[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Maintaining global state with m4 macros
From: |
Paolo Amoroso |
Subject: |
Maintaining global state with m4 macros |
Date: |
Thu, 2 Dec 2021 15:11:59 +0100 |
Is it possible to create an m4 macro expanding to the next integer of
a global counter each time it's called?
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?
Thanks,
Paolo