diff options
Diffstat (limited to 'tex/context/base/attr-ini.lua')
-rw-r--r-- | tex/context/base/attr-ini.lua | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/tex/context/base/attr-ini.lua b/tex/context/base/attr-ini.lua index 5a3bafce3..f3714fcb4 100644 --- a/tex/context/base/attr-ini.lua +++ b/tex/context/base/attr-ini.lua @@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['attr-ini'] = { license = "see context related readme files" } -local commands, context, nodes, storage = commands, context, nodes, storage - local next, type = next, type --[[ldx-- @@ -15,10 +13,11 @@ local next, type = next, type symbolic names later on.</p> --ldx]]-- -attributes = attributes or { } -local attributes = attributes +attributes = attributes or { } + +local attributes, nodes = attributes, nodes -local sharedstorage = storage.shared +-- todo: local and then gobals ... first loaded anyway attributes.names = attributes.names or { } attributes.numbers = attributes.numbers or { } @@ -27,14 +26,15 @@ attributes.states = attributes.states or { } attributes.handlers = attributes.handlers or { } attributes.unsetvalue = -0x7FFFFFFF -local names = attributes.names -local numbers = attributes.numbers -local list = attributes.list +local names, numbers, list = attributes.names, attributes.numbers, attributes.list storage.register("attributes/names", names, "attributes.names") storage.register("attributes/numbers", numbers, "attributes.numbers") storage.register("attributes/list", list, "attributes.list") +names [0] = "fontdynamic" +numbers["fontdynamic"] = 0 + function attributes.define(name,number) -- at the tex end if not numbers[name] then numbers[name] = number @@ -44,18 +44,12 @@ function attributes.define(name,number) -- at the tex end end --[[ldx-- -<p>We reserve this one as we really want it to be always set (faster).</p> ---ldx]]-- - -names[0], numbers["fontdynamic"] = "fontdynamic", 0 - ---[[ldx-- <p>We can use the attributes in the range 127-255 (outside user space). These are only used when no attribute is set at the \TEX\ end which normally happens in <l n='context'/>.</p> --ldx]]-- -sharedstorage.attributes_last_private = sharedstorage.attributes_last_private or 127 +storage.shared.attributes_last_private = storage.shared.attributes_last_private or 127 -- to be considered (so that we can use an array access): -- @@ -63,10 +57,10 @@ sharedstorage.attributes_last_private = sharedstorage.attributes_last_private or -- -- setmetatable(private, { -- __index = function(t,name) --- local number = sharedstorage.attributes_last_private +-- local number = storage.shared.attributes_last_private or 127 -- if number < 1023 then -- tex.count.minallocatedattribute - 1 -- number = number + 1 --- sharedstorage.attributes_last_private = number +-- storage.shared.attributes_last_private = number -- end -- numbers[name], names[number], list[number] = number, name, { } -- private[name] = number @@ -80,12 +74,12 @@ sharedstorage.attributes_last_private = sharedstorage.attributes_last_private or function attributes.private(name) -- at the lua end (hidden from user) local number = numbers[name] if not number then - local last = sharedstorage.attributes_last_private + local last = storage.shared.attributes_last_private or 127 if last < 1023 then -- tex.count.minallocatedattribute - 1 last = last + 1 - sharedstorage.attributes_last_private = last + storage.shared.attributes_last_private = last else - report_attribute("no more room for private attributes") + report_attribute("no more room for private attributes") -- fatal os.exit() end number = last @@ -94,7 +88,7 @@ function attributes.private(name) -- at the lua end (hidden from user) return number end --- tracers +-- new (actually a tracer) local report_attribute = logs.reporter("attributes") |