Statistiques
| Révision :

root / Pi / C / examples / swig / hello_wrap.c @ 38

Historique | Voir | Annoter | Télécharger (109,13 ko)

1
/* ----------------------------------------------------------------------------
2
 * This file was automatically generated by SWIG (http://www.swig.org).
3
 * Version 2.0.7
4
 * 
5
 * This file is not intended to be easily readable and contains a number of 
6
 * coding conventions designed to improve portability and efficiency. Do not make
7
 * changes to this file unless you know what you are doing--modify the SWIG 
8
 * interface file instead. 
9
 * ----------------------------------------------------------------------------- */
10

    
11
#define SWIGPYTHON
12
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
13

    
14
/* -----------------------------------------------------------------------------
15
 *  This section contains generic SWIG labels for method/variable
16
 *  declarations/attributes, and other compiler dependent labels.
17
 * ----------------------------------------------------------------------------- */
18

    
19
/* template workaround for compilers that cannot correctly implement the C++ standard */
20
#ifndef SWIGTEMPLATEDISAMBIGUATOR
21
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
22
#  define SWIGTEMPLATEDISAMBIGUATOR template
23
# elif defined(__HP_aCC)
24
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
25
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
26
#  define SWIGTEMPLATEDISAMBIGUATOR template
27
# else
28
#  define SWIGTEMPLATEDISAMBIGUATOR
29
# endif
30
#endif
31

    
32
/* inline attribute */
33
#ifndef SWIGINLINE
34
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
35
#   define SWIGINLINE inline
36
# else
37
#   define SWIGINLINE
38
# endif
39
#endif
40

    
41
/* attribute recognised by some compilers to avoid 'unused' warnings */
42
#ifndef SWIGUNUSED
43
# if defined(__GNUC__)
44
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
45
#     define SWIGUNUSED __attribute__ ((__unused__)) 
46
#   else
47
#     define SWIGUNUSED
48
#   endif
49
# elif defined(__ICC)
50
#   define SWIGUNUSED __attribute__ ((__unused__)) 
51
# else
52
#   define SWIGUNUSED 
53
# endif
54
#endif
55

    
56
#ifndef SWIG_MSC_UNSUPPRESS_4505
57
# if defined(_MSC_VER)
58
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
59
# endif 
60
#endif
61

    
62
#ifndef SWIGUNUSEDPARM
63
# ifdef __cplusplus
64
#   define SWIGUNUSEDPARM(p)
65
# else
66
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
67
# endif
68
#endif
69

    
70
/* internal SWIG method */
71
#ifndef SWIGINTERN
72
# define SWIGINTERN static SWIGUNUSED
73
#endif
74

    
75
/* internal inline SWIG method */
76
#ifndef SWIGINTERNINLINE
77
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
78
#endif
79

    
80
/* exporting methods */
81
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
82
#  ifndef GCC_HASCLASSVISIBILITY
83
#    define GCC_HASCLASSVISIBILITY
84
#  endif
85
#endif
86

    
87
#ifndef SWIGEXPORT
88
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
89
#   if defined(STATIC_LINKED)
90
#     define SWIGEXPORT
91
#   else
92
#     define SWIGEXPORT __declspec(dllexport)
93
#   endif
94
# else
95
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
96
#     define SWIGEXPORT __attribute__ ((visibility("default")))
97
#   else
98
#     define SWIGEXPORT
99
#   endif
100
# endif
101
#endif
102

    
103
/* calling conventions for Windows */
104
#ifndef SWIGSTDCALL
105
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
106
#   define SWIGSTDCALL __stdcall
107
# else
108
#   define SWIGSTDCALL
109
# endif 
110
#endif
111

    
112
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
113
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
114
# define _CRT_SECURE_NO_DEPRECATE
115
#endif
116

    
117
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
118
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
119
# define _SCL_SECURE_NO_DEPRECATE
120
#endif
121

    
122

    
123

    
124
/* Python.h has to appear first */
125
#include <Python.h>
126

    
127
/* -----------------------------------------------------------------------------
128
 * swigrun.swg
129
 *
130
 * This file contains generic C API SWIG runtime support for pointer
131
 * type checking.
132
 * ----------------------------------------------------------------------------- */
133

    
134
/* This should only be incremented when either the layout of swig_type_info changes,
135
   or for whatever reason, the runtime changes incompatibly */
136
#define SWIG_RUNTIME_VERSION "4"
137

    
138
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
139
#ifdef SWIG_TYPE_TABLE
140
# define SWIG_QUOTE_STRING(x) #x
141
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
142
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
143
#else
144
# define SWIG_TYPE_TABLE_NAME
145
#endif
146

    
147
/*
148
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
149
  creating a static or dynamic library from the SWIG runtime code.
150
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
151
  
152
  But only do this if strictly necessary, ie, if you have problems
153
  with your compiler or suchlike.
154
*/
155

    
156
#ifndef SWIGRUNTIME
157
# define SWIGRUNTIME SWIGINTERN
158
#endif
159

    
160
#ifndef SWIGRUNTIMEINLINE
161
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
162
#endif
163

    
164
/*  Generic buffer size */
165
#ifndef SWIG_BUFFER_SIZE
166
# define SWIG_BUFFER_SIZE 1024
167
#endif
168

    
169
/* Flags for pointer conversions */
170
#define SWIG_POINTER_DISOWN        0x1
171
#define SWIG_CAST_NEW_MEMORY       0x2
172

    
173
/* Flags for new pointer objects */
174
#define SWIG_POINTER_OWN           0x1
175

    
176

    
177
/* 
178
   Flags/methods for returning states.
179
   
180
   The SWIG conversion methods, as ConvertPtr, return an integer 
181
   that tells if the conversion was successful or not. And if not,
182
   an error code can be returned (see swigerrors.swg for the codes).
183
   
184
   Use the following macros/flags to set or process the returning
185
   states.
186
   
187
   In old versions of SWIG, code such as the following was usually written:
188

189
     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
190
       // success code
191
     } else {
192
       //fail code
193
     }
194

195
   Now you can be more explicit:
196

197
    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
198
    if (SWIG_IsOK(res)) {
199
      // success code
200
    } else {
201
      // fail code
202
    }
203

204
   which is the same really, but now you can also do
205

206
    Type *ptr;
207
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
208
    if (SWIG_IsOK(res)) {
209
      // success code
210
      if (SWIG_IsNewObj(res) {
211
        ...
212
        delete *ptr;
213
      } else {
214
        ...
215
      }
216
    } else {
217
      // fail code
218
    }
219
    
220
   I.e., now SWIG_ConvertPtr can return new objects and you can
221
   identify the case and take care of the deallocation. Of course that
222
   also requires SWIG_ConvertPtr to return new result values, such as
223

224
      int SWIG_ConvertPtr(obj, ptr,...) {         
225
        if (<obj is ok>) {                               
226
          if (<need new object>) {                       
227
            *ptr = <ptr to new allocated object>; 
228
            return SWIG_NEWOBJ;                       
229
          } else {                                       
230
            *ptr = <ptr to old object>;               
231
            return SWIG_OLDOBJ;                       
232
          }                                        
233
        } else {                                       
234
          return SWIG_BADOBJ;                       
235
        }                                               
236
      }
237

238
   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
239
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
240
   SWIG errors code.
241

242
   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
243
   allows to return the 'cast rank', for example, if you have this
244

245
       int food(double)
246
       int fooi(int);
247

248
   and you call
249
 
250
      food(1)   // cast rank '1'  (1 -> 1.0)
251
      fooi(1)   // cast rank '0'
252

253
   just use the SWIG_AddCast()/SWIG_CheckState()
254
*/
255

    
256
#define SWIG_OK                    (0) 
257
#define SWIG_ERROR                 (-1)
258
#define SWIG_IsOK(r)               (r >= 0)
259
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
260

    
261
/* The CastRankLimit says how many bits are used for the cast rank */
262
#define SWIG_CASTRANKLIMIT         (1 << 8)
263
/* The NewMask denotes the object was created (using new/malloc) */
264
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
265
/* The TmpMask is for in/out typemaps that use temporal objects */
266
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
267
/* Simple returning values */
268
#define SWIG_BADOBJ                (SWIG_ERROR)
269
#define SWIG_OLDOBJ                (SWIG_OK)
270
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
271
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
272
/* Check, add and del mask methods */
273
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
274
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
275
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
276
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
277
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
278
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
279

    
280
/* Cast-Rank Mode */
281
#if defined(SWIG_CASTRANK_MODE)
282
#  ifndef SWIG_TypeRank
283
#    define SWIG_TypeRank             unsigned long
284
#  endif
285
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
286
#    define SWIG_MAXCASTRANK          (2)
287
#  endif
288
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
289
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
290
SWIGINTERNINLINE int SWIG_AddCast(int r) { 
291
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
292
}
293
SWIGINTERNINLINE int SWIG_CheckState(int r) { 
294
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
295
}
296
#else /* no cast-rank mode */
297
#  define SWIG_AddCast
298
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
299
#endif
300

    
301

    
302
#include <string.h>
303

    
304
#ifdef __cplusplus
305
extern "C" {
306
#endif
307

    
308
typedef void *(*swig_converter_func)(void *, int *);
309
typedef struct swig_type_info *(*swig_dycast_func)(void **);
310

    
311
/* Structure to store information on one type */
312
typedef struct swig_type_info {
313
  const char             *name;                        /* mangled name of this type */
314
  const char             *str;                        /* human readable name of this type */
315
  swig_dycast_func        dcast;                /* dynamic cast function down a hierarchy */
316
  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
317
  void                   *clientdata;                /* language specific type data */
318
  int                    owndata;                /* flag if the structure owns the clientdata */
319
} swig_type_info;
320

    
321
/* Structure to store a type and conversion function used for casting */
322
typedef struct swig_cast_info {
323
  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
324
  swig_converter_func     converter;                /* function to cast the void pointers */
325
  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
326
  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
327
} swig_cast_info;
328

    
329
/* Structure used to store module information
330
 * Each module generates one structure like this, and the runtime collects
331
 * all of these structures and stores them in a circularly linked list.*/
332
typedef struct swig_module_info {
333
  swig_type_info         **types;                /* Array of pointers to swig_type_info structures that are in this module */
334
  size_t                 size;                        /* Number of types in this module */
335
  struct swig_module_info *next;                /* Pointer to next element in circularly linked list */
336
  swig_type_info         **type_initial;        /* Array of initially generated type structures */
337
  swig_cast_info         **cast_initial;        /* Array of initially generated casting structures */
338
  void                    *clientdata;                /* Language specific module data */
339
} swig_module_info;
340

    
341
/* 
342
  Compare two type names skipping the space characters, therefore
343
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
344

345
  Return 0 when the two name types are equivalent, as in
346
  strncmp, but skipping ' '.
347
*/
348
SWIGRUNTIME int
349
SWIG_TypeNameComp(const char *f1, const char *l1,
350
                  const char *f2, const char *l2) {
351
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
352
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
353
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
354
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
355
  }
356
  return (int)((l1 - f1) - (l2 - f2));
357
}
358

    
359
/*
360
  Check type equivalence in a name list like <name1>|<name2>|...
361
  Return 0 if not equal, 1 if equal
362
*/
363
SWIGRUNTIME int
364
SWIG_TypeEquiv(const char *nb, const char *tb) {
365
  int equiv = 0;
366
  const char* te = tb + strlen(tb);
367
  const char* ne = nb;
368
  while (!equiv && *ne) {
369
    for (nb = ne; *ne; ++ne) {
370
      if (*ne == '|') break;
371
    }
372
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
373
    if (*ne) ++ne;
374
  }
375
  return equiv;
376
}
377

    
378
/*
379
  Check type equivalence in a name list like <name1>|<name2>|...
380
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
381
*/
382
SWIGRUNTIME int
383
SWIG_TypeCompare(const char *nb, const char *tb) {
384
  int equiv = 0;
385
  const char* te = tb + strlen(tb);
386
  const char* ne = nb;
387
  while (!equiv && *ne) {
388
    for (nb = ne; *ne; ++ne) {
389
      if (*ne == '|') break;
390
    }
391
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
392
    if (*ne) ++ne;
393
  }
394
  return equiv;
395
}
396

    
397

    
398
/*
399
  Check the typename
400
*/
401
SWIGRUNTIME swig_cast_info *
402
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
403
  if (ty) {
404
    swig_cast_info *iter = ty->cast;
405
    while (iter) {
406
      if (strcmp(iter->type->name, c) == 0) {
407
        if (iter == ty->cast)
408
          return iter;
409
        /* Move iter to the top of the linked list */
410
        iter->prev->next = iter->next;
411
        if (iter->next)
412
          iter->next->prev = iter->prev;
413
        iter->next = ty->cast;
414
        iter->prev = 0;
415
        if (ty->cast) ty->cast->prev = iter;
416
        ty->cast = iter;
417
        return iter;
418
      }
419
      iter = iter->next;
420
    }
421
  }
422
  return 0;
423
}
424

    
425
/* 
426
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
427
*/
428
SWIGRUNTIME swig_cast_info *
429
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
430
  if (ty) {
431
    swig_cast_info *iter = ty->cast;
432
    while (iter) {
433
      if (iter->type == from) {
434
        if (iter == ty->cast)
435
          return iter;
436
        /* Move iter to the top of the linked list */
437
        iter->prev->next = iter->next;
438
        if (iter->next)
439
          iter->next->prev = iter->prev;
440
        iter->next = ty->cast;
441
        iter->prev = 0;
442
        if (ty->cast) ty->cast->prev = iter;
443
        ty->cast = iter;
444
        return iter;
445
      }
446
      iter = iter->next;
447
    }
448
  }
449
  return 0;
450
}
451

    
452
/*
453
  Cast a pointer up an inheritance hierarchy
454
*/
455
SWIGRUNTIMEINLINE void *
456
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
457
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
458
}
459

    
460
/* 
461
   Dynamic pointer casting. Down an inheritance hierarchy
462
*/
463
SWIGRUNTIME swig_type_info *
464
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
465
  swig_type_info *lastty = ty;
466
  if (!ty || !ty->dcast) return ty;
467
  while (ty && (ty->dcast)) {
468
    ty = (*ty->dcast)(ptr);
469
    if (ty) lastty = ty;
470
  }
471
  return lastty;
472
}
473

    
474
/*
475
  Return the name associated with this type
476
*/
477
SWIGRUNTIMEINLINE const char *
478
SWIG_TypeName(const swig_type_info *ty) {
479
  return ty->name;
480
}
481

    
482
/*
483
  Return the pretty name associated with this type,
484
  that is an unmangled type name in a form presentable to the user.
485
*/
486
SWIGRUNTIME const char *
487
SWIG_TypePrettyName(const swig_type_info *type) {
488
  /* The "str" field contains the equivalent pretty names of the
489
     type, separated by vertical-bar characters.  We choose
490
     to print the last name, as it is often (?) the most
491
     specific. */
492
  if (!type) return NULL;
493
  if (type->str != NULL) {
494
    const char *last_name = type->str;
495
    const char *s;
496
    for (s = type->str; *s; s++)
497
      if (*s == '|') last_name = s+1;
498
    return last_name;
499
  }
500
  else
501
    return type->name;
502
}
503

    
504
/* 
505
   Set the clientdata field for a type
506
*/
507
SWIGRUNTIME void
508
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
509
  swig_cast_info *cast = ti->cast;
510
  /* if (ti->clientdata == clientdata) return; */
511
  ti->clientdata = clientdata;
512
  
