On 11/15/2012 12:27 PM, Alan BRASLAU wrote:
! MetaPost capacity exceeded, sorry [expansion depth=10000].
this normally points to an error in mp code, not to instances
I have come across this error previously
with run-away \dorecurse loops
I now have this message with a document that makes VERY heavy
use of MetaPost; I just have too many figures.
Is there some way to "flush" the running instance of MetaPost,
that is to force MPlib to respawn or something like that?
(Of course, I would then have to be careful not to rely on the
reuse of any previous MP instances...)
yes:
\starttext
\defineMPinstance
[myfun-a]
[format=metafun]
\defineMPinstance
[myfun-b]
[format=metafun]
\startMPdefinitions{myfun-a}
color MyColor ; MyColor := (1,0,0) ;
\stopMPdefinitions
\startMPdefinitions{myfun-b}
color MyColor ; MyColor := (0,1,0) ;
\stopMPdefinitions
\startuseMPgraphic{myfun-a::test-1}
fill fullcircle scaled 1cm withcolor MyColor ;
\stopuseMPgraphic
\startuseMPgraphic{myfun-a::test-2}
fill fullcircle scaled 1cm withcolor MyColor ;
\stopuseMPgraphic
\startuseMPgraphic{myfun-b::test-1}
fill fullcircle scaled 1cm withcolor MyColor ;
\stopuseMPgraphic
\startuseMPgraphic{myfun-b::test-2}
fill fullcircle scaled 1cm withcolor MyColor ;
\stopuseMPgraphic
\useMPgraphic{myfun-a::test-1}
\useMPgraphic{myfun-b::test-1}
\useMPgraphic{myfun-a::test-2}
\useMPgraphic{myfun-b::test-2}
\stoptext
however, during some cleanup stage something got lost ... so you need to
fix this:
\unprotect
\def\meta_use_graphic#1#2%
{\meta_begin_graphic_group{#1}%
\doifsomething{#2}{\setupMPvariables[\currentMPgraphicname][#2]}%
\getvalue{\??mpgraphic#1}%
\meta_end_graphic_group}
\protect
there are few more places where
\getvalue{\??mpgraphic ...
needs a #1 (I'll fix it).
So indeed you can have multiple independent instances. For instance we
could have one for the chemical stuff which then cannot be messed up by
other instances.
Hans
-----------------------------------------------------------------
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
___________________________________________________________________________________