annotate lib/swig/swigwin-2.0.11/Lib/exception.i @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents b3009adc0e2f
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 /* -----------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2 * exception.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 *
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4 * SWIG library file providing language independent exception handling
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5 * ----------------------------------------------------------------------------- */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7 #if defined(SWIGUTL)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8 #error "This version of exception.i should not be used"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 %insert("runtime") "swigerrors.swg"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 #ifdef SWIGPHP
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17 #include "zend_exceptions.h"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18 #define SWIG_exception(code, msg) { zend_throw_exception(NULL, (char*)msg, code TSRMLS_CC); }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22 #ifdef SWIGGUILE
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24 SWIGINTERN void SWIG_exception_ (int code, const char *msg,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25 const char *subr) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26 #define ERROR(scmerr) \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27 scm_error(scm_from_locale_string((char *) (scmerr)), \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 (char *) subr, (char *) msg, \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29 SCM_EOL, SCM_BOOL_F)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30 #define MAP(swigerr, scmerr) \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31 case swigerr: \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32 ERROR(scmerr); \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33 break
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 switch (code) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 MAP(SWIG_MemoryError, "swig-memory-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36 MAP(SWIG_IOError, "swig-io-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37 MAP(SWIG_RuntimeError, "swig-runtime-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38 MAP(SWIG_IndexError, "swig-index-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 MAP(SWIG_TypeError, "swig-type-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40 MAP(SWIG_DivisionByZero, "swig-division-by-zero");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41 MAP(SWIG_OverflowError, "swig-overflow-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42 MAP(SWIG_SyntaxError, "swig-syntax-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 MAP(SWIG_ValueError, "swig-value-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44 MAP(SWIG_SystemError, "swig-system-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 default:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46 ERROR("swig-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48 #undef ERROR
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49 #undef MAP
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52 #define SWIG_exception(a,b) SWIG_exception_(a, b, FUNC_NAME)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56 #ifdef SWIGMZSCHEME
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59 SWIGINTERN void SWIG_exception_ (int code, const char *msg) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 #define ERROR(errname) \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61 scheme_signal_error(errname " (%s)", msg);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 #define MAP(swigerr, errname) \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63 case swigerr: \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64 ERROR(errname); \
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65 break
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 switch (code) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67 MAP(SWIG_MemoryError, "swig-memory-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 MAP(SWIG_IOError, "swig-io-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69 MAP(SWIG_RuntimeError, "swig-runtime-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70 MAP(SWIG_IndexError, "swig-index-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 MAP(SWIG_TypeError, "swig-type-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72 MAP(SWIG_DivisionByZero, "swig-division-by-zero");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73 MAP(SWIG_OverflowError, "swig-overflow-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74 MAP(SWIG_SyntaxError, "swig-syntax-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75 MAP(SWIG_ValueError, "swig-value-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76 MAP(SWIG_SystemError, "swig-system-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77 default:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78 ERROR("swig-error");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80 #undef ERROR
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81 #undef MAP
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
82 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
83
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
84 #define SWIG_exception(a,b) SWIG_exception_(a, b)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
85 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
86 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
87
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
88 #ifdef SWIGJAVA
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
89 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
90 SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
91 SWIG_JavaExceptionCodes exception_code = SWIG_JavaUnknownError;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
92 switch(code) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
93 case SWIG_MemoryError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
94 exception_code = SWIG_JavaOutOfMemoryError;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
95 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
96 case SWIG_IOError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
97 exception_code = SWIG_JavaIOException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
98 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
99 case SWIG_SystemError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
100 case SWIG_RuntimeError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
101 exception_code = SWIG_JavaRuntimeException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
102 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
103 case SWIG_OverflowError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
104 case SWIG_IndexError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
105 exception_code = SWIG_JavaIndexOutOfBoundsException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
106 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
107 case SWIG_DivisionByZero:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
108 exception_code = SWIG_JavaArithmeticException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
109 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
110 case SWIG_SyntaxError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
111 case SWIG_ValueError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
112 case SWIG_TypeError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
113 exception_code = SWIG_JavaIllegalArgumentException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
114 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
115 case SWIG_UnknownError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
116 default:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
117 exception_code = SWIG_JavaUnknownError;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
118 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
119 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
120 SWIG_JavaThrowException(jenv, exception_code, msg);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
121 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
122 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
123
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
124 #define SWIG_exception(code, msg)\
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
125 { SWIG_JavaException(jenv, code, msg); return $null; }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
126 #endif // SWIGJAVA
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
127
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
128 #ifdef SWIGOCAML
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
129 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
130 #define OCAML_MSG_BUF_LEN 1024
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
131 SWIGINTERN void SWIG_exception_(int code, const char *msg) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
132 char msg_buf[OCAML_MSG_BUF_LEN];
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
133 sprintf( msg_buf, "Exception(%d): %s\n", code, msg );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
134 failwith( msg_buf );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
135 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
136 #define SWIG_exception(a,b) SWIG_exception_((a),(b))
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
137 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
138 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
139
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
140
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
141 #ifdef SWIGCHICKEN
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
142 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
143 SWIGINTERN void SWIG_exception_(int code, const char *msg) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
144 C_word *a;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
145 C_word scmmsg;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
146 C_word list;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
147
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
148 a = C_alloc (C_SIZEOF_STRING (strlen (msg)) + C_SIZEOF_LIST(2));
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
149 scmmsg = C_string2 (&a, (char *) msg);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
150 list = C_list(&a, 2, C_fix(code), scmmsg);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
151 SWIG_ThrowException(list);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
152 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
153 #define SWIG_exception(a,b) SWIG_exception_((a),(b))
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
154 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
155 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
156
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
157 #ifdef SWIGCSHARP
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
158 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
159 SWIGINTERN void SWIG_CSharpException(int code, const char *msg) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
160 if (code == SWIG_ValueError) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
161 SWIG_CSharpExceptionArgumentCodes exception_code = SWIG_CSharpArgumentOutOfRangeException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
162 SWIG_CSharpSetPendingExceptionArgument(exception_code, msg, 0);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
163 } else {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
164 SWIG_CSharpExceptionCodes exception_code = SWIG_CSharpApplicationException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
165 switch(code) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
166 case SWIG_MemoryError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
167 exception_code = SWIG_CSharpOutOfMemoryException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
168 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
169 case SWIG_IndexError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
170 exception_code = SWIG_CSharpIndexOutOfRangeException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
171 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
172 case SWIG_DivisionByZero:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
173 exception_code = SWIG_CSharpDivideByZeroException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
174 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
175 case SWIG_IOError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
176 exception_code = SWIG_CSharpIOException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
177 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
178 case SWIG_OverflowError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
179 exception_code = SWIG_CSharpOverflowException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
180 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
181 case SWIG_RuntimeError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
182 case SWIG_TypeError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
183 case SWIG_SyntaxError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
184 case SWIG_SystemError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
185 case SWIG_UnknownError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
186 default:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
187 exception_code = SWIG_CSharpApplicationException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
188 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
189 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
190 SWIG_CSharpSetPendingException(exception_code, msg);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
191 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
192 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
193 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
194
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
195 #define SWIG_exception(code, msg)\
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
196 { SWIG_CSharpException(code, msg); return $null; }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
197 #endif // SWIGCSHARP
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
198
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
199 #ifdef SWIGLUA
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
200
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
201 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
202 #define SWIG_exception(a,b)\
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
203 { lua_pushfstring(L,"%s:%s",#a,b);SWIG_fail; }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
204 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
205
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
206 #endif // SWIGLUA
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
207
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
208 #ifdef SWIGD
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
209 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
210 SWIGINTERN void SWIG_DThrowException(int code, const char *msg) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
211 SWIG_DExceptionCodes exception_code;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
212 switch(code) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
213 case SWIG_IndexError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
214 exception_code = SWIG_DNoSuchElementException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
215 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
216 case SWIG_IOError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
217 exception_code = SWIG_DIOException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
218 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
219 case SWIG_ValueError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
220 exception_code = SWIG_DIllegalArgumentException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
221 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
222 case SWIG_DivisionByZero:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
223 case SWIG_MemoryError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
224 case SWIG_OverflowError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
225 case SWIG_RuntimeError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
226 case SWIG_TypeError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
227 case SWIG_SyntaxError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
228 case SWIG_SystemError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
229 case SWIG_UnknownError:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
230 default:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
231 exception_code = SWIG_DException;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
232 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
233 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
234 SWIG_DSetPendingException(exception_code, msg);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
235 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
236 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
237
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
238 #define SWIG_exception(code, msg)\
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
239 { SWIG_DThrowException(code, msg); return $null; }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
240 #endif // SWIGD
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
241
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
242 #ifdef __cplusplus
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
243 /*
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
244 You can use the SWIG_CATCH_STDEXCEPT macro with the %exception
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
245 directive as follows:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
246
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
247 %exception {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
248 try {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
249 $action
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
250 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
251 catch (my_except& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
252 ...
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
253 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
254 SWIG_CATCH_STDEXCEPT // catch std::exception
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
255 catch (...) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
256 SWIG_exception(SWIG_UnknownError, "Unknown exception");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
257 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
258 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
259 */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
260 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
261 #include <stdexcept>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
262 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
263 %define SWIG_CATCH_STDEXCEPT
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
264 /* catching std::exception */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
265 catch (std::invalid_argument& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
266 SWIG_exception(SWIG_ValueError, e.what() );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
267 } catch (std::domain_error& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
268 SWIG_exception(SWIG_ValueError, e.what() );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
269 } catch (std::overflow_error& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
270 SWIG_exception(SWIG_OverflowError, e.what() );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
271 } catch (std::out_of_range& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
272 SWIG_exception(SWIG_IndexError, e.what() );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
273 } catch (std::length_error& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
274 SWIG_exception(SWIG_IndexError, e.what() );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
275 } catch (std::runtime_error& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
276 SWIG_exception(SWIG_RuntimeError, e.what() );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
277 } catch (std::exception& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
278 SWIG_exception(SWIG_SystemError, e.what() );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
279 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
280 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
281 %define SWIG_CATCH_UNKNOWN
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
282 catch (std::exception& e) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
283 SWIG_exception(SWIG_SystemError, e.what() );
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
284 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
285 catch (...) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
286 SWIG_exception(SWIG_UnknownError, "unknown exception");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
287 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
288 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
289
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
290 /* rethrow the unknown exception */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
291
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
292 #if defined(SWIGCSHARP) || defined(SWIGD)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
293 %typemap(throws,noblock=1, canthrow=1) (...) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
294 SWIG_exception(SWIG_RuntimeError,"unknown exception");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
295 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
296 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
297 %typemap(throws,noblock=1) (...) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
298 SWIG_exception(SWIG_RuntimeError,"unknown exception");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
299 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
300 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
301
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
302 #endif /* __cplusplus */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
303
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
304 /* exception.i ends here */