PageRenderTime 15ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Lib/modula3/modula3head.swg

#
Unknown | 64 lines | 57 code | 7 blank | 0 comment | 0 complexity | 0650b5e81eb90aa4c683db2137a3312c MD5 | raw file
 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%}
13
14#if 0
15%insert(runtime) %{
16/* Support for throwing Modula3 exceptions */
17typedef enum {
18  SWIG_JavaOutOfMemoryError = 1, 
19  SWIG_JavaIOException, 
20  SWIG_JavaRuntimeException, 
21  SWIG_JavaIndexOutOfBoundsException,
22  SWIG_JavaArithmeticException,
23  SWIG_JavaIllegalArgumentException,
24  SWIG_JavaNullPointerException,
25  SWIG_JavaUnknownError
26} SWIG_JavaExceptionCodes;
27
28typedef struct {
29  SWIG_JavaExceptionCodes code;
30  const char *java_exception;
31} SWIG_JavaExceptions_t;
32
33#if defined(SWIG_NOINCLUDE)
34void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg);
35#else
36%}
37%insert(runtime) {
38void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
39  jclass excep;
40  static const SWIG_JavaExceptions_t java_exceptions[] = {
41    { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
42    { SWIG_JavaIOException, "java/io/IOException" },
43    { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
44    { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
45    { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
46    { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
47    { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
48    { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
49    { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" } };
50  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
51
52  while (except_ptr->code != code && except_ptr->code)
53    except_ptr++;
54
55  JCALL0(ExceptionClear, jenv);
56  excep = JCALL1(FindClass, jenv, except_ptr->java_exception);
57  if (excep)
58    JCALL2(ThrowNew, jenv, excep, msg);
59}
60}
61%insert(runtime) %{
62#endif
63%}
64#endif