|
|
|
|
|
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 Updates the date and version in the supplied master file. 00020 ** 00021 ** @param $globe::master_nav_file [optional path and] filename for the 00022 ** HTML file to use as the master for information. 00023 ** This file has several specially flagged 00024 ** HTML comment sections that are required. Information from 00025 ** the tagged sections is updated based on the input. 00026 ** 00027 ** 00028 ** @ingroup tp_tools tp_nav 00029 ** 00030 ** @author Glenn C. Maxey 00031 ** 00032 **/ 00033 // # $Id: master_update.pl,v 1.2 2002/11/21 17:57:14 gmaxe Exp $ 00034 //# 00035 //# 2002 Created by Voyant Technologies, Inc., Westminster, Colorado, USA. 00036 //# 00037 //# Permission to use, copy, modify, and distribute this software and its 00038 //# documentation under the terms of the GNU General Public License is hereby 00039 //# granted. No representations are made about the suitability of this software 00040 //# for any purpose. It is provided "as is" without express or implied warranty. 00041 //# See the GNU General Public License (http://www.gnu.org/copyleft/gpl.html) 00042 //# for more details. 00043 //# 00044 //# Documents produced by this script are derivative works derived from the 00045 //# input used in their production; they are not affected by this license. 00046 //# 00047 //# Revision Information: 00048 //# 00049 //# $Log: master_update.pl,v $ 00050 //# Revision 1.2 2002/11/21 17:57:14 gmaxe 00051 //# Minor updates to version updating. 00052 //# 00053 //# Revision 1.1 2002/11/21 17:17:56 gmaxe 00054 //# Tools to automatically update version and date in an HTML file. 00055 //# Important when SCM runs our tool. 00056 //# 00057 //# 00058 //############################################################################# 00059 00060 00061 //############################################################################# 00062 /** @fn int BEGIN 00063 ** @brief Code to execute when first entered. 00064 ** 00065 ** @param None. 00066 ** 00067 ** @return None. 00068 ** 00069 ** @lim None 00070 ** @ingroup tp_nav 00071 **/ 00072 // ############################################################################# 00073 int BEGIN ( ) { 00074 // print "\n============ Starting master_update.pl ==================================\n"; 00075 $_file_list = "_file_list"; 00076 $_index_file = "_index_list"; 00077 $scope_pm = "globe.pm"; 00078 $_arg_inc = 0; 00079 $in_file = ""; 00080 $f_type = "htm"; 00081 $no_scope_file = 0; 00082 00083 push (@INC, `pwd`); 00084 push (@INC, '../perl'); 00085 push (@INC, '/rtfm/techpubs/perl'); 00086 if (0){ 00087 // print (@INC, "\n"); 00088 } 00089 // #### 00090 // All global variables are defined in the following file 00091 // #### 00092 unless (open ( IN_LIST, $scope_pm)) { 00093 unless (open ( IN_LIST, "../perl/$scope_pm")) { 00094 unless (open ( IN_LIST, "/rtfm/techpubs/perl/$scope_pm")) { 00095 push (@file_errors, "Cannot open file \"$scope_pm\" or \"../perl/$scope_pm\" or \"/rtfm/techpubs/perl/$scope_pm\"\n"); 00096 $no_scope_file++; 00097 } 00098 } 00099 } 00100 // close (IN_LIST); 00101 push (@INC, $scope_pm); 00102 push (@INC, "../perl/$scope_pm"); 00103 push (@INC, "/rtfm/techpubs/perl/$scope_pm"); 00104 00105 if (!@file_errors) { 00106 // #### 00107 // All global variables are defined in the following file 00108 // #### 00109 require $scope_pm; 00110 00111 if (&globe::declare_variables()) { 00112 // print "Variables initialized from $scope_pm.\n"; 00113 } else { 00114 push (@file_errors, "Could not initialize variables from $scope_pm.\n"); 00115 } 00116 } // if not @file_errors 00117 00118 if (@ARGV < 1) { 00119 push (@file_errors, "No HTML file specified as first argument.\n"); 00120 } 00121 00122 if (@ARGV > $_arg_inc) { 00123 $globe::master_nav_file = @ARGV[$_arg_inc]; 00124 // print "The master file is $globe::master_nav_file\n"; 00125 unless (open ( IN_MASTER, $globe::master_nav_file)) { 00126 push (@file_errors, "Cannot open file \"$globe::master_nav_file\"\n"); 00127 } 00128 // Get the master definitions 00129 while (<IN_MASTER>){ // entire master file into memory. 00130 $globe::master_nav .= $_; 00131 } 00132 // close (IN_MASTER); 00133 } // if 2 or more arguments 00134 $_arg_inc++; 00135 00136 if (@ARGV > $_arg_inc) { 00137 $def_type = "version"; 00138 $globe::m_info{$def_type} = @ARGV[$_arg_inc]; 00139 // print "The version is $globe::m_info{$def_type}\n"; 00140 } else { 00141 $def_type = "version"; 00142 $globe::m_info{$def_type} = "_NONE_"; 00143 // print "The version is $globe::m_info{$def_type}\n"; 00144 } // if 2 or more arguments 00145 $_arg_inc++; 00146 } 00147 00148 //############################################################################# 00149 /** @fn int main 00150 ** @brief The main program. 00151 ** 00152 ** @param None. 00153 ** 00154 ** @return None. 00155 ** 00156 ** @lim None 00157 ** @ingroup tp_nav 00158 **/ 00159 // ############################################################################# 00160 // sub main { 00161 { 00162 // ############################################################################# 00163 // # Program start 00164 // ############################################################################# 00165 00166 if (@file_errors) { 00167 // Makes no sense to go on if input parameters are off. 00168 // print "\n============ Summary of errors ==================================\n"; 00169 for ($i=0; $i<@file_errors; $i++){ 00170 // print "$i = $file_errors[$i]\n"; 00171 } 00172 &using_update(); 00173 // exit(1); 00174 } 00175 00176 $globe::entire_file = $globe::master_nav; 00177 00178 $not_critical = 0; 00179 $def_type = "version"; 00180 if (0) { 00181 // print "$def_type $globe::m_define{$def_type}[0]\n"; 00182 } 00183 if (1) { 00184 // print "$def_type $globe::m_info{$def_type}\n"; 00185 } 00186 if ( $globe::entire_file =~ /$globe::m_define{$def_type}[0]/ ) { 00187 ($before, $piece, $after) = &globe::get_tag_chunk( $globe::entire_file, 00188 $globe::m_define{$def_type}[0], 00189 $globe::m_define{$def_type}[1], 00190 $not_critical); 00191 if ($piece) { 00192 if ($globe::m_info{$def_type} =~ "_NONE_") { 00193 // This means that what is already in the file is more accurate 00194 // and should be left... 00195 $globe::m_info{$def_type} = $piece; 00196 } else { 00197 // $globe::entire_file = sprintf ("%s%s%s%s%s", 00198 $before, 00199 $globe::m_define{$def_type}[0], 00200 $globe::m_info{$def_type}, 00201 $globe::m_define{$def_type}[1], 00202 $after); 00203 } 00204 } 00205 } 00206 if (1) { 00207 // print "true $def_type $globe::m_info{$def_type}\n"; 00208 } 00209 if (0){ 00210 // print "=== header ==== $globe::entire_file\n"; 00211 // exit(1); 00212 } 00213 00214 $def_type = "date"; 00215 use POSIX 'strftime'; 00216 $globe::m_info{$def_type} strftime "%m/%d/%Y", #definetime 00217 if (1) { 00218 // print "$def_type $globe::m_info{$def_type}\n"; 00219 } 00220 00221 if ( $globe::entire_file =~ /$globe::m_define{$def_type}[0]/ ) { 00222 ($before, $piece, $after) = &globe::get_tag_chunk( $globe::entire_file, 00223 $globe::m_define{$def_type}[0], 00224 $globe::m_define{$def_type}[1], 00225 $not_critical); 00226 if ($piece) { 00227 // $globe::entire_file = sprintf ("%s%s%s%s%s", 00228 $before, 00229 $globe::m_define{$def_type}[0], 00230 $globe::m_info{$def_type}, 00231 $globe::m_define{$def_type}[1], 00232 $after) 00233 } 00234 } 00235 if (0){ 00236 // print "=== header ==== $globe::entire_file\n"; 00237 // exit(1); 00238 } 00239 unless (open ( IN_MASTER, ">$globe::master_nav_file")) { 00240 push (@file_errors, "Cannot open file \"$globe::master_nav_file\"\n"); 00241 } 00242 // print (IN_MASTER $globe::entire_file); 00243 // close (IN_MASTER); 00244 00245 // ############################################################################# 00246 // # End of Program 00247 // ############################################################################# 00248 // exit(0); 00249 } // the main routine 00250 00251 //############################################################################# 00252 /** @fn int using_update ( ) 00253 ** @brief What to do when no arguments are given. 00254 ** @param None 00255 ** @return None 00256 ** 00257 ** @lim None 00258 ** @ingroup tp_nav 00259 **/ 00260 // ############################################################################# 00261 int using_update ( ) { 00262 // print "\nmaster_update.pl operates on an HTML file. \n"; 00263 // print "It updates the date and version tags contained within the file.\n"; 00264 // print "-- The first argument is file to use for the master.\n"; 00265 // print " It must have sections for voy_version and voy_date.\n"; 00266 // print "-- The second argument is the version number.\n"; 00267 // print "\nTerminating master_update.pl without doing anything.\n"; 00268 return; 00269 } 00270 00271 //############################################################################# 00272 /** @fn int END 00273 ** @brief Code to execute when first entered. 00274 ** 00275 ** @param None. 00276 ** 00277 ** @return None. 00278 ** 00279 ** @lim None 00280 ** @ingroup tp_nav 00281 **/ 00282 // ############################################################################# 00283 int END ( ) { 00284 // undef ($_file_list); // "_file_list"; 00285 // undef ($_index_file); // = "_index_list"; 00286 // undef ($in_file); // ""; 00287 // undef ($f_type); // "htm"; 00288 00289 00290 // ############################################################################# 00291 // # Memory clean-up. 00292 // ############################################################################# 00293 if ($no_scope_file > 0){ 00294 &globe::memory_clean_up(); 00295 } 00296 00297 if (@file_errors) { 00298 // print "\n============ Summary of errors ==================================\n"; 00299 for ($i=0; $i<@file_errors; $i++){ 00300 // print "$i = $file_errors[$i]\n"; 00301 } 00302 } 00303 00304 // print "\n============ Finished master_update.pl ==================================\n"; 00305 } // END 00306 00307
|
|
|
Open-Source tools compliments of Voyant Technologies, Inc. and Glenn C. Maxey.
01/13/2003
TP Tools v2-00-0a
# tpt-perl-hcr-02