Mercurial > hg > index.cgi
diff lwasm/macro.c @ 49:bd8b3fbd1e28
Added ability to flag macros as "noexpand" so they are not expanded in the listing
author | lost@l-w.ca |
---|---|
date | Tue, 05 Apr 2011 00:06:28 -0600 |
parents | d96037ea0b80 |
children | e2728091b75a |
line wrap: on
line diff
--- a/lwasm/macro.c Mon Apr 04 22:20:38 2011 -0600 +++ b/lwasm/macro.c Tue Apr 05 00:06:28 2011 -0600 @@ -35,7 +35,9 @@ PARSEFUNC(pseudo_parse_macro) { macrotab_t *m; - + char *t; + char tc; + l -> len = 0; if (as -> skipcond) @@ -72,11 +74,17 @@ m -> next = as -> macros; m -> lines = NULL; m -> numlines = 0; + m -> flags = 0; as -> macros = m; - + + t = *p; while (**p && !isspace(**p)) (*p)++; - + tc = **p; + /* ignore unknown flags */ + if (strcasecmp(t, "noexpand") == 0) + m -> flags |= macro_noexpand; + **p = tc; as -> inmacro = 1; } @@ -204,6 +212,16 @@ // and push it into the front of the input stack bloc = blen = 0; linebuff = NULL; + + if (m -> flags & macro_noexpand) + { + char ctcbuf[100]; + char *p; + snprintf(ctcbuf, 100, "\001\001SETNOEXPANDSTART\n"); + for (p = ctcbuf; *p; p++) + macro_add_to_buff(&linebuff, &bloc, &blen, *p); + } + for (lc = 0; lc < m -> numlines; lc++) { @@ -264,6 +282,15 @@ } + if (m -> flags & macro_noexpand) + { + char ctcbuf[100]; + char *p; + snprintf(ctcbuf, 100, "\001\001SETNOEXPANDEND\n"); + for (p = ctcbuf; *p; p++) + macro_add_to_buff(&linebuff, &bloc, &blen, *p); + } + { char ctcbuf[100]; char *p;