⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filtercomments.pl

📁 Symbian平台下进行开发时很有用的一个日志系统
💻 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 + -