summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/cldf-stp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/cldf-stp.lua')
-rw-r--r--tex/context/base/mkiv/cldf-stp.lua57
1 files changed, 46 insertions, 11 deletions
diff --git a/tex/context/base/mkiv/cldf-stp.lua b/tex/context/base/mkiv/cldf-stp.lua
index eeed47594..2ce6341b3 100644
--- a/tex/context/base/mkiv/cldf-stp.lua
+++ b/tex/context/base/mkiv/cldf-stp.lua
@@ -18,8 +18,8 @@ if not modules then modules = { } end modules ['cldf-stp'] = {
-- ...
-- context.step(nil|...)
-- ...
--- context.step(nil|...)
--- ...
+-- context.step(nil|...)
+-- ...
-- end)
-- ...
-- context.step(nil|...)
@@ -28,6 +28,8 @@ if not modules then modules = { } end modules ['cldf-stp'] = {
-- ...
-- end)
+local context = context
+
local create = coroutine.create
local yield = coroutine.yield
local resume = coroutine.resume
@@ -53,17 +55,50 @@ interfaces.implement {
local ctx_resume = context.protected.cs.clf_step
-function context.step(first,...)
- if first ~= nil then
- context(first,...)
+local closeinput = texio.closeinput -- experiment
+local closeindeed = true
+local stepsindeed = true
+
+directives.register("context.steps.nosteps",function(v) stepsindeed = not v end)
+directives.register("context.steps.noclose",function(v) closeindeed = not v end)
+
+if closeinput then
+
+ function context.step(first,...)
+ if first ~= nil then
+ context(first,...)
+ end
+if stepper then
+ ctx_resume()
+ yield()
+ if closeindeed then
+ closeinput()
+ end
+end
end
- ctx_resume()
- yield()
+
+else
+
+ function context.step(first,...)
+ if first ~= nil then
+ context(first,...)
+ end
+if stepper then
+ ctx_resume()
+ yield()
+end
+ end
+
end
function context.stepwise(f)
- depth = depth + 1
- stack[depth] = stepper
- stepper = create(f)
- ctx_resume(stepper)
+ if stepsindeed then
+ depth = depth + 1
+ stack[depth] = stepper
+ stepper = create(f)
+ -- ctx_resume(stepper)
+ ctx_resume()
+ else
+ f()
+ end
end