BlitzMax Extended
0.8.18
Pushing Blitz to the Max.
Main Page
Related Pages
Data Structures
Files
File List
Globals
c
blitz_macros.h
Go to the documentation of this file.
1
8
#ifndef BLITZ_MACROS_H
9
#define BLITZ_MACROS_H
10
11
#ifdef __cplusplus
12
# define BB_BEGIN_DECLS extern "C" {
13
# define BB_END_DECLS }
14
#else
15
# define BB_BEGIN_DECLS
16
# define BB_END_DECLS
17
#endif
18
19
BB_BEGIN_DECLS
20
21
// Check OS to build for
22
30
#ifdef __linux
31
# define BB_OS_LINUX TRUE
32
#endif
33
39
#ifdef __APPLE__
40
# define BB_OS_MACOS TRUE
41
#endif
42
48
#ifdef _WIN32
49
# define BB_OS_WIN32 TRUE
50
#endif
51
52
// Check the system's CPU
53
54
#if defined (__ppc__)
55
60
# define BB_CPU_PPC TRUE
61
#endif
62
63
#if defined (__i386__) || defined (_X86_)
64
69
# define BB_CPU_X86 TRUE
70
#endif
71
72
// Check for C version
73
74
#if defined (__STDC_VERSION__)
75
76
# if __STDC_VERSION__ >= 199901L
77
# define BB_ENV_C99 TRUE
78
# endif // C99
79
80
#endif // __STDC_VERSION__
81
82
// Check for 32/64-bit environment
83
84
#if defined (__GNUC__)
85
86
# if defined (__x86_64__) || __ppc64__
87
# define BB_ENV_64BIT TRUE
88
# else
89
# define BB_ENV_32BIT TRUE
90
# endif
91
92
#elif defined (_WIN32) || defined (_WIN64)
93
94
# if defined (_WIN64)
95
# define BB_ENV_64BIT TRUE
96
# else
97
# define BB_ENV_32BIT TRUE
98
# endif
99
100
#endif // _WIN32 || _WIN64
101
102
// Double check compile-time configuration in case something went wrong
103
// on the way from blitz.bmx to GCC
104
105
#if defined (THREADED) && !defined (BB_THREADED)
106
# define BB_THREADED TRUE
107
#endif
108
109
#if !defined (NDEBUG) && !defined (BB_DEBUG)
110
# define BB_DEBUG TRUE
111
#endif
112
113
// Set compile options
114
115
// Internal helper functions and structs require GCC and C99 compilation mode.
116
#if defined (__GNUC__) && defined (BB_ENV_C99)
117
# define BB_INCLUDE_INTERNALS TRUE
118
#endif // GCC & C99
119
120
// Error checking
121
122
#if defined (BB_ENABLE_EXPERIMENTAL) && !defined (BB_ENV_C99)
123
# error "Experimental compilation mode requires C99."
124
#endif
125
126
127
// FUNCTIONAL MACROS //
128
135
#define BB_MIN(x, y) \
136
({ \
137
typeof (x) _x = (x); typeof (y) _y = (y); \
138
(_x < _y) ? _x : _y; \
139
})
140
147
#define BB_MAX(x, y) \
148
({ \
149
typeof (x) _x = (x); typeof (y) _y = (y); \
150
(_x > _y) ? _x : _y; \
151
})
152
158
#define BB_ABS(x) \
159
({ \
160
typeof (x) _x = (x); \
161
_x > 0 ? _x : -_x; \
162
})
163
164
BB_END_DECLS
165
166
#endif // BLITZ_MACROS_H
Generated on Thu Oct 11 2012 16:18:59 for BlitzMax Extended by
1.8.1.1