]> granicus.if.org Git - graphviz/commitdiff
Re-do some .h files to limit exposure of internal values, .h files,
authorerg <devnull@localhost>
Thu, 7 Dec 2006 22:49:35 +0000 (22:49 +0000)
committererg <devnull@localhost>
Thu, 7 Dec 2006 22:49:35 +0000 (22:49 +0000)
and dependencies on config.h; return to a simple, concrete boolean type

lib/common/arith.h
lib/common/arrows.c
lib/common/colorprocs.h
lib/common/diagen.c
lib/common/emit.c
lib/common/geom.c
lib/common/geom.h
lib/common/geomprocs.h
lib/common/globals.h

index d60160d6e03ecbf02ee02ed58b4b214460b868ab..d51866a1cf31c0c76eb5304a1b39737791c85c47 100644 (file)
@@ -33,8 +33,6 @@
 #endif
 #include <math.h>
 
-#include "logic.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
index 04c89a70a6dded4355fb68ed30f8e86310efaa74..6bb35d99a1a0931297975c1f82a782b99ea759ff 100644 (file)
@@ -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];
 }
index 468098daa04e27faee956335743d79d733bb256d..a70c63fa51cc582667d952e9c303d17a822a21de 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef GV_COLORPROCS_H
 #define GV_COLORPROCS_H
 
+#include <color.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
index 8efac87b8917fc1dfc2f50d30938a55737bdf8e7..65727cebf8c406a697cee600dc4f317a0a16fa9f 100644 (file)
@@ -974,7 +974,7 @@ static void dia_polyline(point * A, int n)
     dia_fputs("    </dia:object>\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;
 
index 5ed0027cf01af57c93ae4e846616e858059852c1..71fd16e6e680b9784f9871dbc441cb33524abb35 100644 (file)
@@ -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;
index a76e026862d4ea221e7bffbd3c7d64b2d5a1ad2a..59dbb989f5b225cd69143e9350984ad0d8486a3d 100644 (file)
@@ -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);
 }
index b577d0a99fe11eacd8ff2222b70d3bc65106ef52..1b6b7d27321febe803c62045fb385cc41ae35677 100644 (file)
 /* 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
 }
index f48a1872c219e53d6f13ce47707539faa5955b3e..4903ecb29e1d78bb9d0b27d8bc79101e54f0e01e 100644 (file)
@@ -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);
 
index e466ebd726602f06129548e2b1c80bc6f6b78496..be887a4d81cd663fd560fea0c001965d9d1c1a6f 100644 (file)
@@ -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;