summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/attr-ini.mkxl4
-rw-r--r--tex/context/base/mkiv/bibl-tra.mkiv10
-rw-r--r--tex/context/base/mkiv/buff-ver.mkxl14
-rw-r--r--tex/context/base/mkiv/chem-str.mkxl224
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl10
-rw-r--r--tex/context/base/mkiv/font-sty.mklx6
-rw-r--r--tex/context/base/mkiv/grph-trf.mkiv17
-rw-r--r--tex/context/base/mkiv/grph-trf.mkxl1011
-rw-r--r--tex/context/base/mkiv/lang-url.mkiv26
-rw-r--r--tex/context/base/mkiv/lang-url.mkxl167
-rw-r--r--tex/context/base/mkiv/math-frc.mkxl89
-rw-r--r--tex/context/base/mkiv/mult-aux.mkxl18
-rw-r--r--tex/context/base/mkiv/pack-rul.mkxl18
-rw-r--r--tex/context/base/mkiv/spac-hor.mkxl4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin29222 -> 29189 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin267591 -> 256569 bytes
-rw-r--r--tex/context/base/mkiv/strc-con.mklx4
-rw-r--r--tex/context/base/mkiv/strc-des.mklx6
-rw-r--r--tex/context/base/mkiv/strc-doc.mkxl45
-rw-r--r--tex/context/base/mkiv/strc-enu.mklx12
-rw-r--r--tex/context/base/mkiv/strc-itm.mklx6
-rw-r--r--tex/context/base/mkiv/strc-lab.mkxl8
-rw-r--r--tex/context/base/mkiv/strc-sec.mkxl4
-rw-r--r--tex/context/base/mkiv/supp-dir.mkiv51
-rw-r--r--tex/context/base/mkiv/supp-dir.mkxl54
-rw-r--r--tex/context/base/mkiv/syst-aux.mkxl860
-rw-r--r--tex/context/base/mkiv/tabl-xtb.mklx14
-rw-r--r--tex/context/base/mkiv/trac-vis.mkxl44
-rw-r--r--tex/context/modules/mkiv/m-scite.mkiv9
-rw-r--r--tex/context/modules/mkiv/s-system-macros.mkxl76
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
35 files changed, 2066 insertions, 755 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 04af96a54..4dd19224c 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2020.11.05 15:20}
+\newcontextversion{2020.11.05 22:57}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index 369951155..1a3cd5512 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.11.05 15:20}
+\edef\contextversion{2020.11.05 22:57}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/attr-ini.mkxl b/tex/context/base/mkiv/attr-ini.mkxl
index 14d77ec89..47e680c25 100644
--- a/tex/context/base/mkiv/attr-ini.mkxl
+++ b/tex/context/base/mkiv/attr-ini.mkxl
@@ -60,8 +60,8 @@
{\ifcsname\??attributeprefix#2\endcsname\else
\scratchcounter\clf_defineattribute{#2}{#1}\relax
%\writestatus\m!system{defining #1 attribute #2 with number \number\scratchcounter}%
- \global\expandafter\attributedef\csname\??attributeprefix#2\endcsname\scratchcounter % \foo = 123
- \global\expandafter\integerdef \csname\??attributeid #2\endcsname\scratchcounter % \attribute\foo = 123
+ \global\permanent\expandafter\attributedef\csname\??attributeprefix#2\endcsname\scratchcounter % \foo = 123
+ \global\permanent\expandafter\integerdef \csname\??attributeid #2\endcsname\scratchcounter % \attribute\foo = 123
% some attributes are always global
\doifelseinset\s!global{#3}%
{\xtoksapp\t_attr_list_global{\csname\??attributeprefix#2\endcsname\attributeunsetvalue}}% \c_attr_foo
diff --git a/tex/context/base/mkiv/bibl-tra.mkiv b/tex/context/base/mkiv/bibl-tra.mkiv
index eebd92d68..a80a22933 100644
--- a/tex/context/base/mkiv/bibl-tra.mkiv
+++ b/tex/context/base/mkiv/bibl-tra.mkiv
@@ -1152,9 +1152,13 @@
%D edef, and the \type{\robustdoifinsetelse} doesn't listen to
%D \type{\doglobal }
-\unexpanded\def\robustaddtocommalist#1#2% {item} \cs
- {\robustdoifelseinset{#1}#2\resetglobal
- {\dodoglobal\xdef#2{\ifx#2\empty\else#2,\fi#1}}}
+\pushoverloadmode
+
+ \unexpanded\def\robustaddtocommalist#1#2% {item} \cs
+ {\robustdoifelseinset{#1}#2\resetglobal
+ {\dodoglobal\xdef#2{\ifx#2\empty\else#2,\fi#1}}}
+
+\popoverloadmode
%D \macros{donormalbibauthoryear}
%D
diff --git a/tex/context/base/mkiv/buff-ver.mkxl b/tex/context/base/mkiv/buff-ver.mkxl
index db8b62b64..48a496fce 100644
--- a/tex/context/base/mkiv/buff-ver.mkxl
+++ b/tex/context/base/mkiv/buff-ver.mkxl
@@ -148,7 +148,7 @@
\installcommandhandler \??type {type} \??type
\appendtoks
- \setuevalue{\currenttype}{\buff_verbatim_type{\currenttype}}%
+ \frozen\instance\setuevalue{\currenttype}{\buff_verbatim_type{\currenttype}}%
\to \everydefinetype
\appendtoks
@@ -176,8 +176,8 @@
\installcommandhandler \??typing {typing} \??typing
\appendtoks
- \setuevalue{\e!start\currenttyping}{\buff_verbatim_typing_start{\currenttyping}}%
- \setuevalue{\e!stop \currenttyping}{\buff_verbatim_typing_stop {\currenttyping}}%
+ \frozen\instance\setuevalue{\e!start\currenttyping}{\buff_verbatim_typing_start{\currenttyping}}%
+ \frozen\instance\setuevalue{\e!stop \currenttyping}{\buff_verbatim_typing_stop {\currenttyping}}%
\ifempty\currenttypingparent
\normalexpanded{\definelinenumbering[\currenttyping]}%
\else
@@ -578,7 +578,7 @@
% [category] [settings] {name} % for historic reasons, all filenames are {}
\appendtoks
- \setuevalue{\e!type\currenttyping\v!file}{\typefile[\currenttyping]}%
+ \frozen\instance\setuevalue{\e!type\currenttyping\v!file}{\typefile[\currenttyping]}%
\to \everydefinetyping
\permanent\tolerant\protected\def\typefile[#1]#*[#2]#:#3%
@@ -767,11 +767,11 @@
{\buff_verbatim_type_defined_buffer[\v!buffer][\thedefinedbuffer{#1}]}%
\appendtoks
- \setuevalue{\e!type\currentbuffer}{\buff_verbatim_type_defined_buffer[\v!buffer][\currentdefinedbuffer]}%
+ \frozen\instance\setuevalue{\e!type\currentbuffer}{\buff_verbatim_type_defined_buffer[\v!buffer][\currentdefinedbuffer]}%
\to \everydefinebuffer
\appendtoks % \e!buffer
- \setuevalue{\e!type\currenttyping\v!buffer}{\buff_verbatim_type_buffer_class{\currenttyping}}%
+ \frozen\instance\setuevalue{\e!type\currenttyping\v!buffer}{\buff_verbatim_type_buffer_class{\currenttyping}}%
\to \everydefinetyping
\tolerant\protected\def\buff_verbatim_type_buffer[#1]#*[#2]%
@@ -975,7 +975,7 @@
% \installcommandhandler \??visualizer {visualizer} \??visualizer
%
% \appendtoks
-% \setuevalue{\currentvisualizer}{\buff_verbatim_visualize{\currentvisualizer}}%
+% \frozen\instance\setuevalue{\currentvisualizer}{\buff_verbatim_visualize{\currentvisualizer}}%
% \to \everydefinevisualizer
%
% \protected\def\buff_verbatim_visualize#1%
diff --git a/tex/context/base/mkiv/chem-str.mkxl b/tex/context/base/mkiv/chem-str.mkxl
index 036b1f5da..29b112c0e 100644
--- a/tex/context/base/mkiv/chem-str.mkxl
+++ b/tex/context/base/mkiv/chem-str.mkxl
@@ -59,8 +59,8 @@
% \installsimplecommandhandler \??chemical {chemical} \??chemical % no \define...
\installcommandhandler \??chemical {chemical} \??chemical % no \define...
-\let\setupchemicals \setupchemical
-\let\definechemicals\definechemical
+\aliased\let\setupchemicals \setupchemical
+\aliased\let\definechemicals\definechemical
%D We use a dedicated framed macro instead of inheriting one. This is both
%D a historical and practical reason (like shared keys with different meaning
@@ -82,35 +82,29 @@
[\c!align=\v!normal,
\c!strut=\v!no]
-\unexpanded\def\setupchemicalframed
+\permanent\protected\def\setupchemicalframed
{\setupframed[\??chemicalframed]}
-\unexpanded\overloaded\def\definechemical % is global (so we don't use the commandhandler)
+\permanent\protected\overloaded\def\definechemical % is global (so we don't use the commandhandler)
{\dosingleargument\chem_define}
\def\chem_define[#1]#2%
{\startnointerference
\edef\currentdefinedchemical{#1}%
- \let\chemical\chem_chemical_nested
+ \enforced\let\chemical\chem_chemical_nested
\clf_undefinechemical{#1}%
#2% flush
\stopnointerference}
-\unexpanded\def\chem_chemical_nested
- {\dodoubleempty\chem_chemical_nested_indeed}
-
-\def\chem_chemical_nested_indeed[#1][#2]%
+\permanent\tolerant\protected\def\chem_chemical_nested[#1]#*[#2]%
{\clf_definechemical{\currentdefinedchemical}{#1}{\detokenize{#2}}}
% chemical symbols
-\unexpanded\def\definechemicalsymbol
- {\dodoubleempty\chem_symbol_define}
-
-\def\chem_symbol_define[#1][#2]%
- {\setvalue{\??chemicalsymbol#1}{#2}}
+\permanent\tolerant\protected\def\definechemicalsymbol[#1]#*[#2]%
+ {\ifarguments\else\setvalue{\??chemicalsymbol#1}{#2}\fi}
-\unexpanded\def\chemicalsymbol[#1]%
+\permanent\protected\def\chemicalsymbol[#1]%
{\csname\??chemicalsymbol\ifcsname\??chemicalsymbol#1\endcsname#1\else\s!unknown\fi\endcsname}
\definechemicalsymbol[\s!unknown][] % \char"FFFD empty
@@ -120,7 +114,7 @@
\edef\chemicaltoplocation{t}
\edef\chemicalbotlocation{b}
-\unexpanded\def\chemicaltext#1%
+\permanent\protected\def\chemicaltext#1%
{\mathematics
{\usechemicalstyleandcolor\c!style\c!color
\strut
@@ -133,7 +127,7 @@
\newtoks \everychemical
\newtoks \everystructurechemical
-\newconditional\indisplaychemical
+%newconditional\indisplaychemical
\newtoks \t_chem_every_box
\newbox \b_chem_result
@@ -142,25 +136,26 @@
\newdimen \d_chem_height
\newdimen \d_chem_depth
-\unexpanded\def\startchemical
- {\dodoubleempty\chem_start}
-
-\def\chem_start[#1][#2]%
+\permanent\tolerant\protected\def\startchemical[#1]#*[#2]%
{\ifmmode\vcenter\else\vbox\fi % vpack ?
\bgroup
\synchronizestrut{\chemicalparameter\c!strut}%
\dontcomplain
- \settrue\indisplaychemical
+ %\settrue\indisplaychemical
\forgetall
- \ifsecondargument
- \doifelseassignment{#1}
- {\setupcurrentchemical[#1]}% same as \currentchemical
- {\edef\currentchemical{#1}%
- \setupcurrentchemical[#2]}%
- \orelse\iffirstargument
- \doifelseassignment{#1}
- {\setupcurrentchemical[#1]}% same as \currentchemical
- {\edef\currentchemical{#1}}%
+ \ifparameter#2\or
+ \ifhastok={#1}%
+ \setupcurrentchemical[#1]% same as \currentchemical
+ \else
+ \edef\currentchemical{#1}%
+ \setupcurrentchemical[#2]%
+ \fi
+ \orelse\ifparameter#1\or
+ \ifhastok={#1}%
+ \setupcurrentchemical[#1]% same as \currentchemical
+ \else
+ \edef\currentchemical{#1}%
+ \fi
\fi
\the\everystructurechemical
\setbox\b_chem_result\hpack\bgroup
@@ -183,7 +178,7 @@
\relax
\startnointerference}
-\unexpanded\def\stopchemical
+\permanent\protected\def\stopchemical
{\stopnointerference
\clf_stopchemical
\egroup
@@ -194,7 +189,7 @@
\doifelsenothing{\chemicalparameter\c!frame}\chem_framed_nop\chem_framed_yes
\egroup}
-\unexpanded\def\chem_framed_yes
+\protected\def\chem_framed_yes
{\localframedwithsettings
[\??chemicalframed]%
[\c!frame=\chemicalparameter\c!frame,
@@ -202,21 +197,21 @@
\c!framecolor=\chemicalparameter\c!framecolor]%
{\vpack{\box\b_chem_result\vss}}} % remove depth
-\unexpanded\def\chem_framed_nop
+\protected\def\chem_framed_nop
{\directlocalframed
[\??chemicalframed]%
{\vpack{\box\b_chem_result\vss}}} % remove depth
-\let\startstructurechemical\startchemical
-\let\stopstructurechemical \stopchemical
-
-\unexpanded\def\structurechemical
- {\dotripleempty\strc_chem_indeed}
+\aliased\let\startstructurechemical\startchemical
+\aliased\let\stopstructurechemical \stopchemical
\appendtoks
- \let\chemical\structurechemical
+ \enforced\let\chemical\structurechemical
\to\everystructurechemical
+\protected\def\structurechemical
+ {\dotripleempty\strc_chem_indeed}
+
\def\strc_chem_indeed
{\ifthirdargument
\expandafter\strc_chem_indeed_three
@@ -234,7 +229,7 @@
\relax
\ignorespaces}
-\def\strc_chem_indeed_two[#1][#2]%
+\def\strc_chem_indeed_two[#1][#2]% why no [#3] here
{\clf_chemicalcomponent
{#1}%
{\detokenize{#2}}%
@@ -261,14 +256,14 @@
% \to \everystructurechemical
\to \everychemical
-\def\chemicaltoptext#1{\global\settrue\c_chem_some_text\gdef\m_chem_top_text{#1}\ignorespaces}
-\def\chemicalbottext#1{\global\settrue\c_chem_some_text\gdef\m_chem_bot_text{#1}\ignorespaces}
-\def\chemicalmidtext#1{\global\settrue\c_chem_some_text\gdef\m_chem_mid_text{#1}\ignorespaces}
+\permanent\protected\def\chemicaltoptext#1{\global\settrue\c_chem_some_text\gdef\m_chem_top_text{#1}\ignorespaces}
+\permanent\protected\def\chemicalbottext#1{\global\settrue\c_chem_some_text\gdef\m_chem_bot_text{#1}\ignorespaces}
+\permanent\protected\def\chemicalmidtext#1{\global\settrue\c_chem_some_text\gdef\m_chem_mid_text{#1}\ignorespaces}
\appendtoks
- \let\toptext\chemicaltoptext \glet\m_chem_top_text\empty
- \let\bottext\chemicalbottext \glet\m_chem_bot_text\empty
- \let\midtext\chemicalmidtext \glet\m_chem_mid_text\empty
+ \enforced\let\toptext\chemicaltoptext \glet\m_chem_top_text\empty
+ \enforced\let\bottext\chemicalbottext \glet\m_chem_bot_text\empty
+ \enforced\let\midtext\chemicalmidtext \glet\m_chem_mid_text\empty
\global\setfalse\c_chem_some_text
\to \everystructurechemical
@@ -356,48 +351,48 @@
\box\scratchboxtwo
\egroup}
-\unexpanded\def\chemicalleft#1#2% redundant boxes thanks to visual
+\protected\def\chemicalleft#1#2% redundant boxes thanks to visual
{\hbox\bgroup % hpack ?
\setstrut
\llap{\chem_box_visual_nop{\strut#1}}%
\chem_box_visual_nop{\strut#2}%
\egroup}
-\unexpanded\def\chemicalright#1#2% redundant boxes thanks to visual
+\protected\def\chemicalright#1#2% redundant boxes thanks to visual
{\hbox\bgroup % hpack ?
\setstrut
\chem_box_visual_yes{\strut#2}%
\rlap{\chem_box_visual_nop{\strut#1}}%
\egroup}
-\unexpanded\def\chemicaltop {\chem_top_construct \hss \hss }
-\unexpanded\def\chemicallefttop {\chem_top_construct \relax \hss }
-\unexpanded\def\chemicalrighttop {\chem_top_construct \hss \relax}
-\unexpanded\def\chemicalbottom {\chem_bottom_construct \hss \hss }
-\unexpanded\def\chemicalleftbottom {\chem_bottom_construct \relax \hss }
-\unexpanded\def\chemicalrightbottom {\chem_bottom_construct \hss \relax}
+\permanent\protected\def\chemicaltop {\chem_top_construct \hss \hss }
+\permanent\protected\def\chemicallefttop {\chem_top_construct \relax\hss }
+\permanent\protected\def\chemicalrighttop {\chem_top_construct \hss \relax}
+\permanent\protected\def\chemicalbottom {\chem_bottom_construct\hss \hss }
+\permanent\protected\def\chemicalleftbottom {\chem_bottom_construct\relax\hss }
+\permanent\protected\def\chemicalrightbottom{\chem_bottom_construct\hss \relax}
-\unexpanded\def\chemicaltopleft #1{\chemicalleft {\chemicalrighttop {#1}{}}}
-\unexpanded\def\chemicalbottomleft #1{\chemicalleft {\chemicalrightbottom{#1}{}}}
-\unexpanded\def\chemicaltopright #1{\chemicalright{\chemicallefttop {#1}{}}}
-\unexpanded\def\chemicalbottomright #1{\chemicalright{\chemicalleftbottom {#1}{}}}
+\permanent\protected\def\chemicaltopleft #1{\chemicalleft {\chemicalrighttop {#1}{}}}
+\permanent\protected\def\chemicalbottomleft #1{\chemicalleft {\chemicalrightbottom{#1}{}}}
+\permanent\protected\def\chemicaltopright #1{\chemicalright{\chemicallefttop {#1}{}}}
+\permanent\protected\def\chemicalbottomright#1{\chemicalright{\chemicalleftbottom {#1}{}}}
-% \unexpanded\def\chemicalcentered #1{\hbox to \fontcharwd\font`C{\setstrut\strut\hss#1\hss}}
-% \unexpanded\def\chemicalleftcentered #1{\hbox to \fontcharwd\font`C{\setstrut\strut #1\hss}}
-% \unexpanded\def\chemicalrightcentered#1{\hbox to \fontcharwd\font`C{\setstrut\strut\hss#1}}
+% \protected\def\chemicalcentered #1{\hbox to \fontcharwd\font`C{\setstrut\strut\hss#1\hss}}
+% \protected\def\chemicalleftcentered #1{\hbox to \fontcharwd\font`C{\setstrut\strut #1\hss}}
+% \protected\def\chemicalrightcentered#1{\hbox to \fontcharwd\font`C{\setstrut\strut\hss#1}}
% \let\chemicalsmashedmiddle\chemicalcentered
% \let\chemicalsmashedleft \chemicalleftcentered
% \let\chemicalsmashedright \chemicalrightcentered
-\unexpanded\def\chemicalalignedtext
+\permanent\protected\def\chemicalalignedtext
{\ifmmode
\expandafter\chem_aligned_text_math
\else
\expandafter\chem_aligned_text_text
\fi}
-\let\chemicaltighttext\relax % maybe smaller strut
+\aliased\let\chemicaltighttext\relax % maybe smaller strut
\def\chem_aligned_text_text#1#2#3%
{\dontleavehmode
@@ -420,30 +415,30 @@
\egroup
\endgroup}
-\unexpanded\def\chemicalcentered {\chemicalalignedtext\hss \hss }
-\unexpanded\def\chemicalleftcentered {\chemicalalignedtext\relax\hss }
-\unexpanded\def\chemicalrightcentered{\chemicalalignedtext\hss \relax}
+\permanent\protected\def\chemicalcentered {\chemicalalignedtext\hss \hss }
+\permanent\protected\def\chemicalleftcentered {\chemicalalignedtext\relax\hss }
+\permanent\protected\def\chemicalrightcentered{\chemicalalignedtext\hss \relax}
-\let\chemicalsmashedmiddle\chemicalcentered
-\let\chemicalsmashedleft \chemicalleftcentered
-\let\chemicalsmashedright \chemicalrightcentered
+\aliased\let\chemicalsmashedmiddle\chemicalcentered
+\aliased\let\chemicalsmashedleft \chemicalleftcentered
+\aliased\let\chemicalsmashedright \chemicalrightcentered
-\unexpanded\def\chemicaloxidation#1#2#3%
+\permanent\protected\def\chemicaloxidation#1#2#3%
{\chemicaltop{\txx\ifcase#2\relax0\else#1\convertnumber{I}{#2}\fi}{#3}}
-\unexpanded\def\chemicaloxidationplus {\dotriplegroupempty\chemicaloxidation{\textplus }} % {} needed!
-\unexpanded\def\chemicaloxidationminus{\dotriplegroupempty\chemicaloxidation{\textminus}} % {} needed!
-\unexpanded\def\chemicalforeveropen {\dotriplegroupempty\chemicalleft {$\big[$}} % {} needed!
-\unexpanded\def\chemicalforeverclose {\dotriplegroupempty\chemicalright {$\big]$}} % {} needed!
-\unexpanded\def\chemicaloxidationone {\chemicaloxidation\relax1}
-\unexpanded\def\chemicaloxidationtwo {\chemicaloxidation\relax2}
-\unexpanded\def\chemicaloxidationthree{\chemicaloxidation\relax3}
-\unexpanded\def\chemicaloxidationfour {\chemicaloxidation\relax4}
-\unexpanded\def\chemicaloxidationfive {\chemicaloxidation\relax5}
-\unexpanded\def\chemicaloxidationsix {\chemicaloxidation\relax6}
-\unexpanded\def\chemicaloxidationseven{\chemicaloxidation\relax7}
-
-\unexpanded\def\chemicalbar
+\permanent\protected\def\chemicaloxidationplus {\dotriplegroupempty\chemicaloxidation{\textplus }} % {} needed!
+\permanent\protected\def\chemicaloxidationminus{\dotriplegroupempty\chemicaloxidation{\textminus}} % {} needed!
+\permanent\protected\def\chemicalforeveropen {\dotriplegroupempty\chemicalleft {$\big[$}} % {} needed!
+\permanent\protected\def\chemicalforeverclose {\dotriplegroupempty\chemicalright {$\big]$}} % {} needed!
+\permanent\protected\def\chemicaloxidationone {\chemicaloxidation\relax1}
+\permanent\protected\def\chemicaloxidationtwo {\chemicaloxidation\relax2}
+\permanent\protected\def\chemicaloxidationthree{\chemicaloxidation\relax3}
+\permanent\protected\def\chemicaloxidationfour {\chemicaloxidation\relax4}
+\permanent\protected\def\chemicaloxidationfive {\chemicaloxidation\relax5}
+\permanent\protected\def\chemicaloxidationsix {\chemicaloxidation\relax6}
+\permanent\protected\def\chemicaloxidationseven{\chemicaloxidation\relax7}
+
+\permanent\protected\def\chemicalbar
{\hpack \s!spread .5\emwidth \bgroup
\hss
\vrule \s!height .9\strutht \s!depth .65\strutdp \s!width .1\exheight
@@ -491,32 +486,25 @@
% inline
-% \unexpanded\def\chemical
-% {\ifinformula
-% \expandafter\displaychemical
-% \else
-% \expandafter\inlinechemical
-% \fi}
-
-\unexpanded\def\chemical
+\permanent\protected\def\chemical
{\ifinformula
\expandafter\indisplaychemical
\else
\expandafter\inlinechemical
\fi}
-\unexpanded\def\indisplaychemical
+\permanent\protected\def\indisplaychemical
{\mathstylecommand\displaychemical\inlinechemical\inlinechemical}
-\unexpanded\def\inlinechemical#1%
- {\dontleavehmode
- \begingroup
- \scratchcounter\normalmathstyle
- \usechemicalstyleandcolor\c!style\c!color
- \hbox{\mathematics{\tf\triggermathstyle\scratchcounter\clf_inlinechemical{#1}}}%
- \endgroup}
+% \permanent\protected\def\inlinechemical#1%
+% {\dontleavehmode
+% \begingroup
+% \scratchcounter\normalmathstyle
+% \usechemicalstyleandcolor\c!style\c!color
+% \hbox{\mathematics{\tf\triggermathstyle\scratchcounter\clf_inlinechemical{#1}}}%
+% \endgroup}
-\unexpanded\def\displaychemical
+\permanent\protected\def\displaychemical
{\dotriplegroupempty\chem_display}
\def\chem_display#1#2#3%
@@ -537,11 +525,11 @@
\egroup
\quad}
-\unexpanded\def\inlinechemical#1%
+\permanent\protected\def\inlinechemical#1%
{\dontleavehmode
\hbox{\usechemicalstyleandcolor\c!style\c!color\clf_inlinechemical{#1}}}
-\unexpanded\def\chemicalbondrule
+\permanent\protected\def\chemicalbondrule
{\hpack{\vrule\s!height.75\exheight\s!depth-\dimexpr.75\exheight-\linewidth\relax\s!width\emwidth\relax}}
\definechemicalsymbol[i:space] [\enspace\quad\enspace]
@@ -555,17 +543,17 @@
\definechemicalsymbol[i:double] [\hpack{\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
\definechemicalsymbol[i:triple] [\hpack{\chemicalbondrule\hskip-1em\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
-\unexpanded\def\chemicalsinglebond {\chemicalsymbol[i:single]}
-\unexpanded\def\chemicaldoublebond {\chemicalsymbol[i:double]}
-\unexpanded\def\chemicaltriplebond {\chemicalsymbol[i:triple]}
-\unexpanded\def\chemicalgives {\chemicalsymbol[i:gives]}
-\unexpanded\def\chemicalmesomeric {\chemicalsymbol[i:mesomeric]}
-\unexpanded\def\chemicalequilibrium{\chemicalsymbol[i:equilibrium]}
-\unexpanded\def\chemicalplus {\chemicalsymbol[i:plus]}
-\unexpanded\def\chemicalminus {\chemicalsymbol[i:minus]}
-\unexpanded\def\chemicalequals {\chemicalsymbol[i:equals]}
-\unexpanded\def\chemicalspace {\chemicalsymbol[i:space]}
-\unexpanded\def\chemicalinline #1{#1}
+\permanent\protected\def\chemicalsinglebond {\chemicalsymbol[i:single]}
+\permanent\protected\def\chemicaldoublebond {\chemicalsymbol[i:double]}
+\permanent\protected\def\chemicaltriplebond {\chemicalsymbol[i:triple]}
+\permanent\protected\def\chemicalgives {\chemicalsymbol[i:gives]}
+\permanent\protected\def\chemicalmesomeric {\chemicalsymbol[i:mesomeric]}
+\permanent\protected\def\chemicalequilibrium{\chemicalsymbol[i:equilibrium]}
+\permanent\protected\def\chemicalplus {\chemicalsymbol[i:plus]}
+\permanent\protected\def\chemicalminus {\chemicalsymbol[i:minus]}
+\permanent\protected\def\chemicalequals {\chemicalsymbol[i:equals]}
+\permanent\protected\def\chemicalspace {\chemicalsymbol[i:space]}
+\permanent\protected\def\chemicalinline #1{#1}
% display
@@ -578,7 +566,7 @@
\newif\ifinchemicalformula
-\unexpanded\def\startchemicalformula
+\permanent\protected\def\startchemicalformula
{\mathortext\vcenter\vbox\bgroup
\forgetall
\inchemicalformulatrue
@@ -587,11 +575,11 @@
\t_chem_top\emptytoks % not needed
\t_chem_mid\emptytoks % not needed
\t_chem_bot\emptytoks % not needed
- \let\chemical\formulachemical
+ \enforced\let\chemical\formulachemical
\setfalse\c_chem_has_top
\setfalse\c_chem_has_bot}
-\unexpanded\def\stopchemicalformula
+\permanent\protected\def\stopchemicalformula
{\tabskip\emwidth\relax
\nointerlineskip
\ifconditional\c_chem_has_top
@@ -637,7 +625,7 @@
\definechemicalsymbol[d:OPENCOMPLEX] [{\chemicalsymbol[d:opencomplex]}]
\definechemicalsymbol[d:CLOSECOMPLEX][{\chemicalsymbol[d:closecomplex]}]
-\unexpanded\def\formulachemical
+\permanent\protected\def\formulachemical
{\relax\dotriplegroupempty\chem_formula}
\def\chem_formula#1#2#3% we could do hboxes and measure
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index dd018e49b..b7ba71594 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2020.11.05 15:20}
+\newcontextversion{2020.11.05 22:57}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index a6e6f217e..18940ee57 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.11.05 15:20}
+\edef\contextversion{2020.11.05 22:57}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index 88959faa9..f2f29738d 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.11.05 15:20}
+\edef\contextversion{2020.11.05 22:57}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -132,7 +132,7 @@
%D \doifelsefileexists{l-macro-imp-codes-luametatex.lua}{\registerctxluafile{l-macro-imp-codes-luametatex}{}}{}
%D \stoptyping
-\loadmarkfile{supp-dir}
+\loadmkxlfile{supp-dir}
\loadmkxlfile{char-utf}
\loadmkxlfile{char-ini}
@@ -229,7 +229,7 @@
\loadmarkfile{pack-cut}
\loadmkxlfile{lang-mis}
-\loadmarkfile{lang-url}
+\loadmkxlfile{lang-url}
\loadmarkfile{lang-def}
% \loadmkvifile{file-job} % why so late?
@@ -253,7 +253,7 @@
\loadmklxfile{strc-ini}
\loadmarkfile{strc-tag}
-\loadmarkfile{strc-doc}
+\loadmkxlfile{strc-doc}
\loadmkxlfile{strc-num}
\loadmkxlfile{strc-mar}
\loadmkxlfile{strc-sbe}
@@ -516,7 +516,7 @@
\loadmkxlfile{pack-com}
\loadmarkfile{typo-del}
-\loadmarkfile{grph-trf}
+\loadmkxlfile{grph-trf}
\loadmkxlfile{grph-inc}
\loadmarkfile{grph-fig}
\loadmarkfile{grph-raw}
diff --git a/tex/context/base/mkiv/font-sty.mklx b/tex/context/base/mkiv/font-sty.mklx
index 457217f8d..7dc3116f6 100644
--- a/tex/context/base/mkiv/font-sty.mklx
+++ b/tex/context/base/mkiv/font-sty.mklx
@@ -235,9 +235,9 @@
\letvalue{\??stylecheck\currentstyle}\relax
\edef\p_method{\styleparameter\c!method}%
\ifx\p_method\v!command
- \setuevalue{\e!start\currentstyle}{\font_styles_apply_start{\currentstyle}}%
- \setuevalue{\e!stop \currentstyle}{\font_styles_apply_stop}%
- \setuevalue {\currentstyle}{\font_styles_apply_grouped{\currentstyle}}% no longer groupedcommand here
+ \frozen\instance\setuevalue{\e!start\currentstyle}{\font_styles_apply_start{\currentstyle}}%
+ \frozen\instance\setuevalue{\e!stop \currentstyle}{\font_styles_apply_stop}%
+ \frozen\instance\setuevalue {\currentstyle}{\font_styles_apply_grouped{\currentstyle}}% no longer groupedcommand here
\fi
\to \everydefinestyle
diff --git a/tex/context/base/mkiv/grph-trf.mkiv b/tex/context/base/mkiv/grph-trf.mkiv
index d1be7e1d7..d6a6acd78 100644
--- a/tex/context/base/mkiv/grph-trf.mkiv
+++ b/tex/context/base/mkiv/grph-trf.mkiv
@@ -234,20 +234,11 @@
{\ifdim\p_sx\onepoint=\onepoint\else\edef\p_width {\the\dimexpr\p_sx\d_grph_scale_wd}\fi
\ifdim\p_sy\onepoint=\onepoint\else\edef\p_height{\the\dimexpr\p_sy\d_grph_scale_ht}\fi}
-\ifcase\contextlmtxmode
+\def\grph_scale_rounded#1%
+ {\expandafter\expandafter\expandafter\grph_scale_rounded_indeed
+ \expandafter\WITHOUTPT\the\dimexpr#1\points*100+32768\scaledpoint\relax.\relax}
- \def\grph_scale_rounded#1%
- {\expandafter\expandafter\expandafter\grph_scale_rounded_indeed
- \expandafter\WITHOUTPT\the\dimexpr#1\points*100+32768\scaledpoint\relax.\relax}
-
- \def\grph_scale_rounded_indeed#1.#2\relax{#1}
-
-\else
-
- \def\grph_scale_rounded#1%
- {\thewithoutunit\dimexpr#1\points*100+32768\scaledpoint\relax}
-
-\fi
+\def\grph_scale_rounded_indeed#1.#2\relax{#1}
\def\grph_scale_calculations_nop
{\settrue\c_grph_scale_done
diff --git a/tex/context/base/mkiv/grph-trf.mkxl b/tex/context/base/mkiv/grph-trf.mkxl
new file mode 100644
index 000000000..0a423bd6b
--- /dev/null
+++ b/tex/context/base/mkiv/grph-trf.mkxl
@@ -0,0 +1,1011 @@
+%D \module
+%D [ file=grph-trf,
+%D version=2006.08.26, % overhaul/split of 1997.03.31 core-fig
+%D title=\CONTEXT\ Graphic Macros,
+%D subtitle=Transformations,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Graphic Macros / Transformations}
+
+\unprotect
+
+%D We probably use too many dimens as the width calculations can go away. Some of
+%D this is an inheritance of limited backends (some supported fractions, some
+%D 1000's, some dimentions) so we calculate all of them. Nowadays scaling is always
+%D available so we could simplify the code. On the other hand, we now get some extra
+%D values for free.
+%D
+%D We could move the calculations to \LUA\ and clean up this lot anyway. On the
+%D other hand, there is some danger of messing up so it has a real low priority.
+
+\registerctxluafile{grph-trf}{}
+
+% local:
+
+\newdimen\d_grph_scale_x_size
+\newdimen\d_grph_scale_y_size
+\newdimen\d_grph_scale_x_offset
+\newdimen\d_grph_scale_y_offset
+
+\newdimen\d_grph_scale_h_size
+\newdimen\d_grph_scale_v_size
+
+\newconditional\c_grph_scale_done
+\newconditional\c_grph_scale_scaling_done
+\newconditional\c_grph_scale_limit_factors \settrue\c_grph_scale_limit_factors
+
+\newconditional\c_grph_scale_swap_factor
+
+\newdimen\d_grph_scale_wd
+\newdimen\d_grph_scale_ht
+\newdimen\d_grph_scale_dp
+
+% global
+
+\newdimen\d_grph_scale_used_x_size
+\newdimen\d_grph_scale_used_y_size
+
+\newcount\c_grph_scale_used_x_scale
+\newcount\c_grph_scale_used_y_scale
+
+\let \m_grph_scale_used_x_scale\!!plusone
+\let \m_grph_scale_used_y_scale\!!plusone
+
+\newdimen\d_grph_scale_outer_v_size % we cannot manipulate any global vsize !
+
+% scratch:
+
+\let\m_grph_scale_temp \empty
+\let\m_grph_scale_temp_x\empty
+\let\m_grph_scale_temp_y\empty
+
+% public:
+
+\let\finalscaleboxxscale \!!plusone
+\let\finalscaleboxyscale \!!plusone
+\let\finalscaleboxwidth \!!zeropoint
+\let\finalscaleboxheight \!!zeropoint
+
+% we can let sx/sy win (first check)
+
+\installcorenamespace{scale}
+\installcorenamespace{scalegrid}
+\installcorenamespace{scalenorm}
+\installcorenamespace{scalefact}
+
+\installcommandhandler \??scale {scale} \??scale % we can have instances
+
+\setupscale
+ [\c!sx=\scaleparameter\c!s,
+ \c!sy=\scaleparameter\c!s,
+ \c!s=1,
+ %\c!scale=,
+ %\c!xscale=,
+ %\c!yscale=,
+ %\c!width=,
+ %\c!height=,
+ %\c!lines=,
+ %\c!factor=,
+ %\c!hfactor=,
+ %\c!wfactor=,
+ %\c!grid=,
+ %\c!equalwidth=,
+ %\c!equalheight=,
+ \c!maxwidth=\scaleparameter\c!width,
+ \c!maxheight=\scaleparameter\c!height]
+
+\permanent\tolerant\protected\def\scale[#1]#*[#2]%
+ {\bgroup
+ % this is quite common so we might make this a helper
+ \ifarguments
+ \let\currentscale\empty
+ \or
+ \ifhastok={#1}%
+ \let\currentscale\empty
+ \setupcurrentscale[#1]%
+ \else
+ \edef\currentscale{#1}%
+ \fi
+ \or
+ \edef\currentscale{#1}%
+ \setupcurrentscale[#2]%
+ \fi
+ %
+ \dowithnextboxcs\grph_scale_finish\hbox}
+
+\def\grph_scale_finish
+ {% todo: p_scale_
+ \edef\p_scale {\scaleparameter\c!scale }%
+ \edef\p_xscale {\scaleparameter\c!xscale }%
+ \edef\p_yscale {\scaleparameter\c!yscale }%
+ \edef\p_width {\scaleparameter\c!width }%
+ \edef\p_height {\scaleparameter\c!height }%
+ \edef\p_depth {\scaleparameter\c!depth }%
+ \edef\p_lines {\scaleparameter\c!lines }%
+ \edef\p_factor {\scaleparameter\c!factor }%
+ \edef\p_hfactor {\scaleparameter\c!hfactor }%
+ \edef\p_wfactor {\scaleparameter\c!wfactor }%
+ % \edef\p_grid {\scaleparameter\c!grid }% used once
+ \edef\p_maxwidth {\scaleparameter\c!maxwidth }%
+ \edef\p_maxheight {\scaleparameter\c!maxheight }%
+ \edef\p_sx {\scaleparameter\c!sx }%
+ \edef\p_sy {\scaleparameter\c!sy }%
+ \edef\p_equalwidth {\scaleparameter\c!equalwidth }%
+ \edef\p_equalheight{\scaleparameter\c!equalheight}%
+ %
+ \d_grph_scale_dp\dp\nextbox
+ \ifx\p_depth\v!no \ifzeropt\d_grph_scale_dp \else
+ \setbox\nextbox\naturalhpack{\raise\d_grph_scale_dp\box\nextbox}% new
+ \d_grph_scale_dp\dp\nextbox
+ \fi \fi
+ \d_grph_scale_wd\wd\nextbox
+ \d_grph_scale_ht\ht\nextbox
+ \d_grph_scale_dp\dp\nextbox
+ %
+ \glet\finalscaleboxxscale \!!plusone
+ \glet\finalscaleboxyscale \!!plusone
+ \xdef\finalscaleboxwidth {\the\d_grph_scale_wd}%
+ \xdef\finalscaleboxheight{\the\d_grph_scale_ht}%
+ %
+ \forgetall
+ \dontcomplain
+ %
+ \setfalse\c_grph_scale_done
+ \grph_scale_calculate
+ \ifconditional\c_grph_scale_done
+ \grph_scale_apply
+ \fi
+ \grph_scale_position
+ %
+ \box\nextbox
+ \egroup}
+
+\def\grph_scale_apply
+ {\d_grph_scale_wd\finalscaleboxxscale\d_grph_scale_wd
+ \d_grph_scale_ht\finalscaleboxyscale\d_grph_scale_ht
+ \d_grph_scale_dp\finalscaleboxyscale\d_grph_scale_dp
+ \ifdim\d_grph_scale_wd=\wd\nextbox
+ \ifdim\d_grph_scale_ht=\ht\nextbox
+ \ifdim\d_grph_scale_dp=\dp\nextbox
+ % \grph_scale_apply_nop
+ \else
+ \grph_scale_apply_yes
+ \fi
+ \else
+ \grph_scale_apply_yes
+ \fi
+ \else
+ \grph_scale_apply_yes
+ \fi}
+
+\def\grph_scale_apply_yes
+ {\setbox\nextbox\naturalhpack
+ {\dostartscaling \finalscaleboxxscale \finalscaleboxyscale
+ \smashedbox\nextbox
+ \dostopscaling}%
+ \wd\nextbox\d_grph_scale_wd
+ \ht\nextbox\d_grph_scale_ht
+ \dp\nextbox\d_grph_scale_dp}
+
+\def\m_grph_scale_stamp_c{11}
+
+\def\grph_scale_calculate
+ {\ifdim\d_grph_scale_ht>\zeropoint \ifdim\d_grph_scale_wd>\zeropoint
+ \edef\m_grph_scale_stamp_a{\p_scale\p_xscale\p_yscale\p_factor\p_wfactor\p_hfactor\p_lines\p_width\p_height}%
+ \edef\m_grph_scale_stamp_b{\p_sx\p_sy}%
+ \ifempty\m_grph_scale_stamp_a
+ \ifx\m_grph_scale_stamp_b\m_grph_scale_stamp_c
+ % no scaling, don't change this (previous attempts failed anyway)
+ \insidefloattrue % trick
+ \grph_scale_calculations_yes
+ \else
+ \grph_scale_check_sx_sy
+ \grph_scale_calculations_nop
+ \fi
+ \else
+ \ifempty\m_grph_scale_stamp_b
+ % no need to check further
+ \else
+ \grph_scale_check_sx_sy
+ \fi
+ \grph_scale_calculations_yes
+ \fi
+ \fi \fi}
+
+\def\grph_scale_check_sx_sy
+ {\ifdim\p_sx\onepoint=\onepoint\else\edef\p_width {\the\dimexpr\p_sx\d_grph_scale_wd}\fi
+ \ifdim\p_sy\onepoint=\onepoint\else\edef\p_height{\the\dimexpr\p_sy\d_grph_scale_ht}\fi}
+
+\def\grph_scale_rounded#1%
+ {\thewithoutunit\dimexpr#1\points*100+32768\scaledpoint\relax}
+
+\def\grph_scale_calculations_nop
+ {\settrue\c_grph_scale_done
+ \xdef\finalscaleboxwidth {\the\dimexpr\p_sx\d_grph_scale_wd\relax}%
+ \xdef\finalscaleboxheight{\the\dimexpr\p_sy\d_grph_scale_ht\relax}%
+ \glet\finalscaleboxxscale\p_sx
+ \glet\finalscaleboxyscale\p_sy
+ \ifempty\finalscaleboxxscale\let\finalscaleboxxscale\!!plusone\fi
+ \ifempty\finalscaleboxyscale\let\finalscaleboxyscale\!!plusone\fi}
+
+\let\grph_scale_calculations_report\relax
+
+\def\grph_scale_calculations_yes
+ {\settrue\c_grph_scale_done
+ % initial values
+ \d_grph_scale_x_offset\zeropoint
+ \d_grph_scale_y_offset\zeropoint
+ \d_grph_scale_x_size \d_grph_scale_wd
+ \d_grph_scale_y_size \d_grph_scale_ht % alleen ht wordt geschaald!
+ % final values
+ \global\d_grph_scale_used_x_size \zeropoint % see note * (core-fig)
+ \global\d_grph_scale_used_y_size \zeropoint % see note * (core-fig)
+ \c_grph_scale_used_x_scale \plusone % see note * (core-fig)
+ \c_grph_scale_used_y_scale \plusone % see note * (core-fig)
+ \let\m_grph_scale_used_x_scale \!!plusone
+ \let\m_grph_scale_used_y_scale \!!plusone
+ % preparations
+ \setfalse\c_grph_scale_scaling_done
+ \grph_scale_check_parameters
+ % calculators
+ % beware, they operate in sequence, and calculate missing dimensions / messy
+ % grph_scale_by_nature % when? needed?
+ \ifconditional\c_grph_scale_scaling_done\else\grph_scale_by_factor \fi
+ \ifconditional\c_grph_scale_scaling_done\else\grph_scale_by_scale \fi
+ \ifconditional\c_grph_scale_scaling_done\else\grph_scale_by_dimension\fi
+ % used in actual scaling
+ \xdef\finalscaleboxwidth {\the\d_grph_scale_used_x_size}%
+ \xdef\finalscaleboxheight {\the\d_grph_scale_used_y_size}%
+ \glet\finalscaleboxxscale \m_grph_scale_used_x_scale
+ \glet\finalscaleboxyscale \m_grph_scale_used_y_scale
+ \grph_scale_calculations_report}
+
+\setvalue{\??scalegrid\v!yes }{\getnoflines \d_grph_scale_used_y_size\edef\p_height{\the\noflines\lineheight}}
+\setvalue{\??scalegrid\v!height }{\getrawnoflines\d_grph_scale_used_y_size\edef\p_height{\the\dimexpr\noflines\lineheight+\strutdepth}}
+\setvalue{\??scalegrid\v!depth }{\getrawnoflines\d_grph_scale_used_y_size\edef\p_height{\the\dimexpr\noflines\lineheight-\strutdepth}}
+\setvalue{\??scalegrid\v!halfline}{\getrawnoflines\d_grph_scale_used_y_size\edef\p_height{\the\dimexpr\noflines\lineheight+.5\lineheight}}
+\setvalue{\??scalegrid\v!fit }{\getrawnoflines\d_grph_scale_used_y_size\edef\p_height{\the\noflines\lineheight}}
+\letvalue{\??scalegrid\empty }\donothing
+
+\def\grph_scale_check_parameters % resolve self referencing loops
+ {\ifempty\p_maxwidth \else \edef\p_maxwidth {\the\dimexpr\p_maxwidth }\fi
+ \ifempty\p_maxheight\else \edef\p_maxheight{\the\dimexpr\p_maxheight }\fi
+ \ifempty\p_lines \else \edef\p_height {\the\dimexpr\p_lines\lineheight}\fi
+ \csname\??scalegrid\scaleparameter\c!grid\endcsname}
+
+\def\grph_scale_by_nature % where ! ! ! ! !
+ {\ifempty\p_width \else \global\d_grph_scale_used_x_size\p_width \fi
+ \ifempty\p_height\else \global\d_grph_scale_used_y_size\p_height\fi
+ \ifempty\p_scale \else \c_grph_scale_used_x_scale\p_scale
+ \c_grph_scale_used_y_scale\p_scale \fi
+ \ifempty\p_xscale\else \c_grph_scale_used_x_scale\p_xscale\fi
+ \ifempty\p_yscale\else \c_grph_scale_used_y_scale\p_yscale\fi}
+
+% \defineexternalfigure[width-6][factor=auto,maxwidth=\textheight,maxheight=\textwidth]
+% \defineexternalfigure[width-7][factor=auto,maxwidth=\textwidth,maxheight=\textheight]
+% \placefigure{none}{\rotate[frame=on,offset=overlay]{\externalfigure[t:/sources/cow.pdf][width-6]}} \page
+% \placefigure{none}{\framed[frame=on,offset=overlay]{\externalfigure[t:/sources/cow.pdf][width-7]}}
+
+%D The \typpe {min} option makes sure that the smallest available space determines
+%D the max size (so we can get a bleed on the other axis):
+%D
+%D \startlinecorrection
+%D \startcombination[nx=2,ny=2,distance=4cm]
+%D {\externalfigure[hacker][factor=max,maxwidth=6cm,maxheight=6cm]} {}
+%D {\externalfigure[mill] [factor=max,maxwidth=6cm,maxheight=6cm]} {}
+%D {\externalfigure[hacker][factor=min,maxwidth=6cm,maxheight=6cm]} {}
+%D {\externalfigure[mill] [factor=min,maxwidth=6cm,maxheight=6cm]} {}
+%D \stopcombination
+%D \stoplinecorrection
+
+\def\m_grph_scale_factor_set{\v!min,\v!max,\v!fit,\v!broad,\v!auto} % can be an \edef
+
+\def\grph_scale_by_factor
+ {\doifelseinset\p_factor\m_grph_scale_factor_set
+ \grph_scale_by_factor_a
+ {\doifelseinset\p_hfactor\m_grph_scale_factor_set
+ \grph_scale_by_factor_b
+ {\doifelseinset\p_wfactor\m_grph_scale_factor_set
+ \grph_scale_by_factor_c
+ \grph_scale_by_factor_d}}}
+
+\def\grph_scale_by_factor_a
+ {\grph_scale_apply_size
+ \ifdim\d_grph_scale_x_size >\d_grph_scale_y_size
+ \grph_scale_calculate_norm \d_grph_scale_used_x_size\p_factor\p_maxwidth\hsize\d_grph_scale_h_size
+ \grph_scale_calculate_scales\d_grph_scale_used_x_size\d_grph_scale_x_size
+ \d_grph_scale_used_y_size\m_grph_scale_used_x_scale\d_grph_scale_y_size
+ \else
+ \grph_scale_calculate_norm \d_grph_scale_used_y_size\p_factor\p_maxheight\d_grph_scale_outer_v_size\d_grph_scale_v_size
+ \grph_scale_calculate_scales\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \d_grph_scale_used_x_size\m_grph_scale_used_x_scale\d_grph_scale_x_size
+ \fi
+ \grph_scale_by_factor_indeed}
+
+\def\grph_scale_by_factor_b
+ {\grph_scale_apply_size
+ \grph_scale_calculate_norm \d_grph_scale_used_y_size\p_hfactor\p_maxheight\d_grph_scale_outer_v_size\d_grph_scale_v_size
+ \grph_scale_calculate_scales\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \d_grph_scale_used_x_size\m_grph_scale_used_x_scale\d_grph_scale_x_size
+ \grph_scale_by_factor_indeed}
+
+\def\grph_scale_by_factor_c
+ {\grph_scale_apply_size
+ \grph_scale_calculate_norm \d_grph_scale_used_x_size\p_wfactor\p_maxwidth\hsize\d_grph_scale_h_size
+ \grph_scale_calculate_scales\d_grph_scale_used_x_size\d_grph_scale_x_size
+ \d_grph_scale_used_y_size\m_grph_scale_used_x_scale\d_grph_scale_y_size
+ \grph_scale_by_factor_indeed}
+
+\def\grph_scale_by_factor_d
+ {\grph_scale_calculate_norm\d_grph_scale_used_y_size\p_factor \p_height \textheight\d_grph_scale_v_size
+ \grph_scale_calculate_norm\d_grph_scale_used_y_size\p_hfactor\p_height \textheight\d_grph_scale_v_size
+ \grph_scale_calculate_norm\d_grph_scale_used_x_size\p_wfactor\p_width \hsize \hsize}
+
+\def\grph_scale_by_factor_indeed
+ {\grph_scale_calculate_fact\p_factor
+ \settrue\c_grph_scale_scaling_done
+ \ifconditional\c_grph_scale_limit_factors
+ \ifdim\d_grph_scale_used_x_size\ifconditional\c_grph_scale_swap_factor<\else>\fi\d_grph_scale_h_size
+ \global\d_grph_scale_used_y_size\zeropoint
+ \global\d_grph_scale_used_x_size\d_grph_scale_h_size
+ \orelse\ifdim\d_grph_scale_used_y_size\ifconditional\c_grph_scale_swap_factor<\else>\fi\d_grph_scale_v_size
+ \global\d_grph_scale_used_x_size\zeropoint
+ \global\d_grph_scale_used_y_size\d_grph_scale_v_size
+ \fi
+ \fi
+ \grph_scale_by_dimension}
+
+\def\grph_scale_by_scale
+ {\edef\m_grph_scale_temp{\p_scale\p_xscale\p_yscale}%
+ \ifempty\m_grph_scale_temp \else
+ \grph_scale_apply_scale\m_grph_scale_used_x_scale\p_xscale
+ \grph_scale_apply_scale\m_grph_scale_used_y_scale\p_yscale
+ % \global\d_grph_scale_used_x_size\m_grph_scale_used_x_scale\d_grph_scale_x_size\relax % no global needed here
+ % \global\d_grph_scale_used_y_size\m_grph_scale_used_y_scale\d_grph_scale_y_size\relax % no global needed here
+ % wrong: we need to recalculate the scale
+ \global\d_grph_scale_used_x_size\zeropoint
+ \global\d_grph_scale_used_y_size\zeropoint
+ %
+ \ifempty\p_maxwidth
+ \ifempty\p_maxheight
+ \else
+ \ifdim\d_grph_scale_y_size>\p_maxheight\relax
+ \global\d_grph_scale_used_y_size\p_maxheight
+ \fi
+ \fi
+ \else
+ \ifdim\d_grph_scale_x_size>\p_maxwidth\relax
+ \global\d_grph_scale_used_x_size\p_maxwidth
+ \fi
+ \fi
+ \fi}
+
+\def\grph_scale_by_dimension
+ {\ifdim\d_grph_scale_used_x_size>\zeropoint
+ \ifdim\d_grph_scale_used_y_size>\zeropoint
+ \grph_scale_by_dimension_a
+ \else
+ \grph_scale_by_dimension_b
+ \fi
+ \else
+ \ifdim\d_grph_scale_used_y_size>\zeropoint
+ \grph_scale_by_dimension_c
+ \else
+ \grph_scale_by_dimension_d
+ \fi
+ \fi}
+
+\def\grph_scale_by_dimension_a
+ {\grph_scale_by_dimension_indeed
+ {\grph_scale_calculate_scale\m_grph_scale_used_y_scale\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \grph_scale_calculate_scale\m_grph_scale_used_x_scale\d_grph_scale_used_x_size\d_grph_scale_x_size}%
+ {\grph_scale_calculate_scale\m_grph_scale_used_y_scale\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \grph_scale_calculate_scale\m_grph_scale_used_x_scale\d_grph_scale_used_x_size\d_grph_scale_x_size}%
+ {\grph_scale_calculate_scale\m_grph_scale_used_y_scale\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \grph_scale_calculate_scale\m_grph_scale_used_x_scale\d_grph_scale_used_x_size\d_grph_scale_x_size}}
+
+\def\grph_scale_by_dimension_b
+ {\grph_scale_by_dimension_indeed
+ {\grph_scale_calculate_scales\d_grph_scale_used_x_size\d_grph_scale_x_size
+ \d_grph_scale_used_y_size\m_grph_scale_used_x_scale\d_grph_scale_y_size}%
+ {\grph_scale_calculate_scales\d_grph_scale_used_x_size\d_grph_scale_x_size
+ \d_grph_scale_used_y_size\m_grph_scale_used_x_scale\d_grph_scale_y_size}%
+ {\grph_scale_calculate_scales\d_grph_scale_used_x_size\d_grph_scale_x_size
+ \d_grph_scale_used_y_size\m_grph_scale_used_x_scale\d_grph_scale_y_size}}
+
+\def\grph_scale_by_dimension_c
+ {\grph_scale_by_dimension_indeed % weird .. three same cases
+ {\grph_scale_calculate_scales\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \d_grph_scale_used_x_size\m_grph_scale_used_x_scale\d_grph_scale_x_size}%
+ {\grph_scale_calculate_scales\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \d_grph_scale_used_x_size\m_grph_scale_used_x_scale\d_grph_scale_x_size}%
+ {\grph_scale_calculate_scales\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \d_grph_scale_used_x_size\m_grph_scale_used_x_scale\d_grph_scale_x_size}}
+
+\def\grph_scale_by_dimension_d
+ {\grph_scale_by_dimension_indeed
+ {\grph_scale_apply_scale\m_grph_scale_used_x_scale\p_xscale
+ \grph_scale_apply_scale\m_grph_scale_used_y_scale\p_yscale
+ \global\d_grph_scale_used_x_size\m_grph_scale_used_x_scale\d_grph_scale_x_size
+ \global\d_grph_scale_used_y_size\m_grph_scale_used_y_scale\d_grph_scale_y_size}%
+ {\grph_scale_calculate_scales\d_grph_scale_used_x_size\d_grph_scale_x_size
+ \d_grph_scale_used_y_size\m_grph_scale_used_x_scale\d_grph_scale_y_size}%
+ {\grph_scale_calculate_scales\d_grph_scale_used_y_size\d_grph_scale_y_size
+ \d_grph_scale_used_x_size\m_grph_scale_used_x_scale\d_grph_scale_x_size}}
+
+\def\grph_scale_by_dimension_indeed#1#2#3%
+ {#1\relax
+ \ifempty\p_maxwidth \else
+ \ifdim\d_grph_scale_used_x_size>\p_maxwidth\relax
+ \global\d_grph_scale_used_x_size\p_maxwidth
+ #2\relax
+ \fi
+ \fi
+ \ifempty\p_maxheight \else
+ \ifdim\d_grph_scale_used_y_size>\p_maxheight\relax
+ \global\d_grph_scale_used_y_size\p_maxheight
+ #3\relax
+ \fi
+ \fi}
+
+\def\grph_scale_calculate_norm#1#2% todo: swap 1 and 2 and pass one less
+ {\csname\??scalenorm\ifcsname\??scalenorm#2\endcsname#2\else\s!unknown\fi\endcsname#1#2}
+
+\def\grph_scale_calculate_fact#1%
+ {\csname\??scalefact\ifcsname\??scalefact#1\endcsname#1\else\s!unknown\fi\endcsname}
+
+%setvalue{\??scalenorm\v!min }#1#2#3#4#5{\global#1#4}
+\setvalue{\??scalenorm\v!max }#1#2#3#4#5{\global#1#4}
+\setvalue{\??scalenorm\v!fit }#1#2#3#4#5{\global#1#5}
+\setvalue{\??scalenorm\v!broad }#1#2#3#4#5{\global#1\dimexpr#5-4\externalfigureparameter\c!bodyfont\relax}
+\setvalue{\??scalenorm\s!unknown}#1#2#3#4#5{\global#1\dimexpr#2\dimexpr\externalfigureparameter\c!bodyfont/10\relax\relax} % brr ex
+\setvalue{\??scalenorm\v!auto }#1#2#3#4#5{\ifx#3\empty\else\global#1#3\fi}
+\setvalue{\??scalenorm\empty }#1#2#3#4#5{\ifx#3\empty\else\global#1#3\fi}
+\setvalue{\??scalenorm\s!default}#1#2#3#4#5{\ifx#3\empty\else\global#1#3\fi}
+
+\setvalue{\??scalefact\v!min }{\global\settrue \c_grph_scale_swap_factor}
+\setvalue{\??scalefact\s!unknown}{\global\setfalse\c_grph_scale_swap_factor}
+
+% \setvalue{\??scalenorm\v!min }#1#2#3#4#5% an ugly hack
+% {\ifdim\d_grph_scale_used_x_size>\d_grph_scale_h_size
+% \d_grph_scale_used_y_size\vsize
+% \else
+% \d_grph_scale_used_x_size\hsize
+% \fi}
+
+\setvalue{\??scalenorm\v!min}#1#2#3#4#5% an ugly hack
+ {\d_grph_scale_used_x_size\hsize
+ \d_grph_scale_used_y_size\vsize}
+
+\def\grph_scale_calculate_scales#1#2%
+ {\edef\m_grph_scale_used_x_scale{\luaexpr{\number#1/\number#2}}%
+ \let\m_grph_scale_used_y_scale\m_grph_scale_used_x_scale}
+
+\def\grph_scale_calculate_scale#1#2#3%
+ {\edef#1{\luaexpr{\number#2/\number#3}}}
+
+\def\grph_scale_apply_scale#1#2% #1 = parameter / scale can be empty
+ {% no overflow
+ \edef#1{\luaexpr
+ {\number
+ \ifx#2\empty
+ \ifempty\p_scale \plusthousand \else
+ \ifnum \p_scale=\zerocount \plusthousand \else
+ \p_scale \fi\fi
+ \orelse\ifnum#2=\zerocount
+ \ifempty\p_scale \plusthousand \else
+ \ifnum \p_scale=\zerocount \plusthousand \else
+ \p_scale \fi\fi
+ \else
+ #2%
+ \fi
+ /1000}}}
+
+\def\grph_scale_apply_size
+ {\ifempty\p_maxheight
+ \d_grph_scale_outer_v_size\textheight
+ \ifinner
+ \d_grph_scale_outer_v_size \vsize % \textheight =\vsize
+ \scratchdimen\vsize % \scratchdimen=\textheight
+ \orelse\ifinsidefloat
+ \d_grph_scale_outer_v_size \vsize % \textheight =\vsize
+ \scratchdimen\vsize % \scratchdimen=\textheight
+ \orelse\ifinpagebody
+ \d_grph_scale_outer_v_size \vsize % \textheight =\vsize
+ \scratchdimen\vsize % \scratchdimen=\textheight
+ \orelse\ifdim\pagegoal<\maxdimen
+ \ifdim\pagetotal<\pagegoal
+ \scratchdimen\dimexpr\pagegoal-\pagetotal\relax
+ \else
+ \scratchdimen\d_grph_scale_outer_v_size % \textheight
+ \fi
+ \else
+ \scratchdimen\d_grph_scale_outer_v_size % \textheight
+ \fi
+ \else
+ \scratchdimen\p_maxheight
+ \d_grph_scale_outer_v_size\scratchdimen
+ \fi
+ \ifempty\p_height
+ \d_grph_scale_v_size\scratchdimen
+ \else
+ \d_grph_scale_v_size\p_height
+ \fi
+ \ifempty\p_width
+ \d_grph_scale_h_size\hsize
+ \else
+ \d_grph_scale_h_size\p_width
+ \fi}
+
+% \startcombination
+% {\externalfigure[cow.pdf] [frame=on,height=3cm,equalwidth=6cm]} {a cow}
+% {\externalfigure[mill.png][frame=on,height=3cm,equalwidth=6cm]} {a mill}
+% \stopcombination
+
+\def\grph_scale_position
+ {\ifempty\p_equalwidth \else
+ \scratchdimen\p_equalwidth\relax
+ \ifdim\d_grph_scale_wd<\scratchdimen
+ \setbox\nextbox\naturalhpack to \scratchdimen{\hss\box\nextbox\hss}%
+ \fi
+ \fi
+ \ifempty\p_equalheight \else
+ \scratchdimen\p_equalheight\relax
+ \ifdim\d_grph_scale_ht<\scratchdimen
+ \setbox\nextbox\naturalvpack to \scratchdimen{\vss\box\nextbox\vss}%
+ \fi
+ \fi}
+
+\permanent\protected\def\fastscale#1%
+ {\ifnum#1=1000\relax
+ \expandafter\grph_scale_fast_nop
+ \else
+ \expandafter\grph_scale_fast_yes
+ \fi{#1}}
+
+\def\grph_scale_fast_nop#1%
+ {\hbox}
+
+\def\grph_scale_fast_yes#1%
+ {\edef\finalscaleboxxscale{\withoutpt\the\dimexpr#1\onepoint/1000\relax}% brrr
+ \let\finalscaleboxyscale\finalscaleboxxscale
+ \dowithnextboxcs\grph_scale_fast_finish\hbox}
+
+\def\grph_scale_fast_finish
+ {\grph_scale_apply
+ \box\nextbox
+ \endgroup}
+
+\permanent\protected\def\fastsxsy#1#2%
+ {\bgroup
+ \edef\p_sx{#1}%
+ \edef\p_sy{#2}%
+ \dowithnextboxcs\grph_scale_fast_sx_xy_finish\hbox}
+
+\def\grph_scale_fast_sx_xy_finish
+ {\grph_scale_check_sx_sy
+ \d_grph_scale_wd\wd\nextbox
+ \d_grph_scale_ht\ht\nextbox
+ \d_grph_scale_dp\dp\nextbox
+ \grph_scale_calculations_nop
+ \grph_scale_apply
+ \box\nextbox
+ \egroup}
+
+%D \macros
+%D {clip, setupclipping}
+%D
+%D Although related to figures, clipping can be applied to arbitrary content. We can
+%D use \METAPOST\ to provide a non rectangular clipping path.
+%D
+%D \starttyping
+%D \startMPclip{fun}
+%D clip currentpicture to fullcircle
+%D shifted (.5,.5) xscaled \width yscaled \height ;
+%D \stopMPclip
+%D \stoptyping
+%D
+%D We get a rectangular piece of the figure when we say:
+%D
+%D \starttyping
+%D \clip[x=2,y=1]{\externalfigure[photo]}
+%D \stoptyping
+%D
+%D When we want to clip to the oval we defined a few lines ago, we say:
+%D
+%D \starttyping
+%D \clip[nx=1,ny=1,x=1,y=1,mp=fun]{\externalfigure[photo]}
+%D \stoptyping
+%D
+%D The general characteristics of clipping can be set up with
+%D
+%D \showsetup{setupclipping}
+
+\installcorenamespace{clipping}
+
+\installdirectcommandhandler \??clipping {clipping}
+
+\permanent\tolerant\protected\def\clip[#1]% nb top->bottom left->right
+ {\bgroup
+ \ifparameter#1\or
+ \setupcurrentclipping[#1]%
+ \fi
+ \dowithnextboxcs\grph_clip_finish\hbox}
+
+\def\grph_clip_finish
+ {\doifelse{\clippingparameter\c!state}\v!start
+ \grph_clip_yes_finish
+ \grph_clip_nop_finish}
+
+\def\grph_clip_yes_finish
+ {\ifdim\clippingparameter\c!width>\zeropoint
+ \scratchwidth \clippingparameter\c!width
+ \scratchxoffset\clippingparameter\c!hoffset
+ \else
+ \scratchwidth\dimexpr\wd\nextbox/\clippingparameter\c!nx\relax
+ \scratchxoffset\dimexpr\clippingparameter\c!x\scratchwidth-\scratchwidth\relax
+ \scratchwidth\clippingparameter\c!sx\scratchwidth
+ \fi
+ \relax % sure
+ \ifdim\clippingparameter\c!height>\zeropoint
+ \scratchheight\clippingparameter\c!height
+ \scratchyoffset\dimexpr\ht\nextbox-\clippingparameter\c!voffset-\scratchheight\relax
+ \else
+ \scratchheight\dimexpr\ht\nextbox/\clippingparameter\c!ny\relax
+ \scratchyoffset\dimexpr-\clippingparameter\c!y\scratchheight-\clippingparameter\c!sy\scratchheight+\scratchheight\relax
+ \scratchheight\clippingparameter\c!sy\scratchheight
+ \advance\scratchyoffset \ht\nextbox
+ \fi
+ \setbox\nextbox\naturalhpack
+ {\advance\scratchxoffset -\clippingparameter\c!leftoffset \relax
+ \advance\scratchyoffset -\clippingparameter\c!bottomoffset\relax
+ \hskip-\scratchxoffset
+ \lower\scratchyoffset
+ \box\nextbox}%
+ \wd\nextbox\zeropoint
+ \ht\nextbox\zeropoint
+ \dp\nextbox\zeropoint
+ \setbox\nextbox\naturalhpack
+ {\advance\scratchwidth \dimexpr\clippingparameter\c!leftoffset +\clippingparameter\c!rightoffset\relax
+ \advance\scratchheight\dimexpr\clippingparameter\c!bottomoffset+\clippingparameter\c!topoffset \relax
+ \dostartclipping{\clippingparameter\c!mp}\scratchwidth\scratchheight
+ \box\nextbox
+ \dostopclipping}%
+ \setbox\nextbox\naturalhpack
+ {\hskip-\clippingparameter\c!leftoffset
+ \lower \clippingparameter\c!bottomoffset
+ \box\nextbox}%
+ \wd\nextbox\scratchwidth
+ \ht\nextbox\scratchheight
+ \dp\nextbox\zeropoint
+ \box\nextbox
+ \egroup}
+
+\def\grph_clip_nop_finish
+ {\box\nextbox
+ \egroup}
+
+\setupclipping
+ [\c!state=\v!start,
+ \c!n=\plusone, % was \plustwo
+ \c!nx=\clippingparameter\c!n,\c!x=\plusone,\c!sx=\plusone,
+ \c!ny=\clippingparameter\c!n,\c!y=\plusone,\c!sy=\plusone,
+ \c!width=\zeropoint,
+ \c!height=\zeropoint,
+ \c!hoffset=\zeropoint,
+ \c!voffset=\zeropoint,
+ \c!offset=\zeropoint,
+ \c!leftoffset=\clippingparameter\c!offset,
+ \c!rightoffset=\clippingparameter\c!offset,
+ \c!topoffset=\clippingparameter\c!offset,
+ \c!bottomoffset=\clippingparameter\c!offset,
+ \c!mp=]
+
+%D \startbuffer
+%D \startuseMPgraphic{test}
+%D path p ; p := fullcircle scaled 4cm ;
+%D draw p withpen pencircle scaled 1cm ;
+%D setbounds currentpicture to boundingbox p ;
+%D \stopuseMPgraphic
+%D
+%D \hbox to \hsize \bgroup
+%D \hss
+%D \ruledhbox{\useMPgraphic{test}}%
+%D \hss
+%D \ruledhbox{\clip{\useMPgraphic{test}}}%
+%D \hss
+%D \egroup
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
+%D Mirroring.
+
+\permanent\protected\def\mirror
+ {\bgroup
+ \dowithnextboxcs\grph_mirror_finish\hbox}
+
+\def\grph_mirror_finish
+ {\scratchdimen\wd\nextbox
+ % better use an hbox (if no \forgetall, leftskip etc may creep in)
+ %\setbox\nextbox\vbox{\forgetall\dostartmirroring\hskip-\wd\nextbox\box\nextbox\dostopmirroring}%
+ \setbox\nextbox\naturalhpack
+ {\dostartmirroring
+ \hskip-\wd\nextbox
+ \box\nextbox
+ \dostopmirroring}%
+ \wd\nextbox\scratchdimen
+ \box\nextbox
+ \egroup}
+
+%D A couple of examples, demonstrating how the depth is taken care of:
+%D
+%D \startbuffer
+%D test\rotate[frame=on, rotation=0] {gans}%
+%D test\rotate[frame=on, rotation=90] {gans}%
+%D test\rotate[frame=on, rotation=180]{gans}%
+%D test\rotate[frame=on, rotation=270]{gans}%
+%D test
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+%D
+%D When we rotate over arbitrary angles, we need to relocate the resulting box
+%D because rotation brings that box onto the negative axis. The calculations (mostly
+%D sin and cosine) need to be tuned for the way a box is packages (i.e. the refence
+%D point). A typical example of drawing, scribbling, and going back to the days of
+%D school math.
+%D
+%D We do a bit more calculations than needed, simply because that way it's easier to
+%D debug the code.
+
+\installcorenamespace {rotate}
+\installcorenamespace {rotatelocation}
+\installcorenamespace {rotatepreset}
+
+% todo: scratchcounters
+
+\newdimen\d_grph_rotate_x_size
+\newdimen\d_grph_rotate_y_size
+\newdimen\d_grph_rotate_x_offset
+\newdimen\d_grph_rotate_y_offset
+\newdimen\d_grph_rotate_x_position
+\newdimen\d_grph_rotate_y_position
+
+\newdimen\d_grph_rotate_used_height
+
+\newdimen\d_grph_rotate_width
+\newdimen\d_grph_rotate_height
+\newdimen\d_grph_rotate_depth
+
+\newdimen\d_grph_rotate_saved_width
+\newdimen\d_grph_rotate_saved_height
+\newdimen\d_grph_rotate_saved_depth
+
+\newdimen\d_grph_rotate_new_width
+\newdimen\d_grph_rotate_new_height
+\newdimen\d_grph_rotate_new_depth
+
+\newconditional\c_grph_rotate_obey_depth
+\newconditional\c_grph_rotate_not_fit
+\newconditional\c_grph_rotate_center
+
+\installframedcommandhandler \??rotate {rotate} \??rotate
+
+\setuprotate
+ [\c!rotation=90,
+ \c!location=\v!normal,
+ \c!width=\v!fit,
+ \c!height=\v!fit,
+ \c!offset=\v!overlay,
+ \c!frame=\v!off]
+
+\let\p_rotation_location\empty
+\let\p_rotation_rotation\empty
+
+\permanent\tolerant\protected\def\rotate[#1]% \bgroup: \rotate kan argument zijn
+ {\bgroup
+ \ifparameter#1\or
+ \setupcurrentrotate[#1]%
+ \fi
+ \edef\p_rotation_location{\rotateparameter\c!location}%
+ \edef\p_rotation_rotation{\rotateparameter\c!rotation}%
+ \csname\??rotatelocation
+ \ifcsname\??rotatelocation\p_rotation_location\endcsname\p_rotation_location\else\v!default\fi
+ \endcsname}
+
+\def\grph_rotate_framed
+ {\resetrotateparameter\c!location
+ \dowithnextboxcs\grph_rotate_finish\vbox
+ \inheritedrotateframed}
+
+\def\grph_rotate_normal
+ {\dowithnextboxcs\grph_rotate_finish\vbox}
+
+\def\grph_rotate_finish
+ {\grph_rotate_finish_indeed
+ \egroup}
+
+\setvalue{\??rotatelocation\v!depth}%
+ {\setfalse\c_grph_rotate_not_fit
+ \setfalse\c_grph_rotate_center
+ \settrue \c_grph_rotate_obey_depth
+ \grph_rotate_normal}
+
+\setvalue{\??rotatelocation\v!fit}%
+ {\settrue \c_grph_rotate_not_fit
+ \setfalse\c_grph_rotate_center
+ \settrue \c_grph_rotate_obey_depth
+ \grph_rotate_normal}
+
+\setvalue{\??rotatelocation\v!broad}%
+ {\setfalse\c_grph_rotate_not_fit
+ \setfalse\c_grph_rotate_center
+ \setfalse\c_grph_rotate_obey_depth
+ \grph_rotate_normal}
+
+\setvalue{\??rotatelocation\v!high}%
+ {\setfalse\c_grph_rotate_not_fit
+ \setfalse\c_grph_rotate_center
+ \setfalse\c_grph_rotate_obey_depth
+ \grph_rotate_framed}
+
+\setvalue{\??rotatelocation\v!middle}%
+ {\setfalse\c_grph_rotate_not_fit
+ \settrue \c_grph_rotate_center
+ \setfalse\c_grph_rotate_obey_depth % hm, depth ?
+ \grph_rotate_normal}
+
+\setvalue{\??rotatelocation\v!default}%
+ {\setfalse\c_grph_rotate_not_fit
+ \setfalse\c_grph_rotate_center
+ \settrue \c_grph_rotate_obey_depth
+ \grph_rotate_framed}
+
+\protected\def\dorotatebox#1% {angle} \hbox/\vbox/\vtop % a fast low level one
+ {\ifcase#1\relax
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\grph_rotate_box
+ \fi{#1}}
+
+\def\grph_rotate_box#1% {angle} \hbox/\vbox/\vtop
+ {\bgroup
+ \hbox\bgroup % compatibility hack
+ \edef\p_rotation_rotation{#1}%
+ \dowithnextboxcs\grph_rotate_finish_box}
+
+\def\grph_rotate_finish_box
+ {\setfalse\c_grph_rotate_not_fit % this is the same as broad but
+ \setfalse\c_grph_rotate_center % without the following grab as
+ \setfalse\c_grph_rotate_obey_depth % we call finish directly
+ \grph_rotate_finish_indeed
+ \egroup
+ \egroup}
+
+\def\grph_rotate_finish_indeed
+ {\naturalhpack\bgroup
+ \ifempty\p_rotation_rotation
+ \grph_rotate_finish_nop
+ \else
+ \grph_rotate_finish_yes
+ \fi
+ \egroup}
+
+\def\grph_rotate_finish_nop
+ {\boxcursor\box\nextbox}
+
+\setvalue{\??rotatepreset\v!left}%
+ {\edef\p_rotation_rotation{90}}
+
+\setvalue{\??rotatepreset\v!right}%
+ {\edef\p_rotation_rotation{270}}
+
+\setvalue{\??rotatepreset\v!inner}%
+ {\signalrightpage
+ \doifelserightpage{\def\p_rotation_rotation{270}}{\def\p_rotation_rotation{90}}}
+
+\setvalue{\??rotatepreset\v!outer}%
+ {\signalrightpage
+ \doifelserightpage{\def\p_rotation_rotation{90}}{\def\p_rotation_rotation{270}}}
+
+\setvalue{\??rotatepreset\v!default}%
+ {}
+
+\def\grph_rotate_finish_yes
+ {\begincsname\??rotatepreset\p_rotation_rotation\endcsname
+ \setbox\nextbox\naturalvpack{\box\nextbox}% not really needed
+ \dontcomplain
+ \ifconditional\c_grph_rotate_center
+ \d_grph_rotate_saved_width \wd\nextbox
+ \d_grph_rotate_saved_height\ht\nextbox
+ \d_grph_rotate_saved_depth \dp\nextbox
+ \setbox\nextbox\naturalhpack{\hskip-.5\wd\nextbox\lower.5\ht\nextbox\box\nextbox}%
+ \smashbox\nextbox
+ \fi
+ %
+ \d_grph_rotate_width \wd\nextbox
+ \d_grph_rotate_height\ht\nextbox
+ \d_grph_rotate_depth \dp\nextbox
+ %
+ \setbox\nextbox\naturalvpack{\naturalhpack{\raise\dp\nextbox\box\nextbox}}% can we do without
+ %
+ \d_grph_rotate_used_height\ht\nextbox
+ %
+ \clf_analyzerotate % rather accurate
+ \p_rotation_rotation\space
+ \d_grph_rotate_width
+ \d_grph_rotate_height
+ \d_grph_rotate_depth
+ \d_grph_rotate_used_height
+ \c_grph_rotate_not_fit
+ \c_grph_rotate_obey_depth
+ \relax
+ %
+ \setbox\nextbox\naturalvpack to \d_grph_rotate_y_size
+ {\vfilll
+ \naturalhpack to \d_grph_rotate_x_size
+ {\dostartrotation\p_rotation_rotation
+ \wd\nextbox\zeropoint
+ \ht\nextbox\zeropoint
+ \box\nextbox
+ \dostoprotation
+ \hfill}%
+ \kern\d_grph_rotate_y_position}%
+ %
+ \setbox\nextbox\naturalhpack
+ {\kern\dimexpr\d_grph_rotate_x_position+\d_grph_rotate_x_offset\relax
+ \lower\d_grph_rotate_y_offset
+ \box\nextbox}%
+ %
+ \ifconditional\c_grph_rotate_center
+ \setbox\nextbox\naturalhpack{\hskip.5\d_grph_rotate_saved_width\lower-.5\d_grph_rotate_saved_height\box\nextbox}%
+ \wd\nextbox\d_grph_rotate_saved_width
+ \ht\nextbox\d_grph_rotate_saved_height
+ \dp\nextbox\d_grph_rotate_saved_depth
+ \else
+ \wd\nextbox\d_grph_rotate_new_width
+ \ht\nextbox\d_grph_rotate_new_height
+ \dp\nextbox\d_grph_rotate_new_depth
+ \fi
+ %
+ \boxcursor\box\nextbox}
+
+% \dostepwiserecurse{0}{360}{10}
+% {\startlinecorrection[blank]
+% \hbox
+% {\expanded{\setuprotate[rotation=\recurselevel]}%
+% \traceboxplacementtrue
+% \hbox to .2\hsize{\hss\ruledhbox{\rotate[location=depth] {\ruledhbox{\bfb (depth)}}}}%
+% \hbox to .2\hsize{\hss\ruledhbox{\rotate[location=fit] {\ruledhbox{\bfb (fit)}}}}%
+% \hbox to .2\hsize{\hss\ruledhbox{\rotate[location=broad] {\ruledhbox{\bfb (broad)}}}}%
+% \hbox to .2\hsize{\hss\ruledhbox{\rotate[location=normal]{\ruledhbox{\bfb (normal)}}}}%
+% \hbox to .2\hsize{\hss\ruledhbox{\rotate[location=high] {\ruledhbox{\bfb (high)}}}}}
+% \stoplinecorrection}
+
+% \def\Test{\ruledhbox{%
+% \def\DemoX{\vl\kern.5\emwidth\vl}%
+% \kern\emwidth\ruledhpack{\green\rotate[rotation=20] {\ruledhpack{\DemoX}}}%
+% \kern\emwidth\ruledhpack{\blue \rotate[rotation=0] {\ruledhpack{\DemoX}}}%
+% \kern\emwidth\ruledhpack{\red \rotate[rotation=-20] {\ruledhpack{\DemoX}}}%
+% \kern\emwidth\ruledhpack{\green\rotate[rotation=200] {\ruledhpack{\DemoX}}}%
+% \kern\emwidth\ruledhpack{\blue \rotate[rotation=180] {\ruledhpack{\DemoX}}}%
+% \kern\emwidth\ruledhpack{\red \rotate[rotation=-200]{\ruledhpack{\DemoX}}}%
+% \kern\emwidth}}
+
+% \startTEXpage[offset=10pt,align=middle]
+% \setuprotate[location=fit] \Test \par {\infofont\setstrut\strut fit} \par
+% \setuprotate[location=depth] \Test \par {\infofont\setstrut\strut depth} \par
+% \setuprotate[location=broad] \Test \par {\infofont\setstrut\strut broad} \par
+% \setuprotate[location=high] \Test \par {\infofont\setstrut\strut high} \par
+% \setuprotate[location=middle] \Test \par {\infofont\setstrut\strut middle} \par
+% \setuprotate[location=default] \Test \par {\infofont\setstrut\strut default} \par
+% \stopTEXpage
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/lang-url.mkiv b/tex/context/base/mkiv/lang-url.mkiv
index c3ec02da4..8f1a979dc 100644
--- a/tex/context/base/mkiv/lang-url.mkiv
+++ b/tex/context/base/mkiv/lang-url.mkiv
@@ -47,19 +47,19 @@
\resetfontfeature
\resetcharacterspacing
%
- \enforced\let\&\letterampersand
- \enforced\let\#\letterhash
- \enforced\let\~\lettertilde
- \enforced\let\\\letterbackslash
- \enforced\let\$\letterdollar
- \enforced\let\^\letterhat
- \enforced\let\_\letterunderscore
- \enforced\let\{\letterleftbrace
- \enforced\let\}\letterrightbrace
- \enforced\let\|\letterbar
- \enforced\let~=\lettertilde
- \enforced\let|=\letterbar
- \enforced\let\Ux\eUx
+ \let\&\letterampersand
+ \let\#\letterhash
+ \let\~\lettertilde
+ \let\\\letterbackslash
+ \let\$\letterdollar
+ \let\^\letterhat
+ \let\_\letterunderscore
+ \let\{\letterleftbrace
+ \let\}\letterrightbrace
+ \let\|\letterbar
+ \let~=\lettertilde
+ \let|=\letterbar
+ \let\Ux\eUx
\to \everyhyphenatedurl
\let\hyphenatedurlseparator \empty % \periodcentered
diff --git a/tex/context/base/mkiv/lang-url.mkxl b/tex/context/base/mkiv/lang-url.mkxl
new file mode 100644
index 000000000..bb51f838a
--- /dev/null
+++ b/tex/context/base/mkiv/lang-url.mkxl
@@ -0,0 +1,167 @@
+%D \module
+%D [ file=lang-url,
+%D version=2008.01.22, % used to be lang-mis
+%D title=\CONTEXT\ Language Macros,
+%D subtitle=Language Options,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\registerctxluafile{lang-url}{}
+
+\unprotect
+
+%D Traditionally this code is in the language namespace as
+%D hyphenation relates to languages.
+
+%D \macros
+%D {hyphenatedurl}
+%D
+%D For those who want to put full \URL's in a text, we offer
+%D
+%D \startbuffer
+%D \hyphenatedurl{http://optimist.optimist/optimist/optimist.optimist#optimist}
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D which breaks at the appropriate places. Watch the \type{#}
+%D hack.
+%D
+%D When passed as argument, like in \type {\goto}, one needs
+%D to substitute a \type {\\} for each \type{#}.
+%D
+%D \startbuffer
+%D \hyphenatedurl{http://this.is.a.rather/strange/reference#indeed}
+%D \stopbuffer
+%D
+%D \typebuffer
+
+\newtoks\everyhyphenatedurl
+
+\appendtoks
+ \resetfontfeature
+ \resetcharacterspacing
+ %
+ \enforced\let\&\letterampersand
+ \enforced\let\#\letterhash
+ \enforced\let\~\lettertilde
+ \enforced\let\\\letterbackslash
+ \enforced\let\$\letterdollar
+ \enforced\let\^\letterhat
+ \enforced\let\_\letterunderscore
+ \enforced\let\{\letterleftbrace
+ \enforced\let\}\letterrightbrace
+ \enforced\let\|\letterbar
+ \enforced\let~=\lettertilde
+ \enforced\let|=\letterbar
+ \enforced\let\Ux\eUx
+\to \everyhyphenatedurl
+
+\let\hyphenatedurlseparator \empty % \periodcentered
+\let\hyphenatedurldiscretionary\empty
+
+\setnewconstant\hyphenatedurllefthyphenmin \plusthree
+\setnewconstant\hyphenatedurlrighthyphenmin\plusthree
+
+\def\lang_url_more{\penalty\plustenthousand\hskip\scratchskipone\penalty\plustenthousand}
+\def\lang_url_less{\penalty\plustenthousand\hskip\scratchskiptwo\penalty\plustenthousand}
+\def\lang_url_trac{\penalty\plustenthousand\hsmash{\darkred\vl}\penalty\plustenthousand}
+
+\def\lang_url_a#1{\lang_url_more\char#1\lang_url_show\discretionary{}{\hyphenatedurlseparator}{}}
+\def\lang_url_b#1{\lang_url_more\discretionary{\hyphenatedurlseparator}{}{}\lang_url_show\char#1\relax}
+\def\lang_url_d {\lang_url_more\discretionary{\lang_url_show}{\lang_url_show}{\lang_url_show}}
+\def\lang_url_l#1{\lang_url_less\char#1\relax}
+\def\lang_url_c#1{\lang_url_more\char#1\relax}
+\def\lang_url_L#1{\lang_url_less\char#1\relax}
+\def\lang_url_C#1{\lang_url_more\char#1\relax}
+
+\permanent\protected\def\showhyphenatedurlbreaks % for old times sake
+ {\let\lang_url_show\lang_url_trac}
+
+\installtextracker
+ {languages.url}
+ {\let\lang_url_show\lang_url_trac}
+ {\let\lang_url_show\relax}
+
+\let\lang_url_show\relax
+
+\permanent\protected\def\sethyphenatedurlnormal#1{\clf_sethyphenatedurlcharacters{#1}{\v!normal}}
+\permanent\protected\def\sethyphenatedurlbefore#1{\clf_sethyphenatedurlcharacters{#1}{\v!before}}
+\permanent\protected\def\sethyphenatedurlafter #1{\clf_sethyphenatedurlcharacters{#1}{\v!after }}
+
+% \sethyphenatedurlafter{ABCDEF}
+
+\permanent\protected\def\hyphenatedurl#1%
+ {\dontleavehmode
+ \begingroup
+ \the\everyhyphenatedurl
+ \normallanguage\zerocount % \nohyphens in mkiv
+ \scratchskipone\zeropoint\s!plus\dimexpr\emwidth/12\s!minus\dimexpr\emwidth/24\relax % 1.00pt @ 12pt
+ \scratchskiptwo\zeropoint\s!plus\dimexpr\emwidth/48\s!minus\dimexpr\emwidth/96\relax % 0.25pt @ 12pt
+ \unprotect
+ \normalexpanded{\noexpand\clf_hyphenatedurl
+ {\noexpand\detokenize{#1}}%
+ \hyphenatedurllefthyphenmin
+ \hyphenatedurlrighthyphenmin
+ {\hyphenatedurldiscretionary}%
+ }%
+ \protect
+ \endgroup}
+
+%D \macros
+%D {hyphenatedfilename}
+%D
+%D For the moment we treat filenames in a similar way,
+%D
+%D \starttyping
+%D \hyphenatedfilename{here/there/filename.suffix}
+%D \stoptyping
+
+\ifx\hyphenatedfilename\undefined \aliased\let\hyphenatedfilename\hyphenatedurl \fi
+
+% \def\test#1%
+% {\dontleavehmode
+% \begingroup
+% \tttf
+% \hyphenatedurl {%
+% \letterampersand #1\letterampersand #1\letterampersand #1\letterampersand #1\letterampersand
+% \letterhash #1\letterhash #1\letterpercent #1\letterslash #1\letterampersand
+% }%
+% \endgroup}
+
+% \dorecurse{100}{\test{a} \test{ab} \test{abc} \test{abcd} \test{abcde} \test{abcdef}}
+
+\protect \endinput
+
+% \setuppapersize[A7]
+%
+% \protected\def\WhateverA#1%
+% {\dontleavehmode
+% \begingroup
+% \prehyphenchar"B7\relax
+% \setbox\scratchbox\hbox{\tttf#1}%
+% \prehyphenchar`-\relax
+% \unhbox\scratchbox
+% \endgroup}
+%
+% \protected\def\WhateverB#1%
+% {\dontleavehmode
+% \begingroup
+% \tttf
+% \prehyphenchar\minusone
+% % \localrightbox{\llap{_}}%
+% \localrightbox{\llap{\smash{\lower1.5ex\hbox{\char"2192}}}}%
+% \setbox\scratchbox\hbox{#1}%
+% \prehyphenchar`-\relax
+% \unhbox\scratchbox
+% \endgroup}
+%
+% \begingroup \hsize1cm
+% \WhateverA{thisisaboringandverylongcommand}\par
+% \WhateverB{thisisaboringandverylongcommand}\par
+% \endgroup
diff --git a/tex/context/base/mkiv/math-frc.mkxl b/tex/context/base/mkiv/math-frc.mkxl
index 983704f74..485053fa5 100644
--- a/tex/context/base/mkiv/math-frc.mkxl
+++ b/tex/context/base/mkiv/math-frc.mkxl
@@ -18,11 +18,11 @@
%D I need to check it all again as there was a bug in luatex with dimensions that could
%D resulted in side effects that made me mess with spacing.
-\unexpanded\def\topstrut{\vrule\s!width\zeropoint\s!height\strutht\s!depth\zeropoint\relax}
-\unexpanded\def\botstrut{\vrule\s!width\zeropoint\s!height\zeropoint\s!depth\strutdp\relax}
+\permanent\protected\def\topstrut{\vrule\s!width\zeropoint\s!height\strutht\s!depth\zeropoint\relax}
+\permanent\protected\def\botstrut{\vrule\s!width\zeropoint\s!height\zeropoint\s!depth\strutdp\relax}
-\unexpanded\def\mathtopstrut{\setbox\scratchbox\mathstylehbox{(}\vrule\s!width\zeropoint\s!height\ht\scratchbox\s!depth\zeropoint\relax}
-\unexpanded\def\mathbotstrut{\setbox\scratchbox\mathstylehbox{(}\vrule\s!width\zeropoint\s!height\zeropoint\s!depth\dp\scratchbox\relax}
+\permanent\protected\def\mathtopstrut{\setbox\scratchbox\mathstylehbox{(}\vrule\s!width\zeropoint\s!height\ht\scratchbox\s!depth\zeropoint\relax}
+\permanent\protected\def\mathbotstrut{\setbox\scratchbox\mathstylehbox{(}\vrule\s!width\zeropoint\s!height\zeropoint\s!depth\dp\scratchbox\relax}
%D This module is reimplemented in \MKIV\ style.
@@ -102,7 +102,7 @@
\installcommandhandler \??mathfractions {mathfraction} \??mathfractions
-\let\setupmathfractions\setupmathfraction
+\aliased\let\setupmathfractions\setupmathfraction
% color only applies to rule, use regular color for rest
@@ -119,7 +119,7 @@
\c!rule=\v!auto]
\appendtoks
- \setuevalue{\currentmathfraction}{\math_frac{\currentmathfraction}}%
+ \instance\setuevalue{\currentmathfraction}{\math_frac{\currentmathfraction}}%
\to \everydefinemathfraction
% Sometimes users want control over the distances:
@@ -132,15 +132,15 @@
% why only displaystyle .. a bit weak
-\unexpanded\def\math_fraction_set_distance_top
+\protected\def\math_fraction_set_distance_top
{\Umathfractionnumup \displaystyle\m_math_fraction_distance_top
\relax}
-\unexpanded\def\math_fraction_set_distance_bot
+\protected\def\math_fraction_set_distance_bot
{\Umathfractiondenomdown\displaystyle\m_math_fraction_distance_bot
\relax}
-\unexpanded\def\math_fraction_set_distance_all
+\protected\def\math_fraction_set_distance_all
{\Umathfractionnumup \displaystyle\m_math_fraction_distance_top
\Umathfractiondenomdown\displaystyle\m_math_fraction_distance_bot
\relax}
@@ -191,7 +191,7 @@
\newdimen\d_math_fraction_margin
-\unexpanded\def\math_frac#1%
+\protected\def\math_frac#1%
{\begingroup
\edef\currentmathfraction{#1}%
%
@@ -217,18 +217,18 @@
\expandafter\math_frac_colored
\fi}
-\unexpanded\def\math_frac_wrapup
+\protected\def\math_frac_wrapup
{\ifempty\p_math_fraction_fences \else
\math_fenced_fenced_stop\p_math_fraction_fences
\fi
\endgroup}
-\unexpanded\def\math_frac_colored#1#2%
+\protected\def\math_frac_colored#1#2%
{\savecolor
\colo_helpers_activate\p_math_fractions_color
\math_frac_normal{\restorecolor#1}{\restorecolor#2}}
-\unexpanded\def\math_frac_normal
+\protected\def\math_frac_normal
{\expandnamespaceparameter\??mathfractionalternative\mathfractionparameter\c!alternative\v!inner}
% we use utfchar anyway so we can as well do all at the lua end
@@ -359,20 +359,20 @@
\let\normalxfrac\xfrac
-\unexpanded\def\xfrac#1#2{\normalxfrac{\let\xfrac\xxfrac#1}{\let\xfrac\xxfrac#2}}
+\protected\def\xfrac#1#2{\normalxfrac{\let\xfrac\xxfrac#1}{\let\xfrac\xxfrac#2}}
%D Spacing (sensitive for definition of \triggermathstyle:
% \ifcase\contextlmtxmode
-\unexpanded\def\nomathfractiongaps {\normalexpanded{\math_no_fraction_gaps \mathstyletrigger\mathstyle}} % maybe collect settings
-\unexpanded\def\overlaymathfractiongaps{\normalexpanded{\math_overlay_fraction_gaps\mathstyletrigger\mathstyle}} % maybe collect settings
+\permanent\protected\def\nomathfractiongaps {\normalexpanded{\math_no_fraction_gaps \mathstyletrigger\mathstyle}} % maybe collect settings
+\permanent\protected\def\overlaymathfractiongaps{\normalexpanded{\math_overlay_fraction_gaps\mathstyletrigger\mathstyle}} % maybe collect settings
-\unexpanded\def\math_no_fraction_gaps#1%
+\protected\def\math_no_fraction_gaps#1%
{\Umathfractionnumup #1\zeropoint
\Umathfractiondenomdown#1\zeropoint}
-\unexpanded\def\math_overlay_fraction_gaps#1%
+\protected\def\math_overlay_fraction_gaps#1%
{\Umathfractionnumup #1\zeropoint
\Umathfractionnumvgap #1\zeropoint
%Umathfractionrule #1\zeropoint
@@ -381,11 +381,11 @@
% \else
-% \unexpanded\def\math_no_fraction_gaps
+% \protected\def\math_no_fraction_gaps
% {\Umathfractionnumup \mathstyle\zeropoint
% \Umathfractiondenomdown\mathstyle\zeropoint}
%
-% \unexpanded\def\math_overlay_fraction_gaps
+% \protected\def\math_overlay_fraction_gaps
% {\Umathfractionnumup \mathstyle\zeropoint
% \Umathfractionnumvgap \mathstyle\zeropoint
% %Umathfractionrule \mathstyle\zeropoint
@@ -486,7 +486,7 @@
\definemathfraction[d:sfrac][\c!alternative=\v!both ,\c!mathstyle={\s!cramped,\s!scriptscript}]
\definemathfraction[d:dfrac][\c!alternative=\v!inner,\c!mathstyle=\s!display]
-%D \unexpanded\def\ShowMathFractions#1#2%
+%D \protected\def\ShowMathFractions#1#2%
%D {\dontleavehmode
%D \begingroup
%D \showmathstruts
@@ -502,17 +502,17 @@
%D \ShowMathFractions{1}{b}\par
%D \blank
-\unexpanded\def\frac {\csname\inlineordisplaymath id:frac\endcsname}
-\unexpanded\def\tfrac{\csname\inlineordisplaymath id:tfrac\endcsname}
-\unexpanded\def\sfrac{\csname\inlineordisplaymath id:sfrac\endcsname}
-\unexpanded\def\dfrac{\csname\inlineordisplaymath id:dfrac\endcsname}
+\permanent\protected\def\frac {\csname\inlineordisplaymath id:frac\endcsname}
+\permanent\protected\def\tfrac{\csname\inlineordisplaymath id:tfrac\endcsname}
+\permanent\protected\def\sfrac{\csname\inlineordisplaymath id:sfrac\endcsname}
+\permanent\protected\def\dfrac{\csname\inlineordisplaymath id:dfrac\endcsname}
\definemathfraction[ams] [\c!strut=\v!no,\c!alternative=\v!outer]
\definemathfraction[i:ams:frac][ams][\c!mathstyle={\s!cramped,\s!text}]
\definemathfraction[d:ams:frac][ams][\c!mathstyle={\s!cramped,\s!display}]
-\unexpanded\def\ctxfrac{\csname\inlineordisplaymath id:frac\endcsname}
-\unexpanded\def\amsfrac{\csname\inlineordisplaymath id:ams:frac\endcsname}
+\permanent\protected\def\ctxfrac{\csname\inlineordisplaymath id:frac\endcsname}
+\permanent\protected\def\amsfrac{\csname\inlineordisplaymath id:ams:frac\endcsname}
% \appendtoks
% \doifelse{\mathfractionparameter\c!option}{ams}%
@@ -522,17 +522,17 @@
\appendtoks
\doifelse{\mathematicsparameter\c!fractions}{ams}%
- {\let\frac\amsfrac}%
- {\let\frac\ctxfrac}%
+ {\enforced\let\frac\amsfrac}%
+ {\enforced\let\frac\ctxfrac}%
\to \everysetupmathematics
% \definemathfraction[ddfrac][\c!mathstyle=\s!display]
% \definemathfraction[ttfrac][\c!mathstyle=\s!text]
% \definemathfraction[ssfrac][\c!mathstyle=\s!script]
-% \unexpanded\def\binom #1#2{{\Ustack {{#1}\normalabovewithdelims()\zeropoint{#2}}}}
-% \unexpanded\def\dbinom#1#2{{\displaystyle{{#1}\normalabovewithdelims()\zeropoint{#2}}}}
-% \unexpanded\def\tbinom#1#2{{\textstyle {{#1}\normalabovewithdelims()\zeropoint{#2}}}}
+% \protected\def\binom #1#2{{\Ustack {{#1}\normalabovewithdelims()\zeropoint{#2}}}}
+% \protected\def\dbinom#1#2{{\displaystyle{{#1}\normalabovewithdelims()\zeropoint{#2}}}}
+% \protected\def\tbinom#1#2{{\textstyle {{#1}\normalabovewithdelims()\zeropoint{#2}}}}
\definemathfraction
[binom]
@@ -577,7 +577,7 @@
%D
%D \getbuffer
-\unexpanded\def\cfrac
+\permanent\protected\def\cfrac
{\doifelsenextoptionalcs\math_cfrac_yes\math_cfrac_nop}
\def\math_cfrac_nop {\math_cfrac_indeed[cc]}
@@ -617,28 +617,25 @@
%D These macros are based on Michael J.~Downes posting on
%D comp.text.tex on 2001/12/06 but adapted a bit.
-\unexpanded\def\splitfrac #1#2%
- {{\textstyle {{\textstyle#1\quad\hfill}\normalabove\zeropoint{\textstyle\hfill\quad\mathstrut#2}}}}
-
-\unexpanded\def\splitdfrac#1#2%
- {{\displaystyle{{ #1\quad\hfill}\normalabove\zeropoint{ \hfill\quad\mathstrut#2}}}}
+\protected\def\splitfrac #1#2{{\textstyle {{\textstyle#1\quad\hfill}\normalabove\zeropoint{\textstyle\hfill\quad\mathstrut#2}}}}
+\protected\def\splitdfrac#1#2{{\displaystyle{{ #1\quad\hfill}\normalabove\zeropoint{ \hfill\quad\mathstrut#2}}}}
%D For testing:
-% \unexpanded\def\ShowMathFractions#1#2%
+% \protected\def\ShowMathFractions#1#2%
% {\mathematics{x+\tfrac{#1}{#2}+1+\frac{#1}{#2}+2+\sfrac{#1}{#2}+g}}
%D More fracking (for Alan):
-\unexpanded\def\math_frac_colored_vulgar#1#2%
+\protected\def\math_frac_colored_vulgar#1#2%
{\savecolor
\colo_helpers_activate\p_math_fractions_color
{\restorecolor#1}\Uskewed/{\restorecolor#2}}
-\unexpanded\def\math_frac_normal_vulgar#1#2%
+\protected\def\math_frac_normal_vulgar#1#2%
{{#1}\Uskewed/{#2}}
-\unexpanded\def\vfrac#1#2%
+\permanent\protected\def\vfrac#1#2%
{\bgroup
\edef\p_math_fractions_color{\namedmathfractionparameter\s!vfrac\c!color}%
\ifempty\p_math_fractions_color
@@ -712,12 +709,12 @@
% {\math_stylebuilders_sqrt\scriptstyle \textface{#1}{#2}{#3}}%
% {\math_stylebuilders_sqrt\scriptscriptstyle\textface{#1}{#2}{#3}}}
-% \unexpanded\def\mthfrac#1#2#3{[mthfrac: #1 #2 #3]}
-% \unexpanded\def\mthsqrt#1#2#3{[mthsqrt: #1 #2 #3]}
+% \protected\def\mthfrac#1#2#3{[mthfrac: #1 #2 #3]}
+% \protected\def\mthsqrt#1#2#3{[mthsqrt: #1 #2 #3]}
% used for prototyping \Uskewed
%
-% \unexpanded\def\skewedfractiona#1#2{%
+% \protected\def\skewedfractiona#1#2{%
% \raise
% \Umathskewedfractionvgap\textstyle
% \hbox\bgroup
@@ -733,7 +730,7 @@
% \egroup
% }
%
-% \unexpanded\def\skewedfractionb#1#2{%
+% \protected\def\skewedfractionb#1#2{%
% \raise
% \Umathskewedfractionvgap\textstyle
% \hbox\bgroup
diff --git a/tex/context/base/mkiv/mult-aux.mkxl b/tex/context/base/mkiv/mult-aux.mkxl
index 49f473874..da86888c5 100644
--- a/tex/context/base/mkiv/mult-aux.mkxl
+++ b/tex/context/base/mkiv/mult-aux.mkxl
@@ -274,7 +274,7 @@
\def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter}
\protected\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9% inlining \csname*\endcsname is more efficient (#3 and #6 only)
- {\ifx#2\relax\let#2\empty\fi % it is hardly faster but produces less expansion tracing
+ {\ifx#2\relax\mutable\let#2\empty\fi % it is hardly faster but produces less expansion tracing
\frozen\def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}%
\frozen\def#4##1##2{\ifcsname##1:##2\endcsname##1:##2\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}%
\frozen\edef#5##1##2{\noexpand\ifx##1\relax\??empty\noexpand\else\noexpand#4##1{##2}\noexpand\fi}% is {} needed around ##1 ?
@@ -309,7 +309,7 @@
\expandafter\noexpand\csname root#2parameter\endcsname}}
\protected\def\mult_interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9%
- {\ifx#2\relax\let#2\empty\fi
+ {\ifx#2\relax\mutable\let#2\empty\fi
\frozen\def#3##1{#1#4{#1#2}{##1}:}% leading #1 was missing .. is this one used?
\frozen\def#4##1##2{\ifcsname##1:##2\endcsname##1\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}%
\frozen\def#5##1##2{\ifx##1\relax\else#4##1{##2}\fi}%
@@ -338,7 +338,7 @@
% \startinterface english
\protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6%
- {\ifx#2\relax\let#2\empty\fi
+ {\ifx#2\relax\mutable\let#2\empty\fi
\frozen\protected\def#3##1{\defcsname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate)
\frozen\protected\def#4##1{\edefcsname#1#2:##1\endcsname}% ##1 {##2} (braces are mandate)
\frozen\protected\def#5##1{\letcsname#1#2:##1\endcsname}% ##1 ##2
@@ -395,7 +395,7 @@
\def\getcurrentparentchain#1#2{\begincsname#1#2:\s!chain\endcsname}
\protected\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8% why is \expanded still needed in clones
- {\ifx#4\relax\let#4\empty\fi % see \defineregister
+ {\ifx#4\relax\mutable\let#4\empty\fi % see \defineregister
\newtoks#5%
\newtoks#6%
\frozen\tolerant\protected\def#2[##1]##*[##2]##*[##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child]
@@ -458,7 +458,7 @@
\expandafter\noexpand\csname saved_defined_#2\endcsname}}
\protected\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8%
- {\ifx#3\relax\let#3\empty\fi
+ {\ifx#3\relax\mutable\let#3\empty\fi
\protected\def#5{\mult_interfaces_get_parameters{#1#3:}}% no every ! don't change it
\newtoks#4%
\newtoks#7%
@@ -496,7 +496,7 @@
\let\doingrootsetroot \plusfour % \setuplayout
\protected\def\mult_interfaces_install_switch_setup_handler_a#1#2#3%
- {\ifx#2\relax\let#2\empty\fi
+ {\ifx#2\relax\mutable\let#2\empty\fi
\frozen\protected\def#3{\mult_interfaces_get_parameters{#1#2:}}}
\protected\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9%
@@ -572,7 +572,7 @@
\expandafter\noexpand\csname everysetup#2root\endcsname}}
\protected\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8%
- {\ifx#3\relax\let#3\empty\fi
+ {\ifx#3\relax\mutable\let#3\empty\fi
\frozen\protected\def#5{\mult_interfaces_get_parameters{#1#3:}}%
\newtoks#4%
\frozen\tolerant\protected\def#2[##1]##*[##2]##*[##3]%
@@ -1070,12 +1070,12 @@
% this one that often. It's more about less tracing than speed here.
\permanent\protected\def\installmacrostack#1%
- {\ifdefined#1\else\let#1\empty\fi
+ {\ifdefined#1\else\mutable\let#1\empty\fi
\global\protected\defcsname push_macro_\csstring#1\endcsname{\localpushmacro#1}%
\global\protected\defcsname pop_macro_\csstring#1\endcsname{\localpopmacro #1}}
\permanent\protected\def\installglobalmacrostack#1%
- {\ifdefined#1\else\glet#1\empty\fi
+ {\ifdefined#1\else\mutable\glet#1\empty\fi
\global\protected\defcsname push_macro_\csstring#1\endcsname{\globalpushmacro#1}%
\global\protected\defcsname pop_macro_\csstring#1\endcsname{\globalpopmacro #1}}
diff --git a/tex/context/base/mkiv/pack-rul.mkxl b/tex/context/base/mkiv/pack-rul.mkxl
index 07aae0c92..126e5c5d3 100644
--- a/tex/context/base/mkiv/pack-rul.mkxl
+++ b/tex/context/base/mkiv/pack-rul.mkxl
@@ -84,7 +84,7 @@
\protected\def\doinstallinheritedframed#1#2#3#4#5#6#7#8#9%
{\enforced\def#5##1##2{\ifx##1\relax#6{##2}\else#4{##1}{##2}\fi}%
\enforced\def#6##1{\ifcsname\??framed:##1\endcsname\??framed:##1\else\??empty\fi}% root
- \protected\def#8%
+ \frozen\instance\protected\def#8%
{\bgroup
\bgroup
\inframedtrue
@@ -93,7 +93,7 @@
\enforced\let\framedparameterhash#3%
\enforced\let\setupcurrentframed #7%
\pack_framed_process_indeed}%
- \protected\def#9%
+ \frozen\instance\protected\def#9%
{\bgroup
\inframedtrue
\enforced\let\currentframed #1%
@@ -190,7 +190,7 @@
\permanent\protected\def\definesimplifiedframed[#1]% no settings
{\defineframed[#1][\??simplifiedframed]%
- \letcsname#1\endcsname\undefined}
+ \enforced\letcsname#1\endcsname\undefined}
\letcsname\??simplifiedframed\endcsname\undefined
@@ -1877,7 +1877,7 @@
\newtoks \t_pack_framed_mathframed
\appendtoks
- \setuevalue{\currentmathframed}{\pack_framed_mathframed{\currentmathframed}}%
+ \frozen\instance\setuevalue{\currentmathframed}{\pack_framed_mathframed{\currentmathframed}}%
\to \everydefinemathframed
\protected\def\pack_framed_mathframed#1%
@@ -2631,9 +2631,9 @@
\c!margin=\v!standard]
\appendtoks
- \setuevalue{\e!start\currentframedtext}{\pack_framed_text_start {\currentframedtext}}%
- \setuevalue{\e!stop \currentframedtext}{\pack_framed_text_stop }%
- \setuevalue {\currentframedtext}{\pack_framed_text_direct{\currentframedtext}}%
+ \frozen\instance\setuevalue{\e!start\currentframedtext}{\pack_framed_text_start {\currentframedtext}}%
+ \frozen\instance\setuevalue{\e!stop \currentframedtext}{\pack_framed_text_stop }%
+ \frozen\instance\setuevalue {\currentframedtext}{\pack_framed_text_direct{\currentframedtext}}%
\to \everydefineframedtext
\setvalue{\??framedtextlocation\v!left }{\letframedtextparameter\c!left \relax
@@ -2841,7 +2841,7 @@
\to \everypresetframed
\appendtoks
- \setuevalue\currentframed{\pack_framed_defined_process[\currentframed]}%
+ \frozen\instance\setuevalue{\currentframed}{\pack_framed_defined_process[\currentframed]}%
\to \everydefineframed
\newcount\c_temp_framed_crap
@@ -2862,7 +2862,7 @@
\setupcurrentframed[#2]% here !
\pack_framed_process_indeed}
-\let\placeframed\pack_framed_defined_process % new per 2012/04/23
+\aliased\let\placeframed\pack_framed_defined_process % new per 2012/04/23
%D We can do:
%D
diff --git a/tex/context/base/mkiv/spac-hor.mkxl b/tex/context/base/mkiv/spac-hor.mkxl
index 3d9729916..54f360d83 100644
--- a/tex/context/base/mkiv/spac-hor.mkxl
+++ b/tex/context/base/mkiv/spac-hor.mkxl
@@ -654,8 +654,8 @@
\c!default=\v!middle]
\appendtoks
- \setuevalue{\e!start\currentnarrower}{\spac_narrower_start[\currentnarrower]}%
- \setuevalue{\e!stop \currentnarrower}{\spac_narrower_stop}%
+ \frozen\instance\setuevalue{\e!start\currentnarrower}{\spac_narrower_start[\currentnarrower]}%
+ \frozen\instance\setuevalue{\e!stop \currentnarrower}{\spac_narrower_stop}%
\to \everydefinenarrower
\permanent\protected\def\installnarrowermethod#1#2%
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 5c22acd41..46fb57d00 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 0b64f35bb..0b613e4d1 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-con.mklx b/tex/context/base/mkiv/strc-con.mklx
index 5d5eba056..bdc18de81 100644
--- a/tex/context/base/mkiv/strc-con.mklx
+++ b/tex/context/base/mkiv/strc-con.mklx
@@ -121,9 +121,11 @@
\instance\setevalue{\??constructionclass\currentconstruction}{\constructionparameter\s!handler}%
\to \everydefineconstruction
+% todo: inhibit this when we have a different handle .. current we cannot do \frozen
+
\appendtoks
\ifconditional\c_strc_constructions_define_commands
- %% \setuevalue{\e!start\currentconstruction}{\strc_constructions_start{\currentconstruction}}%
+ %% \instance\setuevalue{\e!start\currentconstruction}{\strc_constructions_start{\currentconstruction}}%
\instance\setuevalue{\e!start\currentconstruction}{\strc_constructions_start[\currentconstruction]}%
\instance\setuevalue{\e!stop \currentconstruction}{\strc_constructions_stop}%
\fi
diff --git a/tex/context/base/mkiv/strc-des.mklx b/tex/context/base/mkiv/strc-des.mklx
index 11fca5869..e63512c7f 100644
--- a/tex/context/base/mkiv/strc-des.mklx
+++ b/tex/context/base/mkiv/strc-des.mklx
@@ -67,9 +67,9 @@
\defineconstruction[\currentdescription][\s!handler=\v!description,\c!level=1]%
\fi
% We can combine these but in tracing (or errors) using a different caller is nicer.
- \instance\setuevalue {\currentdescription}{\strc_descriptions_command[\currentdescription]}%
- \instance\setuevalue{\e!start\currentdescription}{\strc_descriptions_start [\currentdescription]}%
- \instance\setuevalue{\e!stop \currentdescription}{\strc_descriptions_stop}%
+ \frozen\instance\setuevalue {\currentdescription}{\strc_descriptions_command[\currentdescription]}%
+ \frozen\instance\setuevalue{\e!start\currentdescription}{\strc_descriptions_start [\currentdescription]}%
+ \frozen\instance\setuevalue{\e!stop \currentdescription}{\strc_descriptions_stop}%
\to \everydefinedescription
\let\p_strc_constructions_title \empty
diff --git a/tex/context/base/mkiv/strc-doc.mkxl b/tex/context/base/mkiv/strc-doc.mkxl
new file mode 100644
index 000000000..046f0b086
--- /dev/null
+++ b/tex/context/base/mkiv/strc-doc.mkxl
@@ -0,0 +1,45 @@
+%D \module
+%D [ file=strc-doc,
+%D version=2008.10.20,
+%D title=\CONTEXT\ Structure Macros,
+%D subtitle=Document Structure,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Structure Macros / Document Structure}
+
+\registerctxluafile{strc-doc}{}
+
+\unprotect
+
+%D This will move:
+
+\permanent\protected\def\setstructuresynchronization#1% todo: use ctxcontext
+ {\clf_setinternalreference
+ prefix {\currentstructurereferenceprefix}%
+ reference {\currentstructurereference}
+ internal \locationcount
+ view {\interactionparameter\c!focus}%
+ \relax
+ \enforced\xdef\currentstructureattribute
+ {\the\lastdestinationattribute}%
+ \enforced\xdef\currentstructuresynchronize
+ {\currentstructuresynchronize
+ \strc_lists_inject_enhance{#1}}}
+
+\permanent\protected\def\setstructurecomponentsynchronization#1% todo: use ctxcontext
+ {\clf_setinternalreference
+ prefix {\currentstructurecomponentreferenceprefix}%
+ reference {\currentstructurecomponentreference}
+ internal \locationcount
+ view {\interactionparameter\c!focus}%
+ \relax
+ \enforced\xdef\currentstructurecomponentattribute {\the\lastdestinationattribute}%
+ \enforced\xdef\currentstructurecomponentsynchronize{\strc_lists_inject_enhance{#1}}}
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/strc-enu.mklx b/tex/context/base/mkiv/strc-enu.mklx
index 011bbedf9..0561ad340 100644
--- a/tex/context/base/mkiv/strc-enu.mklx
+++ b/tex/context/base/mkiv/strc-enu.mklx
@@ -134,12 +134,12 @@
\setevalue{\??enumeration#tag:\s!parent}{\??enumeration}}%
{\normalexpanded{\defineconstruction[#tag][#parent][\s!handler=\v!enumeration,\c!level=#level]}%
\setevalue{\??enumeration#tag:\s!parent}{\??enumeration#parent}}%
- \instance\setuevalue{\e!next #tag}{\strc_enumerations_next {#tag}{\number#level}}% obsolete
- \instance\setuevalue{\c!reset#tag}{\strc_enumerations_reset {#tag}{\number#level}}% obsolete
- %instance\setuevalue{\c!set #tag}{\strc_enumerations_set {#tag}{\number#level}}% obsolete
- \instance\setuevalue {#tag}{\strc_enumerations_command[#tag]}% we could pass level here as well (faster)
- \instance\setuevalue{\e!start#tag}{\strc_enumerations_start [#tag]}% we could pass level here as well (faster)
- \instance\setuevalue{\e!stop #tag}{\strc_enumerations_stop }}
+ \frozen\instance\setuevalue{\e!next #tag}{\strc_enumerations_next {#tag}{\number#level}}% obsolete
+ \frozen\instance\setuevalue{\c!reset#tag}{\strc_enumerations_reset {#tag}{\number#level}}% obsolete
+ %frozen\instance\setuevalue{\c!set #tag}{\strc_enumerations_set {#tag}{\number#level}}% obsolete
+ \frozen\instance\setuevalue {#tag}{\strc_enumerations_command[#tag]}% we could pass level here as well (faster)
+ \frozen\instance\setuevalue{\e!start#tag}{\strc_enumerations_start [#tag]}% we could pass level here as well (faster)
+ \frozen\instance\setuevalue{\e!stop #tag}{\strc_enumerations_stop }}
\appendtoks
\ifempty\currentenumerationparent
diff --git a/tex/context/base/mkiv/strc-itm.mklx b/tex/context/base/mkiv/strc-itm.mklx
index 0b9ae347f..c167e24a4 100644
--- a/tex/context/base/mkiv/strc-itm.mklx
+++ b/tex/context/base/mkiv/strc-itm.mklx
@@ -331,9 +331,9 @@
\aliased\let\setupitemgroups\setupitemgroup
\appendtoks
- \setuevalue{\e!start\currentitemgroup}{\startitemgroup[\currentitemgroup]}%
- \setuevalue{\e!stop \currentitemgroup}{\stopitemgroup}%
- \setuevalue{\e!setup\currentitemgroup\e!endsetup}{\setupitemgroup[\currentitemgroup]}% obsolete
+ \frozen\instance\setuevalue{\e!start\currentitemgroup}{\startitemgroup[\currentitemgroup]}%
+ \frozen\instance\setuevalue{\e!stop \currentitemgroup}{\stopitemgroup}%
+ \frozen\instance\setuevalue{\e!setup\currentitemgroup\e!endsetup}{\setupitemgroup[\currentitemgroup]}% obsolete
\let\currentparentitemgroup\currentitemgroup
\definecounter[\v_strc_itemgroups_counter]%
\to \everydefineitemgroup
diff --git a/tex/context/base/mkiv/strc-lab.mkxl b/tex/context/base/mkiv/strc-lab.mkxl
index a480f782e..95bfa82df 100644
--- a/tex/context/base/mkiv/strc-lab.mkxl
+++ b/tex/context/base/mkiv/strc-lab.mkxl
@@ -58,15 +58,15 @@
{\normalexpanded{\defineconstruction[#1][#3][\s!handler=\v!label,\c!level=#2]}%
\setevalue{\??label#1:\s!parent}{\??label#3}}%
\ifconditional\c_strc_constructions_define_commands
- \setuevalue{\e!next #1}{\strc_labels_next {#1}{\number#2}}% obsolete
- \setuevalue{\v!reset #1}{\strc_labels_reset {#1}{\number#2}}% obsolete % should be \e!reset anyway
- %setuevalue{\c!set #1}{\strc_labels_set {#1}{\number#2}}% obsolete
+ \frozen\instance\setuevalue{\e!next #1}{\strc_labels_next {#1}{\number#2}}% obsolete
+ \frozen\instance\setuevalue{\v!reset#1}{\strc_labels_reset{#1}{\number#2}}% obsolete % should be \e!reset anyway
+ %frozen\instance\setuevalue{\c!set #1}{\strc_labels_set {#1}{\number#2}}% obsolete
\ifcsname\v!current#1\endcsname
% we play safe
\else
\setuevalue{\v!current#1}{\strc_labels_current{#1}}% % obsolete % should be \e!current anyway
\fi
- \setuevalue{#1}{\strc_labels_command[#1]}%
+ \frozen\instance\setuevalue{#1}{\strc_labels_command[#1]}%
\fi}
% todo: \strc_labels_command for user
diff --git a/tex/context/base/mkiv/strc-sec.mkxl b/tex/context/base/mkiv/strc-sec.mkxl
index a6e9b553c..445e042b2 100644
--- a/tex/context/base/mkiv/strc-sec.mkxl
+++ b/tex/context/base/mkiv/strc-sec.mkxl
@@ -474,8 +474,8 @@
\to \everyredefinehead
\appendtoks
- \instance\setuevalue{\e!start\currenthead}{\strc_sectioning_start[\currenthead]}%
- \instance\setuevalue{\e!stop \currenthead}{\strc_sectioning_stop [\currenthead]}%
+ \frozen\instance\setuevalue{\e!start\currenthead}{\strc_sectioning_start[\currenthead]}%
+ \frozen\instance\setuevalue{\e!stop \currenthead}{\strc_sectioning_stop [\currenthead]}%
\to \everydefinehead
% so \subject as well as \section will need two commands when ownnumber
diff --git a/tex/context/base/mkiv/supp-dir.mkiv b/tex/context/base/mkiv/supp-dir.mkiv
index e6c2a5869..0b6437099 100644
--- a/tex/context/base/mkiv/supp-dir.mkiv
+++ b/tex/context/base/mkiv/supp-dir.mkiv
@@ -13,41 +13,34 @@
\unprotect
-\chardef\directionlefttoright\zerocount
-\chardef\directionrighttoleft\plusone
-
-\edef\??bdir{\ifdefined\bodydir bdir\else direction\fi}
-
-\protected\edef\naturalhbox {\hbox \??bdir\directionlefttoright}
-\protected\edef\naturalvbox {\vbox \??bdir\directionlefttoright}
-\protected\edef\naturalvtop {\vtop \??bdir\directionlefttoright}
-\protected\edef\naturalhpack {\hpack \??bdir\directionlefttoright}
-\protected\edef\naturalvpack {\vpack \??bdir\directionlefttoright}
-\protected\edef\naturaltpack {\tpack \??bdir\directionlefttoright}
-
-\protected\edef\reversehbox {\hbox \??bdir\directionrighttoleft}
-\protected\edef\reversevbox {\vbox \??bdir\directionrighttoleft}
-\protected\edef\reversevtop {\vtop \??bdir\directionrighttoleft}
-\protected\edef\reversehpack {\hpack \??bdir\directionrighttoleft}
-\protected\edef\reversevpack {\vpack \??bdir\directionrighttoleft}
-\protected\edef\reversetpack {\tpack \??bdir\directionrighttoleft}
-
-\ifdefined\bodydir
- \let\bodydir \undefined \let\normalbodydir \undefined
- \let\bodydirection\undefined \let\normalbodydirection\undefined
-\fi
-
-\ifdefined\pagedir
- \let\pagedir \undefined \let\normalpagedir \undefined
- \let\pagedirection\undefined \let\normalpagedirection\undefined
-\fi
+% \immutable\chardef\directionlefttoright\zerocount
+% \immutable\chardef\directionrighttoleft\plusone
+
+\setnewconstant\directionlefttoright\zerocount
+\setnewconstant\directionrighttoleft\plusone
+
+\immutable\edef\??bdir{\ifdefined\bodydir bdir\else direction\fi}
+
+\permanent\protected\edef\naturalhbox {\hbox \??bdir\directionlefttoright}
+\permanent\protected\edef\naturalvbox {\vbox \??bdir\directionlefttoright}
+\permanent\protected\edef\naturalvtop {\vtop \??bdir\directionlefttoright}
+\permanent\protected\edef\naturalhpack {\hpack \??bdir\directionlefttoright}
+\permanent\protected\edef\naturalvpack {\vpack \??bdir\directionlefttoright}
+\permanent\protected\edef\naturaltpack {\tpack \??bdir\directionlefttoright}
+
+\permanent\protected\edef\reversehbox {\hbox \??bdir\directionrighttoleft}
+\permanent\protected\edef\reversevbox {\vbox \??bdir\directionrighttoleft}
+\permanent\protected\edef\reversevtop {\vtop \??bdir\directionrighttoleft}
+\permanent\protected\edef\reversehpack {\hpack \??bdir\directionrighttoleft}
+\permanent\protected\edef\reversevpack {\vpack \??bdir\directionrighttoleft}
+\permanent\protected\edef\reversetpack {\tpack \??bdir\directionrighttoleft}
% \expanded{\defineactivecharacter \number"2000E} {\textdirection\directionrighttoleft\relax}
% \expanded{\defineactivecharacter \number"2000F} {\textdirection\directionlefttoright\relax}
\def\syst_direction_string#1{\ifcase#1=\plusone r2l\else l2r\fi}
-\protected\def\showdirsinmargin
+\permanent\protected\def\showdirsinmargin
{\normalexpanded{\inleft{\naturalhbox
{\ttxx[\syst_direction_string\pardirection,\syst_direction_string\textdirection]}}}}
diff --git a/tex/context/base/mkiv/supp-dir.mkxl b/tex/context/base/mkiv/supp-dir.mkxl
new file mode 100644
index 000000000..e6c2a5869
--- /dev/null
+++ b/tex/context/base/mkiv/supp-dir.mkxl
@@ -0,0 +1,54 @@
+%D \module
+%D [ file=supp-dir,
+%D version=2004.11.11,
+%D title=\CONTEXT\ Support Macros,
+%D subtitle=Directional Things,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\chardef\directionlefttoright\zerocount
+\chardef\directionrighttoleft\plusone
+
+\edef\??bdir{\ifdefined\bodydir bdir\else direction\fi}
+
+\protected\edef\naturalhbox {\hbox \??bdir\directionlefttoright}
+\protected\edef\naturalvbox {\vbox \??bdir\directionlefttoright}
+\protected\edef\naturalvtop {\vtop \??bdir\directionlefttoright}
+\protected\edef\naturalhpack {\hpack \??bdir\directionlefttoright}
+\protected\edef\naturalvpack {\vpack \??bdir\directionlefttoright}
+\protected\edef\naturaltpack {\tpack \??bdir\directionlefttoright}
+
+\protected\edef\reversehbox {\hbox \??bdir\directionrighttoleft}
+\protected\edef\reversevbox {\vbox \??bdir\directionrighttoleft}
+\protected\edef\reversevtop {\vtop \??bdir\directionrighttoleft}
+\protected\edef\reversehpack {\hpack \??bdir\directionrighttoleft}
+\protected\edef\reversevpack {\vpack \??bdir\directionrighttoleft}
+\protected\edef\reversetpack {\tpack \??bdir\directionrighttoleft}
+
+\ifdefined\bodydir
+ \let\bodydir \undefined \let\normalbodydir \undefined
+ \let\bodydirection\undefined \let\normalbodydirection\undefined
+\fi
+
+\ifdefined\pagedir
+ \let\pagedir \undefined \let\normalpagedir \undefined
+ \let\pagedirection\undefined \let\normalpagedirection\undefined
+\fi
+
+% \expanded{\defineactivecharacter \number"2000E} {\textdirection\directionrighttoleft\relax}
+% \expanded{\defineactivecharacter \number"2000F} {\textdirection\directionlefttoright\relax}
+
+\def\syst_direction_string#1{\ifcase#1=\plusone r2l\else l2r\fi}
+
+\protected\def\showdirsinmargin
+ {\normalexpanded{\inleft{\naturalhbox
+ {\ttxx[\syst_direction_string\pardirection,\syst_direction_string\textdirection]}}}}
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/syst-aux.mkxl b/tex/context/base/mkiv/syst-aux.mkxl
index 9ae18ab71..0638600c2 100644
--- a/tex/context/base/mkiv/syst-aux.mkxl
+++ b/tex/context/base/mkiv/syst-aux.mkxl
@@ -60,7 +60,7 @@
\aliased \let\startlmtxmode\relax
\aliased \let\stoplmtxmode \relax
\permanent\def\startmkivmode#-\stopmkivmode{}
-\aliased \let\stopmkivmode \relax
+\permanent\let\stopmkivmode \relax
%D As we don't have namespace definers yet, we use a special one. Later we will
%D do a better job.
@@ -237,7 +237,7 @@
%D Reserved macros for tests:
-\let\donothing\empty
+\aliased\let\donothing\empty
\let\m_syst_string_one \empty
\let\m_syst_string_two \empty
@@ -262,16 +262,16 @@
\let\m_syst_action_yes\relax
\let\m_syst_action_nop\relax
-\protected\def\doifelsenextchar#1#2#3% #1 should not be {} !
+\permanent\protected\def\doifelsenextchar#1#2#3% #1 should not be {} !
{\def\m_syst_action_yes{#2}%
\def\m_syst_action_nop{#3}%
\futureexpandis#1\m_syst_action_yes\m_syst_action_nop}
-\protected\def\doifelsenextcharcs % #1#2#3% #1 should not be {} !
+\permanent\protected\def\doifelsenextcharcs % #1#2#3% #1 should not be {} !
{\futureexpandis}
-\let\doifnextcharelse \doifelsenextchar
-\let\doifnextcharcselse\doifelsenextcharcs
+\aliased\let\doifnextcharelse \doifelsenextchar
+\aliased\let\doifnextcharcselse\doifelsenextcharcs
%D Because we will mostly use this macro for testing if the next character is \type
%D {[}, we also make a slightly faster variant as it is not uncommon to have tens of
@@ -282,34 +282,34 @@
%D reputations depends on understanding obscure macro definitions will love the more
%D low level variants.
-\protected\def\doifelsenextoptional#1#2%
+\permanent\protected\def\doifelsenextoptional#1#2%
{\def\m_syst_action_yes{#1}%
\def\m_syst_action_nop{#2}%
\futureexpandis[\m_syst_action_yes\m_syst_action_nop}
-\protected\def\doifelsenextoptionalcs
+\permanent\protected\def\doifelsenextoptionalcs
{\futureexpandis[}
-\let\doifnextoptionalelse \doifelsenextoptional
-\let\doifnextoptionalcselse\doifelsenextoptionalcs
+\aliased\let\doifnextoptionalelse \doifelsenextoptional
+\aliased\let\doifnextoptionalcselse\doifelsenextoptionalcs
-\protected\def\doifelsenextbgroup#1#2%
+\permanent\protected\def\doifelsenextbgroup#1#2%
{\def\m_syst_action_yes{#1}%
\def\m_syst_action_nop{#2}%
\futureexpandis\bgroup\m_syst_action_yes\m_syst_action_nop}
-\protected\def\doifelsenextbgroupcs % #1#2
+\permanent\protected\def\doifelsenextbgroupcs % #1#2
{\futureexpandis\bgroup}
-\let\doifnextbgroupelse \doifelsenextbgroup
-\let\doifnextbgroupcselse\doifelsenextbgroupcs
+\aliased\let\doifnextbgroupelse \doifelsenextbgroup
+\aliased\let\doifnextbgroupcselse\doifelsenextbgroupcs
-\protected\def\doifelsenextparenthesis#1#2%
+\permanent\protected\def\doifelsenextparenthesis#1#2%
{\def\m_syst_action_yes{#1}%
\def\m_syst_action_nop{#2}%
\futureexpandis(\m_syst_action_yes\m_syst_action_nop}
-\let\doifnextparenthesiselse\doifelsenextparenthesis
+\aliased\let\doifnextparenthesiselse\doifelsenextparenthesis
%D The next one is handy in predictable situations:
@@ -320,16 +320,16 @@
\expandafter\m_syst_action_nop
\fi}
-\protected\def\doifelsefastoptionalcheck#1#2%
+\permanent\protected\def\doifelsefastoptionalcheck#1#2%
{\def\m_syst_action_yes{#1}%
\def\m_syst_action_nop{#2}%
\futureexpandis[\m_syst_action_yes\m_syst_action_nop}
-\protected\def\doifelsefastoptionalcheckcs
+\permanent\protected\def\doifelsefastoptionalcheckcs
{\futureexpandis[}
-\let\doiffastoptionalcheckelse \doifelsefastoptionalcheck
-\let\doiffastoptionalcheckcselse\doifelsefastoptionalcheckcs
+\aliased\let\doiffastoptionalcheckelse \doifelsefastoptionalcheck
+\aliased\let\doiffastoptionalcheckcselse\doifelsefastoptionalcheckcs
%D Here's one for skipping spaces and pars, handy for:
%D
@@ -354,7 +354,7 @@
%D The original kind of clumsy but working version is now replaced by a simple
%D macro. And it can be even less code in \LUAMETATEX:
-\let\assumelongusagecs\expandafterpars
+\aliased\let\assumelongusagecs\expandafterpars % so we can replace it
%D It's used to skip over empty lines in some constructs that we like to set up
%D spacy. We already permit par tokens (and equivalents) in math and some other
@@ -370,7 +370,7 @@
%D next space, which is why we need an extra one to achieve our goal. Such a \type
%D {\blankspace} has the meaning \typ {blank space}. A typical \TEX ie definition:
-\normalexpanded{\let\noexpand\blankspace=\space\space}
+\normalexpanded{\permanent\let\noexpand\blankspace=\space\space}
%D \macros
%D {setvalue,setgvalue,setevalue,setxvalue,
@@ -395,23 +395,23 @@
%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\defcsname#1\endcsname}
-\def\setgvalue #1{\global\defcsname#1\endcsname}
-\def\setevalue #1{\edefcsname#1\endcsname}
-\def\setxvalue #1{\global\edefcsname#1\endcsname}
-\def\getvalue #1{\csname#1\endcsname} % maybe: \begincsname#1\endcsname
-\def\letvalue #1{\letcsname#1\endcsname}
-\def\letgvalue #1{\global\letcsname#1\endcsname}
-\def\resetvalue #1{\letcsname#1\endcsname\empty}
-\def\undefinevalue#1{\letcsname#1\endcsname\undefined}
-\def\ignorevalue#1#2{\letcsname#1\endcsname\empty}
+\permanent\def\setvalue #1{\expandafter\defcsname#1\endcsname}
+\permanent\def\setgvalue #1{\global\defcsname#1\endcsname}
+\permanent\def\setevalue #1{\edefcsname#1\endcsname}
+\permanent\def\setxvalue #1{\global\edefcsname#1\endcsname}
+\permanent\def\getvalue #1{\csname#1\endcsname} % maybe: \begincsname#1\endcsname
+\permanent\def\letvalue #1{\letcsname#1\endcsname}
+\permanent\def\letgvalue #1{\global\letcsname#1\endcsname}
+\permanent\def\resetvalue #1{\letcsname#1\endcsname\empty}
+\permanent\def\undefinevalue#1{\letcsname#1\endcsname\undefined}
+\permanent\def\ignorevalue#1#2{\letcsname#1\endcsname\empty}
-\def\setuvalue #1{\protected\defcsname#1\endcsname}
-\def\setuevalue #1{\protected\edefcsname#1\endcsname}
-\def\setugvalue #1{\protected\global\defcsname#1\endcsname}
-\def\setuxvalue #1{\protected\global\edefcsname#1\endcsname}
+\permanent\def\setuvalue #1{\protected\defcsname#1\endcsname}
+\permanent\def\setuevalue #1{\protected\edefcsname#1\endcsname}
+\permanent\def\setugvalue #1{\protected\global\defcsname#1\endcsname}
+\permanent\def\setuxvalue #1{\protected\global\edefcsname#1\endcsname}
-\protected\def\getuvalue#1{\csname#1\endcsname}
+\permanent\protected\def\getuvalue#1{\csname#1\endcsname}
%D \macros
%D {globallet,glet}
@@ -420,7 +420,7 @@
%D save us some $300\times4=1200$ bytes of format file on a 32~bit system. Not that
%D it matters much today. But nowadays we can just alias to a primitive:
-\let\globallet\glet
+\aliased\let\globallet\glet
%D \macros
%D {doifundefined,doifdefined,
@@ -460,28 +460,28 @@
%D needs it. That kind of configuration happens elsewhere. These macros are (mostly
%D for historic reasons) fully expandable.
-\def\doifelseundefined#1%
+\permanent\def\doifelseundefined#1%
{\ifcsname#1\endcsname
\expandafter\secondoftwoarguments\else\expandafter\firstoftwoarguments
\fi}
-\def\doifelsedefined#1%
+\permanent\def\doifelsedefined#1%
{\ifcsname#1\endcsname
\expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments
\fi}
-\def\doifundefined#1%
+\permanent\def\doifundefined#1%
{\ifcsname#1\endcsname
\expandafter\gobbleoneargument\else\expandafter\firstofoneargument
\fi}
-\def\doifdefined#1%
+\permanent\def\doifdefined#1%
{\ifcsname#1\endcsname
\expandafter\firstofoneargument\else\expandafter\gobbleoneargument
\fi}
-\let\doifundefinedelse\doifelseundefined
-\let\doifdefinedelse \doifelsedefined
+\aliased\let\doifundefinedelse\doifelseundefined
+\aliased\let\doifdefinedelse \doifelsedefined
%D \macros
%D {letbeundefined}
@@ -491,13 +491,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:
-\protected\def\letbeundefined#1%
+\permanent\protected\def\letbeundefined#1%
{\letcsname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue
-\protected\def\localundefine#1% conditional
+\permanent\protected\def\localundefine#1% conditional
{\ifcsname#1\endcsname\letcsname#1\endcsname\undefined\fi}
-\protected\def\globalundefine#1% conditional
+\permanent\protected\def\globalundefine#1% conditional
{\ifcsname#1\endcsname\global\letcsname#1\endcsname\undefined\fi}
%D Beware, being \type {\undefined} in \ETEX\ means that the macro {\em is} defined!
@@ -506,7 +506,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}.
-\protected\def\doifelsealldefined#1%
+\permanent\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
@@ -516,7 +516,7 @@
\endgroup\expandafter\secondoftwoarguments
\fi}
-\let\doifalldefinedelse\doifelsealldefined
+\aliased\let\doifalldefinedelse\doifelsealldefined
\def\syst_helpers_do_if_all_defined_else#1%
{\ifcsname#1\endcsname\else
@@ -545,21 +545,21 @@
%D \type {\edef}'s and \type {\ifx} comparison works as well, but this saves tokens
%D and, more important, tracing clutter.
-\protected\def\doifelse#1#2%
+\permanent\protected\def\doifelse#1#2%
{\iftok{#1}{#2}%
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\protected\def\doif#1#2%
+\permanent\protected\def\doif#1#2%
{\iftok{#1}{#2}%
\expandafter\firstofoneargument
\else
\expandafter\gobbleoneargument
\fi}
-\protected\def\doifnot#1#2%
+\permanent\protected\def\doifnot#1#2%
{\iftok{#1}{#2}%
\expandafter\gobbleoneargument
\else
@@ -580,7 +580,7 @@
%D This time, the string is not expanded, but we use the dedicated empty checker
%D here.
-\protected\def\doifelseempty#1%
+\permanent\protected\def\doifelseempty#1%
{\def\m_syst_string_one{#1}%
\ifempty\m_syst_string_one
\expandafter\firstoftwoarguments
@@ -588,9 +588,9 @@
\expandafter\secondoftwoarguments
\fi}
-\let\doifemptyelse\doifelseempty
+\aliased\let\doifemptyelse\doifelseempty
-\protected\def\doifempty#1%
+\permanent\protected\def\doifempty#1%
{\def\m_syst_string_one{#1}%
\ifempty\m_syst_string_one
\expandafter\firstofoneargument
@@ -598,7 +598,7 @@
\expandafter\gobbleoneargument
\fi}
-\protected\def\doifnotempty#1%
+\permanent\protected\def\doifnotempty#1%
{\def\m_syst_string_one{#1}%
\ifempty\m_syst_string_one
\expandafter\gobbleoneargument
@@ -678,26 +678,26 @@
% But these do:
-\edef\a!comma{\expandtoken \ignorecatcode \commaasciicode}
-\edef\a!space{\expandtoken \ignorecatcode \spaceasciicode}
+\immutable\edef\a!comma{\expandtoken \ignorecatcode \commaasciicode}
+\immutable\edef\a!space{\expandtoken \ignorecatcode \spaceasciicode}
\normalexpanded {
- \protected \def \noexpand \doifelseinset#1#2%
+ \permanent \protected \def \noexpand \doifelseinset#1#2%
{\noexpand\ifhasxtoks{,\a!space#1,}{,#2,}%
\noexpand\expandafter\noexpand\firstoftwoarguments
\noexpand\else
\noexpand\expandafter\noexpand\secondoftwoarguments
\noexpand\fi}
- \protected \def \noexpand \doifinset#1#2%
+ \permanent \protected \def \noexpand \doifinset#1#2%
{\noexpand\ifhasxtoks{,\a!space#1,}{,#2,}%
\noexpand\expandafter\noexpand\firstofoneargument
\noexpand\else
\noexpand\expandafter\noexpand\gobbleoneargument
\noexpand\fi}
- \protected \def \noexpand \doifnotinset#1#2%
+ \permanent \protected \def \noexpand \doifnotinset#1#2%
{\noexpand\ifhasxtoks{,\a!space#1,}{,#2,}%
\noexpand\expandafter\noexpand\gobbleoneargument
\noexpand\else
@@ -708,7 +708,7 @@
%D Done.
-\let\doifinsetelse\doifelseinset
+\aliased\let\doifinsetelse\doifelseinset
%D \macros
%D {doifcommon,doifnotcommon,doifcommonelse}
@@ -738,11 +738,11 @@
% !9yes=\doifcommonelse{,a,}{,,,a,}{yes}{nop}
% !9yes=\doifcommonelse{,,a,}{,,,a,}{yes}{nop}
-\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}}
+\permanent\protected\def\doifelsecommon#1#2{\clf_doifelsecommon{#1}{#2}} % todo: define in lua
+\permanent\protected\def\doifcommon #1#2{\clf_doifcommon {#1}{#2}} % todo: define in lua
+\permanent\protected\def\doifnotcommon #1#2{\clf_doifnotcommon {#1}{#2}} % todo: define in lua
-\let\doifcommonelse\doifelsecommon
+\aliased\let\doifcommonelse\doifelsecommon
%D \macros
%D {processcommalist,processcommacommand,quitcommalist,
@@ -837,13 +837,13 @@
% \normalexpanded{\noexpand\expandafterspaces\syst_helpers_process_comma_item#1,}\ignorearguments\ignorearguments\ignorearguments
% \popmacro\commalistcommand}
-\protected\def\processcommalist[#*#+]#2%
+\permanent\protected\def\processcommalist[#*#+]#2%
{\pushmacro\commalistcommand
\def\commalistcommand{#2}%
\expandafterspaces\syst_helpers_process_comma_item#1,\ignorearguments\ignorearguments\ignorearguments
\popmacro\commalistcommand}
-\protected\def\processcommacommand[#*#+]#2%
+\permanent\protected\def\processcommacommand[#*#+]#2%
{\pushmacro\commalistcommand
\def\commalistcommand{#2}%
\normalexpanded{\noexpand\expandafterspaces\syst_helpers_process_comma_item#1,}\ignorearguments\ignorearguments\ignorearguments
@@ -859,8 +859,8 @@
\def\syst_helpers_process_comma_item_next_c#-\ignorearguments{\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_b}
\def\syst_helpers_process_comma_item_gobble#-\ignorearguments{}
-\protected\def\quitcommalist {\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_b}
-\protected\def\quitprevcommalist{\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_c}
+\permanent\protected\def\quitcommalist {\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_b}
+\permanent\protected\def\quitprevcommalist{\let\syst_helpers_process_comma_item_next\syst_helpers_process_comma_item_next_c}
%D \startbuffer
%D \def\foo#1{(#1)}
@@ -901,7 +901,7 @@
%D \def\command[#1]{... #1 ...}
%D \stoptyping
-\protected\def\processcommalistwithparameters[#1]#2%
+\permanent\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}
@@ -912,16 +912,16 @@
\let\syst_helpers_comma_list_step\relax
-\protected\def\startprocesscommalist[#1]#2\stopprocesscommalist
+\permanent\protected\def\startprocesscommalist[#1]#2\stopprocesscommalist
{\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}%
\processcommalist[#1]\syst_helpers_comma_list_step}
-\protected\def\startprocesscommacommand[#1]#2\stopprocesscommacommand
+\permanent\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}
-\let\stopprocesscommalist \relax
-\let\stopprocesscommacommand\relax
+\aliased\let\stopprocesscommalist \relax
+\aliased\let\stopprocesscommacommand\relax
%D \macros
%D {processaction,
@@ -984,7 +984,7 @@
#2%
\fi}
-\protected\def\processaction[#1]#2[%
+\permanent\protected\def\processaction[#1]#2[%
{\edef\m_syst_string_one{#1}%
\ifempty\m_syst_string_one
\let\syst_helpers_do_compare_process_action\syst_helpers_do_compare_process_action_a
@@ -1009,7 +1009,7 @@
\fi
\fi}
-\protected\def\processfirstactioninset[#1]%
+\permanent\protected\def\processfirstactioninset[#1]%
{\edef\m_syst_string_one{#1}%
\ifempty\m_syst_string_one
\expandafter\processaction
@@ -1047,7 +1047,7 @@
\processcommacommand[#1]\syst_process_action_in_set
\globalpopmacro\syst_process_action_in_set_all}
-\protected\def\processallactionsinset[#1]%
+\permanent\protected\def\processallactionsinset[#1]%
{\edef\m_syst_string_one{#1}%
\ifempty\m_syst_string_one
\expandafter\processaction
@@ -1063,7 +1063,7 @@
% \expandafterspaces\syst_helpers_process_comma_item#2#3\ignorearguments\ignorearguments\ignorearguments
% \popmacro\commalistcommand}
-\protected\def\processnextcommalist#1[#2#3]%
+\permanent\protected\def\processnextcommalist#1[#2#3]%
{\pushmacro\commalistcommand
\def\commalistcommand{#1}%
\expandafterspaces\syst_helpers_process_comma_item#2#3\ignorearguments\ignorearguments\ignorearguments
@@ -1085,12 +1085,12 @@
\let\firstcharacter \empty
\let\remainingcharacters\empty
-\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}}
+\permanent\protected\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}}
+\permanent\protected\def\doifelsefirstchar #1#2{\clf_doifelsefirstchar{#1}{#2}}
+\permanent\protected\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}}
+\permanent\protected\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}}
-\let\doiffirstcharelse\doifelsefirstchar
+\aliased\let\doiffirstcharelse\doifelsefirstchar
%D \macros
%D {doifinstringelse, doifincsnameelse}
@@ -1202,34 +1202,34 @@
% \def\syst_helpers_do_if_not_in_string_yes #0\ignorearguments\ignorearguments#0{}
% \def\syst_helpers_do_if_not_in_string_nop #0\ignorearguments#2{#2}
-\protected\def\doifelseinstring#1#2%
+\permanent\protected\def\doifelseinstring#1#2%
{\ifhasxtoks{#1}{#2}%
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\protected\def\doifinstring#1#2%
+\permanent\protected\def\doifinstring#1#2%
{\ifhasxtoks{#1}{#2}%
\expandafter\firstofoneargument
\else
\expandafter\gobbleoneargument
\fi}
-\protected\def\doifnotinstring#1#2%
+\permanent\protected\def\doifnotinstring#1#2%
{\ifhasxtoks{#1}{#2}%
\expandafter\gobbleoneargument
\else
\expandafter\firstofoneargument
\fi}
-\let\doifinstringelse\doifelseinstring
+\aliased\let\doifinstringelse\doifelseinstring
%D The next one one of those variants that we used when speed was more of an issue
%D that today. Now we just expand the lot. We just use an alias now:
-\let\doifelseincsname\doifelseinstring
-\let\doifincsnameelse\doifinstringelse
+\aliased\let\doifelseincsname\doifelseinstring
+\aliased\let\doifincsnameelse\doifinstringelse
%D \macros
%D {doifnumberelse,doifnumber,doifnotnumber}
@@ -1241,21 +1241,21 @@
%D features that no one ever asked for (but they are pretty generic in nature
%D anyway).
-\def\doifelsenumber#1%
+\permanent\def\doifelsenumber#1%
{\ifchknum#1\or
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\def\doifnumber#1%
+\permanent\def\doifnumber#1%
{\ifchknum#1\or
\expandafter\firstoftwoarguments
\else
\expandafter\gobbleoneargument
\fi}
-\def\doifnotnumber#1%
+\permanent\def\doifnotnumber#1%
{\ifchknum#1\or
\expandafter\gobbleoneargument
\else
@@ -1275,10 +1275,10 @@
% todo: use the push back dimen trickery
-\def\percentdimen#1#2% dimen percentage (with %)
+\permanent\def\percentdimen#1#2% dimen percentage (with %)
{\dimexpr\clf_percentageof{#2}\dimexpr#1\relax}
-\protected\def\setpercentdimen#1#2% dimen percentage (with %)
+\permanent\protected\def\setpercentdimen#1#2% dimen percentage (with %)
{#1=\clf_percentageof{#2}\dimexpr#1\relax}
%D \macros
@@ -1306,7 +1306,7 @@
%D The gain in speed depends on the length of the argument (the longer the argument,
%D the less we gain). The question is: do we still need these raw variants?
-\protected\def\makerawcommalist[#1]#2% use \processnext ... here
+\permanent\protected\def\makerawcommalist[#1]#2% use \processnext ... here
{\scratchtoks\emptytoks
\def\syst_helpers_do_make_raw_comma_list##1{\iftok\scratchtoks\emptytoks\scratchtoks{##1}\else\toksapp\scratchtoks{,##1}\fi}%
\processcommalist[#1]\syst_helpers_do_make_raw_comma_list
@@ -1314,8 +1314,8 @@
% beware: in mkiv { } were lost so it was not compatible with the non raw
-\let\rawprocesscommalist \processcommalist % can go
-\let\rawprocesscommacommand\processcommacommand % can go
+\aliased\let\rawprocesscommalist \processcommalist % can go
+\aliased\let\rawprocesscommacommand\processcommacommand % can go
%D Here is one without nesting .. still needed?
@@ -1330,11 +1330,11 @@
\protected\def\syst_helpers_process_fast_comma_item_next
{\expandafterspaces\syst_helpers_process_fast_comma_item}
-\protected\def\fastprocesscommalist[#1]#2%
+\permanent\protected\def\fastprocesscommalist[#1]#2%
{\let\fastcommalistcommand#2%
\expandafterspaces\syst_helpers_process_fast_comma_item#1\ignorearguments\ignorearguments\ignorearguments}
-\protected\def\fastprocesscommacommand[#1]#2%
+\permanent\protected\def\fastprocesscommacommand[#1]#2%
{\let\fastcommalistcommand#2%
\normalexpanded{\noexpand\expandafterspaces\syst_helpers_process_fast_comma_item#1}\ignorearguments\ignorearguments\ignorearguments}
@@ -1356,7 +1356,7 @@
\expandafter\syst_helpers_do_if_else_in_set
\fi}
-\let\rawdoifinsetelse\rawdoifelseinset
+\aliased\let\rawdoifinsetelse\rawdoifelseinset
\def\syst_helpers_do_if_in_set#1%
{\ifhasxtoks{,\m_syst_sub_string,}{,#1,}%
@@ -1365,7 +1365,7 @@
\expandafter\gobbleoneargument
\fi}
-\protected\def\rawdoifinset#1% or just alias this one
+\permanent\protected\def\rawdoifinset#1% or just alias this one
{\edef\m_syst_sub_string{#1}% expand #1 here
\ifx\m_syst_sub_string\m_syst_two_commas
\expandafter\gobbletwoarguments
@@ -1548,13 +1548,13 @@
\let\currentvalue\empty
-\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}
+\permanent\protected\def\getparameters {\dogetparameters\dosetvalue}
+\permanent\protected\def\geteparameters {\dogetparameters\dosetevalue}
+\permanent\protected\def\getgparameters {\dogetparameters\dosetgvalue}
+\permanent\protected\def\getxparameters {\dogetparameters\dosetxvalue}
+\permanent\protected\def\forgetparameters{\dogetparameters\doignorevalue}
-\let\getexpandedparameters\geteparameters
+\aliased\let\getexpandedparameters\geteparameters
\def\syst_helpers_grab_parameter_error#1%
{\showassignerror{#1}{\the\inputlineno\space(\m_syst_parameter_n)}}
@@ -1578,7 +1578,7 @@
\def\syst_helpers_grab_parameter_next
{\expandafterspaces\syst_helpers_grab_parameter}
-\protected\def\dogetparameters#1[#2]#*[#3]%
+\permanent\protected\def\dogetparameters#1[#2]#*[#3]%
{\def\m_syst_parameter_n{#2}%
\let\m_syst_parameter_s#1%
\expandafterspaces\syst_helpers_grab_parameter#3\ignorearguments\ignorearguments}
@@ -1593,7 +1593,7 @@
%D \getemptyparameters [label] [...=...,...=...]
%D \stoptyping
-\protected\def\getemptyparameters[#1]#*[#2]%
+\permanent\protected\def\getemptyparameters[#1]#*[#2]%
{\def\syst_helpers_get_empty_parameters##1{\doassignempty[#1][##1]}%
\processcommalist[#2]\syst_helpers_get_empty_parameters}
@@ -1618,18 +1618,18 @@
%D We can optimize this one if needed but it's not a core macro so hardly worth the
%D trouble and tokens.
-\protected\def\processassignmentlist[#1]#2% #2 == \command{key}{value]
+\permanent\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]}
-\protected\def\processassignmentcommand[#1]%
+\permanent\protected\def\processassignmentcommand[#1]%
{\normalexpanded{\processassignmentlist[#1]}}
-\protected\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist
+\permanent\protected\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist
{\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}%
\processassignmentlist[#1]\currentassignmentlistcommand}
-\protected\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand
+\permanent\protected\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand
{\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}%
\normalexpanded{\processassignmentlist[#1]}\currentassignmentlistcommand}
@@ -1676,7 +1676,7 @@
%D By using \type {\docopyvalue} we've prepared this command for use in a
%D multi||lingual environment.
-\protected\def\copyparameters[#1]#*[#2]#*[#3]%
+\permanent\protected\def\copyparameters[#1]#*[#2]#*[#3]%
{\doifnot{#1}{#2}
{\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#2}}% ##1
\processcommalist[#3]\syst_helpers_copy_parameter}}
@@ -1748,7 +1748,7 @@
{\commalistcounter\zerocount
\let\commalistsize\!!zerocount}
-\protected\def\getcommacommandsize[#1]%
+\permanent\protected\def\getcommacommandsize[#1]%
{\normalexpanded{\getcommalistsize[#1]}}
%D Filters:
@@ -1771,12 +1771,12 @@
\def\syst_helpers_get_from_comma_list_next
{\expandafterspaces\syst_helpers_get_from_comma_list}
-\protected\def\getfromcommalist[#1]#*[#2]%
+\permanent\protected\def\getfromcommalist[#1]#*[#2]%
{\let\commalistelement\empty
\commalistcounter#2\relax
\expandafterspaces\syst_helpers_get_from_comma_list#1\ignorearguments\ignorearguments}
-\protected\def\getfromcommacommand[#1]%
+\permanent\protected\def\getfromcommacommand[#1]%
{\normalexpanded{\getfromcommalist[#1]}}
%D Watertight (and efficient) solutions are hard to find, due to the handling of
@@ -1815,7 +1815,7 @@
{\ifcase\scratchcounter\or#1\or#2\or#3\or#4\or#5\or#6\or#7\or#8\or#9\fi
\syst_helpers_gobble_comma_list}
-\protected\def\dogetcommacommandelement#1\from#2\to#3%
+\permanent\protected\def\dogetcommacommandelement#1\from#2\to#3%
{\scratchcounter#1\relax
\edef#3{\normalexpanded{\syst_helpers_get_comma_list_element#2\ignorearguments\ignorearguments}}}
@@ -2339,13 +2339,13 @@
%D Aliases:
-\let\dosingleargument \dosingleempty
-\let\dodoubleargument \dodoubleempty
-\let\dotripleargument \dotripleempty
-\let\doquadrupleargument \doquadrupleempty
-\let\doquintupleargument \doquintupleempty
-\let\dosixtupleargument \dosixtupleempty
-\let\doseventupleargument\doseventupleempty
+\aliased\let\dosingleargument \dosingleempty
+\aliased\let\dodoubleargument \dodoubleempty
+\aliased\let\dotripleargument \dotripleempty
+\aliased\let\doquadrupleargument \doquadrupleempty
+\aliased\let\doquintupleargument \doquintupleempty
+\aliased\let\dosixtupleargument \dosixtupleempty
+\aliased\let\doseventupleargument\doseventupleempty
%D \macros
%D {strippedcsname}
@@ -2358,7 +2358,7 @@
%D
%D This expands to \type{\ifsomething}.
-\let\strippedcsname\csstring
+\aliased\let\strippedcsname\csstring
%D \macros
%D {complexorsimple,complexorsimpleempty}
@@ -2399,12 +2399,12 @@
%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.
-\protected\def\complexorsimple#1%
+\permanent\protected\def\complexorsimple#1%
{\doifelsenextoptional
{\firstargumenttrue \csname\s!complex\csstring#1\endcsname}
{\firstargumentfalse\csname\s!simple \csstring#1\endcsname}}
-\protected\def\complexorsimpleempty#1%
+\permanent\protected\def\complexorsimpleempty#1%
{\doifelsenextoptional
{\firstargumenttrue \csname\s!complex\csstring#1\endcsname}
{\firstargumentfalse\csname\s!complex\csstring#1\endcsname[]}}
@@ -2421,12 +2421,12 @@
\protected\def\syst_helpers_complex_or_simple_empty#1%
{\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#1[]}}
-\protected\def\definecomplexorsimple#1%
+\permanent\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}}
-\protected\def\definecomplexorsimpleempty#1%
+\permanent\protected\def\definecomplexorsimpleempty#1%
{\protected\edef#1{\syst_helpers_complex_or_simple_empty
\expandafter\noexpand\csname\s!complex\csstring#1\endcsname}}
@@ -2465,8 +2465,8 @@
\newconditional\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}
+\permanent\protected\def \permitspacesbetweengroups{\settrue \c_syst_helpers_permit_spaces_between_groups}
+\permanent\protected\def\dontpermitspacesbetweengroups{\setfalse\c_syst_helpers_permit_spaces_between_groups}
\dontpermitspacesbetweengroups
@@ -2753,15 +2753,15 @@
%D
%D Trivial:
-\protected\def\letempty #1{\let #1\empty}
-\protected\def\globalletempty#1{\glet#1\empty}
+\permanent\protected\def\letempty #1{\let #1\empty}
+\permanent\protected\def\globalletempty#1{\glet#1\empty}
-\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}
+\permanent\protected\def\letvalueempty #1{\letcsname #1\endcsname\empty}
+\permanent\protected\def\letgvalueempty#1{\global\letcsname#1\endcsname\empty}
+\permanent\protected\def\letvaluerelax #1{\letcsname #1\endcsname\relax}
+\permanent\protected\def\letgvalurelax #1{\global\letcsname#1\endcsname\relax}
-\protected\def\relaxvalueifundefined#1%
+\permanent\protected\def\relaxvalueifundefined#1%
{\ifcsname#1\endcsname \else
\letcsname#1\endcsname\relax
\fi}
@@ -2823,7 +2823,7 @@
%D
%D A fully expandable message:
-\let\immediatemessage\clf_immediatemessage % {} mandate
+\let\immediatemessage\clf_immediatemessage % {} mandate / todo permanent at lua end
%D \macros
%D {rawgetparameters}
@@ -2839,7 +2839,7 @@
\def\syst_helpers_grab_raw_parameter_next
{\expandafterspaces\syst_helpers_grab_raw_parameter}
-\protected\def\rawgetparameters#1[#2]#*[#3]%
+\permanent\protected\def\rawgetparameters#1[#2]#*[#3]%
{\def\m_syst_parameter_n{#2}%
%\expandafterspaces\syst_helpers_grab_raw_parameter#3\ignorearguments\ignorearguments}
\expandafter\expandafterspaces\expandafter\syst_helpers_grab_raw_parameter#3\ignorearguments\ignorearguments}
@@ -2854,13 +2854,13 @@
%D all preceding ones with \type {\redoglobal}. When using only alternatives, one
%D can reset this mechanism with \type {\resetglobal}.
-\protected\def\resetglobal
+\permanent\protected\def\resetglobal
{\enforced\let\redoglobal\relax
\enforced\let\dodoglobal\relax}
\resetglobal
-\protected\def\doglobal
+\permanent\protected\def\doglobal
{\ifx\redoglobal\relax
\enforced\let\redoglobal\global
\enforced\let\dodoglobal\syst_helpers_dodo_global
@@ -2877,7 +2877,7 @@
{\enforced\let\redoglobal\syst_helpers_redo_global
\enforced\let\dodoglobal\syst_helpers_dodo_global}
-%D Whatever:
+%D Whatever (will be overtoaded):
\protected\def\define#1%
{\ifdefined#1%
@@ -2887,13 +2887,13 @@
\protected\expandafter\def
\fi#1}
-\protected\def\redefine#1%
+\permanent\protected\def\redefine#1%
{\ifdefined#1%
\message{[\noexpand#1is redefined]}%
\fi
\protected\def#1}
-\protected\def\definemacro#1%
+\permanent\protected\def\definemacro#1%
{\ifdefined#1%
\message{[\noexpand#1is already defined]}%
\protected\expandafter\def\expandafter\gobbleddefinition
@@ -2999,7 +2999,7 @@
\def\zerocountervalue{0}
-\protected\def\newcounter#1%
+\permanent\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.
@@ -3020,14 +3020,14 @@
\def\m_syst_action_nop{\syst_helpers_do_do_do_decrement#1,\plusone}%
\doifelsenextcharcs,\m_syst_action_yes\m_syst_action_nop}
-\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}
+\permanent\protected\def\increment{\doifelsenextcharcs(\syst_helpers_do_do_increment\syst_helpers_do_increment}
+\permanent\protected\def\decrement{\doifelsenextcharcs(\syst_helpers_do_do_decrement\syst_helpers_do_decrement}
-\protected\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr#1+\plusone \relax}}
-\protected\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr#1+\minusone\relax}}
+\permanent\protected\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr#1+\plusone \relax}}
+\permanent\protected\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr#1+\minusone\relax}}
-\protected\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname}
-\protected\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname}
+\permanent\protected\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname}
+\permanent\protected\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname}
%D \macros
%D {newsignal}
@@ -3046,7 +3046,7 @@
\newdimen\maximumsignal % step is about 0.00025pt
-\protected\def\newsignal#1%
+\permanent\protected\def\newsignal#1%
{\ifdefined#1\else
\advance\maximumsignal 2\scaledpoint % to be save in rounding
\edef#1{\the\maximumsignal}%
@@ -3061,14 +3061,14 @@
%D \csname if\strippedcsname\something\endcsname
%D \stoptyping
-\let\checkedstrippedcsname\csstring
+\aliased\let\checkedstrippedcsname\csstring
%D \macros
%D {savenormalmeaning}
%D
%D We will use this one in:
-\protected\def\savenormalmeaning#1%
+\permanent\protected\def\savenormalmeaning#1%
{\ifcsname normal\csstring#1\endcsname \else
\letcsname normal\csstring#1\endcsname#1%
\fi}
@@ -3168,7 +3168,7 @@
% \protected\def\syst_helpers_stepwise_exit
% {\syst_helpers_stepwise_recurse_nop\relax}
-\def\doexpandedrecurse#1#2% user macro (also was \doxprecurse)
+\permanent\def\doexpandedrecurse#1#2% user macro (also was \doxprecurse)
{\ifnum#1>\zerocount
#2\expandafter\doexpandedrecurse\expandafter{\the\numexpr#1-\plusone\relax}{#2}%
\fi}
@@ -3190,7 +3190,7 @@
%D
%D Because the simple case (n=1) is used often, we implement it more efficiently:
-\protected\def\dorecurse#1%
+\permanent\protected\def\dorecurse#1%
{\ifcase#1\relax
\expandafter\gobbletwoarguments
\or
@@ -3225,7 +3225,7 @@
%D \dowith{a,b,c}{[#1]}
%D \stoptyping
-\protected\def\dowith#1#2%
+\permanent\protected\def\dowith#1#2%
{\def\syst_helpers_with##1{#2}%
\normalexpanded{\processcommalist[#1]}\syst_helpers_with}
@@ -3245,14 +3245,14 @@
%D
%D When needed, one can call for \type {\looplevel} and \type {\loopdepth}.
-\let\endofloop\donothing % maybe \syst_helpers_loop_end
+\aliased\let\endofloop\donothing % maybe \syst_helpers_loop_end
-\protected\def\doloop#1%
+\permanent\protected\def\doloop#1%
{\global\advance\outerrecurse \plusone
\globalpushmacro\recurseaction
\globalpushmacro\recurselevel
\protected\gdef\recurseaction##1##2{#1}%
- \let\endofloop\syst_helpers_loop
+ \enforced\let\endofloop\syst_helpers_loop
\syst_helpers_loop1}% no \plusone else \recurselevel wrong
\protected\def\syst_helpers_loop#1%
@@ -3264,15 +3264,15 @@
\endofloop}
\protected\def\syst_helpers_loop_nop#0%
- {\let\endofloop\syst_helpers_loop
+ {\enforced\let\endofloop\syst_helpers_loop
\globalpopmacro\recurselevel
\globalpopmacro\recurseaction
\global\advance\outerrecurse\minusone}
-\protected\def\exitloop % \exitloop quits at end
- {\let\endofloop\syst_helpers_loop_nop}
+\permanent\protected\def\exitloop % \exitloop quits at end
+ {\enforced\let\endofloop\syst_helpers_loop_nop}
-\protected\def\exitloopnow#0\endofloop % \exitloopnow quits directly
+\permanent\protected\def\exitloopnow#0\endofloop % \exitloopnow quits directly
{\syst_helpers_loop_nop}
%D The loop is executed at least once, so beware of situations like:
@@ -3358,7 +3358,7 @@
% \globalpopmacro\recurseaction
% \global\advance\outerrecurse\minusone}
-\protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 ... todo: remove unused helpers
+\permanent\protected\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 ... todo: remove unused helpers
{\global\advance\outerrecurse \plusone
\globalpushmacro\recurseaction
\globalpushmacro\recurselevel
@@ -3388,7 +3388,7 @@
\let\m_syst_helpers_fast_loop_cs\relax
-\protected\def\dofastloopcs#1%
+\permanent\protected\def\dofastloopcs#1%
{\fastloopfinal#1\relax
\ifcase\fastloopfinal
\expandafter\gobbleoneargument
@@ -3412,7 +3412,7 @@
% Helper:
-\protected\def\resetrecurselevel{\let\recurselevel\!!zerocount}
+\permanent\protected\def\resetrecurselevel{\let\recurselevel\!!zerocount}
\let\recurselevel\!!zerocount
@@ -3441,7 +3441,7 @@
%D }
%D \stoptyping
-\protected\def\doloopoverlist#1#2%
+\permanent\protected\def\doloopoverlist#1#2%
{\global\advance\outerrecurse\plusone
\globalpushmacro\recurseaction
\globalpushmacro\recursestring
@@ -3471,13 +3471,13 @@
%D \def\MyMacro#1{(#1)} \ctxluamatch \MyMacro {(.)} {abcd}
%D \stoptyping
-\protected\def\doloopovermatch#1#2#3%
+\permanent\protected\def\doloopovermatch#1#2#3%
{\pushmacro\matchloopcommand
\def\matchloopcommand##1##2##3##4##5##6##7##8##9{#3}%
\ctxluamatch\matchloopcommand{#1}{#2}%
\popmacro\matchloopcommand}
-\def\doloopovermatched#1#2#3%
+\permanent\def\doloopovermatched#1#2#3%
{\beginlocalcontrol
\pushmacro\matchloopcommand
\def\matchloopcommand##1##2##3##4##5##6##7##8##9{#3}%
@@ -3511,11 +3511,11 @@
\installsystemnamespace{extraevery}
-\protected\def\newevery#1#2%
+\permanent\protected\def\newevery#1#2%
{\ifx#1\everypar\else\newtoks#1\fi% we test for redefinition elsewhere
\ifx#2\relax\orelse\ifdefined#2\else
\expandafter\newtoks\csname\??extraevery\csstring#1\endcsname
- \edef#2{\syst_helpers_every#1\csname\??extraevery\csstring#1\endcsname}%
+ \frozen\protected\edef#2{\syst_helpers_every#1\csname\??extraevery\csstring#1\endcsname}%
\fi}
\protected\def\syst_helpers_every#1#2%
@@ -3532,7 +3532,7 @@
\newtoks \neverypar
-\protected\def\forgeteverypar
+\permanent\protected\def\forgeteverypar
{\everypar{\the\neverypar}}
%D Which we're going to use indeed! When the second argument equals \type {\relax},
@@ -3598,10 +3598,10 @@
%D
%D Both commands accept the prefix \type{\doglobal} for global assignments.
-\protected\def\convertvalue#1\to
+\permanent\protected\def\convertvalue#1\to
{\expandafter\convertcommand\csname#1\endcsname\to}
-\protected\def\defconvertedvalue#1#2% less sensitive for \to
+\permanent\protected\def\defconvertedvalue#1#2% less sensitive for \to
{\expandafter\defconvertedcommand\expandafter#1\csname#2\endcsname}
%D \macros
@@ -3634,51 +3634,51 @@
%D
%D \typebuffer gives: \blank \getbuffer \blank
-\protected\def\doifelseassignment#1%
+\permanent\protected\def\doifelseassignment#1%
{\ifhastok={#1}%
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\protected\def\doifelseassignmentcs#1#2#3%
+\permanent\protected\def\doifelseassignmentcs#1#2#3%
{\ifhastok={#1}%
\expandafter#2%
\else
\expandafter#3%
\fi}
-\let\doifassignmentelse \doifelseassignment
-\let\doifassignmentelsecs\doifelseassignmentcs
+\aliased\let\doifassignmentelse \doifelseassignment
+\aliased\let\doifassignmentelsecs\doifelseassignmentcs
\newif\ifassignment
-\protected\def\docheckassignment#1%
+\permanent\protected\def\docheckassignment#1%
{\ifhastok={#1}%
\assignmenttrue
\else
\assignmentfalse
\fi}
-\protected\def\validassignment #1{\ifhastok={#1}} % can become: {\ifhastok=} as we enforce {}
-\protected\def\novalidassignment#1{\ifnum\ifhastok={#1}\zerocount\else\plusone\fi=\plusone} % or use unless
+\permanent\protected\def\validassignment #1{\ifhastok={#1}} % can become: {\ifhastok=} as we enforce {}
+\permanent\protected\def\novalidassignment#1{\ifnum\ifhastok={#1}\zerocount\else\plusone\fi=\plusone} % or use unless
%D In \ETEX\ we can use \type {\detokenize} and gain some speed, but in general far
%D less that 1\% for \type {\convertargument} and nil for \type {\convertcommand}.
%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).
-\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
+\permanent\protected\def\convertargument#1\to#2{\dodoglobal\edef#2{\detokenize{#1}}}
+\permanent\protected\def\convertcommand #1\to#2{\dodoglobal\edef#2{\expandafter\detokenize\expandafter{#1}}} % hm, only second is also ok
-\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}}}
-\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}}}
+\permanent\protected\def\defconvertedargument #1#2{\edef#1{\detokenize{#2}}}
+\permanent\protected\def\defconvertedcommand #1#2{\edef#1{\detokenize\expandafter{#2}}}
+\permanent\protected\def\edefconvertedargument#1#2{\edef#1{#2}%
+ \edef#1{\detokenize\expandafter{#1}}}
+\permanent\protected\def\gdefconvertedargument#1#2{\xdef#1{\detokenize{#2}}}
+\permanent\protected\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\expandafter{#2}}}
+\permanent\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\
%D method fails on for instance \type {\jobname} in the sense that it returns the
@@ -3701,7 +3701,7 @@
%D
%D Ahandy macro, for testing purposes only:
-\protected\def\showvalue#1%
+\permanent\protected\def\showvalue#1%
{\ifcsname#1\endcsname
\expandafter\show\csname#1\endcsname
\else
@@ -3721,7 +3721,7 @@
%D
%D Watch the one level expansion of the second argument.
-\protected\def\doifelsemeaning#1#2%
+\permanent\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}%
@@ -3731,7 +3731,7 @@
\expandafter\secondoftwoarguments
\fi}
-\let\doifmeaningelse\doifelsemeaning
+\aliased\let\doifmeaningelse\doifelsemeaning
%D \macros
%D {doifsamestringselse,doifsamestring,doifnotsamestring}
@@ -3750,11 +3750,11 @@
\edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#4}}}%
\ifx\m_syst_string_one\m_syst_string_two\expandafter#1\else\expandafter#2\fi}
-\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 }
+\permanent\protected\def\doifelsesamestring{\syst_helpers_if_samestring_else\firstoftwoarguments\secondoftwoarguments}
+\permanent\protected\def\doifsamestring {\syst_helpers_if_samestring_else\firstofoneargument \gobbleoneargument }
+\permanent\protected\def\doifnotsamestring {\syst_helpers_if_samestring_else\gobbleoneargument \firstofoneargument }
-\let\doifsamestringelse\doifelsesamestring
+\aliased\let\doifsamestringelse\doifelsesamestring
% BEGIN OF OBSOLETE %
@@ -3782,7 +3782,7 @@
%D
%D In examples~2 and~3 both arguments equal, in~1 and~4 they differ.
-\protected\def\ConvertToConstant#1#2#3%
+\permanent\protected\def\ConvertToConstant#1#2#3% will go
{\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}}
@@ -3812,14 +3812,14 @@
%D
%D where \type {...} can be anything legally \TEX.
-\protected\def\CheckConstantAfter#1#2%
+\permanent\protected\def\CheckConstantAfter#1#2% will go
{\expandafter\convertargument\v!prefix!\to\ascii
\convertargument#1\to#2\relax
\doifelseinstring\ascii{#2}
{\expandafter\convertargument#1\to#2}
{}}
-\protected\def\ConvertConstantAfter#1#2#3%
+\permanent\protected\def\ConvertConstantAfter#1#2#3% will go
{\CheckConstantAfter{#2}\asciia
\CheckConstantAfter{#3}\asciib
#1{\asciia}{\asciib}}
@@ -3837,7 +3837,7 @@
%D
%D We don't explicitly test if the macro is defined.
-\protected\def\assignifempty#1#2%
+\permanent\protected\def\assignifempty#1#2%
{\iftok{#1}\emptytoks \def#1{#2}\fi}
%D \macros
@@ -3881,7 +3881,7 @@
\protected\def\syst_helpers_grab#1#2%
{\def\syst_helpers_grab_indeed##1#1{#2{##1}}\syst_helpers_grab_indeed}
-\protected\def\grabuntil#1%
+\permanent\protected\def\grabuntil#1%
{\expandafter\syst_helpers_grab\expandafter{\csname#1\endcsname}}
%D The next command build on this mechanism:
@@ -3908,7 +3908,7 @@
\let\syst_helpers_gobble_indeed\relax
-\protected\def\processbetween#1#2%
+\permanent\protected\def\processbetween#1#2%
{\setvalue{\s!start#1}{\grabuntil{\s!stop#1}{#2}}}
% \protected\def\gobbleuntil#1%
@@ -3917,10 +3917,10 @@
% \protected\def\gobbleuntilrelax#1\relax
% {}
-\protected\def\gobbleuntil#1%
+\permanent\protected\def\gobbleuntil#1%
{\def\syst_helpers_gobble_indeed##-#1{}\syst_helpers_gobble_indeed}
-\protected\def\gobbleuntilrelax#-\relax
+\permanent\protected\def\gobbleuntilrelax#-\relax
{}
%D The next one simply expands the pickup up tokens.
@@ -3931,7 +3931,7 @@
\let\syst_helpers_until_indeed\relax
-\protected\def\processuntil#1%
+\permanent\protected\def\processuntil#1%
{\def\syst_helpers_until_indeed##1#1{##1}\syst_helpers_until_indeed}
%D \macros
@@ -4091,32 +4091,32 @@
%D {\futurelet} obeys blank spaces, and a line||ending token is treated as a blank
%D space. So the final implementation became:
-\protected\def\groupedcommand#1#2%
+\permanent\protected\def\groupedcommand#1#2%
{\def\m_syst_helpers_handle_group_b{#1}%
\def\m_syst_helpers_handle_group_a{#2}%
\futureexpandis\bgroup\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop}
-\protected\def\groupedcommandcs#1#2%
+\permanent\protected\def\groupedcommandcs#1#2%
{\let\m_syst_helpers_handle_group_b#1%
\let\m_syst_helpers_handle_group_a#2%
\futureexpandis\bgroup\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop}
-\protected\def\simplegroupedcommand#1#2%
+\permanent\protected\def\simplegroupedcommand#1#2%
{\def\m_syst_helpers_handle_group_b{#1}%
\def\m_syst_helpers_handle_group_a{#2}%
\futureexpandis\bgroup\syst_helpers_handle_group_simple\syst_helpers_handle_group_nop}
-\protected\def\pickupgroupedcommand#1#2#3%
+\permanent\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}%
\futureexpandis\bgroup\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop}
-\protected\def\triggergroupedcommand#1%
+\permanent\protected\def\triggergroupedcommand#1%
{\def\m_syst_helpers_handle_group_b{#1}%
\futureexpandis\bgroup\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x}
-\protected\def\triggergroupedcommandcs#1%
+\permanent\protected\def\triggergroupedcommandcs#1%
{\let\m_syst_helpers_handle_group_b#1%
\futureexpandis\bgroup\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x}
@@ -4203,19 +4203,19 @@
\let\syst_helpers_par_before\relax
\let\syst_helpers_par_around\relax
-\protected\def\dowithpar#1#2%
+\permanent\protected\def\dowithpar#1#2%
{\globalpushmacro\syst_helpers_par_around
\def\syst_helpers_par_around##1\par{#1##1#2\globalpopmacro\syst_helpers_par_around}%
\expandafter\syst_helpers_par_around\ignorepars}
-\protected\def\dogotopar#1%
+\permanent\protected\def\dogotopar#1%
{\globalpushmacro\syst_helpers_par_before
\def\syst_helpers_par_before{#1\globalpopmacro\syst_helpers_par_before}%
\expandafter\syst_helpers_par_before\ignorepars}
-\let\dogotoparcs\dogotopar
+\aliased\let\dogotoparcs\dogotopar
-\protected\def\dogotoparstart
+\permanent\protected\def\dogotoparstart
{\ignorepars}
%D This is old and kind of obsolete:
@@ -4223,7 +4223,7 @@
\newtoks\BeforePar
\newtoks\AfterPar
-\protected\def\GetPar
+\permanent\protected\def\GetPar
{\expanded
{\dowithpar
{\the\BeforePar
@@ -4232,7 +4232,7 @@
\BeforePar\emptytoks
\AfterPar\emptytoks}}}
-\protected\def\GotoPar
+\permanent\protected\def\GotoPar
{\expanded
{\dogotopar
{\the\BeforePar
@@ -4271,7 +4271,7 @@
\let\syst_helpers_next_par\relax
\let\syst_helpers_next_arg\relax
-\protected\def\dowithpargument#1%
+\permanent\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}}
@@ -4299,7 +4299,7 @@
\let\syst_helpers_next_war\relax
\let\syst_helpers_next_arg\relax
-\protected\def\dowithwargument#1%
+\permanent\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}
@@ -4333,7 +4333,7 @@
%D commands, the \type {n*} is optional. When this specification is missing, the
%D command executes once.
-\protected\def\dorepeatwithcommand[#1]%
+\permanent\protected\def\dorepeatwithcommand[#1]%
{\syst_helpers_repeat_with_command#1*\empty*\relax}
\def\syst_helpers_repeat_with_command#1*#2#3*#4\relax#5%
@@ -4378,8 +4378,8 @@
%D The next macro is meant for situations where both strings are macros. This save
%D some unneeded expansion. But now we just alias.
-\let\doifelsestringinstring\doifelseinstring
-\let\doifstringinstringelse\doifelseinstring
+\aliased\let\doifelsestringinstring\doifelseinstring
+\aliased\let\doifstringinstringelse\doifelseinstring
%D \macros
%D {appendtoks,prependtoks,appendtoksonce,prependtoksonce,
@@ -4400,7 +4400,7 @@
\newtoks\t_syst_helpers_scratch
\let \m_syst_helpers_scratch\empty
-\protected\def\appendtoks#1\to#2%
+\permanent\protected\def\appendtoks#1\to#2%
{\ifx\dodoglobal\relax
\expandafter\toksapp
\else
@@ -4408,7 +4408,7 @@
\expandafter\gtoksapp
\fi#2{#1}}
-\protected\def\prependtoks#1\to#2%
+\permanent\protected\def\prependtoks#1\to#2%
{\ifx\dodoglobal\relax
\expandafter\tokspre
\else
@@ -4446,26 +4446,26 @@
% \syst_helpers_prepend_toks_indeed
% \fi}
-\protected\def\appendtoksonce#1\to#2%
+\permanent\protected\def\appendtoksonce#1\to#2%
{\ifhasxtoks{#1}#2\else
\appendtoks#1\to#2%
\fi}
-\protected\def\prependtoksonce#1\to#2%
+\permanent\protected\def\prependtoksonce#1\to#2%
{\ifhasxtoks{#1}{#2}\m_syst_helpers_scratch\else
\prependtoks#1\to#2%
\fi}
%D The test macro:
-\protected\def\doifelseintoks#1#2% #1 en #2 zijn toks
+\permanent\protected\def\doifelseintoks#1#2% #1 en #2 zijn toks
{\ifhasxtoks#1#2%
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\let\doifintokselse\doifelseintoks
+\aliased\let\doifintokselse\doifelseintoks
%D Moved from \type {lxml-ini.tex} to here. This one is for generators that collect
%D stuff piecewise, which is sometimes hard on mechanisms that grab content using
@@ -4488,14 +4488,14 @@
\newtoks \collectingtoks
-\protected\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}}
-\protected\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}}
+\permanent\protected\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}}
+\permanent\protected\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}}
-\protected\def\startcollecting{\collectingtoks\emptytoks}
-\protected\def\stopcollecting {\the\collectingtoks}
+\permanent\protected\def\startcollecting{\collectingtoks\emptytoks}
+\permanent\protected\def\stopcollecting {\the\collectingtoks}
-\protected\def\collect {\toksapp \collectingtoks}
-\protected\def\collectexpanded{\etoksapp\collectingtoks}
+\permanent\protected\def\collect {\toksapp \collectingtoks}
+\permanent\protected\def\collectexpanded{\etoksapp\collectingtoks}
%D A nice one too:
@@ -4505,7 +4505,7 @@
% {\scratchtoks{xaa} \removetoks x\from\scratchtoks [\the\scratchtoks]}
% {\scratchtoks{a\relax b} \removetoks \relax\from\scratchtoks [\showthe\scratchtoks]}
-\protected\def\removetoks#1\from#2%
+\permanent\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}%
\ifempty\m_syst_string_one#2{##1}\else#2{##1##2}\fi}%
@@ -4513,7 +4513,7 @@
%D Also:
-\protected\def\appendetoks#1\to#2%
+\permanent\protected\def\appendetoks#1\to#2%
{\ifx\dodoglobal\relax
\expandafter\etoksapp
\else
@@ -4521,7 +4521,7 @@
\expandafter\xtoksapp
\fi#2{#1}}
-\protected\def\prependetoks#1\to#2%
+\permanent\protected\def\prependetoks#1\to#2%
{\ifx\dodoglobal\relax
\expandafter\etokspre
\else
@@ -4531,12 +4531,12 @@
%D Hm.
-\protected\def\flushtoks#1% nb: can reassign to #1 again, hence the indirectness
+\permanent\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}
-\let\dotoks\the
+\aliased\let\dotoks\the
%D \macros
%D {beforesplitstring,aftersplitstring}
@@ -4556,7 +4556,7 @@
\let\syst_helpers_split_string\relax
-\protected\def\beforesplitstring#1\at#2\to#3%
+\permanent\protected\def\beforesplitstring#1\at#2\to#3%
{\def\syst_helpers_split_string##1#2##0^^^^0004% no #- as we need to count
{\ifarguments
\let#3\empty
@@ -4567,7 +4567,7 @@
\fi}%
\expandafter\syst_helpers_split_string#1^^^^0004\ignorearguments\ignorearguments}
-\protected\def\aftersplitstring#1\at#2\to#3%
+\permanent\protected\def\aftersplitstring#1\at#2\to#3%
{\def\syst_helpers_split_string##0#2##2^^^^0004% no #- as we need to count
{\ifarguments
\let#3\empty
@@ -4583,7 +4583,7 @@
%D
%D A bonus macro.
-\protected\def\splitstring#1\at#2\to#3\and#4%
+\permanent\protected\def\splitstring#1\at#2\to#3\and#4%
{\def\syst_helpers_split_string##1#2##2^^^^0004%
{\ifarguments
\let#3\empty
@@ -4597,7 +4597,7 @@
\fi}%
\expandafter\syst_helpers_split_string#1^^^^0004\ignorearguments\ignorearguments}
-\protected\def\greedysplitstring#1\at#2\to#3\and#4%
+\permanent\protected\def\greedysplitstring#1\at#2\to#3\and#4%
{\def\syst_helpers_split_string##1#2##2^^^^0004%
{\ifarguments
\let#3\empty
@@ -4625,9 +4625,9 @@
%D aftertestandsplitstring,
%D testandsplitstring}
-\let\beforetestandsplitstring\beforesplitstring
+\aliased\let\beforetestandsplitstring\beforesplitstring
-\protected\def\aftertestandsplitstring#1\at#2\to#3%
+\permanent\protected\def\aftertestandsplitstring#1\at#2\to#3%
{\def\syst_helpers_split_string##0#2##2^^^^0004% no #- as we need to count
{\ifarguments
\let#3\empty
@@ -4638,7 +4638,7 @@
\fi}%
\expandafter\syst_helpers_split_string#1^^^^0004\ignorearguments\ignorearguments}
-\protected\def\testandsplitstring#1\at#2\to#3\and#4%
+\permanent\protected\def\testandsplitstring#1\at#2\to#3\and#4%
{\def\syst_helpers_split_string##1#2##2^^^^0004%
{\ifarguments
\let#3\empty
@@ -4653,17 +4653,7 @@
\expandafter\syst_helpers_split_string#1^^^^0004\ignorearguments\ignorearguments}
%D \macros
-%D {splitatperiod,
-%D {splitatcomma,
-%D splitatasterisk,
-%D splitatcolon,
-%D splitatcolons}
-
-% \protected\def\syst_helpers_splitatperiod #1.#2.#0^^^^0004#4#5{\def #4{#1}\def #5{#2}}
-% \protected\def\syst_helpers_splitatcomma #1,#2,#0^^^^0004#4#5{\def #4{#1}\def #5{#2}}
-% \protected\def\syst_helpers_splitatasterisk #1*#2*#0^^^^0004#4#5{\def #4{#1}\def #5{#2}}
-% \protected\def\syst_helpers_splitatcolon #1:#2:#0^^^^0004#4#5{\def #4{#1}\def #5{#2}}
-% \protected\def\syst_helpers_splitatcolons #1::#2::#0^^^^0004#4#5{\edef#4{#1}\edef#5{#2}}
+%D {splitatperiod, splitatcomma, splitatasterisk, splitatcolon, splitatcolons}
\protected\def\syst_helpers_splitatperiod #1.#2.#-^^^^0004#3#4{\def #3{#1}\def #4{#2}}
\protected\def\syst_helpers_splitatcomma #1,#2,#-^^^^0004#3#4{\def #3{#1}\def #4{#2}}
@@ -4671,11 +4661,11 @@
\protected\def\syst_helpers_splitatcolon #1:#2:#-^^^^0004#3#4{\def #3{#1}\def #4{#2}}
\protected\def\syst_helpers_splitatcolons #1::#2::#-^^^^0004#3#4{\edef#3{#1}\edef#4{#2}}
-\protected\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..^^^^0004}
-\protected\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,^^^^0004} % not at ", "
-\protected\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**^^^^0004}
-\protected\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::^^^^0004}
-\protected\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::^^^^0004}
+\permanent\protected\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..^^^^0004}
+\permanent\protected\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,^^^^0004} % not at ", "
+\permanent\protected\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**^^^^0004}
+\permanent\protected\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::^^^^0004}
+\permanent\protected\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::^^^^0004}
%D \macros
%D {removesubstring}
@@ -4688,7 +4678,7 @@
%D
%D Which in terms of \TEX\ looks like:
-\protected\def\removesubstring#1\from#2\to#3%
+\permanent\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}}
@@ -4745,36 +4735,36 @@
%D
%D The faster alternatives are:
-\protected\def\appendtocommalist#1#2%
+\permanent\protected\def\appendtocommalist#1#2%
{\dodoglobal\edef#2{\ifempty#2\else#2,\fi#1}}
-\protected\def\prependtocommalist#1#2%
+\permanent\protected\def\prependtocommalist#1#2%
{\dodoglobal\edef#2{#1\ifempty#2\else,#2\fi}}
-\protected\def\addtocommalist#1#2% {item} \cs
+\permanent\protected\def\addtocommalist#1#2% {item} \cs
{\rawdoifelseinset{#1}#2\resetglobal
{\dodoglobal\edef#2{\ifempty#2\else#2,\fi#1}}}
-\protected\def\pretocommalist#1#2% {item} \cs
+\permanent\protected\def\pretocommalist#1#2% {item} \cs
{\rawdoifelseinset{#1}#2\resetglobal
{\dodoglobal\edef#2{#1\ifempty#2\else,#2\fi}}}
-\protected\def\robustdoifelseinset#1#2%
+\permanent\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
+\aliased\let\robustdoifinsetelse\robustdoifelseinset
-\protected\def\robustaddtocommalist#1#2% {item} \cs
+\permanent\protected\def\robustaddtocommalist#1#2% {item} \cs
{\robustdoifelseinset{#1}#2\resetglobal
{\dodoglobal\edef#2{\ifempty#2\else#2,\fi#1}}}
-\protected\def\robustpretocommalist#1#2% {item} \cs
+\permanent\protected\def\robustpretocommalist#1#2% {item} \cs
{\robustdoifelseinset{#1}#2\resetglobal
{\dodoglobal\edef#2{#1\ifempty#2\else,#2\fi}}}
-\protected\def\xsplitstring#1#2% \cs {str}
+\permanent\protected\def\xsplitstring#1#2% \cs {str}
%{\def\syst_helpers_split_string##1,#2,##2,#2,##3\\%
{\def\syst_helpers_split_string##1,#2,##2,#2,##-\\%
{\edef\m_syst_string_one{\bcleanedupcommalist##1\empty\empty\relax}%
@@ -4786,7 +4776,7 @@
%def\acleanedupcommalist#1,,#2\relax{#1}
\def\acleanedupcommalist#1,,#-\relax{#1}
-\protected\def\removefromcommalist#1#2% to be sped up
+\permanent\protected\def\removefromcommalist#1#2% to be sped up
{\rawdoifelseinset{#1}#2%
{\normalexpanded{\xsplitstring\noexpand#2{#1}}%
\dodoglobal\edef#2%
@@ -4816,7 +4806,7 @@
\edef\m_syst_string_four{\ifempty\m_syst_string_four\else\m_syst_string_four,\fi#1}%
\fi}
-\protected\def\substituteincommalist#1#2#3% old, new, list (slooow)
+\permanent\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
@@ -4879,7 +4869,7 @@
\fi
\advance\commalistcounter\plusone}
-\protected\def\replaceincommalist#1#2% #1 = commalistelement #2 = position starts at 1
+\permanent\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
@@ -4903,7 +4893,7 @@
\expandafter\syst_helpers_comma_list_command_global_step
\fi}
-\protected\def\globalprocesscommalist[#1]#2%
+\permanent\protected\def\globalprocesscommalist[#1]#2%
{\glet\m_syst_helpers_comma_list_command_global#2%
\expandafter\syst_helpers_comma_list_command_global_step#1,],}
@@ -4932,7 +4922,7 @@
% that \TEX\ was written, it made no sense to add a lot of that. After decades we know
% what extras we need.
-\def\withoutpt#1{\thewithoutunit\dimexpr#1} % best use the primitive directly
+\permanent\def\withoutpt#1{\thewithoutunit\dimexpr#1} % best use the primitive directly
%D The capitals are needed because \type {p} and \type {t} have catcode~12, while
%D macronames only permit tokens with the catcode~11. As a result we cannot use the
@@ -4943,7 +4933,7 @@
% \def\PtToCm#1%
% {\withoutpt\the\dimexpr0.0351459804\dimexpr#1\relax\relax cm}
-\def\PtToCm#1{\thewithoutunit\dimexpr0.0351459804\dimexpr#1\relax\relax cm}
+\permanent\def\PtToCm#1{\thewithoutunit\dimexpr0.0351459804\dimexpr#1\relax\relax cm}
%D We also support:
%D
@@ -4957,8 +4947,8 @@
% \dimensiontocount{10.49pt}\scratchcounter \the\scratchcounter / \numberofpoints{10.49pt}
% \dimensiontocount{10.51pt}\scratchcounter \the\scratchcounter / \numberofpoints{10.51pt}
-\def\dimensiontocount#1#2{#2\numexpr\dimexpr#1\relax/\maxcard\relax}
-\def\numberofpoints #1{\the\numexpr\dimexpr#1\relax/\maxcard\relax}
+\permanent\def\dimensiontocount#1#2{#2\numexpr\dimexpr#1\relax/\maxcard\relax}
+\permanent\def\numberofpoints #1{\the\numexpr\dimexpr#1\relax/\maxcard\relax}
%D \macros
%D {swapdimens,swapskips,swapcounts,swapmacros,
@@ -4982,15 +4972,15 @@
\aliased\let\swapcounts\swapcsvalues
\aliased\let\swapmacros\swapcsvalues
-\protected\def\globalswapdimens#1#2{\d_syst_helpers_swapped#1\global#1#2\global#2\d_syst_helpers_swapped}
-\protected\def\globalswapskips #1#2{\s_syst_helpers_swapped#1\global#1#2\global#2\s_syst_helpers_swapped}
-\protected\def\globalswapcounts#1#2{\c_syst_helpers_swapped#1\global#1#2\global#2\c_syst_helpers_swapped}
-\protected\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet#1#2\glet#2\m_syst_helpers_swapped}
+% \protected\def\globalswapdimens#1#2{\d_syst_helpers_swapped#1\global#1#2\global#2\d_syst_helpers_swapped}
+% \protected\def\globalswapskips #1#2{\s_syst_helpers_swapped#1\global#1#2\global#2\s_syst_helpers_swapped}
+% \protected\def\globalswapcounts#1#2{\c_syst_helpers_swapped#1\global#1#2\global#2\c_syst_helpers_swapped}
+% \protected\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet#1#2\glet#2\m_syst_helpers_swapped}
-\protected\def\globalswapdimens{\global\swapcsvalues}
-\protected\def\globalswapskips {\global\swapcsvalues}
-\protected\def\globalswapcounts{\global\swapcsvalues}
-\protected\def\globalswapmacros{\global\swapcsvalues}
+\permanent\protected\def\globalswapdimens{\global\swapcsvalues}
+\permanent\protected\def\globalswapskips {\global\swapcsvalues}
+\permanent\protected\def\globalswapcounts{\global\swapcsvalues}
+\permanent\protected\def\globalswapmacros{\global\swapcsvalues}
%D \macros
%D {pushmacro,popmacro}
@@ -5002,8 +4992,8 @@
%D \popmacro\macro
%D \stoptyping
-\let\pushmacro\localpushmacro
-\let\popmacro \localpopmacro
+\permanent\let\pushmacro\localpushmacro
+\permanent\let\popmacro \localpopmacro
%D \macros
%D {setlocalhsize,distributedhsize}
@@ -5035,7 +5025,7 @@
{\syst_helpers_set_local_hsize_nop
\advance\localhsize#1\relax}
-\def\availablehsize
+\permanent\def\availablehsize
{\dimexpr
\hsize-\leftskip-\rightskip
\ifnum\hangafter<\zerocount
@@ -5043,10 +5033,10 @@
\fi
\relax}
-\def\distributedhsize#1#2#3%
+\permanent\def\distributedhsize#1#2#3%
{\dimexpr(#1-\numexpr#3-1\relax\dimexpr#2\relax)/#3\relax}
-\def\hsizefraction#1#2%
+\permanent\def\hsizefraction#1#2%
{\dimexpr#1/#2\relax}
%D \macros
@@ -5059,103 +5049,103 @@
%D three tokens per call. Anyone familiar with the not||values ones, can derive
%D their meaning from the definitions.
-\protected\def\doifvalue#1#2%
+\permanent\protected\def\doifvalue#1#2%
{\iftok{\csname#1\endcsname}{#2}%
\expandafter\firstofoneargument
\else
\expandafter\gobbleoneargument
\fi}
-\protected\def\doifnotvalue#1#2%
+\permanent\protected\def\doifnotvalue#1#2%
{\iftok{\csname#1\endcsname}{#2}%
\expandafter\gobbleoneargument
\else
\expandafter\firstofoneargument
\fi}
-\protected\def\doifelsevalue#1#2%
+\permanent\protected\def\doifelsevalue#1#2%
{\iftok{\csname#1\endcsname}{#2}%
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\protected\def\doifnothing#1%
+\permanent\protected\def\doifnothing#1%
{\iftok{#1}\emptytoks
\expandafter\firstofoneargument
\else
\expandafter\gobbleoneargument
\fi}
-\protected\def\doifsomething#1%
+\permanent\protected\def\doifsomething#1%
{\iftok{#1}\emptytoks
\expandafter\gobbleoneargument
\else
\expandafter\firstofoneargument
\fi}
-\protected\def\doifelsenothing#1%
+\permanent\protected\def\doifelsenothing#1%
{\iftok{#1}\emptytoks
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\protected\def\doifelsesomething#1%
+\permanent\protected\def\doifelsesomething#1%
{\iftok{#1}\emptytoks
\expandafter\secondoftwoarguments
\else
\expandafter\firstoftwoarguments
\fi}
-\protected\def\doifvaluenothing#1%
+\permanent\protected\def\doifvaluenothing#1%
{\iftok{\csname#1\endcsname}\emptytoks
\expandafter\firstofoneargument
\else
\expandafter\gobbleoneargument
\fi}
-\protected\def\doifvaluesomething#1%
+\permanent\protected\def\doifvaluesomething#1%
{\iftok{\csname#1\endcsname}\emptytoks
\expandafter\gobbleoneargument
\else
\expandafter\firstofoneargument
\fi}
-\protected\def\doifelsevaluenothing#1%
+\permanent\protected\def\doifelsevaluenothing#1%
{\iftok{\csname#1\endcsname}\emptytoks
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\let\doifvalueelse \doifelsevalue
-\let\doifnothingelse \doifelsenothing
-\let\doifsomethingelse \doifelsesomething
-\let\doifvaluenothingelse\doifelsevaluenothing
+\aliased\let\doifvalueelse \doifelsevalue
+\aliased\let\doifnothingelse \doifelsenothing
+\aliased\let\doifsomethingelse \doifelsesomething
+\aliased\let\doifvaluenothingelse\doifelsevaluenothing
%D \macros
%D {doifemptyelsevalue, doifemptyvalue, doifnotemptyvalue}
%D
%D Also handy:
-\def\doifelseemptyvalue#1%
+\permanent\def\doifelseemptyvalue#1%
{\expandafter\ifempty\csname#1\endcsname
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\let\doifemptyvalueelse\doifelseemptyvalue
+\aliased\let\doifemptyvalueelse\doifelseemptyvalue
-\def\doifemptyvalue#1%
+\permanent\def\doifemptyvalue#1%
{\expandafter\ifempty\csname#1\endcsname
\expandafter\firstofoneargument
\else
\expandafter\gobbleoneargument
\fi}
-\def\doifnotemptyvalue#1%
+\permanent\def\doifnotemptyvalue#1%
{\expandafter\ifempty\csname#1\endcsname
\expandafter\gobbleoneargument
\else
@@ -5176,11 +5166,11 @@
\processcommalist[#3]\syst_helpers_do_common_check_all
\ifdone\expandafter#1\else\expandafter#2\fi}
-\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 }
+\permanent\protected\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments}
+\permanent\protected\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument }
+\permanent\protected\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments }
-\let\doifallcommonelse\doifelseallcommon
+\aliased\let\doifallcommonelse\doifelseallcommon
%D \macros
%D {DOIF,DOIFELSE,DOIFNOT}
@@ -5225,10 +5215,10 @@
\protected\def\syst_helpers_do_IF_INSTRING_ELSE#1#2%
{\uppercase{\doifelseinstring{#1}{#2}}}
-\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
+\permanent\protected\def\DOIF #1#2{\normalexpanded{\syst_helpers_do_IF {#1}{#2}}}% will become obsolete
+\permanent\protected\def\DOIFNOT #1#2{\normalexpanded{\syst_helpers_do_IF_NOT {#1}{#2}}}% will become obsolete
+\permanent\protected\def\DOIFELSE #1#2{\normalexpanded{\syst_helpers_do_IF_ELSE {#1}{#2}}}% will become obsolete
+\permanent\protected\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\syst_helpers_do_IF_INSTRING_ELSE{#1}{#2}}}% will become obsolete
%D \macros
%D {dosingleargumentwithset,
@@ -5294,8 +5284,8 @@
{\def\syst_helpers_with_set_step##1{#1[##1][#3][#4]}%
\processcommalist[#1]\syst_helpers_with_set_step}}
-\let\dodoubleargumentwithset\dodoubleemptywithset
-\let\dotripleargumentwithset\dotripleemptywithset
+\aliased\let\dodoubleargumentwithset\dodoubleemptywithset
+\aliased\let\dotripleargumentwithset\dotripleemptywithset
%D \macros
%D {stripcharacters,stripspaces}
@@ -5322,7 +5312,7 @@
\let\m_syst_helpers_strip_character\empty
-\protected\def\stripcharacter#1\from#2\to#3%
+\permanent\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}}%
@@ -5331,7 +5321,7 @@
\expandafter\syst_helpers_strip_character\m_syst_string_one#1\end
\dodoglobal\let#3\m_syst_helpers_strip_character}
-\protected\def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2
+\permanent\protected\def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2
{\stripcharacter{ }\from#1\to#2}
%D \macros
@@ -5340,7 +5330,7 @@
%D The next macro does the same but is more compatible with other macros, like \type
%D {\convert...}.
-\protected\def\unspacestring#1\to#2%
+\permanent\protected\def\unspacestring#1\to#2%
{\stripcharacter{ }\from#1\to#2}
%D \macros
@@ -5360,7 +5350,7 @@
%D
%D We can of course gobble more arguments using the appropriate gobbling command.
-\def\executeifdefined#1% #2 / never change this one again
+\permanent\def\executeifdefined#1% #2 / never change this one again
{\ifcsname#1\endcsname
\expandafter\expandafter\expandafter\lastnamedcs\expandafter\gobbleoneargument
\else
@@ -5394,14 +5384,14 @@
% \expandafter\firstoftwoarguments
% \fi}
-\edef\doifelsesomespace#1%
+\permanent\edef\doifelsesomespace#1%
{\noexpand\ifhastok\space{#1}%
\noexpand\expandafter\noexpand\firstoftwoarguments
\noexpand\else
\noexpand\expandafter\noexpand\secondoftwoarguments
\noexpand\fi}
-\let\doifsomespaceelse\doifelsesomespace
+\aliased\let\doifsomespaceelse\doifelsesomespace
%D \macros
%D {processseparatedlist}
@@ -5466,7 +5456,7 @@
}%
\expandafter\syst_helpers_process_separated_list_step\gobbleoneargument#1#2]#2}
-\protected\def\processseparatedlist[%
+\permanent\protected\def\processseparatedlist[%
{\syst_helpers_process_separated_list\relax}
%D \macros
@@ -5489,7 +5479,7 @@
\let\syst_helpers_process_any_list_indeed\relax
\let\syst_helpers_process_any_list_step \relax
-\protected\def\processlist#1#2#3#4% no blank skipping !
+\permanent\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%
@@ -5525,7 +5515,7 @@
% {\syst_helpers_process_assign_list_assign[##1==\relax]}%
% \processcommalist[#2]\syst_helpers_process_assign_list_step}
-\protected\def\processassignlist#1[#2]#3%
+\permanent\protected\def\processassignlist#1[#2]#3%
{\def\syst_helpers_process_assign_list_assign[##1=##-=##2]%
{\doif{##2}\relax{#3{##1}}}%
\def\syst_helpers_process_assign_list_step##1%
@@ -5548,7 +5538,7 @@
\let\m_syst_helpers_untexed\empty
-\protected\def\untexsomething
+\permanent\protected\def\untexsomething
{\begingroup
\catcode\leftbraceasciicode \ignorecatcode
\catcode\rightbraceasciicode\ignorecatcode
@@ -5560,8 +5550,8 @@
\endgroup
\let#3\m_syst_helpers_untexed}
-\protected\def\untexargument{\untexsomething\convertargument}
-\protected\def\untexcommand {\untexsomething\convertcommand}
+\permanent\protected\def\untexargument{\untexsomething\convertargument}
+\permanent\protected\def\untexcommand {\untexsomething\convertcommand}
%D \macros
%D {ScaledPointsToBigPoints,ScaledPointsToWholeBigPoints}
@@ -5575,13 +5565,13 @@
%D \ScaledPointsToWholeBigPoints {number} \target
%D \stoptyping
-\let\tobigpoints \clf_tobigpoints
-\let\towholebigpoints\clf_towholebigpoints
+\aliased\let\tobigpoints \clf_tobigpoints % todo: permanent at lua end
+\aliased\let\towholebigpoints\clf_towholebigpoints % todo: permanent at lua end
-\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
+\permanent\protected\def\PointsToBigPoints #1#2{\edef#2{\tobigpoints #1}} % can be avoided
+\permanent\protected\def\PointsToWholeBigPoints #1#2{\edef#2{\towholebigpoints#1}} % can be avoided
+\permanent\protected\def\ScaledPointsToBigPoints #1#2{\edef#2{\tobigpoints #1\scaledpoint}} % obsolete
+\permanent\protected\def\ScaledPointsToWholeBigPoints#1#2{\edef#2{\towholebigpoints#1\scaledpoint}} % obsolete
%D \macros
%D {PointsToReal}
@@ -5596,7 +5586,7 @@
% \protected\def\PointsToReal#1#2%
% {\edef#2{\withoutpt\the\dimexpr#1}}
-\protected\def\PointsToReal#1#2%
+\permanent\protected\def\PointsToReal#1#2%
{\edef#2{\thewithoutunit\dimexpr#1}}
%D \macros
@@ -5656,11 +5646,11 @@
%D These macros are sort of obsolete as we never use uppercase this way. But
%D nevertheless we provide them:
-\def\utfupper#1{\clf_upper{#1}} % expandable
-\def\utflower#1{\clf_lower{#1}} % expandable
+\permanent\def\utfupper#1{\clf_upper{#1}} % expandable
+\permanent\def\utflower#1{\clf_lower{#1}} % expandable
-\protected\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}}
-\protected\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}}
+\permanent\protected\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}}
+\permanent\protected\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}}
%D \macros
%D {handletokens}
@@ -5705,14 +5695,14 @@
\expandafter\syst_helpers_count_token
\fi}
-\protected\def\counttoken#1\in#2\to#3%
+\permanent\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}
-\protected\def\counttokens#1\to#2%
+\permanent\protected\def\counttokens#1\to#2%
{\privatescratchcounter\zerocount
\def\syst_helpers_count_token##1{\advance\privatescratchcounter\plusone}%
\handletokens#1\with\syst_helpers_count_token
@@ -5724,7 +5714,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.
-\protected\def\splitofftokens#1\from#2\to#3% slow but hardly used
+\permanent\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%
@@ -5771,7 +5761,7 @@
\protected\def\syst_helpers_handle_tokens % \nexthandledtoken is part of interface
{\futurelet\nexthandledtoken\syst_helpers_handle_tokens_indeed}
-\protected\def\handletokens#1\with#2%
+\permanent\protected\def\handletokens#1\with#2%
{\gdef\syst_helpers_handle_tokens_command{#2}% permits more complex #2's
\syst_helpers_handle_tokens#1\end}
@@ -5820,8 +5810,8 @@
\newtoks\everysettrialtypesetting
\newtoks\everyresettrialtypesetting
-\protected\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so
-\protected\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed
+\permanent\protected\def\settrialtypesetting {\the\everysettrialtypesetting } % obeys grouping so
+\permanent\protected\def\resettrialtypesetting{\the\everyresettrialtypesetting} % this one is seldom needed
\let\iftrialtypesetting\iffalse % so we have no \trialtypesettingtrue|false in mkiv !
@@ -5835,10 +5825,10 @@
%D limit the precission. The next macro rounds a real number to two digits. It takes
%D one argument and only works in \ETEX.
-\def\integerrounding #1{\clf_rounded\zerocount\numexpr#1\relax}
-\def\onedigitrounding #1{\clf_rounded\plusone \numexpr#1\relax}
-\def\twodigitrounding #1{\clf_rounded\plustwo \numexpr#1\relax}
-\def\threedigitrounding#1{\clf_rounded\plusthree\numexpr#1\relax}
+\permanent\def\integerrounding #1{\clf_rounded\zerocount\numexpr#1\relax}
+\permanent\def\onedigitrounding #1{\clf_rounded\plusone \numexpr#1\relax}
+\permanent\def\twodigitrounding #1{\clf_rounded\plustwo \numexpr#1\relax}
+\permanent\def\threedigitrounding#1{\clf_rounded\plusthree\numexpr#1\relax}
%D \macros
%D {processcontent}
@@ -5850,7 +5840,7 @@
%D {\processcontent{stophans}\test{\message{\test}\wait}}
%D \stoptyping
-\protected\def\processcontent#1%
+\permanent\protected\def\processcontent#1%
{\begingroup\expandafter\syst_helpers_process_content\csname#1\endcsname}
\protected\def\syst_helpers_process_content#1#2#3%
@@ -5863,11 +5853,11 @@
%D
%D These two macros savely grab and dispose two arguments.
-\tolerant\protected\def\dogobblesingleempty [#-]{}
-\tolerant\protected\def\dogobbledoubleempty[#-]#*[#-]{}
+\permanent\tolerant\protected\def\dogobblesingleempty [#-]{}
+\permanent\tolerant\protected\def\dogobbledoubleempty[#-]#*[#-]{}
-\let\gobblesingleempty\dogobblesingleempty % also used
-\let\gobbledoubleempty\dogobbledoubleempty % also used
+\aliased\let\gobblesingleempty\dogobblesingleempty % also used
+\aliased\let\gobbledoubleempty\dogobbledoubleempty % also used
%D \macros
%D {setdimensionwithunit, freezedimensionwithunit}
@@ -5885,10 +5875,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.
-\protected\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick
+\permanent\protected\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick
{\afterassignment\gobblefourarguments#1=#2#3pt\relax\empty\empty\empty\empty}
-\protected\def\freezedimensionwithunit#1#2%
+\permanent\protected\def\freezedimensionwithunit#1#2%
{\setdimensionwithunit\privatescratchdimen#1{#2}\edef#1{\the\privatescratchdimen}}
%D \macros
@@ -5896,28 +5886,28 @@
%D
%D Not that fast I guess, but here's a way to test for token registers being empty.
-\protected\def\doifelsesometoks#1%
+\permanent\protected\def\doifelsesometoks#1%
{\iftok#1\emptytoks
\expandafter\secondoftwoarguments
\else
\expandafter\firstoftwoarguments
\fi}
-\protected\def\doifsometoks#1%
+\permanent\protected\def\doifsometoks#1%
{\iftok#1\emptytoks
\expandafter\gobbleoneargument
\else
\expandafter\firstofoneargument
\fi}
-\protected\def\doifemptytoks#1%
+\permanent\protected\def\doifemptytoks#1%
{\iftok#1\emptytoks
\expandafter\firstofoneargument
\else
\expandafter\gobbleoneargument
\fi}
-\let\doifsometokselse\doifelsesometoks
+\aliased\let\doifsometokselse\doifelsesometoks
%D \macros
%D {startstrictinspectnextcharacter}
@@ -5933,12 +5923,12 @@
\expandafter\m_syst_action_nop
\fi}
-\protected\def\strictdoifelsenextoptional#1#2%
+\permanent\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}
-\let\strictdoifnextoptionalelse\strictdoifelsenextoptional
+\aliased\let\strictdoifnextoptionalelse\strictdoifelsenextoptional
%D \macros
%D {gobblespacetokens}
@@ -5948,7 +5938,7 @@
%\def\gobblespacetokens
% {\doifnextcharelse\empty\donothing\donothing} % no {}\do\do !
-\def\gobblespacetokens
+\permanent\def\gobblespacetokens
{\afterassignment\nexttoken\let\nexttoken=}
%D \macros
@@ -5956,20 +5946,20 @@
%D
%D As the name says, this macro converts its argument to a (rather safe) string.
-\let\verbatimstring\detokenize
+\aliased\let\verbatimstring\detokenize
%D These are needed in ordinal number conversions:
-\def\lastdigit#1%
+\permanent\def\lastdigit#1%
{\expandafter\thelastdigit\number#1\relax}
-\def\thelastdigit#1#2%
+\permanent\def\thelastdigit#1#2%
{\ifx#2\relax#1\else\expandafter\thelastdigit\expandafter#2\fi}
-\def\lasttwodigits#1%
+\permanent\def\lasttwodigits#1%
{\expandafter\thelasttwodigits\expandafter0\number#1\relax}
-\def\thelasttwodigits#1#2#3% 0 dig ... \relax
+\permanent\def\thelasttwodigits#1#2#3% 0 dig ... \relax
{\ifx#3\relax#1#2\else\expandafter\thelasttwodigits\expandafter#2\expandafter#3\fi}
%D \macros
@@ -5982,7 +5972,7 @@
\def\syst_helpers_serialize_comma_list_step#1%
{\edef\serializedcommalist{\serializedcommalist#1}}
-\protected\def\serializecommalist[#1]%
+\permanent\protected\def\serializecommalist[#1]%
{\let\serializedcommalist\empty
\processcommacommand[#1]\syst_helpers_serialize_comma_list_step}
@@ -6000,7 +5990,7 @@
%D relax-less \type {\purenumber}. This macro works ok with \type {\the}, \type
%D {\number} as well as \ETEX's \type {\numexpr}.
-\def\purenumber#1{\expandafter\firstofoneargument\expandafter{\number#1}}
+\permanent\def\purenumber#1{\expandafter\firstofoneargument\expandafter{\number#1}}
%D \macros
%D {filterfromvalue}
@@ -6025,7 +6015,7 @@
%D
%D I'll implement this when I'm in \quotation {writing dirty macros mood}.
-\def\dofilterfromstr#1#2% max n % no need to be fast
+\permanent\def\dofilterfromstr#1#2% max n % no need to be fast
{\expandafter \expandafter \expandafter \csstring
\ifcase#1\or \ifcase#2\or
\firstofoneargument \else
@@ -6054,7 +6044,7 @@
\gobblefivearguments \fi
\fi}
-\def\filterfromvalue#1#2#3% value max n
+\permanent\def\filterfromvalue#1#2#3% value max n
{\expandafter\doubleexpandafter\csname % we use the fact that an
\expandafter\ifx\csname#1\endcsname\relax % undefined cs has become \relax
\csstring\gobbleoneargument % which we then gobble here
@@ -6063,7 +6053,7 @@
\fi
\endcsname\csname#1\endcsname}
-\def\filterfromnext#1#2% max n {..}{..}{..}{..}
+\permanent\def\filterfromnext#1#2% max n {..}{..}{..}{..}
{\csname\dofilterfromstr{#1}{#2}\endcsname}
%D \macros
@@ -6252,9 +6242,9 @@
\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}
+\permanent\def\flag#1{\csname\??flag#1\endcsname}
-\def\doifelseflagged#1%
+\permanent\def\doifelseflagged#1%
{\expandafter\ifx\csname\??flag#1\endcsname\relax
\expandafter\secondoftwoarguments
\orelse\ifcase\csname\??flag#1\endcsname
@@ -6263,9 +6253,9 @@
\expandafter\secondoftwoarguments
\fi}
-\let\doifflaggedelse\doifelseflagged
+\aliased\let\doifflaggedelse\doifelseflagged
-\def\doifnotflagged#1%
+\permanent\def\doifnotflagged#1%
{\expandafter\ifx\csname\??flag#1\endcsname\relax
\expandafter\firstofoneargument
\orelse\ifcase\csname\??flag#1\endcsname
@@ -6274,7 +6264,7 @@
\expandafter\firstofoneargument
\fi}
-\protected\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey
+\permanent\protected\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey
{\defcsname#1#3\expandafter\endcsname\expandafter{\csname#1#5\endcsname}}
\def\syst_helpers_if_non_zero_positive_else#1#2\end % #3#4%
@@ -6293,10 +6283,10 @@
% used ?
-\def\doifelsenonzeropositive#1%
+\permanent\def\doifelsenonzeropositive#1%
{\begingroup\afterassignment\syst_helpers_if_non_zero_positive_else\privatescratchcounter=0#1\relax\empty\end}
-\let\doifnonzeropositiveelse\doifelsenonzeropositive
+\aliased\let\doifnonzeropositiveelse\doifelsenonzeropositive
% here ?
@@ -6305,26 +6295,26 @@
\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}
-\protected\def\getrawgparameters {\dogetparameters\dosetrawgvalue}
-\protected\def\getrawxparameters {\dogetparameters\dosetrawxvalue}
+\permanent\protected\def\getrawparameters {\dogetparameters\dosetrawvalue }
+\permanent\protected\def\getraweparameters {\dogetparameters\dosetrawevalue}
+\permanent\protected\def\getrawgparameters {\dogetparameters\dosetrawgvalue}
+\permanent\protected\def\getrawxparameters {\dogetparameters\dosetrawxvalue}
-\protected\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete
+\permanent\protected\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete
%D Sort of obsolete:
\newcount\c_syst_helpers_mod
-\protected\def\dosetmodulo#1#2#3%
+\permanent\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}
-\protected\def\dosetdivision#1#2#3%
+\permanent\protected\def\dosetdivision#1#2#3%
{#3#1\divide#3 #2\relax}
-\protected\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}}
-\protected\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}}
+\permanent\protected\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}}
+\permanent\protected\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}}
\def\syst_helpers_unprotected#1\par
{#1\protect}
@@ -6333,13 +6323,13 @@
{\unprotect
\syst_helpers_unprotected}
-\let\resettimer \clf_resettimer
-\let\elapsedtime \clf_elapsedtime
-\let\elapsedseconds\elapsedtime
+\aliased\let\resettimer \clf_resettimer % todo: at lua end
+\aliased\let\elapsedtime \clf_elapsedtime % todo: at lua end
+\aliased\let\elapsedseconds\elapsedtime
\let\elapsedsteps\!!zerocount
-\protected\def\elapsedsteptime % unexpanded ! a bit useless but who knows ...
+\permanent\protected\def\elapsedsteptime % unexpanded ! a bit useless but who knows ...
{\clf_elapsedsteptime\elapsedsteps\relax}
\newcount\c_syst_helpers_test_feature_n
@@ -6347,7 +6337,7 @@
\def\currentfeaturetest{\number\c_syst_helpers_test_feature_n}
-\protected\def\testfeature#1#2%
+\permanent\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
@@ -6362,7 +6352,7 @@
\fi}%
\retestfeature}
-\protected\def\retestfeature % timer support is new per 10/5/2005
+\permanent\protected\def\retestfeature % timer support is new per 10/5/2005
{\bgroup
\ifcase\interactionmode\let\wait\relax\fi
\clf_resettimer
@@ -6381,10 +6371,10 @@
\clf_elapsedsteptime\elapsedsteps\space\space per step}%
\egroup}
-\protected\def\showtimer#1%
+\permanent\protected\def\showtimer#1%
{\writestatus{runtime}{\elapsedseconds\space s / #1}}
-\protected\def\testfeatureonce#1#2%
+\permanent\protected\def\testfeatureonce#1#2%
{\begingroup
\let\wait\relax
\testfeature{#1}{#2}%
@@ -6399,7 +6389,7 @@
%D \freezedimenmacro\leftmargindistance
%D \stoptyping
-\protected\def\freezedimenmacro#1%
+\permanent\protected\def\freezedimenmacro#1%
{\edef#1{\the\dimexpr#1}}
%D The next macro negates a macro (dimension or number, or actually, whatever. It's
@@ -6410,24 +6400,24 @@
%D \if--\whatever\else-\whatever\fi => then => whatever
%D \stoptyping
-\def\negated#1{\if-#1\else-#1\fi} % does only work in macros or text
+\permanent\def\negated#1{\if-#1\else-#1\fi} % does only work in macros or text
\def\gobbleassigndimen#1\\{}
-\def\assigndimen#1#2%
+\permanent\def\assigndimen#1#2%
{\afterassignment\gobbleassigndimen#1=#2\zeropoint\\}
-\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}
+\permanent\protected\def\appended#1#2#3{\expandafter#1\expandafter#2\expandafter{#2#3}}
+\permanent\protected\def\appendvalue #1{\expandafter\appended\expandafter \def\csname#1\endcsname}
+\permanent\protected\def\appendgvalue#1{\expandafter\appended\expandafter\gdef\csname#1\endcsname}
\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}}
-\protected\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname}
-\protected\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname}
+\permanent\protected\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname}
+\permanent\protected\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname}
%D \macros
%D {dowithrange}
@@ -6449,11 +6439,11 @@
\ifempty\m_syst_helpers_range_to\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}}}%
-\protected\def\processranges[#1]#2% #1= n:m,p,q:r
+\permanent\protected\def\processranges[#1]#2% #1= n:m,p,q:r
{\def\m_helpers_range_action{#2}%
\processcommacommand[#1]\syst_helpers_with_range}
-\protected\def\dowithrange#1#2%
+\permanent\protected\def\dowithrange#1#2%
{\def\m_helpers_range_action{#2}%
\processcommacommand[#1]\syst_helpers_with_range}
@@ -6472,7 +6462,7 @@
%D
%D \typebuffer \getbuffer
-\protected\def\ignoreimplicitspaces
+\permanent\protected\def\ignoreimplicitspaces
{\doifelsenextchar\relax\relax\relax}
%D \macros
@@ -6480,6 +6470,8 @@
%D
%D Not that sophisticated but sometimes users (like in metafun).
+%D This will be overloaded.
+
\def\syst_helpers_process_word#1 #2\_e_o_w_
{\doifsomething{#1}{\processword{#1} \syst_helpers_process_word#2 \_e_o_w_}}
@@ -6499,17 +6491,17 @@
\newbox\b_syst_helpers_no_interference
-\protected\def\startnointerference % not even grouped !
+\permanent\protected\def\startnointerference % not even grouped !
{\setbox\b_syst_helpers_no_interference\vbox
\bgroup}
-\protected\def\stopnointerference
+\permanent\protected\def\stopnointerference
{\egroup
\setbox\b_syst_helpers_no_interference\emptybox}
%D A variant for \type {\executeifdefined}:
-\def\expandcheckedcsname#1#2% #2 is often a \xxxparameter so let's expand it once
+\permanent\def\expandcheckedcsname#1#2% #2 is often a \xxxparameter so let's expand it once
{\normalexpanded{\noexpand\syst_helpers_expand_checked_csname{#1}{#2}}}
\def\syst_helpers_expand_checked_csname#1#2#3%
@@ -6523,7 +6515,7 @@
%D A few secial variants of commands defined here. Some more will be moved here (e.g.
%D from table modules.
-\def\dodirectdoubleempty#1#2% used in math (lookahead issues)
+\permanent\def\dodirectdoubleempty#1#2% used in math (lookahead issues)
{\ifx#2[%
\expandafter\syst_helpers_direct_double_empty_one_yes
\else
@@ -6547,7 +6539,7 @@
%D
%D \typebuffer \startlines \getbuffer \stoplines
-\def\docheckedpair#1%
+\permanent\def\docheckedpair#1%
{\syst_helpers_checked_pair#1,,\_o_e_p_}
% \def\syst_helpers_checked_pair#1,#2,#0\_o_e_p_
@@ -6559,7 +6551,7 @@
%D Here are some nasty helpers. They can be used to fill often expanded token
%D lists efficiently (see tabulate for an example).
-\def\constantnumber#1%
+\permanent\def\constantnumber#1%
{\ifcase#1\zerocount
\or \plusone
\or \plustwo
@@ -6573,7 +6565,7 @@
\or \plusten
\else \number#1\relax\fi}
-\def\constantnumberargument#1%
+\permanent\def\constantnumberargument#1%
{\ifcase#1\zerocount
\or \plusone
\or \plustwo
@@ -6587,21 +6579,21 @@
\or \plusten
\else {\number#1}\fi}
-\def\constantdimen#1%
+\permanent\def\constantdimen#1%
{\ifdim#1=\zeropoint
\zeropoint
\else
\the#1\relax
\fi}
-\def\constantdimenargument#1%
+\permanent\def\constantdimenargument#1%
{\ifdim#1=\zeropoint
\zeropoint
\else
{\the#1}%
\fi}
-\def\constantemptyargument#1%
+\permanent\def\constantemptyargument#1%
{\ifempty#1%
\noexpand\empty
\else
@@ -6626,11 +6618,11 @@
% expandable:
-\def\getsubstring#1#2#3{\clf_getsubstring{#3}{#1}{#2}}
+\permanent\def\getsubstring#1#2#3{\clf_getsubstring{#3}{#1}{#2}}
%D Other dimensions than pt (used in mb-mp)
-\def\converteddimen#1#2{\clf_converteddimen\dimexpr#1\relax{#2}}
+\permanent\def\converteddimen#1#2{\clf_converteddimen\dimexpr#1\relax{#2}}
%D Maybe (looks ugly):
%D
@@ -6699,16 +6691,16 @@
%D This is not real fast but quite okay:
%def\ntimes#1#2{\ifnum#2>\zerocount#1\ntimes{#1}{\numexpr#2-\plusone\relax}\fi} % 1.72
-\def\ntimes#1#2{\clf_ntimes{#1}\numexpr#2\relax} % 0.33
+\permanent\def\ntimes#1#2{\clf_ntimes{#1}\numexpr#2\relax} % 0.33
%D Experiment (sometimes looks nicer in code):
-\protected\def\sameargumentscondition#1#2%
+\permanent\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}
-\protected\def\emptyargumentcondition#1%
+\permanent\protected\def\emptyargumentcondition#1%
{\edef\m_syst_string_one{#1}%
\ifempty\m_syst_string_one}
diff --git a/tex/context/base/mkiv/tabl-xtb.mklx b/tex/context/base/mkiv/tabl-xtb.mklx
index 9265ff782..a0fe41428 100644
--- a/tex/context/base/mkiv/tabl-xtb.mklx
+++ b/tex/context/base/mkiv/tabl-xtb.mklx
@@ -179,11 +179,11 @@
\aliased\permanent\let\stopxtable\relax
% These direct buffers can be somewhat faster but it's probably neglectable.
-% Anyway, no nesting is supported as we then need to catch (e.g.) rows and
-% keep track of nesting and have a more complex redefinition of nested
-% instanced \unknown\ it's not worth the trouble. Only use them when you
-% really need them and use the embeddedxtable command when nesting them.
-% Implementing nesting would be slower than not using direct buffers.
+% Anyway, no nesting is supported as we then need to catch (e.g.) rows and keep
+% track of nesting and have a more complex redefinition of nested instanced
+% \unknown\ it's not worth the trouble. Only use them when you really need them and
+% use the embeddedxtable command when nesting them. Implementing nesting would be
+% slower than not using direct buffers.
\permanent\tolerant\protected\def\processxtablebuffer[#name]%
{\bgroup
@@ -203,7 +203,7 @@
%D A bonus: you have to use the following construct inside a macro or
%D direct buffer.
-\permanent\tolerant\protected\def\startembeddedxtable[#settings]#;#content\stopembeddedxtable
+\permanent\tolerant\protected\def\startembeddedxtable[#settings]#:#content\stopembeddedxtable
{\tabl_x_prepare{#settings}%
\clf_assignbuffer{embedded_x_table}{\detokenize{#content}}\catcodetable\relax
\bgroup
@@ -482,7 +482,7 @@
\permanent\protected\def\dummyxcell
{\begingroup
- \let\inheritedxtableframed\relax
+ \enforced\let\inheritedxtableframed\relax
\tabl_x_start_cell_nop
\tabl_x_stop_cell
\endgroup}
diff --git a/tex/context/base/mkiv/trac-vis.mkxl b/tex/context/base/mkiv/trac-vis.mkxl
index 77df80848..dd69e0bb8 100644
--- a/tex/context/base/mkiv/trac-vis.mkxl
+++ b/tex/context/base/mkiv/trac-vis.mkxl
@@ -193,27 +193,27 @@
%D We keep these for a while:
-\let\ruledhss \hss
-\let\ruledhfil \hfil
-\let\ruledhfill \hfill
-\let\ruledhfilll \hfilll
-\let\ruledhfilneg \hfilneg
-\let\ruledhfillneg \hfillneg
-\let\ruledhfilllneg \hfilllneg
-\let\ruledvss \vss
-\let\ruledvfil \vfil
-\let\ruledvfill \vfill
-\let\ruledvfilll \vfilll
-\let\ruledvfilneg \vfilneg
-\let\ruledvfillneg \vfillneg
-\let\ruledvfilllneg \vfilllneg
-\let\ruledhskip \hskip
-\let\ruledvskip \vskip
-\let\ruledkern \kern
-\let\ruledhglue \hglue
-\let\ruledvglue \vglue
-\let\ruledmkern \mkern
-\let\ruledmskip \mskip
-\let\ruledpenalty \penalty
+% \aliased\let\ruledhss \hss
+% \aliased\let\ruledhfil \hfil
+% \aliased\let\ruledhfill \hfill
+% \aliased\let\ruledhfilll \hfilll
+% \aliased\let\ruledhfilneg \hfilneg
+% \aliased\let\ruledhfillneg \hfillneg
+% \aliased\let\ruledhfilllneg \hfilllneg
+% \aliased\let\ruledvss \vss
+% \aliased\let\ruledvfil \vfil
+% \aliased\let\ruledvfill \vfill
+% \aliased\let\ruledvfilll \vfilll
+% \aliased\let\ruledvfilneg \vfilneg
+% \aliased\let\ruledvfillneg \vfillneg
+% \aliased\let\ruledvfilllneg \vfilllneg
+% \aliased\let\ruledhskip \hskip
+% \aliased\let\ruledvskip \vskip
+% \aliased\let\ruledkern \kern
+% \aliased\let\ruledhglue \hglue
+% \aliased\let\ruledvglue \vglue
+% \aliased\let\ruledmkern \mkern
+% \aliased\let\ruledmskip \mskip
+% \aliased\let\ruledpenalty \penalty
\protect \endinput
diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv
index 39ca00ced..7116a5b32 100644
--- a/tex/context/modules/mkiv/m-scite.mkiv
+++ b/tex/context/modules/mkiv/m-scite.mkiv
@@ -311,11 +311,14 @@ moduledata.scite = scite
\stopluacode
-\definetyping[TEX] [option=cld]
-\definetyping[LUA] [option=lua]
+%definetyping[TEX] [option=cld]
+\setuptyping [TEX] [option=cld]
+%definetyping[LUA] [option=lua]
+\setuptyping [LUA] [option=lua]
\definetyping[BTX] [option=bibtex]
\definetyping[MPS] [option=mps]
-\definetyping[MP] [option=mp]
+%definetyping[MP] [option=mp]
+\setuptyping [MP] [option=mp]
\definetyping[PDF] [option=pdf]
\definetyping[CPP] [option=cpp] % Which is kind of like the web one.
\definetyping[WEB] [option=web]
diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl
index 57417b2e1..48b0f5ed3 100644
--- a/tex/context/modules/mkiv/s-system-macros.mkxl
+++ b/tex/context/modules/mkiv/s-system-macros.mkxl
@@ -16,12 +16,18 @@
% todo: \permanent\protected\let\select\directselect : same value (add ref)
+% todo: when mutable, remove immutable
+
\startmodule[system-macros]
\continueifinputfile{s-system-macros.mkxl}
\usemodule[article-basic] \setuplayout[tight] \setupbodyfont[7pt,tt]
+\setuppapersize
+ [A4,landscape]
+ [A4,landscape]
+
\starttext
\startluacode
@@ -36,13 +42,51 @@
local crap = "[$>%|%&%#" .. string.char(0xEF) .. "]"
+ local basefile = resolvers.findfile("context.mkxl")
+ local swapnames = { }
+
+ local pattern = file.join(file.pathpart(basefile),"/*.mk*")
+ local filenames = dir.glob(pattern)
+ for i=1,#filenames do
+ swapnames[file.basename(filenames[i])] = true
+ end
+
+ local pattern = file.join(file.pathpart(basefile),"/*.l**")
+ local filenames = dir.glob(pattern)
+ for i=1,#filenames do
+ swapnames[file.basename(filenames[i])] = true
+ end
+
+ local hashnames = table.setmetatableindex(function(t,k)
+ local s = file.suffix(k)
+ local v = k
+ if s == "mkiv" then
+ local n = file.replacesuffix(k,"mkxl")
+ if swapnames[n] then
+ v = n
+ end
+ elseif s == "mkvi" then
+ local n = file.replacesuffix(k,"mklx")
+ if swapnames[n] then
+ v = n
+ end
+ elseif s == "lua" then
+ local n = file.replacesuffix(k,"lmt")
+ if swapnames[n] then
+ v = n
+ end
+ end
+ t[k] = v
+ return v
+ end)
+
require("mtx-interface")
local data = scripts.interface.editor("data")
local files = data and data.common and data.common.filenames or { }
local t = tex.hashtokens()
table.sort(t)
local function show(check)
- context.starttabulate { "|l|l|l|l|l|l|l|l|l|" }
+ context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" }
for i=1,#t do
local k = t[i]
if check(k) then
@@ -51,12 +95,12 @@
local permanent = v.permanent and "permanent"
local immutable = v.immutable and "immutable"
local primitive = v.primitive and "primitive"
- local mutable = v.immutable and "mutable"
+ local mutable = v.mutable and "mutable"
local tolerant = v.tolerant and "tolerant"
local noaligned = v.noaligned and "noaligned"
local instance = v.instance and "instance"
local parameters = v.parameters or 0
- local dealtwith = frozen or permanent or immutable or primitive or mutable -- beware: we can have combinations
+ local dealtwith = mutable or immutable or frozen or permanent or primitive -- beware: we can have combinations
local cscommand = gsub(v.cmdname or "","_"," ")
local whatever = find(k,"^[a-z][a-z][a-z]+_")
local filename = files[k]
@@ -65,11 +109,14 @@
ctx_NC() if primitive then ctx_bold(csname) else context(csname) end
ctx_NC() if parameters > 0 then context(parameters) end
ctx_NC() context(cscommand)
- ctx_NC() if dealtwith then context(dealtwith) end
ctx_NC() if tolerant then context(tolerant) end
- ctx_NC() if instance then context(instance) end
+ ctx_NC() if primitive then context(primitive) end
+ ctx_NC() if permanent then context(permanent) end
+ ctx_NC() if frozen then context(frozen) end
+ ctx_NC() if immutable then context(immutable) end
+ ctx_NC() if mutable then context(mutable) end
ctx_NC() if noaligned then context(noaligned) end
- ctx_NC() if filename then context(filename) end
+ ctx_NC() if filename then context(hashnames[filename]) end
ctx_NC() ctx_NR()
end
end
@@ -83,6 +130,23 @@
show(function(k) return not find(k,"^[a-zA-Z]+$") and not find(k,crap) end)
\stopluacode
+\page
+
+\starttabulate[|c|l|]
+\HL
+\NC \type {+} \NC mutable, immutable, frozen, permanent, primitive \NC \NR
+\NC \type {-} \NC protected by obscurity (underscores) \NC \NR
+\NC \type {!} \NC instance (can be frozen) \NC \NR
+\NC \type {0-9} \NC the number of arguments (argument grabbing can be delegated) \NC \NR
+\HL
+\stoptabulate
+
+Often frozen commands are redefined on demand and they can be overloaded. Mutable
+doesn't mean that a user can change it without consequences, for instance the
+\type {\current...} ones. Primitives come with the engine, permanent macros are
+the core of \CONTEXT. Noaligned macros are special and dealt deep down when
+scanning for alignment specific primitives.
+
\stoptext
\stopmodule
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index ea779dc80..0ade30aed 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2020-11-05 15:20
+-- merge date : 2020-11-05 22:57
do -- begin closure to overcome local limits and interference