Mercurial > hg > index.cgi
changeset 40:d96037ea0b80
Fixed line number counting being broken by macros
author | lost@l-w.ca |
---|---|
date | Sat, 02 Apr 2011 22:28:22 -0600 |
parents | 23b01aa3ecf9 |
children | c6b8b455d67f |
files | lwasm/macro.c lwasm/pass1.c |
diffstat | 2 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lwasm/macro.c Sat Apr 02 02:48:36 2011 -0600 +++ b/lwasm/macro.c Sat Apr 02 22:28:22 2011 -0600 @@ -267,7 +267,7 @@ { char ctcbuf[100]; char *p; - snprintf(ctcbuf, 100, "\001\001SETCONTEXT %d\n", oldcontext); + snprintf(ctcbuf, 100, "\001\001SETCONTEXT %d\n\001\001SETLINENO %d\n", oldcontext, cl -> lineno + 1); for (p = ctcbuf; *p; p++) macro_add_to_buff(&linebuff, &bloc, &blen, *p); }
--- a/lwasm/pass1.c Sat Apr 02 02:48:36 2011 -0600 +++ b/lwasm/pass1.c Sat Apr 02 22:28:22 2011 -0600 @@ -77,8 +77,13 @@ { as -> context = strtol(p1, NULL, 10); } + else if (!strcmp(line + 2, "SETLINENO")) + { + lc = strtol(p1, NULL, 10); + } lw_free(line); - lc = 1; + if (lc == 0) + lc = 1; continue; } debug_message(as, 75, "Read line: %s", line); @@ -128,7 +133,7 @@ lc = 1; if (lc) { - cl -> lineno = 1; + cl -> lineno = lc; lc = 0; } as -> line_tail = cl;