513
  while (cast) {
514
    if (!cast->converter) {
515
      swig_type_info *tc = cast->type;
516
      if (!tc->clientdata) {
517
        SWIG_TypeClientData(tc, clientdata);
518
      }
519
    }    
520
    cast = cast->next;
521
  }
522
}
523
SWIGRUNTIME void
524
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
525
  SWIG_TypeClientData(ti, clientdata);
526
  ti->owndata = 1;
527
}
528
  
529
/*
530
  Search for a swig_type_info structure only by mangled name
531
  Search is a O(log #types)
532
  
533
  We start searching at module start, and finish searching when start == end.  
534
  Note: if start == end at the beginning of the function, we go all the way around
535
  the circular list.
536
*/
537
SWIGRUNTIME swig_type_info *
538
SWIG_MangledTypeQueryModule(swig_module_info *start, 
539
                            swig_module_info *end, 
540
                            const char *name) {
541
  swig_module_info *iter = start;
542
  do {
543
    if (iter->size) {
544
      register size_t l = 0;
545
      register size_t r = iter->size - 1;
546
      do {
547
        /* since l+r >= 0, we can (>> 1) instead (/ 2) */
548
        register size_t i = (l + r) >> 1; 
549
        const char *iname = iter->types[i]->name;
550
        if (iname) {
551
          register int compare = strcmp(name, iname);
552
          if (compare == 0) {            
553
            return iter->types[i];
554
          } else if (compare < 0) {
555
            if (i) {
556
              r = i - 1;
557
            } else {
558
              break;
559
            }
560
          } else if (compare > 0) {
561
            l = i + 1;
562
          }
563
        } else {
564
          break; /* should never happen */
565
        }
566
      } while (l <= r);
567
    }
568
    iter = iter->next;
569
  } while (iter != end);
570
  return 0;
571
}
572

    
573
/*
574
  Search for a swig_type_info structure for either a mangled name or a human readable name.
575
  It first searches the mangled names of the types, which is a O(log #types)
576
  If a type is not found it then searches the human readable names, which is O(#types).
577
  
578
  We start searching at module start, and finish searching when start == end.  
579
  Note: if start == end at the beginning of the function, we go all the way around
580
  the circular list.
581
*/
582
SWIGRUNTIME swig_type_info *
583
SWIG_TypeQueryModule(swig_module_info *start, 
584
                     swig_module_info *end, 
585
                     const char *name) {
586
  /* STEP 1: Search the name field using binary search */
587
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
588
  if (ret) {
589
    return ret;
590
  } else {
591
    /* STEP 2: If the type hasn't been found, do a complete search
592
       of the str field (the human readable name) */
593
    swig_module_info *iter = start;
594
    do {
595
      register size_t i = 0;
596
      for (; i < iter->size; ++i) {
597
        if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
598
          return iter->types[i];
599
      }
600
      iter = iter->next;
601
    } while (iter != end);
602
  }
603
  
604
  /* neither found a match */
605
  return 0;
606
}
607

    
608
/* 
609
   Pack binary data into a string
610
*/
611
SWIGRUNTIME char *
612
SWIG_PackData(char *c, void *ptr, size_t sz) {
613
  static const char hex[17] = "0123456789abcdef";
614
  register const unsigned char *u = (unsigned char *) ptr;
615
  register const unsigned char *eu =  u + sz;
616
  for (; u != eu; ++u) {
617
    register unsigned char uu = *u;
618
    *(c++) = hex[(uu & 0xf0) >> 4];
619
    *(c++) = hex[uu & 0xf];
620
  }
621
  return c;
622
}
623

    
624
/* 
625
   Unpack binary data from a string
626
*/
627
SWIGRUNTIME const char *
628
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
629
  register unsigned char *u = (unsigned char *) ptr;
630
  register const unsigned char *eu = u + sz;
631
  for (; u != eu; ++u) {
632
    register char d = *(c++);
633
    register unsigned char uu;
634
    if ((d >= '0') && (d <= '9'))
635
      uu = ((d - '0') << 4);
636
    else if ((d >= 'a') && (d <= 'f'))
637
      uu = ((d - ('a'-10)) << 4);
638
    else 
639
      return (char *) 0;
640
    d = *(c++);
641
    if ((d >= '0') && (d <= '9'))
642
      uu |= (d - '0');
643
    else if ((d >= 'a') && (d <= 'f'))
644
      uu |= (d - ('a'-10));
645
    else 
646
      return (char *) 0;
647
    *u = uu;
648
  }
649
  return c;
650
}
651

    
652
/* 
653
   Pack 'void *' into a string buffer.
654
*/
655
SWIGRUNTIME char *
656
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
657
  char *r = buff;
658
  if ((2*sizeof(void *) + 2) > bsz) return 0;
659
  *(r++) = '_';
660
  r = SWIG_PackData(r,&ptr,sizeof(void *));
661
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
662
  strcpy(r,name);
663
  return buff;
664
}
665

    
666
SWIGRUNTIME const char *
667
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
668
  if (*c != '_') {
669
    if (strcmp(c,"NULL") == 0) {
670
      *ptr = (void *) 0;
671
      return name;
672
    } else {
673
      return 0;
674
    }
675
  }
676
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
677
}
678

    
679
SWIGRUNTIME char *
680
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
681
  char *r = buff;
682
  size_t lname = (name ? strlen(name) : 0);
683
  if ((2*sz + 2 + lname) > bsz) return 0;
684
  *(r++) = '_';
685
  r = SWIG_PackData(r,ptr,sz);
686
  if (lname) {
687
    strncpy(r,name,lname+1);
688
  } else {
689
    *r = 0;
690
  }
691
  return buff;
692
}
693

    
694
SWIGRUNTIME const char *
695
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
696
  if (*c != '_') {
697
    if (strcmp(c,"NULL") == 0) {
698
      memset(ptr,0,sz);
699
      return name;
700
    } else {
701
      return 0;
702
    }
703
  }
704
  return SWIG_UnpackData(++c,ptr,sz);
705
}
706

    
707
#ifdef __cplusplus
708
}
709
#endif
710

    
711
/*  Errors in SWIG */
712
#define  SWIG_UnknownError               -1 
713
#define  SWIG_IOError                   -2 
714
#define  SWIG_RuntimeError              -3 
715
#define  SWIG_IndexError                -4 
716
#define  SWIG_TypeError                 -5 
717
#define  SWIG_DivisionByZero            -6 
718
#define  SWIG_OverflowError             -7 
719
#define  SWIG_SyntaxError               -8 
720
#define  SWIG_ValueError                -9 
721
#define  SWIG_SystemError               -10
722
#define  SWIG_AttributeError            -11
723
#define  SWIG_MemoryError               -12 
724
#define  SWIG_NullReferenceError   -13
725

    
726

    
727

    
728
/* Compatibility macros for Python 3 */
729
#if PY_VERSION_HEX >= 0x03000000
730

    
731
#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
732
#define PyInt_Check(x) PyLong_Check(x)
733
#define PyInt_AsLong(x) PyLong_AsLong(x)
734
#define PyInt_FromLong(x) PyLong_FromLong(x)
735
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
736
#define PyString_Check(name) PyBytes_Check(name)
737
#define PyString_FromString(x) PyUnicode_FromString(x)
738
#define PyString_Format(fmt, args)  PyUnicode_Format(fmt, args)
739
#define PyString_AsString(str) PyBytes_AsString(str)
740
#define PyString_Size(str) PyBytes_Size(str)        
741
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
742
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
743
#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
744
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
745

    
746
#endif
747

    
748
#ifndef Py_TYPE
749
#  define Py_TYPE(op) ((op)->ob_type)
750
#endif
751

    
752
/* SWIG APIs for compatibility of both Python 2 & 3 */
753

    
754
#if PY_VERSION_HEX >= 0x03000000
755
#  define SWIG_Python_str_FromFormat PyUnicode_FromFormat
756
#else
757
#  define SWIG_Python_str_FromFormat PyString_FromFormat
758
#endif
759

    
760

    
761
/* Warning: This function will allocate a new string in Python 3,
762
 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
763
 */
764
SWIGINTERN char*
765
SWIG_Python_str_AsChar(PyObject *str)
766
{
767
#if PY_VERSION_HEX >= 0x03000000
768
  char *cstr;
769
  char *newstr;
770
  Py_ssize_t len;
771
  str = PyUnicode_AsUTF8String(str);
772
  PyBytes_AsStringAndSize(str, &cstr, &len);
773
  newstr = (char *) malloc(len+1);
774
  memcpy(newstr, cstr, len+1);
775
  Py_XDECREF(str);
776
  return newstr;
777
#else
778
  return PyString_AsString(str);
779
#endif
780
}
781

    
782
#if PY_VERSION_HEX >= 0x03000000
783
#  define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
784
#else
785
#  define SWIG_Python_str_DelForPy3(x) 
786
#endif
787

    
788

    
789
SWIGINTERN PyObject*
790
SWIG_Python_str_FromChar(const char *c)
791
{
792
#if PY_VERSION_HEX >= 0x03000000
793
  return PyUnicode_FromString(c); 
794
#else
795
  return PyString_FromString(c);
796
#endif
797
}
798

    
799
/* Add PyOS_snprintf for old Pythons */
800
#if PY_VERSION_HEX < 0x02020000
801
# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
802
#  define PyOS_snprintf _snprintf
803
# else
804
#  define PyOS_snprintf snprintf
805
# endif
806
#endif
807

    
808
/* A crude PyString_FromFormat implementation for old Pythons */
809
#if PY_VERSION_HEX < 0x02020000
810

    
811
#ifndef SWIG_PYBUFFER_SIZE
812
# define SWIG_PYBUFFER_SIZE 1024
813
#endif
814

    
815
static PyObject *
816
PyString_FromFormat(const char *fmt, ...) {
817
  va_list ap;
818
  char buf[SWIG_PYBUFFER_SIZE * 2];
819
  int res;
820
  va_start(ap, fmt);
821
  res = vsnprintf(buf, sizeof(buf), fmt, ap);
822
  va_end(ap);
823
  return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
824
}
825
#endif
826

    
827
/* Add PyObject_Del for old Pythons */
828
#if PY_VERSION_HEX < 0x01060000
829
# define PyObject_Del(op) PyMem_DEL((op))
830
#endif
831
#ifndef PyObject_DEL
832
# define PyObject_DEL PyObject_Del
833
#endif
834

    
835
/* A crude PyExc_StopIteration exception for old Pythons */
836
#if PY_VERSION_HEX < 0x02020000
837
# ifndef PyExc_StopIteration
838
#  define PyExc_StopIteration PyExc_RuntimeError
839
# endif
840
# ifndef PyObject_GenericGetAttr
841
#  define PyObject_GenericGetAttr 0
842
# endif
843
#endif
844

    
845
/* Py_NotImplemented is defined in 2.1 and up. */
846
#if PY_VERSION_HEX < 0x02010000
847
# ifndef Py_NotImplemented
848
#  define Py_NotImplemented PyExc_RuntimeError
849
# endif
850
#endif
851

    
852
/* A crude PyString_AsStringAndSize implementation for old Pythons */
853
#if PY_VERSION_HEX < 0x02010000
854
# ifndef PyString_AsStringAndSize
855
#  define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
856
# endif
857
#endif
858

    
859
/* PySequence_Size for old Pythons */
860
#if PY_VERSION_HEX < 0x02000000
861
# ifndef PySequence_Size
862
#  define PySequence_Size PySequence_Length
863
# endif
864
#endif
865

    
866
/* PyBool_FromLong for old Pythons */
867
#if PY_VERSION_HEX < 0x02030000
868
static
869
PyObject *PyBool_FromLong(long ok)
870
{
871
  PyObject *result = ok ? Py_True : Py_False;
872
  Py_INCREF(result);
873
  return result;
874
}
875
#endif
876

    
877
/* Py_ssize_t for old Pythons */
878
/* This code is as recommended by: */
879
/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
880
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
881
typedef int Py_ssize_t;
882
# define PY_SSIZE_T_MAX INT_MAX
883
# define PY_SSIZE_T_MIN INT_MIN
884
typedef inquiry lenfunc;
885
typedef intargfunc ssizeargfunc;
886
typedef intintargfunc ssizessizeargfunc;
887
typedef intobjargproc ssizeobjargproc;
888
typedef intintobjargproc ssizessizeobjargproc;
889
typedef getreadbufferproc readbufferproc;
890
typedef getwritebufferproc writebufferproc;
891
typedef getsegcountproc segcountproc;
892
typedef getcharbufferproc charbufferproc;
893
static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
894
{
895
  long result = 0;
896
  PyObject *i = PyNumber_Int(x);
897
  if (i) {
898
    result = PyInt_AsLong(i);
899
    Py_DECREF(i);
900
  }
901
  return result;
902
}
903
#endif
904

    
905
#if PY_VERSION_HEX < 0x02040000
906
#define Py_VISIT(op)                                \
907
  do {                                                 \
908
    if (op) {                                        \
909
      int vret = visit((op), arg);                \
910
      if (vret)                                        \
911
        return vret;                                \
912
    }                                                \
913
  } while (0)
914
#endif
915

    
916
#if PY_VERSION_HEX < 0x02030000
917
typedef struct {
918
  PyTypeObject type;
919
  PyNumberMethods as_number;
920
  PyMappingMethods as_mapping;
921
  PySequenceMethods as_sequence;
922
  PyBufferProcs as_buffer;
923
  PyObject *name, *slots;
924
} PyHeapTypeObject;
925
#endif
926

    
927
#if PY_VERSION_HEX < 0x02030000
928
typedef destructor freefunc;
929
#endif
930

    
931
#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
932
     (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
933
     (PY_MAJOR_VERSION > 3))
934
# define SWIGPY_USE_CAPSULE
935
# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
936
#endif
937

    
938
#if PY_VERSION_HEX < 0x03020000
939
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
940
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
941
#endif
942

    
943
/* -----------------------------------------------------------------------------
944
 * error manipulation
945
 * ----------------------------------------------------------------------------- */
946

    
947
SWIGRUNTIME PyObject*
948
SWIG_Python_ErrorType(int code) {
949
  PyObject* type = 0;
950
  switch(code) {
951
  case SWIG_MemoryError:
952
    type = PyExc_MemoryError;
953
    break;
954
  case SWIG_IOError:
955
    type = PyExc_IOError;
956
    break;
957
  case SWIG_RuntimeError:
958
    type = PyExc_RuntimeError;
959
    break;
960
  case SWIG_IndexError:
961
    type = PyExc_IndexError;
962
    break;
963
  case SWIG_TypeError:
964
    type = PyExc_TypeError;
965
    break;
966
  case SWIG_DivisionByZero:
967
    type = PyExc_ZeroDivisionError;
968
    break;
969
  case SWIG_OverflowError:
970
    type = PyExc_OverflowError;
971
    break;
972
  case SWIG_SyntaxError:
973
    type = PyExc_SyntaxError;
974
    break;
975
  case SWIG_ValueError:
976
    type = PyExc_ValueError;
977
    break;
978
  case SWIG_SystemError:
979
    type = PyExc_SystemError;
980
    break;
981
  case SWIG_AttributeError:
982
    type = PyExc_AttributeError;
983
    break;
984
  default:
985
    type = PyExc_RuntimeError;
986
  }
987
  return type;
988
}
989

    
990

    
991
SWIGRUNTIME void
992
SWIG_Python_AddErrorMsg(const char* mesg)
993
{
994
  PyObject *type = 0;
995
  PyObject *value = 0;
996
  PyObject *traceback = 0;
997

    
998
  if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
999
  if (value) {
1000
    char *tmp;
1001
    PyObject *old_str = PyObject_Str(value);
1002
    PyErr_Clear();
1003
    Py_XINCREF(type);
1004

    
1005
    PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
1006
    SWIG_Python_str_DelForPy3(tmp);
1007
    Py_DECREF(old_str);
1008
    Py_DECREF(value);
1009
  } else {
1010
    PyErr_SetString(PyExc_RuntimeError, mesg);
1011
  }
1012
}
1013

    
1014
#if defined(SWIG_PYTHON_NO_THREADS)
1015
#  if defined(SWIG_PYTHON_THREADS)
1016
#    undef SWIG_PYTHON_THREADS
1017
#  endif
1018
#endif
1019
#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
1020
#  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
1021
#    if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
1022
#      define SWIG_PYTHON_USE_GIL
1023
#    endif
1024
#  endif
1025
#  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
1026
#    ifndef SWIG_PYTHON_INITIALIZE_THREADS
1027
#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
1028
#    endif
1029
#    ifdef __cplusplus /* C++ code */
1030
       class SWIG_Python_Thread_Block {
1031
         bool status;
1032
         PyGILState_STATE state;
1033
       public:
1034
         void end() { if (status) { PyGILState_Release(state); status = false;} }
1035
         SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
1036
         ~SWIG_Python_Thread_Block() { end(); }
1037
       };
