/[bison]/bison/src/print_graph.c
ViewVC logotype

Diff of /bison/src/print_graph.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by akim, Thu Oct 4 14:55:20 2001 UTC revision 1.8 by akim, Mon Nov 19 10:07:14 2001 UTC
# Line 57  print_core (int state, struct obstack *n Line 57  print_core (int state, struct obstack *n
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)
# Line 88  print_core (int state, struct obstack *n Line 88  print_core (int state, struct obstack *n
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)
# Line 126  print_actions (int state, const char *no Line 126  print_actions (int state, const char *no
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;
# Line 195  print_actions (int state, const char *no Line 195  print_actions (int state, const char *no
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);
# Line 210  print_actions (int state, const char *no Line 210  print_actions (int state, const char *no
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)
# Line 223  print_state (int state) Line 223  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    
# Line 256  void Line 256  void
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    
# Line 267  print_graph (void) Line 267  print_graph (void)
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;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26