r52226 - in /branches/upstream/libextutils-xspp-perl/current: ./ lib/ExtUtils/ lib/ExtUtils/XSpp/ t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Feb 6 21:51:58 UTC 2010


Author: jawnsy-guest
Date: Sat Feb  6 21:51:31 2010
New Revision: 52226

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52226
Log:
[svn-upgrade] Integrating new upstream version, libextutils-xspp-perl (0.08)

Modified:
    branches/upstream/libextutils-xspp-perl/current/Changes
    branches/upstream/libextutils-xspp-perl/current/META.yml
    branches/upstream/libextutils-xspp-perl/current/README
    branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pm
    branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pod
    branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp/Node.pm
    branches/upstream/libextutils-xspp-perl/current/t/005_io.t
    branches/upstream/libextutils-xspp-perl/current/t/010_base.t
    branches/upstream/libextutils-xspp-perl/current/t/011_multiple_files.t
    branches/upstream/libextutils-xspp-perl/current/t/015_reference.t
    branches/upstream/libextutils-xspp-perl/current/t/020_rename.t
    branches/upstream/libextutils-xspp-perl/current/t/022_static.t
    branches/upstream/libextutils-xspp-perl/current/t/023_base_classes.t
    branches/upstream/libextutils-xspp-perl/current/t/030_code_blocks.t
    branches/upstream/libextutils-xspp-perl/current/t/031_verbatim_blocks.t
    branches/upstream/libextutils-xspp-perl/current/t/035_include.t
    branches/upstream/libextutils-xspp-perl/current/t/040_plugin.t
    branches/upstream/libextutils-xspp-perl/current/t/075_types.t
    branches/upstream/libextutils-xspp-perl/current/t/080_complex_typemap.t

Modified: branches/upstream/libextutils-xspp-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/Changes?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/Changes (original)
+++ branches/upstream/libextutils-xspp-perl/current/Changes Sat Feb  6 21:51:31 2010
@@ -1,4 +1,10 @@
 Revision history for Perl extension ExtUtils::XSpp.
+
+0.08  Fri Feb  5 19:00:00 CET 2010
+	- Catch all C++ exceptions in the generated wrapper XS.
+          The exceptions are turned into plain Perl croak() calls
+          for now but may be upgraded to configurable exception
+          objects later. (Steffen Mueller)
 
 0.07  Fri Jan 22 18:07:10 CET 2010
 	- Fix issue with references as method arguments that have

Modified: branches/upstream/libextutils-xspp-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/META.yml?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/META.yml (original)
+++ branches/upstream/libextutils-xspp-perl/current/META.yml Sat Feb  6 21:51:31 2010
@@ -1,24 +1,22 @@
 ---
-name: ExtUtils-XSpp
-version: 0.07
+abstract: 'XS for C++'
 author:
   - 'Mattia Barbon <mbarbon at cpan.org>'
-abstract: XS for C++
-license: perl
-resources:
-  license: http://dev.perl.org/licenses/
 build_requires:
   Test::Base: 0
   Test::Differences: 0
-requires:
-  ExtUtils::ParseXS: 2.22
-  perl: v5.6.1
 configure_requires:
-  Module::Build: 0.35
+  Module::Build: 0.36
+generated_by: 'Module::Build version 0.3603'
+license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: ExtUtils-XSpp
 provides:
   ExtUtils::XSpp:
     file: lib/ExtUtils/XSpp.pm
-    version: 0.07
+    version: 0.08
   ExtUtils::XSpp::Cmd:
     file: lib/ExtUtils/XSpp/Cmd.pm
   ExtUtils::XSpp::Driver:
@@ -66,7 +64,9 @@
     file: lib/ExtUtils/XSpp/Typemap.pm
   ExtUtils::XSpp::Typemap::simple:
     file: lib/ExtUtils/XSpp/Typemap.pm
-generated_by: Module::Build version 0.35
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+requires:
+  ExtUtils::ParseXS: 2.22
+  perl: v5.6.1
+resources:
+  license: http://dev.perl.org/licenses/
+version: 0.08

