-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegest.hh
executable file
·62 lines (50 loc) · 1.53 KB
/
codegest.hh
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
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef CODEGEST_H
#define CODEGEST_H
// Data structures and functions to manage t-code.
typedef struct auxcodenode {
string codop;
vector<string> op;
auxcodenode *next;
// Used when securemode is true, and then concatenation needs linear time.
int check;
} codenode;
class codechain {
public:
codenode *first;
codenode *last;
codechain();
codechain(string s);
codechain(char *cp);
codechain(string codop,string op1);
codechain(string codop,string op1,string op2);
codechain(string codop,string op1,string op2,string op3);
};
typedef struct {
string name;
int size;
} variable_data;
typedef struct {
string name;
list<string> parameters;
list<variable_data> localvariables;
codechain c;
} codesubroutine;
typedef struct {
codesubroutine mainsub;
list<codesubroutine> l;
} codeglobal;
// The code representation tries to concatenate code chains optimally,
// but then it does not check for mistakes of the compiler like
// node-overlapping of the chains that are being concatenated.
// With securemodeon this errors are checked, but then we have linear time.
void securemodeon();
void securemodeof();
codechain operator||(codechain c1,codechain c2);
void writecodechain(codechain &c,ostream &os=cout);
void writesubroutinecontents(codesubroutine &cs,ostream &os=cout);
void writecodeglobal(codeglobal &cg,ostream &os=cout);
// Necessary to be called before any use of previous data structures
// and functions.
void initnumops();
int executecodeglobal(codeglobal &cg,int executiontime,int doitstepbystep);
#endif