]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/libpy.c
Some change notes
[wxWidgets.git] / wxPython / src / libpy.c
1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
3 * Version 1.3.22
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_TypePrettyName SWIG_Python_TypePrettyName
32 #define SWIG_TypeQuery SWIG_Python_TypeQuery
33 #define SWIG_TypeClientData SWIG_Python_TypeClientData
34 #define SWIG_PackData SWIG_Python_PackData
35 #define SWIG_UnpackData SWIG_Python_UnpackData
36
37
38 /***********************************************************************
39 * common.swg
40 *
41 * This file contains generic SWIG runtime support for pointer
42 * type checking as well as a few commonly used macros to control
43 * external linkage.
44 *
45 * Author : David Beazley (beazley@cs.uchicago.edu)
46 *
47 * Copyright (c) 1999-2000, The University of Chicago
48 *
49 * This file may be freely redistributed without license or fee provided
50 * this copyright message remains intact.
51 ************************************************************************/
52
53 #include <string.h>
54
55 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
56 # if defined(_MSC_VER) || defined(__GNUC__)
57 # if defined(STATIC_LINKED)
58 # define SWIGEXPORT(a) a
59 # define SWIGIMPORT(a) extern a
60 # else
61 # define SWIGEXPORT(a) __declspec(dllexport) a
62 # define SWIGIMPORT(a) extern a
63 # endif
64 # else
65 # if defined(__BORLANDC__)
66 # define SWIGEXPORT(a) a _export
67 # define SWIGIMPORT(a) a _export
68 # else
69 # define SWIGEXPORT(a) a
70 # define SWIGIMPORT(a) a
71 # endif
72 # endif
73 #else
74 # define SWIGEXPORT(a) a
75 # define SWIGIMPORT(a) a
76 #endif
77
78 #ifdef SWIG_GLOBAL
79 # define SWIGRUNTIME(a) SWIGEXPORT(a)
80 #else
81 # define SWIGRUNTIME(a) static a
82 #endif
83
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87
88 typedef void *(*swig_converter_func)(void *);
89 typedef struct swig_type_info *(*swig_dycast_func)(void **);
90
91 typedef struct swig_type_info {
92 const char *name;
93 swig_converter_func converter;
94 const char *str;
95 void *clientdata;
96 swig_dycast_func dcast;
97 struct swig_type_info *next;
98 struct swig_type_info *prev;
99 } swig_type_info;
100
101 #ifdef SWIG_NOINCLUDE
102
103 SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
104 SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
105 SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
106 SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **);
107 SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *);
108 SWIGIMPORT(const char *) SWIG_TypePrettyName(const swig_type_info *);
109 SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *);
110 SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *);
111 SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
112 SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
113
114 #else
115
116 static swig_type_info *swig_type_list = 0;
117 static swig_type_info **swig_type_list_handle = &swig_type_list;
118
119 /* Register a type mapping with the type-checking */
120 SWIGRUNTIME(swig_type_info *)
121 SWIG_TypeRegister(swig_type_info *ti) {
122 swig_type_info *tc, *head, *ret, *next;
123 /* Check to see if this type has already been registered */
124 tc = *swig_type_list_handle;
125 while (tc) {
126 if (strcmp(tc->name, ti->name) == 0) {
127 /* Already exists in the table. Just add additional types to the list */
128 if (tc->clientdata) ti->clientdata = tc->clientdata;
129 head = tc;
130 next = tc->next;
131 goto l1;
132 }
133 tc = tc->prev;
134 }
135 head = ti;
136 next = 0;
137
138 /* Place in list */
139 ti->prev = *swig_type_list_handle;
140 *swig_type_list_handle = ti;
141
142 /* Build linked lists */
143 l1:
144 ret = head;
145 tc = ti + 1;
146 /* Patch up the rest of the links */
147 while (tc->name) {
148 head->next = tc;
149 tc->prev = head;
150 head = tc;
151 tc++;
152 }
153 if (next) next->prev = head;
154 head->next = next;
155 return ret;
156 }
157
158 /* Check the typename */
159 SWIGRUNTIME(swig_type_info *)
160 SWIG_TypeCheck(char *c, swig_type_info *ty) {
161 swig_type_info *s;
162 if (!ty) return 0; /* Void pointer */
163 s = ty->next; /* First element always just a name */
164 do {
165 if (strcmp(s->name,c) == 0) {
166 if (s == ty->next) return s;
167 /* Move s to the top of the linked list */
168 s->prev->next = s->next;
169 if (s->next) {
170 s->next->prev = s->prev;
171 }
172 /* Insert s as second element in the list */
173 s->next = ty->next;
174 if (ty->next) ty->next->prev = s;
175 ty->next = s;
176 s->prev = ty;
177 return s;
178 }
179 s = s->next;
180 } while (s && (s != ty->next));
181 return 0;
182 }
183
184 /* Cast a pointer up an inheritance hierarchy */
185 SWIGRUNTIME(void *)
186 SWIG_TypeCast(swig_type_info *ty, void *ptr) {
187 if ((!ty) || (!ty->converter)) return ptr;
188 return (*ty->converter)(ptr);
189 }
190
191 /* Dynamic pointer casting. Down an inheritance hierarchy */
192 SWIGRUNTIME(swig_type_info *)
193 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
194 swig_type_info *lastty = ty;
195 if (!ty || !ty->dcast) return ty;
196 while (ty && (ty->dcast)) {
197 ty = (*ty->dcast)(ptr);
198 if (ty) lastty = ty;
199 }
200 return lastty;
201 }
202
203 /* Return the name associated with this type */
204 SWIGRUNTIME(const char *)
205 SWIG_TypeName(const swig_type_info *ty) {
206 return ty->name;
207 }
208
209 /* Return the pretty name associated with this type,
210 that is an unmangled type name in a form presentable to the user.
211 */
212 SWIGRUNTIME(const char *)
213 SWIG_TypePrettyName(const swig_type_info *type) {
214 /* The "str" field contains the equivalent pretty names of the
215 type, separated by vertical-bar characters. We choose
216 to print the last name, as it is often (?) the most
217 specific. */
218 if (type->str != NULL) {
219 const char *last_name = type->str;
220 const char *s;
221 for (s = type->str; *s; s++)
222 if (*s == '|') last_name = s+1;
223 return last_name;
224 }
225 else
226 return type->name;
227 }
228
229 /*
230 Compare two type names skipping the space characters, therefore
231 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
232
233 Return 0 when the two name types are equivalent, as in
234 strncmp, but skipping ' '.
235 */
236 static int
237 SWIG_TypeNameComp(const char *f1, const char *l1,
238 const char *f2, const char *l2) {
239 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
240 while ((*f1 == ' ') && (f1 != l1)) ++f1;
241 while ((*f2 == ' ') && (f2 != l2)) ++f2;
242 if (*f1 != *f2) return *f1 - *f2;
243 }
244 return (l1 - f1) - (l2 - f2);
245 }
246
247 /*
248 Check type equivalence in a name list like <name1>|<name2>|...
249 */
250 static int
251 SWIG_TypeEquiv(const char *nb, const char *tb) {
252 int equiv = 0;
253 const char* te = tb + strlen(tb);
254 const char* ne = nb;
255 while (!equiv && *ne) {
256 for (nb = ne; *ne; ++ne) {
257 if (*ne == '|') break;
258 }
259 equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0;
260 if (*ne) ++ne;
261 }
262 return equiv;
263 }
264
265
266 /* Search for a swig_type_info structure */
267 SWIGRUNTIME(swig_type_info *)
268 SWIG_TypeQuery(const char *name) {
269 swig_type_info *ty = *swig_type_list_handle;
270 while (ty) {
271 if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
272 if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
273 ty = ty->prev;
274 }
275 return 0;
276 }
277
278 /* Set the clientdata field for a type */
279 SWIGRUNTIME(void)
280 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
281 swig_type_info *tc, *equiv;
282 if (ti->clientdata == clientdata) return;
283 ti->clientdata = clientdata;
284 equiv = ti->next;
285 while (equiv) {
286 if (!equiv->converter) {
287 tc = *swig_type_list_handle;
288 while (tc) {
289 if ((strcmp(tc->name, equiv->name) == 0))
290 SWIG_TypeClientData(tc,clientdata);
291 tc = tc->prev;
292 }
293 }
294 equiv = equiv->next;
295 }
296 }
297
298 /* Pack binary data into a string */
299 SWIGRUNTIME(char *)
300 SWIG_PackData(char *c, void *ptr, int sz) {
301 static char hex[17] = "0123456789abcdef";
302 unsigned char *u = (unsigned char *) ptr;
303 const unsigned char *eu = u + sz;
304 register unsigned char uu;
305 for (; u != eu; ++u) {
306 uu = *u;
307 *(c++) = hex[(uu & 0xf0) >> 4];
308 *(c++) = hex[uu & 0xf];
309 }
310 return c;
311 }
312
313 /* Unpack binary data from a string */
314 SWIGRUNTIME(char *)
315 SWIG_UnpackData(char *c, void *ptr, int sz) {
316 register unsigned char uu = 0;
317 register int d;
318 unsigned char *u = (unsigned char *) ptr;
319 const unsigned char *eu = u + sz;
320 for (; u != eu; ++u) {
321 d = *(c++);
322 if ((d >= '0') && (d <= '9'))
323 uu = ((d - '0') << 4);
324 else if ((d >= 'a') && (d <= 'f'))
325 uu = ((d - ('a'-10)) << 4);
326 d = *(c++);
327 if ((d >= '0') && (d <= '9'))
328 uu |= (d - '0');
329 else if ((d >= 'a') && (d <= 'f'))
330 uu |= (d - ('a'-10));
331 *u = uu;
332 }
333 return c;
334 }
335
336 #endif
337
338 #ifdef __cplusplus
339 }
340 #endif
341
342 /***********************************************************************
343 * pyrun.swg
344 *
345 * This file contains the runtime support for Python modules
346 * and includes code for managing global variables and pointer
347 * type checking.
348 *
349 * Author : David Beazley (beazley@cs.uchicago.edu)
350 ************************************************************************/
351
352 #ifdef __cplusplus
353 extern "C" {
354 #endif
355
356 #define SWIG_PY_INT 1
357 #define SWIG_PY_FLOAT 2
358 #define SWIG_PY_STRING 3
359 #define SWIG_PY_POINTER 4
360 #define SWIG_PY_BINARY 5
361
362 /* Flags for pointer conversion */
363
364 #define SWIG_POINTER_EXCEPTION 0x1
365 #define SWIG_POINTER_DISOWN 0x2
366
367 /* Exception handling in wrappers */
368 #define SWIG_fail goto fail
369
370 /* Constant information structure */
371 typedef struct swig_const_info {
372 int type;
373 char *name;
374 long lvalue;
375 double dvalue;
376 void *pvalue;
377 swig_type_info **ptype;
378 } swig_const_info;
379
380 /* Common SWIG API */
381 #define SWIG_ConvertPtr(obj, pp, type, flags) \
382 SWIG_Python_ConvertPtr(obj, pp, type, flags)
383 #define SWIG_NewPointerObj(p, type, flags) \
384 SWIG_Python_NewPointerObj(p, type, flags)
385 #define SWIG_MustGetPtr(p, type, argnum, flags) \
386 SWIG_Python_MustGetPtr(p, type, argnum, flags)
387
388 /* Python-specific SWIG API */
389 #define SWIG_newvarlink() \
390 SWIG_Python_newvarlink()
391 #define SWIG_addvarlink(p, name, get_attr, set_attr) \
392 SWIG_Python_addvarlink(p, name, get_attr, set_attr)
393 #define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) \
394 SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
395 #define SWIG_NewPackedObj(ptr, sz, type) \
396 SWIG_Python_NewPackedObj(ptr, sz, type)
397 #define SWIG_InstallConstants(d, constants) \
398 SWIG_Python_InstallConstants(d, constants)
399
400 typedef double (*py_objasdbl_conv)(PyObject *obj);
401
402 #ifdef SWIG_NOINCLUDE
403
404 SWIGIMPORT(int) SWIG_Python_ConvertPtr(PyObject *, void **, swig_type_info *, int);
405 SWIGIMPORT(PyObject *) SWIG_Python_NewPointerObj(void *, swig_type_info *,int own);
406 SWIGIMPORT(void *) SWIG_Python_MustGetPtr(PyObject *, swig_type_info *, int, int);
407 SWIGIMPORT(PyObject *) SWIG_Python_newvarlink(void);
408 SWIGIMPORT(void) SWIG_Python_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
409 SWIGIMPORT(int) SWIG_Python_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int);
410 SWIGIMPORT(PyObject *) SWIG_Python_NewPackedObj(void *, int sz, swig_type_info *);
411 SWIGIMPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]);
412
413
414 #else
415
416
417 /* -----------------------------------------------------------------------------
418 * global variable support code.
419 * ----------------------------------------------------------------------------- */
420
421 typedef struct swig_globalvar {
422 char *name; /* Name of global variable */
423 PyObject *(*get_attr)(void); /* Return the current value */
424 int (*set_attr)(PyObject *); /* Set the value */
425 struct swig_globalvar *next;
426 } swig_globalvar;
427
428 typedef struct swig_varlinkobject {
429 PyObject_HEAD
430 swig_globalvar *vars;
431 } swig_varlinkobject;
432
433 static PyObject *
434 swig_varlink_repr(swig_varlinkobject *v) {
435 v = v;
436 return PyString_FromString("<Global variables>");
437 }
438
439 static int
440 swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
441 swig_globalvar *var;
442 flags = flags;
443 fprintf(fp,"Global variables { ");
444 for (var = v->vars; var; var=var->next) {
445 fprintf(fp,"%s", var->name);
446 if (var->next) fprintf(fp,", ");
447 }
448 fprintf(fp," }\n");
449 return 0;
450 }
451
452 static PyObject *
453 swig_varlink_getattr(swig_varlinkobject *v, char *n) {
454 swig_globalvar *var = v->vars;
455 while (var) {
456 if (strcmp(var->name,n) == 0) {
457 return (*var->get_attr)();
458 }
459 var = var->next;
460 }
461 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
462 return NULL;
463 }
464
465 static int
466 swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
467 swig_globalvar *var = v->vars;
468 while (var) {
469 if (strcmp(var->name,n) == 0) {
470 return (*var->set_attr)(p);
471 }
472 var = var->next;
473 }
474 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
475 return 1;
476 }
477
478 statichere PyTypeObject varlinktype = {
479 PyObject_HEAD_INIT(0)
480 0, /* Number of items in variable part (ob_size) */
481 (char *)"swigvarlink", /* Type name (tp_name) */
482 sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
483 0, /* Itemsize (tp_itemsize) */
484 0, /* Deallocator (tp_dealloc) */
485 (printfunc) swig_varlink_print, /* Print (tp_print) */
486 (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
487 (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
488 0, /* tp_compare */
489 (reprfunc) swig_varlink_repr, /* tp_repr */
490 0, /* tp_as_number */
491 0, /* tp_as_sequence */
492 0, /* tp_as_mapping */
493 0, /* tp_hash */
494 0, /* tp_call */
495 0, /* tp_str */
496 0, /* tp_getattro */
497 0, /* tp_setattro */
498 0, /* tp_as_buffer */
499 0, /* tp_flags */
500 0, /* tp_doc */
501 0, /* tp_traverse */
502 0, /* tp_clear */
503 0, /* tp_richcompare */
504 0, /* tp_weaklistoffset */
505 #if PY_VERSION_HEX >= 0x02020000
506 0, /* tp_iter */
507 0, /* tp_iternext */
508 0, /* tp_methods */
509 0, /* tp_members */
510 0, /* tp_getset */
511 0, /* tp_base */
512 0, /* tp_dict */
513 0, /* tp_descr_get */
514 0, /* tp_descr_set */
515 0, /* tp_dictoffset */
516 0, /* tp_init */
517 0, /* tp_alloc */
518 0, /* tp_new */
519 0, /* tp_free */
520 0, /* tp_is_gc */
521 0, /* tp_bases */
522 0, /* tp_mro */
523 0, /* tp_cache */
524 0, /* tp_subclasses */
525 0, /* tp_weaklist */
526 #endif
527 #if PY_VERSION_HEX >= 0x02030200
528 0, /* tp_del */
529 #endif
530 #ifdef COUNT_ALLOCS
531 /* these must be last */
532 0, /* tp_alloc */
533 0, /* tp_free */
534 0, /* tp_maxalloc */
535 0, /* tp_next */
536 #endif
537 };
538
539 /* Create a variable linking object for use later */
540 SWIGRUNTIME(PyObject *)
541 SWIG_Python_newvarlink(void) {
542 swig_varlinkobject *result = 0;
543 result = PyMem_NEW(swig_varlinkobject,1);
544 varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */
545 result->ob_type = &varlinktype;
546 result->vars = 0;
547 result->ob_refcnt = 0;
548 Py_XINCREF((PyObject *) result);
549 return ((PyObject*) result);
550 }
551
552 SWIGRUNTIME(void)
553 SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
554 swig_varlinkobject *v;
555 swig_globalvar *gv;
556 v= (swig_varlinkobject *) p;
557 gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
558 gv->name = (char *) malloc(strlen(name)+1);
559 strcpy(gv->name,name);
560 gv->get_attr = get_attr;
561 gv->set_attr = set_attr;
562 gv->next = v->vars;
563 v->vars = gv;
564 }
565
566 /* Convert a pointer value */
567 SWIGRUNTIME(int)
568 SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
569 swig_type_info *tc;
570 char *c = 0;
571 static PyObject *SWIG_this = 0;
572 int newref = 0;
573 PyObject *pyobj = 0;
574
575 if (!obj) return 0;
576 if (obj == Py_None) {
577 *ptr = 0;
578 return 0;
579 }
580 #ifdef SWIG_COBJECT_TYPES
581 if (!(PyCObject_Check(obj))) {
582 if (!SWIG_this)
583 SWIG_this = PyString_FromString("this");
584 pyobj = obj;
585 obj = PyObject_GetAttr(obj,SWIG_this);
586 newref = 1;
587 if (!obj) goto type_error;
588 if (!PyCObject_Check(obj)) {
589 Py_DECREF(obj);
590 goto type_error;
591 }
592 }
593 *ptr = PyCObject_AsVoidPtr(obj);
594 c = (char *) PyCObject_GetDesc(obj);
595 if (newref) Py_DECREF(obj);
596 goto cobject;
597 #else
598 if (!(PyString_Check(obj))) {
599 if (!SWIG_this)
600 SWIG_this = PyString_FromString("this");
601 pyobj = obj;
602 obj = PyObject_GetAttr(obj,SWIG_this);
603 newref = 1;
604 if (!obj) goto type_error;
605 if (!PyString_Check(obj)) {
606 Py_DECREF(obj);
607 goto type_error;
608 }
609 }
610 c = PyString_AS_STRING(obj);
611 /* Pointer values must start with leading underscore */
612 if (*c != '_') {
613 *ptr = (void *) 0;
614 if (strcmp(c,"NULL") == 0) {
615 if (newref) { Py_DECREF(obj); }
616 return 0;
617 } else {
618 if (newref) { Py_DECREF(obj); }
619 goto type_error;
620 }
621 }
622 c++;
623 c = SWIG_UnpackData(c,ptr,sizeof(void *));
624 if (newref) { Py_DECREF(obj); }
625 #endif
626
627 #ifdef SWIG_COBJECT_TYPES
628 cobject:
629 #endif
630
631 if (ty) {
632 tc = SWIG_TypeCheck(c,ty);
633 if (!tc) goto type_error;
634 *ptr = SWIG_TypeCast(tc,(void*) *ptr);
635 }
636
637 if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
638 PyObject_SetAttrString(pyobj,(char*)"thisown",Py_False);
639 }
640 return 0;
641
642 type_error:
643 PyErr_Clear();
644 if (flags & SWIG_POINTER_EXCEPTION) {
645 if (ty && c) {
646 PyErr_Format(PyExc_TypeError,
647 "Type error. Got %s, expected %s",
648 c, ty->name);
649 } else {
650 PyErr_SetString(PyExc_TypeError,"Expected a pointer");
651 }
652 }
653 return -1;
654 }
655
656 /* Convert a pointer value, signal an exception on a type mismatch */
657 SWIGRUNTIME(void *)
658 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
659 void *result;
660 SWIG_Python_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION);
661 return result;
662 }
663
664 /* Convert a packed value value */
665 SWIGRUNTIME(int)
666 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
667 swig_type_info *tc;
668 char *c = 0;
669
670 if ((!obj) || (!PyString_Check(obj))) goto type_error;
671 c = PyString_AS_STRING(obj);
672 /* Pointer values must start with leading underscore */
673 if (*c != '_') goto type_error;
674 c++;
675 c = SWIG_UnpackData(c,ptr,sz);
676 if (ty) {
677 tc = SWIG_TypeCheck(c,ty);
678 if (!tc) goto type_error;
679 }
680 return 0;
681
682 type_error:
683
684 if (flags) {
685 if (ty && c) {
686 PyErr_Format(PyExc_TypeError,
687 "Type error. Got %s, expected %s",
688 c, ty->name);
689 } else {
690 PyErr_SetString(PyExc_TypeError,"Expected a pointer");
691 }
692 }
693 return -1;
694 }
695
696 /* Create a new pointer object */
697 SWIGRUNTIME(PyObject *)
698 SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) {
699 PyObject *robj;
700 if (!ptr) {
701 Py_INCREF(Py_None);
702 return Py_None;
703 }
704 #ifdef SWIG_COBJECT_TYPES
705 robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) type->name, NULL);
706 #else
707 {
708 char result[1024];
709 char *r = result;
710 *(r++) = '_';
711 r = SWIG_PackData(r,&ptr,sizeof(void *));
712 strcpy(r,type->name);
713 robj = PyString_FromString(result);
714 }
715 #endif
716 if (!robj || (robj == Py_None)) return robj;
717 if (type->clientdata) {
718 PyObject *inst;
719 PyObject *args = Py_BuildValue((char*)"(O)", robj);
720 Py_DECREF(robj);
721 inst = PyObject_CallObject((PyObject *) type->clientdata, args);
722 Py_DECREF(args);
723 if (inst) {
724 if (own) {
725 PyObject_SetAttrString(inst,(char*)"thisown",Py_True);
726 }
727 robj = inst;
728 }
729 }
730 return robj;
731 }
732
733 SWIGRUNTIME(PyObject *)
734 SWIG_Python_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
735 char result[1024];
736 char *r = result;
737 if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
738 *(r++) = '_';
739 r = SWIG_PackData(r,ptr,sz);
740 strcpy(r,type->name);
741 return PyString_FromString(result);
742 }
743
744 /* Install Constants */
745 SWIGRUNTIME(void)
746 SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
747 int i;
748 PyObject *obj;
749 for (i = 0; constants[i].type; i++) {
750 switch(constants[i].type) {
751 case SWIG_PY_INT:
752 obj = PyInt_FromLong(constants[i].lvalue);
753 break;
754 case SWIG_PY_FLOAT:
755 obj = PyFloat_FromDouble(constants[i].dvalue);
756 break;
757 case SWIG_PY_STRING:
758 if (constants[i].pvalue) {
759 obj = PyString_FromString((char *) constants[i].pvalue);
760 } else {
761 Py_INCREF(Py_None);
762 obj = Py_None;
763 }
764 break;
765 case SWIG_PY_POINTER:
766 obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
767 break;
768 case SWIG_PY_BINARY:
769 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
770 break;
771 default:
772 obj = 0;
773 break;
774 }
775 if (obj) {
776 PyDict_SetItemString(d,constants[i].name,obj);
777 Py_DECREF(obj);
778 }
779 }
780 }
781
782 #endif
783
784 /* Contract support */
785
786 #define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
787
788 #ifdef __cplusplus
789 }
790 #endif
791
792
793 /* -------- TYPES TABLE (BEGIN) -------- */
794
795 #define SWIGTYPE_p_char swig_types[0]
796 static swig_type_info *swig_types[2];
797
798 /* -------- TYPES TABLE (END) -------- */
799
800 #define SWIG_init initswigrun
801
802 #define SWIG_name "swigrun"
803
804 /* Auxiliar swig macros that appear in the header */
805
806 #define SWIG_OLDOBJ 1
807 #define SWIG_NEWOBJ SWIG_OLDOBJ + 1
808 #define SWIG_PYSTR SWIG_NEWOBJ + 1
809
810 #ifdef __cplusplus
811 #define SWIGSTATICINLINE(a) static inline a
812 #define SWIGSTATIC(a) static a
813 #define swig_new_array(size,Type) (new Type[(size)])
814 #define swig_delete(cptr) delete cptr
815 #define swig_delete_array(cptr) delete[] cptr
816 #define swig_const_cast(a,Type) const_cast<Type >(a)
817 #define swig_static_cast(a,Type) static_cast<Type >(a)
818 #define swig_reinterpret_cast(a,Type) reinterpret_cast<Type >(a)
819 #define swig_new_copy(ptr,Type) (new Type(*ptr))
820 #define swig_numeric_cast(a,Type) static_cast<Type >(a)
821
822 #else /* C case */
823
824 #define SWIGSTATICINLINE(a) static a
825 #define SWIGSTATIC(a) static a
826 #define swig_new_array(size,Type) ((Type*) malloc((size)*sizeof(Type)))
827 #define swig_delete(cptr) free((char*)cptr)
828 #define swig_delete_array(cptr) free((char*)cptr)
829 #define swig_const_cast(a,Type) (Type)(a)
830 #define swig_static_cast(a,Type) (Type)(a)
831 #define swig_reinterpret_cast(a,Type) (Type)(a)
832 #define swig_numeric_cast(a,Type) (Type)(a)
833 #define swig_new_copy(ptr,Type) ((Type*)memcpy(malloc(sizeof(Type)),ptr,sizeof(Type)))
834
835 #endif /* __cplusplus */
836
837
838 /*@/opt/swig/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/
839 #define SWIG_From_signed_SS_char PyInt_FromLong
840 /*@@*/
841 /*@/opt/swig/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/
842 #define SWIG_From_unsigned_SS_char PyInt_FromLong
843 /*@@*/
844 /*@/opt/swig/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/
845 #define SWIG_From_short PyInt_FromLong
846 /*@@*/
847 /*@/opt/swig/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/
848 #define SWIG_From_unsigned_SS_short PyInt_FromLong
849 /*@@*/
850 /*@/opt/swig/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/
851 #define SWIG_From_int PyInt_FromLong
852 /*@@*/
853 /*@/opt/swig/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/
854 #define SWIG_From_long PyInt_FromLong
855 /*@@*/
856 /*@/opt/swig/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/
857 #define SWIG_From_float PyFloat_FromDouble
858 /*@@*/
859 /*@/opt/swig/share/swig/1.3.22/python/pymacros.swg,63,SWIG_define@*/
860 #define SWIG_From_double PyFloat_FromDouble
861 /*@@*/
862
863 #ifdef __cplusplus
864 extern "C" {
865 #endif
866 static PyMethodDef SwigMethods[] = {
867 { NULL, NULL, 0, NULL }
868 };
869
870
871 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
872
873 static swig_type_info _swigt__p_char[] = {{"_p_char", 0, "char *", 0, 0, 0, 0},{"_p_char", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
874
875 static swig_type_info *swig_types_initial[] = {
876 _swigt__p_char,
877 0
878 };
879
880
881 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
882
883 static swig_const_info swig_const_table[] = {
884 {0, 0, 0, 0.0, 0, 0}};
885
886 #ifdef __cplusplus
887 }
888 #endif
889
890 #ifdef __cplusplus
891 extern "C"
892 #endif
893 SWIGEXPORT(void) SWIG_init(void) {
894 static PyObject *SWIG_globals = 0;
895 static int typeinit = 0;
896 PyObject *m, *d;
897 int i;
898 if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
899 m = Py_InitModule((char *) SWIG_name, SwigMethods);
900 d = PyModule_GetDict(m);
901
902 if (!typeinit) {
903 for (i = 0; swig_types_initial[i]; i++) {
904 swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
905 }
906 typeinit = 1;
907 }
908 SWIG_InstallConstants(d,swig_const_table);
909
910 }
911