/[svn]/linuxsampler/trunk/src/scriptvm/tree.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/scriptvm/tree.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3590 - (show annotations) (download) (as text)
Mon Sep 2 09:03:31 2019 UTC (4 years, 7 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 38947 byte(s)
NKSP: Implemented common real number math functions.

* Added built-in real number functions "round()", "ceil()", "floor()",
  "sqrt()", "log()", "log2()", "log10()", "exp()", "pow()", "sin()",
  "cos()", "tan()", "asin()", "acos()", "atan()".

* Added built-in script real number constant "~NI_MATH_PI".

* Added built-in script real number constant "~NI_MATH_E".

* Added NKSP test cases for built-in functions "round()", "ceil()",
  "floor()", "sqrt()", "log()", "log2()", "log10()", "exp()", "pow()",
  "sin()", "cos()", "tan()", "asin()", "acos()", "atan()".

* Bumped version (2.1.1.svn14).

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

  ViewVC Help
Powered by ViewVC