diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexbase/attr.lua | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexbase/attr.lua b/Master/texmf-dist/tex/luatex/luatexbase/attr.lua index d089c8b0865..e86bbdedfda 100644 --- a/Master/texmf-dist/tex/luatex/luatexbase/attr.lua +++ b/Master/texmf-dist/tex/luatex/luatexbase/attr.lua @@ -77,6 +77,7 @@ function unset_attribute(name) tex.setattribute(attributes[name], unset_value) end luatexbase.unset_attribute = unset_attribute +luatexbase.get_unset_value = function () return unset_value end --- cf. luatexref-t.pdf, sect. 8.1.4.25 local user_whatsits = { --- (package, (name, id hash)) hash __unassociated = { }, --- those without package name @@ -124,16 +125,24 @@ local new_user_whatsit_id = function (name, package) return id end luatexbase.new_user_whatsit_id = new_user_whatsit_id ---- string -> string -> (unit -> node_t, int) -local new_user_whatsit = function (name, package) - local id = new_user_whatsit_id(name, package) - local whatsit = newnode(whatsit_t, user_defined_t) - whatsit.user_id = id - --- unit -> node_t - return function ( ) return copynode(whatsit) end, id +--- (string | node_t) -> string -> ((unit -> node_t) * int) +local new_user_whatsit = function (req, package) + local id, whatsit + if type(req) == "string" then + id = new_user_whatsit_id(req, package) + whatsit = newnode(whatsit_t, user_defined_t) + whatsit.user_id = id + elseif req.id == whatsit_t and req.subtype == user_defined_t then + id = req.user_id + whatsit = copynode(req) + if not whatsit_ids[id] then + warning("whatsit id %d unregistered; " + .. "inconsistencies may arise", id) + end + end + return function () return copynode(whatsit) end, id end luatexbase.new_user_whatsit = new_user_whatsit -luatexbase.new_user_whatsit_factory = new_user_whatsit --- for Stephan --- string -> string -> int local get_user_whatsit_id = function (name, package) if not package then @@ -206,7 +215,6 @@ end luatexbase.dump_registered_whatsits = dump_registered_whatsits luatexbase.newattribute = new_attribute luatexbase.newuserwhatsit = new_user_whatsit -luatexbase.newuserwhatsitfactory = new_user_whatsit_factory luatexbase.newuserwhatsitid = new_user_whatsit_id luatexbase.getuserwhatsitid = get_user_whatsit_id luatexbase.getuserwhatsitname = get_user_whatsit_name |