@@ -314,10 +314,6 @@ BEGIN {
314
314
' xsub_func_full_perl_name' , # its full Perl function name eg. 'Foo::Bar::f'
315
315
' xsub_func_full_C_name' , # its full C function name eg 'Foo__Bar__f'
316
316
317
- ' xsub_map_argname_to_type' , # Hash: map argument names to types, such as
318
- # 'int *'. Names include special ones like
319
- # 'RETVAL'.
320
-
321
317
' xsub_CASE_condition' , # Most recent CASE string.
322
318
323
319
' xsub_CASE_condition_count' , # number of CASE keywords encountered.
711
707
712
708
# Initialize some per-XSUB instance variables:
713
709
714
- foreach my $member (qw( xsub_map_argname_to_type
710
+ foreach my $member (qw(
715
711
xsub_map_varname_to_seen_in_INPUT
716
712
) )
717
713
{
@@ -1336,7 +1332,6 @@ EOF
1336
1332
# Emit the RETVAL variable declaration.
1337
1333
print " \t " . $self -> map_type($self -> {xsub_return_type }, ' RETVAL' ) . " ;\n "
1338
1334
if !$self -> {xsub_seen_RETVAL_in_INPUT };
1339
- $self -> {xsub_map_argname_to_type }-> {" RETVAL" } = $self -> {xsub_return_type };
1340
1335
1341
1336
# If it looks like the output typemap code can be hacked to
1342
1337
# use a TARG to optimise returning the value (rather than
@@ -1539,7 +1534,6 @@ EOF
1539
1534
{
1540
1535
my $var = $param -> {var };
1541
1536
$self -> generate_output( {
1542
- type => $self -> {xsub_map_argname_to_type }-> {$var },
1543
1537
num => $param -> {arg_num },
1544
1538
var => $var ,
1545
1539
do_setmagic => $self -> {xsub_SETMAGIC_state },
@@ -1639,7 +1633,6 @@ EOF
1639
1633
else {
1640
1634
# Emit a normal RETVAL
1641
1635
$self -> generate_output( {
1642
- type => $self -> {xsub_return_type },
1643
1636
num => 0,
1644
1637
var => ' RETVAL' ,
1645
1638
do_setmagic => 0, # RETVAL almost never needs SvSETMAGIC()
@@ -1662,7 +1655,6 @@ EOF
1662
1655
my $var = $param -> {var };
1663
1656
$self -> generate_output(
1664
1657
{
1665
- type => $self -> {xsub_map_argname_to_type }-> {$var },
1666
1658
num => $num ++,
1667
1659
var => $var ,
1668
1660
do_setmagic => 0,
@@ -2522,10 +2514,6 @@ sub OUTPUT_handler {
2522
2514
next ;
2523
2515
}
2524
2516
2525
- $self -> blurt(" Error: No input definition for OUTPUT argument '$outarg ' - ignored" ), next
2526
- unless defined $self -> {xsub_map_argname_to_type }-> {$outarg };
2527
-
2528
-
2529
2517
# Emit the custom var-setter code if present; else use the one from
2530
2518
# the OUTPUT typemap.
2531
2519
@@ -2536,7 +2524,6 @@ sub OUTPUT_handler {
2536
2524
}
2537
2525
else {
2538
2526
$self -> generate_output( {
2539
- type => $self -> {xsub_map_argname_to_type }-> {$outarg },
2540
2527
num => $var_num ,
2541
2528
var => $outarg ,
2542
2529
do_setmagic => $self -> {xsub_SETMAGIC_state },
@@ -3473,7 +3460,6 @@ sub fetch_para {
3473
3460
3474
3461
# $self->generate_output({ key = value, ... })
3475
3462
#
3476
- # type 'char *' etc
3477
3463
# num the parameter number, corresponds to ST(num-1)
3478
3464
# var the parameter name, such as 'RETVAL'
3479
3465
# do_setmagic whether to call set magic after assignment
@@ -3517,8 +3503,28 @@ sub fetch_para {
3517
3503
sub generate_output {
3518
3504
my ExtUtils::ParseXS $self = shift ;
3519
3505
my $argsref = shift ;
3520
- my ($type , $num , $var , $do_setmagic , $do_push )
3521
- = @{$argsref }{qw( type num var do_setmagic do_push) };
3506
+ my ($num , $var , $do_setmagic , $do_push )
3507
+ = @{$argsref }{qw( num var do_setmagic do_push) };
3508
+
3509
+ # Determine type - this is usually from the 'type' field of the
3510
+ # associated param object in the Sig object, but with special cases.
3511
+ my $type ;
3512
+ if ($var eq ' RETVAL' ) {
3513
+ $type = $self -> {xsub_return_type };
3514
+ }
3515
+ else {
3516
+ my $sig = $self -> {xsub_sig };
3517
+ my $param = $sig -> {names }{$var };
3518
+ if ($param ) {
3519
+ $type = $param -> {type };
3520
+ $type = $param -> {soft_type } unless defined $type ;
3521
+ }
3522
+ }
3523
+
3524
+ unless (defined $type ) {
3525
+ $self -> blurt(" Can't determine output type for '$var '" );
3526
+ next ;
3527
+ }
3522
3528
3523
3529
my $arg = $self -> ST($num , 1);
3524
3530
0 commit comments