00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 int BEGIN ( ) {
00117
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";
00126
00127 push (@INC, `pwd`);
00128 push (@INC, '../perl');
00129 if (0){
00130
00131 }
00132
00133
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
00143 push (@INC, $scope_pm);
00144 if (!@file_errors) {
00145
00146
00147
00148 require $scope_pm;
00149
00150 if (&globe::declare_variables()) {
00151
00152 } else {
00153 push (@file_errors, "Could not initialize variables from $scope_pm.");
00154 }
00155 }
00156
00157
00158 if (@ARGV > $_arg_inc) {
00159 $globe::path = @ARGV[$_arg_inc];
00160 if ($globe::path =~ /\
00161
00162
00163 @path_chunks = split ( /\
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 }
00173 $_arg_inc++;
00174
00175 if (@ARGV > $_arg_inc) {
00176 $globe::master_nav_file = @ARGV[$_arg_inc];
00177
00178 unless (open ( IN_MASTER, $globe::master_nav_file)) {
00179 push (@file_errors, "Cannot open file \"$globe::master_nav_file\"");
00180 }
00181
00182 }
00183 $_arg_inc++;
00184
00185
00186 if (@ARGV > $_arg_inc) {
00187 $globe::master_nav_file2 = @ARGV[$_arg_inc];
00188
00189 unless (open ( IN_MASTER, $globe::master_nav_file2)) {
00190 push (@file_errors, "Cannot open file \"$globe::master_nav_file2\"");
00191 }
00192
00193 }
00194 $_arg_inc++;
00195
00196
00197 }
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 {
00213
00214
00215
00216 if (0){
00217
00218
00219 }
00220
00221 if (@file_errors) {
00222
00223
00224 for ($i=0; $i<@file_errors; $i++){
00225
00226 }
00227 &using_voy_latex();
00228
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
00236 while (<IN_MASTER>){
00237 $globe::master_nav .= $_;
00238 }
00239
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
00248 while (<IN_MASTER>){
00249 $globe::master_nav .= $_;
00250 }
00251
00252
00253
00254 if (&fill_in_master_sections() =~ 1){
00255
00256 push (@file_errors, "Master Navigation file \"$globe::master_nav_file\" has definition errors.\n");
00257 }
00258
00259
00260 &new_doxygen_sty();
00261
00262 &new_refman_tex();
00263
00264
00265
00266
00267
00268
00269 }
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284 int new_refman_tex ( ) {
00285
00286
00287
00288
00289
00290
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
00300
00301
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
00312
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
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
00326
00327
00328
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
00335 $refman = join ("", @t_chunk);
00336 } else {
00337
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
00347 push (@file_errors, "Cannot open file \"$loc_path$globe::latex_title[0]\" for writing.");
00348 next ALL_DIR;
00349 }
00350
00351
00352 $#define'output_header_tex $refman
00353
00354 foreach $key (keys %globe::latex_flags) {
00355
00356 if $#define'output_header_tex ~ /$key/{
00357 $#define'output_header_tex ~ s/$key/$globe::latex_flags{$key}/g
00358 }
00359 }
00360
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
00365 if $#define'output_header_tex ~ /$globe::flag_doc_num/{
00366 $temp = $globe::master_order_pdf[$i];
00367 $temp =~ s/.pdf
00368 $#define'output_header_tex ~ s/$globe::flag_doc_num/$temp/g
00369 }
00370
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
00378 print IN_OUT_TEX $#define'output_header_tex
00379
00380
00381
00382 }
00383
00384 }
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
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};
00405 delete( $globe::latex_flags{$key});
00406 } elsif ($key =~ /$globe::master_doxygen_sty/){
00407 $globe::master_doxygen_sty = $globe::latex_flags{$key};
00408 delete( $globe::latex_flags{$key});
00409 } elsif ($key =~ /$globe::output_header_tex/){
00410 $globe::output_header_tex = $globe::latex_flags{$key};
00411 delete( $globe::latex_flags{$key});
00412 } elsif ($key =~ /$globe::output_doxygen_sty/){
00413 $globe::output_doxygen_sty = $globe::latex_flags{$key};
00414 delete( $globe::latex_flags{$key});
00415 }
00416
00417 }
00418
00419 unless (open ( IN_MASTER, $globe::master_header_tex)) {
00420
00421 push (@file_errors, "Cannot open file \"$globe::master_header_tex\"");
00422
00423 }
00424 $globe::master_header_tex = "";
00425
00426 while (<IN_MASTER>){
00427 $globe::master_header_tex .= $_;
00428 }
00429
00430
00431
00432
00433
00434
00435
00436
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
00446
00447
00448 @t_chunk = split (/$start|$stop/, $globe::master_header_tex, 3);
00449
00450
00451
00452 if (@t_chunk =~ /3/){
00453 $globe::latex_title_page = $t_chunk[1];
00454
00455 } else {
00456
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
00465 push (@file_errors, "Cannot open file \"$globe::master_doxygen_sty\"");
00466
00467 }
00468 $globe::master_doxygen_sty = "";
00469
00470 while (<IN_MASTER>){
00471 $globe::master_doxygen_sty .= $_;
00472 }
00473
00474
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
00484
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
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
00495 push (@file_errors, "Cannot open file \"$loc_path$globe::output_doxygen_sty\" for writing.");
00496 next ALL_DIR;
00497 }
00498
00499 $#define'output_header_tex $globe::master_header_tex
00500 $#define'output_doxygen_sty $globe::master_doxygen_sty
00501
00502 foreach $key (keys %globe::latex_flags) {
00503
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
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
00519 if $#define'output_header_tex ~ /$globe::flag_doc_num/{
00520 $temp = $globe::master_order_pdf[$i];
00521 $temp =~ s/.pdf
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
00527 $#define'output_doxygen_sty ~ s/$globe::flag_doc_num/$temp/g
00528 }
00529
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
00537 print OUT_TEX $#define'output_header_tex
00538 print OUT_STY $#define'output_doxygen_sty
00539
00540
00541 }
00542
00543 }
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557 int using_voy_latex ( ) {
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567 return;
00568 }
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589 int fill_in_master_sections ( ) {
00590
00591 &globe::get_master_nav_info();
00592
00593
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
00605
00606 @pre_chunks = split ( /\n/, $globe::m_info{$def_type});
00607 if (0){
00608 for ($i=0; $i < @pre_chunks; $i++){
00609
00610 }
00611 }
00612 $c_cnt=0;
00613 for ($i=0; $i <= $
00614 if ($pre_chunks[$i] =~ /[\w+]/) {
00615 @lx_chunk = split ( /\,/, $pre_chunks[$i], 2);
00616 for ($j=0; $j < @lx_chunk; $j++){
00617
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
00683
00684
00685
00686
00687
00688
00689
00690
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