summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/node-tsk.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-04-19 17:37:21 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-04-19 17:37:21 +0200
commitd817aef76ab8b606c02bd0636661b634b43a68a6 (patch)
treeb222d7a356ebe7f1f2267f6aa4f4e424a4d6d88c /tex/context/base/mkiv/node-tsk.lua
parentd57683f5f67d6651f7b3353ff347ae57a409e0d4 (diff)
downloadcontext-d817aef76ab8b606c02bd0636661b634b43a68a6.tar.gz
2018-04-19 16:02:00
Diffstat (limited to 'tex/context/base/mkiv/node-tsk.lua')
-rw-r--r--tex/context/base/mkiv/node-tsk.lua54
1 files changed, 50 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/node-tsk.lua b/tex/context/base/mkiv/node-tsk.lua
index 1ce7ab1dc..4aec3a038 100644
--- a/tex/context/base/mkiv/node-tsk.lua
+++ b/tex/context/base/mkiv/node-tsk.lua
@@ -52,19 +52,20 @@ end
function tasks.new(specification) -- was: name,arguments,list
local name = specification.name
- local arguments = specification.arguments or 0
local sequence = specification.sequence
if name and sequence then
local tasklist = newsequencer {
-- we can move more to the sequencer now .. todo
}
tasksdata[name] = {
+ name = name,
list = tasklist,
runner = false,
- arguments = arguments,
- -- sequence = sequence,
frozen = { },
- processor = specification.processor or nodeprocessor
+ processor = specification.processor or nodeprocessor,
+ -- could be metatable but best freeze it
+ arguments = specification.arguments or 0,
+ templates = specification.templates,
}
for l=1,#sequence do
appendgroup(tasklist,sequence[l])
@@ -219,6 +220,22 @@ end)
function tasks.actions(name) -- we optimize for the number or arguments (no ...)
local data = tasksdata[name]
if data then
+ local t = data.templates
+ if t then
+ return function(...)
+ total = total + 1 -- will go away
+ local runner = data.runner
+ if not runner then
+ created = created + 1
+-- if trace_tasks then
+ report_tasks("creating runner %a",name)
+-- end
+ runner = compile(data.list,data.processor,t)
+ data.runner = runner
+ end
+ return runner(...)
+ end
+ end
local n = data.arguments or 0
if n == 0 then
return function(head)
@@ -452,3 +469,32 @@ tasks.new {
}
}
+-- for now quite useless (too fuzzy0
+--
+-- tasks.new {
+-- name = "listbuilders",
+-- processor = nodeprocessor,
+-- sequence = {
+-- "before", -- for users
+-- "normalizers",
+-- "after", -- for users
+-- },
+-- templates = {
+-- -- we don't need a default
+-- default = [[
+-- return function(box,location,prevdepth)
+-- return box, prevdepth
+-- end
+-- ]],
+-- process = [[
+-- %localize%
+-- return function(box,location,prevdepth,mirrored)
+-- %actions%
+-- return box, prevdepth
+-- end
+-- ]],
+-- step = [[
+-- box, prevdepth = %action%(box,location,prevdepth,mirrored)
+-- ]],
+-- },
+-- }