Contents 
 Index 
 "Perl Program Reference" 
 < Previous 
 Next > 

log_html_gen.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 package scheck;
00018 //#############################################################################
00019 /** @file
00020  ** @brief Generates one or more HTML files based upon what is found in
00021  ** the messages.txt file that contains all of the log messages.
00022  ** 
00023  ** log_html_gen.pl ../cms_middleware/doc_publish/book_cms_logging/ 
00024  **    ../../zz_stage/bridgegroup/middleware/supptsys/messages.txt 
00025  **    ../cms_middleware/voyant_master_nav.html
00026  **    "Middleware "
00027  **
00028  ** @ingroup tp_tools tp_xhelp
00029  **
00030  ** @author Glenn C. Maxey
00031  **/
00032 // #
00033 //#    $Id: log_html_gen.pl,v 1.8 2002/11/20 15:23:04 gmaxe Exp $
00034 //#
00035 //# Copyright 2002 Created by Voyant Technologies, Inc., Westminster, Colorado, USA.
00036 //#
00037 //# Revision Information:
00038 //#
00039 //# $Log: log_html_gen.pl,v $
00040 //# Revision 1.8  2002/11/20 15:23:04  gmaxe
00041 // //# Added exit codes so that wrapper scripts can catch errors properly.
00042 //#
00043 //# Revision 1.7  2002/11/20 01:49:12  gmaxe
00044 // //# Minor changes to exit codes.
00045 //#
00046 //# Revision 1.6  2002/08/07 01:27:13  gmaxe
00047 //# Changed the {comment} to a {comment_full} where appropriate.
00048 //# Enhanced the ini gen as appropriate to get the desired output.
00049 //#
00050 //# Revision 1.5  2002/08/03 00:58:25  gmaxe
00051 //# Updates before the weekend. Now it parses target files better;
00052 //# had problems with scoping for variables.
00053 //#
00054 //# Revision 1.4  2002/08/02 00:35:07  gmaxe
00055 //# Created a new file for parsing INI files. It is based on
00056 //# log_html_gen.pl; common routines were moved from that file
00057 //# into globe.pm for better sharing.
00058 //#
00059 //# Revision 1.3  2002/07/02 23:10:53  gmaxe
00060 //# Tweaked to get rid of extra expanding line feeds in voyant_nav.pl.
00061 //# Added topper.html and other files to skip list in globe.pm.
00062 //# Enhanced log_html_gen.gl to handle new format of message.txt;
00063 //# it now has a flatter data structure and no enums numbers.
00064 //#
00065 //# Revision 1.2  2002/04/22 17:53:33  gmaxe
00066 //# Minor enhancements to sorting order and TOC display.
00067 //# Also support an additional argument for a title.
00068 //#
00069 //# Revision 1.1  2002/04/20 11:31:22  gmaxe
00070 //# Added support for a tool that generates HTML for the log
00071 //# messages. This is one step away from a tool that does
00072 //# XML parsing to generate HTML. Some comments are still
00073 //# lacking.
00074 //#
00075 //# Revision 1.1  2002/04/12 22:52:25  gmaxe
00076 //# New tool to check on whether or not all SAPI commands are present.
00077 //# Uses the files generated by the vproto_gen.pl tool.
00078 //#
00079 //#
00080 //#############################################################################
00081 
00082 //#############################################################################
00083 /** @fn int BEGIN
00084  ** @brief Code to execute when first entered.
00085  **
00086  ** @param None. 
00087  **
00088  ** @return None.
00089  **
00090  ** @lim None
00091  ** @ingroup tp_xhelp
00092  **/
00093 // #############################################################################
00094 int BEGIN  ( ) {
00095 //    print "\n============  Starting log_html_gen.pl ==================================\n";
00096    $_file_list = "_file_list";
00097    $in_file = "";
00098    $root_path = "./";
00099    $scope_pm = "globe.pm";
00100    $tag_xml = "logmsg";
00101    $no_scope_file = 0;
00102    $arg_cnt=0;
00103    
00104    push (@INC, `pwd`);
00105    push (@INC, '../perl');
00106    if (0){
00107 //       print (@INC, "\n");
00108    }
00109    
00110 
00111    
00112    //  Get scope files if there is one.
00113    if (1) { //  used
00114       //  $scope_pm = @ARGV[$arg_cnt];
00115       // ####
00116       //  All global variables are defined in the following file
00117       // ####
00118       
00119       unless (open ( IN_LIST, $scope_pm)) {
00120          unless (open ( IN_LIST, "../perl/$scope_pm")) {
00121             push (@file_errors, "Cannot open file \"$scope_pm\"");
00122             $no_scope_file++;
00123          }
00124       }
00125 //       close (IN_LIST);
00126       push (@INC, $scope_pm);
00127       
00128       if (!@file_errors) {
00129          // ####
00130          //  All global variables are defined in the following file
00131          // ####
00132          require $scope_pm;
00133    
00134          if (&globe::declare_variables()) {
00135 //             print "Variables initialized from $scope_pm.\n";
00136          } else {
00137             push (@file_errors, "Could not initialize variables from $scope_pm.");
00138          }
00139       } //  if not @file_errors
00140    } else {
00141       push (@file_errors, "Need to provide a scope file as first argument.");
00142    } //  if 1 or more arguments
00143 
00144  
00145  if (0) { //  commented out because not used
00146    //  Get scope files if there is one.
00147    if (@ARGV > $arg_cnt) {
00148       $scope_pm = @ARGV[$arg_cnt];
00149       
00150       unless (open ( IN_LIST, $scope_pm)) {
00151          push (@file_errors, "Cannot open file \"$scope_pm\"");
00152          $no_scope_file++;
00153       }
00154 //       close (IN_LIST);
00155       push (@INC, $scope_pm);
00156       
00157       if (!@file_errors) {
00158          // ####
00159          //  All global variables are defined in the following file
00160          // ####
00161          require $scope_pm;
00162    
00163          if (&globe::declare_variables()) {
00164 //             print "Variables initialized from $scope_pm.\n";
00165          } else {
00166             push (@file_errors, "Could not initialize variables from $scope_pm.");
00167          }
00168       } //  if not @file_errors
00169    } else {
00170       push (@file_errors, "Need to provide a scope file as first argument.");
00171    } //  if 1 or more arguments
00172    $arg_cnt++;
00173  } //  commented out because not used  
00174 
00175    if (!(exists ($globe::x_define{$tag_xml}))) {
00176       push (@file_errors, "\"$tag_xml\" does not exist in the global definitions (\"$scope_pm\").");
00177    }
00178 
00179    //  Get path to code files 
00180    if (@ARGV > $arg_cnt) {
00181       $root_path = @ARGV[$arg_cnt];
00182       $globe::path = @ARGV[$arg_cnt];
00183       if ($root_path =~ /\/$/) {
00184 //          print "The path specified is $root_path\n";
00185       } else {
00186          push (@file_errors, "The input argument \"$root_path\" requires a forward slash (\/) at the end.\n");
00187       }
00188    } //  if 1 or more arguments
00189    $arg_cnt++;
00190 
00191 
00192    // #! log_html_gen.pl ../cms_middleware/doc_publish/book_cms_logging/ ../../zz_stage/bridgegroup/middleware/supptsys/messages.txt ../cms_middleware/voyant_master_nav.html
00193 
00194    if (@ARGV > $arg_cnt) {
00195       $org_msg = @ARGV[$arg_cnt];
00196 //       print "The message input file is $org_msg \n";
00197    } else {
00198       push (@file_errors, "Need to have the input message file.");
00199    } //  if 3 or more arguments
00200    $arg_cnt++;
00201 
00202    if (@ARGV > $arg_cnt) {
00203       $globe::master_nav_file = @ARGV[$arg_cnt];
00204 //       print "The master HTML input file is $globe::master_nav_file \n";
00205       unless (open ( IN_MASTER, $globe::master_nav_file)) {
00206          push (@file_errors, "Cannot open file \"$globe::master_nav_file\"\n");
00207       }
00208    } else {
00209       push (@file_errors, "Need to have the input master HTML file.");
00210    } //  if 3 or more arguments
00211    $arg_cnt++;
00212 
00213    if (@ARGV > $arg_cnt) {
00214       $org_title = @ARGV[$arg_cnt];
00215 //       print "The title for output is $org_title \n";
00216    } //  if 3 or more arguments
00217    $arg_cnt++;
00218 
00219 } //  BEGIN
00220    
00221    
00222    
00223 
00224 //#############################################################################
00225 /** @fn int main
00226  ** @brief The main program.
00227  **
00228  ** @param file_errors If file errors are encountered before the main
00229 //  ** routine is hit, it prints them out and exits. 
00230  **
00231  ** @return None.
00232  **
00233  ** If the needed data structures in $scope_pm have not been enabled,
00234  ** this program errors out immediately.
00235  ** 
00236  ** Controls the program flow. It creates a temporary file with the
00237  ** error results.
00238  **
00239  ** @lim None
00240  ** @ingroup tp_xhelp
00241  **/
00242 // #############################################################################
00243 // sub main {
00244 {
00245    // #############################################################################
00246    // # Start of Main Program
00247    // #############################################################################
00248    if (@file_errors) {
00249       //  Makes no sense to go on if input parameters are off.
00250 //       print "\n============  Summary of errors ==================================\n";
00251       for ($i=0; $i<@file_errors; $i++){
00252 //          print "$i = $file_errors[$i]\n";
00253       }
00254       &scheck::using_scheck();
00255 //       exit(1);
00256    }
00257 
00258 
00259    if ((1) && (!(&master_file))){
00260 //       print "Master file failed some things.\n";
00261    } 
00262    
00263    if ((1) && (!(&globe::read_code_n_comment($org_msg, 1)))){
00264       //  The 1 means that we care about separating comments in the
00265       //  message.txt file from the lines that represent a log message.
00266 //       print "Message file failed some things.\n";
00267    } 
00268    //  At this point, $globe::comment_file was created and populated,
00269    //  as was $globe::entire_file.
00270 
00271    if ((1) && (!(&globe::process_comments_from_file($org_msg, $tag_xml)))){
00272 //       print "1 Processing comments from file failed some things.\n";
00273    } 
00274    //  At this point, $globe::comment_file has been parsed and
00275    //  can be overwritten.
00276    
00277 
00278    if ((1) && (!(&create_data_structure))){
00279 //       print "Creating data structure failed some things.\n";
00280    } 
00281    //  At this point, the $globe::entire_file, which had the
00282    //  log messages in it, has been processed into a data structure.
00283    //  Hence, $globe::entire_file is no longer needed.
00284    
00285    
00286    //  At this point it is safe to call globe::read_code_n_comment again with
00287    //  another file, because $globe::comment_file and $globe::entire_file
00288    //  have both been placed into the data structure already.
00289    //  Deep down in the next routine it does get called.
00290    
00291    if ((1) && (!(&globe::xtag_into_mess_structure($org_msg, $tag_xml)))){
00292 //       print "Getting logmsg into message structure failed some things.\n";
00293    } 
00294    if (0) {
00295 //       print "Searching1 for stuff...\n";
00296       foreach $f (sort keys %{$globe::tag_mess{file}}) {
00297          foreach $t (sort keys %{$globe::tag_mess{file}{$f}}){
00298 //             print "\"$f\":\"$t\":\n$globe::tag_mess{file}{$f}{$t}\n";
00299          }
00300       }
00301       foreach $t (sort keys %{$globe::tag_mess{name}}) {
00302          foreach $i (@{$globe::tag_mess{name}{$t}}){
00303 //             print "\"$t\":$globe::tag_mess{name}{$t}[$i]\n";
00304          }
00305       }
00306 //       print "Searching2 for stuff...\n";
00307 //       exit(1);
00308    }
00309  
00310    
00311    if (1) {
00312       &write_output_html();
00313    }
00314    if (0) {
00315       &generate_index;
00316    }
00317 
00318    if (1) {
00319       &generate_script;
00320    }
00321    
00322    
00323    // #############################################################################
00324    // # Spit out errors
00325    // #############################################################################
00326    if (@file_errors) {
00327 //       print "\n============  Summary of errors ==================================\n";
00328       for ($i=0; $i<@file_errors; $i++){
00329 //          print "$i = $file_errors[$i]\n";
00330       }
00331    }
00332 
00333    // #############################################################################
00334    // # End of most of work
00335    // #############################################################################
00336 //    exit(0);
00337 }
00338 
00339 
00340 //#############################################################################
00341 /** @brief Reads in the entire master HTML file
00342  ** 
00343  ** @lim Fills up $globe::master variables.
00344  **/
00345 // #############################################################################
00346 int master_file  ( ) {
00347    #define $before  ""
00348    #define $after  ""
00349    #define $piece  ""
00350 
00351    //  Get the master definitions
00352    while (<IN_MASTER>){    //  entire master file into memory.
00353       $globe::master_nav .= $_;
00354    }
00355 
00356    if (&globe::get_master_nav_info() =~ 1){
00357 //       print "Master Navigation file \"$globe::master_nav_file\" has definition errors.\n";
00358       if (@file_errors) {
00359 //          print "\n============  Summary of errors ==================================\n";
00360          for ($i=0; $i<@file_errors; $i++){
00361 //             print "$i = $file_errors[$i]\n";
00362          }
00363       }
00364       return (0);
00365    } else {
00366      //  Create special navigation in the footer that repeats buttons.
00367      $globe::voy_footer_fm = "$globe::m_define{footer}[0]\n<br><br>\n";
00368      $def_type = "nav_book";
00369      ($before, $piece, $after) = &globe::get_tag_chunk( $globe::m_info{$def_type},
00370                                  $globe::m_define{$def_type}[0], 
00371                                  $globe::m_define{$def_type}[1], 
00372                                  $very_critical);
00373 
00374      $globe::voy_footer_fm .= "$piece\n";
00375      
00376      $def_type = "footer";
00377      ($before, $piece, $after) = &globe::get_tag_chunk( $globe::m_info{$def_type},
00378                                  $globe::m_define{$def_type}[0], 
00379                                  $globe::m_define{$def_type}[1], 
00380                                  $very_critical);
00381      
00382      $globe::voy_footer_fm .= "$piece\n";
00383      $globe::voy_footer_fm .= "$globe::m_define{footer}[1]\n";
00384 
00385      
00386      $globe::master_order_key = @globe::master_order;  //  sets the default value
00387      for ($i=0; $i <= $// globe::master_order -1; $i++){
00388         //  does not go to the last one, because that is the default, already set
00389         if ($globe::path =~ /$globe::master_order[$i]/){
00390            $globe::master_order_key = $i;
00391 //            //  print "$i = $globe::master_order[$globe::master_order_key]\n";
00392         }
00393      }
00394      if (0) {
00395 //         print "=== Master Header ==\n$globe::m_info{header}\n";
00396 //         print "=== Master Common Top ==\n$globe::m_info{nav_common}\n";
00397 //         print "=== Master Doxygen ==\n$globe::m_info{nav_doxygen}\n";
00398 //         print "=== Master FM Book ==\n$globe::m_info{nav_book}\n";
00399 //         print "=== Master Footer ==\n$globe::m_info{footer}\n";
00400 //         print "=== Master Dox Footer ==\n$globe::voy_footer_dox\n";
00401 //         print "=== Master FM Footer ==\n$globe::voy_footer_fm\n";
00402 //         print "=== Master variables ==\n$globe::m_info{variable}\n";
00403         //  return (0);
00404      }
00405    }
00406    return (1);
00407 } //  master file
00408 
00409 
00410 //#############################################################################
00411 /** @brief Creates a data structure from each line in the message file.
00412  ** 
00413  **       $name = name associated with number
00414  **       $globe::xtag_struct{$name}{severity} = severity associated with number
00415  **       $globe::xtag_struct{$name}{message} = message associated with number
00416  **       $globe::xtag_struct{$name}{comment} = comment associated with number
00417  ** 
00418  ** @lim 
00419  **/
00420 // #############################################################################
00421 int create_data_structure  ( ) {
00422 
00423    // undef (%globe::xtag_struct);
00424    
00425    @_input_line = split (/\n/, $globe::entire_file);
00426    
00427    $j=0;
00428    LMSG: foreach $line (@_input_line){
00429       @_line_field = split (/\|/, $line);
00430       if ($_line_field[0] =~ /enumstart/i) {
00431          next LMSG;
00432       }
00433       if (0) {
00434 //          print "\n$j: Now let's output this Guy =====\n"; 
00435          $i = 0;
00436          foreach $field (@_line_field) {
00437 //             print "a$i = $field; ";
00438             $i++;
00439          }
00440 //          print "\n============\n";
00441          for ($i=0; $i<=$// _line_field; $i++) {
00442 //             print "b$i = $_line_field[$i]; ";
00443          }
00444 //          print "\n============\n";
00445       }
00446       $j++;
00447       
00448      
00449       // ####
00450       //  07/02/2002 GCM message file changed format;
00451       //  field[0] is now the name. So the {name} goes away, as does {num}.
00452       // ####
00453       // ####
00454       //  Create the data structure for messages.
00455       // ####
00456 //       //  print "$_line_field[0]\n";
00457       $globe::xtag_struct{$_line_field[0]} = $_line_field[0];
00458       $globe::xtag_struct{$_line_field[0]}{severity} = $_line_field[1];
00459       $globe::xtag_struct{$_line_field[0]}{message} = $_line_field[2];
00460       $globe::xtag_struct{$_line_field[0]}{comment} = $_line_field[3];
00461       //  07/02/2002
00462    }
00463    
00464    if (0) {
00465 //       print "Testing the output...\n";
00466       $j=0;
00467       foreach $i (sort keys %{globe::xtag_struct}) {
00468          if (1) {
00469 //             print "==== name $i =====\n";
00470             foreach $item (keys %{$globe::xtag_struct{$i}}){
00471 //                print "   $i: $item: $globe::xtag_struct{$i}{$item}\n";
00472             }
00473          }
00474          $j++;
00475       }
00476 //       print "Done Testing the output...\n";
00477 //       //  exit(1);
00478    }
00479    
00480    return (1);
00481  
00482  
00483 } //  create_data_structure
00484 
00485 
00486 
00487 //#############################################################################
00488 /** @fn int write_output_html
00489  ** @brief Sorts the data structure by name and creates the html files.
00490  **
00491  ** @param file_out The name of the file to output.
00492  **       $name = name associated with number
00493  **       $globe::xtag_struct{$name}{prev} = previous html file
00494  **       $globe::xtag_struct{$name}{next} = next html file
00495  **       $globe::xtag_struct{$name}{html} = associated html file
00496  **       $globe::xtag_struct{$name}{severity} = severity associated with number
00497  **       $globe::xtag_struct{$name}{message} = message associated with number
00498  **       $globe::xtag_struct{$name}{comment} = comment associated with number
00499  **
00500  ** @ingroup tp_xhelp
00501  **/
00502 // #############################################################################
00503 int write_output_html  ( ) {
00504    #define $by_name  1
00505    if (1) {
00506 //      print "Getting ready to write output html.\n";
00507    }
00508    if (0) {
00509 //       print "Testing the output...\n";
00510       $j=0;
00511       foreach $i (sort keys %{globe::xtag_struct}) {
00512          if (1) {
00513 //             print "==== name $i =====\n";
00514             foreach $item (keys %{$globe::xtag_struct{$i}}){
00515 //                print "   $i: $item: $globe::xtag_struct{$i}{$item}\n";
00516             }
00517          }
00518          $j++;
00519       }
00520 //       print "Done Testing the output...\n";
00521 //       //  exit(1);
00522    }
00523    
00524    if (0) {
00525 //       print "$globe::m_info{header}\n";
00526 //       print "$globe::m_info{footer}\n";
00527 //       print "$globe::m_info{variable}\n";
00528       $def_type = "variable";
00529 //       print "$def_type $globe::m_define{$def_type}[0]\n";
00530       foreach $var (keys %{$globe::m_var{define}}) {
00531 //          print "$var $globe::m_var{define}{$var}\n";
00532       }
00533 //       exit(1);
00534    }
00535    
00536    
00537    // ####
00538    //  Assign previous and next values for the navigation
00539    // ####
00540    if ($by_name) { //  new way sorts by name
00541       $prev = "_TBD_";
00542       $i=0;
00543       foreach $name (sort {$a cmp $b} keys %{globe::xtag_struct}){
00544          $globe::xtag_struct{$name}{prev} = $prev;
00545          //  Check to see if file exists
00546          $globe::xtag_struct{$name}{html} = "$name.html";
00547          $prev = "$name.html";
00548          if ($i == 0) {
00549             $first = $name;
00550             $first_prev = $prev;
00551          }
00552          $i++;
00553       }
00554       $next = "_TBD_";
00555       $i=0;
00556    }
00557    $next = "_TBD_";
00558    $i=0;
00559    if ($by_name) { //  new way sorts by name
00560       foreach $name (sort {$b cmp $a} keys %{globe::xtag_struct}){
00561          $globe::xtag_struct{$name}{next} = $next;
00562          $next = "$name.html";
00563          if ($i == 0) {
00564             $last = $name;
00565             $last_next = $next;
00566          }
00567          $i++;
00568       }
00569    }
00570    $total=$i;
00571    // ####
00572    //  Fix the first and last previous and next assignments.
00573    // ####
00574    $globe::xtag_struct{$last}{next} = $first_prev;
00575    $globe::xtag_struct{$first}{prev} = $last_next;
00576 
00577    $def_type = "variable";
00578    $i=0;
00579      
00580    //  new way sorts by name, old way by number
00581    ENUM: foreach $name (sort {$a cmp $b} keys %{globe::xtag_struct}){
00582       if (0) {
00583 //          print "Getting ready for $name\n";
00584       }
00585       $file_out = "$globe::path";
00586       $file_out .= "$name.html";
00587 
00588       // ####
00589       //  Cheap-o error checking; not completely valid,
00590       //  but will save at least one file from getting overwritten.
00591       // ####
00592       if ((0) && (open ( OUT_FILE, "$file_out"))) {
00593 //          close (OUT_FILE);
00594          push (@file_errors, "\"$file_out\" already exists.\n");
00595 //          print "Cannot open file \"$file_out\"\n";
00596          next ENUM;
00597       }
00598 
00599       unless (open ( OUT_FILE, ">$file_out")) {
00600          push (@file_errors, "Cannot open file \"$file_out\"\n");
00601 //          print "Cannot open file \"$file_out\"\n";
00602          next ENUM;
00603       }
00604       if (1) {
00605 //          print "Creating $file_out...\n";
00606       }
00607 //       print (OUT_FILE "<html>\n <head>\n");
00608 //       //  print (OUT_FILE "<title>$name</title>\n");
00609 //       print (OUT_FILE "$globe::m_info{header}\n");
00610 //       print (OUT_FILE "$globe::m_define{$def_type}[0] ");
00611       
00612 //       print (OUT_FILE "$globe::m_var{define}{prev}$globe::xtag_struct{$name}{prev}");
00613 //       print (OUT_FILE "$globe::m_var{define}{next}$globe::xtag_struct{$name}{next}");
00614       if (0) {
00615 //          print "$globe::m_var{define}{prev}$globe::xtag_struct{$name}{prev}";
00616 //          print "$globe::m_var{define}{next}$globe::xtag_struct{$name}{next}\n";
00617 
00618       }
00619       if ($i == 0) {
00620 //          print (OUT_FILE "$globe::m_var{define}{firstlast}1\// 0");
00621       } elsif ($i == $total - 1) {
00622 //          print (OUT_FILE "$globe::m_var{define}{firstlast}0\// 1");
00623       } else {
00624 //          print (OUT_FILE "$globe::m_var{define}{firstlast}0\// 0");
00625       }
00626       
00627 //       print (OUT_FILE "$globe::m_define{$def_type}[1] \n");
00628 //       print (OUT_FILE "</head>\n<body>\n");
00629       // ####
00630       //  Fix up the navigation
00631       //  GCM still to do... with previous and next...
00632       // ####
00633       $nav_bars = $globe::m_info{nav_common};
00634       $nav_bars .= $globe::m_info{nav_book};
00635       $nav_bars =~ s/$globe::m_var{define}{prev}/$globe::xtag_struct{$name}{prev}/;
00636       $nav_bars =~ s/$globe::m_var{define}{next}/$globe::xtag_struct{$name}{next}/;
00637       $out_string = $nav_bars;
00638       $out_string .= "<h1>$name</h1>\n";
00639       $out_string .= "<p class=\"TitleChapterTOC\">Syntax:</p>\n"; 
00640       $out_string .= "<p class=\"Head1TOC\">$globe::xtag_struct{$name}{message}</p>\n";
00641       $out_string .= "<p class=\"TitleChapterTOC\">Severity:</p>\n"; 
00642       $out_string .= "<p class=\"Head1TOC\">$globe::xtag_struct{$name}{severity}</p>\n";
00643       $out_string .= "<p class=\"TitleChapterTOC\">Details:</p>\n"; 
00644       $out_string .= "<p class=\"Head1TOC\">$globe::xtag_struct{$name}{comment_full}</p>\n";
00645       $nav_bars = "$globe::m_info{nav_book}$globe::m_info{footer}";
00646       $nav_bars =~ s/$globe::m_var{define}{prev}/$globe::xtag_struct{$name}{prev}/;
00647       $nav_bars =~ s/$globe::m_var{define}{next}/$globe::xtag_struct{$name}{next}/;
00648       $out_string .= "$nav_bars\n";
00649 //       print (OUT_FILE "$out_string");
00650 //       print (OUT_FILE "</body>\n</html>\n");
00651 //       close (OUT_FILE);
00652       $i++;
00653    }
00654 
00655 
00656    for ($i=0; $i<@file_errors; $i++){
00657 //       print (OUT_FILE "$i = $file_errors[$i]\n");
00658    }
00659 } //  write_output_html
00660 
00661 
00662 //#############################################################################
00663 /**       $name = name associated with number
00664  **       $globe::xtag_struct{$name}{prev} = previous html file
00665  **       $globe::xtag_struct{$name}{next} = next html file
00666  **       $globe::xtag_struct{$name}{html} = associated html file
00667  **       $globe::xtag_struct{$name}{severity} = severity associated with number
00668  **       $globe::xtag_struct{$name}{message} = message associated with number
00669  **       $globe::xtag_struct{$name}{comment} = comment associated with number
00670  **/
00671 // #############################################################################
00672 int generate_index  ( ) {
00673       
00674    @path_piece = split (/\//, $globe::path);
00675    $strip_p = pop (@path_piece);
00676    $strip_p = pop (@path_piece);
00677    $strip_p .= "\/";
00678 
00679    foreach $name (sort keys %{globe::xtag_struct}){
00680       $out_string = $name;
00681       $out_string .= $globe::word_url_boundary;
00682       $out_string .= "<a href=\"";
00683       //  $out_string .= $strip_p;
00684       $out_string .= $globe::xtag_struct{$name}{html};
00685       $out_string .= "\" target=\"basefrm\">";
00686       push (@globe::index_info, $out_string);
00687    }
00688    $file_out = "$globe::path";
00689    $file_out .= "_index_list";
00690    unless (open ( OUT_INDEX_LIST, ">$file_out")) {
00691       push (@file_errors, "Cannot open file \"$file_out\"\n");
00692 //       print "Cannot open file \"$file_out\"\n";
00693    }
00694    if (0) { //  
00695       for ($i=0; $i<@globe::index_info; $i++){
00696 //          print "$i = $globe::index_info[$i]\n";
00697 //          print (OUT_INDEX_LIST "$globe::index_info[$i]\n");
00698       }
00699    }
00700 //    close (OUT_INDEX_LIST);
00701    if (1) {
00702 //       print "Creating $file_out...\n";
00703    }
00704 
00705 } //  generate_index
00706 
00707 
00708 //#############################################################################
00709 /**       $name = name associated with number
00710  **       $globe::xtag_struct{$name}{prev} = previous html file
00711  **       $globe::xtag_struct{$name}{next} = next html file
00712  **       $globe::xtag_struct{$name}{html} = associated html file
00713  **       $globe::xtag_struct{$name}{severity} = severity associated with number
00714  **       $globe::xtag_struct{$name}{message} = message associated with number
00715  **       $globe::xtag_struct{$name}{comment} = comment associated with number
00716  **/
00717 // #############################################################################
00718 int generate_script  ( ) {
00719       
00720    $file_out = "$globe::path";
00721    $file_out .= "tree.script";
00722    unless (open ( OUT_SCRIPT, ">$file_out")) {
00723       push (@file_errors, "Cannot open file \"$file_out\"\n");
00724 //       print "Cannot open file \"$file_out\"\n";
00725       return (0);
00726    }
00727 
00728 
00729 
00730    @path_piece = split (/\//, $globe::path);
00731    $strip_p = pop (@path_piece);
00732    $strip_p = pop (@path_piece);
00733    $strip_p .= "\/";
00734 
00735    { //  filler bracket
00736       // ####
00737       //  This top title is part of the master and does not need to be
00738       //  part of this.
00739       // ####
00740 //       print (OUT_SCRIPT "Item level=1 ");
00741 //       print (OUT_SCRIPT "image=nav_folderclosed.gif ");
00742 //       //  print (OUT_SCRIPT "url=$s_path,basefrm ");
00743 //       //  print (OUT_SCRIPT "selected=YES ");
00744 //       print (OUT_SCRIPT "text=$org_title Log Messages\r\n");
00745    } //  filler bracket
00746 
00747 
00748    foreach $name (sort {$a cmp $b} keys %{globe::xtag_struct}){
00749 //       print (OUT_SCRIPT "Item level=2 ");
00750 //       print (OUT_SCRIPT "image=nav_doc.gif ");
00751 //       //  print (OUT_SCRIPT "url=$strip_p$globe::xtag_struct{$name}{html},basefrm ");
00752 //       print (OUT_SCRIPT "url=$globe::xtag_struct{$name}{html},basefrm ");
00753 //       print (OUT_SCRIPT "selected=YES ");
00754 //       print (OUT_SCRIPT "text=$name\r\n");
00755    }
00756 
00757 //    close (OUT_SCRIPT);
00758    if (1) {
00759 //       print "Creating $file_out...\n";
00760    }
00761    
00762    return (1);
00763 
00764 } //  generate_script
00765 
00766 
00767 //#############################################################################
00768 /** @fn int using_scheck
00769  ** @brief What to do when no arguments are given.
00770  ** @param None
00771  ** @return None
00772  ** log_html_gen.pl ../cms_middleware/doc_publish/book_cms_logging/ 
00773  **    ../../zz_stage/bridgegroup/middleware/supptsys/messages.txt 
00774  **    ../cms_middleware/voyant_master_nav.html
00775  **    "Middleware "
00776  ** 
00777  ** @lim None
00778  ** @ingroup tp_xhelp
00779  **/
00780 // #############################################################################
00781 int using_scheck  ( ) {
00782 //    print "============  Syntax  ==================================\n";
00783 //    print "log_html_gen.pl <output directory> <input message file path \& name> ";
00784 //    print "<input master HTML file path \& names> [<title>]\n\n";
00785 //    print "- <output directory>  ";
00786 //    print "\n\n";
00787 //    print "- <input message file path \& name> is file path and name input message ";
00788 //    print "file that came from development.\n\n";
00789 //    print "- <input master HTML file path \& names> is file path and name of the master ";
00790 //    print "HTML file. \n";
00791 //    print "- [<title>] is an optional title that will be inserted into ";
00792 //    print "the TOC script for these messages; make sure it is followed by a ";
00793 //    print "space!!!\n";
00794 //    print "\n";
00795 //    print "============  Terminate  ==================================\n";
00796 //    print "Terminating log_html_gen.pl without doing anything.\n";
00797    return(1);
00798 }
00799 
00800 
00801 
00802 
00803 //#############################################################################
00804 /** @fn int END
00805  ** @brief Code to execute when terminated nicely.
00806  **
00807  ** @param None. 
00808  **
00809  ** @return None.
00810  **
00811  ** @lim None
00812  ** @ingroup tp_xhelp
00813  **/
00814 // #############################################################################
00815 int END  ( ) {
00816    // undef ($_file_list); //  "_file_list";
00817    // undef ($in_file ); //   "";
00818    // undef ($root_path ); //   "./";
00819    // undef (%file_hash);
00820 
00821   
00822    // #############################################################################
00823    // # Memory clean-up.
00824    // # Perform this if it was defined.
00825    // #############################################################################
00826    if ($no_scope_file > 0){
00827       &globe::memory_clean_up();
00828    }
00829    
00830 //    print "\n============  Finished log_html_gen.pl ==================================\n";
00831 } //  END
00832 


 "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