@@ -1705,121 +1705,121 @@ EOF
1705
1705
# ----------------------------------------------------------------
1706
1706
1707
1707
{
1708
- # Depending on whether the XSUB has a prototype, work out how to
1709
- # invoke one of the newXS() function variants. Set these:
1710
- #
1711
- my $newXS ; # the newXS() variant to be called in the boot section
1712
- my $file_arg ; # an extra ', file' arg to be passed to newXS call
1713
- my $proto_arg ; # an extra e.g. ', "$@"' arg to be passed to newXS call
1714
-
1715
- $proto_arg = " " ;
1708
+ # Depending on whether the XSUB has a prototype, work out how to
1709
+ # invoke one of the newXS() function variants. Set these:
1710
+ #
1711
+ my $newXS ; # the newXS() variant to be called in the boot section
1712
+ my $file_arg ; # an extra ', file' arg to be passed to newXS call
1713
+ my $proto_arg ; # an extra e.g. ', "$@"' arg to be passed to newXS call
1716
1714
1717
- unless ($self -> {ProtoThisXSUB }) {
1718
- # no prototype
1719
- $newXS = " newXS_deffile" ;
1720
- $file_arg = " " ;
1721
- }
1722
- else {
1723
- # needs prototype
1724
- $newXS = " newXSproto_portable" ;
1725
- $file_arg = " , file" ;
1715
+ $proto_arg = " " ;
1726
1716
1727
- if ($self -> {ProtoThisXSUB } eq 2) {
1728
- # User has specified an empty prototype
1717
+ unless ($self -> {ProtoThisXSUB }) {
1718
+ # no prototype
1719
+ $newXS = " newXS_deffile" ;
1720
+ $file_arg = " " ;
1729
1721
}
1730
- elsif ($self -> {ProtoThisXSUB } eq 1) {
1731
- # Protoype enabled, but to be auto-generated by us
1732
- my $s = ' ;' ;
1733
- if ($min_arg_count < $args_count ) {
1734
- $s = ' ' ;
1735
- # $self->{proto_arg} was populated during argument / typemap
1736
- # processing. Each element contains the prototype for that arg,
1737
- # typically '$'.
1738
- $self -> {proto_arg }-> [$min_arg_count ] .= " ;" ;
1722
+ else {
1723
+ # needs prototype
1724
+ $newXS = " newXSproto_portable" ;
1725
+ $file_arg = " , file" ;
1726
+
1727
+ if ($self -> {ProtoThisXSUB } eq 2) {
1728
+ # User has specified an empty prototype
1739
1729
}
1740
- push @{ $self -> {proto_arg } }, " $s \@ "
1741
- if $seen_ellipsis ; # '...' was seen in XSUB signature
1730
+ elsif ($self -> {ProtoThisXSUB } eq 1) {
1731
+ # Protoype enabled, but to be auto-generated by us
1732
+ my $s = ' ;' ;
1733
+ if ($min_arg_count < $args_count ) {
1734
+ $s = ' ' ;
1735
+ # $self->{proto_arg} was populated during argument / typemap
1736
+ # processing. Each element contains the prototype for that arg,
1737
+ # typically '$'.
1738
+ $self -> {proto_arg }-> [$min_arg_count ] .= " ;" ;
1739
+ }
1740
+ push @{ $self -> {proto_arg } }, " $s \@ "
1741
+ if $seen_ellipsis ; # '...' was seen in XSUB signature
1742
1742
1743
- $proto_arg = join (" " , grep defined , @{ $self -> {proto_arg } } );
1744
- }
1745
- else {
1746
- # User has manually specified a prototype
1747
- $proto_arg = $self -> {ProtoThisXSUB };
1748
- }
1743
+ $proto_arg = join (" " , grep defined , @{ $self -> {proto_arg } } );
1744
+ }
1745
+ else {
1746
+ # User has manually specified a prototype
1747
+ $proto_arg = $self -> {ProtoThisXSUB };
1748
+ }
1749
1749
1750
- $proto_arg = qq{ , "$proto_arg "} ;
1751
- }
1750
+ $proto_arg = qq{ , "$proto_arg "} ;
1751
+ }
1752
1752
1753
- # Now use those values to append suitable newXS() and other code
1754
- # into @{ $self->{InitFileCode} }, for later insertion into the
1755
- # boot sub.
1753
+ # Now use those values to append suitable newXS() and other code
1754
+ # into @{ $self->{InitFileCode} }, for later insertion into the
1755
+ # boot sub.
1756
1756
1757
- if ($self -> {XsubAliases } and keys %{ $self -> {XsubAliases } }) {
1758
- # For the main XSUB and for each alias name, generate a newXS() call
1759
- # and 'XSANY.any_i32 = ix' line.
1757
+ if ($self -> {XsubAliases } and keys %{ $self -> {XsubAliases } }) {
1758
+ # For the main XSUB and for each alias name, generate a newXS() call
1759
+ # and 'XSANY.any_i32 = ix' line.
1760
1760
1761
- # Make the main name one of the aliases if it isn't already
1762
- $self -> {XsubAliases }-> { $self -> {pname } } = 0
1763
- unless defined $self -> {XsubAliases }-> { $self -> {pname } };
1761
+ # Make the main name one of the aliases if it isn't already
1762
+ $self -> {XsubAliases }-> { $self -> {pname } } = 0
1763
+ unless defined $self -> {XsubAliases }-> { $self -> {pname } };
1764
1764
1765
- foreach my $xname (sort keys %{ $self -> {XsubAliases } }) {
1766
- my $value = $self -> {XsubAliases }{$xname };
1767
- push (@{ $self -> {InitFileCode } }, Q(<<"EOF" ));
1765
+ foreach my $xname (sort keys %{ $self -> {XsubAliases } }) {
1766
+ my $value = $self -> {XsubAliases }{$xname };
1767
+ push (@{ $self -> {InitFileCode } }, Q(<<"EOF" ));
1768
1768
# cv = $newXS (\" $xname \" , XS_$self ->{Full_func_name}$file_arg$proto_arg );
1769
1769
# XSANY.any_i32 = $value ;
1770
1770
EOF
1771
+ }
1771
1772
}
1772
- }
1773
- elsif (@{ $self -> {Attributes } }) {
1774
- # Generate a standard newXS() call, plus a single call to
1775
- # apply_attrs_string() call with the string of attributes.
1776
- push (@{ $self -> {InitFileCode } }, Q(<<"EOF" ));
1773
+ elsif (@{ $self -> {Attributes } }) {
1774
+ # Generate a standard newXS() call, plus a single call to
1775
+ # apply_attrs_string() call with the string of attributes.
1776
+ push (@{ $self -> {InitFileCode } }, Q(<<"EOF" ));
1777
1777
# cv = $newXS (\" $self ->{pname}\" , XS_$self ->{Full_func_name}$file_arg$proto_arg );
1778
1778
# apply_attrs_string("$self ->{Package}", cv, "@{ $self ->{Attributes} }", 0);
1779
1779
EOF
1780
- }
1781
- elsif ($self -> {interface }) {
1782
- # For each interface name, generate both a newXS() and
1783
- # XSINTERFACE_FUNC_SET() call.
1784
- foreach my $yname (sort keys %{ $self -> {Interfaces } }) {
1785
- my $value = $self -> {Interfaces }{$yname };
1786
- $yname = " $self ->{Package}\: :$yname " unless $yname =~ / ::/ ;
1787
- push (@{ $self -> {InitFileCode } }, Q(<<"EOF" ));
1780
+ }
1781
+ elsif ($self -> {interface }) {
1782
+ # For each interface name, generate both a newXS() and
1783
+ # XSINTERFACE_FUNC_SET() call.
1784
+ foreach my $yname (sort keys %{ $self -> {Interfaces } }) {
1785
+ my $value = $self -> {Interfaces }{$yname };
1786
+ $yname = " $self ->{Package}\: :$yname " unless $yname =~ / ::/ ;
1787
+ push (@{ $self -> {InitFileCode } }, Q(<<"EOF" ));
1788
1788
# cv = $newXS (\" $yname \" , XS_$self ->{Full_func_name}$file_arg$proto_arg );
1789
1789
# $self ->{interface_macro_set}(cv,$value );
1790
1790
EOF
1791
+ }
1792
+ }
1793
+ elsif ($newXS eq ' newXS_deffile' ){
1794
+ # Modified default: generate a standard newXS() call; but
1795
+ # work around the CPAN 'P5NCI' distribution doing:
1796
+ # #undef newXS
1797
+ # #define newXS ;
1798
+ # by omitting the initial (void).
1799
+ # XXX DAPM 2024:
1800
+ # this branch was originally: "elsif ($newXS eq 'newXS')"
1801
+ # but when the standard name for the newXS variant changed in
1802
+ # xsubpp, it was changed here too. So this branch no longer actually
1803
+ # handles a workaround for '#define newXS ;'. I also don't
1804
+ # understand how just omitting the '(void)' fixed the problem.
1805
+ push (@{ $self -> {InitFileCode } },
1806
+ " $newXS (\" $self ->{pname}\" , XS_$self ->{Full_func_name}$file_arg$proto_arg );\n " );
1807
+ }
1808
+ else {
1809
+ # Default: generate a standard newXS() call
1810
+ push (@{ $self -> {InitFileCode } },
1811
+ " (void)$newXS (\" $self ->{pname}\" , XS_$self ->{Full_func_name}$file_arg$proto_arg );\n " );
1791
1812
}
1792
- }
1793
- elsif ($newXS eq ' newXS_deffile' ){
1794
- # Modified default: generate a standard newXS() call; but
1795
- # work around the CPAN 'P5NCI' distribution doing:
1796
- # #undef newXS
1797
- # #define newXS ;
1798
- # by omitting the initial (void).
1799
- # XXX DAPM 2024:
1800
- # this branch was originally: "elsif ($newXS eq 'newXS')"
1801
- # but when the standard name for the newXS variant changed in
1802
- # xsubpp, it was changed here too. So this branch no longer actually
1803
- # handles a workaround for '#define newXS ;'. I also don't
1804
- # understand how just omitting the '(void)' fixed the problem.
1805
- push (@{ $self -> {InitFileCode } },
1806
- " $newXS (\" $self ->{pname}\" , XS_$self ->{Full_func_name}$file_arg$proto_arg );\n " );
1807
- }
1808
- else {
1809
- # Default: generate a standard newXS() call
1810
- push (@{ $self -> {InitFileCode } },
1811
- " (void)$newXS (\" $self ->{pname}\" , XS_$self ->{Full_func_name}$file_arg$proto_arg );\n " );
1812
- }
1813
1813
1814
- # For every overload operator, generate an additional newXS()
1815
- # call to add an alias such as "Foo::(<=>" for this XSUB.
1814
+ # For every overload operator, generate an additional newXS()
1815
+ # call to add an alias such as "Foo::(<=>" for this XSUB.
1816
1816
1817
- for my $operator (sort keys %{ $self -> {OverloadsThisXSUB } }) {
1818
- $self -> {Overloaded }-> {$self -> {Package }} = $self -> {Packid };
1819
- my $overload = " $self ->{Package}\: :($operator " ;
1820
- push (@{ $self -> {InitFileCode } },
1821
- " (void)$newXS (\" $overload \" , XS_$self ->{Full_func_name}$file_arg$proto_arg );\n " );
1822
- }
1817
+ for my $operator (sort keys %{ $self -> {OverloadsThisXSUB } }) {
1818
+ $self -> {Overloaded }-> {$self -> {Package }} = $self -> {Packid };
1819
+ my $overload = " $self ->{Package}\: :($operator " ;
1820
+ push (@{ $self -> {InitFileCode } },
1821
+ " (void)$newXS (\" $overload \" , XS_$self ->{Full_func_name}$file_arg$proto_arg );\n " );
1822
+ }
1823
1823
1824
1824
}
1825
1825
0 commit comments