1038
       class SWIG_Python_Thread_Allow {
1039
         bool status;
1040
         PyThreadState *save;
1041
       public:
1042
         void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
1043
         SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
1044
         ~SWIG_Python_Thread_Allow() { end(); }
1045
       };
1046
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
1047
#      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
1048
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
1049
#      define SWIG_PYTHON_THREAD_END_ALLOW     _swig_thread_allow.end()
1050
#    else /* C code */
1051
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1052
#      define SWIG_PYTHON_THREAD_END_BLOCK     PyGILState_Release(_swig_thread_block)
1053
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1054
#      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
1055
#    endif
1056
#  else /* Old thread way, not implemented, user must provide it */
1057
#    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1058
#      define SWIG_PYTHON_INITIALIZE_THREADS
1059
#    endif
1060
#    if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1061
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1062
#    endif
1063
#    if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1064
#      define SWIG_PYTHON_THREAD_END_BLOCK
1065
#    endif
1066
#    if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1067
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1068
#    endif
1069
#    if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1070
#      define SWIG_PYTHON_THREAD_END_ALLOW
1071
#    endif
1072
#  endif
1073
#else /* No thread support */
1074
#  define SWIG_PYTHON_INITIALIZE_THREADS
1075
#  define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1076
#  define SWIG_PYTHON_THREAD_END_BLOCK
1077
#  define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1078
#  define SWIG_PYTHON_THREAD_END_ALLOW
1079
#endif
1080

    
1081
/* -----------------------------------------------------------------------------
1082
 * Python API portion that goes into the runtime
1083
 * ----------------------------------------------------------------------------- */
1084

    
1085
#ifdef __cplusplus
1086
extern "C" {
1087
#endif
1088

    
1089
/* -----------------------------------------------------------------------------
1090
 * Constant declarations
1091
 * ----------------------------------------------------------------------------- */
1092

    
1093
/* Constant Types */
1094
#define SWIG_PY_POINTER 4
1095
#define SWIG_PY_BINARY  5
1096

    
1097
/* Constant information structure */
1098
typedef struct swig_const_info {
1099
  int type;
1100
  char *name;
1101
  long lvalue;
1102
  double dvalue;
1103
  void   *pvalue;
1104
  swig_type_info **ptype;
1105
} swig_const_info;
1106

    
1107

    
1108
/* -----------------------------------------------------------------------------
1109
 * Wrapper of PyInstanceMethod_New() used in Python 3
1110
 * It is exported to the generated module, used for -fastproxy
1111
 * ----------------------------------------------------------------------------- */
1112
#if PY_VERSION_HEX >= 0x03000000
1113
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
1114
{
1115
  return PyInstanceMethod_New(func);
1116
}
1117
#else
1118
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
1119
{
1120
  return NULL;
1121
}
1122
#endif
1123

    
1124
#ifdef __cplusplus
1125
}
1126
#endif
1127

    
1128

    
1129
/* -----------------------------------------------------------------------------
1130
 * pyrun.swg
1131
 *
1132
 * This file contains the runtime support for Python modules
1133
 * and includes code for managing global variables and pointer
1134
 * type checking.
1135
 *
1136
 * ----------------------------------------------------------------------------- */
1137

    
1138
/* Common SWIG API */
1139

    
1140
/* for raw pointers */
1141
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1142
#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1143
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1144

    
1145
#ifdef SWIGPYTHON_BUILTIN
1146
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(self, ptr, type, flags)
1147
#else
1148
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1149
#endif
1150

    
1151
#define SWIG_InternalNewPointerObj(ptr, type, flags)        SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1152

    
1153
#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
1154
#define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
1155
#define swig_owntype                                    int
1156

    
1157
/* for raw packed data */
1158
#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1159
#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
1160

    
1161
/* for class or struct pointers */
1162
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
1163
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
1164

    
1165
/* for C or C++ function pointers */
1166
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1167
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1168

    
1169
/* for C++ member pointers, ie, member methods */
1170
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1171
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
1172

    
1173

    
1174
/* Runtime API */
1175

    
1176
#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule()
1177
#define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
1178
#define SWIG_NewClientData(obj)                         SwigPyClientData_New(obj)
1179

    
1180
#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
1181
#define SWIG_SetErrorMsg                                SWIG_Python_SetErrorMsg                                   
1182
#define SWIG_ErrorType(code)                            SWIG_Python_ErrorType(code)                        
1183
#define SWIG_Error(code, msg)                            SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
1184
#define SWIG_fail                                        goto fail                                           
1185

    
1186

    
1187
/* Runtime API implementation */
1188

    
1189
/* Error manipulation */
1190

    
1191
SWIGINTERN void 
1192
SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1193
  SWIG_PYTHON_THREAD_BEGIN_BLOCK; 
1194
  PyErr_SetObject(errtype, obj);
1195
  Py_DECREF(obj);
1196
  SWIG_PYTHON_THREAD_END_BLOCK;
1197
}
1198

    
1199
SWIGINTERN void 
1200
SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1201
  SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1202
  PyErr_SetString(errtype, msg);
1203
  SWIG_PYTHON_THREAD_END_BLOCK;
1204
}
1205

    
1206
#define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1207

    
1208
/* Set a constant value */
1209

    
1210
#if defined(SWIGPYTHON_BUILTIN)
1211

    
1212
SWIGINTERN void
1213
SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1214
  PyObject *s = PyString_InternFromString(key);
1215
  PyList_Append(seq, s);
1216
  Py_DECREF(s);
1217
}
1218

    
1219
SWIGINTERN void
1220
SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, 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
  if (public_interface)
1228
    SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1229
}
1230

    
1231
#else
1232

    
1233
SWIGINTERN void
1234
SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
1235
#if PY_VERSION_HEX < 0x02030000
1236
  PyDict_SetItemString(d, (char *)name, obj);
1237
#else
1238
  PyDict_SetItemString(d, name, obj);
1239
#endif
1240
  Py_DECREF(obj);                            
1241
}
1242

    
1243
#endif
1244

    
1245
/* Append a value to the result obj */
1246

    
1247
SWIGINTERN PyObject*
1248
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1249
#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
1250
  if (!result) {
1251
    result = obj;
1252
  } else if (result == Py_None) {
1253
    Py_DECREF(result);
1254
    result = obj;
1255
  } else {
1256
    if (!PyList_Check(result)) {
1257
      PyObject *o2 = result;
1258
      result = PyList_New(1);
1259
      PyList_SetItem(result, 0, o2);
1260
    }
1261
    PyList_Append(result,obj);
1262
    Py_DECREF(obj);
1263
  }
1264
  return result;
1265
#else
1266
  PyObject*   o2;
1267
  PyObject*   o3;
1268
  if (!result) {
1269
    result = obj;
1270
  } else if (result == Py_None) {
1271
    Py_DECREF(result);
1272
    result = obj;
1273
  } else {
1274
    if (!PyTuple_Check(result)) {
1275
      o2 = result;
1276
      result = PyTuple_New(1);
1277
      PyTuple_SET_ITEM(result, 0, o2);
1278
    }
1279
    o3 = PyTuple_New(1);
1280
    PyTuple_SET_ITEM(o3, 0, obj);
1281
    o2 = result;
1282
    result = PySequence_Concat(o2, o3);
1283
    Py_DECREF(o2);
1284
    Py_DECREF(o3);
1285
  }
1286
  return result;
1287
#endif
1288
}
1289

    
1290
/* Unpack the argument tuple */
1291

    
1292
SWIGINTERN int
1293
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1294
{
1295
  if (!args) {
1296
    if (!min && !max) {
1297
      return 1;
1298
    } else {
1299
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
1300
                   name, (min == max ? "" : "at least "), (int)min);
1301
      return 0;
1302
    }
1303
  }  
1304
  if (!PyTuple_Check(args)) {
1305
    if (min <= 1 && max >= 1) {
1306
      register int i;
1307
      objs[0] = args;
1308
      for (i = 1; i < max; ++i) {
1309
        objs[i] = 0;
1310
      }
1311
      return 2;
1312
    }
1313
    PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1314
    return 0;
1315
  } else {
1316
    register Py_ssize_t l = PyTuple_GET_SIZE(args);
1317
    if (l < min) {
1318
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
1319
                   name, (min == max ? "" : "at least "), (int)min, (int)l);
1320
      return 0;
1321
    } else if (l > max) {
1322
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
1323
                   name, (min == max ? "" : "at most "), (int)max, (int)l);
1324
      return 0;
1325
    } else {
1326
      register int i;
1327
      for (i = 0; i < l; ++i) {
1328
        objs[i] = PyTuple_GET_ITEM(args, i);
1329
      }
1330
      for (; l < max; ++l) {
1331
        objs[l] = 0;
1332
      }
1333
      return i + 1;
1334
    }    
1335
  }
1336
}
1337

    
1338
/* A functor is a function object with one single object argument */
1339
#if PY_VERSION_HEX >= 0x02020000
1340
#define SWIG_Python_CallFunctor(functor, obj)                PyObject_CallFunctionObjArgs(functor, obj, NULL);
1341
#else
1342
#define SWIG_Python_CallFunctor(functor, obj)                PyObject_CallFunction(functor, "O", obj);
1343
#endif
1344

    
1345
/*
1346
  Helper for static pointer initialization for both C and C++ code, for example
1347
  static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1348
*/
1349
#ifdef __cplusplus
1350
#define SWIG_STATIC_POINTER(var)  var
1351
#else
1352
#define SWIG_STATIC_POINTER(var)  var = 0; if (!var) var
1353
#endif
1354

    
1355
/* -----------------------------------------------------------------------------
1356
 * Pointer declarations
1357
 * ----------------------------------------------------------------------------- */
