#ifndef CORE_LIST_H #define CORE_LIST_H #include "core/Types.h" struct CoreListT { size_t length; size_t capacity; size_t dataSize; void* data; }; typedef struct CoreListT CoreList; void coreInitList(CoreList* l, size_t dataSize); void coreDestroyList(CoreList* l); void coreReserveListEntries(CoreList* l, size_t n); void coreAddListData(CoreList* l, const void* data); #define coreAddListType(l, type, ...) coreAddListData(l, &(type){__VA_ARGS__}) void coreAddLastListData(CoreList* l); void* coreAddEmptyListData(CoreList* l); void* coreGetListIndex(const CoreList* l, size_t index); #define coreGetTypedListIndex(l, index, type) \ (*(type*)coreGetListIndex(l, index)) void* coreGetListLast(const CoreList* l); #define coreGetTypedListLast(l, type) (*(type*)coreGetListLast(l)) void coreClearList(CoreList* l); void coreRemoveListIndexBySwap(CoreList* l, size_t index); void coreRemoveListIndex(CoreList* l, size_t index); void coreRemoveListLast(CoreList* l); void* coreGetListStart(const CoreList* l); void* coreGetListEnd(const CoreList* l); #ifdef IMPORT_CORE #define List CoreList #define initList coreInitList #define destroyList coreDestroyList #define reserveListEntries coreReserveListEntries #define addListData coreAddListData #define addListType coreAddListType #define addLastListData coreAddLastListData #define addEmptyListData coreAddEmptyListData #define getListIndex coreGetListIndex #define getTypedListIndex coreGetTypedListIndex #define getListLast coreGetListLast #define getTypedListLast coreGetTypedListLast #define clearList coreClearList #define removeListIndexBySwap coreRemoveListIndexBySwap #define removeListIndex coreRemoveListIndex #define removeListLast coreRemoveListLast #define getListStart coreGetListStart #define getListEnd coreGetListEnd #endif #endif