diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexbase/mcb.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexbase/mcb.lua | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua b/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua index 08dc3a2abe4..e1c7ac80c3c 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua +++ b/Master/texmf-dist/tex/luatex/luatexbase/mcb.lua @@ -8,8 +8,9 @@ -- -- See the aforementioned source file(s) for copyright and licensing information. -- -module('luatexbase', package.seeall) -local err, warning, info = luatexbase.provides_module({ +luatexbase = luatexbase or { } +local luatexbase = luatexbase +local err, warning, info, log = luatexbase.provides_module({ name = "luatexbase-mcb", version = 0.5, date = "2013/04/13", @@ -18,6 +19,12 @@ local err, warning, info = luatexbase.provides_module({ copyright = "Hans Hagen, Elie Roux, Manuel Pegourie-Gonnard and Philipp Gesang", license = "CC0", }) +local add_to_callback +local call_callback +local create_callback +local priority_in_callback +local remove_from_callback +local reset_callback local callbacklist = callbacklist or { } local list, data, first, simple = 1, 2, 3, 4 local types = { @@ -174,9 +181,10 @@ function add_to_callback (name,func,description,priority) warning("several functions in '%s',\n" .."only one will be active.", name) end - info("inserting '%s'\nat position %s in '%s'", + log("inserting '%s'\nat position %s in '%s'", description, priority, name) end +luatexbase.add_to_callback = add_to_callback function remove_from_callback (name, description) if not name or name == "" then err("unable to remove function:\nno proper callback name passed") @@ -208,7 +216,7 @@ function remove_from_callback (name, description) return end table.remove(l, index) - info("removing '%s'\nfrom '%s'", description, name) + log("removing '%s'\nfrom '%s'", description, name) if #l == 0 then callbacklist[name] = nil if not lua_callbacks_defaults[name] then @@ -217,6 +225,7 @@ function remove_from_callback (name, description) end return end +luatexbase.remove_from_callback = remove_from_callback function reset_callback (name, make_false) if not name or name == "" then err("unable to reset:\nno proper callback name passed") @@ -225,17 +234,18 @@ function reset_callback (name, make_false) err("unable to reset '%s':\nis not a valid callback", name) return end - info("resetting callback '%s'", name) + log("resetting callback '%s'", name) callbacklist[name] = nil if not lua_callbacks_defaults[name] then if make_false == true then - info("setting '%s' to false", name) + log("setting '%s' to false", name) register_callback(name, false) else register_callback(name, nil) end end end +luatexbase.reset_callback = reset_callback function priority_in_callback (name, description) if not name or name == "" or not callbacktypes[name] @@ -251,6 +261,7 @@ function priority_in_callback (name, description) end return false end +luatexbase.priority_in_callback = priority_in_callback function create_callback(name, ctype, default) if not name then err("unable to call callback:\nno proper name passed", name) @@ -270,10 +281,11 @@ function create_callback(name, ctype, default) err("unable to create callback '%s':\ntype '%s' undefined", name, ctype) return nil end - info("creating '%s' type %s", name, ctype) + log("creating '%s' type %s", name, ctype) lua_callbacks_defaults[name] = default callbacktypes[name] = ctype end +luatexbase.create_callback = create_callback function call_callback(name, ...) if not name then err("unable to call callback:\nno proper name passed", name) @@ -296,5 +308,6 @@ function call_callback(name, ...) end return f(...) end +luatexbase.call_callback = call_callback -- -- End of File `mcb.lua'. |