Contents 
 Index 
 "Perl Program Reference" 
 < Previous 
 Next > 

dox_vxworks_filter.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 /** @file
00020  ** @brief Input filter for Doxygen for most VxWorks 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. 
00024  ** 
00025  **
00026  ** @param Input source file.
00027  ** @return Output is file with changes.
00028  **
00029  ** @ingroup tp_tools tp_dox
00030  **
00031  ** @author Glenn C. Maxey
00032  **/
00033 // #
00034 //// $Id: dox_vxworks_filter.pl,v 1.1 2002/02/16 00:59:40 gmaxe Exp $
00035 ////
00036 //// 2002 Created by Voyant Technologies, Inc., Westminster, Colorado, USA.
00037 ////
00038 //// Permission to use, copy, modify, and distribute this software and its 
00039 //// documentation under the terms of the GNU General Public License is hereby 
00040 //// granted. No representations are made about the suitability of this software 
00041 //// for any purpose. It is provided "as is" without express or implied warranty. 
00042 //// See the GNU General Public License (http://www.gnu.org/copyleft/gpl.html) 
00043 //// for more details.
00044 //// 
00045 //// Documents produced by this script are derivative works derived from the 
00046 //// input used in their production; they are not affected by this license.
00047 ////
00048 //// $Log: dox_vxworks_filter.pl,v $
00049 //// Revision 1.1  2002/02/16 00:59:40  gmaxe
00050 //// Added support for script files needed for TOC applet.
00051 ////
00052 ////
00053 /////////////////////////////////////////////////////////////////////////////////
00054 
00055 BEGIN {
00056    #define $comment_tot_count  0  //  total number of comments.
00057    #define $comment_count  0  //  count if you're in the comments somewhere.
00058    #define $period_count  0  //  count of number of periods in brief statement.
00059 }
00060 
00061 NEW_LINE: while (<>) {
00062 
00063    // ######## 
00064    //  Begin replacement of //! comments with /** ... **/ comments
00065 //    //  This purposely does not do NEW_LINE or printing.
00066    // ######## 
00067    if ((/^\/\*\*\*/) && (!/\*\//)) {
00068       //  if first comment has lots of asterix
00069       if ($comment_count == 0){
00070          //  first line of a comment block
00071          $comment_count++;
00072 //          print "\/\*\*\n";
00073          if ($comment_tot_count == 0){
00074             $comment_tot_count++;
00075 //             print "\@file\n";
00076 //             //  print "\@brief ";
00077          } else {
00078 //             print "\@brief ";
00079          }
00080          next NEW_LINE;
00081       }
00082    } elsif ((/^\/\*[\s]*/) && (!/\*\//)) {
00083       //  if first comment is standard
00084       if ($comment_count == 0){
00085          //  first line of a comment block
00086          $comment_count++;
00087 //          print "\/\*\*\n";
00088          if ($comment_tot_count == 0){
00089             $comment_tot_count++;
00090 //             print "\@file\n";
00091 //             //  print "\@brief ";
00092          } else {
00093 //             print "\@brief ";
00094          }
00095          next NEW_LINE;
00096       }
00097    } elsif (!(/\*\//) && ($comment_count > 0)){
00098       //  We were in a comment block; 
00099       $comment_count++;
00100       $_ =~ s/^[\s]*[\*][\s]+//g;
00101       $_ =~ s/^[\s]*[\*\*][\s]+//g;
00102       $_ =~ s/^[\s]*[\*\*]//g;
00103       if (($_ !~ /[\w]+/) && ($comment_count < 3)){
00104          //  if the line is empty now and we're still near beginning
00105          //  of comment block, remove it
00106          next NEW_LINE;
00107       }
00108       if ((0) && ($_ =~ /\./) && ($period_count == 0)){
00109          //  add a carriage return
00110          $_ =~ s/\./\.\n\n/;
00111          $period_count++;
00112       }
00113       $_ =~ s/Abstract\:/\@brief/;
00114       $_ =~ s/Authors\:/\@author/;
00115       $_ =~ s/Caveats\:[\s]*/\@lim /;
00116       $_ =~ s/Argument\(s\)\:/\@param/;
00117       $_ =~ s/Return Value\(s\)\:/\@retval/;
00118       $_ =~ s/RETURNS\:/\@return/;
00119       $_ =~ s/SEE ALSO\:/\@sa/;
00120       if ($comment_count == 3){
00121          $comment_count++;
00122 //          print "$_\.\n\n";
00123          next NEW_LINE;
00124       } 
00125       
00126    } elsif ((/\*\//) && ($comment_count > 0)){
00127       //  We were in a comment block; need to terminate it.
00128       $comment_count = 0;
00129       $period_count = 0;
00130 //       print "\@ingroup vxworks\n";
00131    
00132    }
00133    // ######## End Comment style change.
00134     
00135 
00136 
00137    // ######## 
00138    //  Begin replacement of @lim or @lim to @lim
00139    // ######## 
00140    if (/\@lim|\@lim/) {
00141       $_ =~ s/\@lim/\@lim/;
00142       $_ =~ s/\@lim/\@lim/;
00143 //       print $_;
00144       next NEW_LINE;
00145    } 
00146    
00147    // ######## 
00148    //  Default Fall through
00149    // ######## 
00150 //    print $_;
00151 
00152 }  
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 


 "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