From: ellson Date: Tue, 21 Oct 2008 16:28:45 +0000 (+0000) Subject: some cgraph fixes X-Git-Tag: LAST_LIBGRAPH~32^2~3059 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f8f5547dffd1e4328dff39ad9452f578e022dc6;p=graphviz some cgraph fixes --- diff --git a/lib/common/emit.c b/lib/common/emit.c index e74642605..13a85343f 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -1031,7 +1031,7 @@ static boolean clust_in_layer(GVJ_t *job, graph_t * sg) #ifndef WITH_CGRAPH pg = late_string(sg, agfindattr(sg, "layer"), ""); #else - pg = late_string(sg, agfindattr(sg, "layer"), ""); + pg = late_string(sg, agattr(sg, AGRAPH, "layer", 0), ""); #endif if (selectedlayer(job, pg)) return TRUE; @@ -2346,7 +2346,11 @@ fprintf(stderr,"focus=%g,%g view=%g,%g\n", job->focus.x, job->focus.y, job->view.x, job->view.y); #endif +#ifndef WITH_CGRAPH s = late_string(g, agfindattr(g, "comment"), ""); +#else + s = late_string(g, agattr(g, AGRAPH, "comment", 0), ""); +#endif gvrender_comment(job, s); emit_begin_graph(job, g); diff --git a/lib/common/output.c b/lib/common/output.c index 83d449210..a576de9d0 100644 --- a/lib/common/output.c +++ b/lib/common/output.c @@ -122,20 +122,22 @@ void write_plain(GVJ_t * job, graph_t * g, FILE * f, boolean extend) for (n = agfstnode(g); n; n = agnxtnode(g, n)) { for (e = agfstout(g, n); e; e = agnxtout(g, e)) { +#ifndef WITH_CGRAPH /* FIXME - there must be a proper way to get port info - these are * supposed to be private to libgraph - from libgraph.h */ #define TAILX 1 #define HEADX 2 -#ifndef WITH_CGRAPH if (extend && e->attr) { tport = e->attr[TAILX]; hport = e->attr[HEADX]; } #else /* WITH_CGRAPH */ if (extend) { //assuming these two attrs have already been created by cgraph - tport = agget(e,TAILX); - hport = agget(e,HEADX); + if (!(tport = agget(e,"tailport"))) + tport = ""; + if (!(hport = agget(e,"headport"))) + hport = ""; } #endif /* WITH_CGRAPH */ else