[metapost] metapost 1.999 Semicolon Weirdness
Hans Hagen
pragma at wxs.nl
Wed May 14 01:05:31 CEST 2014
On 5/13/2014 11:00 PM, Hartmut Henkel wrote:
> Hi,
>
> the following program runs fine with MetaPost Version 1.999:
>
> prologues:=3;
> beginfig(1);
> path p;
> z1 = (0.000000,0.000000);
> z2 = (10.000000,0.000000);
> z3 = (10.000000,10.000000);
> z4 = (0.000000,0.000000);
> p := z1 .. controls z2 and z3 .. z4;
> message(decimal(arclength(p)));
> pickup pencircle scaled 0.050000; drawdot z1 withcolor red;
> drawdot z2 withcolor red;
> drawdot z3 withcolor red;
> drawdot z4 withcolor red;
> pickup pencircle scaled 0.010000 draw (z1--z2--z3--z4) withcolor red;
> draw p;
> currentpicture := currentpicture scaled 10;
> endfig;
> end;
>
> Now i wonder why, since by accident there is no semicolon in line 14
> between "pickup pencircle scaled 0.010000" and "draw (z1--z2...".
> Shouldn't this give an error?
pickup is a macro:
def pickup secondary q =
if numeric q :
numeric_pickup_
else :
pen_pickup_
fi q
enddef ;
that one calls:
def numeric_pickup_ primary q =
if unknown pen_[q] :
...
else :
...
fi ;
enddef ;
def pen_pickup_ primary q =
currentpen := q ;
...
path currentpen_path ;
enddef ;
and there are ;'s embedded .. however:
pickup pencircle scaled 0.010000
;
numeric n ; n := savepen ;
pickup n ;
fill fullcircle scaled 1cm withcolor red;
needs the ; so you can best play safe and always add the ;
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
-----------------------------------------------------------------
More information about the metapost
mailing list