ExtUtils-Typemap-1.00/0000755000175000017500000000000011616276562013326 5ustar tseetseeExtUtils-Typemap-1.00/Changes0000644000175000017500000000111511616276510014610 0ustar tseetseeRevision history for Perl extension ExtUtils::Typemap 1.00 Wed 3 Aug 2011 - ExtUtils::Typemap is now only the thinnest of wrappers around ExtUtils::Typemaps (note the plural). Please migrate to using ExtUtils::Typemaps directly. See the docs on why. 0.05 Sat 3 Jul 2010 - Typemap creation from string 0.04 Mon 14 Dec 2009 - Fix hairy validation bug for duplicate XS types in TYPEMAP. 0.03 Mon 14 Dec 2009 - Typemap merging 0.02 Wed 9 Sep 2009 - Add as_string method. - Fix to typemap validation. - More tests. 0.01 Tue 1 Sep 2009 - Initial CPAN release. ExtUtils-Typemap-1.00/Makefile.PL0000644000175000017500000000123411616271021015261 0ustar tseetseeuse 5.006001; use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( NAME => 'ExtUtils::Typemap', VERSION_FROM => 'lib/ExtUtils/Typemap.pm', # finds $VERSION PREREQ_PM => { 'ExtUtils::Typemaps' => '1.00', 'File::Spec' => '0', 'Test::More' => '0.44', 'File::Temp' => '0', }, ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/ExtUtils/Typemap.pm', # retrieve abstract from module AUTHOR => 'Steffen Mueller ') : ()), ); ExtUtils-Typemap-1.00/META.json0000644000175000017500000000174511616276562014756 0ustar tseetsee{ "abstract" : "Read/Write/Modify Perl/XS typemap files", "author" : [ "Steffen Mueller " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.58, CPAN::Meta::Converter version 2.110930", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "ExtUtils-Typemap", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "runtime" : { "requires" : { "ExtUtils::Typemaps" : "1.00", "File::Spec" : 0, "File::Temp" : 0, "Test::More" : "0.44" } } }, "release_status" : "stable", "version" : "1.00" } ExtUtils-Typemap-1.00/t/0000755000175000017500000000000011616276562013571 5ustar tseetseeExtUtils-Typemap-1.00/t/data/0000755000175000017500000000000011616276562014502 5ustar tseetseeExtUtils-Typemap-1.00/t/data/other.typemap0000644000175000017500000000014311616270607017214 0ustar tseetseeTYPEMAP double T_NV INPUT T_NV $var = ($type)SvNV($arg); OUTPUT T_NV sv_setnv($arg, (NV)$var); ExtUtils-Typemap-1.00/t/data/combined.typemap0000644000175000017500000000037611616270607017663 0ustar tseetseeTYPEMAP unsigned int T_UV int T_IV double T_NV INPUT T_UV $var = ($type)SvUV($arg); T_IV $var = ($type)SvIV($arg); T_NV $var = ($type)SvNV($arg); OUTPUT T_UV sv_setuv($arg, (UV)$var); T_IV sv_setiv($arg, (IV)$var); T_NV sv_setnv($arg, (NV)$var); ExtUtils-Typemap-1.00/t/data/simple.typemap0000644000175000017500000000026211616270607017366 0ustar tseetseeTYPEMAP unsigned int T_UV int T_IV INPUT T_UV $var = ($type)SvUV($arg); T_IV $var = ($type)SvIV($arg); OUTPUT T_UV sv_setuv($arg, (UV)$var); T_IV sv_setiv($arg, (IV)$var); ExtUtils-Typemap-1.00/t/11_whitespace.t0000644000175000017500000000156311616270607016412 0ustar tseetsee#!/usr/bin/perl use strict; use warnings; use Test::More tests => 2; use ExtUtils::Typemap; SCOPE: { my $map = ExtUtils::Typemap->new(); $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV'); $map->add_inputmap(xstype => 'T_UV', code => ' $var = ($type)SvUV($arg);'); is($map->as_string(), <<'HERE', "Simple typemap (with input and code including leading whitespace) matches expectations"); TYPEMAP unsigned int T_UV INPUT T_UV $var = ($type)SvUV($arg); HERE } SCOPE: { my $map = ExtUtils::Typemap->new(); $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV'); $map->add_inputmap(xstype => 'T_UV', code => " \$var =\n(\$type)\n SvUV(\$arg);"); is($map->as_string(), <<'HERE', "Simple typemap (with input and multi-line code) matches expectations"); TYPEMAP unsigned int T_UV INPUT T_UV $var = ($type) SvUV($arg); HERE } ExtUtils-Typemap-1.00/t/10_bare.t0000644000175000017500000001026011616273224015156 0ustar tseetsee#!/usr/bin/perl use strict; use warnings; use Test::More tests => 29; use ExtUtils::Typemap; sub _isa_any_ok { my $obj = shift; my @classes = @_; my $ok = 0; foreach (@classes) { $ok = 1 if $obj->isa($_); } ok($ok, "Object isa_any '".join("', '", @classes)."'"); if (not $ok) { diag("Object isa '" . ref($obj) . "', not any of '".join("', '", @classes)."'"); } return $ok; } # typemap only SCOPE: { my $map = ExtUtils::Typemap->new(); $map->add_typemap(ctype => 'unsigned int', xstype => 'T_IV'); is($map->as_string(), <<'HERE', "Simple typemap matches expectations"); TYPEMAP unsigned int T_IV HERE my $type = $map->get_typemap(ctype => 'unsigned int'); _isa_any_ok($type, 'ExtUtils::Typemap::Type', 'ExtUtils::Typemaps::Type'); is($type->ctype, 'unsigned int'); is($type->xstype, 'T_IV'); is($type->tidy_ctype, 'unsigned int'); } # typemap & input SCOPE: { my $map = ExtUtils::Typemap->new(); $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV'); $map->add_inputmap(xstype => 'T_UV', code => '$var = ($type)SvUV($arg);'); is($map->as_string(), <<'HERE', "Simple typemap (with input) matches expectations"); TYPEMAP unsigned int T_UV INPUT T_UV $var = ($type)SvUV($arg); HERE my $type = $map->get_typemap(ctype => 'unsigned int'); _isa_any_ok($type, 'ExtUtils::Typemap::Type', 'ExtUtils::Typemaps::Type'); is($type->ctype, 'unsigned int'); is($type->xstype, 'T_UV'); is($type->tidy_ctype, 'unsigned int'); my $in = $map->get_inputmap(xstype => 'T_UV'); _isa_any_ok($in, 'ExtUtils::Typemap::InputMap', 'ExtUtils::Typemaps::InputMap'); is($in->xstype, 'T_UV'); } # typemap & output SCOPE: { my $map = ExtUtils::Typemap->new(); $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV'); $map->add_outputmap(xstype => 'T_UV', code => 'sv_setuv($arg, (UV)$var);'); is($map->as_string(), <<'HERE', "Simple typemap (with output) matches expectations"); TYPEMAP unsigned int T_UV OUTPUT T_UV sv_setuv($arg, (UV)$var); HERE my $type = $map->get_typemap(ctype => 'unsigned int'); _isa_any_ok($type, 'ExtUtils::Typemap::Type', 'ExtUtils::Typemaps::Type'); is($type->ctype, 'unsigned int'); is($type->xstype, 'T_UV'); is($type->tidy_ctype, 'unsigned int'); my $in = $map->get_outputmap(xstype => 'T_UV'); _isa_any_ok($in, 'ExtUtils::Typemap::OutputMap', 'ExtUtils::Typemaps::OutputMap'); is($in->xstype, 'T_UV'); } # typemap & input & output SCOPE: { my $map = ExtUtils::Typemap->new(); $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV'); $map->add_inputmap(xstype => 'T_UV', code => '$var = ($type)SvUV($arg);'); $map->add_outputmap(xstype => 'T_UV', code => 'sv_setuv($arg, (UV)$var);'); is($map->as_string(), <<'HERE', "Simple typemap (with in- & output) matches expectations"); TYPEMAP unsigned int T_UV INPUT T_UV $var = ($type)SvUV($arg); OUTPUT T_UV sv_setuv($arg, (UV)$var); HERE } # two typemaps & input & output SCOPE: { my $map = ExtUtils::Typemap->new(); $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV'); $map->add_inputmap(xstype => 'T_UV', code => '$var = ($type)SvUV($arg);'); $map->add_outputmap(xstype => 'T_UV', code => 'sv_setuv($arg, (UV)$var);'); $map->add_typemap(ctype => 'int', xstype => 'T_IV'); $map->add_inputmap(xstype => 'T_IV', code => '$var = ($type)SvIV($arg);'); $map->add_outputmap(xstype => 'T_IV', code => 'sv_setiv($arg, (IV)$var);'); is($map->as_string(), <<'HERE', "Simple typemap (with in- & output) matches expectations"); TYPEMAP unsigned int T_UV int T_IV INPUT T_UV $var = ($type)SvUV($arg); T_IV $var = ($type)SvIV($arg); OUTPUT T_UV sv_setuv($arg, (UV)$var); T_IV sv_setiv($arg, (IV)$var); HERE my $type = $map->get_typemap(ctype => 'unsigned int'); _isa_any_ok($type, 'ExtUtils::Typemap::Type', 'ExtUtils::Typemaps::Type'); is($type->ctype, 'unsigned int'); is($type->xstype, 'T_UV'); is($type->tidy_ctype, 'unsigned int'); my $in = $map->get_outputmap(xstype => 'T_UV'); _isa_any_ok($in, 'ExtUtils::Typemap::OutputMap', 'ExtUtils::Typemaps::OutputMap'); is($in->xstype, 'T_UV'); $in = $map->get_outputmap(xstype => 'T_IV'); _isa_any_ok($in, 'ExtUtils::Typemap::OutputMap', 'ExtUtils::Typemaps::OutputMap'); is($in->xstype, 'T_IV'); } ExtUtils-Typemap-1.00/t/12_file.t0000644000175000017500000000337011616270607015174 0ustar tseetsee#!/usr/bin/perl use strict; use warnings; use Test::More tests => 6; use ExtUtils::Typemap; use File::Spec; use File::Temp; my $datadir = -d 't' ? File::Spec->catdir(qw/t data/) : 'data'; sub slurp { my $file = shift; open my $fh, '<', $file or die "Cannot open file '$file' for reading: $!"; local $/ = undef; return <$fh>; } my $cmp_typemap_file = File::Spec->catfile($datadir, 'simple.typemap'); my $cmp_typemap_str = slurp($cmp_typemap_file); my $map = ExtUtils::Typemap->new(); $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV'); $map->add_inputmap(xstype => 'T_UV', code => '$var = ($type)SvUV($arg);'); $map->add_outputmap(xstype => 'T_UV', code => 'sv_setuv($arg, (UV)$var);'); $map->add_typemap(ctype => 'int', xstype => 'T_IV'); $map->add_inputmap(xstype => 'T_IV', code => '$var = ($type)SvIV($arg);'); $map->add_outputmap(xstype => 'T_IV', code => 'sv_setiv($arg, (IV)$var);'); is($map->as_string(), $cmp_typemap_str, "Simple typemap matches reference file"); my $tmpdir = File::Temp::tempdir(CLEANUP => 1, TMPDIR => 1); my $tmpfile = File::Spec->catdir($tmpdir, 'simple.typemap'); $map->write(file => $tmpfile); is($map->as_string(), slurp($tmpfile), "Simple typemap write matches as_string"); is(ExtUtils::Typemap->new(file => $cmp_typemap_file)->as_string(), $cmp_typemap_str, "Simple typemap roundtrips"); is(ExtUtils::Typemap->new(file => $tmpfile)->as_string(), $cmp_typemap_str, "Simple typemap roundtrips (2)"); SCOPE: { local $map->{file} = $cmp_typemap_file; is_deeply(ExtUtils::Typemap->new(file => $cmp_typemap_file), $map, "Simple typemap roundtrips (in memory)"); } # test that we can also create them from a string my $map_from_str = ExtUtils::Typemap->new(string => $map->as_string()); is_deeply($map_from_str, $map); ExtUtils-Typemap-1.00/t/13_merge.t0000644000175000017500000000314511616273336015357 0ustar tseetsee#!/usr/bin/perl use strict; use warnings; use Test::More tests => 5; use ExtUtils::Typemap; use File::Spec; use File::Temp; sub _isa_any_ok { my $obj = shift; my @classes = @_; my $ok = 0; foreach (@classes) { $ok = 1 if $obj->isa($_); } ok($ok, "Object isa_any '".join("', '", @classes)."'"); if (not $ok) { diag("Object isa '" . ref($obj) . "', not any of '".join("', '", @classes)."'"); } return $ok; } my $datadir = -d 't' ? File::Spec->catdir(qw/t data/) : 'data'; sub slurp { my $file = shift; open my $fh, '<', $file or die "Cannot open file '$file' for reading: $!"; local $/ = undef; return <$fh>; } my $first_typemap_file = File::Spec->catfile($datadir, 'simple.typemap'); my $second_typemap_file = File::Spec->catfile($datadir, 'other.typemap'); my $combined_typemap_file = File::Spec->catfile($datadir, 'combined.typemap'); SCOPE: { my $first = ExtUtils::Typemap->new(file => $first_typemap_file); _isa_any_ok($first, 'ExtUtils::Typemap', 'ExtUtils::Typemaps'); my $second = ExtUtils::Typemap->new(file => $second_typemap_file); _isa_any_ok($second, 'ExtUtils::Typemap', 'ExtUtils::Typemaps'); $first->merge(typemap => $second); is($first->as_string(), slurp($combined_typemap_file), "merging produces expected output"); } SCOPE: { my $first = ExtUtils::Typemap->new(file => $first_typemap_file); _isa_any_ok($first, 'ExtUtils::Typemap', 'ExtUtils::Typemaps'); my $second_str = slurp($second_typemap_file); $first->add_string(string => $second_str); is($first->as_string(), slurp($combined_typemap_file), "merging (string) produces expected output"); } ExtUtils-Typemap-1.00/t/01_compile.t0000644000175000017500000000033411616272471015701 0ustar tseetsee#!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 2; # Check their perl version ok( $] >= 5.006001, "Your perl is new enough" ); # Does the module load use_ok( 'ExtUtils::Typemap' ); ExtUtils-Typemap-1.00/MANIFEST0000644000175000017500000000074211616276562014462 0ustar tseetseeChanges lib/ExtUtils/Typemap.pm lib/ExtUtils/Typemap/InputMap.pm lib/ExtUtils/Typemap/OutputMap.pm lib/ExtUtils/Typemap/Type.pm Makefile.PL MANIFEST This list of files README t/01_compile.t t/10_bare.t t/11_whitespace.t t/12_file.t t/13_merge.t t/data/combined.typemap t/data/other.typemap t/data/simple.typemap META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) ExtUtils-Typemap-1.00/README0000644000175000017500000000162011616276416014203 0ustar tseetseeNAME ExtUtils::Typemap - Read/Write/Modify Perl/XS typemap files SYNOPSIS See "ExtUtils::Typemaps" instead! DESCRIPTION This module exists merely as a compatibility wrapper around ExtUtils::Typemaps. In a nutshell, "ExtUtils::Typemap" was renamed to "ExtUtils::Typemaps" because the Typemap directory in lib/ could collide with the typemap file on case-insensitive file systems. The "ExtUtils::Typemaps" module is part of the ExtUtils::ParseXS distribution and ships with the standard library of perl starting with perl version 5.16. SEE ALSO ExtUtils::Typemaps, ExtUtils::ParseXS. For details on typemaps: perlxstut, perlxs. AUTHOR Steffen Mueller " COPYRIGHT & LICENSE Copyright 2009, 2010, 2011 Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ExtUtils-Typemap-1.00/META.yml0000644000175000017500000000107311616276562014600 0ustar tseetsee--- abstract: 'Read/Write/Modify Perl/XS typemap files' author: - 'Steffen Mueller ' build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.58, CPAN::Meta::Converter version 2.110930' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: ExtUtils-Typemap no_index: directory: - t - inc requires: ExtUtils::Typemaps: 1.00 File::Spec: 0 File::Temp: 0 Test::More: 0.44 version: 1.00 ExtUtils-Typemap-1.00/lib/0000755000175000017500000000000011616276562014074 5ustar tseetseeExtUtils-Typemap-1.00/lib/ExtUtils/0000755000175000017500000000000011616276562015655 5ustar tseetseeExtUtils-Typemap-1.00/lib/ExtUtils/Typemap.pm0000644000175000017500000000210411616276521017622 0ustar tseetseepackage ExtUtils::Typemap; use 5.006001; use strict; use warnings; our $VERSION = '1.00'; use ExtUtils::Typemaps; our @ISA = qw(ExtUtils::Typemaps); =head1 NAME ExtUtils::Typemap - Read/Write/Modify Perl/XS typemap files =head1 SYNOPSIS See C instead! =head1 DESCRIPTION This module exists merely as a compatibility wrapper around L. In a nutshell, C was renamed to C because the F directory in F could collide with the F file on case-insensitive file systems. The C module is part of the L distribution and ships with the standard library of perl starting with perl version 5.16. =head1 SEE ALSO L, L. For details on typemaps: L, L. =head1 AUTHOR Steffen Mueller C<> =head1 COPYRIGHT & LICENSE Copyright 2009, 2010, 2011 Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; ExtUtils-Typemap-1.00/lib/ExtUtils/Typemap/0000755000175000017500000000000011616276562017274 5ustar tseetseeExtUtils-Typemap-1.00/lib/ExtUtils/Typemap/OutputMap.pm0000644000175000017500000000143111616276533021565 0ustar tseetseepackage ExtUtils::Typemap::OutputMap; use 5.006001; use strict; use warnings; our $VERSION = '1.00'; use ExtUtils::Typemap; use ExtUtils::Typemaps::OutputMap; our @ISA = qw(ExtUtils::Typemaps::OutputMap); =head1 NAME ExtUtils::Typemap::OutputMap - Entry in the OUTPUT section of a typemap =head1 SYNOPSIS Use L instead! =head1 DESCRIPTION Use L instead! And find the explanation at L. =head1 SEE ALSO L L =head1 AUTHOR Steffen Mueller C<> =head1 COPYRIGHT & LICENSE Copyright 2009, 2010, 2011 Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; ExtUtils-Typemap-1.00/lib/ExtUtils/Typemap/InputMap.pm0000644000175000017500000000142111616276527021366 0ustar tseetseepackage ExtUtils::Typemap::InputMap; use 5.006001; use strict; use warnings; our $VERSION = '1.00'; use ExtUtils::Typemap; use ExtUtils::Typemaps::InputMap; our @ISA = qw(ExtUtils::Typemaps::InputMap); =head1 NAME ExtUtils::Typemap::InputMap - Entry in the INPUT section of a typemap =head1 SYNOPSIS Use L instead! =head1 DESCRIPTION Use L instead! And find the explanation at L. =head1 SEE ALSO L L =head1 AUTHOR Steffen Mueller C<> =head1 COPYRIGHT & LICENSE Copyright 2009, 2010, 2011 Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; ExtUtils-Typemap-1.00/lib/ExtUtils/Typemap/Type.pm0000644000175000017500000000141411616276536020554 0ustar tseetseepackage ExtUtils::Typemap::Type; use 5.006001; use strict; use warnings; our $VERSION = '1.00'; use Carp qw(croak); use ExtUtils::Typemap; use ExtUtils::Typemaps::Type; our @ISA = qw(ExtUtils::Typemaps::Type); =head1 NAME ExtUtils::Typemap::Type - Entry in the TYPEMAP section of a typemap =head1 SYNOPSIS Use L instead! =head1 DESCRIPTION Use L instead! And find the explanation at L. =head1 SEE ALSO L L =head1 AUTHOR Steffen Mueller C<> =head1 COPYRIGHT & LICENSE Copyright 2009, 2010, 2011 Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1;