|
|
@ -50,7 +50,6 @@ namespace df
|
|
|
|
namespace DFHack
|
|
|
|
namespace DFHack
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class Core;
|
|
|
|
class Core;
|
|
|
|
class PluginExports;
|
|
|
|
|
|
|
|
class PluginManager;
|
|
|
|
class PluginManager;
|
|
|
|
class virtual_identity;
|
|
|
|
class virtual_identity;
|
|
|
|
class RPCService;
|
|
|
|
class RPCService;
|
|
|
@ -170,7 +169,6 @@ namespace DFHack
|
|
|
|
command_result invoke(color_ostream &out, const std::string & command, std::vector <std::string> & parameters);
|
|
|
|
command_result invoke(color_ostream &out, const std::string & command, std::vector <std::string> & parameters);
|
|
|
|
bool can_invoke_hotkey(const std::string & command, df::viewscreen *top );
|
|
|
|
bool can_invoke_hotkey(const std::string & command, df::viewscreen *top );
|
|
|
|
plugin_state getState () const;
|
|
|
|
plugin_state getState () const;
|
|
|
|
PluginExports *getExports();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RPCService *rpc_connect(color_ostream &out);
|
|
|
|
RPCService *rpc_connect(color_ostream &out);
|
|
|
|
|
|
|
|
|
|
|
@ -237,16 +235,7 @@ namespace DFHack
|
|
|
|
command_result (*plugin_enable)(color_ostream &, bool);
|
|
|
|
command_result (*plugin_enable)(color_ostream &, bool);
|
|
|
|
RPCService* (*plugin_rpcconnect)(color_ostream &);
|
|
|
|
RPCService* (*plugin_rpcconnect)(color_ostream &);
|
|
|
|
command_result (*plugin_eval_ruby)(color_ostream &, const char*);
|
|
|
|
command_result (*plugin_eval_ruby)(color_ostream &, const char*);
|
|
|
|
PluginExports* (*plugin_get_exports)(void);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
class DFHACK_EXPORT PluginExports {
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
friend class Plugin;
|
|
|
|
|
|
|
|
std::map<std::string, void**> bindings;
|
|
|
|
|
|
|
|
bool bind(DFLibrary* lib);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PLUGIN_EXPORT_BIND(sym) bindings.insert(std::pair<std::string, void**>(#sym, (void**)&this->sym))
|
|
|
|
|
|
|
|
#define PLUGIN_EXPORT_BINDN(sym, name) bindings.insert(std::pair<std::string, void**>(name, (void**)&this->sym))
|
|
|
|
|
|
|
|
class DFHACK_EXPORT PluginManager
|
|
|
|
class DFHACK_EXPORT PluginManager
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// PRIVATE METHODS
|
|
|
|
// PRIVATE METHODS
|
|
|
@ -275,7 +264,6 @@ namespace DFHack
|
|
|
|
|
|
|
|
|
|
|
|
Plugin *getPluginByName (const std::string &name) { return (*this)[name]; }
|
|
|
|
Plugin *getPluginByName (const std::string &name) { return (*this)[name]; }
|
|
|
|
Plugin *getPluginByCommand (const std::string &command);
|
|
|
|
Plugin *getPluginByCommand (const std::string &command);
|
|
|
|
void *getPluginExports(const std::string &name);
|
|
|
|
|
|
|
|
command_result InvokeCommand(color_ostream &out, const std::string & command, std::vector <std::string> & parameters);
|
|
|
|
command_result InvokeCommand(color_ostream &out, const std::string & command, std::vector <std::string> & parameters);
|
|
|
|
bool CanInvokeHotkey(const std::string &command, df::viewscreen *top);
|
|
|
|
bool CanInvokeHotkey(const std::string &command, df::viewscreen *top);
|
|
|
|
Plugin* operator[] (const std::string name);
|
|
|
|
Plugin* operator[] (const std::string name);
|
|
|
@ -324,17 +312,6 @@ namespace DFHack
|
|
|
|
DFhackDataExport bool plugin_is_enabled = false; \
|
|
|
|
DFhackDataExport bool plugin_is_enabled = false; \
|
|
|
|
bool &varname = plugin_is_enabled;
|
|
|
|
bool &varname = plugin_is_enabled;
|
|
|
|
|
|
|
|
|
|
|
|
#define DFHACK_PLUGIN_EXPORTS(clsname) \
|
|
|
|
|
|
|
|
DFhackCExport PluginExports* plugin_get_exports() \
|
|
|
|
|
|
|
|
{ \
|
|
|
|
|
|
|
|
static clsname* instance = NULL; \
|
|
|
|
|
|
|
|
if (!instance) \
|
|
|
|
|
|
|
|
instance = new clsname; \
|
|
|
|
|
|
|
|
return (PluginExports*)instance; \
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GET_PLUGIN_EXPORTS(plugname, clsname) \
|
|
|
|
|
|
|
|
(clsname*)DFHack::Core::getInstance().getPluginManager()->getPluginExports(plugname)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define DFHACK_PLUGIN_LUA_COMMANDS \
|
|
|
|
#define DFHACK_PLUGIN_LUA_COMMANDS \
|
|
|
|
DFhackCExport const DFHack::CommandReg plugin_lua_commands[] =
|
|
|
|
DFhackCExport const DFHack::CommandReg plugin_lua_commands[] =
|
|
|
|
#define DFHACK_PLUGIN_LUA_FUNCTIONS \
|
|
|
|
#define DFHACK_PLUGIN_LUA_FUNCTIONS \
|
|
|
|