From 053f9202f6585b3c0ce196419ef642d557927ae8 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 3 Jun 2014 20:47:35 +0800 Subject: [PATCH] merge graphviz function prototype into r3.h --- Makefile.am | 1 - README.md | 4 +++- include/r3.h | 21 +++++++++++++++++++++ include/r3_gvc.h | 21 --------------------- src/gvc.c | 1 - tests/check_gvc.c | 1 - 6 files changed, 24 insertions(+), 25 deletions(-) delete mode 100644 include/r3_gvc.h diff --git a/Makefile.am b/Makefile.am index 0d9861b..6e1b0e6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,7 +25,6 @@ r3_include_HEADERS = \ include/r3_define.h \ include/r3_list.h \ include/r3_str.h \ - include/r3_gvc.h \ include/str_array.h \ $(NULL) diff --git a/README.md b/README.md index 51ca996..0d67182 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,13 @@ Pattern Syntax /blog/post/{id:\d+} use `\d+` regular expression instead of default. -C API +API ------------------------ ```c #include +#include + // create a router tree with 10 children capacity (this capacity can grow dynamically) n = r3_tree_create(10); diff --git a/include/r3.h b/include/r3.h index b75450b..58d1160 100644 --- a/include/r3.h +++ b/include/r3.h @@ -191,8 +191,29 @@ const char * r3_node_to_json_pretty_string(const node * n); const char * r3_node_to_json_string(const node * n); #endif + +#ifdef ENABLE_GRAPHVIZ +#include +#include + +void r3_tree_build_ag_nodes(Agraph_t * g, Agnode_t * ag_parent_node, const node * n, int node_cnt); + +int r3_tree_render(const node * tree, const char *layout, const char * format, FILE *fp); + +int r3_tree_render_dot(const node * tree, const char *layout, FILE *fp); + +int r3_tree_render_file(const node * tree, const char * format, const char * filename); +#endif + + + + + #ifdef __cplusplus } #endif + + + #endif /* !R3_NODE_H */ diff --git a/include/r3_gvc.h b/include/r3_gvc.h deleted file mode 100644 index 4d2b56f..0000000 --- a/include/r3_gvc.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * r3_gvc.h - * Copyright (C) 2014 c9s - * - * Distributed under terms of the MIT license. - */ -#ifndef R3_GVC_H -#define R3_GVC_H - -#include -#include - -void r3_tree_build_ag_nodes(Agraph_t * g, Agnode_t * ag_parent_node, const node * n, int node_cnt); - -int r3_tree_render(const node * tree, const char *layout, const char * format, FILE *fp); - -int r3_tree_render_dot(const node * tree, const char *layout, FILE *fp); - -int r3_tree_render_file(const node * tree, const char * format, const char * filename); - -#endif /* !R3_GVC_H */ diff --git a/src/gvc.c b/src/gvc.c index e24a555..963df28 100644 --- a/src/gvc.c +++ b/src/gvc.c @@ -9,7 +9,6 @@ #include #include #include "r3.h" -#include "r3_gvc.h" #include "zmalloc.h" void r3_tree_build_ag_nodes(Agraph_t * g, Agnode_t * ag_parent_node, const node * n, int node_cnt) { diff --git a/tests/check_gvc.c b/tests/check_gvc.c index ae43a60..6442d0a 100644 --- a/tests/check_gvc.c +++ b/tests/check_gvc.c @@ -10,7 +10,6 @@ #include #include "r3.h" #include "r3_str.h" -#include "r3_gvc.h" #include "bench.h" START_TEST (test_gvc_render_dot)