1358

    
1359
/* Flags for new pointer objects */
1360
#define SWIG_POINTER_NOSHADOW       (SWIG_POINTER_OWN      << 1)
1361
#define SWIG_POINTER_NEW            (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1362

    
1363
#define SWIG_POINTER_IMPLICIT_CONV  (SWIG_POINTER_DISOWN   << 1)
1364

    
1365
#define SWIG_BUILTIN_TP_INIT            (SWIG_POINTER_OWN << 2)
1366
#define SWIG_BUILTIN_INIT            (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1367

    
1368
#ifdef __cplusplus
1369
extern "C" {
1370
#endif
1371

    
1372
/*  How to access Py_None */
1373
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
1374
#  ifndef SWIG_PYTHON_NO_BUILD_NONE
1375
#    ifndef SWIG_PYTHON_BUILD_NONE
1376
#      define SWIG_PYTHON_BUILD_NONE
1377
#    endif
1378
#  endif
1379
#endif
1380

    
1381
#ifdef SWIG_PYTHON_BUILD_NONE
1382
#  ifdef Py_None
1383
#   undef Py_None
1384
#   define Py_None SWIG_Py_None()
1385
#  endif
1386
SWIGRUNTIMEINLINE PyObject * 
1387
_SWIG_Py_None(void)
1388
{
1389
  PyObject *none = Py_BuildValue((char*)"");
1390
  Py_DECREF(none);
1391
  return none;
1392
}
1393
SWIGRUNTIME PyObject * 
1394
SWIG_Py_None(void)
1395
{
1396
  static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
1397
  return none;
1398
}
1399
#endif
1400

    
1401
/* The python void return value */
1402

    
1403
SWIGRUNTIMEINLINE PyObject * 
1404
SWIG_Py_Void(void)
1405
{
1406
  PyObject *none = Py_None;
1407
  Py_INCREF(none);
1408
  return none;
1409
}
1410

    
1411
/* SwigPyClientData */
1412

    
1413
typedef struct {
1414
  PyObject *klass;
1415
  PyObject *newraw;
1416
  PyObject *newargs;
1417
  PyObject *destroy;
1418
  int delargs;
1419
  int implicitconv;
1420
  PyTypeObject *pytype;
1421
} SwigPyClientData;
1422

    
1423
SWIGRUNTIMEINLINE int 
1424
SWIG_Python_CheckImplicit(swig_type_info *ty)
1425
{
1426
  SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1427
  return data ? data->implicitconv : 0;
1428
}
1429

    
1430
SWIGRUNTIMEINLINE PyObject *
1431
SWIG_Python_ExceptionType(swig_type_info *desc) {
1432
  SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1433
  PyObject *klass = data ? data->klass : 0;
1434
  return (klass ? klass : PyExc_RuntimeError);
1435
}
1436

    
1437

    
1438
SWIGRUNTIME SwigPyClientData * 
1439
SwigPyClientData_New(PyObject* obj)
1440
{
1441
  if (!obj) {
1442
    return 0;
1443
  } else {
1444
    SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1445
    /* the klass element */
1446
    data->klass = obj;
1447
    Py_INCREF(data->klass);
1448
    /* the newraw method and newargs arguments used to create a new raw instance */
1449
    if (PyClass_Check(obj)) {
1450
      data->newraw = 0;
1451
      data->newargs = obj;
1452
      Py_INCREF(obj);
1453
    } else {
1454
#if (PY_VERSION_HEX < 0x02020000)
1455
      data->newraw = 0;
1456
#else
1457
      data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
1458
#endif
1459
      if (data->newraw) {
1460
        Py_INCREF(data->newraw);
1461
        data->newargs = PyTuple_New(1);
1462
        PyTuple_SetItem(data->newargs, 0, obj);
1463
      } else {
1464
        data->newargs = obj;
1465
      }
1466
      Py_INCREF(data->newargs);
1467
    }
1468
    /* the destroy method, aka as the C++ delete method */
1469
    data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
1470
    if (PyErr_Occurred()) {
1471
      PyErr_Clear();
1472
      data->destroy = 0;
1473
    }
1474
    if (data->destroy) {
1475
      int flags;
1476
      Py_INCREF(data->destroy);
1477
      flags = PyCFunction_GET_FLAGS(data->destroy);
1478
#ifdef METH_O
1479
      data->delargs = !(flags & (METH_O));
1480
#else
1481
      data->delargs = 0;
1482
#endif
1483
    } else {
1484
      data->delargs = 0;
1485
    }
1486
    data->implicitconv = 0;
1487
    data->pytype = 0;
1488
    return data;
1489
  }
1490
}
1491

    
1492
SWIGRUNTIME void 
1493
SwigPyClientData_Del(SwigPyClientData *data) {
1494
  Py_XDECREF(data->newraw);
1495
  Py_XDECREF(data->newargs);
1496
  Py_XDECREF(data->destroy);
1497
}
1498

    
1499
/* =============== SwigPyObject =====================*/
1500

    
1501
typedef struct {
1502
  PyObject_HEAD
1503
  void *ptr;
1504
  swig_type_info *ty;
1505
  int own;
1506
  PyObject *next;
1507
#ifdef SWIGPYTHON_BUILTIN
1508
  PyObject *dict;
1509
#endif
1510
} SwigPyObject;
1511

    
1512
SWIGRUNTIME PyObject *
1513
SwigPyObject_long(SwigPyObject *v)
1514
{
1515
  return PyLong_FromVoidPtr(v->ptr);
1516
}
1517

    
1518
SWIGRUNTIME PyObject *
1519
SwigPyObject_format(const char* fmt, SwigPyObject *v)
1520
{
1521
  PyObject *res = NULL;
1522
  PyObject *args = PyTuple_New(1);
1523
  if (args) {
1524
    if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1525
      PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1526
      if (ofmt) {
1527
#if PY_VERSION_HEX >= 0x03000000
1528
        res = PyUnicode_Format(ofmt,args);
1529
#else
1530
        res = PyString_Format(ofmt,args);
1531
#endif
1532
        Py_DECREF(ofmt);
1533
      }
1534
      Py_DECREF(args);
1535
    }
1536
  }
1537
  return res;
1538
}
1539

    
1540
SWIGRUNTIME PyObject *
1541
SwigPyObject_oct(SwigPyObject *v)
1542
{
1543
  return SwigPyObject_format("%o",v);
1544
}
1545

    
1546
SWIGRUNTIME PyObject *
1547
SwigPyObject_hex(SwigPyObject *v)
1548
{
1549
  return SwigPyObject_format("%x",v);
1550
}
1551

    
1552
SWIGRUNTIME PyObject *
1553
#ifdef METH_NOARGS
1554
SwigPyObject_repr(SwigPyObject *v)
1555
#else
1556
SwigPyObject_repr(SwigPyObject *v, PyObject *args)
1557
#endif
1558
{
1559
  const char *name = SWIG_TypePrettyName(v->ty);
1560
  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
1561
  if (v->next) {
1562
# ifdef METH_NOARGS
1563
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1564
# else
1565
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
1566
# endif
1567
# if PY_VERSION_HEX >= 0x03000000
1568
    PyObject *joined = PyUnicode_Concat(repr, nrep);
1569
    Py_DecRef(repr);
1570
    Py_DecRef(nrep);
1571
    repr = joined;
1572
# else
1573
    PyString_ConcatAndDel(&repr,nrep);
1574
# endif
1575
  }
1576
  return repr;  
1577
}
1578

    
1579
SWIGRUNTIME int
1580
SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1581
{
1582
  char *str;
1583
#ifdef METH_NOARGS
1584
  PyObject *repr = SwigPyObject_repr(v);
1585
#else
1586
  PyObject *repr = SwigPyObject_repr(v, NULL);
1587
#endif
1588
  if (repr) {
1589
    str = SWIG_Python_str_AsChar(repr); 
1590
    fputs(str, fp);
1591
    SWIG_Python_str_DelForPy3(str);
1592
    Py_DECREF(repr);
1593
    return 0; 
1594
  } else {
1595
    return 1; 
1596
  }
1597
}
1598

    
1599
SWIGRUNTIME PyObject *
1600
SwigPyObject_str(SwigPyObject *v)
1601
{
1602
  char result[SWIG_BUFFER_SIZE];
1603
  return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
1604
    SWIG_Python_str_FromChar(result) : 0;
1605
}
1606

    
1607
SWIGRUNTIME int
1608
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
1609
{
1610
  void *i = v->ptr;
1611
  void *j = w->ptr;
1612
  return (i < j) ? -1 : ((i > j) ? 1 : 0);
1613
}
1614

    
1615
/* Added for Python 3.x, would it also be useful for Python 2.x? */
1616
SWIGRUNTIME PyObject*
1617
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
1618
{
1619
  PyObject* res;
1620
  if( op != Py_EQ && op != Py_NE ) {
1621
    Py_INCREF(Py_NotImplemented);
1622
    return Py_NotImplemented;
1623
  }
1624
  res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
1625
  return res;  
1626
}
1627

    
1628

    
1629
SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
1630

    
1631
#ifdef SWIGPYTHON_BUILTIN
1632
static swig_type_info *SwigPyObject_stype = 0;
1633
SWIGRUNTIME PyTypeObject*
1634
SwigPyObject_type(void) {
1635
    SwigPyClientData *cd;
1636
    assert(SwigPyObject_stype);
1637
    cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
1638
    assert(cd);
1639
    assert(cd->pytype);
1640
    return cd->pytype;
1641
}
1642
#else
1643
SWIGRUNTIME PyTypeObject*
1644
SwigPyObject_type(void) {
1645
  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1646
  return type;
1647
}
1648
#endif
1649

    
1650
SWIGRUNTIMEINLINE int
1651
SwigPyObject_Check(PyObject *op) {
1652
#ifdef SWIGPYTHON_BUILTIN
1653
  PyTypeObject *target_tp = SwigPyObject_type();
1654
  if (PyType_IsSubtype(op->ob_type, target_tp))
1655
    return 1;
1656
  return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
1657
#else
1658
  return (Py_TYPE(op) == SwigPyObject_type())
1659
    || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1660
#endif
1661
}
1662

    
1663
SWIGRUNTIME PyObject *
1664
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1665

    
1666
SWIGRUNTIME void
1667
SwigPyObject_dealloc(PyObject *v)
1668
{
1669
  SwigPyObject *sobj = (SwigPyObject *) v;
1670
  PyObject *next = sobj->next;
1671
  if (sobj->own == SWIG_POINTER_OWN) {
1672
    swig_type_info *ty = sobj->ty;
1673
    SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1674
    PyObject *destroy = data ? data->destroy : 0;
1675
    if (destroy) {
1676
      /* destroy is always a VARARGS method */
1677
      PyObject *res;
1678
      if (data->delargs) {
1679
        /* we need to create a temporary object to carry the destroy operation */
1680
        PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1681
        res = SWIG_Python_CallFunctor(destroy, tmp);
1682
        Py_DECREF(tmp);
1683
      } else {
1684
        PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1685
        PyObject *mself = PyCFunction_GET_SELF(destroy);
1686
        res = ((*meth)(mself, v));
1687
      }
1688
      Py_XDECREF(res);
1689
    } 
1690
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1691
    else {
1692
      const char *name = SWIG_TypePrettyName(ty);
1693
      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1694
    }
1695
#endif
1696
  } 
1697
  Py_XDECREF(next);
1698
  PyObject_DEL(v);
1699
}
1700

    
1701
SWIGRUNTIME PyObject* 
1702
SwigPyObject_append(PyObject* v, PyObject* next)
1703
{
1704
  SwigPyObject *sobj = (SwigPyObject *) v;
1705
#ifndef METH_O
1706
  PyObject *tmp = 0;
1707
  if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
1708
  next = tmp;
1709
#endif
1710
  if (!SwigPyObject_Check(next)) {
1711
    return NULL;
1712
  }
1713
  sobj->next = next;
1714
  Py_INCREF(next);
1715
  return SWIG_Py_Void();
1716
}
1717

    
1718
SWIGRUNTIME PyObject* 
1719
#ifdef METH_NOARGS
1720
SwigPyObject_next(PyObject* v)
1721
#else
1722
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1723
#endif
1724
{
1725
  SwigPyObject *sobj = (SwigPyObject *) v;
1726
  if (sobj->next) {    
1727
    Py_INCREF(sobj->next);
1728
    return sobj->next;
1729
  } else {
1730
    return SWIG_Py_Void();
1731
  }
1732
}
1733

    
1734
SWIGINTERN PyObject*
1735
#ifdef METH_NOARGS
1736
SwigPyObject_disown(PyObject *v)
1737
#else
1738
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1739
#endif
1740
{
1741
  SwigPyObject *sobj = (SwigPyObject *)v;
1742
  sobj->own = 0;
1743
  return SWIG_Py_Void();
1744
}
1745

    
1746
SWIGINTERN PyObject*
1747
#ifdef METH_NOARGS
1748
SwigPyObject_acquire(PyObject *v)
1749
#else
1750
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1751
#endif
1752
{
1753
  SwigPyObject *sobj = (SwigPyObject *)v;
1754
  sobj->own = SWIG_POINTER_OWN;
1755
  return SWIG_Py_Void();
1756
}
1757

    
1758
SWIGINTERN PyObject*
1759
SwigPyObject_own(PyObject *v, PyObject *args)
1760
{
1761
  PyObject *val = 0;
1762
#if (PY_VERSION_HEX < 0x02020000)
1763
  if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
1764
#elif (PY_VERSION_HEX < 0x02050000)
1765
  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
1766
#else
1767
  if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) 
1768
#endif
1769
    {
1770
      return NULL;
1771
    } 
1772
  else
1773
    {
1774
      SwigPyObject *sobj = (SwigPyObject *)v;
1775
      PyObject *obj = PyBool_FromLong(sobj->own);
1776
      if (val) {
1777
#ifdef METH_NOARGS
1778
        if (PyObject_IsTrue(val)) {
1779
          SwigPyObject_acquire(v);
1780
        } else {
1781
          SwigPyObject_disown(v);
1782
        }
1783
#else
1784
        if (PyObject_IsTrue(val)) {
1785
          SwigPyObject_acquire(v,args);
1786
        } else {
1787
          SwigPyObject_disown(v,args);
1788
        }
1789
#endif
1790
      } 
1791
      return obj;
1792
    }
1793
}
1794

    
1795
#ifdef METH_O
1796
static PyMethodDef
1797
swigobject_methods[] = {
1798
  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
1799
  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
1800
  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1801
  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_O,       (char *)"appends another 'this' object"},
1802
  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
1803
  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
1804
  {0, 0, 0, 0}  
1805
};
1806
#else
1807
static PyMethodDef
1808
swigobject_methods[] = {
1809
  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
1810
  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
1811
  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
1812
  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
1813
  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
1814
  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
1815
  {0, 0, 0, 0}  
1816
};
1817
#endif
1818

    
1819
#if PY_VERSION_HEX < 0x02020000
1820
SWIGINTERN PyObject *
1821
SwigPyObject_getattr(SwigPyObject *sobj,char *name)
1822
{
1823
  return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1824
}
1825
#endif
1826

    
1827
SWIGRUNTIME PyTypeObject*
1828
SwigPyObject_TypeOnce(void) {
1829
  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1830

    
1831
  static PyNumberMethods SwigPyObject_as_number = {
1832
    (binaryfunc)0, /*nb_add*/
1833
    (binaryfunc)0, /*nb_subtract*/
1834
    (binaryfunc)0, /*nb_multiply*/
1835
    /* nb_divide removed in Python 3 */
1836
#if PY_VERSION_HEX < 0x03000000
1837
    (binaryfunc)0, /*nb_divide*/
1838
#endif
1839
    (binaryfunc)0, /*nb_remainder*/
1840
    (binaryfunc)0, /*nb_divmod*/
1841
    (ternaryfunc)0,/*nb_power*/
1842
    (unaryfunc)0,  /*nb_negative*/
1843
    (unaryfunc)0,  /*nb_positive*/
1844
    (unaryfunc)0,  /*nb_absolute*/
1845
    (inquiry)0,    /*nb_nonzero*/
1846
    0,                   /*nb_invert*/
1847
    0,                   /*nb_lshift*/
1848
    0,                   /*nb_rshift*/
1849
    0,                   /*nb_and*/
1850
    0,                   /*nb_xor*/
1851
    0,                   /*nb_or*/
1852
#if PY_VERSION_HEX < 0x03000000
1853
    0,   /*nb_coerce*/
1854
#endif
1855
    (unaryfunc)SwigPyObject_long, /*nb_int*/
1856
#if PY_VERSION_HEX < 0x03000000
1857
    (unaryfunc)SwigPyObject_long, /*nb_long*/
1858
#else
1859
    0, /*nb_reserved*/
1860
#endif
1861
    (unaryfunc)0,                 /*nb_float*/
1862
#if PY_VERSION_HEX < 0x03000000
1863
    (unaryfunc)SwigPyObject_oct,  /*nb_oct*/
1864
    (unaryfunc)SwigPyObject_hex,  /*nb_hex*/
1865
#endif
1866
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1867
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1868
#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
1869
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1870
#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
1871
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
1872
#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
1873
    0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
1874
#endif
1875
  };
1876

    
1877
  static PyTypeObject swigpyobject_type;
1878
  static int type_init = 0;
1879
  if (!type_init) {
1880
    const PyTypeObject tmp = {
1881
      /* PyObject header changed in Python 3 */
1882
#if PY_VERSION_HEX >= 0x03000000
1883
      PyVarObject_HEAD_INIT(NULL, 0)
1884
#else
1885
      PyObject_HEAD_INIT(NULL)
1886
      0,                                    /* ob_size */
1887
#endif
1888
      (char *)"SwigPyObject",               /* tp_name */
1889
      sizeof(SwigPyObject),                 /* tp_basicsize */
1890
      0,                                    /* tp_itemsize */
1891
      (destructor)SwigPyObject_dealloc,     /* tp_dealloc */
1892
      (printfunc)SwigPyObject_print,        /* tp_print */
1893
#if PY_VERSION_HEX < 0x02020000
1894
      (getattrfunc)SwigPyObject_getattr,    /* tp_getattr */
1895
#else
1896
      (getattrfunc)0,                       /* tp_getattr */
1897
#endif
1898
      (setattrfunc)0,                       /* tp_setattr */
1899
#if PY_VERSION_HEX >= 0x03000000
1900
    0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1901
#else
1902
      (cmpfunc)SwigPyObject_compare,        /* tp_compare */
1903
#endif
1904
      (reprfunc)SwigPyObject_repr,          /* tp_repr */
1905
      &SwigPyObject_as_number,              /* tp_as_number */
1906
      0,                                    /* tp_as_sequence */
1907
      0,                                    /* tp_as_mapping */
1908
      (hashfunc)0,                          /* tp_hash */
1909
      (ternaryfunc)0,                       /* tp_call */
1910
      (reprfunc)SwigPyObject_str,           /* tp_str */
1911
      PyObject_GenericGetAttr,              /* tp_getattro */
1912
      0,                                    /* tp_setattro */
1913
      0,                                    /* tp_as_buffer */
1914
      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
1915
      swigobject_doc,                       /* tp_doc */
1916
      0,                                    /* tp_traverse */
1917
      0,                                    /* tp_clear */
1918
      (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
1919
      0,                                    /* tp_weaklistoffset */
1920
#if PY_VERSION_HEX >= 0x02020000
1921
      0,                                    /* tp_iter */
1922
      0,                                    /* tp_iternext */
1923
      swigobject_methods,                   /* tp_methods */
1924
      0,                                    /* tp_members */
1925
      0,                                    /* tp_getset */
1926
      0,                                    /* tp_base */
1927
      0,                                    /* tp_dict */
1928
      0,                                    /* tp_descr_get */
1929
      0,                                    /* tp_descr_set */
1930
      0,                                    /* tp_dictoffset */
1931
      0,                                    /* tp_init */
1932
      0,                                    /* tp_alloc */
1933
      0,                                    /* tp_new */
1934
      0,                                    /* tp_free */
1935
      0,                                    /* tp_is_gc */
1936
      0,                                    /* tp_bases */
1937
      0,                                    /* tp_mro */
1938
      0,                                    /* tp_cache */
1939
      0,                                    /* tp_subclasses */
1940
      0,                                    /* tp_weaklist */
1941
#endif
1942
#if PY_VERSION_HEX >= 0x02030000
1943
      0,                                    /* tp_del */
1944
#endif
1945
#if PY_VERSION_HEX >= 0x02060000
1946
      0,                                    /* tp_version */
1947
#endif
1948
#ifdef COUNT_ALLOCS
1949
      0,0,0,0                               /* tp_alloc -> tp_next */
1950
#endif
1951
    };
1952
    swigpyobject_type = tmp;
1953
    type_init = 1;
1954
#if PY_VERSION_HEX < 0x02020000
1955
    swigpyobject_type.ob_type = &PyType_Type;
1956
#else
1957
    if (PyType_Ready(&swigpyobject_type) < 0)
1958
      return NULL;
1959
#endif
1960
  }
1961
  return &swigpyobject_type;
1962
}
1963

    
1964
SWIGRUNTIME PyObject *
1965
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
1966
{
1967
  SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1968
  if (sobj) {
1969
    sobj->ptr  = ptr;
1970
    sobj->ty   = ty;
1971
    sobj->own  = own;
1972
    sobj->next = 0;
1973
  }
1974
  return (PyObject *)sobj;
1975
}
1976

    
1977
/* -----------------------------------------------------------------------------
1978
 * Implements a simple Swig Packed type, and use it instead of string
1979
 * ----------------------------------------------------------------------------- */
1980

    
1981
typedef struct {
1982
  PyObject_HEAD
1983
  void *pack;
1984
  swig_type_info *ty;
1985
  size_t size;
1986
} SwigPyPacked;
1987

    
1988
SWIGRUNTIME int
1989
SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1990
{
1991
  char result[SWIG_BUFFER_SIZE];
1992
  fputs("<Swig Packed ", fp); 
1993
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1994
    fputs("at ", fp); 
1995
    fputs(result, fp); 
1996
  }
1997
  fputs(v->ty->name,fp); 
1998
  fputs(">", fp);
1999
  return 0; 
2000
}
2001
  
