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