summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/syst-aux.mkxl
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-10-24 22:24:55 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-10-24 22:24:55 +0200
commita23982bf3c6cc3c7e34c89a67004e2ef4c6103eb (patch)
treec555edf1938a2779764b257555e52364272f94bc /tex/context/base/mkxl/syst-aux.mkxl
parent29a395d2b545159c97df693e59187ce61218233c (diff)
downloadcontext-a23982bf3c6cc3c7e34c89a67004e2ef4c6103eb.tar.gz
2021-10-24 21:44:00
Diffstat (limited to 'tex/context/base/mkxl/syst-aux.mkxl')
-rw-r--r--tex/context/base/mkxl/syst-aux.mkxl25
1 files changed, 25 insertions, 0 deletions
diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl
index c9bed105f..278926582 100644
--- a/tex/context/base/mkxl/syst-aux.mkxl
+++ b/tex/context/base/mkxl/syst-aux.mkxl
@@ -3219,6 +3219,31 @@
#2\expandafter\doexpandedrecurse\expandafter{\the\numexpr#1-\plusone\relax}{#2}%
\fi}
+%D The next one might replace the above and provides the current step in \type {#1}
+%D like \type {\dorecurse} do, but it comes with a tiny performance hit.
+
+\installsystemnamespace{expandedrecurse}
+
+\mutable\let\m_expanded_recursed\gobbleoneargument
+
+\permanent\def\doexpandedrecursed#1#2% this might replace: \doexpandedrecurse
+ {\beginlocalcontrol
+ \localpushmacro\m_expanded_recursed
+ \def\m_expanded_recursed##1{#2}%
+ \endlocalcontrol
+ \syst_do_expanded_recursed{1}{#1}{#2}% no \plusone !
+ \beginlocalcontrol
+ \localpopmacro\m_expanded_recursed
+ \endlocalcontrol}
+
+\def\syst_do_expanded_recursed#1#2#3%
+ {\ifnum#1>#2\norelax
+ \expandafter\gobblethreearguments
+ \else
+ \m_expanded_recursed{#1}\doubleexpandafter\syst_do_expanded_recursed
+ \fi
+ {\the\numexpr#1+\plusone\relax}{#2}{#3}}
+
%D As we can see here, the simple command \type{\dorecurse} is a special case of the
%D more general:
%D