projects
/
bison.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3d2cbc2
)
(static_graph): Renamed from graph.
author
Paul Eggert
<eggert@cs.ucla.edu>
Wed, 11 Dec 2002 06:43:08 +0000
(06:43 +0000)
committer
Paul Eggert
<eggert@cs.ucla.edu>
Wed, 11 Dec 2002 06:43:08 +0000
(06:43 +0000)
src/print_graph.c
patch
|
blob
|
blame
|
history
diff --git
a/src/print_graph.c
b/src/print_graph.c
index fe0ee76d9d52b3faa98b54dad40e0c7c223d8ff0..c92ae3577fdf89cf621484f9f98fc6073f998b2e 100644
(file)
--- a/
src/print_graph.c
+++ b/
src/print_graph.c
@@
-1,5
+1,6
@@
/* Output a VCG description on generated parser, for Bison,
/* Output a VCG description on generated parser, for Bison,
- Copyright 2001 Free Software Foundation, Inc.
+
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This file is part of Bison, the GNU Compiler Compiler.
@@
-19,23
+20,25
@@
Boston, MA 02111-1307, USA. */
#include "system.h"
Boston, MA 02111-1307, USA. */
#include "system.h"
-#include "quotearg.h"
-#include
"files.h"
-#include
"symtab.h"
-#include "gram.h"
+
+#include
<obstack.h>
+#include
<quotearg.h>
+
#include "LR0.h"
#include "LR0.h"
-#include "lalr.h"
-#include "conflicts.h"
+#include "closure.h"
#include "complain.h"
#include "complain.h"
+#include "conflicts.h"
+#include "files.h"
#include "getargs.h"
#include "getargs.h"
-#include "state.h"
-#include "reader.h"
-#include "closure.h"
-#include "obstack.h"
+#include "gram.h"
+#include "lalr.h"
#include "print_graph.h"
#include "print_graph.h"
+#include "reader.h"
+#include "state.h"
+#include "symtab.h"
#include "vcg.h"
#include "vcg.h"
-static graph
_t
graph;
+static graph
static_
graph;
static FILE *fgraph = NULL;
static FILE *fgraph = NULL;
@@
-44,11
+47,11
@@
static FILE *fgraph = NULL;
`----------------------------*/
static void
`----------------------------*/
static void
-print_core (struct obstack *oout, state
_t *state
)
+print_core (struct obstack *oout, state
*s
)
{
int i;
{
int i;
- item_number
_t *sitems = state
->items;
- int snritems
= state
->nitems;
+ item_number
*sitems = s
->items;
+ int snritems
= s
->nitems;
/* Output all the items of a state, not only its kernel. */
if (report_flag & report_itemsets)
/* Output all the items of a state, not only its kernel. */
if (report_flag & report_itemsets)
@@
-58,26
+61,26
@@
print_core (struct obstack *oout, state_t *state)
snritems = nritemset;
}
snritems = nritemset;
}
- obstack_fgrow1 (oout, "state %2d\n", s
tate
->number);
+ obstack_fgrow1 (oout, "state %2d\n", s->number);
for (i = 0; i < snritems; i++)
{
for (i = 0; i < snritems; i++)
{
- item_number
_t
*sp;
- item_number
_t
*sp1;
- rule_number
_t rule
;
+ item_number *sp;
+ item_number *sp1;
+ rule_number
r
;
sp1 = sp = ritem + sitems[i];
while (*sp >= 0)
sp++;
sp1 = sp = ritem + sitems[i];
while (*sp >= 0)
sp++;
- r
ule
= item_number_as_rule_number (*sp);
+ r = item_number_as_rule_number (*sp);
if (i)
obstack_1grow (oout, '\n');
obstack_fgrow1 (oout, " %s -> ",
if (i)
obstack_1grow (oout, '\n');
obstack_fgrow1 (oout, " %s -> ",
- rules[r
ule
].lhs->tag);
+ rules[r].lhs->tag);
- for (sp = rules[r
ule
].rhs; sp < sp1; sp++)
+ for (sp = rules[r].rhs; sp < sp1; sp++)
obstack_fgrow1 (oout, "%s ", symbols[*sp]->tag);
obstack_1grow (oout, '.');
obstack_fgrow1 (oout, "%s ", symbols[*sp]->tag);
obstack_1grow (oout, '.');
@@
-89,8
+92,8
@@
print_core (struct obstack *oout, state_t *state)
if (report_flag & report_lookaheads)
{
/* Find the reduction we are handling. */
if (report_flag & report_lookaheads)
{
/* Find the reduction we are handling. */
- reductions
_t *reds = state
->reductions;
- int redno = state_reduction_find (s
tate, &rules[rule
]);
+ reductions
*reds = s
->reductions;
+ int redno = state_reduction_find (s
, &rules[r
]);
/* Print them if there are. */
if (reds->lookaheads && redno != -1)
/* Print them if there are. */
if (reds->lookaheads && redno != -1)
@@
-116,41
+119,41
@@
print_core (struct obstack *oout, state_t *state)
`---------------------------------------------------------------*/
static void
`---------------------------------------------------------------*/
static void
-print_actions (state
_t *state
, const char *node_name)
+print_actions (state
*s
, const char *node_name)
{
int i;
{
int i;
- transitions
_t *transitions = state
->transitions;
- reductions
_t *redp = state
->reductions;
+ transitions
*trans = s
->transitions;
+ reductions
*reds = s
->reductions;
static char buff[10];
static char buff[10];
- edge
_t edg
e;
+ edge
e;
- if (!trans
itions->num && !redp
)
+ if (!trans
->num && !reds
)
return;
return;
- for (i = 0; i < trans
itions
->num; i++)
- if (!TRANSITION_IS_DISABLED (trans
itions
, i))
+ for (i = 0; i < trans->num; i++)
+ if (!TRANSITION_IS_DISABLED (trans, i))
{
{
- state
_t *state1 = transitio
ns->states[i];
- symbol_number
_t symbol = state
1->accessing_symbol;
+ state
*s1 = tra
ns->states[i];
+ symbol_number
sym = s
1->accessing_symbol;
- new_edge (&e
dge
);
+ new_edge (&e);
- if (s
tate->number > state
1->number)
- e
dge
.type = back_edge;
- open_edge (&e
dge
, fgraph);
+ if (s
->number > s
1->number)
+ e.type = back_edge;
+ open_edge (&e, fgraph);
/* The edge source is the current node. */
/* The edge source is the current node. */
- e
dge
.sourcename = node_name;
- sprintf (buff, "%d", s
tate
1->number);
- e
dge
.targetname = buff;
+ e.sourcename = node_name;
+ sprintf (buff, "%d", s1->number);
+ e.targetname = buff;
/* Shifts are blue, gotos are green, and error is red. */
/* Shifts are blue, gotos are green, and error is red. */
- if (TRANSITION_IS_ERROR (trans
itions
, i))
- e
dge
.color = red;
+ if (TRANSITION_IS_ERROR (trans, i))
+ e.color = red;
else
else
- e
dge.color = TRANSITION_IS_SHIFT(transitio
ns, i) ? blue : green;
- e
dge.label = symbols[symbol
]->tag;
- output_edge (&e
dge
, fgraph);
+ e
.color = TRANSITION_IS_SHIFT (tra
ns, i) ? blue : green;
+ e
.label = symbols[sym
]->tag;
+ output_edge (&e, fgraph);
close_edge (fgraph);
}
}
close_edge (fgraph);
}
}
@@
-162,27
+165,27
@@
print_actions (state_t *state, const char *node_name)
`-------------------------------------------------------------*/
static void
`-------------------------------------------------------------*/
static void
-print_state (state
_t *state
)
+print_state (state
*s
)
{
static char name[10];
struct obstack node_obstack;
{
static char name[10];
struct obstack node_obstack;
- node
_t node
;
+ node
n
;
/* The labels of the nodes are their the items. */
obstack_init (&node_obstack);
/* The labels of the nodes are their the items. */
obstack_init (&node_obstack);
- new_node (&n
ode
);
- sprintf (name, "%d", s
tate
->number);
- n
ode
.title = name;
- print_core (&node_obstack, s
tate
);
+ new_node (&n);
+ sprintf (name, "%d", s->number);
+ n.title = name;
+ print_core (&node_obstack, s);
obstack_1grow (&node_obstack, '\0');
obstack_1grow (&node_obstack, '\0');
- n
ode
.label = obstack_finish (&node_obstack);
+ n.label = obstack_finish (&node_obstack);
open_node (fgraph);
open_node (fgraph);
- output_node (&n
ode
, fgraph);
+ output_node (&n, fgraph);
close_node (fgraph);
/* Output the edges. */
close_node (fgraph);
/* Output the edges. */
- print_actions (s
tate
, name);
+ print_actions (s, name);
obstack_free (&node_obstack, 0);
}
obstack_free (&node_obstack, 0);
}
@@
-191,32
+194,32
@@
print_state (state_t *state)
void
print_graph (void)
{
void
print_graph (void)
{
- state_number
_t
i;
+ state_number i;
/* Output file. */
fgraph = xfopen (spec_graph_file, "w");
/* Output file. */
fgraph = xfopen (spec_graph_file, "w");
- new_graph (&graph);
+ new_graph (&
static_
graph);
#if 0
#if 0
- graph.smanhattan_edges = yes;
- graph.manhattan_edges = yes;
+
static_
graph.smanhattan_edges = yes;
+
static_
graph.manhattan_edges = yes;
#endif
#endif
- graph.display_edge_labels = yes;
- graph.layoutalgorithm = normal;
+
static_
graph.display_edge_labels = yes;
+
static_
graph.layoutalgorithm = normal;
- graph.port_sharing = no;
- graph.finetuning = yes;
-
graph.
straight_phase = yes;
- graph.priority_phase = yes;
- graph.splines = yes;
+
static_
graph.port_sharing = no;
+
static_
graph.finetuning = yes;
+
static_graph.long_
straight_phase = yes;
+
static_
graph.priority_phase = yes;
+
static_
graph.splines = yes;
- graph.crossing_weight = median;
+
static_
graph.crossing_weight = median;
/* Output graph options. */
open_graph (fgraph);
/* Output graph options. */
open_graph (fgraph);
- output_graph (&graph, fgraph);
+ output_graph (&
static_
graph, fgraph);
/* Output nodes and edges. */
new_closure (nritems);
/* Output nodes and edges. */
new_closure (nritems);
@@
-225,6
+228,6
@@
print_graph (void)
free_closure ();
/* Close graph. */
free_closure ();
/* Close graph. */
- close_graph (&graph, fgraph);
+ close_graph (&
static_
graph, fgraph);
xfclose (fgraph);
}
xfclose (fgraph);
}