int s0, e0;
/* pick up arrowhead of opposing edge */
#ifdef WITH_CGRAPH
- f = agedge(agraphof(e), aghead(e), agtail(e), (char *)NULL, FALSE);
+ f = agedge(agraphof(aghead(e)), aghead(e), agtail(e), (char *)NULL, FALSE);
#else
- f = agfindedge(e->tail->graph, e->head, e->tail);
+ f = agfindedge(agraphof(aghead(e)), aghead(e), agtail(e));
#endif
arrow_flags(f, &s0, &e0);
*eflag = *eflag | s0;
|| (strcmp(shape_t, "circle") == 0)
|| (strcmp(shape_t, "doublecircle") == 0)) {
cp_h = diaptf(ND_coord(head));
-#ifdef WITH_CGRAPH
if (agisdirected(Rootgraph))
-#else
- if (AG_IS_DIRECTED(Rootgraph))
-#endif
conn_h = ellipse_connection(cp_h, diapt(A[n - 1]));
else
conn_h = ellipse_connection(cp_h, diapt(A[0]));
} else if (strcmp(shape_t, "record") == 0) {
} else {
-#ifdef WITH_CGRAPH
if (agisdirected(Rootgraph))
-#else
- if (AG_IS_DIRECTED(Rootgraph))
-#endif
conn_h = box_connection(head, diapt(A[n - 1]));
else
conn_h = box_connection(head, diapt(A[0]));
|| (strcmp(shape_t, "circle") == 0)
|| (strcmp(shape_t, "doublecircle") == 0)) {
cp_t = diaptf(ND_coord(tail));
-#ifdef WITH_CGRAPH
if (agisdirected(Rootgraph))
-#else
- if (AG_IS_DIRECTED(Rootgraph))
-#endif
conn_t = ellipse_connection(cp_t, diapt(A[0]));
else
conn_t = ellipse_connection(cp_t, diapt(A[n - 1]));
} else if (strcmp(shape_t, "record") == 0) {
} else {
-#ifdef WITH_CGRAPH
if (agisdirected(Rootgraph))
-#else
- if (AG_IS_DIRECTED(Rootgraph))
-#endif
conn_t = box_connection(tail, diapt(A[0]));
else
conn_t = box_connection(tail, diapt(A[n - 1]));
s = malloc(strlen(e->tail->name) + 2 + strlen(e->head->name) + 1);
strcpy(s,e->tail->name);
-#ifdef WITH_CGRAPH
- if (agisdirected(agraphof(e)))
-#else
- if (AG_IS_DIRECTED(e->tail->graph))
-#endif
+ if (agisdirected(agraphof(aghead(e))))
strcat(s,"->");
else
ED_minlen(e) = y;
/* ED_minlen(e) = cp->data.box.UR.y; */
#ifdef DEBUG
- fprintf(stderr, "row edge %s -> %s %d\n", t->name, h->name,
+ fprintf(stderr, "row edge %s -> %s %d\n", agnameof(t), agnameof(h),
ED_minlen(e));
#endif
elist_append(e, ND_out(t));
static char *nameOf(void *obj, agxbuf * xb)
{
Agedge_t *ep;
-#ifdef WITH_CGRAPH
switch (agobjkind(obj)) {
case AGRAPH:
agxbput(xb, agnameof(((Agraph_t *) obj)));
ep = (Agedge_t *) obj;
agxbput(xb, agnameof(agtail(ep)));
agxbput(xb, agnameof(aghead(ep)));
- if (agisdirected(agraphof(ep)))
+ if (agisdirected(agraphof(aghead(ep))))
agxbput(xb, "->");
else
agxbput(xb, "--");
break;
}
-#else
- switch (agobjkind(obj)) {
- case AGGRAPH:
- agxbput(xb, ((Agraph_t *) obj)->name);
- break;
- case AGNODE:
- agxbput(xb, ((Agnode_t *) obj)->name);
- break;
- case AGEDGE:
- ep = (Agedge_t *) obj;
- agxbput(xb, ep->tail->name);
- agxbput(xb, ep->head->name);
- if (AG_IS_DIRECTED(ep->tail->graph))
- agxbput(xb, "->");
- else
- agxbput(xb, "--");
- break;
- }
-#endif
return agxbuse(xb);
}
char *s;
env.obj = obj;
-#ifdef WITH_CGRAPH
switch (agobjkind(obj)) {
+#ifdef WITH_CGRAPH
case AGRAPH:
+#else
+ case AGGRAPH:
+#endif
env.g = ((Agraph_t *) obj)->root;
break;
case AGNODE:
env.g = agraphof(aghead (((Agedge_t *) obj)));
break;
}
-#else
- switch (agobjkind(obj)) {
- case AGGRAPH:
- env.g = ((Agraph_t *) obj)->root;
- break;
- case AGNODE:
- env.g = ((Agnode_t *) obj)->graph;
- break;
- case AGEDGE:
- env.g = ((Agedge_t *) obj)->head->graph;
- break;
- }
-#endif
g = env.g->root;
env.finfo.size = lp->fontsize;
Verbose = gvc->common.verbose;
CmdName = gvc->common.cmdname;
-#ifdef WITH_CGRAPH
-#else
+#ifndef WITH_CGRAPH
aginit();
#endif
nfiles = 0;
}
/* set persistent attributes here (if not already set from command line options) */
-#ifdef WITH_CGRAPH
-#else
+#ifndef WITH_CGRAPH
if (!(agfindattr(agprotograph()->proto->n, "label")))
agnodeattr(NULL, "label", NODENAME_ESC);
#endif
/* set label position */
pos = agget(sg, "labelloc");
-#ifdef WITH_CGRAPH
if (sg != agroot(sg)) {
-#else
- if (sg != sg->root) {
-#endif
if (pos && (pos[0] == 'b'))
pos_flag = LABEL_AT_BOTTOM;
else
}
GD_label_pos(sg) = pos_flag;
-#ifdef WITH_CGRAPH
if (sg == agroot(sg))
-#else
- if (sg == sg->root)
-#endif
return;
/* Set border information for cluster labels to allow space
*/
dimen = GD_label(sg)->dimen;
PAD(dimen);
-#ifdef WITH_CGRAPH
if (!GD_flip(agroot(sg))) {
-#else
- if (!GD_flip(sg->root)) {
-#endif
if (GD_label_pos(sg) & LABEL_AT_TOP)
pos_ix = TOP_IX;
else
#define SET_RANKDIR(g,rd) (GD_rankdir2(g) = rd)
#else
#define SET_RANKDIR(g,rd) ((g)->u.rankdir = (rd))
+#define agnameof(x) ((x)->name)
+/* warning, agraphof doesn't work for edges */
+#define agraphof(n) ((n)->graph)
+#define agroot(g) ((g)->root)
+#define aghead(e) ((e)->head)
+#define agtail(e) ((e)->tail)
+#define agisdirected(g) ((g)->kind & AGFLAG_DIRECTED)
#endif
#ifndef streq