diff options
Diffstat (limited to 'tex/context/base/mkxl/driv-ini.lmt')
-rw-r--r-- | tex/context/base/mkxl/driv-ini.lmt | 134 |
1 files changed, 37 insertions, 97 deletions
diff --git a/tex/context/base/mkxl/driv-ini.lmt b/tex/context/base/mkxl/driv-ini.lmt index 40b351d84..8b6c2e5ff 100644 --- a/tex/context/base/mkxl/driv-ini.lmt +++ b/tex/context/base/mkxl/driv-ini.lmt @@ -65,6 +65,14 @@ local installwhatsits do local leaderlevel = 0 local backends = backends + local trace = true + + local latelua = backends.latelua + local writeout = backends.writeout + local openout = backends.openout + local closeout = backends.closeout + + trackers.register("backends.whatsits",function(v) trace = v end) local function pushleaderlevel() leaderlevel = leaderlevel + 1 @@ -75,26 +83,26 @@ local installwhatsits do end local function flushlatelua(current,h,v) - -- Here we assume maganement by the lua function so currently we don't - -- check for leaderlevel. - return backends.latelua(current,h,v) + -- Here we assume management by the lua function so currently we don't + -- need to check for leaderlevel and it can even be counterproductive. + return latelua(current,h,v) end local function flushwriteout(current) if leaderlevel == 0 then - backends.writeout(current) + writeout(current) end end local function flushopenout(current) if leaderlevel == 0 then - backends.openout(current) + openout(current) end end local function flushcloseout(current) if leaderlevel == 0 then - backends.closeout(current) + closeout(current) end end @@ -110,8 +118,6 @@ local installwhatsits do local whatsitcodes = nodes.whatsitcodes - local trace = true trackers.register("backends.whatsits",function(v) trace = v end) - installwhatsits = function(name,flushers) -- latelua : specific @@ -135,54 +141,13 @@ local installwhatsits do return v end - -- flushers.whatsit = setmetatableindex ( { - -- [whatsitcodes.literal] = flushers.literal, - -- [whatsitcodes.latelua] = flushlatelua, - -- [whatsitcodes.userdefined] = flushuserdefined, - -- [whatsitcodes.savepos] = flushsavepos, - -- [whatsitcodes.save] = flushers.save, - -- [whatsitcodes.restore] = flushers.restore, - -- [whatsitcodes.setmatrix] = flushers.setmatrix, - -- [whatsitcodes.open] = flushopenout, - -- [whatsitcodes.close] = flushcloseout, - -- [whatsitcodes.write] = flushwriteout, - -- [whatsitcodes.startmatrix] = flushers.startmatrix, - -- [whatsitcodes.stopmatrix] = flushers.stopmatrix, - -- [whatsitcodes.startscaling] = flushers.startscaling, - -- [whatsitcodes.stopscaling] = flushers.stopscaling, - -- [whatsitcodes.startrotation] = flushers.startrotation, - -- [whatsitcodes.stoprotation] = flushers.stoprotation, - -- [whatsitcodes.startmirroring] = flushers.startmirroring, - -- [whatsitcodes.stopmirroring] = flushers.stopmirroring, - -- [whatsitcodes.startclipping] = flushers.startclipping, - -- [whatsitcodes.stopclipping] = flushers.stopclipping, - -- [whatsitcodes.setstate] = flushers.setstate, - -- }, checkagain ) - - -- -- sparse - - -- flushers.whatsit = setmetatableindex ( { - -- [whatsitcodes.latelua] = flushlatelua, - -- [whatsitcodes.userdefined] = flushuserdefined, - -- [whatsitcodes.savepos] = flushsavepos, - -- [whatsitcodes.open] = flushopenout, - -- [whatsitcodes.close] = flushcloseout, - -- [whatsitcodes.write] = flushwriteout, - -- }, checkagain ) - - -- -- delayed + -- delayed local whatsit ; whatsit = setmetatableindex ( { [whatsitcodes.literal] = flushers.literal or function(...) return checkagain(whatsit,whatsitcodes.literal )(...) end, - [whatsitcodes.latelua] = flushlatelua, - [whatsitcodes.userdefined] = flushuserdefined, - [whatsitcodes.savepos] = flushsavepos, [whatsitcodes.save] = flushers.save or function(...) return checkagain(whatsit,whatsitcodes.save )(...) end, [whatsitcodes.restore] = flushers.restore or function(...) return checkagain(whatsit,whatsitcodes.restore )(...) end, [whatsitcodes.setmatrix] = flushers.setmatrix or function(...) return checkagain(whatsit,whatsitcodes.setmatrix )(...) end, - [whatsitcodes.open] = flushopenout, - [whatsitcodes.close] = flushcloseout, - [whatsitcodes.write] = flushwriteout, [whatsitcodes.startmatrix] = flushers.startmatrix or function(...) return checkagain(whatsit,whatsitcodes.startmatrix )(...) end, [whatsitcodes.stopmatrix] = flushers.stopmatrix or function(...) return checkagain(whatsit,whatsitcodes.stopmatrix )(...) end, [whatsitcodes.startscaling] = flushers.startscaling or function(...) return checkagain(whatsit,whatsitcodes.startscaling )(...) end, @@ -194,6 +159,13 @@ local installwhatsits do [whatsitcodes.startclipping] = flushers.startclipping or function(...) return checkagain(whatsit,whatsitcodes.startclipping )(...) end, [whatsitcodes.stopclipping] = flushers.stopclipping or function(...) return checkagain(whatsit,whatsitcodes.stopclippin )(...) end, [whatsitcodes.setstate] = flushers.setstate or function(...) return checkagain(whatsit,whatsitcodes.setstate )(...) end, + -- + [whatsitcodes.latelua] = flushlatelua, + [whatsitcodes.userdefined] = flushuserdefined, + [whatsitcodes.savepos] = flushsavepos, + [whatsitcodes.open] = flushopenout, + [whatsitcodes.close] = flushcloseout, + [whatsitcodes.write] = flushwriteout, }, checkagain) flushers.whatsit = whatsit @@ -271,15 +243,15 @@ function drivers.enable(name) cleanup(currentinstance) stoptiming(drivers) end - currentdriver = name or "default" + currentdriver = name or "none" currentinstance = instances[currentdriver] if currentinstance then - local actions = currentinstance.actions - prepare = actions.prepare - wrapup = actions.wrapup - cleanup = actions.cleanup - convert = actions.convert - outputfilename = actions.outputfilename + local actions = currentinstance.actions + prepare = actions.prepare + wrapup = actions.wrapup + cleanup = actions.cleanup + convert = actions.convert + outputfilename = actions.outputfilename -- if prepare and not prepared[currentdriver] then starttiming(drivers) @@ -309,42 +281,6 @@ interfaces.implement { actions = drivers.enable, } --- The default driver: - -do - - local filename = nil - - drivers.install { - name = "default", -- "pdf" - actions = { - convert = drivers.converters.engine, - outputfilename = function(driver) - if not filename then - filename = addsuffix(tex.jobname,"pdf") - end - return filename - end, - }, - flushers = { - -- we always need this entry - }, - } - -end - --- No driver: - -do - - drivers.install { - name = "none", - actions = { }, - flushers = { }, - } - -end - do local function prepare(driver) @@ -366,10 +302,14 @@ do end --- - setmetatableindex(instances,function() return instances.default end) --- for now: +-- We default to no driver at all: + +drivers.install { + name = "none", + actions = { }, + flushers = { }, +} -drivers.enable("default") +drivers.enable("none") |