Modified: branches/upstream/libextutils-xspp-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/README?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/README (original)
+++ branches/upstream/libextutils-xspp-perl/current/README Sat Feb  6 21:51:31 2010
@@ -2,12 +2,21 @@
     ExtUtils::XSpp - XS for C++
 
 SYNOPSIS
-      xspp [--typemap=typemap.xsp [--typemap=typemap2.xsp]] Foo.xsp
+      xspp [--typemap=typemap.xsp [--typemap=typemap2.xsp]]
+           [--xsubpp[=/path/to/xsubpp] [--xsubpp-args="xsubpp args"]
+           Foo.xsp
 
-    In Foo.xs (all in one line):
+    or
 
-      INCLUDE: perl -S xspp --typemap=typemap.xsp
-               Foo.xsp |
+      perl -MExtUtils::XSpp::Cmd -e xspp -- <xspp options and arguments>
+
+    In Foo.xs
+
+      INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- <xspp options/arguments>
+
+    Using "ExtUtils::XSpp::Cmd" is equivalent to using the "xspp" command
+    line script, except that there is no guarantee for "xspp" to be
+    installed in the system PATH.
 
 OVERVIEW
     XS++ is just a thin layer over plain XS, hence to use it you are
@@ -15,6 +24,20 @@
 
     This means that you will need typemaps for both the normal XS
     pre-processor *xsubpp* and the XS++ pre-processor *xspp*.
+
+COMMAND LINE
+  "--typemap=/path/to/typemap.xsp"
+    Can be specified multiple times to process additional typemap files
+    before the main XS++ input files. Typemap files are processed the same
+    way as regular XS++ files, except that output code is discarded.
+
+  "--xsubpp[=/path/to/xsubpp]"
+    If specified, XS++ will run xsubpp after processing the XS++ input file.
+    If the path to xsubpp is not specified, xspp expects to find it in the
+    system PATH.
+
+  "--xsubpp-args="extra xsubpp args""
+    Can be used to pass additional command line arguments to xsubpp.
 
 TYPEMAPS
     There is nothing special about typemap files (i.e. you can put typemaps
@@ -50,7 +73,9 @@
       %}
 
   %code
-    See under Classes.
+    See under Classes. Note that custom %code blocks are the only exception
+    to the exception handling. By specifying a custom %code block, you forgo
+    the automatic exception handlers.
 
   %file
       %file{file/path.h};
@@ -77,8 +102,22 @@
   %typemap
     See TYPEMAPS above.
 
+  %length
+    When you need to pass a string from Perl to an XSUB that takes the C
+    string and its length as arguments, you may have XS++ pass the length of
+    the string automatically. For example, if you declare a method as
+    follows,
+
+      void PrintLine( char* line, unsigned int %length{line} );
+
+    you can call the method from Perl like this:
+
+      $object->PrintLine( $string );
+
+    This feature is also present in plain XS. See also: perlxs
+
   Classes
-      %name{My::Class} class MyClass
+      %name{My::Class} class MyClass : public %name{My::Base} MyBase
       {
           // can be called in Perl as My::Class->new( ... );
           MyClass( int arg );
@@ -100,9 +139,18 @@
       };
 
   Comments
-    C-style "/* ... */" comments will be passed through unchanged. C++-style
-    comments "// ..." will be passed throug with the leading "//" replaced
-    with "##".
+    XS++ recognizes both C-style comments "/* ... */" and C++-style comments
+    "// ...". Comments are removed from the XS output.
+
+  Exceptions
+    C++ Exceptions are always caught and transformed to Perl "croak()"
+    calls. If the exception that was caught inherited from "std::exception",
+    then the "what()" message is included in the Perl-level error message.
+    All other exceptions will result in the "croak()" message "Caught
+    unhandled C++ exception of unknown type".
+
+    Note that if you supply a custom %code block for a function or method,
+    the automatic exception handling is turned off.
 
 AUTHOR
     Mattia Barbon <mbarbon at cpan.org>

Modified: branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pm?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pm (original)
+++ branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pm Sat Feb  6 21:51:31 2010
@@ -5,6 +5,6 @@
 
 use ExtUtils::XSpp::Driver;
 
-our $VERSION = '0.07';
+our $VERSION = '0.08';
 
 1;

Modified: branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pod?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pod (original)
+++ branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp.pod Sat Feb  6 21:51:31 2010
@@ -83,7 +83,9 @@
 
 =head2 %code
 
-See under B<Classes>.
+See under B<Classes>. Note that custom C<%code> blocks are the only
+exception to the exception handling. By specifying a custom C<%code>
+block, you forgo the automatic exception handlers.
 
 =head2 %file
 
@@ -157,6 +159,17 @@
 XS++ recognizes both C-style comments C</* ... */> and C++-style
 comments C<// ...>.  Comments are removed from the XS output.
 
+=head2 Exceptions
+
+C++ Exceptions are always caught and transformed to Perl C<croak()>
+calls. If the exception that was caught inherited from C<std::exception>,
+then the C<what()> message is included in the Perl-level error message.
+All other exceptions will result in the C<croak()> message
+C<"Caught unhandled C++ exception of unknown type">.
+
+Note that if you supply a custom C<%code> block for a function or method,
+the automatic exception handling is turned off.
+
 =head1 AUTHOR
 
 Mattia Barbon <mbarbon at cpan.org>

Modified: branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp/Node.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp/Node.pm?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp/Node.pm (original)
+++ branches/upstream/libextutils-xspp-perl/current/lib/ExtUtils/XSpp/Node.pm Sat Feb  6 21:51:31 2010
@@ -397,21 +397,37 @@
   }
 
   my $has_ret = $ret_typemap && !$ret_typemap->type->is_void;
