--- linuxsampler/trunk/src/scriptvm/CoreVMFunctions.h 2019/09/01 20:01:03 3589 +++ linuxsampler/trunk/src/scriptvm/CoreVMFunctions.h 2019/09/02 09:03:31 3590 @@ -495,6 +495,247 @@ VMFnResult* exec(VMFnArgs* args) OVERRIDE; }; +/** + * Implements the built-in round() script function. + */ +class CoreVMFunction_round FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in ceil() script function. + */ +class CoreVMFunction_ceil FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in floor() script function. + */ +class CoreVMFunction_floor FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in sqrt() script function. + */ +class CoreVMFunction_sqrt FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in log() script function. + */ +class CoreVMFunction_log FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in log2() script function. + */ +class CoreVMFunction_log2 FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in log10() script function. + */ +class CoreVMFunction_log10 FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in exp() script function. + */ +class CoreVMFunction_exp FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in pow() script function. + */ +class CoreVMFunction_pow FINAL : public VMRealResultFunction { + using Super = VMRealResultFunction; // just an alias for the super class +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 2; } + vmint maxAllowedArgs() const OVERRIDE { return 2; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE; + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return iArg == 0; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in sin() script function. + */ +class CoreVMFunction_sin FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in cos() script function. + */ +class CoreVMFunction_cos FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in tan() script function. + */ +class CoreVMFunction_tan FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in asin() script function. + */ +class CoreVMFunction_asin FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in acos() script function. + */ +class CoreVMFunction_acos FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + +/** + * Implements the built-in atan() script function. + */ +class CoreVMFunction_atan FINAL : public VMRealResultFunction { +public: + StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE; + bool returnsFinal(VMFnArgs* args) OVERRIDE; + vmint minRequiredArgs() const OVERRIDE { return 1; } + vmint maxAllowedArgs() const OVERRIDE { return 1; } + bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; } + bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; } + bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; } + VMFnResult* exec(VMFnArgs* args) OVERRIDE; +}; + } // namespace LinuxSampler #endif // LS_COREVMFUNCTIONS_H