dougm 01/11/06 19:14:54
Modified: lib/Apache ParseSource.pm
lib/ModPerl TypeMap.pm WrapXS.pm
src/modules/perl modperl_perl_includes.h
Log:
add logic so we can avoid dTHX; usage in modperl-only functions that have a pTHX_
Revision Changes Path
1.32 +7 -2 modperl-2.0/lib/Apache/ParseSource.pm
Index: ParseSource.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/ParseSource.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- ParseSource.pm 2001/10/21 05:04:27 1.31
+++ ParseSource.pm 2001/11/07 03:14:54 1.32
@@ -2,7 +2,7 @@
use strict;
use Apache::Build ();
-use Config ();
+use Config;
our $VERSION = '0.02';
@@ -60,7 +60,12 @@
my $c = C::Scan->new(filename => $self->{scan_filename});
$c->set(includeDirs => $self->includes);
- $c->set(Defines => '-DCORE_PRIVATE -DMP_SOURCE_SCAN');
+
+ my $defines = '-DCORE_PRIVATE -DMP_SOURCE_SCAN';
+ unless ($Config{useithreads} and $Config{useithreads} eq 'define') {
+ $defines .= ' -DMP_SOURCE_SCAN_NEED_ITHREADS';
+ }
+ $c->set(Defines => $defines);
bless $c, 'Apache::ParseSource::Scan';
}
1.12 +18 -0 modperl-2.0/lib/ModPerl/TypeMap.pm
Index: TypeMap.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/TypeMap.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TypeMap.pm 2001/10/07 19:22:49 1.11
+++ TypeMap.pm 2001/11/07 03:14:54 1.12
@@ -194,12 +194,29 @@
return [ map $self->map_arg($_), @$args ]
}
+#this is needed for modperl-only functions
+#unlike apache/apr functions which are remapped to a mpxs_ function
+sub thx_fixup {
+ my($self, $func) = @_;
+
+ my $first = $func->{args}->[0];
+
+ return unless $first;
+
+ if ($first->{type} =~ /^PerlInterpreter/) {
+ shift @{ $func->{args} };
+ $func->{thx} = 1;
+ }
+}
+
sub map_function {
my($self, $func) = @_;
my $map = $self->function_map->{ $func->{name} };
return unless $map;
+ $self->thx_fixup($func);
+
return unless $self->can_map($map, $func->{return_type},
map $_->{type}, @{ $func->{args} });
my $mf = {
@@ -208,6 +225,7 @@
$func->{return_type} || 'void'),
args => $self->map_args($func),
perl_name => $map->{name},
+ thx => $func->{thx},
};
for (qw(dispatch argspec orig_args prefix)) {
1.34 +2 -2 modperl-2.0/lib/ModPerl/WrapXS.pm
Index: WrapXS.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- WrapXS.pm 2001/10/22 17:20:11 1.33
+++ WrapXS.pm 2001/11/07 03:14:54 1.34
@@ -113,8 +113,8 @@
$attrs
EOF
- if ($dispatch || $orig_args) {
- my $thx = "";
+ if ($dispatch || $orig_args || $func->{thx}) {
+ my $thx = $func->{thx} ? 'aTHX_ ' : "";
if ($dispatch) {
$thx = 'aTHX_ ' if $dispatch =~ /^mpxs_/i;
1.8 +5 -0 modperl-2.0/src/modules/perl/modperl_perl_includes.h
Index: modperl_perl_includes.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl_includes.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- modperl_perl_includes.h 2001/10/21 22:11:34 1.7
+++ modperl_perl_includes.h 2001/11/07 03:14:54 1.8
@@ -24,6 +24,11 @@
*/
# undef __attribute__
# define __attribute__(arg)
+
+# ifdef MP_SOURCE_SCAN_NEED_ITHREADS
+/* just need to have pTHX_ defined for proper prototypes */
+# define USE_ITHREADS
+# endif
#endif
#include "EXTERN.h"