MWCC/CError.h

64 lines
3.3 KiB
C

#include "CompilerTools.h"
#pragma once
#define CError_ASSERT(cond) if (!(cond)) { CError_Internal(__FILE__, __LINE__); }
#define CError_FAIL(cond) if (cond) { CError_Internal(__FILE__, __LINE__); }
typedef struct _CErrorBuffer {
char *start;
char *end;
unsigned long size;
unsigned long remaining;
} CErrorBuffer;
extern void CError_Init();
extern void CError_SetErrorToken(Token *token);
extern void CError_SetNullErrorToken();
extern void CError_LockErrorPos(Token *token, Token **saved);
extern void CError_UnlockErrorPos(Token **saved);
extern void CError_ResetErrorSkip();
extern void CError_GetErrorString(char *buf, short code);
extern void CError_BufferInit(CErrorBuffer *eb, char *buf, long bufSize);
extern void CError_BufferGrow(CErrorBuffer *eb, long amount);
extern void CError_BufferAppendChar(CErrorBuffer *eb, char ch);
extern void CError_BufferAppendString(CErrorBuffer *eb, const char *str);
extern void CError_BufferTerminate(CErrorBuffer *eb);
// FIX LOTS OF THESE
extern void CError_BufferAppendQualifier(CErrorBuffer *eb, int quals);
extern void CError_BufferAppendTemplArgExpr(CErrorBuffer *eb, void *targExpr);
extern void CError_BufferAppendTemplArg(CErrorBuffer *eb, void *targ);
extern void CError_BufferAppendTemplArgs(CErrorBuffer *eb, void *targs);
extern void CError_BufferAppendNameSpace(CErrorBuffer *eb, void *ns);
extern void CError_BufferAppendPType(CErrorBuffer *eb, void *ty);
extern void CError_BufferAppendTemplDepType(CErrorBuffer *eb, void *ty);
extern void CError_BufferAppendFuncArgs(CErrorBuffer *eb, void *args, unsigned char flag);
extern void CError_BufferAppendType(CErrorBuffer *eb, void *ty, int quals);
extern char *CError_GetTypeName(void *ty, int quals, unsigned char useGlobalHeap);
extern void CError_AppendUnqualFunctionName(CErrorBuffer *eb, void *unk1, void *unk2, void *unk3);
extern void CError_AppendFunctionName(CErrorBuffer *eb, void *unk1, void *unk2, void *unk3, void *unk4);
extern void CError_AppendObjectName(CErrorBuffer *eb, void *obj);
extern void CError_AppendMethodName(CErrorBuffer *eb, void *obj);
extern char *CError_GetQualifiedName(void *ns, StringNode *name);
extern char *CError_GetFunctionName(void *a, void *b, void *c);
extern char *CError_GetObjectName(void *obj);
extern char *CError_GetNameString(void *obj, StringNode *operatorName);
extern void CError_ErrorMessage(int errTable, char *buf, unsigned char flag1, unsigned char flag2);
extern void CError_BufferAppendTemplateStack(CErrorBuffer *eb);
extern void CError_ErrorMessageVA(short code, char *buf, va_list list, unsigned char flag1, unsigned char flag2);
extern void CError_VAErrorMessage(short code, va_list list, unsigned char flag1, unsigned char flag2);
extern void CError_Error(short code, ...);
extern void CError_ErrorTerm(short code);
extern void CError_ErrorSkip(short code, ...);
extern void CError_ErrorFuncCall(short code, void *aa, void *bb);
extern void CError_OverloadedFunctionError2(void *aa, void *bb, void *cc);
extern void CError_OverloadedFunctionError(void *aa, void *bb);
extern void CError_AbstractClassError();
extern void CError_Warning(short code, ...);
extern void CError_BreakPoint(const char *a, const char *b);
extern void CError_Internal();
extern void CError_ExpressionTooComplex();
extern void CError_NoMem();
extern void CError_UserBreak();
extern void CError_CannotOpen();
extern void CError_QualifierCheck(int quals);