summaryrefslogtreecommitdiff
path: root/command_line/C++_Parser/Src/Library/ParserErrors.c
blob: df5e67e9c1a2f1eeef79a1a97f5207baa0eedf30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include "parser.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);
}