diff options
Diffstat (limited to 'tex/context/base/luat-cbk.lua')
-rw-r--r-- | tex/context/base/luat-cbk.lua | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tex/context/base/luat-cbk.lua b/tex/context/base/luat-cbk.lua index 47dd94a05..81a09a54b 100644 --- a/tex/context/base/luat-cbk.lua +++ b/tex/context/base/luat-cbk.lua @@ -31,10 +31,14 @@ local frozen, stack = { }, { } callback.original_register_callback = register_callback -local function frozenmessage(what,name) +local function frozen_message(what,name) logs.report("callbacks","not %s frozen '%s' (%s)",what,name,frozen[name]) end +local function frozen_callback(name) + return nil, format("callback '%s' is frozen (%s)",name,frozen[name]) +end + local function state(name) local f = find_callback(name) if f == false then @@ -51,9 +55,9 @@ function callbacks.report() for name, func in table.sortedpairs(list) do local str = frozen[name] if str then - logs.report("callbacks","%s: %s -> %s",state(func),name,str) + logs.report("callbacks","%s: %s -> %s",state(name),name,str) else - logs.report("callbacks","%s: %s",state(func),name) + logs.report("callbacks","%s: %s",state(name),name) end end end @@ -92,22 +96,22 @@ end function callbacks.register(name,func,freeze) if frozen[name] then if trace_callbacks then - frozenmessage("registering",name) + frozen_message("registering",name) end + return frozen_callback(name) elseif freeze then frozen[name] = (type(freeze) == "string" and freeze) or "registered" - register_callback(name,func) - else - register_callback(name,func) end + return register_callback(name,func) end function callback.register(name,func) -- original if not frozen[name] then - register_callback(name,func) + return register_callback(name,func) elseif trace_callbacks then - frozenmessage("registering",name) + frozen_message("registering",name) end + return frozen_callback(name) end function callbacks.push(name, func) @@ -120,7 +124,7 @@ function callbacks.push(name, func) insert(sn,find_callback(name)) register_callback(name, func) elseif trace_callbacks then - frozenmessage("pushing",name) + frozen_message("pushing",name) end end |