From 471adab575a305cb8c52614be3bd54e488e35c73 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Thu, 21 Aug 2014 10:15:04 +0200 Subject: 2014-08-21 09:58:00 --- tex/context/base/char-tex.lua | 6 +-- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4437 -> 4439 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/file-mod.lua | 6 +-- tex/context/base/l-unicode.lua | 46 +++++++++++++----- tex/context/base/lxml-tab.lua | 54 ++++++++++++++++----- tex/context/base/lxml-tex.lua | 3 +- tex/context/base/mult-fun.lua | 1 + tex/context/base/mult-mps.lua | 3 +- tex/context/base/status-files.pdf | Bin 25007 -> 24967 bytes tex/context/base/status-lua.pdf | Bin 327043 -> 327042 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 13 files changed, 89 insertions(+), 36 deletions(-) (limited to 'tex') diff --git a/tex/context/base/char-tex.lua b/tex/context/base/char-tex.lua index 3aba53986..5ca8eea05 100644 --- a/tex/context/base/char-tex.lua +++ b/tex/context/base/char-tex.lua @@ -98,9 +98,9 @@ function utffilters.soften(str) return lpegmatch(tolow,str) end -private.escape = utf.remapper(escapes) -private.replace = utf.remapper(low) -private.revert = utf.remapper(high) +private.escape = utf.remapper(escapes) -- maybe: ,"dynamic" +private.replace = utf.remapper(low) -- maybe: ,"dynamic" +private.revert = utf.remapper(high) -- maybe: ,"dynamic" --[[ldx--

We get a more efficient variant of this when we integrate diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 84642185f..b8f942ea2 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.08.19 11:57} +\newcontextversion{2014.08.21 09:56} %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 caf2c1abc..3e7a37603 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 01bb35232..f5a1dce60 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.08.19 11:57} +\edef\contextversion{2014.08.21 09:56} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/file-mod.lua b/tex/context/base/file-mod.lua index 550e1eb19..bf369d035 100644 --- a/tex/context/base/file-mod.lua +++ b/tex/context/base/file-mod.lua @@ -101,7 +101,7 @@ function commands.usemodules(prefix,askedname,truename) local truename = truename or environment.truefilename(askedname) local hasprefix = prefix and prefix ~= "" local hashname = ((hasprefix and prefix) or "*") .. "-" .. truename - local status = modstatus[hashname] + local status = modstatus[hashname] or false -- yet unset if status == 0 then -- not found elseif status == 1 then @@ -139,9 +139,7 @@ function commands.usemodules(prefix,askedname,truename) -- assume a user namespace report_modules("using user prefixed file %a",truename) status = 1 - elseif not permit_unprefixed then - -- forget about it - elseif usemodule(truename) then + elseif permit_unprefixed and usemodule(truename) then report_modules("using unprefixed file %a",truename) status = 1 else diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua index fb4ea37fa..d75779267 100644 --- a/tex/context/base/l-unicode.lua +++ b/tex/context/base/l-unicode.lua @@ -525,23 +525,45 @@ end -- end, pattern -- end -function utf.remapper(mapping) - local pattern = type(mapping) == "table" and tabletopattern(mapping) or p_utf8char - local pattern = Cs((pattern/mapping + p_utf8char)^0) - return function(str) - if not str or str == "" then - return "" +function utf.remapper(mapping,option) -- static also returns a pattern + if type(mapping) == "table" then + if option == "dynamic" then + local pattern = false + table.setmetatablenewindex(mapping,function(t,k,v) rawset(t,k,v) pattern = false end) + return function(str) + if not str or str == "" then + return "" + else + if not pattern then + pattern = Cs((tabletopattern(mapping)/mapping + p_utf8char)^0) + end + return lpegmatch(pattern,str) + end + end + elseif option == "pattern" then + return Cs((tabletopattern(mapping)/mapping + p_utf8char)^0) + -- elseif option == "static" then else - return lpegmatch(pattern,str) + local pattern = Cs((tabletopattern(mapping)/mapping + p_utf8char)^0) + return function(str) + if not str or str == "" then + return "" + else + return lpegmatch(pattern,str) + end + end, pattern + end + else + -- is actually an error + return function(str) + return str or "" end - end, pattern + end end -- local remap = utf.remapper { a = 'd', b = "c", c = "b", d = "a" } -- print(remap("abcd 1234 abcd")) --- - function utf.replacer(t) -- no precheck, always string builder local r = replacer(t,false,false,true) return function(str) @@ -954,8 +976,8 @@ end -- end -- end -local _, l_remap = utf.remapper(little) -local _, b_remap = utf.remapper(big) +local l_remap = utf.remapper(little,"pattern") +local b_remap = utf.remapper(big,"pattern") function utf.utf8_to_utf16_be(str,nobom) if nobom then diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua index 8b34a96a3..369ac91c7 100644 --- a/tex/context/base/lxml-tab.lua +++ b/tex/context/base/lxml-tab.lua @@ -42,10 +42,10 @@ local xml = xml --~ local xml = xml local concat, remove, insert = table.concat, table.remove, table.insert -local type, next, setmetatable, getmetatable, tonumber = type, next, setmetatable, getmetatable, tonumber +local type, next, setmetatable, getmetatable, tonumber, rawset = type, next, setmetatable, getmetatable, tonumber, rawset local lower, find, match, gsub = string.lower, string.find, string.match, string.gsub local utfchar = utf.char -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local P, S, R, C, V, C, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.C, lpeg.Cs local formatters = string.formatters @@ -325,12 +325,13 @@ end -- one level expansion (simple case), no checking done -local rest = (1-P(";"))^0 -local many = P(1)^0 +local p_rest = (1-P(";"))^0 +local p_many = P(1)^0 +local p_char = lpegpatterns.utf8character local parsedentity = - P("&") * (P("#x")*(rest/fromhex) + P("#")*(rest/fromdec)) * P(";") * P(-1) + - (P("#x")*(many/fromhex) + P("#")*(many/fromdec)) + P("&") * (P("#x")*(p_rest/fromhex) + P("#")*(p_rest/fromdec)) * P(";") * P(-1) + + (P("#x")*(p_many/fromhex) + P("#")*(p_many/fromdec)) -- parsing in the xml file @@ -367,7 +368,41 @@ local privates_n = { -- keeps track of defined ones } -local escaped = utf.remapper(privates_u) +-- -- local escaped = utf.remapper(privates_u) -- can't be used as it freezes +-- -- local unprivatized = utf.remapper(privates_p) -- can't be used as it freezes +-- +-- local p_privates_u = false +-- local p_privates_p = false +-- +-- table.setmetatablenewindex(privates_u,function(t,k,v) rawset(t,k,v) p_privates_u = false end) +-- table.setmetatablenewindex(privates_p,function(t,k,v) rawset(t,k,v) p_privates_p = false end) +-- +-- local function escaped(str) +-- if not str or str == "" then +-- return "" +-- else +-- if not p_privates_u then +-- p_privates_u = Cs((lpeg.utfchartabletopattern(privates_u)/privates_u + p_char)^0) +-- end +-- return lpegmatch(p_privates_u,str) +-- end +-- end +-- +-- local function unprivatized(str) +-- if not str or str == "" then +-- return "" +-- else +-- if not p_privates_p then +-- p_privates_p = Cs((lpeg.utfchartabletopattern(privates_p)/privates_p + p_char)^0) +-- end +-- return lpegmatch(p_privates_p,str) +-- end +-- end + +local escaped = utf.remapper(privates_u,"dynamic") +local unprivatized = utf.remapper(privates_p,"dynamic") + +xml.unprivatized = unprivatized local function unescaped(s) local p = privates_n[s] @@ -382,10 +417,7 @@ local function unescaped(s) return p end -local unprivatized = utf.remapper(privates_p) - xml.privatetoken = unescaped -xml.unprivatized = unprivatized xml.privatecodes = privates_n local function handle_hex_entity(str) @@ -546,7 +578,7 @@ local valid = R('az', 'AZ', '09') + S('_-.') local name_yes = C(valid^1) * colon * C(valid^1) local name_nop = C(P(true)) * C(valid^1) local name = name_yes + name_nop -local utfbom = lpeg.patterns.utfbom -- no capture +local utfbom = lpegpatterns.utfbom -- no capture local spacing = C(space^0) ----- entitycontent = (1-open-semicolon)^0 diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index 700259f4e..c27d4ed40 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -21,7 +21,6 @@ local tex, xml = tex, xml local lowerchars, upperchars, lettered = characters.lower, characters.upper, characters.lettered local basename, dirname, joinfile = file.basename, file.dirname, file.join - lxml = lxml or { } local lxml = lxml @@ -72,7 +71,7 @@ lxml.entities = lxml.entities or { } storage.register("lxml/entities",lxml.entities,"lxml.entities") ---~ xml.placeholders.unknown_any_entity = nil -- has to be per xml +-- xml.placeholders.unknown_any_entity = nil -- has to be per xml local xmlentities = xml.entities local texentities = lxml.entities diff --git a/tex/context/base/mult-fun.lua b/tex/context/base/mult-fun.lua index 846a50ddf..3d511b18d 100644 --- a/tex/context/base/mult-fun.lua +++ b/tex/context/base/mult-fun.lua @@ -14,6 +14,7 @@ return { "maxdimensions", }, commands = { + "transparency", -- "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", diff --git a/tex/context/base/mult-mps.lua b/tex/context/base/mult-mps.lua index 717536fbf..cf4fb4d38 100644 --- a/tex/context/base/mult-mps.lua +++ b/tex/context/base/mult-mps.lua @@ -32,7 +32,7 @@ return { "tertiary", "primarydef", "secondarydef", "tertiarydef", "randomseed", "also", "contour", "doublepath", "withcolor", "withcmykcolor", "withpen", "dashed", "if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "within", - "forsuffixes", "downto", "upto", "step", "until", + "forsuffixes", "step", "until", "charlist", "extensible", "fontdimen", "headerbyte", "kern", "ligtable", "boundarychar", "chardp", "charext", "charht", "charic", "charwd", "designsize", "fontmaking", "charexists", @@ -64,6 +64,7 @@ return { "runscript", }, commands = { + "upto", "downto", "beginfig", "endfig", "beginglyph", "endglyph", "charscale", "rotatedaround", "reflectedabout", diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 3969f8073..df96a33dc 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 7d88c08a4..7b82e3f2c 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index d6e7a2480..0dfbe4b49 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 : 08/19/14 11:57:06 +-- merge date : 08/21/14 09:56:44 do -- begin closure to overcome local limits and interference -- cgit v1.2.3