|
|
|
@@ -136,17 +136,20 @@ inline function Vec4 vec4(real32 x, real32 y, real32 z, real32 w) { |
|
|
|
type* data;\ |
|
|
|
size_t length;\ |
|
|
|
size_t capacity;\ |
|
|
|
} prefix ## List |
|
|
|
} prefix ## List;\ |
|
|
|
typedef type prefix ## List ## _underlying |
|
|
|
#define ListElementSize(list) MemberSizeUnderlying(list, data) |
|
|
|
|
|
|
|
DefineList(string, String); |
|
|
|
|
|
|
|
#define PushList(arena, type, size) (type){ pushSize(arena, ListElementSize(type)*size), 0, size } |
|
|
|
#define EmptyList(type) (type){ NULL, 0, 0 } |
|
|
|
#define PushListZero(arena, type, size) (type){ pushSizeFill(arena, ListElementSize(type)*size, 0), 0, size } |
|
|
|
#define PushFullList(arena, type, size) (type){ pushSize(arena, ListElementSize(type)*size), size, size } |
|
|
|
#define PushFullListZero(arena, type, size) (type){ pushSizeFill(arena, ListElementSize(type)*size, 0), size, size } |
|
|
|
#define ArrayAsList(type, array) (type){ array, ArrayCount(array), ArrayCount(array) } |
|
|
|
|
|
|
|
#define EmptyList() { NULL, 0, 0 } |
|
|
|
#define __ArrayAsList(array) { .data=(array), .length=ArrayCount(array), .capacity=ArrayCount(array) } |
|
|
|
#define AsList(listtype, ...) (listtype)__ArrayAsList(((listtype##_underlying[])__VA_ARGS__)) |
|
|
|
|
|
|
|
#define AppendList(list, element) \ |
|
|
|
if ((list)->length < (list)->capacity) { \ |
|
|
|
|