From a6bce84a9da1f7e127c8434fba6c040b3cd5696e Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 10 Sep 2013 18:00:25 +0300 Subject: beta 2013.09.10 16:50 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4111 -> 4109 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/mlib-pdf.lua | 47 ++++++++++++++++++--- tex/context/base/mult-fun.lua | 2 + tex/context/base/status-files.pdf | Bin 24769 -> 24758 bytes tex/context/base/status-lua.log | 2 +- tex/context/base/typo-dir.lua | 2 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 9 files changed, 50 insertions(+), 9 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 869a9987b..bc6eca7b7 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{2013.09.10 13:58} +\newcontextversion{2013.09.10 16:50} %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 d53ad1639..0bc759237 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 0d72af759..8d744fa13 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.09.10 13:58} +\edef\contextversion{2013.09.10 16:50} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua index 963309951..1e3f4ef49 100644 --- a/tex/context/base/mlib-pdf.lua +++ b/tex/context/base/mlib-pdf.lua @@ -10,8 +10,9 @@ if not modules then modules = { } end modules ['mlib-pdf'] = { local format, concat, gsub = string.format, table.concat, string.gsub local abs, sqrt, round = math.abs, math.sqrt, math.round -local setmetatable = setmetatable -local Cf, C, Cg, Ct, P, S, lpegmatch = lpeg.Cf, lpeg.C, lpeg.Cg, lpeg.Ct, lpeg.P, lpeg.S, lpeg.match +local setmetatable, rawset, tostring, tonumber, type = setmetatable, rawset, tostring, tonumber, type +local P, S, C, Ct, Cc, Cg, Cf, Carg = lpeg.P, lpeg.S, lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.Cg, lpeg.Cf, lpeg.Carg +local lpegmatch = lpeg.match local formatters = string.formatters local report_metapost = logs.reporter("metapost") @@ -268,7 +269,39 @@ metapost.flushnormalpath = flushnormalpath -- performance penalty, but so is passing extra arguments (result, flusher, after) -- and returning stuff. -local function ignore() end +local ignore = function () end + +local space = P(" ") +local equal = P("=") +local key = C((1-equal)^1) * equal +local newline = S("\n\r")^1 +local number = (((1-space-newline)^1) / tonumber) * (space^0) +local variable = + lpeg.P("1:") * key * number + + lpeg.P("2:") * key * C((1-newline)^0) + + lpeg.P("3:") * key * (P("false") * Cc(false) + P("true") * Cc(true)) + + lpeg.S("456") * P(":") * key * Ct(number^1) + + lpeg.P("7:") * key * Ct(Ct(number * number^-5)^1) + +local pattern = Cf ( Carg(1) * (Cg(variable * newline^0)^0), rawset) + +metapost.variables = { } +metapost.llx = 0 +metapost.lly = 0 +metapost.urx = 0 +metapost.ury = 0 + +function commands.mprunvar(key) + local value = variables and variables[key] + local vtype = type(value) + if tvalue == "table" then + context(concat(value," ")) + elseif tvalue == "number" or tvalue == "boolean" then + context(concat(value,tostring(value))) + elseif tvalue == "string" then + context(concat(value," ")) + end +end function metapost.flush(result,flusher,askedfig) if result then @@ -283,7 +316,7 @@ function metapost.flush(result,flusher,askedfig) local stopfigure = flusher.stopfigure local flushfigure = flusher.flushfigure local textfigure = flusher.textfigure - for f=1, #figures do + for f=1,#figures do local figure = figures[f] local objects = getobjects(result,figure,f) local fignum = figure:charcode() or 0 @@ -292,10 +325,12 @@ function metapost.flush(result,flusher,askedfig) local miterlimit, linecap, linejoin, dashed = -1, -1, -1, false local bbox = figure:boundingbox() local llx, lly, urx, ury = bbox[1], bbox[2], bbox[3], bbox[4] + local variables = { } metapost.llx = llx metapost.lly = lly metapost.urx = urx metapost.ury = ury + metapost.variables = variables if urx < llx then -- invalid startfigure(fignum,0,0,0,0,"invalid",figure) @@ -308,8 +343,10 @@ function metapost.flush(result,flusher,askedfig) for o=1,#objects do local object = objects[o] local objecttype = object.type - if objecttype == "start_bounds" or objecttype == "stop_bounds" or objecttype == "special" then + if objecttype == "start_bounds" or objecttype == "stop_bounds" then -- skip + elseif objecttype == "special" then + lpegmatch(pattern,object.prescript,1,variables) elseif objecttype == "start_clip" then t[#t+1] = "q" flushnormalpath(object.path,t,false) diff --git a/tex/context/base/mult-fun.lua b/tex/context/base/mult-fun.lua index a661c53bb..36650183a 100644 --- a/tex/context/base/mult-fun.lua +++ b/tex/context/base/mult-fun.lua @@ -97,5 +97,7 @@ return { "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", -- "decorated", "redecorated", "undecorated", + -- + "passvariable", }, } diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index cf5faa092..f6f078e45 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.log b/tex/context/base/status-lua.log index d46d55954..339dc72cf 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.09.10 13:58 MKIV beta fmt: 2013.9.10 int: english/english +ConTeXt ver: 2013.09.10 16:50 MKIV beta fmt: 2013.9.10 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/typo-dir.lua b/tex/context/base/typo-dir.lua index e155e7314..aa6eb2eeb 100644 --- a/tex/context/base/typo-dir.lua +++ b/tex/context/base/typo-dir.lua @@ -52,6 +52,8 @@ local texsetattribute = tex.setattribute local texsetcount = tex.setcount local unsetvalue = attributes.unsetvalue +local hasbit = number.hasbit + local nodecodes = nodes.nodecodes local whatcodes = nodes.whatcodes local mathcodes = nodes.mathcodes diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e0d09e7e6..88f94b647 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 : 09/10/13 13:58:23 +-- merge date : 09/10/13 16:50:05 do -- begin closure to overcome local limits and interference -- cgit v1.2.3