58 |
}; |
}; |
59 |
typedef Ref<Expression,Node> ExpressionRef; |
typedef Ref<Expression,Node> ExpressionRef; |
60 |
|
|
61 |
class IntExpr : virtual public VMIntExpr, virtual public Expression { |
class Unit : virtual public VMUnit, virtual public Node { |
62 |
|
ArrayList<MetricPrefix_t> prefix; |
63 |
|
StdUnit_t unit; |
64 |
|
public: |
65 |
|
Unit() : unit(VM_NO_UNIT) {} |
66 |
|
MetricPrefix_t unitPrefix(vmuint i) const OVERRIDE; |
67 |
|
StdUnit_t unitType() const OVERRIDE { return unit; } |
68 |
|
void setUnit(const std::vector<MetricPrefix_t>& prefix, StdUnit_t type); |
69 |
|
void setUnit(const MetricPrefix_t* prefixes, StdUnit_t type); |
70 |
|
void copyUnitFrom(const Ref<Unit,Node>& src); |
71 |
|
}; |
72 |
|
typedef Ref<Unit,Node> UnitRef; |
73 |
|
|
74 |
|
class ScalarNumberExpr : virtual public Unit, virtual public VMScalarNumberExpr, virtual public Expression { |
75 |
|
public: |
76 |
|
}; |
77 |
|
typedef Ref<ScalarNumberExpr,Node> ScalarNumberExprRef; |
78 |
|
|
79 |
|
class IntExpr : virtual public ScalarNumberExpr, virtual public VMIntExpr { |
80 |
public: |
public: |
81 |
ExprType_t exprType() const OVERRIDE { return INT_EXPR; } |
ExprType_t exprType() const OVERRIDE { return INT_EXPR; } |
82 |
String evalCastToStr() OVERRIDE; |
String evalCastToStr() OVERRIDE; |
83 |
}; |
}; |
84 |
typedef Ref<IntExpr,Node> IntExprRef; |
typedef Ref<IntExpr,Node> IntExprRef; |
85 |
|
|
86 |
class IntArrayExpr : virtual public VMIntArrayExpr, virtual public Expression { |
class RealExpr : virtual public ScalarNumberExpr, virtual public VMRealExpr { |
87 |
|
public: |
88 |
|
ExprType_t exprType() const OVERRIDE { return REAL_EXPR; } |
89 |
|
String evalCastToStr() OVERRIDE; |
90 |
|
}; |
91 |
|
typedef Ref<RealExpr,Node> RealExprRef; |
92 |
|
|
93 |
|
class ArrayExpr : virtual public VMArrayExpr, virtual public Expression { |
94 |
|
public: |
95 |
|
}; |
96 |
|
typedef Ref<ArrayExpr,Node> ArrayExprRef; |
97 |
|
|
98 |
|
class IntArrayExpr : virtual public VMIntArrayExpr, virtual public ArrayExpr { |
99 |
public: |
public: |
100 |
ExprType_t exprType() const OVERRIDE { return INT_ARR_EXPR; } |
ExprType_t exprType() const OVERRIDE { return INT_ARR_EXPR; } |
101 |
String evalCastToStr() OVERRIDE; |
String evalCastToStr() OVERRIDE; |
102 |
}; |
}; |
103 |
typedef Ref<IntArrayExpr,Node> IntArrayExprRef; |
typedef Ref<IntArrayExpr,Node> IntArrayExprRef; |
104 |
|
|
105 |
|
class RealArrayExpr : virtual public VMRealArrayExpr, virtual public ArrayExpr { |
106 |
|
public: |
107 |
|
ExprType_t exprType() const OVERRIDE { return REAL_ARR_EXPR; } |
108 |
|
String evalCastToStr() OVERRIDE; |
109 |
|
}; |
110 |
|
typedef Ref<RealArrayExpr,Node> RealArrayExprRef; |
111 |
|
|
112 |
class StringExpr : virtual public VMStringExpr, virtual public Expression { |
class StringExpr : virtual public VMStringExpr, virtual public Expression { |
113 |
public: |
public: |
114 |
ExprType_t exprType() const OVERRIDE { return STRING_EXPR; } |
ExprType_t exprType() const OVERRIDE { return STRING_EXPR; } |
116 |
}; |
}; |
117 |
typedef Ref<StringExpr,Node> StringExprRef; |
typedef Ref<StringExpr,Node> StringExprRef; |
118 |
|
|
119 |
class Unit : virtual public VMUnit { |
class IntLiteral : public IntExpr { |
|
ArrayList<MetricPrefix_t> prefix; |
|
|
StdUnit_t unit; |
|
|
public: |
|
|
Unit() : unit(VM_NO_UNIT) {} |
|
|
MetricPrefix_t unitPrefix(vmuint i) const OVERRIDE; |
|
|
StdUnit_t unitType() const OVERRIDE { return unit; } |
|
|
void setUnit(const std::vector<MetricPrefix_t>& prefix, StdUnit_t type); |
|
|
void setUnit(const MetricPrefix_t* prefixes, StdUnit_t type); |
|
|
void copyUnitFrom(const IntExprRef& src); |
|
|
}; |
|
|
|
|
|
class IntLiteral : public Unit, virtual public IntExpr { |
|
120 |
bool finalVal; |
bool finalVal; |
121 |
public: |
public: |
122 |
vmint value; |
vmint value; |
123 |
IntLiteral(vmint value) : Unit(), |
IntLiteral(vmint value) : IntExpr(), |
124 |
value(value), finalVal(false) { } |
value(value), finalVal(false) { } |
125 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
126 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
131 |
}; |
}; |
132 |
typedef Ref<IntLiteral,Node> IntLiteralRef; |
typedef Ref<IntLiteral,Node> IntLiteralRef; |
133 |
|
|
134 |
|
class RealLiteral : public RealExpr { |
135 |
|
vmfloat value; |
136 |
|
bool finalVal; |
137 |
|
public: |
138 |
|
RealLiteral(vmfloat value) : RealExpr(), |
139 |
|
value(value), finalVal(false) { } |
140 |
|
vmfloat evalReal() OVERRIDE; |
141 |
|
void dump(int level = 0) OVERRIDE; |
142 |
|
bool isConstExpr() const OVERRIDE { return true; } |
143 |
|
bool isPolyphonic() const OVERRIDE { return false; } |
144 |
|
bool isFinal() const OVERRIDE { return finalVal; } |
145 |
|
void setFinal(bool b = true) { finalVal = b; } |
146 |
|
}; |
147 |
|
typedef Ref<RealLiteral,Node> RealLiteralRef; |
148 |
|
|
149 |
class StringLiteral : virtual public StringExpr { |
class StringLiteral : virtual public StringExpr { |
150 |
public: |
public: |
151 |
String value; |
String value; |
184 |
}; |
}; |
185 |
typedef Ref<Variable,Node> VariableRef; |
typedef Ref<Variable,Node> VariableRef; |
186 |
|
|
187 |
class IntVariable : public Variable, public Unit, virtual public IntExpr { |
class ScalarNumberVariable : public Variable, virtual public ScalarNumberExpr { |
188 |
bool polyphonic; |
bool polyphonic; |
189 |
bool finalVal; |
bool finalVal; |
190 |
public: |
public: |
191 |
|
bool isPolyphonic() const OVERRIDE { return polyphonic; } |
192 |
|
bool isFinal() const OVERRIDE { return finalVal; } |
193 |
|
void setFinal(bool b = true) { finalVal = b; } |
194 |
|
protected: |
195 |
|
ScalarNumberVariable(ParserContext* ctx, vmint _memPos, |
196 |
|
bool _bConst = false, bool _bPolyphonic = false, |
197 |
|
bool _bFinal = false); |
198 |
|
}; |
199 |
|
typedef Ref<ScalarNumberVariable,Node> ScalarNumberVariableRef; |
200 |
|
|
201 |
|
class IntVariable : public ScalarNumberVariable, virtual public IntExpr { |
202 |
|
public: |
203 |
IntVariable(ParserContext* ctx); |
IntVariable(ParserContext* ctx); |
204 |
void assign(Expression* expr) OVERRIDE; |
void assign(Expression* expr) OVERRIDE; |
205 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
206 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
|
bool isPolyphonic() const OVERRIDE { return polyphonic; } |
|
|
bool isFinal() const OVERRIDE { return finalVal; } |
|
|
void setFinal(bool b = true) { finalVal = b; } |
|
207 |
protected: |
protected: |
208 |
IntVariable(ParserContext* ctx, bool polyphonic, bool bConst, vmint size = 1); |
IntVariable(ParserContext* ctx, bool polyphonic, bool bConst, vmint size = 1); |
209 |
}; |
}; |
210 |
typedef Ref<IntVariable,Node> IntVariableRef; |
typedef Ref<IntVariable,Node> IntVariableRef; |
211 |
|
|
212 |
|
class RealVariable : public ScalarNumberVariable, virtual public RealExpr { |
213 |
|
public: |
214 |
|
RealVariable(ParserContext* ctx); |
215 |
|
void assign(Expression* expr) OVERRIDE; |
216 |
|
vmfloat evalReal() OVERRIDE; |
217 |
|
void dump(int level = 0) OVERRIDE; |
218 |
|
protected: |
219 |
|
RealVariable(ParserContext* ctx, bool polyphonic, bool bConst, vmint size = 1); |
220 |
|
}; |
221 |
|
typedef Ref<RealVariable,Node> RealVariableRef; |
222 |
|
|
223 |
class ConstIntVariable : public IntVariable { |
class ConstIntVariable : public IntVariable { |
224 |
public: |
public: |
225 |
vmint value; |
vmint value; |
226 |
|
|
227 |
ConstIntVariable(vmint value); |
ConstIntVariable(vmint value); |
|
//ConstIntVariable(ParserContext* ctx, int value = 0); |
|
228 |
void assign(Expression* expr) OVERRIDE; |
void assign(Expression* expr) OVERRIDE; |
229 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
230 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
231 |
}; |
}; |
232 |
typedef Ref<ConstIntVariable,Node> ConstIntVariableRef; |
typedef Ref<ConstIntVariable,Node> ConstIntVariableRef; |
233 |
|
|
234 |
|
class ConstRealVariable : public RealVariable { |
235 |
|
public: |
236 |
|
vmfloat value; |
237 |
|
|
238 |
|
ConstRealVariable(vmfloat value); |
239 |
|
void assign(Expression* expr) OVERRIDE; |
240 |
|
vmfloat evalReal() OVERRIDE; |
241 |
|
void dump(int level = 0) OVERRIDE; |
242 |
|
}; |
243 |
|
typedef Ref<ConstRealVariable,Node> ConstRealVariableRef; |
244 |
|
|
245 |
class BuiltInIntVariable : public IntVariable { |
class BuiltInIntVariable : public IntVariable { |
246 |
String name; |
String name; |
247 |
VMIntPtr* ptr; |
VMIntPtr* ptr; |
261 |
}; |
}; |
262 |
typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef; |
typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef; |
263 |
|
|
264 |
|
class PolyphonicRealVariable : public RealVariable { |
265 |
|
public: |
266 |
|
PolyphonicRealVariable(ParserContext* ctx); |
267 |
|
void dump(int level = 0) OVERRIDE; |
268 |
|
}; |
269 |
|
typedef Ref<PolyphonicRealVariable,Node> PolyphonicRealVariableRef; |
270 |
|
|
271 |
class IntArrayVariable : public Variable, virtual public IntArrayExpr { |
class IntArrayVariable : public Variable, virtual public IntArrayExpr { |
272 |
ArrayList<vmint> values; |
ArrayList<vmint> values; |
273 |
public: |
public: |
286 |
}; |
}; |
287 |
typedef Ref<IntArrayVariable,Node> IntArrayVariableRef; |
typedef Ref<IntArrayVariable,Node> IntArrayVariableRef; |
288 |
|
|
289 |
|
class RealArrayVariable : public Variable, virtual public RealArrayExpr { |
290 |
|
ArrayList<vmfloat> values; |
291 |
|
public: |
292 |
|
RealArrayVariable(ParserContext* ctx, vmint size); |
293 |
|
RealArrayVariable(ParserContext* ctx, vmint size, ArgsRef values, bool _bConst = false); |
294 |
|
void assign(Expression* expr) OVERRIDE {} // ignore scalar assignment |
295 |
|
String evalCastToStr() OVERRIDE { return ""; } // ignore scalar cast to string |
296 |
|
ExprType_t exprType() const OVERRIDE { return REAL_ARR_EXPR; } |
297 |
|
virtual vmint arraySize() const OVERRIDE { return values.size(); } |
298 |
|
virtual vmfloat evalRealElement(vmuint i) OVERRIDE; |
299 |
|
virtual void assignRealElement(vmuint i, vmfloat value) OVERRIDE; |
300 |
|
void dump(int level = 0) OVERRIDE; |
301 |
|
bool isPolyphonic() const OVERRIDE { return false; } |
302 |
|
protected: |
303 |
|
RealArrayVariable(ParserContext* ctx, bool bConst); |
304 |
|
}; |
305 |
|
typedef Ref<RealArrayVariable,Node> RealArrayVariableRef; |
306 |
|
|
307 |
class BuiltInIntArrayVariable : public IntArrayVariable { |
class BuiltInIntArrayVariable : public IntArrayVariable { |
308 |
String name; |
String name; |
309 |
VMInt8Array* array; |
VMInt8Array* array; |
328 |
}; |
}; |
329 |
typedef Ref<IntArrayElement,Node> IntArrayElementRef; |
typedef Ref<IntArrayElement,Node> IntArrayElementRef; |
330 |
|
|
331 |
|
class RealArrayElement : public RealVariable { |
332 |
|
RealArrayExprRef array; |
333 |
|
IntExprRef index; |
334 |
|
public: |
335 |
|
RealArrayElement(RealArrayExprRef array, IntExprRef arrayIndex); |
336 |
|
void assign(Expression* expr) OVERRIDE; |
337 |
|
vmfloat evalReal() OVERRIDE; |
338 |
|
void dump(int level = 0) OVERRIDE; |
339 |
|
}; |
340 |
|
typedef Ref<RealArrayElement,Node> RealArrayElementRef; |
341 |
|
|
342 |
class StringVariable : public Variable, virtual public StringExpr { |
class StringVariable : public Variable, virtual public StringExpr { |
343 |
public: |
public: |
344 |
StringVariable(ParserContext* ctx); |
StringVariable(ParserContext* ctx); |
373 |
}; |
}; |
374 |
typedef Ref<BinaryOp,Node> BinaryOpRef; |
typedef Ref<BinaryOp,Node> BinaryOpRef; |
375 |
|
|
376 |
class IntBinaryOp : public BinaryOp, virtual public IntExpr { |
class ScalarNumberBinaryOp : public BinaryOp, virtual public ScalarNumberExpr { |
377 |
public: |
public: |
378 |
IntBinaryOp(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs, rhs) { } |
ScalarNumberBinaryOp(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : BinaryOp(lhs, rhs) { } |
379 |
MetricPrefix_t unitPrefix(vmuint i) const OVERRIDE; |
MetricPrefix_t unitPrefix(vmuint i) const OVERRIDE; |
380 |
StdUnit_t unitType() const OVERRIDE; |
StdUnit_t unitType() const OVERRIDE; |
381 |
bool isFinal() const OVERRIDE; |
bool isFinal() const OVERRIDE; |
382 |
}; |
}; |
383 |
|
typedef Ref<ScalarNumberBinaryOp,Node> ScalarNumberBinaryOpRef; |
384 |
|
|
385 |
|
class IntBinaryOp : public ScalarNumberBinaryOp, virtual public IntExpr { |
386 |
|
public: |
387 |
|
IntBinaryOp(IntExprRef lhs, IntExprRef rhs) : ScalarNumberBinaryOp(lhs, rhs) { } |
388 |
|
}; |
389 |
typedef Ref<IntBinaryOp,Node> IntBinaryOpRef; |
typedef Ref<IntBinaryOp,Node> IntBinaryOpRef; |
390 |
|
|
391 |
class Add : public IntBinaryOp { |
class VaritypeScalarBinaryOp : public ScalarNumberBinaryOp, virtual public IntExpr, virtual public RealExpr { |
392 |
|
public: |
393 |
|
VaritypeScalarBinaryOp(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : ScalarNumberBinaryOp(lhs, rhs) { } |
394 |
|
ExprType_t exprType() const OVERRIDE; |
395 |
|
String evalCastToStr() OVERRIDE; |
396 |
|
}; |
397 |
|
typedef Ref<VaritypeScalarBinaryOp,Node> VaritypeScalarBinaryOpRef; |
398 |
|
|
399 |
|
class Add : public VaritypeScalarBinaryOp { |
400 |
public: |
public: |
401 |
Add(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs, rhs) { } |
Add(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : VaritypeScalarBinaryOp(lhs, rhs) { } |
402 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
403 |
|
vmfloat evalReal() OVERRIDE; |
404 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
405 |
}; |
}; |
406 |
typedef Ref<Add,Node> AddRef; |
typedef Ref<Add,Node> AddRef; |
407 |
|
|
408 |
class Sub : public IntBinaryOp { |
class Sub : public VaritypeScalarBinaryOp { |
409 |
public: |
public: |
410 |
Sub(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs, rhs) { } |
Sub(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : VaritypeScalarBinaryOp(lhs, rhs) { } |
411 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
412 |
|
vmfloat evalReal() OVERRIDE; |
413 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
414 |
}; |
}; |
415 |
typedef Ref<Sub,Node> SubRef; |
typedef Ref<Sub,Node> SubRef; |
416 |
|
|
417 |
class Mul : public IntBinaryOp { |
class Mul : public VaritypeScalarBinaryOp { |
418 |
public: |
public: |
419 |
Mul(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs, rhs) { } |
Mul(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : VaritypeScalarBinaryOp(lhs, rhs) { } |
420 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
421 |
|
vmfloat evalReal() OVERRIDE; |
422 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
423 |
MetricPrefix_t unitPrefix(vmuint i) const OVERRIDE; |
MetricPrefix_t unitPrefix(vmuint i) const OVERRIDE; |
424 |
StdUnit_t unitType() const OVERRIDE; |
StdUnit_t unitType() const OVERRIDE; |
425 |
}; |
}; |
426 |
typedef Ref<Mul,Node> MulRef; |
typedef Ref<Mul,Node> MulRef; |
427 |
|
|
428 |
class Div : public IntBinaryOp { |
class Div : public VaritypeScalarBinaryOp { |
429 |
public: |
public: |
430 |
Div(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs, rhs) { } |
Div(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : VaritypeScalarBinaryOp(lhs, rhs) { } |
431 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
432 |
|
vmfloat evalReal() OVERRIDE; |
433 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
434 |
MetricPrefix_t unitPrefix(vmuint i) const OVERRIDE; |
MetricPrefix_t unitPrefix(vmuint i) const OVERRIDE; |
435 |
StdUnit_t unitType() const OVERRIDE; |
StdUnit_t unitType() const OVERRIDE; |
512 |
}; |
}; |
513 |
typedef Ref<DynamicVariableCall,Node> DynamicVariableCallRef; |
typedef Ref<DynamicVariableCall,Node> DynamicVariableCallRef; |
514 |
|
|
515 |
class FunctionCall : virtual public LeafStatement, virtual public IntExpr, virtual public StringExpr { |
class FunctionCall : virtual public LeafStatement, virtual public IntExpr, virtual public RealExpr, virtual public StringExpr { |
516 |
String functionName; |
String functionName; |
517 |
ArgsRef args; |
ArgsRef args; |
518 |
VMFunction* fn; |
VMFunction* fn; |
522 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
523 |
StmtFlags_t exec() OVERRIDE; |
StmtFlags_t exec() OVERRIDE; |
524 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
525 |
|
vmfloat evalReal() OVERRIDE; |
526 |
VMIntArrayExpr* asIntArray() const OVERRIDE; |
VMIntArrayExpr* asIntArray() const OVERRIDE; |
527 |
|
VMRealArrayExpr* asRealArray() const OVERRIDE; |
528 |
String evalStr() OVERRIDE; |
String evalStr() OVERRIDE; |
529 |
bool isConstExpr() const OVERRIDE { return false; } |
bool isConstExpr() const OVERRIDE { return false; } |
530 |
ExprType_t exprType() const OVERRIDE; |
ExprType_t exprType() const OVERRIDE; |
715 |
EQUAL, |
EQUAL, |
716 |
NOT_EQUAL |
NOT_EQUAL |
717 |
}; |
}; |
718 |
Relation(IntExprRef lhs, Type type, IntExprRef rhs) : |
Relation(ExpressionRef lhs, Type type, ExpressionRef rhs) : |
719 |
lhs(lhs), rhs(rhs), type(type) {} |
lhs(lhs), rhs(rhs), type(type) {} |
720 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
721 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
725 |
StdUnit_t unitType() const OVERRIDE { return VM_NO_UNIT; } |
StdUnit_t unitType() const OVERRIDE { return VM_NO_UNIT; } |
726 |
bool isFinal() const OVERRIDE { return false; } |
bool isFinal() const OVERRIDE { return false; } |
727 |
private: |
private: |
728 |
IntExprRef lhs; |
ExpressionRef lhs; |
729 |
IntExprRef rhs; |
ExpressionRef rhs; |
730 |
Type type; |
Type type; |
731 |
}; |
}; |
732 |
typedef Ref<Relation,Node> RelationRef; |
typedef Ref<Relation,Node> RelationRef; |
795 |
}; |
}; |
796 |
typedef Ref<BitwiseNot,Node> BitwiseNotRef; |
typedef Ref<BitwiseNot,Node> BitwiseNotRef; |
797 |
|
|
798 |
class Final : virtual public IntExpr { |
class Final : virtual public IntExpr, virtual public RealExpr { |
799 |
IntExprRef expr; |
ScalarNumberExprRef expr; |
800 |
public: |
public: |
801 |
Final(IntExprRef expr) : expr(expr) {} |
Final(ScalarNumberExprRef expr) : expr(expr) {} |
802 |
vmint evalInt() OVERRIDE { return expr->evalInt(); } |
ExprType_t exprType() const OVERRIDE { return expr->exprType(); } |
803 |
|
vmint evalInt() OVERRIDE { return expr->asInt()->evalInt(); } |
804 |
|
vmfloat evalReal() OVERRIDE { return expr->asReal()->evalReal(); } |
805 |
|
String evalCastToStr() OVERRIDE; |
806 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
807 |
bool isConstExpr() const OVERRIDE { return expr->isConstExpr(); } |
bool isConstExpr() const OVERRIDE { return expr->isConstExpr(); } |
808 |
bool isPolyphonic() const OVERRIDE { return expr->isPolyphonic(); } |
bool isPolyphonic() const OVERRIDE { return expr->isPolyphonic(); } |
833 |
std::map<String,VariableRef> vartable; |
std::map<String,VariableRef> vartable; |
834 |
std::map<String,StatementsRef> userFnTable; |
std::map<String,StatementsRef> userFnTable; |
835 |
vmint globalIntVarCount; |
vmint globalIntVarCount; |
836 |
|
vmint globalRealVarCount; |
837 |
vmint globalStrVarCount; |
vmint globalStrVarCount; |
838 |
vmint polyphonicIntVarCount; |
vmint polyphonicIntVarCount; |
839 |
|
vmint polyphonicRealVarCount; |
840 |
|
|
841 |
EventHandlersRef handlers; |
EventHandlersRef handlers; |
842 |
|
|
846 |
OnControllerRef onController; |
OnControllerRef onController; |
847 |
|
|
848 |
ArrayList<vmint>* globalIntMemory; |
ArrayList<vmint>* globalIntMemory; |
849 |
|
ArrayList<vmfloat>* globalRealMemory; |
850 |
ArrayList<String>* globalStrMemory; |
ArrayList<String>* globalStrMemory; |
851 |
vmint requiredMaxStackSize; |
vmint requiredMaxStackSize; |
852 |
|
|
856 |
|
|
857 |
ParserContext(VMFunctionProvider* parent) : |
ParserContext(VMFunctionProvider* parent) : |
858 |
scanner(NULL), is(NULL), |
scanner(NULL), is(NULL), |
859 |
globalIntVarCount(0), globalStrVarCount(0), polyphonicIntVarCount(0), |
globalIntVarCount(0), globalRealVarCount(0), globalStrVarCount(0), |
860 |
globalIntMemory(NULL), globalStrMemory(NULL), requiredMaxStackSize(-1), |
polyphonicIntVarCount(0), polyphonicRealVarCount(0), |
861 |
|
globalIntMemory(NULL), globalRealMemory(NULL), globalStrMemory(NULL), |
862 |
|
requiredMaxStackSize(-1), |
863 |
functionProvider(parent), execContext(NULL) |
functionProvider(parent), execContext(NULL) |
864 |
{ |
{ |
865 |
} |
} |
866 |
virtual ~ParserContext(); |
virtual ~ParserContext(); |
867 |
VariableRef globalVar(const String& name); |
VariableRef globalVar(const String& name); |
868 |
IntVariableRef globalIntVar(const String& name); |
IntVariableRef globalIntVar(const String& name); |
869 |
|
RealVariableRef globalRealVar(const String& name); |
870 |
StringVariableRef globalStrVar(const String& name); |
StringVariableRef globalStrVar(const String& name); |
871 |
VariableRef variableByName(const String& name); |
VariableRef variableByName(const String& name); |
872 |
StatementsRef userFunctionByName(const String& name); |
StatementsRef userFunctionByName(const String& name); |
903 |
}; |
}; |
904 |
|
|
905 |
ArrayList<vmint> polyphonicIntMemory; |
ArrayList<vmint> polyphonicIntMemory; |
906 |
|
ArrayList<vmfloat> polyphonicRealMemory; |
907 |
VMExecStatus_t status; |
VMExecStatus_t status; |
908 |
StmtFlags_t flags; |
StmtFlags_t flags; |
909 |
ArrayList<StackFrame> stack; |
ArrayList<StackFrame> stack; |
952 |
} |
} |
953 |
|
|
954 |
void resetPolyphonicData() OVERRIDE { |
void resetPolyphonicData() OVERRIDE { |
955 |
if (polyphonicIntMemory.empty()) return; |
if (!polyphonicIntMemory.empty()) |
956 |
memset(&polyphonicIntMemory[0], 0, polyphonicIntMemory.size() * sizeof(vmint)); |
memset(&polyphonicIntMemory[0], 0, polyphonicIntMemory.size() * sizeof(vmint)); |
957 |
|
if (!polyphonicRealMemory.empty()) |
958 |
|
memset(&polyphonicRealMemory[0], 0, polyphonicRealMemory.size() * sizeof(vmfloat)); |
959 |
} |
} |
960 |
|
|
961 |
size_t instructionsPerformed() const OVERRIDE { |
size_t instructionsPerformed() const OVERRIDE { |