| 1 | // $Id: dstack.h,v 1.2 2003/04/14 05:51:03 mbridak Exp $ |
| 2 | // dstack.h -- Dynamic stack (DStack) declaration and function prototypes. |
| 3 | // |
| 4 | |
| 5 | #ifndef FALSE |
| 6 | #define FALSE 0 |
| 7 | #endif |
| 8 | #ifndef TRUE |
| 9 | #define TRUE 1 |
| 10 | #endif |
| 11 | |
| 12 | typedef struct |
| 13 | { |
| 14 | float value; |
| 15 | void *next, *previous; |
| 16 | } STACKVALUE; |
| 17 | |
| 18 | class DStack |
| 19 | { |
| 20 | private: |
| 21 | STACKVALUE *bottom_; |
| 22 | STACKVALUE *top_; |
| 23 | int number_items; |
| 24 | |
| 25 | public: |
| 26 | DStack(); |
| 27 | ~DStack(); |
| 28 | void clear_stack(); // erase everything |
| 29 | int push(float val); |
| 30 | int num_items(); |
| 31 | float pop(); |
| 32 | int empty(); |
| 33 | void print(); |
| 34 | }; |