]> granicus.if.org Git - graphviz/commitdiff
cgraph fixes
authorellson <devnull@localhost>
Thu, 23 Oct 2008 01:04:54 +0000 (01:04 +0000)
committerellson <devnull@localhost>
Thu, 23 Oct 2008 01:04:54 +0000 (01:04 +0000)
plugin/core/gvloadimage_core.c
plugin/core/gvrender_core_dot.c
plugin/core/gvrender_core_fig.c
plugin/core/gvrender_core_map.c
plugin/core/gvrender_core_ps.c
plugin/core/gvrender_core_svg.c
plugin/core/gvrender_core_tk.c
plugin/core/gvrender_core_vml.c

index 8d6932dc83cb7f29fb64404f0de5c571e4d5e897..c5d881d4e56ff1a1d02956b1edc0847d4c5ef7b1 100644 (file)
@@ -28,9 +28,6 @@
 #include "gvplugin_loadimage.h"
 #include "gvio.h"
 
-/* for n->name */
-#include "graph.h"
-
 extern void core_loadimage_xdot(GVJ_t*, usershape_t*, boxf, boolean);
 extern void epsf_emit_body(GVJ_t *job, usershape_t *us);
 extern shape_desc *find_user_shape(char *name);
index b4b8275b924ea4ff31de32826dc75cbc4beacaa3..44756a85df4f018a022157b33973533c8cd04f1d 100644 (file)
 
 #include "gvplugin_render.h"
 #include "gvplugin_device.h"
+#ifndef WITH_CGRAPH
 #include "graph.h"
+#else
+#include "cgraph.h"
+#endif
 #include "agxbuf.h"
 #include "utils.h"
 
@@ -155,9 +159,17 @@ static void xdot_end_node(GVJ_t* job)
 {
     Agnode_t* n = job->obj->u.n; 
     if (agxblen(xbufs[EMIT_NDRAW]))
+#ifndef WITH_CGRAPH
        agxset(n, xd->n_draw->index, agxbuse(xbufs[EMIT_NDRAW]));
+#else /* WITH_CGRAPH */
+       agxset(n, xd->n_draw, agxbuse(xbufs[EMIT_NDRAW]));
+#endif /* WITH_CGRAPH */
     if (agxblen(xbufs[EMIT_NLABEL]))
+#ifndef WITH_CGRAPH
        agxset(n, xd->n_l_draw->index, agxbuse(xbufs[EMIT_NLABEL]));
+#else /* WITH_CGRAPH */
+       agxset(n, xd->n_l_draw, agxbuse(xbufs[EMIT_NLABEL]));
+#endif /* WITH_CGRAPH */
 }
 
 static void xdot_end_edge(GVJ_t* job)
@@ -165,26 +177,58 @@ static void xdot_end_edge(GVJ_t* job)
     Agedge_t* e = job->obj->u.e; 
 
     if (agxblen(xbufs[EMIT_EDRAW]))
+#ifndef WITH_CGRAPH
        agxset(e, xd->e_draw->index, agxbuse(xbufs[EMIT_EDRAW]));
+#else /* WITH_CGRAPH */
+       agxset(e, xd->e_draw, agxbuse(xbufs[EMIT_EDRAW]));
+#endif /* WITH_CGRAPH */
     if (agxblen(xbufs[EMIT_TDRAW]))
+#ifndef WITH_CGRAPH
        agxset(e, xd->t_draw->index, agxbuse(xbufs[EMIT_TDRAW]));
+#else /* WITH_CGRAPH */
+       agxset(e, xd->t_draw, agxbuse(xbufs[EMIT_TDRAW]));
+#endif /* WITH_CGRAPH */
     if (agxblen(xbufs[EMIT_HDRAW]))
+#ifndef WITH_CGRAPH
        agxset(e, xd->h_draw->index, agxbuse(xbufs[EMIT_HDRAW]));
+#else /* WITH_CGRAPH */
+       agxset(e, xd->h_draw, agxbuse(xbufs[EMIT_HDRAW]));
+#endif /* WITH_CGRAPH */
     if (agxblen(xbufs[EMIT_ELABEL]))
