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