From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/80381 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Problem with arguments in macro Date: Mon, 21 Jan 2013 20:50:53 +0100 Message-ID: <50FD9C1D.5030306@wxs.nl> References: <50FD8872.6090801@wanadoo.fr> <50FD89C6.8070807@wxs.nl> <50FD9B6D.5090907@wanadoo.fr> 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 1358797859 5902 80.91.229.3 (21 Jan 2013 19:50:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Jan 2013 19:50:59 +0000 (UTC) Cc: mailing list for ConTeXt users To: PELLOUIN Christophe Original-X-From: ntg-context-bounces@ntg.nl Mon Jan 21 20:51:17 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 1TxNOl-0004AJ-1b for gctc-ntg-context-518@m.gmane.org; Mon, 21 Jan 2013 20:51:15 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D5480101EE; Mon, 21 Jan 2013 20:50:57 +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 OBn33plMvoXa; Mon, 21 Jan 2013 20:50:54 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id B7B5A101E5; Mon, 21 Jan 2013 20:50:54 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 1AA4C101E5 for ; Mon, 21 Jan 2013 20:50:54 +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 68f1+Dol9kQi for ; Mon, 21 Jan 2013 20:50:53 +0100 (CET) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 23659101E2 for ; Mon, 21 Jan 2013 20:50:53 +0100 (CET) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r0LJoqlS014392 for ; Mon, 21 Jan 2013 20:50:52 +0100 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.101; Original-Received: from [10.100.1.101] (unverified [10.100.1.101]) by pragma-net.nl (SurgeMail 6.1c) with ESMTP (TLS) id 4176-1713362 for multiple; Mon, 21 Jan 2013 20:50:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.2; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: <50FD9B6D.5090907@wanadoo.fr> X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; latitude=52.5000; longitude=5.7500; http://maps.google.com/maps?q=52.5000,5.7500&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03IOHOQs2 - fd420a93948b - 20130121 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 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:80381 Archived-At: On 1/21/2013 8:47 PM, PELLOUIN Christophe wrote: > 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. my_private_u ----------------------------------------------------------------- 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 ___________________________________________________________________________= ________