Remove sp_context_t.

This commit is contained in:
David Anderson 2015-02-24 21:41:35 -08:00
parent c09c65e4c7
commit 33588b65ce
6 changed files with 12 additions and 27 deletions

View File

@ -26,7 +26,6 @@ CContextTrace::CContextTrace(PluginRuntime *pRuntime, int err, const char *errst
m_StartRp(start_rp), m_StartRp(start_rp),
m_Level(0) m_Level(0)
{ {
m_ctx = pRuntime->m_pCtx->GetCtx();
m_pDebug = m_pRuntime->GetDebugInfo(); m_pDebug = m_pRuntime->GetDebugInfo();
} }

View File

@ -39,7 +39,6 @@ class CContextTrace : public IContextTrace
private: private:
PluginRuntime *m_pRuntime; PluginRuntime *m_pRuntime;
PluginContext *context_; PluginContext *context_;
sp_context_t *m_ctx;
int m_Error; int m_Error;
const char *m_pMsg; const char *m_pMsg;
cell_t m_StartRp; cell_t m_StartRp;

View File

@ -45,7 +45,7 @@ Write(const sp_plugin_t *plugin, cell_t offset, cell_t value)
} }
static inline cell_t * static inline cell_t *
Jump(const sp_plugin_t *plugin, sp_context_t *ctx, cell_t target) Jump(const sp_plugin_t *plugin, cell_t target)
{ {
if (!IsValidOffset(target) || uint32_t(target) >= plugin->pcode_size) if (!IsValidOffset(target) || uint32_t(target) >= plugin->pcode_size)
return NULL; return NULL;
@ -53,7 +53,7 @@ Jump(const sp_plugin_t *plugin, sp_context_t *ctx, cell_t target)
} }
static inline cell_t * static inline cell_t *
JumpTarget(const sp_plugin_t *plugin, sp_context_t *ctx, cell_t *cip, bool cond, int *errp) JumpTarget(const sp_plugin_t *plugin, cell_t *cip, bool cond, int *errp)
{ {
if (!cond) if (!cond)
return cip + 1; return cip + 1;
@ -84,7 +84,6 @@ Interpret(PluginRuntime *rt, uint32_t aCodeStart, cell_t *rval)
return SP_ERROR_INVALID_INSTRUCTION; return SP_ERROR_INVALID_INSTRUCTION;
PluginContext *cx = rt->GetBaseContext(); PluginContext *cx = rt->GetBaseContext();
sp_context_t *ctx = cx->GetCtx();
int err = SP_ERROR_NONE; int err = SP_ERROR_NONE;
@ -675,41 +674,41 @@ Interpret(PluginRuntime *rt, uint32_t aCodeStart, cell_t *rval)
} }
case OP_JUMP: case OP_JUMP:
if ((cip = JumpTarget(plugin, ctx, cip, true, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, true, &err)) == NULL)
goto error; goto error;
break; break;
case OP_JZER: case OP_JZER:
if ((cip = JumpTarget(plugin, ctx, cip, pri == 0, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, pri == 0, &err)) == NULL)
goto error; goto error;
break; break;
case OP_JNZ: case OP_JNZ:
if ((cip = JumpTarget(plugin, ctx, cip, pri != 0, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, pri != 0, &err)) == NULL)
goto error; goto error;
break; break;
case OP_JEQ: case OP_JEQ:
if ((cip = JumpTarget(plugin, ctx, cip, pri == alt, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, pri == alt, &err)) == NULL)
goto error; goto error;
break; break;
case OP_JNEQ: case OP_JNEQ:
if ((cip = JumpTarget(plugin, ctx, cip, pri != alt, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, pri != alt, &err)) == NULL)
goto error; goto error;
break; break;
case OP_JSLESS: case OP_JSLESS:
if ((cip = JumpTarget(plugin, ctx, cip, pri < alt, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, pri < alt, &err)) == NULL)
goto error; goto error;
break; break;
case OP_JSLEQ: case OP_JSLEQ:
if ((cip = JumpTarget(plugin, ctx, cip, pri <= alt, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, pri <= alt, &err)) == NULL)
goto error; goto error;
break; break;
case OP_JSGRTR: case OP_JSGRTR:
if ((cip = JumpTarget(plugin, ctx, cip, pri > alt, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, pri > alt, &err)) == NULL)
goto error; goto error;
break; break;
case OP_JSGEQ: case OP_JSGEQ:
if ((cip = JumpTarget(plugin, ctx, cip, pri >= alt, &err)) == NULL) if ((cip = JumpTarget(plugin, cip, pri >= alt, &err)) == NULL)
goto error; goto error;
break; break;
@ -831,7 +830,7 @@ Interpret(PluginRuntime *rt, uint32_t aCodeStart, cell_t *rval)
} }
} }
if ((cip = Jump(plugin, ctx, target)) == NULL) { if ((cip = Jump(plugin, target)) == NULL) {
err = SP_ERROR_INVALID_INSTRUCTION; err = SP_ERROR_INVALID_INSTRUCTION;
goto error; goto error;
} }

View File

@ -70,10 +70,6 @@ namespace SourcePawn
class PluginContext; class PluginContext;
typedef struct sp_context_s
{
} sp_context_t;
//#define SPFLAG_PLUGIN_DEBUG (1<<0) //#define SPFLAG_PLUGIN_DEBUG (1<<0)
#define SPFLAG_PLUGIN_PAUSED (1<<1) #define SPFLAG_PLUGIN_PAUSED (1<<1)

View File

@ -80,12 +80,6 @@ PluginContext::GetContext()
return reinterpret_cast<sp_context_t *>((IPluginContext * )this); return reinterpret_cast<sp_context_t *>((IPluginContext * )this);
} }
sp_context_t *
PluginContext::GetCtx()
{
return &m_ctx;
}
bool bool
PluginContext::IsDebugging() PluginContext::IsDebugging()
{ {

View File

@ -39,7 +39,6 @@ class PluginContext : public IPluginContext
public: //IPluginContext public: //IPluginContext
IVirtualMachine *GetVirtualMachine(); IVirtualMachine *GetVirtualMachine();
sp_context_t *GetContext(); sp_context_t *GetContext();
sp_context_t *GetCtx();
bool IsDebugging(); bool IsDebugging();
int SetDebugBreak(void *newpfn, void *oldpfn); int SetDebugBreak(void *newpfn, void *oldpfn);
IPluginDebugInfo *GetDebugInfo(); IPluginDebugInfo *GetDebugInfo();
@ -187,7 +186,6 @@ class PluginContext : public IPluginContext
bool m_CustomMsg; bool m_CustomMsg;
bool m_InExec; bool m_InExec;
PluginRuntime *m_pRuntime; PluginRuntime *m_pRuntime;
sp_context_t m_ctx;
void *m_keys[4]; void *m_keys[4];
bool m_keys_set[4]; bool m_keys_set[4];