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

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

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

revision 2970 by schoenebeck, Thu Jul 21 16:22:55 2016 UTC revision 3076 by schoenebeck, Thu Jan 5 18:00:52 2017 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2014-2015 Christian Schoenebeck   * Copyright (c) 2014-2016 Christian Schoenebeck
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 29  public: Line 29  public:
29      StmtFlags_t flags; ///< general completion status (i.e. success or failure) of the function call      StmtFlags_t flags; ///< general completion status (i.e. success or failure) of the function call
30    
31      VMEmptyResult() : flags(STMT_SUCCESS) {}      VMEmptyResult() : flags(STMT_SUCCESS) {}
32      ExprType_t exprType() const { return EMPTY_EXPR; }      ExprType_t exprType() const OVERRIDE { return EMPTY_EXPR; }
33      VMExpr* resultValue() { return this; }      VMExpr* resultValue() OVERRIDE { return this; }
34      StmtFlags_t resultFlags() { return flags; }      StmtFlags_t resultFlags() OVERRIDE { return flags; }
35      bool isConstExpr() const OVERRIDE { return false; }      bool isConstExpr() const OVERRIDE { return false; }
36  };  };
37    
# Line 45  public: Line 45  public:
45      int value; ///< result value of the function call      int value; ///< result value of the function call
46    
47      VMIntResult() : flags(STMT_SUCCESS) {}      VMIntResult() : flags(STMT_SUCCESS) {}
48      int evalInt() { return value; }      int evalInt() OVERRIDE { return value; }
49      VMExpr* resultValue() { return this; }      VMExpr* resultValue() OVERRIDE { return this; }
50      StmtFlags_t resultFlags() { return flags; }      StmtFlags_t resultFlags() OVERRIDE { return flags; }
51      bool isConstExpr() const OVERRIDE { return false; }      bool isConstExpr() const OVERRIDE { return false; }
52  };  };
53    
# Line 61  public: Line 61  public:
61      String value; ///< result value of the function call      String value; ///< result value of the function call
62    
63      VMStringResult() : flags(STMT_SUCCESS) {}      VMStringResult() : flags(STMT_SUCCESS) {}
64      String evalStr() { return value; }      String evalStr() OVERRIDE { return value; }
65      VMExpr* resultValue() { return this; }      VMExpr* resultValue() OVERRIDE { return this; }
66      StmtFlags_t resultFlags() { return flags; }      StmtFlags_t resultFlags() OVERRIDE { return flags; }
67      bool isConstExpr() const OVERRIDE { return false; }      bool isConstExpr() const OVERRIDE { return false; }
68  };  };
69    
# Line 73  public: Line 73  public:
73   */   */
74  class VMEmptyResultFunction : public VMFunction {  class VMEmptyResultFunction : public VMFunction {
75  protected:  protected:
76      ExprType_t returnType() { return EMPTY_EXPR; }      virtual ~VMEmptyResultFunction() {}
77        ExprType_t returnType() OVERRIDE { return EMPTY_EXPR; }
78      VMFnResult* errorResult();      VMFnResult* errorResult();
79      VMFnResult* successResult();      VMFnResult* successResult();
80      bool modifiesArg(int iArg) const OVERRIDE { return false; }      bool modifiesArg(int iArg) const OVERRIDE { return false; }
# Line 87  protected: Line 88  protected:
88   */   */
89  class VMIntResultFunction : public VMFunction {  class VMIntResultFunction : public VMFunction {
90  protected:  protected:
91      ExprType_t returnType() { return INT_EXPR; }      virtual ~VMIntResultFunction() {}
92        ExprType_t returnType() OVERRIDE { return INT_EXPR; }
93      VMFnResult* errorResult(int i = 0);      VMFnResult* errorResult(int i = 0);
94      VMFnResult* successResult(int i = 0);      VMFnResult* successResult(int i = 0);
95      bool modifiesArg(int iArg) const OVERRIDE { return false; }      bool modifiesArg(int iArg) const OVERRIDE { return false; }
# Line 101  protected: Line 103  protected:
103   */   */
104  class VMStringResultFunction : public VMFunction {  class VMStringResultFunction : public VMFunction {
105  protected:  protected:
106      ExprType_t returnType() { return STRING_EXPR; }      virtual ~VMStringResultFunction() {}
107        ExprType_t returnType() OVERRIDE { return STRING_EXPR; }
108      VMFnResult* errorResult(const String& s = "");      VMFnResult* errorResult(const String& s = "");
109      VMFnResult* successResult(const String& s = "");      VMFnResult* successResult(const String& s = "");
110      bool modifiesArg(int iArg) const OVERRIDE { return false; }      bool modifiesArg(int iArg) const OVERRIDE { return false; }
# Line 214  public: Line 217  public:
217      VMFnResult* exec(VMFnArgs* args);      VMFnResult* exec(VMFnArgs* args);
218  };  };
219    
220    /**
221     * Implements the built-in in_range() script function.
222     */
223    class CoreVMFunction_in_range : public VMIntResultFunction {
224    public:
225        int minRequiredArgs() const { return 3; }
226        int maxAllowedArgs() const { return 3; }
227        bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; }
228        ExprType_t argType(int iArg) const { return INT_EXPR; }
229        VMFnResult* exec(VMFnArgs* args);
230    };
231    
232  /**  /**
233   * Implements the built-in sh_left() script function.   * Implements the built-in sh_left() script function.
234   */   */

Legend:
Removed from v.2970  
changed lines
  Added in v.3076

  ViewVC Help
Powered by ViewVC