BlitzMax Extended  0.8.9
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 
00023 #if defined (__linux__)
00024 #   define BB_OS_LINUX      TRUE
00025 #endif
00026 
00027 #if defined (__APPLE__)
00028 #   define BB_OS_MACOS      TRUE
00029 #endif
00030 
00031 #if defined (_WIN32)
00032 #   define BB_OS_WIN32      TRUE
00033 #endif
00034 
00035 //  Check the system's CPU
00036 
00037 #if defined (__ppc__)
00038 #   define BB_CPU_PPC       TRUE
00039 #endif
00040 
00041 #if defined (__i386__) || defined (_X86_)
00042 #   define BB_CPU_X86       TRUE
00043 #endif
00044 
00045 //  Check for C version
00046 
00047 #if defined (__STDC_VERSION__)
00048 
00049 #   if __STDC_VERSION__ >= 199901L
00050 #       define BB_ENV_C99   TRUE
00051 #   endif   // C99
00052 
00053 #endif  // __STDC_VERSION__
00054 
00055 //  Check for 32/64-bit environment
00056 
00057 #if defined (__GNUC__)
00058 
00059 #   if defined (__x86_64__) || __ppc64__
00060 #       define BB_ENV_64BIT TRUE
00061 #   else
00062 #       define BB_ENV_32BIT TRUE
00063 #   endif
00064 
00065 #elif defined (_WIN32) || defined (_WIN64)
00066 
00067 #   if defined (_WIN64)
00068 #       define BB_ENV_64BIT TRUE
00069 #   else
00070 #       define BB_ENV_32BIT TRUE
00071 #   endif
00072 
00073 #endif  // _WIN32 || _WIN64
00074 
00075 //  Double-check compile-time configuration in case something went wrong
00076 //  on the way from blitz.bmx to gcc
00077 
00078 #if defined (THREADED) && !defined (BB_THREADED)
00079 #   define BB_THREADED      TRUE
00080 #endif
00081 
00082 #if !defined (NDEBUG) && !defined (BB_DEBUG)
00083 #   define BB_DEBUG         TRUE
00084 #endif
00085 
00086 //  Set compile options
00087 
00088 #if defined (__GNUC__) && defined (BB_ENV_C99)
00089 //  Helpers are various (inline) functions and macros to ease development
00090 #   define BB_ENABLE_HELPER
00091 #endif  // GCC & C99
00092 
00093 //  Error checking
00094 
00095 #if defined (BB_ENABLE_EXPERIMENTAL) && !defined (BB_ENV_C99)
00096 #   error "Experimental compilation mode requires C99."
00097 #endif
00098 
00099 //  Macros that actually do something
00100 
00101 #define BB_MIN(x, y)        ((x) < (y) ? (x) : (y))
00102 #define BB_MAX(x, y)        ((x) > (y) ? (x) : (y))
00103 #define BB_ABS(x)           ((x) > 0 ? (x) : -(x))
00104 
00105 BB_END_DECLS
00106 
00107 #endif  // BLITZ_MACROS_H