--- linuxsampler/trunk/src/scriptvm/ScriptVM.cpp 2019/08/01 09:56:27 3550 +++ linuxsampler/trunk/src/scriptvm/ScriptVM.cpp 2019/08/01 10:22:56 3551 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 - 2017 Christian Schoenebeck + * Copyright (c) 2014 - 2019 Christian Schoenebeck * * http://www.linuxsampler.org * @@ -143,9 +143,12 @@ return max; } - ScriptVM::ScriptVM() : m_eventHandler(NULL), m_parserContext(NULL), m_autoSuspend(true) { + ScriptVM::ScriptVM() : + m_eventHandler(NULL), m_parserContext(NULL), m_autoSuspend(true), + m_acceptExitRes(false) + { m_fnMessage = new CoreVMFunction_message; - m_fnExit = new CoreVMFunction_exit; + m_fnExit = new CoreVMFunction_exit(this); m_fnWait = new CoreVMFunction_wait(this); m_fnAbs = new CoreVMFunction_abs; m_fnRandom = new CoreVMFunction_random; @@ -357,6 +360,14 @@ return m_autoSuspend; } + void ScriptVM::setExitResultEnabled(bool b) { + m_acceptExitRes = b; + } + + bool ScriptVM::isExitResultEnabled() const { + return m_acceptExitRes; + } + VMExecStatus_t ScriptVM::exec(VMParserContext* parserContext, VMExecContext* execContex, VMEventHandler* handler) { m_parserContext = dynamic_cast(parserContext); if (!m_parserContext) { @@ -380,6 +391,7 @@ ctx->status = VM_EXEC_RUNNING; ctx->instructionsCount = 0; + ctx->clearExitRes(); StmtFlags_t& flags = ctx->flags; int instructionsCounter = 0; int synced = m_autoSuspend ? 0 : 1;