2016-09-18 21:24:54 +00:00
|
|
|
#ifndef ARRAY_H
|
|
|
|
#define ARRAY_H
|
|
|
|
|
|
|
|
#define ARRAY(TYPE, NAME) \
|
|
|
|
TYPE** NAME; \
|
|
|
|
int NAME##_count; \
|
|
|
|
int NAME##_max
|
|
|
|
|
2016-09-23 21:59:15 +00:00
|
|
|
#define STATICARRAY(TYPE, NAME) \
|
|
|
|
static TYPE** NAME; \
|
|
|
|
static int NAME##_count; \
|
|
|
|
static int NAME##_max
|
|
|
|
|
2016-09-18 21:24:54 +00:00
|
|
|
#define APPEND(ARRAY, VALUE) \
|
|
|
|
array_append((void***) &ARRAY, &ARRAY##_count, &ARRAY##_max, VALUE)
|
|
|
|
|
|
|
|
#define CONTAINS(ARRAY, VALUE) \
|
|
|
|
array_contains((void**) ARRAY, ARRAY##_count, VALUE)
|
|
|
|
|
|
|
|
#define APPENDU(ARRAY, VALUE) \
|
|
|
|
array_appendu((void***) &ARRAY, &ARRAY##_count, &ARRAY##_max, VALUE)
|
|
|
|
|
2016-09-22 21:19:29 +00:00
|
|
|
#define REMOVE(ARRAY, VALUE) \
|
|
|
|
array_remove((void**) ARRAY, &ARRAY##_count, VALUE)
|
|
|
|
|
2016-09-18 21:24:54 +00:00
|
|
|
extern void array_append(void*** array, int* count, int* max, void* value);
|
|
|
|
extern bool array_contains(void** array, int count, void* value);
|
|
|
|
extern void array_appendu(void*** array, int* count, int* max, void* value);
|
2016-09-22 21:19:29 +00:00
|
|
|
extern void array_remove(void** array, int* count, void* value);
|
2016-09-18 21:24:54 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|