~ubuntu-branches/ubuntu/trusty/znc/trusty

« back to all changes in this revision

Viewing changes to modules/modpython/swigpyrun.h

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-05-06 09:18:27 UTC
  • mfrom: (21.1.5 experimental)
  • Revision ID: package-import@ubuntu.com-20130506091827-08sixjiyy3hjfx6b
Tags: 1.0-4
* Change section from znc-tcl to interpreters.
* Uploading to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ----------------------------------------------------------------------------
 
2
 * This file was automatically generated by SWIG (http://www.swig.org).
 
3
 * Version 2.0.8
 
4
 * 
 
5
 * This file is not intended to be easily readable and contains a number of 
 
6
 * coding conventions designed to improve portability and efficiency. Do not make
 
7
 * changes to this file unless you know what you are doing--modify the SWIG 
 
8
 * interface file instead. 
 
9
 * ----------------------------------------------------------------------------- */
 
10
 
 
11
/* -----------------------------------------------------------------------------
 
12
 *  This section contains generic SWIG labels for method/variable
 
13
 *  declarations/attributes, and other compiler dependent labels.
 
14
 * ----------------------------------------------------------------------------- */
 
15
 
 
16
/* template workaround for compilers that cannot correctly implement the C++ standard */
 
17
#ifndef SWIGTEMPLATEDISAMBIGUATOR
 
18
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
 
19
#  define SWIGTEMPLATEDISAMBIGUATOR template
 
20
# elif defined(__HP_aCC)
 
21
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
 
22
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
 
23
#  define SWIGTEMPLATEDISAMBIGUATOR template
 
24
# else
 
25
#  define SWIGTEMPLATEDISAMBIGUATOR
 
26
# endif
 
27
#endif
 
28
 
 
29
/* inline attribute */
 
30
#ifndef SWIGINLINE
 
31
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
 
32
#   define SWIGINLINE inline
 
33
# else
 
34
#   define SWIGINLINE
 
35
# endif
 
36
#endif
 
37
 
 
38
/* attribute recognised by some compilers to avoid 'unused' warnings */
 
39
#ifndef SWIGUNUSED
 
40
# if defined(__GNUC__)
 
41
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
 
42
#     define SWIGUNUSED __attribute__ ((__unused__)) 
 
43
#   else
 
44
#     define SWIGUNUSED
 
45
#   endif
 
46
# elif defined(__ICC)
 
47
#   define SWIGUNUSED __attribute__ ((__unused__)) 
 
48
# else
 
49
#   define SWIGUNUSED 
 
50
# endif
 
51
#endif
 
52
 
 
53
#ifndef SWIG_MSC_UNSUPPRESS_4505
 
54
# if defined(_MSC_VER)
 
55
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
 
56
# endif 
 
57
#endif
 
58
 
 
59
#ifndef SWIGUNUSEDPARM
 
60
# ifdef __cplusplus
 
61
#   define SWIGUNUSEDPARM(p)
 
62
# else
 
63
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
 
64
# endif
 
65
#endif
 
66
 
 
67
/* internal SWIG method */
 
68
#ifndef SWIGINTERN
 
69
# define SWIGINTERN static SWIGUNUSED
 
70
#endif
 
71
 
 
72
/* internal inline SWIG method */
 
73
#ifndef SWIGINTERNINLINE
 
74
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
 
75
#endif
 
76
 
 
77
/* exporting methods */
 
78
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
 
79
#  ifndef GCC_HASCLASSVISIBILITY
 
80
#    define GCC_HASCLASSVISIBILITY
 
81
#  endif
 
82
#endif
 
83
 
 
84
#ifndef SWIGEXPORT
 
85
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 
86
#   if defined(STATIC_LINKED)
 
87
#     define SWIGEXPORT
 
88
#   else
 
89
#     define SWIGEXPORT __declspec(dllexport)
 
90
#   endif
 
91
# else
 
92
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
 
93
#     define SWIGEXPORT __attribute__ ((visibility("default")))
 
94
#   else
 
95
#     define SWIGEXPORT
 
96
#   endif
 
97
# endif
 
98
#endif
 
99
 
 
100
/* calling conventions for Windows */
 
101
#ifndef SWIGSTDCALL
 
102
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 
103
#   define SWIGSTDCALL __stdcall
 
104
# else
 
105
#   define SWIGSTDCALL
 
106
# endif 
 
107
#endif
 
108
 
 
109
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
 
110
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
 
111
# define _CRT_SECURE_NO_DEPRECATE
 
112
#endif
 
113
 
 
114
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
 
115
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
 
116
# define _SCL_SECURE_NO_DEPRECATE
 
117
#endif
 
118
 
 
119
/*  Errors in SWIG */
 
120
#define  SWIG_UnknownError         -1 
 
121
#define  SWIG_IOError              -2 
 
122
#define  SWIG_RuntimeError         -3 
 
123
#define  SWIG_IndexError           -4 
 
124
#define  SWIG_TypeError            -5 
 
125
#define  SWIG_DivisionByZero       -6 
 
126
#define  SWIG_OverflowError        -7 
 
127
#define  SWIG_SyntaxError          -8 
 
128
#define  SWIG_ValueError           -9 
 
129
#define  SWIG_SystemError          -10
 
130
#define  SWIG_AttributeError       -11
 
131
#define  SWIG_MemoryError          -12 
 
132
#define  SWIG_NullReferenceError   -13
 
133
 
 
134
 
 
135
/* -----------------------------------------------------------------------------
 
136
 * swigrun.swg
 
137
 *
 
138
 * This file contains generic C API SWIG runtime support for pointer
 
139
 * type checking.
 
140
 * ----------------------------------------------------------------------------- */
 
141
 
 
142
/* This should only be incremented when either the layout of swig_type_info changes,
 
143
   or for whatever reason, the runtime changes incompatibly */
 
144
#define SWIG_RUNTIME_VERSION "4"
 
145
 
 
146
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 
147
#ifdef SWIG_TYPE_TABLE
 
148
# define SWIG_QUOTE_STRING(x) #x
 
149
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
 
150
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
 
151
#else
 
152
# define SWIG_TYPE_TABLE_NAME
 
153
#endif
 
154
 
 
155
/*
 
156
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
 
157
  creating a static or dynamic library from the SWIG runtime code.
 
158
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
 
159
  
 
160
  But only do this if strictly necessary, ie, if you have problems
 
161
  with your compiler or suchlike.
 
162
*/
 
163
 
 
164
#ifndef SWIGRUNTIME
 
165
# define SWIGRUNTIME SWIGINTERN
 
166
#endif
 
167
 
 
168
#ifndef SWIGRUNTIMEINLINE
 
169
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
 
170
#endif
 
171
 
 
172
/*  Generic buffer size */
 
173
#ifndef SWIG_BUFFER_SIZE
 
174
# define SWIG_BUFFER_SIZE 1024
 
175
#endif
 
176
 
 
177
/* Flags for pointer conversions */
 
178
#define SWIG_POINTER_DISOWN        0x1
 
179
#define SWIG_CAST_NEW_MEMORY       0x2
 
180
 
 
181
/* Flags for new pointer objects */
 
182
#define SWIG_POINTER_OWN           0x1
 
183
 
 
184
 
 
185
/* 
 
186
   Flags/methods for returning states.
 
187
   
 
188
   The SWIG conversion methods, as ConvertPtr, return an integer 
 
189
   that tells if the conversion was successful or not. And if not,
 
190
   an error code can be returned (see swigerrors.swg for the codes).
 
191
   
 
192
   Use the following macros/flags to set or process the returning
 
193
   states.
 
194
   
 
195
   In old versions of SWIG, code such as the following was usually written:
 
196
 
 
197
     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
 
198
       // success code
 
199
     } else {
 
200
       //fail code
 
201
     }
 
202
 
 
203
   Now you can be more explicit:
 
204
 
 
205
    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
 
206
    if (SWIG_IsOK(res)) {
 
207
      // success code
 
208
    } else {
 
209
      // fail code
 
210
    }
 
211
 
 
212
   which is the same really, but now you can also do
 
213
 
 
214
    Type *ptr;
 
215
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
 
216
    if (SWIG_IsOK(res)) {
 
217
      // success code
 
218
      if (SWIG_IsNewObj(res) {
 
219
        ...
 
220
        delete *ptr;
 
221
      } else {
 
222
        ...
 
223
      }
 
224
    } else {
 
225
      // fail code
 
226
    }
 
227
    
 
228
   I.e., now SWIG_ConvertPtr can return new objects and you can
 
229
   identify the case and take care of the deallocation. Of course that
 
230
   also requires SWIG_ConvertPtr to return new result values, such as
 
231
 
 
232
      int SWIG_ConvertPtr(obj, ptr,...) {         
 
233
        if (<obj is ok>) {                             
 
234
          if (<need new object>) {                     
 
235
            *ptr = <ptr to new allocated object>; 
 
236
            return SWIG_NEWOBJ;                
 
237
          } else {                                     
 
238
            *ptr = <ptr to old object>;        
 
239
            return SWIG_OLDOBJ;                
 
240
          }                                    
 
241
        } else {                                       
 
242
          return SWIG_BADOBJ;                  
 
243
        }                                              
 
244
      }
 
245
 
 
246
   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
 
247
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
 
248
   SWIG errors code.
 
249
 
 
250
   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
 
251
   allows to return the 'cast rank', for example, if you have this
 
252
 
 
253
       int food(double)
 
254
       int fooi(int);
 
255
 
 
256
   and you call
 
257
 
 
258
      food(1)   // cast rank '1'  (1 -> 1.0)
 
259
      fooi(1)   // cast rank '0'
 
260
 
 
261
   just use the SWIG_AddCast()/SWIG_CheckState()
 
262
*/
 
263
 
 
264
#define SWIG_OK                    (0) 
 
265
#define SWIG_ERROR                 (-1)
 
266
#define SWIG_IsOK(r)               (r >= 0)
 
267
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
 
268
 
 
269
/* The CastRankLimit says how many bits are used for the cast rank */
 
270
#define SWIG_CASTRANKLIMIT         (1 << 8)
 
271
/* The NewMask denotes the object was created (using new/malloc) */
 
272
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
 
273
/* The TmpMask is for in/out typemaps that use temporal objects */
 
274
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
 
275
/* Simple returning values */
 
276
#define SWIG_BADOBJ                (SWIG_ERROR)
 
277
#define SWIG_OLDOBJ                (SWIG_OK)
 
278
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
 
279
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
 
280
/* Check, add and del mask methods */
 
281
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
 
282
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
 
283
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
 
284
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
 
285
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
 
286
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
 
287
 
 
288
/* Cast-Rank Mode */
 
289
#if defined(SWIG_CASTRANK_MODE)
 
290
#  ifndef SWIG_TypeRank
 
291
#    define SWIG_TypeRank             unsigned long
 
292
#  endif
 
293
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
 
294
#    define SWIG_MAXCASTRANK          (2)
 
295
#  endif
 
296
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 
297
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
 
298
SWIGINTERNINLINE int SWIG_AddCast(int r) { 
 
299
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 
300
}
 
301
SWIGINTERNINLINE int SWIG_CheckState(int r) { 
 
302
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
 
303
}
 
304
#else /* no cast-rank mode */
 
305
#  define SWIG_AddCast
 
306
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
 
307
#endif
 
308
 
 
309
 
 
310
#include <string.h>
 
311
 
 
312
#ifdef __cplusplus
 
313
extern "C" {
 
314
#endif
 
315
 
 
316
typedef void *(*swig_converter_func)(void *, int *);
 
317
typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
318
 
 
319
/* Structure to store information on one type */
 
320
typedef struct swig_type_info {
 
321
  const char             *name;                 /* mangled name of this type */
 
322
  const char             *str;                  /* human readable name of this type */
 
323
  swig_dycast_func        dcast;                /* dynamic cast function down a hierarchy */
 
324
  struct swig_cast_info  *cast;                 /* linked list of types that can cast into this type */
 
325
  void                   *clientdata;           /* language specific type data */
 
326
  int                    owndata;               /* flag if the structure owns the clientdata */
 
327
} swig_type_info;
 
328
 
 
329
/* Structure to store a type and conversion function used for casting */
 
330
typedef struct swig_cast_info {
 
331
  swig_type_info         *type;                 /* pointer to type that is equivalent to this type */
 
332
  swig_converter_func     converter;            /* function to cast the void pointers */
 
333
  struct swig_cast_info  *next;                 /* pointer to next cast in linked list */
 
334
  struct swig_cast_info  *prev;                 /* pointer to the previous cast */
 
335
} swig_cast_info;
 
336
 
 
337
/* Structure used to store module information
 
338
 * Each module generates one structure like this, and the runtime collects
 
339
 * all of these structures and stores them in a circularly linked list.*/
 
340
typedef struct swig_module_info {
 
341
  swig_type_info         **types;               /* Array of pointers to swig_type_info structures that are in this module */
 
342
  size_t                 size;                  /* Number of types in this module */
 
343
  struct swig_module_info *next;                /* Pointer to next element in circularly linked list */
 
344
  swig_type_info         **type_initial;        /* Array of initially generated type structures */
 
345
  swig_cast_info         **cast_initial;        /* Array of initially generated casting structures */
 
346
  void                    *clientdata;          /* Language specific module data */
 
347
} swig_module_info;
 
348
 
 
349
/* 
 
350
  Compare two type names skipping the space characters, therefore
 
351
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
 
352
 
 
353
  Return 0 when the two name types are equivalent, as in
 
354
  strncmp, but skipping ' '.
 
355
*/
 
356
SWIGRUNTIME int
 
357
SWIG_TypeNameComp(const char *f1, const char *l1,
 
358
                  const char *f2, const char *l2) {
 
359
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
 
360
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
 
361
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
 
362
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
 
363
  }
 
364
  return (int)((l1 - f1) - (l2 - f2));
 
365
}
 
366
 
 
367
/*
 
368
  Check type equivalence in a name list like <name1>|<name2>|...
 
369
  Return 0 if not equal, 1 if equal
 
370
*/
 
371
SWIGRUNTIME int
 
372
SWIG_TypeEquiv(const char *nb, const char *tb) {
 
373
  int equiv = 0;
 
374
  const char* te = tb + strlen(tb);
 
375
  const char* ne = nb;
 
376
  while (!equiv && *ne) {
 
377
    for (nb = ne; *ne; ++ne) {
 
378
      if (*ne == '|') break;
 
379
    }
 
380
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
 
381
    if (*ne) ++ne;
 
382
  }
 
383
  return equiv;
 
384
}
 
385
 
 
386
/*
 
387
  Check type equivalence in a name list like <name1>|<name2>|...
 
388
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 
389
*/
 
390
SWIGRUNTIME int
 
391
SWIG_TypeCompare(const char *nb, const char *tb) {
 
392
  int equiv = 0;
 
393
  const char* te = tb + strlen(tb);
 
394
  const char* ne = nb;
 
395
  while (!equiv && *ne) {
 
396
    for (nb = ne; *ne; ++ne) {
 
397
      if (*ne == '|') break;
 
398
    }
 
399
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
 
400
    if (*ne) ++ne;
 
401
  }
 
402
  return equiv;
 
403
}
 
404
 
 
405
 
 
406
/*
 
407
  Check the typename
 
408
*/
 
409
SWIGRUNTIME swig_cast_info *
 
410
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
 
411
  if (ty) {
 
412
    swig_cast_info *iter = ty->cast;
 
413
    while (iter) {
 
414
      if (strcmp(iter->type->name, c) == 0) {
 
415
        if (iter == ty->cast)
 
416
          return iter;
 
417
        /* Move iter to the top of the linked list */
 
418
        iter->prev->next = iter->next;
 
419
        if (iter->next)
 
420
          iter->next->prev = iter->prev;
 
421
        iter->next = ty->cast;
 
422
        iter->prev = 0;
 
423
        if (ty->cast) ty->cast->prev = iter;
 
424
        ty->cast = iter;
 
425
        return iter;
 
426
      }
 
427
      iter = iter->next;
 
428
    }
 
429
  }
 
430
  return 0;
 
431
}
 
