]> granicus.if.org Git - graphviz/commitdiff
more cgraph ifdefs
authorellson <devnull@localhost>
Wed, 15 Oct 2008 02:55:40 +0000 (02:55 +0000)
committerellson <devnull@localhost>
Wed, 15 Oct 2008 02:55:40 +0000 (02:55 +0000)
lib/common/labels.c
lib/common/ns.c
lib/common/postproc.c
lib/common/psusershape.c
lib/common/routespl.c
lib/common/splines.c
lib/common/types.h

index c0beaa38c10763ba805d8656a9a88bcb91efdbab..a7ab43530fec32209a1f2c1a63dfb0cb7c31d7cf 100644 (file)
@@ -117,17 +117,29 @@ textlabel_t *make_label(void *obj, char *str, int kind, double fontsize, char *f
         char *s;
 
     switch (agobjkind(obj)) {
+#ifndef WITH_CGRAPH
     case AGGRAPH:
+#else
+    case AGRAPH:
+#endif
         sg = (graph_t*)obj;
        g = sg->root;
        break;
     case AGNODE:
         n = (node_t*)obj;
+#ifndef WITH_CGRAPH
        g = n->graph->root;
+#else
+       g = agroot(agraphof(n));
+#endif
        break;
     case AGEDGE:
         e = (edge_t*)obj;
+#ifndef WITH_CGRAPH
        g = e->head->graph->root;
+#else
+       g = agroot(agraphof(aghead(e)));
+#endif
        break;
     }
     rv->fontname = fontname;
@@ -145,19 +157,28 @@ textlabel_t *make_label(void *obj, char *str, int kind, double fontsize, char *f
        rv->html = TRUE;
        if (make_html_label(obj, rv)) {
            switch (agobjkind(obj)) {
+#ifndef WITH_CGRAPH
            case AGGRAPH:
                agerr(AGPREV, "in label of graph %s\n",sg->name);
+#else
+           case AGRAPH:
+               agerr(AGPREV, "in label of graph %s\n",agnameof(sg));
+#endif
                break;
            case AGNODE:
+#ifndef WITH_CGRAPH
                agerr(AGPREV, "in label of node %s\n", n->name);
+#else
+               agerr(AGPREV, "in label of node %s\n", agnameof(n));
+#endif
                break;
            case AGEDGE:
-#ifdef WITH_CGRAPH
+#ifndef WITH_CGRAPH
                agerr(AGPREV, "in label of edge %s %s %s\n",
                        e->tail->name, agisdirected(g)?"->":"--", e->head->name);
 #else
                agerr(AGPREV, "in label of edge %s %s %s\n",
-                       e->tail->name, AG_IS_DIRECTED(g)?"->":"--", e->head->name);
+                       agnameof(agtail(e)), AG_IS_DIRECTED(g)?"->":"--", agnameof(aghead(e)));
 #endif
                break;
            }
@@ -279,8 +300,13 @@ char *strdup_and_subst_obj(char *str, void *obj)
 
     /* prepare substitution strings */
     switch (agobjkind(obj)) {
+#ifndef WITH_CGRAPH
        case AGGRAPH:
            g_str = ((graph_t *)obj)->name;
+#else
+       case AGRAPH:
+           g_str = agnameof((graph_t *)obj);
+#endif
            g_len = strlen(g_str);
            tl = GD_label((graph_t *)obj);
            if (tl) {
@@ -289,9 +315,15 @@ char *strdup_and_subst_obj(char *str, void *obj)
            }
            break;
        case AGNODE:
+#ifndef WITH_CGRAPH
            g_str = ((node_t *)obj)->graph->name;
            g_len = strlen(g_str);
            n_str = ((node_t *)obj)->name;
+#else
+           g_str = agnameof(agraphof((node_t *)obj));
+           g_len = strlen(g_str);
+           n_str = agnameof((node_t *)obj);
+#endif
            n_len = strlen(n_str);
            tl = ND_label((node_t *)obj);
            if (tl) {
@@ -300,6 +332,7 @@ char *strdup_and_subst_obj(char *str, void *obj)
            }
            break;
        case AGEDGE:
+#ifndef WITH_CGRAPH
            g_str = ((edge_t *)obj)->tail->graph->root->name;
            g_len = strlen(g_str);
            t_str = ((edge_t *)obj)->tail->name;
@@ -308,6 +341,16 @@ char *strdup_and_subst_obj(char *str, void *obj)
            if ((tp_str = pt.name))
                tp_len = strlen(tp_str);
            h_str = ((edge_t *)obj)->head->name;
+#else
+           g_str = agnameof(agroot(agraphof(agtail(((edge_t *)obj)))));
+           g_len = strlen(g_str);
+           t_str = agnameof(agtail(((edge_t *)obj)));
+           t_len = strlen(t_str);
+           pt = ED_tail_port((edge_t *)obj);
+           if ((tp_str = pt.name))
+               tp_len = strlen(tp_str);
+           h_str = agnameof(aghead(((edge_t *)obj)));
+#endif
            h_len = strlen(h_str);
            pt = ED_head_port((edge_t *)obj);
            if ((hp_str = pt.name))
@@ -318,7 +361,11 @@ char *strdup_and_subst_obj(char *str, void *obj)
                l_str = tl->text;
                if (str) l_len = strlen(l_str);
            }
+#ifndef WITH_CGRAPH
            if (((edge_t *)obj)->tail->graph->root->kind & AGFLAG_DIRECTED)
+#else
+           if (agisdirected(agroot(agraphof(agtail(((edge_t*)obj))))))
+#endif
                e_str = "->";
            else
                e_str = "--";
index 39098295464fe0b3b6e566ee071f648beebe7def..52556b69f3e127386c28e76d35ef077c22d2443b 100644 (file)
@@ -29,7 +29,11 @@ static int x_val(edge_t * e, node_t * v, int dir);
 static void check_cycles(graph_t * g);
 #endif
 
+#ifndef WITH_CGRAPH
 #define LENGTH(e)              (ND_rank(e->head) - ND_rank(e->tail))
+#else /* WITH_CGRAPH */
+#define LENGTH(e)              (ND_rank(aghead(e)) - ND_rank(agtail(e)))
+#endif /* WITH_CGRAPH */
 #define SLACK(e)               (LENGTH(e) - ED_minlen(e))
 #define SEQ(a,b,c)             (((a) <= (b)) && ((b) <= (c)))
 #define TREE_EDGE(e)   (ED_tree_index(e) >= 0)
@@ -50,17 +54,29 @@ static void add_tree_edge(edge_t * e)
        abort();
     ED_tree_index(e) = Tree_edge.size;
     Tree_edge.list[Tree_edge.size++] = e;
+#ifndef WITH_CGRAPH
     if (ND_mark(e->tail) == FALSE)
        Tree_node.list[Tree_node.size++] = e->tail;
     if (ND_mark(e->head) == FALSE)
        Tree_node.list[Tree_node.size++] = e->head;
     n = e->tail;
+#else /* WITH_CGRAPH */
+    if (ND_mark(agtail(e)) == FALSE)
+       Tree_node.list[Tree_node.size++] = agtail(e);
+    if (ND_mark(aghead(e)) == FALSE)
+       Tree_node.list[Tree_node.size++] = aghead(e);
+    n = agtail(e);
+#endif /* WITH_CGRAPH */
     ND_mark(n) = TRUE;
     ND_tree_out(n).list[ND_tree_out(n).size++] = e;
     ND_tree_out(n).list[ND_tree_out(n).size] = NULL;
     if (ND_out(n).list[ND_tree_out(n).size - 1] == 0)
        abort();
+#ifndef WITH_CGRAPH
     n = e->head;
+#else /* WITH_CGRAPH */
+    n = aghead(e);
+#endif /* WITH_CGRAPH */
     ND_mark(n) = TRUE;
     ND_tree_in(n).list[ND_tree_in(n).size++] = e;
     ND_tree_in(n).list[ND_tree_in(n).size] = NULL;
@@ -77,14 +93,22 @@ static void exchange_tree_edges(edge_t * e, edge_t * f)
     Tree_edge.list[ED_tree_index(e)] = f;
     ED_tree_index(e) = -1;
 
+#ifndef WITH_CGRAPH
     n = e->tail;
+#else /* WITH_CGRAPH */
+    n = agtail(e);
+#endif /* WITH_CGRAPH */
     i = --(ND_tree_out(n).size);
     for (j = 0; j <= i; j++)
        if (ND_tree_out(n).list[j] == e)
            break;
     ND_tree_out(n).list[j] = ND_tree_out(n).list[i];
     ND_tree_out(n).list[i] = NULL;
+#ifndef WITH_CGRAPH
     n = e->head;
+#else /* WITH_CGRAPH */
+    n = aghead(e);
+#endif /* WITH_CGRAPH */
     i = --(ND_tree_in(n).size);
     for (j = 0; j <= i; j++)
        if (ND_tree_in(n).list[j] == e)
@@ -92,10 +116,18 @@ static void exchange_tree_edges(edge_t * e, edge_t * f)
     ND_tree_in(n).list[j] = ND_tree_in(n).list[i];
     ND_tree_in(n).list[i] = NULL;
 
+#ifndef WITH_CGRAPH
     n = f->tail;
+#else /* WITH_CGRAPH */
+    n = agtail(f);
+#endif /* WITH_CGRAPH */
     ND_tree_out(n).list[ND_tree_out(n).size++] = f;
     ND_tree_out(n).list[ND_tree_out(n).size] = NULL;
+#ifndef WITH_CGRAPH
     n = f->head;
+#else /* WITH_CGRAPH */
+    n = aghead(f);
+#endif /* WITH_CGRAPH */
     ND_tree_in(n).list[ND_tree_in(n).size++] = f;
     ND_tree_in(n).list[ND_tree_in(n).size] = NULL;
 }
@@ -120,29 +152,53 @@ void init_rank(void)
        ND_rank(v) = 0;
        ctr++;
        for (i = 0; (e = ND_in(v).list[i]); i++)
+#ifndef WITH_CGRAPH
            ND_rank(v) = MAX(ND_rank(v), ND_rank(e->tail) + ED_minlen(e));
+#else /* WITH_CGRAPH */
+           ND_rank(v) = MAX(ND_rank(v), ND_rank(agtail(e)) + ED_minlen(e));
+#endif /* WITH_CGRAPH */
        for (i = 0; (e = ND_out(v).list[i]); i++) {
+#ifndef WITH_CGRAPH
            if (--(ND_priority(e->head)) <= 0)
                enqueue(Q, e->head);
+#else /* WITH_CGRAPH */
+           if (--(ND_priority(aghead(e))) <= 0)
+               enqueue(Q, aghead(e));
+#endif /* WITH_CGRAPH */
        }
     }
     if (ctr != N_nodes) {
        agerr(AGERR, "trouble in init_rank\n");
        for (v = GD_nlist(G); v; v = ND_next(v))
            if (ND_priority(v))
+#ifndef WITH_CGRAPH
                agerr(AGPREV, "\t%s %d\n", v->name, ND_priority(v));
+#else /* WITH_CGRAPH */
+               agerr(AGPREV, "\t%s %d\n", agnameof(v), ND_priority(v));
+#endif /* WITH_CGRAPH */
     }
     free_queue(Q);
 }
 
 static node_t *incident(edge_t * e)
 {
+#ifndef WITH_CGRAPH
     if (ND_mark(e->tail)) {
        if (ND_mark(e->head) == FALSE)
            return e->tail;
+#else /* WITH_CGRAPH */
+    if (ND_mark(agtail(e))) {
+       if (ND_mark(aghead(e)) == FALSE)
+           return agtail(e);
+#endif /* WITH_CGRAPH */
     } else {
+#ifndef WITH_CGRAPH
        if (ND_mark(e->head))
            return e->head;
+#else /* WITH_CGRAPH */
+       if (ND_mark(aghead(e)))
+           return aghead(e);
+#endif /* WITH_CGRAPH */
     }
     return NULL;
 }
@@ -154,7 +210,11 @@ static edge_t *leave_edge(void)
 
     j = S_i;
     while (S_i < Tree_edge.size) {
+#ifndef WITH_CGRAPH
        if ((f = Tree_edge.list[S_i])->u.cutvalue < 0) {
+#else /* WITH_CGRAPH */
+       if (ED_cutvalue(f = Tree_edge.list[S_i]) < 0) {
+#endif /* WITH_CGRAPH */
            if (rv) {
                if (ED_cutvalue(rv) > ED_cutvalue(f))
                    rv = f;
@@ -168,7 +228,11 @@ static edge_t *leave_edge(void)
     if (j > 0) {
        S_i = 0;
        while (S_i < j) {
+#ifndef WITH_CGRAPH
            if ((f = Tree_edge.list[S_i])->u.cutvalue < 0) {
+#else /* WITH_CGRAPH */
+           if (ED_cutvalue(f = Tree_edge.list[S_i]) < 0) {
+#endif /* WITH_CGRAPH */
                if (rv) {
                    if (ED_cutvalue(rv) > ED_cutvalue(f))
                        rv = f;
@@ -193,19 +257,33 @@ static void dfs_enter_outedge(node_t * v)
 
     for (i = 0; (e = ND_out(v).list[i]); i++) {
        if (TREE_EDGE(e) == FALSE) {
+#ifndef WITH_CGRAPH
            if (!SEQ(Low, ND_lim(e->head), Lim)) {
+#else /* WITH_CGRAPH */
+           if (!SEQ(Low, ND_lim(aghead(e)), Lim)) {
+#endif /* WITH_CGRAPH */
                slack = SLACK(e);
                if ((slack < Slack) || (Enter == NULL)) {
                    Enter = e;
                    Slack = slack;
                }
            }
+#ifndef WITH_CGRAPH
        } else if (ND_lim(e->head) < ND_lim(v))
            dfs_enter_outedge(e->head);
+#else /* WITH_CGRAPH */
+       } else if (ND_lim(aghead(e)) < ND_lim(v))
+           dfs_enter_outedge(aghead(e));
+#endif /* WITH_CGRAPH */
     }
     for (i = 0; (e = ND_tree_in(v).list[i]) && (Slack > 0); i++)
+#ifndef WITH_CGRAPH
        if (ND_lim(e->tail) < ND_lim(v))
            dfs_enter_outedge(e->tail);
+#else /* WITH_CGRAPH */
+       if (ND_lim(agtail(e)) < ND_lim(v))
+           dfs_enter_outedge(agtail(e));
+#endif /* WITH_CGRAPH */
 }
 
 static void dfs_enter_inedge(node_t * v)
@@ -215,19 +293,33 @@ static void dfs_enter_inedge(node_t * v)
 
     for (i = 0; (e = ND_in(v).list[i]); i++) {
        if (TREE_EDGE(e) == FALSE) {
+#ifndef WITH_CGRAPH
            if (!SEQ(Low, ND_lim(e->tail), Lim)) {
+#else /* WITH_CGRAPH */
+           if (!SEQ(Low, ND_lim(agtail(e)), Lim)) {
+#endif /* WITH_CGRAPH */
                slack = SLACK(e);
                if ((slack < Slack) || (Enter == NULL)) {
                    Enter = e;
                    Slack = slack;
                }
            }
+#ifndef WITH_CGRAPH
        } else if (ND_lim(e->tail) < ND_lim(v))
            dfs_enter_inedge(e->tail);
+#else /* WITH_CGRAPH */
+       } else if (ND_lim(agtail(e)) < ND_lim(v))
+           dfs_enter_inedge(agtail(e));
+#endif /* WITH_CGRAPH */
     }
     for (i = 0; (e = ND_tree_out(v).list[i]) && (Slack > 0); i++)
+#ifndef WITH_CGRAPH
        if (ND_lim(e->head) < ND_lim(v))
            dfs_enter_inedge(e->head);
+#else /* WITH_CGRAPH */
+       if (ND_lim(aghead(e)) < ND_lim(v))
+           dfs_enter_inedge(aghead(e));
+#endif /* WITH_CGRAPH */
 }
 
 static edge_t *enter_edge(edge_t * e)
@@ -236,11 +328,20 @@ static edge_t *enter_edge(edge_t * e)
     int outsearch;
 
     /* v is the down node */
+#ifndef WITH_CGRAPH
     if (ND_lim(e->tail) < ND_lim(e->head)) {
        v = e->tail;
+#else /* WITH_CGRAPH */
+    if (ND_lim(agtail(e)) < ND_lim(aghead(e))) {
+       v = agtail(e);
+#endif /* WITH_CGRAPH */
        outsearch = FALSE;
     } else {
+#ifndef WITH_CGRAPH
        v = e->head;
+#else /* WITH_CGRAPH */
+       v = aghead(e);
+#endif /* WITH_CGRAPH */
        outsearch = TRUE;
     }
     Enter = NULL;
@@ -260,16 +361,32 @@ static int treesearch(node_t * v)
     edge_t *e;
 
     for (i = 0; (e = ND_out(v).list[i]); i++) {
+#ifndef WITH_CGRAPH
        if ((ND_mark(e->head) == FALSE) && (SLACK(e) == 0)) {
+#else /* WITH_CGRAPH */
+       if ((ND_mark(aghead(e)) == FALSE) && (SLACK(e) == 0)) {
+#endif /* WITH_CGRAPH */
            add_tree_edge(e);
+#ifndef WITH_CGRAPH
            if ((Tree_edge.size == N_nodes - 1) || treesearch(e->head))
+#else /* WITH_CGRAPH */
+           if ((Tree_edge.size == N_nodes - 1) || treesearch(aghead(e)))
+#endif /* WITH_CGRAPH */
                return TRUE;
        }
     }
     for (i = 0; (e = ND_in(v).list[i]); i++) {
+#ifndef WITH_CGRAPH
        if ((ND_mark(e->tail) == FALSE) && (SLACK(e) == 0)) {
+#else /* WITH_CGRAPH */
+       if ((ND_mark(agtail(e)) == FALSE) && (SLACK(e) == 0)) {
+#endif /* WITH_CGRAPH */
            add_tree_edge(e);
+#ifndef WITH_CGRAPH
            if ((Tree_edge.size == N_nodes - 1) || treesearch(e->tail))
+#else /* WITH_CGRAPH */
+           if ((Tree_edge.size == N_nodes - 1) || treesearch(agtail(e)))
+#endif /* WITH_CGRAPH */
                return TRUE;
        }
     }
@@ -287,7 +404,11 @@ static int tight_tree(void)
        ND_tree_in(n).size = ND_tree_out(n).size = 0;
     }
     for (i = 0; i < Tree_edge.size; i++)
+#ifndef WITH_CGRAPH
        Tree_edge.list[i]->u.tree_index = -1;
+#else /* WITH_CGRAPH */
+       ED_tree_index(Tree_edge.list[i]) = -1;
+#endif /* WITH_CGRAPH */
 
     Tree_node.size = Tree_edge.size = 0;
     for (n = GD_nlist(G); n && (Tree_edge.size == 0); n = ND_next(n))
@@ -324,10 +445,18 @@ static int feasible_tree(void)
        if (e) {
            delta = SLACK(e);
            if (delta) {
+#ifndef WITH_CGRAPH
                if (incident(e) == e->head)
+#else /* WITH_CGRAPH */
+               if (incident(e) == aghead(e))
+#endif /* WITH_CGRAPH */
                    delta = -delta;
                for (i = 0; i < Tree_node.size; i++)
+#ifndef WITH_CGRAPH
                    Tree_node.list[i]->u.rank += delta;
+#else /* WITH_CGRAPH */
+                   ND_rank(Tree_node.list[i]) += delta;
+#endif /* WITH_CGRAPH */
            }
        } else {
 #ifdef DEBUG
@@ -355,7 +484,11 @@ static node_t *treeupdate(node_t * v, node_t * w, int cutvalue, int dir)
 
     while (!SEQ(ND_low(v), ND_lim(w), ND_lim(v))) {
        e = ND_par(v);
+#ifndef WITH_CGRAPH
        if (v == e->tail)
+#else /* WITH_CGRAPH */
+       if (v == agtail(e))
+#endif /* WITH_CGRAPH */
            d = dir;
        else
            d = NOT(dir);
@@ -363,10 +496,19 @@ static node_t *treeupdate(node_t * v, node_t * w, int cutvalue, int dir)
            ED_cutvalue(e) += cutvalue;
        else
            ED_cutvalue(e) -= cutvalue;
+#ifndef WITH_CGRAPH
        if (ND_lim(e->tail) > ND_lim(e->head))
            v = e->tail;
+#else /* WITH_CGRAPH */
+       if (ND_lim(agtail(e)) > ND_lim(aghead(e)))
+           v = agtail(e);
+#endif /* WITH_CGRAPH */
        else
+#ifndef WITH_CGRAPH
            v = e->head;
+#else /* WITH_CGRAPH */
+           v = aghead(e);
+#endif /* WITH_CGRAPH */
     }
     return v;
 }
@@ -379,10 +521,18 @@ static void rerank(node_t * v, int delta)
     ND_rank(v) -= delta;
     for (i = 0; (e = ND_tree_out(v).list[i]); i++)
        if (e != ND_par(v))
+#ifndef WITH_CGRAPH
            rerank(e->head, delta);
+#else /* WITH_CGRAPH */
+           rerank(aghead(e), delta);
+#endif /* WITH_CGRAPH */
     for (i = 0; (e = ND_tree_in(v).list[i]); i++)
        if (e != ND_par(v))
+#ifndef WITH_CGRAPH
            rerank(e->tail, delta);
+#else /* WITH_CGRAPH */
+           rerank(agtail(e), delta);
+#endif /* WITH_CGRAPH */
 }
 
 /* e is the tree edge that is leaving and f is the nontree edge that
@@ -398,25 +548,55 @@ update(edge_t * e, edge_t * f)
     /* "for (v = in nodes in tail side of e) do ND_rank(v) -= delta;" */
     if (delta > 0) {
        int s;
+#ifndef WITH_CGRAPH
        s = ND_tree_in(e->tail).size + ND_tree_out(e->tail).size;
+#else /* WITH_CGRAPH */
+       s = ND_tree_in(agtail(e)).size + ND_tree_out(agtail(e)).size;
+#endif /* WITH_CGRAPH */
        if (s == 1)
+#ifndef WITH_CGRAPH
            rerank(e->tail, delta);
+#else /* WITH_CGRAPH */
+           rerank(agtail(e), delta);
+#endif /* WITH_CGRAPH */
        else {
+#ifndef WITH_CGRAPH
            s = ND_tree_in(e->head).size + ND_tree_out(e->head).size;
+#else /* WITH_CGRAPH */
+           s = ND_tree_in(aghead(e)).size + ND_tree_out(aghead(e)).size;
+#endif /* WITH_CGRAPH */
            if (s == 1)
+#ifndef WITH_CGRAPH
                rerank(e->head, -delta);
+#else /* WITH_CGRAPH */
+               rerank(aghead(e), -delta);
+#endif /* WITH_CGRAPH */
            else {
+#ifndef WITH_CGRAPH
                if (ND_lim(e->tail) < ND_lim(e->head))
                    rerank(e->tail, delta);
+#else /* WITH_CGRAPH */
+               if (ND_lim(agtail(e)) < ND_lim(aghead(e)))
+                   rerank(agtail(e), delta);
+#endif /* WITH_CGRAPH */
                else
+#ifndef WITH_CGRAPH
                    rerank(e->head, -delta);
+#else /* WITH_CGRAPH */
+                   rerank(aghead(e), -delta);
+#endif /* WITH_CGRAPH */
            }
        }
     }
 
     cutvalue = ED_cutvalue(e);
+#ifndef WITH_CGRAPH
     lca = treeupdate(f->tail, f->head, cutvalue, 1);
     if (treeupdate(f->head, f->tail, cutvalue, 0) != lca)
+#else /* WITH_CGRAPH */
+    lca = treeupdate(agtail(f), aghead(f), cutvalue, 1);
+    if (treeupdate(aghead(f), agtail(f), cutvalue, 0) != lca)
+#endif /* WITH_CGRAPH */
        abort();
     ED_cutvalue(f) = -cutvalue;
     ED_cutvalue(e) = 0;
@@ -469,10 +649,19 @@ static void LR_balance(void)
            delta = SLACK(f);
            if (delta <= 1)
                continue;
+#ifndef WITH_CGRAPH
            if (ND_lim(e->tail) < ND_lim(e->head))
                rerank(e->tail, delta / 2);
+#else /* WITH_CGRAPH */
+           if (ND_lim(agtail(e)) < ND_lim(aghead(e)))
+               rerank(agtail(e), delta / 2);
+#endif /* WITH_CGRAPH */
            else
+#ifndef WITH_CGRAPH
                rerank(e->head, -delta / 2);
+#else /* WITH_CGRAPH */
+               rerank(aghead(e), -delta / 2);
+#endif /* WITH_CGRAPH */
        }
     }
     freeTreeList (G);
@@ -502,11 +691,19 @@ static void TB_balance(void)
        high = Maxrank;
        for (i = 0; (e = ND_in(n).list[i]); i++) {
            inweight += ED_weight(e);
+#ifndef WITH_CGRAPH
            low = MAX(low, ND_rank(e->tail) + ED_minlen(e));
+#else /* WITH_CGRAPH */
+           low = MAX(low, ND_rank(agtail(e)) + ED_minlen(e));
+#endif /* WITH_CGRAPH */
        }
        for (i = 0; (e = ND_out(n).list[i]); i++) {
            outweight += ED_weight(e);
+#ifndef WITH_CGRAPH
            high = MIN(high, ND_rank(e->head) - ED_minlen(e));
+#else /* WITH_CGRAPH */
+           high = MIN(high, ND_rank(aghead(e)) - ED_minlen(e));
+#endif /* WITH_CGRAPH */
        }
        if (low < 0)
            low = 0;            /* vnodes can have ranks < 0 */
@@ -554,7 +751,11 @@ static int init_graph(graph_t * g)
            ED_cutvalue(e) = 0;
            ED_tree_index(e) = -1;
            if (feasible
+#ifndef WITH_CGRAPH
                && (ND_rank(e->head) - ND_rank(e->tail) < ED_minlen(e)))
+#else /* WITH_CGRAPH */
+               && (ND_rank(aghead(e)) - ND_rank(agtail(e)) < ED_minlen(e)))
+#endif /* WITH_CGRAPH */
                feasible = FALSE;
        }
        ND_tree_in(n).list = N_NEW(i + 1, edge_t *);
@@ -674,11 +875,20 @@ static void x_cutval(edge_t * f)
     int i, sum, dir;
 
     /* set v to the node on the side of the edge already searched */
+#ifndef WITH_CGRAPH
     if (ND_par(f->tail) == f) {
        v = f->tail;
+#else /* WITH_CGRAPH */
+    if (ND_par(agtail(f)) == f) {
+       v = agtail(f);
+#endif /* WITH_CGRAPH */
        dir = 1;
     } else {
+#ifndef WITH_CGRAPH
        v = f->head;
+#else /* WITH_CGRAPH */
+       v = aghead(f);
+#endif /* WITH_CGRAPH */
        dir = -1;
     }
 
@@ -695,10 +905,19 @@ static int x_val(edge_t * e, node_t * v, int dir)
     node_t *other;
     int d, rv, f;
 
+#ifndef WITH_CGRAPH
     if (e->tail == v)
        other = e->head;
+#else /* WITH_CGRAPH */
+    if (agtail(e) == v)
+       other = aghead(e);
+#endif /* WITH_CGRAPH */
     else
+#ifndef WITH_CGRAPH
        other = e->tail;
+#else /* WITH_CGRAPH */
+       other = agtail(e);
+#endif /* WITH_CGRAPH */
     if (!(SEQ(ND_low(v), ND_lim(other), ND_lim(v)))) {
        f = 1;
        rv = ED_weight(e);
@@ -711,12 +930,20 @@ static int x_val(edge_t * e, node_t * v, int dir)
        rv -= ED_weight(e);
     }
     if (dir > 0) {
+#ifndef WITH_CGRAPH
        if (e->head == v)
+#else /* WITH_CGRAPH */
+       if (aghead(e) == v)
+#endif /* WITH_CGRAPH */
            d = 1;
        else
            d = -1;
     } else {
+#ifndef WITH_CGRAPH
        if (e->tail == v)
+#else /* WITH_CGRAPH */
+       if (agtail(e) == v)
+#endif /* WITH_CGRAPH */
            d = 1;
        else
            d = -1;
@@ -735,10 +962,18 @@ static void dfs_cutval(node_t * v, edge_t * par)
 
     for (i = 0; (e = ND_tree_out(v).list[i]); i++)
        if (e != par)
+#ifndef WITH_CGRAPH
            dfs_cutval(e->head, e);
+#else /* WITH_CGRAPH */
+           dfs_cutval(aghead(e), e);
+#endif /* WITH_CGRAPH */
     for (i = 0; (e = ND_tree_in(v).list[i]); i++)
        if (e != par)
+#ifndef WITH_CGRAPH
            dfs_cutval(e->tail, e);
+#else /* WITH_CGRAPH */
+           dfs_cutval(agtail(e), e);
+#endif /* WITH_CGRAPH */
     if (par)
        x_cutval(par);
 }
@@ -753,10 +988,18 @@ static int dfs_range(node_t * v, edge_t * par, int low)
     ND_low(v) = low;
     for (i = 0; (e = ND_tree_out(v).list[i]); i++)
        if (e != par)
+#ifndef WITH_CGRAPH
            lim = dfs_range(e->head, e, lim);
+#else /* WITH_CGRAPH */
+           lim = dfs_range(aghead(e), e, lim);
+#endif /* WITH_CGRAPH */
     for (i = 0; (e = ND_tree_in(v).list[i]); i++)
        if (e != par)
+#ifndef WITH_CGRAPH
            lim = dfs_range(e->tail, e, lim);
+#else /* WITH_CGRAPH */
+           lim = dfs_range(agtail(e), e, lim);
+#endif /* WITH_CGRAPH */
     ND_lim(v) = lim;
     return lim + 1;
 }
@@ -807,7 +1050,11 @@ int check_ranks(void)
     for (n = GD_nlist(G); n; n = ND_next(n)) {
        for (i = 0; (e = ND_out(n).list[i]); i++) {
            cost += (ED_weight(e)) * abs(LENGTH(e));
+#ifndef WITH_CGRAPH
            if (ND_rank(e->head) - ND_rank(e->tail) - ED_minlen(e) < 0)
+#else /* WITH_CGRAPH */
+           if (ND_rank(aghead(e)) - ND_rank(agtail(e)) - ED_minlen(e) < 0)
+#endif /* WITH_CGRAPH */
                abort();
        }
     }
@@ -837,7 +1084,11 @@ void checktree(void)
 void check_fast_node(node_t * n)
 {
     node_t *nptr;
+#ifndef WITH_CGRAPH
     nptr = GD_nlist(n->graph);
+#else /* WITH_CGRAPH */
+    nptr = GD_nlist(agraphof(n));
+#endif /* WITH_CGRAPH */
     while (nptr && nptr != n)
        nptr = ND_next(nptr);
     assert(nptr != NULL);
@@ -854,24 +1105,38 @@ static node_t *checkdfs(node_t * n)
     ND_mark(n) = TRUE;
     ND_onstack(n) = TRUE;
     for (i = 0; (e = ND_out(n).list[i]); i++) {
+#ifndef WITH_CGRAPH
        w = e->head;
+#else
+       w = aghead(e);
+#endif
        if (ND_onstack(w)) {
+#ifndef WITH_CGRAPH
+           fprintf(stderr, "cycle: last edge %lx %s(%lx) %s(%lx)\n",
+               (unsigned long int)e,
+               n->name, (unsigned long int)n,
+               w->name, (unsigned long int)w);
+#else
            fprintf(stderr, "cycle: last edge %lx %s(%lx) %s(%lx)\n",
                (unsigned long int)e,
-               n->name,
-               (unsigned long int)n,
-               w->name,
-               (unsigned long int)w);
+               agnameof(n), (unsigned long int)n,
+               agnameof(w), (unsigned long int)w);
+#endif
            return w;
        }
        else {
            if (ND_mark(w) == FALSE) {
                x = checkdfs(w);
                if (x) {
+#ifndef WITH_CGRAPH
                    fprintf(stderr,"unwind %lx %s(%lx)\n",
                        (unsigned long int)e,
-                       n->name,
-                       (unsigned long int)n);
+                       n->name, (unsigned long int)n);
+#else
+                   fprintf(stderr,"unwind %lx %s(%lx)\n",
+                       (unsigned long int)e,
+                       agnameof(n), (unsigned long int)n);
+#endif
                    if (x != n) return x;
                    fprintf(stderr,"unwound to root\n");
                    fflush(stderr);
index 88005a141aa23cde6a9e769e250a512b3035cadd..a6ae8ebfed7adb59939efc7401a0a6a6c0c2e958 100644 (file)
@@ -97,8 +97,13 @@ static void map_edge(edge_t * e)
 
     if (ED_spl(e) == NULL) {
        if ((Concentrate == FALSE) || (ED_edge_type(e) != IGNORED))
+#ifndef WITH_CGRAPH
            agerr(AGERR, "lost %s %s edge\n", e->tail->name,
                  e->head->name);
+#else /* WITH_CGRAPH */
+           agerr(AGERR, "lost %s %s edge\n",agnameof(agtail(e)),\r
+                 agnameof(aghead(e)));\r
+#endif /* WITH_CGRAPH */
        return;
     }
     for (j = 0; j < ED_spl(e)->size; j++) {
@@ -305,7 +310,11 @@ static void place_flip_graph_label(graph_t * g)
     int c;
     pointf p, d;
 
+#ifndef WITH_CGRAPH
     if ((g != g->root) && (GD_label(g)) && !GD_label(g)->set) {
+#else /* WITH_CGRAPH */
+    if ((g != agroot(g)) && (GD_label(g)) && !GD_label(g)->set) {\r
+#endif /* WITH_CGRAPH */
 
        if (GD_label_pos(g) & LABEL_AT_TOP) {
            d = GD_border(g)[RIGHT_IX];
@@ -341,7 +350,11 @@ void place_graph_label(graph_t * g)
     int c;
     pointf p, d;
 
+#ifndef WITH_CGRAPH
     if ((g != g->root) && (GD_label(g)) && !GD_label(g)->set) {
+#else /* WITH_CGRAPH */
+    if ((g != agroot(g)) && (GD_label(g)) && !GD_label(g)->set) {\r
+#endif /* WITH_CGRAPH */
        if (GD_label_pos(g) & LABEL_AT_TOP) {
            d = GD_border(g)[TOP_IX];
            p.y = GD_bb(g).UR.y - d.y / 2;
index 770e99ff1f7ef809d56eed61f06d13149b52b0cd..52d8cbd84786e62637a5e22ab6a612e230b9a782 100644 (file)
@@ -117,7 +117,11 @@ void epsf_init(node_t * n)
        desc->offset.x = -us->x - (dx) / 2;
        desc->offset.y = -us->y - (dy) / 2;
     } else
+#ifndef WITH_CGRAPH
        agerr(AGWARN, "shapefile not set for epsf node %s\n", n->name);
+#else /* WITH_CGRAPH */
+       agerr(AGWARN, "shapefile not set for epsf node %s\n", agnameof(n));
+#endif /* WITH_CGRAPH */
 }
 
 void epsf_free(node_t * n)
index 48772126029da931bd33e50b52c2fdd7607120aa..c1350158007aeac69b66633a47d6f048dd20b2de 100644 (file)
@@ -322,7 +322,11 @@ static pointf *_routesplines(path * pp, int *npoints, int polyline)
     }
     else flip = 0;
 
+#ifndef WITH_CGRAPH
     if (realedge->tail != realedge->head) {
+#else /* WITH_CGRAPH */
+    if (agtail(realedge) != aghead(realedge)) {\r
+#endif /* WITH_CGRAPH */
        /* I assume that the path goes either down only or
           up - right - down */
        for (bi = 0, pi = 0; bi < boxn; bi++) {
index b2c44d5feb1e9e44b7f80b49dfc5b8670ff01c20..b204c0bdad7b82424eb43db2a00f9685d6249c91 100644 (file)
 #ifdef DEBUG
 static int debugleveln(edge_t* e, int i)
 {
+#ifndef WITH_CGRAPH
     return (GD_showboxes(e->head->graph) == i ||
            GD_showboxes(e->tail->graph) == i ||
+#else /* WITH_CGRAPH */
+    return (GD_showboxes(aghead(e)->graph) == i ||
+           GD_showboxes(agtail(e)->graph) == i ||
+#endif /* WITH_CGRAPH */
            ED_showboxes(e) == i ||
+#ifndef WITH_CGRAPH
            ND_showboxes(e->head) == i ||
            ND_showboxes(e->tail) == i);
+#else /* WITH_CGRAPH */
+           ND_showboxes(aghead(e)) == i ||
+           ND_showboxes(agtail(e)) == i);
+#endif /* WITH_CGRAPH */
 }
 
 static void showPoints(pointf ps[], int pn)
@@ -73,7 +83,11 @@ arrow_clip(edge_t * fe, node_t * hn,
     arrow_flags(e, &sflag, &eflag);
     if (info->splineMerge(hn))
        eflag = ARR_NONE;
+#ifndef WITH_CGRAPH
     if (info->splineMerge(fe->tail))
+#else /* WITH_CGRAPH */
+    if (info->splineMerge(agtail(fe)))
+#endif /* WITH_CGRAPH */
        sflag = ARR_NONE;
     if (j) {
        i = sflag;
@@ -211,7 +225,11 @@ void shape_clip(node_t * n, pointf curve[4])
 bezier *new_spline(edge_t * e, int sz)
 {
     bezier *rv;
+#ifndef WITH_CGRAPH
 
+#else /* WITH_CGRAPH */
+       splines* sp_test;
+#endif /* WITH_CGRAPH */
     while (ED_edge_type(e) != NORMAL)
        e = ED_to_orig(e);
     if (ED_spl(e) == NULL)
@@ -226,7 +244,7 @@ bezier *new_spline(edge_t * e, int sz)
 
 /* clip_and_install:
  * Given a raw spline (pn control points in ps), representing
- * a path from edge fe->tail ending in node hn, clip the ends to
+ * a path from edge agtail(fe) ending in node hn, clip the ends to
  * the node boundaries and attach the resulting spline to the
  * edge.
  */
@@ -243,20 +261,33 @@ clip_and_install(edge_t * fe, node_t * hn, pointf * ps, int pn,
     boxf *tbox, *hbox;
     inside_t inside_context;
 
+#ifndef WITH_CGRAPH
     tn = fe->tail;
     g = tn->graph;
+#else /* WITH_CGRAPH */
+    tn = agtail(fe);
+    g = agraphof(tn);
+#endif /* WITH_CGRAPH */
     newspl = new_spline(fe, pn);
 
     for (orig = fe; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
 
     /* may be a reversed flat edge */
+#ifndef WITH_CGRAPH
     if ((tn->u.rank == hn->u.rank) && (tn->u.order > hn->u.order)) {
+#else /* WITH_CGRAPH */
+    if ((ND_rank(tn) == ND_rank(hn)) && (ND_order(tn) > ND_order(hn))) {
+#endif /* WITH_CGRAPH */
        node_t *tmp;
        tmp = hn;
        hn = tn;
        tn = tmp;
     }
+#ifndef WITH_CGRAPH
     if (tn == orig->tail) {
+#else /* WITH_CGRAPH */
+    if (tn == agtail(orig)) {
+#endif /* WITH_CGRAPH */
        clipTail = ED_tail_port(orig).clip;
        clipHead = ED_head_port(orig).clip;
        tbox = ED_tail_port(orig).bp;
@@ -330,14 +361,30 @@ conc_slope(node_t* n)
 
     s_in = s_out = 0.0;
     for (cnt_in = 0; (e = ND_in(n).list[cnt_in]); cnt_in++)
+#ifndef WITH_CGRAPH
        s_in += ND_coord(e->tail).x;
+#else /* WITH_CGRAPH */
+       s_in += ND_coord(agtail(e)).x;
+#endif /* WITH_CGRAPH */
     for (cnt_out = 0; (e = ND_out(n).list[cnt_out]); cnt_out++)
+#ifndef WITH_CGRAPH
        s_out += ND_coord(e->head).x;
+#else /* WITH_CGRAPH */
+       s_out += ND_coord(aghead(e)).x;
+#endif /* WITH_CGRAPH */
     p.x = ND_coord(n).x - (s_in / cnt_in);
+#ifndef WITH_CGRAPH
     p.y = ND_coord(n).y - ND_coord(ND_in(n).list[0]->tail).y;
+#else /* WITH_CGRAPH */
+    p.y = ND_coord(n).y - ND_coord(agtail(ND_in(n).list[0])).y;
+#endif /* WITH_CGRAPH */
     m_in = atan2(p.y, p.x);
     p.x = (s_out / cnt_out) - ND_coord(n).x;
+#ifndef WITH_CGRAPH
     p.y = ND_coord(ND_out(n).list[0]->head).y - ND_coord(n).y;
+#else /* WITH_CGRAPH */
+    p.y = ND_coord(aghead(ND_out(n).list[0])).y - ND_coord(n).y;
+#endif /* WITH_CGRAPH */
     m_out = atan2(p.y, p.x);
     return ((m_in + m_out) / 2.0);
 }
@@ -387,10 +434,18 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
     node_t *n;
     int (*pboxfn) (node_t*, port*, int, boxf*, int*);
 
+#ifndef WITH_CGRAPH
     n = e->tail;
+#else /* WITH_CGRAPH */
+    n = agtail(e);
+#endif /* WITH_CGRAPH */
 
     if (ED_tail_port(e).dyna)
+#ifndef WITH_CGRAPH
        ED_tail_port(e) = resolvePort(e->tail, e->head, &ED_tail_port(e));
+#else
+       ED_tail_port(e) = resolvePort(agtail(e), aghead(e), &ED_tail_port(e));
+#endif
     if (ND_shape(n))
        pboxfn = ND_shape(n)->fns->pboxfn;
     else
@@ -398,7 +453,11 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
     P->start.p = add_pointf(ND_coord(n), ED_tail_port(e).p);
     if (merge) {
        /*P->start.theta = - M_PI / 2; */
+#ifndef WITH_CGRAPH
        P->start.theta = conc_slope(e->tail);
+#else /* WITH_CGRAPH */
+       P->start.theta = conc_slope(agtail(e));
+#endif /* WITH_CGRAPH */
        P->start.constrained = TRUE;
     } else {
        if (ED_tail_port(e).constrained) {
@@ -420,7 +479,11 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
                /* b0.LL.y = ND_coord(n).y + ND_ht(n)/2; */
                b0.LL.y = P->start.p.y;
                b0.UR.x = b.UR.x;
+#ifndef WITH_CGRAPH
                b0.UR.y = ND_coord(n).y + ND_ht(n)/2 + GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+               b0.UR.y = ND_coord(n).y + ND_ht(n)/2 + GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
                b.UR.x = ND_coord(n).x - ND_lw(n) - (FUDGE-2);
                b.UR.y = b0.LL.y;
                b.LL.y = ND_coord(n).y - ND_ht(n)/2;
@@ -433,7 +496,11 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
                b0.LL.y = P->start.p.y;
                /* b0.LL.y = ND_coord(n).y + ND_ht(n)/2; */
                b0.UR.x = b.UR.x+1;
+#ifndef WITH_CGRAPH
                b0.UR.y = ND_coord(n).y + ND_ht(n)/2 + GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+               b0.UR.y = ND_coord(n).y + ND_ht(n)/2 + GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
                b.LL.x = ND_coord(n).x + ND_rw(n) + (FUDGE-2);
                b.UR.y = b0.LL.y;
                b.LL.y = ND_coord(n).y - ND_ht(n)/2;
@@ -470,7 +537,11 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            P->start.p.x += 1;
        }
        for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
+#ifndef WITH_CGRAPH
        if (n == orig->tail)
+#else /* WITH_CGRAPH */
+       if (n == agtail(orig))
+#endif /* WITH_CGRAPH */
            ED_tail_port(orig).clip = FALSE;
        else
            ED_head_port(orig).clip = FALSE;
@@ -489,7 +560,11 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
                b0.UR.y = ND_coord(n).y - ND_ht(n)/2;
                b0.UR.x = b.UR.x+1;
                b0.LL.x = P->start.p.x;
+#ifndef WITH_CGRAPH
                b0.LL.y = b0.UR.y - GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+               b0.LL.y = b0.UR.y - GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
                b.LL.x = ND_coord(n).x + ND_rw(n) + (FUDGE-2);
                b.LL.y = b0.UR.y;
                b.UR.y = ND_coord(n).y + ND_ht(n)/2;
@@ -531,7 +606,11 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            endp->boxn = 1;
        }
        for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
+#ifndef WITH_CGRAPH
        if (n == orig->tail)
+#else /* WITH_CGRAPH */
+       if (n == agtail(orig))
+#endif /* WITH_CGRAPH */
            ED_tail_port(orig).clip = FALSE;
        else
            ED_head_port(orig).clip = FALSE;
@@ -578,10 +657,18 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
     node_t *n;
     int (*pboxfn) (node_t* n, port*, int, boxf*, int*);
 
+#ifndef WITH_CGRAPH
     n = e->head;
+#else /* WITH_CGRAPH */
+    n = aghead(e);
+#endif /* WITH_CGRAPH */
 
     if (ED_head_port(e).dyna) 
+#ifndef WITH_CGRAPH
        ED_head_port(e) = resolvePort(e->head, e->tail, &ED_head_port(e));
+#else /* WITH_CGRAPH */
+       ED_head_port(e) = resolvePort(aghead(e), agtail(e), &ED_head_port(e));
+#endif /* WITH_CGRAPH */
     if (ND_shape(n))
        pboxfn = ND_shape(n)->fns->pboxfn;
     else
@@ -589,7 +676,11 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
     P->end.p = add_pointf(ND_coord(n), ED_head_port(e).p);
     if (merge) {
        /*P->end.theta = M_PI / 2; */
+#ifndef WITH_CGRAPH
        P->end.theta = conc_slope(e->head) + M_PI;
+#else /* WITH_CGRAPH */
+       P->end.theta = conc_slope(aghead(e)) + M_PI;
+#endif /* WITH_CGRAPH */
        assert(P->end.theta < 2 * M_PI);
        P->end.constrained = TRUE;
     } else {
@@ -617,7 +708,11 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
                /* b0.UR.y = ND_coord(n).y - ND_ht(n)/2; */
                b0.UR.y = P->end.p.y;
                b0.UR.x = b.UR.x;
+#ifndef WITH_CGRAPH
                b0.LL.y = ND_coord(n).y - ND_ht(n)/2 - GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+               b0.LL.y = ND_coord(n).y - ND_ht(n)/2 - GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
                b.UR.x = ND_coord(n).x - ND_lw(n) - (FUDGE-2);
                b.LL.y = b0.UR.y;
                b.UR.y = ND_coord(n).y + ND_ht(n)/2;
@@ -630,7 +725,11 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
                b0.UR.y = P->end.p.y;
                /* b0.UR.y = ND_coord(n).y - ND_ht(n)/2; */
                b0.UR.x = b.UR.x+1;
+#ifndef WITH_CGRAPH
                b0.LL.y = ND_coord(n).y - ND_ht(n)/2 - GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+               b0.LL.y = ND_coord(n).y - ND_ht(n)/2 - GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
                b.LL.x = ND_coord(n).x + ND_rw(n) + (FUDGE-2);
                b.LL.y = b0.UR.y;
                b.UR.y = ND_coord(n).y + ND_ht(n)/2;
@@ -660,7 +759,11 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            P->start.p.x -= 1;
        }
        for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
+#ifndef WITH_CGRAPH
        if (n == orig->head)
+#else /* WITH_CGRAPH */
+       if (n == aghead(orig))
+#endif /* WITH_CGRAPH */
            ED_head_port(orig).clip = FALSE;
        else
            ED_tail_port(orig).clip = FALSE;
@@ -708,7 +811,11 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
                b0.LL.x = b.LL.x-1;
                b0.UR.y = ND_coord(n).y - ND_ht(n)/2;
                b0.UR.x = P->end.p.x;
+#ifndef WITH_CGRAPH
                b0.LL.y = b0.UR.y - GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+               b0.LL.y = b0.UR.y - GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
                b.UR.x = ND_coord(n).x - ND_lw(n) - 2;
                b.LL.y = b0.UR.y;
                b.UR.y = ND_coord(n).y + ND_ht(n)/2;
@@ -725,7 +832,11 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            break;
        }
        for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
+#ifndef WITH_CGRAPH
        if (n == orig->head)
+#else /* WITH_CGRAPH */
+       if (n == aghead(orig))
+#endif /* WITH_CGRAPH */
            ED_head_port(orig).clip = FALSE;
        else
            ED_tail_port(orig).clip = FALSE;
@@ -777,7 +888,11 @@ static void selfBottom (edge_t* edges[], int ind, int cnt,
     int pointn;
 
     e = edges[ind];
+#ifndef WITH_CGRAPH
     n = e->tail;
+#else
+    n = agtail(e);
+#endif
 
     stepx = (sizex / 2.) / cnt;
     stepx = MAX(stepx,2.);
@@ -806,7 +921,11 @@ static void selfBottom (edge_t* edges[], int ind, int cnt,
         points[pointn++] = pointfof(hp.x - dx, hp.y - hy / 3);
         points[pointn++] = hp;
         if (ED_label(e)) {
+#ifndef WITH_CGRAPH
        if (GD_flip(e->tail->graph)) {
+#else
+       if (GD_flip(agraphof(agtail(e)))) {
+#endif
            width = ED_label(e)->dimen.y;
            height = ED_label(e)->dimen.x;
        } else {
@@ -821,7 +940,11 @@ static void selfBottom (edge_t* edges[], int ind, int cnt,
        if (dx + stepx < width)
            dx += width - stepx;
         }
+#ifndef WITH_CGRAPH
         clip_and_install(e, e->head, points, pointn, sinfo);
+#else
+        clip_and_install(e, aghead(e), points, pointn, sinfo);
+#endif
 #ifdef DEBUG
         if (debugleveln(e,1))
            showPoints (points, pointn);
@@ -843,7 +966,11 @@ selfTop (edge_t* edges[], int ind, int cnt, double sizex, double stepy,
     int pointn;
 
     e = edges[ind];
+#ifndef WITH_CGRAPH
     n = e->tail;
+#else
+    n = agtail(e);
+#endif
 
     stepx = (sizex / 2.) / cnt;
     stepx = MAX(stepx, 2.);
@@ -872,7 +999,11 @@ selfTop (edge_t* edges[], int ind, int cnt, double sizex, double stepy,
         points[pointn++] = pointfof(hp.x - dx, hp.y + hy / 3);
         points[pointn++] = hp;
         if (ED_label(e)) {
-           if (GD_flip(e->tail->graph)) {
+#ifndef WITH_CGRAPH
+           if (GD_flip(e->tail->graph)) {
+#else
+           if (GD_flip(agraphof(agtail(e)))) {
+#endif
                width = ED_label(e)->dimen.y;
                height = ED_label(e)->dimen.x;
            } else {
@@ -887,7 +1018,11 @@ selfTop (edge_t* edges[], int ind, int cnt, double sizex, double stepy,
            if (dx + stepx < width)
                dx += width - stepx;
         }
+#ifndef WITH_CGRAPH
         clip_and_install(e, e->head, points, pointn, sinfo);
+#else
+        clip_and_install(e, aghead(e), points, pointn, sinfo);
+#endif
 #ifdef DEBUG
         if (debugleveln(e,1))
            showPoints (points, pointn);
@@ -909,7 +1044,11 @@ selfRight (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
     int pointn;
 
     e = edges[ind];
+#ifndef WITH_CGRAPH
     n = e->tail;
+#else
+    n = agtail(e);
+#endif
 
     stepy = (sizey / 2.) / cnt;
     stepy = MAX(stepy, 2.);
@@ -938,7 +1077,11 @@ selfRight (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
         points[pointn++] = pointfof(hp.x + hx / 3, hp.y - dy);
         points[pointn++] = hp;
         if (ED_label(e)) {
+#ifndef WITH_CGRAPH
            if (GD_flip(e->tail->graph)) {
+#else
+           if (GD_flip(agraphof(agtail(e)))) {
+#endif
                width = ED_label(e)->dimen.y;
                height = ED_label(e)->dimen.x;
            } else {
@@ -953,7 +1096,11 @@ selfRight (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
            if (dy + stepy < height)
                dy += height - stepy;
         }
+#ifndef WITH_CGRAPH
         clip_and_install(e, e->head, points, pointn, sinfo);
+#else
+       clip_and_install(e, aghead(e), points, pointn, sinfo);
+#endif
 #ifdef DEBUG
         if (debugleveln(e,1))
            showPoints (points, pointn);
@@ -975,7 +1122,11 @@ selfLeft (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
     int pointn;
 
     e = edges[ind];
+#ifndef WITH_CGRAPH
     n = e->tail;
+#else /* WITH_CGRAPH */
+    n = agtail(e);
+#endif /* WITH_CGRAPH */
 
     stepy = (sizey / 2.) / cnt;
     stepy = MAX(stepy,2.);
@@ -1004,7 +1155,11 @@ selfLeft (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
         points[pointn++] = pointfof(hp.x - hx / 3, hp.y - dy);
         points[pointn++] = hp;
         if (ED_label(e)) {
+#ifndef WITH_CGRAPH
        if (GD_flip(e->tail->graph)) {
+#else /* WITH_CGRAPH */
+       if (GD_flip(agraphof(agtail(e)))) {
+#endif /* WITH_CGRAPH */
            width = ED_label(e)->dimen.y;
            height = ED_label(e)->dimen.x;
        } else {
@@ -1019,7 +1174,11 @@ selfLeft (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
        if (dy + stepy < height)
            dy += height - stepy;
         }
+#ifndef WITH_CGRAPH
         clip_and_install(e, e->head, points, pointn, sinfo);
+#else /* WITH_CGRAPH */
+        clip_and_install(e, aghead(e), points, pointn, sinfo);
+#endif /* WITH_CGRAPH */
 #ifdef DEBUG
         if (debugleveln(e,1))
            showPoints (points, pointn);
@@ -1049,7 +1208,11 @@ selfRightSpace (edge_t* e)
           (!(ED_tail_port(e).side & (TOP|BOTTOM)))))) {
        sw = SELF_EDGE_SIZE;
        if (l) {
+#ifndef WITH_CGRAPH
            label_width = GD_flip(e->head->graph) ? l->dimen.y : l->dimen.x;
+#else /* WITH_CGRAPH */
+           label_width = GD_flip(agraphof(aghead(e))) ? l->dimen.y : l->dimen.x;
+#endif /* WITH_CGRAPH */
            sw += label_width;
        }
     }
index b3e3a0a2a04ed2f83257fba9fb28c2c6abc446f7..d210643488f92f939634ced7e421e1ec8b1fa7ea 100644 (file)
@@ -552,7 +552,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #define ND_UF_size(n) (((Agnodeinfo_t*)AGDATA(n))->UF_size)
 #define ND_bb(n) (((Agnodeinfo_t*)AGDATA(n))->bb)
 #define ND_clust(n) (((Agnodeinfo_t*)AGDATA(n))->clust)
-#define ND_coord_i(n) (((Agnodeinfo_t*)AGDATA(n))->coord)
+#define ND_coord(n) (((Agnodeinfo_t*)AGDATA(n))->coord)
 #define ND_dist(n) (((Agnodeinfo_t*)AGDATA(n))->dist)
 #define ND_flat_in(n) (((Agnodeinfo_t*)AGDATA(n))->flat_in)
 #define ND_flat_out(n) (((Agnodeinfo_t*)AGDATA(n))->flat_out)
@@ -561,13 +561,13 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #define ND_heapindex(n) (((Agnodeinfo_t*)AGDATA(n))->heapindex)
 #define ND_height(n) (((Agnodeinfo_t*)AGDATA(n))->height)
 #define ND_hops(n) (((Agnodeinfo_t*)AGDATA(n))->hops)
-#define ND_ht_i(n) (((Agnodeinfo_t*)AGDATA(n))->ht)
+#define ND_ht(n) (((Agnodeinfo_t*)AGDATA(n))->ht)
 #define ND_in(n) (((Agnodeinfo_t*)AGDATA(n))->in)
 #define ND_inleaf(n) (((Agnodeinfo_t*)AGDATA(n))->inleaf)
 #define ND_label(n) (((Agnodeinfo_t*)AGDATA(n))->label)
 #define ND_lim(n) (((Agnodeinfo_t*)AGDATA(n))->lim)
 #define ND_low(n) (((Agnodeinfo_t*)AGDATA(n))->low)
-#define ND_lw_i(n) (((Agnodeinfo_t*)AGDATA(n))->lw)
+#define ND_lw(n) (((Agnodeinfo_t*)AGDATA(n))->lw)
 #define ND_mark(n) (((Agnodeinfo_t*)AGDATA(n))->mark)
 #define ND_mval(n) (((Agnodeinfo_t*)AGDATA(n))->mval)
 #define ND_n_cluster(n) (((Agnodeinfo_t*)AGDATA(n))->n_cluster)
@@ -585,7 +585,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #define ND_priority(n) (((Agnodeinfo_t*)AGDATA(n))->priority)
 #define ND_rank(n) (((Agnodeinfo_t*)AGDATA(n))->rank)
 #define ND_ranktype(n) (((Agnodeinfo_t*)AGDATA(n))->ranktype)
-#define ND_rw_i(n) (((Agnodeinfo_t*)AGDATA(n))->rw)
+#define ND_rw(n) (((Agnodeinfo_t*)AGDATA(n))->rw)
 #define ND_save_in(n) (((Agnodeinfo_t*)AGDATA(n))->save_in)
 #define ND_save_out(n) (((Agnodeinfo_t*)AGDATA(n))->save_out)
 #define ND_shape(n) (((Agnodeinfo_t*)AGDATA(n))->shape)