]> granicus.if.org Git - graphviz/commitdiff
I give up. Plugins need access to graph types. Just don't pull in any
authorellson <devnull@localhost>
Sun, 11 Jun 2006 19:59:03 +0000 (19:59 +0000)
committerellson <devnull@localhost>
Sun, 11 Jun 2006 19:59:03 +0000 (19:59 +0000)
graph functions so that plugins have dependencies on graph libraries.

Clean up header inclusions.

lib/gvc/gvplugin_render.h
lib/gvc/gvplugin_textlayout.h
lib/gvc/gvrender.c
lib/gvc/gvtextlayout.c
lib/gvc/gvusershape.c
plugin/core/gvplugin_core.c
plugin/core/gvrender_core_ps.c
plugin/core/gvrender_core_svg.c

index 9d916cb90b06a5541aa2be49c569fe1f971c69fc..1e7c43d89ec41f40e5dfe635bbec27a5921587e6 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-#ifndef GVRENDER_PLUGIN_H
-#define GVRENDER_PLUGIN_H
+#ifndef GVPLUGIN_RENDER_H
+#define GVPLUGIN_RENDER_H
 
+#include "types.h"
 #include "gvplugin.h"
 #include "gvcjob.h"
-#include "textpara.h"
-#include "usershape.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -63,4 +62,4 @@ extern "C" {
 #ifdef __cplusplus
 }
 #endif
-#endif                         /* GVRENDER_PLUGIN_H */
+#endif                         /* GVPLUGIN_RENDER_H */
index b9a91b302a00f2bfbebf42e02d9944a42d2767cf..b9a648ec99ff65b659a6c0dbeef09824f9f0dbd4 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 
-#ifndef GVTEXTLAYOUT_PLUGIN_H
-#define GVTEXTLAYOUT_PLUGIN_H
+#ifndef GVPLUGIN_TEXTLAYOUT_H
+#define GVPLUGIN_TEXTLAYOUT_H
 
+#include "types.h"
 #include "gvplugin.h"
 #include "gvcjob.h"
-#include "textpara.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -32,4 +32,4 @@ extern "C" {
 #ifdef __cplusplus
 }
 #endif
-#endif                         /* GVTEXTLAYOUT_PLUGIN_H */
+#endif                         /* GVPLUGIN_TEXTLAYOUT_H */
index 20cc15a23eb9bd1084985f377ca87ba2a0a79fb0..e8bbe857be2fff9c30ab351305c5b53f8841193d 100644 (file)
 #include <string.h>
 #include "memory.h"
 #include "const.h"
-#include "types.h"
 #include "macros.h"
+#include "gvplugin_render.h"
 #include "globals.h"
 #include "graph.h"
-#include "gvplugin_render.h"
 #include "gvcint.h"
 #include "colorprocs.h"
 #include "gvcproc.h"
@@ -245,9 +244,8 @@ void gvrender_begin_graph(GVJ_t * job, graph_t * g)
     sx = job->width / (job->zoom * 2.);
     sy = job->height / (job->zoom * 2.);
 
-    gvc->sg = g;  /* current subgraph/cluster */
     job->common->objtype = "graph";
-    job->common->graph_name = g->name;
+    job->g = g; /* current graph */
     job->compscale.x = job->zoom * job->dpi.x / POINTS_PER_INCH;
     job->compscale.y = job->zoom * job->dpi.y / POINTS_PER_INCH;
     job->compscale.y *= (job->flags & GVRENDER_Y_GOES_DOWN) ? -1. : 1.;
@@ -316,7 +314,7 @@ void gvrender_end_graph(GVJ_t * job)
            cg->end_graph();
     }
 #endif
-    job->gvc->sg = NULL;
+    job->sg = NULL;
 }
 
 void gvrender_begin_page(GVJ_t * job)
