4 * (C) Copyright 1989-1995
20 * The module assubr.c contains the error
21 * processing routines.
23 * assubr.c contains the following functions:
30 * assubr.c contains the local array of *error[]
33 /*)Function VOID err(c)
35 * int c error type character
37 * The function err() logs the error code character
38 * suppressing duplicate errors. If the error code
39 * is 'q' then the parse of the current assembler-source
40 * text line is terminated.
43 * char * p pointer to the error array
46 * char eb[] array of generated error codes
49 * VOID longjmp() c_library
52 * The error code may be inserted into the
53 * error code array eb[] or the parse terminated.
72 longjmp(jump_env, -1);
75 /*)Function VOID diag()
77 * The function diag() prints any error codes and
78 * the source line number to the stderr output device.
81 * char * p pointer to error code array eb[]
84 * int cfile current source file index
85 * char eb[] array of generated error codes
86 * char * ep pointer into error list
87 * int incfile current include file index
88 * char incfn[] array of include file names
89 * int incline[] array of include line numbers
90 * char srcfn[] array of source file names
91 * int srcline[] array of source line numbers
92 * FILE * stderr c_library
95 * int fprintf() c_library
96 * char * geterr() assubr.c
105 register char *p,*errstr;
109 fprintf(stderr, "?ASxxxx-Error-<");
111 fprintf(stderr, "%c", *p++);
113 fprintf(stderr, "> in line ");
115 fprintf(stderr, "%d", incline[incfil]);
116 fprintf(stderr, " of %s\n", incfn[incfil]);
118 fprintf(stderr, "%d", srcline[cfile]);
119 fprintf(stderr, " of %s\n", srcfn[cfile]);
123 if ((errstr = geterr(*p++)) != NULL) {
124 fprintf(stderr, " %s\n", errstr);
130 /*)Functions: VOID aerr()
134 * The functions aerr(), qerr(), and rerr() report their
135 * respective error type. These are included only for
145 * VOID err() assubr.c
148 * The appropriate error code is inserted into the
149 * error array and the parse may be terminated.
180 * ASxxxx assembler errors
183 "<.> use \". = . + <arg>\" not \". = <arg>\"",
184 "<a> machine specific addressing or addressing mode error",
185 "<b> direct page boundary error",
186 "<d> direct page addressing error",
187 "<i> .include file error or an .if/.endif mismatch",
188 "<m> multiple definitions error",
189 "<o> .org in REL area or directive / mnemonic error",
190 "<p> phase error: label location changing between passes 2 and 3",
191 "<q> missing or improper operators, terminators, or delimiters",
192 "<r> relocation error",
193 "<u> undefined symbol encountered during assembly",
197 /*)Function: char *getarr(c)
199 * int c the error code character
201 * The function geterr() scans the list of errors returning the
202 * error string corresponding to the input error character.
205 * int i error index counter
208 * char *errors[] array of pointers to the
215 * A pointer to the appropriate
216 * error code string is returned.
224 for (i=0; errors[i]!=NULL; i++) {
225 if (c == errors[i][1]) {