From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/85693 Path: news.gmane.org!not-for-mail From: DesdeChaves Newsgroups: gmane.comp.tex.context Subject: Re: Request for metapost Date: Mon, 23 Dec 2013 14:31:31 +0000 Message-ID: References: <52B6FDD4.3030207@wxs.nl> <52B72B17.3000702@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1520861501==" X-Trace: ger.gmane.org 1387809122 5861 80.91.229.3 (23 Dec 2013 14:32:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Dec 2013 14:32:02 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Dec 23 15:32:10 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 1Vv6Xo-0001f2-86 for gctc-ntg-context-518@m.gmane.org; Mon, 23 Dec 2013 15:31:44 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 419B0101E8; Mon, 23 Dec 2013 15:31:41 +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 xVnyudPJVWfe; Mon, 23 Dec 2013 15:31:38 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 15A7D10208; Mon, 23 Dec 2013 15:31:38 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7E99310208 for ; Mon, 23 Dec 2013 15:31:36 +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 SDfvZH5HtlXS for ; Mon, 23 Dec 2013 15:31:34 +0100 (CET) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id B62CF101E8 for ; Mon, 23 Dec 2013 15:31:34 +0100 (CET) Original-Received: from mail-ob0-x234.google.com (mail-ob0-x234.google.com [IPv6:2607:f8b0:4003:c01::234]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id rBNEffWY008701 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Mon, 23 Dec 2013 15:41:42 +0100 Original-Received: by mail-ob0-f180.google.com with SMTP id wo20so5457427obc.39 for ; Mon, 23 Dec 2013 06:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=SGJsgTwONLNnPbP+4OTf19p9qsRIMDHJYswFKkqrPpE=; b=M+H+bySL1txlZNTME5G6SRSr4N8asA7GeMw/zU8EfnwRDReySyKj6Infgz/Y9C+D0m VcORMphgKskQUpIUtUUTcJjXHhjyaqNMkP1Jmi7856BSftjuXyra1muJCNt6iC9NRJ03 lDesXXb2j8whXiIS5fuQUgF55vADjvlsFXVVyLY4oQCm/MGFfd+Ej/65F3abrL2kZG0j e4SsoIsWst/JYvchZZLs8sQEAwVKNH9JHOjDf5nkYJs159Ug76eAfd/TPV/ymI8padra fD68d6iRykm0OX46mMgdmZ/YPn+IkURyfVXuwxIiIhfaBX1mUx5Wqng55VOKc/ch2iZV HzqA== X-Received: by 10.182.126.167 with SMTP id mz7mr734049obb.69.1387809091640; Mon, 23 Dec 2013 06:31:31 -0800 (PST) Original-Received: by 10.60.52.143 with HTTP; Mon, 23 Dec 2013 06:31:31 -0800 (PST) In-Reply-To: <52B72B17.3000702@wxs.nl> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=2607:f8b0:4003:c01::234; country=US X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01L52FGCJ - 836353f6336d - 20131223 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) 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:85693 Archived-At: --===============1520861501== Content-Type: multipart/alternative; boundary=001a11c1f540ec638c04ee347b31 --001a11c1f540ec638c04ee347b31 Content-Type: text/plain; charset=ISO-8859-1 Thanks very much for your support. Jorge 2013/12/22 Hans Hagen > On 12/22/2013 3:57 PM, Hans Hagen wrote: > >> 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 >> > > \starttext > > % \enabletrackers[metapost.variables] > > \startMPcode > numeric n[] ; for i=1 upto 10: n[i] := 1/i ; endfor ; > path p[] ; for i=1 upto 10: p[i] := fullcircle xyscaled > (cm*i,cm/i) ; endfor ; > numeric r[][] ; for i=1 upto 4 : for j=1 upto 3 : r[i][j] := > uniformdeviate(1) ; endfor ; endfor ; > pair u[][] ; for i=1 step 0.5 until 4 : for j=1 step 0.1 until 2 : > u[i][j] := (i,j) ; 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)) ; > > startpassingvariable("b") > startarray > for i=1 upto 4 : > startarray > for j=1 upto 3 : > value(r[i][j]) > > endfor > stoparray > endfor > stoparray > stoppassingvariable ; > > startpassingvariable("a") > starthash > key("test 1") > > startarray > value(123) > value(456) > stoparray > key("test 2") > startarray > index(0) > value(123) > value(456) > value(789) > slot(999,987) > stoparray > key("test 3") > starthash > key("first") value(789) > entry("second",987) > stophash > stophash > stoppassingvariable ; > > startpassingvariable("c") > startarray > for i=1 step 0.5 until 4 : > index(i) > startarray > for j=1 step 0.1 until 2 : > slot(j,u[i][j]) > > endfor > stoparray > endfor > stoparray > 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 > ____________________________________________________________ > _______________________ > -- Atentamente DesdeChaves --001a11c1f540ec638c04ee347b31 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks very much for your support.=A0