@@ -391,13 +389,11 @@ void gvrender_begin_cluster(GVJ_t * job, graph_t * sg)
 {
     gvrender_engine_t *gvre = job->render.engine;
 
-    job->gvc->sg = sg;  /* set current cluster graph object */
+    job->sg = sg;  /* set current cluster graph object */
 #ifdef WITH_CODEGENS
     Obj = CLST;
 #endif
     job->common->objtype = "cluster";
-    job->common->cluster_name = sg->name;
-    job->common->cluster_id = sg->meta_node->id;
     if (gvre && gvre->begin_cluster)
        gvre->begin_cluster(job);
 #ifdef WITH_CODEGENS
@@ -425,7 +421,7 @@ void gvrender_end_cluster(GVJ_t * job, graph_t *g)
     }
     Obj = NONE;
 #endif
-    job->gvc->sg = g;  /* reset current cluster to parent graph or cluster */
+    job->sg = g;  /* reset current cluster to parent graph or cluster */
 }
 
 void gvrender_begin_nodes(GVJ_t * job)
@@ -500,9 +496,7 @@ void gvrender_begin_node(GVJ_t * job, node_t * n)
     Obj = NODE;
 #endif
     job->common->objtype = "node";
-    job->common->node_name = n->name;
-    job->common->node_id = n->id;
-    job->gvc->n = n; /* set current node */
+    job->n = n; /* set current node */
     if (gvre && gvre->begin_node)
        gvre->begin_node(job);
 #ifdef WITH_CODEGENS
@@ -530,7 +524,7 @@ void gvrender_end_node(GVJ_t * job)
     }
     Obj = NONE;
 #endif
-    job->gvc->n = NULL; /* clear current node */
+    job->n = NULL; /* clear current node */
 }
 
 void gvrender_begin_edge(GVJ_t * job, edge_t * e)
@@ -541,13 +535,7 @@ void gvrender_begin_edge(GVJ_t * job, edge_t * e)
     Obj = EDGE;
 #endif
     job->common->objtype = "edge";
-    job->common->edge_tailname = e->tail->name;
-    job->common->edge_tailid = e->tail->id;
-    job->common->edge_headname = e->head->name;
-    job->common->edge_headid = e->head->id;
-    job->common->edge_directed = e->tail->graph->root->kind & AGFLAG_DIRECTED;
-    job->common->edge_id = e->id;
-    job->gvc->e = e; /* set current edge */
+    job->e = e; /* set current edge */
     if (gvre && gvre->begin_edge)
        gvre->begin_edge(job);
 #ifdef WITH_CODEGENS
@@ -575,7 +563,7 @@ void gvrender_end_edge(GVJ_t * job)
     }
     Obj = NONE;
 #endif
-    job->gvc->e = NULL; /* clear current edge */
+    job->e = NULL; /* clear current edge */
 }
 
 void gvrender_begin_context(GVJ_t * job)
index 6678e64e8f06d36adcb3c760f5949595bbda177a..86aa97e6ff52ed5867ca61378da1a52b910c7edb 100644 (file)
@@ -23,7 +23,6 @@
 #endif
 
 #include "const.h"
-#include "types.h"
 #include "gvplugin_textlayout.h"
 #include "gvcint.h"
 #include "gvcproc.h"
index 884ddf07e454d2befd11cd7e3a9904b264628706..3679a1dc60270cbcc5095781a1723c43b5a368d5 100644 (file)
@@ -19,7 +19,6 @@
 #endif
 
 #include <stddef.h>
-#include <stdlib.h>
 #include <string.h>
 
 #include "types.h"
index c6e04bb506257690b2235ef34a00ca72211b7510..d311e2fb6f11b21878ae33fe51a6bdeae62342eb 100644 (file)
 
 #include "gvplugin.h"
 
-//extern gvplugin_installed_t gvrender_core_ps_types;
+extern gvplugin_installed_t gvrender_core_ps_types;
 extern gvplugin_installed_t gvrender_core_svg_types;
 
 static gvplugin_api_t apis[] = {
-//    {API_render, &gvrender_core_ps_types},
+    {API_render, &gvrender_core_ps_types},
     {API_render, &gvrender_core_svg_types},
     {(api_t)0, 0},
 };
