shishi-commit
[Top][All Lists]
Advanced

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

[SCM] GNU shishi branch, master, updated. shishi-1-0-2-32-g8e5585a


From: Mats Erik Andersson
Subject: [SCM] GNU shishi branch, master, updated. shishi-1-0-2-32-g8e5585a
Date: Wed, 25 Jun 2014 19:04:30 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU shishi".

http://git.savannah.gnu.org/cgit/shishi.git/commit/?id=8e5585a9318aa7e503c3f379ee4a720262774e57

The branch, master has been updated
       via  8e5585a9318aa7e503c3f379ee4a720262774e57 (commit)
       via  0be63c4e8430f8269a600f16097b0a0c75d0fbbb (commit)
      from  a279cacba6ce4e9ffa1860aa880b871f0550ab65 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8e5585a9318aa7e503c3f379ee4a720262774e57
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Jun 24 23:53:01 2014 +0200

    gdoc: Refine HTML mode to validate.

commit 0be63c4e8430f8269a600f16097b0a0c75d0fbbb
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Jun 24 17:55:56 2014 +0200

    gdoc: An additional warning condition.
    
    Add a simple checker of Docbook formatted output.

-----------------------------------------------------------------------

Summary of changes:
 doc/gdoc               |   48 +++++++++++++++++++++++--------------
 tests/Makefile.am      |    3 +-
 tests/check_docbook.sh |   62 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/gdoc-warn.c      |   23 +++++++++++++++++
 4 files changed, 117 insertions(+), 19 deletions(-)
 create mode 100755 tests/check_docbook.sh
 create mode 100644 tests/gdoc-warn.c

diff --git a/doc/gdoc b/doc/gdoc
index db948c9..b7cd237 100755
--- a/doc/gdoc
+++ b/doc/gdoc
@@ -157,7 +157,7 @@ my @known_modes = qw/ docbook html listfunc man sgml tex 
texinfo text /;
                     $type_func =>      "<b>\$1</b>",
                     $type_struct =>    "<i>\$1</i>",
                     $type_param =>     "<tt><b>\$1</b></tt>" );
-$blankline_html = "<p>";
+$blankline_html = '</p><p>';
 
 %highlights_texinfo = ( $type_constant => '@code{$1}',
                        $type_func      => '@code{$1}',
@@ -420,9 +420,10 @@ sub output_html {
     my %args = %{$_[0]};
     my ($parameter, $section);
     my $count;
-    print "\n\n<a name=\"". $args{'function'} . 
"\">&nbsp;</a><h2>Function</h2>\n";
+    print "\n", '<a name="', $args{'function'}, '">&nbsp;</a>', "\n",
+         '<h2>Function</h2>', "\n";
 
-    print "<i>".$args{'functiontype'}."</i>\n";
+    print '<i>', $args{'functiontype'}, '</i> ';
     print "<b>".$args{'function'}."</b>\n";
     print "(";
     $count = 0;
@@ -433,14 +434,12 @@ sub output_html {
 
        print '<b>', $parameter, '</b>';
 
-       print '<i>', $args{'arraylength'}{$parameter}, '</i>'
+       print $args{'arraylength'}{$parameter}
              if $args{'arraylength'}{$parameter};
 
-       print "\n";
-
        if ($count != $#{$args{'parameterlist'}}) {
            $count++;
-           print ", ";
+           print ",\n";
        }
     }
     print ")\n";
@@ -457,29 +456,30 @@ sub output_html {
 
            print '<b>', $parameter, '</b>';
 
-           print '<i>', $args{'arraylength'}{$parameter}, '</i>'
+           print $args{'arraylength'}{$parameter}
                if $args{'arraylength'}{$parameter};
 
-           print "\n<dd>";
+           print "</dt>\n<dd><p>";
 
            output_highlight($args{'parameters'}{$parameter});
+           print "</p></dd>\n";
        }
     } else {
-       print "<dt>None\n";
+       print "<dt>None</dt>\n";
     }
 
     print "</dl>\n";
     foreach $section (@{$args{'sectionlist'}}) {
        print "<h3>$section</h3>\n";
-       print "<ul>\n";
+       print "<p>\n";
 
        # Escape all ampersands before displaying.
        my $text = just_highlight($args{'sections'}{$section});
        $text =~ s|&|\&amp;|g;
        print "$text";
-       print "</ul>\n";
+       print "</p>\n";
     }
-    print "<hr>\n";
+    print "<hr />\n";
 }
 
 # output in tex
