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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2588 by schoenebeck, Sun Jun 1 14:44:38 2014 UTC revision 3253 by schoenebeck, Tue May 30 12:08:45 2017 UTC
# Line 1  Line 1 
1  /*                                                              -*- c++ -*-  /*                                                              -*- c++ -*-
2   *   *
3   * Copyright (c) 2014 Christian Schoenebeck and Andreas Persson   * Copyright (c) 2014 - 2017 Christian Schoenebeck and Andreas Persson
4   *   *
5   * http://www.linuxsampler.org   * http://www.linuxsampler.org
6   *   *
# Line 20  Line 20 
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"
# Line 42  public: Line 43  public:
43      Node();      Node();
44      virtual ~Node();      virtual ~Node();
45      virtual void dump(int level = 0) = 0;      virtual void dump(int level = 0) = 0;
46        virtual bool isPolyphonic() const = 0;
47      void printIndents(int n);      void printIndents(int n);
48  };  };
49  typedef Ref<Node> NodeRef;  typedef Ref<Node> NodeRef;
# Line 62  public: Line 64  public:
64  };  };
65  typedef Ref<IntExpr,Node> IntExprRef;  typedef Ref<IntExpr,Node> IntExprRef;
66    
67    /*class IntArrayExpr : virtual public VMIntArrayExpr, virtual public Expression {
68    public:
69        ExprType_t exprType() const { return INT_ARR_EXPR; }
70        String evalCastToStr();
71    };
72    typedef Ref<IntArrayExpr,Node> IntArrayExprRef;*/
73    
74  class StringExpr : virtual public VMStringExpr, virtual public Expression {  class StringExpr : virtual public VMStringExpr, virtual public Expression {
75  public:  public:
76      ExprType_t exprType() const { return STRING_EXPR; }      ExprType_t exprType() const { return STRING_EXPR; }
# Line 77  public: Line 86  public:
86      int evalInt();      int evalInt();
87      void dump(int level = 0);      void dump(int level = 0);
88      bool isConstExpr() const { return true; }      bool isConstExpr() const { return true; }
89        bool isPolyphonic() const { return false; }
90  };  };
91  typedef Ref<IntLiteral,Node> IntLiteralRef;  typedef Ref<IntLiteral,Node> IntLiteralRef;
92    
# Line 87  public: Line 97  public:
97      bool isConstExpr() const { return true; }      bool isConstExpr() const { return true; }
98      void dump(int level = 0);      void dump(int level = 0);
99      String evalStr() { return value; }      String evalStr() { return value; }
100        bool isPolyphonic() const { return false; }
101  };  };
102  typedef Ref<StringLiteral,Node> StringLiteralRef;  typedef Ref<StringLiteral,Node> StringLiteralRef;
103    
# Line 95  public: Line 106  public:
106      std::vector<ExpressionRef> args;      std::vector<ExpressionRef> args;
107      void add(ExpressionRef arg) { args.push_back(arg); }      void add(ExpressionRef arg) { args.push_back(arg); }
108      void dump(int level = 0);      void dump(int level = 0);
109      int argsCount() const { return args.size(); }      int argsCount() const { return (int) args.size(); }
110      VMExpr* arg(int i) { return (i >= 0 && i < argsCount()) ? &*args.at(i) : NULL; }      VMExpr* arg(int i) { return (i >= 0 && i < argsCount()) ? &*args.at(i) : NULL; }
111        bool isPolyphonic() const;
112  };  };
113  typedef Ref<Args,Node> ArgsRef;  typedef Ref<Args,Node> ArgsRef;
114    
115  class Variable : virtual public Expression {  class Variable : virtual public VMVariable, virtual public Expression {
116  public:  public:
117      virtual bool isConstExpr() const { return bConst; }      bool isConstExpr() const OVERRIDE { return bConst; }
118        bool isAssignable() const OVERRIDE { return !bConst; }
119      virtual void assign(Expression* expr) = 0;      virtual void assign(Expression* expr) = 0;
120        void assignExpr(VMExpr* expr) OVERRIDE { Expression* e = dynamic_cast<Expression*>(expr); if (e) assign(e); }
121  protected:  protected:
122      Variable(ParserContext* ctx, int _memPos, bool _bConst)      Variable(ParserContext* ctx, int _memPos, bool _bConst)
123          : context(ctx), memPos(_memPos), bConst(_bConst) {}          : context(ctx), memPos(_memPos), bConst(_bConst) {}
# Line 139  public: Line 153  public:
153  };  };
154  typedef Ref<ConstIntVariable,Node> ConstIntVariableRef;  typedef Ref<ConstIntVariable,Node> ConstIntVariableRef;
155    
156    class BuiltInIntVariable : public IntVariable {
157        String name;
158        VMIntRelPtr* ptr;
159    public:
160        BuiltInIntVariable(const String& name, VMIntRelPtr* ptr);
161        bool isAssignable() const OVERRIDE { return !ptr->readonly; }
162        void assign(Expression* expr) OVERRIDE;
163        int evalInt() OVERRIDE;
164        void dump(int level = 0) OVERRIDE;
165    };
166    typedef Ref<BuiltInIntVariable,Node> BuiltInIntVariableRef;
167    
168  class PolyphonicIntVariable : public IntVariable {  class PolyphonicIntVariable : public IntVariable {
169  public:  public:
170      PolyphonicIntVariable(ParserContext* ctx);      PolyphonicIntVariable(ParserContext* ctx);
# Line 146  public: Line 172  public:
172  };  };
173  typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef;  typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef;
174    
175  class IntArrayVariable : public Variable {  class IntArrayVariable : public Variable, virtual public VMIntArrayExpr {
176      ArrayList<int> values;      ArrayList<int> values;
177  public:  public:
178      IntArrayVariable(ParserContext* ctx, int size);      IntArrayVariable(ParserContext* ctx, int size);
179      IntArrayVariable(ParserContext* ctx, int size, ArgsRef values);      IntArrayVariable(ParserContext* ctx, int size, ArgsRef values);
180      void assign(Expression* expr) {} // ignore scalar assignment      void assign(Expression* expr) {} // ignore scalar assignment
181      String evalCastToStr() { return ""; } // ignore cast to string      String evalCastToStr() { return ""; } // ignore scalar cast to string
182      ExprType_t exprType() const { return INT_ARR_EXPR; }      ExprType_t exprType() const { return INT_ARR_EXPR; }
183      const int arraySize() const { return values.size(); }      virtual int arraySize() const { return values.size(); }
184        virtual int evalIntElement(uint i);
185        virtual void assignIntElement(uint i, int value);
186        void dump(int level = 0);
187        bool isPolyphonic() const { return false; }
188    protected:
189        IntArrayVariable(ParserContext* ctx, bool bConst);
190    };
191    typedef Ref<IntArrayVariable,Node> IntArrayVariableRef;
192    
193    class BuiltInIntArrayVariable : public IntArrayVariable {
194        String name;
195        VMInt8Array* array;
196    public:
197        BuiltInIntArrayVariable(const String& name, VMInt8Array* array);
198        int arraySize() const { return array->size; }
199      int evalIntElement(uint i);      int evalIntElement(uint i);
200        bool isAssignable() const OVERRIDE { return !array->readonly; }
201      void assignIntElement(uint i, int value);      void assignIntElement(uint i, int value);
202      void dump(int level = 0);      void dump(int level = 0);
203  };  };
204  typedef Ref<IntArrayVariable,Node> IntArrayVariableRef;  typedef Ref<BuiltInIntArrayVariable,Node> BuiltInIntArrayVariableRef;
205    
206  class IntArrayElement : public IntVariable {  class IntArrayElement : public IntVariable {
207      IntArrayVariableRef array;      IntArrayVariableRef array;
# Line 178  public: Line 220  public:
220      void assign(Expression* expr);      void assign(Expression* expr);
221      String evalStr();      String evalStr();
222      void dump(int level = 0);      void dump(int level = 0);
223        bool isPolyphonic() const { return false; }
224  protected:  protected:
225      StringVariable(ParserContext* ctx, bool bConst);      StringVariable(ParserContext* ctx, bool bConst);
226  };  };
# Line 201  protected: Line 244  protected:
244  public:  public:
245      BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { }      BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { }
246      bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); }      bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); }
247        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
248  };  };
249  typedef Ref<BinaryOp,Node> BinaryOpRef;  typedef Ref<BinaryOp,Node> BinaryOpRef;
250    
# Line 257  public: Line 301  public:
301      NoOperation() : Statement() {}      NoOperation() : Statement() {}
302      StmtType_t statementType() const { return STMT_LEAF; }      StmtType_t statementType() const { return STMT_LEAF; }
303      void dump(int level = 0) {}      void dump(int level = 0) {}
304        bool isPolyphonic() const { return false; }
305  };  };
306  typedef Ref<NoOperation,Node> NoOperationRef;  typedef Ref<NoOperation,Node> NoOperationRef;
307    
# Line 276  public: Line 321  public:
321      void dump(int level = 0);      void dump(int level = 0);
322      StmtType_t statementType() const { return STMT_LIST; }      StmtType_t statementType() const { return STMT_LIST; }
323      virtual Statement* statement(uint i);      virtual Statement* statement(uint i);
324        bool isPolyphonic() const;
325  };  };
326  typedef Ref<Statements,Node> StatementsRef;  typedef Ref<Statements,Node> StatementsRef;
327    
# Line 286  public: Line 332  public:
332      virtual Statements* branch(uint i) const = 0;      virtual Statements* branch(uint i) const = 0;
333  };  };
334    
335    class DynamicVariableCall : public Variable, virtual public IntExpr, virtual public StringExpr {
336        VMDynVar* dynVar;
337        String varName;
338    public:
339        DynamicVariableCall(const String& name, ParserContext* ctx, VMDynVar* v);
340        ExprType_t exprType() const OVERRIDE { return dynVar->exprType(); }
341        bool isConstExpr() const OVERRIDE { return dynVar->isConstExpr(); }
342        bool isAssignable() const OVERRIDE { return dynVar->isAssignable(); }
343        bool isPolyphonic() const OVERRIDE { return false; }
344        void assign(Expression* expr) OVERRIDE { dynVar->assignExpr(expr); }
345        VMIntArrayExpr* asIntArray() const OVERRIDE { return dynVar->asIntArray(); }
346        int evalInt() OVERRIDE;
347        String evalStr() OVERRIDE;
348        String evalCastToStr() OVERRIDE;
349        void dump(int level = 0) OVERRIDE;
350    };
351    typedef Ref<DynamicVariableCall,Node> DynamicVariableCallRef;
352    
353  class FunctionCall : virtual public LeafStatement, virtual public IntExpr, virtual public StringExpr {  class FunctionCall : virtual public LeafStatement, virtual public IntExpr, virtual public StringExpr {
354      String functionName;      String functionName;
355      ArgsRef args;      ArgsRef args;
# Line 293  class FunctionCall : virtual public Leaf Line 357  class FunctionCall : virtual public Leaf
357  public:  public:
358      FunctionCall(const char* function, ArgsRef args, VMFunction* fn) :      FunctionCall(const char* function, ArgsRef args, VMFunction* fn) :
359          functionName(function), args(args), fn(fn) { }          functionName(function), args(args), fn(fn) { }
360      void dump(int level = 0);      void dump(int level = 0) OVERRIDE;
361      StmtFlags_t exec();      StmtFlags_t exec() OVERRIDE;
362      int evalInt();      int evalInt() OVERRIDE;
363      String evalStr();      VMIntArrayExpr* asIntArray() const OVERRIDE;
364      bool isConstExpr() const { return false; }      String evalStr() OVERRIDE;
365      ExprType_t exprType() const;      bool isConstExpr() const OVERRIDE { return false; }
366      String evalCastToStr();      ExprType_t exprType() const OVERRIDE;
367        String evalCastToStr() OVERRIDE;
368        bool isPolyphonic() const OVERRIDE { return args->isPolyphonic(); }
369  protected:  protected:
370      VMFnResult* execVMFn();      VMFnResult* execVMFn();
371  };  };
# Line 307  typedef Ref<FunctionCall,Node> FunctionC Line 373  typedef Ref<FunctionCall,Node> FunctionC
373    
374  class EventHandler : virtual public Statements, virtual public VMEventHandler {  class EventHandler : virtual public Statements, virtual public VMEventHandler {
375      StatementsRef statements;      StatementsRef statements;
376        bool usingPolyphonics;
377  public:  public:
378      void dump(int level = 0);      void dump(int level = 0);
379      StmtFlags_t exec();      StmtFlags_t exec();
380      EventHandler(StatementsRef statements) { this->statements = statements; }      EventHandler(StatementsRef statements);
381      Statement* statement(uint i) { return statements->statement(i); }      Statement* statement(uint i) { return statements->statement(i); }
382        bool isPolyphonic() const { return usingPolyphonics; }
383  };  };
384  typedef Ref<EventHandler,Node> EventHandlerRef;  typedef Ref<EventHandler,Node> EventHandlerRef;
385    
386  class OnNote : public EventHandler {  class OnNote : public EventHandler {
387  public:  public:
388      OnNote(StatementsRef statements) : EventHandler(statements) {}      OnNote(StatementsRef statements) : EventHandler(statements) {}
389        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_NOTE; }
390      String eventHandlerName() const { return "note"; }      String eventHandlerName() const { return "note"; }
391  };  };
392  typedef Ref<OnNote,Node> OnNoteRef;  typedef Ref<OnNote,Node> OnNoteRef;
# Line 325  typedef Ref<OnNote,Node> OnNoteRef; Line 394  typedef Ref<OnNote,Node> OnNoteRef;
394  class OnInit : public EventHandler {  class OnInit : public EventHandler {
395  public:  public:
396      OnInit(StatementsRef statements) : EventHandler(statements) {}      OnInit(StatementsRef statements) : EventHandler(statements) {}
397        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_INIT; }
398      String eventHandlerName() const { return "init"; }      String eventHandlerName() const { return "init"; }
399  };  };
400  typedef Ref<OnInit,Node> OnInitRef;  typedef Ref<OnInit,Node> OnInitRef;
# Line 332  typedef Ref<OnInit,Node> OnInitRef; Line 402  typedef Ref<OnInit,Node> OnInitRef;
402  class OnRelease : public EventHandler {  class OnRelease : public EventHandler {
403  public:  public:
404      OnRelease(StatementsRef statements) : EventHandler(statements) {}      OnRelease(StatementsRef statements) : EventHandler(statements) {}
405        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_RELEASE; }
406      String eventHandlerName() const { return "release"; }      String eventHandlerName() const { return "release"; }
407  };  };
408  typedef Ref<OnRelease,Node> OnReleaseRef;  typedef Ref<OnRelease,Node> OnReleaseRef;
# Line 339  typedef Ref<OnRelease,Node> OnReleaseRef Line 410  typedef Ref<OnRelease,Node> OnReleaseRef
410  class OnController : public EventHandler {  class OnController : public EventHandler {
411  public:  public:
412      OnController(StatementsRef statements) : EventHandler(statements) {}      OnController(StatementsRef statements) : EventHandler(statements) {}
413        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_CONTROLLER; }
414      String eventHandlerName() const { return "controller"; }      String eventHandlerName() const { return "controller"; }
415  };  };
416  typedef Ref<OnController,Node> OnControllerRef;  typedef Ref<OnController,Node> OnControllerRef;
# Line 353  public: Line 425  public:
425      int evalInt() { return 0; }      int evalInt() { return 0; }
426      EventHandler* eventHandlerByName(const String& name) const;      EventHandler* eventHandlerByName(const String& name) const;
427      EventHandler* eventHandler(uint index) const;      EventHandler* eventHandler(uint index) const;
428      inline uint size() const { return args.size(); }      inline uint size() const { return (int) args.size(); }
429        bool isPolyphonic() const;
430  };  };
431  typedef Ref<EventHandlers,Node> EventHandlersRef;  typedef Ref<EventHandlers,Node> EventHandlersRef;
432    
# Line 365  public: Line 438  public:
438      Assignment(VariableRef variable, ExpressionRef value);      Assignment(VariableRef variable, ExpressionRef value);
439      void dump(int level = 0);      void dump(int level = 0);
440      StmtFlags_t exec();      StmtFlags_t exec();
441        bool isPolyphonic() const { return (variable && variable->isPolyphonic()) || (value && value->isPolyphonic()); }
442  };  };
443  typedef Ref<Assignment,Node> AssignmentRef;  typedef Ref<Assignment,Node> AssignmentRef;
444    
# Line 380  public: Line 454  public:
454      void dump(int level = 0);      void dump(int level = 0);
455      int evalBranch();      int evalBranch();
456      Statements* branch(uint i) const;      Statements* branch(uint i) const;
457        bool isPolyphonic() const;
458  };  };
459  typedef Ref<If,Node> IfRef;  typedef Ref<If,Node> IfRef;
460    
# Line 403  public: Line 478  public:
478      //void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements);      //void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements);
479      //void addBranch(CaseBranchRef branch);      //void addBranch(CaseBranchRef branch);
480      //void addBranches(CaseBranchesRef branches);      //void addBranches(CaseBranchesRef branches);
481        bool isPolyphonic() const;
482  };  };
483  typedef Ref<SelectCase,Node> SelectCaseRef;  typedef Ref<SelectCase,Node> SelectCaseRef;
484    
# Line 416  public: Line 492  public:
492      void dump(int level = 0);      void dump(int level = 0);
493      bool evalLoopStartCondition();      bool evalLoopStartCondition();
494      Statements* statements() const;      Statements* statements() const;
495        bool isPolyphonic() const { return m_condition->isPolyphonic() || m_statements->isPolyphonic(); }
496  };  };
497    
498  class Neg : public IntExpr {  class Neg : public IntExpr {
# Line 425  public: Line 502  public:
502      int evalInt() { return (expr) ? -expr->evalInt() : 0; }      int evalInt() { return (expr) ? -expr->evalInt() : 0; }
503      void dump(int level = 0);      void dump(int level = 0);
504      bool isConstExpr() const { return expr->isConstExpr(); }      bool isConstExpr() const { return expr->isConstExpr(); }
505        bool isPolyphonic() const { return expr->isPolyphonic(); }
506  };  };
507  typedef Ref<Neg,Node> NegRef;  typedef Ref<Neg,Node> NegRef;
508    
# Line 436  public: Line 514  public:
514      String evalStr();      String evalStr();
515      void dump(int level = 0);      void dump(int level = 0);
516      bool isConstExpr() const;      bool isConstExpr() const;
517        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
518  };  };
519  typedef Ref<ConcatString,Node> ConcatStringRef;  typedef Ref<ConcatString,Node> ConcatStringRef;
520    
# Line 454  public: Line 533  public:
533      int evalInt();      int evalInt();
534      void dump(int level = 0);      void dump(int level = 0);
535      bool isConstExpr() const;      bool isConstExpr() const;
536        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
537  private:  private:
538      IntExprRef lhs;      IntExprRef lhs;
539      IntExprRef rhs;      IntExprRef rhs;
# Line 469  public: Line 549  public:
549  };  };
550  typedef Ref<Or,Node> OrRef;  typedef Ref<Or,Node> OrRef;
551    
552    class BitwiseOr : virtual public BinaryOp, virtual public IntExpr {
553    public:
554        BitwiseOr(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
555        int evalInt();
556        void dump(int level = 0);
557    };
558    typedef Ref<BitwiseOr,Node> BitwiseOrRef;
559    
560  class And : virtual public BinaryOp, virtual public IntExpr {  class And : virtual public BinaryOp, virtual public IntExpr {
561  public:  public:
562      And(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}      And(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
# Line 477  public: Line 565  public:
565  };  };
566  typedef Ref<And,Node> AndRef;  typedef Ref<And,Node> AndRef;
567    
568    class BitwiseAnd : virtual public BinaryOp, virtual public IntExpr {
569    public:
570        BitwiseAnd(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
571        int evalInt();
572        void dump(int level = 0);
573    };
574    typedef Ref<BitwiseAnd,Node> BitwiseAndRef;
575    
576  class Not : virtual public IntExpr {  class Not : virtual public IntExpr {
577      IntExprRef expr;      IntExprRef expr;
578  public:  public:
# Line 484  public: Line 580  public:
580      int evalInt() { return !expr->evalInt(); }      int evalInt() { return !expr->evalInt(); }
581      void dump(int level = 0);      void dump(int level = 0);
582      bool isConstExpr() const { return expr->isConstExpr(); }      bool isConstExpr() const { return expr->isConstExpr(); }
583        bool isPolyphonic() const { return expr->isPolyphonic(); }
584  };  };
585  typedef Ref<Not,Node> NotRef;  typedef Ref<Not,Node> NotRef;
586    
587    class BitwiseNot : virtual public IntExpr {
588        IntExprRef expr;
589    public:
590        BitwiseNot(IntExprRef expr) : expr(expr) {}
591        int evalInt() { return ~expr->evalInt(); }
592        void dump(int level = 0);
593        bool isConstExpr() const { return expr->isConstExpr(); }
594        bool isPolyphonic() const { return expr->isPolyphonic(); }
595    };
596    typedef Ref<BitwiseNot,Node> BitwiseNotRef;
597    
598  class ParserContext : public VMParserContext {  class ParserContext : public VMParserContext {
599  public:  public:
600      struct Error {      struct Error {
# Line 505  public: Line 613  public:
613      std::set<String> userPreprocessorConditions;      std::set<String> userPreprocessorConditions;
614    
615      std::map<String,VariableRef> vartable;      std::map<String,VariableRef> vartable;
616        std::map<String,StatementsRef> userFnTable;
617      int globalIntVarCount;      int globalIntVarCount;
618      int globalStrVarCount;      int globalStrVarCount;
619      int polyphonicIntVarCount;      int polyphonicIntVarCount;
# Line 536  public: Line 645  public:
645      IntVariableRef globalIntVar(const String& name);      IntVariableRef globalIntVar(const String& name);
646      StringVariableRef globalStrVar(const String& name);      StringVariableRef globalStrVar(const String& name);
647      VariableRef variableByName(const String& name);      VariableRef variableByName(const String& name);
648      void addErr(int line, const char* txt);      StatementsRef userFunctionByName(const String& name);
649      void addWrn(int line, const char* txt);      void addErr(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt);
650        void addWrn(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt);
651      void createScanner(std::istream* is);      void createScanner(std::istream* is);
652      void destroyScanner();      void destroyScanner();
653      bool setPreprocessorCondition(const char* name);      bool setPreprocessorCondition(const char* name);
# Line 548  public: Line 658  public:
658      std::vector<ParserIssue> warnings() const OVERRIDE;      std::vector<ParserIssue> warnings() const OVERRIDE;
659      VMEventHandler* eventHandler(uint index) OVERRIDE;      VMEventHandler* eventHandler(uint index) OVERRIDE;
660      VMEventHandler* eventHandlerByName(const String& name) OVERRIDE;      VMEventHandler* eventHandlerByName(const String& name) OVERRIDE;
661        void registerBuiltInConstIntVariables(const std::map<String,int>& vars);
662        void registerBuiltInIntVariables(const std::map<String,VMIntRelPtr*>& vars);
663        void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars);
664        void registerBuiltInDynVariables(const std::map<String,VMDynVar*>& vars);
665  };  };
666    
667  class ExecContext : public VMExecContext {  class ExecContext : public VMExecContext {
# Line 567  public: Line 681  public:
681      ArrayList<StackFrame> stack;      ArrayList<StackFrame> stack;
682      int stackFrame;      int stackFrame;
683      int suspendMicroseconds;      int suspendMicroseconds;
684        size_t instructionsCount;
685    
686      ExecContext() :      ExecContext() :
687          status(VM_EXEC_NOT_RUNNING), stackFrame(-1), suspendMicroseconds(0) {}          status(VM_EXEC_NOT_RUNNING), stackFrame(-1), suspendMicroseconds(0),
688            instructionsCount(0) {}
689    
690      virtual ~ExecContext() {}      virtual ~ExecContext() {}
691    
# Line 597  public: Line 713  public:
713      int suspensionTimeMicroseconds() const OVERRIDE {      int suspensionTimeMicroseconds() const OVERRIDE {
714          return suspendMicroseconds;          return suspendMicroseconds;
715      }      }
716    
717        void resetPolyphonicData() OVERRIDE {
718            if (polyphonicIntMemory.empty()) return;
719            memset(&polyphonicIntMemory[0], 0, polyphonicIntMemory.size() * sizeof(int));
720        }
721    
722        size_t instructionsPerformed() const OVERRIDE {
723            return instructionsCount;
724        }
725  };  };
726    
727  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2588  
changed lines
  Added in v.3253

  ViewVC Help
Powered by ViewVC