~ubuntu-branches/ubuntu/oneiric/python-scipy/oneiric-proposed

« back to all changes in this revision

Viewing changes to scipy/sparse/sparsetools/coo_wrap.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2011-04-06 21:26:25 UTC
  • mfrom: (9.2.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110406212625-3izdplobqe6fzeql
Tags: 0.9.0+dfsg1-1
* New upstream release (Closes: #614407, #579041, #569008)
* Convert to dh_python2 (Closes: #617028)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* ----------------------------------------------------------------------------
2
2
 * This file was automatically generated by SWIG (http://www.swig.org).
3
 
 * Version 1.3.36
 
3
 * Version 2.0.1+capsulehack
4
4
 * 
5
5
 * This file is not intended to be easily readable and contains a number of 
6
6
 * coding conventions designed to improve portability and efficiency. Do not make
11
11
#define SWIGPYTHON
12
12
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
13
13
 
 
14
 
14
15
#ifdef __cplusplus
 
16
/* SwigValueWrapper is described in swig.swg */
15
17
template<typename T> class SwigValueWrapper {
16
 
    T *tt;
 
18
  struct SwigMovePointer {
 
19
    T *ptr;
 
20
    SwigMovePointer(T *p) : ptr(p) { }
 
21
    ~SwigMovePointer() { delete ptr; }
 
22
    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
 
23
  } pointer;
 
24
  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
 
25
  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
17
26
public:
18
 
    SwigValueWrapper() : tt(0) { }
19
 
    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
20
 
    SwigValueWrapper(const T& t) : tt(new T(t)) { }
21
 
    ~SwigValueWrapper() { delete tt; } 
22
 
    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
23
 
    operator T&() const { return *tt; }
24
 
    T *operator&() { return tt; }
25
 
private:
26
 
    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
 
27
  SwigValueWrapper() : pointer(0) { }
 
28
  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
 
29
  operator T&() const { return *pointer.ptr; }
 
30
  T *operator&() { return pointer.ptr; }
27
31
};
28
32
 
29
33
template <typename T> T SwigValueInit() {
147
151
/* -----------------------------------------------------------------------------
148
152
 * swigrun.swg
149
153
 *
150
 
 * This file contains generic CAPI SWIG runtime support for pointer
 
154
 * This file contains generic C API SWIG runtime support for pointer
151
155
 * type checking.
152
156
 * ----------------------------------------------------------------------------- */
153
157
 
166
170
 
167
171
/*
168
172
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
169
 
  creating a static or dynamic library from the swig runtime code.
170
 
  In 99.9% of the cases, swig just needs to declare them as 'static'.
 
173
  creating a static or dynamic library from the SWIG runtime code.
 
174
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
171
175
  
172
 
  But only do this if is strictly necessary, ie, if you have problems
173
 
  with your compiler or so.
 
176
  But only do this if strictly necessary, ie, if you have problems
 
177
  with your compiler or suchlike.
174
178
*/
175
179
 
176
180
#ifndef SWIGRUNTIME
197
201
/* 
198
202
   Flags/methods for returning states.
199
203
   
200
 
   The swig conversion methods, as ConvertPtr, return and integer 
 
204
   The SWIG conversion methods, as ConvertPtr, return an integer 
201
205
   that tells if the conversion was successful or not. And if not,
202
206
   an error code can be returned (see swigerrors.swg for the codes).
203
207
   
204
208
   Use the following macros/flags to set or process the returning
205
209
   states.
206
210
   
207
 
   In old swig versions, you usually write code as:
 
211
   In old versions of SWIG, code such as the following was usually written:
208
212
 
209
213
     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
210
214
       // success code
212
216
       //fail code
213
217
     }
214
218
 
215
 
   Now you can be more explicit as:
 
219
   Now you can be more explicit:
216
220
 
217
221
    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
218
222
    if (SWIG_IsOK(res)) {
221
225
      // fail code
222
226
    }
223
227
 
224
 
   that seems to be the same, but now you can also do
 
228
   which is the same really, but now you can also do
225
229
 
226
230
    Type *ptr;
227
231
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
239
243
    
240
244
   I.e., now SWIG_ConvertPtr can return new objects and you can
241
245
   identify the case and take care of the deallocation. Of course that
242
 
   requires also to SWIG_ConvertPtr to return new result values, as
 
246
   also requires SWIG_ConvertPtr to return new result values, such as
243
247
 
244
248
      int SWIG_ConvertPtr(obj, ptr,...) {         
245
249
        if (<obj is ok>) {                             
257
261
 
258
262
   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
259
263
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
260
 
   swig errors code.
 
264
   SWIG errors code.
261
265
 
262
266
   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
263
267
   allows to return the 'cast rank', for example, if you have this
271
275
      fooi(1)   // cast rank '0'
272
276
 
273
277
   just use the SWIG_AddCast()/SWIG_CheckState()
274
 
 
275
 
 
276
 
 */
 
278
*/
 
279
 
277
280
#define SWIG_OK                    (0) 
278
281
#define SWIG_ERROR                 (-1)
279
282
#define SWIG_IsOK(r)               (r >= 0)
298
301
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
299
302
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
300
303
 
301
 
 
302
304
/* Cast-Rank Mode */
303
305
#if defined(SWIG_CASTRANK_MODE)
304
306
#  ifndef SWIG_TypeRank
321
323
#endif
322
324
 
323
325
 
324
 
 
325
 
 
326
326
#include <string.h>
327
327
 
328
328
#ifdef __cplusplus
419
419
}
420
420
 
421
421
 
422
 
/* think of this as a c++ template<> or a scheme macro */
423
 
#define SWIG_TypeCheck_Template(comparison, ty)         \
424
 
  if (ty) {                                             \
425
 
    swig_cast_info *iter = ty->cast;                    \
426
 
    while (iter) {                                      \
427
 
      if (comparison) {                                 \
428
 
        if (iter == ty->cast) return iter;              \
429
 
        /* Move iter to the top of the linked list */   \
430
 
        iter->prev->next = iter->next;                  \
431
 
        if (iter->next)                                 \
432
 
          iter->next->prev = iter->prev;                \
433
 
        iter->next = ty->cast;                          \
434
 
        iter->prev = 0;                                 \
435
 
        if (ty->cast) ty->cast->prev = iter;            \
436
 
        ty->cast = iter;                                \
437
 
        return iter;                                    \
438
 
      }                                                 \
439
 
      iter = iter->next;                                \
440
 
    }                                                   \
441
 
  }                                                     \
442
 
  return 0
443
 
 
444
422
/*
445
423
  Check the typename
446
424
*/
447
425
SWIGRUNTIME swig_cast_info *
448
426
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
449
 
  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
 
427
  if (ty) {
 
428
    swig_cast_info *iter = ty->cast;
 
429
    while (iter) {
 
430
      if (strcmp(iter->type->name, c) == 0) {
 
431
        if (iter == ty->cast)
 
432
          return iter;
 
433
        /* Move iter to the top of the linked list */
 
434
        iter->prev->next = iter->next;
 
435
        if (iter->next)
 
436
          iter->next->prev = iter->prev;
 
437
        iter->next = ty->cast;
 
438
        iter->prev = 0;
 
439
        if (ty->cast) ty->cast->prev = iter;
 
440
        ty->cast = iter;
 
441
        return iter;
 
442
      }
 
443
      iter = iter->next;
 
444
    }
 
445
  }
 
446
  return 0;
450
447
}
451
448
 
452
 
/* Same as previous function, except strcmp is replaced with a pointer comparison */
 
449
/* 
 
450
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
 
451
*/
453
452
SWIGRUNTIME swig_cast_info *
454
 
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
455
 
  SWIG_TypeCheck_Template(iter->type == from, into);
 
453
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
 
454
  if (ty) {
 
455
    swig_cast_info *iter = ty->cast;
 
456
    while (iter) {
 
457
      if (iter->type == from) {
 
458
        if (iter == ty->cast)
 
459
          return iter;
 
460
        /* Move iter to the top of the linked list */
 
461
        iter->prev->next = iter->next;
 
462
        if (iter->next)
 
463
          iter->next->prev = iter->prev;
 
464
        iter->next = ty->cast;
 
465
        iter->prev = 0;
 
466
        if (ty->cast) ty->cast->prev = iter;
 
467
        ty->cast = iter;
 
468
        return iter;
 
469
      }
 
470
      iter = iter->next;
 
471
    }
 
472
  }
 
473
  return 0;
456
474
}
457
475
 
458
476
/*
731
749
 
732
750
 
733
751
 
 
752
/* Compatibility macros for Python 3 */
 
753
#if PY_VERSION_HEX >= 0x03000000
 
754
 
 
755
#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
 
756
#define PyInt_Check(x) PyLong_Check(x)
 
757
#define PyInt_AsLong(x) PyLong_AsLong(x)
 
758
#define PyInt_FromLong(x) PyLong_FromLong(x)
 
759
#define PyString_Format(fmt, args)  PyUnicode_Format(fmt, args)
 
760
 
 
761
#endif
 
762
 
 
763
#ifndef Py_TYPE
 
764
#  define Py_TYPE(op) ((op)->ob_type)
 
765
#endif
 
766
 
 
767
/* SWIG APIs for compatibility of both Python 2 & 3 */
 
768
 
 
769
#if PY_VERSION_HEX >= 0x03000000
 
770
#  define SWIG_Python_str_FromFormat PyUnicode_FromFormat
 
771
#else
 
772
#  define SWIG_Python_str_FromFormat PyString_FromFormat
 
773
#endif
 
774
 
 
775
 
 
776
/* Warning: This function will allocate a new string in Python 3,
 
777
 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
 
778
 */
 
779
SWIGINTERN char*
 
780
SWIG_Python_str_AsChar(PyObject *str)
 
781
{
 
782
#if PY_VERSION_HEX >= 0x03000000
 
783
  char *cstr;
 
784
  char *newstr;
 
785
  Py_ssize_t len;
 
786
  str = PyUnicode_AsUTF8String(str);
 
787
  PyBytes_AsStringAndSize(str, &cstr, &len);
 
788
  newstr = (char *) malloc(len+1);
 
789
  memcpy(newstr, cstr, len+1);
 
790
  Py_XDECREF(str);
 
791
  return newstr;
 
792
#else
 
793
  return PyString_AsString(str);
 
794
#endif
 
795
}
 
796
 
 
797
#if PY_VERSION_HEX >= 0x03000000
 
798
#  define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
 
799
#else
 
800
#  define SWIG_Python_str_DelForPy3(x) 
 
801
#endif
 
802
 
 
803
 
 
804
SWIGINTERN PyObject*
 
805
SWIG_Python_str_FromChar(const char *c)
 
806
{
 
807
#if PY_VERSION_HEX >= 0x03000000
 
808
  return PyUnicode_FromString(c); 
 
809
#else
 
810
  return PyString_FromString(c);
 
811
#endif
 
812
}
734
813
 
735
814
/* Add PyOS_snprintf for old Pythons */
736
815
#if PY_VERSION_HEX < 0x02020000
777
856
#  define PyObject_GenericGetAttr 0
778
857
# endif
779
858
#endif
 
859
 
780
860
/* Py_NotImplemented is defined in 2.1 and up. */
781
861
#if PY_VERSION_HEX < 0x02010000
782
862
# ifndef Py_NotImplemented
784
864
# endif
785
865
#endif
786
866
 
787
 
 
788
867
/* A crude PyString_AsStringAndSize implementation for old Pythons */
789
868
#if PY_VERSION_HEX < 0x02010000
790
869
# ifndef PyString_AsStringAndSize
799
878
# endif
800
879
#endif
801
880
 
802
 
 
803
881
/* PyBool_FromLong for old Pythons */
804
882
#if PY_VERSION_HEX < 0x02030000
805
883
static
877
955
 
878
956
  if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
879
957
  if (value) {
 
958
    char *tmp;
880
959
    PyObject *old_str = PyObject_Str(value);
881
960
    PyErr_Clear();
882
961
    Py_XINCREF(type);
883
 
    PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
 
962
 
 
963
    PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
 
964
    SWIG_Python_str_DelForPy3(tmp);
884
965
    Py_DECREF(old_str);
885
966
    Py_DECREF(value);
886
967
  } else {
888
969
  }
889
970
}
890
971
 
891
 
 
892
 
 
893
972
#if defined(SWIG_PYTHON_NO_THREADS)
894
973
#  if defined(SWIG_PYTHON_THREADS)
895
974
#    undef SWIG_PYTHON_THREADS
986
1065
  swig_type_info **ptype;
987
1066
} swig_const_info;
988
1067
 
 
1068
 
 
1069
/* -----------------------------------------------------------------------------
 
1070
 * Wrapper of PyInstanceMethod_New() used in Python 3
 
1071
 * It is exported to the generated module, used for -fastproxy
 
1072
 * ----------------------------------------------------------------------------- */
 
