renamed another preprocessor constant
[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 //                  https://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_WINDOWS)
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 MODE_AUTO
36 #undef MODE_AUTO
37 #endif
38
39 #define TRUE                    1
40 #define FALSE                   0
41
42 #define MODE_AUTO               -1
43
44 #ifndef MIN
45 #define MIN(a, b)               ((a) < (b) ? (a) : (b))
46 #endif
47
48 #ifndef MAX
49 #define MAX(a, b)               ((a) > (b) ? (a) : (b))
50 #endif
51
52 #ifndef ABS
53 #define ABS(a)                  ((a) < 0 ? -(a) : (a))
54 #endif
55
56 #ifndef SIGN
57 #define SIGN(a)                 ((a) < 0 ? -1 : ((a) > 0 ? 1 : 0))
58 #endif
59
60 #ifndef ODD
61 #define ODD(a)                  (((a) & 1) == 1)
62 #endif
63
64 #ifndef EVEN
65 #define EVEN(a)                 (((a) & 1) == 0)
66 #endif
67
68 #define ARRAY_SIZE(array)       (sizeof(array) / sizeof(array[0]))
69
70 #define PTR_TO_INT(p)           ((int) (long) (p))
71 #define PTR_TO_UINT(p)          ((unsigned int) (unsigned long) (p))
72
73 #define INT_TO_PTR(i)           ((void *) (long) (i))
74 #define UINT_TO_PTR(u)          ((void *) (unsigned long) (u))
75
76 #define STRUCT_OFFSET(s, m)     (offsetof(s, m))
77
78
79 struct ListNode
80 {
81   char *key;
82   void *content;
83   struct ListNode *prev;
84   struct ListNode *next;
85 };
86 typedef struct ListNode ListNode;
87
88 struct DelayCounter
89 {
90   unsigned int value;
91   unsigned int count;
92 };
93 typedef struct DelayCounter DelayCounter;
94
95 #endif // TYPES_H