texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp texi2any.pl Texinfo/Common.pm Texinf...


From: Patrice Dumas
Subject: texinfo/tp texi2any.pl Texinfo/Common.pm Texinf...
Date: Sun, 13 Nov 2011 23:55:22 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/11/13 23:55:22

Modified files:
        tp             : texi2any.pl 
        tp/Texinfo     : Common.pm Parser.pm 
        tp/Texinfo/Convert: DocBook.pm HTML.pm Info.pm 
        tp/init        : chm.pm 

Log message:
        Mark unclosed files.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.89&r2=1.90
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.97&r2=1.98
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.334&r2=1.335
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/DocBook.pm?cvsroot=texinfo&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.208&r2=1.209
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/init/chm.pm?cvsroot=texinfo&r1=1.9&r2=1.10

Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- texi2any.pl 13 Nov 2011 23:04:29 -0000      1.89
+++ texi2any.pl 13 Nov 2011 23:55:21 -0000      1.90
@@ -1000,6 +1000,7 @@
                       $macro_expand_file, $!));
         $error_macro_expand_file = 1;
       }
+      delete $parser->{'unclosed_files'}->{$macro_expand_file};
     } else {
       warn (sprintf(__("Could not open %s for writing: %s\n"), 
                     $macro_expand_file, $!));
@@ -1069,6 +1070,7 @@
                       $internal_links_file, $!));
         $error_internal_links_file = 1;
       }
+      delete $parser->{'unclosed_files'}->{$internal_links_file};
     } else {
       warn (sprintf(__("Could not open %s for writing: %s\n"), 
                     $internal_links_file, $!));

Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- Texinfo/Common.pm   13 Nov 2011 23:32:48 -0000      1.97
+++ Texinfo/Common.pm   13 Nov 2011 23:55:21 -0000      1.98
@@ -770,7 +770,10 @@
 
   if ($file eq '-') {
     binmode(STDOUT, ":encoding($encoding)") if ($encoding);
-    push @{$self->{'opened_files'}}, $file if ($self);
+    if ($self) {
+      push @{$self->{'opened_files'}}, $file;
+      $self->{'unclosed_files'}->{$file} = 1;
+    }
     return \*STDOUT;
   }
   my $filehandle = do { local *FH };
@@ -785,8 +788,10 @@
     }
     binmode($filehandle, ":encoding($encoding)");
   }
-  push @{$self->{'opened_files'}}, $file
-    if ($self);
+  if ($self) {
+    push @{$self->{'opened_files'}}, $file;
+    $self->{'unclosed_files'}->{$file} = 1;
+  }
   return $filehandle;
 }
 

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.334
retrieving revision 1.335
diff -u -b -r1.334 -r1.335
--- Texinfo/Parser.pm   13 Nov 2011 23:32:48 -0000      1.334
+++ Texinfo/Parser.pm   13 Nov 2011 23:55:21 -0000      1.335
@@ -1724,7 +1724,8 @@
       }
     }
     my $previous_input = shift(@{$self->{'input'}});
