summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua43
1 files changed, 13 insertions, 30 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua b/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua
index ea36b10de7a..3f2b2edfeff 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/pack-obj.lua
@@ -13,10 +13,8 @@ reusable components.</p>
local context = context
local codeinjections = backends.codeinjections
-local ctx_doifelse = commands.doifelse
-local report = logs.reporter("objects")
-local trace = false trackers.register("objects",function(v) trace = v end)
+local ctx_doifelse = commands.doifelse
local nuts = nodes.nuts
@@ -28,7 +26,10 @@ local new_latelua = nuts.pool.latelua
local settexdimen = tokens.setters.dimen
-local getcount = tex.getcount
+local gettexbox = tokens.getters.box
+local settexbox = tokens.setters.box
+local gettexdimen = tokens.getters.dimen
+local gettexcount = tokens.getters.count
local implement = interfaces.implement
local setmacro = interfaces.setmacro
@@ -53,16 +54,8 @@ end
job.register('job.objects.collected', tobesaved, initializer, nil)
local function saveobject(tag,number,page)
- local data = { number, page }
- tobesaved[tag] = data
- collected[tag] = data
-end
-
-local function saveobjectspec(specification)
- local tag = specification.tag
- local data = { specification.number, specification.page }
- tobesaved[tag] = data
- collected[tag] = data
+ local t = { number, page }
+ tobesaved[tag], collected[tag] = t, t
end
local function setobject(tag,number,page)
@@ -135,9 +128,8 @@ objects = {
local objects = objects
function objects.register(ns,id,b,referenced,offset,mode)
- local n = objects.n + 1
- objects.n = n
- nodes.handlers.finalizebox(b)
+ objects.n = objects.n + 1
+ nodes.handlers.finalize(gettexbox(b),"object")
if mode == 0 then
-- tex
data[ns][id] = {
@@ -155,9 +147,6 @@ function objects.register(ns,id,b,referenced,offset,mode)
mode,
}
end
- if trace then
- report("registering object %a (n=%i)",id,n)
- end
end
function objects.restore(ns,id) -- why not just pass a box number here too (ok, we also set offset)
@@ -170,12 +159,9 @@ function objects.restore(ns,id) -- why not just pass a box number here too (ok,
local hbox = codeinjections.restoreboxresource(index) -- a nut !
if status then
local list = getlist(hbox)
- local page = new_latelua {
- action = saveobjectspec,
- tag = ns .. "::" .. id,
- number = index,
- page = getcount("realpageno"),
- }
+ local page = new_latelua(function()
+ saveobject(ns .. "::" .. id,index,gettexcount("realpageno"))
+ end)
setlink(list,page)
end
setbox("objectbox",hbox)
@@ -184,9 +170,6 @@ function objects.restore(ns,id) -- why not just pass a box number here too (ok,
setbox("objectbox",nil)
settexdimen("objectoff",0) -- for good old times
end
- if trace then
- report("restoring object %a",id)
- end
end
function objects.dimensions(index)
@@ -208,7 +191,7 @@ function objects.reference(ns,id)
end
function objects.page(ns,id)
- return getobjectpage(ns .."::" .. id,getcount("realpageno"))
+ return getobjectpage(ns .."::" .. id,gettexcount("realpageno"))
end
function objects.found(ns,id)