texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/init chm.pm tex4ht.pm


From: Patrice Dumas
Subject: texinfo/tp/init chm.pm tex4ht.pm
Date: Sun, 30 Dec 2012 18:18:16 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/12/30 18:18:16

Modified files:
        tp/init        : chm.pm tex4ht.pm 

Log message:
        Improve warning/error messages.  bug-texinfo 
        Sun, 30 Dec 2012 13:59:56.
        http://lists.gnu.org/archive/html/bug-texinfo/2012-12/msg00063.html

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/init/chm.pm?cvsroot=texinfo&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/init/tex4ht.pm?cvsroot=texinfo&r1=1.12&r2=1.13

Patches:
Index: chm.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/init/chm.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- chm.pm      25 Sep 2012 17:46:37 -0000      1.12
+++ chm.pm      30 Dec 2012 18:18:16 -0000      1.13
@@ -216,9 +216,8 @@
   my $hhk_filename = $document_name . ".hhk";
   my $hhk_file = File::Spec->catfile($outdir, $hhk_filename);
   my $hhk_fh = Texinfo::Common::open_out($self, $hhk_file);
-  # Not sure $! is still valid
   if (!defined($hhk_fh)) {
-    $self->document_error(sprintf($self->__("Can't open %s for writing: 
%s\n"), 
+    $self->document_error(sprintf($self->__("chm.pm:%s: Cannot open for 
writing: %s\n"), 
                   $hhk_file, $!));
     return 0;
   }
@@ -264,7 +263,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"),
+    $self->document_error(sprintf($self->__("chm.pm:%s: Error on closing: %s"),
                           $hhk_file, $!));
     return 0;                  
   }
@@ -274,7 +273,7 @@
   my $hhc_fh = Texinfo::Common::open_out($self, $hhc_file);
   # Not sure $! is still valid
   if (!defined($hhc_fh)) {
-    $self->document_error(sprintf($self->__("Can't open %s for writing: 
%s\n"), 
+    $self->document_error(sprintf($self->__("chm.pm:%s: Cannot open for 
writing: %s\n"), 
                   $hhc_file, $!));
     return 0;
   }
@@ -335,7 +334,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"),
+    $self->document_error(sprintf($self->__("chm.pm:%s: Error on closing: %s"),
                           $hhc_file, $!));
     return 0;                  
   }
@@ -345,7 +344,7 @@
   my $hhp_fh = Texinfo::Common::open_out($self, $hhp_file);
   # Not sure $! is still valid
   if (!defined($hhp_fh)) {
-    $self->document_error(sprintf($self->__("Can't open %s for writing: 
%s\n"), 
+    $self->document_error(sprintf($self->__("chm.pm:%s: Cannot open for 
writing: %s\n"), 
                   $hhp_file, $!));
     return 0;
   }
@@ -396,7 +395,7 @@
 
   delete $self->{'unclosed_files'}->{$hhp_file};
   if (!close ($hhp_fh)) {
-    $self->document_error(sprintf($self->__("Error on closing %s: %s"),
+    $self->document_error(sprintf($self->__("chm.pm:%s: Error on closing: %s"),
                           $hhp_file, $!));
     return 0;                  
   }

Index: tex4ht.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/init/tex4ht.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- tex4ht.pm   18 Dec 2012 00:07:16 -0000      1.12
+++ tex4ht.pm   30 Dec 2012 18:18:16 -0000      1.13
@@ -115,11 +115,12 @@
                                           $commands{$command}->{'basefile'});
     my $rfile = $commands{$command}->{'rfile'};
     $commands{$command}->{'counter'} = 0;
+    $commands{$command}->{'output_counter'} = 0;
 
     if ($self->{'extra'}->{$command}) {
       local *TEX4HT_TEXFILE;
       unless (open (*TEX4HT_TEXFILE, ">$rfile")) {
-        $self->document_warn (sprintf($self->__("tex4ht error opening %s: 
%s"), 
+        $self->document_warn (sprintf($self->__("tex4ht.pm:%s: Cannot open: 
%s"), 
                                       $rfile, $!));
         return 1;
       }
@@ -215,9 +216,9 @@
 {
   my $self = shift;
   unless (chdir $tex4ht_out_dir) {
-    $self->document_warn(sprintf($self->__("chdir to %s failed"),
-                         $tex4ht_out_dir));
-    return 1;
+    $self->document_warn(sprintf($self->__("tex4ht.pm: chdir to %s failed: 
%s"),
+                         $tex4ht_out_dir, $!));
+    return 0;
   }
   print STDERR "cwd($tex4ht_out_dir): " . Cwd::cwd() ."\n" 
     if ($self->get_conf('VERBOSE'));
@@ -227,7 +228,8 @@
     $errors += tex4ht_process_command($self, $command);
   }
   unless (chdir $tex4ht_initial_dir) {
-    warn "tex4ht unable to return to the initial dir\n";
+    $self->document_warn(sprintf($self->__(
+          "tex4ht.pm: Unable to return to the initial dir: %s"), $!));
     return 0;
   }
   return 1;
@@ -239,7 +241,7 @@
   
   return 0 unless ($commands{$command}->{'counter'});
 
-  $self->document_warn(sprintf($self->__("tex4ht output file missing: %s"),
+  $self->document_warn(sprintf($self->__("tex4ht.pm: Output file missing: %s"),
                                $commands{$command}->{'basefile'}))
     unless (-f $commands{$command}->{'basefile'});
   my $style = $commands{$command}->{'style'};
@@ -254,14 +256,16 @@
   my $cmd = "$commands{$command}->{'exec'} $commands{$command}->{'basefile'} 
$options";
   print STDERR "tex4ht command: $cmd\n" if ($self->get_conf('VERBOSE'));
   if (system($cmd)) {
-    $self->document_warn ("t2h_tex4ht command: $cmd failed");
+    $self->document_warn (sprintf(__(
+                         "tex4ht.pm: Command `%s' failed"), $cmd));
     return 1;
   }
 
   # extract the html from the file created by tex4ht
   my $html_basefile = $commands{$command}->{'html_file'};
   unless (open (TEX4HT_HTMLFILE, $html_basefile)) {
-    $self->document_warn ("t2h_tex4ht error opening $html_basefile: $!");
+    $self->document_warn (sprintf(__("tex4ht.pm:%s: Cannot open: %s"), 
+                                  $html_basefile, $!));
     return 1;
   }
   my $got_count = 0;
@@ -286,13 +290,14 @@
         }
       }
       unless ($end_found) {
-        $self->document_warn ("tex4ht_process_command: end of $command $count 
not found");
+        $self->document_warn (sprintf(__("tex4ht.pm: end of address@hidden 
item %d not found"), 
+                                      $command, $count));
       }
     }
   }
   if ($got_count != $commands{$command}->{'counter'}) {
     $self->document_warn (sprintf($self->__(
-       "tex4ht processing produced %d items in HTML; expected %d, the number 
of items found in the document"), 
+       "tex4ht.pm: processing produced %d items in HTML; expected %d, the 
number of items found in the document"), 
                                   $got_count, 
$commands{$command}->{'counter'}));
   }
   close (TEX4HT_HTMLFILE);
@@ -310,7 +315,8 @@
      $commands{$cmdname}->{'output_counter'}++;
      return $commands{$cmdname}->{'results'}->{$command};
   } else {
-    $self->document_warn (sprintf($self->__("tex4ht output has no HTML item 
for address@hidden %s"),
+    $self->document_warn (sprintf($self->__(
+                       "tex4ht.pm: Output has no HTML item for address@hidden 
%s"),
                                   $cmdname, $command));
     return '';
   }
@@ -323,7 +329,7 @@
   if ($self->get_conf('VERBOSE')) {
     foreach my $command (keys(%commands)) {
       if ($commands{$command}->{'output_counter'} != 
$commands{$command}->{'counter'}) {
-        $self->line_warn ("tex4ht_finish: address@hidden output counter 
$commands{$command}->{'output_counter'}, counter 
$commands{$command}->{'counter'}");
+        $self->document_warn ("tex4ht_finish: address@hidden output counter 
$commands{$command}->{'output_counter'}, counter 
$commands{$command}->{'counter'}");
       }
     }
   }



reply via email to

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