1073
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func)
 
1074
{
 
1075
#if PY_VERSION_HEX >= 0x03000000
 
1076
  return PyInstanceMethod_New(func);
 
1077
#else
 
1078
  return NULL;
 
1079
#endif
 
1080
}
 
1081
 
989
1082
#ifdef __cplusplus
990
1083
#if 0
991
1084
{ /* cc-mode */
995
1088
 
996
1089
 
997
1090
/* -----------------------------------------------------------------------------
998
 
 * See the LICENSE file for information on copyright, usage and redistribution
999
 
 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1000
 
 *
1001
1091
 * pyrun.swg
1002
1092
 *
1003
1093
 * This file contains the runtime support for Python modules
1038
1128
 
1039
1129
#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule()
1040
1130
#define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
1041
 
#define SWIG_NewClientData(obj)                         PySwigClientData_New(obj)
 
1131
#define SWIG_NewClientData(obj)                         SwigPyClientData_New(obj)
1042
1132
 
1043
1133
#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
1044
1134
#define SWIG_SetErrorMsg                                SWIG_Python_SetErrorMsg                            
1045
1135
#define SWIG_ErrorType(code)                            SWIG_Python_ErrorType(code)                        
1046
1136
#define SWIG_Error(code, msg)                           SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
1047
 
#define SWIG_fail                                       goto fail                                          
 
1137
#define SWIG_fail                                       goto fail                               
1048
1138
 
 
1139
/*
 
1140
 * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of
 
1141
 * CObjects API.
 
1142
 */
 
1143
#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
 
1144
     (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0))
 
1145
#define USE_CAPSULES
 
1146
#define TYPE_POINTER_NAME \
 
1147
    ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
 
1148
#endif
1049
1149
 
1050
1150
/* Runtime API implementation */
1051
1151
 
1234
1334
  return none;
1235
1335
}
1236
1336
 
1237
 
/* PySwigClientData */
 
1337
/* SwigPyClientData */
1238
1338
 
1239
1339
typedef struct {
1240
1340
  PyObject *klass;
1243
1343
  PyObject *destroy;
1244
1344
  int delargs;
1245
1345
  int implicitconv;
1246
 
} PySwigClientData;
 
1346
} SwigPyClientData;
1247
1347
 
1248
1348
SWIGRUNTIMEINLINE int 
1249
1349
SWIG_Python_CheckImplicit(swig_type_info *ty)
1250
1350
{
1251
 
  PySwigClientData *data = (PySwigClientData *)ty->clientdata;
 
1351
  SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1252
1352
  return data ? data->implicitconv : 0;
1253
1353
}
1254
1354
 
1255
1355
SWIGRUNTIMEINLINE PyObject *
1256
1356
SWIG_Python_ExceptionType(swig_type_info *desc) {
1257
 
  PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
 
1357
  SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1258
1358
  PyObject *klass = data ? data->klass : 0;
1259
1359
  return (klass ? klass : PyExc_RuntimeError);
1260
1360
}
1261
1361
 
1262
1362
 
1263
 
SWIGRUNTIME PySwigClientData * 
1264
 
PySwigClientData_New(PyObject* obj)
 
1363
SWIGRUNTIME SwigPyClientData * 
 
1364
SwigPyClientData_New(PyObject* obj)
1265
1365
{
1266
1366
  if (!obj) {
1267
1367
    return 0;
1268
1368
  } else {
1269
 
    PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
 
1369
    SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1270
1370
    /* the klass element */
1271
1371
    data->klass = obj;
1272
1372
    Py_INCREF(data->klass);
1314
1414
}
1315
1415
 
1316
1416
SWIGRUNTIME void 
1317
 
PySwigClientData_Del(PySwigClientData* data)
 
1417
SwigPyClientData_Del(SwigPyClientData* data)
1318
1418
{
1319
1419
  Py_XDECREF(data->newraw);
1320
1420
  Py_XDECREF(data->newargs);
1321
1421
  Py_XDECREF(data->destroy);
1322
1422
}
1323
1423
 
1324
 
/* =============== PySwigObject =====================*/
 
1424
/* =============== SwigPyObject =====================*/
1325
1425
 
1326
1426
typedef struct {
1327
1427
  PyObject_HEAD
1329
1429
  swig_type_info *ty;
1330
1430
  int own;
1331
1431
  PyObject *next;
1332
 
} PySwigObject;
 
1432
} SwigPyObject;
1333
1433
 
1334
1434
SWIGRUNTIME PyObject *
1335
 
PySwigObject_long(PySwigObject *v)
 
1435
SwigPyObject_long(SwigPyObject *v)
1336
1436
{
1337
1437
  return PyLong_FromVoidPtr(v->ptr);
1338
1438
}
1339
1439
 
1340
1440
SWIGRUNTIME PyObject *
1341
 
PySwigObject_format(const char* fmt, PySwigObject *v)
 
