diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-09 01:19:43 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-09 01:19:43 +0100 |
commit | eba7f0e2713a55b2516df97999a3995476a7c166 (patch) | |
tree | 0a798f752b57be021006ae405412453ac26a0512 /trie.inc.h | |
parent | Fix main loop. (diff) | |
download | calp-eba7f0e2713a55b2516df97999a3995476a7c166.tar.gz calp-eba7f0e2713a55b2516df97999a3995476a7c166.tar.xz |
Add support for full tree printing.
Diffstat (limited to '')
-rw-r--r-- | trie.inc.h | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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); |