diff options
Diffstat (limited to 'tex')
47 files changed, 2243 insertions, 2060 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 5302ed551..787c827ac 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{2020.07.07 15:55} +\newcontextversion{2020.07.09 14:48} %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 7b7fbf6c1..cb34f163c 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{2020.07.07 15:55} +\edef\contextversion{2020.07.09 14:48} %D For those who want to use this: diff --git a/tex/context/base/mkiv/catc-act.mkiv b/tex/context/base/mkiv/catc-act.mkiv index bd1ffd38d..f53a14aca 100644 --- a/tex/context/base/mkiv/catc-act.mkiv +++ b/tex/context/base/mkiv/catc-act.mkiv @@ -23,7 +23,7 @@ \let\m_syst_catcodes_temp\empty -\normalprotected\def\installactivecharacter#1 % +\protected\def\installactivecharacter#1 % {\edef\m_syst_catcodes_temp{\detokenize{#1}}% \c_syst_catcodes_c\expandafter`\m_syst_catcodes_temp\relax % relax needed \expandafter\startextendcatcodetable @@ -41,7 +41,7 @@ \setnewconstant\c_syst_catcodes_hack\tildeasciicode % also defined in catc-ini.mkiv -\normalprotected\def\defineactivecharacter #1#2 #3% uses \doifelsenumber which is not yet defined +\protected\def\defineactivecharacter #1#2 #3% uses \doifelsenumber which is not yet defined {\c_syst_catcodes_c\uccode\c_syst_catcodes_hack \if#1"\uccode\c_syst_catcodes_hack\expandafter\doifelsenumber\expandafter{\string#1#2}\empty #1#2\else \uccode\c_syst_catcodes_hack\expandafter\doifelsenumber\expandafter{\string#1#2}\empty`#1#2\fi @@ -64,10 +64,10 @@ \def\syst_catcodes_handle_yes#1#2{#2} \def\syst_catcodes_handle_nop#1#2{\noexpand#1} -\normalprotected\def\makecharacteractive #1 % +\protected\def\makecharacteractive #1 % {\catcode`#1\activecatcode} -\normalprotected\def\installanddefineactivecharacter #1 % #2% +\protected\def\installanddefineactivecharacter #1 % #2% {\normalexpanded{\noexpand\installactivecharacter \utfchar{#1} }% \defineactivecharacter #1 }% {#2}} diff --git a/tex/context/base/mkiv/catc-ctx.mkiv b/tex/context/base/mkiv/catc-ctx.mkiv index 5af8a5035..3492a4bc5 100644 --- a/tex/context/base/mkiv/catc-ctx.mkiv +++ b/tex/context/base/mkiv/catc-ctx.mkiv @@ -128,18 +128,18 @@ % for the moment here: -\normalprotected\def\starttexcode +\protected\def\starttexcode {\pushcatcodetable \catcodetable\prtcatcodes} -\normalprotected\def\stoptexcode +\protected\def\stoptexcode {\popcatcodetable} -\normalprotected\def\startcontextcode +\protected\def\startcontextcode {\pushcatcodetable \catcodetable\ctxcatcodes} -\normalprotected\def\stopcontextcode +\protected\def\stopcontextcode {\popcatcodetable} % not visible, only for special cases @@ -169,11 +169,11 @@ \catcode\barasciicode \activecatcode \stopcatcodetable -\normalprotected\def\startcontextdefinitioncode +\protected\def\startcontextdefinitioncode {\pushcatcodetable \catcodetable\ctdcatcodes} -\normalprotected\def\stopcontextdefinitioncode +\protected\def\stopcontextdefinitioncode {\popcatcodetable} \endinput diff --git a/tex/context/base/mkiv/catc-def.mkiv b/tex/context/base/mkiv/catc-def.mkiv index bf794f045..103d58194 100644 --- a/tex/context/base/mkiv/catc-def.mkiv +++ b/tex/context/base/mkiv/catc-def.mkiv @@ -139,8 +139,8 @@ %D From now on we can use the protection mechanisms. -\normalprotected\def\unprotect{\pushcatcodetable\setcatcodetable\prtcatcodes} -\normalprotected\def\protect {\popcatcodetable} +\protected\def\unprotect{\pushcatcodetable\setcatcodetable\prtcatcodes} +\protected\def\protect {\popcatcodetable} % \prependtoks \catcodetable\ctxcatcodes \to \everyjob diff --git a/tex/context/base/mkiv/catc-ini.mkiv b/tex/context/base/mkiv/catc-ini.mkiv index 215ec14e1..a177b26ca 100644 --- a/tex/context/base/mkiv/catc-ini.mkiv +++ b/tex/context/base/mkiv/catc-ini.mkiv @@ -23,12 +23,12 @@ %D \MKII\ file. There is some overlap in code with \MKII\ but we take that %D for granted. Also, in \MKIV\ less active characters are used. -% \normalprotected\def\setnewconstantfromchar#1% +% \protected\def\setnewconstantfromchar#1% % {\expandafter\ifdefined\expandafter#1\expandafter % \let\expandafter#1\expandafter\undefined\expandafter\fi\expandafter % \newcount\expandafter#1\expandafter#1\the#1\relax} % -% \normalprotected\def\setnewconstantfromchar#1% +% \protected\def\setnewconstantfromchar#1% % {\begingroup % \scratchcounter#1% % \edef\!!stringa{\meaning#1}% @@ -41,7 +41,7 @@ % \fi % #1\the\scratchcounter\relax}} % -% \normalprotected\def\setnewconstantfromchar#1% +% \protected\def\setnewconstantfromchar#1% % {\begingroup % \edef\!!stringa{\meaning#1}% % \expandafter\chardef\expandafter#1\the#1% @@ -53,7 +53,7 @@ % \fi % #1\the#1\relax}} % -% \normalprotected\def\setnewconstantfromchar#1% +% \protected\def\setnewconstantfromchar#1% % {\scratchcounter#1\let#1\undefined\newcount#1#1\scratchcounter} \def\promote#1{\scratchcounter#1\let#1\undefined\newcount#1#1\scratchcounter} @@ -134,13 +134,13 @@ % rather special and used in writing to file: \let\par\outputnewlinechar -% \normalprotected\def\initializenewlinechar % operating system dependent +% \protected\def\initializenewlinechar % operating system dependent % {\begingroup % \newlinechar\newlineasciicode % \xdef\outputnewlinechar{^^J}% % \endgroup} -\normalprotected\def\initializenewlinechar % operating system dependent +\protected\def\initializenewlinechar % operating system dependent {\begingroup \letcharcode\newlineasciicode\relax \newlinechar\newlineasciicode @@ -153,7 +153,7 @@ % % \def\??catcodelet {1>>} % let : \let % \def\??catcodedef {2>>} % def : \def -% \def\??catcodeued {3>>} % ued : \unexpanded\def +% \def\??catcodeued {3>>} % ued : \protected\def % \def\??catcodeget {4>>} % \meaning % % \def\??catcodetablet{5>>} @@ -161,7 +161,7 @@ \installsystemnamespace {catcodelet} % let : \let \installsystemnamespace {catcodedef} % def : \def -\installsystemnamespace {catcodeued} % ued : \unexpanded\def +\installsystemnamespace {catcodeued} % ued : \protected\def \installsystemnamespace {catcodeget} % \meaning \installsystemnamespace {catcodetablet} @@ -172,7 +172,7 @@ \newcount\c_syst_catcodes_b \newcount\c_syst_catcodes_c -\normalprotected\def\newcatcodetable#1% we could move the cctdefcounter to lua +\protected\def\newcatcodetable#1% we could move the cctdefcounter to lua {\global\advance\c_syst_catcodes_n\plusone \expandafter\xdef\csname\??catcodetablen\number\c_syst_catcodes_n\endcsname{\string#1}% logging \newconstant#1% @@ -188,7 +188,7 @@ \catcode\commentasciicode \othercatcode \catcode\delasciicode \othercatcode} -\normalprotected\def\startcatcodetable#1#2\stopcatcodetable +\protected\def\startcatcodetable#1#2\stopcatcodetable {\begingroup \catcodetable\inicatcodes \the\everysetdefaultcatcodes @@ -198,7 +198,7 @@ \let\stopcatcodetable\relax -\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable +\protected\def\startextendcatcodetable#1#2\stopextendcatcodetable {\begingroup \catcodetable#1\relax \globaldefs\plusone @@ -208,14 +208,14 @@ \let\stopextendcatcodetable\relax -\normalprotected\def\permitcircumflexescape % to be used grouped +\protected\def\permitcircumflexescape % to be used grouped {\catcode\circumflexasciicode\superscriptcatcode} \let\permitcaretescape\permitcircumflexescape % == % -% \normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable +% \protected\def\startextendcatcodetable#1#2\stopextendcatcodetable % {\bgroup % \scratchcounter\the\catcodetable % \catcodetable #1 #2 @@ -277,7 +277,7 @@ \def\syst_catcodes_ued_c % only first time {\expandafter\gdef\csname\??catcodeued\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\expandafter\endcsname \expandafter##\expandafter1\expandafter - {\expandafter\normalprotected\expandafter\def\csname\??catcodeget\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname{##1}}% + {\expandafter\protected\expandafter\def\csname\??catcodeget\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname{##1}}% \syst_catcodes_reinstate_unexpanded \csname\??catcodeued\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname} @@ -294,7 +294,7 @@ {\begingroup % and the selector has been lost \uccode\c_syst_catcodes_hack\c_syst_catcodes_b \catcode\uccode\c_syst_catcodes_hack\activecatcode - \uppercase{\normalprotected\xdef~{\noexpand\catcodecommand{\number\c_syst_catcodes_b}}}% + \uppercase{\protected\xdef~{\noexpand\catcodecommand{\number\c_syst_catcodes_b}}}% \endgroup} %D This can be used when a direct definition has been done and the selector has been @@ -310,7 +310,7 @@ % % \def\syst_catcodes_reinstate_unexpanded % {\begingroup -% \normalprotected\edef\next{\noexpand\catcodecommand{\number\c_syst_catcodes_b}}% +% \protected\edef\next{\noexpand\catcodecommand{\number\c_syst_catcodes_b}}% % \global\letcharcode\c_syst_catcodes_b\next % \endgroup} @@ -337,12 +337,12 @@ \newcount\c_syst_catcodes_level -\normalprotected\def\pushcatcodetable +\protected\def\pushcatcodetable {\advance\c_syst_catcodes_level\plusone \syst_catcodes_trace_push \expandafter\chardef\csname\??catcodetablet\number\c_syst_catcodes_level\endcsname\currentcatcodetable} -\normalprotected\def\popcatcodetable +\protected\def\popcatcodetable {\ifcase\c_syst_catcodes_level \syst_catcodes_trace_nesting_error \else @@ -351,19 +351,19 @@ \advance\c_syst_catcodes_level\minusone \fi} -\normalprotected\def\syst_catcodes_trace_nesting_error +\protected\def\syst_catcodes_trace_nesting_error {\immediate\write\statuswrite{}% \immediate\write\statuswrite{Fatal error: catcode push/pop mismatch. Fix this! (restore level: \number\c_syst_catcodes_level)}\wait\end \immediate\write\statuswrite{}} -\normalprotected\def\restorecatcodes % takes previous level +\protected\def\restorecatcodes % takes previous level {\ifnum\c_syst_catcodes_level>\plusone \expandafter\catcodetable\csname\??catcodetablet\number\numexpr\c_syst_catcodes_level-1\relax\endcsname \fi} % \newtoks\everycatcodetable -\normalprotected\def\setcatcodetable#1% +\protected\def\setcatcodetable#1% {\catcodetable#1% % \the\everycatcodetable \syst_catcodes_trace_set} @@ -374,7 +374,7 @@ %D \tracecatcodetables %D \stoptyping -\normalprotected\def\tracecatcodetables +\protected\def\tracecatcodetables {\def\syst_catcodes_trace_set {\syst_catcodes_trace{set \catcodetablename\space at \number\c_syst_catcodes_level}}% \def\syst_catcodes_trace_push{\syst_catcodes_trace{push \catcodetablename\space from \syst_catcodes_prev\space at \number\c_syst_catcodes_level}}% \def\syst_catcodes_trace_pop {\syst_catcodes_trace{pop \catcodetablename\space to \syst_catcodes_prev\space at \number\c_syst_catcodes_level}}} diff --git a/tex/context/base/mkiv/catc-sym.mkiv b/tex/context/base/mkiv/catc-sym.mkiv index 5cda010fe..abe9191d9 100644 --- a/tex/context/base/mkiv/catc-sym.mkiv +++ b/tex/context/base/mkiv/catc-sym.mkiv @@ -79,13 +79,13 @@ %D them for convenience and compatibility. Some old engine code %D has been removed. -\normalprotected\def\uncatcodespecials {\setcatcodetable\nilcatcodes \uncatcodespacetokens} -\normalprotected\def\setnaturalcatcodes {\setcatcodetable\nilcatcodes} -\normalprotected\def\setnormalcatcodes {\setcatcodetable\ctxcatcodes} % maybe \texcatcodes -\normalprotected\def\uncatcodecharacters {\setcatcodetable\nilcatcodes} % was fast version, gone now -\normalprotected\def\uncatcodeallcharacters{\setcatcodetable\nilcatcodes} % was slow one, with restore +\protected\def\uncatcodespecials {\setcatcodetable\nilcatcodes \uncatcodespacetokens} +\protected\def\setnaturalcatcodes {\setcatcodetable\nilcatcodes} +\protected\def\setnormalcatcodes {\setcatcodetable\ctxcatcodes} % maybe \texcatcodes +\protected\def\uncatcodecharacters {\setcatcodetable\nilcatcodes} % was fast version, gone now +\protected\def\uncatcodeallcharacters{\setcatcodetable\nilcatcodes} % was slow one, with restore -\normalprotected\def\uncatcodespacetokens +\protected\def\uncatcodespacetokens {\catcode\spaceasciicode \spacecatcode \catcode\tabasciicode \spacecatcode \catcode\formfeedasciicode \endoflinecatcode @@ -101,10 +101,10 @@ \newtoks\everyverbosechacters -\normalprotected\def\setverbosecscharacter#1% +\protected\def\setverbosecscharacter#1% {\edef#1{\string#1}} -\normalprotected\def\setverbosecscharacters +\protected\def\setverbosecscharacters {\the\everyverbosechacters} \bgroup diff --git a/tex/context/base/mkiv/cldf-ini.mkiv b/tex/context/base/mkiv/cldf-ini.mkiv index 0a1ee639f..4ce48d7af 100644 --- a/tex/context/base/mkiv/cldf-ini.mkiv +++ b/tex/context/base/mkiv/cldf-ini.mkiv @@ -49,11 +49,11 @@ % \catcodetable\ctxcatcodes \catcode`^=\superscriptcatcode\catcode1=\activecatcode \glet^^A=\cldf % \catcodetable\ctxcatcodes \catcode`^=\superscriptcatcode\catcode2=\activecatcode \glet^^B=\cldn -\normalprotected\def\cldprocessfile#1{\directlua{context.runfile("#1")}} - \def\cldloadfile #1{\directlua{context.loadfile("#1")}} - \def\cldloadviafile#1{\directlua{context.loadviafile("#1")}} - \def\cldcontext #1{\directlua{context(#1)}} - \def\cldcommand #1{\directlua{context.#1}} - % \def\cldverbatim #1{\directlua{context.verbatim.#1}} % maybe make verbatim global +\protected\def\cldprocessfile#1{\directlua{context.runfile("#1")}} + \def\cldloadfile #1{\directlua{context.loadfile("#1")}} + \def\cldloadviafile#1{\directlua{context.loadviafile("#1")}} + \def\cldcontext #1{\directlua{context(#1)}} + \def\cldcommand #1{\directlua{context.#1}} + % \def\cldverbatim #1{\directlua{context.verbatim.#1}} % maybe make verbatim global \endinput diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index d3aa63fe1..4b09e1699 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2020.07.07 15:55} +\newcontextversion{2020.07.09 14:48} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index ebf60e788..f2fc78609 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.07.07 15:55} +\edef\contextversion{2020.07.09 14:48} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index bdf396529..6af3d0f0b 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.07.07 15:55} +\edef\contextversion{2020.07.09 14:48} %D Kind of special: diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua index 7979a40fb..b0868ba48 100644 --- a/tex/context/base/mkiv/l-lpeg.lua +++ b/tex/context/base/mkiv/l-lpeg.lua @@ -203,12 +203,14 @@ local collapser = Cs(spacer^0/"" * nonspacer^0 * ((spacer^0/" " * nonspac local nospacer = Cs((whitespace^1/"" + nonwhitespace^1)^0) local b_collapser = Cs( whitespace^0 /"" * (nonwhitespace^1 + whitespace^1/" ")^0) -local e_collapser = Cs((whitespace^1 * endofstring/"" + nonwhitespace^1 + whitespace^1/" ")^0) local m_collapser = Cs( (nonwhitespace^1 + whitespace^1/" ")^0) +local e_collapser = Cs((whitespace^1 * endofstring/"" + nonwhitespace^1 + whitespace^1/" ")^0) +local x_collapser = Cs( (nonwhitespace^1 + whitespace^1/"" )^0) local b_stripper = Cs( spacer^0 /"" * (nonspacer^1 + spacer^1/" ")^0) -local e_stripper = Cs((spacer^1 * endofstring/"" + nonspacer^1 + spacer^1/" ")^0) local m_stripper = Cs( (nonspacer^1 + spacer^1/" ")^0) +local e_stripper = Cs((spacer^1 * endofstring/"" + nonspacer^1 + spacer^1/" ")^0) +local x_stripper = Cs( (nonspacer^1 + spacer^1/"" )^0) patterns.stripper = stripper patterns.fullstripper = fullstripper @@ -218,10 +220,12 @@ patterns.nospacer = nospacer patterns.b_collapser = b_collapser patterns.m_collapser = m_collapser patterns.e_collapser = e_collapser +patterns.x_collapser = x_collapser patterns.b_stripper = b_stripper patterns.m_stripper = m_stripper patterns.e_stripper = e_stripper +patterns.x_stripper = x_stripper patterns.lowercase = lowercase patterns.uppercase = uppercase diff --git a/tex/context/base/mkiv/libs-imp-mujs.mkxl b/tex/context/base/mkiv/libs-imp-mujs.mkxl index 0f278dff5..3fc9d9124 100644 --- a/tex/context/base/mkiv/libs-imp-mujs.mkxl +++ b/tex/context/base/mkiv/libs-imp-mujs.mkxl @@ -29,7 +29,7 @@ \let\stopecmacode\relax -\normalprotected\def\startecmacode % \stopecmacode +\protected\def\startecmacode % \stopecmacode {\begingroup \obeylualines \obeyluatokens diff --git a/tex/context/base/mkiv/luat-ini.mkiv b/tex/context/base/mkiv/luat-ini.mkiv index f059d2b85..d1b02ec7e 100644 --- a/tex/context/base/mkiv/luat-ini.mkiv +++ b/tex/context/base/mkiv/luat-ini.mkiv @@ -34,7 +34,7 @@ % the \type {\normalexpanded} around \type {\directlua}. Something to discuss % in the team. -\normalprotected\def\startlua % \stoplua +\protected\def\startlua % \stoplua {\begingroup \obeylualines \luat_start_lua_indeed} @@ -42,7 +42,7 @@ \def\luat_start_lua_indeed#1\stoplua {\normalexpanded{\endgroup\noexpand\directlua{#1}}} % \zerocount is default -\normalprotected\def\startluacode % \stopluacode +\protected\def\startluacode % \stopluacode {\begingroup \obeylualines \obeyluatokens @@ -94,7 +94,7 @@ \let\9\lua_letter_nine \let\0\lua_letter_zero } % \to \everyluacode -\normalprotected\def\obeyluatokens +\protected\def\obeyluatokens {\setcatcodetable\luacatcodes \the\everyluacode} @@ -121,13 +121,13 @@ %D \edef\luaescapestring#1{\!!bs#1\!!es} %D \stoptyping -\normalprotected\def\setdocumentfilename #1#2{\clf_setdocumentfilename\numexpr#1\relax{#2}} -\normalprotected\def\setdocumentargument #1#2{\clf_setdocumentargument{#1}{#2}} -\normalprotected\def\setdocumentargumentdefault#1#2{\clf_setdocumentdefaultargument{#1}{#2}} - \def\getdocumentfilename #1{\clf_getdocumentfilename\numexpr#1\relax} - \def\getdocumentargument #1{\clf_getdocumentargument{#1}{}} -\normalprotected\def\setdocumentargument #1#2{\clf_setdocumentargument{#1}{#2}} - \def\getdocumentargumentdefault#1#2{\clf_getdocumentargument{#1}{#2}} +\protected\def\setdocumentfilename #1#2{\clf_setdocumentfilename\numexpr#1\relax{#2}} +\protected\def\setdocumentargument #1#2{\clf_setdocumentargument{#1}{#2}} +\protected\def\setdocumentargumentdefault#1#2{\clf_setdocumentdefaultargument{#1}{#2}} + \def\getdocumentfilename #1{\clf_getdocumentfilename\numexpr#1\relax} + \def\getdocumentargument #1{\clf_getdocumentargument{#1}{}} +\protected\def\setdocumentargument #1#2{\clf_setdocumentargument{#1}{#2}} + \def\getdocumentargumentdefault#1#2{\clf_getdocumentargument{#1}{#2}} % seldom used so no need for speedy variants: @@ -147,7 +147,7 @@ %D Experimental: -\normalprotected\def\startluaparameterset[#1]% +\protected\def\startluaparameterset[#1]% {\begingroup \obeylualines \obeyluatokens @@ -186,7 +186,7 @@ %D \ctxluacode{context("%0.5f",1/3)} %D \stoptyping -\normalprotected\def\ctxluacode +\protected\def\ctxluacode {\begingroup \obeylualines \obeyluatokens @@ -217,7 +217,7 @@ \installsystemnamespace{ctxfunction} -\normalprotected\def\startctxfunctiondefinition #1 % +\protected\def\startctxfunctiondefinition #1 % {\begingroup \obeylualines \obeyluatokens \luat_start_lua_function_definition_indeed{#1}} \installsystemnamespace{luafunction} @@ -227,13 +227,13 @@ \expandafter\chardef\csname\??luafunction#1\endcsname\ctxcommand{ctxfunction(\!!bs#2\!!es)}\relax \expandafter\edef\csname#1\endcsname{\noexpand\luafunction\csname\??luafunction#1\endcsname}} -\normalprotected\def\setctxluafunction#1#2% experiment +\protected\def\setctxluafunction#1#2% experiment {\expandafter\chardef\csname\??luafunction#1\endcsname#2\relax \expandafter\edef\csname#1\endcsname{\noexpand\luafunction\csname\??luafunction#1\endcsname}} \let\stopctxfunctiondefinition\relax -\normalprotected\def\startctxfunction #1 % +\protected\def\startctxfunction #1 % {\begingroup \obeylualines \obeyluatokens \luat_start_lua_function_indeed{#1}} \def\luat_start_lua_function_indeed#1#2\stopctxfunction @@ -267,23 +267,23 @@ % \ifdefined\normalluadef - \normalprotected\def\installctxfunction#1#2% expandable + \protected\def\installctxfunction#1#2% expandable {\edef\m_syst_name{\csstring#1}% \global\expandafter\normalluadef\csname\m_syst_name\endcsname\ctxcommand{ctxfunction(\!!bs#2\!!es,true)}\relax} - \normalprotected\def\installctxscanner#1#2% expandable + \protected\def\installctxscanner#1#2% expandable {\edef\m_syst_name{\csstring#1}% \global\expandafter\normalluadef\csname\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name",\!!bs#2\!!es,true)}\relax} - \normalprotected\def\installprotectedctxfunction#1#2% protected + \protected\def\installprotectedctxfunction#1#2% protected {\edef\m_syst_name{\csstring#1}% - \global\normalprotected\expandafter\normalluadef\csname\m_syst_name\endcsname\ctxcommand{ctxfunction(\!!bs#2\!!es,true)}\relax} + \global\protected\expandafter\normalluadef\csname\m_syst_name\endcsname\ctxcommand{ctxfunction(\!!bs#2\!!es,true)}\relax} - \normalprotected\def\installprotectedctxscanner#1#2% protected + \protected\def\installprotectedctxscanner#1#2% protected {\edef\m_syst_name{\csstring#1}% - \global\normalprotected\expandafter\normalluadef\csname\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name",\!!bs#2\!!es,true)}\relax} + \global\protected\expandafter\normalluadef\csname\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name",\!!bs#2\!!es,true)}\relax} - \normalprotected\def\resetctxscanner#1% + \protected\def\resetctxscanner#1% {\edef\m_syst_name{\csstring#1}% \expandafter\glet\csname\m_syst_name\endcsname\relax} @@ -295,53 +295,53 @@ % \else % % \ifdefined\luafunctioncall \else -% \normalprotected\def\luafunctioncall{\luafunction} +% \protected\def\luafunctioncall{\luafunction} % \fi % -% \normalprotected\def\installctxfunction#1#2% expandable +% \protected\def\installctxfunction#1#2% expandable % {\edef\m_syst_name{\csstring#1}% % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxfunction("#2",true)}\relax % \expandafter\xdef\csname\m_syst_name\endcsname{\noexpand\luafunction\csname\??luafunction\m_syst_name\endcsname}} % -% \normalprotected\def\installctxscanner#1#2% expandable +% \protected\def\installctxscanner#1#2% expandable % {\edef\m_syst_name{\csstring#1}% % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name","#2",true)}\relax % \expandafter\xdef\csname\m_syst_name\endcsname{\noexpand\luafunction\csname\??luafunction\m_syst_name\endcsname}} % -% \normalprotected\def\installprotectedctxfunction#1#2% protected +% \protected\def\installprotectedctxfunction#1#2% protected % {\edef\m_syst_name{\csstring#1}% % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxfunction("#2",true)}\relax % \expandafter\xdef\csname\m_syst_name\endcsname{\noexpand\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} % -% \normalprotected\def\installprotectedctxscanner#1#2% protected +% \protected\def\installprotectedctxscanner#1#2% protected % {\edef\m_syst_name{\csstring#1}% % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name","#2",true)}\relax % \expandafter\xdef\csname\m_syst_name\endcsname{\noexpand\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} % -% \normalprotected\def\resetctxscanner#1% +% \protected\def\resetctxscanner#1% % {\edef\m_syst_name{\csstring#1}% % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\zerocount % \expandafter\glet\csname\m_syst_name\endcsname\relax} % -% % \normalprotected\def\installctxfunctioncall#1#2% +% % \protected\def\installctxfunctioncall#1#2% % % {\edef\m_syst_name{\csstring#1}% % % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxfunction("#2",true)}\relax % % \expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} % % -% % \normalprotected\def\installctxscannercall#1#2% +% % \protected\def\installctxscannercall#1#2% % % {\edef\m_syst_name{\csstring#1}% % % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name","#2",true)}\relax % % \expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} % % -% % \normalprotected\def\installprotectedctxfunctioncall#1#2% +% % \protected\def\installprotectedctxfunctioncall#1#2% % % {\edef\m_syst_name{\csstring#1}% % % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxfunction("#2",true)}\relax -% % \normalprotected\expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} +% % \protected\expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} % % -% % \normalprotected\def\installprotectedctxscannercall#1#2% +% % \protected\def\installprotectedctxscannercall#1#2% % % {\edef\m_syst_name{\csstring#1}% % % \global\expandafter\chardef\csname\??luafunction\m_syst_name\endcsname\ctxcommand{ctxscanner("\m_syst_name","#2",true)}\relax -% % \normalprotected\expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} +% % \protected\expandafter\xdef\csname\m_syst_name\endcsname{\luafunctioncall\csname\??luafunction\m_syst_name\endcsname}} % % \fi diff --git a/tex/context/base/mkiv/luat-lib.mkiv b/tex/context/base/mkiv/luat-lib.mkiv index 0ffd1dd40..a42d73f6d 100644 --- a/tex/context/base/mkiv/luat-lib.mkiv +++ b/tex/context/base/mkiv/luat-lib.mkiv @@ -99,8 +99,8 @@ \registerctxluafile{lxml-aux}{} \registerctxluafile{lxml-mis}{} -\normalprotected\def\writestatus#1#2{\ctxlua{logs.status([==[#1]==],[==[#2]==])}} -\normalprotected\def\writestring #1{\ctxlua{logs.writer([==[#1]==],"\string\n")}} -\normalprotected\def\writeline {\ctxlua{logs.newline()}} +\protected\def\writestatus#1#2{\ctxlua{logs.status([==[#1]==],[==[#2]==])}} +\protected\def\writestring #1{\ctxlua{logs.writer([==[#1]==],"\string\n")}} +\protected\def\writeline {\ctxlua{logs.newline()}} \endinput diff --git a/tex/context/base/mkiv/lxml-aux.lua b/tex/context/base/mkiv/lxml-aux.lua index dd0e733c0..f93d472ea 100644 --- a/tex/context/base/mkiv/lxml-aux.lua +++ b/tex/context/base/mkiv/lxml-aux.lua @@ -195,16 +195,29 @@ end xml.toelement = xmltoelement +-- local function copiedelement(element,newparent) +-- if type(element) ~= "string" then +-- element = xmlcopy(element).dt +-- if newparent and type(element) == "table" then +-- element.__p__ = newparent +-- end +-- end +-- return element +-- end + local function copiedelement(element,newparent) - if type(element) == "string" then - return element - else + if type(element) ~= "string" then element = xmlcopy(element).dt if newparent and type(element) == "table" then - element.__p__ = newparent + for i=1,#element do + local e = element[i] + if type(e) == "table" then + e.__p__ = newparent + end + end end - return element end + return element end function xml.delete(root,pattern) @@ -544,30 +557,50 @@ end local b_collapser = lpegpatterns.b_collapser local m_collapser = lpegpatterns.m_collapser local e_collapser = lpegpatterns.e_collapser +local x_collapser = lpegpatterns.x_collapser local b_stripper = lpegpatterns.b_stripper local m_stripper = lpegpatterns.m_stripper local e_stripper = lpegpatterns.e_stripper +local x_stripper = lpegpatterns.x_stripper -local function stripelement(e,nolines,anywhere) +local function stripelement(e,nolines,anywhere,everything) local edt = e.dt + print(nolines,anywhere,everything) if edt then local n = #edt if n == 0 then return e -- convenient + elseif everything then + local t = { } + local m = 0 + for i=1,n do + local str = edt[i] + if type(str) ~= "string" then + m = m + 1 + t[m] = str + elseif str ~= "" then + str = lpegmatch(x_collapser,str) + if str ~= "" then + m = m + 1 + t[m] = str + end + end + end + e.dt = t elseif anywhere then local t = { } local m = 0 - for e=1,n do - local str = edt[e] + for i=1,n do + local str = edt[i] if type(str) ~= "string" then m = m + 1 t[m] = str elseif str ~= "" then if nolines then - str = lpegmatch((n == 1 and b_collapser) or (n == m and e_collapser) or m_collapser,str) + str = lpegmatch((i == 1 and b_collapser) or (i == m and e_collapser) or m_collapser,str) else - str = lpegmatch((n == 1 and b_stripper) or (n == m and e_stripper) or m_stripper,str) + str = lpegmatch((i == 1 and b_stripper) or (i == m and e_stripper) or m_stripper,str) end if str ~= "" then m = m + 1 @@ -611,11 +644,11 @@ end xml.stripelement = stripelement -function xml.strip(root,pattern,nolines,anywhere) -- strips all leading and trailing spacing +function xml.strip(root,pattern,nolines,anywhere,everything) -- strips all leading and trailing spacing local collected = xmlapplylpath(root,pattern) -- beware, indices no longer are valid now if collected then for i=1,#collected do - stripelement(collected[i],nolines,anywhere) + stripelement(collected[i],nolines,anywhere,everything) end end -- return root diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua index 77cc8717c..43643f71a 100644 --- a/tex/context/base/mkiv/lxml-ini.lua +++ b/tex/context/base/mkiv/lxml-ini.lua @@ -116,6 +116,7 @@ implement { name = "xmlsetsetup", public = true, actions = lxml.setsetu implement { name = "xmlsnippet", public = true, actions = lxml.snippet, arguments = "2 strings" } implement { name = "xmlstrip", public = true, actions = lxml.strip, arguments = "2 strings" } implement { name = "xmlstripanywhere", public = true, actions = lxml.strip, arguments = { "string", "string", true, true } } +implement { name = "xmlstripeverything", public = true, actions = lxml.strip, arguments = { "string", "string", true, true, true } } implement { name = "xmlstripnolines", public = true, actions = lxml.strip, arguments = { "string", "string", true } } implement { name = "xmlstripped", public = true, actions = lxml.stripped, arguments = "2 strings" } implement { name = "xmlstrippednolines", public = true, actions = lxml.stripped, arguments = { "string", "string", true } } diff --git a/tex/context/base/mkiv/lxml-lpt.lua b/tex/context/base/mkiv/lxml-lpt.lua index dc9964d0f..9e4b475fb 100644 --- a/tex/context/base/mkiv/lxml-lpt.lua +++ b/tex/context/base/mkiv/lxml-lpt.lua @@ -648,7 +648,7 @@ local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") ----- lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end local lp_fastpos_p = P("+")^0 * R("09")^1 * P(-1) / "l==%0" -local lp_fastpos_n = P("-") * R("09")^1 * P(-1) / "(%0<0 and (#list+%0==l))" +local lp_fastpos_n = P("-") * R("09")^1 * P(-1) / "(%0<0 and (#list+%0+1==l))" -- +1 added local lp_fastpos = lp_fastpos_n + lp_fastpos_p local lp_reserved = C("and") + C("or") + C("not") + C("div") + C("mod") + C("true") + C("false") diff --git a/tex/context/base/mkiv/lxml-tab.lua b/tex/context/base/mkiv/lxml-tab.lua index 1ef82d74d..3af4974d3 100644 --- a/tex/context/base/mkiv/lxml-tab.lua +++ b/tex/context/base/mkiv/lxml-tab.lua @@ -1427,9 +1427,17 @@ local function copy(old,p) new[k] = t elseif k == "dt" then v.__p__ = nil - v = copy(v,new) - new[k] = v - v.__p__ = p + local t = { } + for i=1,#v do + local vi = v[i] + if type(vi) == "table" then + t[i] = copy(vi,new) + else + t[i] = vi + end + end + new[k] = t + t.__p__ = p else new[k] = v -- so we also share entities, etc in root end diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua index 00bff7873..7a79ee15f 100644 --- a/tex/context/base/mkiv/lxml-tex.lua +++ b/tex/context/base/mkiv/lxml-tex.lua @@ -2382,8 +2382,8 @@ function lxml.nonspace(id,pattern) -- slow, todo loop xmltprint(xmlcollect(getid(id),pattern,true)) end -function lxml.strip(id,pattern,nolines,anywhere) - xml.strip(getid(id),pattern,nolines,anywhere) +function lxml.strip(id,pattern,nolines,anywhere,everywhere) + xml.strip(getid(id),pattern,nolines,anywhere,everywhere) end function lxml.stripped(id,pattern,nolines) diff --git a/tex/context/base/mkiv/mult-aux.mkiv b/tex/context/base/mkiv/mult-aux.mkiv index 99d252c6b..15a5b26a9 100644 --- a/tex/context/base/mkiv/mult-aux.mkiv +++ b/tex/context/base/mkiv/mult-aux.mkiv @@ -186,28 +186,28 @@ %D and that only the high level setup commands are used with language specific %D interfaces. -% \unexpanded\def\mult_interfaces_let #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -% \unexpanded\def\mult_interfaces_lete#1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty} -% \unexpanded\def\mult_interfaces_def #1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -% \unexpanded\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -% \unexpanded\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -% \unexpanded\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_let #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_lete#1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty} +% \protected\def\mult_interfaces_def #1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} % \startinterface english - \unexpanded\def\mult_interfaces_let #1#2{\expandafter \let\csname#1#2\endcsname} - \unexpanded\def\mult_interfaces_lete#1#2{\expandafter \let\csname#1#2\endcsname\empty} - \unexpanded\def\mult_interfaces_def #1#2{\expandafter \def\csname#1#2\endcsname} - \unexpanded\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1#2\endcsname} - \unexpanded\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1#2\endcsname} - \unexpanded\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1#2\endcsname} + \protected\def\mult_interfaces_let #1#2{\expandafter \let\csname#1#2\endcsname} + \protected\def\mult_interfaces_lete#1#2{\expandafter \let\csname#1#2\endcsname\empty} + \protected\def\mult_interfaces_def #1#2{\expandafter \def\csname#1#2\endcsname} + \protected\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1#2\endcsname} + \protected\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1#2\endcsname} + \protected\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1#2\endcsname} % \stopinterface %D Do, we only interface the assignment definition: -\unexpanded\def\mult_interfaces_adef#1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +\protected\def\mult_interfaces_adef#1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} \startinterface english - \unexpanded\def\mult_interfaces_adef#1#2{\expandafter \def\csname#1#2\endcsname} + \protected\def\mult_interfaces_adef#1#2{\expandafter \def\csname#1#2\endcsname} \stopinterface % the commented detokenized variant that backtracks ... needs testing usage first @@ -226,7 +226,7 @@ \def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter} -\unexpanded\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only) +\protected\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only) {\ifx#2\relax\let#2\empty\fi % it is hardly faster but produces less expansion tracing \def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}% \def#4##1##2{\ifcsname##1:##2\endcsname##1:##2\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}% @@ -238,7 +238,7 @@ \def#8##1{\begincsname#1#2:##1\endcsname} \def#9##1##2{\expandafter\let\expandafter##1\csname\ifcsname#1#2:##2\endcsname#1#2:##2\else\expandafter#5\csname#1#2:\s!parent\endcsname{##2}\fi\endcsname}} -\unexpanded\def\installparameterhandler#1#2% +\protected\def\installparameterhandler#1#2% {\normalexpanded {\mult_interfaces_install_parameter_handler {\noexpand#1}% \??aa @@ -251,18 +251,18 @@ \expandafter\noexpand\csname direct#2parameter\endcsname \expandafter\noexpand\csname letfrom#2parameter\endcsname}} % strict#2parameter is gone -\unexpanded\def\mult_interfaces_install_root_parameter_handler#1#2#3% +\protected\def\mult_interfaces_install_root_parameter_handler#1#2#3% {\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}% always root \def#3##1{\begincsname#1:##1\endcsname}} -\unexpanded\def\installrootparameterhandler#1#2% +\protected\def\installrootparameterhandler#1#2% {\normalexpanded {\mult_interfaces_install_root_parameter_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname detokenizedroot#2parameter\endcsname \expandafter\noexpand\csname root#2parameter\endcsname}} -\unexpanded\def\mult_interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9% +\protected\def\mult_interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9% {\ifx#2\relax\let#2\empty\fi \def#3##1{#1#4{#1#2}{##1}:}% leading #1 was missing .. is this one used? \def#4##1##2{\ifcsname##1:##2\endcsname##1\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}% @@ -271,9 +271,9 @@ \def#6{#1#2:}% \def#7##1{#1##1:}% \def#8{\ifx#2\empty\else\ifcsname#1#2:\s!parent\endcsname\else\expandafter\let\csname#1#2:\s!parent\endcsname#1\fi\fi}% - \unexpanded\def#9##1{\expandafter\edef\csname#1##1:\s!parent\endcsname{#1#2}}} + \protected\def#9##1{\expandafter\edef\csname#1##1:\s!parent\endcsname{#1#2}}} -\unexpanded\def\installparameterhashhandler#1#2% +\protected\def\installparameterhashhandler#1#2% {\expandafter\let\csname#2namespace\endcsname#1% \normalexpanded {\mult_interfaces_install_parameter_hash_handler @@ -291,23 +291,23 @@ % todo: inline the def/let -% \unexpanded\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% +% \protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% % {\ifx#2\relax\let#2\empty\fi -% \unexpanded\def#3{\mult_interfaces_def {#1#2:}}% ##1 {##2} (braces are mandate) -% \unexpanded\def#4{\mult_interfaces_edef{#1#2:}}% ##1 {##2} (braces are mandate) -% \unexpanded\def#5{\mult_interfaces_let {#1#2:}}% ##1 ##2 -% \unexpanded\def#6{\mult_interfaces_lete{#1#2:}}}% ##1 +% \protected\def#3{\mult_interfaces_def {#1#2:}}% ##1 {##2} (braces are mandate) +% \protected\def#4{\mult_interfaces_edef{#1#2:}}% ##1 {##2} (braces are mandate) +% \protected\def#5{\mult_interfaces_let {#1#2:}}% ##1 ##2 +% \protected\def#6{\mult_interfaces_lete{#1#2:}}}% ##1 % % \startinterface english - \unexpanded\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% + \protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% {\ifx#2\relax\let#2\empty\fi - \unexpanded\def#3##1{\expandafter \def\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) - \unexpanded\def#4##1{\expandafter\edef\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) - \unexpanded\def#5##1{\expandafter \let\csname#1#2:##1\endcsname}% ##1 ##2 - \unexpanded\def#6##1{\expandafter \let\csname#1#2:##1\endcsname\empty}}% ##1 + \protected\def#3##1{\expandafter \def\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) + \protected\def#4##1{\expandafter\edef\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) + \protected\def#5##1{\expandafter \let\csname#1#2:##1\endcsname}% ##1 ##2 + \protected\def#6##1{\expandafter \let\csname#1#2:##1\endcsname\empty}}% ##1 % \stopinterface -\unexpanded\def\installparametersethandler#1#2% +\protected\def\installparametersethandler#1#2% {\normalexpanded {\mult_interfaces_install_parameter_set_handler {\noexpand#1}% \??aa @@ -323,20 +323,20 @@ \let\currentstyleparameter\empty \let\currentcolorparameter\empty -\unexpanded\def\mult_interfaces_install_style_and_color_handler#1#2#3#4% - {\unexpanded\def#2##1##2% style color +\protected\def\mult_interfaces_install_style_and_color_handler#1#2#3#4% + {\protected\def#2##1##2% style color {\edef\currentstyleparameter{#1{##1}}% this name is public (can also set color e.g. in underline) \ifx\currentstyleparameter\empty\else\dousecurrentstyleparameter\fi \edef\currentcolorparameter{#1{##2}}% this name is public (so we do this after the style switch) \ifx\currentcolorparameter\empty\else\dousecurrentcolorparameter\fi}% - \unexpanded\def#3##1% style + \protected\def#3##1% style {\edef\currentstyleparameter{#1{##1}}% this name is public \ifx\currentstyleparameter\empty\else\dousecurrentstyleparameter\fi}% - \unexpanded\def#4##1% color + \protected\def#4##1% color {\edef\currentcolorparameter{#1{##1}}% this name is public \ifx\currentcolorparameter\empty\else\dousecurrentcolorparameter\fi}} -\unexpanded\def\installstyleandcolorhandler#1#2% +\protected\def\installstyleandcolorhandler#1#2% {\normalexpanded {\mult_interfaces_install_style_and_color_handler \expandafter\noexpand\csname #2parameter\endcsname @@ -360,12 +360,12 @@ \def\getparentchain #1#2{\begincsname#1#2:\s!chain\endcsname} \def\getcurrentparentchain#1#2{\begincsname#1#2:\s!chain\endcsname} -% \unexpanded\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones +% \protected\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones % {\ifx#4\relax\let#4\empty\fi % see \defineregister -% \unexpanded\def#2{\dotripleempty#5}% +% \protected\def#2{\dotripleempty#5}% % \newtoks#6% % \newtoks#7% -% \unexpanded\def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] +% \protected\def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] % {\let#9#4% % \edef#4{##1}% % \ifthirdargument @@ -398,12 +398,12 @@ % \the#7% % \let#4#9}} -\unexpanded\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones +\protected\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones {\ifx#4\relax\let#4\empty\fi % see \defineregister - \unexpanded\def#2{\dotripleempty#5}% + \protected\def#2{\dotripleempty#5}% \newtoks#6% \newtoks#7% - \unexpanded\def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] + \protected\def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] {\let#9#4% \edef#4{##1}% \ifthirdargument @@ -435,7 +435,7 @@ \the#7% \let#4#9}} -\unexpanded\def\installdefinehandler#1#2#3% +\protected\def\installdefinehandler#1#2#3% {\normalexpanded {\mult_interfaces_install_define_handler {\noexpand#1}% \??aa @@ -448,13 +448,13 @@ \expandafter\noexpand\csname current#2parent\endcsname \expandafter\noexpand\csname saved_defined_#2\endcsname}} -\unexpanded\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8#9% +\protected\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8#9% {\ifx#3\relax\let#3\empty\fi - \unexpanded\def#2{\dodoubleempty#4}% - \unexpanded\def#6{\mult_interfaces_get_parameters{#1#3:}}% no every ! don't change it + \protected\def#2{\dodoubleempty#4}% + \protected\def#6{\mult_interfaces_get_parameters{#1#3:}}% no every ! don't change it \newtoks#5% \newtoks#8% - \unexpanded\def#4[##1][##2]% maybe helper + \protected\def#4[##1][##2]% maybe helper {\let#7#3% \ifsecondargument \def#9####1% we will have a simple one as well @@ -470,7 +470,7 @@ \let#3#7% \the#8}} -\unexpanded\def\installsetuphandler#1#2% +\protected\def\installsetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_setup_handler {\noexpand#1}% \??aa @@ -488,18 +488,18 @@ \let\doingrootsetnamed \plusthree % \setuplayout[name] \let\doingrootsetroot \plusfour % \setuplayout -\unexpanded\def\mult_interfaces_install_switch_setup_handler_a#1#2#3#4#5% +\protected\def\mult_interfaces_install_switch_setup_handler_a#1#2#3#4#5% {\ifx#3\relax\let#3\empty\fi - \unexpanded\def#2{\dodoubleempty#4}% - \unexpanded\def#5{\mult_interfaces_get_parameters{#1#3:}}} + \protected\def#2{\dodoubleempty#4}% + \protected\def#5{\mult_interfaces_get_parameters{#1#3:}}} -% \unexpanded\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% +% \protected\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% % {\newtoks#5% % \newconstant#2% % \newtoks#8% % \newtoks#9% % \ifx#6\relax\let#6\empty\fi -% \unexpanded\def#4[##1][##2]% maybe helper +% \protected\def#4[##1][##2]% maybe helper % {\ifsecondargument % no commalist here % % \setuplayout[whatever][key=value] % \let#7#3% @@ -542,13 +542,13 @@ % #2\zerocount % mode is always zero at the end % \the#9}} -\unexpanded\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% +\protected\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% {\newtoks#5% \newconstant#2% \newtoks#8% \newtoks#9% \ifx#6\relax\let#6\empty\fi - \unexpanded\def#4[##1][##2]% maybe helper + \protected\def#4[##1][##2]% maybe helper {\ifsecondargument % no commalist here % \setuplayout[whatever][key=value] \let#7#3% @@ -590,7 +590,7 @@ #2\zerocount % mode is always zero at the end \the#9}} -\unexpanded\def\installswitchsetuphandler#1#2% +\protected\def\installswitchsetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_switch_setup_handler_a {\noexpand#1}% \??aa @@ -609,10 +609,10 @@ \expandafter\noexpand\csname everyswitch#2\endcsname \expandafter\noexpand\csname everysetup#2root\endcsname}} -\unexpanded\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8#9% +\protected\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8#9% {\ifx#3\relax\let#3\empty\fi - \unexpanded\def#2{\dotripleempty#4}% - \unexpanded\def#6{\mult_interfaces_get_parameters{#1#3:}}% + \protected\def#2{\dotripleempty#4}% + \protected\def#6{\mult_interfaces_get_parameters{#1#3:}}% \newtoks#5% \def#4[##1][##2][##3]% {\let#8#3% @@ -637,7 +637,7 @@ \fi\fi \let#3#8}} -\unexpanded\def\installautosetuphandler#1#2% +\protected\def\installautosetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_auto_setup_handler {\noexpand#1}% \??aa @@ -650,40 +650,40 @@ \expandafter\noexpand\csname saved_setup_current#2\endcsname \expandafter\noexpand\csname nested_setup_current#2\endcsname}} -\unexpanded\def\installbasicparameterhandler#1#2% +\protected\def\installbasicparameterhandler#1#2% {\installparameterhandler {#1}{#2}% \installparameterhashhandler{#1}{#2}% \installparametersethandler {#1}{#2}% \installrootparameterhandler{#1}{#2}} -\unexpanded\def\installbasicautosetuphandler#1#2#3% \??self name \??parent (can be \??self) +\protected\def\installbasicautosetuphandler#1#2#3% \??self name \??parent (can be \??self) {\installbasicparameterhandler{#1}{#2}% \installautosetuphandler {#1}{#2}} -\unexpanded\def\installstylisticautosetuphandler#1#2#3% \??self name \??parent (can be \??self) +\protected\def\installstylisticautosetuphandler#1#2#3% \??self name \??parent (can be \??self) {\installbasicparameterhandler{#1}{#2}% \installautosetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\unexpanded\def\installcommandhandler#1#2#3% \??self name \??parent (can be \??self) +\protected\def\installcommandhandler#1#2#3% \??self name \??parent (can be \??self) {\installbasicparameterhandler{#1}{#2}% \installdefinehandler {#1}{#2}{#3}% \installsetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\unexpanded\def\installswitchcommandhandler#1#2#3% \??self name \??parent (can be \??self) +\protected\def\installswitchcommandhandler#1#2#3% \??self name \??parent (can be \??self) {\installbasicparameterhandler{#1}{#2}% \installdefinehandler {#1}{#2}{#3}% \installswitchsetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\unexpanded\def\installautocommandhandler#1#2#3% automatically defined cloned setups +\protected\def\installautocommandhandler#1#2#3% automatically defined cloned setups {\installbasicparameterhandler{#1}{#2}% \installdefinehandler {#1}{#2}{#3}% \installautosetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\unexpanded\def\installsimplecommandhandler#1#2#3% no define (experiment) - use \check*parent when defining +\protected\def\installsimplecommandhandler#1#2#3% no define (experiment) - use \check*parent when defining {\installbasicparameterhandler{#1}{#2}% \installsetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} @@ -699,14 +699,14 @@ %D We don't need colons for such simple cases. -\unexpanded\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5% +\protected\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5% %%{\def#3##1{\csname\ifcsname#1##1\endcsname#1##1\else\s!empty\fi\endcsname}% {\def#3##1{\begincsname#1##1\endcsname}% \def#4##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}% % \def#4##1{\mult_interfaces_detokenize{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}}% \def#5##1{\begincsname#1##1\endcsname}} -\unexpanded\def\installdirectparameterhandler#1#2% +\protected\def\installdirectparameterhandler#1#2% {\normalexpanded {\mult_interfaces_install_direct_parameter_handler {\noexpand#1}% @@ -715,13 +715,13 @@ \expandafter\noexpand\csname detokenized#2parameter\endcsname \expandafter\noexpand\csname direct#2parameter\endcsname}} -\unexpanded\def\mult_interfaces_install_direct_setup_handler#1#2#3#4#5% - {\unexpanded\def#2{\dosingleempty#3}% +\protected\def\mult_interfaces_install_direct_setup_handler#1#2#3#4#5% + {\protected\def#2{\dosingleempty#3}% \newtoks#5% \def#3[##1]{\mult_interfaces_get_parameters#1[##1]\the#5}% \def#4{\mult_interfaces_get_parameters#1}} -\unexpanded\def\installdirectsetuphandler#1#2% +\protected\def\installdirectsetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_direct_setup_handler {\noexpand#1}% \??aa @@ -730,21 +730,21 @@ \expandafter\noexpand\csname setupcurrent#2\endcsname % no \every (we use 'current' for consistency) \expandafter\noexpand\csname everysetup#2\endcsname}} -% \unexpanded\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% -% {\unexpanded\def#2{\mult_interfaces_def #1}% -% \unexpanded\def#3{\mult_interfaces_edef#1}% -% \unexpanded\def#4{\mult_interfaces_let #1}% -% \unexpanded\def#5{\mult_interfaces_let #1\empty}}% +% \protected\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% +% {\protected\def#2{\mult_interfaces_def #1}% +% \protected\def#3{\mult_interfaces_edef#1}% +% \protected\def#4{\mult_interfaces_let #1}% +% \protected\def#5{\mult_interfaces_let #1\empty}}% % \startinterface english - \unexpanded\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% - {\unexpanded\def#2##1{\expandafter \def\csname#1##1\endcsname}% - \unexpanded\def#3##1{\expandafter\edef\csname#1##1\endcsname}% - \unexpanded\def#4##1{\expandafter \let\csname#1##1\endcsname}% - \unexpanded\def#5##1{\expandafter \let\csname#1##1\endcsname\empty}}% + \protected\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% + {\protected\def#2##1{\expandafter \def\csname#1##1\endcsname}% + \protected\def#3##1{\expandafter\edef\csname#1##1\endcsname}% + \protected\def#4##1{\expandafter \let\csname#1##1\endcsname}% + \protected\def#5##1{\expandafter \let\csname#1##1\endcsname\empty}}% % \stopinterface -\unexpanded\def\installdirectparametersethandler#1#2% +\protected\def\installdirectparametersethandler#1#2% {\normalexpanded {\mult_interfaces_install_direct_parameter_set_handler {\noexpand#1}% \??aa @@ -755,13 +755,13 @@ \let\installdirectstyleandcolorhandler\installstyleandcolorhandler -\unexpanded\def\installdirectcommandhandler#1#2% +\protected\def\installdirectcommandhandler#1#2% {\installdirectparameterhandler {#1}{#2}% \installdirectsetuphandler {#1}{#2}% \installdirectparametersethandler {#1}{#2}% \installdirectstyleandcolorhandler{#1}{#2}} -\unexpanded\def\installsetuponlycommandhandler#1#2% +\protected\def\installsetuponlycommandhandler#1#2% {\installdirectparameterhandler{#1}{#2}% \installdirectsetuphandler {#1}{#2}% }% maybe \installdirectparametersethandler {#1}{#2}% @@ -789,15 +789,15 @@ % yes:\twoparameter{alpha}\par % yes:\twoparameter{beta}\par -\unexpanded\def\relateparameterhandlers#1#2#3#4% {from} {instance} {to} {instance} +\protected\def\relateparameterhandlers#1#2#3#4% {from} {instance} {to} {instance} {\expandafter\edef\csname\csname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}} -\unexpanded\def\relateparameterhandlersbyns#1#2#3#4% {from} {instance} {to} {instance} +\protected\def\relateparameterhandlersbyns#1#2#3#4% {from} {instance} {to} {instance} {\expandafter\edef\csname#1#2:\s!parent\endcsname{#3#4}} %D Here is another experiment: -\unexpanded\def\installactionhandler#1% +\protected\def\installactionhandler#1% {\normalexpanded {\mult_interfaces_install_action_handler {#1}% @@ -805,9 +805,9 @@ \expandafter\noexpand\csname setupcurrent#1\endcsname \expandafter\noexpand\csname #1_action\endcsname}} -% \unexpanded\def\mult_interfaces_install_action_handler#1#2#3#4% -% {\unexpanded\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% -% \unexpanded\def#4[##1][##2]% +% \protected\def\mult_interfaces_install_action_handler#1#2#3#4% +% {\protected\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% +% \protected\def#4[##1][##2]% % {\begingroup % \ifsecondargument % \edef#2{##1}% @@ -823,9 +823,9 @@ % \directsetup{handler:action:#1}% % \endgroup}} -\unexpanded\def\mult_interfaces_install_action_handler#1#2#3#4% - {\unexpanded\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% - \unexpanded\def#4[##1][##2]% +\protected\def\mult_interfaces_install_action_handler#1#2#3#4% + {\protected\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% + \protected\def#4[##1][##2]% {\begingroup \ifsecondargument \edef#2{##1}% @@ -846,7 +846,7 @@ % First we had, in tune with the regular system variables: % % \starttyping -% \unexpanded\def\installnamespace#1{\setvalue{????#1}{@@@@#1}} +% \protected\def\installnamespace#1{\setvalue{????#1}{@@@@#1}} % \stoptyping % % The following variant is nicer and in principle faster but that gets unnoticed @@ -880,7 +880,7 @@ \def\v_interfaces_prefix_template {\number\c_mult_interfaces_n_of_namespaces>} -\unexpanded\def\installnamespace#1% for modules and users +\protected\def\installnamespace#1% for modules and users {\ifcsname ????#1\endcsname \writestatus\m!system{duplicate user namespace '#1'}\wait \else @@ -888,7 +888,7 @@ \expandafter\edef\csname ????#1\endcsname{\v_interfaces_prefix_template}% \fi} -\unexpanded\def\installcorenamespace#1% +\protected\def\installcorenamespace#1% {\ifcsname ??#1\endcsname \writestatus\m!system{duplicate core namespace '#1'}\wait \else @@ -913,16 +913,16 @@ \letvalue\??dummy\empty - \def\dummyparameter #1{\begincsname\??dummy#1\endcsname} - \def\directdummyparameter #1{\begincsname\??dummy#1\endcsname} -\unexpanded\def\setdummyparameter #1{\expandafter\def\csname\??dummy#1\endcsname} -\unexpanded\def\setexpandeddummyparameter#1{\expandafter\edef\csname\??dummy#1\endcsname} -\unexpanded\def\letdummyparameter #1{\expandafter\let\csname\??dummy#1\endcsname} + \def\dummyparameter #1{\begincsname\??dummy#1\endcsname} + \def\directdummyparameter #1{\begincsname\??dummy#1\endcsname} +\protected\def\setdummyparameter #1{\expandafter\def\csname\??dummy#1\endcsname} +\protected\def\setexpandeddummyparameter#1{\expandafter\edef\csname\??dummy#1\endcsname} +\protected\def\letdummyparameter #1{\expandafter\let\csname\??dummy#1\endcsname} -% \unexpanded\def\getdummyparameters +% \protected\def\getdummyparameters % {\mult_interfaces_get_parameters\??dummy} -\unexpanded\def\getdummyparameters[#1% +\protected\def\getdummyparameters[#1% {\if\noexpand#1]% \expandafter\gobbleoneargument \else @@ -977,7 +977,7 @@ % % This is a user (module) command: -\unexpanded\def\definenamespace +\protected\def\definenamespace {\dodoubleargument\mult_interfaces_define_name_space} \def\mult_interfaces_define_name_space[#1][#2]% namespace settings @@ -992,7 +992,7 @@ %D \showparentchain{@@am}{left} %D \stoptyping -\unexpanded\def\showparentchain#1#2% +\protected\def\showparentchain#1#2% {\writestatus\m!system{chain: [ \mult_interfaces_show_parent_chain{#1#2}]}} % \def\mult_interfaces_show_parent_chain#1% @@ -1010,7 +1010,7 @@ %D Another helper (needs to be applied): -\unexpanded\def\doifelsecommandhandler#1#2% namespace name +\protected\def\doifelsecommandhandler#1#2% namespace name {\ifcsname#1#2:\s!parent\endcsname \expandafter\firstoftwoarguments \else @@ -1019,14 +1019,14 @@ \let\doifcommandhandlerelse\doifelsecommandhandler -\unexpanded\def\doifcommandhandler#1#2% namespace name +\protected\def\doifcommandhandler#1#2% namespace name {\ifcsname#1#2:\s!parent\endcsname \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotcommandhandler#1#2% namespace name +\protected\def\doifnotcommandhandler#1#2% namespace name {\ifcsname#1#2:\s!parent\endcsname \expandafter\gobbleoneargument \else @@ -1077,7 +1077,7 @@ \def\s!double{double} \def\s!triple{triple} -% \unexpanded\def\syst_helpers_double_empty#1#2#3% +% \protected\def\syst_helpers_double_empty#1#2#3% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_double_empty_one_yes_mult#2#3}% @@ -1105,17 +1105,17 @@ % \def\syst_helpers_double_empty_one_spaced_mult#1#2{#1[{#2}] } % \def\syst_helpers_double_empty_one_normal_mult#1#2{#1[{#2}]} % -% \unexpanded\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8% +% \protected\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8% % {\ifx#3\relax\let#3\empty\fi -% \unexpanded\def#5{\mult_interfaces_get_parameters{#1#3:}}% no every ! don't change it +% \protected\def#5{\mult_interfaces_get_parameters{#1#3:}}% no every ! don't change it % \newtoks#4% % \newtoks#7% % \edef\m_mult_interface_setup{\csstring#2_}% -% \unexpanded\edef#2{\syst_helpers_double_empty +% \protected\edef#2{\syst_helpers_double_empty % \csname\m_mult_interface_setup\s!simple\endcsname % \csname\m_mult_interface_setup\s!single\endcsname % \csname\m_mult_interface_setup\s!double\endcsname}% -% \unexpanded\expandafter\def\csname\m_mult_interface_setup\s!double\endcsname[##1][##2]% +% \protected\expandafter\def\csname\m_mult_interface_setup\s!double\endcsname[##1][##2]% % {\let#6#3% % \def#8####1% we will have a simple one as well % {\edef#3{####1}% @@ -1124,21 +1124,21 @@ % \processcommalist[##1]#8% % \let#3#6% % \the#7}% -% \unexpanded\expandafter\def\csname\m_mult_interface_setup\s!single\endcsname[##1]% +% \protected\expandafter\def\csname\m_mult_interface_setup\s!single\endcsname[##1]% % {\let#6#3% % \let#3\empty % \mult_interfaces_get_parameters{#1:}[##1]% % \the#4% % \let#3#6% % \the#7}% -% \unexpanded\expandafter\def\csname\m_mult_interface_setup\s!simple\endcsname% +% \protected\expandafter\def\csname\m_mult_interface_setup\s!simple\endcsname% % {\let#6#3% % \let#3\empty % \the#4% % \let#3#6% % \the#7}} -% \unexpanded\def\installsetuphandler#1#2% +% \protected\def\installsetuphandler#1#2% % {\normalexpanded % {\mult_interfaces_install_setup_handler % {\noexpand#1}% \??aa @@ -1150,7 +1150,7 @@ % \expandafter\noexpand\csname everysetup#2root\endcsname % \expandafter\noexpand\csname nested_setup_current#2\endcsname}} % -% \unexpanded\def\syst_helpers_triple_empty#1#2#3#4% +% \protected\def\syst_helpers_triple_empty#1#2#3#4% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_triple_empty_one_yes_mult#2#3#4}% @@ -1196,17 +1196,17 @@ % \def\syst_helpers_triple_empty_three_spaced_mult#1#2#3{#1[{#2}][{#3}] } % \def\syst_helpers_triple_empty_three_normal_mult#1#2#3{#1[{#2}][{#3}]} % -% \unexpanded\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8% +% \protected\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8% % {\ifx#3\relax\let#3\empty\fi -% \unexpanded\def#5{\mult_interfaces_get_parameters{#1#3:}}% +% \protected\def#5{\mult_interfaces_get_parameters{#1#3:}}% % \newtoks#4% % \edef\m_mult_interface_setup{\csstring#2_}% -% \unexpanded\edef#2{\syst_helpers_triple_empty +% \protected\edef#2{\syst_helpers_triple_empty % \csname\m_mult_interface_setup\s!simple\endcsname % \csname\m_mult_interface_setup\s!single\endcsname % \csname\m_mult_interface_setup\s!double\endcsname % \csname\m_mult_interface_setup\s!triple\endcsname}% -% \unexpanded\expandafter\def\csname\m_mult_interface_setup\s!triple\endcsname[##1][##2][##3]% +% \protected\expandafter\def\csname\m_mult_interface_setup\s!triple\endcsname[##1][##2][##3]% % {\let#7#3% % \def#8####1% % {\edef#3{####1}% @@ -1215,7 +1215,7 @@ % \the#4}% % \processcommalist[##1]#8% % \let#3#7}% -% \unexpanded\expandafter\def\csname\m_mult_interface_setup\s!double\endcsname[##1][##2]% +% \protected\expandafter\def\csname\m_mult_interface_setup\s!double\endcsname[##1][##2]% % {\let#7#3% % \def#8####1% % {\edef#3{####1}% @@ -1224,19 +1224,19 @@ % \the#4}% % \processcommalist[##1]#8% % \let#3#7}% -% \unexpanded\expandafter\def\csname\m_mult_interface_setup\s!single\endcsname[##1]% +% \protected\expandafter\def\csname\m_mult_interface_setup\s!single\endcsname[##1]% % {\let#7#3% % \let#3\empty % \mult_interfaces_get_parameters{#1:}[##1]% % \the#4% % \let#3#7}% -% \unexpanded\expandafter\def\csname\m_mult_interface_setup\s!simple\endcsname% +% \protected\expandafter\def\csname\m_mult_interface_setup\s!simple\endcsname% % {\let#7#3% % \let#3\empty % \the#4% % \let#3#7}} % -% \unexpanded\def\installautosetuphandler#1#2% +% \protected\def\installautosetuphandler#1#2% % {\normalexpanded % {\mult_interfaces_install_auto_setup_handler % {\noexpand#1}% \??aa @@ -1266,30 +1266,30 @@ \let\c_mult_set\relax -\unexpanded\def\mult_interfaces_install_definition_set#1#2#3#4#5#6#7% +\protected\def\mult_interfaces_install_definition_set#1#2#3#4#5#6#7% {\newcount#3% \let#6\empty - \unexpanded\def#2% + \protected\def#2% {\expandafter\let\expandafter\c_mult_set\csname #1_t_#6\endcsname \ifx\c_mult_set\relax \expandafter\newtoks\c_mult_set \expandafter\let\csname #1_t_#6\endcsname\c_mult_set \fi} - \unexpanded\def#4##1% + \protected\def#4##1% {\pushmacro#6% \advance#3\plusone \edef#6{##1}% \unprotect}% - \unexpanded\def#5% + \protected\def#5% {\protect \advance#3\minusone \popmacro#6}% - \unexpanded\def#7##1% + \protected\def#7##1% {\edef#6{##1}% #2% \the\c_mult_set\relax}} -\unexpanded\def\installdefinitionset#1#2% +\protected\def\installdefinitionset#1#2% {\normalexpanded {\mult_interfaces_install_definition_set {\noexpand#1}% \??aa @@ -1300,13 +1300,13 @@ \expandafter\noexpand\csname current#2\endcsname \expandafter\noexpand\csname use#2\endcsname}} -\unexpanded\def\mult_interfaces_install_definition_set_member#1#2#3#4#5#6#7#8#9% no everysetups etc +\protected\def\mult_interfaces_install_definition_set_member#1#2#3#4#5#6#7#8#9% no everysetups etc {\let#5#2% - \unexpanded\def#2% + \protected\def#2% {\ifcase#4\relax\expandafter#5\else\expandafter#6\fi}% - \unexpanded\def#6% + \protected\def#6% {\dodoubleempty#7}% - \unexpanded\def#7[##1][##2]% + \protected\def#7[##1][##2]% {\ifsecondargument %#3\c_mult_set\expandafter{\the\c_mult_set#9[##1][##2]}% #3\toksapp\c_mult_set{#9[##1][##2]}% @@ -1315,7 +1315,7 @@ #3\toksapp\c_mult_set{#8[##1]}% \fi\fi}} -\unexpanded\def\installdefinitionsetmember#1#2#3#4% +\protected\def\installdefinitionsetmember#1#2#3#4% {\normalexpanded {\mult_interfaces_install_definition_set_member {\noexpand#3}% \??aa @@ -1330,13 +1330,13 @@ %D Another experiment: -\unexpanded\def\mult_interfaces_install_parent_injector#1#2#3#4% - {\unexpanded\def#4##1% +\protected\def\mult_interfaces_install_parent_injector#1#2#3#4% + {\protected\def#4##1% {\ifx#3\empty \expandafter\def\csname#1#2:\s!parent\endcsname{#1##1}% \fi}} -\unexpanded\def\installparentinjector#1#2% +\protected\def\installparentinjector#1#2% {\normalexpanded{\mult_interfaces_install_parent_injector {\noexpand#1}% \expandafter\noexpand\csname current#2\endcsname @@ -1346,7 +1346,7 @@ % Faster but not used that much to make a dent in performance. But, because it's % cleaner anyway and also gives less tracing, we apply it a few times. -\unexpanded\def\syst_helpers_install_macro_stack#1#2#3% +\protected\def\syst_helpers_install_macro_stack#1#2#3% {\xdef\m_syst_helpers_push_macro{\csstring#1}% \ifcsname#3\m_syst_helpers_push_macro\endcsname\else \expandafter\newcount\csname#3\m_syst_helpers_push_macro\endcsname @@ -1362,23 +1362,23 @@ \noexpand\csname\m_syst_helpers_push_macro\noexpand\the\csname#3\m_syst_helpers_push_macro\endcsname\endcsname}% \fi} -\unexpanded\def\installmacrostack #1{\syst_helpers_install_macro_stack#1\let \??localpushedmacro } -\unexpanded\def\installglobalmacrostack#1{\syst_helpers_install_macro_stack#1\glet\??globalpushedmacro} +\protected\def\installmacrostack #1{\syst_helpers_install_macro_stack#1\let \??localpushedmacro } +\protected\def\installglobalmacrostack#1{\syst_helpers_install_macro_stack#1\glet\??globalpushedmacro} % \unprotect % % \installcorenamespace {test} \installcommandhandler \??test {test} \??test -% \unexpanded\def\TestMeA[#1]% +% \protected\def\TestMeA[#1]% % {\edef\currenttest{#1} % \edef\p_before{\testparameter\c!before}% % \ifx\p_before\empty \relax \else \relax \fi} -% \unexpanded\def\TestMeB[#1]% +% \protected\def\TestMeB[#1]% % {\edef\currenttest{#1} % \doifelsenothing{\testparameter\c!before}\relax\relax} -% \unexpanded\def\TestMeC[#1]% +% \protected\def\TestMeC[#1]% % {\edef\currenttest{#1} % \expandafter\expandafter\expandafter\ifx\testparameter\c!before\empty \relax \else \relax \fi} -% \unexpanded\def\TestMeD[#1]% +% \protected\def\TestMeD[#1]% % {\edef\currenttest{#1} % \doubleexpandafter\ifx\testparameter\c!before\empty \relax \else \relax \fi} % @@ -1396,7 +1396,7 @@ % only gain a few milliseconds: % % \starttyping -% \unexpanded\def\foo#1{[foo:#1]} +% \protected\def\foo#1{[foo:#1]} % % \installcommalistprocessor {foo} \foo % \installcommalistprocessorcommand \processfoolist \foo @@ -1413,7 +1413,7 @@ % \processfoolist[{x,y,z}]\par % \processcommalist[{x,y,z}]\foo\blank % -% \unexpanded\def\foo#1{} +% \protected\def\foo#1{} % % \testfeatureonce{400000}{\processfoolist [fixed,middle,bar]} \elapsedtime\quad %%\testfeatureonce{400000}{\commalistprocessor{foo}[fixed,middle,bar]} \elapsedtime\quad @@ -1434,46 +1434,46 @@ \installcorenamespace{commalistprocessorpickup} \installcorenamespace{commalistprocessorfinish} -\unexpanded\def\installcommalistprocessor#1#2% 8 macro names overhead +\protected\def\installcommalistprocessor#1#2% 8 macro names overhead {\let\nexttoken\relax - \unexpanded\expandafter\edef\csname\??commalistprocessor#1\endcsname[% + \protected\expandafter\edef\csname\??commalistprocessor#1\endcsname[% {\futurelet\nexttoken\csname\??commalistprocessorcheck#1\endcsname}% - \unexpanded\expandafter\edef\csname\??commalistprocessorcheck#1\endcsname + \protected\expandafter\edef\csname\??commalistprocessorcheck#1\endcsname {\noexpand\ifx\nexttoken]% \noexpand\expandafter\noexpand\gobblethreearguments \noexpand\else \noexpand\expandafter\csname\??commalistprocessorwrap#1\endcsname \noexpand\fi \relax}% this one preserved the next {} - \unexpanded\expandafter\edef\csname\??commalistprocessorwrap#1\endcsname##1]% + \protected\expandafter\edef\csname\??commalistprocessorwrap#1\endcsname##1]% {\csname\??commalistprocessorfirst#1\endcsname##1,]\relax}% - \unexpanded\expandafter\edef\csname\??commalistprocessorfirst#1\endcsname##1% picks up \relax + \protected\expandafter\edef\csname\??commalistprocessorfirst#1\endcsname##1% picks up \relax {\csname\??commalistprocessornext#1\endcsname}% - \unexpanded\expandafter\edef\csname\??commalistprocessornext#1\endcsname + \protected\expandafter\edef\csname\??commalistprocessornext#1\endcsname {\noexpand\ifx\nexttoken\noexpand\blankspace \noexpand\expandafter\csname\??commalistprocessorspace#1\endcsname \noexpand\else \noexpand\expandafter\csname\??commalistprocessorfinish#1\endcsname \noexpand\fi}% - \unexpanded\expandafter\edef\csname\??commalistprocessorfinish#1\endcsname + \protected\expandafter\edef\csname\??commalistprocessorfinish#1\endcsname {\noexpand\ifx\nexttoken]% \noexpand\expandafter\noexpand\gobbleoneargument \noexpand\else \noexpand\expandafter\csname\??commalistprocessoraction#1\endcsname \noexpand\fi}% - \unexpanded\expandafter\edef\csname\??commalistprocessoraction#1\endcsname##1,% + \protected\expandafter\edef\csname\??commalistprocessoraction#1\endcsname##1,% {\noexpand#2{##1}% \futurelet\nexttoken\csname\??commalistprocessornext#1\endcsname}% \let\next\:% - \unexpanded\edef \:{\csname\??commalistprocessorspace#1\endcsname}% - \unexpanded\expandafter\edef\: {\futurelet\nexttoken\csname\??commalistprocessornext#1\endcsname}% + \protected\edef \:{\csname\??commalistprocessorspace#1\endcsname}% + \protected\expandafter\edef\: {\futurelet\nexttoken\csname\??commalistprocessornext#1\endcsname}% \let\:\next} -\unexpanded\def\installcommalistprocessorcommand#1#2% \processor \action +\protected\def\installcommalistprocessorcommand#1#2% \processor \action {\edef\p_name{\csstring#2}% \installcommalistprocessor\p_name{#2}% \expandafter\let\expandafter#1\csname\??commalistprocessor\p_name\endcsname} -\unexpanded\def\commalistprocessor#1{\csname\??commalistprocessor#1\endcsname} +\protected\def\commalistprocessor#1{\csname\??commalistprocessor#1\endcsname} \protect \endinput diff --git a/tex/context/base/mkiv/mult-aux.mkxl b/tex/context/base/mkiv/mult-aux.mkxl index 74e717128..df460ee17 100644 --- a/tex/context/base/mkiv/mult-aux.mkxl +++ b/tex/context/base/mkiv/mult-aux.mkxl @@ -258,28 +258,28 @@ %D and that only the high level setup commands are used with language specific %D interfaces. -% \unexpanded\def\mult_interfaces_let #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -% \unexpanded\def\mult_interfaces_lete#1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty} -% \unexpanded\def\mult_interfaces_def #1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -% \unexpanded\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -% \unexpanded\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -% \unexpanded\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_let #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_lete#1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty} +% \protected\def\mult_interfaces_def #1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +% \protected\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} % \startinterface english - \unexpanded\def\mult_interfaces_let #1#2{\expandafter \let\csname#1#2\endcsname} - \unexpanded\def\mult_interfaces_lete#1#2{\expandafter \let\csname#1#2\endcsname\empty} - \unexpanded\def\mult_interfaces_def #1#2{\expandafter \def\csname#1#2\endcsname} - \unexpanded\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1#2\endcsname} - \unexpanded\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1#2\endcsname} - \unexpanded\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1#2\endcsname} + \protected\def\mult_interfaces_let #1#2{\expandafter \let\csname#1#2\endcsname} + \protected\def\mult_interfaces_lete#1#2{\expandafter \let\csname#1#2\endcsname\empty} + \protected\def\mult_interfaces_def #1#2{\expandafter \def\csname#1#2\endcsname} + \protected\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1#2\endcsname} + \protected\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1#2\endcsname} + \protected\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1#2\endcsname} % \stopinterface %D Do, we only interface the assignment definition: -\unexpanded\def\mult_interfaces_adef#1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +\protected\def\mult_interfaces_adef#1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} \startinterface english - \unexpanded\def\mult_interfaces_adef#1#2{\expandafter \def\csname#1#2\endcsname} + \protected\def\mult_interfaces_adef#1#2{\expandafter \def\csname#1#2\endcsname} \stopinterface % the commented detokenized variant that backtracks ... needs testing usage first @@ -298,7 +298,7 @@ \def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter} -\unexpanded\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only) +\protected\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only) {\ifx#2\relax\let#2\empty\fi % it is hardly faster but produces less expansion tracing \def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}% \def#4##1##2{\ifcsname##1:##2\endcsname##1:##2\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}% @@ -311,7 +311,7 @@ \def#8##1{\begincsname#1#2:##1\endcsname} \def#9##1##2{\expandafter\let\expandafter##1\csname\ifcsname#1#2:##2\endcsname#1#2:##2\else\expandafter#5\csname#1#2:\s!parent\endcsname{##2}\fi\endcsname}} -\unexpanded\def\installparameterhandler#1#2% +\protected\def\installparameterhandler#1#2% {\normalexpanded {\mult_interfaces_install_parameter_handler {\noexpand#1}% \??aa @@ -324,18 +324,18 @@ \expandafter\noexpand\csname direct#2parameter\endcsname \expandafter\noexpand\csname letfrom#2parameter\endcsname}} % strict#2parameter is gone -\unexpanded\def\mult_interfaces_install_root_parameter_handler#1#2#3% +\protected\def\mult_interfaces_install_root_parameter_handler#1#2#3% {\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}% always root \def#3##1{\begincsname#1:##1\endcsname}} -\unexpanded\def\installrootparameterhandler#1#2% +\protected\def\installrootparameterhandler#1#2% {\normalexpanded {\mult_interfaces_install_root_parameter_handler {\noexpand#1}% \??aa \expandafter\noexpand\csname detokenizedroot#2parameter\endcsname \expandafter\noexpand\csname root#2parameter\endcsname}} -\unexpanded\def\mult_interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9% +\protected\def\mult_interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9% {\ifx#2\relax\let#2\empty\fi \def#3##1{#1#4{#1#2}{##1}:}% leading #1 was missing .. is this one used? \def#4##1##2{\ifcsname##1:##2\endcsname##1\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}% @@ -345,9 +345,9 @@ \def#7##1{#1##1:}% %\def#8{\ifx#2\empty\orelse\ifcsname#1#2:\s!parent\endcsname\else\expandafter\let\csname#1#2:\s!parent\endcsname#1\fi}% \def#8{\ifempty#2\orelse\ifcsname#1#2:\s!parent\endcsname\else\expandafter\let\csname#1#2:\s!parent\endcsname#1\fi}% - \unexpanded\def#9##1{\expandafter\edef\csname#1##1:\s!parent\endcsname{#1#2}}} + \protected\def#9##1{\expandafter\edef\csname#1##1:\s!parent\endcsname{#1#2}}} -\unexpanded\def\installparameterhashhandler#1#2% +\protected\def\installparameterhashhandler#1#2% {\expandafter\let\csname#2namespace\endcsname#1% \normalexpanded {\mult_interfaces_install_parameter_hash_handler @@ -365,23 +365,23 @@ % todo: inline the def/let -% \unexpanded\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% +% \protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% % {\ifx#2\relax\let#2\empty\fi -% \unexpanded\def#3{\mult_interfaces_def {#1#2:}}% ##1 {##2} (braces are mandate) -% \unexpanded\def#4{\mult_interfaces_edef{#1#2:}}% ##1 {##2} (braces are mandate) -% \unexpanded\def#5{\mult_interfaces_let {#1#2:}}% ##1 ##2 -% \unexpanded\def#6{\mult_interfaces_lete{#1#2:}}}% ##1 +% \protected\def#3{\mult_interfaces_def {#1#2:}}% ##1 {##2} (braces are mandate) +% \protected\def#4{\mult_interfaces_edef{#1#2:}}% ##1 {##2} (braces are mandate) +% \protected\def#5{\mult_interfaces_let {#1#2:}}% ##1 ##2 +% \protected\def#6{\mult_interfaces_lete{#1#2:}}}% ##1 % % \startinterface english - \unexpanded\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% + \protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6% {\ifx#2\relax\let#2\empty\fi - \unexpanded\def#3##1{\expandafter \def\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) - \unexpanded\def#4##1{\expandafter\edef\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) - \unexpanded\def#5##1{\expandafter \let\csname#1#2:##1\endcsname}% ##1 ##2 - \unexpanded\def#6##1{\expandafter \let\csname#1#2:##1\endcsname\empty}}% ##1 + \protected\def#3##1{\expandafter \def\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) + \protected\def#4##1{\expandafter\edef\csname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate) + \protected\def#5##1{\expandafter \let\csname#1#2:##1\endcsname}% ##1 ##2 + \protected\def#6##1{\expandafter \let\csname#1#2:##1\endcsname\empty}}% ##1 % \stopinterface -\unexpanded\def\installparametersethandler#1#2% +\protected\def\installparametersethandler#1#2% {\normalexpanded {\mult_interfaces_install_parameter_set_handler {\noexpand#1}% \??aa @@ -397,24 +397,24 @@ \let\currentstyleparameter\empty \let\currentcolorparameter\empty -\unexpanded\def\mult_interfaces_install_style_and_color_handler#1#2#3#4% - {\unexpanded\def#2##1##2% style color +\protected\def\mult_interfaces_install_style_and_color_handler#1#2#3#4% + {\protected\def#2##1##2% style color {\edef\currentstyleparameter{#1{##1}}% this name is public (can also set color e.g. in underline) %\ifx\currentstyleparameter\empty\else\dousecurrentstyleparameter\fi \ifempty\currentstyleparameter\else\dousecurrentstyleparameter\fi \edef\currentcolorparameter{#1{##2}}% this name is public (so we do this after the style switch) %\ifx\currentcolorparameter\empty\else\dousecurrentcolorparameter\fi}% \ifempty\currentcolorparameter\else\dousecurrentcolorparameter\fi}% - \unexpanded\def#3##1% style + \protected\def#3##1% style {\edef\currentstyleparameter{#1{##1}}% this name is public %\ifx\currentstyleparameter\empty\else\dousecurrentstyleparameter\fi}% \ifempty\currentstyleparameter\else\dousecurrentstyleparameter\fi}% - \unexpanded\def#4##1% color + \protected\def#4##1% color {\edef\currentcolorparameter{#1{##1}}% this name is public %\ifx\currentcolorparameter\empty\else\dousecurrentcolorparameter\fi}} \ifempty\currentcolorparameter\else\dousecurrentcolorparameter\fi}} -\unexpanded\def\installstyleandcolorhandler#1#2% +\protected\def\installstyleandcolorhandler#1#2% {\normalexpanded {\mult_interfaces_install_style_and_color_handler \expandafter\noexpand\csname #2parameter\endcsname @@ -444,12 +444,12 @@ \def\getparentchain #1#2{\begincsname#1#2:\s!chain\endcsname} \def\getcurrentparentchain#1#2{\begincsname#1#2:\s!chain\endcsname} -\unexpanded\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones +\protected\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones {\ifx#4\relax\let#4\empty\fi % see \defineregister - \unexpanded\def#2{\dotripleempty#5}% + \protected\def#2{\dotripleempty#5}% \newtoks#6% \newtoks#7% - \unexpanded\def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] + \protected\def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] {\let#9#4% \edef#4{##1}% \ifthirdargument @@ -499,7 +499,7 @@ \the#7% \let#4#9}} -\unexpanded\def\installdefinehandler#1#2#3% +\protected\def\installdefinehandler#1#2#3% {\normalexpanded {\mult_interfaces_install_define_handler {\noexpand#1}% \??aa @@ -512,13 +512,13 @@ \expandafter\noexpand\csname current#2parent\endcsname \expandafter\noexpand\csname saved_defined_#2\endcsname}} -\unexpanded\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8#9% +\protected\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8#9% {\ifx#3\relax\let#3\empty\fi - \unexpanded\def#2{\dodoubleempty#4}% - \unexpanded\def#6{\mult_interfaces_get_parameters{#1#3:}}% no every ! don't change it + \protected\def#2{\dodoubleempty#4}% + \protected\def#6{\mult_interfaces_get_parameters{#1#3:}}% no every ! don't change it \newtoks#5% \newtoks#8% - \unexpanded\def#4[##1][##2]% maybe helper + \protected\def#4[##1][##2]% maybe helper {\let#7#3% \ifsecondargument \def#9####1% we will have a simple one as well @@ -534,7 +534,7 @@ \let#3#7% \the#8}} -\unexpanded\def\installsetuphandler#1#2% +\protected\def\installsetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_setup_handler {\noexpand#1}% \??aa @@ -552,18 +552,18 @@ \let\doingrootsetnamed \plusthree % \setuplayout[name] \let\doingrootsetroot \plusfour % \setuplayout -\unexpanded\def\mult_interfaces_install_switch_setup_handler_a#1#2#3#4#5% +\protected\def\mult_interfaces_install_switch_setup_handler_a#1#2#3#4#5% {\ifx#3\relax\let#3\empty\fi - \unexpanded\def#2{\dodoubleempty#4}% - \unexpanded\def#5{\mult_interfaces_get_parameters{#1#3:}}} + \protected\def#2{\dodoubleempty#4}% + \protected\def#5{\mult_interfaces_get_parameters{#1#3:}}} -\unexpanded\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% +\protected\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% {\newtoks#5% \newconstant#2% \newtoks#8% \newtoks#9% \ifx#6\relax\let#6\empty\fi - \unexpanded\def#4[##1][##2]% maybe helper + \protected\def#4[##1][##2]% maybe helper {\ifsecondargument % no commalist here % \setuplayout[whatever][key=value] \let#7#3% @@ -631,7 +631,7 @@ #2\zerocount % mode is always zero at the end \the#9}} -\unexpanded\def\installswitchsetuphandler#1#2% +\protected\def\installswitchsetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_switch_setup_handler_a {\noexpand#1}% \??aa @@ -650,10 +650,10 @@ \expandafter\noexpand\csname everyswitch#2\endcsname \expandafter\noexpand\csname everysetup#2root\endcsname}} -\unexpanded\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8#9% +\protected\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8#9% {\ifx#3\relax\let#3\empty\fi - \unexpanded\def#2{\dotripleempty#4}% - \unexpanded\def#6{\mult_interfaces_get_parameters{#1#3:}}% + \protected\def#2{\dotripleempty#4}% + \protected\def#6{\mult_interfaces_get_parameters{#1#3:}}% \newtoks#5% \def#4[##1][##2][##3]% {\let#8#3% @@ -678,7 +678,7 @@ \fi \let#3#8}} -\unexpanded\def\installautosetuphandler#1#2% +\protected\def\installautosetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_auto_setup_handler {\noexpand#1}% \??aa @@ -691,40 +691,40 @@ \expandafter\noexpand\csname saved_setup_current#2\endcsname \expandafter\noexpand\csname nested_setup_current#2\endcsname}} -\unexpanded\def\installbasicparameterhandler#1#2% +\protected\def\installbasicparameterhandler#1#2% {\installparameterhandler {#1}{#2}% \installparameterhashhandler{#1}{#2}% \installparametersethandler {#1}{#2}% \installrootparameterhandler{#1}{#2}} -\unexpanded\def\installbasicautosetuphandler#1#2#3% \??self name \??parent (can be \??self) +\protected\def\installbasicautosetuphandler#1#2#3% \??self name \??parent (can be \??self) {\installbasicparameterhandler{#1}{#2}% \installautosetuphandler {#1}{#2}} -\unexpanded\def\installstylisticautosetuphandler#1#2#3% \??self name \??parent (can be \??self) +\protected\def\installstylisticautosetuphandler#1#2#3% \??self name \??parent (can be \??self) {\installbasicparameterhandler{#1}{#2}% \installautosetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\unexpanded\def\installcommandhandler#1#2#3% \??self name \??parent (can be \??self) +\protected\def\installcommandhandler#1#2#3% \??self name \??parent (can be \??self) {\installbasicparameterhandler{#1}{#2}% \installdefinehandler {#1}{#2}{#3}% \installsetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\unexpanded\def\installswitchcommandhandler#1#2#3% \??self name \??parent (can be \??self) +\protected\def\installswitchcommandhandler#1#2#3% \??self name \??parent (can be \??self) {\installbasicparameterhandler{#1}{#2}% \installdefinehandler {#1}{#2}{#3}% \installswitchsetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\unexpanded\def\installautocommandhandler#1#2#3% automatically defined cloned setups +\protected\def\installautocommandhandler#1#2#3% automatically defined cloned setups {\installbasicparameterhandler{#1}{#2}% \installdefinehandler {#1}{#2}{#3}% \installautosetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\unexpanded\def\installsimplecommandhandler#1#2#3% no define (experiment) - use \check*parent when defining +\protected\def\installsimplecommandhandler#1#2#3% no define (experiment) - use \check*parent when defining {\installbasicparameterhandler{#1}{#2}% \installsetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} @@ -740,14 +740,14 @@ %D We don't need colons for such simple cases. -\unexpanded\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5% +\protected\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5% %%{\def#3##1{\csname\ifcsname#1##1\endcsname#1##1\else\s!empty\fi\endcsname}% {\def#3##1{\begincsname#1##1\endcsname}% \def#4##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}% % \def#4##1{\mult_interfaces_detokenize{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}}% \def#5##1{\begincsname#1##1\endcsname}} -\unexpanded\def\installdirectparameterhandler#1#2% +\protected\def\installdirectparameterhandler#1#2% {\normalexpanded {\mult_interfaces_install_direct_parameter_handler {\noexpand#1}% @@ -756,13 +756,13 @@ \expandafter\noexpand\csname detokenized#2parameter\endcsname \expandafter\noexpand\csname direct#2parameter\endcsname}} -\unexpanded\def\mult_interfaces_install_direct_setup_handler#1#2#3#4#5% - {\unexpanded\def#2{\dosingleempty#3}% +\protected\def\mult_interfaces_install_direct_setup_handler#1#2#3#4#5% + {\protected\def#2{\dosingleempty#3}% \newtoks#5% \def#3[##1]{\mult_interfaces_get_parameters#1[##1]\the#5}% \def#4{\mult_interfaces_get_parameters#1}} -\unexpanded\def\installdirectsetuphandler#1#2% +\protected\def\installdirectsetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_direct_setup_handler {\noexpand#1}% \??aa @@ -771,21 +771,21 @@ \expandafter\noexpand\csname setupcurrent#2\endcsname % no \every (we use 'current' for consistency) \expandafter\noexpand\csname everysetup#2\endcsname}} -% \unexpanded\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% -% {\unexpanded\def#2{\mult_interfaces_def #1}% -% \unexpanded\def#3{\mult_interfaces_edef#1}% -% \unexpanded\def#4{\mult_interfaces_let #1}% -% \unexpanded\def#5{\mult_interfaces_let #1\empty}}% +% \protected\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% +% {\protected\def#2{\mult_interfaces_def #1}% +% \protected\def#3{\mult_interfaces_edef#1}% +% \protected\def#4{\mult_interfaces_let #1}% +% \protected\def#5{\mult_interfaces_let #1\empty}}% % \startinterface english - \unexpanded\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% - {\unexpanded\def#2##1{\expandafter \def\csname#1##1\endcsname}% - \unexpanded\def#3##1{\expandafter\edef\csname#1##1\endcsname}% - \unexpanded\def#4##1{\expandafter \let\csname#1##1\endcsname}% - \unexpanded\def#5##1{\expandafter \let\csname#1##1\endcsname\empty}}% + \protected\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% + {\protected\def#2##1{\expandafter \def\csname#1##1\endcsname}% + \protected\def#3##1{\expandafter\edef\csname#1##1\endcsname}% + \protected\def#4##1{\expandafter \let\csname#1##1\endcsname}% + \protected\def#5##1{\expandafter \let\csname#1##1\endcsname\empty}}% % \stopinterface -\unexpanded\def\installdirectparametersethandler#1#2% +\protected\def\installdirectparametersethandler#1#2% {\normalexpanded {\mult_interfaces_install_direct_parameter_set_handler {\noexpand#1}% \??aa @@ -796,13 +796,13 @@ \let\installdirectstyleandcolorhandler\installstyleandcolorhandler -\unexpanded\def\installdirectcommandhandler#1#2% +\protected\def\installdirectcommandhandler#1#2% {\installdirectparameterhandler {#1}{#2}% \installdirectsetuphandler {#1}{#2}% \installdirectparametersethandler {#1}{#2}% \installdirectstyleandcolorhandler{#1}{#2}} -\unexpanded\def\installsetuponlycommandhandler#1#2% +\protected\def\installsetuponlycommandhandler#1#2% {\installdirectparameterhandler{#1}{#2}% \installdirectsetuphandler {#1}{#2}% }% maybe \installdirectparametersethandler {#1}{#2}% @@ -830,15 +830,15 @@ % yes:\twoparameter{alpha}\par % yes:\twoparameter{beta}\par -\unexpanded\def\relateparameterhandlers#1#2#3#4% {from} {instance} {to} {instance} +\protected\def\relateparameterhandlers#1#2#3#4% {from} {instance} {to} {instance} {\expandafter\edef\csname\csname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}} -\unexpanded\def\relateparameterhandlersbyns#1#2#3#4% {from} {instance} {to} {instance} +\protected\def\relateparameterhandlersbyns#1#2#3#4% {from} {instance} {to} {instance} {\expandafter\edef\csname#1#2:\s!parent\endcsname{#3#4}} %D Here is another experiment: -\unexpanded\def\installactionhandler#1% +\protected\def\installactionhandler#1% {\normalexpanded {\mult_interfaces_install_action_handler {#1}% @@ -846,9 +846,9 @@ \expandafter\noexpand\csname setupcurrent#1\endcsname \expandafter\noexpand\csname #1_action\endcsname}} -% \unexpanded\def\mult_interfaces_install_action_handler#1#2#3#4% -% {\unexpanded\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% -% \unexpanded\def#4[##1][##2]% +% \protected\def\mult_interfaces_install_action_handler#1#2#3#4% +% {\protected\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% +% \protected\def#4[##1][##2]% % {\begingroup % \ifsecondargument % \edef#2{##1}% @@ -864,9 +864,9 @@ % \directsetup{handler:action:#1}% % \endgroup}} -\unexpanded\def\mult_interfaces_install_action_handler#1#2#3#4% - {\unexpanded\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% - \unexpanded\def#4[##1][##2]% +\protected\def\mult_interfaces_install_action_handler#1#2#3#4% + {\protected\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% + \protected\def#4[##1][##2]% {\begingroup \ifsecondargument \edef#2{##1}% @@ -894,7 +894,7 @@ % First we had, in tune with the regular system variables: % % \starttyping -% \unexpanded\def\installnamespace#1{\setvalue{????#1}{@@@@#1}} +% \protected\def\installnamespace#1{\setvalue{????#1}{@@@@#1}} % \stoptyping % % The following variant is nicer and in principle faster but that gets unnoticed @@ -928,7 +928,7 @@ \def\v_interfaces_prefix_template {\number\c_mult_interfaces_n_of_namespaces>} -\unexpanded\def\installnamespace#1% for modules and users +\protected\def\installnamespace#1% for modules and users {\ifcsname ????#1\endcsname \writestatus\m!system{duplicate user namespace '#1'}\wait \else @@ -936,7 +936,7 @@ \expandafter\edef\csname ????#1\endcsname{\v_interfaces_prefix_template}% \fi} -\unexpanded\def\installcorenamespace#1% +\protected\def\installcorenamespace#1% {\ifcsname ??#1\endcsname \writestatus\m!system{duplicate core namespace '#1'}\wait \else @@ -961,16 +961,16 @@ \letvalue\??dummy\empty - \def\dummyparameter #1{\begincsname\??dummy#1\endcsname} - \def\directdummyparameter #1{\begincsname\??dummy#1\endcsname} -\unexpanded\def\setdummyparameter #1{\expandafter\def\csname\??dummy#1\endcsname} -\unexpanded\def\setexpandeddummyparameter#1{\expandafter\edef\csname\??dummy#1\endcsname} -\unexpanded\def\letdummyparameter #1{\expandafter\let\csname\??dummy#1\endcsname} + \def\dummyparameter #1{\begincsname\??dummy#1\endcsname} + \def\directdummyparameter #1{\begincsname\??dummy#1\endcsname} +\protected\def\setdummyparameter #1{\expandafter\def\csname\??dummy#1\endcsname} +\protected\def\setexpandeddummyparameter#1{\expandafter\edef\csname\??dummy#1\endcsname} +\protected\def\letdummyparameter #1{\expandafter\let\csname\??dummy#1\endcsname} -% \unexpanded\def\getdummyparameters +% \protected\def\getdummyparameters % {\mult_interfaces_get_parameters\??dummy} -\unexpanded\def\getdummyparameters[#1% +\protected\def\getdummyparameters[#1% {\if\noexpand#1]% \expandafter\gobbleoneargument \else @@ -1025,7 +1025,7 @@ % % This is a user (module) command: -\unexpanded\def\definenamespace +\protected\def\definenamespace {\dodoubleargument\mult_interfaces_define_name_space} \def\mult_interfaces_define_name_space[#1][#2]% namespace settings @@ -1040,7 +1040,7 @@ %D \showparentchain{@@am}{left} %D \stoptyping -\unexpanded\def\showparentchain#1#2% +\protected\def\showparentchain#1#2% {\writestatus\m!system{chain: [ \mult_interfaces_show_parent_chain{#1#2}]}} % \def\mult_interfaces_show_parent_chain#1% @@ -1058,7 +1058,7 @@ %D Another helper (needs to be applied): -\unexpanded\def\doifelsecommandhandler#1#2% namespace name +\protected\def\doifelsecommandhandler#1#2% namespace name {\ifcsname#1#2:\s!parent\endcsname \expandafter\firstoftwoarguments \else @@ -1067,14 +1067,14 @@ \let\doifcommandhandlerelse\doifelsecommandhandler -\unexpanded\def\doifcommandhandler#1#2% namespace name +\protected\def\doifcommandhandler#1#2% namespace name {\ifcsname#1#2:\s!parent\endcsname \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotcommandhandler#1#2% namespace name +\protected\def\doifnotcommandhandler#1#2% namespace name {\ifcsname#1#2:\s!parent\endcsname \expandafter\gobbleoneargument \else @@ -1127,30 +1127,30 @@ \let\c_mult_set\relax -\unexpanded\def\mult_interfaces_install_definition_set#1#2#3#4#5#6#7% +\protected\def\mult_interfaces_install_definition_set#1#2#3#4#5#6#7% {\newcount#3% \let#6\empty - \unexpanded\def#2% + \protected\def#2% {\expandafter\let\expandafter\c_mult_set\csname #1_t_#6\endcsname \ifx\c_mult_set\relax \expandafter\newtoks\c_mult_set \expandafter\let\csname #1_t_#6\endcsname\c_mult_set \fi} - \unexpanded\def#4##1% + \protected\def#4##1% {\pushmacro#6% \advance#3\plusone \edef#6{##1}% \unprotect}% - \unexpanded\def#5% + \protected\def#5% {\protect \advance#3\minusone \popmacro#6}% - \unexpanded\def#7##1% + \protected\def#7##1% {\edef#6{##1}% #2% \the\c_mult_set\relax}} -\unexpanded\def\installdefinitionset#1#2% +\protected\def\installdefinitionset#1#2% {\normalexpanded {\mult_interfaces_install_definition_set {\noexpand#1}% \??aa @@ -1161,13 +1161,13 @@ \expandafter\noexpand\csname current#2\endcsname \expandafter\noexpand\csname use#2\endcsname}} -\unexpanded\def\mult_interfaces_install_definition_set_member#1#2#3#4#5#6#7#8#9% no everysetups etc +\protected\def\mult_interfaces_install_definition_set_member#1#2#3#4#5#6#7#8#9% no everysetups etc {\let#5#2% - \unexpanded\def#2% + \protected\def#2% {\ifcase#4\relax\expandafter#5\else\expandafter#6\fi}% - \unexpanded\def#6% + \protected\def#6% {\dodoubleempty#7}% - \unexpanded\def#7[##1][##2]% + \protected\def#7[##1][##2]% {\ifsecondargument %#3\c_mult_set\expandafter{\the\c_mult_set#9[##1][##2]}% #3\toksapp\c_mult_set{#9[##1][##2]}% @@ -1176,7 +1176,7 @@ #3\toksapp\c_mult_set{#8[##1]}% \fi}} -\unexpanded\def\installdefinitionsetmember#1#2#3#4% +\protected\def\installdefinitionsetmember#1#2#3#4% {\normalexpanded {\mult_interfaces_install_definition_set_member {\noexpand#3}% \??aa @@ -1191,14 +1191,14 @@ %D Another experiment: -\unexpanded\def\mult_interfaces_install_parent_injector#1#2#3#4% - {\unexpanded\def#4##1% +\protected\def\mult_interfaces_install_parent_injector#1#2#3#4% + {\protected\def#4##1% %{\ifx#3\empty {\ifempty#3% \expandafter\def\csname#1#2:\s!parent\endcsname{#1##1}% \fi}} -\unexpanded\def\installparentinjector#1#2% +\protected\def\installparentinjector#1#2% {\normalexpanded{\mult_interfaces_install_parent_injector {\noexpand#1}% \expandafter\noexpand\csname current#2\endcsname @@ -1208,7 +1208,7 @@ % Faster but not used that much to make a dent in performance. But, because it's % cleaner anyway and also gives less tracing, we apply it a few times. -% \unexpanded\def\syst_helpers_install_macro_stack#1#2#3% +% \protected\def\syst_helpers_install_macro_stack#1#2#3% % {\xdef\m_syst_helpers_push_macro{\csstring#1}% % \ifcsname#3\m_syst_helpers_push_macro\endcsname\else % \expandafter\newcount\csname#3\m_syst_helpers_push_macro\endcsname @@ -1224,39 +1224,39 @@ % \noexpand\csname\m_syst_helpers_push_macro\noexpand\the\csname#3\m_syst_helpers_push_macro\endcsname\endcsname}% % \fi} % -% \unexpanded\def\installmacrostack #1{\syst_helpers_install_macro_stack#1\let \??localpushedmacro } -% \unexpanded\def\installglobalmacrostack#1{\syst_helpers_install_macro_stack#1\glet\??globalpushedmacro} +% \protected\def\installmacrostack #1{\syst_helpers_install_macro_stack#1\let \??localpushedmacro } +% \protected\def\installglobalmacrostack#1{\syst_helpers_install_macro_stack#1\glet\??globalpushedmacro} % The \LUA\ based variant is twice as fast as the above but as said, we don't use % this one that often. It's more about less tracing than speed here. -\unexpanded\def\installmacrostack#1% +\protected\def\installmacrostack#1% {\ifdefined#1\else\let#1\empty\fi - \unexpanded\expandafter\gdef\csname push_macro_\csstring#1\endcsname{\localpushmacro#1}% - \unexpanded\expandafter\gdef\csname pop_macro_\csstring#1\endcsname{\localpopmacro #1}} + \protected\expandafter\gdef\csname push_macro_\csstring#1\endcsname{\localpushmacro#1}% + \protected\expandafter\gdef\csname pop_macro_\csstring#1\endcsname{\localpopmacro #1}} -\unexpanded\def\installglobalmacrostack#1% +\protected\def\installglobalmacrostack#1% {\ifdefined#1\else\glet#1\empty\fi - \unexpanded\expandafter\gdef\csname push_macro_\csstring#1\endcsname{\globalpushmacro#1}% - \unexpanded\expandafter\gdef\csname pop_macro_\csstring#1\endcsname{\globalpopmacro #1}} + \protected\expandafter\gdef\csname push_macro_\csstring#1\endcsname{\globalpushmacro#1}% + \protected\expandafter\gdef\csname pop_macro_\csstring#1\endcsname{\globalpopmacro #1}} % \showmacrostack can be used to see if there are different entries % \unprotect % % \installcorenamespace {test} \installcommandhandler \??test {test} \??test -% \unexpanded\def\TestMeA[#1]% +% \protected\def\TestMeA[#1]% % {\edef\currenttest{#1} % \edef\p_before{\testparameter\c!before}% % \ifx\p_before\empty \relax \else \relax \fi} -% \unexpanded\def\TestMeB[#1]% +% \protected\def\TestMeB[#1]% % {\edef\currenttest{#1} % \doifelsenothing{\testparameter\c!before}\relax\relax} -% \unexpanded\def\TestMeC[#1]% +% \protected\def\TestMeC[#1]% % {\edef\currenttest{#1} % \expandafter\expandafter\expandafter\ifx\testparameter\c!before\empty \relax \else \relax \fi} -% \unexpanded\def\TestMeD[#1]% +% \protected\def\TestMeD[#1]% % {\edef\currenttest{#1} % \doubleexpandafter\ifx\testparameter\c!before\empty \relax \else \relax \fi} % @@ -1274,7 +1274,7 @@ % only gain a few milliseconds: % % \starttyping -% \unexpanded\def\foo#1{[foo:#1]} +% \protected\def\foo#1{[foo:#1]} % % \installcommalistprocessor {foo} \foo % \installcommalistprocessorcommand \processfoolist \foo @@ -1291,7 +1291,7 @@ % \processfoolist[{x,y,z}]\par % \processcommalist[{x,y,z}]\foo\blank % -% \unexpanded\def\foo#1{} +% \protected\def\foo#1{} % % \testfeatureonce{400000}{\processfoolist [fixed,middle,bar]} \elapsedtime\quad %%\testfeatureonce{400000}{\commalistprocessor{foo}[fixed,middle,bar]} \elapsedtime\quad @@ -1307,30 +1307,30 @@ \installcorenamespace{commalistprocessornext} \installcorenamespace{commalistprocessoraction} -\unexpanded\def\installcommalistprocessor#1#2% 5 macro names overhead - {\unexpanded\expandafter\edef\csname\??commalistprocessor#1\endcsname[% +\protected\def\installcommalistprocessor#1#2% 5 macro names overhead + {\protected\expandafter\edef\csname\??commalistprocessor#1\endcsname[% % {\noexpand\futureexpandis]% % \noexpand\gobbleoneargument % \csname\??commalistprocessorpickup#1\endcsname} - %\unexpanded\expandafter\edef\csname\??commalistprocessorpickup#1\endcsname + %\protected\expandafter\edef\csname\??commalistprocessorpickup#1\endcsname {\csname\??commalistprocessorwrap#1\endcsname\relax}% \relax preserves {} - \unexpanded\expandafter\edef\csname\??commalistprocessorwrap#1\endcsname##1]% + \protected\expandafter\edef\csname\??commalistprocessorwrap#1\endcsname##1]% {\csname\??commalistprocessorfirst#1\endcsname##1,]} - \unexpanded\expandafter\edef\csname\??commalistprocessorfirst#1\endcsname\relax + \protected\expandafter\edef\csname\??commalistprocessorfirst#1\endcsname\relax {\csname\??commalistprocessornext#1\endcsname}% - \unexpanded\expandafter\edef\csname\??commalistprocessornext#1\endcsname + \protected\expandafter\edef\csname\??commalistprocessornext#1\endcsname {\noexpand\futureexpandis]% \noexpand\gobbleoneargument \csname\??commalistprocessoraction#1\endcsname} - \unexpanded\expandafter\edef\csname\??commalistprocessoraction#1\endcsname##1,% + \protected\expandafter\edef\csname\??commalistprocessoraction#1\endcsname##1,% {\noexpand#2{##1}% \csname\??commalistprocessornext#1\endcsname}} -\unexpanded\def\installcommalistprocessorcommand#1#2% \processor \action +\protected\def\installcommalistprocessorcommand#1#2% \processor \action {\edef\p_name{\csstring#2}% \installcommalistprocessor\p_name{#2}% \expandafter\let\expandafter#1\csname\??commalistprocessor\p_name\endcsname} -\unexpanded\def\commalistprocessor#1{\csname\??commalistprocessor#1\endcsname} +\protected\def\commalistprocessor#1{\csname\??commalistprocessor#1\endcsname} \protect \endinput diff --git a/tex/context/base/mkiv/mult-chk.mkiv b/tex/context/base/mkiv/mult-chk.mkiv index 83b82242e..529ab2308 100644 --- a/tex/context/base/mkiv/mult-chk.mkiv +++ b/tex/context/base/mkiv/mult-chk.mkiv @@ -35,8 +35,8 @@ \registerctxluafile{mult-chk}{} -\unexpanded\def\setvalidparameterkeys{\dodoubleargument\mult_checkers_set_valid_parameter_keys} -\unexpanded\def\addvalidparameterkeys{\dodoubleargument\mult_checkers_add_valid_parameter_keys} +\protected\def\setvalidparameterkeys{\dodoubleargument\mult_checkers_set_valid_parameter_keys} +\protected\def\addvalidparameterkeys{\dodoubleargument\mult_checkers_add_valid_parameter_keys} \def\mult_checkers_set_valid_parameter_keys[#1][#2]{\clf_setvalidinterfacekeys{#1}{#2}} \def\mult_checkers_add_valid_parameter_keys[#1][#2]{\clf_addvalidinterfacekeys{#1}{#2}} @@ -64,8 +64,8 @@ {\def\syst_helpers_get_parameters_assign{\syst_helpers_get_parameters_assign_indeed#1}% will change \syst_helpers_process_comma_item#2,],^^^^0004} -\unexpanded\def\disablecheckparameters{\let\getcheckedparameters\mult_checkers_get_checked_parameters_nop} -\unexpanded\def\enablecheckparameters {\let\getcheckedparameters\mult_checkers_get_checked_parameters_yes} +\protected\def\disablecheckparameters{\let\getcheckedparameters\mult_checkers_get_checked_parameters_nop} +\protected\def\enablecheckparameters {\let\getcheckedparameters\mult_checkers_get_checked_parameters_yes} \disablecheckparameters diff --git a/tex/context/base/mkiv/mult-dim.mkvi b/tex/context/base/mkiv/mult-dim.mkvi index 0224e3dbb..952550055 100644 --- a/tex/context/base/mkiv/mult-dim.mkvi +++ b/tex/context/base/mkiv/mult-dim.mkvi @@ -48,10 +48,10 @@ \setvalue{\??dimensionnormal-\v!big }#value#dimension#small#medium#big{#dimension=-#big\relax} \letvalue{\??dimensionnormal\s!unknown}\assign_dimension_direct -% \unexpanded\def\assigndimension#value% +% \protected\def\assigndimension#value% % {\csname\??dimensionnormal\ifcsname\??dimensionnormal#value\endcsname#value\else\s!unknown\fi\endcsname{#value}} -\unexpanded\def\assigndimension#value% +\protected\def\assigndimension#value% {\ifcsname\??dimensionnormal#value\endcsname \expandafter\lastnamedcs \else @@ -81,10 +81,10 @@ \setvalue{\??dimensionalfa\v!big }#value#macro#small#medium#big{\edef#macro{#big}} \letvalue{\??dimensionalfa\s!unknown}\assign_alpha_dimension_direct -% \unexpanded\def\assignalfadimension#value% +% \protected\def\assignalfadimension#value% % {\csname\??dimensionalfa\ifcsname\??dimensionalfa#value\endcsname#value\else\s!unknown\fi\endcsname{#value}} -\unexpanded\def\assignalfadimension#value% +\protected\def\assignalfadimension#value% {\ifcsname\??dimensionalfa#value\endcsname \expandafter\lastnamedcs \else @@ -115,10 +115,10 @@ \setvalue{\??dimensionvalue\v!big }#value#macro#small#medium#big{\edef#macro{#big}} \letvalue{\??dimensionvalue\s!unknown}\assign_value_direct -% \unexpanded\def\assignvalue#value% +% \protected\def\assignvalue#value% % {\csname\??dimensionvalue\ifcsname\??dimensionvalue#value\endcsname#value\else\s!unknown\fi\endcsname{#value}} -\unexpanded\def\assignvalue#value% +\protected\def\assignvalue#value% {\ifcsname\??dimensionvalue#value\endcsname \expandafter\lastnamedcs \else @@ -157,10 +157,10 @@ \setbox\b_assign_width\emptybox} \letvalue{\??dimensionwidth\s!unknown}\assign_width_direct -% \unexpanded\def\assignwidth#value% +% \protected\def\assignwidth#value% % {\csname\??dimensionwidth\ifcsname\??dimensionwidth#value\endcsname#value\else\s!unknown\fi\endcsname{#value}} -\unexpanded\def\assignwidth#value% +\protected\def\assignwidth#value% {\ifcsname\??dimensionwidth#value\endcsname \expandafter\lastnamedcs \else diff --git a/tex/context/base/mkiv/mult-ini.mkiv b/tex/context/base/mkiv/mult-ini.mkiv index 66b4673b0..5b22428ff 100644 --- a/tex/context/base/mkiv/mult-ini.mkiv +++ b/tex/context/base/mkiv/mult-ini.mkiv @@ -170,9 +170,9 @@ %D \def\e!name{meaning} %D \stoptyping -\unexpanded\def\defineinterfaceconstant #1#2{\expandafter\def\csname\c!prefix!#1\endcsname{#2}} -\unexpanded\def\defineinterfacevariable #1#2{\expandafter\def\csname\v!prefix!#1\endcsname{#2}} -\unexpanded\def\defineinterfaceelement #1#2{\expandafter\def\csname\e!prefix!#1\endcsname{#2}} +\protected\def\defineinterfaceconstant #1#2{\expandafter\def\csname\c!prefix!#1\endcsname{#2}} +\protected\def\defineinterfacevariable #1#2{\expandafter\def\csname\v!prefix!#1\endcsname{#2}} +\protected\def\defineinterfaceelement #1#2{\expandafter\def\csname\e!prefix!#1\endcsname{#2}} %D Next come some interface independant constants: %D @@ -180,7 +180,7 @@ %D \definefileconstant {name} {meaning} %D \stoptyping -\unexpanded\def\definefileconstant #1#2{\expandafter\def\csname\f!prefix!#1\endcsname{#2}} +\protected\def\definefileconstant #1#2{\expandafter\def\csname\f!prefix!#1\endcsname{#2}} %D And finaly we have the one argument, space saving constants %D @@ -189,8 +189,8 @@ %D \definemessageconstant {name} %D \stoptyping -\unexpanded\def\definesystemconstant #1{\expandafter\def\csname\s!prefix!#1\endcsname{#1}} -\unexpanded\def\definemessageconstant #1{\expandafter\def\csname\m!prefix!#1\endcsname{#1}} +\protected\def\definesystemconstant #1{\expandafter\def\csname\s!prefix!#1\endcsname{#1}} +\protected\def\definemessageconstant #1{\expandafter\def\csname\m!prefix!#1\endcsname{#1}} %D In a parameter driven system, some parameters are shared by more system %D components. In \CONTEXT\ we can distinguish parameters by a unique prefix. Such a @@ -200,7 +200,7 @@ %D \definesystemvariable {name} %D \stoptyping -\unexpanded\def\definesystemvariable#1{\expandafter\edef\csname\??prefix#1\endcsname{\@@prefix#1}} +\protected\def\definesystemvariable#1{\expandafter\edef\csname\??prefix#1\endcsname{\@@prefix#1}} \definesystemvariable{ms} @@ -265,7 +265,7 @@ %D \stopinterface %D \stoptyping -\unexpanded\def\startinterface #1 +\protected\def\startinterface #1 {\doifnot{#1}{all}{\doifnotinset\currentinterface{#1}{\gobbleuntil\stopinterface}}} \let\stopinterface\relax @@ -349,7 +349,7 @@ %D %D These will become obsolete: -\unexpanded\def\startmessages #1 library: #2 % +\protected\def\startmessages #1 library: #2 % {\begingroup \ifcsname\m!prefix!#2\endcsname\else\setgvalue{\m!prefix!#2}{#2}\fi \catcode\endoflineasciicode\othercatcode @@ -364,21 +364,21 @@ \let\stopmessages\relax -\unexpanded\def\setinterfacemessage#1#2#3% +\protected\def\setinterfacemessage#1#2#3% {\ifcsname\m!prefix!#1\endcsname\else\setgvalue{\m!prefix!#1}{#1}\fi \clf_setinterfacemessage{#1}{#2}{#3}} -\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} +\protected\def\setmessagetext #1#2{\relax\edef\currentmessagetext{\clf_getmessage{#1}{#2}}} +\protected\def\getmessage #1#2{\relax\clf_getmessage{#1}{#2}} +\protected\def\doifelsemessage #1#2{\relax\clf_doifelsemessage{#1}{#2}} +\protected\def\showmessage #1#2#3{\relax\clf_showmessage{#1}{#2}{#3}} +\protected\def\writestatus #1#2{\relax\clf_writestatus{#1}{#2}} +\protected\def\message {\relax\clf_message} \let\doifmessageelse\doifelsemessage -\unexpanded\def\inlinemessage #1{\dontleavehmode{\tttf#1}} -\unexpanded\def\displaymessage#1{\blank\inlinemessage{#1}\blank} +\protected\def\inlinemessage #1{\dontleavehmode{\tttf#1}} +\protected\def\displaymessage#1{\blank\inlinemessage{#1}\blank} \let\getsetupstring\clf_getsetupstring \let\rawsetupstring\clf_rawsetupstring @@ -397,15 +397,15 @@ %D backmapping (\type{\c!k...}) and make \type {\c!c...} similar to \type {\v!...}. %D In that case we can simply the following setters. -\unexpanded\def\doletvalue #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -\unexpanded\def\dosetvalue #1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -\unexpanded\def\dosetevalue #1#2{\expandafter\edef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -\unexpanded\def\dosetgvalue #1#2{\expandafter\gdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -\unexpanded\def\dosetxvalue #1#2{\expandafter\xdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} -\unexpanded\def\doresetvalue #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty} -\unexpanded\def\doignorevalue#1#2#3{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty} +\protected\def\doletvalue #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +\protected\def\dosetvalue #1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +\protected\def\dosetevalue #1#2{\expandafter\edef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +\protected\def\dosetgvalue #1#2{\expandafter\gdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +\protected\def\dosetxvalue #1#2{\expandafter\xdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname} +\protected\def\doresetvalue #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty} +\protected\def\doignorevalue#1#2#3{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty} -\unexpanded\def\docopyvalue#1#2#3% +\protected\def\docopyvalue#1#2#3% {\ifcsname\k!prefix!#3\endcsname \expandafter\def\csname#1\csname\k!prefix!#3\endcsname\expandafter\endcsname\expandafter {\csname#2\csname\k!prefix!#3\endcsname\endcsname}% @@ -416,15 +416,15 @@ \startinterface english - \unexpanded\def\doletvalue #1#2{\expandafter \let\csname#1#2\endcsname} - \unexpanded\def\dosetvalue #1#2{\expandafter \def\csname#1#2\endcsname} - \unexpanded\def\dosetevalue #1#2{\expandafter\edef\csname#1#2\endcsname} - \unexpanded\def\dosetgvalue #1#2{\expandafter\gdef\csname#1#2\endcsname} - \unexpanded\def\dosetxvalue #1#2{\expandafter\xdef\csname#1#2\endcsname} - \unexpanded\def\doresetvalue #1#2{\expandafter \let\csname#1#2\endcsname\empty} - \unexpanded\def\doignorevalue#1#2#3{\expandafter \let\csname#1#2\endcsname\empty} + \protected\def\doletvalue #1#2{\expandafter \let\csname#1#2\endcsname} + \protected\def\dosetvalue #1#2{\expandafter \def\csname#1#2\endcsname} + \protected\def\dosetevalue #1#2{\expandafter\edef\csname#1#2\endcsname} + \protected\def\dosetgvalue #1#2{\expandafter\gdef\csname#1#2\endcsname} + \protected\def\dosetxvalue #1#2{\expandafter\xdef\csname#1#2\endcsname} + \protected\def\doresetvalue #1#2{\expandafter \let\csname#1#2\endcsname\empty} + \protected\def\doignorevalue#1#2#3{\expandafter \let\csname#1#2\endcsname\empty} - \unexpanded\def\docopyvalue#1#2#3% + \protected\def\docopyvalue#1#2#3% {\expandafter\def\csname#1#3\expandafter\endcsname\expandafter {\csname#2#3\endcsname}} @@ -433,9 +433,9 @@ %D We can now redefine some messages that will be introduced in the multi||lingual %D system module. -\unexpanded\def\showassignerror #1#2{\showmessage\m!check1{#1,#2}} -\unexpanded\def\showargumenterror#1#2{\showmessage\m!check2{#1,#2}} -\unexpanded\def\showdefinederror #1#2{\showmessage\m!check3{#1,#2}} +\protected\def\showassignerror #1#2{\showmessage\m!check1{#1,#2}} +\protected\def\showargumenterror#1#2{\showmessage\m!check2{#1,#2}} +\protected\def\showdefinederror #1#2{\showmessage\m!check3{#1,#2}} %D \CONTEXT\ is a parameter driven package. This means that users instruct the %D system by means of variables, values and keywords. These instructions take the @@ -603,7 +603,7 @@ %D simple setup command: %D %D \starttyping -%D \unexpanded\def\setupbox[#1]% +%D \protected\def\setupbox[#1]% %D {\getparameters[\??bx][#1]} %D \stoptyping %D @@ -672,11 +672,11 @@ % temporary mkiv hack (we can best just store the whole table in memory) -\unexpanded\def\setinterfaceconstant#1#2% +\protected\def\setinterfaceconstant#1#2% {\clf_setinterfaceconstant{#1}{#2}% \expandafter\def\csname\c!prefix!#1\endcsname{#1}} -\unexpanded\def\setinterfacevariable#1#2% +\protected\def\setinterfacevariable#1#2% {\clf_setinterfacevariable{#1}{#2}% \expandafter\def\csname\v!prefix!#1\endcsname{#2}} @@ -687,7 +687,7 @@ %D too. It's a bit redundant, because in these situations we could use the %D c||version, but for documentation purposes the x||alternative comes in handy. -\unexpanded\def\defineinterfaceconstant#1#2% +\protected\def\defineinterfaceconstant#1#2% {\expandafter\def\csname\c!prefix!#1\endcsname{#2}} %D \macros @@ -702,7 +702,7 @@ %D {\stel<iets>in}. Such split elements are no problem, because we just define two %D elements. When no second part is needed, we use a \type {-}: -\unexpanded\def\setinterfaceelement#1#2% +\protected\def\setinterfaceelement#1#2% {\clf_setinterfaceelement{#1}{#2}% \ifcsname\e!prefix!#1\endcsname \doifnotvalue{\e!prefix!#1}{#2}{\setvalue{\e!prefix!#1}{#2}}% @@ -710,16 +710,16 @@ \setvalue{\e!prefix!#1}{#2}% \fi} -\unexpanded\def\setinterfacecommand#1#2% +\protected\def\setinterfacecommand#1#2% {\doifnot{#1}{#2}% todo: let when already defined {\expandafter\def\csname#2\expandafter\endcsname\expandafter{\csname#1\endcsname}}} %D We just ignore these: -\unexpanded\def\startvariables{\gobbleuntil\stopvariables} \let\stopvariables\relax -\unexpanded\def\startconstants{\gobbleuntil\stopconstants} \let\stopconstants\relax -\unexpanded\def\startelements {\gobbleuntil\stopelements } \let\stopelements \relax -\unexpanded\def\startcommands {\gobbleuntil\stopcommands } \let\stopcommands \relax +\protected\def\startvariables{\gobbleuntil\stopvariables} \let\stopvariables\relax +\protected\def\startconstants{\gobbleuntil\stopconstants} \let\stopconstants\relax +\protected\def\startelements {\gobbleuntil\stopelements } \let\stopelements \relax +\protected\def\startcommands {\gobbleuntil\stopcommands } \let\stopcommands \relax %D For at the \LUA\ end (experiment): @@ -769,7 +769,7 @@ fmt: \formatversion \space \space int: \currentinterface/\currentresponses} -\unexpanded\def\showcontextbanner +\protected\def\showcontextbanner {\writestatus\m!system\empty \writestatus\m!system\contextbanner \writestatus\m!system\empty} @@ -786,9 +786,9 @@ % \def\contextversionnumber#1.#2.#3 #4:#5\relax{#1\ifnum#2<10 0\fi\purenumber{#2}\ifnum#3<10 0\fi\purenumber{#3} #4:#5} % \edef\contextversionnumber{\expandafter\contextversionnumber\contextversion\relax\space\contextmark} -\unexpanded\def \contextversionnumber #1.#2.#3 #4:#5\relax{#1#2#3} - \contextversionno \expandafter\contextversionnumber\contextversion\relax - \edef \contextversionnumber {\the\contextversionno\space\contextmark} +\protected\def \contextversionnumber #1.#2.#3 #4:#5\relax{#1#2#3} + \contextversionno \expandafter\contextversionnumber\contextversion\relax + \edef \contextversionnumber {\the\contextversionno\space\contextmark} %D \macros %D {everydump} diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 0a6462c1c..7ec4e6a54 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -336,7 +336,7 @@ return { "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", -- - "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "protect", "unprotect", + "unexpanded", "expanded", "startexpanded", "stopexpanded", "protect", "unprotect", -- "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 9fdf72dde..ddb97aca3 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -402,6 +402,8 @@ return { "shapemode", "supmarkmode", "textdirection", + "thewithoutunit", + "tokenized", "toksapp", "tokspre", "tpack", @@ -807,7 +809,6 @@ return { "textfont", "textstyle", "the", - "thewithoutunit", "thickmuskip", "thinmuskip", "time", diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv index d115b588d..53e95460a 100644 --- a/tex/context/base/mkiv/page-lay.mkiv +++ b/tex/context/base/mkiv/page-lay.mkiv @@ -521,6 +521,8 @@ \edef\currentlayouttarget{#1}% \fi} +\newdimen\d_page_minimum_paper_size \d_page_minimum_paper_size\luaexpr{math.pi}\onebasepoint + \unexpanded\def\page_paper_set_current_indeed[#1][#2]% {\edef\m_page_asked_paper{#1}% can be the restores \edef\m_page_asked_print{#2}% @@ -539,11 +541,11 @@ \processcommacommand[\m_page_asked_paper]\page_paper_handle_page_option \global\paperwidth \layouttargetparameter\c!width \relax \global\paperheight\layouttargetparameter\c!height\relax - \ifdim\paperwidth<\onepoint - \global\paperwidth\onepoint + \ifdim\paperwidth<\d_page_minimum_paper_size + \global\paperwidth\d_page_minimum_paper_size \fi - \ifdim\paperheight<\onepoint - \global\paperheight\onepoint + \ifdim\paperheight<\d_page_minimum_paper_size + \global\paperheight\d_page_minimum_paper_size \fi \ifconditional\c_page_target_paper_landscape \doglobal\swapdimens\paperwidth\paperheight diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 8fb1837aa..d2faf2ac3 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 d6d1e520b..81adece53 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv index f5e8af4cc..c48315622 100644 --- a/tex/context/base/mkiv/supp-box.mkiv +++ b/tex/context/base/mkiv/supp-box.mkiv @@ -66,7 +66,7 @@ %D The next macro suppresses over- and underfull messages which often makes sense %D when we deal with boxes. -\unexpanded\def\dontcomplain +\protected\def\dontcomplain {\hbadness\plustenthousand \vbadness\plustenthousand \hfuzz \maxdimen @@ -112,12 +112,12 @@ %D Smashing is introduced in \PLAIN\ \TEX, and stands for reducing the dimensions of %D a box to zero. The most resolute one is presented first. -\unexpanded\def\smashbox#1% +\protected\def\smashbox#1% {\wd#1\zeropoint \ht#1\zeropoint \dp#1\zeropoint} -\unexpanded\def\smashboxed#1% +\protected\def\smashboxed#1% {\wd#1\zeropoint \ht#1\zeropoint \dp#1\zeropoint @@ -129,10 +129,10 @@ %D Smashing can be used for overlaying boxes. Depending on the mode, horizontal or %D vertical, one can use: -\unexpanded\def\hsmashbox#1% +\protected\def\hsmashbox#1% {\wd#1\zeropoint} -\unexpanded\def\vsmashbox#1% +\protected\def\vsmashbox#1% {\ht#1\zeropoint \dp#1\zeropoint} @@ -140,7 +140,7 @@ \newcount\c_boxes_register -\unexpanded\def\smashbox +\protected\def\smashbox {\afterassignment\syst_boxes_smash_boxes_register\c_boxes_register} \def\syst_boxes_smash_boxes_register @@ -148,23 +148,23 @@ \ht\c_boxes_register\zeropoint \dp\c_boxes_register\zeropoint} -\unexpanded\def\hsmashbox +\protected\def\hsmashbox {\afterassignment\syst_boxes_hsmashed_boxes_register\c_boxes_register} \def\syst_boxes_hsmashed_boxes_register {\wd\c_boxes_register\zeropoint} -\unexpanded\def\vsmashbox +\protected\def\vsmashbox {\afterassignment\syst_boxes_vsmashed_boxes_register\c_boxes_register} \def\syst_boxes_vsmashed_boxes_register {\ht\c_boxes_register\zeropoint \dp\c_boxes_register\zeropoint} -\unexpanded\def\smashedbox +\protected\def\smashedbox {\afterassignment\syst_boxes_smashed_boxes_register\c_boxes_register} -\unexpanded\def\syst_boxes_smashed_boxes_register +\protected\def\syst_boxes_smashed_boxes_register {\wd\c_boxes_register\zeropoint \ht\c_boxes_register\zeropoint \dp\c_boxes_register\zeropoint @@ -178,23 +178,23 @@ %D some subtle differences betreen the smash and smashed alternatives. The later %D ones reduce all dimensions to zero. -\unexpanded\def\hsmash {\bgroup\dowithnextboxcs\syst_boxes_hsmashed_nextbox\hbox} -\unexpanded\def\vsmash {\bgroup\dowithnextboxcs\syst_boxes_vsmashed_nextbox\vbox} -\unexpanded\def\hsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \hbox} -\unexpanded\def\vsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \vbox} +\protected\def\hsmash {\bgroup\dowithnextboxcs\syst_boxes_hsmashed_nextbox\hbox} +\protected\def\vsmash {\bgroup\dowithnextboxcs\syst_boxes_vsmashed_nextbox\vbox} +\protected\def\hsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \hbox} +\protected\def\vsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \vbox} -\unexpanded\def\syst_boxes_hsmashed_nextbox +\protected\def\syst_boxes_hsmashed_nextbox {\wd\nextbox\zeropoint \box\nextbox \egroup} -\unexpanded\def\syst_boxes_vsmashed_nextbox +\protected\def\syst_boxes_vsmashed_nextbox {\ht\nextbox\zeropoint \dp\nextbox\zeropoint \box\nextbox \egroup} -\unexpanded\def\syst_boxes_smashed_nextbox +\protected\def\syst_boxes_smashed_nextbox {\ht\nextbox\zeropoint \dp\nextbox\zeropoint \wd\nextbox\zeropoint @@ -211,15 +211,15 @@ %D \smashedvbox to ... {...} %D \stoptyping -\unexpanded\def\smashedhbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\hbox} -\unexpanded\def\smashedvbox{\vpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\vbox} +\protected\def\smashedhbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\hbox} +\protected\def\smashedvbox{\vpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\vbox} %D First we define a helper. We use a \LUATEX\ feature in order to avoid %D mathpalettes. \newcount\c_boxes_math_style -\unexpanded\def\syst_boxes_math_set_nextbox#1% +\protected\def\syst_boxes_math_set_nextbox#1% {\c_boxes_math_style\normalmathstyle \setbox\nextbox\hbox{\normalstartimath\mathsurround\zeropoint\triggermathstyle\c_boxes_math_style{#1}\normalstopimath}} @@ -230,7 +230,7 @@ %D catcode safer. It is needed by the math module (although the \type {\leavevmode} %D is not added here). -\unexpanded\def\smash +\protected\def\smash {\begingroup \futurelet\nexttoken\syst_boxes_smash} @@ -309,9 +309,9 @@ %D {\mathchoice}, the next macro looks ugly. We also take care of non||braced %D arguments. -\unexpanded\def\phantom {\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed } -\unexpanded\def\vphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_v} -\unexpanded\def\hphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_h} +\protected\def\phantom {\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed } +\protected\def\vphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_v} +\protected\def\hphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_h} \def\syst_boxes_phantom_math #1{\syst_boxes_math_set_nextbox{#1}\syst_boxes_phantom_make } \def\syst_boxes_phantom_math_v#1{\syst_boxes_math_set_nextbox{#1}\syst_boxes_phantom_make_v} @@ -375,7 +375,7 @@ %D We also define plain's \type {\mathstrut}. -\unexpanded\def\mathstrut{\vphantom(} % can be made faster by inlining +\protected\def\mathstrut{\vphantom(} % can be made faster by inlining %D \macros %D {getboxheight} @@ -409,7 +409,7 @@ %D The next alternative is slightly more clever, since it accepts \type {{12}} as %D well as \type {12} as box number. -\unexpanded\def\getboxheight#1\of#2\box#3% +\protected\def\getboxheight#1\of#2\box#3% {\def\next{#1\dimexpr\ht\c_boxes_register+\dp\c_boxes_register\relax}% \afterassignment\next\c_boxes_register=#3} @@ -458,7 +458,7 @@ \newcount\noflines \newdimen\noflinesheight -\unexpanded\def\getnoflines#1% +\protected\def\getnoflines#1% {\noflinesheight#1\relax \ifzeropt\noflinesheight \noflines\zerocount @@ -474,7 +474,7 @@ \advance\noflines\minusone \fi\fi} -\unexpanded\def\getroundednoflines#1% +\protected\def\getroundednoflines#1% {\noflinesheight#1\relax \ifzeropt\noflinesheight \noflines\zerocount @@ -488,7 +488,7 @@ \noflines\noflinesheight \fi\fi} -\unexpanded\def\getrawnoflines#1% +\protected\def\getrawnoflines#1% {\noflinesheight#1\relax \ifzeropt\noflinesheight \noflines\zerocount @@ -552,7 +552,7 @@ \def\syst_boxes_determine_noflines {\expandafter\egroup\expandafter\noflines\noflinesinbox\nextbox\relax} -\unexpanded\def\determinenoflines +\protected\def\determinenoflines {\bgroup \forgetall \let\crlf\endgraf @@ -570,7 +570,7 @@ %D \doiftext {data} {then branch} %D \stoptyping -\unexpanded\def\doifelsetext#1% +\protected\def\doifelsetext#1% {\begingroup \setbox\scratchbox\hbox % no \hpack because we can have fallbacks {\settrialtypesetting @@ -583,7 +583,7 @@ \let\doiftextelse\doifelsetext -\unexpanded\def\doiftext#1% +\protected\def\doiftext#1% {\begingroup \setbox\scratchbox\hbox % no \hpack because we can have fallbacks {\settrialtypesetting @@ -627,7 +627,7 @@ %D In this implementation the \type {\aftergroup} construction is needed because %D \type {\afterassignment} is executed inside the box. -\unexpanded\def\dowithnextbox#1% +\protected\def\dowithnextbox#1% {\def\syst_boxes_with_next_box{#1}% \afterassignment\syst_boxes_with_next_box_indeed \setbox\nextbox} @@ -635,7 +635,7 @@ \def\syst_boxes_with_next_box_indeed {\aftergroup\syst_boxes_with_next_box} -\unexpanded\def\dowithnextboxcs#1% +\protected\def\dowithnextboxcs#1% {\let\syst_boxes_with_next_box#1% \afterassignment\syst_boxes_with_next_box_indeed \setbox\nextbox} @@ -655,7 +655,7 @@ %D A slower but more versatile implementation is: %D %D \starttyping -%D \unexpanded\def\dowithnextbox#1#2% +%D \protected\def\dowithnextbox#1#2% %D {\def\syst_boxes_with_next_box{#1}% %D \ifx#2\hbox %D \afterassignment\syst_boxes_with_next_box_indeed @@ -685,7 +685,7 @@ \def\nextboxdp {\dp\nextbox} \def\nextboxhtdp{\dimexpr\ht\nextbox+\dp\nextbox\relax} -\unexpanded\def\flushnextbox{\box\nextbox} +\protected\def\flushnextbox{\box\nextbox} %D \macros %D {dowithnextboxcontent} @@ -699,13 +699,13 @@ %D %D {\em todo: Search source for potential usage!} -\unexpanded\def\dowithnextboxcontent#1#2% inside, after +\protected\def\dowithnextboxcontent#1#2% inside, after {\def\syst_boxes_with_next_box_one{#2}% \def\syst_boxes_with_next_box_two{#1}% \afterassignment\syst_boxes_with_next_box_content_indeed \setbox\nextbox} -\unexpanded\def\dowithnextboxcontentcs#1#2% inside, after +\protected\def\dowithnextboxcontentcs#1#2% inside, after {\let\syst_boxes_with_next_box_one#2% \let\syst_boxes_with_next_box_two#1% \afterassignment\syst_boxes_with_next_box_content_indeed @@ -732,15 +732,15 @@ \def\domathllap{\mathpalette\dodomathllap} \def\dodomathllap#1#2{\dollap{\normalstartimath\mathsurround\zeropoint#1#2\normalstopimath}} \def\domathrlap{\mathpalette\dodomathrlap} \def\dodomathrlap#1#2{\dorlap{\normalstartimath\mathsurround\zeropoint#1#2\normalstopimath}} -\unexpanded\def\rlap{\mathortext\domathrlap\dorlap} -\unexpanded\def\llap{\mathortext\domathllap\dollap} -\unexpanded\def\clap{\mathortext\domathclap\doclap} +\protected\def\rlap{\mathortext\domathrlap\dorlap} +\protected\def\llap{\mathortext\domathllap\dollap} +\protected\def\clap{\mathortext\domathclap\doclap} \def\dodotlap{\vpack to \zeropoint{\vss\box\nextbox}\endgroup} \def\dodoblap{\vpack to \zeropoint{\box\nextbox\vss}\endgroup} -\unexpanded\def\tlap{\begingroup\dowithnextboxcs\dodotlap\vbox} -\unexpanded\def\blap{\begingroup\dowithnextboxcs\dodoblap\vbox} +\protected\def\tlap{\begingroup\dowithnextboxcs\dodotlap\vbox} +\protected\def\blap{\begingroup\dowithnextboxcs\dodoblap\vbox} %D \macros %D {beginofshapebox, @@ -874,7 +874,7 @@ \def\shapesignal{.12345678pt} % or 12345sp -\unexpanded\def\reshapebox#1% +\protected\def\reshapebox#1% {\doreshapebox {#1}% {\penalty\shapepenalty}% @@ -898,11 +898,11 @@ % We will turn this into a \MKIV\ variant (we can use \type {\vpack} too). -\unexpanded\def\insertshapesignal +\protected\def\insertshapesignal {\hpack to \shapesignal{\strut\hss}% plus \strut \prevdepth\strutdp} % never \nointerlineskip -\unexpanded\def\restoreshapebox % compensates for the signal +\protected\def\restoreshapebox % compensates for the signal {\global\setbox\tmpshapebox\vbox{\vskip-\lineheight\unvcopy\oldshapebox}} \def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip @@ -939,21 +939,21 @@ \advance\shapecounter \plusone \fi} -\unexpanded\def\beginofshapebox +\protected\def\beginofshapebox {\setbox\oldshapebox\vbox \bgroup \reshapingboxtrue \the\everyshapebox \insertshapesignal} -\unexpanded\def\endofshapebox +\protected\def\endofshapebox {\endgraf \egroup} \let\beginshapebox\beginofshapebox \let\endshapebox \endofshapebox -\unexpanded\def\flushshapebox +\protected\def\flushshapebox {\bgroup \ifzeropt\ht\newshapebox \else @@ -1004,7 +1004,7 @@ % % \omlijnd[offset=0pt,hoogte=8mm,uitlijnen={rechts,laho}]{\bfa test} -\unexpanded\def\innerflushshapebox +\protected\def\innerflushshapebox {\ifzeropt\ht\newshapebox \else \unvcopy\newshapebox\relax % unvcopy ! else spacing problem % \kern-\dp\newshapebox\relax @@ -1027,7 +1027,7 @@ %D use \type {\shapedhbox} instead of \type {\hbox}, since it manages the height and %D depth of the line. -\unexpanded\def\shapedhbox % lines with non strutted dimensions have +\protected\def\shapedhbox % lines with non strutted dimensions have {\expanded{\dowithnextbox % interlineskip so if we want the original {\ht\nextbox\the\ht\shapebox % spacing, we need to preserve the original \dp\nextbox\the\dp\shapebox % height and depth which is definitely @@ -1047,10 +1047,10 @@ %D \showhyphens{dohyphenatedword} %D \stoptyping -\unexpanded\def\doshowhyphenatednextbox +\protected\def\doshowhyphenatednextbox {\clf_showhyphenatedinlist\nextbox} -\unexpanded\def\showhyphens % hpack: so no processing (we hyphenate in lua) +\protected\def\showhyphens % hpack: so no processing (we hyphenate in lua) {\dowithnextboxcs\doshowhyphenatednextbox\hpack} %D The following macros are seldom used but handy for tracing. @@ -1061,19 +1061,19 @@ %D \hyphenatedfile{tufte} %D \stoptyping -\unexpanded\def\dohyphenatednextbox +\protected\def\dohyphenatednextbox {\clf_hyphenatedlist\nextbox false\relax \unhbox\nextbox} -\unexpanded\def\hyphenatedword {\dowithnextboxcs\dohyphenatednextbox\hbox} -\unexpanded\def\hyphenatedpar {\dowithnextboxcs\dohyphenatednextbox\hbox} -\unexpanded\def\hyphenatedfile#1{\dowithnextboxcs\dohyphenatednextbox\hbox{\readfile{#1}\donothing\donothing}} +\protected\def\hyphenatedword {\dowithnextboxcs\dohyphenatednextbox\hbox} +\protected\def\hyphenatedpar {\dowithnextboxcs\dohyphenatednextbox\hbox} +\protected\def\hyphenatedfile#1{\dowithnextboxcs\dohyphenatednextbox\hbox{\readfile{#1}\donothing\donothing}} -\unexpanded\def\dohyphenatednextboxcolor +\protected\def\dohyphenatednextboxcolor {\clf_hyphenatedlist\nextbox true\relax \unhbox\nextbox} -\unexpanded\def\hyphenatedcoloredword{\dowithnextboxcs\dohyphenatednextboxcolor\hbox} +\protected\def\hyphenatedcoloredword{\dowithnextboxcs\dohyphenatednextboxcolor\hbox} %D \macros %D {processtokens} @@ -1102,7 +1102,7 @@ %D The list of tokens may contain spaces, while \type {\\}, \type {{}} and \type {\ %D } are handled as space too. -\unexpanded\def\processtokens#1#2#3#4#5% +\protected\def\processtokens#1#2#3#4#5% {\begingroup \def\lastcharacter{\lastcharacter}% hm, recursive ? \def\space{ }% @@ -1191,7 +1191,7 @@ \ifdefined\fakecompoundhyphen\else \let\fakecompoundhyphen\relax \fi \ifdefined\veryraggedright \else \def\veryraggedright{\raggedright} \fi -\unexpanded\def\limitatetext +\protected\def\limitatetext {\bgroup % evt \setstrut \forgetall % otherwise indentation and so \let\limitatetext\firstofthreearguments @@ -1288,7 +1288,7 @@ \ifdim\wd\scratchboxtwo<\wd\scratchboxone #1\else\unhbox\scratchboxone\fi \egroup} -\unexpanded\def\limitatetext#1#2#3% \expanded added 2003/01/16 +\protected\def\limitatetext#1#2#3% \expanded added 2003/01/16 {\splitatcomma{#2}\leftlimit\rightlimit \ifx\rightlimit\empty \normallimitatetext {#1}\leftlimit {#3}% @@ -1302,7 +1302,7 @@ %D \limitatefirstline{\input tufte\relax}{10cm}{\unknown} %D \stoptyping -\unexpanded\def\limitatefirstline#1#2#3% +\protected\def\limitatefirstline#1#2#3% {\hbox\bgroup\strut % \hpack \setbox\scratchbox\hbox{\begstrut#1\endstrut}% \ifdim\wd\scratchbox>#2\relax @@ -1345,7 +1345,7 @@ % todo: provide variant with #1 picked up as box -\unexpanded\def\processisolatedchars#1#2% +\protected\def\processisolatedchars#1#2% {\dontleavehmode \begingroup \setbox\scratchbox\hbox{\settrialtypesetting#2{\savecurrentattributes{pic}}}% @@ -1358,7 +1358,7 @@ \relax \endgroup} -\unexpanded\def\processisolatedwords#1#2% +\protected\def\processisolatedwords#1#2% {\dontleavehmode \begingroup \setbox\scratchbox\hbox{\settrialtypesetting#2{\savecurrentattributes{pic}}}% @@ -1373,7 +1373,7 @@ %D A variant: -\unexpanded\def\applytocharacters#1% +\protected\def\applytocharacters#1% {\dontleavehmode \dowithnextbox{\clf_applytobox method {char}% @@ -1383,7 +1383,7 @@ \relax}% \hbox} -\unexpanded\def\applytowords#1% +\protected\def\applytowords#1% {\dontleavehmode \dowithnextbox{\clf_applytobox method {word}% @@ -1395,33 +1395,33 @@ %D The old call: -\unexpanded\def\processwords#1% +\protected\def\processwords#1% {\processisolatedwords{#1}\processword} \let\processword\relax -\unexpanded\def\applytosplitstringchar#1#2% +\protected\def\applytosplitstringchar#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% method {char}% \relax} -\unexpanded\def\applytosplitstringword#1#2% +\protected\def\applytosplitstringword#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% method {word}% \relax} -\unexpanded\def\applytosplitstringline#1#2% +\protected\def\applytosplitstringline#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% method {line}% \relax} -\unexpanded\def\applytosplitstringcharspaced#1#2% +\protected\def\applytosplitstringcharspaced#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% @@ -1429,7 +1429,7 @@ spaced true% \relax} -\unexpanded\def\applytosplitstringwordspaced#1#2% +\protected\def\applytosplitstringwordspaced#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% @@ -1437,7 +1437,7 @@ spaced true% \relax} -\unexpanded\def\applytosplitstringlinespaced#1#2% +\protected\def\applytosplitstringlinespaced#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% @@ -1470,11 +1470,11 @@ %D would have ended up in the text. This macro can be useful when building %D complicated menus, headers and footers and|/|or margin material. -\unexpanded\def\sbox +\protected\def\sbox {\vpack\bgroup \dowithnextboxcs\syst_boxes_sbox_finish\vbox} -\unexpanded\def\syst_boxes_sbox_finish +\protected\def\syst_boxes_sbox_finish {\setbox\nextbox\hpack {\strut % not needed \dp\nextbox\zeropoint % not needed @@ -1490,7 +1490,7 @@ %D xx \ruledhbox{\inlinedbox{\tfd test}} xx %D \stoptyping -\unexpanded\def\inlinedbox +\protected\def\inlinedbox {\bgroup \dowithnextbox {\setbox\nextbox\hpack @@ -1508,7 +1508,7 @@ %D %D This boxing macro limits the height and depth to those of a strut. -\unexpanded\def\struttedbox +\protected\def\struttedbox {\hpack\bgroup \dowithnextboxcs\syst_boxes_struttedbox_finish\hbox} @@ -1524,7 +1524,7 @@ %D This macro compensates the difference between the topskip and strutheight. Watch %D how we preserve the depth when it equals strutdepth. -\unexpanded\def\topskippedbox +\protected\def\topskippedbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_topskippedbox_finish\hbox} \def\syst_boxes_topskippedbox_finish @@ -1576,7 +1576,7 @@ %D The dimensions of the surrounding box are kept intact. This commands handles %D positive and negative dimensions (which is why we need two boxes with rules). -\unexpanded\def\centeredbox#1#% height +/-dimen width +/-dimen +\protected\def\centeredbox#1#% height +/-dimen width +/-dimen {\bgroup \setbox\scratchboxone\vpack to \vsize \bgroup @@ -1616,7 +1616,7 @@ %D %D Do you see what we call this one \type {next}? -\unexpanded\def\centerednextbox#1#% +\protected\def\centerednextbox#1#% {\bgroup \dowithnextbox {\hsize\wd\nextbox @@ -1637,7 +1637,7 @@ %D When omitted, the current \type {\hsize} and \type {\vsize} are used. Local %D dimensions are supported. -\unexpanded\def\centerbox#1#% optional height +/-dimen width +/-dimen +\protected\def\centerbox#1#% optional height +/-dimen width +/-dimen {\bgroup \dowithnextbox {\setlocalhsize @@ -1667,7 +1667,7 @@ \newif\ifstretchrigidcolumns \newif\iftightrigidcolumns % if true: just a vbox, no depth/noflines/gridsnap corrrections -\unexpanded\def\setrigidcolumnhsize#1#2#3% todo: \dimexpr +\protected\def\setrigidcolumnhsize#1#2#3% todo: \dimexpr {\xdef\savedrigidhsize{\the\hsize}% \hsize#1\relax \global\chardef\rigidcolumns#3\relax @@ -1688,7 +1688,7 @@ \let\rigidcolumnlines\!!zerocount -\unexpanded\def\rigidcolumnbalance#1% +\protected\def\rigidcolumnbalance#1% {\ifnum\rigidcolumns=1 % tzt ook h/d correctie \ifinner\ifhmode\box\else\unvbox\fi\else\unvbox\fi#1\relax \else @@ -1779,7 +1779,7 @@ %D Create line and fake height of paragraph by messign with heights: a nice hack by %D DEK himself. -%\unexpanded\def\setvboxtohbox +%\protected\def\setvboxtohbox % {\bgroup % \ifdim\baselineskip<16pt \relax % \scratchdimen\baselineskip @@ -1793,12 +1793,12 @@ % \xdef\vboxtohboxfactor{\withoutpt\the\scratchdimen}% % \egroup} % -% \unexpanded\def\startvboxtohbox +% \protected\def\startvboxtohbox % {\bgroup % \setvboxtohbox % \setbox\scratchbox\hbox\bgroup} % -% \unexpanded\def\stopvboxtohbox +% \protected\def\stopvboxtohbox % {\ifcase\vboxtohboxslack\else\hskip\zeropoint\!!minus\vboxtohboxslack\fi % \egroup % \dp\scratchbox\zeropoint @@ -1813,17 +1813,17 @@ %newbox\d_syst_boxes_vboxtohbox \newbox\d_syst_boxes_separator -\unexpanded\def\startvboxtohboxseparator +\protected\def\startvboxtohboxseparator {\setbox\d_syst_boxes_separator\hbox attr \vboxtohboxseparatorattribute\plusone\bgroup} -\unexpanded\def\stopvboxtohboxseparator +\protected\def\stopvboxtohboxseparator {\egroup} -\unexpanded\def\startvboxtohbox +\protected\def\startvboxtohbox {\begingroup \setbox\scratchbox\hbox\bgroup} -\unexpanded\def\stopvboxtohbox +\protected\def\stopvboxtohbox {\ifvoid\d_syst_boxes_separator \hskip\zeropoint\ifcase\vboxtohboxslack\else\s!minus\vboxtohboxslack\fi % we really need a skip \else @@ -1836,12 +1836,12 @@ % A possible reconstruction: -\unexpanded\def\convertvboxtohbox +\protected\def\convertvboxtohbox {\makehboxofhboxes \setbox\scratchboxone\hpack{\unhbox\scratchboxone\removehboxes}% \hpack \noindent\unhbox\scratchboxone\par} -\unexpanded\def\makehboxofhboxes +\protected\def\makehboxofhboxes {\setbox\scratchboxone\emptyhbox \loop % \doloop { .. \exitloop .. } \setbox\scratchboxtwo\lastbox @@ -1849,7 +1849,7 @@ \setbox\scratchboxone\hpack{\box\scratchboxtwo\unhbox\scratchboxone}% \repeat} -\unexpanded\def\removehboxes +\protected\def\removehboxes {\setbox\scratchboxone\lastbox \ifhbox\scratchboxone {\removehboxes}\unhbox\scratchboxone @@ -1857,11 +1857,11 @@ % And one special for notes: -% \unexpanded\def\starthboxestohbox +% \protected\def\starthboxestohbox % {\bgroup % \beginofshapebox} % -% \unexpanded\def\stophboxestohbox +% \protected\def\stophboxestohbox % {\endofshapebox % \doreshapebox % {\hbox\bgroup @@ -1878,11 +1878,11 @@ % More modern: -\unexpanded\def\starthboxestohbox +\protected\def\starthboxestohbox {\bgroup \setbox\scratchbox\vbox\bgroup} -\unexpanded\def\stophboxestohbox +\protected\def\stophboxestohbox {\egroup \clf_vboxlisttohbox\scratchbox\nextbox\dimexpr\hboxestohboxslack\relax \dontleavehmode @@ -1902,7 +1902,7 @@ \newdimen \lasthhboxwidth \newskip \hhboxindent -\unexpanded\def\unhhbox#1\with#2% +\protected\def\unhhbox#1\with#2% {\bgroup \nopenalties \dontcomplain @@ -1933,7 +1933,7 @@ \unhbox1 \egroup} -\unexpanded\def\hboxofvbox +\protected\def\hboxofvbox {\bgroup \afterassignment\dohboxofvbox \scratchcounter=} @@ -1976,7 +1976,7 @@ %D dimension of this box suggest some content, the resulting box is unboxed and %D surrounded by the first two arguments, else the third arguments is executed. -\unexpanded\def\doifcontent#1#2#3% +\protected\def\doifcontent#1#2#3% {\dowithnextbox {\ifhbox\nextbox \ifdim\wd\nextbox>\zeropoint @@ -2022,7 +2022,7 @@ % \newbox\processbox % public : this is the one where \nextbox's end up in % -% \unexpanded\def\processboxes#1% +% \protected\def\processboxes#1% % {\bgroup % \def\syst_boxes_process_indeed{#1}% #1 can be redefined halfway % \setbox\processbox\emptybox @@ -2045,7 +2045,7 @@ % \afterassignment\syst_boxes_process % \let\nexttoken} % -% \unexpanded\def\syst_boxes_process_nop +% \protected\def\syst_boxes_process_nop % {\removeunwantedspaces % \box\processbox % \nexttoken % messy as we are still in the group @@ -2053,7 +2053,7 @@ \newbox\processbox % public : this is the one where \nextbox's end up in -\unexpanded\def\processboxes#1% +\protected\def\processboxes#1% {\bgroup \def\syst_boxes_process_indeed{#1}% #1 can be redefined halfway \setbox\processbox\emptybox @@ -2067,7 +2067,7 @@ \syst_boxes_process_indeed % takes \nextbox makes \processbox \doifelsenextbgroup\syst_boxes_process_yes\syst_boxes_process_nop} -\unexpanded\def\syst_boxes_process_nop +\protected\def\syst_boxes_process_nop {\removeunwantedspaces \box\processbox \egroup} @@ -2127,7 +2127,7 @@ \kern-\scratchwidth \hpack to \scratchwidth{\hss\box\nextbox \hss}}} -\unexpanded\def\startoverlay +\protected\def\startoverlay {\bgroup \let\stopoverlay\egroup \processboxes\syst_boxes_overlay_process} @@ -2145,7 +2145,7 @@ %D %D returns an empty box with the dimensions of the box specified, here being zero. -\unexpanded\def\fakebox +\protected\def\fakebox {\bgroup \afterassignment\syst_boxes_fakebox_finish\scratchcounter} @@ -2174,13 +2174,13 @@ \def\syst_boxes_lrc_process#1{\bgroup\forgetall\let\\\endgraf#1\let\next} -\unexpanded\def\lbox#1#{\vbox#1\syst_boxes_lrc_process\raggedleft } -\unexpanded\def\cbox#1#{\vbox#1\syst_boxes_lrc_process\raggedcenter} -\unexpanded\def\rbox#1#{\vbox#1\syst_boxes_lrc_process\raggedright } +\protected\def\lbox#1#{\vbox#1\syst_boxes_lrc_process\raggedleft } +\protected\def\cbox#1#{\vbox#1\syst_boxes_lrc_process\raggedcenter} +\protected\def\rbox#1#{\vbox#1\syst_boxes_lrc_process\raggedright } -\unexpanded\def\ltop#1#{\vtop#1\syst_boxes_lrc_process\raggedleft } -\unexpanded\def\ctop#1#{\vtop#1\syst_boxes_lrc_process\raggedcenter} -\unexpanded\def\rtop#1#{\vtop#1\syst_boxes_lrc_process\raggedright } +\protected\def\ltop#1#{\vtop#1\syst_boxes_lrc_process\raggedleft } +\protected\def\ctop#1#{\vtop#1\syst_boxes_lrc_process\raggedcenter} +\protected\def\rtop#1#{\vtop#1\syst_boxes_lrc_process\raggedright } %D The alternatives \type {\tbox} and \type {\bbox} can be used to properly align %D boxes, like in: @@ -2202,8 +2202,8 @@ %D %D \getbuffer -\unexpanded\def\tbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_tbox_finish\hbox} -\unexpanded\def\bbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_bbox_finish\hbox} +\protected\def\tbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_tbox_finish\hbox} +\protected\def\bbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_bbox_finish\hbox} \def\syst_boxes_tbox_finish {\scratchdepth\dimexpr\ht\nextbox+\dp\nextbox-\ht\strutbox\relax @@ -2234,9 +2234,9 @@ \def\dodomhbox{\hpack to \hsize{\hss\box\nextbox\hss}} \def\dodorhbox{\hpack to \hsize{\hss\box\nextbox }} -\unexpanded\def\lhbox{\dowithnextboxcs\dodolhbox\hbox} -\unexpanded\def\mhbox{\dowithnextboxcs\dodomhbox\hbox} -\unexpanded\def\rhbox{\dowithnextboxcs\dodorhbox\hbox} +\protected\def\lhbox{\dowithnextboxcs\dodolhbox\hbox} +\protected\def\mhbox{\dowithnextboxcs\dodomhbox\hbox} +\protected\def\rhbox{\dowithnextboxcs\dodorhbox\hbox} \let\lefthbox \lhbox \let\midhbox \mhbox @@ -2257,7 +2257,7 @@ \newdimen\sizeofbox -\unexpanded\def\boxofsize#1% +\protected\def\boxofsize#1% {\bgroup \sizeofbox\zeropoint \scratchdimen\zeropoint @@ -2279,7 +2279,7 @@ % \limitvbox % \limithbox -\unexpanded\def\limitatelines#1#2% size sentinel +\protected\def\limitatelines#1#2% size sentinel {\dowithnextbox {\scratchdimen#1\hsize \ifdim\wd\nextbox>\scratchdimen @@ -2290,7 +2290,7 @@ \unhbox\nextbox} \hbox} -\unexpanded\def\fittoptobaselinegrid % weg hier +\protected\def\fittoptobaselinegrid % weg hier {\dowithnextbox {\bgroup \par @@ -2319,7 +2319,7 @@ \setbox\fakedboxcursor\hpack {\vrule\s!width\zeropoint\s!height\zeropoint\s!depth\zeropoint} -\unexpanded\def\boxcursor % overloaded in core-vis +\protected\def\boxcursor % overloaded in core-vis {\iftraceboxplacement \bgroup \scratchdimen2\onepoint @@ -2336,21 +2336,21 @@ \copy\fakedboxcursor \fi} -\unexpanded\def\placedbox +\protected\def\placedbox {\iftraceboxplacement\ruledhbox\else\hbox\fi} \newdimen\boxoffset \newdimen\boxhdisplacement \newdimen\boxvdisplacement -\unexpanded\def\rightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbox_finish \placedbox} -\unexpanded\def\leftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbox_finish \placedbox} -\unexpanded\def\topbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_topbox_finish \placedbox} -\unexpanded\def\bottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_bottombox_finish \placedbox} -\unexpanded\def\lefttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_lefttopbox_finish \placedbox} -\unexpanded\def\righttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_righttopbox_finish \placedbox} -\unexpanded\def\leftbottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbottombox_finish \placedbox} -\unexpanded\def\rightbottombox{\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbottombox_finish\placedbox} +\protected\def\rightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbox_finish \placedbox} +\protected\def\leftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbox_finish \placedbox} +\protected\def\topbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_topbox_finish \placedbox} +\protected\def\bottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_bottombox_finish \placedbox} +\protected\def\lefttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_lefttopbox_finish \placedbox} +\protected\def\righttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_righttopbox_finish \placedbox} +\protected\def\leftbottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbottombox_finish \placedbox} +\protected\def\rightbottombox{\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbottombox_finish\placedbox} \let\topleftbox \lefttopbox \let\toprightbox \righttopbox @@ -2416,10 +2416,10 @@ \boxcursor\kern\boxhdisplacement\lower\boxvdisplacement\box\nextbox \egroup} -\unexpanded\def\middlebox {\hpack\bgroup\dowithnextboxcs\syst_boxes_middlebox_finish \placedbox} -\unexpanded\def\baselinemiddlebox{\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinemiddlebox_finish\placedbox} -\unexpanded\def\baselineleftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselineleftbox_finish \placedbox} -\unexpanded\def\baselinerightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinerightbox_finish \placedbox} +\protected\def\middlebox {\hpack\bgroup\dowithnextboxcs\syst_boxes_middlebox_finish \placedbox} +\protected\def\baselinemiddlebox{\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinemiddlebox_finish\placedbox} +\protected\def\baselineleftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselineleftbox_finish \placedbox} +\protected\def\baselinerightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinerightbox_finish \placedbox} \def\syst_boxes_middlebox_finish {\global\boxhdisplacement-.5\wd\nextbox @@ -2453,7 +2453,7 @@ %D %D Experimental, not yet frozen: -\unexpanded\def\lrtbbox#1#2#3#4% l r t b +\protected\def\lrtbbox#1#2#3#4% l r t b {\bgroup \dowithnextboxcontent {\advance\hsize-#1\advance\hsize-#2\relax @@ -2466,7 +2466,7 @@ %D %D See core-tbl.tex for an example of its usage: -\unexpanded\def\toplinebox +\protected\def\toplinebox {\dowithnextboxcs\syst_boxes_toplinebox_finish\tbox} \def\syst_boxes_toplinebox_finish @@ -2505,20 +2505,20 @@ \installcorenamespace {stackbox} \installcorenamespace {stacklst} -\unexpanded\def\setstackbox#1#2% +\protected\def\setstackbox#1#2% {\ifcsname\??stackbox#1:#2\endcsname\else \expandafter\newbox\csname\??stackbox#1:#2\endcsname \fi \global\setbox\csname\??stackbox#1:#2\endcsname\vbox} -\unexpanded\def\initializeboxstack#1% +\protected\def\initializeboxstack#1% {\def\docommand##1{\setstackbox{#1}{##1}{}}% \ifcsname\??stacklst#1\endcsname \expandafter\processcommacommand\expandafter[\lastnamedcs]\docommand \fi \letgvalueempty{\??stacklst#1}} -\unexpanded\def\savebox#1#2% stack name +\protected\def\savebox#1#2% stack name {% beware, \setxvalue defines the cs beforehand so we cannot use the % test inside the { } \ifcsname\??stacklst#1\endcsname @@ -2529,27 +2529,27 @@ \fi \setstackbox{#1}{#2}} -\unexpanded\def\flushbox#1#2% unwrapped +\protected\def\flushbox#1#2% unwrapped {\ifcsname\??stackbox#1:#2\endcsname \box\lastnamedcs \else \emptybox \fi} -\unexpanded\def\restorebox#1#2% unwrapped +\protected\def\restorebox#1#2% unwrapped {\ifcsname\??stackbox#1:#2\endcsname \copy\lastnamedcs \else \emptybox \fi} -\unexpanded\def\foundbox#1#2% wrapped +\protected\def\foundbox#1#2% wrapped {\vpack {\ifcsname\??stackbox#1:#2\endcsname \copy\lastnamedcs \fi}} -\unexpanded\def\doifelsebox#1#2% +\protected\def\doifelsebox#1#2% {\ifcsname\??stackbox#1:#2\endcsname \ifvoid\lastnamedcs \doubleexpandafter\secondoftwoarguments @@ -2569,11 +2569,11 @@ \newcount\c_syst_boxes_stack \let \b_syst_boxes_stack\relax -\unexpanded\def\syst_boxes_stack_allocate +\protected\def\syst_boxes_stack_allocate {\newbox\b_syst_boxes_stack \expandafter\let\csname\??boxstack\number\c_syst_boxes_stack\endcsname\b_syst_boxes_stack} -\unexpanded\def\syst_boxes_push#1#2% +\protected\def\syst_boxes_push#1#2% {\global\advance\c_syst_boxes_stack\plusone \expandafter\let\expandafter\b_syst_boxes_stack\csname\??boxstack\number\c_syst_boxes_stack\endcsname \ifx\b_syst_boxes_stack\relax % cheaper then csname check as in most cases it's defined @@ -2581,15 +2581,15 @@ \fi #1\setbox\b_syst_boxes_stack\box#2\relax} -\unexpanded\def\syst_boxes_pop#1#2% +\protected\def\syst_boxes_pop#1#2% {#1\setbox#2\box\csname\??boxstack\number\c_syst_boxes_stack\endcsname \global\advance\c_syst_boxes_stack\minusone} -\unexpanded\def\localpushbox {\syst_boxes_push\relax} -\unexpanded\def\localpopbox {\syst_boxes_pop \relax} +\protected\def\localpushbox {\syst_boxes_push\relax} +\protected\def\localpopbox {\syst_boxes_pop \relax} -\unexpanded\def\globalpushbox{\syst_boxes_push\global} -\unexpanded\def\globalpopbox {\syst_boxes_pop \global} +\protected\def\globalpushbox{\syst_boxes_push\global} +\protected\def\globalpopbox {\syst_boxes_pop \global} %D And here is a more modern one (not yet in i-*): %D @@ -2607,15 +2607,15 @@ %D \resetboxesincache{foo} %D \stoptyping -\unexpanded\def\putboxincache #1#2#3{\clf_putboxincache {#1}{#2}#3\relax} -\unexpanded\def\getboxfromcache #1#2#3{\clf_getboxfromcache {#1}{#2}#3\relax} -\unexpanded\def\doifelseboxincache #1#2{\clf_doifelseboxincache {#1}{#2}} -\unexpanded\def\copyboxfromcache #1#2#3{\clf_copyboxfromcache {#1}{#2}#3\relax} -\unexpanded\def\directboxfromcache #1#2{\clf_directboxfromcache {#1}{#2}} -\unexpanded\def\directcopyboxfromcache#1#2{\clf_directcopyboxfromcache{#1}{#2}} -\unexpanded\def\resetboxesincache #1{\clf_resetboxesincache {#1}} +\protected\def\putboxincache #1#2#3{\clf_putboxincache {#1}{#2}#3\relax} +\protected\def\getboxfromcache #1#2#3{\clf_getboxfromcache {#1}{#2}#3\relax} +\protected\def\doifelseboxincache #1#2{\clf_doifelseboxincache {#1}{#2}} +\protected\def\copyboxfromcache #1#2#3{\clf_copyboxfromcache {#1}{#2}#3\relax} +\protected\def\directboxfromcache #1#2{\clf_directboxfromcache {#1}{#2}} +\protected\def\directcopyboxfromcache#1#2{\clf_directcopyboxfromcache{#1}{#2}} +\protected\def\resetboxesincache #1{\clf_resetboxesincache {#1}} -\unexpanded\def\putnextboxincache#1#2% +\protected\def\putnextboxincache#1#2% {\dowithnextbox{\putboxincache{#1}{#2}\nextbox}} %D \macros @@ -2624,21 +2624,21 @@ %D While \type {\removedepth} removes the preceding depth, \type {\obeydepth} makes %D sure we have depth. Both macros leave the \type {\prevdepth} untouched. -\unexpanded\def\removedepth +\protected\def\removedepth {\ifvmode \ifdim\prevdepth>\zeropoint \kern-\prevdepth \fi \fi} -\unexpanded\def\obeydepth +\protected\def\obeydepth {\par % watch out for changes in math formulas \ifvmode\ifdim\prevdepth<\zeropoint\else\ifdim\prevdepth<\strutdp \kern\dimexpr\strutdp-\prevdepth\relax \prevdepth\strutdp \fi\fi\fi} -\unexpanded\def\undepthed +\protected\def\undepthed {\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\hbox} %D \macros @@ -2646,10 +2646,10 @@ %D %D A funny (but rather stupid) one, plus a redefinition. -\unexpanded\def\removebottomthings +\protected\def\removebottomthings {\dorecurse\plusfive{\unskip\unkern\unpenalty}} -\unexpanded\def\removelastskip % \ifvmode the plain tex one \fi +\protected\def\removelastskip % \ifvmode the plain tex one \fi {\ifvmode\ifzeropt\lastskip\else\vskip-\lastskip\fi\fi} %D \macros @@ -2658,7 +2658,7 @@ %D This macro sets the dimensions of a box to those of a strut. Sort of obsolete so %D it will go away. -\unexpanded\def\makestrutofbox % not used +\protected\def\makestrutofbox % not used {\afterassignment\syst_boxes_makestrutofbox\c_boxes_register} \def\syst_boxes_makestrutofbox @@ -2677,8 +2677,8 @@ %D \hsmash{\raisebox{100pt}\hbox{test}} %D \stoptyping -\unexpanded\def\raisebox#1{\bgroup\afterassignment\syst_boxes_raise_indeed\scratchdimen#1} % so both 10pt and {10pt} is accepted -\unexpanded\def\lowerbox#1{\bgroup\afterassignment\syst_boxes_lower_indeed\scratchdimen#1} % so both 10pt and {10pt} is accepted +\protected\def\raisebox#1{\bgroup\afterassignment\syst_boxes_raise_indeed\scratchdimen#1} % so both 10pt and {10pt} is accepted +\protected\def\lowerbox#1{\bgroup\afterassignment\syst_boxes_lower_indeed\scratchdimen#1} % so both 10pt and {10pt} is accepted \def\syst_boxes_raise_indeed{\dowithnextboxcs\syst_boxes_raise_finish} \def\syst_boxes_lower_indeed{\dowithnextboxcs\syst_boxes_lower_finish} @@ -2699,7 +2699,7 @@ % vcenter in text, we kunnen vcenter overloaden -\unexpanded\def\halfwaybox +\protected\def\halfwaybox {\hpack\bgroup \dowithnextboxcs\syst_boxes_halfwaybox_finish\hbox} @@ -2708,7 +2708,7 @@ \lower.5\ht\nextbox\box\nextbox \egroup} -\unexpanded\def\depthonlybox +\protected\def\depthonlybox {\tpack\bgroup \dowithnextboxcs\syst_boxes_depthonlybox_finish\vbox} @@ -2733,7 +2733,7 @@ % not in lmtxmode: -\unexpanded\def\vcenter +\protected\def\vcenter {\vbox\bgroup \dowithnextboxcs\syst_boxes_vcenter_finish\vbox} @@ -2753,7 +2753,7 @@ %D %D A not so well unhboxable box can be made with: -\unexpanded\def\frozenhbox +\protected\def\frozenhbox {\hpack\bgroup \dowithnextboxcs\syst_boxes_frozenhbox_finish\hbox} @@ -2769,11 +2769,11 @@ \installcorenamespace {box_x} \installcorenamespace {box_y} -\unexpanded\def\setboxllx #1#2{\expandafter\edef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\setboxlly #1#2{\expandafter\edef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} +\protected\def\setboxllx #1#2{\expandafter\edef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} +\protected\def\setboxlly #1#2{\expandafter\edef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\gsetboxllx#1#2{\expandafter\xdef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\gsetboxlly#1#2{\expandafter\xdef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} +\protected\def\gsetboxllx#1#2{\expandafter\xdef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} +\protected\def\gsetboxlly#1#2{\expandafter\xdef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} %def\getboxllx#1{\ifcsname\??box_x\number#1\endcsname\csname\??box_x\number#1\endcsname\else\zeropoint\fi} %def\getboxlly#1{\ifcsname\??box_y\number#1\endcsname\csname\??box_y\number#1\endcsname\else\zeropoint\fi} @@ -2796,7 +2796,7 @@ %D \shownextbox\vbox{\setupwhitespace[big]test\endgraf\thinrule} %D \stoptyping -\unexpanded\def\shownextbox % seldom used +\protected\def\shownextbox % seldom used {\dowithnextbox {\bgroup \showboxbreadth\maxdimen @@ -2808,7 +2808,7 @@ \interactionmode\scratchcounter \egroup}} -\unexpanded\def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>} +\protected\def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>} {\bgroup \ifhbox#1\relax \setbox\scratchboxtwo\emptybox @@ -2840,7 +2840,7 @@ %D \minimalhbox 100pt {test} %D \stoptyping -\unexpanded\def\minimalhbox#1#% +\protected\def\minimalhbox#1#% {\dowithnextbox {\bgroup \setbox\scratchbox\hpack#1{\hss}% @@ -2851,7 +2851,7 @@ %D A bit dirty: -\unexpanded\def\nodestostring#1#2% more tolerant for #2=\cs +\protected\def\nodestostring#1#2% more tolerant for #2=\cs {\begingroup \setbox\nextbox\hbox{#2}% \normalexpanded{\endgroup\edef\noexpand#1{\clf_boxtostring\nextbox}}} @@ -2882,7 +2882,7 @@ \let\getnaturalwd\clf_getnaturalwd % no intermediate \let\setnaturalwd\clf_setnaturalwd % no intermediate -\unexpanded\def\doifelserighttoleftinbox{\clf_doifelserighttoleftinbox} +\protected\def\doifelserighttoleftinbox{\clf_doifelserighttoleftinbox} \let\doifrighttoleftinboxelse\doifelserighttoleftinbox @@ -2891,23 +2891,23 @@ \definesystemattribute [runningtext] [public] %unexpanded\def\runninghbox{\hbox attr \runningtextattribute \plusone} % not yet in i-* -\unexpanded\def\runninghbox{\hbox attr \runningtextattribute \fontid\font} % not yet in i-* +\protected\def\runninghbox{\hbox attr \runningtextattribute \fontid\font} % not yet in i-* %D To complement lua (yet undocumented): -\unexpanded\def\beginhbox{\hbox\bgroup} \let\endhbox\egroup -\unexpanded\def\beginvbox{\vbox\bgroup} \let\endvbox\egroup -\unexpanded\def\beginvtop{\vtop\bgroup} \let\endvtop\egroup +\protected\def\beginhbox{\hbox\bgroup} \let\endhbox\egroup +\protected\def\beginvbox{\vbox\bgroup} \let\endvbox\egroup +\protected\def\beginvtop{\vtop\bgroup} \let\endvtop\egroup -\unexpanded\def\sethboxregister#1{\setbox#1\hbox} -\unexpanded\def\setvboxregister#1{\setbox#1\vbox} -\unexpanded\def\setvtopregister#1{\setbox#1\vtop} +\protected\def\sethboxregister#1{\setbox#1\hbox} +\protected\def\setvboxregister#1{\setbox#1\vbox} +\protected\def\setvtopregister#1{\setbox#1\vtop} -\unexpanded\def\flushboxregister#1{\box\numexpr#1\relax} +\protected\def\flushboxregister#1{\box\numexpr#1\relax} -\unexpanded\def\starthboxregister#1{\setbox#1\hbox\bgroup} \let\stophboxregister\egroup -\unexpanded\def\startvboxregister#1{\setbox#1\vbox\bgroup} \let\stopvboxregister\egroup -\unexpanded\def\startvtopregister#1{\setbox#1\vtop\bgroup} \let\stopvtopregister\egroup +\protected\def\starthboxregister#1{\setbox#1\hbox\bgroup} \let\stophboxregister\egroup +\protected\def\startvboxregister#1{\setbox#1\vbox\bgroup} \let\stopvboxregister\egroup +\protected\def\startvtopregister#1{\setbox#1\vtop\bgroup} \let\stopvtopregister\egroup %D For whatever third party package needs it: %D @@ -2923,7 +2923,7 @@ \installcorenamespace{localbox} -\unexpanded\def\newlocalbox#1% +\protected\def\newlocalbox#1% {\expandafter\let\expandafter#1\csname\??localbox\string#1\endcsname \ifx#1\relax \syst_aux_new_localbox#1% @@ -2935,26 +2935,26 @@ %D Who knows when this comes in handy: -\unexpanded\def\lastlinewidth{\dimexpr\clf_lastlinewidth\scaledpoint\relax} +\protected\def\lastlinewidth{\dimexpr\clf_lastlinewidth\scaledpoint\relax} %D Keep as reference: -% \unexpanded\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox} -% \unexpanded\def\tightvtop{\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop} +% \protected\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox} +% \protected\def\tightvtop{\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop} %D This one keeps dimensions and sets the shift field (and so it's more for testing %D than for real usage): -\unexpanded\def\shiftbox {\clf_shiftbox} -\unexpanded\def\vpackbox {\clf_vpackbox} -\unexpanded\def\hpackbox {\clf_hpackbox} -\unexpanded\def\vpackedbox{\clf_vpackedbox} -\unexpanded\def\hpackedbox{\clf_hpackedbox} +\protected\def\shiftbox {\clf_shiftbox} +\protected\def\vpackbox {\clf_vpackbox} +\protected\def\hpackbox {\clf_hpackbox} +\protected\def\vpackedbox{\clf_vpackedbox} +\protected\def\hpackedbox{\clf_hpackedbox} %D This one has been moved from a 2 decade old file. It makes something boxed %D sit on the baseline. -\unexpanded\def\linebox +\protected\def\linebox {\hpack\bgroup\dowithnextbox {\scratchdimen\dimexpr\dimexpr\htdp\nextbox-\lineheight\relax/2+\dp\strutbox\relax \setbox\nextbox\hpack{\lower\scratchdimen\box\nextbox}% @@ -3005,10 +3005,10 @@ % % \unprotect % -% \unexpanded\def\withwordsinstring#1#2% command str +% \protected\def\withwordsinstring#1#2% command str % {\ctxcommand{withwords(\!!bs#1\!!es,\!!bs#2\!!es)}} % -% \unexpanded\def\withwordsinfile#1#2% command name +% \protected\def\withwordsinfile#1#2% command name % {\ctxcommand{withwords(\!!bs#1\!!es,io.loaddata(resolvers.findfile("#2")))}} % % \protect diff --git a/tex/context/base/mkiv/supp-box.mkxl b/tex/context/base/mkiv/supp-box.mkxl index b081f83b0..027b89e23 100644 --- a/tex/context/base/mkiv/supp-box.mkxl +++ b/tex/context/base/mkiv/supp-box.mkxl @@ -35,7 +35,7 @@ %D The next macro suppresses over- and underfull messages which often makes sense %D when we deal with boxes. -\unexpanded\def\dontcomplain +\protected\def\dontcomplain {\hbadness\plustenthousand \vbadness\plustenthousand \hfuzz \maxdimen @@ -81,12 +81,12 @@ %D Smashing is introduced in \PLAIN\ \TEX, and stands for reducing the dimensions of %D a box to zero. The most resolute one is presented first. -\unexpanded\def\smashbox#1% +\protected\def\smashbox#1% {\wd#1\zeropoint \ht#1\zeropoint \dp#1\zeropoint} -\unexpanded\def\smashboxed#1% +\protected\def\smashboxed#1% {\wd#1\zeropoint \ht#1\zeropoint \dp#1\zeropoint @@ -98,10 +98,10 @@ %D Smashing can be used for overlaying boxes. Depending on the mode, horizontal or %D vertical, one can use: -\unexpanded\def\hsmashbox#1% +\protected\def\hsmashbox#1% {\wd#1\zeropoint} -\unexpanded\def\vsmashbox#1% +\protected\def\vsmashbox#1% {\ht#1\zeropoint \dp#1\zeropoint} @@ -109,7 +109,7 @@ \newcount\c_boxes_register -\unexpanded\def\smashbox +\protected\def\smashbox {\afterassignment\syst_boxes_smash_boxes_register\c_boxes_register} \def\syst_boxes_smash_boxes_register @@ -117,23 +117,23 @@ \ht\c_boxes_register\zeropoint \dp\c_boxes_register\zeropoint} -\unexpanded\def\hsmashbox +\protected\def\hsmashbox {\afterassignment\syst_boxes_hsmashed_boxes_register\c_boxes_register} \def\syst_boxes_hsmashed_boxes_register {\wd\c_boxes_register\zeropoint} -\unexpanded\def\vsmashbox +\protected\def\vsmashbox {\afterassignment\syst_boxes_vsmashed_boxes_register\c_boxes_register} \def\syst_boxes_vsmashed_boxes_register {\ht\c_boxes_register\zeropoint \dp\c_boxes_register\zeropoint} -\unexpanded\def\smashedbox +\protected\def\smashedbox {\afterassignment\syst_boxes_smashed_boxes_register\c_boxes_register} -\unexpanded\def\syst_boxes_smashed_boxes_register +\protected\def\syst_boxes_smashed_boxes_register {\wd\c_boxes_register\zeropoint \ht\c_boxes_register\zeropoint \dp\c_boxes_register\zeropoint @@ -147,23 +147,23 @@ %D some subtle differences betreen the smash and smashed alternatives. The later %D ones reduce all dimensions to zero. -\unexpanded\def\hsmash {\bgroup\dowithnextboxcs\syst_boxes_hsmashed_nextbox\hbox} -\unexpanded\def\vsmash {\bgroup\dowithnextboxcs\syst_boxes_vsmashed_nextbox\vbox} -\unexpanded\def\hsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \hbox} -\unexpanded\def\vsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \vbox} +\protected\def\hsmash {\bgroup\dowithnextboxcs\syst_boxes_hsmashed_nextbox\hbox} +\protected\def\vsmash {\bgroup\dowithnextboxcs\syst_boxes_vsmashed_nextbox\vbox} +\protected\def\hsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \hbox} +\protected\def\vsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \vbox} -\unexpanded\def\syst_boxes_hsmashed_nextbox +\protected\def\syst_boxes_hsmashed_nextbox {\wd\nextbox\zeropoint \box\nextbox \egroup} -\unexpanded\def\syst_boxes_vsmashed_nextbox +\protected\def\syst_boxes_vsmashed_nextbox {\ht\nextbox\zeropoint \dp\nextbox\zeropoint \box\nextbox \egroup} -\unexpanded\def\syst_boxes_smashed_nextbox +\protected\def\syst_boxes_smashed_nextbox {\ht\nextbox\zeropoint \dp\nextbox\zeropoint \wd\nextbox\zeropoint @@ -180,15 +180,15 @@ %D \smashedvbox to ... {...} %D \stoptyping -\unexpanded\def\smashedhbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\hbox} -\unexpanded\def\smashedvbox{\vpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\vbox} +\protected\def\smashedhbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\hbox} +\protected\def\smashedvbox{\vpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\vbox} %D First we define a helper. We use a \LUATEX\ feature in order to avoid %D mathpalettes. \newcount\c_boxes_math_style -\unexpanded\def\syst_boxes_math_set_nextbox#1% +\protected\def\syst_boxes_math_set_nextbox#1% {\c_boxes_math_style\normalmathstyle \setbox\nextbox\hbox{\normalstartimath\mathsurround\zeropoint\triggermathstyle\c_boxes_math_style{#1}\normalstopimath}} @@ -199,7 +199,7 @@ %D catcode safer. It is needed by the math module (although the \type {\leavevmode} %D is not added here). -\unexpanded\def\smash +\protected\def\smash {\begingroup \futureexpandis[\syst_boxes_smash_yes\syst_boxes_smash_nop} @@ -271,9 +271,9 @@ %D {\mathchoice}, the next macro looks ugly. We also take care of non||braced %D arguments. -\unexpanded\def\phantom {\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed } -\unexpanded\def\vphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_v} -\unexpanded\def\hphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_h} +\protected\def\phantom {\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed } +\protected\def\vphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_v} +\protected\def\hphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_h} \def\syst_boxes_phantom_math #1{\syst_boxes_math_set_nextbox{#1}\syst_boxes_phantom_make } \def\syst_boxes_phantom_math_v#1{\syst_boxes_math_set_nextbox{#1}\syst_boxes_phantom_make_v} @@ -337,7 +337,7 @@ %D We also define plain's \type {\mathstrut}. -\unexpanded\def\mathstrut{\vphantom(} % can be made faster by inlining +\protected\def\mathstrut{\vphantom(} % can be made faster by inlining %D \macros %D {getboxheight} @@ -371,7 +371,7 @@ %D The next alternative is slightly more clever, since it accepts \type {{12}} as %D well as \type {12} as box number. -\unexpanded\def\getboxheight#1\of#2\box#3% +\protected\def\getboxheight#1\of#2\box#3% {\def\next{#1\htdp\c_boxes_register}% \afterassignment\next\c_boxes_register=#3} @@ -420,7 +420,7 @@ \newcount\noflines \newdimen\noflinesheight -\unexpanded\def\getnoflines#1% +\protected\def\getnoflines#1% {\noflinesheight#1\relax \ifzeropt\noflinesheight \noflines\zerocount @@ -436,7 +436,7 @@ \advance\noflines\minusone \fi} -\unexpanded\def\getroundednoflines#1% +\protected\def\getroundednoflines#1% {\noflinesheight#1\relax \ifzeropt\noflinesheight \noflines\zerocount @@ -450,7 +450,7 @@ \noflines\noflinesheight \fi} -\unexpanded\def\getrawnoflines#1% +\protected\def\getrawnoflines#1% {\noflinesheight#1\relax \ifzeropt\noflinesheight \noflines\zerocount @@ -514,7 +514,7 @@ \def\syst_boxes_determine_noflines {\expandafter\egroup\expandafter\noflines\noflinesinbox\nextbox\relax} -\unexpanded\def\determinenoflines +\protected\def\determinenoflines {\bgroup \forgetall \let\crlf\endgraf @@ -532,7 +532,7 @@ %D \doiftext {data} {then branch} %D \stoptyping -\unexpanded\def\doifelsetext#1% +\protected\def\doifelsetext#1% {\begingroup \setbox\scratchbox\hbox % no \hpack because we can have fallbacks {\settrialtypesetting @@ -543,7 +543,7 @@ \endgroup\expandafter\firstoftwoarguments \fi} -\unexpanded\def\doiftext#1% +\protected\def\doiftext#1% {\begingroup \setbox\scratchbox\hbox % no \hpack because we can have fallbacks {\settrialtypesetting @@ -593,7 +593,7 @@ %D In this implementation the \type {\aftergroup} construction is needed because %D \type {\afterassignment} is executed inside the box. -\unexpanded\def\dowithnextbox#1% +\protected\def\dowithnextbox#1% {\def\syst_boxes_with_next_box{#1}% \afterassignment\syst_boxes_with_next_box_indeed \setbox\nextbox} @@ -601,7 +601,7 @@ \def\syst_boxes_with_next_box_indeed {\aftergroup\syst_boxes_with_next_box} -\unexpanded\def\dowithnextboxcs#1% +\protected\def\dowithnextboxcs#1% {\let\syst_boxes_with_next_box#1% \afterassignment\syst_boxes_with_next_box_indeed \setbox\nextbox} @@ -621,7 +621,7 @@ %D A slower but more versatile implementation is: %D %D \starttyping -%D \unexpanded\def\dowithnextbox#1#2% +%D \protected\def\dowithnextbox#1#2% %D {\def\syst_boxes_with_next_box{#1}% %D \ifx#2\hbox %D \afterassignment\syst_boxes_with_next_box_indeed @@ -651,7 +651,7 @@ \def\nextboxdp {\dp\nextbox} \def\nextboxhtdp{\htdp\nextbox} -\unexpanded\def\flushnextbox{\box\nextbox} +\protected\def\flushnextbox{\box\nextbox} %D \macros %D {dowithnextboxcontent} @@ -665,13 +665,13 @@ %D %D {\em todo: Search source for potential usage!} -\unexpanded\def\dowithnextboxcontent#1#2% inside, after +\protected\def\dowithnextboxcontent#1#2% inside, after {\def\syst_boxes_with_next_box_one{#2}% \def\syst_boxes_with_next_box_two{#1}% \afterassignment\syst_boxes_with_next_box_content_indeed \setbox\nextbox} -\unexpanded\def\dowithnextboxcontentcs#1#2% inside, after +\protected\def\dowithnextboxcontentcs#1#2% inside, after {\let\syst_boxes_with_next_box_one#2% \let\syst_boxes_with_next_box_two#1% \afterassignment\syst_boxes_with_next_box_content_indeed @@ -698,15 +698,15 @@ \def\domathllap{\mathpalette\dodomathllap} \def\dodomathllap#1#2{\dollap{\normalstartimath\mathsurround\zeropoint#1#2\normalstopimath}} \def\domathrlap{\mathpalette\dodomathrlap} \def\dodomathrlap#1#2{\dorlap{\normalstartimath\mathsurround\zeropoint#1#2\normalstopimath}} -\unexpanded\def\rlap{\mathortext\domathrlap\dorlap} -\unexpanded\def\llap{\mathortext\domathllap\dollap} -\unexpanded\def\clap{\mathortext\domathclap\doclap} +\protected\def\rlap{\mathortext\domathrlap\dorlap} +\protected\def\llap{\mathortext\domathllap\dollap} +\protected\def\clap{\mathortext\domathclap\doclap} \def\dodotlap{\vpack to \zeropoint{\vss\box\nextbox}\endgroup} \def\dodoblap{\vpack to \zeropoint{\box\nextbox\vss}\endgroup} -\unexpanded\def\tlap{\begingroup\dowithnextboxcs\dodotlap\vbox} -\unexpanded\def\blap{\begingroup\dowithnextboxcs\dodoblap\vbox} +\protected\def\tlap{\begingroup\dowithnextboxcs\dodotlap\vbox} +\protected\def\blap{\begingroup\dowithnextboxcs\dodoblap\vbox} %D \macros %D {beginofshapebox, @@ -840,7 +840,7 @@ \def\shapesignal{.12345678pt} % or 12345sp -\unexpanded\def\reshapebox#1% +\protected\def\reshapebox#1% {\doreshapebox {#1}% {\penalty\shapepenalty}% @@ -864,11 +864,11 @@ % We will turn this into a \MKIV\ variant (we can use \type {\vpack} too). -\unexpanded\def\insertshapesignal +\protected\def\insertshapesignal {\hpack to \shapesignal{\strut\hss}% plus \strut \prevdepth\strutdp} % never \nointerlineskip -\unexpanded\def\restoreshapebox % compensates for the signal +\protected\def\restoreshapebox % compensates for the signal {\global\setbox\tmpshapebox\vbox{\vskip-\lineheight\unvcopy\oldshapebox}} \def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip @@ -905,21 +905,21 @@ \advance\shapecounter \plusone \fi} -\unexpanded\def\beginofshapebox +\protected\def\beginofshapebox {\setbox\oldshapebox\vbox \bgroup \reshapingboxtrue \the\everyshapebox \insertshapesignal} -\unexpanded\def\endofshapebox +\protected\def\endofshapebox {\endgraf \egroup} \let\beginshapebox\beginofshapebox \let\endshapebox \endofshapebox -\unexpanded\def\flushshapebox +\protected\def\flushshapebox {\bgroup \ifzeropt\ht\newshapebox \else @@ -970,7 +970,7 @@ % % \omlijnd[offset=0pt,hoogte=8mm,uitlijnen={rechts,laho}]{\bfa test} -\unexpanded\def\innerflushshapebox +\protected\def\innerflushshapebox {\ifzeropt\ht\newshapebox \else \unvcopy\newshapebox\relax % unvcopy ! else spacing problem % \kern-\dp\newshapebox\relax @@ -993,7 +993,7 @@ %D use \type {\shapedhbox} instead of \type {\hbox}, since it manages the height and %D depth of the line. -\unexpanded\def\shapedhbox % lines with non strutted dimensions have +\protected\def\shapedhbox % lines with non strutted dimensions have {\expanded{\dowithnextbox % interlineskip so if we want the original {\ht\nextbox\the\ht\shapebox % spacing, we need to preserve the original \dp\nextbox\the\dp\shapebox % height and depth which is definitely @@ -1013,10 +1013,10 @@ %D \showhyphens{dohyphenatedword} %D \stoptyping -\unexpanded\def\doshowhyphenatednextbox +\protected\def\doshowhyphenatednextbox {\clf_showhyphenatedinlist\nextbox} -\unexpanded\def\showhyphens % hpack: so no processing (we hyphenate in lua) +\protected\def\showhyphens % hpack: so no processing (we hyphenate in lua) {\dowithnextboxcs\doshowhyphenatednextbox\hpack} %D The following macros are seldom used but handy for tracing. @@ -1027,19 +1027,19 @@ %D \hyphenatedfile{tufte} %D \stoptyping -\unexpanded\def\dohyphenatednextbox +\protected\def\dohyphenatednextbox {\clf_hyphenatedlist\nextbox false\relax \unhbox\nextbox} -\unexpanded\def\hyphenatedword {\dowithnextboxcs\dohyphenatednextbox\hbox} -\unexpanded\def\hyphenatedpar {\dowithnextboxcs\dohyphenatednextbox\hbox} -\unexpanded\def\hyphenatedfile#1{\dowithnextboxcs\dohyphenatednextbox\hbox{\readfile{#1}\donothing\donothing}} +\protected\def\hyphenatedword {\dowithnextboxcs\dohyphenatednextbox\hbox} +\protected\def\hyphenatedpar {\dowithnextboxcs\dohyphenatednextbox\hbox} +\protected\def\hyphenatedfile#1{\dowithnextboxcs\dohyphenatednextbox\hbox{\readfile{#1}\donothing\donothing}} -\unexpanded\def\dohyphenatednextboxcolor +\protected\def\dohyphenatednextboxcolor {\clf_hyphenatedlist\nextbox true\relax \unhbox\nextbox} -\unexpanded\def\hyphenatedcoloredword{\dowithnextboxcs\dohyphenatednextboxcolor\hbox} +\protected\def\hyphenatedcoloredword{\dowithnextboxcs\dohyphenatednextboxcolor\hbox} %D \macros %D {processtokens} @@ -1068,7 +1068,7 @@ %D The list of tokens may contain spaces, while \type {\\}, \type {{}} and \type {\ %D } are handled as space too. -\unexpanded\def\processtokens#1#2#3#4#5% +\protected\def\processtokens#1#2#3#4#5% {\begingroup \def\lastcharacter{\lastcharacter}% hm, recursive ? \def\space{ }% @@ -1157,7 +1157,7 @@ \ifdefined\fakecompoundhyphen\else \let\fakecompoundhyphen\relax \fi \ifdefined\veryraggedright \else \def\veryraggedright{\raggedright} \fi -% \unexpanded\def\limitatetext +% \protected\def\limitatetext % {\bgroup % evt \setstrut % \forgetall % otherwise indentation and so % \let\limitatetext\firstofthreearguments @@ -1253,7 +1253,7 @@ % \ifdim\wd\scratchboxtwo<\wd\scratchboxone #1\else\unhbox\scratchboxone\fi % \egroup} % -% \unexpanded\def\limitatetext#1#2#3% \expanded added 2003/01/16 +% \protected\def\limitatetext#1#2#3% \expanded added 2003/01/16 % {\splitatcomma{#2}\leftlimit\rightlimit % \ifempty\rightlimit % \normallimitatetext {#1}\leftlimit {#3}% @@ -1261,7 +1261,7 @@ % \speciallimitatetext{#1}\leftlimit\rightlimit{#3}% % \fi} -\unexpanded\def\limitatetext#1#2#3% \expanded added 2003/01/16 +\protected\def\limitatetext#1#2#3% \expanded added 2003/01/16 {\splitatcomma{#2}\leftlimit\rightlimit \limitated left \leftlimit @@ -1279,7 +1279,7 @@ %D \limitatefirstline{\input tufte\relax}{10cm}{\unknown} %D \stoptyping -\unexpanded\def\limitatefirstline#1#2#3% +\protected\def\limitatefirstline#1#2#3% {\hbox\bgroup\strut % \hpack \setbox\scratchbox\hbox{\begstrut#1\endstrut}% \ifdim\wd\scratchbox>#2\relax @@ -1322,7 +1322,7 @@ % todo: provide variant with #1 picked up as box -\unexpanded\def\processisolatedchars#1#2% +\protected\def\processisolatedchars#1#2% {\dontleavehmode \begingroup \setbox\scratchbox\hbox{\settrialtypesetting#2{\savecurrentattributes{pic}}}% @@ -1335,7 +1335,7 @@ \relax \endgroup} -\unexpanded\def\processisolatedwords#1#2% +\protected\def\processisolatedwords#1#2% {\dontleavehmode \begingroup \setbox\scratchbox\hbox{\settrialtypesetting#2{\savecurrentattributes{pic}}}% @@ -1350,7 +1350,7 @@ %D A variant: -\unexpanded\def\applytocharacters#1% +\protected\def\applytocharacters#1% {\dontleavehmode \dowithnextbox{\clf_applytobox method {char}% @@ -1360,7 +1360,7 @@ \relax}% \hbox} -\unexpanded\def\applytowords#1% +\protected\def\applytowords#1% {\dontleavehmode \dowithnextbox{\clf_applytobox method {word}% @@ -1372,33 +1372,33 @@ %D The old call: -\unexpanded\def\processwords#1% +\protected\def\processwords#1% {\processisolatedwords{#1}\processword} \let\processword\relax -\unexpanded\def\applytosplitstringchar#1#2% +\protected\def\applytosplitstringchar#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% method {char}% \relax} -\unexpanded\def\applytosplitstringword#1#2% +\protected\def\applytosplitstringword#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% method {word}% \relax} -\unexpanded\def\applytosplitstringline#1#2% +\protected\def\applytosplitstringline#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% method {line}% \relax} -\unexpanded\def\applytosplitstringcharspaced#1#2% +\protected\def\applytosplitstringcharspaced#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% @@ -1406,7 +1406,7 @@ spaced true% \relax} -\unexpanded\def\applytosplitstringwordspaced#1#2% +\protected\def\applytosplitstringwordspaced#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% @@ -1414,7 +1414,7 @@ spaced true% \relax} -\unexpanded\def\applytosplitstringlinespaced#1#2% +\protected\def\applytosplitstringlinespaced#1#2% {\dontleavehmode\clf_processsplit data {#2}% command {\csstring#1}% @@ -1447,11 +1447,11 @@ %D would have ended up in the text. This macro can be useful when building %D complicated menus, headers and footers and|/|or margin material. -\unexpanded\def\sbox +\protected\def\sbox {\vpack\bgroup \dowithnextboxcs\syst_boxes_sbox_finish\vbox} -\unexpanded\def\syst_boxes_sbox_finish +\protected\def\syst_boxes_sbox_finish {\boxyoffset\nextbox-\strutdp \dp\nextbox\strutdp \ht\nextbox\strutht @@ -1464,11 +1464,11 @@ %D xx \ruledhbox{\inlinedbox{\tfd test}} xx %D \stoptyping -\unexpanded\def\inlinedbox +\protected\def\inlinedbox {\bgroup \dowithnextboxcs\syst_boxes_inlined_finish\hbox} -\unexpanded\def\syst_boxes_inlined_finish +\protected\def\syst_boxes_inlined_finish {\boxyoffset\nextbox-\dimexpr(\htdp\nextbox-\lineheight)/\plustwo+\strutdp\relax \ht\nextbox\strutht \dp\nextbox\strutdp @@ -1480,7 +1480,7 @@ %D %D This boxing macro limits the height and depth to those of a strut. -\unexpanded\def\struttedbox +\protected\def\struttedbox {\hpack\bgroup \dowithnextboxcs\syst_boxes_struttedbox_finish\hbox} @@ -1496,7 +1496,7 @@ %D This macro compensates the difference between the topskip and strutheight. Watch %D how we preserve the depth when it equals strutdepth. -\unexpanded\def\topskippedbox +\protected\def\topskippedbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_topskippedbox_finish\hbox} \def\syst_boxes_topskippedbox_finish @@ -1548,7 +1548,7 @@ %D The dimensions of the surrounding box are kept intact. This commands handles %D positive and negative dimensions (which is why we need two boxes with rules). -\unexpanded\def\centeredbox#1#% height +/-dimen width +/-dimen +\protected\def\centeredbox#1#% height +/-dimen width +/-dimen {\bgroup \dontcomplain \forgetall @@ -1585,7 +1585,7 @@ %D %D Do you see why we call this one \type {next}? -\unexpanded\def\centerednextbox#1#% +\protected\def\centerednextbox#1#% {\bgroup \dowithnextbox {\hsize\wd\nextbox @@ -1606,7 +1606,7 @@ %D When omitted, the current \type {\hsize} and \type {\vsize} are used. Local %D dimensions are supported. -\unexpanded\def\centerbox#1#% optional height +/-dimen width +/-dimen +\protected\def\centerbox#1#% optional height +/-dimen width +/-dimen {\bgroup \dowithnextbox {\setlocalhsize @@ -1636,7 +1636,7 @@ \newif\ifstretchrigidcolumns \newif\iftightrigidcolumns % if true: just a vbox, no depth/noflines/gridsnap corrrections -\unexpanded\def\setrigidcolumnhsize#1#2#3% todo: \dimexpr +\protected\def\setrigidcolumnhsize#1#2#3% todo: \dimexpr {\xdef\savedrigidhsize{\the\hsize}% \hsize#1\relax \global\chardef\rigidcolumns#3\relax @@ -1657,7 +1657,7 @@ \let\rigidcolumnlines\!!zerocount -\unexpanded\def\rigidcolumnbalance#1% +\protected\def\rigidcolumnbalance#1% {\ifnum\rigidcolumns=1 % tzt ook h/d correctie \ifinner\ifhmode\box\else\unvbox\fi\else\unvbox\fi#1\relax \else @@ -1748,7 +1748,7 @@ %D Create line and fake height of paragraph by messign with heights: a nice hack by %D DEK himself. -%\unexpanded\def\setvboxtohbox +%\protected\def\setvboxtohbox % {\bgroup % \ifdim\baselineskip<16pt \relax % \scratchdimen\baselineskip @@ -1762,12 +1762,12 @@ % \xdef\vboxtohboxfactor{\withoutpt\the\scratchdimen}% % \egroup} % -% \unexpanded\def\startvboxtohbox +% \protected\def\startvboxtohbox % {\bgroup % \setvboxtohbox % \setbox\scratchbox\hbox\bgroup} % -% \unexpanded\def\stopvboxtohbox +% \protected\def\stopvboxtohbox % {\ifcase\vboxtohboxslack\else\hskip\zeropoint\!!minus\vboxtohboxslack\fi % \egroup % \dp\scratchbox\zeropoint @@ -1782,17 +1782,17 @@ %newbox\d_syst_boxes_vboxtohbox \newbox\d_syst_boxes_separator -\unexpanded\def\startvboxtohboxseparator +\protected\def\startvboxtohboxseparator {\setbox\d_syst_boxes_separator\hbox attr \vboxtohboxseparatorattribute\plusone\bgroup} -\unexpanded\def\stopvboxtohboxseparator +\protected\def\stopvboxtohboxseparator {\egroup} -\unexpanded\def\startvboxtohbox +\protected\def\startvboxtohbox {\begingroup \setbox\scratchbox\hbox\bgroup} -\unexpanded\def\stopvboxtohbox +\protected\def\stopvboxtohbox {\ifvoid\d_syst_boxes_separator \hskip\zeropoint\ifcase\vboxtohboxslack\else\s!minus\vboxtohboxslack\fi % we really need a skip \else @@ -1805,12 +1805,12 @@ % A possible reconstruction: -\unexpanded\def\convertvboxtohbox +\protected\def\convertvboxtohbox {\makehboxofhboxes \setbox\scratchboxone\hpack{\unhbox\scratchboxone\removehboxes}% \hpack \noindent\unhbox\scratchboxone\par} -\unexpanded\def\makehboxofhboxes +\protected\def\makehboxofhboxes {\setbox\scratchboxone\emptyhbox \loop % \doloop { .. \exitloop .. } \setbox\scratchboxtwo\lastbox @@ -1818,7 +1818,7 @@ \setbox\scratchboxone\hpack{\box\scratchboxtwo\unhbox\scratchboxone}% \repeat} -\unexpanded\def\removehboxes +\protected\def\removehboxes {\setbox\scratchboxone\lastbox \ifhbox\scratchboxone {\removehboxes}\unhbox\scratchboxone @@ -1826,11 +1826,11 @@ % And one special for notes: -\unexpanded\def\starthboxestohbox +\protected\def\starthboxestohbox {\bgroup \setbox\scratchbox\vbox\bgroup} -\unexpanded\def\stophboxestohbox +\protected\def\stophboxestohbox {\egroup \clf_vboxlisttohbox\scratchbox\nextbox\dimexpr\hboxestohboxslack\relax \dontleavehmode @@ -1850,7 +1850,7 @@ \newdimen \lasthhboxwidth \newskip \hhboxindent -\unexpanded\def\unhhbox#1\with#2% +\protected\def\unhhbox#1\with#2% {\bgroup \nopenalties \dontcomplain @@ -1881,7 +1881,7 @@ \unhbox1 \egroup} -\unexpanded\def\hboxofvbox +\protected\def\hboxofvbox {\bgroup \afterassignment\dohboxofvbox \scratchcounter=} @@ -1924,7 +1924,7 @@ %D dimension of this box suggest some content, the resulting box is unboxed and %D surrounded by the first two arguments, else the third arguments is executed. -\unexpanded\def\doifcontent#1#2#3% +\protected\def\doifcontent#1#2#3% {\dowithnextbox {\ifhbox\nextbox \ifdim\wd\nextbox>\zeropoint @@ -1967,7 +1967,7 @@ \newbox\processbox % public : this is the one where \nextbox's end up in -\unexpanded\def\processboxes#1% +\protected\def\processboxes#1% {\bgroup \def\syst_boxes_process_indeed{#1}% #1 can be redefined halfway \setbox\processbox\emptybox @@ -1981,7 +1981,7 @@ \syst_boxes_process_indeed % takes \nextbox makes \processbox \doifelsenextbgroup\syst_boxes_process_yes\syst_boxes_process_nop} -\unexpanded\def\syst_boxes_process_nop +\protected\def\syst_boxes_process_nop {\removeunwantedspaces \box\processbox \egroup} @@ -2041,7 +2041,7 @@ \kern-\scratchwidth \hpack to \scratchwidth{\hss\box\nextbox \hss}}} -\unexpanded\def\startoverlay +\protected\def\startoverlay {\bgroup \let\stopoverlay\egroup \processboxes\syst_boxes_overlay_process} @@ -2059,7 +2059,7 @@ %D %D returns an empty box with the dimensions of the box specified, here being zero. -\unexpanded\def\fakebox +\protected\def\fakebox {\bgroup \afterassignment\syst_boxes_fakebox_finish\scratchcounter} @@ -2088,13 +2088,13 @@ \def\syst_boxes_lrc_process#1{\bgroup\forgetall\let\\\endgraf#1\let\next} -\unexpanded\def\lbox#1#{\vbox#1\syst_boxes_lrc_process\raggedleft } -\unexpanded\def\cbox#1#{\vbox#1\syst_boxes_lrc_process\raggedcenter} -\unexpanded\def\rbox#1#{\vbox#1\syst_boxes_lrc_process\raggedright } +\protected\def\lbox#1#{\vbox#1\syst_boxes_lrc_process\raggedleft } +\protected\def\cbox#1#{\vbox#1\syst_boxes_lrc_process\raggedcenter} +\protected\def\rbox#1#{\vbox#1\syst_boxes_lrc_process\raggedright } -\unexpanded\def\ltop#1#{\vtop#1\syst_boxes_lrc_process\raggedleft } -\unexpanded\def\ctop#1#{\vtop#1\syst_boxes_lrc_process\raggedcenter} -\unexpanded\def\rtop#1#{\vtop#1\syst_boxes_lrc_process\raggedright } +\protected\def\ltop#1#{\vtop#1\syst_boxes_lrc_process\raggedleft } +\protected\def\ctop#1#{\vtop#1\syst_boxes_lrc_process\raggedcenter} +\protected\def\rtop#1#{\vtop#1\syst_boxes_lrc_process\raggedright } %D The alternatives \type {\tbox} and \type {\bbox} can be used to properly align %D boxes, like in: @@ -2116,8 +2116,8 @@ %D %D \getbuffer -\unexpanded\def\tbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_tbox_finish\hbox} -\unexpanded\def\bbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_bbox_finish\hbox} +\protected\def\tbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_tbox_finish\hbox} +\protected\def\bbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_bbox_finish\hbox} \def\syst_boxes_tbox_finish {\scratchheight\ht\strutbox @@ -2146,9 +2146,9 @@ \def\dodomhbox{\hpack to \hsize{\hss\box\nextbox\hss}} \def\dodorhbox{\hpack to \hsize{\hss\box\nextbox }} -\unexpanded\def\lhbox{\dowithnextboxcs\dodolhbox\hbox} -\unexpanded\def\mhbox{\dowithnextboxcs\dodomhbox\hbox} -\unexpanded\def\rhbox{\dowithnextboxcs\dodorhbox\hbox} +\protected\def\lhbox{\dowithnextboxcs\dodolhbox\hbox} +\protected\def\mhbox{\dowithnextboxcs\dodomhbox\hbox} +\protected\def\rhbox{\dowithnextboxcs\dodorhbox\hbox} \let\lefthbox \lhbox \let\midhbox \mhbox @@ -2169,7 +2169,7 @@ \newdimen\sizeofbox -\unexpanded\def\boxofsize#1% +\protected\def\boxofsize#1% {\bgroup \sizeofbox\zeropoint \scratchdimen\zeropoint @@ -2191,7 +2191,7 @@ % \limitvbox % \limithbox -\unexpanded\def\limitatelines#1#2% size sentinel +\protected\def\limitatelines#1#2% size sentinel {\dowithnextbox {\scratchdimen#1\hsize \ifdim\wd\nextbox>\scratchdimen @@ -2202,7 +2202,7 @@ \unhbox\nextbox} \hbox} -\unexpanded\def\fittoptobaselinegrid % weg hier +\protected\def\fittoptobaselinegrid % weg hier {\dowithnextbox {\bgroup \par @@ -2231,7 +2231,7 @@ \setbox\fakedboxcursor\hpack {\vrule\s!width\zeropoint\s!height\zeropoint\s!depth\zeropoint} -\unexpanded\def\boxcursor % overloaded in core-vis +\protected\def\boxcursor % overloaded in core-vis {\iftraceboxplacement \bgroup \scratchdimen2\onepoint @@ -2248,21 +2248,21 @@ \copy\fakedboxcursor \fi} -\unexpanded\def\placedbox +\protected\def\placedbox {\iftraceboxplacement\ruledhbox\else\hbox\fi} \newdimen\boxoffset \newdimen\boxhdisplacement \newdimen\boxvdisplacement -\unexpanded\def\rightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbox_finish \placedbox} -\unexpanded\def\leftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbox_finish \placedbox} -\unexpanded\def\topbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_topbox_finish \placedbox} -\unexpanded\def\bottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_bottombox_finish \placedbox} -\unexpanded\def\lefttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_lefttopbox_finish \placedbox} -\unexpanded\def\righttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_righttopbox_finish \placedbox} -\unexpanded\def\leftbottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbottombox_finish \placedbox} -\unexpanded\def\rightbottombox{\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbottombox_finish\placedbox} +\protected\def\rightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbox_finish \placedbox} +\protected\def\leftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbox_finish \placedbox} +\protected\def\topbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_topbox_finish \placedbox} +\protected\def\bottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_bottombox_finish \placedbox} +\protected\def\lefttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_lefttopbox_finish \placedbox} +\protected\def\righttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_righttopbox_finish \placedbox} +\protected\def\leftbottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbottombox_finish \placedbox} +\protected\def\rightbottombox{\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbottombox_finish\placedbox} \let\topleftbox \lefttopbox \let\toprightbox \righttopbox @@ -2341,10 +2341,10 @@ \box\nextbox \egroup} -\unexpanded\def\middlebox {\hpack\bgroup\dowithnextboxcs\syst_boxes_middlebox_finish \placedbox} -\unexpanded\def\baselinemiddlebox{\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinemiddlebox_finish\placedbox} -\unexpanded\def\baselineleftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselineleftbox_finish \placedbox} -\unexpanded\def\baselinerightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinerightbox_finish \placedbox} +\protected\def\middlebox {\hpack\bgroup\dowithnextboxcs\syst_boxes_middlebox_finish \placedbox} +\protected\def\baselinemiddlebox{\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinemiddlebox_finish\placedbox} +\protected\def\baselineleftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselineleftbox_finish \placedbox} +\protected\def\baselinerightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinerightbox_finish \placedbox} \def\syst_boxes_middlebox_finish {\global\boxhdisplacement-.5\wd\nextbox @@ -2387,7 +2387,7 @@ %D %D Experimental, not yet frozen: -\unexpanded\def\lrtbbox#1#2#3#4% l r t b +\protected\def\lrtbbox#1#2#3#4% l r t b {\bgroup \dowithnextboxcontent {\advance\hsize-#1\advance\hsize-#2\relax @@ -2400,7 +2400,7 @@ %D %D See core-tbl.tex for an example of its usage: -\unexpanded\def\toplinebox +\protected\def\toplinebox {\dowithnextboxcs\syst_boxes_toplinebox_finish\tbox} \def\syst_boxes_toplinebox_finish @@ -2439,20 +2439,20 @@ \installcorenamespace {stackbox} \installcorenamespace {stacklst} -\unexpanded\def\setstackbox#1#2% +\protected\def\setstackbox#1#2% {\ifcsname\??stackbox#1:#2\endcsname\else \expandafter\newbox\csname\??stackbox#1:#2\endcsname \fi \global\setbox\csname\??stackbox#1:#2\endcsname\vbox} -\unexpanded\def\initializeboxstack#1% +\protected\def\initializeboxstack#1% {\def\docommand##1{\setstackbox{#1}{##1}{}}% \ifcsname\??stacklst#1\endcsname \expandafter\processcommacommand\expandafter[\lastnamedcs]\docommand \fi \letgvalueempty{\??stacklst#1}} -\unexpanded\def\savebox#1#2% stack name +\protected\def\savebox#1#2% stack name {% beware, \setxvalue defines the cs beforehand so we cannot use the % test inside the { } \ifcsname\??stacklst#1\endcsname @@ -2463,27 +2463,27 @@ \fi \setstackbox{#1}{#2}} -\unexpanded\def\flushbox#1#2% unwrapped +\protected\def\flushbox#1#2% unwrapped {\ifcsname\??stackbox#1:#2\endcsname \box\lastnamedcs \else \emptybox \fi} -\unexpanded\def\restorebox#1#2% unwrapped +\protected\def\restorebox#1#2% unwrapped {\ifcsname\??stackbox#1:#2\endcsname \copy\lastnamedcs \else \emptybox \fi} -\unexpanded\def\foundbox#1#2% wrapped +\protected\def\foundbox#1#2% wrapped {\vpack {\ifcsname\??stackbox#1:#2\endcsname \copy\lastnamedcs \fi}} -\unexpanded\def\doifelsebox#1#2% +\protected\def\doifelsebox#1#2% {\ifcsname\??stackbox#1:#2\endcsname \ifvoid\lastnamedcs \doubleexpandafter\secondoftwoarguments @@ -2503,11 +2503,11 @@ \newcount\c_syst_boxes_stack \let \b_syst_boxes_stack\relax -\unexpanded\def\syst_boxes_stack_allocate +\protected\def\syst_boxes_stack_allocate {\newbox\b_syst_boxes_stack \expandafter\let\csname\??boxstack\number\c_syst_boxes_stack\endcsname\b_syst_boxes_stack} -\unexpanded\def\syst_boxes_push#1#2% +\protected\def\syst_boxes_push#1#2% {\global\advance\c_syst_boxes_stack\plusone \expandafter\let\expandafter\b_syst_boxes_stack\csname\??boxstack\number\c_syst_boxes_stack\endcsname \ifx\b_syst_boxes_stack\relax % cheaper then csname check as in most cases it's defined @@ -2515,15 +2515,15 @@ \fi #1\setbox\b_syst_boxes_stack\box#2\relax} -\unexpanded\def\syst_boxes_pop#1#2% +\protected\def\syst_boxes_pop#1#2% {#1\setbox#2\box\csname\??boxstack\number\c_syst_boxes_stack\endcsname \global\advance\c_syst_boxes_stack\minusone} -\unexpanded\def\localpushbox {\syst_boxes_push\relax} -\unexpanded\def\localpopbox {\syst_boxes_pop \relax} +\protected\def\localpushbox {\syst_boxes_push\relax} +\protected\def\localpopbox {\syst_boxes_pop \relax} -\unexpanded\def\globalpushbox{\syst_boxes_push\global} -\unexpanded\def\globalpopbox {\syst_boxes_pop \global} +\protected\def\globalpushbox{\syst_boxes_push\global} +\protected\def\globalpopbox {\syst_boxes_pop \global} %D And here is a more modern one (not yet in i-*): %D @@ -2541,15 +2541,15 @@ %D \resetboxesincache{foo} %D \stoptyping -\unexpanded\def\putboxincache #1#2#3{\clf_putboxincache {#1}{#2}#3\relax} -\unexpanded\def\getboxfromcache #1#2#3{\clf_getboxfromcache {#1}{#2}#3\relax} -\unexpanded\def\doifelseboxincache #1#2{\clf_doifelseboxincache {#1}{#2}} -\unexpanded\def\copyboxfromcache #1#2#3{\clf_copyboxfromcache {#1}{#2}#3\relax} -\unexpanded\def\directboxfromcache #1#2{\clf_directboxfromcache {#1}{#2}} -\unexpanded\def\directcopyboxfromcache#1#2{\clf_directcopyboxfromcache{#1}{#2}} -\unexpanded\def\resetboxesincache #1{\clf_resetboxesincache {#1}} +\protected\def\putboxincache #1#2#3{\clf_putboxincache {#1}{#2}#3\relax} +\protected\def\getboxfromcache #1#2#3{\clf_getboxfromcache {#1}{#2}#3\relax} +\protected\def\doifelseboxincache #1#2{\clf_doifelseboxincache {#1}{#2}} +\protected\def\copyboxfromcache #1#2#3{\clf_copyboxfromcache {#1}{#2}#3\relax} +\protected\def\directboxfromcache #1#2{\clf_directboxfromcache {#1}{#2}} +\protected\def\directcopyboxfromcache#1#2{\clf_directcopyboxfromcache{#1}{#2}} +\protected\def\resetboxesincache #1{\clf_resetboxesincache {#1}} -\unexpanded\def\putnextboxincache#1#2% +\protected\def\putnextboxincache#1#2% {\dowithnextbox{\putboxincache{#1}{#2}\nextbox}} %D \macros @@ -2558,21 +2558,21 @@ %D While \type {\removedepth} removes the preceding depth, \type {\obeydepth} makes %D sure we have depth. Both macros leave the \type {\prevdepth} untouched. -\unexpanded\def\removedepth +\protected\def\removedepth {\ifvmode \ifdim\prevdepth>\zeropoint \kern-\prevdepth \fi \fi} -\unexpanded\def\obeydepth +\protected\def\obeydepth {\par % watch out for changes in math formulas \ifvmode\ifdim\prevdepth<\zeropoint\orelse\ifdim\prevdepth<\strutdp \kern\dimexpr\strutdp-\prevdepth\relax \prevdepth\strutdp \fi\fi} -\unexpanded\def\undepthed +\protected\def\undepthed {\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\hbox} %D \macros @@ -2580,10 +2580,10 @@ %D %D A funny (but rather stupid) one, plus a redefinition. -\unexpanded\def\removebottomthings +\protected\def\removebottomthings {\dorecurse\plusfive{\unskip\unkern\unpenalty}} -\unexpanded\def\removelastskip % \ifvmode the plain tex one \fi +\protected\def\removelastskip % \ifvmode the plain tex one \fi {\ifvmode\ifzeropt\lastskip\else\vskip-\lastskip\fi\fi} %D \macros @@ -2592,7 +2592,7 @@ %D This macro sets the dimensions of a box to those of a strut. Sort of obsolete so %D it will go away. -\unexpanded\def\makestrutofbox % not used +\protected\def\makestrutofbox % not used {\afterassignment\syst_boxes_makestrutofbox\c_boxes_register} \def\syst_boxes_makestrutofbox @@ -2611,8 +2611,8 @@ %D \hsmash{\raisebox{100pt}\hbox{test}} %D \stoptyping -\unexpanded\def\raisebox#1{\bgroup\afterassignment\syst_boxes_raise_indeed\scratchdimen#1} % so both 10pt and {10pt} is accepted -\unexpanded\def\lowerbox#1{\bgroup\afterassignment\syst_boxes_lower_indeed\scratchdimen#1} % so both 10pt and {10pt} is accepted +\protected\def\raisebox#1{\bgroup\afterassignment\syst_boxes_raise_indeed\scratchdimen#1} % so both 10pt and {10pt} is accepted +\protected\def\lowerbox#1{\bgroup\afterassignment\syst_boxes_lower_indeed\scratchdimen#1} % so both 10pt and {10pt} is accepted \def\syst_boxes_raise_indeed{\dowithnextboxcs\syst_boxes_raise_finish} \def\syst_boxes_lower_indeed{\dowithnextboxcs\syst_boxes_lower_finish} @@ -2633,7 +2633,7 @@ % vcenter in text, we kunnen vcenter overloaden -\unexpanded\def\halfwaybox +\protected\def\halfwaybox {\hpack\bgroup \dowithnextboxcs\syst_boxes_halfwaybox_finish\hbox} @@ -2642,7 +2642,7 @@ \lower.5\ht\nextbox\box\nextbox \egroup} -\unexpanded\def\depthonlybox +\protected\def\depthonlybox {\tpack\bgroup \dowithnextboxcs\syst_boxes_depthonlybox_finish\vbox} @@ -2667,7 +2667,7 @@ %D %D A not so well unhboxable box can be made with: -\unexpanded\def\frozenhbox +\protected\def\frozenhbox {\hpack\bgroup \dowithnextboxcs\syst_boxes_frozenhbox_finish\hbox} @@ -2683,11 +2683,11 @@ \installcorenamespace {box_x} \installcorenamespace {box_y} -\unexpanded\def\setboxllx #1#2{\expandafter\edef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\setboxlly #1#2{\expandafter\edef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} +\protected\def\setboxllx #1#2{\expandafter\edef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} +\protected\def\setboxlly #1#2{\expandafter\edef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\gsetboxllx#1#2{\expandafter\xdef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} -\unexpanded\def\gsetboxlly#1#2{\expandafter\xdef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} +\protected\def\gsetboxllx#1#2{\expandafter\xdef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}} +\protected\def\gsetboxlly#1#2{\expandafter\xdef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}} %def\getboxllx#1{\ifcsname\??box_x\number#1\endcsname\csname\??box_x\number#1\endcsname\else\zeropoint\fi} %def\getboxlly#1{\ifcsname\??box_y\number#1\endcsname\csname\??box_y\number#1\endcsname\else\zeropoint\fi} @@ -2710,7 +2710,7 @@ %D \shownextbox\vbox{\setupwhitespace[big]test\endgraf\thinrule} %D \stoptyping -\unexpanded\def\shownextbox % seldom used +\protected\def\shownextbox % seldom used {\dowithnextbox {\bgroup \showboxbreadth\maxdimen @@ -2722,7 +2722,7 @@ \interactionmode\scratchcounter \egroup}} -\unexpanded\def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>} +\protected\def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>} {\bgroup \ifhbox#1\relax \setbox\scratchboxtwo\emptybox @@ -2754,7 +2754,7 @@ %D \minimalhbox 100pt {test} %D \stoptyping -\unexpanded\def\minimalhbox#1#% +\protected\def\minimalhbox#1#% {\dowithnextbox {\bgroup \setbox\scratchbox\hpack#1{\hss}% @@ -2765,7 +2765,7 @@ %D A bit dirty: -\unexpanded\def\nodestostring#1#2% more tolerant for #2=\cs +\protected\def\nodestostring#1#2% more tolerant for #2=\cs {\begingroup \setbox\nextbox\hbox{#2}% \normalexpanded{\endgroup\edef\noexpand#1{\clf_boxtostring\nextbox}}} @@ -2796,7 +2796,7 @@ \let\getnaturalwd\clf_getnaturalwd % no intermediate \let\setnaturalwd\clf_setnaturalwd % no intermediate -\unexpanded\def\doifelserighttoleftinbox{\clf_doifelserighttoleftinbox} +\protected\def\doifelserighttoleftinbox{\clf_doifelserighttoleftinbox} \let\doifrighttoleftinboxelse\doifelserighttoleftinbox @@ -2805,23 +2805,23 @@ \definesystemattribute [runningtext] [public] %unexpanded\def\runninghbox{\hbox attr \runningtextattribute \plusone} % not yet in i-* -\unexpanded\def\runninghbox{\hbox attr \runningtextattribute \fontid\font} % not yet in i-* +\protected\def\runninghbox{\hbox attr \runningtextattribute \fontid\font} % not yet in i-* %D To complement lua (yet undocumented): -\unexpanded\def\beginhbox{\hbox\bgroup} \let\endhbox\egroup -\unexpanded\def\beginvbox{\vbox\bgroup} \let\endvbox\egroup -\unexpanded\def\beginvtop{\vtop\bgroup} \let\endvtop\egroup +\protected\def\beginhbox{\hbox\bgroup} \let\endhbox\egroup +\protected\def\beginvbox{\vbox\bgroup} \let\endvbox\egroup +\protected\def\beginvtop{\vtop\bgroup} \let\endvtop\egroup -\unexpanded\def\sethboxregister#1{\setbox#1\hbox} -\unexpanded\def\setvboxregister#1{\setbox#1\vbox} -\unexpanded\def\setvtopregister#1{\setbox#1\vtop} +\protected\def\sethboxregister#1{\setbox#1\hbox} +\protected\def\setvboxregister#1{\setbox#1\vbox} +\protected\def\setvtopregister#1{\setbox#1\vtop} -\unexpanded\def\flushboxregister#1{\box\numexpr#1\relax} +\protected\def\flushboxregister#1{\box\numexpr#1\relax} -\unexpanded\def\starthboxregister#1{\setbox#1\hbox\bgroup} \let\stophboxregister\egroup -\unexpanded\def\startvboxregister#1{\setbox#1\vbox\bgroup} \let\stopvboxregister\egroup -\unexpanded\def\startvtopregister#1{\setbox#1\vtop\bgroup} \let\stopvtopregister\egroup +\protected\def\starthboxregister#1{\setbox#1\hbox\bgroup} \let\stophboxregister\egroup +\protected\def\startvboxregister#1{\setbox#1\vbox\bgroup} \let\stopvboxregister\egroup +\protected\def\startvtopregister#1{\setbox#1\vtop\bgroup} \let\stopvtopregister\egroup %D For whatever third party package needs it: %D @@ -2837,7 +2837,7 @@ \installcorenamespace{localbox} -\unexpanded\def\newlocalbox#1% +\protected\def\newlocalbox#1% {\expandafter\let\expandafter#1\csname\??localbox\string#1\endcsname \ifx#1\relax \syst_aux_new_localbox#1% @@ -2849,26 +2849,26 @@ %D Who knows when this comes in handy: -\unexpanded\def\lastlinewidth{\dimexpr\clf_lastlinewidth\scaledpoint\relax} +\protected\def\lastlinewidth{\dimexpr\clf_lastlinewidth\scaledpoint\relax} %D Keep as reference: -% \unexpanded\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox} -% \unexpanded\def\tightvtop{\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop} +% \protected\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox} +% \protected\def\tightvtop{\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop} %D This one keeps dimensions and sets the shift field (and so it's more for testing %D than for real usage): -\unexpanded\def\shiftbox {\clf_shiftbox} -\unexpanded\def\vpackbox {\clf_vpackbox} -\unexpanded\def\hpackbox {\clf_hpackbox} -\unexpanded\def\vpackedbox{\clf_vpackedbox} -\unexpanded\def\hpackedbox{\clf_hpackedbox} +\protected\def\shiftbox {\clf_shiftbox} +\protected\def\vpackbox {\clf_vpackbox} +\protected\def\hpackbox {\clf_hpackbox} +\protected\def\vpackedbox{\clf_vpackedbox} +\protected\def\hpackedbox{\clf_hpackedbox} %D This one has been moved from a 2 decade old file. It makes something boxed %D sit on the baseline. -\unexpanded\def\linebox +\protected\def\linebox {\hpack\bgroup\dowithnextbox {\scratchdimen\dimexpr\dimexpr\htdp\nextbox-\lineheight\relax/2+\dp\strutbox\relax \setbox\nextbox\hpack{\lower\scratchdimen\box\nextbox}% @@ -2932,10 +2932,10 @@ % % \unprotect % -% \unexpanded\def\withwordsinstring#1#2% command str +% \protected\def\withwordsinstring#1#2% command str % {\ctxcommand{withwords(\!!bs#1\!!es,\!!bs#2\!!es)}} % -% \unexpanded\def\withwordsinfile#1#2% command name +% \protected\def\withwordsinfile#1#2% command name % {\ctxcommand{withwords(\!!bs#1\!!es,io.loaddata(resolvers.findfile("#2")))}} % % \protect diff --git a/tex/context/base/mkiv/supp-dir.mkiv b/tex/context/base/mkiv/supp-dir.mkiv index 277f2b7ca..e6c2a5869 100644 --- a/tex/context/base/mkiv/supp-dir.mkiv +++ b/tex/context/base/mkiv/supp-dir.mkiv @@ -18,19 +18,19 @@ \edef\??bdir{\ifdefined\bodydir bdir\else direction\fi} -\unexpanded\edef\naturalhbox {\hbox \??bdir\directionlefttoright} -\unexpanded\edef\naturalvbox {\vbox \??bdir\directionlefttoright} -\unexpanded\edef\naturalvtop {\vtop \??bdir\directionlefttoright} -\unexpanded\edef\naturalhpack {\hpack \??bdir\directionlefttoright} -\unexpanded\edef\naturalvpack {\vpack \??bdir\directionlefttoright} -\unexpanded\edef\naturaltpack {\tpack \??bdir\directionlefttoright} - -\unexpanded\edef\reversehbox {\hbox \??bdir\directionrighttoleft} -\unexpanded\edef\reversevbox {\vbox \??bdir\directionrighttoleft} -\unexpanded\edef\reversevtop {\vtop \??bdir\directionrighttoleft} -\unexpanded\edef\reversehpack {\hpack \??bdir\directionrighttoleft} -\unexpanded\edef\reversevpack {\vpack \??bdir\directionrighttoleft} -\unexpanded\edef\reversetpack {\tpack \??bdir\directionrighttoleft} +\protected\edef\naturalhbox {\hbox \??bdir\directionlefttoright} +\protected\edef\naturalvbox {\vbox \??bdir\directionlefttoright} +\protected\edef\naturalvtop {\vtop \??bdir\directionlefttoright} +\protected\edef\naturalhpack {\hpack \??bdir\directionlefttoright} +\protected\edef\naturalvpack {\vpack \??bdir\directionlefttoright} +\protected\edef\naturaltpack {\tpack \??bdir\directionlefttoright} + +\protected\edef\reversehbox {\hbox \??bdir\directionrighttoleft} +\protected\edef\reversevbox {\vbox \??bdir\directionrighttoleft} +\protected\edef\reversevtop {\vtop \??bdir\directionrighttoleft} +\protected\edef\reversehpack {\hpack \??bdir\directionrighttoleft} +\protected\edef\reversevpack {\vpack \??bdir\directionrighttoleft} +\protected\edef\reversetpack {\tpack \??bdir\directionrighttoleft} \ifdefined\bodydir \let\bodydir \undefined \let\normalbodydir \undefined @@ -47,7 +47,7 @@ \def\syst_direction_string#1{\ifcase#1=\plusone r2l\else l2r\fi} -\unexpanded\def\showdirsinmargin +\protected\def\showdirsinmargin {\normalexpanded{\inleft{\naturalhbox {\ttxx[\syst_direction_string\pardirection,\syst_direction_string\textdirection]}}}} diff --git a/tex/context/base/mkiv/supp-mat.mkiv b/tex/context/base/mkiv/supp-mat.mkiv index bb2488494..8f49ac254 100644 --- a/tex/context/base/mkiv/supp-mat.mkiv +++ b/tex/context/base/mkiv/supp-mat.mkiv @@ -53,7 +53,7 @@ % \let\normalstartdmath \Ustartdisplaymath % \let\normalstopdmath \Ustopdisplaymath -% \unexpanded\def\Ustartdisplaymath +% \protected\def\Ustartdisplaymath % {\ifinner % \ifhmode % \normalUstartmath @@ -67,7 +67,7 @@ % \let\Ustopdisplaymath\normalUstopdisplaymath % \fi} -\unexpanded\def\Ucheckedstartdisplaymath +\protected\def\Ucheckedstartdisplaymath {\ifinner \ifhmode \normalUstartmath @@ -93,16 +93,16 @@ \let\startdmath \Ustartdisplaymath % \Ucheckedstartdisplaymath \let\stopdmath \Ustopdisplaymath % \Ucheckedstopdisplaymath -\unexpanded\def\mathematics#1{\relax \ifmmode#1\else\normalstartimath#1\normalstopimath\fi} -\unexpanded\def\displaymath#1{\noindent \ifmmode#1\else\normalstartdmath#1\normalstopdmath\fi} -\unexpanded\def\inlinemath #1{\dontleavehmode\ifmmode#1\else\normalstartimath#1\normalstopimath\fi} -\unexpanded\def\textmath #1{\dontleavehmode\ifmmode#1\else\begingroup\everymath\emptytoks\normalstartimath#1\normalstopimath\endgroup\fi} % \mathsurround\zeropoint +\protected\def\mathematics#1{\relax \ifmmode#1\else\normalstartimath#1\normalstopimath\fi} +\protected\def\displaymath#1{\noindent \ifmmode#1\else\normalstartdmath#1\normalstopdmath\fi} +\protected\def\inlinemath #1{\dontleavehmode\ifmmode#1\else\normalstartimath#1\normalstopimath\fi} +\protected\def\textmath #1{\dontleavehmode\ifmmode#1\else\begingroup\everymath\emptytoks\normalstartimath#1\normalstopimath\endgroup\fi} % \mathsurround\zeropoint \let\m\mathematics \let\stopmathmode\relax -\unexpanded\def\startmathmode % nested variant +\protected\def\startmathmode % nested variant {\relax\ifmmode \begingroup \let\stopmathmode\endgroup @@ -111,7 +111,7 @@ \let\stopmathmode\normalstopimath \fi} -\unexpanded\def\nomathematics#1% +\protected\def\nomathematics#1% {\relax\ifmmode\hbox{#1}\else#1\fi} \let\math\mathematics @@ -126,13 +126,13 @@ \def\strc_formulas_stop_formula {\normalstopdmath } \fi -\unexpanded\def\displaymathematics#1{\relax\ifmmode#1\else\strc_formulas_start_formula{}#1\strc_formulas_stop_formula\fi} -\unexpanded\def\inlinemathematics {\dontleavehmode\mathematics} -\unexpanded\def\automathematics {\relax\ifhmode\expandafter\inlinemathematics\else\expandafter\displaymathematics\fi} +\protected\def\displaymathematics#1{\relax\ifmmode#1\else\strc_formulas_start_formula{}#1\strc_formulas_stop_formula\fi} +\protected\def\inlinemathematics {\dontleavehmode\mathematics} +\protected\def\automathematics {\relax\ifhmode\expandafter\inlinemathematics\else\expandafter\displaymathematics\fi} % better, esp when used in bTABLE ... eTABLE -\unexpanded\def\automathematics +\protected\def\automathematics {\relax \ifhmode \expandafter\inlinemathematics @@ -157,7 +157,7 @@ \def\dimensiontypeface {\tf} \def\dimensionhalfspace {\,} -\unexpanded\def\dimension#1% +\protected\def\dimension#1% {\pushmacro\dodimensionsignal \gdef\dodimensionsignal{\kern\dimensionsignal}% \ifzeropt\lastskip @@ -178,7 +178,7 @@ \dodimensionsignal \popmacro\dodimensionsignal} -\unexpanded\def\nodimension#1% +\protected\def\nodimension#1% {\unskip#1\glet\dodimensionsignal\relax} %D \macros @@ -193,7 +193,7 @@ %D %D \typebuffer \getbuffer -\unexpanded\def\cramped +\protected\def\cramped {\mathpalette\math_cramped} %D We force a cramped style by issuing a non||existing radical (box). @@ -294,9 +294,9 @@ %D Notice that \type {\clap{\cramped ... }} would also work, %D but it requires \TEX\ to typeset it arguments 16 times. -\unexpanded\def\crampedllap{\mathpalette\math_cramped_llap} -\unexpanded\def\crampedrlap{\mathpalette\math_cramped_rlap} -\unexpanded\def\crampedclap{\mathpalette\math_cramped_clap} +\protected\def\crampedllap{\mathpalette\math_cramped_llap} +\protected\def\crampedrlap{\mathpalette\math_cramped_rlap} +\protected\def\crampedclap{\mathpalette\math_cramped_clap} \def\math_cramped_llap#1#2{{}\dollap{\math_cramped #1{#2}}} \def\math_cramped_rlap#1#2{{}\dorlap{\math_cramped #1{#2}}} @@ -304,7 +304,7 @@ % experiment, not yet to be used -% \unexpanded\def\displaybreak +% \protected\def\displaybreak % {\ifhmode % \removeunwantedspaces % \ifcase\raggedstatus\hfill\fi diff --git a/tex/context/base/mkiv/supp-ran.mkiv b/tex/context/base/mkiv/supp-ran.mkiv index 59707836a..79efde79c 100644 --- a/tex/context/base/mkiv/supp-ran.mkiv +++ b/tex/context/base/mkiv/supp-ran.mkiv @@ -20,15 +20,15 @@ \unprotect -\unexpanded\def\getrandomcount #1#2#3{#1=\clf_getrandomnumber\numexpr#2\relax\numexpr#3\relax\relax} -\unexpanded\def\getrandomdimen #1#2#3{#1=\clf_getrandomdimen\dimexpr#2\relax\dimexpr#3\relax\scaledpoint\relax} -\unexpanded\def\getrandomnumber#1#2#3{\edef#1{\clf_getrandomnumber\numexpr#2\relax\numexpr#3\relax}} -\unexpanded\def\getrandomfloat #1#2#3{\edef#1{\clf_getrandomfloat\dimexpr#2\relax\dimexpr#3\relax}} -\unexpanded\def\setrandomseed #1{\clf_setrandomseed\numexpr#1\relax} -\unexpanded\def\getrandomseed #1{\edef#1{\clf_getrandomseed}} -\unexpanded\def\pushrandomseed {\clf_pushrandomseed} -\unexpanded\def\poprandomseed {\clf_poprandomseed} -\unexpanded\def\reuserandomseed {\clf_reuserandomseed} % within push/pop +\protected\def\getrandomcount #1#2#3{#1=\clf_getrandomnumber\numexpr#2\relax\numexpr#3\relax\relax} +\protected\def\getrandomdimen #1#2#3{#1=\clf_getrandomdimen\dimexpr#2\relax\dimexpr#3\relax\scaledpoint\relax} +\protected\def\getrandomnumber#1#2#3{\edef#1{\clf_getrandomnumber\numexpr#2\relax\numexpr#3\relax}} +\protected\def\getrandomfloat #1#2#3{\edef#1{\clf_getrandomfloat\dimexpr#2\relax\dimexpr#3\relax}} +\protected\def\setrandomseed #1{\clf_setrandomseed\numexpr#1\relax} +\protected\def\getrandomseed #1{\edef#1{\clf_getrandomseed}} +\protected\def\pushrandomseed {\clf_pushrandomseed} +\protected\def\poprandomseed {\clf_poprandomseed} +\protected\def\reuserandomseed {\clf_reuserandomseed} % within push/pop \let\freezerandomseed \pushrandomseed \let\defrostrandomseed\poprandomseed diff --git a/tex/context/base/mkiv/supp-vis.mkiv b/tex/context/base/mkiv/supp-vis.mkiv index 23dfcb5fa..f32f21ae0 100644 --- a/tex/context/base/mkiv/supp-vis.mkiv +++ b/tex/context/base/mkiv/supp-vis.mkiv @@ -97,7 +97,7 @@ %D unwanted results. We can therefore turn all those things %D off with \type{\dontinterfere}. -\unexpanded\def\dontinterfere % or maybe just forgetall +\protected\def\dontinterfere % or maybe just forgetall {\reseteverypar \parindent\zeropoint \parskip \zeropoint @@ -114,7 +114,7 @@ \ifdefined\dontcomplain \else - \unexpanded\def\dontcomplain + \protected\def\dontcomplain {\hbadness\plustenthousand \vbadness\plustenthousand \hfuzz \maxdimen @@ -316,7 +316,7 @@ \let\dowithruledbox\relax % hook -\unexpanded\def\makeruledbox#1% +\protected\def\makeruledbox#1% {\boxruleht\ht#1% \boxruledp\dp#1% \boxrulewd\wd#1% @@ -397,7 +397,7 @@ %D %D \ShowBufferedExampleBox -\unexpanded\def\ruledhbox +\protected\def\ruledhbox {\normalhbox\bgroup \dowithnextboxcs\supp_visualizers_hbox_finish\normalhbox} @@ -419,7 +419,7 @@ %D %D \ShowBufferedExampleBox -\unexpanded\def\ruledvbox +\protected\def\ruledvbox {\normalvbox\bgroup \dowithnextboxcs\supp_visualizers_vbox_finish\normalvbox} @@ -441,7 +441,7 @@ %D %D \ShowBufferedExampleBox -\unexpanded\def\ruledvtop +\protected\def\ruledvtop {\normalvtop\bgroup \dowithnextboxcs\supp_visualizers_vtop_finish\normalvtop} @@ -462,7 +462,7 @@ %D %D \ShowBufferedExampleBox -\unexpanded\def\ruledvcenter +\protected\def\ruledvcenter {\normalvbox\bgroup \dontinterfere \dowithnextboxcs\supp_visualizers_vcenter_finish\normalvbox} @@ -499,7 +499,7 @@ %D At the cost of some extra macros we can implement a %D variant that does not need the~\type{=}, but we stick to: -\unexpanded\def\ruledbox +\protected\def\ruledbox {\dowithnextboxcs\supp_visualizers_box_finish} \def\supp_visualizers_box_finish @@ -811,11 +811,11 @@ %D All five substitutions use the same auxiliary macro. Watch %D the positive first -- negative next approach. -\unexpanded\def\ruledhss {\doruledhfiller\normalhss \normalhfilneg {0}{0}} -\unexpanded\def\ruledhfil {\doruledhfiller\normalhfil \normalhfilneg {10}{-6}} -\unexpanded\def\ruledhfill {\doruledhfiller\normalhfill \normalhfillneg{18}{-14}} -\unexpanded\def\ruledhfilneg {\doruledhfiller\normalhfilneg \normalhfil {-6}{10}} -\unexpanded\def\ruledhfillneg{\doruledhfiller\normalhfillneg\normalhfill {-14}{18}} +\protected\def\ruledhss {\doruledhfiller\normalhss \normalhfilneg {0}{0}} +\protected\def\ruledhfil {\doruledhfiller\normalhfil \normalhfilneg {10}{-6}} +\protected\def\ruledhfill {\doruledhfiller\normalhfill \normalhfillneg{18}{-14}} +\protected\def\ruledhfilneg {\doruledhfiller\normalhfilneg \normalhfil {-6}{10}} +\protected\def\ruledhfillneg{\doruledhfiller\normalhfillneg\normalhfill {-14}{18}} %D \macros %D {ruledvss, @@ -889,11 +889,11 @@ %D Keep in mind that \type{\vfillneg} is not part of \PLAIN\ %D \TEX, but are mimmicked by a macro. -\unexpanded\def\ruledvss {\doruledvfiller\normalvss \normalvfilneg {2}} -\unexpanded\def\ruledvfil {\doruledvfiller\normalvfil \normalvfilneg {-4}} -\unexpanded\def\ruledvfill {\doruledvfiller\normalvfill \normalvfillneg{-12}} -\unexpanded\def\ruledvfilneg {\doruledvfiller\normalvfilneg \normalvfil {8}} -\unexpanded\def\ruledvfillneg{\doruledvfiller\normalvfillneg\normalvfill {16}} +\protected\def\ruledvss {\doruledvfiller\normalvss \normalvfilneg {2}} +\protected\def\ruledvfil {\doruledvfiller\normalvfil \normalvfilneg {-4}} +\protected\def\ruledvfill {\doruledvfiller\normalvfill \normalvfillneg{-12}} +\protected\def\ruledvfilneg {\doruledvfiller\normalvfilneg \normalvfil {8}} +\protected\def\ruledvfillneg{\doruledvfiller\normalvfillneg\normalvfill {16}} %D \macros %D {ruledhskip} @@ -999,7 +999,7 @@ \fi \egroup} -\unexpanded\def\ruledhskip +\protected\def\ruledhskip {\bgroup \afterassignment\supp_visualizers_hskip_indeed \scratchskip=} @@ -1149,7 +1149,7 @@ \fi \egroup} -\unexpanded\def\ruledvskip +\protected\def\ruledvskip {\bgroup \afterassignment\doruledvskip \scratchskip=} @@ -1228,7 +1228,7 @@ \afterwards\scratchskip \egroup} -\unexpanded\def\ruledhkern#1% +\protected\def\ruledhkern#1% {\bgroup \let\afterwards#1% \afterassignment\supp_visualizers_hkern_indeed @@ -1317,13 +1317,13 @@ \afterwards\scratchskip \egroup} -\unexpanded\def\ruledvkern#1% +\protected\def\ruledvkern#1% {\bgroup \let\afterwards#1\relax \afterassignment\supp_visualizers_vkern_indeed \scratchskip=} -\unexpanded\def\ruledkern +\protected\def\ruledkern {\ifvmode \expandafter\ruledvkern \else @@ -1334,7 +1334,7 @@ %D A a bit more \TEX nice solution is: %D %D \starttyping -%D \unexpanded\def\ruledkern% +%D \protected\def\ruledkern% %D {\csname ruled\ifvmode v\else h\fi kern\endcsname\normalkern} %D \stoptyping @@ -1370,7 +1370,7 @@ \spacefactor\scratchcounter \egroup} -\unexpanded\def\ruledhglue +\protected\def\ruledhglue {\bgroup \afterassignment\supp_visualizers_hglue_indeed\scratchskip=} @@ -1400,7 +1400,7 @@ \prevdepth\nextdepth \egroup} -\unexpanded\def\ruledvglue +\protected\def\ruledvglue {\bgroup \afterassignment\supp_visualizers_vglue_indeed\scratchskip=} @@ -1461,7 +1461,7 @@ %D %D \ShowBufferedExample -\unexpanded\def\ruledmkern +\protected\def\ruledmkern {\bgroup \afterassignment\supp_visualizers_mkern_indeed \scratchmuskip=} @@ -1485,7 +1485,7 @@ \flexibletrue \supp_visualizers_mkern_finish\normalmskip} -\unexpanded\def\ruledmskip +\protected\def\ruledmskip {\bgroup \afterassignment\supp_visualizers_mskip_indeed \scratchmuskip=} @@ -1589,7 +1589,7 @@ \fi}% \smashbox#1} -\unexpanded\def\ruledhpenalty +\protected\def\ruledhpenalty {\bgroup \afterassignment\supp_visualizers_hpenalty_indeed \scratchcounter=} @@ -1639,7 +1639,7 @@ %D %D \ShowBufferedExample -\unexpanded\def\ruledvpenalty +\protected\def\ruledvpenalty {\bgroup \afterassignment\supp_visualizers_vpenalty_indeed \scratchcounter=} @@ -1682,7 +1682,7 @@ %D This comes together in: -\unexpanded\def\ruledpenalty +\protected\def\ruledpenalty {\ifvmode \expandafter\ruledvpenalty \else @@ -1698,7 +1698,7 @@ %D For those who want to manipulate the visual cues in detail, %D we have grouped them. -\unexpanded\def\showfils +\protected\def\showfils {\showingcompositiontrue \let\hss \ruledhss \let\hfil \ruledhfil @@ -1711,7 +1711,7 @@ \let\vfilneg \ruledvfilneg \let\vfillneg \ruledvfillneg} -\unexpanded\def\dontshowfils +\protected\def\dontshowfils {\let\hss \normalhss \let\hfil \normalhfil \let\hfill \normalhfill @@ -1723,7 +1723,7 @@ \let\vfilneg \normalvfilneg \let\vfillneg \normalvfillneg} -\unexpanded\def\showboxes +\protected\def\showboxes {\showingcompositiontrue \baselineruletrue \let\hbox \ruledhbox @@ -1731,13 +1731,13 @@ \let\vtop \ruledvtop \let\vcenter \ruledvcenter} -\unexpanded\def\dontshowboxes +\protected\def\dontshowboxes {\let\hbox \normalhbox \let\vbox \normalvbox \let\vtop \normalvtop \let\vcenter \normalvcenter} -\unexpanded\def\showskips +\protected\def\showskips {\showingcompositiontrue \let\hskip \ruledhskip \let\vskip \ruledvskip @@ -1747,7 +1747,7 @@ \let\hglue \ruledhglue \let\vglue \ruledvglue} -\unexpanded\def\dontshowskips +\protected\def\dontshowskips {\let\hskip \normalhskip \let\vskip \normalvskip \let\kern \normalkern @@ -1756,11 +1756,11 @@ \let\hglue \normalhglue \let\vglue \normalvglue} -\unexpanded\def\showpenalties +\protected\def\showpenalties {\showingcompositiontrue \let\penalty \ruledpenalty} -\unexpanded\def\dontshowpenalties +\protected\def\dontshowpenalties {\let\penalty \normalpenalty} %D \macros @@ -1787,7 +1787,7 @@ \newif\ifshowingcomposition -\unexpanded\def\showcomposition +\protected\def\showcomposition {\ifshowingcomposition \showfils \showboxes @@ -1795,7 +1795,7 @@ \showpenalties \fi} -\unexpanded\def\dontshowcomposition +\protected\def\dontshowcomposition {\ifshowingcomposition \dontshowfils \dontshowboxes @@ -1829,7 +1829,7 @@ \def\defaulttestrulewidth{.02\bodyfontsize} \fi -\unexpanded\def\showmakeup +\protected\def\showmakeup {\testrulewidth\defaulttestrulewidth \showingcompositiontrue \showcomposition} diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 824590d9e..df74fb44f 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -47,7 +47,7 @@ %D code. %D %D \starttyping -%D \unexpanded\def\somecommand{... ... ...} +%D \protected\def\somecommand{... ... ...} %D \stoptyping %D %D This overloads the \ETEX\ primitive but as we already had an \MKII\ solution we @@ -86,7 +86,7 @@ \fi -\unexpanded\def\installsystemnamespace#1% maybe move this to syst-ini +\protected\def\installsystemnamespace#1% maybe move this to syst-ini {\ifcsname ??#1\endcsname \writestatus\m!system{duplicate system namespace '#1'}\wait \else @@ -198,10 +198,10 @@ \let\m_syst_helpers_expanded\empty -\unexpanded\def\expanded#1% +\protected\def\expanded#1% {\xdef\m_syst_helpers_expanded{\noexpand#1}\m_syst_helpers_expanded} -\unexpanded\def\startexpanded#1\stopexpanded +\protected\def\startexpanded#1\stopexpanded {\xdef\m_syst_helpers_expanded{#1}\m_syst_helpers_expanded} \let\stopexpanded\relax @@ -296,13 +296,13 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsenextchar#1#2#3% #1 should not be {} ! +\protected\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 {} ! +\protected\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% @@ -343,13 +343,13 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsenextoptional#1#2% +\protected\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) +\protected\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 @@ -360,14 +360,14 @@ % fails on assignments % -% \unexpanded\def\doifelsenextoptional {\afterassignment\doifelsenextoptional_n \def\m_syst_action_yes} -% \def\doifelsenextoptional_n {\afterassignment\doifelsenextoptional_n_n\def\m_syst_action_nop} -% \def\doifelsenextoptional_n_n {\let\if_next_blank_space_token\iffalse +% \protected\def\doifelsenextoptional {\afterassignment\doifelsenextoptional_n \def\m_syst_action_yes} +% \def\doifelsenextoptional_n {\afterassignment\doifelsenextoptional_n_n\def\m_syst_action_nop} +% \def\doifelsenextoptional_n_n {\let\if_next_blank_space_token\iffalse % \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} % -% \unexpanded\def\doifelsenextoptionalcs {\afterassignment\doifelsenextoptionalcs_n \let\m_syst_action_yes} -% \def\doifelsenextoptionalcs_n {\afterassignment\doifelsenextoptionalcs_n_n\let\m_syst_action_nop} -% \def\doifelsenextoptionalcs_n_n{\let\if_next_blank_space_token\iffalse +% \protected\def\doifelsenextoptionalcs {\afterassignment\doifelsenextoptionalcs_n \let\m_syst_action_yes} +% \def\doifelsenextoptionalcs_n {\afterassignment\doifelsenextoptionalcs_n_n\let\m_syst_action_nop} +% \def\doifelsenextoptionalcs_n_n{\let\if_next_blank_space_token\iffalse % \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} \let\syst_helpers_next_bgroup_character_token\bgroup @@ -386,13 +386,13 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsenextbgroup#1#2% +\protected\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% +\protected\def\doifelsenextbgroupcs#1#2% {\let\m_syst_action_yes#1% \let\m_syst_action_nop#2% \let\if_next_blank_space_token\iffalse @@ -417,7 +417,7 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsenextparenthesis#1#2% +\protected\def\doifelsenextparenthesis#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% \let\if_next_blank_space_token\iffalse @@ -434,12 +434,12 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsefastoptionalcheck#1#2% +\protected\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 +\protected\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} @@ -455,7 +455,7 @@ %D {a few lines later} %D \stoptyping -% \unexpanded\def\assumelongusagecs#1% +% \protected\def\assumelongusagecs#1% % {\let\m_syst_action#1% % \futurelet\nexttoken\syst_helpers_ignore_par_character} % @@ -476,7 +476,7 @@ % \def\syst_helpers_ignore_par_partoken % {\afterassignment\m_syst_action\let\nexttoken} -\unexpanded\def\assumelongusagecs#1% +\protected\def\assumelongusagecs#1% {\let\m_syst_action#1% \futurelet\nexttoken\syst_helpers_ignore_spacing} @@ -590,12 +590,12 @@ \def\undefinevalue#1{\expandafter\let \csname#1\endcsname\undefined} \def\ignorevalue#1#2{\expandafter\let \csname#1\endcsname\empty} -\def\setuvalue #1{\normalprotected\expandafter \def\csname#1\endcsname} -\def\setuevalue #1{\normalprotected\expandafter\edef\csname#1\endcsname} -\def\setugvalue #1{\normalprotected\expandafter\gdef\csname#1\endcsname} -\def\setuxvalue #1{\normalprotected\expandafter\xdef\csname#1\endcsname} +\def\setuvalue #1{\protected\expandafter \def\csname#1\endcsname} +\def\setuevalue #1{\protected\expandafter\edef\csname#1\endcsname} +\def\setugvalue #1{\protected\expandafter\gdef\csname#1\endcsname} +\def\setuxvalue #1{\protected\expandafter\xdef\csname#1\endcsname} -\unexpanded\def\getuvalue#1{\csname#1\endcsname} +\protected\def\getuvalue#1{\csname#1\endcsname} %D \macros %D {globallet,glet} @@ -670,13 +670,13 @@ %D {\undefined}! In \ETEX\ we have \type {\ifcsname} and that way of testing on %D existance is not the same as the one described here. Therefore we introduce: -\unexpanded\def\letbeundefined#1% potential stack buildup when used \global +\protected\def\letbeundefined#1% potential stack buildup when used \global {\expandafter\let\csname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue -\unexpanded\def\localundefine#1% conditional +\protected\def\localundefine#1% conditional {\ifcsname#1\endcsname\expandafter\let\csname#1\endcsname\undefined\fi} -\unexpanded\def\globalundefine#1% conditional +\protected\def\globalundefine#1% conditional {\ifcsname#1\endcsname\expandafter\glet\csname#1\endcsname\undefined\fi} %D Beware, being \type {\undefined} in \ETEX\ means that the macro {\em is} defined! @@ -685,7 +685,7 @@ %D behavior in text and math mode, which was due to this grouping subtilities. We %D therefore decided to use \type{\begingroup} instead of \type{\bgroup}. -\unexpanded\def\doifelsealldefined#1% +\protected\def\doifelsealldefined#1% {\begingroup \donetrue % we could use a reserved one and avoid the group \processcommalist[#1]\syst_helpers_do_if_all_defined_else @@ -720,7 +720,7 @@ %D \doifelse {string1} {string2} {then ...}{else ...} %D \stoptyping -\unexpanded\def\doif#1#2% +\protected\def\doif#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -729,7 +729,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnot#1#2% +\protected\def\doifnot#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -738,7 +738,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelse#1#2% +\protected\def\doifelse#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -760,7 +760,7 @@ %D %D This time, the string is not expanded. -\unexpanded\def\doifelseempty#1% +\protected\def\doifelseempty#1% {\def\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments @@ -770,7 +770,7 @@ \let\doifemptyelse\doifelseempty -\unexpanded\def\doifempty#1% +\protected\def\doifempty#1% {\def\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\firstofoneargument @@ -778,7 +778,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotempty#1% +\protected\def\doifnotempty#1% {\def\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument @@ -835,7 +835,7 @@ % \def\syst_helpers_re_do_if_in_set {\expandafter\syst_helpers_do_check_if_item_in_set \m_syst_string_two,],\relax} % \def\syst_helpers_re_do_if_not_in_set {\expandafter\syst_helpers_do_check_if_item_not_in_set \m_syst_string_two,],\relax} % -% \unexpanded\def\doifelseinset#1% make this two step too +% \protected\def\doifelseinset#1% make this two step too % {\edef\m_syst_string_one{#1}% % \ifx\m_syst_string_one\empty % \expandafter\thirdofthreearguments @@ -853,7 +853,7 @@ % \expandafter\syst_helpers_re_do_if_in_set_else % \fi} % -% \unexpanded\def\doifinset#1% +% \protected\def\doifinset#1% % {\edef\m_syst_string_one{#1}% % \ifx\m_syst_string_one\empty % \expandafter\gobbletwoarguments @@ -869,7 +869,7 @@ % \expandafter\syst_helpers_re_do_if_in_set % \fi} % -% \unexpanded\def\doifnotinset#1% +% \protected\def\doifnotinset#1% % {\edef\m_syst_string_one{#1}% % \ifx\m_syst_string_one\empty % \expandafter\secondoftwoarguments @@ -951,9 +951,9 @@ % \expandafter\syst_helpers_do_check_if_item_not_in_set % \fi} -\unexpanded\def\doifelseinset#1#2{\clf_doifelseinset{#1}{#2}} -\unexpanded\def\doifinset #1#2{\clf_doifinset {#1}{#2}} -\unexpanded\def\doifnotinset #1#2{\clf_doifnotinset {#1}{#2}} +\protected\def\doifelseinset#1#2{\clf_doifelseinset{#1}{#2}} +\protected\def\doifinset #1#2{\clf_doifinset {#1}{#2}} +\protected\def\doifnotinset #1#2{\clf_doifnotinset {#1}{#2}} % \let\firstinset \clf_firstinset \let\doifinsetelse\doifelseinset @@ -1042,15 +1042,15 @@ % \fi\fi % #1#2} -% \unexpanded\def\doifelsecommon{\syst_helpers_do_do_if_common_else\firstoftwoarguments\secondoftwoarguments} -% \unexpanded\def\doifcommon {\syst_helpers_do_do_if_common_else\firstofoneargument \gobbleoneargument } -% \unexpanded\def\doifnotcommon {\syst_helpers_do_do_if_common_else\gobbleoneargument \firstofoneargument } +% \protected\def\doifelsecommon{\syst_helpers_do_do_if_common_else\firstoftwoarguments\secondoftwoarguments} +% \protected\def\doifcommon {\syst_helpers_do_do_if_common_else\firstofoneargument \gobbleoneargument } +% \protected\def\doifnotcommon {\syst_helpers_do_do_if_common_else\gobbleoneargument \firstofoneargument } % % \let\doifcommonelse\doifelsecommon -\unexpanded\def\doifelsecommon#1#2{\clf_doifelsecommon{#1}{#2}} -\unexpanded\def\doifcommon #1#2{\clf_doifcommon {#1}{#2}} -\unexpanded\def\doifnotcommon #1#2{\clf_doifnotcommon {#1}{#2}} +\protected\def\doifelsecommon#1#2{\clf_doifelsecommon{#1}{#2}} +\protected\def\doifcommon #1#2{\clf_doifcommon {#1}{#2}} +\protected\def\doifnotcommon #1#2{\clf_doifnotcommon {#1}{#2}} \let\doifcommonelse\doifelsecommon @@ -1122,7 +1122,7 @@ %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}]}. -\unexpanded\def\processcommalist[% +\protected\def\processcommalist[% {\futurelet\nexttoken\syst_helpers_do_check_comma_item} \def\syst_helpers_do_check_comma_item @@ -1151,13 +1151,13 @@ %D One way of quitting a commalist halfway is: -\unexpanded\def\quitcommalist +\protected\def\quitcommalist {\begingroup\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_comma_list} \def\syst_helpers_do_quit_comma_list#1]% {\endgroup} -\unexpanded\def\quitprevcommalist +\protected\def\quitprevcommalist {\begingroup\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_prev_comma_list} \def\syst_helpers_do_quit_prev_comma_list#1]% @@ -1208,7 +1208,7 @@ %D Commands that are part of the list are expanded, so the use of this macro has its %D limits. -\unexpanded\def\processcommacommand[#1]% +\protected\def\processcommacommand[#1]% {\normalexpanded{\processcommalist[#1]}} %D The argument to \type{\command} is not delimited. Because we often use \type {[]} @@ -1224,7 +1224,7 @@ %D \def\command[#1]{... #1 ...} %D \stoptyping -\unexpanded\def\processcommalistwithparameters[#1]#2% +\protected\def\processcommalistwithparameters[#1]#2% {\def\syst_helpers_do_process_comma_list_with_parameters##1{#2[##1]}% \processcommalist[#1]\syst_helpers_do_process_comma_list_with_parameters} @@ -1235,11 +1235,11 @@ \let\syst_helpers_comma_list_step\relax -\unexpanded\def\startprocesscommalist[#1]#2\stopprocesscommalist +\protected\def\startprocesscommalist[#1]#2\stopprocesscommalist {\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}% \processcommalist[#1]\syst_helpers_comma_list_step} -\unexpanded\def\startprocesscommacommand[#1]#2\stopprocesscommacommand +\protected\def\startprocesscommacommand[#1]#2\stopprocesscommacommand {\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}% \normalexpanded{\processcommalist[#1]}\syst_helpers_comma_list_step} @@ -1287,7 +1287,7 @@ % obsolete: \def\expandactions{\let\expandedaction\edef} \expandactions (see mkii) -\unexpanded\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% {\edef\m_syst_string_two{#1}% \ifx\m_syst_string_two\s!default \let\commalistelement\empty @@ -1296,7 +1296,7 @@ % met \quitcommalist tot meer dan 25\% sneller -\unexpanded\def\syst_helpers_do_compare_process_action_b[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_b[#1=>#2][#3]% {\edef\m_syst_string_two{#1}% \ifx\m_syst_string_one\m_syst_string_two \def\commalistelement{#3}% @@ -1307,7 +1307,7 @@ #2% \fi\fi} -\unexpanded\def\processaction[#1]#2[% +\protected\def\processaction[#1]#2[% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \let\syst_helpers_do_compare_process_action\syst_helpers_do_compare_process_action_a @@ -1317,7 +1317,7 @@ \edef\syst_helpers_do_process_action##1{\syst_helpers_do_compare_process_action[##1][#1]}% expands #1 \processnextcommalist\relax\relax\syst_helpers_do_process_action[} -\unexpanded\def\syst_helpers_do_compare_process_action_c[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_c[#1=>#2][#3]% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#3}% \ifx\m_syst_string_one\m_syst_string_two @@ -1332,7 +1332,7 @@ \fi \fi} -\unexpanded\def\processfirstactioninset[#1]% +\protected\def\processfirstactioninset[#1]% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\processaction @@ -1341,13 +1341,13 @@ \fi [#1]} -\unexpanded\def\syst_helpers_process_first_action_in_set_indeed[#1]#2[#3]% +\protected\def\syst_helpers_process_first_action_in_set_indeed[#1]#2[#3]% {\def\syst_helpers_do_process_action##1% {\def\syst_helpers_do_do_process_action####1{\syst_helpers_do_compare_process_action_c[####1][##1]}% \processcommalist[#3]\syst_helpers_do_do_process_action}% \normalexpanded{\processcommalist[#1]}\syst_helpers_do_process_action} -\unexpanded\def\syst_helpers_do_compare_process_action_d[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_d[#1=>#2][#3]% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#3}% \ifx\m_syst_string_one\m_syst_string_two @@ -1364,10 +1364,10 @@ \installsystemnamespace{nextactionlevel} -\unexpanded\def\syst_helpers_do_process_all_actions_in_set +\protected\def\syst_helpers_do_process_all_actions_in_set {\csname\??nextactionlevel\the\processlevel\endcsname} -\unexpanded\def\processallactionsinset[#1]% +\protected\def\processallactionsinset[#1]% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\processaction @@ -1376,7 +1376,7 @@ \fi [#1]} -\unexpanded\def\syst_helpers_process_all_actions_in_set_indeed[#1]#2[#3]% +\protected\def\syst_helpers_process_all_actions_in_set_indeed[#1]#2[#3]% {\advance\processlevel \plusone \expandafter\def\csname\??nextactionlevel\the\processlevel\endcsname##1% {\def\syst_helpers_do_do_process_action####1{\syst_helpers_do_compare_process_action_d[####1][##1]}% @@ -1386,7 +1386,7 @@ %D These macros use: -\unexpanded\def\processnextcommalist#1#2#3[#4#5]% +\protected\def\processnextcommalist#1#2#3[#4#5]% {#1% \let\nexttoken#4% \global\advance\commalevel \plusone @@ -1412,10 +1412,10 @@ \let\firstcharacter \empty \let\remainingcharacters\empty -\unexpanded\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}} -\unexpanded\def\doifelsefirstchar #1#2{\clf_doifelsefirstchar{#1}{#2}} -\unexpanded\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}} -\unexpanded\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}} +\protected\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}} +\protected\def\doifelsefirstchar #1#2{\clf_doifelsefirstchar{#1}{#2}} +\protected\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}} +\protected\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}} \let\doiffirstcharelse\doifelsefirstchar @@ -1430,7 +1430,7 @@ \let\m_syst_sub_string\empty -\unexpanded\def\doifelseinstring#1% +\protected\def\doifelseinstring#1% {\edef\m_syst_sub_string{#1}% expand #1 here \ifx\m_syst_sub_string\empty \expandafter\thirdofthreearguments @@ -1440,14 +1440,14 @@ \let\doifinstringelse\doifelseinstring -\unexpanded\def\syst_helpers_do_if_in_string_else_indeed#1% +\protected\def\syst_helpers_do_if_in_string_else_indeed#1% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifinstring#1%% +\protected\def\doifinstring#1%% {\edef\m_syst_sub_string{#1}% expand #1 here \ifx\m_syst_sub_string\empty \expandafter\gobbletwoarguments @@ -1455,14 +1455,14 @@ \expandafter\syst_helpers_do_if_in_string_indeed \fi} -\unexpanded\def\syst_helpers_do_if_in_string_indeed#1% +\protected\def\syst_helpers_do_if_in_string_indeed#1% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotinstring#1%% +\protected\def\doifnotinstring#1%% {\edef\m_syst_sub_string{#1}% expand #1 here \ifx\m_syst_sub_string\empty %\expandafter\gobbletwoarguments @@ -1471,7 +1471,7 @@ \expandafter\syst_helpers_do_if_not_in_string_indeed \fi} -\unexpanded\def\syst_helpers_do_if_not_in_string_indeed#1% +\protected\def\syst_helpers_do_if_not_in_string_indeed#1% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\gobbleoneargument \else @@ -1480,7 +1480,7 @@ % replaces prev -\unexpanded\def\syst_helpers_do_if_in_string_else#1#2% ##2 can be {abc} +\protected\def\syst_helpers_do_if_in_string_else#1#2% ##2 can be {abc} {\expandafter\def\expandafter\syst_helpers_do_do_if_in_string_else \expandafter##\expandafter1#1##2##3^^^^0004{\unless\if##2@}% expand #1 here \expandafter\syst_helpers_do_do_if_in_string_else\normalexpanded{#2#1}@@^^^^0004} % expand #2 here @@ -1496,12 +1496,12 @@ %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% +\protected\def\syst_helpers_do_if_in_csname_else#1#2% {\def\syst_helpers_do_do_if_in_csname_else##1#1##2##3^^^^0004% {\unless\if##2@}% \expandafter\syst_helpers_do_do_if_in_csname_else#2#1@@^^^^0004} -\unexpanded\def\doifelseincsname#1#2% +\protected\def\doifelseincsname#1#2% {\normalexpanded{\syst_helpers_do_if_in_csname_else{#1}}{#2}% \expandafter\firstoftwoarguments \else @@ -1559,7 +1559,7 @@ \def\percentdimen#1#2% dimen percentage (with %) {\dimexpr\clf_percentageof{#2}\dimexpr#1\relax} -\unexpanded\def\setpercentdimen#1#2% dimen percentage (with %) +\protected\def\setpercentdimen#1#2% dimen percentage (with %) {#1=\clf_percentageof{#2}\dimexpr#1\relax} %D \macros @@ -1587,7 +1587,7 @@ %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 +\protected\def\makerawcommalist[#1]#2% use \processnext ... here {\def\syst_helpers_do_make_raw_comma_list##1% we don't expand ##1 {\ifx#2\empty \def#2{##1}% @@ -1603,28 +1603,28 @@ \expandafter\syst_helpers_raw_process_comma_item \fi#2} -\unexpanded\def\rawprocesscommalist[#1]#2% accepteert ook [\cs] +\protected\def\rawprocesscommalist[#1]#2% accepteert ook [\cs] {\global\advance\commalevel \plusone \expandafter\let\csname\??nextcommalevel\the\commalevel\endcsname#2% \expandafter\syst_helpers_raw_process_comma_item#1,],% \relax \global\advance\commalevel \minusone } -\unexpanded\def\rawprocesscommacommand[#1]% not really needed +\protected\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 +\protected\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] +\protected\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] +\protected\def\fastprocesscommacommand[#1]#2% accepteert ook [\cs] {\let\syst_helpers_fast_process_comma_command#2% \normalexpanded{\syst_helpers_fast_process_comma_item#1},],}% \relax @@ -1633,7 +1633,7 @@ \def\m_syst_two_commas{,,} -\unexpanded\def\rawdoifelseinset#1% +\protected\def\rawdoifelseinset#1% {\edef\m_syst_sub_string{,#1,}% expand #1 here \ifx\m_syst_sub_string\m_syst_two_commas \expandafter\thirdofthreearguments @@ -1643,14 +1643,14 @@ \let\rawdoifinsetelse\rawdoifelseinset -\unexpanded\def\syst_helpers_raw_do_if_in_set_else#1% +\protected\def\syst_helpers_raw_do_if_in_set_else#1% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{,#1,}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\rawdoifinset#1% +\protected\def\rawdoifinset#1% {\edef\m_syst_sub_string{,#1,}% expand #1 here \ifx\m_syst_sub_string\m_syst_two_commas \expandafter\gobbletwoarguments @@ -1658,7 +1658,7 @@ \expandafter\syst_helpers_raw_do_if_in_set \fi} -\unexpanded\def\syst_helpers_raw_do_if_in_set#1%% +\protected\def\syst_helpers_raw_do_if_in_set#1%% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{,#1,}% \expandafter\firstofoneargument \else @@ -1674,7 +1674,7 @@ \fi}% \syst_helpers_do_do_raw_process_action,#2,#1=>,@^^^^0004} -\unexpanded\def\rawprocessaction[#1]#2[#3]% +\protected\def\rawprocessaction[#1]#2[#3]% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{undefined}% better \!!undefined \let\m_syst_helpers_process_action\m_syst_string_two @@ -1764,10 +1764,10 @@ %D will redefine this macro later on, when a more advanced message mechanism is %D implemented. -\unexpanded\def\showassignerror#1#2% +\protected\def\showassignerror#1#2% {\writestatus{setup}{missing or ungrouped '=' after '#1' in line #2}} -\unexpanded\def\doassignempty[#1][#2=#3]% +\protected\def\doassignempty[#1][#2=#3]% {\ifcsname#1#2\endcsname\else\dosetvalue{#1}{#2}{#3}\fi} %D \macros @@ -1837,15 +1837,15 @@ \let\currentvalue\empty -\unexpanded\def\getparameters {\dogetparameters\dosetvalue} -\unexpanded\def\geteparameters {\dogetparameters\dosetevalue} -\unexpanded\def\getgparameters {\dogetparameters\dosetgvalue} -\unexpanded\def\getxparameters {\dogetparameters\dosetxvalue} -\unexpanded\def\forgetparameters{\dogetparameters\doignorevalue} +\protected\def\getparameters {\dogetparameters\dosetvalue} +\protected\def\geteparameters {\dogetparameters\dosetevalue} +\protected\def\getgparameters {\dogetparameters\dosetgvalue} +\protected\def\getxparameters {\dogetparameters\dosetxvalue} +\protected\def\forgetparameters{\dogetparameters\doignorevalue} \let\getexpandedparameters\geteparameters -\unexpanded\def\dogetparameters#1[#2]#3[#4% +\protected\def\dogetparameters#1[#2]#3[#4% {\if\noexpand#4]% \expandafter\gobbleoneargument \else @@ -1897,9 +1897,9 @@ \let\syst_helpers_get_parameters_assign_indeed\syst_helpers_get_parameters_assign_normal -\unexpanded\def\doassign [#1][#2]{\let\setsomevalue\dosetvalue \syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} -\unexpanded\def\doeassign [#1][#2]{\let\setsomevalue\dosetevalue \syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} -\unexpanded\def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} +\protected\def\doassign [#1][#2]{\let\setsomevalue\dosetvalue \syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} +\protected\def\doeassign [#1][#2]{\let\setsomevalue\dosetevalue \syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} +\protected\def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} %D \macros %D {processassignmentlist,processassignmentcommand, @@ -1915,18 +1915,18 @@ %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] +\protected\def\processassignmentlist[#1]#2% #2 == \command{key}{value] {\def\syst_helpers_process_assignment_entry##1{#2}% {##2}{##3} % namespace is ignored \dogetparameters\syst_helpers_process_assignment_entry[][#1]} -\unexpanded\def\processassignmentcommand[#1]% +\protected\def\processassignmentcommand[#1]% {\normalexpanded{\processassignmentlist[#1]}} -\unexpanded\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist +\protected\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% \processassignmentlist[#1]\currentassignmentlistcommand} -\unexpanded\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand +\protected\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% \normalexpanded{\processassignmentlist[#1]}\currentassignmentlistcommand} @@ -1980,7 +1980,7 @@ \let\syst_helpers_get_parameters\syst_helpers_get_parameters_normal % ** -\unexpanded\def\expandparameters +\protected\def\expandparameters {\let\syst_helpers_get_parameters\syst_helpers_get_parameters_expanded} %D \macros @@ -1993,7 +1993,7 @@ %D \getemptyparameters [label] [...=...,...=...] %D \stoptyping -\unexpanded\def\getemptyparameters[#1]#2[#3]% +\protected\def\getemptyparameters[#1]#2[#3]% {\def\syst_helpers_get_empty_parameters##1{\doassignempty[#1][##1]}% \processcommalist[#3]\syst_helpers_get_empty_parameters} @@ -2026,7 +2026,7 @@ %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]% +\protected\def\copyparameters[#1]#2[#3]#4[#5]% {\doifnot{#1}{#3} {\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#3}}% ##1 \processcommalist[#5]\syst_helpers_copy_parameter}} @@ -2049,7 +2049,7 @@ \def\syst_helpers_check_parameters#1=#2#3^^^^0004% {\if#2^^^^0003\parametersfalse\else\parameterstrue\fi} -\unexpanded\def\checkparameters[#1]% +\protected\def\checkparameters[#1]% {\syst_helpers_check_parameters#1=^^^^0003^^^^0003^^^^0004} %D \macros @@ -2086,7 +2086,7 @@ \def\syst_helpers_get_comma_list_size#1% {\advance\commalistcounter\plusone} -\unexpanded\def\getcommalistsize#1]% don't loose [{#1}] +\protected\def\getcommalistsize#1]% don't loose [{#1}] {\commalistcounter\zerocount \processcommalist#1]\syst_helpers_get_comma_list_size % was [{#1}] \edef\commalistsize{\the\commalistcounter}} @@ -2096,7 +2096,7 @@ % \scratchtoks\expandafter{\expandafter[\commacommand]}% % \expandafter\getcommalistsize\the\scratchtoks } -\unexpanded\def\getcommacommandsize[#1]% +\protected\def\getcommacommandsize[#1]% {\normalexpanded{\getcommalistsize[#1]}} \def\syst_helpers_get_from_comma_list#1% @@ -2106,12 +2106,12 @@ \expandafter\quitcommalist \fi} -\unexpanded\def\getfromcommalist[#1]#2[#3]% +\protected\def\getfromcommalist[#1]#2[#3]% {\let\commalistelement\empty \commalistcounter#3\relax \processcommalist[#1]\syst_helpers_get_from_comma_list} -\unexpanded\def\getfromcommacommand[#1]% +\protected\def\getfromcommacommand[#1]% {\normalexpanded{\getfromcommalist[#1]}} %D Watertight (and efficient) solutions are hard to find, due to the handling of @@ -2177,7 +2177,7 @@ %D \def\dosetupsomething[#1][#2]% %D {... #1 ... #2 ...} %D -%D \unexpanded\def\setupsomething +%D \protected\def\setupsomething %D {\dodoubleargument\dosetupsomething} %D \stoptyping %D @@ -2205,13 +2205,13 @@ % no longer a message: % -% \unexpanded\def\dosingleargument {\let\expectedarguments\plusone \dosingleempty } -% \unexpanded\def\dodoubleargument {\let\expectedarguments\plustwo \dodoubleempty } -% \unexpanded\def\dotripleargument {\let\expectedarguments\plusthree \dotripleempty } -% \unexpanded\def\doquadrupleargument {\let\expectedarguments\plusfour \doquadrupleempty } -% \unexpanded\def\doquintupleargument {\let\expectedarguments\plusfive \doquintupleempty } -% \unexpanded\def\dosixtupleargument {\let\expectedarguments\plussix \dosixtupleempty } -% \unexpanded\def\doseventupleargument{\let\expectedarguments\plusseven \doseventupleempty} +% \protected\def\dosingleargument {\let\expectedarguments\plusone \dosingleempty } +% \protected\def\dodoubleargument {\let\expectedarguments\plustwo \dodoubleempty } +% \protected\def\dotripleargument {\let\expectedarguments\plusthree \dotripleempty } +% \protected\def\doquadrupleargument {\let\expectedarguments\plusfour \doquadrupleempty } +% \protected\def\doquintupleargument {\let\expectedarguments\plusfive \doquintupleempty } +% \protected\def\dosixtupleargument {\let\expectedarguments\plussix \dosixtupleempty } +% \protected\def\doseventupleargument{\let\expectedarguments\plusseven \doseventupleempty} %D \macros %D {iffirstagument,ifsecondargument,ifthirdargument, @@ -2260,16 +2260,16 @@ % \setnewconstant\noexpectedarguments\zerocount % \setnewconstant\expectedarguments \zerocount % -% \unexpanded\def\showargumenterror#1#2% +% \protected\def\showargumenterror#1#2% % {\writestatus{system}{\number#1 argument(s) expected in line #2}} % -% \unexpanded\def\syst_helpers_argument_error +% \protected\def\syst_helpers_argument_error % {\ifnum\expectedarguments>\noexpectedarguments % \showargumenterror{\number\expectedarguments}{\number\inputlineno}% % \fi % \syst_helpers_argument_reset} % -% \unexpanded\def\syst_helpers_argument_reset +% \protected\def\syst_helpers_argument_reset % {\let\expectedarguments\noexpectedarguments} % \def\test[#1]{(#1)} @@ -2317,7 +2317,7 @@ % % with % -% \unexpanded\def\dodoubleempty#1% +% \protected\def\dodoubleempty#1% % {\syst_helpers_argument_reset % \let\m_syst_aux_do#1% alias % \let\m_syst_action_yes\syst_helpers_double_empty_one_yes @@ -2358,7 +2358,7 @@ %D Single: -% \unexpanded\def\dosingleempty#1% +% \protected\def\dosingleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\firstargumenttrue#1}% @@ -2368,7 +2368,7 @@ % {\firstargumentfalse % #1[]} -\unexpanded\def\dosingleempty#1% +\protected\def\dosingleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_single_empty_one_yes @@ -2382,7 +2382,7 @@ %D Double -% \unexpanded\def\dodoubleempty#1% +% \protected\def\dodoubleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_double_empty_one_yes#1}% @@ -2410,7 +2410,7 @@ % \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% +\protected\def\dodoubleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_double_empty_one_yes @@ -2441,7 +2441,7 @@ % Triple -% \unexpanded\def\dotripleempty#1% +% \protected\def\dotripleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_triple_empty_one_yes#1}% @@ -2487,7 +2487,7 @@ % \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% +\protected\def\dotripleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_triple_empty_one_yes @@ -2536,7 +2536,7 @@ %D Quadruple: -% \unexpanded\def\doquadrupleempty#1% +% \protected\def\doquadrupleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_quadruple_empty_one_yes#1}% @@ -2601,7 +2601,7 @@ % \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% +\protected\def\doquadrupleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_quadruple_empty_one_yes @@ -2669,7 +2669,7 @@ %D Quintuple: -% \unexpanded\def\doquintupleempty#1% +% \protected\def\doquintupleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_quintuple_empty_one_yes#1}% @@ -2754,7 +2754,7 @@ % \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% +\protected\def\doquintupleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_quintuple_empty_one_yes @@ -2842,7 +2842,7 @@ %D Sixtuple: -% \unexpanded\def\dosixtupleempty#1% +% \protected\def\dosixtupleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_sixtuple_empty_one_yes#1} @@ -2948,7 +2948,7 @@ % \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% +\protected\def\dosixtupleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_sixtuple_empty_one_yes @@ -3057,7 +3057,7 @@ %D Seventuple: -% \unexpanded\def\doseventupleempty#1% +% \protected\def\doseventupleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_seventuple_empty_one_yes#1}% @@ -3185,7 +3185,7 @@ % \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% +\protected\def\doseventupleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_seventuple_empty_one_yes @@ -3379,13 +3379,13 @@ %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% +\protected\def\complexorsimple#1% {% \relax % prevents lookahead, brrr \doifelsenextoptional {\firstargumenttrue \csname\s!complex\csstring#1\endcsname} {\firstargumentfalse\csname\s!simple \csstring#1\endcsname}} -\unexpanded\def\complexorsimpleempty#1% +\protected\def\complexorsimpleempty#1% {% \relax % prevents lookahead, brrr \doifelsenextoptional {\firstargumenttrue \csname\s!complex\csstring#1\endcsname} @@ -3397,19 +3397,19 @@ %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% +\protected\def\syst_helpers_complex_or_simple#1#2% {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#2}} -\unexpanded\def\syst_helpers_complex_or_simple_empty#1% +\protected\def\syst_helpers_complex_or_simple_empty#1% {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#1[]}} -\unexpanded\def\definecomplexorsimple#1% - {\unexpanded\edef#1{\syst_helpers_complex_or_simple +\protected\def\definecomplexorsimple#1% + {\protected\edef#1{\syst_helpers_complex_or_simple \expandafter\noexpand\csname\s!complex\csstring#1\endcsname \expandafter\noexpand\csname\s!simple \csstring#1\endcsname}} -\unexpanded\def\definecomplexorsimpleempty#1% - {\unexpanded\edef#1{\syst_helpers_complex_or_simple_empty +\protected\def\definecomplexorsimpleempty#1% + {\protected\edef#1{\syst_helpers_complex_or_simple_empty \expandafter\noexpand\csname\s!complex\csstring#1\endcsname}} %D These commands are called as: @@ -3447,8 +3447,8 @@ \newconditional\c_syst_helpers_permit_spaces_between_groups -\unexpanded\def \permitspacesbetweengroups{\settrue \c_syst_helpers_permit_spaces_between_groups} -\unexpanded\def\dontpermitspacesbetweengroups{\setfalse\c_syst_helpers_permit_spaces_between_groups} +\protected\def \permitspacesbetweengroups{\settrue \c_syst_helpers_permit_spaces_between_groups} +\protected\def\dontpermitspacesbetweengroups{\setfalse\c_syst_helpers_permit_spaces_between_groups} \dontpermitspacesbetweengroups @@ -3457,7 +3457,7 @@ %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% +\protected\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} @@ -3496,13 +3496,13 @@ \expandafter\syst_helpers_get_grouped_argument_d % h \fi} -\unexpanded\def\dosinglegroupempty#1% +\protected\def\dosinglegroupempty#1% {\def\syst_helpers_get_grouped_argument_nested {\dontpermitspacesbetweengroups #1}% \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} -\unexpanded\def\dodoublegroupempty#1% +\protected\def\dodoublegroupempty#1% {\def\syst_helpers_get_grouped_argument_nested##1% {\def\syst_helpers_get_grouped_argument_nested {\dontpermitspacesbetweengroups @@ -3510,7 +3510,7 @@ \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} -\unexpanded\def\dotriplegroupempty#1% +\protected\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 @@ -3520,7 +3520,7 @@ \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} -\unexpanded\def\doquadruplegroupempty#1% +\protected\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% @@ -3532,7 +3532,7 @@ \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} -\unexpanded\def\doquintuplegroupempty#1% +\protected\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% @@ -3600,14 +3600,14 @@ \def\fifthofsixarguments #1#2#3#4#5#6{#5} \def\sixthofsixarguments #1#2#3#4#5#6{#6} -\unexpanded\def\firstofoneunexpanded #1{#1} +\protected\def\firstofoneunexpanded #1{#1} -\unexpanded\def\firstoftwounexpanded #1#2{#1} -\unexpanded\def\secondoftwounexpanded #1#2{#2} +\protected\def\firstoftwounexpanded #1#2{#1} +\protected\def\secondoftwounexpanded #1#2{#2} -\unexpanded\def\firstofthreeunexpanded #1#2#3{#1} -\unexpanded\def\secondofthreeunexpanded#1#2#3{#2} -\unexpanded\def\thirdofthreeunexpanded #1#2#3{#3} +\protected\def\firstofthreeunexpanded #1#2#3{#1} +\protected\def\secondofthreeunexpanded#1#2#3{#2} +\protected\def\thirdofthreeunexpanded #1#2#3{#3} %D \macros %D {globalletempty,letempty, @@ -3616,15 +3616,15 @@ %D %D Trivial: -\unexpanded\def\letempty #1{\let #1\empty} -\unexpanded\def\globalletempty#1{\glet#1\empty} +\protected\def\letempty #1{\let #1\empty} +\protected\def\globalletempty#1{\glet#1\empty} -\unexpanded\def\letvalueempty #1{\expandafter\let \csname#1\endcsname\empty} -\unexpanded\def\letgvalueempty#1{\expandafter\glet\csname#1\endcsname\empty} -\unexpanded\def\letvaluerelax #1{\expandafter\let \csname#1\endcsname\relax} -\unexpanded\def\letgvalurelax #1{\expandafter\glet\csname#1\endcsname\relax} +\protected\def\letvalueempty #1{\expandafter\let \csname#1\endcsname\empty} +\protected\def\letgvalueempty#1{\expandafter\glet\csname#1\endcsname\empty} +\protected\def\letvaluerelax #1{\expandafter\let \csname#1\endcsname\relax} +\protected\def\letgvalurelax #1{\expandafter\glet\csname#1\endcsname\relax} -\unexpanded\def\relaxvalueifundefined#1% +\protected\def\relaxvalueifundefined#1% {\ifcsname#1\endcsname \else \expandafter\let\csname#1\endcsname\relax \fi} @@ -3635,7 +3635,7 @@ %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 +\protected\def\wait {\begingroup \read16 to \wait \endgroup} @@ -3662,12 +3662,12 @@ \ifdefined\writestring \else - \unexpanded\def\writestring{\immediate\write\statuswrite} - \unexpanded\def\writeline {\writestring{}} + \protected\def\writestring{\immediate\write\statuswrite} + \protected\def\writeline {\writestring{}} \fi -\unexpanded\def\normalwritestatus#1#2% +\protected\def\normalwritestatus#1#2% {\writestring{\expandafter\syst_helpers_split_status_yes\expandafter\statuswidth#1% \space\space\space\space\space\space\space \space\space\space\space\space\space\space @@ -3693,13 +3693,13 @@ %D %D A raw and dirty alternative for \type {\getparameters}; no checking is done! -\unexpanded\def\rawsetparameter#1=#2,% +\protected\def\rawsetparameter#1=#2,% {\if]#1\else \expandafter\def\csname\rawparameterprefix#1\endcsname{#2}% \expandafter\rawsetparameter \fi} -\unexpanded\def\rawgetparameters[#1][#2% some 5-10% faster +\protected\def\rawgetparameters[#1][#2% some 5-10% faster {\ifx#2]% test is needed, else bomb on [#1][] \expandafter\gobbleoneargument \else @@ -3720,13 +3720,13 @@ %D all preceding ones with \type {\redoglobal}. When using only alternatives, one %D can reset this mechanism with \type {\resetglobal}. -\unexpanded\def\resetglobal +\protected\def\resetglobal {\let\redoglobal\relax \let\dodoglobal\relax} \resetglobal -\unexpanded\def\doglobal +\protected\def\doglobal {\ifx\redoglobal\relax \let\redoglobal\global \let\dodoglobal\syst_helpers_dodo_global @@ -3760,7 +3760,7 @@ %D %D Apart from the prefixes, a few more \type {\expandafters} are needed: -% \unexpanded\def\newif#1% uses the original plain \@if +% \protected\def\newif#1% uses the original plain \@if % {\privatescratchcounter\escapechar % \escapechar\minusone % \expandafter\expandafter\expandafter @@ -3772,7 +3772,7 @@ % \dodoglobal\@if#1{false}% % \escapechar\privatescratchcounter} -\normalprotected\def\newif#1% see syst-ini.mkiv +\protected\def\newif#1% see syst-ini.mkiv {\let\new_if_saved\newif \let\newif\new_if_check \expandafter\redoglobal\expandafter\def\csname\expandafter\newif\csstring#1true\endcsname {\let#1\iftrue }% @@ -3782,26 +3782,26 @@ %D Also new: -\unexpanded\def\define#1% +\protected\def\define#1% {\ifdefined#1% \message{[\noexpand#1is already defined]}% - \unexpanded\expandafter\def\expandafter\gobbleddefinition + \protected\expandafter\def\expandafter\gobbleddefinition \else - \unexpanded\expandafter\def + \protected\expandafter\def \fi#1} -\unexpanded\def\redefine#1% +\protected\def\redefine#1% {\ifdefined#1% \message{[\noexpand#1is redefined]}% \fi - \unexpanded\def#1} + \protected\def#1} -\unexpanded\def\definemacro#1% +\protected\def\definemacro#1% {\ifdefined#1% \message{[\noexpand#1is already defined]}% - \unexpanded\expandafter\def\expandafter\gobbleddefinition + \protected\expandafter\def\expandafter\gobbleddefinition \else - \unexpanded\expandafter\def + \protected\expandafter\def \fi#1} % \define\hans{hans} @@ -3832,7 +3832,7 @@ % % \glet\stoptexdefinition\relax % -% \unexpanded\gdef\starttexdefinition% +% \protected\gdef\starttexdefinition% % {\bgroup% % \obeylines% % \syst_helpers_start_tex_definition} @@ -3855,7 +3855,7 @@ % \gdef\syst_helpers_start_tex_definition_yes_unexpanded#1#2 #3 % #4\stoptexdefinition% % {\egroup% #1=unexpanded -% \unexpanded\expandafter\def\csname#2\endcsname#3{#4}} +% \protected\expandafter\def\csname#2\endcsname#3{#4}} % % \gdef\syst_helpers_start_tex_definition_yes_normal#1#2 % #3\stoptexdefinition% @@ -3889,7 +3889,7 @@ % % \glet\stoptexdefinition\relax % -% \unexpanded\gdef\starttexdefinition% +% \protected\gdef\starttexdefinition% % {\bgroup% % \obeylines% % \syst_helpers_start_tex_definition_one} @@ -3908,7 +3908,7 @@ \glet\stoptexdefinition\relax -\unexpanded\gdef\starttexdefinition% +\protected\gdef\starttexdefinition% {\bgroup% \obeylines% \syst_helpers_start_tex_definition} @@ -3923,14 +3923,14 @@ \egroup -% \unexpanded\def\texdefinition#1{\csname\ifcsname#1\endcsname#1\else donothing\fi\endcsname} % todo: a nop cs: char 0 or some corenamespace +% \protected\def\texdefinition#1{\csname\ifcsname#1\endcsname#1\else donothing\fi\endcsname} % todo: a nop cs: char 0 or some corenamespace -\unexpanded\def\texdefinition#1{\begincsname#1\endcsname} +\protected\def\texdefinition#1{\begincsname#1\endcsname} % This is a first variant, more might be added: -\unexpanded\def\starttexcode{\unprotect} -\unexpanded\def\stoptexcode {\protect} +\protected\def\starttexcode{\unprotect} +\protected\def\stoptexcode {\protect} %D \macros %D {newcounter, @@ -3985,7 +3985,7 @@ \def\zerocountervalue{0} -\unexpanded\def\newcounter#1% +\protected\def\newcounter#1% {\dodoglobal\let#1\zerocountervalue} %D Nowadays we don't mind a few more tokens if we can gain a bit of speed. @@ -4006,14 +4006,14 @@ \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} +\protected\def\increment{\doifelsenextcharcs(\syst_helpers_do_do_increment\syst_helpers_do_increment} +\protected\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}} +\protected\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr#1+\plusone \relax}} +\protected\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr#1+\minusone\relax}} -\unexpanded\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname} -\unexpanded\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname} +\protected\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname} +\protected\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname} %D \macros %D {newsignal} @@ -4032,7 +4032,7 @@ \newdimen\maximumsignal % step is about 0.00025pt -\unexpanded\def\newsignal#1% +\protected\def\newsignal#1% {\ifdefined#1\else \advance\maximumsignal 2\scaledpoint % to be save in rounding \edef#1{\the\maximumsignal}% @@ -4061,7 +4061,7 @@ %D %D We will use this one in: -\unexpanded\def\savenormalmeaning#1% +\protected\def\savenormalmeaning#1% {\ifcsname normal\csstring#1\endcsname \else \expandafter\let\csname normal\csstring#1\endcsname#1% \fi} @@ -4114,7 +4114,7 @@ \installsystemnamespace{recurseindex} \installsystemnamespace{recurseaction} -\unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#4}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4136,7 +4136,7 @@ \fi \fi\normalexpanded{\syst_helpers_stepwise_next{\number#1}{\number#2}{\number#3}}} -\unexpanded\def\syst_helpers_stepwise_recurse#1#2#3% from to step +\protected\def\syst_helpers_stepwise_recurse#1#2#3% from to step {\ifnum#1>#2\relax \expandafter\syst_helpers_stepwise_recurse_nop \else @@ -4144,14 +4144,14 @@ \doubleexpandafter\syst_helpers_stepwise_recurse_yes\expandafter \fi\expandafter{\the\numexpr\recurselevel+#3\relax}{#2}{#3}} -\unexpanded\def\syst_helpers_recurse_content +\protected\def\syst_helpers_recurse_content {\csname\??recurseaction\the\outerrecurse\endcsname} -\unexpanded\def\syst_helpers_stepwise_recurse_yes +\protected\def\syst_helpers_stepwise_recurse_yes {\syst_helpers_recurse_content \syst_helpers_stepwise_recurse} -\unexpanded\def\syst_helpers_stepwise_reverse#1#2#3% from to step +\protected\def\syst_helpers_stepwise_reverse#1#2#3% from to step {\ifnum#1<#2\relax \expandafter\syst_helpers_stepwise_recurse_nop \else @@ -4161,22 +4161,22 @@ \doubleexpandafter\syst_helpers_stepwise_reverse_yes\expandafter \fi\expandafter{\the\innerrecurse}{#2}{#3}} -\unexpanded\def\syst_helpers_stepwise_reverse_yes +\protected\def\syst_helpers_stepwise_reverse_yes {\syst_helpers_recurse_content \syst_helpers_stepwise_reverse} -\unexpanded\def\syst_helpers_stepwise_exit +\protected\def\syst_helpers_stepwise_exit {\syst_helpers_stepwise_recurse_nop\relax} -\unexpanded\def\syst_helpers_stepwise_recurse_nop#1#2#3#4% +\protected\def\syst_helpers_stepwise_recurse_nop#1#2#3#4% {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse\minusone} -% \unexpanded\def\nonostepwiserecurse#1#2#3% +% \protected\def\nonostepwiserecurse#1#2#3% % {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname % \global\advance\outerrecurse\minusone} -\unexpanded\def\dorecurse#1% +\protected\def\dorecurse#1% {\dostepwiserecurse\plusone{#1}\plusone} \def\doexpandedrecurse#1#2% user macro (also was \doxprecurse) @@ -4201,7 +4201,7 @@ %D %D Because the simple case is used often, we implement it more efficiently: -\unexpanded\def\dorecurse#1% +\protected\def\dorecurse#1% {\ifcase#1\relax \expandafter\gobbletwoarguments \or @@ -4210,13 +4210,13 @@ \expandafter\syst_helpers_recurse_x \fi{#1}} -\unexpanded\def\syst_helpers_recurse_x#1#2% +\protected\def\syst_helpers_recurse_x#1#2% {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#2}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel \expandafter\syst_helpers_recurse_indeed\expandafter1\expandafter{\number#1}} -\unexpanded\def\syst_helpers_recurse_y#1#2% +\protected\def\syst_helpers_recurse_y#1#2% {\global\advance\outerrecurse \plusone \expandafter\glet\csname\??recurseindex\the\outerrecurse\endcsname\recurselevel \let\recurselevel\!!plusone @@ -4224,7 +4224,7 @@ \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse \minusone} -\unexpanded\def\syst_helpers_recurse_indeed#1#2% from to +\protected\def\syst_helpers_recurse_indeed#1#2% from to {\ifnum#1>#2\relax \expandafter\syst_helpers_recurse_indeed_nop \else @@ -4232,7 +4232,7 @@ \doubleexpandafter\syst_helpers_recurse_indeed_yes \fi\expandafter{\the\numexpr\recurselevel+\plusone\relax}{#2}} -\unexpanded\def\syst_helpers_recurse_indeed#1#2% from to +\protected\def\syst_helpers_recurse_indeed#1#2% from to {\ifnum#1>#2\relax \expandafter\syst_helpers_recurse_indeed_nop \else @@ -4241,11 +4241,11 @@ \doubleexpandafter\syst_helpers_recurse_indeed_yes \fi\expandafter{\the\innerrecurse}{#2}} -\unexpanded\def\syst_helpers_recurse_indeed_yes +\protected\def\syst_helpers_recurse_indeed_yes {\syst_helpers_recurse_content \syst_helpers_recurse_indeed} -\unexpanded\def\syst_helpers_recurse_indeed_nop#1#2#3% +\protected\def\syst_helpers_recurse_indeed_nop#1#2#3% {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse \minusone } @@ -4258,7 +4258,7 @@ %D \dowith{a,b,c}{[#1]} %D \stoptyping -\unexpanded\def\dowith#1#2% +\protected\def\dowith#1#2% {\def\syst_helpers_with##1{#2}% \normalexpanded{\processcommalist[#1]}\syst_helpers_with} @@ -4280,30 +4280,30 @@ \let\endofloop\donothing % maybe \syst_helpers_loop_end -\unexpanded\def\doloop#1% +\protected\def\doloop#1% {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#1}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel \let\endofloop\syst_helpers_loop \syst_helpers_loop1} % no \plusone else \recurselevel wrong -\unexpanded\def\syst_helpers_loop#1% +\protected\def\syst_helpers_loop#1% {\def\recurselevel{#1}% \expandafter\syst_helpers_loop_yes\expandafter{\the\numexpr\recurselevel+\plusone\relax}} -\unexpanded\def\syst_helpers_loop_yes +\protected\def\syst_helpers_loop_yes {\syst_helpers_recurse_content \endofloop} -\unexpanded\def\syst_helpers_loop_nop#1% +\protected\def\syst_helpers_loop_nop#1% {\let\endofloop\syst_helpers_loop % new, permits nested \doloop's \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse\minusone} -\unexpanded\def\exitloop % \exitloop quits at end +\protected\def\exitloop % \exitloop quits at end {\let\endofloop\syst_helpers_loop_nop} -\unexpanded\def\exitloopnow#1\endofloop % \exitloopnow quits directly +\protected\def\exitloopnow#1\endofloop % \exitloopnow quits directly {\syst_helpers_loop_nop} %D The loop is executed at least once, so beware of situations @@ -4346,13 +4346,13 @@ {\csname\??recurseaction\the\outerrecurse\expandafter\expandafter\expandafter\endcsname \expandafter\expandafter\expandafter{\expandafter\recurselevel\expandafter}\expandafter{\the\outerrecurse}} -\unexpanded\def\syst_helpers_recurse_x#1#2% +\protected\def\syst_helpers_recurse_x#1#2% {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#2}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel \expandafter\syst_helpers_recurse_indeed\expandafter1\expandafter{\number#1}} -\unexpanded\def\syst_helpers_recurse_y#1#2% +\protected\def\syst_helpers_recurse_y#1#2% {\global\advance\outerrecurse \plusone \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel \let\recurselevel\!!plusone @@ -4361,7 +4361,7 @@ \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse \minusone} -\unexpanded\def\doloop#1% +\protected\def\doloop#1% {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#1}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4370,7 +4370,7 @@ % for instance: % -% \unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +% \protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 % {\global\advance\outerrecurse \plusone % \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#4}% % \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4394,7 +4394,7 @@ % % faster: % -% \unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +% \protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 % {\global\advance\outerrecurse \plusone % \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#4}% % \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4414,7 +4414,7 @@ \installsystemnamespace{recursestepwise} -\unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#4}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4466,7 +4466,7 @@ \let\m_syst_helpers_fast_loop_cs\relax -\unexpanded\def\dofastloopcs#1% +\protected\def\dofastloopcs#1% {\fastloopfinal#1\relax \ifcase\fastloopfinal \expandafter\gobbleoneargument @@ -4474,12 +4474,12 @@ \expandafter\syst_helpers_fast_loop_cs \fi} -\unexpanded\def\syst_helpers_fast_loop_cs#1% +\protected\def\syst_helpers_fast_loop_cs#1% {\let\m_syst_helpers_fast_loop_cs#1% \fastloopindex\plusone \syst_helpers_fast_loop_cs_step} -\unexpanded\def\syst_helpers_fast_loop_cs_step +\protected\def\syst_helpers_fast_loop_cs_step {\ifnum\fastloopindex>\fastloopfinal \let\m_syst_helpers_fast_loop_cs\relax \else @@ -4490,7 +4490,7 @@ % Helper: -\unexpanded\def\resetrecurselevel{\let\recurselevel\!!zerocount} +\protected\def\resetrecurselevel{\let\recurselevel\!!zerocount} \let\recurselevel \!!zerocount \let\recurseaction\relax @@ -4521,7 +4521,7 @@ %D } %D \stoptyping -\unexpanded\def\doloopoverlist#1#2% +\protected\def\doloopoverlist#1#2% {\global\advance\outerrecurse\plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1{\edef\recursestring{##1}#2}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recursestring @@ -4553,26 +4553,26 @@ \installsystemnamespace{extraevery} -% \unexpanded\def\newevery#1#2% +% \protected\def\newevery#1#2% % {\ifx#1\everypar\else\newtoks#1\fi% we test for redefinition elsewhere % \ifx#2\relax\else\ifdefined#2\else % \expandafter\newtoks\csname\??extraevery\csstring#1\endcsname % \def#2{\syst_helpers_every#1}% % \fi\fi} % -% \unexpanded\def\syst_helpers_every#1% +% \protected\def\syst_helpers_every#1% % {\expandafter\removetoks\expandafter\the\csname\??extraevery\csstring#1\endcsname\from#1% % \expandafter\appendtoks\expandafter\the\csname\??extraevery\csstring#1\endcsname\to #1% % \csname\??extraevery\csstring#1\endcsname} -\unexpanded\def\newevery#1#2% +\protected\def\newevery#1#2% {\ifx#1\everypar\else\newtoks#1\fi% we test for redefinition elsewhere \ifx#2\relax\else\ifdefined#2\else \expandafter\newtoks\csname\??extraevery\csstring#1\endcsname \edef#2{\syst_helpers_every#1\csname\??extraevery\csstring#1\endcsname}% \fi\fi} -\unexpanded\def\syst_helpers_every#1#2% +\protected\def\syst_helpers_every#1#2% {\removetoks\the#2\from#1% \appendtoks\the#2\to #1% #2} @@ -4587,19 +4587,19 @@ % \newtoks \neverypar % \newtoks \neveryendpar % -% \normalprotected\def\syst_helpers_forgotten_endpar +% \protected\def\syst_helpers_forgotten_endpar % {\the\neveryendpar\normalpar} % -% \unexpanded\def\forgeteverypar +% \protected\def\forgeteverypar % {\everypar{\the\neverypar}% % \let\endpar\syst_helpers_forgotten_endpar} % -% \unexpanded\def\finishpar +% \protected\def\finishpar % {\ifvmode\else\par\fi} \newtoks \neverypar -\unexpanded\def\forgeteverypar +\protected\def\forgeteverypar {\everypar{\the\neverypar}} %D Which we're going to use indeed! When the second argument equals \type {\relax}, @@ -4665,10 +4665,10 @@ %D %D Both commands accept the prefix \type{\doglobal} for global assignments. -\unexpanded\def\convertvalue#1\to +\protected\def\convertvalue#1\to {\expandafter\convertcommand\csname#1\endcsname\to} -\unexpanded\def\defconvertedvalue#1#2% less sensitive for \to +\protected\def\defconvertedvalue#1#2% less sensitive for \to {\expandafter\defconvertedcommand\expandafter#1\csname#2\endcsname} %D \macros @@ -4692,14 +4692,14 @@ \def\syst_helpers_check_if_assignment_else#1=#2#3^^^^0004{\if#2^^^^0003}% \def\syst_helpers_check_else_assignment_if#1=#2#3^^^^0004{\unless\if#2^^^^0003}% -\unexpanded\def\doifelseassignment#1% +\protected\def\doifelseassignment#1% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=^^^^0003^^^^0003^^^^0004% \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} -\unexpanded\def\doifelseassignmentcs#1#2#3% +\protected\def\doifelseassignmentcs#1#2#3% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=^^^^0003^^^^0003^^^^0004% \expandafter#3% \else @@ -4711,7 +4711,7 @@ \newif\ifassignment -\unexpanded\def\docheckassignment#1% +\protected\def\docheckassignment#1% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=^^^^0003^^^^0003^^^^0004% \assignmentfalse \else @@ -4720,10 +4720,10 @@ %D These can be used for cases where we want less tracing noise. -\unexpanded\def\validassignment#1% +\protected\def\validassignment#1% {\expandafter\syst_helpers_check_else_assignment_if\detokenize{#1}=^^^^0003^^^^0003^^^^0004} -\unexpanded\def\novalidassignment#1% +\protected\def\novalidassignment#1% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=^^^^0003^^^^0003^^^^0004} %D In \ETEX\ we can use \type {\detokenize} and gain some speed, but in general far @@ -4731,16 +4731,16 @@ %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 +\protected\def\convertargument#1\to#2{\dodoglobal\edef#2{\detokenize{#1}}} +\protected\def\convertcommand #1\to#2{\dodoglobal\edef#2{\expandafter\detokenize\expandafter{#1}}} % hm, only second is also ok -\unexpanded\def\defconvertedargument #1#2{\edef#1{\detokenize{#2}}} -\unexpanded\def\defconvertedcommand #1#2{\edef#1{\detokenize\expandafter{#2}}} -\unexpanded\def\edefconvertedargument#1#2{\edef#1{#2}% +\protected\def\defconvertedargument #1#2{\edef#1{\detokenize{#2}}} +\protected\def\defconvertedcommand #1#2{\edef#1{\detokenize\expandafter{#2}}} +\protected\def\edefconvertedargument#1#2{\edef#1{#2}% \edef#1{\detokenize\expandafter{#1}}} -\unexpanded\def\gdefconvertedargument#1#2{\xdef#1{\detokenize{#2}}} -\unexpanded\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\expandafter{#2}}} -\unexpanded\def\xdefconvertedargument#1#2{\xdef#1{#2}% +\protected\def\gdefconvertedargument#1#2{\xdef#1{\detokenize{#2}}} +\protected\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\expandafter{#2}}} +\protected\def\xdefconvertedargument#1#2{\xdef#1{#2}% \xdef#1{\detokenize\expandafter{#1}}} %D When you try to convert a primitive command, you'll find out that the \ETEX\ @@ -4764,7 +4764,7 @@ %D %D Ahandy macro, for testing purposes only: -\unexpanded\def\showvalue#1% +\protected\def\showvalue#1% {\ifcsname#1\endcsname \expandafter\show\csname#1\endcsname \else @@ -4784,7 +4784,7 @@ %D %D Watch the one level expansion of the second argument. -\unexpanded\def\doifelsemeaning#1#2% +\protected\def\doifelsemeaning#1#2% {\edef\m_syst_string_one{\normalmeaning#1}% \def \m_syst_string_two{#2}% \edef\m_syst_string_two{\normalmeaning\m_syst_string_two}% @@ -4813,9 +4813,9 @@ \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#4}}}% \ifx\m_syst_string_one\m_syst_string_two\expandafter#1\else\expandafter#2\fi} -\unexpanded\def\doifelsesamestring{\syst_helpers_if_samestring_else\firstoftwoarguments\secondoftwoarguments} -\unexpanded\def\doifsamestring {\syst_helpers_if_samestring_else\firstofoneargument \gobbleoneargument } -\unexpanded\def\doifnotsamestring {\syst_helpers_if_samestring_else\gobbleoneargument \firstofoneargument } +\protected\def\doifelsesamestring{\syst_helpers_if_samestring_else\firstoftwoarguments\secondoftwoarguments} +\protected\def\doifsamestring {\syst_helpers_if_samestring_else\firstofoneargument \gobbleoneargument } +\protected\def\doifnotsamestring {\syst_helpers_if_samestring_else\gobbleoneargument \firstofoneargument } \let\doifsamestringelse\doifelsesamestring @@ -4843,7 +4843,7 @@ %D %D In examples~2 and~3 both arguments equal, in~1 and~4 they differ. -\unexpanded\def\ConvertToConstant#1#2#3% +\protected\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}} @@ -4873,14 +4873,14 @@ %D %D where \type {...} can be anything legally \TEX. -\unexpanded\def\CheckConstantAfter#1#2% +\protected\def\CheckConstantAfter#1#2% {\expandafter\convertargument\v!prefix!\to\ascii \convertargument#1\to#2\relax \doifelseinstring\ascii{#2} {\expandafter\convertargument#1\to#2} {}} -\unexpanded\def\ConvertConstantAfter#1#2#3% +\protected\def\ConvertConstantAfter#1#2#3% {\CheckConstantAfter{#2}\asciia \CheckConstantAfter{#3}\asciib #1{\asciia}{\asciib}} @@ -4896,7 +4896,7 @@ %D %D We don't explicitly test if the macro is defined. -\unexpanded\def\assignifempty#1#2% can be sped up +\protected\def\assignifempty#1#2% can be sped up {\doifnothing{#1}{\def#1{#2}}} %D \macros @@ -4909,7 +4909,7 @@ %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 \protected\def\startcommand#1\stopcommand% %D {... #1 ...} %D \stoptyping %D @@ -4927,7 +4927,7 @@ %D {\stop}. This means that: %D %D \starttyping -%D \unexpanded\def\starthello% +%D \protected\def\starthello% %D {\grabuntil{stophello}\message} %D %D \starthello Hello world!\stophello @@ -4937,10 +4937,10 @@ \let\syst_helpers_grab_indeed\relax -\unexpanded\def\syst_helpers_grab#1#2% +\protected\def\syst_helpers_grab#1#2% {\def\syst_helpers_grab_indeed##1#1{#2{##1}}\syst_helpers_grab_indeed} -\unexpanded\def\grabuntil#1% +\protected\def\grabuntil#1% {\expandafter\syst_helpers_grab\expandafter{\csname#1\endcsname}} %D The next command build on this mechanism: @@ -4967,18 +4967,18 @@ \let\syst_helpers_gobble_indeed\relax -\unexpanded\def\processbetween#1#2% +\protected\def\processbetween#1#2% {\setvalue{\s!start#1}{\grabuntil{\s!stop#1}{#2}}} -\unexpanded\def\gobbleuntil#1% +\protected\def\gobbleuntil#1% {\def\syst_helpers_gobble_indeed##1#1{}\syst_helpers_gobble_indeed} -\unexpanded\def\gobbleuntilrelax#1\relax +\protected\def\gobbleuntilrelax#1\relax {} % experimental -\unexpanded\def\gobblenested#1#2#3% +\protected\def\gobblenested#1#2#3% {\normalexpanded{\def\noexpand\next##1\csname#2\endcsname}{\csname#3\endcsname}% \next}% @@ -4990,7 +4990,7 @@ \let\syst_helpers_until_indeed\relax -\unexpanded\def\processuntil#1% +\protected\def\processuntil#1% {\def\syst_helpers_until_indeed##1#1{##1}\syst_helpers_until_indeed} %D \macros @@ -5062,14 +5062,14 @@ % keep: % -% \unexpanded\def\syst_helpers_handle_group_normal#1#2% +% \protected\def\syst_helpers_handle_group_normal#1#2% % {\bgroup % \def\m_syst_helpers_handle_group_before{\bgroup#1\bgroup\aftergroup\m_syst_helpers_handle_group_after}% can't we remove the second \bgroup % \def\m_syst_helpers_handle_group_after {#2\egroup\egroup}% and one \egroup here? % \afterassignment\m_syst_helpers_handle_group_before % \let\next=} -% \unexpanded\def\syst_helpers_handle_group_normal#1#2% +% \protected\def\syst_helpers_handle_group_normal#1#2% % {\bgroup % \def\m_syst_helpers_handle_group_before{#1}% % \def\m_syst_helpers_handle_group_after {#2}% @@ -5087,7 +5087,7 @@ % \egroup % \egroup} % -% \unexpanded\def\syst_helpers_handle_group_simple#1#2% no inner group (so no kerning interference) +% \protected\def\syst_helpers_handle_group_simple#1#2% no inner group (so no kerning interference) % {\bgroup % \def\m_syst_helpers_handle_group_before{#1}% % \def\m_syst_helpers_handle_group_after {#2}% @@ -5103,7 +5103,7 @@ % {\m_syst_helpers_handle_group_after % \egroup}% % -% \unexpanded\def\syst_helpers_handle_group_pickup#1#2#3% no inner group (so no kerning interference) +% \protected\def\syst_helpers_handle_group_pickup#1#2#3% no inner group (so no kerning interference) % {\bgroup % \def\m_syst_helpers_handle_group_before{#1}% % \def\m_syst_helpers_handle_group_after {#2\egroup#3}% @@ -5115,7 +5115,7 @@ % \aftergroup\m_syst_helpers_handle_group_after % \m_syst_helpers_handle_group_before} % -% \unexpanded\def\syst_helpers_handle_group_nop +% \protected\def\syst_helpers_handle_group_nop % {\ifnum\currentgrouptype=\semisimplegroupcode % \expandafter\syst_helpers_handle_group_nop_a % \else @@ -5134,7 +5134,7 @@ % \aftergroup\m_syst_helpers_handle_group_after % #1} -\unexpanded\def\syst_helpers_handle_group_nop +\protected\def\syst_helpers_handle_group_nop {\ifnum\currentgrouptype=\semisimplegroupcode \expandafter\syst_helpers_handle_group_nop_a \else @@ -5153,7 +5153,7 @@ \aftergroup\egroup \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_normal +\protected\def\syst_helpers_handle_group_normal {\bgroup \afterassignment\m_syst_helpers_handle_group_normal_before \let\next=} @@ -5166,7 +5166,7 @@ \aftergroup\egroup \aftergroup\egroup} -\unexpanded\def\syst_helpers_handle_group_simple% no inner group (so no kerning interference) +\protected\def\syst_helpers_handle_group_simple% no inner group (so no kerning interference) {\bgroup \afterassignment\m_syst_helpers_handle_group_simple_before \let\next=} @@ -5180,7 +5180,7 @@ {\m_syst_helpers_handle_group_a \egroup}% -\unexpanded\def\syst_helpers_handle_group_pickup% no inner group (so no kerning interference) +\protected\def\syst_helpers_handle_group_pickup% no inner group (so no kerning interference) {\bgroup \afterassignment\m_syst_helpers_handle_group_pickup_before \let\next=} @@ -5192,7 +5192,7 @@ \aftergroup\m_syst_helpers_handle_group_p \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_nop_x +\protected\def\syst_helpers_handle_group_nop_x {\ifnum\currentgrouptype=\semisimplegroupcode \begingroup \aftergroup\endgroup @@ -5202,7 +5202,7 @@ \fi \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_normal_x +\protected\def\syst_helpers_handle_group_normal_x {\bgroup \afterassignment\m_syst_helpers_handle_group_normal_before_x \let\next=} @@ -5225,50 +5225,50 @@ %D {\futurelet} obeys blank spaces, and a line||ending token is treated as a blank %D space. So the final implementation became: -% \unexpanded\def\groupedcommand#1#2% +% \protected\def\groupedcommand#1#2% % {\doifelsenextbgroup{\syst_helpers_handle_group_normal{#1}{#2}}{\syst_helpers_handle_group_nop{#1}{#2}}} % -% \unexpanded\def\groupedcommandcs#1#2% +% \protected\def\groupedcommandcs#1#2% % {\doifelsenextbgroup{\syst_helpers_handle_group_normal{#1}{#2}}{\syst_helpers_handle_group_nop{#1}{#2}}} % -% \unexpanded\def\triggergroupedcommand#1% +% \protected\def\triggergroupedcommand#1% % {\doifelsenextbgroup{\syst_helpers_handle_group_normal{#1}{}}{\syst_helpers_handle_group_nop{#1}{}}} % -% \unexpanded\def\triggergroupedcommandcs#1% +% \protected\def\triggergroupedcommandcs#1% % {\doifelsenextbgroup{\syst_helpers_handle_group_normal{#1}{}}{\syst_helpers_handle_group_nop{#1}{}}} % -% \unexpanded\def\simplegroupedcommand#1#2% +% \protected\def\simplegroupedcommand#1#2% % {\doifelsenextbgroup{\syst_helpers_handle_group_simple{#1}{#2}}{\syst_helpers_handle_group_nop{#1}{#2}}} % -% \unexpanded\def\pickupgroupedcommand#1#2#3% +% \protected\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% +\protected\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% +\protected\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% +\protected\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% +\protected\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{#3}% \doifelsenextbgroupcs\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop} -\unexpanded\def\triggergroupedcommand#1% +\protected\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% +\protected\def\triggergroupedcommandcs#1% {\let\m_syst_helpers_handle_group_b#1% \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} @@ -5297,10 +5297,10 @@ %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% +\protected\def\showdefinederror#1#2% {\writestatus\m!system{#1 #2 replaces a macro, use CAPITALS!}} -\unexpanded\def\checkdefined#1#2#3% +\protected\def\checkdefined#1#2#3% {\doifdefined{#3}{\showdefinederror{#2}{#3}}} %D \macros @@ -5355,29 +5355,29 @@ \newtoks\BeforePar \newtoks\AfterPar -\unexpanded\def\redowithpar\par +\protected\def\redowithpar\par {\doifelsenextchar\par\redowithpar\dodowithpar}% -\unexpanded\def\dowithpar#1#2% +\protected\def\dowithpar#1#2% {\def\dodowithpar##1\par{#1##1#2}% \redowithpar\par} -\unexpanded\def\redogotopar\par +\protected\def\redogotopar\par {\doifelsenextchar\par\redogotopar\dodogotopar}% -\unexpanded\def\dogotopar#1% +\protected\def\dogotopar#1% {\def\dodogotopar{#1}% \redogotopar\par} -\unexpanded\def\dogotoparcs#1% +\protected\def\dogotoparcs#1% {\let\dodogotopar#1% \redogotopar\par} \ifdefined \ignorepars \else - \unexpanded\def\ignorepars{\dogotoparcs\relax} + \protected\def\ignorepars{\dogotoparcs\relax} \fi -\unexpanded\def\GetPar +\protected\def\GetPar {\expanded {\dowithpar {\the\BeforePar @@ -5386,7 +5386,7 @@ \BeforePar\emptytoks \AfterPar\emptytoks}}} -\unexpanded\def\GotoPar +\protected\def\GotoPar {\expanded {\dogotopar {\the\BeforePar @@ -5425,7 +5425,7 @@ \let\syst_helpers_next_par\relax \let\syst_helpers_next_arg\relax -\unexpanded\def\dowithpargument#1% +\protected\def\dowithpargument#1% {\def\syst_helpers_next_par##1 \par{#1{##1}}% \def\syst_helpers_next_arg##1{#1{##1}}% \doifelsenextbgroup\syst_helpers_next_arg{\doifelsenextchar\par{#1{}}\syst_helpers_next_par}} @@ -5453,7 +5453,7 @@ \let\syst_helpers_next_war\relax \let\syst_helpers_next_arg\relax -\unexpanded\def\dowithwargument#1% +\protected\def\dowithwargument#1% {\def\syst_helpers_next_war##1 {#1{##1}}% \def\syst_helpers_next_arg##1{#1{##1}}% \doifelsenextbgroup\syst_helpers_next_arg\syst_helpers_next_war} @@ -5487,7 +5487,7 @@ %D commands, the \type {n*} is optional. When this specification is missing, the %D command executes once. -\unexpanded\def\dorepeatwithcommand[#1]% +\protected\def\dorepeatwithcommand[#1]% {\syst_helpers_repeat_with_command#1*\empty*\relax} \def\syst_helpers_repeat_with_command#1*#2#3*#4\relax#5% @@ -5578,10 +5578,10 @@ % no longer \def but \let to target toks .. the space gobbling \relax will go -% \unexpanded\def\appendtoks {\syst_helpers_append_toks \relax} -% \unexpanded\def\prependtoks {\syst_helpers_prepend_toks \relax} -% \unexpanded\def\appendtoksonce {\syst_helpers_append_toks_once \relax} -% \unexpanded\def\prependtoksonce{\syst_helpers_prepend_toks_once\relax} +% \protected\def\appendtoks {\syst_helpers_append_toks \relax} +% \protected\def\prependtoks {\syst_helpers_prepend_toks \relax} +% \protected\def\appendtoksonce {\syst_helpers_append_toks_once \relax} +% \protected\def\prependtoksonce{\syst_helpers_prepend_toks_once\relax} % % \def\syst_helpers_append_toks_indeed % {\dodoglobal\m_syst_helpers_scratch\doubleexpandafter{\expandafter\the\expandafter\m_syst_helpers_scratch\the\t_syst_helpers_scratch}} @@ -5613,13 +5613,13 @@ % \donothing % \syst_helpers_prepend_toks_indeed} -% \unexpanded\def\appendtoks#1\to#2% +% \protected\def\appendtoks#1\to#2% % {\toksapp#2{#1}% % \ifx\dodoglobal\relax\else % \dodoglobal#2#2% % \fi} % -% \unexpanded\def\prependtoks#1\to#2% +% \protected\def\prependtoks#1\to#2% % {\tokspre#2{#1}% % \ifx\dodoglobal\relax\else % \dodoglobal#2#2% @@ -5637,7 +5637,7 @@ % \dodoglobal\m_syst_helpers_scratch\m_syst_helpers_scratch % \fi} -\unexpanded\def\appendtoks#1\to#2% +\protected\def\appendtoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\toksapp \else @@ -5645,7 +5645,7 @@ \expandafter\gtoksapp \fi#2{#1}} -\unexpanded\def\prependtoks#1\to#2% +\protected\def\prependtoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\tokspre \else @@ -5669,14 +5669,14 @@ \expandafter\gtokspre \fi\m_syst_helpers_scratch\t_syst_helpers_scratch} -\unexpanded\def\appendtoksonce#1\to#2% +\protected\def\appendtoksonce#1\to#2% {\let\m_syst_helpers_scratch#2% \t_syst_helpers_scratch{#1}% \doifelseintoks\t_syst_helpers_scratch\m_syst_helpers_scratch \donothing \syst_helpers_append_toks_indeed} -\unexpanded\def\prependtoksonce#1\to#2% +\protected\def\prependtoksonce#1\to#2% {\let\m_syst_helpers_scratch#2% \t_syst_helpers_scratch{#1}% \doifelseintoks\t_syst_helpers_scratch\m_syst_helpers_scratch @@ -5685,7 +5685,7 @@ %D The test macro: -\unexpanded\def\doifelseintoks#1#2% #1 en #2 zijn toks +\protected\def\doifelseintoks#1#2% #1 en #2 zijn toks {\edef\asciia{\detokenize\expandafter{\the#1}}% \edef\asciib{\detokenize\expandafter{\the#2}}% \doifelsestringinstring\asciia\asciib} @@ -5713,14 +5713,14 @@ \newtoks \collectingtoks -\unexpanded\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}} -\unexpanded\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}} +\protected\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}} +\protected\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}} -\unexpanded\def\startcollecting{\collectingtoks\emptytoks} -\unexpanded\def\stopcollecting {\the\collectingtoks} +\protected\def\startcollecting{\collectingtoks\emptytoks} +\protected\def\stopcollecting {\the\collectingtoks} -\unexpanded\def\collect {\toksapp \collectingtoks} -\unexpanded\def\collectexpanded{\etoksapp\collectingtoks} +\protected\def\collect {\toksapp \collectingtoks} +\protected\def\collectexpanded{\etoksapp\collectingtoks} %D A nice one too: @@ -5730,7 +5730,7 @@ % {\scratchtoks{xaa} \removetoks x\from\scratchtoks [\the\scratchtoks]} % {\scratchtoks{a\relax b} \removetoks \relax\from\scratchtoks [\showthe\scratchtoks]} -\unexpanded\def\removetoks#1\from#2% +\protected\def\removetoks#1\from#2% {\def\syst_helpers_remove_toks##1#1##2\empty\empty\empty##3^^^^0004% {\def\m_syst_string_one{##3}% \ifx\m_syst_string_one\empty#2{##1}\else#2{##1##2}\fi}% @@ -5738,22 +5738,22 @@ %D Also: -% \unexpanded\def\appendetoks #1\to{\normalexpanded{\appendtoks #1}\to} -% \unexpanded\def\prependetoks#1\to{\normalexpanded{\prependtoks#1}\to} +% \protected\def\appendetoks #1\to{\normalexpanded{\appendtoks #1}\to} +% \protected\def\prependetoks#1\to{\normalexpanded{\prependtoks#1}\to} -% \unexpanded\def\appendetoks#1\to#2% +% \protected\def\appendetoks#1\to#2% % {\etoksapp#2{#1}% % \ifx\dodoglobal\relax\else % \global#2#2% % \fi} % -% \unexpanded\def\prependetoks#1\to#2% +% \protected\def\prependetoks#1\to#2% % {\etokspre#2{#1}% % \ifx\dodoglobal\relax\else % \global#2#2% % \fi} -\unexpanded\def\appendetoks#1\to#2% +\protected\def\appendetoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\etoksapp \else @@ -5761,7 +5761,7 @@ \expandafter\xtoksapp \fi#2{#1}} -\unexpanded\def\prependetoks#1\to#2% +\protected\def\prependetoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\etokspre \else @@ -5771,7 +5771,7 @@ %D Hm. -\unexpanded\def\flushtoks#1% nb: can reassign to #1 again, hence the indirectness +\protected\def\flushtoks#1% nb: can reassign to #1 again, hence the indirectness {\t_syst_helpers_scratch#1\relax \dodoglobal#1\emptytoks \the\t_syst_helpers_scratch\relax} @@ -5798,12 +5798,12 @@ \let\syst_helpers_split_string\relax -\unexpanded\def\beforesplitstring#1\at#2\to#3% +\protected\def\beforesplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##1#2##2#2##3\\% {\def#3{##1}}% \expandafter\syst_helpers_split_string#1#2#2\\} -\unexpanded\def\aftersplitstring#1\at#2\to#3% +\protected\def\aftersplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##1#2##2@@@##3\\% {\def#3{##2}}% \expandafter\syst_helpers_split_string#1@@@#2@@@\\} @@ -5813,7 +5813,7 @@ %D %D A bonus macro. -\unexpanded\def\splitstring#1\at#2\to#3\and#4% +\protected\def\splitstring#1\at#2\to#3\and#4% {\def\syst_helpers_split_string##1#2##2\empty\empty\empty##3\\% {\def#3{##1}% \def\syst_helpers_split_string{##3}% @@ -5824,7 +5824,7 @@ \fi}% \expandafter\syst_helpers_split_string#1\empty\empty\empty#2\empty\empty\empty\\} -\unexpanded\def\greedysplitstring#1\at#2\to#3\and#4% +\protected\def\greedysplitstring#1\at#2\to#3\and#4% {\edef\asciib{#1}% \let\asciic\asciib \let#3\empty @@ -5846,12 +5846,12 @@ %D aftertestandsplitstring, %D testandsplitstring} -\unexpanded\def\beforetestandsplitstring#1\at#2\to#3% +\protected\def\beforetestandsplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##1#2##2#2##3##4\\% {\ifx##3\empty\let#3\empty\else\def#3{##1}\fi}% \expandafter\syst_helpers_split_string#1#2#2\empty\\} -\unexpanded\def\aftertestandsplitstring#1\at#2\to#3% +\protected\def\aftertestandsplitstring#1\at#2\to#3% {\def\syst_helpers_split_string ##1#2##2@@@##3##4\\% {\ifx##3\empty\let#3\empty\else\def#3{##2}\fi}% \expandafter\syst_helpers_split_string #1@@@#2@@@\empty\\} @@ -5868,17 +5868,17 @@ %D splitatcolon, %D splitatcolons} -\unexpanded\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..\relax} -\unexpanded\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,\relax} % not at ", " -\unexpanded\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**\relax} -\unexpanded\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::\relax} -\unexpanded\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::\relax} +\protected\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..\relax} +\protected\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,\relax} % not at ", " +\protected\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**\relax} +\protected\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::\relax} +\protected\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::\relax} -\unexpanded\def\syst_helpers_splitatperiod #1.#2.#3\relax#4#5{\def#4{#1}\def#5{#2}} -\unexpanded\def\syst_helpers_splitatcomma #1,#2,#3\relax#4#5{\def#4{#1}\def#5{#2}} -\unexpanded\def\syst_helpers_splitatasterisk #1*#2*#3\relax#4#5{\def#4{#1}\def#5{#2}} -\unexpanded\def\syst_helpers_splitatcolon #1:#2:#3\relax#4#5{\def#4{#1}\def#5{#2}} -\unexpanded\def\syst_helpers_splitatcolons #1::#2::#3\relax#4#5{\edef#4{#1}\edef#5{#2}} +\protected\def\syst_helpers_splitatperiod #1.#2.#3\relax#4#5{\def#4{#1}\def#5{#2}} +\protected\def\syst_helpers_splitatcomma #1,#2,#3\relax#4#5{\def#4{#1}\def#5{#2}} +\protected\def\syst_helpers_splitatasterisk #1*#2*#3\relax#4#5{\def#4{#1}\def#5{#2}} +\protected\def\syst_helpers_splitatcolon #1:#2:#3\relax#4#5{\def#4{#1}\def#5{#2}} +\protected\def\syst_helpers_splitatcolons #1::#2::#3\relax#4#5{\edef#4{#1}\edef#5{#2}} %D \macros %D {removesubstring} @@ -5891,7 +5891,7 @@ %D %D Which in terms of \TEX\ looks like: -\unexpanded\def\removesubstring#1\from#2\to#3% +\protected\def\removesubstring#1\from#2\to#3% {\splitstring#2\to\m_syst_string_one\and\m_syst_string_two \dodoglobal#3{\m_syst_string_one\m_syst_string_two}} @@ -5948,36 +5948,36 @@ %D %D The faster alternatives are: -\unexpanded\def\appendtocommalist#1#2% +\protected\def\appendtocommalist#1#2% {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}} -\unexpanded\def\prependtocommalist#1#2% +\protected\def\prependtocommalist#1#2% {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}} -\unexpanded\def\addtocommalist#1#2% {item} \cs +\protected\def\addtocommalist#1#2% {item} \cs {\rawdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}} -\unexpanded\def\pretocommalist#1#2% {item} \cs +\protected\def\pretocommalist#1#2% {item} \cs {\rawdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}} -\unexpanded\def\robustdoifelseinset#1#2% +\protected\def\robustdoifelseinset#1#2% {\edef\m_syst_string_one{\detokenize\expandafter{\normalexpanded{#1}}}% \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#2}}}% \rawdoifelseinset\m_syst_string_one\m_syst_string_two} \let\robustdoifinsetelse\robustdoifelseinset -\unexpanded\def\robustaddtocommalist#1#2% {item} \cs +\protected\def\robustaddtocommalist#1#2% {item} \cs {\robustdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}} -\unexpanded\def\robustpretocommalist#1#2% {item} \cs +\protected\def\robustpretocommalist#1#2% {item} \cs {\robustdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}} -\unexpanded\def\xsplitstring#1#2% \cs {str} +\protected\def\xsplitstring#1#2% \cs {str} {\def\syst_helpers_split_string##1,#2,##2,#2,##3\\% {\edef\m_syst_string_one{\bcleanedupcommalist##1\empty\empty\relax}% \edef\m_syst_string_two{\acleanedupcommalist##2,,\relax}}% @@ -5987,7 +5987,7 @@ \def\bcleanedupcommalist#1#2\relax{\if#1,\else#1\fi#2} \def\acleanedupcommalist#1,,#2\relax{#1} -\unexpanded\def\removefromcommalist#1#2% to be sped up +\protected\def\removefromcommalist#1#2% to be sped up {\rawdoifelseinset{#1}#2% {\normalexpanded{\xsplitstring\noexpand#2{#1}}% \dodoglobal\edef#2% @@ -5998,10 +5998,10 @@ \fi}} \resetglobal} -% \unexpanded\def\addtocommalist#1#2% upto 3 times slower +% \protected\def\addtocommalist#1#2% upto 3 times slower % {\dodoglobal\edef#2{\ctxcommand{addtocommalist(\!!bs#1\!!es,\!!bs#2\!!es)}}} % -% \unexpanded\def\removefromcommalist#1#2% faster and more robust +% \protected\def\removefromcommalist#1#2% faster and more robust % {\dodoglobal\edef#2{\ctxcommand{addtocommalist(\!!bs#1\!!es,\!!bs#2\!!es)}}} %D \macros @@ -6023,7 +6023,7 @@ \edef\m_syst_string_four{\ifx\m_syst_string_four\empty\else\m_syst_string_four,\fi#1}% \fi} -\unexpanded\def\substituteincommalist#1#2#3% old, new, list (slooow) +\protected\def\substituteincommalist#1#2#3% old, new, list (slooow) {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \let\m_syst_string_four\empty @@ -6086,7 +6086,7 @@ \fi \advance\commalistcounter\plusone} -\unexpanded\def\replaceincommalist#1#2% #1 = commalistelement #2 = position starts at 1 +\protected\def\replaceincommalist#1#2% #1 = commalistelement #2 = position starts at 1 {\c_syst_helpers_comma_list_index#2\relax \let\m_syst_helpers_comma_list_target\empty \let\commalistelement\empty @@ -6110,7 +6110,7 @@ \expandafter\syst_helpers_comma_list_command_global_step \fi} -\unexpanded\def\globalprocesscommalist[#1]#2% +\protected\def\globalprocesscommalist[#1]#2% {\glet\m_syst_helpers_comma_list_command_global#2% \expandafter\syst_helpers_comma_list_command_global_step#1,],} @@ -6167,13 +6167,13 @@ \newcount\c_syst_helpers_swapped \let \m_syst_helpers_swapped\relax -\unexpanded\def\swapdimens#1#2{\d_syst_helpers_swapped #1\relax#1#2\relax#2\d_syst_helpers_swapped} -\unexpanded\def\swapcounts#1#2{\c_syst_helpers_swapped #1\relax#1#2\relax#2\c_syst_helpers_swapped} -\unexpanded\def\swapmacros#1#2{\let\m_syst_helpers_swapped#1\let #1#2\let #2\m_syst_helpers_swapped} +\protected\def\swapdimens#1#2{\d_syst_helpers_swapped #1\relax#1#2\relax#2\d_syst_helpers_swapped} +\protected\def\swapcounts#1#2{\c_syst_helpers_swapped #1\relax#1#2\relax#2\c_syst_helpers_swapped} +\protected\def\swapmacros#1#2{\let\m_syst_helpers_swapped#1\let #1#2\let #2\m_syst_helpers_swapped} -\unexpanded\def\globalswapdimens#1#2{\d_syst_helpers_swapped #1\global#1#2\global#2\d_syst_helpers_swapped} -\unexpanded\def\globalswapcounts#1#2{\c_syst_helpers_swapped #1\global#1#2\global#2\c_syst_helpers_swapped} -\unexpanded\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet #1#2\glet #2\m_syst_helpers_swapped} +\protected\def\globalswapdimens#1#2{\d_syst_helpers_swapped #1\global#1#2\global#2\d_syst_helpers_swapped} +\protected\def\globalswapcounts#1#2{\c_syst_helpers_swapped #1\global#1#2\global#2\c_syst_helpers_swapped} +\protected\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet #1#2\glet #2\m_syst_helpers_swapped} %D \macros %D {pushmacro,popmacro} @@ -6192,7 +6192,7 @@ % \let\m_syst_helpers_push_macro\empty % -% \unexpanded\def\globalpushmacro#1% +% \protected\def\globalpushmacro#1% % {\xdef\m_syst_helpers_push_macro{\string#1}% % \ifcsname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \else % \expandafter\newcount\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname @@ -6200,12 +6200,12 @@ % \global\advance\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \plusone % \expandafter\glet\csname\the\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname\m_syst_helpers_push_macro\endcsname#1} % -% \unexpanded\def\globalpopmacro#1% +% \protected\def\globalpopmacro#1% % {\xdef\m_syst_helpers_push_macro{\string#1}% % \expandafter\glet\expandafter#1\csname\the\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname\m_syst_helpers_push_macro\endcsname % \global\advance\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \minusone} % -% \unexpanded\def\localpushmacro#1% this one can be used to push a value over an \egroup +% \protected\def\localpushmacro#1% this one can be used to push a value over an \egroup % {\xdef\m_syst_helpers_push_macro{\string#1}% % \ifcsname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \else % \expandafter\newcount\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname @@ -6213,7 +6213,7 @@ % \global\advance\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \plusone % \expandafter\glet\csname\the\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname\m_syst_helpers_push_macro\endcsname#1} % -% \unexpanded\def\localpopmacro#1% +% \protected\def\localpopmacro#1% % {\xdef\m_syst_helpers_push_macro{\string#1}% % \expandafter\let\expandafter#1\csname\the\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname\m_syst_helpers_push_macro\endcsname % \global\advance\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \minusone } @@ -6237,7 +6237,7 @@ {\expandafter\newcount\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname\plusone} -\unexpanded\def\globalpushmacro#1% +\protected\def\globalpushmacro#1% {\xdef\m_syst_helpers_push_macro{\csstring#1}% \ifcsname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\lastnamedcs\plusone @@ -6246,7 +6246,7 @@ \fi \expandafter\glet\csname\the\lastnamedcs\m_syst_helpers_push_macro\endcsname#1} -\unexpanded\def\localpushmacro#1% this one can be used to push a value over an \egroup +\protected\def\localpushmacro#1% this one can be used to push a value over an \egroup {\xdef\m_syst_helpers_push_macro{\csstring#1}% \ifcsname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\lastnamedcs\plusone @@ -6255,13 +6255,13 @@ \fi \expandafter\glet\csname\the\lastnamedcs\m_syst_helpers_push_macro\endcsname#1} -\unexpanded\def\globalpopmacro#1% +\protected\def\globalpopmacro#1% {\xdef\m_syst_helpers_push_macro{\csstring#1}% \c_syst_helpers_pop_count\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\lastnamedcs \minusone \expandafter\glet\expandafter#1\csname\the\c_syst_helpers_pop_count\m_syst_helpers_push_macro\endcsname} -\unexpanded\def\localpopmacro#1% +\protected\def\localpopmacro#1% {\xdef\m_syst_helpers_push_macro{\csstring#1}% \c_syst_helpers_pop_count\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\lastnamedcs \minusone @@ -6288,7 +6288,7 @@ \newdimen\localhsize -\unexpanded\def\setlocalhsize % don't change ! +\protected\def\setlocalhsize % don't change ! {\doifelsenextoptional \syst_helpers_set_local_hsize_yes \syst_helpers_set_local_hsize_nop} @@ -6324,7 +6324,7 @@ %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% +\protected\def\doifvalue#1#2% {\edef\m_syst_string_one{\csname#1\endcsname}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -6333,7 +6333,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotvalue#1#2% +\protected\def\doifnotvalue#1#2% {\edef\m_syst_string_one{\csname#1\endcsname}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -6342,7 +6342,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsevalue#1#2% +\protected\def\doifelsevalue#1#2% {\edef\m_syst_string_one{\csname#1\endcsname}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -6351,7 +6351,7 @@ \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifnothing#1% +\protected\def\doifnothing#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\firstofoneargument @@ -6359,7 +6359,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifsomething#1% +\protected\def\doifsomething#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument @@ -6367,7 +6367,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsenothing#1% +\protected\def\doifelsenothing#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments @@ -6375,7 +6375,7 @@ \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifelsesomething#1% +\protected\def\doifelsesomething#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\secondoftwoarguments @@ -6383,7 +6383,7 @@ \expandafter\firstoftwoarguments \fi} -\unexpanded\def\doifvaluenothing#1% +\protected\def\doifvaluenothing#1% {\edef\m_syst_string_one{\csname#1\endcsname}% \ifx\m_syst_string_one\empty \expandafter\firstofoneargument @@ -6391,7 +6391,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifvaluesomething#1% +\protected\def\doifvaluesomething#1% {\edef\m_syst_string_one{\csname#1\endcsname}% \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument @@ -6399,7 +6399,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsevaluenothing#1% +\protected\def\doifelsevaluenothing#1% {\edef\m_syst_string_one{\csname#1\endcsname}% \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments @@ -6454,9 +6454,9 @@ \processcommalist[#3]\syst_helpers_do_common_check_all \ifdone\expandafter#1\else\expandafter#2\fi} -\unexpanded\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments} -\unexpanded\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument } -\unexpanded\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments } +\protected\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments} +\protected\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument } +\protected\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments } \let\doifallcommonelse\doifelseallcommon @@ -6479,38 +6479,38 @@ %D These might end up as \LUA based helpers (i.e. consider these %D obsolete: -\unexpanded\def\syst_helpers_do_IF#1#2% +\protected\def\syst_helpers_do_IF#1#2% {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\syst_helpers_do_IF_NOT#1#2% +\protected\def\syst_helpers_do_IF_NOT#1#2% {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}% \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\unexpanded\def\syst_helpers_do_IF_ELSE#1#2% +\protected\def\syst_helpers_do_IF_ELSE#1#2% {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\syst_helpers_do_IF_INSTRING_ELSE#1#2% +\protected\def\syst_helpers_do_IF_INSTRING_ELSE#1#2% {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\DOIF #1#2{\normalexpanded{\syst_helpers_do_IF {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFNOT #1#2{\normalexpanded{\syst_helpers_do_IF_NOT {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFELSE #1#2{\normalexpanded{\syst_helpers_do_IF_ELSE {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\syst_helpers_do_IF_INSTRING_ELSE{#1}{#2}}}% will become obsolete +\protected\def\DOIF #1#2{\normalexpanded{\syst_helpers_do_IF {#1}{#2}}}% will become obsolete +\protected\def\DOIFNOT #1#2{\normalexpanded{\syst_helpers_do_IF_NOT {#1}{#2}}}% will become obsolete +\protected\def\DOIFELSE #1#2{\normalexpanded{\syst_helpers_do_IF_ELSE {#1}{#2}}}% will become obsolete +\protected\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\syst_helpers_do_IF_INSTRING_ELSE{#1}{#2}}}% will become obsolete %D \macros %D {dosingleargumentwithset, @@ -6535,7 +6535,7 @@ %D \def\dodefinesomething[#1][#2]% %D {\getparameters[\??xx#1][#2]} %D -%D \unexpanded\def\definesomething% +%D \protected\def\definesomething% %D {\dodoubleargumentwithset\dodefinesomething} %D \stoptyping %D @@ -6589,7 +6589,7 @@ \let\m_syst_helpers_strip_character\empty -\unexpanded\def\stripcharacter#1\from#2\to#3% +\protected\def\stripcharacter#1\from#2\to#3% {\def\syst_helpers_strip_character##1#1##2\end {\edef\m_syst_helpers_strip_character{\m_syst_helpers_strip_character##1}% \doifnotempty{##2}{\syst_helpers_strip_character##2\end}}% @@ -6598,7 +6598,7 @@ \expandafter\syst_helpers_strip_character\m_syst_string_one#1\end \dodoglobal\let#3\m_syst_helpers_strip_character} -\unexpanded\def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2 +\protected\def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2 {\stripcharacter{ }\from#1\to#2} %D \macros @@ -6607,7 +6607,7 @@ %D The next macro does the same but is more compatible with other macros, like \type %D {\convert...}. -\unexpanded\def\unspacestring#1\to#2% +\protected\def\unspacestring#1\to#2% {\stripcharacter{ }\from#1\to#2} %D \macros @@ -6712,7 +6712,7 @@ \syst_helpers_process_separated_list_step}% \expandafter\syst_helpers_process_separated_list_step\gobbleoneargument#1#3]#3} -\unexpanded\def\processseparatedlist[% +\protected\def\processseparatedlist[% {\syst_helpers_process_separated_list\relax} %D \macros @@ -6735,7 +6735,7 @@ \let\syst_helpers_process_any_list_indeed\relax \let\syst_helpers_process_any_list_step \relax -\unexpanded\def\processlist#1#2#3#4% no blank skipping ! +\protected\def\processlist#1#2#3#4% no blank skipping ! {\def\syst_helpers_process_any_list_indeed##1#2% {\def\syst_helpers_process_any_list_step####1####2#3% {\ifx#2####1% @@ -6764,7 +6764,7 @@ %D This command can be integrated in \type {\getparameters}, but we decided best not %D to do so. -\unexpanded\def\processassignlist#1[#2]#3% +\protected\def\processassignlist#1[#2]#3% {\def\syst_helpers_process_assign_list_assign[##1=##2=##3]% {\doif{##3}\relax{#3{##1}}}% \def\syst_helpers_process_assign_list_step##1% @@ -6787,7 +6787,7 @@ \let\m_syst_helpers_untexed\empty -\unexpanded\def\untexsomething +\protected\def\untexsomething {\begingroup \catcode\leftbraceasciicode \ignorecatcode \catcode\rightbraceasciicode\ignorecatcode @@ -6799,8 +6799,8 @@ \endgroup \let#3\m_syst_helpers_untexed} -\unexpanded\def\untexargument{\untexsomething\convertargument} -\unexpanded\def\untexcommand {\untexsomething\convertcommand} +\protected\def\untexargument{\untexsomething\convertargument} +\protected\def\untexcommand {\untexsomething\convertcommand} %D \macros %D {ScaledPointsToBigPoints,ScaledPointsToWholeBigPoints} @@ -6816,16 +6816,16 @@ %D %D In pure \TEX: -% \unexpanded\def\PointsToBigPoints#1#2% +% \protected\def\PointsToBigPoints#1#2% % {\edef#2{\withoutpt\the\dimexpr.996264\dimexpr#1\relax\relax}} % -% \unexpanded\def\PointsToWholeBigPoints#1#2% +% \protected\def\PointsToWholeBigPoints#1#2% % {\edef#2{\the\numexpr\dimexpr.996264\dimexpr#1\relax\relax/\maxcard\relax}} % -% \unexpanded\def\ScaledPointsToBigPoints#1% % #2 +% \protected\def\ScaledPointsToBigPoints#1% % #2 % {\PointsToBigPoints{\number#1\scaledpoint}} % {#2} % -% \unexpanded\def\ScaledPointsToWholeBigPoints#1% % #2 +% \protected\def\ScaledPointsToWholeBigPoints#1% % #2 % {\PointsToWholeBigPoints{\number#1\scaledpoint}} % {#2} %D This is slower but cleaner and more accurate too. The only place these are still @@ -6834,10 +6834,10 @@ \let\tobigpoints \clf_tobigpoints \let\towholebigpoints\clf_towholebigpoints -\unexpanded\def\PointsToBigPoints #1#2{\edef#2{\tobigpoints #1}} % can be avoided -\unexpanded\def\PointsToWholeBigPoints #1#2{\edef#2{\towholebigpoints#1}} % can be avoided -\unexpanded\def\ScaledPointsToBigPoints #1#2{\edef#2{\tobigpoints #1\scaledpoint}} % obsolete -\unexpanded\def\ScaledPointsToWholeBigPoints#1#2{\edef#2{\towholebigpoints#1\scaledpoint}} % obsolete +\protected\def\PointsToBigPoints #1#2{\edef#2{\tobigpoints #1}} % can be avoided +\protected\def\PointsToWholeBigPoints #1#2{\edef#2{\towholebigpoints#1}} % can be avoided +\protected\def\ScaledPointsToBigPoints #1#2{\edef#2{\tobigpoints #1\scaledpoint}} % obsolete +\protected\def\ScaledPointsToWholeBigPoints#1#2{\edef#2{\towholebigpoints#1\scaledpoint}} % obsolete %D \macros %D {PointsToReal} @@ -6849,7 +6849,7 @@ %D \PointsToReal {dimension} \target %D \stoptyping -\unexpanded\def\PointsToReal#1#2% +\protected\def\PointsToReal#1#2% {\edef#2{\withoutpt\the\dimexpr#1}} %D \macros @@ -6884,7 +6884,7 @@ %D \starttyping %D \newbox\b_syst_helpers_dlh %D -%D \unexpanded\def\dontleavehmode +%D \protected\def\dontleavehmode %D {\ifhmode\else \ifmmode\else %D \setbox\b_syst_helpers_dlh\hbox{\mathsurround\zeropoint\everymath\emptytoks$ $}\unhbox\b_syst_helpers_dlh %D \fi \fi} @@ -6906,10 +6906,10 @@ %D %D The first argument may be a \type{\macro}. -% \unexpanded\def\uppercasestring#1\to#2% +% \protected\def\uppercasestring#1\to#2% % {\uppercase\expandafter{\expandafter\dodoglobal\expandafter\edef\expandafter#2\expandafter{\normalexpanded{#1}}}} % -% \unexpanded\def\lowercasestring#1\to#2% +% \protected\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 way. But @@ -6918,8 +6918,8 @@ \def\utfupper#1{\clf_upper{#1}} % expandable \def\utflower#1{\clf_lower{#1}} % expandable -\unexpanded\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}} -\unexpanded\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}} +\protected\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}} +\protected\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}} %D \macros %D {handletokens} @@ -6964,14 +6964,14 @@ \expandafter\syst_helpers_count_token \fi} -\unexpanded\def\counttoken#1\in#2\to#3% +\protected\def\counttoken#1\in#2\to#3% {\privatescratchcounter\zerocount \def\m_syst_string_one{#1}% \def\m_syst_string_two{\end}% \syst_helpers_count_token#2\end \dodoglobal#3\privatescratchcounter} -\unexpanded\def\counttokens#1\to#2% +\protected\def\counttokens#1\to#2% {\privatescratchcounter\zerocount \def\syst_helpers_count_token##1{\advance\privatescratchcounter\plusone}% \handletokens#1\with\syst_helpers_count_token @@ -6983,7 +6983,7 @@ %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 +\protected\def\splitofftokens#1\from#2\to#3% slow but hardly used {\ifnum#1>\zerocount \privatescratchcounter#1\relax \def\syst_helpers_split_off_tokens##1% @@ -7027,7 +7027,7 @@ %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 +\protected\def\syst_helpers_handle_tokens % \nexthandledtoken is part of interface {\futurelet\nexthandledtoken\syst_helpers_handle_tokens_indeed} \def\handletokens#1\with#2% @@ -7079,8 +7079,8 @@ \newtoks\everysettrialtypesetting \newtoks\everyresettrialtypesetting -\unexpanded\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so -\unexpanded\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed +\protected\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so +\protected\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed \let\iftrialtypesetting\iffalse % so we have no \trialtypesettingtrue|false in mkiv ! @@ -7119,15 +7119,15 @@ %D This macro is first used in the tabulation macros. %D %D \starttyping -%D \unexpanded\def\starthans% +%D \protected\def\starthans% %D {\processcontent{stophans}\test{\message{\test}\wait}} %D \stoptyping -\unexpanded\def\processcontent#1% +\protected\def\processcontent#1% {\begingroup\expandafter\syst_helpers_process_content\csname#1\endcsname} -\unexpanded\def\syst_helpers_process_content#1#2#3% - {\unexpanded\def\syst_helpers_process_content##1#1% +\protected\def\syst_helpers_process_content#1#2#3% + {\protected\def\syst_helpers_process_content##1#1% {\endgroup\def#2{##1}#3}% \syst_helpers_process_content} @@ -7173,10 +7173,10 @@ %D As an alternative for the next macro we can use a global assignment inside a box. %D The \type {\empty}'s permits gobbling while preventing spurious \type {\relax}'s. -\unexpanded\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick +\protected\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick {\afterassignment\gobblefourarguments#1=#2#3pt\relax\empty\empty\empty\empty} -\unexpanded\def\freezedimensionwithunit#1#2% +\protected\def\freezedimensionwithunit#1#2% {\setdimensionwithunit\privatescratchdimen#1{#2}\edef#1{\the\privatescratchdimen}} %D \macros @@ -7184,7 +7184,7 @@ %D %D Not that fast I guess, but here's a way to test for token registers being empty. -\unexpanded\def\doifelsesometoks#1% +\protected\def\doifelsesometoks#1% {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok \ifx\m_syst_string_one\empty \expandafter\secondoftwoarguments @@ -7192,7 +7192,7 @@ \expandafter\firstoftwoarguments \fi} -\unexpanded\def\doifsometoks#1% +\protected\def\doifsometoks#1% {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument @@ -7200,7 +7200,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifemptytoks#1% +\protected\def\doifemptytoks#1% {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok \ifx\m_syst_string_one\empty \expandafter\firstofoneargument @@ -7224,7 +7224,7 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\strictdoifelsenextoptional#1#2% +\protected\def\strictdoifelsenextoptional#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% \futurelet\nexttoken\syst_helpers_strict_inspect_next_character} @@ -7273,7 +7273,7 @@ \def\syst_helpers_serialize_comma_list_step#1% {\edef\serializedcommalist{\serializedcommalist#1}} -\unexpanded\def\serializecommalist[#1]% +\protected\def\serializecommalist[#1]% {\let\serializedcommalist\empty \processcommacommand[#1]\syst_helpers_serialize_comma_list_step} @@ -7368,22 +7368,22 @@ \installsystemnamespace{measure} -\unexpanded\def\definemeasure +\protected\def\definemeasure {\dodoubleargument\syst_helpers_define_measure} \def\syst_helpers_define_measure[#1][#2]% {\expandafter\def\csname\??measure#1\endcsname{#2}} -\unexpanded\def\freezemeasure +\protected\def\freezemeasure {\dodoubleargument\syst_helpers_freeze_measure} \def\syst_helpers_freeze_measure[#1][#2]% {\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} -\unexpanded\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way -\unexpanded\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way -\unexpanded\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way -\unexpanded\def\setxmeasure#1#2{\expandafter\xdef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way +\protected\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way +\protected\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way +\protected\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way +\protected\def\setxmeasure#1#2{\expandafter\xdef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way \def\measure {\the\measured} @@ -7408,22 +7408,22 @@ \installsystemnamespace{quantity} -\unexpanded\def\definequantity +\protected\def\definequantity {\dodoubleargument\syst_helpers_define_quantity} \def\syst_helpers_define_quantity[#1][#2]% {\expandafter\def\csname\??quantity#1\endcsname{#2}} -\unexpanded\def\freezequantity +\protected\def\freezequantity {\dodoubleargument\syst_helpers_freeze_quantity} \def\syst_helpers_freeze_quantity[#1][#2]% {\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} -\unexpanded\def\setquantity #1#2{\expandafter\def \csname\??quantity#1\endcsname{#2}} % quick way -\unexpanded\def\setgquantity#1#2{\expandafter\gdef\csname\??quantity#1\endcsname{#2}} % quick way -\unexpanded\def\setequantity#1#2{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way -\unexpanded\def\setxquantity#1#2{\expandafter\xdef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way +\protected\def\setquantity #1#2{\expandafter\def \csname\??quantity#1\endcsname{#2}} % quick way +\protected\def\setgquantity#1#2{\expandafter\gdef\csname\??quantity#1\endcsname{#2}} % quick way +\protected\def\setequantity#1#2{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way +\protected\def\setxquantity#1#2{\expandafter\xdef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way \def\quantity {\the\quantitied} @@ -7577,19 +7577,19 @@ % \copycsname xxx\endcsname\csname ..\endcsname -\unexpanded\def\copycsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter\csname} +\protected\def\copycsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter\csname} % \letcscsname \crap \csname ..\endcsname % \letcsnamecs \csname ..\endcsname\crap % \letcsnamecsname\csname ..\endcsname\csname ..\endcsname -\unexpanded\def\letcscsname {\expandafter\let\expandafter} -\unexpanded\def\letcsnamecs {\expandafter\let} -\unexpanded\def\letcsnamecsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter} +\protected\def\letcscsname {\expandafter\let\expandafter} +\protected\def\letcsnamecs {\expandafter\let} +\protected\def\letcsnamecsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter} % another one, add an item to a commalist -\unexpanded\def\addvalue#1#2% cs item +\protected\def\addvalue#1#2% cs item {\ifcsname#1\endcsname\else\expandafter\let\csname#1\endcsname\empty\fi \normalexpanded{\noexpand\addtocommalist{#2}\expandafter\noexpand\csname#1\endcsname}} @@ -7604,25 +7604,25 @@ \fi \syst_helpers_unspaced} -\unexpanded\def\unspaceargument#1\to#2% +\protected\def\unspaceargument#1\to#2% {\privatescratchcounter\catcode\spaceasciicode \catcode\spaceasciicode\ignorecatcode \scantextokens{\edef#2{#1}}% \catcode\spaceasciicode\privatescratchcounter} -\unexpanded\def\unspaceafter#1#2% +\protected\def\unspaceafter#1#2% {\unspaceargument#2\to\ascii \expandafter#1\expandafter{\ascii}} % sometimes handy: -\unexpanded\def\doifelsehasspace#1% +\protected\def\doifelsehasspace#1% {\edef\m_syst_string_one{#1}% \normalexpanded{\syst_helpers_if_has_space_else#1\space}\empty\relax} \let\doifhasspaceelse\doifelsehasspace -\unexpanded\def\syst_helpers_if_has_space_else#1 #2#3\relax % \space\empty\relax +\protected\def\syst_helpers_if_has_space_else#1 #2#3\relax % \space\empty\relax {\ifx\m_syst_string_one\space \expandafter\firstoftwoarguments \else\ifx#2\empty @@ -7635,8 +7635,8 @@ \installsystemnamespace{flag} -\unexpanded\def\setflag #1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\zerocount} -\unexpanded\def\resetflag#1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\plusone} +\protected\def\setflag #1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\zerocount} +\protected\def\resetflag#1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\plusone} \def\flag#1{\csname\??flag#1\endcsname} @@ -7660,7 +7660,7 @@ \doubleexpandafter\firstofoneargument \fi\fi} -\unexpanded\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey +\protected\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey {\expandafter\def\csname#1#3\expandafter\endcsname\expandafter{\csname#1#5\endcsname}} \def\syst_helpers_if_non_zero_positive_else#1#2\end % #3#4% @@ -7686,36 +7686,36 @@ % here ? -\unexpanded\def\dosetrawvalue #1#2#3{\expandafter \def\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawevalue#1#2#3{\expandafter\edef\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawgvalue#1#2#3{\expandafter\gdef\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawxvalue#1#2#3{\expandafter\xdef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawvalue #1#2#3{\expandafter \def\csname#1#2\endcsname{#3}} +\protected\def\dosetrawevalue#1#2#3{\expandafter\edef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawgvalue#1#2#3{\expandafter\gdef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawxvalue#1#2#3{\expandafter\xdef\csname#1#2\endcsname{#3}} -\unexpanded\def\getrawparameters {\dogetparameters\dosetrawvalue } -\unexpanded\def\getraweparameters {\dogetparameters\dosetrawevalue} -\unexpanded\def\getrawgparameters {\dogetparameters\dosetrawgvalue} -\unexpanded\def\getrawxparameters {\dogetparameters\dosetrawxvalue} +\protected\def\getrawparameters {\dogetparameters\dosetrawvalue } +\protected\def\getraweparameters {\dogetparameters\dosetrawevalue} +\protected\def\getrawgparameters {\dogetparameters\dosetrawgvalue} +\protected\def\getrawxparameters {\dogetparameters\dosetrawxvalue} -\unexpanded\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete +\protected\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete %D Sort of obsolete: \newcount\c_syst_helpers_mod -\unexpanded\def\dosetmodulo#1#2#3% +\protected\def\dosetmodulo#1#2#3% {\c_syst_helpers_mod#1\divide\c_syst_helpers_mod#2\multiply\c_syst_helpers_mod#2% #3#1\advance#3-\c_syst_helpers_mod} -\unexpanded\def\dosetdivision#1#2#3% +\protected\def\dosetdivision#1#2#3% {#3#1\divide#3 #2\relax} -\unexpanded\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}} -\unexpanded\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}} +\protected\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}} +\protected\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}} \def\syst_helpers_unprotected#1\par {#1\protect} -\unexpanded\def\unprotected +\protected\def\unprotected {\unprotect \syst_helpers_unprotected} @@ -7725,7 +7725,7 @@ \let\elapsedsteps\!!zerocount -\unexpanded\def\elapsedsteptime % unexpanded ! a bit useless but who knows ... +\protected\def\elapsedsteptime % unexpanded ! a bit useless but who knows ... {\clf_elapsedsteptime\elapsedsteps\relax} \newcount\c_syst_helpers_test_feature_n @@ -7733,7 +7733,7 @@ \def\currentfeaturetest{\number\c_syst_helpers_test_feature_n} -\unexpanded\def\testfeature#1#2% +\protected\def\testfeature#1#2% {\c_syst_helpers_test_feature_m#1\relax \xdef\elapsedsteps{\number\c_syst_helpers_test_feature_m}% \def\syst_helpers_test_feature_yes @@ -7748,7 +7748,7 @@ \fi}% \retestfeature} -\unexpanded\def\retestfeature % timer support is new per 10/5/2005 +\protected\def\retestfeature % timer support is new per 10/5/2005 {\bgroup \ifcase\interactionmode\let\wait\relax\fi \clf_resettimer @@ -7762,10 +7762,10 @@ \wait \egroup} -\unexpanded\def\showtimer#1% +\protected\def\showtimer#1% {\writestatus{runtime}{\elapsedseconds\space s / #1}} -\unexpanded\def\testfeatureonce#1#2% +\protected\def\testfeatureonce#1#2% {\begingroup \let\wait\relax \testfeature{#1}{#2}% @@ -7780,7 +7780,7 @@ %D \freezedimenmacro\leftmargindistance %D \stoptyping -\unexpanded\def\freezedimenmacro#1% +\protected\def\freezedimenmacro#1% {\edef#1{\the\dimexpr#1}} %D The next macro negates a macro (dimension or number, or actually, whatever. It's @@ -7798,17 +7798,17 @@ \def\assigndimen#1#2% {\afterassignment\gobbleassigndimen#1=#2\zeropoint\\} -\unexpanded\def\appended#1#2#3{\expandafter#1\expandafter#2\expandafter{#2#3}} -\unexpanded\def\appendvalue #1{\expandafter\appended\expandafter \def\csname#1\endcsname} -\unexpanded\def\appendgvalue#1{\expandafter\appended\expandafter\gdef\csname#1\endcsname} +\protected\def\appended#1#2#3{\expandafter#1\expandafter#2\expandafter{#2#3}} +\protected\def\appendvalue #1{\expandafter\appended\expandafter \def\csname#1\endcsname} +\protected\def\appendgvalue#1{\expandafter\appended\expandafter\gdef\csname#1\endcsname} -\unexpanded\def\prepended#1#2#3% +\protected\def\prepended#1#2#3% {\t_syst_helpers_scratch{#3}% \expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter#2\expandafter\expandafter\expandafter {\expandafter\the\expandafter\t_syst_helpers_scratch#2}} -\unexpanded\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname} -\unexpanded\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname} +\protected\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname} +\protected\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname} %D \macros %D {dowithrange} @@ -7830,11 +7830,11 @@ \ifx\m_syst_helpers_range_to\empty\let\m_syst_helpers_range_to\m_syst_helpers_range_from\fi \dostepwiserecurse\m_syst_helpers_range_from\m_syst_helpers_range_to\plusone{\m_helpers_range_action{##1}}}% -\unexpanded\def\processranges[#1]#2% #1= n:m,p,q:r +\protected\def\processranges[#1]#2% #1= n:m,p,q:r {\def\m_helpers_range_action{#2}% \processcommacommand[#1]\syst_helpers_with_range} -\unexpanded\def\dowithrange#1#2% +\protected\def\dowithrange#1#2% {\def\m_helpers_range_action{#2}% \processcommacommand[#1]\syst_helpers_with_range} @@ -7853,7 +7853,7 @@ %D %D \typebuffer \getbuffer -\unexpanded\def\ignoreimplicitspaces +\protected\def\ignoreimplicitspaces {\doifelsenextchar\relax\relax\relax} %D \macros @@ -7880,11 +7880,11 @@ \newbox\b_syst_helpers_no_interference -\unexpanded\def\startnointerference % not even grouped ! +\protected\def\startnointerference % not even grouped ! {\setbox\b_syst_helpers_no_interference\vbox \bgroup} -\unexpanded\def\stopnointerference +\protected\def\stopnointerference {\egroup \setbox\b_syst_helpers_no_interference\emptybox} @@ -7899,9 +7899,9 @@ %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 +\protected\def\signalcharacter{\char\zerocount} % \zwj -% \unexpanded\def\signalcharacter +% \protected\def\signalcharacter % {\scratchcounter\normallanguage % \normallanguage\zerocount % \char\zerocount @@ -8067,7 +8067,7 @@ % {title} {\texdefinition{btx:apa:title-subtitle-type}} % {default} {\btxflush{author}} -% \unexpanded\def\doifcase#1% +% \protected\def\doifcase#1% % {\edef\m_case_asked{#1}% % \syst_aux_case} % @@ -8114,8 +8114,8 @@ %D Not that useful: -% \unexpanded\def\doifelsestringbefore{\clf_doifelsestringbefore} -% \unexpanded\def\doifelsestringafter {\clf_doifelsestringafter} +% \protected\def\doifelsestringbefore{\clf_doifelsestringbefore} +% \protected\def\doifelsestringafter {\clf_doifelsestringafter} % Could have been useful but not faster that addtocommalist and also expansion mess: % @@ -8123,30 +8123,30 @@ %D Experiment (sometimes looks nicer in code): -\unexpanded\def\sameargumentscondition#1#2% +\protected\def\sameargumentscondition#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two} -\unexpanded\def\emptyargumentcondition#1% +\protected\def\emptyargumentcondition#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty} -% \unexpanded\def\hascommonargumentcondition#1#2{\clf_hascommonargumentcondition{#1}{#2}} +% \protected\def\hascommonargumentcondition#1#2{\clf_hascommonargumentcondition{#1}{#2}} % \let\hascommonargumentcondition \clf_hascommonargumentcondition -% \unexpanded\def\hascommonargumentcondition{\clf_hascommonargumentcondition} +% \protected\def\hascommonargumentcondition{\clf_hascommonargumentcondition} \protect \endinput % \edef\choicetokenyes{+} % \edef\choicetokennop{-} % -% \unexpanded\def\startchoice#1% +% \protected\def\startchoice#1% % {\pushmacro\currentchoicevalue % \edef\currentchoicevalue{#1}% % \checkchoicetoken} % -% \unexpanded\def\checkchoicetoken#1% +% \protected\def\checkchoicetoken#1% % {\edef\choicetoken{#1}% % \ifx\choicetoken\choicetokenyes % \singleexpandafter\checkchoiceyes @@ -8231,7 +8231,7 @@ % % \showvalue{mylist} -% \unexpanded\def\showtokenlist#1% +% \protected\def\showtokenlist#1% % {\begingroup % \edef\tempstring{\the#1}% % \tx\ttbf\string#1: \tttf\meaning\tempstring @@ -8241,7 +8241,7 @@ % % \chardef\_E_O_T_0 % -% \unexpanded\def\doifelsetokens#1% +% \protected\def\doifelsetokens#1% % {\dodoifelsetokens#1\_E_O_T_\_e_o_t_} % % \def\dodoifelsetokens#1#2\_e_o_t_ diff --git a/tex/context/base/mkiv/syst-aux.mkxl b/tex/context/base/mkiv/syst-aux.mkxl index 6574ba9b0..a85560989 100644 --- a/tex/context/base/mkiv/syst-aux.mkxl +++ b/tex/context/base/mkiv/syst-aux.mkxl @@ -38,11 +38,12 @@ %D code. %D %D \starttyping -%D \unexpanded\def\somecommand{... ... ...} +%D \protected\def\somecommand{... ... ...} %D \stoptyping %D %D This overloads the \ETEX\ primitive but as we already had an \MKII\ solution we -%D keep the same name for a similar mechanism. +%D keep the same name for a similar mechanism. So, effectively we have two ways to +%D protect a macro. \let\unexpanded\normalprotected @@ -69,7 +70,7 @@ \fi -\unexpanded\def\installsystemnamespace#1% maybe move this to syst-ini +\protected\def\installsystemnamespace#1% maybe move this to syst-ini {\ifcsname ??#1\endcsname \writestatus\m!system{duplicate system namespace '#1'}\wait \else @@ -176,10 +177,10 @@ \let\m_syst_helpers_expanded\empty -\unexpanded\def\expanded#1% +\protected\def\expanded#1% {\xdef\m_syst_helpers_expanded{\noexpand#1}\m_syst_helpers_expanded} -\unexpanded\def\startexpanded#1\stopexpanded +\protected\def\startexpanded#1\stopexpanded {\xdef\m_syst_helpers_expanded{#1}\m_syst_helpers_expanded} \let\stopexpanded\relax @@ -248,12 +249,12 @@ \let\m_syst_action_yes\relax \let\m_syst_action_nop\relax -\unexpanded\def\doifelsenextchar#1#2#3% #1 should not be {} ! +\protected\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 {} ! +\protected\def\doifelsenextcharcs % #1#2#3% #1 should not be {} ! {\futureexpandis} \let\doifnextcharelse \doifelsenextchar @@ -268,29 +269,29 @@ %D reputations depends on understanding obscure macro definitions will love the more %D low level variants. -\unexpanded\def\doifelsenextoptional#1#2% +\protected\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 +\protected\def\doifelsenextoptionalcs {\futureexpandis[} \let\doifnextoptionalelse \doifelsenextoptional \let\doifnextoptionalcselse\doifelsenextoptionalcs -\unexpanded\def\doifelsenextbgroup#1#2% +\protected\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 +\protected\def\doifelsenextbgroupcs % #1#2 {\futureexpandis\bgroup} \let\doifnextbgroupelse \doifelsenextbgroup \let\doifnextbgroupcselse\doifelsenextbgroupcs -\unexpanded\def\doifelsenextparenthesis#1#2% +\protected\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} @@ -306,12 +307,12 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsefastoptionalcheck#1#2% +\protected\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 +\protected\def\doifelsefastoptionalcheckcs {\futureexpandis[} \let\doiffastoptionalcheckelse \doifelsefastoptionalcheck @@ -392,12 +393,12 @@ \def\undefinevalue#1{\expandafter\let \csname#1\endcsname\undefined} \def\ignorevalue#1#2{\expandafter\let \csname#1\endcsname\empty} -\def\setuvalue #1{\normalprotected\expandafter \def\csname#1\endcsname} -\def\setuevalue #1{\normalprotected\expandafter\edef\csname#1\endcsname} -\def\setugvalue #1{\normalprotected\expandafter\gdef\csname#1\endcsname} -\def\setuxvalue #1{\normalprotected\expandafter\xdef\csname#1\endcsname} +\def\setuvalue #1{\protected\expandafter \def\csname#1\endcsname} +\def\setuevalue #1{\protected\expandafter\edef\csname#1\endcsname} +\def\setugvalue #1{\protected\expandafter\gdef\csname#1\endcsname} +\def\setuxvalue #1{\protected\expandafter\xdef\csname#1\endcsname} -\unexpanded\def\getuvalue#1{\csname#1\endcsname} +\protected\def\getuvalue#1{\csname#1\endcsname} %D \macros %D {globallet,glet} @@ -477,13 +478,13 @@ %D {\undefined}! In \ETEX\ we have \type {\ifcsname} and that way of testing on %D existance is not the same as the one described here. Therefore we introduce: -\unexpanded\def\letbeundefined#1% +\protected\def\letbeundefined#1% {\expandafter\let\csname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue -\unexpanded\def\localundefine#1% conditional +\protected\def\localundefine#1% conditional {\ifcsname#1\endcsname\expandafter\let\csname#1\endcsname\undefined\fi} -\unexpanded\def\globalundefine#1% conditional +\protected\def\globalundefine#1% conditional {\ifcsname#1\endcsname\expandafter\glet\csname#1\endcsname\undefined\fi} %D Beware, being \type {\undefined} in \ETEX\ means that the macro {\em is} defined! @@ -492,7 +493,7 @@ %D behavior in text and math mode, which was due to this grouping subtilities. We %D therefore decided to use \type {\begingroup} instead of \type {\bgroup}. -\unexpanded\def\doifelsealldefined#1% +\protected\def\doifelsealldefined#1% {\begingroup \donetrue % we could use a reserved one and avoid the group \processcommalist[#1]\syst_helpers_do_if_all_defined_else @@ -531,21 +532,21 @@ %D \type {\edef}'s and \type {\ifx} comparison works as well, but this saves tokens %D and, more important, tracing clutter. -\unexpanded\def\doifelse#1#2% +\protected\def\doifelse#1#2% {\iftok{#1}{#2}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doif#1#2% +\protected\def\doif#1#2% {\iftok{#1}{#2}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnot#1#2% +\protected\def\doifnot#1#2% {\iftok{#1}{#2}% \expandafter\gobbleoneargument \else @@ -566,7 +567,7 @@ %D This time, the string is not expanded, but we use the dedicated empty checker %D here. -\unexpanded\def\doifelseempty#1% +\protected\def\doifelseempty#1% {\def\m_syst_string_one{#1}% \ifempty\m_syst_string_one \expandafter\firstoftwoarguments @@ -576,7 +577,7 @@ \let\doifemptyelse\doifelseempty -\unexpanded\def\doifempty#1% +\protected\def\doifempty#1% {\def\m_syst_string_one{#1}% \ifempty\m_syst_string_one \expandafter\firstofoneargument @@ -584,7 +585,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotempty#1% +\protected\def\doifnotempty#1% {\def\m_syst_string_one{#1}% \ifempty\m_syst_string_one \expandafter\gobbleoneargument @@ -641,21 +642,21 @@ % These don't accept spaces after commas: % -% \unexpanded\def\doifelseinset#1#2% +% \protected\def\doifelseinset#1#2% % {\ifhasxtoks{,#1,}{,#2,}% % \expandafter\firstoftwoarguments % \else % \expandafter\secondoftwoarguments % \fi} -% \unexpanded\def\doifinset#1#2% +% \protected\def\doifinset#1#2% % {\ifhasxtoks{,#1,}{,#2,}% % \expandafter\firstofoneargument % \else % \expandafter\gobbleoneargument % \fi} -% \unexpanded\def\doifnotinset#1#2% +% \protected\def\doifnotinset#1#2% % {\ifhasxtoks{,#1,}{,#2,}% % \expandafter\gobbleoneargument % \else @@ -669,21 +670,21 @@ \normalexpanded { - \unexpanded \def \noexpand \doifelseinset#1#2% + \protected \def \noexpand \doifelseinset#1#2% {\noexpand\ifhasxtoks{,\a!space#1,}{,#2,}% \noexpand\expandafter\noexpand\firstoftwoarguments \noexpand\else \noexpand\expandafter\noexpand\secondoftwoarguments \noexpand\fi} - \unexpanded \def \noexpand \doifinset#1#2% + \protected \def \noexpand \doifinset#1#2% {\noexpand\ifhasxtoks{,\a!space#1,}{,#2,}% \noexpand\expandafter\noexpand\firstofoneargument \noexpand\else \noexpand\expandafter\noexpand\gobbleoneargument \noexpand\fi} - \unexpanded \def \noexpand \doifnotinset#1#2% + \protected \def \noexpand \doifnotinset#1#2% {\noexpand\ifhasxtoks{,\a!space#1,}{,#2,}% \noexpand\expandafter\noexpand\gobbleoneargument \noexpand\else @@ -724,9 +725,9 @@ % !9yes=\doifcommonelse{,a,}{,,,a,}{yes}{nop} % !9yes=\doifcommonelse{,,a,}{,,,a,}{yes}{nop} -\unexpanded\def\doifelsecommon#1#2{\clf_doifelsecommon{#1}{#2}} -\unexpanded\def\doifcommon #1#2{\clf_doifcommon {#1}{#2}} -\unexpanded\def\doifnotcommon #1#2{\clf_doifnotcommon {#1}{#2}} +\protected\def\doifelsecommon#1#2{\clf_doifelsecommon{#1}{#2}} +\protected\def\doifcommon #1#2{\clf_doifcommon {#1}{#2}} +\protected\def\doifnotcommon #1#2{\clf_doifnotcommon {#1}{#2}} \let\doifcommonelse\doifelsecommon @@ -796,7 +797,7 @@ %D arguments state. Again it permits leaner and meaner macro definitions with a bit %D less clutter in tracing. -\unexpanded\def\syst_helpers_process_comma_item#1,% +\protected\def\syst_helpers_process_comma_item#1,% {\ifarguments \expandafter\syst_helpers_process_comma_item_gobble \or @@ -807,13 +808,13 @@ \def\syst_helpers_process_comma_item_next {\expandafterspaces\syst_helpers_process_comma_item} -\unexpanded\def\processcommalist[#1]#2% +\protected\def\processcommalist[#1]#2% {\pushmacro\commalistcommand \def\commalistcommand{#2}% \expandafterspaces\syst_helpers_process_comma_item#1,\ignorearguments\ignorearguments\ignorearguments \popmacro\commalistcommand} -\unexpanded\def\processcommacommand[#1]#2% +\protected\def\processcommacommand[#1]#2% {\pushmacro\commalistcommand \def\commalistcommand{#2}% \normalexpanded{\noexpand\expandafterspaces\syst_helpers_process_comma_item#1,}\ignorearguments\ignorearguments\ignorearguments @@ -829,8 +830,8 @@ \def\syst_helpers_process_comma_item_next_c#-\ignorearguments{\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_b} \def\syst_helpers_process_comma_item_gobble#-\ignorearguments{} -\unexpanded\def\quitcommalist {\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_b} -\unexpanded\def\quitprevcommalist{\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_c} +\protected\def\quitcommalist {\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_b} +\protected\def\quitprevcommalist{\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_c} %D \startbuffer %D \def\foo#1{(#1)} @@ -871,7 +872,7 @@ %D \def\command[#1]{... #1 ...} %D \stoptyping -\unexpanded\def\processcommalistwithparameters[#1]#2% +\protected\def\processcommalistwithparameters[#1]#2% {\def\syst_helpers_do_process_comma_list_with_parameters##1{#2[##1]}% \processcommalist[#1]\syst_helpers_do_process_comma_list_with_parameters} @@ -882,11 +883,11 @@ \let\syst_helpers_comma_list_step\relax -\unexpanded\def\startprocesscommalist[#1]#2\stopprocesscommalist +\protected\def\startprocesscommalist[#1]#2\stopprocesscommalist {\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}% \processcommalist[#1]\syst_helpers_comma_list_step} -\unexpanded\def\startprocesscommacommand[#1]#2\stopprocesscommacommand +\protected\def\startprocesscommacommand[#1]#2\stopprocesscommacommand {\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}% \normalexpanded{\processcommalist[#1]}\syst_helpers_comma_list_step} @@ -936,14 +937,14 @@ %D this more hip and a bit faster now but \unknown\ it's seldom used nowadays as we %D have better ways now. -\unexpanded\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% {\edef\m_syst_string_two{#1}% \ifx\m_syst_string_two\s!default \let\commalistelement\empty #2% \fi} -\unexpanded\def\syst_helpers_do_compare_process_action_b[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_b[#1=>#2][#3]% {\edef\m_syst_string_two{#1}% \ifx\m_syst_string_one\m_syst_string_two \def\commalistelement{#3}% @@ -954,7 +955,7 @@ #2% \fi} -\unexpanded\def\processaction[#1]#2[% +\protected\def\processaction[#1]#2[% {\edef\m_syst_string_one{#1}% \ifempty\m_syst_string_one \let\syst_helpers_do_compare_process_action\syst_helpers_do_compare_process_action_a @@ -964,7 +965,7 @@ \edef\syst_helpers_do_process_action##1{\syst_helpers_do_compare_process_action[##1][#1]}% expands #1 \processnextcommalist\relax\relax\syst_helpers_do_process_action[} -\unexpanded\def\syst_helpers_do_compare_process_action_c[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_c[#1=>#2][#3]% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#3}% \ifx\m_syst_string_one\m_syst_string_two @@ -979,7 +980,7 @@ \fi \fi} -\unexpanded\def\processfirstactioninset[#1]% +\protected\def\processfirstactioninset[#1]% {\edef\m_syst_string_one{#1}% \ifempty\m_syst_string_one \expandafter\processaction @@ -988,13 +989,13 @@ \fi [#1]} -\unexpanded\def\syst_helpers_process_first_action_in_set_indeed[#1]#2[#3]% +\protected\def\syst_helpers_process_first_action_in_set_indeed[#1]#2[#3]% {\def\syst_helpers_do_process_action##1% {\def\syst_helpers_do_do_process_action####1{\syst_helpers_do_compare_process_action_c[####1][##1]}% \processcommalist[#3]\syst_helpers_do_do_process_action}% \normalexpanded{\processcommalist[#1]}\syst_helpers_do_process_action} -\unexpanded\def\syst_helpers_do_compare_process_action_d[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_d[#1=>#2][#3]% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#3}% \ifx\m_syst_string_one\m_syst_string_two @@ -1009,7 +1010,7 @@ \fi \fi} -\unexpanded\def\syst_helpers_process_all_actions_in_set_indeed[#1]#2[#3]% +\protected\def\syst_helpers_process_all_actions_in_set_indeed[#1]#2[#3]% {\globalpushmacro\syst_process_action_in_set_all \def\syst_process_action_in_set##1% {\def\syst_process_action_in_set_one####1{\syst_helpers_do_compare_process_action_d[####1][##1]}% @@ -1017,7 +1018,7 @@ \processcommacommand[#1]\syst_process_action_in_set \globalpopmacro\syst_process_action_in_set_all} -\unexpanded\def\processallactionsinset[#1]% +\protected\def\processallactionsinset[#1]% {\edef\m_syst_string_one{#1}% \ifempty\m_syst_string_one \expandafter\processaction @@ -1028,7 +1029,7 @@ %D These macros use: -\unexpanded\def\processnextcommalist#1#2#3[#4#5]% +\protected\def\processnextcommalist#1#2#3[#4#5]% {#1\relax \pushmacro\commalistcommand \def\commalistcommand{#3}% @@ -1052,10 +1053,10 @@ \let\firstcharacter \empty \let\remainingcharacters\empty -\unexpanded\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}} -\unexpanded\def\doifelsefirstchar #1#2{\clf_doifelsefirstchar{#1}{#2}} -\unexpanded\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}} -\unexpanded\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}} +\protected\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}} +\protected\def\doifelsefirstchar #1#2{\clf_doifelsefirstchar{#1}{#2}} +\protected\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}} +\protected\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}} \let\doiffirstcharelse\doifelsefirstchar @@ -1096,7 +1097,7 @@ % % \let\m_syst_sub_string \empty % -% \unexpanded\def\doifelseinstring#1% +% \protected\def\doifelseinstring#1% % {\edef\m_syst_sub_string{#1}% expand #1 here % \ifempty\m_syst_sub_string % \expandafter\thirdofthreearguments @@ -1106,8 +1107,8 @@ % % \let\doifinstringelse\doifelseinstring % -% \unexpanded\def\syst_helpers_do_if_in_string_else#1% ##2 can be {abc} -% {\normalexpanded{\unexpanded\def\syst_helpers_do_do_if_in_string_else##1\m_syst_sub_string##2}% +% \protected\def\syst_helpers_do_if_in_string_else#1% ##2 can be {abc} +% {\normalexpanded{\protected\def\syst_helpers_do_do_if_in_string_else##1\m_syst_sub_string##2}% % {\ifarguments % \or % \expandafter\syst_helpers_do_if_in_string_else_nop @@ -1116,8 +1117,8 @@ % \fi}% % \normalexpanded{\syst_helpers_do_do_if_in_string_else#1}\e_o_t\ignorearguments\ignorearguments} % -% \unexpanded\def\syst_helpers_do_if_in_string_else_delimited#1% ##2 can be {abc} -% {\normalexpanded{\unexpanded\def\syst_helpers_do_do_if_in_string_else##1,\m_syst_sub_string,##2}% +% \protected\def\syst_helpers_do_if_in_string_else_delimited#1% ##2 can be {abc} +% {\normalexpanded{\protected\def\syst_helpers_do_do_if_in_string_else##1,\m_syst_sub_string,##2}% % {\ifarguments % \or % \expandafter\syst_helpers_do_if_in_string_else_nop @@ -1126,7 +1127,7 @@ % \fi}% % \normalexpanded{\syst_helpers_do_do_if_in_string_else,#1,}\e_o_t\ignorearguments\ignorearguments} % -% \unexpanded\def\doifinstring#1% +% \protected\def\doifinstring#1% % {\edef\m_syst_sub_string{#1}% expand #1 here % \ifempty\m_syst_sub_string % \expandafter\gobbletwoarguments @@ -1134,8 +1135,8 @@ % \expandafter\syst_helpers_do_if_in_string % \fi} % -% \unexpanded\def\syst_helpers_do_if_in_string#1% ##2 can be {abc} -% {\normalexpanded{\unexpanded\def\syst_helpers_do_do_if_in_string##1\m_syst_sub_string##2}% +% \protected\def\syst_helpers_do_if_in_string#1% ##2 can be {abc} +% {\normalexpanded{\protected\def\syst_helpers_do_do_if_in_string##1\m_syst_sub_string##2}% % {\ifarguments % \or % \expandafter\syst_helpers_do_if_in_string_nop @@ -1144,7 +1145,7 @@ % \fi}% % \normalexpanded{\syst_helpers_do_do_if_in_string#1}\e_o_t\ignorearguments\ignorearguments} % -% \unexpanded\def\doifnotinstring#1% +% \protected\def\doifnotinstring#1% % {\edef\m_syst_sub_string{#1}% expand #1 here % \ifempty\m_syst_sub_string % \expandafter\secondoftwoarguments @@ -1152,8 +1153,8 @@ % \expandafter\syst_helpers_do_if_not_in_string % \fi} % -% \unexpanded\def\syst_helpers_do_if_not_in_string#1% ##2 can be {abc} -% {\normalexpanded{\unexpanded\def\syst_helpers_do_do_if_not_in_string##1\m_syst_sub_string##2}% +% \protected\def\syst_helpers_do_if_not_in_string#1% ##2 can be {abc} +% {\normalexpanded{\protected\def\syst_helpers_do_do_if_not_in_string##1\m_syst_sub_string##2}% % {\ifarguments % \or % \expandafter\syst_helpers_do_if_not_in_string_nop @@ -1169,21 +1170,21 @@ % \def\syst_helpers_do_if_not_in_string_yes #0\ignorearguments\ignorearguments#0{} % \def\syst_helpers_do_if_not_in_string_nop #0\ignorearguments#2{#2} -\unexpanded\def\doifelseinstring#1#2% +\protected\def\doifelseinstring#1#2% {\ifhasxtoks{#1}{#2}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifinstring#1#2% +\protected\def\doifinstring#1#2% {\ifhasxtoks{#1}{#2}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotinstring#1#2% +\protected\def\doifnotinstring#1#2% {\ifhasxtoks{#1}{#2}% \expandafter\gobbleoneargument \else @@ -1245,7 +1246,7 @@ \def\percentdimen#1#2% dimen percentage (with %) {\dimexpr\clf_percentageof{#2}\dimexpr#1\relax} -\unexpanded\def\setpercentdimen#1#2% dimen percentage (with %) +\protected\def\setpercentdimen#1#2% dimen percentage (with %) {#1=\clf_percentageof{#2}\dimexpr#1\relax} %D \macros @@ -1273,7 +1274,7 @@ %D The gain in speed depends on the length of the argument (the longer the argument, %D the less we gain). The question is: do we still need these raw variants? -\unexpanded\def\makerawcommalist[#1]#2% use \processnext ... here +\protected\def\makerawcommalist[#1]#2% use \processnext ... here {\scratchtoks\emptytoks \def\syst_helpers_do_make_raw_comma_list##1{\iftok\scratchtoks\emptytoks\scratchtoks{##1}\else\toksapp\scratchtoks{,##1}\fi}% \processcommalist[#1]\syst_helpers_do_make_raw_comma_list @@ -1284,7 +1285,7 @@ %D Here is one without nesting: -\unexpanded\def\syst_helpers_process_fast_comma_item#1,% +\protected\def\syst_helpers_process_fast_comma_item#1,% {\ifarguments \expandafter\syst_helpers_process_comma_item_gobble \or @@ -1292,14 +1293,14 @@ \expandafter\syst_helpers_process_fast_comma_item_next \fi} -\unexpanded\def\syst_helpers_process_fast_comma_item_next +\protected\def\syst_helpers_process_fast_comma_item_next {\expandafterspaces\syst_helpers_process_fast_comma_item} -\unexpanded\def\fastprocesscommalist[#1]#2% +\protected\def\fastprocesscommalist[#1]#2% {\let\fastcommalistcommand#2% \expandafterspaces\syst_helpers_process_fast_comma_item#1\ignorearguments\ignorearguments\ignorearguments} -\unexpanded\def\fastprocesscommacommand[#1]#2% +\protected\def\fastprocesscommacommand[#1]#2% {\let\fastcommalistcommand#2% \normalexpanded{\noexpand\expandafterspaces\syst_helpers_process_fast_comma_item#1}\ignorearguments\ignorearguments\ignorearguments} @@ -1313,7 +1314,7 @@ \expandafter\secondoftwoarguments \fi} -\unexpanded\def\rawdoifelseinset#1% +\protected\def\rawdoifelseinset#1% {\edef\m_syst_sub_string{#1}% expand #1 here \ifx\m_syst_sub_string\empty \expandafter\thirdofthreearguments @@ -1330,7 +1331,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\rawdoifinset#1% or just alias this one +\protected\def\rawdoifinset#1% or just alias this one {\edef\m_syst_sub_string{#1}% expand #1 here \ifx\m_syst_sub_string\m_syst_two_commas \expandafter\gobbletwoarguments @@ -1364,7 +1365,7 @@ \def\syst_helpers_raw_process_action_next {\expandafterspaces\syst_helpers_raw_process_action} -\unexpanded\def\xrawprocessaction[#1]#2[#3]% +\protected\def\xrawprocessaction[#1]#2[#3]% {\edef\m_syst_string_one{#1}% \ifempty\m_syst_string_one \let\m_syst_string_one\s!default @@ -1440,10 +1441,10 @@ %D will redefine this macro later on, when a more advanced message mechanism is %D implemented. -\unexpanded\def\showassignerror#1#2% +\protected\def\showassignerror#1#2% {\writestatus{setup}{missing or ungrouped '=' after '#1' in line #2}} -\unexpanded\def\doassignempty[#1][#2=#3]% +\protected\def\doassignempty[#1][#2=#3]% {\ifcsname#1#2\endcsname\else\dosetvalue{#1}{#2}{#3}\fi} %D \macros @@ -1513,11 +1514,11 @@ \let\currentvalue\empty -\unexpanded\def\getparameters {\dogetparameters\dosetvalue} -\unexpanded\def\geteparameters {\dogetparameters\dosetevalue} -\unexpanded\def\getgparameters {\dogetparameters\dosetgvalue} -\unexpanded\def\getxparameters {\dogetparameters\dosetxvalue} -\unexpanded\def\forgetparameters{\dogetparameters\doignorevalue} +\protected\def\getparameters {\dogetparameters\dosetvalue} +\protected\def\geteparameters {\dogetparameters\dosetevalue} +\protected\def\getgparameters {\dogetparameters\dosetgvalue} +\protected\def\getxparameters {\dogetparameters\dosetxvalue} +\protected\def\forgetparameters{\dogetparameters\doignorevalue} \let\getexpandedparameters\geteparameters @@ -1543,7 +1544,7 @@ \def\syst_helpers_grab_parameter_next {\expandafterspaces\syst_helpers_grab_parameter} -\unexpanded\def\dogetparameters#1[#2]#-[#3]% +\protected\def\dogetparameters#1[#2]#-[#3]% {\def\m_syst_parameter_n{#2}% \let\m_syst_parameter_s#1% \expandafterspaces\syst_helpers_grab_parameter#3\ignorearguments\ignorearguments} @@ -1559,7 +1560,7 @@ %D \getemptyparameters [label] [...=...,...=...] %D \stoptyping -\unexpanded\def\getemptyparameters[#1]#2[#3]% +\protected\def\getemptyparameters[#1]#2[#3]% {\def\syst_helpers_get_empty_parameters##1{\doassignempty[#1][##1]}% \processcommalist[#3]\syst_helpers_get_empty_parameters} @@ -1584,18 +1585,18 @@ %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] +\protected\def\processassignmentlist[#1]#2% #2 == \command{key}{value] {\def\syst_helpers_process_assignment_entry##1{#2}% {##2}{##3} % namespace is ignored \dogetparameters\syst_helpers_process_assignment_entry[][#1]} -\unexpanded\def\processassignmentcommand[#1]% +\protected\def\processassignmentcommand[#1]% {\normalexpanded{\processassignmentlist[#1]}} -\unexpanded\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist +\protected\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% \processassignmentlist[#1]\currentassignmentlistcommand} -\unexpanded\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand +\protected\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% \normalexpanded{\processassignmentlist[#1]}\currentassignmentlistcommand} @@ -1642,7 +1643,7 @@ %D By using \type {\docopyvalue} we've prepared this command for use in a %D multi||lingual environment. -\unexpanded\def\copyparameters[#1]#-[#2]#-[#3]% +\protected\def\copyparameters[#1]#-[#2]#-[#3]% {\doifnot{#1}{#2} {\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#2}}% ##1 \processcommalist[#3]\syst_helpers_copy_parameter}} @@ -1662,7 +1663,7 @@ \newif\ifparameters -\unexpanded\def\checkparameters[#1]% +\protected\def\checkparameters[#1]% {\ifhastok={#1}\parameterstrue\else\parametersfalse\fi} %D \macros @@ -1702,7 +1703,7 @@ \expandafter\syst_helpers_get_comma_list_size \fi} -\unexpanded\def\getcommalistsize[% +\protected\def\getcommalistsize[% {\futureexpand]\syst_helpers_get_comma_list_size_nop\syst_helpers_get_comma_list_size_yes} \def\syst_helpers_get_comma_list_size_yes#+]% @@ -1714,7 +1715,7 @@ {\commalistcounter\zerocount \let\commalistsize\!!zerocount} -\unexpanded\def\getcommacommandsize[#1]% +\protected\def\getcommacommandsize[#1]% {\normalexpanded{\getcommalistsize[#1]}} %D Filters: @@ -1737,12 +1738,12 @@ \def\syst_helpers_get_from_comma_list_next {\expandafterspaces\syst_helpers_get_from_comma_list} -\unexpanded\def\getfromcommalist[#1]#2[#3]% +\protected\def\getfromcommalist[#1]#2[#3]% {\let\commalistelement\empty \commalistcounter#3\relax \expandafterspaces\syst_helpers_get_from_comma_list#1\ignorearguments\ignorearguments} -\unexpanded\def\getfromcommacommand[#1]% +\protected\def\getfromcommacommand[#1]% {\normalexpanded{\getfromcommalist[#1]}} %D Watertight (and efficient) solutions are hard to find, due to the handling of @@ -1781,7 +1782,7 @@ {\ifcase\scratchcounter\or#1\or#2\or#3\or#4\or#5\or#6\or#7\or#8\or#9\fi \syst_helpers_gobble_comma_list} -\unexpanded\def\dogetcommacommandelement#1\from#2\to#3% +\protected\def\dogetcommacommandelement#1\from#2\to#3% {\scratchcounter#1\relax \edef#3{\normalexpanded{\syst_helpers_get_comma_list_element#2\ignorearguments\ignorearguments}}} @@ -1810,7 +1811,7 @@ %D \def\dosetupsomething[#1][#2]% %D {... #1 ... #2 ...} %D -%D \unexpanded\def\setupsomething +%D \protected\def\setupsomething %D {\dodoubleargument\dosetupsomething} %D \stoptyping %D @@ -1896,7 +1897,7 @@ %D Single: -\unexpanded\def\dosingleempty#1% +\protected\def\dosingleempty#1% {\t_syst_aux{#1}% \futureexpand[\syst_helpers_single_empty_one_yes\syst_helpers_single_empty_one_nop} @@ -1906,7 +1907,7 @@ %D Double -\unexpanded\def\dodoubleempty#1% +\protected\def\dodoubleempty#1% {\t_syst_aux{#1}% \futureexpand[\syst_helpers_double_empty_one_yes\syst_helpers_double_empty_one_nop} @@ -1926,7 +1927,7 @@ % Triple -\unexpanded\def\dotripleempty#1% +\protected\def\dotripleempty#1% {\t_syst_aux{#1}% \futureexpand[\syst_helpers_triple_empty_one_yes\syst_helpers_triple_empty_one_nop} @@ -1957,7 +1958,7 @@ %D Quadruple: -\unexpanded\def\doquadrupleempty#1% +\protected\def\doquadrupleempty#1% {\t_syst_aux{#1}% \futureexpand[\syst_helpers_quadruple_empty_one_yes\syst_helpers_quadruple_empty_one_nop} @@ -2000,7 +2001,7 @@ %D Quintuple: -\unexpanded\def\doquintupleempty#1% +\protected\def\doquintupleempty#1% {\t_syst_aux{#1}% \futureexpand[\syst_helpers_quintuple_empty_one_yes\syst_helpers_quintuple_empty_one_nop} @@ -2056,7 +2057,7 @@ %D Sixtuple: -\unexpanded\def\dosixtupleempty#1% +\protected\def\dosixtupleempty#1% {\t_syst_aux{#1}% \futureexpand[\syst_helpers_sixtuple_empty_one_yes\syst_helpers_sixtuple_empty_one_nop} @@ -2126,7 +2127,7 @@ %D Seventuple: -\unexpanded\def\doseventupleempty#1% +\protected\def\doseventupleempty#1% {\t_syst_aux{#1}% \futureexpand[\syst_helpers_seventuple_empty_one_yes\syst_helpers_seventuple_empty_one_nop} @@ -2271,12 +2272,12 @@ %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% +\protected\def\complexorsimple#1% {\doifelsenextoptional {\firstargumenttrue \csname\s!complex\csstring#1\endcsname} {\firstargumentfalse\csname\s!simple \csstring#1\endcsname}} -\unexpanded\def\complexorsimpleempty#1% +\protected\def\complexorsimpleempty#1% {\doifelsenextoptional {\firstargumenttrue \csname\s!complex\csstring#1\endcsname} {\firstargumentfalse\csname\s!complex\csstring#1\endcsname[]}} @@ -2287,19 +2288,19 @@ %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% +\protected\def\syst_helpers_complex_or_simple#1#2% {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#2}} -\unexpanded\def\syst_helpers_complex_or_simple_empty#1% +\protected\def\syst_helpers_complex_or_simple_empty#1% {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#1[]}} -\unexpanded\def\definecomplexorsimple#1% - {\unexpanded\edef#1{\syst_helpers_complex_or_simple +\protected\def\definecomplexorsimple#1% + {\protected\edef#1{\syst_helpers_complex_or_simple \expandafter\noexpand\csname\s!complex\csstring#1\endcsname \expandafter\noexpand\csname\s!simple \csstring#1\endcsname}} -\unexpanded\def\definecomplexorsimpleempty#1% - {\unexpanded\edef#1{\syst_helpers_complex_or_simple_empty +\protected\def\definecomplexorsimpleempty#1% + {\protected\edef#1{\syst_helpers_complex_or_simple_empty \expandafter\noexpand\csname\s!complex\csstring#1\endcsname}} %D These commands are called as: @@ -2337,8 +2338,8 @@ \newconditional\c_syst_helpers_permit_spaces_between_groups -\unexpanded\def \permitspacesbetweengroups{\settrue \c_syst_helpers_permit_spaces_between_groups} -\unexpanded\def\dontpermitspacesbetweengroups{\setfalse\c_syst_helpers_permit_spaces_between_groups} +\protected\def \permitspacesbetweengroups{\settrue \c_syst_helpers_permit_spaces_between_groups} +\protected\def\dontpermitspacesbetweengroups{\setfalse\c_syst_helpers_permit_spaces_between_groups} \dontpermitspacesbetweengroups @@ -2349,7 +2350,7 @@ %D NB: experimental code in cont-exp.mkiv -\unexpanded\def\dosinglegroupempty#1% +\protected\def\dosinglegroupempty#1% {\t_syst_aux{#1}% \futureexpand\bgroup\syst_helpers_single_empty_one_yes\syst_helpers_single_group_empty_one_nop} @@ -2357,7 +2358,7 @@ {\firstargumentfalse \the\t_syst_aux{}} -\unexpanded\def\dodoublegroupempty#1% +\protected\def\dodoublegroupempty#1% {\t_syst_aux{#1}% \futureexpand\bgroup\syst_helpers_group_double_empty_one_yes\syst_helpers_group_double_empty_one_nop} @@ -2375,7 +2376,7 @@ {\secondargumentfalse \the\t_syst_aux{}} -\unexpanded\def\dotriplegroupempty#1% +\protected\def\dotriplegroupempty#1% {\t_syst_aux{#1}% \futureexpand\bgroup\syst_helpers_group_triple_empty_one_yes\syst_helpers_group_triple_empty_one_nop} @@ -2404,7 +2405,7 @@ {\thirdargumentfalse \the\t_syst_aux{}} -\unexpanded\def\doquadruplegroupempty#1% +\protected\def\doquadruplegroupempty#1% {\t_syst_aux{#1}% \futureexpand\bgroup\syst_helpers_group_quadruple_empty_one_yes\syst_helpers_group_quadruple_empty_one_nop} @@ -2445,7 +2446,7 @@ {\fourthargumentfalse \the\t_syst_aux{}} -\unexpanded\def\doquintuplegroupempty#1% +\protected\def\doquintuplegroupempty#1% {\t_syst_aux{#1}% \futureexpand\bgroup\syst_helpers_group_quintuple_empty_one_yes\syst_helpers_group_quintuple_empty_one_nop} @@ -2553,14 +2554,14 @@ \def\fifthofsixarguments #-#-#-#-#1#-{#1} \def\sixthofsixarguments #-#-#-#-#-#1{#1} -\unexpanded\def\firstofoneunexpanded #1{#1} +\protected\def\firstofoneunexpanded #1{#1} -\unexpanded\def\firstoftwounexpanded #1#-{#1} -\unexpanded\def\secondoftwounexpanded #-#1{#1} +\protected\def\firstoftwounexpanded #1#-{#1} +\protected\def\secondoftwounexpanded #-#1{#1} -\unexpanded\def\firstofthreeunexpanded #1#-#-{#1} -\unexpanded\def\secondofthreeunexpanded#-#1#-{#1} -\unexpanded\def\thirdofthreeunexpanded #-#-#1{#1} +\protected\def\firstofthreeunexpanded #1#-#-{#1} +\protected\def\secondofthreeunexpanded#-#1#-{#1} +\protected\def\thirdofthreeunexpanded #-#-#1{#1} %D \macros %D {globalletempty,letempty, @@ -2569,15 +2570,15 @@ %D %D Trivial: -\unexpanded\def\letempty #1{\let #1\empty} -\unexpanded\def\globalletempty#1{\glet#1\empty} +\protected\def\letempty #1{\let #1\empty} +\protected\def\globalletempty#1{\glet#1\empty} -\unexpanded\def\letvalueempty #1{\expandafter\let \csname#1\endcsname\empty} -\unexpanded\def\letgvalueempty#1{\expandafter\glet\csname#1\endcsname\empty} -\unexpanded\def\letvaluerelax #1{\expandafter\let \csname#1\endcsname\relax} -\unexpanded\def\letgvalurelax #1{\expandafter\glet\csname#1\endcsname\relax} +\protected\def\letvalueempty #1{\expandafter\let \csname#1\endcsname\empty} +\protected\def\letgvalueempty#1{\expandafter\glet\csname#1\endcsname\empty} +\protected\def\letvaluerelax #1{\expandafter\let \csname#1\endcsname\relax} +\protected\def\letgvalurelax #1{\expandafter\glet\csname#1\endcsname\relax} -\unexpanded\def\relaxvalueifundefined#1% +\protected\def\relaxvalueifundefined#1% {\ifcsname#1\endcsname \else \expandafter\let\csname#1\endcsname\relax \fi} @@ -2588,7 +2589,7 @@ %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 +\protected\def\wait {\begingroup \read16 to \wait \endgroup} @@ -2615,12 +2616,12 @@ \ifdefined\writestring \else - \unexpanded\def\writestring{\immediate\write\statuswrite} - \unexpanded\def\writeline {\writestring{}} + \protected\def\writestring{\immediate\write\statuswrite} + \protected\def\writeline {\writestring{}} \fi -\unexpanded\def\normalwritestatus#1#2% +\protected\def\normalwritestatus#1#2% {\writestring{\expandafter\syst_helpers_split_status_yes\expandafter\statuswidth#1% \space\space\space\space\space\space\space \space\space\space\space\space\space\space @@ -2655,7 +2656,7 @@ \def\syst_helpers_grab_raw_parameter_next {\expandafterspaces\syst_helpers_grab_raw_parameter} -\unexpanded\def\rawgetparameters#1[#2]#-[#3]% +\protected\def\rawgetparameters#1[#2]#-[#3]% {\def\m_syst_parameter_n{#2}% %\expandafterspaces\syst_helpers_grab_raw_parameter#3\ignorearguments\ignorearguments} \expandafter\expandafterspaces\expandafter\syst_helpers_grab_raw_parameter#3\ignorearguments\ignorearguments} @@ -2670,13 +2671,13 @@ %D all preceding ones with \type {\redoglobal}. When using only alternatives, one %D can reset this mechanism with \type {\resetglobal}. -\unexpanded\def\resetglobal +\protected\def\resetglobal {\let\redoglobal\relax \let\dodoglobal\relax} \resetglobal -\unexpanded\def\doglobal +\protected\def\doglobal {\ifx\redoglobal\relax \let\redoglobal\global \let\dodoglobal\syst_helpers_dodo_global @@ -2710,7 +2711,7 @@ %D %D Apart from the prefixes, a few more \type {\expandafters} are needed: -% \unexpanded\def\newif#1% uses the original plain \@if +% \protected\def\newif#1% uses the original plain \@if % {\privatescratchcounter\escapechar % \escapechar\minusone % \expandafter\expandafter\expandafter @@ -2722,7 +2723,7 @@ % \dodoglobal\@if#1{false}% % \escapechar\privatescratchcounter} -\normalprotected\def\newif#1% see syst-ini.mkiv +\protected\def\newif#1% see syst-ini.mkiv {\let\new_if_saved\newif \let\newif\new_if_check \expandafter\redoglobal\expandafter\def\csname\expandafter\newif\csstring#1true\endcsname {\let#1\iftrue }% @@ -2732,26 +2733,26 @@ %D Also new: -\unexpanded\def\define#1% +\protected\def\define#1% {\ifdefined#1% \message{[\noexpand#1is already defined]}% - \unexpanded\expandafter\def\expandafter\gobbleddefinition + \protected\expandafter\def\expandafter\gobbleddefinition \else - \unexpanded\expandafter\def + \protected\expandafter\def \fi#1} -\unexpanded\def\redefine#1% +\protected\def\redefine#1% {\ifdefined#1% \message{[\noexpand#1is redefined]}% \fi - \unexpanded\def#1} + \protected\def#1} -\unexpanded\def\definemacro#1% +\protected\def\definemacro#1% {\ifdefined#1% \message{[\noexpand#1is already defined]}% - \unexpanded\expandafter\def\expandafter\gobbleddefinition + \protected\expandafter\def\expandafter\gobbleddefinition \else - \unexpanded\expandafter\def + \protected\expandafter\def \fi#1} % \define\hans{hans} @@ -2782,7 +2783,7 @@ \glet\stoptexdefinition\relax -\unexpanded\gdef\starttexdefinition% +\protected\gdef\starttexdefinition% {\bgroup% \obeylines% \syst_helpers_start_tex_definition} @@ -2797,14 +2798,14 @@ \egroup -% \unexpanded\def\texdefinition#1{\csname\ifcsname#1\endcsname#1\else donothing\fi\endcsname} % todo: a nop cs: char 0 or some corenamespace +% \protected\def\texdefinition#1{\csname\ifcsname#1\endcsname#1\else donothing\fi\endcsname} % todo: a nop cs: char 0 or some corenamespace -\unexpanded\def\texdefinition#1{\begincsname#1\endcsname} +\protected\def\texdefinition#1{\begincsname#1\endcsname} % This is a first variant, more might be added: -\unexpanded\def\starttexcode{\unprotect} -\unexpanded\def\stoptexcode {\protect} +\protected\def\starttexcode{\unprotect} +\protected\def\stoptexcode {\protect} %D \macros %D {newcounter, @@ -2859,7 +2860,7 @@ \def\zerocountervalue{0} -\unexpanded\def\newcounter#1% +\protected\def\newcounter#1% {\dodoglobal\let#1\zerocountervalue} %D Nowadays we don't mind a few more tokens if we can gain a bit of speed. @@ -2880,14 +2881,14 @@ \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} +\protected\def\increment{\doifelsenextcharcs(\syst_helpers_do_do_increment\syst_helpers_do_increment} +\protected\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}} +\protected\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr#1+\plusone \relax}} +\protected\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr#1+\minusone\relax}} -\unexpanded\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname} -\unexpanded\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname} +\protected\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname} +\protected\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname} %D \macros %D {newsignal} @@ -2906,7 +2907,7 @@ \newdimen\maximumsignal % step is about 0.00025pt -\unexpanded\def\newsignal#1% +\protected\def\newsignal#1% {\ifdefined#1\else \advance\maximumsignal 2\scaledpoint % to be save in rounding \edef#1{\the\maximumsignal}% @@ -2928,7 +2929,7 @@ %D %D We will use this one in: -\unexpanded\def\savenormalmeaning#1% +\protected\def\savenormalmeaning#1% {\ifcsname normal\csstring#1\endcsname \else \expandafter\let\csname normal\csstring#1\endcsname#1% \fi} @@ -2984,7 +2985,7 @@ \let\syst_helpers_stepwise_next\relax -\unexpanded\def\syst_helpers_stepwise_recurse#1#2#3% from to step +\protected\def\syst_helpers_stepwise_recurse#1#2#3% from to step {\ifnum#1>#2\relax \expandafter\syst_helpers_stepwise_recurse_nop \else @@ -2992,11 +2993,11 @@ \doubleexpandafter\syst_helpers_stepwise_recurse_yes\expandafter \fi\expandafter{\the\numexpr\recurselevel+#3\relax}{#2}{#3}} -\unexpanded\def\syst_helpers_stepwise_recurse_yes +\protected\def\syst_helpers_stepwise_recurse_yes {\syst_helpers_recurse_content \syst_helpers_stepwise_recurse} -\unexpanded\def\syst_helpers_stepwise_reverse#1#2#3% from to step +\protected\def\syst_helpers_stepwise_reverse#1#2#3% from to step {\ifnum#1<#2\relax \expandafter\syst_helpers_stepwise_recurse_nop \else @@ -3006,11 +3007,11 @@ \doubleexpandafter\syst_helpers_stepwise_reverse_yes\expandafter \fi\expandafter{\the\innerrecurse}{#2}{#3}} -\unexpanded\def\syst_helpers_stepwise_reverse_yes +\protected\def\syst_helpers_stepwise_reverse_yes {\syst_helpers_recurse_content \syst_helpers_stepwise_reverse} -\unexpanded\def\syst_helpers_stepwise_exit +\protected\def\syst_helpers_stepwise_exit {\syst_helpers_stepwise_recurse_nop\relax} \def\doexpandedrecurse#1#2% user macro (also was \doxprecurse) @@ -3035,7 +3036,7 @@ %D %D Because the simple case (n=1) is used often, we implement it more efficiently: -\unexpanded\def\dorecurse#1% +\protected\def\dorecurse#1% {\ifcase#1\relax \expandafter\gobbletwoarguments \or @@ -3044,7 +3045,7 @@ \expandafter\syst_helpers_recurse_x \fi{#1}} -\unexpanded\def\syst_helpers_recurse_indeed#1#2% from to +\protected\def\syst_helpers_recurse_indeed#1#2% from to {\ifnum#1>#2\relax \expandafter\syst_helpers_recurse_indeed_nop \else @@ -3053,11 +3054,11 @@ \doubleexpandafter\syst_helpers_recurse_indeed_yes \fi\expandafter{\the\innerrecurse}{#2}} -\unexpanded\def\syst_helpers_recurse_indeed_yes +\protected\def\syst_helpers_recurse_indeed_yes {\syst_helpers_recurse_content \syst_helpers_recurse_indeed} -\unexpanded\def\syst_helpers_recurse_indeed_nop#1#2#3% +\protected\def\syst_helpers_recurse_indeed_nop#1#2#3% {} %D \macros @@ -3069,7 +3070,7 @@ %D \dowith{a,b,c}{[#1]} %D \stoptyping -\unexpanded\def\dowith#1#2% +\protected\def\dowith#1#2% {\def\syst_helpers_with##1{#2}% \normalexpanded{\processcommalist[#1]}\syst_helpers_with} @@ -3092,32 +3093,32 @@ \let\endofloop\donothing % maybe \syst_helpers_loop_end -\unexpanded\def\doloop#1% +\protected\def\doloop#1% {\global\advance\outerrecurse \plusone \globalpushmacro\recurselevel \globalpushmacro\recurseaction - \unexpanded\gdef\recurseaction##1##2{#1}% + \protected\gdef\recurseaction##1##2{#1}% \let\endofloop\syst_helpers_loop \syst_helpers_loop1}% no \plusone else \recurselevel wrong -\unexpanded\def\syst_helpers_loop#1% +\protected\def\syst_helpers_loop#1% {\def\recurselevel{#1}% \expandafter\syst_helpers_loop_yes\expandafter{\the\numexpr\recurselevel+\plusone\relax}} -\unexpanded\def\syst_helpers_loop_yes +\protected\def\syst_helpers_loop_yes {\syst_helpers_recurse_content \endofloop} -\unexpanded\def\syst_helpers_loop_nop#0% +\protected\def\syst_helpers_loop_nop#0% {\let\endofloop\syst_helpers_loop \globalpopmacro\recurselevel \globalpopmacro\recurseaction \global\advance\outerrecurse\minusone} -\unexpanded\def\exitloop % \exitloop quits at end +\protected\def\exitloop % \exitloop quits at end {\let\endofloop\syst_helpers_loop_nop} -\unexpanded\def\exitloopnow#0\endofloop % \exitloopnow quits directly +\protected\def\exitloopnow#0\endofloop % \exitloopnow quits directly {\syst_helpers_loop_nop} %D The loop is executed at least once, so beware of situations like: @@ -3158,32 +3159,32 @@ \def\syst_helpers_recurse_content {\normalexpanded{\recurseaction{\recurselevel}{\the\outerrecurse}}} -\unexpanded\def\syst_helpers_recurse_x#1#2% +\protected\def\syst_helpers_recurse_x#1#2% {\global\advance\outerrecurse\plusone \globalpushmacro\recurseaction \globalpushmacro\recurselevel - \unexpanded\gdef\recurseaction##1##2{#2}% + \protected\gdef\recurseaction##1##2{#2}% \expandafter\syst_helpers_recurse_indeed\expandafter1\expandafter{\number#1}% \globalpopmacro\recurselevel \globalpopmacro\recurseaction \global\advance\outerrecurse\minusone} -\unexpanded\def\syst_helpers_recurse_y#1#2% +\protected\def\syst_helpers_recurse_y#1#2% {\global\advance\outerrecurse\plusone \globalpushmacro\recurseaction \globalpushmacro\recurselevel \let\recurselevel\!!plusone - \unexpanded\gdef\recurseaction##1##2{#2}% + \protected\gdef\recurseaction##1##2{#2}% \syst_helpers_recurse_content \globalpopmacro\recurselevel \globalpopmacro\recurseaction \global\advance\outerrecurse\minusone} -\unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone \globalpushmacro\recurselevel \globalpushmacro\recurseaction - \unexpanded\gdef\recurseaction##1##2{#4}% + \protected\gdef\recurseaction##1##2{#4}% \normalexpanded{\ifcmpnum#3\zerocount \ifnum#1<#2\relax\relax % so we catch \number\numexpr xx without \relax's \syst_helpers_stepwise_exit @@ -3203,7 +3204,7 @@ \globalpopmacro\recurseaction \global\advance\outerrecurse\minusone} -\unexpanded\def\syst_helpers_stepwise_recurse_nop#1#2#3#4% +\protected\def\syst_helpers_stepwise_recurse_nop#1#2#3#4% {} \newcount\fastloopindex @@ -3211,7 +3212,7 @@ \let\m_syst_helpers_fast_loop_cs\relax -\unexpanded\def\dofastloopcs#1% +\protected\def\dofastloopcs#1% {\fastloopfinal#1\relax \ifcase\fastloopfinal \expandafter\gobbleoneargument @@ -3219,12 +3220,12 @@ \expandafter\syst_helpers_fast_loop_cs \fi} -\unexpanded\def\syst_helpers_fast_loop_cs#1% +\protected\def\syst_helpers_fast_loop_cs#1% {\let\m_syst_helpers_fast_loop_cs#1% \fastloopindex\plusone \syst_helpers_fast_loop_cs_step} -\unexpanded\def\syst_helpers_fast_loop_cs_step +\protected\def\syst_helpers_fast_loop_cs_step {\ifnum\fastloopindex>\fastloopfinal \let\m_syst_helpers_fast_loop_cs\relax \else @@ -3235,7 +3236,7 @@ % Helper: -\unexpanded\def\resetrecurselevel{\let\recurselevel\!!zerocount} +\protected\def\resetrecurselevel{\let\recurselevel\!!zerocount} \let\recurselevel\!!zerocount @@ -3264,11 +3265,11 @@ %D } %D \stoptyping -\unexpanded\def\doloopoverlist#1#2% +\protected\def\doloopoverlist#1#2% {\global\advance\outerrecurse\plusone \globalpushmacro\recurseaction \globalpushmacro\recursestring - \unexpanded\gdef\recurseaction##1{\edef\recursestring{##1}#2}% + \protected\gdef\recurseaction##1{\edef\recursestring{##1}#2}% \processcommacommand[#1]\recurseaction \globalpopmacro\recursestring \globalpopmacro\recurseaction @@ -3298,14 +3299,14 @@ \installsystemnamespace{extraevery} -\unexpanded\def\newevery#1#2% +\protected\def\newevery#1#2% {\ifx#1\everypar\else\newtoks#1\fi% we test for redefinition elsewhere \ifx#2\relax\orelse\ifdefined#2\else \expandafter\newtoks\csname\??extraevery\csstring#1\endcsname \edef#2{\syst_helpers_every#1\csname\??extraevery\csstring#1\endcsname}% \fi} -\unexpanded\def\syst_helpers_every#1#2% +\protected\def\syst_helpers_every#1#2% {\removetoks\the#2\from#1% \appendtoks\the#2\to #1% #2} @@ -3319,7 +3320,7 @@ \newtoks \neverypar -\unexpanded\def\forgeteverypar +\protected\def\forgeteverypar {\everypar{\the\neverypar}} %D Which we're going to use indeed! When the second argument equals \type {\relax}, @@ -3385,10 +3386,10 @@ %D %D Both commands accept the prefix \type{\doglobal} for global assignments. -\unexpanded\def\convertvalue#1\to +\protected\def\convertvalue#1\to {\expandafter\convertcommand\csname#1\endcsname\to} -\unexpanded\def\defconvertedvalue#1#2% less sensitive for \to +\protected\def\defconvertedvalue#1#2% less sensitive for \to {\expandafter\defconvertedcommand\expandafter#1\csname#2\endcsname} %D \macros @@ -3421,14 +3422,14 @@ %D %D \typebuffer gives: \blank \getbuffer \blank -\unexpanded\def\doifelseassignment#1% +\protected\def\doifelseassignment#1% {\ifhastok={#1}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifelseassignmentcs#1#2#3% +\protected\def\doifelseassignmentcs#1#2#3% {\ifhastok={#1}% \expandafter#2% \else @@ -3440,31 +3441,31 @@ \newif\ifassignment -\unexpanded\def\docheckassignment#1% +\protected\def\docheckassignment#1% {\ifhastok={#1}% \assignmenttrue \else \assignmentfalse \fi} -\unexpanded\def\validassignment #1{\ifhastok={#1}} -\unexpanded\def\novalidassignment#1{\ifnum\ifhastok={#1}\zerocount\else\plusone\fi=\plusone} +\protected\def\validassignment #1{\ifhastok={#1}} +\protected\def\novalidassignment#1{\ifnum\ifhastok={#1}\zerocount\else\plusone\fi=\plusone} %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 +\protected\def\convertargument#1\to#2{\dodoglobal\edef#2{\detokenize{#1}}} +\protected\def\convertcommand #1\to#2{\dodoglobal\edef#2{\expandafter\detokenize\expandafter{#1}}} % hm, only second is also ok -\unexpanded\def\defconvertedargument #1#2{\edef#1{\detokenize{#2}}} -\unexpanded\def\defconvertedcommand #1#2{\edef#1{\detokenize\expandafter{#2}}} -\unexpanded\def\edefconvertedargument#1#2{\edef#1{#2}% +\protected\def\defconvertedargument #1#2{\edef#1{\detokenize{#2}}} +\protected\def\defconvertedcommand #1#2{\edef#1{\detokenize\expandafter{#2}}} +\protected\def\edefconvertedargument#1#2{\edef#1{#2}% \edef#1{\detokenize\expandafter{#1}}} -\unexpanded\def\gdefconvertedargument#1#2{\xdef#1{\detokenize{#2}}} -\unexpanded\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\expandafter{#2}}} -\unexpanded\def\xdefconvertedargument#1#2{\xdef#1{#2}% +\protected\def\gdefconvertedargument#1#2{\xdef#1{\detokenize{#2}}} +\protected\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\expandafter{#2}}} +\protected\def\xdefconvertedargument#1#2{\xdef#1{#2}% \xdef#1{\detokenize\expandafter{#1}}} %D When you try to convert a primitive command, you'll find out that the \ETEX\ @@ -3488,7 +3489,7 @@ %D %D Ahandy macro, for testing purposes only: -\unexpanded\def\showvalue#1% +\protected\def\showvalue#1% {\ifcsname#1\endcsname \expandafter\show\csname#1\endcsname \else @@ -3508,7 +3509,7 @@ %D %D Watch the one level expansion of the second argument. -\unexpanded\def\doifelsemeaning#1#2% +\protected\def\doifelsemeaning#1#2% {\edef\m_syst_string_one{\normalmeaning#1}% \def \m_syst_string_two{#2}% \edef\m_syst_string_two{\normalmeaning\m_syst_string_two}% @@ -3537,9 +3538,9 @@ \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#4}}}% \ifx\m_syst_string_one\m_syst_string_two\expandafter#1\else\expandafter#2\fi} -\unexpanded\def\doifelsesamestring{\syst_helpers_if_samestring_else\firstoftwoarguments\secondoftwoarguments} -\unexpanded\def\doifsamestring {\syst_helpers_if_samestring_else\firstofoneargument \gobbleoneargument } -\unexpanded\def\doifnotsamestring {\syst_helpers_if_samestring_else\gobbleoneargument \firstofoneargument } +\protected\def\doifelsesamestring{\syst_helpers_if_samestring_else\firstoftwoarguments\secondoftwoarguments} +\protected\def\doifsamestring {\syst_helpers_if_samestring_else\firstofoneargument \gobbleoneargument } +\protected\def\doifnotsamestring {\syst_helpers_if_samestring_else\gobbleoneargument \firstofoneargument } \let\doifsamestringelse\doifelsesamestring @@ -3569,7 +3570,7 @@ %D %D In examples~2 and~3 both arguments equal, in~1 and~4 they differ. -\unexpanded\def\ConvertToConstant#1#2#3% +\protected\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}} @@ -3599,14 +3600,14 @@ %D %D where \type {...} can be anything legally \TEX. -\unexpanded\def\CheckConstantAfter#1#2% +\protected\def\CheckConstantAfter#1#2% {\expandafter\convertargument\v!prefix!\to\ascii \convertargument#1\to#2\relax \doifelseinstring\ascii{#2} {\expandafter\convertargument#1\to#2} {}} -\unexpanded\def\ConvertConstantAfter#1#2#3% +\protected\def\ConvertConstantAfter#1#2#3% {\CheckConstantAfter{#2}\asciia \CheckConstantAfter{#3}\asciib #1{\asciia}{\asciib}} @@ -3624,7 +3625,7 @@ %D %D We don't explicitly test if the macro is defined. -\unexpanded\def\assignifempty#1#2% +\protected\def\assignifempty#1#2% {\iftok{#1}\emptytoks \def#1{#2}\fi} %D \macros @@ -3637,7 +3638,7 @@ %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 \protected\def\startcommand#1\stopcommand% %D {... #1 ...} %D \stoptyping %D @@ -3655,7 +3656,7 @@ %D {\stop}. This means that: %D %D \starttyping -%D \unexpanded\def\starthello% +%D \protected\def\starthello% %D {\grabuntil{stophello}\message} %D %D \starthello Hello world!\stophello @@ -3665,10 +3666,10 @@ \let\syst_helpers_grab_indeed\relax -\unexpanded\def\syst_helpers_grab#1#2% +\protected\def\syst_helpers_grab#1#2% {\def\syst_helpers_grab_indeed##1#1{#2{##1}}\syst_helpers_grab_indeed} -\unexpanded\def\grabuntil#1% +\protected\def\grabuntil#1% {\expandafter\syst_helpers_grab\expandafter{\begincsname#1\endcsname}} %D The next command build on this mechanism: @@ -3695,19 +3696,19 @@ \let\syst_helpers_gobble_indeed\relax -\unexpanded\def\processbetween#1#2% +\protected\def\processbetween#1#2% {\setvalue{\s!start#1}{\grabuntil{\s!stop#1}{#2}}} -% \unexpanded\def\gobbleuntil#1% +% \protected\def\gobbleuntil#1% % {\def\syst_helpers_gobble_indeed##1#1{}\syst_helpers_gobble_indeed} % -% \unexpanded\def\gobbleuntilrelax#1\relax +% \protected\def\gobbleuntilrelax#1\relax % {} -\unexpanded\def\gobbleuntil#1% +\protected\def\gobbleuntil#1% {\def\syst_helpers_gobble_indeed##-#1{}\syst_helpers_gobble_indeed} -\unexpanded\def\gobbleuntilrelax#-\relax +\protected\def\gobbleuntilrelax#-\relax {} %D The next one simply expands the pickup up tokens. @@ -3718,7 +3719,7 @@ \let\syst_helpers_until_indeed\relax -\unexpanded\def\processuntil#1% +\protected\def\processuntil#1% {\def\syst_helpers_until_indeed##1#1{##1}\syst_helpers_until_indeed} %D \macros @@ -3787,7 +3788,7 @@ \let\m_syst_helpers_handle_group_after \relax \let\m_syst_helpers_handle_group_before\relax -\unexpanded\def\syst_helpers_handle_group_nop +\protected\def\syst_helpers_handle_group_nop {\ifnum\currentgrouptype=\semisimplegroupcode \expandafter\syst_helpers_handle_group_nop_a \else @@ -3806,7 +3807,7 @@ \aftergroup\egroup \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_normal +\protected\def\syst_helpers_handle_group_normal {\bgroup \afterassignment\m_syst_helpers_handle_group_normal_before \let\next=} @@ -3819,7 +3820,7 @@ \aftergroup\egroup \aftergroup\egroup} -\unexpanded\def\syst_helpers_handle_group_simple% no inner group (so no kerning interference) +\protected\def\syst_helpers_handle_group_simple% no inner group (so no kerning interference) {\bgroup \afterassignment\m_syst_helpers_handle_group_simple_before \let\next=} @@ -3833,7 +3834,7 @@ {\m_syst_helpers_handle_group_a \egroup}% -\unexpanded\def\syst_helpers_handle_group_pickup% no inner group (so no kerning interference) +\protected\def\syst_helpers_handle_group_pickup% no inner group (so no kerning interference) {\bgroup \afterassignment\m_syst_helpers_handle_group_pickup_before \let\next=} @@ -3845,7 +3846,7 @@ \aftergroup\m_syst_helpers_handle_group_p \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_nop_x +\protected\def\syst_helpers_handle_group_nop_x {\ifnum\currentgrouptype=\semisimplegroupcode \begingroup \aftergroup\endgroup @@ -3855,7 +3856,7 @@ \fi \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_normal_x +\protected\def\syst_helpers_handle_group_normal_x {\bgroup \afterassignment\m_syst_helpers_handle_group_normal_before_x \let\next=} @@ -3878,32 +3879,32 @@ %D {\futurelet} obeys blank spaces, and a line||ending token is treated as a blank %D space. So the final implementation became: -\unexpanded\def\groupedcommand#1#2% +\protected\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% +\protected\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% +\protected\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% +\protected\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{#3}% \futureexpandis\bgroup\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop} -\unexpanded\def\triggergroupedcommand#1% +\protected\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% +\protected\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} @@ -3932,10 +3933,10 @@ %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% +\protected\def\showdefinederror#1#2% {\writestatus\m!system{#1 #2 replaces a macro, use CAPITALS!}} -\unexpanded\def\checkdefined#1#2#3% +\protected\def\checkdefined#1#2#3% {\doifdefined{#3}{\showdefinederror{#2}{#3}}} %D \macros @@ -3990,19 +3991,19 @@ \let\syst_helpers_par_before\relax \let\syst_helpers_par_around\relax -\unexpanded\def\dowithpar#1#2% +\protected\def\dowithpar#1#2% {\globalpushmacro\syst_helpers_par_around \def\syst_helpers_par_around##1\par{#1##1#2\globalpopmacro\syst_helpers_par_around}% \expandafter\syst_helpers_par_around\ignorepars} -\unexpanded\def\dogotopar#1% +\protected\def\dogotopar#1% {\globalpushmacro\syst_helpers_par_before \def\syst_helpers_par_before{#1\globalpopmacro\syst_helpers_par_before}% \expandafter\syst_helpers_par_before\ignorepars} \let\dogotoparcs\dogotopar -\unexpanded\def\dogotoparstart +\protected\def\dogotoparstart {\ignorepars} %D This is old and kind of obsolete: @@ -4010,7 +4011,7 @@ \newtoks\BeforePar \newtoks\AfterPar -\unexpanded\def\GetPar +\protected\def\GetPar {\expanded {\dowithpar {\the\BeforePar @@ -4019,7 +4020,7 @@ \BeforePar\emptytoks \AfterPar\emptytoks}}} -\unexpanded\def\GotoPar +\protected\def\GotoPar {\expanded {\dogotopar {\the\BeforePar @@ -4058,7 +4059,7 @@ \let\syst_helpers_next_par\relax \let\syst_helpers_next_arg\relax -\unexpanded\def\dowithpargument#1% +\protected\def\dowithpargument#1% {\def\syst_helpers_next_par##1 \par{#1{##1}}% \def\syst_helpers_next_arg##1{#1{##1}}% \doifelsenextbgroup\syst_helpers_next_arg{\doifelsenextchar\par{#1{}}\syst_helpers_next_par}} @@ -4086,7 +4087,7 @@ \let\syst_helpers_next_war\relax \let\syst_helpers_next_arg\relax -\unexpanded\def\dowithwargument#1% +\protected\def\dowithwargument#1% {\def\syst_helpers_next_war##1 {#1{##1}}% \def\syst_helpers_next_arg##1{#1{##1}}% \doifelsenextbgroup\syst_helpers_next_arg\syst_helpers_next_war} @@ -4120,7 +4121,7 @@ %D commands, the \type {n*} is optional. When this specification is missing, the %D command executes once. -\unexpanded\def\dorepeatwithcommand[#1]% +\protected\def\dorepeatwithcommand[#1]% {\syst_helpers_repeat_with_command#1*\empty*\relax} \def\syst_helpers_repeat_with_command#1*#2#3*#4\relax#5% @@ -4187,7 +4188,7 @@ \newtoks\t_syst_helpers_scratch \let \m_syst_helpers_scratch\empty -\unexpanded\def\appendtoks#1\to#2% +\protected\def\appendtoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\toksapp \else @@ -4195,7 +4196,7 @@ \expandafter\gtoksapp \fi#2{#1}} -\unexpanded\def\prependtoks#1\to#2% +\protected\def\prependtoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\tokspre \else @@ -4219,14 +4220,14 @@ \expandafter\gtokspre \fi\m_syst_helpers_scratch\t_syst_helpers_scratch} -\unexpanded\def\appendtoksonce#1\to#2% +\protected\def\appendtoksonce#1\to#2% {\let\m_syst_helpers_scratch#2% \t_syst_helpers_scratch{#1}% \ifhasxtoks\t_syst_helpers_scratch\m_syst_helpers_scratch\else \syst_helpers_append_toks_indeed \fi} -\unexpanded\def\prependtoksonce#1\to#2% +\protected\def\prependtoksonce#1\to#2% {\let\m_syst_helpers_scratch#2% \t_syst_helpers_scratch{#1}% \ifhasxtoks\t_syst_helpers_scratch\m_syst_helpers_scratch\else @@ -4235,7 +4236,7 @@ %D The test macro: -\unexpanded\def\doifelseintoks#1#2% #1 en #2 zijn toks +\protected\def\doifelseintoks#1#2% #1 en #2 zijn toks {\ifhasxtoks#1#2% \expandafter\firstoftwoarguments \else @@ -4265,14 +4266,14 @@ \newtoks \collectingtoks -\unexpanded\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}} -\unexpanded\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}} +\protected\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}} +\protected\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}} -\unexpanded\def\startcollecting{\collectingtoks\emptytoks} -\unexpanded\def\stopcollecting {\the\collectingtoks} +\protected\def\startcollecting{\collectingtoks\emptytoks} +\protected\def\stopcollecting {\the\collectingtoks} -\unexpanded\def\collect {\toksapp \collectingtoks} -\unexpanded\def\collectexpanded{\etoksapp\collectingtoks} +\protected\def\collect {\toksapp \collectingtoks} +\protected\def\collectexpanded{\etoksapp\collectingtoks} %D A nice one too: @@ -4282,7 +4283,7 @@ % {\scratchtoks{xaa} \removetoks x\from\scratchtoks [\the\scratchtoks]} % {\scratchtoks{a\relax b} \removetoks \relax\from\scratchtoks [\showthe\scratchtoks]} -\unexpanded\def\removetoks#1\from#2% +\protected\def\removetoks#1\from#2% {\def\syst_helpers_remove_toks##1#1##2\empty\empty\empty##3^^^^0004% {\def\m_syst_string_one{##3}% \ifempty\m_syst_string_one#2{##1}\else#2{##1##2}\fi}% @@ -4290,7 +4291,7 @@ %D Also: -\unexpanded\def\appendetoks#1\to#2% +\protected\def\appendetoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\etoksapp \else @@ -4298,7 +4299,7 @@ \expandafter\xtoksapp \fi#2{#1}} -\unexpanded\def\prependetoks#1\to#2% +\protected\def\prependetoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\etokspre \else @@ -4308,7 +4309,7 @@ %D Hm. -\unexpanded\def\flushtoks#1% nb: can reassign to #1 again, hence the indirectness +\protected\def\flushtoks#1% nb: can reassign to #1 again, hence the indirectness {\t_syst_helpers_scratch#1\relax \dodoglobal#1\emptytoks \the\t_syst_helpers_scratch\relax} @@ -4333,7 +4334,7 @@ \let\syst_helpers_split_string\relax -\unexpanded\def\beforesplitstring#1\at#2\to#3% +\protected\def\beforesplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##1#2##0^^^^0004% no #- as we need to count {\ifarguments \let#3\empty @@ -4344,7 +4345,7 @@ \fi}% \expandafter\syst_helpers_split_string#1^^^^0004\ignorearguments\ignorearguments} -\unexpanded\def\aftersplitstring#1\at#2\to#3% +\protected\def\aftersplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##0#2##2^^^^0004% no #- as we need to count {\ifarguments \let#3\empty @@ -4360,7 +4361,7 @@ %D %D A bonus macro. -\unexpanded\def\splitstring#1\at#2\to#3\and#4% +\protected\def\splitstring#1\at#2\to#3\and#4% {\def\syst_helpers_split_string##1#2##2^^^^0004% {\ifarguments \let#3\empty @@ -4374,7 +4375,7 @@ \fi}% \expandafter\syst_helpers_split_string#1^^^^0004\ignorearguments\ignorearguments} -\unexpanded\def\greedysplitstring#1\at#2\to#3\and#4% +\protected\def\greedysplitstring#1\at#2\to#3\and#4% {\def\syst_helpers_split_string##1#2##2^^^^0004% {\ifarguments \let#3\empty @@ -4404,7 +4405,7 @@ \let\beforetestandsplitstring\beforesplitstring -\unexpanded\def\aftertestandsplitstring#1\at#2\to#3% +\protected\def\aftertestandsplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##0#2##2^^^^0004% no #- as we need to count {\ifarguments \let#3\empty @@ -4415,7 +4416,7 @@ \fi}% \expandafter\syst_helpers_split_string#1^^^^0004\ignorearguments\ignorearguments} -\unexpanded\def\testandsplitstring#1\at#2\to#3\and#4% +\protected\def\testandsplitstring#1\at#2\to#3\and#4% {\def\syst_helpers_split_string##1#2##2^^^^0004% {\ifarguments \let#3\empty @@ -4436,23 +4437,23 @@ %D splitatcolon, %D splitatcolons} -% \unexpanded\def\syst_helpers_splitatperiod #1.#2.#0^^^^0004#4#5{\def #4{#1}\def #5{#2}} -% \unexpanded\def\syst_helpers_splitatcomma #1,#2,#0^^^^0004#4#5{\def #4{#1}\def #5{#2}} -% \unexpanded\def\syst_helpers_splitatasterisk #1*#2*#0^^^^0004#4#5{\def #4{#1}\def #5{#2}} -% \unexpanded\def\syst_helpers_splitatcolon #1:#2:#0^^^^0004#4#5{\def #4{#1}\def #5{#2}} -% \unexpanded\def\syst_helpers_splitatcolons #1::#2::#0^^^^0004#4#5{\edef#4{#1}\edef#5{#2}} +% \protected\def\syst_helpers_splitatperiod #1.#2.#0^^^^0004#4#5{\def #4{#1}\def #5{#2}} +% \protected\def\syst_helpers_splitatcomma #1,#2,#0^^^^0004#4#5{\def #4{#1}\def #5{#2}} +% \protected\def\syst_helpers_splitatasterisk #1*#2*#0^^^^0004#4#5{\def #4{#1}\def #5{#2}} +% \protected\def\syst_helpers_splitatcolon #1:#2:#0^^^^0004#4#5{\def #4{#1}\def #5{#2}} +% \protected\def\syst_helpers_splitatcolons #1::#2::#0^^^^0004#4#5{\edef#4{#1}\edef#5{#2}} -\unexpanded\def\syst_helpers_splitatperiod #1.#2.#-^^^^0004#3#4{\def #3{#1}\def #4{#2}} -\unexpanded\def\syst_helpers_splitatcomma #1,#2,#-^^^^0004#3#4{\def #3{#1}\def #4{#2}} -\unexpanded\def\syst_helpers_splitatasterisk #1*#2*#-^^^^0004#3#4{\def #3{#1}\def #4{#2}} -\unexpanded\def\syst_helpers_splitatcolon #1:#2:#-^^^^0004#3#4{\def #3{#1}\def #4{#2}} -\unexpanded\def\syst_helpers_splitatcolons #1::#2::#-^^^^0004#3#4{\edef#3{#1}\edef#4{#2}} +\protected\def\syst_helpers_splitatperiod #1.#2.#-^^^^0004#3#4{\def #3{#1}\def #4{#2}} +\protected\def\syst_helpers_splitatcomma #1,#2,#-^^^^0004#3#4{\def #3{#1}\def #4{#2}} +\protected\def\syst_helpers_splitatasterisk #1*#2*#-^^^^0004#3#4{\def #3{#1}\def #4{#2}} +\protected\def\syst_helpers_splitatcolon #1:#2:#-^^^^0004#3#4{\def #3{#1}\def #4{#2}} +\protected\def\syst_helpers_splitatcolons #1::#2::#-^^^^0004#3#4{\edef#3{#1}\edef#4{#2}} -\unexpanded\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..^^^^0004} -\unexpanded\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,^^^^0004} % not at ", " -\unexpanded\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**^^^^0004} -\unexpanded\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::^^^^0004} -\unexpanded\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::^^^^0004} +\protected\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..^^^^0004} +\protected\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,^^^^0004} % not at ", " +\protected\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**^^^^0004} +\protected\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::^^^^0004} +\protected\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::^^^^0004} %D \macros %D {removesubstring} @@ -4465,7 +4466,7 @@ %D %D Which in terms of \TEX\ looks like: -\unexpanded\def\removesubstring#1\from#2\to#3% +\protected\def\removesubstring#1\from#2\to#3% {\splitstring#2\to\m_syst_string_one\and\m_syst_string_two \dodoglobal#3{\m_syst_string_one\m_syst_string_two}} @@ -4522,36 +4523,36 @@ %D %D The faster alternatives are: -\unexpanded\def\appendtocommalist#1#2% +\protected\def\appendtocommalist#1#2% {\dodoglobal\edef#2{\ifempty#2\else#2,\fi#1}} -\unexpanded\def\prependtocommalist#1#2% +\protected\def\prependtocommalist#1#2% {\dodoglobal\edef#2{#1\ifempty#2\else,#2\fi}} -\unexpanded\def\addtocommalist#1#2% {item} \cs +\protected\def\addtocommalist#1#2% {item} \cs {\rawdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{\ifempty#2\else#2,\fi#1}}} -\unexpanded\def\pretocommalist#1#2% {item} \cs +\protected\def\pretocommalist#1#2% {item} \cs {\rawdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{#1\ifempty#2\else,#2\fi}}} -\unexpanded\def\robustdoifelseinset#1#2% +\protected\def\robustdoifelseinset#1#2% {\edef\m_syst_string_one{\detokenize\expandafter{\normalexpanded{#1}}}% \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#2}}}% \rawdoifelseinset\m_syst_string_one\m_syst_string_two} \let\robustdoifinsetelse\robustdoifelseinset -\unexpanded\def\robustaddtocommalist#1#2% {item} \cs +\protected\def\robustaddtocommalist#1#2% {item} \cs {\robustdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{\ifempty#2\else#2,\fi#1}}} -\unexpanded\def\robustpretocommalist#1#2% {item} \cs +\protected\def\robustpretocommalist#1#2% {item} \cs {\robustdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{#1\ifempty#2\else,#2\fi}}} -\unexpanded\def\xsplitstring#1#2% \cs {str} +\protected\def\xsplitstring#1#2% \cs {str} %{\def\syst_helpers_split_string##1,#2,##2,#2,##3\\% {\def\syst_helpers_split_string##1,#2,##2,#2,##-\\% {\edef\m_syst_string_one{\bcleanedupcommalist##1\empty\empty\relax}% @@ -4563,7 +4564,7 @@ %def\acleanedupcommalist#1,,#2\relax{#1} \def\acleanedupcommalist#1,,#-\relax{#1} -\unexpanded\def\removefromcommalist#1#2% to be sped up +\protected\def\removefromcommalist#1#2% to be sped up {\rawdoifelseinset{#1}#2% {\normalexpanded{\xsplitstring\noexpand#2{#1}}% \dodoglobal\edef#2% @@ -4593,7 +4594,7 @@ \edef\m_syst_string_four{\ifempty\m_syst_string_four\else\m_syst_string_four,\fi#1}% \fi} -\unexpanded\def\substituteincommalist#1#2#3% old, new, list (slooow) +\protected\def\substituteincommalist#1#2#3% old, new, list (slooow) {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \let\m_syst_string_four\empty @@ -4656,7 +4657,7 @@ \fi \advance\commalistcounter\plusone} -\unexpanded\def\replaceincommalist#1#2% #1 = commalistelement #2 = position starts at 1 +\protected\def\replaceincommalist#1#2% #1 = commalistelement #2 = position starts at 1 {\c_syst_helpers_comma_list_index#2\relax \let\m_syst_helpers_comma_list_target\empty \let\commalistelement\empty @@ -4680,7 +4681,7 @@ \expandafter\syst_helpers_comma_list_command_global_step \fi} -\unexpanded\def\globalprocesscommalist[#1]#2% +\protected\def\globalprocesscommalist[#1]#2% {\glet\m_syst_helpers_comma_list_command_global#2% \expandafter\syst_helpers_comma_list_command_global_step#1,],} @@ -4748,13 +4749,13 @@ \newcount\c_syst_helpers_swapped \let \m_syst_helpers_swapped\relax -\unexpanded\def\swapdimens#1#2{\d_syst_helpers_swapped#1#1#2#2\d_syst_helpers_swapped} -\unexpanded\def\swapcounts#1#2{\c_syst_helpers_swapped#1#1#2#2\c_syst_helpers_swapped} -\unexpanded\def\swapmacros#1#2{\let\m_syst_helpers_swapped#1\let#1#2\let#2\m_syst_helpers_swapped} +\protected\def\swapdimens#1#2{\d_syst_helpers_swapped#1#1#2#2\d_syst_helpers_swapped} +\protected\def\swapcounts#1#2{\c_syst_helpers_swapped#1#1#2#2\c_syst_helpers_swapped} +\protected\def\swapmacros#1#2{\let\m_syst_helpers_swapped#1\let#1#2\let#2\m_syst_helpers_swapped} -\unexpanded\def\globalswapdimens#1#2{\d_syst_helpers_swapped#1\global#1#2\global#2\d_syst_helpers_swapped} -\unexpanded\def\globalswapcounts#1#2{\c_syst_helpers_swapped#1\global#1#2\global#2\c_syst_helpers_swapped} -\unexpanded\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet#1#2\glet#2\m_syst_helpers_swapped} +\protected\def\globalswapdimens#1#2{\d_syst_helpers_swapped#1\global#1#2\global#2\d_syst_helpers_swapped} +\protected\def\globalswapcounts#1#2{\c_syst_helpers_swapped#1\global#1#2\global#2\c_syst_helpers_swapped} +\protected\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet#1#2\glet#2\m_syst_helpers_swapped} %D \macros %D {pushmacro,popmacro} @@ -4787,7 +4788,7 @@ \newdimen\localhsize -\unexpanded\def\setlocalhsize % don't change ! +\protected\def\setlocalhsize % don't change ! {\doifelsenextoptional \syst_helpers_set_local_hsize_yes \syst_helpers_set_local_hsize_nop} @@ -4823,70 +4824,70 @@ %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% +\protected\def\doifvalue#1#2% {\iftok{\csname#1\endcsname}{#2}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotvalue#1#2% +\protected\def\doifnotvalue#1#2% {\iftok{\csname#1\endcsname}{#2}% \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsevalue#1#2% +\protected\def\doifelsevalue#1#2% {\iftok{\csname#1\endcsname}{#2}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifnothing#1% +\protected\def\doifnothing#1% {\iftok{#1}\emptytoks \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifsomething#1% +\protected\def\doifsomething#1% {\iftok{#1}\emptytoks \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsenothing#1% +\protected\def\doifelsenothing#1% {\iftok{#1}\emptytoks \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifelsesomething#1% +\protected\def\doifelsesomething#1% {\iftok{#1}\emptytoks \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} -\unexpanded\def\doifvaluenothing#1% +\protected\def\doifvaluenothing#1% {\iftok{\csname#1\endcsname}\emptytoks \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifvaluesomething#1% +\protected\def\doifvaluesomething#1% {\iftok{\csname#1\endcsname}\emptytoks \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsevaluenothing#1% +\protected\def\doifelsevaluenothing#1% {\iftok{\csname#1\endcsname}\emptytoks \expandafter\firstoftwoarguments \else @@ -4940,9 +4941,9 @@ \processcommalist[#3]\syst_helpers_do_common_check_all \ifdone\expandafter#1\else\expandafter#2\fi} -\unexpanded\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments} -\unexpanded\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument } -\unexpanded\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments } +\protected\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments} +\protected\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument } +\protected\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments } \let\doifallcommonelse\doifelseallcommon @@ -4965,34 +4966,34 @@ %D These might end up as \LUA based helpers (i.e. consider these %D obsolete: -\unexpanded\def\syst_helpers_do_IF#1#2% +\protected\def\syst_helpers_do_IF#1#2% {\uppercase{\iftok{#1}{#2}}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\syst_helpers_do_IF_NOT#1#2% +\protected\def\syst_helpers_do_IF_NOT#1#2% {\uppercase{\iftok{#1}{#2}}% \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\unexpanded\def\syst_helpers_do_IF_ELSE#1#2% +\protected\def\syst_helpers_do_IF_ELSE#1#2% {\uppercase{\iftok{#1}{#2}}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\syst_helpers_do_IF_INSTRING_ELSE#1#2% +\protected\def\syst_helpers_do_IF_INSTRING_ELSE#1#2% {\uppercase{\doifelseinstring{#1}{#2}}} -\unexpanded\def\DOIF #1#2{\normalexpanded{\syst_helpers_do_IF {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFNOT #1#2{\normalexpanded{\syst_helpers_do_IF_NOT {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFELSE #1#2{\normalexpanded{\syst_helpers_do_IF_ELSE {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\syst_helpers_do_IF_INSTRING_ELSE{#1}{#2}}}% will become obsolete +\protected\def\DOIF #1#2{\normalexpanded{\syst_helpers_do_IF {#1}{#2}}}% will become obsolete +\protected\def\DOIFNOT #1#2{\normalexpanded{\syst_helpers_do_IF_NOT {#1}{#2}}}% will become obsolete +\protected\def\DOIFELSE #1#2{\normalexpanded{\syst_helpers_do_IF_ELSE {#1}{#2}}}% will become obsolete +\protected\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\syst_helpers_do_IF_INSTRING_ELSE{#1}{#2}}}% will become obsolete %D \macros %D {dosingleargumentwithset, @@ -5017,7 +5018,7 @@ %D \def\dodefinesomething[#1][#2]% %D {\getparameters[\??xx#1][#2]} %D -%D \unexpanded\def\definesomething% +%D \protected\def\definesomething% %D {\dodoubleargumentwithset\dodefinesomething} %D \stoptyping %D @@ -5071,7 +5072,7 @@ \let\m_syst_helpers_strip_character\empty -\unexpanded\def\stripcharacter#1\from#2\to#3% +\protected\def\stripcharacter#1\from#2\to#3% {\def\syst_helpers_strip_character##1#1##2\end {\edef\m_syst_helpers_strip_character{\m_syst_helpers_strip_character##1}% \doifnotempty{##2}{\syst_helpers_strip_character##2\end}}% @@ -5080,7 +5081,7 @@ \expandafter\syst_helpers_strip_character\m_syst_string_one#1\end \dodoglobal\let#3\m_syst_helpers_strip_character} -\unexpanded\def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2 +\protected\def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2 {\stripcharacter{ }\from#1\to#2} %D \macros @@ -5089,7 +5090,7 @@ %D The next macro does the same but is more compatible with other macros, like \type %D {\convert...}. -\unexpanded\def\unspacestring#1\to#2% +\protected\def\unspacestring#1\to#2% {\stripcharacter{ }\from#1\to#2} %D \macros @@ -5201,7 +5202,7 @@ \syst_helpers_process_separated_list_step}% \expandafter\syst_helpers_process_separated_list_step\gobbleoneargument#1#3]#3} -\unexpanded\def\processseparatedlist[% +\protected\def\processseparatedlist[% {\syst_helpers_process_separated_list\relax} %D \macros @@ -5224,7 +5225,7 @@ \let\syst_helpers_process_any_list_indeed\relax \let\syst_helpers_process_any_list_step \relax -\unexpanded\def\processlist#1#2#3#4% no blank skipping ! +\protected\def\processlist#1#2#3#4% no blank skipping ! {\def\syst_helpers_process_any_list_indeed##1#2% {\def\syst_helpers_process_any_list_step####1####2#3% {\ifx#2####1% @@ -5253,14 +5254,14 @@ %D This command can be integrated in \type {\getparameters}, but we decided best not %D to do so. -% \unexpanded\def\processassignlist#1[#2]#3% +% \protected\def\processassignlist#1[#2]#3% % {\def\syst_helpers_process_assign_list_assign[##1=##2=##3]% % {\doif{##3}\relax{#3{##1}}}% % \def\syst_helpers_process_assign_list_step##1% % {\syst_helpers_process_assign_list_assign[##1==\relax]}% % \processcommalist[#2]\syst_helpers_process_assign_list_step} -\unexpanded\def\processassignlist#1[#2]#3% +\protected\def\processassignlist#1[#2]#3% {\def\syst_helpers_process_assign_list_assign[##1=##-=##2]% {\doif{##2}\relax{#3{##1}}}% \def\syst_helpers_process_assign_list_step##1% @@ -5283,7 +5284,7 @@ \let\m_syst_helpers_untexed\empty -\unexpanded\def\untexsomething +\protected\def\untexsomething {\begingroup \catcode\leftbraceasciicode \ignorecatcode \catcode\rightbraceasciicode\ignorecatcode @@ -5295,8 +5296,8 @@ \endgroup \let#3\m_syst_helpers_untexed} -\unexpanded\def\untexargument{\untexsomething\convertargument} -\unexpanded\def\untexcommand {\untexsomething\convertcommand} +\protected\def\untexargument{\untexsomething\convertargument} +\protected\def\untexcommand {\untexsomething\convertcommand} %D \macros %D {ScaledPointsToBigPoints,ScaledPointsToWholeBigPoints} @@ -5313,10 +5314,10 @@ \let\tobigpoints \clf_tobigpoints \let\towholebigpoints\clf_towholebigpoints -\unexpanded\def\PointsToBigPoints #1#2{\edef#2{\tobigpoints #1}} % can be avoided -\unexpanded\def\PointsToWholeBigPoints #1#2{\edef#2{\towholebigpoints#1}} % can be avoided -\unexpanded\def\ScaledPointsToBigPoints #1#2{\edef#2{\tobigpoints #1\scaledpoint}} % obsolete -\unexpanded\def\ScaledPointsToWholeBigPoints#1#2{\edef#2{\towholebigpoints#1\scaledpoint}} % obsolete +\protected\def\PointsToBigPoints #1#2{\edef#2{\tobigpoints #1}} % can be avoided +\protected\def\PointsToWholeBigPoints #1#2{\edef#2{\towholebigpoints#1}} % can be avoided +\protected\def\ScaledPointsToBigPoints #1#2{\edef#2{\tobigpoints #1\scaledpoint}} % obsolete +\protected\def\ScaledPointsToWholeBigPoints#1#2{\edef#2{\towholebigpoints#1\scaledpoint}} % obsolete %D \macros %D {PointsToReal} @@ -5328,10 +5329,10 @@ %D \PointsToReal {dimension} \target %D \stoptyping -% \unexpanded\def\PointsToReal#1#2% +% \protected\def\PointsToReal#1#2% % {\edef#2{\withoutpt\the\dimexpr#1}} -\unexpanded\def\PointsToReal#1#2% +\protected\def\PointsToReal#1#2% {\edef#2{\thewithoutunit\dimexpr#1}} %D \macros @@ -5366,7 +5367,7 @@ %D \starttyping %D \newbox\b_syst_helpers_dlh %D -%D \unexpanded\def\dontleavehmode +%D \protected\def\dontleavehmode %D {\ifhmode\else \ifmmode\else %D \setbox\b_syst_helpers_dlh\hbox{\mathsurround\zeropoint\everymath\emptytoks$ $}\unhbox\b_syst_helpers_dlh %D \fi \fi} @@ -5394,8 +5395,8 @@ \def\utfupper#1{\clf_upper{#1}} % expandable \def\utflower#1{\clf_lower{#1}} % expandable -\unexpanded\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}} -\unexpanded\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}} +\protected\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}} +\protected\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}} %D \macros %D {handletokens} @@ -5440,14 +5441,14 @@ \expandafter\syst_helpers_count_token \fi} -\unexpanded\def\counttoken#1\in#2\to#3% +\protected\def\counttoken#1\in#2\to#3% {\privatescratchcounter\zerocount \def\m_syst_string_one{#1}% \def\m_syst_string_two{\end}% \syst_helpers_count_token#2\end \dodoglobal#3\privatescratchcounter} -\unexpanded\def\counttokens#1\to#2% +\protected\def\counttokens#1\to#2% {\privatescratchcounter\zerocount \def\syst_helpers_count_token##1{\advance\privatescratchcounter\plusone}% \handletokens#1\with\syst_helpers_count_token @@ -5459,7 +5460,7 @@ %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 +\protected\def\splitofftokens#1\from#2\to#3% slow but hardly used {\ifnum#1>\zerocount \privatescratchcounter#1\relax \def\syst_helpers_split_off_tokens##1% @@ -5503,10 +5504,10 @@ %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 +\protected\def\syst_helpers_handle_tokens % \nexthandledtoken is part of interface {\futurelet\nexthandledtoken\syst_helpers_handle_tokens_indeed} -\unexpanded\def\handletokens#1\with#2% +\protected\def\handletokens#1\with#2% {\gdef\syst_helpers_handle_tokens_command{#2}% permits more complex #2's \syst_helpers_handle_tokens#1\end} @@ -5555,8 +5556,8 @@ \newtoks\everysettrialtypesetting \newtoks\everyresettrialtypesetting -\unexpanded\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so -\unexpanded\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed +\protected\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so +\protected\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed \let\iftrialtypesetting\iffalse % so we have no \trialtypesettingtrue|false in mkiv ! @@ -5581,15 +5582,15 @@ %D This macro is first used in the tabulation macros. %D %D \starttyping -%D \unexpanded\def\starthans% +%D \protected\def\starthans% %D {\processcontent{stophans}\test{\message{\test}\wait}} %D \stoptyping -\unexpanded\def\processcontent#1% +\protected\def\processcontent#1% {\begingroup\expandafter\syst_helpers_process_content\csname#1\endcsname} -\unexpanded\def\syst_helpers_process_content#1#2#3% - {\unexpanded\def\syst_helpers_process_content##1#1% +\protected\def\syst_helpers_process_content#1#2#3% + {\protected\def\syst_helpers_process_content##1#1% {\endgroup\def#2{##1}#3}% \syst_helpers_process_content} @@ -5623,10 +5624,10 @@ %D As an alternative for the next macro we can use a global assignment inside a box. %D The \type {\empty}'s permits gobbling while preventing spurious \type {\relax}'s. -\unexpanded\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick +\protected\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick {\afterassignment\gobblefourarguments#1=#2#3pt\relax\empty\empty\empty\empty} -\unexpanded\def\freezedimensionwithunit#1#2% +\protected\def\freezedimensionwithunit#1#2% {\setdimensionwithunit\privatescratchdimen#1{#2}\edef#1{\the\privatescratchdimen}} %D \macros @@ -5634,21 +5635,21 @@ %D %D Not that fast I guess, but here's a way to test for token registers being empty. -\unexpanded\def\doifelsesometoks#1% +\protected\def\doifelsesometoks#1% {\iftok#1\emptytoks \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} -\unexpanded\def\doifsometoks#1% +\protected\def\doifsometoks#1% {\iftok#1\emptytoks \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\unexpanded\def\doifemptytoks#1% +\protected\def\doifemptytoks#1% {\iftok#1\emptytoks \expandafter\firstofoneargument \else @@ -5671,7 +5672,7 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\strictdoifelsenextoptional#1#2% +\protected\def\strictdoifelsenextoptional#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% \futurelet\nexttoken\syst_helpers_strict_inspect_next_character} @@ -5720,7 +5721,7 @@ \def\syst_helpers_serialize_comma_list_step#1% {\edef\serializedcommalist{\serializedcommalist#1}} -\unexpanded\def\serializecommalist[#1]% +\protected\def\serializecommalist[#1]% {\let\serializedcommalist\empty \processcommacommand[#1]\syst_helpers_serialize_comma_list_step} @@ -5815,22 +5816,22 @@ \installsystemnamespace{measure} -\unexpanded\def\definemeasure +\protected\def\definemeasure {\dodoubleargument\syst_helpers_define_measure} \def\syst_helpers_define_measure[#1][#2]% {\expandafter\def\csname\??measure#1\endcsname{#2}} -\unexpanded\def\freezemeasure +\protected\def\freezemeasure {\dodoubleargument\syst_helpers_freeze_measure} \def\syst_helpers_freeze_measure[#1][#2]% {\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} -\unexpanded\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way -\unexpanded\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way -\unexpanded\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way -\unexpanded\def\setxmeasure#1#2{\expandafter\xdef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way +\protected\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way +\protected\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way +\protected\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way +\protected\def\setxmeasure#1#2{\expandafter\xdef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way \def\measure {\the\measured} @@ -5852,22 +5853,22 @@ \installsystemnamespace{quantity} -\unexpanded\def\definequantity +\protected\def\definequantity {\dodoubleargument\syst_helpers_define_quantity} \def\syst_helpers_define_quantity[#1][#2]% {\expandafter\def\csname\??quantity#1\endcsname{#2}} -\unexpanded\def\freezequantity +\protected\def\freezequantity {\dodoubleargument\syst_helpers_freeze_quantity} \def\syst_helpers_freeze_quantity[#1][#2]% {\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} -\unexpanded\def\setquantity #1#2{\expandafter\def \csname\??quantity#1\endcsname{#2}} % quick way -\unexpanded\def\setgquantity#1#2{\expandafter\gdef\csname\??quantity#1\endcsname{#2}} % quick way -\unexpanded\def\setequantity#1#2{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way -\unexpanded\def\setxquantity#1#2{\expandafter\xdef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way +\protected\def\setquantity #1#2{\expandafter\def \csname\??quantity#1\endcsname{#2}} % quick way +\protected\def\setgquantity#1#2{\expandafter\gdef\csname\??quantity#1\endcsname{#2}} % quick way +\protected\def\setequantity#1#2{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way +\protected\def\setxquantity#1#2{\expandafter\xdef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way \def\quantity {\the\quantitied} @@ -5964,19 +5965,19 @@ % \copycsname xxx\endcsname\csname ..\endcsname -\unexpanded\def\copycsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter\csname} +\protected\def\copycsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter\csname} % \letcscsname \crap \csname ..\endcsname % \letcsnamecs \csname ..\endcsname\crap % \letcsnamecsname\csname ..\endcsname\csname ..\endcsname -\unexpanded\def\letcscsname {\expandafter\let\expandafter} -\unexpanded\def\letcsnamecs {\expandafter\let} -\unexpanded\def\letcsnamecsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter} +\protected\def\letcscsname {\expandafter\let\expandafter} +\protected\def\letcsnamecs {\expandafter\let} +\protected\def\letcsnamecsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter} % another one, add an item to a commalist -\unexpanded\def\addvalue#1#2% cs item +\protected\def\addvalue#1#2% cs item {\ifcsname#1\endcsname\else\expandafter\let\csname#1\endcsname\empty\fi \normalexpanded{\addtocommalist{#2}\expandafter\noexpand\csname#1\endcsname}} @@ -5993,25 +5994,25 @@ \fi \syst_helpers_unspaced} -\unexpanded\def\unspaceargument#1\to#2% +\protected\def\unspaceargument#1\to#2% {\privatescratchcounter\catcode\spaceasciicode \catcode\spaceasciicode\ignorecatcode \scantextokens{\edef#2{#1}}% \catcode\spaceasciicode\privatescratchcounter} -\unexpanded\def\unspaceafter#1#2% +\protected\def\unspaceafter#1#2% {\unspaceargument#2\to\ascii \expandafter#1\expandafter{\ascii}} % sometimes handy: -\unexpanded\def\doifelsehasspace#1% +\protected\def\doifelsehasspace#1% {\edef\m_syst_string_one{#1}% \normalexpanded{\syst_helpers_if_has_space_else#1\space}\empty\relax} \let\doifhasspaceelse\doifelsehasspace -\unexpanded\def\syst_helpers_if_has_space_else#1 #2#3\relax % \space\empty\relax +\protected\def\syst_helpers_if_has_space_else#1 #2#3\relax % \space\empty\relax {\ifx\m_syst_string_one\space \expandafter\firstoftwoarguments \orelse\ifempty#2% @@ -6024,8 +6025,8 @@ \installsystemnamespace{flag} -\unexpanded\def\setflag #1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\zerocount} -\unexpanded\def\resetflag#1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\plusone} +\protected\def\setflag #1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\zerocount} +\protected\def\resetflag#1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\plusone} \def\flag#1{\csname\??flag#1\endcsname} @@ -6049,7 +6050,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey +\protected\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey {\expandafter\def\csname#1#3\expandafter\endcsname\expandafter{\csname#1#5\endcsname}} \def\syst_helpers_if_non_zero_positive_else#1#2\end % #3#4% @@ -6075,36 +6076,36 @@ % here ? -\unexpanded\def\dosetrawvalue #1#2#3{\expandafter \def\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawevalue#1#2#3{\expandafter\edef\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawgvalue#1#2#3{\expandafter\gdef\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawxvalue#1#2#3{\expandafter\xdef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawvalue #1#2#3{\expandafter \def\csname#1#2\endcsname{#3}} +\protected\def\dosetrawevalue#1#2#3{\expandafter\edef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawgvalue#1#2#3{\expandafter\gdef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawxvalue#1#2#3{\expandafter\xdef\csname#1#2\endcsname{#3}} -\unexpanded\def\getrawparameters {\dogetparameters\dosetrawvalue } -\unexpanded\def\getraweparameters {\dogetparameters\dosetrawevalue} -\unexpanded\def\getrawgparameters {\dogetparameters\dosetrawgvalue} -\unexpanded\def\getrawxparameters {\dogetparameters\dosetrawxvalue} +\protected\def\getrawparameters {\dogetparameters\dosetrawvalue } +\protected\def\getraweparameters {\dogetparameters\dosetrawevalue} +\protected\def\getrawgparameters {\dogetparameters\dosetrawgvalue} +\protected\def\getrawxparameters {\dogetparameters\dosetrawxvalue} -\unexpanded\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete +\protected\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete %D Sort of obsolete: \newcount\c_syst_helpers_mod -\unexpanded\def\dosetmodulo#1#2#3% +\protected\def\dosetmodulo#1#2#3% {\c_syst_helpers_mod#1\divide\c_syst_helpers_mod#2\multiply\c_syst_helpers_mod#2% #3#1\advance#3-\c_syst_helpers_mod} -\unexpanded\def\dosetdivision#1#2#3% +\protected\def\dosetdivision#1#2#3% {#3#1\divide#3 #2\relax} -\unexpanded\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}} -\unexpanded\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}} +\protected\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}} +\protected\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}} \def\syst_helpers_unprotected#1\par {#1\protect} -\unexpanded\def\unprotected +\protected\def\unprotected {\unprotect \syst_helpers_unprotected} @@ -6114,7 +6115,7 @@ \let\elapsedsteps\!!zerocount -\unexpanded\def\elapsedsteptime % unexpanded ! a bit useless but who knows ... +\protected\def\elapsedsteptime % unexpanded ! a bit useless but who knows ... {\clf_elapsedsteptime\elapsedsteps\relax} \newcount\c_syst_helpers_test_feature_n @@ -6122,7 +6123,7 @@ \def\currentfeaturetest{\number\c_syst_helpers_test_feature_n} -\unexpanded\def\testfeature#1#2% +\protected\def\testfeature#1#2% {\c_syst_helpers_test_feature_m#1\relax \xdef\elapsedsteps{\number\c_syst_helpers_test_feature_m}% \def\syst_helpers_test_feature_yes @@ -6137,7 +6138,7 @@ \fi}% \retestfeature} -\unexpanded\def\retestfeature % timer support is new per 10/5/2005 +\protected\def\retestfeature % timer support is new per 10/5/2005 {\bgroup \ifcase\interactionmode\let\wait\relax\fi \clf_resettimer @@ -6156,10 +6157,10 @@ \clf_elapsedsteptime\elapsedsteps\space\space per step}% \egroup} -\unexpanded\def\showtimer#1% +\protected\def\showtimer#1% {\writestatus{runtime}{\elapsedseconds\space s / #1}} -\unexpanded\def\testfeatureonce#1#2% +\protected\def\testfeatureonce#1#2% {\begingroup \let\wait\relax \testfeature{#1}{#2}% @@ -6174,7 +6175,7 @@ %D \freezedimenmacro\leftmargindistance %D \stoptyping -\unexpanded\def\freezedimenmacro#1% +\protected\def\freezedimenmacro#1% {\edef#1{\the\dimexpr#1}} %D The next macro negates a macro (dimension or number, or actually, whatever. It's @@ -6192,17 +6193,17 @@ \def\assigndimen#1#2% {\afterassignment\gobbleassigndimen#1=#2\zeropoint\\} -\unexpanded\def\appended#1#2#3{\expandafter#1\expandafter#2\expandafter{#2#3}} -\unexpanded\def\appendvalue #1{\expandafter\appended\expandafter \def\csname#1\endcsname} -\unexpanded\def\appendgvalue#1{\expandafter\appended\expandafter\gdef\csname#1\endcsname} +\protected\def\appended#1#2#3{\expandafter#1\expandafter#2\expandafter{#2#3}} +\protected\def\appendvalue #1{\expandafter\appended\expandafter \def\csname#1\endcsname} +\protected\def\appendgvalue#1{\expandafter\appended\expandafter\gdef\csname#1\endcsname} -\unexpanded\def\prepended#1#2#3% +\protected\def\prepended#1#2#3% {\t_syst_helpers_scratch{#3}% \expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter#2\expandafter\expandafter\expandafter {\expandafter\the\expandafter\t_syst_helpers_scratch#2}} -\unexpanded\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname} -\unexpanded\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname} +\protected\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname} +\protected\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname} %D \macros %D {dowithrange} @@ -6224,11 +6225,11 @@ \ifempty\m_syst_helpers_range_to\let\m_syst_helpers_range_to\m_syst_helpers_range_from\fi \dostepwiserecurse\m_syst_helpers_range_from\m_syst_helpers_range_to\plusone{\m_helpers_range_action{##1}}}% -\unexpanded\def\processranges[#1]#2% #1= n:m,p,q:r +\protected\def\processranges[#1]#2% #1= n:m,p,q:r {\def\m_helpers_range_action{#2}% \processcommacommand[#1]\syst_helpers_with_range} -\unexpanded\def\dowithrange#1#2% +\protected\def\dowithrange#1#2% {\def\m_helpers_range_action{#2}% \processcommacommand[#1]\syst_helpers_with_range} @@ -6247,7 +6248,7 @@ %D %D \typebuffer \getbuffer -\unexpanded\def\ignoreimplicitspaces +\protected\def\ignoreimplicitspaces {\doifelsenextchar\relax\relax\relax} %D \macros @@ -6274,11 +6275,11 @@ \newbox\b_syst_helpers_no_interference -\unexpanded\def\startnointerference % not even grouped ! +\protected\def\startnointerference % not even grouped ! {\setbox\b_syst_helpers_no_interference\vbox \bgroup} -\unexpanded\def\stopnointerference +\protected\def\stopnointerference {\egroup \setbox\b_syst_helpers_no_interference\emptybox} @@ -6293,7 +6294,7 @@ %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 +\protected\def\signalcharacter{\char\zerocount} % \zwj %D A few secial variants of commands defined here. Some more will be moved here (e.g. %D from table modules. @@ -6431,7 +6432,7 @@ % {title} {\texdefinition{btx:apa:title-subtitle-type}} % {default} {\btxflush{author}} -% \unexpanded\def\doifcase#1% +% \protected\def\doifcase#1% % {\edef\m_case_asked{#1}% % \syst_aux_case} % @@ -6478,12 +6479,12 @@ %D Experiment (sometimes looks nicer in code): -\unexpanded\def\sameargumentscondition#1#2% +\protected\def\sameargumentscondition#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two} -\unexpanded\def\emptyargumentcondition#1% +\protected\def\emptyargumentcondition#1% {\edef\m_syst_string_one{#1}% \ifempty\m_syst_string_one} diff --git a/tex/context/base/mkiv/syst-con.mkiv b/tex/context/base/mkiv/syst-con.mkiv index 56155460a..ddd65865d 100644 --- a/tex/context/base/mkiv/syst-con.mkiv +++ b/tex/context/base/mkiv/syst-con.mkiv @@ -84,14 +84,14 @@ %D \macros{setcalculatedsin,setcalculatedcos,setcalculatedtan} -\unexpanded\def\setcalculatedsin#1#2{\edef#1{\clf_sind#2}} -\unexpanded\def\setcalculatedcos#1#2{\edef#1{\clf_cosd#2}} -\unexpanded\def\setcalculatedtan#1#2{\edef#1{\clf_tand#2}} +\protected\def\setcalculatedsin#1#2{\edef#1{\clf_sind#2}} +\protected\def\setcalculatedcos#1#2{\edef#1{\clf_cosd#2}} +\protected\def\setcalculatedtan#1#2{\edef#1{\clf_tand#2}} %D \macros{formatted,format} - \def\formatted#1{\ctxcommand{format(#1)}} % not clf -\unexpanded\def\format #1{\ctxcommand{format(#1)}} % not clf + \def\formatted#1{\ctxcommand{format(#1)}} % not clf +\protected\def\format #1{\ctxcommand{format(#1)}} % not clf %D The \type {\modulatednumber} and \type {\realnumber} macros have been removed. diff --git a/tex/context/base/mkiv/syst-con.mkxl b/tex/context/base/mkiv/syst-con.mkxl index c3293b221..ffff5aab7 100644 --- a/tex/context/base/mkiv/syst-con.mkxl +++ b/tex/context/base/mkiv/syst-con.mkxl @@ -79,14 +79,14 @@ %D \macros{setcalculatedsin,setcalculatedcos,setcalculatedtan} -\unexpanded\def\setcalculatedsin#1#2{\edef#1{\clf_sind#2}} -\unexpanded\def\setcalculatedcos#1#2{\edef#1{\clf_cosd#2}} -\unexpanded\def\setcalculatedtan#1#2{\edef#1{\clf_tand#2}} +\protected\def\setcalculatedsin#1#2{\edef#1{\clf_sind#2}} +\protected\def\setcalculatedcos#1#2{\edef#1{\clf_cosd#2}} +\protected\def\setcalculatedtan#1#2{\edef#1{\clf_tand#2}} %D \macros{formatted,format} - \def\formatted#1{\ctxcommand{format(#1)}} % not clf -\unexpanded\def\format #1{\ctxcommand{format(#1)}} % not clf + \def\formatted#1{\ctxcommand{format(#1)}} % not clf +\protected\def\format #1{\ctxcommand{format(#1)}} % not clf %D The \type {\modulatednumber} and \type {\realnumber} macros have been removed. diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index 1de243a6d..1fa52e625 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -235,21 +235,21 @@ %D The allocators share a common helper macro. -\normalprotected\def\newcount {\syst_basics_allocate\c_syst_last_allocated_count \count \countdef \c_syst_max_allocated_register} -\normalprotected\def\newdimen {\syst_basics_allocate\c_syst_last_allocated_dimen \dimen \dimendef \c_syst_max_allocated_register} -\normalprotected\def\newskip {\syst_basics_allocate\c_syst_last_allocated_skip \skip \skipdef \c_syst_max_allocated_register} -\normalprotected\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register} -\normalprotected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \mathchardef\c_syst_max_allocated_register} -\normalprotected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register} -\normalprotected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \chardef \c_syst_max_allocated_read} -\normalprotected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \chardef \c_syst_max_allocated_write} -\normalprotected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \mathchardef\c_syst_max_allocated_register} -\normalprotected\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert} +\protected\def\newcount {\syst_basics_allocate\c_syst_last_allocated_count \count \countdef \c_syst_max_allocated_register} +\protected\def\newdimen {\syst_basics_allocate\c_syst_last_allocated_dimen \dimen \dimendef \c_syst_max_allocated_register} +\protected\def\newskip {\syst_basics_allocate\c_syst_last_allocated_skip \skip \skipdef \c_syst_max_allocated_register} +\protected\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register} +\protected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \mathchardef\c_syst_max_allocated_register} +\protected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register} +\protected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \chardef \c_syst_max_allocated_read} +\protected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \chardef \c_syst_max_allocated_write} +\protected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \mathchardef\c_syst_max_allocated_register} +\protected\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert} %D We don't need these in \CONTEXT: -\normalprotected\def\newlanguage{\syst_basics_allocate\c_syst_last_allocated_language \language\chardef \c_syst_max_allocated_language} -\normalprotected\def\newfamily {\syst_basics_allocate\c_syst_last_allocated_family \fam \chardef \c_syst_max_allocated_family} +\protected\def\newlanguage{\syst_basics_allocate\c_syst_last_allocated_language \language\chardef \c_syst_max_allocated_language} +\protected\def\newfamily {\syst_basics_allocate\c_syst_last_allocated_family \fam \chardef \c_syst_max_allocated_family} \let\newfam\newfamily @@ -258,10 +258,10 @@ % Watch out, for the moment we disable the check for already being defined % later we will revert this but first all chardefs must be replaced. -\normalprotected\def\newconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1} -\normalprotected\def\setnewconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1#1} % just a number -\normalprotected\def\setconstant {} % dummy, no checking, so it warns -\normalprotected\def\setconstantvalue#1#2{\csname#1\endcsname\numexpr#2\relax} +\protected\def\newconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1} +\protected\def\setnewconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1#1} % just a number +\protected\def\setconstant {} % dummy, no checking, so it warns +\protected\def\setconstantvalue#1#2{\csname#1\endcsname\numexpr#2\relax} % maybe setconstant with check @@ -276,8 +276,8 @@ %D as all engines now provide many registers we removed all traces. \ifdefined\writestatus \else - %\normalprotected\def\writestatus#1#2{\immediate\write\statuswrite{#1: #2}} - \normalprotected\def\writestatus#1#2{\message{#1: #2}} + %\protected\def\writestatus#1#2{\immediate\write\statuswrite{#1: #2}} + \protected\def\writestatus#1#2{\message{#1: #2}} \fi \def\syst_basics_allocate_yes#1#2#3#4#5% last class method max name @@ -304,8 +304,8 @@ %D Since the number of chars exceed 256 now, we can use \type {\chardef} instead of %D the more limited \type {\mathchardef}. -\normalprotected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \chardef\c_syst_max_allocated_register} -\normalprotected\def\newmarks{\syst_basics_allocate\c_syst_last_allocated_marks\marks\chardef\c_syst_max_allocated_register} +\protected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \chardef\c_syst_max_allocated_register} +\protected\def\newmarks{\syst_basics_allocate\c_syst_last_allocated_marks\marks\chardef\c_syst_max_allocated_register} %D Attributes are something very \LUATEX. In \CONTEXT\ you are not supposed to use %D the attributes directly but always allocate then first. For instance attribute~0 @@ -314,14 +314,14 @@ \let\attributeunsetvalue\c_syst_min_counter_value % used to be \minusone -\normalprotected\def\newattribute{\syst_basics_allocate\c_syst_last_allocated_attribute\attribute\attributedef\c_syst_max_allocated_register} +\protected\def\newattribute{\syst_basics_allocate\c_syst_last_allocated_attribute\attribute\attributedef\c_syst_max_allocated_register} %D Not used by \CONTEXT\ but for instance \PICTEX\ needs it. It's a trick to force %D strings instead of tokens that take more memory. It's a trick to trick to force %D strings. This macro is never used in \CONTEXT. -%normalprotected\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} -\normalprotected\def\newhelp#1#2{\newtoks#1#1\expandafter{\detokenize{#2}}} +%protected\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} +\protected\def\newhelp#1#2{\newtoks#1#1\expandafter{\detokenize{#2}}} %D \macros %D {scratchcounter, @@ -490,7 +490,7 @@ %D %D We need this one soon: -\normalprotected\def\dontcomplain +\protected\def\dontcomplain {\hbadness\plustenthousand \vbadness\plustenthousand \hfuzz \maxdimen @@ -524,7 +524,7 @@ %D creates \type {\footrue}, \type {\foofalse} to go with \type {\iffoo}. %D \stopnarrower -% \normalprotected\def\newif#1% +% \protected\def\newif#1% % {\count@\escapechar % \escapechar\minusone % \expandafter\expandafter\expandafter\def\new_if #1{true}{\let#1\iftrue }% @@ -542,7 +542,7 @@ % We use \csstring so there is no need to push/pop escapechar. % We use different names so that we get a better error message. % -% \normalprotected\def\newif#1% +% \protected\def\newif#1% % {\let\new_if_saved\newif % \let\newif\new_if_check % \expandafter\expandafter\expandafter\def\new_if_cs #1{true}{\let#1\iftrue }% @@ -550,12 +550,12 @@ % \new_if_cs#1{false}% % \let\newif\new_if_saved} % -% \normalprotected\def\new_if_cs#1#2% +% \protected\def\new_if_cs#1#2% % {\csname\expandafter\newif\csstring#1#2\endcsname} % % We wrap all into one macro: -\normalprotected\def\newif#1% +\protected\def\newif#1% {\let\new_if_saved\newif \let\newif\new_if_check \expandafter\def\csname\expandafter\newif\csstring#1true\endcsname {\let#1\iftrue }% @@ -576,10 +576,10 @@ %D A few shortcuts: -\normalprotected\def\udef {\normalprotected\def } -\normalprotected\def\ugdef{\normalprotected\gdef} -\normalprotected\def\uedef{\normalprotected\edef} -\normalprotected\def\uxdef{\normalprotected\xdef} +\protected\def\udef {\protected\def } +\protected\def\ugdef{\protected\gdef} +\protected\def\uedef{\protected\edef} +\protected\def\uxdef{\protected\xdef} %D For a while we keep the following, as systems like tikz need it. Best %D not use that one \CONTEXT. @@ -696,7 +696,7 @@ % no longer \errorstopmode cf. plain tex 3.141592653 -\normalprotected\def\tracingall +\protected\def\tracingall {\tracingonline \plusone \tracingcommands \plusthree \tracingstats \plustwo @@ -714,11 +714,11 @@ \tracingnesting \plustwo \tracingassigns \plustwo} -\normalprotected\def\loggingall +\protected\def\loggingall {\tracingall \tracingonline \zerocount} -\normalprotected\def\tracingnone +\protected\def\tracingnone {\tracingassigns \zerocount \tracingnesting \zerocount \tracingscantokens\zerocount @@ -811,11 +811,11 @@ \let\conditionalfalse\plusone % maybe we will have a dedicated count/chardef \let\conditionaltrue \zerocount % maybe we will have a dedicated count/chardef -\normalprotected\def\settrue #1{\let#1\conditionaltrue } -\normalprotected\def\setfalse#1{\let#1\conditionalfalse} +\protected\def\settrue #1{\let#1\conditionaltrue } +\protected\def\setfalse#1{\let#1\conditionalfalse} -\normalprotected\def\settruevalue #1{\expandafter\let\csname#1\endcsname\conditionaltrue } -\normalprotected\def\setfalsevalue#1{\expandafter\let\csname#1\endcsname\conditionalfalse} +\protected\def\settruevalue #1{\expandafter\let\csname#1\endcsname\conditionaltrue } +\protected\def\setfalsevalue#1{\expandafter\let\csname#1\endcsname\conditionalfalse} \let\newconditional\setfalse \let\ifconditional \ifcase @@ -831,13 +831,13 @@ %D Let's be complete and also introduce some definers. These are not mandate %D but handy for grepping. -\normalprotected\def\newmacro #1{\let#1\empty} -\normalprotected\def\setnewmacro#1{\let#1} +\protected\def\newmacro #1{\let#1\empty} +\protected\def\setnewmacro#1{\let#1} \def\!!zerocount{0} \def\!!plusone {1} -\normalprotected\def\newfraction#1{\let#1\!!plusone} +\protected\def\newfraction#1{\let#1\!!plusone} %D It would be handy to have a primitive \type {\unless\ifcase} because then we %D could use nicer values. Anyhow, this conditional code used to be in the \type @@ -859,19 +859,19 @@ % % we assume a \cs. not toks0 or so % -% \normalprotected\def\appendtotoks #1#{\def\temp{#1}\afterassignment\doappendtotoks \scratchtoks=} -% \normalprotected\def\prependtotoks#1#{\def\temp{#1}\afterassignment\doprependtotoks\scratchtoks=} +% \protected\def\appendtotoks #1#{\def\temp{#1}\afterassignment\doappendtotoks \scratchtoks=} +% \protected\def\prependtotoks#1#{\def\temp{#1}\afterassignment\doprependtotoks\scratchtoks=} \newtoks\t_syst_toks_temp \let\m_syst_toks_temp\t_syst_toks_temp -\normalprotected\def\appendtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_append_l \t_syst_toks_temp=} -\normalprotected\def\prependtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_prepend_l\t_syst_toks_temp=} +\protected\def\appendtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_append_l \t_syst_toks_temp=} +\protected\def\prependtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_prepend_l\t_syst_toks_temp=} % \def\syst_toks_append {\m_syst_toks_temp\expandafter\expandafter\expandafter{\expandafter\the\expandafter\m_syst_toks_temp\the\t_syst_toks_temp}}} % \def\syst_toks_prepend{\m_syst_toks_temp\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t_syst_toks_temp\the\m_syst_toks_temp}}} -\normalprotected\def\globalappendtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_append_g \t_syst_toks_temp=} -\normalprotected\def\globalprependtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_prepend_g\t_syst_toks_temp=} +\protected\def\globalappendtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_append_g \t_syst_toks_temp=} +\protected\def\globalprependtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_prepend_g\t_syst_toks_temp=} \def\syst_toks_append_l {\normalexpanded{\m_syst_toks_temp{\the\m_syst_toks_temp\the\t_syst_toks_temp}}} \def\syst_toks_prepend_l{\normalexpanded{\m_syst_toks_temp{\the\t_syst_toks_temp\the\m_syst_toks_temp}}} @@ -879,14 +879,14 @@ \def\syst_toks_append_g {\global\syst_toks_append_l } \def\syst_toks_prepend_g{\global\syst_toks_prepend_l} -\normalprotected\def\addtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_add_l\let\next} -\normalprotected\def\globaladdtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_add_g\let\next} +\protected\def\addtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_add_l\let\next} +\protected\def\globaladdtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_add_g\let\next} \def\syst_toks_add_l{\m_syst_toks_temp\expandafter\bgroup\the\m_syst_toks_temp} \def\syst_toks_add_g{\global\syst_toks_add_l} -\normalprotected\def\addtotokscs #1#2{#1{\the#1#2}} % saves a few bytes -\normalprotected\def\globaladdtotokscs#1#2{\global#1{\the#1#2}} % saves a few bytes +\protected\def\addtotokscs #1#2{#1{\the#1#2}} % saves a few bytes +\protected\def\globaladdtotokscs#1#2{\global#1{\the#1#2}} % saves a few bytes %D \macros %D {begcsname} @@ -905,20 +905,20 @@ % % \newtoks\everyendpar % -% \normalprotected\def\endpar{\the\everyendpar\normalpar} -% \normalprotected\def\par {\endpar} +% \protected\def\endpar{\the\everyendpar\normalpar} +% \protected\def\par {\endpar} % -% \normalprotected\def\reseteverypar +% \protected\def\reseteverypar % {\everypar \emptytoks % \everyendpar\emptytoks} -\normalprotected\def\reseteverypar +\protected\def\reseteverypar {\everypar\emptytoks} \let\endgraf\par \let\endline\cr -\normalprotected\def\null{\hpack{}} +\protected\def\null{\hpack{}} %D The following two might be overloaded later on but some modules need then %D earlier. These functionality is reflected in the name and will not change. @@ -997,8 +997,8 @@ %D Sometimes kerns make more sense than glue but we need to be in the %D right mode: -\normalprotected\def\vkern{\ifhmode\par \fi\kern} -\normalprotected\def\hkern{\ifvmode\dontleavehmode\fi\kern} +\protected\def\vkern{\ifhmode\par \fi\kern} +\protected\def\hkern{\ifvmode\dontleavehmode\fi\kern} %D Again a few kind-of-extensions the core. These come from plain \TEX\ but %D are probably not used in \CONTEXT. @@ -1146,7 +1146,7 @@ \def\v_interfaces_prefix_template_system{\number \c_syst_helpers_n_of_namespaces>>} %def\v_interfaces_prefix_template_system{\characters\c_syst_helpers_n_of_namespaces>>} % no \characters yet -\normalprotected\def\installsystemnamespace#1% +\protected\def\installsystemnamespace#1% {\ifcsname ??#1\endcsname \immediate\write\statuswrite{fatal error: duplicate system namespace '#1'}% \expandafter\normalend @@ -1182,4 +1182,13 @@ \glyphdimensionsmode\plusone +%D For completeness (tokenizer commands have complements), so this one complements +%D \type {\detokenize}, like \type {\expanded} and \type {\unexpanded}. Not that we +%D ever needed this one: + +\ifdefined \tokenized \else + \def\tokenized#1{\scantextokens\expandafter{\normalexpanded{#1}}} +\fi + + \protect \endinput diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl index a4c355bba..1aa78f564 100644 --- a/tex/context/base/mkiv/syst-ini.mkxl +++ b/tex/context/base/mkiv/syst-ini.mkxl @@ -266,21 +266,21 @@ %D The allocators share a common helper macro. -\normalprotected\def\newcount {\syst_basics_allocate\c_syst_last_allocated_count \count \countdef \c_syst_max_allocated_register} -\normalprotected\def\newdimen {\syst_basics_allocate\c_syst_last_allocated_dimen \dimen \dimendef \c_syst_max_allocated_register} -\normalprotected\def\newskip {\syst_basics_allocate\c_syst_last_allocated_skip \skip \skipdef \c_syst_max_allocated_register} -\normalprotected\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register} -\normalprotected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \mathchardef\c_syst_max_allocated_register} -\normalprotected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register} -\normalprotected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \chardef \c_syst_max_allocated_read} -\normalprotected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \chardef \c_syst_max_allocated_write} -\normalprotected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \mathchardef\c_syst_max_allocated_register} -\normalprotected\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert} +\protected\def\newcount {\syst_basics_allocate\c_syst_last_allocated_count \count \countdef \c_syst_max_allocated_register} +\protected\def\newdimen {\syst_basics_allocate\c_syst_last_allocated_dimen \dimen \dimendef \c_syst_max_allocated_register} +\protected\def\newskip {\syst_basics_allocate\c_syst_last_allocated_skip \skip \skipdef \c_syst_max_allocated_register} +\protected\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register} +\protected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \mathchardef\c_syst_max_allocated_register} +\protected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register} +\protected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \chardef \c_syst_max_allocated_read} +\protected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \chardef \c_syst_max_allocated_write} +\protected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \mathchardef\c_syst_max_allocated_register} +\protected\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert} %D We don't need these in \CONTEXT: -\normalprotected\def\newlanguage{\syst_basics_allocate\c_syst_last_allocated_language \language\chardef \c_syst_max_allocated_language} -\normalprotected\def\newfamily {\syst_basics_allocate\c_syst_last_allocated_family \fam \chardef \c_syst_max_allocated_family} +\protected\def\newlanguage{\syst_basics_allocate\c_syst_last_allocated_language \language\chardef \c_syst_max_allocated_language} +\protected\def\newfamily {\syst_basics_allocate\c_syst_last_allocated_family \fam \chardef \c_syst_max_allocated_family} \let\newfam\newfamily @@ -289,10 +289,10 @@ % Watch out, for the moment we disable the check for already being defined % later we will revert this but first all chardefs must be replaced. -\normalprotected\def\newconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1} -\normalprotected\def\setnewconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1#1} % just a number -\normalprotected\def\setconstant {} % dummy, no checking, so it warns -\normalprotected\def\setconstantvalue#1#2{\csname#1\endcsname\numexpr#2\relax} +\protected\def\newconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1} +\protected\def\setnewconstant #1{\ifdefined#1\let#1\undefined\fi\newcount#1#1} % just a number +\protected\def\setconstant {} % dummy, no checking, so it warns +\protected\def\setconstantvalue#1#2{\csname#1\endcsname\numexpr#2\relax} % maybe setconstant with check @@ -307,8 +307,8 @@ %D as all engines now provide many registers we removed all traces. \ifdefined\writestatus \else - %\normalprotected\def\writestatus#1#2{\immediate\write\statuswrite{#1: #2}} - \normalprotected\def\writestatus#1#2{\message{#1: #2}} + %\protected\def\writestatus#1#2{\immediate\write\statuswrite{#1: #2}} + \protected\def\writestatus#1#2{\message{#1: #2}} \fi \def\syst_basics_allocate_yes#1#2#3#4#5% last class method max name @@ -335,8 +335,8 @@ %D Since the number of chars exceed 256 now, we can use \type {\chardef} instead of %D the more limited \type {\mathchardef}. -\normalprotected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \chardef\c_syst_max_allocated_register} -\normalprotected\def\newmarks{\syst_basics_allocate\c_syst_last_allocated_marks\marks\chardef\c_syst_max_allocated_register} +\protected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \chardef\c_syst_max_allocated_register} +\protected\def\newmarks{\syst_basics_allocate\c_syst_last_allocated_marks\marks\chardef\c_syst_max_allocated_register} %D Attributes are something very \LUATEX. In \CONTEXT\ you are not supposed to use %D the attributes directly but always allocate then first. For instance attribute~0 @@ -345,14 +345,14 @@ \let\attributeunsetvalue\c_syst_min_counter_value % used to be \minusone -\normalprotected\def\newattribute{\syst_basics_allocate\c_syst_last_allocated_attribute\attribute\attributedef\c_syst_max_allocated_register} +\protected\def\newattribute{\syst_basics_allocate\c_syst_last_allocated_attribute\attribute\attributedef\c_syst_max_allocated_register} %D Not used by \CONTEXT\ but for instance \PICTEX\ needs it. It's a trick to force %D strings instead of tokens that take more memory. It's a trick to trick to force %D strings. This macro is never used in \CONTEXT. -%normalprotected\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} -\normalprotected\def\newhelp#1#2{\newtoks#1#1\expandafter{\detokenize{#2}}} +%protected\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} +\protected\def\newhelp#1#2{\newtoks#1#1\expandafter{\detokenize{#2}}} %D \macros %D {scratchcounter, @@ -521,7 +521,7 @@ %D %D We need this one soon: -\normalprotected\def\dontcomplain +\protected\def\dontcomplain {\hbadness\plustenthousand \vbadness\plustenthousand \hfuzz \maxdimen @@ -555,7 +555,7 @@ %D creates \type {\footrue}, \type {\foofalse} to go with \type {\iffoo}. %D \stopnarrower -% \normalprotected\def\newif#1% +% \protected\def\newif#1% % {\count@\escapechar % \escapechar\minusone % \expandafter\expandafter\expandafter\def\new_if #1{true}{\let#1\iftrue }% @@ -573,7 +573,7 @@ % We use \csstring so there is no need to push/pop escapechar. % We use different names so that we get a better error message. % -% \normalprotected\def\newif#1% +% \protected\def\newif#1% % {\let\new_if_saved\newif % \let\newif\new_if_check % \expandafter\expandafter\expandafter\def\new_if_cs #1{true}{\let#1\iftrue }% @@ -581,12 +581,12 @@ % \new_if_cs#1{false}% % \let\newif\new_if_saved} % -% \normalprotected\def\new_if_cs#1#2% +% \protected\def\new_if_cs#1#2% % {\csname\expandafter\newif\csstring#1#2\endcsname} % % We wrap all into one macro: -\normalprotected\def\newif#1% +\protected\def\newif#1% {\let\new_if_saved\newif \let\newif\new_if_check \expandafter\def\csname\expandafter\newif\csstring#1true\endcsname {\let#1\iftrue }% @@ -607,10 +607,10 @@ %D A few shortcuts: -\normalprotected\def\udef {\normalprotected\def } -\normalprotected\def\ugdef{\normalprotected\gdef} -\normalprotected\def\uedef{\normalprotected\edef} -\normalprotected\def\uxdef{\normalprotected\xdef} +\protected\def\udef {\protected\def } +\protected\def\ugdef{\protected\gdef} +\protected\def\uedef{\protected\edef} +\protected\def\uxdef{\protected\xdef} %D For a while we keep the following, as systems like tikz need it. Best %D not use that one \CONTEXT. @@ -703,7 +703,7 @@ % no longer \errorstopmode cf. plain tex 3.141592653 -\normalprotected\def\tracingall +\protected\def\tracingall {\tracingonline \plusone \tracingcommands \plusthree \tracingstats \plustwo @@ -721,11 +721,11 @@ \tracingnesting \plustwo \tracingassigns \plustwo} -\normalprotected\def\loggingall +\protected\def\loggingall {\tracingall \tracingonline \zerocount} -\normalprotected\def\tracingnone +\protected\def\tracingnone {\tracingassigns \zerocount \tracingnesting \zerocount \tracingscantokens\zerocount @@ -818,11 +818,11 @@ \let\conditionalfalse\plusone % maybe we will have a dedicated count/chardef \let\conditionaltrue \zerocount % maybe we will have a dedicated count/chardef -\normalprotected\def\settrue #1{\let#1\conditionaltrue } -\normalprotected\def\setfalse#1{\let#1\conditionalfalse} +\protected\def\settrue #1{\let#1\conditionaltrue } +\protected\def\setfalse#1{\let#1\conditionalfalse} -\normalprotected\def\settruevalue #1{\expandafter\let\csname#1\endcsname\conditionaltrue } -\normalprotected\def\setfalsevalue#1{\expandafter\let\csname#1\endcsname\conditionalfalse} +\protected\def\settruevalue #1{\expandafter\let\csname#1\endcsname\conditionaltrue } +\protected\def\setfalsevalue#1{\expandafter\let\csname#1\endcsname\conditionalfalse} \let\newconditional\setfalse \let\ifconditional \ifcase @@ -843,13 +843,13 @@ %D Let's be complete and also introduce some definers. These are not mandate %D but handy for grepping. -\normalprotected\def\newmacro #1{\let#1\empty} -\normalprotected\def\setnewmacro#1{\let#1} +\protected\def\newmacro #1{\let#1\empty} +\protected\def\setnewmacro#1{\let#1} \def\!!zerocount{0} \def\!!plusone {1} -\normalprotected\def\newfraction#1{\let#1\!!plusone} +\protected\def\newfraction#1{\let#1\!!plusone} %D It would be handy to have a primitive \type {\unless\ifcase} because then we %D could use nicer values. Anyhow, this conditional code used to be in the \type @@ -871,19 +871,19 @@ % % we assume a \cs. not toks0 or so % -% \normalprotected\def\appendtotoks #1#{\def\temp{#1}\afterassignment\doappendtotoks \scratchtoks=} -% \normalprotected\def\prependtotoks#1#{\def\temp{#1}\afterassignment\doprependtotoks\scratchtoks=} +% \protected\def\appendtotoks #1#{\def\temp{#1}\afterassignment\doappendtotoks \scratchtoks=} +% \protected\def\prependtotoks#1#{\def\temp{#1}\afterassignment\doprependtotoks\scratchtoks=} \newtoks\t_syst_toks_temp \let\m_syst_toks_temp\t_syst_toks_temp -\normalprotected\def\appendtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_append_l \t_syst_toks_temp=} -\normalprotected\def\prependtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_prepend_l\t_syst_toks_temp=} +\protected\def\appendtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_append_l \t_syst_toks_temp=} +\protected\def\prependtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_prepend_l\t_syst_toks_temp=} % \def\syst_toks_append {\m_syst_toks_temp\expandafter\expandafter\expandafter{\expandafter\the\expandafter\m_syst_toks_temp\the\t_syst_toks_temp}}} % \def\syst_toks_prepend{\m_syst_toks_temp\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t_syst_toks_temp\the\m_syst_toks_temp}}} -\normalprotected\def\globalappendtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_append_g \t_syst_toks_temp=} -\normalprotected\def\globalprependtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_prepend_g\t_syst_toks_temp=} +\protected\def\globalappendtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_append_g \t_syst_toks_temp=} +\protected\def\globalprependtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_prepend_g\t_syst_toks_temp=} \def\syst_toks_append_l {\normalexpanded{\m_syst_toks_temp{\the\m_syst_toks_temp\the\t_syst_toks_temp}}} \def\syst_toks_prepend_l{\normalexpanded{\m_syst_toks_temp{\the\t_syst_toks_temp\the\m_syst_toks_temp}}} @@ -891,14 +891,14 @@ \def\syst_toks_append_g {\global\syst_toks_append_l } \def\syst_toks_prepend_g{\global\syst_toks_prepend_l} -\normalprotected\def\addtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_add_l\let\next} -\normalprotected\def\globaladdtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_add_g\let\next} +\protected\def\addtotoks #1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_add_l\let\next} +\protected\def\globaladdtotoks#1{\let\m_syst_toks_temp#1\afterassignment\syst_toks_add_g\let\next} \def\syst_toks_add_l{\m_syst_toks_temp\expandafter\bgroup\the\m_syst_toks_temp} \def\syst_toks_add_g{\global\syst_toks_add_l} -\normalprotected\def\addtotokscs #1#2{#1{\the#1#2}} % saves a few bytes -\normalprotected\def\globaladdtotokscs#1#2{\global#1{\the#1#2}} % saves a few bytes +\protected\def\addtotokscs #1#2{#1{\the#1#2}} % saves a few bytes +\protected\def\globaladdtotokscs#1#2{\global#1{\the#1#2}} % saves a few bytes %D \macros %D {begcsname} @@ -917,20 +917,20 @@ % % \newtoks\everyendpar % -% \normalprotected\def\endpar{\the\everyendpar\normalpar} -% \normalprotected\def\par {\endpar} +% \protected\def\endpar{\the\everyendpar\normalpar} +% \protected\def\par {\endpar} % -% \normalprotected\def\reseteverypar +% \protected\def\reseteverypar % {\everypar \emptytoks % \everyendpar\emptytoks} -\normalprotected\def\reseteverypar +\protected\def\reseteverypar {\everypar\emptytoks} \let\endgraf\par \let\endline\cr -\normalprotected\def\null{\hpack{}} +\protected\def\null{\hpack{}} %D The following two might be overloaded later on but some modules need then %D earlier. These functionality is reflected in the name and will not change. @@ -1009,8 +1009,8 @@ %D Sometimes kerns make more sense than glue but we need to be in the %D right mode: -\normalprotected\def\vkern{\ifhmode\par \fi\kern} -\normalprotected\def\hkern{\ifvmode\dontleavehmode\fi\kern} +\protected\def\vkern{\ifhmode\par \fi\kern} +\protected\def\hkern{\ifvmode\dontleavehmode\fi\kern} %D Again a few kind-of-extensions the core. These come from plain \TEX\ but %D are probably not used in \CONTEXT. @@ -1087,7 +1087,7 @@ \def\v_interfaces_prefix_template_system{\number \c_syst_helpers_n_of_namespaces>>} %def\v_interfaces_prefix_template_system{\characters\c_syst_helpers_n_of_namespaces>>} % no \characters yet -\normalprotected\def\installsystemnamespace#1% +\protected\def\installsystemnamespace#1% {\ifcsname ??#1\endcsname \immediate\write\statuswrite{fatal error: duplicate system namespace '#1'}% \expandafter\normalend diff --git a/tex/context/base/mkiv/syst-lua.mkiv b/tex/context/base/mkiv/syst-lua.mkiv index d275acd7d..6ad8f5a99 100644 --- a/tex/context/base/mkiv/syst-lua.mkiv +++ b/tex/context/base/mkiv/syst-lua.mkiv @@ -68,7 +68,7 @@ \edef\!!bs{[\luastringsep[} \edef\!!es{]\luastringsep]} -\unexpanded\def\writestatus#1#2{\clf_writestatus{#1}{#2}} +\protected\def\writestatus#1#2{\clf_writestatus{#1}{#2}} %D We can omit the tex.ctxcatcodes here as nowadays we seldom change the regime at %D the \TEX\ end: diff --git a/tex/context/base/mkiv/syst-lua.mkxl b/tex/context/base/mkiv/syst-lua.mkxl index ae0de0f22..89d5ed6dd 100644 --- a/tex/context/base/mkiv/syst-lua.mkxl +++ b/tex/context/base/mkiv/syst-lua.mkxl @@ -45,7 +45,7 @@ \edef\!!bs{[\luastringsep[} \edef\!!es{]\luastringsep]} -\unexpanded\def\writestatus#1#2{\clf_writestatus{#1}{#2}} +\protected\def\writestatus#1#2{\clf_writestatus{#1}{#2}} %D We can omit the tex.ctxcatcodes here as nowadays we seldom change the regime at %D the \TEX\ end: diff --git a/tex/context/base/mkiv/syst-mes.mkiv b/tex/context/base/mkiv/syst-mes.mkiv index 4ed2697f1..cf9da21de 100644 --- a/tex/context/base/mkiv/syst-mes.mkiv +++ b/tex/context/base/mkiv/syst-mes.mkiv @@ -11,8 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\normalprotected\def\writestring {\immediate\write\statuswrite} -\normalprotected\def\writeline {\writestring{}} - \let\message \normalmessage +\protected\def\writestring {\immediate\write\statuswrite} +\protected\def\writeline {\writestring{}} + \let\message \normalmessage \endinput diff --git a/tex/context/modules/mkiv/m-system-aliasing.mkiv b/tex/context/modules/mkiv/m-system-aliasing.mkiv new file mode 100644 index 000000000..4661cc503 --- /dev/null +++ b/tex/context/modules/mkiv/m-system-aliasing.mkiv @@ -0,0 +1,120 @@ +%D \module +%D [ file=m-system-aliasing, +%D version=2020.07.08, +%D title=\CONTEXT\ Modules, +%D subtitle=Loading generic stuff, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] + +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmodule[system-aliasing] + +\startluacode + local next = next + local find, topattern = string.find, string.topattern + + local aliases = { } + local replacer = false + local filenames = false + local wildcards = false + local enabled = false + + local report = logs.reporter("system", "aliasing") + + -- This is not yet perfect as we actually need to quit at a non token. + + interfaces.implement { + name = "registeralias", + public = true, + arguments = { "csname", "csname" }, + actions = function(old,new) + aliases[old] = new + replacer = false + end + } + + interfaces.implement { + name = "registeraliasfile", + public = true, + arguments = "string", + actions = function(name) + if find(name,"%*") then + name = topattern(name) + if wildcards then wildcards[name] = true else wildcards = { [name] = true } end + else + if filenames then filenames[name] = true else filenames = { [name] = true } end + end + if not enabled then + utilities.sequencers.appendaction( + resolvers.openers.helpers.textfileactions, + "system","resolvers.macros.processgeneric" + ) + utilities.sequencers.enableaction( + resolvers.openers.helpers.textfileactions, + "resolvers.macros.processgeneric" + ) + enabled = true + end + end + } + + local function found(name) + if filenames and filenames[name] then + return true + end + if wildcards then + for k, v in next, wildcards do + if find(name,k) then + return true + end + end + end + return false + end + + local Cs, lpegmatch = lpeg.Cs, lpeg.match + + local utfchartabletopattern = lpeg.utfchartabletopattern + local utf8character = lpeg.patterns.utf8character + local escapecharacter = lpeg.P("\\") + local terminal = lpeg.S([[`"'~@#$%^&_-+/*=(){}[]<>:;,.!?|\\]]) + + lpeg.P(-1) + local lpegmatch = lpeg.match + + function resolvers.macros.processgeneric(str,name) + if found(name) then + report("file %a",name) + if not replacer then + replacer = Cs( ( + escapecharacter + * (utfchartabletopattern(aliases) / aliases) + * terminal + + utf8character + )^0 ) + end + str = lpegmatch(replacer,str) or str + end + return str + end + +\stopluacode + +\registeralias \protected \normalprotected +\registeralias \unexpanded \normalunexpanded +\registeralias \expanded \normalexpanded + +%D \starttyping +%D \registeraliasfile{rubish.tex} +%D \registeraliasfile{generic/*.tex} +%D +%D % e.g. \def\foo{\unexpanded{test}} +%D +%D \input rubish.tex +%D \input generic/foo.tex +%D \stoptyping + +\stopmodule diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 65060a8f4..ed2413858 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 : 2020-07-07 15:55 +-- merge date : 2020-07-09 14:48 do -- begin closure to overcome local limits and interference @@ -225,11 +225,13 @@ local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0) local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0)) local nospacer=Cs((whitespace^1/""+nonwhitespace^1)^0) local b_collapser=Cs(whitespace^0/""*(nonwhitespace^1+whitespace^1/" ")^0) -local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0) local m_collapser=Cs((nonwhitespace^1+whitespace^1/" ")^0) +local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0) +local x_collapser=Cs((nonwhitespace^1+whitespace^1/"" )^0) local b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0) -local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0) local m_stripper=Cs((nonspacer^1+spacer^1/" ")^0) +local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0) +local x_stripper=Cs((nonspacer^1+spacer^1/"" )^0) patterns.stripper=stripper patterns.fullstripper=fullstripper patterns.collapser=collapser @@ -237,9 +239,11 @@ patterns.nospacer=nospacer patterns.b_collapser=b_collapser patterns.m_collapser=m_collapser patterns.e_collapser=e_collapser +patterns.x_collapser=x_collapser patterns.b_stripper=b_stripper patterns.m_stripper=m_stripper patterns.e_stripper=e_stripper +patterns.x_stripper=x_stripper patterns.lowercase=lowercase patterns.uppercase=uppercase patterns.letter=patterns.lowercase+patterns.uppercase |