Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / share / swig / 1.3.26 / modula3 / modula3head.swg
CommitLineData
920dae64
AT
1/* -----------------------------------------------------------------------------
2 * modula3head.swg
3 *
4 * Modula3 support code
5 * ----------------------------------------------------------------------------- */
6
7%insert(runtime) %{
8
9#include <stdlib.h>
10#include <string.h>
11#include <stdio.h>
12#ifdef WIN32
13# define DllExport __declspec( dllexport )
14#else
15# define DllExport
16#endif
17%}
18
19#if 0
20%insert(runtime) %{
21/* Support for throwing Modula3 exceptions */
22typedef enum {
23 SWIG_JavaOutOfMemoryError = 1,
24 SWIG_JavaIOException,
25 SWIG_JavaRuntimeException,
26 SWIG_JavaIndexOutOfBoundsException,
27 SWIG_JavaArithmeticException,
28 SWIG_JavaIllegalArgumentException,
29 SWIG_JavaNullPointerException,
30 SWIG_JavaUnknownError
31} SWIG_JavaExceptionCodes;
32
33typedef struct {
34 SWIG_JavaExceptionCodes code;
35 const char *java_exception;
36} SWIG_JavaExceptions_t;
37
38#if defined(SWIG_NOINCLUDE)
39void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg);
40#else
41%}
42%insert(runtime) {
43void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
44 jclass excep;
45 static const SWIG_JavaExceptions_t java_exceptions[] = {
46 { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
47 { SWIG_JavaIOException, "java/io/IOException" },
48 { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
49 { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
50 { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
51 { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
52 { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
53 { SWIG_JavaUnknownError, "java/lang/UnknownError" },
54 { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } };
55 const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
56
57 while (except_ptr->code != code && except_ptr->code)
58 except_ptr++;
59
60 JCALL0(ExceptionClear, jenv);
61 excep = JCALL1(FindClass, jenv, except_ptr->java_exception);
62 if (excep)
63 JCALL2(ThrowNew, jenv, excep, msg);
64}
65}
66%insert(runtime) %{
67#endif
68%}
69#endif