diff options
Diffstat (limited to 'tex/context/base/mkxl/node-fin.lmt')
-rw-r--r-- | tex/context/base/mkxl/node-fin.lmt | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/tex/context/base/mkxl/node-fin.lmt b/tex/context/base/mkxl/node-fin.lmt index 2ca7491a1..464f17f83 100644 --- a/tex/context/base/mkxl/node-fin.lmt +++ b/tex/context/base/mkxl/node-fin.lmt @@ -17,62 +17,62 @@ local setmetatableindex = table.setmetatableindex local attributes, nodes, node = attributes, nodes, node -local nuts = nodes.nuts -local tonut = nodes.tonut - -local getnext = nuts.getnext -local getid = nuts.getid -local getlist = nuts.getlist -local getleader = nuts.getleader -local getattr = nuts.getattr -local getattrs = nuts.getattrs -local getwidth = nuts.getwidth -local getwhd = nuts.getwhd -local getorientation = nuts.getorientation -local has_dimensions = nuts.has_dimensions -local getbox = nuts.getbox - -local setlist = nuts.setlist -local setleader = nuts.setleader - -local copy_node = nuts.copy -local find_tail = nuts.tail -local insert_node_before = nuts.insert_before -local insert_node_after = nuts.insert_after - -local nextnode = nuts.traversers.node -local nextcontent = nuts.traversers.content - -local nodecodes = nodes.nodecodes -local rulecodes = nodes.rulecodes - -local boxrule_code = rulecodes.box -local imagerule_code = rulecodes.image -local emptyrule_code = rulecodes.empty - -local container_code = nodes.listcodes.container - -local glyph_code = nodecodes.glyph -local disc_code = nodecodes.disc -local glue_code = nodecodes.glue -local rule_code = nodecodes.rule -local hlist_code = nodecodes.hlist -local vlist_code = nodecodes.vlist - -local texlists = tex.lists -local texgetnest = tex.getnest - -local states = attributes.states -local numbers = attributes.numbers -local a_trigger = attributes.private('trigger') -local triggering = false - -local implement = interfaces.implement - -local starttiming = statistics.starttiming -local stoptiming = statistics.stoptiming -local loadstripped = utilities.lua.loadstripped -local unsetvalue = attributes.unsetvalue +local nuts = nodes.nuts +local tonut = nodes.tonut + +local getnext = nuts.getnext +local getid = nuts.getid +local getlist = nuts.getlist +local getleader = nuts.getleader +local getattr = nuts.getattr +local getattrs = nuts.getattrs +local getwidth = nuts.getwidth +local getwhd = nuts.getwhd +local getorientation = nuts.getorientation +local hasdimensions = nuts.hasdimensions +local getbox = nuts.getbox + +local setlist = nuts.setlist +local setleader = nuts.setleader + +local copy_node = nuts.copy +local find_tail = nuts.tail +local insertnodebefore = nuts.insertbefore +local insertnodeafter = nuts.insertafter + +local nextnode = nuts.traversers.node +local nextcontent = nuts.traversers.content + +local nodecodes = nodes.nodecodes +local rulecodes = nodes.rulecodes + +local boxrule_code = rulecodes.box +local imagerule_code = rulecodes.image +local emptyrule_code = rulecodes.empty + +local container_code = nodes.listcodes.container + +local glyph_code = nodecodes.glyph +local disc_code = nodecodes.disc +local glue_code = nodecodes.glue +local rule_code = nodecodes.rule +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + +local texlists = tex.lists +local texgetnest = tex.getnest + +local states = attributes.states +local numbers = attributes.numbers +local a_trigger = attributes.private('trigger') +local triggering = false + +local implement = interfaces.implement + +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming +local loadstripped = utilities.lua.loadstripped +local unsetvalue = attributes.unsetvalue -- these two will be like trackers @@ -168,15 +168,15 @@ function states.finalize(namespace,attribute,head) -- is this one ok? if id == hlist_code or id == vlist_code then local content = getlist(head) if content then --- local list = insert_node_before(content,content,copy_node(nsnone)) -- two return values - local list = insert_node_after(content,find_tail(content),copy_node(nsnone)) -- two return values +-- local list = insertnodebefore(content,content,copy_node(nsnone)) -- two return values + local list = insertnodeafter(content,find_tail(content),copy_node(nsnone)) -- two return values if list ~= content then setlist(head,list) end end else --- head = insert_node_before(head,head,copy_node(nsnone)) - head = insert_node_after(find_tail(head),head,copy_node(nsnone)) +-- head = insertnodebefore(head,head,copy_node(nsnone)) + head = insertnodeafter(find_tail(head),head,copy_node(nsnone)) end return head, true end @@ -206,20 +206,20 @@ current = 0 if outer then if default and outer == inheritance then if current ~= default then - head = insert_node_before(head,stack,copy_node(nsdata[default])) + head = insertnodebefore(head,stack,copy_node(nsdata[default])) current = default end elseif current ~= outer then - head = insert_node_before(head,stack,copy_node(nsdata[c])) + head = insertnodebefore(head,stack,copy_node(nsdata[c])) current = outer end elseif default and inheritance then if current ~= default then - head = insert_node_before(head,stack,copy_node(nsdata[default])) + head = insertnodebefore(head,stack,copy_node(nsdata[default])) current = default end elseif current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) current = 0 end end @@ -242,7 +242,7 @@ current = 0 end -- end nested -- elseif id == rule_code then - check = has_dimensions(stack) + check = hasdimensions(stack) end -- much faster this way than using a check() and nested() function if check then @@ -250,11 +250,11 @@ current = 0 if c then if default and c == inheritance then if current ~= default then - head = insert_node_before(head,stack,copy_node(nsdata[default])) + head = insertnodebefore(head,stack,copy_node(nsdata[default])) current = default end elseif current ~= c then - head = insert_node_before(head,stack,copy_node(nsdata[c])) + head = insertnodebefore(head,stack,copy_node(nsdata[c])) current = c end if leader then @@ -287,11 +287,11 @@ current = 0 end elseif default and inheritance then if current ~= default then - head = insert_node_before(head,stack,copy_node(nsdata[default])) + head = insertnodebefore(head,stack,copy_node(nsdata[default])) current = default end elseif current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) current = 0 end check = false @@ -323,13 +323,13 @@ current = 0 if outer then if current ~= outer then if current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) end - head = insert_node_before(head,stack,copy_node(nsdata[c])) + head = insertnodebefore(head,stack,copy_node(nsdata[c])) current = outer end elseif current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) current = 0 end end @@ -338,16 +338,16 @@ current = 0 setlist(stack,list) end elseif id == rule_code then - check = has_dimensions(stack) + check = hasdimensions(stack) end if check then local c = getattr(stack,attribute) if c then if current ~= c then if current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) end - head = insert_node_before(head,stack,copy_node(nsdata[c])) + head = insertnodebefore(head,stack,copy_node(nsdata[c])) current = c end if leader then @@ -364,7 +364,7 @@ current = 0 leader = false end elseif current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) current = 0 end check = false @@ -405,7 +405,7 @@ end -- if default and outer == inheritance then -- if current ~= default then -- local data = nsdata[default] --- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector])) +-- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector])) -- current = default -- end -- else @@ -413,7 +413,7 @@ end -- -- local s = nsforced or getattr(stack,nsselector) -- if current ~= outer or current_selector ~= s then -- local data = nsdata[outer] --- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector])) +-- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector])) -- current = outer -- current_selector = s -- end @@ -421,11 +421,11 @@ end -- elseif default and inheritance then -- if current ~= default then -- local data = nsdata[default] --- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector])) +-- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector])) -- current = default -- end -- elseif current > 0 then --- head = insert_node_before(head,stack,copy_node(nsnone)) +-- head = insertnodebefore(head,stack,copy_node(nsnone)) -- current, current_selector = 0, 0 -- end -- end @@ -452,7 +452,7 @@ end -- -- so no redundant color stuff (only here, layers for instance should obey) -- check = false -- else --- check = has_dimensions(stack) +-- check = hasdimensions(stack) -- end -- end -- if check then @@ -461,7 +461,7 @@ end -- if default and c == inheritance then -- if current ~= default then -- local data = nsdata[default] --- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector])) +-- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector])) -- current = default -- end -- else @@ -469,7 +469,7 @@ end -- -- local s = nsforced or getattr(stack,nsselector) -- if current ~= c or current_selector ~= s then -- local data = nsdata[c] --- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector])) +-- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector])) -- current = c -- current_selector = s -- end @@ -496,11 +496,11 @@ end -- elseif default and inheritance then -- if current ~= default then -- local data = nsdata[default] --- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector])) +-- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector])) -- current = default -- end -- elseif current > 0 then --- head = insert_node_before(head,stack,copy_node(nsnone)) +-- head = insertnodebefore(head,stack,copy_node(nsnone)) -- current, current_selector = 0, 0 -- end -- check = false @@ -531,23 +531,23 @@ current = 0 if default and outer == inheritance then if current ~= default then local data = nsdata[default] - head = insert_node_before(head,stack,copy_node(data[nsforced or nsselector])) + head = insertnodebefore(head,stack,copy_node(data[nsforced or nsselector])) current = default end elseif current ~= outer or current_selector ~= s then local data = nsdata[outer] - head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector])) + head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector])) current = outer current_selector = s end elseif default and inheritance then if current ~= default then local data = nsdata[default] - head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector])) + head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector])) current = default end elseif current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) current, current_selector = 0, 0 end end @@ -574,7 +574,7 @@ current = 0 -- so no redundant color stuff (only here, layers for instance should obey) check = false else - check = has_dimensions(stack) + check = hasdimensions(stack) end end if check then @@ -583,12 +583,12 @@ current = 0 if default and c == inheritance then if current ~= default then local data = nsdata[default] - head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector])) + head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector])) current = default end elseif current ~= c or current_selector ~= s then local data = nsdata[c] - head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector])) + head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector])) current = c current_selector = s end @@ -614,11 +614,11 @@ current = 0 elseif default and inheritance then if current ~= default then local data = nsdata[default] - head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector])) + head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector])) current = default end elseif current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) current, current_selector = 0, 0 end check = false @@ -669,9 +669,9 @@ current = 0 if a and current ~= a and nslistwise[a] then -- viewerlayer / needs checking, see below local p = current current = a - head = insert_node_before(head,stack,copy_node(nsdata[a])) + head = insertnodebefore(head,stack,copy_node(nsdata[a])) list = stacked(attribute,content,current) -- two return values - head, stack = insert_node_after(head,stack,copy_node(nsnone)) + head, stack = insertnodeafter(head,stack,copy_node(nsnone)) current = p else list = stacked(attribute,content,current) @@ -684,13 +684,13 @@ current = 0 end end elseif id == rule_code then - check = has_dimensions(stack) + check = hasdimensions(stack) end if check then local a = getattr(stack,attribute) if a then if current ~= a then - head = insert_node_before(head,stack,copy_node(nsdata[a])) + head = insertnodebefore(head,stack,copy_node(nsdata[a])) depth = depth + 1 current = a end @@ -707,7 +707,7 @@ current = 0 elseif default > 0 then -- elseif current > 0 then - head = insert_node_before(head,stack,copy_node(nsnone)) + head = insertnodebefore(head,stack,copy_node(nsnone)) depth = depth - 1 current = 0 end @@ -716,7 +716,7 @@ current = 0 stack = getnext(stack) end while depth > 0 do - head = insert_node_after(head,stack,copy_node(nsnone)) + head = insertnodeafter(head,stack,copy_node(nsnone)) depth = depth - 1 end return head @@ -759,12 +759,12 @@ end -- if nslistwise then -- local a = getattr(current,attribute) -- if a and attrib ~= a and nslistwise[a] then -- viewerlayer --- head = insert_node_before(head,current,copy_node(nsdata[a])) +-- head = insertnodebefore(head,current,copy_node(nsdata[a])) -- list = stacker(attribute,content,a) -- if list ~= content then -- setlist(current,list) -- end --- head, current = insert_node_after(head,current,copy_node(nsnone)) +-- head, current = insertnodeafter(head,current,copy_node(nsnone)) -- else -- list = stacker(attribute,content,attrib) -- if list ~= content then @@ -779,7 +779,7 @@ end -- end -- end -- elseif id == rule_code then --- check = has_dimensions(current) +-- check = hasdimensions(current) -- end -- -- if check then @@ -791,7 +791,7 @@ end -- end -- local n = nsstep(a) -- if n then --- head = insert_node_before(head,current,n) -- a +-- head = insertnodebefore(head,current,n) -- a -- end -- attrib = a -- if leader then @@ -820,7 +820,7 @@ end -- if stacked then -- local n = nsend() -- while n do --- head = insert_node_after(head,previous,n) +-- head = insertnodeafter(head,previous,n) -- n = nsend() -- end -- end @@ -854,12 +854,12 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance, if nslistwise then local a = getattr(current,attribute) if a and attrib ~= a and nslistwise[a] then -- viewerlayer - head = insert_node_before(head,current,copy_node(nsdata[a])) + head = insertnodebefore(head,current,copy_node(nsdata[a])) list = stacker(attribute,content,a) if list ~= content then setlist(current,list) end - head, current = insert_node_after(head,current,copy_node(nsnone)) + head, current = insertnodeafter(head,current,copy_node(nsnone)) else list = stacker(attribute,content,attrib) if list ~= content then @@ -877,7 +877,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance, -- so no redundant color stuff (only here, layers for instance should obey) check = false else - check = has_dimensions(current) + check = hasdimensions(current) end end @@ -890,7 +890,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance, end local n = nsstep(a) if n then - head = insert_node_before(head,current,n) -- a + head = insertnodebefore(head,current,n) -- a end attrib = a if leader then @@ -918,7 +918,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance, if stacked then local n = nsend() while n do - head = insert_node_after(head,previous,n) + head = insertnodeafter(head,previous,n) n = nsend() end end |