help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

m4: doing arithmetic on macro arguments


From: Haakon Nilsen
Subject: m4: doing arithmetic on macro arguments
Date: Tue, 23 Nov 2004 16:21:14 +0100
User-agent: KNode/0.8.1

Hi,

I have been using m4 to generate HTML, and it's been great fun and very
useful. However, there's one problem I have been unable to solve.

I want to have a macro like this:

  m4_define(`_FOO', m4_incr($1))

I want _FOO(1) to expand into "2", for instance.

Using the macro definition above, m4 complains that m4_incr has been passed
a non-numerical argument. I have looked at many examples, but none of them
show how to increase the value of an argument to a macro. Is it possible at
all?

Thanks,
Haakon Nilsen.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]