ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: PELLOUIN Christophe <christophe.pellouin@wanadoo.fr>
To: ntg-context@ntg.nl
Subject: Problem with arguments in macro
Date: Mon, 21 Jan 2013 19:26:58 +0100	[thread overview]
Message-ID: <50FD8872.6090801@wanadoo.fr> (raw)

Hello,

When writing a macro, I observed that some arguments are not transmitted 
correctly, particularly when the type is defined as "text".
Here is an example with the macro max defined in the file plain.mp
With this program:

     beginfig(1)

         show("first test");
         show max (1,2,8,5,15,2,1,4);

         numeric u_;
         v_=15;
         show("second test");
         show max (1,2,8,5,v_,2,1,4);

         numeric u_;
         u_=15    % u_ variable is also defined in the macro max
         show("third test");
         show max (1,2,8,5,u_,2,1,4);

     endfig;
     end

The result is:

     This is MetaPost, version 1.504 (kpathsea version 6.0.1)
     (mpost.mp (c:/texlive/2011/texmf-dist/metapost/base/plain.mp
     Preloading the plain mem file, version 1.004)) (./bizzare.mp
     >> "first test"
     >> 15
     >> "second test"
     >> 15
     >> "third test"
     >> 8 [1] )
     1 output file written: bizzare.1
     Transcript written on bizzare.log.



The third result is different because the variable u_ is defined in the 
macro max of the file plain.mp

Christophe Pellouin



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

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


             reply	other threads:[~2013-01-21 18:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-21 18:26 PELLOUIN Christophe [this message]
2013-01-21 18:32 ` Hans Hagen
2013-01-21 19:47   ` PELLOUIN Christophe
2013-01-21 19:50     ` Hans Hagen
2013-01-21 20:25       ` PELLOUIN Christophe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50FD8872.6090801@wanadoo.fr \
    --to=christophe.pellouin@wanadoo.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).