@@ -843,6 +843,7 @@ sub output_function {
 # takes a function prototype and spits out all the details
 # stored in global arrays/hashes.
 sub dump_function {
+    my $docname = shift @_;
     my $prototype = shift @_;
 
     my %arraylength;
@@ -885,7 +886,10 @@ sub dump_function {
 
            if ($param ne "void" and not $parameters{$param}) {
                $parameters{$param} = "-- undescribed --";
-               print STDERR "warning: $lineno: Function parameter '$param' not 
described in '$function_name'\n";
+               print STDERR 'Warning(', $lineno - 1, '): ',
+                            'Function parameter "', $param, '" ',
+                            'is not described by "', $docname, '".',
+                            "\n";
            }
 
            push @parameterlist, $param;
@@ -894,10 +898,17 @@ sub dump_function {
 #          print STDERR "param = '$param', type = '$type'\n";
        }
     } else {
-       print STDERR "warning: $lineno: Cannot understand prototype: 
'$prototype'\n";
+       print STDERR 'Warning(', $lineno - 1, '): ',
+                    'Cannot understand prototype: ',
+                    "'$prototype'.\n";
        return;
     }
 
+    print STDERR 'Warning(', $lineno - 1, '): ',
+                'Defines "', $function_name, '"',
+                ', but "', $docname, '" was documented.', "\n"
+       if $docname ne $function_name;
+
     if ($function_only==0 || defined($function_table{$function_name})) {
        output_function({'function' => $function_name,
                         'module' => $modulename,
@@ -1012,7 +1023,7 @@ foreach my $file (@ARGV) {
                    print STDERR "Info($lineno): Scanning doc for $function\n";
                }
            } else {
-               print STDERR "warning: $lineno: Cannot understand $_ on line 
$lineno",
+               print STDERR "Warning($lineno): Cannot understand '$_' on line 
$lineno",
                " - I thought it was a doc line\n";
                $state = 0;
            }
@@ -1054,7 +1065,7 @@ foreach my $file (@ARGV) {
                }
            } else {
                # i dont know - bad line?  ignore.
-               print STDERR "warning: $lineno: Bad line: $_";
+               print STDERR "Warning($lineno): Bad line: $_\n";
            }
        } elsif ($state == 3) { # scanning for function { (end of prototype)
            if (m#\s*/\*\s+MACDOC\s*#io) {
@@ -1067,7 +1078,8 @@ foreach my $file (@ARGV) {
                $prototype =~ s@/\*.*?\*/@@gos; # strip comments.
                $prototype =~ address@hidden@ @gos; # strip newlines/cr's.
                $prototype =~ address@hidden +@@gos; # strip leading spaces
-               dump_function($prototype);
+
+               dump_function($function, $prototype);
 
                $function = "";
                %constants = ();
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9cf0b29..12da084 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -18,7 +18,8 @@
 # to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 # Floor, Boston, MA 02110-1301, USA.
 
-EXTRA_DIST = shisa.sh shishi.supp keytab1.bin ccache1.bin
+EXTRA_DIST = shisa.sh shishi.supp keytab1.bin ccache1.bin \
+            check_docbook.sh
 
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl \
diff --git a/tests/check_docbook.sh b/tests/check_docbook.sh
new file mode 100755
index 0000000..94b9341
--- /dev/null
+++ b/tests/check_docbook.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# Check whether Docbook mode allows gdoc to produce
+# valid XML as output.
+#
+# Copyright (C) 2014 Mats Erik Andersson
+#
+# This file is part of Shishi.
+#
+# Shishi is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Shishi is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Shishi; if not, see http://www.gnu.org/licenses or write
+# to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+# Floor, Boston, MA 02110-1301, USA.
+
+set -eu
+
+GDOC=${GDOC:-gdoc}
+XMLLINT=${XMLLINT:-xmllint}
+XSLTPROC=${XSLTPROC:-xsltproc}
+
+if test -z "$(command -v $XMLLINT)"; then
+    echo >&2 'Not able to access xmllint.'
+    exit 77
+fi
+
+#if test -z "$(command -v $XSLTPROC)"; then
+#    echo >&2 'Not able to access xsltproc.'
+#    exit 77
+#fi
+
+if test -z "$(command -v $GDOC)"; then
+    GDOC=./doc/gdoc
+    if test ! -x $GDOC; then
+       GDOC=../doc/gdoc
+       if test ! -x $GDOC; then
+           echo >&2 'Not able to find an executable gdoc.'
+           exit 77
+       fi
+    fi
+fi
+
+while test $# -gt 0; do
+    file=$1
+    shift
+    printf "%-20s" ">>> $file"
+
+    FLIST=$($GDOC -listfunc $file 2>/dev/null)
+    for funcname in $FLIST; do
+       $GDOC -docbook -dtd -function $funcname $file |
+       $XMLLINT -noout -valid -
+    done && echo ' OK'
+done
diff --git a/tests/gdoc-warn.c b/tests/gdoc-warn.c
new file mode 100644
index 0000000..c8bbec6
--- /dev/null
+++ b/tests/gdoc-warn.c
@@ -0,0 +1,23 @@
+/**
+ * no_param_desc: - throws a warning
+ * @n:
+ *
+ * Missing parameter description.
+ **/
+void
+no_param_desc (int n)
+{
+  return;
+}
+
+/**
+ * differing_names: - throws a warning
+ * @n: ignored integer
+ *
+ * Misspelled function name.
+ **/
+void
+differing_name (int n)
+{
+  return;
+}


hooks/post-receive
-- 
GNU shishi



reply via email to

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