source: tags/arb_5.5/TREEGEN/defines.c

Last change on this file was 4043, checked in by westram, 18 years ago
  • includes fixed (make depends had problems with)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
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 ---- */
10void 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 ---- */
18void warning(cstr message)
19{
20    fprintf(stderr, "Warning: %s\n", message);
21}
22/* -------------------------------------------------------------------------- */
23/*      void errorf(cstr format, ...) */
24/* ------------------------------------------------------ 18.05.95 11.08 ---- */
25void 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 ---- */
39void 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 ---- */
53void 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 ---- */
60void 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}
Note: See TracBrowser for help on using the repository browser.