IPluginFunction implementation is re-entrant across native calls, as heap allocations are delayed until execution

removed ICallable::GetAddressOfPushedParam
removed phys_addr from ICallable::PushArray
fixed a bug where sp_context_t::n_idx was overwritten upon re-entrant calls

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40595
This commit is contained in:
David Anderson
2007-03-10 21:02:40 +00:00
parent f592744d87
commit 38c94838b9
8 changed files with 137 additions and 124 deletions
+10 -6
View File
@@ -37,7 +37,7 @@
using namespace SourcePawn;
#define SMINTERFACE_FORWARDMANAGER_NAME "IForwardManager"
#define SMINTERFACE_FORWARDMANAGER_VERSION 1
#define SMINTERFACE_FORWARDMANAGER_VERSION 2
/*
* There is some very important documentation at the bottom of this file.
@@ -177,14 +177,10 @@ namespace SourceMod
*
* @param inarray Array to copy. Cannot be NULL, unlike ICallable's version.
* @param cells Number of cells to allocate and optionally read from the input array.
* @param phys_addr Unused. If a value is passed, it will be filled with NULL.
* @param flags Whether or not changes should be copied back to the input array.
* @return Error code, if any.
*/
virtual int PushArray(cell_t *inarray,
unsigned int cells,
cell_t **phys_addr,
int flags=0) =0;
virtual int PushArray(cell_t *inarray, unsigned int cells, int flags=0) =0;
};
/**
@@ -270,6 +266,14 @@ namespace SourceMod
{
return SMINTERFACE_FORWARDMANAGER_VERSION;
}
virtual bool IsVersionCompatible(unsigned int version)
{
if (version < 2 || version > GetInterfaceVersion())
{
return false;
}
return true;
}
public:
/**
* @brief Creates a managed forward. This forward exists globally.
+9 -19
View File
@@ -94,23 +94,21 @@ namespace SourcePawn
virtual int PushFloatByRef(float *number, int flags=SM_PARAM_COPYBACK) =0;
/**
* @brief Pushes an array of cells onto the current call.
* NOTE: On Execute, the pointer passed will be modified if non-NULL and copy-back
* is enabled.
* NOTE: By reference parameters are cached and thus are not read until execution.
* This means you cannot push a pointer, change it, and push it again and expect
* two different values to come out.
* @brief Pushes an array of cells onto the current call.
*
* On Execute, the pointer passed will be modified if non-NULL and copy-back
* is enabled.
*
* By reference parameters are cached and thus are not read until execution.
* This means you cannot push a pointer, change it, and push it again and expect
* two different values to come out.
*
* @param inarray Array to copy, NULL if no initial array should be copied.
* @param cells Number of cells to allocate and optionally read from the input array.
* @param phys_addr Optional return address for physical array, if one was made.
* @param flags Whether or not changes should be copied back to the input array.
* @return Error code, if any.
*/
virtual int PushArray(cell_t *inarray,
unsigned int cells,
cell_t **phys_addr,
int flags=0) =0;
virtual int PushArray(cell_t *inarray, unsigned int cells, int flags=0) =0;
/**
* @brief Pushes a string onto the current call.
@@ -177,14 +175,6 @@ namespace SourcePawn
*/
virtual IPluginContext *GetParentContext() =0;
/**
* @brief Returns the physical address of a by-reference parameter.
*
* @param param Parameter index to read (beginning at 0).
* @return Address, or NULL if invalid parameter specified.
*/
virtual cell_t *GetAddressOfPushedParam(unsigned int param) =0;
/**
* @brief Returns whether the parent plugin is paused.
*