I mean for doing useful stuff , not just experimental programmes.

There are a couple of awk programmes I want to write and I was thinking it
would be nice to have named constants as you do in C. I mean things like
#define MAX_FIELD_WIDTH 100
I want to do similar things with awk.The catch is that I don't want macros
to be expanded inside quoted strings and inside regular expressions.So for
example if my programme has somewhere
if ( $0 ~ /MAX_FIELD_WIDTH/ )
I want these to remain unchanged after I filter the programme through m4.
On the other hand if I have somewhere
if &#40; a < MAX_FIELD_WIDTH &#41;
then m4 should replace this by
if &#40; a < 100 &#41;
I've only had a look at the m4 manual today so I'm a complete beginner.
Defining macros is straightforward but as I've said my problem is how to
prevent them from expanding at the wrong place.So far the only way I can
see to achieve this is to put the critical portions of the code inside m4
quotes ie write
if &#40; $0 ~ ` /MAX_FIELD_WIDTH/ ' &#41;
print ` "MAX_FIELD_WIDTH" '
but this is an ugly solution.It would mean that as I write the programme I
would have to think not only in terms of awk but also in terms of m4.While
what I have in mind is to put in the beginning some m4 directives and
from then on just write the programme as any other awk programme
apart from using the macros.

The other solution is to use macro names which I won't use inside regular
expressions or quotes.Once again I find this inelegant.It's an extra thing
to worry about , especially if I have a lot of macros.

So can anyone suggest any other solution ?

Even if you don't have any ideas for my specific problem , if you've
used m4 as a preprocessor for other languages I'd be curious to see what
you did with it.