[perl #35847] File::Find not performing as documented
[p5sagit/p5-mst-13.2.git] / autodoc.pl
index c87f114..6a2e28b 100644 (file)
@@ -33,6 +33,7 @@ sub walk_table (&@) {
     else {
        safer_unlink $filename;
        open F, ">$filename" or die "Can't open $filename: $!";
+       binmode F;
        $F = \*F;
     }
     print $F $leader if $leader;
@@ -44,6 +45,7 @@ sub walk_table (&@) {
            $_ .= <IN>;
            chomp;
        }
+       s/\s+$//;
        my @args;
        if (/^\s*(#|$)/) {
            @args = $_;
@@ -51,6 +53,7 @@ sub walk_table (&@) {
        else {
            @args = split /\s*\|\s*/, $_;
        }
+       s/\b(NN|NULLOK)\b\s+//g for @args;
        print $F $function->(@args);
     }
     print $F $trailer if $trailer;
@@ -117,13 +120,14 @@ DOC:
 sub docout ($$$) { # output the docs for one function
     my($fh, $name, $docref) = @_;
     my($flags, $docs, $ret, $file, @args) = @$docref;
+    $name =~ s/\s*$//;
 
     $docs .= "NOTE: this function is experimental and may change or be
 removed without notice.\n\n" if $flags =~ /x/;
     $docs .= "NOTE: the perl_ form of this function is deprecated.\n\n"
        if $flags =~ /p/;
 
-    print $fh "=item $name\n$docs";
+    print $fh "=item $name\nX<$name>\n$docs";
 
     if ($flags =~ /U/) { # no usage
        # nothing
@@ -158,6 +162,7 @@ for $file (($MANIFEST =~ /^(\S+\.c)\t/gm), ($MANIFEST =~ /^(\S+\.h)\t/gm)) {
 safer_unlink "pod/perlapi.pod";
 open (DOC, ">pod/perlapi.pod") or
        die "Can't create pod/perlapi.pod: $!\n";
+binmode DOC;
 
 walk_table {   # load documented functions into approriate hash
     if (@_ > 1) {
@@ -196,6 +201,7 @@ print DOC <<'_EOB_';
 perlapi - autogenerated documentation for the perl public API
 
 =head1 DESCRIPTION
+X<Perl API> X<API> X<api>
 
 This file contains the documentation of the perl public API generated by
 embed.pl, specifically a listing of functions, macros, flags, and variables
@@ -217,7 +223,8 @@ my $key;
 for $key (sort { uc($a) cmp uc($b) || $a cmp $b } keys %apidocs) {
     my $section = $apidocs{$key}; 
     print DOC "\n=head1 $key\n\n=over 8\n\n";
-    for my $key (sort { uc($a) cmp uc($b); } keys %$section) {
+    # Again, fallback for determinacy
+    for my $key (sort { uc($a) cmp uc($b) || $a cmp $b } keys %$section) {
         docout(\*DOC, $key, $section->{$key});
     }
     print DOC "\n=back\n";
@@ -251,6 +258,7 @@ close(DOC) or die "Error closing pod/perlapi.pod: $!";
 safer_unlink "pod/perlintern.pod";
 open(GUTS, ">pod/perlintern.pod") or
                die "Unable to create pod/perlintern.pod: $!\n";
+binmode GUTS;
 print GUTS <<'END';
 =head1 NAME
 
@@ -258,6 +266,7 @@ perlintern - autogenerated documentation of purely B<internal>
                 Perl functions
 
 =head1 DESCRIPTION
+X<internal Perl functions> X<interpreter functions>
 
 This file is the autogenerated documentation of functions in the
 Perl interpreter that are documented using Perl's internal documentation