4 * (C) Copyright 1989-1995
13 * Extensions: P. Felber, M. Hope
20 //#if !defined(_MSC_VER)
28 * The module assubr.c contains the error
29 * processing routines.
31 * assubr.c contains the following functions:
38 * assubr.c contains the local array of *error[]
41 /*)Function VOID err(c)
43 * int c error type character
45 * The function err() logs the error code character
46 * suppressing duplicate errors. If the error code
47 * is 'q' then the parse of the current assembler-source
48 * text line is terminated.
51 * char * p pointer to the error array
54 * char eb[] array of generated error codes
57 * VOID longjmp() c_library
60 * The error code may be inserted into the
61 * error code array eb[] or the parse terminated.
82 longjmp(jump_env, -1);
85 /*)Function VOID diag()
87 * The function diag() prints any error codes and
88 * the source line number to the stderr output device.
91 * char * p pointer to error code array eb[]
94 * int cfile current source file index
95 * char eb[] array of generated error codes
96 * char * ep pointer into error list
97 * int incfile current include file index
98 * char incfn[] array of include file names
99 * int incline[] array of include line numbers
100 * char srcfn[] array of source file names
101 * int srcline[] array of source line numbers
102 * FILE * stderr c_library
105 * int fprintf() c_library
106 * char * geterr() assubr.c
115 register char *p,*errstr;
120 fprintf(stderr, "?ASxxxx-Error-<");
122 fprintf(stderr, "%c", *p++);
124 fprintf(stderr, "> in line ");
126 fprintf(stderr, "%d", incline[incfil]);
127 fprintf(stderr, " of %s\n", incfn[incfil]);
129 fprintf(stderr, "%d", srcline[cfile]);
130 fprintf(stderr, " of %s\n", srcfn[cfile]);
135 if ((errstr = geterr(*p++)) != NULL) {
137 /* Modified to conform to gcc error standard, M. Hope, 7 Feb 98. */
139 fprintf(stderr, "%s:", incfn[incfil]);
140 fprintf(stderr, "%d: Error:", incline[incfil]);
143 fprintf(stderr, "%s:", srcfn[cfile]);
144 fprintf(stderr, "%d: Error:", srcline[cfile]);
146 fprintf(stderr, " %s\n", errstr);
148 fprintf(stderr, " %s\n", errstr);
158 /*)Functions: VOID aerr()
162 * The functions aerr(), qerr(), and rerr() report their
163 * respective error type. These are included only for
173 * VOID err() assubr.c
176 * The appropriate error code is inserted into the
177 * error array and the parse may be terminated.
208 * ASxxxx assembler errors
211 "<.> use \". = . + <arg>\" not \". = <arg>\"",
212 "<a> machine specific addressing or addressing mode error",
213 "<b> direct page boundary error",
214 "<d> direct page addressing error",
215 "<i> .include file error or an .if/.endif mismatch",
216 "<m> multiple definitions error",
217 "<o> .org in REL area or directive / mnemonic error",
218 "<p> phase error: label location changing between passes 2 and 3",
219 "<q> missing or improper operators, terminators, or delimiters",
220 "<r> relocation error",
221 "<u> undefined symbol encountered during assembly",
225 /*)Function: char *getarr(c)
227 * int c the error code character
229 * The function geterr() scans the list of errors returning the
230 * error string corresponding to the input error character.
233 * int i error index counter
236 * char *errors[] array of pointers to the
243 * A pointer to the appropriate
244 * error code string is returned.
252 for (i=0; errors[i]!=NULL; i++) {
253 if (c == errors[i][1]) {