- new_node (&node);
- open_node (&graph_obstack);
-
- sprintf(name, "%d", state);
- node.title = name;
- output_node (&node, &graph_obstack);
-
- print_core (state); /* node label */
-
- close_node (&graph_obstack);
-
- print_actions (state, &node); /* edges */
+ obstack_init (&node_obstack);
+ new_node (&node); /* Set node attributs default value. */
+ sprintf (name, "%d", state);
+ 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. */
+ obstack_sgrow (&node_obstack, "\t\tlabel:\t\""); /* Open Label */
+
+ /* Keep the size of NODE_OBSTACK before computing the label. It is
+ useful to format the label. */
+ node_output_size = obstack_object_size (&node_obstack);
+
+ /* Compute the labels of nodes on the fly. */
+ print_core (state, &node_obstack);
+ /* Compute edges and additionnal parts of node label. */
+ print_actions (state, node.title, &node_obstack);
+
+ obstack_sgrow (&node_obstack, "\"\n"); /* Close Label. */
+
+ close_node (&node_obstack);
+ }
+
+ /* `obstack_cat' NODE_OBSTACK to GRAPH_OBSTACK. */
+ obstack_grow (&graph_obstack,
+ obstack_base (&node_obstack),
+ obstack_object_size (&node_obstack));
+ obstack_finish (&node_obstack);