]> granicus.if.org Git - graphviz/commitdiff
cgraph fixes
authorellson <devnull@localhost>
Tue, 21 Oct 2008 23:09:51 +0000 (23:09 +0000)
committerellson <devnull@localhost>
Tue, 21 Oct 2008 23:09:51 +0000 (23:09 +0000)
lib/common/Makefile.am
lib/fdpgen/fdpinit.c
lib/neatogen/neatoinit.c
lib/pack/Makefile.am
lib/patchwork/Makefile.am
lib/patchwork/patchwork.c

index 57e53e37df3037b8e09756d0ffc9e7578c1506f2..0f0487e10763d6c36870efc4a493b68ec2f65ba1 100644 (file)
@@ -3,17 +3,15 @@
 
 if WITH_CGRAPH
 GRAPH = cgraph
-FDPGEN = fdpgen_cgraph
 else
 GRAPH = graph
-FDPGEN = fdpgen
 endif
 
 AM_CPPFLAGS = \
         -I$(top_srcdir) \
        -I$(top_srcdir)/lib/gvc \
        -I$(top_srcdir)/lib/pack \
-       -I$(top_srcdir)/lib/$(FDPGEN) \
+       -I$(top_srcdir)/lib/fdpgen \
        -I$(top_srcdir)/lib/pathplan \
        -I$(top_srcdir)/lib/$(GRAPH) \
        -I$(top_srcdir)/lib/cdt $(GD_INCLUDES) $(EXPAT_INCLUDES) $(Z_INCLUDES)
index afb08cf7e1a753207d4c9828f2bfc96307bce3dd..dbd51b525fdb311fd47fce9b5f32189adb9022cd 100644 (file)
@@ -164,11 +164,11 @@ static void fdp_cleanup_graph(graph_t * g)
     cleanup_subgs(g);
     free(GD_neato_nlist(g));
     free(GD_alg(g));
+    if (g != agroot(g))
 #ifndef WITH_CGRAPH
-    if (g != g->root) memset(&(g->u), 0, sizeof(Agraphinfo_t));
+       memset(&(g->u), 0, sizeof(Agraphinfo_t));
 #else /* WITH_CGRAPH */
-    if (g != agroot(g))
-       agclean(g,AGRAPH , "Agraphinfo_t");                             
+       agclean(g, AGRAPH , "Agraphinfo_t");                            
 #endif /* WITH_CGRAPH */
 }
 
index b0db754b257ab7bae314e20bc36ed70d2ac04dbc..06adcc170377f3ba29b9afe3be2e257ce6d1a4ac 100644 (file)
@@ -152,7 +152,12 @@ static void neato_cleanup_graph(graph_t * g)
 {
     if (Nop || (Pack < 0))
        free_scan_graph(g);
-    if (g != g->root) memset(&(g->u), 0, sizeof(Agraphinfo_t));
+    if (g != agroot(g))
+#ifndef WITH_CGRAPH
+        memset(&(g->u), 0, sizeof(Agraphinfo_t));
+#else /* WITH_CGRAPH */
+        agclean(g, AGRAPH , "Agraphinfo_t");
+#endif /* WITH_CGRAPH */
 }
 
 void neato_cleanup(graph_t * g)
index 1ebdc7a05bcc6139d43139b6faec68b04f1ef09a..caa7c772e7c96676bab7e1a82e949e3465334c4a 100644 (file)
@@ -6,16 +6,14 @@ pdfdir = $(pkgdatadir)/doc/pdf
 
 if WITH_CGRAPH
 GRAPH = cgraph
-NEATOGEN = neatogen_cgraph
 else
 GRAPH = graph
-NEATOGEN = neatogen
 endif
 
 AM_CPPFLAGS = -I$(top_srcdir) \
         -I$(top_srcdir)/lib/common \
        -I$(top_srcdir)/lib/gvc \
-       -I$(top_srcdir)/lib/$(NEATOGEN) \
+       -I$(top_srcdir)/lib/neatogen \
        -I$(top_srcdir)/lib/pathplan \
        -I$(top_srcdir)/lib/$(GRAPH) \
        -I$(top_srcdir)/lib/cdt
index e415cdd02d26b24ae87e5e525b08c5469e8c70ce..0f7b7338db446aea51bc75f0997abd3f7c5ebb2f 100644 (file)
@@ -3,30 +3,23 @@
 
 if WITH_CGRAPH
 GRAPH = cgraph
-NEATOGEN = neatogen_cgraph
-FDPGEN = fdpgen_cgraph
 else
 GRAPH = graph
