bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison test version 1.875e bugs


From: Paul Eggert
Subject: Re: Bison test version 1.875e bugs
Date: Wed, 15 Dec 2004 16:15:55 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

address@hidden writes:

> 2) use of keyword `expand' should be `stretch'
> 3) keyword `normal' for layoutalgorithm does only exist
>    at commandline, not in the graph. in the vcg.c this
>    keyword `normal' is mentioned, should not be there.
>    in the graph output should be no line `layoutalgorithm:'
>    to select the default layoutalgorithm.
> 6) at around 32k %token statements strange things may happen.

Thanks for these bug reports.  I installed the fixes quoted at the
end of this message.  Please give them a try.

> 5) strtol() in handle_action_dollar() is missing check
>    on complete number conversion. try ` $$=$1gnu ' no warning.

POSIX doesn't require a check here, as near as I can tell.  See
<http://www.opengroup.org/onlinepubs/009695399/utilities/yacc.html>
for the POSIX spec.  Here, Bison is behaving compatibly with
traditional Yacc.  I'd like to release a new stable version soon, so
I'm inclined to leave the behavior as-is unless it's causing real
trouble.

> 1) vcg graph output has no ` title: "name" ' in the toplevel graph

Is a title required?  The VCG documentation I found suggested that it
was optional.  What is the downside of omitting the title?  If it's
needed, can we just say the title is something like "0", as we do for
other nodes?

> 4) a c-comment line in the vcg graph output with the bison
>    version and input file would be nice, if possible with
>    number of nodes/edges/backedges.

That might be nice, yes.  However, the Bison TODO says:

  * Move to Graphviz
  Well, VCG seems really dead.  Move to Graphviz instead.  Also, equip
  the parser with a means to create the (visual) parse tree.

so for VCG I'm inclined to do bugfixing only.

Thanks again for your bug report.  Here's the patch:

2004-12-15  Paul Eggert  <address@hidden>

        Fix some problems reported by twlevo at xs4all.
        * src/symtab.c (symbol_new): Report an error if the input grammar
        contains too many symbols.  This is better than calling abort() later.
        * src/vcg.h (enum layoutalgorithm): Remove.  All uses removed.
        (struct node, struct graph):
        Rename member expand to stretch.  All uses changed.
        (struct graph): Remove member layoutalgorithm.  All uses removed.
        * src/vcg.c (get_layoutalgorithm_str): Remove.  All uses removed.
        * src/vcg_defaults.h (G_STRETCH): Renamed from G_EXPAND.
        All uses changed.
        (N_STRETCH): Rename from N_EXPAND.  All uses changed.

Index: src/symtab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.c,v
retrieving revision 1.58
diff -p -u -r1.58 symtab.c
--- src/symtab.c        10 Dec 2004 07:50:44 -0000      1.58
+++ src/symtab.c        16 Dec 2004 00:02:09 -0000
@@ -66,6 +66,9 @@ symbol_new (uniqstr tag, location loc)
   res->alias = NULL;
   res->class = unknown_sym;
 
+  if (nsyms == SYMBOL_NUMBER_MAXIMUM)
+    fatal (_("too many symbols in input grammar (limit is %d)"),
+          SYMBOL_NUMBER_MAXIMUM);
   nsyms++;
   return res;
 }
Index: src/print_graph.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print_graph.c,v
retrieving revision 1.55
diff -p -u -r1.55 print_graph.c
--- src/print_graph.c   21 Jun 2004 20:20:31 -0000      1.55
+++ src/print_graph.c   16 Dec 2004 00:02:09 -0000
@@ -208,7 +208,6 @@ print_graph (void)
 #endif
 
   static_graph.display_edge_labels = yes;
-  static_graph.layoutalgorithm = normal;
 
   static_graph.port_sharing = no;
   static_graph.finetuning = yes;
Index: src/vcg.c
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.c,v
retrieving revision 1.15
diff -p -u -r1.15 vcg.c
--- src/vcg.c   10 Dec 2004 07:50:44 -0000      1.15
+++ src/vcg.c   16 Dec 2004 00:02:09 -0000
@@ -59,7 +59,7 @@ new_graph (graph *g)
   g->y = G_Y;
   g->folding = G_FOLDING;
   g->shrink = G_SHRINK;
-  g->expand = G_EXPAND;
+  g->stretch = G_STRETCH;
 
   g->textmode = G_TEXTMODE;
   g->shape = G_SHAPE;
@@ -85,7 +85,6 @@ new_graph (graph *g)
 
   g->classname = G_CLASSNAME; /* No class name association. */
 
-  g->layoutalgorithm = G_LAYOUTALGORITHM;
   g->layout_downfactor = G_LAYOUT_DOWNFACTOR;
   g->layout_upfactor = G_LAYOUT_UPFACTOR;
   g->layout_nearfactor = G_LAYOUT_NEARFACTOR;
@@ -149,7 +148,7 @@ new_node (node *n)
   n->height = N_HEIGHT; /* Also. */
 
   n->shrink = N_SHRINK;
-  n->expand = N_EXPAND;
+  n->stretch = N_STRETCH;
 
   n->folding = N_FOLDING; /* No explicit default value. */
 
@@ -275,29 +274,6 @@ get_shape_str (enum shape shape)
 }
 
 static const char *
-get_layoutalgorithm_str (enum layoutalgorithm layoutalgorithm)
-{
-  switch (layoutalgorithm)
-    {
-    case normal:               return "normal";
-    case maxdepth:     return "maxdepth";
-    case mindepth:     return "mindepth";
-    case maxdepthslow: return "maxdepthslow";
-    case mindepthslow: return "mindepthslow";
-    case maxdegree:    return "maxdegree";
-    case mindegree:    return "mindegree";
-    case maxindegree:  return "maxindegree";
-    case minindegree:  return "minindegree";
-    case maxoutdegree: return "maxoutdegree";
-    case minoutdegree: return "minoutdegree";
-    case minbackward:  return "minbackward";
-    case dfs:          return "dfs";
-    case tree:         return "tree";
-    default:           abort (); return NULL;
-    }
-}
-
-static const char *
 get_decision_str (enum decision decision)
 {
   switch (decision)
@@ -559,8 +535,8 @@ output_node (node *n, FILE *fout)
 
   if (n->shrink != N_SHRINK)
     fprintf (fout, "\t\tshrink:\t%d\n", n->shrink);
-  if (n->expand != N_EXPAND)
-    fprintf (fout, "\t\texpand:\t%d\n", n->expand);
+  if (n->stretch != N_STRETCH)
+    fprintf (fout, "\t\tstretch:\t%d\n", n->stretch);
 
   if (n->folding != N_FOLDING)
     fprintf (fout, "\t\tfolding:\t%d\n", n->folding);
@@ -687,8 +663,8 @@ output_graph (graph *g, FILE *fout)
 
   if (g->shrink != G_SHRINK)
     fprintf (fout, "\tshrink:\t%d\n", g->shrink);
-  if (g->expand != G_EXPAND)
-    fprintf (fout, "\texpand:\t%d\n", g->expand);
+  if (g->stretch != G_STRETCH)
+    fprintf (fout, "\tstretch:\t%d\n", g->stretch);
 
   if (g->textmode != G_TEXTMODE)
     fprintf (fout, "\ttextmode:\t%s\n",
@@ -761,10 +737,6 @@ output_graph (graph *g, FILE *fout)
        }
     }
 
-  if (g->layoutalgorithm != G_LAYOUTALGORITHM)
-    fprintf (fout, "\tlayoutalgorithm:\t%s\n",
-            get_layoutalgorithm_str (g->layoutalgorithm));
-
   if (g->layout_downfactor != G_LAYOUT_DOWNFACTOR)
     fprintf (fout, "\tlayout_downfactor:\t%d\n", g->layout_downfactor);
   if (g->layout_upfactor != G_LAYOUT_UPFACTOR)
Index: src/vcg.h
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.h,v
retrieving revision 1.8
diff -p -u -r1.8 vcg.h
--- src/vcg.h   1 Oct 2003 07:46:41 -0000       1.8
+++ src/vcg.h   16 Dec 2004 00:02:09 -0000
@@ -102,26 +102,6 @@ struct infoname
   struct infoname *next;
 };
 
-/* Layout Algorithms which can be found in VCG.
-   Details about each algoithm can be found below. */
-enum layoutalgorithm
-{
-  normal,
-  maxdepth,
-  mindepth,
-  maxdepthslow,
-  mindepthslow,
-  maxdegree,
-  mindegree,
-  maxindegree,
-  minindegree,
-  maxoutdegree,
-  minoutdegree,
-  minbackward,
-  dfs,
-  tree
-};
-
 /* VCG decision yes/no. */
 enum decision
 {
@@ -232,18 +212,18 @@ struct node
   int width;
   int height;
 
-  /* shrink, expand gives the shrinking and expanding factor of the
+  /* shrink, stretch gives the shrinking and stretching factor of the
      node. The values of the attributes width, height, borderwidth and
-     the size of the label text is scaled by ((expand=shrink) \Lambda
+     the size of the label text is scaled by ((stretch=shrink) \Lambda
      100) percent. Note that the actual scale value is determined by the
      scale value of a node relatively to a scale value of the graph,
-     i.e. if (expand,shrink) = (2,1) for the graph and (expand,shrink)
+     i.e. if (stretch,shrink) = (2,1) for the graph and (stretch,shrink)
      = (2,1) for the node of the graph, then the node is scaled by the
      factor 4 compared to the normal size. The scale value can also be
      specified by scaling: float.
      Default are 1,1. */
   int shrink;
-  int expand;
+  int stretch;
 
   /* folding specifies the default folding of the nodes. The folding k
      (with k ? 0) means that the graph part that is reachable via edges
@@ -542,16 +522,16 @@ struct graph
      Default value is 0 */
   int folding;
 
-  /* Shrink, expand gives the shrinking and expanding factor for the
-     graph's representation (default is 1, 1). ((expand=shrink) \Lambda
+  /* Shrink, stretch gives the shrinking and stretching factor for the
+     graph's representation (default is 1, 1). ((stretch=shrink) \Lambda
      100) is the scaling of the graph in percentage, e.g.,
-     (expand,shrink) = (1,1) or (2,2) or (3,3) : : : is normal size,
-     (expand,shrink) = (1,2) is half size, (expand,shrink) = (2,1) is
+     (stretch,shrink) = (1,1) or (2,2) or (3,3) : : : is normal size,
+     (stretch,shrink) = (1,2) is half size, (stretch,shrink) = (2,1) is
      double size. For subgraphs, it is also the scaling factor of the
      summary node. The scaling factor can also be specified by scaling:
      float (here, scaling 1.0 means normal size). */
   int shrink;
-  int expand;
+  int stretch;
 
   /* textmode specifies the adjustment of the text within the border of a
      summary node. The possibilities are center, left.justify and
@@ -678,34 +658,6 @@ struct graph
      Default id NULL.  */
   struct colorentry *colorentry;
 
-  /* layoutalgorithm chooses different graph layout algorithms
-     Possibilities are maxdepth, mindepth, maxdepthslow, mindepthslow,
-     maxdegree, mindegree, maxindegree, minindegree, maxoutdegree,
-     minoutdegree, minbackward, dfs and tree. The default algorithm tries
-     to give all edges the same orientation and is based on the
-     calculation of strongly connected components. The algorithms that
-     are based on depth first search are faster. While the simple dfs
-     does not enforce additionally constraints, the algorithm maxdepth
-     tries to increase the depth of the layout and the algorithm mindepth
-     tries to increase the wide of the layout. These algorithms are fast
-     heuristics. If they are not appropriate, the algorithms maxdepthslow
-     or mindepthslow also increase the depth or wide, but they are very
-     slow. The algorithm maxindegree lays out the nodes by scheduling the
-     nodes with the maximum of incoming edges first, and minindegree lays
-     out the nodes by scheduling the nodes with the minimum of incoming
-     edges first. In the same manner work the algorithms maxoutdegree and
-     minoutdegree for outgoing edges, and maxdegree and mindegree for the
-     sum of incoming and outgoing edges. These algorithms may have various
-     effects, and can sometimes be used as replacements of maxdepthslow
-     or mindepthslow.
-
-     The algorithm minbackward can be used if the graph is acyclic.
-     The algorithm tree is a specialized method for downward laid out
-     trees. It is much faster on such tree-like graphs and results in a
-     balanced layout.
-     Default is normal. */
-  enum layoutalgorithm layoutalgorithm;
-
   /* Layout downfactor, layout upfactor, layout nearfactor The layout
      algorithm partitions the set of edges into edges pointing upward,
      edges pointing downward, and edges pointing sidewards. The last type
Index: src/vcg_defaults.h
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg_defaults.h,v
retrieving revision 1.5
diff -p -u -r1.5 vcg_defaults.h
--- src/vcg_defaults.h  13 Dec 2002 08:50:13 -0000      1.5
+++ src/vcg_defaults.h  16 Dec 2004 00:02:09 -0000
@@ -43,7 +43,7 @@
 # define G_FOLDING             0
 
 # define G_SHRINK              1
-# define G_EXPAND              1
+# define G_STRETCH             1
 
 # define G_TEXTMODE            centered
 # define G_SHAPE               box
@@ -129,7 +129,7 @@
 # define N_HEIGHT              -1      /* also. */
 
 # define N_SHRINK              1
-# define N_EXPAND              1
+# define N_STRETCH             1
 
 # define N_FOLDING             -1      /* no explicit default value. */
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]