]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/libpy.c
Fixed typo causing multiple file selections to always return the same single name.
[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_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 /***********************************************************************
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.
43 *
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.
50 ************************************************************************/
51
52 #include <string.h>
53
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
72 #else
73 # define SWIGEXPORT(a) a
74 # define SWIGIMPORT(a) a
75 #endif
76
77 #ifdef SWIG_GLOBAL
78 # define SWIGRUNTIME(a) SWIGEXPORT(a)
79 #else
80 # define SWIGRUNTIME(a) static a
81 #endif
82
83 #ifdef __cplusplus
84 extern "C" {
85 #endif
86
87 typedef void *(*swig_converter_func)(void *);
88 typedef struct swig_type_info *(*swig_dycast_func)(void **);
89
90 typedef struct swig_type_info {
91 const char *name;
92 swig_converter_func converter;
93 const char *str;
94 void *clientdata;
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 *);
109 SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
110 SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
111
112 #else
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 *)
118 SWIG_TypeRegister(swig_type_info *ti) {
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 */
125 if (tc->clientdata) ti->clientdata = tc->clientdata;
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 */
140 l1:
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 }
150 if (next) next->prev = head;
151 head->next = next;
152 return ret;
153 }
154
155 /* Check the typename */
156 SWIGRUNTIME(swig_type_info *)
157 SWIG_TypeCheck(char *c, swig_type_info *ty) {
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) {
167 s->next->prev = s->prev;
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;
173 s->prev = ty;
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 *)
183 SWIG_TypeCast(swig_type_info *ty, void *ptr) {
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 *)
190 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
191 swig_type_info *lastty = ty;
192 if (!ty || !ty->dcast) return ty;
193 while (ty && (ty->dcast)) {
194 ty = (*ty->dcast)(ptr);
195 if (ty) lastty = ty;
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) {
229 if ((strcmp(tc->name, equiv->name) == 0))
230 SWIG_TypeClientData(tc,clientdata);
231 tc = tc->prev;
232 }
233 }
234 equiv = equiv->next;
235 }
236 }
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
276 #endif
277
278 #ifdef __cplusplus
279 }
280 #endif
281
282
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
293 #include "Python.h"
294
295 #ifdef __cplusplus
296 extern "C" {
297 #endif
298
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 */
314 typedef 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)
330
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)
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
343 typedef double (*py_objasdbl_conv)(PyObject *obj);
344
345 #ifdef SWIG_NOINCLUDE
346
347 SWIGIMPORT(int) SWIG_Python_ConvertPtr(PyObject *, void **, swig_type_info *, int);
348 SWIGIMPORT(PyObject *) SWIG_Python_NewPointerObj(void *, swig_type_info *,int own);
349 SWIGIMPORT(void *) SWIG_Python_MustGetPtr(PyObject *, swig_type_info *, int, int);
350 SWIGIMPORT(PyObject *) SWIG_Python_newvarlink(void);
351 SWIGIMPORT(void) SWIG_Python_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
352 SWIGIMPORT(int) SWIG_Python_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int);
353 SWIGIMPORT(PyObject *) SWIG_Python_NewPackedObj(void *, int sz, swig_type_info *);
354 SWIGIMPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]);
355
356 /* -----------------------------------------------------------------------------
357 * the needed conversions between C++ and python
358 * ----------------------------------------------------------------------------- */
359 /* basic types */
360 /*
361 utilities
362 */
363 SWIGIMPORT(char* ) SWIG_PyObj_AsCharPtr(PyObject *obj, swig_type_info* pchar_info);
364 SWIGIMPORT(PyObject *) SWIG_PyObj_FromCharPtr(const char* cptr);
365 SWIGIMPORT(unsigned long) SWIG_PyObj_AsUnsignedLong(PyObject * obj);
366 SWIGIMPORT(long) SWIG_PyObj_AsLongInRange(PyObject * obj, const char* type,
367 long min_value, long max_value);
368 SWIGIMPORT(unsigned long) SWIG_PyObj_AsUnsignedLongInRange(PyObject *obj, const char* type,
369 unsigned long max_value);
370 SWIGIMPORT(char *) SWIG_PyObj_AsNewCharPtr(PyObject *obj, swig_type_info* pchar_info);
371 SWIGIMPORT(void) SWIG_PyObj_AsCharPtrAndSize(PyObject *obj, swig_type_info* pchar_info,
372 char** cptr, size_t* size);
373 SWIGIMPORT(void) SWIG_PyObj_AsCharArray(PyObject *obj, swig_type_info* pchar_info,
374 char* carray, size_t size);
375 SWIGIMPORT(PyObject *) SWIG_PyObj_FromCharArray(const char* carray, size_t size);
376 SWIGIMPORT(float) SWIG_PyObj_AsFloatConv(PyObject *obj, py_objasdbl_conv pyconv);
377
378 #else
379
380
381 /* -----------------------------------------------------------------------------
382 * global variable support code.
383 * ----------------------------------------------------------------------------- */
384
385 typedef 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;
390 } swig_globalvar;
391
392 typedef struct swig_varlinkobject {
393 PyObject_HEAD
394 swig_globalvar *vars;
395 } swig_varlinkobject;
396
397 static PyObject *
398 swig_varlink_repr(swig_varlinkobject *v) {
399 v = v;
400 return PyString_FromString("<Global variables>");
401 }
402
403 static int
404 swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
405 swig_globalvar *var;
406 flags = flags;
407 fprintf(fp,"Global variables { ");
408 for (var = v->vars; var; var=var->next) {
409 fprintf(fp,"%s", var->name);
410 if (var->next) fprintf(fp,", ");
411 }
412 fprintf(fp," }\n");
413 return 0;
414 }
415
416 static PyObject *
417 swig_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)();
422 }
423 var = var->next;
424 }
425 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
426 return NULL;
427 }
428
429 static int
430 swig_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);
435 }
436 var = var->next;
437 }
438 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
439 return 1;
440 }
441
442 statichere PyTypeObject varlinktype = {
443 PyObject_HEAD_INIT(0)
444 0,
445 (char *)"swigvarlink", /* Type name */
446 sizeof(swig_varlinkobject), /* Basic size */
447 0, /* Itemsize */
448 0, /* Deallocator */
449 (printfunc) swig_varlink_print, /* Print */
450 (getattrfunc) swig_varlink_getattr, /* get attr */
451 (setattrfunc) swig_varlink_setattr, /* Set attr */
452 0, /* tp_compare */
453 (reprfunc) swig_varlink_repr, /* tp_repr */
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 */
460 SWIGRUNTIME(PyObject *)
461 SWIG_Python_newvarlink(void) {
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;
466 result->vars = 0;
467 result->ob_refcnt = 0;
468 Py_XINCREF((PyObject *) result);
469 return ((PyObject*) result);
470 }
471
472 SWIGRUNTIME(void)
473 SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
474 swig_varlinkobject *v;
475 swig_globalvar *gv;
476 v= (swig_varlinkobject *) p;
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;
484 }
485
486 /* Convert a pointer value */
487 SWIGRUNTIME(int)
488 SWIG_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;
499 }
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;
540 }
541 }
542 c++;
543 c = SWIG_UnpackData(c,ptr,sizeof(void *));
544 if (newref) { Py_DECREF(obj); }
545 #endif
546
547 #ifdef SWIG_COBJECT_TYPES
548 cobject:
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);
555 }
556
557 if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
558 PyObject *zero = PyInt_FromLong(0);
559 PyObject_SetAttrString(pyobj,(char*)"thisown",zero);
560 Py_DECREF(zero);
561 }
562 return 0;
563
564 type_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");
573 }
574 }
575 return -1;
576 }
577
578 /* Convert a pointer value, signal an exception on a type mismatch */
579 SWIGRUNTIME(void *)
580 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
581 void *result;
582 SWIG_Python_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION);
583 return result;
584 }
585
586 /* Convert a packed value value */
587 SWIGRUNTIME(int)
588 SWIG_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);
594 /* Pointer values must start with leading underscore */
595 if (*c != '_') goto type_error;
596 c++;
597 c = SWIG_UnpackData(c,ptr,sz);
598 if (ty) {
599 tc = SWIG_TypeCheck(c,ty);
600 if (!tc) goto type_error;
601 }
602 return 0;
603
604 type_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");
614 }
615 }
616 return -1;
617 }
618
619 /* Create a new pointer object */
620 SWIGRUNTIME(PyObject *)
621 SWIG_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;
626 }
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);
651 }
652 robj = inst;
653 }
654 }
655 return robj;
656 }
657
658 SWIGRUNTIME(PyObject *)
659 SWIG_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 }
668
669 /* -----------------------------------------------------------------------------
670 * the needed conversions between C++ and python
671 * ----------------------------------------------------------------------------- */
672
673 #include <limits.h>
674 #include <float.h>
675 #include <string.h>
676
677 SWIGRUNTIME(unsigned long)
678 SWIG_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
691 SWIGRUNTIME(long)
692 SWIG_PyObj_AsLongInRange(PyObject * obj, const char* type,
693 long min_value, long max_value)
694 {
695 long value = PyInt_Check(obj) ? PyInt_AsLong(obj) : (long)PyLong_AsLongLong(obj);
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
715 SWIGRUNTIME(unsigned long)
716 SWIG_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
732 SWIGRUNTIME(float)
733 SWIG_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
754 SWIGRUNTIME(void)
755 SWIG_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
770 SWIGRUNTIME(char*)
771 SWIG_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
792 SWIGRUNTIME(PyObject *)
793 SWIG_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
809 SWIGRUNTIME(void)
810 SWIG_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
837 SWIGRUNTIME(PyObject *)
838 SWIG_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
848 SWIGRUNTIME(char* )
849 SWIG_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
859 /* Install Constants */
860 SWIGRUNTIME(void)
861 SWIG_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:
873 obj = SWIG_PyObj_FromCharPtr((char *) constants[i].pvalue);
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 }
889 }
890 }
891
892 #endif
893
894 /* Contract support */
895
896 #define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
897
898 #ifdef __cplusplus
899 }
900 #endif
901
902
903
904 /* -------- TYPES TABLE (BEGIN) -------- */
905
906 #define SWIGTYPE_p_char swig_types[0]
907 static swig_type_info *swig_types[2];
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"
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
956 #ifdef __cplusplus
957 extern "C" {
958 #endif
959 static PyMethodDef SwigMethods[] = {
960 { NULL, NULL }
961 };
962
963
964 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
965
966 static swig_type_info _swigt__p_char[] = {{"_p_char", 0, "char *", 0},{"_p_char"},{0}};
967
968 static swig_type_info *swig_types_initial[] = {
969 _swigt__p_char,
970 0
971 };
972
973
974 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
975
976 static swig_const_info swig_const_table[] = {
977 {0}};
978
979 #ifdef __cplusplus
980 }
981 #endif
982
983 #ifdef __cplusplus
984 extern "C"
985 #endif
986 SWIGEXPORT(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