Mercurial > hg-old > index.cgi
diff lwasm/lwasm.c @ 382:eacdae8a1575
Various bugfixes
author | lost@starbug |
---|---|
date | Sat, 15 May 2010 13:39:21 -0600 |
parents | 1624a36f12a3 |
children | cf8c92d70eb1 |
line wrap: on
line diff
--- a/lwasm/lwasm.c Mon Apr 26 19:56:10 2010 -0600 +++ b/lwasm/lwasm.c Sat May 15 13:39:21 2010 -0600 @@ -348,7 +348,6 @@ // hexadecimal constant int v = 0, v2; (*p)++; - if (!strchr("0123456789abcdefABCDEF", **p)) return NULL; @@ -357,7 +356,7 @@ v2 = toupper(**p) - '0'; if (v2 > 9) v2 -= 7; - val = val * 16 + v2; + v = v * 16 + v2; (*p)++; } return lw_expr_build(lw_expr_type_int, v); @@ -377,7 +376,7 @@ v2 = toupper(**p) - '0'; if (v2 > 9) v2 -= 7; - val = val * 16 + v2; + v = v * 16 + v2; (*p)++; } return lw_expr_build(lw_expr_type_int, v); @@ -394,7 +393,7 @@ while (**p && strchr("01234567", **p)) { - val = val * 8 + (**p - '0'); + v = v * 8 + (**p - '0'); (*p)++; } return lw_expr_build(lw_expr_type_int, v); @@ -762,5 +761,22 @@ void lwasm_show_errors(asmstate_t *as) { - fprintf(stderr, "Errors encountered. FIXME - print out errors.\n"); + line_t *cl; + lwasm_error_t *e; + + for (cl = as -> line_head; cl; cl = cl -> next) + { + if (!(cl -> err) && !(cl -> warn)) + continue; + for (e = cl -> err; e; e = e -> next) + { + fprintf(stderr, "ERROR: %s\n", e -> mess); + } + for (e = cl -> warn; e; e = e -> next) + { + fprintf(stderr, "WARNING: %s\n", e -> mess); + } + + fprintf(stderr, " LINE: %s\n", cl -> ltext); + } }