* src/vcg.c (open_edge, close_edge, open_node, close_node): Change

to output informations in fout (FILE*).
(open_graph, close_graph): Likewise.
(output_graph, output_edge, output_node): Likewise.
* src/vcg.h: Update function prototypes.
* src/print_graph.c (print_graph): Open output graph file.
(print_actions): Adjust.
* src/files.h: Remove extern declaration.
* src/files.c: Remove graph_obstack declaration.
(open_files): Remove graph_obstack initialization.
(output_files): Remove graph_obstack saving.
This commit is contained in:
Marc Autret
2001-09-24 15:54:18 +00:00
parent 330de47708
commit 9190f3e726
6 changed files with 215 additions and 211 deletions

View File

@@ -1,3 +1,17 @@
2001-09-24 Marc Autret <autret_m@epita.fr>
* src/vcg.c (open_edge, close_edge, open_node, close_node): Change
to output informations in fout (FILE*).
(open_graph, close_graph): Likewise.
(output_graph, output_edge, output_node): Likewise.
* src/vcg.h: Update function prototypes.
* src/print_graph.c (print_graph): Open output graph file.
(print_actions): Adjust.
* src/files.h: Remove extern declaration.
* src/files.c: Remove graph_obstack declaration.
(open_files): Remove graph_obstack initialization.
(output_files): Remove graph_obstack saving.
2001-09-24 Marc Autret <autret_m@epita.fr> 2001-09-24 Marc Autret <autret_m@epita.fr>
* src/files.c (compute_output_file_names): Fix. * src/files.c (compute_output_file_names): Fix.

View File

@@ -34,7 +34,6 @@ struct obstack table_obstack;
struct obstack defines_obstack; struct obstack defines_obstack;
struct obstack guard_obstack; struct obstack guard_obstack;
struct obstack output_obstack; struct obstack output_obstack;
struct obstack graph_obstack;
char *spec_outfile = NULL; /* for -o. */ char *spec_outfile = NULL; /* for -o. */
char *spec_file_prefix = NULL; /* for -b. */ char *spec_file_prefix = NULL; /* for -b. */
@@ -442,7 +441,6 @@ open_files (void)
obstack_init (&defines_obstack); obstack_init (&defines_obstack);
obstack_init (&guard_obstack); obstack_init (&guard_obstack);
obstack_init (&output_obstack); obstack_init (&output_obstack);
obstack_init (&graph_obstack);
} }
@@ -491,7 +489,4 @@ output_files (void)
#endif /* MSDOS */ #endif /* MSDOS */
obstack_save (&guard_obstack, temp_name); obstack_save (&guard_obstack, temp_name);
} }
if (graph_flag)
obstack_save (&graph_obstack, spec_graph_file);
} }

View File

@@ -65,9 +65,6 @@ extern struct obstack guard_obstack;
/* The verbose output. */ /* The verbose output. */
extern struct obstack output_obstack; extern struct obstack output_obstack;
/* The VCG graph output. */
extern struct obstack graph_obstack;
extern char *infile; extern char *infile;
extern char *attrsfile; extern char *attrsfile;

View File

@@ -35,6 +35,7 @@
#include "quotearg.h" #include "quotearg.h"
static graph_t graph; static graph_t graph;
static FILE *fgraph = NULL;
static size_t node_output_size = 0; static size_t node_output_size = 0;
@@ -136,7 +137,7 @@ print_actions (int state, const char *node_name, struct obstack *node_obstack)
if (state > state1) if (state > state1)
edge.type = back_edge; edge.type = back_edge;
open_edge (&edge, &graph_obstack); open_edge (&edge, fgraph);
/* The edge source is the current node. */ /* The edge source is the current node. */
edge.sourcename = node_name; edge.sourcename = node_name;
sprintf (buff, "%d", state1); sprintf (buff, "%d", state1);
@@ -145,8 +146,8 @@ print_actions (int state, const char *node_name, struct obstack *node_obstack)
/* FIXME: Be aware that quote uses static memory. The string /* FIXME: Be aware that quote uses static memory. The string
must be output immediately (which is the case here). */ must be output immediately (which is the case here). */
edge.label = tags[symbol] ? quote (tags[symbol]) : NULL; edge.label = tags[symbol] ? quote (tags[symbol]) : NULL;
output_edge (&edge, &graph_obstack); output_edge (&edge, fgraph);
close_edge (&graph_obstack); close_edge (fgraph);
} }
} }
} }
@@ -198,14 +199,14 @@ print_actions (int state, const char *node_name, struct obstack *node_obstack)
symbol = accessing_symbol[state1]; symbol = accessing_symbol[state1];
new_edge (&edge); new_edge (&edge);
open_edge (&edge, &graph_obstack); open_edge (&edge, fgraph);
edge.sourcename = node_name; edge.sourcename = node_name;
sprintf (buff, "%d", state1); sprintf (buff, "%d", state1);
edge.targetname = buff; edge.targetname = buff;
edge.color = red; edge.color = red;
edge.label = tags[symbol] ? quote (tags[symbol]) : NULL; edge.label = tags[symbol] ? quote (tags[symbol]) : NULL;
output_edge (&edge, &graph_obstack); output_edge (&edge, fgraph);
close_edge (&graph_obstack); close_edge (fgraph);
} }
} }
} }
@@ -223,9 +224,6 @@ print_state (int state)
new_node (&node); /* Set node attributs default value. */ new_node (&node); /* Set node attributs default value. */
sprintf (name, "%d", state); sprintf (name, "%d", state);
node.title = name; /* Give a name to the node. */ node.title = name; /* Give a name to the node. */
open_node (&node_obstack);
/* Output a VCG formatted attributs list. */
output_node (&node, &node_obstack);
{ {
/* Here we begin to compute the node label. */ /* Here we begin to compute the node label. */
@@ -241,20 +239,17 @@ print_state (int state)
print_actions (state, node.title, &node_obstack); print_actions (state, node.title, &node_obstack);
obstack_sgrow (&node_obstack, "\"\n"); /* Close Label. */ obstack_sgrow (&node_obstack, "\"\n"); /* Close Label. */
close_node (&node_obstack);
} }
/* `obstack_cat' NODE_OBSTACK to GRAPH_OBSTACK. */ open_node (fgraph);
{ /* Output a VCG formatted attributs list. */
size_t obs_size; output_node (&node, fgraph);
/* Save the node label. */
fwrite (obstack_base (&node_obstack),
obstack_object_size (&node_obstack), 1, fgraph);
close_node (fgraph);
obs_size = obstack_object_size (&node_obstack); obstack_free (&node_obstack, 0);
obstack_grow (&graph_obstack,
obstack_base (&node_obstack),
obs_size);
obstack_free (&node_obstack, 0);
}
} }
@@ -265,6 +260,10 @@ print_graph (void)
if (!graph_flag) if (!graph_flag)
return; return;
/* Output file. */
fgraph = xfopen (spec_graph_file, "w");
new_graph (&graph); new_graph (&graph);
#if 0 #if 0
@@ -284,13 +283,14 @@ print_graph (void)
graph.crossing_weight = median; graph.crossing_weight = median;
/* Output graph options. */ /* Output graph options. */
open_graph (&graph_obstack); open_graph (fgraph);
output_graph (&graph, &graph_obstack); output_graph (&graph, fgraph);
for (i = 0; i < nstates; i++) for (i = 0; i < nstates; i++)
/* Output nodes & edges. */ /* Output nodes & edges. */
print_state (i); print_state (i);
/* Close graph. */ /* Close graph. */
close_graph (&graph, &graph_obstack); close_graph (&graph, fgraph);
xfclose (fgraph);
} }

