diff options
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r-- | plugins/pychrysalide/analysis/db/certs.c | 2 | ||||
-rw-r--r-- | plugins/pychrysalide/analysis/db/collection.c | 2 | ||||
-rw-r--r-- | plugins/pychrysalide/analysis/db/item.c | 2 | ||||
-rw-r--r-- | plugins/pychrysalide/format/symbol.c | 10 | ||||
-rw-r--r-- | plugins/pychrysalide/helpers.c | 24 | ||||
-rw-r--r-- | plugins/pychrysalide/pychrysa.c | 4 |
6 files changed, 33 insertions, 11 deletions
diff --git a/plugins/pychrysalide/analysis/db/certs.c b/plugins/pychrysalide/analysis/db/certs.c index 5fd2034..3da3849 100644 --- a/plugins/pychrysalide/analysis/db/certs.c +++ b/plugins/pychrysalide/analysis/db/certs.c @@ -263,7 +263,7 @@ PyTypeObject *get_python_certs_type(void) }, { "sign_cert", py_certs_sign_cert, METH_VARARGS | METH_STATIC, - "sign_cert(csr, cacert, cakey, cert, valid, /)\n--\n\nSign a certificate sign request.." + "sign_cert(csr, cacert, cakey, cert, valid, /)\n--\n\nSign a certificate sign request." }, { NULL } diff --git a/plugins/pychrysalide/analysis/db/collection.c b/plugins/pychrysalide/analysis/db/collection.c index 7f8ac2d..699c272 100644 --- a/plugins/pychrysalide/analysis/db/collection.c +++ b/plugins/pychrysalide/analysis/db/collection.c @@ -104,7 +104,7 @@ bool ensure_python_db_collection_is_registered(void) if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) { - module = get_access_to_python_module("pychrysalide.format"); + module = get_access_to_python_module("pychrysalide.analysis.db"); dict = PyModule_GetDict(module); diff --git a/plugins/pychrysalide/analysis/db/item.c b/plugins/pychrysalide/analysis/db/item.c index 23e6933..0544d86 100644 --- a/plugins/pychrysalide/analysis/db/item.c +++ b/plugins/pychrysalide/analysis/db/item.c @@ -176,7 +176,7 @@ bool ensure_python_db_item_is_registered(void) if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) { - module = get_access_to_python_module("pychrysalide.format"); + module = get_access_to_python_module("pychrysalide.analysis.db"); dict = PyModule_GetDict(module); diff --git a/plugins/pychrysalide/format/symbol.c b/plugins/pychrysalide/format/symbol.c index 359ee45..a88a260 100644 --- a/plugins/pychrysalide/format/symbol.c +++ b/plugins/pychrysalide/format/symbol.c @@ -249,16 +249,16 @@ static int py_binary_symbol_init(PyObject *self, PyObject *args, PyObject *kwds) GBinSymbol *symbol; /* Version GLib du symble */ #define BINARY_SYMBOL_DOC \ - "BinSymbol represents all kinds of symbols, such as string, routines or" \ + "BinSymbol represents all kinds of symbols, such as strings, routines or" \ " objects. If something can be linked to a physical or virtual location," \ " it can be a symbol." \ "\n" \ "Instances can be created using the following constructor:\n" \ "\n" \ - " BinSymbol(stype, range)" \ + " BinSymbol(range, stype)" \ "\n" \ - "Where stype is a pychrysalide.format.BinSymbol.SymbolType value, and" \ - " range a memory space defined by pychrysalide.arch.mrange." \ + "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." @@ -363,7 +363,7 @@ static PyObject *py_binary_symbol_get_range(PyObject *self, void *closure) #define BINARY_SYMBOL_RANGE_ATTRIB PYTHON_GETSET_DEF_FULL \ ( \ range, py_binary_symbol, \ - "Range covered by the symbol." \ + "Memory range covered by the symbol." \ ) symbol = G_BIN_SYMBOL(pygobject_get(self)); diff --git a/plugins/pychrysalide/helpers.c b/plugins/pychrysalide/helpers.c index 59bcd45..5b7c1e6 100644 --- a/plugins/pychrysalide/helpers.c +++ b/plugins/pychrysalide/helpers.c @@ -28,8 +28,10 @@ #include <malloc.h> #include <pygobject.h> #include <stdarg.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <i18n.h> @@ -1003,6 +1005,9 @@ bool attach_constants_group(PyTypeObject *owner, bool flags, const char *name, P int ret; /* Bilan d'une insertion */ PyObject *args; /* Arguments de la construction*/ PyObject *kwargs; /* Mots clefs en complément */ + char *dot; /* Point de séparation */ + char *module; /* Module d'appartenance */ + char *qualname; /* Désignation pour Pickle */ PyObject *new; /* Nouvelle instance en place */ PyObject *features; /* Module à recompléter */ PyObject *features_dict; /* Dictionnaire à compléter */ @@ -1046,10 +1051,27 @@ bool attach_constants_group(PyTypeObject *owner, bool flags, const char *name, P kwargs = PyDict_New(); - str_obj = PyUnicode_FromString(owner->tp_name); + dot = rindex(owner->tp_name, '.'); + assert(dot != NULL); + + module = strndup(owner->tp_name, dot - owner->tp_name); + + str_obj = PyUnicode_FromString(module); ret = PyDict_SetItemString(kwargs, "module", str_obj); Py_DECREF(str_obj); + free(module); + + asprintf(&qualname, "%s.%s", dot + 1, name); + + if (ret != 0) goto kwargs_error; + + str_obj = PyUnicode_FromString(qualname); + ret = PyDict_SetItemString(kwargs, "qualname", str_obj); + Py_DECREF(str_obj); + + free(qualname); + if (ret != 0) goto kwargs_error; /* Constitution de l'énumération et enregistrement */ diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c index 23ec3d7..d97cbf0 100644 --- a/plugins/pychrysalide/pychrysa.c +++ b/plugins/pychrysalide/pychrysa.c @@ -390,10 +390,10 @@ static bool add_plugin_module_to_python_module(PyObject *super) "PyChrysalide is a module containing Chrysalide's features and designed for Python users.\n" \ "\n" \ "The whole API is defined in a single library named 'pychrysalide.so' and can be used in two ways:\n" \ - "* either from the Chrysalide's GUI, by registering hooks or GLib signals.\n" \ + "* either from the Chrysalide's GUI, by registering hooks or GLib signals,\n" \ "* or from a shell command line, by setting PYTHONPATH to point to the directory containing the library.\n" \ "\n" \ - "In both cases, it is a good start point to have a look at already existing plugins to quickly learn " \ + "In both cases, this is a good start point to have a look at already existing plugins to quickly learn " \ "how the API works.\n" \ "\n" \ "These plugins are located in the 'plugins/python' directory." |