From d505a9a66e5d2d7ad64a5ed5ebc1d6bad7867e76 Mon Sep 17 00:00:00 2001 From: Steffen Mueller Date: Fri, 11 Feb 2011 16:50:12 +0100 Subject: [PATCH] Add method to generate the prototype lookup hash Akin to the methods in the parent commit that generate the lookup hash for TYPEMAP/INPUT/OUTPUT, this method will generate the lookup has for typemap's prototypes as required by ExtUtils::ParseXS at this time. --- dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm index dc9e5b9..c2f0687 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm @@ -653,6 +653,38 @@ sub _get_outputmap_hash { return \%rv; } +=head2 _get_prototype_hash + +Returns a hash mapping the C types of the typemap to their +corresponding prototypes. + + { + 'char **' => '$', + 'bool_t' => '$', + 'AV *' => '$', + 'InputStream' => '$', + 'double' => '$', + # ... + } + +This is documented because it is used by C, +but it's not intended for general consumption. May be removed +at any time. + +=cut + +sub _get_prototype_hash { + my $self = shift; + my $lookup = $self->{typemap_lookup}; + my $storage = $self->{typemap_section}; + + my %rv; + foreach my $ctype (keys %$lookup) { + $rv{$ctype} = $storage->[ $lookup->{$ctype} ]->proto || '$'; + } + + return \%rv; +} -- 1.8.3.1