index f06806fff8eae6e65e64ed6c594d1f6a0137c41c..2557d7b3257282d419c147922d7414d7e0584136 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 
 #ifdef HAVE_LIBZ
 #include <zlib.h>
 #undef HAVE_LIBGD
 
 #include "gvplugin_render.h"
+#include "graph.h"
+#if 0
+/* FIXME - gv_ps_txt collides in multiple ps renderers */
 #include "gv_ps.h"
-#include "const.h"
-#include "macros.h"
+#endif
 #ifdef HAVE_LIBGD
 #include "gd.h"
 #endif
@@ -84,12 +85,15 @@ static void psgen_begin_graph(GVJ_t * job)
     setupLatin1 = FALSE;
 
     if (job->common->viewNum == 0) {
-        fprintf(job->output_file, "%%%%Title: %s\n", job->common->graphname);
+        fprintf(job->output_file, "%%%%Title: %s\n", job->g->name);
         fprintf(job->output_file, "%%%%Pages: (atend)\n");
         if (job->common->show_boxes == NULL)
             fprintf(job->output_file, "%%%%BoundingBox: (atend)\n");
         fprintf(job->output_file, "%%%%EndComments\nsave\n");
+#if 0
+/* FIXME - gv_ps_txt collides in multiple ps renderers */
         cat_libfile(job->output_file, job->common->lib, gv_ps_txt);
+#endif
         epsf_define(job->output_file);
     }
 #ifdef FIXME
@@ -204,9 +208,9 @@ static void psgen_end_page(GVJ_t * job)
     fprintf(job->output_file, "%%%%EndPage: %d\n", job->common->viewNum);
 }
 
-static void psgen_begin_cluster(GVJ_t * job, char *clustername, long id)
+static void psgen_begin_cluster(GVJ_t * job)
 {
-    fprintf(job->output_file, "%% %s\n", clustername);
+    fprintf(job->output_file, "%% %s\n", job->sg->name);
 
 #if 0
     /*  Embed information for Distiller to generate hyperlinked PDF  */
@@ -231,7 +235,8 @@ psgen_begin_edge(GVJ_t * job)
 #endif
 }
 
-static void psgen_begin_anchor(GVJ_t * job, char *href, char *tooltip, char *target)
+static void
+psgen_begin_anchor(GVJ_t * job, char *href, char *tooltip, char *target)
 {
 #if 0
     if (href && href[0]) 
@@ -279,7 +284,7 @@ static void ps_set_color(GVJ_t *job, gvcolor_t *color)
          || last_color.u.HSV[1] != color->u.HSV[1]
          || last_color.u.HSV[2] != color->u.HSV[2]) {
            fprintf(job->output_file, "%.3f %.3f %.3f %scolor\n",
-               color->u.HSV[0], color->u.HSV[1], color->u.HSV[2], job->objname);
+               color->u.HSV[0], color->u.HSV[1], color->u.HSV[2], job->common->objtype);
            last_color.u.HSV[0] = color->u.HSV[0];
            last_color.u.HSV[1] = color->u.HSV[1];
            last_color.u.HSV[2] = color->u.HSV[2];
