mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 18:23:03 +00:00
* src/vcg.c (complain.h): Include it.
Unepitaize `return' invocations. [NDEBUG] (main): Remove. * src/vcg.h (node_t, edge_t, graph_t): Constify the char * memebers. * src/files.c (open_files): Initialize graph_obstack. * src/print_graph.c (print_actions): CPP out useless code. (print_core): Don't output the last `n' in labels. Use `quote'. * src/files.c (output_files): Output the VCG file. * src/main.c (main): Invoke print_graph ();
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,9 +1,15 @@
|
|||||||
2001-08-06 Akim Demaille <akim@epita.fr>, Marc Autret <autret_@epita.fr>
|
2001-08-06 Akim Demaille <akim@epita.fr>, Marc Autret <autret_@epita.fr>
|
||||||
|
|
||||||
* src/print_graph.c (print_actions): CPP out useless code.
|
|
||||||
* src/vcg.c (complain.h): Include it.
|
* src/vcg.c (complain.h): Include it.
|
||||||
Unepitaize `return' invocations.
|
Unepitaize `return' invocations.
|
||||||
* src/vcg.c [NDEBUG] (main): Remove.
|
[NDEBUG] (main): Remove.
|
||||||
|
* src/vcg.h (node_t, edge_t, graph_t): Constify the char * memebers.
|
||||||
|
* src/files.c (open_files): Initialize graph_obstack.
|
||||||
|
* src/print_graph.c (print_actions): CPP out useless code.
|
||||||
|
(print_core): Don't output the last `\n' in labels.
|
||||||
|
Use `quote'.
|
||||||
|
* src/files.c (output_files): Output the VCG file.
|
||||||
|
* src/main.c (main): Invoke print_graph ();
|
||||||
|
|
||||||
2001-08-06 Marc Autret <autret_@epita.fr>
|
2001-08-06 Marc Autret <autret_@epita.fr>
|
||||||
|
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -407,4 +408,7 @@ output_files (void)
|
|||||||
/* We used to use just .out if spec_name_prefix (-p) was used, but
|
/* We used to use just .out if spec_name_prefix (-p) was used, but
|
||||||
that conflicts with Posix. */
|
that conflicts with Posix. */
|
||||||
obstack_save (&output_obstack, stringappend (short_base_name, EXT_OUTPUT));
|
obstack_save (&output_obstack, stringappend (short_base_name, EXT_OUTPUT));
|
||||||
|
|
||||||
|
if (graph_flag)
|
||||||
|
obstack_save (&graph_obstack, stringappend (short_base_name, ".vcg"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "print.h"
|
#include "print.h"
|
||||||
#include "LR0.h"
|
#include "LR0.h"
|
||||||
#include "conflicts.h"
|
#include "conflicts.h"
|
||||||
|
#include "print_graph.h"
|
||||||
|
|
||||||
/* The name this program was run with, for messages. */
|
/* The name this program was run with, for messages. */
|
||||||
char *program_name;
|
char *program_name;
|
||||||
@@ -83,6 +84,9 @@ main (int argc, char *argv[])
|
|||||||
/* Print information about results, if requested. */
|
/* Print information about results, if requested. */
|
||||||
print_results ();
|
print_results ();
|
||||||
|
|
||||||
|
/* Output the VCG graph. */
|
||||||
|
print_graph ();
|
||||||
|
|
||||||
/* Output the tables and the parser to ftable. In file output. */
|
/* Output the tables and the parser to ftable. In file output. */
|
||||||
output ();
|
output ();
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
#include "print_graph.h"
|
#include "print_graph.h"
|
||||||
#include "vcg.h"
|
#include "vcg.h"
|
||||||
|
#include "quote.h"
|
||||||
|
|
||||||
static graph_t graph;
|
static graph_t graph;
|
||||||
|
|
||||||
@@ -56,6 +57,9 @@ print_core (int state)
|
|||||||
|
|
||||||
for (i = 0; i < k; i++)
|
for (i = 0; i < k; i++)
|
||||||
{
|
{
|
||||||
|
if (i)
|
||||||
|
obstack_sgrow (&graph_obstack, "\\n");
|
||||||
|
|
||||||
sp1 = sp = ritem + statep->items[i];
|
sp1 = sp = ritem + statep->items[i];
|
||||||
|
|
||||||
while (*sp > 0)
|
while (*sp > 0)
|
||||||
@@ -64,17 +68,16 @@ print_core (int state)
|
|||||||
rule = -(*sp);
|
rule = -(*sp);
|
||||||
|
|
||||||
obstack_fgrow1 (&graph_obstack, _("%d: "), rule);
|
obstack_fgrow1 (&graph_obstack, _("%d: "), rule);
|
||||||
obstack_fgrow1 (&graph_obstack, " %s -> ", tags[rlhs[rule]]);
|
obstack_fgrow1 (&graph_obstack, " %s -> ", quote (tags[rlhs[rule]]));
|
||||||
|
|
||||||
for (sp = ritem + rrhs[rule]; sp < sp1; sp++)
|
for (sp = ritem + rrhs[rule]; sp < sp1; sp++)
|
||||||
obstack_fgrow1 (&graph_obstack, "%s ", tags[*sp]);
|
obstack_fgrow1 (&graph_obstack, "%s ", quote (tags[*sp]));
|
||||||
|
|
||||||
obstack_1grow (&graph_obstack, '.');
|
obstack_1grow (&graph_obstack, '.');
|
||||||
|
|
||||||
while (*sp > 0)
|
while (*sp > 0)
|
||||||
obstack_fgrow1 (&graph_obstack, " %s", tags[*sp++]);
|
obstack_fgrow1 (&graph_obstack, " %s", quote (tags[*sp++]));
|
||||||
|
|
||||||
obstack_sgrow (&graph_obstack, "\\n");
|
|
||||||
}
|
}
|
||||||
obstack_sgrow (&graph_obstack, "\"\n");
|
obstack_sgrow (&graph_obstack, "\"\n");
|
||||||
}
|
}
|
||||||
@@ -129,10 +132,12 @@ print_actions (int state, node_t *node)
|
|||||||
edge.type = back_edge;
|
edge.type = back_edge;
|
||||||
open_edge (&edge, &graph_obstack);
|
open_edge (&edge, &graph_obstack);
|
||||||
edge.sourcename = node->title;
|
edge.sourcename = node->title;
|
||||||
|
sprintf (buff, "%d", state1);
|
||||||
edge.targetname = buff;
|
edge.targetname = buff;
|
||||||
sprintf (edge.targetname, "%d", state1);
|
|
||||||
edge.color = (symbol == 0) ? blue : red;
|
edge.color = (symbol == 0) ? blue : red;
|
||||||
edge.label = tags[symbol];
|
/* FIXME: Be aware that quote uses static memory. The string
|
||||||
|
must be output immediately (which is the case here). */
|
||||||
|
edge.label = tags[symbol] ? quote (tags[symbol]) : NULL;
|
||||||
output_edge (&edge, &graph_obstack);
|
output_edge (&edge, &graph_obstack);
|
||||||
close_edge (&graph_obstack);
|
close_edge (&graph_obstack);
|
||||||
}
|
}
|
||||||
@@ -176,10 +181,10 @@ print_actions (int state, node_t *node)
|
|||||||
new_edge (&edge);
|
new_edge (&edge);
|
||||||
open_edge (&edge, &graph_obstack);
|
open_edge (&edge, &graph_obstack);
|
||||||
edge.sourcename = node->title;
|
edge.sourcename = node->title;
|
||||||
|
sprintf (buff, "%d", state1);
|
||||||
edge.targetname = buff;
|
edge.targetname = buff;
|
||||||
edge.color = red;
|
edge.color = red;
|
||||||
sprintf (edge.targetname, "%d", state1);
|
edge.label = tags[symbol] ? quote (tags[symbol]) : NULL;
|
||||||
edge.label = tags[symbol];
|
|
||||||
output_edge (&edge, &graph_obstack);
|
output_edge (&edge, &graph_obstack);
|
||||||
close_edge (&graph_obstack);
|
close_edge (&graph_obstack);
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/vcg.h
13
src/vcg.h
@@ -329,16 +329,16 @@ struct edge_s
|
|||||||
|
|
||||||
/* Sourcename is the title of the source node of the edge.
|
/* Sourcename is the title of the source node of the edge.
|
||||||
Default: none. */
|
Default: none. */
|
||||||
char *sourcename; /* Mandatory. */
|
const char *sourcename; /* Mandatory. */
|
||||||
|
|
||||||
/* Targetname is the title of the target node of the edge.
|
/* Targetname is the title of the target node of the edge.
|
||||||
Default: none. */
|
Default: none. */
|
||||||
char *targetname; /* Mandatory. */
|
const char *targetname; /* Mandatory. */
|
||||||
|
|
||||||
/* Label specifies the label of the edge. It is drawn if
|
/* Label specifies the label of the edge. It is drawn if
|
||||||
display.edge.labels is set to yes.
|
display.edge.labels is set to yes.
|
||||||
Default: no label. */
|
Default: no label. */
|
||||||
char *label;
|
const char *label;
|
||||||
|
|
||||||
/* Linestyle specifies the style the edge is drawn. Possibilities are:
|
/* Linestyle specifies the style the edge is drawn. Possibilities are:
|
||||||
ffl continuous a solid line is drawn ( -- ) ffl dashed the edge
|
ffl continuous a solid line is drawn ( -- ) ffl dashed the edge
|
||||||
@@ -459,7 +459,7 @@ struct graph_s
|
|||||||
the root of the first subgraph in the graph, if the subgraph is
|
the root of the first subgraph in the graph, if the subgraph is
|
||||||
visualized explicitly.
|
visualized explicitly.
|
||||||
By default, it's the name of the vcg graph file description. */
|
By default, it's the name of the vcg graph file description. */
|
||||||
char *title;
|
const char *title;
|
||||||
|
|
||||||
/* Graph label.
|
/* Graph label.
|
||||||
Label the text displayed inside the node, when the graph is folded
|
Label the text displayed inside the node, when the graph is folded
|
||||||
@@ -467,7 +467,7 @@ struct graph_s
|
|||||||
be used. Note that this text may contain control characters like
|
be used. Note that this text may contain control characters like
|
||||||
NEWLINE that influences the size of the node.
|
NEWLINE that influences the size of the node.
|
||||||
By default, it takes the title value */
|
By default, it takes the title value */
|
||||||
char *label;
|
const char *label;
|
||||||
|
|
||||||
/* Any informations.
|
/* Any informations.
|
||||||
Info1, info2, info3 combines additional text labels with a node or a
|
Info1, info2, info3 combines additional text labels with a node or a
|
||||||
@@ -475,7 +475,7 @@ struct graph_s
|
|||||||
interactively. The corresponding text labels can be shown by mouse
|
interactively. The corresponding text labels can be shown by mouse
|
||||||
clicks on nodes.
|
clicks on nodes.
|
||||||
Defalut values are empty strings (here NULL pointers) */
|
Defalut values are empty strings (here NULL pointers) */
|
||||||
char *infos[3];
|
const char *infos[3];
|
||||||
|
|
||||||
/* Background color and summary node colors
|
/* Background color and summary node colors
|
||||||
Color specifies the background color for the outermost graph, or the
|
Color specifies the background color for the outermost graph, or the
|
||||||
@@ -972,4 +972,3 @@ void output_graph PARAMS ((graph_t *graph, struct obstack *os));
|
|||||||
void close_graph PARAMS ((graph_t *graph, struct obstack *os));
|
void close_graph PARAMS ((graph_t *graph, struct obstack *os));
|
||||||
|
|
||||||
#endif /* VCG_H_ */
|
#endif /* VCG_H_ */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user