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