summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/core-env.mkiv
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2010-05-24 14:05:02 +0000
committerTaco Hoekwater <taco@elvenkind.com>2010-05-24 14:05:02 +0000
commit57ea7dad48fbf2541c04e434c31bde655ada3ac4 (patch)
tree1f8b43bc7cb92939271e1f5bec610710be69097f /Master/texmf-dist/tex/context/base/core-env.mkiv
parent6ee41e1f1822657f7f23231ec56c0272de3855e3 (diff)
here is context 2010.05.24 13:05
git-svn-id: svn://tug.org/texlive/trunk@18445 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-env.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/core-env.mkiv170
1 files changed, 51 insertions, 119 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-env.mkiv b/Master/texmf-dist/tex/context/base/core-env.mkiv
index c979872687c..d927ff3ad50 100644
--- a/Master/texmf-dist/tex/context/base/core-env.mkiv
+++ b/Master/texmf-dist/tex/context/base/core-env.mkiv
@@ -108,11 +108,11 @@
% simple ones
-\def\doifmodeelse{\unprotect\dodoifmodeelse}
-\def\doifmode {\unprotect\dodoifmode}
-\def\doifnotmode {\unprotect\dodoifnotmode}
-\def\startmode {\unprotect\dostartmode}
-\def\startnotmode{\unprotect\dostartnotmode}
+\unexpanded\def\doifmodeelse{\unprotect\dodoifmodeelse}
+\unexpanded\def\doifmode {\unprotect\dodoifmode}
+\unexpanded\def\doifnotmode {\unprotect\dodoifnotmode}
+\unexpanded\def\startmode {\unprotect\dostartmode}
+\unexpanded\def\startnotmode{\unprotect\dostartnotmode}
\def\dodoifmodeelse
{\docheckformode\firstoftwoarguments\secondoftwoarguments}
@@ -123,23 +123,23 @@
\def\dodoifnotmode
{\docheckformode\gobbleoneargument\firstofoneargument}
-\long\def\dostartmode[#1]%
+\long\unexpanded\def\dostartmode[#1]%
{\docheckformode\donothing\dostopmode{#1}}
\long\def\dostartnotmode[#1]%
{\docheckformode\dostopnotmode\donothing{#1}}
-\let\stopmode \donothing
-\let\stopnotmode\donothing
+\unexpanded\def\stopmode {} % no relax
+\unexpanded\def\stopnotmode{} % no relax
\long\def\dostopmode #1\stopmode {}
\long\def\dostopnotmode#1\stopnotmode{}
-\def\doifallmodeselse{\unprotect\dodoifallmodeselse}
-\def\doifallmodes {\unprotect\dodoifallmodes}
-\def\doifnotallmodes {\unprotect\dodoifnotallmodes}
-\def\startallmodes {\unprotect\dostartallmodes}
-\def\startnotallmodes{\unprotect\dostartnotallmodes}
+\unexpanded\def\doifallmodeselse{\unprotect\dodoifallmodeselse}
+\unexpanded\def\doifallmodes {\unprotect\dodoifallmodes}
+\unexpanded\def\doifnotallmodes {\unprotect\dodoifnotallmodes}
+\unexpanded\def\startallmodes {\unprotect\dostartallmodes}
+\unexpanded\def\startnotallmodes{\unprotect\dostartnotallmodes}
\def\dodoifallmodeselse
{\docheckforallmodes\firstoftwoarguments\secondoftwoarguments}
@@ -156,27 +156,31 @@
\long\def\dostartnotallmodes[#1]%
{\docheckforallmodes\dostopnotallmodes\donothing{#1}}
-\let\stopallmodes \donothing
-\let\stopnotallmodes\donothing
+\unexpanded\def\stopallmodes {} % no relax
+\unexpanded\def\stopnotallmodes{} % no relax
\long\def\dostopallmodes #1\stopallmodes {}
\long\def\dostopnotallmodes#1\stopnotallmodes{}
+%D Lets now set a mode:
+
+\enablemode[mkiv] \setsystemmode{mkiv}
+
%D Setups:
-\let\startsetups\relax % to please dep checker
-\let\stopsetups \relax % to please dep checker
+\unexpanded\def\startsetups{} % to please dep checker
+\unexpanded\def\stopsetups {} % to please dep checker
\expanded
{\long\def\@EA\noexpand\csname\e!start\v!setups\endcsname
{\begingroup\noexpand\doifnextoptionalelse
- {\noexpand\startsetupsA\@EA\noexpand\csname\e!stop\v!setups\endcsname}
- {\noexpand\startsetupsB\@EA\noexpand\csname\e!stop\v!setups\endcsname}}}
+ {\noexpand\dostartsetupsA\@EA\noexpand\csname\e!stop\v!setups\endcsname}
+ {\noexpand\dostartsetupsB\@EA\noexpand\csname\e!stop\v!setups\endcsname}}}
\letvalue{\e!stop\v!setups}\relax
-\unexpanded \def\setups{\doifnextbgroupelse\dosetupsA\dosetupsB} % {..} or [..]
-\unexpanded \def\setup {\doifnextbgroupelse\dosetups \dosetupsC} % {..} or [..]
+\unexpanded\def\setups{\doifnextbgroupelse\dosetupsA\dosetupsB} % {..} or [..]
+\unexpanded\def\setup {\doifnextbgroupelse\dosetups \dosetupsC} % {..} or [..]
\def\dosetupsA #1{\processcommacommand[#1]\dosetups} % {..}
\def\dosetupsB[#1]{\processcommacommand[#1]\dosetups} % [..]
@@ -193,8 +197,20 @@
\fi
\endcsname\empty} % takes one argument
-\def\setupwithargument#1% the grid option will be extended to other main modes
- {\csname\??su:\ifcsname\??su:#1\endcsname#1\else\letterpercent\fi\endcsname}
+% the next one is meant for \c!setups situations, hence the check for
+% a shortcut
+
+\def\doprocesslocalsetups#1%
+ {\edef\tobeprocessedsetups{#1}%
+ \ifx\tobeprocessedsetups\empty\else
+ \dodoprocesslocalsetups
+ \fi}
+
+\def\dodoprocesslocalsetups
+ {\@EA\processcommalist\@EA[\tobeprocessedsetups]\dosetups}
+
+\edef\setupwithargument#1% saves a few expansions
+ {\noexpand\csname\??su:\noexpand\ifcsname\??su:#1\endcsname#1\noexpand\else\letterpercent\noexpand\fi\endcsname}
\let\directsetup\dosetups
@@ -203,27 +219,27 @@
\chardef\setupseolmode\plusone
-\def\startsetups {\xxstartsetups\plusone \stopsetups } \let\stopsetups \relax
-\def\startlocalsetups{\xxstartsetups\plusone \stoplocalsetups} \let\stoplocalsetups\relax
-\def\startrawsetups {\xxstartsetups\zerocount\stoprawsetups } \let\stoprawsetups \relax
-\def\startxmlsetups {\xxstartsetups\plustwo \stopxmlsetups } \let\stopxmlsetups \relax
+\unexpanded\def\startsetups {\xxstartsetups\plusone \stopsetups } \let\stopsetups \relax
+\unexpanded\def\startlocalsetups{\xxstartsetups\plusone \stoplocalsetups} \let\stoplocalsetups\relax
+\unexpanded\def\startrawsetups {\xxstartsetups\zerocount\stoprawsetups } \let\stoprawsetups \relax
+\unexpanded\def\startxmlsetups {\xxstartsetups\plustwo \stopxmlsetups } \let\stopxmlsetups \relax
\def\xxstartsetups#1#2%
- {\begingroup\let\setupseolmode#1\doifnextoptionalelse{\startsetupsA#2}{\startsetupsB#2}}
+ {\begingroup\let\setupseolmode#1\doifnextoptionalelse{\dostartsetupsA#2}{\dostartsetupsB#2}}
-\def\startsetupsA#1% [ ] delimited
+\def\dostartsetupsA#1% [ ] delimited
{\ifcase\setupseolmode\or\catcode`\^^M\@@ignore\or\catcode`\^^M\@@ignore\catcode`\|\@@other\fi
\dotripleempty\dostartsetups[#1]}
-\def\startsetupsB#1#2 % space delimited
+\def\dostartsetupsB#1#2 % space delimited
{\ifcase\setupseolmode\or\catcode`\^^M\@@ignore\or\catcode`\^^M\@@ignore\catcode`\|\@@other\fi
\dodostartsetups#1\empty{#2}}
-\def\startsetupsC[#1][#2][#3]{\dodostartsetups#1{#2}{#3}} % [..] [..]
-\def\startsetupsD[#1][#2][#3]{\dodostartsetups#1\empty{#2}} % [..]
+\def\dostartsetupsC[#1][#2][#3]{\dodostartsetups#1{#2}{#3}} % [..] [..]
+\def\dostartsetupsD[#1][#2][#3]{\dodostartsetups#1\empty{#2}} % [..]
\def\dostartsetups
- {\ifthirdargument\@EA\startsetupsC\else\@EA\startsetupsD\fi}
+ {\ifthirdargument\@EA\dostartsetupsC\else\@EA\dostartsetupsD\fi}
\long\def\dodostartsetups#1#2#3%
{\long\def\dododostartsetups##1#1%
@@ -243,90 +259,6 @@
\dodoglobal\letbeundefined{\??su:#1}%
\fi}
-%D \defineshortcut [style=type]
-%D \defineshortcut [b] [style=bold]
-%D \defineshortcut [e] [style=\em]
-%D \defineshortcut [t] [style=type]
-%D \defineshortcut [c] [style=cap]
-%D \defineshortcut [k] [style=cap]
-%D \defineshortcut [u] [style=type,command=\hyphenatedurl]
-%D
-%D \startlines
-%D test <ziezo> test
-%D test test <t:ziezo>
-%D test test <b:ziezo>
-%D test test <w:ziezo>
-%D zus<>zo zus<:>zo zus<::>zo
-%D test test <t:ziezo> dat (ziezo)
-%D test test <t::ziezo> dat (:ziezo)
-%D test test <t:ziezo:> dat (ziezo:)
-%D test test <t:zi:ezo:> dat (zi:ezo:)
-%D well, <u:http://www.pragma-ade.nl> looks fuzzy
-%D $10<20$
-%D \stoplines
-%D
-%D \defineshortcut [<>] [i] [style=\it]
-%D \defineshortcut [()] [b] [style=\bf]
-%D \defineshortcut [++] [s] [style=\sl]
-%D \defineshortcut [//] [u] [style=\underbars]
-%D \defineshortcut [--] [a] [style=\overstrike]
-%D
-%D \startlines
-%D it seems <i:to work> well
-%D it seems (b:to work) well
-%D it seems +s:to work+ well
-%D it seems /u:to work/ well
-%D it seems -a:to work- well
-%D \stoplines
-
-\def\defineshortcut
- {\dotripleargument\dodefineshortcut}
-
-\def\dodefineshortcut[#1][#2][#3]%
- {\ifthirdargument
- \doifelsenothing{#1}
- {\dododefineshortcut[<>][#2][#3]}
- {\dododefineshortcut[#1][#2][#3]}%
- \else\ifsecondargument
- \dododefineshortcut[<>][#1][#2]%
- \else
- \dododefineshortcut[<>][][#1]%
- \fi\fi}
-
-\def\dododefineshortcut[#1#2][#3][#4]% #1 is the trigger, #2 the delimiter/tag
- {\doifundefined{\??te\??te\string#2}{\letvalue{\??te\??te\string#2}=#1}%
- \defineactivecharacter #1 {\@EA\doshortcut\string#2} % we need to deactivate in math
- \getparameters
- [\??te\string#2#3]
- [\c!commands=,\c!command=,\c!style=,\c!color=,#4]}
-
-\def\doshortcut#1%
- {\ifmmode
- \getvalue{\??te\??te#1}%
- \else
- \bgroup
- \catcode`#1=\@@other
- \def\dodoshortcut##1#1%
- {\def\shorttag{\??te#1}%
- \def\shortcut{##1}%
- \dododoshortcut##1:\end}%
- \@EA\dodoshortcut
- \fi}
-
-\def\dododoshortcut#1:#2\end
- {\doifelsenothing{#2}
- {\doifundefinedelse{\shorttag\c!commands}
- {\shortcut}
- {\@EA\dodododoshortcut\@EA\shorttag\@EA:\shortcut:\end}}
- {\doifundefinedelse{\shorttag#1\c!commands}
- {\shortcut}
- {\dodododoshortcut\shorttag#1:#2\end}}%
- \egroup}
-
-\def\dodododoshortcut#1:#2:\end
- {\getvalue{#1\c!commands}%
- \doattributes{#1}\c!style\c!color{\getvalue{#1\c!command}{#2}}}
-
%D \macros
%D {setvariables,getvariable,getvariabledefault}
%D
@@ -426,7 +358,7 @@
\def\getvariabledefault#1#2% #3% can be command, so no ifcsname here
{\executeifdefined{\??vars:#1:#2}}% {#3}
-% \def\setupenv{\dodoubleargument\rawgetparameters[\??en]}
+% \unexpanded\def\setupenv{\dodoubleargument\rawgetparameters[\??en]}
%
% \def\doifenvelse#1{\doifdefinedelse{\??en#1}} % speed up
% \def\doifenv #1{\doifdefined {\??en#1}} % speed up
@@ -446,7 +378,7 @@
\def\s!environment{environment}
-\def\setupenv {\dotripleargument\dosetvariables[\getrawparameters][\s!environment]}
+\unexpanded\def\setupenv {\dotripleargument\dosetvariables[\getrawparameters][\s!environment]}
\def\doifenvelse{\doifelsevariable \s!environment}
\def\doifenv {\doifvariable \s!environment}
\def\doifnotenv {\doifnotvariable \s!environment}