From b4260c7c04f7e82a9987b7bb758040853ebc464e Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 9 Jul 2020 15:15:53 +0200 Subject: 2020-07-09 14:50:00 --- tex/context/base/mkiv/syst-aux.mkiv | 1034 +++++++++++++++++------------------ 1 file changed, 517 insertions(+), 517 deletions(-) (limited to 'tex/context/base/mkiv/syst-aux.mkiv') diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 824590d9e..df74fb44f 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -47,7 +47,7 @@ %D code. %D %D \starttyping -%D \unexpanded\def\somecommand{... ... ...} +%D \protected\def\somecommand{... ... ...} %D \stoptyping %D %D This overloads the \ETEX\ primitive but as we already had an \MKII\ solution we @@ -86,7 +86,7 @@ \fi -\unexpanded\def\installsystemnamespace#1% maybe move this to syst-ini +\protected\def\installsystemnamespace#1% maybe move this to syst-ini {\ifcsname ??#1\endcsname \writestatus\m!system{duplicate system namespace '#1'}\wait \else @@ -198,10 +198,10 @@ \let\m_syst_helpers_expanded\empty -\unexpanded\def\expanded#1% +\protected\def\expanded#1% {\xdef\m_syst_helpers_expanded{\noexpand#1}\m_syst_helpers_expanded} -\unexpanded\def\startexpanded#1\stopexpanded +\protected\def\startexpanded#1\stopexpanded {\xdef\m_syst_helpers_expanded{#1}\m_syst_helpers_expanded} \let\stopexpanded\relax @@ -296,13 +296,13 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsenextchar#1#2#3% #1 should not be {} ! +\protected\def\doifelsenextchar#1#2#3% #1 should not be {} ! {\let\charactertoken=#1% = needed here \def\m_syst_action_yes{#2}% \def\m_syst_action_nop{#3}% \futurelet\nexttoken\syst_helpers_inspect_next_character} -\unexpanded\def\doifelsenextcharcs#1#2#3% #1 should not be {} ! +\protected\def\doifelsenextcharcs#1#2#3% #1 should not be {} ! {\let\charactertoken=#1% = needed here \let\m_syst_action_yes#2% \let\m_syst_action_nop#3% @@ -343,13 +343,13 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsenextoptional#1#2% +\protected\def\doifelsenextoptional#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% \let\if_next_blank_space_token\iffalse \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} -\unexpanded\def\doifelsenextoptionalcs#1#2% \cs \cs (upto 10% faster) +\protected\def\doifelsenextoptionalcs#1#2% \cs \cs (upto 10% faster) {\let\m_syst_action_yes#1% \let\m_syst_action_nop#2% \let\if_next_blank_space_token\iffalse @@ -360,14 +360,14 @@ % fails on assignments % -% \unexpanded\def\doifelsenextoptional {\afterassignment\doifelsenextoptional_n \def\m_syst_action_yes} -% \def\doifelsenextoptional_n {\afterassignment\doifelsenextoptional_n_n\def\m_syst_action_nop} -% \def\doifelsenextoptional_n_n {\let\if_next_blank_space_token\iffalse +% \protected\def\doifelsenextoptional {\afterassignment\doifelsenextoptional_n \def\m_syst_action_yes} +% \def\doifelsenextoptional_n {\afterassignment\doifelsenextoptional_n_n\def\m_syst_action_nop} +% \def\doifelsenextoptional_n_n {\let\if_next_blank_space_token\iffalse % \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} % -% \unexpanded\def\doifelsenextoptionalcs {\afterassignment\doifelsenextoptionalcs_n \let\m_syst_action_yes} -% \def\doifelsenextoptionalcs_n {\afterassignment\doifelsenextoptionalcs_n_n\let\m_syst_action_nop} -% \def\doifelsenextoptionalcs_n_n{\let\if_next_blank_space_token\iffalse +% \protected\def\doifelsenextoptionalcs {\afterassignment\doifelsenextoptionalcs_n \let\m_syst_action_yes} +% \def\doifelsenextoptionalcs_n {\afterassignment\doifelsenextoptionalcs_n_n\let\m_syst_action_nop} +% \def\doifelsenextoptionalcs_n_n{\let\if_next_blank_space_token\iffalse % \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} \let\syst_helpers_next_bgroup_character_token\bgroup @@ -386,13 +386,13 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsenextbgroup#1#2% +\protected\def\doifelsenextbgroup#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% \let\if_next_blank_space_token\iffalse \futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character} -\unexpanded\def\doifelsenextbgroupcs#1#2% +\protected\def\doifelsenextbgroupcs#1#2% {\let\m_syst_action_yes#1% \let\m_syst_action_nop#2% \let\if_next_blank_space_token\iffalse @@ -417,7 +417,7 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsenextparenthesis#1#2% +\protected\def\doifelsenextparenthesis#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% \let\if_next_blank_space_token\iffalse @@ -434,12 +434,12 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\doifelsefastoptionalcheck#1#2% +\protected\def\doifelsefastoptionalcheck#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else} -\unexpanded\def\doifelsefastoptionalcheckcs#1#2% \cs \cs +\protected\def\doifelsefastoptionalcheckcs#1#2% \cs \cs {\let\m_syst_action_yes#1% \let\m_syst_action_nop#2% \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else} @@ -455,7 +455,7 @@ %D {a few lines later} %D \stoptyping -% \unexpanded\def\assumelongusagecs#1% +% \protected\def\assumelongusagecs#1% % {\let\m_syst_action#1% % \futurelet\nexttoken\syst_helpers_ignore_par_character} % @@ -476,7 +476,7 @@ % \def\syst_helpers_ignore_par_partoken % {\afterassignment\m_syst_action\let\nexttoken} -\unexpanded\def\assumelongusagecs#1% +\protected\def\assumelongusagecs#1% {\let\m_syst_action#1% \futurelet\nexttoken\syst_helpers_ignore_spacing} @@ -590,12 +590,12 @@ \def\undefinevalue#1{\expandafter\let \csname#1\endcsname\undefined} \def\ignorevalue#1#2{\expandafter\let \csname#1\endcsname\empty} -\def\setuvalue #1{\normalprotected\expandafter \def\csname#1\endcsname} -\def\setuevalue #1{\normalprotected\expandafter\edef\csname#1\endcsname} -\def\setugvalue #1{\normalprotected\expandafter\gdef\csname#1\endcsname} -\def\setuxvalue #1{\normalprotected\expandafter\xdef\csname#1\endcsname} +\def\setuvalue #1{\protected\expandafter \def\csname#1\endcsname} +\def\setuevalue #1{\protected\expandafter\edef\csname#1\endcsname} +\def\setugvalue #1{\protected\expandafter\gdef\csname#1\endcsname} +\def\setuxvalue #1{\protected\expandafter\xdef\csname#1\endcsname} -\unexpanded\def\getuvalue#1{\csname#1\endcsname} +\protected\def\getuvalue#1{\csname#1\endcsname} %D \macros %D {globallet,glet} @@ -670,13 +670,13 @@ %D {\undefined}! In \ETEX\ we have \type {\ifcsname} and that way of testing on %D existance is not the same as the one described here. Therefore we introduce: -\unexpanded\def\letbeundefined#1% potential stack buildup when used \global +\protected\def\letbeundefined#1% potential stack buildup when used \global {\expandafter\let\csname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue -\unexpanded\def\localundefine#1% conditional +\protected\def\localundefine#1% conditional {\ifcsname#1\endcsname\expandafter\let\csname#1\endcsname\undefined\fi} -\unexpanded\def\globalundefine#1% conditional +\protected\def\globalundefine#1% conditional {\ifcsname#1\endcsname\expandafter\glet\csname#1\endcsname\undefined\fi} %D Beware, being \type {\undefined} in \ETEX\ means that the macro {\em is} defined! @@ -685,7 +685,7 @@ %D behavior in text and math mode, which was due to this grouping subtilities. We %D therefore decided to use \type{\begingroup} instead of \type{\bgroup}. -\unexpanded\def\doifelsealldefined#1% +\protected\def\doifelsealldefined#1% {\begingroup \donetrue % we could use a reserved one and avoid the group \processcommalist[#1]\syst_helpers_do_if_all_defined_else @@ -720,7 +720,7 @@ %D \doifelse {string1} {string2} {then ...}{else ...} %D \stoptyping -\unexpanded\def\doif#1#2% +\protected\def\doif#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -729,7 +729,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnot#1#2% +\protected\def\doifnot#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -738,7 +738,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelse#1#2% +\protected\def\doifelse#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -760,7 +760,7 @@ %D %D This time, the string is not expanded. -\unexpanded\def\doifelseempty#1% +\protected\def\doifelseempty#1% {\def\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments @@ -770,7 +770,7 @@ \let\doifemptyelse\doifelseempty -\unexpanded\def\doifempty#1% +\protected\def\doifempty#1% {\def\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\firstofoneargument @@ -778,7 +778,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotempty#1% +\protected\def\doifnotempty#1% {\def\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument @@ -835,7 +835,7 @@ % \def\syst_helpers_re_do_if_in_set {\expandafter\syst_helpers_do_check_if_item_in_set \m_syst_string_two,],\relax} % \def\syst_helpers_re_do_if_not_in_set {\expandafter\syst_helpers_do_check_if_item_not_in_set \m_syst_string_two,],\relax} % -% \unexpanded\def\doifelseinset#1% make this two step too +% \protected\def\doifelseinset#1% make this two step too % {\edef\m_syst_string_one{#1}% % \ifx\m_syst_string_one\empty % \expandafter\thirdofthreearguments @@ -853,7 +853,7 @@ % \expandafter\syst_helpers_re_do_if_in_set_else % \fi} % -% \unexpanded\def\doifinset#1% +% \protected\def\doifinset#1% % {\edef\m_syst_string_one{#1}% % \ifx\m_syst_string_one\empty % \expandafter\gobbletwoarguments @@ -869,7 +869,7 @@ % \expandafter\syst_helpers_re_do_if_in_set % \fi} % -% \unexpanded\def\doifnotinset#1% +% \protected\def\doifnotinset#1% % {\edef\m_syst_string_one{#1}% % \ifx\m_syst_string_one\empty % \expandafter\secondoftwoarguments @@ -951,9 +951,9 @@ % \expandafter\syst_helpers_do_check_if_item_not_in_set % \fi} -\unexpanded\def\doifelseinset#1#2{\clf_doifelseinset{#1}{#2}} -\unexpanded\def\doifinset #1#2{\clf_doifinset {#1}{#2}} -\unexpanded\def\doifnotinset #1#2{\clf_doifnotinset {#1}{#2}} +\protected\def\doifelseinset#1#2{\clf_doifelseinset{#1}{#2}} +\protected\def\doifinset #1#2{\clf_doifinset {#1}{#2}} +\protected\def\doifnotinset #1#2{\clf_doifnotinset {#1}{#2}} % \let\firstinset \clf_firstinset \let\doifinsetelse\doifelseinset @@ -1042,15 +1042,15 @@ % \fi\fi % #1#2} -% \unexpanded\def\doifelsecommon{\syst_helpers_do_do_if_common_else\firstoftwoarguments\secondoftwoarguments} -% \unexpanded\def\doifcommon {\syst_helpers_do_do_if_common_else\firstofoneargument \gobbleoneargument } -% \unexpanded\def\doifnotcommon {\syst_helpers_do_do_if_common_else\gobbleoneargument \firstofoneargument } +% \protected\def\doifelsecommon{\syst_helpers_do_do_if_common_else\firstoftwoarguments\secondoftwoarguments} +% \protected\def\doifcommon {\syst_helpers_do_do_if_common_else\firstofoneargument \gobbleoneargument } +% \protected\def\doifnotcommon {\syst_helpers_do_do_if_common_else\gobbleoneargument \firstofoneargument } % % \let\doifcommonelse\doifelsecommon -\unexpanded\def\doifelsecommon#1#2{\clf_doifelsecommon{#1}{#2}} -\unexpanded\def\doifcommon #1#2{\clf_doifcommon {#1}{#2}} -\unexpanded\def\doifnotcommon #1#2{\clf_doifnotcommon {#1}{#2}} +\protected\def\doifelsecommon#1#2{\clf_doifelsecommon{#1}{#2}} +\protected\def\doifcommon #1#2{\clf_doifcommon {#1}{#2}} +\protected\def\doifnotcommon #1#2{\clf_doifnotcommon {#1}{#2}} \let\doifcommonelse\doifelsecommon @@ -1122,7 +1122,7 @@ %D Empty arguments are not processed. Empty items (\type {,,}) however are %D treated. We have to check for the special case \type {[{a,b,c}]}. -\unexpanded\def\processcommalist[% +\protected\def\processcommalist[% {\futurelet\nexttoken\syst_helpers_do_check_comma_item} \def\syst_helpers_do_check_comma_item @@ -1151,13 +1151,13 @@ %D One way of quitting a commalist halfway is: -\unexpanded\def\quitcommalist +\protected\def\quitcommalist {\begingroup\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_comma_list} \def\syst_helpers_do_quit_comma_list#1]% {\endgroup} -\unexpanded\def\quitprevcommalist +\protected\def\quitprevcommalist {\begingroup\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_prev_comma_list} \def\syst_helpers_do_quit_prev_comma_list#1]% @@ -1208,7 +1208,7 @@ %D Commands that are part of the list are expanded, so the use of this macro has its %D limits. -\unexpanded\def\processcommacommand[#1]% +\protected\def\processcommacommand[#1]% {\normalexpanded{\processcommalist[#1]}} %D The argument to \type{\command} is not delimited. Because we often use \type {[]} @@ -1224,7 +1224,7 @@ %D \def\command[#1]{... #1 ...} %D \stoptyping -\unexpanded\def\processcommalistwithparameters[#1]#2% +\protected\def\processcommalistwithparameters[#1]#2% {\def\syst_helpers_do_process_comma_list_with_parameters##1{#2[##1]}% \processcommalist[#1]\syst_helpers_do_process_comma_list_with_parameters} @@ -1235,11 +1235,11 @@ \let\syst_helpers_comma_list_step\relax -\unexpanded\def\startprocesscommalist[#1]#2\stopprocesscommalist +\protected\def\startprocesscommalist[#1]#2\stopprocesscommalist {\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}% \processcommalist[#1]\syst_helpers_comma_list_step} -\unexpanded\def\startprocesscommacommand[#1]#2\stopprocesscommacommand +\protected\def\startprocesscommacommand[#1]#2\stopprocesscommacommand {\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}% \normalexpanded{\processcommalist[#1]}\syst_helpers_comma_list_step} @@ -1287,7 +1287,7 @@ % obsolete: \def\expandactions{\let\expandedaction\edef} \expandactions (see mkii) -\unexpanded\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% {\edef\m_syst_string_two{#1}% \ifx\m_syst_string_two\s!default \let\commalistelement\empty @@ -1296,7 +1296,7 @@ % met \quitcommalist tot meer dan 25\% sneller -\unexpanded\def\syst_helpers_do_compare_process_action_b[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_b[#1=>#2][#3]% {\edef\m_syst_string_two{#1}% \ifx\m_syst_string_one\m_syst_string_two \def\commalistelement{#3}% @@ -1307,7 +1307,7 @@ #2% \fi\fi} -\unexpanded\def\processaction[#1]#2[% +\protected\def\processaction[#1]#2[% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \let\syst_helpers_do_compare_process_action\syst_helpers_do_compare_process_action_a @@ -1317,7 +1317,7 @@ \edef\syst_helpers_do_process_action##1{\syst_helpers_do_compare_process_action[##1][#1]}% expands #1 \processnextcommalist\relax\relax\syst_helpers_do_process_action[} -\unexpanded\def\syst_helpers_do_compare_process_action_c[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_c[#1=>#2][#3]% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#3}% \ifx\m_syst_string_one\m_syst_string_two @@ -1332,7 +1332,7 @@ \fi \fi} -\unexpanded\def\processfirstactioninset[#1]% +\protected\def\processfirstactioninset[#1]% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\processaction @@ -1341,13 +1341,13 @@ \fi [#1]} -\unexpanded\def\syst_helpers_process_first_action_in_set_indeed[#1]#2[#3]% +\protected\def\syst_helpers_process_first_action_in_set_indeed[#1]#2[#3]% {\def\syst_helpers_do_process_action##1% {\def\syst_helpers_do_do_process_action####1{\syst_helpers_do_compare_process_action_c[####1][##1]}% \processcommalist[#3]\syst_helpers_do_do_process_action}% \normalexpanded{\processcommalist[#1]}\syst_helpers_do_process_action} -\unexpanded\def\syst_helpers_do_compare_process_action_d[#1=>#2][#3]% +\protected\def\syst_helpers_do_compare_process_action_d[#1=>#2][#3]% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#3}% \ifx\m_syst_string_one\m_syst_string_two @@ -1364,10 +1364,10 @@ \installsystemnamespace{nextactionlevel} -\unexpanded\def\syst_helpers_do_process_all_actions_in_set +\protected\def\syst_helpers_do_process_all_actions_in_set {\csname\??nextactionlevel\the\processlevel\endcsname} -\unexpanded\def\processallactionsinset[#1]% +\protected\def\processallactionsinset[#1]% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\processaction @@ -1376,7 +1376,7 @@ \fi [#1]} -\unexpanded\def\syst_helpers_process_all_actions_in_set_indeed[#1]#2[#3]% +\protected\def\syst_helpers_process_all_actions_in_set_indeed[#1]#2[#3]% {\advance\processlevel \plusone \expandafter\def\csname\??nextactionlevel\the\processlevel\endcsname##1% {\def\syst_helpers_do_do_process_action####1{\syst_helpers_do_compare_process_action_d[####1][##1]}% @@ -1386,7 +1386,7 @@ %D These macros use: -\unexpanded\def\processnextcommalist#1#2#3[#4#5]% +\protected\def\processnextcommalist#1#2#3[#4#5]% {#1% \let\nexttoken#4% \global\advance\commalevel \plusone @@ -1412,10 +1412,10 @@ \let\firstcharacter \empty \let\remainingcharacters\empty -\unexpanded\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}} -\unexpanded\def\doifelsefirstchar #1#2{\clf_doifelsefirstchar{#1}{#2}} -\unexpanded\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}} -\unexpanded\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}} +\protected\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}} +\protected\def\doifelsefirstchar #1#2{\clf_doifelsefirstchar{#1}{#2}} +\protected\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}} +\protected\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}} \let\doiffirstcharelse\doifelsefirstchar @@ -1430,7 +1430,7 @@ \let\m_syst_sub_string\empty -\unexpanded\def\doifelseinstring#1% +\protected\def\doifelseinstring#1% {\edef\m_syst_sub_string{#1}% expand #1 here \ifx\m_syst_sub_string\empty \expandafter\thirdofthreearguments @@ -1440,14 +1440,14 @@ \let\doifinstringelse\doifelseinstring -\unexpanded\def\syst_helpers_do_if_in_string_else_indeed#1% +\protected\def\syst_helpers_do_if_in_string_else_indeed#1% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifinstring#1%% +\protected\def\doifinstring#1%% {\edef\m_syst_sub_string{#1}% expand #1 here \ifx\m_syst_sub_string\empty \expandafter\gobbletwoarguments @@ -1455,14 +1455,14 @@ \expandafter\syst_helpers_do_if_in_string_indeed \fi} -\unexpanded\def\syst_helpers_do_if_in_string_indeed#1% +\protected\def\syst_helpers_do_if_in_string_indeed#1% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotinstring#1%% +\protected\def\doifnotinstring#1%% {\edef\m_syst_sub_string{#1}% expand #1 here \ifx\m_syst_sub_string\empty %\expandafter\gobbletwoarguments @@ -1471,7 +1471,7 @@ \expandafter\syst_helpers_do_if_not_in_string_indeed \fi} -\unexpanded\def\syst_helpers_do_if_not_in_string_indeed#1% +\protected\def\syst_helpers_do_if_not_in_string_indeed#1% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\gobbleoneargument \else @@ -1480,7 +1480,7 @@ % replaces prev -\unexpanded\def\syst_helpers_do_if_in_string_else#1#2% ##2 can be {abc} +\protected\def\syst_helpers_do_if_in_string_else#1#2% ##2 can be {abc} {\expandafter\def\expandafter\syst_helpers_do_do_if_in_string_else \expandafter##\expandafter1#1##2##3^^^^0004{\unless\if##2@}% expand #1 here \expandafter\syst_helpers_do_do_if_in_string_else\normalexpanded{#2#1}@@^^^^0004} % expand #2 here @@ -1496,12 +1496,12 @@ %D Where \type {\doifinstringelse} does as much expansion as possible, the latter %D alternative does minimal (one level) expansion. -\unexpanded\def\syst_helpers_do_if_in_csname_else#1#2% +\protected\def\syst_helpers_do_if_in_csname_else#1#2% {\def\syst_helpers_do_do_if_in_csname_else##1#1##2##3^^^^0004% {\unless\if##2@}% \expandafter\syst_helpers_do_do_if_in_csname_else#2#1@@^^^^0004} -\unexpanded\def\doifelseincsname#1#2% +\protected\def\doifelseincsname#1#2% {\normalexpanded{\syst_helpers_do_if_in_csname_else{#1}}{#2}% \expandafter\firstoftwoarguments \else @@ -1559,7 +1559,7 @@ \def\percentdimen#1#2% dimen percentage (with %) {\dimexpr\clf_percentageof{#2}\dimexpr#1\relax} -\unexpanded\def\setpercentdimen#1#2% dimen percentage (with %) +\protected\def\setpercentdimen#1#2% dimen percentage (with %) {#1=\clf_percentageof{#2}\dimexpr#1\relax} %D \macros @@ -1587,7 +1587,7 @@ %D The gain in speed depends on the length of the argument (the longer the argument, %D the less we gain). -\unexpanded\def\makerawcommalist[#1]#2% use \processnext ... here +\protected\def\makerawcommalist[#1]#2% use \processnext ... here {\def\syst_helpers_do_make_raw_comma_list##1% we don't expand ##1 {\ifx#2\empty \def#2{##1}% @@ -1603,28 +1603,28 @@ \expandafter\syst_helpers_raw_process_comma_item \fi#2} -\unexpanded\def\rawprocesscommalist[#1]#2% accepteert ook [\cs] +\protected\def\rawprocesscommalist[#1]#2% accepteert ook [\cs] {\global\advance\commalevel \plusone \expandafter\let\csname\??nextcommalevel\the\commalevel\endcsname#2% \expandafter\syst_helpers_raw_process_comma_item#1,],% \relax \global\advance\commalevel \minusone } -\unexpanded\def\rawprocesscommacommand[#1]% not really needed +\protected\def\rawprocesscommacommand[#1]% not really needed {\normalexpanded{\rawprocesscommalist[#1]}} %D Here is one without nesting: -\unexpanded\def\syst_helpers_fast_process_comma_item#1,#2% #2 eats up preceding space +\protected\def\syst_helpers_fast_process_comma_item#1,#2% #2 eats up preceding space {\if]#1\else \syst_helpers_fast_process_comma_command{#1}% \expandafter\syst_helpers_fast_process_comma_item \fi#2} -\unexpanded\def\fastprocesscommalist[#1]#2% accepteert ook [\cs] +\protected\def\fastprocesscommalist[#1]#2% accepteert ook [\cs] {\let\syst_helpers_fast_process_comma_command#2% \expandafter\syst_helpers_fast_process_comma_item#1,],}% \relax -\unexpanded\def\fastprocesscommacommand[#1]#2% accepteert ook [\cs] +\protected\def\fastprocesscommacommand[#1]#2% accepteert ook [\cs] {\let\syst_helpers_fast_process_comma_command#2% \normalexpanded{\syst_helpers_fast_process_comma_item#1},],}% \relax @@ -1633,7 +1633,7 @@ \def\m_syst_two_commas{,,} -\unexpanded\def\rawdoifelseinset#1% +\protected\def\rawdoifelseinset#1% {\edef\m_syst_sub_string{,#1,}% expand #1 here \ifx\m_syst_sub_string\m_syst_two_commas \expandafter\thirdofthreearguments @@ -1643,14 +1643,14 @@ \let\rawdoifinsetelse\rawdoifelseinset -\unexpanded\def\syst_helpers_raw_do_if_in_set_else#1% +\protected\def\syst_helpers_raw_do_if_in_set_else#1% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{,#1,}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\rawdoifinset#1% +\protected\def\rawdoifinset#1% {\edef\m_syst_sub_string{,#1,}% expand #1 here \ifx\m_syst_sub_string\m_syst_two_commas \expandafter\gobbletwoarguments @@ -1658,7 +1658,7 @@ \expandafter\syst_helpers_raw_do_if_in_set \fi} -\unexpanded\def\syst_helpers_raw_do_if_in_set#1%% +\protected\def\syst_helpers_raw_do_if_in_set#1%% {\syst_helpers_do_if_in_string_else\m_syst_sub_string{,#1,}% \expandafter\firstofoneargument \else @@ -1674,7 +1674,7 @@ \fi}% \syst_helpers_do_do_raw_process_action,#2,#1=>,@^^^^0004} -\unexpanded\def\rawprocessaction[#1]#2[#3]% +\protected\def\rawprocessaction[#1]#2[#3]% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{undefined}% better \!!undefined \let\m_syst_helpers_process_action\m_syst_string_two @@ -1764,10 +1764,10 @@ %D will redefine this macro later on, when a more advanced message mechanism is %D implemented. -\unexpanded\def\showassignerror#1#2% +\protected\def\showassignerror#1#2% {\writestatus{setup}{missing or ungrouped '=' after '#1' in line #2}} -\unexpanded\def\doassignempty[#1][#2=#3]% +\protected\def\doassignempty[#1][#2=#3]% {\ifcsname#1#2\endcsname\else\dosetvalue{#1}{#2}{#3}\fi} %D \macros @@ -1837,15 +1837,15 @@ \let\currentvalue\empty -\unexpanded\def\getparameters {\dogetparameters\dosetvalue} -\unexpanded\def\geteparameters {\dogetparameters\dosetevalue} -\unexpanded\def\getgparameters {\dogetparameters\dosetgvalue} -\unexpanded\def\getxparameters {\dogetparameters\dosetxvalue} -\unexpanded\def\forgetparameters{\dogetparameters\doignorevalue} +\protected\def\getparameters {\dogetparameters\dosetvalue} +\protected\def\geteparameters {\dogetparameters\dosetevalue} +\protected\def\getgparameters {\dogetparameters\dosetgvalue} +\protected\def\getxparameters {\dogetparameters\dosetxvalue} +\protected\def\forgetparameters{\dogetparameters\doignorevalue} \let\getexpandedparameters\geteparameters -\unexpanded\def\dogetparameters#1[#2]#3[#4% +\protected\def\dogetparameters#1[#2]#3[#4% {\if\noexpand#4]% \expandafter\gobbleoneargument \else @@ -1897,9 +1897,9 @@ \let\syst_helpers_get_parameters_assign_indeed\syst_helpers_get_parameters_assign_normal -\unexpanded\def\doassign [#1][#2]{\let\setsomevalue\dosetvalue \syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} -\unexpanded\def\doeassign [#1][#2]{\let\setsomevalue\dosetevalue \syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} -\unexpanded\def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} +\protected\def\doassign [#1][#2]{\let\setsomevalue\dosetvalue \syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} +\protected\def\doeassign [#1][#2]{\let\setsomevalue\dosetevalue \syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} +\protected\def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\syst_helpers_get_parameters_assign_indeed#1^^^^0004#2==\empty^^^^0004} %D \macros %D {processassignmentlist,processassignmentcommand, @@ -1915,18 +1915,18 @@ %D We can optimize this one if needed but it's not a core macro so hardly worth the %D trouble and tokens. -\unexpanded\def\processassignmentlist[#1]#2% #2 == \command{key}{value] +\protected\def\processassignmentlist[#1]#2% #2 == \command{key}{value] {\def\syst_helpers_process_assignment_entry##1{#2}% {##2}{##3} % namespace is ignored \dogetparameters\syst_helpers_process_assignment_entry[][#1]} -\unexpanded\def\processassignmentcommand[#1]% +\protected\def\processassignmentcommand[#1]% {\normalexpanded{\processassignmentlist[#1]}} -\unexpanded\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist +\protected\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% \processassignmentlist[#1]\currentassignmentlistcommand} -\unexpanded\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand +\protected\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% \normalexpanded{\processassignmentlist[#1]}\currentassignmentlistcommand} @@ -1980,7 +1980,7 @@ \let\syst_helpers_get_parameters\syst_helpers_get_parameters_normal % ** -\unexpanded\def\expandparameters +\protected\def\expandparameters {\let\syst_helpers_get_parameters\syst_helpers_get_parameters_expanded} %D \macros @@ -1993,7 +1993,7 @@ %D \getemptyparameters [label] [...=...,...=...] %D \stoptyping -\unexpanded\def\getemptyparameters[#1]#2[#3]% +\protected\def\getemptyparameters[#1]#2[#3]% {\def\syst_helpers_get_empty_parameters##1{\doassignempty[#1][##1]}% \processcommalist[#3]\syst_helpers_get_empty_parameters} @@ -2026,7 +2026,7 @@ %D By using \type {\docopyvalue} we've prepared this command for use in a %D multi||lingual environment. -\unexpanded\def\copyparameters[#1]#2[#3]#4[#5]% +\protected\def\copyparameters[#1]#2[#3]#4[#5]% {\doifnot{#1}{#3} {\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#3}}% ##1 \processcommalist[#5]\syst_helpers_copy_parameter}} @@ -2049,7 +2049,7 @@ \def\syst_helpers_check_parameters#1=#2#3^^^^0004% {\if#2^^^^0003\parametersfalse\else\parameterstrue\fi} -\unexpanded\def\checkparameters[#1]% +\protected\def\checkparameters[#1]% {\syst_helpers_check_parameters#1=^^^^0003^^^^0003^^^^0004} %D \macros @@ -2086,7 +2086,7 @@ \def\syst_helpers_get_comma_list_size#1% {\advance\commalistcounter\plusone} -\unexpanded\def\getcommalistsize#1]% don't loose [{#1}] +\protected\def\getcommalistsize#1]% don't loose [{#1}] {\commalistcounter\zerocount \processcommalist#1]\syst_helpers_get_comma_list_size % was [{#1}] \edef\commalistsize{\the\commalistcounter}} @@ -2096,7 +2096,7 @@ % \scratchtoks\expandafter{\expandafter[\commacommand]}% % \expandafter\getcommalistsize\the\scratchtoks } -\unexpanded\def\getcommacommandsize[#1]% +\protected\def\getcommacommandsize[#1]% {\normalexpanded{\getcommalistsize[#1]}} \def\syst_helpers_get_from_comma_list#1% @@ -2106,12 +2106,12 @@ \expandafter\quitcommalist \fi} -\unexpanded\def\getfromcommalist[#1]#2[#3]% +\protected\def\getfromcommalist[#1]#2[#3]% {\let\commalistelement\empty \commalistcounter#3\relax \processcommalist[#1]\syst_helpers_get_from_comma_list} -\unexpanded\def\getfromcommacommand[#1]% +\protected\def\getfromcommacommand[#1]% {\normalexpanded{\getfromcommalist[#1]}} %D Watertight (and efficient) solutions are hard to find, due to the handling of @@ -2177,7 +2177,7 @@ %D \def\dosetupsomething[#1][#2]% %D {... #1 ... #2 ...} %D -%D \unexpanded\def\setupsomething +%D \protected\def\setupsomething %D {\dodoubleargument\dosetupsomething} %D \stoptyping %D @@ -2205,13 +2205,13 @@ % no longer a message: % -% \unexpanded\def\dosingleargument {\let\expectedarguments\plusone \dosingleempty } -% \unexpanded\def\dodoubleargument {\let\expectedarguments\plustwo \dodoubleempty } -% \unexpanded\def\dotripleargument {\let\expectedarguments\plusthree \dotripleempty } -% \unexpanded\def\doquadrupleargument {\let\expectedarguments\plusfour \doquadrupleempty } -% \unexpanded\def\doquintupleargument {\let\expectedarguments\plusfive \doquintupleempty } -% \unexpanded\def\dosixtupleargument {\let\expectedarguments\plussix \dosixtupleempty } -% \unexpanded\def\doseventupleargument{\let\expectedarguments\plusseven \doseventupleempty} +% \protected\def\dosingleargument {\let\expectedarguments\plusone \dosingleempty } +% \protected\def\dodoubleargument {\let\expectedarguments\plustwo \dodoubleempty } +% \protected\def\dotripleargument {\let\expectedarguments\plusthree \dotripleempty } +% \protected\def\doquadrupleargument {\let\expectedarguments\plusfour \doquadrupleempty } +% \protected\def\doquintupleargument {\let\expectedarguments\plusfive \doquintupleempty } +% \protected\def\dosixtupleargument {\let\expectedarguments\plussix \dosixtupleempty } +% \protected\def\doseventupleargument{\let\expectedarguments\plusseven \doseventupleempty} %D \macros %D {iffirstagument,ifsecondargument,ifthirdargument, @@ -2260,16 +2260,16 @@ % \setnewconstant\noexpectedarguments\zerocount % \setnewconstant\expectedarguments \zerocount % -% \unexpanded\def\showargumenterror#1#2% +% \protected\def\showargumenterror#1#2% % {\writestatus{system}{\number#1 argument(s) expected in line #2}} % -% \unexpanded\def\syst_helpers_argument_error +% \protected\def\syst_helpers_argument_error % {\ifnum\expectedarguments>\noexpectedarguments % \showargumenterror{\number\expectedarguments}{\number\inputlineno}% % \fi % \syst_helpers_argument_reset} % -% \unexpanded\def\syst_helpers_argument_reset +% \protected\def\syst_helpers_argument_reset % {\let\expectedarguments\noexpectedarguments} % \def\test[#1]{(#1)} @@ -2317,7 +2317,7 @@ % % with % -% \unexpanded\def\dodoubleempty#1% +% \protected\def\dodoubleempty#1% % {\syst_helpers_argument_reset % \let\m_syst_aux_do#1% alias % \let\m_syst_action_yes\syst_helpers_double_empty_one_yes @@ -2358,7 +2358,7 @@ %D Single: -% \unexpanded\def\dosingleempty#1% +% \protected\def\dosingleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\firstargumenttrue#1}% @@ -2368,7 +2368,7 @@ % {\firstargumentfalse % #1[]} -\unexpanded\def\dosingleempty#1% +\protected\def\dosingleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_single_empty_one_yes @@ -2382,7 +2382,7 @@ %D Double -% \unexpanded\def\dodoubleempty#1% +% \protected\def\dodoubleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_double_empty_one_yes#1}% @@ -2410,7 +2410,7 @@ % \def\syst_helpers_double_empty_one_spaced#1#2{#1[{#2}][] } % \def\syst_helpers_double_empty_one_normal#1#2{#1[{#2}][]} -\unexpanded\def\dodoubleempty#1% +\protected\def\dodoubleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_double_empty_one_yes @@ -2441,7 +2441,7 @@ % Triple -% \unexpanded\def\dotripleempty#1% +% \protected\def\dotripleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_triple_empty_one_yes#1}% @@ -2487,7 +2487,7 @@ % \def\syst_helpers_triple_empty_three_spaced#1#2#3{#1[{#2}][{#3}][] } % \def\syst_helpers_triple_empty_three_normal#1#2#3{#1[{#2}][{#3}][]} -\unexpanded\def\dotripleempty#1% +\protected\def\dotripleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_triple_empty_one_yes @@ -2536,7 +2536,7 @@ %D Quadruple: -% \unexpanded\def\doquadrupleempty#1% +% \protected\def\doquadrupleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_quadruple_empty_one_yes#1}% @@ -2601,7 +2601,7 @@ % \def\syst_helpers_quadruple_empty_four_spaced #1#2#3#4{#1[{#2}][{#3}][{#4}][] } % \def\syst_helpers_quadruple_empty_four_normal #1#2#3#4{#1[{#2}][{#3}][{#4}][]} -\unexpanded\def\doquadrupleempty#1% +\protected\def\doquadrupleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_quadruple_empty_one_yes @@ -2669,7 +2669,7 @@ %D Quintuple: -% \unexpanded\def\doquintupleempty#1% +% \protected\def\doquintupleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_quintuple_empty_one_yes#1}% @@ -2754,7 +2754,7 @@ % \def\syst_helpers_quintuple_empty_five_spaced #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][] } % \def\syst_helpers_quintuple_empty_five_normal #1#2#3#4#5{#1[{#2}][{#3}][{#4}][{#5}][]} -\unexpanded\def\doquintupleempty#1% +\protected\def\doquintupleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_quintuple_empty_one_yes @@ -2842,7 +2842,7 @@ %D Sixtuple: -% \unexpanded\def\dosixtupleempty#1% +% \protected\def\dosixtupleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_sixtuple_empty_one_yes#1} @@ -2948,7 +2948,7 @@ % \def\syst_helpers_sixtuple_empty_six_spaced #1#2#3#4#5#6{#1[{#2}][{#3}][{#4}][{#5}][{#6}][] } % \def\syst_helpers_sixtuple_empty_six_normal #1#2#3#4#5#6{#1[{#2}][{#3}][{#4}][{#5}][{#6}][]} -\unexpanded\def\dosixtupleempty#1% +\protected\def\dosixtupleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_sixtuple_empty_one_yes @@ -3057,7 +3057,7 @@ %D Seventuple: -% \unexpanded\def\doseventupleempty#1% +% \protected\def\doseventupleempty#1% % {\syst_helpers_argument_reset % \doifelsenextoptional % {\syst_helpers_seventuple_empty_one_yes#1}% @@ -3185,7 +3185,7 @@ % \def\syst_helpers_seventuple_empty_seven_spaced#1#2#3#4#5#6#7{#1[{#2}][{#3}][{#4}][{#5}][{#6}][{#7}][] } % \def\syst_helpers_seventuple_empty_seven_normal#1#2#3#4#5#6#7{#1[{#2}][{#3}][{#4}][{#5}][{#6}][{#7}][]} -\unexpanded\def\doseventupleempty#1% +\protected\def\doseventupleempty#1% {%syst_helpers_argument_reset \t_syst_aux{#1}% \let\m_syst_action_yes\syst_helpers_seventuple_empty_one_yes @@ -3379,13 +3379,13 @@ %D Many \CONTEXT\ commands started as complex or simple ones, but changed into more %D versatile (more object oriented) ones using the \type {\get..argument} commands. -\unexpanded\def\complexorsimple#1% +\protected\def\complexorsimple#1% {% \relax % prevents lookahead, brrr \doifelsenextoptional {\firstargumenttrue \csname\s!complex\csstring#1\endcsname} {\firstargumentfalse\csname\s!simple \csstring#1\endcsname}} -\unexpanded\def\complexorsimpleempty#1% +\protected\def\complexorsimpleempty#1% {% \relax % prevents lookahead, brrr \doifelsenextoptional {\firstargumenttrue \csname\s!complex\csstring#1\endcsname} @@ -3397,19 +3397,19 @@ %D The previous commands are used that often that we found it worthwile to offer two %D more alternatives. Watch the build in protection. -\unexpanded\def\syst_helpers_complex_or_simple#1#2% +\protected\def\syst_helpers_complex_or_simple#1#2% {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#2}} -\unexpanded\def\syst_helpers_complex_or_simple_empty#1% +\protected\def\syst_helpers_complex_or_simple_empty#1% {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#1[]}} -\unexpanded\def\definecomplexorsimple#1% - {\unexpanded\edef#1{\syst_helpers_complex_or_simple +\protected\def\definecomplexorsimple#1% + {\protected\edef#1{\syst_helpers_complex_or_simple \expandafter\noexpand\csname\s!complex\csstring#1\endcsname \expandafter\noexpand\csname\s!simple \csstring#1\endcsname}} -\unexpanded\def\definecomplexorsimpleempty#1% - {\unexpanded\edef#1{\syst_helpers_complex_or_simple_empty +\protected\def\definecomplexorsimpleempty#1% + {\protected\edef#1{\syst_helpers_complex_or_simple_empty \expandafter\noexpand\csname\s!complex\csstring#1\endcsname}} %D These commands are called as: @@ -3447,8 +3447,8 @@ \newconditional\c_syst_helpers_permit_spaces_between_groups -\unexpanded\def \permitspacesbetweengroups{\settrue \c_syst_helpers_permit_spaces_between_groups} -\unexpanded\def\dontpermitspacesbetweengroups{\setfalse\c_syst_helpers_permit_spaces_between_groups} +\protected\def \permitspacesbetweengroups{\settrue \c_syst_helpers_permit_spaces_between_groups} +\protected\def\dontpermitspacesbetweengroups{\setfalse\c_syst_helpers_permit_spaces_between_groups} \dontpermitspacesbetweengroups @@ -3457,7 +3457,7 @@ %D \type {conditional} token. Okay, these macros are not called that often but it %D saves crap when tracing. -\unexpanded\def\syst_helpers_get_grouped_argument#1#2% +\protected\def\syst_helpers_get_grouped_argument#1#2% {\let\syst_helpers_get_grouped_argument_yes#1% \let\syst_helpers_get_grouped_argument_nop#2% \futurelet\nextargument\syst_helpers_get_grouped_argument_indeed} @@ -3496,13 +3496,13 @@ \expandafter\syst_helpers_get_grouped_argument_d % h \fi} -\unexpanded\def\dosinglegroupempty#1% +\protected\def\dosinglegroupempty#1% {\def\syst_helpers_get_grouped_argument_nested {\dontpermitspacesbetweengroups #1}% \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} -\unexpanded\def\dodoublegroupempty#1% +\protected\def\dodoublegroupempty#1% {\def\syst_helpers_get_grouped_argument_nested##1% {\def\syst_helpers_get_grouped_argument_nested {\dontpermitspacesbetweengroups @@ -3510,7 +3510,7 @@ \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} -\unexpanded\def\dotriplegroupempty#1% +\protected\def\dotriplegroupempty#1% {\def\syst_helpers_get_grouped_argument_nested##1% {\def\syst_helpers_get_grouped_argument_nested####1% {\def\syst_helpers_get_grouped_argument_nested @@ -3520,7 +3520,7 @@ \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} -\unexpanded\def\doquadruplegroupempty#1% +\protected\def\doquadruplegroupempty#1% {\def\syst_helpers_get_grouped_argument_nested##1% {\def\syst_helpers_get_grouped_argument_nested####1% {\def\syst_helpers_get_grouped_argument_nested########1% @@ -3532,7 +3532,7 @@ \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}% \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse} -\unexpanded\def\doquintuplegroupempty#1% +\protected\def\doquintuplegroupempty#1% {\def\syst_helpers_get_grouped_argument_nested##1% {\def\syst_helpers_get_grouped_argument_nested####1% {\def\syst_helpers_get_grouped_argument_nested########1% @@ -3600,14 +3600,14 @@ \def\fifthofsixarguments #1#2#3#4#5#6{#5} \def\sixthofsixarguments #1#2#3#4#5#6{#6} -\unexpanded\def\firstofoneunexpanded #1{#1} +\protected\def\firstofoneunexpanded #1{#1} -\unexpanded\def\firstoftwounexpanded #1#2{#1} -\unexpanded\def\secondoftwounexpanded #1#2{#2} +\protected\def\firstoftwounexpanded #1#2{#1} +\protected\def\secondoftwounexpanded #1#2{#2} -\unexpanded\def\firstofthreeunexpanded #1#2#3{#1} -\unexpanded\def\secondofthreeunexpanded#1#2#3{#2} -\unexpanded\def\thirdofthreeunexpanded #1#2#3{#3} +\protected\def\firstofthreeunexpanded #1#2#3{#1} +\protected\def\secondofthreeunexpanded#1#2#3{#2} +\protected\def\thirdofthreeunexpanded #1#2#3{#3} %D \macros %D {globalletempty,letempty, @@ -3616,15 +3616,15 @@ %D %D Trivial: -\unexpanded\def\letempty #1{\let #1\empty} -\unexpanded\def\globalletempty#1{\glet#1\empty} +\protected\def\letempty #1{\let #1\empty} +\protected\def\globalletempty#1{\glet#1\empty} -\unexpanded\def\letvalueempty #1{\expandafter\let \csname#1\endcsname\empty} -\unexpanded\def\letgvalueempty#1{\expandafter\glet\csname#1\endcsname\empty} -\unexpanded\def\letvaluerelax #1{\expandafter\let \csname#1\endcsname\relax} -\unexpanded\def\letgvalurelax #1{\expandafter\glet\csname#1\endcsname\relax} +\protected\def\letvalueempty #1{\expandafter\let \csname#1\endcsname\empty} +\protected\def\letgvalueempty#1{\expandafter\glet\csname#1\endcsname\empty} +\protected\def\letvaluerelax #1{\expandafter\let \csname#1\endcsname\relax} +\protected\def\letgvalurelax #1{\expandafter\glet\csname#1\endcsname\relax} -\unexpanded\def\relaxvalueifundefined#1% +\protected\def\relaxvalueifundefined#1% {\ifcsname#1\endcsname \else \expandafter\let\csname#1\endcsname\relax \fi} @@ -3635,7 +3635,7 @@ %D The next macro hardly needs explanation. Because no nesting is to be expected, we %D can reuse \type {\wait} within \type {\wait} itself. -\unexpanded\def\wait +\protected\def\wait {\begingroup \read16 to \wait \endgroup} @@ -3662,12 +3662,12 @@ \ifdefined\writestring \else - \unexpanded\def\writestring{\immediate\write\statuswrite} - \unexpanded\def\writeline {\writestring{}} + \protected\def\writestring{\immediate\write\statuswrite} + \protected\def\writeline {\writestring{}} \fi -\unexpanded\def\normalwritestatus#1#2% +\protected\def\normalwritestatus#1#2% {\writestring{\expandafter\syst_helpers_split_status_yes\expandafter\statuswidth#1% \space\space\space\space\space\space\space \space\space\space\space\space\space\space @@ -3693,13 +3693,13 @@ %D %D A raw and dirty alternative for \type {\getparameters}; no checking is done! -\unexpanded\def\rawsetparameter#1=#2,% +\protected\def\rawsetparameter#1=#2,% {\if]#1\else \expandafter\def\csname\rawparameterprefix#1\endcsname{#2}% \expandafter\rawsetparameter \fi} -\unexpanded\def\rawgetparameters[#1][#2% some 5-10% faster +\protected\def\rawgetparameters[#1][#2% some 5-10% faster {\ifx#2]% test is needed, else bomb on [#1][] \expandafter\gobbleoneargument \else @@ -3720,13 +3720,13 @@ %D all preceding ones with \type {\redoglobal}. When using only alternatives, one %D can reset this mechanism with \type {\resetglobal}. -\unexpanded\def\resetglobal +\protected\def\resetglobal {\let\redoglobal\relax \let\dodoglobal\relax} \resetglobal -\unexpanded\def\doglobal +\protected\def\doglobal {\ifx\redoglobal\relax \let\redoglobal\global \let\dodoglobal\syst_helpers_dodo_global @@ -3760,7 +3760,7 @@ %D %D Apart from the prefixes, a few more \type {\expandafters} are needed: -% \unexpanded\def\newif#1% uses the original plain \@if +% \protected\def\newif#1% uses the original plain \@if % {\privatescratchcounter\escapechar % \escapechar\minusone % \expandafter\expandafter\expandafter @@ -3772,7 +3772,7 @@ % \dodoglobal\@if#1{false}% % \escapechar\privatescratchcounter} -\normalprotected\def\newif#1% see syst-ini.mkiv +\protected\def\newif#1% see syst-ini.mkiv {\let\new_if_saved\newif \let\newif\new_if_check \expandafter\redoglobal\expandafter\def\csname\expandafter\newif\csstring#1true\endcsname {\let#1\iftrue }% @@ -3782,26 +3782,26 @@ %D Also new: -\unexpanded\def\define#1% +\protected\def\define#1% {\ifdefined#1% \message{[\noexpand#1is already defined]}% - \unexpanded\expandafter\def\expandafter\gobbleddefinition + \protected\expandafter\def\expandafter\gobbleddefinition \else - \unexpanded\expandafter\def + \protected\expandafter\def \fi#1} -\unexpanded\def\redefine#1% +\protected\def\redefine#1% {\ifdefined#1% \message{[\noexpand#1is redefined]}% \fi - \unexpanded\def#1} + \protected\def#1} -\unexpanded\def\definemacro#1% +\protected\def\definemacro#1% {\ifdefined#1% \message{[\noexpand#1is already defined]}% - \unexpanded\expandafter\def\expandafter\gobbleddefinition + \protected\expandafter\def\expandafter\gobbleddefinition \else - \unexpanded\expandafter\def + \protected\expandafter\def \fi#1} % \define\hans{hans} @@ -3832,7 +3832,7 @@ % % \glet\stoptexdefinition\relax % -% \unexpanded\gdef\starttexdefinition% +% \protected\gdef\starttexdefinition% % {\bgroup% % \obeylines% % \syst_helpers_start_tex_definition} @@ -3855,7 +3855,7 @@ % \gdef\syst_helpers_start_tex_definition_yes_unexpanded#1#2 #3 % #4\stoptexdefinition% % {\egroup% #1=unexpanded -% \unexpanded\expandafter\def\csname#2\endcsname#3{#4}} +% \protected\expandafter\def\csname#2\endcsname#3{#4}} % % \gdef\syst_helpers_start_tex_definition_yes_normal#1#2 % #3\stoptexdefinition% @@ -3889,7 +3889,7 @@ % % \glet\stoptexdefinition\relax % -% \unexpanded\gdef\starttexdefinition% +% \protected\gdef\starttexdefinition% % {\bgroup% % \obeylines% % \syst_helpers_start_tex_definition_one} @@ -3908,7 +3908,7 @@ \glet\stoptexdefinition\relax -\unexpanded\gdef\starttexdefinition% +\protected\gdef\starttexdefinition% {\bgroup% \obeylines% \syst_helpers_start_tex_definition} @@ -3923,14 +3923,14 @@ \egroup -% \unexpanded\def\texdefinition#1{\csname\ifcsname#1\endcsname#1\else donothing\fi\endcsname} % todo: a nop cs: char 0 or some corenamespace +% \protected\def\texdefinition#1{\csname\ifcsname#1\endcsname#1\else donothing\fi\endcsname} % todo: a nop cs: char 0 or some corenamespace -\unexpanded\def\texdefinition#1{\begincsname#1\endcsname} +\protected\def\texdefinition#1{\begincsname#1\endcsname} % This is a first variant, more might be added: -\unexpanded\def\starttexcode{\unprotect} -\unexpanded\def\stoptexcode {\protect} +\protected\def\starttexcode{\unprotect} +\protected\def\stoptexcode {\protect} %D \macros %D {newcounter, @@ -3985,7 +3985,7 @@ \def\zerocountervalue{0} -\unexpanded\def\newcounter#1% +\protected\def\newcounter#1% {\dodoglobal\let#1\zerocountervalue} %D Nowadays we don't mind a few more tokens if we can gain a bit of speed. @@ -4006,14 +4006,14 @@ \def\m_syst_action_nop{\syst_helpers_do_do_do_decrement#1,\plusone}% \doifelsenextcharcs,\m_syst_action_yes\m_syst_action_nop} -\unexpanded\def\increment{\doifelsenextcharcs(\syst_helpers_do_do_increment\syst_helpers_do_increment} -\unexpanded\def\decrement{\doifelsenextcharcs(\syst_helpers_do_do_decrement\syst_helpers_do_decrement} +\protected\def\increment{\doifelsenextcharcs(\syst_helpers_do_do_increment\syst_helpers_do_increment} +\protected\def\decrement{\doifelsenextcharcs(\syst_helpers_do_do_decrement\syst_helpers_do_decrement} -\unexpanded\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr#1+\plusone \relax}} -\unexpanded\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr#1+\minusone\relax}} +\protected\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr#1+\plusone \relax}} +\protected\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr#1+\minusone\relax}} -\unexpanded\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname} -\unexpanded\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname} +\protected\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname} +\protected\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname} %D \macros %D {newsignal} @@ -4032,7 +4032,7 @@ \newdimen\maximumsignal % step is about 0.00025pt -\unexpanded\def\newsignal#1% +\protected\def\newsignal#1% {\ifdefined#1\else \advance\maximumsignal 2\scaledpoint % to be save in rounding \edef#1{\the\maximumsignal}% @@ -4061,7 +4061,7 @@ %D %D We will use this one in: -\unexpanded\def\savenormalmeaning#1% +\protected\def\savenormalmeaning#1% {\ifcsname normal\csstring#1\endcsname \else \expandafter\let\csname normal\csstring#1\endcsname#1% \fi} @@ -4114,7 +4114,7 @@ \installsystemnamespace{recurseindex} \installsystemnamespace{recurseaction} -\unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#4}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4136,7 +4136,7 @@ \fi \fi\normalexpanded{\syst_helpers_stepwise_next{\number#1}{\number#2}{\number#3}}} -\unexpanded\def\syst_helpers_stepwise_recurse#1#2#3% from to step +\protected\def\syst_helpers_stepwise_recurse#1#2#3% from to step {\ifnum#1>#2\relax \expandafter\syst_helpers_stepwise_recurse_nop \else @@ -4144,14 +4144,14 @@ \doubleexpandafter\syst_helpers_stepwise_recurse_yes\expandafter \fi\expandafter{\the\numexpr\recurselevel+#3\relax}{#2}{#3}} -\unexpanded\def\syst_helpers_recurse_content +\protected\def\syst_helpers_recurse_content {\csname\??recurseaction\the\outerrecurse\endcsname} -\unexpanded\def\syst_helpers_stepwise_recurse_yes +\protected\def\syst_helpers_stepwise_recurse_yes {\syst_helpers_recurse_content \syst_helpers_stepwise_recurse} -\unexpanded\def\syst_helpers_stepwise_reverse#1#2#3% from to step +\protected\def\syst_helpers_stepwise_reverse#1#2#3% from to step {\ifnum#1<#2\relax \expandafter\syst_helpers_stepwise_recurse_nop \else @@ -4161,22 +4161,22 @@ \doubleexpandafter\syst_helpers_stepwise_reverse_yes\expandafter \fi\expandafter{\the\innerrecurse}{#2}{#3}} -\unexpanded\def\syst_helpers_stepwise_reverse_yes +\protected\def\syst_helpers_stepwise_reverse_yes {\syst_helpers_recurse_content \syst_helpers_stepwise_reverse} -\unexpanded\def\syst_helpers_stepwise_exit +\protected\def\syst_helpers_stepwise_exit {\syst_helpers_stepwise_recurse_nop\relax} -\unexpanded\def\syst_helpers_stepwise_recurse_nop#1#2#3#4% +\protected\def\syst_helpers_stepwise_recurse_nop#1#2#3#4% {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse\minusone} -% \unexpanded\def\nonostepwiserecurse#1#2#3% +% \protected\def\nonostepwiserecurse#1#2#3% % {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname % \global\advance\outerrecurse\minusone} -\unexpanded\def\dorecurse#1% +\protected\def\dorecurse#1% {\dostepwiserecurse\plusone{#1}\plusone} \def\doexpandedrecurse#1#2% user macro (also was \doxprecurse) @@ -4201,7 +4201,7 @@ %D %D Because the simple case is used often, we implement it more efficiently: -\unexpanded\def\dorecurse#1% +\protected\def\dorecurse#1% {\ifcase#1\relax \expandafter\gobbletwoarguments \or @@ -4210,13 +4210,13 @@ \expandafter\syst_helpers_recurse_x \fi{#1}} -\unexpanded\def\syst_helpers_recurse_x#1#2% +\protected\def\syst_helpers_recurse_x#1#2% {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#2}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel \expandafter\syst_helpers_recurse_indeed\expandafter1\expandafter{\number#1}} -\unexpanded\def\syst_helpers_recurse_y#1#2% +\protected\def\syst_helpers_recurse_y#1#2% {\global\advance\outerrecurse \plusone \expandafter\glet\csname\??recurseindex\the\outerrecurse\endcsname\recurselevel \let\recurselevel\!!plusone @@ -4224,7 +4224,7 @@ \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse \minusone} -\unexpanded\def\syst_helpers_recurse_indeed#1#2% from to +\protected\def\syst_helpers_recurse_indeed#1#2% from to {\ifnum#1>#2\relax \expandafter\syst_helpers_recurse_indeed_nop \else @@ -4232,7 +4232,7 @@ \doubleexpandafter\syst_helpers_recurse_indeed_yes \fi\expandafter{\the\numexpr\recurselevel+\plusone\relax}{#2}} -\unexpanded\def\syst_helpers_recurse_indeed#1#2% from to +\protected\def\syst_helpers_recurse_indeed#1#2% from to {\ifnum#1>#2\relax \expandafter\syst_helpers_recurse_indeed_nop \else @@ -4241,11 +4241,11 @@ \doubleexpandafter\syst_helpers_recurse_indeed_yes \fi\expandafter{\the\innerrecurse}{#2}} -\unexpanded\def\syst_helpers_recurse_indeed_yes +\protected\def\syst_helpers_recurse_indeed_yes {\syst_helpers_recurse_content \syst_helpers_recurse_indeed} -\unexpanded\def\syst_helpers_recurse_indeed_nop#1#2#3% +\protected\def\syst_helpers_recurse_indeed_nop#1#2#3% {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse \minusone } @@ -4258,7 +4258,7 @@ %D \dowith{a,b,c}{[#1]} %D \stoptyping -\unexpanded\def\dowith#1#2% +\protected\def\dowith#1#2% {\def\syst_helpers_with##1{#2}% \normalexpanded{\processcommalist[#1]}\syst_helpers_with} @@ -4280,30 +4280,30 @@ \let\endofloop\donothing % maybe \syst_helpers_loop_end -\unexpanded\def\doloop#1% +\protected\def\doloop#1% {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#1}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel \let\endofloop\syst_helpers_loop \syst_helpers_loop1} % no \plusone else \recurselevel wrong -\unexpanded\def\syst_helpers_loop#1% +\protected\def\syst_helpers_loop#1% {\def\recurselevel{#1}% \expandafter\syst_helpers_loop_yes\expandafter{\the\numexpr\recurselevel+\plusone\relax}} -\unexpanded\def\syst_helpers_loop_yes +\protected\def\syst_helpers_loop_yes {\syst_helpers_recurse_content \endofloop} -\unexpanded\def\syst_helpers_loop_nop#1% +\protected\def\syst_helpers_loop_nop#1% {\let\endofloop\syst_helpers_loop % new, permits nested \doloop's \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse\minusone} -\unexpanded\def\exitloop % \exitloop quits at end +\protected\def\exitloop % \exitloop quits at end {\let\endofloop\syst_helpers_loop_nop} -\unexpanded\def\exitloopnow#1\endofloop % \exitloopnow quits directly +\protected\def\exitloopnow#1\endofloop % \exitloopnow quits directly {\syst_helpers_loop_nop} %D The loop is executed at least once, so beware of situations @@ -4346,13 +4346,13 @@ {\csname\??recurseaction\the\outerrecurse\expandafter\expandafter\expandafter\endcsname \expandafter\expandafter\expandafter{\expandafter\recurselevel\expandafter}\expandafter{\the\outerrecurse}} -\unexpanded\def\syst_helpers_recurse_x#1#2% +\protected\def\syst_helpers_recurse_x#1#2% {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#2}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel \expandafter\syst_helpers_recurse_indeed\expandafter1\expandafter{\number#1}} -\unexpanded\def\syst_helpers_recurse_y#1#2% +\protected\def\syst_helpers_recurse_y#1#2% {\global\advance\outerrecurse \plusone \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel \let\recurselevel\!!plusone @@ -4361,7 +4361,7 @@ \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname \global\advance\outerrecurse \minusone} -\unexpanded\def\doloop#1% +\protected\def\doloop#1% {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#1}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4370,7 +4370,7 @@ % for instance: % -% \unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +% \protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 % {\global\advance\outerrecurse \plusone % \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#4}% % \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4394,7 +4394,7 @@ % % faster: % -% \unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +% \protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 % {\global\advance\outerrecurse \plusone % \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#4}% % \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4414,7 +4414,7 @@ \installsystemnamespace{recursestepwise} -\unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#4}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel @@ -4466,7 +4466,7 @@ \let\m_syst_helpers_fast_loop_cs\relax -\unexpanded\def\dofastloopcs#1% +\protected\def\dofastloopcs#1% {\fastloopfinal#1\relax \ifcase\fastloopfinal \expandafter\gobbleoneargument @@ -4474,12 +4474,12 @@ \expandafter\syst_helpers_fast_loop_cs \fi} -\unexpanded\def\syst_helpers_fast_loop_cs#1% +\protected\def\syst_helpers_fast_loop_cs#1% {\let\m_syst_helpers_fast_loop_cs#1% \fastloopindex\plusone \syst_helpers_fast_loop_cs_step} -\unexpanded\def\syst_helpers_fast_loop_cs_step +\protected\def\syst_helpers_fast_loop_cs_step {\ifnum\fastloopindex>\fastloopfinal \let\m_syst_helpers_fast_loop_cs\relax \else @@ -4490,7 +4490,7 @@ % Helper: -\unexpanded\def\resetrecurselevel{\let\recurselevel\!!zerocount} +\protected\def\resetrecurselevel{\let\recurselevel\!!zerocount} \let\recurselevel \!!zerocount \let\recurseaction\relax @@ -4521,7 +4521,7 @@ %D } %D \stoptyping -\unexpanded\def\doloopoverlist#1#2% +\protected\def\doloopoverlist#1#2% {\global\advance\outerrecurse\plusone \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1{\edef\recursestring{##1}#2}% \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recursestring @@ -4553,26 +4553,26 @@ \installsystemnamespace{extraevery} -% \unexpanded\def\newevery#1#2% +% \protected\def\newevery#1#2% % {\ifx#1\everypar\else\newtoks#1\fi% we test for redefinition elsewhere % \ifx#2\relax\else\ifdefined#2\else % \expandafter\newtoks\csname\??extraevery\csstring#1\endcsname % \def#2{\syst_helpers_every#1}% % \fi\fi} % -% \unexpanded\def\syst_helpers_every#1% +% \protected\def\syst_helpers_every#1% % {\expandafter\removetoks\expandafter\the\csname\??extraevery\csstring#1\endcsname\from#1% % \expandafter\appendtoks\expandafter\the\csname\??extraevery\csstring#1\endcsname\to #1% % \csname\??extraevery\csstring#1\endcsname} -\unexpanded\def\newevery#1#2% +\protected\def\newevery#1#2% {\ifx#1\everypar\else\newtoks#1\fi% we test for redefinition elsewhere \ifx#2\relax\else\ifdefined#2\else \expandafter\newtoks\csname\??extraevery\csstring#1\endcsname \edef#2{\syst_helpers_every#1\csname\??extraevery\csstring#1\endcsname}% \fi\fi} -\unexpanded\def\syst_helpers_every#1#2% +\protected\def\syst_helpers_every#1#2% {\removetoks\the#2\from#1% \appendtoks\the#2\to #1% #2} @@ -4587,19 +4587,19 @@ % \newtoks \neverypar % \newtoks \neveryendpar % -% \normalprotected\def\syst_helpers_forgotten_endpar +% \protected\def\syst_helpers_forgotten_endpar % {\the\neveryendpar\normalpar} % -% \unexpanded\def\forgeteverypar +% \protected\def\forgeteverypar % {\everypar{\the\neverypar}% % \let\endpar\syst_helpers_forgotten_endpar} % -% \unexpanded\def\finishpar +% \protected\def\finishpar % {\ifvmode\else\par\fi} \newtoks \neverypar -\unexpanded\def\forgeteverypar +\protected\def\forgeteverypar {\everypar{\the\neverypar}} %D Which we're going to use indeed! When the second argument equals \type {\relax}, @@ -4665,10 +4665,10 @@ %D %D Both commands accept the prefix \type{\doglobal} for global assignments. -\unexpanded\def\convertvalue#1\to +\protected\def\convertvalue#1\to {\expandafter\convertcommand\csname#1\endcsname\to} -\unexpanded\def\defconvertedvalue#1#2% less sensitive for \to +\protected\def\defconvertedvalue#1#2% less sensitive for \to {\expandafter\defconvertedcommand\expandafter#1\csname#2\endcsname} %D \macros @@ -4692,14 +4692,14 @@ \def\syst_helpers_check_if_assignment_else#1=#2#3^^^^0004{\if#2^^^^0003}% \def\syst_helpers_check_else_assignment_if#1=#2#3^^^^0004{\unless\if#2^^^^0003}% -\unexpanded\def\doifelseassignment#1% +\protected\def\doifelseassignment#1% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=^^^^0003^^^^0003^^^^0004% \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} -\unexpanded\def\doifelseassignmentcs#1#2#3% +\protected\def\doifelseassignmentcs#1#2#3% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=^^^^0003^^^^0003^^^^0004% \expandafter#3% \else @@ -4711,7 +4711,7 @@ \newif\ifassignment -\unexpanded\def\docheckassignment#1% +\protected\def\docheckassignment#1% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=^^^^0003^^^^0003^^^^0004% \assignmentfalse \else @@ -4720,10 +4720,10 @@ %D These can be used for cases where we want less tracing noise. -\unexpanded\def\validassignment#1% +\protected\def\validassignment#1% {\expandafter\syst_helpers_check_else_assignment_if\detokenize{#1}=^^^^0003^^^^0003^^^^0004} -\unexpanded\def\novalidassignment#1% +\protected\def\novalidassignment#1% {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=^^^^0003^^^^0003^^^^0004} %D In \ETEX\ we can use \type {\detokenize} and gain some speed, but in general far @@ -4731,16 +4731,16 @@ %D This macro is more robust than the pure \TEX\ one, something I found out when %D primitives like \type {\jobname} were fed (or something undefined). -\unexpanded\def\convertargument#1\to#2{\dodoglobal\edef#2{\detokenize{#1}}} -\unexpanded\def\convertcommand #1\to#2{\dodoglobal\edef#2{\expandafter\detokenize\expandafter{#1}}} % hm, only second is also ok +\protected\def\convertargument#1\to#2{\dodoglobal\edef#2{\detokenize{#1}}} +\protected\def\convertcommand #1\to#2{\dodoglobal\edef#2{\expandafter\detokenize\expandafter{#1}}} % hm, only second is also ok -\unexpanded\def\defconvertedargument #1#2{\edef#1{\detokenize{#2}}} -\unexpanded\def\defconvertedcommand #1#2{\edef#1{\detokenize\expandafter{#2}}} -\unexpanded\def\edefconvertedargument#1#2{\edef#1{#2}% +\protected\def\defconvertedargument #1#2{\edef#1{\detokenize{#2}}} +\protected\def\defconvertedcommand #1#2{\edef#1{\detokenize\expandafter{#2}}} +\protected\def\edefconvertedargument#1#2{\edef#1{#2}% \edef#1{\detokenize\expandafter{#1}}} -\unexpanded\def\gdefconvertedargument#1#2{\xdef#1{\detokenize{#2}}} -\unexpanded\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\expandafter{#2}}} -\unexpanded\def\xdefconvertedargument#1#2{\xdef#1{#2}% +\protected\def\gdefconvertedargument#1#2{\xdef#1{\detokenize{#2}}} +\protected\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\expandafter{#2}}} +\protected\def\xdefconvertedargument#1#2{\xdef#1{#2}% \xdef#1{\detokenize\expandafter{#1}}} %D When you try to convert a primitive command, you'll find out that the \ETEX\ @@ -4764,7 +4764,7 @@ %D %D Ahandy macro, for testing purposes only: -\unexpanded\def\showvalue#1% +\protected\def\showvalue#1% {\ifcsname#1\endcsname \expandafter\show\csname#1\endcsname \else @@ -4784,7 +4784,7 @@ %D %D Watch the one level expansion of the second argument. -\unexpanded\def\doifelsemeaning#1#2% +\protected\def\doifelsemeaning#1#2% {\edef\m_syst_string_one{\normalmeaning#1}% \def \m_syst_string_two{#2}% \edef\m_syst_string_two{\normalmeaning\m_syst_string_two}% @@ -4813,9 +4813,9 @@ \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#4}}}% \ifx\m_syst_string_one\m_syst_string_two\expandafter#1\else\expandafter#2\fi} -\unexpanded\def\doifelsesamestring{\syst_helpers_if_samestring_else\firstoftwoarguments\secondoftwoarguments} -\unexpanded\def\doifsamestring {\syst_helpers_if_samestring_else\firstofoneargument \gobbleoneargument } -\unexpanded\def\doifnotsamestring {\syst_helpers_if_samestring_else\gobbleoneargument \firstofoneargument } +\protected\def\doifelsesamestring{\syst_helpers_if_samestring_else\firstoftwoarguments\secondoftwoarguments} +\protected\def\doifsamestring {\syst_helpers_if_samestring_else\firstofoneargument \gobbleoneargument } +\protected\def\doifnotsamestring {\syst_helpers_if_samestring_else\gobbleoneargument \firstofoneargument } \let\doifsamestringelse\doifelsesamestring @@ -4843,7 +4843,7 @@ %D %D In examples~2 and~3 both arguments equal, in~1 and~4 they differ. -\unexpanded\def\ConvertToConstant#1#2#3% +\protected\def\ConvertToConstant#1#2#3% {\edef\m_syst_string_one{\expandafter\detokenize\expandafter{#2}}% \edef\m_syst_string_two{\expandafter\detokenize\expandafter{#3}}% #1{\m_syst_string_one}{\m_syst_string_two}} @@ -4873,14 +4873,14 @@ %D %D where \type {...} can be anything legally \TEX. -\unexpanded\def\CheckConstantAfter#1#2% +\protected\def\CheckConstantAfter#1#2% {\expandafter\convertargument\v!prefix!\to\ascii \convertargument#1\to#2\relax \doifelseinstring\ascii{#2} {\expandafter\convertargument#1\to#2} {}} -\unexpanded\def\ConvertConstantAfter#1#2#3% +\protected\def\ConvertConstantAfter#1#2#3% {\CheckConstantAfter{#2}\asciia \CheckConstantAfter{#3}\asciib #1{\asciia}{\asciib}} @@ -4896,7 +4896,7 @@ %D %D We don't explicitly test if the macro is defined. -\unexpanded\def\assignifempty#1#2% can be sped up +\protected\def\assignifempty#1#2% can be sped up {\doifnothing{#1}{\def#1{#2}}} %D \macros @@ -4909,7 +4909,7 @@ %D In \CONTEXT\ we use a lot of \type {\start}||\type {\stop} like constructions. %D Sometimes, the \type {\stop} is used as a hard coded delimiter like in: %D %D \starttyping -%D \unexpanded\def\startcommand#1\stopcommand% +%D \protected\def\startcommand#1\stopcommand% %D {... #1 ...} %D \stoptyping %D @@ -4927,7 +4927,7 @@ %D {\stop}. This means that: %D %D \starttyping -%D \unexpanded\def\starthello% +%D \protected\def\starthello% %D {\grabuntil{stophello}\message} %D %D \starthello Hello world!\stophello @@ -4937,10 +4937,10 @@ \let\syst_helpers_grab_indeed\relax -\unexpanded\def\syst_helpers_grab#1#2% +\protected\def\syst_helpers_grab#1#2% {\def\syst_helpers_grab_indeed##1#1{#2{##1}}\syst_helpers_grab_indeed} -\unexpanded\def\grabuntil#1% +\protected\def\grabuntil#1% {\expandafter\syst_helpers_grab\expandafter{\csname#1\endcsname}} %D The next command build on this mechanism: @@ -4967,18 +4967,18 @@ \let\syst_helpers_gobble_indeed\relax -\unexpanded\def\processbetween#1#2% +\protected\def\processbetween#1#2% {\setvalue{\s!start#1}{\grabuntil{\s!stop#1}{#2}}} -\unexpanded\def\gobbleuntil#1% +\protected\def\gobbleuntil#1% {\def\syst_helpers_gobble_indeed##1#1{}\syst_helpers_gobble_indeed} -\unexpanded\def\gobbleuntilrelax#1\relax +\protected\def\gobbleuntilrelax#1\relax {} % experimental -\unexpanded\def\gobblenested#1#2#3% +\protected\def\gobblenested#1#2#3% {\normalexpanded{\def\noexpand\next##1\csname#2\endcsname}{\csname#3\endcsname}% \next}% @@ -4990,7 +4990,7 @@ \let\syst_helpers_until_indeed\relax -\unexpanded\def\processuntil#1% +\protected\def\processuntil#1% {\def\syst_helpers_until_indeed##1#1{##1}\syst_helpers_until_indeed} %D \macros @@ -5062,14 +5062,14 @@ % keep: % -% \unexpanded\def\syst_helpers_handle_group_normal#1#2% +% \protected\def\syst_helpers_handle_group_normal#1#2% % {\bgroup % \def\m_syst_helpers_handle_group_before{\bgroup#1\bgroup\aftergroup\m_syst_helpers_handle_group_after}% can't we remove the second \bgroup % \def\m_syst_helpers_handle_group_after {#2\egroup\egroup}% and one \egroup here? % \afterassignment\m_syst_helpers_handle_group_before % \let\next=} -% \unexpanded\def\syst_helpers_handle_group_normal#1#2% +% \protected\def\syst_helpers_handle_group_normal#1#2% % {\bgroup % \def\m_syst_helpers_handle_group_before{#1}% % \def\m_syst_helpers_handle_group_after {#2}% @@ -5087,7 +5087,7 @@ % \egroup % \egroup} % -% \unexpanded\def\syst_helpers_handle_group_simple#1#2% no inner group (so no kerning interference) +% \protected\def\syst_helpers_handle_group_simple#1#2% no inner group (so no kerning interference) % {\bgroup % \def\m_syst_helpers_handle_group_before{#1}% % \def\m_syst_helpers_handle_group_after {#2}% @@ -5103,7 +5103,7 @@ % {\m_syst_helpers_handle_group_after % \egroup}% % -% \unexpanded\def\syst_helpers_handle_group_pickup#1#2#3% no inner group (so no kerning interference) +% \protected\def\syst_helpers_handle_group_pickup#1#2#3% no inner group (so no kerning interference) % {\bgroup % \def\m_syst_helpers_handle_group_before{#1}% % \def\m_syst_helpers_handle_group_after {#2\egroup#3}% @@ -5115,7 +5115,7 @@ % \aftergroup\m_syst_helpers_handle_group_after % \m_syst_helpers_handle_group_before} % -% \unexpanded\def\syst_helpers_handle_group_nop +% \protected\def\syst_helpers_handle_group_nop % {\ifnum\currentgrouptype=\semisimplegroupcode % \expandafter\syst_helpers_handle_group_nop_a % \else @@ -5134,7 +5134,7 @@ % \aftergroup\m_syst_helpers_handle_group_after % #1} -\unexpanded\def\syst_helpers_handle_group_nop +\protected\def\syst_helpers_handle_group_nop {\ifnum\currentgrouptype=\semisimplegroupcode \expandafter\syst_helpers_handle_group_nop_a \else @@ -5153,7 +5153,7 @@ \aftergroup\egroup \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_normal +\protected\def\syst_helpers_handle_group_normal {\bgroup \afterassignment\m_syst_helpers_handle_group_normal_before \let\next=} @@ -5166,7 +5166,7 @@ \aftergroup\egroup \aftergroup\egroup} -\unexpanded\def\syst_helpers_handle_group_simple% no inner group (so no kerning interference) +\protected\def\syst_helpers_handle_group_simple% no inner group (so no kerning interference) {\bgroup \afterassignment\m_syst_helpers_handle_group_simple_before \let\next=} @@ -5180,7 +5180,7 @@ {\m_syst_helpers_handle_group_a \egroup}% -\unexpanded\def\syst_helpers_handle_group_pickup% no inner group (so no kerning interference) +\protected\def\syst_helpers_handle_group_pickup% no inner group (so no kerning interference) {\bgroup \afterassignment\m_syst_helpers_handle_group_pickup_before \let\next=} @@ -5192,7 +5192,7 @@ \aftergroup\m_syst_helpers_handle_group_p \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_nop_x +\protected\def\syst_helpers_handle_group_nop_x {\ifnum\currentgrouptype=\semisimplegroupcode \begingroup \aftergroup\endgroup @@ -5202,7 +5202,7 @@ \fi \m_syst_helpers_handle_group_b} -\unexpanded\def\syst_helpers_handle_group_normal_x +\protected\def\syst_helpers_handle_group_normal_x {\bgroup \afterassignment\m_syst_helpers_handle_group_normal_before_x \let\next=} @@ -5225,50 +5225,50 @@ %D {\futurelet} obeys blank spaces, and a line||ending token is treated as a blank %D space. So the final implementation became: -% \unexpanded\def\groupedcommand#1#2% +% \protected\def\groupedcommand#1#2% % {\doifelsenextbgroup{\syst_helpers_handle_group_normal{#1}{#2}}{\syst_helpers_handle_group_nop{#1}{#2}}} % -% \unexpanded\def\groupedcommandcs#1#2% +% \protected\def\groupedcommandcs#1#2% % {\doifelsenextbgroup{\syst_helpers_handle_group_normal{#1}{#2}}{\syst_helpers_handle_group_nop{#1}{#2}}} % -% \unexpanded\def\triggergroupedcommand#1% +% \protected\def\triggergroupedcommand#1% % {\doifelsenextbgroup{\syst_helpers_handle_group_normal{#1}{}}{\syst_helpers_handle_group_nop{#1}{}}} % -% \unexpanded\def\triggergroupedcommandcs#1% +% \protected\def\triggergroupedcommandcs#1% % {\doifelsenextbgroup{\syst_helpers_handle_group_normal{#1}{}}{\syst_helpers_handle_group_nop{#1}{}}} % -% \unexpanded\def\simplegroupedcommand#1#2% +% \protected\def\simplegroupedcommand#1#2% % {\doifelsenextbgroup{\syst_helpers_handle_group_simple{#1}{#2}}{\syst_helpers_handle_group_nop{#1}{#2}}} % -% \unexpanded\def\pickupgroupedcommand#1#2#3% +% \protected\def\pickupgroupedcommand#1#2#3% % {\doifelsenextbgroup{\syst_helpers_handle_group_pickup{#1}{#2}{#3}}{\syst_helpers_handle_group_nop{#1}{#2}}} -\unexpanded\def\groupedcommand#1#2% +\protected\def\groupedcommand#1#2% {\def\m_syst_helpers_handle_group_b{#1}% \def\m_syst_helpers_handle_group_a{#2}% \doifelsenextbgroupcs\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop} -\unexpanded\def\groupedcommandcs#1#2% +\protected\def\groupedcommandcs#1#2% {\let\m_syst_helpers_handle_group_b#1% \let\m_syst_helpers_handle_group_a#2% \doifelsenextbgroupcs\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop} -\unexpanded\def\simplegroupedcommand#1#2% +\protected\def\simplegroupedcommand#1#2% {\def\m_syst_helpers_handle_group_b{#1}% \def\m_syst_helpers_handle_group_a{#2}% \doifelsenextbgroupcs\syst_helpers_handle_group_simple\syst_helpers_handle_group_nop} -\unexpanded\def\pickupgroupedcommand#1#2#3% +\protected\def\pickupgroupedcommand#1#2#3% {\def\m_syst_helpers_handle_group_b{#1}% \def\m_syst_helpers_handle_group_a{#2}% \def\m_syst_helpers_handle_group_p{#3}% \doifelsenextbgroupcs\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop} -\unexpanded\def\triggergroupedcommand#1% +\protected\def\triggergroupedcommand#1% {\def\m_syst_helpers_handle_group_b{#1}% \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} -\unexpanded\def\triggergroupedcommandcs#1% +\protected\def\triggergroupedcommandcs#1% {\let\m_syst_helpers_handle_group_b#1% \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x} @@ -5297,10 +5297,10 @@ %D The user is warned with the suggestion to use \type {CAPITALS}. This suggestion %D is feasible, because \CONTEXT only defines lowcased macros. -\unexpanded\def\showdefinederror#1#2% +\protected\def\showdefinederror#1#2% {\writestatus\m!system{#1 #2 replaces a macro, use CAPITALS!}} -\unexpanded\def\checkdefined#1#2#3% +\protected\def\checkdefined#1#2#3% {\doifdefined{#3}{\showdefinederror{#2}{#3}}} %D \macros @@ -5355,29 +5355,29 @@ \newtoks\BeforePar \newtoks\AfterPar -\unexpanded\def\redowithpar\par +\protected\def\redowithpar\par {\doifelsenextchar\par\redowithpar\dodowithpar}% -\unexpanded\def\dowithpar#1#2% +\protected\def\dowithpar#1#2% {\def\dodowithpar##1\par{#1##1#2}% \redowithpar\par} -\unexpanded\def\redogotopar\par +\protected\def\redogotopar\par {\doifelsenextchar\par\redogotopar\dodogotopar}% -\unexpanded\def\dogotopar#1% +\protected\def\dogotopar#1% {\def\dodogotopar{#1}% \redogotopar\par} -\unexpanded\def\dogotoparcs#1% +\protected\def\dogotoparcs#1% {\let\dodogotopar#1% \redogotopar\par} \ifdefined \ignorepars \else - \unexpanded\def\ignorepars{\dogotoparcs\relax} + \protected\def\ignorepars{\dogotoparcs\relax} \fi -\unexpanded\def\GetPar +\protected\def\GetPar {\expanded {\dowithpar {\the\BeforePar @@ -5386,7 +5386,7 @@ \BeforePar\emptytoks \AfterPar\emptytoks}}} -\unexpanded\def\GotoPar +\protected\def\GotoPar {\expanded {\dogotopar {\the\BeforePar @@ -5425,7 +5425,7 @@ \let\syst_helpers_next_par\relax \let\syst_helpers_next_arg\relax -\unexpanded\def\dowithpargument#1% +\protected\def\dowithpargument#1% {\def\syst_helpers_next_par##1 \par{#1{##1}}% \def\syst_helpers_next_arg##1{#1{##1}}% \doifelsenextbgroup\syst_helpers_next_arg{\doifelsenextchar\par{#1{}}\syst_helpers_next_par}} @@ -5453,7 +5453,7 @@ \let\syst_helpers_next_war\relax \let\syst_helpers_next_arg\relax -\unexpanded\def\dowithwargument#1% +\protected\def\dowithwargument#1% {\def\syst_helpers_next_war##1 {#1{##1}}% \def\syst_helpers_next_arg##1{#1{##1}}% \doifelsenextbgroup\syst_helpers_next_arg\syst_helpers_next_war} @@ -5487,7 +5487,7 @@ %D commands, the \type {n*} is optional. When this specification is missing, the %D command executes once. -\unexpanded\def\dorepeatwithcommand[#1]% +\protected\def\dorepeatwithcommand[#1]% {\syst_helpers_repeat_with_command#1*\empty*\relax} \def\syst_helpers_repeat_with_command#1*#2#3*#4\relax#5% @@ -5578,10 +5578,10 @@ % no longer \def but \let to target toks .. the space gobbling \relax will go -% \unexpanded\def\appendtoks {\syst_helpers_append_toks \relax} -% \unexpanded\def\prependtoks {\syst_helpers_prepend_toks \relax} -% \unexpanded\def\appendtoksonce {\syst_helpers_append_toks_once \relax} -% \unexpanded\def\prependtoksonce{\syst_helpers_prepend_toks_once\relax} +% \protected\def\appendtoks {\syst_helpers_append_toks \relax} +% \protected\def\prependtoks {\syst_helpers_prepend_toks \relax} +% \protected\def\appendtoksonce {\syst_helpers_append_toks_once \relax} +% \protected\def\prependtoksonce{\syst_helpers_prepend_toks_once\relax} % % \def\syst_helpers_append_toks_indeed % {\dodoglobal\m_syst_helpers_scratch\doubleexpandafter{\expandafter\the\expandafter\m_syst_helpers_scratch\the\t_syst_helpers_scratch}} @@ -5613,13 +5613,13 @@ % \donothing % \syst_helpers_prepend_toks_indeed} -% \unexpanded\def\appendtoks#1\to#2% +% \protected\def\appendtoks#1\to#2% % {\toksapp#2{#1}% % \ifx\dodoglobal\relax\else % \dodoglobal#2#2% % \fi} % -% \unexpanded\def\prependtoks#1\to#2% +% \protected\def\prependtoks#1\to#2% % {\tokspre#2{#1}% % \ifx\dodoglobal\relax\else % \dodoglobal#2#2% @@ -5637,7 +5637,7 @@ % \dodoglobal\m_syst_helpers_scratch\m_syst_helpers_scratch % \fi} -\unexpanded\def\appendtoks#1\to#2% +\protected\def\appendtoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\toksapp \else @@ -5645,7 +5645,7 @@ \expandafter\gtoksapp \fi#2{#1}} -\unexpanded\def\prependtoks#1\to#2% +\protected\def\prependtoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\tokspre \else @@ -5669,14 +5669,14 @@ \expandafter\gtokspre \fi\m_syst_helpers_scratch\t_syst_helpers_scratch} -\unexpanded\def\appendtoksonce#1\to#2% +\protected\def\appendtoksonce#1\to#2% {\let\m_syst_helpers_scratch#2% \t_syst_helpers_scratch{#1}% \doifelseintoks\t_syst_helpers_scratch\m_syst_helpers_scratch \donothing \syst_helpers_append_toks_indeed} -\unexpanded\def\prependtoksonce#1\to#2% +\protected\def\prependtoksonce#1\to#2% {\let\m_syst_helpers_scratch#2% \t_syst_helpers_scratch{#1}% \doifelseintoks\t_syst_helpers_scratch\m_syst_helpers_scratch @@ -5685,7 +5685,7 @@ %D The test macro: -\unexpanded\def\doifelseintoks#1#2% #1 en #2 zijn toks +\protected\def\doifelseintoks#1#2% #1 en #2 zijn toks {\edef\asciia{\detokenize\expandafter{\the#1}}% \edef\asciib{\detokenize\expandafter{\the#2}}% \doifelsestringinstring\asciia\asciib} @@ -5713,14 +5713,14 @@ \newtoks \collectingtoks -\unexpanded\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}} -\unexpanded\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}} +\protected\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}} +\protected\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}} -\unexpanded\def\startcollecting{\collectingtoks\emptytoks} -\unexpanded\def\stopcollecting {\the\collectingtoks} +\protected\def\startcollecting{\collectingtoks\emptytoks} +\protected\def\stopcollecting {\the\collectingtoks} -\unexpanded\def\collect {\toksapp \collectingtoks} -\unexpanded\def\collectexpanded{\etoksapp\collectingtoks} +\protected\def\collect {\toksapp \collectingtoks} +\protected\def\collectexpanded{\etoksapp\collectingtoks} %D A nice one too: @@ -5730,7 +5730,7 @@ % {\scratchtoks{xaa} \removetoks x\from\scratchtoks [\the\scratchtoks]} % {\scratchtoks{a\relax b} \removetoks \relax\from\scratchtoks [\showthe\scratchtoks]} -\unexpanded\def\removetoks#1\from#2% +\protected\def\removetoks#1\from#2% {\def\syst_helpers_remove_toks##1#1##2\empty\empty\empty##3^^^^0004% {\def\m_syst_string_one{##3}% \ifx\m_syst_string_one\empty#2{##1}\else#2{##1##2}\fi}% @@ -5738,22 +5738,22 @@ %D Also: -% \unexpanded\def\appendetoks #1\to{\normalexpanded{\appendtoks #1}\to} -% \unexpanded\def\prependetoks#1\to{\normalexpanded{\prependtoks#1}\to} +% \protected\def\appendetoks #1\to{\normalexpanded{\appendtoks #1}\to} +% \protected\def\prependetoks#1\to{\normalexpanded{\prependtoks#1}\to} -% \unexpanded\def\appendetoks#1\to#2% +% \protected\def\appendetoks#1\to#2% % {\etoksapp#2{#1}% % \ifx\dodoglobal\relax\else % \global#2#2% % \fi} % -% \unexpanded\def\prependetoks#1\to#2% +% \protected\def\prependetoks#1\to#2% % {\etokspre#2{#1}% % \ifx\dodoglobal\relax\else % \global#2#2% % \fi} -\unexpanded\def\appendetoks#1\to#2% +\protected\def\appendetoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\etoksapp \else @@ -5761,7 +5761,7 @@ \expandafter\xtoksapp \fi#2{#1}} -\unexpanded\def\prependetoks#1\to#2% +\protected\def\prependetoks#1\to#2% {\ifx\dodoglobal\relax \expandafter\etokspre \else @@ -5771,7 +5771,7 @@ %D Hm. -\unexpanded\def\flushtoks#1% nb: can reassign to #1 again, hence the indirectness +\protected\def\flushtoks#1% nb: can reassign to #1 again, hence the indirectness {\t_syst_helpers_scratch#1\relax \dodoglobal#1\emptytoks \the\t_syst_helpers_scratch\relax} @@ -5798,12 +5798,12 @@ \let\syst_helpers_split_string\relax -\unexpanded\def\beforesplitstring#1\at#2\to#3% +\protected\def\beforesplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##1#2##2#2##3\\% {\def#3{##1}}% \expandafter\syst_helpers_split_string#1#2#2\\} -\unexpanded\def\aftersplitstring#1\at#2\to#3% +\protected\def\aftersplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##1#2##2@@@##3\\% {\def#3{##2}}% \expandafter\syst_helpers_split_string#1@@@#2@@@\\} @@ -5813,7 +5813,7 @@ %D %D A bonus macro. -\unexpanded\def\splitstring#1\at#2\to#3\and#4% +\protected\def\splitstring#1\at#2\to#3\and#4% {\def\syst_helpers_split_string##1#2##2\empty\empty\empty##3\\% {\def#3{##1}% \def\syst_helpers_split_string{##3}% @@ -5824,7 +5824,7 @@ \fi}% \expandafter\syst_helpers_split_string#1\empty\empty\empty#2\empty\empty\empty\\} -\unexpanded\def\greedysplitstring#1\at#2\to#3\and#4% +\protected\def\greedysplitstring#1\at#2\to#3\and#4% {\edef\asciib{#1}% \let\asciic\asciib \let#3\empty @@ -5846,12 +5846,12 @@ %D aftertestandsplitstring, %D testandsplitstring} -\unexpanded\def\beforetestandsplitstring#1\at#2\to#3% +\protected\def\beforetestandsplitstring#1\at#2\to#3% {\def\syst_helpers_split_string##1#2##2#2##3##4\\% {\ifx##3\empty\let#3\empty\else\def#3{##1}\fi}% \expandafter\syst_helpers_split_string#1#2#2\empty\\} -\unexpanded\def\aftertestandsplitstring#1\at#2\to#3% +\protected\def\aftertestandsplitstring#1\at#2\to#3% {\def\syst_helpers_split_string ##1#2##2@@@##3##4\\% {\ifx##3\empty\let#3\empty\else\def#3{##2}\fi}% \expandafter\syst_helpers_split_string #1@@@#2@@@\empty\\} @@ -5868,17 +5868,17 @@ %D splitatcolon, %D splitatcolons} -\unexpanded\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..\relax} -\unexpanded\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,\relax} % not at ", " -\unexpanded\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**\relax} -\unexpanded\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::\relax} -\unexpanded\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::\relax} +\protected\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..\relax} +\protected\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,\relax} % not at ", " +\protected\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**\relax} +\protected\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::\relax} +\protected\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::\relax} -\unexpanded\def\syst_helpers_splitatperiod #1.#2.#3\relax#4#5{\def#4{#1}\def#5{#2}} -\unexpanded\def\syst_helpers_splitatcomma #1,#2,#3\relax#4#5{\def#4{#1}\def#5{#2}} -\unexpanded\def\syst_helpers_splitatasterisk #1*#2*#3\relax#4#5{\def#4{#1}\def#5{#2}} -\unexpanded\def\syst_helpers_splitatcolon #1:#2:#3\relax#4#5{\def#4{#1}\def#5{#2}} -\unexpanded\def\syst_helpers_splitatcolons #1::#2::#3\relax#4#5{\edef#4{#1}\edef#5{#2}} +\protected\def\syst_helpers_splitatperiod #1.#2.#3\relax#4#5{\def#4{#1}\def#5{#2}} +\protected\def\syst_helpers_splitatcomma #1,#2,#3\relax#4#5{\def#4{#1}\def#5{#2}} +\protected\def\syst_helpers_splitatasterisk #1*#2*#3\relax#4#5{\def#4{#1}\def#5{#2}} +\protected\def\syst_helpers_splitatcolon #1:#2:#3\relax#4#5{\def#4{#1}\def#5{#2}} +\protected\def\syst_helpers_splitatcolons #1::#2::#3\relax#4#5{\edef#4{#1}\edef#5{#2}} %D \macros %D {removesubstring} @@ -5891,7 +5891,7 @@ %D %D Which in terms of \TEX\ looks like: -\unexpanded\def\removesubstring#1\from#2\to#3% +\protected\def\removesubstring#1\from#2\to#3% {\splitstring#2\to\m_syst_string_one\and\m_syst_string_two \dodoglobal#3{\m_syst_string_one\m_syst_string_two}} @@ -5948,36 +5948,36 @@ %D %D The faster alternatives are: -\unexpanded\def\appendtocommalist#1#2% +\protected\def\appendtocommalist#1#2% {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}} -\unexpanded\def\prependtocommalist#1#2% +\protected\def\prependtocommalist#1#2% {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}} -\unexpanded\def\addtocommalist#1#2% {item} \cs +\protected\def\addtocommalist#1#2% {item} \cs {\rawdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}} -\unexpanded\def\pretocommalist#1#2% {item} \cs +\protected\def\pretocommalist#1#2% {item} \cs {\rawdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}} -\unexpanded\def\robustdoifelseinset#1#2% +\protected\def\robustdoifelseinset#1#2% {\edef\m_syst_string_one{\detokenize\expandafter{\normalexpanded{#1}}}% \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#2}}}% \rawdoifelseinset\m_syst_string_one\m_syst_string_two} \let\robustdoifinsetelse\robustdoifelseinset -\unexpanded\def\robustaddtocommalist#1#2% {item} \cs +\protected\def\robustaddtocommalist#1#2% {item} \cs {\robustdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}} -\unexpanded\def\robustpretocommalist#1#2% {item} \cs +\protected\def\robustpretocommalist#1#2% {item} \cs {\robustdoifelseinset{#1}#2\resetglobal {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}} -\unexpanded\def\xsplitstring#1#2% \cs {str} +\protected\def\xsplitstring#1#2% \cs {str} {\def\syst_helpers_split_string##1,#2,##2,#2,##3\\% {\edef\m_syst_string_one{\bcleanedupcommalist##1\empty\empty\relax}% \edef\m_syst_string_two{\acleanedupcommalist##2,,\relax}}% @@ -5987,7 +5987,7 @@ \def\bcleanedupcommalist#1#2\relax{\if#1,\else#1\fi#2} \def\acleanedupcommalist#1,,#2\relax{#1} -\unexpanded\def\removefromcommalist#1#2% to be sped up +\protected\def\removefromcommalist#1#2% to be sped up {\rawdoifelseinset{#1}#2% {\normalexpanded{\xsplitstring\noexpand#2{#1}}% \dodoglobal\edef#2% @@ -5998,10 +5998,10 @@ \fi}} \resetglobal} -% \unexpanded\def\addtocommalist#1#2% upto 3 times slower +% \protected\def\addtocommalist#1#2% upto 3 times slower % {\dodoglobal\edef#2{\ctxcommand{addtocommalist(\!!bs#1\!!es,\!!bs#2\!!es)}}} % -% \unexpanded\def\removefromcommalist#1#2% faster and more robust +% \protected\def\removefromcommalist#1#2% faster and more robust % {\dodoglobal\edef#2{\ctxcommand{addtocommalist(\!!bs#1\!!es,\!!bs#2\!!es)}}} %D \macros @@ -6023,7 +6023,7 @@ \edef\m_syst_string_four{\ifx\m_syst_string_four\empty\else\m_syst_string_four,\fi#1}% \fi} -\unexpanded\def\substituteincommalist#1#2#3% old, new, list (slooow) +\protected\def\substituteincommalist#1#2#3% old, new, list (slooow) {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \let\m_syst_string_four\empty @@ -6086,7 +6086,7 @@ \fi \advance\commalistcounter\plusone} -\unexpanded\def\replaceincommalist#1#2% #1 = commalistelement #2 = position starts at 1 +\protected\def\replaceincommalist#1#2% #1 = commalistelement #2 = position starts at 1 {\c_syst_helpers_comma_list_index#2\relax \let\m_syst_helpers_comma_list_target\empty \let\commalistelement\empty @@ -6110,7 +6110,7 @@ \expandafter\syst_helpers_comma_list_command_global_step \fi} -\unexpanded\def\globalprocesscommalist[#1]#2% +\protected\def\globalprocesscommalist[#1]#2% {\glet\m_syst_helpers_comma_list_command_global#2% \expandafter\syst_helpers_comma_list_command_global_step#1,],} @@ -6167,13 +6167,13 @@ \newcount\c_syst_helpers_swapped \let \m_syst_helpers_swapped\relax -\unexpanded\def\swapdimens#1#2{\d_syst_helpers_swapped #1\relax#1#2\relax#2\d_syst_helpers_swapped} -\unexpanded\def\swapcounts#1#2{\c_syst_helpers_swapped #1\relax#1#2\relax#2\c_syst_helpers_swapped} -\unexpanded\def\swapmacros#1#2{\let\m_syst_helpers_swapped#1\let #1#2\let #2\m_syst_helpers_swapped} +\protected\def\swapdimens#1#2{\d_syst_helpers_swapped #1\relax#1#2\relax#2\d_syst_helpers_swapped} +\protected\def\swapcounts#1#2{\c_syst_helpers_swapped #1\relax#1#2\relax#2\c_syst_helpers_swapped} +\protected\def\swapmacros#1#2{\let\m_syst_helpers_swapped#1\let #1#2\let #2\m_syst_helpers_swapped} -\unexpanded\def\globalswapdimens#1#2{\d_syst_helpers_swapped #1\global#1#2\global#2\d_syst_helpers_swapped} -\unexpanded\def\globalswapcounts#1#2{\c_syst_helpers_swapped #1\global#1#2\global#2\c_syst_helpers_swapped} -\unexpanded\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet #1#2\glet #2\m_syst_helpers_swapped} +\protected\def\globalswapdimens#1#2{\d_syst_helpers_swapped #1\global#1#2\global#2\d_syst_helpers_swapped} +\protected\def\globalswapcounts#1#2{\c_syst_helpers_swapped #1\global#1#2\global#2\c_syst_helpers_swapped} +\protected\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet #1#2\glet #2\m_syst_helpers_swapped} %D \macros %D {pushmacro,popmacro} @@ -6192,7 +6192,7 @@ % \let\m_syst_helpers_push_macro\empty % -% \unexpanded\def\globalpushmacro#1% +% \protected\def\globalpushmacro#1% % {\xdef\m_syst_helpers_push_macro{\string#1}% % \ifcsname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \else % \expandafter\newcount\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname @@ -6200,12 +6200,12 @@ % \global\advance\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \plusone % \expandafter\glet\csname\the\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname\m_syst_helpers_push_macro\endcsname#1} % -% \unexpanded\def\globalpopmacro#1% +% \protected\def\globalpopmacro#1% % {\xdef\m_syst_helpers_push_macro{\string#1}% % \expandafter\glet\expandafter#1\csname\the\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname\m_syst_helpers_push_macro\endcsname % \global\advance\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \minusone} % -% \unexpanded\def\localpushmacro#1% this one can be used to push a value over an \egroup +% \protected\def\localpushmacro#1% this one can be used to push a value over an \egroup % {\xdef\m_syst_helpers_push_macro{\string#1}% % \ifcsname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \else % \expandafter\newcount\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname @@ -6213,7 +6213,7 @@ % \global\advance\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \plusone % \expandafter\glet\csname\the\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname\m_syst_helpers_push_macro\endcsname#1} % -% \unexpanded\def\localpopmacro#1% +% \protected\def\localpopmacro#1% % {\xdef\m_syst_helpers_push_macro{\string#1}% % \expandafter\let\expandafter#1\csname\the\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname\m_syst_helpers_push_macro\endcsname % \global\advance\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \minusone } @@ -6237,7 +6237,7 @@ {\expandafter\newcount\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname\plusone} -\unexpanded\def\globalpushmacro#1% +\protected\def\globalpushmacro#1% {\xdef\m_syst_helpers_push_macro{\csstring#1}% \ifcsname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\lastnamedcs\plusone @@ -6246,7 +6246,7 @@ \fi \expandafter\glet\csname\the\lastnamedcs\m_syst_helpers_push_macro\endcsname#1} -\unexpanded\def\localpushmacro#1% this one can be used to push a value over an \egroup +\protected\def\localpushmacro#1% this one can be used to push a value over an \egroup {\xdef\m_syst_helpers_push_macro{\csstring#1}% \ifcsname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\lastnamedcs\plusone @@ -6255,13 +6255,13 @@ \fi \expandafter\glet\csname\the\lastnamedcs\m_syst_helpers_push_macro\endcsname#1} -\unexpanded\def\globalpopmacro#1% +\protected\def\globalpopmacro#1% {\xdef\m_syst_helpers_push_macro{\csstring#1}% \c_syst_helpers_pop_count\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\lastnamedcs \minusone \expandafter\glet\expandafter#1\csname\the\c_syst_helpers_pop_count\m_syst_helpers_push_macro\endcsname} -\unexpanded\def\localpopmacro#1% +\protected\def\localpopmacro#1% {\xdef\m_syst_helpers_push_macro{\csstring#1}% \c_syst_helpers_pop_count\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname \global\advance\lastnamedcs \minusone @@ -6288,7 +6288,7 @@ \newdimen\localhsize -\unexpanded\def\setlocalhsize % don't change ! +\protected\def\setlocalhsize % don't change ! {\doifelsenextoptional \syst_helpers_set_local_hsize_yes \syst_helpers_set_local_hsize_nop} @@ -6324,7 +6324,7 @@ %D three tokens per call. Anyone familiar with the not||values ones, can derive %D their meaning from the definitions. -\unexpanded\def\doifvalue#1#2% +\protected\def\doifvalue#1#2% {\edef\m_syst_string_one{\csname#1\endcsname}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -6333,7 +6333,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifnotvalue#1#2% +\protected\def\doifnotvalue#1#2% {\edef\m_syst_string_one{\csname#1\endcsname}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -6342,7 +6342,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsevalue#1#2% +\protected\def\doifelsevalue#1#2% {\edef\m_syst_string_one{\csname#1\endcsname}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two @@ -6351,7 +6351,7 @@ \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifnothing#1% +\protected\def\doifnothing#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\firstofoneargument @@ -6359,7 +6359,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifsomething#1% +\protected\def\doifsomething#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument @@ -6367,7 +6367,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsenothing#1% +\protected\def\doifelsenothing#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments @@ -6375,7 +6375,7 @@ \expandafter\secondoftwoarguments \fi} -\unexpanded\def\doifelsesomething#1% +\protected\def\doifelsesomething#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty \expandafter\secondoftwoarguments @@ -6383,7 +6383,7 @@ \expandafter\firstoftwoarguments \fi} -\unexpanded\def\doifvaluenothing#1% +\protected\def\doifvaluenothing#1% {\edef\m_syst_string_one{\csname#1\endcsname}% \ifx\m_syst_string_one\empty \expandafter\firstofoneargument @@ -6391,7 +6391,7 @@ \expandafter\gobbleoneargument \fi} -\unexpanded\def\doifvaluesomething#1% +\protected\def\doifvaluesomething#1% {\edef\m_syst_string_one{\csname#1\endcsname}% \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument @@ -6399,7 +6399,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifelsevaluenothing#1% +\protected\def\doifelsevaluenothing#1% {\edef\m_syst_string_one{\csname#1\endcsname}% \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments @@ -6454,9 +6454,9 @@ \processcommalist[#3]\syst_helpers_do_common_check_all \ifdone\expandafter#1\else\expandafter#2\fi} -\unexpanded\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments} -\unexpanded\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument } -\unexpanded\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments } +\protected\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments} +\protected\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument } +\protected\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments } \let\doifallcommonelse\doifelseallcommon @@ -6479,38 +6479,38 @@ %D These might end up as \LUA based helpers (i.e. consider these %D obsolete: -\unexpanded\def\syst_helpers_do_IF#1#2% +\protected\def\syst_helpers_do_IF#1#2% {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\unexpanded\def\syst_helpers_do_IF_NOT#1#2% +\protected\def\syst_helpers_do_IF_NOT#1#2% {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}% \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\unexpanded\def\syst_helpers_do_IF_ELSE#1#2% +\protected\def\syst_helpers_do_IF_ELSE#1#2% {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\syst_helpers_do_IF_INSTRING_ELSE#1#2% +\protected\def\syst_helpers_do_IF_INSTRING_ELSE#1#2% {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\unexpanded\def\DOIF #1#2{\normalexpanded{\syst_helpers_do_IF {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFNOT #1#2{\normalexpanded{\syst_helpers_do_IF_NOT {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFELSE #1#2{\normalexpanded{\syst_helpers_do_IF_ELSE {#1}{#2}}}% will become obsolete -\unexpanded\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\syst_helpers_do_IF_INSTRING_ELSE{#1}{#2}}}% will become obsolete +\protected\def\DOIF #1#2{\normalexpanded{\syst_helpers_do_IF {#1}{#2}}}% will become obsolete +\protected\def\DOIFNOT #1#2{\normalexpanded{\syst_helpers_do_IF_NOT {#1}{#2}}}% will become obsolete +\protected\def\DOIFELSE #1#2{\normalexpanded{\syst_helpers_do_IF_ELSE {#1}{#2}}}% will become obsolete +\protected\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\syst_helpers_do_IF_INSTRING_ELSE{#1}{#2}}}% will become obsolete %D \macros %D {dosingleargumentwithset, @@ -6535,7 +6535,7 @@ %D \def\dodefinesomething[#1][#2]% %D {\getparameters[\??xx#1][#2]} %D -%D \unexpanded\def\definesomething% +%D \protected\def\definesomething% %D {\dodoubleargumentwithset\dodefinesomething} %D \stoptyping %D @@ -6589,7 +6589,7 @@ \let\m_syst_helpers_strip_character\empty -\unexpanded\def\stripcharacter#1\from#2\to#3% +\protected\def\stripcharacter#1\from#2\to#3% {\def\syst_helpers_strip_character##1#1##2\end {\edef\m_syst_helpers_strip_character{\m_syst_helpers_strip_character##1}% \doifnotempty{##2}{\syst_helpers_strip_character##2\end}}% @@ -6598,7 +6598,7 @@ \expandafter\syst_helpers_strip_character\m_syst_string_one#1\end \dodoglobal\let#3\m_syst_helpers_strip_character} -\unexpanded\def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2 +\protected\def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2 {\stripcharacter{ }\from#1\to#2} %D \macros @@ -6607,7 +6607,7 @@ %D The next macro does the same but is more compatible with other macros, like \type %D {\convert...}. -\unexpanded\def\unspacestring#1\to#2% +\protected\def\unspacestring#1\to#2% {\stripcharacter{ }\from#1\to#2} %D \macros @@ -6712,7 +6712,7 @@ \syst_helpers_process_separated_list_step}% \expandafter\syst_helpers_process_separated_list_step\gobbleoneargument#1#3]#3} -\unexpanded\def\processseparatedlist[% +\protected\def\processseparatedlist[% {\syst_helpers_process_separated_list\relax} %D \macros @@ -6735,7 +6735,7 @@ \let\syst_helpers_process_any_list_indeed\relax \let\syst_helpers_process_any_list_step \relax -\unexpanded\def\processlist#1#2#3#4% no blank skipping ! +\protected\def\processlist#1#2#3#4% no blank skipping ! {\def\syst_helpers_process_any_list_indeed##1#2% {\def\syst_helpers_process_any_list_step####1####2#3% {\ifx#2####1% @@ -6764,7 +6764,7 @@ %D This command can be integrated in \type {\getparameters}, but we decided best not %D to do so. -\unexpanded\def\processassignlist#1[#2]#3% +\protected\def\processassignlist#1[#2]#3% {\def\syst_helpers_process_assign_list_assign[##1=##2=##3]% {\doif{##3}\relax{#3{##1}}}% \def\syst_helpers_process_assign_list_step##1% @@ -6787,7 +6787,7 @@ \let\m_syst_helpers_untexed\empty -\unexpanded\def\untexsomething +\protected\def\untexsomething {\begingroup \catcode\leftbraceasciicode \ignorecatcode \catcode\rightbraceasciicode\ignorecatcode @@ -6799,8 +6799,8 @@ \endgroup \let#3\m_syst_helpers_untexed} -\unexpanded\def\untexargument{\untexsomething\convertargument} -\unexpanded\def\untexcommand {\untexsomething\convertcommand} +\protected\def\untexargument{\untexsomething\convertargument} +\protected\def\untexcommand {\untexsomething\convertcommand} %D \macros %D {ScaledPointsToBigPoints,ScaledPointsToWholeBigPoints} @@ -6816,16 +6816,16 @@ %D %D In pure \TEX: -% \unexpanded\def\PointsToBigPoints#1#2% +% \protected\def\PointsToBigPoints#1#2% % {\edef#2{\withoutpt\the\dimexpr.996264\dimexpr#1\relax\relax}} % -% \unexpanded\def\PointsToWholeBigPoints#1#2% +% \protected\def\PointsToWholeBigPoints#1#2% % {\edef#2{\the\numexpr\dimexpr.996264\dimexpr#1\relax\relax/\maxcard\relax}} % -% \unexpanded\def\ScaledPointsToBigPoints#1% % #2 +% \protected\def\ScaledPointsToBigPoints#1% % #2 % {\PointsToBigPoints{\number#1\scaledpoint}} % {#2} % -% \unexpanded\def\ScaledPointsToWholeBigPoints#1% % #2 +% \protected\def\ScaledPointsToWholeBigPoints#1% % #2 % {\PointsToWholeBigPoints{\number#1\scaledpoint}} % {#2} %D This is slower but cleaner and more accurate too. The only place these are still @@ -6834,10 +6834,10 @@ \let\tobigpoints \clf_tobigpoints \let\towholebigpoints\clf_towholebigpoints -\unexpanded\def\PointsToBigPoints #1#2{\edef#2{\tobigpoints #1}} % can be avoided -\unexpanded\def\PointsToWholeBigPoints #1#2{\edef#2{\towholebigpoints#1}} % can be avoided -\unexpanded\def\ScaledPointsToBigPoints #1#2{\edef#2{\tobigpoints #1\scaledpoint}} % obsolete -\unexpanded\def\ScaledPointsToWholeBigPoints#1#2{\edef#2{\towholebigpoints#1\scaledpoint}} % obsolete +\protected\def\PointsToBigPoints #1#2{\edef#2{\tobigpoints #1}} % can be avoided +\protected\def\PointsToWholeBigPoints #1#2{\edef#2{\towholebigpoints#1}} % can be avoided +\protected\def\ScaledPointsToBigPoints #1#2{\edef#2{\tobigpoints #1\scaledpoint}} % obsolete +\protected\def\ScaledPointsToWholeBigPoints#1#2{\edef#2{\towholebigpoints#1\scaledpoint}} % obsolete %D \macros %D {PointsToReal} @@ -6849,7 +6849,7 @@ %D \PointsToReal {dimension} \target %D \stoptyping -\unexpanded\def\PointsToReal#1#2% +\protected\def\PointsToReal#1#2% {\edef#2{\withoutpt\the\dimexpr#1}} %D \macros @@ -6884,7 +6884,7 @@ %D \starttyping %D \newbox\b_syst_helpers_dlh %D -%D \unexpanded\def\dontleavehmode +%D \protected\def\dontleavehmode %D {\ifhmode\else \ifmmode\else %D \setbox\b_syst_helpers_dlh\hbox{\mathsurround\zeropoint\everymath\emptytoks$ $}\unhbox\b_syst_helpers_dlh %D \fi \fi} @@ -6906,10 +6906,10 @@ %D %D The first argument may be a \type{\macro}. -% \unexpanded\def\uppercasestring#1\to#2% +% \protected\def\uppercasestring#1\to#2% % {\uppercase\expandafter{\expandafter\dodoglobal\expandafter\edef\expandafter#2\expandafter{\normalexpanded{#1}}}} % -% \unexpanded\def\lowercasestring#1\to#2% +% \protected\def\lowercasestring#1\to#2% % {\lowercase\expandafter{\expandafter\dodoglobal\expandafter\edef\expandafter#2\expandafter{\normalexpanded{#1}}}} %D These macros are sort of obsolete as we never use uppercase this way. But @@ -6918,8 +6918,8 @@ \def\utfupper#1{\clf_upper{#1}} % expandable \def\utflower#1{\clf_lower{#1}} % expandable -\unexpanded\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}} -\unexpanded\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}} +\protected\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}} +\protected\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}} %D \macros %D {handletokens} @@ -6964,14 +6964,14 @@ \expandafter\syst_helpers_count_token \fi} -\unexpanded\def\counttoken#1\in#2\to#3% +\protected\def\counttoken#1\in#2\to#3% {\privatescratchcounter\zerocount \def\m_syst_string_one{#1}% \def\m_syst_string_two{\end}% \syst_helpers_count_token#2\end \dodoglobal#3\privatescratchcounter} -\unexpanded\def\counttokens#1\to#2% +\protected\def\counttokens#1\to#2% {\privatescratchcounter\zerocount \def\syst_helpers_count_token##1{\advance\privatescratchcounter\plusone}% \handletokens#1\with\syst_helpers_count_token @@ -6983,7 +6983,7 @@ %D Running this one not always gives the expected results. Consider for instance the %D macro for which I originally wrote this token handler. -\unexpanded\def\splitofftokens#1\from#2\to#3% slow but hardly used +\protected\def\splitofftokens#1\from#2\to#3% slow but hardly used {\ifnum#1>\zerocount \privatescratchcounter#1\relax \def\syst_helpers_split_off_tokens##1% @@ -7027,7 +7027,7 @@ %D assignment, this time by using \type {\futurelet}, and grabbing an argument as %D well. That way we can handle the sentinal, a blank space and grouped tokens. -\unexpanded\def\syst_helpers_handle_tokens % \nexthandledtoken is part of interface +\protected\def\syst_helpers_handle_tokens % \nexthandledtoken is part of interface {\futurelet\nexthandledtoken\syst_helpers_handle_tokens_indeed} \def\handletokens#1\with#2% @@ -7079,8 +7079,8 @@ \newtoks\everysettrialtypesetting \newtoks\everyresettrialtypesetting -\unexpanded\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so -\unexpanded\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed +\protected\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so +\protected\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed \let\iftrialtypesetting\iffalse % so we have no \trialtypesettingtrue|false in mkiv ! @@ -7119,15 +7119,15 @@ %D This macro is first used in the tabulation macros. %D %D \starttyping -%D \unexpanded\def\starthans% +%D \protected\def\starthans% %D {\processcontent{stophans}\test{\message{\test}\wait}} %D \stoptyping -\unexpanded\def\processcontent#1% +\protected\def\processcontent#1% {\begingroup\expandafter\syst_helpers_process_content\csname#1\endcsname} -\unexpanded\def\syst_helpers_process_content#1#2#3% - {\unexpanded\def\syst_helpers_process_content##1#1% +\protected\def\syst_helpers_process_content#1#2#3% + {\protected\def\syst_helpers_process_content##1#1% {\endgroup\def#2{##1}#3}% \syst_helpers_process_content} @@ -7173,10 +7173,10 @@ %D As an alternative for the next macro we can use a global assignment inside a box. %D The \type {\empty}'s permits gobbling while preventing spurious \type {\relax}'s. -\unexpanded\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick +\protected\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick {\afterassignment\gobblefourarguments#1=#2#3pt\relax\empty\empty\empty\empty} -\unexpanded\def\freezedimensionwithunit#1#2% +\protected\def\freezedimensionwithunit#1#2% {\setdimensionwithunit\privatescratchdimen#1{#2}\edef#1{\the\privatescratchdimen}} %D \macros @@ -7184,7 +7184,7 @@ %D %D Not that fast I guess, but here's a way to test for token registers being empty. -\unexpanded\def\doifelsesometoks#1% +\protected\def\doifelsesometoks#1% {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok \ifx\m_syst_string_one\empty \expandafter\secondoftwoarguments @@ -7192,7 +7192,7 @@ \expandafter\firstoftwoarguments \fi} -\unexpanded\def\doifsometoks#1% +\protected\def\doifsometoks#1% {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument @@ -7200,7 +7200,7 @@ \expandafter\firstofoneargument \fi} -\unexpanded\def\doifemptytoks#1% +\protected\def\doifemptytoks#1% {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok \ifx\m_syst_string_one\empty \expandafter\firstofoneargument @@ -7224,7 +7224,7 @@ \expandafter\m_syst_action_nop \fi} -\unexpanded\def\strictdoifelsenextoptional#1#2% +\protected\def\strictdoifelsenextoptional#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% \futurelet\nexttoken\syst_helpers_strict_inspect_next_character} @@ -7273,7 +7273,7 @@ \def\syst_helpers_serialize_comma_list_step#1% {\edef\serializedcommalist{\serializedcommalist#1}} -\unexpanded\def\serializecommalist[#1]% +\protected\def\serializecommalist[#1]% {\let\serializedcommalist\empty \processcommacommand[#1]\syst_helpers_serialize_comma_list_step} @@ -7368,22 +7368,22 @@ \installsystemnamespace{measure} -\unexpanded\def\definemeasure +\protected\def\definemeasure {\dodoubleargument\syst_helpers_define_measure} \def\syst_helpers_define_measure[#1][#2]% {\expandafter\def\csname\??measure#1\endcsname{#2}} -\unexpanded\def\freezemeasure +\protected\def\freezemeasure {\dodoubleargument\syst_helpers_freeze_measure} \def\syst_helpers_freeze_measure[#1][#2]% {\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} -\unexpanded\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way -\unexpanded\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way -\unexpanded\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way -\unexpanded\def\setxmeasure#1#2{\expandafter\xdef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way +\protected\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way +\protected\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way +\protected\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way +\protected\def\setxmeasure#1#2{\expandafter\xdef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way \def\measure {\the\measured} @@ -7408,22 +7408,22 @@ \installsystemnamespace{quantity} -\unexpanded\def\definequantity +\protected\def\definequantity {\dodoubleargument\syst_helpers_define_quantity} \def\syst_helpers_define_quantity[#1][#2]% {\expandafter\def\csname\??quantity#1\endcsname{#2}} -\unexpanded\def\freezequantity +\protected\def\freezequantity {\dodoubleargument\syst_helpers_freeze_quantity} \def\syst_helpers_freeze_quantity[#1][#2]% {\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} -\unexpanded\def\setquantity #1#2{\expandafter\def \csname\??quantity#1\endcsname{#2}} % quick way -\unexpanded\def\setgquantity#1#2{\expandafter\gdef\csname\??quantity#1\endcsname{#2}} % quick way -\unexpanded\def\setequantity#1#2{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way -\unexpanded\def\setxquantity#1#2{\expandafter\xdef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way +\protected\def\setquantity #1#2{\expandafter\def \csname\??quantity#1\endcsname{#2}} % quick way +\protected\def\setgquantity#1#2{\expandafter\gdef\csname\??quantity#1\endcsname{#2}} % quick way +\protected\def\setequantity#1#2{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way +\protected\def\setxquantity#1#2{\expandafter\xdef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way \def\quantity {\the\quantitied} @@ -7577,19 +7577,19 @@ % \copycsname xxx\endcsname\csname ..\endcsname -\unexpanded\def\copycsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter\csname} +\protected\def\copycsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter\csname} % \letcscsname \crap \csname ..\endcsname % \letcsnamecs \csname ..\endcsname\crap % \letcsnamecsname\csname ..\endcsname\csname ..\endcsname -\unexpanded\def\letcscsname {\expandafter\let\expandafter} -\unexpanded\def\letcsnamecs {\expandafter\let} -\unexpanded\def\letcsnamecsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter} +\protected\def\letcscsname {\expandafter\let\expandafter} +\protected\def\letcsnamecs {\expandafter\let} +\protected\def\letcsnamecsname{\expandafter\expandafter\expandafter\let\expandafter\expandafter} % another one, add an item to a commalist -\unexpanded\def\addvalue#1#2% cs item +\protected\def\addvalue#1#2% cs item {\ifcsname#1\endcsname\else\expandafter\let\csname#1\endcsname\empty\fi \normalexpanded{\noexpand\addtocommalist{#2}\expandafter\noexpand\csname#1\endcsname}} @@ -7604,25 +7604,25 @@ \fi \syst_helpers_unspaced} -\unexpanded\def\unspaceargument#1\to#2% +\protected\def\unspaceargument#1\to#2% {\privatescratchcounter\catcode\spaceasciicode \catcode\spaceasciicode\ignorecatcode \scantextokens{\edef#2{#1}}% \catcode\spaceasciicode\privatescratchcounter} -\unexpanded\def\unspaceafter#1#2% +\protected\def\unspaceafter#1#2% {\unspaceargument#2\to\ascii \expandafter#1\expandafter{\ascii}} % sometimes handy: -\unexpanded\def\doifelsehasspace#1% +\protected\def\doifelsehasspace#1% {\edef\m_syst_string_one{#1}% \normalexpanded{\syst_helpers_if_has_space_else#1\space}\empty\relax} \let\doifhasspaceelse\doifelsehasspace -\unexpanded\def\syst_helpers_if_has_space_else#1 #2#3\relax % \space\empty\relax +\protected\def\syst_helpers_if_has_space_else#1 #2#3\relax % \space\empty\relax {\ifx\m_syst_string_one\space \expandafter\firstoftwoarguments \else\ifx#2\empty @@ -7635,8 +7635,8 @@ \installsystemnamespace{flag} -\unexpanded\def\setflag #1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\zerocount} -\unexpanded\def\resetflag#1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\plusone} +\protected\def\setflag #1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\zerocount} +\protected\def\resetflag#1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\plusone} \def\flag#1{\csname\??flag#1\endcsname} @@ -7660,7 +7660,7 @@ \doubleexpandafter\firstofoneargument \fi\fi} -\unexpanded\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey +\protected\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey {\expandafter\def\csname#1#3\expandafter\endcsname\expandafter{\csname#1#5\endcsname}} \def\syst_helpers_if_non_zero_positive_else#1#2\end % #3#4% @@ -7686,36 +7686,36 @@ % here ? -\unexpanded\def\dosetrawvalue #1#2#3{\expandafter \def\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawevalue#1#2#3{\expandafter\edef\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawgvalue#1#2#3{\expandafter\gdef\csname#1#2\endcsname{#3}} -\unexpanded\def\dosetrawxvalue#1#2#3{\expandafter\xdef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawvalue #1#2#3{\expandafter \def\csname#1#2\endcsname{#3}} +\protected\def\dosetrawevalue#1#2#3{\expandafter\edef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawgvalue#1#2#3{\expandafter\gdef\csname#1#2\endcsname{#3}} +\protected\def\dosetrawxvalue#1#2#3{\expandafter\xdef\csname#1#2\endcsname{#3}} -\unexpanded\def\getrawparameters {\dogetparameters\dosetrawvalue } -\unexpanded\def\getraweparameters {\dogetparameters\dosetrawevalue} -\unexpanded\def\getrawgparameters {\dogetparameters\dosetrawgvalue} -\unexpanded\def\getrawxparameters {\dogetparameters\dosetrawxvalue} +\protected\def\getrawparameters {\dogetparameters\dosetrawvalue } +\protected\def\getraweparameters {\dogetparameters\dosetrawevalue} +\protected\def\getrawgparameters {\dogetparameters\dosetrawgvalue} +\protected\def\getrawxparameters {\dogetparameters\dosetrawxvalue} -\unexpanded\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete +\protected\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete %D Sort of obsolete: \newcount\c_syst_helpers_mod -\unexpanded\def\dosetmodulo#1#2#3% +\protected\def\dosetmodulo#1#2#3% {\c_syst_helpers_mod#1\divide\c_syst_helpers_mod#2\multiply\c_syst_helpers_mod#2% #3#1\advance#3-\c_syst_helpers_mod} -\unexpanded\def\dosetdivision#1#2#3% +\protected\def\dosetdivision#1#2#3% {#3#1\divide#3 #2\relax} -\unexpanded\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}} -\unexpanded\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}} +\protected\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}} +\protected\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}} \def\syst_helpers_unprotected#1\par {#1\protect} -\unexpanded\def\unprotected +\protected\def\unprotected {\unprotect \syst_helpers_unprotected} @@ -7725,7 +7725,7 @@ \let\elapsedsteps\!!zerocount -\unexpanded\def\elapsedsteptime % unexpanded ! a bit useless but who knows ... +\protected\def\elapsedsteptime % unexpanded ! a bit useless but who knows ... {\clf_elapsedsteptime\elapsedsteps\relax} \newcount\c_syst_helpers_test_feature_n @@ -7733,7 +7733,7 @@ \def\currentfeaturetest{\number\c_syst_helpers_test_feature_n} -\unexpanded\def\testfeature#1#2% +\protected\def\testfeature#1#2% {\c_syst_helpers_test_feature_m#1\relax \xdef\elapsedsteps{\number\c_syst_helpers_test_feature_m}% \def\syst_helpers_test_feature_yes @@ -7748,7 +7748,7 @@ \fi}% \retestfeature} -\unexpanded\def\retestfeature % timer support is new per 10/5/2005 +\protected\def\retestfeature % timer support is new per 10/5/2005 {\bgroup \ifcase\interactionmode\let\wait\relax\fi \clf_resettimer @@ -7762,10 +7762,10 @@ \wait \egroup} -\unexpanded\def\showtimer#1% +\protected\def\showtimer#1% {\writestatus{runtime}{\elapsedseconds\space s / #1}} -\unexpanded\def\testfeatureonce#1#2% +\protected\def\testfeatureonce#1#2% {\begingroup \let\wait\relax \testfeature{#1}{#2}% @@ -7780,7 +7780,7 @@ %D \freezedimenmacro\leftmargindistance %D \stoptyping -\unexpanded\def\freezedimenmacro#1% +\protected\def\freezedimenmacro#1% {\edef#1{\the\dimexpr#1}} %D The next macro negates a macro (dimension or number, or actually, whatever. It's @@ -7798,17 +7798,17 @@ \def\assigndimen#1#2% {\afterassignment\gobbleassigndimen#1=#2\zeropoint\\} -\unexpanded\def\appended#1#2#3{\expandafter#1\expandafter#2\expandafter{#2#3}} -\unexpanded\def\appendvalue #1{\expandafter\appended\expandafter \def\csname#1\endcsname} -\unexpanded\def\appendgvalue#1{\expandafter\appended\expandafter\gdef\csname#1\endcsname} +\protected\def\appended#1#2#3{\expandafter#1\expandafter#2\expandafter{#2#3}} +\protected\def\appendvalue #1{\expandafter\appended\expandafter \def\csname#1\endcsname} +\protected\def\appendgvalue#1{\expandafter\appended\expandafter\gdef\csname#1\endcsname} -\unexpanded\def\prepended#1#2#3% +\protected\def\prepended#1#2#3% {\t_syst_helpers_scratch{#3}% \expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter#2\expandafter\expandafter\expandafter {\expandafter\the\expandafter\t_syst_helpers_scratch#2}} -\unexpanded\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname} -\unexpanded\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname} +\protected\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname} +\protected\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname} %D \macros %D {dowithrange} @@ -7830,11 +7830,11 @@ \ifx\m_syst_helpers_range_to\empty\let\m_syst_helpers_range_to\m_syst_helpers_range_from\fi \dostepwiserecurse\m_syst_helpers_range_from\m_syst_helpers_range_to\plusone{\m_helpers_range_action{##1}}}% -\unexpanded\def\processranges[#1]#2% #1= n:m,p,q:r +\protected\def\processranges[#1]#2% #1= n:m,p,q:r {\def\m_helpers_range_action{#2}% \processcommacommand[#1]\syst_helpers_with_range} -\unexpanded\def\dowithrange#1#2% +\protected\def\dowithrange#1#2% {\def\m_helpers_range_action{#2}% \processcommacommand[#1]\syst_helpers_with_range} @@ -7853,7 +7853,7 @@ %D %D \typebuffer \getbuffer -\unexpanded\def\ignoreimplicitspaces +\protected\def\ignoreimplicitspaces {\doifelsenextchar\relax\relax\relax} %D \macros @@ -7880,11 +7880,11 @@ \newbox\b_syst_helpers_no_interference -\unexpanded\def\startnointerference % not even grouped ! +\protected\def\startnointerference % not even grouped ! {\setbox\b_syst_helpers_no_interference\vbox \bgroup} -\unexpanded\def\stopnointerference +\protected\def\stopnointerference {\egroup \setbox\b_syst_helpers_no_interference\emptybox} @@ -7899,9 +7899,9 @@ %D Signal. Some fonts have a char0 rendering so we need to make sure that it is not %D set in the font! (This will be overloaded) -\unexpanded\def\signalcharacter{\char\zerocount} % \zwj +\protected\def\signalcharacter{\char\zerocount} % \zwj -% \unexpanded\def\signalcharacter +% \protected\def\signalcharacter % {\scratchcounter\normallanguage % \normallanguage\zerocount % \char\zerocount @@ -8067,7 +8067,7 @@ % {title} {\texdefinition{btx:apa:title-subtitle-type}} % {default} {\btxflush{author}} -% \unexpanded\def\doifcase#1% +% \protected\def\doifcase#1% % {\edef\m_case_asked{#1}% % \syst_aux_case} % @@ -8114,8 +8114,8 @@ %D Not that useful: -% \unexpanded\def\doifelsestringbefore{\clf_doifelsestringbefore} -% \unexpanded\def\doifelsestringafter {\clf_doifelsestringafter} +% \protected\def\doifelsestringbefore{\clf_doifelsestringbefore} +% \protected\def\doifelsestringafter {\clf_doifelsestringafter} % Could have been useful but not faster that addtocommalist and also expansion mess: % @@ -8123,30 +8123,30 @@ %D Experiment (sometimes looks nicer in code): -\unexpanded\def\sameargumentscondition#1#2% +\protected\def\sameargumentscondition#1#2% {\edef\m_syst_string_one{#1}% \edef\m_syst_string_two{#2}% \ifx\m_syst_string_one\m_syst_string_two} -\unexpanded\def\emptyargumentcondition#1% +\protected\def\emptyargumentcondition#1% {\edef\m_syst_string_one{#1}% \ifx\m_syst_string_one\empty} -% \unexpanded\def\hascommonargumentcondition#1#2{\clf_hascommonargumentcondition{#1}{#2}} +% \protected\def\hascommonargumentcondition#1#2{\clf_hascommonargumentcondition{#1}{#2}} % \let\hascommonargumentcondition \clf_hascommonargumentcondition -% \unexpanded\def\hascommonargumentcondition{\clf_hascommonargumentcondition} +% \protected\def\hascommonargumentcondition{\clf_hascommonargumentcondition} \protect \endinput % \edef\choicetokenyes{+} % \edef\choicetokennop{-} % -% \unexpanded\def\startchoice#1% +% \protected\def\startchoice#1% % {\pushmacro\currentchoicevalue % \edef\currentchoicevalue{#1}% % \checkchoicetoken} % -% \unexpanded\def\checkchoicetoken#1% +% \protected\def\checkchoicetoken#1% % {\edef\choicetoken{#1}% % \ifx\choicetoken\choicetokenyes % \singleexpandafter\checkchoiceyes @@ -8231,7 +8231,7 @@ % % \showvalue{mylist} -% \unexpanded\def\showtokenlist#1% +% \protected\def\showtokenlist#1% % {\begingroup % \edef\tempstring{\the#1}% % \tx\ttbf\string#1: \tttf\meaning\tempstring @@ -8241,7 +8241,7 @@ % % \chardef\_E_O_T_0 % -% \unexpanded\def\doifelsetokens#1% +% \protected\def\doifelsetokens#1% % {\dodoifelsetokens#1\_E_O_T_\_e_o_t_} % % \def\dodoifelsetokens#1#2\_e_o_t_ -- cgit v1.2.3