X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=error.c;h=47cff9f29b4fae42afc48f96dade5e5eb92d351b;hp=ce22b395f3d87976f60ca0b8beaabe0a359044d7;hb=HEAD;hpb=37694c99b02f939fc259c1e180359afb887acd55 diff --git a/error.c b/error.c index ce22b39..47cff9f 100644 --- a/error.c +++ b/error.c @@ -8,8 +8,20 @@ #include "error.h" #include -#include "listing.h" #include "token.h" +#include "listing.h" +char * interror_msg[] = { + "Unknown internal error", // Error not referenced, should not be displayed + "Unknown internal error", // Error not referenced, should not be displayed + "Bad MULTX entry in chrtab", // Error #2 + "Unknown internal error", // Error not referenced, should not be displayed + "Bad fixup type", // Error #4 + "Bad operator in expression stream", // Error #5 + "Can't find generated code in section", // Error #6 + "Fixup (loc) out of range", // Error #7 + "Absolute top filename found", // Error #8 + "The RISC expression evaluator blew up, sorry" // Error #9 +}; // Exported variables int errcnt; // Error count @@ -18,7 +30,6 @@ char * err_fname; // Name of error message file // Internal variables static long unused; // For supressing 'write' warnings - // // Report error if not at EOL // @@ -39,7 +50,6 @@ int ErrorIfNotAtEOL(void) return 0; } - // // Cannot create a file // @@ -49,7 +59,6 @@ void CantCreateFile(const char * fn) exit(1); } - // // Setup for error message // o Create error listing file (if necessary) @@ -75,7 +84,6 @@ void err_setup(void) } } - // // Display error message (uses printf() style variable arguments) // @@ -103,13 +111,13 @@ int error(const char * text, ...) break; case SRC_IMACRO: { - // This is basically SetFilenameForErrorReporting() but we don't call it here - // as it will clobber curfname. That function is used during fixups only so - // it really doesn't matter at that point... + // This is basically SetFilenameForErrorReporting() but we don't + // call it here as it will clobber curfname. That function is used + // during fixups only so it really doesn't matter at that point... char * filename; -#include FILEREC * fr; uint16_t fnum = cur_inobj->inobj.imacro->im_macro->cfileno; + // Check for absolute top filename (this should never happen) if (fnum == -1) interror(8); @@ -130,7 +138,8 @@ int error(const char * text, ...) filename = fr->frec_name; - sprintf(buf1, "%s %d: Error: %s\n", filename, cur_inobj->inobj.imacro->im_macro->lineList->lineno, buf); + sprintf(buf1, "%s %d: Error: %s\nCalled from: %s %d\n", filename, cur_inobj->inobj.imacro->im_macro->lineList->lineno, buf, + curfname, curlineno); } break; case SRC_IREPT: @@ -153,7 +162,6 @@ int error(const char * text, ...) return ERROR; } - // // Display warning message (uses printf() style variable arguments) // @@ -183,7 +191,6 @@ int warn(const char * text, ...) return OK; } - int fatal(const char * s) { char buf[EBUFSIZ]; @@ -203,13 +210,12 @@ int fatal(const char * s) exit(1); } - int interror(int n) { char buf[EBUFSIZ]; err_setup(); - sprintf(buf, "%s %d: Internal error #%d\n", curfname, curlineno, n); + sprintf(buf, "%s %d: Internal error #%d: %s\n", curfname, curlineno, n, interror_msg[n]); if (listing > 0) ship_ln(buf); @@ -221,4 +227,3 @@ int interror(int n) exit(1); } -