summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexbase/attr.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexbase/attr.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexbase/attr.lua23
1 files changed, 21 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexbase/attr.lua b/Master/texmf-dist/tex/luatex/luatexbase/attr.lua
index f794e350812..74ecd6ac07f 100644
--- a/Master/texmf-dist/tex/luatex/luatexbase/attr.lua
+++ b/Master/texmf-dist/tex/luatex/luatexbase/attr.lua
@@ -13,8 +13,27 @@
--
module('luatexbase', package.seeall)
attributes = {}
-function attributedef_from_tex(name, number)
- attributes[name] = tonumber(number)
+local last_alloc = 0
+function new_attribute(name, silent)
+ if last_alloc >= 65535 then
+ if silent then
+ return -1
+ else
+ error("No room for a new \\attribute", 1)
+ end
+ end
+ last_alloc = last_alloc + 1
+ attributes[name] = last_alloc
+ unset_attribute(name)
+ if not silent then
+ texio.write_nl('log', string.format(
+ 'luatexbase.attributes[%q] = %d', name, last_alloc))
+ end
+ return last_alloc
+end
+local unset_value = (luatexbase.luatexversion < 37) and -1 or -2147483647
+function unset_attribute(name)
+ tex.setattribute(attributes[name], unset_value)
end
--
-- End of File `attr.lua'.