Indeed a challenge!

Alan

On Tue, 10 Sep 2013 18:11:13 +0200
Hans Hagen <pra...@wxs.nl> wrote:

> Hi,
> 
> There's now a convenient way to pass data back from an mprun to the
> tex instance:
> 
> \starttext
> 
> \startMPcode
>      passvariable("version","1.0") ;
>      passvariable("number",123) ;
>      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) ;
> 
>      draw fullcircle scaled 20pt ;
> \stopMPcode
> 
> \ctxlua{inspect(metapost.variables)}
> 
> \ctxcommand{mprunvar("number")}
> \ctxcommand{mprunvar("string")}
> 
> \stoptext
> 
> the inspect shows:
> 
> table={
>   ["boolean"]=false,
>   ["number"]=123,
>   ["path"]={
>    { 10.02177, 10.02177, 12.67969, 7.36386, 7.36386, 12.67969 },
>    { 0, 14.17323, 3.75914, 14.17323, -3.75914, 14.17323 },
>    { -10.02177, 10.02177, -7.36386, 12.67969, -12.67969, 7.36386 },
>    { -14.17323, 0, -14.17323, 3.75914, -14.17323, -3.75914 },
>    { -10.02177, -10.02177, -12.67969, -7.36386, -7.36386, -12.67969 },
>    { 0, -14.17323, -3.75914, -14.17323, 3.75914, -14.17323 },
>    { 10.02177, -10.02177, 7.36386, -12.67969, 12.67969, -7.36386 },
>    { 14.17323, 0, 14.17323, -3.75914, 14.17323, 3.75914 },
>   },
>   ["point"]={ 1, 2 },
>   ["quad"]={ 1, 2, 3, 4 },
>   ["string"]="whatever",
>   ["triplet"]={ 1, 2, 3 },
>   ["version"]="1.0",
> }
> 
> the mprunvar pips a value or concatination to tex

___________________________________________________________________________________
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 via email to