6e55364cb9ddd40945865a5eda9cbd262324c8ac
[rocksndiamonds.git] / src / libgame / types.h
1 /***********************************************************
2 * Artsoft Retro-Game Library                               *
3 *----------------------------------------------------------*
4 * (c) 1994-2006 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * types.h                                                  *
12 ***********************************************************/
13
14 #ifndef TYPES_H
15 #define TYPES_H
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <stdarg.h>
20 #include <string.h>
21 #include <sys/types.h>
22
23 typedef int boolean;
24
25 #if !defined(PLATFORM_WIN32)
26 typedef unsigned char byte;
27 #endif
28
29 #ifdef TRUE
30 #undef TRUE
31 #endif
32
33 #ifdef FALSE
34 #undef FALSE
35 #endif
36
37 #ifdef AUTO
38 #undef AUTO
39 #endif
40
41 #define TRUE            1
42 #define FALSE           0
43 #define AUTO            -1
44
45 #ifndef MIN
46 #define MIN(a,b)        ((a) < (b) ? (a) : (b))
47 #endif
48
49 #ifndef MAX
50 #define MAX(a,b)        ((a) > (b) ? (a) : (b))
51 #endif
52
53 #ifndef ABS
54 #define ABS(a)          ((a) < 0 ? -(a) : (a))
55 #endif
56
57 #ifndef SIGN
58 #define SIGN(a)         ((a) < 0 ? -1 : ((a) > 0 ? 1 : 0))
59 #endif
60
61 #ifndef ODD
62 #define ODD(a)          (((a) & 1) == 1)
63 #endif
64
65 #ifndef EVEN
66 #define EVEN(a)         (((a) & 1) == 0)
67 #endif
68
69 #define SIZEOF_ARRAY(array, type)       (sizeof(array) / sizeof(type))
70 #define SIZEOF_ARRAY_INT(array)         SIZEOF_ARRAY(array, int)
71
72
73 struct ListNode
74 {
75   char *key;
76   void *content;
77   struct ListNode *next;
78 };
79 typedef struct ListNode ListNode;
80
81 #endif /* TYPES_H */