?? filtercomments.pl
字號:
#!/usr/bin/perl -w######################## filterComments## This is an input filter for doxygen that allows cocoon-style# comments to be used. That is, it converts from this style:# # ///# // This is a cocoon-style multi-line# // comment.## to the Qt-style that doxygen supports:## /*!# * This is a Qt-style multi-line# * comment.# */## For this to work as a doxygen input filter (INPUT_FILTER in the# doxygen.config) file, it must read from a file named on the command# line and write to stdout.#######################use strict;use File::Basename;my $Cmd = basename($0);my $usage = <<ENDUSAGE;Usage: $Cmd inputfile > outputfile Input filter for doxygen ENDUSAGE# Make sure there is one argument: the name of the fileif ($#ARGV != 0) { print $usage; exit;}my $incomment = 0;my $commentStart;my $commentEnd;# Note: Or-bars (|) are used as delimiters for the regular expressions# below because there are so many slashes.my $previousline = <>;while (<>) { if ($incomment == 1) { # If we're still inside a multiline comment if (m|^\s*//|) { # If this is the second line of the comment (which we can # tell because $commentStart is not empty), output the # first line of the comment after converting it. if ($commentStart ne "") { $commentStart =~ s|//*|/\*\!|; print $commentStart; $commentStart = ""; } # "//-" is used as a delimiter between external and # internal comments in cocoon. If we hit this delimiter, # end the comment. if ($previousline =~ m|^\s*//\s*-|) { $incomment = 0; print "$commentEnd\n"; } # Lines after the first that start with "//" are replaced # with a "*" else { $previousline =~ s|//*| \*|; } } # We are no longer inside the comment. If there was only one # line, leave it as is. else { if ($commentStart ne "") { print $commentStart; $commentStart = ""; } else { print "$commentEnd"; $previousline = $_; $incomment = 0; next; } $incomment = 0; } } # Check for the start of a comment: "//". If we get one, save it # in $commentStart so we can make sure this is a multiline comment # before modifying anything. if ($previousline =~ m|^\s*//|) { $incomment = 1; $commentStart = $previousline; $commentEnd = $commentStart; $commentEnd =~ s|//.*| */|; } # Output the line else { print $previousline; } $previousline = $_;}# Deal with "//" comment on last lineif ($incomment) { if ($commentStart ne "") { $commentStart =~ s|//*|/\*\!|; print $commentStart; } else { print "$commentEnd\n"; }}print $previousline;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -