#ifndef STACK_DEFINED #define STACK_DEFINED /* File Stack.h. Common header file for all stack representations. Code taken in part from MCS 360 textbook (Data Structures and Program Design in C, Second Edition, by Kruse, Tondo, and Leung), pages 83-85, but modified to allow use of a common header file, and to make use of the functions in mcs360.c. */ #ifndef StackEntry #error Error: StackEntry not defined in the compile command. #endif #include "mcs360.h" /* The full definition of the structure Stack for each representation (array, linked list) will be given in the source file for that representation. The incomplete definition given here will allow us to write stack pointers. */ typedef struct Stack Stack; Stack *CreateStack( void); void DestroyStack( Stack *s); void Push( StackEntry item, Stack *s); void Pop( StackEntry *item, Stack *s); Boolean StackEmpty( const Stack *s); void ClearStack( Stack *s); int StackSize( const Stack *s); void StackTop( StackEntry *item, const Stack *s); void TraverseStack( Stack *s, void (*visit)(StackEntry item)); int freeStackMemory( Stack *s); #endif