BlitzMax Extended  0.8.11
Pushing Blitz to the Max.
blitz_macros.h
Go to the documentation of this file.
00001 
00008 #ifndef BLITZ_MACROS_H
00009 #define BLITZ_MACROS_H
00010 
00011 #ifdef __cplusplus
00012 #   define BB_BEGIN_DECLS   extern "C" {
00013 #   define BB_END_DECLS     }
00014 #else
00015 #   define BB_BEGIN_DECLS
00016 #   define BB_END_DECLS
00017 #endif
00018 
00019 BB_BEGIN_DECLS
00020 
00021 //  Check OS to build for
00022 
00030 #if defined (__linux__) || defined (__linux)
00031 #   define BB_OS_LINUX      TRUE
00032 #endif
00033 
00039 #if defined (__APPLE__)
00040 #   define BB_OS_MACOS      TRUE
00041 #endif
00042 
00048 #if defined (_WIN32)
00049 #   define BB_OS_WIN32      TRUE
00050 #endif
00051 
00052 //  Check the system's CPU
00053 
00054 #if defined (__ppc__)
00055 
00060 #   define BB_CPU_PPC       TRUE
00061 #endif
00062 
00063 #if defined (__i386__) || defined (_X86_)
00064 
00069 #   define BB_CPU_X86       TRUE
00070 #endif
00071 
00072 //  Check for C version
00073 
00074 #if defined (__STDC_VERSION__)
00075 
00076 #   if __STDC_VERSION__ >= 199901L
00077 #       define BB_ENV_C99   TRUE
00078 #   endif   // C99
00079 
00080 #endif  // __STDC_VERSION__
00081 
00082 //  Check for 32/64-bit environment
00083 
00084 #if defined (__GNUC__)
00085 
00086 #   if defined (__x86_64__) || __ppc64__
00087 #       define BB_ENV_64BIT TRUE
00088 #   else
00089 #       define BB_ENV_32BIT TRUE
00090 #   endif
00091 
00092 #elif defined (_WIN32) || defined (_WIN64)
00093 
00094 #   if defined (_WIN64)
00095 #       define BB_ENV_64BIT TRUE
00096 #   else
00097 #       define BB_ENV_32BIT TRUE
00098 #   endif
00099 
00100 #endif  // _WIN32 || _WIN64
00101 
00102 //  Double-check compile-time configuration in case something went wrong
00103 //  on the way from blitz.bmx to gcc
00104 
00105 #if defined (THREADED) && !defined (BB_THREADED)
00106 #   define BB_THREADED      TRUE
00107 #endif
00108 
00109 #if !defined (NDEBUG) && !defined (BB_DEBUG)
00110 #   define BB_DEBUG         TRUE
00111 #endif
00112 
00113 //  Set compile options
00114 
00115 #if defined (__GNUC__) && defined (BB_ENV_C99)
00116 //  Helpers are various (inline) functions and macros to ease development
00117 #   define BB_ENABLE_HELPER
00118 #endif  // GCC & C99
00119 
00120 //  Error checking
00121 
00122 #if defined (BB_ENABLE_EXPERIMENTAL) && !defined (BB_ENV_C99)
00123 #   error "Experimental compilation mode requires C99."
00124 #endif
00125 
00126 //  Macros that actually do something
00127 
00128 #define BB_MIN(x, y)        ((x) < (y) ? (x) : (y))
00129 #define BB_MAX(x, y)        ((x) > (y) ? (x) : (y))
00130 #define BB_ABS(x)           ((x) > 0 ? (x) : -(x))
00131 
00132 BB_END_DECLS
00133 
00134 #endif  // BLITZ_MACROS_H