[metapost] variable parameter list

Jens-Uwe Morawski s5d5 at gmx.net
Tue Feb 14 12:13:53 CET 2006


Am Freitag, den 10.02.2006, 12:32 +0100 schrieb Stephan Hennig:
> Jens-Uwe Morawski schrieb:
> 
> > def processKeyvals (text _kvps_)=
> 
> Great! Will CTAN ever see this piece of code?

It's there since more than a year, see my latexMP
package :)

> 
> >   begingroup;
> >     save _equals, _assign ;
> >     let _equals= = ;
> 
> Is it true that there would be no need to save '=' (for the final for
> loop) if one chose another assignment character in keyval syntax, e.g.,
> a colon?

indeed, but this wouldn't be a common key-value interface

> >     primarydef _ll_ _assign _rr_ =
> >       hide(_ll_ _equals _rr_ ) 1
> 
> An arbitrary return value (zero or -1) would work here as well?

hope so :)
 
> >     save = ;
> >     let = _equals _assign ;
> 
> What is the difference in '=' before and after these changes? As I
> understand it '=' refers to _assign which in turn refers to _equals
> which is the same as '='.

_equals has the original definition of "=". _assign is needed to
hide the operation from the for-loop and return something the
loop can work with. I don't know how the loop works internally,
thus the solution was found mainly by trial and error :)

j.



More information about the metapost mailing list