aboutsummaryrefslogtreecommitdiff
path: root/trie.inc.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-09 01:19:43 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-09 01:19:43 +0100
commiteba7f0e2713a55b2516df97999a3995476a7c166 (patch)
tree0a798f752b57be021006ae405412453ac26a0512 /trie.inc.h
parentFix main loop. (diff)
downloadcalp-eba7f0e2713a55b2516df97999a3995476a7c166.tar.gz
calp-eba7f0e2713a55b2516df97999a3995476a7c166.tar.xz
Add support for full tree printing.
Diffstat (limited to 'trie.inc.h')
-rw-r--r--trie.inc.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/trie.inc.h b/trie.inc.h
index 5fa047db..3bc19895 100644
--- a/trie.inc.h
+++ b/trie.inc.h
@@ -113,11 +113,16 @@ FREE_F(TRIE(TYPE)) {
return FREE(TRIE_NODE(TYPE))(this->root);
}
+int EMPTY(TRIE(TYPE))(TRIE(TYPE)* this) {
+ return this->root->child == NULL;
+}
+
int TRIE_DOT(TYPE) ( TRIE(TYPE)* trie, FILE* f ) {
TRIE_NODE(TYPE)* n = trie->root->child;
- fputs("root [fontcolor=gray, color=gray];", f);
+ fprintf(f, "\"%p\" [label=root fontcolor=gray, color=gray];", trie);
while (n != NULL) {
- fprintf(f, "root -> \"%p\" [color=gray]\n",
+ fprintf(f, "\"%p\" -> \"%p\" [color=gray]\n",
+ (void*) trie,
(void*) n);
fprintf(f, "subgraph \"cluster_%c\" {\n",
n->c);