diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2005-04-18 16:18:30 +0300 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-04-21 15:38:30 +0000 |
commit | 27da23d53ccce622bc51822f59df8def79b4df95 (patch) | |
tree | 1202440e0fbf7a2fc1bb54993d11cda7b245f1b4 /lib/ExtUtils | |
parent | ec0624293b57ae07d6b2c32bae099d4f163e7e07 (diff) | |
download | perl-27da23d53ccce622bc51822f59df8def79b4df95.tar.gz |
Symbian port of Perl
Message-ID: <B356D8F434D20B40A8CEDAEC305A1F2453D653@esebe105.NOE.Nokia.com>
p4raw-id: //depot/perl@24271
Diffstat (limited to 'lib/ExtUtils')
-rw-r--r-- | lib/ExtUtils/t/Embed.t | 18 | ||||
-rwxr-xr-x | lib/ExtUtils/xsubpp | 21 |
2 files changed, 34 insertions, 5 deletions
diff --git a/lib/ExtUtils/t/Embed.t b/lib/ExtUtils/t/Embed.t index fc0ed3cbc1..1c82cd9ae0 100644 --- a/lib/ExtUtils/t/Embed.t +++ b/lib/ExtUtils/t/Embed.t @@ -153,10 +153,22 @@ __END__ static char *cmds[] = { "perl","-e", "$|=1; print qq[ok 5\\n]", NULL }; +#ifdef PERL_GLOBAL_STRUCT_PRIVATE +static struct perl_vars *my_plvarsp; +struct perl_vars* Perl_GetVarsPrivate(void) { return my_plvarsp; } +#endif + int main(int argc, char **argv, char **env) { PerlInterpreter *my_perl; - +#ifdef PERL_GLOBAL_STRUCT + dVAR; + struct perl_vars *plvarsp = init_global_struct(); +# ifdef PERL_GLOBAL_STRUCT_PRIVATE + my_vars = my_plvarsp = plvarsp; +# endif +#endif /* PERL_GLOBAL_STRUCT */ + PERL_SYS_INIT3(&argc,&argv,&env); my_perl = perl_alloc(); @@ -183,6 +195,10 @@ int main(int argc, char **argv, char **env) perl_free(my_perl); +#ifdef PERL_GLOBAL_STRUCT + free_global_struct(plvarsp); +#endif /* PERL_GLOBAL_STRUCT */ + my_puts("ok 8"); PERL_SYS_TERM(); diff --git a/lib/ExtUtils/xsubpp b/lib/ExtUtils/xsubpp index 7ae8020e25..9be40e64ec 100755 --- a/lib/ExtUtils/xsubpp +++ b/lib/ExtUtils/xsubpp @@ -6,7 +6,7 @@ xsubpp - compiler to convert Perl XS code into C code =head1 SYNOPSIS -B<xsubpp> [B<-v>] [B<-C++>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-nooptimize>] [B<-typemap typemap>] ... file.xs +B<xsubpp> [B<-v>] [B<-C++>] [B<-csuffix csuffix>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-nooptimize>] [B<-typemap typemap>] ... file.xs =head1 DESCRIPTION @@ -34,6 +34,12 @@ any makefiles generated by MakeMaker. Adds ``extern "C"'' to the C code. +=item B<-csuffix csuffix> + +Set the suffix used for the generated C or C++ code. Defaults to '.c' +(even with B<-C++>), but some platforms might want to have e.g. '.cpp'. +Don't forget the '.' from the front. + =item B<-hiertype> Retains '::' in type names so that C++ hierachical types can be mapped. @@ -126,7 +132,7 @@ if ($^O eq 'VMS') { $FH = 'File0000' ; -$usage = "Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck] [-nolinenumbers] [-nooptimize] [-noinout] [-noargtypes] [-s pattern] [-typemap typemap]... file.xs\n"; +$usage = "Usage: xsubpp [-v] [-C++] [-csuffix csuffix] [-except] [-prototypes] [-noversioncheck] [-nolinenumbers] [-nooptimize] [-noinout] [-noargtypes] [-s pattern] [-typemap typemap]... file.xs\n"; $proto_re = "[" . quotemeta('\$%&*@;[]') . "]" ; @@ -141,12 +147,14 @@ $Fallback = 'PL_sv_undef'; my $process_inout = 1; my $process_argtypes = 1; +my $csuffix = '.c'; SWITCH: while (@ARGV and $ARGV[0] =~ /^-./) { $flag = shift @ARGV; $flag =~ s/^-// ; $spat = quotemeta shift, next SWITCH if $flag eq 's'; $cplusplus = 1, next SWITCH if $flag eq 'C++'; + $csuffix = shift, next SWITCH if $flag eq 'csuffix'; $hiertype = 1, next SWITCH if $flag eq 'hiertype'; $WantPrototypes = 0, next SWITCH if $flag eq 'noprototypes'; $WantPrototypes = 1, next SWITCH if $flag eq 'prototypes'; @@ -357,7 +365,7 @@ if ($WantLineNumbers) { } my $cfile = $filename; - $cfile =~ s/\.xs$/.c/i or $cfile .= ".c"; + $cfile =~ s/\.xs$/$csuffix/i or $cfile .= $csuffix; tie(*PSEUDO_STDOUT, 'xsubpp::counter', $cfile); select PSEUDO_STDOUT; } @@ -1059,6 +1067,7 @@ while (fetch_para()) { undef(%var_types); undef(%defaults); undef($class); + undef($externC); undef($static); undef($elipsis); undef($wantRETVAL) ; @@ -1112,7 +1121,8 @@ while (fetch_para()) { blurt ("Error: Function definition too short '$ret_type'"), next PARAGRAPH unless @line ; - $static = 1 if $ret_type =~ s/^static\s+//; + $externC = 1 if $ret_type =~ s/^extern "C"\s+//; + $static = 1 if $ret_type =~ s/^static\s+//; $func_header = shift(@line); blurt ("Error: Cannot parse function definition from '$func_header'"), next PARAGRAPH @@ -1251,8 +1261,11 @@ while (fetch_para()) { $xsreturn = 1 if $EXPLICIT_RETURN; + $externC = $externC ? qq[extern "C"] : ""; + # print function header print Q<<"EOF"; +#$externC #XS(XS_${Full_func_name}); /* prototype to pass -Wmissing-prototypes */ #XS(XS_${Full_func_name}) #[[ |