2022-11-20 05:07:22 +00:00
|
|
|
#include "compiler/PPCError.h"
|
|
|
|
#include "compiler/CError.h"
|
|
|
|
#include "compiler/CParser.h"
|
|
|
|
#include "compiler/InlineAsm.h"
|
|
|
|
#include "cos.h"
|
|
|
|
|
|
|
|
static void PPCError_GetErrorString(char *str, short code) {
|
|
|
|
short scode;
|
|
|
|
|
|
|
|
scode = (short) code;
|
2022-12-29 12:32:55 +00:00
|
|
|
CError_ASSERT(40, scode >= 100 && scode < 212);
|
2022-11-20 05:07:22 +00:00
|
|
|
|
|
|
|
COS_GetString(str, 10001, scode - 99);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void PPCError_VAErrorMessage(int code, va_list list, Boolean flag1, Boolean flag2) {
|
|
|
|
char format[256];
|
|
|
|
PPCError_GetErrorString(format, code);
|
|
|
|
CError_ErrorMessageVA(code + 10001, format, list, flag1, flag2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PPCError_Error(int code, ...) {
|
|
|
|
va_list list;
|
|
|
|
|
|
|
|
if (trychain)
|
|
|
|
longjmp(trychain->jmpbuf, 1);
|
|
|
|
|
|
|
|
va_start(list, code);
|
|
|
|
PPCError_VAErrorMessage(code, list, 0, 0);
|
|
|
|
va_end(list);
|
|
|
|
|
|
|
|
if (in_assembler)
|
|
|
|
AssemblerError();
|
|
|
|
}
|
|
|
|
|
|
|
|
void PPCError_Warning(int code, ...) {
|
|
|
|
va_list list;
|
|
|
|
|
|
|
|
if (!trychain) {
|
|
|
|
va_start(list, code);
|
|
|
|
PPCError_VAErrorMessage(code, list, 0, 1);
|
|
|
|
va_end(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PPCError_Message(char *format, ...) {
|
|
|
|
va_list list;
|
|
|
|
|
|
|
|
if (!trychain) {
|
|
|
|
va_start(list, format);
|
|
|
|
CError_ErrorMessageVA(10213, format, list, 0, 1);
|
|
|
|
va_end(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PPCError_ErrorTerm(short code, ...) {
|
|
|
|
va_list list;
|
|
|
|
|
|
|
|
if (trychain)
|
|
|
|
longjmp(trychain->jmpbuf, 1);
|
|
|
|
|
|
|
|
va_start(list, code);
|
|
|
|
PPCError_VAErrorMessage(code, list, 1, 0);
|
|
|
|
va_end(list);
|
|
|
|
|
|
|
|
if (in_assembler)
|
|
|
|
AssemblerError();
|
|
|
|
|
|
|
|
longjmp(errorreturn, 1);
|
|
|
|
}
|