From 65d009a0596b194597f47531523addd3e64ed005 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 20 Mar 2018 22:10:59 +0000 Subject: context [current] (20mar18) git-svn-id: svn://tug.org/texlive/trunk@47050 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/context/base/mkiv/cldf-stp.lua | 57 +++++++++++++++++----- 1 file changed, 46 insertions(+), 11 deletions(-) (limited to 'Master/texmf-dist/tex/context/base/mkiv/cldf-stp.lua') diff --git a/Master/texmf-dist/tex/context/base/mkiv/cldf-stp.lua b/Master/texmf-dist/tex/context/base/mkiv/cldf-stp.lua index eeed47594f8..2ce6341b3f0 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/cldf-stp.lua +++ b/Master/texmf-dist/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 -- cgit v1.2.3