perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angus Lees <...@debian.org>
Subject ExtUtils::XSBuilder patches
Date Sun, 16 Mar 2003 06:25:48 GMT

some patches accumulated in packaging and using ExtUtils::XSBuilder:

make pod2man happier:

--- libextutils-xsbuilder-perl-0.23.orig/XSBuilder.pod
+++ libextutils-xsbuilder-perl-0.23/XSBuilder.pod
@@ -1,6 +1,8 @@
+=head1 NAME
 
+ExtUtils::XSBuilder - Automatic XS glue code generation
 
-=head1 Basics
+=head1 DESCRIPTION
 
 ExtUtils::XSBuilder is a set modules to parse C header files and create XS
 glue code and documentation out of it. Idealy this allows to "write" an



CHAR/U_CHAR (_types.map) null_type.

extra parentheses around mg_find to avoid "Assignment used as
comparison" gcc warning.

explicit $type casts to avoid compiler warning when (eg) using SVPTR
for coderefs (CV*).

--- libextutils-xsbuilder-perl-0.23.orig/XSBuilder/TypeMap.pm
+++ libextutils-xsbuilder-perl-0.23/XSBuilder/TypeMap.pm
@@ -165,6 +165,9 @@
     if ($class =~ /^[INU]V/) {
         return '0';
     }
+    elsif ($class =~ /^(U_)?CHAR$/) {
+        return '0'; # xsubpp seems to mangle q{'\0'}
+    }
     else {
         return 'NULL';
     }
@@ -795,7 +798,7 @@
             'INPUT' =>
 q[    {
     MAGIC * mg ;
-    if (mg = mg_find (SvRV($arg), '~'))
+    if ((mg = mg_find (SvRV($arg), '~')))
         $var = *(($type *)(mg -> mg_ptr)) ;
     else
         croak (\"$var is not of type $type\") ;
@@ -846,17 +849,17 @@
         'T_AVREF' => 
             {
             'OUTPUT' => '        $arg = SvREFCNT_inc (epxs_AVREF_2obj($var));',
-            'INPUT'  => '        $var = epxs_sv2_AVREF($arg)',
+            'INPUT'  => '        $var = ($type) epxs_sv2_AVREF($arg)',
             },
         'T_HVREF' => 
             {
             'OUTPUT' => '        $arg = SvREFCNT_inc (epxs_HVREF_2obj($var));',
-            'INPUT'  => '        $var = epxs_sv2_HVREF($arg)',
+            'INPUT'  => '        $var = ($type) epxs_sv2_HVREF($arg)',
             },
         'T_SVPTR' => 
             {
             'OUTPUT' => '        $arg = SvREFCNT_inc (epxs_SVPTR_2obj($var));',
-            'INPUT'  => '        $var = epxs_sv2_SVPTR($arg)',
+            'INPUT'  => '        $var = ($type) epxs_sv2_SVPTR($arg)',
             },
         },
     }


retargs values are never passed to perl functions directly, so should
use the C type, not the mapped perl class (avoids several compiler
warnings where the types don't quite match. eg int <-> IV).  Also note
that TypeMap->map_args has stripped a trailing * from
pointer-to-pointer types:

--- libextutils-xsbuilder-perl-0.23.orig/XSBuilder/WrapXS.pm
+++ libextutils-xsbuilder-perl-0.23/XSBuilder/WrapXS.pm
@@ -549,7 +549,8 @@
       $name =~ /^DESTROY$/ ? 'void' : $func->{return_type};
 
     my $retdecl = @$retargs?(join "\n",
-      (map { my $type = $self -> cname($_->{class}) ; $type =~ s/\*$//; '    ' . $type
. " $_->{name};"} @$retargs), 
+      # TypeMap->map_args has already stripped a * from retargs
+      (map { my $type = $_->{rtype} ; $type =~ s/^const\s+//; '    ' . $type . " $_->{name};"}
@$retargs), 
       #'    ' . $self -> cname($return_type) . ' RETVAL',
       ''):'';
 

-- 
 - Gus

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message