1441
SwigPyObject_format(const char* fmt, SwigPyObject *v)
1342
1442
{
1343
1443
  PyObject *res = NULL;
1344
1444
  PyObject *args = PyTuple_New(1);
1345
1445
  if (args) {
1346
 
    if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
1347
 
      PyObject *ofmt = PyString_FromString(fmt);
 
1446
    if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
 
1447
      PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1348
1448
      if (ofmt) {
 
1449
#if PY_VERSION_HEX >= 0x03000000
 
1450
        res = PyUnicode_Format(ofmt,args);
 
1451
#else
1349
1452
        res = PyString_Format(ofmt,args);
 
1453
#endif
1350
1454
        Py_DECREF(ofmt);
1351
1455
      }
1352
1456
      Py_DECREF(args);
1356
1460
}
1357
1461
 
1358
1462
SWIGRUNTIME PyObject *
1359
 
PySwigObject_oct(PySwigObject *v)
 
1463
SwigPyObject_oct(SwigPyObject *v)
1360
1464
{
1361
 
  return PySwigObject_format("%o",v);
 
1465
  return SwigPyObject_format("%o",v);
1362
1466
}
1363
1467
 
1364
1468
SWIGRUNTIME PyObject *
1365
 
PySwigObject_hex(PySwigObject *v)
 
1469
SwigPyObject_hex(SwigPyObject *v)
1366
1470
{
1367
 
  return PySwigObject_format("%x",v);
 
1471
  return SwigPyObject_format("%x",v);
1368
1472
}
1369
1473
 
1370
1474
SWIGRUNTIME PyObject *
1371
1475
#ifdef METH_NOARGS
1372
 
PySwigObject_repr(PySwigObject *v)
 
1476
SwigPyObject_repr(SwigPyObject *v)
1373
1477
#else
1374
 
PySwigObject_repr(PySwigObject *v, PyObject *args)
 
1478
SwigPyObject_repr(SwigPyObject *v, PyObject *args)
1375
1479
#endif
1376
1480
{
1377
1481
  const char *name = SWIG_TypePrettyName(v->ty);
1378
 
  PyObject *hex = PySwigObject_hex(v);    
1379
 
  PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
1380
 
  Py_DECREF(hex);
 
1482
  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, v);
1381
1483
  if (v->next) {
1382
1484
#ifdef METH_NOARGS
1383
 
    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
 
1485
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1384
1486
#else
1385
 
    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
 
1487
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
1386
1488
#endif
 
1489
#if PY_VERSION_HEX >= 0x03000000
 
1490
    PyObject *joined = PyUnicode_Concat(repr, nrep);
 
1491
    Py_DecRef(repr);
 
1492
    Py_DecRef(nrep);
 
1493
    repr = joined;
 
1494
#else
1387
1495
    PyString_ConcatAndDel(&repr,nrep);
 
1496
#endif
1388
1497
  }
1389
1498
  return repr;  
1390
1499
}
1391
1500
 
1392
1501
SWIGRUNTIME int
1393
 
PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 
1502
SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1394
1503
{
 
1504
  char *str;
1395
1505
#ifdef METH_NOARGS
1396
 
  PyObject *repr = PySwigObject_repr(v);
 
1506
  PyObject *repr = SwigPyObject_repr(v);
1397
1507
#else
1398
 
  PyObject *repr = PySwigObject_repr(v, NULL);
 
1508
  PyObject *repr = SwigPyObject_repr(v, NULL);
1399
1509
#endif
1400
1510
  if (repr) {
1401
 
    fputs(PyString_AsString(repr), fp);
 
1511
    str = SWIG_Python_str_AsChar(repr); 
 
1512
    fputs(str, fp);
 
1513
    SWIG_Python_str_DelForPy3(str);
1402
1514
    Py_DECREF(repr);
1403
1515
    return 0; 
1404
1516
  } else {
1407
1519
}
1408
1520
 
1409
1521
SWIGRUNTIME PyObject *
1410
 
PySwigObject_str(PySwigObject *v)
 
1522
SwigPyObject_str(SwigPyObject *v)
1411
1523
{
1412
1524
  char result[SWIG_BUFFER_SIZE];
1413
1525
  return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
1414
 
    PyString_FromString(result) : 0;
 
1526
    SWIG_Python_str_FromChar(result) : 0;
1415
1527
}
1416
1528
 
1417
1529
SWIGRUNTIME int
1418
 
PySwigObject_compare(PySwigObject *v, PySwigObject *w)
 
1530
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
1419
1531
{
1420
1532
  void *i = v->ptr;
1421
1533
  void *j = w->ptr;
1422
1534
  return (i < j) ? -1 : ((i > j) ? 1 : 0);
1423
1535
}
1424
1536
 
 
1537
/* Added for Python 3.x, would it also be useful for Python 2.x? */
 
1538
SWIGRUNTIME PyObject*
 
1539
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
 
1540
{
 
1541
  PyObject* res;
 
1542
  if( op != Py_EQ && op != Py_NE ) {
 
1543
    Py_INCREF(Py_NotImplemented);
 
1544
    return Py_NotImplemented;
 
1545
  }
 
1546
  if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) )
 
1547
    res = Py_True;
 
1548
  else
 
1549
    res = Py_False;
 
1550
  Py_INCREF(res);
 
1551
  return res;  
 
1552
}
 
1553
 
 
1554
 
1425
1555
SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
1426
1556
 
1427
1557
SWIGRUNTIME PyTypeObject*
1428
 
