diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-05-17 18:05:48 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-05-17 18:05:48 (GMT) |
commit | d110791309783e6e30df837a81cf8e14e1ac9641 (patch) | |
tree | 75e65909e080cc3ace578c7beb6f0bdae6dc18c1 /plugins/pychrysalide/format | |
parent | f3e136eab9fd6adcb51988c9f70ca7f35552abc4 (diff) |
Updated the plugin system and its Python documentation.
Diffstat (limited to 'plugins/pychrysalide/format')
-rw-r--r-- | plugins/pychrysalide/format/symbol.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/plugins/pychrysalide/format/symbol.c b/plugins/pychrysalide/format/symbol.c index c86b453..7ecc576 100644 --- a/plugins/pychrysalide/format/symbol.c +++ b/plugins/pychrysalide/format/symbol.c @@ -59,7 +59,7 @@ static PyObject *py_binary_symbol_new(PyTypeObject *, PyObject *, PyObject *); static void py_binary_symbol_init_gclass(GBinSymbolClass *, gpointer); /* Fournit une étiquette pour viser un symbole. */ -static char *g_binary_symbol_get_label_wrapper(const GBinSymbol *); +static char *py_binary_symbol_get_label_wrapper(const GBinSymbol *); /* Initialise une instance sur la base du dérivé de GObject. */ static int py_binary_symbol_init(PyObject *, PyObject *, PyObject *); @@ -194,7 +194,7 @@ static PyObject *py_binary_symbol_new(PyTypeObject *type, PyObject *args, PyObje static void py_binary_symbol_init_gclass(GBinSymbolClass *class, gpointer unused) { - class->get_label = g_binary_symbol_get_label_wrapper; + class->get_label = py_binary_symbol_get_label_wrapper; } @@ -211,12 +211,21 @@ static void py_binary_symbol_init_gclass(GBinSymbolClass *class, gpointer unused * * ******************************************************************************/ -static char *g_binary_symbol_get_label_wrapper(const GBinSymbol *symbol) +static char *py_binary_symbol_get_label_wrapper(const GBinSymbol *symbol) { char *result; /* Etiquette à retourner */ PyObject *pyobj; /* Objet Python concerné */ PyObject *pyret; /* Bilan de consultation */ +#define BINARY_SYMBOL_GET_LABEL_WRAPPER PYTHON_WRAPPER_DEF \ +( \ + _get_label, "$self, /", \ + METH_VARARGS, \ + "Abstract method used to provide the default label for a symbol.\n" \ + "\n" \ + "The returned value has to be a string." \ +) + result = NULL; pyobj = pygobject_new(G_OBJECT(symbol)); @@ -275,8 +284,8 @@ static int py_binary_symbol_init(PyObject *self, PyObject *args, PyObject *kwds) "Where range is a memory space defined by pychrysalide.arch.mrange and" \ " stype a pychrysalide.format.BinSymbol.SymbolType value." \ "\n" \ - "The following special method can be overridden:\n" \ - "* _get_label(self): provides a default label for the symbol." + "The following methods have to be defined for new classes:\n" \ + "* pychrysalide.format.BinSymbol._get_label()." /* Récupération des paramètres */ @@ -892,6 +901,7 @@ static int py_binary_symbol_set_label(PyObject *self, PyObject *value, void *clo PyTypeObject *get_python_binary_symbol_type(void) { static PyMethodDef binary_symbol_methods[] = { + BINARY_SYMBOL_GET_LABEL_WRAPPER, BINARY_SYMBOL_SET_FLAG_METHOD, BINARY_SYMBOL_UNSET_FLAG_METHOD, BINARY_SYMBOL_HAS_FLAG_METHOD, |