]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/libpy.c
Fixed typo causing multiple file selections to always return the same single name.
[wxWidgets.git] / wxPython / src / libpy.c
CommitLineData
98fb9b71
RD
1/* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
d7f82584 3 * Version 1.3.22
98fb9b71
RD
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
84extern "C" {
85#endif
6bddd8c5 86
d14a1e28
RD
87typedef void *(*swig_converter_func)(void *);
88typedef struct swig_type_info *(*swig_dycast_func)(void **);
89
90typedef 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
102SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
103SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
104SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
105SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **);
106SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *);
107SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *);
108SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *);
98fb9b71
RD
109SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
110SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
d14a1e28 111
6bddd8c5 112#else
d14a1e28
RD
113
114static swig_type_info *swig_type_list = 0;
115
116/* Register a type mapping with the type-checking */
117SWIGRUNTIME(swig_type_info *)
98fb9b71 118SWIG_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 */
156SWIGRUNTIME(swig_type_info *)
98fb9b71 157SWIG_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 */
182SWIGRUNTIME(void *)
98fb9b71 183SWIG_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 */
189SWIGRUNTIME(swig_type_info *)
98fb9b71 190SWIG_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 */
201SWIGRUNTIME(const char *)
202SWIG_TypeName(const swig_type_info *ty) {
203 return ty->name;
204}
205
206/* Search for a swig_type_info structure */
207SWIGRUNTIME(swig_type_info *)
208SWIG_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 */
219SWIGRUNTIME(void)
220SWIG_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 */
239SWIGRUNTIME(char *)
240SWIG_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 */
254SWIGRUNTIME(char *)
255SWIG_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
d7f82584 282
d14a1e28
RD
283/***********************************************************************
284 * python.swg
285 *
286 * This file contains the runtime support for Python modules
287 * and includes code for managing global variables and pointer
288 * type checking.
289 *
290 * Author : David Beazley (beazley@cs.uchicago.edu)
291 ************************************************************************/
292
98fb9b71 293#include "Python.h"
d14a1e28
RD
294
295#ifdef __cplusplus
296extern "C" {
6bddd8c5
RD
297#endif
298
d14a1e28
RD
299#define SWIG_PY_INT 1
300#define SWIG_PY_FLOAT 2
301#define SWIG_PY_STRING 3
302#define SWIG_PY_POINTER 4
303#define SWIG_PY_BINARY 5
304
305/* Flags for pointer conversion */
306
307#define SWIG_POINTER_EXCEPTION 0x1
308#define SWIG_POINTER_DISOWN 0x2
309
310/* Exception handling in wrappers */
311#define SWIG_fail goto fail
312
313/* Constant information structure */
314typedef struct swig_const_info {
315 int type;
316 char *name;
317 long lvalue;
318 double dvalue;
319 void *pvalue;
320 swig_type_info **ptype;
321} swig_const_info;
322
323/* Common SWIG API */
324#define SWIG_ConvertPtr(obj, pp, type, flags) \
325 SWIG_Python_ConvertPtr(obj, pp, type, flags)
326#define SWIG_NewPointerObj(p, type, flags) \
327 SWIG_Python_NewPointerObj(p, type, flags)
328#define SWIG_MustGetPtr(p, type, argnum, flags) \
329 SWIG_Python_MustGetPtr(p, type, argnum, flags)
d7f82584 330
d14a1e28
RD
331/* Python-specific SWIG API */
332#define SWIG_newvarlink() \
333 SWIG_Python_newvarlink()
334#define SWIG_addvarlink(p, name, get_attr, set_attr) \
335 SWIG_Python_addvarlink(p, name, get_attr, set_attr)
336#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) \
337 SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
d14a1e28
RD
338#define SWIG_NewPackedObj(ptr, sz, type) \
339 SWIG_Python_NewPackedObj(ptr, sz, type)
340#define SWIG_InstallConstants(d, constants) \
341 SWIG_Python_InstallConstants(d, constants)
342
d7f82584
RD
343typedef double (*py_objasdbl_conv)(PyObject *obj);
344
d14a1e28
RD
345#ifdef SWIG_NOINCLUDE
346
98fb9b71
RD
347SWIGIMPORT(int) SWIG_Python_ConvertPtr(PyObject *, void **, swig_type_info *, int);
348SWIGIMPORT(PyObject *) SWIG_Python_NewPointerObj(void *, swig_type_info *,int own);
349SWIGIMPORT(void *) SWIG_Python_MustGetPtr(PyObject *, swig_type_info *, int, int);
350SWIGIMPORT(PyObject *) SWIG_Python_newvarlink(void);
351SWIGIMPORT(void) SWIG_Python_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
352SWIGIMPORT(int) SWIG_Python_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int);
353SWIGIMPORT(PyObject *) SWIG_Python_NewPackedObj(void *, int sz, swig_type_info *);
354SWIGIMPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]);
355
d7f82584
RD
356/* -----------------------------------------------------------------------------
357 * the needed conversions between C++ and python
358 * ----------------------------------------------------------------------------- */
359/* basic types */
360/*
361 utilities
362*/
363SWIGIMPORT(char* ) SWIG_PyObj_AsCharPtr(PyObject *obj, swig_type_info* pchar_info);
364SWIGIMPORT(PyObject *) SWIG_PyObj_FromCharPtr(const char* cptr);
365SWIGIMPORT(unsigned long) SWIG_PyObj_AsUnsignedLong(PyObject * obj);
366SWIGIMPORT(long) SWIG_PyObj_AsLongInRange(PyObject * obj, const char* type,
367 long min_value, long max_value);
368SWIGIMPORT(unsigned long) SWIG_PyObj_AsUnsignedLongInRange(PyObject *obj, const char* type,
369 unsigned long max_value);
370SWIGIMPORT(char *) SWIG_PyObj_AsNewCharPtr(PyObject *obj, swig_type_info* pchar_info);
371SWIGIMPORT(void) SWIG_PyObj_AsCharPtrAndSize(PyObject *obj, swig_type_info* pchar_info,
372 char** cptr, size_t* size);
373SWIGIMPORT(void) SWIG_PyObj_AsCharArray(PyObject *obj, swig_type_info* pchar_info,
374 char* carray, size_t size);
375SWIGIMPORT(PyObject *) SWIG_PyObj_FromCharArray(const char* carray, size_t size);
376SWIGIMPORT(float) SWIG_PyObj_AsFloatConv(PyObject *obj, py_objasdbl_conv pyconv);
377
d14a1e28
RD
378#else
379
d7f82584 380
d14a1e28
RD
381/* -----------------------------------------------------------------------------
382 * global variable support code.
383 * ----------------------------------------------------------------------------- */
384
385typedef struct swig_globalvar {
386 char *name; /* Name of global variable */
387 PyObject *(*get_attr)(void); /* Return the current value */
388 int (*set_attr)(PyObject *); /* Set the value */
389 struct swig_globalvar *next;
6bddd8c5
RD
390} swig_globalvar;
391
392typedef struct swig_varlinkobject {
393 PyObject_HEAD
d14a1e28 394 swig_globalvar *vars;
6bddd8c5
RD
395} swig_varlinkobject;
396
6bddd8c5 397static PyObject *
d14a1e28 398swig_varlink_repr(swig_varlinkobject *v) {
6bddd8c5
RD
399 v = v;
400 return PyString_FromString("<Global variables>");
401}
402
6bddd8c5 403static int
d14a1e28
RD
404swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
405 swig_globalvar *var;
6bddd8c5
RD
406 flags = flags;
407 fprintf(fp,"Global variables { ");
d14a1e28
RD
408 for (var = v->vars; var; var=var->next) {
409 fprintf(fp,"%s", var->name);
410 if (var->next) fprintf(fp,", ");
6bddd8c5
RD
411 }
412 fprintf(fp," }\n");
413 return 0;
414}
415
6bddd8c5 416static PyObject *
d14a1e28
RD
417swig_varlink_getattr(swig_varlinkobject *v, char *n) {
418 swig_globalvar *var = v->vars;
419 while (var) {
420 if (strcmp(var->name,n) == 0) {
421 return (*var->get_attr)();
6bddd8c5 422 }
d14a1e28 423 var = var->next;
6bddd8c5 424 }
d14a1e28 425 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
6bddd8c5
RD
426 return NULL;
427}
428
6bddd8c5 429static int
d14a1e28
RD
430swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
431 swig_globalvar *var = v->vars;
432 while (var) {
433 if (strcmp(var->name,n) == 0) {
434 return (*var->set_attr)(p);
6bddd8c5 435 }
d14a1e28 436 var = var->next;
6bddd8c5 437 }
d14a1e28 438 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
6bddd8c5
RD
439 return 1;
440}
441
442statichere PyTypeObject varlinktype = {
d14a1e28 443 PyObject_HEAD_INIT(0)
6bddd8c5 444 0,
d14a1e28 445 (char *)"swigvarlink", /* Type name */
6bddd8c5
RD
446 sizeof(swig_varlinkobject), /* Basic size */
447 0, /* Itemsize */
d14a1e28 448 0, /* Deallocator */
6bddd8c5
RD
449 (printfunc) swig_varlink_print, /* Print */
450 (getattrfunc) swig_varlink_getattr, /* get attr */
451 (setattrfunc) swig_varlink_setattr, /* Set attr */
452 0, /* tp_compare */
d14a1e28 453 (reprfunc) swig_varlink_repr, /* tp_repr */
6bddd8c5
RD
454 0, /* tp_as_number */
455 0, /* tp_as_mapping*/
456 0, /* tp_hash */
457};
458
459/* Create a variable linking object for use later */
d14a1e28
RD
460SWIGRUNTIME(PyObject *)
461SWIG_Python_newvarlink(void) {
6bddd8c5
RD
462 swig_varlinkobject *result = 0;
463 result = PyMem_NEW(swig_varlinkobject,1);
464 varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */
465 result->ob_type = &varlinktype;
d14a1e28 466 result->vars = 0;
6bddd8c5
RD
467 result->ob_refcnt = 0;
468 Py_XINCREF((PyObject *) result);
469 return ((PyObject*) result);
470}
471
d14a1e28 472SWIGRUNTIME(void)
98fb9b71 473SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
6bddd8c5 474 swig_varlinkobject *v;
d14a1e28 475 swig_globalvar *gv;
6bddd8c5 476 v= (swig_varlinkobject *) p;
d14a1e28
RD
477 gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
478 gv->name = (char *) malloc(strlen(name)+1);
479 strcpy(gv->name,name);
480 gv->get_attr = get_attr;
481 gv->set_attr = set_attr;
482 gv->next = v->vars;
483 v->vars = gv;
6bddd8c5
RD
484}
485
d14a1e28
RD
486/* Convert a pointer value */
487SWIGRUNTIME(int)
488SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
489 swig_type_info *tc;
490 char *c = 0;
491 static PyObject *SWIG_this = 0;
492 int newref = 0;
493 PyObject *pyobj = 0;
494
495 if (!obj) return 0;
496 if (obj == Py_None) {
497 *ptr = 0;
498 return 0;
1d99702e 499 }
d14a1e28
RD
500#ifdef SWIG_COBJECT_TYPES
501 if (!(PyCObject_Check(obj))) {
502 if (!SWIG_this)
503 SWIG_this = PyString_FromString("this");
504 pyobj = obj;
505 obj = PyObject_GetAttr(obj,SWIG_this);
506 newref = 1;
507 if (!obj) goto type_error;
508 if (!PyCObject_Check(obj)) {
509 Py_DECREF(obj);
510 goto type_error;
511 }
512 }
513 *ptr = PyCObject_AsVoidPtr(obj);
514 c = (char *) PyCObject_GetDesc(obj);
515 if (newref) Py_DECREF(obj);
516 goto cobject;
517#else
518 if (!(PyString_Check(obj))) {
519 if (!SWIG_this)
520 SWIG_this = PyString_FromString("this");
521 pyobj = obj;
522 obj = PyObject_GetAttr(obj,SWIG_this);
523 newref = 1;
524 if (!obj) goto type_error;
525 if (!PyString_Check(obj)) {
526 Py_DECREF(obj);
527 goto type_error;
528 }
529 }
530 c = PyString_AsString(obj);
531 /* Pointer values must start with leading underscore */
532 if (*c != '_') {
533 *ptr = (void *) 0;
534 if (strcmp(c,"NULL") == 0) {
535 if (newref) { Py_DECREF(obj); }
536 return 0;
537 } else {
538 if (newref) { Py_DECREF(obj); }
539 goto type_error;
1d99702e
RD
540 }
541 }
d14a1e28
RD
542 c++;
543 c = SWIG_UnpackData(c,ptr,sizeof(void *));
544 if (newref) { Py_DECREF(obj); }
545#endif
546
547#ifdef SWIG_COBJECT_TYPES
548cobject:
549#endif
550
551 if (ty) {
552 tc = SWIG_TypeCheck(c,ty);
553 if (!tc) goto type_error;
554 *ptr = SWIG_TypeCast(tc,(void*) *ptr);
1d99702e
RD
555 }
556
d14a1e28 557 if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
98fb9b71
RD
558 PyObject *zero = PyInt_FromLong(0);
559 PyObject_SetAttrString(pyobj,(char*)"thisown",zero);
560 Py_DECREF(zero);
1d99702e 561 }
d14a1e28 562 return 0;
1d99702e 563
d14a1e28
RD
564type_error:
565 if (flags & SWIG_POINTER_EXCEPTION) {
566 if (ty && c) {
567 char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c));
568 sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
569 PyErr_SetString(PyExc_TypeError, temp);
570 free((char *) temp);
571 } else {
572 PyErr_SetString(PyExc_TypeError,"Expected a pointer");
1d99702e 573 }
1d99702e 574 }
d14a1e28 575 return -1;
1d99702e
RD
576}
577
d14a1e28
RD
578/* Convert a pointer value, signal an exception on a type mismatch */
579SWIGRUNTIME(void *)
98fb9b71 580SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
d14a1e28
RD
581 void *result;
582 SWIG_Python_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION);
583 return result;
584}
1d99702e 585
d14a1e28
RD
586/* Convert a packed value value */
587SWIGRUNTIME(int)
588SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
589 swig_type_info *tc;
590 char *c = 0;
591
592 if ((!obj) || (!PyString_Check(obj))) goto type_error;
593 c = PyString_AsString(obj);
1d99702e 594 /* Pointer values must start with leading underscore */
d14a1e28 595 if (*c != '_') goto type_error;
1d99702e 596 c++;
d14a1e28
RD
597 c = SWIG_UnpackData(c,ptr,sz);
598 if (ty) {
599 tc = SWIG_TypeCheck(c,ty);
600 if (!tc) goto type_error;
1d99702e 601 }
d14a1e28
RD
602 return 0;
603
604type_error:
605
606 if (flags) {
607 if (ty && c) {
608 char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c));
609 sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
610 PyErr_SetString(PyExc_TypeError, temp);
611 free((char *) temp);
612 } else {
613 PyErr_SetString(PyExc_TypeError,"Expected a pointer");
1d99702e 614 }
1d99702e 615 }
d14a1e28
RD
616 return -1;
617}
618
619/* Create a new pointer object */
620SWIGRUNTIME(PyObject *)
621SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) {
622 PyObject *robj;
623 if (!ptr) {
624 Py_INCREF(Py_None);
625 return Py_None;
1d99702e 626 }
d14a1e28
RD
627#ifdef SWIG_COBJECT_TYPES
628 robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) type->name, NULL);
629#else
630 {
631 char result[1024];
632 char *r = result;
633 *(r++) = '_';
634 r = SWIG_PackData(r,&ptr,sizeof(void *));
635 strcpy(r,type->name);
636 robj = PyString_FromString(result);
637 }
638#endif
639 if (!robj || (robj == Py_None)) return robj;
640 if (type->clientdata) {
641 PyObject *inst;
642 PyObject *args = Py_BuildValue((char*)"(O)", robj);
643 Py_DECREF(robj);
644 inst = PyObject_CallObject((PyObject *) type->clientdata, args);
645 Py_DECREF(args);
646 if (inst) {
647 if (own) {
648 PyObject *n = PyInt_FromLong(1);
649 PyObject_SetAttrString(inst,(char*)"thisown",n);
650 Py_DECREF(n);
1d99702e 651 }
d14a1e28 652 robj = inst;
1d99702e 653 }
1d99702e 654 }
d14a1e28 655 return robj;
1afc06c2 656}
1d99702e 657
d14a1e28
RD
658SWIGRUNTIME(PyObject *)
659SWIG_Python_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
660 char result[1024];
661 char *r = result;
662 if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
663 *(r++) = '_';
664 r = SWIG_PackData(r,ptr,sz);
665 strcpy(r,type->name);
666 return PyString_FromString(result);
667}
3628e088 668
d7f82584
RD
669/* -----------------------------------------------------------------------------
670 * the needed conversions between C++ and python
671 * ----------------------------------------------------------------------------- */
672
673#include <limits.h>
674#include <float.h>
675#include <string.h>
676
677SWIGRUNTIME(unsigned long)
678SWIG_PyObj_AsUnsignedLong(PyObject * obj)
679{
680 if (PyLong_Check(obj)) {
681 return PyLong_AsUnsignedLong(obj);
682 } else {
683 long i = PyInt_AsLong(obj);
684 if ( !PyErr_Occurred() && (i < 0)) {
685 PyErr_SetString(PyExc_TypeError, "negative value for unsigned type");
686 }
687 return i;
688 }
689}
690
691SWIGRUNTIME(long)
692SWIG_PyObj_AsLongInRange(PyObject * obj, const char* type,
693 long min_value, long max_value)
694{
a3331207 695 long value = PyInt_Check(obj) ? PyInt_AsLong(obj) : (long)PyLong_AsLongLong(obj);
d7f82584
RD
696 if (!PyErr_Occurred()) {
697 if (value < min_value) {
698 PyObject *err =
699 PyString_FromFormat("value %ld is less than '%s' minimum %ld",
700 value, type, min_value);
701
702 PyErr_SetObject(PyExc_OverflowError, err);
703 Py_XDECREF(err);
704 } else if (value > max_value) {
705 PyObject *err =
706 PyString_FromFormat("value %ld is greater than '%s' maximum %ld",
707 value, type, max_value);
708 PyErr_SetObject(PyExc_OverflowError, err);
709 Py_XDECREF(err);
710 }
711 }
712 return value;
713}
714
715SWIGRUNTIME(unsigned long)
716SWIG_PyObj_AsUnsignedLongInRange(PyObject *obj, const char* type,
717 unsigned long max_value)
718{
719 unsigned long value = SWIG_PyObj_AsUnsignedLong(obj);
720 if (!PyErr_Occurred()) {
721 if (value > max_value) {
722 PyObject *err =
723 PyString_FromFormat("value %ld is greater than '%s' minimum %ld",
724 value, type, max_value);
725 PyErr_SetObject(PyExc_OverflowError, err);
726 Py_XDECREF(err);
727 }
728 }
729 return value;
730}
731
732SWIGRUNTIME(float)
733SWIG_PyObj_AsFloatConv(PyObject *obj, py_objasdbl_conv pyconv)
734{
735 double value = pyconv(obj);
736 if (!PyErr_Occurred()) {
737 if (value < FLT_MIN) {
738 PyObject *err =
739 PyString_FromFormat("value %g is less than float minimum %g",
740 value, FLT_MIN);
741 PyErr_SetObject(PyExc_OverflowError, err);
742 Py_XDECREF(err);
743 } else if (value > FLT_MAX) {
744 PyObject *err =
745 PyString_FromFormat("value %g is greater than float maximum %g",
746 value, FLT_MAX);
747 PyErr_SetObject(PyExc_OverflowError, err);
748 Py_XDECREF(err);
749 }
750 }
751 return (float) value;
752}
753
754SWIGRUNTIME(void)
755SWIG_PyObj_AsCharPtrAndSize(PyObject *obj, swig_type_info* pchar_info,
756 char** cptr, size_t* size)
757{
758 int psize;
759 if ((!pchar_info) || SWIG_ConvertPtr(obj,(void **)cptr, pchar_info, 0) == -1) {
760 if (pchar_info && PyErr_Occurred()) PyErr_Clear();
761 PyString_AsStringAndSize(obj, cptr, &psize);
762 *size = (size_t) psize;
763 } else {
764 /* don't like strlen, but ... */
765 *size = (*cptr) ? (strlen(*cptr) + 1) : 0;
766 }
767}
768
769
770SWIGRUNTIME(char*)
771SWIG_PyObj_AsNewCharPtr(PyObject *obj, swig_type_info* pchar_info)
772{
773 char *res = 0;
774 char* cptr; size_t csize;
775 SWIG_PyObj_AsCharPtrAndSize(obj, pchar_info, &cptr, &csize);
776 if (!PyErr_Occurred() && cptr) {
777 /* we add the '0' terminator if needed */
778 size_t size = (csize && !(cptr[csize - 1])) ? csize : csize + 1;
779 if (size) {
780#ifdef __cplusplus
781 res = new char[size];
782#else
783 res = malloc(size);
784#endif
785 if (csize) memcpy(res, cptr, csize);
786 if (csize < size) res[csize] = 0;
787 }
788 }
789 return res;
790}
791
792SWIGRUNTIME(PyObject *)
793SWIG_PyObj_FromCharArray(const char* carray, size_t size)
794{
795 if (size > INT_MAX) {
796 PyObject *err =
797 PyString_FromFormat("a char array of size %d is not allowed in python",
798 size);
799 PyErr_SetObject(PyExc_TypeError, err);
800 Py_XDECREF(err);
801 Py_INCREF(Py_None);
802 return Py_None;
803 } else {
804 int psize = (int) size;
805 return PyString_FromStringAndSize(carray, psize);
806 }
807}
808
809SWIGRUNTIME(void)
810SWIG_PyObj_AsCharArray(PyObject *obj, swig_type_info* pchar_info,
811 char* carray, size_t size)
812{
813 char* cptr; size_t csize;
814 SWIG_PyObj_AsCharPtrAndSize(obj, pchar_info, &cptr, &csize);
815 if (!PyErr_Occurred()) {
816 /* in C (but not in C++) you can do:
817
818 char x[5] = "hello";
819
820 ie, assing the array using an extra '0' char. Here,
821 we assume the C behavior...
822 */
823 if ((csize == size + 1) && !(cptr[csize-1])) --csize;
824 if (csize > size) {
825 PyObject *err =
826 PyString_FromFormat("a char array of maximum size %d is expected",
827 size);
828 PyErr_SetObject(PyExc_TypeError, err);
829 Py_XDECREF(err);
830 } else {
831 if (csize) memcpy(carray, cptr, csize);
832 if (csize < size) memset(carray + csize, 0, size - csize);
833 }
834 }
835}
836
837SWIGRUNTIME(PyObject *)
838SWIG_PyObj_FromCharPtr(const char* cptr)
839{
840 if (cptr) {
841 return PyString_FromString(cptr);
842 } else {
843 Py_INCREF(Py_None);
844 return Py_None;
845 }
846}
847
848SWIGRUNTIME(char* )
849SWIG_PyObj_AsCharPtr(PyObject *obj, swig_type_info* pchar_info)
850{
851 char* ptr;
852 if (SWIG_ConvertPtr(obj,(void **)&ptr, pchar_info, 0) == -1) {
853 if (PyErr_Occurred()) PyErr_Clear();
854 ptr = PyString_AsString(obj);
855 }
856 return ptr;
857}
858
d14a1e28
RD
859/* Install Constants */
860SWIGRUNTIME(void)
861SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
862 int i;
863 PyObject *obj;
864 for (i = 0; constants[i].type; i++) {
865 switch(constants[i].type) {
866 case SWIG_PY_INT:
867 obj = PyInt_FromLong(constants[i].lvalue);
868 break;
869 case SWIG_PY_FLOAT:
870 obj = PyFloat_FromDouble(constants[i].dvalue);
871 break;
872 case SWIG_PY_STRING:
d7f82584 873 obj = SWIG_PyObj_FromCharPtr((char *) constants[i].pvalue);
d14a1e28
RD
874 break;
875 case SWIG_PY_POINTER:
876 obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
877 break;
878 case SWIG_PY_BINARY:
879 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
880 break;
881 default:
882 obj = 0;
883 break;
884 }
885 if (obj) {
886 PyDict_SetItemString(d,constants[i].name,obj);
887 Py_DECREF(obj);
888 }
1d99702e 889 }
1d99702e
RD
890}
891
1d99702e 892#endif
6bddd8c5 893
d14a1e28 894/* Contract support */
6bddd8c5 895
11188b02 896#define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
1b62f00d 897
d14a1e28
RD
898#ifdef __cplusplus
899}
900#endif
98fb9b71
RD
901
902
d7f82584 903
98fb9b71
RD
904/* -------- TYPES TABLE (BEGIN) -------- */
905
d7f82584
RD
906#define SWIGTYPE_p_char swig_types[0]
907static swig_type_info *swig_types[2];
98fb9b71
RD
908
909/* -------- TYPES TABLE (END) -------- */
910
911
912/*-----------------------------------------------
913 @(target):= _swigrun.so
914 ------------------------------------------------*/
915#define SWIG_init init_swigrun
916
917#define SWIG_name "_swigrun"
d7f82584
RD
918
919#include <limits.h>
920#include <float.h>
921#include <string.h>
922
923#ifndef SWIGSTATIC
924#ifdef __cplusplus
925#define SWIGSTATIC(a) static inline a
926#else
927#define SWIGSTATIC(a) static a
928#endif
929#endif
930
931#ifndef numeric_cast
932#ifdef __cplusplus
933#ifdef HAVE_NUMERIC_CAST
934#define numeric_cast(type,a) numeric_cast<type>(a)
935#else
936#define numeric_cast(type,a) static_cast<type>(a)
937#endif
938#else
939#define numeric_cast(type,a) (type)(a)
940#endif
941#endif
942
943
944
945#define SWIG_PyObj_FromSignedChar PyInt_FromLong
946#define SWIG_PyObj_FromUnsignedChar PyInt_FromLong
947#define SWIG_PyObj_FromShort PyInt_FromLong
948#define SWIG_PyObj_FromUnsignedShort PyInt_FromLong
949#define SWIG_PyObj_FromInt PyInt_FromLong
950#define SWIG_PyObj_FromLong PyInt_FromLong
951#define SWIG_PyObj_FromFloat PyFloat_FromDouble
952#define SWIG_PyObj_FromDouble PyFloat_FromDouble
953#define SWIG_PyObj_FromFloat PyFloat_FromDouble
954#define SWIG_PyObj_FromDouble PyFloat_FromDouble
955
98fb9b71
RD
956#ifdef __cplusplus
957extern "C" {
958#endif
959static PyMethodDef SwigMethods[] = {
960 { NULL, NULL }
961};
962
963
964/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
965
d7f82584 966static swig_type_info _swigt__p_char[] = {{"_p_char", 0, "char *", 0},{"_p_char"},{0}};
98fb9b71
RD
967
968static swig_type_info *swig_types_initial[] = {
d7f82584 969_swigt__p_char,
98fb9b71
RD
9700
971};
972
973
974/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
975
976static swig_const_info swig_const_table[] = {
977{0}};
978
979#ifdef __cplusplus
980}
981#endif
982
983#ifdef __cplusplus
984extern "C"
985#endif
986SWIGEXPORT(void) SWIG_init(void) {
987 static PyObject *SWIG_globals = 0;
988 static int typeinit = 0;
989 PyObject *m, *d;
990 int i;
991 if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
992 m = Py_InitModule((char *) SWIG_name, SwigMethods);
993 d = PyModule_GetDict(m);
994
995 if (!typeinit) {
996 for (i = 0; swig_types_initial[i]; i++) {
997 swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
998 }
999 typeinit = 1;
1000 }
1001 SWIG_InstallConstants(d,swig_const_table);
1002
1003}
1004