%type_kind, %proto_letter, $Package,
@line, %args_match, %defaults, %var_types, %arg_list, @proto_arg,
%argtype_seen, %in_out, %lengthof,
- @line_no, $ret_type, $func_name, $Full_func_name, $Packprefix, $Packid,
+ @line_no, $func_name, $Full_func_name, $Packprefix, $Packid,
%XsubAliases, %XsubAliasValues, %Interfaces, @Attributes, %outargs, $pname,
$thisdone, $retvaldone, $deferred, $gotRETVAL, $condnum, $cond,
$RETVAL_code, $printed_name, $func_args, @XSStack, $ALIAS,
}
# extract return type, function name and arguments
- ($ret_type) = tidy_type($_);
- $RETVAL_no_return = 1 if $ret_type =~ s/^NO_OUTPUT\s+//;
+ ($self->{ret_type}) = tidy_type($_);
+ $RETVAL_no_return = 1 if $self->{ret_type} =~ s/^NO_OUTPUT\s+//;
# Allow one-line ANSI-like declaration
unshift @line, $2
if $args{argtypes}
- and $ret_type =~ s/^(.*?\w.*?)\s*\b(\w+\s*\(.*)/$1/s;
+ and $self->{ret_type} =~ s/^(.*?\w.*?)\s*\b(\w+\s*\(.*)/$1/s;
# a function definition needs at least 2 lines
- blurt ("Error: Function definition too short '$ret_type'"), next PARAGRAPH
+ blurt ("Error: Function definition too short '$self->{ret_type}'"), next PARAGRAPH
unless @line;
- $externC = 1 if $ret_type =~ s/^extern "C"\s+//;
- $static = 1 if $ret_type =~ s/^static\s+//;
+ $externC = 1 if $self->{ret_type} =~ s/^extern "C"\s+//;
+ $static = 1 if $self->{ret_type} =~ s/^static\s+//;
$func_header = shift(@line);
blurt ("Error: Cannot parse function definition from '$func_header'"), next PARAGRAPH
# dXSI32;
EOF
print Q(<<"EOF") if $INTERFACE;
-# dXSFUNCTION($ret_type);
+# dXSFUNCTION($self->{ret_type});
EOF
if ($ellipsis) {
$cond = ($min_args ? qq(items < $min_args) : 0);
$_ = '';
}
else {
- if ($ret_type ne "void") {
- print "\t" . &map_type($ret_type, 'RETVAL', $self->{hiertype}) . ";\n"
+ if ($self->{ret_type} ne "void") {
+ print "\t" . &map_type($self->{ret_type}, 'RETVAL', $self->{hiertype}) . ";\n"
if !$retvaldone;
$args_match{"RETVAL"} = 0;
- $var_types{"RETVAL"} = $ret_type;
+ $var_types{"RETVAL"} = $self->{ret_type};
print "\tdXSTARG;\n"
- if $args{optimize} and $targetable{$type_kind{$ret_type}};
+ if $args{optimize} and $targetable{$type_kind{$self->{ret_type}}};
}
if (@fake_INPUT or @fake_INPUT_pre) {
}
else {
print "\n\t";
- if ($ret_type ne "void") {
+ if ($self->{ret_type} ne "void") {
print "RETVAL = ";
$wantRETVAL = 1;
}
$gotRETVAL = 0; # 1 if RETVAL seen in OUTPUT section;
undef $RETVAL_code ; # code to set RETVAL (from OUTPUT section);
# $wantRETVAL set if 'RETVAL =' autogenerated
- ($wantRETVAL, $ret_type) = (0, 'void') if $RETVAL_no_return;
+ ($wantRETVAL, $self->{ret_type}) = (0, 'void') if $RETVAL_no_return;
undef %outargs;
process_keyword("POSTCALL|OUTPUT|ALIAS|ATTRS|PROTOTYPE|OVERLOAD");
print "\t$RETVAL_code\n";
}
elsif ($gotRETVAL || $wantRETVAL) {
- my $t = $args{optimize} && $targetable{$type_kind{$ret_type}};
+ my $t = $args{optimize} && $targetable{$type_kind{$self->{ret_type}}};
# Although the '$var' declared in the next line is never explicitly
# used within this 'elsif' block, commenting it out leads to
# disaster, starting with the first 'eval qq' inside the 'elsif' block
# '$var' as a substring:
# <i> <> <(IV)$var>
my $var = 'RETVAL';
- my $type = $ret_type;
+ my $type = $self->{ret_type};
# 0: type, 1: with_size, 2: how, 3: how_size
if ($t and not $t->[1] and $t->[0] eq 'p') {
else {
# RETVAL almost never needs SvSETMAGIC()
generate_output( {
- type => $ret_type,
+ type => $self->{ret_type},
num => 0,
var => 'RETVAL',
do_setmagic => 0,
}
}
- $xsreturn = 1 if $ret_type ne "void";
+ $xsreturn = 1 if $self->{ret_type} ne "void";
my $num = $xsreturn;
my $c = @outlist;
print "\tXSprePUSH;" if $c and not $prepush_done;
$Interfaces{$iface_name} = $_;
}
print Q(<<"EOF");
-# XSFUNCTION = $self->{interface_macro}($ret_type,cv,XSANY.any_dptr);
+# XSFUNCTION = $self->{interface_macro}($self->{ret_type},cv,XSANY.any_dptr);
EOF
$self->{interface} = 1; # local
$Interfaces = 1; # global