summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/core
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-05-12 22:09:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-05-12 22:09:53 (GMT)
commit00e93226e72bdb18853580f553e32df111422936 (patch)
tree9c346903d4506cae2df19b9314cf307c783c0cb3 /plugins/pychrysalide/core
parente44ffc323c8a9d4b446baba6e0b131107312fa84 (diff)
Simplified the way processors are registered.
Diffstat (limited to 'plugins/pychrysalide/core')
-rw-r--r--plugins/pychrysalide/core/processors.c63
1 files changed, 7 insertions, 56 deletions
diff --git a/plugins/pychrysalide/core/processors.c b/plugins/pychrysalide/core/processors.c
index 56498f3..47e4643 100644
--- a/plugins/pychrysalide/core/processors.c
+++ b/plugins/pychrysalide/core/processors.c
@@ -43,11 +43,8 @@
/* Enregistre un processeur pour une architecture donnée. */
static PyObject *py_processors_register_type(PyObject *, PyObject *);
-/* Fournit le nom humain de l'architecture visée. */
-static PyObject *py_processors_get_description(PyObject *, PyObject *);
-
/* Fournit le processeur d'architecture correspondant à un nom. */
-static PyObject *py_processors_get_for_name(PyObject *, PyObject *);
+static PyObject *py_processors_get_for_key(PyObject *, PyObject *);
@@ -67,8 +64,6 @@ static PyObject *py_processors_get_for_name(PyObject *, PyObject *);
static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
- const char *name; /* Nom technique de processeur */
- const char *desc; /* description humaine liée */
PyObject *type; /* Type d'une instance future */
int ret; /* Bilan de lecture des args. */
PyObject *new_args; /* Nouveaux arguments épurés */
@@ -77,7 +72,7 @@ static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
GType instance; /* Type pour futures instances */
bool status; /* Bilan d'un enregistrement */
- ret = PyArg_ParseTuple(args, "ssO!", &name, &desc, &PyType_Type, &type);
+ ret = PyArg_ParseTuple(args, "O!", &PyType_Type, &type);
if (!ret) return NULL;
ret = PyObject_IsSubclass(type, (PyObject *)get_python_arch_processor_type());;
@@ -112,7 +107,7 @@ static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
Py_DECREF(dummy);
- status = register_processor_type(name, desc, instance);
+ status = register_processor_type(instance);
result = status ? Py_True : Py_False;
Py_INCREF(result);
@@ -127,45 +122,6 @@ static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
* Paramètres : self = objet Python concerné par l'appel. *
* args = arguments fournis à l'appel. *
* *
-* Description : Fournit le nom humain de l'architecture visée. *
-* *
-* Retour : Désignation humaine trouvée ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_processors_get_description(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Bilan à retourner */
- const char *name; /* Nom technique de processeur */
- int ret; /* Bilan de lecture des args. */
- const char *desc; /* Description humaine obtenue */
-
- ret = PyArg_ParseTuple(args, "s", &name);
- if (!ret) return NULL;
-
- desc = get_arch_processor_description(name);
-
- if (desc != NULL)
- result = PyUnicode_FromString(desc);
-
- else
- {
- result = Py_None;
- Py_INCREF(result);
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* args = arguments fournis à l'appel. *
-* *
* Description : Fournit le processeur d'architecture correspondant à un nom. *
* *
* Retour : Processeur d'architecture trouvé. *
@@ -174,7 +130,7 @@ static PyObject *py_processors_get_description(PyObject *self, PyObject *args)
* *
******************************************************************************/
-static PyObject *py_processors_get_for_name(PyObject *self, PyObject *args)
+static PyObject *py_processors_get_for_key(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
const char *name; /* Nom technique de processeur */
@@ -184,7 +140,7 @@ static PyObject *py_processors_get_for_name(PyObject *self, PyObject *args)
ret = PyArg_ParseTuple(args, "s", &name);
if (!ret) return NULL;
- proc = get_arch_processor_for_name(name);
+ proc = get_arch_processor_for_key(name);
if (proc != NULL)
{
@@ -226,14 +182,9 @@ bool populate_core_module_with_processors(void)
"register_processor(name, desc, cls, /)\n--\n\nRegister an an architecture processor by its name, description and class type."
},
{
- "get_processor_description", py_processors_get_description,
- METH_VARARGS,
- "get_processor_description(name, /)\n--\n\nProvide the description of a given architecture processor."
- },
- {
- "get_processor_for_name", py_processors_get_for_name,
+ "get_processor_for_key", py_processors_get_for_key,
METH_VARARGS,
- "get_processor_for_name(name, /)\n--\n\nProvide an instance of an architecture processor for a given name."
+ "get_processor_for_key(name, /)\n--\n\nProvide an instance of an architecture processor for a given name."
},
{ NULL }