bison-patches
[Top][All Lists]
Advanced

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

Re: bison version in graph output file


From: Akim Demaille
Subject: Re: bison version in graph output file
Date: Mon, 5 Apr 2010 21:42:51 +0200

Le 5 févr. 2010 à 14:45, tys lefering a écrit :

> Hi,
> Here is a very small patch to add a comment line
> in the output graph with the bison version number.
> Would like to have that in the graph output file.
> 
> --- /home/twlevo/etc/bisongit/bison/src/graphviz.c    2010-01-13
> 20:20:52.000000000 +0100
> +++ graphviz.c        2010-02-05 14:34:35.000000000 +0100
> @@ -38,6 +38,7 @@
> void
> start_graph (FILE *fout)
> {
> +  fprintf (fout, "/* generated with GNU Bison parser generator version
> %s. Report bugs to <%s>. http://www.gnu.org/software/bison/ */\n",
> VERSION, PACKAGE_BUGREPORT);
>   fputs ("digraph Automaton {\n", fout);
> }

Hi Tys,

I installed the following patch in branch-2.5 and master.  I hesitated about 
putting the name of the file in the comments too, but I'm bothered by the fact 
that there is no means to quote strings in comments.  So if someone had a 
directory * containing foo.y, then we would get something incorrect.  Of course 
I can keep the basename of the file, but then on Windows, where the separator 
is not /, this would not work properly either.

I figured that it was safe to use it as the graph name.  But I'd be happy to 
hear other opinions.

Cheers!

From a02797656ed9675eaabfcf9114301f8c7cb45383 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Mon, 5 Apr 2010 21:30:36 +0200
Subject: [PATCH 1/2] graph: sign the output file.

        * src/graphviz.c (start_graph): Issue comments about Bison.
        Suggested by Tys Lefering.
(cherry picked from commit 8176ab33c83a8f393fb9a55b4ba28a8f5dc526c8)
---
 ChangeLog      |    6 ++++++
 src/graphviz.c |   16 +++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d764f12..24b263a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-05  Akim Demaille  <address@hidden>
+
+       graph: sign the output file.
+       * src/graphviz.c (start_graph): Issue comments about Bison.
+       Suggested by Tys Lefering.
+
 2010-03-31  Joel E. Denny  <address@hidden>
 
        portability: fix test suite for GCC 4.5's new #error message.
diff --git a/src/graphviz.c b/src/graphviz.c
index 3b483b5..13f279f 100644
--- a/src/graphviz.c
+++ b/src/graphviz.c
@@ -24,6 +24,7 @@
 
 #include <quotearg.h>
 
+#include "files.h"
 #include "graphviz.h"
 
 /* Return an unambiguous printable representation for NAME, suitable
@@ -38,7 +39,20 @@ quote (char const *name)
 void
 start_graph (FILE *fout)
 {
-  fputs ("digraph Automaton {\n", fout);
+  fprintf (fout,
+           _("/*\n"
+             " * Generated by %s.\n"
+             " * Report bugs to <%s>.\n"
+             " * Home page: <%s>.\n"
+             " */\n"
+             "\n"),
+           PACKAGE_STRING,
+           PACKAGE_BUGREPORT,
+           PACKAGE_URL);
+  fprintf (fout,
+           "digraph %s\n"
+           "{\n",
+           quote (grammar_file));
 }
 
 void
-- 
1.7.0.3








reply via email to

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