source: tags/ms_r16q2/TREEGEN/defines.c

Last change on this file was 7811, checked in by westram, 13 years ago

merge from dev [7748] [7749] [7750]

  • comments (C→C++ style)
  • fixed umlauts in TREEGEN
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 935 bytes
Line 
1#include "defines.h"
2#include <stdlib.h>
3#include <stdarg.h>
4
5#define MAXERRLEN 500
6
7void error(cstr message)
8{
9    fprintf(stderr, "Error: %s\n", message);
10    exit(1);
11}
12void warning(cstr message)
13{
14    fprintf(stderr, "Warning: %s\n", message);
15}
16void errorf(cstr format, ...)
17{
18    char    errBuf[MAXERRLEN];
19    va_list argptr;
20
21    va_start(argptr, format);
22    vsprintf(errBuf, format, argptr);
23    va_end(argptr);
24
25    error(errBuf);
26}
27void warningf(cstr format, ...)
28{
29    char    warnBuf[MAXERRLEN];
30    va_list argptr;
31
32    va_start(argptr, format);
33    vsprintf(warnBuf, format, argptr);
34    va_end(argptr);
35
36    warning(warnBuf);
37}
38void def_outOfMemory(cstr source, int lineno)
39{
40    errorf("Out of memory (in %s, #%i)", source, lineno);
41}
42void def_assert(cstr whatFailed, cstr source, int lineno, int cnt)
43{
44    errorf("Assertion (%s) failed in %s (Line: %i ; Pass: %i)\n",
45           whatFailed, source, lineno, cnt);
46}
Note: See TracBrowser for help on using the repository browser.