432
 
 
433
/* 
 
434
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
 
435
*/
 
436
SWIGRUNTIME swig_cast_info *
 
437
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
 
438
  if (ty) {
 
439
    swig_cast_info *iter = ty->cast;
 
440
    while (iter) {
 
441
      if (iter->type == from) {
 
442
        if (iter == ty->cast)
 
443
          return iter;
 
444
        /* Move iter to the top of the linked list */
 
445
        iter->prev->next = iter->next;
 
446
        if (iter->next)
 
447
          iter->next->prev = iter->prev;
 
448
        iter->next = ty->cast;
 
449
        iter->prev = 0;
 
450
        if (ty->cast) ty->cast->prev = iter;
 
451
        ty->cast = iter;
 
452
        return iter;
 
453
      }
 
454
      iter = iter->next;
 
455
    }
 
456
  }
 
457
  return 0;
 
458
}
 
459
 
 
460
/*
 
461
  Cast a pointer up an inheritance hierarchy
 
462
*/
 
463
SWIGRUNTIMEINLINE void *
 
464
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
 
465
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 
466
}
 
467
 
 
468
/* 
 
469
   Dynamic pointer casting. Down an inheritance hierarchy
 
470
*/
 
471
SWIGRUNTIME swig_type_info *
 
472
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
 
473
  swig_type_info *lastty = ty;
 
474
  if (!ty || !ty->dcast) return ty;
 
475
  while (ty && (ty->dcast)) {
 
476
    ty = (*ty->dcast)(ptr);
 
477
    if (ty) lastty = ty;
 
478
  }
 
479
  return lastty;
 
480
}
 
481
 
 
482
/*
 
483
  Return the name associated with this type
 
484
*/
 
485
SWIGRUNTIMEINLINE const char *
 
486
SWIG_TypeName(const swig_type_info *ty) {
 
487
  return ty->name;
 
488
}
 
489
 
 
490
/*
 
491
  Return the pretty name associated with this type,
 
492
  that is an unmangled type name in a form presentable to the user.
 
493
*/
 
494
SWIGRUNTIME const char *
 
495
SWIG_TypePrettyName(const swig_type_info *type) {
 
496
  /* The "str" field contains the equivalent pretty names of the
 
497
     type, separated by vertical-bar characters.  We choose
 
498
     to print the last name, as it is often (?) the most
 
499
     specific. */
 
500
  if (!type) return NULL;
 
501
  if (type->str != NULL) {
 
502
    const char *last_name = type->str;
 
503
    const char *s;
 
504
    for (s = type->str; *s; s++)
 
505
      if (*s == '|') last_name = s+1;
 
506
    return last_name;
 
507
  }
 
508
  else
 
509
    return type->name;
 
510
}
 
511
 
 
512
/* 
 
513
   Set the clientdata field for a type
 
514
*/
 
515
SWIGRUNTIME void
 
516
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
 
517
  swig_cast_info *cast = ti->cast;
 
518
  /* if (ti->clientdata == clientdata) return; */
 
519
  ti->clientdata = clientdata;
 
520
  
 
521
  while (cast) {
 
522
    if (!cast->converter) {
 
523
      swig_type_info *tc = cast->type;
 
524
      if (!tc->clientdata) {
 
525
        SWIG_TypeClientData(tc, clientdata);
 
526
      }
 
527
    }    
 
528
    cast = cast->next;
 
529
  }
 
530
}
 
531
SWIGRUNTIME void
 
532
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
 
533
  SWIG_TypeClientData(ti, clientdata);
 
534
  ti->owndata = 1;
 
535
}
 
536
  
 
537
/*
 
538
  Search for a swig_type_info structure only by mangled name
 
539
  Search is a O(log #types)
 
540
  
 
541
  We start searching at module start, and finish searching when start == end.  
 
542
  Note: if start == end at the beginning of the function, we go all the way around
 
543
  the circular list.
 
544
*/
 
545
SWIGRUNTIME swig_type_info *
 
546
SWIG_MangledTypeQueryModule(swig_module_info *start, 
 
547
                            swig_module_info *end, 
 
548
                            const char *name) {
 
549
  swig_module_info *iter = start;
 
550
  do {
 
551
    if (iter->size) {
 
552
      register size_t l = 0;
 
553
      register size_t r = iter->size - 1;
 
554
      do {
 
555
        /* since l+r >= 0, we can (>> 1) instead (/ 2) */
 
556
        register size_t i = (l + r) >> 1; 
 
557
        const char *iname = iter->types[i]->name;
 
558
        if (iname) {
 
559
          register int compare = strcmp(name, iname);
 
560
          if (compare == 0) {       
 
561
            return iter->types[i];
 
562
          } else if (compare < 0) {
 
563
            if (i) {
 
564
              r = i - 1;
 
565
            } else {
 
566
              break;
 
567
            }
 
568
          } else if (compare > 0) {
 
569
            l = i + 1;
 
570
          }
 
571
        } else {
 
572
          break; /* should never happen */
 
573
        }
 
574
      } while (l <= r);
 
575
    }
 
576
    iter = iter->next;
 
577
  } while (iter != end);
 
578
  return 0;
 
579
}
 
580
 
 
581
/*
 
582
  Search for a swig_type_info structure for either a mangled name or a human readable name.
 
583
  It first searches the mangled names of the types, which is a O(log #types)
 
584
  If a type is not found it then searches the human readable names, which is O(#types).
 
585
  
 
586
  We start searching at module start, and finish searching when start == end.  
 
587
  Note: if start == end at the beginning of the function, we go all the way around
 
588
  the circular list.
 
589
*/
 
590
SWIGRUNTIME swig_type_info *
 
591
SWIG_TypeQueryModule(swig_module_info *start, 
 
592
                     swig_module_info *end, 
 
593
                     const char *name) {
 
594
  /* STEP 1: Search the name field using binary search */
 
595
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
 
596
  if (ret) {
 
597
    return ret;
 
598
  } else {
 
599
    /* STEP 2: If the type hasn't been found, do a complete search
 
600
       of the str field (the human readable name) */
 
601
    swig_module_info *iter = start;
 
602
    do {
 
603
      register size_t i = 0;
 
604
      for (; i < iter->size; ++i) {
 
605
        if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
 
606
          return iter->types[i];
 
607
      }
 
608
      iter = iter->next;
 
609
    } while (iter != end);
 
610
  }
 
611
  
 
612
  /* neither found a match */
 
613
  return 0;
 
614
}
 
615
 
 
616
/* 
 
617
   Pack binary data into a string
 
618
*/
 
619
SWIGRUNTIME char *
 
620
SWIG_PackData(char *c, void *ptr, size_t sz) {
 
621
  static const char hex[17] = "0123456789abcdef";
 
622
  register const unsigned char *u = (unsigned char *) ptr;
 
623
  register const unsigned char *eu =  u + sz;
 
624
  for (; u != eu; ++u) {
 
625
    register unsigned char uu = *u;
 
626
    *(c++) = hex[(uu & 0xf0) >> 4];
 
627
    *(c++) = hex[uu & 0xf];
 
628
  }
 
629
  return c;
 
630
}
 
631
 
 
632
/* 
 
633
   Unpack binary data from a string
 
634
*/
 
635
SWIGRUNTIME const char *
 
636
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
 
637
  register unsigned char *u = (unsigned char *) ptr;
 
638
  register const unsigned char *eu = u + sz;
 
639
  for (; u != eu; ++u) {
 
640
    register char d = *(c++);
 
641
    register unsigned char uu;
 
642
    if ((d >= '0') && (d <= '9'))
 
643
      uu = (unsigned char)((d - '0') << 4);
 
644
    else if ((d >= 'a') && (d <= 'f'))
 
645
      uu = (unsigned char)((d - ('a'-10)) << 4);
 
646
    else 
 
647
      return (char *) 0;
 
648
    d = *(c++);
 
649
    if ((d >= '0') && (d <= '9'))
 
650
      uu |= (unsigned char)(d - '0');
 
651
    else if ((d >= 'a') && (d <= 'f'))
 
652
      uu |= (unsigned char)(d - ('a'-10));
 
653
    else 
 
654
      return (char *) 0;
 
655
    *u = uu;
 
656
  }
 
657
  return c;
 
658
}
 
659
 
 
660
/* 
 
661
   Pack 'void *' into a string buffer.
 
662
*/
 
663
SWIGRUNTIME char *
 
664
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
 
665
  char *r = buff;
 
666
  if ((2*sizeof(void *) + 2) > bsz) return 0;
 
667
  *(r++) = '_';
 
668
  r = SWIG_PackData(r,&ptr,sizeof(void *));
 
669
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
 
670
  strcpy(r,name);
 
671
  return buff;
 
672
}
 
673
 
 
674
SWIGRUNTIME const char *
 
675
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
 
676
  if (*c != '_') {
 
677
    if (strcmp(c,"NULL") == 0) {
 
678
      *ptr = (void *) 0;
 
679
      return name;
 
680
    } else {
 
681
      return 0;
 
682
    }
 
683
  }
 
684
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
 
685
}
 
686
 
 
687
SWIGRUNTIME char *
 
688
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
 
689
  char *r = buff;
 
690
  size_t lname = (name ? strlen(name) : 0);
 
691
  if ((2*sz + 2 + lname) > bsz) return 0;
 
692
  *(r++) = '_';
 
693
  r = SWIG_PackData(r,ptr,sz);
 
694
  if (lname) {
 
695
    strncpy(r,name,lname+1);
 
696
  } else {
 
697
    *r = 0;
 
698
  }
 
699
  return buff;
 
700
}
 
701
 
 
702
SWIGRUNTIME const char *
 
703
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
 
704
  if (*c != '_') {
 
705
    if (strcmp(c,"NULL") == 0) {
 
706
      memset(ptr,0,sz);
 
707
      return name;
 
708
    } else {
 
709
      return 0;
 
710
    }
 
711
  }
 
712
  return SWIG_UnpackData(++c,ptr,sz);
 
713
}
 
714
 
 
715
#ifdef __cplusplus
 
716
}
 
717
#endif
 
718
/* Compatibility macros for Python 3 */
 
719
#if PY_VERSION_HEX >= 0x03000000
 
720
 
 
721
#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
 
722
#define PyInt_Check(x) PyLong_Check(x)
 
723
#define PyInt_AsLong(x) PyLong_AsLong(x)
 
724
#define PyInt_FromLong(x) PyLong_FromLong(x)
 
725
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
 
726
#define PyString_Check(name) PyBytes_Check(name)
 
727
#define PyString_FromString(x) PyUnicode_FromString(x)
 
728
#define PyString_Format(fmt, args)  PyUnicode_Format(fmt, args)
 
729
#define PyString_AsString(str) PyBytes_AsString(str)
 
730
#define PyString_Size(str) PyBytes_Size(str)    
 
731
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
 
732
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
 
733
#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
 
734
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
 
735
 
 
736
#endif
 
737
 
 
738
#ifndef Py_TYPE
 
739
#  define Py_TYPE(op) ((op)->ob_type)
 
740
#endif
 
741
 
 
742
/* SWIG APIs for compatibility of both Python 2 & 3 */
 
743
 
 
744
#if PY_VERSION_HEX >= 0x03000000
 
745
#  define SWIG_Python_str_FromFormat PyUnicode_FromFormat
 
746
#else
 
747
#  define SWIG_Python_str_FromFormat PyString_FromFormat
 
748
#endif
 
749
 
 
750
 
 
751
/* Warning: This function will allocate a new string in Python 3,
 
752
 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
 
753
 */
 
754
SWIGINTERN char*
 
755
SWIG_Python_str_AsChar(PyObject *str)
 
