I'd like to invoke a macro N times, each time using the accumulator, ie;
%macro foo 1
range 1, 8, {some_partially_applied_macro %1}
%endmacro
is equivalent to
%macro foo 1
some_partially_applied_macro %1, 1
some_partially_applied_macro %1, 2
some_partially_applied_macro %1, 3
...
some_partially_applied_macro %1, 8
%endmacro
I tried writing the following (and several variations thereof):
%macro range 3
%assign i %1
%rep %2
%[%3 i]
%assign i i+1
%endrep
%endmacro
I've had no success.
An important thing to note is the 3rd argument may need to be partially applied.
Figured it out. Remove the %[...] part around %[%3 i].
It was tricking me because I was testing it like so:
range 1, 8, {some_partially_applied_macro %1}
Actually has to have a comma at the end after %1, or NASM doesn't expand it properly (it doesn't see it as a proper comma separated macro).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With