Jorge


2013/12/22 Hans Hagen <pragma@wxs.nl>
On 1= 2/22/2013 3:57 PM, Hans Hagen wrote:
On 12/21/2013 12:50 PM, DesdeChaves wrote:

I know that metapost can send the variables "version", "numb= er",
"string", "point", "quad", "boolean"= ; and "path" to Context.
"triplet" variable can't pass. It will be very usefull if met= apost can
send a array to context.

\startMPcode

numeric x[];
for i =3D 1 upto 10: x[i]:=3Drandom; endfor

passvariable("array",x);
=A0 =A0 =A0passvariable("version","1.0") ;
=A0 =A0 =A0passvariable("number",x[1]) ;
=A0 =A0 =A0passvariable("string","whatever") ; =A0 =A0 =A0passvariable("point",(1,2)) ;
passvariable("triplet",(1,2,3)) ;
=A0 =A0 =A0passvariable("quad",(1,2,3,4)) ;
=A0 =A0 =A0passvariable("boolean",false) ;
=A0 =A0 =A0passvariable("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<= br> (next beta) ... of course the next request would concern complex arrays
so i also made a more low level flusher

\starttext

\startMPcode
=A0 =A0 =A0numeric n[] =A0 ; for i=3D1 upto 10: n[i] :=3D i + 1 ; endfor ;<= br> =A0 =A0 =A0path =A0 =A0p[] =A0 ; for i=3D1 upto 10: p[i] :=3D fullcircle sc= aled (i*cm) ;
endfor ;
=A0 =A0 =A0numeric n[][] ; for i=3D1,4 : for j=3D1,3 : n[i][j] =3D uniformd= eviate(1)
; endfor ; endfor ;

=A0 =A0 =A0passvariable("x",12345) ;
=A0 =A0 =A0passarrayvariable("n-array",n,1,7,1) ;
=A0 =A0 =A0passarrayvariable("p-array",p,1,7,1) ;
=A0 =A0 =A0passvariable("p",(1,1) .. (2,2)) ;

=A0 =A0 =A0% watch out: no ; in between

=A0 =A0 =A0startpassingvariable("b")
=A0 =A0 =A0 =A0 =A0startarray
=A0 =A0 =A0 =A0 =A0 =A0 =A0for i=3D1,4 :
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0startarray
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for j=3D1,3 :
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0value(n[i][j])
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0endfor
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0stoparray
=A0 =A0 =A0 =A0 =A0 =A0 =A0endfor
=A0 =A0 =A0 =A0 =A0stoparray
=A0 =A0 =A0stoppassingvariable ;

=A0 =A0 =A0startpassingvariable("a")
=A0 =A0 =A0 =A0 =A0starthash
=A0 =A0 =A0 =A0 =A0 =A0 =A0key("test1")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0startarray
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0value(123)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0value(456)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0stoparray
=A0 =A0 =A0 =A0 =A0 =A0 =A0key("test2")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0starthash
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0key("test")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0value(789)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0stophash
=A0 =A0 =A0 =A0 =A0stophash
=A0 =A0 =A0stoppassingvariable ;

=A0 =A0 =A0draw fullcircle scaled 1cm ;
\stopMPcode

\ctxluacode{inspect(metapost.variables)}

\ctxcommand{mprunvar("x")}

\stoptext

\starttext

% \enabletrackers[metapost.variables]

\startMPcode
=A0 =A0 numeric n[] =A0 ; for i=3D1 upto 10: n[i] :=3D 1/i ; endfor ;
=A0 =A0 path =A0 =A0p[] =A0 ; for i=3D1 upto 10: p[i] :=3D fullcircle xysca= led (cm*i,cm/i) ; endfor ;
=A0 =A0 numeric r[][] ; for i=3D1 upto 4 : for j=3D1 upto 3 : r[i][j] :=3D = uniformdeviate(1) ; endfor ; endfor ;
=A0 =A0 pair =A0 =A0u[][] ; for i=3D1 step 0.5 until 4 : for j=3D1 step 0.1= until 2 : u[i][j] :=3D (i,j) ; endfor ; endfor ;


=A0 =A0 passvariable("x",12345) ;
=A0 =A0 passarrayvariable("n-array",n,1,7,1) ;
=A0 =A0 passarrayvariable("p-array",p,1,7,1) ;
=A0 =A0 passvariable("p",(1,1) .. (2,2)) ;

=A0 =A0 startpassingvariable("b")
=A0 =A0 =A0 =A0 startarray
=A0 =A0 =A0 =A0 =A0 =A0 for i=3D1 upto 4 :
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 startarray
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for j=3D1 upto 3 :
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 value(r[i][j])

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 endfor
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 stoparray
=A0 =A0 =A0 =A0 =A0 =A0 endfor
=A0 =A0 =A0 =A0 stoparray
=A0 =A0 stoppassingvariable ;

=A0 =A0 startpassingvariable("a")
=A0 =A0 =A0 =A0 starthash
=A0 =A0 =A0 =A0 =A0 =A0 key("test 1")

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 startarray
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 value(123)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 value(456)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 stoparray
=A0 =A0 =A0 =A0 =A0 =A0 key("test 2")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 startarray
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 index(0)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 value(123)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 value(456)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 value(789)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 slot(999,987)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 stoparray
=A0 =A0 =A0 =A0 =A0 =A0 key("test 3")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 starthash
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 key("first") value(789) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 entry("second",987)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 stophash
=A0 =A0 =A0 =A0 stophash
=A0 =A0 stoppassingvariable ;

=A0 =A0 startpassingvariable("c")
=A0 =A0 =A0 =A0 startarray
=A0 =A0 =A0 =A0 =A0 =A0 for i=3D1 step 0.5 until 4 :
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 index(i)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 startarray
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for j=3D1 step 0.1 until 2 :
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 slot(j,u[i][j])

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 endfor
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 stoparray
=A0 =A0 =A0 =A0 =A0 =A0 endfor
=A0 =A0 =A0 =A0 stoparray
=A0 =A0 stoppassingvariable ;

=A0 =A0 draw fullcircle scaled 1cm ;
\stopMPcode

\ctxluacode{inspect(metapost.variables)}

\ctxcommand{mprunvar("x")}

\stoptext



-------------------------------------------------------------= ----
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 Hans Hagen | PRAGMA ADE
=A0 =A0 =A0 =A0 =A0 =A0 =A0 Ridderstraat 27 | 8061 GH Hasselt | The Netherl= ands
=A0 =A0 tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0| ww= w.pragma-pod.nl
-------------------------------------------------------------= ----
_____________________________________________________________= ______________________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage =A0:
http://= www.pragma-ade.nl / http://tex.aanhet.net
archive =A0: http://foundry.supelec.fr/projects/contextrev/ wiki =A0 =A0 : http:= //contextgarden.net
_____________________________________________________________= ______________________



--
= Atentamente

DesdeChaves
--001a11c1f540ec638c04ee347b31-- --===============1520861501== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1520861501==--