diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2003-03-12 20:33:38 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2003-03-12 20:33:38 +0000 |
commit | e702ffd133996f9173875e719ff0a64510914813 (patch) | |
tree | 6e5f574dd03a26fe22b8dbfc35d087c09eb58517 /Lib/csharp/csharphead.swg | |
parent | a3e7a4580e78e8d252b91b43ecb08d8d87dcefa6 (diff) | |
download | swig-e702ffd133996f9173875e719ff0a64510914813.tar.gz |
Non typemap code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4522 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/csharp/csharphead.swg')
-rw-r--r-- | Lib/csharp/csharphead.swg | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Lib/csharp/csharphead.swg b/Lib/csharp/csharphead.swg new file mode 100644 index 000000000..bcc603db9 --- /dev/null +++ b/Lib/csharp/csharphead.swg @@ -0,0 +1,68 @@ +/* ----------------------------------------------------------------------------- + * csharphead.swg + * + * CSharp support code + * ----------------------------------------------------------------------------- */ + +%insert(runtime) %{ + +#include <stdlib.h> +#include <string.h> +#ifdef WIN32 +# define DllExport __declspec( dllexport ) +#else +# define DllExport +#endif +%} + +#if 0 +%insert(runtime) %{ +/* Support for throwing CSharp exceptions */ +typedef enum { + SWIG_JavaOutOfMemoryError = 1, + SWIG_JavaIOException, + SWIG_JavaRuntimeException, + SWIG_JavaIndexOutOfBoundsException, + SWIG_JavaArithmeticException, + SWIG_JavaIllegalArgumentException, + SWIG_JavaNullPointerException, + SWIG_JavaUnknownError +} SWIG_JavaExceptionCodes; + +typedef struct { + SWIG_JavaExceptionCodes code; + const char *java_exception; +} SWIG_JavaExceptions_t; + +#if defined(SWIG_NOINCLUDE) +void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg); +#else +%} +%insert(runtime) { +void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { + jclass excep; + static const SWIG_JavaExceptions_t java_exceptions[] = { + { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, + { SWIG_JavaIOException, "java/io/IOException" }, + { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, + { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, + { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, + { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, + { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, + { SWIG_JavaUnknownError, "java/lang/UnknownError" }, + { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } }; + const SWIG_JavaExceptions_t *except_ptr = java_exceptions; + + while (except_ptr->code != code && except_ptr->code) + except_ptr++; + + JCALL0(ExceptionClear, jenv); + excep = JCALL1(FindClass, jenv, except_ptr->java_exception); + if (excep) + JCALL2(ThrowNew, jenv, excep, msg); +} +} +%insert(runtime) %{ +#endif +%} +#endif |