756
{
 
757
#if PY_VERSION_HEX >= 0x03000000
 
758
  char *cstr;
 
759
  char *newstr;
 
760
  Py_ssize_t len;
 
761
  str = PyUnicode_AsUTF8String(str);
 
762
  PyBytes_AsStringAndSize(str, &cstr, &len);
 
763
  newstr = (char *) malloc(len+1);
 
764
  memcpy(newstr, cstr, len+1);
 
765
  Py_XDECREF(str);
 
766
  return newstr;
 
767
#else
 
768
  return PyString_AsString(str);
 
769
#endif
 
770
}
 
771
 
 
772
#if PY_VERSION_HEX >= 0x03000000
 
773
#  define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
 
774
#else
 
775
#  define SWIG_Python_str_DelForPy3(x) 
 
776
#endif
 
777
 
 
778
 
 
779
SWIGINTERN PyObject*
 
780
SWIG_Python_str_FromChar(const char *c)
 
781
{
 
782
#if PY_VERSION_HEX >= 0x03000000
 
783
  return PyUnicode_FromString(c); 
 
784
#else
 
785
  return PyString_FromString(c);
 
786
#endif
 
787
}
 
788
 
 
789
/* Add PyOS_snprintf for old Pythons */
 
790
#if PY_VERSION_HEX < 0x02020000
 
791
# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
 
792
#  define PyOS_snprintf _snprintf
 
793
# else
 
794
#  define PyOS_snprintf snprintf
 
795
# endif
 
796
#endif
 
797
 
 
798
/* A crude PyString_FromFormat implementation for old Pythons */
 
799
#if PY_VERSION_HEX < 0x02020000
 
800
 
 
801
#ifndef SWIG_PYBUFFER_SIZE
 
802
# define SWIG_PYBUFFER_SIZE 1024
 
803
#endif
 
804
 
 
805
static PyObject *
 
806
PyString_FromFormat(const char *fmt, ...) {
 
807
  va_list ap;
 
808
  char buf[SWIG_PYBUFFER_SIZE * 2];
 
809
  int res;
 
810
  va_start(ap, fmt);
 
811
  res = vsnprintf(buf, sizeof(buf), fmt, ap);
 
812
  va_end(ap);
 
813
  return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
 
814
}
 
815
#endif
 
816
 
 
817
/* Add PyObject_Del for old Pythons */
 
818
#if PY_VERSION_HEX < 0x01060000
 
819
# define PyObject_Del(op) PyMem_DEL((op))
 
820
#endif
 
821
#ifndef PyObject_DEL
 
822
# define PyObject_DEL PyObject_Del
 
823
#endif
 
824
 
 
825
/* A crude PyExc_StopIteration exception for old Pythons */
 
826
#if PY_VERSION_HEX < 0x02020000
 
827
# ifndef PyExc_StopIteration
 
828
#  define PyExc_StopIteration PyExc_RuntimeError
 
829
# endif
 
830
# ifndef PyObject_GenericGetAttr
 
831
#  define PyObject_GenericGetAttr 0
 
832
# endif
 
833
#endif
 
834
 
 
835
/* Py_NotImplemented is defined in 2.1 and up. */
 
836
#if PY_VERSION_HEX < 0x02010000
 
837
# ifndef Py_NotImplemented
 
838
#  define Py_NotImplemented PyExc_RuntimeError
 
839
# endif
 
840
#endif
 
841
 
 
842
/* A crude PyString_AsStringAndSize implementation for old Pythons */
 
843
#if PY_VERSION_HEX < 0x02010000
 
844
# ifndef PyString_AsStringAndSize
 
845
#  define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
 
846
# endif
 
847
#endif
 
848
 
 
849
/* PySequence_Size for old Pythons */
 
850
#if PY_VERSION_HEX < 0x02000000
 
851
# ifndef PySequence_Size
 
852
#  define PySequence_Size PySequence_Length
 
853
# endif
 
854
#endif
 
855
 
 
856
/* PyBool_FromLong for old Pythons */
 
857
#if PY_VERSION_HEX < 0x02030000
 
858
static
 
859
PyObject *PyBool_FromLong(long ok)
 
860
{
 
861
  PyObject *result = ok ? Py_True : Py_False;
 
862
  Py_INCREF(result);
 
863
  return result;
 
864
}
 
865
#endif
 
866
 
 
867
/* Py_ssize_t for old Pythons */
 
868
/* This code is as recommended by: */
 
869
/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
 
870
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
 
871
typedef int Py_ssize_t;
 
872
# define PY_SSIZE_T_MAX INT_MAX
 
873
# define PY_SSIZE_T_MIN INT_MIN
 
874
typedef inquiry lenfunc;
 
875
typedef intargfunc ssizeargfunc;
 
876
typedef intintargfunc ssizessizeargfunc;
 
877
typedef intobjargproc ssizeobjargproc;
 
878
typedef intintobjargproc ssizessizeobjargproc;
 
879
typedef getreadbufferproc readbufferproc;
 
880
typedef getwritebufferproc writebufferproc;
 
881
typedef getsegcountproc segcountproc;
 
882
typedef getcharbufferproc charbufferproc;
 
883
static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
 
884
{
 
885
  long result = 0;
 
886
  PyObject *i = PyNumber_Int(x);
 
887
  if (i) {
 
888
    result = PyInt_AsLong(i);
 
889
    Py_DECREF(i);
 
890
  }
 
891
  return result;
 
892
}
 
893
#endif
 
894
 
 
895
#if PY_VERSION_HEX < 0x02040000
 
896
#define Py_VISIT(op)                            \
 
897
  do {                                          \
 
898
    if (op) {                                   \
 
899
      int vret = visit((op), arg);              \
 
900
      if (vret)                                 \
 
901
        return vret;                            \
 
902
    }                                           \
 
903
  } while (0)
 
904
#endif
 
905
 
 
906
#if PY_VERSION_HEX < 0x02030000
 
907
typedef struct {
 
908
  PyTypeObject type;
 
909
  PyNumberMethods as_number;
 
910
  PyMappingMethods as_mapping;
 
911
  PySequenceMethods as_sequence;
 
912
  PyBufferProcs as_buffer;
 
913
  PyObject *name, *slots;
 
914
} PyHeapTypeObject;
 
915
#endif
 
916
 
 
917
#if PY_VERSION_HEX < 0x02030000
 
918
typedef destructor freefunc;
 
919
#endif
 
920
 
 
921
#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
 
922
     (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
 
923
     (PY_MAJOR_VERSION > 3))
 
924
# define SWIGPY_USE_CAPSULE
 
925
# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
 
926
#endif
 
927
 
 
928
#if PY_VERSION_HEX < 0x03020000
 
929
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
 
930
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
 
931
#endif
 
932
/* -----------------------------------------------------------------------------
 
933
 * error manipulation
 
934
 * ----------------------------------------------------------------------------- */
 
935
 
 
936
SWIGRUNTIME PyObject*
 
937
SWIG_Python_ErrorType(int code) {
 
938
  PyObject* type = 0;
 
939
  switch(code) {
 
940
  case SWIG_MemoryError:
 
941
    type = PyExc_MemoryError;
 
942
    break;
 
943
  case SWIG_IOError:
 
944
    type = PyExc_IOError;
 
945
    break;
 
946
  case SWIG_RuntimeError:
 
947
    type = PyExc_RuntimeError;
 
948
    break;
 
949
  case SWIG_IndexError:
 
950
    type = PyExc_IndexError;
 
951
    break;
 
952
  case SWIG_TypeError:
 
953
    type = PyExc_TypeError;
 
954
    break;
 
955
  case SWIG_DivisionByZero:
 
956
    type = PyExc_ZeroDivisionError;
 
957
    break;
 
958
  case SWIG_OverflowError:
 
959
    type = PyExc_OverflowError;
 
960
    break;
 
961
  case SWIG_SyntaxError:
 
962
    type = PyExc_SyntaxError;
 
963
    break;
 
964
  case SWIG_ValueError:
 
965
    type = PyExc_ValueError;
 
966
    break;
 
967
  case SWIG_SystemError:
 
968
    type = PyExc_SystemError;
 
969
    break;
 
970
  case SWIG_AttributeError:
 
971
    type = PyExc_AttributeError;
 
972
    break;
 
973
  default:
 
974
    type = PyExc_RuntimeError;
 
975
  }
 
976
  return type;
 
977
}
 
978
 
 
979
 
 
980
SWIGRUNTIME void
 
981
SWIG_Python_AddErrorMsg(const char* mesg)
 
982
{
 
983
  PyObject *type = 0;
 
984
  PyObject *value = 0;
 
985
  PyObject *traceback = 0;
 
986
 
 
987
  if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
 
988
  if (value) {
 
989
    char *tmp;
 
990
    PyObject *old_str = PyObject_Str(value);
 
991
    PyErr_Clear();
 
992
    Py_XINCREF(type);
 
993
 
 
994
    PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
 
995
    SWIG_Python_str_DelForPy3(tmp);
 
996
    Py_DECREF(old_str);
 
997
    Py_DECREF(value);
 
998
  } else {
 
999
    PyErr_SetString(PyExc_RuntimeError, mesg);
 
1000
  }
 
1001
}
 
1002
#if defined(SWIG_PYTHON_NO_THREADS)
 
1003
#  if defined(SWIG_PYTHON_THREADS)
 
1004
#    undef SWIG_PYTHON_THREADS
 
1005
#  endif
 
1006
#endif
 
1007
#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
 
1008
#  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
 
1009
#    if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
 
1010
#      define SWIG_PYTHON_USE_GIL
 
1011
#    endif
 
1012
#  endif
 
1013
#  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
 
1014
#    ifndef SWIG_PYTHON_INITIALIZE_THREADS
 
1015
#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
 
1016
#    endif
 
1017
#    ifdef __cplusplus /* C++ code */
 
1018
       class SWIG_Python_Thread_Block {
 
1019
         bool status;
 
1020
         PyGILState_STATE state;
 
1021
       public:
 
1022
         void end() { if (status) { PyGILState_Release(state); status = false;} }
 
1023
         SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
 
1024
         ~SWIG_Python_Thread_Block() { end(); }
 
1025
       };
 
1026
       class SWIG_Python_Thread_Allow {
 
1027
         bool status;
 
1028
         PyThreadState *save;
 
1029
       public:
 
1030
         void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
 
1031
         SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
 
1032
         ~SWIG_Python_Thread_Allow() { end(); }
 
1033
       };
 
1034
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
 
1035
#      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
 
1036
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
 
1037
#      define SWIG_PYTHON_THREAD_END_ALLOW     _swig_thread_allow.end()
 
1038
#    else /* C code */
 
1039
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
 
1040
#      define SWIG_PYTHON_THREAD_END_BLOCK     PyGILState_Release(_swig_thread_block)
 
1041
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
 
1042
#      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
 
1043
#    endif
 
1044
#  else /* Old thread way, not implemented, user must provide it */
 
1045
#    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
 
1046
#      define SWIG_PYTHON_INITIALIZE_THREADS
 
1047
#    endif
 
1048
#    if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
 
1049
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK
 
1050
#    endif
 
1051
#    if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
 
1052
#      define SWIG_PYTHON_THREAD_END_BLOCK
 
1053
#    endif
 
1054
#    if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
 
1055
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW
 
1056
#    endif
 
1057
#    if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
 
1058
#      define SWIG_PYTHON_THREAD_END_ALLOW
 
1059
#    endif
 
1060
#  endif
 
1061
#else /* No thread support */
 
1062
#  define SWIG_PYTHON_INITIALIZE_THREADS
 
1063
#  define SWIG_PYTHON_THREAD_BEGIN_BLOCK
 
1064
#  define SWIG_PYTHON_THREAD_END_BLOCK
 
1065
#  define SWIG_PYTHON_THREAD_BEGIN_ALLOW
 
1066
#  define SWIG_PYTHON_THREAD_END_ALLOW
 
1067
#endif
 
1068
/* -----------------------------------------------------------------------------
 
1069
 * Python API portion that goes into the runtime
 
1070
 * ----------------------------------------------------------------------------- */
 
1071
 
 
1072
#ifdef __cplusplus
 
1073
extern "C" {
 
1074
#endif
 
1075
 
 
1076
/* -----------------------------------------------------------------------------
 
1077
 * Constant declarations
 
1078
 * ----------------------------------------------------------------------------- */
 
1079
 
 
1080
/* Constant Types */
 
1081
#define SWIG_PY_POINTER 4
 
1082
#define SWIG_PY_BINARY  5
 
1083
 
 
1084
/* Constant information structure */
 
1085
typedef struct swig_const_info {
 
1086
  int type;
 
1087
  char *name;
 
1088
  long lvalue;
 
1089
  double dvalue;
 
1090
  void   *pvalue;
 
1091
  swig_type_info **ptype;
 
1092
} swig_const_info;
 
1093
 
 
1094
 
 
1095
/* -----------------------------------------------------------------------------
 
1096
 * Wrapper of PyInstanceMethod_New() used in Python 3
 
1097
 * It is exported to the generated module, used for -fastproxy
 
1098
 * ----------------------------------------------------------------------------- */
 
1099
#if PY_VERSION_HEX >= 0x03000000
 
1100
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
 
1101
{
 
1102
  return PyInstanceMethod_New(func);
 
1103
}
 
1104
#else
 
1105
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
 
1106
{
 
1107
  return NULL;
 
1108
}
 
1109
#endif
 
1110
 
 
1111
#ifdef __cplusplus
 
1112
}
 
1113
#endif
 
1114
 
 
1115
/* -----------------------------------------------------------------------------
 
1116
 * pyrun.swg
 
1117
 *
 
1118
 * This file contains the runtime support for Python modules
 
1119
 * and includes code for managing global variables and pointer
 
1120
 * type checking.
 
1121
 *
 
1122
 * ----------------------------------------------------------------------------- */
 
1123
 
 
1124
/* Common SWIG API */
 
1125
 
 
1126
/* for raw pointers */
 
1127
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
 
1128
#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
 
1129
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
 
1130
 
 
1131
#ifdef SWIGPYTHON_BUILTIN
 
1132
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(self, ptr, type, flags)
 
1133
#else
 
1134
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
 
1135
#endif
 
