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