Contents 
 Index 
 "Perl Program Reference" 
 < Previous 
 Next > 

csh_comment_chg.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 //##############################################################################/
00019 //#
00020 /** @file
00021  ** @brief Changes the b shell script files so that it "looks" like a 
00022  ** C file with respect to the comment format and function names.
00023  ** 
00024  ** This is intended as an input filter to Doxygen.
00025  **
00026  ** @param Input file that uses shell (hash-hash-bang) comments.
00027  ** @return Output is a file that uses C-style comments required
00028  ** by Doxygen. 
00029  **
00030  ** If a line begins with hash-hash-bang, it is considered part of a Doxygen comment
00031  ** block.
00032  ** Lines that only have hash are turned into // comments and are later ignored
00033  ** by Doxygen.
00034  **  
00035  ** @ingroup tp_tools
00036  **
00037  ** @author Glenn C. Maxey
00038  **/
00039 // #
00040 //# $Id: csh_comment_chg.pl,v 1.1 2002/12/24 20:16:51 gmaxe Exp $
00041 //#
00042 //# 2002 Created by Voyant Technologies, Inc., Westminster, Colorado, USA.
00043 //#
00044 //# Permission to use, copy, modify, and distribute this software and its 
00045 //# documentation under the terms of the GNU General Public License is hereby 
00046 //# granted. No representations are made about the suitability of this software 
00047 //# for any purpose. It is provided "as is" without express or implied warranty. 
00048 //# See the GNU General Public License (http://www.gnu.org/copyleft/gpl.html) 
00049 //# for more details.
00050 //# 
00051 //# Documents produced by this script are derivative works derived from the 
00052 //# input used in their production; they are not affected by this license.
00053 //#
00054 //# $Log: csh_comment_chg.pl,v $
00055 //# Revision 1.1  2002/12/24 20:16:51  gmaxe
00056 //# Used for changing shell scripts for doxygen.
00057 //#
00058 //# Revision 1.7  2002/04/06 01:55:13  gmaxe
00059 //# New files and new general constructs for handling tags. Uses globals better.
00060 //# The html_look* files are designed to handle spider tracing of html systems.
00061 //#
00062 //# Revision 1.6  2002/01/16 19:49:08  gmaxe
00063 //# Removed much of revision history in comments.
00064 //#
00065 //#
00066 //##############################################################################/
00067 
00068 BEGIN {
00069    #define $comment_count  0  //  count if you're in the comments somewhere.
00070 //    print "\/\/ This file has been modified on-the-fly with an input filter\n";
00071 //    print "\/\/ to change it from shell syntax to C++ strictly for the purposes\n";
00072 //    print "\/\/ of faking out Doxygen. Modifications include:\n\n";
00073 //    print "\/\/ - changing \//  comments to C++ comments.\n";
00074 //    print "\/\/ - ...\n\n";
00075 //    print "\/\/ If you see other strangeness in the HTML version of the script file,\n";
00076 //    print "\/\/ it comes from getting it to look more C++ like.\n\n\n";
00077 }
00078 
00079 NEW_LINE: while (<>) {
00080 
00081    // ######## 
00082    //  Begin replacement of ##! comments with /** ... **/ comments
00083 //    //  This purposely does not do NEW_LINE or printing.
00084    // ######## 
00085    if (/^\// \#\!/) {
00086       if ($comment_count == 0){
00087          //  first line of a comment block
00088          $comment_count++;
00089          $_ =~ s/\// \#\!/\/\*\*/;
00090       } else {
00091          //  Some line in the middle of a comment block.
00092          $comment_count++;
00093          // ##
00094          //  Changed to have middle stuff with asterix.
00095          //  $_ =~ s/\#\#\!//;
00096          // ##
00097          $_ =~ s/\// \#\!/ \*\*/;
00098       }
00099    } elsif ($comment_count > 0){
00100       //  We were in a comment block; need to terminate it.
00101       $comment_count = 0;
00102       $_ = " \*\*\/\n" . $_ ;
00103    }
00104    // ######## 
00105 //    //  This purposely does not do NEW_LINE or printing.
00106    // ######## 
00107    // ######## End Comment style change.
00108 
00109    // ######## 
00110    //  Begin replacement of # comments with // comments
00111 //    //  This purposely does not do NEW_LINE or printing.
00112    // ######## 
00113    if (/^\// \!/) {
00114       //  Take care of the first line in a perl file.
00115       $_ =~ s/\// \!/\/\/ \#\!/;
00116    } elsif (/^[\// ]/) {
00117       //  Take care of lines that begin with a # perl comment
00118       $_ =~ s/\// /\/\//;
00119    } elsif (/[\// ]/) {
00120       //  Take care of lines that have a # perl comment somewhere
00121       $_ =~ s/\// /\/\/ /;
00122    }
00123    // ######## 
00124 //    //  This purposely does not do NEW_LINE or printing.
00125    // ########
00126    if (/globe\'/){
00127       $_ =~ s/globe\'/globe\_/g;
00128    }
00129    // ######## End Comment style change.
00130 
00131    // ######## 
00132    //  Begin replacement of @lim or @lim to @lim
00133    // ######## 
00134    if (/\@lim|\@lim/) {
00135       $_ =~ s/\@lim/\@lim/;
00136       $_ =~ s/\@lim/\@lim/;
00137 //       print $_;
00138       next NEW_LINE;
00139    } 
00140    
00141    // ######## 
00142    //  Default Fall through
00143    // ######## 
00144 //    print $_;
00145 
00146 }  
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 


 "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