-
Notifications
You must be signed in to change notification settings - Fork 1
/
stack.h
50 lines (49 loc) · 833 Bytes
/
stack.h
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
49
50
struct varble{
int ident;//will be zero
char * name;
char * type;
void* value;
};
struct function{
char * body;
int numargs;
char *type;
char *name;
};
struct sstruct{
int ident;
char * name;
char * label;
char * type;
int size;
varble **var;
};
union stack{
varble var;
sstruct st;
};
struct frame{
stack ** sstack;//array of variables/structs
int stacksize;
int maxsize;
frame * pframe;//previous frame
};
struct cstack{
function **funcs;
int funcmax ;
int funcount;
frame **fframe;
frame *curframe;
int stacksize;
int maxsize;
cstack();
void push(frame *aframe);
void pop();
frame * getframe(int i);
int find(frame * f, char * var);
int findstruct(frame * f, char * var);
void pushsstack(stack * s, frame *f);
void printframe(frame *f);
static cstack thiscstack;
int findfunc(char *func);
};