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

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

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

revision 2611 by schoenebeck, Mon Jun 9 19:20:37 2014 UTC revision 2645 by schoenebeck, Wed Jun 18 00:14:57 2014 UTC
# Line 144  void Args::dump(int level) { Line 144  void Args::dump(int level) {
144      printf(")\n");      printf(")\n");
145  }  }
146    
147    bool Args::isPolyphonic() const {
148        for (int i = 0; i < args.size(); ++i)
149            if (args[i]->isPolyphonic())
150                return true;
151        return false;
152    }
153    
154  EventHandlers::EventHandlers() {  EventHandlers::EventHandlers() {
155      //printf("EventHandlers::Constructor 0x%lx\n", (long long)this);      //printf("EventHandlers::Constructor 0x%lx\n", (long long)this);
156  }  }
# Line 177  EventHandler* EventHandlers::eventHandle Line 184  EventHandler* EventHandlers::eventHandle
184      return const_cast<EventHandler*>(&*args.at(index));      return const_cast<EventHandler*>(&*args.at(index));
185  }  }
186    
187    bool EventHandlers::isPolyphonic() const {
188        for (int i = 0; i < args.size(); ++i)
189            if (args[i]->isPolyphonic())
190                return true;
191        return false;
192    }
193    
194  Assignment::Assignment(VariableRef variable, ExpressionRef value)  Assignment::Assignment(VariableRef variable, ExpressionRef value)
195     : variable(variable), value(value)     : variable(variable), value(value)
196  {  {
# Line 194  StmtFlags_t Assignment::exec() { Line 208  StmtFlags_t Assignment::exec() {
208      return STMT_SUCCESS;      return STMT_SUCCESS;
209  }  }
210    
211    EventHandler::EventHandler(StatementsRef statements) {
212        this->statements = statements;
213        usingPolyphonics = statements->isPolyphonic();
214    }
215    
216  void EventHandler::dump(int level) {  void EventHandler::dump(int level) {
217      printIndents(level);      printIndents(level);
218      printf("EventHandler {\n");      printf("EventHandler {\n");
# Line 217  Statement* Statements::statement(uint i) Line 236  Statement* Statements::statement(uint i)
236      return &*args.at(i);      return &*args.at(i);
237  }  }
238    
239    bool Statements::isPolyphonic() const {
240        for (int i = 0; i < args.size(); ++i)
241            if (args[i]->isPolyphonic())
242                return true;
243        return false;
244    }
245    
246  void FunctionCall::dump(int level) {  void FunctionCall::dump(int level) {
247      printIndents(level);      printIndents(level);
248      printf("FunctionCall '%s' args={\n", functionName.c_str());      printf("FunctionCall '%s' args={\n", functionName.c_str());
# Line 537  Statements* If::branch(uint i) const { Line 563  Statements* If::branch(uint i) const {
563      return NULL;      return NULL;
564  }  }
565    
566    bool If::isPolyphonic() const {
567        if (condition->isPolyphonic() || ifStatements->isPolyphonic())
568            return true;
569        return elseStatements ? elseStatements->isPolyphonic() : false;
570    }
571    
572  void SelectCase::dump(int level) {  void SelectCase::dump(int level) {
573      printIndents(level);      printIndents(level);
574      if (select)      if (select)
# Line 587  Statements* SelectCase::branch(uint i) c Line 619  Statements* SelectCase::branch(uint i) c
619      return NULL;      return NULL;
620  }  }
621    
622    bool SelectCase::isPolyphonic() const {
623        if (select->isPolyphonic()) return true;
624        for (int i = 0; i < branches.size(); ++i)
625            if (branches[i].statements->isPolyphonic())
626                return true;
627        return false;
628    }
629    
630  // void Case::addBranch(IntExprRef condition, StatementsRef statements) {  // void Case::addBranch(IntExprRef condition, StatementsRef statements) {
631  //     CaseBranchRef b = new CaseBranchRef;  //     CaseBranchRef b = new CaseBranchRef;
632  //     b->from = condition;  //     b->from = condition;

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

  ViewVC Help
Powered by ViewVC