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: Joel E. Denny
Subject: Re: bison version in graph output file
Date: Sat, 1 May 2010 20:55:45 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Hi Tys,

On Sun, 2 May 2010, tys lefering wrote:

> use of c++ comment style to prevent trouble with possible
> unusual filenames looks good idea and should not be any
> problem for tools reading dot graphs.

Then, regardless of what we put in the comments now, I think I'll keep the 
new comment style in case we eventually need it.

> actually liked the use of 'digraph "parser-name" { }'
> because it is usefull and maybe better then 'Automation'.
>
> for example can put this way graph title in window top
> in vcgview which is a gtk+ gui tool reading dot graph.
> 
> also the graph title will appear in few types of dot
> output, for example the ps output with 'dot -Tps' as:

I wasn't aware of that.  Good point.

What about something like

  "LALR(1) Automaton for parser.y"

where LALR(1) could also be IELR(1) or canonical LR(1)?

> for grep it can be idea to put bison version string
> and parser name in one line, then 'grep bison *.dot'
> does show the bison graphs and what it is about in
> a directory with many different dot graph files.

I think we could potentially grow many pieces of information like this 
(for example, whether it's LALR(1) and whether default reductions are 
enabled), but how much should be on one line?  What about using something 
like "grep -A3 Bison *.dot"?

> noticed there is no statement about the copyright status
> of gcc and bison generated graph output files, assuming
> it is "undefined" and maybe not good situation for the
> fsf free software foundation.

I don't know, but I don't believe we've ever worried about that before.  
Akim?

Here's a new version of the previous patches.  They only convert to "//" 
and update xml2dot.xsl.  I went ahead and pushed to master and branch-2.5.  
However, I'm still thinking that it might be nice to have more information 
(like the type of the automaton) and that we should make all the same 
additions to the ASCII and XHTML output.

>From b7666378f5cb5e9587d3c918f0cdcaf6f8aca5c7 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Fri, 30 Apr 2010 19:50:34 -0400
Subject: [PATCH] In DOT output, convert from "/*" comments to "//" comments.

This handles the possibility that a "*/" might appear in
variable portions of those comments at some point in the future.
* src/graphviz.c (start_graph): Implement.
---
 ChangeLog      |    7 +++++++
 src/graphviz.c |    8 +++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1bc9ec7..4904085 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-01  Joel E. Denny  <address@hidden>
+
+       In DOT output, convert from "/*" comments to "//" comments.
+       This handles the possibility that a "*/" might appear in
+       variable portions of those comments at some point in the future.
+       * src/graphviz.c (start_graph): Implement.
+
 2010-04-30  Joel E. Denny  <address@hidden>
 
        Document that undefined %prec identifier warnings will remain.
