diff options
Diffstat (limited to 'plugins/pychrysalide/arch/operand.c')
-rw-r--r-- | plugins/pychrysalide/arch/operand.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/plugins/pychrysalide/arch/operand.c b/plugins/pychrysalide/arch/operand.c index 7fa5118..0aee4f7 100644 --- a/plugins/pychrysalide/arch/operand.c +++ b/plugins/pychrysalide/arch/operand.c @@ -35,6 +35,7 @@ #include "../access.h" #include "../helpers.h" +#include "../glibext/singleton.h" @@ -48,7 +49,7 @@ static PyObject *py_arch_operand_new(PyTypeObject *, PyObject *, PyObject *); static void py_arch_operand_init_gclass(GArchOperandClass *, gpointer); /* Compare un opérande avec un autre. */ -static int py_arch_operand___cmp___wrapper(const GArchOperand *, const GArchOperand *); +static int py_arch_operand___cmp___wrapper(const GArchOperand *, const GArchOperand *, bool); /* Détermine le chemin conduisant à un opérande interne. */ static char *py_arch_operand_find_inner_operand_path_wrapper(const GArchOperand *, const GArchOperand *); @@ -59,9 +60,13 @@ static GArchOperand *py_arch_operand_get_inner_operand_from_path_wrapper(const G /* Traduit un opérande en version humainement lisible. */ static void py_arch_operand_print_wrapper(const GArchOperand *, GBufferLine *); +#ifdef INCLUDE_GTK_SUPPORT + /* Construit un petit résumé concis de l'opérande. */ static char *py_arch_operand_build_tooltip_wrapper(const GArchOperand *, const GLoadedBinary *); +#endif + /* ------------------------ DEFINITION D'OPERANDE QUELCONQUE ------------------------ */ @@ -144,7 +149,7 @@ static PyObject *py_arch_operand_new(PyTypeObject *type, PyObject *args, PyObjec if (first_time) { - status = register_class_for_dynamic_pygobject(gtype, type, base); + status = register_class_for_dynamic_pygobject(gtype, type); if (!status) { @@ -185,15 +190,18 @@ static void py_arch_operand_init_gclass(GArchOperandClass *class, gpointer unuse class->get_inner = py_arch_operand_get_inner_operand_from_path_wrapper; class->print = py_arch_operand_print_wrapper; +#ifdef INCLUDE_GTK_SUPPORT class->build_tooltip = py_arch_operand_build_tooltip_wrapper; +#endif } /****************************************************************************** * * -* Paramètres : a = premier opérande à consulter. * -* b = second opérande à consulter. * +* Paramètres : a = premier opérande à consulter. * +* b = second opérande à consulter. * +* lock = précise le besoin en verrouillage. * * * * Description : Compare un opérande avec un autre. * * * @@ -203,7 +211,7 @@ static void py_arch_operand_init_gclass(GArchOperandClass *class, gpointer unuse * * ******************************************************************************/ -static int py_arch_operand___cmp___wrapper(const GArchOperand *a, const GArchOperand *b) +static int py_arch_operand___cmp___wrapper(const GArchOperand *a, const GArchOperand *b, bool lock) { int result; /* Empreinte à retourner */ PyGILState_STATE gstate; /* Sauvegarde d'environnement */ @@ -454,6 +462,9 @@ static void py_arch_operand_print_wrapper(const GArchOperand *operand, GBufferLi } +#ifdef INCLUDE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : operand = opérande à consulter. * @@ -520,6 +531,9 @@ static char *py_arch_operand_build_tooltip_wrapper(const GArchOperand *operand, } +#endif + + /* ---------------------------------------------------------------------------------- */ /* DEFINITION D'OPERANDE QUELCONQUE */ @@ -558,7 +572,7 @@ static PyObject *py_arch_operand_richcompare(PyObject *a, PyObject *b, int op) reg_a = G_ARCH_OPERAND(pygobject_get(a)); reg_b = G_ARCH_OPERAND(pygobject_get(b)); - status = py_arch_operand___cmp___wrapper(reg_a, reg_b); + status = py_arch_operand___cmp___wrapper(reg_a, reg_b, true); result = status_to_rich_cmp_state(status, op); @@ -707,7 +721,9 @@ PyTypeObject *get_python_arch_operand_type(void) ARCH_OPERAND_FIND_INNER_OPERAND_PATH_WRAPPER, ARCH_OPERAND_GET_INNER_OPERAND_FROM_PATH_WRAPPER, ARCH_OPERAND_PRINT_WRAPPER, +#ifdef INCLUDE_GTK_SUPPORT ARCH_OPERAND_BUILD_TOOLTIP_WRAPPER, +#endif ARCH_OPERAND_FIND_INNER_OPERAND_PATH_METHOD, ARCH_OPERAND_GET_INNER_OPERAND_FROM_PATH_METHOD, { NULL } @@ -768,7 +784,10 @@ bool ensure_python_arch_operand_is_registered(void) dict = PyModule_GetDict(module); - if (!register_class_for_pygobject(dict, G_TYPE_ARCH_OPERAND, type, &PyGObject_Type)) + if (!ensure_python_singleton_candidate_is_registered()) + return false; + + if (!register_class_for_pygobject(dict, G_TYPE_ARCH_OPERAND, type)) return false; } |