This was suggested by wsfulton on the mailing list in order to bring the D module in line with the C# one, the naming scheme of which is intended to be language-independent. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12319 626c5289-ae23-0410-ae9c-e8d60b6d4f22
30 lines
1.1 KiB
Text
30 lines
1.1 KiB
Text
/* -----------------------------------------------------------------------------
|
|
* dexception.swg
|
|
*
|
|
* Typemaps used for propagating C++ exceptions to D.
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
// Code which is inserted into the dout typemaps and class constructors via
|
|
// excode if exceptions can be thrown.
|
|
%define SWIGEXCODE "\n if ($imdmodule.SwigPendingException.isPending) throw $imdmodule.SwigPendingException.retrieve();" %enddef
|
|
|
|
%typemap(throws, canthrow=1) int,
|
|
long,
|
|
short,
|
|
unsigned int,
|
|
unsigned long,
|
|
unsigned short
|
|
%{ char error_msg[256];
|
|
sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
|
|
SWIG_DSetPendingException(SWIG_DException, error_msg);
|
|
return $null; %}
|
|
|
|
%typemap(throws, canthrow=1) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [ANY],
|
|
enum SWIGTYPE, const enum SWIGTYPE &
|
|
%{ (void)$1;
|
|
SWIG_DSetPendingException(SWIG_DException, "C++ $1_type exception thrown");
|
|
return $null; %}
|
|
|
|
%typemap(throws, canthrow=1) char *
|
|
%{ SWIG_DSetPendingException(SWIG_DException, $1);
|
|
return $null; %}
|