vipulraheja

defected ossimInit_wrap.cxx

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