From 0ae14e7400b2e4a6cf76d7e185433f5f901b5592 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 28 Jan 2021 18:40:41 +0100 Subject: 2021-01-28 18:20:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/cont-run.lua | 26 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/mult-fmt.lua | 227 ++++++++++++-- tex/context/base/mkiv/mult-ini.lua | 2 +- tex/context/base/mkiv/mult-low.lua | 2 + tex/context/base/mkiv/mult-prm.lua | 1 + tex/context/base/mkiv/pack-box.mkiv | 2 +- tex/context/base/mkiv/page-otr.mkvi | 2 - tex/context/base/mkiv/phys-dim.lua | 14 +- tex/context/base/mkiv/publ-imp-apa.mkvi | 40 +-- tex/context/base/mkiv/publ-imp-aps.mkvi | 26 +- tex/context/base/mkiv/publ-imp-author.mkvi | 2 +- tex/context/base/mkiv/publ-imp-chicago.mkvi | 50 +-- tex/context/base/mkiv/publ-imp-cite.mkvi | 4 +- tex/context/base/mkiv/publ-imp-default.mkvi | 16 +- tex/context/base/mkiv/publ-imp-definitions.mkvi | 10 +- tex/context/base/mkiv/publ-imp-list.mkvi | 8 +- tex/context/base/mkiv/publ-ini.mkiv | 4 +- tex/context/base/mkiv/spac-ali.mkiv | 2 +- tex/context/base/mkiv/status-files.pdf | Bin 26121 -> 26107 bytes tex/context/base/mkiv/status-lua.pdf | Bin 255112 -> 255206 bytes tex/context/base/mkiv/syst-aux.lua | 16 +- tex/context/base/mkiv/syst-aux.mkiv | 4 +- tex/context/base/mkxl/anch-pos.mkxl | 6 +- tex/context/base/mkxl/buff-par.mklx | 6 +- tex/context/base/mkxl/catc-ini.mkxl | 12 +- tex/context/base/mkxl/catc-sym.mkxl | 14 +- tex/context/base/mkxl/chem-str.mkxl | 10 +- tex/context/base/mkxl/colo-ini.mkxl | 3 - tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/cont-run.lmt | 311 +++++++++++++++++++ tex/context/base/mkxl/cont-run.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 11 +- tex/context/base/mkxl/core-con.mkxl | 20 +- tex/context/base/mkxl/driv-shp.lmt | 105 ++++--- tex/context/base/mkxl/enco-ini.mkxl | 7 +- tex/context/base/mkxl/file-res.mklx | 2 +- tex/context/base/mkxl/font-ini.mklx | 4 + tex/context/base/mkxl/font-lib.mklx | 2 +- tex/context/base/mkxl/font-mps.lmt | 395 ++++++++++++++++++++++++ tex/context/base/mkxl/font-sty.mklx | 4 +- tex/context/base/mkxl/font-tra.mkxl | 2 +- tex/context/base/mkxl/grph-fig.mkxl | 5 + tex/context/base/mkxl/lang-ini.mkxl | 8 +- tex/context/base/mkxl/luat-ini.mkxl | 2 + tex/context/base/mkxl/math-ini.mkxl | 2 +- tex/context/base/mkxl/meta-ini.mkxl | 5 +- tex/context/base/mkxl/meta-nod.mkxl | 3 + tex/context/base/mkxl/mlib-pdf.mkxl | 2 +- tex/context/base/mkxl/mult-aux.mkxl | 2 +- tex/context/base/mkxl/mult-ini.mkxl | 28 +- tex/context/base/mkxl/node-rul.mkxl | 8 +- tex/context/base/mkxl/pack-box.mkxl | 2 +- tex/context/base/mkxl/pack-lyr.mkxl | 10 +- tex/context/base/mkxl/pack-obj.mkxl | 2 +- tex/context/base/mkxl/pack-rul.lmt | 1 + tex/context/base/mkxl/pack-rul.mkxl | 28 +- tex/context/base/mkxl/page-otr.mklx | 2 - tex/context/base/mkxl/page-pcl.mkxl | 2 +- tex/context/base/mkxl/page-sid.mkxl | 12 +- tex/context/base/mkxl/phys-dim.mkxl | 11 + tex/context/base/mkxl/publ-ini.mkxl | 6 +- tex/context/base/mkxl/regi-ini.mkxl | 2 +- tex/context/base/mkxl/scrn-fld.mklx | 8 + tex/context/base/mkxl/spac-ali.mkxl | 2 +- tex/context/base/mkxl/spac-ver.mkxl | 9 +- tex/context/base/mkxl/strc-itm.mklx | 18 +- tex/context/base/mkxl/strc-lst.mklx | 32 +- tex/context/base/mkxl/strc-pag.mkxl | 8 +- tex/context/base/mkxl/strc-reg.mkxl | 1 + tex/context/base/mkxl/strc-sec.mkxl | 4 +- tex/context/base/mkxl/symb-ini.mkxl | 4 +- tex/context/base/mkxl/syst-aux.lmt | 23 +- tex/context/base/mkxl/syst-aux.mkxl | 75 +++-- tex/context/base/mkxl/syst-ini.mkxl | 45 ++- tex/context/base/mkxl/syst-lua.lmt | 2 +- tex/context/base/mkxl/tabl-ntb.mkxl | 8 +- tex/context/base/mkxl/tabl-tab.mkxl | 10 +- tex/context/base/mkxl/tabl-tbl.mkxl | 13 +- tex/context/base/mkxl/trac-tex.mkxl | 5 +- tex/context/base/mkxl/typo-cap.mkxl | 3 +- tex/context/base/mkxl/typo-del.mkxl | 6 +- tex/context/modules/mkiv/s-system-macros.mkxl | 19 +- 86 files changed, 1390 insertions(+), 432 deletions(-) create mode 100644 tex/context/base/mkxl/cont-run.lmt create mode 100644 tex/context/base/mkxl/font-mps.lmt (limited to 'tex/context') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 2af36d356..7b2009ec1 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.01.26 18:02} +\newcontextversion{2021.01.28 18:17} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index dbdc83d4c..1ea02bd7a 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.01.26 18:02} +\edef\contextversion{2021.01.28 18:17} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index eb9380033..f57a3cd66 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.01.26 18:02} +\newcontextversion{2021.01.28 18:17} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/cont-run.lua b/tex/context/base/mkiv/cont-run.lua index e9bb5b338..0d8d79691 100644 --- a/tex/context/base/mkiv/cont-run.lua +++ b/tex/context/base/mkiv/cont-run.lua @@ -200,7 +200,7 @@ local function processjob() local suffix = environment.suffix local filename = environment.filename -- hm, not inputfilename ! - environment.lmtxmode = CONTEXTLMTXMODE + environment.lmtxmode = false if arguments.nosynctex then luatex.synctex.setup { @@ -213,24 +213,6 @@ local function processjob() } end - if CONTEXTLMTXMODE then - - local overloadmode = arguments.overloadmode - - if overloadmode == "warning" then - overloadmode = 3 -- 5 - elseif overloadmode == "error" then - overloadmode = 4 -- 6 - else - overloadmode = tonumber(overloadmode) - end - - if overloadmode then - tex.set("overloadmode",overloadmode) - end - - end - if not filename or filename == "" then -- skip elseif suffix == "xml" or arguments.forcexml then @@ -310,9 +292,3 @@ implement { onlyonce = true, actions = processjob, } - -if CONTEXTLMTXMODE then - - texconfig.firstline = "\\processjob " -- experiment, yet undocumented - -end diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 372a1c29b..1c9c3f894 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.01.26 18:02} +\edef\contextversion{2021.01.28 18:17} %D Kind of special: diff --git a/tex/context/base/mkiv/mult-fmt.lua b/tex/context/base/mkiv/mult-fmt.lua index 8d116c44f..53dbff5b8 100644 --- a/tex/context/base/mkiv/mult-fmt.lua +++ b/tex/context/base/mkiv/mult-fmt.lua @@ -15,6 +15,9 @@ local prtcatcodes = catcodes.numbers.prtcatcodes local contextsprint = context.sprint local implement = interfaces.implement +local setmacro = token.set_macro +local definedmacro = token.is_defined + local report = logs.reporter("interface") local report_interface = logs.reporter("interface","initialization") local report_variable = logs.reporter("variable") @@ -38,7 +41,151 @@ local function limit(str,n) return str end --- todo: use setmacro +-- function interfaces.setuserinterface(interface,response) +-- local variables = interfaces.variables +-- local constants = interfaces.constants +-- local elements = interfaces.elements +-- local formats = interfaces.formats +-- local translations = interfaces.translations +-- local setupstrings = interfaces.setupstrings +-- local complete = interfaces.complete +-- local sharedstorage = storage.shared +-- -- +-- sharedstorage.currentinterface, currentinterface = interface, interface +-- sharedstorage.currentresponse, currentresponse = response, response +-- -- +-- if environment.initex then +-- local nofconstants = 0 +-- local nofvariables = 0 +-- local nofelements = 0 +-- local nofcommands = 0 +-- local nofformats = 0 +-- local noftranslations = 0 +-- local nofsetupstrings = 0 +-- -- +-- do +-- local list = complete.constants -- forces the load +-- local t = { } +-- local f = formatters["\\ui_c{%s}{%s}"] +-- local s = formatters["\\ui_s{%s}"] +-- logs.startfilelogging(report,"translated constants") +-- for given, constant in sortedhash(list) 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 +-- report_constant("%-40s: %s",given,constant) +-- end +-- logs.stopfilelogging() +-- contextsprint(prtcatcodes,concat(t)) +-- end +-- do +-- local list = complete.variables -- forces the load +-- local t = { } +-- local f = formatters["\\ui_v{%s}{%s}"] +-- logs.startfilelogging(report,"translated variables") +-- for given, variable in sortedhash(list) do +-- variable = variable[interface] or variable.en or given +-- variables[given] = variable -- ja -> yes +-- nofvariables = nofvariables + 1 +-- t[nofvariables] = f(given,variable) +-- report_variable("%-40s: %s",given,variable) +-- end +-- logs.stopfilelogging() +-- contextsprint(prtcatcodes,concat(t)) +-- end +-- do +-- local list = complete.elements -- forces the load +-- local t = { } +-- local f = formatters["\\ui_e{%s}{%s}"] +-- logs.startfilelogging(report,"translated elements") +-- for given, element in sortedhash(list) do +-- element = element[interface] or element.en or given +-- elements[element] = given +-- nofelements = nofelements + 1 +-- t[nofelements] = f(given,element) +-- report_element("%-40s: %s",given,element) +-- end +-- logs.stopfilelogging() +-- contextsprint(prtcatcodes,concat(t)) +-- end +-- do +-- local list = complete.commands -- forces the load +-- local t = { } +-- local n = 0 +-- local f = formatters["\\ui_a\\%s\\%s"] -- formatters["\\ui_m{%s}{%s}"] +-- logs.startfilelogging(report,"translated commands") +-- for given, command in sortedhash(list) do +-- command = command[interface] or command.en or given +-- if command ~= given then +-- n = n + 1 +-- t[n] = f(given,command) +-- report_command("%-40s: %s",given,command) +-- end +-- nofcommands = nofcommands + 1 +-- end +-- logs.stopfilelogging() +-- contextsprint(prtcatcodes,"\\toksapp\\everydump{"..concat(t).."}") +-- end +-- do +-- local list = complete.messages.formats +-- logs.startfilelogging(report,"translated message formats") +-- for given, format in sortedhash(list) do +-- local found = format[interface] or format.en or given +-- formats[given] = found +-- nofformats = nofformats + 1 +-- report_messagetag("%-40s: %s",limit(given,38),limit(found,38)) +-- end +-- logs.stopfilelogging() +-- end +-- do +-- local list = complete.messages.translations +-- logs.startfilelogging(report,"translated message tags") +-- for given, translation in sortedhash(list) do +-- local found = translation[interface] or translation.en or given +-- translations[given] = found +-- noftranslations = noftranslations + 1 +-- report_messagetag("%-40s: %s",given,found) +-- end +-- logs.stopfilelogging() +-- end +-- do +-- local list = complete.setupstrings +-- logs.startfilelogging(report,"translated setupstrings") +-- for given, setupstring in sortedhash(list) do +-- local found = setupstring[interface] or setupstring.en or given +-- setupstrings[given] = found +-- nofsetupstrings = nofsetupstrings + 1 +-- report_setupstring("%-40s: %s",given,found) +-- end +-- logs.stopfilelogging() +-- end +-- report_interface("definitions: %a constants, %a variables, %a elements, %a commands, %a formats, %a translations, %a setupstrings", +-- nofconstants,nofvariables,nofelements,nofcommands,nofformats,noftranslations,nofsetupstrings) +-- else +-- report_interface("the language(s) can only be set when making the format") +-- end +-- interfaces.currentinterface = currentinterface +-- interfaces.currentresponse = currentresponse +-- end + +-- different per interface +-- +-- en: +-- +-- ui_c macro:#1#2 -> \immutable \gdefcsname \c!prefix! #1\endcsname {#1} +-- ui_v macro:#1#2 -> \immutable \gdefcsname \v!prefix! #1\endcsname {#2} +-- ui_e macro:#1#2 -> \immutable \gdefcsname \e!prefix! #1\endcsname {#2} +-- ui_a macro:#1#2 -> \frozen \protected \def #2{#1} +-- +-- otherwise: +-- +-- ui_c macro:#1#2 -> \immutable \gdefcsname \c!prefix! #1\endcsname {#1} +-- \immutable \gdefcsname \k!prefix! #2\endcsname {#1} function interfaces.setuserinterface(interface,response) local variables = interfaces.variables @@ -61,75 +208,87 @@ function interfaces.setuserinterface(interface,response) local nofformats = 0 local noftranslations = 0 local nofsetupstrings = 0 + local reversetoo = interface ~= "en" -- do local list = complete.constants -- forces the load - local t = { } - local f = formatters["\\ui_c{%s}{%s}"], formatters["\\ui_s{%s}"] - local s = formatters["\\ui_s{%s}"] logs.startfilelogging(report,"translated constants") for given, constant in sortedhash(list) 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) + setmacro("c!" .. given,given,"immutable") + if reversetoo then + setmacro("k!" .. constant,given,"immutable") end report_constant("%-40s: %s",given,constant) end logs.stopfilelogging() - contextsprint(prtcatcodes,concat(t)) end do local list = complete.variables -- forces the load - local t = { } - local f = formatters["\\ui_v{%s}{%s}"] logs.startfilelogging(report,"translated variables") for given, variable in sortedhash(list) do variable = variable[interface] or variable.en or given variables[given] = variable -- ja -> yes nofvariables = nofvariables + 1 - t[nofvariables] = f(given,variable) + setmacro("v!" .. given,variable,"immutable") report_variable("%-40s: %s",given,variable) end logs.stopfilelogging() - contextsprint(prtcatcodes,concat(t)) end do local list = complete.elements -- forces the load - local t = { } - local f = formatters["\\ui_e{%s}{%s}"] logs.startfilelogging(report,"translated elements") for given, element in sortedhash(list) do element = element[interface] or element.en or given elements[element] = given nofelements = nofelements + 1 - t[nofelements] = f(given,element) + setmacro("e!" .. given,element,"immutable") report_element("%-40s: %s",given,element) end logs.stopfilelogging() - contextsprint(prtcatcodes,concat(t)) end - do - local list = complete.commands -- forces the load - local t = { } - local n = 0 - local f = formatters["\\ui_a\\%s\\%s"] -- formatters["\\ui_m{%s}{%s}"] - logs.startfilelogging(report,"translated commands") - for given, command in sortedhash(list) do - command = command[interface] or command.en or given - if command ~= given then - n = n + 1 - t[n] = f(given,command) - report_command("%-40s: %s",given,command) - end - nofcommands = nofcommands + 1 - end - logs.stopfilelogging() - contextsprint(prtcatcodes,"\\toksapp\\everydump{"..concat(t).."}") +-- do +-- local list = complete.commands -- forces the load +-- local todo = { } -- normally a small list +-- logs.startfilelogging(report,"translated commands") +-- for given, command in sortedhash(list) do +-- command = command[interface] or command.en or given +-- if command ~= given then +-- report_command("%-40s: %s",given,command) +-- todo[given] = command +-- end +-- nofcommands = nofcommands + 1 +-- end +-- logs.stopfilelogging() +-- -- For some reason we get corrupted definitions. +-- luatex.registerdumpactions(function() +-- for given, command in sortedhash(todo) do +-- -- if definedmacro(given) then +-- setmacro(command,"\\"..given,"frozen","protected","global") +-- -- end +-- end +-- end) +-- end +do + local list = complete.commands -- forces the load + local t = { } + local n = 0 + local f = formatters["\\frozen\\protected\\def\\%s{\\%s}"] -- formatters["\\ui_m{%s}{%s}"] + logs.startfilelogging(report,"translated commands") + for given, command in sortedhash(list) do + command = command[interface] or command.en or given + if command ~= given then + n = n + 1 + t[n] = f(command,given) + report_command("%-40s: %s",given,command) end + nofcommands = nofcommands + 1 + end + logs.stopfilelogging() + contextsprint(prtcatcodes,"\\toksapp\\everydump{"..concat(t).."}") +end do local list = complete.messages.formats logs.startfilelogging(report,"translated message formats") diff --git a/tex/context/base/mkiv/mult-ini.lua b/tex/context/base/mkiv/mult-ini.lua index 9664342ab..eb758fcbf 100644 --- a/tex/context/base/mkiv/mult-ini.lua +++ b/tex/context/base/mkiv/mult-ini.lua @@ -308,7 +308,7 @@ local function gss(s) contextsprint(vrbcatcodes,getsetupstring(s)) end -implement { -- will b eoverloaded +implement { -- will be overloaded name = "getsetupstring", actions = gss, arguments = "string", diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 2b1dffc68..a14246a58 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -45,6 +45,8 @@ return { -- "attributeunsetvalue", -- + "statuswrite", + -- "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", -- "inicatcodes", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index e8d0cefc4..f779bc230 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -388,6 +388,7 @@ return { "mathrulesfam", "mathrulesmode", "mathrulethicknessmode", + "mathscale", "mathscriptboxmode", "mathscriptcharmode", "mathscriptsmode", diff --git a/tex/context/base/mkiv/pack-box.mkiv b/tex/context/base/mkiv/pack-box.mkiv index 422f090f0..4c9a4c17d 100644 --- a/tex/context/base/mkiv/pack-box.mkiv +++ b/tex/context/base/mkiv/pack-box.mkiv @@ -337,7 +337,7 @@ \pack_boxes_collector_check_box{#1}% \ifconditional\c_pack_boxes_collector_valid_box \letcollectorparameter\c!voffset\zeropoint - \letcollectorparameter\h!voffset\zeropoint + \letcollectorparameter\c!hoffset\zeropoint \ifsecondargument \setupcurrentcollector[#2]% \fi diff --git a/tex/context/base/mkiv/page-otr.mkvi b/tex/context/base/mkiv/page-otr.mkvi index 6feb15a9d..062761261 100644 --- a/tex/context/base/mkiv/page-otr.mkvi +++ b/tex/context/base/mkiv/page-otr.mkvi @@ -25,8 +25,6 @@ \let\triggerpagebuilder\clf_triggerpagebuilder -\def\m!otr{otr} % todo - \installcorenamespace{outputroutine} \installswitchcommandhandler \??outputroutine {outputroutine} \??outputroutine diff --git a/tex/context/base/mkiv/phys-dim.lua b/tex/context/base/mkiv/phys-dim.lua index faf458738..e0cea7bab 100644 --- a/tex/context/base/mkiv/phys-dim.lua +++ b/tex/context/base/mkiv/phys-dim.lua @@ -41,7 +41,7 @@ if not modules then modules = { } end modules ['phys-dim'] = { local rawset, next = rawset, next local V, P, S, R, C, Cc, Cs, matchlpeg = lpeg.V, lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.match -local format, lower = string.format, string.lower +local format, lower, gsub = string.format, string.lower, string.gsub local appendlpeg = lpeg.append local utfchartabletopattern = lpeg.utfchartabletopattern local mergetable, mergedtable, keys, loweredkeys = table.merge, table.merged, table.keys, table.loweredkeys @@ -1001,3 +1001,15 @@ implement { name = "digits_reverse", actions = makedigits, arguments = { "stri implement { name = "unit_normal", actions = makeunit, arguments = "string"} implement { name = "unit_reverse", actions = makeunit, arguments = { "string", true } } implement { name = "registerunit", actions = registerunit, arguments = "2 strings" } + +implement { + name = "hyphenateddigits", + public = true, + protected = true, + arguments = { "optional", "string" }, + actions = function(filler, digits) + digits = gsub(digits,"(%d)","%1\\digitsbreak") + digits = gsub(digits,"\\-$",filler) + context(digits) + end +} diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi index 5603b79a5..c7c00fd14 100644 --- a/tex/context/base/mkiv/publ-imp-apa.mkvi +++ b/tex/context/base/mkiv/publ-imp-apa.mkvi @@ -846,7 +846,7 @@ % #title can be title or booktitle -\starttexdefinition unexpanded btx:apa:translated-title #title +\starttexdefinition mutable protected btx:apa:translated-title #title \ifx\currentbtxlanguage\empty % no need for an extra \else\ifx\mainbtxlanguage\currentbtxlanguage @@ -865,7 +865,7 @@ \fi\fi \stoptexdefinition -\starttexdefinition unexpanded btx:apa:composed-title #title +\starttexdefinition mutable protected btx:apa:composed-title #title \btxstartstyleandcolor[apa:\s!list:#title:\currentbtxcategory] \begingroup \language[\currentbtxlanguage] @@ -884,7 +884,7 @@ \btxstopstyleandcolor \stoptexdefinition -\starttexdefinition unexpanded btx:apa:title +\starttexdefinition mutable protected btx:apa:title \setmode{btx:apa:title-placed} % we make the title active, opening "file" \btxdoifelse {file} { @@ -925,7 +925,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:apa:title-if-not-placed +\starttexdefinition mutable protected btx:apa:title-if-not-placed \doifelsemode {btx:apa:title-placed} { \resetmode{btx:apa:title-placed} } { @@ -940,7 +940,7 @@ \btxlabeltext{apa:nd} \stopsetups -\starttexdefinition unexpanded btx:apa:suffixedyear +\starttexdefinition mutable protected btx:apa:suffixedyear \btxdoifelse {year} { \btxflush{year} \btxflushsuffix @@ -965,7 +965,7 @@ % #author may be author(set) or editor -\starttexdefinition unexpanded btx:apa:author-or-editor #author +\starttexdefinition mutable protected btx:apa:author-or-editor #author \btxdoifelse {#author} { \btxstartstyleandcolor[apa:\s!list:#author] \btxusecommand[apa:\s!list:#author]{ @@ -1048,7 +1048,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:apa:authoryear +\starttexdefinition mutable protected btx:apa:authoryear % we make the authoryear active, pointing to the citation \texdefinition{btx:format:inject} {internal(\currentbtxinternal)} @@ -1073,7 +1073,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:apa:editor-in +\starttexdefinition mutable protected btx:apa:editor-in \btxdoif {booktitle} { \btxlabeltext{In} \btxspace @@ -1086,7 +1086,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:apa:organization-if-not-author +\starttexdefinition mutable protected btx:apa:organization-if-not-author \btxdoif {organization} { \doifnot {\btxfoundname{author}} {organization} { \btxspace @@ -1099,7 +1099,7 @@ % TODO: The title is terminated with period. However, % we probably don't want this before the parenthesis. -\starttexdefinition unexpanded btx:apa:leftparenthesis-or-comma +\starttexdefinition mutable protected btx:apa:leftparenthesis-or-comma \doifelsemode {btx:apa:editionset-is-empty} { \btxleftparenthesis \resetmode{btx:apa:editionset-is-empty} @@ -1108,7 +1108,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:apa:editionset +\starttexdefinition mutable protected btx:apa:editionset \setmode{btx:apa:editionset-is-empty} \doif {\currentbtxcategory} {techreport} { \texdefinition{btx:apa:leftparenthesis-or-comma} @@ -1157,7 +1157,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:apa:journal +\starttexdefinition mutable protected btx:apa:journal \btxstartstyleandcolor[apa:\s!list:journal] \btxusecommand [apa:\s!list:journal] { \btxflush{journal} @@ -1165,7 +1165,7 @@ \btxstopstyleandcolor \stoptexdefinition -\starttexdefinition unexpanded btx:apa:volume +\starttexdefinition mutable protected btx:apa:volume \btxstartstyleandcolor[apa:\s!list:volume] \btxflush{volume} \btxstopstyleandcolor @@ -1173,7 +1173,7 @@ % this could be simplified! -\starttexdefinition unexpanded btx:apa:journal-volume-number-pages +\starttexdefinition mutable protected btx:apa:journal-volume-number-pages \btxdoif {journal} { \btxspace \texdefinition{btx:apa:journal} @@ -1222,7 +1222,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:apa:wherefrom-publisher +\starttexdefinition mutable protected btx:apa:wherefrom-publisher \btxdoifelse {address} { \btxflush{address} \btxdoif {country} { @@ -1256,7 +1256,7 @@ % use \btxentry here? -\starttexdefinition unexpanded btx:apa:url +\starttexdefinition mutable protected btx:apa:url \begingroup \setbreakpoints[doi] \ifconditional\btxinteractive @@ -1273,7 +1273,7 @@ % use \btxentry here? -\starttexdefinition unexpanded btx:apa:doi +\starttexdefinition mutable protected btx:apa:doi \begingroup \setbreakpoints[doi] \ifconditional\btxinteractive @@ -1288,7 +1288,7 @@ \endgroup \stoptexdefinition -\starttexdefinition unexpanded btx:apa:note +\starttexdefinition mutable protected btx:apa:note \btxdoif {note} { \btxleftparenthesis \btxflush{note} @@ -1296,7 +1296,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:apa:url-doi-note +\starttexdefinition mutable protected btx:apa:url-doi-note \doif {\btxfoundname{doi}} {url} { \btxspace \btxlabeltext{apa:Retrieved} @@ -1311,7 +1311,7 @@ \removeunwantedspaces \stoptexdefinition -\starttexdefinition unexpanded btx:apa:type +\starttexdefinition mutable protected btx:apa:type \btxdoif {type} { \btxleftbracket \btxflush{type} diff --git a/tex/context/base/mkiv/publ-imp-aps.mkvi b/tex/context/base/mkiv/publ-imp-aps.mkvi index d085b96eb..e16279222 100644 --- a/tex/context/base/mkiv/publ-imp-aps.mkvi +++ b/tex/context/base/mkiv/publ-imp-aps.mkvi @@ -596,7 +596,7 @@ %D returned. In lua syntax, it can be understood as %D author or editor or publisher or title or "" -\starttexdefinition unexpanded btx:aps:composed-title #title +\starttexdefinition mutable protected btx:aps:composed-title #title \btxstartstyleandcolor [aps:\s!list:title:\currentbtxcategory] \begingroup \language[\currentbtxlanguage] @@ -611,7 +611,7 @@ \btxstopstyleandcolor \stoptexdefinition -\starttexdefinition unexpanded btx:aps:title +\starttexdefinition mutable protected btx:aps:title \btxdoif {title} { % we make the title active, opening file \btxdoifelse {file} { @@ -627,13 +627,13 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:aps:optional-title +\starttexdefinition mutable protected btx:aps:optional-title \doif{\btxparameter{\c!title}}\v!yes { \texdefinition {btx:aps:title} } \stoptexdefinition -\starttexdefinition unexpanded btx:aps:year +\starttexdefinition mutable protected btx:aps:year \btxdoifelse {year} { \btxflush{year} } { @@ -643,7 +643,7 @@ % #author may be author(set) or editor -\starttexdefinition unexpanded btx:aps:author-or-editor #author +\starttexdefinition mutable protected btx:aps:author-or-editor #author \btxdoif {#author} { \btxflush{#author} \doifelse {\btxfoundname{#author}} {editor} { @@ -664,14 +664,14 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:aps:author +\starttexdefinition mutable protected btx:aps:author \btxdoif {author} { \btxflush{author} \btxcomma } \stoptexdefinition -\starttexdefinition unexpanded btx:aps:organization-if-not-author +\starttexdefinition mutable protected btx:aps:organization-if-not-author \btxdoif {organization} { \doifnot {\btxfoundname{author}} {organization} { \btxspace @@ -681,7 +681,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:aps:editor-in +\starttexdefinition mutable protected btx:aps:editor-in \btxdoif {booktitle} { \btxlabeltext{In} \doifnot {\btxfoundname{author}} {editor} { @@ -694,7 +694,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:aps:editionset +\starttexdefinition mutable protected btx:aps:editionset \doif {\currentbtxcategory} {techreport} { \btxdoifelse {type} { \btxusecommand [\currentbtx:type] { @@ -739,7 +739,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:aps:journal-volume-year +\starttexdefinition mutable protected btx:aps:journal-volume-year \btxdoif {journal} { \btxspace \btxstartstyleandcolor [aps:\s!list:journal] @@ -773,7 +773,7 @@ \btxrightparenthesis \stoptexdefinition -\starttexdefinition unexpanded btx:aps:publisher-wherefrom-year +\starttexdefinition mutable protected btx:aps:publisher-wherefrom-year \removeunwantedspaces \removepunctuation \btxleftparenthesis @@ -797,7 +797,7 @@ \btxrightparenthesis \stoptexdefinition -\starttexdefinition unexpanded btx:aps:note +\starttexdefinition mutable protected btx:aps:note \btxperiod \btxdoif {note} { \btxleftparenthesis @@ -806,7 +806,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:aps:doi-url #text +\starttexdefinition mutable protected btx:aps:doi-url #text \ifconditional\btxinteractive \btxdoifelse {doi} { \goto {#text} [url(http://dx.doi.org/\btxflush{doi})] diff --git a/tex/context/base/mkiv/publ-imp-author.mkvi b/tex/context/base/mkiv/publ-imp-author.mkvi index b52433186..8ee783599 100644 --- a/tex/context/base/mkiv/publ-imp-author.mkvi +++ b/tex/context/base/mkiv/publ-imp-author.mkvi @@ -23,7 +23,7 @@ % \currentbtxsurnames : \btxauthorfield{surnames} % \currentbtxjuniors : \btxauthorfield{juniors} -\starttexdefinition unexpanded \s!btx:\s!cite:\s!author:\s!de +\starttexdefinition mutable protected \s!btx:\s!cite:\s!author:\s!de \ifx\currentbtxlanguage\s!de \setmode{\s!btx:\s!de} \fi diff --git a/tex/context/base/mkiv/publ-imp-chicago.mkvi b/tex/context/base/mkiv/publ-imp-chicago.mkvi index 867535ca6..315d68612 100644 --- a/tex/context/base/mkiv/publ-imp-chicago.mkvi +++ b/tex/context/base/mkiv/publ-imp-chicago.mkvi @@ -702,20 +702,20 @@ chicago:edition={Utgåva}, chicago:Editor=Redaktör, chicago:Editors=Redaktörer, - chicago:Volume=Band, + chicago:Volume=Band, chicago:Volumes=Band, chicago:nd={u.å.}, % utan årtal chicago:supplement=Bilaga, % Supplement chicago:MotionPicture=Spelfilm, % ? chicago:Writer={Manusförfattare}, % Assuming for a movie - chicago:Writers={Manusförfattare}, % + chicago:Writers={Manusförfattare}, % chicago:Producer=Producent, % Assuming for a movie - chicago:Producers=Producenter, % + chicago:Producers=Producenter, % chicago:Director={Regissör}, % Assuming for a movie - chicago:Directors={Regissörer}, % + chicago:Directors={Regissörer}, % chicago:Recordedby={Inspelad av}, % Assuming for a movie chicago:Author={Författare}, - chicago:Translator={Översättare}, + chicago:Translator={Översättare}, chicago:Advanced={Avancerad onlinepublikation}, % ? chicago:Retrieved={Hämtad från}] @@ -845,7 +845,7 @@ % #title can be title or booktitle -\starttexdefinition unexpanded btx:chicago:translated-title #title +\starttexdefinition mutable protected btx:chicago:translated-title #title \ifx\currentbtxlanguage\empty % no need for an extra \else\ifx\mainbtxlanguage\currentbtxlanguage @@ -864,7 +864,7 @@ \fi\fi \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:composed-title #title +\starttexdefinition mutable protected btx:chicago:composed-title #title \btxstartstyleandcolor[chicago:\s!list:#title:\currentbtxcategory] \begingroup \language[\currentbtxlanguage] @@ -883,7 +883,7 @@ \btxstopstyleandcolor \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:title +\starttexdefinition mutable protected btx:chicago:title \setmode{btx:chicago:title-placed} % we make the title active, opening "file" \btxdoifelse {file} { @@ -924,7 +924,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:title-if-not-placed +\starttexdefinition mutable protected btx:chicago:title-if-not-placed \doifelsemode {btx:chicago:title-placed} { \resetmode{btx:chicago:title-placed} } { @@ -939,7 +939,7 @@ \btxlabeltext{chicago:nd} \stopsetups -\starttexdefinition unexpanded btx:chicago:suffixedyear +\starttexdefinition mutable protected btx:chicago:suffixedyear \btxdoifelse {year} { \btxflush{year} \btxflushsuffix @@ -964,7 +964,7 @@ % #author may be author(set) or editor -\starttexdefinition unexpanded btx:chicago:author-or-editor #author +\starttexdefinition mutable protected btx:chicago:author-or-editor #author \btxdoifelse {#author} { \btxstartstyleandcolor[chicago:\s!list:#author] \btxusecommand[chicago:\s!list:#author]{ @@ -1047,7 +1047,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:authoryear +\starttexdefinition mutable protected btx:chicago:authoryear % we make the authoryear active, pointing to the citation \texdefinition{btx:format:inject} {internal(\currentbtxinternal)} @@ -1070,7 +1070,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:editor-in +\starttexdefinition mutable protected btx:chicago:editor-in \btxdoif {booktitle} { \btxlabeltext{In} \btxspace @@ -1083,7 +1083,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:organization-if-not-author +\starttexdefinition mutable protected btx:chicago:organization-if-not-author \btxdoif {organization} { \doifnot {\btxfoundname{author}} {organization} { \btxspace @@ -1096,7 +1096,7 @@ % TODO: The title is terminated with period. However, % we probably don't want this before the parenthesis. -\starttexdefinition unexpanded btx:chicago:leftparenthesis-or-comma +\starttexdefinition mutable protected btx:chicago:leftparenthesis-or-comma \doifelsemode {btx:chicago:editionset-is-empty} { \btxleftparenthesis \resetmode{btx:chicago:editionset-is-empty} @@ -1105,7 +1105,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:editionset +\starttexdefinition mutable protected btx:chicago:editionset \setmode{btx:chicago:editionset-is-empty} \doif {\currentbtxcategory} {techreport} { \texdefinition{btx:chicago:leftparenthesis-or-comma} @@ -1154,7 +1154,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:journal +\starttexdefinition mutable protected btx:chicago:journal \btxstartstyleandcolor[chicago:\s!list:journal] \btxusecommand [chicago:\s!list:journal] { \btxflush{journal} @@ -1162,7 +1162,7 @@ \btxstopstyleandcolor \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:volume +\starttexdefinition mutable protected btx:chicago:volume \btxstartstyleandcolor[chicago:\s!list:volume] \btxflush{volume} \btxstopstyleandcolor @@ -1170,7 +1170,7 @@ % this could be simplified! -\starttexdefinition unexpanded btx:chicago:journal-volume-number-pages +\starttexdefinition mutable protected btx:chicago:journal-volume-number-pages \btxdoif {journal} { \btxspace \texdefinition{btx:chicago:journal} @@ -1219,7 +1219,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:wherefrom-publisher +\starttexdefinition mutable protected btx:chicago:wherefrom-publisher \btxdoifelse {address} { \btxflush{address} \btxdoif {country} { @@ -1253,7 +1253,7 @@ % use \btxentry here? -\starttexdefinition unexpanded btx:chicago:url +\starttexdefinition mutable protected btx:chicago:url \begingroup \setbreakpoints[doi] \ifconditional\btxinteractive @@ -1270,7 +1270,7 @@ % use \btxentry here? -\starttexdefinition unexpanded btx:chicago:doi +\starttexdefinition mutable protected btx:chicago:doi \begingroup \setbreakpoints[doi] \ifconditional\btxinteractive @@ -1285,7 +1285,7 @@ \endgroup \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:note +\starttexdefinition mutable protected btx:chicago:note \btxdoif {note} { \btxleftparenthesis \btxflush{note} @@ -1293,7 +1293,7 @@ } \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:url-doi-note +\starttexdefinition mutable protected btx:chicago:url-doi-note \doif {\btxfoundname{doi}} {url} { \btxspace \btxlabeltext{chicago:Retrieved} @@ -1308,7 +1308,7 @@ \removeunwantedspaces \stoptexdefinition -\starttexdefinition unexpanded btx:chicago:type +\starttexdefinition mutable protected btx:chicago:type \btxdoif {type} { \btxleftbracket \btxflush{type} diff --git a/tex/context/base/mkiv/publ-imp-cite.mkvi b/tex/context/base/mkiv/publ-imp-cite.mkvi index 3a01b219a..721985499 100644 --- a/tex/context/base/mkiv/publ-imp-cite.mkvi +++ b/tex/context/base/mkiv/publ-imp-cite.mkvi @@ -13,7 +13,7 @@ \unprotect -\starttexdefinition unexpanded btx:cite:inject #content +\starttexdefinition mutable protected btx:cite:inject #content \ifconditional\btxinteractive \ifx\currentbtxinternal\empty #content @@ -29,7 +29,7 @@ \fi \stoptexdefinition -\starttexdefinition unexpanded btx:cite:checkconcat +\starttexdefinition mutable protected btx:cite:checkconcat \ifnum\currentbtxcount>\zerocount \let\currentbtxinternal\empty \let\currentbtxbacklink\empty diff --git a/tex/context/base/mkiv/publ-imp-default.mkvi b/tex/context/base/mkiv/publ-imp-default.mkvi index fef993fe0..8d9d24b59 100644 --- a/tex/context/base/mkiv/publ-imp-default.mkvi +++ b/tex/context/base/mkiv/publ-imp-default.mkvi @@ -365,7 +365,7 @@ [\s!default:and=och, \s!default:number={nr.}, \s!default:edition={Utgåva}, - \s!default:Editor=Redaktör, + \s!default:Editor=Redaktör, \s!default:Editors=Redaktörer, \s!default:Volume=Band, \s!default:Volumes=Band, @@ -374,7 +374,7 @@ % First some helpers: -\starttexdefinition btx:default:composed-title +\starttexdefinition mutable protected btx:default:composed-title \begingroup \language[\currentbtxlanguage] \btxflush{title} @@ -385,7 +385,7 @@ \endgroup \stoptexdefinition -\starttexdefinition btx:default:title +\starttexdefinition mutable protected btx:default:title \btxdoif {title} { \btxspace \btxstartstyleandcolor [default:list:title:\currentbtxcategory] @@ -397,7 +397,7 @@ } \stoptexdefinition -\starttexdefinition btx:default:author +\starttexdefinition mutable protected btx:default:author \btxdoif {author} { \btxflush{author} \doif {\btxfoundname{author}} {editor} { @@ -412,12 +412,12 @@ } \stoptexdefinition -\starttexdefinition btx:default:year +\starttexdefinition mutable protected btx:default:year \btxflush{year} \btxflushsuffix \stoptexdefinition -\starttexdefinition btx:default:journal +\starttexdefinition mutable protected btx:default:journal \btxdoif {journal} { \btxspace \btxstartstyleandcolor [default:list:journal] @@ -450,7 +450,7 @@ } \stoptexdefinition -\starttexdefinition btx:default:editionset +\starttexdefinition mutable protected btx:default:editionset \btxdoif {editionset} { \removeunwantedspaces \removepunctuation @@ -483,7 +483,7 @@ } \stoptexdefinition -\starttexdefinition btx:default:publisher +\starttexdefinition mutable protected btx:default:publisher \btxdoif {publisher} { \btxflush{publisher} \btxcomma diff --git a/tex/context/base/mkiv/publ-imp-definitions.mkvi b/tex/context/base/mkiv/publ-imp-definitions.mkvi index 295586f60..1e9f8ea9b 100644 --- a/tex/context/base/mkiv/publ-imp-definitions.mkvi +++ b/tex/context/base/mkiv/publ-imp-definitions.mkvi @@ -27,7 +27,7 @@ \btxfield{short} \stopxmlsetups -\starttexdefinition unexpanded btx:format:inject #link #content +\starttexdefinition mutable protected btx:format:inject #link #content \ifx\currentbtxinternal\empty #content \else\ifconditional\btxinteractive @@ -86,7 +86,7 @@ % macros: -\starttexdefinition unexpanded btx:style:italic #content +\starttexdefinition mutable protected btx:style:italic #content \dontleavehmode \begingroup \it @@ -95,7 +95,7 @@ \endgroup \stoptexdefinition -\starttexdefinition unexpanded btx:style:bold #content +\starttexdefinition mutable protected btx:style:bold #content \dontleavehmode \begingroup \bf @@ -103,14 +103,14 @@ \endgroup \stoptexdefinition -\starttexdefinition unexpanded btx:style:quote #content +\starttexdefinition mutable protected btx:style:quote #content \dontleavehmode \startquote #content \stopquote \stoptexdefinition -\starttexdefinition unexpanded btx:style #style #content +\starttexdefinition mutable protected btx:style #style #content \doifelsedefined {btx:style:#style} { \texdefinition{btx:style:#style} { #content diff --git a/tex/context/base/mkiv/publ-imp-list.mkvi b/tex/context/base/mkiv/publ-imp-list.mkvi index b00c4bd40..eec63e515 100644 --- a/tex/context/base/mkiv/publ-imp-list.mkvi +++ b/tex/context/base/mkiv/publ-imp-list.mkvi @@ -13,7 +13,7 @@ \unprotect -\starttexdefinition unexpanded btx:list:inject:text #content +\starttexdefinition mutable protected btx:list:inject:text #content \ifconditional\btxinteractivetext \ifx\currentbtxinternal\empty #content @@ -39,7 +39,7 @@ } \stopsetups -\starttexdefinition unexpanded btx:list:inject:number #content +\starttexdefinition mutable protected btx:list:inject:number #content \ifconditional\btxinteractivenumber \ifx\currentbtxinternal\empty #content @@ -55,7 +55,7 @@ \fi \stoptexdefinition -\starttexdefinition unexpanded btx:list:helpers:concat +\starttexdefinition mutable protected btx:list:helpers:concat \space \stoptexdefinition @@ -66,7 +66,7 @@ } \stopsetups -\starttexdefinition unexpanded btx:list:numbering #variant +\starttexdefinition mutable protected btx:list:numbering #variant \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:#variant] \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:#variant] { \fastsetup{\s!btx:\s!list:\s!numbering} diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index 12864aa6c..ef2c5cbda 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -919,7 +919,7 @@ %D \starttyping %D % #1 is number of entries %D -%D \starttexdefinition unexpanded btx:for:alan:wrapper #1 +%D \starttexdefinition mutable protected btx:for:alan:wrapper #1 %D \bTABLE %D % we can have a command or setups %D \flushbtxentries[command=\texdefinition{btx:for:alan:content}] @@ -928,7 +928,7 @@ %D %D % #1 is tag %D -%D \starttexdefinition unexpanded btx:for:alan:content #1 +%D \starttexdefinition mutable protected btx:for:alan:content #1 %D \bTR %D \bTD %D \btxsettag{#1} diff --git a/tex/context/base/mkiv/spac-ali.mkiv b/tex/context/base/mkiv/spac-ali.mkiv index 7ed3416cc..2467f8352 100644 --- a/tex/context/base/mkiv/spac-ali.mkiv +++ b/tex/context/base/mkiv/spac-ali.mkiv @@ -807,7 +807,7 @@ \forgetall \let\\\endgraf \ifdoublesided\signalouterrealign\fi - \doifelserightpage\c_spac_align_state_horizontal_left\spac_align_set_horizontal_right + \doifelserightpage\spac_align_set_horizontal_left\spac_align_set_horizontal_right \let\next} \let\raggedbox\relax diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index fa71c74b4..6f5ee9318 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 7bae75b95..6c4204d6a 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua index 859e40ead..2e50a9e5c 100644 --- a/tex/context/base/mkiv/syst-aux.lua +++ b/tex/context/base/mkiv/syst-aux.lua @@ -289,11 +289,17 @@ local pattern = ( spaces * ( ( P("spaces") * space / catcodes_s ) + ( P("nospaces") * space / catcodes_n ) - + ( P("global") * space / function() global = true end ) - + ( P("unexpanded") * space / function() unexpanded = true end ) - + ( P("protected") * space / function() unexpanded = true end ) - + ( P("expanded") * space / function() expanded = true end ) - + ( C(option) * space / function(s) optional = s end ) + + ( P("global") * space / function() global = true end ) + + ( P("protected") * space / function() protected = true end) + + ( P("permanent") * space ) + + ( P("expanded") * space / function() expanded = true end) + + ( P("tolerant") * space ) + + ( P("instance") * space ) + + ( P("frozen") * space ) + + ( P("mutable") * space ) + + ( P("immutable") * space ) + + ( P("unexpanded") * space / function() protected = true end) + + ( C(option) * space / function(s) optional = s end) ) )^0 * spaces * ( C((1-S(" #["))^1) ) diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 29f05c9b8..cd0c133cd 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -7936,9 +7936,9 @@ %D \typebuffer \startlines \getbuffer \stoplines \def\docheckedpair#1% - {\syst_helpers_checked_pair#1,,\_o_e_p_} + {\syst_helpers_checked_pair#1,,\_e_o_p_} -\def\syst_helpers_checked_pair#1,#2,#3\_o_e_p_ +\def\syst_helpers_checked_pair#1,#2,#3\_e_o_p_ {#1,#2} %D Here are some nasty helpers. They can be used to fill often expanded token diff --git a/tex/context/base/mkxl/anch-pos.mkxl b/tex/context/base/mkxl/anch-pos.mkxl index 3075a9ab6..d217f2cac 100644 --- a/tex/context/base/mkxl/anch-pos.mkxl +++ b/tex/context/base/mkxl/anch-pos.mkxl @@ -277,9 +277,9 @@ %D A few special ones .. will be cleaned up -\def\pageanchor {page:\the\realpageno} % for the moment only one pagesize -\def\textanchor {text:\the\realpageno} -\def\regionanchor{region:0} +\permanent\def\pageanchor {page:\the\realpageno} % for the moment only one pagesize +\permanent\def\textanchor {text:\the\realpageno} +\permanent\def\regionanchor{region:0} \newcount\c_anch_column % will be delegated to lua \newcount\c_anch_text % will be delegated to lua diff --git a/tex/context/base/mkxl/buff-par.mklx b/tex/context/base/mkxl/buff-par.mklx index 4b762ff04..ddafd7e14 100644 --- a/tex/context/base/mkxl/buff-par.mklx +++ b/tex/context/base/mkxl/buff-par.mklx @@ -83,9 +83,9 @@ \def\buff_parallel_define_instance#name#instance% {\normalexpanded{\buff_parallel_define_saved[#instance][#name]}% \definebuffer[#instance]% - %\edef\t_buff_parallel{\csname\??parallelhandler#name\endcsname}% - \expandafter\let\expandafter\t_buff_parallel\csname\??parallelhandler#name\endcsname - \toksapp\t_buff_parallel{\edef\currentparallelinstance{#instance}\buff_process_parallel_instance\relax}% + \toksapp + \csname\??parallelhandler#name\endcsname + {\edef\currentparallelinstance{#instance}\buff_process_parallel_instance\relax}% \setuevalue{\e!stop#instance}{\buff_parallel_save{#instance}}} \pushoverloadmode diff --git a/tex/context/base/mkxl/catc-ini.mkxl b/tex/context/base/mkxl/catc-ini.mkxl index 186e6f820..c7427a40c 100644 --- a/tex/context/base/mkxl/catc-ini.mkxl +++ b/tex/context/base/mkxl/catc-ini.mkxl @@ -58,7 +58,7 @@ \immutable\integerdef#1\c_syst_catcodes_n \ctxlua{catcodes.register("\expandafter\gobbleoneargument\string#1",\number#1)}} -\newtoks \everysetdefaultcatcodes +\newtoks\everysetdefaultcatcodes \everysetdefaultcatcodes % this might get dropped {\catcode\backslashasciicode\othercatcode @@ -167,14 +167,14 @@ \def\syst_catcodes_reinstate_normal {\begingroup - \edef\c_syst_char_code{\noexpand\catcodecommand{\number\c_syst_catcodes_b}}% - \global\letcharcode\c_syst_catcodes_b\c_syst_char_code + \edef\temp{\noexpand\catcodecommand{\number\c_syst_catcodes_b}}% + \global\letcharcode\c_syst_catcodes_b\temp \endgroup} \def\syst_catcodes_reinstate_unexpanded {\begingroup - \protected\edef\c_syst_char_code{\noexpand\catcodecommand{\number\c_syst_catcodes_b}}% - \global\letcharcode\c_syst_catcodes_b\c_syst_char_code + \protected\edef\temp{\noexpand\catcodecommand{\number\c_syst_catcodes_b}}% + \global\letcharcode\c_syst_catcodes_b\temp \endgroup} \newconstant\defaultcatcodetable @@ -249,7 +249,7 @@ -% \fi} -\def\catcodetablename +\permanent\def\catcodetablename {\ifnum\currentcatcodetable>\zerocount \csname\??catcodetablen\number\currentcatcodetable\endcsname \else diff --git a/tex/context/base/mkxl/catc-sym.mkxl b/tex/context/base/mkxl/catc-sym.mkxl index f60537da8..c0a55e12e 100644 --- a/tex/context/base/mkxl/catc-sym.mkxl +++ b/tex/context/base/mkxl/catc-sym.mkxl @@ -53,13 +53,13 @@ \unprotect -%immutable\edef\_n_u_l_{\expandtoken \othercatcode \zerocount} % nul(l) -%immutable\edef\_s_o_h_{\expandtoken \othercatcode \plusone } % start of header ^^^^0001 -\immutable\edef\_s_t_x_{\expandtoken \othercatcode \plustwo } % start of text ^^^^0002 -\immutable\edef\_e_t_x_{\expandtoken \othercatcode \plusthree} % end of text ^^^^0003 -\immutable\edef\_e_o_t_{\expandtoken \othercatcode \plusfour } % end of transmission ^^^^0004 -%immutable\edef\_e_n_q_{\expandtoken \othercatcode \plusfive } % enquiry -%immutable\edef\_a_c_k_{\expandtoken \othercatcode \plussix } % aknowledgement +%immutable\edef\s!n_u_l_token{\expandtoken \othercatcode \zerocount} % nul(l) +%immutable\edef\s!s_o_h_token{\expandtoken \othercatcode \plusone } % start of header ^^^^0001 +%immutable\edef\s!s_t_x_token{\expandtoken \othercatcode \plustwo } % start of text ^^^^0002 +%immutable\edef\s!e_t_x_token{\expandtoken \othercatcode \plusthree} % end of text ^^^^0003 +%immutable\edef\s!e_o_t_token{\expandtoken \othercatcode \plusfour } % end of transmission ^^^^0004 +%immutable\edef\s!e_n_q_token{\expandtoken \othercatcode \plusfive } % enquiry +%immutable\edef\s!a_c_k_token{\expandtoken \othercatcode \plussix } % aknowledgement \protect diff --git a/tex/context/base/mkxl/chem-str.mkxl b/tex/context/base/mkxl/chem-str.mkxl index 3645713c6..03f006fdf 100644 --- a/tex/context/base/mkxl/chem-str.mkxl +++ b/tex/context/base/mkxl/chem-str.mkxl @@ -257,10 +257,14 @@ \permanent\protected\def\chemicalbottext#1{\global\settrue\c_chem_some_text\gdef\m_chem_bot_text{#1}\ignorespaces} \permanent\protected\def\chemicalmidtext#1{\global\settrue\c_chem_some_text\gdef\m_chem_mid_text{#1}\ignorespaces} +\mutable\let\toptext\empty +\mutable\let\bottext\empty +\mutable\let\midtext\empty + \appendtoks - \enforced\let\toptext\chemicaltoptext \glet\m_chem_top_text\empty - \enforced\let\bottext\chemicalbottext \glet\m_chem_bot_text\empty - \enforced\let\midtext\chemicalmidtext \glet\m_chem_mid_text\empty + \let\toptext\chemicaltoptext \glet\m_chem_top_text\empty + \let\bottext\chemicalbottext \glet\m_chem_bot_text\empty + \let\midtext\chemicalmidtext \glet\m_chem_mid_text\empty \global\setfalse\c_chem_some_text \to \everystructurechemical diff --git a/tex/context/base/mkxl/colo-ini.mkxl b/tex/context/base/mkxl/colo-ini.mkxl index 7d2e419bc..b9170ea40 100644 --- a/tex/context/base/mkxl/colo-ini.mkxl +++ b/tex/context/base/mkxl/colo-ini.mkxl @@ -120,9 +120,6 @@ % \testfeatureonce{100000}{\color[red]{}} % 1.046 => 0.541 -\let\g_color\empty -\let\g_style\empty - \permanent\protected\def\switchtocolor[#1]{\begincsname#1\endcsname} % transparency diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 9bcddeee0..4b239b6ff 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.01.26 18:02} +\newcontextversion{2021.01.28 18:17} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/cont-run.lmt b/tex/context/base/mkxl/cont-run.lmt new file mode 100644 index 000000000..76fd6ba24 --- /dev/null +++ b/tex/context/base/mkxl/cont-run.lmt @@ -0,0 +1,311 @@ +if not modules then modules = { } end modules ['cont-run'] = { + version = 1.001, + comment = "companion to cont-yes.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- When a style is loaded there is a good change that we never enter +-- this code. + + +local type, tostring = type, tostring + +local report_sandbox = logs.reporter("sandbox","call") +local report_system = logs.reporter("system") +local fastserialize = table.fastserialize +local quoted = string.quoted +local possiblepath = sandbox.possiblepath + +local context = context +local implement = interfaces.implement + +local qualified = { } +local writeable = { } +local readable = { } +local blocked = { } +local trace_files = false +local trace_calls = false +local nofcalls = 0 +local nofrejected = 0 +local logfilename = "sandbox.log" + +local function registerstats() + statistics.register("sandboxing", function() + if trace_files then + return string.format("%i calls, %i rejected, logdata in '%s'",nofcalls,nofrejected,logfilename) + else + return string.format("%i calls, %i rejected",nofcalls,nofrejected) + end + end) + registerstats = false +end + +local function logsandbox(details) + local comment = details.comment + local result = details.result + local arguments = details.arguments + for i=1,#arguments do + local argument = arguments[i] + local t = type(argument) + if t == "string" then + arguments[i] = quoted(argument) + if trace_files and possiblepath(argument) then + local q = qualified[argument] + if q then + local c = q[comment] + if c then + local r = c[result] + if r then + c[result] = r + 1 + else + c[result] = r + end + else + q[comment] = { + [result] = 1 + } + end + else + qualified[argument] = { + [comment] = { + [result] = 1 + } + } + end + end + elseif t == "table" then + arguments[i] = fastserialize(argument) + else + arguments[i] = tostring(argument) + end + end + if trace_calls then + report_sandbox("%s(%,t) => %l",details.comment,arguments,result) + end + nofcalls = nofcalls + 1 + if not result then + nofrejected = nofrejected + 1 + end +end + +local ioopen = sandbox.original(io.open) -- dummy call + +local function logsandboxfiles(name,what,asked,okay) + -- we're only interested in permitted access + if not okay then + blocked [asked] = blocked [asked] or 0 + 1 + elseif what == "*" or what == "w" then + writeable[asked] = writeable[asked] or 0 + 1 + else + readable [asked] = readable [asked] or 0 + 1 + end +end + +function sandbox.logcalls() + if not trace_calls then + trace_calls = true + sandbox.setlogger(logsandbox) + if registerstats then + registerstats() + end + end +end + +function sandbox.logfiles() + if not trace_files then + trace_files = true + sandbox.setlogger(logsandbox) + sandbox.setfilenamelogger(logsandboxfiles) + luatex.registerstopactions(function() + table.save(logfilename,{ + calls = { + nofcalls = nofcalls, + nofrejected = nofrejected, + filenames = qualified, + }, + checkednames = { + readable = readable, + writeable = writeable, + blocked = blocked, + }, + }) + end) + if registerstats then + registerstats() + end + end +end + +trackers.register("sandbox.tracecalls",sandbox.logcalls) +trackers.register("sandbox.tracefiles",sandbox.logfiles) + +local sandboxing = environment.arguments.sandbox +local debugging = environment.arguments.debug + +if sandboxing then + + report_system("enabling sandbox") + + sandbox.enable() + + if type(sandboxing) == "string" then + sandboxing = utilities.parsers.settings_to_hash(sandboxing) + if sandboxing.calls then + sandbox.logcalls() + end + if sandboxing.files then + sandbox.logfiles() + end + end + + -- Nicer would be if we could just disable write 18 and keep os.execute + -- which in fact we can do by defining write18 as macro instead of + -- primitive ... todo ... well, it has been done now. + + -- We block some potential escapes from protection. + + context [[\let\primitive\relax\let\normalprimitive\relax]] + + debug = { + traceback = debug.traceback, + } + + package.loaded.debug = debug + +elseif debugging then + + -- we keep debug + +else + + debug = { + traceback = debug.traceback, + getinfo = debug.getinfo, + sethook = debug.sethook, + } + + package.loaded.debug = debug + +end + +local function processjob() + + tokens.setters.macro("processjob","","permanent") + + environment.initializefilenames() -- todo: check if we really need to pre-prep the filename + + local arguments = environment.arguments + local suffix = environment.suffix + local filename = environment.filename -- hm, not inputfilename ! + + environment.lmtxmode = CONTEXTLMTXMODE -- should be true + + if arguments.nosynctex then + luatex.synctex.setup { + state = interfaces.variables.never, + } + elseif arguments.synctex then + luatex.synctex.setup { + state = interfaces.variables.start, + method = interfaces.variables.max, + } + end + + local overloadmode = arguments.overloadmode + + if overloadmode == "warning" then + overloadmode = 3 -- 5 + elseif overloadmode == "error" then + overloadmode = 4 -- 6 + else + overloadmode = tonumber(overloadmode) + end + + if overloadmode then + tex.set("overloadmode",overloadmode) + end + + if not filename or filename == "" then + -- skip + elseif suffix == "xml" or arguments.forcexml then + + -- Maybe we should move the preamble parsing here as it + -- can be part of (any) loaded (sub) file. The \starttext + -- wrapping might go away. + + report_system("processing as xml: %s",filename) + + context.starttext() + context.xmlprocess("main",filename,"") + context.stoptext() + + elseif suffix == "cld" or arguments.forcecld then + + report_system("processing as cld: %s",filename) + + context.runfile(filename) + + elseif suffix == "lua" or arguments.forcelua then + + -- The wrapping might go away. Why is is it there in the + -- first place. + + report_system("processing as lua: %s",filename) + + context.starttext() + context.ctxlua(string.format('dofile("%s")',filename)) + context.stoptext() + + elseif suffix == "mp" or arguments.forcemp then + + report_system("processing as metapost: %s",filename) + + context.starttext() + context.processMPfigurefile(filename) + context.stoptext() + + -- elseif suffix == "prep" then + -- + -- -- Why do we wrap here. Because it can be xml? Let's get rid + -- -- of prepping in general. + -- + -- context.starttext() + -- context.input(filename) + -- context.stoptext() + + elseif suffix == "mps" or arguments.forcemps then + + report_system("processing metapost output: %s",filename) + + context.starttext() + context.startTEXpage() + context.externalfigure { filename } + context.stopTEXpage() + context.stoptext() + + else + + -- \writestatus{system}{processing as tex} + -- We have a regular tex file so no \starttext yet as we can + -- load fonts. + -- context.enabletrackers { "resolvers.*" } + context.input(filename) + -- context.disabletrackers { "resolvers.*" } + + end + + context.finishjob() + +end + +implement { + name = "processjob", + -- protected = true + public = true, + onlyonce = true, + actions = processjob, +} + +texconfig.firstline = "\\processjob " -- experiment, yet undocumented diff --git a/tex/context/base/mkxl/cont-run.mkxl b/tex/context/base/mkxl/cont-run.mkxl index 909c07204..8944a0359 100644 --- a/tex/context/base/mkxl/cont-run.mkxl +++ b/tex/context/base/mkxl/cont-run.mkxl @@ -13,7 +13,7 @@ \writestatus{loading}{ConTeXt Core Macros / Runner} -\registerctxluafile{cont-run}{} +\registerctxluafile{cont-run}{autosuffix} % \enabletrackers[system.synctex.visualize] % \enabletrackers[system.synctex.xml] diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index f576a1ad8..f70ae4c46 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.01.26 18:02} +\immutable\edef\contextversion{2021.01.28 18:17} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -50,7 +50,7 @@ \immutable\edef\mksuffix {mkiv} \immutable\edef\contextmark{LMTX} -\ifdefined\normalinput \else \let\normalinput\input \fi +\ifdefined\normalinput \else \aliased\let\normalinput\input \fi \def\loadmarkfile#1{\normalinput{#1.\mksuffix}} \def\loadmkivfile#1{\normalinput{#1.mkiv}} @@ -63,13 +63,6 @@ \loadmkxlfile{syst-ini} -%D We just quit if new functionality is expected. - -\ifnum\luatexversion<200 % also change message - \writestatus{!!!!}{Your luametatex binary is too old, you need at least version 2.00!} - \expandafter\end -\fi - %D Some checking (more primitives are now defined): \ifdefined\defaultinterface \else \def\defaultinterface {english} \fi diff --git a/tex/context/base/mkxl/core-con.mkxl b/tex/context/base/mkxl/core-con.mkxl index 3601dc630..cf88a0eea 100644 --- a/tex/context/base/mkxl/core-con.mkxl +++ b/tex/context/base/mkxl/core-con.mkxl @@ -32,8 +32,8 @@ % needed for arab: \permanent\protected\def\isolateseparators % even works with list separator overloading - {\def\spr##1{{##1}}% % we can probably best mess around with zwj - \def\stp##1{{##1}}} % and friends + {\def\spr##1{{##1}}% % we can probably best mess around with zwj + \def\stp##1{{##1}}} % and friends %D \macros %D {numbers} @@ -449,7 +449,7 @@ \normalyear\normalmonth\normalday \endgroup} -\permanent\tolerant\protected\def\date[#1]#*[#2]% sets the date ! +\permanent\tolerant\protected\def\setdate[#1]% sets the date ! {\dontleavehmode \ifparameter#1\or \begingroup @@ -462,8 +462,12 @@ \normalday \number\directdummyparameter\c!d\relax \normalmonth\number\directdummyparameter\c!m\relax \normalyear \number\directdummyparameter\c!y\relax}% - \fi + \fi} + +\permanent\tolerant\protected\def\date[#1]#*[#2]% sets the date ! + {\dontleavehmode \begingroup + \setdate[#1]% sets the date ! \the\everycurrentdate \edef\forceddatespecification{#2}% \syst_converters_check_date_specification\forceddatespecification @@ -484,15 +488,15 @@ %D The currenttime is actually the jobtime. You can specify a pattern similar %D to the previous date macro using the keys \type {h}, \type {m} and a separator. +\mutable\let\currenthour \!!plusone +\mutable\let\currentminute\!!plusone +\mutable\let\currentsecond\!!plusone + \permanent\protected\def\calculatecurrenttime {\edef\currenthour {\clf_hour }% \edef\currentminute{\clf_minute}% \edef\currentsecond{\clf_second}} -\let\currenthour \!!plusone -\let\currentminute\!!plusone -\let\currentsecond\!!plusone - % \def\currenttimespecification{h,:,m} \permanent\protected\def\currenttime diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt index 7f305877d..d231b8f0a 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -74,32 +74,30 @@ local dircodes = nodes.dircodes local dirvalues = nodes.dirvalues local subtypes = nodes.subtypes -local normaldir_code = dircodes.normal - -local lefttoright_code = dirvalues.lefttoright -local righttoleft_code = dirvalues.righttoleft - -local glyph_code = nodecodes.glyph -local kern_code = nodecodes.kern -local glue_code = nodecodes.glue -local hlist_code = nodecodes.hlist -local vlist_code = nodecodes.vlist -local dir_code = nodecodes.dir -local disc_code = nodecodes.disc -local math_code = nodecodes.math -local rule_code = nodecodes.rule -local whatsit_code = nodecodes.whatsit ------ penalty_code = nodecodes.penalty ------ boundary_code = nodecodes.boundary - -local leaders_code = gluecodes.leaders -local cleaders_code = gluecodes.cleaders -local xleaders_code = gluecodes.xleaders -local gleaders_code = gluecodes.gleaders - -local spaceskip_code = gluecodes.spaceskip - -local getpagedimensions = layouts.getpagedimensions +local lefttoright_code = dirvalues.lefttoright +local righttoleft_code = dirvalues.righttoleft + +local glyph_code = nodecodes.glyph +local kern_code = nodecodes.kern +local glue_code = nodecodes.glue +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local dir_code = nodecodes.dir +local disc_code = nodecodes.disc +local math_code = nodecodes.math +local rule_code = nodecodes.rule +local whatsit_code = nodecodes.whatsit +----- penalty_code = nodecodes.penalty +----- boundary_code = nodecodes.boundary + +local leaders_code = gluecodes.leaders +local cleaders_code = gluecodes.cleaders +local xleaders_code = gluecodes.xleaders +local gleaders_code = gluecodes.gleaders + +local spaceskip_code = gluecodes.spaceskip + +local getpagedimensions = layouts.getpagedimensions local drivers = drivers local instances = drivers.instances @@ -1219,7 +1217,7 @@ function drivers.converters.lmtx(driver,box,smode,objnum,specification) -- we need to do this once ... - if not updatefontstate then +-- if not updatefontstate then updatefontstate = flushers.updatefontstate @@ -1233,31 +1231,36 @@ function drivers.converters.lmtx(driver,box,smode,objnum,specification) flushspecialrule = flushers.specialrule flushliteral = flushers.literal - flushwhatsit = setmetatableindex ( { - [whatsitcodes.literal] = flushliteral, - [whatsitcodes.latelua] = flushlatelua, - [whatsitcodes.userdefined] = function() end, -- special purpose, handled in callbacks - [whatsitcodes.savepos] = flushsavepos, -- only used by generic packages - [whatsitcodes.save] = flushers.save, - [whatsitcodes.restore] = flushers.restore, - [whatsitcodes.setmatrix] = flushers.setmatrix, - [whatsitcodes.open] = flushopenout, -- generic - [whatsitcodes.close] = flushcloseout, -- generic - [whatsitcodes.write] = flushwriteout, -- generic - [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, - }, function(t, k) report("weird whatsit %a",k) return function() end end) + flushwhatsit = rawget(flushers,"whatsit") + + if not flushwhatsit then + flushwhatsit = setmetatableindex ( { + [whatsitcodes.literal] = flushliteral, + [whatsitcodes.latelua] = flushlatelua, + [whatsitcodes.userdefined] = function() end, -- special purpose, handled in callbacks + [whatsitcodes.savepos] = flushsavepos, -- only used by generic packages + [whatsitcodes.save] = flushers.save, + [whatsitcodes.restore] = flushers.restore, + [whatsitcodes.setmatrix] = flushers.setmatrix, + [whatsitcodes.open] = flushopenout, -- generic + [whatsitcodes.close] = flushcloseout, -- generic + [whatsitcodes.write] = flushwriteout, -- generic + [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, + }, function(t, k) report("weird whatsit %a",k) return function() end end) + flushers.whatsit = flushwhatsit + end - end +-- end reset_dir_stack() reset_state() diff --git a/tex/context/base/mkxl/enco-ini.mkxl b/tex/context/base/mkxl/enco-ini.mkxl index 7873bae1f..f8487d697 100644 --- a/tex/context/base/mkxl/enco-ini.mkxl +++ b/tex/context/base/mkxl/enco-ini.mkxl @@ -420,16 +420,13 @@ %D %D \typbuffer \getbuffer -\def\periodswidth {.5\emwidth} % downward compatible -\def\periodsdefault{3} % downward compatible - \installcorenamespace {periods} \installsetuponlycommandhandler \??periods {periods} \setupperiods - [\c!n=\periodsdefault, - \c!width=\periodswidth, % can also be \v!fit + [\c!n=3, + \c!width=.5\emwidth, % can also be \v!fit \c!distance=.25\emwidth, \c!symbol=.] diff --git a/tex/context/base/mkxl/file-res.mklx b/tex/context/base/mkxl/file-res.mklx index a796f3e97..a123b5e22 100644 --- a/tex/context/base/mkxl/file-res.mklx +++ b/tex/context/base/mkxl/file-res.mklx @@ -62,7 +62,7 @@ %D to redefine the original \type {\input} when needed, for instance when loading %D third party libraries. -\let\readfilename\empty +\mutable\let\readfilename\empty \def\syst_files_read_file#protocol#path#name% #true #false {\edef\readfilename{\clf_getreadfilename{#protocol}{#path}{#name}}% diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index daa551487..4baacf970 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -696,6 +696,10 @@ \newcount\c_font_scaled_font_mode_saved \newcount\c_font_scaled_points +\mutable\let\somefontspec \empty +\mutable\let\lastrawfontcall \relax +\mutable\let\lastglobalrawfontcall\relax + \protected\def\font_helpers_low_level_define {\ifconditional\c_font_compact \expandafter\font_helpers_low_level_define_compact diff --git a/tex/context/base/mkxl/font-lib.mklx b/tex/context/base/mkxl/font-lib.mklx index e90973d75..72c2d4ba9 100644 --- a/tex/context/base/mkxl/font-lib.mklx +++ b/tex/context/base/mkxl/font-lib.mklx @@ -79,7 +79,7 @@ \registerctxluafile{node-fnt}{autosuffix} % here -\registerctxluafile{font-mps}{} % outline fun +\registerctxluafile{font-mps}{autosuffix} % outline fun \registerctxluafile{font-lua}{} diff --git a/tex/context/base/mkxl/font-mps.lmt b/tex/context/base/mkxl/font-mps.lmt new file mode 100644 index 000000000..d6bf888c1 --- /dev/null +++ b/tex/context/base/mkxl/font-mps.lmt @@ -0,0 +1,395 @@ +if not modules then modules = { } end modules ['font-mps'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local tostring = tostring +local concat = table.concat +local formatters = string.formatters + +-- QP0 [QP1] QP2 => CP0 [CP1 CP2] CP3 + +-- CP0 = QP0 +-- CP3 = QP2 +-- +-- CP1 = QP0 + 2/3 *(QP1-QP0) +-- CP2 = QP2 + 2/3 *(QP1-QP2) + +fonts = fonts or { } +local metapost = fonts.metapost or { } +fonts.metapost = metapost + +local f_moveto = formatters["(%N,%N)"] +local f_lineto = formatters["--(%N,%N)"] +local f_curveto = formatters["..controls(%N,%N)and(%N,%N)..(%N,%N)"] +local s_cycle = "--cycle" + +local f_nofill = formatters["nofill %s;"] +local f_dofill = formatters["fill %s;"] + +local f_draw_trace = formatters["drawpathonly %s;"] +local f_draw = formatters["draw %s;"] + +local f_boundingbox = formatters["((%N,%N)--(%N,%N)--(%N,%N)--(%N,%N)--cycle)"] +local f_vertical = formatters["((%N,%N)--(%N,%N))"] + +function metapost.boundingbox(d,factor) + local bounds = d.boundingbox + local factor = factor or 1 + local llx = factor*bounds[1] + local lly = factor*bounds[2] + local urx = factor*bounds[3] + local ury = factor*bounds[4] + return f_boundingbox(llx,lly,urx,lly,urx,ury,llx,ury) +end + +function metapost.widthline(d,factor) + local bounds = d.boundingbox + local factor = factor or 1 + local lly = factor*bounds[2] + local ury = factor*bounds[4] + local width = factor*d.width + return f_vertical(width,lly,width,ury) +end + +function metapost.zeroline(d,factor) + local bounds = d.boundingbox + local factor = factor or 1 + local lly = factor*bounds[2] + local ury = factor*bounds[4] + return f_vertical(0,lly,0,ury) +end + +function metapost.paths(d,xfactor,yfactor) + local sequence = d.sequence + local segments = d.segments + local list = { } + local path = { } -- recycled + local size = 0 + local xfactor = xfactor or 1 + local yfactor = yfactor or xfactor + if sequence then + local i = 1 + local n = #sequence + while i < n do + local operator = sequence[i] + if operator == "m" then -- "moveto" + if size > 0 then + size = size + 1 + path[size] = s_cycle + list[#list+1] = concat(path,"",1,size) + size = 1 + else + size = size + 1 + end + path[size] = f_moveto(xfactor*sequence[i+1],yfactor*sequence[i+2]) + i = i + 3 + elseif operator == "l" then -- "lineto" + size = size + 1 + path[size] = f_lineto(xfactor*sequence[i+1],yfactor*sequence[i+2]) + i = i + 3 + elseif operator == "c" then -- "curveto" + size = size + 1 + path[size] = f_curveto(xfactor*sequence[i+1],yfactor*sequence[i+2],xfactor*sequence[i+3],yfactor*sequence[i+4],xfactor*sequence[i+5],yfactor*sequence[i+6]) + i = i + 7 + elseif operator =="q" then -- "quadraticto" + size = size + 1 + -- first is always a moveto + local l_x = xfactor*sequence[i-2] + local l_y = yfactor*sequence[i-1] + local m_x = xfactor*sequence[i+1] + local m_y = yfactor*sequence[i+2] + local r_x = xfactor*sequence[i+3] + local r_y = yfactor*sequence[i+4] + path[size] = f_curveto ( + l_x + 2/3 * (m_x-l_x), + l_y + 2/3 * (m_y-l_y), + r_x + 2/3 * (m_x-r_x), + r_y + 2/3 * (m_y-r_y), + r_x, r_y + ) + i = i + 5 + else + -- weird + i = i + 1 + end + end + elseif segments then + for i=1,#segments do + local segment = segments[i] + local operator = segment[#segment] + if operator == "m" then -- "moveto" + if size > 0 then + size = size + 1 + path[size] = s_cycle + list[#list+1] = concat(path,"",1,size) + size = 1 + else + size = size + 1 + end + path[size] = f_moveto(xfactor*segment[1],yfactor*segment[2]) + elseif operator == "l" then -- "lineto" + size = size + 1 + path[size] = f_lineto(xfactor*segment[1],yfactor*segment[2]) + elseif operator == "c" then -- "curveto" + size = size + 1 + path[size] = f_curveto(xfactor*segment[1],yfactor*segment[2],xfactor*segment[3],yfactor*segment[4],xfactor*segment[5],yfactor*segment[6]) + elseif operator =="q" then -- "quadraticto" + size = size + 1 + -- first is always a moveto + local prev = segments[i-1] + local l_x = xfactor*prev[#prev-2] + local l_y = yfactor*prev[#prev-1] + local m_x = xfactor*segment[1] + local m_y = yfactor*segment[2] + local r_x = xfactor*segment[3] + local r_y = yfactor*segment[4] + path[size] = f_curveto ( + l_x + 2/3 * (m_x-l_x), + l_y + 2/3 * (m_y-l_y), + r_x + 2/3 * (m_x-r_x), + r_y + 2/3 * (m_y-r_y), + r_x, r_y + ) + else + -- weird + end + end + else + return + end + if size > 0 then + size = size + 1 + path[size] = s_cycle + list[#list+1] = concat(path,"",1,size) + end + return list +end + +function metapost.fill(paths) + local r = { } + local n = #paths + for i=1,n do + if i < n then + r[i] = f_nofill(paths[i]) + else + r[i] = f_dofill(paths[i]) + end + end + return concat(r) +end + +function metapost.draw(paths,trace) + local r = { } + local n = #paths + for i=1,n do + if trace then + r[i] = f_draw_trace(paths[i]) + else + r[i] = f_draw(paths[i]) + end + end + return concat(r) +end + +function metapost.maxbounds(data,index,factor) + local maxbounds = data.maxbounds + local factor = factor or 1 + local glyphs = data.glyphs + local glyph = glyphs[index] + local boundingbox = glyph.boundingbox + local xmin, ymin, xmax, ymax + if not maxbounds then + xmin = 0 + ymin = 0 + xmax = 0 + ymax = 0 + for i=1,#glyphs do + local d = glyphs[i] + if d then + local b = d.boundingbox + if b then + if b[1] < xmin then xmin = b[1] end + if b[2] < ymin then ymin = b[2] end + if b[3] > xmax then xmax = b[3] end + if b[4] > ymax then ymax = b[4] end + end + end + end + maxbounds = { xmin, ymin, xmax, ymax } + data.maxbounds = maxbounds + else + xmin = maxbounds[1] + ymin = maxbounds[2] + xmax = maxbounds[3] + ymax = maxbounds[4] + end + local llx = boundingbox[1] + local lly = boundingbox[2] + local urx = boundingbox[3] + local ury = boundingbox[4] + local width = glyph.width + if llx > 0 then + llx = 0 + end + if width > urx then + urx = width + end + return f_boundingbox( + factor*llx,factor*ymin, + factor*urx,factor*ymin, + factor*urx,factor*ymax, + factor*llx,factor*ymax + ) +end + +-- This is a nice example of tex, metapost and lua working in tandem. Each kicks in at the +-- right time. It's probably why I like watching https://www.youtube.com/watch?v=c5FqpddnJmc +-- so much: precisely (and perfectly) timed too. + +local texgetbox = tex.getbox + +local nodecodes = nodes.nodecodes -- no nuts yet +local rulecodes = nodes.rulecodes + +local rule_code = nodecodes.rule + +local normalrule_code = rulecodes.normal +local outlinerule_code = rulecodes.outline +local userrule_code = rulecodes.user +local emptyrule_code = rulecodes.empty + +local nuts = nodes.nuts +local getwhd = nuts.getwhd +local getexpansion = nuts.getexpansion +local isglyph = nuts.isglyph + +local characters = fonts.hashes.characters +local parameters = fonts.hashes.parameters +local shapes = fonts.hashes.shapes +local topaths = metapost.paths + +local f_text = formatters["mfun_do_outline_text_flush(%q,%i,%N,%N,%q)(%,t);"] +local f_rule = formatters["mfun_do_outline_rule_flush(%q,%N,%N,%N,%N);"] +local f_bounds = formatters["checkbounds(%N,%N,%N,%N);"] +local s_nothing = "(origin scaled 10)" + +local sc = 10 +local fc = number.dimenfactors.bp + +function metapost.glyph(kind,font,char,advance,shift,ex) + local character = characters[font][char] + if character then + local index = character.index + if index then + local shapedata = shapes[font] + local glyphs = shapedata.glyphs -- todo: subfonts fonts.shapes.indexed(font,sub) + if glyphs then + local glyf = glyphs[index] + if glyf then + local units = 1000 -- factor already takes shapedata.units into account + local yfactor = (sc/units) * parameters[font].factor / 655.36 + local xfactor = yfactor + local shift = shift or 0 + local advance = advance or 0 + local exfactor = ex or 0 + local wfactor = 1 + local detail = kind == "p" and tostring(char) or "" + if exfactor ~= 0 then + wfactor = (1+(ex/units)/1000) + xfactor = xfactor * wfactor + end + local paths = topaths(glyf,xfactor,yfactor) + if paths then + return f_text(kind,#paths,advance,shift,detail,paths) -- , character.width * fc * wfactor + end + end + end + end + end +end + +local kind = "" +local buffer = { } +local b = 0 + +local function reset() + buffer = { } + b = 0 +end + +local function flushcharacter(current, pos_h, pos_v, pod_r, font, char) + local char, font = isglyph(current) + local code = metapost.glyph(kind,font,char,pos_h*fc,pos_v*fc,getexpansion(current)) + if code then + b = b + 1 + buffer[b] = code + end +end + +local function flushrule(current, pos_h, pos_v, pos_r, size_h, size_v, subtype) + if subtype == normalrule_code then + b = b + 1 + buffer[b] = f_rule("f",pos_h*fc,pos_v*fc,size_h*fc,size_v*fc) + elseif subtype == outlinerule_code then + b = b + 1 + buffer[b] = f_rule("d",pos_h*fc,pos_v*fc,size_h*fc,size_v*fc) + elseif subtype == userrule_code then + -- print("USER RULE") + -- b = b + 1 + -- buffer[b] = f_rule("d",size_h*fc,size_v*fc,pos_h*fc,pos_v*fc) + elseif subtype == emptyrule_code then + -- ignore + else + -- b = b + 1 + -- buffer[b] = f_rule("f",pos_h*fc,pos_v*fc,size_h*fc,size_v*fc) + end +end + +local function flushsimplerule(pos_h, pos_v, pos_r, size_h, size_v) + flush_rule(false,pos_h,pos_v,pos_r,size_h,size_v,normalrule_code) +end + +local function flushspecialrule(pos_h, pos_v, pos_r, w, h, d, l, outline) + flush_rule(false,pos_h,pos_v-d,pos_r,w,h+d,outline and outlinerule_code or normalrule_code) +end + +-- installer + +drivers.install { + name = "mpo", + actions = { + initialize = function() + reset() + end, + finalize = function(driver,details) + local bb = details.boundingbox + local llx = bb[1] * fc + local lly = bb[2] * fc + local urx = bb[3] * fc + local ury = bb[4] * fc + b = b + 1 + buffer[b] = f_bounds(llx,lly,urx,ury) + end, + }, + flushers = { + updatefontstate = updatefontstate, + character = flushcharacter, + rule = flushrule, + simplerule = flushsimplerule, + specialrule = flushspecialrule, + } +} + +function metapost.boxtomp(n,k) + kind = k + nodes.handlers.finalizebox(n) + drivers.converters.lmtx(drivers.instances.mpo,texgetbox(n),"box",1) + local result = concat(buffer,";") + reset() + return result +end + diff --git a/tex/context/base/mkxl/font-sty.mklx b/tex/context/base/mkxl/font-sty.mklx index db7b69e48..11abdde99 100644 --- a/tex/context/base/mkxl/font-sty.mklx +++ b/tex/context/base/mkxl/font-sty.mklx @@ -252,8 +252,8 @@ \protected\def\font_styles_apply_grouped#name% assumes that the next is { or \bgroup {\bgroup - \def\g_style{\font_styles_use_defined{#name}}% - \afterassignment\g_style + \def\currentstyle{\font_styles_use_defined{#name}}% + \afterassignment\currentstyle \let\nexttoken} \protected\def\font_styles_use_defined#name% diff --git a/tex/context/base/mkxl/font-tra.mkxl b/tex/context/base/mkxl/font-tra.mkxl index 1452244af..625e2fe0b 100644 --- a/tex/context/base/mkxl/font-tra.mkxl +++ b/tex/context/base/mkxl/font-tra.mkxl @@ -51,7 +51,7 @@ %D %D \showkerning{Can you guess what kerning is?} -\fetchmodulecommand \showkerning \f!s_fonts_show +\fetchmodulecommand \showkerning \f!font_run %D \macros %D {showbodyfontenvironment,showfont,showfontstyle,showligatures} diff --git a/tex/context/base/mkxl/grph-fig.mkxl b/tex/context/base/mkxl/grph-fig.mkxl index 71e9569d5..dee441c98 100644 --- a/tex/context/base/mkxl/grph-fig.mkxl +++ b/tex/context/base/mkxl/grph-fig.mkxl @@ -108,6 +108,11 @@ \newdimen\d_grph_steps_y \newbox \b_grph_steps_colorbar +\ifdefined\referring\else \mutable\let\referring\relax \fi +\ifdefined\marking \else \mutable\let\marking \relax \fi +\ifdefined\remark \else \mutable\let\remark \relax \fi +\ifdefined\colorbar \else \mutable\let\colorbar \relax \fi + \tolerant\protected\def\grph_steps_place_figure#1#2#3#4[#5]% {\hpack {\setbox\scratchbox\hpack diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl index c95f57fda..fa689a18b 100644 --- a/tex/context/base/mkxl/lang-ini.mkxl +++ b/tex/context/base/mkxl/lang-ini.mkxl @@ -11,8 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% We can protect \currentlanguage etc too. - % \cldcontext{languages.numbers[tex.count.mainlanguagenumber]} %D This module implements multi||language support of \CONTEXT, which should not be @@ -60,8 +58,8 @@ %D \startmode[*nl] dutch \stopmode} %D \stoptyping -\let\currentlanguage \empty -\let\currentmainlanguage\empty +\mutable\let\currentlanguage \empty +\mutable\let\currentmainlanguage\empty %D \macros %D {defaultlanguage,languageparameter,specificlanguageparameter} @@ -72,7 +70,7 @@ \installcorenamespace{language} \installcorenamespace{languagelinked} -\def\currentusedlanguage{\currentlanguage} +\mutable\def\currentusedlanguage{\currentlanguage} \permanent\def\defaultlanguage#1% {\ifcsname\??language#1\s!default\endcsname diff --git a/tex/context/base/mkxl/luat-ini.mkxl b/tex/context/base/mkxl/luat-ini.mkxl index 4373131e1..48876a05f 100644 --- a/tex/context/base/mkxl/luat-ini.mkxl +++ b/tex/context/base/mkxl/luat-ini.mkxl @@ -75,6 +75,8 @@ \ifdefined\+ \else \def\+{+} \fi \ifdefined\- \else \def\-{-} \fi +\ifdefined\? \else \def\?{?} \fi \ifdefined\! \else \def\!{!} \fi % bonus + \ifdefined\1 \else \def\1{1} \fi \ifdefined\2 \else \def\2{2} \fi \ifdefined\3 \else \def\3{3} \fi \ifdefined\4 \else \def\4{4} \fi \ifdefined\5 \else \def\5{5} \fi \ifdefined\6 \else \def\6{6} \fi diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index b568ef126..39eb3f31d 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -702,7 +702,7 @@ %definemathcommand [joinrel] {\mathrel{\mkern-3mu}} \definemathcommand [joinrel] [rel] {\mkern-3mu} -\chardef\c_math_strut"28 +\immutable\chardef\c_math_strut"28 % \protected\def\math_strut_htdp#1% % {\s!height\fontcharht#1\c_math_strut diff --git a/tex/context/base/mkxl/meta-ini.mkxl b/tex/context/base/mkxl/meta-ini.mkxl index 9d32e2dbf..ce3e59c96 100644 --- a/tex/context/base/mkxl/meta-ini.mkxl +++ b/tex/context/base/mkxl/meta-ini.mkxl @@ -82,8 +82,9 @@ \installcorenamespace{mpclip} \newtoks \t_meta_initializations % tex, each -\def \t_meta_inclusions {\csname\??mpinclusions \currentMPinstance\endcsname} % token register -\def \t_meta_definitions {\csname\??mpdefinitions\currentMPinstance\endcsname} % token register + +\permanent\def\t_meta_inclusions {\csname\??mpinclusions \currentMPinstance\endcsname} % token register +\permanent\def\t_meta_definitions{\csname\??mpdefinitions\currentMPinstance\endcsname} % token register %D The next command is, of course, dedicated to Mojca, who needs it for gnuplot. %D Anyway, the whole multiple engine mechanism is to keep her gnuplot from diff --git a/tex/context/base/mkxl/meta-nod.mkxl b/tex/context/base/mkxl/meta-nod.mkxl index 4ecdce63c..021e84561 100644 --- a/tex/context/base/mkxl/meta-nod.mkxl +++ b/tex/context/base/mkxl/meta-nod.mkxl @@ -233,6 +233,9 @@ \permanent\protected\def\grph_nodes_code#1% {\etoksapp\t_meta_nodes{#1}} +\aliased\let\mpcode \relax +\aliased\let\nodeMPcode\relax + \appendtoks \enforced\let\nodeMPcode\grph_nodes_code \enforced\let\mpcode \grph_nodes_code diff --git a/tex/context/base/mkxl/mlib-pdf.mkxl b/tex/context/base/mkxl/mlib-pdf.mkxl index cf11e5bb7..03bc44f79 100644 --- a/tex/context/base/mkxl/mlib-pdf.mkxl +++ b/tex/context/base/mkxl/mlib-pdf.mkxl @@ -46,7 +46,7 @@ \global\MPurx \zeropoint \global\MPury \zeropoint} -\let\popMPboundingbox\relax +\aliased\let\popMPboundingbox\relax \permanent\protected\def\pushMPboundingbox {\enforced\permanent\protected\edef\popMPboundingbox diff --git a/tex/context/base/mkxl/mult-aux.mkxl b/tex/context/base/mkxl/mult-aux.mkxl index 5db4c1677..20199667c 100644 --- a/tex/context/base/mkxl/mult-aux.mkxl +++ b/tex/context/base/mkxl/mult-aux.mkxl @@ -996,7 +996,7 @@ % many assignments and mechanism that do are also slow; the advantage is mostly nicer % in tracing -\let\c_mult_set\relax +\mutable\let\c_mult_set\relax \protected\def\mult_interfaces_install_definition_set#1#2#3#4#5#6#7% {\newcount#3% diff --git a/tex/context/base/mkxl/mult-ini.mkxl b/tex/context/base/mkxl/mult-ini.mkxl index ce8d12069..1b13b1dbc 100644 --- a/tex/context/base/mkxl/mult-ini.mkxl +++ b/tex/context/base/mkxl/mult-ini.mkxl @@ -735,20 +735,20 @@ %D For at the \LUA\ end (experiment): -\def\ui_c#1#2{\immutable\gdefcsname\c!prefix!#1\endcsname{#1}% - \immutable\gdefcsname\k!prefix!#2\endcsname{#1}} % backmapping from non english -\def\ui_s #1{\immutable\gdefcsname\c!prefix!#1\endcsname{#1}% - \immutable\gdefcsname\k!prefix!#1\endcsname{#1}} % backmapping from non english -\def\ui_v#1#2{\immutable\gdefcsname\v!prefix!#1\endcsname{#2}} -\def\ui_e#1#2{\immutable\gdefcsname\e!prefix!#1\endcsname{#2}} -\def\ui_a#1#2{\frozen\protected\def#2{#1}} % will go away - -\startinterface english - - \def\ui_c#1#2{\immutable\gdefcsname\c!prefix!#1\endcsname{#1}} - \def\ui_s #1{\immutable\gdefcsname\c!prefix!#1\endcsname{#1}} - -\stopinterface +% \def\ui_c#1#2{\immutable\gdefcsname\c!prefix!#1\endcsname{#1}% +% \immutable\gdefcsname\k!prefix!#2\endcsname{#1}} % backmapping from non english +% \def\ui_s #1{\immutable\gdefcsname\c!prefix!#1\endcsname{#1}% +% \immutable\gdefcsname\k!prefix!#1\endcsname{#1}} % backmapping from non english +% \def\ui_v#1#2{\immutable\gdefcsname\v!prefix!#1\endcsname{#2}} +% \def\ui_e#1#2{\immutable\gdefcsname\e!prefix!#1\endcsname{#2}} +% \def\ui_a#1#2{\frozen\protected\def#2{#1}} % will go away +% +% \startinterface english +% +% \def\ui_c#1#2{\immutable\gdefcsname\c!prefix!#1\endcsname{#1}} +% \def\ui_s #1{\immutable\gdefcsname\c!prefix!#1\endcsname{#1}} +% +% \stopinterface %D So much for the basic multi||lingual interface commands. The macro's can be %D enhanced with more testing facilities, but for the moment they suffice. diff --git a/tex/context/base/mkxl/node-rul.mkxl b/tex/context/base/mkxl/node-rul.mkxl index c507885a8..3adf3b5b8 100644 --- a/tex/context/base/mkxl/node-rul.mkxl +++ b/tex/context/base/mkxl/node-rul.mkxl @@ -82,8 +82,8 @@ \newtoks\t_node_rules_checklist -\let\c_node_rules_index\relax % temporary synonym -\let\p_node_rules_color\empty +\mutable\let\c_node_rules_index\relax % temporary synonym (can be shared) +\mutable\let\p_node_rules_color\empty \aliased\let\setupbars\setupbar @@ -363,7 +363,7 @@ \newtoks\t_node_shifts_checklist -\let\c_node_shifts_index\relax % temporary synonym +\mutable\let\c_node_shifts_index\relax % temporary synonym (can be shared) \let\setupshifts\setupshift @@ -472,7 +472,7 @@ \newtoks\t_node_linefiller_checklist -\let\c_node_linefiller_index\relax % temporary synonym +\mutable\let\c_node_linefiller_index\relax % temporary synonym (can be shared) \aliased\let\setuplinefillers\setuplinefiller diff --git a/tex/context/base/mkxl/pack-box.mkxl b/tex/context/base/mkxl/pack-box.mkxl index 975f657b7..3cb50d6f0 100644 --- a/tex/context/base/mkxl/pack-box.mkxl +++ b/tex/context/base/mkxl/pack-box.mkxl @@ -193,7 +193,7 @@ \newconditional\c_pack_boxes_collector_valid_box -\let\b_pack_boxes_collector\scratchbox +\mutable\let\b_pack_boxes_collector\scratchbox \def\pack_boxes_collector_check_box#1% {\edef\currentcollector{#1}% diff --git a/tex/context/base/mkxl/pack-lyr.mkxl b/tex/context/base/mkxl/pack-lyr.mkxl index 2950782f7..6f84b0628 100644 --- a/tex/context/base/mkxl/pack-lyr.mkxl +++ b/tex/context/base/mkxl/pack-lyr.mkxl @@ -196,6 +196,9 @@ %D \setlayer [identifier] [optional parameters] {data} %D \stoptyping +\mutable\let\currentlayerwidth \empty +\mutable\let\currentlayerheight\empty + \permanent\tolerant\protected\def\setcurrentlayerdimensions[#1]#*[#2]% name left|right {\edef\currentlayerwidth {\thelayerwidth {#2#1}}% \edef\currentlayerheight{\thelayerheight{#2#1}}} @@ -528,6 +531,9 @@ % optimized +\mutable\integerdef\b_layer_one\zerocount +\mutable\integerdef\b_layer_two\zerocount + \def\pack_layers_flush_single {\ifcsname\??layerbox\currentlayer\endcsname \ifvoid\lastnamedcs @@ -538,10 +544,10 @@ \fi \fi \else - \chardef\b_layer_one\lastnamedcs + \chardef\b_layer_one\lastnamedcs % will be \integerdef \ifcsname\??layerbox\currentlayer:\the\realpageno\endcsname \ifvoid\lastnamedcs\else - \chardef\b_layer_two\lastnamedcs + \chardef\b_layer_two\lastnamedcs % will be \integerdef \startoverlay {\pack_layers_flush_indeed\plusone \currentlayer \b_layer_one}% {\pack_layers_flush_indeed\zerocount{\currentlayer:\the\realpageno}\b_layer_two}% diff --git a/tex/context/base/mkxl/pack-obj.mkxl b/tex/context/base/mkxl/pack-obj.mkxl index 751434db0..04fc90a58 100644 --- a/tex/context/base/mkxl/pack-obj.mkxl +++ b/tex/context/base/mkxl/pack-obj.mkxl @@ -42,7 +42,7 @@ \newif \ifinobject \newbox \objectbox -\def\objectoffset{1cm} +\mutable\def\objectoffset{1cm} \newdimen\objectoff \permanent\def\objectmargin{\the\objectoff} \newdimen\objectwd \permanent\def\objectwidth {\the\objectwd} diff --git a/tex/context/base/mkxl/pack-rul.lmt b/tex/context/base/mkxl/pack-rul.lmt index 3fa179604..e5b2887ba 100644 --- a/tex/context/base/mkxl/pack-rul.lmt +++ b/tex/context/base/mkxl/pack-rul.lmt @@ -243,6 +243,7 @@ nodes.maxboxwidth = maxboxwidth implement { name = "themaxboxwidth", + public = true, actions = function(n) context("%rsp",maxboxwidth(getbox(n))) end, -- r = rounded arguments = "integer" } diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index d3db64d2e..17df200e2 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -2813,18 +2813,34 @@ \newcount\c_temp_framed_crap +% \permanent\tolerant\protected\def\pack_framed_defined_process[#1]#*[#2]% official (not much checking, todo: parent) +% {\bgroup +% \ifcsname\??regularframedlevel#1\endcsname +% %\expandafter\let\expandafter\c_pack_framed_temp\csname\??regularframedlevel#1\endcsname +% \expandafter\let\expandafter\c_pack_framed_temp\lastnamedcs +% \else +% \let\c_pack_framed_temp\c_temp_framed_crap +% \fi +% \advance\c_pack_framed_temp\plusone +% \defcsname\??framed#1>\the\c_pack_framed_temp:\s!parent\endcsname{\??framed#1}% \inheritlocalframed +% \bgroup +% \edef\currentframed{#1>\the\c_pack_framed_temp}% +% \pack_framed_initialize +% \setupcurrentframed[#2]% here ! +% \pack_framed_process_indeed} + \permanent\tolerant\protected\def\pack_framed_defined_process[#1]#*[#2]% official (not much checking, todo: parent) {\bgroup \ifcsname\??regularframedlevel#1\endcsname %\expandafter\let\expandafter\c_pack_framed_temp\csname\??regularframedlevel#1\endcsname - \expandafter\let\expandafter\c_pack_framed_temp\lastnamedcs + \scratchcounter\lastnamedcs \else - \let\c_pack_framed_temp\c_temp_framed_crap + \scratchcounter\c_temp_framed_crap \fi - \advance\c_pack_framed_temp\plusone - \defcsname\??framed#1>\the\c_pack_framed_temp:\s!parent\endcsname{\??framed#1}% \inheritlocalframed + \advance\scratchcounter\plusone + \defcsname\??framed#1>\the\scratchcounter:\s!parent\endcsname{\??framed#1}% \inheritlocalframed \bgroup - \edef\currentframed{#1>\the\c_pack_framed_temp}% + \edef\currentframed{#1>\the\scratchcounter}% \pack_framed_initialize \setupcurrentframed[#2]% here ! \pack_framed_process_indeed} @@ -2965,7 +2981,7 @@ %D \the\dimexpr\themaxboxwidth\scratchbox\relax %D \stoptyping -\let\themaxboxwidth\clf_themaxboxwidth +% \let\themaxboxwidth % defined at the lua end %D Fast enough for most cases (we could do a massive \type {\ifhastok} instead): diff --git a/tex/context/base/mkxl/page-otr.mklx b/tex/context/base/mkxl/page-otr.mklx index 2cc8f4809..f2a341d4b 100644 --- a/tex/context/base/mkxl/page-otr.mklx +++ b/tex/context/base/mkxl/page-otr.mklx @@ -25,8 +25,6 @@ % triggerpagebuilder % defined at the lua end -\def\m!otr{otr} % todo - \installcorenamespace{outputroutine} \installswitchcommandhandler \??outputroutine {outputroutine} \??outputroutine diff --git a/tex/context/base/mkxl/page-pcl.mkxl b/tex/context/base/mkxl/page-pcl.mkxl index db4ebdfd4..98f69b10d 100644 --- a/tex/context/base/mkxl/page-pcl.mkxl +++ b/tex/context/base/mkxl/page-pcl.mkxl @@ -480,7 +480,7 @@ \fi \egroup} -\def\d_page_col_collected_top_float_height % pseudo +\permanent\def\d_page_col_collected_top_float_height % pseudo {\dimexpr \d_page_floats_inserted_top + \maxcollectedfloatstotal + diff --git a/tex/context/base/mkxl/page-sid.mkxl b/tex/context/base/mkxl/page-sid.mkxl index 230ce147e..3c1f1f7be 100644 --- a/tex/context/base/mkxl/page-sid.mkxl +++ b/tex/context/base/mkxl/page-sid.mkxl @@ -379,14 +379,14 @@ %D {\pagedepth} and \type {\pageshrink} in the next two. If we ever need %D that it will become options. -\def\e_page_sides_flush_criterium +\permanent\def\d_page_sides_flush_criterium {\dimexpr \d_page_sides_vsize -\d_page_sides_bottomtotal -\pagetotal \relax} -\def\e_page_sides_room_criterium +\permanent\def\d_page_sides_room_criterium {\dimexpr \d_page_sides_vsize -\d_page_sides_bottomtotal % added here too @@ -418,7 +418,7 @@ \def\page_sides_flush_floats {\par - \ifdim\e_page_sides_flush_criterium>\zeropoint + \ifdim\d_page_sides_flush_criterium>\zeropoint \page_sides_flush_floats_progress \page_sides_flush_floats_after_next \fi @@ -427,7 +427,7 @@ \def\page_sides_flush_floats_text {\par % what with \c_anch_backgrounds_text_level>\plusone - \ifdim\e_page_sides_flush_criterium>\zeropoint + \ifdim\d_page_sides_flush_criterium>\zeropoint \page_sides_flush_floats_progress \page_sides_flush_floats_after_none \fi @@ -458,7 +458,7 @@ \permanent\protected\def\doifelsesidefloat {\par - \ifdim\e_page_sides_room_criterium>\zeropoint % -\pagedepth + \ifdim\d_page_sides_room_criterium>\zeropoint % -\pagedepth \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -511,7 +511,7 @@ \forgetall \offinterlineskip \doloop - {\scratchdimen\e_page_sides_flush_criterium + {\scratchdimen\d_page_sides_flush_criterium \ifdim\scratchdimen>\onepoint % good enough, can become configurable \ifnum\recurselevel>\plushundred % safeguard, sort of deadcycles \exitloop diff --git a/tex/context/base/mkxl/phys-dim.mkxl b/tex/context/base/mkxl/phys-dim.mkxl index 3102650bf..5df7b5a16 100644 --- a/tex/context/base/mkxl/phys-dim.mkxl +++ b/tex/context/base/mkxl/phys-dim.mkxl @@ -805,4 +805,15 @@ %D \defineunits[bunit][label=bar] \bunit{10 l/s}\par %D \stoptyping +%D Bonus: +%D +%D \starttyping +%D \pi\ = \hyphenateddigits[\unknown]{3.141592653589793238462643383279502884197169399375105} \blank +%D \pi\ = \hyphenateddigits{3.141592653589793238462643383279502884197169399375105} \blank +%D x $\pi = \hyphenateddigits[\unknown]{3.141592653589793238462643383279502884197169399375105}$ \blank +%D x $\pi = \hyphenateddigits{3.141592653589793238462643383279502884197169399375105}$ \blank +%D \stoptyping + +\mutable\protected\def\digitsbreak{\hskip\zeropoint\s!plus\onepoint\relax\ifmmode\allowbreak\fi} + \protect \endinput diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl index b550fef39..e3eee279d 100644 --- a/tex/context/base/mkxl/publ-ini.mkxl +++ b/tex/context/base/mkxl/publ-ini.mkxl @@ -924,7 +924,7 @@ %D \starttyping %D % #1 is number of entries %D -%D \starttexdefinition unexpanded btx:for:alan:wrapper #1 +%D \starttexdefinition mutable protected btx:for:alan:wrapper #1 %D \bTABLE %D % we can have a command or setups %D \flushbtxentries[command=\texdefinition{btx:for:alan:content}] @@ -933,7 +933,7 @@ %D %D % #1 is tag %D -%D \starttexdefinition unexpanded btx:for:alan:content #1 +%D \starttexdefinition mutable protected btx:for:alan:content #1 %D \bTR %D \bTD %D \btxsettag{#1} @@ -1309,7 +1309,7 @@ \ifx\currentbtxinteraction\v!stop \setfalse\btxinteractive \else - \let\structurelistlocation\empty + \enforced\let\structurelistlocation\empty \settrue\btxinteractive \begincsname\??btxinteraction\currentbtxinteraction\endcsname \fi diff --git a/tex/context/base/mkxl/regi-ini.mkxl b/tex/context/base/mkxl/regi-ini.mkxl index 31e8b4717..515b6afd6 100644 --- a/tex/context/base/mkxl/regi-ini.mkxl +++ b/tex/context/base/mkxl/regi-ini.mkxl @@ -23,7 +23,7 @@ %D Beware, the enable and disable commands are global switches, so best use the %D start|/|stop commands. -\let\currentregime\empty +\mutable\let\currentregime\empty \permanent\protected\def\enableregime[#1]{\clf_enableregime{#1}} \permanent\protected\def\disableregime {\clf_disableregime} diff --git a/tex/context/base/mkxl/scrn-fld.mklx b/tex/context/base/mkxl/scrn-fld.mklx index 674be425a..d01ecfaca 100644 --- a/tex/context/base/mkxl/scrn-fld.mklx +++ b/tex/context/base/mkxl/scrn-fld.mklx @@ -473,6 +473,14 @@ \newconditional\fieldisvertical \newconditional\fieldishorizontal +\mutable\let\currentfieldtotalframed \empty +\mutable\let\currentfieldlabelframed \empty +\mutable\let\currentfieldcontentframed\empty + +\mutable\let\fieldtotalframedparameterhash \empty % weird that we have to flag this +\mutable\let\fieldlabelframedparameterhash \empty % idem +\mutable\let\fieldcontentframedparameterhash\empty % idem + \permanent\tolerant\protected\def\field[#tag]#spacer[#label]% can be sped up with \setupcurrentfieldtotalframed etc {\iflocation \dontleavehmode diff --git a/tex/context/base/mkxl/spac-ali.mkxl b/tex/context/base/mkxl/spac-ali.mkxl index 56ac53a3e..17886dfd3 100644 --- a/tex/context/base/mkxl/spac-ali.mkxl +++ b/tex/context/base/mkxl/spac-ali.mkxl @@ -781,7 +781,7 @@ \forgetall \enforced\let\\\endgraf \ifdoublesided\signalouterrealign\fi - \doifelserightpage\c_spac_align_state_horizontal_left\spac_align_set_horizontal_right + \doifelserightpage\spac_align_set_horizontal_left\spac_align_set_horizontal_right \let\next} \let\raggedbox\relax diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl index 9a7912abf..3d0963df5 100644 --- a/tex/context/base/mkxl/spac-ver.mkxl +++ b/tex/context/base/mkxl/spac-ver.mkxl @@ -718,7 +718,7 @@ \fi \fi} -\protected\def\setmaxdepth +\permanent\protected\def\setmaxdepth {\maxdepth\systemmaxdepthfactor\globalbodyfontsize} \newskip \usedbaselineskip % These used to be \normal... but that isn't pretty @@ -793,10 +793,10 @@ %D \rm \saveinterlinespace .... {\ss \restoreinterlinespace .... \endgraf} %D \stoptyping -\let\restoreinterlinespace\relax +\aliased\let\restoreinterlinespace\relax \permanent\protected\def\saveinterlinespace - {\protected\edef\restoreinterlinespace + {\enforced\permanent\protected\edef\restoreinterlinespace {\lineheight \the\lineheight \openstrutheight \the\openstrutheight \openstrutdepth \the\openstrutdepth @@ -1358,7 +1358,8 @@ % attributes \newcount\c_spac_keep_lines_together -\let\restoreinterlinepenalty\relax + +\aliased\let\restoreinterlinepenalty\relax \protected\def\spac_penalties_restore {\global\enforced\let\restoreinterlinepenalty\relax diff --git a/tex/context/base/mkxl/strc-itm.mklx b/tex/context/base/mkxl/strc-itm.mklx index be663edc8..c6206edd5 100644 --- a/tex/context/base/mkxl/strc-itm.mklx +++ b/tex/context/base/mkxl/strc-itm.mklx @@ -199,6 +199,7 @@ \newconditional\c_strc_itemgroups_extra \newconditional\c_strc_itemgroups_repeat \newconditional\c_strc_itemgroups_inline_head +\newconditional\c_strc_itemgroups_symbol % 0 = before/after % 1 = between unless before @@ -392,6 +393,9 @@ % \protected\def\strc_itemgroups_process_options#options% % {\normalexpanded{\strc_itemgroups_process_option_list[#options]}} % expansion of options is handy for xml +\mutable\let\itemgroupfirst \empty +\mutable\let\itemgroupsecond\empty + \def\strc_itemgroups_process_option#option% {\edef\itemgroupconstantvalue{#option}% \ifempty\itemgroupconstantvalue\else @@ -1775,10 +1779,20 @@ \starthead{#head}#body\stophead \stopitemgroup} -\setuvalue{\e!start\v!item}% todo: frozen +\pushoverloadmode + +\permanent\protected\defcsname\e!start\v!item\endcsname {\startitemgroup[\v!itemize]% \startitemgroupitem - \setuvalue{\e!stop\v!item}{\stopitemgroupitem\stopitemgroup}} % todo: frozen + \enforced\letcsname\e!stop\v!item\endcsname\strc_itemgroups_stop_item} + +\aliased\letcsname\e!stop\v!item\endcsname\relax + +\permanent\protected\def\strc_itemgroups_stop_item + {\stopitemgroupitem + \stopitemgroup} + +\popoverloadmode % \def\sym#text% % {\noindent diff --git a/tex/context/base/mkxl/strc-lst.mklx b/tex/context/base/mkxl/strc-lst.mklx index 725faff9a..d54192e25 100644 --- a/tex/context/base/mkxl/strc-lst.mklx +++ b/tex/context/base/mkxl/strc-lst.mklx @@ -359,13 +359,13 @@ \def\strc_lists_process_pagenumber#1% {\begincsname\??listpagenumber#1\endcsname} -\def\structurelistlocation +\permanent\def\structurelistlocation {\clf_listlocation\numexpr\currentlistindex\relax} -\def\structurelistrealpagenumber +\permanent\def\structurelistrealpagenumber {\clf_listrealpage{\currentlist}\numexpr\currentlistindex\relax} -\protected\def\structurelistpagenumber +\permanent\protected\def\structurelistpagenumber {\dostarttagged\t!listpage\empty \ifconditional\c_lists_show_realpage \clf_listrealpage{\currentlist}\numexpr\currentlistindex\relax @@ -373,18 +373,18 @@ \clf_listprefixedpage {\currentlist}% \currentlistindex - { - separatorset {\listparameter\c!pageprefixseparatorset} - conversionset {\listparameter\c!pageprefixconversionset} - set {\listparameter\c!pageprefixset} - segments {\listparameter\c!pageprefixsegments} - connector {\listparameter\c!pageprefixconnector} + {% + separatorset {\listparameter\c!pageprefixseparatorset}% + conversionset {\listparameter\c!pageprefixconversionset}% + set {\listparameter\c!pageprefixset}% + segments {\listparameter\c!pageprefixsegments}% + connector {\listparameter\c!pageprefixconnector}% }% - { - prefix {\listparameter\c!pageprefix} - conversionset {\listparameter\c!pageconversionset} - starter {\listparameter\c!pagestarter} - stopper {\listparameter\c!pagestopper} + {% + prefix {\listparameter\c!pageprefix}% + conversionset {\listparameter\c!pageconversionset}% + starter {\listparameter\c!pagestarter}% + stopper {\listparameter\c!pagestopper}% }% \relax \fi @@ -511,7 +511,7 @@ \dostoptagged \listextraparameter\c!after} -\protected\def\strclistsentryprocess#tag#method#index#extra% This one is called at the lua end! +\permanent\protected\def\strclistsentryprocess#tag#method#index#extra% This one is called at the lua end! {\clf_pushlist#index\relax %\let\currentlistentrylocation\empty \edef\currentlist {#tag}% @@ -860,7 +860,7 @@ % because we want to avoid redundant lua calls we expand the % location beforehand \ifempty\currentlistentrylocation - \edef\currentlistentrylocation{\structurelistlocation}% needs attention + \enforced\edef\currentlistentrylocation{\structurelistlocation}% needs attention \fi % because these tests happen often and because we're dealing with % rather complex composed data we have special conditionals; keep diff --git a/tex/context/base/mkxl/strc-pag.mkxl b/tex/context/base/mkxl/strc-pag.mkxl index 3af694e81..8d404f163 100644 --- a/tex/context/base/mkxl/strc-pag.mkxl +++ b/tex/context/base/mkxl/strc-pag.mkxl @@ -30,10 +30,10 @@ \ifdefined\pageno \else \aliased\let\pageno\userpageno \fi -\def\realfolio{\the\realpageno} -\def\userfolio{\the\userpageno} -\def\subfolio {\the\subpageno } -\def\lastfolio{\the\lastpageno} +\permanent\def\realfolio{\the\realpageno} +\permanent\def\userfolio{\the\userpageno} +\permanent\def\subfolio {\the\subpageno } +\permanent\def\lastfolio{\the\lastpageno} \newtoks\everyinitializepagecounters diff --git a/tex/context/base/mkxl/strc-reg.mkxl b/tex/context/base/mkxl/strc-reg.mkxl index 2a8cc50fe..f2466a8c4 100644 --- a/tex/context/base/mkxl/strc-reg.mkxl +++ b/tex/context/base/mkxl/strc-reg.mkxl @@ -634,6 +634,7 @@ \to \everyplaceregister \newconditional\c_strc_registers_text_interaction +\newconditional\c_strc_registers_page_done \permanent\tolerant\protected\def\placeregister[#1]#*[#2]% {\ifarguments\else diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl index 0ede2f153..a77cdb401 100644 --- a/tex/context/base/mkxl/strc-sec.mkxl +++ b/tex/context/base/mkxl/strc-sec.mkxl @@ -1298,9 +1298,7 @@ \getsomefullstructurenumber{\thenamedheadlevel{#1}}{#2}% \endgroup} -\aliased\let\sectioncountervalue\structurevalue - -\def\currentheadtext{obsolete,\space use marks} +% \mutable\def\currentheadtext{obsolete,\space use marks} % list references, will be redone in lua when we need it diff --git a/tex/context/base/mkxl/symb-ini.mkxl b/tex/context/base/mkxl/symb-ini.mkxl index 458e212aa..74d4a2232 100644 --- a/tex/context/base/mkxl/symb-ini.mkxl +++ b/tex/context/base/mkxl/symb-ini.mkxl @@ -58,8 +58,8 @@ \setupsymbols [\c!stylealternative=\v!text] -\let\currentsymbol \empty -\let\currentsymbolset\empty +\mutable\let\currentsymbol \empty +\mutable\let\currentsymbolset\empty \newtoks\t_symb_setups diff --git a/tex/context/base/mkxl/syst-aux.lmt b/tex/context/base/mkxl/syst-aux.lmt index c0de8a953..4ef7b19d6 100644 --- a/tex/context/base/mkxl/syst-aux.lmt +++ b/tex/context/base/mkxl/syst-aux.lmt @@ -142,7 +142,10 @@ local spaces = space^0 local global = nil local protected = nil +local permanent = nil local expanded = nil +local mutable = nil +local immutable = nil local optional = nil local tolerant = nil local instance = nil @@ -185,10 +188,13 @@ local pattern = ( + ( P("nospaces") * space / catcodes_n ) + ( P("global") * space / function() global = true end) + ( P("protected") * space / function() protected = true end) + + ( P("permanent") * space / function() permanent = true end) + ( P("expanded") * space / function() expanded = true end) + ( P("tolerant") * space / function() tolerant = true end) + ( P("instance") * space / function() instance = true end) + ( P("frozen") * space / function() frozen = true end) + + ( P("mutable") * space / function() mutable = true end) + + ( P("immutable") * space / function() immutable = true end) + ( P("unexpanded") * space / function() protected = true end) + ( option * space / function(s) tolerant = true optional = s end) @@ -207,7 +213,10 @@ local ctx_dostarttexdefinition = context.dostarttexdefinition local function texdefinition_one(str) global = false protected = false + permanent = false expanded = false + mutable = false + immutable = false optional = 0 tolerant = false instance = false @@ -218,9 +227,17 @@ end local function texdefinition_two() context ( - (tolerant and [[\tolerant]] or "") .. (frozen and [[\frozen]] or "") .. (protected and [[\protected]] or "") .. (instance and [[\instance]] or "") .. - [[\expandafter]] .. (global and (expanded and [[\xdef]] or [[\gdef]]) or (expanded and [[\edef]] or [[\def]])) .. - [[\csname ]] .. csname .. [[\endcsname ]] .. + (tolerant and [[\tolerant]] or "") .. + (frozen and [[\frozen]] or "") .. + (protected and [[\protected]] or "") .. + (permanent and [[\permanent]] or "") .. + (instance and [[\instance]] or "") .. + (mutable and [[\mutable]] or "") .. + (immutable and [[\immutable]] or "") .. +-- [[\expandafter]] .. (global and (expanded and [[\xdef]] or [[\gdef]]) or (expanded and [[\edef]] or [[\def]])) .. +-- [[\csname ]] .. csname .. [[\endcsname ]] .. + (global and (expanded and [[\xdefcsname ]] or [[\gdefcsname ]]) or (expanded and [[\edefcsname ]] or [[\defcsname ]])) .. + csname .. [[\endcsname ]] .. rest ) end diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl index c116e9d46..4ee3f530c 100644 --- a/tex/context/base/mkxl/syst-aux.mkxl +++ b/tex/context/base/mkxl/syst-aux.mkxl @@ -1037,6 +1037,8 @@ \fi \fi} +\let\syst_process_action_in_set_all\relax + \tolerant\protected\def\syst_helpers_process_all_actions_in_set_indeed[#1]#*[#2]% {\globalpushmacro\syst_process_action_in_set_all \def\syst_process_action_in_set##1% @@ -1145,7 +1147,7 @@ % \or % \expandafter\syst_helpers_do_if_in_string_else_yes % \fi}% -% \normalexpanded{\syst_helpers_do_do_if_in_string_else#1}\e_o_t\ignorearguments\ignorearguments} +% \normalexpanded{\syst_helpers_do_do_if_in_string_else#1}\s!e_o_t_token\ignorearguments\ignorearguments} % % \protected\def\syst_helpers_do_if_in_string_else_delimited#1% ##2 can be {abc} % {\normalexpanded{\protected\def\syst_helpers_do_do_if_in_string_else##1,\m_syst_sub_string,##2}% @@ -1155,7 +1157,7 @@ % \or % \expandafter\syst_helpers_do_if_in_string_else_yes % \fi}% -% \normalexpanded{\syst_helpers_do_do_if_in_string_else,#1,}\e_o_t\ignorearguments\ignorearguments} +% \normalexpanded{\syst_helpers_do_do_if_in_string_else,#1,}\s!e_o_t_token\ignorearguments\ignorearguments} % % \protected\def\doifinstring#1% % {\edef\m_syst_sub_string{#1}% expand #1 here @@ -1173,7 +1175,7 @@ % \or % \expandafter\syst_helpers_do_if_in_string_yes % \fi}% -% \normalexpanded{\syst_helpers_do_do_if_in_string#1}\e_o_t\ignorearguments\ignorearguments} +% \normalexpanded{\syst_helpers_do_do_if_in_string#1}\s!e_o_t_token\ignorearguments\ignorearguments} % % \protected\def\doifnotinstring#1% % {\edef\m_syst_sub_string{#1}% expand #1 here @@ -1191,7 +1193,7 @@ % \or % \expandafter\syst_helpers_do_if_not_in_string_yes % \fi}% -% \normalexpanded{\syst_helpers_do_do_if_not_in_string#1}\e_o_t\ignorearguments\ignorearguments} +% \normalexpanded{\syst_helpers_do_do_if_not_in_string#1}\s!e_o_t_token\ignorearguments\ignorearguments} % % \def\syst_helpers_do_if_in_string_else_yes#0\ignorearguments\ignorearguments#2#0{#2} % \def\syst_helpers_do_if_in_string_else_nop#0\ignorearguments#0#3{#3} @@ -2875,11 +2877,11 @@ \def\syst_helpers_dodo_global {\resetglobal\global} -\def\saveglobal +\permanent\protected\def\saveglobal {\let\syst_helpers_dodo_global\dodoglobal \let\syst_helpers_redo_global\redoglobal} -\def\restoreglobal +\permanent\protected\def\restoreglobal {\enforced\let\redoglobal\syst_helpers_redo_global \enforced\let\dodoglobal\syst_helpers_dodo_global} @@ -6355,20 +6357,20 @@ \permanent\protected\def\ignoreimplicitspaces {\doifelsenextchar\relax\relax\relax} -%D \macros -%D {processwords} -%D -%D Not that sophisticated but sometimes users (like in metafun). - -%D This will be overloaded. - -\def\syst_helpers_process_word#1 #2\_e_o_w_ - {\doifsomething{#1}{\processword{#1} \syst_helpers_process_word#2 \_e_o_w_}} - -\def\processwords#1% - {\syst_helpers_process_word#1 \_e_o_w_}% no \unskip - -\let\processword\relax +% %D \macros +% %D {processwords} +% %D +% %D Not that sophisticated but sometimes users (like in metafun). +% +% %D This will be overloaded. +% +% \def\syst_helpers_process_word#1 #2\s!e_o_t_token +% {\doifsomething{#1}{\processword{#1} \syst_helpers_process_word#2 \s!e_o_t_token}} +% +% \def\processwords#1% +% {\syst_helpers_process_word#1 \s!e_o_t_token}% no \unskip +% +% \let\processword\relax %D \macros %D {startnointerference} @@ -6418,26 +6420,23 @@ \def\syst_helpers_direct_double_empty_one_nop#1{#1[][]} \def\syst_helpers_direct_double_empty_two_nop#1[#2]{#1[#2][]} -%D Used in math definitions (in an \type {\edef}): - -%D \startbuffer -%D [\docheckedpair{}] -%D [\docheckedpair{a}] -%D [\docheckedpair{a,b}] -%D [\docheckedpair{a,b,c}] -%D \stopbuffer -%D -%D \typebuffer \startlines \getbuffer \stoplines - -\permanent\def\docheckedpair#1% - {\syst_helpers_checked_pair#1,,\_o_e_p_} - -% \def\syst_helpers_checked_pair#1,#2,#0\_o_e_p_ +% %D Used in math definitions (in an \type {\edef}). This will be replaced. +% %D +% %D \startbuffer +% %D [\docheckedpair{}] +% %D [\docheckedpair{a}] +% %D [\docheckedpair{a,b}] +% %D [\docheckedpair{a,b,c}] +% %D \stopbuffer +% %D +% %D \typebuffer \startlines \getbuffer \stoplines +% +% \permanent\def\docheckedpair#1% +% {\syst_helpers_checked_pair#1,,\s!e_o_t_token} +% +% \def\syst_helpers_checked_pair#1,#2,#-\s!e_o_t_token % {#1,#2} -\def\syst_helpers_checked_pair#1,#2,#-\_o_e_p_ - {#1,#2} - %D Here are some nasty helpers. They can be used to fill often expanded token %D lists efficiently (see tabulate for an example). diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index dbd82c166..018658544 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -98,8 +98,6 @@ \catcode\tildeasciicode \activecatcode % `\~ tilde is active %catcode\delasciicode \invalidcatcode % `\^^? ascii delete is invalid -\chardef\statuswrite 128 % we need to get rid of this one - %D First we need to initialization the primitives. Because \CONTEXT\ is already a %D pretty old macro package, we have a couple of issues with respect to primitives. %D The \ETEX\ engine added a few as did \PDFTEX. The \LUATEX\ engine added even @@ -244,11 +242,13 @@ \permanent\countdef \c_syst_min_counter_value = 125 \c_syst_min_counter_value = -"7FFFFFFF % beware, we use index 125 at the lua end \permanent\countdef \c_syst_max_counter_value = 126 \c_syst_max_counter_value = "7FFFFFFF % beware, we use index 126 at the lua end -\immutable\integerdef\zerocount = 0 -\immutable\integerdef\plusone = 1 -\immutable\integerdef\minusone = -1 +\immutable\integerdef\zerocount 0 +\immutable\integerdef\plusone 1 +\immutable\integerdef\minusone -1 + +\immutable\integerdef\normalpagebox 255 % hardcoded in pdftex/xetex -\immutable\integerdef\normalpagebox = 255 % hardcoded in pdftex/xetex +\immutable\integerdef\statuswrite \minusone % A few traditional allocations (these might go): @@ -741,7 +741,7 @@ \popoverloadmode %let\pushoverloadmode\relax %let\popoverloadmode\relax -% \tracingall + % \tracingall \normaldump} \permanent\protected\def\input @@ -820,12 +820,14 @@ %D {newmacro,setnewmacro,newfraction} %D %D Let's be complete and also introduce some definers. These are not mandate -%D but handy for grepping. +%D but handy for grepping. We make these mutable because they are \type +%D {\let} (the only advantage is that we often give them names with some +%D prefix. -\permanent\protected\def\newmacro #1{\let#1\empty} -\permanent\protected\def\setnewmacro#1{\let#1} +\permanent\protected\def\newmacro #1{\mutable\let#1\empty} +\permanent\protected\def\setnewmacro#1{\mutable\let#1} -\permanent\protected\def\newfraction#1{\let#1\!!plusone} +\permanent\protected\def\newfraction#1{\mutable\let#1\!!plusone} \def\!!zerocount{0} % later redefined \def\!!plusone {1} % later redefined @@ -937,28 +939,39 @@ %D get. Beware: this macro does not support nested loops. We use a namespace %D prefix \type {@@pln}. -\permanent\def\loop#1\repeat{\def\@@plnbody{#1}\@@plniterate} % might go +\permanent\def\loop#1\repeat{\def\syst_plain_body{#1}\syst_plain_iterate} % might go %D The following makes \type {\loop} \unknown\ \type {\if} \unknown\ \type %D {\repeat} skippable (clever trick): \permanent\let\repeat\fi % so both \loop and \repeat are reserved words! -%D The original (no \type {@@pln} there): +%D The original (no \type {syst_plain_} there): %D %D \starttyping -%D \def\@@plniterate{\@@plnbody\let\next\@@plniterate\else\let\next\relax\fi\next} +%D \def\syst_plain_iterate +%D {\syst_plain_body +%D \let\next\syst_plain_iterate +%D \else +%D \let\next\relax +%D \fi +%D \next} %D \stoptyping %D %D A more efficient alternative: %D %D \starttyping -%D \def\@@plniterate{\@@plnbody\expandafter\@@plniterate\else\expandafter\relax\fi} +%D \def\syst_plain_iterate +%D {\syst_plain_body +%D \expandafter\syst_plain_iterate +%D \else\expandafter\relax\fi} %D \stoptyping %D %D An even more efficient one: -\def\@@plniterate{\@@plnbody\expandafter\@@plniterate\else\fi} +\def\syst_plain_iterate + {\syst_plain_body + \expandafter\syst_plain_iterate\else\fi} %D We don't define a real output routine yet but at least get rid of pages: diff --git a/tex/context/base/mkxl/syst-lua.lmt b/tex/context/base/mkxl/syst-lua.lmt index faad64ff0..911f9cbdf 100644 --- a/tex/context/base/mkxl/syst-lua.lmt +++ b/tex/context/base/mkxl/syst-lua.lmt @@ -63,7 +63,7 @@ local ctx_gobbleoneargument = context.gobbleoneargument implement { -- will be overloaded later name = "writestatus", - arguments = "2 strings", + arguments = "2 arguments", actions = logs.status, } diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl index 668a10f5b..f5e84f13f 100644 --- a/tex/context/base/mkxl/tabl-ntb.mkxl +++ b/tex/context/base/mkxl/tabl-ntb.mkxl @@ -969,10 +969,10 @@ \def\tabl_ntb_n_of_rows {\number\c_tabl_ntb_maximum_row} \def\tabl_ntb_n_of_columns {\number\c_tabl_ntb_maximum_col} -\let\currentTABLErow \!!zerocount -\let\currentTABLEcolumn\!!zerocount -\let\nofTABLErows \!!zerocount -\let\nofTABLEcolumns \!!zerocount +\mutable\let\currentTABLErow \!!zerocount +\mutable\let\currentTABLEcolumn\!!zerocount +\mutable\let\nofTABLErows \!!zerocount +\mutable\let\nofTABLEcolumns \!!zerocount % there is no gain in a \doifelsenextoptionalcs variant diff --git a/tex/context/base/mkxl/tabl-tab.mkxl b/tex/context/base/mkxl/tabl-tab.mkxl index 45dc36b36..7f16360a0 100644 --- a/tex/context/base/mkxl/tabl-tab.mkxl +++ b/tex/context/base/mkxl/tabl-tab.mkxl @@ -387,8 +387,8 @@ \fi}% \tempstring} -\def\newtableformatkey #1{\setvalue{!tk<\string#1>}} -\def\doreadtableformatkeys#1{\getvalue{!tk<\string#1>}} +\permanent\protected\def\newtableformatkey #1{\defcsname !tk<\string#1>\endcsname} +\permanent \def\doreadtableformatkeys#1{\begincsname !tk<\string#1>\endcsname} % Key "b": b{TOKENS} adds TOKENS to the left of (before) the template @@ -892,7 +892,7 @@ \let\m_tabl_table_vrule_color\empty \let\m_tabl_table_hrule_color\empty -\def\do!ttInsertVrule +\def\tabl_table_insert_vrule {\vrule\s!width \ifnum\!tgCode=\plusone \ifempty\!tgValue @@ -916,10 +916,10 @@ \switchtocolor[\m_tabl_table_vrule_color]% \fi \ifcase\c_tabl_table_n_of_vrules\or - \do!ttInsertVrule + \tabl_table_insert_vrule \unskip \else - \dorecurse\c_tabl_table_n_of_vrules\do!ttInsertVrule + \dorecurse\c_tabl_table_n_of_vrules\tabl_table_insert_vrule \global\c_tabl_table_n_of_vrules\plusone \unskip \fi diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl index 64a865a2a..cabe3babf 100644 --- a/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/tex/context/base/mkxl/tabl-tbl.mkxl @@ -265,7 +265,7 @@ \global\advance\c_tabl_tabulate_nofrealrows\plusone \to \t_tabl_tabulate_every_real_row -\def\b_tabl_tabulate_current#1% +\permanent\def\b_tabl_tabulate_current#1% {\csname\??tabulatebox\number#1\endcsname} % beware, a synonym \def\tabl_tabulate_initialize_boxes#1% @@ -1550,7 +1550,7 @@ \expandafter\ignorespaces % interferes with the more tricky hooks \fi} -\protected\def\setquicktabulate#1% see \startlegend \startgiven (for the moment still public) +\protected\def\tabl_tabulate_set_quick#1% see \startlegend \startgiven (for the moment still public) {\enforced\let#1\tabl_tabulate_column_inject_auto \enforced\let\\\tabl_tabulate_column_inject_auto} % brrr, will go @@ -1658,7 +1658,6 @@ {\begingroup \clf_enablebackgroundalign % was \node_backgrounds_align_initialize \glet\tabl_tabulate_color_repeat\tabl_tabulate_color_repeat_second - \global\settrue\c_tabl_tabulate_has_colors \ifnum\c_tabl_tabulate_column>\c_tabl_tabulate_max_colorcolumn \global\c_tabl_tabulate_max_colorcolumn\c_tabl_tabulate_column \fi @@ -2174,8 +2173,8 @@ \s_tabl_tabulate_last\s_tabl_tabulate_first \s_tabl_tabulate_pre\zeropoint \s_tabl_tabulate_post\zeropoint - %setfalse\s_tabl_pre_is_set - \setfalse\s_tabl_post_is_set + %setfalse\c_tabl_pre_is_set + \setfalse\c_tabl_post_is_set \global\c_tabl_tabulate_columns\zerocount \global\c_tabl_tabulate_nofauto\zerocount \global\c_tabl_tabulate_noflines\zerocount @@ -2535,7 +2534,7 @@ \setuptabulate [\v!legend] - [\c!unit=.75em,\c!inner=\setquicktabulate\leg,EQ={=}] + [\c!unit=.75em,\c!inner=\tabl_tabulate_set_quick\leg,EQ={=}] \definetabulate [\v!legend][\v!two] @@ -2547,7 +2546,7 @@ \setuptabulate [\v!fact] - [\c!unit=.75em,\c!inner=\setquicktabulate\fact,EQ={=}] + [\c!unit=.75em,\c!inner=\tabl_tabulate_set_quick\fact,EQ={=}] %D Another example: %D diff --git a/tex/context/base/mkxl/trac-tex.mkxl b/tex/context/base/mkxl/trac-tex.mkxl index f9c763c4f..13c1a047f 100644 --- a/tex/context/base/mkxl/trac-tex.mkxl +++ b/tex/context/base/mkxl/trac-tex.mkxl @@ -35,9 +35,10 @@ \def\syst_textracers_enable #1{\begincsname enabletracer#1\endcsname} \def\syst_textracers_disable#1{\begincsname disabletracer#1\endcsname} -% The next one is for Taco, although we can use directives as well: +%D The next one is for Taco, although we can use directives as well which is the +%D preferred way! -\protected\def\nomkivstatistics{\enabledirectives[system.nostatistics]} +\permanent\protected\def\nomkivstatistics{\enabledirectives[system.nostatistics]} %D This is not really a tracker but for decades it lived in my \type {cont-loc} %D file. I moved it here because I wanted someone else to use it. This macro is not diff --git a/tex/context/base/mkxl/typo-cap.mkxl b/tex/context/base/mkxl/typo-cap.mkxl index 86f3647dc..bab69e130 100644 --- a/tex/context/base/mkxl/typo-cap.mkxl +++ b/tex/context/base/mkxl/typo-cap.mkxl @@ -213,7 +213,8 @@ \enforced\let\cap\autocap \to \everydump -\aliased\let\kap\cap % for old times sake +\ifdefined\kap\else \aliased\let\kap\cap \fi % for old times sake + \aliased\let\Caps\SmallCapped % for old times sake \aliased\let\mixedcaps\pseudoMixedCapped diff --git a/tex/context/base/mkxl/typo-del.mkxl b/tex/context/base/mkxl/typo-del.mkxl index ad0c93fa0..2a7dc27da 100644 --- a/tex/context/base/mkxl/typo-del.mkxl +++ b/tex/context/base/mkxl/typo-del.mkxl @@ -288,13 +288,13 @@ \newsignal\d_typo_delimited_signal -\let\currentdelimitedtext\s!unknown +\mutable\let\currentdelimitedtext\s!unknown \installglobalmacrostack\currentdelimitedtext -\let\delimitedtextlevel\!!zerocount +\mutable\let\delimitedtextlevel\!!zerocount -\def\c_typo_delimited_nesting{\csname\??delimitedtextlevel\currentparentdelimitedtext\endcsname} +\permanent\def\c_typo_delimited_nesting{\csname\??delimitedtextlevel\currentparentdelimitedtext\endcsname} % the \setlanguageparameter macro sets but we are ungrouped .. only used here % diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl index f9d7c5fb8..2bee53bc8 100644 --- a/tex/context/modules/mkiv/s-system-macros.mkxl +++ b/tex/context/modules/mkiv/s-system-macros.mkxl @@ -30,6 +30,7 @@ \enablemode[texmacros] % \enablemode[metapostmacros] \enablemode[notmarked] +% \enablemode[everything] \startmodule[system-macros] @@ -101,12 +102,13 @@ require("mtx-interface") - local data = scripts.interface.editor("data") - local files = data and data.common and data.common.filenames or { } - local flagged = 0 - local total = 0 - local list = tex.hashtokens() - local all = not tex.modes.notmarked + local data = scripts.interface.editor("data") + local files = data and data.common and data.common.filenames or { } + local flagged = 0 + local total = 0 + local list = tex.hashtokens() + local all = not tex.modes.notmarked + local everything = tex.modes.everything table.sort(list) @@ -128,7 +130,7 @@ local cscommand = gsub(v.cmdname or "","_"," ") local undefined = cscommand == "undefined cs" local marked = (dealtwith and "+") or (whatever and "-") or (instance and "!") - if (all or not marked) and not find(k,"^[pvm]_") and not find(k,"^![tT]") then + if everything or ((all or not marked) and not find(k,"^[pvm]_") and not find(k,"^![tT]")) then local parameters = v.parameters local noaligned = v.noaligned and "noaligned" local filename = files[k] @@ -229,6 +231,7 @@ local types = metapost.types local parameters = metapost.knownparameters local procodes = mplib.propertycodes + local everything = tex.modes.everything context.startcolumns { n = 5, distance = "1em" } context.nohyphens(false) @@ -259,7 +262,7 @@ elseif property == "mutable" then context.bf(false) context.lightmagenta(false) - elseif not find(name,"^%a+_") then + elseif everything or not find(name,"^%a+_") then -- todo: if vardef then context.bf(false) -- cgit v1.2.3