Mercurial > hg > index.cgi
diff lwasm/macro.c @ 528:4536f0e61425
Add \# macro expansion which expands to the number of arguments
It seems useful to have a number of arguments in some macros. Add \#
expansion tag which turns into the number of arguments.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 30 Jan 2022 14:13:34 -0700 |
parents | a4a58c4c7a41 |
children | bbc600db5016 |
line wrap: on
line diff
--- a/lwasm/macro.c Sun Jan 30 14:12:40 2022 -0700 +++ b/lwasm/macro.c Sun Jan 30 14:13:34 2022 -0700 @@ -247,6 +247,14 @@ } p2++; } + else if (*p2 == '\\' && p2[1] == '#') + { + char ctcbuf[25]; + snprintf(ctcbuf, 25, "%d", nargs); + for (p3 = ctcbuf; *p3; p3++) + macro_add_to_buff(&linebuff, &bloc, &blen, *p3); + p2++; + } else if (*p2 == '\\' && isdigit(p2[1])) { int n;