summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/node-tsk.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/node-tsk.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/node-tsk.lua86
1 files changed, 49 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/context/base/node-tsk.lua b/Master/texmf-dist/tex/context/base/node-tsk.lua
index 29a665ff031..efc51913c12 100644
--- a/Master/texmf-dist/tex/context/base/node-tsk.lua
+++ b/Master/texmf-dist/tex/context/base/node-tsk.lua
@@ -10,22 +10,26 @@ if not modules then modules = { } end modules ['node-tsk'] = {
-- we already have dirty flags as well. On the other hand, nodes are
-- rather specialized and here we focus on node related tasks.
+local format = string.format
+
local trace_tasks = false trackers.register("tasks.creation", function(v) trace_tasks = v end)
local report_tasks = logs.reporter("tasks")
local allocate = utilities.storage.allocate
-local nodes = nodes
+local nodes = nodes
-nodes.tasks = nodes.tasks or { }
-local tasks = nodes.tasks
+nodes.tasks = nodes.tasks or { }
+local tasks = nodes.tasks
-local tasksdata = { } -- no longer public
+local tasksdata = { } -- no longer public
-local sequencers = utilities.sequencers
+local sequencers = utilities.sequencers
+local compile = sequencers.compile
+local nodeprocessor = sequencers.nodeprocessor
-local frozengroups = "no"
+local frozengroups = "no"
function tasks.freeze(kind)
frozengroups = kind or "tolerant" -- todo: hook into jobname
@@ -36,13 +40,16 @@ function tasks.new(specification) -- was: name,arguments,list
local arguments = specification.arguments or 0
local sequence = specification.sequence
if name and sequence then
- local tasklist = sequencers.reset()
+ local tasklist = sequencers.new {
+ -- we can move more to the sequencer now .. todo
+ }
tasksdata[name] = {
list = tasklist,
runner = false,
arguments = arguments,
-- sequence = sequence,
frozen = { },
+ processor = specification.processor or nodeprocessor
}
for l=1,#sequence do
sequencers.appendgroup(tasklist,sequence[l])
@@ -152,7 +159,7 @@ end
function tasks.showactions(name,group,action,where,kind)
local data = valid(name)
if data then
- report_tasks("task %s, list:\n%s",name,sequencers.nodeprocessor(data.list))
+ report_tasks("task %s, list:\n%s",name,nodeprocessor(data.list))
end
end
@@ -165,14 +172,12 @@ local created, total = 0, 0
statistics.register("node list callback tasks", function()
if total > 0 then
- return string.format("%s unique task lists, %s instances (re)created, %s calls",table.count(tasksdata),created,total)
+ return format("%s unique task lists, %s instances (re)created, %s calls",table.count(tasksdata),created,total)
else
return nil
end
end)
-local compile, nodeprocessor = sequencers.compile, sequencers.nodeprocessor
-
function tasks.actions(name) -- we optimize for the number or arguments (no ...)
local data = tasksdata[name]
if data then
@@ -186,7 +191,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
if trace_tasks then
report_tasks("creating runner '%s'",name)
end
- runner = compile(data.list,nodeprocessor,0)
+ runner = compile(data.list,data.processor,0)
data.runner = runner
end
return runner(head)
@@ -200,7 +205,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
if trace_tasks then
report_tasks("creating runner '%s' with 1 extra arguments",name)
end
- runner = compile(data.list,nodeprocessor,1)
+ runner = compile(data.list,data.processor,1)
data.runner = runner
end
return runner(head,one)
@@ -214,7 +219,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
if trace_tasks then
report_tasks("creating runner '%s' with 2 extra arguments",name)
end
- runner = compile(data.list,nodeprocessor,2)
+ runner = compile(data.list,data.processor,2)
data.runner = runner
end
return runner(head,one,two)
@@ -228,7 +233,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
if trace_tasks then
report_tasks("creating runner '%s' with 3 extra arguments",name)
end
- runner = compile(data.list,nodeprocessor,3)
+ runner = compile(data.list,data.processor,3)
data.runner = runner
end
return runner(head,one,two,three)
@@ -242,7 +247,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
if trace_tasks then
report_tasks("creating runner '%s' with 4 extra arguments",name)
end
- runner = compile(data.list,nodeprocessor,4)
+ runner = compile(data.list,data.processor,4)
data.runner = runner
end
return runner(head,one,two,three,four)
@@ -256,7 +261,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
if trace_tasks then
report_tasks("creating runner '%s' with 5 extra arguments",name)
end
- runner = compile(data.list,nodeprocessor,5)
+ runner = compile(data.list,data.processor,5)
data.runner = runner
end
return runner(head,one,two,three,four,five)
@@ -270,7 +275,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)
if trace_tasks then
report_tasks("creating runner '%s' with n extra arguments",name)
end
- runner = compile(data.list,nodeprocessor,"n")
+ runner = compile(data.list,data.processor,"n")
data.runner = runner
end
return runner(head,...)
@@ -313,6 +318,7 @@ end
tasks.new {
name = "processors",
arguments = 4,
+ processor = nodeprocessor,
sequence = {
"before", -- for users
"normalizers",
@@ -327,6 +333,7 @@ tasks.new {
tasks.new {
name = "finalizers",
arguments = 1,
+ processor = nodeprocessor,
sequence = {
"before", -- for users
"normalizers",
@@ -341,6 +348,7 @@ tasks.new {
tasks.new {
name = "shipouts",
arguments = 0,
+ processor = nodeprocessor,
sequence = {
"before", -- for users
"normalizers",
@@ -352,6 +360,7 @@ tasks.new {
tasks.new {
name = "mvlbuilders",
arguments = 1,
+ processor = nodeprocessor,
sequence = {
"before", -- for users
"normalizers",
@@ -362,6 +371,7 @@ tasks.new {
tasks.new {
name = "vboxbuilders",
arguments = 5,
+ processor = nodeprocessor,
sequence = {
"before", -- for users
"normalizers",
@@ -369,22 +379,24 @@ tasks.new {
}
}
---~ tasks.new {
---~ name = "parbuilders",
---~ arguments = 1,
---~ sequence = {
---~ "before", -- for users
---~ "lists",
---~ "after", -- for users
---~ }
---~ }
-
---~ tasks.new {
---~ name = "pagebuilders",
---~ arguments = 5,
---~ sequence = {
---~ "before", -- for users
---~ "lists",
---~ "after", -- for users
---~ }
---~ }
+-- tasks.new {
+-- name = "parbuilders",
+-- arguments = 1,
+-- processor = nodeprocessor,
+-- sequence = {
+-- "before", -- for users
+-- "lists",
+-- "after", -- for users
+-- }
+-- }
+
+-- tasks.new {
+-- name = "pagebuilders",
+-- arguments = 5,
+-- processor = nodeprocessor,
+-- sequence = {
+-- "before", -- for users
+-- "lists",
+-- "after", -- for users
+-- }
+-- }