diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-08 00:43:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-08 00:43:40 +0000 |
commit | 824f7b0903de8ad7f6ee3d7656005e4c59155e06 (patch) | |
tree | abfc8673ef9916f3ab7074e811207384c301492b /Master/texmf-dist/tex/context/base/luat-cbk.lua | |
parent | 689aefb0727676ed3cddf331337b4be226495e72 (diff) |
context import for TL13, from www.pragma-ade.com/context/beta/cont-tmf.zip
git-svn-id: svn://tug.org/texlive/trunk@29731 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/luat-cbk.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/luat-cbk.lua | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/context/base/luat-cbk.lua b/Master/texmf-dist/tex/context/base/luat-cbk.lua index 6622c64cd8c..f8c6926f075 100644 --- a/Master/texmf-dist/tex/context/base/luat-cbk.lua +++ b/Master/texmf-dist/tex/context/base/luat-cbk.lua @@ -34,10 +34,13 @@ functions.</p> local trace_callbacks = false trackers.register("system.callbacks", function(v) trace_callbacks = v end) local trace_calls = false -- only used when analyzing performance and initializations -local register_callback, find_callback, list_callbacks = callback.register, callback.find, callback.list +local register_callback = callback.register +local find_callback = callback.find +local list_callbacks = callback.list + local frozen, stack, list = { }, { }, callbacks.list -if not callbacks.list then -- otherwise counters get reset +if not list then -- otherwise counters get reset list = utilities.storage.allocate(list_callbacks()) @@ -80,11 +83,11 @@ if trace_calls then end local function frozen_message(what,name) - report_callbacks("not %s frozen '%s' (%s)",what,name,frozen[name]) + report_callbacks("not %s frozen %a to %a",what,name,frozen[name]) end local function frozen_callback(name) - return nil, format("callback '%s' is frozen (%s)",name,frozen[name]) + return nil, format("callback '%s' is frozen to '%s'",name,frozen[name]) -- no formatter yet end local function state(name) @@ -113,15 +116,6 @@ function callbacks.report() end end -function callbacks.table() - local NC, NR, verbatim = context.NC, context.NR, context.type - context.starttabulate { "|l|l|p|" } - for name, _ in sortedhash(list) do - NC() verbatim(name) NC() verbatim(state(name)) NC() context(frozen[name] or "") NC() NR() - end - context.stoptabulate() -end - function callbacks.freeze(name,freeze) freeze = type(freeze) == "string" and freeze if find(name,"%*") then @@ -143,7 +137,7 @@ function callbacks.register(name,func,freeze) end return frozen_callback(name) elseif freeze then - frozen[name] = (type(freeze) == "string" and freeze) or "registered" + frozen[name] = type(freeze) == "string" and freeze or "registered" end if delayed[name] and environment.initex then return nil @@ -160,7 +154,7 @@ function callback.register(name,func) -- original return frozen_callback(name) end -function callbacks.push(name, func) +function callbacks.push(name,func) if not frozen[name] then local sn = stack[name] if not sn then @@ -311,3 +305,16 @@ function garbagecollector.check(size,criterium) end end end + +-- this will move + +commands = commands or { } + +function commands.showcallbacks() + local NC, NR, verbatim = context.NC, context.NR, context.type + context.starttabulate { "|l|l|p|" } + for name, _ in sortedhash(list) do + NC() verbatim(name) NC() verbatim(state(name)) NC() context(frozen[name] or "") NC() NR() + end + context.stoptabulate() +end |