summaryrefslogtreecommitdiff
path: root/lib/sbin/c_file_processor.pl
diff options
context:
space:
mode:
authortradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-12-30 15:22:38 +0000
committertradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-12-30 15:22:38 +0000
commit16618fb888bb9181bd2921a2b1998e407d97e1ed (patch)
tree2937ddb91f6d9aabf6ecf1c5a3f0861dc719c5a1 /lib/sbin/c_file_processor.pl
parent2ea181b307e500e8b243d51bf1de29e94baf6973 (diff)
Skip one-line comments before parsing the source code for DECLARE_CCTK_* macros.
This closes PR Cactus-867. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2549 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/c_file_processor.pl')
-rw-r--r--lib/sbin/c_file_processor.pl19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/sbin/c_file_processor.pl b/lib/sbin/c_file_processor.pl
index c2602f7d..c182573a 100644
--- a/lib/sbin/c_file_processor.pl
+++ b/lib/sbin/c_file_processor.pl
@@ -16,6 +16,7 @@
# "CCTK_NO_AUTOUSE_MACRO" somewhere at the top (within a comment).
# Everything after will not be matched.
# @enddesc
+# @version $Header$
#@@*/
$home = shift(@ARGV);
@@ -64,6 +65,12 @@ while(<>)
{
$routine.=$mline."\n";
+ # skip one-line comments
+ # (note that this is still incomplete for C comments -
+ # it is not checked if some code follows after the closing '*/')
+ next if ($mline=~m/^\s*\/\//);
+ next if ($mline=~m/^\s*\/\*.*\*\//);
+
if ($mline=~/$skipstring/)
{
$skip = 1;
@@ -89,7 +96,7 @@ while(<>)
$n_arg_braces--;
}
while ($mline=~m/({)/g) {
- $n_arg_braces++;
+ $n_arg_braces++;
}
}
@@ -99,15 +106,15 @@ while(<>)
if ($domacro1) {
if (!($routine=~s/([ \t\f]*)(return\s*\S*\s*}\s*)$/$1$addmacro1; $1$2/s))
{
- ($routine=~s/(}\s*$)/ $addmacro1; $1/s)
- }
+ ($routine=~s/(}\s*$)/ $addmacro1; $1/s)
+ }
$domacro1=0;
}
## Start adding second macro
if ($domacro2) {
- if (!($routine=~s/([ \t\f]*)(return\s*\S*\s*}\s*)$/$1$addmacro2 $1$2/s))
- {
- ($routine=~s/(}\s*$)/ $addmacro2 $1/s)
+ if (!($routine=~s/([ \t\f]*)(return\s*\S*\s*}\s*)$/$1$addmacro2 $1$2/s))
+ {
+ ($routine=~s/(}\s*$)/ $addmacro2 $1/s)
}
$domacro2=0;
}