--- linuxsampler/trunk/src/scriptvm/ScriptVM.h 2016/07/22 15:51:40 2974 +++ linuxsampler/trunk/src/scriptvm/ScriptVM.h 2019/08/01 10:22:56 3551 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 Christian Schoenebeck + * Copyright (c) 2014-2019 Christian Schoenebeck * * http://www.linuxsampler.org * @@ -173,6 +173,17 @@ VMFunction* functionByName(const String& name) OVERRIDE; /** + * Whether the passed built-in function is disabled and should thus be + * ignored by the parser at the passed parser context (parser state + * where the built-in function call occurs). + * + * @param fn - built-in function to be checked + * @param ctx - parser context at the position where the built-in + * function call is located within the script + */ + bool isFunctionDisabled(VMFunction* fn, VMParserContext* ctx) OVERRIDE; + + /** * Returns all built-in integer script variables. This method returns a * STL map, where the map's key is the variable name and the map's value * is the native pointer to the actual built-in variable. @@ -256,6 +267,29 @@ */ bool isAutoSuspendEnabled() const; + /** + * By default (i.e. in production use) the built-in exit() function + * prohibits any arguments to be passed to its function by scripts. So + * by default, scripts trying to pass any arguments to the built-in + * exit() function will yield in a parser error. + * + * By calling this method the built-in exit() function will optionally + * accept one argument to be passed to its function call by scripts. The + * value of that function argument will become available by calling + * VMExecContext::exitResult() after execution of the script. + * + * @see VMExecContext::exitResult() + */ + void setExitResultEnabled(bool b = true); + + /** + * Returns @c true if the built-in exit() function optionally accepts + * a function argument by scripts. + * + * @see setExitResultEnabled() + */ + bool isExitResultEnabled() const; + VMEventHandler* currentVMEventHandler(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions) VMParserContext* currentVMParserContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions) VMExecContext* currentVMExecContext(); //TODO: should be protected (only usable during exec() calls, intended only for VMFunctions) @@ -264,6 +298,7 @@ VMEventHandler* m_eventHandler; ParserContext* m_parserContext; bool m_autoSuspend; + bool m_acceptExitRes; class CoreVMFunction_message* m_fnMessage; class CoreVMFunction_exit* m_fnExit; class CoreVMFunction_wait* m_fnWait; @@ -272,10 +307,14 @@ class CoreVMFunction_num_elements* m_fnNumElements; class CoreVMFunction_inc* m_fnInc; class CoreVMFunction_dec* m_fnDec; + class CoreVMFunction_in_range* m_fnInRange; class CoreVMFunction_sh_left* m_fnShLeft; class CoreVMFunction_sh_right* m_fnShRight; class CoreVMFunction_min* m_fnMin; class CoreVMFunction_max* m_fnMax; + class CoreVMFunction_array_equal* m_fnArrayEqual; + class CoreVMFunction_search* m_fnSearch; + class CoreVMFunction_sort* m_fnSort; class CoreVMDynVar_NKSP_REAL_TIMER* m_varRealTimer; class CoreVMDynVar_NKSP_PERF_TIMER* m_varPerfTimer; };