summaryrefslogtreecommitdiff
path: root/XSUB.h
diff options
context:
space:
mode:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>2005-01-31 18:00:31 +0000
committerMarcus Holland-Moritz <mhx-perl@gmx.net>2005-01-31 18:00:31 +0000
commit0ca3a8747a809cd312a4430d331d6b34d04f27c0 (patch)
tree49370b8724ddf86db64503cc049773fed4d33b69 /XSUB.h
parent4b5bf9a685821e2bf3efb2542e8e8d6ca57c3194 (diff)
downloadperl-0ca3a8747a809cd312a4430d331d6b34d04f27c0.tar.gz
Add simple exception handling macros for XS writers.
p4raw-id: //depot/perl@23911
Diffstat (limited to 'XSUB.h')
-rw-r--r--XSUB.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/XSUB.h b/XSUB.h
index 8d8de8d033..6751572c8a 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -192,6 +192,24 @@ Macro to verify that a PM module's $VERSION variable matches the XS
module's C<XS_VERSION> variable. This is usually handled automatically by
C<xsubpp>. See L<perlxs/"The VERSIONCHECK: Keyword">.
+=head1 Simple Exception Handling Macros
+
+=for apidoc Ams||dXCPT
+Set up neccessary local variables for exception handling.
+See L<perlguts/"Exception Handling">.
+
+=for apidoc AmU||XCPT_TRY_START
+Starts a try block. See L<perlguts/"Exception Handling">.
+
+=for apidoc AmU||XCPT_TRY_END
+Ends a try block. See L<perlguts/"Exception Handling">.
+
+=for apidoc AmU||XCPT_CATCH
+Introduces a catch block. See L<perlguts/"Exception Handling">.
+
+=for apidoc Ams||XCPT_RETHROW
+Rethrows a previously caught exception. See L<perlguts/"Exception Handling">.
+
=cut
*/
@@ -254,6 +272,12 @@ C<xsubpp>. See L<perlxs/"The VERSIONCHECK: Keyword">.
# define XS_VERSION_BOOTCHECK
#endif
+#define dXCPT dJMPENV; int rEtV = 0
+#define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0)
+#define XCPT_TRY_END JMPENV_POP;
+#define XCPT_CATCH if (rEtV != 0)
+#define XCPT_RETHROW JMPENV_JUMP(rEtV)
+
/*
The DBM_setFilter & DBM_ckFilter macros are only used by
the *DB*_File modules