core/vm/sp_vm_function.cpp
changeset 525 d36c45088e36
parent 502 4530ea065a8b
child 584 1b10d3504e9e
     1.1 --- a/core/vm/sp_vm_function.cpp	Wed Feb 21 22:09:05 2007 +0000
     1.2 +++ b/core/vm/sp_vm_function.cpp	Thu Feb 22 02:05:50 2007 +0000
     1.3 @@ -26,10 +26,21 @@
     1.4  	m_curparam = 0;
     1.5  	m_errorstate = SP_ERROR_NONE;
     1.6  	m_Invalid = false;
     1.7 +	m_pCtx = plugin ? plugin->GetContext() : NULL;
     1.8 +}
     1.9 +
    1.10 +bool CFunction::IsRunnable()
    1.11 +{
    1.12 +	return ((m_pCtx->flags & SPFLAG_PLUGIN_PAUSED) != SPFLAG_PLUGIN_PAUSED);
    1.13  }
    1.14  
    1.15  int CFunction::CallFunction(const cell_t *params, unsigned int num_params, cell_t *result)
    1.16  {
    1.17 +	if (!IsRunnable())
    1.18 +	{
    1.19 +		return SP_ERROR_NOT_RUNNABLE;
    1.20 +	}
    1.21 +
    1.22  	while (num_params--)
    1.23  	{
    1.24  		m_pContext->PushCell(params[num_params]);
    1.25 @@ -48,6 +59,10 @@
    1.26  	m_errorstate(SP_ERROR_NONE)
    1.27  {
    1.28  	m_Invalid = false;
    1.29 +	if (plugin)
    1.30 +	{
    1.31 +		m_pCtx = plugin->GetContext();
    1.32 +	}
    1.33  }
    1.34  
    1.35  int CFunction::PushCell(cell_t cell)
    1.36 @@ -201,6 +216,10 @@
    1.37  int CFunction::Execute(cell_t *result)
    1.38  {
    1.39  	int err;
    1.40 +	if (!IsRunnable())
    1.41 +	{
    1.42 +		m_errorstate = SP_ERROR_NOT_RUNNABLE;
    1.43 +	}
    1.44  	if (m_errorstate != SP_ERROR_NONE)
    1.45  	{
    1.46  		err = m_errorstate;