1 |
|
---|
2 | #include "MOperator.h"
|
---|
3 | #include "MStatement.h"
|
---|
4 | #include <string>
|
---|
5 |
|
---|
6 | using namespace std;
|
---|
7 |
|
---|
8 | MStatement::MStatement(MOperator op, const char *comment) {
|
---|
9 | MStatement::SetOperator(op);
|
---|
10 | MStatement::SetOperand1(NULL);
|
---|
11 | MStatement::SetOperand2(NULL);
|
---|
12 | MStatement::SetOperand3(NULL);
|
---|
13 | MStatement::SetComment(comment);
|
---|
14 | }
|
---|
15 |
|
---|
16 | MStatement::MStatement(MOperator op, MOperand *opnd1, const char *comment) {
|
---|
17 | MStatement::SetOperator(op);
|
---|
18 | MStatement::SetOperand1(opnd1);
|
---|
19 | MStatement::SetOperand2(NULL);
|
---|
20 | MStatement::SetOperand3(NULL);
|
---|
21 | MStatement::SetComment(comment);
|
---|
22 | }
|
---|
23 |
|
---|
24 | MStatement::MStatement(MOperator op, MOperand *opnd1, MOperand *opnd2,
|
---|
25 | const char *comment) {
|
---|
26 | MStatement::SetOperator(op);
|
---|
27 | MStatement::SetOperand1(opnd1);
|
---|
28 | MStatement::SetOperand2(opnd2);
|
---|
29 | MStatement::SetOperand3(NULL);
|
---|
30 | MStatement::SetComment(comment);
|
---|
31 | }
|
---|
32 |
|
---|
33 | MStatement::MStatement(MOperator op, MOperand *opnd1, MOperand *opnd2,
|
---|
34 | MOperand *opnd3, const char *comment) {
|
---|
35 | MStatement::SetOperator(op);
|
---|
36 | MStatement::SetOperand1(opnd1);
|
---|
37 | MStatement::SetOperand2(opnd2);
|
---|
38 | MStatement::SetOperand3(opnd3);
|
---|
39 | MStatement::SetComment(comment);
|
---|
40 | }
|
---|
41 |
|
---|
42 | MStatement::~MStatement() {
|
---|
43 | delete comment;
|
---|
44 | }
|
---|
45 |
|
---|
46 | MOperator MStatement::GetOperator() const {
|
---|
47 | return moperator;
|
---|
48 | }
|
---|
49 |
|
---|
50 | void MStatement::SetOperator(MOperator op) {
|
---|
51 | moperator = op;
|
---|
52 | }
|
---|
53 |
|
---|
54 | MOperand *MStatement::GetOperand1() const {
|
---|
55 | return operand1;
|
---|
56 | }
|
---|
57 |
|
---|
58 | void MStatement::SetOperand1(MOperand *operand) {
|
---|
59 | operand1 = operand;
|
---|
60 | }
|
---|
61 |
|
---|
62 | MOperand *MStatement::GetOperand2() const {
|
---|
63 | return operand2;
|
---|
64 | }
|
---|
65 |
|
---|
66 | void MStatement::SetOperand2(MOperand *operand) {
|
---|
67 | operand2 = operand;
|
---|
68 | }
|
---|
69 |
|
---|
70 | MOperand *MStatement::GetOperand3() const {
|
---|
71 | return operand3;
|
---|
72 | }
|
---|
73 |
|
---|
74 | void MStatement::SetOperand3(MOperand *operand) {
|
---|
75 | operand3 = operand;
|
---|
76 | }
|
---|
77 |
|
---|
78 | void MStatement::Dump(FILE *file, int indent) {
|
---|
79 | //XXX: Dump operand, operators # Comment
|
---|
80 | }
|
---|
81 |
|
---|
82 | const char *MStatement::GetComment() const {
|
---|
83 | return (comment);
|
---|
84 | }
|
---|
85 |
|
---|
86 | void MStatement::SetComment(const char *value) {
|
---|
87 | comment = value;
|
---|
88 | }
|
---|
89 |
|
---|
90 | string MStatement::GetLabel() const {
|
---|
91 | return label;
|
---|
92 | }
|
---|
93 |
|
---|
94 | void MStatement::SetLabel(string value) {
|
---|
95 | label = value;
|
---|
96 | }
|
---|