|
|
1.1 root 1: #ifndef lint
2: static char sccsid[] = "@(#)error.c 1.1 86/02/03 Copyr 1984 Sun Micro";
3: #endif
4:
5: /*
6: * Copyright (c) 1984 by Sun Microsystems, Inc.
7: */
8:
9: #include "as.h"
10:
11: /*
12: * routines to write error messages and warnings.
13: */
14:
15:
16: char *e_messages[] = {
17: /* 0 */ "<unused>",
18: /* 1 */ "<unused>",
19: /* 2 */ "Invalid character",
20: /* 3 */ "Multiply defined symbol",
21: /* 4 */ "Symbol storage exceeded",
22: /* 5 */ "Offset too large",
23: /* 6 */ "Symbol too long",
24: /* 7 */ "Undefined symbol",
25: /* 8 */ "Invalid constant",
26: /* 9 */ "Invalid term",
27: /* 10 */ "Invalid operator",
28: /* 11 */ "Non-relocatable expression",
29: /* 12 */ "Wrong type for instruction",
30: /* 13 */ "Invalid operand",
31: /* 14 */ "Invalid symbol",
32: /* 15 */ "Invalid assignment",
33: /* 16 */ "Too many labels",
34: /* 17 */ "Invalid op-code",
35: /* 18 */ "Invalid entry point",
36: /* 19 */ "Invalid string",
37: /* 20 */ "Multiply defined symbol (phase error)",
38: /* 21 */ "Illegal .align",
39: /* 22 */ ".Error statement",
40: /* 23 */ "<unused>",
41: /* 24 */ "<unused>",
42: /* 25 */ "Wrong number of operands",
43: /* 26 */ "Line too long",
44: /* 27 */ "Invalid register expression",
45: /* 28 */ "Invalid machine address",
46: /* 29 */ "<unused>",
47: /* 30 */ "<unused>",
48: /* 31 */ "Missing close-paren `)'",
49: /* 32 */ "<unused>",
50: /* 33 */ "<unused>",
51: /* 34 */ "<unused>",
52: /* 35 */ "<unused>",
53: /* 36 */ "<unused>",
54: /* 37 */ "<unused>",
55: /* 38 */ "<unused>",
56: /* 39 */ "<unused>",
57: /* 40 */ "<unused>",
58: /* 41 */ "Obsolete floating point syntax",
59: /* 42 */ "Bad csect",
60: /* 43 */ "Odd address",
61: /* 44 */ "Undefined L-symbol",
62: /* 45 */ "Invalid register list",
63: /* 46 */ "Unqualified forward reference",
64: 0
65: } ;
66:
67: extern char * asm_name; /* from init.c */
68:
69: /* Sys_Error is called when a System Error occurs, that is, something is wrong
70: with the assembler itself. Explanation is a string suitable for a printf
71: control string which explains the error, and Number is the value of the
72: offending parameter. This routine will not return.
73: */
74: sys_error(Explanation,Number)
75: char *Explanation;
76: {
77: fprintf(stderr, "%s: Assembler Error-- ", asm_name);
78: fprintf(stderr, Explanation,Number);
79: exit(-1);
80: }
81:
82: /* This is called whenever the assembler recognizes an error in the current
83: statement. It registers the error, so that an error code will be listed with
84: the statement, and a description of the error will be printed at the end of
85: the listing */
86:
87: prog_error(code)
88: register int code;
89: {
90: errors++; /* increment error count */
91: fprintf(stderr,"%s: error (%s:%d): %s\n",asm_name,
92: source_name[current_file], line_no,e_messages[code]);
93: }
94:
95: /* Prog_Warning registers a warning on a statement. A warning is like an error,
96: in that something is probably amiss, but the assembler will still try
97: to generate the .o file.
98: */
99:
100: prog_warning(code){
101:
102: if (pass != 2) return;
103: fprintf(stderr,"%s: warning (%s:%d): %s\n",asm_name, source_name[current_file],
104: line_no,e_messages[code]);
105: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.