diff options
author | Marius <mariausol@gmail.com> | 2010-08-19 10:29:42 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-08-19 10:29:42 +0300 |
commit | 7d7e0d3c8d778650105cfb479f31a2bb54d69d50 (patch) | |
tree | e0c4e7d8bf466a70af56be02a0de703bbd09a5af /tex/context/base/node-mig.lua | |
parent | b469b8ec1b494ab72cd462bfc539ce01440e6aaf (diff) | |
download | context-7d7e0d3c8d778650105cfb479f31a2bb54d69d50.tar.gz |
beta 2010.08.19 01:08
Diffstat (limited to 'tex/context/base/node-mig.lua')
-rw-r--r-- | tex/context/base/node-mig.lua | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/tex/context/base/node-mig.lua b/tex/context/base/node-mig.lua index c2d6e8eca..24f01fbff 100644 --- a/tex/context/base/node-mig.lua +++ b/tex/context/base/node-mig.lua @@ -8,18 +8,21 @@ if not modules then modules = { } end modules ['node-mig'] = { local format = string.format +local attributes, nodes, node = attributes, nodes, node + local has_attribute = node.has_attribute local set_attribute = node.set_attribute local remove_nodes = nodes.remove -local nodecodes = nodes.nodecodes +local nodecodes = nodes.nodecodes +local tasks = nodes.tasks -local hlist = nodecodes.hlist -local vlist = nodecodes.vlist -local insert = nodecodes.ins -local mark = nodecodes.mark +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local insert_code = nodecodes.ins +local mark_code = nodecodes.mark -local migrated = attributes.private("migrated") +local migrated = attributes.private("migrated") local trace_migrations = false trackers.register("nodes.migrations", function(v) trace_migrations = v end) @@ -33,10 +36,10 @@ local function locate(head,first,last,ni,nm) local current = head while current do local id = current.id - if id == vlist or id == hlist then + if id == vlist_code or id == hlist_code then current.list, first, last, ni, nm = locate(current.list,first,last,ni,nm) current= current.next - elseif migrate_inserts and id == insert then + elseif migrate_inserts and id == insert_code then local insert head, current, insert = remove_nodes(head,current) insert.next = nil @@ -46,7 +49,7 @@ local function locate(head,first,last,ni,nm) insert.prev, first = nil, insert end last, ni = insert, ni + 1 - elseif migrate_marks and id == mark then + elseif migrate_marks and id == mark_code then local mark head, current, mark = remove_nodes(head,current) mark.next = nil @@ -63,20 +66,20 @@ local function locate(head,first,last,ni,nm) return head, first, last, ni, nm end -function nodes.migrate_outwards(head,where) +function nodes.handlers.migrate(head,where) local done = false if head then local current = head while current do local id = current.id - if id == vlist or id == hlist and not has_attribute(current,migrated) then + if id == vlist_code or id == hlist_code and not has_attribute(current,migrated) then set_attribute(current,migrated,1) t_sweeps = t_sweeps + 1 local h = current.list local first, last, ni, nm while h do local id = h.id - if id == vlist or id == hlist then + if id == vlist_code or id == hlist_code then h, first, last, ni, nm = locate(h,first,last,0,0) end h = h.next @@ -103,14 +106,14 @@ end experiments.register("marks.migrate", function(v) if v then - tasks.enableaction("mvlbuilders", "nodes.migrate_outwards") + tasks.enableaction("mvlbuilders", "nodes.handlers.migrate") end migrate_marks = v end) experiments.register("inserts.migrate", function(v) if v then - tasks.enableaction("mvlbuilders", "nodes.migrate_outwards") + tasks.enableaction("mvlbuilders", "nodes.handlers.migrate") end migrate_inserts = v end) |