Mercurial > hg > index.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
527:2c4d11da2afe | 528:4536f0e61425 |
---|---|
243 if (n != (nargs -1)) | 243 if (n != (nargs -1)) |
244 { | 244 { |
245 macro_add_to_buff(&linebuff, &bloc, &blen, ','); | 245 macro_add_to_buff(&linebuff, &bloc, &blen, ','); |
246 } | 246 } |
247 } | 247 } |
248 p2++; | |
249 } | |
250 else if (*p2 == '\\' && p2[1] == '#') | |
251 { | |
252 char ctcbuf[25]; | |
253 snprintf(ctcbuf, 25, "%d", nargs); | |
254 for (p3 = ctcbuf; *p3; p3++) | |
255 macro_add_to_buff(&linebuff, &bloc, &blen, *p3); | |
248 p2++; | 256 p2++; |
249 } | 257 } |
250 else if (*p2 == '\\' && isdigit(p2[1])) | 258 else if (*p2 == '\\' && isdigit(p2[1])) |
251 { | 259 { |
252 int n; | 260 int n; |