~ecryptfs/ecryptfs/trunk

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