+#ifndef WITH_CGRAPH
        agxset(e, xd->e_l_draw->index,agxbuse(xbufs[EMIT_ELABEL]));
+#else /* WITH_CGRAPH */
+       agxset(e, xd->e_l_draw,agxbuse(xbufs[EMIT_ELABEL]));
+#endif /* WITH_CGRAPH */
     if (agxblen(xbufs[EMIT_TLABEL]))
+#ifndef WITH_CGRAPH
        agxset(e, xd->tl_draw->index, agxbuse(xbufs[EMIT_TLABEL]));
+#else /* WITH_CGRAPH */
+       agxset(e, xd->tl_draw, agxbuse(xbufs[EMIT_TLABEL]));
+#endif /* WITH_CGRAPH */
     if (agxblen(xbufs[EMIT_HLABEL]))
+#ifndef WITH_CGRAPH
        agxset(e, xd->hl_draw->index, agxbuse(xbufs[EMIT_HLABEL]));
+#else /* WITH_CGRAPH */
+       agxset(e, xd->hl_draw, agxbuse(xbufs[EMIT_HLABEL]));
+#endif /* WITH_CGRAPH */
 }
 
 static void xdot_end_cluster(GVJ_t * job)
 {
     Agraph_t* cluster_g = job->obj->u.sg;
 
+#ifndef WITH_CGRAPH
     agxset(cluster_g, xd->g_draw->index, agxbuse(xbufs[EMIT_CDRAW]));
+#else /* WITH_CGRAPH */
+    agxset(cluster_g, xd->g_draw, agxbuse(xbufs[EMIT_CDRAW]));
+#endif /* WITH_CGRAPH */
     if (GD_label(cluster_g))
+#ifndef WITH_CGRAPH
        agxset(cluster_g, xd->g_l_draw->index, agxbuse(xbufs[EMIT_CLABEL]));
+#else /* WITH_CGRAPH */
+       agxset(cluster_g, xd->g_l_draw, agxbuse(xbufs[EMIT_CLABEL]));
+#endif /* WITH_CGRAPH */
 }
 
 /* 
@@ -217,36 +261,71 @@ xdot_begin_graph (graph_t *g, int s_arrows, int e_arrows)
     xd = GNEW(xdot_state_t);
 
     if (GD_n_cluster(g))
+#ifndef WITH_CGRAPH
        xd->g_draw = safe_dcl(g, g, "_draw_", "", agraphattr);
+#else
+       xd->g_draw = safe_dcl(g, AGRAPH, "_draw_", "");
+#endif
     else
        xd->g_draw = NULL;
     if (GD_has_labels(g) & GRAPH_LABEL)
+#ifndef WITH_CGRAPH
        xd->g_l_draw = safe_dcl(g, g, "_ldraw_", "", agraphattr);
+#else
+       xd->g_l_draw = safe_dcl(g, AGRAPH, "_ldraw_", "");
+#endif
     else
        xd->g_l_draw = NULL;
 
+#ifndef WITH_CGRAPH
     xd->n_draw = safe_dcl(g, g->proto->n, "_draw_", "", agnodeattr);
     xd->n_l_draw = safe_dcl(g, g->proto->n, "_ldraw_", "", agnodeattr);
 
     xd->e_draw = safe_dcl(g, g->proto->e, "_draw_", "", agedgeattr);
+#else
+    xd->n_draw = safe_dcl(g, AGNODE, "_draw_", "");
+    xd->n_l_draw = safe_dcl(g, AGNODE, "_ldraw_", "");
+
+    xd->e_draw = safe_dcl(g, AGEDGE, "_draw_", "");
+#endif
     if (e_arrows)
+#ifndef WITH_CGRAPH
        xd->h_draw = safe_dcl(g, g->proto->e, "_hdraw_", "", agedgeattr);
+#else
+       xd->h_draw = safe_dcl(g, AGEDGE, "_hdraw_", "");
+#endif
     else
        xd->h_draw = NULL;
     if (s_arrows)
+#ifndef WITH_CGRAPH
        xd->t_draw = safe_dcl(g, g->proto->e, "_tdraw_", "", agedgeattr);
+#else
+       xd->t_draw = safe_dcl(g, AGEDGE, "_tdraw_", "");
+#endif
     else
        xd->t_draw = NULL;
     if (GD_has_labels(g) & EDGE_LABEL)
+#ifndef WITH_CGRAPH
        xd->e_l_draw = safe_dcl(g, g->proto->e, "_ldraw_", "", agedgeattr);
+#else
+       xd->e_l_draw = safe_dcl(g, AGEDGE, "_ldraw_", "");
+#endif
     else
        xd->e_l_draw = NULL;
     if (GD_has_labels(g) & HEAD_LABEL)
+#ifndef WITH_CGRAPH
        xd->hl_draw = safe_dcl(g, g->proto->e, "_hldraw_", "", agedgeattr);
+#else
+       xd->hl_draw = safe_dcl(g, AGEDGE, "_hldraw_", "");
+#endif
     else
        xd->hl_draw = NULL;
     if (GD_has_labels(g) & TAIL_LABEL)
+#ifndef WITH_CGRAPH
        xd->tl_draw = safe_dcl(g, g->proto->e, "_tldraw_", "", agedgeattr);
+#else
+       xd->tl_draw = safe_dcl(g, AGEDGE, "_tldraw_", "");
+#endif
     else
        xd->tl_draw = NULL;
 
@@ -283,11 +362,20 @@ static void xdot_end_graph(graph_t* g)
 
     if (agxblen(xbufs[EMIT_GDRAW])) {
        if (!xd->g_draw)
+#ifndef WITH_CGRAPH
            xd->g_draw = safe_dcl(g, g, "_draw_", "", agraphattr);
        agxset(g, xd->g_draw->index, agxbuse(xbufs[EMIT_GDRAW]));
+#else /* WITH_CGRAPH */
+           xd->g_draw = safe_dcl(g, AGRAPH, "_draw_", "");
+       agxset(g, xd->g_draw, agxbuse(xbufs[EMIT_GDRAW]));
+#endif /* WITH_CGRAPH */
     }
     if (GD_label(g))
