-
Notifications
You must be signed in to change notification settings - Fork 1
/
stackval.hpp
executable file
·48 lines (44 loc) · 1.32 KB
/
stackval.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef STACKVAL_HPP
#define SATCKVAL_HPP
//#include<classlib/stacks.h>
// source of TStackAsVector<variableValue> in
//#include<\classlib\stacks.h>
#include"stackcls.hpp"
// ifdef tc3
//#define TStackAsVector BI_StackAsVector
//#include"allexe.hpp"
class variableValue ;
//class stackOfValExpr : public TStackAsVector<variableValue> {
class stackOfValExpr : public stackCls<variableValue> {
int noVInStack ;
int maxVal;
void error(char *pp1)
{cout <<"maxVal is "<<maxVal<<endl; myDebugKey(noVInStack,pp1);exitProgram(0) ; }
public :
// stackOfValExpr(void):TStackAsVector<variableValue>(20)
stackOfValExpr(void):stackCls<variableValue>(29)
{noVInStack = 0 ; maxVal = 29 ;}
void push(variableValue v1)
{
noVInStack++;
// myDebugKey(noVInStack , " stack v in push==");
if(noVInStack < maxVal)
Push(v1);
else
error(" standard stack of exprssion overflow in STACKVAL.HPP" );
}
variableValue pop(void)
{
if(noVInStack)
noVInStack -- ;
else
error("standard stack of exprssion underflow end of stack encounter in STACKVAL.HPP ");
// myDebugKey(noVInStack , " stack v in pop ==");
return Pop();
}
variableValue top(void)
{ return Top();}
void init(void)
{noVInStack=0;stackCls<variableValue>::init();}
};
#endif