/[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 2619 by schoenebeck, Wed Jun 11 13:24:32 2014 UTC revision 2645 by schoenebeck, Wed Jun 18 00:14:57 2014 UTC
# 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 77  public: Line 78  public:
78      int evalInt();      int evalInt();
79      void dump(int level = 0);      void dump(int level = 0);
80      bool isConstExpr() const { return true; }      bool isConstExpr() const { return true; }
81        bool isPolyphonic() const { return false; }
82  };  };
83  typedef Ref<IntLiteral,Node> IntLiteralRef;  typedef Ref<IntLiteral,Node> IntLiteralRef;
84    
# Line 87  public: Line 89  public:
89      bool isConstExpr() const { return true; }      bool isConstExpr() const { return true; }
90      void dump(int level = 0);      void dump(int level = 0);
91      String evalStr() { return value; }      String evalStr() { return value; }
92        bool isPolyphonic() const { return false; }
93  };  };
94  typedef Ref<StringLiteral,Node> StringLiteralRef;  typedef Ref<StringLiteral,Node> StringLiteralRef;
95    
# Line 97  public: Line 100  public:
100      void dump(int level = 0);      void dump(int level = 0);
101      int argsCount() const { return args.size(); }      int argsCount() const { return args.size(); }
102      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; }
103        bool isPolyphonic() const;
104  };  };
105  typedef Ref<Args,Node> ArgsRef;  typedef Ref<Args,Node> ArgsRef;
106    
# Line 169  public: Line 173  public:
173      virtual int evalIntElement(uint i);      virtual int evalIntElement(uint i);
174      virtual void assignIntElement(uint i, int value);      virtual void assignIntElement(uint i, int value);
175      void dump(int level = 0);      void dump(int level = 0);
176        bool isPolyphonic() const { return false; }
177  protected:  protected:
178      IntArrayVariable(ParserContext* ctx, bool bConst);      IntArrayVariable(ParserContext* ctx, bool bConst);
179  };  };
# Line 203  public: Line 208  public:
208      void assign(Expression* expr);      void assign(Expression* expr);
209      String evalStr();      String evalStr();
210      void dump(int level = 0);      void dump(int level = 0);
211        bool isPolyphonic() const { return false; }
212  protected:  protected:
213      StringVariable(ParserContext* ctx, bool bConst);      StringVariable(ParserContext* ctx, bool bConst);
214  };  };
# Line 226  protected: Line 232  protected:
232  public:  public:
233      BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { }      BinaryOp(ExpressionRef lhs, ExpressionRef rhs) : lhs(lhs), rhs(rhs) { }
234      bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); }      bool isConstExpr() const { return lhs->isConstExpr() && rhs->isConstExpr(); }
235        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
236  };  };
237  typedef Ref<BinaryOp,Node> BinaryOpRef;  typedef Ref<BinaryOp,Node> BinaryOpRef;
238    
# Line 282  public: Line 289  public:
289      NoOperation() : Statement() {}      NoOperation() : Statement() {}
290      StmtType_t statementType() const { return STMT_LEAF; }      StmtType_t statementType() const { return STMT_LEAF; }
291      void dump(int level = 0) {}      void dump(int level = 0) {}
292        bool isPolyphonic() const { return false; }
293  };  };
294  typedef Ref<NoOperation,Node> NoOperationRef;  typedef Ref<NoOperation,Node> NoOperationRef;
295    
# Line 301  public: Line 309  public:
309      void dump(int level = 0);      void dump(int level = 0);
310      StmtType_t statementType() const { return STMT_LIST; }      StmtType_t statementType() const { return STMT_LIST; }
311      virtual Statement* statement(uint i);      virtual Statement* statement(uint i);
312        bool isPolyphonic() const;
313  };  };
314  typedef Ref<Statements,Node> StatementsRef;  typedef Ref<Statements,Node> StatementsRef;
315    
# Line 325  public: Line 334  public:
334      bool isConstExpr() const { return false; }      bool isConstExpr() const { return false; }
335      ExprType_t exprType() const;      ExprType_t exprType() const;
336      String evalCastToStr();      String evalCastToStr();
337        bool isPolyphonic() const { return args->isPolyphonic(); }
338  protected:  protected:
339      VMFnResult* execVMFn();      VMFnResult* execVMFn();
340  };  };
# Line 332  typedef Ref<FunctionCall,Node> FunctionC Line 342  typedef Ref<FunctionCall,Node> FunctionC
342    
343  class EventHandler : virtual public Statements, virtual public VMEventHandler {  class EventHandler : virtual public Statements, virtual public VMEventHandler {
344      StatementsRef statements;      StatementsRef statements;
345        bool usingPolyphonics;
346  public:  public:
347      void dump(int level = 0);      void dump(int level = 0);
348      StmtFlags_t exec();      StmtFlags_t exec();
349      EventHandler(StatementsRef statements) { this->statements = statements; }      EventHandler(StatementsRef statements);
350      Statement* statement(uint i) { return statements->statement(i); }      Statement* statement(uint i) { return statements->statement(i); }
351        bool isPolyphonic() const { return usingPolyphonics; }
352  };  };
353  typedef Ref<EventHandler,Node> EventHandlerRef;  typedef Ref<EventHandler,Node> EventHandlerRef;
354    
# Line 379  public: Line 391  public:
391      EventHandler* eventHandlerByName(const String& name) const;      EventHandler* eventHandlerByName(const String& name) const;
392      EventHandler* eventHandler(uint index) const;      EventHandler* eventHandler(uint index) const;
393      inline uint size() const { return args.size(); }      inline uint size() const { return args.size(); }
394        bool isPolyphonic() const;
395  };  };
396  typedef Ref<EventHandlers,Node> EventHandlersRef;  typedef Ref<EventHandlers,Node> EventHandlersRef;
397    
# Line 390  public: Line 403  public:
403      Assignment(VariableRef variable, ExpressionRef value);      Assignment(VariableRef variable, ExpressionRef value);
404      void dump(int level = 0);      void dump(int level = 0);
405      StmtFlags_t exec();      StmtFlags_t exec();
406        bool isPolyphonic() const { return variable->isPolyphonic() || value->isPolyphonic(); }
407  };  };
408  typedef Ref<Assignment,Node> AssignmentRef;  typedef Ref<Assignment,Node> AssignmentRef;
409    
# Line 405  public: Line 419  public:
419      void dump(int level = 0);      void dump(int level = 0);
420      int evalBranch();      int evalBranch();
421      Statements* branch(uint i) const;      Statements* branch(uint i) const;
422        bool isPolyphonic() const;
423  };  };
424  typedef Ref<If,Node> IfRef;  typedef Ref<If,Node> IfRef;
425    
# Line 428  public: Line 443  public:
443      //void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements);      //void addBranch(IntExprRef from, IntExprRef to, StatementsRef statements);
444      //void addBranch(CaseBranchRef branch);      //void addBranch(CaseBranchRef branch);
445      //void addBranches(CaseBranchesRef branches);      //void addBranches(CaseBranchesRef branches);
446        bool isPolyphonic() const;
447  };  };
448  typedef Ref<SelectCase,Node> SelectCaseRef;  typedef Ref<SelectCase,Node> SelectCaseRef;
449    
# Line 441  public: Line 457  public:
457      void dump(int level = 0);      void dump(int level = 0);
458      bool evalLoopStartCondition();      bool evalLoopStartCondition();
459      Statements* statements() const;      Statements* statements() const;
460        bool isPolyphonic() const { return m_condition->isPolyphonic() || m_statements->isPolyphonic(); }
461  };  };
462    
463  class Neg : public IntExpr {  class Neg : public IntExpr {
# Line 450  public: Line 467  public:
467      int evalInt() { return (expr) ? -expr->evalInt() : 0; }      int evalInt() { return (expr) ? -expr->evalInt() : 0; }
468      void dump(int level = 0);      void dump(int level = 0);
469      bool isConstExpr() const { return expr->isConstExpr(); }      bool isConstExpr() const { return expr->isConstExpr(); }
470        bool isPolyphonic() const { return expr->isPolyphonic(); }
471  };  };
472  typedef Ref<Neg,Node> NegRef;  typedef Ref<Neg,Node> NegRef;
473    
# Line 461  public: Line 479  public:
479      String evalStr();      String evalStr();
480      void dump(int level = 0);      void dump(int level = 0);
481      bool isConstExpr() const;      bool isConstExpr() const;
482        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
483  };  };
484  typedef Ref<ConcatString,Node> ConcatStringRef;  typedef Ref<ConcatString,Node> ConcatStringRef;
485    
# Line 479  public: Line 498  public:
498      int evalInt();      int evalInt();
499      void dump(int level = 0);      void dump(int level = 0);
500      bool isConstExpr() const;      bool isConstExpr() const;
501        bool isPolyphonic() const { return lhs->isPolyphonic() || rhs->isPolyphonic(); }
502  private:  private:
503      IntExprRef lhs;      IntExprRef lhs;
504      IntExprRef rhs;      IntExprRef rhs;
# Line 509  public: Line 529  public:
529      int evalInt() { return !expr->evalInt(); }      int evalInt() { return !expr->evalInt(); }
530      void dump(int level = 0);      void dump(int level = 0);
531      bool isConstExpr() const { return expr->isConstExpr(); }      bool isConstExpr() const { return expr->isConstExpr(); }
532        bool isPolyphonic() const { return expr->isPolyphonic(); }
533  };  };
534  typedef Ref<Not,Node> NotRef;  typedef Ref<Not,Node> NotRef;
535    

Legend:
Removed from v.2619  
changed lines
  Added in v.2645

  ViewVC Help
Powered by ViewVC