1136
 
 
1137
#define SWIG_InternalNewPointerObj(ptr, type, flags)    SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
 
1138
 
 
1139
#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
 
1140
#define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
 
1141
#define swig_owntype                                    int
 
1142
 
 
1143
/* for raw packed data */
 
1144
#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
 
1145
#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
 
1146
 
 
1147
/* for class or struct pointers */
 
1148
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
 
1149
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
 
1150
 
 
1151
/* for C or C++ function pointers */
 
1152
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
 
1153
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
 
1154
 
 
1155
/* for C++ member pointers, ie, member methods */
 
1156
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
 
1157
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
 
1158
 
 
1159
 
 
1160
/* Runtime API */
 
1161
 
 
1162
#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule()
 
1163
#define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
 
1164
#define SWIG_NewClientData(obj)                         SwigPyClientData_New(obj)
 
1165
 
 
1166
#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
 
1167
#define SWIG_SetErrorMsg                                SWIG_Python_SetErrorMsg                            
 
1168
#define SWIG_ErrorType(code)                            SWIG_Python_ErrorType(code)                        
 
1169
#define SWIG_Error(code, msg)                           SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
 
1170
#define SWIG_fail                                       goto fail                                          
 
1171
 
 
1172
 
 
1173
/* Runtime API implementation */
 
1174
 
 
1175
/* Error manipulation */
 
1176
 
 
1177
SWIGINTERN void 
 
1178
SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
 
1179
  SWIG_PYTHON_THREAD_BEGIN_BLOCK; 
 
1180
  PyErr_SetObject(errtype, obj);
 
1181
  Py_DECREF(obj);
 
1182
  SWIG_PYTHON_THREAD_END_BLOCK;
 
1183
}
 
1184
 
 
1185
SWIGINTERN void 
 
1186
SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
 
1187
  SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 
1188
  PyErr_SetString(errtype, msg);
 
1189
  SWIG_PYTHON_THREAD_END_BLOCK;
 
1190
}
 
1191
 
 
1192
#define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
 
1193
 
 
1194
/* Set a constant value */
 
1195
 
 
1196
#if defined(SWIGPYTHON_BUILTIN)
 
1197
 
 
1198
SWIGINTERN void
 
1199
SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
 
1200
  PyObject *s = PyString_InternFromString(key);
 
1201
  PyList_Append(seq, s);
 
1202
  Py_DECREF(s);
 
1203
}
 
1204
 
 
1205
SWIGINTERN void
 
1206
SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {   
 
1207
#if PY_VERSION_HEX < 0x02030000
 
1208
  PyDict_SetItemString(d, (char *)name, obj);
 
1209
#else
 
1210
  PyDict_SetItemString(d, name, obj);
 
1211
#endif
 
1212
  Py_DECREF(obj);
 
1213
  if (public_interface)
 
1214
    SwigPyBuiltin_AddPublicSymbol(public_interface, name);
 
1215
}
 
1216
 
 
1217
#else
 
1218
 
 
1219
SWIGINTERN void
 
1220
SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
 
1221
#if PY_VERSION_HEX < 0x02030000
 
1222
  PyDict_SetItemString(d, (char *)name, obj);
 
1223
#else
 
1224
  PyDict_SetItemString(d, name, obj);
 
1225
#endif
 
1226
  Py_DECREF(obj);                            
 
1227
}
 
1228
 
 
1229
#endif
 
1230
 
 
1231
/* Append a value to the result obj */
 
1232
 
 
1233
SWIGINTERN PyObject*
 
1234
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
 
1235
#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
 
1236
  if (!result) {
 
1237
    result = obj;
 
1238
  } else if (result == Py_None) {
 
1239
    Py_DECREF(result);
 
1240
    result = obj;
 
1241
  } else {
 
1242
    if (!PyList_Check(result)) {
 
1243
      PyObject *o2 = result;
 
1244
      result = PyList_New(1);
 
1245
      PyList_SetItem(result, 0, o2);
 
1246
    }
 
1247
    PyList_Append(result,obj);
 
1248
    Py_DECREF(obj);
 
1249
  }
 
1250
  return result;
 
1251
#else
 
1252
  PyObject*   o2;
 
1253
  PyObject*   o3;
 
1254
  if (!result) {
 
1255
    result = obj;
 
1256
  } else if (result == Py_None) {
 
1257
    Py_DECREF(result);
 
1258
    result = obj;
 
1259
  } else {
 
1260
    if (!PyTuple_Check(result)) {
 
1261
      o2 = result;
 
1262
      result = PyTuple_New(1);
 
1263
      PyTuple_SET_ITEM(result, 0, o2);
 
1264
    }
 
1265
    o3 = PyTuple_New(1);
 
1266
    PyTuple_SET_ITEM(o3, 0, obj);
 
1267
    o2 = result;
 
1268
    result = PySequence_Concat(o2, o3);
 
1269
    Py_DECREF(o2);
 
1270
    Py_DECREF(o3);
 
1271
  }
 
1272
  return result;
 
1273
#endif
 
1274
}
 
1275
 
 
1276
/* Unpack the argument tuple */
 
1277
 
 
1278
SWIGINTERN int
 
1279
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
 
1280
{
 
1281
  if (!args) {
 
1282
    if (!min && !max) {
 
1283
      return 1;
 
1284
    } else {
 
1285
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
 
1286
                   name, (min == max ? "" : "at least "), (int)min);
 
1287
      return 0;
 
1288
    }
 
1289
  }  
 
1290
  if (!PyTuple_Check(args)) {
 
1291
    if (min <= 1 && max >= 1) {
 
1292
      register int i;
 
1293
      objs[0] = args;
 
1294
      for (i = 1; i < max; ++i) {
 
1295
        objs[i] = 0;
 
1296
      }
 
1297
      return 2;
 
1298
    }
 
1299
    PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
 
1300
    return 0;
 
1301
  } else {
 
1302
    register Py_ssize_t l = PyTuple_GET_SIZE(args);
 
1303
    if (l < min) {
 
1304
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
 
1305
                   name, (min == max ? "" : "at least "), (int)min, (int)l);
 
1306
      return 0;
 
1307
    } else if (l > max) {
 
1308
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
 
1309
                   name, (min == max ? "" : "at most "), (int)max, (int)l);
 
1310
      return 0;
 
1311
    } else {
 
1312
      register int i;
 
1313
      for (i = 0; i < l; ++i) {
 
1314
        objs[i] = PyTuple_GET_ITEM(args, i);
 
1315
      }
 
1316
      for (; l < max; ++l) {
 
1317
        objs[l] = 0;
 
1318
      }
 
1319
      return i + 1;
 
1320
    }    
 
1321
  }
 
1322
}
 
1323
 
 
1324
/* A functor is a function object with one single object argument */
 
1325
#if PY_VERSION_HEX >= 0x02020000
 
1326
#define SWIG_Python_CallFunctor(functor, obj)           PyObject_CallFunctionObjArgs(functor, obj, NULL);
 
1327
#else
 
1328
#define SWIG_Python_CallFunctor(functor, obj)           PyObject_CallFunction(functor, "O", obj);
 
1329
#endif
 
1330
 
 
1331
/*
 
1332
  Helper for static pointer initialization for both C and C++ code, for example
 
1333
  static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
 
1334
*/
 
1335
#ifdef __cplusplus
 
1336
#define SWIG_STATIC_POINTER(var)  var
 
1337
#else
 
1338
#define SWIG_STATIC_POINTER(var)  var = 0; if (!var) var
 
1339
#endif
 
1340
 
 
1341
/* -----------------------------------------------------------------------------
 
1342
 * Pointer declarations
 
1343
 * ----------------------------------------------------------------------------- */
 
1344
 
 
1345
/* Flags for new pointer objects */
 
1346
#define SWIG_POINTER_NOSHADOW       (SWIG_POINTER_OWN      << 1)
 
1347
#define SWIG_POINTER_NEW            (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
 
1348
 
 
1349
#define SWIG_POINTER_IMPLICIT_CONV  (SWIG_POINTER_DISOWN   << 1)
 
1350
 
 
1351
#define SWIG_BUILTIN_TP_INIT        (SWIG_POINTER_OWN << 2)
 
1352
#define SWIG_BUILTIN_INIT           (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
 
1353
 
 
1354
#ifdef __cplusplus
 
1355
extern "C" {
 
1356
#endif
 
1357
 
 
1358
/*  How to access Py_None */
 
1359
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 
1360
#  ifndef SWIG_PYTHON_NO_BUILD_NONE
 
1361
#    ifndef SWIG_PYTHON_BUILD_NONE
 
1362
#      define SWIG_PYTHON_BUILD_NONE
 
1363
#    endif
 
1364
#  endif
 
1365
#endif
 
1366
 
 
1367
#ifdef SWIG_PYTHON_BUILD_NONE
 
1368
#  ifdef Py_None
 
1369
#   undef Py_None
 
1370
#   define Py_None SWIG_Py_None()
 
1371
#  endif
 
1372
SWIGRUNTIMEINLINE PyObject * 
 
1373
_SWIG_Py_None(void)
 
1374
{
 
1375
  PyObject *none = Py_BuildValue((char*)"");
 
1376
  Py_DECREF(none);
 
1377
  return none;
 
1378
}
 
1379
SWIGRUNTIME PyObject * 
 
1380
SWIG_Py_None(void)
 
1381
{
 
1382
  static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
 
1383
  return none;
 
1384
}
 
1385
#endif
 
1386
 
 
1387
/* The python void return value */
 
1388
 
 
1389
SWIGRUNTIMEINLINE PyObject * 
 
1390
SWIG_Py_Void(void)
 
1391
{
 
1392
  PyObject *none = Py_None;
 
1393
  Py_INCREF(none);
 
1394
  return none;
 
1395
}
 
1396
 
 
1397
/* SwigPyClientData */
 
1398
 
 
1399
typedef struct {
 
1400
  PyObject *klass;
 
1401
  PyObject *newraw;
 
1402
  PyObject *newargs;
 
1403
  PyObject *destroy;
 
1404
  int delargs;
 
1405
  int implicitconv;
 
1406
  PyTypeObject *pytype;
 
1407
} SwigPyClientData;
 
1408
 
 
1409
SWIGRUNTIMEINLINE int 
 
1410
SWIG_Python_CheckImplicit(swig_type_info *ty)
 
1411
{
 
1412
  SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
 
1413
  return data ? data->implicitconv : 0;
 
1414
}
 
1415
 
 
1416
SWIGRUNTIMEINLINE PyObject *
 
1417
SWIG_Python_ExceptionType(swig_type_info *desc) {
 
1418
  SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
 
1419
  PyObject *klass = data ? data->klass : 0;
 
1420
  return (klass ? klass : PyExc_RuntimeError);
 
1421
}
 
1422
 
 
1423
 
 
1424
SWIGRUNTIME SwigPyClientData * 
 
1425
SwigPyClientData_New(PyObject* obj)
 
1426
{
 
1427
  if (!obj) {
 
1428
    return 0;
 
1429
  } else {
 
1430
    SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
 
1431
    /* the klass element */
 
1432
    data->klass = obj;
 
1433
    Py_INCREF(data->klass);
 
1434
    /* the newraw method and newargs arguments used to create a new raw instance */
 
1435
    if (PyClass_Check(obj)) {
 
1436
      data->newraw = 0;
 
1437
      data->newargs = obj;
 
1438
      Py_INCREF(obj);
 
1439
    } else {
 
1440
#if (PY_VERSION_HEX < 0x02020000)
 
1441
      data->newraw = 0;
 
1442
#else
 
1443
      data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
 
1444
#endif
 
1445
      if (data->newraw) {
 
1446
        Py_INCREF(data->newraw);
 
1447
        data->newargs = PyTuple_New(1);
 
1448
        PyTuple_SetItem(data->newargs, 0, obj);
 
1449
      } else {
 
1450
        data->newargs = obj;
 
1451
      }
 
1452
      Py_INCREF(data->newargs);
 
1453
    }
 
1454
    /* the destroy method, aka as the C++ delete method */
 
1455
    data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
 
1456
    if (PyErr_Occurred()) {
 
1457
      PyErr_Clear();
 
1458
      data->destroy = 0;
 
1459
    }
 
1460
    if (data->destroy) {
 
1461
      int flags;
 
1462
      Py_INCREF(data->destroy);
 
1463
      flags = PyCFunction_GET_FLAGS(data->destroy);
 
1464
#ifdef METH_O
 
1465
      data->delargs = !(flags & (METH_O));
 
1466
#else
 
1467
      data->delargs = 0;
 
1468
#endif
 
1469
    } else {
 
1470
      data->delargs = 0;
 
1471
    }
 
1472
    data->implicitconv = 0;
 
1473
    data->pytype = 0;
 
1474
    return data;
 
1475
  }
 
1476
}
 
1477
 
 
1478
SWIGRUNTIME void 
 
1479
SwigPyClientData_Del(SwigPyClientData *data) {
 
1480
  Py_XDECREF(data->newraw);
 
1481
  Py_XDECREF(data->newargs);
 
1482
  Py_XDECREF(data->destroy);
 
1483
}
 
1484
 
 
1485
/* =============== SwigPyObject =====================*/
 
1486
 
 
1487
typedef struct {
 
1488
  PyObject_HEAD
 
1489
  void *ptr;
 
1490
  swig_type_info *ty;
 
1491
  int own;
 
1492
  PyObject *next;
 
1493
#ifdef SWIGPYTHON_BUILTIN
 
1494
  PyObject *dict;
 
1495
#endif
 
1496
} SwigPyObject;
 
1497
 
 
1498
SWIGRUNTIME PyObject *
 
1499
SwigPyObject_long(SwigPyObject *v)
 
1500
{
 
1501
  return PyLong_FromVoidPtr(v->ptr);
 
1502
}
 
1503
 
 
1504
SWIGRUNTIME PyObject *
 
1505
SwigPyObject_format(const char* fmt, SwigPyObject *v)
 
1506
{
 
1507
  PyObject *res = NULL;
 
1508
  PyObject *args = PyTuple_New(1);
 
1509
  if (args) {
 
1510
    if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
 
1511
      PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
 
1512
      if (ofmt) {
 
1513
#if PY_VERSION_HEX >= 0x03000000
 
1514
        res = PyUnicode_Format(ofmt,args);
 
1515
#else
 
1516
        res = PyString_Format(ofmt,args);
 
1517
#endif
 
1518
        Py_DECREF(ofmt);
 
1519
      }
 
1520
      Py_DECREF(args);
 
1521
    }
 
1522
  }
 
1523
  return res;
 
1524
}
 
