Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00042 #ifndef _orxDECL_H_
00043 #define _orxDECL_H_
00044
00045 #ifdef __APPLE__
00046
00047 #include "TargetConditionals.h"
00048
00049 #endif
00050
00051
00052
00053
00054
00055 #if !defined(__orxPPC__) && !defined(__orxX86_64__)
00056
00057
00058 #if defined(__ppc__) || defined(PPC) || defined(__PPC) || defined(__POWERPC__)
00059
00060 #define __orxPPC__
00061
00062
00063 #elif defined(__x86_64)
00064
00065 #define __orxX86_64__
00066
00067 #endif
00068
00069 #endif
00070
00071
00072 #ifdef __orxPPC__
00073
00074 #define __orxBIG_ENDIAN__
00075 #undef __orxLITTLE_ENDIAN__
00076
00077 #else
00078
00079 #define __orxLITTLE_ENDIAN__
00080 #undef __orxBIG_ENDIAN__
00081
00082 #endif
00083
00084
00085 #if !defined(__orxGCC__) && !defined(__orxMSVC__)
00086
00087
00088 #if defined(__GNUC__)
00089
00090 #define __orxGCC__
00091
00092
00093 #elif defined(_MSC_VER)
00094
00095 #define __orxMSVC__
00096
00097 #else
00098
00099 #error "Couldn't guess compiler define. Please provide it (__orxGCC__/__orxMSVC__)"
00100
00101 #endif
00102
00103 #endif
00104
00105
00106
00107 #if !defined(__orxWINDOWS__) && !defined(__orxMAC__) && !defined(__orxLINUX__) && !defined(__orxGP2X__) && !defined(__orxWII__) && !defined(__orxIPHONE__) && !defined(__orxANDROID__) && !defined(__orxANDROID_NATIVE__)
00108
00109
00110 #if defined(_WIN32) || defined(WIN32)
00111
00112 #define __orxWINDOWS__
00113
00114
00115 #elif defined(__linux__) && defined(__arm__)
00116
00117 #define __orxGP2X__
00118
00119
00120 #elif defined(linux) || defined(__linux__)
00121
00122 #define __orxLINUX__
00123
00124
00125 #elif defined(TARGET_OS_IPHONE)
00126
00127 #define __orxIPHONE__
00128
00129
00130 #elif defined(TARGET_OS_ANDROID)
00131
00132 #define __orxANDROID__
00133
00134
00135 #elif defined(__APPLE__)
00136
00137 #define __orxMAC__
00138
00139
00140 #elif defined(__orxPPC__)
00141
00142 #define __orxWII__
00143
00144 #else
00145
00146 #error "Couldn't guess platform define. Please provide it (__orxWINDOWS__/__orxLINUX__/__orxMAC__/__orxGP2X__/__orxWII__/__orxIPHONE__/__orxANDROID__/__orxANDROID_NATIVE__)"
00147
00148 #endif
00149
00150 #endif
00151
00152
00153 #ifdef __cplusplus
00154
00155 #define orxIMPORT "C"
00156 #define __orxCPP__
00157
00158 #else
00159
00160 #define orxIMPORT
00161 #undef __orxCPP__
00162
00163 #endif
00164
00165 #ifdef __OBJC__
00166
00167 #define __orxOBJC__
00168
00169 #else
00170
00171 #undef __orxOBJC__
00172
00173 #endif
00174
00175
00176
00177 #ifdef __orxWINDOWS__
00178
00179 #ifdef __orxFREEBASIC__
00180
00181 #define orxFASTCALL __stdcall
00182
00183 #else
00184
00185 #define orxFASTCALL __fastcall
00186
00187 #endif
00188
00189 #define orxSTDCALL __stdcall
00190
00191 #define orxCDECL __cdecl
00192
00194 #define orxDLLEXPORT __declspec(dllexport)
00195
00197 #define orxDLLIMPORT __declspec(dllimport)
00198
00200 #define orxNULL (0)
00201
00202
00204 #if defined(__orxFREEBASIC__)
00205
00206 #define orxINLINE
00207
00208 #elif defined(__orxGCC__)
00209
00210 #define orxINLINE inline
00211
00212 #elif defined(__orxMSVC__)
00213
00214 #define orxINLINE __inline
00215
00216 #endif
00217
00218 #else
00219
00220
00221 #if defined(__orxLINUX__) || defined(__orxMAC__) || defined(__orxGP2X__) || defined(__orxWII__) || defined(__orxIPHONE__) || defined(__orxANDROID__) || defined(__orxANDROID_NATIVE__)
00222
00223 #if defined(__orxGP2X__) || defined(__orxPPC__) || defined(__orxX86_64__) || defined(__orxIPHONE__) || defined(__orxANDROID__) || defined(__orxANDROID_NATIVE__)
00224
00225 #define orxFASTCALL
00226
00227 #define orxSTDCALL
00228
00229 #define orxCDECL
00230
00231 #else
00232
00233 #ifdef __orxFREEBASIC__
00234
00235 #define orxFASTCALL __attribute__ ((stdcall))
00236
00237 #else
00238
00239 #define orxFASTCALL __attribute__ ((fastcall))
00240
00241 #endif
00242
00243 #define orxSTDCALL __attribute__ ((stdcall))
00244
00245 #define orxCDECL __attribute__ ((cdecl))
00246
00247 #endif
00248
00250 #define orxDLLEXPORT __attribute__ ((visibility("default")))
00251
00253 #define orxDLLIMPORT
00254
00256 #ifdef __orxFREEBASIC__
00257
00258 #define orxINLINE
00259
00260 #else
00261
00262 #define orxINLINE inline
00263
00264 #endif
00265
00267 #define orxNULL (0)
00268
00269 #if defined(__orxWII__) || defined(__orxIPHONE__) || defined(__orxANDROID__) || defined(__orxANDROID_NATIVE__)
00270
00271
00272 #define __orxEMBEDDED__
00273
00274 #endif
00275
00276 #endif
00277
00278 #endif
00279
00280
00281
00282 #if defined(__orxPLUGIN__)
00283
00284 #ifdef __orxEMBEDDED__
00285
00286 #define orxDLLAPI orxIMPORT
00287
00288 #else
00289
00290 #define orxDLLAPI orxIMPORT orxDLLIMPORT
00291
00292 #endif
00293
00294
00295 #elif defined(__orxEXTERN__)
00296
00297 #ifdef __orxSTATIC__
00298
00299 #define orxDLLAPI orxIMPORT
00300
00301 #else
00302
00303 #define orxDLLAPI orxIMPORT orxDLLIMPORT
00304
00305 #endif
00306
00307
00308 #else
00309
00310 #define orxDLLAPI orxIMPORT orxDLLEXPORT
00311
00312 #endif
00313
00314
00316 #define orxALIGN(ADDRESS, BLOCK_SIZE) (((ADDRESS) + ((BLOCK_SIZE) - 1)) & (~((BLOCK_SIZE) - 1)))
00317
00318 #define orxALIGN16(ADDRESS) orxALIGN(ADDRESS, 16)
00319 #define orxALIGN32(ADDRESS) orxALIGN(ADDRESS, 32)
00320 #define orxALIGN64(ADDRESS) orxALIGN(ADDRESS, 64)
00321
00322
00323
00324 #ifdef __orxPADDING__
00325
00326 #ifdef orxPADDING_SIZE
00327
00328 #define orxPAD(SIZE) orxU8 au8Pad[orxALIGN(SIZE, orxPADDING_SIZE) - SIZE];
00329
00330 #else
00331
00332 #define orxPAD(SIZE)
00333
00334 #warning orxPADDING_SIZE is undefined : its value should be a power of 2!
00335 #undef __orxPADDING__
00336
00337 #endif
00338
00339 #else
00340
00341 #define orxPAD(SIZE)
00342
00343 #endif
00344
00345
00351 #define orxFLAG_TEST_ALL(X, F) (((X) & (F)) == (F))
00352
00358 #define orxFLAG_TEST(X, F) (((X) & (F)) != 0)
00359
00365 #define orxFLAG_GET(X, M) ((X) & (M))
00366
00372 #define orxFLAG_SET(X, A, R) \
00373 do \
00374 { \
00375 (X) &= ~(R); \
00376 (X) |= (A); \
00377 } while(orxFALSE)
00378
00383 #define orxFLAG_SWAP(X, S) ((X) ^= (S))
00384
00385 #endif
00386