-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariables.h
More file actions
71 lines (59 loc) · 1.47 KB
/
Variables.h
File metadata and controls
71 lines (59 loc) · 1.47 KB
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
63
64
65
66
67
68
69
70
71
// implement variables using a c++ map of the variable number and a pointer to the variable structure
// this will allow for a dynamically allocated number of variables
// 2010-12-13 j.m.reneau
#pragma once
#include "Error.h"
#include "DataElement.h"
#define MAX_RECURSE_LEVELS 1048576
class Variable
{
public:
Variable();
~Variable();
DataElement *data;
};
class Variables: public QObject
{
Q_OBJECT;
public:
Variables(int);
~Variables();
//
QString debug();
void increaserecurse();
void decreaserecurse();
int getrecurse();
//
int type(int);
//
Variable* get(int, int);
Variable* get(int);
Variable* getAt(int, int);
Variable* getAt(int);
DataElement *getData(int);
void setData(int, DataElement *);
void setData(int, long);
void setData(int, double);
void setData(int, QString);
void setData(int, std::string);
void unassign(int);
//
void makeglobal(int);
static int getError() {
return getError(false);
}
static int getError(int clear) {
int olde = e;
if (clear) e = ERROR_NONE;
return olde;
}
private:
int real_varnum; // set by get and getAt for the actual variable number and level returned (deref/global)
int real_level;
int numsyms; // size of the symbol table
int recurselevel;
std::vector<Variable**> varmap;
bool *isglobal;
void clearvariable(Variable *);
static int e; // error number thrown - will be 0 if no error
};