42 |
class VMIntResult : public VMFnResult, public VMIntExpr { |
class VMIntResult : public VMFnResult, public VMIntExpr { |
43 |
public: |
public: |
44 |
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 |
45 |
int value; ///< result value of the function call |
vmint value; ///< result value of the function call |
46 |
|
|
47 |
VMIntResult() : flags(STMT_SUCCESS) {} |
VMIntResult() : flags(STMT_SUCCESS) {} |
48 |
int evalInt() OVERRIDE { return value; } |
vmint evalInt() OVERRIDE { return value; } |
49 |
VMExpr* resultValue() OVERRIDE { return this; } |
VMExpr* resultValue() OVERRIDE { return this; } |
50 |
StmtFlags_t resultFlags() OVERRIDE { return flags; } |
StmtFlags_t resultFlags() OVERRIDE { return flags; } |
51 |
bool isConstExpr() const OVERRIDE { return false; } |
bool isConstExpr() const OVERRIDE { return false; } |
77 |
ExprType_t returnType() OVERRIDE { return EMPTY_EXPR; } |
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(vmint iArg) const OVERRIDE { return false; } |
81 |
protected: |
protected: |
82 |
VMEmptyResult result; |
VMEmptyResult result; |
83 |
}; |
}; |
90 |
protected: |
protected: |
91 |
virtual ~VMIntResultFunction() {} |
virtual ~VMIntResultFunction() {} |
92 |
ExprType_t returnType() OVERRIDE { return INT_EXPR; } |
ExprType_t returnType() OVERRIDE { return INT_EXPR; } |
93 |
VMFnResult* errorResult(int i = 0); |
VMFnResult* errorResult(vmint i = 0); |
94 |
VMFnResult* successResult(int i = 0); |
VMFnResult* successResult(vmint i = 0); |
95 |
bool modifiesArg(int iArg) const OVERRIDE { return false; } |
bool modifiesArg(vmint iArg) const OVERRIDE { return false; } |
96 |
protected: |
protected: |
97 |
VMIntResult result; |
VMIntResult result; |
98 |
}; |
}; |
107 |
ExprType_t returnType() OVERRIDE { return STRING_EXPR; } |
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(vmint iArg) const OVERRIDE { return false; } |
111 |
protected: |
protected: |
112 |
VMStringResult result; |
VMStringResult result; |
113 |
}; |
}; |
121 |
*/ |
*/ |
122 |
class CoreVMFunction_message : public VMEmptyResultFunction { |
class CoreVMFunction_message : public VMEmptyResultFunction { |
123 |
public: |
public: |
124 |
int minRequiredArgs() const { return 1; } |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
125 |
int maxAllowedArgs() const { return 1; } |
vmint maxAllowedArgs() const OVERRIDE { return 1; } |
126 |
bool acceptsArgType(int iArg, ExprType_t type) const; |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
127 |
ExprType_t argType(int iArg) const { return STRING_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return STRING_EXPR; } |
128 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
129 |
}; |
}; |
130 |
|
|
131 |
/** |
/** |
134 |
class CoreVMFunction_exit : public VMEmptyResultFunction { |
class CoreVMFunction_exit : public VMEmptyResultFunction { |
135 |
public: |
public: |
136 |
CoreVMFunction_exit(ScriptVM* vm) : vm(vm) {} |
CoreVMFunction_exit(ScriptVM* vm) : vm(vm) {} |
137 |
int minRequiredArgs() const OVERRIDE { return 0; } |
vmint minRequiredArgs() const OVERRIDE { return 0; } |
138 |
int maxAllowedArgs() const OVERRIDE; |
vmint maxAllowedArgs() const OVERRIDE; |
139 |
bool acceptsArgType(int iArg, ExprType_t type) const OVERRIDE; |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
140 |
ExprType_t argType(int iArg) const OVERRIDE { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
141 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
142 |
protected: |
protected: |
143 |
ScriptVM* vm; |
ScriptVM* vm; |
144 |
}; |
}; |
149 |
class CoreVMFunction_wait : public VMEmptyResultFunction { |
class CoreVMFunction_wait : public VMEmptyResultFunction { |
150 |
public: |
public: |
151 |
CoreVMFunction_wait(ScriptVM* vm) : vm(vm) {} |
CoreVMFunction_wait(ScriptVM* vm) : vm(vm) {} |
152 |
int minRequiredArgs() const { return 1; } |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
153 |
int maxAllowedArgs() const { return 1; } |
vmint maxAllowedArgs() const OVERRIDE { return 1; } |
154 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } |
155 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
156 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
157 |
protected: |
protected: |
158 |
ScriptVM* vm; |
ScriptVM* vm; |
159 |
}; |
}; |
163 |
*/ |
*/ |
164 |
class CoreVMFunction_abs : public VMIntResultFunction { |
class CoreVMFunction_abs : public VMIntResultFunction { |
165 |
public: |
public: |
166 |
int minRequiredArgs() const { return 1; } |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
167 |
int maxAllowedArgs() const { return 1; } |
vmint maxAllowedArgs() const OVERRIDE { return 1; } |
168 |
bool acceptsArgType(int iArg, ExprType_t type) const; |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
169 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
170 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
171 |
}; |
}; |
172 |
|
|
173 |
/** |
/** |
175 |
*/ |
*/ |
176 |
class CoreVMFunction_random : public VMIntResultFunction { |
class CoreVMFunction_random : public VMIntResultFunction { |
177 |
public: |
public: |
178 |
int minRequiredArgs() const { return 2; } |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
179 |
int maxAllowedArgs() const { return 2; } |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
180 |
bool acceptsArgType(int iArg, ExprType_t type) const; |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
181 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
182 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
183 |
}; |
}; |
184 |
|
|
185 |
/** |
/** |
187 |
*/ |
*/ |
188 |
class CoreVMFunction_num_elements : public VMIntResultFunction { |
class CoreVMFunction_num_elements : public VMIntResultFunction { |
189 |
public: |
public: |
190 |
int minRequiredArgs() const { return 1; } |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
191 |
int maxAllowedArgs() const { return 1; } |
vmint maxAllowedArgs() const OVERRIDE { return 1; } |
192 |
bool acceptsArgType(int iArg, ExprType_t type) const; |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
193 |
ExprType_t argType(int iArg) const { return INT_ARR_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_ARR_EXPR; } |
194 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
195 |
}; |
}; |
196 |
|
|
197 |
/** |
/** |
199 |
*/ |
*/ |
200 |
class CoreVMFunction_inc : public VMIntResultFunction { |
class CoreVMFunction_inc : public VMIntResultFunction { |
201 |
public: |
public: |
202 |
int minRequiredArgs() const { return 1; } |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
203 |
int maxAllowedArgs() const { return 1; } |
vmint maxAllowedArgs() const OVERRIDE { return 1; } |
204 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } |
205 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
206 |
bool modifiesArg(int iArg) const { return true; } |
bool modifiesArg(vmint iArg) const OVERRIDE { return true; } |
207 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
208 |
}; |
}; |
209 |
|
|
210 |
/** |
/** |
212 |
*/ |
*/ |
213 |
class CoreVMFunction_dec : public VMIntResultFunction { |
class CoreVMFunction_dec : public VMIntResultFunction { |
214 |
public: |
public: |
215 |
int minRequiredArgs() const { return 1; } |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
216 |
int maxAllowedArgs() const { return 1; } |
vmint maxAllowedArgs() const OVERRIDE { return 1; } |
217 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } |
218 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
219 |
bool modifiesArg(int iArg) const { return true; } |
bool modifiesArg(vmint iArg) const OVERRIDE { return true; } |
220 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
221 |
}; |
}; |
222 |
|
|
223 |
/** |
/** |
225 |
*/ |
*/ |
226 |
class CoreVMFunction_in_range : public VMIntResultFunction { |
class CoreVMFunction_in_range : public VMIntResultFunction { |
227 |
public: |
public: |
228 |
int minRequiredArgs() const { return 3; } |
vmint minRequiredArgs() const OVERRIDE { return 3; } |
229 |
int maxAllowedArgs() const { return 3; } |
vmint maxAllowedArgs() const OVERRIDE { return 3; } |
230 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } |
231 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
232 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
233 |
}; |
}; |
234 |
|
|
235 |
/** |
/** |
237 |
*/ |
*/ |
238 |
class CoreVMFunction_sh_left : public VMIntResultFunction { |
class CoreVMFunction_sh_left : public VMIntResultFunction { |
239 |
public: |
public: |
240 |
int minRequiredArgs() const { return 2; } |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
241 |
int maxAllowedArgs() const { return 2; } |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
242 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } |
243 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
244 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
245 |
}; |
}; |
246 |
|
|
247 |
/** |
/** |
249 |
*/ |
*/ |
250 |
class CoreVMFunction_sh_right : public VMIntResultFunction { |
class CoreVMFunction_sh_right : public VMIntResultFunction { |
251 |
public: |
public: |
252 |
int minRequiredArgs() const { return 2; } |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
253 |
int maxAllowedArgs() const { return 2; } |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
254 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } |
255 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
256 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
257 |
}; |
}; |
258 |
|
|
259 |
/** |
/** |
261 |
*/ |
*/ |
262 |
class CoreVMFunction_min : public VMIntResultFunction { |
class CoreVMFunction_min : public VMIntResultFunction { |
263 |
public: |
public: |
264 |
int minRequiredArgs() const { return 2; } |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
265 |
int maxAllowedArgs() const { return 2; } |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
266 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } |
267 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
268 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
269 |
}; |
}; |
270 |
|
|
271 |
/** |
/** |
273 |
*/ |
*/ |
274 |
class CoreVMFunction_max : public VMIntResultFunction { |
class CoreVMFunction_max : public VMIntResultFunction { |
275 |
public: |
public: |
276 |
int minRequiredArgs() const { return 2; } |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
277 |
int maxAllowedArgs() const { return 2; } |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
278 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; } |
279 |
ExprType_t argType(int iArg) const { return INT_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_EXPR; } |
280 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
281 |
}; |
}; |
282 |
|
|
283 |
/** |
/** |
285 |
*/ |
*/ |
286 |
class CoreVMFunction_array_equal : public VMIntResultFunction { |
class CoreVMFunction_array_equal : public VMIntResultFunction { |
287 |
public: |
public: |
288 |
int minRequiredArgs() const { return 2; } |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
289 |
int maxAllowedArgs() const { return 2; } |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
290 |
bool acceptsArgType(int iArg, ExprType_t type) const { return type == INT_ARR_EXPR; } |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_ARR_EXPR; } |
291 |
ExprType_t argType(int iArg) const { return INT_ARR_EXPR; } |
ExprType_t argType(vmint iArg) const OVERRIDE { return INT_ARR_EXPR; } |
292 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
293 |
}; |
}; |
294 |
|
|
295 |
/** |
/** |
297 |
*/ |
*/ |
298 |
class CoreVMFunction_search : public VMIntResultFunction { |
class CoreVMFunction_search : public VMIntResultFunction { |
299 |
public: |
public: |
300 |
int minRequiredArgs() const { return 2; } |
vmint minRequiredArgs() const OVERRIDE { return 2; } |
301 |
int maxAllowedArgs() const { return 2; } |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
302 |
bool acceptsArgType(int iArg, ExprType_t type) const; |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
303 |
ExprType_t argType(int iArg) const; |
ExprType_t argType(vmint iArg) const OVERRIDE; |
304 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
305 |
}; |
}; |
306 |
|
|
307 |
/** |
/** |
309 |
*/ |
*/ |
310 |
class CoreVMFunction_sort : public VMEmptyResultFunction { |
class CoreVMFunction_sort : public VMEmptyResultFunction { |
311 |
public: |
public: |
312 |
int minRequiredArgs() const { return 1; } |
vmint minRequiredArgs() const OVERRIDE { return 1; } |
313 |
int maxAllowedArgs() const { return 2; } |
vmint maxAllowedArgs() const OVERRIDE { return 2; } |
314 |
bool acceptsArgType(int iArg, ExprType_t type) const; |
bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE; |
315 |
ExprType_t argType(int iArg) const; |
ExprType_t argType(vmint iArg) const OVERRIDE; |
316 |
bool modifiesArg(int iArg) const { return iArg == 0; } |
bool modifiesArg(vmint iArg) const OVERRIDE { return iArg == 0; } |
317 |
VMFnResult* exec(VMFnArgs* args); |
VMFnResult* exec(VMFnArgs* args) OVERRIDE; |
318 |
}; |
}; |
319 |
|
|
320 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |