summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2022-08-05 17:44:39 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2022-08-05 17:44:39 +0200
commit178de9556e3cb519672f9b54db7b5b29eec43c69 (patch)
tree4a6131cbd880fdd2c613e9a372b8d661acd70f4d /doc
parent79db9f0bfc67ea8b4ed21d966e270f0adddfd8b8 (diff)
downloadcontext-178de9556e3cb519672f9b54db7b5b29eec43c69.tar.gz
2022-08-05 17:17:00
Diffstat (limited to 'doc')
-rw-r--r--doc/context/documents/general/manuals/onandon.pdfbin6602776 -> 2757973 bytes
-rw-r--r--doc/context/sources/general/manuals/onandon/onandon-expansion.tex72
-rw-r--r--doc/context/sources/general/manuals/onandon/onandon-fences.tex5
-rw-r--r--doc/context/sources/general/manuals/onandon/onandon.tex2
4 files changed, 71 insertions, 8 deletions
diff --git a/doc/context/documents/general/manuals/onandon.pdf b/doc/context/documents/general/manuals/onandon.pdf
index 029f83609..e9c6930b5 100644
--- a/doc/context/documents/general/manuals/onandon.pdf
+++ b/doc/context/documents/general/manuals/onandon.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/onandon/onandon-expansion.tex b/doc/context/sources/general/manuals/onandon/onandon-expansion.tex
index e20d7e192..a25b75246 100644
--- a/doc/context/sources/general/manuals/onandon/onandon-expansion.tex
+++ b/doc/context/sources/general/manuals/onandon/onandon-expansion.tex
@@ -75,6 +75,11 @@ the other with user defined conditions. The first one relates directly to
expansion, the second one concerns conditions and relates more to parsing
branches which on purpose avoids expansion.
+{\em In the meantime \LUAMETATEX\ has a slightly different implementation which
+goes under the umbrella \quote {local control}. We show both ways here. The
+example where two token lists are compared can be done easier with \type
+{\iftok}.}
+
For the first one I use some silly examples. I must admit that although I can
envision useful application, I really need to go over the large amount of
\CONTEXT\ source code to really find a place where it is making things better.
@@ -106,8 +111,14 @@ preventing look ahead interference by using a space or \tex {relax} (often an
expression works better as it doesn't leave an \tex {relax}).
\startbuffer
+% luatex
+
\def\TestMe{\immediateassignment\advance\NumberOfCalls1 }
+% luametatex
+
+\def\TestMe{\localcontrolled{\advance\NumberOfCalls1 }}
+
\edef\Tested{\TestMe bar:\the\NumberOfCalls}
\edef\Tested{\TestMe bar:\the\NumberOfCalls}
\edef\Tested{\TestMe bar:\the\NumberOfCalls}
@@ -126,7 +137,9 @@ Here is a somewhat silly example of an expanded comparison of two \quote
{strings}:
\startbuffer
-\def\expandeddoifelse#1#2#3#4%
+% luatex
+
+\def\ExpandedDoifElse#1#2#3#4%
{\immediateassignment\edef\tempa{#1}%
\immediateassignment\edef\tempb{#2}%
\ifx\tempa\tempb
@@ -136,9 +149,21 @@ Here is a somewhat silly example of an expanded comparison of two \quote
\fi
\next}
+% luametatex
+
+\def\ExpandedDoifElse#1#2#3#4%
+ {\localcontrolled{\edef\tempa{#1}}%
+ \localcontrolled{\edef\tempb{#2}}%
+ \ifx\tempa\tempb
+ \localcontrolled{\def\next{#3}}%
+ \else
+ \localcontrolled{\def\next{#4}}%
+ \fi
+ \next}
+
\edef\Tested
- {(\expandeddoifelse{abc}{def}{yes}{nop}/%
- \expandeddoifelse{abc}{abc}{yes}{nop})}
+ {(\ExpandedDoifElse{abc}{def}{yes}{nop}/%
+ \ExpandedDoifElse{abc}{abc}{yes}{nop})}
\meaning\Tested
\stopbuffer
@@ -162,7 +187,9 @@ In addition to this one|-|time immediate assignment a pseudo token list variant
is provided, so the above could be rewritten to:
\starttyping
-\def\expandeddoifelse#1#2#3#4%
+% luatex
+
+\def\ExpandedDoifElse#1#2#3#4%
{\immediateassigned {
\edef\tempa{#1}
\edef\tempb{#2}
@@ -173,6 +200,20 @@ is provided, so the above could be rewritten to:
\immediateassignment\def\next{#4}%
\fi
\next}
+
+% luametatex
+
+\def\ExpandedDoifElse#1#2#3#4%
+ {\beginlocalcontrol
+ \edef\tempa{#1}
+ \edef\tempb{#2}
+ \endlocalcontrol
+ \ifx\tempa\tempb
+ \localcontrolled{\def\next{#3}}%
+ \else
+ \localcontrolled{\def\next{#4}}%
+ \fi
+ \next}
\stoptyping
While \tex {expanded} first builds a token lists that then gets used, the \tex
@@ -261,18 +302,35 @@ previously mentioned immediate assignment. Here is another example:
The previously defined comparison macro can now be rewritten as:
\starttyping
-\def\equaltokens#1#2%
+% luatex
+
+\def\EqualTokens#1#2%
{\immediateassignment\edef\tempa{#1}%
\immediateassignment\edef\tempb{#2}%
\ifx\tempa\tempb}
-\def\expandeddoifelse#1#2#3#4%
- {\ifcondition\equaltokens{#1}{#2}%
+\def\ExpandedDoifElse#1#2#3#4%
+ {\ifcondition\EqualTokens{#1}{#2}%
\immediateassignment\def\next{#3}%
\else
\immediateassignment\def\next{#4}%
\fi
\next}
+
+% luametatex
+
+\def\EqualTokens#1#2%
+ {\localcontrolled{\edef\tempa{#1}}%
+ \localcontrolled{\edef\tempb{#2}}%
+ \ifx\tempa\tempb}
+
+\def\ExpandedDoifElse#1#2#3#4%
+ {\ifcondition\EqualTokens{#1}{#2}%
+ \localcontrolled{\def\next{#3}}%
+ \else
+ \localcontrolled{\def\next{#4}}%
+ \fi
+ \next}
\stoptyping
When used this way it will of course also work without the \tex {ifcondition} but
diff --git a/doc/context/sources/general/manuals/onandon/onandon-fences.tex b/doc/context/sources/general/manuals/onandon/onandon-fences.tex
index ff50ebe5e..76ade938e 100644
--- a/doc/context/sources/general/manuals/onandon/onandon-fences.tex
+++ b/doc/context/sources/general/manuals/onandon/onandon-fences.tex
@@ -1,5 +1,10 @@
% language=us
+% This feature has been removed because we have different control now in the
+% reworked engine so this chapter cnanot be processed any longer.
+
+\endinput
+
\startcomponent onandon-fences
\environment onandon-environment
diff --git a/doc/context/sources/general/manuals/onandon/onandon.tex b/doc/context/sources/general/manuals/onandon/onandon.tex
index 3b6f22cf9..7ea81205d 100644
--- a/doc/context/sources/general/manuals/onandon/onandon.tex
+++ b/doc/context/sources/general/manuals/onandon/onandon.tex
@@ -39,7 +39,7 @@
\component onandon-emoji
\component onandon-performance
\component onandon-editing
- \component onandon-fences % first published in user group magazines
+ % \component onandon-fences % first published in user group magazines / obsolete
\component onandon-media
\component onandon-53 % first published in user group magazines
\component onandon-execute % first published in user group magazines