if not modules then modules = { } end modules ['luat-cbk'] = { version = 1.001, comment = "companion to luat-lib.tex", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --[[ldx--
Callbacks are the real asset of
When you (temporarily) want to install a callback function, and after a while wants to revert to the original one, you can use the following two functions.
--ldx]]-- function callbacks.push(name, func) if not callbacks.stack[name] then callbacks.stack[name] = { } end table.insert(callbacks.stack[name],callback.find(name)) callback.register(name, func) end function callbacks.pop(name) -- this fails: callback.register(name, table.remove(callbacks.stack[name])) local func = table.remove(callbacks.stack[name]) callback.register(name, func) end --[[ldx--The simple case is to remove the callback:
callbacks.push('linebreak_filter')
... some actions ...
callbacks.pop('linebreak_filter')
Often, in such case, another callback or a macro call will pop the original.
In practice one will install a new handler, like in:
callbacks.push('linebreak_filter', function(...)
return something_done(...)
end)
Even more interesting is:
callbacks.push('linebreak_filter', function(...)
callbacks.pop('linebreak_filter')
return something_done(...)
end)
This does a one-shot.
--ldx]]-- --[[ldx--Callbacks may result in
At some point in the development we did some tests with counting nodes (in this case 121049).
setstepmul | seconds | megabytes |
200 | 24.0 | 80.5 |
175 | 21.0 | 78.2 |
150 | 22.0 | 74.6 |
160 | 22.0 | 74.6 |
165 | 21.0 | 77.6 |
125 | 21.5 | 89.2 |
100 | 21.5 | 88.4 |
The following code is kind of experimental. In the documents
that describe the development of