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

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

Re: m4: doing arithmetic on macro arguments


From: Paul Jarc
Subject: Re: m4: doing arithmetic on macro arguments
Date: Tue, 23 Nov 2004 10:54:39 -0500
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

Haakon Nilsen <haakonn@gmail.com> wrote:
>   m4_define(`_FOO', m4_incr($1))
>
> I want _FOO(1) to expand into "2", for instance.

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

The second argument to m4_define is macro-expanded before m4_define
sees it, so you have to quote it.  Then when _FOO is expanded later,
its replacement text will be rescanned for macros, so as long as you
have only one level of quoting, m4_incr will be expanded then.


paul




reply via email to

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