From: Nicholas Clark Date: Fri, 28 Jan 2005 21:01:04 +0000 (+0000) Subject: More consistent names for all the parameter name/declaration methods X-Git-Tag: accepted/trunk/20130322.191538~21208 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8901870eae83390cf40d51cb7fd1437ed1fa230;p=platform%2Fupstream%2Fperl.git More consistent names for all the parameter name/declaration methods p4raw-id: //depot/perl@23897 --- diff --git a/lib/ExtUtils/Constant/Base.pm b/lib/ExtUtils/Constant/Base.pm index 1221b7d..8a6fc6f 100644 --- a/lib/ExtUtils/Constant/Base.pm +++ b/lib/ExtUtils/Constant/Base.pm @@ -592,23 +592,23 @@ sub C_constant_prefix_param_defintion { ''; } -sub C_constant_name_param_definition { +sub name_param_definition { "const char *" . $_[0]->name_param; } -sub C_constant_namelen_param { +sub namelen_param { 'len'; } -sub C_constant_namelen_param_definition { - 'size_t ' . $_[0] -> C_constant_namelen_param; +sub namelen_param_definition { + 'size_t ' . $_[0]->namelen_param; } -sub C_constant_param { +sub C_constant_other_params { ''; } -sub C_constant_param_defintion { +sub C_constant_other_params_defintion { ''; } @@ -620,8 +620,8 @@ the C<*param*> calls. (Yes, having to read the source to make sense of this is considered a known bug). I is be a hashref of types the constant function will return. In ExtUtils::Constant::XS this method is used to returns a hashref keyed IV NV PV SV to show which combination of pointers will -be needed in the C argument list generated by C_constant_param_definition -and C_constant_param +be needed in the C argument list generated by +C_constant_other_params_definition and C_constant_other_params =cut @@ -877,11 +877,11 @@ sub C_constant { # Eg "pTHX_ " . $self->C_constant_prefix_param_defintion($params) # Probably "const char *name" - . $self->C_constant_name_param_definition($params); + . $self->name_param_definition($params); # Something like ", STRLEN len" - $body .= ", " . $self->C_constant_namelen_param_definition($params) + $body .= ", " . $self->namelen_param_definition($params) unless defined $namelen; - $body .= $self->C_constant_param_defintion($params); + $body .= $self->C_constant_other_params_defintion($params); $body .= ") {\n"; if (defined $namelen) { @@ -898,7 +898,7 @@ sub C_constant { default_type => $default_type, what => $what, indent => $indent, breakout => $breakout}, @items); - $body .= ' switch ('.$self->C_constant_namelen_param().") {\n"; + $body .= ' switch ('.$self->namelen_param().") {\n"; # Need to group names of the same length my @by_length; foreach (@items) { @@ -943,7 +943,7 @@ sub C_constant { . $self->C_constant_prefix_param($params) # Probably "name" . $self->name_param($params); - $body .= $self->C_constant_param($params); + $body .= $self->C_constant_other_params($params); $body .= ");\n"; } $body .= " break;\n"; diff --git a/lib/ExtUtils/Constant/XS.pm b/lib/ExtUtils/Constant/XS.pm index 1c5516b..51244f6 100644 --- a/lib/ExtUtils/Constant/XS.pm +++ b/lib/ExtUtils/Constant/XS.pm @@ -171,11 +171,11 @@ sub C_constant_prefix_param_defintion { "pTHX_ "; } -sub C_constant_namelen_param_definition { - 'STRLEN ' . $_[0] -> C_constant_namelen_param; +sub namelen_param_definition { + 'STRLEN ' . $_[0] -> namelen_param; } -sub C_constant_param_defintion { +sub C_constant_other_params_defintion { my ($self, $params) = @_; my $body = ''; $body .= ", int utf8" if $params->{''}; @@ -186,7 +186,7 @@ sub C_constant_param_defintion { $body; } -sub C_constant_param { +sub C_constant_other_params { my ($self, $params) = @_; my $body = ''; $body .= ", utf8" if $params->{''}; diff --git a/perl_keyword.pl b/perl_keyword.pl index a8c015e..957f8f9 100644 --- a/perl_keyword.pl +++ b/perl_keyword.pl @@ -31,7 +31,7 @@ sub return_statement_for_notfound { } # Ditch the default "const" -sub C_constant_name_param_definition { +sub name_param_definition { "char *" . $_[0]->name_param; } @@ -48,8 +48,8 @@ sub C_constant_prefix_param_defintion { "pTHX_ "; } -sub C_constant_namelen_param_definition { - 'I32 ' . $_[0] -> C_constant_namelen_param; +sub namelen_param_definition { + 'I32 ' . $_[0] -> namelen_param; } package main;