r26399: Use -O option for SWIG (less evil generated code).
[Samba.git] / source4 / lib / tdb / tdb_wrap.c
blob841cd783996ad2a2fd7486caf43be65b0f50a6a0
1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
3 * Version 1.3.33
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 * ----------------------------------------------------------------------------- */
11 #define SWIGPYTHON
12 #define SWIG_PYTHON_NO_BUILD_NONE
13 /* -----------------------------------------------------------------------------
14 * This section contains generic SWIG labels for method/variable
15 * declarations/attributes, and other compiler dependent labels.
16 * ----------------------------------------------------------------------------- */
18 /* template workaround for compilers that cannot correctly implement the C++ standard */
19 #ifndef SWIGTEMPLATEDISAMBIGUATOR
20 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
21 # define SWIGTEMPLATEDISAMBIGUATOR template
22 # elif defined(__HP_aCC)
23 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
24 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
25 # define SWIGTEMPLATEDISAMBIGUATOR template
26 # else
27 # define SWIGTEMPLATEDISAMBIGUATOR
28 # endif
29 #endif
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
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
55 #ifndef SWIGUNUSEDPARM
56 # ifdef __cplusplus
57 # define SWIGUNUSEDPARM(p)
58 # else
59 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
60 # endif
61 #endif
63 /* internal SWIG method */
64 #ifndef SWIGINTERN
65 # define SWIGINTERN static SWIGUNUSED
66 #endif
68 /* internal inline SWIG method */
69 #ifndef SWIGINTERNINLINE
70 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
71 #endif
73 /* exporting methods */
74 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
75 # ifndef GCC_HASCLASSVISIBILITY
76 # define GCC_HASCLASSVISIBILITY
77 # endif
78 #endif
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
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
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
110 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
111 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
112 # define _SCL_SECURE_NO_DEPRECATE
113 #endif
117 /* Python.h has to appear first */
118 #include <Python.h>
120 /* -----------------------------------------------------------------------------
121 * swigrun.swg
123 * This file contains generic CAPI SWIG runtime support for pointer
124 * type checking.
125 * ----------------------------------------------------------------------------- */
127 /* This should only be incremented when either the layout of swig_type_info changes,
128 or for whatever reason, the runtime changes incompatibly */
129 #define SWIG_RUNTIME_VERSION "3"
131 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
132 #ifdef SWIG_TYPE_TABLE
133 # define SWIG_QUOTE_STRING(x) #x
134 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
135 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
136 #else
137 # define SWIG_TYPE_TABLE_NAME
138 #endif
141 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
142 creating a static or dynamic library from the swig runtime code.
143 In 99.9% of the cases, swig just needs to declare them as 'static'.
145 But only do this if is strictly necessary, ie, if you have problems
146 with your compiler or so.
149 #ifndef SWIGRUNTIME
150 # define SWIGRUNTIME SWIGINTERN
151 #endif
153 #ifndef SWIGRUNTIMEINLINE
154 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
155 #endif
157 /* Generic buffer size */
158 #ifndef SWIG_BUFFER_SIZE
159 # define SWIG_BUFFER_SIZE 1024
160 #endif
162 /* Flags for pointer conversions */
163 #define SWIG_POINTER_DISOWN 0x1
165 /* Flags for new pointer objects */
166 #define SWIG_POINTER_OWN 0x1
170 Flags/methods for returning states.
172 The swig conversion methods, as ConvertPtr, return and integer
173 that tells if the conversion was successful or not. And if not,
174 an error code can be returned (see swigerrors.swg for the codes).
176 Use the following macros/flags to set or process the returning
177 states.
179 In old swig versions, you usually write code as:
181 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
182 // success code
183 } else {
184 //fail code
187 Now you can be more explicit as:
189 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
190 if (SWIG_IsOK(res)) {
191 // success code
192 } else {
193 // fail code
196 that seems to be the same, but now you can also do
198 Type *ptr;
199 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
200 if (SWIG_IsOK(res)) {
201 // success code
202 if (SWIG_IsNewObj(res) {
204 delete *ptr;
205 } else {
208 } else {
209 // fail code
212 I.e., now SWIG_ConvertPtr can return new objects and you can
213 identify the case and take care of the deallocation. Of course that
214 requires also to SWIG_ConvertPtr to return new result values, as
216 int SWIG_ConvertPtr(obj, ptr,...) {
217 if (<obj is ok>) {
218 if (<need new object>) {
219 *ptr = <ptr to new allocated object>;
220 return SWIG_NEWOBJ;
221 } else {
222 *ptr = <ptr to old object>;
223 return SWIG_OLDOBJ;
225 } else {
226 return SWIG_BADOBJ;
230 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
231 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
232 swig errors code.
234 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
235 allows to return the 'cast rank', for example, if you have this
237 int food(double)
238 int fooi(int);
240 and you call
242 food(1) // cast rank '1' (1 -> 1.0)
243 fooi(1) // cast rank '0'
245 just use the SWIG_AddCast()/SWIG_CheckState()
249 #define SWIG_OK (0)
250 #define SWIG_ERROR (-1)
251 #define SWIG_IsOK(r) (r >= 0)
252 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
254 /* The CastRankLimit says how many bits are used for the cast rank */
255 #define SWIG_CASTRANKLIMIT (1 << 8)
256 /* The NewMask denotes the object was created (using new/malloc) */
257 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
258 /* The TmpMask is for in/out typemaps that use temporal objects */
259 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
260 /* Simple returning values */
261 #define SWIG_BADOBJ (SWIG_ERROR)
262 #define SWIG_OLDOBJ (SWIG_OK)
263 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
264 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
265 /* Check, add and del mask methods */
266 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
267 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
268 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
269 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
270 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
271 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
274 /* Cast-Rank Mode */
275 #if defined(SWIG_CASTRANK_MODE)
276 # ifndef SWIG_TypeRank
277 # define SWIG_TypeRank unsigned long
278 # endif
279 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
280 # define SWIG_MAXCASTRANK (2)
281 # endif
282 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
283 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
284 SWIGINTERNINLINE int SWIG_AddCast(int r) {
285 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
287 SWIGINTERNINLINE int SWIG_CheckState(int r) {
288 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
290 #else /* no cast-rank mode */
291 # define SWIG_AddCast
292 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
293 #endif
298 #include <string.h>
300 #ifdef __cplusplus
301 extern "C" {
302 #endif
304 typedef void *(*swig_converter_func)(void *);
305 typedef struct swig_type_info *(*swig_dycast_func)(void **);
307 /* Structure to store inforomation on one type */
308 typedef struct swig_type_info {
309 const char *name; /* mangled name of this type */
310 const char *str; /* human readable name of this type */
311 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
312 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
313 void *clientdata; /* language specific type data */
314 int owndata; /* flag if the structure owns the clientdata */
315 } swig_type_info;
317 /* Structure to store a type and conversion function used for casting */
318 typedef struct swig_cast_info {
319 swig_type_info *type; /* pointer to type that is equivalent to this type */
320 swig_converter_func converter; /* function to cast the void pointers */
321 struct swig_cast_info *next; /* pointer to next cast in linked list */
322 struct swig_cast_info *prev; /* pointer to the previous cast */
323 } swig_cast_info;
325 /* Structure used to store module information
326 * Each module generates one structure like this, and the runtime collects
327 * all of these structures and stores them in a circularly linked list.*/
328 typedef struct swig_module_info {
329 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
330 size_t size; /* Number of types in this module */
331 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
332 swig_type_info **type_initial; /* Array of initially generated type structures */
333 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
334 void *clientdata; /* Language specific module data */
335 } swig_module_info;
338 Compare two type names skipping the space characters, therefore
339 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
341 Return 0 when the two name types are equivalent, as in
342 strncmp, but skipping ' '.
344 SWIGRUNTIME int
345 SWIG_TypeNameComp(const char *f1, const char *l1,
346 const char *f2, const char *l2) {
347 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
348 while ((*f1 == ' ') && (f1 != l1)) ++f1;
349 while ((*f2 == ' ') && (f2 != l2)) ++f2;
350 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
352 return (int)((l1 - f1) - (l2 - f2));
356 Check type equivalence in a name list like <name1>|<name2>|...
357 Return 0 if not equal, 1 if equal
359 SWIGRUNTIME int
360 SWIG_TypeEquiv(const char *nb, const char *tb) {
361 int equiv = 0;
362 const char* te = tb + strlen(tb);
363 const char* ne = nb;
364 while (!equiv && *ne) {
365 for (nb = ne; *ne; ++ne) {
366 if (*ne == '|') break;
368 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
369 if (*ne) ++ne;
371 return equiv;
375 Check type equivalence in a name list like <name1>|<name2>|...
376 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
378 SWIGRUNTIME int
379 SWIG_TypeCompare(const char *nb, const char *tb) {
380 int equiv = 0;
381 const char* te = tb + strlen(tb);
382 const char* ne = nb;
383 while (!equiv && *ne) {
384 for (nb = ne; *ne; ++ne) {
385 if (*ne == '|') break;
387 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
388 if (*ne) ++ne;
390 return equiv;
394 /* think of this as a c++ template<> or a scheme macro */
395 #define SWIG_TypeCheck_Template(comparison, ty) \
396 if (ty) { \
397 swig_cast_info *iter = ty->cast; \
398 while (iter) { \
399 if (comparison) { \
400 if (iter == ty->cast) return iter; \
401 /* Move iter to the top of the linked list */ \
402 iter->prev->next = iter->next; \
403 if (iter->next) \
404 iter->next->prev = iter->prev; \
405 iter->next = ty->cast; \
406 iter->prev = 0; \
407 if (ty->cast) ty->cast->prev = iter; \
408 ty->cast = iter; \
409 return iter; \
411 iter = iter->next; \
414 return 0
417 Check the typename
419 SWIGRUNTIME swig_cast_info *
420 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
421 SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
424 /* Same as previous function, except strcmp is replaced with a pointer comparison */
425 SWIGRUNTIME swig_cast_info *
426 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
427 SWIG_TypeCheck_Template(iter->type == from, into);
431 Cast a pointer up an inheritance hierarchy
433 SWIGRUNTIMEINLINE void *
434 SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
435 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
439 Dynamic pointer casting. Down an inheritance hierarchy
441 SWIGRUNTIME swig_type_info *
442 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
443 swig_type_info *lastty = ty;
444 if (!ty || !ty->dcast) return ty;
445 while (ty && (ty->dcast)) {
446 ty = (*ty->dcast)(ptr);
447 if (ty) lastty = ty;
449 return lastty;
453 Return the name associated with this type
455 SWIGRUNTIMEINLINE const char *
456 SWIG_TypeName(const swig_type_info *ty) {
457 return ty->name;
461 Return the pretty name associated with this type,
462 that is an unmangled type name in a form presentable to the user.
464 SWIGRUNTIME const char *
465 SWIG_TypePrettyName(const swig_type_info *type) {
466 /* The "str" field contains the equivalent pretty names of the
467 type, separated by vertical-bar characters. We choose
468 to print the last name, as it is often (?) the most
469 specific. */
470 if (!type) return NULL;
471 if (type->str != NULL) {
472 const char *last_name = type->str;
473 const char *s;
474 for (s = type->str; *s; s++)
475 if (*s == '|') last_name = s+1;
476 return last_name;
478 else
479 return type->name;
483 Set the clientdata field for a type
485 SWIGRUNTIME void
486 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
487 swig_cast_info *cast = ti->cast;
488 /* if (ti->clientdata == clientdata) return; */
489 ti->clientdata = clientdata;
491 while (cast) {
492 if (!cast->converter) {
493 swig_type_info *tc = cast->type;
494 if (!tc->clientdata) {
495 SWIG_TypeClientData(tc, clientdata);
498 cast = cast->next;
501 SWIGRUNTIME void
502 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
503 SWIG_TypeClientData(ti, clientdata);
504 ti->owndata = 1;
508 Search for a swig_type_info structure only by mangled name
509 Search is a O(log #types)
511 We start searching at module start, and finish searching when start == end.
512 Note: if start == end at the beginning of the function, we go all the way around
513 the circular list.
515 SWIGRUNTIME swig_type_info *
516 SWIG_MangledTypeQueryModule(swig_module_info *start,
517 swig_module_info *end,
518 const char *name) {
519 swig_module_info *iter = start;
520 do {
521 if (iter->size) {
522 register size_t l = 0;
523 register size_t r = iter->size - 1;
524 do {
525 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
526 register size_t i = (l + r) >> 1;
527 const char *iname = iter->types[i]->name;
528 if (iname) {
529 register int compare = strcmp(name, iname);
530 if (compare == 0) {
531 return iter->types[i];
532 } else if (compare < 0) {
533 if (i) {
534 r = i - 1;
535 } else {
536 break;
538 } else if (compare > 0) {
539 l = i + 1;
541 } else {
542 break; /* should never happen */
544 } while (l <= r);
546 iter = iter->next;
547 } while (iter != end);
548 return 0;
552 Search for a swig_type_info structure for either a mangled name or a human readable name.
553 It first searches the mangled names of the types, which is a O(log #types)
554 If a type is not found it then searches the human readable names, which is O(#types).
556 We start searching at module start, and finish searching when start == end.
557 Note: if start == end at the beginning of the function, we go all the way around
558 the circular list.
560 SWIGRUNTIME swig_type_info *
561 SWIG_TypeQueryModule(swig_module_info *start,
562 swig_module_info *end,
563 const char *name) {
564 /* STEP 1: Search the name field using binary search */
565 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
566 if (ret) {
567 return ret;
568 } else {
569 /* STEP 2: If the type hasn't been found, do a complete search
570 of the str field (the human readable name) */
571 swig_module_info *iter = start;
572 do {
573 register size_t i = 0;
574 for (; i < iter->size; ++i) {
575 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
576 return iter->types[i];
578 iter = iter->next;
579 } while (iter != end);
582 /* neither found a match */
583 return 0;
587 Pack binary data into a string
589 SWIGRUNTIME char *
590 SWIG_PackData(char *c, void *ptr, size_t sz) {
591 static const char hex[17] = "0123456789abcdef";
592 register const unsigned char *u = (unsigned char *) ptr;
593 register const unsigned char *eu = u + sz;
594 for (; u != eu; ++u) {
595 register unsigned char uu = *u;
596 *(c++) = hex[(uu & 0xf0) >> 4];
597 *(c++) = hex[uu & 0xf];
599 return c;
603 Unpack binary data from a string
605 SWIGRUNTIME const char *
606 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
607 register unsigned char *u = (unsigned char *) ptr;
608 register const unsigned char *eu = u + sz;
609 for (; u != eu; ++u) {
610 register char d = *(c++);
611 register unsigned char uu;
612 if ((d >= '0') && (d <= '9'))
613 uu = ((d - '0') << 4);
614 else if ((d >= 'a') && (d <= 'f'))
615 uu = ((d - ('a'-10)) << 4);
616 else
617 return (char *) 0;
618 d = *(c++);
619 if ((d >= '0') && (d <= '9'))
620 uu |= (d - '0');
621 else if ((d >= 'a') && (d <= 'f'))
622 uu |= (d - ('a'-10));
623 else
624 return (char *) 0;
625 *u = uu;
627 return c;
631 Pack 'void *' into a string buffer.
633 SWIGRUNTIME char *
634 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
635 char *r = buff;
636 if ((2*sizeof(void *) + 2) > bsz) return 0;
637 *(r++) = '_';
638 r = SWIG_PackData(r,&ptr,sizeof(void *));
639 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
640 strcpy(r,name);
641 return buff;
644 SWIGRUNTIME const char *
645 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
646 if (*c != '_') {
647 if (strcmp(c,"NULL") == 0) {
648 *ptr = (void *) 0;
649 return name;
650 } else {
651 return 0;
654 return SWIG_UnpackData(++c,ptr,sizeof(void *));
657 SWIGRUNTIME char *
658 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
659 char *r = buff;
660 size_t lname = (name ? strlen(name) : 0);
661 if ((2*sz + 2 + lname) > bsz) return 0;
662 *(r++) = '_';
663 r = SWIG_PackData(r,ptr,sz);
664 if (lname) {
665 strncpy(r,name,lname+1);
666 } else {
667 *r = 0;
669 return buff;
672 SWIGRUNTIME const char *
673 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
674 if (*c != '_') {
675 if (strcmp(c,"NULL") == 0) {
676 memset(ptr,0,sz);
677 return name;
678 } else {
679 return 0;
682 return SWIG_UnpackData(++c,ptr,sz);
685 #ifdef __cplusplus
687 #endif
689 /* Errors in SWIG */
690 #define SWIG_UnknownError -1
691 #define SWIG_IOError -2
692 #define SWIG_RuntimeError -3
693 #define SWIG_IndexError -4
694 #define SWIG_TypeError -5
695 #define SWIG_DivisionByZero -6
696 #define SWIG_OverflowError -7
697 #define SWIG_SyntaxError -8
698 #define SWIG_ValueError -9
699 #define SWIG_SystemError -10
700 #define SWIG_AttributeError -11
701 #define SWIG_MemoryError -12
702 #define SWIG_NullReferenceError -13
707 /* Add PyOS_snprintf for old Pythons */
708 #if PY_VERSION_HEX < 0x02020000
709 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
710 # define PyOS_snprintf _snprintf
711 # else
712 # define PyOS_snprintf snprintf
713 # endif
714 #endif
716 /* A crude PyString_FromFormat implementation for old Pythons */
717 #if PY_VERSION_HEX < 0x02020000
719 #ifndef SWIG_PYBUFFER_SIZE
720 # define SWIG_PYBUFFER_SIZE 1024
721 #endif
723 static PyObject *
724 PyString_FromFormat(const char *fmt, ...) {
725 va_list ap;
726 char buf[SWIG_PYBUFFER_SIZE * 2];
727 int res;
728 va_start(ap, fmt);
729 res = vsnprintf(buf, sizeof(buf), fmt, ap);
730 va_end(ap);
731 return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
733 #endif
735 /* Add PyObject_Del for old Pythons */
736 #if PY_VERSION_HEX < 0x01060000
737 # define PyObject_Del(op) PyMem_DEL((op))
738 #endif
739 #ifndef PyObject_DEL
740 # define PyObject_DEL PyObject_Del
741 #endif
743 /* A crude PyExc_StopIteration exception for old Pythons */
744 #if PY_VERSION_HEX < 0x02020000
745 # ifndef PyExc_StopIteration
746 # define PyExc_StopIteration PyExc_RuntimeError
747 # endif
748 # ifndef PyObject_GenericGetAttr
749 # define PyObject_GenericGetAttr 0
750 # endif
751 #endif
752 /* Py_NotImplemented is defined in 2.1 and up. */
753 #if PY_VERSION_HEX < 0x02010000
754 # ifndef Py_NotImplemented
755 # define Py_NotImplemented PyExc_RuntimeError
756 # endif
757 #endif
760 /* A crude PyString_AsStringAndSize implementation for old Pythons */
761 #if PY_VERSION_HEX < 0x02010000
762 # ifndef PyString_AsStringAndSize
763 # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
764 # endif
765 #endif
767 /* PySequence_Size for old Pythons */
768 #if PY_VERSION_HEX < 0x02000000
769 # ifndef PySequence_Size
770 # define PySequence_Size PySequence_Length
771 # endif
772 #endif
775 /* PyBool_FromLong for old Pythons */
776 #if PY_VERSION_HEX < 0x02030000
777 static
778 PyObject *PyBool_FromLong(long ok)
780 PyObject *result = ok ? Py_True : Py_False;
781 Py_INCREF(result);
782 return result;
784 #endif
786 /* Py_ssize_t for old Pythons */
787 /* This code is as recommended by: */
788 /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
789 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
790 typedef int Py_ssize_t;
791 # define PY_SSIZE_T_MAX INT_MAX
792 # define PY_SSIZE_T_MIN INT_MIN
793 #endif
795 /* -----------------------------------------------------------------------------
796 * error manipulation
797 * ----------------------------------------------------------------------------- */
799 SWIGRUNTIME PyObject*
800 SWIG_Python_ErrorType(int code) {
801 PyObject* type = 0;
802 switch(code) {
803 case SWIG_MemoryError:
804 type = PyExc_MemoryError;
805 break;
806 case SWIG_IOError:
807 type = PyExc_IOError;
808 break;
809 case SWIG_RuntimeError:
810 type = PyExc_RuntimeError;
811 break;
812 case SWIG_IndexError:
813 type = PyExc_IndexError;
814 break;
815 case SWIG_TypeError:
816 type = PyExc_TypeError;
817 break;
818 case SWIG_DivisionByZero:
819 type = PyExc_ZeroDivisionError;
820 break;
821 case SWIG_OverflowError:
822 type = PyExc_OverflowError;
823 break;
824 case SWIG_SyntaxError:
825 type = PyExc_SyntaxError;
826 break;
827 case SWIG_ValueError:
828 type = PyExc_ValueError;
829 break;
830 case SWIG_SystemError:
831 type = PyExc_SystemError;
832 break;
833 case SWIG_AttributeError:
834 type = PyExc_AttributeError;
835 break;
836 default:
837 type = PyExc_RuntimeError;
839 return type;
843 SWIGRUNTIME void
844 SWIG_Python_AddErrorMsg(const char* mesg)
846 PyObject *type = 0;
847 PyObject *value = 0;
848 PyObject *traceback = 0;
850 if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
851 if (value) {
852 PyObject *old_str = PyObject_Str(value);
853 PyErr_Clear();
854 Py_XINCREF(type);
855 PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
856 Py_DECREF(old_str);
857 Py_DECREF(value);
858 } else {
859 PyErr_Format(PyExc_RuntimeError, mesg);
865 #if defined(SWIG_PYTHON_NO_THREADS)
866 # if defined(SWIG_PYTHON_THREADS)
867 # undef SWIG_PYTHON_THREADS
868 # endif
869 #endif
870 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
871 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
872 # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
873 # define SWIG_PYTHON_USE_GIL
874 # endif
875 # endif
876 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
877 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
878 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
879 # endif
880 # ifdef __cplusplus /* C++ code */
881 class SWIG_Python_Thread_Block {
882 bool status;
883 PyGILState_STATE state;
884 public:
885 void end() { if (status) { PyGILState_Release(state); status = false;} }
886 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
887 ~SWIG_Python_Thread_Block() { end(); }
889 class SWIG_Python_Thread_Allow {
890 bool status;
891 PyThreadState *save;
892 public:
893 void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
894 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
895 ~SWIG_Python_Thread_Allow() { end(); }
897 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
898 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
899 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
900 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
901 # else /* C code */
902 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
903 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
904 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
905 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
906 # endif
907 # else /* Old thread way, not implemented, user must provide it */
908 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
909 # define SWIG_PYTHON_INITIALIZE_THREADS
910 # endif
911 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
912 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
913 # endif
914 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
915 # define SWIG_PYTHON_THREAD_END_BLOCK
916 # endif
917 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
918 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
919 # endif
920 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
921 # define SWIG_PYTHON_THREAD_END_ALLOW
922 # endif
923 # endif
924 #else /* No thread support */
925 # define SWIG_PYTHON_INITIALIZE_THREADS
926 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
927 # define SWIG_PYTHON_THREAD_END_BLOCK
928 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
929 # define SWIG_PYTHON_THREAD_END_ALLOW
930 #endif
932 /* -----------------------------------------------------------------------------
933 * Python API portion that goes into the runtime
934 * ----------------------------------------------------------------------------- */
936 #ifdef __cplusplus
937 extern "C" {
938 #if 0
939 } /* cc-mode */
940 #endif
941 #endif
943 /* -----------------------------------------------------------------------------
944 * Constant declarations
945 * ----------------------------------------------------------------------------- */
947 /* Constant Types */
948 #define SWIG_PY_POINTER 4
949 #define SWIG_PY_BINARY 5
951 /* Constant information structure */
952 typedef struct swig_const_info {
953 int type;
954 char *name;
955 long lvalue;
956 double dvalue;
957 void *pvalue;
958 swig_type_info **ptype;
959 } swig_const_info;
961 #ifdef __cplusplus
962 #if 0
963 { /* cc-mode */
964 #endif
966 #endif
969 /* -----------------------------------------------------------------------------
970 * See the LICENSE file for information on copyright, usage and redistribution
971 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
973 * pyrun.swg
975 * This file contains the runtime support for Python modules
976 * and includes code for managing global variables and pointer
977 * type checking.
979 * ----------------------------------------------------------------------------- */
981 /* Common SWIG API */
983 /* for raw pointers */
984 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
985 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
986 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
987 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
988 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
989 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
990 #define swig_owntype int
992 /* for raw packed data */
993 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
994 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
996 /* for class or struct pointers */
997 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
998 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1000 /* for C or C++ function pointers */
1001 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1002 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0)
1004 /* for C++ member pointers, ie, member methods */
1005 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1006 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1009 /* Runtime API */
1011 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
1012 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1013 #define SWIG_NewClientData(obj) PySwigClientData_New(obj)
1015 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1016 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1017 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1018 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1019 #define SWIG_fail goto fail
1022 /* Runtime API implementation */
1024 /* Error manipulation */
1026 SWIGINTERN void
1027 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1028 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1029 PyErr_SetObject(errtype, obj);
1030 Py_DECREF(obj);
1031 SWIG_PYTHON_THREAD_END_BLOCK;
1034 SWIGINTERN void
1035 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1036 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1037 PyErr_SetString(errtype, (char *) msg);
1038 SWIG_PYTHON_THREAD_END_BLOCK;
1041 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1043 /* Set a constant value */
1045 SWIGINTERN void
1046 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1047 PyDict_SetItemString(d, (char*) name, obj);
1048 Py_DECREF(obj);
1051 /* Append a value to the result obj */
1053 SWIGINTERN PyObject*
1054 SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1055 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
1056 if (!result) {
1057 result = obj;
1058 } else if (result == Py_None) {
1059 Py_DECREF(result);
1060 result = obj;
1061 } else {
1062 if (!PyList_Check(result)) {
1063 PyObject *o2 = result;
1064 result = PyList_New(1);
1065 PyList_SetItem(result, 0, o2);
1067 PyList_Append(result,obj);
1068 Py_DECREF(obj);
1070 return result;
1071 #else
1072 PyObject* o2;
1073 PyObject* o3;
1074 if (!result) {
1075 result = obj;
1076 } else if (result == Py_None) {
1077 Py_DECREF(result);
1078 result = obj;
1079 } else {
1080 if (!PyTuple_Check(result)) {
1081 o2 = result;
1082 result = PyTuple_New(1);
1083 PyTuple_SET_ITEM(result, 0, o2);
1085 o3 = PyTuple_New(1);
1086 PyTuple_SET_ITEM(o3, 0, obj);
1087 o2 = result;
1088 result = PySequence_Concat(o2, o3);
1089 Py_DECREF(o2);
1090 Py_DECREF(o3);
1092 return result;
1093 #endif
1096 /* Unpack the argument tuple */
1098 SWIGINTERN int
1099 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1101 if (!args) {
1102 if (!min && !max) {
1103 return 1;
1104 } else {
1105 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1106 name, (min == max ? "" : "at least "), (int)min);
1107 return 0;
1110 if (!PyTuple_Check(args)) {
1111 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1112 return 0;
1113 } else {
1114 register Py_ssize_t l = PyTuple_GET_SIZE(args);
1115 if (l < min) {
1116 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1117 name, (min == max ? "" : "at least "), (int)min, (int)l);
1118 return 0;
1119 } else if (l > max) {
1120 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1121 name, (min == max ? "" : "at most "), (int)max, (int)l);
1122 return 0;
1123 } else {
1124 register int i;
1125 for (i = 0; i < l; ++i) {
1126 objs[i] = PyTuple_GET_ITEM(args, i);
1128 for (; l < max; ++l) {
1129 objs[l] = 0;
1131 return i + 1;
1136 /* A functor is a function object with one single object argument */
1137 #if PY_VERSION_HEX >= 0x02020000
1138 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1139 #else
1140 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
1141 #endif
1144 Helper for static pointer initialization for both C and C++ code, for example
1145 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1147 #ifdef __cplusplus
1148 #define SWIG_STATIC_POINTER(var) var
1149 #else
1150 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1151 #endif
1153 /* -----------------------------------------------------------------------------
1154 * Pointer declarations
1155 * ----------------------------------------------------------------------------- */
1157 /* Flags for new pointer objects */
1158 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1159 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1161 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1163 #ifdef __cplusplus
1164 extern "C" {
1165 #if 0
1166 } /* cc-mode */
1167 #endif
1168 #endif
1170 /* How to access Py_None */
1171 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
1172 # ifndef SWIG_PYTHON_NO_BUILD_NONE
1173 # ifndef SWIG_PYTHON_BUILD_NONE
1174 # define SWIG_PYTHON_BUILD_NONE
1175 # endif
1176 # endif
1177 #endif
1179 #ifdef SWIG_PYTHON_BUILD_NONE
1180 # ifdef Py_None
1181 # undef Py_None
1182 # define Py_None SWIG_Py_None()
1183 # endif
1184 SWIGRUNTIMEINLINE PyObject *
1185 _SWIG_Py_None(void)
1187 PyObject *none = Py_BuildValue((char*)"");
1188 Py_DECREF(none);
1189 return none;
1191 SWIGRUNTIME PyObject *
1192 SWIG_Py_None(void)
1194 static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
1195 return none;
1197 #endif
1199 /* The python void return value */
1201 SWIGRUNTIMEINLINE PyObject *
1202 SWIG_Py_Void(void)
1204 PyObject *none = Py_None;
1205 Py_INCREF(none);
1206 return none;
1209 /* PySwigClientData */
1211 typedef struct {
1212 PyObject *klass;
1213 PyObject *newraw;
1214 PyObject *newargs;
1215 PyObject *destroy;
1216 int delargs;
1217 int implicitconv;
1218 } PySwigClientData;
1220 SWIGRUNTIMEINLINE int
1221 SWIG_Python_CheckImplicit(swig_type_info *ty)
1223 PySwigClientData *data = (PySwigClientData *)ty->clientdata;
1224 return data ? data->implicitconv : 0;
1227 SWIGRUNTIMEINLINE PyObject *
1228 SWIG_Python_ExceptionType(swig_type_info *desc) {
1229 PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
1230 PyObject *klass = data ? data->klass : 0;
1231 return (klass ? klass : PyExc_RuntimeError);
1235 SWIGRUNTIME PySwigClientData *
1236 PySwigClientData_New(PyObject* obj)
1238 if (!obj) {
1239 return 0;
1240 } else {
1241 PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
1242 /* the klass element */
1243 data->klass = obj;
1244 Py_INCREF(data->klass);
1245 /* the newraw method and newargs arguments used to create a new raw instance */
1246 if (PyClass_Check(obj)) {
1247 data->newraw = 0;
1248 data->newargs = obj;
1249 Py_INCREF(obj);
1250 } else {
1251 #if (PY_VERSION_HEX < 0x02020000)
1252 data->newraw = 0;
1253 #else
1254 data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
1255 #endif
1256 if (data->newraw) {
1257 Py_INCREF(data->newraw);
1258 data->newargs = PyTuple_New(1);
1259 PyTuple_SetItem(data->newargs, 0, obj);
1260 } else {
1261 data->newargs = obj;
1263 Py_INCREF(data->newargs);
1265 /* the destroy method, aka as the C++ delete method */
1266 data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
1267 if (PyErr_Occurred()) {
1268 PyErr_Clear();
1269 data->destroy = 0;
1271 if (data->destroy) {
1272 int flags;
1273 Py_INCREF(data->destroy);
1274 flags = PyCFunction_GET_FLAGS(data->destroy);
1275 #ifdef METH_O
1276 data->delargs = !(flags & (METH_O));
1277 #else
1278 data->delargs = 0;
1279 #endif
1280 } else {
1281 data->delargs = 0;
1283 data->implicitconv = 0;
1284 return data;
1288 SWIGRUNTIME void
1289 PySwigClientData_Del(PySwigClientData* data)
1291 Py_XDECREF(data->newraw);
1292 Py_XDECREF(data->newargs);
1293 Py_XDECREF(data->destroy);
1296 /* =============== PySwigObject =====================*/
1298 typedef struct {
1299 PyObject_HEAD
1300 void *ptr;
1301 swig_type_info *ty;
1302 int own;
1303 PyObject *next;
1304 } PySwigObject;
1306 SWIGRUNTIME PyObject *
1307 PySwigObject_long(PySwigObject *v)
1309 return PyLong_FromVoidPtr(v->ptr);
1312 SWIGRUNTIME PyObject *
1313 PySwigObject_format(const char* fmt, PySwigObject *v)
1315 PyObject *res = NULL;
1316 PyObject *args = PyTuple_New(1);
1317 if (args) {
1318 if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
1319 PyObject *ofmt = PyString_FromString(fmt);
1320 if (ofmt) {
1321 res = PyString_Format(ofmt,args);
1322 Py_DECREF(ofmt);
1324 Py_DECREF(args);
1327 return res;
1330 SWIGRUNTIME PyObject *
1331 PySwigObject_oct(PySwigObject *v)
1333 return PySwigObject_format("%o",v);
1336 SWIGRUNTIME PyObject *
1337 PySwigObject_hex(PySwigObject *v)
1339 return PySwigObject_format("%x",v);
1342 SWIGRUNTIME PyObject *
1343 #ifdef METH_NOARGS
1344 PySwigObject_repr(PySwigObject *v)
1345 #else
1346 PySwigObject_repr(PySwigObject *v, PyObject *args)
1347 #endif
1349 const char *name = SWIG_TypePrettyName(v->ty);
1350 PyObject *hex = PySwigObject_hex(v);
1351 PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
1352 Py_DECREF(hex);
1353 if (v->next) {
1354 #ifdef METH_NOARGS
1355 PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
1356 #else
1357 PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
1358 #endif
1359 PyString_ConcatAndDel(&repr,nrep);
1361 return repr;
1364 SWIGRUNTIME int
1365 PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1367 #ifdef METH_NOARGS
1368 PyObject *repr = PySwigObject_repr(v);
1369 #else
1370 PyObject *repr = PySwigObject_repr(v, NULL);
1371 #endif
1372 if (repr) {
1373 fputs(PyString_AsString(repr), fp);
1374 Py_DECREF(repr);
1375 return 0;
1376 } else {
1377 return 1;
1381 SWIGRUNTIME PyObject *
1382 PySwigObject_str(PySwigObject *v)
1384 char result[SWIG_BUFFER_SIZE];
1385 return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
1386 PyString_FromString(result) : 0;
1389 SWIGRUNTIME int
1390 PySwigObject_compare(PySwigObject *v, PySwigObject *w)
1392 void *i = v->ptr;
1393 void *j = w->ptr;
1394 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1397 SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
1399 SWIGRUNTIME PyTypeObject*
1400 PySwigObject_type(void) {
1401 static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
1402 return type;
1405 SWIGRUNTIMEINLINE int
1406 PySwigObject_Check(PyObject *op) {
1407 return ((op)->ob_type == PySwigObject_type())
1408 || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
1411 SWIGRUNTIME PyObject *
1412 PySwigObject_New(void *ptr, swig_type_info *ty, int own);
1414 SWIGRUNTIME void
1415 PySwigObject_dealloc(PyObject *v)
1417 PySwigObject *sobj = (PySwigObject *) v;
1418 PyObject *next = sobj->next;
1419 if (sobj->own) {
1420 swig_type_info *ty = sobj->ty;
1421 PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
1422 PyObject *destroy = data ? data->destroy : 0;
1423 if (destroy) {
1424 /* destroy is always a VARARGS method */
1425 PyObject *res;
1426 if (data->delargs) {
1427 /* we need to create a temporal object to carry the destroy operation */
1428 PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
1429 res = SWIG_Python_CallFunctor(destroy, tmp);
1430 Py_DECREF(tmp);
1431 } else {
1432 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1433 PyObject *mself = PyCFunction_GET_SELF(destroy);
1434 res = ((*meth)(mself, v));
1436 Py_XDECREF(res);
1437 } else {
1438 const char *name = SWIG_TypePrettyName(ty);
1439 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1440 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
1441 #endif
1444 Py_XDECREF(next);
1445 PyObject_DEL(v);
1448 SWIGRUNTIME PyObject*
1449 PySwigObject_append(PyObject* v, PyObject* next)
1451 PySwigObject *sobj = (PySwigObject *) v;
1452 #ifndef METH_O
1453 PyObject *tmp = 0;
1454 if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
1455 next = tmp;
1456 #endif
1457 if (!PySwigObject_Check(next)) {
1458 return NULL;
1460 sobj->next = next;
1461 Py_INCREF(next);
1462 return SWIG_Py_Void();
1465 SWIGRUNTIME PyObject*
1466 #ifdef METH_NOARGS
1467 PySwigObject_next(PyObject* v)
1468 #else
1469 PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1470 #endif
1472 PySwigObject *sobj = (PySwigObject *) v;
1473 if (sobj->next) {
1474 Py_INCREF(sobj->next);
1475 return sobj->next;
1476 } else {
1477 return SWIG_Py_Void();
1481 SWIGINTERN PyObject*
1482 #ifdef METH_NOARGS
1483 PySwigObject_disown(PyObject *v)
1484 #else
1485 PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1486 #endif
1488 PySwigObject *sobj = (PySwigObject *)v;
1489 sobj->own = 0;
1490 return SWIG_Py_Void();
1493 SWIGINTERN PyObject*
1494 #ifdef METH_NOARGS
1495 PySwigObject_acquire(PyObject *v)
1496 #else
1497 PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1498 #endif
1500 PySwigObject *sobj = (PySwigObject *)v;
1501 sobj->own = SWIG_POINTER_OWN;
1502 return SWIG_Py_Void();
1505 SWIGINTERN PyObject*
1506 PySwigObject_own(PyObject *v, PyObject *args)
1508 PyObject *val = 0;
1509 #if (PY_VERSION_HEX < 0x02020000)
1510 if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
1511 #else
1512 if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
1513 #endif
1515 return NULL;
1517 else
1519 PySwigObject *sobj = (PySwigObject *)v;
1520 PyObject *obj = PyBool_FromLong(sobj->own);
1521 if (val) {
1522 #ifdef METH_NOARGS
1523 if (PyObject_IsTrue(val)) {
1524 PySwigObject_acquire(v);
1525 } else {
1526 PySwigObject_disown(v);
1528 #else
1529 if (PyObject_IsTrue(val)) {
1530 PySwigObject_acquire(v,args);
1531 } else {
1532 PySwigObject_disown(v,args);
1534 #endif
1536 return obj;
1540 #ifdef METH_O
1541 static PyMethodDef
1542 swigobject_methods[] = {
1543 {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
1544 {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
1545 {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1546 {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"},
1547 {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
1548 {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"},
1549 {0, 0, 0, 0}
1551 #else
1552 static PyMethodDef
1553 swigobject_methods[] = {
1554 {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
1555 {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
1556 {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1557 {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
1558 {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
1559 {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"},
1560 {0, 0, 0, 0}
1562 #endif
1564 #if PY_VERSION_HEX < 0x02020000
1565 SWIGINTERN PyObject *
1566 PySwigObject_getattr(PySwigObject *sobj,char *name)
1568 return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1570 #endif
1572 SWIGRUNTIME PyTypeObject*
1573 _PySwigObject_type(void) {
1574 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1576 static PyNumberMethods PySwigObject_as_number = {
1577 (binaryfunc)0, /*nb_add*/
1578 (binaryfunc)0, /*nb_subtract*/
1579 (binaryfunc)0, /*nb_multiply*/
1580 (binaryfunc)0, /*nb_divide*/
1581 (binaryfunc)0, /*nb_remainder*/
1582 (binaryfunc)0, /*nb_divmod*/
1583 (ternaryfunc)0,/*nb_power*/
1584 (unaryfunc)0, /*nb_negative*/
1585 (unaryfunc)0, /*nb_positive*/
1586 (unaryfunc)0, /*nb_absolute*/
1587 (inquiry)0, /*nb_nonzero*/
1588 0, /*nb_invert*/
1589 0, /*nb_lshift*/
1590 0, /*nb_rshift*/
1591 0, /*nb_and*/
1592 0, /*nb_xor*/
1593 0, /*nb_or*/
1594 (coercion)0, /*nb_coerce*/
1595 (unaryfunc)PySwigObject_long, /*nb_int*/
1596 (unaryfunc)PySwigObject_long, /*nb_long*/
1597 (unaryfunc)0, /*nb_float*/
1598 (unaryfunc)PySwigObject_oct, /*nb_oct*/
1599 (unaryfunc)PySwigObject_hex, /*nb_hex*/
1600 #if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
1601 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1602 #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
1603 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
1604 #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
1605 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
1606 #endif
1609 static PyTypeObject pyswigobject_type;
1610 static int type_init = 0;
1611 if (!type_init) {
1612 const PyTypeObject tmp
1614 PyObject_HEAD_INIT(NULL)
1615 0, /* ob_size */
1616 (char *)"PySwigObject", /* tp_name */
1617 sizeof(PySwigObject), /* tp_basicsize */
1618 0, /* tp_itemsize */
1619 (destructor)PySwigObject_dealloc, /* tp_dealloc */
1620 (printfunc)PySwigObject_print, /* tp_print */
1621 #if PY_VERSION_HEX < 0x02020000
1622 (getattrfunc)PySwigObject_getattr, /* tp_getattr */
1623 #else
1624 (getattrfunc)0, /* tp_getattr */
1625 #endif
1626 (setattrfunc)0, /* tp_setattr */
1627 (cmpfunc)PySwigObject_compare, /* tp_compare */
1628 (reprfunc)PySwigObject_repr, /* tp_repr */
1629 &PySwigObject_as_number, /* tp_as_number */
1630 0, /* tp_as_sequence */
1631 0, /* tp_as_mapping */
1632 (hashfunc)0, /* tp_hash */
1633 (ternaryfunc)0, /* tp_call */
1634 (reprfunc)PySwigObject_str, /* tp_str */
1635 PyObject_GenericGetAttr, /* tp_getattro */
1636 0, /* tp_setattro */
1637 0, /* tp_as_buffer */
1638 Py_TPFLAGS_DEFAULT, /* tp_flags */
1639 swigobject_doc, /* tp_doc */
1640 0, /* tp_traverse */
1641 0, /* tp_clear */
1642 0, /* tp_richcompare */
1643 0, /* tp_weaklistoffset */
1644 #if PY_VERSION_HEX >= 0x02020000
1645 0, /* tp_iter */
1646 0, /* tp_iternext */
1647 swigobject_methods, /* tp_methods */
1648 0, /* tp_members */
1649 0, /* tp_getset */
1650 0, /* tp_base */
1651 0, /* tp_dict */
1652 0, /* tp_descr_get */
1653 0, /* tp_descr_set */
1654 0, /* tp_dictoffset */
1655 0, /* tp_init */
1656 0, /* tp_alloc */
1657 0, /* tp_new */
1658 0, /* tp_free */
1659 0, /* tp_is_gc */
1660 0, /* tp_bases */
1661 0, /* tp_mro */
1662 0, /* tp_cache */
1663 0, /* tp_subclasses */
1664 0, /* tp_weaklist */
1665 #endif
1666 #if PY_VERSION_HEX >= 0x02030000
1667 0, /* tp_del */
1668 #endif
1669 #ifdef COUNT_ALLOCS
1670 0,0,0,0 /* tp_alloc -> tp_next */
1671 #endif
1673 pyswigobject_type = tmp;
1674 pyswigobject_type.ob_type = &PyType_Type;
1675 type_init = 1;
1677 return &pyswigobject_type;
1680 SWIGRUNTIME PyObject *
1681 PySwigObject_New(void *ptr, swig_type_info *ty, int own)
1683 PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
1684 if (sobj) {
1685 sobj->ptr = ptr;
1686 sobj->ty = ty;
1687 sobj->own = own;
1688 sobj->next = 0;
1690 return (PyObject *)sobj;
1693 /* -----------------------------------------------------------------------------
1694 * Implements a simple Swig Packed type, and use it instead of string
1695 * ----------------------------------------------------------------------------- */
1697 typedef struct {
1698 PyObject_HEAD
1699 void *pack;
1700 swig_type_info *ty;
1701 size_t size;
1702 } PySwigPacked;
1704 SWIGRUNTIME int
1705 PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1707 char result[SWIG_BUFFER_SIZE];
1708 fputs("<Swig Packed ", fp);
1709 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1710 fputs("at ", fp);
1711 fputs(result, fp);
1713 fputs(v->ty->name,fp);
1714 fputs(">", fp);
1715 return 0;
1718 SWIGRUNTIME PyObject *
1719 PySwigPacked_repr(PySwigPacked *v)
1721 char result[SWIG_BUFFER_SIZE];
1722 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1723 return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1724 } else {
1725 return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
1729 SWIGRUNTIME PyObject *
1730 PySwigPacked_str(PySwigPacked *v)
1732 char result[SWIG_BUFFER_SIZE];
1733 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
1734 return PyString_FromFormat("%s%s", result, v->ty->name);
1735 } else {
1736 return PyString_FromString(v->ty->name);
1740 SWIGRUNTIME int
1741 PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
1743 size_t i = v->size;
1744 size_t j = w->size;
1745 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1746 return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
1749 SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
1751 SWIGRUNTIME PyTypeObject*
1752 PySwigPacked_type(void) {
1753 static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
1754 return type;
1757 SWIGRUNTIMEINLINE int
1758 PySwigPacked_Check(PyObject *op) {
1759 return ((op)->ob_type == _PySwigPacked_type())
1760 || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
1763 SWIGRUNTIME void
1764 PySwigPacked_dealloc(PyObject *v)
1766 if (PySwigPacked_Check(v)) {
1767 PySwigPacked *sobj = (PySwigPacked *) v;
1768 free(sobj->pack);
1770 PyObject_DEL(v);
1773 SWIGRUNTIME PyTypeObject*
1774 _PySwigPacked_type(void) {
1775 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
1776 static PyTypeObject pyswigpacked_type;
1777 static int type_init = 0;
1778 if (!type_init) {
1779 const PyTypeObject tmp
1781 PyObject_HEAD_INIT(NULL)
1782 0, /* ob_size */
1783 (char *)"PySwigPacked", /* tp_name */
1784 sizeof(PySwigPacked), /* tp_basicsize */
1785 0, /* tp_itemsize */
1786 (destructor)PySwigPacked_dealloc, /* tp_dealloc */
1787 (printfunc)PySwigPacked_print, /* tp_print */
1788 (getattrfunc)0, /* tp_getattr */
1789 (setattrfunc)0, /* tp_setattr */
1790 (cmpfunc)PySwigPacked_compare, /* tp_compare */
1791 (reprfunc)PySwigPacked_repr, /* tp_repr */
1792 0, /* tp_as_number */
1793 0, /* tp_as_sequence */
1794 0, /* tp_as_mapping */
1795 (hashfunc)0, /* tp_hash */
1796 (ternaryfunc)0, /* tp_call */
1797 (reprfunc)PySwigPacked_str, /* tp_str */
1798 PyObject_GenericGetAttr, /* tp_getattro */
1799 0, /* tp_setattro */
1800 0, /* tp_as_buffer */
1801 Py_TPFLAGS_DEFAULT, /* tp_flags */
1802 swigpacked_doc, /* tp_doc */
1803 0, /* tp_traverse */
1804 0, /* tp_clear */
1805 0, /* tp_richcompare */
1806 0, /* tp_weaklistoffset */
1807 #if PY_VERSION_HEX >= 0x02020000
1808 0, /* tp_iter */
1809 0, /* tp_iternext */
1810 0, /* tp_methods */
1811 0, /* tp_members */
1812 0, /* tp_getset */
1813 0, /* tp_base */
1814 0, /* tp_dict */
1815 0, /* tp_descr_get */
1816 0, /* tp_descr_set */
1817 0, /* tp_dictoffset */
1818 0, /* tp_init */
1819 0, /* tp_alloc */
1820 0, /* tp_new */
1821 0, /* tp_free */
1822 0, /* tp_is_gc */
1823 0, /* tp_bases */
1824 0, /* tp_mro */
1825 0, /* tp_cache */
1826 0, /* tp_subclasses */
1827 0, /* tp_weaklist */
1828 #endif
1829 #if PY_VERSION_HEX >= 0x02030000
1830 0, /* tp_del */
1831 #endif
1832 #ifdef COUNT_ALLOCS
1833 0,0,0,0 /* tp_alloc -> tp_next */
1834 #endif
1836 pyswigpacked_type = tmp;
1837 pyswigpacked_type.ob_type = &PyType_Type;
1838 type_init = 1;
1840 return &pyswigpacked_type;
1843 SWIGRUNTIME PyObject *
1844 PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
1846 PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
1847 if (sobj) {
1848 void *pack = malloc(size);
1849 if (pack) {
1850 memcpy(pack, ptr, size);
1851 sobj->pack = pack;
1852 sobj->ty = ty;
1853 sobj->size = size;
1854 } else {
1855 PyObject_DEL((PyObject *) sobj);
1856 sobj = 0;
1859 return (PyObject *) sobj;
1862 SWIGRUNTIME swig_type_info *
1863 PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
1865 if (PySwigPacked_Check(obj)) {
1866 PySwigPacked *sobj = (PySwigPacked *)obj;
1867 if (sobj->size != size) return 0;
1868 memcpy(ptr, sobj->pack, size);
1869 return sobj->ty;
1870 } else {
1871 return 0;
1875 /* -----------------------------------------------------------------------------
1876 * pointers/data manipulation
1877 * ----------------------------------------------------------------------------- */
1879 SWIGRUNTIMEINLINE PyObject *
1880 _SWIG_This(void)
1882 return PyString_FromString("this");
1885 SWIGRUNTIME PyObject *
1886 SWIG_This(void)
1888 static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
1889 return swig_this;
1892 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
1894 SWIGRUNTIME PySwigObject *
1895 SWIG_Python_GetSwigThis(PyObject *pyobj)
1897 if (PySwigObject_Check(pyobj)) {
1898 return (PySwigObject *) pyobj;
1899 } else {
1900 PyObject *obj = 0;
1901 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
1902 if (PyInstance_Check(pyobj)) {
1903 obj = _PyInstance_Lookup(pyobj, SWIG_This());
1904 } else {
1905 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
1906 if (dictptr != NULL) {
1907 PyObject *dict = *dictptr;
1908 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
1909 } else {
1910 #ifdef PyWeakref_CheckProxy
1911 if (PyWeakref_CheckProxy(pyobj)) {
1912 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
1913 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
1915 #endif
1916 obj = PyObject_GetAttr(pyobj,SWIG_This());
1917 if (obj) {
1918 Py_DECREF(obj);
1919 } else {
1920 if (PyErr_Occurred()) PyErr_Clear();
1921 return 0;
1925 #else
1926 obj = PyObject_GetAttr(pyobj,SWIG_This());
1927 if (obj) {
1928 Py_DECREF(obj);
1929 } else {
1930 if (PyErr_Occurred()) PyErr_Clear();
1931 return 0;
1933 #endif
1934 if (obj && !PySwigObject_Check(obj)) {
1935 /* a PyObject is called 'this', try to get the 'real this'
1936 PySwigObject from it */
1937 return SWIG_Python_GetSwigThis(obj);
1939 return (PySwigObject *)obj;
1943 /* Acquire a pointer value */
1945 SWIGRUNTIME int
1946 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
1947 if (own) {
1948 PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
1949 if (sobj) {
1950 int oldown = sobj->own;
1951 sobj->own = own;
1952 return oldown;
1955 return 0;
1958 /* Convert a pointer value */
1960 SWIGRUNTIME int
1961 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
1962 if (!obj) return SWIG_ERROR;
1963 if (obj == Py_None) {
1964 if (ptr) *ptr = 0;
1965 return SWIG_OK;
1966 } else {
1967 PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
1968 while (sobj) {
1969 void *vptr = sobj->ptr;
1970 if (ty) {
1971 swig_type_info *to = sobj->ty;
1972 if (to == ty) {
1973 /* no type cast needed */
1974 if (ptr) *ptr = vptr;
1975 break;
1976 } else {
1977 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
1978 if (!tc) {
1979 sobj = (PySwigObject *)sobj->next;
1980 } else {
1981 if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
1982 break;
1985 } else {
1986 if (ptr) *ptr = vptr;
1987 break;
1990 if (sobj) {
1991 if (own) *own = sobj->own;
1992 if (flags & SWIG_POINTER_DISOWN) {
1993 sobj->own = 0;
1995 return SWIG_OK;
1996 } else {
1997 int res = SWIG_ERROR;
1998 if (flags & SWIG_POINTER_IMPLICIT_CONV) {
1999 PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
2000 if (data && !data->implicitconv) {
2001 PyObject *klass = data->klass;
2002 if (klass) {
2003 PyObject *impconv;
2004 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2005 impconv = SWIG_Python_CallFunctor(klass, obj);
2006 data->implicitconv = 0;
2007 if (PyErr_Occurred()) {
2008 PyErr_Clear();
2009 impconv = 0;
2011 if (impconv) {
2012 PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
2013 if (iobj) {
2014 void *vptr;
2015 res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2016 if (SWIG_IsOK(res)) {
2017 if (ptr) {
2018 *ptr = vptr;
2019 /* transfer the ownership to 'ptr' */
2020 iobj->own = 0;
2021 res = SWIG_AddCast(res);
2022 res = SWIG_AddNewMask(res);
2023 } else {
2024 res = SWIG_AddCast(res);
2028 Py_DECREF(impconv);
2033 return res;
2038 /* Convert a function ptr value */
2040 SWIGRUNTIME int
2041 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2042 if (!PyCFunction_Check(obj)) {
2043 return SWIG_ConvertPtr(obj, ptr, ty, 0);
2044 } else {
2045 void *vptr = 0;
2047 /* here we get the method pointer for callbacks */
2048 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2049 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2050 if (desc) {
2051 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2052 if (!desc) return SWIG_ERROR;
2054 if (ty) {
2055 swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
2056 if (!tc) return SWIG_ERROR;
2057 *ptr = SWIG_TypeCast(tc,vptr);
2058 } else {
2059 *ptr = vptr;
2061 return SWIG_OK;
2065 /* Convert a packed value value */
2067 SWIGRUNTIME int
2068 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2069 swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
2070 if (!to) return SWIG_ERROR;
2071 if (ty) {
2072 if (to != ty) {
2073 /* check type cast? */
2074 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2075 if (!tc) return SWIG_ERROR;
2078 return SWIG_OK;
2081 /* -----------------------------------------------------------------------------
2082 * Create a new pointer object
2083 * ----------------------------------------------------------------------------- */
2086 Create a new instance object, whitout calling __init__, and set the
2087 'this' attribute.
2090 SWIGRUNTIME PyObject*
2091 SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
2093 #if (PY_VERSION_HEX >= 0x02020000)
2094 PyObject *inst = 0;
2095 PyObject *newraw = data->newraw;
2096 if (newraw) {
2097 inst = PyObject_Call(newraw, data->newargs, NULL);
2098 if (inst) {
2099 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2100 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2101 if (dictptr != NULL) {
2102 PyObject *dict = *dictptr;
2103 if (dict == NULL) {
2104 dict = PyDict_New();
2105 *dictptr = dict;
2106 PyDict_SetItem(dict, SWIG_This(), swig_this);
2109 #else
2110 PyObject *key = SWIG_This();
2111 PyObject_SetAttr(inst, key, swig_this);
2112 #endif
2114 } else {
2115 PyObject *dict = PyDict_New();
2116 PyDict_SetItem(dict, SWIG_This(), swig_this);
2117 inst = PyInstance_NewRaw(data->newargs, dict);
2118 Py_DECREF(dict);
2120 return inst;
2121 #else
2122 #if (PY_VERSION_HEX >= 0x02010000)
2123 PyObject *inst;
2124 PyObject *dict = PyDict_New();
2125 PyDict_SetItem(dict, SWIG_This(), swig_this);
2126 inst = PyInstance_NewRaw(data->newargs, dict);
2127 Py_DECREF(dict);
2128 return (PyObject *) inst;
2129 #else
2130 PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
2131 if (inst == NULL) {
2132 return NULL;
2134 inst->in_class = (PyClassObject *)data->newargs;
2135 Py_INCREF(inst->in_class);
2136 inst->in_dict = PyDict_New();
2137 if (inst->in_dict == NULL) {
2138 Py_DECREF(inst);
2139 return NULL;
2141 #ifdef Py_TPFLAGS_HAVE_WEAKREFS
2142 inst->in_weakreflist = NULL;
2143 #endif
2144 #ifdef Py_TPFLAGS_GC
2145 PyObject_GC_Init(inst);
2146 #endif
2147 PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
2148 return (PyObject *) inst;
2149 #endif
2150 #endif
2153 SWIGRUNTIME void
2154 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2156 PyObject *dict;
2157 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2158 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2159 if (dictptr != NULL) {
2160 dict = *dictptr;
2161 if (dict == NULL) {
2162 dict = PyDict_New();
2163 *dictptr = dict;
2165 PyDict_SetItem(dict, SWIG_This(), swig_this);
2166 return;
2168 #endif
2169 dict = PyObject_GetAttrString(inst, (char*)"__dict__");
2170 PyDict_SetItem(dict, SWIG_This(), swig_this);
2171 Py_DECREF(dict);
2175 SWIGINTERN PyObject *
2176 SWIG_Python_InitShadowInstance(PyObject *args) {
2177 PyObject *obj[2];
2178 if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
2179 return NULL;
2180 } else {
2181 PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2182 if (sthis) {
2183 PySwigObject_append((PyObject*) sthis, obj[1]);
2184 } else {
2185 SWIG_Python_SetSwigThis(obj[0], obj[1]);
2187 return SWIG_Py_Void();
2191 /* Create a new pointer object */
2193 SWIGRUNTIME PyObject *
2194 SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
2195 if (!ptr) {
2196 return SWIG_Py_Void();
2197 } else {
2198 int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2199 PyObject *robj = PySwigObject_New(ptr, type, own);
2200 PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
2201 if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2202 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2203 if (inst) {
2204 Py_DECREF(robj);
2205 robj = inst;
2208 return robj;
2212 /* Create a new packed object */
2214 SWIGRUNTIMEINLINE PyObject *
2215 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2216 return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2219 /* -----------------------------------------------------------------------------*
2220 * Get type list
2221 * -----------------------------------------------------------------------------*/
2223 #ifdef SWIG_LINK_RUNTIME
2224 void *SWIG_ReturnGlobalTypeList(void *);
2225 #endif
2227 SWIGRUNTIME swig_module_info *
2228 SWIG_Python_GetModule(void) {
2229 static void *type_pointer = (void *)0;
2230 /* first check if module already created */
2231 if (!type_pointer) {
2232 #ifdef SWIG_LINK_RUNTIME
2233 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2234 #else
2235 type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2236 (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
2237 if (PyErr_Occurred()) {
2238 PyErr_Clear();
2239 type_pointer = (void *)0;
2241 #endif
2243 return (swig_module_info *) type_pointer;
2246 #if PY_MAJOR_VERSION < 2
2247 /* PyModule_AddObject function was introduced in Python 2.0. The following function
2248 is copied out of Python/modsupport.c in python version 2.3.4 */
2249 SWIGINTERN int
2250 PyModule_AddObject(PyObject *m, char *name, PyObject *o)
2252 PyObject *dict;
2253 if (!PyModule_Check(m)) {
2254 PyErr_SetString(PyExc_TypeError,
2255 "PyModule_AddObject() needs module as first arg");
2256 return SWIG_ERROR;
2258 if (!o) {
2259 PyErr_SetString(PyExc_TypeError,
2260 "PyModule_AddObject() needs non-NULL value");
2261 return SWIG_ERROR;
2264 dict = PyModule_GetDict(m);
2265 if (dict == NULL) {
2266 /* Internal error -- modules must have a dict! */
2267 PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
2268 PyModule_GetName(m));
2269 return SWIG_ERROR;
2271 if (PyDict_SetItemString(dict, name, o))
2272 return SWIG_ERROR;
2273 Py_DECREF(o);
2274 return SWIG_OK;
2276 #endif
2278 SWIGRUNTIME void
2279 SWIG_Python_DestroyModule(void *vptr)
2281 swig_module_info *swig_module = (swig_module_info *) vptr;
2282 swig_type_info **types = swig_module->types;
2283 size_t i;
2284 for (i =0; i < swig_module->size; ++i) {
2285 swig_type_info *ty = types[i];
2286 if (ty->owndata) {
2287 PySwigClientData *data = (PySwigClientData *) ty->clientdata;
2288 if (data) PySwigClientData_Del(data);
2291 Py_DECREF(SWIG_This());
2294 SWIGRUNTIME void
2295 SWIG_Python_SetModule(swig_module_info *swig_module) {
2296 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
2298 PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2299 swig_empty_runtime_method_table);
2300 PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
2301 if (pointer && module) {
2302 PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
2303 } else {
2304 Py_XDECREF(pointer);
2308 /* The python cached type query */
2309 SWIGRUNTIME PyObject *
2310 SWIG_Python_TypeCache(void) {
2311 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2312 return cache;
2315 SWIGRUNTIME swig_type_info *
2316 SWIG_Python_TypeQuery(const char *type)
2318 PyObject *cache = SWIG_Python_TypeCache();
2319 PyObject *key = PyString_FromString(type);
2320 PyObject *obj = PyDict_GetItem(cache, key);
2321 swig_type_info *descriptor;
2322 if (obj) {
2323 descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
2324 } else {
2325 swig_module_info *swig_module = SWIG_Python_GetModule();
2326 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2327 if (descriptor) {
2328 obj = PyCObject_FromVoidPtr(descriptor, NULL);
2329 PyDict_SetItem(cache, key, obj);
2330 Py_DECREF(obj);
2333 Py_DECREF(key);
2334 return descriptor;
2338 For backward compatibility only
2340 #define SWIG_POINTER_EXCEPTION 0
2341 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2342 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2344 SWIGRUNTIME int
2345 SWIG_Python_AddErrMesg(const char* mesg, int infront)
2347 if (PyErr_Occurred()) {
2348 PyObject *type = 0;
2349 PyObject *value = 0;
2350 PyObject *traceback = 0;
2351 PyErr_Fetch(&type, &value, &traceback);
2352 if (value) {
2353 PyObject *old_str = PyObject_Str(value);
2354 Py_XINCREF(type);
2355 PyErr_Clear();
2356 if (infront) {
2357 PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
2358 } else {
2359 PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
2361 Py_DECREF(old_str);
2363 return 1;
2364 } else {
2365 return 0;
2369 SWIGRUNTIME int
2370 SWIG_Python_ArgFail(int argnum)
2372 if (PyErr_Occurred()) {
2373 /* add information about failing argument */
2374 char mesg[256];
2375 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2376 return SWIG_Python_AddErrMesg(mesg, 1);
2377 } else {
2378 return 0;
2382 SWIGRUNTIMEINLINE const char *
2383 PySwigObject_GetDesc(PyObject *self)
2385 PySwigObject *v = (PySwigObject *)self;
2386 swig_type_info *ty = v ? v->ty : 0;
2387 return ty ? ty->str : (char*)"";
2390 SWIGRUNTIME void
2391 SWIG_Python_TypeError(const char *type, PyObject *obj)
2393 if (type) {
2394 #if defined(SWIG_COBJECT_TYPES)
2395 if (obj && PySwigObject_Check(obj)) {
2396 const char *otype = (const char *) PySwigObject_GetDesc(obj);
2397 if (otype) {
2398 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
2399 type, otype);
2400 return;
2402 } else
2403 #endif
2405 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2406 if (otype) {
2407 PyObject *str = PyObject_Str(obj);
2408 const char *cstr = str ? PyString_AsString(str) : 0;
2409 if (cstr) {
2410 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2411 type, otype, cstr);
2412 } else {
2413 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2414 type, otype);
2416 Py_XDECREF(str);
2417 return;
2420 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2421 } else {
2422 PyErr_Format(PyExc_TypeError, "unexpected type is received");
2427 /* Convert a pointer value, signal an exception on a type mismatch */
2428 SWIGRUNTIME void *
2429 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
2430 void *result;
2431 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2432 PyErr_Clear();
2433 if (flags & SWIG_POINTER_EXCEPTION) {
2434 SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2435 SWIG_Python_ArgFail(argnum);
2438 return result;
2442 #ifdef __cplusplus
2443 #if 0
2444 { /* cc-mode */
2445 #endif
2447 #endif
2451 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2453 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2457 /* -------- TYPES TABLE (BEGIN) -------- */
2459 #define SWIGTYPE_p_TDB_DATA swig_types[0]
2460 #define SWIGTYPE_p_char swig_types[1]
2461 #define SWIGTYPE_p_int swig_types[2]
2462 #define SWIGTYPE_p_long_long swig_types[3]
2463 #define SWIGTYPE_p_short swig_types[4]
2464 #define SWIGTYPE_p_signed_char swig_types[5]
2465 #define SWIGTYPE_p_tdb_context swig_types[6]
2466 #define SWIGTYPE_p_unsigned_char swig_types[7]
2467 #define SWIGTYPE_p_unsigned_int swig_types[8]
2468 #define SWIGTYPE_p_unsigned_long_long swig_types[9]
2469 #define SWIGTYPE_p_unsigned_short swig_types[10]
2470 static swig_type_info *swig_types[12];
2471 static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0};
2472 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2473 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2475 /* -------- TYPES TABLE (END) -------- */
2477 #if (PY_VERSION_HEX <= 0x02000000)
2478 # if !defined(SWIG_PYTHON_CLASSIC)
2479 # error "This python version requires swig to be run with the '-classic' option"
2480 # endif
2481 #endif
2482 #if (PY_VERSION_HEX <= 0x02020000)
2483 # error "This python version requires swig to be run with the '-nomodern' option"
2484 #endif
2485 #if (PY_VERSION_HEX <= 0x02020000)
2486 # error "This python version requires swig to be run with the '-nomodernargs' option"
2487 #endif
2488 #ifndef METH_O
2489 # error "This python version requires swig to be run with the '-nofastunpack' option"
2490 #endif
2491 #ifdef SWIG_TypeQuery
2492 # undef SWIG_TypeQuery
2493 #endif
2494 #define SWIG_TypeQuery SWIG_Python_TypeQuery
2496 /*-----------------------------------------------
2497 @(target):= _tdb.so
2498 ------------------------------------------------*/
2499 #define SWIG_init init_tdb
2501 #define SWIG_name "_tdb"
2503 #define SWIGVERSION 0x010333
2504 #define SWIG_VERSION SWIGVERSION
2507 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
2508 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
2512 /* This symbol is used in both includes.h and Python.h which causes an
2513 annoying compiler warning. */
2515 #ifdef HAVE_FSTAT
2516 #undef HAVE_FSTAT
2517 #endif
2519 /* Include tdb headers */
2520 #include <stdint.h>
2521 #include <signal.h>
2522 #include <tdb.h>
2523 #include <fcntl.h>
2525 typedef TDB_CONTEXT tdb;
2528 #define SWIG_From_long PyInt_FromLong
2531 SWIGINTERNINLINE PyObject *
2532 SWIG_From_int (int value)
2534 return SWIG_From_long (value);
2538 SWIGINTERN swig_type_info*
2539 SWIG_pchar_descriptor(void)
2541 static int init = 0;
2542 static swig_type_info* info = 0;
2543 if (!init) {
2544 info = SWIG_TypeQuery("_p_char");
2545 init = 1;
2547 return info;
2551 SWIGINTERN int
2552 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
2554 if (PyString_Check(obj)) {
2555 char *cstr; Py_ssize_t len;
2556 PyString_AsStringAndSize(obj, &cstr, &len);
2557 if (cptr) {
2558 if (alloc) {
2560 In python the user should not be able to modify the inner
2561 string representation. To warranty that, if you define
2562 SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
2563 buffer is always returned.
2565 The default behavior is just to return the pointer value,
2566 so, be careful.
2568 #if defined(SWIG_PYTHON_SAFE_CSTRINGS)
2569 if (*alloc != SWIG_OLDOBJ)
2570 #else
2571 if (*alloc == SWIG_NEWOBJ)
2572 #endif
2574 *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
2575 *alloc = SWIG_NEWOBJ;
2577 else {
2578 *cptr = cstr;
2579 *alloc = SWIG_OLDOBJ;
2581 } else {
2582 *cptr = PyString_AsString(obj);
2585 if (psize) *psize = len + 1;
2586 return SWIG_OK;
2587 } else {
2588 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
2589 if (pchar_descriptor) {
2590 void* vptr = 0;
2591 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
2592 if (cptr) *cptr = (char *) vptr;
2593 if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
2594 if (alloc) *alloc = SWIG_OLDOBJ;
2595 return SWIG_OK;
2599 return SWIG_TypeError;
2606 #include <limits.h>
2607 #if !defined(SWIG_NO_LLONG_MAX)
2608 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
2609 # define LLONG_MAX __LONG_LONG_MAX__
2610 # define LLONG_MIN (-LLONG_MAX - 1LL)
2611 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
2612 # endif
2613 #endif
2616 SWIGINTERN int
2617 SWIG_AsVal_double (PyObject *obj, double *val)
2619 int res = SWIG_TypeError;
2620 if (PyFloat_Check(obj)) {
2621 if (val) *val = PyFloat_AsDouble(obj);
2622 return SWIG_OK;
2623 } else if (PyInt_Check(obj)) {
2624 if (val) *val = PyInt_AsLong(obj);
2625 return SWIG_OK;
2626 } else if (PyLong_Check(obj)) {
2627 double v = PyLong_AsDouble(obj);
2628 if (!PyErr_Occurred()) {
2629 if (val) *val = v;
2630 return SWIG_OK;
2631 } else {
2632 PyErr_Clear();
2635 #ifdef SWIG_PYTHON_CAST_MODE
2637 int dispatch = 0;
2638 double d = PyFloat_AsDouble(obj);
2639 if (!PyErr_Occurred()) {
2640 if (val) *val = d;
2641 return SWIG_AddCast(SWIG_OK);
2642 } else {
2643 PyErr_Clear();
2645 if (!dispatch) {
2646 long v = PyLong_AsLong(obj);
2647 if (!PyErr_Occurred()) {
2648 if (val) *val = v;
2649 return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
2650 } else {
2651 PyErr_Clear();
2655 #endif
2656 return res;
2660 #include <float.h>
2663 #include <math.h>
2666 SWIGINTERNINLINE int
2667 SWIG_CanCastAsInteger(double *d, double min, double max) {
2668 double x = *d;
2669 if ((min <= x && x <= max)) {
2670 double fx = floor(x);
2671 double cx = ceil(x);
2672 double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
2673 if ((errno == EDOM) || (errno == ERANGE)) {
2674 errno = 0;
2675 } else {
2676 double summ, reps, diff;
2677 if (rd < x) {
2678 diff = x - rd;
2679 } else if (rd > x) {
2680 diff = rd - x;
2681 } else {
2682 return 1;
2684 summ = rd + x;
2685 reps = diff/summ;
2686 if (reps < 8*DBL_EPSILON) {
2687 *d = rd;
2688 return 1;
2692 return 0;
2696 SWIGINTERN int
2697 SWIG_AsVal_long (PyObject *obj, long* val)
2699 if (PyInt_Check(obj)) {
2700 if (val) *val = PyInt_AsLong(obj);
2701 return SWIG_OK;
2702 } else if (PyLong_Check(obj)) {
2703 long v = PyLong_AsLong(obj);
2704 if (!PyErr_Occurred()) {
2705 if (val) *val = v;
2706 return SWIG_OK;
2707 } else {
2708 PyErr_Clear();
2711 #ifdef SWIG_PYTHON_CAST_MODE
2713 int dispatch = 0;
2714 long v = PyInt_AsLong(obj);
2715 if (!PyErr_Occurred()) {
2716 if (val) *val = v;
2717 return SWIG_AddCast(SWIG_OK);
2718 } else {
2719 PyErr_Clear();
2721 if (!dispatch) {
2722 double d;
2723 int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
2724 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
2725 if (val) *val = (long)(d);
2726 return res;
2730 #endif
2731 return SWIG_TypeError;
2735 SWIGINTERN int
2736 SWIG_AsVal_int (PyObject * obj, int *val)
2738 long v;
2739 int res = SWIG_AsVal_long (obj, &v);
2740 if (SWIG_IsOK(res)) {
2741 if ((v < INT_MIN || v > INT_MAX)) {
2742 return SWIG_OverflowError;
2743 } else {
2744 if (val) *val = (int)(v);
2747 return res;
2750 SWIGINTERN tdb *new_tdb(char const *name,int hash_size,int tdb_flags,int open_flags,mode_t mode){
2751 tdb *ret = tdb_open(name, hash_size, tdb_flags, open_flags, mode);
2753 /* Throw an IOError exception from errno if tdb_open() returns
2754 NULL */
2755 if (ret == NULL) {
2756 PyErr_SetFromErrno(PyExc_IOError);
2757 SWIG_fail;
2760 fail:
2761 return ret;
2763 SWIGINTERN void delete_tdb(tdb *self){ tdb_close(self); }
2765 SWIGINTERNINLINE PyObject *
2766 SWIG_FromCharPtrAndSize(const char* carray, size_t size)
2768 if (carray) {
2769 if (size > INT_MAX) {
2770 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
2771 return pchar_descriptor ?
2772 SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
2773 } else {
2774 return PyString_FromStringAndSize(carray, (int)(size));
2776 } else {
2777 return SWIG_Py_Void();
2782 SWIGINTERNINLINE PyObject *
2783 SWIG_FromCharPtr(const char *cptr)
2785 return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
2789 SWIGINTERNINLINE PyObject*
2790 SWIG_From_unsigned_SS_long (unsigned long value)
2792 return (value > LONG_MAX) ?
2793 PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value));
2797 SWIGINTERNINLINE PyObject *
2798 SWIG_From_size_t (size_t value)
2800 return SWIG_From_unsigned_SS_long ((unsigned long)(value));
2803 #ifdef __cplusplus
2804 extern "C" {
2805 #endif
2806 SWIGINTERN PyObject *_wrap_new_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
2807 PyObject *resultobj = 0;
2808 char *arg1 = (char *) 0 ;
2809 int arg2 ;
2810 int arg3 ;
2811 int arg4 ;
2812 mode_t arg5 ;
2813 tdb *result = 0 ;
2814 int res1 ;
2815 char *buf1 = 0 ;
2816 int alloc1 = 0 ;
2817 int val2 ;
2818 int ecode2 = 0 ;
2819 int val3 ;
2820 int ecode3 = 0 ;
2821 int val4 ;
2822 int ecode4 = 0 ;
2823 int val5 ;
2824 int ecode5 = 0 ;
2825 PyObject * obj0 = 0 ;
2826 PyObject * obj1 = 0 ;
2827 PyObject * obj2 = 0 ;
2828 PyObject * obj3 = 0 ;
2829 PyObject * obj4 = 0 ;
2830 char * kwnames[] = {
2831 (char *) "name",(char *) "hash_size",(char *) "tdb_flags",(char *) "open_flags",(char *) "mode", NULL
2835 arg2 = 0;
2838 arg3 = TDB_DEFAULT;
2841 arg4 = O_RDWR;
2844 arg5 = 0600;
2846 if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:new_Tdb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
2847 res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
2848 if (!SWIG_IsOK(res1)) {
2849 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Tdb" "', argument " "1"" of type '" "char const *""'");
2851 arg1 = (char *)(buf1);
2852 if (obj1) {
2853 ecode2 = SWIG_AsVal_int(obj1, &val2);
2854 if (!SWIG_IsOK(ecode2)) {
2855 SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Tdb" "', argument " "2"" of type '" "int""'");
2857 arg2 = (int)(val2);
2859 if (obj2) {
2860 ecode3 = SWIG_AsVal_int(obj2, &val3);
2861 if (!SWIG_IsOK(ecode3)) {
2862 SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_Tdb" "', argument " "3"" of type '" "int""'");
2864 arg3 = (int)(val3);
2866 if (obj3) {
2867 ecode4 = SWIG_AsVal_int(obj3, &val4);
2868 if (!SWIG_IsOK(ecode4)) {
2869 SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_Tdb" "', argument " "4"" of type '" "int""'");
2871 arg4 = (int)(val4);
2873 if (obj4) {
2874 ecode5 = SWIG_AsVal_int(obj4, &val5);
2875 if (!SWIG_IsOK(ecode5)) {
2876 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_Tdb" "', argument " "5"" of type '" "mode_t""'");
2878 arg5 = (mode_t)(val5);
2880 result = (tdb *)new_tdb((char const *)arg1,arg2,arg3,arg4,arg5);
2881 resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_tdb_context, SWIG_POINTER_OWN | 0 );
2882 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2883 return resultobj;
2884 fail:
2885 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2886 return NULL;
2890 SWIGINTERN PyObject *_wrap_tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2891 PyObject *resultobj = 0;
2892 tdb *arg1 = (tdb *) 0 ;
2893 enum TDB_ERROR result;
2894 void *argp1 = 0 ;
2895 int res1 = 0 ;
2896 PyObject *swig_obj[1] ;
2898 if (!args) SWIG_fail;
2899 swig_obj[0] = args;
2900 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
2901 if (!SWIG_IsOK(res1)) {
2902 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_error" "', argument " "1"" of type '" "tdb *""'");
2904 arg1 = (tdb *)(argp1);
2905 result = (enum TDB_ERROR)tdb_error(arg1);
2906 resultobj = SWIG_From_int((int)(result));
2907 return resultobj;
2908 fail:
2909 return NULL;
2913 SWIGINTERN PyObject *_wrap_delete_tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2914 PyObject *resultobj = 0;
2915 tdb *arg1 = (tdb *) 0 ;
2916 void *argp1 = 0 ;
2917 int res1 = 0 ;
2918 PyObject *swig_obj[1] ;
2920 if (!args) SWIG_fail;
2921 swig_obj[0] = args;
2922 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, SWIG_POINTER_DISOWN | 0 );
2923 if (!SWIG_IsOK(res1)) {
2924 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_tdb" "', argument " "1"" of type '" "tdb *""'");
2926 arg1 = (tdb *)(argp1);
2927 delete_tdb(arg1);
2929 resultobj = SWIG_Py_Void();
2930 return resultobj;
2931 fail:
2932 return NULL;
2936 SWIGINTERN PyObject *_wrap_tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2937 PyObject *resultobj = 0;
2938 tdb *arg1 = (tdb *) 0 ;
2939 int result;
2940 void *argp1 = 0 ;
2941 int res1 = 0 ;
2942 PyObject *swig_obj[1] ;
2944 if (!args) SWIG_fail;
2945 swig_obj[0] = args;
2946 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
2947 if (!SWIG_IsOK(res1)) {
2948 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_close" "', argument " "1"" of type '" "tdb *""'");
2950 arg1 = (tdb *)(argp1);
2951 result = (int)tdb_close(arg1);
2952 resultobj = SWIG_From_int((int)(result));
2953 return resultobj;
2954 fail:
2955 return NULL;
2959 SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
2960 PyObject *resultobj = 0;
2961 tdb *arg1 = (tdb *) 0 ;
2962 TDB_DATA arg2 ;
2963 TDB_DATA arg3 ;
2964 int result;
2965 void *argp1 = 0 ;
2966 int res1 = 0 ;
2967 PyObject * obj0 = 0 ;
2968 PyObject * obj1 = 0 ;
2969 PyObject * obj2 = 0 ;
2970 char * kwnames[] = {
2971 (char *) "self",(char *) "key",(char *) "new_dbuf", NULL
2974 if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
2975 res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
2976 if (!SWIG_IsOK(res1)) {
2977 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_append" "', argument " "1"" of type '" "tdb *""'");
2979 arg1 = (tdb *)(argp1);
2981 if (!PyString_Check(obj1)) {
2982 PyErr_SetString(PyExc_TypeError, "string arg expected");
2983 return NULL;
2985 (&arg2)->dsize = PyString_Size(obj1);
2986 (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
2989 if (!PyString_Check(obj2)) {
2990 PyErr_SetString(PyExc_TypeError, "string arg expected");
2991 return NULL;
2993 (&arg3)->dsize = PyString_Size(obj2);
2994 (&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
2996 result = (int)tdb_append(arg1,arg2,arg3);
2997 resultobj = SWIG_From_int((int)(result));
2998 return resultobj;
2999 fail:
3000 return NULL;
3004 SWIGINTERN PyObject *_wrap_tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3005 PyObject *resultobj = 0;
3006 tdb *arg1 = (tdb *) 0 ;
3007 char *result = 0 ;
3008 void *argp1 = 0 ;
3009 int res1 = 0 ;
3010 PyObject *swig_obj[1] ;
3012 if (!args) SWIG_fail;
3013 swig_obj[0] = args;
3014 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3015 if (!SWIG_IsOK(res1)) {
3016 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_errorstr" "', argument " "1"" of type '" "tdb *""'");
3018 arg1 = (tdb *)(argp1);
3019 result = (char *)tdb_errorstr(arg1);
3020 resultobj = SWIG_FromCharPtr((const char *)result);
3021 return resultobj;
3022 fail:
3023 return NULL;
3027 SWIGINTERN PyObject *_wrap_tdb_fetch(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
3028 PyObject *resultobj = 0;
3029 tdb *arg1 = (tdb *) 0 ;
3030 TDB_DATA arg2 ;
3031 TDB_DATA result;
3032 void *argp1 = 0 ;
3033 int res1 = 0 ;
3034 PyObject * obj0 = 0 ;
3035 PyObject * obj1 = 0 ;
3036 char * kwnames[] = {
3037 (char *) "self",(char *) "key", NULL
3040 if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_fetch",kwnames,&obj0,&obj1)) SWIG_fail;
3041 res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3042 if (!SWIG_IsOK(res1)) {
3043 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_fetch" "', argument " "1"" of type '" "tdb *""'");
3045 arg1 = (tdb *)(argp1);
3047 if (!PyString_Check(obj1)) {
3048 PyErr_SetString(PyExc_TypeError, "string arg expected");
3049 return NULL;
3051 (&arg2)->dsize = PyString_Size(obj1);
3052 (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
3054 result = tdb_fetch(arg1,arg2);
3056 if ((&result)->dptr == NULL && (&result)->dsize == 0) {
3057 resultobj = Py_None;
3058 } else {
3059 resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
3060 free((&result)->dptr);
3063 return resultobj;
3064 fail:
3065 return NULL;
3069 SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
3070 PyObject *resultobj = 0;
3071 tdb *arg1 = (tdb *) 0 ;
3072 TDB_DATA arg2 ;
3073 int result;
3074 void *argp1 = 0 ;
3075 int res1 = 0 ;
3076 PyObject * obj0 = 0 ;
3077 PyObject * obj1 = 0 ;
3078 char * kwnames[] = {
3079 (char *) "self",(char *) "key", NULL
3082 if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail;
3083 res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3084 if (!SWIG_IsOK(res1)) {
3085 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_delete" "', argument " "1"" of type '" "tdb *""'");
3087 arg1 = (tdb *)(argp1);
3089 if (!PyString_Check(obj1)) {
3090 PyErr_SetString(PyExc_TypeError, "string arg expected");
3091 return NULL;
3093 (&arg2)->dsize = PyString_Size(obj1);
3094 (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
3096 result = (int)tdb_delete(arg1,arg2);
3097 resultobj = SWIG_From_int((int)(result));
3098 return resultobj;
3099 fail:
3100 return NULL;
3104 SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
3105 PyObject *resultobj = 0;
3106 tdb *arg1 = (tdb *) 0 ;
3107 TDB_DATA arg2 ;
3108 TDB_DATA arg3 ;
3109 int arg4 ;
3110 int result;
3111 void *argp1 = 0 ;
3112 int res1 = 0 ;
3113 int val4 ;
3114 int ecode4 = 0 ;
3115 PyObject * obj0 = 0 ;
3116 PyObject * obj1 = 0 ;
3117 PyObject * obj2 = 0 ;
3118 PyObject * obj3 = 0 ;
3119 char * kwnames[] = {
3120 (char *) "self",(char *) "key",(char *) "dbuf",(char *) "flag", NULL
3124 arg4 = TDB_REPLACE;
3126 if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
3127 res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3128 if (!SWIG_IsOK(res1)) {
3129 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_store" "', argument " "1"" of type '" "tdb *""'");
3131 arg1 = (tdb *)(argp1);
3133 if (!PyString_Check(obj1)) {
3134 PyErr_SetString(PyExc_TypeError, "string arg expected");
3135 return NULL;
3137 (&arg2)->dsize = PyString_Size(obj1);
3138 (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
3141 if (!PyString_Check(obj2)) {
3142 PyErr_SetString(PyExc_TypeError, "string arg expected");
3143 return NULL;
3145 (&arg3)->dsize = PyString_Size(obj2);
3146 (&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
3148 if (obj3) {
3149 ecode4 = SWIG_AsVal_int(obj3, &val4);
3150 if (!SWIG_IsOK(ecode4)) {
3151 SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "tdb_store" "', argument " "4"" of type '" "int""'");
3153 arg4 = (int)(val4);
3155 result = (int)tdb_store(arg1,arg2,arg3,arg4);
3156 resultobj = SWIG_From_int((int)(result));
3157 return resultobj;
3158 fail:
3159 return NULL;
3163 SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
3164 PyObject *resultobj = 0;
3165 tdb *arg1 = (tdb *) 0 ;
3166 TDB_DATA arg2 ;
3167 int result;
3168 void *argp1 = 0 ;
3169 int res1 = 0 ;
3170 PyObject * obj0 = 0 ;
3171 PyObject * obj1 = 0 ;
3172 char * kwnames[] = {
3173 (char *) "self",(char *) "key", NULL
3176 if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail;
3177 res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3178 if (!SWIG_IsOK(res1)) {
3179 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_exists" "', argument " "1"" of type '" "tdb *""'");
3181 arg1 = (tdb *)(argp1);
3183 if (!PyString_Check(obj1)) {
3184 PyErr_SetString(PyExc_TypeError, "string arg expected");
3185 return NULL;
3187 (&arg2)->dsize = PyString_Size(obj1);
3188 (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
3190 result = (int)tdb_exists(arg1,arg2);
3191 resultobj = SWIG_From_int((int)(result));
3192 return resultobj;
3193 fail:
3194 return NULL;
3198 SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3199 PyObject *resultobj = 0;
3200 tdb *arg1 = (tdb *) 0 ;
3201 TDB_DATA result;
3202 void *argp1 = 0 ;
3203 int res1 = 0 ;
3204 PyObject *swig_obj[1] ;
3206 if (!args) SWIG_fail;
3207 swig_obj[0] = args;
3208 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3209 if (!SWIG_IsOK(res1)) {
3210 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_firstkey" "', argument " "1"" of type '" "tdb *""'");
3212 arg1 = (tdb *)(argp1);
3213 result = tdb_firstkey(arg1);
3215 if ((&result)->dptr == NULL && (&result)->dsize == 0) {
3216 resultobj = Py_None;
3217 } else {
3218 resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
3219 free((&result)->dptr);
3222 return resultobj;
3223 fail:
3224 return NULL;
3228 SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
3229 PyObject *resultobj = 0;
3230 tdb *arg1 = (tdb *) 0 ;
3231 TDB_DATA arg2 ;
3232 TDB_DATA result;
3233 void *argp1 = 0 ;
3234 int res1 = 0 ;
3235 PyObject * obj0 = 0 ;
3236 PyObject * obj1 = 0 ;
3237 char * kwnames[] = {
3238 (char *) "self",(char *) "key", NULL
3241 if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail;
3242 res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3243 if (!SWIG_IsOK(res1)) {
3244 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_nextkey" "', argument " "1"" of type '" "tdb *""'");
3246 arg1 = (tdb *)(argp1);
3248 if (!PyString_Check(obj1)) {
3249 PyErr_SetString(PyExc_TypeError, "string arg expected");
3250 return NULL;
3252 (&arg2)->dsize = PyString_Size(obj1);
3253 (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
3255 result = tdb_nextkey(arg1,arg2);
3257 if ((&result)->dptr == NULL && (&result)->dsize == 0) {
3258 resultobj = Py_None;
3259 } else {
3260 resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
3261 free((&result)->dptr);
3264 return resultobj;
3265 fail:
3266 return NULL;
3270 SWIGINTERN PyObject *_wrap_tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3271 PyObject *resultobj = 0;
3272 tdb *arg1 = (tdb *) 0 ;
3273 int result;
3274 void *argp1 = 0 ;
3275 int res1 = 0 ;
3276 PyObject *swig_obj[1] ;
3278 if (!args) SWIG_fail;
3279 swig_obj[0] = args;
3280 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3281 if (!SWIG_IsOK(res1)) {
3282 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_lock_all" "', argument " "1"" of type '" "tdb *""'");
3284 arg1 = (tdb *)(argp1);
3285 result = (int)tdb_lockall(arg1);
3286 resultobj = SWIG_From_int((int)(result));
3287 return resultobj;
3288 fail:
3289 return NULL;
3293 SWIGINTERN PyObject *_wrap_tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3294 PyObject *resultobj = 0;
3295 tdb *arg1 = (tdb *) 0 ;
3296 int result;
3297 void *argp1 = 0 ;
3298 int res1 = 0 ;
3299 PyObject *swig_obj[1] ;
3301 if (!args) SWIG_fail;
3302 swig_obj[0] = args;
3303 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3304 if (!SWIG_IsOK(res1)) {
3305 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_unlock_all" "', argument " "1"" of type '" "tdb *""'");
3307 arg1 = (tdb *)(argp1);
3308 result = (int)tdb_unlockall(arg1);
3309 resultobj = SWIG_From_int((int)(result));
3310 return resultobj;
3311 fail:
3312 return NULL;
3316 SWIGINTERN PyObject *_wrap_tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3317 PyObject *resultobj = 0;
3318 tdb *arg1 = (tdb *) 0 ;
3319 int result;
3320 void *argp1 = 0 ;
3321 int res1 = 0 ;
3322 PyObject *swig_obj[1] ;
3324 if (!args) SWIG_fail;
3325 swig_obj[0] = args;
3326 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3327 if (!SWIG_IsOK(res1)) {
3328 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_read_lock_all" "', argument " "1"" of type '" "tdb *""'");
3330 arg1 = (tdb *)(argp1);
3331 result = (int)tdb_lockall_read(arg1);
3332 resultobj = SWIG_From_int((int)(result));
3333 return resultobj;
3334 fail:
3335 return NULL;
3339 SWIGINTERN PyObject *_wrap_tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3340 PyObject *resultobj = 0;
3341 tdb *arg1 = (tdb *) 0 ;
3342 int result;
3343 void *argp1 = 0 ;
3344 int res1 = 0 ;
3345 PyObject *swig_obj[1] ;
3347 if (!args) SWIG_fail;
3348 swig_obj[0] = args;
3349 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3350 if (!SWIG_IsOK(res1)) {
3351 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_read_unlock_all" "', argument " "1"" of type '" "tdb *""'");
3353 arg1 = (tdb *)(argp1);
3354 result = (int)tdb_unlockall_read(arg1);
3355 resultobj = SWIG_From_int((int)(result));
3356 return resultobj;
3357 fail:
3358 return NULL;
3362 SWIGINTERN PyObject *_wrap_tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3363 PyObject *resultobj = 0;
3364 tdb *arg1 = (tdb *) 0 ;
3365 int result;
3366 void *argp1 = 0 ;
3367 int res1 = 0 ;
3368 PyObject *swig_obj[1] ;
3370 if (!args) SWIG_fail;
3371 swig_obj[0] = args;
3372 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3373 if (!SWIG_IsOK(res1)) {
3374 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_reopen" "', argument " "1"" of type '" "tdb *""'");
3376 arg1 = (tdb *)(argp1);
3377 result = (int)tdb_reopen(arg1);
3378 resultobj = SWIG_From_int((int)(result));
3379 return resultobj;
3380 fail:
3381 return NULL;
3385 SWIGINTERN PyObject *_wrap_tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3386 PyObject *resultobj = 0;
3387 tdb *arg1 = (tdb *) 0 ;
3388 int result;
3389 void *argp1 = 0 ;
3390 int res1 = 0 ;
3391 PyObject *swig_obj[1] ;
3393 if (!args) SWIG_fail;
3394 swig_obj[0] = args;
3395 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3396 if (!SWIG_IsOK(res1)) {
3397 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_start" "', argument " "1"" of type '" "tdb *""'");
3399 arg1 = (tdb *)(argp1);
3400 result = (int)tdb_transaction_start(arg1);
3401 resultobj = SWIG_From_int((int)(result));
3402 return resultobj;
3403 fail:
3404 return NULL;
3408 SWIGINTERN PyObject *_wrap_tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3409 PyObject *resultobj = 0;
3410 tdb *arg1 = (tdb *) 0 ;
3411 int result;
3412 void *argp1 = 0 ;
3413 int res1 = 0 ;
3414 PyObject *swig_obj[1] ;
3416 if (!args) SWIG_fail;
3417 swig_obj[0] = args;
3418 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3419 if (!SWIG_IsOK(res1)) {
3420 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_commit" "', argument " "1"" of type '" "tdb *""'");
3422 arg1 = (tdb *)(argp1);
3423 result = (int)tdb_transaction_commit(arg1);
3424 resultobj = SWIG_From_int((int)(result));
3425 return resultobj;
3426 fail:
3427 return NULL;
3431 SWIGINTERN PyObject *_wrap_tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3432 PyObject *resultobj = 0;
3433 tdb *arg1 = (tdb *) 0 ;
3434 int result;
3435 void *argp1 = 0 ;
3436 int res1 = 0 ;
3437 PyObject *swig_obj[1] ;
3439 if (!args) SWIG_fail;
3440 swig_obj[0] = args;
3441 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3442 if (!SWIG_IsOK(res1)) {
3443 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_cancel" "', argument " "1"" of type '" "tdb *""'");
3445 arg1 = (tdb *)(argp1);
3446 result = (int)tdb_transaction_cancel(arg1);
3447 resultobj = SWIG_From_int((int)(result));
3448 return resultobj;
3449 fail:
3450 return NULL;
3454 SWIGINTERN PyObject *_wrap_tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3455 PyObject *resultobj = 0;
3456 tdb *arg1 = (tdb *) 0 ;
3457 int result;
3458 void *argp1 = 0 ;
3459 int res1 = 0 ;
3460 PyObject *swig_obj[1] ;
3462 if (!args) SWIG_fail;
3463 swig_obj[0] = args;
3464 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3465 if (!SWIG_IsOK(res1)) {
3466 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_recover" "', argument " "1"" of type '" "tdb *""'");
3468 arg1 = (tdb *)(argp1);
3469 result = (int)tdb_transaction_recover(arg1);
3470 resultobj = SWIG_From_int((int)(result));
3471 return resultobj;
3472 fail:
3473 return NULL;
3477 SWIGINTERN PyObject *_wrap_tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3478 PyObject *resultobj = 0;
3479 tdb *arg1 = (tdb *) 0 ;
3480 int result;
3481 void *argp1 = 0 ;
3482 int res1 = 0 ;
3483 PyObject *swig_obj[1] ;
3485 if (!args) SWIG_fail;
3486 swig_obj[0] = args;
3487 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3488 if (!SWIG_IsOK(res1)) {
3489 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_hash_size" "', argument " "1"" of type '" "tdb *""'");
3491 arg1 = (tdb *)(argp1);
3492 result = (int)tdb_hash_size(arg1);
3493 resultobj = SWIG_From_int((int)(result));
3494 return resultobj;
3495 fail:
3496 return NULL;
3500 SWIGINTERN PyObject *_wrap_tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3501 PyObject *resultobj = 0;
3502 tdb *arg1 = (tdb *) 0 ;
3503 size_t result;
3504 void *argp1 = 0 ;
3505 int res1 = 0 ;
3506 PyObject *swig_obj[1] ;
3508 if (!args) SWIG_fail;
3509 swig_obj[0] = args;
3510 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3511 if (!SWIG_IsOK(res1)) {
3512 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_map_size" "', argument " "1"" of type '" "tdb *""'");
3514 arg1 = (tdb *)(argp1);
3515 result = tdb_map_size(arg1);
3516 resultobj = SWIG_From_size_t((size_t)(result));
3517 return resultobj;
3518 fail:
3519 return NULL;
3523 SWIGINTERN PyObject *_wrap_tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3524 PyObject *resultobj = 0;
3525 tdb *arg1 = (tdb *) 0 ;
3526 int result;
3527 void *argp1 = 0 ;
3528 int res1 = 0 ;
3529 PyObject *swig_obj[1] ;
3531 if (!args) SWIG_fail;
3532 swig_obj[0] = args;
3533 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3534 if (!SWIG_IsOK(res1)) {
3535 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_get_flags" "', argument " "1"" of type '" "tdb *""'");
3537 arg1 = (tdb *)(argp1);
3538 result = (int)tdb_get_flags(arg1);
3539 resultobj = SWIG_From_int((int)(result));
3540 return resultobj;
3541 fail:
3542 return NULL;
3546 SWIGINTERN PyObject *_wrap_tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
3547 PyObject *resultobj = 0;
3548 tdb *arg1 = (tdb *) 0 ;
3549 int arg2 ;
3550 void *argp1 = 0 ;
3551 int res1 = 0 ;
3552 int val2 ;
3553 int ecode2 = 0 ;
3554 PyObject * obj0 = 0 ;
3555 PyObject * obj1 = 0 ;
3556 char * kwnames[] = {
3557 (char *) "self",(char *) "max_dead", NULL
3560 if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_set_max_dead",kwnames,&obj0,&obj1)) SWIG_fail;
3561 res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3562 if (!SWIG_IsOK(res1)) {
3563 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_set_max_dead" "', argument " "1"" of type '" "tdb *""'");
3565 arg1 = (tdb *)(argp1);
3566 ecode2 = SWIG_AsVal_int(obj1, &val2);
3567 if (!SWIG_IsOK(ecode2)) {
3568 SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tdb_set_max_dead" "', argument " "2"" of type '" "int""'");
3570 arg2 = (int)(val2);
3571 tdb_set_max_dead(arg1,arg2);
3572 resultobj = SWIG_Py_Void();
3573 return resultobj;
3574 fail:
3575 return NULL;
3579 SWIGINTERN PyObject *_wrap_tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3580 PyObject *resultobj = 0;
3581 tdb *arg1 = (tdb *) 0 ;
3582 char *result = 0 ;
3583 void *argp1 = 0 ;
3584 int res1 = 0 ;
3585 PyObject *swig_obj[1] ;
3587 if (!args) SWIG_fail;
3588 swig_obj[0] = args;
3589 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
3590 if (!SWIG_IsOK(res1)) {
3591 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_name" "', argument " "1"" of type '" "tdb *""'");
3593 arg1 = (tdb *)(argp1);
3594 result = (char *)tdb_name(arg1);
3595 resultobj = SWIG_FromCharPtr((const char *)result);
3596 return resultobj;
3597 fail:
3598 return NULL;
3602 SWIGINTERN PyObject *tdb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3603 PyObject *obj;
3604 if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
3605 SWIG_TypeNewClientData(SWIGTYPE_p_tdb_context, SWIG_NewClientData(obj));
3606 return SWIG_Py_Void();
3609 static PyMethodDef SwigMethods[] = {
3610 { (char *)"new_Tdb", (PyCFunction) _wrap_new_Tdb, METH_VARARGS | METH_KEYWORDS, NULL},
3611 { (char *)"tdb_error", (PyCFunction)_wrap_tdb_error, METH_O, NULL},
3612 { (char *)"delete_tdb", (PyCFunction)_wrap_delete_tdb, METH_O, NULL},
3613 { (char *)"tdb_close", (PyCFunction)_wrap_tdb_close, METH_O, NULL},
3614 { (char *)"tdb_append", (PyCFunction) _wrap_tdb_append, METH_VARARGS | METH_KEYWORDS, NULL},
3615 { (char *)"tdb_errorstr", (PyCFunction)_wrap_tdb_errorstr, METH_O, NULL},
3616 { (char *)"tdb_fetch", (PyCFunction) _wrap_tdb_fetch, METH_VARARGS | METH_KEYWORDS, NULL},
3617 { (char *)"tdb_delete", (PyCFunction) _wrap_tdb_delete, METH_VARARGS | METH_KEYWORDS, NULL},
3618 { (char *)"tdb_store", (PyCFunction) _wrap_tdb_store, METH_VARARGS | METH_KEYWORDS, NULL},
3619 { (char *)"tdb_exists", (PyCFunction) _wrap_tdb_exists, METH_VARARGS | METH_KEYWORDS, NULL},
3620 { (char *)"tdb_firstkey", (PyCFunction)_wrap_tdb_firstkey, METH_O, NULL},
3621 { (char *)"tdb_nextkey", (PyCFunction) _wrap_tdb_nextkey, METH_VARARGS | METH_KEYWORDS, NULL},
3622 { (char *)"tdb_lock_all", (PyCFunction)_wrap_tdb_lock_all, METH_O, NULL},
3623 { (char *)"tdb_unlock_all", (PyCFunction)_wrap_tdb_unlock_all, METH_O, NULL},
3624 { (char *)"tdb_read_lock_all", (PyCFunction)_wrap_tdb_read_lock_all, METH_O, NULL},
3625 { (char *)"tdb_read_unlock_all", (PyCFunction)_wrap_tdb_read_unlock_all, METH_O, NULL},
3626 { (char *)"tdb_reopen", (PyCFunction)_wrap_tdb_reopen, METH_O, NULL},
3627 { (char *)"tdb_transaction_start", (PyCFunction)_wrap_tdb_transaction_start, METH_O, NULL},
3628 { (char *)"tdb_transaction_commit", (PyCFunction)_wrap_tdb_transaction_commit, METH_O, NULL},
3629 { (char *)"tdb_transaction_cancel", (PyCFunction)_wrap_tdb_transaction_cancel, METH_O, NULL},
3630 { (char *)"tdb_transaction_recover", (PyCFunction)_wrap_tdb_transaction_recover, METH_O, NULL},
3631 { (char *)"tdb_hash_size", (PyCFunction)_wrap_tdb_hash_size, METH_O, NULL},
3632 { (char *)"tdb_map_size", (PyCFunction)_wrap_tdb_map_size, METH_O, NULL},
3633 { (char *)"tdb_get_flags", (PyCFunction)_wrap_tdb_get_flags, METH_O, NULL},
3634 { (char *)"tdb_set_max_dead", (PyCFunction) _wrap_tdb_set_max_dead, METH_VARARGS | METH_KEYWORDS, NULL},
3635 { (char *)"tdb_name", (PyCFunction)_wrap_tdb_name, METH_O, NULL},
3636 { (char *)"tdb_swigregister", tdb_swigregister, METH_VARARGS, NULL},
3637 { NULL, NULL, 0, NULL }
3641 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3643 static swig_type_info _swigt__p_TDB_DATA = {"_p_TDB_DATA", "TDB_DATA *", 0, 0, (void*)0, 0};
3644 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
3645 static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *|mode_t *", 0, 0, (void*)0, 0};
3646 static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
3647 static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
3648 static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
3649 static swig_type_info _swigt__p_tdb_context = {"_p_tdb_context", "struct tdb_context *|tdb *", 0, 0, (void*)0, 0};
3650 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
3651 static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
3652 static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
3653 static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
3655 static swig_type_info *swig_type_initial[] = {
3656 &_swigt__p_TDB_DATA,
3657 &_swigt__p_char,
3658 &_swigt__p_int,
3659 &_swigt__p_long_long,
3660 &_swigt__p_short,
3661 &_swigt__p_signed_char,
3662 &_swigt__p_tdb_context,
3663 &_swigt__p_unsigned_char,
3664 &_swigt__p_unsigned_int,
3665 &_swigt__p_unsigned_long_long,
3666 &_swigt__p_unsigned_short,
3669 static swig_cast_info _swigc__p_TDB_DATA[] = { {&_swigt__p_TDB_DATA, 0, 0, 0},{0, 0, 0, 0}};
3670 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
3671 static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
3672 static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
3673 static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
3674 static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
3675 static swig_cast_info _swigc__p_tdb_context[] = { {&_swigt__p_tdb_context, 0, 0, 0},{0, 0, 0, 0}};
3676 static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
3677 static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
3678 static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
3679 static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
3681 static swig_cast_info *swig_cast_initial[] = {
3682 _swigc__p_TDB_DATA,
3683 _swigc__p_char,
3684 _swigc__p_int,
3685 _swigc__p_long_long,
3686 _swigc__p_short,
3687 _swigc__p_signed_char,
3688 _swigc__p_tdb_context,
3689 _swigc__p_unsigned_char,
3690 _swigc__p_unsigned_int,
3691 _swigc__p_unsigned_long_long,
3692 _swigc__p_unsigned_short,
3696 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3698 static swig_const_info swig_const_table[] = {
3699 {0, 0, 0, 0.0, 0, 0}};
3701 #ifdef __cplusplus
3703 #endif
3704 /* -----------------------------------------------------------------------------
3705 * Type initialization:
3706 * This problem is tough by the requirement that no dynamic
3707 * memory is used. Also, since swig_type_info structures store pointers to
3708 * swig_cast_info structures and swig_cast_info structures store pointers back
3709 * to swig_type_info structures, we need some lookup code at initialization.
3710 * The idea is that swig generates all the structures that are needed.
3711 * The runtime then collects these partially filled structures.
3712 * The SWIG_InitializeModule function takes these initial arrays out of
3713 * swig_module, and does all the lookup, filling in the swig_module.types
3714 * array with the correct data and linking the correct swig_cast_info
3715 * structures together.
3717 * The generated swig_type_info structures are assigned staticly to an initial
3718 * array. We just loop through that array, and handle each type individually.
3719 * First we lookup if this type has been already loaded, and if so, use the
3720 * loaded structure instead of the generated one. Then we have to fill in the
3721 * cast linked list. The cast data is initially stored in something like a
3722 * two-dimensional array. Each row corresponds to a type (there are the same
3723 * number of rows as there are in the swig_type_initial array). Each entry in
3724 * a column is one of the swig_cast_info structures for that type.
3725 * The cast_initial array is actually an array of arrays, because each row has
3726 * a variable number of columns. So to actually build the cast linked list,
3727 * we find the array of casts associated with the type, and loop through it
3728 * adding the casts to the list. The one last trick we need to do is making
3729 * sure the type pointer in the swig_cast_info struct is correct.
3731 * First off, we lookup the cast->type name to see if it is already loaded.
3732 * There are three cases to handle:
3733 * 1) If the cast->type has already been loaded AND the type we are adding
3734 * casting info to has not been loaded (it is in this module), THEN we
3735 * replace the cast->type pointer with the type pointer that has already
3736 * been loaded.
3737 * 2) If BOTH types (the one we are adding casting info to, and the
3738 * cast->type) are loaded, THEN the cast info has already been loaded by
3739 * the previous module so we just ignore it.
3740 * 3) Finally, if cast->type has not already been loaded, then we add that
3741 * swig_cast_info to the linked list (because the cast->type) pointer will
3742 * be correct.
3743 * ----------------------------------------------------------------------------- */
3745 #ifdef __cplusplus
3746 extern "C" {
3747 #if 0
3748 } /* c-mode */
3749 #endif
3750 #endif
3752 #if 0
3753 #define SWIGRUNTIME_DEBUG
3754 #endif
3757 SWIGRUNTIME void
3758 SWIG_InitializeModule(void *clientdata) {
3759 size_t i;
3760 swig_module_info *module_head, *iter;
3761 int found;
3763 clientdata = clientdata;
3765 /* check to see if the circular list has been setup, if not, set it up */
3766 if (swig_module.next==0) {
3767 /* Initialize the swig_module */
3768 swig_module.type_initial = swig_type_initial;
3769 swig_module.cast_initial = swig_cast_initial;
3770 swig_module.next = &swig_module;
3773 /* Try and load any already created modules */
3774 module_head = SWIG_GetModule(clientdata);
3775 if (!module_head) {
3776 /* This is the first module loaded for this interpreter */
3777 /* so set the swig module into the interpreter */
3778 SWIG_SetModule(clientdata, &swig_module);
3779 module_head = &swig_module;
3780 } else {
3781 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3782 found=0;
3783 iter=module_head;
3784 do {
3785 if (iter==&swig_module) {
3786 found=1;
3787 break;
3789 iter=iter->next;
3790 } while (iter!= module_head);
3792 /* if the is found in the list, then all is done and we may leave */
3793 if (found) return;
3794 /* otherwise we must add out module into the list */
3795 swig_module.next = module_head->next;
3796 module_head->next = &swig_module;
3799 /* Now work on filling in swig_module.types */
3800 #ifdef SWIGRUNTIME_DEBUG
3801 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
3802 #endif
3803 for (i = 0; i < swig_module.size; ++i) {
3804 swig_type_info *type = 0;
3805 swig_type_info *ret;
3806 swig_cast_info *cast;
3808 #ifdef SWIGRUNTIME_DEBUG
3809 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3810 #endif
3812 /* if there is another module already loaded */
3813 if (swig_module.next != &swig_module) {
3814 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3816 if (type) {
3817 /* Overwrite clientdata field */
3818 #ifdef SWIGRUNTIME_DEBUG
3819 printf("SWIG_InitializeModule: found type %s\n", type->name);
3820 #endif
3821 if (swig_module.type_initial[i]->clientdata) {
3822 type->clientdata = swig_module.type_initial[i]->clientdata;
3823 #ifdef SWIGRUNTIME_DEBUG
3824 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3825 #endif
3827 } else {
3828 type = swig_module.type_initial[i];
3831 /* Insert casting types */
3832 cast = swig_module.cast_initial[i];
3833 while (cast->type) {
3834 /* Don't need to add information already in the list */
3835 ret = 0;
3836 #ifdef SWIGRUNTIME_DEBUG
3837 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3838 #endif
3839 if (swig_module.next != &swig_module) {
3840 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3841 #ifdef SWIGRUNTIME_DEBUG
3842 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3843 #endif
3845 if (ret) {
3846 if (type == swig_module.type_initial[i]) {
3847 #ifdef SWIGRUNTIME_DEBUG
3848 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3849 #endif
3850 cast->type = ret;
3851 ret = 0;
3852 } else {
3853 /* Check for casting already in the list */
3854 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3855 #ifdef SWIGRUNTIME_DEBUG
3856 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3857 #endif
3858 if (!ocast) ret = 0;
3862 if (!ret) {
3863 #ifdef SWIGRUNTIME_DEBUG
3864 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3865 #endif
3866 if (type->cast) {
3867 type->cast->prev = cast;
3868 cast->next = type->cast;
3870 type->cast = cast;
3872 cast++;
3874 /* Set entry in modules->types array equal to the type */
3875 swig_module.types[i] = type;
3877 swig_module.types[i] = 0;
3879 #ifdef SWIGRUNTIME_DEBUG
3880 printf("**** SWIG_InitializeModule: Cast List ******\n");
3881 for (i = 0; i < swig_module.size; ++i) {
3882 int j = 0;
3883 swig_cast_info *cast = swig_module.cast_initial[i];
3884 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3885 while (cast->type) {
3886 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3887 cast++;
3888 ++j;
3890 printf("---- Total casts: %d\n",j);
3892 printf("**** SWIG_InitializeModule: Cast List ******\n");
3893 #endif
3896 /* This function will propagate the clientdata field of type to
3897 * any new swig_type_info structures that have been added into the list
3898 * of equivalent types. It is like calling
3899 * SWIG_TypeClientData(type, clientdata) a second time.
3901 SWIGRUNTIME void
3902 SWIG_PropagateClientData(void) {
3903 size_t i;
3904 swig_cast_info *equiv;
3905 static int init_run = 0;
3907 if (init_run) return;
3908 init_run = 1;
3910 for (i = 0; i < swig_module.size; i++) {
3911 if (swig_module.types[i]->clientdata) {
3912 equiv = swig_module.types[i]->cast;
3913 while (equiv) {
3914 if (!equiv->converter) {
3915 if (equiv->type && !equiv->type->clientdata)
3916 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3918 equiv = equiv->next;
3924 #ifdef __cplusplus
3925 #if 0
3927 /* c-mode */
3928 #endif
3930 #endif
3934 #ifdef __cplusplus
3935 extern "C" {
3936 #endif
3938 /* Python-specific SWIG API */
3939 #define SWIG_newvarlink() SWIG_Python_newvarlink()
3940 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
3941 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
3943 /* -----------------------------------------------------------------------------
3944 * global variable support code.
3945 * ----------------------------------------------------------------------------- */
3947 typedef struct swig_globalvar {
3948 char *name; /* Name of global variable */
3949 PyObject *(*get_attr)(void); /* Return the current value */
3950 int (*set_attr)(PyObject *); /* Set the value */
3951 struct swig_globalvar *next;
3952 } swig_globalvar;
3954 typedef struct swig_varlinkobject {
3955 PyObject_HEAD
3956 swig_globalvar *vars;
3957 } swig_varlinkobject;
3959 SWIGINTERN PyObject *
3960 swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
3961 return PyString_FromString("<Swig global variables>");
3964 SWIGINTERN PyObject *
3965 swig_varlink_str(swig_varlinkobject *v) {
3966 PyObject *str = PyString_FromString("(");
3967 swig_globalvar *var;
3968 for (var = v->vars; var; var=var->next) {
3969 PyString_ConcatAndDel(&str,PyString_FromString(var->name));
3970 if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
3972 PyString_ConcatAndDel(&str,PyString_FromString(")"));
3973 return str;
3976 SWIGINTERN int
3977 swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
3978 PyObject *str = swig_varlink_str(v);
3979 fprintf(fp,"Swig global variables ");
3980 fprintf(fp,"%s\n", PyString_AsString(str));
3981 Py_DECREF(str);
3982 return 0;
3985 SWIGINTERN void
3986 swig_varlink_dealloc(swig_varlinkobject *v) {
3987 swig_globalvar *var = v->vars;
3988 while (var) {
3989 swig_globalvar *n = var->next;
3990 free(var->name);
3991 free(var);
3992 var = n;
3996 SWIGINTERN PyObject *
3997 swig_varlink_getattr(swig_varlinkobject *v, char *n) {
3998 PyObject *res = NULL;
3999 swig_globalvar *var = v->vars;
4000 while (var) {
4001 if (strcmp(var->name,n) == 0) {
4002 res = (*var->get_attr)();
4003 break;
4005 var = var->next;
4007 if (res == NULL && !PyErr_Occurred()) {
4008 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
4010 return res;
4013 SWIGINTERN int
4014 swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
4015 int res = 1;
4016 swig_globalvar *var = v->vars;
4017 while (var) {
4018 if (strcmp(var->name,n) == 0) {
4019 res = (*var->set_attr)(p);
4020 break;
4022 var = var->next;
4024 if (res == 1 && !PyErr_Occurred()) {
4025 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
4027 return res;
4030 SWIGINTERN PyTypeObject*
4031 swig_varlink_type(void) {
4032 static char varlink__doc__[] = "Swig var link object";
4033 static PyTypeObject varlink_type;
4034 static int type_init = 0;
4035 if (!type_init) {
4036 const PyTypeObject tmp
4038 PyObject_HEAD_INIT(NULL)
4039 0, /* Number of items in variable part (ob_size) */
4040 (char *)"swigvarlink", /* Type name (tp_name) */
4041 sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
4042 0, /* Itemsize (tp_itemsize) */
4043 (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */
4044 (printfunc) swig_varlink_print, /* Print (tp_print) */
4045 (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
4046 (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
4047 0, /* tp_compare */
4048 (reprfunc) swig_varlink_repr, /* tp_repr */
4049 0, /* tp_as_number */
4050 0, /* tp_as_sequence */
4051 0, /* tp_as_mapping */
4052 0, /* tp_hash */
4053 0, /* tp_call */
4054 (reprfunc)swig_varlink_str, /* tp_str */
4055 0, /* tp_getattro */
4056 0, /* tp_setattro */
4057 0, /* tp_as_buffer */
4058 0, /* tp_flags */
4059 varlink__doc__, /* tp_doc */
4060 0, /* tp_traverse */
4061 0, /* tp_clear */
4062 0, /* tp_richcompare */
4063 0, /* tp_weaklistoffset */
4064 #if PY_VERSION_HEX >= 0x02020000
4065 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
4066 #endif
4067 #if PY_VERSION_HEX >= 0x02030000
4068 0, /* tp_del */
4069 #endif
4070 #ifdef COUNT_ALLOCS
4071 0,0,0,0 /* tp_alloc -> tp_next */
4072 #endif
4074 varlink_type = tmp;
4075 varlink_type.ob_type = &PyType_Type;
4076 type_init = 1;
4078 return &varlink_type;
4081 /* Create a variable linking object for use later */
4082 SWIGINTERN PyObject *
4083 SWIG_Python_newvarlink(void) {
4084 swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
4085 if (result) {
4086 result->vars = 0;
4088 return ((PyObject*) result);
4091 SWIGINTERN void
4092 SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
4093 swig_varlinkobject *v = (swig_varlinkobject *) p;
4094 swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
4095 if (gv) {
4096 size_t size = strlen(name)+1;
4097 gv->name = (char *)malloc(size);
4098 if (gv->name) {
4099 strncpy(gv->name,name,size);
4100 gv->get_attr = get_attr;
4101 gv->set_attr = set_attr;
4102 gv->next = v->vars;
4105 v->vars = gv;
4108 SWIGINTERN PyObject *
4109 SWIG_globals(void) {
4110 static PyObject *_SWIG_globals = 0;
4111 if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
4112 return _SWIG_globals;
4115 /* -----------------------------------------------------------------------------
4116 * constants/methods manipulation
4117 * ----------------------------------------------------------------------------- */
4119 /* Install Constants */
4120 SWIGINTERN void
4121 SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
4122 PyObject *obj = 0;
4123 size_t i;
4124 for (i = 0; constants[i].type; ++i) {
4125 switch(constants[i].type) {
4126 case SWIG_PY_POINTER:
4127 obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
4128 break;
4129 case SWIG_PY_BINARY:
4130 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
4131 break;
4132 default:
4133 obj = 0;
4134 break;
4136 if (obj) {
4137 PyDict_SetItemString(d, constants[i].name, obj);
4138 Py_DECREF(obj);
4143 /* -----------------------------------------------------------------------------*/
4144 /* Fix SwigMethods to carry the callback ptrs when needed */
4145 /* -----------------------------------------------------------------------------*/
4147 SWIGINTERN void
4148 SWIG_Python_FixMethods(PyMethodDef *methods,
4149 swig_const_info *const_table,
4150 swig_type_info **types,
4151 swig_type_info **types_initial) {
4152 size_t i;
4153 for (i = 0; methods[i].ml_name; ++i) {
4154 const char *c = methods[i].ml_doc;
4155 if (c && (c = strstr(c, "swig_ptr: "))) {
4156 int j;
4157 swig_const_info *ci = 0;
4158 const char *name = c + 10;
4159 for (j = 0; const_table[j].type; ++j) {
4160 if (strncmp(const_table[j].name, name,
4161 strlen(const_table[j].name)) == 0) {
4162 ci = &(const_table[j]);
4163 break;
4166 if (ci) {
4167 size_t shift = (ci->ptype) - types;
4168 swig_type_info *ty = types_initial[shift];
4169 size_t ldoc = (c - methods[i].ml_doc);
4170 size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
4171 char *ndoc = (char*)malloc(ldoc + lptr + 10);
4172 if (ndoc) {
4173 char *buff = ndoc;
4174 void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
4175 if (ptr) {
4176 strncpy(buff, methods[i].ml_doc, ldoc);
4177 buff += ldoc;
4178 strncpy(buff, "swig_ptr: ", 10);
4179 buff += 10;
4180 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
4181 methods[i].ml_doc = ndoc;
4189 #ifdef __cplusplus
4191 #endif
4193 /* -----------------------------------------------------------------------------*
4194 * Partial Init method
4195 * -----------------------------------------------------------------------------*/
4197 #ifdef __cplusplus
4198 extern "C"
4199 #endif
4200 SWIGEXPORT void SWIG_init(void) {
4201 PyObject *m, *d;
4203 /* Fix SwigMethods to carry the callback ptrs when needed */
4204 SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
4206 m = Py_InitModule((char *) SWIG_name, SwigMethods);
4207 d = PyModule_GetDict(m);
4209 SWIG_InitializeModule(0);
4210 SWIG_InstallConstants(d,swig_const_table);
4213 SWIG_Python_SetConstant(d, "REPLACE",SWIG_From_int((int)(TDB_REPLACE)));
4214 SWIG_Python_SetConstant(d, "INSERT",SWIG_From_int((int)(TDB_INSERT)));
4215 SWIG_Python_SetConstant(d, "MODIFY",SWIG_From_int((int)(TDB_MODIFY)));
4216 SWIG_Python_SetConstant(d, "DEFAULT",SWIG_From_int((int)(TDB_DEFAULT)));
4217 SWIG_Python_SetConstant(d, "CLEAR_IF_FIRST",SWIG_From_int((int)(TDB_CLEAR_IF_FIRST)));
4218 SWIG_Python_SetConstant(d, "INTERNAL",SWIG_From_int((int)(TDB_INTERNAL)));
4219 SWIG_Python_SetConstant(d, "NOLOCK",SWIG_From_int((int)(TDB_NOLOCK)));
4220 SWIG_Python_SetConstant(d, "NOMMAP",SWIG_From_int((int)(TDB_NOMMAP)));
4221 SWIG_Python_SetConstant(d, "CONVERT",SWIG_From_int((int)(TDB_CONVERT)));
4222 SWIG_Python_SetConstant(d, "BIGENDIAN",SWIG_From_int((int)(TDB_BIGENDIAN)));
4223 SWIG_Python_SetConstant(d, "TDB_SUCCESS",SWIG_From_int((int)(TDB_SUCCESS)));
4224 SWIG_Python_SetConstant(d, "TDB_ERR_CORRUPT",SWIG_From_int((int)(TDB_ERR_CORRUPT)));
4225 SWIG_Python_SetConstant(d, "TDB_ERR_IO",SWIG_From_int((int)(TDB_ERR_IO)));
4226 SWIG_Python_SetConstant(d, "TDB_ERR_LOCK",SWIG_From_int((int)(TDB_ERR_LOCK)));
4227 SWIG_Python_SetConstant(d, "TDB_ERR_OOM",SWIG_From_int((int)(TDB_ERR_OOM)));
4228 SWIG_Python_SetConstant(d, "TDB_ERR_EXISTS",SWIG_From_int((int)(TDB_ERR_EXISTS)));
4229 SWIG_Python_SetConstant(d, "TDB_ERR_NOLOCK",SWIG_From_int((int)(TDB_ERR_NOLOCK)));
4230 SWIG_Python_SetConstant(d, "TDB_ERR_LOCK_TIMEOUT",SWIG_From_int((int)(TDB_ERR_LOCK_TIMEOUT)));
4231 SWIG_Python_SetConstant(d, "TDB_ERR_NOEXIST",SWIG_From_int((int)(TDB_ERR_NOEXIST)));
4232 SWIG_Python_SetConstant(d, "TDB_ERR_EINVAL",SWIG_From_int((int)(TDB_ERR_EINVAL)));
4233 SWIG_Python_SetConstant(d, "TDB_ERR_RDONLY",SWIG_From_int((int)(TDB_ERR_RDONLY)));