]> granicus.if.org Git - graphviz/commitdiff
fully remove all CGRAPH conditionals from libgvc
authorJohn Ellson <ellson@research.att.com>
Wed, 16 Oct 2013 19:19:50 +0000 (15:19 -0400)
committerJohn Ellson <ellson@research.att.com>
Wed, 16 Oct 2013 19:19:50 +0000 (15:19 -0400)
lib/gvc/Makefile.am
lib/gvc/gvc.c
lib/gvc/gvevent.c
lib/gvc/gvlayout.c
lib/gvc/gvloadimage.c
lib/gvc/gvrender.c

index d5e3404e674b2b5a4d3ed9c05834222d20d0abdb..773c70ffd8b92f540d529415c5f2d5d95261a9ef 100644 (file)
@@ -3,12 +3,6 @@
 
 GVC_VERSION="6:0:0"
 
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
 pdfdir = $(pkgdatadir)/doc/pdf
 pkgconfigdir = $(libdir)/pkgconfig
 
@@ -16,7 +10,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir) \
        -I$(top_srcdir)/lib/common \
        -I$(top_srcdir)/lib/pathplan \
-       -I$(top_srcdir)/lib/$(GRAPH) \
+       -I$(top_srcdir)/lib/cgraph \
        -I$(top_srcdir)/lib/cdt \
        $(INCLTDL) -DGVLIBDIR=\"$(pkglibdir)\"
 
@@ -64,7 +58,7 @@ libgvc_la_SOURCES = $(libgvc_C_la_SOURCES)
 libgvc_la_LIBADD = $(libgvc_C_la_LIBADD) \
        $(top_builddir)/lib/xdot/libxdot.la \
        $(top_builddir)/lib/cdt/libcdt.la \
-       $(top_builddir)/lib/$(GRAPH)/lib$(GRAPH).la \
+       $(top_builddir)/lib/cgraph/libcgraph.la \
        $(top_builddir)/lib/pathplan/libpathplan.la \
        $(EXPAT_LIBS) $(Z_LIBS) $(MATH_LIBS)
 libgvc_la_DEPENDENCIES = $(libgvc_C_la_DEPENDENCIES)
index b362b07fc899ccf4d27c3a095763594f4e071933..fd241c7fe5c0789f5e2e67e6f5b055cb70961c44 100644 (file)
 #include "gvcproc.h"
 #include "gvconfig.h"
 #include "gvio.h"
-#ifdef WITH_CGRAPH
 #include <stdlib.h>
-#endif
 
 #ifdef WIN32 /*dependencies*/
-#ifdef WITH_CGRAPH
     #pragma comment( lib, "cgraph.lib" )
-#else
-    #pragma comment( lib, "graph.lib" )
-#endif
     #pragma comment( lib, "cdt.lib" )
     #pragma comment( lib, "ltdl.lib" )
     #pragma comment( lib, "xml2.lib" )
