From: erg Date: Thu, 7 Dec 2006 22:49:35 +0000 (+0000) Subject: Re-do some .h files to limit exposure of internal values, .h files, X-Git-Tag: LAST_LIBGRAPH~32^2~5794 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50e6037fce73f8c966aae243f575455a760f373f;p=graphviz Re-do some .h files to limit exposure of internal values, .h files, and dependencies on config.h; return to a simple, concrete boolean type --- diff --git a/lib/common/arith.h b/lib/common/arith.h index d60160d6e..d51866a1c 100644 --- a/lib/common/arith.h +++ b/lib/common/arith.h @@ -33,8 +33,6 @@ #endif #include -#include "logic.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/lib/common/arrows.c b/lib/common/arrows.c index 04c89a70a..6bb35d99a 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -226,7 +226,7 @@ double arrow_length(edge_t * e, int flag) } /* inside function for calls to bezier_clip */ -static bool inside(inside_t * inside_context, pointf p) +static boolean inside(inside_t * inside_context, pointf p) { return DIST2(p, inside_context->a.p[0]) <= inside_context->a.r[0]; } diff --git a/lib/common/colorprocs.h b/lib/common/colorprocs.h index 468098daa..a70c63fa5 100644 --- a/lib/common/colorprocs.h +++ b/lib/common/colorprocs.h @@ -17,6 +17,8 @@ #ifndef GV_COLORPROCS_H #define GV_COLORPROCS_H +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/lib/common/diagen.c b/lib/common/diagen.c index 8efac87b8..65727cebf 100644 --- a/lib/common/diagen.c +++ b/lib/common/diagen.c @@ -974,7 +974,7 @@ static void dia_polyline(point * A, int n) dia_fputs(" \n"); } -static void dia_usershape(usershape_t *us, boxf b, point *A, int n, bool filled) +static void dia_usershape(usershape_t *us, boxf b, point *A, int n, boolean filled) { char *imagefile; diff --git a/lib/common/emit.c b/lib/common/emit.c index 5ed0027cf..71fd16e6e 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -167,7 +167,7 @@ static void map_label(GVJ_t *job, textlabel_t *lab) * regular rectangular shape. Rectangle is regular when * it is not skewed and distorted and orientation is almost zero */ -static bool isRect(polygon_t * p) +static boolean isRect(polygon_t * p) { return (p->sides == 4 && (ROUND(p->orientation) % 90) == 0 && p->distortion == 0.0 && p->skew == 0.0); @@ -533,7 +533,7 @@ static void firstlayer(GVJ_t *job) job->layerNum = 1; } -static bool validlayer(GVJ_t *job) +static boolean validlayer(GVJ_t *job) { return (job->layerNum <= job->numLayers); } @@ -671,7 +671,7 @@ static void firstpage(GVJ_t *job) job->pagesArrayElem = job->pagesArrayFirst; } -static bool validpage(GVJ_t *job) +static boolean validpage(GVJ_t *job) { return ((job->pagesArrayElem.x >= 0) && (job->pagesArrayElem.x < job->pagesArraySize.x) @@ -691,7 +691,7 @@ static void nextpage(GVJ_t *job) } } -static bool write_edge_test(Agraph_t * g, Agedge_t * e) +static boolean write_edge_test(Agraph_t * g, Agedge_t * e) { Agraph_t *sg; int c; @@ -704,7 +704,7 @@ static bool write_edge_test(Agraph_t * g, Agedge_t * e) return TRUE; } -static bool write_node_test(Agraph_t * g, Agnode_t * n) +static boolean write_node_test(Agraph_t * g, Agnode_t * n) { Agraph_t *sg; int c; @@ -844,7 +844,7 @@ static void setup_page(GVJ_t * job, graph_t * g) } } -static bool is_natural_number(char *sstr) +static boolean is_natural_number(char *sstr) { unsigned char *str = (unsigned char *) sstr; @@ -870,14 +870,14 @@ static int layer_index(GVC_t *gvc, char *str, int all) return -1; } -static bool selectedlayer(GVJ_t *job, char *spec) +static boolean selectedlayer(GVJ_t *job, char *spec) { GVC_t *gvc = job->gvc; int n0, n1; unsigned char buf[SMALLBUF]; char *w0, *w1; agxbuf xb; - bool rval = FALSE; + boolean rval = FALSE; agxbinit(&xb, SMALLBUF, buf); agxbput(&xb, spec); @@ -909,7 +909,7 @@ static bool selectedlayer(GVJ_t *job, char *spec) return rval; } -static bool node_in_layer(GVJ_t *job, graph_t * g, node_t * n) +static boolean node_in_layer(GVJ_t *job, graph_t * g, node_t * n) { char *pn, *pe; edge_t *e; @@ -931,7 +931,7 @@ static bool node_in_layer(GVJ_t *job, graph_t * g, node_t * n) return FALSE; } -static bool edge_in_layer(GVJ_t *job, graph_t * g, edge_t * e) +static boolean edge_in_layer(GVJ_t *job, graph_t * g, edge_t * e) { char *pe, *pn; int cnt; @@ -951,7 +951,7 @@ static bool edge_in_layer(GVJ_t *job, graph_t * g, edge_t * e) return FALSE; } -static bool clust_in_layer(GVJ_t *job, graph_t * sg) +static boolean clust_in_layer(GVJ_t *job, graph_t * sg) { char *pg; node_t *n; @@ -969,7 +969,7 @@ static bool clust_in_layer(GVJ_t *job, graph_t * sg) return FALSE; } -static bool node_in_box(node_t *n, boxf b) +static boolean node_in_box(node_t *n, boxf b) { return boxf_overlap(ND_bb(n), b); } @@ -1002,7 +1002,7 @@ static void emit_begin_node(GVJ_t * job, node_t * n) if (flags & GVRENDER_DOES_TOOLTIPS) { if ((s = agget(n, "tooltip")) && s[0]) { obj->tooltip = strdup_and_subst_obj(s, (void*)n); - obj->explicit_tooltip = true; + obj->explicit_tooltip = TRUE; } else { obj->tooltip = strdup(ND_label(n)->text); @@ -1466,7 +1466,7 @@ static void emit_edge_graphics(GVJ_t * job, edge_t * e) } } -static bool edge_in_box(edge_t *e, boxf b) +static boolean edge_in_box(edge_t *e, boxf b) { splines *spl; textlabel_t *lp; @@ -1540,21 +1540,21 @@ void emit_begin_edge(GVJ_t * job, edge_t * e) if (flags & GVRENDER_DOES_TOOLTIPS) { if ((s = agget(e, "tooltip")) && s[0]) { obj->tooltip = strdup_and_subst_obj(s, (void*)e); - obj->explicit_tooltip = true; + obj->explicit_tooltip = TRUE; } else if (obj->label) obj->tooltip = strdup(obj->label); if ((s = agget(e, "tailtooltip")) && s[0]) { obj->tailtooltip = strdup_and_subst_obj(s, (void*)e); - obj->explicit_tailtooltip = true; + obj->explicit_tailtooltip = TRUE; } else if (obj->taillabel) obj->tailtooltip = strdup(obj->taillabel); if ((s = agget(e, "headtooltip")) && s[0]) { obj->headtooltip = strdup_and_subst_obj(s, (void*)e); - obj->explicit_headtooltip = true; + obj->explicit_headtooltip = TRUE; } else if (obj->headlabel) obj->headtooltip = strdup(obj->headlabel); @@ -2007,7 +2007,7 @@ static void emit_begin_graph(GVJ_t * job, graph_t * g) if (flags & GVRENDER_DOES_TOOLTIPS) { if ((s = agget(g, "tooltip")) && s[0]) { obj->tooltip = strdup_and_subst_obj(s, (void*)g); - obj->explicit_tooltip = true; + obj->explicit_tooltip = TRUE; } else if (obj->url && obj->label) { obj->tooltip = strdup(obj->label); @@ -2192,7 +2192,7 @@ static void emit_begin_cluster(GVJ_t * job, Agraph_t * sg) if (flags & GVRENDER_DOES_TOOLTIPS) { if ((s = agget(sg, "tooltip")) && s[0]) { obj->tooltip = strdup_and_subst_obj(s, (void*)sg); - obj->explicit_tooltip = true; + obj->explicit_tooltip = TRUE; } else if (obj->label) { obj->tooltip = strdup(obj->label); @@ -2326,7 +2326,7 @@ void emit_clusters(GVJ_t * job, Agraph_t * g, int flags) } } -static bool is_style_delim(int c) +static boolean is_style_delim(int c) { switch (c) { case '(': @@ -2388,9 +2388,9 @@ static void cleanup(void) char **parse_style(char *s) { static char *parse[FUNLIMIT]; - static bool is_first = TRUE; + static boolean is_first = TRUE; int fun = 0; - bool in_parens = FALSE; + boolean in_parens = FALSE; unsigned char buf[SMALLBUF]; char *p; int c; diff --git a/lib/common/geom.c b/lib/common/geom.c index a76e02686..59dbb989f 100644 --- a/lib/common/geom.c +++ b/lib/common/geom.c @@ -204,22 +204,22 @@ boxf boxf_intersect(boxf b0, boxf b1) return b; } -bool box_overlap(box b0, box b1) +int box_overlap(box b0, box b1) { return OVERLAP(b0, b1); } -bool boxf_overlap(boxf b0, boxf b1) +int boxf_overlap(boxf b0, boxf b1) { return OVERLAP(b0, b1); } -bool box_contains(box b0, box b1) +int box_contains(box b0, box b1) { return CONTAINS(b0, b1); } -bool boxf_contains(boxf b0, boxf b1) +int boxf_contains(boxf b0, boxf b1) { return CONTAINS(b0, b1); } diff --git a/lib/common/geom.h b/lib/common/geom.h index b577d0a99..1b6b7d273 100644 --- a/lib/common/geom.h +++ b/lib/common/geom.h @@ -17,11 +17,13 @@ /* geometric types and macros (e.g. points and boxes) with application to, but * no specific dependance on graphs */ -#include "arith.h" - #ifndef GV_GEOM_H #define GV_GEOM_H +#ifdef HAVE_CONFIG_H +#include "arith.h" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -37,6 +39,7 @@ typedef struct { point LL, UR; } box; typedef struct { pointf LL, UR; } boxf; +#ifdef HAVE_CONFIG_H /* true if point p is inside box b */ #define INSIDE(p,b) (BETWEEN((b).LL.x,(p).x,(b).UR.x) && BETWEEN((b).LL.y,(p).y,(b).UR.y)) /* true if boxes b0 and b1 overlap */ @@ -62,6 +65,7 @@ typedef struct { pointf LL, UR; } boxf; #define PF2P(pf, p) (p.x = ROUND (pf.x), p.y = ROUND (pf.y)) #define B2BF(b, bf) (bf.LL.x = b.LL.x, bf.LL.y = b.LL.y, bf.UR.x = b.UR.x, bf.UR.y = b.UR.y) #define BF2B(bf, b) (b.LL.x = ROUND (bf.LL.x), b.LL.y = ROUND (bf.LL.y), b.UR.x = ROUND (bf.UR.x), b.UR.y = ROUND (bf.UR.y)) +#endif #ifdef __cplusplus } diff --git a/lib/common/geomprocs.h b/lib/common/geomprocs.h index f48a1872c..4903ecb29 100644 --- a/lib/common/geomprocs.h +++ b/lib/common/geomprocs.h @@ -51,11 +51,11 @@ extern boxf boxf_bb(boxf, boxf); extern box box_intersect(box, box); extern boxf boxf_intersect(boxf, boxf); -extern bool box_overlap(box, box); -extern bool boxf_overlap(boxf, boxf); +extern int box_overlap(box, box); +extern int boxf_overlap(boxf, boxf); -extern bool box_contains(box, box); -extern bool boxf_contains(boxf, boxf); +extern int box_contains(box, box); +extern int boxf_contains(boxf, boxf); extern box flip_rec_box(box b, point p); diff --git a/lib/common/globals.h b/lib/common/globals.h index e466ebd72..be887a4d8 100644 --- a/lib/common/globals.h +++ b/lib/common/globals.h @@ -65,7 +65,7 @@ extern "C" { #endif EXTERN unsigned char Verbose; - EXTERN bool Reduce, MemTest; + EXTERN boolean Reduce, MemTest; EXTERN char *HTTPServerEnVar; EXTERN char *Output_file_name; EXTERN int graphviz_errors; @@ -75,7 +75,7 @@ extern "C" { EXTERN int Show_cnt; EXTERN char** Show_boxes; /* emit code for correct box coordinates */ EXTERN int CL_type; /* NONE, LOCAL, GLOBAL */ - EXTERN bool Concentrate; /* if parallel edges should be merged */ + EXTERN boolean Concentrate; /* if parallel edges should be merged */ EXTERN double Epsilon; /* defined in input_graph */ EXTERN int MaxIter; EXTERN int Ndim;