ADded support for multiline defines
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 6 Dec 2004 10:19:47 +0000 (10:19 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 6 Dec 2004 10:19:47 +0000 (10:19 +0000)
[r4566]

tools/remove_cpp_comands.perl

index 56a8c2a..7597720 100644 (file)
@@ -62,6 +62,7 @@ $scndlastline = "";
 $lastline = "";
 
 $eat = 0;
+$multiline = 0;
 
 foreach $line (@lines) {
 
@@ -71,10 +72,22 @@ foreach $line (@lines) {
        $eat = 2;
     } elsif ($eat > 0) {
        $eat = $eat -1;
-    } elsif (($line =~ /^\#/)   ) {
+    } elsif ($multiline > 0) {
+        # this line connects a previous one, kill it
+        if ($line =~ /\\$/) {
+          $multiline = 1;
+        } else {
+          $multiline = 0;
+        }
+    } elsif ($line =~ /^\#/) {
        # eat the line
        $scndlastline = $lastline;
        $lastline = $line;
+        if ($line =~ /\\$/) {
+          $multiline = 1;
+        } else {
+          $multiline = 0;
+        }
     } elsif ($openbracket == 1) {
        print TDF "$line";
        if ((index($line, "}") > -1)) {