+
+  # Hardcoded to one because we force the exception handling for now
+  # All the hard work above about determining whether $need_call_function
+  # needs to be enabled is left in as exception handling may be subject
+  # to configuration later. --Steffen
+  $need_call_function = 1;
+
   if( $need_call_function ) {
     my $ccode = $this->_call_code( $call_arg_list );
-    if( $has_ret && defined $ret_typemap->call_function_code( '', '' ) ) {
+    if ($this->isa('ExtUtils::XSpp::Node::Destructor')) {
+      $ccode = 'delete THIS';
+      $has_ret = 0;
+    } elsif( $has_ret && defined $ret_typemap->call_function_code( '', '' ) ) {
       $ccode = $ret_typemap->call_function_code( $ccode, 'RETVAL' );
     } elsif( $has_ret ) {
       $ccode = "RETVAL = $ccode";
     }
 
     $code .= "  CODE:\n";
-    $code .= '    ' . $precall if $precall;
-    $code .= '    ' . $ccode . ";\n";
-
+    $code .= "    try {\n";
+    $code .= '      ' . $precall if $precall;
+    $code .= '      ' . $ccode . ";\n";
     if( $has_ret && defined $ret_typemap->output_code ) {
-      $code .= '    ' . $ret_typemap->output_code . ";\n";
+      $code .= '      ' . $ret_typemap->output_code . ";\n";
     }
+    $code .= "    } catch (std::exception& e) {\n";
+    $code .= '      croak("Caught unhandled C++ exception: %s", e.what());' . "\n";
+    $code .= "    } catch (...) {\n";
+    $code .= '      croak("Caught unhandled C++ exception of unknown type");' . "\n";
+    $code .= "    }\n";
+
     $output = "  OUTPUT: RETVAL\n" if $has_ret;
 
     if( $has_ret && defined $ret_typemap->cleanup_code ) {
@@ -422,7 +438,9 @@
 
   if( $this->code ) {
     $code = "  CODE:\n    " . join( "\n", @{$this->code} ) . "\n";
-    $output = "  OUTPUT: RETVAL\n" if $code =~ m/RETVAL/;
+    # cleanup potential multiple newlines because they break XSUBs
+    $code =~ s/^\s*\z//m;
+    $output = "  OUTPUT: RETVAL\n" if $code =~ m/\bRETVAL\b/;
   }
   if( $this->postcall ) {
     $postcall = "  POSTCALL:\n    " . join( "\n", @{$this->postcall} ) . "\n";

Modified: branches/upstream/libextutils-xspp-perl/current/t/005_io.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/005_io.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/005_io.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/005_io.t Sat Feb  6 21:51:31 2010
@@ -43,6 +43,15 @@
     int a
     int b
     int c
+  CODE:
+    try {
+      RETVAL = foo( a, b, c );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 EOT
 

Modified: branches/upstream/libextutils-xspp-perl/current/t/010_base.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/010_base.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/010_base.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/010_base.t Sat Feb  6 21:51:31 2010
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use t::lib::XSP::Test tests => 11;
+use t::lib::XSP::Test tests => 12;
 
 run_diff xsp_stdout => 'expected';
 
@@ -26,6 +26,15 @@
     int a
     int b
     int c
+  CODE:
+    try {
+      RETVAL = THIS->foo( a, b, c );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 === Empty class
 --- xsp_stdout
@@ -53,6 +62,15 @@
 int
 foo( a )
     int a
+  CODE:
+    try {
+      RETVAL = foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 === Default arguments
 --- xsp_stdout
@@ -70,6 +88,15 @@
 int
 Foo::foo( a = 1 )
     int a
+  CODE:
+    try {
+      RETVAL = THIS->foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 === Constructor
 --- xsp_stdout
@@ -87,6 +114,15 @@
 Foo*
 Foo::new( a = 1 )
     int a
+  CODE:
+    try {
+      RETVAL = new Foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 === Destructor
 --- xsp_stdout
@@ -103,6 +139,14 @@
 
 void
 Foo::DESTROY()
+  CODE:
+    try {
+      delete THIS;
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 === Void function
 --- xsp_stdout
@@ -120,6 +164,14 @@
 void
 Foo::foo( a )
     int a
+  CODE:
+    try {
+      THIS->foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 === No parameters
 --- xsp_stdout
@@ -136,6 +188,14 @@
 
 void
 Foo::foo()
+  CODE:
+    try {
+      THIS->foo();
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 === Comments and raw blocks
 --- xsp_stdout
@@ -197,6 +257,15 @@
     int a
     int b
     int c
+  CODE:
+    try {
+      RETVAL = THIS->foo( a, b, c );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 # after method
 
@@ -215,6 +284,15 @@
 
 unsigned int
 bar( char* line, unsigned long length(line) )
+  CODE:
+    try {
+      RETVAL = bar( line, length(line) );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 === various integer types
 --- xsp_stdout
 %module{Foo};
@@ -238,3 +316,35 @@
     unsigned short f
     long g
     unsigned long h
+  CODE:
+    try {
+      RETVAL = bar( a, b, c, d, e, f, g, h );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
+=== verbatim code blocks for xsubs
+--- xsp_stdout
+%module{Wx};
+
+%typemap{wxRichTextCtrl}{simple};
+%name{Wx::RichTextCtrl} class wxRichTextCtrl
+{
+    %name{newDefault} wxRichTextCtrl()
+        %code{% RETVAL = new wxRichTextCtrl();
+                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
+             %};
+};
+--- expected
+MODULE=Wx
+
+MODULE=Wx PACKAGE=Wx::RichTextCtrl
+
+static wxRichTextCtrl*
+wxRichTextCtrl::newDefault()
+  CODE:
+     RETVAL = new wxRichTextCtrl();
+                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
+  OUTPUT: RETVAL

Modified: branches/upstream/libextutils-xspp-perl/current/t/011_multiple_files.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/011_multiple_files.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/011_multiple_files.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/011_multiple_files.t Sat Feb  6 21:51:31 2010
@@ -32,6 +32,15 @@
     int a
     int b
     int c
+  CODE:
+    try {
+      RETVAL = foo( a, b, c );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 === Basic file - external file
 --- process xsp_file=foo.h
@@ -64,3 +73,12 @@
 int
 bar( x )
     int x
+  CODE:
+    try {
+      RETVAL = bar( x );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL

Modified: branches/upstream/libextutils-xspp-perl/current/t/015_reference.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/015_reference.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/015_reference.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/015_reference.t Sat Feb  6 21:51:31 2010
@@ -25,7 +25,13 @@
 Foo::foo( a )
     Foo* a
   CODE:
-    THIS->foo( *( a ) );
+    try {
+      THIS->foo( *( a ) );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 === Reference in return value
 --- xsp_stdout
@@ -43,6 +49,12 @@
 Foo*
 Foo::foo()
   CODE:
-    RETVAL = new Foo( THIS->foo() );
+    try {
+      RETVAL = new Foo( THIS->foo() );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 

Modified: branches/upstream/libextutils-xspp-perl/current/t/020_rename.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/020_rename.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/020_rename.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/020_rename.t Sat Feb  6 21:51:31 2010
@@ -24,7 +24,13 @@
 boo( a )
     int a
   CODE:
-    RETVAL = foo( a );
+    try {
+      RETVAL = foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 
 MODULE=Foo PACKAGE=moo
@@ -33,7 +39,13 @@
 boo( a )
     int a
   CODE:
-    RETVAL = foo( a );
+    try {
+      RETVAL = foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 
 === Renamed method
@@ -53,7 +65,13 @@
 Foo::bar( a )
     int a
   CODE:
-    RETVAL = THIS->foo( a );
+    try {
+      RETVAL = THIS->foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 
 === Renamed constructor
@@ -73,7 +91,13 @@
 Foo::newFoo( a )
     int a
   CODE:
-    RETVAL = new Foo( a );
+    try {
+      RETVAL = new Foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 
 === Renamed class
@@ -92,10 +116,24 @@
 
 void
 Foo::foo()
+  CODE:
+    try {
+      THIS->foo();
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 int
 Foo::foo_int( a )
     int a
   CODE:
-    RETVAL = THIS->foo( a );
+    try {
+      RETVAL = THIS->foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL

Modified: branches/upstream/libextutils-xspp-perl/current/t/022_static.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/022_static.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/022_static.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/022_static.t Sat Feb  6 21:51:31 2010
@@ -25,5 +25,11 @@
 Foo::foo( a )
     int a
   CODE:
-    RETVAL = Foo::foo( a );
+    try {
+      RETVAL = Foo::foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL

Modified: branches/upstream/libextutils-xspp-perl/current/t/023_base_classes.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/023_base_classes.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/023_base_classes.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/023_base_classes.t Sat Feb  6 21:51:31 2010
@@ -23,6 +23,14 @@
 
 void
 Foo::foo()
+  CODE:
+    try {
+      THIS->foo();
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 BOOT:
     {
@@ -45,6 +53,14 @@
 
 void
 Foo::foo()
+  CODE:
+    try {
+      THIS->foo();
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 BOOT:
     {

Modified: branches/upstream/libextutils-xspp-perl/current/t/030_code_blocks.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/030_code_blocks.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/030_code_blocks.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/030_code_blocks.t Sat Feb  6 21:51:31 2010
@@ -43,7 +43,13 @@
 boo( a )
     int a
   CODE:
-    RETVAL = foo( a );
+    try {
+      RETVAL = foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
   CLEANUP:
      free( it ); 
@@ -63,6 +69,14 @@
 int
 foo( a )
     int a
+  CODE:
+    try {
+      RETVAL = foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   POSTCALL:
      blub( a ); 
   OUTPUT: RETVAL
@@ -121,5 +135,13 @@
 void
 foo( a )
     int a
+  CODE:
+    try {
+      foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   POSTCALL:
      blub( a ); 

Modified: branches/upstream/libextutils-xspp-perl/current/t/031_verbatim_blocks.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/031_verbatim_blocks.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/031_verbatim_blocks.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/031_verbatim_blocks.t Sat Feb  6 21:51:31 2010
@@ -47,3 +47,13 @@
 int
 X::foo( a )
     int a
+  CODE:
+    try {
+      RETVAL = THIS->foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
+

Modified: branches/upstream/libextutils-xspp-perl/current/t/035_include.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/035_include.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/035_include.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/035_include.t Sat Feb  6 21:51:31 2010
@@ -27,7 +27,25 @@
 int
 foo( x )
     int x
+  CODE:
+    try {
+      RETVAL = foo( x );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 int
 bar( y )
     int y
+  CODE:
+    try {
+      RETVAL = bar( y );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL

Modified: branches/upstream/libextutils-xspp-perl/current/t/040_plugin.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/040_plugin.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/040_plugin.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/040_plugin.t Sat Feb  6 21:51:31 2010
@@ -38,7 +38,13 @@
 foo_perl( y )
     int y
   CODE:
-    RETVAL = foo( y );
+    try {
+      RETVAL = foo( y );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 
 
@@ -46,6 +52,15 @@
 
 void
 Y::bar()
+  CODE:
+    try {
+      THIS->bar();
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+
 === Plugin loading from the plugin namespace
 --- xsp_stdout
 %module{Foo};
@@ -67,7 +82,13 @@
 foo_perl2( y )
     int y
   CODE:
-    RETVAL = foo( y );
+    try {
+      RETVAL = foo( y );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 
 
@@ -75,3 +96,11 @@
 
 void
 Y::bar()
+  CODE:
+    try {
+      THIS->bar();
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }

Modified: branches/upstream/libextutils-xspp-perl/current/t/075_types.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/075_types.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/075_types.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/075_types.t Sat Feb  6 21:51:31 2010
@@ -25,10 +25,28 @@
 
 int*
 foo()
+  CODE:
+    try {
+      RETVAL = foo();
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 int*
 boo( a )
     const int* a
+  CODE:
+    try {
+      RETVAL = boo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 === Const value/const reference type
 --- xsp_stdout
@@ -48,12 +66,26 @@
 void
 foo( a )
     const std::string a
+  CODE:
+    try {
+      foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 void
 boo( a )
     std::string* a
   CODE:
-    boo( *( a ) );
+    try {
+      boo( *( a ) );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 === Template type
 --- xsp_stdout
@@ -75,10 +107,26 @@
 void
 foo( a )
     const std::vector< int >& a
+  CODE:
+    try {
+      foo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 
 void
 boo( a )
     const std::map< int, std::string > a
+  CODE:
+    try {
+      boo( a );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
 === Template argument transformed to pointer
 --- xsp_stdout
 %module{Foo};
@@ -97,4 +145,10 @@
 foo( a )
     std::vector< double >* a
   CODE:
-    foo( *( a ) );
+    try {
+      foo( *( a ) );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }

Modified: branches/upstream/libextutils-xspp-perl/current/t/080_complex_typemap.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-xspp-perl/current/t/080_complex_typemap.t?rev=52226&op=diff
==============================================================================
--- branches/upstream/libextutils-xspp-perl/current/t/080_complex_typemap.t (original)
+++ branches/upstream/libextutils-xspp-perl/current/t/080_complex_typemap.t Sat Feb  6 21:51:31 2010
@@ -27,6 +27,15 @@
 Foo::foo( a, b )
     foobar a
     foobar b
+  CODE:
+    try {
+      RETVAL = THIS->foo( a, b );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
+  OUTPUT: RETVAL
 
 === Complex typemap, custom return value conversion
 --- xsp_stdout
@@ -48,7 +57,13 @@
     int a
     int b
   CODE:
-     RETVAL = fancy_conversion( THIS->foo( a, b ) ) ;
+    try {
+       RETVAL = fancy_conversion( THIS->foo( a, b ) ) ;
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 
 === Complex typemap, output code
@@ -71,8 +86,14 @@
     int a
     int b
   CODE:
-    RETVAL = THIS->foo( a, b );
-     custom_code( RETVAL ) ;
+    try {
+      RETVAL = THIS->foo( a, b );
+       custom_code( RETVAL ) ;
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
 
 === Complex typemap, cleanup code
@@ -95,7 +116,13 @@
     int a
     int b
   CODE:
-    RETVAL = THIS->foo( a, b );
+    try {
+      RETVAL = THIS->foo( a, b );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL
   CLEANUP:
      custom_code( ST(0), RETVAL ) ;
@@ -121,7 +148,13 @@
     int a
     int b
   CODE:
-     custom_code( ST(1), RETVAL ) ;
+    try {
+       custom_code( ST(1), RETVAL ) ;
  custom_code( ST(2), RETVAL ) ;
-    RETVAL = THIS->foo( a, b );
+      RETVAL = THIS->foo( a, b );
+    } catch (std::exception& e) {
+      croak("Caught unhandled C++ exception: %s", e.what());
+    } catch (...) {
+      croak("Caught unhandled C++ exception of unknown type");
+    }
   OUTPUT: RETVAL




More information about the Pkg-perl-cvs-commits mailing list