summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/project.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-12 17:07:05 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-12 17:07:05 (GMT)
commitc806bc75910c129c6d78115cfdc571316e060412 (patch)
tree3752138befa5508fe43ea3410237c5edb1163cbf /plugins/pychrysalide/analysis/project.c
parentd5b598b14fd4c50847ce536692ded258ba1720ca (diff)
Reorganized the global variables access in the Python bindings.
Diffstat (limited to 'plugins/pychrysalide/analysis/project.c')
-rw-r--r--plugins/pychrysalide/analysis/project.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/project.c b/plugins/pychrysalide/analysis/project.c
index 06a67b6..1a85f71 100644
--- a/plugins/pychrysalide/analysis/project.c
+++ b/plugins/pychrysalide/analysis/project.c
@@ -335,3 +335,48 @@ bool ensure_python_study_project_is_registered(void)
return true;
}
+
+
+/******************************************************************************
+* *
+* 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 projet d'étude. *
+* *
+* Retour : Bilan de l'opération, voire indications supplémentaires. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int convert_to_study_project(PyObject *arg, void *dst)
+{
+ int result; /* Bilan à retourner */
+
+ result = PyObject_IsInstance(arg, (PyObject *)get_python_study_project_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 study project");
+ break;
+
+ case 1:
+ *((GStudyProject **)dst) = G_STUDY_PROJECT(pygobject_get(arg));
+ break;
+
+ default:
+ assert(false);
+ break;
+
+ }
+
+ return result;
+
+}