[metapost] problem with macro parameters

Stephan Hennig mailing_list at arcor.de
Sat Aug 20 18:14:17 CEST 2005


Stephan Hennig schrieb:

> def curveS(suffix a,b)(expr ra,rb) =

"begingroup" is missing here. But that doesn't solve the problem.


> %% Alternatively tried with scantokens, but this fails.
> %% Do I have to expand a and b?

Expanding a and b works. But I can't believe there is no easier solution
without scantokens.

Thanks in advance,
Stephan Hennig



input metaobj
prologues := 1;

def curveS(suffix a,b)(expr ra,rb) =
begingroup
  save s;
  string s;
  s = "nccurve(Obj(" & decimal a & "))(Obj(" & decimal b & ")) " &
    char(34) & "angleA(" & decimal ra & ")" & char(34) & ", " &
    char(34) & "angleB(" & decimal rb & ")" & char(34) & ";";
  show s;
  scantokens(s);
endgroup
enddef;

beginfig(1);
  newCircle.source("S");
  newCircle.sink("T");
  source.c = (0bp, 0bp);
  sink.c = (100bp, 0bp);
  drawObj(source, sink);
  curveS(source,sink, 20,-20);
endfig;
end



More information about the metapost mailing list