summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/arch/vmpa.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/arch/vmpa.c')
-rw-r--r--plugins/pychrysalide/arch/vmpa.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/pychrysalide/arch/vmpa.c b/plugins/pychrysalide/arch/vmpa.c
index b042a9f..015687f 100644
--- a/plugins/pychrysalide/arch/vmpa.c
+++ b/plugins/pychrysalide/arch/vmpa.c
@@ -1342,3 +1342,47 @@ PyObject *build_from_internal_mrange(const mrange_t *range)
return result;
}
+
+
+/******************************************************************************
+* *
+* 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 espace mémoire n'importe quoi. *
+* *
+* Retour : Bilan de l'opération, voire indications supplémentaires. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int convert_any_to_mrange(PyObject *arg, void *dst)
+{
+ int result; /* Bilan à retourner */
+ int ret; /* Test intermédiaire */
+ mrange_t *src; /* Modèle de données à copier */
+
+ result = 0;
+
+ /* Si l'objet est au bon format, rien à faire ! */
+
+ ret = PyObject_IsInstance(arg, (PyObject *)get_python_mrange_type());
+
+ if (ret == 1)
+ {
+ src = get_internal_mrange(arg);
+ copy_mrange((mrange_t *)dst, src);
+
+ result = 1;
+ goto catm_done;
+
+ }
+
+ PyErr_SetString(PyExc_TypeError, "unable to convert the provided argument to mrange");
+
+ catm_done:
+
+ return result;
+
+}