/////////////////////////////////////////////////////////////////////////// // Copyright (C) 2021 Wizardry and Steamworks - License: MIT // /////////////////////////////////////////////////////////////////////////// typedef struct { void *data; unsigned int size; } stackElement; /* * The stack structure with top being the index of the next element * to be inserted in stack (the top-most element to be found at top - 1). */ typedef struct { int size; stackElement **store; int top; } stack; // Zero or one arguments for stackCreate_Internal. #define stackIsEmpty(s) (s->top == 0) #define stackSize(s) s->size #define stackCount(s) s->top extern stack* stackCreate(unsigned int size); extern stack* stackClear(stack *s); extern void stackPush(stack *s, void *e, unsigned int size); extern void *stackPop(stack *s); extern void stackDestroy(stack *s); extern void stackPrint(stack *s);