PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/modula3/modula3head.swg

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