/[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 3208 by schoenebeck, Thu May 25 11:39:03 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      void assignIntElement(uint i, int value);      void assignIntElement(uint i, int value);
201      void dump(int level = 0);      void dump(int level = 0);
202  };  };
203  typedef Ref<IntArrayVariable,Node> IntArrayVariableRef;  typedef Ref<BuiltInIntArrayVariable,Node> BuiltInIntArrayVariableRef;
204    
205  class IntArrayElement : public IntVariable {  class IntArrayElement : public IntVariable {
206      IntArrayVariableRef array;      IntArrayVariableRef array;
# Line 178  public: Line 219  public:
219      void assign(Expression* expr);      void assign(Expression* expr);
220      String evalStr();      String evalStr();
221      void dump(int level = 0);      void dump(int level = 0);
222        bool isPolyphonic() const { return false; }
223  protected:  protected:
224      StringVariable(ParserContext* ctx, bool bConst);      StringVariable(ParserContext* ctx, bool bConst);
225  };  };
# Line 201  protected: Line 243  protected:
243  public:  public:
244      BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { }      BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { }
245      bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); }      bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); }
246        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
247  };  };
248  typedef Ref<BinaryOp,Node> BinaryOpRef;  typedef Ref<BinaryOp,Node> BinaryOpRef;
249    
# Line 257  public: Line 300  public:
300      NoOperation() : Statement() {}      NoOperation() : Statement() {}
301      StmtType_t statementType() const { return STMT_LEAF; }      StmtType_t statementType() const { return STMT_LEAF; }
302      void dump(int level = 0) {}      void dump(int level = 0) {}
303        bool isPolyphonic() const { return false; }
304  };  };
305  typedef Ref<NoOperation,Node> NoOperationRef;  typedef Ref<NoOperation,Node> NoOperationRef;
306    
# Line 276  public: Line 320  public:
320      void dump(int level = 0);      void dump(int level = 0);
321      StmtType_t statementType() const { return STMT_LIST; }      StmtType_t statementType() const { return STMT_LIST; }
322      virtual Statement* statement(uint i);      virtual Statement* statement(uint i);
323        bool isPolyphonic() const;
324  };  };
325  typedef Ref<Statements,Node> StatementsRef;  typedef Ref<Statements,Node> StatementsRef;
326    
# Line 286  public: Line 331  public:
331      virtual Statements* branch(uint i) const = 0;      virtual Statements* branch(uint i) const = 0;
332  };  };
333    
334    class DynamicVariableCall : public Variable, virtual public IntExpr, virtual public StringExpr {
335        VMDynVar* dynVar;
336        String varName;
337    public:
338        DynamicVariableCall(const String& name, ParserContext* ctx, VMDynVar* v);
339        ExprType_t exprType() const OVERRIDE { return dynVar->exprType(); }
340        bool isConstExpr() const OVERRIDE { return dynVar->isConstExpr(); }
341        bool isAssignable() const OVERRIDE { return dynVar->isAssignable(); }
342        bool isPolyphonic() const OVERRIDE { return false; }
343        void assign(Expression* expr) OVERRIDE { dynVar->assignExpr(expr); }
344        VMIntArrayExpr* asIntArray() const OVERRIDE { return dynVar->asIntArray(); }
345        int evalInt() OVERRIDE;
346        String evalStr() OVERRIDE;
347        String evalCastToStr() OVERRIDE;
348        void dump(int level = 0) OVERRIDE;
349    };
350    typedef Ref<DynamicVariableCall,Node> DynamicVariableCallRef;
351    
352  class FunctionCall : virtual public LeafStatement, virtual public IntExpr, virtual public StringExpr {  class FunctionCall : virtual public LeafStatement, virtual public IntExpr, virtual public StringExpr {
353      String functionName;      String functionName;
354      ArgsRef args;      ArgsRef args;
# Line 293  class FunctionCall : virtual public Leaf Line 356  class FunctionCall : virtual public Leaf
356  public:  public:
357      FunctionCall(const char* function, ArgsRef args, VMFunction* fn) :      FunctionCall(const char* function, ArgsRef args, VMFunction* fn) :
358          functionName(function), args(args), fn(fn) { }          functionName(function), args(args), fn(fn) { }
359      void dump(int level = 0);      void dump(int level = 0) OVERRIDE;
360      StmtFlags_t exec();      StmtFlags_t exec() OVERRIDE;
361      int evalInt();      int evalInt() OVERRIDE;
362      String evalStr();      VMIntArrayExpr* asIntArray() const OVERRIDE;
363      bool isConstExpr() const { return false; }      String evalStr() OVERRIDE;
364      ExprType_t exprType() const;      bool isConstExpr() const OVERRIDE { return false; }
365      String evalCastToStr();      ExprType_t exprType() const OVERRIDE;
366        String evalCastToStr() OVERRIDE;
367        bool isPolyphonic() const OVERRIDE { return args->isPolyphonic(); }
368  protected:  protected:
369      VMFnResult* execVMFn();      VMFnResult* execVMFn();
370  };  };
# Line 307  typedef Ref<FunctionCall,Node> FunctionC Line 372  typedef Ref<FunctionCall,Node> FunctionC
372    
373  class EventHandler : virtual public Statements, virtual public VMEventHandler {  class EventHandler : virtual public Statements, virtual public VMEventHandler {
374      StatementsRef statements;      StatementsRef statements;
375        bool usingPolyphonics;
376  public:  public:
377      void dump(int level = 0);      void dump(int level = 0);
378      StmtFlags_t exec();      StmtFlags_t exec();
379      EventHandler(StatementsRef statements) { this->statements = statements; }      EventHandler(StatementsRef statements);
380      Statement* statement(uint i) { return statements->statement(i); }      Statement* statement(uint i) { return statements->statement(i); }
381        bool isPolyphonic() const { return usingPolyphonics; }
382  };  };
383  typedef Ref<EventHandler,Node> EventHandlerRef;  typedef Ref<EventHandler,Node> EventHandlerRef;
384    
385  class OnNote : public EventHandler {  class OnNote : public EventHandler {
386  public:  public:
387      OnNote(StatementsRef statements) : EventHandler(statements) {}      OnNote(StatementsRef statements) : EventHandler(statements) {}
388        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_NOTE; }
389      String eventHandlerName() const { return "note"; }      String eventHandlerName() const { return "note"; }
390  };  };
391  typedef Ref<OnNote,Node> OnNoteRef;  typedef Ref<OnNote,Node> OnNoteRef;
# Line 325  typedef Ref<OnNote,Node> OnNoteRef; Line 393  typedef Ref<OnNote,Node> OnNoteRef;
393  class OnInit : public EventHandler {  class OnInit : public EventHandler {
394  public:  public:
395      OnInit(StatementsRef statements) : EventHandler(statements) {}      OnInit(StatementsRef statements) : EventHandler(statements) {}
396        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_INIT; }
397      String eventHandlerName() const { return "init"; }      String eventHandlerName() const { return "init"; }
398  };  };
399  typedef Ref<OnInit,Node> OnInitRef;  typedef Ref<OnInit,Node> OnInitRef;
# Line 332  typedef Ref<OnInit,Node> OnInitRef; Line 401  typedef Ref<OnInit,Node> OnInitRef;
401  class OnRelease : public EventHandler {  class OnRelease : public EventHandler {
402  public:  public:
403      OnRelease(StatementsRef statements) : EventHandler(statements) {}      OnRelease(StatementsRef statements) : EventHandler(statements) {}
404        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_RELEASE; }
405      String eventHandlerName() const { return "release"; }      String eventHandlerName() const { return "release"; }
406  };  };
407  typedef Ref<OnRelease,Node> OnReleaseRef;  typedef Ref<OnRelease,Node> OnReleaseRef;
# Line 339  typedef Ref<OnRelease,Node> OnReleaseRef Line 409  typedef Ref<OnRelease,Node> OnReleaseRef
409  class OnController : public EventHandler {  class OnController : public EventHandler {
410  public:  public:
411      OnController(StatementsRef statements) : EventHandler(statements) {}      OnController(StatementsRef statements) : EventHandler(statements) {}
412        VMEventHandlerType_t eventHandlerType() const { return VM_EVENT_HANDLER_CONTROLLER; }
413      String eventHandlerName() const { return "controller"; }      String eventHandlerName() const { return "controller"; }
414  };  };
415  typedef Ref<OnController,Node> OnControllerRef;  typedef Ref<OnController,Node> OnControllerRef;
# Line 353  public: Line 424  public:
424      int evalInt() { return 0; }      int evalInt() { return 0; }
425      EventHandler* eventHandlerByName(const String& name) const;      EventHandler* eventHandlerByName(const String& name) const;
426      EventHandler* eventHandler(uint index) const;      EventHandler* eventHandler(uint index) const;
427      inline uint size() const { return args.size(); }      inline uint size() const { return (int) args.size(); }
428        bool isPolyphonic() const;
429  };  };
430  typedef Ref<EventHandlers,Node> EventHandlersRef;  typedef Ref<EventHandlers,Node> EventHandlersRef;
431    
# Line 365  public: Line 437  public:
437      Assignment(VariableRef variable, ExpressionRef value);      Assignment(VariableRef variable, ExpressionRef value);
438      void dump(int level = 0);      void dump(int level = 0);
439      StmtFlags_t exec();      StmtFlags_t exec();
440        bool isPolyphonic() const { return (variable && variable->isPolyphonic()) || (value && value->isPolyphonic()); }
441  };  };
442  typedef Ref<Assignment,Node> AssignmentRef;  typedef Ref<Assignment,Node> AssignmentRef;
443    
# Line 380  public: Line 453  public:
453      void dump(int level = 0);      void dump(int level = 0);
454      int evalBranch();      int evalBranch();
455      Statements* branch(uint i) const;      Statements* branch(uint i) const;
456        bool isPolyphonic() const;
457  };  };
458  typedef Ref<If,Node> IfRef;  typedef Ref<If,Node> IfRef;
459    
# Line 403  public: Line 477  public:
477      //void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements);      //void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements);
478      //void addBranch(CaseBranchRef branch);      //void addBranch(CaseBranchRef branch);
479      //void addBranches(CaseBranchesRef branches);      //void addBranches(CaseBranchesRef branches);
480        bool isPolyphonic() const;
481  };  };
482  typedef Ref<SelectCase,Node> SelectCaseRef;  typedef Ref<SelectCase,Node> SelectCaseRef;
483    
# Line 416  public: Line 491  public:
491      void dump(int level = 0);      void dump(int level = 0);
492      bool evalLoopStartCondition();      bool evalLoopStartCondition();
493      Statements* statements() const;      Statements* statements() const;
494        bool isPolyphonic() const { return m_condition->isPolyphonic() || m_statements->isPolyphonic(); }
495  };  };
496    
497  class Neg : public IntExpr {  class Neg : public IntExpr {
# Line 425  public: Line 501  public:
501      int evalInt() { return (expr) ? -expr->evalInt() : 0; }      int evalInt() { return (expr) ? -expr->evalInt() : 0; }
502      void dump(int level = 0);      void dump(int level = 0);
503      bool isConstExpr() const { return expr->isConstExpr(); }      bool isConstExpr() const { return expr->isConstExpr(); }
504        bool isPolyphonic() const { return expr->isPolyphonic(); }
505  };  };
506  typedef Ref<Neg,Node> NegRef;  typedef Ref<Neg,Node> NegRef;
507    
# Line 436  public: Line 513  public:
513      String evalStr();      String evalStr();
514      void dump(int level = 0);      void dump(int level = 0);
515      bool isConstExpr() const;      bool isConstExpr() const;
516        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
517  };  };
518  typedef Ref<ConcatString,Node> ConcatStringRef;  typedef Ref<ConcatString,Node> ConcatStringRef;
519    
# Line 454  public: Line 532  public:
532      int evalInt();      int evalInt();
533      void dump(int level = 0);      void dump(int level = 0);
534      bool isConstExpr() const;      bool isConstExpr() const;
535        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
536  private:  private:
537      IntExprRef lhs;      IntExprRef lhs;
538      IntExprRef rhs;      IntExprRef rhs;
# Line 469  public: Line 548  public:
548  };  };
549  typedef Ref<Or,Node> OrRef;  typedef Ref<Or,Node> OrRef;
550    
551    class BitwiseOr : virtual public BinaryOp, virtual public IntExpr {
552    public:
553        BitwiseOr(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
554        int evalInt();
555        void dump(int level = 0);
556    };
557    typedef Ref<BitwiseOr,Node> BitwiseOrRef;
558    
559  class And : virtual public BinaryOp, virtual public IntExpr {  class And : virtual public BinaryOp, virtual public IntExpr {
560  public:  public:
561      And(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}      And(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
# Line 477  public: Line 564  public:
564  };  };
565  typedef Ref<And,Node> AndRef;  typedef Ref<And,Node> AndRef;
566    
567    class BitwiseAnd : virtual public BinaryOp, virtual public IntExpr {
568    public:
569        BitwiseAnd(IntExprRef lhs, IntExprRef rhs) : BinaryOp(lhs,rhs) {}
570        int evalInt();
571        void dump(int level = 0);
572    };
573    typedef Ref<BitwiseAnd,Node> BitwiseAndRef;
574    
575  class Not : virtual public IntExpr {  class Not : virtual public IntExpr {
576      IntExprRef expr;      IntExprRef expr;
577  public:  public:
# Line 484  public: Line 579  public:
579      int evalInt() { return !expr->evalInt(); }      int evalInt() { return !expr->evalInt(); }
580      void dump(int level = 0);      void dump(int level = 0);
581      bool isConstExpr() const { return expr->isConstExpr(); }      bool isConstExpr() const { return expr->isConstExpr(); }
582        bool isPolyphonic() const { return expr->isPolyphonic(); }
583  };  };
584  typedef Ref<Not,Node> NotRef;  typedef Ref<Not,Node> NotRef;
585    
586    class BitwiseNot : virtual public IntExpr {
587        IntExprRef expr;
588    public:
589        BitwiseNot(IntExprRef expr) : expr(expr) {}
590        int evalInt() { return ~expr->evalInt(); }
591        void dump(int level = 0);
592        bool isConstExpr() const { return expr->isConstExpr(); }
593        bool isPolyphonic() const { return expr->isPolyphonic(); }
594    };
595    typedef Ref<BitwiseNot,Node> BitwiseNotRef;
596    
597  class ParserContext : public VMParserContext {  class ParserContext : public VMParserContext {
598  public:  public:
599      struct Error {      struct Error {
# Line 497  public: Line 604  public:
604    
605      void* scanner;      void* scanner;
606      std::istream* is;      std::istream* is;
607      std::vector<ParserIssue> errors;      std::vector<ParserIssue> vErrors;
608      std::vector<ParserIssue> warnings;      std::vector<ParserIssue> vWarnings;
609      std::vector<ParserIssue> issues;      std::vector<ParserIssue> vIssues;
610    
611      std::set<String> builtinPreprocessorConditions;      std::set<String> builtinPreprocessorConditions;
612      std::set<String> userPreprocessorConditions;      std::set<String> userPreprocessorConditions;
613    
614      std::map<String,VariableRef> vartable;      std::map<String,VariableRef> vartable;
615        std::map<String,StatementsRef> userFnTable;
616      int globalIntVarCount;      int globalIntVarCount;
617      int globalStrVarCount;      int globalStrVarCount;
618      int polyphonicIntVarCount;      int polyphonicIntVarCount;
# Line 518  public: Line 626  public:
626    
627      ArrayList<int>* globalIntMemory;      ArrayList<int>* globalIntMemory;
628      ArrayList<String>* globalStrMemory;      ArrayList<String>* globalStrMemory;
629        int requiredMaxStackSize;
630    
631      VMFunctionProvider* functionProvider;      VMFunctionProvider* functionProvider;
632    
# Line 526  public: Line 635  public:
635      ParserContext(VMFunctionProvider* parent) :      ParserContext(VMFunctionProvider* parent) :
636          scanner(NULL), is(NULL),          scanner(NULL), is(NULL),
637          globalIntVarCount(0), globalStrVarCount(0), polyphonicIntVarCount(0),          globalIntVarCount(0), globalStrVarCount(0), polyphonicIntVarCount(0),
638          globalIntMemory(NULL), globalStrMemory(NULL), functionProvider(parent),          globalIntMemory(NULL), globalStrMemory(NULL), requiredMaxStackSize(-1),
639          execContext(NULL)          functionProvider(parent), execContext(NULL)
640      {      {
641      }      }
642      virtual ~ParserContext() { destroyScanner(); }      virtual ~ParserContext();
643      VariableRef globalVar(const String& name);      VariableRef globalVar(const String& name);
644      IntVariableRef globalIntVar(const String& name);      IntVariableRef globalIntVar(const String& name);
645      StringVariableRef globalStrVar(const String& name);      StringVariableRef globalStrVar(const String& name);
646      VariableRef variableByName(const String& name);      VariableRef variableByName(const String& name);
647      void addErr(int line, const char* txt);      StatementsRef userFunctionByName(const String& name);
648      void addWrn(int line, const char* txt);      void addErr(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt);
649        void addWrn(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt);
650      void createScanner(std::istream* is);      void createScanner(std::istream* is);
651      void destroyScanner();      void destroyScanner();
652      bool setPreprocessorCondition(const char* name);      bool setPreprocessorCondition(const char* name);
653      bool resetPreprocessorCondition(const char* name);      bool resetPreprocessorCondition(const char* name);
654      bool isPreprocessorConditionSet(const char* name);      bool isPreprocessorConditionSet(const char* name);
655        std::vector<ParserIssue> issues() const OVERRIDE;
656        std::vector<ParserIssue> errors() const OVERRIDE;
657        std::vector<ParserIssue> warnings() const OVERRIDE;
658        VMEventHandler* eventHandler(uint index) OVERRIDE;
659        VMEventHandler* eventHandlerByName(const String& name) OVERRIDE;
660        void registerBuiltInConstIntVariables(const std::map<String,int>& vars);
661        void registerBuiltInIntVariables(const std::map<String,VMIntRelPtr*>& vars);
662        void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars);
663        void registerBuiltInDynVariables(const std::map<String,VMDynVar*>& vars);
664  };  };
665    
666  class ExecContext : public VMExecContext {  class ExecContext : public VMExecContext {
# Line 588  public: Line 707  public:
707          stackFrame = -1;          stackFrame = -1;
708      }      }
709    
710      int suspensionTimeMicroseconds() const {      int suspensionTimeMicroseconds() const OVERRIDE {
711          return suspendMicroseconds;          return suspendMicroseconds;
712      }      }
713    
714        void resetPolyphonicData() OVERRIDE {
715            if (polyphonicIntMemory.empty()) return;
716            memset(&polyphonicIntMemory[0], 0, polyphonicIntMemory.size() * sizeof(int));
717        }
718  };  };
719    
720  } // namespace LinuxSampler  } // namespace LinuxSampler

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

  ViewVC Help
Powered by ViewVC