4 * (C) Copyright 1989-1995
13 * Extensions: P. Felber, M. Hope
23 * The module assubr.c contains the error
24 * processing routines.
26 * assubr.c contains the following functions:
33 * assubr.c contains the local array of *error[]
36 /*)Function VOID err(c)
38 * int c error type character
40 * The function err() logs the error code character
41 * suppressing duplicate errors. If the error code
42 * is 'q' then the parse of the current assembler-source
43 * text line is terminated.
46 * char * p pointer to the error array
49 * char eb[] array of generated error codes
52 * VOID longjmp() c_library
55 * The error code may be inserted into the
56 * error code array eb[] or the parse terminated.
77 longjmp(jump_env, -1);
80 /*)Function VOID diag()
82 * The function diag() prints any error codes and
83 * the source line number to the stderr output device.
86 * char * p pointer to error code array eb[]
89 * int cfile current source file index
90 * char eb[] array of generated error codes
91 * char * ep pointer into error list
92 * int incfile current include file index
93 * char incfn[] array of include file names
94 * int incline[] array of include line numbers
95 * char srcfn[] array of source file names
96 * int srcline[] array of source line numbers
97 * FILE * stderr c_library
100 * int fprintf() c_library
101 * char * geterr() assubr.c
110 register char *p,*errstr;
115 fprintf(stderr, "?ASxxxx-Error-<");
117 fprintf(stderr, "%c", *p++);
119 fprintf(stderr, "> in line ");
121 fprintf(stderr, "%d", incline[incfil]);
122 fprintf(stderr, " of %s\n", incfn[incfil]);
124 fprintf(stderr, "%d", srcline[cfile]);
125 fprintf(stderr, " of %s\n", srcfn[cfile]);
130 if ((errstr = geterr(*p++)) != NULL) {
132 /* Modified to conform to gcc error standard, M. Hope, 7 Feb 98. */
134 fprintf(stderr, "%s:", incfn[incfil]);
135 fprintf(stderr, "%d: Error:", incline[incfil]);
138 fprintf(stderr, "%s:", srcfn[cfile]);
139 fprintf(stderr, "%d: Error:", srcline[cfile]);
141 fprintf(stderr, " %s\n", errstr);
143 fprintf(stderr, " %s\n", errstr);
153 /*)Functions: VOID aerr()
157 * The functions aerr(), qerr(), and rerr() report their
158 * respective error type. These are included only for
168 * VOID err() assubr.c
171 * The appropriate error code is inserted into the
172 * error array and the parse may be terminated.
203 * ASxxxx assembler errors
206 "<.> use \". = . + <arg>\" not \". = <arg>\"",
207 "<a> machine specific addressing or addressing mode error",
208 "<b> direct page boundary error",
209 "<d> direct page addressing error",
210 "<i> .include file error or an .if/.endif mismatch",
211 "<m> multiple definitions error",
212 "<o> .org in REL area or directive / mnemonic error",
213 "<p> phase error: label location changing between passes 2 and 3",
214 "<q> missing or improper operators, terminators, or delimiters",
215 "<r> relocation error",
216 "<u> undefined symbol encountered during assembly",
220 /*)Function: char *getarr(c)
222 * int c the error code character
224 * The function geterr() scans the list of errors returning the
225 * error string corresponding to the input error character.
228 * int i error index counter
231 * char *errors[] array of pointers to the
238 * A pointer to the appropriate
239 * error code string is returned.
247 for (i=0; errors[i]!=NULL; i++) {
248 if (c == errors[i][1]) {