MWCC/includes/compiler/CError.h

370 lines
11 KiB
C
Raw Normal View History

2022-10-25 19:30:28 +00:00
#ifndef COMPILER_CERROR_H
#define COMPILER_CERROR_H
#include "compiler/common.h"
2022-12-29 12:32:55 +00:00
#define CError_ASSERT(line, cond) if (!(cond)) { CError_Internal(__FILE__, line); }
#define CError_FAIL(line, cond) if (cond) { CError_Internal(__FILE__, line); }
#define CError_FATAL(line) do { CError_Internal(__FILE__, line); } while (0)
2022-10-25 19:30:28 +00:00
enum {
CErrorStr100 = 100,
CErrorStr101 = 101,
CErrorStr102 = 102,
CErrorStr103 = 103,
CErrorStr104 = 104,
CErrorStr105 = 105,
CErrorStr106 = 106,
CErrorStr107 = 107,
CErrorStr108 = 108,
CErrorStr109 = 109,
CErrorStr110 = 110,
CErrorStr111 = 111,
CErrorStr112 = 112,
CErrorStr113 = 113,
CErrorStr114 = 114,
CErrorStr115 = 115,
CErrorStr116 = 116,
CErrorStr117 = 117,
CErrorStr118 = 118,
CErrorStr119 = 119,
CErrorStr120 = 120,
CErrorStr121 = 121,
CErrorStr122 = 122,
CErrorStr123 = 123,
CErrorStr124 = 124,
CErrorStr125 = 125,
CErrorStr126 = 126,
CErrorStr127 = 127,
CErrorStr128 = 128,
CErrorStr129 = 129,
CErrorStr130 = 130,
CErrorStr131 = 131,
CErrorStr132 = 132,
CErrorStr133 = 133,
CErrorStr134 = 134,
CErrorStr135 = 135,
CErrorStr136 = 136,
CErrorStr137 = 137,
CErrorStr138 = 138,
CErrorStr139 = 139,
CErrorStr140 = 140,
CErrorStr141 = 141,
CErrorStr142 = 142,
CErrorStr143 = 143,
CErrorStr144 = 144,
CErrorStr145 = 145,
CErrorStr146 = 146,
CErrorStr147 = 147,
CErrorStr148 = 148,
CErrorStr149 = 149,
CErrorStr150 = 150,
CErrorStr151 = 151,
CErrorStr152 = 152,
CErrorStr153 = 153,
CErrorStr154 = 154,
CErrorStr155 = 155,
CErrorStr156 = 156,
CErrorStr157 = 157,
CErrorStr158 = 158,
CErrorStr159 = 159,
CErrorStr160 = 160,
CErrorStr161 = 161,
CErrorStr162 = 162,
CErrorStr163 = 163,
CErrorStr164 = 164,
CErrorStr165 = 165,
CErrorStr166 = 166,
CErrorStr167 = 167,
CErrorStr168 = 168,
CErrorStr169 = 169,
CErrorStr170 = 170,
CErrorStr171 = 171,
CErrorStr172 = 172,
CErrorStr173 = 173,
CErrorStr174 = 174,
CErrorStr175 = 175,
CErrorStr176 = 176,
CErrorStr177 = 177,
CErrorStr178 = 178,
CErrorStr179 = 179,
CErrorStr180 = 180,
CErrorStr181 = 181,
CErrorStr182 = 182,
CErrorStr183 = 183,
CErrorStr184 = 184,
CErrorStr185 = 185,
CErrorStr186 = 186,
CErrorStr187 = 187,
CErrorStr188 = 188,
CErrorStr189 = 189,
CErrorStr190 = 190,
CErrorStr191 = 191,
CErrorStr192 = 192,
CErrorStr193 = 193,
CErrorStr194 = 194,
CErrorStr195 = 195,
CErrorStr196 = 196,
CErrorStr197 = 197,
CErrorStr198 = 198,
CErrorStr199 = 199,
CErrorStr200 = 200,
CErrorStr201 = 201,
CErrorStr202 = 202,
CErrorStr203 = 203,
CErrorStr204 = 204,
CErrorStr205 = 205,
CErrorStr206 = 206,
CErrorStr207 = 207,
CErrorStr208 = 208,
CErrorStr209 = 209,
CErrorStr210 = 210,
CErrorStr211 = 211,
CErrorStr212 = 212,
CErrorStr213 = 213,
CErrorStr214 = 214,
CErrorStr215 = 215,
CErrorStr216 = 216,
CErrorStr217 = 217,
CErrorStr218 = 218,
CErrorStr219 = 219,
CErrorStr220 = 220,
CErrorStr221 = 221,
CErrorStr222 = 222,
CErrorStr223 = 223,
CErrorStr224 = 224,
CErrorStr225 = 225,
CErrorStr226 = 226,
CErrorStr227 = 227,
CErrorStr228 = 228,
CErrorStr229 = 229,
CErrorStr230 = 230,
CErrorStr231 = 231,
CErrorStr232 = 232,
CErrorStr233 = 233,
CErrorStr234 = 234,
CErrorStr235 = 235,
CErrorStr236 = 236,
CErrorStr237 = 237,
CErrorStr238 = 238,
CErrorStr239 = 239,
CErrorStr240 = 240,
CErrorStr241 = 241,
CErrorStr242 = 242,
CErrorStr243 = 243,
CErrorStr244 = 244,
CErrorStr245 = 245,
CErrorStr246 = 246,
CErrorStr247 = 247,
CErrorStr248 = 248,
CErrorStr249 = 249,
CErrorStr250 = 250,
CErrorStr251 = 251,
CErrorStr252 = 252,
CErrorStr253 = 253,
CErrorStr254 = 254,
CErrorStr255 = 255,
CErrorStr256 = 256,
CErrorStr257 = 257,
CErrorStr258 = 258,
CErrorStr259 = 259,
CErrorStr260 = 260,
CErrorStr261 = 261,
CErrorStr262 = 262,
CErrorStr263 = 263,
CErrorStr264 = 264,
CErrorStr265 = 265,
CErrorStr266 = 266,
CErrorStr267 = 267,
CErrorStr268 = 268,
CErrorStr269 = 269,
CErrorStr270 = 270,
CErrorStr271 = 271,
CErrorStr272 = 272,
CErrorStr273 = 273,
CErrorStr274 = 274,
CErrorStr275 = 275,
CErrorStr276 = 276,
CErrorStr277 = 277,
CErrorStr278 = 278,
CErrorStr279 = 279,
CErrorStr280 = 280,
CErrorStr281 = 281,
CErrorStr282 = 282,
CErrorStr283 = 283,
CErrorStr284 = 284,
CErrorStr285 = 285,
CErrorStr286 = 286,
CErrorStr287 = 287,
CErrorStr288 = 288,
CErrorStr289 = 289,
CErrorStr290 = 290,
CErrorStr291 = 291,
CErrorStr292 = 292,
CErrorStr293 = 293,
CErrorStr294 = 294,
CErrorStr295 = 295,
CErrorStr296 = 296,
CErrorStr297 = 297,
CErrorStr298 = 298,
CErrorStr299 = 299,
CErrorStr300 = 300,
CErrorStr301 = 301,
CErrorStr302 = 302,
CErrorStr303 = 303,
CErrorStr304 = 304,
CErrorStr305 = 305,
CErrorStr306 = 306,
CErrorStr307 = 307,
CErrorStr308 = 308,
CErrorStr309 = 309,
CErrorStr310 = 310,
CErrorStr311 = 311,
CErrorStr312 = 312,
CErrorStr313 = 313,
CErrorStr314 = 314,
CErrorStr315 = 315,
CErrorStr316 = 316,
CErrorStr317 = 317,
CErrorStr318 = 318,
CErrorStr319 = 319,
CErrorStr320 = 320,
CErrorStr321 = 321,
CErrorStr322 = 322,
CErrorStr323 = 323,
CErrorStr324 = 324,
CErrorStr325 = 325,
CErrorStr326 = 326,
CErrorStr327 = 327,
CErrorStr328 = 328,
CErrorStr329 = 329,
CErrorStr330 = 330,
CErrorStr331 = 331,
CErrorStr332 = 332,
CErrorStr333 = 333,
CErrorStr334 = 334,
CErrorStr335 = 335,
CErrorStr336 = 336,
CErrorStr337 = 337,
CErrorStr338 = 338,
CErrorStr339 = 339,
CErrorStr340 = 340,
CErrorStr341 = 341,
CErrorStr342 = 342,
CErrorStr343 = 343,
CErrorStr344 = 344,
CErrorStr345 = 345,
CErrorStr346 = 346,
CErrorStr347 = 347,
CErrorStr348 = 348,
CErrorStr349 = 349,
CErrorStr350 = 350,
CErrorStr351 = 351,
CErrorStr352 = 352,
CErrorStr353 = 353,
CErrorStr354 = 354,
CErrorStr355 = 355,
CErrorStr356 = 356,
CErrorStr357 = 357,
CErrorStr358 = 358,
CErrorStr359 = 359,
CErrorStr360 = 360,
CErrorStr361 = 361,
CErrorStr362 = 362,
CErrorStr363 = 363,
CErrorStr364 = 364,
CErrorStr365 = 365,
CErrorStr366 = 366,
CErrorStr367 = 367,
CErrorStr368 = 368,
CErrorStr369 = 369,
CErrorStr370 = 370,
CErrorStr371 = 371,
CErrorStr372 = 372,
CErrorStr373 = 373,
CErrorStr374 = 374,
CErrorStr375 = 375,
CErrorStr376 = 376,
CErrorStr377 = 377,
CErrorStr378 = 378,
CErrorStr379 = 379,
CErrorStr380 = 380,
CErrorStr381 = 381,
CErrorStr382 = 382,
CErrorStr383 = 383,
CErrorStr384 = 384,
CErrorStr385 = 385,
CErrorStr386 = 386,
CErrorStr387 = 387,
CErrorStr388 = 388,
CErrorStr389 = 389,
CErrorStr390 = 390,
CErrorStr391 = 391,
CErrorStr392 = 392,
CErrorStrMAX = 393
};
typedef struct _CErrorBuffer {
char *start;
char *end;
UInt32 size;
UInt32 remaining;
} CErrorBuffer;
2022-11-07 03:06:21 +00:00
extern TStreamElement *cerror_locktoken;
extern char cerror_synchdata[32];
extern short cerror_synchoffset;
extern int CError_BreakPointcount;
2022-10-25 19:30:28 +00:00
extern void CError_Init();
extern void CError_SetErrorToken(TStreamElement *token);
extern void CError_SetNullErrorToken();
extern void CError_LockErrorPos(TStreamElement *token, TStreamElement **saved);
extern void CError_UnlockErrorPos(TStreamElement **saved);
extern void CError_ResetErrorSkip();
extern void CError_GetErrorString(char *buf, short code);
extern void CError_BufferInit(CErrorBuffer *eb, char *buf, SInt32 bufSize);
extern void CError_BufferGrow(CErrorBuffer *eb, SInt32 amount);
extern void CError_BufferAppendChar(CErrorBuffer *eb, char ch);
extern void CError_BufferAppendString(CErrorBuffer *eb, const char *str);
extern void CError_BufferTerminate(CErrorBuffer *eb);
extern void CError_BufferAppendQualifier(CErrorBuffer *eb, UInt32 qual);
extern void CError_BufferAppendTemplArgExpr(CErrorBuffer *eb, ENode *node);
extern void CError_BufferAppendTemplArg(CErrorBuffer *eb, TemplArg *targ);
extern void CError_BufferAppendTemplArgs(CErrorBuffer *eb, TemplArg *targs);
extern void CError_BufferAppendNameSpace(CErrorBuffer *eb, NameSpace *nspace);
extern void CError_BufferAppendPType(CErrorBuffer *eb, Type *ty);
extern void CError_BufferAppendTemplDepType(CErrorBuffer *eb, TypeTemplDep *type);
extern void CError_BufferAppendFuncArgs(CErrorBuffer *eb, TypeFunc *tfunc, Boolean isMethod);
extern void CError_BufferAppendType(CErrorBuffer *eb, Type *ty, UInt32 qual);
extern char *CError_GetTypeName(Type *ty, UInt32 qual, Boolean useGlobalHeap);
extern void CError_AppendUnqualFunctionName(CErrorBuffer *eb, NameSpace *nspace, HashNameNode *name, TypeFunc *tfunc);
extern void CError_AppendFunctionName(CErrorBuffer *eb, NameSpace *nspace, HashNameNode *name, TemplArg *templargs, TypeFunc *tfunc);
extern void CError_AppendObjectName(CErrorBuffer *eb, Object *obj);
extern void CError_AppendMethodName(CErrorBuffer *eb, ObjCMethod *meth);
extern char *CError_GetQualifiedName(NameSpace *nspace, HashNameNode *name);
extern char *CError_GetFunctionName(NameSpace *nspace, HashNameNode *name, TypeFunc *tfunc);
extern char *CError_GetObjectName(Object *obj);
extern char *CError_GetNameString(NameSpace *nspace, HashNameNode *operatorName);
extern void CError_ErrorMessage(int errTable, char *buf, Boolean flag1, Boolean flag2);
extern void CError_BufferAppendTemplateStack(CErrorBuffer *eb);
extern void CError_ErrorMessageVA(int code, const char *format, va_list list, Boolean flag1, Boolean flag2);
extern void CError_VAErrorMessage(int code, va_list list, Boolean flag1, Boolean flag2);
extern void CError_Error(int code, ...);
extern void CError_ErrorTerm(short code);
extern void CError_ErrorSkip(int code, ...);
extern void CError_ErrorFuncCall(short code, NameSpaceObjectList *args, ENodeList *argNodes);
extern void CError_OverloadedFunctionError2(Object *obj, ObjectList *olst, ENodeList *argNodes);
extern void CError_OverloadedFunctionError(Object *obj, ObjectList *olst);
extern void CError_AbstractClassError(TypeClass *tclass);
extern void CError_Warning(int code, ...);
extern void CError_BreakPoint(const char *a, const char *b);
2022-11-07 03:06:21 +00:00
extern void CError_Internal(char *filename, int line);
2022-10-25 19:30:28 +00:00
extern void CError_ExpressionTooComplex();
extern void CError_NoMem();
extern void CError_UserBreak();
extern void CError_CannotOpen();
extern void CError_QualifierCheck(UInt32 qual);
#endif