2002
SWIGRUNTIME PyObject *
2003
SwigPyPacked_repr(SwigPyPacked *v)
2004
{
2005
  char result[SWIG_BUFFER_SIZE];
2006
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
2007
    return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
2008
  } else {
2009
    return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
2010
  }  
2011
}
2012

    
2013
SWIGRUNTIME PyObject *
2014
SwigPyPacked_str(SwigPyPacked *v)
2015
{
2016
  char result[SWIG_BUFFER_SIZE];
2017
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
2018
    return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
2019
  } else {
2020
    return SWIG_Python_str_FromChar(v->ty->name);
2021
  }  
2022
}
2023

    
2024
SWIGRUNTIME int
2025
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
2026
{
2027
  size_t i = v->size;
2028
  size_t j = w->size;
2029
  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
2030
  return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
2031
}
2032

    
2033
SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
2034

    
2035
SWIGRUNTIME PyTypeObject*
2036
SwigPyPacked_type(void) {
2037
  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
2038
  return type;
2039
}
2040

    
2041
SWIGRUNTIMEINLINE int
2042
SwigPyPacked_Check(PyObject *op) {
2043
  return ((op)->ob_type == SwigPyPacked_TypeOnce()) 
2044
    || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
2045
}
2046

    
2047
SWIGRUNTIME void
2048
SwigPyPacked_dealloc(PyObject *v)
2049
{
2050
  if (SwigPyPacked_Check(v)) {
2051
    SwigPyPacked *sobj = (SwigPyPacked *) v;
2052
    free(sobj->pack);
2053
  }
2054
  PyObject_DEL(v);
2055
}
2056

    
2057
SWIGRUNTIME PyTypeObject*
2058
SwigPyPacked_TypeOnce(void) {
2059
  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
2060
  static PyTypeObject swigpypacked_type;
2061
  static int type_init = 0;
2062
  if (!type_init) {
2063
    const PyTypeObject tmp = {
2064
      /* PyObject header changed in Python 3 */
2065
#if PY_VERSION_HEX>=0x03000000
2066
      PyVarObject_HEAD_INIT(NULL, 0)
2067
#else
2068
      PyObject_HEAD_INIT(NULL)
2069
      0,                                    /* ob_size */
2070
#endif
2071
      (char *)"SwigPyPacked",               /* tp_name */
2072
      sizeof(SwigPyPacked),                 /* tp_basicsize */
2073
      0,                                    /* tp_itemsize */
2074
      (destructor)SwigPyPacked_dealloc,     /* tp_dealloc */
2075
      (printfunc)SwigPyPacked_print,        /* tp_print */
2076
      (getattrfunc)0,                       /* tp_getattr */
2077
      (setattrfunc)0,                       /* tp_setattr */
2078
#if PY_VERSION_HEX>=0x03000000
2079
      0, /* tp_reserved in 3.0.1 */
2080
#else
2081
      (cmpfunc)SwigPyPacked_compare,        /* tp_compare */
2082
#endif
2083
      (reprfunc)SwigPyPacked_repr,          /* tp_repr */
2084
      0,                                    /* tp_as_number */
2085
      0,                                    /* tp_as_sequence */
2086
      0,                                    /* tp_as_mapping */
2087
      (hashfunc)0,                          /* tp_hash */
2088
      (ternaryfunc)0,                       /* tp_call */
2089
      (reprfunc)SwigPyPacked_str,           /* tp_str */
2090
      PyObject_GenericGetAttr,              /* tp_getattro */
2091
      0,                                    /* tp_setattro */
2092
      0,                                    /* tp_as_buffer */
2093
      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
2094
      swigpacked_doc,                       /* tp_doc */
2095
      0,                                    /* tp_traverse */
2096
      0,                                    /* tp_clear */
2097
      0,                                    /* tp_richcompare */
2098
      0,                                    /* tp_weaklistoffset */
2099
#if PY_VERSION_HEX >= 0x02020000
2100
      0,                                    /* tp_iter */
2101
      0,                                    /* tp_iternext */
2102
      0,                                    /* tp_methods */
2103
      0,                                    /* tp_members */
2104
      0,                                    /* tp_getset */
2105
      0,                                    /* tp_base */
2106
      0,                                    /* tp_dict */
2107
      0,                                    /* tp_descr_get */
2108
      0,                                    /* tp_descr_set */
2109
      0,                                    /* tp_dictoffset */
2110
      0,                                    /* tp_init */
2111
      0,                                    /* tp_alloc */
2112
      0,                                    /* tp_new */
2113
      0,                                    /* tp_free */
2114
      0,                                    /* tp_is_gc */
2115
      0,                                    /* tp_bases */
2116
      0,                                    /* tp_mro */
2117
      0,                                    /* tp_cache */
2118
      0,                                    /* tp_subclasses */
2119
      0,                                    /* tp_weaklist */
2120
#endif
2121
#if PY_VERSION_HEX >= 0x02030000
2122
      0,                                    /* tp_del */
2123
#endif
2124
#if PY_VERSION_HEX >= 0x02060000
2125
      0,                                    /* tp_version */
2126
#endif
2127
#ifdef COUNT_ALLOCS
2128
      0,0,0,0                               /* tp_alloc -> tp_next */
2129
#endif
2130
    };
2131
    swigpypacked_type = tmp;
2132
    type_init = 1;
2133
#if PY_VERSION_HEX < 0x02020000
2134
    swigpypacked_type.ob_type = &PyType_Type;
2135
#else
2136
    if (PyType_Ready(&swigpypacked_type) < 0)
2137
      return NULL;
2138
#endif
2139
  }
2140
  return &swigpypacked_type;
2141
}
2142

    
2143
SWIGRUNTIME PyObject *
2144
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
2145
{
2146
  SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
2147
  if (sobj) {
2148
    void *pack = malloc(size);
2149
    if (pack) {
2150
      memcpy(pack, ptr, size);
2151
      sobj->pack = pack;
2152
      sobj->ty   = ty;
2153
      sobj->size = size;
2154
    } else {
2155
      PyObject_DEL((PyObject *) sobj);
2156
      sobj = 0;
2157
    }
2158
  }
2159
  return (PyObject *) sobj;
2160
}
2161

    
2162
SWIGRUNTIME swig_type_info *
2163
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
2164
{
2165
  if (SwigPyPacked_Check(obj)) {
2166
    SwigPyPacked *sobj = (SwigPyPacked *)obj;
2167
    if (sobj->size != size) return 0;
2168
    memcpy(ptr, sobj->pack, size);
2169
    return sobj->ty;
2170
  } else {
2171
    return 0;
2172
  }
2173
}
2174

    
2175
/* -----------------------------------------------------------------------------
2176
 * pointers/data manipulation
2177
 * ----------------------------------------------------------------------------- */
2178

    
2179
SWIGRUNTIMEINLINE PyObject *
2180
_SWIG_This(void)
2181
{
2182
    return SWIG_Python_str_FromChar("this");
2183
}
2184

    
2185
static PyObject *swig_this = NULL;
2186

    
2187
SWIGRUNTIME PyObject *
2188
SWIG_This(void)
2189
{
2190
  if (swig_this == NULL)
2191
    swig_this = _SWIG_This();
2192
  return swig_this;
2193
}
2194

    
2195
/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
2196

    
2197
/* TODO: I don't know how to implement the fast getset in Python 3 right now */
2198
#if PY_VERSION_HEX>=0x03000000
2199
#define SWIG_PYTHON_SLOW_GETSET_THIS 
2200
#endif
2201

    
2202
SWIGRUNTIME SwigPyObject *
2203
SWIG_Python_GetSwigThis(PyObject *pyobj) 
2204
{
2205
  PyObject *obj;
2206

    
2207
  if (SwigPyObject_Check(pyobj))
2208
    return (SwigPyObject *) pyobj;
2209

    
2210
#ifdef SWIGPYTHON_BUILTIN
2211
  (void)obj;
2212
# ifdef PyWeakref_CheckProxy
2213
  if (PyWeakref_CheckProxy(pyobj)) {
2214
    pyobj = PyWeakref_GET_OBJECT(pyobj);
2215
    if (pyobj && SwigPyObject_Check(pyobj))
2216
      return (SwigPyObject*) pyobj;
2217
  }
2218
# endif
2219
  return NULL;
2220
#else
2221

    
2222
  obj = 0;
2223

    
2224
#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
2225
  if (PyInstance_Check(pyobj)) {
2226
    obj = _PyInstance_Lookup(pyobj, SWIG_This());      
2227
  } else {
2228
    PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2229
    if (dictptr != NULL) {
2230
      PyObject *dict = *dictptr;
2231
      obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
2232
    } else {
2233
#ifdef PyWeakref_CheckProxy
2234
      if (PyWeakref_CheckProxy(pyobj)) {
2235
        PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2236
        return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2237
      }
2238
#endif
2239
      obj = PyObject_GetAttr(pyobj,SWIG_This());
2240
      if (obj) {
2241
        Py_DECREF(obj);
2242
      } else {
2243
        if (PyErr_Occurred()) PyErr_Clear();
2244
        return 0;
2245
      }
2246
    }
2247
  }
2248
#else
2249
  obj = PyObject_GetAttr(pyobj,SWIG_This());
2250
  if (obj) {
2251
    Py_DECREF(obj);
2252
  } else {
2253
    if (PyErr_Occurred()) PyErr_Clear();
2254
    return 0;
2255
  }
2256
#endif
2257
  if (obj && !SwigPyObject_Check(obj)) {
2258
    /* a PyObject is called 'this', try to get the 'real this'
2259
       SwigPyObject from it */ 
2260
    return SWIG_Python_GetSwigThis(obj);
2261
  }
2262
  return (SwigPyObject *)obj;
2263
#endif
2264
}
2265

    
2266
/* Acquire a pointer value */
2267

    
2268
SWIGRUNTIME int
2269
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2270
  if (own == SWIG_POINTER_OWN) {
2271
    SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2272
    if (sobj) {
2273
      int oldown = sobj->own;
2274
      sobj->own = own;
2275
      return oldown;
2276
    }
2277
  }
2278
  return 0;
2279
}
2280

    
2281
/* Convert a pointer value */
2282

    
2283
SWIGRUNTIME int
2284
SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2285
  int res;
2286
  SwigPyObject *sobj;
2287

    
2288
  if (!obj)
2289
    return SWIG_ERROR;
2290
  if (obj == Py_None) {
2291
    if (ptr)
2292
      *ptr = 0;
2293
    return SWIG_OK;
2294
  }
2295

    
2296
  res = SWIG_ERROR;
2297

    
2298
  sobj = SWIG_Python_GetSwigThis(obj);
2299
  if (own)
2300
    *own = 0;
2301
  while (sobj) {
2302
    void *vptr = sobj->ptr;
2303
    if (ty) {
2304
      swig_type_info *to = sobj->ty;
2305
      if (to == ty) {
2306
        /* no type cast needed */
2307
        if (ptr) *ptr = vptr;
2308
        break;
2309
      } else {
2310
        swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2311
        if (!tc) {
2312
          sobj = (SwigPyObject *)sobj->next;
2313
        } else {
2314
          if (ptr) {
2315
            int newmemory = 0;
2316
            *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2317
            if (newmemory == SWIG_CAST_NEW_MEMORY) {
2318
              assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2319
              if (own)
2320
                *own = *own | SWIG_CAST_NEW_MEMORY;
2321
            }
2322
          }
2323
          break;
2324
        }
2325
      }
2326
    } else {
2327
      if (ptr) *ptr = vptr;
2328
      break;
2329
    }
2330
  }
2331
  if (sobj) {
2332
    if (own)
2333
      *own = *own | sobj->own;
2334
    if (flags & SWIG_POINTER_DISOWN) {
2335
      sobj->own = 0;
2336
    }
2337
    res = SWIG_OK;
2338
  } else {
2339
    if (flags & SWIG_POINTER_IMPLICIT_CONV) {
2340
      SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2341
      if (data && !data->implicitconv) {
2342
        PyObject *klass = data->klass;
2343
        if (klass) {
2344
          PyObject *impconv;
2345
          data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2346
          impconv = SWIG_Python_CallFunctor(klass, obj);
2347
          data->implicitconv = 0;
2348
          if (PyErr_Occurred()) {
2349
            PyErr_Clear();
2350
            impconv = 0;
2351
          }
2352
          if (impconv) {
2353
            SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2354
            if (iobj) {
2355
              void *vptr;
2356
              res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2357
              if (SWIG_IsOK(res)) {
2358
                if (ptr) {
2359
                  *ptr = vptr;
2360
                  /* transfer the ownership to 'ptr' */
2361
                  iobj->own = 0;
2362
                  res = SWIG_AddCast(res);
2363
                  res = SWIG_AddNewMask(res);
2364
                } else {
2365
                  res = SWIG_AddCast(res);                    
2366
                }
2367
              }
2368
            }
2369
            Py_DECREF(impconv);
2370
          }
2371
        }
2372
      }
2373
    }
2374
  }
2375
  return res;
2376
}
2377

    
2378
/* Convert a function ptr value */
2379

    
2380
SWIGRUNTIME int
2381
SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2382
  if (!PyCFunction_Check(obj)) {
2383
    return SWIG_ConvertPtr(obj, ptr, ty, 0);
2384
  } else {
2385
    void *vptr = 0;
2386
    
2387
    /* here we get the method pointer for callbacks */
2388
    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2389
    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2390
    if (desc)
2391
      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2392
    if (!desc) 
2393
      return SWIG_ERROR;
2394
    if (ty) {
2395
      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
2396
      if (tc) {
2397
        int newmemory = 0;
2398
        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2399
        assert(!newmemory); /* newmemory handling not yet implemented */
2400
      } else {
2401
        return SWIG_ERROR;
2402
      }
2403
    } else {
2404
      *ptr = vptr;
2405
    }
2406
    return SWIG_OK;
2407
  }
