0
|
1 /* ----------------------------------------------------------------------------
|
|
2 * File : defs.h
|
|
3 * Purpose : general defines for dynamic tree program
|
|
4 * ----------------------------------------------------------------------------
|
|
5 */
|
|
6
|
|
7 #include <stdio.h>
|
|
8
|
|
9 #define ASSERT(x, msg) \
|
|
10 if ((x) == NULL) { fprintf(stderr, "%s: %s\n", ProgramName, msg); exit(0); }
|
|
11
|
|
12 #define NASSERT(x, msg) \
|
|
13 if ((x) == NULL) { fprintf(stderr, "%s: %s\n", ProgramName, msg); \
|
|
14 return (NULL); }
|
|
15
|
|
16 #define WARN(msg) \
|
|
17 fprintf(stderr, "%s: %s\n", ProgramName, msg)
|
|
18
|
|
19 #define WARN_1(msg, arg1) \
|
|
20 fprintf(stderr, "%s: %s %s", ProgramName, msg, arg1)
|
|
21
|
|
22 #define WARN_4(msg1, arg1, msg2, arg2) \
|
|
23 fprintf(stderr, "%s: %s %s; %s %s\n", ProgramName, msg1, arg1, msg2, arg2)
|
|
24
|
|
25 #ifdef GLOBALS
|
|
26 #define Global
|
|
27 #else
|
|
28 #define Global extern
|
|
29 #endif
|
|
30
|
|
31 Global char *ProgramName;
|
|
32
|
|
33 #undef Global
|
|
34 #undef GLOBALS
|
|
35
|
|
36 #ifndef TRUE
|
|
37 #define TRUE 1
|
|
38 #endif
|
|
39
|
|
40 #ifndef FALSE
|
|
41 #define FALSE 0
|
|
42 #endif
|
|
43
|
|
44 #ifndef NULL
|
|
45 #define NULL 0L
|
|
46 #endif
|
|
47
|
|
48 #ifndef MAX
|
|
49 #define MAX(x, y) ((x) < (y)) ? (y) : (x)
|
|
50 #endif
|