initial import of dynamic native code for both the JIT and plugins

note: dependency resolution is not done yet!

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40607
This commit is contained in:
David Anderson
2007-03-12 07:08:05 +00:00
parent 7ab8e2027b
commit 7c06d89b00
14 changed files with 963 additions and 5 deletions
+18 -1
View File
@@ -28,7 +28,7 @@
#include "sp_vm_types.h"
/** SourcePawn VM API Version */
#define SOURCEPAWN_VM_API_VERSION 1
#define SOURCEPAWN_VM_API_VERSION 2
#if defined SOURCEMOD_BUILD
namespace SourceMod
@@ -820,6 +820,23 @@ namespace SourcePawn
* @return True if code index is valid, false otherwise.
*/
virtual bool FunctionPLookup(const sp_context_t *ctx, uint32_t code_addr, unsigned int *result) =0;
/**
* @brief Creates a fake native and binds it to a general callback function.
*
* @param callback Callback function to bind the native to.
* @param pData Private data to pass to the callback when the native is invoked.
* @return A new fake native function as a wrapper around the callback.
*/
virtual SPVM_NATIVE_FUNC CreateFakeNative(SPVM_FAKENATIVE_FUNC callback, void *pData) =0;
/**
* @brief Destroys a fake native function wrapper.
*
* @param function Pointer to the fake native created by CreateFakeNative.
* @noreturn
*/
virtual void DestroyFakenative(SPVM_NATIVE_FUNC func) =0;
};
};
+6
View File
@@ -136,6 +136,12 @@ struct sp_context_s;
*/
typedef cell_t (*SPVM_NATIVE_FUNC)(SourcePawn::IPluginContext *, const cell_t *);
/**
* @brief Fake native callback prototype, passed a context, parameter stack, and private data.
* A cell must be returned.
*/
typedef cell_t (*SPVM_FAKENATIVE_FUNC)(SourcePawn::IPluginContext *, const cell_t *, void *);
/**********************************************
*** The following structures are bound to the VM/JIT.
*** Changing them will result in necessary recompilation.