aboutsummaryrefslogtreecommitdiff
path: root/graphs.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-03 13:27:20 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-03 13:27:20 +0100
commit1fd1232450a215a37915e3657964f2dad7ce72d6 (patch)
tree907cb87e027c12ffd550081513340db5aef3589a /graphs.c
parentMade .x files secoundary in makefile. (diff)
downloadcalp-1fd1232450a215a37915e3657964f2dad7ce72d6.tar.gz
calp-1fd1232450a215a37915e3657964f2dad7ce72d6.tar.xz
Add graphviz output for TRIE's.
Add simple output in dot format for trie structures. Along with a slightly updated main which handles a few more command line arguments. Also updated makefile to generate pdf's from dot files and dot-files from parse.
Diffstat (limited to 'graphs.c')
-rw-r--r--graphs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/graphs.c b/graphs.c
new file mode 100644
index 00000000..931b181b
--- /dev/null
+++ b/graphs.c
@@ -0,0 +1,17 @@
+#include "graphs.h"
+
+#include <stdio.h>
+
+int create_graph (vevent* ev, char* filename) {
+ FILE* f = fopen(filename, "w");
+
+ fputs("digraph {\n rankdir=LR;", f);
+ TRIE_DOT(content_line)(&ev->clines, f);
+ fputs("}", f);
+
+ fclose(f);
+
+ printf("Wrote '%s' to '%s'\n", ev->filename, filename);
+
+ return 0;
+}