/[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 3586 by schoenebeck, Fri Aug 30 18:59:21 2019 UTC revision 3690 by schoenebeck, Fri Jan 3 10:18:21 2020 UTC
# Line 224  struct VariableDecl { Line 224  struct VariableDecl {
224      ParserContext* ctx;      ParserContext* ctx;
225      bool isPolyphonic;      bool isPolyphonic;
226      bool isConst;      bool isConst;
     bool isFinal;  
227      vmint elements = 1;      vmint elements = 1;
228      vmint memPos;      vmint memPos;
229      vmint unitFactorMemPos;      vmint unitFactorMemPos;
230      StdUnit_t unitType = VM_NO_UNIT;      StdUnit_t unitType = VM_NO_UNIT;
231        bool isFinal;
232  };  };
233    
234  class Variable : virtual public VMVariable, virtual public Expression {  class Variable : virtual public VMVariable, virtual public Expression {
# Line 279  public: Line 279  public:
279  typedef Ref<RealVariable,Node> RealVariableRef;  typedef Ref<RealVariable,Node> RealVariableRef;
280    
281  struct IntVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17  struct IntVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17
282        // additions for RealVarDef
283        vmint value = 0; //NOTE: sequence matters! Since this is usually initialized with VMIntExpr::evalInt() it should be before member unitFactor, since the latter is usually initialized with VMIntExpr::unitFactor() which does not evaluate the expression.
284        vmfloat unitFactor = VM_NO_FACTOR;
285      // copied from VariableDecl      // copied from VariableDecl
286      ParserContext* ctx;      ParserContext* ctx;
287      bool isPolyphonic;      bool isPolyphonic;
288      bool isConst;      bool isConst;
     bool isFinal;  
289      vmint elements = 1;      vmint elements = 1;
290      vmint memPos;      vmint memPos;
291      vmint unitFactorMemPos;      vmint unitFactorMemPos;
292      StdUnit_t unitType = VM_NO_UNIT;      StdUnit_t unitType = VM_NO_UNIT;
293      // additions for RealVarDef      bool isFinal;
     vmint value = 0; //NOTE: sequence matters! Since this is usually initialized with VMIntExpr::evalInt() it should be before member unitFactor, since the latter is usually initialized with VMIntExpr::unitFactor() which does not evaluate the expression.  
     vmfloat unitFactor = VM_NO_FACTOR;  
294  };  };
295    
296  class ConstIntVariable FINAL : public IntVariable {  class ConstIntVariable FINAL : public IntVariable {
# Line 306  public: Line 306  public:
306  typedef Ref<ConstIntVariable,Node> ConstIntVariableRef;  typedef Ref<ConstIntVariable,Node> ConstIntVariableRef;
307    
308  struct RealVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17  struct RealVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17
309        // additions for RealVarDef
310        vmfloat value = vmfloat(0); //NOTE: sequence matters! Since this is usually initialized with VMRealExpr::evalReal() it should be before member unitFactor, since the latter is usually initialized with VMRealExpr::unitFactor() which does not evaluate the expression.
311        vmfloat unitFactor = VM_NO_FACTOR;
312      // copied from VariableDecl      // copied from VariableDecl
313      ParserContext* ctx;      ParserContext* ctx;
314      bool isPolyphonic;      bool isPolyphonic;
315      bool isConst;      bool isConst;
     bool isFinal;  
316      vmint elements = 1;      vmint elements = 1;
317      vmint memPos;      vmint memPos;
318      vmint unitFactorMemPos;      vmint unitFactorMemPos;
319      StdUnit_t unitType = VM_NO_UNIT;      StdUnit_t unitType = VM_NO_UNIT;
320      // additions for RealVarDef      bool isFinal;
     vmfloat value = vmfloat(0); //NOTE: sequence matters! Since this is usually initialized with VMRealExpr::evalReal() it should be before member unitFactor, since the latter is usually initialized with VMRealExpr::unitFactor() which does not evaluate the expression.  
     vmfloat unitFactor = VM_NO_FACTOR;  
321  };  };
322    
323  class ConstRealVariable FINAL : public RealVariable {  class ConstRealVariable FINAL : public RealVariable {
# Line 688  public: Line 688  public:
688  };  };
689  typedef Ref<OnController,Node> OnControllerRef;  typedef Ref<OnController,Node> OnControllerRef;
690    
691    class OnRpn FINAL : public EventHandler {
692    public:
693        OnRpn(StatementsRef statements) : EventHandler(statements) {}
694        VMEventHandlerType_t eventHandlerType() const OVERRIDE { return VM_EVENT_HANDLER_RPN; }
695        String eventHandlerName() const OVERRIDE { return "rpn"; }
696    };
697    typedef Ref<OnRpn,Node> OnRpnRef;
698    
699    class OnNrpn FINAL : public EventHandler {
700    public:
701        OnNrpn(StatementsRef statements) : EventHandler(statements) {}
702        VMEventHandlerType_t eventHandlerType() const OVERRIDE { return VM_EVENT_HANDLER_NRPN; }
703        String eventHandlerName() const OVERRIDE { return "nrpn"; }
704    };
705    typedef Ref<OnNrpn,Node> OnNrpnRef;
706    
707  class EventHandlers FINAL : virtual public Node {  class EventHandlers FINAL : virtual public Node {
708      std::vector<EventHandlerRef> args;      std::vector<EventHandlerRef> args;
709  public:  public:
# Line 937  public: Line 953  public:
953      OnNoteRef onNote;      OnNoteRef onNote;
954      OnReleaseRef onRelease;      OnReleaseRef onRelease;
955      OnControllerRef onController;      OnControllerRef onController;
956        OnRpnRef onRpn;
957        OnNrpnRef onNrpn;
958    
959      ArrayList<vmint>* globalIntMemory;      ArrayList<vmint>* globalIntMemory;
960      ArrayList<vmfloat>* globalRealMemory;      ArrayList<vmfloat>* globalRealMemory;
# Line 982  public: Line 1000  public:
1000      VMEventHandler* eventHandler(uint index) OVERRIDE;      VMEventHandler* eventHandler(uint index) OVERRIDE;
1001      VMEventHandler* eventHandlerByName(const String& name) OVERRIDE;      VMEventHandler* eventHandlerByName(const String& name) OVERRIDE;
1002      void registerBuiltInConstIntVariables(const std::map<String,vmint>& vars);      void registerBuiltInConstIntVariables(const std::map<String,vmint>& vars);
1003        void registerBuiltInConstRealVariables(const std::map<String,vmfloat>& vars);
1004      void registerBuiltInIntVariables(const std::map<String,VMIntPtr*>& vars);      void registerBuiltInIntVariables(const std::map<String,VMIntPtr*>& vars);
1005      void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars);      void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars);
1006      void registerBuiltInDynVariables(const std::map<String,VMDynVar*>& vars);      void registerBuiltInDynVariables(const std::map<String,VMDynVar*>& vars);

Legend:
Removed from v.3586  
changed lines
  Added in v.3690

  ViewVC Help
Powered by ViewVC