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

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

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

revision 3221 by schoenebeck, Fri May 26 18:30:42 2017 UTC revision 3345 by schoenebeck, Thu Aug 10 13:18:06 2017 UTC
# Line 15  Line 15 
15  #include <stdlib.h>  #include <stdlib.h>
16  #include "tree.h"  #include "tree.h"
17  #include "ScriptVM.h"  #include "ScriptVM.h"
18    #include "../common/RTMath.h"
19    
20  namespace LinuxSampler {  namespace LinuxSampler {
21    
# Line 71  bool CoreVMFunction_message::acceptsArgT Line 72  bool CoreVMFunction_message::acceptsArgT
72  VMFnResult* CoreVMFunction_message::exec(VMFnArgs* args) {  VMFnResult* CoreVMFunction_message::exec(VMFnArgs* args) {
73      if (!args->argsCount()) return errorResult();      if (!args->argsCount()) return errorResult();
74    
75        uint64_t usecs = RTMath::unsafeMicroSeconds(RTMath::real_clock);
76    
77      VMStringExpr* strExpr = dynamic_cast<VMStringExpr*>(args->arg(0));      VMStringExpr* strExpr = dynamic_cast<VMStringExpr*>(args->arg(0));
78      if (strExpr) {      if (strExpr) {
79          std::cout << "[ScriptVM] " << strExpr->evalStr() << "\n";          printf("[ScriptVM %.3f] %s\n", usecs/1000000.f, strExpr->evalStr().c_str());
80          return successResult();          return successResult();
81      }      }
82    
83      VMIntExpr* intExpr = dynamic_cast<VMIntExpr*>(args->arg(0));      VMIntExpr* intExpr = dynamic_cast<VMIntExpr*>(args->arg(0));
84      if (intExpr) {      if (intExpr) {
85          std::cout << "[ScriptVM] " << intExpr->evalInt() << "\n";          printf("[ScriptVM %.3f] %d\n", usecs/1000000.f, intExpr->evalInt());
86          return successResult();          return successResult();
87      }      }
88    
# Line 291  struct ArrElemPOD { Line 294  struct ArrElemPOD {
294      int m_index;      int m_index;
295  };  };
296    
297  static inline void swap(class ArrElemRef& a, class ArrElemRef& b);  static inline void swap(class ArrElemRef a, class ArrElemRef b);
298    
299  class ArrElemRef : protected ArrElemPOD {  class ArrElemRef : protected ArrElemPOD {
300  public:  public:
# Line 368  protected: Line 371  protected:
371          m_array->assignIntElement(m_index, value);          m_array->assignIntElement(m_index, value);
372      }      }
373    
374      friend void swap(class ArrElemRef& a, class ArrElemRef& b);      friend void swap(class ArrElemRef a, class ArrElemRef b);
375  };  };
376    
377  class ArrElemPtr : protected ArrElemPOD {  class ArrElemPtr : protected ArrElemPOD {
# Line 386  public: Line 389  public:
389      }      }
390  };  };
391    
392  static inline void swap(ArrElemRef& a, ArrElemRef& b) {  static inline void swap(ArrElemRef a, ArrElemRef b) {
393      int valueA = a.getValue();      int valueA = a.getValue();
394      int valueB = b.getValue();      int valueB = b.getValue();
395      a.setValue(valueB);      a.setValue(valueB);
# Line 426  public: Line 429  public:
429          --m_index;          --m_index;
430          return it;          return it;
431      }      }
432        inline ArrExprIter& operator+=(difference_type d) {
433            m_index += d;
434            return *this;
435        }
436        inline ArrExprIter& operator-=(difference_type d) {
437            m_index -= d;
438            return *this;
439        }
440      inline bool operator==(const ArrExprIter& other) const {      inline bool operator==(const ArrExprIter& other) const {
441          return m_index == other.m_index;          return m_index == other.m_index;
442      }      }

Legend:
Removed from v.3221  
changed lines
  Added in v.3345

  ViewVC Help
Powered by ViewVC