/* OpenIDA - Outil d'analyse de fichiers binaires
 * format_elf.h - prototypes pour l'affichage d'un fragment de code d'assemblage
 *
 * Copyright (C) 2008 Cyrille Bagard
 *
 *  This file is part of OpenIDA.
 *
 *  OpenIDA is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  OpenIDA is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar.  If not, see .
 */
#ifndef _GTK_SNIPPET_H
#define _GTK_SNIPPET_H
#include 
#include 
#include 
#include "arch/instruction.h"
#include "arch/processor.h"
G_BEGIN_DECLS
#define GTK_SNIPPET(obj) GTK_CHECK_CAST(obj, gtk_snippet_get_type (), GtkSnippet)
#define GTK_SNIPPET_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, gtk_snippet_get_type(), GtkSnippetClass)
#define GTK_IS_SNIPPET(obj) GTK_CHECK_TYPE(obj, gtk_snippet_get_type())
typedef struct _GtkSnippet GtkSnippet;
typedef struct _GtkSnippetClass GtkSnippetClass;
/* Mode d'adressage à utiliser */
typedef enum _AdressMode
{
    ADM_32BITS,                             /* Adresses sur 32 bits        */
    ADM_64BITS                              /* Adresses sur 64 bits        */
} AdressMode;
typedef struct _code_line_info
{
    uint64_t offset;                        /* Position de l'instruction   */
    asm_instr *instr;                       /* Eventuelle instruction      */
    char *comment;                          /* Eventuel commentaire        */
} code_line_info;
struct _GtkSnippet {
    GtkWidget widget;                       /* Présence obligatoire en 1er */
    AdressMode mode;                        /* Mode d'affichage            */
    PangoLayout *layout;                    /* Moteur de rendu du code ASM */
    GdkGC *gc;                              /* Contexte graphique du rendu */
    const asm_processor *proc;              /* Architecture utilisée       */
    code_line_info *info;                   /* Contenu à représenter       */
    unsigned int info_count;                /* Quantité d'informations     */
  gint sel;
};
struct _GtkSnippetClass {
  GtkWidgetClass parent_class;
};
GtkType gtk_snippet_get_type(void);
void gtk_snippet_set_sel(GtkSnippet *cpu, gint sel);
GtkWidget * gtk_snippet_new();
void gtk_snippet_test(GtkSnippet *cpu);
/* Définit l'architecture à laquelle le contenu est lié. */
void gtk_snippet_set_processor(GtkSnippet *, const asm_processor *);
/* Ajoute une ligne dans le bloc de représentation. */
void gtk_snippet_add_line(GtkSnippet *, uint64_t, asm_instr *, const char *);
/* Définit le contenu visuel à partir des infos enregistrées. */
void gtk_snippet_build_content(GtkSnippet *);
G_END_DECLS
#endif  /* _GTK_SNIPPET_H */