X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=error.c;h=9b5460b850e8f35846b6997e8f0a8f5bc82ebca6;hp=c27911796f9dc9778102ccccb1c19b47db8ef0a3;hb=9153334781cd2e23750f4dc002e847606c07a1f0;hpb=f3c7d186a15b89c39e360b9cc89545a0d24bd6a4 diff --git a/error.c b/error.c index c279117..9b5460b 100644 --- a/error.c +++ b/error.c @@ -1,7 +1,7 @@ // // RMAC - Reboot's Macro Assembler for all Atari computers // ERROR.C - Error Handling -// Copyright (C) 199x Landon Dyer, 2011-2017 Reboot and Friends +// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 // Source utilised with the kind permission of Landon Dyer // @@ -24,11 +24,11 @@ static long unused; // For supressing 'write' warnings // int at_eol(void) { - if (*tok.u32 != EOL) + if (*tok != EOL) { - error("syntax error. expected EOL, found $%X ('%c')", *tok.u32, *tok.u32); + error("syntax error. expected EOL, found $%X ('%c')", *tok, *tok); printf("Token = "); - DumpToken(*tok.u32); + DumpToken(*tok); printf("\n"); DumpTokenBuffer(); } @@ -91,7 +91,24 @@ int error(const char * text, ...) if (listing > 0) ship_ln(buf); - sprintf(buf1, "%s %d: Error: %s\n", curfname, curlineno, buf); + if (cur_inobj) + { + switch (cur_inobj->in_type) + { + case SRC_IFILE: + sprintf(buf1, "%s %d: Error: %s\n", curfname, curlineno, buf); + break; + case SRC_IMACRO: + sprintf(buf1, "%s %d: Error: %s\n", curfname, cur_inobj->inobj.imacro->im_macro->lineList->lineno, buf); + break; + case SRC_IREPT: + sprintf(buf1, "%s %d: Error: %s\n", curfname, cur_inobj->inobj.irept->lineno, buf); + break; + } + } + else + // No current file so cur_inobj is NULL + sprintf(buf1, "%s %d: Error: %s\n", curfname, curlineno, buf); if (err_flag) unused = write(err_fd, buf1, (LONG)strlen(buf1));