3 * ================================================================
4 * SourcePawn (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ================================================================
7 * This file is not open source and may not be copied without explicit
8 * written permission of AlliedModders LLC. This file may not be redistributed
9 * in whole or significant part.
10 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
15 #ifndef _INCLUDE_SOURCEMOD_BASEFUNCTION_H_
16 #define _INCLUDE_SOURCEMOD_BASEFUNCTION_H_
18 #include "sm_globals.h"
22 int flags; /* Copy-back flags */
23 bool marked; /* Whether this is marked as being used */
24 cell_t local_addr; /* Local address to free */
25 cell_t *phys_addr; /* Physical address of our copy */
26 cell_t *orig_addr; /* Original address to copy back to */
27 ucell_t size; /* Size of array in bytes */
30 bool is_sz; /* is a string */
31 int sz_flags; /* has sz flags */
37 class CFunction : public IPluginFunction
39 friend class SourcePawnEngine;
41 CFunction(uint32_t code_addr, IPluginContext *pContext);
43 virtual int PushCell(cell_t cell);
44 virtual int PushCellByRef(cell_t *cell, int flags);
45 virtual int PushFloat(float number);
46 virtual int PushFloatByRef(float *number, int flags);
47 virtual int PushArray(cell_t *inarray, unsigned int cells, int copyback);
48 virtual int PushString(const char *string);
49 virtual int PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags);
50 virtual int Execute(cell_t *result);
51 virtual void Cancel();
52 virtual int CallFunction(const cell_t *params, unsigned int num_params, cell_t *result);
53 virtual IPluginContext *GetParentContext();
54 inline bool IsInvalidated()
58 inline void Invalidate()
64 void Set(uint32_t code_addr, IPluginContext *plugin);
66 int _PushString(const char *string, int sz_flags, int cp_flags, size_t len);
67 inline int SetError(int err)
74 IPluginContext *m_pContext;
76 cell_t m_params[SP_MAX_EXEC_PARAMS];
77 ParamInfo m_info[SP_MAX_EXEC_PARAMS];
78 unsigned int m_curparam;
84 #endif //_INCLUDE_SOURCEMOD_BASEFUNCTION_H_