}
}
-static void dia_comment(void *obj, attrsym_t * sym)
+static void dia_comment(char *str)
{
- char *str = late_string(obj, sym, "");
- if (str[0]) {
- dia_fputs("<!-- ");
- /* FIXME - should check for --> sequences in str */
- dia_fputs(str);
- dia_fputs(" -->\n");
- }
+ dia_fputs("<!-- ");
+ /* FIXME - should check for --> sequences in str */
+ dia_fputs(str);
+ dia_fputs(" -->\n");
}
static void
Offset.y = GD_drawing(g)->margin.y * SCALE;
if (onetime) {
init_dia();
- dia_comment(g, agfindattr(g, "comment"));
onetime = FALSE;
}
dia_fputs
dia_ellipse, dia_polygon,
dia_bezier, dia_polyline,
1, /* bezier_has_arrows */
- 0, /* dia_comment */
+ dia_comment,
0, /* dia_textsize */
dia_user_shape,
0 /* dia_usershapesize */
if (ND_shape(n) == NULL)
return;
-#if 0
-fprintf(stderr,"node_in_layer %s node_in_pageBox %s state %s\n",
- node_in_layer(gvc, n->graph, n)?"true":"false",
- node_in_pageBox(gvc, n)?"true":"false",
- (ND_state(n) != gvc->pageNum)?"true":"false");
-#endif
if (node_in_layer(gvc, n->graph, n)
&& node_in_pageBox(gvc, n)
&& (ND_state(n) != gvc->pageNum)) {
+
+ gvrender_comment(gvc, n->name);
+
+ s = late_string(n, N_comment, "");
+ if (s[0])
+ gvrender_comment(gvc, s);
+
gvrender_begin_node(gvc, n);
if (((s = agget(n, "href")) && s[0])
|| ((s = agget(n, "URL")) && s[0])) {
char *s, *url = NULL, *label = NULL, *tooltip = NULL, *target = NULL;
textlabel_t *lab = NULL;
-#if 0
-fprintf(stderr,"edge_in_layer %s edge_in_pageBox %s\n",
- edge_in_layer(gvc, e->head->graph, e)?"true":"false",
- edge_in_pageBox(gvc, e)?"true":"false");
-#endif
-
if (! edge_in_pageBox(gvc, e) || ! edge_in_layer(gvc, e->head->graph, e))
return;
+ s = malloc(strlen(e->tail->name) + 2 + strlen(e->head->name) + 1);
+ strcpy(s,e->tail->name);
+ if (AG_IS_DIRECTED(e->tail->graph))
+ strcat(s,"->");
+ else
+ strcat(s,"--");
+ strcat(s,e->head->name);
+ gvrender_comment(gvc, s);
+ free(s);
+
+ s = late_string(e, E_comment, "");
+ if (s[0])
+ gvrender_comment(gvc, s);
+
gvrender_begin_edge(gvc, e);
if (((s = agget(e, "href")) && s[0])
|| ((s = agget(e, "URL")) && s[0])) {
if (gvc->pageNum == 0)
gvrender_begin_job(gvc);
+
+ s = late_string(g, agfindattr(g, "comment"), "");
+ gvrender_comment(gvc, s);
+
gvrender_begin_graph(gvc, g);
if (flags & EMIT_COLORS) {
gvrender_set_fillcolor(gvc, DEFAULT_FILL);
fprintf(Output_file, "\n");
}
-static void fig_comment(void *obj, attrsym_t * sym)
+static void fig_comment(char *str)
{
- char *str;
- str = late_string(obj, sym, "");
- if (str[0])
- fprintf(Output_file, "# %s\n", str);
+ fprintf(Output_file, "# %s\n", str);
}
static void
PB.UR.y);
#endif
init_fig();
- fig_comment(g, agfindattr(g, "comment"));
onetime = FALSE;
}
}
*/
}
-static void fig_begin_node(node_t * n)
-{
- fprintf(Output_file, "# %s\n", n->name);
- fig_comment(n, N_comment);
-}
-
-
-static void fig_begin_edge(edge_t * e)
-{
- fprintf(Output_file, "# %s -> %s\n", e->tail->name, e->head->name);
- fig_comment(e, E_comment);
-}
-
static void fig_begin_context(void)
{
assert(SP + 1 < MAXNEST);
fig_begin_job, fig_end_job,
fig_begin_graph, 0, /* fig_end_graph */
fig_begin_page, 0, /* fig_end_page */
- 0 /* fig_begin_layer */ , 0 /* fig_end_layer */ ,
- 0, /* fig_begin_cluster */ 0, /* fig_end_cluster */
+ 0, /* fig_begin_layer */ 0, /* fig_end_layer */
+ 0, /* fig_begin_cluster */ 0, /* fig_end_cluster */
0, /* fig_begin_nodes */ 0, /* fig_end_nodes */
0, /* fig_begin_edges */ 0, /* fig_end_edges */
- fig_begin_node, 0, /* fig_end_node */
- fig_begin_edge, 0, /* fig_end_edge */
+ 0, /* fig_begin_node */ 0, /* fig_end_node */
+ 0, /* fig_begin_edge */ 0, /* fig_end_edge */
fig_begin_context, fig_end_context,
0, /* fig_begin_anchor */ 0, /* fig_end_anchor */
fig_set_font, fig_textline,
fig_ellipse, fig_polygon,
fig_bezier, fig_polyline,
0, /* bezier_has_arrows */
- 0, /* fig_comment */
+ fig_comment,
0, /* fig_textsize */
fig_user_shape,
0 /* fig_usershapesize */
cp->pen, cp->fill, cp->penwidth);
}
-static void mif_comment(void *obj, attrsym_t * sym)
+static void mif_comment(char *str)
{
- char *str;
- str = late_string(obj, sym, "");
- if (str[0])
- fprintf(Output_file, "# %s\n", str);
+ fprintf(Output_file, "# %s\n", str);
}
static void
fprintf(Output_file, "<BRect %d %d %d %d>\n",
PB.LL.x, PB.UR.y, PB.UR.x - PB.LL.x, PB.UR.y - PB.LL.y);
init_mif();
- mif_comment(g, agfindattr(g, "comment"));
onetime = FALSE;
}
}
14 * Scale);
}
-static void mif_begin_node(node_t * n)
-{
- fprintf(Output_file, "# %s\n", n->name);
- mif_comment(n, N_comment);
-}
-
-static void mif_begin_edge(edge_t * e)
-{
- fprintf(Output_file, "# %s -> %s\n", e->tail->name, e->head->name);
- mif_comment(e, E_comment);
-}
-
static void mif_begin_context(void)
{
assert(SP + 1 < MAXNEST);
mif_begin_graph, 0, /* mif_end_graph */
mif_begin_page, 0, /* mif_end_page */
0, /* mif_begin_layer */ 0, /* mif_end_layer */
- 0, /* mif_begin_cluster */ 0, /* mif_end_cluster */
+ 0, /* mif_begin_cluster */ 0, /* mif_end_cluster */
0, /* mif_begin_nodes */ 0, /* mif_end_nodes */
0, /* mif_begin_edges */ 0, /* mif_end_edges */
- mif_begin_node, 0, /* mif_end_node */
- mif_begin_edge, 0, /* mif_end_edge */
+ 0, /* mif_begin_node */ 0, /* mif_end_node */
+ 0, /* mif_begin_edge */ 0, /* mif_end_edge */
mif_begin_context, mif_end_context,
0, /* mif_begin_anchor */ 0, /* mif_end_anchor */
mif_set_font, mif_textline,
mif_ellipse, mif_polygon,
mif_bezier, mif_polyline,
0, /* bezier_has_arrows */
- 0, /* mif_comment */
+ mif_comment,
0, /* mif_textsize */
mif_user_shape,
0 /* mif_usershapesize */
fprintf(Output_file, "%% \n");
}
-static void mp_comment(void *obj, attrsym_t * sym)
+static void mp_comment(char *str)
{
- char *str;
- str = late_string(obj, sym, "");
- if (str[0])
- fprintf(Output_file, "%% %s\n", str);
+ fprintf(Output_file, "%% %s\n", str);
}
static void mp_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
if (onetime) {
fprintf(Output_file, "%% BoundingBox: %d %d %d %d\n",
bb.LL.x, bb.LL.y, bb.UR.x + 1, bb.UR.y + 1);
- mp_comment(g, agfindattr(g, "comment"));
/* cat_libfile(Output_file,U_lib,mp_lib); */
onetime = FALSE;
}
S[SP].size = 0.0;
}
-static void mp_begin_node(node_t * n)
-{
- fprintf(Output_file, "%% GV node: \n%% %s\n", n->name);
- mp_comment(n, N_comment);
-}
-
-static void mp_begin_edge(edge_t * e)
-{
- fprintf(Output_file, "%% GV edge: \n%% %s -> %s\n", e->tail->name,
- e->head->name);
- mp_comment(e, E_comment);
-}
-
static void mp_begin_context(void)
{
if (SP == STACKSIZE - 1)
0, /* mp_begin_cluster */ 0, /* mp_end_cluster */
0, /* mp_begin_nodes */ 0, /* mp_end_nodes */
0, /* mp_begin_edges */ 0, /* mp_end_edges */
- mp_begin_node, 0, /* mp_end_node */
- mp_begin_edge, 0, /* mp_end_edge */
+ 0, /* mp_begin_node */ 0, /* mp_end_node */
+ 0, /* mp_begin_edge */ 0, /* mp_end_edge */
mp_begin_context, mp_end_context,
0, /* mp_begin_anchor */ 0, /* mp_end_anchor */
mp_set_font, mp_textline,
fprintf(Output_file, "move to P%d; line attrs%d to P%d then to P%d\n", i, SP, i + 1, i + 2); /* use line, as splines can't be dotted or dashed */
}
-static void pic_comment(void *obj, attrsym_t * sym)
+static void pic_comment(char *str)
{
- char *str;
-
- str = late_string(obj, sym, "");
- if (str[0])
- fprintf(Output_file, "'\\\" %s\n", str);
+ fprintf(Output_file, "'\\\" %s\n", str);
}
codegen_t PIC_CodeGen = {
fprintf(Output_file, "%%%%EOF\n");
}
-static void ps_comment(void *obj, attrsym_t * sym)
+static void ps_comment(char *str)
{
- char *str;
- str = late_string(obj, sym, "");
- if (str[0])
- fprintf(Output_file, "%% %s\n", str);
+ fprintf(Output_file, "%% %s\n", str);
}
static void ps_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
if (Show_boxes == NULL)
fprintf(Output_file, "%%%%BoundingBox: %d %d %d %d\n",
0, 0, sz.x, sz.y);
- ps_comment(g, agfindattr(g, "comment"));
fprintf(Output_file, "%%%%EndComments\nsave\n");
cat_libfile(Output_file, U_lib, ps_txt);
epsf_define(Output_file);
static void ps_begin_node(node_t * n)
{
Curnode = n;
- fprintf(Output_file, "\n%%\t%s\n", n->name);
- ps_comment(n, N_comment);
/* Embed information for Distiller to generate hyperlinked PDF */
map_begin_node(n);
static void ps_begin_edge(edge_t * e)
{
- fprintf(Output_file, "\n%%\t%s -> %s\n", e->tail->name, e->head->name);
- ps_comment(e, E_comment);
-
/* Embed information for Distiller, so it can generate hyperactive PDF */
map_begin_edge(e);
}
svg_fputs("\"");
}
-static void svg_comment(void *obj, attrsym_t * sym)
+static void svg_comment(char *str)
{
- char *str = late_string(obj, sym, "");
- if (str[0]) {
- svg_fputs("<!-- ");
- svg_fputs(xml_string(str));
- svg_fputs(" -->\n");
- }
+ svg_fputs("<!-- ");
+ svg_fputs(xml_string(str));
+ svg_fputs(" -->\n");
}
static void
PB.UR.y);
#endif
init_svg();
- svg_comment(g, agfindattr(g, "comment"));
onetime = FALSE;
}
if (dpi < 1.0)
static void svg_begin_node(node_t * n)
{
Curnode = n;
-#if 0
- svg_printf("<!-- %s -->\n", n->name);
- svg_comment(n, N_comment);
-#endif
svg_printf("<g id=\"%s%d\" class=\"node\">", op[Obj], n->id);
svg_fputs("<title>");
svg_fputs(xml_string(n->name));
svg_ellipse, svg_polygon,
svg_bezier, svg_polyline,
0, /* bezier_has_arrows */
- 0, /* svg_comment */
+ svg_comment,
0, /* svg_textsize */
svg_user_shape,
0 /* svg_usershape_size */
int arrow_at_end);
void (*polyline) (point * A, int n);
boolean bezier_has_arrows;
- void (*comment) (void *obj, attrsym_t * sym);
+ void (*comment) (char *str);
void (*textsize) (void); /* not used */
void (*user_shape) (char *name, point * A, int sides, int filled);
void (*usershapesize) (void); /* not used */
*/
}
-static void vtx_comment(void *obj, attrsym_t * sym)
+static void vtx_comment(char *str)
{
- char *str;
- str = late_string(obj, sym, "");
- if (str[0])
- fprintf(Output_file, "; %s\n", str);
+ fprintf(Output_file, "; %s\n", str);
}
static void
/* PB = bb; */
if (onetime) {
init_vtx();
- vtx_comment(g, agfindattr(g, "comment"));
onetime = FALSE;
}
}
extern void gvrender_beziercurve(GVC_t * gvc, pointf * AF, int n,
int arrow_at_start, int arrow_at_end);
extern void gvrender_polyline(GVC_t * gvc, point * A, int n);
- extern void gvrender_comment(GVC_t * gvc, void *obj, attrsym_t * sym);
+ extern void gvrender_comment(GVC_t * gvc, char *str);
extern void gvrender_user_shape(GVC_t * gvc, char *name, point * A,
int sides, int filled);
else {
config_text[sz] = '\0'; /* make input into a null terminated string */
gvconfig_plugin_install_from_config(gvc, config_text);
- /* NB. config_text not freed becasue we retain char* into it */
+ /* NB. config_text not freed because we retain char* into it */
}
}
}
#endif
}
-void gvrender_comment(GVC_t * gvc, void *obj, attrsym_t * sym)
+void gvrender_comment(GVC_t * gvc, char *str)
{
gvrender_job_t *job = gvc->job;
gvrender_engine_t *gvre = job->render_engine;
+ if (!str || !str[0])
+ return;
+
if (gvre && gvre->comment) {
- if (sym)
- gvre->comment(job, agxget(obj, sym->index));
+ gvre->comment(job, str);
}
#ifndef DISABLE_CODEGENS
else {
codegen_t *cg = job->codegen;
if (cg && cg->comment)
- cg->comment(obj, sym);
+ cg->comment(str);
}
#endif
}