PageRenderTime 34ms CodeModel.GetById 33ms app.highlight 0ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-29/SWIG/Lib/modula3/modula3head.swg

#
Unknown | 67 lines | 60 code | 7 blank | 0 comment | 0 complexity | 6c537c6c8681f507f9ae94a95a566bc4 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1/* -----------------------------------------------------------------------------
 2 * See the LICENSE file for information on copyright, usage and redistribution
 3 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
 4 *
 5 * modula3head.swg
 6 *
 7 * Modula3 support code
 8 * ----------------------------------------------------------------------------- */
 9
10%insert(runtime) %{
11
12#include <stdlib.h>
13#include <string.h>
14#include <stdio.h>
15%}
16
17#if 0
18%insert(runtime) %{
19/* Support for throwing Modula3 exceptions */
20typedef enum {
21  SWIG_JavaOutOfMemoryError = 1, 
22  SWIG_JavaIOException, 
23  SWIG_JavaRuntimeException, 
24  SWIG_JavaIndexOutOfBoundsException,
25  SWIG_JavaArithmeticException,
26  SWIG_JavaIllegalArgumentException,
27  SWIG_JavaNullPointerException,
28  SWIG_JavaUnknownError
29} SWIG_JavaExceptionCodes;
30
31typedef struct {
32  SWIG_JavaExceptionCodes code;
33  const char *java_exception;
34} SWIG_JavaExceptions_t;
35
36#if defined(SWIG_NOINCLUDE)
37void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg);
38#else
39%}
40%insert(runtime) {
41void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
42  jclass excep;
43  static const SWIG_JavaExceptions_t java_exceptions[] = {
44    { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
45    { SWIG_JavaIOException, "java/io/IOException" },
46    { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
47    { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
48    { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
49    { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
50    { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
51    { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
52    { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" } };
53  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
54
55  while (except_ptr->code != code && except_ptr->code)
56    except_ptr++;
57
58  JCALL0(ExceptionClear, jenv);
59  excep = JCALL1(FindClass, jenv, except_ptr->java_exception);
60  if (excep)
61    JCALL2(ThrowNew, jenv, excep, msg);
62}
63}
64%insert(runtime) %{
65#endif
66%}
67#endif