/[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 2581 by schoenebeck, Fri May 30 12:48:05 2014 UTC revision 3207 by schoenebeck, Thu May 25 10:53: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 42  public: Line 42  public:
42      Node();      Node();
43      virtual ~Node();      virtual ~Node();
44      virtual void dump(int level = 0) = 0;      virtual void dump(int level = 0) = 0;
45        virtual bool isPolyphonic() const = 0;
46      void printIndents(int n);      void printIndents(int n);
47  };  };
48  typedef Ref<Node> NodeRef;  typedef Ref<Node> NodeRef;
# Line 62  public: Line 63  public:
63  };  };
64  typedef Ref<IntExpr,Node> IntExprRef;  typedef Ref<IntExpr,Node> IntExprRef;
65    
66    /*class IntArrayExpr : virtual public VMIntArrayExpr, virtual public Expression {
67    public:
68        ExprType_t exprType() const { return INT_ARR_EXPR; }
69        String evalCastToStr();
70    };
71    typedef Ref<IntArrayExpr,Node> IntArrayExprRef;*/
72    
73  class StringExpr : virtual public VMStringExpr, virtual public Expression {  class StringExpr : virtual public VMStringExpr, virtual public Expression {
74  public:  public:
75      ExprType_t exprType() const { return STRING_EXPR; }      ExprType_t exprType() const { return STRING_EXPR; }
# Line 77  public: Line 85  public:
85      int evalInt();      int evalInt();
86      void dump(int level = 0);      void dump(int level = 0);
87      bool isConstExpr() const { return true; }      bool isConstExpr() const { return true; }
88        bool isPolyphonic() const { return false; }
89  };  };
90  typedef Ref<IntLiteral,Node> IntLiteralRef;  typedef Ref<IntLiteral,Node> IntLiteralRef;
91    
# Line 87  public: Line 96  public:
96      bool isConstExpr() const { return true; }      bool isConstExpr() const { return true; }
97      void dump(int level = 0);      void dump(int level = 0);
98      String evalStr() { return value; }      String evalStr() { return value; }
99        bool isPolyphonic() const { return false; }
100  };  };
101  typedef Ref<StringLiteral,Node> StringLiteralRef;  typedef Ref<StringLiteral,Node> StringLiteralRef;
102    
# Line 95  public: Line 105  public:
105      std::vector<ExpressionRef> args;      std::vector<ExpressionRef> args;
106      void add(ExpressionRef arg) { args.push_back(arg); }      void add(ExpressionRef arg) { args.push_back(arg); }
107      void dump(int level = 0);      void dump(int level = 0);
108      int argsCount() const { return args.size(); }      int argsCount() const { return (int) args.size(); }
109      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; }
110        bool isPolyphonic() const;
111  };  };
112  typedef Ref<Args,Node> ArgsRef;  typedef Ref<Args,Node> ArgsRef;
113    
114  class Variable : virtual public Expression {  class Variable : virtual public VMVariable, virtual public Expression {
115  public:  public:
116      virtual bool isConstExpr() const { return bConst; }      bool isConstExpr() const OVERRIDE { return bConst; }
117        bool isAssignable() const OVERRIDE { return !bConst; }
118      virtual void assign(Expression* expr) = 0;      virtual void assign(Expression* expr) = 0;
119        void assignExpr(VMExpr* expr) OVERRIDE { Expression* e = dynamic_cast<Expression*>(expr); if (e) assign(e); }
120  protected:  protected:
121      Variable(ParserContext* ctx, int _memPos, bool _bConst)      Variable(ParserContext* ctx, int _memPos, bool _bConst)
122          : context(ctx), memPos(_memPos), bConst(_bConst) {}          : context(ctx), memPos(_memPos), bConst(_bConst) {}
# Line 139  public: Line 152  public:
152  };  };
153  typedef Ref<ConstIntVariable,Node> ConstIntVariableRef;  typedef Ref<ConstIntVariable,Node> ConstIntVariableRef;
154    
155    class BuiltInIntVariable : public IntVariable {
156        String name;
157        VMIntRelPtr* ptr;
158    public:
159        BuiltInIntVariable(const String& name, VMIntRelPtr* ptr);
160        bool isAssignable() const OVERRIDE { return !ptr->readonly; }
161        void assign(Expression* expr) OVERRIDE;
162        int evalInt() OVERRIDE;
163        void dump(int level = 0) OVERRIDE;
164    };
165    typedef Ref<BuiltInIntVariable,Node> BuiltInIntVariableRef;
166    
167  class PolyphonicIntVariable : public IntVariable {  class PolyphonicIntVariable : public IntVariable {
168  public:  public:
169      PolyphonicIntVariable(ParserContext* ctx);      PolyphonicIntVariable(ParserContext* ctx);
# Line 146  public: Line 171  public:
171  };  };
172  typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef;  typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef;
173    
174  class IntArrayVariable : public Variable {  class IntArrayVariable : public Variable, virtual public VMIntArrayExpr {
175      ArrayList<int> values;      ArrayList<int> values;
176  public:  public:
177      IntArrayVariable(ParserContext* ctx, int size);      IntArrayVariable(ParserContext* ctx, int size);
178      IntArrayVariable(ParserContext* ctx, int size, ArgsRef values);      IntArrayVariable(ParserContext* ctx, int size, ArgsRef values);
179      void assign(Expression* expr) {} // ignore scalar assignment      void assign(Expression* expr) {} // ignore scalar assignment
180      String evalCastToStr() { return ""; } // ignore cast to string      String evalCastToStr() { return ""; } // ignore scalar cast to string
181      ExprType_t exprType() const { return INT_ARR_EXPR; }      ExprType_t exprType() const { return INT_ARR_EXPR; }
182      const int arraySize() const { return values.size(); }      virtual int arraySize() const { return values.size(); }
183        virtual int evalIntElement(uint i);
184        virtual void assignIntElement(uint i, int value);
185        void dump(int level = 0);
186        bool isPolyphonic() const { return false; }
187    protected:
188        IntArrayVariable(ParserContext* ctx, bool bConst);
189    };
190    typedef Ref<IntArrayVariable,Node> IntArrayVariableRef;
191    
192    class BuiltInIntArrayVariable : public IntArrayVariable {
193        String name;
194        VMInt8Array* array;
195    public:
196        BuiltInIntArrayVariable(const String& name, VMInt8Array* array);
197        int arraySize() const { return array->size; }
198      int evalIntElement(uint i);      int evalIntElement(uint i);
199      void assignIntElement(uint i, int value);      void assignIntElement(uint i, int value);
200      void dump(int level = 0);      void dump(int level = 0);
201  };  };
202  typedef Ref<IntArrayVariable,Node> IntArrayVariableRef;  typedef Ref<BuiltInIntArrayVariable,Node> BuiltInIntArrayVariableRef;
203    
204  class IntArrayElement : public IntVariable {  class IntArrayElement : public IntVariable {
205      IntArrayVariableRef array;      IntArrayVariableRef array;
# Line 178  public: Line 218  public:
218      void assign(Expression* expr);      void assign(Expression* expr);
219      String evalStr();      String evalStr();
220      void dump(int level = 0);      void dump(int level = 0);
221        bool isPolyphonic() const { return false; }
222  protected:  protected:
223      StringVariable(ParserContext* ctx, bool bConst);      StringVariable(ParserContext* ctx, bool bConst);
224  };  };
# Line 201  protected: Line 242  protected:
242  public:  public:
243      BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { }      BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { }
244      bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); }      bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); }
245        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
246  };  };
247  typedef Ref<BinaryOp,Node> BinaryOpRef;  typedef Ref<BinaryOp,Node> BinaryOpRef;
248    
# Line 257  public: Line 299  public:
299      NoOperation() : Statement() {}      NoOperation() : Statement() {}
300      StmtType_t statementType() const { return STMT_LEAF; }      StmtType_t statementType() const { return STMT_LEAF; }
301      void dump(int level = 0) {}      void dump(int level = 0) {}
302        bool isPolyphonic() const { return false; }
303  };  };
304  typedef Ref<NoOperation,Node> NoOperationRef;  typedef Ref<NoOperation,Node> NoOperationRef;
305    
# Line 276  public: Line 319  public:
319      void dump(int level = 0);      void dump(int level = 0);
320      StmtType_t statementType() const { return STMT_LIST; }      StmtType_t statementType() const { return STMT_LIST; }
321      virtual Statement* statement(uint i);      virtual Statement* statement(uint i);
322        bool isPolyphonic() const;
323  };  };
324  typedef Ref<Statements,Node> StatementsRef;  typedef Ref<Statements,Node> StatementsRef;
325    
# Line 286  public: Line 330  public:
330      virtual Statements* branch(uint i) const = 0;      virtual Statements* branch(uint i) const = 0;
331  };  };
332    
333    class DynamicVariableCall : public Variable, virtual public IntExpr, virtual public StringExpr {
334        VMDynVar* dynVar;
335        String varName;
336    public:
337        DynamicVariableCall(const String& name, ParserContext* ctx, VMDynVar* v);
338        ExprType_t exprType() const OVERRIDE { return dynVar->exprType(); }
339        bool isConstExpr() const OVERRIDE { return dynVar->isConstExpr(); }
340        bool isAssignable() const OVERRIDE { return dynVar->isAssignable(); }
341        bool isPolyphonic() const OVERRIDE { return false; }
342        void assign(Expression* expr) OVERRIDE { dynVar->assignExpr(expr); }
343        VMIntArrayExpr* asIntArray() const OVERRIDE { return dynVar->asIntArray(); }
344        int evalInt() OVERRIDE;
345        String evalStr() OVERRIDE;
346        String evalCastToStr() OVERRIDE;
347        void dump(int level = 0) OVERRIDE;
348    };
349    typedef Ref<DynamicVariableCall,Node> DynamicVariableCallRef;
350    
351  class FunctionCall : virtual public LeafStatement, virtual public IntExpr, virtual public StringExpr {  class FunctionCall : virtual public LeafStatement, virtual public IntExpr, virtual public StringExpr {
352      String functionName;      String functionName;
353      ArgsRef args;      ArgsRef args;
# Line 293  class FunctionCall : virtual public Leaf Line 355  class FunctionCall : virtual public Leaf
355  public:  public:
356      FunctionCall(const char* function, ArgsRef args, VMFunction* fn) :      FunctionCall(const char* function, ArgsRef args, VMFunction* fn) :
357          functionName(function), args(args), fn(fn) { }          functionName(function), args(args), fn(fn) { }
358      void dump(int level = 0);      void dump(int level = 0) OVERRIDE;
359      StmtFlags_t exec();      StmtFlags_t exec() OVERRIDE;
360      int evalInt();      int evalInt() OVERRIDE;
361      String evalStr();      VMIntArrayExpr* asIntArray() const OVERRIDE;
362      bool isConstExpr() const { return false; }      String evalStr() OVERRIDE;
363      ExprType_t exprType() const;      bool isConstExpr() const OVERRIDE { return false; }
364      String evalCastToStr();      ExprType_t exprType() const OVERRIDE;
365        String evalCastToStr() OVERRIDE;
366        bool isPolyphonic() const OVERRIDE { return args->isPolyphonic(); }
367  protected:  protected:
368      VMFnResult* execVMFn();      VMFnResult* execVMFn();
369  };  };
# Line 307  typedef Ref<FunctionCall,Node> FunctionC Line 371  typedef Ref<FunctionCall,Node> FunctionC
371    
372  class EventHandler : virtual public Statements, virtual public VMEventHandler {  class EventHandler : virtual public Statements, virtual public VMEventHandler {
373      StatementsRef statements;      StatementsRef statements;
374        bool usingPolyphonics;
375  public:  public:
376      void dump(int level = 0);      void dump(int level = 0);
377      StmtFlags_t exec();      StmtFlags_t exec();
378      EventHandler(StatementsRef statements) { this->statements = statements; }      EventHandler(StatementsRef statements);
379      Statement* statement(uint i) { return statements->statement(i); }      Statement* statement(uint i) { return statements->statement(i); }
380        bool isPolyphonic() const { return usingPolyphonics; }
381  };  };
382  typedef Ref<EventHandler,Node> EventHandlerRef;  typedef Ref<EventHandler,Node> EventHandlerRef;
383    
384  class OnNote : public EventHandler {  class OnNote : public EventHandler {
385  public:  public:
386      OnNote(StatementsRef statements) : EventHandler(statements) {}      OnNote(StatementsRef statements) : EventHandler(statements) {}
387        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_NOTE; }
388      String eventHandlerName() const { return "note"; }      String eventHandlerName() const { return "note"; }
389  };  };
390  typedef Ref<OnNote,Node> OnNoteRef;  typedef Ref<OnNote,Node> OnNoteRef;
# Line 325  typedef Ref<OnNote,Node> OnNoteRef; Line 392  typedef Ref<OnNote,Node> OnNoteRef;
392  class OnInit : public EventHandler {  class OnInit : public EventHandler {
393  public:  public:
394      OnInit(StatementsRef statements) : EventHandler(statements) {}      OnInit(StatementsRef statements) : EventHandler(statements) {}
395        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_INIT; }
396      String eventHandlerName() const { return "init"; }      String eventHandlerName() const { return "init"; }
397  };  };
398  typedef Ref<OnInit,Node> OnInitRef;  typedef Ref<OnInit,Node> OnInitRef;
# Line 332  typedef Ref<OnInit,Node> OnInitRef; Line 400  typedef Ref<OnInit,Node> OnInitRef;
400  class OnRelease : public EventHandler {  class OnRelease : public EventHandler {
401  public:  public:
402      OnRelease(StatementsRef statements) : EventHandler(statements) {}      OnRelease(StatementsRef statements) : EventHandler(statements) {}
403        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_RELEASE; }
404      String eventHandlerName() const { return "release"; }      String eventHandlerName() const { return "release"; }
405  };  };
406  typedef Ref<OnRelease,Node> OnReleaseRef;  typedef Ref<OnRelease,Node> OnReleaseRef;
# Line 339  typedef Ref<OnRelease,Node> OnReleaseRef Line 408  typedef Ref<OnRelease,Node> OnReleaseRef
408  class OnController : public EventHandler {  class OnController : public EventHandler {
409  public:  public:
410      OnController(StatementsRef statements) : EventHandler(statements) {}      OnController(StatementsRef statements) : EventHandler(statements) {}
411        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_CONTROLLER; }
412      String eventHandlerName() const { return "controller"; }      String eventHandlerName() const { return "controller"; }
413  };  };
414  typedef Ref<OnController,Node> OnControllerRef;  typedef Ref<OnController,Node> OnControllerRef;
# Line 353  public: Line 423  public:
423      int evalInt() { return 0; }      int evalInt() { return 0; }
424      EventHandler* eventHandlerByName(const String& name) const;      EventHandler* eventHandlerByName(const String& name) const;
425      EventHandler* eventHandler(uint index) const;      EventHandler* eventHandler(uint index) const;
426      inline uint size() const { return args.size(); }      inline uint size() const { return (int) args.size(); }
427        bool isPolyphonic() const;
428  };  };
429  typedef Ref<EventHandlers,Node> EventHandlersRef;  typedef Ref<EventHandlers,Node> EventHandlersRef;
430    
# Line 365  public: Line 436  public:
436      Assignment(VariableRef variable, ExpressionRef value);      Assignment(VariableRef variable, ExpressionRef value);
437      void dump(int level = 0);      void dump(int level = 0);
438      StmtFlags_t exec();      StmtFlags_t exec();
439        bool isPolyphonic() const { return (variable && variable->isPolyphonic()) || (value && value->isPolyphonic()); }
440  };  };
441  typedef Ref<Assignment,Node> AssignmentRef;  typedef Ref<Assignment,Node> AssignmentRef;
442    
# Line 380  public: Line 452  public:
452      void dump(int level = 0);      void dump(int level = 0);
453      int evalBranch();      int evalBranch();
454      Statements* branch(uint i) const;      Statements* branch(uint i) const;
455        bool isPolyphonic() const;
456  };  };
457  typedef Ref<If,Node> IfRef;  typedef Ref<If,Node> IfRef;
458    
# Line 403  public: Line 476  public:
476      //void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements);      //void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements);
477      //void addBranch(CaseBranchRef branch);      //void addBranch(CaseBranchRef branch);
478      //void addBranches(CaseBranchesRef branches);      //void addBranches(CaseBranchesRef branches);
479        bool isPolyphonic() const;
480  };  };
481  typedef Ref<SelectCase,Node> SelectCaseRef;  typedef Ref<SelectCase,Node> SelectCaseRef;
482    
# Line 416  public: Line 490  public:
490      void dump(int level = 0);      void dump(int level = 0);
491      bool evalLoopStartCondition();      bool evalLoopStartCondition();
492      Statements* statements() const;      Statements* statements() const;
493        bool isPolyphonic() const { return m_condition->isPolyphonic() || m_statements->isPolyphonic(); }
494  };  };
495    
496  class Neg : public IntExpr {  class Neg : public IntExpr {
# Line 425  public: Line 500  public:
500      int evalInt() { return (expr) ? -expr->evalInt() : 0; }      int evalInt() { return (expr) ? -expr->evalInt() : 0; }
501      void dump(int level = 0);      void dump(int level = 0);
502      bool isConstExpr() const { return expr->isConstExpr(); }      bool isConstExpr() const { return expr->isConstExpr(); }
503        bool isPolyphonic() const { return expr->isPolyphonic(); }
504  };  };
505  typedef Ref<Neg,Node> NegRef;  typedef Ref<Neg,Node> NegRef;
506    
# Line 436  public: Line 512  public:
512      String evalStr();      String evalStr();
513      void dump(int level = 0);      void dump(int level = 0);
514      bool isConstExpr() const;      bool isConstExpr() const;
515        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
516  };  };
517  typedef Ref<ConcatString,Node> ConcatStringRef;  typedef Ref<ConcatString,Node> ConcatStringRef;
518    
# Line 454  public: Line 531  public:
531      int evalInt();      int evalInt();
532      void dump(int level = 0);      void dump(int level = 0);
533      bool isConstExpr() const;      bool isConstExpr() const;
534        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
535  private:  private:
536      IntExprRef lhs;      IntExprRef lhs;
537      IntExprRef rhs;      IntExprRef rhs;
# Line 469  public: Line 547  public:
547  };  };
548  typedef Ref<Or,Node> OrRef;  typedef Ref<Or,Node> OrRef;
549    
550    class BitwiseOr : virtual public BinaryOp, virtual public IntExpr {
551    public:
552        BitwiseOr(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
553        int evalInt();
554        void dump(int level = 0);
555    };
556    typedef Ref<BitwiseOr,Node> BitwiseOrRef;
557    
558  class And : virtual public BinaryOp, virtual public IntExpr {  class And : virtual public BinaryOp, virtual public IntExpr {
559  public:  public:
560      And(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}      And(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
# Line 477  public: Line 563  public:
563  };  };
564  typedef Ref<And,Node> AndRef;  typedef Ref<And,Node> AndRef;
565    
566    class BitwiseAnd : virtual public BinaryOp, virtual public IntExpr {
567    public:
568        BitwiseAnd(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
569        int evalInt();
570        void dump(int level = 0);
571    };
572    typedef Ref<BitwiseAnd,Node> BitwiseAndRef;
573    
574  class Not : virtual public IntExpr {  class Not : virtual public IntExpr {
575      IntExprRef expr;      IntExprRef expr;
576  public:  public:
# Line 484  public: Line 578  public:
578      int evalInt() { return !expr->evalInt(); }      int evalInt() { return !expr->evalInt(); }
579      void dump(int level = 0);      void dump(int level = 0);
580      bool isConstExpr() const { return expr->isConstExpr(); }      bool isConstExpr() const { return expr->isConstExpr(); }
581        bool isPolyphonic() const { return expr->isPolyphonic(); }
582  };  };
583  typedef Ref<Not,Node> NotRef;  typedef Ref<Not,Node> NotRef;
584    
585    class BitwiseNot : virtual public IntExpr {
586        IntExprRef expr;
587    public:
588        BitwiseNot(IntExprRef expr) : expr(expr) {}
589        int evalInt() { return ~expr->evalInt(); }
590        void dump(int level = 0);
591        bool isConstExpr() const { return expr->isConstExpr(); }
592        bool isPolyphonic() const { return expr->isPolyphonic(); }
593    };
594    typedef Ref<BitwiseNot,Node> BitwiseNotRef;
595    
596  class ParserContext : public VMParserContext {  class ParserContext : public VMParserContext {
597  public:  public:
598      struct Error {      struct Error {
# Line 497  public: Line 603  public:
603    
604      void* scanner;      void* scanner;
605      std::istream* is;      std::istream* is;
606      std::vector<ParserIssue> errors;      std::vector<ParserIssue> vErrors;
607      std::vector<ParserIssue> warnings;      std::vector<ParserIssue> vWarnings;
608      std::vector<ParserIssue> issues;      std::vector<ParserIssue> vIssues;
609    
610      std::set<String> builtinPreprocessorConditions;      std::set<String> builtinPreprocessorConditions;
611      std::set<String> userPreprocessorConditions;      std::set<String> userPreprocessorConditions;
612    
613      std::map<String,VariableRef> vartable;      std::map<String,VariableRef> vartable;
614        std::map<String,StatementsRef> userFnTable;
615      int globalIntVarCount;      int globalIntVarCount;
616      int globalStrVarCount;      int globalStrVarCount;
617      int polyphonicIntVarCount;      int polyphonicIntVarCount;
# Line 518  public: Line 625  public:
625    
626      ArrayList<int>* globalIntMemory;      ArrayList<int>* globalIntMemory;
627      ArrayList<String>* globalStrMemory;      ArrayList<String>* globalStrMemory;
628        int requiredMaxStackSize;
629    
630      VMFunctionProvider* functionProvider;      VMFunctionProvider* functionProvider;
631    
# Line 526  public: Line 634  public:
634      ParserContext(VMFunctionProvider* parent) :      ParserContext(VMFunctionProvider* parent) :
635          scanner(NULL), is(NULL),          scanner(NULL), is(NULL),
636          globalIntVarCount(0), globalStrVarCount(0), polyphonicIntVarCount(0),          globalIntVarCount(0), globalStrVarCount(0), polyphonicIntVarCount(0),
637          globalIntMemory(NULL), globalStrMemory(NULL), functionProvider(parent),          globalIntMemory(NULL), globalStrMemory(NULL), requiredMaxStackSize(-1),
638          execContext(NULL)          functionProvider(parent), execContext(NULL)
639      {      {
640      }      }
641      virtual ~ParserContext() { destroyScanner(); }      virtual ~ParserContext();
642      VariableRef globalVar(const String& name);      VariableRef globalVar(const String& name);
643      IntVariableRef globalIntVar(const String& name);      IntVariableRef globalIntVar(const String& name);
644      StringVariableRef globalStrVar(const String& name);      StringVariableRef globalStrVar(const String& name);
645      VariableRef variableByName(const String& name);      VariableRef variableByName(const String& name);
646      void addErr(int line, const char* txt);      StatementsRef userFunctionByName(const String& name);
647      void addWrn(int line, const char* txt);      void addErr(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt);
648        void addWrn(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt);
649      void createScanner(std::istream* is);      void createScanner(std::istream* is);
650      void destroyScanner();      void destroyScanner();
651      bool setPreprocessorCondition(const char* name);      bool setPreprocessorCondition(const char* name);
652      bool resetPreprocessorCondition(const char* name);      bool resetPreprocessorCondition(const char* name);
653      bool isPreprocessorConditionSet(const char* name);      bool isPreprocessorConditionSet(const char* name);
654        std::vector<ParserIssue> issues() const OVERRIDE;
655        std::vector<ParserIssue> errors() const OVERRIDE;
656        std::vector<ParserIssue> warnings() const OVERRIDE;
657        VMEventHandler* eventHandler(uint index) OVERRIDE;
658        VMEventHandler* eventHandlerByName(const String& name) OVERRIDE;
659        void registerBuiltInConstIntVariables(const std::map<String,int>& vars);
660        void registerBuiltInIntVariables(const std::map<String,VMIntRelPtr*>& vars);
661        void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars);
662        void registerBuiltInDynVariables(const std::map<String,VMDynVar*>& vars);
663  };  };
664    
665  class ExecContext : public VMExecContext {  class ExecContext : public VMExecContext {
# Line 588  public: Line 706  public:
706          stackFrame = -1;          stackFrame = -1;
707      }      }
708    
709      int suspensionTimeMicroseconds() const {      int suspensionTimeMicroseconds() const OVERRIDE {
710          return suspendMicroseconds;          return suspendMicroseconds;
711      }      }
712    
713        void resetPolyphonicData() OVERRIDE {
714            if (polyphonicIntMemory.empty()) return;
715            memset(&polyphonicIntMemory[0], 0, polyphonicIntMemory.size() * sizeof(int));
716        }
717  };  };
718    
719  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2581  
changed lines
  Added in v.3207

  ViewVC Help
Powered by ViewVC