Re: Maintaining global state with m4 macros
Paolo Amoroso <[email protected]> Thu, 2 Dec 2021 19:25:11 +0100
| Newsgroups | gmane.comp.gnu.m4.general |
|---|---|
| Message-ID | <CAGi1hzvOYC_2z3RSVY7GvFQYj1wHccOzrogbhyX4_dFaKvRFEQ@mail.gmail.com> |
On Thu, Dec 2, 2021 at 6:45 PM Douglas McIlroy <[email protected]> wrote: > > define(bump,`define(`$1',incr($1))')dnl > define(counter,0)dnl > counter > bump(`counter')counter > bump(`counter')counter Thanks Douglas, your solution works great. In the context of the Assembly macros I mentioned in an earlier message I'd add something like this to your code: define(`mymacro', `Lbump(`counter')counter mvi a, $1') mymacro(`3') But the output is not what I'd expect: 0 1 2 [blank lines] Lbump(counter)2: mvi a, 3 Instead I need: L2: mvi a, 3 Paolo