1 |
/* |
/* |
2 |
* Copyright (c) 2014 - 2017 Christian Schoenebeck |
* Copyright (c) 2014 - 2019 Christian Schoenebeck |
3 |
* |
* |
4 |
* http://www.linuxsampler.org |
* http://www.linuxsampler.org |
5 |
* |
* |
143 |
return max; |
return max; |
144 |
} |
} |
145 |
|
|
146 |
ScriptVM::ScriptVM() : m_eventHandler(NULL), m_parserContext(NULL), m_autoSuspend(true) { |
ScriptVM::ScriptVM() : |
147 |
|
m_eventHandler(NULL), m_parserContext(NULL), m_autoSuspend(true), |
148 |
|
m_acceptExitRes(false) |
149 |
|
{ |
150 |
m_fnMessage = new CoreVMFunction_message; |
m_fnMessage = new CoreVMFunction_message; |
151 |
m_fnExit = new CoreVMFunction_exit; |
m_fnExit = new CoreVMFunction_exit(this); |
152 |
m_fnWait = new CoreVMFunction_wait(this); |
m_fnWait = new CoreVMFunction_wait(this); |
153 |
m_fnAbs = new CoreVMFunction_abs; |
m_fnAbs = new CoreVMFunction_abs; |
154 |
m_fnRandom = new CoreVMFunction_random; |
m_fnRandom = new CoreVMFunction_random; |
360 |
return m_autoSuspend; |
return m_autoSuspend; |
361 |
} |
} |
362 |
|
|
363 |
|
void ScriptVM::setExitResultEnabled(bool b) { |
364 |
|
m_acceptExitRes = b; |
365 |
|
} |
366 |
|
|
367 |
|
bool ScriptVM::isExitResultEnabled() const { |
368 |
|
return m_acceptExitRes; |
369 |
|
} |
370 |
|
|
371 |
VMExecStatus_t ScriptVM::exec(VMParserContext* parserContext, VMExecContext* execContex, VMEventHandler* handler) { |
VMExecStatus_t ScriptVM::exec(VMParserContext* parserContext, VMExecContext* execContex, VMEventHandler* handler) { |
372 |
m_parserContext = dynamic_cast<ParserContext*>(parserContext); |
m_parserContext = dynamic_cast<ParserContext*>(parserContext); |
373 |
if (!m_parserContext) { |
if (!m_parserContext) { |
391 |
|
|
392 |
ctx->status = VM_EXEC_RUNNING; |
ctx->status = VM_EXEC_RUNNING; |
393 |
ctx->instructionsCount = 0; |
ctx->instructionsCount = 0; |
394 |
|
ctx->clearExitRes(); |
395 |
StmtFlags_t& flags = ctx->flags; |
StmtFlags_t& flags = ctx->flags; |
396 |
int instructionsCounter = 0; |
int instructionsCounter = 0; |
397 |
int synced = m_autoSuspend ? 0 : 1; |
int synced = m_autoSuspend ? 0 : 1; |