/[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 3056 by schoenebeck, Fri Dec 16 12:57:59 2016 UTC revision 3253 by schoenebeck, Tue May 30 12:08:45 2017 UTC
# Line 1  Line 1 
1  /*                                                              -*- c++ -*-  /*                                                              -*- c++ -*-
2   *   *
3   * Copyright (c) 2014 - 2016 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 196  public: Line 197  public:
197      BuiltInIntArrayVariable(const String& name, VMInt8Array* array);      BuiltInIntArrayVariable(const String& name, VMInt8Array* array);
198      int arraySize() const { return array->size; }      int arraySize() const { return array->size; }
199      int evalIntElement(uint i);      int evalIntElement(uint i);
200        bool isAssignable() const OVERRIDE { return !array->readonly; }
201      void assignIntElement(uint i, int value);      void assignIntElement(uint i, int value);
202      void dump(int level = 0);      void dump(int level = 0);
203  };  };
# Line 340  public: Line 342  public:
342      bool isAssignable() const OVERRIDE { return dynVar->isAssignable(); }      bool isAssignable() const OVERRIDE { return dynVar->isAssignable(); }
343      bool isPolyphonic() const OVERRIDE { return false; }      bool isPolyphonic() const OVERRIDE { return false; }
344      void assign(Expression* expr) OVERRIDE { dynVar->assignExpr(expr); }      void assign(Expression* expr) OVERRIDE { dynVar->assignExpr(expr); }
345        VMIntArrayExpr* asIntArray() const OVERRIDE { return dynVar->asIntArray(); }
346      int evalInt() OVERRIDE;      int evalInt() OVERRIDE;
347      String evalStr() OVERRIDE;      String evalStr() OVERRIDE;
348      String evalCastToStr() OVERRIDE;      String evalCastToStr() OVERRIDE;
# Line 354  class FunctionCall : virtual public Leaf Line 357  class FunctionCall : virtual public Leaf
357  public:  public:
358      FunctionCall(const char* function, ArgsRef args, VMFunction* fn) :      FunctionCall(const char* function, ArgsRef args, VMFunction* fn) :
359          functionName(function), args(args), fn(fn) { }          functionName(function), args(args), fn(fn) { }
360      void dump(int level = 0);      void dump(int level = 0) OVERRIDE;
361      StmtFlags_t exec();      StmtFlags_t exec() OVERRIDE;
362      int evalInt();      int evalInt() OVERRIDE;
363      VMIntArrayExpr* asIntArray() const OVERRIDE;      VMIntArrayExpr* asIntArray() const OVERRIDE;
364      String evalStr();      String evalStr() OVERRIDE;
365      bool isConstExpr() const { return false; }      bool isConstExpr() const OVERRIDE { return false; }
366      ExprType_t exprType() const;      ExprType_t exprType() const OVERRIDE;
367      String evalCastToStr();      String evalCastToStr() OVERRIDE;
368      bool isPolyphonic() const { return args->isPolyphonic(); }      bool isPolyphonic() const OVERRIDE { return args->isPolyphonic(); }
369  protected:  protected:
370      VMFnResult* execVMFn();      VMFnResult* execVMFn();
371  };  };
# Line 678  public: Line 681  public:
681      ArrayList<StackFrame> stack;      ArrayList<StackFrame> stack;
682      int stackFrame;      int stackFrame;
683      int suspendMicroseconds;      int suspendMicroseconds;
684        size_t instructionsCount;
685    
686      ExecContext() :      ExecContext() :
687          status(VM_EXEC_NOT_RUNNING), stackFrame(-1), suspendMicroseconds(0) {}          status(VM_EXEC_NOT_RUNNING), stackFrame(-1), suspendMicroseconds(0),
688            instructionsCount(0) {}
689    
690      virtual ~ExecContext() {}      virtual ~ExecContext() {}
691    
# Line 708  public: Line 713  public:
713      int suspensionTimeMicroseconds() const OVERRIDE {      int suspensionTimeMicroseconds() const OVERRIDE {
714          return suspendMicroseconds;          return suspendMicroseconds;
715      }      }
716    
717        void resetPolyphonicData() OVERRIDE {
718            if (polyphonicIntMemory.empty()) return;
719            memset(&polyphonicIntMemory[0], 0, polyphonicIntMemory.size() * sizeof(int));
720        }
721    
722        size_t instructionsPerformed() const OVERRIDE {
723            return instructionsCount;
724        }
725  };  };
726    
727  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.3056  
changed lines
  Added in v.3253

  ViewVC Help
Powered by ViewVC