1525
 
 
1526
SWIGRUNTIME PyObject *
 
1527
SwigPyObject_oct(SwigPyObject *v)
 
1528
{
 
1529
  return SwigPyObject_format("%o",v);
 
1530
}
 
1531
 
 
1532
SWIGRUNTIME PyObject *
 
1533
SwigPyObject_hex(SwigPyObject *v)
 
1534
{
 
1535
  return SwigPyObject_format("%x",v);
 
1536
}
 
1537
 
 
1538
SWIGRUNTIME PyObject *
 
1539
#ifdef METH_NOARGS
 
1540
SwigPyObject_repr(SwigPyObject *v)
 
1541
#else
 
1542
SwigPyObject_repr(SwigPyObject *v, PyObject *args)
 
1543
#endif
 
1544
{
 
1545
  const char *name = SWIG_TypePrettyName(v->ty);
 
1546
  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
 
1547
  if (v->next) {
 
1548
# ifdef METH_NOARGS
 
1549
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
 
1550
# else
 
1551
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
 
1552
# endif
 
1553
# if PY_VERSION_HEX >= 0x03000000
 
1554
    PyObject *joined = PyUnicode_Concat(repr, nrep);
 
1555
    Py_DecRef(repr);
 
1556
    Py_DecRef(nrep);
 
1557
    repr = joined;
 
1558
# else
 
1559
    PyString_ConcatAndDel(&repr,nrep);
 
1560
# endif
 
1561
  }
 
1562
  return repr;  
 
1563
}
 
1564
 
 
1565
SWIGRUNTIME int
 
1566
SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 
1567
{
 
1568
  char *str;
 
1569
#ifdef METH_NOARGS
 
1570
  PyObject *repr = SwigPyObject_repr(v);
 
1571
#else
 
1572
  PyObject *repr = SwigPyObject_repr(v, NULL);
 
1573
#endif
 
1574
  if (repr) {
 
1575
    str = SWIG_Python_str_AsChar(repr); 
 
1576
    fputs(str, fp);
 
1577
    SWIG_Python_str_DelForPy3(str);
 
1578
    Py_DECREF(repr);
 
1579
    return 0; 
 
1580
  } else {
 
1581
    return 1; 
 
1582
  }
 
1583
}
 
1584
 
 
1585
SWIGRUNTIME PyObject *
 
1586
SwigPyObject_str(SwigPyObject *v)
 
1587
{
 
1588
  char result[SWIG_BUFFER_SIZE];
 
1589
  return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
 
1590
    SWIG_Python_str_FromChar(result) : 0;
 
1591
}
 
1592
 
 
1593
SWIGRUNTIME int
 
1594
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
 
1595
{
 
1596
  void *i = v->ptr;
 
1597
  void *j = w->ptr;
 
1598
  return (i < j) ? -1 : ((i > j) ? 1 : 0);
 
1599
}
 
1600
 
 
1601
/* Added for Python 3.x, would it also be useful for Python 2.x? */
 
1602
SWIGRUNTIME PyObject*
 
1603
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
 
1604
{
 
1605
  PyObject* res;
 
1606
  if( op != Py_EQ && op != Py_NE ) {
 
1607
    Py_INCREF(Py_NotImplemented);
 
1608
    return Py_NotImplemented;
 
1609
  }
 
1610
  res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
 
1611
  return res;  
 
1612
}
 
1613
 
 
1614
 
 
1615
SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
 
1616
 
 
1617
#ifdef SWIGPYTHON_BUILTIN
 
1618
static swig_type_info *SwigPyObject_stype = 0;
 
1619
SWIGRUNTIME PyTypeObject*
 
1620
SwigPyObject_type(void) {
 
1621
    SwigPyClientData *cd;
 
1622
    assert(SwigPyObject_stype);
 
1623
    cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
 
1624
    assert(cd);
 
1625
    assert(cd->pytype);
 
1626
    return cd->pytype;
 
1627
}
 
1628
#else
 
1629
SWIGRUNTIME PyTypeObject*
 
1630
SwigPyObject_type(void) {
 
1631
  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
 
1632
  return type;
 
1633
}
 
1634
#endif
 
1635
 
 
1636
SWIGRUNTIMEINLINE int
 
1637
SwigPyObject_Check(PyObject *op) {
 
1638
#ifdef SWIGPYTHON_BUILTIN
 
1639
  PyTypeObject *target_tp = SwigPyObject_type();
 
1640
  if (PyType_IsSubtype(op->ob_type, target_tp))
 
1641
    return 1;
 
1642
  return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
 
1643
#else
 
1644
  return (Py_TYPE(op) == SwigPyObject_type())
 
1645
    || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
 
1646
#endif
 
1647
}
 
1648
 
 
1649
SWIGRUNTIME PyObject *
 
1650
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
 
1651
 
 
1652
SWIGRUNTIME void
 
1653
SwigPyObject_dealloc(PyObject *v)
 
1654
{
 
1655
  SwigPyObject *sobj = (SwigPyObject *) v;
 
1656
  PyObject *next = sobj->next;
 
1657
  if (sobj->own == SWIG_POINTER_OWN) {
 
1658
    swig_type_info *ty = sobj->ty;
 
1659
    SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
 
1660
    PyObject *destroy = data ? data->destroy : 0;
 
1661
    if (destroy) {
 
1662
      /* destroy is always a VARARGS method */
 
1663
      PyObject *res;
 
1664
      if (data->delargs) {
 
1665
        /* we need to create a temporary object to carry the destroy operation */
 
1666
        PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
 
1667
        res = SWIG_Python_CallFunctor(destroy, tmp);
 
1668
        Py_DECREF(tmp);
 
1669
      } else {
 
1670
        PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
 
1671
        PyObject *mself = PyCFunction_GET_SELF(destroy);
 
1672
        res = ((*meth)(mself, v));
 
1673
      }
 
1674
      Py_XDECREF(res);
 
1675
    } 
 
1676
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
 
1677
    else {
 
1678
      const char *name = SWIG_TypePrettyName(ty);
 
1679
      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
 
1680
    }
 
1681
#endif
 
1682
  } 
 
1683
  Py_XDECREF(next);
 
1684
  PyObject_DEL(v);
 
1685
}
 
1686
 
 
1687
SWIGRUNTIME PyObject* 
 
1688
SwigPyObject_append(PyObject* v, PyObject* next)
 
1689
{
 
1690
  SwigPyObject *sobj = (SwigPyObject *) v;
 
1691
#ifndef METH_O
 
1692
  PyObject *tmp = 0;
 
1693
  if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
 
1694
  next = tmp;
 
1695
#endif
 
1696
  if (!SwigPyObject_Check(next)) {
 
1697
    return NULL;
 
1698
  }
 
1699
  sobj->next = next;
 
1700
  Py_INCREF(next);
 
1701
  return SWIG_Py_Void();
 
1702
}
 
1703
 
 
1704
SWIGRUNTIME PyObject* 
 
1705
#ifdef METH_NOARGS
 
1706
SwigPyObject_next(PyObject* v)
 
1707
#else
 
1708
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 
1709
#endif
 
1710
{
 
1711
  SwigPyObject *sobj = (SwigPyObject *) v;
 
1712
  if (sobj->next) {    
 
1713
    Py_INCREF(sobj->next);
 
1714
    return sobj->next;
 
1715
  } else {
 
1716
    return SWIG_Py_Void();
 
1717
  }
 
1718
}
 
1719
 
 
1720
SWIGINTERN PyObject*
 
1721
#ifdef METH_NOARGS
 
1722
SwigPyObject_disown(PyObject *v)
 
1723
#else
 
1724
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 
1725
#endif
 
1726
{
 
1727
  SwigPyObject *sobj = (SwigPyObject *)v;
 
1728
  sobj->own = 0;
 
1729
  return SWIG_Py_Void();
 
1730
}
 
1731
 
 
1732
SWIGINTERN PyObject*
 
1733
#ifdef METH_NOARGS
 
1734
SwigPyObject_acquire(PyObject *v)
 
1735
#else
 
1736
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 
1737
#endif
 
1738
{
 
1739
  SwigPyObject *sobj = (SwigPyObject *)v;
 
1740
  sobj->own = SWIG_POINTER_OWN;
 
1741
  return SWIG_Py_Void();
 
1742
}
 
1743
 
 
1744
SWIGINTERN PyObject*
 
1745
SwigPyObject_own(PyObject *v, PyObject *args)
 
1746
{
 
1747
  PyObject *val = 0;
 
1748
#if (PY_VERSION_HEX < 0x02020000)
 
1749
  if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
 
1750
#elif (PY_VERSION_HEX < 0x02050000)
 
1751
  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
 
1752
#else
 
1753
  if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) 
 
1754
#endif
 
1755
    {
 
1756
      return NULL;
 
1757
    } 
 
1758
  else
 
1759
    {
 
1760
      SwigPyObject *sobj = (SwigPyObject *)v;
 
1761
      PyObject *obj = PyBool_FromLong(sobj->own);
 
1762
      if (val) {
 
1763
#ifdef METH_NOARGS
 
1764
        if (PyObject_IsTrue(val)) {
 
1765
          SwigPyObject_acquire(v);
 
1766
        } else {
 
1767
          SwigPyObject_disown(v);
 
1768
        }
 
1769
#else
 
1770
        if (PyObject_IsTrue(val)) {
 
1771
          SwigPyObject_acquire(v,args);
 
1772
        } else {
 
1773
          SwigPyObject_disown(v,args);
 
1774
        }
 
1775
#endif
 
1776
      } 
 
1777
      return obj;
 
1778
    }
 
1779
}
 
1780
 
 
1781
#ifdef METH_O
 
1782
static PyMethodDef
 
1783
swigobject_methods[] = {
 
1784
  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
 
1785
  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
 
1786
  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
 
1787
  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_O,       (char *)"appends another 'this' object"},
 
1788
  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
 
1789
  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
 
1790
  {0, 0, 0, 0}  
 
1791
};
 
1792
#else
 
1793
static PyMethodDef
 
1794
swigobject_methods[] = {
 
1795
  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
 
1796
  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
 
1797
  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
 
1798
  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
 
1799
  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
 
1800
  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
 
1801
  {0, 0, 0, 0}  
 
1802
};
 
1803
#endif
 
1804
 
 
1805
#if PY_VERSION_HEX < 0x02020000
 
1806
SWIGINTERN PyObject *
 
1807
SwigPyObject_getattr(SwigPyObject *sobj,char *name)
 
1808
{
 
1809
  return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
 
1810
}
 
1811
#endif
 
1812
 
 
1813
SWIGRUNTIME PyTypeObject*
 
