1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
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 * ----------------------------------------------------------------------------- */
18 /*************************************************************** -*- c -*-
19 * python/precommon.swg
21 * Rename all exported symbols from common.swg, to avoid symbol
22 * clashes if multiple interpreters are included
24 ************************************************************************/
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
37 /***********************************************************************
40 * This file contains generic SWIG runtime support for pointer
41 * type checking as well as a few commonly used macros to control
44 * Author : David Beazley (beazley@cs.uchicago.edu)
46 * Copyright (c) 1999-2000, The University of Chicago
48 * This file may be freely redistributed without license or fee provided
49 * this copyright message remains intact.
50 ************************************************************************/
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
60 # define SWIGEXPORT(a) __declspec(dllexport) a
61 # define SWIGIMPORT(a) extern a
64 # if defined(__BORLANDC__)
65 # define SWIGEXPORT(a) a _export
66 # define SWIGIMPORT(a) a _export
68 # define SWIGEXPORT(a) a
69 # define SWIGIMPORT(a) a
73 # define SWIGEXPORT(a) a
74 # define SWIGIMPORT(a) a
78 # define SWIGRUNTIME(a) SWIGEXPORT(a)
80 # define SWIGRUNTIME(a) static a
87 typedef void *(*swig_converter_func
)(void *);
88 typedef struct swig_type_info
*(*swig_dycast_func
)(void **);
90 typedef struct swig_type_info
{
92 swig_converter_func converter
;
95 swig_dycast_func dcast
;
96 struct swig_type_info
*next
;
97 struct swig_type_info
*prev
;
100 #ifdef SWIG_NOINCLUDE
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);
114 static swig_type_info
*swig_type_list
= 0;
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 */
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
;
136 ti
->prev
= swig_type_list
;
139 /* Build linked lists */
143 /* Patch up the rest of the links */
150 if (next
) next
->prev
= head
;
155 /* Check the typename */
156 SWIGRUNTIME(swig_type_info
*)
157 SWIG_TypeCheck(char *c
, swig_type_info
*ty
) {
159 if (!ty
) return 0; /* Void pointer */
160 s
= ty
->next
; /* First element always just a name */
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
;
167 s
->next
->prev
= s
->prev
;
169 /* Insert s as second element in the list */
171 if (ty
->next
) ty
->next
->prev
= s
;
177 } while (s
&& (s
!= ty
->next
));
181 /* Cast a pointer up an inheritance hierarchy */
183 SWIG_TypeCast(swig_type_info
*ty
, void *ptr
) {
184 if ((!ty
) || (!ty
->converter
)) return ptr
;
185 return (*ty
->converter
)(ptr
);
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
);
200 /* Return the name associated with this type */
201 SWIGRUNTIME(const char *)
202 SWIG_TypeName(const swig_type_info
*ty
) {
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
;
211 if (ty
->str
&& (strcmp(name
,ty
->str
) == 0)) return ty
;
212 if (ty
->name
&& (strcmp(name
,ty
->name
) == 0)) return ty
;
218 /* Set the clientdata field for a type */
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
;
226 if (!equiv
->converter
) {
229 if ((strcmp(tc
->name
, equiv
->name
) == 0))
230 SWIG_TypeClientData(tc
,clientdata
);
238 /* Pack binary data into a string */
240 SWIG_PackData(char *c
, void *ptr
, int sz
) {
241 static char hex
[17] = "0123456789abcdef";
243 unsigned char *u
= (unsigned char *) ptr
;
244 register unsigned char uu
;
245 for (i
= 0; i
< sz
; i
++,u
++) {
247 *(c
++) = hex
[(uu
& 0xf0) >> 4];
248 *(c
++) = hex
[uu
& 0xf];
253 /* Unpack binary data from a string */
255 SWIG_UnpackData(char *c
, void *ptr
, int sz
) {
256 register unsigned char uu
= 0;
258 unsigned char *u
= (unsigned char *) ptr
;
260 for (i
= 0; i
< sz
; i
++, u
++) {
262 if ((d
>= '0') && (d
<= '9'))
263 uu
= ((d
- '0') << 4);
264 else if ((d
>= 'a') && (d
<= 'f'))
265 uu
= ((d
- ('a'-10)) << 4);
267 if ((d
>= '0') && (d
<= '9'))
269 else if ((d
>= 'a') && (d
<= 'f'))
270 uu
|= (d
- ('a'-10));
283 /***********************************************************************
286 * This file contains the runtime support for Python modules
287 * and includes code for managing global variables and pointer
290 * Author : David Beazley (beazley@cs.uchicago.edu)
291 ************************************************************************/
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
305 /* Flags for pointer conversion */
307 #define SWIG_POINTER_EXCEPTION 0x1
308 #define SWIG_POINTER_DISOWN 0x2
310 /* Exception handling in wrappers */
311 #define SWIG_fail goto fail
313 /* Constant information structure */
314 typedef struct swig_const_info
{
320 swig_type_info
**ptype
;
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)
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)
343 typedef double (*py_objasdbl_conv
)(PyObject
*obj
);
345 #ifdef SWIG_NOINCLUDE
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
[]);
356 /* -----------------------------------------------------------------------------
357 * the needed conversions between C++ and python
358 * ----------------------------------------------------------------------------- */
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
);
381 /* -----------------------------------------------------------------------------
382 * global variable support code.
383 * ----------------------------------------------------------------------------- */
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
;
392 typedef struct swig_varlinkobject
{
394 swig_globalvar
*vars
;
395 } swig_varlinkobject
;
398 swig_varlink_repr(swig_varlinkobject
*v
) {
400 return PyString_FromString("<Global variables>");
404 swig_varlink_print(swig_varlinkobject
*v
, FILE *fp
, int 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
,", ");
417 swig_varlink_getattr(swig_varlinkobject
*v
, char *n
) {
418 swig_globalvar
*var
= v
->vars
;
420 if (strcmp(var
->name
,n
) == 0) {
421 return (*var
->get_attr
)();
425 PyErr_SetString(PyExc_NameError
,"Unknown C global variable");
430 swig_varlink_setattr(swig_varlinkobject
*v
, char *n
, PyObject
*p
) {
431 swig_globalvar
*var
= v
->vars
;
433 if (strcmp(var
->name
,n
) == 0) {
434 return (*var
->set_attr
)(p
);
438 PyErr_SetString(PyExc_NameError
,"Unknown C global variable");
442 statichere PyTypeObject varlinktype
= {
443 PyObject_HEAD_INIT(0)
445 (char *)"swigvarlink", /* Type name */
446 sizeof(swig_varlinkobject
), /* Basic size */
449 (printfunc
) swig_varlink_print
, /* Print */
450 (getattrfunc
) swig_varlink_getattr
, /* get attr */
451 (setattrfunc
) swig_varlink_setattr
, /* Set attr */
453 (reprfunc
) swig_varlink_repr
, /* tp_repr */
454 0, /* tp_as_number */
455 0, /* tp_as_mapping*/
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
;
467 result
->ob_refcnt
= 0;
468 Py_XINCREF((PyObject
*) result
);
469 return ((PyObject
*) result
);
473 SWIG_Python_addvarlink(PyObject
*p
, char *name
, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
)) {
474 swig_varlinkobject
*v
;
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
;
486 /* Convert a pointer value */
488 SWIG_Python_ConvertPtr(PyObject
*obj
, void **ptr
, swig_type_info
*ty
, int flags
) {
491 static PyObject
*SWIG_this
= 0;
496 if (obj
== Py_None
) {
500 #ifdef SWIG_COBJECT_TYPES
501 if (!(PyCObject_Check(obj
))) {
503 SWIG_this
= PyString_FromString("this");
505 obj
= PyObject_GetAttr(obj
,SWIG_this
);
507 if (!obj
) goto type_error
;
508 if (!PyCObject_Check(obj
)) {
513 *ptr
= PyCObject_AsVoidPtr(obj
);
514 c
= (char *) PyCObject_GetDesc(obj
);
515 if (newref
) Py_DECREF(obj
);
518 if (!(PyString_Check(obj
))) {
520 SWIG_this
= PyString_FromString("this");
522 obj
= PyObject_GetAttr(obj
,SWIG_this
);
524 if (!obj
) goto type_error
;
525 if (!PyString_Check(obj
)) {
530 c
= PyString_AsString(obj
);
531 /* Pointer values must start with leading underscore */
534 if (strcmp(c
,"NULL") == 0) {
535 if (newref
) { Py_DECREF(obj
); }
538 if (newref
) { Py_DECREF(obj
); }
543 c
= SWIG_UnpackData(c
,ptr
,sizeof(void *));
544 if (newref
) { Py_DECREF(obj
); }
547 #ifdef SWIG_COBJECT_TYPES
552 tc
= SWIG_TypeCheck(c
,ty
);
553 if (!tc
) goto type_error
;
554 *ptr
= SWIG_TypeCast(tc
,(void*) *ptr
);
557 if ((pyobj
) && (flags
& SWIG_POINTER_DISOWN
)) {
558 PyObject
*zero
= PyInt_FromLong(0);
559 PyObject_SetAttrString(pyobj
,(char*)"thisown",zero
);
565 if (flags
& SWIG_POINTER_EXCEPTION
) {
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
);
572 PyErr_SetString(PyExc_TypeError
,"Expected a pointer");
578 /* Convert a pointer value, signal an exception on a type mismatch */
580 SWIG_Python_MustGetPtr(PyObject
*obj
, swig_type_info
*ty
, int argnum
, int flags
) {
582 SWIG_Python_ConvertPtr(obj
, &result
, ty
, flags
| SWIG_POINTER_EXCEPTION
);
586 /* Convert a packed value value */
588 SWIG_Python_ConvertPacked(PyObject
*obj
, void *ptr
, int sz
, swig_type_info
*ty
, int flags
) {
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
;
597 c
= SWIG_UnpackData(c
,ptr
,sz
);
599 tc
= SWIG_TypeCheck(c
,ty
);
600 if (!tc
) goto type_error
;
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
);
613 PyErr_SetString(PyExc_TypeError
,"Expected a pointer");
619 /* Create a new pointer object */
620 SWIGRUNTIME(PyObject
*)
621 SWIG_Python_NewPointerObj(void *ptr
, swig_type_info
*type
, int own
) {
627 #ifdef SWIG_COBJECT_TYPES
628 robj
= PyCObject_FromVoidPtrAndDesc((void *) ptr
, (char *) type
->name
, NULL
);
634 r
= SWIG_PackData(r
,&ptr
,sizeof(void *));
635 strcpy(r
,type
->name
);
636 robj
= PyString_FromString(result
);
639 if (!robj
|| (robj
== Py_None
)) return robj
;
640 if (type
->clientdata
) {
642 PyObject
*args
= Py_BuildValue((char*)"(O)", robj
);
644 inst
= PyObject_CallObject((PyObject
*) type
->clientdata
, args
);
648 PyObject
*n
= PyInt_FromLong(1);
649 PyObject_SetAttrString(inst
,(char*)"thisown",n
);
658 SWIGRUNTIME(PyObject
*)
659 SWIG_Python_NewPackedObj(void *ptr
, int sz
, swig_type_info
*type
) {
662 if ((2*sz
+ 1 + strlen(type
->name
)) > 1000) return 0;
664 r
= SWIG_PackData(r
,ptr
,sz
);
665 strcpy(r
,type
->name
);
666 return PyString_FromString(result
);
669 /* -----------------------------------------------------------------------------
670 * the needed conversions between C++ and python
671 * ----------------------------------------------------------------------------- */
677 SWIGRUNTIME(unsigned long)
678 SWIG_PyObj_AsUnsignedLong(PyObject
* obj
)
680 if (PyLong_Check(obj
)) {
681 return PyLong_AsUnsignedLong(obj
);
683 long i
= PyInt_AsLong(obj
);
684 if ( !PyErr_Occurred() && (i
< 0)) {
685 PyErr_SetString(PyExc_TypeError
, "negative value for unsigned type");
692 SWIG_PyObj_AsLongInRange(PyObject
* obj
, const char* type
,
693 long min_value
, long max_value
)
695 long value
= PyInt_Check(obj
) ? PyInt_AsLong(obj
) : (long)PyLong_AsLongLong(obj
);
696 if (!PyErr_Occurred()) {
697 if (value
< min_value
) {
699 PyString_FromFormat("value %ld is less than '%s' minimum %ld",
700 value
, type
, min_value
);
702 PyErr_SetObject(PyExc_OverflowError
, err
);
704 } else if (value
> max_value
) {
706 PyString_FromFormat("value %ld is greater than '%s' maximum %ld",
707 value
, type
, max_value
);
708 PyErr_SetObject(PyExc_OverflowError
, err
);
715 SWIGRUNTIME(unsigned long)
716 SWIG_PyObj_AsUnsignedLongInRange(PyObject
*obj
, const char* type
,
717 unsigned long max_value
)
719 unsigned long value
= SWIG_PyObj_AsUnsignedLong(obj
);
720 if (!PyErr_Occurred()) {
721 if (value
> max_value
) {
723 PyString_FromFormat("value %ld is greater than '%s' minimum %ld",
724 value
, type
, max_value
);
725 PyErr_SetObject(PyExc_OverflowError
, err
);
733 SWIG_PyObj_AsFloatConv(PyObject
*obj
, py_objasdbl_conv pyconv
)
735 double value
= pyconv(obj
);
736 if (!PyErr_Occurred()) {
737 if (value
< FLT_MIN
) {
739 PyString_FromFormat("value %g is less than float minimum %g",
741 PyErr_SetObject(PyExc_OverflowError
, err
);
743 } else if (value
> FLT_MAX
) {
745 PyString_FromFormat("value %g is greater than float maximum %g",
747 PyErr_SetObject(PyExc_OverflowError
, err
);
751 return (float) value
;
755 SWIG_PyObj_AsCharPtrAndSize(PyObject
*obj
, swig_type_info
* pchar_info
,
756 char** cptr
, size_t* size
)
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
;
764 /* don't like strlen, but ... */
765 *size
= (*cptr
) ? (strlen(*cptr
) + 1) : 0;
771 SWIG_PyObj_AsNewCharPtr(PyObject
*obj
, swig_type_info
* pchar_info
)
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;
781 res
= new char[size
];
785 if (csize
) memcpy(res
, cptr
, csize
);
786 if (csize
< size
) res
[csize
] = 0;
792 SWIGRUNTIME(PyObject
*)
793 SWIG_PyObj_FromCharArray(const char* carray
, size_t size
)
795 if (size
> INT_MAX
) {
797 PyString_FromFormat("a char array of size %d is not allowed in python",
799 PyErr_SetObject(PyExc_TypeError
, err
);
804 int psize
= (int) size
;
805 return PyString_FromStringAndSize(carray
, psize
);
810 SWIG_PyObj_AsCharArray(PyObject
*obj
, swig_type_info
* pchar_info
,
811 char* carray
, size_t size
)
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:
820 ie, assing the array using an extra '0' char. Here,
821 we assume the C behavior...
823 if ((csize
== size
+ 1) && !(cptr
[csize
-1])) --csize
;
826 PyString_FromFormat("a char array of maximum size %d is expected",
828 PyErr_SetObject(PyExc_TypeError
, err
);
831 if (csize
) memcpy(carray
, cptr
, csize
);
832 if (csize
< size
) memset(carray
+ csize
, 0, size
- csize
);
837 SWIGRUNTIME(PyObject
*)
838 SWIG_PyObj_FromCharPtr(const char* cptr
)
841 return PyString_FromString(cptr
);
849 SWIG_PyObj_AsCharPtr(PyObject
*obj
, swig_type_info
* pchar_info
)
852 if (SWIG_ConvertPtr(obj
,(void **)&ptr
, pchar_info
, 0) == -1) {
853 if (PyErr_Occurred()) PyErr_Clear();
854 ptr
= PyString_AsString(obj
);
859 /* Install Constants */
861 SWIG_Python_InstallConstants(PyObject
*d
, swig_const_info constants
[]) {
864 for (i
= 0; constants
[i
].type
; i
++) {
865 switch(constants
[i
].type
) {
867 obj
= PyInt_FromLong(constants
[i
].lvalue
);
870 obj
= PyFloat_FromDouble(constants
[i
].dvalue
);
873 obj
= SWIG_PyObj_FromCharPtr((char *) constants
[i
].pvalue
);
875 case SWIG_PY_POINTER
:
876 obj
= SWIG_NewPointerObj(constants
[i
].pvalue
, *(constants
[i
]).ptype
,0);
879 obj
= SWIG_NewPackedObj(constants
[i
].pvalue
, constants
[i
].lvalue
, *(constants
[i
].ptype
));
886 PyDict_SetItemString(d
,constants
[i
].name
,obj
);
894 /* Contract support */
896 #define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
904 /* -------- TYPES TABLE (BEGIN) -------- */
906 #define SWIGTYPE_p_char swig_types[0]
907 static swig_type_info
*swig_types
[2];
909 /* -------- TYPES TABLE (END) -------- */
912 /*-----------------------------------------------
913 @(target):= _swigrun.so
914 ------------------------------------------------*/
915 #define SWIG_init init_swigrun
917 #define SWIG_name "_swigrun"
925 #define SWIGSTATIC(a) static inline a
927 #define SWIGSTATIC(a) static a
933 #ifdef HAVE_NUMERIC_CAST
934 #define numeric_cast(type,a) numeric_cast<type>(a)
936 #define numeric_cast(type,a) static_cast<type>(a)
939 #define numeric_cast(type,a) (type)(a)
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
959 static PyMethodDef SwigMethods
[] = {
964 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
966 static swig_type_info _swigt__p_char
[] = {{"_p_char", 0, "char *", 0},{"_p_char"},{0}};
968 static swig_type_info
*swig_types_initial
[] = {
974 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
976 static swig_const_info swig_const_table
[] = {
986 SWIGEXPORT(void) SWIG_init(void) {
987 static PyObject
*SWIG_globals
= 0;
988 static int typeinit
= 0;
991 if (!SWIG_globals
) SWIG_globals
= SWIG_newvarlink();
992 m
= Py_InitModule((char *) SWIG_name
, SwigMethods
);
993 d
= PyModule_GetDict(m
);
996 for (i
= 0; swig_types_initial
[i
]; i
++) {
997 swig_types
[i
] = SWIG_TypeRegister(swig_types_initial
[i
]);
1001 SWIG_InstallConstants(d
,swig_const_table
);