881
881
# Split $self->{xsub_sub}{sig_text} into parameters, parse them,
882
882
# and store them as Node::Param objects within the Node::Sig object.
883
883
884
- $self -> parse_sig( );
884
+ $sig -> parse( $self );
885
885
886
886
# ----------------------------------------------------------------
887
887
# Peek ahead into the body of the XSUB looking for various conditions
@@ -1894,13 +1894,13 @@ EOF
1894
1894
#
1895
1895
# ----------------------------------------------------------------
1896
1896
1897
- sub parse_sig {
1898
- my ExtUtils::ParseXS $self = shift ;
1899
- my ExtUtils::ParseXS::Node::Sig $sig = $self -> { xsub_sig } ;
1897
+ sub ExtUtils ::ParseXS::Node::Sig::parse {
1898
+ my ExtUtils::ParseXS::Node::Sig $self = shift ;
1899
+ my ExtUtils::ParseXS $pxs = shift ;
1900
1900
1901
1901
# remove line continuation chars (\)
1902
- $sig -> {sig_text } =~ s /\\\s */ / g ;
1903
- my $sig_text = $sig -> {sig_text };
1902
+ $self -> {sig_text } =~ s /\\\s */ / g ;
1903
+ my $sig_text = $self -> {sig_text };
1904
1904
1905
1905
my @args ;
1906
1906
my $optional_args_count = 0;# how many default params seen
@@ -1926,7 +1926,7 @@ sub parse_sig {
1926
1926
# regex doesn't work. This code path should ideally never be
1927
1927
# reached, and indicates a design weakness in $C_arg.
1928
1928
@args = split (/ \s *,\s */ , $sig_text );
1929
- Warn( $self , " Warning: cannot parse argument list '$sig_text ', fallback to split" );
1929
+ Warn($pxs , " Warning: cannot parse argument list '$sig_text ', fallback to split" );
1930
1930
}
1931
1931
}
1932
1932
else {
@@ -1935,11 +1935,11 @@ sub parse_sig {
1935
1935
1936
1936
# C++ methods get a fake object/class arg at the start.
1937
1937
# This affects arg numbering.
1938
- if (defined ($self -> {xsub_class })) {
1938
+ if (defined ($pxs -> {xsub_class })) {
1939
1939
my ($var , $type ) =
1940
- ($self -> {xsub_seen_static } or $self -> {xsub_func_name } eq ' new' )
1940
+ ($pxs -> {xsub_seen_static } or $pxs -> {xsub_func_name } eq ' new' )
1941
1941
? (' CLASS' , " char *" )
1942
- : (' THIS' , " $self ->{xsub_class} *" );
1942
+ : (' THIS' , " $pxs ->{xsub_class} *" );
1943
1943
1944
1944
my ExtUtils::ParseXS::Node::Param $param
1945
1945
= ExtUtils::ParseXS::Node::Param-> new( {
@@ -1948,9 +1948,9 @@ sub parse_sig {
1948
1948
is_synthetic => 1,
1949
1949
arg_num => ++$args_count ,
1950
1950
});
1951
- push @{$sig -> {params }}, $param ;
1952
- $sig -> {names }{$var } = $param ;
1953
- $param -> check($self )
1951
+ push @{$self -> {params }}, $param ;
1952
+ $self -> {names }{$var } = $param ;
1953
+ $param -> check($pxs )
1954
1954
}
1955
1955
1956
1956
for (@args ) {
@@ -1960,27 +1960,27 @@ sub parse_sig {
1960
1960
#
1961
1961
# where:
1962
1962
# IN/OUT/OUTLIST etc are only allowed under
1963
- # $self ->{config_allow_inout}
1963
+ # $pxs ->{config_allow_inout}
1964
1964
#
1965
1965
# a C type is only allowed under
1966
- # $self ->{config_allow_argtypes}
1966
+ # $pxs ->{config_allow_argtypes}
1967
1967
#
1968
1968
# foo can be a plain C variable name, or can be
1969
- # length(foo) but only under $self ->{config_allow_argtypes}
1969
+ # length(foo) but only under $pxs ->{config_allow_argtypes}
1970
1970
#
1971
1971
# = default default value - only allowed under
1972
- # $self ->{config_allow_argtypes}
1972
+ # $pxs ->{config_allow_argtypes}
1973
1973
1974
1974
s / ^\s +// ;
1975
1975
s /\s +$// ;
1976
1976
1977
1977
# Process ellipsis (...)
1978
1978
1979
- $self -> blurt(" further XSUB parameter seen after ellipsis (...)" )
1980
- if $sig -> {seen_ellipsis };
1979
+ $pxs -> blurt(" further XSUB parameter seen after ellipsis (...)" )
1980
+ if $self -> {seen_ellipsis };
1981
1981
1982
1982
if ($_ eq ' ...' ) {
1983
- $sig -> {seen_ellipsis } = 1;
1983
+ $self -> {seen_ellipsis } = 1;
1984
1984
next ;
1985
1985
}
1986
1986
@@ -2007,7 +2007,7 @@ sub parse_sig {
2007
2007
/x ;
2008
2008
2009
2009
unless (defined $name ) {
2010
- $self -> blurt(" Unparseable XSUB parameter: '$_ '" );
2010
+ $pxs -> blurt(" Unparseable XSUB parameter: '$_ '" );
2011
2011
next ;
2012
2012
}
2013
2013
@@ -2016,23 +2016,23 @@ sub parse_sig {
2016
2016
var => $name ,
2017
2017
});
2018
2018
2019
- if (exists $sig -> {names }{$name }) {
2020
- $self -> blurt(
2019
+ if (exists $self -> {names }{$name }) {
2020
+ $pxs -> blurt(
2021
2021
" Error: duplicate definition of argument '$name ' ignored" );
2022
2022
next ;
2023
2023
}
2024
2024
2025
- push @{$sig -> {params }}, $param ;
2026
- $sig -> {names }{$name } = $param ;
2025
+ push @{$self -> {params }}, $param ;
2026
+ $self -> {names }{$name } = $param ;
2027
2027
2028
2028
# Process optional IN/OUT etc modifier
2029
2029
2030
2030
if (defined $out_type ) {
2031
- if ($self -> {config_allow_inout }) {
2031
+ if ($pxs -> {config_allow_inout }) {
2032
2032
$out_type = $1 eq ' IN' ? ' ' : $1 ;
2033
2033
}
2034
2034
else {
2035
- $self -> blurt(" parameter IN/OUT modifier not allowed under -noinout" );
2035
+ $pxs -> blurt(" parameter IN/OUT modifier not allowed under -noinout" );
2036
2036
}
2037
2037
}
2038
2038
else {
@@ -2043,8 +2043,8 @@ sub parse_sig {
2043
2043
2044
2044
undef $type unless length ($type ) && $type =~ / \S / ;
2045
2045
2046
- if (defined ($type ) && !$self -> {config_allow_argtypes }) {
2047
- $self -> blurt(" parameter type not allowed under -noargtypes" );
2046
+ if (defined ($type ) && !$pxs -> {config_allow_argtypes }) {
2047
+ $pxs -> blurt(" parameter type not allowed under -noargtypes" );
2048
2048
undef $type ;
2049
2049
}
2050
2050
@@ -2054,16 +2054,16 @@ sub parse_sig {
2054
2054
my $len_name ;
2055
2055
2056
2056
if ($name =~ / ^length\( \s * (\w +) \s * \)\z /x ) {
2057
- if ($self -> {config_allow_argtypes }) {
2057
+ if ($pxs -> {config_allow_argtypes }) {
2058
2058
$len_name = $1 ;
2059
2059
$is_length = 1;
2060
2060
if (defined $default ) {
2061
- $self -> blurt(" Default value not allowed on length() parameter '$len_name '" );
2061
+ $pxs -> blurt(" Default value not allowed on length() parameter '$len_name '" );
2062
2062
undef $default ;
2063
2063
}
2064
2064
}
2065
2065
else {
2066
- $self -> blurt(" length() pseudo-parameter not allowed under -noargtypes" );
2066
+ $pxs -> blurt(" length() pseudo-parameter not allowed under -noargtypes" );
2067
2067
}
2068
2068
}
2069
2069
@@ -2104,8 +2104,8 @@ sub parse_sig {
2104
2104
}
2105
2105
} # for (@args)
2106
2106
2107
- $sig -> {nargs } = $args_count ;
2108
- $sig -> {min_args } = $args_count - $optional_args_count ;
2107
+ $self -> {nargs } = $args_count ;
2108
+ $self -> {min_args } = $args_count - $optional_args_count ;
2109
2109
}
2110
2110
2111
2111
0 commit comments