+#ifndef WITH_CGRAPH
        agxset(g, xd->g_l_draw->index, agxbuse(xbufs[EMIT_GLABEL]));
+#else /* WITH_CGRAPH */
+       agxset(g, xd->g_l_draw, agxbuse(xbufs[EMIT_GLABEL]));
+#endif /* WITH_CGRAPH */
     agsafeset (g, "xdotversion", XDOTVERSION, "");
 
     for (i = 0; i < NUMXBUFS; i++)
index d57bf2b43c6bbeaa48a4663f05a5926a6f062ee0..140d1a84ce7d009b0a22ab2f86d0ea700256bf61 100644 (file)
 #include "gvplugin_render.h"
 #include "gvplugin_device.h"
 #include "gvio.h"
+#ifndef WITH_CGRAPH
 #include "graph.h"
+#else
+#include "cgraph.h"
+#endif
 #include "agxbuf.h"
 #include "utils.h"
 #include "color.h"
@@ -204,7 +208,7 @@ static void fig_begin_graph(GVJ_t * job)
     gvprintf(job, "# Generated by %s version %s (%s)\n",
        job->common->info[0], job->common->info[1], job->common->info[2]);
     gvprintf(job, "# For: %s\n", job->common->user);
-    gvprintf(job, "# Title: %s\n", obj->u.g->name);
+    gvprintf(job, "# Title: %s\n", agnameof(obj->u.g));
     gvprintf(job, "# Pages: %d\n", job->pagesArraySize.x * job->pagesArraySize.y);
     gvputs(job, "Portrait\n"); /* orientation */
     gvputs(job, "Center\n");   /* justification */
index 033b306589861fcc116de2d606219b0750bfd642..0fdb2a39608816aba9e44a9b09b2e074b9684850 100644 (file)
 #include "config.h"
 #endif
 
