[NTG-context] Why does this METAPOST vardef 'save' statement fail?

Gerben Wierda gerben.wierda at rna.nl
Sat Mar 14 15:45:18 CET 2020

I have this vardef:

vardef Foo(expr w, h) =
   save pth; path pth;
   %save pth2; path pth2;
   save pic; picture pic;
   pth = fullsquare xysized (w, h);
   %pth2 = fullsquare xysized (h/4, h/8)
   pic := image (
       draw pth;
       %draw pth2 shifted (-w/2, -h/4);
       % all kind of stuff here
   setbounds pic to pth;
enddef ;

As soon as I uncomment the bold line (first comment) a mtxrun fails. Whatever I try, a single save statement, etc., I fail in getting a second local variable. The METAPOST manual is no help.

The error shown is:

metapost log    > ! Extra tokens will be flushed.
metapost log    > <to be read again> 
metapost log    >                    2
metapost log    > Foo->...h;path.pth;save.pth2
metapost log    >                                                   ;path.pth2;save.pic;pictur...
metapost log    > <*> ... ; s := Foo(8cm, 2cm)
metapost log    >                                                   ; draw s; drawdot center l...
metapost log    > 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200314/0e41298f/attachment.htm>

More information about the ntg-context mailing list