summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/page-str.lua
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2019-02-24 15:12:57 +0000
committerNorbert Preining <preining@logic.at>2019-02-24 15:12:57 +0000
commit1314fbe93790c501dc436a5cf99f106b9e5c0f63 (patch)
tree04dc7734c8be8ffe385d41f4388826ef5857b6f9 /Master/texmf-dist/tex/context/base/mkiv/page-str.lua
parenteb80ce7b34f59896a1dfee5ca422495394d6677f (diff)
Revert "ConTeXt version 2019.02.22 19:35"
This reverts commit 5c6357cdb820b4f628d036ba7b2248f221d50c0b. git-svn-id: svn://tug.org/texlive/trunk@50112 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/page-str.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/page-str.lua73
1 files changed, 27 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/page-str.lua b/Master/texmf-dist/tex/context/base/mkiv/page-str.lua
index ebb49a918c2..4aeffffd80d 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/page-str.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/page-str.lua
@@ -20,27 +20,18 @@ local implement = interfaces.implement
local nodecodes = nodes.nodecodes
-local nuts = nodes.nuts
-local tonut = nodes.tonut
-local slide_node_list = nuts.slide
-local write_node = nuts.write
-local flush_node = nuts.flush
-local copy_node_list = nuts.copy_list
-local vpack_node_list = nuts.vpack
-
-local getbox = nuts.getbox
-local setlink = nuts.setlink
-local getlist = nuts.getlist
-local setlist = nuts.setlist
-local getwhd = nuts.getwhd
-local setwhd = nuts.setwhd
+local slide_node_list = nodes.slide
+local write_node = nodes.write
+local flush_node = nodes.flush
+local copy_node_list = nodes.copy_list
+local vpack_node_list = nodes.vpack
local settings_to_array = utilities.parsers.settings_to_array
local enableaction = nodes.tasks.enableaction
local texgetdimen = tex.getdimen
------ texgetbox = tex.getbox
+local texgetbox = tex.getbox
local trace_collecting = false trackers.register("streams.collecting", function(v) trace_collecting = v end)
local trace_flushing = false trackers.register("streams.flushing", function(v) trace_flushing = v end)
@@ -50,11 +41,7 @@ local report_streams = logs.reporter("streams")
streams = streams or { } -- might move to the builders namespace
local streams = streams
--- maybe store head and tail ... first we need usage
-
-local data = { }
-local name = nil
-local stack = { }
+local data, name, stack = { }, nil, { }
function streams.enable(newname)
if newname == "default" then
@@ -79,7 +66,7 @@ end
function streams.collect(head,where)
if name and head and name ~= "default" then
- local head = tonut(head)
+ local tail = node.slide(head)
local dana = data[name]
if not dana then
dana = { }
@@ -88,7 +75,7 @@ function streams.collect(head,where)
local last = dana[#dana]
if last then
local tail = slide_node_list(last)
- setlink(tail,head)
+ tail.next, head.prev = head, tail
elseif last == false then
dana[#dana] = head
else
@@ -97,9 +84,9 @@ function streams.collect(head,where)
if trace_collecting then
report_streams("appending snippet %a to slot %s",name,#dana)
end
- return nil
+ return nil, true
else
- return head
+ return head, false
end
end
@@ -131,7 +118,7 @@ function streams.flush(name,copy) -- problem: we need to migrate afterwards
for i=1,dn do
local di = dana[i]
if di then
- write_node(copy_node_list(getlist(di))) -- list, will be option
+ write_node(copy_node_list(di.list)) -- list, will be option
end
end
if copy then
@@ -144,8 +131,8 @@ function streams.flush(name,copy) -- problem: we need to migrate afterwards
for i=1,dn do
local di = dana[i]
if di then
- write_node(getlist(di)) -- list, will be option
- setlist(di)
+ write_node(di.list) -- list, will be option
+ di.list = nil
flush_node(di)
end
end
@@ -180,7 +167,7 @@ function streams.synchronize(list) -- this is an experiment !
local slot = dana[m]
if slot then
local vbox = vpack_node_list(slot)
- local wd, ht, dp = getwhd(vbox)
+ local ht, dp = vbox.height, vbox.depth
if ht > height then
height = ht
end
@@ -204,36 +191,32 @@ function streams.synchronize(list) -- this is an experiment !
local dana = data[name]
local vbox = dana[m]
if vbox then
- local wd, ht, dp = getwhd(vbox)
- local delta_height = height - ht
- local delta_depth = depth - dp
+ local delta_height = height - vbox.height
+ local delta_depth = depth - vbox.depth
if delta_height > 0 or delta_depth > 0 then
if false then
-- actually we need to add glue and repack
- setwhd(vbox,false,height,depth)
+ vbox.height, vbox.depth = height, depth
if trace_flushing then
report_streams("slot %s of %a with delta (%p,%p) is compensated",m,i,delta_height,delta_depth)
end
else
-- this is not yet ok as we also need to keep an eye on vertical spacing
-- so we might need to do some splitting or whatever
- local list = getlist(vbox)
- local tail = list and slide_node_list(list)
- local n = 0
- local delta = delta_height -- for tracing
+ local tail = vbox.list and slide_node_list(vbox.list)
+ local n, delta = 0, delta_height -- for tracing
while delta > 0 do
-- we need to add some interline penalties
- local line = copy_node_list(getbox("strutbox"))
- setwhd(line,false,strutht,strutdp)
+ local line = copy_node_list(texgetbox("strutbox"))
+ line.height, line.depth = strutht, strutdp
if tail then
- setlink(tail,line)
+ tail.next, line.prev = line, tail
end
- tail = line
- n = n + 1
- delta = delta - struthtdp
+ tail = line
+ n, delta = n +1, delta - struthtdp
end
- dana[m] = vpack_node_list(getlist(vbox))
- setlist(vbox)
+ dana[m] = vpack_node_list(vbox.list)
+ vbox.list = nil
flush_node(vbox)
if trace_flushing then
report_streams("slot %s:%s with delta (%p,%p) is compensated by %s lines",m,i,delta_height,delta_depth,n)
@@ -247,8 +230,6 @@ function streams.synchronize(list) -- this is an experiment !
end
end
--- hm, nut or node
-
tasks.appendaction("mvlbuilders", "normalizers", "streams.collect")
tasks.disableaction("mvlbuilders", "streams.collect")