@@ -44,12 +38,7 @@ GVC_t *gvContext(void)
 {
     GVC_t *gvc;
 
-#ifndef WITH_CGRAPH
-    aginit();
-    agnodeattr(NULL, "label", NODENAME_ESC);
-#else
     agattr(NULL, AGNODE, "label", NODENAME_ESC);
-#endif
     /* default to no builtins, demand loading enabled */
     gvc = gvNEWcontext(NULL, TRUE);
     gvconfig(gvc, FALSE); /* configure for available plugins */
@@ -60,12 +49,7 @@ GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading)
 {
     GVC_t *gvc;
 
-#ifndef WITH_CGRAPH
-    aginit();
-    agnodeattr(NULL, "label", NODENAME_ESC);
-#else
     agattr(NULL, AGNODE, "label", NODENAME_ESC);
-#endif
     gvc = gvNEWcontext(builtins, demand_loading);
     gvconfig(gvc, FALSE); /* configure for available plugins */
     return gvc;
index b9e398135ff2367bbc7c92e6de58621f73103525..24c7e1bf806d6550263238d0348eb371450f1d85 100644 (file)
@@ -49,9 +49,6 @@ static char *s_key = "key";
 
 static void gv_graph_state(GVJ_t *job, graph_t *g)
 {
-#ifndef WITH_CGRAPH
-    int i;
-#endif
     int j;
     Agsym_t *a;
     gv_argvlist_t *list;
@@ -71,19 +68,10 @@ static void gv_graph_state(GVJ_t *job, graph_t *g)
     list->argc = j;
 
     list = &(job->selected_obj_attributes);
-#ifndef WITH_CGRAPH
-    for (i = 0, j = 0; i < dtsize(g->univ->globattr->dict); i++) {
-        a = g->univ->globattr->list[i];
-#else
     a = NULL;
     while ((a = agnxtattr(g, AGRAPH, a))) {
-#endif
         gv_argvlist_set_item(list, j++, a->name);
-#ifndef WITH_CGRAPH
-        gv_argvlist_set_item(list, j++, agxget(g, a->index));
-#else
         gv_argvlist_set_item(list, j++, agxget(g, a));
-#endif
         gv_argvlist_set_item(list, j++, (char*)GVATTR_STRING);
     }
     list->argc = j;
@@ -92,18 +80,11 @@ static void gv_graph_state(GVJ_t *job, graph_t *g)
     if (!a)
        a = agfindgraphattr(g, s_URL);
     if (a)
-#ifndef WITH_CGRAPH
-       job->selected_href = strdup_and_subst_obj(agxget(g, a->index), (void*)g);
-#else
        job->selected_href = strdup_and_subst_obj(agxget(g, a), (void*)g);
-#endif
 }
 
 static void gv_node_state(GVJ_t *job, node_t *n)
 {
-#ifndef WITH_CGRAPH
-    int i;
-#endif
     int j;
     Agsym_t *a;
     Agraph_t *g;
@@ -117,19 +98,10 @@ static void gv_node_state(GVJ_t *job, node_t *n)
 
     list = &(job->selected_obj_attributes);
     g = agroot(agraphof(n));
-#ifndef WITH_CGRAPH
-    for (i = 0, j = 0; i < dtsize(g->univ->nodeattr->dict); i++) {
-        a = g->univ->nodeattr->list[i];
-#else
     a = NULL;
     while ((a = agnxtattr(g, AGNODE, a))) {
-#endif
         gv_argvlist_set_item(list, j++, a->name);
-#ifndef WITH_CGRAPH
-        gv_argvlist_set_item(list, j++, agxget(n, a->index));
-#else
         gv_argvlist_set_item(list, j++, agxget(n, a));
-#endif
     }
     list->argc = j;
 
@@ -137,18 +109,11 @@ static void gv_node_state(GVJ_t *job, node_t *n)
     if (!a)
         a = agfindnodeattr(agraphof(n), s_URL);
     if (a)
-#ifndef WITH_CGRAPH
-       job->selected_href = strdup_and_subst_obj(agxget(n, a->index), (void*)n);
-#else
        job->selected_href = strdup_and_subst_obj(agxget(n, a), (void*)n);
-#endif
 }
 
 static void gv_edge_state(GVJ_t *job, edge_t *e)
 {
-#ifndef WITH_CGRAPH
-    int i;
-#endif
     int j;
     Agsym_t *a;
     Agraph_t *g;
@@ -171,48 +136,27 @@ static void gv_edge_state(GVJ_t *job, edge_t *e)
 
     alist = &(job->selected_obj_attributes);
     g = agroot(agraphof(aghead(e)));
-#ifndef WITH_CGRAPH
-    for (i = 0, j = 0; i < dtsize(g->univ->edgeattr->dict); i++) {
-        a = g->univ->edgeattr->list[i];
-#else
     a = NULL;
     while ((a = agnxtattr(g, AGEDGE, a))) {
-#endif
 
        /* tailport and headport can be shown as part of the name, but they
         * are not identifying properties of the edge so we 
         * also list them as modifyable attributes. */
         if (strcmp(a->name,s_tailport) == 0)
-#ifndef WITH_CGRAPH
-           gv_argvlist_set_item(nlist, 2, agxget(e, a->index));
-#else
            gv_argvlist_set_item(nlist, 2, agxget(e, a));
-#endif
        else if (strcmp(a->name,s_headport) == 0)
-#ifndef WITH_CGRAPH
-           gv_argvlist_set_item(nlist, 5, agxget(e, a->index));
-#else
            gv_argvlist_set_item(nlist, 5, agxget(e, a));
-#endif
 
        /* key is strictly an identifying property to distinguish multiple
         * edges between the same node pair.   Its non-writable, so
         * no need to list it as an attribute as well. */
        else if (strcmp(a->name,s_key) == 0) {
-#ifndef WITH_CGRAPH
-           gv_argvlist_set_item(nlist, 6, agxget(e, a->index));
-#else
            gv_argvlist_set_item(nlist, 6, agxget(e, a));
-#endif
            continue;
        }
 
         gv_argvlist_set_item(alist, j++, a->name);
-#ifndef WITH_CGRAPH
-        gv_argvlist_set_item(alist, j++, agxget(e, a->index));
-#else
         gv_argvlist_set_item(alist, j++, agxget(e, a));
-#endif
     }
     alist->argc = j;
 
@@ -220,11 +164,7 @@ static void gv_edge_state(GVJ_t *job, edge_t *e)
     if (!a)
        a = agfindedgeattr(agraphof(aghead(e)), s_URL);
     if (a)
-#ifndef WITH_CGRAPH
-       job->selected_href = strdup_and_subst_obj(agxget(e, a->index), (void*)e);
-#else
        job->selected_href = strdup_and_subst_obj(agxget(e, a), (void*)e);
-#endif
 }
 
 static void gvevent_refresh(GVJ_t * job)
@@ -288,11 +228,7 @@ static void gvevent_leave_obj(GVJ_t * job)
 
     if (obj) {
         switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
-        case AGGRAPH:
-#else /* WITH_CGRAPH */
         case AGRAPH:
-#endif /* WITH_CGRAPH */
            GD_gui_state((graph_t*)obj) &= ~GUI_STATE_ACTIVE;
            break;
         case AGNODE:
@@ -321,42 +257,26 @@ static void gvevent_enter_obj(GVJ_t * job)
     obj = job->current_obj;
     if (obj) {
         switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
-        case AGGRAPH:
-#else /* WITH_CGRAPH */
         case AGRAPH:
-#endif /* WITH_CGRAPH */
            g = (graph_t*)obj;
            GD_gui_state(g) |= GUI_STATE_ACTIVE;
            a = agfindgraphattr(g, s_tooltip);
            if (a)
-#ifndef WITH_CGRAPH
-               job->active_tooltip = strdup_and_subst_obj(agxget(g, a->index), obj);
-#else /* WITH_CGRAPH */
                job->active_tooltip = strdup_and_subst_obj(agxget(g, a), obj);
-#endif /* WITH_CGRAPH */
            break;
         case AGNODE:
            n = (node_t*)obj;
            ND_gui_state(n) |= GUI_STATE_ACTIVE;
            a = agfindnodeattr(agraphof(n), s_tooltip);
            if (a)
-#ifndef WITH_CGRAPH
-               job->active_tooltip = strdup_and_subst_obj(agxget(n, a->index), obj);
-#else /* WITH_CGRAPH */
                job->active_tooltip = strdup_and_subst_obj(agxget(n, a), obj);
-#endif /* WITH_CGRAPH */
            break;
         case AGEDGE:
            e = (edge_t*)obj;
            ED_gui_state(e) |= GUI_STATE_ACTIVE;
            a = agfindedgeattr(agraphof(aghead(e)), s_tooltip);
            if (a)
-#ifndef WITH_CGRAPH
-               job->active_tooltip = strdup_and_subst_obj(agxget(e, a->index), obj);
-#else /* WITH_CGRAPH */
                job->active_tooltip = strdup_and_subst_obj(agxget(e, a), obj);
-#endif /* WITH_CGRAPH */
            break;
         }
     }
@@ -414,11 +334,7 @@ static void gvevent_select_current_obj(GVJ_t * job)
     obj = job->selected_obj;
     if (obj) {
         switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
-        case AGGRAPH:
-#else /* WITH_CGRAPH */
         case AGRAPH:
-#endif /* WITH_CGRAPH */
            GD_gui_state((graph_t*)obj) |= GUI_STATE_VISITED;
            GD_gui_state((graph_t*)obj) &= ~GUI_STATE_SELECTED;
            break;
@@ -441,11 +357,7 @@ static void gvevent_select_current_obj(GVJ_t * job)
     obj = job->selected_obj = job->current_obj;
     if (obj) {
         switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
-        case AGGRAPH:
-#else /* WITH_CGRAPH */
         case AGRAPH:
-#endif /* WITH_CGRAPH */
            GD_gui_state((graph_t*)obj) |= GUI_STATE_SELECTED;
            gv_graph_state(job, (graph_t*)obj);
            break;
@@ -666,23 +578,14 @@ static void gvevent_read (GVJ_t * job, const char *filename, const char *layout)
 
     gvc = job->gvc;
     if (!filename) {
-#ifndef WITH_CGRAPH
-       g = agopen("G", AGDIGRAPH);
-#else /* WITH_CGRAPH */
        g = agopen("G", Agdirected, NIL(Agdisc_t *));
-#endif /* WITH_CGRAPH */
        job->output_filename = "new.gv";
     }
     else {
        f = fopen(filename, "r");
        if (!f)
           return;   /* FIXME - need some error handling */
-#ifndef WITH_CGRAPH
-       g = agread(f);
-#else /* WITH_CGRAPH */
        g = agread(f,NIL(Agdisc_t *));
-
-#endif /* WITH_CGRAPH */
        fclose(f);
     }
     if (!g)
@@ -696,11 +599,9 @@ static void gvevent_read (GVJ_t * job, const char *filename, const char *layout)
        agclose(gvc->g);
     }
 
-#ifdef WITH_CGRAPH
     aginit (g, AGRAPH, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
     aginit (g, AGNODE, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
     aginit (g, AGEDGE, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE);
-#endif
     gvc->g = g;
     GD_gvc(g) = gvc;
     gvLayout(gvc, g, layout);
index 70d71a2ce7f4ba279bf001e398d6bcd8174db20e..d0eaedeb437f2b94a999aff7f765ed664f4dc47b 100644 (file)
 #include "const.h"
 #include "gvplugin_layout.h"
 #include "gvcint.h"
-#if WITH_CGRAPH
 #include "cgraph.h"
-#else
-#include "graph.h"
-#endif
 #include "gvcproc.h"
 #include "gvc.h"
 
@@ -63,9 +59,7 @@ int gvLayoutJobs(GVC_t * gvc, Agraph_t * g)
     char *p;
     int rc;
 
-#ifdef WITH_CGRAPH
     agbindrec(g, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif
     GD_gvc(g) = gvc;
     if (g != agroot(g))
        GD_gvc(agroot(g)) = gvc;
@@ -106,11 +100,9 @@ int gvLayoutJobs(GVC_t * gvc, Agraph_t * g)
  */
 int gvFreeLayout(GVC_t * gvc, Agraph_t * g)
 {
-#ifdef WITH_CGRAPH
     /* skip if no Agraphinfo_t yet */
     if (! agbindrec(g, "Agraphinfo_t", 0, TRUE))
            return 0;
-#endif
 
     if (GD_cleanup(g)) {
        (GD_cleanup(g))(g);
@@ -119,10 +111,6 @@ int gvFreeLayout(GVC_t * gvc, Agraph_t * g)
     
     if (GD_drawing(g)) {
        graph_cleanup(g);
-#ifndef WITH_CGRAPH
-       GD_drawing(g) = NULL;
-       GD_drawing(g->root) = NULL;
-#endif
     }
     return 0;
 }
index 03ddd26eff462b6b8ff9b96aa598aec5e55d11a0..93706a8cffb503623ec2a4bb261f3554005c484c 100644 (file)
 #include "gvcproc.h"
 
 /* for agerr() */
-#if WITH_CGRAPH
 #include "cgraph.h"
-#else
-#include "graph.h"
-#endif
 
 static int gvloadimage_select(GVJ_t * job, char *str)
 {
index 1424a82fc32be9a802ffb81425b3c88712013256..c60465a98b12fa0d528dfbf4d644baa767c0b745 100644 (file)
 #include "macros.h"
 #include "colorprocs.h"
 #include "gvplugin_render.h"
-#if WITH_CGRAPH
 #include "cgraph.h"
-#else
-#include "graph.h"
-#endif
 #include "gvcint.h"
 #include "geom.h"
 #include "geomprocs.h"