/*--------------------------------------------------------------------*/ /* stack.h (Version 3) */ /* Author: Bob Dondero */ /*--------------------------------------------------------------------*/ #ifndef STACK_INCLUDED #define STACK_INCLUDED typedef struct Stack *Stack_T; /* A Stack_T object is a last-in-first-out collection of doubles. */ Stack_T Stack_new(void); /* Return a new Stack_T object, or NULL if insufficient memory is available. */ void Stack_free(Stack_T oStack); /* Free oStack. */ int Stack_push(Stack_T oStack, double dItem); /* Push dItem onto oStack. Return 1 (TRUE) if successful, or 0 (FALSE) if insufficient memory is available. */ double Stack_top(Stack_T oStack); /* Return the top item of oStack. */ void Stack_pop(Stack_T oStack); /* Pop and discard the top item of oStack. */ int Stack_isEmpty(Stack_T oStack); /* Return 1 (TRUE) if oStack is empty, or 0 (FALSE) otherwise. */ #endif