1 /*****************************************************************************/
5 /* Error handling for the ca65 macroassembler */
9 /* (C) 1998-2000 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
45 /*****************************************************************************/
47 /*****************************************************************************/
53 WARN_NONE, /* No warning */
55 WARN_SYM_NOT_REFERENCED,
56 WARN_IMPORT_NOT_REFERENCED,
57 WARN_CANNOT_TRACK_STATUS,
58 WARN_COUNT /* Warning count */
63 ERR_NONE, /* No error */
64 ERR_NOT_IMPLEMENTED, /* Command/operation not implemented */
65 ERR_CANNOT_OPEN_INCLUDE,
68 ERR_HEX_DIGIT_EXPECTED,
85 ERR_CONSTEXPR_EXPECTED,
87 ERR_ENDMACRO_EXPECTED,
88 ERR_OPTION_KEY_EXPECTED,
92 ERR_NEWLINE_IN_STRING,
94 ERR_ILLEGAL_ADDR_MODE,
95 ERR_ILLEGAL_LOCALSTART,
96 ERR_ILLEGAL_LOCAL_USE,
102 ERR_SYM_ALREADY_DEFINED,
104 ERR_SYM_ALREADY_IMPORT,
105 ERR_SYM_ALREADY_EXPORT,
106 ERR_EXPORT_UNDEFINED,
107 ERR_EXPORT_MUST_BE_CONST,
115 ERR_MACRO_PARAM_EXPECTED,
116 ERR_CIRCULAR_REFERENCE,
117 ERR_SYM_REDECL_MISMATCH,
122 ERR_SEG_ATTR_MISMATCH,
123 ERR_CPU_NOT_SUPPORTED,
124 ERR_COUNTER_UNDERFLOW,
126 ERR_COUNT /* Error count */
134 FAT_TOO_MANY_SEGMENTS,
136 FAT_CANNOT_OPEN_INPUT,
137 FAT_CANNOT_STAT_INPUT,
138 FAT_CANNOT_OPEN_OUTPUT,
139 FAT_CANNOT_WRITE_OUTPUT,
140 FAT_CANNOT_OPEN_LISTING,
141 FAT_CANNOT_WRITE_LISTING,
142 FAT_CANNOT_READ_LISTING,
144 FAT_TOO_MANY_SYMBOLS,
145 FAT_COUNT /* Fatal error count */
151 extern unsigned WarnLevel;
153 /* Messages for internal compiler errors */
154 extern const char _MsgCheckFailed [];
155 extern const char _MsgPrecondition [];
156 extern const char _MsgFail [];
159 extern unsigned ErrorCount;
160 extern unsigned WarningCount;
164 /*****************************************************************************/
166 /*****************************************************************************/
170 void Warning (unsigned WarnNum, ...);
171 /* Print warning message. */
173 void PWarning (const FilePos* Pos, unsigned WarnNum, ...);
174 /* Print warning message giving an explicit file and position. */
176 void Error (unsigned ErrNum, ...);
177 /* Print an error message */
179 void PError (const FilePos* Pos, unsigned ErrNum, ...);
180 /* Print an error message giving an explicit file and position. */
182 void ErrorSkip (unsigned ErrNum, ...);
183 /* Print an error message and skip the rest of the line */
185 void Fatal (unsigned FatNum, ...);
186 /* Print a message about a fatal error and die */
188 void Internal (const char* Format, ...);
189 /* Print a message about an internal compiler error and die. */
193 Internal (_MsgCheckFailed, #c, c, __FILE__, __LINE__)
195 #define PRECONDITION(c) \
197 Internal (_MsgPrecondition, #c, c, __FILE__, __LINE__)
200 Internal (_MsgFail, s, __FILE__, __LINE__)