summaryrefslogtreecommitdiff
path: root/tex/context/base/node-res.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-07-12 20:20:46 +0300
committerMarius <mariausol@gmail.com>2013-07-12 20:20:46 +0300
commitb1d691809f3556327b45caf09444c50a77335b8f (patch)
tree8e85bb077d6680d1ea73a284a9ab3a0d26954628 /tex/context/base/node-res.lua
parentb10c48bc0fe2e5be7305c0f31e41ea01f8596c30 (diff)
downloadcontext-b1d691809f3556327b45caf09444c50a77335b8f.tar.gz
beta 2013.07.12 19:10
Diffstat (limited to 'tex/context/base/node-res.lua')
-rw-r--r--tex/context/base/node-res.lua44
1 files changed, 36 insertions, 8 deletions
diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua
index 768aac404..ca9d67f91 100644
--- a/tex/context/base/node-res.lua
+++ b/tex/context/base/node-res.lua
@@ -35,6 +35,9 @@ local glyph_code = nodecodes.glyph
local allocate = utilities.storage.allocate
+local texgetbox = tex.getbox
+local texgetcount = tex.getcount
+
local reserved, nofreserved = { }, 0
local function register_node(n)
@@ -57,11 +60,10 @@ function pool.cleanup(nofboxes) -- todo
-- end
end
if nofboxes then
- local tb = tex.box
for i=0,nofboxes do
- local l = tb[i]
+ local l = texgetbox(i)
if l then
- free_node(tb[i])
+ free_node(l) -- also list ?
nl = nl + 1
end
end
@@ -293,12 +295,38 @@ function pool.noad()
return copy_node(noad)
end
-function pool.hlist()
- return copy_node(hlist)
+function pool.hlist(list,width,height,depth)
+ local n = copy_node(hlist)
+ if list then
+ n.list = list
+ end
+ if width then
+ n.width = width
+ end
+ if height then
+ n.height = height
+ end
+ if depth then
+ n.depth = depth
+ end
+ return n
end
-function pool.vlist()
- return copy_node(vlist)
+function pool.vlist(list,width,height,depth)
+ local n = copy_node(vlist)
+ if list then
+ n.list = list
+ end
+ if width then
+ n.width = width
+ end
+ if height then
+ n.height = height
+ end
+ if depth then
+ n.depth = depth
+ end
+ return n
end
--[[
@@ -396,7 +424,7 @@ function pool.special(str)
end
statistics.register("cleaned up reserved nodes", function()
- return format("%s nodes, %s lists of %s", pool.cleanup(tex.count["c_syst_last_allocated_box"]))
+ return format("%s nodes, %s lists of %s", pool.cleanup(texgetcount("c_syst_last_allocated_box")))
end) -- \topofboxstack
statistics.register("node memory usage", function() -- comes after cleanup !