core/systems/PluginSys.h
changeset 1112 152ceef17866
parent 1089 275107f9ca95
child 1122 f07d8e10433b
     1.1 --- a/core/systems/PluginSys.h	Sat Jul 14 17:36:11 2007 +0000
     1.2 +++ b/core/systems/PluginSys.h	Sun Jul 15 01:04:34 2007 +0000
     1.3 @@ -116,6 +116,18 @@
     1.4  	bool create;
     1.5  };
     1.6  
     1.7 +class CPlugin;
     1.8 +struct WeakNative
     1.9 +{
    1.10 +	WeakNative(CPlugin *plugin, uint32_t index)
    1.11 +	{
    1.12 +		pl = plugin;
    1.13 +		idx = index;
    1.14 +	}
    1.15 +	CPlugin *pl;
    1.16 +	uint32_t idx;
    1.17 +};
    1.18 +
    1.19  class CPlugin : public IPlugin
    1.20  {
    1.21  	friend class CPluginManager;
    1.22 @@ -234,9 +246,9 @@
    1.23  	void AddConfig(bool autoCreate, const char *cfg, const char *folder);
    1.24  	unsigned int GetConfigCount();
    1.25  	AutoConfig *GetConfig(unsigned int i);
    1.26 -	inline bool IsInAskPluginLoad()
    1.27 +	inline void AddLibrary(const char *name)
    1.28  	{
    1.29 -		return m_IsInAskPluginLoad;
    1.30 +		m_Libraries.push_back(name);
    1.31  	}
    1.32  protected:
    1.33  	void UpdateInfo();
    1.34 @@ -259,10 +271,13 @@
    1.35  	List<CPlugin *> m_dependents;
    1.36  	List<CPlugin *> m_dependsOn;
    1.37  	List<FakeNative *> m_fakeNatives;
    1.38 +	List<WeakNative *> m_WeakNatives;
    1.39 +	List<String> m_RequiredLibs;
    1.40 +	List<String> m_Libraries;
    1.41  	Trie *m_pProps;
    1.42  	bool m_FakeNativesMissing;
    1.43 +	bool m_LibraryMissing;
    1.44  	CVector<AutoConfig *> m_configs;
    1.45 -	bool m_IsInAskPluginLoad;
    1.46  };
    1.47  
    1.48  class CPluginManager : 
    1.49 @@ -413,6 +428,11 @@
    1.50  	 */
    1.51  	bool LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass, char *error, size_t maxlength);
    1.52  
    1.53 +	/**
    1.54 +	* Manages required natives.
    1.55 +	*/
    1.56 +	bool FindOrRequirePluginDeps(CPlugin *pPlugin, char *error, size_t maxlength);
    1.57 +
    1.58  	void _SetPauseState(CPlugin *pPlugin, bool pause);
    1.59  
    1.60  	void ExecAndGenPluginConfs();
    1.61 @@ -430,7 +450,7 @@
    1.62  	bool AddFakeNative(IPluginFunction *pFunction, const char *name, SPVM_FAKENATIVE_FUNC func);
    1.63  private:
    1.64  	void AddFakeNativesToPlugin(CPlugin *pPlugin);
    1.65 -	void TryRefreshNatives(CPlugin *pOther);
    1.66 +	void TryRefreshDependencies(CPlugin *pOther);
    1.67  private:
    1.68  	List<IPluginsListener *> m_listeners;
    1.69  	List<CPlugin *> m_plugins;