summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/node-res.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/node-res.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/node-res.lua35
1 files changed, 26 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/context/base/node-res.lua b/Master/texmf-dist/tex/context/base/node-res.lua
index 4522bef98ea..768aac404e2 100644
--- a/Master/texmf-dist/tex/context/base/node-res.lua
+++ b/Master/texmf-dist/tex/context/base/node-res.lua
@@ -33,6 +33,8 @@ local nodecodes = nodes.nodecodes
local glyph_code = nodecodes.glyph
+local allocate = utilities.storage.allocate
+
local reserved, nofreserved = { }, 0
local function register_node(n)
@@ -44,7 +46,9 @@ end
pool.register = register_node
function pool.cleanup(nofboxes) -- todo
- nodes.tracers.steppers.reset() -- todo: make a registration subsystem
+ if nodes.tracers.steppers then -- to be resolved
+ nodes.tracers.steppers.reset() -- todo: make a registration subsystem
+ end
local nl, nr = 0, nofreserved
for i=1,nofreserved do
local ri = reserved[i]
@@ -83,7 +87,6 @@ local glue = register_node(new_node("glue")) -- glue.spec = nil
local glue_spec = register_node(new_node("glue_spec"))
local glyph = register_node(new_node("glyph",0))
local textdir = register_node(new_node("whatsit",whatsitcodes.dir))
-local rule = register_node(new_node("rule"))
local latelua = register_node(new_node("whatsit",whatsitcodes.latelua))
local special = register_node(new_node("whatsit",whatsitcodes.special))
local user_n = register_node(new_node("whatsit",whatsitcodes.userdefined)) user_n.type = 100 -- 44
@@ -99,6 +102,12 @@ local rightskip = register_node(new_node("glue",skipcodes.rightskip))
local temp = register_node(new_node("temp",0))
local noad = register_node(new_node("noad"))
+-- the dir field needs to be set otherwise crash:
+
+local rule = register_node(new_node("rule")) rule .dir = "TLT"
+local hlist = register_node(new_node("hlist")) hlist.dir = "TLT"
+local vlist = register_node(new_node("vlist")) vlist.dir = "TLT"
+
function pool.zeroglue(n)
local s = n.spec
return not writable or (
@@ -223,7 +232,7 @@ function pool.textdir(dir)
return t
end
-function pool.rule(width,height,depth,dir)
+function pool.rule(width,height,depth,dir) -- w/h/d == nil will let them adapt
local n = copy_node(rule)
if width then n.width = width end
if height then n.height = height end
@@ -251,7 +260,7 @@ function pool.leftmarginkern(glyph,width)
if not glyph then
report_nodes("invalid pointer to left margin glyph node")
elseif glyph.id ~= glyph_code then
- report_nodes("invalid node type %s for left margin glyph node",nodecodes[glyph])
+ report_nodes("invalid node type %a for %s margin glyph node",nodecodes[glyph],"left")
else
n.glyph = glyph
end
@@ -266,7 +275,7 @@ function pool.rightmarginkern(glyph,width)
if not glyph then
report_nodes("invalid pointer to right margin glyph node")
elseif glyph.id ~= glyph_code then
- report_nodes("invalid node type %s for right margin glyph node",nodecodes[p])
+ report_nodes("invalid node type %a for %s margin glyph node",nodecodes[p],"right")
else
n.glyph = glyph
end
@@ -284,6 +293,14 @@ function pool.noad()
return copy_node(noad)
end
+function pool.hlist()
+ return copy_node(hlist)
+end
+
+function pool.vlist()
+ return copy_node(vlist)
+end
+
--[[
<p>At some point we ran into a problem that the glue specification
of the zeropoint dimension was overwritten when adapting a glue spec
@@ -312,7 +329,7 @@ end
-- local num = userids["my id"]
-- local str = userids[num]
-local userids = utilities.storage.allocate() pool.userids = userids
+local userids = allocate() pool.userids = userids
local lastid = 0
setmetatable(userids, {
@@ -345,7 +362,7 @@ end
function pool.userlist(id,list)
local n = copy_node(user_l)
if list then
- n.user_id, n.value =id, list
+ n.user_id, n.value = id, list
else
n.value = id
end
@@ -355,7 +372,7 @@ end
function pool.userstring(id,str)
local n = copy_node(user_s)
if str then
- n.user_id, n.value =id, str
+ n.user_id, n.value = id, str
else
n.value = id
end
@@ -365,7 +382,7 @@ end
function pool.usertokens(id,tokens)
local n = copy_node(user_t)
if tokens then
- n.user_id, n.value =id, tokens
+ n.user_id, n.value = id, tokens
else
n.value = id
end