summaryrefslogtreecommitdiff
path: root/src/project.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-07-31 23:34:56 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-07-31 23:34:56 (GMT)
commitd02deb2425d6559c357bdd00e1c0fb05f35d5fc9 (patch)
tree1a78849aa7d51706856a6c6127f66b48c188d0fc /src/project.c
parentfd2abec30a224279c62a7ab4892d95e56cb08dff (diff)
Processed disassembling in a dedicated thread.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@104 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/project.c')
-rw-r--r--src/project.c78
1 files changed, 72 insertions, 6 deletions
diff --git a/src/project.c b/src/project.c
index 40ddb14..fde1eb2 100644
--- a/src/project.c
+++ b/src/project.c
@@ -62,6 +62,8 @@ GtkWidget *get_loaded_binary_view(const loaded_binary *, BinaryView);
/* Propriétés d'un ensemble de fichiers ouverts */
struct openida_project
{
+ GObject* ref; /* Espace de référencement */
+
char *filename; /* Lieu d'enregistrement */
loaded_binary **binaries; /* Fichiers binaires associés */
@@ -74,6 +76,12 @@ struct openida_project
+/* Assure l'intégration d'un élément binaire dans un projet. */
+void display_new_binary_of_openida_project(GOpenidaBinary *, openida_project *);
+
+
+
+
@@ -194,7 +202,7 @@ openida_project *_get_current_openida_project(openida_project *project)
/******************************************************************************
* *
-* Paramètres : - *
+* Paramètres : ref = espace de référencement global. *
* *
* Description : Crée un projet vide. *
* *
@@ -204,12 +212,14 @@ openida_project *_get_current_openida_project(openida_project *project)
* *
******************************************************************************/
-openida_project *create_empty_openida_project(void)
+openida_project *create_empty_openida_project(GObject *ref)
{
openida_project *result; /* Adresse à retourner */
result = (openida_project *)calloc(1, sizeof(openida_project));
+ result->ref = ref;
+
return result;
}
@@ -217,7 +227,8 @@ openida_project *create_empty_openida_project(void)
/******************************************************************************
* *
-* Paramètres : filename = chemin d'accès au fichier à charger. *
+* Paramètres : ref = espace de référencement global. *
+* filename = chemin d'accès au fichier à charger. *
* *
* Description : Crée un projet à partir du contenu XML d'un fichier. *
* *
@@ -227,7 +238,7 @@ openida_project *create_empty_openida_project(void)
* *
******************************************************************************/
-openida_project *g_openida_project_new_from_xml(const char *filename)
+openida_project *g_openida_project_new_from_xml(GObject *ref, const char *filename)
{
openida_project *result; /* Adresse à retourner */
xmlDocPtr xdoc; /* Structure XML chargée */
@@ -240,7 +251,7 @@ openida_project *g_openida_project_new_from_xml(const char *filename)
if (!open_xml_file(filename, &xdoc, &context)) return NULL;
- result = (openida_project *)calloc(1, sizeof(openida_project));
+ result = create_empty_openida_project(ref);
/* Chargement des éléments binaires attachés */
@@ -259,7 +270,11 @@ openida_project *g_openida_project_new_from_xml(const char *filename)
free(access);
if (binary != NULL)
- attach_binary_to_openida_project(result, binary);
+ {
+ g_signal_connect(binary, "disassembly-done",
+ G_CALLBACK(display_new_binary_of_openida_project), result);
+ g_openida_binary_analyse(binary);
+ }
}
@@ -655,3 +670,54 @@ void display_openida_project(const openida_project *project, GObject *ref)
}
+
+
+/******************************************************************************
+* *
+* Paramètres : binary = élément binaire tout juste désassemblé. *
+* project = projet dont le contenu est à compléter. *
+* *
+* Description : Assure l'intégration d'un élément binaire dans un projet. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void display_new_binary_of_openida_project(GOpenidaBinary *binary, openida_project *project)
+{
+ size_t index; /* Indice du nouveau binaire */
+ GtkDockPanel *dpanel; /* Support de panneaux */
+ GtkWidget *view; /* Affichage du code binaire */
+ GtkDockItem *ditem; /* Panneau avec ses infos. */
+ GtkBinView *binview; /* Affichage à faire défiler */
+
+
+
+
+ attach_binary_to_openida_project(project, binary);
+ index = project->binaries_count - 1;
+
+ dpanel = GTK_DOCK_PANEL(g_object_get_data(project->ref, "binpanel"));
+
+ view = get_loaded_binary_view(project->binaries[index], BVW_BLOCK);
+
+ ditem = gtk_dock_item_new(g_openida_binary_to_string(binary), view);
+ gtk_dock_panel_add_item(dpanel, ditem);
+
+
+
+ g_object_set_data(project->ref, "current_binary", binary);
+
+
+ get_view_for_openida_project_binary(project, binary, BVW_BLOCK, &binview);
+ g_object_set_data(project->ref, "binview", binview);
+
+
+ reload_symbols_panel_content(get_panel(PNT_SYMBOLS), g_openida_binary_get_format(binary));
+
+
+
+
+}