From 0b61aa2fbf3667649962132eadfb1d78eab0be41 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 13 Jan 2004 00:00:00 +0100 Subject: stable 2004.01.13 --- tex/context/base/supp-mps.tex | 176 ++++++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 82 deletions(-) (limited to 'tex/context/base/supp-mps.tex') diff --git a/tex/context/base/supp-mps.tex b/tex/context/base/supp-mps.tex index 7e37bf1b4..ca56f6eaf 100644 --- a/tex/context/base/supp-mps.tex +++ b/tex/context/base/supp-mps.tex @@ -46,7 +46,7 @@ \def\@@MPG{@MPG@} -%D First we define a handy constant: +%D First we define a handy constant: \bgroup \catcode`\%=\@@other \xdef\letterpercent{\string%} \egroup @@ -64,7 +64,7 @@ %D This is implemented as: \long\def\startMPgraphic#1\stopMPgraphic - {\checkMPTEXgraphic{#1}% % potential speedup: pass #1 as macro + {\checkMPTEXgraphic{#1}% % potential speedup: pass #1 as macro \startwritingMPgraphic \writeMPgraphic{#1}% \stopwritingMPgraphic} @@ -207,17 +207,17 @@ \newtoks \MPinitializations -% buggy +% buggy % % \long\def\startMPinclusions#1\stopMPinclusions % {\long\def\theMPinclusions -% {% \expanded ! +% {% \expanded ! % \@EA\expanded\@EA{\@EA\writeMPgraphic\@EA{\the\MPinitializations;}}% % \writeMPgraphic{#1}}} \long\def\startMPinclusions#1\stopMPinclusions {\long\def\theMPinclusions - {% \expanded ! + {% \expanded ! % \@EA\expanded\@EA{\@EA\writeMPgraphic\@EA{\the\MPinitializations;}}% \writeMPgraphic{#1}}} @@ -318,13 +318,13 @@ \newif\ifforceMPTEXgraphic -%D Before we supported the graph module, we had: +%D Before we supported the graph module, we had: %D -%D \starttypen +%D \starttypen %D \convertargument etex\to\MPasciiB %D \convertargument textext\to\MPasciiC % geen "text" %D \convertargument graphictext\to\MPasciiD % geen "text" -%D +%D %D \long\def\checkMPTEXgraphic#1% %D {\ifforceMPTEXgraphic %D \global\MPTEXgraphictrue @@ -335,10 +335,10 @@ %D {\doifstringinstringelse\MPasciiD\MPasciiA{\global\MPTEXgraphictrue} %D {\global\MPTEXgraphicfalse}}}% %D \fi} -%D \stoptypen +%D \stoptypen %D %D The next alternative permits extensions in other modules -%D without the need to know the details of testing. +%D without the need to know the details of testing. \newtoks\MPTEXgrapicchecks @@ -351,10 +351,10 @@ \the\MPTEXgrapicchecks\relax \fi} -%D We could have used a kind of array approach using a -%D counter appended to \type {MPascii}, but this is an -%D as efficient alternative. (The uglyness comes from -%D expanding after the string \type {#1}). +%D We could have used a kind of array approach using a +%D counter appended to \type {MPascii}, but this is an +%D as efficient alternative. (The uglyness comes from +%D expanding after the string \type {#1}). \def\forceMPTEXcheck#1% {\expanded{\convertargument#1\noexpand\to @@ -368,6 +368,18 @@ \forceMPTEXcheck{textext} \forceMPTEXcheck{graphictext} +%D \starttypen +%D \forceMPTEXgraphictrue +%D +%D \forceMPTEXcheck{lintext} +%D \forceMPTEXcheck{logtext} +%D +%D \startMPcode +%D draw hlintext.lft(0, 20, 5, 20cm, "@3e") ; +%D draw vlogtext.bot(0, 10, 9, 10cm, "@3e") ; +%D \stopMPcode +%D \stoptypen + \def\flushMPTEXgraphic {\ifMPTEXgraphic \ifx\everyMPTEXgraphic\emptytoks \else \immediate\write\MPwrite{verbatimtex \the\everyMPTEXgraphic\space etex;}% @@ -380,7 +392,7 @@ \fi} % the next one fails on btex \vbox {\hbox .. leading to \vbox \hbox -% +% % \long\def\dodowriteMPgraphicline#1tex #2#3etex#4\MPend % {\ifx\next\empty\else\ifx\next\relax\else % \bgroup @@ -400,8 +412,8 @@ % \dowriteMPgraphicline#4tex \relax etex\MPend % \fi % \fi\fi} -% -% so we need a two step approach +% +% so we need a two step approach \long\def\dodowriteMPgraphicline#1tex % {\doifnextcharelse\relax @@ -444,19 +456,19 @@ \newtoks\everyMPgraphic \everyMPgraphic{\everyMPgraphic\emptytoks} -\ifx\blabelgroup\undefined +\ifx\blabelgroup\undefined - \let\blabelgroup\bgroup + \let\blabelgroup\bgroup \let\elabelgroup\egroup \fi \newconditional\firstMPgraphic \settrue\firstMPgraphic -\appendtoks +\appendtoks \let \# \letterhash \let \_ \letterunderscore - \let \& \letterampersand + \let \& \letterampersand \let \{ \letteropenbrace \let \} \letterclosebrace \to \everyMPgraphic @@ -466,16 +478,16 @@ \beginTEX -\ifx \honorunexpanded \undefined \else % not really needed +\ifx \honorunexpanded \undefined \else % not really needed \prependtoks \honorunexpanded \to \everyMPgraphic -\fi +\fi \endTEX -% buggy (at least in collected graphics, lazy expansion) +% buggy (at least in collected graphics, lazy expansion) % % \def\startwritingMPgraphic % {\blabelgroup -% \global\advance\nofMPgraphics 1 +% \global\advance\nofMPgraphics 1 % \ifMPrun \else % \allocateMPslot\currentMPgraphic % \fi @@ -485,12 +497,12 @@ % \ifrunMPgraphics % \openMPgraphicfile1{runtime}% % % no reset here ! -% \theMPinclusions +% \theMPinclusions % \else -% \openMPgraphicfile0{collected}% +% \openMPgraphicfile0{collected}% % % reset here ! global added (due to adding \blabelgroup) -% \theMPinclusions -% \global\let\theMPinclusions\relax +% \theMPinclusions +% \global\let\theMPinclusions\relax % \fi % \flushMPTEXgraphic % \ifMPrun \else @@ -502,7 +514,7 @@ \def\startwritingMPgraphic {\blabelgroup - \global\advance\nofMPgraphics 1 + \global\advance\nofMPgraphics 1 \ifMPrun \else \allocateMPslot\currentMPgraphic \fi @@ -512,13 +524,13 @@ \ifrunMPgraphics \openMPgraphicfile1{runtime}% % no reset here ! - \theMPinclusions + \theMPinclusions \@EA\expanded\@EA{\@EA\writeMPgraphic\@EA{\the\MPinitializations;}}% \else - \openMPgraphicfile0{collected}% + \openMPgraphicfile0{collected}% % reset here ! global added (due to adding \blabelgroup) - \theMPinclusions - \global\let\theMPinclusions\relax + \theMPinclusions + \global\let\theMPinclusions\relax \fi \flushMPTEXgraphic \ifMPrun \else @@ -539,9 +551,9 @@ % \@EA\newwrite\csname\@@MPG\@@MPG\MPgraphicfile\endcsname}% % {\ifcase#1\donefalse\else\donetrue\fi}% \@EA\ifx\csname\@@MPG\@@MPG\MPgraphicfile\endcsname\relax - %\donetrue \@EA\newwrite\csname\@@MPG\@@MPG\MPgraphicfile\endcsname - % for the sake of plain usage - \donetrue \@EA\@EA\csname newwrite\endcsname\csname\@@MPG\@@MPG\MPgraphicfile\endcsname + %\donetrue \@EA\newwrite\csname\@@MPG\@@MPG\MPgraphicfile\endcsname + % for the sake of plain usage + \donetrue \@EA\@EA\csname newwrite\endcsname\csname\@@MPG\@@MPG\MPgraphicfile\endcsname \doglobal\addtocommalist\MPgraphicfile\MPgraphicfiles \else \ifcase#1\relax\donefalse\else\donetrue\fi @@ -588,7 +600,7 @@ \def\closeMPgraphicfiles {\ifrunMPgraphics \else \ifx\MPgraphicsfiles\empty\else - \def\docommando##1% + \def\docommando##1% {\message{[flush and process ##1.mp afterwards]}% \@EA\let\@EA\MPwrite\csname\@@MPG\@@MPG##1\endcsname \finishwritingMPgraphics}% @@ -604,26 +616,26 @@ \def \allocateMPslot#1{\global\advance#1 1 } \def\deallocateMPslot#1{} -%D \macros +%D \macros %D {translateMPinput} %D -%D For my polish friends: +%D For my polish friends: %D -%D \starttypen -%D % translate=il2-pl +%D \starttypen +%D % translate=il2-pl %D %D \translateMPinput{il2-pl} %D -%D \startMPenvironment[global] -%D \setupbodyfont[plr] -%D \stopMPenvironment +%D \startMPenvironment[global] +%D \setupbodyfont[plr] +%D \stopMPenvironment %D -%D \TeX: ± ¶ +%D \TeX: ± ¶ %D %D \startMPcode -%D draw btex MetaPost: ± ¶ etex scaled 5 ; +%D draw btex MetaPost: ± ¶ etex scaled 5 ; %D \stopMPcode -%D \stoptypen +%D \stoptypen \def\translateMPinput#1% {\xdef\MPinputtranslation{\letterpercent -translate-file=#1\space}} @@ -705,7 +717,7 @@ % \box\MPgraphicbox % \fi} % -% experimental: +% experimental: \def\placeMPgraphic {\ifMPshiftdrawing @@ -728,9 +740,9 @@ \newif\ifuseMPbox \useMPboxtrue -%D We assume that one can set objects: -%D -%D \starttypen +%D We assume that one can set objects: +%D +%D \starttypen %D \def\douseMPbox#1% %D {\setobject{MP}{#1}\vbox %D {\forgetall @@ -738,16 +750,16 @@ %D \deallocateMPslot\currentMPgraphic %D \placeMPgraphic}% %D \setgvalue{#1}{\getobject{MP}{#1}}} -%D \stoptypen -%D +%D \stoptypen +%D %D More save is to use a number for {MP}{#1} which permits -%D redefinition. +%D redefinition. \newcount\MPobjectcounter \def\douseMPbox#1% {\global\advance\MPobjectcounter\plusone - \setobject{MP}{\number\MPobjectcounter}\vbox + \setobject{MP}{\number\MPobjectcounter}\vbox {\forgetall \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}% \deallocateMPslot\currentMPgraphic @@ -802,7 +814,7 @@ %D particular place. Therefore we explicitly disable %D inclusions (resulting in an dummy figure) when we are in MP %D run mode (see mfun-004 for an example, we process an -%D example buffer which produced graphics). +%D example buffer which produced graphics). \long\def\handleuseMPgraphic#1#2% {\bgroup @@ -811,7 +823,7 @@ \ifMPrun \else \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}% \placeMPgraphic - \fi + \fi \deallocateMPslot\currentMPgraphic \egroup} @@ -821,9 +833,9 @@ \elabelgroup} \long\def\startusableMPgraphic#1#2\stopusableMPgraphic % dummy - {\blabelgroup + {\blabelgroup \long\setgvalue{\@@MPG#1}{\handleuseMPgraphic{#1}{#2}}% - \elabelgroup} + \elabelgroup} \let\useMPgraphic=\reuseMPgraphic @@ -917,7 +929,7 @@ \def\MPOSTdriver {dvips} \def\executeMPOST#1% - {mpost + {mpost \ifcase\interactionmode\MPOSTbatchswitch\or\MPOSTnonstopswitch\fi \space\ifuseMETAFUNformat \MPOSTformatswitch metafun \fi #1} @@ -940,8 +952,8 @@ \fi -%D The batchmode and nonstopmode (introduced in 2003 for -%D Patrick Gundlach) switches may differ per binary and are +%D The batchmode and nonstopmode (introduced in 2003 for +%D Patrick Gundlach) switches may differ per binary and are %D supported by \TEXEXEC. %D \macros @@ -1035,16 +1047,16 @@ %D \starttypen %D \includeMPfontsfalse %D \stoptypen -%D +%D %D {\em Currently this method fails for situations where the %D font definition is not on one line, which is he case when %D unkerned fonts are used along with long lines. One solution %D for this is to increase the value of \type {max_print_line} -%D in \type {texmf.cnf}.}} +%D in \type {texmf.cnf}.}} \newif\ifincludeMPfonts \includeMPfontstrue -\def\includeMPfonts#1% +\def\includeMPfonts#1% {\ifincludeMPfonts \bgroup \message{[MP fonts #1]}% @@ -1192,7 +1204,7 @@ %D \stoptypen %D %D which comes to rounding sizes. This is something -%D experimental. (The macro in supp-pdf.tex is more +%D experimental. (The macro in supp-pdf.tex is more %D advanced.) \def\PSnfont{nfont} @@ -1278,7 +1290,7 @@ \def\convertMPcolorpath{} \def\convertMPcolorfile{metacmyk.tmp} -\def\convertMPcolors#1% todo: open on local path, no copy +\def\convertMPcolors#1% todo: open on local path, no copy {\bgroup \ifforcegrayMPcolors \donetrue @@ -1315,8 +1327,8 @@ %D copied back. We don't have to reduce to gray scales; %D \METAPOST\ already takes care of that. -%D BTW, this code is quite old, and not as complete as the -%D \PDF\ converter, which also handles spot colors and so. +%D BTW, this code is quite old, and not as complete as the +%D \PDF\ converter, which also handles spot colors and so. \def\handleMPcolor {\expandafter\dohandleMPcolor\fileline setrgbcolor*\\} @@ -1330,7 +1342,7 @@ \def\dodohandleMPcolor#1 #2 #3setrgbcolor#4setrgbcolor*\\% {\bgroup -%\ifnum\MPspecialsignal=123 % color spec / hardcoded hack +%\ifnum\MPspecialsignal=123 % color spec / hardcoded hack \ifdim#1pt=.123pt \immediate\write\scratchwrite{#1 #2 #3 setrgbcolor}% \else @@ -1525,7 +1537,7 @@ {\ifMPdrawingdone \expandafter\startMPgraphic\MPdrawingdata\stopMPgraphic \loadcurrentMPgraphic\empty - \deallocateMPslot\currentMPgraphic + \deallocateMPslot\currentMPgraphic \placeMPgraphic \fi} @@ -1652,19 +1664,19 @@ %D turn can trigger generation of other graphics, like those %D in the background. Graphics start swapping place and again %D page breaks change. You can imagine the mess we en dup -%D with. -%D +%D with. +%D %D This is why we provide was to use a dedicate range if %D numbers for fixed graphcis. Such graphics will not en dup %D in the text flow (at least their dimensions don't %D contribute to the main vertical list, and thereby they -%D cannot interfere. We use a rather safe maximum of 4000 -%D graphics here and 8000 in \type {meta-ini}. +%D cannot interfere. We use a rather safe maximum of 4000 +%D graphics here and 8000 in \type {meta-ini}. -\newcount \maxnofMPgraphics \maxnofMPgraphics = 4000 % 8000 +\newcount \maxnofMPgraphics \maxnofMPgraphics = 4000 % 8000 \newcount \minnofMPgraphics \minnofMPgraphics = 1 -\newif \ifMPstaticgraphic \MPstaticgraphicfalse +\newif \ifMPstaticgraphic \MPstaticgraphicfalse \def\allocateMPslot#1% {\ifrunMPgraphics @@ -1673,21 +1685,21 @@ \recycleMPslotsfalse \fi \ifrecycleMPslots - \doloop % slow but used seldom + \doloop % slow but used seldom {\doifundefined{\recurselevel MP} {\letgvalueempty{\recurselevel MP}% \global#1=\recurselevel \exitloop}}% % \message{[MP slot + \number#1]% \else\ifMPstaticgraphic - \global#1\maxnofMPgraphics + \global#1\maxnofMPgraphics \global\advance\maxnofMPgraphics \minusone \else - \global#1\minnofMPgraphics + \global#1\minnofMPgraphics \global\advance\minnofMPgraphics \plusone \fi\fi \ifnum\minnofMPgraphics<\maxnofMPgraphics \else - \writestatus{\m!systems}{increase \string\maxnofMPgraphics}% + \writestatus{\m!systems}{increase \string\maxnofMPgraphics}% \fi} \def\deallocateMPslot#1% -- cgit v1.2.3