1814
SwigPyObject_TypeOnce(void) {
 
1815
  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
 
1816
 
 
1817
  static PyNumberMethods SwigPyObject_as_number = {
 
1818
    (binaryfunc)0, /*nb_add*/
 
1819
    (binaryfunc)0, /*nb_subtract*/
 
1820
    (binaryfunc)0, /*nb_multiply*/
 
1821
    /* nb_divide removed in Python 3 */
 
1822
#if PY_VERSION_HEX < 0x03000000
 
1823
    (binaryfunc)0, /*nb_divide*/
 
1824
#endif
 
1825
    (binaryfunc)0, /*nb_remainder*/
 
1826
    (binaryfunc)0, /*nb_divmod*/
 
1827
    (ternaryfunc)0,/*nb_power*/
 
1828
    (unaryfunc)0,  /*nb_negative*/
 
1829
    (unaryfunc)0,  /*nb_positive*/
 
1830
    (unaryfunc)0,  /*nb_absolute*/
 
1831
    (inquiry)0,    /*nb_nonzero*/
 
1832
    0,             /*nb_invert*/
 
1833
    0,             /*nb_lshift*/
 
1834
    0,             /*nb_rshift*/
 
1835
    0,             /*nb_and*/
 
1836
    0,             /*nb_xor*/
 
1837
    0,             /*nb_or*/
 
1838
#if PY_VERSION_HEX < 0x03000000
 
1839
    0,   /*nb_coerce*/
 
1840
#endif
 
1841
    (unaryfunc)SwigPyObject_long, /*nb_int*/
 
1842
#if PY_VERSION_HEX < 0x03000000
 
1843
    (unaryfunc)SwigPyObject_long, /*nb_long*/
 
1844
#else
 
1845
    0, /*nb_reserved*/
 
1846
#endif
 
1847
    (unaryfunc)0,                 /*nb_float*/
 
1848
#if PY_VERSION_HEX < 0x03000000
 
1849
    (unaryfunc)SwigPyObject_oct,  /*nb_oct*/
 
1850
    (unaryfunc)SwigPyObject_hex,  /*nb_hex*/
 
1851
#endif
 
1852
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
 
1853
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
 
1854
#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
 
1855
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
 
1856
#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
 
1857
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
 
1858
#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
 
1859
    0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
 
1860
#endif
 
1861
  };
 
1862
 
 
1863
  static PyTypeObject swigpyobject_type;
 
1864
  static int type_init = 0;
 
1865
  if (!type_init) {
 
1866
    const PyTypeObject tmp = {
 
1867
      /* PyObject header changed in Python 3 */
 
1868
#if PY_VERSION_HEX >= 0x03000000
 
1869
      PyVarObject_HEAD_INIT(NULL, 0)
 
1870
#else
 
1871
      PyObject_HEAD_INIT(NULL)
 
1872
      0,                                    /* ob_size */
 
1873
#endif
 
1874
      (char *)"SwigPyObject",               /* tp_name */
 
1875
      sizeof(SwigPyObject),                 /* tp_basicsize */
 
1876
      0,                                    /* tp_itemsize */
 
1877
      (destructor)SwigPyObject_dealloc,     /* tp_dealloc */
 
1878
      (printfunc)SwigPyObject_print,        /* tp_print */
 
1879
#if PY_VERSION_HEX < 0x02020000
 
1880
      (getattrfunc)SwigPyObject_getattr,    /* tp_getattr */
 
1881
#else
 
1882
      (getattrfunc)0,                       /* tp_getattr */
 
1883
#endif
 
1884
      (setattrfunc)0,                       /* tp_setattr */
 
1885
#if PY_VERSION_HEX >= 0x03000000
 
1886
    0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
 
1887
#else
 
1888
      (cmpfunc)SwigPyObject_compare,        /* tp_compare */
 
1889
#endif
 
1890
      (reprfunc)SwigPyObject_repr,          /* tp_repr */
 
1891
      &SwigPyObject_as_number,              /* tp_as_number */
 
1892
      0,                                    /* tp_as_sequence */
 
1893
      0,                                    /* tp_as_mapping */
 
1894
      (hashfunc)0,                          /* tp_hash */
 
1895
      (ternaryfunc)0,                       /* tp_call */
 
1896
      (reprfunc)SwigPyObject_str,           /* tp_str */
 
1897
      PyObject_GenericGetAttr,              /* tp_getattro */
 
1898
      0,                                    /* tp_setattro */
 
1899
      0,                                    /* tp_as_buffer */
 
1900
      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
 
1901
      swigobject_doc,                       /* tp_doc */
 
1902
      0,                                    /* tp_traverse */
 
1903
      0,                                    /* tp_clear */
 
1904
      (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
 
1905
      0,                                    /* tp_weaklistoffset */
 
1906
#if PY_VERSION_HEX >= 0x02020000
 
1907
      0,                                    /* tp_iter */
 
1908
      0,                                    /* tp_iternext */
 
1909
      swigobject_methods,                   /* tp_methods */
 
1910
      0,                                    /* tp_members */
 
1911
      0,                                    /* tp_getset */
 
1912
      0,                                    /* tp_base */
 
1913
      0,                                    /* tp_dict */
 
1914
      0,                                    /* tp_descr_get */
 
1915
      0,                                    /* tp_descr_set */
 
1916
      0,                                    /* tp_dictoffset */
 
1917
      0,                                    /* tp_init */
 
1918
      0,                                    /* tp_alloc */
 
1919
      0,                                    /* tp_new */
 
1920
      0,                                    /* tp_free */
 
1921
      0,                                    /* tp_is_gc */
 
1922
      0,                                    /* tp_bases */
 
1923
      0,                                    /* tp_mro */
 
1924
      0,                                    /* tp_cache */
 
1925
      0,                                    /* tp_subclasses */
 
1926
      0,                                    /* tp_weaklist */
 
1927
#endif
 
1928
#if PY_VERSION_HEX >= 0x02030000
 
1929
      0,                                    /* tp_del */
 
1930
#endif
 
1931
#if PY_VERSION_HEX >= 0x02060000
 
1932
      0,                                    /* tp_version */
 
1933
#endif
 
1934
#ifdef COUNT_ALLOCS
 
1935
      0,0,0,0                               /* tp_alloc -> tp_next */
 
1936
#endif
 
1937
    };
 
1938
    swigpyobject_type = tmp;
 
1939
    type_init = 1;
 
1940
#if PY_VERSION_HEX < 0x02020000
 
1941
    swigpyobject_type.ob_type = &PyType_Type;
 
1942
#else
 
1943
    if (PyType_Ready(&swigpyobject_type) < 0)
 
1944
      return NULL;
 
1945
#endif
 
1946
  }
 
1947
  return &swigpyobject_type;
 
1948
}
 
1949
 
 
1950
SWIGRUNTIME PyObject *
 
1951
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
 
1952
{
 
1953
  SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
 
1954
  if (sobj) {
 
1955
    sobj->ptr  = ptr;
 
1956
    sobj->ty   = ty;
 
1957
    sobj->own  = own;
 
1958
    sobj->next = 0;
 
1959
  }
 
1960
  return (PyObject *)sobj;
 
1961
}
 
1962
 
 
1963
/* -----------------------------------------------------------------------------
 
1964
 * Implements a simple Swig Packed type, and use it instead of string
 
1965
 * ----------------------------------------------------------------------------- */
 
1966
 
 
1967
typedef struct {
 
1968
  PyObject_HEAD
 
1969
  void *pack;
 
1970
  swig_type_info *ty;
 
1971
  size_t size;
 
1972
} SwigPyPacked;
 
1973
 
 
1974
SWIGRUNTIME int
 
1975
SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 
1976
{
 
1977
  char result[SWIG_BUFFER_SIZE];
 
1978
  fputs("<Swig Packed ", fp); 
 
1979
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
 
1980
    fputs("at ", fp); 
 
1981
    fputs(result, fp); 
 
1982
  }
 
1983
  fputs(v->ty->name,fp); 
 
1984
  fputs(">", fp);
 
1985
  return 0; 
 
1986
}
 
1987
  
 
1988
SWIGRUNTIME PyObject *
 
1989
SwigPyPacked_repr(SwigPyPacked *v)
 
1990
{
 
1991
  char result[SWIG_BUFFER_SIZE];
 
1992
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
 
1993
    return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
 
1994
  } else {
 
1995
    return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
 
1996
  }  
 
1997
}
 
1998
 
 
1999
SWIGRUNTIME PyObject *
 
2000
SwigPyPacked_str(SwigPyPacked *v)
 
2001
{
 
2002
  char result[SWIG_BUFFER_SIZE];
 
2003
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
 
2004
    return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
 
2005
  } else {
 
2006
    return SWIG_Python_str_FromChar(v->ty->name);
 
2007
  }  
 
2008
}
 
2009
 
 
2010
SWIGRUNTIME int
 
2011
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
 
2012
{
 
2013
  size_t i = v->size;
 
2014
  size_t j = w->size;
 
2015
  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
 
2016
  return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
 
2017
}
 
2018
 
 
2019
SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
 
2020
 
 
2021
SWIGRUNTIME PyTypeObject*
 
2022
SwigPyPacked_type(void) {
 
2023
  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
 
2024
  return type;
 
2025
}
 
2026
 
 
2027
SWIGRUNTIMEINLINE int
 
2028
SwigPyPacked_Check(PyObject *op) {
 
2029
  return ((op)->ob_type == SwigPyPacked_TypeOnce()) 
 
2030
    || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
 
2031
}
 
2032
 
 
2033
SWIGRUNTIME void
 
2034
SwigPyPacked_dealloc(PyObject *v)
 
2035
{
 
2036
  if (SwigPyPacked_Check(v)) {
 
2037
    SwigPyPacked *sobj = (SwigPyPacked *) v;
 
2038
    free(sobj->pack);
 
2039
  }
 
2040
  PyObject_DEL(v);
 
2041
}
 
2042
 
 
2043
SWIGRUNTIME PyTypeObject*
 
2044
SwigPyPacked_TypeOnce(void) {
 
2045
  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
 
2046
  static PyTypeObject swigpypacked_type;
 
2047
  static int type_init = 0;
 
2048
  if (!type_init) {
 
2049
    const PyTypeObject tmp = {
 
2050
      /* PyObject header changed in Python 3 */
 
2051
#if PY_VERSION_HEX>=0x03000000
 
2052
      PyVarObject_HEAD_INIT(NULL, 0)
 
2053
#else
 
2054
      PyObject_HEAD_INIT(NULL)
 
2055
      0,                                    /* ob_size */
 
2056
#endif
 
2057
      (char *)"SwigPyPacked",               /* tp_name */
 
2058
      sizeof(SwigPyPacked),                 /* tp_basicsize */
 
2059
      0,                                    /* tp_itemsize */
 
2060
      (destructor)SwigPyPacked_dealloc,     /* tp_dealloc */
 
2061
      (printfunc)SwigPyPacked_print,        /* tp_print */
 
2062
      (getattrfunc)0,                       /* tp_getattr */
 
2063
      (setattrfunc)0,                       /* tp_setattr */
 
2064
#if PY_VERSION_HEX>=0x03000000
 
2065
      0, /* tp_reserved in 3.0.1 */
 
2066
#else
 
2067
      (cmpfunc)SwigPyPacked_compare,        /* tp_compare */
 
2068
#endif
 
2069
      (reprfunc)SwigPyPacked_repr,          /* tp_repr */
 
2070
      0,                                    /* tp_as_number */
 
2071
      0,                                    /* tp_as_sequence */
 
2072
      0,                                    /* tp_as_mapping */
 
2073
      (hashfunc)0,                          /* tp_hash */
 
2074
      (ternaryfunc)0,                       /* tp_call */
 
2075
      (reprfunc)SwigPyPacked_str,           /* tp_str */
 
2076
      PyObject_GenericGetAttr,              /* tp_getattro */
 
2077
      0,                                    /* tp_setattro */
 
2078
      0,                                    /* tp_as_buffer */
 
2079
      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
 
2080
      swigpacked_doc,                       /* tp_doc */
 
2081
      0,                                    /* tp_traverse */
 
2082
      0,                                    /* tp_clear */
 
2083
      0,                                    /* tp_richcompare */
 
2084
      0,                                    /* tp_weaklistoffset */
 
2085
#if PY_VERSION_HEX >= 0x02020000
 
2086
      0,                                    /* tp_iter */
 
2087
      0,                                    /* tp_iternext */
 
2088
      0,                                    /* tp_methods */
 
2089
      0,                                    /* tp_members */
 
2090
      0,                                    /* tp_getset */
 
2091
      0,                                    /* tp_base */
 
2092
      0,                                    /* tp_dict */
 
2093
      0,                                    /* tp_descr_get */
 
2094
      0,                                    /* tp_descr_set */
 
2095
      0,                                    /* tp_dictoffset */
 
2096
      0,                                    /* tp_init */
 
2097
      0,                                    /* tp_alloc */
 
2098
      0,                                    /* tp_new */
 
2099
      0,                                    /* tp_free */
 
2100
      0,                                    /* tp_is_gc */
 
2101
      0,                                    /* tp_bases */
 
2102
      0,                                    /* tp_mro */
 
2103
      0,                                    /* tp_cache */
 
2104
      0,                                    /* tp_subclasses */
 
2105
      0,                                    /* tp_weaklist */
 
2106
#endif
 
2107
#if PY_VERSION_HEX >= 0x02030000
 
2108
      0,                                    /* tp_del */
 
2109
#endif
 
2110
#if PY_VERSION_HEX >= 0x02060000
 
2111
      0,                                    /* tp_version */
 
2112
#endif
 
2113
#ifdef COUNT_ALLOCS
 
2114
      0,0,0,0                               /* tp_alloc -> tp_next */
 
2115
#endif
 
2116
    };
 
2117
    swigpypacked_type = tmp;
 
2118
    type_init = 1;
 
2119
#if PY_VERSION_HEX < 0x02020000
 
2120
    swigpypacked_type.ob_type = &PyType_Type;
 
2121
#else
 
2122
    if (PyType_Ready(&swigpypacked_type) < 0)
 
2123
      return NULL;
 
2124
#endif
 
2125
  }
 
2126
  return &swigpypacked_type;
 
2127
}
 
2128
 
 
2129
SWIGRUNTIME PyObject *
 
2130
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
 
2131
{
 
2132
  SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
 
2133
  if (sobj) {
 
2134
    void *pack = malloc(size);
 
2135
    if (pack) {
 
2136
      memcpy(pack, ptr, size);
 
2137
      sobj->pack = pack;
 
2138
      sobj->ty   = ty;
 
2139
      sobj->size = size;
 
2140
    } else {
 
2141
      PyObject_DEL((PyObject *) sobj);
 
2142
      sobj = 0;
 
2143
    }
 
2144
  }
 
2145
  return (PyObject *) sobj;
 
2146
}
 
2147
 
 
2148
SWIGRUNTIME swig_type_info *
 
2149
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
 
2150
{
 
2151
  if (SwigPyPacked_Check(obj)) {
 
2152
    SwigPyPacked *sobj = (SwigPyPacked *)obj;
 
2153
    if (sobj->size != size) return 0;
 
2154
    memcpy(ptr, sobj->pack, size);
 
2155
    return sobj->ty;
 
2156
  } else {
 
2157
    return 0;
 
2158
  }
 
2159
}
 
2160
 
 
2161
/* -----------------------------------------------------------------------------
 
2162
 * pointers/data manipulation
 
2163
 * ----------------------------------------------------------------------------- */
 
2164
 
 
2165
SWIGRUNTIMEINLINE PyObject *
 
2166
_SWIG_This(void)
 
2167
{
 
2168
    return SWIG_Python_str_FromChar("this");
 
2169
}
 
2170
 
 
2171
static PyObject *swig_this = NULL;
 
2172
 
 
2173
SWIGRUNTIME PyObject *
 
2174
SWIG_This(void)
 
2175
{
 
2176
  if (swig_this == NULL)
 
2177
    swig_this = _SWIG_This();
 
2178
  return swig_this;
 
2179
}
 
2180
 
 
2181
/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
 
2182
 
 
2183
/* TODO: I don't know how to implement the fast getset in Python 3 right now */
 
2184
#if PY_VERSION_HEX>=0x03000000
 
2185
#define SWIG_PYTHON_SLOW_GETSET_THIS 
 
2186
#endif
 
2187
 
 
2188
SWIGRUNTIME SwigPyObject *
 
2189
SWIG_Python_GetSwigThis(PyObject *pyobj) 
 
