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