[dev-context] piping to ConTeXt

Hans Hagen pragma at wxs.nl
Sat May 23 19:56:48 CEST 2009


Aditya Mahajan wrote:

> context misc/null
> ....
> ....
> *
> \newbox\ASYbox
> \newdimen\ASYdimen
> \long\def\ASYbase#1#2{\leavevmode\setbox\ASYbox=\hbox{#1}\ASYdimen=\ht\ASYbox% 
> 
> \setbox\ASYbox=\hbox{#2}\lower\ASYdimen\box\ASYbox}
> \font\ASYfont=lmr12 at 12pt\ASYfont\switchtobodyfont[12pt]%
> %
> (Please type a command or say `\end')
> *\setbox\ASYbox=\hbox{$x$}
> 
> 
> *
> *
> *
> *
> *
> *
> *(Please type a command or say `\end')
> *\showthe\wd\ASYbox
>> 6.67703pt.
> 
> etc... (for the moment, ignore the fact that the font setup is incorrect)

hm, this should be possible but you should keep in mind then that the 
run is separate from the main run so dimensions (and fonts and ...) 
might not reflect reality

if real integration is needed, a multipass approach might make more 
sense (ok, one can pass environments to the null run if needed)

(1) run asymptote from current run on tex file, (2) during that run 
asymptote creates a tex file, (3) after the run tex picks up its run and 
processes that tex file writing dimensions to another file, (4) another 
asymptote run uses those dimensions

anyhow, it all depends on what one wants to achieve ... in mkiv we can 
also think of:

(1) open socket connection, (2) run asymptote from current run on tex 
file (in parallel), (3) communicate via socket till done

i'm not sure how well this works, maybe just pipes are better, but 
experiments that we did with that (before mplib) made us pessimistic as 
there are platform and timing issues involved


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-context mailing list