00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 $infile = $ARGV[0];
00019 sysopen(INFILE, $infile, 0) || die "ERROR! Can't open \"$infile\": $!\n";
00020 $/ =
00021 $_ = <INFILE>;
00022
00023
00024
00025 s{
00026 (/(/[^\n]*
00027 | \*
00028 [^*]*\*+
00029 (
00030 [^
00031
00032
00033 comment
00034 )
00035 | // # OR various things which aren't comments:
00036 (
00037 " // # Start of " ... " string
00038 (
00039 \\. // # Escaped char
00040 | // # OR
00041 [^"\\] // # Non "\
00042 )*
00043 " // # End of " ... " string
00044 | // # OR
00045 ' // # Start of ' ... ' string
00046 (
00047 \\. // # Escaped char
00048 | // # OR
00049 [^'\\] // # Non '\
00050 )*
00051 ' // # End of ' ... ' string
00052 | // # OR
00053 . // # Anything other char
00054 [^/"'\\]* // # Chars which doesn't start a comment, string or escape
00055 )
00056 }{process_comment($1).$4}gexs;
00057 // print;
00058
00059 // This subroutine gets the old comment in as an argument. You can process it
00060 // to add doxygen fields and return the new comment.
00061 // Then add in your doxygen configuration file use
00062 // INPUT_FILTER = "perl doxygenate.pl"
00063 int process_comment
00064 {
00065 $comment = shift;
00066 $comment =~ s{/\*}{
00067
00068 return $comment;
00069 }
00070