diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mult-ini.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mult-ini.lua | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/context/base/mult-ini.lua b/Master/texmf-dist/tex/context/base/mult-ini.lua index 4156e813d38..d14f38ad5f6 100644 --- a/Master/texmf-dist/tex/context/base/mult-ini.lua +++ b/Master/texmf-dist/tex/context/base/mult-ini.lua @@ -12,23 +12,25 @@ local serialize = table.serialize local allocate = utilities.storage.allocate local mark = utilities.storage.mark -local texsprint = tex.sprint +local contextsprint = context.sprint local setmetatableindex = table.setmetatableindex local report_interface = logs.reporter("interface","initialization") -interfaces = interfaces or { } -interfaces.constants = mark(interfaces.constants or { }) -interfaces.variables = mark(interfaces.variables or { }) -interfaces.elements = mark(interfaces.elements or { }) -interfaces.formats = mark(interfaces.formats or { }) -interfaces.translations = mark(interfaces.translations or { }) - -storage.register("interfaces/constants", interfaces.constants, "interfaces.constants") -storage.register("interfaces/variables", interfaces.variables, "interfaces.variables") -storage.register("interfaces/elements", interfaces.elements, "interfaces.elements") -storage.register("interfaces/formats", interfaces.formats, "interfaces.formats") -storage.register("interfaces/translations", interfaces.translations, "interfaces.translations") +interfaces = interfaces or { } +interfaces.constants = mark(interfaces.constants or { }) +interfaces.variables = mark(interfaces.variables or { }) +interfaces.elements = mark(interfaces.elements or { }) +interfaces.formats = mark(interfaces.formats or { }) +interfaces.translations = mark(interfaces.translations or { }) +interfaces.corenamespaces = mark(interfaces.corenamespaces or { }) + +storage.register("interfaces/constants", interfaces.constants, "interfaces.constants") +storage.register("interfaces/variables", interfaces.variables, "interfaces.variables") +storage.register("interfaces/elements", interfaces.elements, "interfaces.elements") +storage.register("interfaces/formats", interfaces.formats, "interfaces.formats") +storage.register("interfaces/translations", interfaces.translations, "interfaces.translations") +storage.register("interfaces/corenamespaces", interfaces.corenamespaces, "interfaces.corenamespaces") interfaces.interfaces = { "cs", "de", "en", "fr", "it", "nl", "ro", "pe", @@ -54,12 +56,13 @@ end setmetatableindex(complete, resolve) -local constants = interfaces.constants -local variables = interfaces.variables -local elements = interfaces.elements -local formats = interfaces.formats -local translations = interfaces.translations -local reporters = { } -- just an optimization +local constants = interfaces.constants +local variables = interfaces.variables +local elements = interfaces.elements +local formats = interfaces.formats +local translations = interfaces.translations +local corenamespaces = interfaces.corenamespaces +local reporters = { } -- just an optimization local function valueiskey(t,k) -- will be helper t[k] = k @@ -72,6 +75,10 @@ setmetatableindex(elements, valueiskey) setmetatableindex(formats, valueiskey) setmetatableindex(translations, valueiskey) +function commands.registernamespace(n,namespace) + corenamespaces[n] = namespace +end + local function resolve(t,k) local v = logs.reporter(k) t[k] = v @@ -147,8 +154,11 @@ local splitter = lpeg.splitat(",") function interfaces.showmessage(category,tag,arguments) local r = reporters[category] local f = formats[fulltag(category,tag)] - if type(arguments) == "string" and #arguments > 0 then + local t = type(arguments) + if t == "string" and #arguments > 0 then r(f,lpegmatch(splitter,arguments)) + elseif t == "table" then + r(f,unpack(arguments)) elseif arguments then r(f,arguments) else @@ -176,9 +186,9 @@ logs.setmessenger(context.verbatim.ctxreport) -- status -function commands.writestatus(category,message) +function commands.writestatus(category,message,...) local r = reporters[category] - r(message) + r(message,...) end -- initialization @@ -191,28 +201,28 @@ function interfaces.setuserinterface(interface,response) for given, constant in next, complete.constants do constant = constant[interface] or constant.en or given constants[constant] = given -- breedte -> width - texsprint("\\do@sicon{",given,"}{",constant,"}") + contextsprint("\\do@sicon{",given,"}{",constant,"}") nofconstants = nofconstants + 1 end local nofvariables = 0 for given, variable in next, complete.variables do variable = variable[interface] or variable.en or given variables[given] = variable -- ja -> yes - texsprint("\\do@sivar{",given,"}{",variable,"}") + contextsprint("\\do@sivar{",given,"}{",variable,"}") nofvariables = nofvariables + 1 end local nofelements = 0 for given, element in next, complete.elements do element = element[interface] or element.en or given elements[element] = given - texsprint("\\do@siele{",given,"}{",element,"}") + contextsprint("\\do@siele{",given,"}{",element,"}") nofelements = nofelements + 1 end local nofcommands = 0 for given, command in next, complete.commands do command = command[interface] or command.en or given if command ~= given then - texsprint("\\do@sicom{",given,"}{",command,"}") + contextsprint("\\do@sicom{",given,"}{",command,"}") end nofcommands = nofcommands + 1 end @@ -226,7 +236,7 @@ function interfaces.setuserinterface(interface,response) translations[given] = translation[interface] or translation.en or given noftranslations = noftranslations + 1 end - report_interface("definitions: %s constants, %s variables, %s elements, %s commands, % formats, %s translations", + report_interface("definitions: %s constants, %s variables, %s elements, %s commands, %s formats, %s translations", nofconstants,nofvariables,nofelements,nofcommands,nofformats,noftranslations) end end |