diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-04-04 21:57:54 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-04-04 21:57:54 (GMT) |
commit | 286ba13e0a5e908f9ebe67286bb6006adb4102fc (patch) | |
tree | 06d1ef353ae623c579a8fff5a74d22ecc0b9b862 /plugins/pychrysalide | |
parent | c1cac2ce69f01deb99c5c91a803dfa04af90ef14 (diff) |
Simplified the plugin interface.
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r-- | plugins/pychrysalide/Makefile.am | 5 | ||||
-rw-r--r-- | plugins/pychrysalide/core/logs.c | 3 | ||||
-rw-r--r-- | plugins/pychrysalide/plugin.c | 6 | ||||
-rw-r--r-- | plugins/pychrysalide/pychrysa.c | 43 | ||||
-rw-r--r-- | plugins/pychrysalide/pychrysa.h | 3 |
5 files changed, 16 insertions, 44 deletions
diff --git a/plugins/pychrysalide/Makefile.am b/plugins/pychrysalide/Makefile.am index 25c3e40..b85f417 100644 --- a/plugins/pychrysalide/Makefile.am +++ b/plugins/pychrysalide/Makefile.am @@ -26,8 +26,9 @@ pychrysalide_la_LIBADD = \ gui/libpychrysagui.la \ mangling/libpychrysamangling.la -pychrysalide_la_LDFLAGS = -module -avoid-version \ - $(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) \ +pychrysalide_la_LDFLAGS = \ + -module -avoid-version \ + $(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) \ -L$(top_srcdir)/src/.libs -lchrysacore diff --git a/plugins/pychrysalide/core/logs.c b/plugins/pychrysalide/core/logs.c index 0136b50..0965b4b 100644 --- a/plugins/pychrysalide/core/logs.c +++ b/plugins/pychrysalide/core/logs.c @@ -29,6 +29,7 @@ #include <core/logs.h> +#include <plugins/self.h> #include "constants.h" @@ -169,7 +170,7 @@ static PyObject *py_logs_log_message(PyObject *self, PyObject *args) case LMT_BAD_BINARY: case LMT_ERROR: case LMT_EXT_ERROR: - log_pychrysalide_simple_message(type, msg); + log_plugin_simple_message(type, msg); result = Py_None; Py_INCREF(result); break; diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c index 07b9224..1736826 100644 --- a/plugins/pychrysalide/plugin.c +++ b/plugins/pychrysalide/plugin.c @@ -33,7 +33,7 @@ #include <common/extstr.h> #include <plugins/dt.h> -#include <plugins/plugin-int.h> +#include <plugins/self.h> #include "access.h" @@ -1021,8 +1021,8 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename) no_class: if (class == NULL) - log_pychrysalide_simple_message(LMT_ERROR, - _("An error occured when looking for the 'AutoLoad': item not found!")); + log_plugin_simple_message(LMT_ERROR, + _("An error occured when looking for the 'AutoLoad': item not found!")); no_import: diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c index 8e37b09..683e41e 100644 --- a/plugins/pychrysalide/pychrysa.c +++ b/plugins/pychrysalide/pychrysa.c @@ -43,8 +43,7 @@ #include <common/extstr.h> #include <core/core.h> #include <plugins/pglist.h> -#include <plugins/plugin-def.h> -#include <plugins/plugin-int.h> +#include <plugins/self.h> #include "access.h" @@ -66,15 +65,13 @@ -DEFINE_CHRYSALIDE_CONTAINER_PLUGIN("GPyChrysalidePlugin", "PyChrysalide", "Provides bindings to Python", "0.1.0", - EMPTY_PG_LIST(.required), AL(PGA_PLUGIN_INIT, PGA_PLUGIN_EXIT, PGA_NATIVE_LOADED)); +DEFINE_CHRYSALIDE_CONTAINER_PLUGIN("PyChrysalide", "Chrysalide bindings to Python", + PACKAGE_VERSION, CHRYSALIDE_WEBSITE("api/python/pychrysalide"), + NO_REQ, AL(PGA_PLUGIN_INIT, PGA_PLUGIN_EXIT, PGA_NATIVE_LOADED)); -/* Conservation d'une référence au greffon pour les messages */ -static GPluginModule *_this = NULL; - /* Note la nature du chargement */ -#define _standalone (_this == NULL) +static bool _standalone = true; /* Réceptacle pour le chargement forcé */ static PyObject *_chrysalide_module = NULL; @@ -777,7 +774,7 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin) bool result; /* Bilan à retourner */ int ret; /* Bilan de préparatifs */ - _this = plugin; + _standalone = false; /* Chargement du module pour Python */ @@ -785,8 +782,7 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin) if (ret == -1) { - g_plugin_module_log_variadic_message(plugin, LMT_ERROR, - _("Can not extend the existing table of Python built-in modules.")); + log_plugin_simple_message(LMT_ERROR, _("Can not extend the existing table of Python built-in modules.")); result = false; goto cpi_done; } @@ -900,29 +896,6 @@ PyThreadState *get_pychrysalide_main_tstate(void) /****************************************************************************** * * -* Paramètres : msg = message à faire apparaître à l'écran. * -* * -* Description : Présente dans le journal un message simple. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void log_pychrysalide_simple_message(LogMessageType type, const char *msg) -{ - if (_this != NULL) - g_plugin_module_log_simple_message(_this, type, msg); - - else - log_simple_message(type, msg); - -} - - -/****************************************************************************** -* * * Paramètres : prefix = message d'introduction à faire apparaître à l'écran.* * * * Description : Présente dans le journal une exception survenue. * @@ -976,7 +949,7 @@ void log_pychrysalide_exception(const char *prefix, ...) Py_XDECREF(err_traceback); Py_XDECREF(err_type); - log_pychrysalide_simple_message(LMT_ERROR, msg); + log_plugin_simple_message(LMT_ERROR, msg); free(msg); diff --git a/plugins/pychrysalide/pychrysa.h b/plugins/pychrysalide/pychrysa.h index 8eba5b7..a6d4bb1 100644 --- a/plugins/pychrysalide/pychrysa.h +++ b/plugins/pychrysalide/pychrysa.h @@ -55,9 +55,6 @@ G_MODULE_EXPORT void chrysalide_plugin_on_native_loaded(GPluginModule *, PluginA /* Fournit les informations du thread principal. */ PyThreadState *get_pychrysalide_main_tstate(void); -/* Présente dans le journal un message simple. */ -void log_pychrysalide_simple_message(LogMessageType, const char *); - /* Présente dans le journal une exception survenue. */ void log_pychrysalide_exception(const char *, ...); |