1 | #include "defines.h" |
---|
2 | |
---|
3 | #ifndef __STDLIB_H |
---|
4 | #include <stdlib.h> |
---|
5 | #endif |
---|
6 | #ifndef __STDARG_H |
---|
7 | #include <stdarg.h> |
---|
8 | #endif |
---|
9 | |
---|
10 | #define MAXERRLEN 500 |
---|
11 | |
---|
12 | /* -------------------------------------------------------------------------- */ |
---|
13 | /* void error(cstr message) */ |
---|
14 | /* ------------------------------------------------------ 14.05.95 16:47 ---- */ |
---|
15 | void error(cstr message) |
---|
16 | { |
---|
17 | fprintf(stderr, "Fehler: %s\n", message); |
---|
18 | exit(1); |
---|
19 | } |
---|
20 | /* -------------------------------------------------------------------------- */ |
---|
21 | /* void warning(cstr message) */ |
---|
22 | /* ------------------------------------------------------ 18.05.95 11.41 ---- */ |
---|
23 | void warning(cstr message) |
---|
24 | { |
---|
25 | fprintf(stderr, "Warnung: %s\n", message); |
---|
26 | } |
---|
27 | /* -------------------------------------------------------------------------- */ |
---|
28 | /* void errorf(cstr format, ...) */ |
---|
29 | /* ------------------------------------------------------ 18.05.95 11.08 ---- */ |
---|
30 | void errorf(cstr format, ...) |
---|
31 | { |
---|
32 | char errBuf[MAXERRLEN]; |
---|
33 | va_list argptr; |
---|
34 | |
---|
35 | va_start(argptr, format); |
---|
36 | vsprintf(errBuf, format, argptr); |
---|
37 | va_end(argptr); |
---|
38 | |
---|
39 | error(errBuf); |
---|
40 | } |
---|
41 | /* -------------------------------------------------------------------------- */ |
---|
42 | /* void warningf(cstr format, ...) */ |
---|
43 | /* ------------------------------------------------------ 18.05.95 11.08 ---- */ |
---|
44 | void warningf(cstr format, ...) |
---|
45 | { |
---|
46 | char warnBuf[MAXERRLEN]; |
---|
47 | va_list argptr; |
---|
48 | |
---|
49 | va_start(argptr, format); |
---|
50 | vsprintf(warnBuf, format, argptr); |
---|
51 | va_end(argptr); |
---|
52 | |
---|
53 | warning(warnBuf); |
---|
54 | } |
---|
55 | /* -------------------------------------------------------------------------- */ |
---|
56 | /* void def_outOfMemory(cstr source, int lineno) */ |
---|
57 | /* ------------------------------------------------------ 14.05.95 16:47 ---- */ |
---|
58 | void def_outOfMemory(cstr source, int lineno) |
---|
59 | { |
---|
60 | errorf("Out of memory (in %s, #%i)", source, lineno); |
---|
61 | } |
---|
62 | /* -------------------------------------------------------------------------- */ |
---|
63 | /* void def_assert(cstr whatFailed, cstr source, int lineno, int cnt) */ |
---|
64 | /* ------------------------------------------------------ 17.05.95 22.30 ---- */ |
---|
65 | void def_assert(cstr whatFailed, cstr source, int lineno, int cnt) |
---|
66 | { |
---|
67 | errorf("Assertion (%s) failed in %s (Line: %i ; Pass: %i)\n", |
---|
68 | whatFailed, source, lineno, cnt); |
---|
69 | } |
---|