1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* |
* |
3 |
* Copyright (c) 2014 - 2016 Christian Schoenebeck and Andreas Persson |
* Copyright (c) 2014 - 2019 Christian Schoenebeck and Andreas Persson |
4 |
* |
* |
5 |
* http://www.linuxsampler.org |
* http://www.linuxsampler.org |
6 |
* |
* |
20 |
#include <iostream> |
#include <iostream> |
21 |
#include <map> |
#include <map> |
22 |
#include <set> |
#include <set> |
23 |
|
#include <string.h> // for memset() |
24 |
#include "../common/global.h" |
#include "../common/global.h" |
25 |
#include "../common/Ref.h" |
#include "../common/Ref.h" |
26 |
#include "../common/ArrayList.h" |
#include "../common/ArrayList.h" |
36 |
STMT_LIST, |
STMT_LIST, |
37 |
STMT_BRANCH, |
STMT_BRANCH, |
38 |
STMT_LOOP, |
STMT_LOOP, |
39 |
|
STMT_SYNC, |
40 |
|
STMT_NOOP, |
41 |
}; |
}; |
42 |
|
|
43 |
class Node { |
class Node { |
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 |
|
StdUnit_t unit; |
63 |
public: |
public: |
64 |
ExprType_t exprType() const { return INT_EXPR; } |
Unit(StdUnit_t type) : unit(type) {} |
65 |
virtual int evalInt() = 0; |
StdUnit_t unitType() const OVERRIDE { return unit; } |
66 |
String evalCastToStr(); |
static vmint convIntToUnitFactor(vmint iValue, VMUnit* srcUnit, VMUnit* dstUnit); |
67 |
|
static vmint convIntToUnitFactor(vmint iValue, vmfloat srcFactor, vmfloat dstFactor); |
68 |
|
static vmfloat convRealToUnitFactor(vmfloat fValue, VMUnit* srcUnit, VMUnit* dstUnit); |
69 |
|
static vmfloat convRealToUnitFactor(vmfloat fValue, vmfloat srcFactor, vmfloat dstFactor); |
70 |
|
}; |
71 |
|
typedef Ref<Unit,Node> UnitRef; |
72 |
|
|
73 |
|
class ScalarNumberExpr : virtual public Unit, virtual public VMScalarNumberExpr, virtual public Expression { |
74 |
|
public: |
75 |
|
}; |
76 |
|
typedef Ref<ScalarNumberExpr,Node> ScalarNumberExprRef; |
77 |
|
|
78 |
|
class IntExpr : virtual public ScalarNumberExpr, virtual public VMIntExpr { |
79 |
|
public: |
80 |
|
ExprType_t exprType() const OVERRIDE { return INT_EXPR; } |
81 |
|
vmint evalIntToUnitFactor(vmfloat unitFactor); |
82 |
|
String evalCastToStr() OVERRIDE; |
83 |
}; |
}; |
84 |
typedef Ref<IntExpr,Node> IntExprRef; |
typedef Ref<IntExpr,Node> IntExprRef; |
85 |
|
|
86 |
|
class RealExpr : virtual public ScalarNumberExpr, virtual public VMRealExpr { |
87 |
|
public: |
88 |
|
ExprType_t exprType() const OVERRIDE { return REAL_EXPR; } |
89 |
|
vmfloat evalRealToUnitFactor(vmfloat unitFactor); |
90 |
|
String evalCastToStr() OVERRIDE; |
91 |
|
}; |
92 |
|
typedef Ref<RealExpr,Node> RealExprRef; |
93 |
|
|
94 |
|
class ArrayExpr : virtual public VMArrayExpr, virtual public Expression { |
95 |
|
public: |
96 |
|
}; |
97 |
|
typedef Ref<ArrayExpr,Node> ArrayExprRef; |
98 |
|
|
99 |
|
class IntArrayExpr : virtual public VMIntArrayExpr, virtual public ArrayExpr { |
100 |
|
public: |
101 |
|
ExprType_t exprType() const OVERRIDE { return INT_ARR_EXPR; } |
102 |
|
String evalCastToStr() OVERRIDE; |
103 |
|
}; |
104 |
|
typedef Ref<IntArrayExpr,Node> IntArrayExprRef; |
105 |
|
|
106 |
|
class RealArrayExpr : virtual public VMRealArrayExpr, virtual public ArrayExpr { |
107 |
|
public: |
108 |
|
ExprType_t exprType() const OVERRIDE { return REAL_ARR_EXPR; } |
109 |
|
String evalCastToStr() OVERRIDE; |
110 |
|
}; |
111 |
|
typedef Ref<RealArrayExpr,Node> RealArrayExprRef; |
112 |
|
|
113 |
class StringExpr : virtual public VMStringExpr, virtual public Expression { |
class StringExpr : virtual public VMStringExpr, virtual public Expression { |
114 |
public: |
public: |
115 |
ExprType_t exprType() const { return STRING_EXPR; } |
ExprType_t exprType() const OVERRIDE { return STRING_EXPR; } |
116 |
virtual String evalStr() = 0; |
String evalCastToStr() OVERRIDE { return evalStr(); } |
|
String evalCastToStr() { return evalStr(); } |
|
117 |
}; |
}; |
118 |
typedef Ref<StringExpr,Node> StringExprRef; |
typedef Ref<StringExpr,Node> StringExprRef; |
119 |
|
|
120 |
class IntLiteral : virtual public IntExpr { |
struct IntLitDef { |
121 |
int value; |
vmint value; //NOTE: sequence matters! Since this is usually initialized with VMIntExpr::evalInt() it should be before member unitFactor, since the latter is usually initialized with VMIntExpr::unitFactor() which does not evaluate the expression. |
122 |
public: |
vmfloat unitFactor = VM_NO_FACTOR; |
123 |
IntLiteral(int value) : value(value) { } |
StdUnit_t unitType = VM_NO_UNIT; |
124 |
int evalInt(); |
bool isFinal; |
125 |
void dump(int level = 0); |
}; |
126 |
bool isConstExpr() const { return true; } |
|
127 |
bool isPolyphonic() const { return false; } |
class IntLiteral FINAL : public IntExpr { |
128 |
|
bool finalVal; |
129 |
|
vmfloat unitPrefixFactor; |
130 |
|
vmint value; |
131 |
|
public: |
132 |
|
IntLiteral(const IntLitDef& def); |
133 |
|
vmint evalInt() OVERRIDE; |
134 |
|
vmfloat unitFactor() const OVERRIDE { return unitPrefixFactor; } |
135 |
|
void dump(int level = 0) OVERRIDE; |
136 |
|
bool isConstExpr() const OVERRIDE { return true; } |
137 |
|
bool isPolyphonic() const OVERRIDE { return false; } |
138 |
|
bool isFinal() const OVERRIDE { return finalVal; } |
139 |
}; |
}; |
140 |
typedef Ref<IntLiteral,Node> IntLiteralRef; |
typedef Ref<IntLiteral,Node> IntLiteralRef; |
141 |
|
|
142 |
class StringLiteral : virtual public StringExpr { |
struct RealLitDef { |
143 |
public: |
vmfloat value; //NOTE: sequence matters! Since this is usually initialized with VMRealExpr::evalReal() it should be before member unitFactor, since the latter is usually initialized with VMRealExpr::unitFactor() which does not evaluate the expression. |
144 |
|
vmfloat unitFactor = VM_NO_FACTOR; |
145 |
|
StdUnit_t unitType = VM_NO_UNIT; |
146 |
|
bool isFinal; |
147 |
|
}; |
148 |
|
|
149 |
|
class RealLiteral FINAL : public RealExpr { |
150 |
|
bool finalVal; |
151 |
|
vmfloat unitPrefixFactor; |
152 |
|
vmfloat value; |
153 |
|
public: |
154 |
|
RealLiteral(const RealLitDef& def); |
155 |
|
vmfloat evalReal() OVERRIDE; |
156 |
|
vmfloat unitFactor() const OVERRIDE { return unitPrefixFactor; } |
157 |
|
void dump(int level = 0) OVERRIDE; |
158 |
|
bool isConstExpr() const OVERRIDE { return true; } |
159 |
|
bool isPolyphonic() const OVERRIDE { return false; } |
160 |
|
bool isFinal() const OVERRIDE { return finalVal; } |
161 |
|
}; |
162 |
|
typedef Ref<RealLiteral,Node> RealLiteralRef; |
163 |
|
|
164 |
|
class StringLiteral FINAL : public StringExpr { |
165 |
String value; |
String value; |
166 |
|
public: |
167 |
StringLiteral(const String& value) : value(value) { } |
StringLiteral(const String& value) : value(value) { } |
168 |
bool isConstExpr() const { return true; } |
bool isConstExpr() const OVERRIDE { return true; } |
169 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
170 |
String evalStr() { return value; } |
String evalStr() OVERRIDE { return value; } |
171 |
bool isPolyphonic() const { return false; } |
bool isPolyphonic() const OVERRIDE { return false; } |
172 |
}; |
}; |
173 |
typedef Ref<StringLiteral,Node> StringLiteralRef; |
typedef Ref<StringLiteral,Node> StringLiteralRef; |
174 |
|
|
175 |
class Args : virtual public VMFnArgs, virtual public Node { |
class Args FINAL : virtual public VMFnArgs, virtual public Node { |
176 |
public: |
public: |
177 |
std::vector<ExpressionRef> args; |
std::vector<ExpressionRef> args; |
178 |
void add(ExpressionRef arg) { args.push_back(arg); } |
void add(ExpressionRef arg) { args.push_back(arg); } |
179 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
180 |
int argsCount() const { return args.size(); } |
vmint argsCount() const OVERRIDE { return (vmint) args.size(); } |
181 |
VMExpr* arg(int i) { return (i >= 0 && i < argsCount()) ? &*args.at(i) : NULL; } |
VMExpr* arg(vmint i) OVERRIDE { return (i >= 0 && i < argsCount()) ? &*args.at(i) : NULL; } |
182 |
bool isPolyphonic() const; |
bool isPolyphonic() const OVERRIDE; |
183 |
}; |
}; |
184 |
typedef Ref<Args,Node> ArgsRef; |
typedef Ref<Args,Node> ArgsRef; |
185 |
|
|
186 |
class Variable : virtual public Expression { |
struct VariableDecl { |
187 |
|
ParserContext* ctx; |
188 |
|
bool isPolyphonic; |
189 |
|
bool isConst; |
190 |
|
bool isFinal; |
191 |
|
vmint elements = 1; |
192 |
|
vmint memPos; |
193 |
|
vmint unitFactorMemPos; |
194 |
|
StdUnit_t unitType = VM_NO_UNIT; |
195 |
|
}; |
196 |
|
|
197 |
|
class Variable : virtual public VMVariable, virtual public Expression { |
198 |
public: |
public: |
199 |
virtual bool isConstExpr() const { return bConst; } |
bool isConstExpr() const OVERRIDE { return bConst; } |
200 |
|
bool isAssignable() const OVERRIDE { return !bConst; } |
201 |
virtual void assign(Expression* expr) = 0; |
virtual void assign(Expression* expr) = 0; |
202 |
|
void assignExpr(VMExpr* expr) OVERRIDE { Expression* e = dynamic_cast<Expression*>(expr); if (e) assign(e); } |
203 |
protected: |
protected: |
204 |
Variable(ParserContext* ctx, int _memPos, bool _bConst) |
Variable(const VariableDecl& decl); |
|
: context(ctx), memPos(_memPos), bConst(_bConst) {} |
|
205 |
|
|
206 |
ParserContext* context; |
ParserContext* context; |
207 |
int memPos; |
vmint memPos; |
208 |
bool bConst; |
bool bConst; |
209 |
}; |
}; |
210 |
typedef Ref<Variable,Node> VariableRef; |
typedef Ref<Variable,Node> VariableRef; |
211 |
|
|
212 |
class IntVariable : public Variable, virtual public IntExpr { |
class ScalarNumberVariable : public Variable, virtual public ScalarNumberExpr { |
213 |
bool polyphonic; |
bool polyphonic; |
214 |
|
bool finalVal; |
215 |
|
protected: |
216 |
|
vmint unitFactorMemPos; |
217 |
public: |
public: |
218 |
IntVariable(ParserContext* ctx); |
bool isPolyphonic() const OVERRIDE { return polyphonic; } |
219 |
void assign(Expression* expr); |
bool isFinal() const OVERRIDE { return finalVal; } |
220 |
int evalInt(); |
vmfloat unitFactor() const OVERRIDE; |
|
void dump(int level = 0); |
|
|
bool isPolyphonic() const { return polyphonic; } |
|
221 |
protected: |
protected: |
222 |
IntVariable(ParserContext* ctx, bool polyphonic, bool bConst, int size = 1); |
ScalarNumberVariable(const VariableDecl& decl); |
223 |
}; |
}; |
224 |
typedef Ref<IntVariable,Node> IntVariableRef; |
typedef Ref<ScalarNumberVariable,Node> ScalarNumberVariableRef; |
225 |
|
|
226 |
class ConstIntVariable : public IntVariable { |
class IntVariable : public ScalarNumberVariable, virtual public IntExpr { |
227 |
public: |
public: |
228 |
int value; |
IntVariable(const VariableDecl& decl); |
229 |
|
void assign(Expression* expr) OVERRIDE; |
230 |
|
vmint evalInt() OVERRIDE; |
231 |
|
void dump(int level = 0) OVERRIDE; |
232 |
|
}; |
233 |
|
typedef Ref<IntVariable,Node> IntVariableRef; |
234 |
|
|
235 |
ConstIntVariable(int value); |
class RealVariable : public ScalarNumberVariable, virtual public RealExpr { |
236 |
//ConstIntVariable(ParserContext* ctx, int value = 0); |
public: |
237 |
void assign(Expression* expr); |
RealVariable(const VariableDecl& decl); |
238 |
int evalInt(); |
void assign(Expression* expr) OVERRIDE; |
239 |
void dump(int level = 0); |
vmfloat evalReal() OVERRIDE; |
240 |
|
void dump(int level = 0) OVERRIDE; |
241 |
|
}; |
242 |
|
typedef Ref<RealVariable,Node> RealVariableRef; |
243 |
|
|
244 |
|
struct IntVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17 |
245 |
|
// copied from VariableDecl |
246 |
|
ParserContext* ctx; |
247 |
|
bool isPolyphonic; |
248 |
|
bool isConst; |
249 |
|
bool isFinal; |
250 |
|
vmint elements = 1; |
251 |
|
vmint memPos; |
252 |
|
vmint unitFactorMemPos; |
253 |
|
StdUnit_t unitType = VM_NO_UNIT; |
254 |
|
// additions for RealVarDef |
255 |
|
vmint value = 0; //NOTE: sequence matters! Since this is usually initialized with VMIntExpr::evalInt() it should be before member unitFactor, since the latter is usually initialized with VMIntExpr::unitFactor() which does not evaluate the expression. |
256 |
|
vmfloat unitFactor = VM_NO_FACTOR; |
257 |
|
}; |
258 |
|
|
259 |
|
class ConstIntVariable FINAL : public IntVariable { |
260 |
|
vmfloat unitPrefixFactor; |
261 |
|
vmint value; |
262 |
|
public: |
263 |
|
ConstIntVariable(const IntVarDef& def); |
264 |
|
void assign(Expression* expr) OVERRIDE; |
265 |
|
vmint evalInt() OVERRIDE; |
266 |
|
vmfloat unitFactor() const OVERRIDE { return unitPrefixFactor; } |
267 |
|
void dump(int level = 0) OVERRIDE; |
268 |
}; |
}; |
269 |
typedef Ref<ConstIntVariable,Node> ConstIntVariableRef; |
typedef Ref<ConstIntVariable,Node> ConstIntVariableRef; |
270 |
|
|
271 |
class BuiltInIntVariable : public IntVariable { |
struct RealVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17 |
272 |
|
// copied from VariableDecl |
273 |
|
ParserContext* ctx; |
274 |
|
bool isPolyphonic; |
275 |
|
bool isConst; |
276 |
|
bool isFinal; |
277 |
|
vmint elements = 1; |
278 |
|
vmint memPos; |
279 |
|
vmint unitFactorMemPos; |
280 |
|
StdUnit_t unitType = VM_NO_UNIT; |
281 |
|
// additions for RealVarDef |
282 |
|
vmfloat value = vmfloat(0); //NOTE: sequence matters! Since this is usually initialized with VMRealExpr::evalReal() it should be before member unitFactor, since the latter is usually initialized with VMRealExpr::unitFactor() which does not evaluate the expression. |
283 |
|
vmfloat unitFactor = VM_NO_FACTOR; |
284 |
|
}; |
285 |
|
|
286 |
|
class ConstRealVariable FINAL : public RealVariable { |
287 |
|
vmfloat unitPrefixFactor; |
288 |
|
vmfloat value; |
289 |
|
public: |
290 |
|
ConstRealVariable(const RealVarDef& def); |
291 |
|
void assign(Expression* expr) OVERRIDE; |
292 |
|
vmfloat evalReal() OVERRIDE; |
293 |
|
vmfloat unitFactor() const OVERRIDE { return unitPrefixFactor; } |
294 |
|
void dump(int level = 0) OVERRIDE; |
295 |
|
}; |
296 |
|
typedef Ref<ConstRealVariable,Node> ConstRealVariableRef; |
297 |
|
|
298 |
|
class BuiltInIntVariable FINAL : public IntVariable { |
299 |
String name; |
String name; |
300 |
VMIntRelPtr* ptr; |
VMIntPtr* ptr; |
301 |
public: |
public: |
302 |
BuiltInIntVariable(const String& name, VMIntRelPtr* ptr); |
BuiltInIntVariable(const String& name, VMIntPtr* ptr); |
303 |
void assign(Expression* expr); |
bool isAssignable() const OVERRIDE { return ptr->isAssignable(); } |
304 |
int evalInt(); |
void assign(Expression* expr) OVERRIDE; |
305 |
void dump(int level = 0); |
vmint evalInt() OVERRIDE; |
306 |
|
vmfloat unitFactor() const OVERRIDE { return VM_NO_UNIT; } |
307 |
|
void dump(int level = 0) OVERRIDE; |
308 |
}; |
}; |
309 |
typedef Ref<BuiltInIntVariable,Node> BuiltInIntVariableRef; |
typedef Ref<BuiltInIntVariable,Node> BuiltInIntVariableRef; |
310 |
|
|
311 |
class PolyphonicIntVariable : public IntVariable { |
class PolyphonicIntVariable FINAL : public IntVariable { |
312 |
public: |
public: |
313 |
PolyphonicIntVariable(ParserContext* ctx); |
PolyphonicIntVariable(const VariableDecl& decl); |
314 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
315 |
}; |
}; |
316 |
typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef; |
typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef; |
317 |
|
|
318 |
class IntArrayVariable : public Variable, virtual public VMIntArrayExpr { |
class PolyphonicRealVariable FINAL : public RealVariable { |
|
ArrayList<int> values; |
|
319 |
public: |
public: |
320 |
IntArrayVariable(ParserContext* ctx, int size); |
PolyphonicRealVariable(const VariableDecl& decl); |
321 |
IntArrayVariable(ParserContext* ctx, int size, ArgsRef values); |
void dump(int level = 0) OVERRIDE; |
322 |
void assign(Expression* expr) {} // ignore scalar assignment |
}; |
323 |
String evalCastToStr() { return ""; } // ignore scalar cast to string |
typedef Ref<PolyphonicRealVariable,Node> PolyphonicRealVariableRef; |
324 |
ExprType_t exprType() const { return INT_ARR_EXPR; } |
|
325 |
virtual int arraySize() const { return values.size(); } |
class IntArrayVariable : public Variable, virtual public IntArrayExpr { |
326 |
virtual int evalIntElement(uint i); |
ArrayList<vmint> values; |
327 |
virtual void assignIntElement(uint i, int value); |
ArrayList<vmfloat> unitFactors; |
328 |
void dump(int level = 0); |
public: |
329 |
bool isPolyphonic() const { return false; } |
IntArrayVariable(ParserContext* ctx, vmint size); |
330 |
|
IntArrayVariable(ParserContext* ctx, vmint size, ArgsRef values, bool _bConst = false); |
331 |
|
void assign(Expression* expr) OVERRIDE {} // ignore scalar assignment |
332 |
|
ExprType_t exprType() const OVERRIDE { return INT_ARR_EXPR; } |
333 |
|
virtual vmint arraySize() const OVERRIDE { return values.size(); } |
334 |
|
virtual vmint evalIntElement(vmuint i) OVERRIDE; |
335 |
|
virtual void assignIntElement(vmuint i, vmint value) OVERRIDE; |
336 |
|
vmfloat unitFactorOfElement(vmuint i) const OVERRIDE; |
337 |
|
void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE; |
338 |
|
void dump(int level = 0) OVERRIDE; |
339 |
|
bool isPolyphonic() const OVERRIDE { return false; } |
340 |
protected: |
protected: |
341 |
IntArrayVariable(ParserContext* ctx, bool bConst); |
IntArrayVariable(ParserContext* ctx, bool bConst); |
342 |
}; |
}; |
343 |
typedef Ref<IntArrayVariable,Node> IntArrayVariableRef; |
typedef Ref<IntArrayVariable,Node> IntArrayVariableRef; |
344 |
|
|
345 |
class BuiltInIntArrayVariable : public IntArrayVariable { |
class RealArrayVariable FINAL : public Variable, virtual public RealArrayExpr { |
346 |
|
ArrayList<vmfloat> values; |
347 |
|
ArrayList<vmfloat> unitFactors; |
348 |
|
public: |
349 |
|
RealArrayVariable(ParserContext* ctx, vmint size); |
350 |
|
RealArrayVariable(ParserContext* ctx, vmint size, ArgsRef values, bool _bConst = false); |
351 |
|
void assign(Expression* expr) OVERRIDE {} // ignore scalar assignment |
352 |
|
ExprType_t exprType() const OVERRIDE { return REAL_ARR_EXPR; } |
353 |
|
virtual vmint arraySize() const OVERRIDE { return values.size(); } |
354 |
|
virtual vmfloat evalRealElement(vmuint i) OVERRIDE; |
355 |
|
virtual void assignRealElement(vmuint i, vmfloat value) OVERRIDE; |
356 |
|
vmfloat unitFactorOfElement(vmuint i) const OVERRIDE; |
357 |
|
void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE; |
358 |
|
void dump(int level = 0) OVERRIDE; |
359 |
|
bool isPolyphonic() const OVERRIDE { return false; } |
360 |
|
protected: |
361 |
|
RealArrayVariable(ParserContext* ctx, bool bConst); |
362 |
|
}; |
363 |
|
typedef Ref<RealArrayVariable,Node> RealArrayVariableRef; |
364 |
|
|
365 |
|
class BuiltInIntArrayVariable FINAL : public IntArrayVariable { |
366 |
String name; |
String name; |
367 |
VMInt8Array* array; |
VMInt8Array* array; |
368 |
public: |
public: |
369 |
BuiltInIntArrayVariable(const String& name, VMInt8Array* array); |
BuiltInIntArrayVariable(const String& name, VMInt8Array* array); |
370 |
int arraySize() const { return array->size; } |
vmint arraySize() const OVERRIDE { return array->size; } |
371 |
int evalIntElement(uint i); |
vmint evalIntElement(vmuint i) OVERRIDE; |
372 |
void assignIntElement(uint i, int value); |
void assignIntElement(vmuint i, vmint value) OVERRIDE; |
373 |
void dump(int level = 0); |
vmfloat unitFactorOfElement(vmuint i) const OVERRIDE { return VM_NO_FACTOR; } |
374 |
|
void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE {} |
375 |
|
bool isAssignable() const OVERRIDE { return !array->readonly; } |
376 |
|
void dump(int level = 0) OVERRIDE; |
377 |
}; |
}; |
378 |
typedef Ref<BuiltInIntArrayVariable,Node> BuiltInIntArrayVariableRef; |
typedef Ref<BuiltInIntArrayVariable,Node> BuiltInIntArrayVariableRef; |
379 |
|
|
380 |
class IntArrayElement : public IntVariable { |
class IntArrayElement FINAL : public IntVariable { |
381 |
IntArrayVariableRef array; |
IntArrayExprRef array; |
382 |
IntExprRef index; |
IntExprRef index; |
383 |
|
vmint currentIndex; |
384 |
public: |
public: |
385 |
IntArrayElement(IntArrayVariableRef array, IntExprRef arrayIndex); |
IntArrayElement(IntArrayExprRef array, IntExprRef arrayIndex); |
386 |
void assign(Expression* expr); |
void assign(Expression* expr) OVERRIDE; |
387 |
int evalInt(); |
vmint evalInt() OVERRIDE; |
388 |
void dump(int level = 0); |
vmfloat unitFactor() const OVERRIDE; |
389 |
|
void dump(int level = 0) OVERRIDE; |
390 |
}; |
}; |
391 |
typedef Ref<IntArrayElement,Node> IntArrayElementRef; |
typedef Ref<IntArrayElement,Node> IntArrayElementRef; |
392 |
|
|
393 |
|
class RealArrayElement FINAL : public RealVariable { |
394 |
|
RealArrayExprRef array; |
395 |
|
IntExprRef index; |
396 |
|
vmint currentIndex; |
397 |
|
public: |
398 |
|
RealArrayElement(RealArrayExprRef array, IntExprRef arrayIndex); |
399 |
|
void assign(Expression* expr) OVERRIDE; |
400 |
|
vmfloat evalReal() OVERRIDE; |
401 |
|
vmfloat unitFactor() const OVERRIDE; |
402 |
|
void dump(int level = 0) OVERRIDE; |
403 |
|
}; |
404 |
|
typedef Ref<RealArrayElement,Node> RealArrayElementRef; |
405 |
|
|
406 |
class StringVariable : public Variable, virtual public StringExpr { |
class StringVariable : public Variable, virtual public StringExpr { |
407 |
public: |
public: |
408 |
StringVariable(ParserContext* ctx); |
StringVariable(ParserContext* ctx); |
409 |
void assign(Expression* expr); |
void assign(Expression* expr) OVERRIDE; |
410 |
String evalStr(); |
String evalStr() OVERRIDE; |
411 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
412 |
bool isPolyphonic() const { return false; } |
bool isPolyphonic() const OVERRIDE { return false; } |
413 |
protected: |
protected: |
414 |
StringVariable(ParserContext* ctx, bool bConst); |
StringVariable(ParserContext* ctx, bool bConst); |
415 |
}; |
}; |
416 |
typedef Ref<StringVariable,Node> StringVariableRef; |
typedef Ref<StringVariable,Node> StringVariableRef; |
417 |
|
|
418 |
class ConstStringVariable : public StringVariable { |
class ConstStringVariable FINAL : public StringVariable { |
|
public: |
|
419 |
String value; |
String value; |
420 |
|
public: |
421 |
ConstStringVariable(ParserContext* ctx, String value = ""); |
ConstStringVariable(ParserContext* ctx, String value = ""); |
422 |
void assign(Expression* expr); |
void assign(Expression* expr) OVERRIDE; |
423 |
String evalStr(); |
String evalStr() OVERRIDE; |
424 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
425 |
}; |
}; |
426 |
typedef Ref<ConstStringVariable,Node> ConstStringVariableRef; |
typedef Ref<ConstStringVariable,Node> ConstStringVariableRef; |
427 |
|
|
431 |
ExpressionRef rhs; |
ExpressionRef rhs; |
432 |
public: |
public: |
433 |
BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { } |
BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { } |
434 |
bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); } |
bool isConstExpr() const OVERRIDE { return lhs->isConstExpr() && rhs->isConstExpr(); } |
435 |
bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); } |
bool isPolyphonic() const OVERRIDE { return lhs->isPolyphonic() || rhs->isPolyphonic(); } |
436 |
}; |
}; |
437 |
typedef Ref<BinaryOp,Node> BinaryOpRef; |
typedef Ref<BinaryOp,Node> BinaryOpRef; |
438 |
|
|
439 |
class Add : virtual public BinaryOp, virtual public IntExpr { |
class ScalarNumberBinaryOp : public BinaryOp, virtual public ScalarNumberExpr { |
440 |
|
public: |
441 |
|
ScalarNumberBinaryOp(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : BinaryOp(lhs, rhs) { } |
442 |
|
bool isFinal() const OVERRIDE; |
443 |
|
}; |
444 |
|
typedef Ref<ScalarNumberBinaryOp,Node> ScalarNumberBinaryOpRef; |
445 |
|
|
446 |
|
class IntBinaryOp : public ScalarNumberBinaryOp, virtual public IntExpr { |
447 |
|
public: |
448 |
|
IntBinaryOp(IntExprRef lhs, IntExprRef rhs) : ScalarNumberBinaryOp(lhs, rhs) { } |
449 |
|
}; |
450 |
|
typedef Ref<IntBinaryOp,Node> IntBinaryOpRef; |
451 |
|
|
452 |
|
class VaritypeScalarBinaryOp : public ScalarNumberBinaryOp, virtual public IntExpr, virtual public RealExpr { |
453 |
|
public: |
454 |
|
VaritypeScalarBinaryOp(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : ScalarNumberBinaryOp(lhs, rhs) { } |
455 |
|
ExprType_t exprType() const OVERRIDE; |
456 |
|
String evalCastToStr() OVERRIDE; |
457 |
|
}; |
458 |
|
typedef Ref<VaritypeScalarBinaryOp,Node> VaritypeScalarBinaryOpRef; |
459 |
|
|
460 |
|
class Add FINAL : public VaritypeScalarBinaryOp { |
461 |
public: |
public: |
462 |
Add(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs, rhs) { } |
Add(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs); |
463 |
int evalInt(); |
vmint evalInt() OVERRIDE; |
464 |
void dump(int level = 0); |
vmfloat evalReal() OVERRIDE; |
465 |
|
vmfloat unitFactor() const OVERRIDE; |
466 |
|
void dump(int level = 0) OVERRIDE; |
467 |
}; |
}; |
468 |
typedef Ref<Add,Node> AddRef; |
typedef Ref<Add,Node> AddRef; |
469 |
|
|
470 |
class Sub : virtual public BinaryOp, virtual public IntExpr { |
class Sub FINAL : public VaritypeScalarBinaryOp { |
471 |
public: |
public: |
472 |
Sub(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs, rhs) { } |
Sub(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs); |
473 |
int evalInt(); |
vmint evalInt() OVERRIDE; |
474 |
void dump(int level = 0); |
vmfloat evalReal() OVERRIDE; |
475 |
|
vmfloat unitFactor() const OVERRIDE; |
476 |
|
void dump(int level = 0) OVERRIDE; |
477 |
}; |
}; |
478 |
typedef Ref<Sub,Node> SubRef; |
typedef Ref<Sub,Node> SubRef; |
479 |
|
|
480 |
class Mul : virtual public BinaryOp, virtual public IntExpr { |
class Mul FINAL : public VaritypeScalarBinaryOp { |
481 |
public: |
public: |
482 |
Mul(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs, rhs) { } |
Mul(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs); |
483 |
int evalInt(); |
vmint evalInt() OVERRIDE; |
484 |
void dump(int level = 0); |
vmfloat evalReal() OVERRIDE; |
485 |
|
vmfloat unitFactor() const OVERRIDE; |
486 |
|
void dump(int level = 0) OVERRIDE; |
487 |
}; |
}; |
488 |
typedef Ref<Mul,Node> MulRef; |
typedef Ref<Mul,Node> MulRef; |
489 |
|
|
490 |
class Div : virtual public BinaryOp, virtual public IntExpr { |
class Div FINAL : public VaritypeScalarBinaryOp { |
491 |
public: |
public: |
492 |
Div(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs, rhs) { } |
Div(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs); |
493 |
int evalInt(); |
vmint evalInt() OVERRIDE; |
494 |
void dump(int level = 0); |
vmfloat evalReal() OVERRIDE; |
495 |
|
void dump(int level = 0) OVERRIDE; |
496 |
|
vmfloat unitFactor() const OVERRIDE; |
497 |
}; |
}; |
498 |
typedef Ref<Div,Node> DivRef; |
typedef Ref<Div,Node> DivRef; |
499 |
|
|
500 |
class Mod : virtual public BinaryOp, virtual public IntExpr { |
class Mod FINAL : public IntBinaryOp { |
501 |
public: |
public: |
502 |
Mod(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs, rhs) { } |
Mod(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs, rhs), Unit(VM_NO_UNIT) { } |
503 |
int evalInt(); |
vmint evalInt() OVERRIDE; |
504 |
void dump(int level = 0); |
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
505 |
|
void dump(int level = 0) OVERRIDE; |
506 |
}; |
}; |
507 |
typedef Ref<Mod,Node> ModRef; |
typedef Ref<Mod,Node> ModRef; |
508 |
|
|
514 |
|
|
515 |
// Just used by parser to avoid "not a statement" parser warning, will be |
// Just used by parser to avoid "not a statement" parser warning, will be |
516 |
// filtered out by parser. So it will not be part of the VM tree after parsing. |
// filtered out by parser. So it will not be part of the VM tree after parsing. |
517 |
class NoOperation : public Statement { |
class NoOperation FINAL : public Statement { |
518 |
public: |
public: |
519 |
NoOperation() : Statement() {} |
NoOperation() : Statement() {} |
520 |
StmtType_t statementType() const { return STMT_LEAF; } |
StmtType_t statementType() const OVERRIDE { return STMT_NOOP; } |
521 |
void dump(int level = 0) {} |
void dump(int level = 0) OVERRIDE {} |
522 |
bool isPolyphonic() const { return false; } |
bool isPolyphonic() const OVERRIDE { return false; } |
523 |
}; |
}; |
524 |
typedef Ref<NoOperation,Node> NoOperationRef; |
typedef Ref<NoOperation,Node> NoOperationRef; |
525 |
|
|
528 |
class LeafStatement : public Statement { |
class LeafStatement : public Statement { |
529 |
public: |
public: |
530 |
virtual StmtFlags_t exec() = 0; |
virtual StmtFlags_t exec() = 0; |
531 |
virtual StmtType_t statementType() const { return STMT_LEAF; } |
StmtType_t statementType() const OVERRIDE { return STMT_LEAF; } |
532 |
}; |
}; |
533 |
typedef Ref<LeafStatement,Node> LeafStatementRef; |
typedef Ref<LeafStatement,Node> LeafStatementRef; |
534 |
|
|
536 |
std::vector<StatementRef> args; |
std::vector<StatementRef> args; |
537 |
public: |
public: |
538 |
void add(StatementRef arg) { args.push_back(arg); } |
void add(StatementRef arg) { args.push_back(arg); } |
539 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
540 |
StmtType_t statementType() const { return STMT_LIST; } |
StmtType_t statementType() const OVERRIDE { return STMT_LIST; } |
541 |
virtual Statement* statement(uint i); |
virtual Statement* statement(uint i); |
542 |
bool isPolyphonic() const; |
bool isPolyphonic() const OVERRIDE; |
543 |
}; |
}; |
544 |
typedef Ref<Statements,Node> StatementsRef; |
typedef Ref<Statements,Node> StatementsRef; |
545 |
|
|
546 |
class BranchStatement : public Statement { |
class BranchStatement : public Statement { |
547 |
public: |
public: |
548 |
StmtType_t statementType() const { return STMT_BRANCH; } |
StmtType_t statementType() const OVERRIDE { return STMT_BRANCH; } |
549 |
virtual int evalBranch() = 0; |
virtual vmint evalBranch() = 0; |
550 |
virtual Statements* branch(uint i) const = 0; |
virtual Statements* branch(vmuint i) const = 0; |
551 |
|
}; |
552 |
|
|
553 |
|
class DynamicVariableCall FINAL : public Variable, virtual public IntExpr, virtual public StringExpr, virtual public IntArrayExpr { |
554 |
|
VMDynVar* dynVar; |
555 |
|
String varName; |
556 |
|
public: |
557 |
|
DynamicVariableCall(const String& name, ParserContext* ctx, VMDynVar* v); |
558 |
|
ExprType_t exprType() const OVERRIDE { return dynVar->exprType(); } |
559 |
|
bool isConstExpr() const OVERRIDE { return dynVar->isConstExpr(); } |
560 |
|
bool isAssignable() const OVERRIDE { return dynVar->isAssignable(); } |
561 |
|
bool isPolyphonic() const OVERRIDE { return false; } |
562 |
|
void assign(Expression* expr) OVERRIDE { dynVar->assignExpr(expr); } |
563 |
|
VMIntArrayExpr* asIntArray() const OVERRIDE { return dynVar->asIntArray(); } |
564 |
|
vmint evalInt() OVERRIDE; |
565 |
|
String evalStr() OVERRIDE; |
566 |
|
String evalCastToStr() OVERRIDE; |
567 |
|
vmint arraySize() const OVERRIDE { return dynVar->asIntArray()->arraySize(); } |
568 |
|
vmint evalIntElement(vmuint i) OVERRIDE { return dynVar->asIntArray()->evalIntElement(i); } |
569 |
|
void assignIntElement(vmuint i, vmint value) OVERRIDE { return dynVar->asIntArray()->assignIntElement(i, value); } |
570 |
|
vmfloat unitFactorOfElement(vmuint i) const OVERRIDE { return VM_NO_FACTOR; } |
571 |
|
void assignElementUnitFactor(vmuint i, vmfloat factor) OVERRIDE {} |
572 |
|
void dump(int level = 0) OVERRIDE; |
573 |
|
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
574 |
|
bool isFinal() const OVERRIDE { return false; } |
575 |
}; |
}; |
576 |
|
typedef Ref<DynamicVariableCall,Node> DynamicVariableCallRef; |
577 |
|
|
578 |
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 { |
579 |
String functionName; |
String functionName; |
580 |
ArgsRef args; |
ArgsRef args; |
581 |
VMFunction* fn; |
VMFunction* fn; |
582 |
|
VMFnResult* result; |
583 |
public: |
public: |
584 |
FunctionCall(const char* function, ArgsRef args, VMFunction* fn) : |
FunctionCall(const char* function, ArgsRef args, VMFunction* fn); |
585 |
functionName(function), args(args), fn(fn) { } |
void dump(int level = 0) OVERRIDE; |
586 |
void dump(int level = 0); |
StmtFlags_t exec() OVERRIDE; |
587 |
StmtFlags_t exec(); |
vmint evalInt() OVERRIDE; |
588 |
int evalInt(); |
vmfloat evalReal() OVERRIDE; |
589 |
String evalStr(); |
VMIntArrayExpr* asIntArray() const OVERRIDE; |
590 |
bool isConstExpr() const { return false; } |
VMRealArrayExpr* asRealArray() const OVERRIDE; |
591 |
ExprType_t exprType() const; |
String evalStr() OVERRIDE; |
592 |
String evalCastToStr(); |
bool isConstExpr() const OVERRIDE { return false; } |
593 |
bool isPolyphonic() const { return args->isPolyphonic(); } |
ExprType_t exprType() const OVERRIDE; |
594 |
|
String evalCastToStr() OVERRIDE; |
595 |
|
bool isPolyphonic() const OVERRIDE { return args->isPolyphonic(); } |
596 |
|
vmfloat unitFactor() const OVERRIDE; |
597 |
|
bool isFinal() const OVERRIDE; |
598 |
protected: |
protected: |
599 |
VMFnResult* execVMFn(); |
VMFnResult* execVMFn(); |
600 |
}; |
}; |
601 |
typedef Ref<FunctionCall,Node> FunctionCallRef; |
typedef Ref<FunctionCall,Node> FunctionCallRef; |
602 |
|
|
603 |
|
class NoFunctionCall FINAL : public FunctionCall { |
604 |
|
public: |
605 |
|
NoFunctionCall() : FunctionCall("nothing", new Args, NULL), Unit(VM_NO_UNIT) {} |
606 |
|
StmtType_t statementType() const OVERRIDE { return STMT_NOOP; } |
607 |
|
}; |
608 |
|
typedef Ref<NoFunctionCall,Node> NoFunctionCallRef; |
609 |
|
|
610 |
class EventHandler : virtual public Statements, virtual public VMEventHandler { |
class EventHandler : virtual public Statements, virtual public VMEventHandler { |
611 |
StatementsRef statements; |
StatementsRef statements; |
612 |
bool usingPolyphonics; |
bool usingPolyphonics; |
613 |
public: |
public: |
614 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
615 |
StmtFlags_t exec(); |
StmtFlags_t exec(); |
616 |
EventHandler(StatementsRef statements); |
EventHandler(StatementsRef statements); |
617 |
Statement* statement(uint i) { return statements->statement(i); } |
Statement* statement(uint i) OVERRIDE { return statements->statement(i); } |
618 |
bool isPolyphonic() const { return usingPolyphonics; } |
bool isPolyphonic() const OVERRIDE { return usingPolyphonics; } |
619 |
}; |
}; |
620 |
typedef Ref<EventHandler,Node> EventHandlerRef; |
typedef Ref<EventHandler,Node> EventHandlerRef; |
621 |
|
|
622 |
class OnNote : public EventHandler { |
class OnNote FINAL : public EventHandler { |
623 |
public: |
public: |
624 |
OnNote(StatementsRef statements) : EventHandler(statements) {} |
OnNote(StatementsRef statements) : EventHandler(statements) {} |
625 |
VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_NOTE; } |
VMEventHandlerType_t eventHandlerType() const OVERRIDE { return VM_EVENT_HANDLER_NOTE; } |
626 |
String eventHandlerName() const { return "note"; } |
String eventHandlerName() const OVERRIDE { return "note"; } |
627 |
}; |
}; |
628 |
typedef Ref<OnNote,Node> OnNoteRef; |
typedef Ref<OnNote,Node> OnNoteRef; |
629 |
|
|
630 |
class OnInit : public EventHandler { |
class OnInit FINAL : public EventHandler { |
631 |
public: |
public: |
632 |
OnInit(StatementsRef statements) : EventHandler(statements) {} |
OnInit(StatementsRef statements) : EventHandler(statements) {} |
633 |
VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_INIT; } |
VMEventHandlerType_t eventHandlerType() const OVERRIDE { return VM_EVENT_HANDLER_INIT; } |
634 |
String eventHandlerName() const { return "init"; } |
String eventHandlerName() const OVERRIDE { return "init"; } |
635 |
}; |
}; |
636 |
typedef Ref<OnInit,Node> OnInitRef; |
typedef Ref<OnInit,Node> OnInitRef; |
637 |
|
|
638 |
class OnRelease : public EventHandler { |
class OnRelease FINAL : public EventHandler { |
639 |
public: |
public: |
640 |
OnRelease(StatementsRef statements) : EventHandler(statements) {} |
OnRelease(StatementsRef statements) : EventHandler(statements) {} |
641 |
VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_RELEASE; } |
VMEventHandlerType_t eventHandlerType() const OVERRIDE { return VM_EVENT_HANDLER_RELEASE; } |
642 |
String eventHandlerName() const { return "release"; } |
String eventHandlerName() const OVERRIDE { return "release"; } |
643 |
}; |
}; |
644 |
typedef Ref<OnRelease,Node> OnReleaseRef; |
typedef Ref<OnRelease,Node> OnReleaseRef; |
645 |
|
|
646 |
class OnController : public EventHandler { |
class OnController FINAL : public EventHandler { |
647 |
public: |
public: |
648 |
OnController(StatementsRef statements) : EventHandler(statements) {} |
OnController(StatementsRef statements) : EventHandler(statements) {} |
649 |
VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_CONTROLLER; } |
VMEventHandlerType_t eventHandlerType() const OVERRIDE { return VM_EVENT_HANDLER_CONTROLLER; } |
650 |
String eventHandlerName() const { return "controller"; } |
String eventHandlerName() const OVERRIDE { return "controller"; } |
651 |
}; |
}; |
652 |
typedef Ref<OnController,Node> OnControllerRef; |
typedef Ref<OnController,Node> OnControllerRef; |
653 |
|
|
654 |
class EventHandlers : virtual public Node { |
class EventHandlers FINAL : virtual public Node { |
655 |
std::vector<EventHandlerRef> args; |
std::vector<EventHandlerRef> args; |
656 |
public: |
public: |
657 |
EventHandlers(); |
EventHandlers(); |
658 |
~EventHandlers(); |
~EventHandlers(); |
659 |
void add(EventHandlerRef arg); |
void add(EventHandlerRef arg); |
660 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
|
int evalInt() { return 0; } |
|
661 |
EventHandler* eventHandlerByName(const String& name) const; |
EventHandler* eventHandlerByName(const String& name) const; |
662 |
EventHandler* eventHandler(uint index) const; |
EventHandler* eventHandler(uint index) const; |
663 |
inline uint size() const { return args.size(); } |
inline uint size() const { return (int) args.size(); } |
664 |
bool isPolyphonic() const; |
bool isPolyphonic() const OVERRIDE; |
665 |
}; |
}; |
666 |
typedef Ref<EventHandlers,Node> EventHandlersRef; |
typedef Ref<EventHandlers,Node> EventHandlersRef; |
667 |
|
|
668 |
class Assignment : public LeafStatement { |
class Assignment FINAL : public LeafStatement { |
669 |
protected: |
protected: |
670 |
VariableRef variable; |
VariableRef variable; |
671 |
ExpressionRef value; |
ExpressionRef value; |
672 |
public: |
public: |
673 |
Assignment(VariableRef variable, ExpressionRef value); |
Assignment(VariableRef variable, ExpressionRef value); |
674 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
675 |
StmtFlags_t exec(); |
StmtFlags_t exec() OVERRIDE; |
676 |
bool isPolyphonic() const { return (variable && variable->isPolyphonic()) || (value && value->isPolyphonic()); } |
bool isPolyphonic() const OVERRIDE { return (variable && variable->isPolyphonic()) || (value && value->isPolyphonic()); } |
677 |
}; |
}; |
678 |
typedef Ref<Assignment,Node> AssignmentRef; |
typedef Ref<Assignment,Node> AssignmentRef; |
679 |
|
|
680 |
class If : public BranchStatement { |
class If FINAL : public BranchStatement { |
681 |
IntExprRef condition; |
IntExprRef condition; |
682 |
StatementsRef ifStatements; |
StatementsRef ifStatements; |
683 |
StatementsRef elseStatements; |
StatementsRef elseStatements; |
686 |
condition(condition), ifStatements(ifStatements), elseStatements(elseStatements) { } |
condition(condition), ifStatements(ifStatements), elseStatements(elseStatements) { } |
687 |
If(IntExprRef condition, StatementsRef statements) : |
If(IntExprRef condition, StatementsRef statements) : |
688 |
condition(condition), ifStatements(statements) { } |
condition(condition), ifStatements(statements) { } |
689 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
690 |
int evalBranch(); |
vmint evalBranch() OVERRIDE; |
691 |
Statements* branch(uint i) const; |
Statements* branch(vmuint i) const OVERRIDE; |
692 |
bool isPolyphonic() const; |
bool isPolyphonic() const OVERRIDE; |
693 |
}; |
}; |
694 |
typedef Ref<If,Node> IfRef; |
typedef Ref<If,Node> IfRef; |
695 |
|
|
696 |
struct CaseBranch { |
struct CaseBranch FINAL { |
697 |
IntExprRef from; |
IntExprRef from; |
698 |
IntExprRef to; |
IntExprRef to; |
699 |
StatementsRef statements; |
StatementsRef statements; |
700 |
}; |
}; |
|
|
|
701 |
typedef std::vector<CaseBranch> CaseBranches; |
typedef std::vector<CaseBranch> CaseBranches; |
702 |
|
|
703 |
class SelectCase : public BranchStatement { |
class SelectCase FINAL : public BranchStatement { |
704 |
IntExprRef select; |
IntExprRef select; |
705 |
CaseBranches branches; |
CaseBranches branches; |
706 |
public: |
public: |
707 |
SelectCase(IntExprRef select, const CaseBranches& branches) : select(select), branches(branches) { } |
SelectCase(IntExprRef select, const CaseBranches& branches) : select(select), branches(branches) { } |
708 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
709 |
int evalBranch(); |
vmint evalBranch() OVERRIDE; |
710 |
Statements* branch(uint i) const; |
Statements* branch(vmuint i) const OVERRIDE; |
711 |
//void addBranch(IntExprRef condition, StatementsRef statements); |
bool isPolyphonic() const OVERRIDE; |
|
//void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements); |
|
|
//void addBranch(CaseBranchRef branch); |
|
|
//void addBranches(CaseBranchesRef branches); |
|
|
bool isPolyphonic() const; |
|
712 |
}; |
}; |
713 |
typedef Ref<SelectCase,Node> SelectCaseRef; |
typedef Ref<SelectCase,Node> SelectCaseRef; |
714 |
|
|
715 |
class While : public Statement { |
class While FINAL : public Statement { |
716 |
IntExprRef m_condition; |
IntExprRef m_condition; |
717 |
StatementsRef m_statements; |
StatementsRef m_statements; |
718 |
public: |
public: |
719 |
While(IntExprRef condition, StatementsRef statements) : |
While(IntExprRef condition, StatementsRef statements) : |
720 |
m_condition(condition), m_statements(statements) {} |
m_condition(condition), m_statements(statements) {} |
721 |
StmtType_t statementType() const { return STMT_LOOP; } |
StmtType_t statementType() const OVERRIDE { return STMT_LOOP; } |
722 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
723 |
bool evalLoopStartCondition(); |
bool evalLoopStartCondition(); |
724 |
Statements* statements() const; |
Statements* statements() const; |
725 |
bool isPolyphonic() const { return m_condition->isPolyphonic() || m_statements->isPolyphonic(); } |
bool isPolyphonic() const OVERRIDE { return m_condition->isPolyphonic() || m_statements->isPolyphonic(); } |
726 |
}; |
}; |
727 |
|
|
728 |
class Neg : public IntExpr { |
class SyncBlock FINAL : public Statement { |
729 |
IntExprRef expr; |
StatementsRef m_statements; |
730 |
public: |
public: |
731 |
Neg(IntExprRef expr) : expr(expr) { } |
SyncBlock(StatementsRef statements) : m_statements(statements) {} |
732 |
int evalInt() { return (expr) ? -expr->evalInt() : 0; } |
StmtType_t statementType() const OVERRIDE { return STMT_SYNC; } |
733 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
734 |
bool isConstExpr() const { return expr->isConstExpr(); } |
Statements* statements() const; |
735 |
bool isPolyphonic() const { return expr->isPolyphonic(); } |
bool isPolyphonic() const OVERRIDE { return m_statements->isPolyphonic(); } |
736 |
|
}; |
737 |
|
typedef Ref<SyncBlock,Node> SyncBlockRef; |
738 |
|
|
739 |
|
class Neg FINAL : virtual public IntExpr, virtual public RealExpr { |
740 |
|
ScalarNumberExprRef expr; |
741 |
|
public: |
742 |
|
Neg(ScalarNumberExprRef expr) : Unit(expr->unitType()), expr(expr) { } |
743 |
|
ExprType_t exprType() const OVERRIDE { return expr->exprType(); } |
744 |
|
vmint evalInt() OVERRIDE { return (expr) ? -(expr->asInt()->evalInt()) : 0; } |
745 |
|
vmfloat evalReal() OVERRIDE { return (expr) ? -(expr->asReal()->evalReal()) : vmfloat(0); } |
746 |
|
String evalCastToStr() OVERRIDE; |
747 |
|
void dump(int level = 0) OVERRIDE; |
748 |
|
bool isConstExpr() const OVERRIDE { return expr->isConstExpr(); } |
749 |
|
bool isPolyphonic() const OVERRIDE { return expr->isPolyphonic(); } |
750 |
|
vmfloat unitFactor() const OVERRIDE { return expr->unitFactor(); } |
751 |
|
bool isFinal() const OVERRIDE { return expr->isFinal(); } |
752 |
}; |
}; |
753 |
typedef Ref<Neg,Node> NegRef; |
typedef Ref<Neg,Node> NegRef; |
754 |
|
|
755 |
class ConcatString : public StringExpr { |
class ConcatString FINAL : public StringExpr { |
756 |
ExpressionRef lhs; |
ExpressionRef lhs; |
757 |
ExpressionRef rhs; |
ExpressionRef rhs; |
758 |
public: |
public: |
759 |
ConcatString(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) {} |
ConcatString(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) {} |
760 |
String evalStr(); |
String evalStr() OVERRIDE; |
761 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
762 |
bool isConstExpr() const; |
bool isConstExpr() const OVERRIDE; |
763 |
bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); } |
bool isPolyphonic() const OVERRIDE { return lhs->isPolyphonic() || rhs->isPolyphonic(); } |
764 |
}; |
}; |
765 |
typedef Ref<ConcatString,Node> ConcatStringRef; |
typedef Ref<ConcatString,Node> ConcatStringRef; |
766 |
|
|
767 |
class Relation : public IntExpr { |
class Relation FINAL : public IntExpr { |
768 |
public: |
public: |
769 |
enum Type { |
enum Type { |
770 |
LESS_THAN, |
LESS_THAN, |
774 |
EQUAL, |
EQUAL, |
775 |
NOT_EQUAL |
NOT_EQUAL |
776 |
}; |
}; |
777 |
Relation(IntExprRef lhs, Type type, IntExprRef rhs) : |
Relation(ExpressionRef lhs, Type type, ExpressionRef rhs); |
778 |
lhs(lhs), rhs(rhs), type(type) {} |
vmint evalInt() OVERRIDE; |
779 |
int evalInt(); |
void dump(int level = 0) OVERRIDE; |
780 |
void dump(int level = 0); |
bool isConstExpr() const OVERRIDE; |
781 |
bool isConstExpr() const; |
bool isPolyphonic() const OVERRIDE { return lhs->isPolyphonic() || rhs->isPolyphonic(); } |
782 |
bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); } |
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
783 |
|
bool isFinal() const OVERRIDE { return false; } |
784 |
private: |
private: |
785 |
IntExprRef lhs; |
ExpressionRef lhs; |
786 |
IntExprRef rhs; |
ExpressionRef rhs; |
787 |
Type type; |
Type type; |
788 |
}; |
}; |
789 |
typedef Ref<Relation,Node> RelationRef; |
typedef Ref<Relation,Node> RelationRef; |
790 |
|
|
791 |
class Or : virtual public BinaryOp, virtual public IntExpr { |
class Or FINAL : public IntBinaryOp { |
792 |
public: |
public: |
793 |
Or(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {} |
Or(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs,rhs), Unit(VM_NO_UNIT) {} |
794 |
int evalInt(); |
vmint evalInt() OVERRIDE; |
795 |
void dump(int level = 0); |
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
796 |
|
void dump(int level = 0) OVERRIDE; |
797 |
}; |
}; |
798 |
typedef Ref<Or,Node> OrRef; |
typedef Ref<Or,Node> OrRef; |
799 |
|
|
800 |
class And : virtual public BinaryOp, virtual public IntExpr { |
class BitwiseOr FINAL : public IntBinaryOp { |
801 |
public: |
public: |
802 |
And(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {} |
BitwiseOr(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs,rhs), Unit(VM_NO_UNIT) {} |
803 |
int evalInt(); |
vmint evalInt() OVERRIDE; |
804 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
805 |
|
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
806 |
|
}; |
807 |
|
typedef Ref<BitwiseOr,Node> BitwiseOrRef; |
808 |
|
|
809 |
|
class And FINAL : public IntBinaryOp { |
810 |
|
public: |
811 |
|
And(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs,rhs), Unit(VM_NO_UNIT) {} |
812 |
|
vmint evalInt() OVERRIDE; |
813 |
|
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
814 |
|
void dump(int level = 0) OVERRIDE; |
815 |
}; |
}; |
816 |
typedef Ref<And,Node> AndRef; |
typedef Ref<And,Node> AndRef; |
817 |
|
|
818 |
class Not : virtual public IntExpr { |
class BitwiseAnd FINAL : public IntBinaryOp { |
819 |
|
public: |
820 |
|
BitwiseAnd(IntExprRef lhs, IntExprRef rhs) : IntBinaryOp(lhs,rhs), Unit(VM_NO_UNIT) {} |
821 |
|
vmint evalInt() OVERRIDE; |
822 |
|
void dump(int level = 0) OVERRIDE; |
823 |
|
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
824 |
|
}; |
825 |
|
typedef Ref<BitwiseAnd,Node> BitwiseAndRef; |
826 |
|
|
827 |
|
class Not FINAL : virtual public IntExpr { |
828 |
IntExprRef expr; |
IntExprRef expr; |
829 |
public: |
public: |
830 |
Not(IntExprRef expr) : expr(expr) {} |
Not(IntExprRef expr) : Unit(VM_NO_UNIT), expr(expr) {} |
831 |
int evalInt() { return !expr->evalInt(); } |
vmint evalInt() OVERRIDE { return !expr->evalInt(); } |
832 |
void dump(int level = 0); |
void dump(int level = 0) OVERRIDE; |
833 |
bool isConstExpr() const { return expr->isConstExpr(); } |
bool isConstExpr() const OVERRIDE { return expr->isConstExpr(); } |
834 |
bool isPolyphonic() const { return expr->isPolyphonic(); } |
bool isPolyphonic() const OVERRIDE { return expr->isPolyphonic(); } |
835 |
|
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
836 |
|
bool isFinal() const OVERRIDE { return expr->isFinal(); } |
837 |
}; |
}; |
838 |
typedef Ref<Not,Node> NotRef; |
typedef Ref<Not,Node> NotRef; |
839 |
|
|
840 |
class ParserContext : public VMParserContext { |
class BitwiseNot FINAL : virtual public IntExpr { |
841 |
|
IntExprRef expr; |
842 |
|
public: |
843 |
|
BitwiseNot(IntExprRef expr) : Unit(VM_NO_UNIT), expr(expr) {} |
844 |
|
vmint evalInt() OVERRIDE { return ~expr->evalInt(); } |
845 |
|
void dump(int level = 0) OVERRIDE; |
846 |
|
bool isConstExpr() const OVERRIDE { return expr->isConstExpr(); } |
847 |
|
bool isPolyphonic() const OVERRIDE { return expr->isPolyphonic(); } |
848 |
|
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
849 |
|
bool isFinal() const OVERRIDE { return expr->isFinal(); } |
850 |
|
}; |
851 |
|
typedef Ref<BitwiseNot,Node> BitwiseNotRef; |
852 |
|
|
853 |
|
class Final FINAL : virtual public IntExpr, virtual public RealExpr { |
854 |
|
ScalarNumberExprRef expr; |
855 |
|
public: |
856 |
|
Final(ScalarNumberExprRef expr) : Unit(expr->unitType()), expr(expr) {} |
857 |
|
ExprType_t exprType() const OVERRIDE { return expr->exprType(); } |
858 |
|
vmint evalInt() OVERRIDE { return expr->asInt()->evalInt(); } |
859 |
|
vmfloat evalReal() OVERRIDE { return expr->asReal()->evalReal(); } |
860 |
|
String evalCastToStr() OVERRIDE; |
861 |
|
void dump(int level = 0) OVERRIDE; |
862 |
|
bool isConstExpr() const OVERRIDE { return expr->isConstExpr(); } |
863 |
|
bool isPolyphonic() const OVERRIDE { return expr->isPolyphonic(); } |
864 |
|
vmfloat unitFactor() const OVERRIDE { return expr->unitFactor(); } |
865 |
|
bool isFinal() const OVERRIDE { return true; } |
866 |
|
}; |
867 |
|
typedef Ref<Final,Node> FinalRef; |
868 |
|
|
869 |
|
class ParserContext FINAL : public VMParserContext { |
870 |
public: |
public: |
871 |
struct Error { |
struct Error { |
872 |
String txt; |
String txt; |
879 |
std::vector<ParserIssue> vErrors; |
std::vector<ParserIssue> vErrors; |
880 |
std::vector<ParserIssue> vWarnings; |
std::vector<ParserIssue> vWarnings; |
881 |
std::vector<ParserIssue> vIssues; |
std::vector<ParserIssue> vIssues; |
882 |
|
std::vector<CodeBlock> vPreprocessorComments; |
883 |
|
|
884 |
std::set<String> builtinPreprocessorConditions; |
std::set<String> builtinPreprocessorConditions; |
885 |
std::set<String> userPreprocessorConditions; |
std::set<String> userPreprocessorConditions; |
886 |
|
|
887 |
std::map<String,VariableRef> vartable; |
std::map<String,VariableRef> vartable; |
888 |
int globalIntVarCount; |
std::map<String,StatementsRef> userFnTable; |
889 |
int globalStrVarCount; |
vmint globalIntVarCount; |
890 |
int polyphonicIntVarCount; |
vmint globalRealVarCount; |
891 |
|
vmint globalStrVarCount; |
892 |
|
vmint globalUnitFactorCount; |
893 |
|
vmint polyphonicIntVarCount; |
894 |
|
vmint polyphonicRealVarCount; |
895 |
|
vmint polyphonicUnitFactorCount; |
896 |
|
|
897 |
EventHandlersRef handlers; |
EventHandlersRef handlers; |
898 |
|
|
901 |
OnReleaseRef onRelease; |
OnReleaseRef onRelease; |
902 |
OnControllerRef onController; |
OnControllerRef onController; |
903 |
|
|
904 |
ArrayList<int>* globalIntMemory; |
ArrayList<vmint>* globalIntMemory; |
905 |
|
ArrayList<vmfloat>* globalRealMemory; |
906 |
ArrayList<String>* globalStrMemory; |
ArrayList<String>* globalStrMemory; |
907 |
int requiredMaxStackSize; |
ArrayList<vmfloat>* globalUnitFactorMemory; |
908 |
|
vmint requiredMaxStackSize; |
909 |
|
|
910 |
VMFunctionProvider* functionProvider; |
VMFunctionProvider* functionProvider; |
911 |
|
|
913 |
|
|
914 |
ParserContext(VMFunctionProvider* parent) : |
ParserContext(VMFunctionProvider* parent) : |
915 |
scanner(NULL), is(NULL), |
scanner(NULL), is(NULL), |
916 |
globalIntVarCount(0), globalStrVarCount(0), polyphonicIntVarCount(0), |
globalIntVarCount(0), globalRealVarCount(0), globalStrVarCount(0), |
917 |
globalIntMemory(NULL), globalStrMemory(NULL), requiredMaxStackSize(-1), |
globalUnitFactorCount(0), |
918 |
|
polyphonicIntVarCount(0), polyphonicRealVarCount(0), |
919 |
|
polyphonicUnitFactorCount(0), |
920 |
|
globalIntMemory(NULL), globalRealMemory(NULL), globalStrMemory(NULL), |
921 |
|
globalUnitFactorMemory(NULL), |
922 |
|
requiredMaxStackSize(-1), |
923 |
functionProvider(parent), execContext(NULL) |
functionProvider(parent), execContext(NULL) |
924 |
{ |
{ |
925 |
} |
} |
926 |
virtual ~ParserContext(); |
virtual ~ParserContext(); |
927 |
VariableRef globalVar(const String& name); |
VariableRef globalVar(const String& name); |
928 |
IntVariableRef globalIntVar(const String& name); |
IntVariableRef globalIntVar(const String& name); |
929 |
|
RealVariableRef globalRealVar(const String& name); |
930 |
StringVariableRef globalStrVar(const String& name); |
StringVariableRef globalStrVar(const String& name); |
931 |
VariableRef variableByName(const String& name); |
VariableRef variableByName(const String& name); |
932 |
void addErr(int line, const char* txt); |
StatementsRef userFunctionByName(const String& name); |
933 |
void addWrn(int line, const char* txt); |
void addErr(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt); |
934 |
|
void addWrn(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt); |
935 |
|
void addPreprocessorComment(int firstLine, int lastLine, int firstColumn, int lastColumn); |
936 |
void createScanner(std::istream* is); |
void createScanner(std::istream* is); |
937 |
void destroyScanner(); |
void destroyScanner(); |
938 |
bool setPreprocessorCondition(const char* name); |
bool setPreprocessorCondition(const char* name); |
941 |
std::vector<ParserIssue> issues() const OVERRIDE; |
std::vector<ParserIssue> issues() const OVERRIDE; |
942 |
std::vector<ParserIssue> errors() const OVERRIDE; |
std::vector<ParserIssue> errors() const OVERRIDE; |
943 |
std::vector<ParserIssue> warnings() const OVERRIDE; |
std::vector<ParserIssue> warnings() const OVERRIDE; |
944 |
|
std::vector<CodeBlock> preprocessorComments() const OVERRIDE; |
945 |
VMEventHandler* eventHandler(uint index) OVERRIDE; |
VMEventHandler* eventHandler(uint index) OVERRIDE; |
946 |
VMEventHandler* eventHandlerByName(const String& name) OVERRIDE; |
VMEventHandler* eventHandlerByName(const String& name) OVERRIDE; |
947 |
void registerBuiltInConstIntVariables(const std::map<String,int>& vars); |
void registerBuiltInConstIntVariables(const std::map<String,vmint>& vars); |
948 |
void registerBuiltInIntVariables(const std::map<String,VMIntRelPtr*>& vars); |
void registerBuiltInIntVariables(const std::map<String,VMIntPtr*>& vars); |
949 |
void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars); |
void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars); |
950 |
|
void registerBuiltInDynVariables(const std::map<String,VMDynVar*>& vars); |
951 |
}; |
}; |
952 |
|
|
953 |
class ExecContext : public VMExecContext { |
class ExecContext FINAL : public VMExecContext { |
954 |
public: |
public: |
955 |
struct StackFrame { |
struct StackFrame { |
956 |
Statement* statement; |
Statement* statement; |
962 |
} |
} |
963 |
}; |
}; |
964 |
|
|
965 |
ArrayList<int> polyphonicIntMemory; |
ArrayList<vmint> polyphonicIntMemory; |
966 |
|
ArrayList<vmfloat> polyphonicRealMemory; |
967 |
|
ArrayList<vmfloat> polyphonicUnitFactorMemory; |
968 |
VMExecStatus_t status; |
VMExecStatus_t status; |
969 |
|
StmtFlags_t flags; |
970 |
ArrayList<StackFrame> stack; |
ArrayList<StackFrame> stack; |
971 |
int stackFrame; |
int stackFrame; |
972 |
int suspendMicroseconds; |
vmint suspendMicroseconds; |
973 |
|
size_t instructionsCount; |
974 |
ExecContext() : |
struct ExitRes { |
975 |
status(VM_EXEC_NOT_RUNNING), stackFrame(-1), suspendMicroseconds(0) {} |
Expression* value; |
976 |
|
IntLiteral intLiteral; |
977 |
|
RealLiteral realLiteral; |
978 |
|
StringLiteral stringLiteral; |
979 |
|
|
980 |
|
ExitRes() : |
981 |
|
intLiteral({ .value = 0 }), realLiteral({ .value = 0.0 }), |
982 |
|
stringLiteral("") { } |
983 |
|
} exitRes; |
984 |
|
|
985 |
|
ExecContext(); |
986 |
virtual ~ExecContext() {} |
virtual ~ExecContext() {} |
987 |
|
|
988 |
inline void pushStack(Statement* stmt) { |
inline void pushStack(Statement* stmt) { |
1004 |
stack[0].statement = NULL; |
stack[0].statement = NULL; |
1005 |
stack[0].subindex = -1; |
stack[0].subindex = -1; |
1006 |
stackFrame = -1; |
stackFrame = -1; |
1007 |
|
flags = STMT_SUCCESS; |
1008 |
|
} |
1009 |
|
|
1010 |
|
inline void clearExitRes() { |
1011 |
|
exitRes.value = NULL; |
1012 |
} |
} |
1013 |
|
|
1014 |
int suspensionTimeMicroseconds() const OVERRIDE { |
vmint suspensionTimeMicroseconds() const OVERRIDE { |
1015 |
return suspendMicroseconds; |
return suspendMicroseconds; |
1016 |
} |
} |
1017 |
|
|
1018 |
|
void resetPolyphonicData() OVERRIDE { |
1019 |
|
if (!polyphonicIntMemory.empty()) |
1020 |
|
memset(&polyphonicIntMemory[0], 0, polyphonicIntMemory.size() * sizeof(vmint)); |
1021 |
|
if (!polyphonicRealMemory.empty()) |
1022 |
|
memset(&polyphonicRealMemory[0], 0, polyphonicRealMemory.size() * sizeof(vmfloat)); |
1023 |
|
if (!polyphonicUnitFactorMemory.empty()) { |
1024 |
|
const vmint sz = polyphonicUnitFactorMemory.size(); |
1025 |
|
for (vmint i = 0; i < sz; ++i) |
1026 |
|
polyphonicUnitFactorMemory[i] = VM_NO_FACTOR; |
1027 |
|
} |
1028 |
|
} |
1029 |
|
|
1030 |
|
size_t instructionsPerformed() const OVERRIDE { |
1031 |
|
return instructionsCount; |
1032 |
|
} |
1033 |
|
|
1034 |
|
void signalAbort() OVERRIDE { |
1035 |
|
flags = StmtFlags_t(flags | STMT_ABORT_SIGNALLED); |
1036 |
|
} |
1037 |
|
|
1038 |
|
void forkTo(VMExecContext* ectx) const OVERRIDE; |
1039 |
|
|
1040 |
|
VMExpr* exitResult() OVERRIDE { |
1041 |
|
return exitRes.value; |
1042 |
|
} |
1043 |
}; |
}; |
1044 |
|
|
1045 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |