diff options
Diffstat (limited to 'tex')
48 files changed, 2437 insertions, 1569 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 29fff3fc5..6175e3b1f 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{2019.04.16 08:54} +\newcontextversion{2019.04.25 10:36} %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 2d0c17f50..a3ee5ac4a 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{2019.04.16 08:54} +\edef\contextversion{2019.04.25 10:36} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii index fe883d50f..b551d9c71 100644 --- a/tex/context/base/mkii/mult-fr.mkii +++ b/tex/context/base/mkii/mult-fr.mkii @@ -587,6 +587,7 @@ \setinterfacevariable{understrike}{understrike} \setinterfacevariable{understrikes}{understrikes} \setinterfacevariable{unframed}{unframed} +\setinterfacevariable{unicode}{unicode} \setinterfacevariable{unit}{unite} \setinterfacevariable{units}{unites} \setinterfacevariable{unknown}{inconnu} diff --git a/tex/context/base/mkiv/back-lpd.lua b/tex/context/base/mkiv/back-lpd.lua index 48053e72b..1bb4ab846 100644 --- a/tex/context/base/mkiv/back-lpd.lua +++ b/tex/context/base/mkiv/back-lpd.lua @@ -175,8 +175,7 @@ local pdfcharacters local horizontalmode = true ----- widefontmode = true local scalefactor = 1 -local minthreshold = -65536 * 5 -local maxthreshold = 65536 * 5 +local threshold = 655360 / (10 * 5) -- default is 5 local tjfactor = 100 / 65536 lpdf.usedcharacters = usedcharacters @@ -191,8 +190,7 @@ local function updatefontstate(font) horizontalmode = fontparameters.writingmode ~= "vertical" -- widefontmode = fontproperties.encodingbytes == 2 scalefactor = (designsize/size) * tjfactor - maxthreshold = designsize - minthreshold = - maxthreshold + threshold = designsize / (10 * (fontproperties.threshold or 5)) end -- helpers @@ -480,7 +478,7 @@ local flushcharacter do cur_tmrx = tmrx end - -- local f_skip = formatters["%i"] + local f_skip = formatters["%.1f"] -- local f_octal = formatters["\\%o"] -- local f_char = formatters["%c"] local f_hex = formatters["%04X"] @@ -506,13 +504,13 @@ local flushcharacter do if horizontalmode then if (saved_text_pos_v + tmty) ~= pdf_v then need_tm = true - elseif tj_delta >= maxthreshold or tj_delta <= minthreshold then + elseif tj_delta >= threshold or tj_delta <= -threshold then need_tm = true end else if (saved_text_pos_h + tmtx) ~= pdf_h then need_tm = true - elseif tj_delta >= maxthreshold or tj_delta <= minthreshold then + elseif tj_delta >= threshold or tj_delta <= -threshold then need_tm = true end end @@ -527,7 +525,7 @@ local flushcharacter do -- local d = round(tj_delta * scalefactor) -- if d ~= 0 then local d = tj_delta * scalefactor - if d <= -0.5 or d >= 0.5 then + if d <= -0.5 or d >= 0.5 then if mode == "char" then end_charmode() end @@ -535,6 +533,12 @@ local flushcharacter do -- b = b + 1 ; buffer[b] = d b = b + 1 ; buffer[b] = round(d) end +-- if d <= -0.25 or d >= 0.25 then +-- if mode == "char" then +-- end_charmode() +-- end +-- b = b + 1 ; buffer[b] = f_skip(d) +-- end cw = cw - tj_delta end end diff --git a/tex/context/base/mkiv/back-out.lua b/tex/context/base/mkiv/back-out.lua index 86a1669a0..176a71f78 100644 --- a/tex/context/base/mkiv/back-out.lua +++ b/tex/context/base/mkiv/back-out.lua @@ -22,7 +22,7 @@ local scaninteger = token.scan_int local scanstring = token.scan_string local scankeyword = token.scan_keyword local scantokenlist = token.scan_tokenlist -local scancode = token.scan_code +----- scancode = token.scan_code local tokentostring = token.to_string diff --git a/tex/context/base/mkiv/bibl-tra.lua b/tex/context/base/mkiv/bibl-tra.lua index 76171cb7f..d6fb7c6c7 100644 --- a/tex/context/base/mkiv/bibl-tra.lua +++ b/tex/context/base/mkiv/bibl-tra.lua @@ -68,7 +68,7 @@ local runners = { name = "bibtex", method = "execute", program = "bibtex", - template = [["%filename%"]], + template = "%filename%", checkers = { filename = "readable", } @@ -77,7 +77,7 @@ local runners = { name = "mlbibtex", method = "execute", program = "mlbibcontext", - template = [["%filename%"]], + template = "%filename%", checkers = { filename = "readable", } diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua index ecb5d9dd0..08cb03b9e 100644 --- a/tex/context/base/mkiv/buff-ini.lua +++ b/tex/context/base/mkiv/buff-ini.lua @@ -512,7 +512,7 @@ local runner = sandbox.registerrunner { name = "run buffer", program = "context", method = "execute", - template = "--purgeall " .. (jit and "--jit" or "") .. " %filename%", + template = jit and "--purgeall --jit %filename%" or "--purgeall %filename%", reporter = report_typeset, checkers = { filename = "readable", diff --git a/tex/context/base/mkiv/buff-ver.mkiv b/tex/context/base/mkiv/buff-ver.mkiv index efa179d3b..e6c88cdb7 100644 --- a/tex/context/base/mkiv/buff-ver.mkiv +++ b/tex/context/base/mkiv/buff-ver.mkiv @@ -286,10 +286,6 @@ {\setupcurrenttype[#1]% \buff_verbatim_type_nop} -\def\buff_verbatim_type_nop - {\buff_verbatim_left_of_type - \futurelet\next\buff_verbatim_type_one} - \def\buff_verbatim_typ#1% {\dontleavehmode \bgroup @@ -298,17 +294,38 @@ \let\specialobeyedspace\specialstretchedspace \doifelsenextoptionalcs\buff_verbatim_type_yes\buff_verbatim_type_nop} -\def\buff_verbatim_type_one - {\ifx\next\bgroup - \expandafter\buff_verbatim_type_a - \else - \expandafter\buff_verbatim_type_two - \fi} +\startmkivmode + + \def\buff_verbatim_type_nop + {\buff_verbatim_left_of_type + \futurelet\next\buff_verbatim_type_one} + + \def\buff_verbatim_type_one + {\ifx\next\bgroup + \expandafter\buff_verbatim_type_a + \else + \expandafter\buff_verbatim_type_two + \fi} + + \def\buff_verbatim_type_two + {\catcode`<=\othercatcode % old precaution + \catcode`>=\othercatcode % old precaution + \futurelet\next\buff_verbatim_type_three} + +\stopmkivmode + +\startlmtxmode + + \def\buff_verbatim_type_nop + {\buff_verbatim_left_of_type + \futureexpand\bgroup\buff_verbatim_type_a\buff_verbatim_type_one} + + \def\buff_verbatim_type_one + {\catcode`<=\othercatcode % old precaution + \catcode`>=\othercatcode % old precaution + \futureexpandis<\buff_verbatim_type_b\buff_verbatim_type_c} -\def\buff_verbatim_type_two - {\catcode`<=\othercatcode % old precaution - \catcode`>=\othercatcode % old precaution - \futurelet\next\buff_verbatim_type_three} +\stoplmtxmode \def\buff_verbatim_type_three {\if\next<% @@ -473,18 +490,32 @@ \let\beginofverbatimlines\relax % hooks \let\endofverbatimlines \relax % hooks -\unexpanded\def\buff_verbatim_typing_start#1% tricky non standard lookahead - {\begingroup - \edef\currenttyping{#1}% - \obeylines - \futurelet\nexttoken\buff_verbatim_typing_start_indeed} +\startmkivmode -\def\buff_verbatim_typing_start_indeed - {\ifx\nexttoken[% - \expandafter\buff_verbatim_typing_start_yes - \else - \expandafter\buff_verbatim_typing_start_nop - \fi} + \unexpanded\def\buff_verbatim_typing_start#1% tricky non standard lookahead + {\begingroup + \edef\currenttyping{#1}% + \obeylines + \futurelet\nexttoken\buff_verbatim_typing_start_indeed} + + \def\buff_verbatim_typing_start_indeed + {\ifx\nexttoken[% + \expandafter\buff_verbatim_typing_start_yes + \else + \expandafter\buff_verbatim_typing_start_nop + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\buff_verbatim_typing_start#1% tricky non standard lookahead + {\begingroup + \edef\currenttyping{#1}% + \obeylines + \futureexpandis[\buff_verbatim_typing_start_yes\buff_verbatim_typing_start_nop} + +\stoplmtxmode \unexpanded\def\buff_verbatim_setup_keep_together {\edef\p_keeptogether{\typingparameter\c!keeptogether}% diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index 463ece151..0778ced4e 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -124,8 +124,8 @@ local scannerdefmode = true local maxflushnodeindex = 0x10FFFF - 1 -- tokenflushmode = false --- scannerdefmode = false -- nodeflushmode = false +-- scannerdefmode = false -- In earlier experiments a function tables was referred to as lua.calls and the -- primitive \luafunctions was \luacall and we used our own implementation of @@ -792,11 +792,11 @@ local function writer(parent,command,...) -- already optimized before call if type(tj) == "function" then tj = storefunction(tj) if tokenflushmode then - if newtoken then + -- if newtoken then flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_token_code),"]") - else - flush(currentcatcodes,"[",t_cldl_luafunction,tj,"]") - end + -- else + -- flush(currentcatcodes,"[",t_cldl_luafunction,tj,"]") + -- end else flush(currentcatcodes,s_cldl_option_b,tj,s_cldl_option_e) end @@ -810,11 +810,11 @@ local function writer(parent,command,...) -- already optimized before call if type(tj) == "function" then tj = storefunction(tj) if tokenflushmode then - if newtoken then + -- if newtoken then flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_token_code),j == tn and "]" or ",") - else - flush(currentcatcodes,"[",t_cldl_luafunction,tj,j == tn and "]" or ",") - end + -- else + -- flush(currentcatcodes,"[",t_cldl_luafunction,tj,j == tn and "]" or ",") + -- end else flush(currentcatcodes,s_cldl_option_s,tj,j == tn and "]" or ",") end @@ -831,11 +831,11 @@ local function writer(parent,command,...) -- already optimized before call -- todo: ctx|prt|texcatcodes ti = storefunction(ti) if tokenflushmode then - if newtoken then + -- if newtoken then flush(currentcatcodes,"{",newtoken(ti,lua_expandable_call_token_code),"}") - else - flush(currentcatcodes,"{",t_cldl_luafunction,ti,"}") - end + -- else + -- flush(currentcatcodes,"{",t_cldl_luafunction,ti,"}") + -- end else flush(currentcatcodes,s_cldl_argument_f,ti,s_cldl_argument_e) end @@ -1060,11 +1060,11 @@ local caller = function(parent,f,a,...) -- ignored: a ... f = storefunction(f) if tokenflushmode then - if newtoken then + -- if newtoken then flush(currentcatcodes,"{",newtoken(f,lua_expandable_call_token_code),"}") - else - flush(currentcatcodes,"{",t_cldl_luafunction,f,"}") - end + -- else + -- flush(currentcatcodes,"{",t_cldl_luafunction,f,"}") + -- end else flush(currentcatcodes,s_cldl_argument_b,f,s_cldl_argument_e) -- todo: ctx|prt|texcatcodes end diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index e200e6bbd..485de7771 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.04.16 08:54} +\newcontextversion{2019.04.25 10:36} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index ccd549ec9..8b9d4d7b7 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.04.16 08:54} +\edef\contextversion{2019.04.25 10:36} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/core-env.mkiv b/tex/context/base/mkiv/core-env.mkiv index 758ee126d..605a92486 100644 --- a/tex/context/base/mkiv/core-env.mkiv +++ b/tex/context/base/mkiv/core-env.mkiv @@ -129,9 +129,13 @@ \unexpanded\def\globalenablemode {\let\syst_mode_prefix\global\unprotect\syst_modes_enable } \unexpanded\def\globaldisablemode{\let\syst_mode_prefix\global\unprotect\syst_modes_disable} -\def\syst_modes_prevent[#1]{\protect\rawprocesscommacommand[#1]\syst_modes_prevent_indeed\let\syst_mode_prefix\relax} -\def\syst_modes_enable [#1]{\protect\rawprocesscommacommand[#1]\syst_modes_enable_indeed \let\syst_mode_prefix\relax} -\def\syst_modes_disable[#1]{\protect\rawprocesscommacommand[#1]\syst_modes_disable_indeed\let\syst_mode_prefix\relax} +% \def\syst_modes_prevent[#1]{\protect\rawprocesscommacommand[#1]\syst_modes_prevent_indeed\let\syst_mode_prefix\relax} +% \def\syst_modes_enable [#1]{\protect\rawprocesscommacommand[#1]\syst_modes_enable_indeed \let\syst_mode_prefix\relax} +% \def\syst_modes_disable[#1]{\protect\rawprocesscommacommand[#1]\syst_modes_disable_indeed\let\syst_mode_prefix\relax} + +\def\syst_modes_prevent[#1]{\protect\fastprocesscommacommand[#1]\syst_modes_prevent_indeed\let\syst_mode_prefix\relax} +\def\syst_modes_enable [#1]{\protect\fastprocesscommacommand[#1]\syst_modes_enable_indeed \let\syst_mode_prefix\relax} +\def\syst_modes_disable[#1]{\protect\fastprocesscommacommand[#1]\syst_modes_disable_indeed\let\syst_mode_prefix\relax} \def\syst_modes_prevent_indeed#1% {\ifcsname\??mode#1\endcsname\else\syst_modes_new{#1}\fi @@ -174,7 +178,8 @@ \def\syst_modes_define[#1][#2]% {\protect \edef\m_modes_asked{#2}% - \rawprocesscommacommand[#1]\syst_modes_define_indeed} + % \rawprocesscommacommand[#1]\syst_modes_define_indeed} + \fastprocesscommacommand[#1]\syst_modes_define_indeed} % \def\syst_modes_define_indeed#1% % {\ifcsname\??mode#1\endcsname @@ -230,7 +235,8 @@ \def\syst_modes_check_nop#1#2#3% {\let\syst_modes_check_step\syst_modes_check_indeed - \rawprocesscommacommand[#3]\syst_modes_check_step + % \rawprocesscommacommand[#3]\syst_modes_check_step + \fastprocesscommacommand[#3]\syst_modes_check_step \ifx\syst_modes_check_step\gobbleoneargument \expandafter#1% \else @@ -277,7 +283,8 @@ \def\syst_modes_check_all_lr#1#2#3% {\let\syst_modes_check_all_step\syst_modes_check_all_indeed - \rawprocesscommacommand[#3]\syst_modes_check_all_step + % \rawprocesscommacommand[#3]\syst_modes_check_all_step + \fastprocesscommacommand[#3]\syst_modes_check_all_step \ifx\syst_modes_check_all_step\gobbleoneargument \expandafter#2% \else @@ -286,7 +293,8 @@ \def\syst_modes_check_all_ss#1#2[#3]% {\let\syst_modes_check_all_step\syst_modes_check_all_indeed - \rawprocesscommacommand[#3]\syst_modes_check_all_step + % \rawprocesscommacommand[#3]\syst_modes_check_all_step + \fastprocesscommacommand[#3]\syst_modes_check_all_step \ifx\syst_modes_check_all_step\gobbleoneargument \expandafter#2% \else diff --git a/tex/context/base/mkiv/driv-shp.lua b/tex/context/base/mkiv/driv-shp.lua index 5fcfc7955..bc8073233 100644 --- a/tex/context/base/mkiv/driv-shp.lua +++ b/tex/context/base/mkiv/driv-shp.lua @@ -321,10 +321,12 @@ flush_character = function(current,font,char,factor,vfcommands,pos_h,pos_v,pos_r local data = fontcharacters[char] if not data then - if not onetimemessage then - onetimemessage = fonts.loggers.onetimemessage + if char > 0 then + if not onetimemessage then + onetimemessage = fonts.loggers.onetimemessage + end + onetimemessage(font,char,"missing") end - onetimemessage(font,char,"missing") return 0, 0, 0 end diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index 93ce9f5da..9def52ef0 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -595,7 +595,6 @@ function constructors.scale(tfmdata,specification) targetparameters.descender = delta * descender end -- --- inspect(targetparameters) constructors.enhanceparameters(targetparameters) -- official copies for us, now virtual -- local protrusionfactor = (targetquad ~= 0 and 1000/targetquad) or 0 @@ -1027,11 +1026,11 @@ function constructors.finalize(tfmdata) properties.virtualized = tfmdata.type == "virtual" end -- - properties.fontname = tfmdata.fontname - properties.filename = tfmdata.filename - properties.fullname = tfmdata.fullname - properties.name = tfmdata.name - properties.psname = tfmdata.psname + properties.fontname = properties.fontname or tfmdata.fontname + properties.filename = properties.filename or tfmdata.filename + properties.fullname = properties.fullname or tfmdata.fullname + properties.name = properties.name or tfmdata.name + properties.psname = properties.psname or tfmdata.psname -- properties.encodingbytes = tfmdata.encodingbytes or 1 properties.embedding = tfmdata.embedding or "subset" diff --git a/tex/context/base/mkiv/font-imp-quality.lua b/tex/context/base/mkiv/font-imp-quality.lua index 01f0afe63..56e91df99 100644 --- a/tex/context/base/mkiv/font-imp-quality.lua +++ b/tex/context/base/mkiv/font-imp-quality.lua @@ -153,15 +153,11 @@ registerafmfeature(specification) fonts.goodies.register("expansions", function(...) return fonts.goodies.report("expansions", trace_expansion, ...) end) -if context then - - implement { - name = "setupfontexpansion", - arguments = "2 strings", - actions = function(class,settings) getparameters(classes,class,'preset',settings) end - } - -end +implement { + name = "setupfontexpansion", + arguments = "2 strings", + actions = function(class,settings) getparameters(classes,class,'preset',settings) end +} -- -- -- -- -- -- -- protrusion @@ -516,12 +512,35 @@ registerafmfeature(specification) fonts.goodies.register("protrusions", function(...) return fonts.goodies.report("protrusions", trace_protrusion, ...) end) -if context then +implement { + name = "setupfontprotrusion", + arguments = "2 strings", + actions = function(class,settings) getparameters(classes,class,'preset',settings) end +} + +local function initialize(tfmdata,value) + local properties = tfmdata.properties + if properties then + value = tonumber(value) + if value then + if value < 5 then + value = 5 + elseif value > 100 then + value = 100 + end + end + properties.threshold = value or nil -- nil enforces default + end +end - implement { - name = "setupfontprotrusion", - arguments = "2 strings", - actions = function(class,settings) getparameters(classes,class,'preset',settings) end +local specification = { + name = "threshold", + description = "threshold for quality features", + initializers = { + base = initialize, + node = initialize, } +} -end +registerotffeature(specification) +registerafmfeature(specification) diff --git a/tex/context/base/mkiv/font-one.lua b/tex/context/base/mkiv/font-one.lua index 9b296cac5..5387516b4 100644 --- a/tex/context/base/mkiv/font-one.lua +++ b/tex/context/base/mkiv/font-one.lua @@ -483,8 +483,9 @@ local function copytotfm(data) local filename = constructors.checkedfilename(resources) local fontname = metadata.fontname or metadata.fullname local fullname = metadata.fullname or metadata.fontname - local endash = 0x0020 -- space + local endash = 0x2013 local emdash = 0x2014 + local space = 0x0020 -- space local spacer = "space" local spaceunits = 500 -- @@ -496,28 +497,33 @@ local function copytotfm(data) parameters.italicangle = italicangle parameters.charwidth = charwidth parameters.charxheight = charxheight - -- same as otf + -- nearly the same as otf, catches + local d_endash = descriptions[endash] + local d_emdash = descriptions[emdash] + local d_space = descriptions[space] + if not d_space or d_space == 0 then + d_space = d_endash + end + if d_space then + spaceunits, spacer = d_space.width or 0, "space" + end if properties.monospaced then - if descriptions[endash] then - spaceunits, spacer = descriptions[endash].width, "space" - end - if not spaceunits and descriptions[emdash] then - spaceunits, spacer = descriptions[emdash].width, "emdash" - end - if not spaceunits and charwidth then - spaceunits, spacer = charwidth, "charwidth" + if spaceunits == 0 and d_emdash then + spaceunits, spacer = d_emdash.width or 0, "emdash" end else - if descriptions[endash] then - spaceunits, spacer = descriptions[endash].width, "space" - end - if not spaceunits and charwidth then - spaceunits, spacer = charwidth, "charwidth" + if spaceunits == 0 and d_endash then + spaceunits, spacer = d_emdash.width or 0, "endash" end end - spaceunits = tonumber(spaceunits) - if spaceunits < 200 then - -- todo: warning + if spaceunits == 0 and charwidth then + spaceunits, spacer = charwidth or 0, "charwidth" + end + if spaceunits == 0 then + spaceunits = tonumber(spaceunits) or 500 + end + if spaceunits == 0 then + spaceunits = 500 end -- parameters.slant = 0 diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua index b7986f7a2..e14146c36 100644 --- a/tex/context/base/mkiv/font-shp.lua +++ b/tex/context/base/mkiv/font-shp.lua @@ -351,7 +351,7 @@ end hashes.streams = table.setmetatableindex(function(t,k) local f = identifiers[k] if f then - return loadstreamdata(f,true) + return loadstreamdata(f) end end) diff --git a/tex/context/base/mkiv/font-tpk.lua b/tex/context/base/mkiv/font-tpk.lua index 8f4b00b56..4c3e7c42e 100644 --- a/tex/context/base/mkiv/font-tpk.lua +++ b/tex/context/base/mkiv/font-tpk.lua @@ -1277,6 +1277,9 @@ do data.characters = glyphs data.glyphs = nil data.size = size + -- we assume type1 for now ... maybe the format should be unknown + data.filename = tfmfile -- file.replacesuffix(tfmfile,"pfb") + data.format = "unknown" -- return data end diff --git a/tex/context/base/mkiv/grph-con.lua b/tex/context/base/mkiv/grph-con.lua index f106e1036..ab6651f97 100644 --- a/tex/context/base/mkiv/grph-con.lua +++ b/tex/context/base/mkiv/grph-con.lua @@ -68,9 +68,9 @@ do -- eps | ps -dPDFSETTINGS=/%presets% -dEPSCrop -dCompatibilityLevel=%level% - -sOutputFile="%newname%" + -sOutputFile=%newname% %colorspace% - "%oldname%" + %oldname% -c quit ]], checkers = { @@ -197,9 +197,9 @@ do -- svg name = "svg to something", program = "inkscape", template = longtostring [[ - "%oldname%" + %oldname% --export-dpi=%resolution% - --export-%format%="%newname%" + --export-%format%=%newname% ]], checkers = { oldname = "readable", @@ -324,7 +324,7 @@ do -- png | jpg | profiles local pngtocmykpdf = sandbox.registerrunner { name = "png to cmyk pdf", program = "gm", - template = [[convert -compress Zip -strip +profile "*" -profile "%rgbprofile%" -profile "%cmykprofile%" -sampling-factor 1x1 "%oldname%" "%newname%"]], + template = [[convert -compress Zip -strip +profile "*" -profile %rgbprofile% -profile %cmykprofile% -sampling-factor 1x1 %oldname% %newname%]], checkers = checkers, defaults = defaults, } @@ -332,7 +332,7 @@ do -- png | jpg | profiles local jpgtocmykpdf = sandbox.registerrunner { name = "jpg to cmyk pdf", program = "gm", - template = [[convert -compress JPEG -strip +profile "*" -profile "%rgbprofile%" -profile "%cmykprofile%" -sampling-factor 1x1 "%oldname%" "%newname%"]], + template = [[convert -compress JPEG -strip +profile "*" -profile %rgbprofile% -profile %cmykprofile% -sampling-factor 1x1 %oldname% %newname%]], checkers = checkers, defaults = defaults, } @@ -340,7 +340,7 @@ do -- png | jpg | profiles local pngtograypdf = sandbox.registerrunner { name = "png to gray pdf", program = "gm", - template = [[convert -colorspace gray -compress Zip -sampling-factor 1x1 "%oldname%" "%newname%"]], + template = [[convert -colorspace gray -compress Zip -sampling-factor 1x1 %oldname% %newname%]], checkers = checkers, defaults = defaults, } @@ -348,7 +348,7 @@ do -- png | jpg | profiles local jpgtograypdf = sandbox.registerrunner { name = "jpg to gray pdf", program = "gm", - template = [[convert -colorspace gray -compress Zip -sampling-factor 1x1 "%oldname%" "%newname%"]], + template = [[convert -colorspace gray -compress Zip -sampling-factor 1x1 %oldname% %newname%]], checkers = checkers, defaults = defaults, } @@ -401,7 +401,7 @@ do -- png | jpg | profiles local recolorpng = sandbox.registerrunner { name = "recolor png", program = "gm", - template = [[convert -recolor "%color%" "%oldname%" "%newname%"]], + template = [[convert -recolor %color% %oldname% %newname%]], checkers = checkers, defaults = defaults, } diff --git a/tex/context/base/mkiv/grph-fil.lua b/tex/context/base/mkiv/grph-fil.lua index 540356c46..155d4211b 100644 --- a/tex/context/base/mkiv/grph-fil.lua +++ b/tex/context/base/mkiv/grph-fil.lua @@ -45,7 +45,7 @@ job.register('job.files.collected', tobesaved, initializer) local runner = sandbox.registerrunner { name = "hashed context run", program = "context", - template = [[%options% "%filename%"]], + template = [[%options% %filename%]], checkers = { options = "string", filename = "readable", diff --git a/tex/context/base/mkiv/lpdf-emb.lua b/tex/context/base/mkiv/lpdf-emb.lua index 0f5d14cf1..744011341 100644 --- a/tex/context/base/mkiv/lpdf-emb.lua +++ b/tex/context/base/mkiv/lpdf-emb.lua @@ -1708,6 +1708,8 @@ function lpdf.flushfonts() end end + -- this is no not yet ok for tfm / type 1 + for hash, details in sortedhash(mainfonts) do if next(details.indices) then local filename = details.filename @@ -1729,8 +1731,8 @@ function lpdf.flushfonts() local format = properties.format local writer = mainwriters[format] if not writer then - -- at some point we should do this in the frontend but - -- luatex does it anyway then + -- This will move to the tpk module where we will also deal + -- with bitmaps then. local encoding, pfbfile, encfile = getmapentry(filename) if encoding and pfbfile then filename = pfbfile @@ -1770,6 +1772,46 @@ function lpdf.flushfonts() writer = mainwriters[format] end end + if not writer then + local pfbfile = file.replacesuffix(filename,"pfb") + if encoding and pfbfile then + filename = pfbfile + format = "type1" + -- + -- another (temp) hack + local size = details.fontdata.parameters.size + local factor = details.fontdata.parameters.factor + local descriptions = { } + local characters = details.fontdata.characters + -- + local names, _, _, metadata = fonts.constructors.handlers.pfb.loadvector(pfbfile) + local reverse = table.swapped(names) + local vector = encoding.vector + local indices = details.indices + local remapped = { } + local factor = number.dimenfactors.bp * size / 65536 + for k, v in next, indices do + local name = vector[k] + local index = reverse[name] or 0 + local width = factor * (characters[k].width or 0) + descriptions[k] = { + width = width, + index = index, + name = name, + } + remapped[index] = true + end + details.indices = remapped + -- + details.rawdata.descriptions = descriptions + details.filename = filename + details.rawdata.metadata = { } + -- + properties.filename = filename + properties.format = format + writer = mainwriters[format] + end + end if writer then if trace_fonts then report_fonts("using main writer %a",format) diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua index c8aa0423b..cec4c414a 100644 --- a/tex/context/base/mkiv/luat-cnf.lua +++ b/tex/context/base/mkiv/luat-cnf.lua @@ -32,6 +32,7 @@ texconfig.save_size = 100000 texconfig.stack_size = 10000 texconfig.function_size = 32768 texconfig.properties_size = 65536 +texconfig.fix_mem_init = 750000 local stub = [[ diff --git a/tex/context/base/mkiv/luat-cod.lua b/tex/context/base/mkiv/luat-cod.lua index 0658fca1e..b863bf9a4 100644 --- a/tex/context/base/mkiv/luat-cod.lua +++ b/tex/context/base/mkiv/luat-cod.lua @@ -32,6 +32,7 @@ texconfig.save_size = 100000 texconfig.stack_size = 10000 texconfig.function_size = 32768 texconfig.properties_size = 65536 +texconfig.fix_mem_init = 750000 -- registering bytecode chunks diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua index ae3edba56..6a9e3c2cc 100644 --- a/tex/context/base/mkiv/lxml-tex.lua +++ b/tex/context/base/mkiv/lxml-tex.lua @@ -92,7 +92,7 @@ local forceraw = false local p_texescape = patterns.texescape -local tokenizedcs = context.tokenizedcs +local tokenizedxmlw = context.tokenizedcs and context.tokenizedcs.xmlw directives.enable("xml.path.keeplastmatch") @@ -501,15 +501,14 @@ function lxml.checkindex(name) return root and root.index or 0 end -if tokenizedcs then +if tokenizedxmlw then function lxml.withindex(name,n,command) -- will change as name is always there now local i, p = lpegmatch(splitter,n) - local w = tokenizedcs.xmlw if p then - contextsprint(ctxcatcodes,w,"{",command,"}{",n,"}") + contextsprint(ctxcatcodes,tokenizedxmlw,"{",command,"}{",n,"}") else - contextsprint(ctxcatcodes,w,"{",command,"}{",name,"::",n,"}") + contextsprint(ctxcatcodes,tokenizedxmlw,"{",command,"}{",name,"::",n,"}") end end @@ -770,7 +769,7 @@ end) local tex_element -if tokenizedcs then +if tokenizedxmlw then tex_element = function(e,handlers) if setfilename then @@ -788,16 +787,15 @@ if tokenizedcs then local tc = type(command) if tc == "string" then local rootname, ix = e.name, e.ix - local w = tokenizedcs.xmlw if rootname then if not ix then addindex(rootname,false,true) ix = e.ix end - contextsprint(ctxcatcodes,w,"{",command,"}{",rootname,"::",ix,"}") + contextsprint(ctxcatcodes,tokenizedxmlw,"{",command,"}{",rootname,"::",ix,"}") else report_lxml("fatal error: no index for %a",command) - contextsprint(ctxcatcodes,w,"{",command,"}{",ix or 0,"}") + contextsprint(ctxcatcodes,tokenizedxmlw,"{",command,"}{",ix or 0,"}") end elseif tc == "function" then command(e) @@ -1488,11 +1486,10 @@ end local command -if tokenizedcs then +if tokenizedxmlw then command = function(collected,cmd,otherwise) local n = collected and #collected - local w = tokenizedcs.xmlw if n and n > 0 then local wildcard = find(cmd,"*",1,true) for c=1,n do -- maybe optimize for n=1 @@ -1506,13 +1503,13 @@ if tokenizedcs then if not ix or not name then report_lxml("no valid node index for element %a using command %s",name or "?",cmd) elseif wildcard then - contextsprint(ctxcatcodes,w,"{",(gsub(cmd,"%*",e.tg)),"}{",name,"::",ix,"}") + contextsprint(ctxcatcodes,tokenizedxmlw,"{",(gsub(cmd,"%*",e.tg)),"}{",name,"::",ix,"}") else - contextsprint(ctxcatcodes,w,"{",cmd,"}{",name,"::",ix,"}") + contextsprint(ctxcatcodes,tokenizedxmlw,"{",cmd,"}{",name,"::",ix,"}") end end elseif otherwise then - contextsprint(ctxcatcodes,w,"{",otherwise,"}{#1}") + contextsprint(ctxcatcodes,tokenizedxmlw,"{",otherwise,"}{#1}") end end @@ -2215,16 +2212,15 @@ function lxml.direct(id) end end -if tokenizedcs then +if tokenizedxmlw then function lxml.command(id,pattern,cmd) local i, p = getid(id,true) - local collected = xmlapplylpath(getid(i),pattern) + local collected = xmlapplylpath(getid(i),pattern) -- again getid? if collected then local nc = #collected if nc > 0 then local rootname = p or i.name - local w = tokenizedcs.xmlw for c=1,nc do local e = collected[c] local ix = e.ix @@ -2232,7 +2228,7 @@ if tokenizedcs then addindex(rootname,false,true) ix = e.ix end - contextsprint(ctxcatcodes,w,"{",cmd,"}{",rootname,"::",ix,"}") + contextsprint(ctxcatcodes,tokenizedxmlw,"{",cmd,"}{",rootname,"::",ix,"}") end end end @@ -2242,7 +2238,7 @@ else function lxml.command(id,pattern,cmd) local i, p = getid(id,true) - local collected = xmlapplylpath(getid(i),pattern) + local collected = xmlapplylpath(getid(i),pattern) -- again getid? if collected then local nc = #collected if nc > 0 then diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv index 592a3441c..4ca713bbc 100644 --- a/tex/context/base/mkiv/math-ali.mkiv +++ b/tex/context/base/mkiv/math-ali.mkiv @@ -42,7 +42,8 @@ \unexpanded\def\math_eqalign_distance {\relax \ifdim\d_math_eqalign_distance>\zeropoint - \hskip\d_math_eqalign_distance + % \hskip\d_math_eqalign_distance + \tabskip\d_math_eqalign_distance \fi \mathalignmentparameter\c!separator \relax} @@ -68,7 +69,7 @@ \def\math_build_eqalign {\scratchtoks\emptytoks - \d_math_eqalign_distance\mathalignmentparameter\c!distance + \d_math_eqalign_distance\mathalignmentparameter\c!distance\relax \scratchcounterone\mathalignmentparameter\c!m \scratchcountertwo\mathalignmentparameter\c!n \etoksapp\scratchtoks{\the\t_math_align_a}% @@ -1824,31 +1825,31 @@ \or \bgroup \hsize\displaywidth \fi - \ifcase\mathnumberstatus + \ifcase\mathnumberstatus + \strc_math_flush_box + \or % status 1 + \ifcase\c_strc_math_number_location \strc_math_flush_box - \or % status 1 - \ifcase\c_strc_math_number_location - \strc_math_flush_box - \or % number left - \ifzeropt\wd\b_strc_formulas_number - \strc_math_flush_number_no - \else - \strc_math_flush_number_left - \fi - \else % number right - \ifzeropt\wd\b_strc_formulas_number - \strc_math_flush_number_no - \else - \strc_math_flush_number_right - \fi + \or % number left + \ifzeropt\wd\b_strc_formulas_number + \strc_math_flush_number_no + \else + \strc_math_flush_number_left + \fi + \else % number right + \ifzeropt\wd\b_strc_formulas_number + \strc_math_flush_number_no + \else + \strc_math_flush_number_right \fi - \or % status 2 - \hskip\d_math_number_correction % probably no longer used - \strc_math_flush_box - \hss - \else - \strc_math_flush_box \fi + \or % status 2 + \hskip\d_math_number_correction % probably no longer used + \strc_math_flush_box + \hss + \else + \strc_math_flush_box + \fi \ifcase\c_strc_math_vertical \or \or diff --git a/tex/context/base/mkiv/meta-imp-tab.mkiv b/tex/context/base/mkiv/meta-imp-tab.mkiv index a4affbea4..2604c3aa4 100644 --- a/tex/context/base/mkiv/meta-imp-tab.mkiv +++ b/tex/context/base/mkiv/meta-imp-tab.mkiv @@ -34,7 +34,7 @@ \unexpanded\def\tallynumeral#1% {\dontleavehmode - \lower.25\exheight\hbox{\useMPgraphic{TallyBar}{n=#1}}} + \lower.25\exheight\hpack{\useMPgraphic{TallyBar}{n=#1}}} \unexpanded\def\tallynumerals#1% {\dontleavehmode @@ -42,11 +42,11 @@ \scratchcounter#1\relax \doloop {\ifnum\scratchcounter>\plusfive - \lower.25\exheight\hbox{\useMPgraphic{TallyBar}{n=5}}% + \lower.25\exheight\hpack{\useMPgraphic{TallyBar}{n=5}}% \advance\scratchcounter-\plusfive \space \else - \lower.25\exheight\hbox{\useMPgraphic{TallyBar}{n=\the\scratchcounter}}% + \lower.25\exheight\hpack{\useMPgraphic{TallyBar}{n=\the\scratchcounter}}% \exitloop \fi}% \endgroup} diff --git a/tex/context/base/mkiv/meta-imp-txt.mkiv b/tex/context/base/mkiv/meta-imp-txt.mkiv index d4329cd6f..e683c3766 100644 --- a/tex/context/base/mkiv/meta-imp-txt.mkiv +++ b/tex/context/base/mkiv/meta-imp-txt.mkiv @@ -58,7 +58,7 @@ \scratchcounter\zerocount \scratchtoks\emptytoks \def\docommand##1% - {\setbox\scratchbox\hbox{\useMPgraphic{##1}}% + {\setbox\scratchbox\hpack{\useMPgraphic{##1}}% \global\parfirst\zerocount \getMPdata \setshapecharacteristics @@ -389,7 +389,7 @@ %D \stoplinecorrection \unexpanded\def\TightText#1#2#3#4% - {\hbox % \ruledhbox + {\hpack {\startMPcode picture p ; p := image (graphictext "#1" withfillcolor red) ; draw p xsized #2 ysized #3 withcolor \MPcolor{#4} ; diff --git a/tex/context/base/mkiv/meta-ini.mkiv b/tex/context/base/mkiv/meta-ini.mkiv index 89c7699de..ef13affbb 100644 --- a/tex/context/base/mkiv/meta-ini.mkiv +++ b/tex/context/base/mkiv/meta-ini.mkiv @@ -574,17 +574,37 @@ \def\meta_prepare_variable_dimension {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\the\dimexpr\m_meta_current_variable}} -\def\meta_prepare_variable_yes - {\defconvertedcommand\ascii\m_meta_current_variable % otherwise problems - \doifelsecolor \ascii % with 2\bodyfontsize - {\meta_prepare_variable_color} - {\begingroup - \setbox\b_meta_variable_box\hpack{\scratchdimen\m_meta_current_variable sp}% - \ifzeropt\wd\b_meta_variable_box - \endgroup\meta_prepare_variable_number - \else - \endgroup\meta_prepare_variable_dimension - \fi}} + +\startmkivmode + + \def\meta_prepare_variable_yes + {\defconvertedcommand\ascii\m_meta_current_variable % otherwise problems + \doifelsecolor \ascii % with 2\bodyfontsize + {\meta_prepare_variable_color} + {\begingroup + \setbox\b_meta_variable_box\hpack{\scratchdimen\m_meta_current_variable sp}% + \ifzeropt\wd\b_meta_variable_box + \endgroup\meta_prepare_variable_number + \else + \endgroup\meta_prepare_variable_dimension + \fi}} + +\stopmkivmode + +\startlmtxmode + + \def\meta_prepare_variable_yes + {\ifdimen\m_meta_current_variable\or + \meta_prepare_variable_dimension + \else\ifnumber\m_meta_current_variable\or + \meta_prepare_variable_number + \else + \doifelsecolor\m_meta_current_variable + \meta_prepare_variable_color + \meta_prepare_variable_dimension + \fi\fi} + +\stoplmtxmode % \def\meta_prepare_variable_yes % {\expandafter\edef\csname\m_meta_current_variable_template\endcsname diff --git a/tex/context/base/mkiv/mult-ini.mkiv b/tex/context/base/mkiv/mult-ini.mkiv index 634e2c1d8..678d2e965 100644 --- a/tex/context/base/mkiv/mult-ini.mkiv +++ b/tex/context/base/mkiv/mult-ini.mkiv @@ -356,12 +356,12 @@ {\ifcsname\m!prefix!#1\endcsname\else\setgvalue{\m!prefix!#1}{#1}\fi \clf_setinterfacemessage{#1}{#2}{#3}} -\unexpanded\def\setmessagetext #1#2{\edef\currentmessagetext{\clf_getmessage{#1}{#2}}} -\unexpanded\def\getmessage #1#2{\clf_getmessage{#1}{#2}} -\unexpanded\def\doifelsemessage #1#2{\clf_doifelsemessage{#1}{#2}} -\unexpanded\def\showmessage #1#2#3{\clf_showmessage{#1}{#2}{#3}} -\unexpanded\def\writestatus #1#2{\clf_writestatus{#1}{#2}} -\unexpanded\def\message {\clf_message} +\unexpanded\def\setmessagetext #1#2{\relax\edef\currentmessagetext{\clf_getmessage{#1}{#2}}} +\unexpanded\def\getmessage #1#2{\relax\clf_getmessage{#1}{#2}} +\unexpanded\def\doifelsemessage #1#2{\relax\clf_doifelsemessage{#1}{#2}} +\unexpanded\def\showmessage #1#2#3{\relax\clf_showmessage{#1}{#2}{#3}} +\unexpanded\def\writestatus #1#2{\relax\clf_writestatus{#1}{#2}} +\unexpanded\def\message {\relax\clf_message} \let\doifmessageelse\doifelsemessage diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index b620eb721..422d47c30 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -263,6 +263,7 @@ return { "doifinset", "doifnotinset", "doifelseinset", "doifinsetelse", "doifelsenextchar", "doifnextcharelse", + "doifelsenextcharcs", "doifnextcharcselse", "doifelsenextoptional", "doifnextoptionalelse", "doifelsenextoptionalcs", "doifnextoptionalcselse", "doifelsefastoptionalcheck", "doiffastoptionalcheckelse", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 579750bc9..2770db21f 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -254,6 +254,8 @@ return { "fixupboxesmode", "fontid", "formatname", + "futureexpand", + "futureexpandis", "gleaders", "gtoksapp", "gtokspre", @@ -845,4 +847,4 @@ return { ["xetex"]={ "XeTeXversion", }, -}
\ No newline at end of file +} diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua index d6f5a34e4..ebccab04c 100644 --- a/tex/context/base/mkiv/node-nut.lua +++ b/tex/context/base/mkiv/node-nut.lua @@ -280,8 +280,8 @@ nuts.setshift = direct.setshift nuts.getorientation = direct.getorientation or function() end nuts.setorientation = direct.setorientation or function() end -nuts.getglyphdata = direct.getglyphdata or get_attribute -nuts.setglyphdata = direct.setglyphdata or set_attribute +nuts.getglyphdata = direct.getglyphdata or get_attribute +nuts.setglyphdata = direct.setglyphdata or function(n,d) set_attribute(n,0,d) end nuts.getruledata = direct.getglyphdata and getdata or function(n) return getfield(n,"transform") end nuts.setruledata = direct.setglyphdata and setdata or function(n,d) return setfield(n,"transform",d) end diff --git a/tex/context/base/mkiv/pack-rul.lua b/tex/context/base/mkiv/pack-rul.lua index 455d0bff8..ef8d8136f 100644 --- a/tex/context/base/mkiv/pack-rul.lua +++ b/tex/context/base/mkiv/pack-rul.lua @@ -123,6 +123,8 @@ local function doreshapeframedbox(n) for h, id, subtype, list in nextlist, list do if list and id == hlist_code then if subtype == boxlist_code or subtype == linelist_code then + -- getdirection is irrelevant here so it will go + -- somehow a parfillskip also can get influenced local p = hpack(list,maxwidth,'exactly',getdirection(h)) -- multiple return value local set, order, sign = getboxglue(p) setboxglue(h,set,order,sign) diff --git a/tex/context/base/mkiv/spac-par.mkiv b/tex/context/base/mkiv/spac-par.mkiv index 0932b7359..7678cc34b 100644 --- a/tex/context/base/mkiv/spac-par.mkiv +++ b/tex/context/base/mkiv/spac-par.mkiv @@ -218,7 +218,7 @@ {\begingroup \the\everyflushatnextpar \glet\flushpostponednodedata\spac_postponed_data_flush - \dowithnextboxcs\spac_postponed_data_finish\hbox} + \dowithnextboxcs\spac_postponed_data_finish\hpack} \def\spac_postponed_data_finish {\global\setbox\b_spac_postponed_data\hpack % to\zeropoint diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv index 3f1be18e5..647af3ff6 100644 --- a/tex/context/base/mkiv/spac-ver.mkiv +++ b/tex/context/base/mkiv/spac-ver.mkiv @@ -2151,13 +2151,38 @@ \installcorenamespace{vspacing} -\unexpanded\def\directvspacing#1% - {\par - \ifcsname\??vspacing#1\endcsname - \lastnamedcs - \else - \spac_vspacing_yes_preset{#1}% - \fi} +\startmkivmode + + \unexpanded\def\directvspacing#1% + {\par + \ifcsname\??vspacing#1\endcsname + \lastnamedcs + \else + \spac_vspacing_yes_preset{#1}% + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\directvspacing#1% + {\par + \ifdimen#1\or + \spac_vspacing_dim_preset{\the\dimexpr#1}% + \else\ifcsname\??vspacing#1\endcsname + \lastnamedcs + \else + \spac_vspacing_yes_preset{#1}% + \fi\fi} + + \def\spac_vspacing_dim_preset#1% + {\ifcsname\??vspacing#1\endcsname + \lastnamedcs + \else + \spac_vspacing_yes_preset{#1}% + \fi} + +\stoplmtxmode \def\spac_vspacing_yes_preset#1% {\setxvalue{\??vspacing#1}{\clf_vspacing{#1}}% diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 3fdae5c04..822213061 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 5d10829d8..8cd4fd845 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-ref.mkvi b/tex/context/base/mkiv/strc-ref.mkvi index c7f204815..05abd4930 100644 --- a/tex/context/base/mkiv/strc-ref.mkvi +++ b/tex/context/base/mkiv/strc-ref.mkvi @@ -1053,7 +1053,7 @@ \relax} \def\referencepagedetail - {\numexpr\clf_referencepagestate + {\numexpr\clf_referencepagedetail {rst::\number\nofreferencestates}% true % \ifconditional\pagestatespread false\ifdoublesided true\else false\fi\fi diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index f316511e8..80e11d68a 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -60,6 +60,22 @@ \let\unexpanded\normalprotected +\ifcase\contextlmtxmode + + \def\startlmtxmode#1\stoplmtxmode{} + \let\stoplmtxmode \relax + \let\startmkivmode\relax + \let\stopmkivmode \relax + +\else + + \let\startlmtxmode\relax + \let\stoplmtxmode \relax + \def\startmkivmode#1\stopmkivmode{} + \let\stopmkivmode \relax + +\fi + % %D \macros % %D {expunded} % %D @@ -273,9 +289,8 @@ %D \doifnextcharelse {karakter} {then ...} {else ...} %D \stoptyping %D -%D This macro differs from the original in the use of \type -%D {\localnext} because we don't want clashes with \type -%D {\next}. +%D This macro differs from the original in the use of \type {\localnext} because we +%D don't want clashes with \type {\next}. \let\next \relax \let\nextnext \relax @@ -286,14 +301,6 @@ \let\m_syst_action_yes\relax \let\m_syst_action_nop\relax -\unexpanded\def\doifelsenextchar#1#2#3% #1 should not be {} ! - {\let\charactertoken=#1% = needed here - \def\m_syst_action_yes{#2}% - \def\m_syst_action_nop{#3}% - \futurelet\nexttoken\syst_helpers_inspect_next_character} - -\let\doifnextcharelse\doifelsenextchar - \def\syst_helpers_inspect_next_character {\ifx\nexttoken\blankspace \expandafter\syst_helpers_reinspect_next_character @@ -308,14 +315,45 @@ \expandafter\m_syst_action_nop \fi} +\startmkivmode + + \unexpanded\def\doifelsenextchar#1#2#3% #1 should not be {} ! + {\let\charactertoken=#1% = needed here + \def\m_syst_action_yes{#2}% + \def\m_syst_action_nop{#3}% + \futurelet\nexttoken\syst_helpers_inspect_next_character} + + \unexpanded\def\doifelsenextcharcs#1#2#3% #1 should not be {} ! + {\let\charactertoken=#1% = needed here + \let\m_syst_action_yes#2% + \let\m_syst_action_nop#3% + \futurelet\nexttoken\syst_helpers_inspect_next_character} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doifelsenextchar#1#2#3% #1 should not be {} ! + {\def\m_syst_action_yes{#2}% + \def\m_syst_action_nop{#3}% + \futureexpandis#1\m_syst_action_yes\m_syst_action_nop} + + \unexpanded\def\doifelsenextcharcs % #1#2#3% #1 should not be {} ! + {\futureexpandis} + +\stoplmtxmode + +\let\doifnextcharelse \doifelsenextchar +\let\doifnextcharcselse\doifelsenextcharcs + %D Because we will mostly use this macro for testing if the next character is \type %D {[}, we also make a slightly faster variant as it is not uncommon to have tens of %D thousands of calls to this test in a run. Of course it also is more convenient to %D read a trace then. -% We could make variants without the \if_next_blank_space_token but the overhead is -% only .1 sec on 3.5 for 10^6 tests and often that branch is not entered anyway. The -% fast variants with less checking do make a difference however: +%D We could make variants without the \if_next_blank_space_token but the overhead is +%D only .1 sec on 3.5 for 10^6 tests and often that branch is not entered anyway. The +%D fast variants with less checking do make a difference however: % \testfeature{1000000}{\doifnextoptionalelse \gobbleoneargument\gobbleoneargument[} % 2.902s % \testfeature{1000000}{\doifnextoptionalcselse \gobbleoneargument\gobbleoneargument[} % 2.590s @@ -326,17 +364,47 @@ \let\syst_helpers_next_optional_character_token=[ -\unexpanded\def\doifelsenextoptional#1#2% - {\def\m_syst_action_yes{#1}% - \def\m_syst_action_nop{#2}% - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} +\def\syst_helpers_inspect_next_optional_character + {\ifx\nexttoken\blankspace + \expandafter\syst_helpers_reinspect_next_optional_character + \else + \expandafter\syst_helpers_inspect_next_optional_character_indeed + \fi} + +\def\syst_helpers_inspect_next_optional_character_indeed + {\ifx\nexttoken\syst_helpers_next_optional_character_token + \expandafter\m_syst_action_yes + \else + \expandafter\m_syst_action_nop + \fi} -\unexpanded\def\doifelsenextoptionalcs#1#2% \cs \cs (upto 10% faster) - {\let\m_syst_action_yes#1% - \let\m_syst_action_nop#2% - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} +\startmkivmode + + \unexpanded\def\doifelsenextoptional#1#2% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \unexpanded\def\doifelsenextoptionalcs#1#2% \cs \cs (upto 10% faster) + {\let\m_syst_action_yes#1% + \let\m_syst_action_nop#2% + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doifelsenextoptional#1#2% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \futureexpandis[\m_syst_action_yes\m_syst_action_nop} + + \unexpanded\def\doifelsenextoptionalcs + {\futureexpandis[} + +\stoplmtxmode \let\doifnextoptionalelse \doifelsenextoptional \let\doifnextoptionalcselse\doifelsenextoptionalcs @@ -353,37 +421,8 @@ % \def\doifelsenextoptionalcs_n_n{\let\if_next_blank_space_token\iffalse % \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} -\def\syst_helpers_inspect_next_optional_character - {\ifx\nexttoken\blankspace - \expandafter\syst_helpers_reinspect_next_optional_character - \else - \expandafter\syst_helpers_inspect_next_optional_character_indeed - \fi} - -\def\syst_helpers_inspect_next_optional_character_indeed - {\ifx\nexttoken\syst_helpers_next_optional_character_token - \expandafter\m_syst_action_yes - \else - \expandafter\m_syst_action_nop - \fi} - \let\syst_helpers_next_bgroup_character_token\bgroup -\unexpanded\def\doifelsenextbgroup#1#2% - {\def\m_syst_action_yes{#1}% - \def\m_syst_action_nop{#2}% - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character} - -\unexpanded\def\doifelsenextbgroupcs#1#2% - {\let\m_syst_action_yes#1% - \let\m_syst_action_nop#2% - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character} - -\let\doifnextbgroupelse \doifelsenextbgroup -\let\doifnextbgroupcselse\doifelsenextbgroupcs - \def\syst_helpers_inspect_next_bgroup_character {\ifx\nexttoken\blankspace \expandafter\syst_helpers_reinspect_next_bgroup_character @@ -398,15 +437,38 @@ \expandafter\m_syst_action_nop \fi} -\let\syst_helpers_next_parenthesis_character_token( +\startmkivmode -\unexpanded\def\doifelsenextparenthesis#1#2% - {\def\m_syst_action_yes{#1}% - \def\m_syst_action_nop{#2}% - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_parenthesis_character} + \unexpanded\def\doifelsenextbgroup#1#2% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character} -\let\doifnextparenthesiselse\doifelsenextparenthesis + \unexpanded\def\doifelsenextbgroupcs#1#2% + {\let\m_syst_action_yes#1% + \let\m_syst_action_nop#2% + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doifelsenextbgroup#1#2% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \futureexpandis\bgroup\m_syst_action_yes\m_syst_action_nop} + + \unexpanded\def\doifelsenextbgroupcs % #1#2 + {\futureexpandis\bgroup} + +\stoplmtxmode + +\let\doifnextbgroupelse \doifelsenextbgroup +\let\doifnextbgroupcselse\doifelsenextbgroupcs + +\let\syst_helpers_next_parenthesis_character_token( \def\syst_helpers_inspect_next_parenthesis_character {\ifx\nexttoken\blankspace @@ -422,20 +484,28 @@ \expandafter\m_syst_action_nop \fi} -%D The next one is handy in predictable situations: +\startmkivmode -\unexpanded\def\doifelsefastoptionalcheck#1#2% - {\def\m_syst_action_yes{#1}% - \def\m_syst_action_nop{#2}% - \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else} + \unexpanded\def\doifelsenextparenthesis#1#2% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_parenthesis_character} -\unexpanded\def\doifelsefastoptionalcheckcs#1#2% \cs \cs - {\let\m_syst_action_yes#1% - \let\m_syst_action_nop#2% - \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else} +\stopmkivmode -\let\doiffastoptionalcheckelse \doifelsefastoptionalcheck -\let\doiffastoptionalcheckcselse\doifelsefastoptionalcheckcs +\startlmtxmode + + \unexpanded\def\doifelsenextparenthesis#1#2% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \futureexpandis(\m_syst_action_yes\m_syst_action_nop} + +\stoplmtxmode + +\let\doifnextparenthesiselse\doifelsenextparenthesis + +%D The next one is handy in predictable situations: \def\syst_helpers_do_if_fast_optional_check_else {\ifx\nexttoken\syst_helpers_next_optional_character_token @@ -444,6 +514,35 @@ \expandafter\m_syst_action_nop \fi} +\startmkivmode + + \unexpanded\def\doifelsefastoptionalcheck#1#2% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else} + + \unexpanded\def\doifelsefastoptionalcheckcs#1#2% \cs \cs + {\let\m_syst_action_yes#1% + \let\m_syst_action_nop#2% + \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doifelsefastoptionalcheck#1#2% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \futureexpandis[\m_syst_action_yes\m_syst_action_nop} + + \unexpanded\def\doifelsefastoptionalcheckcs + {\futureexpandis[} + +\stoplmtxmode + +\let\doiffastoptionalcheckelse \doifelsefastoptionalcheck +\let\doiffastoptionalcheckcselse\doifelsefastoptionalcheckcs + %D Here's one for skipping spaces and pars, handy for: %D %D \starttyping @@ -499,26 +598,34 @@ %D \type {\def} comes into action. This way the space after \type {\:} becomes a %D delimiter of the longer named \type {\reinspectnextcharacter}. -\let\next\: +% \ifcase\contextlmtxmode + + \let\next\: + + \def\:{\let\blankspace= } \: -\def\:{\let\blankspace= } \: + \def\:{\syst_helpers_reinspect_next_character} + \expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_character} -\def\:{\syst_helpers_reinspect_next_character} -\expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_character} + \def\:{\syst_helpers_reinspect_next_optional_character} + \expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_optional_character} -\def\:{\syst_helpers_reinspect_next_optional_character} -\expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + \def\:{\syst_helpers_reinspect_next_bgroup_character} + \expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character} -\def\:{\syst_helpers_reinspect_next_bgroup_character} -\expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character} + \def\:{\syst_helpers_reinspect_next_parenthesis_character} + \expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_parenthesis_character} -\def\:{\syst_helpers_reinspect_next_parenthesis_character} -\expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_parenthesis_character} + \def\:{\syst_helpers_ignore_spacing_blankspace} + \expandafter\def\: {\futurelet\nexttoken\syst_helpers_ignore_spacing} -\def\:{\syst_helpers_ignore_spacing_blankspace} -\expandafter\def\: {\futurelet\nexttoken\syst_helpers_ignore_spacing} + \let\:\next -\let\:\next +% \else +% +% % nothing here +% +% \fi %D This is much nicer and works too: @@ -1099,22 +1206,31 @@ \def\syst_helpers_do_do_do_process_comma_item {\csname\??nextcommalevel\the\commalevel\endcsname} -\def\syst_helpers_do_do_process_comma_item - {\ifx\nexttoken\blankspace - \expandafter\syst_helpers_re_do_process_comma_item - \else - \expandafter\syst_helpers_do_do_process_comma_item_indeed - \fi} +% \ifcase\contextlmtxmode -\def\syst_helpers_do_do_process_comma_item_indeed - {\ifx\nexttoken]% - \expandafter\gobbleoneargument - \else - \expandafter\syst_helpers_do_do_do_process_comma_item - \fi} + \def\syst_helpers_do_process_comma_item + {\futurelet\nexttoken\syst_helpers_do_do_process_comma_item} + + \def\syst_helpers_do_do_process_comma_item + {\ifx\nexttoken\blankspace + \expandafter\syst_helpers_re_do_process_comma_item + \else + \expandafter\syst_helpers_do_do_process_comma_item_indeed + \fi} -\def\syst_helpers_do_process_comma_item - {\futurelet\nexttoken\syst_helpers_do_do_process_comma_item} + \def\syst_helpers_do_do_process_comma_item_indeed + {\ifx\nexttoken]% + \expandafter\gobbleoneargument + \else + \expandafter\syst_helpers_do_do_do_process_comma_item + \fi} + +% \else +% +% \def\syst_helpers_do_process_comma_item +% {\futureexpandis]\gobbleoneargument\syst_helpers_do_do_do_process_comma_item_indeed} +% +% \fi %D Empty arguments are not processed. Empty items (\type {,,}) however are %D treated. We have to check for the special case \type {[{a,b,c}]}. @@ -1163,13 +1279,17 @@ %D The hack we used for checking the next character \type {\doifnextcharelse} %D is also used here. -\let\next\: +% \ifcase\contextlmtxmode + + \let\next\: + + \def\:{\syst_helpers_re_do_process_comma_item} % \:not saved ? -\def\:{\syst_helpers_re_do_process_comma_item} % \:not saved ? + \expandafter\def\: {\futurelet\nexttoken\syst_helpers_do_do_process_comma_item} -\expandafter\def\: {\futurelet\nexttoken\syst_helpers_do_do_process_comma_item} + \let\:\next -\let\:\next +% \fi %D The previous examples lead to: %D @@ -1198,14 +1318,14 @@ %D \processcommacommand[\first,between,\second]\message %D \stoptyping %D -%D Commands that are part of the list are expanded, so the use of -%D this macro has its limits. +%D Commands that are part of the list are expanded, so the use of this macro has its +%D limits. \unexpanded\def\processcommacommand[#1]% {\normalexpanded{\processcommalist[#1]}} -%D The argument to \type{\command} is not delimited. Because we often -%D use \type{[]} as delimiters, we also have: +%D The argument to \type{\command} is not delimited. Because we often use \type {[]} +%D as delimiters, we also have: %D %D \starttyping %D \processcommalistwithparameters[string,string,...]\command @@ -1244,10 +1364,9 @@ %D processfirstactioninset, %D processallactionsinset} %D -%D \CONTEXT\ makes extensive use of a sort of case or switch -%D command. Depending of the presence of one or more provided -%D items, some actions is taken. These macros can be nested -%D without problems. +%D \CONTEXT\ makes extensive use of a sort of case or switch command. Depending of +%D the presence of one or more provided items, some actions is taken. These macros +%D can be nested without problems. %D %D \starttyping %D \processaction [x] [a=>\a,b=>\b,c=>\c] @@ -1268,16 +1387,14 @@ %D unknown=>\unknown{... \commalistelement ...}] %D \stoptyping %D -%D When \type{#1} is empty, this macro scans list \type{#2} for -%D the keyword \type{default} and executed the related action -%D if present. When \type{#1} is non empty and not in the list, -%D the action related to \type{unknown} is executed. Both -%D keywords must be at the end of list \type{#2}. Afterwards, -%D the actually found keyword is available in -%D \type{\commalistelement}. An advanced example of the use of -%D this macro can be found in \PPCHTEX, where we completely -%D rely on \TEX\ for interpreting user supplied keywords like -%D \type{SB}, \type{SB1..6}, \type{SB125} etc. +%D When \type {#1} is empty, this macro scans list \type {#2} for the keyword \type +%D {default} and executed the related action if present. When \type {#1} is non +%D empty and not in the list, the action related to \type {unknown} is executed. +%D Both keywords must be at the end of list \type{#2}. Afterwards, the actually +%D found keyword is available in \type {\commalistelement}. An advanced example of +%D the use of this macro can be found in \PPCHTEX, where we completely rely on \TEX\ +%D for interpreting user supplied keywords like \type {SB}, \type {SB1..6}, \type +%D {SB125} etc. \newcount\processlevel @@ -1395,17 +1512,15 @@ %D \macros %D {getfirstcharacter, firstcharacter, remainingcharacters, doiffirstcharacter} %D -%D Sometimes the action to be undertaken depends on the -%D next character. This macro get this character and puts it in -%D \type {\firstcharacter}. +%D Sometimes the action to be undertaken depends on the next character. This macro +%D get this character and puts it in \type {\firstcharacter}. %D %D \starttyping %D \getfirstcharacter {string} %D \stoptyping %D -%D A two step expansion is used to prevent problems with -%D complicated arguments, for instance arguments that -%D consist of two or more expandable tokens. +%D A two step expansion is used to prevent problems with complicated arguments, for +%D instance arguments that consist of two or more expandable tokens. \let\firstcharacter \empty \let\remainingcharacters\empty @@ -1420,8 +1535,7 @@ %D \macros %D {doifinstringelse, doifincsnameelse} %D -%D We can check for the presence of a substring in a given -%D sequence of characters. +%D We can check for the presence of a substring in a given sequence of characters. %D %D \starttyping %D \doifinsetelse {substring} {string} {then ...} {else ...} @@ -1483,18 +1597,16 @@ \expandafter##\expandafter1#1##2##3\_e_o_s_{\unless\if##2@}% expand #1 here \expandafter\syst_helpers_do_do_if_in_string_else\normalexpanded{#2#1}@@\_e_o_s_} % expand #2 here -%D The next alternative proved to be upto twice as fast on -%D tasks like checking reserved words in pretty verbatim -%D typesetting! This is mainly due to the fact that passing -%D (expanded) strings is much slower that passing a macro. +%D The next alternative proved to be upto twice as fast on tasks like checking +%D reserved words in pretty verbatim typesetting! This is mainly due to the fact +%D that passing (expanded) strings is much slower that passing a macro. %D %D \starttyping %D \doifincsnameelse {substring} {\string} {then ...} {else ...} %D \stoptyping %D -%D Where \type{\doifinstringelse} does as much expansion as -%D possible, the latter alternative does minimal (one level) -%D expansion. +%D Where \type {\doifinstringelse} does as much expansion as possible, the latter +%D alternative does minimal (one level) expansion. \unexpanded\def\syst_helpers_do_if_in_csname_else#1#2% {\def\syst_helpers_do_do_if_in_csname_else##1#1##2##3\_e_o_s_ @@ -1513,43 +1625,68 @@ %D \macros %D {doifnumberelse,doifnumber,doifnotnumber} %D -%D The next macro executes a command depending of the outcome of a test on -%D numerals. This is probably one of the fastest test possible, exept from -%D a less robust 10||step \type {\if}||ladder or some tricky \type {\lcode} -%D checking. +%D The next macro executes a command depending of the outcome of a test on numerals. +%D This is probably one of the fastest test possible, exept from a less robust +%D 10||step \type {\if}||ladder or some tricky \type {\lcode} checking. %D %D \starttyping %D \doifnumberelse {string} {then ...} {else ...} %D \stoptyping %D -%D The macro accepts \type {123}, \type {abc}, \type {{}}, \type {\getal} and -%D \type {\the\count...}. This macro is a rather dirty one. +%D The macro accepts \type {123}, \type {abc}, \type {{}}, \type {\getal} and \type +%D {\the\count...}. This macro is a rather dirty one. -\def\doifelsenumber#1% does not accept counters (fully expandable) - {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space - \expandafter\secondoftwoarguments - \else - \expandafter\firstoftwoarguments - \fi} +\startmkivmode -\let\doifnumberelse\doifelsenumber + \def\doifelsenumber#1% does not accept counters (fully expandable) + {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space + \expandafter\secondoftwoarguments + \else + \expandafter\firstoftwoarguments + \fi} -\def\doifnumber#1% - {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} + \def\doifnumber#1% + {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} -\def\doifnotnumber#1% - {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space - \expandafter\gobbleoneargument - \else - \expandafter\firstofoneargument - \fi} + \def\doifnotnumber#1% + {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + +\stopmkivmode + +\startlmtxmode -\def\isnonumbercondition#1% does not accept counters (fully expandable) - {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space} + \def\doifelsenumber#1% + {\ifnumber#1\or + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + + \def\doifnumber#1% + {\ifnumber#1\or + \expandafter\firstoftwoarguments + \else + \expandafter\gobbleoneargument + \fi} + + \def\doifnotnumber#1% + {\ifnumber#1\or + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + +\stoplmtxmode + +\let\doifnumberelse\doifelsenumber %D \macros %D {setpercentdimen} @@ -1572,14 +1709,12 @@ %D rawprocesscommalist, %D rawprocessaction} %D -%D Some of the commands mentioned earlier are effective but -%D slow. When one is desperately in need of faster alternatives -%D and when the conditions are predictable safe, the \type{\raw} -%D alternatives come into focus. A major drawback is that -%D they do not take \type{\c!constants} into account, simply -%D because no expansion is done. This is no problem with -%D \type{\rawprocesscommalist}, because this macro does not -%D compare anything. Expandable macros are permitted as search +%D Some of the commands mentioned earlier are effective but slow. When one is +%D desperately in need of faster alternatives and when the conditions are +%D predictable safe, the \type {\raw} alternatives come into focus. A major drawback +%D is that they do not take \type {\c!constants} into account, simply because no +%D expansion is done. This is no problem with \type {\rawprocesscommalist}, because +%D this macro does not compare anything. Expandable macros are permitted as search %D string. %D %D \starttyping @@ -1589,10 +1724,9 @@ %D \rawprocessaction[x][a=>\a,b=>\b,c=>\c] %D \stoptyping %D -%D Spaces embedded in the list, for instance after commas, -%D spoil the search process. The gain in speed depends on the -%D length of the argument (the longer the argument, the less -%D we gain). +%D Spaces embedded in the list, for instance after commas, spoil the search process. +%D The gain in speed depends on the length of the argument (the longer the argument, +%D the less we gain). \unexpanded\def\makerawcommalist[#1]#2% use \processnext ... here {\def\syst_helpers_do_make_raw_comma_list##1% we don't expand ##1 @@ -1619,6 +1753,22 @@ \unexpanded\def\rawprocesscommacommand[#1]% not really needed {\normalexpanded{\rawprocesscommalist[#1]}} +%D Here is one without nesting: + +\unexpanded\def\syst_helpers_fast_process_comma_item#1,#2% #2 eats up preceding space + {\if]#1\else + \syst_helpers_fast_process_comma_command{#1}% + \expandafter\syst_helpers_fast_process_comma_item + \fi#2} + +\unexpanded\def\fastprocesscommalist[#1]#2% accepteert ook [\cs] + {\let\syst_helpers_fast_process_comma_command#2% + \expandafter\syst_helpers_fast_process_comma_item#1,],}% \relax + +\unexpanded\def\fastprocesscommacommand[#1]#2% accepteert ook [\cs] + {\let\syst_helpers_fast_process_comma_command#2% + \normalexpanded{\syst_helpers_fast_process_comma_item#1},],}% \relax + % \def\rawdoifelseinset#1#2{\doifinstringelse{,#1,}{,#2,}} % \def\rawdoifinset #1#2{\doifinstring {,#1,}{,#2,}} @@ -1682,11 +1832,11 @@ \m_syst_helpers_process_action \fi} -%D When we process the list \type{a,b,c,d,e}, the raw routine takes over 30\% less +%D When we process the list \type {a,b,c,d,e}, the raw routine takes over 30\% less %D time, when we feed $20+$ character strings we gain about 20\%. Alternatives which -%D use \type{\futurelet} perform worse. Part of the speedup is due to the -%D \type{\let} and \type{\expandafter} in the test. - +%D use \type {\futurelet} perform worse. Part of the speedup is due to the \type +%D {\let} and \type {\expandafter} in the test. +%D %D \macros %D {dosetvalue,dosetevalue,dosetgvalue,docopyvalue,doresetvalue, %D dogetvalue} @@ -1909,8 +2059,8 @@ %D \processassignmentlist[a=1,b=2]\showpair %D \stoptyping %D -%D We can optimize this one if needed but it's not a core macro so hardly -%D worth the trouble and tokens. +%D We can optimize this one if needed but it's not a core macro so hardly worth the +%D trouble and tokens. \unexpanded\def\processassignmentlist[#1]#2% #2 == \command{key}{value] {\def\syst_helpers_process_assignment_entry##1{#2}% {##2}{##3} % namespace is ignored @@ -1983,8 +2133,8 @@ %D \macros %D {getemptyparameters} %D -%D Sometimes we explicitly want variables to default to an -%D empty string, so we welcome: +%D Sometimes we explicitly want variables to default to an empty string, so we +%D welcome: %D %D \starttyping %D \getemptyparameters [label] [...=...,...=...] @@ -1997,11 +2147,9 @@ %D \macros %D {copyparameters} %D -%D Some \CONTEXT\ commands take their default setups from -%D others. All commands that are able to provide backgounds -%D or rules around some content, for instance default to the -%D standard command for ruled boxes. Is situations like this -%D we can use: +%D Some \CONTEXT\ commands take their default setups from others. All commands that +%D are able to provide backgounds or rules around some content, for instance default +%D to the standard command for ruled boxes. Is situations like this we can use: %D %D \starttyping %D \copyparameters [to-label] [from-label] [name1,name2,...] @@ -2022,8 +2170,8 @@ %D \def\internalbeta {\externalbeta} %D \stoptyping %D -%D By using \type{\docopyvalue} we've prepared this command -%D for use in a multi||lingual environment. +%D By using \type {\docopyvalue} we've prepared this command for use in a +%D multi||lingual environment. \unexpanded\def\copyparameters[#1]#2[#3]#4[#5]% {\doifnot{#1}{#3} @@ -2033,12 +2181,11 @@ %D \macros %D {ifparameters,checkparameters} %D -%D A slightly different one is \type{\checkparameters}, which -%D also checks on the presence of a~\type{=}. +%D A slightly different one is \type {\checkparameters}, which also checks on the +%D presence of a~\type {=}. %D -%D The boolean \type{\ifparameters} can be used afterwards. -%D Combining both in one \type{\if}||macro would lead to -%D problems with nested \type{\if}'s. +%D The boolean \type {\ifparameters} can be used afterwards. Combining both in one +%D \type {\if}||macro would lead to problems with nested \type {\if}'s. %D %D \starttyping %D \checkparameters[argument] @@ -2114,9 +2261,8 @@ \unexpanded\def\getfromcommacommand[#1]% {\normalexpanded{\getfromcommalist[#1]}} -%D Watertight (and efficient) solutions are hard to find, due -%D to the handling of braces during parameters passing and -%D scanning. Nevertheless: +%D Watertight (and efficient) solutions are hard to find, due to the handling of +%D braces during parameters passing and scanning. Nevertheless: %D %D \startbuffer %D \def\dosomething#1{(#1=\commalistsize) } @@ -2140,8 +2286,8 @@ %D \macros %D {dogetcommalistelement,dogetcommacommandelement} %D -%D For low level (fast) purposes, we can also use the next -%D alternative, which can handle 8~elements at most. +%D For low level (fast) purposes, we can also use the next alternative, which can +%D handle 8~elements at most. %D %D \starttyping %D \dogetcommalistelement1\from a,b,c\to\commalistelement @@ -2158,9 +2304,8 @@ %D doquadrupleargument,doquintupleargument,dosixtupleargument, %D doseventupleargument} %D -%D When working with delimited arguments, spaces and -%D lineendings can interfere. The next set of macros uses -%D \TEX' internal scanner for grabbing everything between +%D When working with delimited arguments, spaces and lineendings can interfere. The +%D next set of macros uses \TEX' internal scanner for grabbing everything between %D arguments. Forgive me the funny names. %D %D \starttyping @@ -2197,17 +2342,15 @@ %D \dodoquintupleargument} %D \stoptyping %D -%D Because \TEX\ accepts 9~arguments at most, we have to use -%D two||step solution when getting five or more arguments. +%D Because \TEX\ accepts 9~arguments at most, we have to use two||step solution when +%D getting five or more arguments. %D -%D When developing more and more of the real \CONTEXT, we -%D started using some alternatives that provided empty -%D arguments (in fact optional ones) whenever the user failed -%D to supply them. Because this more complicated macros enable -%D us to do some checking, we reimplemented the non||empty -%D ones. +%D When developing more and more of the real \CONTEXT, we started using some +%D alternatives that provided empty arguments (in fact optional ones) whenever the +%D user failed to supply them. Because this more complicated macros enable us to do +%D some checking, we reimplemented the non||empty ones. -% no longer a mesage: +% no longer a message: % % \unexpanded\def\dosingleargument {\let\expectedarguments\plusone \dosingleempty } % \unexpanded\def\dodoubleargument {\let\expectedarguments\plustwo \dodoubleempty } @@ -2222,8 +2365,8 @@ %D iffourthargument,iffifthargument,ifsixthargument, %D ifseventhargument} %D -%D We use some signals for telling the calling macros if all -%D wanted arguments are indeed supplied by the user. +%D We use some signals for telling the calling macros if all wanted arguments are +%D indeed supplied by the user. \newif\iffirstargument \newif\ifsecondargument @@ -2258,24 +2401,23 @@ %D \command[][] %D \stoptyping %D -%D Depending of the generousity of the user. Afterwards one can -%D use the \type{\if...argument} boolean. For novice: watch -%D the stepwise doubling of \type{#}'s - -\setnewconstant\noexpectedarguments\zerocount -\setnewconstant\expectedarguments \zerocount - -\unexpanded\def\showargumenterror#1#2% - {\writestatus{system}{\number#1 argument(s) expected in line #2}} +%D Depending of the generousity of the user. Afterwards one can use the \type +%D {\if...argument} boolean. For novice: watch the stepwise doubling of \type {#}'s. -\unexpanded\def\syst_helpers_argument_error - {\ifnum\expectedarguments>\noexpectedarguments - \showargumenterror{\number\expectedarguments}{\number\inputlineno}% - \fi - \syst_helpers_argument_reset} - -\unexpanded\def\syst_helpers_argument_reset - {\let\expectedarguments\noexpectedarguments} +% \setnewconstant\noexpectedarguments\zerocount +% \setnewconstant\expectedarguments \zerocount +% +% \unexpanded\def\showargumenterror#1#2% +% {\writestatus{system}{\number#1 argument(s) expected in line #2}} +% +% \unexpanded\def\syst_helpers_argument_error +% {\ifnum\expectedarguments>\noexpectedarguments +% \showargumenterror{\number\expectedarguments}{\number\inputlineno}% +% \fi +% \syst_helpers_argument_reset} +% +% \unexpanded\def\syst_helpers_argument_reset +% {\let\expectedarguments\noexpectedarguments} % \def\test[#1]{(#1)} % @@ -2340,18 +2482,22 @@ % % But we use this as it keeps the original name visible: -\def\syst_helpers_empty_spaced_six {\the\t_syst_aux[][][][][][] } -\def\syst_helpers_empty_normal_six {\the\t_syst_aux[][][][][][]} -\def\syst_helpers_empty_spaced_five {\the\t_syst_aux[][][][][] } -\def\syst_helpers_empty_normal_five {\the\t_syst_aux[][][][][]} -\def\syst_helpers_empty_spaced_four {\the\t_syst_aux[][][][] } -\def\syst_helpers_empty_normal_four {\the\t_syst_aux[][][][]} -\def\syst_helpers_empty_spaced_three{\the\t_syst_aux[][][] } -\def\syst_helpers_empty_normal_three{\the\t_syst_aux[][][]} -\def\syst_helpers_empty_spaced_two {\the\t_syst_aux[][] } -\def\syst_helpers_empty_normal_two {\the\t_syst_aux[][]} -\def\syst_helpers_empty_spaced_one {\the\t_syst_aux[] } -\def\syst_helpers_empty_normal_one {\the\t_syst_aux[]} +\startmkivmode + + \def\syst_helpers_empty_spaced_six {\the\t_syst_aux[][][][][][] } + \def\syst_helpers_empty_normal_six {\the\t_syst_aux[][][][][][]} + \def\syst_helpers_empty_spaced_five {\the\t_syst_aux[][][][][] } + \def\syst_helpers_empty_normal_five {\the\t_syst_aux[][][][][]} + \def\syst_helpers_empty_spaced_four {\the\t_syst_aux[][][][] } + \def\syst_helpers_empty_normal_four {\the\t_syst_aux[][][][]} + \def\syst_helpers_empty_spaced_three{\the\t_syst_aux[][][] } + \def\syst_helpers_empty_normal_three{\the\t_syst_aux[][][]} + \def\syst_helpers_empty_spaced_two {\the\t_syst_aux[][] } + \def\syst_helpers_empty_normal_two {\the\t_syst_aux[][]} + \def\syst_helpers_empty_spaced_one {\the\t_syst_aux[] } + \def\syst_helpers_empty_normal_one {\the\t_syst_aux[]} + +\stopmkivmode \def\syst_helpers_single_empty_one_yes {\firstargumenttrue \the\t_syst_aux} \def\syst_helpers_double_empty_two_yes {\secondargumenttrue \the\t_syst_aux} @@ -2373,17 +2519,34 @@ % {\firstargumentfalse % #1[]} -\unexpanded\def\dosingleempty#1% - {\syst_helpers_argument_reset - \t_syst_aux{#1}% - \let\m_syst_action_yes\syst_helpers_single_empty_one_yes - \let\m_syst_action_nop\syst_helpers_single_empty_one_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} +\startmkivmode -\def\syst_helpers_single_empty_one_nop - {\firstargumentfalse - \the\t_syst_aux[]} + \unexpanded\def\dosingleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \let\m_syst_action_yes\syst_helpers_single_empty_one_yes + \let\m_syst_action_nop\syst_helpers_single_empty_one_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_single_empty_one_nop + {\firstargumentfalse + \the\t_syst_aux[]} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\dosingleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \futureexpand[\syst_helpers_single_empty_one_yes\syst_helpers_single_empty_one_nop} + + \def\syst_helpers_single_empty_one_nop + {\firstargumentfalse + \the\t_syst_aux[]} + +\stoplmtxmode %D Double @@ -2415,34 +2578,61 @@ % \def\syst_helpers_double_empty_one_spaced#1#2{#1[{#2}][] } % \def\syst_helpers_double_empty_one_normal#1#2{#1[{#2}][]} -\unexpanded\def\dodoubleempty#1% - {\syst_helpers_argument_reset - \t_syst_aux{#1}% - \let\m_syst_action_yes\syst_helpers_double_empty_one_yes - \let\m_syst_action_nop\syst_helpers_double_empty_one_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_double_empty_one_yes[#1]% - {\firstargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_double_empty_two_yes - \let\m_syst_action_nop\syst_helpers_double_empty_two_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_double_empty_one_nop - {\firstargumentfalse - \secondargumentfalse - \the\t_syst_aux[][]} - -\def\syst_helpers_double_empty_two_nop - {\secondargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_one - \else - \expandafter\syst_helpers_empty_normal_one - \fi} +\startmkivmode + + \unexpanded\def\dodoubleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \let\m_syst_action_yes\syst_helpers_double_empty_one_yes + \let\m_syst_action_nop\syst_helpers_double_empty_one_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_double_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_double_empty_two_yes + \let\m_syst_action_nop\syst_helpers_double_empty_two_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_double_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \the\t_syst_aux[][]} + + \def\syst_helpers_double_empty_two_nop + {\secondargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_one + \else + \expandafter\syst_helpers_empty_normal_one + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\dodoubleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \futureexpand[\syst_helpers_double_empty_one_yes\syst_helpers_double_empty_one_nop} + + \def\syst_helpers_double_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_double_empty_two_yes\syst_helpers_double_empty_two_nop} + + \def\syst_helpers_double_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \the\t_syst_aux[][]} + + \def\syst_helpers_double_empty_two_nop + {\secondargumentfalse + \the\t_syst_aux[]} + +\stoplmtxmode % Triple @@ -2492,52 +2682,90 @@ % \def\syst_helpers_triple_empty_three_spaced#1#2#3{#1[{#2}][{#3}][] } % \def\syst_helpers_triple_empty_three_normal#1#2#3{#1[{#2}][{#3}][]} -\unexpanded\def\dotripleempty#1% - {\syst_helpers_argument_reset - \t_syst_aux{#1}% - \let\m_syst_action_yes\syst_helpers_triple_empty_one_yes - \let\m_syst_action_nop\syst_helpers_triple_empty_one_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_triple_empty_one_yes[#1]% - {\firstargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_triple_empty_two_yes - \let\m_syst_action_nop\syst_helpers_triple_empty_two_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_triple_empty_two_yes[#1]% - {\secondargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_triple_empty_three_yes - \let\m_syst_action_nop\syst_helpers_triple_empty_three_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_triple_empty_one_nop - {\firstargumentfalse - \secondargumentfalse - \thirdargumentfalse - \the\t_syst_aux[][][]} - -\def\syst_helpers_triple_empty_two_nop - {\secondargumentfalse - \thirdargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_two - \else - \expandafter\syst_helpers_empty_normal_two - \fi} +\startmkivmode + + \unexpanded\def\dotripleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \let\m_syst_action_yes\syst_helpers_triple_empty_one_yes + \let\m_syst_action_nop\syst_helpers_triple_empty_one_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_triple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_triple_empty_two_yes + \let\m_syst_action_nop\syst_helpers_triple_empty_two_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_triple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_triple_empty_three_yes + \let\m_syst_action_nop\syst_helpers_triple_empty_three_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_triple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \the\t_syst_aux[][][]} + + \def\syst_helpers_triple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_two + \else + \expandafter\syst_helpers_empty_normal_two + \fi} -\def\syst_helpers_triple_empty_three_nop - {\thirdargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_one - \else - \expandafter\syst_helpers_empty_normal_one - \fi} + \def\syst_helpers_triple_empty_three_nop + {\thirdargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_one + \else + \expandafter\syst_helpers_empty_normal_one + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\dotripleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \futureexpand[\syst_helpers_triple_empty_one_yes\syst_helpers_triple_empty_one_nop} + + \def\syst_helpers_triple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_triple_empty_two_yes\syst_helpers_triple_empty_two_nop} + + \def\syst_helpers_triple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_triple_empty_three_yes\syst_helpers_triple_empty_three_nop} + + \def\syst_helpers_triple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \the\t_syst_aux[][][]} + + \def\syst_helpers_triple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \the\t_syst_aux[][]} + + \def\syst_helpers_triple_empty_three_nop + {\thirdargumentfalse + \the\t_syst_aux[]} + +\stoplmtxmode %D Quadruple: @@ -2606,71 +2834,121 @@ % \def\syst_helpers_quadruple_empty_four_spaced #1#2#3#4{#1[{#2}][{#3}][{#4}][] } % \def\syst_helpers_quadruple_empty_four_normal #1#2#3#4{#1[{#2}][{#3}][{#4}][]} -\unexpanded\def\doquadrupleempty#1% - {\syst_helpers_argument_reset - \t_syst_aux{#1}% - \let\m_syst_action_yes\syst_helpers_quadruple_empty_one_yes - \let\m_syst_action_nop\syst_helpers_quadruple_empty_one_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quadruple_empty_one_yes[#1]% - {\firstargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_quadruple_empty_two_yes - \let\m_syst_action_nop\syst_helpers_quadruple_empty_two_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quadruple_empty_two_yes[#1]% - {\secondargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_quadruple_empty_three_yes - \let\m_syst_action_nop\syst_helpers_quadruple_empty_three_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quadruple_empty_three_yes[#1]% - {\thirdargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_quadruple_empty_four_yes - \let\m_syst_action_nop\syst_helpers_quadruple_empty_four_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quadruple_empty_one_nop - {\firstargumentfalse - \secondargumentfalse - \thirdargumentfalse - \fourthargumentfalse - \the\t_syst_aux[][][][]} - -\def\syst_helpers_quadruple_empty_two_nop - {\secondargumentfalse - \thirdargumentfalse - \fourthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_three - \else - \expandafter\syst_helpers_empty_normal_three - \fi} +\startmkivmode + + \unexpanded\def\doquadrupleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \let\m_syst_action_yes\syst_helpers_quadruple_empty_one_yes + \let\m_syst_action_nop\syst_helpers_quadruple_empty_one_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quadruple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_quadruple_empty_two_yes + \let\m_syst_action_nop\syst_helpers_quadruple_empty_two_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quadruple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_quadruple_empty_three_yes + \let\m_syst_action_nop\syst_helpers_quadruple_empty_three_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quadruple_empty_three_yes[#1]% + {\thirdargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_quadruple_empty_four_yes + \let\m_syst_action_nop\syst_helpers_quadruple_empty_four_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quadruple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \the\t_syst_aux[][][][]} + + \def\syst_helpers_quadruple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_three + \else + \expandafter\syst_helpers_empty_normal_three + \fi} + + \def\syst_helpers_quadruple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_two + \else + \expandafter\syst_helpers_empty_normal_two + \fi} -\def\syst_helpers_quadruple_empty_three_nop - {\thirdargumentfalse - \fourthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_two - \else - \expandafter\syst_helpers_empty_normal_two - \fi} + \def\syst_helpers_quadruple_empty_four_nop + {\fourthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_one + \else + \expandafter\syst_helpers_empty_normal_one + \fi} -\def\syst_helpers_quadruple_empty_four_nop - {\fourthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_one - \else - \expandafter\syst_helpers_empty_normal_one - \fi} +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doquadrupleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \futureexpand[\syst_helpers_quadruple_empty_one_yes\syst_helpers_quadruple_empty_one_nop} + + \def\syst_helpers_quadruple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_quadruple_empty_two_yes\syst_helpers_quadruple_empty_two_nop} + + \def\syst_helpers_quadruple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_quadruple_empty_three_yes\syst_helpers_quadruple_empty_three_nop} + + \def\syst_helpers_quadruple_empty_three_yes[#1]% + {\thirdargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_quadruple_empty_four_yes\syst_helpers_quadruple_empty_four_nop} + + \def\syst_helpers_quadruple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \the\t_syst_aux[][][][]} + + \def\syst_helpers_quadruple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \the\t_syst_aux[][][]} + + \def\syst_helpers_quadruple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \the\t_syst_aux[][]} + + \def\syst_helpers_quadruple_empty_four_nop + {\fourthargumentfalse + \the\t_syst_aux[]} + +\stoplmtxmode %D Quintuple: @@ -2759,91 +3037,154 @@ % \def\syst_helpers_quintuple_empty_five_spaced #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][] } % \def\syst_helpers_quintuple_empty_five_normal #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][]} -\unexpanded\def\doquintupleempty#1% - {\syst_helpers_argument_reset - \t_syst_aux{#1}% - \let\m_syst_action_yes\syst_helpers_quintuple_empty_one_yes - \let\m_syst_action_nop\syst_helpers_quintuple_empty_one_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quintuple_empty_one_yes[#1]% - {\firstargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_quintuple_empty_two_yes - \let\m_syst_action_nop\syst_helpers_quintuple_empty_two_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quintuple_empty_two_yes[#1]% - {\secondargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_quintuple_empty_three_yes - \let\m_syst_action_nop\syst_helpers_quintuple_empty_three_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quintuple_empty_three_yes[#1]% - {\thirdargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_quintuple_empty_four_yes - \let\m_syst_action_nop\syst_helpers_quintuple_empty_four_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quintuple_empty_four_yes[#1]% - {\fourthargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_quintuple_empty_five_yes - \let\m_syst_action_nop\syst_helpers_quintuple_empty_five_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_quintuple_empty_one_nop - {\firstargumentfalse - \secondargumentfalse - \thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \the\t_syst_aux[][][][][]} - -\def\syst_helpers_quintuple_empty_two_nop - {\secondargumentfalse - \thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_four - \else - \expandafter\syst_helpers_empty_normal_four - \fi} - -\def\syst_helpers_quintuple_empty_three_nop - {\thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_three - \else - \expandafter\syst_helpers_empty_normal_three - \fi} - -\def\syst_helpers_quintuple_empty_four_nop - {\fourthargumentfalse - \fifthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_two - \else - \expandafter\syst_helpers_empty_normal_two - \fi} +\startmkivmode + + \unexpanded\def\doquintupleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \let\m_syst_action_yes\syst_helpers_quintuple_empty_one_yes + \let\m_syst_action_nop\syst_helpers_quintuple_empty_one_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quintuple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_quintuple_empty_two_yes + \let\m_syst_action_nop\syst_helpers_quintuple_empty_two_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quintuple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_quintuple_empty_three_yes + \let\m_syst_action_nop\syst_helpers_quintuple_empty_three_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quintuple_empty_three_yes[#1]% + {\thirdargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_quintuple_empty_four_yes + \let\m_syst_action_nop\syst_helpers_quintuple_empty_four_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quintuple_empty_four_yes[#1]% + {\fourthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_quintuple_empty_five_yes + \let\m_syst_action_nop\syst_helpers_quintuple_empty_five_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_quintuple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux[][][][][]} + + \def\syst_helpers_quintuple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_four + \else + \expandafter\syst_helpers_empty_normal_four + \fi} + + \def\syst_helpers_quintuple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_three + \else + \expandafter\syst_helpers_empty_normal_three + \fi} + + \def\syst_helpers_quintuple_empty_four_nop + {\fourthargumentfalse + \fifthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_two + \else + \expandafter\syst_helpers_empty_normal_two + \fi} -\def\syst_helpers_quintuple_empty_five_nop - {\fifthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_one - \else - \expandafter\syst_helpers_empty_normal_one - \fi} + \def\syst_helpers_quintuple_empty_five_nop + {\fifthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_one + \else + \expandafter\syst_helpers_empty_normal_one + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doquintupleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \futureexpand[\syst_helpers_quintuple_empty_one_yes\syst_helpers_quintuple_empty_one_nop} + + \def\syst_helpers_quintuple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_quintuple_empty_two_yes\syst_helpers_quintuple_empty_two_nop} + + \def\syst_helpers_quintuple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_quintuple_empty_three_yes\syst_helpers_quintuple_empty_three_nop} + + \def\syst_helpers_quintuple_empty_three_yes[#1]% + {\thirdargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_quintuple_empty_four_yes\syst_helpers_quintuple_empty_four_nop} + + \def\syst_helpers_quintuple_empty_four_yes[#1]% + {\fourthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_quintuple_empty_five_yes\syst_helpers_quintuple_empty_five_nop} + + \def\syst_helpers_quintuple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux[][][][][]} + + \def\syst_helpers_quintuple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux[][][][]} + + \def\syst_helpers_quintuple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux[][][]} + + \def\syst_helpers_quintuple_empty_four_nop + {\fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux[][]} + + \def\syst_helpers_quintuple_empty_five_nop + {\fifthargumentfalse + \the\t_syst_aux[]} + +\stoplmtxmode %D Sixtuple: @@ -2953,112 +3294,189 @@ % \def\syst_helpers_sixtuple_empty_six_spaced #1#2#3#4#5#6{#1[{#2}][{#3}][{#4}][{#5}][{#6}][] } % \def\syst_helpers_sixtuple_empty_six_normal #1#2#3#4#5#6{#1[{#2}][{#3}][{#4}][{#5}][{#6}][]} -\unexpanded\def\dosixtupleempty#1% - {\syst_helpers_argument_reset - \t_syst_aux{#1}% - \let\m_syst_action_yes\syst_helpers_sixtuple_empty_one_yes - \let\m_syst_action_nop\syst_helpers_sixtuple_empty_one_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_sixtuple_empty_one_yes[#1]% - {\firstargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_sixtuple_empty_two_yes - \let\m_syst_action_nop\syst_helpers_sixtuple_empty_two_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_sixtuple_empty_two_yes[#1]% - {\secondargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_sixtuple_empty_three_yes - \let\m_syst_action_nop\syst_helpers_sixtuple_empty_three_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_sixtuple_empty_three_yes[#1]% - {\thirdargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_sixtuple_empty_four_yes - \let\m_syst_action_nop\syst_helpers_sixtuple_empty_four_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_sixtuple_empty_four_yes[#1]% - {\fourthargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_sixtuple_empty_five_yes - \let\m_syst_action_nop\syst_helpers_sixtuple_empty_five_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_sixtuple_empty_five_yes[#1]% - {\fifthargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_sixtuple_empty_six_yes - \let\m_syst_action_nop\syst_helpers_sixtuple_empty_six_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_sixtuple_empty_one_nop - {\firstargumentfalse - \secondargumentfalse - \thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \sixthargumentfalse - \the\t_syst_aux[][][][][][]} - -\def\syst_helpers_sixtuple_empty_two_nop - {\secondargumentfalse - \thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \sixthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_five - \else - \expandafter\syst_helpers_empty_normal_five - \fi} - -\def\syst_helpers_sixtuple_empty_three_nop - {\thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \sixthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_four - \else - \expandafter\syst_helpers_empty_normal_four - \fi} - -\def\syst_helpers_sixtuple_empty_four_nop - {\fourthargumentfalse - \fifthargumentfalse - \sixthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_three - \else - \expandafter\syst_helpers_empty_normal_three - \fi} - -\def\syst_helpers_sixtuple_empty_five_nop - {\fifthargumentfalse - \sixthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_two - \else - \expandafter\syst_helpers_empty_normal_two - \fi} +\startmkivmode + + \unexpanded\def\dosixtupleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \let\m_syst_action_yes\syst_helpers_sixtuple_empty_one_yes + \let\m_syst_action_nop\syst_helpers_sixtuple_empty_one_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_sixtuple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_sixtuple_empty_two_yes + \let\m_syst_action_nop\syst_helpers_sixtuple_empty_two_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_sixtuple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_sixtuple_empty_three_yes + \let\m_syst_action_nop\syst_helpers_sixtuple_empty_three_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_sixtuple_empty_three_yes[#1]% + {\thirdargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_sixtuple_empty_four_yes + \let\m_syst_action_nop\syst_helpers_sixtuple_empty_four_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_sixtuple_empty_four_yes[#1]% + {\fourthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_sixtuple_empty_five_yes + \let\m_syst_action_nop\syst_helpers_sixtuple_empty_five_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_sixtuple_empty_five_yes[#1]% + {\fifthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_sixtuple_empty_six_yes + \let\m_syst_action_nop\syst_helpers_sixtuple_empty_six_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_sixtuple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \the\t_syst_aux[][][][][][]} + + \def\syst_helpers_sixtuple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_five + \else + \expandafter\syst_helpers_empty_normal_five + \fi} + + \def\syst_helpers_sixtuple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_four + \else + \expandafter\syst_helpers_empty_normal_four + \fi} + + \def\syst_helpers_sixtuple_empty_four_nop + {\fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_three + \else + \expandafter\syst_helpers_empty_normal_three + \fi} + + \def\syst_helpers_sixtuple_empty_five_nop + {\fifthargumentfalse + \sixthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_two + \else + \expandafter\syst_helpers_empty_normal_two + \fi} -\def\syst_helpers_sixtuple_empty_six_nop - {\sixthargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_one - \else - \expandafter\syst_helpers_empty_normal_one - \fi} + \def\syst_helpers_sixtuple_empty_six_nop + {\sixthargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_one + \else + \expandafter\syst_helpers_empty_normal_one + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\dosixtupleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \futureexpand[\syst_helpers_sixtuple_empty_one_yes\syst_helpers_sixtuple_empty_one_nop} + + \def\syst_helpers_sixtuple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_sixtuple_empty_two_yes\syst_helpers_sixtuple_empty_two_nop} + + \def\syst_helpers_sixtuple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_sixtuple_empty_three_yes\syst_helpers_sixtuple_empty_three_nop} + + \def\syst_helpers_sixtuple_empty_three_yes[#1]% + {\thirdargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_sixtuple_empty_four_yes\syst_helpers_sixtuple_empty_four_nop} + + \def\syst_helpers_sixtuple_empty_four_yes[#1]% + {\fourthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_sixtuple_empty_five_yes\syst_helpers_sixtuple_empty_five_nop} + + \def\syst_helpers_sixtuple_empty_five_yes[#1]% + {\fifthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_sixtuple_empty_six_yes\syst_helpers_sixtuple_empty_six_nop} + + \def\syst_helpers_sixtuple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \the\t_syst_aux[][][][][][]} + + \def\syst_helpers_sixtuple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \the\t_syst_aux[][][][][]} + + \def\syst_helpers_sixtuple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \the\t_syst_aux[][][][]} + + \def\syst_helpers_sixtuple_empty_four_nop + {\fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \the\t_syst_aux[][][]} + + \def\syst_helpers_sixtuple_empty_five_nop + {\fifthargumentfalse + \sixthargumentfalse + \the\t_syst_aux[][]} + + \def\syst_helpers_sixtuple_empty_six_nop + {\sixthargumentfalse + \the\t_syst_aux[]} + +\stoplmtxmode %D Seventuple: @@ -3190,134 +3608,226 @@ % \def\syst_helpers_seventuple_empty_seven_spaced#1#2#3#4#5#6#7{#1[{#2}][{#3}][{#4}][{#5}][{#6}][{#7}][] } % \def\syst_helpers_seventuple_empty_seven_normal#1#2#3#4#5#6#7{#1[{#2}][{#3}][{#4}][{#5}][{#6}][{#7}][]} -\unexpanded\def\doseventupleempty#1% - {\syst_helpers_argument_reset - \t_syst_aux{#1}% - \let\m_syst_action_yes\syst_helpers_seventuple_empty_one_yes - \let\m_syst_action_nop\syst_helpers_seventuple_empty_one_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_seventuple_empty_one_yes[#1]% - {\firstargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_seventuple_empty_two_yes - \let\m_syst_action_nop\syst_helpers_seventuple_empty_two_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_seventuple_empty_two_yes[#1]% - {\secondargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_seventuple_empty_three_yes - \let\m_syst_action_nop\syst_helpers_seventuple_empty_three_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_seventuple_empty_three_yes[#1]% - {\thirdargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_seventuple_empty_four_yes - \let\m_syst_action_nop\syst_helpers_seventuple_empty_four_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_seventuple_empty_four_yes[#1]% - {\fourthargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_seventuple_empty_five_yes - \let\m_syst_action_nop\syst_helpers_seventuple_empty_five_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_seventuple_empty_five_yes[#1]% - {\fifthargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_seventuple_empty_six_yes - \let\m_syst_action_nop\syst_helpers_seventuple_empty_six_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_seventuple_empty_six_yes[#1]% - {\sixthargumenttrue - \toksapp\t_syst_aux{[{#1}]}% - \let\m_syst_action_yes\syst_helpers_seventuple_empty_seven_yes - \let\m_syst_action_nop\syst_helpers_seventuple_empty_seven_nop - \let\if_next_blank_space_token\iffalse - \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} - -\def\syst_helpers_seventuple_empty_one_nop - {\firstargumentfalse - \secondargumentfalse - \thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \sixthargumentfalse - \seventhargumentfalse - \the\t_syst_aux[][][][][][][]} - -\def\syst_helpers_seventuple_empty_two_nop - {\secondargumentfalse - \thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \sixthargumentfalse - \seventhargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_six - \else - \expandafter\syst_helpers_empty_normal_six - \fi} - -\def\syst_helpers_seventuple_empty_three_nop - {\thirdargumentfalse - \fourthargumentfalse - \fifthargumentfalse - \sixthargumentfalse - \seventhargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_five - \else - \expandafter\syst_helpers_empty_normal_five - \fi} - -\def\syst_helpers_seventuple_empty_four_nop - {\fourthargumentfalse - \fifthargumentfalse - \sixthargumentfalse - \seventhargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_four - \else - \expandafter\syst_helpers_empty_normal_four - \fi} - -\def\syst_helpers_seventuple_empty_five_nop - {\fifthargumentfalse - \sixthargumentfalse - \seventhargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_three - \else - \expandafter\syst_helpers_empty_normal_three - \fi} - -\def\syst_helpers_seventuple_empty_six_nop - {\sixthargumentfalse - \seventhargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_two - \else - \expandafter\syst_helpers_empty_normal_two - \fi} +\startmkivmode + + \unexpanded\def\doseventupleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \let\m_syst_action_yes\syst_helpers_seventuple_empty_one_yes + \let\m_syst_action_nop\syst_helpers_seventuple_empty_one_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_seventuple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_seventuple_empty_two_yes + \let\m_syst_action_nop\syst_helpers_seventuple_empty_two_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_seventuple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_seventuple_empty_three_yes + \let\m_syst_action_nop\syst_helpers_seventuple_empty_three_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_seventuple_empty_three_yes[#1]% + {\thirdargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_seventuple_empty_four_yes + \let\m_syst_action_nop\syst_helpers_seventuple_empty_four_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_seventuple_empty_four_yes[#1]% + {\fourthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_seventuple_empty_five_yes + \let\m_syst_action_nop\syst_helpers_seventuple_empty_five_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_seventuple_empty_five_yes[#1]% + {\fifthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_seventuple_empty_six_yes + \let\m_syst_action_nop\syst_helpers_seventuple_empty_six_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_seventuple_empty_six_yes[#1]% + {\sixthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \let\m_syst_action_yes\syst_helpers_seventuple_empty_seven_yes + \let\m_syst_action_nop\syst_helpers_seventuple_empty_seven_nop + \let\if_next_blank_space_token\iffalse + \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} + + \def\syst_helpers_seventuple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \the\t_syst_aux[][][][][][][]} + + \def\syst_helpers_seventuple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_six + \else + \expandafter\syst_helpers_empty_normal_six + \fi} + + \def\syst_helpers_seventuple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_five + \else + \expandafter\syst_helpers_empty_normal_five + \fi} + + \def\syst_helpers_seventuple_empty_four_nop + {\fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_four + \else + \expandafter\syst_helpers_empty_normal_four + \fi} + + \def\syst_helpers_seventuple_empty_five_nop + {\fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_three + \else + \expandafter\syst_helpers_empty_normal_three + \fi} + + \def\syst_helpers_seventuple_empty_six_nop + {\sixthargumentfalse + \seventhargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_two + \else + \expandafter\syst_helpers_empty_normal_two + \fi} -\def\syst_helpers_seventuple_empty_seven_nop - {\seventhargumentfalse - \if_next_blank_space_token - \expandafter\syst_helpers_empty_spaced_one - \else - \expandafter\syst_helpers_empty_normal_one - \fi} + \def\syst_helpers_seventuple_empty_seven_nop + {\seventhargumentfalse + \if_next_blank_space_token + \expandafter\syst_helpers_empty_spaced_one + \else + \expandafter\syst_helpers_empty_normal_one + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doseventupleempty#1% + {%syst_helpers_argument_reset + \t_syst_aux{#1}% + \futureexpand[\syst_helpers_seventuple_empty_one_yes\syst_helpers_seventuple_empty_one_nop} + + \def\syst_helpers_seventuple_empty_one_yes[#1]% + {\firstargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_seventuple_empty_two_yes\syst_helpers_seventuple_empty_two_nop} + + \def\syst_helpers_seventuple_empty_two_yes[#1]% + {\secondargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_seventuple_empty_three_yes\syst_helpers_seventuple_empty_three_nop} + + \def\syst_helpers_seventuple_empty_three_yes[#1]% + {\thirdargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_seventuple_empty_four_yes\syst_helpers_seventuple_empty_four_nop} + + \def\syst_helpers_seventuple_empty_four_yes[#1]% + {\fourthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_seventuple_empty_five_yes\syst_helpers_seventuple_empty_five_nop} + + \def\syst_helpers_seventuple_empty_five_yes[#1]% + {\fifthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_seventuple_empty_six_yes\syst_helpers_seventuple_empty_six_nop} + + \def\syst_helpers_seventuple_empty_six_yes[#1]% + {\sixthargumenttrue + \toksapp\t_syst_aux{[{#1}]}% + \futureexpand[\syst_helpers_seventuple_empty_seven_yes\syst_helpers_seventuple_empty_seven_nop} + + \def\syst_helpers_seventuple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \the\t_syst_aux[][][][][][][]} + + \def\syst_helpers_seventuple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \the\t_syst_aux[][][][][][]} + + \def\syst_helpers_seventuple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \the\t_syst_aux[][][][][]} + + \def\syst_helpers_seventuple_empty_four_nop + {\fourthargumentfalse + \fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \the\t_syst_aux[][][][]} + + \def\syst_helpers_seventuple_empty_five_nop + {\fifthargumentfalse + \sixthargumentfalse + \seventhargumentfalse + \the\t_syst_aux[][][]} + + \def\syst_helpers_seventuple_empty_six_nop + {\sixthargumentfalse + \seventhargumentfalse + \the\t_syst_aux[][]} + + \def\syst_helpers_seventuple_empty_seven_nop + {\seventhargumentfalse + \the\t_syst_aux[]} + +\stoplmtxmode %D Aliases: @@ -3332,8 +3842,7 @@ %D \macros %D {strippedcsname} %D -%D The next macro can be very useful when using \type{\csname} -%D like in: +%D The next macro can be very useful when using \type{\csname} like in: %D %D \starttyping %D \csname if\strippedcsname\something\endcsname @@ -3349,9 +3858,9 @@ %D \macros %D {complexorsimple,complexorsimpleempty} %D -%D Setups can be optional. A command expecting a setup is -%D prefixed by \type{\complex}, a command without one gets the -%D prefix \type{\simple}. Commands like this can be defined by: +%D Setups can be optional. A command expecting a setup is prefixed by \type +%D {\complex}, a command without one gets the prefix \type {\simple}. Commands like +%D this can be defined by: %D %D \starttyping %D \complexorsimple\command @@ -3375,17 +3884,15 @@ %D \complexorsimpleempty {command} %D \stoptyping %D -%D Depending on the presence of \type{[setup]}, this one -%D leads to one of: +%D Depending on the presence of \type{[setup]}, this one leads to one of: %D %D \starttyping %D \complexcommando [setup] %D \complexcommando [] %D \stoptyping %D -%D Many \CONTEXT\ commands started as complex or simple ones, -%D but changed into more versatile (more object oriented) ones -%D using the \type{\get..argument} commands. +%D Many \CONTEXT\ commands started as complex or simple ones, but changed into more +%D versatile (more object oriented) ones using the \type {\get..argument} commands. \unexpanded\def\complexorsimple#1% {% \relax % prevents lookahead, brrr @@ -3402,9 +3909,8 @@ %D \macros %D {definecomplexorsimple,definecomplexorsimpleempty} %D -%D The previous commands are used that often that we found it -%D worthwile to offer two more alternatives. Watch the build -%D in protection. +%D The previous commands are used that often that we found it worthwile to offer two +%D more alternatives. Watch the build in protection. \unexpanded\def\syst_helpers_complex_or_simple#1#2% {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#2}} @@ -3451,9 +3957,8 @@ %D \doquadruplegroupempty \ineedFOURarguments %D \doquintuplegroupempty \ineedFIVEarguments %D \stoptyping - -%D We can add additional definitions later when we have defined -%D \type {\appendtoks}. +%D +%D We can add additional definitions later when we have defined \type {\appendtoks}. \newconditional\c_syst_helpers_permit_spaces_between_groups @@ -3462,99 +3967,257 @@ \dontpermitspacesbetweengroups -%D We can avoid the nasty if handling in \type {syst-gen} by splitting -%D the lot in pieces so that we have no nested \type {\nextarguments} -%D potentially being an \type {conditional} token. Okay, these macros -%D are not called that often but it saves crap when tracing. +%D We can avoid the nasty if handling in \type {syst-gen} by splitting the lot in +%D pieces so that we have no nested \type {\nextarguments} potentially being an +%D \type {conditional} token. Okay, these macros are not called that often but it +%D saves crap when tracing. -\unexpanded\def\syst_helpers_get_grouped_argument#1#2% - {\let\syst_helpers_get_grouped_argument_yes#1% - \let\syst_helpers_get_grouped_argument_nop#2% - \futurelet\nextargument\syst_helpers_get_grouped_argument_indeed} +\startmkivmode -\def\syst_helpers_get_grouped_argument_indeed - {\ifx\nextargument\bgroup - \expandafter\syst_helpers_get_grouped_argument_a - \else - \expandafter\syst_helpers_get_grouped_argument_b - \fi} + \unexpanded\def\syst_helpers_get_grouped_argument#1#2% + {\let\syst_helpers_get_grouped_argument_yes#1% + \let\syst_helpers_get_grouped_argument_nop#2% + \futurelet\nextargument\syst_helpers_get_grouped_argument_indeed} -\def\syst_helpers_get_grouped_argument_a - {\syst_helpers_argument_reset - \syst_helpers_get_grouped_argument_yes\syst_helpers_get_grouped_argument_nested} + \def\syst_helpers_get_grouped_argument_indeed + {\ifx\nextargument\bgroup + \expandafter\syst_helpers_get_grouped_argument_a + \else + \expandafter\syst_helpers_get_grouped_argument_b + \fi} -\def\syst_helpers_get_grouped_argument_b - {\ifconditional\c_syst_helpers_permit_spaces_between_groups - \expandafter\syst_helpers_get_grouped_argument_f - \else - \expandafter\syst_helpers_get_grouped_argument_d - \fi} + \def\syst_helpers_get_grouped_argument_a + {%syst_helpers_argument_reset + \syst_helpers_get_grouped_argument_yes\syst_helpers_get_grouped_argument_nested} -\def\syst_helpers_get_grouped_argument_d - {\syst_helpers_argument_error - \syst_helpers_get_grouped_argument_nop\syst_helpers_get_grouped_argument_nested{}} + \def\syst_helpers_get_grouped_argument_b + {\ifconditional\c_syst_helpers_permit_spaces_between_groups + \expandafter\syst_helpers_get_grouped_argument_f + \else + \expandafter\syst_helpers_get_grouped_argument_d + \fi} -\begingroup - \def\\ {\syst_helpers_get_grouped_argument\syst_helpers_get_grouped_argument_yes\syst_helpers_get_grouped_argument_nop} - \glet\syst_helpers_get_grouped_argument_e\\ -\endgroup + \def\syst_helpers_get_grouped_argument_d + {%syst_helpers_argument_error + \syst_helpers_get_grouped_argument_nop\syst_helpers_get_grouped_argument_nested{}} -\def\syst_helpers_get_grouped_argument_f - {\ifx\nextargument\blankspace - \expandafter\syst_helpers_get_grouped_argument_e % g - \else - \expandafter\syst_helpers_get_grouped_argument_d % h - \fi} + \begingroup + \def\\ {\syst_helpers_get_grouped_argument\syst_helpers_get_grouped_argument_yes\syst_helpers_get_grouped_argument_nop} + \glet\syst_helpers_get_grouped_argument_e\\ + \endgroup -\def\dosinglegroupempty#1% - {\def\syst_helpers_get_grouped_argument_nested - {\dontpermitspacesbetweengroups - #1}% - \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} - -\def\dodoublegroupempty#1% - {\def\syst_helpers_get_grouped_argument_nested##1% - {\def\syst_helpers_get_grouped_argument_nested - {\dontpermitspacesbetweengroups - #1{##1}}% - \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% - \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} - -\def\dotriplegroupempty#1% - {\def\syst_helpers_get_grouped_argument_nested##1% - {\def\syst_helpers_get_grouped_argument_nested####1% - {\def\syst_helpers_get_grouped_argument_nested - {\dontpermitspacesbetweengroups - #1{##1}{####1}}% - \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}% - \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% - \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} - -\def\doquadruplegroupempty#1% - {\def\syst_helpers_get_grouped_argument_nested##1% - {\def\syst_helpers_get_grouped_argument_nested####1% - {\def\syst_helpers_get_grouped_argument_nested########1% - {\def\syst_helpers_get_grouped_argument_nested - {\dontpermitspacesbetweengroups - #1{##1}{####1}{########1}}% - \syst_helpers_get_grouped_argument\fourthargumenttrue\fourthargumentfalse}% - \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}% - \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% - \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} - -\def\doquintuplegroupempty#1% - {\def\syst_helpers_get_grouped_argument_nested##1% - {\def\syst_helpers_get_grouped_argument_nested####1% - {\def\syst_helpers_get_grouped_argument_nested########1% - {\def\syst_helpers_get_grouped_argument_nested################1% - {\def\syst_helpers_get_grouped_argument_nested - {\dontpermitspacesbetweengroups - #1{##1}{####1}{########1}{################1}}% - \syst_helpers_get_grouped_argument\fifthargumenttrue\fifthargumentfalse}% - \syst_helpers_get_grouped_argument\fourthargumenttrue\fourthargumentfalse}% - \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}% - \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% - \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} + \def\syst_helpers_get_grouped_argument_f + {\ifx\nextargument\blankspace + \expandafter\syst_helpers_get_grouped_argument_e % g + \else + \expandafter\syst_helpers_get_grouped_argument_d % h + \fi} + + \unexpanded\def\dosinglegroupempty#1% + {\def\syst_helpers_get_grouped_argument_nested + {\dontpermitspacesbetweengroups + #1}% + \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} + + \unexpanded\def\dodoublegroupempty#1% + {\def\syst_helpers_get_grouped_argument_nested##1% + {\def\syst_helpers_get_grouped_argument_nested + {\dontpermitspacesbetweengroups + #1{##1}}% + \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% + \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} + + \unexpanded\def\dotriplegroupempty#1% + {\def\syst_helpers_get_grouped_argument_nested##1% + {\def\syst_helpers_get_grouped_argument_nested####1% + {\def\syst_helpers_get_grouped_argument_nested + {\dontpermitspacesbetweengroups + #1{##1}{####1}}% + \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}% + \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% + \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} + + \unexpanded\def\doquadruplegroupempty#1% + {\def\syst_helpers_get_grouped_argument_nested##1% + {\def\syst_helpers_get_grouped_argument_nested####1% + {\def\syst_helpers_get_grouped_argument_nested########1% + {\def\syst_helpers_get_grouped_argument_nested + {\dontpermitspacesbetweengroups + #1{##1}{####1}{########1}}% + \syst_helpers_get_grouped_argument\fourthargumenttrue\fourthargumentfalse}% + \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}% + \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% + \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} + + \unexpanded\def\doquintuplegroupempty#1% + {\def\syst_helpers_get_grouped_argument_nested##1% + {\def\syst_helpers_get_grouped_argument_nested####1% + {\def\syst_helpers_get_grouped_argument_nested########1% + {\def\syst_helpers_get_grouped_argument_nested################1% + {\def\syst_helpers_get_grouped_argument_nested + {\dontpermitspacesbetweengroups + #1{##1}{####1}{########1}{################1}}% + \syst_helpers_get_grouped_argument\fifthargumenttrue\fifthargumentfalse}% + \syst_helpers_get_grouped_argument\fourthargumenttrue\fourthargumentfalse}% + \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}% + \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% + \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\dosinglegroupempty#1% + {\t_syst_aux{#1}% + \futureexpand\bgroup\syst_helpers_single_empty_one_yes\syst_helpers_single_group_empty_one_nop} + + \def\syst_helpers_single_group_empty_one_nop + {\firstargumentfalse + \the\t_syst_aux{}} + + \unexpanded\def\dodoublegroupempty#1% + {\t_syst_aux{#1}% + \futureexpand\bgroup\syst_helpers_group_double_empty_one_yes\syst_helpers_group_double_empty_one_nop} + + \def\syst_helpers_group_double_empty_one_yes#1% + {\firstargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_double_empty_two_yes\syst_helpers_group_double_empty_two_nop} + + \def\syst_helpers_group_double_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \the\t_syst_aux{}{}} + + \def\syst_helpers_group_double_empty_two_nop + {\secondargumentfalse + \the\t_syst_aux{}} + + \unexpanded\def\dotriplegroupempty#1% + {\t_syst_aux{#1}% + \futureexpand\bgroup\syst_helpers_group_triple_empty_one_yes\syst_helpers_group_triple_empty_one_nop} + + \def\syst_helpers_group_triple_empty_one_yes#1% + {\firstargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_group_triple_empty_two_yes\syst_helpers_group_triple_empty_two_nop} + + \def\syst_helpers_group_triple_empty_two_yes#1% + {\secondargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_triple_empty_three_yes\syst_helpers_group_triple_empty_three_nop} + + \def\syst_helpers_group_triple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \the\t_syst_aux{}{}{}} + + \def\syst_helpers_group_triple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \the\t_syst_aux{}{}} + + \def\syst_helpers_group_triple_empty_three_nop + {\thirdargumentfalse + \the\t_syst_aux{}} + + \unexpanded\def\doquadruplegroupempty#1% + {\t_syst_aux{#1}% + \futureexpand\bgroup\syst_helpers_group_quadruple_empty_one_yes\syst_helpers_group_quadruple_empty_one_nop} + + \def\syst_helpers_group_quadruple_empty_one_yes#1% + {\firstargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_group_quadruple_empty_two_yes\syst_helpers_group_quadruple_empty_two_nop} + + \def\syst_helpers_group_quadruple_empty_two_yes#1% + {\secondargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_group_quadruple_empty_three_yes\syst_helpers_group_quadruple_empty_three_nop} + + \def\syst_helpers_group_quadruple_empty_three_yes#1% + {\thirdargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_quadruple_empty_four_yes\syst_helpers_group_quadruple_empty_four_nop} + + \def\syst_helpers_group_quadruple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \the\t_syst_aux{}{}{}{}} + + \def\syst_helpers_group_quadruple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \the\t_syst_aux{}{}{}} + + \def\syst_helpers_group_quadruple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \the\t_syst_aux{}{}} + + \def\syst_helpers_group_quadruple_empty_four_nop + {\fourthargumentfalse + \the\t_syst_aux{}} + + \unexpanded\def\doquintuplegroupempty#1% + {\t_syst_aux{#1}% + \futureexpand\bgroup\syst_helpers_group_quintuple_empty_one_yes\syst_helpers_group_quintuple_empty_one_nop} + + \def\syst_helpers_group_quintuple_empty_one_yes#1% + {\firstargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_group_quintuple_empty_two_yes\syst_helpers_group_quintuple_empty_two_nop} + + \def\syst_helpers_group_quintuple_empty_two_yes#1% + {\secondargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_group_quintuple_empty_three_yes\syst_helpers_group_quintuple_empty_three_nop} + + \def\syst_helpers_group_quintuple_empty_three_yes#1% + {\thirdargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_group_quintuple_empty_four_yes\syst_helpers_group_quintuple_empty_four_nop} + + \def\syst_helpers_group_quintuple_empty_four_yes#1% + {\fourthargumenttrue + \toksapp\t_syst_aux{{#1}}% + \futureexpand\bgroup\syst_helpers_quintuple_empty_five_yes\syst_helpers_group_quintuple_empty_five_nop} + + \def\syst_helpers_group_quintuple_empty_one_nop + {\firstargumentfalse + \secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux{}{}{}{}{}} + + \def\syst_helpers_group_quintuple_empty_two_nop + {\secondargumentfalse + \thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux{}{}{}{}} + + \def\syst_helpers_group_quintuple_empty_three_nop + {\thirdargumentfalse + \fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux{}{}{}} + + \def\syst_helpers_group_quintuple_empty_four_nop + {\fourthargumentfalse + \fifthargumentfalse + \the\t_syst_aux{}{}} + + \def\syst_helpers_group_quintuple_empty_five_nop + {\fifthargumentfalse + \the\t_syst_aux{}} + +\stoplmtxmode %D These macros can explictly take care of spaces, which means %D that the next definition and calls are valid: @@ -3580,9 +4243,8 @@ %D secondoftwoarguments, secondofthreearguments, %D thirdofthreearguments} %D -%D The next six macros (dedicated to Taco) can conveniently -%D used to select arguments. Their names explain their -%D functionality. +%D The next six macros (dedicated to Taco) can conveniently used to select +%D arguments. Their names explain their functionality. \def\firstofoneargument #1{#1} @@ -3643,9 +4305,8 @@ %D \macros %D {wait} %D -%D The next macro hardly needs explanation. Because no -%D nesting is to be expected, we can reuse \type{\wait} within -%D \type{\wait} itself. +%D The next macro hardly needs explanation. Because no nesting is to be expected, we +%D can reuse \type {\wait} within \type {\wait} itself. \unexpanded\def\wait {\begingroup @@ -3656,10 +4317,9 @@ %D {writestring,writeline, %D writestatus,statuswidth,normalwritestatus} %D -%D Maybe one didn't notice, but we've already introduced a -%D macro for showing messages. In the multi||lingual modules, -%D we will also introduce a mechanism for message passing. For -%D the moment we stick to the core macros: +%D Maybe one didn't notice, but we've already introduced a macro for showing +%D messages. In the multi||lingual modules, we will also introduce a mechanism for +%D message passing. For the moment we stick to the core macros: %D %D \starttyping %D \writestring {string} @@ -3667,9 +4327,8 @@ %D \writestatus {category} {message} %D \stoptyping %D -%D Messages are formatted. One can provide the maximum with -%D of the identification string with the macro \type -%D {\statuswidth}. +%D Messages are formatted. One can provide the maximum with of the identification +%D string with the macro \type {\statuswidth}. \setnewconstant\statuswidth 15 \setnewconstant\statuswrite 128 % \pluscxxviii @@ -3705,8 +4364,7 @@ %D \macros %D {rawgetparameters} %D -%D A raw and dirty alternative for \type {\getparameters}; no -%D checking is done! +%D A raw and dirty alternative for \type {\getparameters}; no checking is done! \unexpanded\def\rawsetparameter#1=#2,% {\if]#1\else @@ -3729,13 +4387,11 @@ %D {doglobal, %D redoglobal,dodoglobal,resetglobal} %D -%D The two macros \type {\redoglobal} and \type{\dodoglobal} are -%D used in this and some other modules to enforce a user -%D specified \type {\doglobal} action. The last and often only -%D global assignment in a macro is done with -%D \type {\dodoglobal}, but all preceding ones with -%D \type {\redoglobal}. When using only alternatives, one can -%D reset this mechanism with \type {\resetglobal}. +%D The two macros \type {\redoglobal} and \type{\dodoglobal} are used in this and +%D some other modules to enforce a user specified \type {\doglobal} action. The last +%D and often only global assignment in a macro is done with \type {\dodoglobal}, but +%D all preceding ones with \type {\redoglobal}. When using only alternatives, one +%D can reset this mechanism with \type {\resetglobal}. \unexpanded\def\resetglobal {\let\redoglobal\relax @@ -3760,9 +4416,8 @@ {\let\redoglobal\syst_helpers_redo_global \let\dodoglobal\syst_helpers_dodo_global} -%D A very useful application of this macro is \type {\newif}, -%D \TEX's fake boolean type. Not being a primitive, -%D \type {\global} hopelessly fails here. But a slight +%D A very useful application of this macro is \type {\newif}, \TEX's fake boolean +%D type. Not being a primitive, \type {\global} hopelessly fails here. But a slight %D adaption of Knuth's original macro permits: %D %D \starttyping @@ -3776,8 +4431,7 @@ %D \global\testfalse %D \stoptyping %D -%D Apart from the prefixes, a few more \type{\expandafters} -%D are needed: +%D Apart from the prefixes, a few more \type {\expandafters} are needed: % \unexpanded\def\newif#1% uses the original plain \@if % {\privatescratchcounter\escapechar @@ -3955,9 +4609,9 @@ %D {newcounter, %D increment,decrement} %D -%D Unfortunately the number of \COUNTERS\ in \TEX\ is limited, -%D but fortunately we can store numbers in a macro. We can -%D increment such pseudo \COUNTERS\ with \type{\increment}. +%D Unfortunately the number of \COUNTERS\ in \TEX\ is limited, but fortunately we +%D can store numbers in a macro. We can increment such pseudo \COUNTERS\ with \type +%D {\increment}. %D %D \starttyping %D \increment(\counter,20) @@ -3966,9 +4620,8 @@ %D \increment\counter %D \stoptyping %D -%D After this sequence of commands, the value of -%D \type{\counter} is 20, 16, 17 and~18. Of course there is -%D also the complementary command \type{\decrement}. +%D After this sequence of commands, the value of \type {\counter} is 20, 16, 17 +%D and~18. Of course there is also the complementary command \type {\decrement}. %D %D Global assignments are possible too, using \type{\doglobal}: %D @@ -3976,36 +4629,32 @@ %D \doglobal\increment\counter %D \stoptyping %D -%D When \type{\counter} is undefined, it's value is initialized -%D at~0. It is nevertheless better to define a \COUNTER\ -%D explicitly. One reason could be that the \COUNTER\ can be -%D part of a test with \type{\ifnum} and this conditional does -%D not accept undefined macro's. The \COUNTER\ in our example -%D can for instance be defined with: +%D When \type {\counter} is undefined, it's value is initialized at~0. It is +%D nevertheless better to define a \COUNTER\ explicitly. One reason could be that +%D the \COUNTER\ can be part of a test with \type {\ifnum} and this conditional does +%D not accept undefined macro's. The \COUNTER\ in our example can for instance be +%D defined with: %D %D \starttyping %D \newcounter\counter %D \stoptyping %D -%D The command \type{\newcounter} must not be confused with -%D \type{\newcount}! Of course this mechanism is much slower -%D than using \TEX's \COUNTERS\ directly. In practice -%D \COUNTERS\ (and therefore our pseudo counters too) are -%D seldom the bottleneck in the processing of a text. Apart -%D from some other incompatilities we want to mention a pitfal -%D when using \type{\ifnum}. +%D The command \type {\newcounter} must not be confused with \type {\newcount}! Of +%D course this mechanism is much slower than using \TEX's \COUNTERS\ directly. In +%D practice \COUNTERS\ (and therefore our pseudo counters too) are seldom the +%D bottleneck in the processing of a text. Apart from some other incompatilities we +%D want to mention a pitfal when using \type {\ifnum}. %D %D \starttyping %D \ifnum\normalcounter=\pseudocounter \doif \else \doelse \fi %D \ifnum\pseudocounter=\normalcounter \doif \else \doelse \fi %D \stoptyping %D -%D In the first test, \TEX\ continues it's search for the -%D second number after reading \type{\pseudocounter}, while -%D in the second test, it stops reading after having -%D encountered a real one. Tests like the first one therefore -%D can give unexpected results, for instance execution -%D of \type{\doif} even if both numbers are unequal. +%D In the first test, \TEX\ continues it's search for the second number after +%D reading \type {\pseudocounter}, while in the second test, it stops reading after +%D having encountered a real one. Tests like the first one therefore can give +%D unexpected results, for instance execution of \type {\doif} even if both numbers +%D are unequal. \def\zerocountervalue{0} @@ -4021,34 +4670,39 @@ \def\syst_helpers_do_do_do_increment#1,#2){\dodoglobal\edef#1{\the\numexpr\ifdefined#1\ifx#1\relax\else#1\fi\fi+#2\relax}} \def\syst_helpers_do_do_do_decrement#1,#2){\dodoglobal\edef#1{\the\numexpr\ifdefined#1\ifx#1\relax\else#1\fi\fi-#2\relax}} -\def\syst_helpers_do_do_increment(#1{\doifelsenextchar,{\syst_helpers_do_do_do_increment#1}{\syst_helpers_do_do_do_increment#1,\plusone}} -\def\syst_helpers_do_do_decrement(#1{\doifelsenextchar,{\syst_helpers_do_do_do_decrement#1}{\syst_helpers_do_do_do_decrement#1,\plusone}} +\def\syst_helpers_do_do_increment(#1% + {\def\m_syst_action_yes{\syst_helpers_do_do_do_increment#1}% + \def\m_syst_action_nop{\syst_helpers_do_do_do_increment#1,\plusone}% + \doifelsenextcharcs,\m_syst_action_yes\m_syst_action_nop} + +\def\syst_helpers_do_do_decrement(#1% + {\def\m_syst_action_yes{\syst_helpers_do_do_do_decrement#1}% + \def\m_syst_action_nop{\syst_helpers_do_do_do_decrement#1,\plusone}% + \doifelsenextcharcs,\m_syst_action_yes\m_syst_action_nop} + +\unexpanded\def\increment{\doifelsenextcharcs(\syst_helpers_do_do_increment\syst_helpers_do_increment} +\unexpanded\def\decrement{\doifelsenextcharcs(\syst_helpers_do_do_decrement\syst_helpers_do_decrement} \unexpanded\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr#1+\plusone \relax}} \unexpanded\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr#1+\minusone\relax}} -\unexpanded\def\increment{\doifelsenextchar(\syst_helpers_do_do_increment\syst_helpers_do_increment} -\unexpanded\def\decrement{\doifelsenextchar(\syst_helpers_do_do_decrement\syst_helpers_do_decrement} - \unexpanded\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname} \unexpanded\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname} %D \macros %D {newsignal} %D -%D When writing advanced macros, we cannot do without -%D signaling. A signal is a small (invisible) kern or penalty -%D that signals the next macro that something just happened. -%D This macro can take any action depending on the previous -%D signal. Signals must be unique and the next macro takes care -%D of that. +%D When writing advanced macros, we cannot do without signaling. A signal is a small +%D (invisible) kern or penalty that signals the next macro that something just +%D happened. This macro can take any action depending on the previous signal. +%D Signals must be unique and the next macro takes care of that. %D %D \starttyping %D \newsignal\somesignal %D \stoptyping %D -%D Signals old dimensions and can be used in skips, kerns and -%D tests like \type{\ifdim}. +%D Signals old dimensions and can be used in skips, kerns and tests like \type +%D {\ifdim}. \newdimen\maximumsignal % step is about 0.00025pt @@ -4061,8 +4715,7 @@ %D \macros %D {strippedcsname} %D -%D The next macro can be very useful when using \type{\csname} -%D like in: +%D The next macro can be very useful when using \type {\csname} like in: %D %D \starttyping %D \csname if\strippedcsname\something\endcsname @@ -4091,21 +4744,18 @@ %D {dorecurse,recurselevel,recursedepth, %D dostepwiserecurse} %D -%D \TEX\ does not offer us powerfull for||loop mechanisms. On -%D the other hand its recursion engine is quite unique. We -%D therefore identify the for||looping macros by this method. -%D The most simple alternative is the one that only needs a -%D number. +%D \TEX\ does not offer us powerfull for||loop mechanisms. On the other hand its +%D recursion engine is quite unique. We therefore identify the for||looping macros +%D by this method. The most simple alternative is the one that only needs a number. %D %D \starttyping %D \dorecurse {n} {whatever we want} %D \stoptyping %D -%D This macro can be nested without problems and therefore be -%D used in situations where \PLAIN\ \TEX's \type{\loop} macro -%D ungracefully fails. The current value of the counter is -%D available in \type{\recurselevel}, before as well as after -%D the \typ{whatever we wat} stuff. +%D This macro can be nested without problems and therefore be used in situations +%D where \PLAIN\ \TEX's \type {\loop} macro ungracefully fails. The current value of +%D the counter is available in \type {\recurselevel}, before as well as after the +%D \typ {whatever we wat} stuff. %D %D \starttyping %D \dorecurse % inner loop @@ -4120,14 +4770,12 @@ %D \endgraf} %D \stoptyping %D -%D In this example the first, second and fourth -%D \type{\recurselevel} concern the outer loop, while the third -%D and fifth one concern the inner loop. The depth of the -%D nesting is available for inspection in \type{\recursedepth}. +%D In this example the first, second and fourth \type {\recurselevel} concern the +%D outer loop, while the third and fifth one concern the inner loop. The depth of +%D the nesting is available for inspection in \type {\recursedepth}. %D -%D Both \type{\recurselevel} and \type{\recursedepth} are -%D macros. The real \COUNTERS\ are hidden from the user because -%D we don't want any interference. +%D Both \type {\recurselevel} and \type {\recursedepth} are macros. The real +%D \COUNTERS\ are hidden from the user because we don't want any interference. \newcount\outerrecurse \newcount\innerrecurse @@ -4293,11 +4941,10 @@ %D \macros %D {doloop,exitloop} %D -%D Sometimes loops are not determined by counters, but by -%D (a combinations of) conditions. We therefore implement a -%D straightforward loop, which can only be left when we -%D explictly exit it. Nesting is supported. First we present -%D a more extensive alternative. +%D Sometimes loops are not determined by counters, but by (a combinations of) +%D conditions. We therefore implement a straightforward loop, which can only be left +%D when we explictly exit it. Nesting is supported. First we present a more +%D extensive alternative. %D %D \starttyping %D \doloop @@ -4305,8 +4952,7 @@ %D \ifnum\pageno>100 \exitloop \fi} %D \stoptyping %D -%D When needed, one can call for \type{\looplevel} and -%D \type{\loopdepth}. +%D When needed, one can call for \type {\looplevel} and \type {\loopdepth}. \let\endofloop\donothing % maybe \syst_helpers_loop_end @@ -4343,8 +4989,8 @@ %D \doloop {\exitloop some commands} %D \stoptyping %D -%D It's just a matter of putting the text into the \type{\if} -%D statement that should be there anyway, like in: +%D It's just a matter of putting the text into the \type {\if} statement that should +%D be there anyway, like in: %D %D \starttyping %D \doloop {\ifwhatever \exitloop \else some commands\fi} @@ -4354,10 +5000,9 @@ %D {\exitloopnow} instead. Beware, this is more sensitive %D for conditional errors. -%D Krzysztof Leszczynski suggested to provide access to the level by -%D means of a \type {#1}. I decided to pass the more frequently used -%D level as \type {#1} and the less favoured depth as \type {#2}. The -%D intended usage is: +%D Krzysztof Leszczynski suggested to provide access to the level by means of a +%D \type {#1}. I decided to pass the more frequently used level as \type {#1} and +%D the less favoured depth as \type {#2}. The intended usage is: %D %D \starttyping %D \dorecurse{3}{\definesymbol[test-#1][xx-#1]} @@ -4367,8 +5012,7 @@ %D \symbol[test-1]\quad\symbol[test-2]\quad\symbol[test-3] %D \stoptyping %D -%D Since the hashed arguments are expanded, we don't need tricky -%D expansion here. +%D Since the hashed arguments are expanded, we don't need tricky expansion here. %D %D \starttyping %D \dorecurse{3}{\expanded{\definesymbol[test-\recurselevel][xx-\recurselevel]}} @@ -4747,12 +5391,10 @@ \unexpanded\def\novalidassignment#1% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=\_e_t_x_\_e_t_x_\_e_o_t_} -%D In \ETEX\ we can use \type {\detokenize} and gain some -%D speed, but in general far less that 1\% for \type -%D {\convertargument} and nil for \type {\convertcommand}. -%D This macro is more robust than the pure \TEX\ one, -%D something I found out when primitives like \type -%D {\jobname} were fed (or something undefined). +%D In \ETEX\ we can use \type {\detokenize} and gain some speed, but in general far +%D less that 1\% for \type {\convertargument} and nil for \type {\convertcommand}. +%D This macro is more robust than the pure \TEX\ one, something I found out when +%D primitives like \type {\jobname} were fed (or something undefined). \unexpanded\def\convertargument#1\to#2{\dodoglobal\edef#2{\detokenize{#1}}} \unexpanded\def\convertcommand #1\to#2{\dodoglobal\edef#2{\expandafter\detokenize\expandafter{#1}}} % hm, only second is also ok @@ -4766,23 +5408,21 @@ \unexpanded\def\xdefconvertedargument#1#2{\xdef#1{#2}% \xdef#1{\detokenize\expandafter{#1}}} -%D When you try to convert a primitive command, you'll find -%D out that the \ETEX\ method fails on for instance \type -%D {\jobname} in the sense that it returns the filename -%D instead of just \type {\jobname}. So far this does not -%D give real problems. +%D When you try to convert a primitive command, you'll find out that the \ETEX\ +%D method fails on for instance \type {\jobname} in the sense that it returns the +%D filename instead of just \type {\jobname}. So far this does not give real +%D problems. -%D This is typically a macro that one comes to after reading -%D the \TEX book carefully. Even then, the definite solution -%D was found after rereading the \TEX book. The first -%D implementation was: +%D This is typically a macro that one comes to after reading the \TEX book +%D carefully. Even then, the definite solution was found after rereading the \TEX +%D book. The first implementation was: %D %D \starttyping %D \def\doconvertargument#1->#2\\\\{#2} %D \stoptyping %D -%D The \type{-}, the delimiter \type{\\\\} and the the second -%D argument are completely redundant. +%D The \type {-}, the delimiter \type {\\\\} and the the second argument are +%D completely redundant. %D \macros %D {showvalue} @@ -4799,10 +5439,9 @@ %D \macros %D {doifmeaningelse} %D -%D We can use both commands in testing, but alas, not all -%D meanings expand to something \type {->}. This is no problem -%D in the \ETEX\ implementation, but since we want -%D compatibility, we need: +%D We can use both commands in testing, but alas, not all meanings expand to +%D something \type {->}. This is no problem in the \ETEX\ implementation, but since +%D we want compatibility, we need: %D %D \starttyping %D \doifmeaningelse {\next} {\something} {true} {false} @@ -4825,9 +5464,9 @@ %D \macros %D {doifsamestringselse,doifsamestring,doifnotsamestring} %D -%D The next comparison macro converts the arguments into -%D expanded strings. This command can be used to compare for -%D instance \type {\jobname} with a name stored in a macro. +%D The next comparison macro converts the arguments into expanded strings. This +%D command can be used to compare for instance \type {\jobname} with a name stored +%D in a macro. %D %D \starttyping %D \doifelse {\jobname}{oeps}{YES}{NO} @@ -4848,18 +5487,17 @@ %D \macros %D {ConvertToConstant,ConvertConstantAfter} %D -%D When comparing arguments with a constant, we can get into -%D trouble when this argument consists of tricky expandable -%D commands. One solution for this is converting the -%D argument to a string of unexpandable characters. To make -%D comparison possible, we have to convert the constant too +%D When comparing arguments with a constant, we can get into trouble when this +%D argument consists of tricky expandable commands. One solution for this is +%D converting the argument to a string of unexpandable characters. To make +%D comparison possible, we have to convert the constant too. %D %D \starttyping %D \ConvertToConstant\doifelse {...} {...} {then ...} {else ...} %D \stoptyping %D -%D This construction is only needed when the first argument -%D can give troubles. Misuse can slow down processing. +%D This construction is only needed when the first argument can give troubles. +%D Misuse can slow down processing. %D %D \starttyping %D \ConvertToConstant\doifelse{\c!alfa} {\c!alfa}{...}{...} @@ -4868,16 +5506,14 @@ %D \ConvertToConstant\doifelse{alfa \alfa test}{\c!alfa}{...}{...} %D \stoptyping %D -%D In examples~2 and~3 both arguments equal, in~1 and~4 -%D they differ. +%D In examples~2 and~3 both arguments equal, in~1 and~4 they differ. \unexpanded\def\ConvertToConstant#1#2#3% {\edef\m_syst_string_one{\expandafter\detokenize\expandafter{#2}}% \edef\m_syst_string_two{\expandafter\detokenize\expandafter{#3}}% #1{\m_syst_string_one}{\m_syst_string_two}} -%D When the argument \type{#1} consists of commands, we had -%D better use +%D When the argument \type{#1} consists of commands, we had better use %D %D \starttyping %D \ConvertConstantAfter\processaction[#1][...] @@ -4892,8 +5528,7 @@ %D \hbox to \hsize{\rubish} %D \stoptyping %D -%D As we will see in the core modules, this macro permits -%D constructions like: +%D As we will see in the core modules, this macro permits constructions like: %D %D \starttyping %D \setupfootertexts[...][...] @@ -4901,7 +5536,7 @@ %D \setupfootertexts[\v!margin][...][...] %D \stoptyping %D -%D where \type{...} can be anything legally \TEX. +%D where \type {...} can be anything legally \TEX. \unexpanded\def\CheckConstantAfter#1#2% {\expandafter\convertargument\v!prefix!\to\ascii @@ -4933,33 +5568,28 @@ %D {gobbleuntil,grabuntil,gobbleuntilrelax, %D processbetween,processuntil} %D -%D In \TEX\ gobbling usually stand for skipping arguments, so -%D here are our gobbling macros. -%D -%D In \CONTEXT\ we use a lot of \type{\start}||\type{\stop} -%D like constructions. Sometimes, the \type{\stop} is used as a -%D hard coded delimiter like in: +%D In \TEX\ gobbling usually stand for skipping arguments, so here are our gobbling +%D macros. %D +%D In \CONTEXT\ we use a lot of \type {\start}||\type {\stop} like constructions. +%D Sometimes, the \type {\stop} is used as a hard coded delimiter like in: %D %D \starttyping %D \unexpanded\def\startcommand#1\stopcommand% %D {... #1 ...} %D \stoptyping %D -%D In many cases the \type{\start}||\type{\stop} pair is -%D defined at format generation time or during a job. This -%D means that we cannot hardcode the \type{\stop} criterium. -%D Only after completely understanding \type{\csname} and -%D \type{\expandafter} I was able to to implement a solution, -%D starting with: +%D In many cases the \type {\start}||\type {\stop} pair is defined at format +%D generation time or during a job. This means that we cannot hardcode the \type +%D {\stop} criterium. Only after completely understanding \type {\csname} and \type +%D {\expandafter} I was able to to implement a solution, starting with: %D %D \starttyping %D \grabuntil{stop}\command %D \stoptyping %D -%D This commands executes, after having encountered -%D \type {\stop} the command \type {\command}. This command -%D receives as argument the text preceding the \type {\stop}. -%D This means that: +%D This commands executes, after having encountered \type {\stop} the command \type +%D {\command}. This command receives as argument the text preceding the \type +%D {\stop}. This means that: %D %D \starttyping %D \unexpanded\def\starthello% @@ -5272,34 +5902,71 @@ % \unexpanded\def\pickupgroupedcommand#1#2#3% % {\doifelsenextbgroup{\syst_helpers_handle_group_pickup{#1}{#2}{#3}}{\syst_helpers_handle_group_nop{#1}{#2}}} -\unexpanded\def\groupedcommand#1#2% - {\def\m_syst_helpers_handle_group_b{#1}% - \def\m_syst_helpers_handle_group_a{#2}% - \doifelsenextbgroupcs\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop} +\startmkivmode + + \unexpanded\def\groupedcommand#1#2% + {\def\m_syst_helpers_handle_group_b{#1}% + \def\m_syst_helpers_handle_group_a{#2}% + \doifelsenextbgroupcs\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop} + + \unexpanded\def\groupedcommandcs#1#2% + {\let\m_syst_helpers_handle_group_b#1% + \let\m_syst_helpers_handle_group_a#2% + \doifelsenextbgroupcs\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop} + + \unexpanded\def\simplegroupedcommand#1#2% + {\def\m_syst_helpers_handle_group_b{#1}% + \def\m_syst_helpers_handle_group_a{#2}% + \doifelsenextbgroupcs\syst_helpers_handle_group_simple\syst_helpers_handle_group_nop} + + \unexpanded\def\pickupgroupedcommand#1#2#3% + {\def\m_syst_helpers_handle_group_b{#1}% + \def\m_syst_helpers_handle_group_a{#2}% + \def\m_syst_helpers_handle_group_p{#2}% + \doifelsenextbgroupcs\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop} + + \unexpanded\def\triggergroupedcommand#1% + {\def\m_syst_helpers_handle_group_b{#1}% + \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} + + \unexpanded\def\triggergroupedcommandcs#1% + {\let\m_syst_helpers_handle_group_b#1% + \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\groupedcommand#1#2% + {\def\m_syst_helpers_handle_group_b{#1}% + \def\m_syst_helpers_handle_group_a{#2}% + \futureexpandis\bgroup\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop} -\unexpanded\def\groupedcommandcs#1#2% - {\let\m_syst_helpers_handle_group_b#1% - \let\m_syst_helpers_handle_group_a#2% - \doifelsenextbgroupcs\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop} + \unexpanded\def\groupedcommandcs#1#2% + {\let\m_syst_helpers_handle_group_b#1% + \let\m_syst_helpers_handle_group_a#2% + \futureexpandis\bgroup\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop} -\unexpanded\def\simplegroupedcommand#1#2% - {\def\m_syst_helpers_handle_group_b{#1}% - \def\m_syst_helpers_handle_group_a{#2}% - \doifelsenextbgroupcs\syst_helpers_handle_group_simple\syst_helpers_handle_group_nop} + \unexpanded\def\simplegroupedcommand#1#2% + {\def\m_syst_helpers_handle_group_b{#1}% + \def\m_syst_helpers_handle_group_a{#2}% + \futureexpandis\bgroup\syst_helpers_handle_group_simple\syst_helpers_handle_group_nop} -\unexpanded\def\pickupgroupedcommand#1#2#3% - {\def\m_syst_helpers_handle_group_b{#1}% - \def\m_syst_helpers_handle_group_a{#2}% - \def\m_syst_helpers_handle_group_p{#2}% - \doifelsenextbgroupcs\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop} + \unexpanded\def\pickupgroupedcommand#1#2#3% + {\def\m_syst_helpers_handle_group_b{#1}% + \def\m_syst_helpers_handle_group_a{#2}% + \def\m_syst_helpers_handle_group_p{#2}% + \futureexpandis\bgroup\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop} -\unexpanded\def\triggergroupedcommand#1% - {\def\m_syst_helpers_handle_group_b{#1}% - \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} + \unexpanded\def\triggergroupedcommand#1% + {\def\m_syst_helpers_handle_group_b{#1}% + \futureexpandis\bgroup\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} -\unexpanded\def\triggergroupedcommandcs#1% - {\let\m_syst_helpers_handle_group_b#1% - \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} + \unexpanded\def\triggergroupedcommandcs#1% + {\let\m_syst_helpers_handle_group_b#1% + \futureexpandis\bgroup\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} + +\stoplmtxmode %D Users should be aware of the fact that grouping can interfere with ones paragraph %D settings that are executed after the paragraph is closed. One should therefore @@ -5314,19 +5981,17 @@ %D \macros %D {checkdefined} %D -%D The bigger the system, the greater the change that -%D user defined commands collide with those that are part of -%D the system. The next macro gives a warning when a command is -%D already defined. We considered blocking the definition, but -%D this is not always what we want. +%D The bigger the system, the greater the change that user defined commands collide +%D with those that are part of the system. The next macro gives a warning when a +%D command is already defined. We considered blocking the definition, but this is +%D not always what we want. %D %D \starttyping %D \checkdefined {category} {class} {command} %D \stoptyping %D -%D The user is warned with the suggestion to use -%D \type{CAPITALS}. This suggestion is feasible, because -%D \CONTEXT only defines lowcased macros. +%D The user is warned with the suggestion to use \type {CAPITALS}. This suggestion +%D is feasible, because \CONTEXT only defines lowcased macros. \unexpanded\def\showdefinederror#1#2% {\writestatus\m!system{#1 #2 replaces a macro, use CAPITALS!}} @@ -5337,10 +6002,9 @@ %D \macros %D {GotoPar,GetPar} %D -%D Typesetting a paragraph in a special way can be done by -%D first grabbing the contents of the paragraph and processing -%D this contents grouped. The next macro for instance typesets -%D a paragraph in boldface. +%D Typesetting a paragraph in a special way can be done by first grabbing the +%D contents of the paragraph and processing this contents grouped. The next macro +%D for instance typesets a paragraph in boldface. %D %D \starttyping %D \def\remark#1\par% @@ -5353,13 +6017,12 @@ %D \remark some text ... ending with \par %D \stoptyping %D -%D Instead of \type{\par} we can of course use an empty line. -%D When we started typesetting with \TEX, we already had -%D produced lots of text in plain \ASCII. In producing such -%D simple formatted texts, we adopted an open layout, and when -%D switching to \TEX, we continued this open habit. Although -%D \TEX\ permits a cramped and badly formatted source, it adds -%D to confusion and sometimes introduces errors. So we prefer: +%D Instead of \type {\par} we can of course use an empty line. When we started +%D typesetting with \TEX, we already had produced lots of text in plain \ASCII. In +%D producing such simple formatted texts, we adopted an open layout, and when +%D switching to \TEX, we continued this open habit. Although \TEX\ permits a cramped +%D and badly formatted source, it adds to confusion and sometimes introduces errors. +%D So we prefer: %D %D \starttyping %D \remark @@ -5367,9 +6030,8 @@ %D some text ... ending with an empty line %D \stoptyping %D -%D We are going to implement a mechanism that allows such open -%D specifications. The definition of the macro handling -%D \type{\remark} becomes: +%D We are going to implement a mechanism that allows such open specifications. The +%D definition of the macro handling \type {\remark} becomes: %D %D \starttyping %D \def\remark% @@ -5378,15 +6040,13 @@ %D \GetPar} %D \stoptyping %D -%D A macro like \type{\GetPar} can be defined in several -%D ways. The recent version, the fourth one in a row, -%D originally was far more complicated, but some functionality -%D has been moved to other macros. +%D A macro like \type {\GetPar} can be defined in several ways. The recent version, +%D the fourth one in a row, originally was far more complicated, but some +%D functionality has been moved to other macros. %D -%D We start with the more simple but in some cases more -%D appropriate alternative is \type{\GotoPar}. This one leaves -%D \type{\par} unchanged and is therefore more robust. On the -%D other hand, \type{\AfterPar} is not supported. +%D We start with the more simple but in some cases more appropriate alternative is +%D \type {\GotoPar}. This one leaves \type {\par} unchanged and is therefore more +%D robust. On the other hand, \type {\AfterPar} is not supported. \newtoks\BeforePar \newtoks\AfterPar @@ -5427,12 +6087,10 @@ %D \macros %D {dowithpargument,dowithwargument} %D -%D The next macros are a variation on \type{\GetPar}. When -%D macros expect an argument, it interprets a grouped sequence -%D of characters a one token. While this adds to robustness and -%D less ambiguous situations, we sometimes want to be a bit -%D more flexible, or at least want to be a bit more tolerant -%D to user input. +%D The next macros are a variation on \type {\GetPar}. When macros expect an +%D argument, it interprets a grouped sequence of characters a one token. While this +%D adds to robustness and less ambiguous situations, we sometimes want to be a bit +%D more flexible, or at least want to be a bit more tolerant to user input. %D %D We start with a commands that acts on paragraphs. This %D command is called as: @@ -5442,11 +6100,10 @@ %D \dowithpargument{\command ... } %D \stoptyping %D -%D In \CONTEXT\ we use this one to read in the titles of -%D chapters, sections etc. The commands responsible for these -%D activities accept several alternative ways of argument -%D passing. In these examples, the \type{\par} can be omitted -%D when an empty line is present. +%D In \CONTEXT\ we use this one to read in the titles of chapters, sections etc. The +%D commands responsible for these activities accept several alternative ways of +%D argument passing. In these examples, the \type {\par} can be omitted when an +%D empty line is present. %D %D \starttyping %D \command{...} @@ -5465,18 +6122,16 @@ \def\syst_helpers_next_arg##1{#1{##1}}% \doifelsenextbgroup\syst_helpers_next_arg{\doifelsenextchar\par{#1{}}\syst_helpers_next_par}} -%D The \type{p} in the previous command stands for paragraph. -%D When we want to act upon words we can use the \type{w} -%D alternative. +%D The \type {p} in the previous command stands for paragraph. When we want to act +%D upon words we can use the \type{w} alternative. %D %D \starttyping %D \dowithwargument\command %D \dowithwargument{... \command ...} %D \stoptyping %D -%D The main difference bwteen two alternatives is in the -%D handling of \type{\par}'s. This time the space token acts -%D as a delimiter. +%D The main difference bwteen two alternatives is in the handling of \type {\par}'s. +%D This time the space token acts as a delimiter. %D %D \starttyping %D \command{...} @@ -5498,9 +6153,8 @@ %D \macros %D {dorepeat,dorepeatwithcommand} %D -%D When doing repetitive tasks, we stromgly advice to use -%D \type{\dorecurse}. The next alternative however, suits -%D better some of the \CONTEXT\ interface commands. +%D When doing repetitive tasks, we stromgly advice to use \type {\dorecurse}. The +%D next alternative however, suits better some of the \CONTEXT\ interface commands. %D %D \starttyping %D \dorepeat[n*\command] @@ -5521,9 +6175,9 @@ %D \dorepeatwithcommand[3*{Hello}]\message %D \stoptyping %D -%D we get ourselves three \type{\message{Hello}} messages in -%D a row. In both commands, the \type{n*} is optional. When this -%D specification is missing, the command executes once. +%D we get ourselves three \type {\message{Hello}} messages in a row. In both +%D commands, the \type {n*} is optional. When this specification is missing, the +%D command executes once. \unexpanded\def\dorepeatwithcommand[#1]% {\syst_helpers_repeat_with_command#1*\empty*\relax} @@ -5567,8 +6221,8 @@ %D \macros %D {doifstringinstringelse} %D -%D The next macro is meant for situations where both strings -%D are macros. This save some unneeded expansion. +%D The next macro is meant for situations where both strings are macros. This save +%D some unneeded expansion. %D %D \starttyping %D \def\doifstringinstringelse#1#2% @@ -5599,9 +6253,8 @@ %D {appendtoks,prependtoks,appendtoksonce,prependtoksonce, %D doifintokselse,flushtoks,dotoks} %D -%D We use \TOKENLISTS\ sparsely within \CONTEXT, because the -%D comma separated lists are more suitable for the user -%D interface. Nevertheless we have: +%D We use tokenlists sparsely within \CONTEXT, because the comma separated lists are +%D more suitable for the user interface. Nevertheless we have: %D %D \starttyping %D (\doglobal) \appendtoks ... \to\tokenlist @@ -5610,8 +6263,7 @@ %D \dotoks\tokenlist %D \stoptyping %D -%D These macros are clones of the ones implemented in page~378 of -%D Knuth's \TeX book. +%D These macros are clones of the ones implemented in page~378 of Knuth's \TEX book. \newtoks\t_syst_helpers_scratch \let \m_syst_helpers_scratch\empty @@ -5653,29 +6305,61 @@ % \donothing % \syst_helpers_prepend_toks_indeed} +% \unexpanded\def\appendtoks#1\to#2% +% {\toksapp#2{#1}% +% \ifx\dodoglobal\relax\else +% \dodoglobal#2#2% +% \fi} +% +% \unexpanded\def\prependtoks#1\to#2% +% {\tokspre#2{#1}% +% \ifx\dodoglobal\relax\else +% \dodoglobal#2#2% +% \fi} +% +% \def\syst_helpers_append_toks_indeed +% {\toksapp\m_syst_helpers_scratch\t_syst_helpers_scratch +% \ifx\dodoglobal\relax\else +% \dodoglobal\m_syst_helpers_scratch\m_syst_helpers_scratch +% \fi} +% +% \def\syst_helpers_prepend_toks_indeed +% {\tokspre\m_syst_helpers_scratch\t_syst_helpers_scratch +% \ifx\dodoglobal\relax\else +% \dodoglobal\m_syst_helpers_scratch\m_syst_helpers_scratch +% \fi} + \unexpanded\def\appendtoks#1\to#2% - {\toksapp#2{#1}% - \ifx\dodoglobal\relax\else - \global#2#2% - \fi} + {\ifx\dodoglobal\relax + \expandafter\toksapp + \else + \resetglobal + \expandafter\gtoksapp + \fi#2{#1}} \unexpanded\def\prependtoks#1\to#2% - {\tokspre#2{#1}% - \ifx\dodoglobal\relax\else - \global#2#2% - \fi} + {\ifx\dodoglobal\relax + \expandafter\tokspre + \else + \resetglobal + \expandafter\gtokspre + \fi#2{#1}} \def\syst_helpers_append_toks_indeed - {\toksapp\m_syst_helpers_scratch\t_syst_helpers_scratch - \ifx\dodoglobal\relax\else - \global\m_syst_helpers_scratch\m_syst_helpers_scratch - \fi} + {\ifx\dodoglobal\relax + \expandafter\toksapp + \else + \resetglobal + \expandafter\gtoksapp + \fi\m_syst_helpers_scratch\t_syst_helpers_scratch} \def\syst_helpers_prepend_toks_indeed - {\tokspre\m_syst_helpers_scratch\t_syst_helpers_scratch - \ifx\dodoglobal\relax\else - \global\m_syst_helpers_scratch\m_syst_helpers_scratch - \fi} + {\ifx\dodoglobal\relax + \expandafter\tokspre + \else + \resetglobal + \expandafter\gtokspre + \fi\m_syst_helpers_scratch\t_syst_helpers_scratch} \unexpanded\def\appendtoksonce#1\to#2% {\let\m_syst_helpers_scratch#2% @@ -5700,9 +6384,9 @@ \let\doifintokselse\doifelseintoks -%D Moved from \type{lxml-ini.tex} to here. This one is for generators that -%D collect stuff piecewise, which is sometimes hard on mechanisms that -%D grab content using delimiters: +%D Moved from \type {lxml-ini.tex} to here. This one is for generators that collect +%D stuff piecewise, which is sometimes hard on mechanisms that grab content using +%D delimiters: %D %D \starttyping %D \startcollecting @@ -5749,17 +6433,33 @@ % \unexpanded\def\appendetoks #1\to{\normalexpanded{\appendtoks #1}\to} % \unexpanded\def\prependetoks#1\to{\normalexpanded{\prependtoks#1}\to} +% \unexpanded\def\appendetoks#1\to#2% +% {\etoksapp#2{#1}% +% \ifx\dodoglobal\relax\else +% \global#2#2% +% \fi} +% +% \unexpanded\def\prependetoks#1\to#2% +% {\etokspre#2{#1}% +% \ifx\dodoglobal\relax\else +% \global#2#2% +% \fi} + \unexpanded\def\appendetoks#1\to#2% - {\etoksapp#2{#1}% - \ifx\dodoglobal\relax\else - \global#2#2% - \fi} + {\ifx\dodoglobal\relax + \expandafter\etoksapp + \else + \resetglobal + \expandafter\xtoksapp + \fi#2{#1}} \unexpanded\def\prependetoks#1\to#2% - {\etokspre#2{#1}% - \ifx\dodoglobal\relax\else - \global#2#2% - \fi} + {\ifx\dodoglobal\relax + \expandafter\etokspre + \else + \resetglobal + \expandafter\xtokspre + \fi#2{#1}} %D Hm. @@ -5783,11 +6483,10 @@ %D \aftersplitstring test.tex\at.\to\extension %D \stoptyping %D -%D The first routine looks (and is indeed) a bit simpler than -%D the second one. The alternative looking more or less like -%D the first one did not always give the results we needed. -%D Both implementations show some insight in the manipulation -%D of arguments. +%D The first routine looks (and is indeed) a bit simpler than the second one. The +%D alternative looking more or less like the first one did not always give the +%D results we needed. Both implementations show some insight in the manipulation of +%D arguments. \let\syst_helpers_split_string\relax @@ -5892,10 +6591,9 @@ %D {appendtocommalist,prependtocommalist, %D addtocommalist,removefromcommalist} %D -%D When working with comma separated lists, one sooner or -%D later want the tools to append or remove items from such a -%D list. When we add an item, we first check if it's already -%D there. This means that every item in the list is unique. +%D When working with comma separated lists, one sooner or later want the tools to +%D append or remove items from such a list. When we add an item, we first check if +%D it's already there. This means that every item in the list is unique. %D %D \starttyping %D \addtocommalist {alfa} \name @@ -5904,22 +6602,18 @@ %D \removefromcommalist {beta} \name %D \stoptyping %D -%D These commands can be prefixed with \type{\doglobal}. The -%D implementation of the second command is more complecated, -%D because we have to take leading spaces into account. Keep in -%D mind that users may provide lists with spaces after the -%D commas. When one item is left, we also have to get rid of -%D trailing spaces. +%D These commands can be prefixed with \type {\doglobal}. The implementation of the +%D second command is more complecated, because we have to take leading spaces into +%D account. Keep in mind that users may provide lists with spaces after the commas. +%D When one item is left, we also have to get rid of trailing spaces. %D %D \starttyping %D \def\words{alfa, beta, gamma, delta} %D \def\words{alfa,beta,gamma,delta} %D \stoptyping %D -%D Removing an item takes more time than adding one. -%D -%D A fast appending alternative, without any testing, is -%D also provided: +%D Removing an item takes more time than adding one. A fast appending alternative, +%D without any testing, is also provided: %D %D \starttyping %D \appendtocommalist {something} \name @@ -6005,8 +6699,7 @@ %D \macros %D {substituteincommalist} %D -%D Slow but seldom used, so for the moment we stick to this -%D implementation. +%D Slow but seldom used, so for the moment we stick to this implementation. %D %D \starttyping %D \substituteincommalist{old}{new}{list} @@ -6096,10 +6789,9 @@ %D \macros %D {globalprocesscommalist} %D -%D The commalist processing commands are characterized by the -%D fact that the way they handle expansion as well as the fact -%D that they can be nested. This makes them kind of useless for -%D handling comma lists in alignments. In these situations the +%D The commalist processing commands are characterized by the fact that the way they +%D handle expansion as well as the fact that they can be nested. This makes them +%D kind of useless for handling comma lists in alignments. In these situations the %D next macro can be of use. \let\m_syst_helpers_comma_list_command_global\empty @@ -6132,13 +6824,11 @@ \def\withoutpt#1% {\expandafter\WITHOUTPT#1} -%D The capitals are needed because \type{p} and \type{t} have -%D \CATCODE~12, while macronames only permit tokens with the -%D \CATCODE~11. As a result we cannot use the \type{.group} -%D primitives. Those who want to know more about this kind of -%D manipulations, we advice to study the \TEX book in detail. -%D Because this macro does not do any assignment, we can use it -%D in the following way too. +%D The capitals are needed because \type {p} and \type {t} have catcode~12, while +%D macronames only permit tokens with the catcode~11. As a result we cannot use the +%D \type {.group} primitives. Those who want to know more about this kind of +%D manipulations, we advice to study the \TEX book in detail. Because this macro +%D does not do any assignment, we can use it in the following way too. \def\PtToCm#1% {\withoutpt\the\dimexpr0.0351459804\dimexpr#1\relax\relax cm} @@ -6162,8 +6852,8 @@ %D {swapdimens,swapcounts,swapmacros, %D globalswapdimens,globalswapcounts,globalswapmacros} %D -%D Simple but effective are the next two macros. There name -%D exactly states their purpose. +%D Simple but effective are the next two macros. There name exactly states their +%D purpose. \newdimen\d_syst_helpers_swapped \newcount\c_syst_helpers_swapped @@ -6275,10 +6965,9 @@ %D \macros %D {setlocalhsize,distributedhsize} %D -%D Sometimes we need to work with the \type{\hsize} that is -%D corrected for indentation and left and right skips. The -%D corrected value is available in \type{\localhsize}, which -%D needs to be calculated with \type{\setlocalhsize} first. +%D Sometimes we need to work with the \type{ \hsize} that is corrected for +%D indentation and left and right skips. The corrected value is available in \type +%D {\localhsize}, which needs to be calculated with \type {\setlocalhsize} first. %D %D %D \starttyping %D \setlocalhsize \hbox to \localhsize{...} @@ -6286,8 +6975,8 @@ %D \setlocalhsize[.5ex] \hbox to \localhsize{...} %D \stoptyping %D -%D These examples show us that an optional can be used. The -%D value provided is added to \type{\localhsize}. +%D These examples show us that an optional can be used. The value provided is added +%D to \type {\localhsize}. \newdimen\localhsize @@ -6322,11 +7011,10 @@ %D doifnothing,doifsomething,doifelsenothing, %D doifvaluenothing,doifvaluesomething,doifelsevaluenothing} %D -%D These long named \type{\if} commands can be used to access -%D macros (or variables) that are normally accessed by using -%D \type{\getvalue}. Using these alternatives safes us three -%D tokens per call. Anyone familiar with the not||values -%D ones, can derive their meaning from the definitions. +%D These \type {\if} commands can be used to access macros (or variables) that are +%D normally accessed by using \type {\getvalue}. Using these alternatives safes us +%D three tokens per call. Anyone familiar with the not||values ones, can derive +%D their meaning from the definitions. \unexpanded\def\doifvalue#1#2% {\edef\m_syst_string_one{\csname#1\endcsname}% @@ -6447,9 +7135,8 @@ %D \macros %D {doifallcommonelse} %D -%D A complete match of two sets can be tested with -%D \type {\doifallcommonelse}, where the first two -%D arguments are sets. +%D A complete match of two sets can be tested with \type {\doifallcommonelse}, where +%D the first two arguments are sets. \def\syst_helpers_do_if_all_common_else#1#2#3#4% slow {\def\syst_helpers_do_common_check_all##1% @@ -6468,10 +7155,9 @@ %D \macros %D {DOIF,DOIFELSE,DOIFNOT} %D -%D \TEX\ is case sensitive. When comparing arguments, this -%D feature sometimes is less desirable, for instance when we -%D compare filenames. The next three alternatives upcase their -%D arguments before comparing them. +%D \TEX\ is case sensitive. When comparing arguments, this feature sometimes is less +%D desirable, for instance when we compare filenames. The next three alternatives +%D upcase their arguments before comparing them. %D %D \starttyping %D \DOIF {string1} {string2} {...} @@ -6523,8 +7209,7 @@ %D dodoubleargumentwithset,dodoubleemptywithset, %D dotripleargumentwithset,dotripleemptywithset} %D -%D These maybe too mysterious macros enable us to handle more -%D than one setup at once. +%D These maybe too mysterious macros enable us to handle more than one setup at once. %D %D \starttyping %D \dosingleargumentwithset \command[#1] @@ -6534,10 +7219,9 @@ %D \dotripleemptywithset \command[#1][#2][#3] %D \stoptyping %D -%D The first macro calls \type{\command[##1]} for each string -%D in the set~\type{#1}. The second one calls for -%D \type{\commando[##1][#2]} and the third, well one may guess. -%D These commands support constructions like: +%D The first macro calls \type {\command[##1]} for each string in the set~\type +%D {#1}. The second one calls for \typ {\command [##1][#2]} and the third, well one +%D may guess. These commands support constructions like: %D %D \starttyping %D \def\dodefinesomething[#1][#2]% @@ -6575,13 +7259,11 @@ %D \macros %D {stripcharacters,stripspaces} %D -%D The next command was needed first when we implemented -%D the \CONTEXT\ interactivity macros. When we use labeled -%D destinations, we often cannot use all the characters we -%D want. We therefore strip some of the troublemakers, like -%D spaces, from the labels before we write them to the -%D \DVI||file, which passes them to for instance a PostScript -%D file. +%D The next command was needed first when we implemented the \CONTEXT\ interactivity +%D macros. When we use labeled destinations, we often cannot use all the characters +%D we want. We therefore strip some of the troublemakers, like spaces, from the +%D labels before we write them to the \DVI||file, which passes them to for instance +%D a \POSTSCRIPT\ file. %D %D \starttyping %D \stripspaces\from\one\to\two @@ -6594,8 +7276,8 @@ %D \stripcharacter\char\from\one\to\two %D \stoptyping %D -%D As we can see below, spaces following a control sequence are -%D to enclosed in \type{{}}. +%D As we can see below, spaces following a control sequence are to enclosed in \type +%D {{}}. \let\m_syst_helpers_strip_character\empty @@ -6614,8 +7296,8 @@ %D \macros %D {unspacestring} %D -%D The next macro does the same but is more compatible with other macros, -%D like \type {\convert...}. +%D The next macro does the same but is more compatible with other macros, like \type +%D {\convert...}. \unexpanded\def\unspacestring#1\to#2% {\stripcharacter{ }\from#1\to#2} @@ -6623,22 +7305,19 @@ %D \macros %D {executeifdefined} %D -%D \CONTEXT\ uses one auxiliary file for all data concerning -%D tables of contents, references, two||pass optimizations, -%D sorted lists etc. This file is loaded as many times as -%D needed. During such a pass we skip the commands thate are of -%D no use at that moment. Because we don't want to come into -%D trouble with undefined auxiliary commands, we call the -%D macros in a way similar to \type{\getvalue}. The next macro -%D take care of such executions and when not defined, gobbles -%D the unwanted arguments. +%D \CONTEXT\ uses one auxiliary file for all data concerning tables of contents, +%D references, two||pass optimizations, sorted lists etc. This file is loaded as +%D many times as needed. During such a pass we skip the commands thate are of no use +%D at that moment. Because we don't want to come into trouble with undefined +%D auxiliary commands, we call the macros in a way similar to \type {\getvalue}. The +%D next macro take care of such executions and when not defined, gobbles the +%D unwanted arguments. %D %D \starttyping %D \executeifdefined{name}\gobbleoneargument %D \stoptyping %D -%D We can of course gobble more arguments using the -%D appropriate gobbling command. +%D We can of course gobble more arguments using the appropriate gobbling command. \def\executeifdefined#1% #2 / never change this one again {\ifcsname#1\endcsname @@ -6648,22 +7327,21 @@ \expandafter\firstofoneargument \fi} -%D This one also has the advantage that it is fully -%D expandable and that it can be used after an assignment. +%D This one also has the advantage that it is fully expandable and that it can be +%D used after an assignment. %D \macros %D {doifsomespaceelse} %D -%D The next command checks a string on the presence of a space -%D and executed a command accordingly. +%D The next command checks a string on the presence of a space and executed a +%D command accordingly. %D %D \starttyping %D \doifsomespaceelse {tekst} {then ...} {else ...} %D \stoptyping %D -%D We use this command in \CONTEXT\ for determing if an -%D argument must be broken into words when made interactive. -%D Watch the use of \type{\noexpand}. +%D We use this command in \CONTEXT\ for determing if an argument must be broken into +%D words when made interactive. Watch the use of \type {\noexpand}. %D Is this one still needed? @@ -6681,9 +7359,9 @@ %D \macros %D {processseparatedlist} %D -%D Maybe a bit late, but here is a more general version of the -%D \type{\processcommalist} command. This time we don't handle -%D nesting but accept arbitrary seperators. +%D Maybe a bit late, but here is a more general version of the \type +%D {\processcommalist} command. This time we don't handle nesting but accept +%D arbitrary seperators. %D %D \starttyping %D \processseparatedlist[list][separator]\command @@ -6706,8 +7384,8 @@ %D %D \typebuffer \getbuffer %D -%D Therefore we smuggle a \type {\relax} in front of the -%D argument, which we remove afterwards. +%D Therefore we smuggle a \type {\relax} in front of the argument, which we remove +%D afterwards. \let\syst_helpers_process_separated_list_step\relax @@ -6738,8 +7416,8 @@ %D \processlist{beginsym}{endsym}{separator}\docommand list %D \stoptyping %D -%D This one supports arbitrary open and close symbols as well as user -%D defined separators. +%D This one supports arbitrary open and close symbols as well as user defined +%D separators. %D %D \starttyping %D \processlist(){=>}\docommand(a=>b=>c=>d) @@ -6768,16 +7446,15 @@ %D \macros %D {processassignlist} %D -%D Is possible to combine an assignment list with one -%D containing keywords. Assignments are treated accordingly, -%D keywords are treated by \type{\command}. +%D Is possible to combine an assignment list with one containing keywords. +%D Assignments are treated accordingly, keywords are treated by \type {\command}. %D %D \starttyping %D \processassignlist[...=...,...=...,...]\commando %D \stoptyping %D -%D This command can be integrated in \type{\getparameters}, but -%D we decided best not to do so. +%D This command can be integrated in \type {\getparameters}, but we decided best not +%D to do so. \unexpanded\def\processassignlist#1[#2]#3% {\def\syst_helpers_process_assign_list_assign[##1=##2=##3]% @@ -6790,16 +7467,15 @@ %D {untextargument %D untexcommand} %D -%D When manipulating data(bases) and for instance generating -%D index entries, the next three macros can be of help: +%D When manipulating data(bases) and for instance generating index entries, the next +%D three macros can be of help: %D %D \starttyping %D \untextargument{...}\to\name %D \untexcommand {...}\to\name %D \stoptyping %D -%D They remove braces and backslashes and give us something to -%D sort. +%D They remove braces and backslashes and give us something to sort. \let\m_syst_helpers_untexed\empty @@ -6830,7 +7506,6 @@ %D \ScaledPointsToWholeBigPoints {number} \target %D \stoptyping %D - %D In pure \TEX: % \unexpanded\def\PointsToBigPoints#1#2% @@ -6872,16 +7547,15 @@ %D \macros %D {dontleavehmode} %D -%D Sometimes when we enter a paragraph with some command, the -%D first token gets the whole first line. We can prevent this -%D by saying: +%D Sometimes when we enter a paragraph with some command, the first token gets the +%D whole first line. We can prevent this by saying: %D %D \starttyping %D \dontleavehmode %D \stoptyping %D -%D This command is used in for instance the language module -%D \type{lang-ini}. The first version was: +%D This command is used in for instance the language module \type {lang-ini}. The +%D first version was: %D %D \starttyping %D \def\dontleavehmode{\ifhmode\else\ifmmode\else$ $\fi\fi} @@ -6896,8 +7570,8 @@ %D \fi \fi} %D \stoptyping %D -%D And finaly we got the following alternative, one that avoids -%D interfering grouping at the cost of a box. +%D And finaly we got the following alternative, one that avoids interfering grouping +%D at the cost of a box. %D %D \starttyping %D \newbox\b_syst_helpers_dlh @@ -6930,8 +7604,8 @@ % \unexpanded\def\lowercasestring#1\to#2% % {\lowercase\expandafter{\expandafter\dodoglobal\expandafter\edef\expandafter#2\expandafter{\normalexpanded{#1}}}} -%D These macros are sort of obsolete as we never use uppercase this -%D way. But nevertheless we provide them: +%D These macros are sort of obsolete as we never use uppercase this way. But +%D nevertheless we provide them: \def\utfupper#1{\clf_upper{#1}} % expandable \def\utflower#1{\clf_lower{#1}} % expandable @@ -6942,8 +7616,8 @@ %D \macros %D {handletokens} %D -%D With the next macro we enter a critical area of macro -%D expansion. What we want is a macro that looks like: +%D With the next macro we enter a critical area of macro expansion. What we want is +%D a macro that looks like: %D %D \starttyping %D \handletokens some tokens\with \somemacro @@ -6962,17 +7636,16 @@ %D \macros %D {counttoken,counttokens} %D -%D For the few occasions that we want to know the number of -%D specific tokens in a string, we can use: +%D For the few occasions that we want to know the number of specific tokens in a +%D string, we can use: %D %D \starttyping %D \counttoken token\in string\to \somecount %D \counttokens string\to \somecount %D \stoptyping %D -%D This macro, that for instance is used in \type{cont-tab}, -%D takes a real counter. The macro can be preceded by \type -%D {\doglobal}. +%D This macro, that for instance is used in \type {cont-tab}, takes a real counter. +%D The macro can be preceded by \type {\doglobal}. \def\syst_helpers_count_token#1% obeys {} {\def\m_syst_string_three{#1}% @@ -6999,9 +7672,8 @@ %D \macros %D {splitofftokens} %D -%D Running this one not always gives the expected results. -%D Consider for instance the macro for which I originally -%D wrote this token handler. +%D Running this one not always gives the expected results. Consider for instance the +%D macro for which I originally wrote this token handler. \unexpanded\def\splitofftokens#1\from#2\to#3% slow but hardly used {\ifnum#1>\zerocount @@ -7024,10 +7696,9 @@ %D \splitofftokens10\from01234567 890123456789\to\test [\test] %D \stopbuffer %D -%D However, the characters that we expect to find in -%D \type{\test} just don't show up there. The reason for this -%D is not that logical but follows from \TEX's sometimes -%D mysterious way of expanding. Look at this: +%D up there. The reason for this is not that logical but follows from \TEX's +%D However, the characters that we expect to find in \type {\test} just don't show +%D sometimes mysterious way of expanding. Look at this: %D %D \startbuffer[next] %D \def\next{a} \edef\test{\next} [\test] @@ -7039,16 +7710,14 @@ %D %D \typebuffer[next] %D -%D Careful reading shows that inside an \type{\edef} macro's -%D that are \type{\let} are not expanded! +%D Careful reading shows that inside an \type {\edef} macro's that are \type {\let} +%D are not expanded! %D %D \unprotect\getbuffer[next]\protect %D -%D That's why we finally end up with a macro that looks -%D ahead by using an assignment, this time by using \type -%D {\futurelet}, and grabbing an argument as well. That -%D way we can handle the sentinal, a blank space and grouped -%D tokens. +%D That's why we finally end up with a macro that looks ahead by using an +%D assignment, this time by using \type {\futurelet}, and grabbing an argument as +%D well. That way we can handle the sentinal, a blank space and grouped tokens. \unexpanded\def\syst_helpers_handle_tokens % \nexthandledtoken is part of interface {\futurelet\nexthandledtoken\syst_helpers_handle_tokens_indeed} @@ -7091,12 +7760,11 @@ %D \macros %D {iftrialtypesetting, ifvisible} %D -%D The next boolean is at first sight a strange one. Sometimes -%D one does a trial typesetting run, for instance to determine -%D dimensions. Some mechanisms, like object inclusion, can fail -%D on such trials. Temporary setting the next boolean to true, -%D helps a lot. The second boolena can be used to inhibit -%D processing completely. +%D The next boolean is at first sight a strange one. Sometimes one does a trial +%D typesetting run, for instance to determine dimensions. Some mechanisms, like +%D object inclusion, can fail on such trials. Temporary setting the next boolean to +%D true, helps a lot. The second boolena can be used to inhibit processing +%D completely. \newif\ifvisible \visibletrue @@ -7114,10 +7782,9 @@ %D \macros %D {twodigitrounding} %D -%D When using \type {\special}s or \type {\pdfliteral}s, it -%D sometimes makes sense to limit the precission. The next -%D macro rounds a real number to two digits. It takes one -%D argument and only works in \ETEX. +%D When using \type {\special}s or \type {\pdfliteral}s, it sometimes makes sense to +%D limit the precission. The next macro rounds a real number to two digits. It takes +%D one argument and only works in \ETEX. % \def\dointegerrounding #1.#2\relax {#1} % \def\doonedigitrounding #1.#2#3\relax {\ifx#2*#1\else#1.#2\fi} @@ -7208,8 +7875,7 @@ %D \macros %D {doifsometokselse, doifsometoks} %D -%D Not that fast I guess, but here's a way to test for token -%D registers being empty. +%D Not that fast I guess, but here's a way to test for token registers being empty. \unexpanded\def\doifelsesometoks#1% {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok @@ -7240,28 +7906,21 @@ %D \macros %D {startstrictinspectnextcharacter} %D -%D This one if for Taco's bibliography module: +%D This one is for the bibliography module (still?): -\let\syst_helpers_normal_inspect_next_character\syst_helpers_inspect_next_character +\let\syst_helpers_strict_inspect_next_character[ \def\syst_helpers_strict_inspect_next_character% no user macro ! - {\ifx\nexttoken\charactertoken + {\ifx\nexttoken[% \expandafter\m_syst_action_yes \else \expandafter\m_syst_action_nop \fi} -% better: push/pop - -\unexpanded\def\startstrictinspectnextcharacter - {\let\syst_helpers_inspect_next_character\syst_helpers_strict_inspect_next_character} - -\unexpanded\def\stopstrictinspectnextcharacter - {\let\syst_helpers_inspect_next_character\syst_helpers_normal_inspect_next_character} - \unexpanded\def\strictdoifelsenextoptional#1#2% - {\startstrictinspectnextcharacter - \doifelsenextchar[{\stopstrictinspectnextcharacter#1}{\stopstrictinspectnextcharacter#2}} + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% + \futurelet\nexttoken\syst_helpers_strict_inspect_next_character} \let\strictdoifnextoptionalelse\strictdoifelsenextoptional @@ -7279,8 +7938,7 @@ %D \macros %D {verbatimargument} %D -%D As the name says, this macro converts its argument to a -%D (rather safe) string. +%D As the name says, this macro converts its argument to a (rather safe) string. \let\verbatimstring\detokenize @@ -7315,18 +7973,16 @@ %D \macros %D {purenumber} %D -%D Sometimes we need control over when \TEX\ stops reading a -%D number, especially in full expandable macros where using -%D \type {\relax} would lead to disasters. +%D Sometimes we need control over when \TEX\ stops reading a number, especially in +%D full expandable macros where using \type {\relax} would lead to disasters. %D %D \starttyping %D \ifodd\purenumber{...}\space ... \else ... \fi %D \stoptyping %D -%D Here we use a space as number delimiter in combination -%D with a space- and relax-less \type {\purenumber}. This -%D macro works ok with \type {\the}, \type {\number} as well -%D as \ETEX's \type {\numexpr}. +%D Here we use a space as number delimiter in combination with a space- and +%D relax-less \type {\purenumber}. This macro works ok with \type {\the}, \type +%D {\number} as well as \ETEX's \type {\numexpr}. \def\purenumber#1{\expandafter\firstofoneargument\expandafter{\number#1}} @@ -7351,8 +8007,7 @@ %D \filterfromvalues{3}{xx}{1} %D \stoptyping %D -%D I'll implement this when I'm in \quotation {writing dirty -%D macros mood}. +%D I'll implement this when I'm in \quotation {writing dirty macros mood}. \def\dofilterfromstr#1#2% max n % no need to be fast {\expandafter \expandafter \expandafter \csstring @@ -7457,17 +8112,35 @@ %D %D This is a dirty one: we simply append a unit and discard it when needed. -\def\doifelsedimension#1% - {\afterassignment\syst_helpers_if_dimension_else\privatescratchdimen#1pt\relax} +\startmkivmode -\let\doifdimensionelse\doifelsedimension + \def\doifelsedimension#1% + {\afterassignment\syst_helpers_if_dimension_else\privatescratchdimen#1pt\relax} -\def\syst_helpers_if_dimension_else#1% - {\ifx#1\relax - \expandafter\secondoftwoarguments - \else % #1=p ... t\relax - \expandafter\thirdoffourarguments - \fi} + % \def\doifelsedimension#1% + % {\expandafter\syst_helpers_if_dimension_else\immediateassignment\privatescratchdimen#1pt\relax} + + \def\syst_helpers_if_dimension_else#1% + {\ifx#1\relax + \expandafter\secondoftwoarguments + \else % #1=p ... t\relax + \expandafter\thirdoffourarguments + \fi} + +\stopmkivmode + +\startlmtxmode + + \def\doifelsedimension#1% + {\ifdimen#1\or + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\stoplmtxmode + +\let\doifdimensionelse\doifelsedimension %D Ok, here's another one, slower but seldom used. This one scans the text. %D @@ -7486,60 +8159,70 @@ %D \NC 1 \NC \doifdimenstringelse {1}{yes}{no} \NC \NR %D \stoptabulate -\installsystemnamespace{dimenchecka} -\installsystemnamespace{dimencheckb} -\installsystemnamespace{dimencheckc} - -\def\doifelsedimenstring#1{\normalexpanded{\noexpand\dodimenteststageone#1}\empty\empty]} +\startmkivmode + + \installsystemnamespace{dimenchecka} + \installsystemnamespace{dimencheckb} + \installsystemnamespace{dimencheckc} + + \def\doifelsedimenstring#1{\normalexpanded{\noexpand\dodimenteststageone#1}\empty\empty]} + + \def\dodimenteststageone #1#2{\csname \??dimenchecka\ifcsname \??dimenchecka#2\endcsname#2\else x\fi\endcsname#2} + \def\dodimenteststagetwo #1#2{\csname \??dimencheckb\ifcsname \??dimencheckb#2\endcsname#2\else x\fi\endcsname#2} + \def\dodimenteststagethree #1]{\csname \??dimencheckc\ifcsname \??dimencheckc#1\endcsname#1\else x\fi\endcsname} + + \expandafter\let\csname \??dimenchecka x\endcsname\dodimenteststagethree + \expandafter\let\csname \??dimencheckb x\endcsname\dodimenteststagethree + \expandafter\let\csname \??dimencheckc x\endcsname\secondoftwoarguments + + \expandafter\let\csname \??dimenchecka.\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimenchecka,\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimenchecka1\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka2\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka3\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka4\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka5\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka6\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka7\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka8\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka9\endcsname\dodimenteststageone + \expandafter\let\csname \??dimenchecka0\endcsname\dodimenteststageone + + \expandafter\let\csname \??dimencheckb1\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb2\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb3\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb4\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb5\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb6\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb7\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb8\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb9\endcsname\dodimenteststagetwo + \expandafter\let\csname \??dimencheckb0\endcsname\dodimenteststagetwo + + \expandafter\let\csname \??dimencheckc pt\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc pc\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc in\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc bp\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc cm\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc mm\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc dd\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc cc\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc sp\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc ex\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc em\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc nd\endcsname\firstoftwoarguments + \expandafter\let\csname \??dimencheckc nc\endcsname\firstoftwoarguments + +\stopmkivmode + +\startlmtxmode + + \let\doifelsedimenstring\doifelsedimension + +\stoplmtxmode \let\doifdimenstringelse\doifelsedimenstring -\def\dodimenteststageone #1#2{\csname \??dimenchecka\ifcsname \??dimenchecka#2\endcsname#2\else x\fi\endcsname#2} -\def\dodimenteststagetwo #1#2{\csname \??dimencheckb\ifcsname \??dimencheckb#2\endcsname#2\else x\fi\endcsname#2} -\def\dodimenteststagethree #1]{\csname \??dimencheckc\ifcsname \??dimencheckc#1\endcsname#1\else x\fi\endcsname} - -\expandafter\let\csname \??dimenchecka x\endcsname\dodimenteststagethree -\expandafter\let\csname \??dimencheckb x\endcsname\dodimenteststagethree -\expandafter\let\csname \??dimencheckc x\endcsname\secondoftwoarguments - -\expandafter\let\csname \??dimenchecka.\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimenchecka,\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimenchecka1\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka2\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka3\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka4\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka5\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka6\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka7\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka8\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka9\endcsname\dodimenteststageone -\expandafter\let\csname \??dimenchecka0\endcsname\dodimenteststageone - -\expandafter\let\csname \??dimencheckb1\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb2\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb3\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb4\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb5\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb6\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb7\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb8\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb9\endcsname\dodimenteststagetwo -\expandafter\let\csname \??dimencheckb0\endcsname\dodimenteststagetwo - -\expandafter\let\csname \??dimencheckc pt\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc pc\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc in\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc bp\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc cm\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc mm\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc dd\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc cc\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc sp\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc ex\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc em\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc nd\endcsname\firstoftwoarguments -\expandafter\let\csname \??dimencheckc nc\endcsname\firstoftwoarguments - %D \macros %D {comparedimension,comparedimensioneps} %D @@ -7570,8 +8253,6 @@ \plustwo \fi\fi\fi} -% % % % % % % % % % % % % % % % % % % % % % - % pretty ugly but fast % \copycsname xxx\endcsname\csname ..\endcsname @@ -7766,8 +8447,8 @@ \unexpanded\def\freezedimenmacro#1% {\edef#1{\the\dimexpr#1}} -%D The next macro negates a macro (dimension or number, or actually, whatever. -%D It's a typical example of \type {\if} usage: +%D The next macro negates a macro (dimension or number, or actually, whatever. It's +%D a typical example of \type {\if} usage: %D %D \starttyping %D \if-\whatever \else-\whatever\fi => else => -whatever @@ -7796,8 +8477,8 @@ %D \macros %D {dowithrange} %D -%D This one is for Mojca Miklavec, who made me aware of the fact that -%D \type {page-imp.tex} was not the best place to hide it. +%D This one is for Mojca Miklavec, who made me aware of the fact that \type +%D {page-imp.tex} was not the best place to hide it. %D %D \startbuffer %D \def\DoSomething#1{ [item #1] } @@ -7879,8 +8560,8 @@ \def\syst_helpers_expand_checked_csname#1#2#3% {\csname#1\ifcsname#1#2\endcsname#2\else#3\fi\endcsname} -%D Signal. Some fonts have a char0 rendering so we need to make sure that it -%D is not set in the font! (THis will be overloaded) +%D Signal. Some fonts have a char0 rendering so we need to make sure that it is not +%D set in the font! (This will be overloaded) \unexpanded\def\signalcharacter{\char\zerocount} % \zwj diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index 4dc3bd03b..8a7132be0 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -510,7 +510,7 @@ local glyphexpansion do glyphexpansion = function(head,current) local extra = getexpansion(current) - if extra ~= 0 then + if extra and extra ~= 0 then extra = extra / 1000 local info = f_cache[extra] if not info then diff --git a/tex/context/base/mkiv/typo-itc.lua b/tex/context/base/mkiv/typo-itc.lua index 2683eecc3..64701abcc 100644 --- a/tex/context/base/mkiv/typo-itc.lua +++ b/tex/context/base/mkiv/typo-itc.lua @@ -383,6 +383,8 @@ local function texthandler(head) postinserted = nil postitalic = 0 updated = false + replacefont = nil + postfont = nil pre, post, replace, pretail, posttail, replacetail = getdisc(current,true) if replace then local current = replacetail @@ -390,29 +392,32 @@ local function texthandler(head) local char, id = isglyph(current) if char then local font = id - local data = italicsdata[font] - if data then - local attr = forcedvariant or getattr(current,a_italics) - if attr and attr > 0 then - local cd = data[char] - if not cd then - -- this really can happen - replaceitalic = 0 - else - replaceitalic = cd.italic - if not replaceitalic then - replaceitalic = setitalicinfont(font,char) -- calculated once - -- replaceitalic = 0 - end - if replaceitalic ~= 0 then - lastfont = font - lastattr = attr - replacechar = char - replacehead = replace - updated = true + if font ~= lastfont then + local data = italicsdata[font] + if data then + local attr = forcedvariant or getattr(current,a_italics) + if attr and attr > 0 then + local cd = data[char] + if not cd then + -- this really can happen + replaceitalic = 0 + else + replaceitalic = cd.italic + if not replaceitalic then + replaceitalic = setitalicinfont(font,char) -- calculated once + -- replaceitalic = 0 + end + if replaceitalic ~= 0 then + lastfont = font + lastattr = attr + replacechar = char + replacehead = replace + updated = true + end end end end + replacefont = font end break else @@ -426,29 +431,32 @@ local function texthandler(head) local char, id = isglyph(current) if char then local font = id - local data = italicsdata[font] - if data then - local attr = forcedvariant or getattr(current,a_italics) - if attr and attr > 0 then - local cd = data[char] - if not cd then - -- this really can happen - -- postitalic = 0 - else - postitalic = cd.italic - if not postitalic then - postitalic = setitalicinfont(font,char) -- calculated once - -- postitalic = 0 - end - if postitalic ~= 0 then - lastfont = font - lastattr = attr - postchar = char - posthead = post - updated = true + if font ~= lastfont then + local data = italicsdata[font] + if data then + local attr = forcedvariant or getattr(current,a_italics) + if attr and attr > 0 then + local cd = data[char] + if not cd then + -- this really can happen + -- postitalic = 0 + else + postitalic = cd.italic + if not postitalic then + postitalic = setitalicinfont(font,char) -- calculated once + -- postitalic = 0 + end + if postitalic ~= 0 then + lastfont = font + lastattr = attr + postchar = char + posthead = post + updated = true + end end end end + postfont = font end break else @@ -456,6 +464,9 @@ local function texthandler(head) end end end + if replacefont or postfont then + lastfont = replacefont or postfont + end if updated then setdisc(current,pre,post,replace) end @@ -520,7 +531,7 @@ local function texthandler(head) else if replaceitalic ~= 0 then if trace_italics then - report_italics("inserting %p between %s italic %C and whatever",replaceritalic,"replace",replacechar) + report_italics("inserting %p between %s italic %C and whatever",replaceitalic,"replace",replacechar) end insert_node_after(replacehead,replace,correction_kern(replaceitalic,current)) previnserted = nil diff --git a/tex/context/base/mkiv/util-tpl.lua b/tex/context/base/mkiv/util-tpl.lua index 5e75a151b..57d7df3a9 100644 --- a/tex/context/base/mkiv/util-tpl.lua +++ b/tex/context/base/mkiv/util-tpl.lua @@ -171,6 +171,8 @@ local function replace(str,mapping,how,recurse) end -- print(replace("test '%[x]%' test",{ x = [[a 'x' a]] })) +-- print(replace("test '%x%' test",{ x = [[a "x" a]] })) +-- print(replace([[test "%[x]%" test]],{ x = [[a "x" a]] })) -- print(replace("test '%[x]%' test",{ x = true })) -- print(replace("test '%[x]%' test",{ x = [[a 'x' a]], y = "oeps" },'sql')) -- print(replace("test '%[x]%' test",{ x = [[a '%y%' a]], y = "oeps" },'sql',true)) diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml index 452f3316a..476557e5a 100644 --- a/tex/context/interface/mkii/keys-fr.xml +++ b/tex/context/interface/mkii/keys-fr.xml @@ -590,6 +590,7 @@ <cd:variable name='understrike' value='understrike'/> <cd:variable name='understrikes' value='understrikes'/> <cd:variable name='unframed' value='unframed'/> + <cd:variable name='unicode' value='unicode'/> <cd:variable name='unit' value='unite'/> <cd:variable name='units' value='unites'/> <cd:variable name='unknown' value='inconnu'/> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 59f56b683..c4a935a11 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex beae0d66b..0fc265613 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/common/s-abbreviations-logos.tex b/tex/context/modules/common/s-abbreviations-logos.tex index 49a30451c..e394157d7 100644 --- a/tex/context/modules/common/s-abbreviations-logos.tex +++ b/tex/context/modules/common/s-abbreviations-logos.tex @@ -149,6 +149,7 @@ \logo [JPEG] {jpeg} \logo [JPG] {jpg} \logo [JSON] {json} +\logo [KB] {KB} \logo [KPATHSEA] {kpathsea} \logo [KPSE] {kpse} \logo [KPSEWHICH] {kpsewhich} @@ -174,6 +175,7 @@ \logo [MAPPING] {map} \logo [MAPS] {Maps} \logo [MATHML] {MathML} +\logo [MB] {MB} \logo [METAFONT] {\MetaFont} \logo [METAFUN] {\MetaFun} \logo [METAPOST] {\MetaPost} diff --git a/tex/context/modules/mkiv/m-asymptote.lua b/tex/context/modules/mkiv/m-asymptote.lua index 39a0d987b..31a81433f 100644 --- a/tex/context/modules/mkiv/m-asymptote.lua +++ b/tex/context/modules/mkiv/m-asymptote.lua @@ -17,7 +17,7 @@ sandbox.registerrunner { name = "asymptote prc", program = "asy", method = "execute", - template = '-noV -config="" -tex=context -outformat="prc" "%filename%"', + template = [[-noV -config="" -tex=context -outformat="prc" %filename%]], checkers = { filename = "readable" }, } @@ -25,7 +25,7 @@ sandbox.registerrunner { name = "asymptote pdf", program = "asy", method = "execute", - template = '-noV -config="" -tex=context -outformat="pdf" "%filename%"', + template = [[-noV -config="" -tex=context -outformat="pdf" %filename%]], checkers = { filename = "readable" }, } diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e537a1141..8ac1b547d 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 04/16/19 08:54:10 +-- merge date : 04/25/19 10:36:19 do -- begin closure to overcome local limits and interference @@ -9098,11 +9098,11 @@ function constructors.finalize(tfmdata) if not properties.virtualized then properties.virtualized=tfmdata.type=="virtual" end - properties.fontname=tfmdata.fontname - properties.filename=tfmdata.filename - properties.fullname=tfmdata.fullname - properties.name=tfmdata.name - properties.psname=tfmdata.psname + properties.fontname=properties.fontname or tfmdata.fontname + properties.filename=properties.filename or tfmdata.filename + properties.fullname=properties.fullname or tfmdata.fullname + properties.name=properties.name or tfmdata.name + properties.psname=properties.psname or tfmdata.psname properties.encodingbytes=tfmdata.encodingbytes or 1 properties.embedding=tfmdata.embedding or "subset" properties.tounicode=tfmdata.tounicode or 1 @@ -33053,8 +33053,9 @@ local function copytotfm(data) local filename=constructors.checkedfilename(resources) local fontname=metadata.fontname or metadata.fullname local fullname=metadata.fullname or metadata.fontname - local endash=0x0020 + local endash=0x2013 local emdash=0x2014 + local space=0x0020 local spacer="space" local spaceunits=500 local monospaced=metadata.monospaced @@ -33065,26 +33066,32 @@ local function copytotfm(data) parameters.italicangle=italicangle parameters.charwidth=charwidth parameters.charxheight=charxheight + local d_endash=descriptions[endash] + local d_emdash=descriptions[emdash] + local d_space=descriptions[space] + if not d_space or d_space==0 then + d_space=d_endash + end + if d_space then + spaceunits,spacer=d_space.width or 0,"space" + end if properties.monospaced then - if descriptions[endash] then - spaceunits,spacer=descriptions[endash].width,"space" - end - if not spaceunits and descriptions[emdash] then - spaceunits,spacer=descriptions[emdash].width,"emdash" - end - if not spaceunits and charwidth then - spaceunits,spacer=charwidth,"charwidth" + if spaceunits==0 and d_emdash then + spaceunits,spacer=d_emdash.width or 0,"emdash" end else - if descriptions[endash] then - spaceunits,spacer=descriptions[endash].width,"space" - end - if not spaceunits and charwidth then - spaceunits,spacer=charwidth,"charwidth" + if spaceunits==0 and d_endash then + spaceunits,spacer=d_emdash.width or 0,"endash" end end - spaceunits=tonumber(spaceunits) - if spaceunits<200 then + if spaceunits==0 and charwidth then + spaceunits,spacer=charwidth or 0,"charwidth" + end + if spaceunits==0 then + spaceunits=tonumber(spaceunits) or 500 + end + if spaceunits==0 then + spaceunits=500 end parameters.slant=0 parameters.space=spaceunits |