diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/graph/dot.c | 18 | ||||
-rw-r--r-- | src/gtkext/graph/layout.c | 35 | ||||
-rw-r--r-- | src/gtkext/gtkgraphview.c | 2 | ||||
-rw-r--r-- | src/gtkext/gtklinkrenderer.c | 16 | ||||
-rw-r--r-- | src/gtkext/gtklinkrenderer.h | 1 |
5 files changed, 39 insertions, 33 deletions
diff --git a/src/gtkext/graph/dot.c b/src/gtkext/graph/dot.c index 4c35089..0e7091e 100644 --- a/src/gtkext/graph/dot.c +++ b/src/gtkext/graph/dot.c @@ -25,6 +25,7 @@ #include <malloc.h> +#include <string.h> #include <graphviz/gvc.h> #include <graphviz/types.h> @@ -210,14 +211,19 @@ GtkLinkRenderer **create_links_from_graph_layout(const graph_layout *layout, siz /* Détermination de la couleur */ + color = LKC_DEFAULT; + attrib = agfindedgeattr(agraphof(agtail(eiter)), "color"); - if (eiter->attr[attrib->index][0] == 'g') /* "green" */ - color = LKC_GREEN; - else if (eiter->attr[attrib->index][0] == 'r') /* "red" */ - color = LKC_RED; - else - color = LKC_DEFAULT; + if (attrib != NULL) + { + if (strcmp("green", eiter->attr[attrib->index]) == 0) + color = LKC_GREEN; + else if (strcmp("red", eiter->attr[attrib->index]) == 0) + color = LKC_RED; + else if (strcmp("gray", eiter->attr[attrib->index]) == 0) + color = LKC_DASHED_GRAY; + } /* Raccordement au point de départ */ diff --git a/src/gtkext/graph/layout.c b/src/gtkext/graph/layout.c index 64a8236..3a2f4e3 100644 --- a/src/gtkext/graph/layout.c +++ b/src/gtkext/graph/layout.c @@ -137,7 +137,6 @@ static char *complete_graph_links(const GtkGraphView *view, GtkViewPanel **views size_t j; /* Boucle de parcours #2 */ size_t k; /* Boucle de parcours #3 */ char cmd[LINKS_DESC_LEN]; /* Tampon pour l'ajout de liens*/ - GArchInstruction *next; /* Instruction suivante */ if (count == 0) return desc; @@ -168,6 +167,7 @@ static char *complete_graph_links(const GtkGraphView *view, GtkViewPanel **views if (k < count) switch (types[j]) { + case ILT_EXEC_FLOW: case ILT_JUMP: snprintf(cmd, LINKS_DESC_LEN, "_%p:s -> _%p:n [ltail=cluster_%p, lhead=cluster_%p];\n", @@ -191,6 +191,14 @@ static char *complete_graph_links(const GtkGraphView *view, GtkViewPanel **views desc = stradd(desc, cmd); break; + case ILT_CATCH_EXCEPTION: + snprintf(cmd, LINKS_DESC_LEN, + "_%p:s -> _%p:n [ltail=cluster_%p, lhead=cluster_%p, " \ + "color=gray];\n", + views[i], views[k], views[i], views[k]); + desc = stradd(desc, cmd); + break; + default: break; @@ -200,31 +208,6 @@ static char *complete_graph_links(const GtkGraphView *view, GtkViewPanel **views } - /* Sinon on suit le flux normal */ - else - { - if (g_arch_instruction_is_return(last)) - continue; - - next = g_arch_instruction_get_next_iter(instrs, last, VMPA_MAX); - if (next == NULL) continue; - - g_arch_instruction_get_location(next, NULL, NULL, &addr); - - for (k = 0; k < count; k++) - if (gtk_view_panel_contain_address(views[k], addr)) - break; - - if (k < count) - { - snprintf(cmd, LINKS_DESC_LEN, - "_%p:s -> _%p:n [ltail=cluster_%p, lhead=cluster_%p];\n", - views[i], views[k], views[i], views[k]); - desc = stradd(desc, cmd); - } - - } - } return desc; diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c index f205ee2..1a48680 100644 --- a/src/gtkext/gtkgraphview.c +++ b/src/gtkext/gtkgraphview.c @@ -650,7 +650,7 @@ static GtkViewPanel **gtk_graph_view_load_nodes(GtkGraphView *view, GLoadedBinar g_arch_instruction_get_location(iter, NULL, NULL, &last); if (first == VMPA_MAX) first = last; - if (g_arch_instruction_has_destinations(iter)) + if (g_arch_instruction_has_destinations(iter) || g_arch_instruction_is_return(iter)) { result = (GtkViewPanel **)realloc(result, ++(*count) * sizeof(GtkViewPanel *)); diff --git a/src/gtkext/gtklinkrenderer.c b/src/gtkext/gtklinkrenderer.c index 43eda38..8b43fa8 100644 --- a/src/gtkext/gtklinkrenderer.c +++ b/src/gtkext/gtklinkrenderer.c @@ -189,6 +189,22 @@ void _gtk_link_renderer_draw(const GtkLinkRenderer *renderer, cairo_t *cairo, bo case LKC_RED: cairo_set_source_rgb(cairo, 0.8, 0, 0); break; + case LKC_DASHED_GRAY: + cairo_set_source_rgb(cairo, 0.4, 0.4, 0.4); + break; + } + + switch (renderer->color) + { + default: + case LKC_DEFAULT: + case LKC_GREEN: + case LKC_RED: + cairo_set_dash(cairo, (double []) { 6.0 }, 0, 0.0); + break; + case LKC_DASHED_GRAY: + cairo_set_dash(cairo, (double []) { 6.0 }, 1, 0.0); + break; } /** diff --git a/src/gtkext/gtklinkrenderer.h b/src/gtkext/gtklinkrenderer.h index 574bd1d..3f6442c 100644 --- a/src/gtkext/gtklinkrenderer.h +++ b/src/gtkext/gtklinkrenderer.h @@ -52,6 +52,7 @@ typedef enum _LinkColor LKC_DEFAULT, /* Noir, par défaut */ LKC_GREEN, /* Condition vérifiée */ LKC_RED, /* Condition non vérifiée */ + LKC_DASHED_GRAY, /* Exception omniprésente */ LKC_COUNT |