Make ExtUtils::ParseXS use ExtUtils::Typemaps
authorSteffen Mueller <smueller@cpan.org>
Fri, 11 Feb 2011 17:31:44 +0000 (18:31 +0100)
committerSteffen Mueller <smueller@cpan.org>
Tue, 12 Jul 2011 18:54:49 +0000 (20:54 +0200)
This is just the quick'n'dirty conversion to make it use
EU::Typemaps. Eventually, we want to use it in its full object-oriented
goodness!

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm

index 8412056..eb3ba17 100644 (file)
@@ -375,19 +375,22 @@ sub process_typemaps {
 
   push @tm, standard_typemap_locations( \@INC );
 
-  my ($type_kind_ref, $proto_letter_ref, $input_expr_ref, $output_expr_ref)
-    = ( {}, {}, {}, {} );
-
-  foreach my $typemap (@tm) {
-    next unless -f $typemap;
+  my $typemap = ExtUtils::Typemaps->new;
+  foreach my $typemap_loc (@tm) {
+    next unless -f $typemap_loc;
     # skip directories, binary files etc.
-    warn("Warning: ignoring non-text typemap file '$typemap'\n"), next
-      unless -T $typemap;
-    ($type_kind_ref, $proto_letter_ref, $input_expr_ref, $output_expr_ref) =
-      process_single_typemap( $typemap,
-        $type_kind_ref, $proto_letter_ref, $input_expr_ref, $output_expr_ref);
+    warn("Warning: ignoring non-text typemap file '$typemap_loc'\n"), next
+      unless -T $typemap_loc;
+
+    $typemap->merge(file => $typemap_loc, replace => 1);
   }
-  return ($type_kind_ref, $proto_letter_ref, $input_expr_ref, $output_expr_ref);
+
+  return (
+    $typemap->_get_typemap_hash(),
+    $typemap->_get_prototype_hash(),
+    $typemap->_get_inputmap_hash(),
+    $typemap->_get_outputmap_hash(),
+  );
 }
 
 =head2 C<process_single_typemap()>