summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/page-str.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/page-str.lua')
-rw-r--r--tex/context/base/mkiv/page-str.lua57
1 files changed, 20 insertions, 37 deletions
diff --git a/tex/context/base/mkiv/page-str.lua b/tex/context/base/mkiv/page-str.lua
index b2f597633..4aeffffd8 100644
--- a/tex/context/base/mkiv/page-str.lua
+++ b/tex/context/base/mkiv/page-str.lua
@@ -8,35 +8,28 @@ if not modules then modules = { } end modules ['page-str'] = {
-- streams -> managers.streams
--- work in progresss .. unfinished
+-- work in progresss .. unfinished .. non-optimized
local concat, insert, remove = table.concat, table.insert, table.remove
local nodes, node = nodes, node
-local nodepool = nodes.pool
local tasks = nodes.tasks
local implement = interfaces.implement
-local new_kern = nodepool.kern
-local new_glyph = nodepool.glyph
-
local nodecodes = nodes.nodecodes
-local gluecodes = nodes.gluecodes
-local hlist_code = nodecodes.hlist
-local vlist_code = nodecodes.vlist
-local glue_code = nodecodes.glue
-
-local slide_nodelist = node.slide
-local write_node = node.write
-local free_node = node.free
-local copy_nodelist = node.copy_list
-local vpack_nodelist = node.vpack
-local hpack_nodelist = node.hpack
+
+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
local texgetbox = tex.getbox
@@ -81,7 +74,7 @@ function streams.collect(head,where)
end
local last = dana[#dana]
if last then
- local tail = slide_nodelist(last)
+ local tail = slide_node_list(last)
tail.next, head.prev = head, tail
elseif last == false then
dana[#dana] = head
@@ -125,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_nodelist(di.list)) -- list, will be option
+ write_node(copy_node_list(di.list)) -- list, will be option
end
end
if copy then
@@ -140,7 +133,7 @@ function streams.flush(name,copy) -- problem: we need to migrate afterwards
if di then
write_node(di.list) -- list, will be option
di.list = nil
- free_node(di)
+ flush_node(di)
end
end
end
@@ -173,17 +166,7 @@ function streams.synchronize(list) -- this is an experiment !
local dana = data[name]
local slot = dana[m]
if slot then
--- for n in nodes.traverse(slot) do
--- local id = n.id
--- if id == hlist_code or id == vlist_code then
--- print(n,n.height,n.depth)
--- elseif id == glue_code then
--- print(n,n.width,gluecodes[n.subtype])
--- else
--- print(n)
--- end
--- end
- local vbox = vpack_nodelist(slot)
+ local vbox = vpack_node_list(slot)
local ht, dp = vbox.height, vbox.depth
if ht > height then
height = ht
@@ -220,11 +203,11 @@ function streams.synchronize(list) -- this is an experiment !
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 tail = vbox.list and slide_nodelist(vbox.list)
+ 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_nodelist(texgetbox("strutbox"))
+ local line = copy_node_list(texgetbox("strutbox"))
line.height, line.depth = strutht, strutdp
if tail then
tail.next, line.prev = line, tail
@@ -232,9 +215,9 @@ function streams.synchronize(list) -- this is an experiment !
tail = line
n, delta = n +1, delta - struthtdp
end
- dana[m] = vpack_nodelist(vbox.list)
+ dana[m] = vpack_node_list(vbox.list)
vbox.list = nil
- free_node(vbox)
+ 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)
end
@@ -252,7 +235,7 @@ tasks.appendaction("mvlbuilders", "normalizers", "streams.collect")
tasks.disableaction("mvlbuilders", "streams.collect")
function streams.initialize()
- tasks.enableaction ("mvlbuilders", "streams.collect")
+ enableaction("mvlbuilders","streams.collect")
function streams.initialize() end
end
@@ -260,8 +243,8 @@ end
-- todo: better names, enable etc
implement {
- name = "initializestream",
- actions = streams.initialize,
+ name = "initializestream",
+ actions = streams.initialize,
onlyonce = true,
}