summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexbase/attr.lua
blob: e21e47d0c115df0fcf94d8b7f89c9ef497ea9cac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-- 
--  This is file `attr.lua',
--  generated with the docstrip utility.
-- 
--  The original source files were:
-- 
--  luatexbase-attr.dtx  (with options: `luamodule')
--  
--  See the aforementioned source file(s) for copyright and licensing information.
--  
module('luatexbase', package.seeall)
attributes = {}
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'.