From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/80380 Path: news.gmane.org!not-for-mail From: PELLOUIN Christophe Newsgroups: gmane.comp.tex.context Subject: Re: Problem with arguments in macro Date: Mon, 21 Jan 2013 20:47:57 +0100 Message-ID: <50FD9B6D.5090907@wanadoo.fr> References: <50FD8872.6090801@wanadoo.fr> <50FD89C6.8070807@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1358797688 3941 80.91.229.3 (21 Jan 2013 19:48:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Jan 2013 19:48:08 +0000 (UTC) Cc: mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Mon Jan 21 20:48:27 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TxNLy-0002hX-Q7 for gctc-ntg-context-518@m.gmane.org; Mon, 21 Jan 2013 20:48:22 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 93641101E9; Mon, 21 Jan 2013 20:48:05 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bzbxmWyBuWu2; Mon, 21 Jan 2013 20:48:03 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id D7D59101E5; Mon, 21 Jan 2013 20:48:03 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B1103101E5 for ; Mon, 21 Jan 2013 20:48:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id fuMthtYB5bng for ; Mon, 21 Jan 2013 20:48:00 +0100 (CET) Original-Received: from filter4-til.mf.surf.net (filter4-til.mf.surf.net [194.171.167.220]) by balder.ntg.nl (Postfix) with ESMTP id 958E2101E2 for ; Mon, 21 Jan 2013 20:48:00 +0100 (CET) Original-Received: from smtp.smtpout.orange.fr (smtp12.smtpout.orange.fr [80.12.242.134]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r0LJlxk7011620 for ; Mon, 21 Jan 2013 20:47:59 +0100 Original-Received: from [127.0.0.1] ([81.48.214.240]) by mwinf5d23 with ME id qjnw1k00a5BmLFD03jnwZH; Mon, 21 Jan 2013 20:47:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 In-Reply-To: <50FD89C6.8070807@wxs.nl> X-Antivirus: avast! (VPS 130121-0, 21/01/2013), Outbound message X-Antivirus-Status: Clean X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=80.12.242.134; country=FR; latitude=46.0000; longitude=2.0000; http://maps.google.com/maps?q=46.0000,2.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0VIOHLXpi - a5f08fba0f08 - 20130121 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.220 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:80380 Archived-At: Le 21/01/2013 19:32, Hans Hagen a =E9crit : > On 1/21/2013 7:26 PM, PELLOUIN Christophe wrote: >> 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_=3D15; >> show("second test"); >> show max (1,2,8,5,v_,2,1,4); >> >> numeric u_; >> u_=3D15 % 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 > > I can protect all local plain variables if needed but I'll only do it = > if someone then tests all the plain macros. How can I protect a variable? I had the same bug in one of my macros and = I'd like to fix it. Thanks > > Hans > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com > | www.pragma-pod.nl > ----------------------------------------------------------------- > ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________