Index: lib/ExtUtils/ParseXS.pm =================================================================== RCS file: /Users/ken/src/CVS-repository/modules/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm,v retrieving revision 1.4 diff -u -r1.4 ParseXS.pm --- ParseXS.pm 2003/02/05 18:08:46 1.4 +++ ParseXS.pm 2003/02/10 03:18:18 @@ -88,6 +88,7 @@ # other kind of reference, trust them that we can print to it. if (not ref $args{output}) { open my($fh), "> $args{output}" or die "Can't create $args{output}: $!"; + $args{outfile} = $args{output}; $args{output} = $fh; } @@ -100,11 +101,15 @@ $pwd = cwd(); if ($WantLineNumbers) { - my $cfile = $filename; - $cfile =~ s/\.xs$/.c/i or $cfile .= ".c"; + my $cfile; + if ( $args{outfile} ) { + $cfile = $args{outfile}; + } else { + $cfile = $filename; + $cfile =~ s/\.xs$/.c/i or $cfile .= ".c"; + } tie(*PSEUDO_STDOUT, 'ExtUtils::ParseXS::CountLines', $cfile, $args{output}); select PSEUDO_STDOUT; - } else { select $args{output}; } @@ -255,6 +260,13 @@ } die "Didn't find a 'MODULE ... PACKAGE ... PREFIX' line\n" unless defined $_; + print <<"EOF"; +#ifndef PERL_UNUSED_VAR +# define PERL_UNUSED_VAR(var) if (0) var = var +#endif + +EOF + print "$ExtUtils::ParseXS::CountLines::SECTION_END_MARKER\n" if $WantLineNumbers; $lastline = $_; @@ -921,6 +933,8 @@ chdir($orig_cwd); select($orig_fh); + untie *PSEUDO_STDOUT if tied *PSEUDO_STDOUT; + return 1; } @@ -1804,7 +1818,9 @@ print {$self->{fh}} $self->{buffer}; } - +sub UNTIE { + # This sub does nothing, but is neccessary for references to be released. +} Index: lib/ExtUtils/xsubpp =================================================================== RCS file: /Users/ken/src/CVS-repository/modules/ExtUtils-ParseXS/lib/ExtUtils/xsubpp,v retrieving revision 1.1 diff -u -r1.1 xsubpp --- xsubpp 2002/12/08 09:13:35 1.1 +++ xsubpp 2003/02/10 03:56:59 @@ -21,6 +21,7 @@ except! v typemap=s@ + output=s s=s )) or die $usage; @@ -45,7 +46,7 @@ =head1 SYNOPSIS -B [B<-v>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-nooptimize>] [B<-typemap typemap>] ... file.xs +B [B<-v>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-nooptimize>] [B<-typemap typemap>] [B<-output filename>]... file.xs =head1 DESCRIPTION @@ -84,6 +85,11 @@ Indicates that a user-supplied typemap should take precedence over the default typemaps. This option may be used multiple times, with the last typemap having the highest precedence. + +=item B<-output filename> + +Specifies the name of the output file to generate. If no file is +specified, output will be written to standard output. =item B<-v> Index: t/basic.t =================================================================== RCS file: /Users/ken/src/CVS-repository/modules/ExtUtils-ParseXS/t/basic.t,v retrieving revision 1.5 diff -u -r1.5 basic.t --- basic.t 2003/02/05 18:16:38 1.5 +++ basic.t 2003/02/10 03:54:28 @@ -16,6 +16,11 @@ use Carp; $SIG{__WARN__} = \&Carp::cluck; +sub Is_MSVC { return $^O eq 'MSWin32' + && $Config{cc} =~ /cl(\.exe)?$/i + && $Config{ld} =~ /link(\.exe)?$/i +} + ######################### # Try sending to filehandle @@ -31,12 +36,24 @@ if (have_compiler()) { my $corelib = File::Spec->catdir($Config{archlib}, 'CORE'); my $o_file = "XSTest$Config{obj_ext}"; + my $cc_out = Is_MSVC() ? '-Fo' : '-o '; - ok !do_system("$Config{cc} -c $Config{ccflags} -I$corelib -o $o_file XSTest.c"); + ok !do_system("$Config{cc} -c $Config{ccflags} -I$corelib $cc_out$o_file XSTest.c"); ok -e $o_file, 1, "Make sure $o_file exists"; my $lib_file = "XSTest.$Config{dlext}"; - ok !do_system("$Config{shrpenv} $Config{ld} $Config{lddlflags} -o $lib_file $o_file"); + my $ld_out = '-o '; + my $libs = ''; + if ( $^O eq 'MSWin32' ) { + require ExtUtils::Mksymlists; + Mksymlists( 'NAME' => 'XSTest', 'DLBASE' => 'XSTest', 'IMPORTS' => {} ); + + if ( Is_MSVC() ) { + $ld_out = '-OUT:'; + $libs = "$Config{libperl} -def:XSTest.def"; + } + } + ok !do_system("$Config{shrpenv} $Config{ld} $Config{lddlflags} $ld_out$lib_file $o_file $Config{libs} $libs" ); eval {require XSTest}; ok $@, ''; @@ -51,10 +68,15 @@ sub find_in_path { my $thing = shift; - my @path = split ':', $ENV{PATH}; + my @path = split $Config{path_sep}, $ENV{PATH}; + my @exe_ext = $^O eq 'MSWin32' ? + split($Config{path_sep}, $ENV{PATHEXT} || '.com;.exe;.bat') : + (''); foreach (@path) { my $fullpath = File::Spec->catfile($_, $thing); - return $fullpath if -e $fullpath; + foreach my $ext ( @exe_ext ) { + return "$fullpath$ext" if -e "$fullpath$ext"; + } } return; }