4 #define ArrayDef(name, type) \
5 struct Array ## name { \
9 typedef struct Array ## name Array ## name; \
10 static inline Array ## name * allocArray ## name(uint size) { \
11 Array ## name * tmp = (Array ## name *)ourmalloc(sizeof(type)); \
13 tmp->array = (type *) ourcalloc(1, sizeof(type) * size); \
16 static inline Array ## name * allocArrayInit ## name(type * array, uint size) { \
17 Array ## name * tmp = allocArray ## name(size); \
18 memcpy(tmp->array, array, size * sizeof(type)); \
21 static inline type getArray ## name(Array ## name * This, uint index) { \
22 return This->array[index]; \
24 static inline void setArray ## name(Array ## name * This, uint index, type item) { \
25 This->array[index]=item; \
27 static inline uint getSizeArray ## name(Array ## name *This) { \
30 static inline void deleteArray ## name(Array ## name *This) { \
31 ourfree(This->array); \
34 static inline type * exposeCArray ## name(Array ## name * This) { \
37 static inline void deleteInlineArray ## name(Array ## name *This) { \
38 ourfree(This->array); \
40 static inline void allocInlineArray ## name(Array ## name * This, uint size) { \
42 This->array = (type *) ourcalloc(1, sizeof(type) * size); \
44 static inline void allocInlineArrayInit ## name(Array ## name * This, type *array, uint size) { \
45 allocInlineArray ##name(This, size); \
46 memcpy(This->array, array, size * sizeof(type)); \