core/NativeInvoker.h
changeset 3872 4c93f74cae51
parent 3871 4edce76aefe3
child 3873 a496ff7c2aad
     1.1 --- a/core/NativeInvoker.h	Fri Mar 29 12:28:02 2013 -0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,98 +0,0 @@
     1.4 -/**
     1.5 - * vim: set ts=4 :
     1.6 - * =============================================================================
     1.7 - * SourceMod
     1.8 - * Copyright (C) 2004-2009 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_NATIVE_INVOKER_H_
    1.36 -#define _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
    1.37 -
    1.38 -#include "sm_globals.h"
    1.39 -#include <INativeInvoker.h>
    1.40 -
    1.41 -struct ParamInfo
    1.42 -{
    1.43 -	int flags;			/* Copy-back flags */
    1.44 -	bool marked;		/* Whether this is marked as being used */
    1.45 -	cell_t local_addr;	/* Local address to free */
    1.46 -	cell_t *phys_addr;	/* Physical address of our copy */
    1.47 -	cell_t *orig_addr;	/* Original address to copy back to */
    1.48 -	ucell_t size;		/* Size of array in bytes */
    1.49 -	struct
    1.50 -	{
    1.51 -		bool is_sz;		/* is a string */
    1.52 -		int sz_flags;	/* has sz flags */
    1.53 -	} str;
    1.54 -};
    1.55 -
    1.56 -class NativeInvoker : public INativeInvoker
    1.57 -{
    1.58 -public:
    1.59 -	NativeInvoker();
    1.60 -	~NativeInvoker();
    1.61 -public: /* ICallable */
    1.62 -	int PushCell(cell_t cell);
    1.63 -	int PushCellByRef(cell_t *cell, int flags=SM_PARAM_COPYBACK);
    1.64 -	int PushFloat(float number);
    1.65 -	int PushFloatByRef(float *number, int flags=SM_PARAM_COPYBACK);
    1.66 -	int PushArray(cell_t *inarray, unsigned int cells, int flags=0);
    1.67 -	int PushString(const char *string);
    1.68 -	int PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags);
    1.69 -	void Cancel();
    1.70 -public: /* INativeInvoker */
    1.71 -	bool Start(IPluginContext *pContext, const char *name);
    1.72 -	int Invoke(cell_t *result);
    1.73 -private:
    1.74 -	int _PushString(const char *string, int sz_flags, int cp_flags, size_t len);
    1.75 -	int SetError(int err);
    1.76 -private:
    1.77 -	IPluginContext *pContext;
    1.78 -	SPVM_NATIVE_FUNC native;
    1.79 -	cell_t m_params[SP_MAX_EXEC_PARAMS];
    1.80 -	ParamInfo m_info[SP_MAX_EXEC_PARAMS];
    1.81 -	unsigned int m_curparam;
    1.82 -	int m_errorstate;
    1.83 -};
    1.84 -
    1.85 -class NativeInterface : 
    1.86 -	public INativeInterface,
    1.87 -	public SMGlobalClass
    1.88 -{
    1.89 -public: /* SMGlobalClass */
    1.90 -	void OnSourceModAllInitialized();
    1.91 -public: /* SMInterface */
    1.92 -	unsigned int GetInterfaceVersion();
    1.93 -	const char *GetInterfaceName();
    1.94 -public: /* INativeInvoker */
    1.95 -	IPluginRuntime *CreateRuntime(const char *name, size_t bytes);
    1.96 -	INativeInvoker *CreateInvoker();
    1.97 -};
    1.98 -
    1.99 -extern NativeInterface g_NInvoke;
   1.100 -
   1.101 -#endif /* _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_ */