From bf41c57dd73c5a183dae0b046bedd2a15ec15dd7 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Mon, 6 Oct 2014 15:15:03 +0200 Subject: 2014-10-06 14:33:00 --- tex/context/base/char-def.lua | 12 ++++ tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4381 -> 4381 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-ini.mkvi | 6 +- tex/context/base/l-lpeg.lua | 72 +++++++++++++++++++++ tex/context/base/l-md5.lua | 64 ++++++++---------- tex/context/base/lpdf-epd.lua | 16 +++-- tex/context/base/math-ini.mkiv | 6 +- tex/context/base/math-stc.mkvi | 18 ++++++ tex/context/base/status-files.pdf | Bin 24731 -> 24741 bytes tex/context/base/status-lua.pdf | Bin 333371 -> 333450 bytes tex/context/base/x-asciimath.lua | 21 +++--- tex/context/base/x-asciimath.mkiv | 17 ++++- tex/context/base/x-mathml.xsd | 6 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 61 ++++++++++++++++- 16 files changed, 238 insertions(+), 65 deletions(-) (limited to 'tex') diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index 84420ae9d..864ca26c4 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -66888,6 +66888,8 @@ characters.data={ linebreak="al", mathclass="topaccent", mathname="overbracket", + mathextensible="h", + mathfiller="overbracketfill", unicodeslot=0x23B4, }, [0x23B5]={ @@ -66897,6 +66899,8 @@ characters.data={ linebreak="al", mathclass="botaccent", mathname="underbracket", + mathextensible="h", + mathfiller="underbracketfill", unicodeslot=0x23B5, }, [0x23B6]={ @@ -67172,6 +67176,8 @@ characters.data={ linebreak="al", mathclass="topaccent", mathname="overparent", + mathextensible="h", + mathfiller="overparentfill", unicodeslot=0x23DC, }, [0x23DD]={ @@ -67181,6 +67187,8 @@ characters.data={ linebreak="al", mathclass="botaccent", mathname="underparent", + mathextensible="h", + mathfiller="underparentfill", unicodeslot=0x23DD, }, [0x23DE]={ @@ -67190,6 +67198,8 @@ characters.data={ linebreak="al", mathclass="topaccent", mathname="overbrace", + mathextensible="h", + mathfiller="overbracefill", unicodeslot=0x23DE, }, [0x23DF]={ @@ -67199,6 +67209,8 @@ characters.data={ linebreak="al", mathclass="botaccent", mathname="underbrace", + mathextensible="h", + mathfiller="underbracefill", unicodeslot=0x23DF, }, [0x23E0]={ diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index b4c6976b4..7700bfe92 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.10.06 00:29} +\newcontextversion{2014.10.06 14:31} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 9069b051b..8a8d11cdd 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index e76ba90d7..cc0df1ac5 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.10.06 00:29} +\edef\contextversion{2014.10.06 14:31} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-ini.mkvi b/tex/context/base/font-ini.mkvi index c427c2f89..f174b132b 100644 --- a/tex/context/base/font-ini.mkvi +++ b/tex/context/base/font-ini.mkvi @@ -2170,7 +2170,7 @@ %D Handy for manuals: \unexpanded\def\fontchar#character% - {\ctxcommand{fontchar("#character")}} + {\ctxcommand{fontchar(\!!bs#character\!!es)}} \unexpanded\def\fontcharbyindex#index% unofficial command, for idris' font building {\ctxcommand{fontcharbyindex(\number#index)}} @@ -2190,12 +2190,12 @@ %D This is an expandable command! \def\tochar#specifications% - {\ctxcommand{tochar("#specifications")}} % expanded (also used in edef) + {\ctxcommand{tochar(\!!bs#specifications\!!es)}} % expanded (also used in edef) %D The next auxilliary macro is an alternative to \type %D {\fontname}. -\def\purefontname#font{\ctxcommand{purefontname("\fontname#font")}} +\def\purefontname#font{\ctxcommand{purefontname(\!!bs\fontname#font\!!es)}} %def\purefontname#font{\ctxcommand{purefontname(\number\fontid#font)}} %D \macros diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index f310bc0fe..3e620a6ca 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -1017,3 +1017,75 @@ lpeg.patterns.stripzeros = stripper -- lpegmatch(stripper,str) -- print(#str, os.clock()-ts, lpegmatch(stripper,sample)) +-- for practical reasone we keep this here: + +local byte_to_HEX = { } +local byte_to_hex = { } +local byte_to_dec = { } -- for md5 +local hex_to_byte = { } + +for i=0,255 do + local H = format("%02X",i) + local h = format("%02x",i) + local d = format("%03i",i) + local c = char(i) + byte_to_HEX[c] = H + byte_to_hex[c] = h + byte_to_dec[c] = d + hex_to_byte[h] = c + hex_to_byte[H] = c +end + +local hextobyte = P(2)/hex_to_byte +local bytetoHEX = P(1)/byte_to_HEX +local bytetohex = P(1)/byte_to_hex +local bytetodec = P(1)/byte_to_dec +local hextobytes = Cs(hextobyte^0) +local bytestoHEX = Cs(bytetoHEX^0) +local bytestohex = Cs(bytetohex^0) +local bytestodec = Cs(bytetodec^0) + +patterns.hextobyte = hextobyte +patterns.bytetoHEX = bytetoHEX +patterns.bytetohex = bytetohex +patterns.bytetodec = bytetodec +patterns.hextobytes = hextobytes +patterns.bytestoHEX = bytestoHEX +patterns.bytestohex = bytestohex +patterns.bytestodec = bytestodec + +function string.toHEX(s) + if not s or s == "" then + return s + else + return lpegmatch(bytestoHEX,s) + end +end + +function string.tohex(s) + if not s or s == "" then + return s + else + return lpegmatch(bytestohex,s) + end +end + +function string.todec(s) + if not s or s == "" then + return s + else + return lpegmatch(bytestodec,s) + end +end + +function string.tobytes(s) + if not s or s == "" then + return s + else + return lpegmatch(hextobytes,s) + end +end + +-- local h = "ADFE0345" +-- local b = lpegmatch(patterns.hextobytes,h) +-- print(h,b,string.tohex(b),string.toHEX(b)) diff --git a/tex/context/base/l-md5.lua b/tex/context/base/l-md5.lua index 8ac20a5a5..00272c873 100644 --- a/tex/context/base/l-md5.lua +++ b/tex/context/base/l-md5.lua @@ -19,48 +19,38 @@ if not md5 then end local md5, file = md5, file -local gsub, format, byte = string.gsub, string.format, string.byte -local md5sum = md5.sum +local gsub = string.gsub -local function convert(str,fmt) - return (gsub(md5sum(str),".",function(chr) return format(fmt,byte(chr)) end)) -end - -if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end -if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end -if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end - --- local P, Cs, lpegmatch = lpeg.P, lpeg.Cs,lpeg.match --- --- if not md5.HEX then --- local function remap(chr) return format("%02X",byte(chr)) end --- function md5.HEX(str) return (gsub(md5.sum(str),".",remap)) end --- end +-- local gsub, format, byte = string.gsub, string.format, string.byte -- --- if not md5.hex then --- local function remap(chr) return format("%02x",byte(chr)) end --- function md5.hex(str) return (gsub(md5.sum(str),".",remap)) end +-- local function convert(str,fmt) +-- return (gsub(md5sum(str),".",function(chr) return format(fmt,byte(chr)) end)) -- end -- --- if not md5.dec then --- local function remap(chr) return format("%03i",byte(chr)) end --- function md5.dec(str) return (gsub(md5.sum(str),".",remap)) end --- end +-- if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end +-- if not md5.hex then function md5.hex(str) return convert(str,"%02x") end end +-- if not md5.dec then function md5.dec(str) return convert(str,"%03i") end end --- if not md5.HEX then --- local pattern_HEX = Cs( ( P(1) / function(chr) return format("%02X",byte(chr)) end)^0 ) --- function md5.HEX(str) return lpegmatch(pattern_HEX,md5.sum(str)) end --- end --- --- if not md5.hex then --- local pattern_hex = Cs( ( P(1) / function(chr) return format("%02x",byte(chr)) end)^0 ) --- function md5.hex(str) return lpegmatch(pattern_hex,md5.sum(str)) end --- end --- --- if not md5.dec then --- local pattern_dec = Cs( ( P(1) / function(chr) return format("%02i",byte(chr)) end)^0 ) --- function md5.dec(str) return lpegmatch(pattern_dec,md5.sum(str)) end --- end +do + + local patterns = lpeg and lpeg.patterns + + if patterns then + + local bytestoHEX = patterns.bytestoHEX + local bytestohex = patterns.bytestohex + local bytestodec = patterns.bytestodec + + local lpegmatch = lpeg.match + local md5sum = md5.sum + + if not md5.HEX then function md5.HEX(str) if str then return lpegmatch(bytestoHEX,md5sum(str)) end end end + if not md5.hex then function md5.hex(str) if str then return lpegmatch(bytestohex,md5sum(str)) end end end + if not md5.dec then function md5.dec(str) if str then return lpegmatch(bytestodec,md5sum(str)) end end end + + end + +end function file.needsupdating(oldname,newname,threshold) -- size modification access change local oldtime = lfs.attributes(oldname,"modification") diff --git a/tex/context/base/lpdf-epd.lua b/tex/context/base/lpdf-epd.lua index 14432d88b..44e1a04c2 100644 --- a/tex/context/base/lpdf-epd.lua +++ b/tex/context/base/lpdf-epd.lua @@ -342,7 +342,8 @@ end -- the getString function gives back bytes so we don't need to worry about -- the hex aspect. -local pattern = lpeg.patterns.utfbom_16_be * lpeg.patterns.utf16_to_utf8_be +local u_pattern = lpeg.patterns.utfbom_16_be * lpeg.patterns.utf16_to_utf8_be +local b_pattern = lpeg.patterns.hextobytes local function get_string(v) -- the toutf function only converts a utf16 string and leves the original @@ -352,12 +353,15 @@ local function get_string(v) if not s or s == "" then return "" end - local r = lpegmatch(pattern,s) - if r then - return r - else - return s, "rawtext" + local u = lpegmatch(u_pattern,s) + if u then + return u -- , "unicode" + end + local b = lpegmatch(b_pattern,s) + if b then + return b, "rawtext" end + return s, "rawtext" end local function get_null() diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index a7b2a924c..fd170d29f 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -298,15 +298,15 @@ \def\utfmathcommand#1{\ctxcommand{utfmathcommand(\!!bs#1\!!es)}} \def\utfmathfiller #1{\ctxcommand{utfmathfiller (\!!bs#1\!!es)}} -\def\utfmathclassfiltered #1#2{\ctxcommand{utfmathclass (\!!bs#1\!!es,nil,"#2")}} -\def\utfmathcommandfiltered#1#2{\ctxcommand{utfmathcommand(\!!bs#1\!!es,nil,"#2")}} +\def\utfmathclassfiltered #1#2{\ctxcommand{utfmathclass (\!!bs#1\!!es,nil,\!!bs#2\!!es)}} +\def\utfmathcommandfiltered#1#2{\ctxcommand{utfmathcommand(\!!bs#1\!!es,nil,\!!bs#2\!!es)}} \def\utfmathcommandabove #1{\ctxcommand{utfmathcommandabove (\!!bs#1\!!es)}} \def\utfmathcommandbelow #1{\ctxcommand{utfmathcommandbelow (\!!bs#1\!!es)}} \def\utfmathcommandfiller#1{\ctxcommand{utfmathcommandfiller(\!!bs#1\!!es)}} \unexpanded\def\doifelseutfmathaccent #1{\ctxcommand{doifelseutfmathaccent(\!!bs#1\!!es)}} -\unexpanded\def\doifelseutfmathaccentfiltered#1#2{\ctxcommand{doifelseutfmathaccent(\!!bs#1\!!es,"#2")}} +\unexpanded\def\doifelseutfmathaccentfiltered#1#2{\ctxcommand{doifelseutfmathaccent(\!!bs#1\!!es,\!!bs#2\!!es)}} \unexpanded\def\doifelseutfmathabove #1{\ctxcommand{doifelseutfmathabove(\!!bs#1\!!es)}} \unexpanded\def\doifelseutfmathbelow #1{\ctxcommand{doifelseutfmathbelow(\!!bs#1\!!es)}} diff --git a/tex/context/base/math-stc.mkvi b/tex/context/base/math-stc.mkvi index ca39287c5..349664891 100644 --- a/tex/context/base/math-stc.mkvi +++ b/tex/context/base/math-stc.mkvi @@ -988,6 +988,15 @@ \definemathextensible [\v!mathematics] [erightharpoondownfill] ["21C1] \definemathextensible [\v!mathematics] [erightharpoonupfill] ["21C0] +\definemathextensible [\v!mathematics] [eoverbarfill] ["FE33E] +\definemathextensible [\v!mathematics] [eunderbarfill] ["FE33F] +\definemathextensible [\v!mathematics] [eoverbracefill] ["FE3DE] +\definemathextensible [\v!mathematics] [eunderbracefill] ["FE3DF] +\definemathextensible [\v!mathematics] [eoverparentfill] ["FE3DC] +\definemathextensible [\v!mathematics] [eunderparentfill] ["FE3DD] +\definemathextensible [\v!mathematics] [eoverbracketfill] ["FE3B4] +\definemathextensible [\v!mathematics] [eunderbracketfill] ["FE3B5] + \definemathextensible [\v!text] [trel] ["002D] \definemathextensible [\v!text] [tequal] ["003D] \definemathextensible [\v!text] [tmapsto] ["21A6] @@ -1170,6 +1179,15 @@ \defineextensiblefiller [Leftrightarrowfill] ["27FA] \defineextensiblefiller [Leftrightarrowfill] ["27FA] +%defineextensiblefiller [overbarfill] ["FE33E] % untested +%defineextensiblefiller [underbarfill] ["FE33F] % untested +\defineextensiblefiller [overbracefill] ["FE3DE] % untested +\defineextensiblefiller [underbracefill] ["FE3DF] % untested +\defineextensiblefiller [overparentfill] ["FE3DC] % untested +\defineextensiblefiller [underparentfill] ["FE3DD] % untested +\defineextensiblefiller [overbracketfill] ["FE3B4] % untested +\defineextensiblefiller [underbracketfill] ["FE3B5] % untested + %D Extra: \unexpanded\edef\singlebond{\mathematics{\mathsurround\zeropoint\char\number"002D}} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 7fb1ecac9..b2dd4be34 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index a9ca8b459..30c0a9f46 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua index 60fbb0b5a..ee4fb5134 100644 --- a/tex/context/base/x-asciimath.lua +++ b/tex/context/base/x-asciimath.lua @@ -108,10 +108,12 @@ local reserved = { ["sqrt"] = "\\rootradical{}", ["root"] = "\\rootradical", ["frac"] = "\\frac", - ["stackrel"] = "\\stackrel", - -- ["text"] = "\\mathoptext", + -- ["stackrel"] = "\\stackrel", + ["stackrel"] = "\\asciimathstackrel", + -- ["text"] = "\\asciimathoptext", -- ["bb"] = "\\bb", ["hat"] = "\\widehat", + ["bar"] = "\\overbar", ["overbar"] = "\\overbar", ["underline"] = "\\underline", ["vec"] = "\\overrightarrow", @@ -660,10 +662,11 @@ local reserved = { } local isbinary = { - ["\\frac"] = true, - ["\\root"] = true, - ["\\rootradical"] = true, - ["\\stackrel"] = true, + ["\\frac"] = true, + ["\\root"] = true, + ["\\rootradical"] = true, + ["\\stackrel"] = true, + ["\\asciimathstackrel"] = true, } local isunary = { @@ -672,8 +675,10 @@ local isunary = { -- ["\\bb"] = true, ["\\text"] = true, -- mathoptext ["\\mathoptext"] = true, -- mathoptext + ["\\asciimathoptext"]= true, -- mathoptext ["\\hat"] = true, -- widehat ["\\widehat"] = true, -- widehat + ["\\bar"] = true, -- ["\\overbar"] = true, -- ["\\underline"] = true, -- ["\\vec"] = true, -- overrightarrow @@ -785,12 +790,12 @@ local p_reserved = local p_text = P("text") * p_spaces^0 - * Cc("\\mathoptext") + * Cc("\\asciimathoptext") * ( -- maybe balanced Cs( P("{") * (1-P("}"))^0 * P("}") ) + Cs((P("(")/"{") * (1-P(")"))^0 * (P(")")/"}")) ) - + Cc("\\mathoptext") * Cs(Cc("{") * patterns.undouble * Cc("}")) + + Cc("\\asciimathoptext") * Cs(Cc("{") * patterns.undouble * Cc("}")) -- either map to \left or map to \left\name diff --git a/tex/context/base/x-asciimath.mkiv b/tex/context/base/x-asciimath.mkiv index acdcae64a..6a9595a59 100644 --- a/tex/context/base/x-asciimath.mkiv +++ b/tex/context/base/x-asciimath.mkiv @@ -119,11 +119,25 @@ %D %D In retrospect I sometimes wonder if the energy put into constantly adapting to %D the fashion of the day pays off. Probably not. It definitely doesn't pay of. +%D +%D More complex crap: +%D +%D 1: $x + \stackrel{comment}{\stackrel{\utfchar{"23DE}}{yyyyyyyy}} = y$ \blank +%D 2: \asciimath{x + stackrel{\utfchar{"23DE}}{yyyyyyyy} = y} \blank +%D 3: \asciimath{x + stackrel{yyyyyyyy}{\utfchar{"23DE}} = y} \blank +%D 4: \asciimath{x + stackrel{"comment"}{stackrel{\utfchar{"23DE}}{yyyyyyyy}} = y} \blank \unprotect \writestatus{asciimath}{beware, this is an experimental (m4all only) module} +%D Hacks: + +\unexpanded\def\asciimathoptext #1{\ifmmode\mathop{\text{#1}}\else#1\fi} +\unexpanded\def\asciimathoptexttraced#1{\ifmmode\mathop{\text{\color[darkgreen]{#1}}}\else\color[darkgreen]{#1}\fi} + +\unexpanded\def\asciimathstackrel #1#2{\mathematics{\mathop{\let\limits\relax\mover{#2}{#1}}}} + %D The core commands: \unexpanded\def\asciimath#1% @@ -168,8 +182,7 @@ \unexpanded\def\ShowAsciiMathStart {\begingroup - \let\normalmathoptext\mathoptext - \unexpanded\def\mathoptext##1{\normalmathoptext{\color[darkgreen]{##1}}}% + \let\asciimathoptext\asciimathoptexttraced \setuptyping[\v!buffer][\c!before=,\c!after=] \setupmargindata[\v!left][\c!style=]} diff --git a/tex/context/base/x-mathml.xsd b/tex/context/base/x-mathml.xsd index 17f0bea2a..1c29452b0 100644 --- a/tex/context/base/x-mathml.xsd +++ b/tex/context/base/x-mathml.xsd @@ -3,9 +3,9 @@ - + - - + + diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index efbac3f25..69a9d5a3c 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 10/06/14 00:29:22 +-- merge date : 10/06/14 14:31:35 do -- begin closure to overcome local limits and interference @@ -733,6 +733,65 @@ local case_2=period*(digit-trailingzeros)^1*(trailingzeros/"") local number=digit^1*(case_1+case_2) local stripper=Cs((number+1)^0) lpeg.patterns.stripzeros=stripper +local byte_to_HEX={} +local byte_to_hex={} +local byte_to_dec={} +local hex_to_byte={} +for i=0,255 do + local H=format("%02X",i) + local h=format("%02x",i) + local d=format("%03i",i) + local c=char(i) + byte_to_HEX[c]=H + byte_to_hex[c]=h + byte_to_dec[c]=d + hex_to_byte[h]=c + hex_to_byte[H]=c +end +local hextobyte=P(2)/hex_to_byte +local bytetoHEX=P(1)/byte_to_HEX +local bytetohex=P(1)/byte_to_hex +local bytetodec=P(1)/byte_to_dec +local hextobytes=Cs(hextobyte^0) +local bytestoHEX=Cs(bytetoHEX^0) +local bytestohex=Cs(bytetohex^0) +local bytestodec=Cs(bytetodec^0) +patterns.hextobyte=hextobyte +patterns.bytetoHEX=bytetoHEX +patterns.bytetohex=bytetohex +patterns.bytetodec=bytetodec +patterns.hextobytes=hextobytes +patterns.bytestoHEX=bytestoHEX +patterns.bytestohex=bytestohex +patterns.bytestodec=bytestodec +function string.toHEX(s) + if not s or s=="" then + return s + else + return lpegmatch(bytestoHEX,s) + end +end +function string.tohex(s) + if not s or s=="" then + return s + else + return lpegmatch(bytestohex,s) + end +end +function string.todec(s) + if not s or s=="" then + return s + else + return lpegmatch(bytestodec,s) + end +end +function string.tobytes(s) + if not s or s=="" then + return s + else + return lpegmatch(hextobytes,s) + end +end end -- closure -- cgit v1.2.3