From: ellson Date: Thu, 7 Aug 2008 17:17:47 +0000 (+0000) Subject: Removing all existing usage of USE_CGRAPH X-Git-Tag: LAST_LIBGRAPH~32^2~3655 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=baf27fbf9870d04d44f8353136bf4d944aa987ba;p=graphviz Removing all existing usage of USE_CGRAPH cgraph is now in full production in all these files configure.ac still contains the --with-cgraph option in case Arif wants to use it. --- diff --git a/cmd/tools/unflatten.c b/cmd/tools/unflatten.c index e9c76d5e0..0385d0662 100644 --- a/cmd/tools/unflatten.c +++ b/cmd/tools/unflatten.c @@ -27,15 +27,10 @@ #include #include #ifdef HAVE_UNISTD_H -#include +#include #endif -#ifdef USE_CGRAPH #include "cgraph.h" #define degreeOf(n,I,O) (agdegree(n->root, n, I, O)) -#else -#include "agraph.h" -#define degreeOf(n,I,O) (agdegree(n, I, O)) -#endif #include "ingraphs.h" #ifdef HAVE_GETOPT_H @@ -87,21 +82,13 @@ static void transform(Agraph_t * g) m_ix = bindedgeattr(g, "minlen"); s_ix = bindedgeattr(g, "style"); -#ifdef USE_CGRAPH for (n = agfstnode(g); n; n = agnxtnode(g, n)) { -#else - for (n = agfstnode(g); n; n = agnxtnode(n)) { -#endif d = degreeOf(n, TRUE, TRUE); if (d == 0) { if (ChainLimit < 1) continue; if (ChainNode) { -#ifdef USE_CGRAPH e = agedge(g, ChainNode, n, "", TRUE); -#else - e = agedge(ChainNode, n, "", TRUE); -#endif agxset(e, s_ix, "invis"); ChainSize++; if (ChainSize < ChainLimit) @@ -116,11 +103,7 @@ static void transform(Agraph_t * g) if (MaxMinlen < 1) continue; cnt = 0; -#ifdef USE_CGRAPH for (e = agfstin(g, n); e; e = agnxtin(g, e)) { -#else - for (e = agfstin(n); e; e = agnxtin(e)) { -#endif if (isleaf(agtail(e))) { str = agxget(e, m_ix); if (str[0] == 0) { @@ -131,11 +114,7 @@ static void transform(Agraph_t * g) } cnt = 0; -#ifdef USE_CGRAPH for (e = agfstout(g, n); e; e = agnxtout(g, e)) { -#else - for (e = agfstout(n); e; e = agnxtout(e)) { -#endif if (isleaf(e->node) || (Do_fans && ischainnode(e->node))) { str = agxget(e, m_ix); if (str[0] == 0) diff --git a/contrib/prune/Makefile.am b/contrib/prune/Makefile.am index eb828dfd7..63b191f12 100644 --- a/contrib/prune/Makefile.am +++ b/contrib/prune/Makefile.am @@ -3,7 +3,6 @@ pdfdir = $(pkgdatadir)/doc/pdf -AM_CFLAGS = -DUSE_CGRAPH AM_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/lib/ingraphs \ diff --git a/contrib/prune/prune.c b/contrib/prune/prune.c index 652ae863a..276afe7db 100644 --- a/contrib/prune/prune.c +++ b/contrib/prune/prune.c @@ -30,13 +30,8 @@ #include "compat_getopt.h" #endif -#ifdef USE_CGRAPH #include "cgraph.h" -#else -#include "agraph.h" -#endif #include "ingraphs.h" - #include "generic_list.h" /* structure to hold an attribute specified on the commandline */ @@ -176,7 +171,6 @@ int main(int argc, char **argv) } else { MARK(node); /* Avoid cycles */ /* Iterate over all outgoing edges */ -#ifdef USE_CGRAPH for (edge = agfstout(graph, node); edge; edge = nexte) { nexte = agnxtout(graph, edge); if (aghead(edge) != node) { /* non-loop edges */ @@ -187,18 +181,6 @@ int main(int argc, char **argv) agdelete(graph, edge); } } -#else - for (edge = agfstout(node); edge; edge = nexte) { - nexte = agnxtout(edge); - if (aghead(edge) != node) { /* non-loop edges */ - if (verbose == 1) - fprintf(stderr, "Processing descendant: %s\n", - agnameof(aghead(edge))); - remove_child(graph, aghead(edge)); - agdelete(graph, edge); - } - } -#endif UNMARK(node); /* Unmark so that it can be removed in later passes */ /* Change attribute (e.g. border style) to show that node has been pruneed */ @@ -236,19 +218,13 @@ void remove_child(Agraph_t * graph, Agnode_t * node) MARK(node); /* Skip nodes with more than one parent */ -#ifdef USE_CGRAPH edge = agfstin(graph, node); if (edge && (agnxtin(graph, edge) != NULL)) { -#else - edge = agfstin(node); - if (edge && (agnxtin(edge) != NULL)) { -#endif UNMARK(node); return; } /* recursively remove children */ -#ifdef USE_CGRAPH for (edge = agfstout(graph, node); edge; edge = nexte) { nexte = agnxtout(graph, edge); if (aghead(edge) != node) { @@ -261,20 +237,6 @@ void remove_child(Agraph_t * graph, Agnode_t * node) } agdelnode(graph, node); -#else - for (edge = agfstout(node); edge; edge = nexte) { - nexte = agnxtout(edge); - if (aghead(edge) != node) { - if (verbose) - fprintf(stderr, "Processing descendant: %s\n", - agnameof(aghead(edge))); - remove_child(graph, aghead(edge)); - agdeledge(edge); - } - } - - agdelnode(node); -#endif return; }