-*- text -*-
-* Assembler macros can now use the syntax \+ to access the number of times a
- given macro has been executed. This is similar to the already existing \@
- syntax, except that the count is maintained on a per-macro basis.
+* Assembler macros as well as the bodies of .irp / .irpc can now use the
+ syntax \+ to access the number of times a given macro has been executed.
+ This is similar to the already existing \@ syntax, except that the count is
+ maintained on a per-macro basis.
* Support the NF feature in Intel APX.
static const char *
macro_expand_body (sb *in, sb *out, formal_entry *formals,
- struct htab *formal_hash, const macro_entry *macro)
+ struct htab *formal_hash, const macro_entry *macro,
+ unsigned int instance)
{
sb t;
size_t src = 0;
sprintf (buffer, "%u", macro_number);
sb_add_string (out, buffer);
}
- else if (macro && src < in->len && in->ptr[src] == '+')
+ else if (src < in->len && in->ptr[src] == '+')
{
/* Sub in the current macro invocation number. */
char buffer[12];
src++;
- sprintf (buffer, "%d", macro->count);
+ sprintf (buffer, "%d", instance);
sb_add_string (out, buffer);
}
else if (src < in->len && in->ptr[src] == '&')
}
}
- err = macro_expand_body (&m->sub, out, m->formals, m->formal_hash, m);
+ err = macro_expand_body (&m->sub, out, m->formals, m->formal_hash, m,
+ m->count);
}
/* Discard any unnamed formal arguments. */
if (idx >= in->len)
{
/* Expand once with a null string. */
- err = macro_expand_body (&sub, out, &f, h, 0);
+ err = macro_expand_body (&sub, out, &f, h, NULL, 0);
}
else
{
bool in_quotes = false;
+ unsigned int instance = 0;
while (idx < in->len)
{
++idx;
}
- err = macro_expand_body (&sub, out, &f, h, 0);
+ err = macro_expand_body (&sub, out, &f, h, NULL, instance);
+ ++instance;
if (err != NULL)
break;
if (!irpc)