-    if ($previous_input->{'fh'}) {
+    # Don't close STDIN
+    if ($previous_input->{'fh'} and $previous_input->{'name'} ne '-') {
       if (!close($previous_input->{'fh'})) {
         $self->document_warn(sprintf($self->__("Error on closing %s: %s"),
                                      $previous_input->{'name'}, $!));

Index: Texinfo/Convert/DocBook.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/DocBook.pm,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- Texinfo/Convert/DocBook.pm  13 Nov 2011 23:04:30 -0000      1.32
+++ Texinfo/Convert/DocBook.pm  13 Nov 2011 23:55:21 -0000      1.33
@@ -331,10 +331,14 @@
   $result .= $self->_output_text($header, $fh);
   $result .= $self->convert_document_sections($root, $fh);
   $result .= $self->_output_text("</book>\n", $fh);
-  if ($fh and !close ($fh)) {
+  if ($fh) {
+    # FIXME do not close STDOUT
+    delete $self->{'unclosed_files'}->{$self->{'output_filename'}};
+    if (!close ($fh)) {
     $self->document_error(sprintf($self->__("Error on closing %s: %s"),
                                   $self->{'output_filename'}, $!));
   }
+  }
   return $result;
 }
 

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -b -r1.208 -r1.209
--- Texinfo/Convert/HTML.pm     13 Nov 2011 23:32:49 -0000      1.208
+++ Texinfo/Convert/HTML.pm     13 Nov 2011 23:55:22 -0000      1.209
@@ -6101,6 +6101,7 @@
 </html>
 EOT
 
+    delete $self->{'unclosed_files'}->{$frame_outfile};
     if (!close ($frame_fh)) {
       $self->document_error(sprintf($self->__("Error on closing frame file %s: 
%s"),
                                     $frame_outfile, $!));
@@ -6124,6 +6125,7 @@
     print $toc_frame_fh $shortcontents;
     print $toc_frame_fh "</body></html>\n";
 
+    delete $self->{'unclosed_files'}->{$toc_frame_outfile};
     if (!close ($toc_frame_fh)) {
       $self->document_error(sprintf($self->__("Error on closing TOC frame file 
%s: %s"),
                                     $toc_frame_outfile, $!));
@@ -6513,10 +6515,14 @@
       $output .= $self->_output_text($self->_convert($root), $fh);
     }
     $output .= $self->_output_text(&{$self->{'format_end_file'}}($self), $fh);
-    if ($fh and !close($fh)) {
+    # FIXME do not close STDOUT
+    if ($fh) {
+      delete $self->{'unclosed_files'}->{$outfile};
+      if (!close($fh)) {
       $self->document_error(sprintf($self->__("Error on closing %s: %s"),
                                     $outfile, $!));
     }
+    }
     return $output if ($self->{'output_file'} eq '');
   } else {
     # output with pages
@@ -6567,6 +6573,9 @@
       if ($self->{'file_counters'}->{$element->{'filename'}} == 0) {
         # end file
         print $file_fh "". &{$self->{'format_end_file'}}($self);
+
+        # FIXME do not close STDOUT
+        delete $self->{'unclosed_files'}->{$element->{'out_filename'}};
         if (!close($file_fh)) {
           $self->document_error(sprintf($self->__("Error on closing %s: %s"),
                                 $element->{'out_filename'}, $!));
@@ -6621,6 +6630,7 @@
                                     $out_filename, $!));
         } else {
           print $file_fh $redirection_page;
+          delete $self->{'unclosed_files'}->{$out_filename};
           if (!close ($file_fh)) {
             $self->document_error(sprintf($self->__("Error on closing 
redirection node file %s: %s"),
                                     $out_filename, $!));
@@ -6687,6 +6697,7 @@
                                     $out_filename, $!));
         } else {
           print $file_fh $redirection_page;
+          delete $self->{'unclosed_files'}->{$out_filename};
           if (!close ($file_fh)) {
             $self->document_error(sprintf($self->__("Error on closing renamed 
node file %s: %s"),
                                     $out_filename, $!));

Index: Texinfo/Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- Texinfo/Convert/Info.pm     13 Nov 2011 23:31:35 -0000      1.76
+++ Texinfo/Convert/Info.pm     13 Nov 2011 23:55:22 -0000      1.77
@@ -123,6 +123,7 @@
           and $self->{'count_context'}->[-1]->{'bytes'} > 
                   $out_file_nr * $self->get_conf('SPLIT_SIZE') 
           and @nodes and $fh) {
+        delete $self->{'unclosed_files'}->{$self->{'output_file'}};
         my $close_error;
         if (!close ($fh)) {
           $close_error = $!;
@@ -176,10 +177,11 @@
   }
   my $tag_text = '';
   if ($out_file_nr > 1) {
+    delete 
$self->{'unclosed_files'}->{$self->{'output_file'}.'-'.$out_file_nr};
     if (!close ($fh)) {
       $self->document_error(sprintf($self->__("Error on closing %s: %s"),
                             $self->{'output_file'}.'-'.$out_file_nr, $!));
-      # FIXME return undef, interrupting processing?
+      # FIXME(Karl) return undef, interrupting processing?
       # return undef;
     }
     $fh = $self->Texinfo::Common::open_out($self->{'output_file'});
@@ -238,6 +240,7 @@
     # 'Filehandle STDOUT reopened as FH only for input' if there are files
     # reopened after closing STDOUT.
     unless ($self->{'output_file'} eq '-') {
+      delete $self->{'unclosed_files'}->{$self->{'output_file'}};
       if (!close ($fh)) {
         $self->document_error(sprintf($self->__("Error on closing %s: %s"),
                               $self->{'output_file'}, $!));

Index: init/chm.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/init/chm.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- init/chm.pm 13 Nov 2011 23:04:30 -0000      1.9
+++ init/chm.pm 13 Nov 2011 23:55:22 -0000      1.10
@@ -258,6 +258,7 @@
     }
   }
   print $hhk_fh "</BODY>\n</HTML>\n";
+  delete $self->{'unclosed_files'}->{$hhk_file};
   if (!close ($hhk_fh)) {
     $self->document_error(sprintf($self->__("Error on closing %s: %s"),
                           $hhk_file, $!));
@@ -328,6 +329,7 @@
     }
   }
   print $hhc_fh "</HTML>\n</BODY>\n";
+  delete $self->{'unclosed_files'}->{$hhc_file};
   if (!close ($hhc_fh)) {
     $self->document_error(sprintf($self->__("Error on closing %s: %s"),
                           $hhc_file, $!));
@@ -388,6 +390,7 @@
     }
   }
 
+  delete $self->{'unclosed_files'}->{$hhp_file};
   if (!close ($hhp_fh)) {
     $self->document_error(sprintf($self->__("Error on closing %s: %s"),
                           $hhp_file, $!));



reply via email to

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