diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/back-ini.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/back-ini.lua | 144 |
1 files changed, 46 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/context/base/back-ini.lua b/Master/texmf-dist/tex/context/base/back-ini.lua index 12a487dd4dc..39de73741e2 100644 --- a/Master/texmf-dist/tex/context/base/back-ini.lua +++ b/Master/texmf-dist/tex/context/base/back-ini.lua @@ -6,99 +6,48 @@ if not modules then modules = { } end modules ['back-ini'] = { license = "see context related readme files" } -backends = backends or { } -local trace_backend = false +backends = backends or { } +local backends = backends -local function nothing() return nil end - -backends.nothing = nothing - -backends.nodeinjections = { - rgbcolor = nothing, - cmykcolor = nothing, - graycolor = nothing, - spotcolor = nothing, - transparency = nothing, - overprint = nothing, - knockout = nothing, - positive = nothing, - negative = nothing, - effect = nothing, - startlayer = nothing, - stoplayer = nothing, - switchlayer = nothing, - - reference = nothing, - destination = nothing, - -} - -backends.codeinjections = { - - prerollreference = nothing, - - insertmovie = nothing, - insertsound = nothing, +local trace_backend = false trackers.register("backend.initializers", function(v) trace_finalizers = v end) - presetsymbollist = nothing, - registersymbol = nothing, - registeredsymbol = nothing, +local report_backend = logs.reporter("backend","initializing") - registercomment = nothing, - embedfile = nothing, - attachfile = nothing, - adddocumentinfo = nothing, - setupidentity = nothing, - setpagetransition = nothing, - defineviewerlayer = nothing, - addbookmarks = nothing, - addtransparencygroup = nothing, +local allocate = utilities.storage.allocate +local setmetatableindex = table.setmetatableindex - typesetfield = nothing, - doiffieldelse = nothing, - doiffieldgroupelse = nothing, - definefield = nothing, - clonefield = nothing, - definefieldset = nothing, - getfieldgroup = nothing, - setformsmethod = nothing, - getdefaultfieldvalue = nothing, - - setupcanvas = nothing, +local function nothing() return nil end - initializepage = nothing, - initializedocument = nothing, - finalizepage = nothing, - finalizedocument = nothing, +backends.nothing = nothing - flushpageactions = nothing, - flushdocumentactions = nothing, +local nodeinjections = { } +local codeinjections = { } +local registrations = { } +local tables = allocate() - insertrenderingwindow = nothing, - processrendering = nothing, - kindofrendering = nothing, - flushrenderingwindow = nothing, +local function donothing(t,k) + t[k] = nothing + return nothing +end - setfigurecolorspace = nothing, - setfigurealternative = nothing, +setmetatableindex(nodeinjections, donothing) +setmetatableindex(codeinjections, donothing) +setmetatableindex(registrations, donothing) +local defaults = { + nodeinjections = nodeinjections, + codeinjections = codeinjections, + registrations = registrations, + tables = tables, } -backends.registrations = { - grayspotcolor = nothing, - rgbspotcolor = nothing, - cmykspotcolor = nothing, - grayindexcolor = nothing, - rgbindexcolor = nothing, - cmykindexcolor = nothing, - spotcolorname = nothing, - transparency = nothing, -} +backends.defaults = defaults -local nodeinjections = backends.nodeinjections -local codeinjections = backends.codeinjections -local registrations = backends.registrations +backends.nodeinjections = { } setmetatableindex(backends.nodeinjections, nodeinjections) +backends.codeinjections = { } setmetatableindex(backends.codeinjections, codeinjections) +backends.registrations = { } setmetatableindex(backends.registrations, registrations) +backends.tables = { } setmetatableindex(backends.tables, tables) backends.current = "unknown" @@ -107,28 +56,16 @@ function backends.install(what) local backend = backends[what] if backend then if trace_backend then - logs.report("backend", "initializing backend %s (%s)",what,backend.comment or "no comment") + report_backend("initializing backend %s (%s)",what,backend.comment or "no comment") end backends.current = what - for _, category in next, { "nodeinjections", "codeinjections", "registrations"} do - local plugin = backend[category] - if plugin then - local whereto = backends[category] - for name, meaning in next, whereto do - if plugin[name] then - whereto[name] = plugin[name] - -- logs.report("backend", "installing function %s in category %s of %s",name,category,what) - elseif trace_backend then - logs.report("backend", "no function %s in category %s of %s",name,category,what) - end - end - elseif trace_backend then - logs.report("backend", "no category %s in %s",category,what) - end + for category, default in next, defaults do + local target, plugin = backends[category], backend[category] + setmetatableindex(plugin, default) + setmetatableindex(target, plugin) end - backends.helpers = backend.helpers elseif trace_backend then - logs.report("backend", "no backend named %s",what) + report_backend("no backend named %s",what) end end end @@ -141,3 +78,14 @@ statistics.register("used backend", function() return nil end end) + +local comment = { "comment", "" } + +tables.vfspecials = allocate { + red = comment, + green = comment, + blue = comment, + black = comment, + startslant = comment, + stopslant = comment, +} |