2190
{
 
2191
  PyObject *obj;
 
2192
 
 
2193
  if (SwigPyObject_Check(pyobj))
 
2194
    return (SwigPyObject *) pyobj;
 
2195
 
 
2196
#ifdef SWIGPYTHON_BUILTIN
 
2197
  (void)obj;
 
2198
# ifdef PyWeakref_CheckProxy
 
2199
  if (PyWeakref_CheckProxy(pyobj)) {
 
2200
    pyobj = PyWeakref_GET_OBJECT(pyobj);
 
2201
    if (pyobj && SwigPyObject_Check(pyobj))
 
2202
      return (SwigPyObject*) pyobj;
 
2203
  }
 
2204
# endif
 
2205
  return NULL;
 
2206
#else
 
2207
 
 
2208
  obj = 0;
 
2209
 
 
2210
#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
 
2211
  if (PyInstance_Check(pyobj)) {
 
2212
    obj = _PyInstance_Lookup(pyobj, SWIG_This());      
 
2213
  } else {
 
2214
    PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
 
2215
    if (dictptr != NULL) {
 
2216
      PyObject *dict = *dictptr;
 
2217
      obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
 
2218
    } else {
 
2219
#ifdef PyWeakref_CheckProxy
 
2220
      if (PyWeakref_CheckProxy(pyobj)) {
 
2221
        PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
 
2222
        return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
 
2223
      }
 
2224
#endif
 
2225
      obj = PyObject_GetAttr(pyobj,SWIG_This());
 
2226
      if (obj) {
 
2227
        Py_DECREF(obj);
 
2228
      } else {
 
2229
        if (PyErr_Occurred()) PyErr_Clear();
 
2230
        return 0;
 
2231
      }
 
2232
    }
 
2233
  }
 
2234
#else
 
2235
  obj = PyObject_GetAttr(pyobj,SWIG_This());
 
2236
  if (obj) {
 
2237
    Py_DECREF(obj);
 
2238
  } else {
 
2239
    if (PyErr_Occurred()) PyErr_Clear();
 
2240
    return 0;
 
2241
  }
 
2242
#endif
 
2243
  if (obj && !SwigPyObject_Check(obj)) {
 
2244
    /* a PyObject is called 'this', try to get the 'real this'
 
2245
       SwigPyObject from it */ 
 
2246
    return SWIG_Python_GetSwigThis(obj);
 
2247
  }
 
2248
  return (SwigPyObject *)obj;
 
2249
#endif
 
2250
}
 
2251
 
 
2252
/* Acquire a pointer value */
 
2253
 
 
2254
SWIGRUNTIME int
 
2255
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
 
2256
  if (own == SWIG_POINTER_OWN) {
 
2257
    SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
 
2258
    if (sobj) {
 
2259
      int oldown = sobj->own;
 
2260
      sobj->own = own;
 
2261
      return oldown;
 
2262
    }
 
2263
  }
 
2264
  return 0;
 
2265
}
 
2266
 
 
2267
/* Convert a pointer value */
 
2268
 
 
2269
SWIGRUNTIME int
 
2270
SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
 
2271
  int res;
 
2272
  SwigPyObject *sobj;
 
2273
 
 
2274
  if (!obj)
 
2275
    return SWIG_ERROR;
 
2276
  if (obj == Py_None) {
 
2277
    if (ptr)
 
2278
      *ptr = 0;
 
2279
    return SWIG_OK;
 
2280
  }
 
2281
 
 
2282
  res = SWIG_ERROR;
 
2283
 
 
2284
  sobj = SWIG_Python_GetSwigThis(obj);
 
2285
  if (own)
 
2286
    *own = 0;
 
2287
  while (sobj) {
 
2288
    void *vptr = sobj->ptr;
 
2289
    if (ty) {
 
2290
      swig_type_info *to = sobj->ty;
 
2291
      if (to == ty) {
 
2292
        /* no type cast needed */
 
2293
        if (ptr) *ptr = vptr;
 
2294
        break;
 
2295
      } else {
 
2296
        swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
 
2297
        if (!tc) {
 
2298
          sobj = (SwigPyObject *)sobj->next;
 
2299
        } else {
 
2300
          if (ptr) {
 
2301
            int newmemory = 0;
 
2302
            *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
 
2303
            if (newmemory == SWIG_CAST_NEW_MEMORY) {
 
2304
              assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
 
2305
              if (own)
 
2306
                *own = *own | SWIG_CAST_NEW_MEMORY;
 
2307
            }
 
2308
          }
 
2309
          break;
 
2310
        }
 
2311
      }
 
2312
    } else {
 
2313
      if (ptr) *ptr = vptr;
 
2314
      break;
 
2315
    }
 
2316
  }
 
2317
  if (sobj) {
 
2318
    if (own)
 
2319
      *own = *own | sobj->own;
 
2320
    if (flags & SWIG_POINTER_DISOWN) {
 
2321
      sobj->own = 0;
 
2322
    }
 
2323
    res = SWIG_OK;
 
2324
  } else {
 
2325
    if (flags & SWIG_POINTER_IMPLICIT_CONV) {
 
2326
      SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
 
2327
      if (data && !data->implicitconv) {
 
2328
        PyObject *klass = data->klass;
 
2329
        if (klass) {
 
2330
          PyObject *impconv;
 
2331
          data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
 
2332
          impconv = SWIG_Python_CallFunctor(klass, obj);
 
2333
          data->implicitconv = 0;
 
2334
          if (PyErr_Occurred()) {
 
2335
            PyErr_Clear();
 
2336
            impconv = 0;
 
2337
          }
 
2338
          if (impconv) {
 
2339
            SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
 
2340
            if (iobj) {
 
2341
              void *vptr;
 
2342
              res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
 
2343
              if (SWIG_IsOK(res)) {
 
2344
                if (ptr) {
 
2345
                  *ptr = vptr;
 
2346
                  /* transfer the ownership to 'ptr' */
 
2347
                  iobj->own = 0;
 
2348
                  res = SWIG_AddCast(res);
 
2349
                  res = SWIG_AddNewMask(res);
 
2350
                } else {
 
2351
                  res = SWIG_AddCast(res);                  
 
2352
                }
 
2353
              }
 
2354
            }
 
2355
            Py_DECREF(impconv);
 
2356
          }
 
2357
        }
 
2358
      }
 
2359
    }
 
2360
  }
 
2361
  return res;
 
2362
}
 
2363
 
 
2364
/* Convert a function ptr value */
 
2365
 
 
2366
SWIGRUNTIME int
 
2367
SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
 
2368
  if (!PyCFunction_Check(obj)) {
 
2369
    return SWIG_ConvertPtr(obj, ptr, ty, 0);
 
2370
  } else {
 
2371
    void *vptr = 0;
 
2372
    
 
2373
    /* here we get the method pointer for callbacks */
 
2374
    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
 
2375
    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
 
2376
    if (desc)
 
2377
      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
 
2378
    if (!desc) 
 
2379
      return SWIG_ERROR;
 
2380
    if (ty) {
 
2381
      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
 
2382
      if (tc) {
 
2383
        int newmemory = 0;
 
2384
        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
 
2385
        assert(!newmemory); /* newmemory handling not yet implemented */
 
2386
      } else {
 
2387
        return SWIG_ERROR;
 
2388
      }
 
2389
    } else {
 
2390
      *ptr = vptr;
 
2391
    }
 
2392
    return SWIG_OK;
 
2393
  }
 
2394
}
 
2395
 
 
2396
/* Convert a packed value value */
 
2397
 
 
2398
SWIGRUNTIME int
 
2399
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
 
2400
  swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
 
2401
  if (!to) return SWIG_ERROR;
 
2402
  if (ty) {
 
2403
    if (to != ty) {
 
2404
      /* check type cast? */
 
2405
      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
 
2406
      if (!tc) return SWIG_ERROR;
 
2407
    }
 
2408
  }
 
2409
  return SWIG_OK;
 
2410
}  
 
2411
 
 
2412
/* -----------------------------------------------------------------------------
 
2413
 * Create a new pointer object
 
2414
 * ----------------------------------------------------------------------------- */
 
2415
 
 
2416
/*
 
2417
  Create a new instance object, without calling __init__, and set the
 
2418
  'this' attribute.
 
2419
*/
 
2420
 
 
2421
SWIGRUNTIME PyObject* 
 
2422
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
 
2423
{
 
2424
#if (PY_VERSION_HEX >= 0x02020000)
 
2425
  PyObject *inst = 0;
 
2426
  PyObject *newraw = data->newraw;
 
2427
  if (newraw) {
 
2428
    inst = PyObject_Call(newraw, data->newargs, NULL);
 
2429
    if (inst) {
 
2430
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
 
2431
      PyObject **dictptr = _PyObject_GetDictPtr(inst);
 
2432
      if (dictptr != NULL) {
 
2433
        PyObject *dict = *dictptr;
 
2434
        if (dict == NULL) {
 
2435
          dict = PyDict_New();
 
2436
          *dictptr = dict;
 
2437
          PyDict_SetItem(dict, SWIG_This(), swig_this);
 
2438
        }
 
2439
      }
 
2440
#else
 
2441
      PyObject *key = SWIG_This();
 
2442
      PyObject_SetAttr(inst, key, swig_this);
 
2443
#endif
 
2444
    }
 
2445
  } else {
 
2446
#if PY_VERSION_HEX >= 0x03000000
 
2447
    inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
 
2448
    if (inst) {
 
2449
      PyObject_SetAttr(inst, SWIG_This(), swig_this);
 
2450
      Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
 
2451
    }
 
2452
#else
 
2453
    PyObject *dict = PyDict_New();
 
2454
    if (dict) {
 
2455
      PyDict_SetItem(dict, SWIG_This(), swig_this);
 
2456
      inst = PyInstance_NewRaw(data->newargs, dict);
 
2457
      Py_DECREF(dict);
 
2458
    }
 
2459
#endif
 
2460
  }
 
2461
  return inst;
 
2462
#else
 
2463
#if (PY_VERSION_HEX >= 0x02010000)
 
2464
  PyObject *inst = 0;
 
2465
  PyObject *dict = PyDict_New();
 
2466
  if (dict) {
 
2467
    PyDict_SetItem(dict, SWIG_This(), swig_this);
 
2468
    inst = PyInstance_NewRaw(data->newargs, dict);
 
2469
    Py_DECREF(dict);
 
2470
  }
 
2471
  return (PyObject *) inst;
 
2472
#else
 
2473
  PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
 
2474
  if (inst == NULL) {
 
2475
    return NULL;
 
2476
  }
 
2477
  inst->in_class = (PyClassObject *)data->newargs;
 
2478
  Py_INCREF(inst->in_class);
 
2479
  inst->in_dict = PyDict_New();
 
2480
  if (inst->in_dict == NULL) {
 
2481
    Py_DECREF(inst);
 
2482
    return NULL;
 
2483
  }
 
2484
#ifdef Py_TPFLAGS_HAVE_WEAKREFS
 
2485
  inst->in_weakreflist = NULL;
 
2486
#endif
 
2487
#ifdef Py_TPFLAGS_GC
 
2488
  PyObject_GC_Init(inst);
 
2489
#endif
 
2490
  PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
 
2491
  return (PyObject *) inst;
 
2492
#endif
 
2493
#endif
 
2494
}
 
2495
 
 
2496
SWIGRUNTIME void
 
2497
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
 
2498
{
 
2499
 PyObject *dict;
 
2500
#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
 
2501
 PyObject **dictptr = _PyObject_GetDictPtr(inst);
 
2502
 if (dictptr != NULL) {
 
2503
   dict = *dictptr;
 
2504
   if (dict == NULL) {
 
2505
     dict = PyDict_New();
 
2506
     *dictptr = dict;
 
2507
   }
 
2508
   PyDict_SetItem(dict, SWIG_This(), swig_this);
 
2509
   return;
 
2510
 }
 
2511
#endif
 
2512
 dict = PyObject_GetAttrString(inst, (char*)"__dict__");
 
2513
 PyDict_SetItem(dict, SWIG_This(), swig_this);
 
2514
 Py_DECREF(dict);
 
2515
 
2516
 
 
2517
 
 
2518
SWIGINTERN PyObject *
 
2519
SWIG_Python_InitShadowInstance(PyObject *args) {
 
2520
  PyObject *obj[2];
 
2521
  if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
 
2522
    return NULL;
 
2523
  } else {
 
2524
    SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
 
2525
    if (sthis) {
 
2526
      SwigPyObject_append((PyObject*) sthis, obj[1]);
 
2527
    } else {
 
2528
      SWIG_Python_SetSwigThis(obj[0], obj[1]);
 
2529
    }
 
2530
    return SWIG_Py_Void();
 
2531
  }
 
2532
}
 
2533
 
 
2534
/* Create a new pointer object */
 
2535
 
 
2536
SWIGRUNTIME PyObject *
 
2537
SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
 
2538
  SwigPyClientData *clientdata;
 
2539
  PyObject * robj;
 
2540
  int own;
 
2541
 
 
2542
  if (!ptr)
 
2543
    return SWIG_Py_Void();
 
2544
 
 
2545
  clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
 
2546
  own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
 
2547
  if (clientdata && clientdata->pytype) {
 
2548
    SwigPyObject *newobj;
 
2549
    if (flags & SWIG_BUILTIN_TP_INIT) {
 
2550
      newobj = (SwigPyObject*) self;
 
2551
      if (newobj->ptr) {
 
2552
        PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
 
2553
        while (newobj->next)
 
2554
          newobj = (SwigPyObject *) newobj->next;
 
2555
        newobj->next = next_self;
 
2556
        newobj = (SwigPyObject *)next_self;
 
2557
      }
 
2558
    } else {
 
2559
      newobj = PyObject_New(SwigPyObject, clientdata->pytype);
 
2560
    }
 
2561
    if (newobj) {
 
2562
      newobj->ptr = ptr;
 
2563
      newobj->ty = type;
 
2564
      newobj->own = own;
 
2565
      newobj->next = 0;
 
2566
#ifdef SWIGPYTHON_BUILTIN
 
2567
      newobj->dict = 0;
 
2568
#endif
 
2569
      return (PyObject*) newobj;
 
2570
    }
 
2571
    return SWIG_Py_Void();
 
2572
  }
 
