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
52 if (err_fname != NULL)
54 strcpy(fnbuf, err_fname);
57 strcpy(fnbuf, firstfname);
61 if ((err_fd = open(fnbuf, _OPEN_FLAGS, _PERM_MODE)) < 0)
70 // Display Error Message
82 sprintf(buf, "%s%d: Error: %s%s", curfname, curlineno, s, nl);
86 write(err_fd, buf, length);
96 int errors(char * s, char * s1)
107 sprintf(buf1, "%s%d: Error: %s%s", curfname, curlineno, buf, nl);
110 write(err_fd, buf1, (LONG)strlen(buf1));
129 sprintf(buf, "%s%d: Warning: %s%s", curfname, curlineno, s, nl);
132 write(err_fd, buf, (LONG)strlen(buf));
141 int warns(char * s, char * s1)
152 sprintf(buf1, "%s%d: Warning: %s%s", curfname, curlineno, buf, nl);
155 write(err_fd, buf1, (LONG)strlen(buf1));
164 int warni(char * s, unsigned i)
175 sprintf(buf1, "%s%d: Warning: %s%s", curfname, curlineno, buf, nl);
178 write(err_fd, buf1, (LONG)strlen(buf1));
196 sprintf(buf, "%s%d: Fatal: %s%s", curfname, curlineno, s, nl);
199 write(err_fd, buf, (LONG)strlen(buf));
211 sprintf(buf, "%s%d: Internal Error Number %d%s", curfname, curlineno, n, nl);
217 write(err_fd, buf, (LONG)strlen(buf));