diff options
author | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2005-02-02 21:26:14 +0000 |
---|---|---|
committer | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2005-02-02 21:26:14 +0000 |
commit | 9b5c3821be1f2a9a84772171c8bbadbf9cfc4a53 (patch) | |
tree | 4b5ecf8fab09757c501d691471658ab6d039283d /ext | |
parent | 21c16052ffb70c4bff066e455c6d4bea74622e34 (diff) | |
download | perl-9b5c3821be1f2a9a84772171c8bbadbf9cfc4a53.tar.gz |
Attempt to fix problems with new exception handling macros.
p4raw-id: //depot/perl@23925
Diffstat (limited to 'ext')
-rw-r--r-- | ext/XS/APItest/APItest.xs | 28 | ||||
-rw-r--r-- | ext/XS/APItest/MANIFEST | 1 | ||||
-rw-r--r-- | ext/XS/APItest/Makefile.PL | 2 | ||||
-rw-r--r-- | ext/XS/APItest/exception.c | 33 |
4 files changed, 38 insertions, 26 deletions
diff --git a/ext/XS/APItest/APItest.xs b/ext/XS/APItest/APItest.xs index 9b7da1226d..fcdcc9a03c 100644 --- a/ext/XS/APItest/APItest.xs +++ b/ext/XS/APItest/APItest.xs @@ -2,32 +2,8 @@ #include "perl.h" #include "XSUB.h" -static void throws_exception(int throw_e) -{ - if (throw_e) - croak("boo\n"); -} - -static int exception(int throw_e) -{ - dTHR; - dXCPT; - SV *caught = get_sv("XS::APItest::exception_caught", 0); - - XCPT_TRY_START { - throws_exception(throw_e); - } XCPT_TRY_END - - XCPT_CATCH - { - sv_setiv(caught, 1); - XCPT_RETHROW; - } - - sv_setiv(caught, 0); - - return 42; -} +/* from exception.c */ +int exception(int); MODULE = XS::APItest:Hash PACKAGE = XS::APItest::Hash diff --git a/ext/XS/APItest/MANIFEST b/ext/XS/APItest/MANIFEST index 1feded88b8..a8cfd5f05d 100644 --- a/ext/XS/APItest/MANIFEST +++ b/ext/XS/APItest/MANIFEST @@ -3,6 +3,7 @@ MANIFEST README APItest.pm APItest.xs +exception.c t/call.t t/hash.t t/printf.t diff --git a/ext/XS/APItest/Makefile.PL b/ext/XS/APItest/Makefile.PL index 4ff940394a..e49da36e08 100644 --- a/ext/XS/APItest/Makefile.PL +++ b/ext/XS/APItest/Makefile.PL @@ -9,6 +9,8 @@ WriteMakefile( ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'APItest.pm', # retrieve abstract from module AUTHOR => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>') : ()), + 'C' => ['exception.c'], + 'OBJECT' => '$(BASEEXT)$(OBJ_EXT) $(O_FILES)', 'LIBS' => [''], # e.g., '-lm' 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' 'INC' => '-I.', # e.g., '-I. -I/usr/include/other' diff --git a/ext/XS/APItest/exception.c b/ext/XS/APItest/exception.c new file mode 100644 index 0000000000..9477ea95f8 --- /dev/null +++ b/ext/XS/APItest/exception.c @@ -0,0 +1,33 @@ +#include "EXTERN.h" +#include "perl.h" + +#define NO_XSLOCKS +#include "XSUB.h" + +static void throws_exception(int throw_e) +{ + if (throw_e) + croak("boo\n"); +} + +int exception(int throw_e) +{ + dTHR; + dXCPT; + SV *caught = get_sv("XS::APItest::exception_caught", 0); + + XCPT_TRY_START { + throws_exception(throw_e); + } XCPT_TRY_END + + XCPT_CATCH + { + sv_setiv(caught, 1); + XCPT_RETHROW; + } + + sv_setiv(caught, 0); + + return 42; +} + |