diff options
Diffstat (limited to 'plugins/pychrysalide/arch')
| -rw-r--r-- | plugins/pychrysalide/arch/Makefile.am | 28 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/context.c | 10 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/instruction.c | 282 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/instructions/Makefile.am | 19 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/instructions/raw.c | 4 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/instructions/undefined.c | 4 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/operand.c | 18 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/operands/Makefile.am | 33 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/operands/immediate.c | 2 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/operands/known.c | 2 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/operands/proxy.c | 7 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/operands/register.c | 7 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/operands/target.c | 7 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/processor.c | 4 | ||||
| -rw-r--r-- | plugins/pychrysalide/arch/register.c | 4 | 
15 files changed, 123 insertions, 308 deletions
| diff --git a/plugins/pychrysalide/arch/Makefile.am b/plugins/pychrysalide/arch/Makefile.am index ab4ca23..c113f6e 100644 --- a/plugins/pychrysalide/arch/Makefile.am +++ b/plugins/pychrysalide/arch/Makefile.am @@ -1,22 +1,23 @@  noinst_LTLIBRARIES = libpychrysaarch.la -libpychrysaarch_la_SOURCES =			\ -	constants.h constants.c				\ -	context.h context.c					\ -	instriter.h instriter.c				\ -	instruction.h instruction.c			\ -	module.h module.c					\ -	operand.h operand.c					\ -	processor.h processor.c				\ -	register.h register.c				\ +libpychrysaarch_la_SOURCES =				\ +	constants.h constants.c					\ +	context.h context.c						\ +	instriter.h instriter.c					\ +	instruction.h instruction.c				\ +	module.h module.c						\ +	operand.h operand.c						\ +	processor.h processor.c					\ +	register.h register.c					\  	vmpa.h vmpa.c -libpychrysaarch_la_LIBADD =				\ +libpychrysaarch_la_LIBADD =					\  	instructions/libpychrysaarchinstructions.la \  	operands/libpychrysaarchoperands.la -libpychrysaarch_la_LDFLAGS =  +libpychrysaarch_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ +	-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT  devdir = $(includedir)/chrysalide/$(subdir) @@ -24,9 +25,4 @@ devdir = $(includedir)/chrysalide/$(subdir)  dev_HEADERS = $(libpychrysaarch_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ -	-I$(top_srcdir)/src - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) -  SUBDIRS = instructions operands diff --git a/plugins/pychrysalide/arch/context.c b/plugins/pychrysalide/arch/context.c index ce1ef01..79c782f 100644 --- a/plugins/pychrysalide/arch/context.c +++ b/plugins/pychrysalide/arch/context.c @@ -1,6 +1,6 @@  /* Chrysalide - Outil d'analyse de fichiers binaires - * context.c - équivalent Python du fichier "arch/context.h" + * context.c - équivalent Python du fichier "arch/context.c"   *   * Copyright (C) 2018 Cyrille Bagard   * @@ -39,6 +39,7 @@  #include "../helpers.h"  #include "../analysis/db/item.h"  #include "../arch/vmpa.h" +#include "../format/preload.h" @@ -120,7 +121,7 @@ static PyObject *py_proc_context_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)          { @@ -518,7 +519,10 @@ bool ensure_python_proc_context_is_registered(void)          dict = PyModule_GetDict(module); -        if (!register_class_for_pygobject(dict, G_TYPE_PROC_CONTEXT, type, &PyGObject_Type)) +        if (!ensure_python_preload_info_is_registered()) +            return false; + +        if (!register_class_for_pygobject(dict, G_TYPE_PROC_CONTEXT, type))              return false;          if (!define_proc_context_constants(type)) diff --git a/plugins/pychrysalide/arch/instruction.c b/plugins/pychrysalide/arch/instruction.c index 3606cfe..0a9ba16 100644 --- a/plugins/pychrysalide/arch/instruction.c +++ b/plugins/pychrysalide/arch/instruction.c @@ -45,52 +45,7 @@ -/* -------------------- INTERFACE INTERNE POUR EXTENSIONS PYTHON -------------------- */ - - -/* Définition générique d'une instruction d'architecture (instance) */ -typedef struct _GPyArchInstruction -{ -    GArchInstruction parent;                /* A laisser en premier        */ - -    char *cached_keyword;                   /* Conservation de constante   */ - -} GPyArchInstruction; - - -/* Définition générique d'une instruction d'architecture (classe) */ -typedef struct _GPyArchInstructionClass -{ -    GArchInstructionClass parent;           /* A laisser en premier        */ - -} GPyArchInstructionClass; - - -#define G_TYPE_PYARCH_INSTRUCTION            g_pyarch_instruction_get_type() -#define G_PYARCH_INSTRUCTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_PYARCH_INSTRUCTION, GPyArchInstruction)) -#define G_IS_PYTHON_INSTRUCTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_PYARCH_INSTRUCTION)) -#define G_PYARCH_INSTRUCTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PYARCH_INSTRUCTION, GPyArchInstructionClass)) -#define G_IS_PYTHON_INSTRUCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_PYARCH_INSTRUCTION)) -#define G_PYARCH_INSTRUCTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PYARCH_INSTRUCTION, GPyArchInstructionClass)) - - -/* Indique le type défini pour une instruction d'architecture en Python. */ -GType g_pyarch_instruction_get_type(void); - -/* Initialise la classe générique des instructions en Python. */ -static void g_pyarch_instruction_class_init(GPyArchInstructionClass *); - -/* Initialise une instance d'opérande d'architecture. */ -static void g_pyarch_instruction_init(GPyArchInstruction *); - -/* Supprime toutes les références externes. */ -static void g_pyarch_instruction_dispose(GPyArchInstruction *); - -/* Procède à la libération totale de la mémoire. */ -static void g_pyarch_instruction_finalize(GPyArchInstruction *); - -/* Fournit le nom humain de l'instruction manipulée. */ -static const char *g_pyarch_instruction_get_keyword(GPyArchInstruction *); +static G_DEFINE_QUARK(cached_keyword, get_cached_keyword); @@ -101,11 +56,16 @@ static const char *g_pyarch_instruction_get_keyword(GPyArchInstruction *);  static PyObject *py_arch_instruction_new(PyTypeObject *, PyObject *, PyObject *);  /* Initialise la classe générique des instructions. */ -static void py_arch_instruction_init_gclass(GPyArchInstructionClass *, gpointer); +static void py_arch_instruction_init_gclass(GArchInstructionClass *, gpointer); + +CREATE_DYN_ABSTRACT_CONSTRUCTOR(arch_instruction, G_TYPE_ARCH_INSTRUCTION, py_arch_instruction_init_gclass);  /* Initialise une instance sur la base du dérivé de GObject. */  static int py_arch_instruction_init(PyObject *, PyObject *, PyObject *); +/* Fournit le nom humain de l'instruction manipulée. */ +static const char *py_arch_instruction_get_class_keyword(GArchInstruction *); +  /* --------------------------- MANIPULATION DES OPERANDES --------------------------- */ @@ -160,19 +120,16 @@ static PyObject *py_arch_instruction_get_keyword(PyObject *, void *);  /* ---------------------------------------------------------------------------------- */ -/*                      INTERFACE INTERNE POUR EXTENSIONS PYTHON                      */ +/*                          GLUE POUR CREATION DEPUIS PYTHON                          */  /* ---------------------------------------------------------------------------------- */ -/* Indique le type défini pour une instruction d'architecture en Python. */ -G_DEFINE_TYPE(GPyArchInstruction, g_pyarch_instruction, G_TYPE_ARCH_INSTRUCTION); - -  /******************************************************************************  *                                                                             * -*  Paramètres  : klass = classe à initialiser.                                * +*  Paramètres  : class  = classe à initialiser.                               * +*                unused = données non utilisées ici.                          *  *                                                                             * -*  Description : Initialise la classe générique des instructions en Python.   * +*  Description : Initialise la classe générique des instructions.             *  *                                                                             *  *  Retour      : -                                                            *  *                                                                             * @@ -180,78 +137,62 @@ G_DEFINE_TYPE(GPyArchInstruction, g_pyarch_instruction, G_TYPE_ARCH_INSTRUCTION)  *                                                                             *  ******************************************************************************/ -static void g_pyarch_instruction_class_init(GPyArchInstructionClass *klass) +static void py_arch_instruction_init_gclass(GArchInstructionClass *class, gpointer unused)  { -    GObjectClass *object;                   /* Autre version de la classe  */      GArchInstructionClass *instr;           /* Encore une autre vision...  */ -    object = G_OBJECT_CLASS(klass); +    instr = G_ARCH_INSTRUCTION_CLASS(class); -    object->dispose = (GObjectFinalizeFunc/* ! */)g_pyarch_instruction_dispose; -    object->finalize = (GObjectFinalizeFunc)g_pyarch_instruction_finalize; - -    instr = G_ARCH_INSTRUCTION_CLASS(klass); - -    instr->get_keyword = (get_instruction_keyword_fc)g_pyarch_instruction_get_keyword; +    instr->get_keyword = (get_instruction_keyword_fc)py_arch_instruction_get_class_keyword;  }  /******************************************************************************  *                                                                             * -*  Paramètres  : instr = instance à initialiser.                              * +*  Paramètres  : self = objet à initialiser (théoriquement).                  * +*                args = arguments fournis à l'appel.                          * +*                kwds = arguments de type key=val fournis.                    *  *                                                                             * -*  Description : Initialise une instance d'instruction d'architecture.        * +*  Description : Initialise une instance sur la base du dérivé de GObject.    *  *                                                                             * -*  Retour      : -                                                            * +*  Retour      : 0.                                                           *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -static void g_pyarch_instruction_init(GPyArchInstruction *instr) +static int py_arch_instruction_init(PyObject *self, PyObject *args, PyObject *kwds)  { +    unsigned short int uid;                 /* Indentifiant unique de type */ +    const char *keyword;                    /* Désignation d'instruction   */ +    int ret;                                /* Bilan de lecture des args.  */ +    GArchInstruction *instr;                /* Instruction à manipuler     */ +    GQuark cache_key;                       /* Emplacement local           */ -} +    static char *kwlist[] = { "uid", "keyword", NULL }; +    /* Récupération des paramètres */ -/****************************************************************************** -*                                                                             * -*  Paramètres  : instr = instance d'objet GLib à traiter.                     * -*                                                                             * -*  Description : Supprime toutes les références externes.                     * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ +    ret = PyArg_ParseTupleAndKeywords(args, kwds, "Hs", kwlist, &uid, &keyword); +    if (!ret) return -1; -static void g_pyarch_instruction_dispose(GPyArchInstruction *instr) -{ -    G_OBJECT_CLASS(g_pyarch_instruction_parent_class)->dispose(G_OBJECT(instr)); +    /* Initialisation d'un objet GLib */ -} +    ret = forward_pygobjet_init(self); +    if (ret == -1) return -1; +    /* Eléments de base */ -/****************************************************************************** -*                                                                             * -*  Paramètres  : instr = instance d'objet GLib à traiter.                     * -*                                                                             * -*  Description : Procède à la libération totale de la mémoire.                * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ +    instr = G_ARCH_INSTRUCTION(pygobject_get(self)); -static void g_pyarch_instruction_finalize(GPyArchInstruction *instr) -{ -    if (instr->cached_keyword) -        free(instr->cached_keyword); +    cache_key = get_cached_keyword_quark(); -    G_OBJECT_CLASS(g_pyarch_instruction_parent_class)->finalize(G_OBJECT(instr)); +    g_object_set_qdata_full(G_OBJECT(instr), cache_key, strdup(keyword), g_free); + +    g_arch_instruction_set_unique_id(G_ARCH_INSTRUCTION(instr), uid); + +    return 0;  } @@ -268,151 +209,21 @@ static void g_pyarch_instruction_finalize(GPyArchInstruction *instr)  *                                                                             *  ******************************************************************************/ -static const char *g_pyarch_instruction_get_keyword(GPyArchInstruction *instr) +static const char *py_arch_instruction_get_class_keyword(GArchInstruction *instr)  {      const char *result;                     /* Désignation à retourner     */ +    GQuark cache_key;                       /* Emplacement local           */ -    result = instr->cached_keyword; +    cache_key = get_cached_keyword_quark(); -    return result; - -} - - -/* ---------------------------------------------------------------------------------- */ -/*                          GLUE POUR CREATION DEPUIS PYTHON                          */ -/* ---------------------------------------------------------------------------------- */ - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : type = type du nouvel objet à mettre en place.               * -*                args = éventuelle liste d'arguments.                         * -*                kwds = éventuel dictionnaire de valeurs mises à disposition. * -*                                                                             * -*  Description : Accompagne la création d'une instance dérivée en Python.     * -*                                                                             * -*  Retour      : Nouvel objet Python mis en place ou NULL en cas d'échec.     * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static PyObject *py_arch_instruction_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ -    PyObject *result;                       /* Objet à retourner           */ -    PyTypeObject *base;                     /* Type de base à dériver      */ -    bool first_time;                        /* Evite les multiples passages*/ -    GType gtype;                            /* Nouveau type de processeur  */ -    bool status;                            /* Bilan d'un enregistrement   */ - -    /* Validations diverses */ - -    base = get_python_arch_instruction_type(); - -    if (type == base) -    { -        result = NULL; -        PyErr_Format(PyExc_RuntimeError, _("%s is an abstract class"), type->tp_name); -        goto exit; -    } - -    /* Mise en place d'un type dédié */ - -    first_time = (g_type_from_name(type->tp_name) == 0); - -    gtype = build_dynamic_type(G_TYPE_PYARCH_INSTRUCTION, type->tp_name, -                               (GClassInitFunc)py_arch_instruction_init_gclass, NULL, NULL); - -    if (first_time) -    { -        status = register_class_for_dynamic_pygobject(gtype, type, base); - -        if (!status) -        { -            result = NULL; -            goto exit; -        } - -    } - -    /* On crée, et on laisse ensuite la main à PyGObject_Type.tp_init() */ - -    result = PyType_GenericNew(type, args, kwds); - - exit: +    result = g_object_get_qdata(G_OBJECT(instr), cache_key); +    assert(result != NULL);      return result;  } -/****************************************************************************** -*                                                                             * -*  Paramètres  : class  = classe à initialiser.                               * -*                unused = données non utilisées ici.                          * -*                                                                             * -*  Description : Initialise la classe générique des instructions.             * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void py_arch_instruction_init_gclass(GPyArchInstructionClass *class, gpointer unused) -{ -    /// .... - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : self = objet à initialiser (théoriquement).                  * -*                args = arguments fournis à l'appel.                          * -*                kwds = arguments de type key=val fournis.                    * -*                                                                             * -*  Description : Initialise une instance sur la base du dérivé de GObject.    * -*                                                                             * -*  Retour      : 0.                                                           * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static int py_arch_instruction_init(PyObject *self, PyObject *args, PyObject *kwds) -{ -    unsigned short int uid;                 /* Indentifiant unique de type */ -    const char *keyword;                    /* Désignation d'instruction   */ -    int ret;                                /* Bilan de lecture des args.  */ -    GPyArchInstruction *instr;              /* Instruction à manipuler     */ - -    static char *kwlist[] = { "uid", "keyword", NULL }; - -    /* Récupération des paramètres */ - -    ret = PyArg_ParseTupleAndKeywords(args, kwds, "Hs", kwlist, &uid, &keyword); -    if (!ret) return -1; - -    /* Initialisation d'un objet GLib */ - -    ret = forward_pygobjet_init(self); -    if (ret == -1) return -1; - -    /* Eléments de base */ - -    instr = G_PYARCH_INSTRUCTION(pygobject_get(self)); - -    instr->cached_keyword = strdup(keyword); - -    g_arch_instruction_set_unique_id(G_ARCH_INSTRUCTION(instr), uid); - -    return 0; - -} - -  /* ---------------------------------------------------------------------------------- */  /*                             MANIPULATION DES OPERANDES                             */ @@ -1085,8 +896,7 @@ bool ensure_python_arch_instruction_is_registered(void)          if (!ensure_python_line_generator_is_registered())              return false; -        if (!_register_class_for_pygobject(dict, G_TYPE_PYARCH_INSTRUCTION, type, -                                           &PyGObject_Type, get_python_line_generator_type(), NULL)) +        if (!register_class_for_pygobject(dict, G_TYPE_ARCH_INSTRUCTION, type))              return false;          if (!define_arch_instruction_constants(type)) diff --git a/plugins/pychrysalide/arch/instructions/Makefile.am b/plugins/pychrysalide/arch/instructions/Makefile.am index 4c36acf..65efe42 100644 --- a/plugins/pychrysalide/arch/instructions/Makefile.am +++ b/plugins/pychrysalide/arch/instructions/Makefile.am @@ -2,24 +2,15 @@  noinst_LTLIBRARIES = libpychrysaarchinstructions.la  libpychrysaarchinstructions_la_SOURCES =	\ -	constants.h constants.c				\ -	module.h module.c					\ -	raw.h raw.c							\ +	constants.h constants.c					\ +	module.h module.c						\ +	raw.h raw.c								\  	undefined.h undefined.c -libpychrysaarchinstructions_la_LIBADD =  - -libpychrysaarchinstructions_la_LDFLAGS =  +libpychrysaarchinstructions_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ +	-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT  devdir = $(includedir)/chrysalide/$(subdir)  dev_HEADERS = $(libpychrysaarchinstructions_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ -	-I$(top_srcdir)/src - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS =  diff --git a/plugins/pychrysalide/arch/instructions/raw.c b/plugins/pychrysalide/arch/instructions/raw.c index c1366c6..7e58b96 100644 --- a/plugins/pychrysalide/arch/instructions/raw.c +++ b/plugins/pychrysalide/arch/instructions/raw.c @@ -99,7 +99,7 @@ static PyObject *py_raw_instruction_new(PyTypeObject *type, PyObject *args, PyOb      if (first_time)      { -        status = register_class_for_dynamic_pygobject(gtype, type, base); +        status = register_class_for_dynamic_pygobject(gtype, type);          if (!status)          { @@ -458,7 +458,7 @@ bool ensure_python_raw_instruction_is_registered(void)          if (!ensure_python_arch_instruction_is_registered())              return false; -        if (!register_class_for_pygobject(dict, G_TYPE_RAW_INSTRUCTION, type, get_python_arch_instruction_type())) +        if (!register_class_for_pygobject(dict, G_TYPE_RAW_INSTRUCTION, type))              return false;          if (!define_raw_instruction_constants(type)) diff --git a/plugins/pychrysalide/arch/instructions/undefined.c b/plugins/pychrysalide/arch/instructions/undefined.c index 99fd2ff..1246daa 100644 --- a/plugins/pychrysalide/arch/instructions/undefined.c +++ b/plugins/pychrysalide/arch/instructions/undefined.c @@ -88,7 +88,7 @@ static PyObject *py_undef_instruction_new(PyTypeObject *type, PyObject *args, Py      if (first_time)      { -        status = register_class_for_dynamic_pygobject(gtype, type, base); +        status = register_class_for_dynamic_pygobject(gtype, type);          if (!status)          { @@ -285,7 +285,7 @@ bool ensure_python_undefined_instruction_is_registered(void)          if (!ensure_python_arch_instruction_is_registered())              return false; -        if (!register_class_for_pygobject(dict, G_TYPE_UNDEF_INSTRUCTION, type, get_python_arch_instruction_type())) +        if (!register_class_for_pygobject(dict, G_TYPE_UNDEF_INSTRUCTION, type))              return false;          if (!define_undefined_instruction_constants(type)) diff --git a/plugins/pychrysalide/arch/operand.c b/plugins/pychrysalide/arch/operand.c index 71e7cdc..0aee4f7 100644 --- a/plugins/pychrysalide/arch/operand.c +++ b/plugins/pychrysalide/arch/operand.c @@ -60,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 ------------------------ */ @@ -145,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)          { @@ -186,7 +190,9 @@ 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  } @@ -456,6 +462,9 @@ static void py_arch_operand_print_wrapper(const GArchOperand *operand, GBufferLi  } +#ifdef INCLUDE_GTK_SUPPORT + +  /******************************************************************************  *                                                                             *  *  Paramètres  : operand = opérande à consulter.                              * @@ -522,6 +531,9 @@ static char *py_arch_operand_build_tooltip_wrapper(const GArchOperand *operand,  } +#endif + +  /* ---------------------------------------------------------------------------------- */  /*                          DEFINITION D'OPERANDE QUELCONQUE                          */ @@ -709,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 } @@ -773,7 +787,7 @@ bool ensure_python_arch_operand_is_registered(void)          if (!ensure_python_singleton_candidate_is_registered())              return false; -        if (!register_class_for_pygobject(dict, G_TYPE_ARCH_OPERAND, type, &PyGObject_Type)) +        if (!register_class_for_pygobject(dict, G_TYPE_ARCH_OPERAND, type))              return false;      } diff --git a/plugins/pychrysalide/arch/operands/Makefile.am b/plugins/pychrysalide/arch/operands/Makefile.am index cf00ce2..a41cbbb 100644 --- a/plugins/pychrysalide/arch/operands/Makefile.am +++ b/plugins/pychrysalide/arch/operands/Makefile.am @@ -1,31 +1,22 @@  noinst_LTLIBRARIES = libpychrysaarchoperands.la -libpychrysaarchoperands_la_SOURCES =	\ -	constants.h constants.c				\ -	feeder.h feeder.c					\ -	immediate.h immediate.c				\ -	known.h known.c						\ -	module.h module.c					\ -	proxy.h proxy.c						\ -	register.h register.c				\ -	rename.h rename.c					\ -	target.h target.c					\ +libpychrysaarchoperands_la_SOURCES =		\ +	constants.h constants.c					\ +	feeder.h feeder.c						\ +	immediate.h immediate.c					\ +	known.h known.c							\ +	module.h module.c						\ +	proxy.h proxy.c							\ +	register.h register.c					\ +	rename.h rename.c						\ +	target.h target.c						\  	targetable.h targetable.c -libpychrysaarchoperands_la_LIBADD =  - -libpychrysaarchoperands_la_LDFLAGS =  +libpychrysaarchoperands_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ +	-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT  devdir = $(includedir)/chrysalide/$(subdir)  dev_HEADERS = $(libpychrysaarchoperands_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ -	-I$(top_srcdir)/src - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS =  diff --git a/plugins/pychrysalide/arch/operands/immediate.c b/plugins/pychrysalide/arch/operands/immediate.c index 62f6328..2239eb2 100644 --- a/plugins/pychrysalide/arch/operands/immediate.c +++ b/plugins/pychrysalide/arch/operands/immediate.c @@ -603,7 +603,7 @@ bool ensure_python_imm_operand_is_registered(void)          if (!ensure_python_renameable_operand_is_registered())              return false; -        if (!register_class_for_pygobject(dict, G_TYPE_IMM_OPERAND, type, get_python_arch_operand_type())) +        if (!register_class_for_pygobject(dict, G_TYPE_IMM_OPERAND, type))              return false;          if (!define_imm_operand_constants(type)) diff --git a/plugins/pychrysalide/arch/operands/known.c b/plugins/pychrysalide/arch/operands/known.c index 435ea0f..fab426e 100644 --- a/plugins/pychrysalide/arch/operands/known.c +++ b/plugins/pychrysalide/arch/operands/known.c @@ -169,7 +169,7 @@ bool ensure_python_known_imm_operand_is_registered(void)          if (!ensure_python_renamed_operand_is_registered())              return false; -        if (!register_class_for_pygobject(dict, G_TYPE_KNOWN_IMM_OPERAND, type, get_python_imm_operand_type())) +        if (!register_class_for_pygobject(dict, G_TYPE_KNOWN_IMM_OPERAND, type))              return false;      } diff --git a/plugins/pychrysalide/arch/operands/proxy.c b/plugins/pychrysalide/arch/operands/proxy.c index 1cfd4a4..5009d29 100644 --- a/plugins/pychrysalide/arch/operands/proxy.c +++ b/plugins/pychrysalide/arch/operands/proxy.c @@ -105,7 +105,7 @@ static PyObject *py_proxy_operand_new(PyTypeObject *type, PyObject *args, PyObje      if (first_time)      { -        status = register_class_for_dynamic_pygobject(gtype, type, base); +        status = register_class_for_dynamic_pygobject(gtype, type);          if (!status)          { @@ -319,7 +319,10 @@ bool ensure_python_proxy_operand_is_registered(void)          dict = PyModule_GetDict(module); -        if (!register_class_for_pygobject(dict, G_TYPE_PROXY_OPERAND, type, get_python_arch_operand_type())) +        if (!ensure_python_arch_operand_is_registered()) +            return false; + +        if (!register_class_for_pygobject(dict, G_TYPE_PROXY_OPERAND, type))              return false;      } diff --git a/plugins/pychrysalide/arch/operands/register.c b/plugins/pychrysalide/arch/operands/register.c index d032e04..2a48a0f 100644 --- a/plugins/pychrysalide/arch/operands/register.c +++ b/plugins/pychrysalide/arch/operands/register.c @@ -112,7 +112,7 @@ static PyObject *py_register_operand_new(PyTypeObject *type, PyObject *args, PyO      if (first_time)      { -        status = register_class_for_dynamic_pygobject(gtype, type, base); +        status = register_class_for_dynamic_pygobject(gtype, type);          if (!status)          { @@ -427,7 +427,10 @@ bool ensure_python_register_operand_is_registered(void)          dict = PyModule_GetDict(module); -        if (!register_class_for_pygobject(dict, G_TYPE_REGISTER_OPERAND, type, get_python_arch_operand_type())) +        if (!ensure_python_arch_operand_is_registered()) +            return false; + +        if (!register_class_for_pygobject(dict, G_TYPE_REGISTER_OPERAND, type))              return false;      } diff --git a/plugins/pychrysalide/arch/operands/target.c b/plugins/pychrysalide/arch/operands/target.c index 76c8269..b8cd536 100644 --- a/plugins/pychrysalide/arch/operands/target.c +++ b/plugins/pychrysalide/arch/operands/target.c @@ -115,7 +115,7 @@ static PyObject *py_target_operand_new(PyTypeObject *type, PyObject *args, PyObj      if (first_time)      { -        status = register_class_for_dynamic_pygobject(gtype, type, base); +        status = register_class_for_dynamic_pygobject(gtype, type);          if (!status)          { @@ -429,10 +429,13 @@ bool ensure_python_target_operand_is_registered(void)          dict = PyModule_GetDict(module); +        if (!ensure_python_arch_operand_is_registered()) +            return false; +          if (!ensure_python_targetable_operand_is_registered())              return false; -        if (!register_class_for_pygobject(dict, G_TYPE_TARGET_OPERAND, type, get_python_arch_operand_type())) +        if (!register_class_for_pygobject(dict, G_TYPE_TARGET_OPERAND, type))              return false;      } diff --git a/plugins/pychrysalide/arch/processor.c b/plugins/pychrysalide/arch/processor.c index 80b55d3..00b472f 100644 --- a/plugins/pychrysalide/arch/processor.c +++ b/plugins/pychrysalide/arch/processor.c @@ -186,7 +186,7 @@ static PyObject *py_arch_processor_new(PyTypeObject *type, PyObject *args, PyObj      if (first_time)      { -        status = register_class_for_dynamic_pygobject(gtype, type, base); +        status = register_class_for_dynamic_pygobject(gtype, type);          if (!status)          { @@ -1452,7 +1452,7 @@ bool ensure_python_arch_processor_is_registered(void)          dict = PyModule_GetDict(module); -        if (!register_class_for_pygobject(dict, G_TYPE_ARCH_PROCESSOR, type, &PyGObject_Type)) +        if (!register_class_for_pygobject(dict, G_TYPE_ARCH_PROCESSOR, type))              return false;          if (!define_arch_processor_constants(type)) diff --git a/plugins/pychrysalide/arch/register.c b/plugins/pychrysalide/arch/register.c index 5d9e90b..615a5b7 100644 --- a/plugins/pychrysalide/arch/register.c +++ b/plugins/pychrysalide/arch/register.c @@ -144,7 +144,7 @@ static PyObject *py_arch_register_new(PyTypeObject *type, PyObject *args, PyObje      if (first_time)      { -        status = register_class_for_dynamic_pygobject(gtype, type, base); +        status = register_class_for_dynamic_pygobject(gtype, type);          if (!status)          { @@ -686,7 +686,7 @@ bool ensure_python_arch_register_is_registered(void)          if (!ensure_python_serializable_object_is_registered())              return false; -        if (!register_class_for_pygobject(dict, G_TYPE_ARCH_REGISTER, type, &PyGObject_Type)) +        if (!register_class_for_pygobject(dict, G_TYPE_ARCH_REGISTER, type))              return false;      } | 
