Contents 
 Index 
 "Perl Program Reference" 
 < Previous 
 Next > 

voyant_latex.pl

Go to the documentation of this file.
00001 // This file has been modified on-the-fly with an input filter
00002 // to change it from Perl syntax to C++ strictly for the purposes
00003 // of faking out Doxygen. Modifications include:
00004 
00005 // - changing local() definitions to C++ #define statements.
00006 // - commenting out undef statements.
00007 // - changing $globe'... variable names to $globe_...
00008 // - changing sub statements to look like C++ functions.
00009 // - changing # comments to C++ comments.
00010 // - ...
00011 
00012 // If you see other strangeness in the HTML version of the Perl file,
00013 // it comes from getting it to look more C++ like.
00014 
00015 
00016 // #!/usr/#define/bin/perl
00017 //#############################################################################
00018 /** @file
00019  ** @brief Changes two Latex files in each zlx_ directory of the system
00020  ** so that they contain the appropriate information for
00021  ** the project.
00022  ** 
00023  ** @param $globe::path default location to find the Latex temporary directories. 
00024  ** The name should be terminated with a slash (\). 
00025  ** This should be the top directory where various master-doxygen.sty
00026  ** and master-header.tex can be found and more importantly, the zlx_ directories 
00027  ** where generated LaTex files from Doxygen reside.
00028  **
00029  ** @param $globe::master_tree_file [optional path and] filename for the file
00030  ** that stores the information needed for the project and the latex files.
00031  ** It does need additional comment tags containing the
00032  ** voy_latex variables and the latex_header variables. 
00033  **
00034  ** @return Generates appropriate header.tex and doxygen.sty
00035  ** files for each zlx_ directory in the system. These are then used
00036  ** in Latex's PDF generation for each subproject. 
00037  **
00038  ** This tool reads in the voyant_master_nav.html file (or equivalent).
00039  ** This file must specify:
00040  ** <ul><li>The voy_order for the system that lists all directories, associated
00041  ** names, and associated PDF files.</li>
00042  ** <li>The voy_latex which contains variables used in LaTex build such as
00043  ** master file names, company name, etc.</li>
00044  ** <li>The latex_head which contains additional information for the refman.tex
00045  ** file.</li>
00046  ** </ul>
00047  **
00048  ** This tool steps through all cref_ directory names in the voy_order and generates
00049  ** an equivalent zlx_ directory name which should be found under $globe::path.
00050  ** The voy_latex variables declare where additional master.tex and master.sty
00051  ** files reside. These contain call-outs for variables that voy_latex resolves
00052  ** for the given project. All variables in the master files are resolved
00053  ** with information appropriate for the project.
00054  **
00055  ** Upon conclusion, appropriate refman.tex and doxygen.sty files are written
00056  ** to each zlx_ directory.
00057  **
00058  ** @ingroup tp_tools tp_latex
00059  **
00060  ** @author Glenn C. Maxey
00061  **/
00062 // #
00063 //#    $Id: voyant_latex.pl,v 1.12 2002/11/20 15:23:07 gmaxe Exp $
00064 //#
00065 //# 2002 Created by Voyant Technologies, Inc., Westminster, Colorado, USA.
00066 //#
00067 //# Permission to use, copy, modify, and distribute this software and its 
00068 //# documentation under the terms of the GNU General Public License is hereby 
00069 //# granted. No representations are made about the suitability of this software 
00070 //# for any purpose. It is provided "as is" without express or implied warranty. 
00071 //# See the GNU General Public License (http://www.gnu.org/copyleft/gpl.html) 
00072 //# for more details.
00073 //# 
00074 //# Documents produced by this script are derivative works derived from the 
00075 //# input used in their production; they are not affected by this license.
00076 //#
00077 //# Revision Information:
00078 //#
00079 //# $Log: voyant_latex.pl,v $
00080 //# Revision 1.12  2002/11/20 15:23:07  gmaxe
00081 // //# Added exit codes so that wrapper scripts can catch errors properly.
00082 //#
00083 //# Revision 1.11  2002/07/26 18:56:12  gmaxe
00084 //# Got rid of old definitions and migrated new structures into all;
00085 //# enhanced xhelp output file names and format; now everything is
00086 //# alphebetized.
00087 //#
00088 //# Revision 1.10  2002/07/22 21:51:32  gmaxe
00089 //# Created separate configuration file; allow for two inputs to
00090 //# the voyant_latex.pl. commented out old variables in globe.pm.
00091 //#
00092 //# Revision 1.9  2002/04/06 01:55:16  gmaxe
00093 //# New files and new general constructs for handling tags. Uses globals better.
00094 //# The html_look* files are designed to handle spider tracing of html systems.
00095 //#
00096 //# Revision 1.8  2002/01/16 19:49:09  gmaxe
00097 //# Removed much of revision history in comments.
00098 //#
00099 //# Revision 1.7  2002/01/16 19:41:46  gmaxe
00100 //# Updated description.
00101 //#
00102 //#############################################################################
00103 
00104 //#############################################################################
00105 /** @fn int BEGIN
00106  ** @brief Code to execute when first entered.
00107  **
00108  ** @param None. 
00109  **
00110  ** @return None.
00111  **
00112  ** @lim None
00113  ** @ingroup tp_nav
00114  **/
00115 // #############################################################################
00116 int BEGIN  ( ) {
00117 //    print "\n============  Starting voyant_latex.pl ==================================\n";
00118    $_file_list = "_file_list";
00119    $in_file = "";
00120    $f_type = "htm";
00121    $loc_path = "./";
00122    $_arg_inc = 0;
00123 
00124    $no_scope_file = 0;
00125    $scope_pm = "globe.pm";  //  first time through; other scope stuff passed in.
00126 
00127    push (@INC, `pwd`);
00128    push (@INC, '../perl');
00129    if (0){
00130 //       print (@INC, "\n");
00131    }
00132    // ####
00133    //  All global variables are defined in the following file
00134    // ####
00135    unless (open ( IN_LIST, $scope_pm)) {
00136       $scope_pm = "../perl/$scope_pm";
00137       unless (open ( IN_LIST, $scope_pm)) {
00138          push (@file_errors, "Cannot open file \"$scope_pm\"");
00139          $no_scope_file++;
00140       }
00141    }
00142 //    close (IN_LIST);
00143    push (@INC, $scope_pm);
00144    if (!@file_errors) {
00145       // ####
00146       //  All global variables are defined in the following file
00147       // ####
00148       require $scope_pm;
00149 
00150       if (&globe::declare_variables()) {
00151 //          print "Variables initialized from $scope_pm.\n";
00152       } else {
00153          push (@file_errors, "Could not initialize variables from $scope_pm.");
00154       }
00155    } //  if not @file_errors
00156    
00157    //  Get path if there is one.
00158    if (@ARGV > $_arg_inc) {
00159       $globe::path = @ARGV[$_arg_inc];
00160       if ($globe::path =~ /\//) {
00161 //          print "The path specified is $globe::path\n";
00162    
00163          @path_chunks = split ( /\//, $globe::path);
00164          if (@path_chunks < 2) {
00165             $globe::rel_path_to_start_point = "./";
00166          } else {
00167             $globe::rel_path_to_start_point = "../";
00168          }
00169       } else {
00170          push (@file_errors, "The input argument \"$globe::path\" requires a forward slash (\/) at the end.\n");
00171       }
00172    } //  if 1 or more arguments
00173    $_arg_inc++;
00174 
00175    if (@ARGV > $_arg_inc) {
00176       $globe::master_nav_file = @ARGV[$_arg_inc];
00177 //       print "The master file is $globe::master_nav_file\n";
00178       unless (open ( IN_MASTER, $globe::master_nav_file)) {
00179          push (@file_errors, "Cannot open file \"$globe::master_nav_file\"");
00180       }
00181 //       close (IN_MASTER);
00182    } //  if 2 or more arguments
00183    $_arg_inc++;
00184 
00185    // undef ($globe::master_nav_file2);
00186    if (@ARGV > $_arg_inc) {
00187       $globe::master_nav_file2 = @ARGV[$_arg_inc];
00188 //       print "The master file is $globe::master_nav_file2\n";
00189       unless (open ( IN_MASTER, $globe::master_nav_file2)) {
00190          push (@file_errors, "Cannot open file \"$globe::master_nav_file2\"");
00191       }
00192 //       close (IN_MASTER);
00193    } //  if 2 or more arguments
00194    $_arg_inc++;
00195 
00196 
00197 }
00198 
00199 //#############################################################################
00200 /** @fn int main
00201  ** @brief The main program.
00202  **
00203  ** @param None. 
00204  **
00205  ** @return None.
00206  **
00207  ** @lim None
00208  ** @ingroup tp_nav
00209  **/
00210 // #############################################################################
00211 // sub main {
00212 {
00213    // #############################################################################
00214    // # Start of Main Program
00215    // #############################################################################
00216    if (0){
00217 //       print "=== Definitions 3 \n";
00218 //       exit(1);
00219    }
00220 
00221    if (@file_errors) {
00222       //  Makes no sense to go on if input parameters are off.
00223 //       print "\n============  Summary of errors =================================a\n";
00224       for ($i=0; $i<@file_errors; $i++){
00225 //          print "$i = $file_errors[$i]\n";
00226       }
00227       &using_voy_latex();
00228 //       exit(1);
00229    }
00230 
00231    unless (open ( IN_MASTER, $globe::master_nav_file)) {
00232       push (@file_errors, "Cannot open file \"$globe::master_nav_file\"");
00233    }
00234 
00235    //  Get the master definitions
00236    while (<IN_MASTER>){    //  entire master file into memory.
00237       $globe::master_nav .= $_;
00238    }
00239 //    close (IN_MASTER);
00240 
00241    if ($globe::master_nav_file2) {
00242       unless (open ( IN_MASTER, $globe::master_nav_file2)) {
00243          push (@file_errors, "Cannot open file \"$globe::master_nav_file2\"");
00244       }
00245    }
00246 
00247    //  Get the master definitions
00248    while (<IN_MASTER>){    //  entire master file into memory.
00249       $globe::master_nav .= $_;
00250    }
00251 //    close (IN_MASTER);
00252 
00253    
00254    if (&fill_in_master_sections() =~ 1){
00255 //       print "Master Navigation file \"$globe::master_nav_file\" has definition errors.\n";
00256       push (@file_errors, "Master Navigation file \"$globe::master_nav_file\" has definition errors.\n");
00257    }
00258 
00259    //  Write the TEX and STY files
00260    &new_doxygen_sty();
00261    //  Update any existing refman.tex files
00262    &new_refman_tex();
00263 
00264 
00265    // #############################################################################
00266    // # End of most of work
00267    // #############################################################################
00268 //    exit(0);
00269 }
00270 
00271 //#############################################################################
00272 /** @fn int new_refman_tex
00273  ** @brief Creates a new refman.tex file to use as a master.
00274  **
00275  ** @param global variables are used for the master definitions.
00276  **
00277  ** @return Writes out a brand-new refman_tex file.
00278  **
00279  ** @lim This makes heavy use of global variables.
00280  **
00281  ** @ingroup tp_latex
00282  **/
00283 // #############################################################################
00284 int new_refman_tex  ( ) {
00285 
00286 
00287    // #####
00288    //  Extract latex title page from the master_header_tex
00289    // #####
00290    //  escape out important characters
00291    $start = $globe::latex_title[1];
00292    $stop = $globe::latex_title[2];
00293    $start =~ s/\\/\\\\/g;
00294    $start =~ s/\{/\\\{/g;
00295    $start =~ s/\}/\\\}/g;
00296    $stop =~ s/\\/\\\\/g;
00297    $stop =~ s/\{/\\\{/g;
00298    $stop =~ s/\}/\\\}/g;
00299    //  end of escape characters
00300    
00301 //    //  print "start=$globe::latex_title[1]\nstop=$globe::latex_title[2]\n";
00302 
00303    use POSIX 'strftime';
00304    $dddate  strftime "%h %d, %Y", #definetime
00305 
00306 
00307    ALL_DIR: for ($i=0; $i < @globe::master_order; $i++){
00308       if ($globe::master_order[$i] !~ /cref_/i){
00309          next ALL_DIR;
00310       }
00311 //       //  print "$i = dir $globe::master_order[$i] title \"$globe::master_order_title[$i]\"\n";
00312 //       //  print "$i = pdf $globe::master_order_pdf[$i] and doc_num \# $globe::master_order_doc_num[$i]\n";
00313    
00314       $loc_path = "$globe::path$globe::master_order[$i]\/";
00315       $loc_path =~ s/cref_/zlx_/i;
00316       unless (open ( IN_OUT_TEX, "$loc_path$globe::latex_title[0]")) {
00317 //         print "Cannot open file \"$loc_path$globe::latex_title[0]\" for reading: $globe::master_order[$i].\n";
00318         push (@file_errors, "Cannot open file \"$globe::latex_title[0]\" for reading: $globe::master_order[$i].");
00319         next ALL_DIR;
00320       }
00321       #define $refman  ""
00322       while (<IN_OUT_TEX>){
00323          $refman .= $_;
00324       }
00325 //       close ( IN_OUT_TEX);
00326       
00327       // ######
00328       //  Update contents with new title page
00329       // ######
00330       
00331       @t_chunk = split (/$start|$stop/, $refman, 3);
00332       if (@t_chunk =~ /3/){
00333          $t_chunk[1] = "$globe::latex_title[1]$globe::latex_title_page$globe::latex_title[2]";
00334 //          //  print "Latex title page =====\n$globe::latex_title_page\n";
00335          $refman = join ("", @t_chunk);
00336       } else {
00337 //          print "Latex file doesn't have title page defined.\n";
00338          push (@file_errors, "Latex file doesn't have title page defined.\n");
00339          push (@file_errors, "Needs definitions for start ($globe::latex_title[1]) and stop ($globe::latex_title[2])\n");
00340       }
00341 
00342       // ######
00343       
00344       
00345       unless (open ( IN_OUT_TEX, ">$loc_path$globe::latex_title[0]")) {
00346 //         print "Cannot open file \"$loc_path$globe::latex_title[0]\" for writing.\n";
00347         push (@file_errors, "Cannot open file \"$loc_path$globe::latex_title[0]\" for writing.");
00348         next ALL_DIR;
00349       }
00350 //       //  print "output file = $loc_path$globe::latex_title[0]\n";
00351       //  OVERWRITE FILENAME IN THESE TWO WITH COPY OF MASTER.
00352       $#define'output_header_tex  $refman
00353       //  Swap out flags with proper text;
00354       foreach $key (keys %globe::latex_flags) {  
00355 //          //  print "key = $key = $globe::latex_flags{$key}\n";
00356          if $#define'output_header_tex ~ /$key/{
00357             $#define'output_header_tex ~ s/$key/$globe::latex_flags{$key}/g
00358          }
00359       }
00360       //  Take care of the title
00361       if $#define'output_header_tex ~ /$globe::flag_title/{
00362          $#define'output_header_tex ~ s/$globe::flag_title/$globe::master_order_title[$i]/g
00363       }
00364       //  Take care of the document number
00365       if $#define'output_header_tex ~ /$globe::flag_doc_num/{
00366          $temp = $globe::master_order_pdf[$i];
00367          $temp =~ s/.pdf//gi;
00368          $#define'output_header_tex ~ s/$globe::flag_doc_num/$temp/g
00369       }
00370       //  Take care of the date
00371       if $#define'output_header_tex ~ /$globe::flag_date/{
00372          $#define'output_header_tex ~ s/$globe::flag_date/$dddate/g
00373       }
00374       if $#define'output_doxygen_sty ~ /$globe::flag_date/{
00375          $#define'output_doxygen_sty ~ s/$globe::flag_date/$dddate/g
00376       }
00377       //  Output the stuff to where it belongs...
00378       print IN_OUT_TEX  $#define'output_header_tex
00379 //       close (IN_OUT_TEX);
00380 //       //  print "\n\n\n=====\noutput file = $loc_path$globe::latex_title[0]======\n";
00381       //  print $#define'output_header_tex
00382    }  //  for all indices into globe master order
00383 
00384 } //  new_refman_tex
00385 
00386 //#############################################################################
00387 /** @fn int new_doxygen_sty
00388  ** @brief Retrieves the master TEX/STY definitions and swaps in information
00389  ** from the mast files about document names, number, etc.
00390  **
00391  ** @param global variables are used for the master definitions.
00392  **
00393  ** @return Sets several global variables and flags. Outputs to both a TEX
00394  ** and STY file.
00395  **
00396  ** @lim This makes heavy use of global variables.
00397  **
00398  ** @ingroup tp_latex
00399  **/
00400 // #############################################################################
00401 int new_doxygen_sty  ( ) {
00402    foreach $key (keys %globe::latex_flags) {  
00403       if ($key =~ /$globe::master_header_tex/){
00404          $globe::master_header_tex = $globe::latex_flags{$key};  //  now has filename
00405          delete( $globe::latex_flags{$key}); 
00406       } elsif ($key =~ /$globe::master_doxygen_sty/){
00407          $globe::master_doxygen_sty = $globe::latex_flags{$key};  //  now has filename
00408          delete( $globe::latex_flags{$key}); 
00409       } elsif ($key =~ /$globe::output_header_tex/){
00410          $globe::output_header_tex = $globe::latex_flags{$key};  //  now has filename
00411          delete( $globe::latex_flags{$key}); 
00412       } elsif ($key =~ /$globe::output_doxygen_sty/){
00413          $globe::output_doxygen_sty = $globe::latex_flags{$key};  //  now has filename
00414          delete( $globe::latex_flags{$key}); 
00415       }
00416 //       //  print "key = $key = $globe::latex_flags{$key}\n";
00417    }
00418 
00419    unless (open ( IN_MASTER, $globe::master_header_tex)) {
00420 //      print "Cannot open file \"$globe::master_header_tex\"\n";
00421      push (@file_errors, "Cannot open file \"$globe::master_header_tex\"");
00422 //      exit(1);
00423    }
00424    $globe::master_header_tex = "";
00425    //  Get the master definitions
00426    while (<IN_MASTER>){    //  entire master file into memory.
00427       $globe::master_header_tex .= $_; //  Now has contents
00428    }
00429 //    close (IN_MASTER);
00430 
00431 //    //  print "Master tex\n=========\n$globe::master_header_tex=========\n";
00432    
00433    // #####
00434    //  Extract latex title page from the master_header_tex
00435    // #####
00436    //  escape out important characters
00437    $start = $globe::latex_title[1];
00438    $stop = $globe::latex_title[2];
00439    $start =~ s/\\/\\\\/g;
00440    $start =~ s/\{/\\\{/g;
00441    $start =~ s/\}/\\\}/g;
00442    $stop =~ s/\\/\\\\/g;
00443    $stop =~ s/\{/\\\{/g;
00444    $stop =~ s/\}/\\\}/g;
00445    //  end of escape characters
00446    
00447 //    //  print "start=$globe::latex_title[1]\nstop=$globe::latex_title[2]\n";
00448    @t_chunk = split (/$start|$stop/, $globe::master_header_tex, 3);
00449    //  for ($j=0; $j < @t_chunk; $j++){
00450 //    //    print "$j = $t_chunk[$j]\n";
00451    //  }
00452    if (@t_chunk =~ /3/){
00453       $globe::latex_title_page = $t_chunk[1];
00454 //       //  print "Latex title page =====\n$globe::latex_title_page\n";
00455    } else {
00456 //       print "Master Latex file doesn't have title page defined.\n";
00457       push (@file_errors, "Master Latex file doesn't have title page defined.\n");
00458       push (@file_errors, "Needs definitions for start ($globe::latex_title[1]) and stop ($globe::latex_title[2])\n");
00459    }
00460    // #####
00461 
00462 
00463    unless (open ( IN_MASTER, $globe::master_doxygen_sty)) {
00464 //      print "Cannot open file \"$globe::master_doxygen_sty\"\n";
00465      push (@file_errors, "Cannot open file \"$globe::master_doxygen_sty\"");
00466 //      exit(1);
00467    }
00468    $globe::master_doxygen_sty = "";
00469    //  Get the master definitions
00470    while (<IN_MASTER>){    //  entire master file into memory.
00471       $globe::master_doxygen_sty .= $_; //  Now has contents
00472    }
00473 //    close (IN_MASTER);
00474 //    //  print "Master sty\n=========\n$globe::master_doxygen_sty=========\n";
00475 
00476    use POSIX 'strftime';
00477    $dddate  strftime "%h %d, %Y", #definetime
00478 
00479    ALL_DIR: for ($i=0; $i < @globe::master_order; $i++){
00480       if ($globe::master_order[$i] !~ /cref_/i){
00481          next ALL_DIR;
00482       }
00483 //       //  print "$i = dir $globe::master_order[$i] title \"$globe::master_order_title[$i]\"\n";
00484 //       //  print "$i = pdf $globe::master_order_pdf[$i] and doc_num \# $globe::master_order_doc_num[$i]\n";
00485    
00486       $loc_path = "$globe::path$globe::master_order[$i]\/";
00487       $loc_path =~ s/cref_/zlx_/i;
00488       unless (open ( OUT_TEX, ">$loc_path$globe::output_header_tex")) {
00489 //         print "Cannot open file \"$loc_path$globe::output_header_tex\" for writing.\n";
00490         push (@file_errors, "Cannot open file \"$loc_path$globe::output_header_tex\" for writing.");
00491         next ALL_DIR;
00492       }
00493       unless (open ( OUT_STY, ">$loc_path$globe::output_doxygen_sty")) {
00494 //         print "Cannot open file \"$loc_path$globe::output_doxygen_sty\" for writing.\n";
00495         push (@file_errors, "Cannot open file \"$loc_path$globe::output_doxygen_sty\" for writing.");
00496         next ALL_DIR;
00497       }
00498       //  OVERWRITE FILENAME IN THESE TWO WITH COPY OF MASTER.
00499       $#define'output_header_tex  $globe::master_header_tex
00500       $#define'output_doxygen_sty  $globe::master_doxygen_sty
00501       //  Swap out flags with proper text;
00502       foreach $key (keys %globe::latex_flags) {  
00503 //          //  print "key = $key = $globe::latex_flags{$key}\n";
00504          if $#define'output_header_tex ~ /$key/{
00505             $#define'output_header_tex ~ s/$key/$globe::latex_flags{$key}/g
00506          }
00507          if $#define'output_doxygen_sty ~ /$key/{
00508             $#define'output_doxygen_sty ~ s/$key/$globe::latex_flags{$key}/g
00509          }
00510       }
00511       //  Take care of the title
00512       if $#define'output_header_tex ~ /$globe::flag_title/{
00513          $#define'output_header_tex ~ s/$globe::flag_title/$globe::master_order_title[$i]/g
00514       }
00515       if $#define'output_doxygen_sty ~ /$globe::flag_title/{
00516          $#define'output_doxygen_sty ~ s/$globe::flag_title/$globe::master_order_title[$i]/g
00517       }
00518       //  Take care of the document number
00519       if $#define'output_header_tex ~ /$globe::flag_doc_num/{
00520          $temp = $globe::master_order_pdf[$i];
00521          $temp =~ s/.pdf//gi;
00522          $#define'output_header_tex ~ s/$globe::flag_doc_num/$temp/g
00523       }
00524       if $#define'output_doxygen_sty ~ /$globe::flag_doc_num/{
00525          $temp = $globe::master_order_pdf[$i];
00526          $temp =~ s/.pdf//gi;
00527          $#define'output_doxygen_sty ~ s/$globe::flag_doc_num/$temp/g
00528       }
00529       //  Take care of the date
00530       if $#define'output_header_tex ~ /$globe::flag_date/{
00531          $#define'output_header_tex ~ s/$globe::flag_date/$dddate/g
00532       }
00533       if $#define'output_doxygen_sty ~ /$globe::flag_date/{
00534          $#define'output_doxygen_sty ~ s/$globe::flag_date/$dddate/g
00535       }
00536       //  Output the stuff to where it belongs...
00537       print OUT_TEX  $#define'output_header_tex
00538       print OUT_STY  $#define'output_doxygen_sty
00539 //       close (OUT_TEX);
00540 //       close (OUT_STY);
00541    }  //  for all indices into globe master order
00542 
00543 } //  new_doxygen_sty
00544 
00545 
00546 
00547 //#############################################################################
00548 /** @fn int using_voy_latex
00549  ** @brief What to do when no arguments are given.
00550  ** @param None
00551  ** @return None
00552  ** 
00553  ** @lim None
00554  ** @ingroup tp_latex
00555  **/
00556 // #############################################################################
00557 int using_voy_latex  ( ) {
00558 //    print "\nvoyant_latex.pl creates TEX and STY files output files for \n";
00559 //    print "Latex to use when creating PDF files from Doxygen output. \n";
00560 //    print "-- The first argument is the path where to start.\n";
00561 //    print "   It is assumed that the latex subdirectories will be under here.\n";
00562 //    print "-- The second argument is file to use to find the master order.\n";
00563 //    print "-- The optional third argument is file to use to find the latex definitions.\n";
00564 //    print "NOTE: The lates directories have to be named similar to\n";
00565 //    print "      their code reference directories \"zlx_\" instead of \"cref_\".\n";
00566 //    print "\nTerminating voyant_latex.pl without doing anything.\n";
00567    return;
00568 }
00569 
00570 
00571 
00572 //#############################################################################
00573 /** @fn int fill_in_master_sections
00574  ** @brief Gets the ordering out of the master file.
00575  ** @param None.
00576  ** @return Stores information into global variables for potential use.
00577  ** 
00578  ** Parses the master file for necessary information. This includes:<ul>
00579  ** <li>directory.</li>
00580  ** <li>document name.</li>
00581  ** <li>PDF file name.</li>
00582  ** <li>document number.</li></ul>
00583  ** The ordering is the directory under doc_publish that the material is supposed
00584  ** to appear in.
00585  ** @lim None.
00586  ** @ingroup tp_latex
00587  **/
00588 // #############################################################################
00589 int fill_in_master_sections  ( ) {
00590 
00591    &globe::get_master_nav_info();
00592    // ####
00593    //  Get the latex file information
00594    // ####
00595    $def_type = "latex";
00596    if (exists ($globe::m_info{$def_type})){
00597       ($before, $piece, $after) = &globe::get_tag_chunk( $globe::m_info{$def_type},
00598                                $globe::m_define{$def_type}[0], 
00599                                $globe::m_define{$def_type}[1], 
00600                                $not_critical);
00601       if ($piece){
00602          $globe::m_info{$def_type} = $piece;
00603          // #################
00604          //  Latex flag definitions
00605          // #################
00606          @pre_chunks = split ( /\n/, $globe::m_info{$def_type});
00607          if (0){
00608             for ($i=0; $i < @pre_chunks; $i++){  
00609 //                print "$i == $pre_chunks[$i]\n";
00610             }
00611          }
00612          $c_cnt=0;
00613          for ($i=0; $i <= $// pre_chunks; $i++){
00614             if ($pre_chunks[$i] =~ /[\w+]/) {
00615                @lx_chunk = split ( /\,/, $pre_chunks[$i], 2);
00616                for ($j=0; $j < @lx_chunk; $j++){
00617                   //  strip out quotation marks
00618                   $lx_chunk[$j] =~ s/[\s]*\"[\s]*//g;
00619                }
00620                $lx_flag[$c_cnt] = $lx_chunk[0];
00621                $globe::latex_flags{$lx_flag[$c_cnt]} = $lx_chunk[1];
00622                //  we use the c_cnt, because they're might be blank lines
00623                $c_cnt++;
00624             }
00625          }  //  for $i
00626       }
00627    } else {
00628       push (@file_errors, "ERROR: Master file does not have proper latex definition.");
00629    }
00630    
00631    // ####
00632    //  Get the latex header information
00633    //  Latex title page definitions
00634    // ####
00635    $def_type = "latex_header";
00636    if (exists ($globe::m_info{$def_type})){
00637       ($before, $piece, $after) = &globe::get_tag_chunk( $globe::m_info{$def_type},
00638                                $globe::m_define{$def_type}[0], 
00639                                $globe::m_define{$def_type}[1], 
00640                                $not_critical);
00641       if ($piece){
00642          @globe::latex_title = split ( /\,/, $piece, 3);
00643          for ($i=0; $i <= $// globe::latex_title; $i++){  
00644              //  strip out quotation marks
00645              $globe::latex_title[$i] =~  s/[\s]*\"[\s]*//g;
00646              if (0){
00647 //                 print "$i == $globe::latex_title[$i]\n";
00648              }
00649          }
00650       }
00651    } else {
00652       push (@file_errors, "ERROR: Master file does not have proper latex header definition.");
00653    }
00654    
00655    if (0) {
00656       foreach $k (keys %globe::m_info) {
00657          if ($k =~ /^latex/i){
00658 //             print "$k $globe::m_info{$k}\n";
00659          }
00660       }
00661       foreach $key (keys %globe::latex_flags) {  
00662 //          print "key = $key = $globe::latex_flags{$key}\n";
00663       }
00664       for ($i=0; $i <= $// globe::latex_title; $i++){  
00665 //          print "$i == $globe::latex_title[$i]\n";
00666       }
00667 
00668 //       print "glenn";
00669 //       exit(1);
00670    }
00671 
00672    // undef (@pre_chunks);
00673    // undef (@chunks);
00674    // undef (@lx_chunks);
00675    // undef ($start);
00676    // undef ($stop);
00677    
00678 } //  fill_in_master_sections
00679 
00680 
00681 //#############################################################################
00682 /** @fn int END
00683  ** @brief Code to execute when first entered.
00684  **
00685  ** @param None. 
00686  **
00687  ** @return None.
00688  **
00689  ** @lim None
00690  ** @ingroup tp_nav
00691  **/
00692 // #############################################################################
00693 int END  ( ) {
00694    // undef ($_file_list); //  = "_file_list";
00695    // undef ($in_file); //  = "";
00696    // undef ($f_type); //  = "htm";
00697    // undef ($loc_path); //  = "./";
00698 
00699    if (@file_errors) {
00700 //       print "\n============  Summary of errors =================================b\n";
00701       for ($i=0; $i<@file_errors; $i++){
00702 //          print "$i = $file_errors[$i]\n";
00703       }
00704    }
00705    
00706    // #############################################################################
00707    // # Memory clean-up.
00708    // #############################################################################
00709    &globe::memory_clean_up();
00710 
00711 //    print "\n============  Finished voyant_latex.pl ==================================\n";
00712 } //  END
00713 


 "Perl Program Reference" 
 < Previous 
 Next > 


Open-Source tools compliments of Voyant Technologies, Inc. and Glenn C. Maxey.
01/13/2003

TP Tools v2-00-0a

# tpt-perl-hcr-02