diff options
author | Hans Hagen <pragma@wxs.nl> | 2009-09-15 12:27:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2009-09-15 12:27:00 +0200 |
commit | 2527b228386c22af57e3d72a739c74930fd09eb6 (patch) | |
tree | 34994fdc3f4798fc638a7c7668872cacae827248 /tex/context/base/mult-cld.lua | |
parent | b6f05180d27bb8e4cb3e570633f16185eba987fe (diff) | |
download | context-2527b228386c22af57e3d72a739c74930fd09eb6.tar.gz |
beta 2009.09.15 12:27
Diffstat (limited to 'tex/context/base/mult-cld.lua')
-rw-r--r-- | tex/context/base/mult-cld.lua | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/tex/context/base/mult-cld.lua b/tex/context/base/mult-cld.lua index 10ca5e1d2..257921cb1 100644 --- a/tex/context/base/mult-cld.lua +++ b/tex/context/base/mult-cld.lua @@ -19,11 +19,15 @@ context = context or { } local format, concat = string.format, table.concat local next, type = next, type -local texsprint, texiowrite = tex.sprint, texio.write +local texsprint, texiowrite, ctxcatcodes = tex.sprint, texio.write, tex.ctxcatcodes local flush = texsprint local cache +function tex.fprint(...) -- goodie + texsprint(ctxcatcodes,format(...)) +end + local function cached_flush(c,...) local tt = { ... } for i=1,#tt do @@ -31,6 +35,17 @@ local function cached_flush(c,...) end end +function context.trace(intercept) + local normalflush = flush + flush = function(c,...) + logs.report("context",concat({...})) + if not intercept then + normalflush(c,...) + end + end + context.trace = function() end +end + local function writer(k,...) flush(ctxcatcodes,k) local t = { ... } @@ -38,21 +53,24 @@ local function writer(k,...) for i=1,#t do local ti = t[i] local typ, force = type(ti), nil + local saved_flush = flush + flush = cached_flush while typ == "function" do - local saved_flush = flush cache = { } - flush = cached_flush ti, force = ti() if force then typ = false -- force special cases - elseif typ == "nil" then - typ = "string" - ti = concat(cache) - elseif typ == "string" then - ti = concat(cache) + else + typ = type(ti) + if typ == "nil" then + typ = "string" + ti = concat(cache) + elseif typ == "string" then + ti = concat(cache) + end end - flush = saved_flush end + flush = saved_flush if ti == nil then -- next elseif typ == "string" or typ == "number" then |