sourcepawn/jit/sp_vm_function.h
branchrefac-jit
changeset 2284 026da5437111
parent 2192 7602d7fb60d9
child 2288 15c77b21589a
     1.1 --- a/sourcepawn/jit/sp_vm_function.h	Fri Jul 11 06:51:21 2008 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,104 +0,0 @@
     1.4 -/**
     1.5 - * vim: set ts=4 :
     1.6 - * =============================================================================
     1.7 - * SourcePawn
     1.8 - * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     1.9 - * =============================================================================
    1.10 - *
    1.11 - * This program is free software; you can redistribute it and/or modify it under
    1.12 - * the terms of the GNU General Public License, version 3.0, as published by the
    1.13 - * Free Software Foundation.
    1.14 - * 
    1.15 - * This program is distributed in the hope that it will be useful, but WITHOUT
    1.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.17 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    1.18 - * details.
    1.19 - *
    1.20 - * You should have received a copy of the GNU General Public License along with
    1.21 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    1.22 - *
    1.23 - * As a special exception, AlliedModders LLC gives you permission to link the
    1.24 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    1.25 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    1.26 - * by the Valve Corporation.  You must obey the GNU General Public License in
    1.27 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    1.28 - * this exception to all derivative works.  AlliedModders LLC defines further
    1.29 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    1.30 - * or <http://www.sourcemod.net/license.php>.
    1.31 - *
    1.32 - * Version: $Id$
    1.33 - */
    1.34 -
    1.35 -#ifndef _INCLUDE_SOURCEMOD_BASEFUNCTION_H_
    1.36 -#define _INCLUDE_SOURCEMOD_BASEFUNCTION_H_
    1.37 -
    1.38 -#include <sp_vm_api.h>
    1.39 -
    1.40 -class BaseRuntime;
    1.41 -
    1.42 -using namespace SourcePawn;
    1.43 -
    1.44 -struct ParamInfo
    1.45 -{
    1.46 -	int flags;			/* Copy-back flags */
    1.47 -	bool marked;		/* Whether this is marked as being used */
    1.48 -	cell_t local_addr;	/* Local address to free */
    1.49 -	cell_t *phys_addr;	/* Physical address of our copy */
    1.50 -	cell_t *orig_addr;	/* Original address to copy back to */
    1.51 -	ucell_t size;		/* Size of array in bytes */
    1.52 -	struct
    1.53 -	{
    1.54 -		bool is_sz;		/* is a string */
    1.55 -		int sz_flags;	/* has sz flags */
    1.56 -	} str;
    1.57 -};
    1.58 -
    1.59 -class CPlugin;
    1.60 -
    1.61 -class CFunction : public IPluginFunction
    1.62 -{
    1.63 -	friend class SourcePawnEngine;
    1.64 -public:
    1.65 -	CFunction(uint32_t code_addr,
    1.66 -			  BaseRuntime *pRuntime, 
    1.67 -			  funcid_t fnid,
    1.68 -			  uint32_t pub_id);
    1.69 -public:
    1.70 -	virtual int PushCell(cell_t cell);
    1.71 -	virtual int PushCellByRef(cell_t *cell, int flags);
    1.72 -	virtual int PushFloat(float number);
    1.73 -	virtual int PushFloatByRef(float *number, int flags);
    1.74 -	virtual int PushArray(cell_t *inarray, unsigned int cells, int copyback);
    1.75 -	virtual int PushString(const char *string);
    1.76 -	virtual int PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags);
    1.77 -	virtual int Execute(cell_t *result);
    1.78 -	virtual void Cancel();
    1.79 -	virtual int CallFunction(const cell_t *params, unsigned int num_params, cell_t *result);
    1.80 -	virtual IPluginContext *GetParentContext();
    1.81 -	bool IsInvalidated();
    1.82 -	void Invalidate();
    1.83 -	bool IsRunnable();
    1.84 -	funcid_t GetFunctionID();
    1.85 -	int Execute2(IPluginContext *ctx, cell_t *result);
    1.86 -	int CallFunction2(IPluginContext *ctx, 
    1.87 -		const cell_t *params, 
    1.88 -		unsigned int num_params, 
    1.89 -		cell_t *result);
    1.90 -public:
    1.91 -	void Set(uint32_t code_addr, BaseRuntime *runtime, funcid_t fnid, uint32_t pub_id);
    1.92 -private:
    1.93 -	int _PushString(const char *string, int sz_flags, int cp_flags, size_t len);
    1.94 -	int SetError(int err);
    1.95 -private:
    1.96 -	uint32_t m_codeaddr;
    1.97 -	BaseRuntime *m_pRuntime;
    1.98 -	cell_t m_params[SP_MAX_EXEC_PARAMS];
    1.99 -	ParamInfo m_info[SP_MAX_EXEC_PARAMS];
   1.100 -	unsigned int m_curparam;
   1.101 -	int m_errorstate;
   1.102 -	CFunction *m_pNext;
   1.103 -	bool m_Invalid;
   1.104 -	funcid_t m_FnId;
   1.105 -};
   1.106 -
   1.107 -#endif //_INCLUDE_SOURCEMOD_BASEFUNCTION_H_