summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/mult-ini.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-04-16 16:06:47 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-04-16 16:06:47 +0200
commita104570ad82618ffffc82ffea3f12c5bb0a35232 (patch)
treef58dd337722644cc179ed4865aa0c1d6ca8b1b7b /tex/context/base/mkiv/mult-ini.lua
parentdaff89c886893f6bf7d092e45b7f78d5395f6274 (diff)
downloadcontext-a104570ad82618ffffc82ffea3f12c5bb0a35232.tar.gz
2016-04-16 15:32:00
Diffstat (limited to 'tex/context/base/mkiv/mult-ini.lua')
-rw-r--r--tex/context/base/mkiv/mult-ini.lua110
1 files changed, 77 insertions, 33 deletions
diff --git a/tex/context/base/mkiv/mult-ini.lua b/tex/context/base/mkiv/mult-ini.lua
index 3fb5416ba..409c735b7 100644
--- a/tex/context/base/mkiv/mult-ini.lua
+++ b/tex/context/base/mkiv/mult-ini.lua
@@ -215,6 +215,8 @@ function interfaces.setuserinterface(interface,response)
sharedstorage.currentinterface, currentinterface = interface, interface
sharedstorage.currentresponse, currentresponse = response, response
if environment.initex then
+ local setmacro = false
+ -- local setmacro = interfaces.setmacro -- cleaner (but we need to test first)
local nofconstants = 0
local nofvariables = 0
local nofelements = 0
@@ -222,49 +224,91 @@ function interfaces.setuserinterface(interface,response)
local nofformats = 0
local noftranslations = 0
local nofsetupstrings = 0
- local t, n, f, s
--
- t, n, f, s = { }, 0, formatters["\\ui_c{%s}{%s}"], formatters["\\ui_s{%s}"]
- for given, constant in next, complete.constants do
- constant = constant[interface] or constant.en or given
- constants[constant] = given -- breedte -> width
- nofconstants = nofconstants + 1
- if given == constant then
- t[nofconstants] = s(given)
- else
- t[nofconstants] = f(given,constant)
+ if setmacro then
+ for given, constant in next, complete.constants do
+ constant = constant[interface] or constant.en or given
+ constants[constant] = given -- breedte -> width
+ nofconstants = nofconstants + 1
+ setmacro("c!"..given,given)
+ if currentinterface ~= "en" then
+ setmacro("k!"..constant,given)
+ end
+ end
+ else
+ local t, f, s = { }, formatters["\\ui_c{%s}{%s}"], formatters["\\ui_s{%s}"]
+ for given, constant in next, complete.constants do
+ constant = constant[interface] or constant.en or given
+ constants[constant] = given -- breedte -> width
+ nofconstants = nofconstants + 1
+ if given == constant then
+ t[nofconstants] = s(given)
+ else
+ t[nofconstants] = f(given,constant)
+ end
end
+ contextsprint(prtcatcodes,concat(t))
end
- contextsprint(prtcatcodes,concat(t))
--
- t, n, f = { }, 0, formatters["\\ui_v{%s}{%s}"]
- for given, variable in next, complete.variables do
- variable = variable[interface] or variable.en or given
- variables[given] = variable -- ja -> yes
- nofvariables = nofvariables + 1
- t[nofvariables] = f(given,variable)
+ if setmacro then
+ for given, variable in next, complete.variables do
+ variable = variable[interface] or variable.en or given
+ variables[given] = variable -- ja -> yes
+ nofvariables = nofvariables + 1
+ setmacro("v!"..given,variable)
+ end
+ else
+ local t, f = { }, formatters["\\ui_v{%s}{%s}"]
+ for given, variable in next, complete.variables do
+ variable = variable[interface] or variable.en or given
+ variables[given] = variable -- ja -> yes
+ nofvariables = nofvariables + 1
+ t[nofvariables] = f(given,variable)
+ end
+ contextsprint(prtcatcodes,concat(t))
end
- contextsprint(prtcatcodes,concat(t))
--
- t, n, f = { }, 0, formatters["\\ui_e{%s}{%s}"]
- for given, element in next, complete.elements do
- element = element[interface] or element.en or given
- elements[element] = given
- nofelements = nofelements + 1
- t[nofelements] = f(given,element)
+ if setmacro then
+ for given, element in next, complete.elements do
+ element = element[interface] or element.en or given
+ elements[element] = given
+ nofelements = nofelements + 1
+ setmacro("e!"..given,element)
+ end
+ else
+ local t, f = { }, formatters["\\ui_e{%s}{%s}"]
+ for given, element in next, complete.elements do
+ element = element[interface] or element.en or given
+ elements[element] = given
+ nofelements = nofelements + 1
+ t[nofelements] = f(given,element)
+ end
+ contextsprint(prtcatcodes,concat(t))
end
- contextsprint(prtcatcodes,concat(t))
--
- t, n, f = { }, 0, formatters["\\ui_m{%s}{%s}"]
- for given, command in next, complete.commands do
- command = command[interface] or command.en or given
- if command ~= given then
- n = n + 1
- t[n] = f(given,command)
+ if setmacro then
+ -- this can only work ok when we already have defined the command
+ luatex.registerdumpactions(function()
+ for given, command in next, complete.commands do
+ command = command[interface] or command.en or given
+ if command ~= given then
+ setmacro(prtcatcodes,given,"\\"..command)
+ end
+ nofcommands = nofcommands + 1
+ end
+ end)
+ else
+ local t, n, f = { }, 0, formatters["\\ui_m{%s}{%s}"]
+ for given, command in next, complete.commands do
+ command = command[interface] or command.en or given
+ if command ~= given then
+ n = n + 1
+ t[n] = f(given,command)
+ end
+ nofcommands = nofcommands + 1
end
- nofcommands = nofcommands + 1
+ contextsprint(prtcatcodes,concat(t))
end
- contextsprint(prtcatcodes,concat(t))
--
for given, format in next, complete.messages.formats do
formats[given] = format[interface] or format.en or given