3 Copyright (C) 1989-1995 Alan R. Baldwin
4 721 Berkeley St., Kent, Ohio 44240
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 * Extensions: P. Felber, M. Hope
30 * The module assubr.c contains the error
31 * processing routines.
33 * assubr.c contains the following functions:
40 * assubr.c contains the local array of *error[]
43 /*)Function VOID err(c)
45 * int c error type character
47 * The function err() logs the error code character
48 * suppressing duplicate errors. If the error code
49 * is 'q' then the parse of the current assembler-source
50 * text line is terminated.
53 * char * p pointer to the error array
56 * char eb[] array of generated error codes
59 * VOID longjmp() c_library
62 * The error code may be inserted into the
63 * error code array eb[] or the parse terminated.
84 longjmp(jump_env, -1);
87 /*)Function VOID diag()
89 * The function diag() prints any error codes and
90 * the source line number to the stderr output device.
93 * char * p pointer to error code array eb[]
96 * int cfile current source file index
97 * char eb[] array of generated error codes
98 * char * ep pointer into error list
99 * int incfile current include file index
100 * char incfn[] array of include file names
101 * int incline[] array of include line numbers
102 * char srcfn[] array of source file names
103 * int srcline[] array of source line numbers
104 * FILE * stderr c_library
107 * int fprintf() c_library
108 * char * geterr() assubr.c
117 register char *p,*errstr;
122 fprintf(stderr, "?ASxxxx-Error-<");
124 fprintf(stderr, "%c", *p++);
126 fprintf(stderr, "> in line ");
128 fprintf(stderr, "%d", incline[incfil]);
129 fprintf(stderr, " of %s\n", incfn[incfil]);
131 fprintf(stderr, "%d", srcline[cfile]);
132 fprintf(stderr, " of %s\n", srcfn[cfile]);
137 if ((errstr = geterr(*p++)) != NULL) {
139 /* Modified to conform to gcc error standard, M. Hope, 7 Feb 98. */
141 fprintf(stderr, "%s:", incfn[incfil]);
142 fprintf(stderr, "%d: Error:", incline[incfil]);
145 fprintf(stderr, "%s:", srcfn[cfile]);
146 fprintf(stderr, "%d: Error:", srcline[cfile]);
148 fprintf(stderr, " %s\n", errstr);
150 fprintf(stderr, " %s\n", errstr);
160 /*)Functions: VOID aerr()
164 * The functions aerr(), qerr(), and rerr() report their
165 * respective error type. These are included only for
175 * VOID err() assubr.c
178 * The appropriate error code is inserted into the
179 * error array and the parse may be terminated.
210 * ASxxxx assembler errors
213 "<.> use \". = . + <arg>\" not \". = <arg>\"",
214 "<a> machine specific addressing or addressing mode error",
215 "<b> direct page boundary error",
216 "<d> direct page addressing error",
217 "<i> .include file error or an .if/.endif mismatch",
218 "<m> multiple definitions error",
219 "<o> .org in REL area or directive / mnemonic error",
220 "<p> phase error: label location changing between passes 2 and 3",
221 "<q> missing or improper operators, terminators, or delimiters",
222 "<r> relocation error",
223 "<u> undefined symbol encountered during assembly",
227 /*)Function: char *getarr(c)
229 * int c the error code character
231 * The function geterr() scans the list of errors returning the
232 * error string corresponding to the input error character.
235 * int i error index counter
238 * char *errors[] array of pointers to the
245 * A pointer to the appropriate
246 * error code string is returned.
254 for (i=0; errors[i]!=NULL; i++) {
255 if (c == errors[i][1]) {