4 * (C) Copyright 1989-1995
13 * Extensions: P. Felber, M. Hope
24 * The module assubr.c contains the error
25 * processing routines.
27 * assubr.c contains the following functions:
34 * assubr.c contains the local array of *error[]
37 /*)Function VOID err(c)
39 * int c error type character
41 * The function err() logs the error code character
42 * suppressing duplicate errors. If the error code
43 * is 'q' then the parse of the current assembler-source
44 * text line is terminated.
47 * char * p pointer to the error array
50 * char eb[] array of generated error codes
53 * VOID longjmp() c_library
56 * The error code may be inserted into the
57 * error code array eb[] or the parse terminated.
78 longjmp(jump_env, -1);
81 /*)Function VOID diag()
83 * The function diag() prints any error codes and
84 * the source line number to the stderr output device.
87 * char * p pointer to error code array eb[]
90 * int cfile current source file index
91 * char eb[] array of generated error codes
92 * char * ep pointer into error list
93 * int incfile current include file index
94 * char incfn[] array of include file names
95 * int incline[] array of include line numbers
96 * char srcfn[] array of source file names
97 * int srcline[] array of source line numbers
98 * FILE * stderr c_library
101 * int fprintf() c_library
102 * char * geterr() assubr.c
111 register char *p,*errstr;
116 fprintf(stderr, "?ASxxxx-Error-<");
118 fprintf(stderr, "%c", *p++);
120 fprintf(stderr, "> in line ");
122 fprintf(stderr, "%d", incline[incfil]);
123 fprintf(stderr, " of %s\n", incfn[incfil]);
125 fprintf(stderr, "%d", srcline[cfile]);
126 fprintf(stderr, " of %s\n", srcfn[cfile]);
131 if ((errstr = geterr(*p++)) != NULL) {
133 /* Modified to conform to gcc error standard, M. Hope, 7 Feb 98. */
135 fprintf(stderr, "%s:", incfn[incfil]);
136 fprintf(stderr, "%d: Error:", incline[incfil]);
139 fprintf(stderr, "%s:", srcfn[cfile]);
140 fprintf(stderr, "%d: Error:", srcline[cfile]);
142 fprintf(stderr, " %s\n", errstr);
144 fprintf(stderr, " %s\n", errstr);
154 /*)Functions: VOID aerr()
158 * The functions aerr(), qerr(), and rerr() report their
159 * respective error type. These are included only for
169 * VOID err() assubr.c
172 * The appropriate error code is inserted into the
173 * error array and the parse may be terminated.
204 * ASxxxx assembler errors
207 "<.> use \". = . + <arg>\" not \". = <arg>\"",
208 "<a> machine specific addressing or addressing mode error",
209 "<b> direct page boundary error",
210 "<d> direct page addressing error",
211 "<i> .include file error or an .if/.endif mismatch",
212 "<m> multiple definitions error",
213 "<o> .org in REL area or directive / mnemonic error",
214 "<p> phase error: label location changing between passes 2 and 3",
215 "<q> missing or improper operators, terminators, or delimiters",
216 "<r> relocation error",
217 "<u> undefined symbol encountered during assembly",
221 /*)Function: char *getarr(c)
223 * int c the error code character
225 * The function geterr() scans the list of errors returning the
226 * error string corresponding to the input error character.
229 * int i error index counter
232 * char *errors[] array of pointers to the
239 * A pointer to the appropriate
240 * error code string is returned.
248 for (i=0; errors[i]!=NULL; i++) {
249 if (c == errors[i][1]) {