Hi,

\doifelse does not work inside any MP environment. Something really 
strange happens if you try to use it. \loggingall tells me what exactly is 
happening, but I do not know enough low-level TeX to understand why this 
is happening.

Conside this test file

%----------------------
\def\test{string}
\starttext
\doifelse{\test}{string}{test is a string}{or not}
\loggingall
\startMPcode
   draw \doifelse{\test}{string}{fullcircle}{fullsquare} scaled 5cm ;
\stopMPcode
\stoptext
%------------------------

It does not compile correctly. Intesting pieces from the log file 
(actually the MKII log, since that is more interesting)

\dostartMPcode #1\stopMPcode ->\startuseMPgraphic {@@}#1\stopuseMPgraphic 
\useMPgraphic {@@}\endgroup
#1<-draw \doifelse {\test }{string}{fullcircle}{fullsquare} scaled 5cm ;

...

\doifelse #1#2->\edef \!!stringa {#1}\edef \!!stringb {#2}\ifx \!!stringa 
\!!stringb \expandafter \firstoftwoarguments \else \expandafter 
\secondoftwoargument
s \fi
#1<-\test
#2<-string

\!!stringa ->currentcolor

\test ->string

\!!stringb ->black
{no mode: \ifx: (level 5) entered on line 11}
{false}
{\else: \ifx (level 5) entered on line 11}
{\expandafter}
{\fi: \ifx (level 5) entered on line 11}

.....

\ascii ->
draw \edef currentcolor{string}\edef black{string}fullsquare scaled 5cm ;
{changing \MPascii=undefined}
{into \MPascii=macro:->
draw \edef currentcolor{string\ETC.}
{\the}


Notice the first line of \ascii, and compare that with the definition of
\doifelse. The command \!!stringa inside the definition of \doifelse gets
expanded too soon. Is there any way to get this work, other than doing the
comparison outside the MP code.

Aditya

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to