merge graphviz function prototype into r3.h

This commit is contained in:
c9s 2014-06-03 20:47:35 +08:00
parent 09da7a0b6c
commit 053f9202f6
6 changed files with 24 additions and 25 deletions

View file

@ -25,7 +25,6 @@ r3_include_HEADERS = \
include/r3_define.h \ include/r3_define.h \
include/r3_list.h \ include/r3_list.h \
include/r3_str.h \ include/r3_str.h \
include/r3_gvc.h \
include/str_array.h \ include/str_array.h \
$(NULL) $(NULL)

View file

@ -36,11 +36,13 @@ Pattern Syntax
/blog/post/{id:\d+} use `\d+` regular expression instead of default. /blog/post/{id:\d+} use `\d+` regular expression instead of default.
C API API
------------------------ ------------------------
```c ```c
#include <r3.h> #include <r3.h>
#include <r3_str.h>
// create a router tree with 10 children capacity (this capacity can grow dynamically) // create a router tree with 10 children capacity (this capacity can grow dynamically)
n = r3_tree_create(10); n = r3_tree_create(10);

View file

@ -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); const char * r3_node_to_json_string(const node * n);
#endif #endif
#ifdef ENABLE_GRAPHVIZ
#include <stdio.h>
#include <gvc.h>
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 #ifdef __cplusplus
} }
#endif #endif
#endif /* !R3_NODE_H */ #endif /* !R3_NODE_H */

View file

@ -1,21 +0,0 @@
/*
* r3_gvc.h
* Copyright (C) 2014 c9s <c9s@c9smba.local>
*
* Distributed under terms of the MIT license.
*/
#ifndef R3_GVC_H
#define R3_GVC_H
#include <stdio.h>
#include <gvc.h>
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 */

View file

@ -9,7 +9,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "r3.h" #include "r3.h"
#include "r3_gvc.h"
#include "zmalloc.h" #include "zmalloc.h"
void r3_tree_build_ag_nodes(Agraph_t * g, Agnode_t * ag_parent_node, const node * n, int node_cnt) { void r3_tree_build_ag_nodes(Agraph_t * g, Agnode_t * ag_parent_node, const node * n, int node_cnt) {

View file

@ -10,7 +10,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "r3.h" #include "r3.h"
#include "r3_str.h" #include "r3_str.h"
#include "r3_gvc.h"
#include "bench.h" #include "bench.h"
START_TEST (test_gvc_render_dot) START_TEST (test_gvc_render_dot)