diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-11-11 19:43:54 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-11-11 19:43:54 +0100 |
commit | e1968f3ee77c1485c06a567aed0bc0e2eb5c7d01 (patch) | |
tree | e6664e73334ac677241feb04244580b2f22c92c3 /tex/context/base/mkxl/buff-ini.lmt | |
parent | 70deb1dc5cd7c0546dd864ca91a8fa0b97e31533 (diff) | |
download | context-e1968f3ee77c1485c06a567aed0bc0e2eb5c7d01.tar.gz |
2021-11-11 19:21:00
Diffstat (limited to 'tex/context/base/mkxl/buff-ini.lmt')
-rw-r--r-- | tex/context/base/mkxl/buff-ini.lmt | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt index 0b54f81ac..2cde7c72b 100644 --- a/tex/context/base/mkxl/buff-ini.lmt +++ b/tex/context/base/mkxl/buff-ini.lmt @@ -678,7 +678,7 @@ implement { if doundent or (autoundent and doundent == nil) then data = undent(data) end - buffers.assign(name,data,catcodes) + assign(name,data,catcodes) context[finish]() end } @@ -954,3 +954,79 @@ implement { actions = buffers.samplefile, arguments = "string" } + +-- A somewhat strange place (for now) so the *.log definitions might move someplace +-- else (if useful at all). + +-- Handy for the math test suite that Mikael Sundqvist and I are making where we +-- need to track box content as well as some low level math tracing features, so +-- we can pipe to buffers (via a temporary file). + +do + + local insert, remove = table.insert, table.remove + local setlogfile = texio.setlogfile + local openfile = io.open + + local stack = { } + local files = { } + + local function resetlogfile(name) + files[name] = false + end + + local function pushlogfile(name) + local f = openfile(name,files[name] and "ab" or "wb") + insert(stack,f) + files[name] = true + setlogfile(f) + end + + local function poplogfile() + remove(stack) + setlogfile(stack[#stack]) + end + + logs.pushlogfile = pushlogfile + logs.poplogfile = poplogfile + logs.resetlogfile = resetlogfile + + implement { + name = "resetlogfile", + arguments = "argument", + public = true, + protected = true, + actions = resetlogfile, + } + + implement { + name = "pushlogfile", + arguments = "argument", + public = true, + protected = true, + actions = pushlogfile, + } + + implement { + name = "poplogfile", + public = true, + protected = true, + actions = poplogfile, + } + + -- In the end we went for a somewhat hidden low level one (see low level math tests + -- for usage): + + local showbox = tex.showbox + + implement { + name = "showboxinbuffer", + public = true, + protected = true, + arguments = { "argument", "integer", "integer" }, + actions = function(buffer, box, detail) + assign(buffer or "",showbox(box, detail)) + end, + } + +end |