PageRenderTime 41ms CodeModel.GetById 18ms 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. %insert(runtime) %{
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <stdio.h>
  13. %}
  14. #if 0
  15. %insert(runtime) %{
  16. /* Support for throwing Modula3 exceptions */
  17. typedef 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. typedef struct {
  28. SWIG_JavaExceptionCodes code;
  29. const char *java_exception;
  30. } SWIG_JavaExceptions_t;
  31. #if defined(SWIG_NOINCLUDE)
  32. void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg);
  33. #else
  34. %}
  35. %insert(runtime) {
  36. void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
  37. jclass excep;
  38. static const SWIG_JavaExceptions_t java_exceptions[] = {
  39. { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
  40. { SWIG_JavaIOException, "java/io/IOException" },
  41. { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
  42. { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
  43. { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
  44. { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
  45. { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
  46. { SWIG_JavaUnknownError, "java/lang/UnknownError" },
  47. { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } };
  48. const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
  49. while (except_ptr->code != code && except_ptr->code)
  50. except_ptr++;
  51. JCALL0(ExceptionClear, jenv);
  52. excep = JCALL1(FindClass, jenv, except_ptr->java_exception);
  53. if (excep)
  54. JCALL2(ThrowNew, jenv, excep, msg);
  55. }
  56. }
  57. %insert(runtime) %{
  58. #endif
  59. %}
  60. #endif