[metapost] Error when defining a function

Peng Yu pengyu.ut at gmail.com
Fri Jun 15 05:25:52 CEST 2007


Hi

I couldn't figure out what is wrong with the following metapost
program. Would you please help me?

Thanks,
Peng

$ mpost psm.mp
This is MetaPost, Version 0.641 (Web2C 7.5.4)
(psm.mp
! Missing `)' has been inserted.
<to be read again>
                   1
l.8 def drawrect(expr x1
                        , x2, y1, y2) =
? X
Transcript written on psm.log.


$ cat psm.mp
u := 1cm;
beginfig(1);

numeric glass[];
glass[0] := -2*u;
glass[1] := 2*u;

def drawrect(expr x1, x2, y1, y2) =
  draw (x1,y1)--(x2,y1)--(x2,y2)--(x1,y2)--cycle
enddef;

drawrect(glass[0], glass[1], 0, 1cm);

endfig;

end;


More information about the metapost mailing list