2015-02-23 22:01:00 +01:00
|
|
|
// vim: set sts=2 ts=8 sw=2 tw=99 et:
|
|
|
|
//
|
|
|
|
// Copyright (C) 2006-2015 AlliedModders LLC
|
|
|
|
//
|
|
|
|
// This file is part of SourcePawn. SourcePawn is free software: you can
|
|
|
|
// redistribute it and/or modify it under the terms of the GNU General Public
|
|
|
|
// License as published by the Free Software Foundation, either version 3 of
|
|
|
|
// the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along with
|
|
|
|
// SourcePawn. If not, see http://www.gnu.org/licenses/.
|
|
|
|
//
|
2008-03-30 09:00:22 +02:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2015-02-24 01:14:59 +01:00
|
|
|
#include "scripted-invoker.h"
|
2015-02-24 01:44:15 +01:00
|
|
|
#include "plugin-runtime.h"
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
#include "environment.h"
|
|
|
|
#include "plugin-context.h"
|
2008-03-30 09:00:22 +02:00
|
|
|
|
|
|
|
/********************
|
|
|
|
* FUNCTION CALLING *
|
|
|
|
********************/
|
|
|
|
|
Rewrite the .smx parser.
This removes one the last remnants of the SourceMod 1.0 VM implementation.
The new parser introduces a number of design changes in the VM. First, the VM now takes greater responsibility for validating and sanity checking the structure of the SMX container format. Previously, malformed SMX files could easily crash SourcePawn. The loader now rejects files that have out-of-bounds offsets or incomplete sections. Complex sections, like debug info or the code stream, are verified lazily.
Internally, the sp_plugin_t structure has been removed. It has been replaced by a new LegacyImage class, designed to be independent from the SPVM API. This potentially lets us load code streams from non-.smx containers. More importantly, it removes a lot of bookkeeping and pre-computed state from PluginRuntime. The LegacyImage class is now responsible for handling debug info as well.
PluginRuntime is now intended to hold only cached or immutable data, and PluginContext holds all VM state. As such PluginContext is now responsible for allocating a plugin's runtime memory, not PluginRuntime.
Finally, some aspects of the loading process have been cleaned up. The
decompression and image handoff logic should now be easier to
understand.
2015-02-25 11:19:38 +01:00
|
|
|
using namespace sp;
|
|
|
|
using namespace SourcePawn;
|
|
|
|
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
ScriptedInvoker::ScriptedInvoker(PluginRuntime *runtime, funcid_t id, uint32_t pub_id)
|
|
|
|
: env_(Environment::get()),
|
|
|
|
context_(runtime->GetBaseContext()),
|
|
|
|
m_curparam(0),
|
|
|
|
m_errorstate(SP_ERROR_NONE),
|
|
|
|
m_FnId(id),
|
|
|
|
cc_function_(nullptr)
|
|
|
|
{
|
|
|
|
runtime->GetPublicByIndex(pub_id, &public_);
|
|
|
|
|
|
|
|
size_t rt_len = strlen(runtime->Name());
|
|
|
|
size_t len = rt_len + strlen("::") + strlen(public_->name);
|
|
|
|
|
|
|
|
full_name_ = new char[len + 1];
|
|
|
|
strcpy(full_name_, runtime->Name());
|
|
|
|
strcpy(&full_name_[rt_len], "::");
|
|
|
|
strcpy(&full_name_[rt_len + 2], public_->name);
|
|
|
|
}
|
|
|
|
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::~ScriptedInvoker()
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
bool
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::IsRunnable()
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
return !context_->runtime()->IsPaused();
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::CallFunction(const cell_t *params, unsigned int num_params, cell_t *result)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
Environment::get()->ReportError(SP_ERROR_ABORTED);
|
|
|
|
return SP_ERROR_ABORTED;
|
2008-07-11 10:18:43 +02:00
|
|
|
}
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::CallFunction2(IPluginContext *pContext, const cell_t *params, unsigned int num_params, cell_t *result)
|
2008-07-11 10:18:43 +02:00
|
|
|
{
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
Environment::get()->ReportError(SP_ERROR_ABORTED);
|
|
|
|
return SP_ERROR_ABORTED;
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
IPluginContext *
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::GetParentContext()
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
return context_;
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-24 00:47:47 +01:00
|
|
|
int ScriptedInvoker::PushCell(cell_t cell)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
|
|
|
return SetError(SP_ERROR_PARAMS_MAX);
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
m_info[m_curparam].marked = false;
|
|
|
|
m_params[m_curparam] = cell;
|
|
|
|
m_curparam++;
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
return SP_ERROR_NONE;
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::PushCellByRef(cell_t *cell, int flags)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
return PushArray(cell, 1, flags);
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::PushFloat(float number)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
cell_t val = *(cell_t *)&number;
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
return PushCell(val);
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::PushFloatByRef(float *number, int flags)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
return PushCellByRef((cell_t *)number, flags);
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::PushArray(cell_t *inarray, unsigned int cells, int copyback)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
|
|
|
{
|
|
|
|
return SetError(SP_ERROR_PARAMS_MAX);
|
|
|
|
}
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
ParamInfo *info = &m_info[m_curparam];
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
info->flags = inarray ? copyback : 0;
|
|
|
|
info->marked = true;
|
|
|
|
info->size = cells;
|
|
|
|
info->str.is_sz = false;
|
|
|
|
info->orig_addr = inarray;
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
m_curparam++;
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
return SP_ERROR_NONE;
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::PushString(const char *string)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
return _PushString(string, SM_PARAM_STRING_COPY, 0, strlen(string)+1);
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
return _PushString(buffer, sz_flags, cp_flags, length);
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::_PushString(const char *string, int sz_flags, int cp_flags, size_t len)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
|
|
|
return SetError(SP_ERROR_PARAMS_MAX);
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
ParamInfo *info = &m_info[m_curparam];
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
info->marked = true;
|
|
|
|
info->orig_addr = (cell_t *)string;
|
|
|
|
info->flags = cp_flags;
|
|
|
|
info->size = len;
|
|
|
|
info->str.sz_flags = sz_flags;
|
|
|
|
info->str.is_sz = true;
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
m_curparam++;
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
return SP_ERROR_NONE;
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
void
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::Cancel()
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
if (!m_curparam)
|
|
|
|
return;
|
2008-03-30 09:00:22 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
m_errorstate = SP_ERROR_NONE;
|
|
|
|
m_curparam = 0;
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::Execute(cell_t *result)
|
2008-07-11 10:18:43 +02:00
|
|
|
{
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
Environment *env = Environment::get();
|
|
|
|
env->clearPendingException();
|
|
|
|
|
|
|
|
// For backward compatibility, we have to clear the exception state.
|
|
|
|
// Otherwise code like this:
|
|
|
|
//
|
|
|
|
// static cell_t native(cx, params) {
|
|
|
|
// for (auto callback : callbacks) {
|
|
|
|
// callback->Execute();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// Could unintentionally leak a pending exception back to the caller,
|
|
|
|
// which wouldn't have happened before the Great Exception Refactoring.
|
|
|
|
ExceptionHandler eh(context_);
|
|
|
|
if (!Invoke(result)) {
|
|
|
|
assert(env->hasPendingException());
|
|
|
|
return env->getPendingExceptionCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
return SP_ERROR_NONE;
|
2008-07-11 10:18:43 +02:00
|
|
|
}
|
|
|
|
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
bool
|
|
|
|
ScriptedInvoker::Invoke(cell_t *result)
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
if (!IsRunnable()) {
|
|
|
|
Cancel();
|
|
|
|
env_->ReportError(SP_ERROR_NOT_RUNNABLE);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (int err = m_errorstate) {
|
2015-02-23 22:01:00 +01:00
|
|
|
Cancel();
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
env_->ReportError(err);
|
|
|
|
return false;
|
2015-02-23 22:01:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//This is for re-entrancy!
|
|
|
|
cell_t temp_params[SP_MAX_EXEC_PARAMS];
|
|
|
|
ParamInfo temp_info[SP_MAX_EXEC_PARAMS];
|
|
|
|
unsigned int numparams = m_curparam;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (numparams)
|
|
|
|
{
|
|
|
|
//Save the info locally, then reset it for re-entrant calls.
|
|
|
|
memcpy(temp_info, m_info, numparams * sizeof(ParamInfo));
|
|
|
|
}
|
|
|
|
m_curparam = 0;
|
|
|
|
|
|
|
|
/* Browse the parameters and build arrays */
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
bool ok = true;
|
2015-02-23 22:01:00 +01:00
|
|
|
for (i=0; i<numparams; i++) {
|
|
|
|
/* Is this marked as an array? */
|
|
|
|
if (temp_info[i].marked) {
|
|
|
|
if (!temp_info[i].str.is_sz) {
|
|
|
|
/* Allocate a normal/generic array */
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
int err = context_->HeapAlloc(
|
|
|
|
temp_info[i].size,
|
|
|
|
&(temp_info[i].local_addr),
|
|
|
|
&(temp_info[i].phys_addr));
|
|
|
|
if (err != SP_ERROR_NONE) {
|
|
|
|
env_->ReportError(err);
|
|
|
|
ok = false;
|
2015-02-23 22:01:00 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (temp_info[i].orig_addr)
|
|
|
|
{
|
|
|
|
memcpy(temp_info[i].phys_addr, temp_info[i].orig_addr, sizeof(cell_t) * temp_info[i].size);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Calculate cells required for the string */
|
|
|
|
size_t cells = (temp_info[i].size + sizeof(cell_t) - 1) / sizeof(cell_t);
|
|
|
|
|
|
|
|
/* Allocate the buffer */
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
int err = context_->HeapAlloc(
|
|
|
|
cells,
|
|
|
|
&(temp_info[i].local_addr),
|
|
|
|
&(temp_info[i].phys_addr));
|
|
|
|
if (err != SP_ERROR_NONE) {
|
|
|
|
env_->ReportError(err);
|
|
|
|
ok = false;
|
2015-02-23 22:01:00 +01:00
|
|
|
break;
|
|
|
|
}
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
/* Copy original string if necessary */
|
|
|
|
if ((temp_info[i].str.sz_flags & SM_PARAM_STRING_COPY) && (temp_info[i].orig_addr != NULL))
|
|
|
|
{
|
|
|
|
/* Cut off UTF-8 properly */
|
|
|
|
if (temp_info[i].str.sz_flags & SM_PARAM_STRING_UTF8) {
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
context_->StringToLocalUTF8(
|
|
|
|
temp_info[i].local_addr,
|
|
|
|
temp_info[i].size,
|
|
|
|
(const char *)temp_info[i].orig_addr,
|
|
|
|
NULL);
|
2015-02-23 22:01:00 +01:00
|
|
|
}
|
|
|
|
/* Copy a binary blob */
|
|
|
|
else if (temp_info[i].str.sz_flags & SM_PARAM_STRING_BINARY)
|
|
|
|
{
|
|
|
|
memmove(temp_info[i].phys_addr, temp_info[i].orig_addr, temp_info[i].size);
|
|
|
|
}
|
|
|
|
/* Copy ASCII characters */
|
|
|
|
else
|
|
|
|
{
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
context_->StringToLocal(
|
|
|
|
temp_info[i].local_addr,
|
|
|
|
temp_info[i].size,
|
|
|
|
(const char *)temp_info[i].orig_addr);
|
2015-02-23 22:01:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* End array/string calculation */
|
|
|
|
/* Update the pushed parameter with the byref local address */
|
|
|
|
temp_params[i] = temp_info[i].local_addr;
|
|
|
|
} else {
|
|
|
|
/* Just copy the value normally */
|
|
|
|
temp_params[i] = m_params[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make the call if we can */
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
if (ok)
|
|
|
|
ok = context_->Invoke(m_FnId, temp_params, numparams, result);
|
2015-02-23 22:01:00 +01:00
|
|
|
|
|
|
|
/* i should be equal to the last valid parameter + 1 */
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
bool docopies = ok;
|
2015-02-23 22:01:00 +01:00
|
|
|
while (i--) {
|
|
|
|
if (!temp_info[i].marked)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (docopies && (temp_info[i].flags & SM_PARAM_COPYBACK)) {
|
|
|
|
if (temp_info[i].orig_addr) {
|
|
|
|
if (temp_info[i].str.is_sz) {
|
|
|
|
memcpy(temp_info[i].orig_addr, temp_info[i].phys_addr, temp_info[i].size);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if (temp_info[i].size == 1) {
|
|
|
|
*temp_info[i].orig_addr = *(temp_info[i].phys_addr);
|
|
|
|
} else {
|
|
|
|
memcpy(temp_info[i].orig_addr,
|
|
|
|
temp_info[i].phys_addr,
|
|
|
|
temp_info[i].size * sizeof(cell_t));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
if (int err = context_->HeapPop(temp_info[i].local_addr))
|
|
|
|
env_->ReportError(err);
|
2015-02-23 22:01:00 +01:00
|
|
|
}
|
|
|
|
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
return !env_->hasPendingException();
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ScriptedInvoker::Execute2(IPluginContext *ctx, cell_t *result)
|
|
|
|
{
|
|
|
|
Environment::get()->ReportError(SP_ERROR_ABORTED);
|
|
|
|
return SP_ERROR_ABORTED;
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
IPluginRuntime *
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::GetParentRuntime()
|
2009-10-06 20:37:30 +02:00
|
|
|
{
|
Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.
The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.
Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.
Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.
These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-02-27 09:32:44 +01:00
|
|
|
return context_->runtime();
|
2009-10-06 20:37:30 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
funcid_t
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::GetFunctionID()
|
2008-03-30 09:00:22 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
return m_FnId;
|
2008-03-30 09:00:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
int
|
2015-02-24 00:47:47 +01:00
|
|
|
ScriptedInvoker::SetError(int err)
|
2008-07-11 10:18:43 +02:00
|
|
|
{
|
2015-02-23 22:01:00 +01:00
|
|
|
m_errorstate = err;
|
2008-07-11 10:18:43 +02:00
|
|
|
|
2015-02-23 22:01:00 +01:00
|
|
|
return err;
|
2008-07-11 10:18:43 +02:00
|
|
|
}
|
|
|
|
|