diff --git a/src/graphviz.c b/src/graphviz.c
index 13f279f..5eefcbf 100644
--- a/src/graphviz.c
+++ b/src/graphviz.c
@@ -40,11 +40,9 @@ void
 start_graph (FILE *fout)
 {
   fprintf (fout,
-           _("/*\n"
-             " * Generated by %s.\n"
-             " * Report bugs to <%s>.\n"
-             " * Home page: <%s>.\n"
-             " */\n"
+           _("// Generated by %s.\n"
+             "// Report bugs to <%s>.\n"
+             "// Home page: <%s>.\n"
              "\n"),
            PACKAGE_STRING,
            PACKAGE_BUGREPORT,
-- 
1.5.4.3


>From bc81de36b7ef78ff280e14a173e5cc5d5a3191eb Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Fri, 30 Apr 2010 19:50:52 -0400
Subject: [PATCH] tests: fix maintainer-xml-check.

* data/xslt/xml2dot.xsl (xsl:template match="bison-xml-report"):
Update output to include comments now produced by --graph.
(xsl:template match="automaton"): As for --graph, name the
digraph after the grammar file.
* src/print-xml.c (escape_bufs): Enlarge array.
(print_xml): Add bug-report and url attributes to
bison-xml-report element.
---
 ChangeLog             |   11 +++++++++++
 data/xslt/xml2dot.xsl |   20 ++++++++++++++++++--
 src/print-xml.c       |   10 +++++++---
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4904085..fcc5975 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2010-05-01  Joel E. Denny  <address@hidden>
 
+       tests: fix maintainer-xml-check.
+       * data/xslt/xml2dot.xsl (xsl:template match="bison-xml-report"):
+       Update output to include comments now produced by --graph.
+       (xsl:template match="automaton"): As for --graph, name the
+       digraph after the grammar file.
+       * src/print-xml.c (escape_bufs): Enlarge array.
+       (print_xml): Add bug-report and url attributes to
+       bison-xml-report element.
+
+2010-05-01  Joel E. Denny  <address@hidden>
+
        In DOT output, convert from "/*" comments to "//" comments.
        This handles the possibility that a "*/" might appear in
        variable portions of those comments at some point in the future.
diff --git a/data/xslt/xml2dot.xsl b/data/xslt/xml2dot.xsl
index 887a991..836bb1b 100644
--- a/data/xslt/xml2dot.xsl
+++ b/data/xslt/xml2dot.xsl
@@ -35,11 +35,27 @@
 </xsl:template>
 
 <xsl:template match="bison-xml-report">
-  <xsl:apply-templates select="automaton"/>
+  <xsl:text>// Generated by GNU Bison </xsl:text>
+  <xsl:value-of select="@version"/>
+  <xsl:text>.&#10;</xsl:text>
+  <xsl:text>// Report bugs to &lt;</xsl:text>
+  <xsl:value-of select="@bug-report"/>
+  <xsl:text>&gt;.&#10;</xsl:text>
+  <xsl:text>// Home page: &lt;</xsl:text>
+  <xsl:value-of select="@url"/>
+  <xsl:text>&gt;.&#10;&#10;</xsl:text>
+  <xsl:apply-templates select="automaton">
+    <xsl:with-param name="filename" select="filename"/>
+  </xsl:apply-templates>
 </xsl:template>
 
 <xsl:template match="automaton">
-  <xsl:text>digraph Automaton {&#10;</xsl:text>
+  <xsl:param name="filename"/>
+  <xsl:text>digraph "</xsl:text>
+  <xsl:call-template name="escape">
+    <xsl:with-param name="subject" select="$filename"/>
+  </xsl:call-template>
+  <xsl:text>"&#10;{&#10;</xsl:text>
   <xsl:apply-templates select="state"/>
   <xsl:text>}&#10;</xsl:text>
 </xsl:template>
diff --git a/src/print-xml.c b/src/print-xml.c
index 0d68171..b23de38 100644
--- a/src/print-xml.c
+++ b/src/print-xml.c
@@ -48,7 +48,7 @@ struct escape_buf
   char *ptr;
   size_t size;
 };
-static struct escape_buf escape_bufs[2];
+static struct escape_buf escape_bufs[3];
 
 
 /*--------------------------------.
@@ -505,8 +505,12 @@ print_xml (void)
   FILE *out = xfopen (spec_xml_file, "w");
 
   fputs ("<?xml version=\"1.0\"?>\n\n", out);
-  xml_printf (out, level, "<bison-xml-report version=\"%s\">",
-             xml_escape (VERSION));
+  xml_printf (out, level,
+              "<bison-xml-report version=\"%s\" bug-report=\"%s\""
+              " url=\"%s\">",
+              xml_escape_n (0, VERSION),
+              xml_escape_n (1, PACKAGE_BUGREPORT),
+              xml_escape_n (2, PACKAGE_URL));
 
   fputc ('\n', out);
   xml_printf (out, level + 1, "<filename>%s</filename>",
-- 
1.5.4.3





reply via email to

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