/[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 3260 by schoenebeck, Wed May 31 21:07:44 2017 UTC revision 3551 by schoenebeck, Thu Aug 1 10:22:56 2019 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2014 - 2017 Christian Schoenebeck and Andreas Persson   * Copyright (c) 2014 - 2019 Christian Schoenebeck and Andreas Persson
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 16  Line 16 
16  namespace LinuxSampler {  namespace LinuxSampler {
17            
18  bool isNoOperation(StatementRef statement) {  bool isNoOperation(StatementRef statement) {
19      NoOperation* noOp = dynamic_cast<NoOperation*>(&*statement);      return statement->statementType() == STMT_NOOP;
     return noOp;  
20  }  }
21            
22  Node::Node() {  Node::Node() {
# Line 35  String IntExpr::evalCastToStr() { Line 34  String IntExpr::evalCastToStr() {
34      return ToString(evalInt());      return ToString(evalInt());
35  }  }
36    
37  /*String IntArrayExpr::evalCastToStr() {  String IntArrayExpr::evalCastToStr() {
38      String s = "{";      String s = "{";
39      for (int i = 0; i < arraySize(); ++i) {      for (int i = 0; i < arraySize(); ++i) {
40          int val = evalIntElement(i);          int val = evalIntElement(i);
# Line 44  String IntExpr::evalCastToStr() { Line 43  String IntExpr::evalCastToStr() {
43      }      }
44      s += "}";      s += "}";
45      return s;      return s;
46  }*/  }
47    
48  int IntLiteral::evalInt() {  int IntLiteral::evalInt() {
49      return value;      return value;
# Line 521  void BuiltInIntArrayVariable::dump(int l Line 520  void BuiltInIntArrayVariable::dump(int l
520      printf("Built-In Int Array Variable '%s'\n", name.c_str());      printf("Built-In Int Array Variable '%s'\n", name.c_str());
521  }  }
522    
523  IntArrayElement::IntArrayElement(IntArrayVariableRef array, IntExprRef arrayIndex)  IntArrayElement::IntArrayElement(IntArrayExprRef array, IntExprRef arrayIndex)
524      : IntVariable(NULL, false, false, 0), array(array), index(arrayIndex)      : IntVariable(NULL, false, false, 0), array(array), index(arrayIndex)
525  {      {    
526  }  }
# Line 977  void ParserContext::addWrn(int firstLine Line 976  void ParserContext::addWrn(int firstLine
976      vIssues.push_back(w);      vIssues.push_back(w);
977  }  }
978    
979    void ParserContext::addPreprocessorComment(int firstLine, int lastLine, int firstColumn, int lastColumn) {
980        CodeBlock block;
981        block.firstLine = firstLine;
982        block.lastLine = lastLine;
983        block.firstColumn = firstColumn;
984        block.lastColumn = lastColumn;
985        vPreprocessorComments.push_back(block);
986    }
987    
988  bool ParserContext::setPreprocessorCondition(const char* name) {  bool ParserContext::setPreprocessorCondition(const char* name) {
989      if (builtinPreprocessorConditions.count(name)) return false;      if (builtinPreprocessorConditions.count(name)) return false;
990      if (userPreprocessorConditions.count(name)) return false;      if (userPreprocessorConditions.count(name)) return false;
# Line 1008  std::vector<ParserIssue> ParserContext:: Line 1016  std::vector<ParserIssue> ParserContext::
1016      return vWarnings;      return vWarnings;
1017  }  }
1018    
1019    std::vector<CodeBlock> ParserContext::preprocessorComments() const {
1020        return vPreprocessorComments;
1021    }
1022    
1023  VMEventHandler* ParserContext::eventHandler(uint index) {  VMEventHandler* ParserContext::eventHandler(uint index) {
1024      if (!handlers) return NULL;      if (!handlers) return NULL;
1025      return handlers->eventHandler(index);      return handlers->eventHandler(index);
# Line 1054  void ParserContext::registerBuiltInDynVa Line 1066  void ParserContext::registerBuiltInDynVa
1066      }      }
1067  }  }
1068    
1069    ExecContext::ExecContext() :
1070        status(VM_EXEC_NOT_RUNNING), flags(STMT_SUCCESS), stackFrame(-1),
1071        suspendMicroseconds(0), instructionsCount(0)
1072    {
1073        exitRes.value = NULL;
1074    }
1075    
1076    void ExecContext::forkTo(VMExecContext* ectx) const {
1077        ExecContext* child = dynamic_cast<ExecContext*>(ectx);
1078    
1079        child->polyphonicIntMemory.copyFlatFrom(polyphonicIntMemory);
1080        child->status = VM_EXEC_SUSPENDED;
1081        child->flags = STMT_SUCCESS;
1082        child->stack.copyFlatFrom(stack);
1083        child->stackFrame = stackFrame;
1084        child->suspendMicroseconds = 0;
1085        child->instructionsCount = 0;
1086    }
1087    
1088  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.3260  
changed lines
  Added in v.3551

  ViewVC Help
Powered by ViewVC