summaryrefslogtreecommitdiff
path: root/unsorted/ParserErrors.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2022-10-14 23:15:32 +0100
committerAsh Wolf <ninji@wuffs.org>2022-10-14 23:15:32 +0100
commit775b6861666af36d317fb577cf489e2c6377f878 (patch)
tree2ae8c829eb861c85a6e2b5acf42f51919a0d78f2 /unsorted/ParserErrors.c
parentb8df05413a4e8b299de07b915cddce73a3bb16e3 (diff)
downloadMWCC-775b6861666af36d317fb577cf489e2c6377f878.tar.gz
MWCC-775b6861666af36d317fb577cf489e2c6377f878.zip
add tons of stuff
Diffstat (limited to '')
-rw-r--r--unsorted/ParserErrors.c119
1 files changed, 119 insertions, 0 deletions
diff --git a/unsorted/ParserErrors.c b/unsorted/ParserErrors.c
new file mode 100644
index 0000000..172e04c
--- /dev/null
+++ b/unsorted/ParserErrors.c
@@ -0,0 +1,119 @@
+#include "mwcc_decomp.h"
+
+static char errorbuf[1024];
+
+void CLPReportError_V(const char *format, va_list ap) {
+ vsprintf(errorbuf, format, ap);
+ CWReportMessage(parseopts.context, NULL, errorbuf, NULL, messagetypeError, 0);
+ parseopts.hadErrors = 1;
+}
+
+void CLPReportWarning_V(const char *format, va_list ap) {
+ vsprintf(errorbuf, format, ap);
+ CWReportMessage(parseopts.context, NULL, errorbuf, NULL, messagetypeWarning, 0);
+}
+
+void CLPReport_V(const char *format, va_list ap) {
+ vsprintf(errorbuf, format, ap);
+ CWReportMessage(parseopts.context, NULL, errorbuf, NULL, messagetypeInfo, 0);
+}
+
+void CLPStatus_V(const char *format, va_list ap) {
+ vsprintf(errorbuf, format, ap);
+ CWShowStatus(parseopts.context, errorbuf, NULL);
+}
+
+void CLPAlert_V(const char *format, va_list ap) {
+ vsprintf(errorbuf, format, ap);
+ CWAlert(parseopts.context, errorbuf, NULL, NULL, NULL);
+ parseopts.hadErrors = 1;
+}
+
+void CLPOSAlert_V(const char *format, SInt32 err, va_list ap) {
+ vsprintf(errorbuf, format, ap);
+ CWAlert(parseopts.context, errorbuf, "Operating system error:", OS_GetErrText(err), NULL);
+}
+
+char *CLPGetErrorString(SInt16 errid, char *buffer) {
+ getindstring(buffer, 12010, errid);
+ return buffer;
+}
+
+void CLPReportError(SInt16 errid, ...) {
+ char format[256];
+ va_list va;
+
+ CLPGetErrorString(errid, format);
+ va_start(va, errid);
+ CLPReportError_V(format, va);
+ va_end(va);
+}
+
+void CLPReportWarning(SInt16 errid, ...) {
+ char format[256];
+ va_list va;
+
+ CLPGetErrorString(errid, format);
+ va_start(va, errid);
+ CLPReportWarning_V(format, va);
+ va_end(va);
+}
+
+void CLPReport(SInt16 errid, ...) {
+ char format[256];
+ va_list va;
+
+ CLPGetErrorString(errid, format);
+ va_start(va, errid);
+ CLPReport_V(format, va);
+ va_end(va);
+}
+
+void CLPAlert(SInt16 errid, ...) {
+ char format[256];
+ va_list va;
+
+ CLPGetErrorString(errid, format);
+ va_start(va, errid);
+ CLPAlert_V(format, va);
+ va_end(va);
+}
+
+void CLPOSAlert(SInt16 errid, SInt16 err, ...) {
+ char format[256];
+ va_list va;
+
+ CLPGetErrorString(errid, format);
+ va_start(va, err);
+ CLPOSAlert_V(format, err, va);
+ va_end(va);
+}
+
+void CLPProgress(SInt16 errid, ...) {
+ char format[256];
+ va_list va;
+
+ CLPGetErrorString(errid, format);
+ va_start(va, errid);
+ CLPStatus_V(format, va);
+ va_end(va);
+}
+
+void CLPStatus(SInt16 errid, ...) {
+ char format[256];
+ va_list va;
+
+ CLPGetErrorString(errid, format);
+ va_start(va, errid);
+ CLPStatus_V(format, va);
+ va_end(va);
+}
+
+void CLPFatalError(const char *format, ...) {
+ va_list va;
+
+ va_start(va, format);
+ CLPAlert_V(format, va);
+ va_end(va);
+ longjmp(exit_plugin, -123);
+}