/*-------------------------------------------------------------------*/ /* stack.h (Version 6: Generic ADTs) */ /*-------------------------------------------------------------------*/ #ifndef STACK_INCLUDED #define STACK_INCLUDED typedef struct Stack *Stack_T; extern Stack_T Stack_new(int iMaxSize); /* Return a new Stack_T that is able to store iMaxSize items, each of type void*. */ extern void Stack_free(Stack_T oStack); /* Free *oStack. */ extern void Stack_push(Stack_T oStack, void *pvItem); /* Push pvItem onto oStack. */ extern void *Stack_pop(Stack_T oStack); /* Pop oStack, and return the popped item. */ extern int Stack_empty(Stack_T oStack); /* Return 1 (TRUE) iff oStack is empty. */ extern int Stack_full(Stack_T oStack); /* Return 1 (TRUE) iff oStack is full. */ /* Checked runtime errors: Call any function with a NULL Stack_T. Call Stack_new with iMaxSize <= 0. Call Stack_push with oStack full. Call Stack_pop with oStack empty. */ #endif