[NTG-context] metafont suffix problem

Hans van der Meer hansm at science.uva.nl
Tue Jun 26 22:35:59 CEST 2007

My knowledge of MetaPost falls short. I hope someone will be able to  
help me with the following problem:

This is a macro along the line of the mode_def definition (see the  
MetaFont book, Appendix B).

def count_ suffix $ =
	$ := incr counter_;
	countnames_[$] := str$;

called from some other macro, abbreviated:

def defineCount(expr xyz) suffix name =
	% among other statements
	count_ name;

The problem is that I would like to modify the contents of 'name'  
before it is used in 'count'.
I tried several solutions as for example:
	save name; string newname; newname := str name & "extension";
	count_ newname;
but then newname is not accepted. The error message is:
 >> unknown string newname
! Equation cannot be performed (unknown string=numeric).
and occurs

Directly changing name (because assignment to a suffix is possible):
	name := str name & "extension";
gives a similar error.

Nor did encapsulating of 'defineCount' with an outer calling macro  
where the extension as added work for me.

Hans van der Meer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ntg.nl/pipermail/ntg-context/attachments/20070626/d5ce14fe/attachment.html 

More information about the ntg-context mailing list