ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \doifdefinedelse and \write
@ 2006-04-14 16:37 Peter Münster
  2006-04-14 17:19 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Münster @ 2006-04-14 16:37 UTC (permalink / raw)


Hello,
with the following test-file I expect the output: "Yes No"
But the output is:
"edef @@lycurrentstate{myTestbla}No edef @@lycurrentstate{myTestblub}No"
Where does this come from, and how could I get it right please?

\def\myMacro#1{\doifdefinedelse{myTest#1}{Yes}{No}}
\def\myTestfile{\jobname-test.tmp}
\def\myTestbla{just a test}
\starttext
\immediate\write18{echo \myMacro{bla} \myMacro{blub} >\myTestfile}
\typefile{\myTestfile}
\stoptext

Greetings, Peter

-- 
http://pmrb.free.fr/contact/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: \doifdefinedelse and \write
  2006-04-14 16:37 \doifdefinedelse and \write Peter Münster
@ 2006-04-14 17:19 ` Hans Hagen
  2006-04-14 18:40   ` Peter Münster
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2006-04-14 17:19 UTC (permalink / raw)


� wrote:
> Hello,
> with the following test-file I expect the output: "Yes No"
> But the output is:
> "edef @@lycurrentstate{myTestbla}No edef @@lycurrentstate{myTestblub}No"
> Where does this come from, and how could I get it right please?
>
> \def\myMacro#1{\doifdefinedelse{myTest#1}{Yes}{No}}
> \def\myTestfile{\jobname-test.tmp}
> \def\myTestbla{just a test}
> \starttext
> \immediate\write18{echo \myMacro{bla} \myMacro{blub} >\myTestfile}
> \typefile{\myTestfile}
> \stoptext
>
> Greetings, Peter
>
>   
\def\myMacro#1{\ifundefined{myTest#1}Yes\else No\fi}

(see definition of \doifdefinedelse: it does some clever things in order 
to handle messy #1's)

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: \doifdefinedelse and \write
  2006-04-14 17:19 ` Hans Hagen
@ 2006-04-14 18:40   ` Peter Münster
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Münster @ 2006-04-14 18:40 UTC (permalink / raw)


On Fri, 14 Apr 2006, Hans Hagen wrote:

> > \def\myMacro#1{\doifdefinedelse{myTest#1}{Yes}{No}}
> > \def\myTestfile{\jobname-test.tmp}
> > \def\myTestbla{just a test}
> > \starttext
> > \immediate\write18{echo \myMacro{bla} \myMacro{blub} >\myTestfile}
> > \typefile{\myTestfile}
> > \stoptext
> >
> \def\myMacro#1{\ifundefined{myTest#1}Yes\else No\fi}
> 
> (see definition of \doifdefinedelse: it does some clever things in order 
> to handle messy #1's)

Great, thanks for your fast help!
I tried a lot of things with \expanded{} and \unexpanded but I've never
thought of looking for another if-else command...
Thanks, Peter

-- 
http://pmrb.free.fr/contact/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-14 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-14 16:37 \doifdefinedelse and \write Peter Münster
2006-04-14 17:19 ` Hans Hagen
2006-04-14 18:40   ` Peter Münster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).