334
src/vcg.c
View File

@@ -471,55 +471,55 @@ add_colorentry (graph_t *g, int color_idx, int red_cp,
`-------------------------------------*/ `-------------------------------------*/
void void
open_edge(edge_t *edge, struct obstack *os) open_edge(edge_t *edge, FILE *fout)
{ {
switch (edge->type) switch (edge->type)
{ {
case normal_edge: case normal_edge:
obstack_sgrow (os, "\tedge: {\n"); fputs ("\tedge: {\n", fout);
break; break;
case back_edge: case back_edge:
obstack_sgrow (os, "\tbackedge: {\n"); fputs ("\tbackedge: {\n", fout);
break; break;
case near_edge: case near_edge:
obstack_sgrow (os, "\tnearedge: {\n"); fputs ("\tnearedge: {\n", fout);
break; break;
case bent_near_edge: case bent_near_edge:
obstack_sgrow (os, "\tbentnearedge: {\n"); fputs ("\tbentnearedge: {\n", fout);
break; break;
default: default:
obstack_sgrow (os, "\tedge: {\n"); fputs ("\tedge: {\n", fout);
} }
} }
void void
close_edge(struct obstack *os) close_edge(FILE *fout)
{ {
obstack_sgrow (os, "\t}\n"); fputs ("\t}\n", fout);
} }
void void
open_node(struct obstack *os) open_node(FILE *fout)
{ {
obstack_sgrow (os, "\tnode: {\n"); fputs ("\tnode: {\n", fout);
} }
void void
close_node(struct obstack *os) close_node(FILE *fout)
{ {
obstack_sgrow (os, "\t}\n"); fputs ("\t}\n", fout);
} }
void void
open_graph(struct obstack *os) open_graph(FILE *fout)
{ {
obstack_sgrow (os, "graph: {\n"); fputs ("graph: {\n", fout);
} }
void void
close_graph(graph_t *graph, struct obstack *os) close_graph(graph_t *graph, FILE *fout)
{ {
obstack_1grow (os, '\n'); fputc ('\n', fout);
/* FIXME: Unallocate nodes and edges if required. */ /* FIXME: Unallocate nodes and edges if required. */
{ {
@@ -527,223 +527,223 @@ close_graph(graph_t *graph, struct obstack *os)
for (node = graph->node_list; node; node = node->next) for (node = graph->node_list; node; node = node->next)
{ {
open_node (os); open_node (fout);
output_node (node, os); output_node (node, fout);
close_node (os); close_node (fout);
} }
} }
obstack_1grow (os, '\n'); fputc ('\n', fout);
{ {
edge_t *edge; edge_t *edge;
for (edge = graph->edge_list; edge; edge = edge->next) for (edge = graph->edge_list; edge; edge = edge->next)
{ {
open_edge (edge, os); open_edge (edge, fout);
output_edge (edge, os); output_edge (edge, fout);
close_edge (os); close_edge (fout);
} }
} }
obstack_sgrow (os, "}\n"); fputs ("}\n", fout);
} }
/*-------------------------------------------. /*-------------------------------------------.
| Output functions (formatted) in obstack os | | Output functions (formatted) in file FOUT |
`-------------------------------------------*/ `-------------------------------------------*/
void void
output_node (node_t *node, struct obstack *os) output_node (node_t *node, FILE *fout)
{ {
if (node->title != N_TITLE) if (node->title != N_TITLE)
obstack_fgrow1 (os, "\t\ttitle:\t\"%s\"\n", node->title); fprintf (fout, "\t\ttitle:\t\"%s\"\n", node->title);
if (node->label != N_LABEL) if (node->label != N_LABEL)
obstack_fgrow1 (os, "\t\tlabel:\t\"%s\"\n", node->label); fprintf (fout, "\t\tlabel:\t\"%s\"\n", node->label);
if ((node->locx != N_LOCX) && (node->locy != N_LOCY)) if ((node->locx != N_LOCX) && (node->locy != N_LOCY))
obstack_fgrow2 (os, "\t\tloc { x: %d y: %d }\t\n", node->locx, node->locy); fprintf (fout, "\t\tloc { x: %d y: %d }\t\n", node->locx, node->locy);
if (node->vertical_order != N_VERTICAL_ORDER) if (node->vertical_order != N_VERTICAL_ORDER)
obstack_fgrow1 (os, "\t\tvertical_order:\t%d\n", node->vertical_order); fprintf (fout, "\t\tvertical_order:\t%d\n", node->vertical_order);
if (node->horizontal_order != N_HORIZONTAL_ORDER) if (node->horizontal_order != N_HORIZONTAL_ORDER)
obstack_fgrow1 (os, "\t\thorizontal_order:\t%d\n", node->horizontal_order); fprintf (fout, "\t\thorizontal_order:\t%d\n", node->horizontal_order);
if (node->width != N_WIDTH) if (node->width != N_WIDTH)
obstack_fgrow1 (os, "\t\twidth:\t%d\n", node->width); fprintf (fout, "\t\twidth:\t%d\n", node->width);
if (node->height != N_HEIGHT) if (node->height != N_HEIGHT)
obstack_fgrow1 (os, "\t\theight:\t%d\n", node->height); fprintf (fout, "\t\theight:\t%d\n", node->height);
if (node->shrink != N_SHRINK) if (node->shrink != N_SHRINK)
obstack_fgrow1 (os, "\t\tshrink:\t%d\n", node->shrink); fprintf (fout, "\t\tshrink:\t%d\n", node->shrink);
if (node->stretch != N_STRETCH) if (node->stretch != N_STRETCH)
obstack_fgrow1 (os, "\t\tstretch:\t%d\n", node->stretch); fprintf (fout, "\t\tstretch:\t%d\n", node->stretch);
if (node->folding != N_FOLDING) if (node->folding != N_FOLDING)
obstack_fgrow1 (os, "\t\tfolding:\t%d\n", node->folding); fprintf (fout, "\t\tfolding:\t%d\n", node->folding);
if (node->textmode != N_TEXTMODE) if (node->textmode != N_TEXTMODE)
obstack_fgrow1 (os, "\t\ttextmode:\t%s\n", fprintf (fout, "\t\ttextmode:\t%s\n",
get_textmode_str (node->textmode)); get_textmode_str (node->textmode));
if (node->shape != N_SHAPE) if (node->shape != N_SHAPE)
obstack_fgrow1 (os, "\t\tshape:\t%s\n", get_shape_str (node->shape)); fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (node->shape));
if (node->borderwidth != N_BORDERWIDTH) if (node->borderwidth != N_BORDERWIDTH)
obstack_fgrow1 (os, "\t\tborderwidth:\t%d\n", node->borderwidth); fprintf (fout, "\t\tborderwidth:\t%d\n", node->borderwidth);
if (node->color != N_COLOR) if (node->color != N_COLOR)
obstack_fgrow1 (os, "\t\tcolor:\t%s\n", get_color_str (node->color)); fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (node->color));
if (node->textcolor != N_TEXTCOLOR) if (node->textcolor != N_TEXTCOLOR)
obstack_fgrow1 (os, "\t\ttextcolor:\t%s\n", fprintf (fout, "\t\ttextcolor:\t%s\n",
get_color_str (node->textcolor)); get_color_str (node->textcolor));
if (node->bordercolor != N_BORDERCOLOR) if (node->bordercolor != N_BORDERCOLOR)
obstack_fgrow1 (os, "\t\tbordercolor:\t%s\n", fprintf (fout, "\t\tbordercolor:\t%s\n",
get_color_str (node->bordercolor)); get_color_str (node->bordercolor));
if (node->infos[0]) if (node->infos[0])
obstack_fgrow1 (os, "\t\tinfo1:\t\"%s\"\n", node->infos[0]); fprintf (fout, "\t\tinfo1:\t\"%s\"\n", node->infos[0]);
if (node->infos[1]) if (node->infos[1])
obstack_fgrow1 (os, "\t\tinfo2:\t\"%s\"\n", node->infos[1]); fprintf (fout, "\t\tinfo2:\t\"%s\"\n", node->infos[1]);
if (node->infos[2]) if (node->infos[2])
obstack_fgrow1 (os, "\t\tinfo3:\t\"%s\"\n", node->infos[2]); fprintf (fout, "\t\tinfo3:\t\"%s\"\n", node->infos[2]);
} }
void void
output_edge (edge_t *edge, struct obstack *os) output_edge (edge_t *edge, FILE *fout)
{ {
/* FIXME: SOURCENAME and TARGETNAME are mandatory /* FIXME: SOURCENAME and TARGETNAME are mandatory
so it has to be fatal not to give these informations. */ so it has to be fatal not to give these informations. */
if (edge->sourcename != E_SOURCENAME) if (edge->sourcename != E_SOURCENAME)
obstack_fgrow1 (os, "\t\tsourcename:\t\"%s\"\n", edge->sourcename); fprintf (fout, "\t\tsourcename:\t\"%s\"\n", edge->sourcename);
if (edge->targetname != E_TARGETNAME) if (edge->targetname != E_TARGETNAME)
obstack_fgrow1 (os, "\t\ttargetname:\t\"%s\"\n", edge->targetname); fprintf (fout, "\t\ttargetname:\t\"%s\"\n", edge->targetname);
if (edge->label != E_LABEL) if (edge->label != E_LABEL)
obstack_fgrow1 (os, "\t\tlabel:\t\"%s\"\n", edge->label); fprintf (fout, "\t\tlabel:\t\"%s\"\n", edge->label);
if (edge->linestyle != E_LINESTYLE) if (edge->linestyle != E_LINESTYLE)
obstack_fgrow1 (os, "\t\tlinestyle:\t\"%s\"\n", fprintf (fout, "\t\tlinestyle:\t\"%s\"\n",
get_linestyle_str(edge->linestyle)); get_linestyle_str(edge->linestyle));
if (edge->thickness != E_THICKNESS) if (edge->thickness != E_THICKNESS)
obstack_fgrow1 (os, "\t\tthickness:\t%d\n", edge->thickness); fprintf (fout, "\t\tthickness:\t%d\n", edge->thickness);
if (edge->class != E_CLASS) if (edge->class != E_CLASS)
obstack_fgrow1 (os, "\t\tclass:\t%d\n", edge->class); fprintf (fout, "\t\tclass:\t%d\n", edge->class);
if (edge->color != E_COLOR) if (edge->color != E_COLOR)
obstack_fgrow1 (os, "\t\tcolor:\t%s\n", get_color_str (edge->color)); fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (edge->color));
if (edge->color != E_TEXTCOLOR) if (edge->color != E_TEXTCOLOR)
obstack_fgrow1 (os, "\t\ttextcolor:\t%s\n", fprintf (fout, "\t\ttextcolor:\t%s\n",
get_color_str (edge->textcolor)); get_color_str (edge->textcolor));
if (edge->arrowcolor != E_ARROWCOLOR) if (edge->arrowcolor != E_ARROWCOLOR)
obstack_fgrow1 (os, "\t\tarrowcolor:\t%s\n", fprintf (fout, "\t\tarrowcolor:\t%s\n",
get_color_str (edge->arrowcolor)); get_color_str (edge->arrowcolor));
if (edge->backarrowcolor != E_BACKARROWCOLOR) if (edge->backarrowcolor != E_BACKARROWCOLOR)
obstack_fgrow1 (os, "\t\tbackarrowcolor:\t%s\n", fprintf (fout, "\t\tbackarrowcolor:\t%s\n",
get_color_str (edge->backarrowcolor)); get_color_str (edge->backarrowcolor));
if (edge->arrowsize != E_ARROWSIZE) if (edge->arrowsize != E_ARROWSIZE)
obstack_fgrow1 (os, "\t\tarrowsize:\t%d\n", edge->arrowsize); fprintf (fout, "\t\tarrowsize:\t%d\n", edge->arrowsize);
if (edge->backarrowsize != E_BACKARROWSIZE) if (edge->backarrowsize != E_BACKARROWSIZE)
obstack_fgrow1 (os, "\t\tbackarrowsize:\t%d\n", edge->backarrowsize); fprintf (fout, "\t\tbackarrowsize:\t%d\n", edge->backarrowsize);
if (edge->arrowstyle != E_ARROWSTYLE) if (edge->arrowstyle != E_ARROWSTYLE)
obstack_fgrow1 (os, "\t\tarrowstyle:\t%s\n", fprintf (fout, "\t\tarrowstyle:\t%s\n",
get_arrowstyle_str(edge->arrowstyle)); get_arrowstyle_str(edge->arrowstyle));
if (edge->backarrowstyle != E_BACKARROWSTYLE) if (edge->backarrowstyle != E_BACKARROWSTYLE)
obstack_fgrow1 (os, "\t\tbackarrowstyle:\t%s\n", fprintf (fout, "\t\tbackarrowstyle:\t%s\n",
get_arrowstyle_str(edge->backarrowstyle)); get_arrowstyle_str(edge->backarrowstyle));
if (edge->priority != E_PRIORITY) if (edge->priority != E_PRIORITY)
obstack_fgrow1 (os, "\t\tpriority:\t%d\n", edge->priority); fprintf (fout, "\t\tpriority:\t%d\n", edge->priority);
if (edge->anchor != E_ANCHOR) if (edge->anchor != E_ANCHOR)
obstack_fgrow1 (os, "\t\tanchor:\t%d\n", edge->anchor); fprintf (fout, "\t\tanchor:\t%d\n", edge->anchor);
if (edge->horizontal_order != E_HORIZONTAL_ORDER) if (edge->horizontal_order != E_HORIZONTAL_ORDER)
obstack_fgrow1 (os, "\t\thorizontal_order:\t%d\n", edge->horizontal_order); fprintf (fout, "\t\thorizontal_order:\t%d\n", edge->horizontal_order);
} }
void void
output_graph (graph_t *graph, struct obstack *os) output_graph (graph_t *graph, FILE *fout)
{ {
if (graph->title) if (graph->title)
obstack_fgrow1 (os, "\ttitle:\t\"%s\"\n", graph->title); fprintf (fout, "\ttitle:\t\"%s\"\n", graph->title);
if (graph->label) if (graph->label)
obstack_fgrow1 (os, "\tlabel:\t\"%s\"\n", graph->label); fprintf (fout, "\tlabel:\t\"%s\"\n", graph->label);
if (graph->infos[0]) if (graph->infos[0])
obstack_fgrow1 (os, "\tinfo1:\t\"%s\"\n", graph->infos[0]); fprintf (fout, "\tinfo1:\t\"%s\"\n", graph->infos[0]);
if (graph->infos[1]) if (graph->infos[1])
obstack_fgrow1 (os, "\tinfo2:\t\"%s\"\n", graph->infos[1]); fprintf (fout, "\tinfo2:\t\"%s\"\n", graph->infos[1]);
if (graph->infos[2]) if (graph->infos[2])
obstack_fgrow1 (os, "\tinfo3:\t\"%s\"\n", graph->infos[2]); fprintf (fout, "\tinfo3:\t\"%s\"\n", graph->infos[2]);
if (graph->color != G_COLOR) if (graph->color != G_COLOR)
obstack_fgrow1 (os, "\tcolor:\t%s\n", get_color_str (graph->color)); fprintf (fout, "\tcolor:\t%s\n", get_color_str (graph->color));
if (graph->textcolor != G_TEXTCOLOR) if (graph->textcolor != G_TEXTCOLOR)
obstack_fgrow1 (os, "\ttextcolor:\t%s\n", get_color_str (graph->textcolor)); fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (graph->textcolor));
if (graph->bordercolor != G_BORDERCOLOR) if (graph->bordercolor != G_BORDERCOLOR)
obstack_fgrow1 (os, "\tbordercolor:\t%s\n", fprintf (fout, "\tbordercolor:\t%s\n",
get_color_str (graph->bordercolor)); get_color_str (graph->bordercolor));
if (graph->width != G_WIDTH) if (graph->width != G_WIDTH)
obstack_fgrow1 (os, "\twidth:\t%d\n", graph->width); fprintf (fout, "\twidth:\t%d\n", graph->width);
if (graph->height != G_HEIGHT) if (graph->height != G_HEIGHT)
obstack_fgrow1 (os, "\theight:\t%d\n", graph->height); fprintf (fout, "\theight:\t%d\n", graph->height);
if (graph->borderwidth != G_BORDERWIDTH) if (graph->borderwidth != G_BORDERWIDTH)
obstack_fgrow1 (os, "\tborderwidth:\t%d\n", graph->borderwidth); fprintf (fout, "\tborderwidth:\t%d\n", graph->borderwidth);
if (graph->x != G_X) if (graph->x != G_X)
obstack_fgrow1 (os, "\tx:\t%d\n", graph->x); fprintf (fout, "\tx:\t%d\n", graph->x);
if (graph->y != G_Y) if (graph->y != G_Y)
obstack_fgrow1 (os, "\ty:\t%d\n", graph->y); fprintf (fout, "\ty:\t%d\n", graph->y);
if (graph->folding != G_FOLDING) if (graph->folding != G_FOLDING)
obstack_fgrow1 (os, "\tfolding:\t%d\n", graph->folding); fprintf (fout, "\tfolding:\t%d\n", graph->folding);
if (graph->shrink != G_SHRINK) if (graph->shrink != G_SHRINK)
obstack_fgrow1 (os, "\tshrink:\t%d\n", graph->shrink); fprintf (fout, "\tshrink:\t%d\n", graph->shrink);
if (graph->stretch != G_STRETCH) if (graph->stretch != G_STRETCH)
obstack_fgrow1 (os, "\tstretch:\t%d\n", graph->stretch); fprintf (fout, "\tstretch:\t%d\n", graph->stretch);
if (graph->textmode != G_TEXTMODE) if (graph->textmode != G_TEXTMODE)
obstack_fgrow1 (os, "\ttextmode:\t%s\n", fprintf (fout, "\ttextmode:\t%s\n",
get_textmode_str (graph->textmode)); get_textmode_str (graph->textmode));
if (graph->shape != G_SHAPE) if (graph->shape != G_SHAPE)
obstack_fgrow1 (os, "\tshape:\t%s\n", get_shape_str (graph->shape)); fprintf (fout, "\tshape:\t%s\n", get_shape_str (graph->shape));
if (graph->vertical_order != G_VERTICAL_ORDER) if (graph->vertical_order != G_VERTICAL_ORDER)
obstack_fgrow1 (os, "\tvertical_order:\t%d\n", graph->vertical_order); fprintf (fout, "\tvertical_order:\t%d\n", graph->vertical_order);
if (graph->horizontal_order != G_HORIZONTAL_ORDER) if (graph->horizontal_order != G_HORIZONTAL_ORDER)
obstack_fgrow1 (os, "\thorizontal_order:\t%d\n", graph->horizontal_order); fprintf (fout, "\thorizontal_order:\t%d\n", graph->horizontal_order);
if (graph->xmax != G_XMAX) if (graph->xmax != G_XMAX)
obstack_fgrow1 (os, "\txmax:\t%d\n", graph->xmax); fprintf (fout, "\txmax:\t%d\n", graph->xmax);
if (graph->ymax != G_YMAX) if (graph->ymax != G_YMAX)
obstack_fgrow1 (os, "\tymax:\t%d\n", graph->ymax); fprintf (fout, "\tymax:\t%d\n", graph->ymax);
if (graph->xbase != G_XBASE) if (graph->xbase != G_XBASE)
obstack_fgrow1 (os, "\txbase:\t%d\n", graph->xbase); fprintf (fout, "\txbase:\t%d\n", graph->xbase);
if (graph->ybase != G_YBASE) if (graph->ybase != G_YBASE)
obstack_fgrow1 (os, "\tybase:\t%d\n", graph->ybase); fprintf (fout, "\tybase:\t%d\n", graph->ybase);
if (graph->xspace != G_XSPACE) if (graph->xspace != G_XSPACE)
obstack_fgrow1 (os, "\txspace:\t%d\n", graph->xspace); fprintf (fout, "\txspace:\t%d\n", graph->xspace);
if (graph->yspace != G_YSPACE) if (graph->yspace != G_YSPACE)
obstack_fgrow1 (os, "\tyspace:\t%d\n", graph->yspace); fprintf (fout, "\tyspace:\t%d\n", graph->yspace);
if (graph->xlspace != G_XLSPACE) if (graph->xlspace != G_XLSPACE)
obstack_fgrow1 (os, "\txlspace:\t%d\n", graph->xlspace); fprintf (fout, "\txlspace:\t%d\n", graph->xlspace);
if (graph->xraster != G_XRASTER) if (graph->xraster != G_XRASTER)
obstack_fgrow1 (os, "\txraster:\t%d\n", graph->xraster); fprintf (fout, "\txraster:\t%d\n", graph->xraster);
if (graph->yraster != G_YRASTER) if (graph->yraster != G_YRASTER)
obstack_fgrow1 (os, "\tyraster:\t%d\n", graph->yraster); fprintf (fout, "\tyraster:\t%d\n", graph->yraster);
if (graph->xlraster != G_XLRASTER) if (graph->xlraster != G_XLRASTER)
obstack_fgrow1 (os, "\txlraster:\t%d\n", graph->xlraster); fprintf (fout, "\txlraster:\t%d\n", graph->xlraster);
if (graph->hidden != G_HIDDEN) if (graph->hidden != G_HIDDEN)
obstack_fgrow1 (os, "\thidden:\t%d\n", graph->hidden); fprintf (fout, "\thidden:\t%d\n", graph->hidden);
/* FIXME: Unallocate struct list if required. /* FIXME: Unallocate struct list if required.
Maybe with a little function. */ Maybe with a little function. */
@@ -752,7 +752,7 @@ output_graph (graph_t *graph, struct obstack *os)
struct classname_s *ite; struct classname_s *ite;
for (ite = graph->classname; ite; ite = ite->next) for (ite = graph->classname; ite; ite = ite->next)
obstack_fgrow2 (os, "\tclassname %d :\t%s\n", ite->no, ite->name); fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name);
} }
if (graph->infoname != G_INFONAME) if (graph->infoname != G_INFONAME)
@@ -760,129 +760,127 @@ output_graph (graph_t *graph, struct obstack *os)
struct infoname_s *ite; struct infoname_s *ite;
for (ite = graph->infoname; ite; ite = ite->next) for (ite = graph->infoname; ite; ite = ite->next)
obstack_fgrow2 (os, "\tinfoname %d :\t%s\n", ite->integer, ite->string); fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->string);
} }
if (graph->colorentry != G_COLORENTRY) if (graph->colorentry != G_COLORENTRY)
{ {
struct colorentry_s *ite; struct colorentry_s *ite;
char buff[64];
for (ite = graph->colorentry; ite; ite = ite->next) for (ite = graph->colorentry; ite; ite = ite->next)
{ {
sprintf (buff, "\tcolorentry %d :\t%d %d %d\n", fprintf (fout, "\tcolorentry %d :\t%d %d %d\n",
ite->color_index, ite->color_index,
ite->red_cp, ite->red_cp,
ite->green_cp, ite->green_cp,
ite->blue_cp); ite->blue_cp);
obstack_sgrow (os, buff);
} }
} }
if (graph->layoutalgorithm != G_LAYOUTALGORITHM) if (graph->layoutalgorithm != G_LAYOUTALGORITHM)
obstack_fgrow1 (os, "\tlayoutalgorithm:\t%s\n", fprintf (fout, "\tlayoutalgorithm:\t%s\n",
get_layoutalgorithm_str(graph->layoutalgorithm)); get_layoutalgorithm_str(graph->layoutalgorithm));
if (graph->layout_downfactor != G_LAYOUT_DOWNFACTOR) if (graph->layout_downfactor != G_LAYOUT_DOWNFACTOR)
obstack_fgrow1 (os, "\tlayout_downfactor:\t%d\n", graph->layout_downfactor); fprintf (fout, "\tlayout_downfactor:\t%d\n", graph->layout_downfactor);
if (graph->layout_upfactor != G_LAYOUT_UPFACTOR) if (graph->layout_upfactor != G_LAYOUT_UPFACTOR)
obstack_fgrow1 (os, "\tlayout_upfactor:\t%d\n", graph->layout_upfactor); fprintf (fout, "\tlayout_upfactor:\t%d\n", graph->layout_upfactor);
if (graph->layout_nearfactor != G_LAYOUT_NEARFACTOR) if (graph->layout_nearfactor != G_LAYOUT_NEARFACTOR)
obstack_fgrow1 (os, "\tlayout_nearfactor:\t%d\n", graph->layout_nearfactor); fprintf (fout, "\tlayout_nearfactor:\t%d\n", graph->layout_nearfactor);
if (graph->layout_splinefactor != G_LAYOUT_SPLINEFACTOR) if (graph->layout_splinefactor != G_LAYOUT_SPLINEFACTOR)
obstack_fgrow1 (os, "\tlayout_splinefactor:\t%d\n", fprintf (fout, "\tlayout_splinefactor:\t%d\n",
graph->layout_splinefactor); graph->layout_splinefactor);
if (graph->late_edge_labels != G_LATE_EDGE_LABELS) if (graph->late_edge_labels != G_LATE_EDGE_LABELS)
obstack_fgrow1 (os, "\tlate_edge_labels:\t%s\n", fprintf (fout, "\tlate_edge_labels:\t%s\n",
get_decision_str(graph->late_edge_labels)); get_decision_str(graph->late_edge_labels));
if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS) if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS)
obstack_fgrow1 (os, "\tdisplay_edge_labels:\t%s\n", fprintf (fout, "\tdisplay_edge_labels:\t%s\n",
get_decision_str(graph->display_edge_labels)); get_decision_str(graph->display_edge_labels));
if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS) if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS)
obstack_fgrow1 (os, "\tdirty_edge_labels:\t%s\n", fprintf (fout, "\tdirty_edge_labels:\t%s\n",
get_decision_str(graph->dirty_edge_labels)); get_decision_str(graph->dirty_edge_labels));
if (graph->finetuning != G_FINETUNING) if (graph->finetuning != G_FINETUNING)
obstack_fgrow1 (os, "\tfinetuning:\t%s\n", fprintf (fout, "\tfinetuning:\t%s\n",
get_decision_str(graph->finetuning)); get_decision_str(graph->finetuning));
if (graph->ignore_singles != G_IGNORE_SINGLES) if (graph->ignore_singles != G_IGNORE_SINGLES)
obstack_fgrow1 (os, "\tignore_singles:\t%s\n", fprintf (fout, "\tignore_singles:\t%s\n",
get_decision_str(graph->ignore_singles)); get_decision_str(graph->ignore_singles));
if (graph->straight_phase != G_STRAIGHT_PHASE) if (graph->straight_phase != G_STRAIGHT_PHASE)
obstack_fgrow1 (os, "\tstraight_phase:\t%s\n", fprintf (fout, "\tstraight_phase:\t%s\n",
get_decision_str(graph->straight_phase)); get_decision_str(graph->straight_phase));
if (graph->priority_phase != G_PRIORITY_PHASE) if (graph->priority_phase != G_PRIORITY_PHASE)
obstack_fgrow1 (os, "\tpriority_phase:\t%s\n", fprintf (fout, "\tpriority_phase:\t%s\n",
get_decision_str(graph->priority_phase)); get_decision_str(graph->priority_phase));
if (graph->manhattan_edges != G_MANHATTAN_EDGES) if (graph->manhattan_edges != G_MANHATTAN_EDGES)
obstack_fgrow1 (os, fprintf (fout,
"\tmanhattan_edges:\t%s\n", "\tmanhattan_edges:\t%s\n",
get_decision_str(graph->manhattan_edges)); get_decision_str(graph->manhattan_edges));
if (graph->smanhattan_edges != G_SMANHATTAN_EDGES) if (graph->smanhattan_edges != G_SMANHATTAN_EDGES)
obstack_fgrow1 (os, fprintf (fout,
"\tsmanhattan_edges:\t%s\n", "\tsmanhattan_edges:\t%s\n",
get_decision_str(graph->smanhattan_edges)); get_decision_str(graph->smanhattan_edges));
if (graph->near_edges != G_NEAR_EDGES) if (graph->near_edges != G_NEAR_EDGES)
obstack_fgrow1 (os, "\tnear_edges:\t%s\n", fprintf (fout, "\tnear_edges:\t%s\n",
get_decision_str(graph->near_edges)); get_decision_str(graph->near_edges));
if (graph->orientation != G_ORIENTATION) if (graph->orientation != G_ORIENTATION)
obstack_fgrow1 (os, "\torientation:\t%s\n", fprintf (fout, "\torientation:\t%s\n",
get_orientation_str(graph->orientation)); get_orientation_str(graph->orientation));
if (graph->node_alignement != G_NODE_ALIGNEMENT) if (graph->node_alignement != G_NODE_ALIGNEMENT)
obstack_fgrow1 (os, "\tnode_alignement:\t%s\n", fprintf (fout, "\tnode_alignement:\t%s\n",
get_node_alignement_str(graph->node_alignement)); get_node_alignement_str(graph->node_alignement));
if (graph->port_sharing != G_PORT_SHARING) if (graph->port_sharing != G_PORT_SHARING)
obstack_fgrow1 (os, "\tport_sharing:\t%s\n", fprintf (fout, "\tport_sharing:\t%s\n",
get_decision_str(graph->port_sharing)); get_decision_str(graph->port_sharing));
if (graph->arrow_mode != G_ARROW_MODE) if (graph->arrow_mode != G_ARROW_MODE)
obstack_fgrow1 (os, "\tarrow_mode:\t%s\n", fprintf (fout, "\tarrow_mode:\t%s\n",
get_arrow_mode_str(graph->arrow_mode)); get_arrow_mode_str(graph->arrow_mode));
if (graph->treefactor != G_TREEFACTOR) if (graph->treefactor != G_TREEFACTOR)
obstack_fgrow1 (os, "\ttreefactor:\t%f\n", graph->treefactor); fprintf (fout, "\ttreefactor:\t%f\n", graph->treefactor);
if (graph->spreadlevel != G_SPREADLEVEL) if (graph->spreadlevel != G_SPREADLEVEL)
obstack_fgrow1 (os, "\tspreadlevel:\t%d\n", graph->spreadlevel); fprintf (fout, "\tspreadlevel:\t%d\n", graph->spreadlevel);
if (graph->crossing_weight != G_CROSSING_WEIGHT) if (graph->crossing_weight != G_CROSSING_WEIGHT)
obstack_fgrow1 (os, "\tcrossing_weight:\t%s\n", fprintf (fout, "\tcrossing_weight:\t%s\n",
get_crossing_type_str(graph->crossing_weight)); get_crossing_type_str(graph->crossing_weight));
if (graph->crossing_phase2 != G_CROSSING_PHASE2) if (graph->crossing_phase2 != G_CROSSING_PHASE2)
obstack_fgrow1 (os, "\tcrossing_phase2:\t%s\n", fprintf (fout, "\tcrossing_phase2:\t%s\n",
get_decision_str(graph->crossing_phase2)); get_decision_str(graph->crossing_phase2));
if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION) if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION)
obstack_fgrow1 (os, "\tcrossing_optimization:\t%s\n", fprintf (fout, "\tcrossing_optimization:\t%s\n",
get_decision_str(graph->crossing_optimization)); get_decision_str(graph->crossing_optimization));
if (graph->view != G_VIEW) if (graph->view != G_VIEW)
obstack_fgrow1 (os, "\tview:\t%s\n", get_view_str(graph->view)); fprintf (fout, "\tview:\t%s\n", get_view_str(graph->view));
if (graph->edges != G_EDGES) if (graph->edges != G_EDGES)
obstack_fgrow1 (os, "\tedges:\t%s\n", get_decision_str(graph->edges)); fprintf (fout, "\tedges:\t%s\n", get_decision_str(graph->edges));
if (graph->nodes != G_NODES) if (graph->nodes != G_NODES)
obstack_fgrow1 (os,"\tnodes:\t%s\n", get_decision_str(graph->nodes)); fprintf (fout,"\tnodes:\t%s\n", get_decision_str(graph->nodes));
if (graph->splines != G_SPLINES) if (graph->splines != G_SPLINES)
obstack_fgrow1 (os, "\tsplines:\t%s\n", get_decision_str(graph->splines)); fprintf (fout, "\tsplines:\t%s\n", get_decision_str(graph->splines));
if (graph->bmax != G_BMAX) if (graph->bmax != G_BMAX)
obstack_fgrow1 (os, "\tbmax:\t%d\n", graph->bmax); fprintf (fout, "\tbmax:\t%d\n", graph->bmax);
if (graph->cmin != G_CMIN) if (graph->cmin != G_CMIN)
obstack_fgrow1 (os, "\tcmin:\t%d\n", graph->cmin); fprintf (fout, "\tcmin:\t%d\n", graph->cmin);
if (graph->cmax != G_CMAX) if (graph->cmax != G_CMAX)
obstack_fgrow1 (os, "\tcmax:\t%d\n", graph->cmax); fprintf (fout, "\tcmax:\t%d\n", graph->cmax);
if (graph->pmin != G_PMIN) if (graph->pmin != G_PMIN)
obstack_fgrow1 (os, "\tpmin:\t%d\n", graph->pmin); fprintf (fout, "\tpmin:\t%d\n", graph->pmin);
if (graph->pmax != G_PMAX) if (graph->pmax != G_PMAX)
obstack_fgrow1 (os, "\tpmax:\t%d\n", graph->pmax); fprintf (fout, "\tpmax:\t%d\n", graph->pmax);
if (graph->rmin != G_RMIN) if (graph->rmin != G_RMIN)
obstack_fgrow1 (os, "\trmin:\t%d\n", graph->rmin); fprintf (fout, "\trmin:\t%d\n", graph->rmin);
if (graph->rmax != G_RMAX) if (graph->rmax != G_RMAX)
obstack_fgrow1 (os, "\trmax:\t%d\n", graph->rmax); fprintf (fout, "\trmax:\t%d\n", graph->rmax);
if (graph->smax != G_SMAX) if (graph->smax != G_SMAX)
obstack_fgrow1 (os, "\tsmax:\t%d\n", graph->smax); fprintf (fout, "\tsmax:\t%d\n", graph->smax);
} }

View File

@@ -1004,16 +1004,16 @@ void add_colorentry PARAMS ((graph_t *g, int color_idx, int red_cp,
void add_classname PARAMS ((graph_t *g, int val, const char *name)); void add_classname PARAMS ((graph_t *g, int val, const char *name));
void add_infoname PARAMS ((graph_t *g, int val, const char *name)); void add_infoname PARAMS ((graph_t *g, int val, const char *name));
void open_node PARAMS ((struct obstack *os)); void open_node PARAMS ((FILE *fout));
void output_node PARAMS ((node_t *node, struct obstack *os)); void output_node PARAMS ((node_t *node, FILE *fout));
void close_node PARAMS ((struct obstack *os)); void close_node PARAMS ((FILE *fout));
void open_edge PARAMS ((edge_t *edge, struct obstack *os)); void open_edge PARAMS ((edge_t *edge, FILE *fout));
void output_edge PARAMS ((edge_t *edge, struct obstack *os)); void output_edge PARAMS ((edge_t *edge, FILE *fout));
void close_edge PARAMS ((struct obstack *os)); void close_edge PARAMS ((FILE *fout));
void open_graph PARAMS ((struct obstack *os)); void open_graph PARAMS ((FILE *fout));
void output_graph PARAMS ((graph_t *graph, struct obstack *os)); void output_graph PARAMS ((graph_t *graph, FILE *fout));
void close_graph PARAMS ((graph_t *graph, struct obstack *os)); void close_graph PARAMS ((graph_t *graph, FILE *fout));
#endif /* VCG_H_ */ #endif /* VCG_H_ */