+#include <stdlib.h>
+
 #include "gvplugin_render.h"
 #include "gvplugin_device.h"
 #include "gvio.h"
 
 /* for g->name */
+#ifndef WITH_CGRAPH
 #include "graph.h"
+#else
+#include "cgraph.h"
+#endif
 
 extern char *xml_string(char *str);
 extern char *xml_url_string(char *str);
@@ -172,12 +178,12 @@ static void map_begin_page(GVJ_t * job)
            gvputs(job, "default ");
            gvputs(job, xml_string(obj->url));
            gvputs(job, " ");
-           gvputs(job, xml_string(obj->u.g->name));
+           gvputs(job, xml_string(agnameof(obj->u.g)));
            gvputs(job, "\n");
        }
         break;
     case FORMAT_CMAPX:
-       s = xml_string(obj->u.g->name);
+       s = xml_string(agnameof(obj->u.g));
        gvputs(job, "<map id=\"");
        gvputs(job, s);
        gvputs(job, "\" name=\"");
index 3c4a6e304d848b8f8b5337a5d0a369ff646ee0f1..071007717bee859f6200fd5d26b850931e895f08 100644 (file)
@@ -76,7 +76,7 @@ static void psgen_begin_graph(GVJ_t * job)
     setupLatin1 = FALSE;
 
     if (job->common->viewNum == 0) {
-        gvprintf(job, "%%%%Title: %s\n", obj->u.g->name);
+        gvprintf(job, "%%%%Title: %s\n", agnameof(obj->u.g));
        if (job->render.id != FORMAT_EPS)
             gvputs(job, "%%Pages: (atend)\n");
        else
@@ -176,7 +176,7 @@ static void psgen_begin_cluster(GVJ_t * job)
 {
     obj_state_t *obj = job->obj;
 
-    gvprintf(job, "%% %s\n", obj->u.sg->name);
+    gvprintf(job, "%% %s\n", agnameof(obj->u.g));
 
     gvputs(job, "gsave\n");
 }
index 0e1cd59310b39783c7dd4dbef33ecad8f002573d..c6e18491b266dc54f55a908cd57084deb1134065 100644 (file)
@@ -40,7 +40,6 @@
 #include "gvplugin_device.h"
 #include "gvio.h"
 #include "gvcint.h"
-#include "graph.h"
 #include "types.h"             /* need the SVG font name schemes */
 
 extern char *strdup_and_subst_obj(char *str, void *obj);
@@ -172,9 +171,9 @@ static void svg_begin_graph(GVJ_t * job)
     obj_state_t *obj = job->obj;
 
     gvputs(job, "<!--");
-    if (obj->u.g->name[0]) {
+    if (agnameof(obj->u.g)[0]) {
         gvputs(job, " Title: ");
-       gvputs(job, xml_string(obj->u.g->name));
+       gvputs(job, xml_string(agnameof(obj->u.g)));
     }
     gvprintf(job, " Pages: %d -->\n", job->pagesArraySize.x * job->pagesArraySize.y);
 
@@ -220,9 +219,9 @@ static void svg_begin_page(GVJ_t * job)
            job->scale.x, job->scale.y, -job->rotation,
            job->translation.x, -job->translation.y);
     /* default style */
-    if (obj->u.g->name[0]) {
+    if (agnameof(obj->u.g)[0]) {
         gvputs(job, "<title>");
-        gvputs(job, xml_string(obj->u.g->name));
+        gvputs(job, xml_string(agnameof(obj->u.g)));
         gvputs(job, "</title>\n");
     }
 }
@@ -240,7 +239,7 @@ static void svg_begin_cluster(GVJ_t * job)
     gvputs(job, xml_string(obj->id));
     gvputs(job, "\" class=\"cluster\">");
     gvputs(job, "<title>");
-    gvputs(job, xml_string(obj->u.sg->name));
+    gvputs(job, xml_string(agnameof(obj->u.g)));
     gvputs(job, "</title>\n");
 }
 
