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
26 error("syntax error");
33 // Cannot Create a File
35 void cantcreat(const char * fn)
37 printf("cannot create: '%s'\n", fn);
43 // Setup for Error Message
44 // o Create error listing file (if necessary)
45 // o Set current filename
51 // This seems like it's unnecessary, as token.c seems to take care of this all by itself.
52 // Can restore if it's really needed. If not, into the bit bucket it goes. :-)
55 if (err_fname != NULL)
57 strcpy(fnbuf, err_fname);
60 strcpy(fnbuf, firstfname);
64 if ((err_fd = open(fnbuf, _OPEN_FLAGS, _PERM_MODE)) < 0)
73 // Display Error Message
75 int error(const char * s)
85 sprintf(buf, "%s %d: Error: %s%s", curfname, curlineno, s, nl);
89 unused = write(err_fd, buf, length);
100 int errors(const char * s, char * s1)
111 sprintf(buf1, "%s %d: Error: %s%s", curfname, curlineno, buf, nl);
114 unused = write(err_fd, buf1, (LONG)strlen(buf1));
125 int warn(const char * s)
134 sprintf(buf, "%s %d: Warning: %s%s", curfname, curlineno, s, nl);
137 unused = write(err_fd, buf, (LONG)strlen(buf));
147 int warns(const char * s, char * s1)
158 sprintf(buf1, "%s %d: Warning: %s%s", curfname, curlineno, buf, nl);
161 unused = write(err_fd, buf1, (LONG)strlen(buf1));
171 int warni(const char * s, unsigned i)
182 sprintf(buf1, "%s %d: Warning: %s%s", curfname, curlineno, buf, nl);
185 unused = write(err_fd, buf1, (LONG)strlen(buf1));
195 int fatal(const char * s)
204 sprintf(buf, "%s %d: Fatal: %s%s", curfname, curlineno, s, nl);
207 unused = write(err_fd, buf, (LONG)strlen(buf));
220 sprintf(buf, "%s %d: Internal Error Number %d%s", curfname, curlineno, n, nl);
226 unused = write(err_fd, buf, (LONG)strlen(buf));