erroneously checked in
[codemux.git] / appdef.h
1 #ifndef _APPDEF_H_
2 #define _APPDEF_H_
3
4 /* useful definitions */
5 #ifndef TRUE
6 #define TRUE 1
7 #endif
8
9 #ifndef FALSE
10 #define FALSE 0
11 #endif
12
13 #ifndef SUCCESS
14 #define SUCCESS 0
15 #endif
16
17 #ifndef FAILURE
18 #define FAILURE (-1)
19 #endif
20
21 #ifndef INT_MAX
22 #ifdef MAX_INT
23 #define INT_MAX MAXINT
24 #endif
25 #endif
26
27 #ifndef MAX
28 #define MAX(x, y) ((x) > (y) ? (x) : (y))
29 #endif
30
31 #ifndef MIN
32 #define MIN(x, y) ((x) < (y) ? (x) : (y))
33 #endif
34
35 #ifndef NELEMS
36 #define NELEMS(x) (sizeof(x)/sizeof(x[0]))
37 #endif
38
39 #ifndef SKIP_CHARS
40 #define SKIP_CHARS(x)  while(!isspace((int)*x)) (x)++
41 #endif
42
43 #ifndef SKIP_SPACES
44 #define SKIP_SPACES(x) while (isspace((int)*x)) (x)++ 
45 #endif
46
47 #ifndef SKIP_WORD
48 #define SKIP_WORD(x)   do { SKIP_SPACES(x); \
49                             SKIP_CHARS(x);  \
50                             SKIP_SPACES(x);} while(0)
51 #endif
52
53 #endif //_APPDEF_H_