summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/arch/processor.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-04-19 20:55:58 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-04-19 20:55:58 (GMT)
commit14d17285cdfae2fe6bd7df0e873ef11ef876e12c (patch)
tree477afb439b4b0872268cd5e59e7badf98d6052ab /plugins/pychrysalide/arch/processor.c
parent2769384a97478f4901157b71e67ec33496dd75cf (diff)
Restricted instructions iterators to get routine contents.
Diffstat (limited to 'plugins/pychrysalide/arch/processor.c')
-rw-r--r--plugins/pychrysalide/arch/processor.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/pychrysalide/arch/processor.c b/plugins/pychrysalide/arch/processor.c
index 78109ee..94ba7df 100644
--- a/plugins/pychrysalide/arch/processor.c
+++ b/plugins/pychrysalide/arch/processor.c
@@ -1087,6 +1087,51 @@ bool ensure_python_arch_processor_is_registered(void)
}
+/******************************************************************************
+* *
+* Paramètres : arg = argument quelconque à tenter de convertir. *
+* dst = destination des valeurs récupérées en cas de succès. *
+* *
+* Description : Tente de convertir en processeur d'architecture. *
+* *
+* Retour : Bilan de l'opération, voire indications supplémentaires. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int convert_to_arch_processor(PyObject *arg, void *dst)
+{
+ int result; /* Bilan à retourner */
+
+ result = PyObject_IsInstance(arg, (PyObject *)get_python_arch_processor_type());
+
+ switch (result)
+ {
+ case -1:
+ /* L'exception est déjà fixée par Python */
+ result = 0;
+ break;
+
+ case 0:
+ PyErr_SetString(PyExc_TypeError, "unable to convert the provided argument to arch processor");
+ break;
+
+ case 1:
+ *((GArchProcessor **)dst) = G_ARCH_PROCESSOR(pygobject_get(arg));
+ break;
+
+ default:
+ assert(false);
+ break;
+
+ }
+
+ return result;
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* TRADUCTION D'EMPLACEMENT */