@@ -257,7 +256,7 @@ static void svg_begin_node(GVJ_t * job)
     gvputs(job, xml_string(obj->id));
     gvputs(job, "\" class=\"node\">");
     gvputs(job, "<title>");
-    gvputs(job, xml_string(obj->u.n->name));
+    gvputs(job, xml_string(agnameof(obj->u.n)));
     gvputs(job, "</title>\n");
 }
 
index 9d355eca6f79ef6c49786a04f8c39c33a67f9c59..48497baaa77539da70e82e303e8a44b84812c584 100644 (file)
@@ -31,7 +31,6 @@
 #include "gvplugin_device.h"
 #include "gvio.h"
 #include "gvcint.h"
-#include "graph.h"
 #include "types.h"             /* need the SVG font name schemes */
 
 typedef enum { FORMAT_TK, } format_type;
@@ -68,23 +67,23 @@ static void tkgen_print_tags(GVJ_t *job)
     switch (obj->emit_state) {
     case EMIT_NDRAW:
        ObjType = "node";
-        ObjId = obj->u.n->id;
+        ObjId = AGID(obj->u.n);
        break;
     case EMIT_NLABEL:
        ObjType = "node label";
-        ObjId = obj->u.n->id;
+        ObjId = AGID(obj->u.n);
        break;
     case EMIT_EDRAW:
     case EMIT_TDRAW:
     case EMIT_HDRAW:
        ObjType = "edge";
-        ObjId = obj->u.e->id;
+        ObjId = AGID(obj->u.e);
        break;
     case EMIT_ELABEL:
     case EMIT_TLABEL:
     case EMIT_HLABEL:
        ObjType = "edge label";
-        ObjId = obj->u.e->id;
+        ObjId = AGID(obj->u.e);
        break;
     case EMIT_GDRAW:
        ObjType = "graph";
@@ -96,11 +95,11 @@ static void tkgen_print_tags(GVJ_t *job)
        break;
     case EMIT_CDRAW:
        ObjType = "cluster";
-       ObjId = obj->u.sg->meta_node->id;
+       ObjId = AGID(obj->u.sg);
        break;
     case EMIT_CLABEL:
        ObjType = "cluster label";
-       ObjId = obj->u.sg->meta_node->id;
+       ObjId = AGID(obj->u.sg);
        break;
     default:
        assert (0);
@@ -142,9 +141,9 @@ static void tkgen_begin_graph(GVJ_t * job)
     obj_state_t *obj = job->obj;
 
     gvputs(job, "#");
-    if (obj->u.g->name[0]) {
+    if (agnameof(obj->u.g)[0]) {
         gvputs(job, " Title: ");
-       gvputs(job, tkgen_string(obj->u.g->name));
+       gvputs(job, tkgen_string(agnameof(obj->u.g)));
     }
     gvprintf(job, " Pages: %d\n", job->pagesArraySize.x * job->pagesArraySize.y);
 }
index 9f332331cc737e73a649f4b0b7d4ab7e5cb88788..24f2c9fbf21b7d4b444d4f0cbc6d46e0c1db3a0a 100644 (file)
@@ -28,7 +28,6 @@
 #include "gvplugin_render.h"
 #include "gvplugin_device.h"
 #include "gvio.h"
-#include "graph.h"
 
 typedef enum { FORMAT_VML, FORMAT_VMLZ, } format_type;
 
@@ -164,9 +163,9 @@ static void vml_begin_graph(GVJ_t * job)
     obj_state_t *obj = job->obj;
 
     gvputs(job, "<head>");
-    if (obj->u.g->name[0]) {
+    if (agnameof(obj->u.g)[0]) {
         gvputs(job, "<title>");
-       gvputs(job, xml_string(obj->u.g->name));
+       gvputs(job, xml_string(agnameof(obj->u.g)));
         gvputs(job, "</title>");
     }
     gvprintf(job, "<!-- Pages: %d -->\n</head>\n", job->pagesArraySize.x * job->pagesArraySize.y);