@@ -656,7 +661,7 @@ static gvrender_engine_t psgen_engine = {
 static gvrender_features_t psgen_features = {
     GVRENDER_DOES_MULTIGRAPH_OUTPUT_FILES
        | GVRENDER_DOES_TRANSFORM,
-    DEFAULT_PRINT_MARGIN,      /* default margin - points */
+    36,                                /* default margin - points */
     {72.,72.},                 /* default dpi */
     NULL,                      /* knowncolors */
     0,                         /* sizeof knowncolors */
index 238936976cd41b1e891468a466e48fc15480d42f..664593e11313c334759e4a168998c2536455b281 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 
 #ifdef HAVE_LIBZ
 #include <zlib.h>
@@ -34,6 +33,7 @@
 #include "const.h"
 
 #include "gvplugin_render.h"
+#include "graph.h"
 
 typedef enum { FORMAT_SVG, FORMAT_SVGZ, } format_type;
 
@@ -244,9 +244,9 @@ static void svggen_begin_job(GVJ_t * job)
 static void svggen_begin_graph(GVJ_t * job)
 {
     svggen_fputs(job, "<!--");
-    if (job->common->graph_name[0]) {
+    if (job->g->name[0]) {
         svggen_fputs(job, " Title: ");
-       svggen_fputs(job, xml_string(job->common->graph_name));
+       svggen_fputs(job, xml_string(job->g->name));
     }
     svggen_printf(job, " Pages: %d -->\n", job->pagesArraySize.x * job->pagesArraySize.y);
 
@@ -312,9 +312,9 @@ static void svggen_begin_page(GVJ_t * job)
     svggen_fputs(job, " style=\"font-family:");
     svggen_fputs(job, job->style->fontfam);
     svggen_printf(job, ";font-size:%.2f;\">\n", job->style->fontsz);
-    if (job->common->graph_name[0]) {
+    if (job->g->name[0]) {
         svggen_fputs(job, "<title>");
-        svggen_fputs(job, xml_string(job->common->graph_name));
+        svggen_fputs(job, xml_string(job->g->name));
         svggen_fputs(job, "</title>\n");
     }
 }
@@ -326,9 +326,10 @@ static void svggen_end_page(GVJ_t * job)
 
 static void svggen_begin_cluster(GVJ_t * job)
 {
-    svggen_printf(job, "<g id=\"cluster%ld\" class=\"cluster\">", job->common->cluster_id);
+    svggen_printf(job, "<g id=\"cluster%ld\" class=\"cluster\">",
+           job->sg->meta_node->id);
     svggen_fputs(job, "<title>");
-    svggen_fputs(job, xml_string(job->common->cluster_name));
+    svggen_fputs(job, xml_string(job->sg->name));
     svggen_fputs(job, "</title>\n");
 }
 
@@ -339,9 +340,9 @@ static void svggen_end_cluster(GVJ_t * job)
 
 static void svggen_begin_node(GVJ_t * job)
 {
-    svggen_printf(job, "<g id=\"node%ld\" class=\"node\">", job->common->node_id);
+    svggen_printf(job, "<g id=\"node%ld\" class=\"node\">", job->n->id);
     svggen_fputs(job, "<title>");
-    svggen_fputs(job, xml_string(job->common->node_name));
+    svggen_fputs(job, xml_string(job->n->name));
     svggen_fputs(job, "</title>\n");
 }
 
@@ -355,17 +356,17 @@ svggen_begin_edge(GVJ_t * job)
 {
     char *edgeop;
 
-    svggen_printf(job, "<g id=\"edge%ld\" class=\"edge\">", job->common->edge_id);
-    if (job->common->edge_directed)
+    svggen_printf(job, "<g id=\"edge%ld\" class=\"edge\">", job->e->id);
+    if (job->e->tail->graph->root->kind & AGFLAG_DIRECTED)
        edgeop = "&#45;&gt;";
     else
        edgeop = "&#45;&#45;";
     svggen_fputs(job, "<title>");
-    svggen_fputs(job, xml_string(job->common->edge_tailname));
+    svggen_fputs(job, xml_string(job->e->tail->name));
     svggen_fputs(job, edgeop);
     /* can't do this in single svggen_printf because
      * xml_string's buffer gets reused. */
-    svggen_fputs(job, xml_string(job->common->edge_headname));
+    svggen_fputs(job, xml_string(job->e->head->name));
     svggen_fputs(job, "</title>\n");
 }
 
@@ -470,7 +471,7 @@ static void svggen_polyline(GVJ_t * job, pointf * A, int n)
 }
 
 static void
-svggen_usershape(GVJ_t * job, usershape_t *us, boxf b, int filled)
+svggen_usershape(GVJ_t * job, usershape_t *us, boxf b, bool filled)
 {
     if (job->style->pen == PEN_NONE) {
        /* its invisible, don't draw */