2408
}
2409

    
2410
/* Convert a packed value value */
2411

    
2412
SWIGRUNTIME int
2413
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2414
  swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2415
  if (!to) return SWIG_ERROR;
2416
  if (ty) {
2417
    if (to != ty) {
2418
      /* check type cast? */
2419
      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2420
      if (!tc) return SWIG_ERROR;
2421
    }
2422
  }
2423
  return SWIG_OK;
2424
}  
2425

    
2426
/* -----------------------------------------------------------------------------
2427
 * Create a new pointer object
2428
 * ----------------------------------------------------------------------------- */
2429

    
2430
/*
2431
  Create a new instance object, without calling __init__, and set the
2432
  'this' attribute.
2433
*/
2434

    
2435
SWIGRUNTIME PyObject* 
2436
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
2437
{
2438
#if (PY_VERSION_HEX >= 0x02020000)
2439
  PyObject *inst = 0;
2440
  PyObject *newraw = data->newraw;
2441
  if (newraw) {
2442
    inst = PyObject_Call(newraw, data->newargs, NULL);
2443
    if (inst) {
2444
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2445
      PyObject **dictptr = _PyObject_GetDictPtr(inst);
2446
      if (dictptr != NULL) {
2447
        PyObject *dict = *dictptr;
2448
        if (dict == NULL) {
2449
          dict = PyDict_New();
2450
          *dictptr = dict;
2451
          PyDict_SetItem(dict, SWIG_This(), swig_this);
2452
        }
2453
      }
2454
#else
2455
      PyObject *key = SWIG_This();
2456
      PyObject_SetAttr(inst, key, swig_this);
2457
#endif
2458
    }
2459
  } else {
2460
#if PY_VERSION_HEX >= 0x03000000
2461
    inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
2462
    PyObject_SetAttr(inst, SWIG_This(), swig_this);
2463
    Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2464
#else
2465
    PyObject *dict = PyDict_New();
2466
    PyDict_SetItem(dict, SWIG_This(), swig_this);
2467
    inst = PyInstance_NewRaw(data->newargs, dict);
2468
    Py_DECREF(dict);
2469
#endif
2470
  }
2471
  return inst;
2472
#else
2473
#if (PY_VERSION_HEX >= 0x02010000)
2474
  PyObject *inst;
2475
  PyObject *dict = PyDict_New();
2476
  PyDict_SetItem(dict, SWIG_This(), swig_this);
2477
  inst = PyInstance_NewRaw(data->newargs, dict);
2478
  Py_DECREF(dict);
2479
  return (PyObject *) inst;
2480
#else
2481
  PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
2482
  if (inst == NULL) {
2483
    return NULL;
2484
  }
2485
  inst->in_class = (PyClassObject *)data->newargs;
2486
  Py_INCREF(inst->in_class);
2487
  inst->in_dict = PyDict_New();
2488
  if (inst->in_dict == NULL) {
2489
    Py_DECREF(inst);
2490
    return NULL;
2491
  }
2492
#ifdef Py_TPFLAGS_HAVE_WEAKREFS
2493
  inst->in_weakreflist = NULL;
2494
#endif
2495
#ifdef Py_TPFLAGS_GC
2496
  PyObject_GC_Init(inst);
2497
#endif
2498
  PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
2499
  return (PyObject *) inst;
2500
#endif
2501
#endif
2502
}
2503

    
2504
SWIGRUNTIME void
2505
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2506
{
2507
 PyObject *dict;
2508
#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2509
 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2510
 if (dictptr != NULL) {
2511
   dict = *dictptr;
2512
   if (dict == NULL) {
2513
     dict = PyDict_New();
2514
     *dictptr = dict;
2515
   }
2516
   PyDict_SetItem(dict, SWIG_This(), swig_this);
2517
   return;
2518
 }
2519
#endif
2520
 dict = PyObject_GetAttrString(inst, (char*)"__dict__");
2521
 PyDict_SetItem(dict, SWIG_This(), swig_this);
2522
 Py_DECREF(dict);
2523
} 
2524

    
2525

    
2526
SWIGINTERN PyObject *
2527
SWIG_Python_InitShadowInstance(PyObject *args) {
2528
  PyObject *obj[2];
2529
  if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
2530
    return NULL;
2531
  } else {
2532
    SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2533
    if (sthis) {
2534
      SwigPyObject_append((PyObject*) sthis, obj[1]);
2535
    } else {
2536
      SWIG_Python_SetSwigThis(obj[0], obj[1]);
2537
    }
2538
    return SWIG_Py_Void();
2539
  }
2540
}
2541

    
2542
/* Create a new pointer object */
2543

    
2544
SWIGRUNTIME PyObject *
2545
SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2546
  SwigPyClientData *clientdata;
2547
  PyObject * robj;
2548
  int own;
2549

    
2550
  if (!ptr)
2551
    return SWIG_Py_Void();
2552

    
2553
  clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2554
  own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2555
  if (clientdata && clientdata->pytype) {
2556
    SwigPyObject *newobj;
2557
    if (flags & SWIG_BUILTIN_TP_INIT) {
2558
      newobj = (SwigPyObject*) self;
2559
      if (newobj->ptr) {
2560
        PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2561
        while (newobj->next)
2562
          newobj = (SwigPyObject *) newobj->next;
2563
        newobj->next = next_self;
2564
        newobj = (SwigPyObject *)next_self;
2565
      }
2566
    } else {
2567
      newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2568
    }
2569
    if (newobj) {
2570
      newobj->ptr = ptr;
2571
      newobj->ty = type;
2572
      newobj->own = own;
2573
      newobj->next = 0;
2574
#ifdef SWIGPYTHON_BUILTIN
2575
      newobj->dict = 0;
2576
#endif
2577
      return (PyObject*) newobj;
2578
    }
2579
    return SWIG_Py_Void();
2580
  }
2581

    
2582
  assert(!(flags & SWIG_BUILTIN_TP_INIT));
2583

    
2584
  robj = SwigPyObject_New(ptr, type, own);
2585
  if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2586
    PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2587
    if (inst) {
2588
      Py_DECREF(robj);
2589
      robj = inst;
2590
    }
2591
  }
2592
  return robj;
2593
}
2594

    
2595
/* Create a new packed object */
2596

    
2597
SWIGRUNTIMEINLINE PyObject *
2598
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2599
  return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2600
}
2601

    
2602
/* -----------------------------------------------------------------------------*
2603
 *  Get type list 
2604
 * -----------------------------------------------------------------------------*/
2605

    
2606
#ifdef SWIG_LINK_RUNTIME
2607
void *SWIG_ReturnGlobalTypeList(void *);
2608
#endif
2609

    
2610
SWIGRUNTIME swig_module_info *
2611
SWIG_Python_GetModule(void) {
2612
  static void *type_pointer = (void *)0;
2613
  /* first check if module already created */
2614
  if (!type_pointer) {
2615
#ifdef SWIG_LINK_RUNTIME
2616
    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2617
#else
2618
# ifdef SWIGPY_USE_CAPSULE
2619
    type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2620
# else
2621
    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2622
                                    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
2623
# endif
2624
    if (PyErr_Occurred()) {
2625
      PyErr_Clear();
2626
      type_pointer = (void *)0;
2627
    }
2628
#endif
2629
  }
2630
  return (swig_module_info *) type_pointer;
2631
}
2632

    
2633
#if PY_MAJOR_VERSION < 2
2634
/* PyModule_AddObject function was introduced in Python 2.0.  The following function
2635
   is copied out of Python/modsupport.c in python version 2.3.4 */
2636
SWIGINTERN int
2637
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
2638
{
2639
  PyObject *dict;
2640
  if (!PyModule_Check(m)) {
2641
    PyErr_SetString(PyExc_TypeError,
2642
                    "PyModule_AddObject() needs module as first arg");
2643
    return SWIG_ERROR;
2644
  }
2645
  if (!o) {
2646
    PyErr_SetString(PyExc_TypeError,
2647
                    "PyModule_AddObject() needs non-NULL value");
2648
    return SWIG_ERROR;
2649
  }
2650
  
2651
  dict = PyModule_GetDict(m);
2652
  if (dict == NULL) {
2653
    /* Internal error -- modules must have a dict! */
2654
    PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
2655
                 PyModule_GetName(m));
2656
    return SWIG_ERROR;
2657
  }
2658
  if (PyDict_SetItemString(dict, name, o))
2659
    return SWIG_ERROR;
2660
  Py_DECREF(o);
2661
  return SWIG_OK;
2662
}
2663
#endif
2664

    
2665
SWIGRUNTIME void
2666
#ifdef SWIGPY_USE_CAPSULE
2667
SWIG_Python_DestroyModule(PyObject *obj)
2668
#else
2669
SWIG_Python_DestroyModule(void *vptr)
2670
#endif
2671
{
2672
#ifdef SWIGPY_USE_CAPSULE
2673
  swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2674
#else
2675
  swig_module_info *swig_module = (swig_module_info *) vptr;
2676
#endif
2677
  swig_type_info **types = swig_module->types;
2678
  size_t i;
2679
  for (i =0; i < swig_module->size; ++i) {
2680
    swig_type_info *ty = types[i];
2681
    if (ty->owndata) {
2682
      SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
2683
      if (data) SwigPyClientData_Del(data);
2684
    }
2685
  }
2686
  Py_DECREF(SWIG_This());
2687
  swig_this = NULL;
2688
}
2689

    
2690
SWIGRUNTIME void
2691
SWIG_Python_SetModule(swig_module_info *swig_module) {
2692
#if PY_VERSION_HEX >= 0x03000000
2693
 /* Add a dummy module object into sys.modules */
2694
  PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
2695
#else
2696
  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2697
  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2698
#endif
2699
#ifdef SWIGPY_USE_CAPSULE
2700
  PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2701
  if (pointer && module) {
2702
    PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2703
  } else {
2704
    Py_XDECREF(pointer);
2705
  }
2706
#else
2707
  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
2708
  if (pointer && module) {
2709
    PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
2710
  } else {
2711
    Py_XDECREF(pointer);
2712
  }
2713
#endif
2714
}
2715

    
2716
/* The python cached type query */
2717
SWIGRUNTIME PyObject *
2718
SWIG_Python_TypeCache(void) {
2719
  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2720
  return cache;
2721
}
2722

    
2723
SWIGRUNTIME swig_type_info *
2724
SWIG_Python_TypeQuery(const char *type)
2725
{
2726
  PyObject *cache = SWIG_Python_TypeCache();
2727
  PyObject *key = SWIG_Python_str_FromChar(type); 
2728
  PyObject *obj = PyDict_GetItem(cache, key);
2729
  swig_type_info *descriptor;
2730
  if (obj) {
2731
#ifdef SWIGPY_USE_CAPSULE
2732
    descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2733
#else
2734
    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
2735
#endif
2736
  } else {
2737
    swig_module_info *swig_module = SWIG_Python_GetModule();
2738
    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2739
    if (descriptor) {
2740
#ifdef SWIGPY_USE_CAPSULE
2741
      obj = PyCapsule_New((void*) descriptor, NULL, NULL);
2742
#else
2743
      obj = PyCObject_FromVoidPtr(descriptor, NULL);
2744
#endif
2745
      PyDict_SetItem(cache, key, obj);
2746
      Py_DECREF(obj);
2747
    }
2748
  }
2749
  Py_DECREF(key);
2750
  return descriptor;
2751
}
2752

    
2753
/* 
2754
   For backward compatibility only
2755
*/
2756
#define SWIG_POINTER_EXCEPTION  0
2757
#define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
2758
#define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)
2759

    
2760
SWIGRUNTIME int
2761
SWIG_Python_AddErrMesg(const char* mesg, int infront)
2762
{  
2763
  if (PyErr_Occurred()) {
2764
    PyObject *type = 0;
2765
    PyObject *value = 0;
2766
    PyObject *traceback = 0;
2767
    PyErr_Fetch(&type, &value, &traceback);
2768
    if (value) {
2769
      char *tmp;
2770
      PyObject *old_str = PyObject_Str(value);
2771
      Py_XINCREF(type);
2772
      PyErr_Clear();
2773
      if (infront) {
2774
        PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
2775
      } else {
2776
        PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
2777
      }
2778
      SWIG_Python_str_DelForPy3(tmp);
2779
      Py_DECREF(old_str);
2780
    }
2781
    return 1;
2782
  } else {
2783
    return 0;
2784
  }
2785
}
2786
  
2787
SWIGRUNTIME int
2788
SWIG_Python_ArgFail(int argnum)
2789
{
2790
  if (PyErr_Occurred()) {
2791
    /* add information about failing argument */
2792
    char mesg[256];
2793
    PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2794
    return SWIG_Python_AddErrMesg(mesg, 1);
2795
  } else {
2796
    return 0;
2797
  }
2798
}
2799

    
2800
SWIGRUNTIMEINLINE const char *
2801
SwigPyObject_GetDesc(PyObject *self)
2802
{
2803
  SwigPyObject *v = (SwigPyObject *)self;
2804
  swig_type_info *ty = v ? v->ty : 0;
2805
  return ty ? ty->str : "";
2806
}
2807

    
2808
SWIGRUNTIME void
2809
SWIG_Python_TypeError(const char *type, PyObject *obj)
2810
{
2811
  if (type) {
2812
#if defined(SWIG_COBJECT_TYPES)
2813
    if (obj && SwigPyObject_Check(obj)) {
2814
      const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2815
      if (otype) {
2816
        PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2817
                     type, otype);
2818
        return;
2819
      }
2820
    } else 
2821
#endif      
2822
    {
2823
      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
2824
      if (otype) {
2825
        PyObject *str = PyObject_Str(obj);
2826
        const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2827
        if (cstr) {
2828
          PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2829
                       type, otype, cstr);
2830
          SWIG_Python_str_DelForPy3(cstr);
2831
        } else {
2832
          PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2833
                       type, otype);
2834
        }
2835
        Py_XDECREF(str);
2836
        return;
2837
      }
2838
    }   
2839
    PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2840
  } else {
2841
    PyErr_Format(PyExc_TypeError, "unexpected type is received");
2842
  }
2843
}
2844

    
2845

    
2846
/* Convert a pointer value, signal an exception on a type mismatch */
2847
SWIGRUNTIME void *
2848
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
2849
  void *result;
2850
  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2851
    PyErr_Clear();
2852
#if SWIG_POINTER_EXCEPTION
2853
    if (flags) {
2854
      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2855
      SWIG_Python_ArgFail(argnum);
2856
    }
2857
#endif
2858
  }
2859
  return result;
2860
}
2861

    
2862
#ifdef SWIGPYTHON_BUILTIN
2863
SWIGRUNTIME int
2864
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
2865
  PyTypeObject *tp = obj->ob_type;
2866
  PyObject *descr;
2867
  PyObject *encoded_name;
2868
  descrsetfunc f;
2869
  int res;
2870

    
2871
# ifdef Py_USING_UNICODE
2872
  if (PyString_Check(name)) {
2873
    name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2874
    if (!name)
2875
      return -1;
2876
  } else if (!PyUnicode_Check(name))
2877
# else
2878
  if (!PyString_Check(name))
2879
# endif
2880
  {
2881
    PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2882
    return -1;
2883
  } else {
2884
    Py_INCREF(name);
2885
  }
2886

    
2887
  if (!tp->tp_dict) {
2888
    if (PyType_Ready(tp) < 0)
2889
      goto done;
2890
  }
2891

    
2892
  res = -1;