PySwigObject_type(void) {
 
1558
SwigPyObject_type(void) {
1429
1559
  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
1430
1560
  return type;
1431
1561
}
1432
1562
 
1433
1563
SWIGRUNTIMEINLINE int
1434
 
PySwigObject_Check(PyObject *op) {
1435
 
  return ((op)->ob_type == PySwigObject_type())
1436
 
    || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
 
1564
SwigPyObject_Check(PyObject *op) {
 
1565
  return (Py_TYPE(op) == SwigPyObject_type())
 
1566
    || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1437
1567
}
1438
1568
 
1439
1569
SWIGRUNTIME PyObject *
1440
 
PySwigObject_New(void *ptr, swig_type_info *ty, int own);
 
1570
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1441
1571
 
1442
1572
SWIGRUNTIME void
1443
 
PySwigObject_dealloc(PyObject *v)
 
1573
SwigPyObject_dealloc(PyObject *v)
1444
1574
{
1445
 
  PySwigObject *sobj = (PySwigObject *) v;
 
1575
  SwigPyObject *sobj = (SwigPyObject *) v;
1446
1576
  PyObject *next = sobj->next;
1447
1577
  if (sobj->own == SWIG_POINTER_OWN) {
1448
1578
    swig_type_info *ty = sobj->ty;
1449
 
    PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
 
1579
    SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1450
1580
    PyObject *destroy = data ? data->destroy : 0;
1451
1581
    if (destroy) {
1452
1582
      /* destroy is always a VARARGS method */
1453
1583
      PyObject *res;
1454
1584
      if (data->delargs) {
1455
 
        /* we need to create a temporal object to carry the destroy operation */
1456
 
        PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
 
1585
        /* we need to create a temporary object to carry the destroy operation */
 
1586
        PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1457
1587
        res = SWIG_Python_CallFunctor(destroy, tmp);
1458
1588
        Py_DECREF(tmp);
1459
1589
      } else {
1475
1605
}
1476
1606
 
1477
1607
SWIGRUNTIME PyObject* 
1478
 
PySwigObject_append(PyObject* v, PyObject* next)
 
1608
SwigPyObject_append(PyObject* v, PyObject* next)
1479
1609
{
1480
 
  PySwigObject *sobj = (PySwigObject *) v;
 
1610
  SwigPyObject *sobj = (SwigPyObject *) v;
1481
1611
#ifndef METH_O
1482
1612
  PyObject *tmp = 0;
1483
1613
  if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
1484
1614
  next = tmp;
1485
1615
#endif
1486
 
  if (!PySwigObject_Check(next)) {
 
1616
  if (!SwigPyObject_Check(next)) {
1487
1617
    return NULL;
1488
1618
  }
1489
1619
  sobj->next = next;
1493
1623
 
1494
1624
SWIGRUNTIME PyObject* 
1495
1625
#ifdef METH_NOARGS
1496
 
PySwigObject_next(PyObject* v)
 
1626
SwigPyObject_next(PyObject* v)
1497
1627
#else
1498
 
PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 
1628
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1499
1629
#endif
1500
1630
{
1501
 
  PySwigObject *sobj = (PySwigObject *) v;
 
1631
  SwigPyObject *sobj = (SwigPyObject *) v;
1502
1632
  if (sobj->next) {    
1503
1633
    Py_INCREF(sobj->next);
1504
1634
    return sobj->next;
1509
1639
 
1510
1640
SWIGINTERN PyObject*
1511
1641
#ifdef METH_NOARGS
1512
 
PySwigObject_disown(PyObject *v)
 
1642
SwigPyObject_disown(PyObject *v)
1513
1643
#else
1514
 
PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 
1644
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1515
1645
#endif
1516
1646
{
1517
 
  PySwigObject *sobj = (PySwigObject *)v;
 
1647
  SwigPyObject *sobj = (SwigPyObject *)v;
1518
1648
  sobj->own = 0;
1519
1649
  return SWIG_Py_Void();
1520
1650
}
1521
1651
 
1522
1652
SWIGINTERN PyObject*
1523
1653
#ifdef METH_NOARGS
1524
 
PySwigObject_acquire(PyObject *v)
 
1654
SwigPyObject_acquire(PyObject *v)
1525
1655
#else
1526
 
PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 
1656
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1527
1657
#endif
1528
1658
{
1529
 
  PySwigObject *sobj = (PySwigObject *)v;
 
1659
  SwigPyObject *sobj = (SwigPyObject *)v;
1530
1660
  sobj->own = SWIG_POINTER_OWN;
1531
1661
  return SWIG_Py_Void();
1532
1662
}
1533
1663
 
1534
1664
SWIGINTERN PyObject*
1535
 
PySwigObject_own(PyObject *v, PyObject *args)
 
1665
SwigPyObject_own(PyObject *v, PyObject *args)
1536
1666
{
1537
1667
  PyObject *val = 0;
1538
1668
#if (PY_VERSION_HEX < 0x02020000)
1545
1675
    } 
1546
1676
  else
1547
1677
    {
1548
 
      PySwigObject *sobj = (PySwigObject *)v;
 
1678
      SwigPyObject *sobj = (SwigPyObject *)v;
1549
1679
      PyObject *obj = PyBool_FromLong(sobj->own);
1550
1680
      if (val) {
1551
1681
#ifdef METH_NOARGS
1552
1682
        if (PyObject_IsTrue(val)) {
1553
 
          PySwigObject_acquire(v);
 
1683
          SwigPyObject_acquire(v);
1554
1684
        } else {
1555
 
          PySwigObject_disown(v);
 
1685
          SwigPyObject_disown(v);
1556
1686
        }
1557
1687
#else
1558
1688
        if (PyObject_IsTrue(val)) {
1559
 
          PySwigObject_acquire(v,args);
 
1689
          SwigPyObject_acquire(v,args);
1560
1690
        } else {
1561
 
          PySwigObject_disown(v,args);
 
1691
          SwigPyObject_disown(v,args);
1562
1692
        }
1563
1693
#endif
1564
1694
      } 
1569
1699
#ifdef METH_O
1570
1700
static PyMethodDef
1571
1701
swigobject_methods[] = {
1572
 
  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
1573
 
  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
1574
 
  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1575
 
  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_O,       (char *)"appends another 'this' object"},
1576
 
  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
1577
 
  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
 
1702
  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
 
1703
  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
 
1704
  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
 
1705
  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_O,       (char *)"appends another 'this' object"},
 
1706
  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
 
1707
  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
1578
1708
  {0, 0, 0, 0}  
1579
1709
};
1580
1710
#else
1581
1711
static PyMethodDef
1582
1712
swigobject_methods[] = {
1583
 
  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
1584
 
  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
1585
 
  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
1586
 
  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
1587
 
  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
1588
 
  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
 
1713
  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
 
1714
  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
 
1715
  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
 
1716
  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
 
1717
  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
 
1718
  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
1589
1719
  {0, 0, 0, 0}  
1590
1720
};
1591
1721
#endif
1592
1722
 
1593
1723
#if PY_VERSION_HEX < 0x02020000
1594
1724
SWIGINTERN PyObject *
1595
 
PySwigObject_getattr(PySwigObject *sobj,char *name)
 
1725
SwigPyObject_getattr(SwigPyObject *sobj,char *name)
1596
1726
{
1597
1727
  return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1598
1728
}
1602
1732
_PySwigObject_type(void) {
1603
1733
  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1604
1734
  
1605
 
  static PyNumberMethods PySwigObject_as_number = {
 
1735
  static PyNumberMethods SwigPyObject_as_number = {
1606
1736
    (binaryfunc)0, /*nb_add*/
1607
1737
    (binaryfunc)0, /*nb_subtract*/
1608
1738
    (binaryfunc)0, /*nb_multiply*/
 
1739
    /* nb_divide removed in Python 3 */
 
1740
#if PY_VERSION_HEX < 0x03000000
1609
1741
    (binaryfunc)0, /*nb_divide*/
 
1742
#endif
1610
1743
    (binaryfunc)0, /*nb_remainder*/
1611
1744
    (binaryfunc)0, /*nb_divmod*/
1612
1745
    (ternaryfunc)0,/*nb_power*/
1620
1753
    0,             /*nb_and*/
1621
1754
    0,             /*nb_xor*/
1622
1755
    0,             /*nb_or*/
1623
 
    (coercion)0,   /*nb_coerce*/
1624
 
    (unaryfunc)PySwigObject_long, /*nb_int*/
1625
 
    (unaryfunc)PySwigObject_long, /*nb_long*/
 
1756
#if PY_VERSION_HEX < 0x03000000
 
1757
    0,   /*nb_coerce*/
 
1758
#endif
 
1759
    (unaryfunc)SwigPyObject_long, /*nb_int*/
 
1760
#if PY_VERSION_HEX < 0x03000000
 
1761
    (unaryfunc)SwigPyObject_long, /*nb_long*/
 
1762
#else
 
1763
    0, /*nb_reserved*/
 
1764
#endif
1626
1765
    (unaryfunc)0,                 /*nb_float*/
1627
 
    (unaryfunc)PySwigObject_oct,  /*nb_oct*/
1628
 
    (unaryfunc)PySwigObject_hex,  /*nb_hex*/
1629
 
#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
 
1766
#if PY_VERSION_HEX < 0x03000000
 
1767
    (unaryfunc)SwigPyObject_oct,  /*nb_oct*/
 
1768
    (unaryfunc)SwigPyObject_hex,  /*nb_hex*/
 
1769
#endif
 
1770
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
 
1771
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
 
1772
#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
1630
1773
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1631
1774
#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
1632
1775
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
1635
1778
#endif
1636
1779
  };
1637
1780
 
1638
 
  static PyTypeObject pyswigobject_type;  
 
1781
  static PyTypeObject swigpyobject_type;  
1639
1782
  static int type_init = 0;
1640
1783
  if (!type_init) {
1641
1784
    const PyTypeObject tmp
1642
1785
      = {
 
1786
        /* PyObject header changed in Python 3 */
 
1787
#if PY_VERSION_HEX >= 0x03000000
 
1788
        PyVarObject_HEAD_INIT(&PyType_Type, 0)
 
1789
#else    
1643
1790
        PyObject_HEAD_INIT(NULL)
1644
1791
        0,                                  /* ob_size */
1645
 
        (char *)"PySwigObject",             /* tp_name */
1646
 
        sizeof(PySwigObject),               /* tp_basicsize */
 
1792
#endif
 
1793
        (char *)"SwigPyObject",             /* tp_name */
 
1794
        sizeof(SwigPyObject),               /* tp_basicsize */
1647
1795
        0,                                  /* tp_itemsize */
1648
 
        (destructor)PySwigObject_dealloc,   /* tp_dealloc */
1649
 
        (printfunc)PySwigObject_print,      /* tp_print */
 
1796
        (destructor)SwigPyObject_dealloc,   /* tp_dealloc */
 
1797
        (printfunc)SwigPyObject_print,      /* tp_print */
1650
1798
#if PY_VERSION_HEX < 0x02020000
1651
 
        (getattrfunc)PySwigObject_getattr,  /* tp_getattr */ 
 
1799
        (getattrfunc)SwigPyObject_getattr,  /* tp_getattr */ 
1652
1800
#else
1653
1801
        (getattrfunc)0,                     /* tp_getattr */ 
1654
1802
#endif
1655
1803
        (setattrfunc)0,                     /* tp_setattr */ 
1656
 
        (cmpfunc)PySwigObject_compare,      /* tp_compare */ 
1657
 
        (reprfunc)PySwigObject_repr,        /* tp_repr */    
1658
 
        &PySwigObject_as_number,            /* tp_as_number */
 
1804
#if PY_VERSION_HEX >= 0x03000000
 
1805
    0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
 
1806
#else
 
1807
        (cmpfunc)SwigPyObject_compare,      /* tp_compare */
 
1808
#endif
 
1809
        (reprfunc)SwigPyObject_repr,        /* tp_repr */    
 
1810
        &SwigPyObject_as_number,            /* tp_as_number */
1659
1811
        0,                                  /* tp_as_sequence */
1660
1812
        0,                                  /* tp_as_mapping */
1661
1813
        (hashfunc)0,                        /* tp_hash */
1662
1814
        (ternaryfunc)0,                     /* tp_call */
1663
 
        (reprfunc)PySwigObject_str,         /* tp_str */
 
1815
        (reprfunc)SwigPyObject_str,         /* tp_str */
1664
1816
        PyObject_GenericGetAttr,            /* tp_getattro */
1665
1817
        0,                                  /* tp_setattro */
1666
1818
        0,                                  /* tp_as_buffer */
1668
1820
        swigobject_doc,                     /* tp_doc */        
1669
1821
        0,                                  /* tp_traverse */
1670
1822
        0,                                  /* tp_clear */
1671
 
        0,                                  /* tp_richcompare */
 
1823
        (richcmpfunc)SwigPyObject_richcompare,           /* tp_richcompare */
1672
1824
        0,                                  /* tp_weaklistoffset */
1673
1825
#if PY_VERSION_HEX >= 0x02020000
1674
1826
        0,                                  /* tp_iter */
1685
1837
        0,                                  /* tp_alloc */              
1686
1838
        0,                                  /* tp_new */                
1687
1839
        0,                                  /* tp_free */          
1688
 
        0,                                  /* tp_is_gc */  
 
1840
        0,                                  /* tp_is_gc */  
1689
1841
        0,                                  /* tp_bases */   
1690
1842
        0,                                  /* tp_mro */
1691
1843
        0,                                  /* tp_cache */   
1692
 
        0,                                  /* tp_subclasses */
 
1844
        0,                                  /* tp_subclasses */
1693
1845
        0,                                  /* tp_weaklist */
1694
1846
#endif
1695
1847
#if PY_VERSION_HEX >= 0x02030000
1699
1851
        0,0,0,0                             /* tp_alloc -> tp_next */
1700
1852
#endif
1701
1853
      };
1702
 
    pyswigobject_type = tmp;
1703
 
    pyswigobject_type.ob_type = &PyType_Type;
 
1854
    swigpyobject_type = tmp;
 
1855
    /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */
 
1856
#if PY_VERSION_HEX < 0x03000000
 
1857
    swigpyobject_type.ob_type = &PyType_Type;
 
1858
#endif
1704
1859
    type_init = 1;
1705
1860
  }
1706
 
  return &pyswigobject_type;
 
1861
  return &swigpyobject_type;
1707
1862
}
1708
1863
 
1709
1864
SWIGRUNTIME PyObject *
1710
 
PySwigObject_New(void *ptr, swig_type_info *ty, int own)
 
1865
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
1711
1866
{
1712
 
  PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
 
1867
  SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1713
1868
  if (sobj) {
1714
1869
    sobj->ptr  = ptr;
1715
1870
    sobj->ty   = ty;
1728
1883
  void *pack;
1729
1884
  swig_type_info *ty;
1730
1885
  size_t size;
1731
 
} PySwigPacked;
 
1886
} SwigPyPacked;
1732
1887
 
1733
1888
SWIGRUNTIME int
1734
 
PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 
1889
SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1735
1890
{
1736
1891
  char result[SWIG_BUFFER_SIZE];
1737
1892
  fputs("<Swig Packed ", fp); 
1745
1900
}
1746
1901
  
1747
1902
SWIGRUNTIME PyObject *
1748
 
PySwigPacked_repr(PySwigPacked *v)
 
1903
SwigPyPacked_repr(SwigPyPacked *v)
1749
1904
{
1750
1905
  char result[SWIG_BUFFER_SIZE];
1751
1906
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1752
 
    return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
 
1907
    return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1753
1908
  } else {
1754
 
    return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
 
1909
    return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
1755
1910
  }  
1756
1911
}
1757
1912
 
1758
1913
SWIGRUNTIME PyObject *
1759
 
PySwigPacked_str(PySwigPacked *v)
 
1914
SwigPyPacked_str(SwigPyPacked *v)
1760
1915
{
1761
1916
  char result[SWIG_BUFFER_SIZE];
1762
1917
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
1763
 
    return PyString_FromFormat("%s%s", result, v->ty->name);
 
1918
    return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
1764
1919
  } else {
1765
 
    return PyString_FromString(v->ty->name);
 
1920
    return SWIG_Python_str_FromChar(v->ty->name);
1766
1921
  }  
1767
1922
}
1768
1923
 
1769
1924
SWIGRUNTIME int
1770
 
PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
 
1925
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
1771
1926
{
1772
1927
  size_t i = v->size;
1773
1928
  size_t j = w->size;
1778
1933
SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
1779
1934
 
1780
1935
SWIGRUNTIME PyTypeObject*
1781
 
PySwigPacked_type(void) {
 
1936
SwigPyPacked_type(void) {
1782
1937
  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
1783
1938
  return type;
1784
1939
}
1785
1940
 
1786
1941
SWIGRUNTIMEINLINE int
1787
 
PySwigPacked_Check(PyObject *op) {
 
1942
SwigPyPacked_Check(PyObject *op) {
1788
1943
  return ((op)->ob_type == _PySwigPacked_type()) 
1789
 
    || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
 
1944
    || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
1790
1945
}
1791
1946
 
1792
1947
SWIGRUNTIME void
1793
 
PySwigPacked_dealloc(PyObject *v)
 
1948
SwigPyPacked_dealloc(PyObject *v)
1794
1949
{
1795
 
  if (PySwigPacked_Check(v)) {
1796
 
    PySwigPacked *sobj = (PySwigPacked *) v;
 
1950
  if (SwigPyPacked_Check(v)) {
 
1951
    SwigPyPacked *sobj = (SwigPyPacked *) v;
1797
1952
    free(sobj->pack);
1798
1953
  }
1799
1954
  PyObject_DEL(v);
1802
1957
SWIGRUNTIME PyTypeObject*
1803
1958
_PySwigPacked_type(void) {
1804
1959
  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
1805
 
  static PyTypeObject pyswigpacked_type;
 
1960
  static PyTypeObject swigpypacked_type;
1806
1961
  static int type_init = 0;  
1807
1962
  if (!type_init) {
1808
1963
    const PyTypeObject tmp
1809
1964
      = {
 
1965
    /* PyObject header changed in Python 3 */
 
1966
#if PY_VERSION_HEX>=0x03000000
 
1967
    PyVarObject_HEAD_INIT(&PyType_Type, 0)
 
1968
#else
1810
1969
        PyObject_HEAD_INIT(NULL)
1811
 
        0,                                  /* ob_size */       
1812
 
        (char *)"PySwigPacked",             /* tp_name */       
1813
 
        sizeof(PySwigPacked),               /* tp_basicsize */  
 
1970
    0,                              /* ob_size */       
 
1971
#endif
 
1972
        (char *)"SwigPyPacked",             /* tp_name */       
 
1973
        sizeof(SwigPyPacked),               /* tp_basicsize */  
1814
1974
        0,                                  /* tp_itemsize */   
1815
 
        (destructor)PySwigPacked_dealloc,   /* tp_dealloc */    
1816
 
        (printfunc)PySwigPacked_print,      /* tp_print */      
 
1975
        (destructor)SwigPyPacked_dealloc,   /* tp_dealloc */    
 
1976
        (printfunc)SwigPyPacked_print,      /* tp_print */      
1817
1977
        (getattrfunc)0,                     /* tp_getattr */    
1818
1978
        (setattrfunc)0,                     /* tp_setattr */    
1819
 
        (cmpfunc)PySwigPacked_compare,      /* tp_compare */    
1820
 
        (reprfunc)PySwigPacked_repr,        /* tp_repr */       
1821
 
        0,                                  /* tp_as_number */  
 
1979
#if PY_VERSION_HEX>=0x03000000
 
1980
    0, /* tp_reserved in 3.0.1 */
 
1981
#else
 
1982
    (cmpfunc)SwigPyPacked_compare,          /* tp_compare */
 
1983
#endif
 
1984
        (reprfunc)SwigPyPacked_repr,        /* tp_repr */
 
1985
        0,                                  /* tp_as_number */
1822
1986
        0,                                  /* tp_as_sequence */
1823
 
        0,                                  /* tp_as_mapping */ 
1824
 
        (hashfunc)0,                        /* tp_hash */       
1825
 
        (ternaryfunc)0,                     /* tp_call */       
1826
 
        (reprfunc)PySwigPacked_str,         /* tp_str */        
 
1987
        0,                                  /* tp_as_mapping */
 
1988
        (hashfunc)0,                        /* tp_hash */
 
1989
        (ternaryfunc)0,                     /* tp_call */
 
1990
        (reprfunc)SwigPyPacked_str,         /* tp_str */
1827
1991
        PyObject_GenericGetAttr,            /* tp_getattro */
1828
1992
        0,                                  /* tp_setattro */
1829
1993
        0,                                  /* tp_as_buffer */
1862
2026
        0,0,0,0                             /* tp_alloc -> tp_next */
1863
2027
#endif
1864
2028
      };
1865
 
    pyswigpacked_type = tmp;
1866
 
    pyswigpacked_type.ob_type = &PyType_Type;
 
2029
    swigpypacked_type = tmp;
 
2030
    /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */
 
2031
#if PY_VERSION_HEX < 0x03000000
 
2032
    swigpypacked_type.ob_type = &PyType_Type;
 
2033
#endif
1867
2034
    type_init = 1;
1868
2035
  }
1869
 
  return &pyswigpacked_type;
 
2036
  return &swigpypacked_type;
1870
2037
}
1871
2038
 
1872
2039
SWIGRUNTIME PyObject *
1873
 
PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
 
2040
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
1874
2041
{
1875
 
  PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
 
2042
  SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
1876
2043
  if (sobj) {
1877
2044
    void *pack = malloc(size);
1878
2045
    if (pack) {
1889
2056
}
1890
2057
 
1891
2058
SWIGRUNTIME swig_type_info *
1892
 
PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
 
2059
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
1893
2060
{
1894
 
  if (PySwigPacked_Check(obj)) {
1895
 
    PySwigPacked *sobj = (PySwigPacked *)obj;
 
2061
  if (SwigPyPacked_Check(obj)) {
 
2062
    SwigPyPacked *sobj = (SwigPyPacked *)obj;
1896
2063
    if (sobj->size != size) return 0;
1897
2064
    memcpy(ptr, sobj->pack, size);
1898
2065
    return sobj->ty;
1908
2075
SWIGRUNTIMEINLINE PyObject *
1909
2076
_SWIG_This(void)
1910
2077
{
1911
 
  return PyString_FromString("this");
 
2078
    return SWIG_Python_str_FromChar("this");
1912
2079
}
1913
2080
 
 
2081
static PyObject *swig_this = NULL;
 
2082
 
1914
2083
SWIGRUNTIME PyObject *
1915
2084
SWIG_This(void)
1916
2085
{
1917
 
  static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
 
2086
  if (swig_this == NULL)
 
2087
    swig_this = _SWIG_This();
1918
2088
  return swig_this;
1919
2089
}
1920
2090
 
1921
2091
/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
1922
2092
 
1923
 
SWIGRUNTIME PySwigObject *
 
2093
/* TODO: I don't know how to implement the fast getset in Python 3 right now */
 
2094
#if PY_VERSION_HEX>=0x03000000
 
2095
#define SWIG_PYTHON_SLOW_GETSET_THIS 
 
2096
#endif
 
2097
 
 
2098
SWIGRUNTIME SwigPyObject *
1924
2099
SWIG_Python_GetSwigThis(PyObject *pyobj) 
1925
2100
{
1926
 
  if (PySwigObject_Check(pyobj)) {
1927
 
    return (PySwigObject *) pyobj;
 
2101
  if (SwigPyObject_Check(pyobj)) {
 
2102
    return (SwigPyObject *) pyobj;
1928
2103
  } else {
1929
2104
    PyObject *obj = 0;
1930
2105
#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
1960
2135
      return 0;
1961
2136
    }
1962
2137
#endif
1963
 
    if (obj && !PySwigObject_Check(obj)) {
 
2138
    if (obj && !SwigPyObject_Check(obj)) {
1964
2139
      /* a PyObject is called 'this', try to get the 'real this'
1965
 
         PySwigObject from it */ 
 
2140
         SwigPyObject from it */ 
1966
2141
      return SWIG_Python_GetSwigThis(obj);
1967
2142
    }
1968
 
    return (PySwigObject *)obj;
 
2143
    return (SwigPyObject *)obj;
1969
2144
  }
1970
2145
}
1971
2146
 
1974
2149
SWIGRUNTIME int
1975
2150
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
1976
2151
  if (own == SWIG_POINTER_OWN) {
1977
 
    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
 
2152
    SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
1978
2153
    if (sobj) {
1979
2154
      int oldown = sobj->own;
1980
2155
      sobj->own = own;
1993
2168
    if (ptr) *ptr = 0;
1994
2169
    return SWIG_OK;
1995
2170
  } else {
1996
 
    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
 
2171
    SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
1997
2172
    if (own)
1998
2173
      *own = 0;
1999
2174
    while (sobj) {
2007
2182
        } else {
2008
2183
          swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2009
2184
          if (!tc) {
2010
 
            sobj = (PySwigObject *)sobj->next;
 
2185
            sobj = (SwigPyObject *)sobj->next;
2011
2186
          } else {
2012
2187
            if (ptr) {
2013
2188
              int newmemory = 0;
2014
2189
              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2015
2190
              if (newmemory == SWIG_CAST_NEW_MEMORY) {
2016
 
                assert(own);
 
2191
                assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2017
2192
                if (own)
2018
2193
                  *own = *own | SWIG_CAST_NEW_MEMORY;
2019
2194
              }
2036
2211
    } else {
2037
2212
      int res = SWIG_ERROR;
2038
2213
      if (flags & SWIG_POINTER_IMPLICIT_CONV) {
2039
 
        PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
 
2214
        SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2040
2215
        if (data && !data->implicitconv) {
2041
2216
          PyObject *klass = data->klass;
2042
2217
          if (klass) {
2049
2224
              impconv = 0;
2050
2225
            }
2051
2226
            if (impconv) {
2052
 
              PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
 
2227
              SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2053
2228
              if (iobj) {
2054
2229
                void *vptr;
2055
2230
                res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2087
2262
    /* here we get the method pointer for callbacks */
2088
2263
    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2089
2264
    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2090
 
    if (desc) {
 
2265
    if (desc)
2091
2266
      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2092
 
      if (!desc) return SWIG_ERROR;
2093
 
    }
 
2267
    if (!desc) 
 
2268
      return SWIG_ERROR;
2094
2269
    if (ty) {
2095
2270
      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
2096
2271
      if (tc) {
2111
2286
 
2112
2287
SWIGRUNTIME int
2113
2288
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2114
 
  swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
 
2289
  swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2115
2290
  if (!to) return SWIG_ERROR;
2116
2291
  if (ty) {
2117
2292
    if (to != ty) {
2128
2303
 * ----------------------------------------------------------------------------- */
2129
2304
 
2130
2305
/*
2131
 
  Create a new instance object, whitout calling __init__, and set the
 
2306
  Create a new instance object, without calling __init__, and set the
2132
2307
  'this' attribute.
2133
2308
*/
2134
2309
 
2135
2310
SWIGRUNTIME PyObject* 
2136
 
SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
 
2311
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
2137
2312
{
2138
2313
#if (PY_VERSION_HEX >= 0x02020000)
2139
2314
  PyObject *inst = 0;
2157
2332
#endif
2158
2333
    }
2159
2334
  } else {
 
2335
#if PY_VERSION_HEX >= 0x03000000
 
2336
    inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
 
2337
    PyObject_SetAttr(inst, SWIG_This(), swig_this);
 
2338
    Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
 
2339
#else
2160
2340
    PyObject *dict = PyDict_New();
2161
2341
    PyDict_SetItem(dict, SWIG_This(), swig_this);
2162
2342
    inst = PyInstance_NewRaw(data->newargs, dict);
2163
2343
    Py_DECREF(dict);
 
2344
#endif
2164
2345
  }
2165
2346
  return inst;
2166
2347
#else
2223
2404
  if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
2224
2405
    return NULL;
2225
2406
  } else {
2226
 
    PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
 
2407
    SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2227
2408
    if (sthis) {
2228
 
      PySwigObject_append((PyObject*) sthis, obj[1]);
 
2409
      SwigPyObject_append((PyObject*) sthis, obj[1]);
2229
2410
    } else {
2230
2411
      SWIG_Python_SetSwigThis(obj[0], obj[1]);
2231
2412
    }
2241
2422
    return SWIG_Py_Void();
2242
2423
  } else {
2243
2424
    int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2244
 
    PyObject *robj = PySwigObject_New(ptr, type, own);
2245
 
    PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
 
2425
    PyObject *robj = SwigPyObject_New(ptr, type, own);
 
2426
    SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2246
2427
    if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2247
2428
      PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2248
2429
      if (inst) {
2258
2439
 
2259
2440
SWIGRUNTIMEINLINE PyObject *
2260
2441
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2261
 
  return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
 
2442
  return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2262
2443
}
2263
2444
 
2264
2445
/* -----------------------------------------------------------------------------*
2277
2458
#ifdef SWIG_LINK_RUNTIME
2278
2459
    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2279
2460
#else
 
2461
#ifdef USE_CAPSULES
 
2462
    type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0);
 
2463
#else
2280
2464
    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2281
2465
                                    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
 
2466
#endif
2282
2467
    if (PyErr_Occurred()) {
2283
2468
      PyErr_Clear();
2284
2469
      type_pointer = (void *)0;
2323
2508
SWIGRUNTIME void
2324
2509
SWIG_Python_DestroyModule(void *vptr)
2325
2510
{
 
2511
  size_t i;
 
2512
#ifdef USE_CAPSULES
 
2513
  swig_module_info *swig_module =
 
2514
    (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME);
 
2515
#else
2326
2516
  swig_module_info *swig_module = (swig_module_info *) vptr;
 
2517
#endif
2327
2518
  swig_type_info **types = swig_module->types;
2328
 
  size_t i;
2329
2519
  for (i =0; i < swig_module->size; ++i) {
2330
2520
    swig_type_info *ty = types[i];
2331
2521
    if (ty->owndata) {
2332
 
      PySwigClientData *data = (PySwigClientData *) ty->clientdata;
2333
 
      if (data) PySwigClientData_Del(data);
 
2522
      SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
 
2523
      if (data) SwigPyClientData_Del(data);
2334
2524
    }
2335
2525
  }
2336
2526
  Py_DECREF(SWIG_This());
 
2527
  swig_this = NULL;
2337
2528
}
2338
2529
 
2339
2530
SWIGRUNTIME void
2340
2531
SWIG_Python_SetModule(swig_module_info *swig_module) {
2341
2532
  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
2342
2533
 
 
2534
#if PY_VERSION_HEX >= 0x03000000
 
2535
 /* Add a dummy module object into sys.modules */
 
2536
  PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
 
2537
#else
2343
2538
  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2344
2539
                                   swig_empty_runtime_method_table);
 
2540
#endif
 
2541
#ifdef USE_CAPSULES
 
2542
  PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME,
 
2543
                                    (PyCapsule_Destructor)SWIG_Python_DestroyModule);
 
2544
#else
2345
2545
  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
 
2546
#endif
2346
2547
  if (pointer && module) {
 
2548
#ifdef USE_CAPSULES
 
2549
    PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
 
2550
#else
2347
2551
    PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
 
2552
#endif
2348
2553
  } else {
2349
2554
    Py_XDECREF(pointer);
2350
2555
  }
2361
2566
SWIG_Python_TypeQuery(const char *type)
2362
2567
{
2363
2568
  PyObject *cache = SWIG_Python_TypeCache();
2364
 
  PyObject *key = PyString_FromString(type); 
 
2569
  PyObject *key = SWIG_Python_str_FromChar(type); 
2365
2570
  PyObject *obj = PyDict_GetItem(cache, key);
2366
2571
  swig_type_info *descriptor;
2367
2572
  if (obj) {
 
2573
#ifdef USE_CAPSULES
 
2574
    descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type);
 
2575
#else
2368
2576
    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
 
2577
#endif
2369
2578
  } else {
2370
2579
    swig_module_info *swig_module = SWIG_Python_GetModule();
2371
2580
    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2372
2581
    if (descriptor) {
 
2582
#ifdef USE_CAPSULES
 
2583
      obj = PyCapsule_New(descriptor, type, NULL);
 
2584
#else
2373
2585
      obj = PyCObject_FromVoidPtr(descriptor, NULL);
 
2586
#endif
2374
2587
      PyDict_SetItem(cache, key, obj);
2375
2588
      Py_DECREF(obj);
2376
2589
    }
2388
2601
 
2389
2602
SWIGRUNTIME int
2390
2603
SWIG_Python_AddErrMesg(const char* mesg, int infront)
2391
 
{
 
2604
{  
2392
2605
  if (PyErr_Occurred()) {
2393
2606
    PyObject *type = 0;
2394
2607
    PyObject *value = 0;
2395
2608
    PyObject *traceback = 0;
2396
2609
    PyErr_Fetch(&type, &value, &traceback);
2397
2610
    if (value) {
 
2611
      char *tmp;
2398
2612
      PyObject *old_str = PyObject_Str(value);
2399
2613
      Py_XINCREF(type);
2400
2614
      PyErr_Clear();
2401
2615
      if (infront) {
2402
 
        PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
 
2616
        PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
2403
2617
      } else {
2404
 
        PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
 
2618
        PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
2405
2619
      }
 
2620
      SWIG_Python_str_DelForPy3(tmp);
2406
2621
      Py_DECREF(old_str);
2407
2622
    }
2408
2623
    return 1;
2425
2640
}
2426
2641
 
2427
2642
SWIGRUNTIMEINLINE const char *
2428
 
PySwigObject_GetDesc(PyObject *self)
 
2643
SwigPyObject_GetDesc(PyObject *self)
2429
2644
{
2430
 
  PySwigObject *v = (PySwigObject *)self;
 
2645
  SwigPyObject *v = (SwigPyObject *)self;
2431
2646
  swig_type_info *ty = v ? v->ty : 0;
2432
2647
  return ty ? ty->str : (char*)"";
2433
2648
}
2437
2652
{
2438
2653
  if (type) {
2439
2654
#if defined(SWIG_COBJECT_TYPES)
2440
 
    if (obj && PySwigObject_Check(obj)) {
2441
 
      const char *otype = (const char *) PySwigObject_GetDesc(obj);
 
2655
    if (obj && SwigPyObject_Check(obj)) {
 
2656
      const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2442
2657
      if (otype) {
2443
 
        PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
 
2658
        PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2444
2659
                     type, otype);
2445
2660
        return;
2446
2661
      }
2450
2665
      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
2451
2666
      if (otype) {
2452
2667
        PyObject *str = PyObject_Str(obj);
2453
 
        const char *cstr = str ? PyString_AsString(str) : 0;
 
2668
        const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2454
2669
        if (cstr) {
2455
2670
          PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2456
2671
                       type, otype, cstr);
 
2672
          SWIG_Python_str_DelForPy3(cstr);
2457
2673
        } else {
2458
2674
          PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2459
2675
                       type, otype);
2475
2691
  void *result;
2476
2692
  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2477
2693
    PyErr_Clear();
2478
 
    if (flags & SWIG_POINTER_EXCEPTION) {
 
2694
#if SWIG_POINTER_EXCEPTION
 
2695
    if (flags) {
2479
2696
      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2480
2697
      SWIG_Python_ArgFail(argnum);
2481
2698
    }
 
2699
#endif
2482
2700
  }
2483
2701
  return result;
2484
2702
}
2518
2736
/*-----------------------------------------------
2519
2737
              @(target):= _coo.so
2520
2738
  ------------------------------------------------*/
2521
 
#define SWIG_init    init_coo
2522
 
 
 
2739
#if PY_VERSION_HEX >= 0x03000000
 
2740
#  define SWIG_init    PyInit__coo
 
2741
 
 
2742
#else
 
2743
#  define SWIG_init    init_coo
 
2744
 
 
2745
#endif
2523
2746
#define SWIG_name    "_coo"
2524
2747
 
2525
 
#define SWIGVERSION 0x010336 
 
2748
#define SWIGVERSION 0x020001 
2526
2749
#define SWIG_VERSION SWIGVERSION
2527
2750
 
2528
2751
 
2534
2757
 
2535
2758
 
2536
2759
namespace swig {
2537
 
  class PyObject_ptr {
 
2760
  class SwigPtr_PyObject {
2538
2761
  protected:
2539
2762
    PyObject *_obj;
2540
2763
 
2541
2764
  public:
2542
 
    PyObject_ptr() :_obj(0)
 
2765
    SwigPtr_PyObject() :_obj(0)
2543
2766
    {
2544
2767
    }
2545
2768
 
2546
 
    PyObject_ptr(const PyObject_ptr& item) : _obj(item._obj)
 
2769
    SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj)
2547
2770
    {
2548
2771
      Py_XINCREF(_obj);      
2549
2772
    }
2550
2773
    
2551
 
    PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
 
2774
    SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj)
2552
2775
    {
2553
2776
      if (initial_ref) {
2554
2777
        Py_XINCREF(_obj);
2555
2778
      }
2556
2779
    }
2557
2780
    
2558
 
    PyObject_ptr & operator=(const PyObject_ptr& item) 
 
2781
    SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) 
2559
2782
    {
2560
2783
      Py_XINCREF(item._obj);
2561
2784
      Py_XDECREF(_obj);
2563
2786
      return *this;      
2564
2787
    }
2565
2788
    
2566
 
    ~PyObject_ptr() 
 
2789
    ~SwigPtr_PyObject() 
2567
2790
    {
2568
2791
      Py_XDECREF(_obj);
2569
2792
    }
2582
2805
 
2583
2806
 
2584
2807
namespace swig {
2585
 
  struct PyObject_var : PyObject_ptr {
2586
 
    PyObject_var(PyObject* obj = 0) : PyObject_ptr(obj, false) { }
 
2808
  struct SwigVar_PyObject : SwigPtr_PyObject {
 
2809
    SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { }
2587
2810
    
2588
 
    PyObject_var & operator = (PyObject* obj)
 
2811
    SwigVar_PyObject & operator = (PyObject* obj)
2589
2812
    {
2590
2813
      Py_XDECREF(_obj);
2591
2814
      _obj = obj;
2595
2818
}
2596
2819
 
2597
2820
 
 
2821
#include "py3k.h"
2598
2822
#define SWIG_FILE_WITH_INIT
2599
2823
#include "Python.h"
2600
2824
#include "numpy/arrayobject.h"
5740
5964
  }
5741
5965
  
5742
5966
fail:
5743
 
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_tocsr'.\n"
 
5967
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'coo_tocsr'.\n"
5744
5968
    "  Possible C/C++ prototypes are:\n"
5745
5969
    "    coo_tocsr< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"
5746
5970
    "    coo_tocsr< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"
8390
8614
  }
8391
8615
  
8392
8616
fail:
8393
 
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_tocsc'.\n"
 
8617
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'coo_tocsc'.\n"
8394
8618
    "  Possible C/C++ prototypes are:\n"
8395
8619
    "    coo_tocsc< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],int [],int [],signed char [])\n"
8396
8620
    "    coo_tocsc< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],int [],int [],unsigned char [])\n"
10676
10900
  }
10677
10901
  
10678
10902
fail:
10679
 
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_todense'.\n"
 
10903
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'coo_todense'.\n"
10680
10904
    "  Possible C/C++ prototypes are:\n"
10681
10905
    "    coo_todense< int,signed char >(int const,int const,int const,int const [],int const [],signed char const [],signed char [])\n"
10682
10906
    "    coo_todense< int,unsigned char >(int const,int const,int const,int const [],int const [],unsigned char const [],unsigned char [])\n"
12948
13172
  }
12949
13173
  
12950
13174
fail:
12951
 
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'coo_matvec'.\n"
 
13175
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'coo_matvec'.\n"
12952
13176
    "  Possible C/C++ prototypes are:\n"
12953
13177
    "    coo_matvec< int,signed char >(int const,int const [],int const [],signed char const [],signed char const [],signed char [])\n"
12954
13178
    "    coo_matvec< int,unsigned char >(int const,int const [],int const [],unsigned char const [],unsigned char const [],unsigned char [])\n"
13039
13263
 
13040
13264
 
13041
13265
static PyMethodDef SwigMethods[] = {
 
13266
         { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
13042
13267
         { (char *)"coo_tocsr", _wrap_coo_tocsr, METH_VARARGS, (char *)"\n"
13043
13268
                "coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, \n"
13044
13269
                "    int Bp, int Bj, signed char Bx)\n"
13449
13674
  
13450
13675
  SWIGINTERN PyObject *
13451
13676
  swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
 
13677
#if PY_VERSION_HEX >= 0x03000000
 
13678
    return PyUnicode_InternFromString("<Swig global variables>");
 
13679
#else
13452
13680
    return PyString_FromString("<Swig global variables>");
 
13681
#endif
13453
13682
  }
13454
13683
  
13455
13684
  SWIGINTERN PyObject *
13456
13685
  swig_varlink_str(swig_varlinkobject *v) {
 
13686
#if PY_VERSION_HEX >= 0x03000000
 
13687
    PyObject *str = PyUnicode_InternFromString("(");
 
13688
    PyObject *tail;
 
13689
    PyObject *joined;
 
13690
    swig_globalvar *var;
 
13691
    for (var = v->vars; var; var=var->next) {
 
13692
      tail = PyUnicode_FromString(var->name);
 
13693
      joined = PyUnicode_Concat(str, tail);
 
13694
      Py_DecRef(str);
 
13695
      Py_DecRef(tail);
 
13696
      str = joined;
 
13697
      if (var->next) {
 
13698
        tail = PyUnicode_InternFromString(", ");
 
13699
        joined = PyUnicode_Concat(str, tail);
 
13700
        Py_DecRef(str);
 
13701
        Py_DecRef(tail);
 
13702
        str = joined;
 
13703
      }
 
13704
    }
 
13705
    tail = PyUnicode_InternFromString(")");
 
13706
    joined = PyUnicode_Concat(str, tail);
 
13707
    Py_DecRef(str);
 
13708
    Py_DecRef(tail);
 
13709
    str = joined;
 
13710
#else
13457
13711
    PyObject *str = PyString_FromString("(");
13458
 
    swig_globalvar  *var;
 
13712
    swig_globalvar *var;
13459
13713
    for (var = v->vars; var; var=var->next) {
13460
13714
      PyString_ConcatAndDel(&str,PyString_FromString(var->name));
13461
13715
      if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
13462
13716
    }
13463
13717
    PyString_ConcatAndDel(&str,PyString_FromString(")"));
 
13718
#endif
13464
13719
    return str;
13465
13720
  }
13466
13721
  
13467
13722
  SWIGINTERN int
13468
13723
  swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
 
13724
    char *tmp;
13469
13725
    PyObject *str = swig_varlink_str(v);
13470
13726
    fprintf(fp,"Swig global variables ");
13471
 
    fprintf(fp,"%s\n", PyString_AsString(str));
 
13727
    fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
 
13728
    SWIG_Python_str_DelForPy3(tmp);
13472
13729
    Py_DECREF(str);
13473
13730
    return 0;
13474
13731
  }
13526
13783
    if (!type_init) {
13527
13784
      const PyTypeObject tmp
13528
13785
      = {
 
13786
        /* PyObject header changed in Python 3 */
 
13787
#if PY_VERSION_HEX >= 0x03000000
 
13788
        PyVarObject_HEAD_INIT(&PyType_Type, 0)
 
13789
#else
13529
13790
        PyObject_HEAD_INIT(NULL)
13530
13791
        0,                                  /* Number of items in variable part (ob_size) */
 
13792
#endif
13531
13793
        (char *)"swigvarlink",              /* Type name (tp_name) */
13532
13794
        sizeof(swig_varlinkobject),         /* Basic size (tp_basicsize) */
13533
13795
        0,                                  /* Itemsize (tp_itemsize) */
13534
 
        (destructor) swig_varlink_dealloc,   /* Deallocator (tp_dealloc) */ 
 
13796
        (destructor) swig_varlink_dealloc,  /* Deallocator (tp_dealloc) */ 
13535
13797
        (printfunc) swig_varlink_print,     /* Print (tp_print) */
13536
13798
        (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
13537
13799
        (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
13542
13804
        0,                                  /* tp_as_mapping */
13543
13805
        0,                                  /* tp_hash */
13544
13806
        0,                                  /* tp_call */
13545
 
        (reprfunc)swig_varlink_str,        /* tp_str */
 
13807
        (reprfunc) swig_varlink_str,        /* tp_str */
13546
13808
        0,                                  /* tp_getattro */
13547
13809
        0,                                  /* tp_setattro */
13548
13810
        0,                                  /* tp_as_buffer */
13563
13825
#endif
13564
13826
      };
13565
13827
      varlink_type = tmp;
 
13828
      /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */
 
13829
#if PY_VERSION_HEX < 0x03000000
13566
13830
      varlink_type.ob_type = &PyType_Type;
 
13831
#endif
13567
13832
      type_init = 1;
13568
13833
    }
13569
13834
    return &varlink_type;
13655
13920
          }
13656
13921
        }
13657
13922
        if (ci) {
13658
 
          size_t shift = (ci->ptype) - types;
13659
 
          swig_type_info *ty = types_initial[shift];
13660
 
          size_t ldoc = (c - methods[i].ml_doc);
13661
 
          size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
13662
 
          char *ndoc = (char*)malloc(ldoc + lptr + 10);
13663
 
          if (ndoc) {
13664
 
            char *buff = ndoc;
13665
 
            void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
13666
 
            if (ptr) {
 
13923
          void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
 
13924
          if (ptr) {
 
13925
            size_t shift = (ci->ptype) - types;
 
13926
            swig_type_info *ty = types_initial[shift];
 
13927
            size_t ldoc = (c - methods[i].ml_doc);
 
13928
            size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
 
13929
            char *ndoc = (char*)malloc(ldoc + lptr + 10);
 
13930
            if (ndoc) {
 
13931
              char *buff = ndoc;
13667
13932
              strncpy(buff, methods[i].ml_doc, ldoc);
13668
13933
              buff += ldoc;
13669
13934
              strncpy(buff, "swig_ptr: ", 10);
13688
13953
#ifdef __cplusplus
13689
13954
extern "C"
13690
13955
#endif
13691
 
SWIGEXPORT void SWIG_init(void) {
13692
 
  PyObject *m, *d;
 
13956
 
 
13957
SWIGEXPORT 
 
13958
#if PY_VERSION_HEX >= 0x03000000
 
13959
PyObject*
 
13960
#else
 
13961
void
 
13962
#endif
 
13963
SWIG_init(void) {
 
13964
  PyObject *m, *d;  
 
13965
#if PY_VERSION_HEX >= 0x03000000
 
13966
  static struct PyModuleDef SWIG_module = {
 
13967
    PyModuleDef_HEAD_INIT,
 
13968
    (char *) SWIG_name,
 
13969
    NULL,
 
13970
    -1,
 
13971
    SwigMethods,
 
13972
    NULL,
 
13973
    NULL,
 
13974
    NULL,
 
13975
    NULL
 
13976
  };
 
13977
#endif
13693
13978
  
13694
13979
  /* Fix SwigMethods to carry the callback ptrs when needed */
13695
13980
  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
13696
13981
  
 
13982
#if PY_VERSION_HEX >= 0x03000000
 
13983
  m = PyModule_Create(&SWIG_module);
 
13984
#else
13697
13985
  m = Py_InitModule((char *) SWIG_name, SwigMethods);
 
13986
#endif
13698
13987
  d = PyModule_GetDict(m);
13699
13988
  
13700
13989
  SWIG_InitializeModule(0);
13704
13993
  
13705
13994
  import_array();
13706
13995
  
 
13996
#if PY_VERSION_HEX >= 0x03000000
 
13997
  return m;
 
13998
#else
 
13999
  return;
 
14000
#endif
13707
14001
}
13708
14002