/*--------------------------------------------------------------------*/ /* stack.h */ /* Author: Bob Dondero */ /* A generic Stack ADT interface */ /*--------------------------------------------------------------------*/ #ifndef STACK_INCLUDED #define STACK_INCLUDED typedef struct Stack *Stack_T; /* A Stack_T is a last-in-first-out collection of items. */ Stack_T Stack_new(void); /* Return a new Stack_T. */ void Stack_free(Stack_T oStack); /* Free oStack. */ void Stack_push(Stack_T oStack, const void *pvItem); /* Push pvItem onto oStack. It is a checked runtime error for oStack to be NULL. */ void *Stack_top(Stack_T oStack); /* Return the top item of oStack. It is a checked runtime error for oStack to be NULL or empty. */ void Stack_pop(Stack_T oStack); /* Pop oStack, and discard the popped item. It is a checked runtime error for oStack to be NULL or empty. */ int Stack_isEmpty(Stack_T oStack); /* Return 1 (TRUE) iff oStack is empty. It is a checked runtime error for oStack to be NULL. */ #endif