BlitzMax Extended  0.8.11
Pushing Blitz to the Max.
blitz.h
Go to the documentation of this file.
00001 
00031 #ifndef BLITZ_H
00032 #define BLITZ_H
00033 
00034 #include "c/blitz_types.h"
00035 #include "c/blitz_memory.h"
00036 #include "c/blitz_thread.h"
00037 #include "c/blitz_gc.h"
00038 #include "c/blitz_ex.h"
00039 #include "c/blitz_cclib.h"
00040 #include "c/blitz_debug.h"
00041 #include "c/blitz_module.h"
00042 #include "c/blitz_incbin.h"
00043 #include "c/blitz_class.h"
00044 #include "c/blitz_object.h"
00045 #include "c/blitz_string.h"
00046 #include "c/blitz_array.h"
00047 #include "c/blitz_handle.h"
00048 #include "c/blitz_app.h" 
00049 
00050 //  Exceptions
00051 
00052 #include "c/exceptions/blitz_exception.h"
00053 
00054 #include "c/exceptions/blitz_blitzexception.h"
00055 #include "c/exceptions/blitz_nullobjectexception.h"
00056 #include "c/exceptions/blitz_nullmethodexception.h"
00057 #include "c/exceptions/blitz_nullfunctionexception.h"
00058 #include "c/exceptions/blitz_arrayboundsexception.h"
00059 #include "c/exceptions/blitz_outofdataexception.h"
00060 #include "c/exceptions/blitz_runtimeexception.h"
00061 
00062 BB_BEGIN_DECLS
00063 
00064 #define BB_EXT_ZOMBIEMADE       TRUE
00065 
00066 #ifdef BB_ENABLE_HELPER
00067 
00083 #define BB_ISNULL(ptr) \
00084     ({                                                                          \
00085         typeof (ptr) _x = (ptr);                                                \
00086         __builtin_choose_expr (                                                 \
00087             __builtin_types_compatible_p (typeof (_x), BBString*),              \
00088             _x == BBNULLSTRING,                                                 \
00089             __builtin_choose_expr (                                             \
00090                 __builtin_types_compatible_p (typeof (_x), BBArray*)            \
00091                 || __builtin_types_compatible_p (typeof (_x), BBByteArray*)     \
00092                 || __builtin_types_compatible_p (typeof (_x), BBShortArray*)    \
00093                 || __builtin_types_compatible_p (typeof (_x), BBIntArray*)      \
00094                 || __builtin_types_compatible_p (typeof (_x), BBFloatArray*)    \
00095                 || __builtin_types_compatible_p (typeof (_x), BBDoubleArray*)   \
00096                 || __builtin_types_compatible_p (typeof (_x), BBStringArray*),  \
00097                 _x == BBNULLARRAY,                                              \
00098                 __builtin_choose_expr (                                         \
00099                     __builtin_types_compatible_p (typeof (_x), BBObject*),      \
00100                     _x == BBNULLOBJECT,                                         \
00101                     _x == NULL                                                  \
00102                 )                                                               \
00103             )                                                                   \
00104         );                                                                      \
00105     })
00106 
00116 #define BB_EQUALS(obj, rhs) \
00117     ({                                                                          \
00118         typeof (obj) _x = (obj); typeof (rhs) _y = (rhs);                       \
00119         __builtin_choose_expr (                                                 \
00120             __builtin_types_compatible_p (typeof (_x), BBString*)               \
00121             && __builtin_types_compatible_p (typeof (_y), BBString*),           \
00122             bbStringEquals(_x, _y),                                             \
00123             __builtin_choose_expr (                                             \
00124                 __builtin_types_compatible_p (typeof (_x), BBArray*)            \
00125                 && __builtin_types_compatible_p (typeof (_y), BBArray*),        \
00126                 bbArrayEquals(_x, _y),                                          \
00127                 __builtin_choose_expr (                                         \
00128                     __builtin_types_compatible_p (typeof (_x), BBObject*)       \
00129                     && __builtin_types_compatible_p (typeof (_x), BBObject*),   \
00130                     _x->clas->Compare(_x, _y) == 0,                             \
00131                     false                                                       \
00132                 )                                                               \
00133             )                                                                   \
00134         );                                                                      \
00135     })
00136 
00141 #define BB_THROW(cstring_or_obj) \
00142     ({                                                                          \
00143         typeof (cstring_or_obj) _x = (cstring_or_obj);                          \
00144         __builtin_choose_expr (                                                 \
00145             __builtin_types_compatible_p (typeof (_x), const char*)             \
00146             || __builtin_types_compatible_p (typeof (_x), char*)                \
00147             || __builtin_types_compatible_p (typeof (_x), char[]),              \
00148             bbExThrowCString(_x),                                               \
00149             bbExThrow(_x)                                                       \
00150         );                                                                      \
00151     })
00152 
00153 #endif  // BB_ENABLE_HELPER
00154 
00155 
00156 BB_END_DECLS
00157 
00158 #endif  // BLITZ_H