greatly optimized the process of mapping plugin natives from Core

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401388
This commit is contained in:
David Anderson
2007-08-29 00:47:05 +00:00
parent 08ae85bdb3
commit f145178fc0
5 changed files with 51 additions and 11 deletions
+16
View File
@@ -642,6 +642,22 @@ int BaseContext::BindNative(const sp_nativeinfo_t *native)
return SP_ERROR_NONE;
}
int BaseContext::BindNativeToIndex(uint32_t index, SPVM_NATIVE_FUNC native)
{
int err;
sp_native_t *native;
if ((err = GetNativeByIndex(index, &native)) != SP_ERROR_NONE)
{
return err;
}
ctx->natives[index].pfn = native;
ctx->natives[index].status = SP_NATIVE_BOUND;
return SP_ERROR_NONE;
}
int BaseContext::BindNativeToAny(SPVM_NATIVE_FUNC native)
{
uint32_t nativesnum, i;
+1
View File
@@ -89,6 +89,7 @@ namespace SourcePawn
cell_t *GetNullRef(SP_NULL_TYPE type);
int LocalToStringNULL(cell_t local_addr, char **addr);
#endif
int BindNativeToIndex(uint32_t index, SPVM_NATIVE_FUNC native);
public: //IPluginDebugInfo
int LookupFile(ucell_t addr, const char **filename);
int LookupFunction(ucell_t addr, const char **name);