lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [8/14] git commit: refs/heads/chaz_namespacing - Add #line directives to Charmonizer meld file.
Date Thu, 01 Nov 2012 23:35:00 GMT
Add #line directives to Charmonizer meld file.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/dd69f40d
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/dd69f40d
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/dd69f40d

Branch: refs/heads/chaz_namespacing
Commit: dd69f40d79a54761cad80c14264f6a4a36e44943
Parents: 2000b57
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Fri Oct 19 18:43:09 2012 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Thu Nov 1 15:24:15 2012 -0700

----------------------------------------------------------------------
 charmonizer/buildbin/meld.pl |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/dd69f40d/charmonizer/buildbin/meld.pl
----------------------------------------------------------------------
diff --git a/charmonizer/buildbin/meld.pl b/charmonizer/buildbin/meld.pl
index ead2dc3..db25eaa 100755
--- a/charmonizer/buildbin/meld.pl
+++ b/charmonizer/buildbin/meld.pl
@@ -127,9 +127,10 @@ for my $file (@charm_files) {
 for my $file (@user_files) {
     my $content = slurp($file);
 
-    # Remove pound-includes for files being inlined.
-    $content =~ s/^#include "Charmonizer[^\n]+\n//msg;
+    # Comment out pound-includes for files being inlined.
+    $content =~ s|^(#include "Charmonizer[^\n]+)\n|/* $1 */\n|msg;
 
+    print $out_fh qq|#line 1 "$file"\n|;
     print $out_fh $content;
 }
 
@@ -139,16 +140,25 @@ exit;
 sub pare_charm_file {
     my $path    = shift;
     my $content = slurp($path);
+    my $num_newlines = $content =~ tr/\n/\n/;
 
     # Strip license header.
     $content =~ s#/\* Licensed to the Apache.+?\*/\n+##s
         or die "Couldn't find ASF license header in '$path'";
 
-    # Remove C++ guards (if this is a header).
-    $content =~ s/^#ifdef __cplusplus.*?#endif\n+//msg;
+    # Remove opening C++ guards (if this is a header).
+    $content =~ s/^#ifdef __cplusplus.*?#endif\n+//ms;
 
-    # Remove pound-includes for files being inlined.
-    $content =~ s/^#include "Charmonizer[^\n]+\n//msg;
+    # Add a #line directive.
+    my $new_num_newlines = $content =~ tr/\n/\n/;
+    my $starting_line = 1 + $num_newlines - $new_num_newlines;
+    $content = qq|#line $starting_line "$path"\n$content|;
+
+    # Remove closing C++ guards (if this is a header).
+    $content =~ s/^#ifdef __cplusplus.*?#endif\n+//ms;
+
+    # Comment out pound-includes for files being inlined.
+    $content =~ s|^(#include "Charmonizer[^\n]+)\n|/* $1 */\n|msg;
 
     return <<END_STUFF;
 /***************************************************************************/


Mime
View raw message