ExtUtils-Typemaps-Default-1.05000755001750001750 012250406402 15460 5ustar00tseetsee000000000000ExtUtils-Typemaps-Default-1.05/Build.PL000444001750001750 56112250406402 17073 0ustar00tseetsee000000000000#!/usr/bin/perl -w use strict; use Module::Build; my $build = Module::Build->new( module_name => 'ExtUtils::Typemaps::Default', license => 'perl', requires => { 'ExtUtils::Typemaps' => '3.18_03', }, build_requires => { 'Module::Build' => '0', }, test_requires => { 'Test::More' => '0', }, ); $build->create_build_script; ExtUtils-Typemaps-Default-1.05/META.yml000444001750001750 333212250406402 17067 0ustar00tseetsee000000000000--- abstract: 'A set of useful typemaps' author: - 'Steffen Mueller ' build_requires: Module::Build: 0 configure_requires: Module::Build: 0.40 dynamic_config: 1 generated_by: 'Module::Build version 0.4008, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: ExtUtils-Typemaps-Default provides: ExtUtils::Typemap::Basic: file: lib/ExtUtils/Typemap/Basic.pm version: 1.05 ExtUtils::Typemap::Default: file: lib/ExtUtils/Typemap/Default.pm version: 1.05 ExtUtils::Typemap::ObjectMap: file: lib/ExtUtils/Typemap/ObjectMap.pm version: 1.05 ExtUtils::Typemap::STL: file: lib/ExtUtils/Typemap/STL.pm version: 1.05 ExtUtils::Typemap::STL::String: file: lib/ExtUtils/Typemap/STL/String.pm version: 1.05 ExtUtils::Typemap::STL::Vector: file: lib/ExtUtils/Typemap/STL/Vector.pm version: 1.05 ExtUtils::Typemaps::Basic: file: lib/ExtUtils/Typemaps/Basic.pm version: 1.05 ExtUtils::Typemaps::Default: file: lib/ExtUtils/Typemaps/Default.pm version: 1.05 ExtUtils::Typemaps::ObjectMap: file: lib/ExtUtils/Typemaps/ObjectMap.pm version: 1.05 ExtUtils::Typemaps::STL: file: lib/ExtUtils/Typemaps/STL.pm version: 1.05 ExtUtils::Typemaps::STL::List: file: lib/ExtUtils/Typemaps/STL/List.pm version: 1.05 ExtUtils::Typemaps::STL::String: file: lib/ExtUtils/Typemaps/STL/String.pm version: 1.05 ExtUtils::Typemaps::STL::Vector: file: lib/ExtUtils/Typemaps/STL/Vector.pm version: 1.05 requires: ExtUtils::Typemaps: 3.18_03 resources: license: http://dev.perl.org/licenses/ version: 1.05 x_test_requires: Test::More: 0 ExtUtils-Typemaps-Default-1.05/MANIFEST000444001750001750 101212250406402 16740 0ustar00tseetsee000000000000Build.PL Changes lib/ExtUtils/Typemap/Basic.pm lib/ExtUtils/Typemap/Default.pm lib/ExtUtils/Typemap/ObjectMap.pm lib/ExtUtils/Typemap/STL.pm lib/ExtUtils/Typemap/STL/String.pm lib/ExtUtils/Typemap/STL/Vector.pm lib/ExtUtils/Typemaps/Basic.pm lib/ExtUtils/Typemaps/Default.pm lib/ExtUtils/Typemaps/ObjectMap.pm lib/ExtUtils/Typemaps/STL.pm lib/ExtUtils/Typemaps/STL/List.pm lib/ExtUtils/Typemaps/STL/String.pm lib/ExtUtils/Typemaps/STL/Vector.pm MANIFEST This list of files MANIFEST.SKIP META.json META.yml t/001_basic.t ExtUtils-Typemaps-Default-1.05/META.json000444001750001750 517512250406402 17246 0ustar00tseetsee000000000000{ "abstract" : "A set of useful typemaps", "author" : [ "Steffen Mueller " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4008, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "ExtUtils-Typemaps-Default", "prereqs" : { "build" : { "requires" : { "Module::Build" : "0" } }, "configure" : { "requires" : { "Module::Build" : "0.40" } }, "runtime" : { "requires" : { "ExtUtils::Typemaps" : "3.18_03" } } }, "provides" : { "ExtUtils::Typemap::Basic" : { "file" : "lib/ExtUtils/Typemap/Basic.pm", "version" : "1.05" }, "ExtUtils::Typemap::Default" : { "file" : "lib/ExtUtils/Typemap/Default.pm", "version" : "1.05" }, "ExtUtils::Typemap::ObjectMap" : { "file" : "lib/ExtUtils/Typemap/ObjectMap.pm", "version" : "1.05" }, "ExtUtils::Typemap::STL" : { "file" : "lib/ExtUtils/Typemap/STL.pm", "version" : "1.05" }, "ExtUtils::Typemap::STL::String" : { "file" : "lib/ExtUtils/Typemap/STL/String.pm", "version" : "1.05" }, "ExtUtils::Typemap::STL::Vector" : { "file" : "lib/ExtUtils/Typemap/STL/Vector.pm", "version" : "1.05" }, "ExtUtils::Typemaps::Basic" : { "file" : "lib/ExtUtils/Typemaps/Basic.pm", "version" : "1.05" }, "ExtUtils::Typemaps::Default" : { "file" : "lib/ExtUtils/Typemaps/Default.pm", "version" : "1.05" }, "ExtUtils::Typemaps::ObjectMap" : { "file" : "lib/ExtUtils/Typemaps/ObjectMap.pm", "version" : "1.05" }, "ExtUtils::Typemaps::STL" : { "file" : "lib/ExtUtils/Typemaps/STL.pm", "version" : "1.05" }, "ExtUtils::Typemaps::STL::List" : { "file" : "lib/ExtUtils/Typemaps/STL/List.pm", "version" : "1.05" }, "ExtUtils::Typemaps::STL::String" : { "file" : "lib/ExtUtils/Typemaps/STL/String.pm", "version" : "1.05" }, "ExtUtils::Typemaps::STL::Vector" : { "file" : "lib/ExtUtils/Typemaps/STL/Vector.pm", "version" : "1.05" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ] }, "version" : "1.05", "x_test_requires" : { "Test::More" : "0" } } ExtUtils-Typemaps-Default-1.05/MANIFEST.SKIP000444001750001750 233612250406402 17517 0ustar00tseetsee000000000000 #!start included /opt/perl/modules/lib/perl5/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ \..*\.sw[po]$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid MYMETA files ^MYMETA\. #!end included /opt/perl/modules/lib/perl5/ExtUtils/MANIFEST.SKIP # Avoid configuration metadata file ^MYMETA\. # Avoid Module::Build generated and utility files. \bBuild$ \bBuild.bat$ \b_build \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid archives of this distribution \bExtUtils-Typemaps?-Default-[\d\.\_]+ # Ignore test byproducts ExtUtils-Typemaps-Default-1.05/Changes000444001750001750 212612250406402 17111 0ustar00tseetsee000000000000Revision history for Perl extension ExtUtils::Typemaps::Default. 1.05 Fri Dec 6 18:43:00 CET 2013 - Fix invalid av_extend on zero-length vectors. (James Wright, RT #91213) 1.04 Sun Jun 23 18:11:00 CEST 2013 - Fix typoes in stl::list typemaps. 1.03 Wed May 15 07:54:00 CEST 2013 - Implement some stl::list typemaps. 1.02 Fri Apr 19 18:38:00 CEST 2013 - Require new-enough ExtUtils::Typemaps for template type canonicalization (sort of). 1.01 Sat Oct 6 11:40:00 CEST 2012 - POD fix 1.00 Wed Aug 3 19:10:00 CEST 2011 - Rename module from ExtUtils::Typemap::Default to ExtUtils::Typemaps::Default. 0.06 Thu Aug 26 20:00:00 CEST 2010 - Fix various issues with vector typemaps 0.05 Thu Aug 19 20:00:00 CEST 2010 - Fix typemap interpolation problems 0.04 Thu Jul 15 20:00:00 CEST 2010 - size_t is of type T_UV, not T_IV 0.03 Thu Jul 15 20:00:00 CEST 2010 - Add basic types typemap - Add necessary 'use' statements. 0.02 Mon Jul 12 20:00:00 CEST 2010 - Add simple vector typemaps. 0.01 Mon Jun 28 20:00:00 CEST 2010 - First release. ExtUtils-Typemaps-Default-1.05/lib000755001750001750 012250406402 16226 5ustar00tseetsee000000000000ExtUtils-Typemaps-Default-1.05/lib/ExtUtils000755001750001750 012250406402 20007 5ustar00tseetsee000000000000ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemap000755001750001750 012250406402 21426 5ustar00tseetsee000000000000ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemap/Basic.pm000444001750001750 142612250406402 23145 0ustar00tseetsee000000000000package ExtUtils::Typemap::Basic; use strict; use warnings; use ExtUtils::Typemaps; use ExtUtils::Typemaps::Basic; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps::Basic); =head1 NAME ExtUtils::Typemap::Basic - A set of typemaps for simple types =head1 SYNOPSIS This module had to be renamed. Use L instead! =head1 DESCRIPTION This module had to be renamed. Use L instead! =head1 SEE ALSO L L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by 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-Typemaps-Default-1.05/lib/ExtUtils/Typemap/ObjectMap.pm000444001750001750 147212250406402 23771 0ustar00tseetsee000000000000package ExtUtils::Typemap::ObjectMap; use strict; use warnings; use ExtUtils::Typemaps; use ExtUtils::Typemaps::ObjectMap; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps::ObjectMap); =head1 NAME ExtUtils::Typemap::ObjectMap - A set of typemaps for opaque C/C++ objects =head1 SYNOPSIS This module had to be renamed. Use L instead! =head1 DESCRIPTION This module had to be renamed. Use L instead! =head1 SEE ALSO L L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by 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-Typemaps-Default-1.05/lib/ExtUtils/Typemap/Default.pm000444001750001750 143212250406402 23505 0ustar00tseetsee000000000000package ExtUtils::Typemap::Default; use strict; use warnings; use ExtUtils::Typemaps; use ExtUtils::Typemaps::Default; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps::Default); =head1 NAME ExtUtils::Typemap::Default - A set of useful typemaps =head1 SYNOPSIS This module had to be renamed. Use L instead! =head1 DESCRIPTION This module had to be renamed. Use L instead! =head1 SEE ALSO L L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by 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-Typemaps-Default-1.05/lib/ExtUtils/Typemap/STL.pm000444001750001750 140612250406402 22564 0ustar00tseetsee000000000000package ExtUtils::Typemap::STL; use strict; use warnings; use ExtUtils::Typemaps; use ExtUtils::Typemaps::STL; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps::STL); =head1 NAME ExtUtils::Typemap::STL - A set of useful typemaps for STL =head1 SYNOPSIS This module had to be renamed. Use L instead! =head1 DESCRIPTION This module had to be renamed. Use L instead! =head1 SEE ALSO L L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by 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-Typemaps-Default-1.05/lib/ExtUtils/Typemap/STL000755001750001750 012250406402 22070 5ustar00tseetsee000000000000ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemap/STL/String.pm000444001750001750 150412250406402 24031 0ustar00tseetsee000000000000package ExtUtils::Typemap::STL::String; use strict; use warnings; use ExtUtils::Typemaps; use ExtUtils::Typemaps::STL::String; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps::STL::String); =head1 NAME ExtUtils::Typemap::STL::String - A set of typemaps for STL std::strings =head1 SYNOPSIS This module had to be renamed. Use L instead! =head1 DESCRIPTION This module had to be renamed. Use L instead! =head1 SEE ALSO L L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by 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-Typemaps-Default-1.05/lib/ExtUtils/Typemap/STL/Vector.pm000444001750001750 150412250406402 24025 0ustar00tseetsee000000000000package ExtUtils::Typemap::STL::Vector; use strict; use warnings; use ExtUtils::Typemaps; use ExtUtils::Typemaps::STL::Vector; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps::STL::Vector); =head1 NAME ExtUtils::Typemap::STL::Vector - A set of typemaps for STL std::vectors =head1 SYNOPSIS This module had to be renamed. Use L instead! =head1 DESCRIPTION This module had to be renamed. Use L instead! =head1 SEE ALSO L L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by 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-Typemaps-Default-1.05/lib/ExtUtils/Typemaps000755001750001750 012250406402 21611 5ustar00tseetsee000000000000ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemaps/Basic.pm000444001750001750 406412250406402 23331 0ustar00tseetsee000000000000package ExtUtils::Typemaps::Basic; use strict; use warnings; use ExtUtils::Typemaps; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps); =head1 NAME ExtUtils::Typemaps::Basic - A set of typemaps for simple types =head1 SYNOPSIS use ExtUtils::Typemaps::Basic; # First, read my own type maps: my $private_map = ExtUtils::Typemaps->new(file => 'my.map'); # Then, get additional typemaps and merge them into mine $private_map->merge(typemap => ExtUtils::Typemaps::Basic->new); # Now, write the combined map to an output file $private_map->write(file => 'typemap'); =head1 DESCRIPTION C is an C subclass that provides a set of mappings for some basic integer, unsigned, and floating point types that aren't in perl's builtin typemap. =head1 METHODS These are the overridden methods: =head2 new Creates a new C object. It acts as any other C object, except that it has the object maps initialized. =cut sub new { my $class = shift; my @iv_types = (qw(int short long char), "short int", "long int", "long long"); my @uv_types = ((map {"unsigned $_"} @iv_types), qw(unsigned Uint16 Uint32 Uint64 size_t bool)); @iv_types = map {($_, "signed $_")} @iv_types; push @iv_types, qw(time_t Sint16 Sint32 Sint64); my @nv_types = (qw(float double), "long double"); my $map = "TYPEMAP\n"; $map .= "$_\tT_IV\n" for @iv_types; $map .= "$_\tT_UV\n" for @uv_types; $map .= "$_\tT_NV\n" for @nv_types; $map .= "const $_\tT_IV\n" for @iv_types; $map .= "const $_\tT_UV\n" for @uv_types; $map .= "const $_\tT_NV\n" for @nv_types; my $self = $class->SUPER::new(@_); $self->add_string(string => $map); return $self; } 1; __END__ =head1 SEE ALSO L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemaps/ObjectMap.pm000444001750001750 1161612250406402 24175 0ustar00tseetsee000000000000package ExtUtils::Typemaps::ObjectMap; use strict; use warnings; use ExtUtils::Typemaps; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps); =head1 NAME ExtUtils::Typemaps::ObjectMap - A set of typemaps for opaque C/C++ objects =head1 SYNOPSIS use ExtUtils::Typemaps::ObjectMap; # First, read my own type maps: my $private_map = ExtUtils::Typemaps->new(file => 'my.map'); # Then, get the object map set and merge it into my maps $private_map->merge(typemap => ExtUtils::Typemaps::ObjectMap->new); # Now, write the combined map to an output file $private_map->write(file => 'typemap'); =head1 DESCRIPTION C is an C subclass that provides a set of mappings for using pointers to C/C++ objects as opaque objects from Perl. These mappings are taken verbatim from Dean Roehrich's C. They are: # "perlobject.map" Dean Roehrich, version 19960302 # # TYPEMAPs # # HV * -> unblessed Perl HV object. # AV * -> unblessed Perl AV object. # # INPUT/OUTPUT maps # # O_* -> opaque blessed objects # T_* -> opaque blessed or unblessed objects # # O_OBJECT -> link an opaque C or C++ object to a blessed Perl object. # T_OBJECT -> link an opaque C or C++ object to an unblessed Perl object. # O_HvRV -> a blessed Perl HV object. # T_HvRV -> an unblessed Perl HV object. # O_AvRV -> a blessed Perl AV object. # T_AvRV -> an unblessed Perl AV object. =head1 METHODS These are the overridden methods: =head2 new Creates a new C object. It acts as any other C object, except that it has the object maps initialized. =cut sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->add_string(string => <<'END_TYPEMAP'); # "perlobject.map" Dean Roehrich, version 19960302 # # TYPEMAPs # # HV * -> unblessed Perl HV object. # AV * -> unblessed Perl AV object. # # INPUT/OUTPUT maps # # O_* -> opaque blessed objects # T_* -> opaque blessed or unblessed objects # # O_OBJECT -> link an opaque C or C++ object to a blessed Perl object. # T_OBJECT -> link an opaque C or C++ object to an unblessed Perl object. # O_HvRV -> a blessed Perl HV object. # T_HvRV -> an unblessed Perl HV object. # O_AvRV -> a blessed Perl AV object. # T_AvRV -> an unblessed Perl AV object. TYPEMAP HV * T_HvRV AV * T_AvRV ###################################################################### OUTPUT # The Perl object is blessed into 'CLASS', which should be a # char* having the name of the package for the blessing. O_OBJECT sv_setref_pv( $arg, CLASS, (void*)$var ); T_OBJECT sv_setref_pv( $arg, Nullch, (void*)$var ); # Cannot use sv_setref_pv() because that will destroy # the HV-ness of the object. Remember that newRV() will increment # the refcount. O_HvRV $arg = sv_bless( newRV((SV*)$var), gv_stashpv(CLASS,1) ); T_HvRV $arg = newRV((SV*)$var); # Cannot use sv_setref_pv() because that will destroy # the AV-ness of the object. Remember that newRV() will increment # the refcount. O_AvRV $arg = sv_bless( newRV((SV*)$var), gv_stashpv(CLASS,1) ); T_AvRV $arg = newRV((SV*)$var); ###################################################################### INPUT O_OBJECT if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) $var = ($type)SvIV((SV*)SvRV( $arg )); else{ warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } T_OBJECT if( SvROK($arg) ) $var = ($type)SvIV((SV*)SvRV( $arg )); else{ warn( \"${Package}::$func_name() -- $var is not an SV reference\" ); XSRETURN_UNDEF; } O_HvRV if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVHV) ) $var = (HV*)SvRV( $arg ); else { warn( \"${Package}::$func_name() -- $var is not a blessed HV reference\" ); XSRETURN_UNDEF; } T_HvRV if( SvROK($arg) && (SvTYPE(SvRV($arg)) == SVt_PVHV) ) $var = (HV*)SvRV( $arg ); else { warn( \"${Package}::$func_name() -- $var is not an HV reference\" ); XSRETURN_UNDEF; } O_AvRV if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVAV) ) $var = (AV*)SvRV( $arg ); else { warn( \"${Package}::$func_name() -- $var is not a blessed AV reference\" ); XSRETURN_UNDEF; } T_AvRV if( SvROK($arg) && (SvTYPE(SvRV($arg)) == SVt_PVAV) ) $var = (AV*)SvRV( $arg ); else { warn( \"${Package}::$func_name() -- $var is not an AV reference\" ); XSRETURN_UNDEF; } END_TYPEMAP return $self; } 1; __END__ =head1 SEE ALSO L, L, L =head1 AUTHOR The module was written by Steffen Mueller , but the important bit, the typemap, was written by Dean Roehrich. =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by Steffen Mueller Except for the typemap code, which is copyright 1996 Dean Roehrich This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemaps/Default.pm000444001750001750 361312250406402 23673 0ustar00tseetsee000000000000package ExtUtils::Typemaps::Default; use strict; use warnings; use ExtUtils::Typemaps; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps); require ExtUtils::Typemaps::ObjectMap; require ExtUtils::Typemaps::Basic; require ExtUtils::Typemaps::STL; =head1 NAME ExtUtils::Typemaps::Default - A set of useful typemaps =head1 SYNOPSIS use ExtUtils::Typemaps::Default; # First, read my own type maps: my $private_map = ExtUtils::Typemaps->new(file => 'my.map'); # Then, get the default set and merge it into my maps my $map = ExtUtils::Typemaps::Default->new; $private_map->merge(typemap => $map); # Now, write the combined map to an output file $private_map->write(file => 'typemap'); =head1 DESCRIPTION C is an C subclass that provides a set of default mappings (in addition to what perl itself provides). These default mappings are currently defined as the combination of the mappings provided by the following typemap classes which are provided in this distribution: L, L, L =head1 METHODS These are the overridden methods: =head2 new Creates a new C object. =cut sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->merge(typemap => ExtUtils::Typemaps::Basic->new); $self->merge(typemap => ExtUtils::Typemaps::ObjectMap->new); $self->merge(typemap => ExtUtils::Typemaps::STL->new); return $self; } 1; __END__ =head1 SEE ALSO L, L, L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemaps/STL.pm000444001750001750 374112250406402 22753 0ustar00tseetsee000000000000package ExtUtils::Typemaps::STL; use strict; use warnings; use ExtUtils::Typemaps; use ExtUtils::Typemaps::STL::Vector; use ExtUtils::Typemaps::STL::String; use ExtUtils::Typemaps::STL::List; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps); =head1 NAME ExtUtils::Typemaps::STL - A set of useful typemaps for STL =head1 SYNOPSIS use ExtUtils::Typemaps::STL; # First, read my own type maps: my $private_map = ExtUtils::Typemaps->new(file => 'my.map'); # Then, get the STL set and merge it into my maps my $map = ExtUtils::Typemaps::STL->new; $private_map->merge(typemap => $map); # Now, write the combined map to an output file $private_map->write(file => 'typemap'); =head1 DESCRIPTION C is an C subclass that provides a few of default mappings for Standard Template Library types. These default mappings are currently defined as the combination of the mappings provided by the following typemap classes which are provided in this distribution: L, L, L More are to come, patches are welcome. =head1 METHODS These are the overridden methods: =head2 new Creates a new C object. =cut sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->merge(typemap => ExtUtils::Typemaps::STL::String->new); $self->merge(typemap => ExtUtils::Typemaps::STL::Vector->new); $self->merge(typemap => ExtUtils::Typemaps::STL::List->new); return $self; } 1; __END__ =head1 SEE ALSO L, L L, L L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemaps/STL000755001750001750 012250406402 22253 5ustar00tseetsee000000000000ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemaps/STL/String.pm000444001750001750 440212250406402 24214 0ustar00tseetsee000000000000package ExtUtils::Typemaps::STL::String; use strict; use warnings; use ExtUtils::Typemaps; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps); =head1 NAME ExtUtils::Typemaps::STL::String - A set of typemaps for STL std::strings =head1 SYNOPSIS use ExtUtils::Typemaps::STL::String; # First, read my own type maps: my $private_map = ExtUtils::Typemaps->new(file => 'my.map'); # Then, get the object map set and merge it into my maps $private_map->merge(typemap => ExtUtils::Typemaps::STL::String->new); # Now, write the combined map to an output file $private_map->write(file => 'typemap'); =head1 DESCRIPTION C is an C subclass that provides a set of mappings for C++ STL strings. These are: TYPEMAP std::string T_STD_STRING std::string* T_STD_STRING_PTR INPUT T_STD_STRING $var = std::string( SvPV_nolen( $arg ), SvCUR( $arg ) ); T_STD_STRING_PTR $var = new std::string( SvPV_nolen( $arg ), SvCUR( $arg ) ); OUTPUT T_STD_STRING $arg = newSVpvn( $var.c_str(), $var.length() ); T_STD_STRING_PTR $arg = newSVpvn( $var->c_str(), $var->length() ); =head1 METHODS These are the overridden methods: =head2 new Creates a new C object. It acts as any other C object, except that it has the string type maps initialized. =cut sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->add_string(string => <<'END_TYPEMAP'); TYPEMAP std::string T_STD_STRING std::string* T_STD_STRING_PTR INPUT T_STD_STRING $var = std::string( SvPV_nolen( $arg ), SvCUR( $arg ) ); T_STD_STRING_PTR $var = new std::string( SvPV_nolen( $arg ), SvCUR( $arg ) ); OUTPUT T_STD_STRING $arg = newSVpvn( $var.c_str(), $var.length() ); T_STD_STRING_PTR $arg = newSVpvn( $var->c_str(), $var->length() ); END_TYPEMAP return $self; } 1; __END__ =head1 SEE ALSO L, L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemaps/STL/List.pm000444001750001750 2322312250406402 23703 0ustar00tseetsee000000000000package ExtUtils::Typemaps::STL::List; use strict; use warnings; use ExtUtils::Typemaps; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps); =head1 NAME ExtUtils::Typemaps::STL::List - A set of typemaps for STL std::lists =head1 SYNOPSIS use ExtUtils::Typemaps::STL::List; # First, read my own type maps: my $private_map = ExtUtils::Typemaps->new(file => 'my.map'); # Then, get the object map set and merge it into my maps $private_map->merge(typemap => ExtUtils::Typemaps::STL::List->new); # Now, write the combined map to an output file $private_map->write(file => 'typemap'); =head1 DESCRIPTION C is an C subclass that provides a set of mappings for C++ STL lists. These are: TYPEMAP std::list T_STD_LIST_DOUBLE std::list* T_STD_LIST_DOUBLE_PTR std::list T_STD_LIST_INT std::list* T_STD_LIST_INT_PTR std::list T_STD_LIST_UINT std::list* T_STD_LIST_UINT_PTR std::list T_STD_LIST_STD_STRING std::list* T_STD_LIST_STD_STRING_PTR std::list T_STD_LIST_CSTRING std::list* T_STD_LIST_CSTRING_PTR All of these mean that the lists are converted to references to Perl arrays and vice versa. =head1 METHODS These are the overridden methods: =head2 new Creates a new C object. It acts as any other C object, except that it has the list type maps initialized. =cut sub new { my $class = shift; my $self = $class->SUPER::new(@_); my $input_tmpl = <<'HERE'; !TYPENAME! if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int len = av_len(av)+1; $var = std::list(); SV** elem; for (unsigned int i = 0; i < len; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) ${var}.push_back(Sv!SHORTTYPE!V(*elem)); else ${var}[i].push_back(!DEFAULT!); } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); !TYPENAME!_PTR if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int len = av_len(av)+1; $var = new std::list(); SV** elem; for (unsigned int i = 0; i < len; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) (*$var).push_back(Sv!SHORTTYPE!V(*elem)); else (*$var).push_back(!DEFAULT!); } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); HERE my $output_tmpl = <<'HERE'; !TYPENAME! AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var.size(); // Technically may be linear... av_extend(av, len-1); unsigned int i = 0; std::list::const_iterator lend = $var.cend(); std::list::const_iterator lit = $var.cbegin(); for (; lit != lend; ++lit) { av_store(av, i++, newSV!SHORTTYPELC!v(*lit)); } !TYPENAME!_PTR AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var->size(); // Technically may be linear... av_extend(av, len-1); unsigned int i = 0; std::list::const_iterator lend = (*$var).cend(); std::list::const_iterator lit = (*$var).cbegin(); for (; lit != lend; ++lit) { av_store(av, i++, newSV!SHORTTYPELC!v(*lit)); } HERE my ($output_code, $input_code); # TYPENAME, TYPE, SHORTTYPE, SHORTTYPELC, DEFAULT foreach my $type ([qw(T_STD_LIST_DOUBLE double N n 0.)], [qw(T_STD_LIST_INT int I i 0)], [qw(T_STD_LIST_UINT), "unsigned int", qw(U u 0)]) { my @type = @$type; my $otmpl = $output_tmpl; my $itmpl = $input_tmpl; for ($otmpl, $itmpl) { s/!TYPENAME!/$type[0]/g; s/!TYPE!/$type[1]/g; s/!SHORTTYPE!/$type[2]/g; s/!SHORTTYPELC!/$type[3]/g; s/!DEFAULT!/$type[4]/g; } $output_code .= $otmpl; $input_code .= $itmpl; } # add a static part $output_code .= <<'END_OUTPUT'; T_STD_LIST_STD_STRING AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var.size(); // Technically may be linear... av_extend(av, len-1); unsigned int i = 0; std::list::const_iterator lend = $var.cend(); std::list::const_iterator lit = $var.cbegin(); for (; lit != lend; ++lit) { const std::string& str = *lit; STRLEN len = str.length(); av_store(av, i++, newSVpv(str.c_str(), len)); } T_STD_LIST_STD_STRING_PTR AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var->size(); // Technically may be linear... av_extend(av, len-1); unsigned int i = 0; std::list::const_iterator lend = (*$var).cend(); std::list::const_iterator lit = (*$var).cbegin(); for (; lit != lend; ++lit) { const std::string& str = *lit; STRLEN len = str.length(); av_store(av, i++, newSVpv(str.c_str(), len)); } T_STD_LIST_CSTRING AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var.size(); av_extend(av, len-1); unsigned int i = 0; std::list::const_iterator lend = $var.cend(); std::list::const_iterator lit = $var.cbegin(); for (; lit != lend; ++lit) { av_store(av, i, newSVpv(*lit, (STRLEN)strlen(*lit))); } T_STD_LIST_CSTRING_PTR AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var->size(); av_extend(av, len-1); unsigned int i = 0; std::list::const_iterator lend = (*$var).cend(); std::list::const_iterator lit = (*$var).cbegin(); for (; lit != lend; ++lit) { av_store(av, i, newSVpv(*lit, (STRLEN)strlen(*lit))); } END_OUTPUT # add a static part to input $input_code .= <<'END_INPUT'; T_STD_LIST_STD_STRING if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int alen = av_len(av)+1; $var = std::list(); STRLEN len; char* tmp; SV** elem; for (unsigned int i = 0; i < alen; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) { tmp = SvPV(*elem, len); ${var}.push_back(std::string(tmp, len)); } else ${var}.push_back(std::string(\"\")); } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); T_STD_LIST_STD_STRING_PTR if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int alen = av_len(av)+1; $var = new std::list(alen); STRLEN len; char* tmp; SV** elem; for (unsigned int i = 0; i < alen; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) { tmp = SvPV(*elem, len); (*$var).push_back(std::string(tmp, len)); } else (*$var).push_back(std::string(\"\")); } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); T_STD_LIST_CSTRING if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int len = av_len(av)+1; $var = std::list(); SV** elem; for (unsigned int i = 0; i < len; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) { ${var}.push_back(SvPV_nolen(*elem)); else ${var}.push_back(NULL); } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); T_STD_LIST_CSTRING_PTR if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int len = av_len(av)+1; $var = new std::list(); SV** elem; for (unsigned int i = 0; i < len; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) { (*$var).push_back(SvPV_nolen(*elem)); else (*$var).push_back(NULL); } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); END_INPUT my $typemap_code = <<'END_TYPEMAP'; TYPEMAP std::list* T_STD_LIST_DOUBLE_PTR std::list T_STD_LIST_DOUBLE std::list* T_STD_LIST_INT_PTR std::list T_STD_LIST_INT std::list* T_STD_LIST_UINT_PTR std::list T_STD_LIST_UINT std::list T_STD_LIST_STD_STRING std::list* T_STD_LIST_STD_STRING_PTR std::list T_STD_LIST_STD_STRING std::list* T_STD_LIST_STD_STRING_PTR std::list T_STD_LIST_CSTRING std::list* T_STD_LIST_CSTRING_PTR list* T_STD_LIST_DOUBLE_PTR list T_STD_LIST_DOUBLE list* T_STD_LIST_INT_PTR list T_STD_LIST_INT list* T_STD_LIST_UINT_PTR list T_STD_LIST_UINT list T_STD_LIST_STD_STRING list* T_STD_LIST_STD_STRING_PTR list T_STD_LIST_STD_STRING list* T_STD_LIST_STD_STRING_PTR list T_STD_LIST_CSTRING list* T_STD_LIST_CSTRING_PTR INPUT END_TYPEMAP $typemap_code .= $input_code; $typemap_code .= "\nOUTPUT\n"; $typemap_code .= $output_code; $typemap_code .= "\n"; $self->add_string(string => $typemap_code); return $self; } 1; __END__ =head1 SEE ALSO L, L, L, L, L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2013 by Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut ExtUtils-Typemaps-Default-1.05/lib/ExtUtils/Typemaps/STL/Vector.pm000444001750001750 2100112250406402 24222 0ustar00tseetsee000000000000package ExtUtils::Typemaps::STL::Vector; use strict; use warnings; use ExtUtils::Typemaps; our $VERSION = '1.05'; our @ISA = qw(ExtUtils::Typemaps); =head1 NAME ExtUtils::Typemaps::STL::Vector - A set of typemaps for STL std::vectors =head1 SYNOPSIS use ExtUtils::Typemaps::STL::Vector; # First, read my own type maps: my $private_map = ExtUtils::Typemaps->new(file => 'my.map'); # Then, get the object map set and merge it into my maps $private_map->merge(typemap => ExtUtils::Typemaps::STL::Vector->new); # Now, write the combined map to an output file $private_map->write(file => 'typemap'); =head1 DESCRIPTION C is an C subclass that provides a set of mappings for C++ STL vectors. These are: TYPEMAP std::vector T_STD_VECTOR_DOUBLE std::vector* T_STD_VECTOR_DOUBLE_PTR std::vector T_STD_VECTOR_INT std::vector* T_STD_VECTOR_INT_PTR std::vector T_STD_VECTOR_UINT std::vector* T_STD_VECTOR_UINT_PTR std::vector T_STD_VECTOR_STD_STRING std::vector* T_STD_VECTOR_STD_STRING_PTR std::vector T_STD_VECTOR_CSTRING std::vector* T_STD_VECTOR_CSTRING_PTR All of these mean that the vectors are converted to references to Perl arrays and vice versa. =head1 METHODS These are the overridden methods: =head2 new Creates a new C object. It acts as any other C object, except that it has the vector type maps initialized. =cut sub new { my $class = shift; my $self = $class->SUPER::new(@_); my $input_tmpl = <<'HERE'; !TYPENAME! if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int len = av_len(av)+1; $var = std::vector(len); SV** elem; for (unsigned int i = 0; i < len; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) ${var}[i] = Sv!SHORTTYPE!V(*elem); else ${var}[i] = !DEFAULT!; } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); !TYPENAME!_PTR if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int len = av_len(av)+1; $var = new std::vector(len); SV** elem; for (unsigned int i = 0; i < len; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) (*$var)[i] = Sv!SHORTTYPE!V(*elem); else (*$var)[i] = 0.; } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); HERE my $output_tmpl = <<'HERE'; !TYPENAME! AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var.size(); if (len) av_extend(av, len-1); for (unsigned int i = 0; i < len; i++) { av_store(av, i, newSV!SHORTTYPELC!v(${var}[i])); } !TYPENAME!_PTR AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var->size(); if (len) av_extend(av, len-1); for (unsigned int i = 0; i < len; i++) { av_store(av, i, newSV!SHORTTYPELC!v((*$var)[i])); } HERE my ($output_code, $input_code); # TYPENAME, TYPE, SHORTTYPE, SHORTTYPELC, DEFAULT foreach my $type ([qw(T_STD_VECTOR_DOUBLE double N n 0.)], [qw(T_STD_VECTOR_INT int I i 0)], [qw(T_STD_VECTOR_UINT), "unsigned int", qw(U u 0)]) { my @type = @$type; my $otmpl = $output_tmpl; my $itmpl = $input_tmpl; for ($otmpl, $itmpl) { s/!TYPENAME!/$type[0]/g; s/!TYPE!/$type[1]/g; s/!SHORTTYPE!/$type[2]/g; s/!SHORTTYPELC!/$type[3]/g; s/!DEFAULT!/$type[4]/g; } $output_code .= $otmpl; $input_code .= $itmpl; } # add a static part $output_code .= <<'END_OUTPUT'; T_STD_VECTOR_STD_STRING AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var.size(); if (len) av_extend(av, len-1); for (unsigned int i = 0; i < len; i++) { const std::string& str = ${var}[i]; STRLEN len = str.length(); av_store(av, i, newSVpv(str.c_str(), len)); } T_STD_VECTOR_STD_STRING_PTR AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var->size(); if (len) av_extend(av, len-1); for (unsigned int i = 0; i < len; i++) { const std::string& str = (*$var)[i]; STRLEN len = str.length(); av_store(av, i, newSVpv(str.c_str(), len)); } T_STD_VECTOR_CSTRING AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var.size(); if (len) av_extend(av, len-1); for (unsigned int i = 0; i < len; i++) { STRLEN len = strlen(${var}[i]); av_store(av, i, newSVpv(${var}[i], len)); } T_STD_VECTOR_CSTRING_PTR AV* av = newAV(); $arg = newRV_noinc((SV*)av); const unsigned int len = $var->size(); if (len) av_extend(av, len-1); for (unsigned int i = 0; i < len; i++) { STRLEN len = strlen((*$var)[i]); av_store(av, i, newSVpv((*$var)[i], len)); } END_OUTPUT # add a static part to input $input_code .= <<'END_INPUT'; T_STD_VECTOR_STD_STRING if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int alen = av_len(av)+1; $var = std::vector(alen); STRLEN len; char* tmp; SV** elem; for (unsigned int i = 0; i < alen; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) { tmp = SvPV(*elem, len); ${var}[i] = std::string(tmp, len); } else ${var}[i] = std::string(\"\"); } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); T_STD_VECTOR_STD_STRING_PTR if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int alen = av_len(av)+1; $var = new std::vector(alen); STRLEN len; char* tmp; SV** elem; for (unsigned int i = 0; i < alen; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) { tmp = SvPV(*elem, len); (*$var)[i] = std::string(tmp, len); } else (*$var)[i] = std::string(\"\"); } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); T_STD_VECTOR_CSTRING if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int len = av_len(av)+1; $var = std::vector(len); SV** elem; for (unsigned int i = 0; i < len; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) { ${var}[i] = SvPV_nolen(*elem); else ${var}[i] = NULL; } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); T_STD_VECTOR_CSTRING_PTR if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) { AV* av = (AV*)SvRV($arg); const unsigned int len = av_len(av)+1; $var = new std::vector(len); SV** elem; for (unsigned int i = 0; i < len; i++) { elem = av_fetch(av, i, 0); if (elem != NULL) { (*$var)[i] = SvPV_nolen(*elem); else (*$var)[i] = NULL; } } else Perl_croak(aTHX_ \"%s: %s is not an array reference\", ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, \"$var\"); END_INPUT my $typemap_code = <<'END_TYPEMAP'; TYPEMAP std::vector* T_STD_VECTOR_DOUBLE_PTR std::vector T_STD_VECTOR_DOUBLE std::vector* T_STD_VECTOR_INT_PTR std::vector T_STD_VECTOR_INT std::vector* T_STD_VECTOR_UINT_PTR std::vector T_STD_VECTOR_UINT std::vector T_STD_VECTOR_STD_STRING std::vector* T_STD_VECTOR_STD_STRING_PTR std::vector T_STD_VECTOR_CSTRING std::vector* T_STD_VECTOR_CSTRING_PTR INPUT END_TYPEMAP $typemap_code .= $input_code; $typemap_code .= "\nOUTPUT\n"; $typemap_code .= $output_code; $typemap_code .= "\n"; $self->add_string(string => $typemap_code); return $self; } 1; __END__ =head1 SEE ALSO L, L, L, L, L =head1 AUTHOR Steffen Mueller =head1 COPYRIGHT AND LICENSE Copyright 2010, 2011, 2012, 2013 by Steffen Mueller This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut ExtUtils-Typemaps-Default-1.05/t000755001750001750 012250406402 15723 5ustar00tseetsee000000000000ExtUtils-Typemaps-Default-1.05/t/001_basic.t000444001750001750 342412250406402 17711 0ustar00tseetsee000000000000#!/usr/bin/perl -w use strict; use Test::More tests => 26; use_ok( 'ExtUtils::Typemaps::STL::String' ); use_ok( 'ExtUtils::Typemaps::STL::Vector' ); use_ok( 'ExtUtils::Typemaps::STL::List' ); use_ok( 'ExtUtils::Typemaps::ObjectMap' ); use_ok( 'ExtUtils::Typemaps::Basic' ); use_ok( 'ExtUtils::Typemaps::STL' ); use_ok( 'ExtUtils::Typemaps::Default' ); my $omap = ExtUtils::Typemaps::ObjectMap->new(); isa_ok($omap, 'ExtUtils::Typemaps::ObjectMap'); isa_ok($omap, 'ExtUtils::Typemaps'); my $bmap = ExtUtils::Typemaps::Basic->new(); isa_ok($bmap, 'ExtUtils::Typemaps::Basic'); isa_ok($bmap, 'ExtUtils::Typemaps'); my $smap = ExtUtils::Typemaps::STL::String->new(); isa_ok($smap, 'ExtUtils::Typemaps::STL::String'); isa_ok($smap, 'ExtUtils::Typemaps'); my $vmap = ExtUtils::Typemaps::STL::Vector->new(); isa_ok($vmap, 'ExtUtils::Typemaps::STL::Vector'); isa_ok($vmap, 'ExtUtils::Typemaps'); my $lmap = ExtUtils::Typemaps::STL::List->new(); isa_ok($lmap, 'ExtUtils::Typemaps::STL::List'); isa_ok($lmap, 'ExtUtils::Typemaps'); my $stl = ExtUtils::Typemaps::STL->new; isa_ok($stl, 'ExtUtils::Typemaps'); my $stlm = ExtUtils::Typemaps->new; isa_ok($stlm, 'ExtUtils::Typemaps'); $stlm->merge(typemap => $smap); $stlm->merge(typemap => $vmap); $stlm->merge(typemap => $lmap); ok($stl->as_string =~ /\S/); is($stl->as_string, $stlm->as_string, "manually merged STL and STL are the same"); my $merged = ExtUtils::Typemaps->new; isa_ok($merged, 'ExtUtils::Typemaps'); $merged->merge(typemap => $bmap); $merged->merge(typemap => $omap); $merged->merge(typemap => $stl); my $def = ExtUtils::Typemaps::Default->new(); isa_ok($def, 'ExtUtils::Typemaps::Default'); isa_ok($def, 'ExtUtils::Typemaps'); ok($def->as_string =~ /\S/); is($def->as_string, $merged->as_string, "manually merged and default are the same");