This commit is contained in:
Daniel Ledda
2025-11-14 10:47:11 +01:00
parent 27e7d74895
commit 221217fd18

2
core.h
View File

@@ -151,6 +151,8 @@ DefineList(string, String);
#define __ArrayAsList(array) { .data=(array), .length=ArrayCount(array), .capacity=ArrayCount(array) } #define __ArrayAsList(array) { .data=(array), .length=ArrayCount(array), .capacity=ArrayCount(array) }
#define AsList(listtype, ...) (listtype)__ArrayAsList(((listtype##_underlying[])__VA_ARGS__)) #define AsList(listtype, ...) (listtype)__ArrayAsList(((listtype##_underlying[])__VA_ARGS__))
// TODO(dledda): clone list
// TODO(dledda): list back element accessor
#define AppendList(list, element) \ #define AppendList(list, element) \
if ((list)->length < (list)->capacity) { \ if ((list)->length < (list)->capacity) { \
(list)->data[(list)->length++] = (element); \ (list)->data[(list)->length++] = (element); \