summaryrefslogtreecommitdiff
path: root/tex/context/base/syst-new.tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/syst-new.tex')
-rw-r--r--tex/context/base/syst-new.tex128
1 files changed, 69 insertions, 59 deletions
diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex
index 13a3f64be..183ad8cb4 100644
--- a/tex/context/base/syst-new.tex
+++ b/tex/context/base/syst-new.tex
@@ -8,15 +8,15 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
-%D Code from this module will move. For instance to
+%D Code from this module will move. For instance to
%D syst-dat.tex (datastructures).
\unprotect
-% moved from core-ntb
+% moved from core-ntb
\def\v!oddeven#1{\ifodd#1\v!oneven\else\v!even\fi}
@@ -34,7 +34,7 @@
{\global\advance\nofprofiled\plusone
\csname\string#1\string#1\endcsname}}
-% pretty ugly but fast
+% pretty ugly but fast
% \copycsname xxx\endcsname\csname ..\endcsname
@@ -50,7 +50,7 @@
% another one, add an item to a commalist
-\def\addvalue#1#2% cs item
+\def\addvalue#1#2% cs item
{\ifundefined{#1}\@EA\let\csname#1\endcsname\empty\fi
\expanded{\addtocommalist{#2}\@EA\noexpand\csname#1\endcsname}}
@@ -102,7 +102,7 @@
\def\setobeyedlccode#1{\lccode#1\obeyedlccode}
\def\obeylccodes
- {\let\withcharacter\setownlccode
+ {\let\withcharacter\setownlccode
\the\withlowercharacters
\let\withcharacter\setobeyedlccode
\the\withminorcharacters
@@ -126,47 +126,47 @@
\def\unspaceafter#1#2%
{\edef\ascii{\dounspaced#2\end}\@EA#1\@EA{\ascii}}
-% etex, much faster
+% etex, much faster
%
% \def\unspaceargument#1\to#2%
% {\scratchcounter\catcode'32\catcode32=\@@ignore
-% \scantokens{\edef#2{#1}}%
+% \scantokens{\edef#2{#1}}%
% \catcode32=\scratchcounter}
\def\unspaceafter#1#2%
{\edef\ascii{\dounspaced#2\end}\@EA#1\@EA{\ascii}}
-% this will replace loadfile once and alike !!! todo
+% this will replace loadfile once and alike !!! todo
\def\@flg@{@flg@}
\def\setflag#1%
- {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname\zerocount}
+ {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname\zerocount}
\def\resetflag#1%
- {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname\plusone}
+ {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname\plusone}
\let\ifflagged\ifcase
\def\flag#1{\csname\@flg@#1\endcsname}
\def\doifelseflagged#1%
- {\@EA\ifx\csname\@flg@#1\endcsname\relax
+ {\@EA\ifx\csname\@flg@#1\endcsname\relax
\@EA\secondoftwoarguments
- \else\ifcase\csname\@flg@#1\endcsname
+ \else\ifcase\csname\@flg@#1\endcsname
\@EAEAEA\firstoftwoarguments
\else
\@EAEAEA\secondoftwoarguments
- \fi\fi}
+ \fi\fi}
\def\doifnotflagged#1%
- {\@EA\ifx\csname\@flg@#1\endcsname\relax
+ {\@EA\ifx\csname\@flg@#1\endcsname\relax
\@EA\firstofoneargument
- \else\ifcase\csname\@flg@#1\endcsname
- \@EAEAEA\gobbleoneargument
+ \else\ifcase\csname\@flg@#1\endcsname
+ \@EAEAEA\gobbleoneargument
\else
\@EAEAEA\firstofoneargument
- \fi\fi}
+ \fi\fi}
\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey % [bypasses k!prefix]
{\@EAEAEA\def\@EA\csname\@EA#1\@EA#3\@EA\endcsname\@EA
@@ -176,21 +176,21 @@
% \setarrayelement{test}{1}{qq}
% \arrayelement{test}{1}
% \arraylength{test}
-%
+%
% \def\buildarray[#1][#2]%
-% {\scratchcounter=0
+% {\scratchcounter=0
% \def\docommando##1%
-% {\advance\scratchcounter by 1
+% {\advance\scratchcounter by 1
% \setvalue{@@aa#1\the\scratchcounter}{##1}}%
% \processcommalist[#2]\docommando
% \setevalue{@@aa#1}{\the\scratchcounter}}%
-%
+%
% \def\setarrayelement#1#2{\setvalue{@@aa#1#2}}
% \def\arrayelement #1#2{\getvalue{@@aa#1#2}}
% \def\arraylength #1{\getvalue{@@aa#1}}
% \newsignal\junksignal
-%
+%
% \def\setjunksignal%
% {\ifhmode
% \hskip\junksignal
@@ -198,7 +198,7 @@
% \else
% \let\removejunkspaces\relax
% \fi}
-%
+%
% \def\doremovejunkspaces%
% {\doloop{\ifdim\lastskip=\junksignal\unskip\else\exitloop\fi}}
@@ -223,7 +223,7 @@
\def\doifnonzeropositiveelse#1%
{\begingroup\afterassignment\dodoifnonzeropositiveelse\scratchcounter=0#1\relax\empty\end}
-% here ?
+% here ?
\def\dosetrawvalue #1#2#3{\@EA \def\csname#1#2\endcsname{#3}}
\def\dosetrawevalue#1#2#3{\@EA\edef\csname#1#2\endcsname{#3}}
@@ -235,7 +235,7 @@
\def\getrawgparameters {\dogetparameters\dosetrawgvalue}
\def\getrawxparameters {\dogetparameters\dosetrawxvalue}
-\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete
+\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete
\def\splitskip#1%
{\scratchskip\zeropoint \!!plus 1pt \!!minus 1pt
@@ -262,15 +262,15 @@
% \def\minimaxskip#1#2%
% {\splitskip#2\relax
% \scratchdimen=#2\relax
-% #2=\scratchdimen
+% #2=\scratchdimen
% \advance#2 by #1\relax}
-%
+%
% \def\maximizeskip%
% {\minimaxskip{-\dimen4}}
-%
+%
% \def\maximizeskip%
% {\minimaxskip{\dimen2}}
-%
+%
% \def\maximizespacing%
% {\maximizeskip\blankoskipamount
% \maximizeskip\parskip
@@ -378,17 +378,17 @@
%D {adddimenregister,adddimenmacro}
%D
%D Instead of using numerous \type {\advance}'s, one can use
-%D the next macros to add|/|subtract a series of dimensions
-%D to a register or macro.
+%D the next macros to add|/|subtract a series of dimensions
+%D to a register or macro.
%D
-%D \starttypen
+%D \starttypen
%D \adddimenregister 10pt 5pt \papierbreedte \to \somedimen
%D \adddimenmacro 10pt 5pt \papierbreedte \to \bagger
%D \stoptypen
\newdimen\dimentoaddto
-\def\adddimenregister#1\to#2% will be obsolete once full etex
+\def\adddimenregister#1\to#2% will be obsolete once full etex
{\begingroup
#2=\zeropoint
\dimentoaddto\zeropoint
@@ -410,25 +410,25 @@
%D \macros
%D {freezedimenmacro}
%D
-%D This macro is use as:
+%D This macro is use as:
%D
-%D \starttypen
+%D \starttypen
%D \freezedimenmacro\linkermargeafstand
-%D \stoptypen
+%D \stoptypen
\def\freezedimenmacro#1%
{\scratchdimen#1\edef#1{\the\scratchdimen}}
-%D The next one is slower:
+%D The next one is slower:
%D
%D \starttypen
-%D \def\freezedimenmacro#1{\edef#1{\the\dimexpr(#1)}}
-%D \stoptypen
+%D \def\freezedimenmacro#1{\edef#1{\the\dimexpr(#1)}}
+%D \stoptypen
% \newcount\rawrecursecounter
-%
+%
% \def\rawrecurselevel{\the\rawrecursecounter}%
-%
+%
% \def\dorawrecurse#1#2%
% {\rawrecursecounter\plusone
% \let\oldrecurselevel\recurselevel
@@ -442,6 +442,16 @@
% \fi}%
% \dodorawrecurse}
+%D The next macro negates a macro (dimension or number, or actually, whatever.
+%D It's a typical example of \if usage:
+%D
+%D \starttypen
+%D \if-\whatever \else-\whatever\fi => else => -whatever
+%D \if--\whatever\else-\whatever\fi => then => whatever
+%D \stoptypen
+
+\def\negated#1{\if-#1\else-#1\fi} % does only work in macros or text
+
% This permits things like ^\index{hans}^, where hans is
% duplicated in the text.
@@ -499,15 +509,15 @@
\endETEX
-%D Very handy, more efficient than \type{{}}, and more readable
-%D than \type {\empty}.
+%D Very handy, more efficient than \type{{}}, and more readable
+%D than \type {\empty}.
\let\donothing\empty
-% The following macros are used in XML handling.
+% The following macros are used in XML handling.
-\long\def\dowithstringed#1#2#3#4% " ' space
- {\if#4"\@EA#1\else\if#4'\@EAEAEA#2\else\@EAEAEA#3\fi\fi#4}
+\long\def\dowithstringed#1#2#3#4% " ' space
+ {\if#4"\@EA#1\else\if#4'\@EAEAEA#2\else\@EAEAEA#3\fi\fi#4}
\def\unstringed
{\dowithstringed\unstringdouble\unstringsingle\unstringnothing}
@@ -541,12 +551,12 @@
\ifx#3\relax
\@EAEAEAEAEAEA\@@if@@equal@@false
\else\ifx#1#3%
- % go on
+ % go on
\else
\@EAEAEAEAEAEA\@@if@@equal@@false
\fi\fi
\fi
- \@@ifequal#2\@@and}
+ \@@ifequal#2\@@and}
\long\def\@@if@@equal@@true #1\@@then#2#3{#2}
\long\def\@@if@@equal@@false#1\@@then#2#3{#3}
@@ -559,9 +569,9 @@
\let\notexpanded\empty
\@@expanded}
-% for Simon ; watch how we make them fully expandable (i.e.
+% for Simon ; watch how we make them fully expandable (i.e.
% no \type {\relax}es) popping up
-
+
\def\@@dothenumber#1\relax#2\end{#1}
\def\@@thenumber#1{\@EA\@@dothenumber\number#1\relax\end}
@@ -569,22 +579,22 @@
\def\doifnum#1#2%
{\ifnum#1=\@@thenumber{#2} % space needed
\expandafter\firstofoneargument
- \else
- \expandafter\gobbleoneargument
+ \else
+ \expandafter\gobbleoneargument
\fi}
\def\doifnotnum#1#2%
{\ifnum#1=\@@thenumber{#2} % space needed
\expandafter\gobbleoneargument
- \else
- \expandafter\firstofoneargument
+ \else
+ \expandafter\firstofoneargument
\fi}
\def\doifelsenum#1#2%
{\ifnum#1=\@@thenumber{#2} % space needed
\expandafter\firstoftwoarguments
- \else
- \expandafter\secondoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
\fi}
% \edef\xxxx{\doifnum{1}{2}{no}} \show \xxxx
@@ -596,4 +606,4 @@
\def\appendvalue #1{\@EA\appended\@EA \def\csname#1\endcsname}
\def\appendgvalue#1{\@EA\appended\@EA\gdef\csname#1\endcsname}
-\protect \endinput
+\protect \endinput \ No newline at end of file