diff options
Diffstat (limited to 'tex/context/base')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/buff-ini.lua | 72 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/grph-fig.mkiv | 9 | ||||
-rw-r--r-- | tex/context/base/mkiv/math-fen.mkiv | 7 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 25647 -> 25637 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 422616 -> 422699 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/util-sbx.lua | 13 |
10 files changed, 84 insertions, 25 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 74e8c6681..2dd5d3783 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.03.23 17:20} +\newcontextversion{2017.03.24 19:06} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index e4c100754..5c88b9193 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.03.23 17:20} +\edef\contextversion{2017.03.24 19:06} %D For those who want to use this: diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua index 2b3270300..a2f8914ff 100644 --- a/tex/context/base/mkiv/buff-ini.lua +++ b/tex/context/base/mkiv/buff-ini.lua @@ -14,6 +14,9 @@ local P, Cs, patterns, lpegmatch = lpeg.P, lpeg.Cs, lpeg.patterns, lpeg.match local utfchar = utf.char local nameonly = file.nameonly local totable = string.totable +local md5hex = md5.hex +local isfile = lfs.isfile +local savedata = io.savedata local trace_run = false trackers.register("buffers.run", function(v) trace_run = v end) local trace_grab = false trackers.register("buffers.grab", function(v) trace_grab = v end) @@ -62,6 +65,9 @@ local catcodenumbers = catcodes.numbers local ctxcatcodes = catcodenumbers.ctxcatcodes local txtcatcodes = catcodenumbers.txtcatcodes +local setdata = job.datasets.setdata +local getdata = job.datasets.getdata + buffers = buffers or { } local buffers = buffers @@ -486,6 +492,7 @@ implement { local oldhashes = nil local newhashes = nil +local getrunner = sandbox.getrunner local runner = sandbox.registerrunner { name = "run buffer", @@ -498,23 +505,46 @@ local runner = sandbox.registerrunner { } } -local function runbuffer(name,encapsulate) +local function runbuffer(name,encapsulate,runnername,suffix,extra) + if not runnername or runnername == "" then + runnername = "run buffer" + end + if not suffix or suffix == "" then + suffix = "pdf" + end + local runner = getrunner(runnername) + if not runner then + report_typeset("unknown runner %a",runnername) + return + end if not oldhashes then - oldhashes = job.datasets.getdata("typeset buffers","hashes") or { } - for hash, n in next, oldhashes do - local tag = formatters["%s-t-b-%s"](tex.jobname,hash) - registertempfile(addsuffix(tag,"tmp")) -- to be sure - registertempfile(addsuffix(tag,"pdf")) - end + oldhashes = getdata("typeset buffers","hashes") or { } + end + if not newhashes then newhashes = { - version = environment.version, + version = environment.version } - job.datasets.setdata { + setdata { name = "typeset buffers", tag = "hashes", data = newhashes, } end + local old = oldhashes[suffix] + local new = newhashes[suffix] + if not old then + old = { } + oldhashes[suffix] = old + for hash, n in next, old do + local tag = formatters["%s-t-b-%s"](tex.jobname,hash) + registertempfile(addsuffix(tag,"tmp")) -- to be sure + registertempfile(addsuffix(tag,suffix)) + end + end + if not new then + new = { } + newhashes[suffix] = new + end local names = getnames(name) local content = collectcontent(names,nil) or "" if content == "" then @@ -524,23 +554,23 @@ local function runbuffer(name,encapsulate) content = formatters["\\starttext\n%s\n\\stoptext\n"](content) end -- - local hash = md5.hex(content) + local hash = md5hex(content) local tag = formatters["%s-t-b-%s"](nameonly(tex.jobname),hash) -- make sure we run on the local path -- local filename = addsuffix(tag,"tmp") - local resultname = addsuffix(tag,"pdf") + local resultname = addsuffix(tag .. (extra or ""),suffix) -- - if newhashes[hash] then + if new[hash] then -- done - elseif not oldhashes[hash] or oldhashes.version ~= newhashes.version or not lfs.isfile(resultname) then + elseif not old[hash] or oldhashes.version ~= newhashes.version or not isfile(resultname) then if trace_run then report_typeset("changes in %a, processing forced",name) end - io.savedata(filename,content) + savedata(filename,content) report_typeset("processing saved buffer %a\n",filename) runner { filename = filename } end - newhashes[hash] = (newhashes[hash] or 0) + 1 + new[hash] = (new[hash] or 0) + 1 report_typeset("no changes in %a, processing skipped",name) registertempfile(filename) registertempfile(resultname,nil,true) @@ -575,18 +605,26 @@ local function gettexbuffer(name) end end +buffers.run = runbuffer + implement { name = "getbufferctxlua", actions = loadcontent, arguments = "string" } implement { name = "getbuffer", actions = getbuffer, arguments = "string" } implement { name = "getbuffermkvi", actions = getbuffermkvi, arguments = "string" } implement { name = "gettexbuffer", actions = gettexbuffer, arguments = "string" } implement { - name = "runbuffer", + name = "typesetbuffer", actions = { runbuffer, context }, arguments = { "string", true } } implement { + name = "runbuffer", + actions = { runbuffer, context }, + arguments = { "string", false, "string" } +} + +implement { name = "doifelsebuffer", actions = { exists, commands.doifelse }, arguments = "string" @@ -623,4 +661,4 @@ do stopcollecting() end - end +end diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index ae8d8b1f0..e382b6282 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.03.23 17:20} +\newcontextversion{2017.03.24 19:06} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 940c5de76..4012e29dd 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.03.23 17:20} +\edef\contextversion{2017.03.24 19:06} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/grph-fig.mkiv b/tex/context/base/mkiv/grph-fig.mkiv index 80b094d83..1fdc0caa0 100644 --- a/tex/context/base/mkiv/grph-fig.mkiv +++ b/tex/context/base/mkiv/grph-fig.mkiv @@ -53,7 +53,7 @@ \fi\fi} \def\grph_buffers_typeset_indeed[#1][#2]% we could use the via files - {\doifnot{#1}{*}{\xdef\lasttypesetbuffer{\clf_runbuffer{#1}}}% + {\doifnot{#1}{*}{\xdef\lasttypesetbuffer{\clf_typesetbuffer{#1}}}% \ifcase\c_grph_buffers_mode % typesetonly \or @@ -61,6 +61,13 @@ \fi \egroup} +\unexpanded\def\runbuffer % for now + {\dotripleempty\grph_buffers_run_indeed} + +\def\grph_buffers_run_indeed[#1][#2]% + {\xdef\lasttypesetbuffer{\clf_runbuffer{#1}{#2}}} + + % For manuals and such: % % \definetypesetting [name] [options] [settings-a] diff --git a/tex/context/base/mkiv/math-fen.mkiv b/tex/context/base/mkiv/math-fen.mkiv index 9c856904e..320dffeb8 100644 --- a/tex/context/base/mkiv/math-fen.mkiv +++ b/tex/context/base/mkiv/math-fen.mkiv @@ -44,7 +44,7 @@ \c!mathstyle=, \c!color=, \c!command=, - \c!factor=] % == auto == none + \c!factor=\v!auto] \appendtoks \edef\p_command{\mathfenceparameter\c!command}% @@ -64,10 +64,11 @@ \edef\p_factor{\mathfenceparameter\c!factor}% \ifx\p_factor\empty #2% - \else\ifx\p_factor\v!none - #2% \else\ifx\p_factor\v!auto #2% + \else\ifx\p_factor\v!none + #3\s!height\zeropoint\s!depth\zeropoint\s!axis + #2% \else \scratchdimen\dimexpr\p_factor\bodyfontsize/2\relax #3\s!height\scratchdimen\s!depth\scratchdimen\s!axis diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 0490d86ec..9fdfe1ddd 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 61a645e8a..b5e8cb4fd 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/util-sbx.lua b/tex/context/base/mkiv/util-sbx.lua index 0db2e0295..66a650875 100644 --- a/tex/context/base/mkiv/util-sbx.lua +++ b/tex/context/base/mkiv/util-sbx.lua @@ -369,6 +369,9 @@ local runners = { resultof = function(...) local command = validcommand(...) if command then + if trace then + report("resultof: %s",command) + end local handle = iopopen(command,"r") -- already has flush if handle then local result = handle:read("*all") or "" @@ -380,12 +383,18 @@ local runners = { execute = function(...) local command = validcommand(...) if command then + if trace then + report("execute: %s",command) + end return osexecute(command) end end, pipeto = function(...) local command = validcommand(...) if command then + if trace then + report("pipeto: %s",command) + end return iopopen(command,"w") -- already has flush end end, @@ -447,6 +456,10 @@ function sandbox.registerrunner(specification) end end +function sandbox.getrunner(name) + return name and validrunners[name] +end + local function suspicious(str) return (find(str,"[/\\]") or find(command,"%.%.")) and true or false end |