- 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. */
+
+ {
+ /* 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. */
+ }
+
+ open_node (fgraph);
+ /* Output a VCG formatted attributs list. */
+ output_node (&node, fgraph);
+ /* Save the node label. */
+ fwrite (obstack_base (&node_obstack),
+ obstack_object_size (&node_obstack), 1, fgraph);
+ close_node (fgraph);
+
+ obstack_free (&node_obstack, 0);