[xml/sgml-commit] [SCM] linuxdoc-tools package for Debian. branch, experimental, updated. debian/0.9.60-7-ga985da1

Agustin Martin Domingo agmartin at debian.org
Tue Apr 14 23:13:09 UTC 2009


The following commit has been merged in the experimental branch:
commit e7f9d1555f0e978e06efaf97cb2b4a0fd79f423a
Author: Agustin Martin Domingo <agmartin at debian.org>
Date:   Mon Apr 13 23:30:38 2009 +0200

    fmt_latex2e.pl: Make all filehandles indirect and uppercase.

diff --git a/lib/fmt/fmt_latex2e.pl b/lib/fmt/fmt_latex2e.pl
index c9d5be2..cce02de 100644
--- a/lib/fmt/fmt_latex2e.pl
+++ b/lib/fmt/fmt_latex2e.pl
@@ -121,7 +121,7 @@ $latex2e->{preASP} = sub {
 # ------------------------------------------------------------------
 #  Translate character entities and escape LaTeX special chars.
 # ------------------------------------------------------------------
-  my ($infile, $outfile) = @_;
+  my ($INFILE, $OUTFILE) = @_;
 
   # note the conversion of `sdata_dirs' list to an anonymous array to
   # make a single argument
@@ -143,7 +143,7 @@ $latex2e->{preASP} = sub {
   # on whether we're in a HEADING or ABSTRACT environment or not
   $remove_comment = 0;
 
-  while (<$infile>) {
+  while (<$INFILE>) {
     if ( s/^-// ){
       chomp;
       s/^\\n/ /;          # Remove spurious leading \n (not real \\n)
@@ -151,7 +151,7 @@ $latex2e->{preASP} = sub {
       if ($remove_comment){
 	s/(\s+\\n)+//;
       }
-      print $outfile "-" . $_ . "\n";
+      print $OUTFILE "-" . $_ . "\n";
     } elsif (/^A/) {
       /^A(\S+) (IMPLIED|CDATA|NOTATION|ENTITY|TOKEN)( (.*))?$/
 	|| die "bad attribute data: $_\n";
@@ -172,28 +172,28 @@ $latex2e->{preASP} = sub {
 	  $value = parse_data ($value, $char_maps, $latex2e_escape);
 	}
       }
-      print $outfile "A$name $type $value\n";
+      print $OUTFILE "A$name $type $value\n";
     } elsif (/^\((VERB|CODE)/) {
-      print $outfile $_;
+      print $OUTFILE $_;
       # going into VERB/CODE section
       $in_verb = 1;
       $char_maps = $ascii_char_maps;
     } elsif (/^\)(VERB|CODE)/) {
-      print $outfile $_;
+      print $OUTFILE $_;
       # leaving VERB/CODE section
       $in_verb = 0;
       $char_maps = $tex_char_maps;
     } elsif (/^\((HEADING|ABSTRACT)/) {
-      print $outfile $_;
+      print $OUTFILE $_;
       # empty lines (comment in sgml source) do harm
       # in HEADING or ABSTRACT
       $remove_comment = 1;
     } elsif (/^\)(HEADING|ABSTRACT)/) {
-      print $outfile $_;
+      print $OUTFILE $_;
       # leaving HEADING or ABSTRACT section
       $remove_comment = 0;
     } else {
-      print $outfile $_;
+      print $OUTFILE $_;
     }
   }
 };
@@ -224,7 +224,9 @@ $latex2e->{postASP} = sub
 #  Take the sgmlsasp output, and make something useful from it.
 # ------------------------------------------------------------------
 {
-  my $infile       = shift;
+  my $INFILE       = shift;
+  my $OUTFILE;
+  my $SGMLFILE;
   my $filename     = $global->{filename};
   my $tmplatexdir  = $global->{tmpbase} . "-latex-" . $$ . ".dir";
   my $tmplatexnam  = $tmplatexdir . "/" . $filename;
@@ -239,7 +241,8 @@ $latex2e->{postASP} = sub
   $ENV{TEXINPUTS} .= ":$main::DataDir";
 
   umask 0077;
-  mkdir ($tmplatexdir, 0700) || return -1;
+  mkdir ($tmplatexdir, 0700)
+    or die "Could not create \"$tmplatexdir\" directory.\n";
 
   #
   # check epsfile is specified in source file
@@ -247,8 +250,8 @@ $latex2e->{postASP} = sub
   #
   {
     my $epsf;
-    open SGMLFILE, "<$filename.sgml";
-    while (<SGMLFILE>)
+    open $SGMLFILE, "<$filename.sgml";
+    while (<$SGMLFILE>)
       {
 	# for epsfile
 	if ( s/^\s*<eps\s+file=(.*)>/$1/ )
@@ -271,13 +274,13 @@ $latex2e->{postASP} = sub
 	      }
 	  }
       }
-    close SGMLFILE;
+    close $SGMLFILE;
   }
   {
     my $urlid;
     my $urlnam;
     my $urldef;
-    while (<$infile>)
+    while (<$INFILE>)
       {
 	push @texlines, $_;
 	# for nameurl
@@ -293,10 +296,11 @@ $latex2e->{postASP} = sub
 	    $urlnum++;
 	  }
       }
-    close $infile;
+    close $INFILE;
   }
 
-  open OUTFILE, ">$tmplatexnam.tex";
+  open ($OUTFILE, "> $tmplatexnam.tex")
+    or die "fmt_latex2e::postASP: Could not open \"$tmplatexnam.tex\" for write.\n";
 
   # --------------------------------------------------------------------
   #  Set the correct \documentclass and packages options.
@@ -317,6 +321,7 @@ $latex2e->{postASP} = sub
 	$classprefix = "j-";
       }
     }
+
     # Getting class options
     my $classoptions = $global->{papersize} . 'paper';
 
@@ -382,19 +387,19 @@ $latex2e->{postASP} = sub
       if (/\\nameurl/ && $latex2e->{output} ne "pdf") {
 	$_ = shift @urlnames;
       }
-      print OUTFILE;
+      print $OUTFILE $_;
 
       if (/%end-preamble/) {
 	if ($urlnum && $latex2e->{output} ne "pdf") {
 	  while (defined($urldefines[0])) {
 	    $_ = shift @urldefines;
-	    print OUTFILE;
+	    print $OUTFILE $_;
 	  }
 	}
       }
     }
   }
-  close OUTFILE;
+  close $OUTFILE;
 
   #
   #  LaTeX, dvips, and assorted cleanups.

-- 
linuxdoc-tools package for Debian.



More information about the debian-xml-sgml-commit mailing list