diff options
Diffstat (limited to 'tex/context/base/mkiv/syst-aux.mkxl')
-rw-r--r-- | tex/context/base/mkiv/syst-aux.mkxl | 123 |
1 files changed, 53 insertions, 70 deletions
diff --git a/tex/context/base/mkiv/syst-aux.mkxl b/tex/context/base/mkiv/syst-aux.mkxl index b94bc285c..9ae18ab71 100644 --- a/tex/context/base/mkiv/syst-aux.mkxl +++ b/tex/context/base/mkiv/syst-aux.mkxl @@ -395,17 +395,6 @@ %D As we will see, \CONTEXT\ uses these commands many times, which is mainly due to %D its object oriented and parameter driven character. -% \def\setvalue #1{\expandafter\def \csname#1\endcsname} -% \def\setgvalue #1{\expandafter\gdef\csname#1\endcsname} -% \def\setevalue #1{\expandafter\edef\csname#1\endcsname} -% \def\setxvalue #1{\expandafter\xdef\csname#1\endcsname} -% \def\getvalue #1{\csname#1\endcsname} % maybe: \begincsname#1\endcsname -% \def\letvalue #1{\expandafter\let \csname#1\endcsname} -% \def\letgvalue #1{\expandafter\glet\csname#1\endcsname} -% \def\resetvalue #1{\expandafter\let \csname#1\endcsname\empty} -% \def\undefinevalue#1{\expandafter\let \csname#1\endcsname\undefined} -% \def\ignorevalue#1#2{\expandafter\let \csname#1\endcsname\empty} - \def\setvalue #1{\expandafter\defcsname#1\endcsname} \def\setgvalue #1{\global\defcsname#1\endcsname} \def\setevalue #1{\edefcsname#1\endcsname} @@ -417,11 +406,6 @@ \def\undefinevalue#1{\letcsname#1\endcsname\undefined} \def\ignorevalue#1#2{\letcsname#1\endcsname\empty} -% \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} - \def\setuvalue #1{\protected\defcsname#1\endcsname} \def\setuevalue #1{\protected\edefcsname#1\endcsname} \def\setugvalue #1{\protected\global\defcsname#1\endcsname} @@ -508,13 +492,13 @@ %D existance is not the same as the one described here. Therefore we introduce: \protected\def\letbeundefined#1% - {\expandafter\let\csname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue + {\letcsname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue \protected\def\localundefine#1% conditional - {\ifcsname#1\endcsname\expandafter\let\csname#1\endcsname\undefined\fi} + {\ifcsname#1\endcsname\letcsname#1\endcsname\undefined\fi} \protected\def\globalundefine#1% conditional - {\ifcsname#1\endcsname\expandafter\glet\csname#1\endcsname\undefined\fi} + {\ifcsname#1\endcsname\global\letcsname#1\endcsname\undefined\fi} %D Beware, being \type {\undefined} in \ETEX\ means that the macro {\em is} defined! %D @@ -1452,12 +1436,12 @@ %D These macros are in fact auxiliary ones and are not meant for use outside the %D assignment macros. -\def\dosetvalue #1#2{\expandafter\def \csname#1#2\endcsname} % takes #3 -\def\dosetevalue #1#2{\expandafter\edef\csname#1#2\endcsname} % takes #3 -\def\dosetgvalue #1#2{\expandafter\gdef\csname#1#2\endcsname} % takes #3 -\def\doresetvalue #1#2{\expandafter\let \csname#1#2\endcsname\empty} -\def\doignorevalue#1#2#3{\expandafter\let \csname#1#2\endcsname\empty} -\def\docopyvalue #1#2#3{\expandafter\def \csname#1#3\endcsname{\csname#2#3\endcsname}} +\def\dosetvalue #1#2{\defcsname #1#2\endcsname} % takes #3 +\def\dosetevalue #1#2{\edefcsname #1#2\endcsname} % takes #3 +\def\dosetgvalue #1#2{\global\edefcsname#1#2\endcsname} % takes #3 +\def\doresetvalue #1#2{\letcsname #1#2\endcsname\empty} +\def\doignorevalue#1#2#3{\letcsname #1#2\endcsname\empty} +\def\docopyvalue #1#2#3{\defcsname #1#3\endcsname{\csname#2#3\endcsname}} %D \macros %D {doassign,undoassign,doassignempty} @@ -1697,23 +1681,23 @@ {\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#2}}% ##1 \processcommalist[#3]\syst_helpers_copy_parameter}} -%D \macros -%D {ifparameters,checkparameters} -%D -%D A slightly different one is \type {\checkparameters}, which also checks on the -%D presence of a~\type {=}. -%D -%D The boolean \type {\ifparameters} can be used afterwards. Combining both in one -%D \type {\if}||macro would lead to problems with nested \type {\if}'s. -%D -%D \starttyping -%D \checkparameters[argument] -%D \stoptyping - -\newif\ifparameters - -\protected\def\checkparameters[#1]% - {\ifhastok={#1}\parameterstrue\else\parametersfalse\fi} +% %D \macros +% %D {ifparameters,checkparameters} +% %D +% %D A slightly different one is \type {\checkparameters}, which also checks on the +% %D presence of a~\type {=}. +% %D +% %D The boolean \type {\ifparameters} can be used afterwards. Combining both in one +% %D \type {\if}||macro would lead to problems with nested \type {\if}'s. +% %D +% %D \starttyping +% %D \checkparameters[argument] +% %D \stoptyping +% +% \newif\ifparameters +% +% \protected\def\checkparameters[#1]% +% {\ifhastok={#1}\parameterstrue\else\parametersfalse\fi} %D \macros %D {getfromcommalist,getfromcommacommand, @@ -2772,14 +2756,14 @@ \protected\def\letempty #1{\let #1\empty} \protected\def\globalletempty#1{\glet#1\empty} -\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} +\protected\def\letvalueempty #1{\letcsname #1\endcsname\empty} +\protected\def\letgvalueempty#1{\global\letcsname#1\endcsname\empty} +\protected\def\letvaluerelax #1{\letcsname #1\endcsname\relax} +\protected\def\letgvalurelax #1{\global\letcsname#1\endcsname\relax} \protected\def\relaxvalueifundefined#1% {\ifcsname#1\endcsname \else - \expandafter\let\csname#1\endcsname\relax + \letcsname#1\endcsname\relax \fi} %D \macros @@ -2848,7 +2832,7 @@ \def\syst_helpers_grab_raw_parameter#1=#2,% {\ifarguments\or\or - \expandafter\def\csname\m_syst_parameter_n#1\endcsname{#2}% + \defcsname\m_syst_parameter_n#1\endcsname{#2}% \expandafter\syst_helpers_grab_raw_parameter_next \fi} @@ -3086,7 +3070,7 @@ \protected\def\savenormalmeaning#1% {\ifcsname normal\csstring#1\endcsname \else - \expandafter\let\csname normal\csstring#1\endcsname#1% + \letcsname normal\csstring#1\endcsname#1% \fi} %D \macros @@ -5378,7 +5362,6 @@ \def\executeifdefined#1% #2 / never change this one again {\ifcsname#1\endcsname - % \csname#1\expandafter\expandafter\expandafter\endcsname\expandafter\gobbleoneargument \expandafter\expandafter\expandafter\lastnamedcs\expandafter\gobbleoneargument \else \expandafter\firstofoneargument @@ -6094,13 +6077,13 @@ \installsystemnamespace{measure} -\permanent\tolerant\protected\def\definemeasure[#1]#*[#2]{\expandafter \def\csname\??measure#1\endcsname{#2}} -\permanent\tolerant\protected\def\freezemeasure[#1]#*[#2]{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} +\permanent\tolerant\protected\def\definemeasure[#1]#*[#2]{\defcsname \??measure#1\endcsname{#2}} +\permanent\tolerant\protected\def\freezemeasure[#1]#*[#2]{\edefcsname\??measure#1\endcsname{\the\dimexpr#2}} -\permanent\protected\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way -\permanent\protected\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way -\permanent\protected\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way -\permanent\protected\def\setxmeasure#1#2{\expandafter\xdef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way +\permanent\protected\def\setmeasure #1#2{\defcsname \??measure#1\endcsname{#2}} % quick way +\permanent\protected\def\setgmeasure#1#2{\global\defcsname \??measure#1\endcsname{#2}} % quick way +\permanent\protected\def\setemeasure#1#2{\edefcsname \??measure#1\endcsname{\the\dimexpr#2}} % quick way +\permanent\protected\def\setxmeasure#1#2{\global\edefcsname\??measure#1\endcsname{\the\dimexpr#2}} % quick way \permanent\def\measure {\the\measured} \permanent\def\measured#1{\dimexpr\ifcsname\??measure#1\endcsname\lastnamedcs\else\zeropoint\fi\relax} @@ -6118,13 +6101,13 @@ \installsystemnamespace{quantity} -\permanent\tolerant\protected\def\definequantity[#1]#*[#2]{\expandafter\def \csname\??quantity#1\endcsname{#2}} -\permanent\tolerant\protected\def\freezequantity[#1]#*[#2]{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} +\permanent\tolerant\protected\def\definequantity[#1]#*[#2]{\defcsname \??quantity#1\endcsname{#2}} +\permanent\tolerant\protected\def\freezequantity[#1]#*[#2]{\edefcsname\??quantity#1\endcsname{\the\numexpr#2}} -\permanent\protected\def\setquantity #1#2{\expandafter\def \csname\??quantity#1\endcsname{#2}} % quick way -\permanent\protected\def\setgquantity#1#2{\expandafter\gdef\csname\??quantity#1\endcsname{#2}} % quick way -\permanent\protected\def\setequantity#1#2{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way -\permanent\protected\def\setxquantity#1#2{\expandafter\xdef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way +\permanent\protected\def\setquantity #1#2{\defcsname \??quantity#1\endcsname{#2}} % quick way +\permanent\protected\def\setgquantity#1#2{\global\defcsname \??quantity#1\endcsname{#2}} % quick way +\permanent\protected\def\setequantity#1#2{\edefcsname \??quantity#1\endcsname{\the\numexpr#2}} % quick way +\permanent\protected\def\setxquantity#1#2{\global\edefcsname\??quantity#1\endcsname{\the\numexpr#2}} % quick way \permanent\def\quantity {\the\quantitied} \permanent\def\quantitied #1{\numexpr\ifcsname\??quantity#1\endcsname\lastnamedcs\else\zeropoint\fi\relax} @@ -6229,7 +6212,7 @@ % another one, add an item to a commalist \permanent\protected\def\addvalue#1#2% cs item - {\ifcsname#1\endcsname\else\expandafter\let\csname#1\endcsname\empty\fi + {\ifcsname#1\endcsname\else\letcsname#1\endcsname\empty\fi \normalexpanded{\addtocommalist{#2}\expandafter\noexpand\csname#1\endcsname}} %D Are these ever used? Anyway, these variants are somewhat more efficient than @@ -6266,8 +6249,8 @@ \installsystemnamespace{flag} -\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} +\protected\def\setflag #1{\dodoglobal\letcsname\??flag#1\endcsname\zerocount} +\protected\def\resetflag#1{\dodoglobal\letcsname\??flag#1\endcsname\plusone} \def\flag#1{\csname\??flag#1\endcsname} @@ -6292,7 +6275,7 @@ \fi} \protected\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey - {\expandafter\def\csname#1#3\expandafter\endcsname\expandafter{\csname#1#5\endcsname}} + {\defcsname#1#3\expandafter\endcsname\expandafter{\csname#1#5\endcsname}} \def\syst_helpers_if_non_zero_positive_else#1#2\end % #3#4% {\ifx#1\relax @@ -6317,10 +6300,10 @@ % here ? -\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}} +\protected\def\dosetrawvalue #1#2#3{\defcsname #1#2\endcsname{#3}} +\protected\def\dosetrawevalue#1#2#3{\edefcsname #1#2\endcsname{#3}} +\protected\def\dosetrawgvalue#1#2#3{\global\defcsname #1#2\endcsname{#3}} +\protected\def\dosetrawxvalue#1#2#3{\global\edefcsname#1#2\endcsname{#3}} \protected\def\getrawparameters {\dogetparameters\dosetrawvalue } \protected\def\getraweparameters {\dogetparameters\dosetrawevalue} |