File: errors.hh

package info (click to toggle)
gri 2.4.2-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,540 kB
  • ctags: 1,966
  • sloc: cpp: 32,542; lisp: 3,243; perl: 806; makefile: 548; sh: 253
file content (44 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#if !defined(_errors_hh_)

#define _errors_hh_
#if defined(VMS)
void            err(va_dcl va_alist);
void            fatal_err(va_dcl va_alist);
#else
void            err(const char *string, ...);
void            fatal_err(const char *string, ...);
#endif

void            gr_error(const char *lab); // as in gr.hh


// Error with filename and line number
#if !defined(gr_Error)
#define gr_Error(err)             \
{                                 \
    string msg;                   \
    msg.append((char*)__FILE__);  \
    msg.append(":");              \
    char num[20];                 \
    sprintf(num, "%d", __LINE__); \
    msg.append(num);              \
    msg.append(": ");             \
    msg.append((err));            \
    gr_error(msg.c_str());        \
}
#endif


#define READ_WORD_ERROR(word) {err("Can't read `\\", (word), "'", "\\");}

#define NUMBER_WORDS_ERROR {err("Wrong number of words in command");}

#define MISSING_WORD_ERROR(word) {err("Missing keyword `\\", (word), "'", "\\");}

#define NO_NEGATIVE_ERROR(word) {err("Cannot have negative value of `\\", (word), "'", "\\");}

#define NO_COLUMN_ERROR(word) {err("Column `\\", (word), "' has no data", "\\");}

#define OUT_OF_MEMORY {gr_Error("Out of storage");}

#endif				// _errors_hh_