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 char nl[] = "\n";
20 // Report error if not at EOL
25 error("syntax error");
32 // Cannot Create a File
34 void cantcreat(char * fn)
36 printf("cannot create: '%s'\n", fn);
42 // Setup for Error Message
43 // o Create error listing file (if necessary)
44 // o Set current filename
50 // This seems like it's unnecessary, as token.c seems to take care of this all by itself.
51 // Can restore if it's really needed. If not, into the bit bucket it goes. :-)
54 if (err_fname != NULL)
56 strcpy(fnbuf, err_fname);
59 strcpy(fnbuf, firstfname);
63 if ((err_fd = open(fnbuf, _OPEN_FLAGS, _PERM_MODE)) < 0)
72 // Display Error Message
74 int error(const char * s)
84 sprintf(buf, "%s %d: Error: %s%s", curfname, curlineno, s, nl);
88 write(err_fd, buf, length);
99 int errors(char * s, char * s1)
110 sprintf(buf1, "%s %d: Error: %s%s", curfname, curlineno, buf, nl);
113 write(err_fd, buf1, (LONG)strlen(buf1));
133 sprintf(buf, "%s %d: Warning: %s%s", curfname, curlineno, s, nl);
136 write(err_fd, buf, (LONG)strlen(buf));
146 int warns(char * s, char * s1)
157 sprintf(buf1, "%s %d: Warning: %s%s", curfname, curlineno, buf, nl);
160 write(err_fd, buf1, (LONG)strlen(buf1));
170 int warni(char * s, unsigned i)
181 sprintf(buf1, "%s %d: Warning: %s%s", curfname, curlineno, buf, nl);
184 write(err_fd, buf1, (LONG)strlen(buf1));
203 sprintf(buf, "%s %d: Fatal: %s%s", curfname, curlineno, s, nl);
206 write(err_fd, buf, (LONG)strlen(buf));
219 sprintf(buf, "%s %d: Internal Error Number %d%s", curfname, curlineno, n, nl);
225 write(err_fd, buf, (LONG)strlen(buf));