From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/85676 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Request for metapost Date: Sun, 22 Dec 2013 15:57:24 +0100 Message-ID: <52B6FDD4.3030207@wxs.nl> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1387724248 12528 80.91.229.3 (22 Dec 2013 14:57:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Dec 2013 14:57:28 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sun Dec 22 15:57:33 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VukTE-0004zM-Qx for gctc-ntg-context-518@m.gmane.org; Sun, 22 Dec 2013 15:57:32 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C462510213; Sun, 22 Dec 2013 15:57:31 +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 vi-pU86-oSLz; Sun, 22 Dec 2013 15:57:30 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id D8563101FB; Sun, 22 Dec 2013 15:57:29 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B8CF0101FB for ; Sun, 22 Dec 2013 15:57:28 +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 msWd5XNebIRU for ; Sun, 22 Dec 2013 15:57:27 +0100 (CET) Original-Received: from filter3-utr.mf.surf.net (filter3-utr.mf.surf.net [195.169.124.154]) by balder.ntg.nl (Postfix) with ESMTP id C9D20101F7 for ; Sun, 22 Dec 2013 15:57:27 +0100 (CET) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter3-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id rBMEvQob011616 for ; Sun, 22 Dec 2013 15:57:27 +0100 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.103; Original-Received: from [10.100.1.103] (unverified [10.100.1.103]) by pragma-net.nl (SurgeMail 6.3c2) with ESMTP id 2384-1713362 for ; Sun, 22 Dec 2013 15:57:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: 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; region=15; city=Zwolle; latitude=52.5058; longitude=6.0858; http://maps.google.com/maps?q=52.5058,6.0858&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 08L4CVqoQ - 0c1920c4ccc3 - 20131222 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.154 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:85676 Archived-At: On 12/21/2013 12:50 PM, DesdeChaves wrote: > > I know that metapost can send the variables "version", "number", > "string", "point", "quad", "boolean" and "path" to Context. > "triplet" variable can't pass. It will be very usefull if metapost can > send a array to context. > > \startMPcode > > numeric x[]; > for i = 1 upto 10: x[i]:=random; endfor > > passvariable("array",x); > passvariable("version","1.0") ; > passvariable("number",x[1]) ; > passvariable("string","whatever") ; > passvariable("point",(1,2)) ; > passvariable("triplet",(1,2,3)) ; > passvariable("quad",(1,2,3,4)) ; > passvariable("boolean",false) ; > passvariable("path",fullcircle scaled 1cm) ; > > > \stopMPcode > > \ctxluacode{inspect(metapost.variables)} > > \ctxcommand{mprunvar("array")} > > Thanks in advance that's less trivial (as automatism) so i provide passarrayvariable now (next beta) ... of course the next request would concern complex arrays so i also made a more low level flusher \starttext \startMPcode numeric n[] ; for i=1 upto 10: n[i] := i + 1 ; endfor ; path p[] ; for i=1 upto 10: p[i] := fullcircle scaled (i*cm) ; endfor ; numeric n[][] ; for i=1,4 : for j=1,3 : n[i][j] = uniformdeviate(1) ; endfor ; endfor ; passvariable("x",12345) ; passarrayvariable("n-array",n,1,7,1) ; passarrayvariable("p-array",p,1,7,1) ; passvariable("p",(1,1) .. (2,2)) ; % watch out: no ; in between startpassingvariable("b") startarray for i=1,4 : startarray for j=1,3 : value(n[i][j]) endfor stoparray endfor stoparray stoppassingvariable ; startpassingvariable("a") starthash key("test1") startarray value(123) value(456) stoparray key("test2") starthash key("test") value(789) stophash stophash stoppassingvariable ; draw fullcircle scaled 1cm ; \stopMPcode \ctxluacode{inspect(metapost.variables)} \ctxcommand{mprunvar("x")} \stoptext ----------------------------------------------------------------- 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 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 ___________________________________________________________________________________