[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Maintaining global state with m4 macros
From: |
Grant Taylor |
Subject: |
Re: Maintaining global state with m4 macros |
Date: |
Thu, 2 Dec 2021 09:36:56 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
Hi,
On 12/2/21 7:11 AM, Paolo Amoroso wrote:
Is it possible to create an m4 macro expanding to the next integer
of a global counter each time it's called?
I don't know.
I /feel/ like it should be possible.
But my brain is definitely not in m4 mode this morning.
In other words, assuming the counter has an initial value (e.g. 0),
these calls to such a nextcount macro:
First call: nextcount
Second call: nextcount
Third call: nextcount
should generate the following output:
First call: 1
Second call: 2
Third call: 3
I'm stumped as I'm not sure updating the global state of a counter
is even possible with m4. Is there any way?
It sounds like you have some code that you're working on. Can you share
a (sanitized version of) it so that we know how you're doing things and
how complex / level of nesting the environment you're working on is?
--
Grant. . . .
unix || die
smime.p7s
Description: S/MIME Cryptographic Signature