summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/core/processors.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-01-04 10:15:57 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-01-04 10:15:57 (GMT)
commitaded4e75efc21319d5a777bf53bc087587f0740c (patch)
tree8b1b11415227679c79272cfb1df90f13801bb219 /plugins/pychrysalide/core/processors.c
parent8255d60ac64a851c2e7ca37d63aa1ba37d35b704 (diff)
Refreshed the Python documentation for the core features.
Diffstat (limited to 'plugins/pychrysalide/core/processors.c')
-rw-r--r--plugins/pychrysalide/core/processors.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/plugins/pychrysalide/core/processors.c b/plugins/pychrysalide/core/processors.c
index 47e4643..bd4a50f 100644
--- a/plugins/pychrysalide/core/processors.c
+++ b/plugins/pychrysalide/core/processors.c
@@ -41,10 +41,10 @@
/* Enregistre un processeur pour une architecture donnée. */
-static PyObject *py_processors_register_type(PyObject *, PyObject *);
+static PyObject *py_processors_register_processor(PyObject *, PyObject *);
/* Fournit le processeur d'architecture correspondant à un nom. */
-static PyObject *py_processors_get_for_key(PyObject *, PyObject *);
+static PyObject *py_processors_get_processor_for_key(PyObject *, PyObject *);
@@ -61,7 +61,7 @@ static PyObject *py_processors_get_for_key(PyObject *, PyObject *);
* *
******************************************************************************/
-static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
+static PyObject *py_processors_register_processor(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
PyObject *type; /* Type d'une instance future */
@@ -72,6 +72,15 @@ static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
GType instance; /* Type pour futures instances */
bool status; /* Bilan d'un enregistrement */
+#define PROCESSORS_REGISTER_PROCESSOR_METHOD PYTHON_METHOD_DEF \
+( \
+ register_processor, "inst, /", \
+ METH_VARARGS, py_processors, \
+ "Register an architecture processor using an initial instance of it.\n" \
+ "\n" \
+ "This instance has to be a subclass of pychrysalide.arch.ArchProcessor."\
+)
+
ret = PyArg_ParseTuple(args, "O!", &PyType_Type, &type);
if (!ret) return NULL;
@@ -130,17 +139,27 @@ static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
* *
******************************************************************************/
-static PyObject *py_processors_get_for_key(PyObject *self, PyObject *args)
+static PyObject *py_processors_get_processor_for_key(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
- const char *name; /* Nom technique de processeur */
+ const char *key; /* Nom technique de processeur */
int ret; /* Bilan de lecture des args. */
GArchProcessor *proc; /* Instance mise en place */
- ret = PyArg_ParseTuple(args, "s", &name);
+#define PROCESSORS_GET_PROCESSOR_FOR_KEY_METHOD PYTHON_METHOD_DEF \
+( \
+ get_processor_for_key, "key, /", \
+ METH_VARARGS, py_processors, \
+ "Provide an instance of an architecture processor for a given name," \
+ " provided as a key string.\n" \
+ "\n" \
+ "The return instance is a pychrysalide.arch.ArchProcessor subclass." \
+)
+
+ ret = PyArg_ParseTuple(args, "s", &key);
if (!ret) return NULL;
- proc = get_arch_processor_for_key(name);
+ proc = get_arch_processor_for_key(key);
if (proc != NULL)
{
@@ -176,18 +195,9 @@ bool populate_core_module_with_processors(void)
PyObject *module; /* Module à recompléter */
static PyMethodDef py_processors_methods[] = {
- {
- "register_processor", py_processors_register_type,
- METH_VARARGS,
- "register_processor(name, desc, cls, /)\n--\n\nRegister an an architecture processor by its name, description and class type."
- },
- {
- "get_processor_for_key", py_processors_get_for_key,
- METH_VARARGS,
- "get_processor_for_key(name, /)\n--\n\nProvide an instance of an architecture processor for a given name."
- },
+ PROCESSORS_REGISTER_PROCESSOR_METHOD,
+ PROCESSORS_GET_PROCESSOR_FOR_KEY_METHOD,
{ NULL }
-
};
module = get_access_to_python_module("pychrysalide.core");