summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/syst-aux.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/syst-aux.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/syst-aux.mkiv1102
1 files changed, 562 insertions, 540 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/syst-aux.mkiv b/Master/texmf-dist/tex/context/base/mkiv/syst-aux.mkiv
index 255f0746c39..194f1de2cb1 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/syst-aux.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/syst-aux.mkiv
@@ -12,6 +12,7 @@
%C details.
\registerctxluafile{syst-aux}{}
+\registerctxluafile{syst-mac}{}
% A dedicated primitive \ifvoidmacro\cs == \ifx\cs\empty is some 10% faster but
% probably not that noticeable in practice. An \ifvoidtoks might make sense but we
@@ -47,7 +48,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
@@ -55,21 +56,10 @@
\let\unexpanded\normalprotected
-\ifcase\contextlmtxmode
-
- \def\startlmtxmode#1\stoplmtxmode{}
- \let\stoplmtxmode \relax
- \let\startmkivmode\relax
- \let\stopmkivmode \relax
-
-\else
-
- \let\startlmtxmode\relax
- \let\stoplmtxmode \relax
- \def\startmkivmode#1\stopmkivmode{}
- \let\stopmkivmode \relax
-
-\fi
+\def\startlmtxmode#1\stoplmtxmode{}
+\let\stoplmtxmode \relax
+\let\startmkivmode\relax
+\let\stopmkivmode \relax
%D As we don't have namespace definers yet, we use a special one:
@@ -86,7 +76,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 +188,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 +286,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 +333,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 +350,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 +376,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 +407,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 +424,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 +445,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 +466,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 +580,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 +660,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 +675,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 +710,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 +719,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 +728,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 +750,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 +760,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 +768,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 +825,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 +843,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 +859,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 +941,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 +1032,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 +1112,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 +1141,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 +1198,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 +1214,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 +1225,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 +1277,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 +1286,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 +1297,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 +1307,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 +1322,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 +1331,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 +1354,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 +1366,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 +1376,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 +1402,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 +1420,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 +1430,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,22 +1445,23 @@
\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
+ %\expandafter\gobbletwoarguments
+ \expandafter\secondoftwoarguments
\else
\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
@@ -1479,7 +1470,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
@@ -1495,12 +1486,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
@@ -1558,7 +1549,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
@@ -1586,7 +1577,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}%
@@ -1602,28 +1593,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
@@ -1632,7 +1623,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
@@ -1640,16 +1631,16 @@
\expandafter\syst_helpers_raw_do_if_in_set_else
\fi}
-\let\rawdoifinsetelse\rawdoifinsetelse
+\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
@@ -1657,7 +1648,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
@@ -1673,7 +1664,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
@@ -1731,6 +1722,14 @@
\def\docopyvalue#1#2#3%
{\expandafter\def\csname#1#3\endcsname{\csname#2#3\endcsname}}
+%D Experiment:
+
+\edef\m_syst_protected{\detokenize{protected}}
+
+\protected\def\aliasmacro#1#2%
+ {\doifinstring{\m_syst_protected}{\meaning#2}\protected
+ \def#1{#2}}
+
%D \macros
%D {doassign,undoassign,doassignempty}
%D
@@ -1763,10 +1762,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
@@ -1836,15 +1835,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
@@ -1896,9 +1895,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,
@@ -1914,18 +1913,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}
@@ -1979,7 +1978,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
@@ -1992,7 +1991,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}
@@ -2025,7 +2024,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}}
@@ -2048,7 +2047,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
@@ -2085,7 +2084,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}}
@@ -2095,7 +2094,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%
@@ -2105,12 +2104,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
@@ -2176,7 +2175,7 @@
%D \def\dosetupsomething[#1][#2]%
%D {... #1 ... #2 ...}
%D
-%D \unexpanded\def\setupsomething
+%D \protected\def\setupsomething
%D {\dodoubleargument\dosetupsomething}
%D \stoptyping
%D
@@ -2204,13 +2203,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,
@@ -2259,16 +2258,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)}
@@ -2316,7 +2315,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
@@ -2357,7 +2356,7 @@
%D Single:
-% \unexpanded\def\dosingleempty#1%
+% \protected\def\dosingleempty#1%
% {\syst_helpers_argument_reset
% \doifelsenextoptional
% {\firstargumenttrue#1}%
@@ -2367,7 +2366,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
@@ -2381,7 +2380,7 @@
%D Double
-% \unexpanded\def\dodoubleempty#1%
+% \protected\def\dodoubleempty#1%
% {\syst_helpers_argument_reset
% \doifelsenextoptional
% {\syst_helpers_double_empty_one_yes#1}%
@@ -2409,7 +2408,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
@@ -2440,7 +2439,7 @@
% Triple
-% \unexpanded\def\dotripleempty#1%
+% \protected\def\dotripleempty#1%
% {\syst_helpers_argument_reset
% \doifelsenextoptional
% {\syst_helpers_triple_empty_one_yes#1}%
@@ -2486,7 +2485,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
@@ -2535,7 +2534,7 @@
%D Quadruple:
-% \unexpanded\def\doquadrupleempty#1%
+% \protected\def\doquadrupleempty#1%
% {\syst_helpers_argument_reset
% \doifelsenextoptional
% {\syst_helpers_quadruple_empty_one_yes#1}%
@@ -2600,7 +2599,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
@@ -2668,7 +2667,7 @@
%D Quintuple:
-% \unexpanded\def\doquintupleempty#1%
+% \protected\def\doquintupleempty#1%
% {\syst_helpers_argument_reset
% \doifelsenextoptional
% {\syst_helpers_quintuple_empty_one_yes#1}%
@@ -2753,7 +2752,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
@@ -2841,7 +2840,7 @@
%D Sixtuple:
-% \unexpanded\def\dosixtupleempty#1%
+% \protected\def\dosixtupleempty#1%
% {\syst_helpers_argument_reset
% \doifelsenextoptional
% {\syst_helpers_sixtuple_empty_one_yes#1}
@@ -2947,7 +2946,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
@@ -3056,7 +3055,7 @@
%D Seventuple:
-% \unexpanded\def\doseventupleempty#1%
+% \protected\def\doseventupleempty#1%
% {\syst_helpers_argument_reset
% \doifelsenextoptional
% {\syst_helpers_seventuple_empty_one_yes#1}%
@@ -3184,7 +3183,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
@@ -3378,13 +3377,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}
@@ -3396,19 +3395,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:
@@ -3446,8 +3445,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
@@ -3456,7 +3455,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}
@@ -3495,13 +3494,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
@@ -3509,7 +3508,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
@@ -3519,7 +3518,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%
@@ -3531,7 +3530,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%
@@ -3599,14 +3598,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,
@@ -3615,15 +3614,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}
@@ -3634,7 +3633,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}
@@ -3661,12 +3660,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
@@ -3692,13 +3691,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
@@ -3719,13 +3718,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
@@ -3759,7 +3758,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
@@ -3771,7 +3770,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 }%
@@ -3781,26 +3780,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}
@@ -3831,7 +3830,7 @@
%
% \glet\stoptexdefinition\relax
%
-% \unexpanded\gdef\starttexdefinition%
+% \protected\gdef\starttexdefinition%
% {\bgroup%
% \obeylines%
% \syst_helpers_start_tex_definition}
@@ -3854,7 +3853,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%
@@ -3888,7 +3887,7 @@
%
% \glet\stoptexdefinition\relax
%
-% \unexpanded\gdef\starttexdefinition%
+% \protected\gdef\starttexdefinition%
% {\bgroup%
% \obeylines%
% \syst_helpers_start_tex_definition_one}
@@ -3907,7 +3906,7 @@
\glet\stoptexdefinition\relax
-\unexpanded\gdef\starttexdefinition%
+\protected\gdef\starttexdefinition%
{\bgroup%
\obeylines%
\syst_helpers_start_tex_definition}
@@ -3922,14 +3921,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,
@@ -3984,7 +3983,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.
@@ -4005,14 +4004,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}
@@ -4031,7 +4030,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}%
@@ -4060,7 +4059,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}
@@ -4113,7 +4112,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
@@ -4135,7 +4134,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
@@ -4143,14 +4142,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
@@ -4160,22 +4159,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)
@@ -4200,7 +4199,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
@@ -4209,13 +4208,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
@@ -4223,7 +4222,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
@@ -4231,7 +4230,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
@@ -4240,11 +4239,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 }
@@ -4257,7 +4256,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}
@@ -4279,30 +4278,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
@@ -4345,13 +4344,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
@@ -4360,7 +4359,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
@@ -4369,7 +4368,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
@@ -4393,7 +4392,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
@@ -4413,7 +4412,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
@@ -4423,6 +4422,8 @@
\ifnum#2<#1x\else d\fi
\else\ifnum#3<\zerocount
\ifnum#1<#2x\else r\fi
+ \else
+ x%
\fi\fi
\expandafter\endcsname\normalexpanded{{\number#1}{\number#2}{\number#3}}}
% \expandafter\endcsname\expandafter{\number#1\expandafter}\expandafter{\number#2\expandafter}\expandafter{\number#3}}
@@ -4463,7 +4464,7 @@
\let\m_syst_helpers_fast_loop_cs\relax
-\unexpanded\def\dofastloopcs#1%
+\protected\def\dofastloopcs#1%
{\fastloopfinal#1\relax
\ifcase\fastloopfinal
\expandafter\gobbleoneargument
@@ -4471,12 +4472,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
@@ -4487,9 +4488,11 @@
% Helper:
-\unexpanded\def\resetrecurselevel{\let\recurselevel\!!zerocount}
+\protected\def\resetrecurselevel{\let\recurselevel\!!zerocount}
-\let\recurselevel\!!zerocount
+\let\recurselevel \!!zerocount
+\let\recurseaction\relax
+\let\recursestring\empty
% \appendtoks \resetrecurselevel \to \everydump
@@ -4516,7 +4519,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
@@ -4548,26 +4551,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}
@@ -4582,19 +4585,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},
@@ -4660,10 +4663,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
@@ -4687,14 +4690,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
@@ -4706,7 +4709,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
@@ -4715,10 +4718,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
@@ -4726,16 +4729,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\
@@ -4759,7 +4762,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
@@ -4779,7 +4782,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}%
@@ -4808,9 +4811,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
@@ -4838,7 +4841,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}}
@@ -4868,14 +4871,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}}
@@ -4891,8 +4894,8 @@
%D
%D We don't explicitly test if the macro is defined.
-\unexpanded\def\assignifempty#1#2% can be sped up
- {\doifsomething{#1}{\def#1{#2}}} % {\doifnot{#1}{}{\def#1{#2}}}
+\protected\def\assignifempty#1#2% can be sped up
+ {\doifnothing{#1}{\def#1{#2}}}
%D \macros
%D {gobbleuntil,grabuntil,gobbleuntilrelax,
@@ -4904,7 +4907,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
@@ -4922,7 +4925,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
@@ -4932,10 +4935,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:
@@ -4962,15 +4965,21 @@
\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
+
+\protected\def\gobblenested#1#2#3%
+ {\normalexpanded{\def\noexpand\next##1\csname#2\endcsname}{\csname#3\endcsname}%
+ \next}%
+
%D The next one simply expands the pickup up tokens.
%D
%D \starttyping
@@ -4979,7 +4988,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
@@ -5051,14 +5060,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}%
@@ -5076,7 +5085,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}%
@@ -5092,7 +5101,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}%
@@ -5104,7 +5113,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
@@ -5123,7 +5132,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
@@ -5142,7 +5151,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=}
@@ -5155,7 +5164,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=}
@@ -5169,7 +5178,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=}
@@ -5181,7 +5190,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
@@ -5191,7 +5200,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=}
@@ -5214,50 +5223,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}
@@ -5286,10 +5295,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
@@ -5344,25 +5353,29 @@
\newtoks\BeforePar
\newtoks\AfterPar
-\def\redowithpar\par
+\protected\def\redowithpar\par
{\doifelsenextchar\par\redowithpar\dodowithpar}%
-\def\dowithpar#1#2%
+\protected\def\dowithpar#1#2%
{\def\dodowithpar##1\par{#1##1#2}%
\redowithpar\par}
-\def\redogotopar\par
+\protected\def\redogotopar\par
{\doifelsenextchar\par\redogotopar\dodogotopar}%
-\def\dogotopar#1%
+\protected\def\dogotopar#1%
{\def\dodogotopar{#1}%
\redogotopar\par}
-\def\dogotoparcs#1%
+\protected\def\dogotoparcs#1%
{\let\dodogotopar#1%
\redogotopar\par}
-\unexpanded\def\GetPar
+\ifdefined \ignorepars \else
+ \protected\def\ignorepars{\dogotoparcs\relax}
+\fi
+
+\protected\def\GetPar
{\expanded
{\dowithpar
{\the\BeforePar
@@ -5371,7 +5384,7 @@
\BeforePar\emptytoks
\AfterPar\emptytoks}}}
-\unexpanded\def\GotoPar
+\protected\def\GotoPar
{\expanded
{\dogotopar
{\the\BeforePar
@@ -5410,7 +5423,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}}
@@ -5438,7 +5451,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}
@@ -5472,7 +5485,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%
@@ -5563,10 +5576,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}}
@@ -5598,13 +5611,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%
@@ -5622,7 +5635,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
@@ -5630,7 +5643,7 @@
\expandafter\gtoksapp
\fi#2{#1}}
-\unexpanded\def\prependtoks#1\to#2%
+\protected\def\prependtoks#1\to#2%
{\ifx\dodoglobal\relax
\expandafter\tokspre
\else
@@ -5654,14 +5667,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
@@ -5670,7 +5683,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}
@@ -5698,14 +5711,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:
@@ -5715,7 +5728,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}%
@@ -5723,22 +5736,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
@@ -5746,7 +5759,7 @@
\expandafter\xtoksapp
\fi#2{#1}}
-\unexpanded\def\prependetoks#1\to#2%
+\protected\def\prependetoks#1\to#2%
{\ifx\dodoglobal\relax
\expandafter\etokspre
\else
@@ -5756,7 +5769,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}
@@ -5783,12 +5796,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@@@\\}
@@ -5798,7 +5811,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}%
@@ -5809,7 +5822,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
@@ -5831,12 +5844,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\\}
@@ -5853,17 +5866,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}
@@ -5876,7 +5889,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}}
@@ -5933,36 +5946,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}}%
@@ -5972,7 +5985,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%
@@ -5983,10 +5996,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
@@ -6008,7 +6021,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
@@ -6071,7 +6084,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
@@ -6095,7 +6108,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,],}
@@ -6142,23 +6155,26 @@
\def\numberofpoints #1{\the\numexpr\dimexpr#1\relax/\maxcard\relax}
%D \macros
-%D {swapdimens,swapcounts,swapmacros,
+%D {swapdimens,swapskips,swapcounts,swapmacros,
%D globalswapdimens,globalswapcounts,globalswapmacros}
%D
%D Simple but effective are the next two macros. There name exactly states their
%D purpose.
\newdimen\d_syst_helpers_swapped
+\newskip \s_syst_helpers_swapped
\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\swapskips #1#2{\s_syst_helpers_swapped #1\relax#1#2\relax#2\s_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\globalswapskips #1#2{\s_syst_helpers_swapped #1\global#1#2\global#2\s_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}
@@ -6177,7 +6193,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
@@ -6185,12 +6201,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
@@ -6198,7 +6214,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 }
@@ -6222,7 +6238,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
@@ -6231,7 +6247,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
@@ -6240,13 +6256,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
@@ -6273,7 +6289,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}
@@ -6309,7 +6325,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
@@ -6318,7 +6334,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
@@ -6327,7 +6343,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
@@ -6336,7 +6352,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
@@ -6344,7 +6360,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
@@ -6352,7 +6368,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
@@ -6360,7 +6376,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
@@ -6368,7 +6384,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
@@ -6376,7 +6392,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
@@ -6384,7 +6400,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
@@ -6439,9 +6455,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
@@ -6464,38 +6480,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,
@@ -6520,7 +6536,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
@@ -6574,7 +6590,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}}%
@@ -6583,7 +6599,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
@@ -6592,7 +6608,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
@@ -6697,7 +6713,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
@@ -6720,7 +6736,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%
@@ -6749,7 +6765,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%
@@ -6772,7 +6788,7 @@
\let\m_syst_helpers_untexed\empty
-\unexpanded\def\untexsomething
+\protected\def\untexsomething
{\begingroup
\catcode\leftbraceasciicode \ignorecatcode
\catcode\rightbraceasciicode\ignorecatcode
@@ -6784,8 +6800,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}
@@ -6801,16 +6817,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
@@ -6819,10 +6835,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}
@@ -6834,7 +6850,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
@@ -6869,7 +6885,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}
@@ -6891,10 +6907,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
@@ -6903,8 +6919,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}
@@ -6949,14 +6965,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
@@ -6968,7 +6984,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%
@@ -7012,7 +7028,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%
@@ -7064,8 +7080,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 !
@@ -7104,15 +7120,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}
@@ -7158,10 +7174,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
@@ -7169,7 +7185,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
@@ -7177,7 +7193,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
@@ -7185,7 +7201,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
@@ -7209,7 +7225,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}
@@ -7258,7 +7274,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}
@@ -7353,22 +7369,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}
@@ -7393,22 +7409,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}
@@ -7538,9 +7554,9 @@
\def\comparedimension#1#2%
{\compresult
- \ifdim#1<#2%
+ \ifdim#1<#2 % space wil be skipped
\zerocount
- \else\ifdim#1<#2%
+ \else\ifdim#1<#2 % space wil be skipped
\plusone
\else
\plustwo
@@ -7552,7 +7568,7 @@
\zerocount
\else\ifdim\dimexpr#2-#1\relax<\roudingeps
\zerocount
- \else\ifdim#1<#2%
+ \else\ifdim#1<#2 % space wil be skipped
\plusone
\else
\plustwo
@@ -7562,19 +7578,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}}
@@ -7589,25 +7605,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
@@ -7620,8 +7636,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}
@@ -7645,7 +7661,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%
@@ -7671,50 +7687,56 @@
% 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}
\let\resettimer \clf_resettimer
\let\elapsedtime \clf_elapsedtime
-\let\elapsedseconds \elapsedtime
+\let\elapsedseconds\elapsedtime
+
+\let\elapsedsteps\!!zerocount
+
+\protected\def\elapsedsteptime % unexpanded ! a bit useless but who knows ...
+ {\clf_elapsedsteptime\elapsedsteps\relax}
\newcount\c_syst_helpers_test_feature_n
\newcount\c_syst_helpers_test_feature_m
\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
{\advance\c_syst_helpers_test_feature_n\plusone
\ifnum\c_syst_helpers_test_feature_n>\c_syst_helpers_test_feature_m\else
@@ -7727,7 +7749,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
@@ -7741,10 +7763,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}%
@@ -7759,7 +7781,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
@@ -7777,17 +7799,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}
@@ -7809,11 +7831,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}
@@ -7832,7 +7854,7 @@
%D
%D \typebuffer \getbuffer
-\unexpanded\def\ignoreimplicitspaces
+\protected\def\ignoreimplicitspaces
{\doifelsenextchar\relax\relax\relax}
%D \macros
@@ -7859,11 +7881,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}
@@ -7878,9 +7900,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
@@ -7914,9 +7936,9 @@
%D \typebuffer \startlines \getbuffer \stoplines
\def\docheckedpair#1%
- {\syst_helpers_checked_pair#1,,\_o_e_p_}
+ {\syst_helpers_checked_pair#1,,\_e_o_p_}
-\def\syst_helpers_checked_pair#1,#2,#3\_o_e_p_
+\def\syst_helpers_checked_pair#1,#2,#3\_e_o_p_
{#1,#2}
%D Here are some nasty helpers. They can be used to fill often expanded token
@@ -8046,7 +8068,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}
%
@@ -8093,8 +8115,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:
%
@@ -8102,30 +8124,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
@@ -8210,7 +8232,7 @@
%
% \showvalue{mylist}
-% \unexpanded\def\showtokenlist#1%
+% \protected\def\showtokenlist#1%
% {\begingroup
% \edef\tempstring{\the#1}%
% \tx\ttbf\string#1: \tttf\meaning\tempstring
@@ -8220,7 +8242,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_