|
|
|
|
|
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 /** @file 00020 ** @brief Input filter for Doxygen for most C/C++ code files. 00021 ** 00022 ** This changes code comments and other items on-the-fly so that it can be 00023 ** more effectively processed by Doxygen. In particular, our coding standard 00024 ** calls for slash-slash-bang comments. However, these comments are not interpretted as 00025 ** blocks even when placed together. Sometimes comments from a file header 00026 ** were being placed on code items. By changing the comment style to be 00027 ** C-style, a true comment block could be created with no misinterpretation. 00028 ** 00029 ** Other changes that this file does include: 00030 ** 00031 ** <ul><li> formatting some auto-generated classes to be correct for extraction.</li> 00032 ** <li>replacing @_bug with @_lim -- defined in the project file -- so that 00033 ** the word "bug" never appears in our output.</li> 00034 ** </ul> 00035 ** 00036 ** @param Input source file. 00037 ** @return Output is file with changes. 00038 ** 00039 ** @ingroup tp_tools tp_dox 00040 ** 00041 ** @author Glenn C. Maxey 00042 **/ 00043 // # 00044 //// $Id: dox_bug_filter.pl,v 1.9 2002/05/10 16:53:54 gmaxe Exp $ 00045 //// 00046 //// 2002 Created by Voyant Technologies, Inc., Westminster, Colorado, USA. 00047 //// 00048 //// Permission to use, copy, modify, and distribute this software and its 00049 //// documentation under the terms of the GNU General Public License is hereby 00050 //// granted. No representations are made about the suitability of this software 00051 //// for any purpose. It is provided "as is" without express or implied warranty. 00052 //// See the GNU General Public License (http://www.gnu.org/copyleft/gpl.html) 00053 //// for more details. 00054 //// 00055 //// Documents produced by this script are derivative works derived from the 00056 //// input used in their production; they are not affected by this license. 00057 //// 00058 //// $Log: dox_bug_filter.pl,v $ 00059 //// Revision 1.9 2002/05/10 16:53:54 gmaxe 00060 //// Added testing for inline comments; broke them out so that they 00061 //// appear on a line by themselves IN FRONT OF their owning code items. 00062 //// PTR#: 1-N8KS 00063 //// 00064 //// Revision 1.8 2002/04/06 01:55:08 gmaxe 00065 //// New files and new general constructs for handling tags. Uses globals better. 00066 //// The html_look* files are designed to handle spider tracing of html systems. 00067 //// 00068 //// Revision 1.7 2002/01/16 19:49:06 gmaxe 00069 //// Removed much of revision history in comments. 00070 //// 00071 ///////////////////////////////////////////////////////////////////////////////// 00072 00073 BEGIN { 00074 #define $comment_count 0 // count if you're in the comments somewhere. 00075 } 00076 00077 NEW_LINE: while (<>) { 00078 00079 // ######## 00080 // Begin replacement of //! comments with /** ... **/ comments 00081 // // This purposely does not do NEW_LINE or printing. 00082 // ######## 00083 if (/^\/\/\!/) { 00084 if ($comment_count == 0){ 00085 // first line of a comment block 00086 $comment_count++; 00087 $_ =~ s/\/\/\!/\/\*\*/; 00088 } else { 00089 // Some line in the middle of a comment block. 00090 $comment_count++; 00091 // ## 00092 // Changed to have middle stuff with no asterix. 00093 // $_ =~ s/\/\/\!/ \*\*/; 00094 // ## 00095 $_ =~ s/\/\/\!//; 00096 } 00097 } elsif ($comment_count > 0){ 00098 // We were in a comment block; need to terminate it. 00099 $comment_count = 0; 00100 $_ = " \*\*\/\n" . $_ ; 00101 } 00102 // ######## End Comment style change. 00103 00104 00105 00106 // ######## 00107 // Fixing class definitions 00108 // ######## 00109 if (/^\s*_CLASSDEF\s*\(\s*([a-zA-Z0-9_]+)\s*\)/) { 00110 // print "class $1;"; 00111 // print "typedef $1 *p$1;"; 00112 // print "typedef $1 &r$1;"; 00113 // print "typedef $1 *&rp$1;"; 00114 // print "typedef const $1 *pc$1;"; 00115 // print "typedef const $1 &rc$1;\n"; 00116 next NEW_LINE; 00117 } 00118 if (/^\s*_TYPEDEF\s*\(\s*([a-zA-Z0-9_]+)\s*\)/) { 00119 // print "typedef $1 *p$1;"; 00120 // print "typedef $1 &r$1;"; 00121 // print "typedef $1 *&rp$1;"; 00122 // print "typedef const $1 *pc$1;"; 00123 // print "typedef const $1 &rc$1;\n"; 00124 next NEW_LINE; 00125 } 00126 00127 // ######## 00128 // Rearrangement of the inline //! comments such 00129 // that those comments appear on a line before their 00130 // code item. 00131 // ######## 00132 if (/\/\/\!/) { 00133 @line_chunk = split (/\/\/\!/, $_, 2); 00134 // print "\/\/\! $line_chunk[1]"; 00135 // print "$line_chunk[0]\n"; 00136 next NEW_LINE; 00137 } 00138 00139 00140 // ######## 00141 // Begin replacement of @lim or @lim to @lim 00142 // ######## 00143 if (/\@lim|\@lim/) { 00144 $_ =~ s/\@lim/\@lim/; 00145 $_ =~ s/\@lim/\@lim/; 00146 // print $_; 00147 next NEW_LINE; 00148 } 00149 00150 // ######## 00151 // Default Fall through 00152 // ######## 00153 // print $_; 00154 00155 } 00156 00157 00158 00159 00160 00161 00162 00163
|
|
|
Open-Source tools compliments of Voyant Technologies, Inc. and Glenn C. Maxey.
01/13/2003
TP Tools v2-00-0a
# tpt-perl-hcr-02