2893
  descr = _PyType_Lookup(tp, name);
2894
  f = NULL;
2895
  if (descr != NULL)
2896
    f = descr->ob_type->tp_descr_set;
2897
  if (!f) {
2898
    if (PyString_Check(name)) {
2899
      encoded_name = name;
2900
      Py_INCREF(name);
2901
    } else {
2902
      encoded_name = PyUnicode_AsUTF8String(name);
2903
    }
2904
    PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2905
    Py_DECREF(encoded_name);
2906
  } else {
2907
    res = f(descr, obj, value);
2908
  }
2909
  
2910
  done:
2911
  Py_DECREF(name);
2912
  return res;
2913
}
2914
#endif
2915

    
2916

    
2917
#ifdef __cplusplus
2918
}
2919
#endif
2920

    
2921

    
2922

    
2923
#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
2924

    
2925
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
2926

    
2927

    
2928

    
2929
/* -------- TYPES TABLE (BEGIN) -------- */
2930

    
2931
#define SWIGTYPE_p_char swig_types[0]
2932
static swig_type_info *swig_types[2];
2933
static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
2934
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2935
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2936

    
2937
/* -------- TYPES TABLE (END) -------- */
2938

    
2939
#if (PY_VERSION_HEX <= 0x02000000)
2940
# if !defined(SWIG_PYTHON_CLASSIC)
2941
#  error "This python version requires swig to be run with the '-classic' option"
2942
# endif
2943
#endif
2944

    
2945
/*-----------------------------------------------
2946
              @(target):= _hello.so
2947
  ------------------------------------------------*/
2948
#if PY_VERSION_HEX >= 0x03000000
2949
#  define SWIG_init    PyInit__hello
2950

    
2951
#else
2952
#  define SWIG_init    init_hello
2953

    
2954
#endif
2955
#define SWIG_name    "_hello"
2956

    
2957
#define SWIGVERSION 0x020007 
2958
#define SWIG_VERSION SWIGVERSION
2959

    
2960

    
2961
#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
2962
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
2963

    
2964

    
2965
SWIGINTERN swig_type_info*
2966
SWIG_pchar_descriptor(void)
2967
{
2968
  static int init = 0;
2969
  static swig_type_info* info = 0;
2970
  if (!init) {
2971
    info = SWIG_TypeQuery("_p_char");
2972
    init = 1;
2973
  }
2974
  return info;
2975
}
2976

    
2977

    
2978
SWIGINTERN int
2979
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
2980
{
2981
#if PY_VERSION_HEX>=0x03000000
2982
  if (PyUnicode_Check(obj))
2983
#else  
2984
  if (PyString_Check(obj))
2985
#endif
2986
  {
2987
    char *cstr; Py_ssize_t len;
2988
#if PY_VERSION_HEX>=0x03000000
2989
    if (!alloc && cptr) {
2990
        /* We can't allow converting without allocation, since the internal
2991
           representation of string in Python 3 is UCS-2/UCS-4 but we require
2992
           a UTF-8 representation.
2993
           TODO(bhy) More detailed explanation */
2994
        return SWIG_RuntimeError;
2995
    }
2996
    obj = PyUnicode_AsUTF8String(obj);
2997
    PyBytes_AsStringAndSize(obj, &cstr, &len);
2998
    if(alloc) *alloc = SWIG_NEWOBJ;
2999
#else
3000
    PyString_AsStringAndSize(obj, &cstr, &len);
3001
#endif
3002
    if (cptr) {
3003
      if (alloc) {
3004
        /* 
3005
           In python the user should not be able to modify the inner
3006
           string representation. To warranty that, if you define
3007
           SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
3008
           buffer is always returned.
3009

3010
           The default behavior is just to return the pointer value,
3011
           so, be careful.
3012
        */ 
3013
#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
3014
        if (*alloc != SWIG_OLDOBJ) 
3015
#else
3016
        if (*alloc == SWIG_NEWOBJ) 
3017
#endif
3018
          {
3019
            *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
3020
            *alloc = SWIG_NEWOBJ;
3021
          }
3022
        else {
3023
          *cptr = cstr;
3024
          *alloc = SWIG_OLDOBJ;
3025
        }
3026
      } else {
3027
        #if PY_VERSION_HEX>=0x03000000
3028
        assert(0); /* Should never reach here in Python 3 */
3029
        #endif
3030
        *cptr = SWIG_Python_str_AsChar(obj);
3031
      }
3032
    }
3033
    if (psize) *psize = len + 1;
3034
#if PY_VERSION_HEX>=0x03000000
3035
    Py_XDECREF(obj);
3036
#endif
3037
    return SWIG_OK;
3038
  } else {
3039
    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
3040
    if (pchar_descriptor) {
3041
      void* vptr = 0;
3042
      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
3043
        if (cptr) *cptr = (char *) vptr;
3044
        if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
3045
        if (alloc) *alloc = SWIG_OLDOBJ;
3046
        return SWIG_OK;
3047
      }
3048
    }
3049
  }
3050
  return SWIG_TypeError;
3051
}
3052

    
3053

    
3054

    
3055

    
3056
#ifdef __cplusplus
3057
extern "C" {
3058
#endif
3059
SWIGINTERN PyObject *_wrap_say_hello(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3060
  PyObject *resultobj = 0;
3061
  char *arg1 = (char *) 0 ;
3062
  int res1 ;
3063
  char *buf1 = 0 ;
3064
  int alloc1 = 0 ;
3065
  PyObject * obj0 = 0 ;
3066
  
3067
  if (!PyArg_ParseTuple(args,(char *)"O:say_hello",&obj0)) SWIG_fail;
3068
  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
3069
  if (!SWIG_IsOK(res1)) {
3070
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "say_hello" "', argument " "1"" of type '" "char const *""'");
3071
  }
3072
  arg1 = (char *)(buf1);
3073
  say_hello((char const *)arg1);
3074
  resultobj = SWIG_Py_Void();
3075
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3076
  return resultobj;
3077
fail:
3078
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3079
  return NULL;
3080
}
3081

    
3082

    
3083
static PyMethodDef SwigMethods[] = {
3084
         { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
3085
         { (char *)"say_hello", _wrap_say_hello, METH_VARARGS, NULL},
3086
         { NULL, NULL, 0, NULL }
3087
};
3088

    
3089

    
3090
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3091

    
3092
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
3093

    
3094
static swig_type_info *swig_type_initial[] = {
3095
  &_swigt__p_char,
3096
};
3097

    
3098
static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
3099

    
3100
static swig_cast_info *swig_cast_initial[] = {
3101
  _swigc__p_char,
3102
};
3103

    
3104

    
3105
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3106

    
3107
static swig_const_info swig_const_table[] = {
3108
{0, 0, 0, 0.0, 0, 0}};
3109

    
3110
#ifdef __cplusplus
3111
}
3112
#endif
3113
/* -----------------------------------------------------------------------------
3114
 * Type initialization:
3115
 * This problem is tough by the requirement that no dynamic 
3116
 * memory is used. Also, since swig_type_info structures store pointers to 
3117
 * swig_cast_info structures and swig_cast_info structures store pointers back
3118
 * to swig_type_info structures, we need some lookup code at initialization. 
3119
 * The idea is that swig generates all the structures that are needed. 
3120
 * The runtime then collects these partially filled structures. 
3121
 * The SWIG_InitializeModule function takes these initial arrays out of 
3122
 * swig_module, and does all the lookup, filling in the swig_module.types
3123
 * array with the correct data and linking the correct swig_cast_info
3124
 * structures together.
3125
 *
3126
 * The generated swig_type_info structures are assigned staticly to an initial 
3127
 * array. We just loop through that array, and handle each type individually.
3128
 * First we lookup if this type has been already loaded, and if so, use the
3129
 * loaded structure instead of the generated one. Then we have to fill in the
3130
 * cast linked list. The cast data is initially stored in something like a
3131
 * two-dimensional array. Each row corresponds to a type (there are the same
3132
 * number of rows as there are in the swig_type_initial array). Each entry in
3133
 * a column is one of the swig_cast_info structures for that type.
3134
 * The cast_initial array is actually an array of arrays, because each row has
3135
 * a variable number of columns. So to actually build the cast linked list,
3136
 * we find the array of casts associated with the type, and loop through it 
3137
 * adding the casts to the list. The one last trick we need to do is making
3138
 * sure the type pointer in the swig_cast_info struct is correct.
3139
 *
3140
 * First off, we lookup the cast->type name to see if it is already loaded. 
3141
 * There are three cases to handle:
3142
 *  1) If the cast->type has already been loaded AND the type we are adding
3143
 *     casting info to has not been loaded (it is in this module), THEN we
3144
 *     replace the cast->type pointer with the type pointer that has already
3145
 *     been loaded.
3146
 *  2) If BOTH types (the one we are adding casting info to, and the 
3147
 *     cast->type) are loaded, THEN the cast info has already been loaded by
3148
 *     the previous module so we just ignore it.
3149
 *  3) Finally, if cast->type has not already been loaded, then we add that
3150
 *     swig_cast_info to the linked list (because the cast->type) pointer will
3151
 *     be correct.
3152
 * ----------------------------------------------------------------------------- */
3153

    
3154
#ifdef __cplusplus
3155
extern "C" {
3156
#if 0
3157
} /* c-mode */
3158
#endif
3159
#endif
3160

    
3161
#if 0
3162
#define SWIGRUNTIME_DEBUG
3163
#endif
3164

    
3165

    
3166
SWIGRUNTIME void
3167
SWIG_InitializeModule(void *clientdata) {
3168
  size_t i;
3169
  swig_module_info *module_head, *iter;
3170
  int found, init;
3171
  
3172
  clientdata = clientdata;
3173
  
3174
  /* check to see if the circular list has been setup, if not, set it up */
3175
  if (swig_module.next==0) {
3176
    /* Initialize the swig_module */
3177
    swig_module.type_initial = swig_type_initial;
3178
    swig_module.cast_initial = swig_cast_initial;
3179
    swig_module.next = &swig_module;
3180
    init = 1;
3181
  } else {
3182
    init = 0;
3183
  }
3184
  
3185
  /* Try and load any already created modules */
3186
  module_head = SWIG_GetModule(clientdata);
3187
  if (!module_head) {
3188
    /* This is the first module loaded for this interpreter */
3189
    /* so set the swig module into the interpreter */
3190
    SWIG_SetModule(clientdata, &swig_module);
3191
    module_head = &swig_module;
3192
  } else {
3193
    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3194
    found=0;
3195
    iter=module_head;
3196
    do {
3197
      if (iter==&swig_module) {
3198
        found=1;
3199
        break;
3200
      }
3201
      iter=iter->next;
3202
    } while (iter!= module_head);
3203
    
3204
    /* if the is found in the list, then all is done and we may leave */
3205
    if (found) return;
3206
    /* otherwise we must add out module into the list */
3207
    swig_module.next = module_head->next;
3208
    module_head->next = &swig_module;
3209
  }
3210
  
3211
  /* When multiple interpeters are used, a module could have already been initialized in
3212
       a different interpreter, but not yet have a pointer in this interpreter.
3213
       In this case, we do not want to continue adding types... everything should be
3214
       set up already */
3215
  if (init == 0) return;
3216
  
3217
  /* Now work on filling in swig_module.types */
3218
#ifdef SWIGRUNTIME_DEBUG
3219
  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
3220
#endif
3221
  for (i = 0; i < swig_module.size; ++i) {
3222
    swig_type_info *type = 0;
3223
    swig_type_info *ret;
3224
    swig_cast_info *cast;
3225
    
3226
#ifdef SWIGRUNTIME_DEBUG
3227
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3228
#endif
3229
    
3230
    /* if there is another module already loaded */
3231
    if (swig_module.next != &swig_module) {
3232
      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3233
    }
3234
    if (type) {
3235
      /* Overwrite clientdata field */
3236
#ifdef SWIGRUNTIME_DEBUG
3237
      printf("SWIG_InitializeModule: found type %s\n", type->name);
3238
#endif
3239
      if (swig_module.type_initial[i]->clientdata) {
3240
        type->clientdata = swig_module.type_initial[i]->clientdata;
3241
#ifdef SWIGRUNTIME_DEBUG
3242
        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3243
#endif
3244
      }
3245
    } else {
3246
      type = swig_module.type_initial[i];
3247
    }
3248
    
3249
    /* Insert casting types */
3250
    cast = swig_module.cast_initial[i];
3251
    while (cast->type) {
3252
      /* Don't need to add information already in the list */
3253
      ret = 0;
3254
#ifdef SWIGRUNTIME_DEBUG
3255
      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3256
#endif
3257
      if (swig_module.next != &swig_module) {
3258
        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3259
#ifdef SWIGRUNTIME_DEBUG
3260
        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3261
#endif
3262
      }
3263
      if (ret) {
3264
        if (type == swig_module.type_initial[i]) {
3265
#ifdef SWIGRUNTIME_DEBUG
3266
          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3267
#endif
3268
          cast->type = ret;
3269
          ret = 0;
3270
        } else {
3271
          /* Check for casting already in the list */
3272
          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3273
#ifdef SWIGRUNTIME_DEBUG
3274
          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3275
#endif
3276
          if (!ocast) ret = 0;
3277
        }
3278
      }
3279
      
3280
      if (!ret) {
3281
#ifdef SWIGRUNTIME_DEBUG
3282
        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3283
#endif
3284
        if (type->cast) {
3285
          type->cast->prev = cast;
3286
          cast->next = type->cast;
3287
        }
3288
        type->cast = cast;
3289
      }
3290
      cast++;
3291
    }
3292
    /* Set entry in modules->types array equal to the type */
3293
    swig_module.types[i] = type;
3294
  }
3295
  swig_module.types[i] = 0;
3296
  
3297
#ifdef SWIGRUNTIME_DEBUG
3298
  printf("**** SWIG_InitializeModule: Cast List ******\n");
3299
  for (i = 0; i < swig_module.size; ++i) {
3300
    int j = 0;
3301
    swig_cast_info *cast = swig_module.cast_initial[i];
3302
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3303
    while (cast->type) {
3304
      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3305
      cast++;
3306
      ++j;
3307
    }
3308
    printf("---- Total casts: %d\n",j);
3309
  }
3310
  printf("**** SWIG_InitializeModule: Cast List ******\n");
3311
#endif
3312
}
3313

    
3314
/* This function will propagate the clientdata field of type to
3315
* any new swig_type_info structures that have been added into the list
3316
* of equivalent types.  It is like calling
3317
* SWIG_TypeClientData(type, clientdata) a second time.
3318
*/
3319
SWIGRUNTIME void
3320
SWIG_PropagateClientData(void) {
3321
  size_t i;
3322
  swig_cast_info *equiv;
3323
  static int init_run = 0;
3324
  
3325
  if (init_run) return;
3326
  init_run = 1;
3327
  
3328
  for (i = 0; i < swig_module.size; i++) {
3329
    if (swig_module.types[i]->clientdata) {
3330
      equiv = swig_module.types[i]->cast;
3331
      while (equiv) {
3332
        if (!equiv->converter) {
3333
          if (equiv->type && !equiv->type->clientdata)
3334
          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3335
        }
3336
        equiv = equiv->next;
3337
      }
3338
    }
3339
  }
3340
}
3341

    
3342
#ifdef __cplusplus
3343
#if 0
3344
{
3345
  /* c-mode */
3346
#endif
3347
}
3348
#endif
3349

    
3350

    
3351

    
3352
#ifdef __cplusplus
3353
extern "C" {
3354
#endif
3355
  
3356
  /* Python-specific SWIG API */
3357
#define SWIG_newvarlink()                             SWIG_Python_newvarlink()
3358
#define SWIG_addvarlink(p, name, get_attr, set_attr)  SWIG_Python_addvarlink(p, name, get_attr, set_attr)
3359
#define SWIG_InstallConstants(d, constants)           SWIG_Python_InstallConstants(d, constants)
3360
  
3361
  /* -----------------------------------------------------------------------------
3362
   * global variable support code.
3363
   * ----------------------------------------------------------------------------- */
3364
  
3365
  typedef struct swig_globalvar {
3366
    char       *name;                  /* Name of global variable */
3367
    PyObject *(*get_attr)(void);       /* Return the current value */
3368
    int       (*set_attr)(PyObject *); /* Set the value */
3369
    struct swig_globalvar *next;
3370
  } swig_globalvar;
3371
  
3372
  typedef struct swig_varlinkobject {
3373
    PyObject_HEAD
3374
    swig_globalvar *vars;
3375
  } swig_varlinkobject;
3376
  
3377
  SWIGINTERN PyObject *
3378
  swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
3379
#if PY_VERSION_HEX >= 0x03000000
3380
    return PyUnicode_InternFromString("<Swig global variables>");
3381
#else
3382
    return PyString_FromString("<Swig global variables>");
3383
#endif
3384
  }
