4 * (C) Copyright 1989-1995
19 * The module assubr.c contains the error
20 * processing routines.
22 * assubr.c contains the following functions:
29 * assubr.c contains the local array of *error[]
32 /*)Function VOID err(c)
34 * int c error type character
36 * The function err() logs the error code character
37 * suppressing duplicate errors. If the error code
38 * is 'q' then the parse of the current assembler-source
39 * text line is terminated.
42 * char * p pointer to the error array
45 * char eb[] array of generated error codes
48 * VOID longjmp() c_library
51 * The error code may be inserted into the
52 * error code array eb[] or the parse terminated.
71 longjmp(jump_env, -1);
74 /*)Function VOID diag()
76 * The function diag() prints any error codes and
77 * the source line number to the stderr output device.
80 * char * p pointer to error code array eb[]
83 * int cfile current source file index
84 * char eb[] array of generated error codes
85 * char * ep pointer into error list
86 * int incfile current include file index
87 * char incfn[] array of include file names
88 * int incline[] array of include line numbers
89 * char srcfn[] array of source file names
90 * int srcline[] array of source line numbers
91 * FILE * stderr c_library
94 * int fprintf() c_library
95 * char * geterr() assubr.c
101 extern int fatalErrors;
106 register char *p,*errstr;
111 fprintf(stderr, "?ASxxxx-Error-<");
113 fprintf(stderr, "%c", *p++);
115 fprintf(stderr, "> in line ");
117 fprintf(stderr, "%d", incline[incfil]);
118 fprintf(stderr, " of %s\n", incfn[incfil]);
120 fprintf(stderr, "%d", srcline[cfile]);
121 fprintf(stderr, " of %s\n", srcfn[cfile]);
125 if ((errstr = geterr(*p++)) != NULL) {
126 fprintf(stderr, " %s\n", errstr);
132 /*)Function VOID warnBanner()
134 * The function warnBanner() prints a generic warning message
135 * header (including the current source file/line) and positions
136 * the output for a more specific warning message.
138 * It is assumed that the call to warnBanner will be followed with
139 * a fprintf to stderr (or equivalent) with the specific warning
146 * int cfile current source file index
147 * int incfile current include file index
148 * char incfn[] array of include file names
149 * int incline[] array of include line numbers
150 * char srcfn[] array of source file names
151 * int srcline[] array of source line numbers
152 * FILE * stderr c_library
155 * int fprintf() c_library
163 fprintf(stderr, "?ASxxxx-Warning in line ");
165 fprintf(stderr, "%d", incline[incfil]);
166 fprintf(stderr, " of %s\n", incfn[incfil]);
168 fprintf(stderr, "%d", srcline[cfile]);
169 fprintf(stderr, " of %s\n", srcfn[cfile]);
171 fprintf(stderr, " ");
174 /*)Functions: VOID aerr()
178 * The functions aerr(), qerr(), and rerr() report their
179 * respective error type. These are included only for
189 * VOID err() assubr.c
192 * The appropriate error code is inserted into the
193 * error array and the parse may be terminated.
224 * ASxxxx assembler errors
227 "<.> use \". = . + <arg>\" not \". = <arg>\"",
228 "<a> machine specific addressing or addressing mode error",
229 "<b> direct page boundary error",
230 "<d> direct page addressing error",
231 "<i> .include file error or an .if/.endif mismatch",
232 "<m> multiple definitions error",
233 "<o> .org in REL area or directive / mnemonic error",
234 "<p> phase error: label location changing between passes 2 and 3",
235 "<q> missing or improper operators, terminators, or delimiters",
236 "<r> relocation error",
237 "<u> undefined symbol encountered during assembly",
241 /*)Function: char *getarr(c)
243 * int c the error code character
245 * The function geterr() scans the list of errors returning the
246 * error string corresponding to the input error character.
249 * int i error index counter
252 * char *errors[] array of pointers to the
259 * A pointer to the appropriate
260 * error code string is returned.
268 for (i=0; errors[i]!=NULL; i++) {
269 if (c == errors[i][1]) {