-NEATOGEN = neatogen
-FDPGEN = fdpgen
 endif
 
 AM_CPPFLAGS = \
         -I$(top_srcdir) \
         -I$(top_srcdir)/lib/common \
        -I$(top_srcdir)/lib/gvc \
-       -I$(top_srcdir)/lib/$(NEATOGEN) \
-       -I$(top_srcdir)/lib/$(FDPGEN) \
+       -I$(top_srcdir)/lib/neatogen \
+       -I$(top_srcdir)/lib/fdpgen \
        -I$(top_srcdir)/lib/pack \
        -I$(top_srcdir)/lib/pathplan \
        -I$(top_srcdir)/lib/$(GRAPH) \
        -I$(top_srcdir)/lib/cdt
 
-if WITH_CGRAPH
-else
 noinst_HEADERS = patchwork.h
 noinst_LTLIBRARIES = libpatchwork_C.la
-endif
 
 libpatchwork_C_la_SOURCES = patchwork.c patchworkinit.c
 
index 03e087811cc42ebc7e6f12f1c93ad59d920da570..73644909e8599c00314e87a8ea7b426f275cfa1d 100644 (file)
@@ -42,7 +42,11 @@ static treenode_t *treebuilder(Agraph_t *g)
                subg = GD_clust(g)[i];
                if (agnnodes(subg) == 0) continue;
                p = newtreenode(&first,&prev);
+#ifndef WITH_CGRAPH
                p->kind = AGGRAPH;
+#else
+               p->kind = AGRAPH;
+#endif
                p->u.subg = subg;
                p->leftchild = treebuilder(subg);
        }
@@ -161,41 +165,44 @@ static void finishNode (node_t* n)
 
 static rect_t walker(treenode_t *tree)
 {
-       treenode_t      *p;
-       Agnode_t        *n;
-       pointf          center;
+    treenode_t *p;
+    Agnode_t   *n;
+    pointf             center;
     rect_t      r, rr;
 
-       switch(tree->kind) {
-               case AGGRAPH:
-               case AGRAPH:
-                       break;
-               case AGNODE:
-                       rr = tree->r;
-                       center.x = (tree->r.UR.x + tree->r.LL.x) / 2.0;
-                       center.y = (tree->r.UR.y + tree->r.LL.y) / 2.0;
-
-                       n = tree->u.n;
-                       ND_coord(n) = center;
-                       ND_height(n) = PS2INCH(tree->r.UR.y - tree->r.LL.y);
-                       ND_width(n) = PS2INCH(tree->r.UR.x - tree->r.LL.x);
-                       gv_nodesize(n,GD_flip(n->graph));
-                       finishNode (n);
-                       /*fprintf(stderr,"%s coord %.5g %.5g ht %d width %d\n",
-                               n->name, ND_coord(n).x, ND_coord(n).y, ND_ht(n),
-                               ND_rw(n)+ND_lw(n));*/
-                       break;
-               default: abort();
-       }
-       if ((p = tree->leftchild)) {
-               rr = walker (p);
-               p = p->rightsib;
-               for (; p; p = p->rightsib) {
-                       r = walker(p);
-                       EXPANDBB(rr,r);
-               }
-               GD_bb(tree->u.subg) = rr;
+    switch(tree->kind) {
+#ifndef WITH_CGRAPH
+       case AGGRAPH:
+#else
+       case AGRAPH:
+#endif
+           break;
+       case AGNODE:
+           rr = tree->r;
+           center.x = (tree->r.UR.x + tree->r.LL.x) / 2.0;
+           center.y = (tree->r.UR.y + tree->r.LL.y) / 2.0;
+
+           n = tree->u.n;
+           ND_coord(n) = center;
+           ND_height(n) = PS2INCH(tree->r.UR.y - tree->r.LL.y);
+           ND_width(n) = PS2INCH(tree->r.UR.x - tree->r.LL.x);
+           gv_nodesize(n,GD_flip(agraphof(n)));
+           finishNode (n);
+           /*fprintf(stderr,"%s coord %.5g %.5g ht %d width %d\n",
+                   agnameof(n), ND_coord(n).x, ND_coord(n).y, ND_ht(n),
+                   ND_rw(n)+ND_lw(n));*/
+           break;
+       default: abort();
+    }
+    if ((p = tree->leftchild)) {
+       rr = walker (p);
+       p = p->rightsib;
+       for (; p; p = p->rightsib) {
+           r = walker(p);
+           EXPANDBB(rr,r);
        }
+       GD_bb(tree->u.subg) = rr;
+    }
     return rr;
 }