core/systems/PluginSys.h
changeset 2193 db7c6362f3f2
parent 2105 ad190b9bb5af
child 2226 d10b38524be3
     1.1 --- a/core/systems/PluginSys.h	Thu Jul 10 01:26:02 2008 +0000
     1.2 +++ b/core/systems/PluginSys.h	Fri Jul 11 08:18:43 2008 +0000
     1.3 @@ -43,7 +43,6 @@
     1.4  #include <sh_vector.h>
     1.5  #include <sh_string.h>
     1.6  #include "sm_globals.h"
     1.7 -#include "vm/sp_vm_basecontext.h"
     1.8  #include "PluginInfoDatabase.h"
     1.9  #include "sm_trie.h"
    1.10  #include "sourcemod.h"
    1.11 @@ -109,19 +108,6 @@
    1.12   *			 7. Once all plugins are deemed to be loaded, OnPluginStart() is called
    1.13   */
    1.14  
    1.15 -#define SM_CONTEXTVAR_MYSELF	0
    1.16 -
    1.17 -struct ContextPair
    1.18 -{
    1.19 -	ContextPair() : base(NULL), ctx(NULL), co(NULL)
    1.20 -	{
    1.21 -	};
    1.22 -	BaseContext *base;
    1.23 -	sp_context_t *ctx;
    1.24 -	ICompilation *co;
    1.25 -	IVirtualMachine *vm;
    1.26 -};
    1.27 -
    1.28  enum LoadRes
    1.29  {
    1.30  	LoadRes_Successful,
    1.31 @@ -152,18 +138,19 @@
    1.32  	PluginType GetType();
    1.33  	SourcePawn::IPluginContext *GetBaseContext();
    1.34  	sp_context_t *GetContext();
    1.35 -	const sm_plugininfo_t *GetPublicInfo();
    1.36 +	void *GetPluginStructure();
    1.37  	const char *GetFilename();
    1.38  	bool IsDebugging();
    1.39  	PluginStatus GetStatus();
    1.40 +	const sm_plugininfo_t *GetPublicInfo();
    1.41  	bool SetPauseState(bool paused);
    1.42  	unsigned int GetSerial();
    1.43 -	const sp_plugin_t *GetPluginStructure();
    1.44  	IdentityToken_t *GetIdentity();
    1.45  	unsigned int CalcMemUsage();
    1.46  	bool SetProperty(const char *prop, void *ptr);
    1.47  	bool GetProperty(const char *prop, void **ptr, bool remove=false);
    1.48  	void DropEverything();
    1.49 +	SourcePawn::IPluginRuntime *GetRuntime();
    1.50  public:
    1.51  	/**
    1.52  	 * Creates a plugin object with default values.
    1.53 @@ -174,16 +161,6 @@
    1.54  	 */
    1.55  	static CPlugin *CreatePlugin(const char *file, char *error, size_t maxlength);
    1.56  public:
    1.57 -	/**
    1.58 -	 * Starts the initial compilation of a plugin.
    1.59 -	 * Returns false if another compilation exists or there is a current context set.
    1.60 -	 */
    1.61 -	ICompilation *StartMyCompile(IVirtualMachine *vm);
    1.62 -	/** 
    1.63 -	 * Finalizes a compilation.  If error buffer is NULL, the error is saved locally.
    1.64 -	 */
    1.65 -	bool FinishMyCompile(char *error, size_t maxlength);
    1.66 -	void CancelMyCompile();
    1.67  
    1.68  	/**
    1.69  	 * Sets an error state on the plugin
    1.70 @@ -267,13 +244,11 @@
    1.71  	void SetTimeStamp(time_t t);
    1.72  	void DependencyDropped(CPlugin *pOwner);
    1.73  private:
    1.74 -	ContextPair m_ctx;
    1.75  	PluginType m_type;
    1.76  	char m_filename[PLATFORM_MAX_PATH];
    1.77  	PluginStatus m_status;
    1.78  	unsigned int m_serial;
    1.79  	sm_plugininfo_t m_info;
    1.80 -	sp_plugin_t *m_plugin;
    1.81  	char m_errormsg[256];
    1.82  	time_t m_LastAccess;
    1.83  	IdentityToken_t *m_ident;
    1.84 @@ -289,6 +264,8 @@
    1.85  	bool m_bGotAllLoaded;
    1.86  	int m_FileVersion;
    1.87  	char m_DateTime[256];
    1.88 +	IPluginRuntime *m_pRuntime;
    1.89 +	IPluginContext *m_pContext;
    1.90  };
    1.91  
    1.92  class CPluginManager : 
    1.93 @@ -382,10 +359,7 @@
    1.94  	/** 
    1.95  	 * Internal version of FindPluginByContext()
    1.96  	 */
    1.97 -	inline CPlugin *GetPluginByCtx(const sp_context_t *ctx)
    1.98 -	{
    1.99 -		return reinterpret_cast<CPlugin *>(ctx->user[SM_CONTEXTVAR_MYSELF]);
   1.100 -	}
   1.101 +	CPlugin *GetPluginByCtx(const sp_context_t *ctx);
   1.102  
   1.103  	/**
   1.104  	 * Gets status text for a status code