Repository: lucy-charmonizer
Updated Branches:
  refs/heads/master 0b1d7eb68 -> 5a65b5eba


Adjust meld.pl for Windows

Fix newlines and path separators to match UNIX.


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

Branch: refs/heads/master
Commit: 5a65b5ebab84746ceb9259ffbdb50d639293e734
Parents: 0b1d7eb
Author: Nick Wellnhofer <[email protected]>
Authored: Mon Jul 21 13:16:04 2014 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Mon Jul 21 13:16:04 2014 +0200

----------------------------------------------------------------------
 buildbin/meld.pl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/5a65b5eb/buildbin/meld.pl
----------------------------------------------------------------------
diff --git a/buildbin/meld.pl b/buildbin/meld.pl
index 4f84721..5826802 100755
--- a/buildbin/meld.pl
+++ b/buildbin/meld.pl
@@ -125,6 +125,7 @@ if ( -e $outfile ) {
 # Start the composite.
 open( my $out_fh, '>', $outfile )
     or die "Can't open '$outfile': $!";
+binmode $out_fh;
 print $out_fh meld_start();
 
 # Process core files.
@@ -139,7 +140,7 @@ for my $file (@user_files) {
     # 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 line_directive(1, $file);
     print $out_fh $content;
 }
 
@@ -161,7 +162,7 @@ sub pare_charm_file {
     # 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|;
+    $content = line_directive($starting_line, $path) . $content;
 
     # Remove closing C++ guards (if this is a header).
     $content =~ s/^#ifdef __cplusplus.*?#endif\n+//ms;
@@ -182,6 +183,12 @@ sub slurp {
     return do { local $/; <$fh> };
 }
 
+sub line_directive {
+    my ( $lineno, $file ) = @_;
+    $file =~ s'\\'/'g;
+    return qq|#line $lineno "$file"\n|;
+}
+
 sub meld_start {
     return <<END_STUFF;
 /* This is an auto-generated file -- do not edit directly. */

Reply via email to