From: ellson Date: Sun, 11 Jun 2006 19:59:03 +0000 (+0000) Subject: I give up. Plugins need access to graph types. Just don't pull in any X-Git-Tag: LAST_LIBGRAPH~32^2~6450 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fe8b9b859a6fc78bca9b2ecaac6a58eed4d347b;p=graphviz I give up. Plugins need access to graph types. Just don't pull in any graph functions so that plugins have dependencies on graph libraries. Clean up header inclusions. --- diff --git a/lib/gvc/gvplugin_render.h b/lib/gvc/gvplugin_render.h index 9d916cb90..1e7c43d89 100644 --- a/lib/gvc/gvplugin_render.h +++ b/lib/gvc/gvplugin_render.h @@ -14,13 +14,12 @@ * 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 */ diff --git a/lib/gvc/gvplugin_textlayout.h b/lib/gvc/gvplugin_textlayout.h index b9a91b302..b9a648ec9 100644 --- a/lib/gvc/gvplugin_textlayout.h +++ b/lib/gvc/gvplugin_textlayout.h @@ -14,12 +14,12 @@ * 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 */ diff --git a/lib/gvc/gvrender.c b/lib/gvc/gvrender.c index 20cc15a23..e8bbe857b 100644 --- a/lib/gvc/gvrender.c +++ b/lib/gvc/gvrender.c @@ -27,11 +27,10 @@ #include #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) diff --git a/lib/gvc/gvtextlayout.c b/lib/gvc/gvtextlayout.c index 6678e64e8..86aa97e6f 100644 --- a/lib/gvc/gvtextlayout.c +++ b/lib/gvc/gvtextlayout.c @@ -23,7 +23,6 @@ #endif #include "const.h" -#include "types.h" #include "gvplugin_textlayout.h" #include "gvcint.h" #include "gvcproc.h" diff --git a/lib/gvc/gvusershape.c b/lib/gvc/gvusershape.c index 884ddf07e..3679a1dc6 100644 --- a/lib/gvc/gvusershape.c +++ b/lib/gvc/gvusershape.c @@ -19,7 +19,6 @@ #endif #include -#include #include #include "types.h" diff --git a/plugin/core/gvplugin_core.c b/plugin/core/gvplugin_core.c index c6e04bb50..d311e2fb6 100644 --- a/plugin/core/gvplugin_core.c +++ b/plugin/core/gvplugin_core.c @@ -16,11 +16,11 @@ #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}, }; diff --git a/plugin/core/gvrender_core_ps.c b/plugin/core/gvrender_core_ps.c index f06806fff..2557d7b32 100644 --- a/plugin/core/gvrender_core_ps.c +++ b/plugin/core/gvrender_core_ps.c @@ -21,7 +21,6 @@ #include #include #include -#include #ifdef HAVE_LIBZ #include @@ -33,9 +32,11 @@ #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 */ diff --git a/plugin/core/gvrender_core_svg.c b/plugin/core/gvrender_core_svg.c index 238936976..664593e11 100644 --- a/plugin/core/gvrender_core_svg.c +++ b/plugin/core/gvrender_core_svg.c @@ -21,7 +21,6 @@ #include #include #include -#include #ifdef HAVE_LIBZ #include @@ -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, "\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, ""); - svggen_fputs(job, xml_string(job->common->graph_name)); + svggen_fputs(job, xml_string(job->g->name)); svggen_fputs(job, "\n"); } } @@ -326,9 +326,10 @@ static void svggen_end_page(GVJ_t * job) static void svggen_begin_cluster(GVJ_t * job) { - svggen_printf(job, "", job->common->cluster_id); + svggen_printf(job, "", + job->sg->meta_node->id); svggen_fputs(job, ""); - svggen_fputs(job, xml_string(job->common->cluster_name)); + svggen_fputs(job, xml_string(job->sg->name)); svggen_fputs(job, "\n"); } @@ -339,9 +340,9 @@ static void svggen_end_cluster(GVJ_t * job) static void svggen_begin_node(GVJ_t * job) { - svggen_printf(job, "", job->common->node_id); + svggen_printf(job, "", job->n->id); svggen_fputs(job, ""); - svggen_fputs(job, xml_string(job->common->node_name)); + svggen_fputs(job, xml_string(job->n->name)); svggen_fputs(job, "\n"); } @@ -355,17 +356,17 @@ svggen_begin_edge(GVJ_t * job) { char *edgeop; - svggen_printf(job, "", job->common->edge_id); - if (job->common->edge_directed) + svggen_printf(job, "", job->e->id); + if (job->e->tail->graph->root->kind & AGFLAG_DIRECTED) edgeop = "->"; else edgeop = "--"; svggen_fputs(job, ""); - 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, "\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 */