2573
 
 
2574
  assert(!(flags & SWIG_BUILTIN_TP_INIT));
 
2575
 
 
2576
  robj = SwigPyObject_New(ptr, type, own);
 
2577
  if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
 
2578
    PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
 
2579
    Py_DECREF(robj);
 
2580
    robj = inst;
 
2581
  }
 
2582
  return robj;
 
2583
}
 
2584
 
 
2585
/* Create a new packed object */
 
2586
 
 
2587
SWIGRUNTIMEINLINE PyObject *
 
2588
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
 
2589
  return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
 
2590
}
 
2591
 
 
2592
/* -----------------------------------------------------------------------------*
 
2593
 *  Get type list 
 
2594
 * -----------------------------------------------------------------------------*/
 
2595
 
 
2596
#ifdef SWIG_LINK_RUNTIME
 
2597
void *SWIG_ReturnGlobalTypeList(void *);
 
2598
#endif
 
2599
 
 
2600
SWIGRUNTIME swig_module_info *
 
2601
SWIG_Python_GetModule(void) {
 
2602
  static void *type_pointer = (void *)0;
 
2603
  /* first check if module already created */
 
2604
  if (!type_pointer) {
 
2605
#ifdef SWIG_LINK_RUNTIME
 
2606
    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
 
2607
#else
 
2608
# ifdef SWIGPY_USE_CAPSULE
 
2609
    type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
 
2610
# else
 
2611
    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
 
2612
                                    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
 
2613
# endif
 
2614
    if (PyErr_Occurred()) {
 
2615
      PyErr_Clear();
 
2616
      type_pointer = (void *)0;
 
2617
    }
 
2618
#endif
 
2619
  }
 
2620
  return (swig_module_info *) type_pointer;
 
2621
}
 
2622
 
 
2623
#if PY_MAJOR_VERSION < 2
 
2624
/* PyModule_AddObject function was introduced in Python 2.0.  The following function
 
2625
   is copied out of Python/modsupport.c in python version 2.3.4 */
 
2626
SWIGINTERN int
 
2627
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
 
2628
{
 
2629
  PyObject *dict;
 
2630
  if (!PyModule_Check(m)) {
 
2631
    PyErr_SetString(PyExc_TypeError,
 
2632
                    "PyModule_AddObject() needs module as first arg");
 
2633
    return SWIG_ERROR;
 
2634
  }
 
2635
  if (!o) {
 
2636
    PyErr_SetString(PyExc_TypeError,
 
2637
                    "PyModule_AddObject() needs non-NULL value");
 
2638
    return SWIG_ERROR;
 
2639
  }
 
2640
  
 
2641
  dict = PyModule_GetDict(m);
 
2642
  if (dict == NULL) {
 
2643
    /* Internal error -- modules must have a dict! */
 
2644
    PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
 
2645
                 PyModule_GetName(m));
 
2646
    return SWIG_ERROR;
 
2647
  }
 
2648
  if (PyDict_SetItemString(dict, name, o))
 
2649
    return SWIG_ERROR;
 
2650
  Py_DECREF(o);
 
2651
  return SWIG_OK;
 
2652
}
 
2653
#endif
 
2654
 
 
2655
SWIGRUNTIME void
 
2656
#ifdef SWIGPY_USE_CAPSULE
 
2657
SWIG_Python_DestroyModule(PyObject *obj)
 
2658
#else
 
2659
SWIG_Python_DestroyModule(void *vptr)
 
2660
#endif
 
2661
{
 
2662
#ifdef SWIGPY_USE_CAPSULE
 
2663
  swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
 
2664
#else
 
2665
  swig_module_info *swig_module = (swig_module_info *) vptr;
 
2666
#endif
 
2667
  swig_type_info **types = swig_module->types;
 
2668
  size_t i;
 
2669
  for (i =0; i < swig_module->size; ++i) {
 
2670
    swig_type_info *ty = types[i];
 
2671
    if (ty->owndata) {
 
2672
      SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
 
2673
      if (data) SwigPyClientData_Del(data);
 
2674
    }
 
2675
  }
 
2676
  Py_DECREF(SWIG_This());
 
2677
  swig_this = NULL;
 
2678
}
 
2679
 
 
2680
SWIGRUNTIME void
 
2681
SWIG_Python_SetModule(swig_module_info *swig_module) {
 
2682
#if PY_VERSION_HEX >= 0x03000000
 
2683
 /* Add a dummy module object into sys.modules */
 
2684
  PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
 
2685
#else
 
2686
  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
 
2687
  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
 
2688
#endif
 
2689
#ifdef SWIGPY_USE_CAPSULE
 
2690
  PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
 
2691
  if (pointer && module) {
 
2692
    PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
 
2693
  } else {
 
2694
    Py_XDECREF(pointer);
 
2695
  }
 
2696
#else
 
2697
  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
 
2698
  if (pointer && module) {
 
2699
    PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
 
2700
  } else {
 
2701
    Py_XDECREF(pointer);
 
2702
  }
 
2703
#endif
 
2704
}
 
2705
 
 
2706
/* The python cached type query */
 
2707
SWIGRUNTIME PyObject *
 
2708
SWIG_Python_TypeCache(void) {
 
2709
  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
 
2710
  return cache;
 
2711
}
 
2712
 
 
2713
SWIGRUNTIME swig_type_info *
 
2714
SWIG_Python_TypeQuery(const char *type)
 
2715
{
 
2716
  PyObject *cache = SWIG_Python_TypeCache();
 
2717
  PyObject *key = SWIG_Python_str_FromChar(type); 
 
2718
  PyObject *obj = PyDict_GetItem(cache, key);
 
2719
  swig_type_info *descriptor;
 
2720
  if (obj) {
 
2721
#ifdef SWIGPY_USE_CAPSULE
 
2722
    descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
 
2723
#else
 
2724
    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
 
2725
#endif
 
2726
  } else {
 
2727
    swig_module_info *swig_module = SWIG_Python_GetModule();
 
2728
    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
 
2729
    if (descriptor) {
 
2730
#ifdef SWIGPY_USE_CAPSULE
 
2731
      obj = PyCapsule_New((void*) descriptor, NULL, NULL);
 
2732
#else
 
2733
      obj = PyCObject_FromVoidPtr(descriptor, NULL);
 
2734
#endif
 
2735
      PyDict_SetItem(cache, key, obj);
 
2736
      Py_DECREF(obj);
 
2737
    }
 
2738
  }
 
2739
  Py_DECREF(key);
 
2740
  return descriptor;
 
2741
}
 
2742
 
 
2743
/* 
 
2744
   For backward compatibility only
 
2745
*/
 
2746
#define SWIG_POINTER_EXCEPTION  0
 
2747
#define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
 
2748
#define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)
 
2749
 
 
2750
SWIGRUNTIME int
 
2751
SWIG_Python_AddErrMesg(const char* mesg, int infront)
 
2752
{  
 
2753
  if (PyErr_Occurred()) {
 
2754
    PyObject *type = 0;
 
2755
    PyObject *value = 0;
 
2756
    PyObject *traceback = 0;
 
2757
    PyErr_Fetch(&type, &value, &traceback);
 
2758
    if (value) {
 
2759
      char *tmp;
 
2760
      PyObject *old_str = PyObject_Str(value);
 
2761
      Py_XINCREF(type);
 
2762
      PyErr_Clear();
 
2763
      if (infront) {
 
2764
        PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
 
2765
      } else {
 
2766
        PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
 
2767
      }
 
2768
      SWIG_Python_str_DelForPy3(tmp);
 
2769
      Py_DECREF(old_str);
 
2770
    }
 
2771
    return 1;
 
2772
  } else {
 
2773
    return 0;
 
2774
  }
 
2775
}
 
2776
  
 
2777
SWIGRUNTIME int
 
2778
SWIG_Python_ArgFail(int argnum)
 
2779
{
 
2780
  if (PyErr_Occurred()) {
 
2781
    /* add information about failing argument */
 
2782
    char mesg[256];
 
2783
    PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
 
2784
    return SWIG_Python_AddErrMesg(mesg, 1);
 
2785
  } else {
 
2786
    return 0;
 
2787
  }
 
2788
}
 
2789
 
 
2790
SWIGRUNTIMEINLINE const char *
 
2791
SwigPyObject_GetDesc(PyObject *self)
 
2792
{
 
2793
  SwigPyObject *v = (SwigPyObject *)self;
 
2794
  swig_type_info *ty = v ? v->ty : 0;
 
2795
  return ty ? ty->str : "";
 
2796
}
 
2797
 
 
2798
SWIGRUNTIME void
 
2799
SWIG_Python_TypeError(const char *type, PyObject *obj)
 
2800
{
 
2801
  if (type) {
 
2802
#if defined(SWIG_COBJECT_TYPES)
 
2803
    if (obj && SwigPyObject_Check(obj)) {
 
2804
      const char *otype = (const char *) SwigPyObject_GetDesc(obj);
 
2805
      if (otype) {
 
2806
        PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
 
2807
                     type, otype);
 
2808
        return;
 
2809
      }
 
2810
    } else 
 
2811
#endif      
 
2812
    {
 
2813
      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
 
2814
      if (otype) {
 
2815
        PyObject *str = PyObject_Str(obj);
 
2816
        const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
 
2817
        if (cstr) {
 
2818
          PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
 
2819
                       type, otype, cstr);
 
2820
          SWIG_Python_str_DelForPy3(cstr);
 
2821
        } else {
 
2822
          PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
 
2823
                       type, otype);
 
2824
        }
 
2825
        Py_XDECREF(str);
 
2826
        return;
 
2827
      }
 
2828
    }   
 
2829
    PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
 
2830
  } else {
 
2831
    PyErr_Format(PyExc_TypeError, "unexpected type is received");
 
2832
  }
 
2833
}
 
2834
 
 
2835
 
 
2836
/* Convert a pointer value, signal an exception on a type mismatch */
 
2837
SWIGRUNTIME void *
 
2838
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
 
2839
  void *result;
 
2840
  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
 
2841
    PyErr_Clear();
 
2842
#if SWIG_POINTER_EXCEPTION
 
2843
    if (flags) {
 
2844
      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
 
2845
      SWIG_Python_ArgFail(argnum);
 
2846
    }
 
2847
#endif
 
2848
  }
 
2849
  return result;
 
2850
}
 
2851
 
 
2852
#ifdef SWIGPYTHON_BUILTIN
 
2853
SWIGRUNTIME int
 
2854
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
 
2855
  PyTypeObject *tp = obj->ob_type;
 
2856
  PyObject *descr;
 
2857
  PyObject *encoded_name;
 
2858
  descrsetfunc f;
 
2859
  int res;
 
2860
 
 
2861
# ifdef Py_USING_UNICODE
 
2862
  if (PyString_Check(name)) {
 
2863
    name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
 
2864
    if (!name)
 
2865
      return -1;
 
2866
  } else if (!PyUnicode_Check(name))
 
2867
# else
 
2868
  if (!PyString_Check(name))
 
2869
# endif
 
2870
  {
 
2871
    PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
 
2872
    return -1;
 
2873
  } else {
 
2874
    Py_INCREF(name);
 
2875
  }
 
2876
 
 
2877
  if (!tp->tp_dict) {
 
2878
    if (PyType_Ready(tp) < 0)
 
2879
      goto done;
 
2880
  }
 
2881
 
 
2882
  res = -1;
 
2883
  descr = _PyType_Lookup(tp, name);
 
2884
  f = NULL;
 
2885
  if (descr != NULL)
 
2886
    f = descr->ob_type->tp_descr_set;
 
2887
  if (!f) {
 
2888
    if (PyString_Check(name)) {
 
2889
      encoded_name = name;
 
2890
      Py_INCREF(name);
 
2891
    } else {
 
2892
      encoded_name = PyUnicode_AsUTF8String(name);
 
2893
    }
 
2894
    PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
 
2895
    Py_DECREF(encoded_name);
 
2896
  } else {
 
2897
    res = f(descr, obj, value);
 
2898
  }
 
2899
  
 
2900
  done:
 
2901
  Py_DECREF(name);
 
2902
  return res;
 
2903
}
 
2904
#endif
 
2905
 
 
2906
 
 
2907
#ifdef __cplusplus
 
2908
}
 
2909
#endif
 
2910
/* -----------------------------------------------------------------------------*
 
2911
   Standard SWIG API for use inside user code.
 
2912
 
 
2913
   Don't include this file directly, run the command
 
2914
   swig -python -external-runtime
 
2915
   Also, read the Modules chapter of the SWIG Manual.
 
2916
 
 
2917
 * -----------------------------------------------------------------------------*/
 
2918
 
 
2919
#ifdef SWIG_MODULE_CLIENTDATA_TYPE
 
2920
 
 
2921
SWIGRUNTIMEINLINE swig_type_info *
 
2922
SWIG_TypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
 
2923
  swig_module_info *module = SWIG_GetModule(clientdata);
 
2924
  return SWIG_TypeQueryModule(module, module, name);
 
2925
}
 
2926
 
 
2927
SWIGRUNTIMEINLINE swig_type_info *
 
2928
SWIG_MangledTypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
 
2929
  swig_module_info *module = SWIG_GetModule(clientdata);
 
2930
  return SWIG_MangledTypeQueryModule(module, module, name);
 
2931
}
 
2932
 
 
2933
#else
 
2934
 
 
2935
SWIGRUNTIMEINLINE swig_type_info *
 
2936
SWIG_TypeQuery(const char *name) {
 
2937
  swig_module_info *module = SWIG_GetModule(NULL);
 
2938
  return SWIG_TypeQueryModule(module, module, name);
 
2939
}
 
2940
 
 
2941
SWIGRUNTIMEINLINE swig_type_info *
 
2942
SWIG_MangledTypeQuery(const char *name) {
 
2943
  swig_module_info *module = SWIG_GetModule(NULL);
 
2944
  return SWIG_MangledTypeQueryModule(module, module, name);
 
2945
}
 
2946
 
 
2947
#endif