3385
  
3386
  SWIGINTERN PyObject *
3387
  swig_varlink_str(swig_varlinkobject *v) {
3388
#if PY_VERSION_HEX >= 0x03000000
3389
    PyObject *str = PyUnicode_InternFromString("(");
3390
    PyObject *tail;
3391
    PyObject *joined;
3392
    swig_globalvar *var;
3393
    for (var = v->vars; var; var=var->next) {
3394
      tail = PyUnicode_FromString(var->name);
3395
      joined = PyUnicode_Concat(str, tail);
3396
      Py_DecRef(str);
3397
      Py_DecRef(tail);
3398
      str = joined;
3399
      if (var->next) {
3400
        tail = PyUnicode_InternFromString(", ");
3401
        joined = PyUnicode_Concat(str, tail);
3402
        Py_DecRef(str);
3403
        Py_DecRef(tail);
3404
        str = joined;
3405
      }
3406
    }
3407
    tail = PyUnicode_InternFromString(")");
3408
    joined = PyUnicode_Concat(str, tail);
3409
    Py_DecRef(str);
3410
    Py_DecRef(tail);
3411
    str = joined;
3412
#else
3413
    PyObject *str = PyString_FromString("(");
3414
    swig_globalvar *var;
3415
    for (var = v->vars; var; var=var->next) {
3416
      PyString_ConcatAndDel(&str,PyString_FromString(var->name));
3417
      if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
3418
    }
3419
    PyString_ConcatAndDel(&str,PyString_FromString(")"));
3420
#endif
3421
    return str;
3422
  }
3423
  
3424
  SWIGINTERN int
3425
  swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
3426
    char *tmp;
3427
    PyObject *str = swig_varlink_str(v);
3428
    fprintf(fp,"Swig global variables ");
3429
    fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
3430
    SWIG_Python_str_DelForPy3(tmp);
3431
    Py_DECREF(str);
3432
    return 0;
3433
  }
3434
  
3435
  SWIGINTERN void
3436
  swig_varlink_dealloc(swig_varlinkobject *v) {
3437
    swig_globalvar *var = v->vars;
3438
    while (var) {
3439
      swig_globalvar *n = var->next;
3440
      free(var->name);
3441
      free(var);
3442
      var = n;
3443
    }
3444
  }
3445
  
3446
  SWIGINTERN PyObject *
3447
  swig_varlink_getattr(swig_varlinkobject *v, char *n) {
3448
    PyObject *res = NULL;
3449
    swig_globalvar *var = v->vars;
3450
    while (var) {
3451
      if (strcmp(var->name,n) == 0) {
3452
        res = (*var->get_attr)();
3453
        break;
3454
      }
3455
      var = var->next;
3456
    }
3457
    if (res == NULL && !PyErr_Occurred()) {
3458
      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
3459
    }
3460
    return res;
3461
  }
3462
  
3463
  SWIGINTERN int
3464
  swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
3465
    int res = 1;
3466
    swig_globalvar *var = v->vars;
3467
    while (var) {
3468
      if (strcmp(var->name,n) == 0) {
3469
        res = (*var->set_attr)(p);
3470
        break;
3471
      }
3472
      var = var->next;
3473
    }
3474
    if (res == 1 && !PyErr_Occurred()) {
3475
      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
3476
    }
3477
    return res;
3478
  }
3479
  
3480
  SWIGINTERN PyTypeObject*
3481
  swig_varlink_type(void) {
3482
    static char varlink__doc__[] = "Swig var link object";
3483
    static PyTypeObject varlink_type;
3484
    static int type_init = 0;
3485
    if (!type_init) {
3486
      const PyTypeObject tmp = {
3487
        /* PyObject header changed in Python 3 */
3488
#if PY_VERSION_HEX >= 0x03000000
3489
        PyVarObject_HEAD_INIT(NULL, 0)
3490
#else
3491
        PyObject_HEAD_INIT(NULL)
3492
        0,                                  /* ob_size */
3493
#endif
3494
        (char *)"swigvarlink",              /* tp_name */
3495
        sizeof(swig_varlinkobject),         /* tp_basicsize */
3496
        0,                                  /* tp_itemsize */
3497
        (destructor) swig_varlink_dealloc,  /* tp_dealloc */
3498
        (printfunc) swig_varlink_print,     /* tp_print */
3499
        (getattrfunc) swig_varlink_getattr, /* tp_getattr */
3500
        (setattrfunc) swig_varlink_setattr, /* tp_setattr */
3501
        0,                                  /* tp_compare */
3502
        (reprfunc) swig_varlink_repr,       /* tp_repr */
3503
        0,                                  /* tp_as_number */
3504
        0,                                  /* tp_as_sequence */
3505
        0,                                  /* tp_as_mapping */
3506
        0,                                  /* tp_hash */
3507
        0,                                  /* tp_call */
3508
        (reprfunc) swig_varlink_str,        /* tp_str */
3509
        0,                                  /* tp_getattro */
3510
        0,                                  /* tp_setattro */
3511
        0,                                  /* tp_as_buffer */
3512
        0,                                  /* tp_flags */
3513
        varlink__doc__,                     /* tp_doc */
3514
        0,                                  /* tp_traverse */
3515
        0,                                  /* tp_clear */
3516
        0,                                  /* tp_richcompare */
3517
        0,                                  /* tp_weaklistoffset */
3518
#if PY_VERSION_HEX >= 0x02020000
3519
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
3520
#endif
3521
#if PY_VERSION_HEX >= 0x02030000
3522
        0,                                  /* tp_del */
3523
#endif
3524
#if PY_VERSION_HEX >= 0x02060000
3525
        0,                                  /* tp_version */
3526
#endif
3527
#ifdef COUNT_ALLOCS
3528
        0,0,0,0                             /* tp_alloc -> tp_next */
3529
#endif
3530
      };
3531
      varlink_type = tmp;
3532
      type_init = 1;
3533
#if PY_VERSION_HEX < 0x02020000
3534
      varlink_type.ob_type = &PyType_Type;
3535
#else
3536
      if (PyType_Ready(&varlink_type) < 0)
3537
      return NULL;
3538
#endif
3539
    }
3540
    return &varlink_type;
3541
  }
3542
  
3543
  /* Create a variable linking object for use later */
3544
  SWIGINTERN PyObject *
3545
  SWIG_Python_newvarlink(void) {
3546
    swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
3547
    if (result) {
3548
      result->vars = 0;
3549
    }
3550
    return ((PyObject*) result);
3551
  }
3552
  
3553
  SWIGINTERN void 
3554
  SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
3555
    swig_varlinkobject *v = (swig_varlinkobject *) p;
3556
    swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
3557
    if (gv) {
3558
      size_t size = strlen(name)+1;
3559
      gv->name = (char *)malloc(size);
3560
      if (gv->name) {
3561
        strncpy(gv->name,name,size);
3562
        gv->get_attr = get_attr;
3563
        gv->set_attr = set_attr;
3564
        gv->next = v->vars;
3565
      }
3566
    }
3567
    v->vars = gv;
3568
  }
3569
  
3570
  SWIGINTERN PyObject *
3571
  SWIG_globals(void) {
3572
    static PyObject *_SWIG_globals = 0; 
3573
    if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();  
3574
    return _SWIG_globals;
3575
  }
3576
  
3577
  /* -----------------------------------------------------------------------------
3578
   * constants/methods manipulation
3579
   * ----------------------------------------------------------------------------- */
3580
  
3581
  /* Install Constants */
3582
  SWIGINTERN void
3583
  SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
3584
    PyObject *obj = 0;
3585
    size_t i;
3586
    for (i = 0; constants[i].type; ++i) {
3587
      switch(constants[i].type) {
3588
      case SWIG_PY_POINTER:
3589
        obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
3590
        break;
3591
      case SWIG_PY_BINARY:
3592
        obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
3593
        break;
3594
      default:
3595
        obj = 0;
3596
        break;
3597
      }
3598
      if (obj) {
3599
        PyDict_SetItemString(d, constants[i].name, obj);
3600
        Py_DECREF(obj);
3601
      }
3602
    }
3603
  }
3604
  
3605
  /* -----------------------------------------------------------------------------*/
3606
  /* Fix SwigMethods to carry the callback ptrs when needed */
3607
  /* -----------------------------------------------------------------------------*/
3608
  
3609
  SWIGINTERN void
3610
  SWIG_Python_FixMethods(PyMethodDef *methods,
3611
    swig_const_info *const_table,
3612
    swig_type_info **types,
3613
    swig_type_info **types_initial) {
3614
    size_t i;
3615
    for (i = 0; methods[i].ml_name; ++i) {
3616
      const char *c = methods[i].ml_doc;
3617
      if (c && (c = strstr(c, "swig_ptr: "))) {
3618
        int j;
3619
        swig_const_info *ci = 0;
3620
        const char *name = c + 10;
3621
        for (j = 0; const_table[j].type; ++j) {
3622
          if (strncmp(const_table[j].name, name, 
3623
              strlen(const_table[j].name)) == 0) {
3624
            ci = &(const_table[j]);
3625
            break;
3626
          }
3627
        }
3628
        if (ci) {
3629
          void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
3630
          if (ptr) {
3631
            size_t shift = (ci->ptype) - types;
3632
            swig_type_info *ty = types_initial[shift];
3633
            size_t ldoc = (c - methods[i].ml_doc);
3634
            size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
3635
            char *ndoc = (char*)malloc(ldoc + lptr + 10);
3636
            if (ndoc) {
3637
              char *buff = ndoc;
3638
              strncpy(buff, methods[i].ml_doc, ldoc);
3639
              buff += ldoc;
3640
              strncpy(buff, "swig_ptr: ", 10);
3641
              buff += 10;
3642
              SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
3643
              methods[i].ml_doc = ndoc;
3644
            }
3645
          }
3646
        }
3647
      }
3648
    }
3649
  } 
3650
  
3651
#ifdef __cplusplus
3652
}
3653
#endif
3654

    
3655
/* -----------------------------------------------------------------------------*
3656
 *  Partial Init method
3657
 * -----------------------------------------------------------------------------*/
3658

    
3659
#ifdef __cplusplus
3660
extern "C"
3661
#endif
3662

    
3663
SWIGEXPORT 
3664
#if PY_VERSION_HEX >= 0x03000000
3665
PyObject*
3666
#else
3667
void
3668
#endif
3669
SWIG_init(void) {
3670
  PyObject *m, *d, *md;
3671
#if PY_VERSION_HEX >= 0x03000000
3672
  static struct PyModuleDef SWIG_module = {
3673
# if PY_VERSION_HEX >= 0x03020000
3674
    PyModuleDef_HEAD_INIT,
3675
# else
3676
    {
3677
      PyObject_HEAD_INIT(NULL)
3678
      NULL, /* m_init */
3679
      0,    /* m_index */
3680
      NULL, /* m_copy */
3681
    },
3682
# endif
3683
    (char *) SWIG_name,
3684
    NULL,
3685
    -1,
3686
    SwigMethods,
3687
    NULL,
3688
    NULL,
3689
    NULL,
3690
    NULL
3691
  };
3692
#endif
3693
  
3694
#if defined(SWIGPYTHON_BUILTIN)
3695
  static SwigPyClientData SwigPyObject_clientdata = {
3696
    0, 0, 0, 0, 0, 0, 0
3697
  };
3698
  static PyGetSetDef this_getset_def = {
3699
    (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
3700
  };
3701
  static SwigPyGetSet thisown_getset_closure = {
3702
    (PyCFunction) SwigPyObject_own,
3703
    (PyCFunction) SwigPyObject_own
3704
  };
3705
  static PyGetSetDef thisown_getset_def = {
3706
    (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
3707
  };
3708
  PyObject *metatype_args;
3709
  PyTypeObject *builtin_pytype;
3710
  int builtin_base_count;
3711
  swig_type_info *builtin_basetype;
3712
  PyObject *tuple;
3713
  PyGetSetDescrObject *static_getset;
3714
  PyTypeObject *metatype;
3715
  SwigPyClientData *cd;
3716
  PyObject *public_interface, *public_symbol;
3717
  PyObject *this_descr;
3718
  PyObject *thisown_descr;
3719
  int i;
3720
  
3721
  (void)builtin_pytype;
3722
  (void)builtin_base_count;
3723
  (void)builtin_basetype;
3724
  (void)tuple;
3725
  (void)static_getset;
3726
  
3727
  /* metatype is used to implement static member variables. */
3728
  metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type);
3729
  assert(metatype_args);
3730
  metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL);
3731
  assert(metatype);
3732
  Py_DECREF(metatype_args);
3733
  metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro;
3734
  assert(PyType_Ready(metatype) >= 0);
3735
#endif
3736
  
3737
  /* Fix SwigMethods to carry the callback ptrs when needed */
3738
  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
3739
  
3740
#if PY_VERSION_HEX >= 0x03000000
3741
  m = PyModule_Create(&SWIG_module);
3742
#else
3743
  m = Py_InitModule((char *) SWIG_name, SwigMethods);
3744
#endif
3745
  md = d = PyModule_GetDict(m);
3746
  
3747
  SWIG_InitializeModule(0);
3748
  
3749
#ifdef SWIGPYTHON_BUILTIN
3750
  SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
3751
  assert(SwigPyObject_stype);
3752
  cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
3753
  if (!cd) {
3754
    SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
3755
    SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce();
3756
  } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) {
3757
    PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
3758
# if PY_VERSION_HEX >= 0x03000000
3759
    return NULL;
3760
# else
3761
    return;
3762
# endif
3763
  }
3764
  
3765
  /* All objects have a 'this' attribute */
3766
  this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
3767
  (void)this_descr;
3768
  
3769
  /* All objects have a 'thisown' attribute */
3770
  thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
3771
  (void)thisown_descr;
3772
  
3773
  public_interface = PyList_New(0);
3774
  public_symbol = 0;
3775
  (void)public_symbol;
3776
  
3777
  PyDict_SetItemString(md, "__all__", public_interface);
3778
  Py_DECREF(public_interface);
3779
  for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
3780
  SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
3781
  for (i = 0; swig_const_table[i].name != 0; ++i)
3782
  SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
3783
#endif
3784
  
3785
  SWIG_InstallConstants(d,swig_const_table);
3786
  
3787
#if PY_VERSION_HEX >= 0x03000000
3788
  return m;
3789
#else
3790
  return;
3791
#endif
3792
}
3793