BlitzMax Extended  0.8.17
Pushing Blitz to the Max.
blitz.h
Go to the documentation of this file.
1 
31 #ifndef BLITZ_H
32 #define BLITZ_H
33 
34 #include "c/_common.h"
35 
36 #include "c/blitz_types.h"
37 #include "c/blitz_memory.h"
38 #include "c/blitz_thread.h"
39 #include "c/blitz_gc.h"
40 #include "c/blitz_ex.h"
41 #include "c/blitz_cclib.h"
42 #include "c/blitz_debug.h"
43 #include "c/blitz_module.h"
44 #include "c/blitz_incbin.h"
45 #include "c/blitz_class.h"
46 #include "c/blitz_object.h"
47 #include "c/blitz_string.h"
48 #include "c/blitz_array.h"
49 #include "c/blitz_handle.h"
50 #include "c/blitz_app.h"
51 
52 // Exceptions //
53 
55 
63 
64 BB_BEGIN_DECLS
65 
66 #ifdef BB_ENABLE_HELPER
67 
83 #define BB_ISNULL(ptr) \
84  ({ \
85  typeof (ptr) _x = (ptr); \
86  __builtin_choose_expr ( \
87  __builtin_types_compatible_p (typeof (_x), BBString*), \
88  _x == BBNULLSTRING, \
89  __builtin_choose_expr ( \
90  __builtin_types_compatible_p (typeof (_x), BBArray*) \
91  || __builtin_types_compatible_p (typeof (_x), BBByteArray*) \
92  || __builtin_types_compatible_p (typeof (_x), BBShortArray*) \
93  || __builtin_types_compatible_p (typeof (_x), BBIntArray*) \
94  || __builtin_types_compatible_p (typeof (_x), BBFloatArray*) \
95  || __builtin_types_compatible_p (typeof (_x), BBDoubleArray*) \
96  || __builtin_types_compatible_p (typeof (_x), BBStringArray*), \
97  _x == BBNULLARRAY, \
98  __builtin_choose_expr ( \
99  __builtin_types_compatible_p (typeof (_x), BBObject*), \
100  _x == BBNULLOBJECT, \
101  _x == NULL \
102  ) \
103  ) \
104  ); \
105  })
106 
116 #define BB_EQUALS(obj, rhs) \
117  ({ \
118  typeof (obj) _x = (obj); typeof (rhs) _y = (rhs); \
119  __builtin_choose_expr ( \
120  __builtin_types_compatible_p (typeof (_x), BBString*) \
121  && __builtin_types_compatible_p (typeof (_y), BBString*), \
122  bbStringEquals(_x, _y), \
123  __builtin_choose_expr ( \
124  __builtin_types_compatible_p (typeof (_x), BBArray*) \
125  && __builtin_types_compatible_p (typeof (_y), BBArray*), \
126  bbArrayEquals(_x, _y), \
127  __builtin_choose_expr ( \
128  __builtin_types_compatible_p (typeof (_x), BBObject*) \
129  && __builtin_types_compatible_p (typeof (_x), BBObject*), \
130  _x->clas->Compare(_x, _y) == 0, \
131  false \
132  ) \
133  ) \
134  ); \
135  })
136 
141 #define BB_THROW(cstring_or_obj) \
142  ({ \
143  typeof (cstring_or_obj) _x = (cstring_or_obj); \
144  __builtin_choose_expr ( \
145  __builtin_types_compatible_p (typeof (_x), const char*) \
146  || __builtin_types_compatible_p (typeof (_x), char*) \
147  || __builtin_types_compatible_p (typeof (_x), char[]), \
148  bbExThrowCString(_x), \
149  bbExThrow(_x) \
150  ); \
151  })
152 
153 #endif // BB_ENABLE_HELPER
154 
155 
156 BB_END_DECLS
157 
158 #endif // BLITZ_H