Permalink
Browse files

[GH #913] Handle windows backslashes in ops2c h guard generator

rurban/win-replace_slashes-gh891 for #891 enabled windows paths, handle them in ops2c also.
Thanks to Mark Solinski. msvc tests passed.
  • Loading branch information...
1 parent 9bfd9dd commit 6a6dc5e4e2d8a2524e93987c3535b51deabd5c59 Reini Urban committed Jan 5, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 compilers/opsc/src/Ops/Emitter.pm
@@ -1,5 +1,5 @@
#! nqp
-# Copyright (C) 2010-2012, Parrot Foundation.
+# Copyright (C) 2010-2013, Parrot Foundation.
class Ops::Emitter is Hash;
@@ -9,6 +9,8 @@ Emitter.
=end
+pir::load_bytecode('config.pbc');
+
method new(:$ops_file!, :$trans!, :$script!, :$file, :%flags!) {
self<ops_file> := $ops_file;
self<trans> := $trans;
@@ -309,6 +311,11 @@ $load_func(PARROT_INTERP)
# returns a string like "PARROT_OPLIB_CORE_OPS_H_GUARD"
method _generate_guard_macro_name($filename) {
$filename := subst($filename, /.h$/, '');
+ my $config := _config();
+ my $osname := $config<osname>;
+ if ($osname eq 'MSWin32') {
+ $filename := subst($filename, /\\/, '/', :global);
+ }
#my @path = File::Spec->splitdir($filename);
my @path := split('/', $filename);
@path.shift if @path[0]~'/' eq self<flags><dir>;

0 comments on commit 6a6dc5e

Please sign in to comment.