ARB
defines.c
Go to the documentation of this file.
1 #include "defines.h"
2 #include <stdlib.h>
3 #include <stdarg.h>
4 
5 #define MAXERRLEN 500
6 
7 void error(cstr message) {
8  fprintf(stderr, "Error: %s\n", message);
9  exit(1);
10 }
12  fprintf(stderr, "Warning: %s\n", message);
13 }
14 void errorf(cstr format, ...) {
15  char errBuf[MAXERRLEN];
16  va_list argptr;
17 
18  va_start(argptr, format);
19  vsprintf(errBuf, format, argptr);
20  va_end(argptr);
21 
22  error(errBuf);
23 }
24 void warningf(cstr format, ...) {
25  char warnBuf[MAXERRLEN];
26  va_list argptr;
27 
28  va_start(argptr, format);
29  vsprintf(warnBuf, format, argptr);
30  va_end(argptr);
31 
32  warning(warnBuf);
33 }
34 void def_outOfMemory(cstr source, int lineno) {
35  errorf("Out of memory (in %s, #%i)", source, lineno);
36 }
37 void def_assert(cstr whatFailed, cstr source, int lineno, int cnt) {
38  errorf("Assertion (%s) failed in %s (Line: %i ; Pass: %i)\n",
39  whatFailed, source, lineno, cnt);
40 }
AliDataPtr format(AliDataPtr data, const size_t wanted_len, GB_ERROR &error)
Definition: insdel.cxx:615
void warningf(cstr format,...)
Definition: defines.c:24
void errorf(cstr format,...)
Definition: defines.c:14
void message(char *errortext)
void error(cstr message)
Definition: defines.c:7
va_end(argPtr)
void def_outOfMemory(cstr source, int lineno)
Definition: defines.c:34
va_start(argPtr, format)
void def_assert(cstr whatFailed, cstr source, int lineno, int cnt)
Definition: defines.c:37
const char * cstr
Definition: defines.h:21
#define MAXERRLEN
Definition: defines.c:5
void warning(cstr message)
Definition: defines.c:11