[svn:parrot] r37800 - in trunk: . t/codingstd tools/docs

coke at svn.parrot.org coke at svn.parrot.org
Sat Mar 28 14:41:27 UTC 2009


Author: coke
Date: Sat Mar 28 14:41:26 2009
New Revision: 37800
URL: https://trac.parrot.org/parrot/changeset/37800

Log:
[t/docs] Update the output of test to show the expected signature
removes the need for a separate tool that had a separate implementation
from the test for generating docs.

Deleted:
   trunk/tools/docs/func_boilerplate.pl
Modified:
   trunk/MANIFEST
   trunk/t/codingstd/c_function_docs.t

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Sat Mar 28 14:31:38 2009	(r37799)
+++ trunk/MANIFEST	Sat Mar 28 14:41:26 2009	(r37800)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Mar 27 19:13:49 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Mar 28 14:40:23 2009 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2101,7 +2101,6 @@
 tools/dev/vgp                                               []
 tools/dev/vms-patch                                         []
 tools/dev/vtablize.pl                                       []
-tools/docs/func_boilerplate.pl                              []
 tools/docs/mk_chm.pl                                        []
 tools/docs/ops_summary.pl                                   []
 tools/docs/write_docs.pl                                    []

Modified: trunk/t/codingstd/c_function_docs.t
==============================================================================
--- trunk/t/codingstd/c_function_docs.t	Sat Mar 28 14:31:38 2009	(r37799)
+++ trunk/t/codingstd/c_function_docs.t	Sat Mar 28 14:41:26 2009	(r37800)
@@ -44,19 +44,19 @@
 
     for my $function_decl (@function_decls) {
 
-        my $escaped_decl = $function_decl;
-
         # strip out any PARROT_* prefixes
-        $escaped_decl =~ s/^\s*PARROT_[A-Z_]*\b\s+//gm;
+        $function_decl =~ s/^\s*PARROT_[A-Z_]*\b\s+//gm;
 
         # strip out any ARG* modifiers
-        $escaped_decl =~ s/ARG(?:IN|MOD)(?:_NULLOK)?\((.*?)\)/$1/g;
+        $function_decl =~ s/ARG(?:IN|MOD)(?:_NULLOK)?\((.*?)\)/$1/g;
 
         # strip out the SHIM modifier
-        $escaped_decl =~ s/SHIM\((.*?)\)/$1/g;
+        $function_decl =~ s/SHIM\((.*?)\)/$1/g;
 
         # SHIM_INTERP is still a PARROT_INTERP
-        $escaped_decl =~ s/SHIM_INTERP/PARROT_INTERP/g;
+        $function_decl =~ s/SHIM_INTERP/PARROT_INTERP/g;
+
+        my $escaped_decl = $function_decl;
 
         # escape [, ], (, ), and *
         $escaped_decl =~ s/\[/\\[/g;
@@ -83,7 +83,7 @@
             $missing = 'missing'; 
         }
         if ($missing) {
-            push @missing_docs, "$path: $function_decl ($missing)\n";
+            push @missing_docs, "$path ($missing)\n$function_decl\n";
         }
     }
 }
@@ -93,7 +93,7 @@
 
     ok( !scalar(@missing_docs), 'Functions documented' )
         or diag( scalar @missing_docs
-            . " functions lacking documentation = "
+            . " function(s) lacking documentation:\n"
             . join "#" x 70 . "\n", @missing_docs, "\n");
 }
 

Deleted: trunk/tools/docs/func_boilerplate.pl
==============================================================================
--- trunk/tools/docs/func_boilerplate.pl	Sat Mar 28 14:41:26 2009	(r37799)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,96 +0,0 @@
-#! perl
-# Copyright (C) 2006, Parrot Foundation.
-# $Id$
-
-use strict;
-use warnings;
-
-use lib qw( . lib ../lib ../../lib );
-use Parrot::Distribution;
-use Parrot::Headerizer;
-
-=head1 NAME
-
-tools/doc/func_boilerplate.pl - generate function boilerplate documentation
-
-=head1 SYNOPSIS
-
-    # all files
-    % perl tools/doc/func_boilerplate.pl
-
-    # specific files
-    % perl tools/doc/func_boilerplate.pl src/foo.c include/parrot/bar.h
-
-=head1 DESCRIPTION
-
-Searches for functions which aren't documented in the C-language source of
-Parrot and outputs boilerplate function documentation to be inserted into
-the code at the function definition.  This should reduced the amount of
-typing for people adding the boilerplate documentation, and consequently
-lower the bar for more people to actually document the code.
-
-=head1 AUTHOR
-
-Paul Cochrane <paultcochrane at gmail dot com>
-
-=cut
-
-my $DIST = Parrot::Distribution->new;
-my @files = @ARGV ? @ARGV : $DIST->get_c_language_files();
-my $headerizer = Parrot::Headerizer->new;
-
-my $cut_line = "=cut";    # stops t/doc/pod.t from complaining.
-
-print "#### Start of boilerplate code ####\n";
-
-foreach my $file (@files) {
-    my $path = @ARGV ? $file : $file->path;
-    my $buf = $DIST->slurp($path);
-
-    my @function_decls = $headerizer->extract_function_declarations($buf);
-
-    for my $function_decl (@function_decls) {
-
-        my $escaped_decl = $function_decl;
-        # escape [, ], (, ), and *
-        $escaped_decl =~ s/\[/\\[/g;
-        $escaped_decl =~ s/\]/\\]/g;
-        $escaped_decl =~ s/\(/\\(/g;
-        $escaped_decl =~ s/\)/\\)/g;
-        $escaped_decl =~ s/\*/\\*/g;
-
-        # don't worry if the function declaration has embedded newlines in
-        # it and the documented function doesn't.
-        $escaped_decl =~ s/\s/\\s/g;
-
-        my $decl_rx = qr/=item C<$escaped_decl>/;
-
-        # look for matching documentation.  This means the text
-        # '=item C<function_declaration>'
-        if ( $buf !~ m/$decl_rx/g ) {
-            # if passed in files at the command line, print out
-            # boilerplate docs for undocumented functions
-
-            # stop t/doc/pod.t from complaining about badly formatted pod
-            my $item_line = "=item C<$function_decl>";
-            print <<"END";
-/*
-
-$item_line
-
-$cut_line
-
-*/
-
-END
-        }
-    }
-    print "#### End of boilerplate code ####\n";
-}
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:


More information about the parrot-commits mailing list