typemap.
Mandatory named arguments: The C<xstype> of the
-entry.
+entry or the C<ctype> of the typemap that can be used to find
+the C<xstype>. To wit, the following pieces of code
+are equivalent:
+
+ my $type = $typemap->get_typemap(ctype => $ctype)
+ my $input_map = $typemap->get_inputmap(xstype => $type->xstype);
+
+ my $input_map = $typemap->get_inputmap(ctype => $ctype);
Returns the C<ExtUtils::Typemaps::InputMap>
object for the entry if found.
my $self = shift;
my %args = @_;
my $xstype = $args{xstype};
- die("Need xstype argument") if not defined $xstype;
+ my $ctype = $args{ctype};
+ die("Need xstype or ctype argument")
+ if not defined $xstype
+ and not defined $ctype;
+ die("Need xstype OR ctype arguments, not both")
+ if defined $xstype and defined $ctype;
+
+ if (defined $ctype) {
+ $xstype = $self->get_typemap(ctype => $ctype)->xstype;
+ }
my $index = $self->{input_lookup}{$xstype};
return() if not defined $index;
typemap.
Mandatory named arguments: The C<xstype> of the
-entry.
+entry or the C<ctype> of the typemap that can be used to
+resolve the C<xstype>. (See above for an example.)
Returns the C<ExtUtils::Typemaps::InputMap>
object for the entry if found.
my $self = shift;
my %args = @_;
my $xstype = $args{xstype};
- die("Need xstype argument") if not defined $xstype;
+ my $ctype = $args{ctype};
+ die("Need xstype or ctype argument")
+ if not defined $xstype
+ and not defined $ctype;
+ die("Need xstype OR ctype arguments, not both")
+ if defined $xstype and defined $ctype;
+
+ if (defined $ctype) {
+ $xstype = $self->get_typemap(ctype => $ctype)->xstype;
+ }
my $index = $self->{output_lookup}{$xstype};
return() if not defined $index;
use strict;
use warnings;
-use Test::More tests => 29;
+use Test::More tests => 30;
use ExtUtils::Typemaps;
# typemap only
my $in = $map->get_inputmap(xstype => 'T_UV');
isa_ok($in, 'ExtUtils::Typemaps::InputMap');
is($in->xstype, 'T_UV');
+
+ # test fetching inputmap by ctype
+ my $in2 = $map->get_inputmap(ctype => 'unsigned int');
+ is_deeply($in2, $in, "get_inputmap returns the same typemap for ctype and xstype");
}