//----------------------------------------------------------------------
//  SPECIFICATION FILE (bstack.h)
//  This module exports an ADT for a stack of integer values.
//  The maximum stack depth is MAX_DEPTH.
//  Stacks are defined as sequences where the front of the sequence
//  is the top of the stack.
//----------------------------------------------------------------------
#include "bool.h"

// DOMAIN: An IntStack instance is a collection of integer values

const int MAX_DEPTH = 200;

class IntStack {
public:
    Boolean IsEmpty() const;
        // POST: FCTVAL == (Length(stack) == 0)

    Boolean IsFull() const;
        // POST: FCTVAL == (Length(stack) == MAX_DEPTH)

    void Push( /* in */ int newItem );
        // PRE:  Length(stack) < MAX_DEPTH  &&  Assigned(newItem)
        // POST: stack == AppendFront(stack<entry>,newItem)

    int Top() const;
        // PRE:  Length(stack) >= 1
        // POST: FCTVAL == Front(stack)

    void Pop();
        // PRE:  Length(stack) >= 1
        // POST: stack == RemoveFront(stack<entry>)

    IntStack();
        // Constructor
        // POST: Created(stack)  &&  stack == <>
private:
    int data[MAX_DEPTH];
    int top;
};

