ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: [NTG-Context] MetaPost capacity exceeded.
Date: Thu, 15 Nov 2012 13:21:50 +0100	[thread overview]
Message-ID: <50A4DE5E.8040908@wxs.nl> (raw)
In-Reply-To: <20121115122708.26e6fa60@sole>

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
___________________________________________________________________________________


      reply	other threads:[~2012-11-15 12:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 11:27 Alan BRASLAU
2012-11-15 12:21 ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50A4DE5E.8040908@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).