From 3b7bb66d7e7f3655571cb2bbdd47eaa8fc2833b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 10 Feb 2019 01:04:44 +0100 Subject: Add attr_helper to graph output. --- graphs.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/graphs.c b/graphs.c index f1c8ed75..bcadd787 100644 --- a/graphs.c +++ b/graphs.c @@ -17,6 +17,29 @@ int create_graph_trie (vcomponent* ev, char* filename) { return 0; } +int attr_helper(TRIE_NODE(content_line)* root, FILE* f) { + + if (root->value != NULL) { + if (! EMPTY(LLIST(strbuf))(&root->value->params)) { + printf("%s\n", root->value->key.mem); + fprintf(f, "subgraph \"cluster_param_%p\"{\n color=blue;\n", root); + FOR(LLIST(strbuf), link, &root->value->params) { + fprintf(f, "\"%p\" [label=\"%s\"];", link, link->value->mem); + fprintf(f, "\"%p\" -> \"%p\";\n", root, link); + } + fputs("}", f); + } + } + + TRIE_NODE(content_line)* child = root->child; + while (child != NULL) { + attr_helper(root->child, f); + child = child->next; + } + + return 0; +} + int helper_vcomponent (vcomponent* root, FILE* f) { fprintf(f, "subgraph \"cluster_root\" { label=File; \"%p\" [label=%s] }\n", root, root->type); @@ -34,10 +57,14 @@ int helper_vcomponent (vcomponent* root, FILE* f) { fprintf(f, "subgraph \"cluster_%c_%p\" {\ncolor=red; \n", n->c, root); TRIE_DOT_HELP(content_line) ( n, f ); + + fputs("}", f); n = n->next; } fputs("}", f); + + attr_helper(trie->root, f); } vcomponent* child; -- cgit v1.2.3