]>
Commit | Line | Data |
---|---|---|
98fb9b71 RD |
1 | /* ---------------------------------------------------------------------------- |
2 | * This file was automatically generated by SWIG (http://www.swig.org). | |
3 | * Version 1.3.20 | |
4 | * | |
5 | * This file is not intended to be easily readable and contains a number of | |
6 | * coding conventions designed to improve portability and efficiency. Do not make | |
7 | * changes to this file unless you know what you are doing--modify the SWIG | |
8 | * interface file instead. | |
9 | * ----------------------------------------------------------------------------- */ | |
10 | ||
11 | #define SWIGPYTHON | |
12 | ||
13 | #define SWIG_GLOBAL 1 | |
14 | ||
15 | ||
16 | #include "Python.h" | |
17 | ||
d14a1e28 RD |
18 | /*************************************************************** -*- c -*- |
19 | * python/precommon.swg | |
20 | * | |
21 | * Rename all exported symbols from common.swg, to avoid symbol | |
22 | * clashes if multiple interpreters are included | |
23 | * | |
24 | ************************************************************************/ | |
25 | ||
26 | #define SWIG_TypeRegister SWIG_Python_TypeRegister | |
27 | #define SWIG_TypeCheck SWIG_Python_TypeCheck | |
28 | #define SWIG_TypeCast SWIG_Python_TypeCast | |
29 | #define SWIG_TypeDynamicCast SWIG_Python_TypeDynamicCast | |
30 | #define SWIG_TypeName SWIG_Python_TypeName | |
31 | #define SWIG_TypeQuery SWIG_Python_TypeQuery | |
32 | #define SWIG_TypeClientData SWIG_Python_TypeClientData | |
1de47c7c RD |
33 | #define SWIG_PackData SWIG_Python_PackData |
34 | #define SWIG_UnpackData SWIG_Python_UnpackData | |
35 | ||
d14a1e28 | 36 | |
6bddd8c5 | 37 | /*********************************************************************** |
d14a1e28 RD |
38 | * common.swg |
39 | * | |
40 | * This file contains generic SWIG runtime support for pointer | |
41 | * type checking as well as a few commonly used macros to control | |
42 | * external linkage. | |
6bddd8c5 | 43 | * |
d14a1e28 RD |
44 | * Author : David Beazley (beazley@cs.uchicago.edu) |
45 | * | |
46 | * Copyright (c) 1999-2000, The University of Chicago | |
47 | * | |
48 | * This file may be freely redistributed without license or fee provided | |
49 | * this copyright message remains intact. | |
6bddd8c5 RD |
50 | ************************************************************************/ |
51 | ||
185d7c3e | 52 | #include <string.h> |
d14a1e28 | 53 | |
98fb9b71 RD |
54 | #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) |
55 | # if defined(_MSC_VER) || defined(__GNUC__) | |
56 | # if defined(STATIC_LINKED) | |
57 | # define SWIGEXPORT(a) a | |
58 | # define SWIGIMPORT(a) extern a | |
59 | # else | |
60 | # define SWIGEXPORT(a) __declspec(dllexport) a | |
61 | # define SWIGIMPORT(a) extern a | |
62 | # endif | |
63 | # else | |
64 | # if defined(__BORLANDC__) | |
65 | # define SWIGEXPORT(a) a _export | |
66 | # define SWIGIMPORT(a) a _export | |
67 | # else | |
68 | # define SWIGEXPORT(a) a | |
69 | # define SWIGIMPORT(a) a | |
70 | # endif | |
71 | # endif | |
d14a1e28 | 72 | #else |
98fb9b71 RD |
73 | # define SWIGEXPORT(a) a |
74 | # define SWIGIMPORT(a) a | |
d14a1e28 RD |
75 | #endif |
76 | ||
77 | #ifdef SWIG_GLOBAL | |
98fb9b71 | 78 | # define SWIGRUNTIME(a) SWIGEXPORT(a) |
d14a1e28 | 79 | #else |
98fb9b71 | 80 | # define SWIGRUNTIME(a) static a |
d14a1e28 | 81 | #endif |
185d7c3e | 82 | |
6bddd8c5 RD |
83 | #ifdef __cplusplus |
84 | extern "C" { | |
85 | #endif | |
6bddd8c5 | 86 | |
d14a1e28 RD |
87 | typedef void *(*swig_converter_func)(void *); |
88 | typedef struct swig_type_info *(*swig_dycast_func)(void **); | |
89 | ||
90 | typedef struct swig_type_info { | |
98fb9b71 | 91 | const char *name; |
d14a1e28 RD |
92 | swig_converter_func converter; |
93 | const char *str; | |
98fb9b71 | 94 | void *clientdata; |
d14a1e28 RD |
95 | swig_dycast_func dcast; |
96 | struct swig_type_info *next; | |
97 | struct swig_type_info *prev; | |
98 | } swig_type_info; | |
99 | ||
100 | #ifdef SWIG_NOINCLUDE | |
101 | ||
102 | SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *); | |
103 | SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *); | |
104 | SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *); | |
105 | SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **); | |
106 | SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *); | |
107 | SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *); | |
108 | SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *); | |
98fb9b71 RD |
109 | SWIGIMPORT(char *) SWIG_PackData(char *, void *, int); |
110 | SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int); | |
d14a1e28 | 111 | |
6bddd8c5 | 112 | #else |
d14a1e28 RD |
113 | |
114 | static swig_type_info *swig_type_list = 0; | |
115 | ||
116 | /* Register a type mapping with the type-checking */ | |
117 | SWIGRUNTIME(swig_type_info *) | |
98fb9b71 | 118 | SWIG_TypeRegister(swig_type_info *ti) { |
d14a1e28 RD |
119 | swig_type_info *tc, *head, *ret, *next; |
120 | /* Check to see if this type has already been registered */ | |
121 | tc = swig_type_list; | |
122 | while (tc) { | |
123 | if (strcmp(tc->name, ti->name) == 0) { | |
124 | /* Already exists in the table. Just add additional types to the list */ | |
98fb9b71 | 125 | if (tc->clientdata) ti->clientdata = tc->clientdata; |
d14a1e28 RD |
126 | head = tc; |
127 | next = tc->next; | |
128 | goto l1; | |
129 | } | |
130 | tc = tc->prev; | |
131 | } | |
132 | head = ti; | |
133 | next = 0; | |
134 | ||
135 | /* Place in list */ | |
136 | ti->prev = swig_type_list; | |
137 | swig_type_list = ti; | |
138 | ||
139 | /* Build linked lists */ | |
98fb9b71 | 140 | l1: |
d14a1e28 RD |
141 | ret = head; |
142 | tc = ti + 1; | |
143 | /* Patch up the rest of the links */ | |
144 | while (tc->name) { | |
145 | head->next = tc; | |
146 | tc->prev = head; | |
147 | head = tc; | |
148 | tc++; | |
149 | } | |
98fb9b71 | 150 | if (next) next->prev = head; |
d14a1e28 RD |
151 | head->next = next; |
152 | return ret; | |
153 | } | |
154 | ||
155 | /* Check the typename */ | |
156 | SWIGRUNTIME(swig_type_info *) | |
98fb9b71 | 157 | SWIG_TypeCheck(char *c, swig_type_info *ty) { |
d14a1e28 RD |
158 | swig_type_info *s; |
159 | if (!ty) return 0; /* Void pointer */ | |
160 | s = ty->next; /* First element always just a name */ | |
161 | do { | |
162 | if (strcmp(s->name,c) == 0) { | |
163 | if (s == ty->next) return s; | |
164 | /* Move s to the top of the linked list */ | |
165 | s->prev->next = s->next; | |
166 | if (s->next) { | |
98fb9b71 | 167 | s->next->prev = s->prev; |
d14a1e28 RD |
168 | } |
169 | /* Insert s as second element in the list */ | |
170 | s->next = ty->next; | |
171 | if (ty->next) ty->next->prev = s; | |
172 | ty->next = s; | |
98fb9b71 | 173 | s->prev = ty; |
d14a1e28 RD |
174 | return s; |
175 | } | |
176 | s = s->next; | |
177 | } while (s && (s != ty->next)); | |
178 | return 0; | |
179 | } | |
180 | ||
181 | /* Cast a pointer up an inheritance hierarchy */ | |
182 | SWIGRUNTIME(void *) | |
98fb9b71 | 183 | SWIG_TypeCast(swig_type_info *ty, void *ptr) { |
d14a1e28 RD |
184 | if ((!ty) || (!ty->converter)) return ptr; |
185 | return (*ty->converter)(ptr); | |
186 | } | |
187 | ||
188 | /* Dynamic pointer casting. Down an inheritance hierarchy */ | |
189 | SWIGRUNTIME(swig_type_info *) | |
98fb9b71 | 190 | SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { |
d14a1e28 RD |
191 | swig_type_info *lastty = ty; |
192 | if (!ty || !ty->dcast) return ty; | |
193 | while (ty && (ty->dcast)) { | |
98fb9b71 RD |
194 | ty = (*ty->dcast)(ptr); |
195 | if (ty) lastty = ty; | |
d14a1e28 RD |
196 | } |
197 | return lastty; | |
198 | } | |
199 | ||
200 | /* Return the name associated with this type */ | |
201 | SWIGRUNTIME(const char *) | |
202 | SWIG_TypeName(const swig_type_info *ty) { | |
203 | return ty->name; | |
204 | } | |
205 | ||
206 | /* Search for a swig_type_info structure */ | |
207 | SWIGRUNTIME(swig_type_info *) | |
208 | SWIG_TypeQuery(const char *name) { | |
209 | swig_type_info *ty = swig_type_list; | |
210 | while (ty) { | |
211 | if (ty->str && (strcmp(name,ty->str) == 0)) return ty; | |
212 | if (ty->name && (strcmp(name,ty->name) == 0)) return ty; | |
213 | ty = ty->prev; | |
214 | } | |
215 | return 0; | |
216 | } | |
217 | ||
218 | /* Set the clientdata field for a type */ | |
219 | SWIGRUNTIME(void) | |
220 | SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { | |
221 | swig_type_info *tc, *equiv; | |
222 | if (ti->clientdata == clientdata) return; | |
223 | ti->clientdata = clientdata; | |
224 | equiv = ti->next; | |
225 | while (equiv) { | |
226 | if (!equiv->converter) { | |
227 | tc = swig_type_list; | |
228 | while (tc) { | |
98fb9b71 RD |
229 | if ((strcmp(tc->name, equiv->name) == 0)) |
230 | SWIG_TypeClientData(tc,clientdata); | |
231 | tc = tc->prev; | |
d14a1e28 RD |
232 | } |
233 | } | |
234 | equiv = equiv->next; | |
235 | } | |
236 | } | |
98fb9b71 RD |
237 | |
238 | /* Pack binary data into a string */ | |
239 | SWIGRUNTIME(char *) | |
240 | SWIG_PackData(char *c, void *ptr, int sz) { | |
241 | static char hex[17] = "0123456789abcdef"; | |
242 | int i; | |
243 | unsigned char *u = (unsigned char *) ptr; | |
244 | register unsigned char uu; | |
245 | for (i = 0; i < sz; i++,u++) { | |
246 | uu = *u; | |
247 | *(c++) = hex[(uu & 0xf0) >> 4]; | |
248 | *(c++) = hex[uu & 0xf]; | |
249 | } | |
250 | return c; | |
251 | } | |
252 | ||
253 | /* Unpack binary data from a string */ | |
254 | SWIGRUNTIME(char *) | |
255 | SWIG_UnpackData(char *c, void *ptr, int sz) { | |
256 | register unsigned char uu = 0; | |
257 | register int d; | |
258 | unsigned char *u = (unsigned char *) ptr; | |
259 | int i; | |
260 | for (i = 0; i < sz; i++, u++) { | |
261 | d = *(c++); | |
262 | if ((d >= '0') && (d <= '9')) | |
263 | uu = ((d - '0') << 4); | |
264 | else if ((d >= 'a') && (d <= 'f')) | |
265 | uu = ((d - ('a'-10)) << 4); | |
266 | d = *(c++); | |
267 | if ((d >= '0') && (d <= '9')) | |
268 | uu |= (d - '0'); | |
269 | else if ((d >= 'a') && (d <= 'f')) | |
270 | uu |= (d - ('a'-10)); | |
271 | *u = uu; | |
272 | } | |
273 | return c; | |
274 | } | |
275 | ||
6bddd8c5 RD |
276 | #endif |
277 | ||
d14a1e28 RD |
278 | #ifdef __cplusplus |
279 | } | |
d14a1e28 | 280 | #endif |
98fb9b71 | 281 | |
d14a1e28 RD |
282 | /*********************************************************************** |
283 | * python.swg | |
284 | * | |
285 | * This file contains the runtime support for Python modules | |
286 | * and includes code for managing global variables and pointer | |
287 | * type checking. | |
288 | * | |
289 | * Author : David Beazley (beazley@cs.uchicago.edu) | |
290 | ************************************************************************/ | |
291 | ||
98fb9b71 | 292 | #include "Python.h" |
d14a1e28 RD |
293 | |
294 | #ifdef __cplusplus | |
295 | extern "C" { | |
6bddd8c5 RD |
296 | #endif |
297 | ||
d14a1e28 RD |
298 | #define SWIG_PY_INT 1 |
299 | #define SWIG_PY_FLOAT 2 | |
300 | #define SWIG_PY_STRING 3 | |
301 | #define SWIG_PY_POINTER 4 | |
302 | #define SWIG_PY_BINARY 5 | |
303 | ||
304 | /* Flags for pointer conversion */ | |
305 | ||
306 | #define SWIG_POINTER_EXCEPTION 0x1 | |
307 | #define SWIG_POINTER_DISOWN 0x2 | |
308 | ||
309 | /* Exception handling in wrappers */ | |
310 | #define SWIG_fail goto fail | |
311 | ||
312 | /* Constant information structure */ | |
313 | typedef struct swig_const_info { | |
314 | int type; | |
315 | char *name; | |
316 | long lvalue; | |
317 | double dvalue; | |
318 | void *pvalue; | |
319 | swig_type_info **ptype; | |
320 | } swig_const_info; | |
321 | ||
322 | /* Common SWIG API */ | |
323 | #define SWIG_ConvertPtr(obj, pp, type, flags) \ | |
324 | SWIG_Python_ConvertPtr(obj, pp, type, flags) | |
325 | #define SWIG_NewPointerObj(p, type, flags) \ | |
326 | SWIG_Python_NewPointerObj(p, type, flags) | |
327 | #define SWIG_MustGetPtr(p, type, argnum, flags) \ | |
328 | SWIG_Python_MustGetPtr(p, type, argnum, flags) | |
329 | ||
330 | /* Python-specific SWIG API */ | |
331 | #define SWIG_newvarlink() \ | |
332 | SWIG_Python_newvarlink() | |
333 | #define SWIG_addvarlink(p, name, get_attr, set_attr) \ | |
334 | SWIG_Python_addvarlink(p, name, get_attr, set_attr) | |
335 | #define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) \ | |
336 | SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags) | |
d14a1e28 RD |
337 | #define SWIG_NewPackedObj(ptr, sz, type) \ |
338 | SWIG_Python_NewPackedObj(ptr, sz, type) | |
339 | #define SWIG_InstallConstants(d, constants) \ | |
340 | SWIG_Python_InstallConstants(d, constants) | |
341 | ||
342 | #ifdef SWIG_NOINCLUDE | |
343 | ||
98fb9b71 RD |
344 | SWIGIMPORT(int) SWIG_Python_ConvertPtr(PyObject *, void **, swig_type_info *, int); |
345 | SWIGIMPORT(PyObject *) SWIG_Python_NewPointerObj(void *, swig_type_info *,int own); | |
346 | SWIGIMPORT(void *) SWIG_Python_MustGetPtr(PyObject *, swig_type_info *, int, int); | |
347 | SWIGIMPORT(PyObject *) SWIG_Python_newvarlink(void); | |
348 | SWIGIMPORT(void) SWIG_Python_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); | |
349 | SWIGIMPORT(int) SWIG_Python_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int); | |
350 | SWIGIMPORT(PyObject *) SWIG_Python_NewPackedObj(void *, int sz, swig_type_info *); | |
351 | SWIGIMPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]); | |
352 | ||
d14a1e28 RD |
353 | #else |
354 | ||
355 | /* ----------------------------------------------------------------------------- | |
356 | * global variable support code. | |
357 | * ----------------------------------------------------------------------------- */ | |
358 | ||
359 | typedef struct swig_globalvar { | |
360 | char *name; /* Name of global variable */ | |
361 | PyObject *(*get_attr)(void); /* Return the current value */ | |
362 | int (*set_attr)(PyObject *); /* Set the value */ | |
363 | struct swig_globalvar *next; | |
6bddd8c5 RD |
364 | } swig_globalvar; |
365 | ||
366 | typedef struct swig_varlinkobject { | |
367 | PyObject_HEAD | |
d14a1e28 | 368 | swig_globalvar *vars; |
6bddd8c5 RD |
369 | } swig_varlinkobject; |
370 | ||
6bddd8c5 | 371 | static PyObject * |
d14a1e28 | 372 | swig_varlink_repr(swig_varlinkobject *v) { |
6bddd8c5 RD |
373 | v = v; |
374 | return PyString_FromString("<Global variables>"); | |
375 | } | |
376 | ||
6bddd8c5 | 377 | static int |
d14a1e28 RD |
378 | swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) { |
379 | swig_globalvar *var; | |
6bddd8c5 RD |
380 | flags = flags; |
381 | fprintf(fp,"Global variables { "); | |
d14a1e28 RD |
382 | for (var = v->vars; var; var=var->next) { |
383 | fprintf(fp,"%s", var->name); | |
384 | if (var->next) fprintf(fp,", "); | |
6bddd8c5 RD |
385 | } |
386 | fprintf(fp," }\n"); | |
387 | return 0; | |
388 | } | |
389 | ||
6bddd8c5 | 390 | static PyObject * |
d14a1e28 RD |
391 | swig_varlink_getattr(swig_varlinkobject *v, char *n) { |
392 | swig_globalvar *var = v->vars; | |
393 | while (var) { | |
394 | if (strcmp(var->name,n) == 0) { | |
395 | return (*var->get_attr)(); | |
6bddd8c5 | 396 | } |
d14a1e28 | 397 | var = var->next; |
6bddd8c5 | 398 | } |
d14a1e28 | 399 | PyErr_SetString(PyExc_NameError,"Unknown C global variable"); |
6bddd8c5 RD |
400 | return NULL; |
401 | } | |
402 | ||
6bddd8c5 | 403 | static int |
d14a1e28 RD |
404 | swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { |
405 | swig_globalvar *var = v->vars; | |
406 | while (var) { | |
407 | if (strcmp(var->name,n) == 0) { | |
408 | return (*var->set_attr)(p); | |
6bddd8c5 | 409 | } |
d14a1e28 | 410 | var = var->next; |
6bddd8c5 | 411 | } |
d14a1e28 | 412 | PyErr_SetString(PyExc_NameError,"Unknown C global variable"); |
6bddd8c5 RD |
413 | return 1; |
414 | } | |
415 | ||
416 | statichere PyTypeObject varlinktype = { | |
d14a1e28 | 417 | PyObject_HEAD_INIT(0) |
6bddd8c5 | 418 | 0, |
d14a1e28 | 419 | (char *)"swigvarlink", /* Type name */ |
6bddd8c5 RD |
420 | sizeof(swig_varlinkobject), /* Basic size */ |
421 | 0, /* Itemsize */ | |
d14a1e28 | 422 | 0, /* Deallocator */ |
6bddd8c5 RD |
423 | (printfunc) swig_varlink_print, /* Print */ |
424 | (getattrfunc) swig_varlink_getattr, /* get attr */ | |
425 | (setattrfunc) swig_varlink_setattr, /* Set attr */ | |
426 | 0, /* tp_compare */ | |
d14a1e28 | 427 | (reprfunc) swig_varlink_repr, /* tp_repr */ |
6bddd8c5 RD |
428 | 0, /* tp_as_number */ |
429 | 0, /* tp_as_mapping*/ | |
430 | 0, /* tp_hash */ | |
431 | }; | |
432 | ||
433 | /* Create a variable linking object for use later */ | |
d14a1e28 RD |
434 | SWIGRUNTIME(PyObject *) |
435 | SWIG_Python_newvarlink(void) { | |
6bddd8c5 RD |
436 | swig_varlinkobject *result = 0; |
437 | result = PyMem_NEW(swig_varlinkobject,1); | |
438 | varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */ | |
439 | result->ob_type = &varlinktype; | |
d14a1e28 | 440 | result->vars = 0; |
6bddd8c5 RD |
441 | result->ob_refcnt = 0; |
442 | Py_XINCREF((PyObject *) result); | |
443 | return ((PyObject*) result); | |
444 | } | |
445 | ||
d14a1e28 | 446 | SWIGRUNTIME(void) |
98fb9b71 | 447 | SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { |
6bddd8c5 | 448 | swig_varlinkobject *v; |
d14a1e28 | 449 | swig_globalvar *gv; |
6bddd8c5 | 450 | v= (swig_varlinkobject *) p; |
d14a1e28 RD |
451 | gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); |
452 | gv->name = (char *) malloc(strlen(name)+1); | |
453 | strcpy(gv->name,name); | |
454 | gv->get_attr = get_attr; | |
455 | gv->set_attr = set_attr; | |
456 | gv->next = v->vars; | |
457 | v->vars = gv; | |
6bddd8c5 RD |
458 | } |
459 | ||
d14a1e28 RD |
460 | /* Convert a pointer value */ |
461 | SWIGRUNTIME(int) | |
462 | SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) { | |
463 | swig_type_info *tc; | |
464 | char *c = 0; | |
465 | static PyObject *SWIG_this = 0; | |
466 | int newref = 0; | |
467 | PyObject *pyobj = 0; | |
468 | ||
469 | if (!obj) return 0; | |
470 | if (obj == Py_None) { | |
471 | *ptr = 0; | |
472 | return 0; | |
1d99702e | 473 | } |
d14a1e28 RD |
474 | #ifdef SWIG_COBJECT_TYPES |
475 | if (!(PyCObject_Check(obj))) { | |
476 | if (!SWIG_this) | |
477 | SWIG_this = PyString_FromString("this"); | |
478 | pyobj = obj; | |
479 | obj = PyObject_GetAttr(obj,SWIG_this); | |
480 | newref = 1; | |
481 | if (!obj) goto type_error; | |
482 | if (!PyCObject_Check(obj)) { | |
483 | Py_DECREF(obj); | |
484 | goto type_error; | |
485 | } | |
486 | } | |
487 | *ptr = PyCObject_AsVoidPtr(obj); | |
488 | c = (char *) PyCObject_GetDesc(obj); | |
489 | if (newref) Py_DECREF(obj); | |
490 | goto cobject; | |
491 | #else | |
492 | if (!(PyString_Check(obj))) { | |
493 | if (!SWIG_this) | |
494 | SWIG_this = PyString_FromString("this"); | |
495 | pyobj = obj; | |
496 | obj = PyObject_GetAttr(obj,SWIG_this); | |
497 | newref = 1; | |
498 | if (!obj) goto type_error; | |
499 | if (!PyString_Check(obj)) { | |
500 | Py_DECREF(obj); | |
501 | goto type_error; | |
502 | } | |
503 | } | |
504 | c = PyString_AsString(obj); | |
505 | /* Pointer values must start with leading underscore */ | |
506 | if (*c != '_') { | |
507 | *ptr = (void *) 0; | |
508 | if (strcmp(c,"NULL") == 0) { | |
509 | if (newref) { Py_DECREF(obj); } | |
510 | return 0; | |
511 | } else { | |
512 | if (newref) { Py_DECREF(obj); } | |
513 | goto type_error; | |
1d99702e RD |
514 | } |
515 | } | |
d14a1e28 RD |
516 | c++; |
517 | c = SWIG_UnpackData(c,ptr,sizeof(void *)); | |
518 | if (newref) { Py_DECREF(obj); } | |
519 | #endif | |
520 | ||
521 | #ifdef SWIG_COBJECT_TYPES | |
522 | cobject: | |
523 | #endif | |
524 | ||
525 | if (ty) { | |
526 | tc = SWIG_TypeCheck(c,ty); | |
527 | if (!tc) goto type_error; | |
528 | *ptr = SWIG_TypeCast(tc,(void*) *ptr); | |
1d99702e RD |
529 | } |
530 | ||
d14a1e28 | 531 | if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) { |
98fb9b71 RD |
532 | PyObject *zero = PyInt_FromLong(0); |
533 | PyObject_SetAttrString(pyobj,(char*)"thisown",zero); | |
534 | Py_DECREF(zero); | |
1d99702e | 535 | } |
d14a1e28 | 536 | return 0; |
1d99702e | 537 | |
d14a1e28 RD |
538 | type_error: |
539 | if (flags & SWIG_POINTER_EXCEPTION) { | |
540 | if (ty && c) { | |
541 | char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c)); | |
542 | sprintf(temp,"Type error. Got %s, expected %s", c, ty->name); | |
543 | PyErr_SetString(PyExc_TypeError, temp); | |
544 | free((char *) temp); | |
545 | } else { | |
546 | PyErr_SetString(PyExc_TypeError,"Expected a pointer"); | |
1d99702e | 547 | } |
1d99702e | 548 | } |
d14a1e28 | 549 | return -1; |
1d99702e RD |
550 | } |
551 | ||
d14a1e28 RD |
552 | /* Convert a pointer value, signal an exception on a type mismatch */ |
553 | SWIGRUNTIME(void *) | |
98fb9b71 | 554 | SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { |
d14a1e28 RD |
555 | void *result; |
556 | SWIG_Python_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION); | |
557 | return result; | |
558 | } | |
1d99702e | 559 | |
d14a1e28 RD |
560 | /* Convert a packed value value */ |
561 | SWIGRUNTIME(int) | |
562 | SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) { | |
563 | swig_type_info *tc; | |
564 | char *c = 0; | |
565 | ||
566 | if ((!obj) || (!PyString_Check(obj))) goto type_error; | |
567 | c = PyString_AsString(obj); | |
1d99702e | 568 | /* Pointer values must start with leading underscore */ |
d14a1e28 | 569 | if (*c != '_') goto type_error; |
1d99702e | 570 | c++; |
d14a1e28 RD |
571 | c = SWIG_UnpackData(c,ptr,sz); |
572 | if (ty) { | |
573 | tc = SWIG_TypeCheck(c,ty); | |
574 | if (!tc) goto type_error; | |
1d99702e | 575 | } |
d14a1e28 RD |
576 | return 0; |
577 | ||
578 | type_error: | |
579 | ||
580 | if (flags) { | |
581 | if (ty && c) { | |
582 | char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c)); | |
583 | sprintf(temp,"Type error. Got %s, expected %s", c, ty->name); | |
584 | PyErr_SetString(PyExc_TypeError, temp); | |
585 | free((char *) temp); | |
586 | } else { | |
587 | PyErr_SetString(PyExc_TypeError,"Expected a pointer"); | |
1d99702e | 588 | } |
1d99702e | 589 | } |
d14a1e28 RD |
590 | return -1; |
591 | } | |
592 | ||
593 | /* Create a new pointer object */ | |
594 | SWIGRUNTIME(PyObject *) | |
595 | SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) { | |
596 | PyObject *robj; | |
597 | if (!ptr) { | |
598 | Py_INCREF(Py_None); | |
599 | return Py_None; | |
1d99702e | 600 | } |
d14a1e28 RD |
601 | #ifdef SWIG_COBJECT_TYPES |
602 | robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) type->name, NULL); | |
603 | #else | |
604 | { | |
605 | char result[1024]; | |
606 | char *r = result; | |
607 | *(r++) = '_'; | |
608 | r = SWIG_PackData(r,&ptr,sizeof(void *)); | |
609 | strcpy(r,type->name); | |
610 | robj = PyString_FromString(result); | |
611 | } | |
612 | #endif | |
613 | if (!robj || (robj == Py_None)) return robj; | |
614 | if (type->clientdata) { | |
615 | PyObject *inst; | |
616 | PyObject *args = Py_BuildValue((char*)"(O)", robj); | |
617 | Py_DECREF(robj); | |
618 | inst = PyObject_CallObject((PyObject *) type->clientdata, args); | |
619 | Py_DECREF(args); | |
620 | if (inst) { | |
621 | if (own) { | |
622 | PyObject *n = PyInt_FromLong(1); | |
623 | PyObject_SetAttrString(inst,(char*)"thisown",n); | |
624 | Py_DECREF(n); | |
1d99702e | 625 | } |
d14a1e28 | 626 | robj = inst; |
1d99702e | 627 | } |
1d99702e | 628 | } |
d14a1e28 | 629 | return robj; |
1afc06c2 | 630 | } |
1d99702e | 631 | |
d14a1e28 RD |
632 | SWIGRUNTIME(PyObject *) |
633 | SWIG_Python_NewPackedObj(void *ptr, int sz, swig_type_info *type) { | |
634 | char result[1024]; | |
635 | char *r = result; | |
636 | if ((2*sz + 1 + strlen(type->name)) > 1000) return 0; | |
637 | *(r++) = '_'; | |
638 | r = SWIG_PackData(r,ptr,sz); | |
639 | strcpy(r,type->name); | |
640 | return PyString_FromString(result); | |
641 | } | |
3628e088 | 642 | |
d14a1e28 RD |
643 | /* Install Constants */ |
644 | SWIGRUNTIME(void) | |
645 | SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { | |
646 | int i; | |
647 | PyObject *obj; | |
648 | for (i = 0; constants[i].type; i++) { | |
649 | switch(constants[i].type) { | |
650 | case SWIG_PY_INT: | |
651 | obj = PyInt_FromLong(constants[i].lvalue); | |
652 | break; | |
653 | case SWIG_PY_FLOAT: | |
654 | obj = PyFloat_FromDouble(constants[i].dvalue); | |
655 | break; | |
656 | case SWIG_PY_STRING: | |
657 | obj = PyString_FromString((char *) constants[i].pvalue); | |
658 | break; | |
659 | case SWIG_PY_POINTER: | |
660 | obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); | |
661 | break; | |
662 | case SWIG_PY_BINARY: | |
663 | obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); | |
664 | break; | |
665 | default: | |
666 | obj = 0; | |
667 | break; | |
668 | } | |
669 | if (obj) { | |
670 | PyDict_SetItemString(d,constants[i].name,obj); | |
671 | Py_DECREF(obj); | |
672 | } | |
1d99702e | 673 | } |
1d99702e RD |
674 | } |
675 | ||
1d99702e | 676 | #endif |
6bddd8c5 | 677 | |
d14a1e28 | 678 | /* Contract support */ |
6bddd8c5 | 679 | |
11188b02 | 680 | #define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else |
1b62f00d | 681 | |
d14a1e28 RD |
682 | #ifdef __cplusplus |
683 | } | |
684 | #endif | |
98fb9b71 RD |
685 | |
686 | ||
687 | /* -------- TYPES TABLE (BEGIN) -------- */ | |
688 | ||
689 | static swig_type_info *swig_types[1]; | |
690 | ||
691 | /* -------- TYPES TABLE (END) -------- */ | |
692 | ||
693 | ||
694 | /*----------------------------------------------- | |
695 | @(target):= _swigrun.so | |
696 | ------------------------------------------------*/ | |
697 | #define SWIG_init init_swigrun | |
698 | ||
699 | #define SWIG_name "_swigrun" | |
700 | #ifdef __cplusplus | |
701 | extern "C" { | |
702 | #endif | |
703 | static PyMethodDef SwigMethods[] = { | |
704 | { NULL, NULL } | |
705 | }; | |
706 | ||
707 | ||
708 | /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ | |
709 | ||
710 | ||
711 | static swig_type_info *swig_types_initial[] = { | |
712 | 0 | |
713 | }; | |
714 | ||
715 | ||
716 | /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ | |
717 | ||
718 | static swig_const_info swig_const_table[] = { | |
719 | {0}}; | |
720 | ||
721 | #ifdef __cplusplus | |
722 | } | |
723 | #endif | |
724 | ||
725 | #ifdef __cplusplus | |
726 | extern "C" | |
727 | #endif | |
728 | SWIGEXPORT(void) SWIG_init(void) { | |
729 | static PyObject *SWIG_globals = 0; | |
730 | static int typeinit = 0; | |
731 | PyObject *m, *d; | |
732 | int i; | |
733 | if (!SWIG_globals) SWIG_globals = SWIG_newvarlink(); | |
734 | m = Py_InitModule((char *) SWIG_name, SwigMethods); | |
735 | d = PyModule_GetDict(m); | |
736 | ||
737 | if (!typeinit) { | |
738 | for (i = 0; swig_types_initial[i]; i++) { | |
739 | swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); | |
740 | } | |
741 | typeinit = 1; | |
742 | } | |
743 | SWIG_InstallConstants(d,swig_const_table); | |
744 | ||
745 | } | |
746 |