57 |
short *sp; |
short *sp; |
58 |
short *sp1; |
short *sp1; |
59 |
|
|
60 |
statep = state_table[state]; |
statep = state_table[state].state; |
61 |
k = statep->nitems; |
k = statep->nitems; |
62 |
|
|
63 |
if (k == 0) |
if (k == 0) |
88 |
} |
} |
89 |
} |
} |
90 |
|
|
91 |
/* Output in graph_obstack edges specifications in incidence with current |
/* Output in graph_obstack edges specifications in incidence with current |
92 |
node. */ |
node. */ |
93 |
static void |
static void |
94 |
print_actions (int state, const char *node_name, struct obstack *node_obstack) |
print_actions (int state, const char *node_name, struct obstack *node_obstack) |
126 |
if (!shiftp->shifts[i]) |
if (!shiftp->shifts[i]) |
127 |
continue; |
continue; |
128 |
state1 = shiftp->shifts[i]; |
state1 = shiftp->shifts[i]; |
129 |
symbol = accessing_symbol[state1]; |
symbol = state_table[state1].accessing_symbol; |
130 |
|
|
131 |
if (ISVAR (symbol)) |
if (ISVAR (symbol)) |
132 |
break; |
break; |
195 |
if (!shiftp->shifts[i]) |
if (!shiftp->shifts[i]) |
196 |
continue; |
continue; |
197 |
state1 = shiftp->shifts[i]; |
state1 = shiftp->shifts[i]; |
198 |
symbol = accessing_symbol[state1]; |
symbol = state_table[state1].accessing_symbol; |
199 |
|
|
200 |
new_edge (&edge); |
new_edge (&edge); |
201 |
open_edge (&edge, fgraph); |
open_edge (&edge, fgraph); |
210 |
} |
} |
211 |
} |
} |
212 |
|
|
213 |
/* Output in GRAPH_OBSTACK the current node specifications and edges |
/* Output in GRAPH_OBSTACK the current node specifications and edges |
214 |
which go out from that node. */ |
which go out from that node. */ |
215 |
static void |
static void |
216 |
print_state (int state) |
print_state (int state) |
223 |
new_node (&node); /* Set node attributs default value. */ |
new_node (&node); /* Set node attributs default value. */ |
224 |
sprintf (name, "%d", state); |
sprintf (name, "%d", state); |
225 |
node.title = name; /* Give a name to the node. */ |
node.title = name; /* Give a name to the node. */ |
226 |
|
|
227 |
{ |
{ |
228 |
/* Here we begin to compute the node label. */ |
/* Here we begin to compute the node label. */ |
229 |
obstack_sgrow (&node_obstack, "\t\tlabel:\t\""); /* Open Label */ |
obstack_sgrow (&node_obstack, "\t\tlabel:\t\""); /* Open Label */ |
230 |
|
|
231 |
/* Keep the size of NODE_OBSTACK before computing the label. It is |
/* Keep the size of NODE_OBSTACK before computing the label. It is |
232 |
useful to format the label. */ |
useful to format the label. */ |
233 |
node_output_size = obstack_object_size (&node_obstack); |
node_output_size = obstack_object_size (&node_obstack); |
234 |
|
|
235 |
/* Compute the labels of nodes on the fly. */ |
/* Compute the labels of nodes on the fly. */ |
236 |
print_core (state, &node_obstack); |
print_core (state, &node_obstack); |
237 |
/* Compute edges and additionnal parts of node label. */ |
/* Compute edges and additionnal parts of node label. */ |
238 |
print_actions (state, node.title, &node_obstack); |
print_actions (state, node.title, &node_obstack); |
239 |
|
|
240 |
obstack_sgrow (&node_obstack, "\"\n"); /* Close Label. */ |
obstack_sgrow (&node_obstack, "\"\n"); /* Close Label. */ |
241 |
} |
} |
242 |
|
|
243 |
open_node (fgraph); |
open_node (fgraph); |
244 |
/* Output a VCG formatted attributs list. */ |
/* Output a VCG formatted attributs list. */ |
245 |
output_node (&node, fgraph); |
output_node (&node, fgraph); |
246 |
/* Save the node label. */ |
/* Save the node label. */ |
247 |
fwrite (obstack_base (&node_obstack), |
fwrite (obstack_base (&node_obstack), |
248 |
obstack_object_size (&node_obstack), 1, fgraph); |
obstack_object_size (&node_obstack), 1, fgraph); |
249 |
close_node (fgraph); |
close_node (fgraph); |
250 |
|
|
256 |
print_graph (void) |
print_graph (void) |
257 |
{ |
{ |
258 |
int i; |
int i; |
259 |
|
|
260 |
if (!graph_flag) |
if (!graph_flag) |
261 |
return; |
return; |
262 |
|
|
267 |
|
|
268 |
#if 0 |
#if 0 |
269 |
graph.smanhattan_edges = yes; |
graph.smanhattan_edges = yes; |
270 |
graph.manhattan_edges = yes; |
graph.manhattan_edges = yes; |
271 |
#endif |
#endif |
272 |
|
|
273 |
graph.display_edge_labels = yes; |
graph.display_edge_labels = yes; |