ack/mach/proto/mcg/array.h
David Given ed67d427c9 Replaced the block splicer with a trivial block eliminator (which rewrites
jumps to blocks which contain only a jump). Don't bother storing the bb graph
in the ir nodes; we can find it on demand by walking the tree instead ---
slower, but much easier to understand and more robust. Added a terrible map
library.
2016-09-23 23:59:15 +02:00

33 lines
894 B
C

#ifndef ARRAY_H
#define ARRAY_H
#define ARRAY(TYPE, NAME) \
TYPE** NAME; \
int NAME##_count; \
int NAME##_max
#define STATICARRAY(TYPE, NAME) \
static TYPE** NAME; \
static int NAME##_count; \
static int NAME##_max
#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)
#define REMOVE(ARRAY, VALUE) \
array_remove((void**) ARRAY, &ARRAY##_count, VALUE)
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);
extern void array_remove(void** array, int* count, void* value);
#endif