2 // RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
3 // ERROR.C - Error Handling
4 // Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
5 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
6 // Source Utilised with the Kind Permission of Landon Dyer
13 int errcnt; // Error count
14 char * err_fname; // Name of error message file
16 static const char nl[] = "\n";
17 static long unused; // For supressing 'write' warnings
21 // Report error if not at EOL
29 // error("syntax error");
30 sprintf(msg, "syntax error. expected EOL, found $%X ('%c')", *tok, *tok);
39 // Cannot Create a File
41 void cantcreat(const char * fn)
43 printf("cannot create: '%s'\n", fn);
49 // Setup for Error Message
50 // o Create error listing file (if necessary)
51 // o Set current filename
57 // This seems like it's unnecessary, as token.c seems to take care of this all by itself.
58 // Can restore if it's really needed. If not, into the bit bucket it goes. :-)
61 if (err_fname != NULL)
63 strcpy(fnbuf, err_fname);
66 strcpy(fnbuf, firstfname);
70 if ((err_fd = open(fnbuf, _OPEN_FLAGS, _PERM_MODE)) < 0)
79 // Display Error Message
81 int error(const char * s)
91 sprintf(buf, "%s %d: Error: %s%s", curfname, curlineno, s, nl);
95 unused = write(err_fd, buf, length);
106 int errors(const char * s, char * s1)
117 sprintf(buf1, "%s %d: Error: %s%s", curfname, curlineno, buf, nl);
120 unused = write(err_fd, buf1, (LONG)strlen(buf1));
131 int warn(const char * s)
140 sprintf(buf, "%s %d: Warning: %s%s", curfname, curlineno, s, nl);
143 unused = write(err_fd, buf, (LONG)strlen(buf));
153 int warns(const char * s, char * s1)
164 sprintf(buf1, "%s %d: Warning: %s%s", curfname, curlineno, buf, nl);
167 unused = write(err_fd, buf1, (LONG)strlen(buf1));
177 int warni(const char * s, unsigned i)
188 sprintf(buf1, "%s %d: Warning: %s%s", curfname, curlineno, buf, nl);
191 unused = write(err_fd, buf1, (LONG)strlen(buf1));
201 int fatal(const char * s)
210 sprintf(buf, "%s %d: Fatal: %s%s", curfname, curlineno, s, nl);
213 unused = write(err_fd, buf, (LONG)strlen(buf));
226 sprintf(buf, "%s %d: Internal Error Number %d%s", curfname, curlineno, n, nl);
232 unused = write(err_fd, buf, (LONG)strlen(buf));