提交 5536181c authored 作者: Muhammad Shahzad's avatar Muhammad Shahzad

Added c/c++ comments remover script, will be used in doxygen documentation

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@14939 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 b14e7a57
#!/usr/bin/perl -w
# This scripts removes comments from .c .cpp and .h files
#
# Usage: comments-remover.pl <original-filename> <resultant-filename>
#
# For example,
# comments-remover.pl abc.c /tmp/abc.c
#
# Author: Muhammad Shahzad <shaheryarkh@googlemail.com>
# License: MPL 1.1
# Updated: Sept. 20, 2009.
#
use strict;
use warnings;
my $usage = "Usage: $0 <original-filename> <resultant-filename>\n";
die $usage if @ARGV != 2;
open(SRC, $ARGV[0]);
open(DST, ">".$ARGV[1]);
$/ = undef;
$_ = <SRC>;
s#/\*.*?\*/|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $1 ? $1 : ""#gse;
print DST;
close(SRC);
close(DST);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论