aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-02-10 15:42:54 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-02-10 15:42:54 +0100
commitf7463e7ce1afd8c56207adcb52fc02599c897f92 (patch)
treea7b9b23815db7a523aee1b055d413edd14528b62
parentAdd support for parameters in parser! (diff)
downloadcalp-f7463e7ce1afd8c56207adcb52fc02599c897f92.tar.gz
calp-f7463e7ce1afd8c56207adcb52fc02599c897f92.tar.xz
Add parameters to graph output.
-rw-r--r--graphs.c25
-rw-r--r--trie.inc.h17
2 files changed, 17 insertions, 25 deletions
diff --git a/graphs.c b/graphs.c
index 4f6955c3..aeb28990 100644
--- a/graphs.c
+++ b/graphs.c
@@ -14,29 +14,6 @@ int create_graph_trie (vcomponent* ev, char* filename) {
fclose(f);
-
- 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;
- }
INFO_F("Wrote '%s' to '%s'", ev->filename, filename);
return 0;
@@ -65,8 +42,6 @@ int helper_vcomponent (vcomponent* root, FILE* f) {
n = n->next;
}
fputs("}", f);
-
- attr_helper(trie->root, f);
}
vcomponent* child;
diff --git a/trie.inc.h b/trie.inc.h
index a2590b3e..89ec1ec4 100644
--- a/trie.inc.h
+++ b/trie.inc.h
@@ -141,6 +141,23 @@ int TRIE_DOT_HELP(TYPE) ( TRIE_NODE(TYPE)* root, FILE* f ) {
root->value == NULL ? "white" : "green");
TRIE_NODE(TYPE)* child = root->child;
+ // ----------------------------------------
+ if (root->value != NULL) {
+ if (! EMPTY(LLIST(key_val))(&root->value->params)) {
+ fprintf(f, "subgraph \"cluster_param_%p\"{\n color=blue;\n", root);
+ FOR(LLIST(key_val), link, &root->value->params) {
+ fprintf(f, "\"%p\" [label=\"%s := %s\"];", link,
+ link->value->key.mem,
+ link->value->val.mem);
+ }
+ fputs("}", f);
+ FOR(LLIST(key_val), link, &root->value->params) {
+ fprintf(f, "\"%p\" -> \"%p\";\n", root, link);
+ }
+ }
+ }
+ // ----------------------------------------
+
while (child != NULL) {
fprintf(f, "\"%p\" -> \"%p\";\n",
(void*) root, (void*) child);