Code: Select all
typedef struct PB_ListHeader
{
struct PB_ListHeader *Next;
struct PB_ListHeader *Previous;
} PB_ListHeader;
typedef struct PB_ListPosition
{
struct PB_ListPosition *Next;
PB_ListHeader *Element;
} PB_ListPosition;
struct PB_ListObject;
typedef struct PB_List
{
PB_ListHeader *First;
PB_ListHeader *Last;
PB_ListHeader *Current; // Don't move it, as it is used internally by the compiler
PB_ListHeader **CurrentVariable;
integer NbElements;
integer Index;
integer *StructureMap;
// Every List has its private allocator, so we can call ClearAll() for a fast ClearList()
// Also this way Lists in separate threads work without a lock for allocation
PB_BlockAlloc *Allocator;
// see PushListPosition.c
PB_ListPosition *PositionStack;
struct PB_ListObject *Object;
integer ElementSize; // moved here for better alignment on 64-bit
int ElementType;
char IsIndexInvalid;
char IsDynamic;
char IsDynamicObject;
}
PB_List;
PB_ListPosition is for Push/PopListPosition()