Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2506 lines
71 KiB

  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 1.3.34
  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. * This section contains generic SWIG labels for method/variable
  12. * declarations/attributes, and other compiler dependent labels.
  13. * ----------------------------------------------------------------------------- */
  14. /* template workaround for compilers that cannot correctly implement the C++ standard */
  15. #ifndef SWIGTEMPLATEDISAMBIGUATOR
  16. # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
  17. # define SWIGTEMPLATEDISAMBIGUATOR template
  18. # elif defined(__HP_aCC)
  19. /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
  20. /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
  21. # define SWIGTEMPLATEDISAMBIGUATOR template
  22. # else
  23. # define SWIGTEMPLATEDISAMBIGUATOR
  24. # endif
  25. #endif
  26. /* inline attribute */
  27. #ifndef SWIGINLINE
  28. # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
  29. # define SWIGINLINE inline
  30. # else
  31. # define SWIGINLINE
  32. # endif
  33. #endif
  34. /* attribute recognised by some compilers to avoid 'unused' warnings */
  35. #ifndef SWIGUNUSED
  36. # if defined(__GNUC__)
  37. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  38. # define SWIGUNUSED __attribute__ ((__unused__))
  39. # else
  40. # define SWIGUNUSED
  41. # endif
  42. # elif defined(__ICC)
  43. # define SWIGUNUSED __attribute__ ((__unused__))
  44. # else
  45. # define SWIGUNUSED
  46. # endif
  47. #endif
  48. #ifndef SWIGUNUSEDPARM
  49. # ifdef __cplusplus
  50. # define SWIGUNUSEDPARM(p)
  51. # else
  52. # define SWIGUNUSEDPARM(p) p SWIGUNUSED
  53. # endif
  54. #endif
  55. /* internal SWIG method */
  56. #ifndef SWIGINTERN
  57. # define SWIGINTERN static SWIGUNUSED
  58. #endif
  59. /* internal inline SWIG method */
  60. #ifndef SWIGINTERNINLINE
  61. # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
  62. #endif
  63. /* exporting methods */
  64. #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
  65. # ifndef GCC_HASCLASSVISIBILITY
  66. # define GCC_HASCLASSVISIBILITY
  67. # endif
  68. #endif
  69. #ifndef SWIGEXPORT
  70. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  71. # if defined(STATIC_LINKED)
  72. # define SWIGEXPORT
  73. # else
  74. # define SWIGEXPORT __declspec(dllexport)
  75. # endif
  76. # else
  77. # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
  78. # define SWIGEXPORT __attribute__ ((visibility("default")))
  79. # else
  80. # define SWIGEXPORT
  81. # endif
  82. # endif
  83. #endif
  84. /* calling conventions for Windows */
  85. #ifndef SWIGSTDCALL
  86. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  87. # define SWIGSTDCALL __stdcall
  88. # else
  89. # define SWIGSTDCALL
  90. # endif
  91. #endif
  92. /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
  93. #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
  94. # define _CRT_SECURE_NO_DEPRECATE
  95. #endif
  96. /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
  97. #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
  98. # define _SCL_SECURE_NO_DEPRECATE
  99. #endif
  100. /* Errors in SWIG */
  101. #define SWIG_UnknownError -1
  102. #define SWIG_IOError -2
  103. #define SWIG_RuntimeError -3
  104. #define SWIG_IndexError -4
  105. #define SWIG_TypeError -5
  106. #define SWIG_DivisionByZero -6
  107. #define SWIG_OverflowError -7
  108. #define SWIG_SyntaxError -8
  109. #define SWIG_ValueError -9
  110. #define SWIG_SystemError -10
  111. #define SWIG_AttributeError -11
  112. #define SWIG_MemoryError -12
  113. #define SWIG_NullReferenceError -13
  114. /* Errors in SWIG */
  115. #define SWIG_UnknownError -1
  116. #define SWIG_IOError -2
  117. #define SWIG_RuntimeError -3
  118. #define SWIG_IndexError -4
  119. #define SWIG_TypeError -5
  120. #define SWIG_DivisionByZero -6
  121. #define SWIG_OverflowError -7
  122. #define SWIG_SyntaxError -8
  123. #define SWIG_ValueError -9
  124. #define SWIG_SystemError -10
  125. #define SWIG_AttributeError -11
  126. #define SWIG_MemoryError -12
  127. #define SWIG_NullReferenceError -13
  128. /* -----------------------------------------------------------------------------
  129. * swigrun.swg
  130. *
  131. * This file contains generic CAPI SWIG runtime support for pointer
  132. * type checking.
  133. * ----------------------------------------------------------------------------- */
  134. /* This should only be incremented when either the layout of swig_type_info changes,
  135. or for whatever reason, the runtime changes incompatibly */
  136. #define SWIG_RUNTIME_VERSION "4"
  137. /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
  138. #ifdef SWIG_TYPE_TABLE
  139. # define SWIG_QUOTE_STRING(x) #x
  140. # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
  141. # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
  142. #else
  143. # define SWIG_TYPE_TABLE_NAME
  144. #endif
  145. /*
  146. You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  147. creating a static or dynamic library from the swig runtime code.
  148. In 99.9% of the cases, swig just needs to declare them as 'static'.
  149. But only do this if is strictly necessary, ie, if you have problems
  150. with your compiler or so.
  151. */
  152. #ifndef SWIGRUNTIME
  153. # define SWIGRUNTIME SWIGINTERN
  154. #endif
  155. #ifndef SWIGRUNTIMEINLINE
  156. # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
  157. #endif
  158. /* Generic buffer size */
  159. #ifndef SWIG_BUFFER_SIZE
  160. # define SWIG_BUFFER_SIZE 1024
  161. #endif
  162. /* Flags for pointer conversions */
  163. #define SWIG_POINTER_DISOWN 0x1
  164. #define SWIG_CAST_NEW_MEMORY 0x2
  165. /* Flags for new pointer objects */
  166. #define SWIG_POINTER_OWN 0x1
  167. /*
  168. Flags/methods for returning states.
  169. The swig conversion methods, as ConvertPtr, return and integer
  170. that tells if the conversion was successful or not. And if not,
  171. an error code can be returned (see swigerrors.swg for the codes).
  172. Use the following macros/flags to set or process the returning
  173. states.
  174. In old swig versions, you usually write code as:
  175. if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
  176. // success code
  177. } else {
  178. //fail code
  179. }
  180. Now you can be more explicit as:
  181. int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
  182. if (SWIG_IsOK(res)) {
  183. // success code
  184. } else {
  185. // fail code
  186. }
  187. that seems to be the same, but now you can also do
  188. Type *ptr;
  189. int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
  190. if (SWIG_IsOK(res)) {
  191. // success code
  192. if (SWIG_IsNewObj(res) {
  193. ...
  194. delete *ptr;
  195. } else {
  196. ...
  197. }
  198. } else {
  199. // fail code
  200. }
  201. I.e., now SWIG_ConvertPtr can return new objects and you can
  202. identify the case and take care of the deallocation. Of course that
  203. requires also to SWIG_ConvertPtr to return new result values, as
  204. int SWIG_ConvertPtr(obj, ptr,...) {
  205. if (<obj is ok>) {
  206. if (<need new object>) {
  207. *ptr = <ptr to new allocated object>;
  208. return SWIG_NEWOBJ;
  209. } else {
  210. *ptr = <ptr to old object>;
  211. return SWIG_OLDOBJ;
  212. }
  213. } else {
  214. return SWIG_BADOBJ;
  215. }
  216. }
  217. Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
  218. more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
  219. swig errors code.
  220. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
  221. allows to return the 'cast rank', for example, if you have this
  222. int food(double)
  223. int fooi(int);
  224. and you call
  225. food(1) // cast rank '1' (1 -> 1.0)
  226. fooi(1) // cast rank '0'
  227. just use the SWIG_AddCast()/SWIG_CheckState()
  228. */
  229. #define SWIG_OK (0)
  230. #define SWIG_ERROR (-1)
  231. #define SWIG_IsOK(r) (r >= 0)
  232. #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
  233. /* The CastRankLimit says how many bits are used for the cast rank */
  234. #define SWIG_CASTRANKLIMIT (1 << 8)
  235. /* The NewMask denotes the object was created (using new/malloc) */
  236. #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
  237. /* The TmpMask is for in/out typemaps that use temporal objects */
  238. #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
  239. /* Simple returning values */
  240. #define SWIG_BADOBJ (SWIG_ERROR)
  241. #define SWIG_OLDOBJ (SWIG_OK)
  242. #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
  243. #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
  244. /* Check, add and del mask methods */
  245. #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
  246. #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
  247. #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
  248. #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
  249. #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
  250. #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
  251. /* Cast-Rank Mode */
  252. #if defined(SWIG_CASTRANK_MODE)
  253. # ifndef SWIG_TypeRank
  254. # define SWIG_TypeRank unsigned long
  255. # endif
  256. # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
  257. # define SWIG_MAXCASTRANK (2)
  258. # endif
  259. # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
  260. # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
  261. SWIGINTERNINLINE int SWIG_AddCast(int r) {
  262. return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
  263. }
  264. SWIGINTERNINLINE int SWIG_CheckState(int r) {
  265. return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
  266. }
  267. #else /* no cast-rank mode */
  268. # define SWIG_AddCast
  269. # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
  270. #endif
  271. #include <string.h>
  272. #ifdef __cplusplus
  273. extern "C" {
  274. #endif
  275. typedef void *(*swig_converter_func)(void *, int *);
  276. typedef struct swig_type_info *(*swig_dycast_func)(void **);
  277. /* Structure to store information on one type */
  278. typedef struct swig_type_info {
  279. const char *name; /* mangled name of this type */
  280. const char *str; /* human readable name of this type */
  281. swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
  282. struct swig_cast_info *cast; /* linked list of types that can cast into this type */
  283. void *clientdata; /* language specific type data */
  284. int owndata; /* flag if the structure owns the clientdata */
  285. } swig_type_info;
  286. /* Structure to store a type and conversion function used for casting */
  287. typedef struct swig_cast_info {
  288. swig_type_info *type; /* pointer to type that is equivalent to this type */
  289. swig_converter_func converter; /* function to cast the void pointers */
  290. struct swig_cast_info *next; /* pointer to next cast in linked list */
  291. struct swig_cast_info *prev; /* pointer to the previous cast */
  292. } swig_cast_info;
  293. /* Structure used to store module information
  294. * Each module generates one structure like this, and the runtime collects
  295. * all of these structures and stores them in a circularly linked list.*/
  296. typedef struct swig_module_info {
  297. swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
  298. size_t size; /* Number of types in this module */
  299. struct swig_module_info *next; /* Pointer to next element in circularly linked list */
  300. swig_type_info **type_initial; /* Array of initially generated type structures */
  301. swig_cast_info **cast_initial; /* Array of initially generated casting structures */
  302. void *clientdata; /* Language specific module data */
  303. } swig_module_info;
  304. /*
  305. Compare two type names skipping the space characters, therefore
  306. "char*" == "char *" and "Class<int>" == "Class<int >", etc.
  307. Return 0 when the two name types are equivalent, as in
  308. strncmp, but skipping ' '.
  309. */
  310. SWIGRUNTIME int
  311. SWIG_TypeNameComp(const char *f1, const char *l1,
  312. const char *f2, const char *l2) {
  313. for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
  314. while ((*f1 == ' ') && (f1 != l1)) ++f1;
  315. while ((*f2 == ' ') && (f2 != l2)) ++f2;
  316. if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  317. }
  318. return (int)((l1 - f1) - (l2 - f2));
  319. }
  320. /*
  321. Check type equivalence in a name list like <name1>|<name2>|...
  322. Return 0 if not equal, 1 if equal
  323. */
  324. SWIGRUNTIME int
  325. SWIG_TypeEquiv(const char *nb, const char *tb) {
  326. int equiv = 0;
  327. const char* te = tb + strlen(tb);
  328. const char* ne = nb;
  329. while (!equiv && *ne) {
  330. for (nb = ne; *ne; ++ne) {
  331. if (*ne == '|') break;
  332. }
  333. equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
  334. if (*ne) ++ne;
  335. }
  336. return equiv;
  337. }
  338. /*
  339. Check type equivalence in a name list like <name1>|<name2>|...
  340. Return 0 if equal, -1 if nb < tb, 1 if nb > tb
  341. */
  342. SWIGRUNTIME int
  343. SWIG_TypeCompare(const char *nb, const char *tb) {
  344. int equiv = 0;
  345. const char* te = tb + strlen(tb);
  346. const char* ne = nb;
  347. while (!equiv && *ne) {
  348. for (nb = ne; *ne; ++ne) {
  349. if (*ne == '|') break;
  350. }
  351. equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
  352. if (*ne) ++ne;
  353. }
  354. return equiv;
  355. }
  356. /* think of this as a c++ template<> or a scheme macro */
  357. #define SWIG_TypeCheck_Template(comparison, ty) \
  358. if (ty) { \
  359. swig_cast_info *iter = ty->cast; \
  360. while (iter) { \
  361. if (comparison) { \
  362. if (iter == ty->cast) return iter; \
  363. /* Move iter to the top of the linked list */ \
  364. iter->prev->next = iter->next; \
  365. if (iter->next) \
  366. iter->next->prev = iter->prev; \
  367. iter->next = ty->cast; \
  368. iter->prev = 0; \
  369. if (ty->cast) ty->cast->prev = iter; \
  370. ty->cast = iter; \
  371. return iter; \
  372. } \
  373. iter = iter->next; \
  374. } \
  375. } \
  376. return 0
  377. /*
  378. Check the typename
  379. */
  380. SWIGRUNTIME swig_cast_info *
  381. SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  382. SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
  383. }
  384. /* Same as previous function, except strcmp is replaced with a pointer comparison */
  385. SWIGRUNTIME swig_cast_info *
  386. SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
  387. SWIG_TypeCheck_Template(iter->type == from, into);
  388. }
  389. /*
  390. Cast a pointer up an inheritance hierarchy
  391. */
  392. SWIGRUNTIMEINLINE void *
  393. SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  394. return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
  395. }
  396. /*
  397. Dynamic pointer casting. Down an inheritance hierarchy
  398. */
  399. SWIGRUNTIME swig_type_info *
  400. SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  401. swig_type_info *lastty = ty;
  402. if (!ty || !ty->dcast) return ty;
  403. while (ty && (ty->dcast)) {
  404. ty = (*ty->dcast)(ptr);
  405. if (ty) lastty = ty;
  406. }
  407. return lastty;
  408. }
  409. /*
  410. Return the name associated with this type
  411. */
  412. SWIGRUNTIMEINLINE const char *
  413. SWIG_TypeName(const swig_type_info *ty) {
  414. return ty->name;
  415. }
  416. /*
  417. Return the pretty name associated with this type,
  418. that is an unmangled type name in a form presentable to the user.
  419. */
  420. SWIGRUNTIME const char *
  421. SWIG_TypePrettyName(const swig_type_info *type) {
  422. /* The "str" field contains the equivalent pretty names of the
  423. type, separated by vertical-bar characters. We choose
  424. to print the last name, as it is often (?) the most
  425. specific. */
  426. if (!type) return NULL;
  427. if (type->str != NULL) {
  428. const char *last_name = type->str;
  429. const char *s;
  430. for (s = type->str; *s; s++)
  431. if (*s == '|') last_name = s+1;
  432. return last_name;
  433. }
  434. else
  435. return type->name;
  436. }
  437. /*
  438. Set the clientdata field for a type
  439. */
  440. SWIGRUNTIME void
  441. SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  442. swig_cast_info *cast = ti->cast;
  443. /* if (ti->clientdata == clientdata) return; */
  444. ti->clientdata = clientdata;
  445. while (cast) {
  446. if (!cast->converter) {
  447. swig_type_info *tc = cast->type;
  448. if (!tc->clientdata) {
  449. SWIG_TypeClientData(tc, clientdata);
  450. }
  451. }
  452. cast = cast->next;
  453. }
  454. }
  455. SWIGRUNTIME void
  456. SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  457. SWIG_TypeClientData(ti, clientdata);
  458. ti->owndata = 1;
  459. }
  460. /*
  461. Search for a swig_type_info structure only by mangled name
  462. Search is a O(log #types)
  463. We start searching at module start, and finish searching when start == end.
  464. Note: if start == end at the beginning of the function, we go all the way around
  465. the circular list.
  466. */
  467. SWIGRUNTIME swig_type_info *
  468. SWIG_MangledTypeQueryModule(swig_module_info *start,
  469. swig_module_info *end,
  470. const char *name) {
  471. swig_module_info *iter = start;
  472. do {
  473. if (iter->size) {
  474. register size_t l = 0;
  475. register size_t r = iter->size - 1;
  476. do {
  477. /* since l+r >= 0, we can (>> 1) instead (/ 2) */
  478. register size_t i = (l + r) >> 1;
  479. const char *iname = iter->types[i]->name;
  480. if (iname) {
  481. register int compare = strcmp(name, iname);
  482. if (compare == 0) {
  483. return iter->types[i];
  484. } else if (compare < 0) {
  485. if (i) {
  486. r = i - 1;
  487. } else {
  488. break;
  489. }
  490. } else if (compare > 0) {
  491. l = i + 1;
  492. }
  493. } else {
  494. break; /* should never happen */
  495. }
  496. } while (l <= r);
  497. }
  498. iter = iter->next;
  499. } while (iter != end);
  500. return 0;
  501. }
  502. /*
  503. Search for a swig_type_info structure for either a mangled name or a human readable name.
  504. It first searches the mangled names of the types, which is a O(log #types)
  505. If a type is not found it then searches the human readable names, which is O(#types).
  506. We start searching at module start, and finish searching when start == end.
  507. Note: if start == end at the beginning of the function, we go all the way around
  508. the circular list.
  509. */
  510. SWIGRUNTIME swig_type_info *
  511. SWIG_TypeQueryModule(swig_module_info *start,
  512. swig_module_info *end,
  513. const char *name) {
  514. /* STEP 1: Search the name field using binary search */
  515. swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  516. if (ret) {
  517. return ret;
  518. } else {
  519. /* STEP 2: If the type hasn't been found, do a complete search
  520. of the str field (the human readable name) */
  521. swig_module_info *iter = start;
  522. do {
  523. register size_t i = 0;
  524. for (; i < iter->size; ++i) {
  525. if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
  526. return iter->types[i];
  527. }
  528. iter = iter->next;
  529. } while (iter != end);
  530. }
  531. /* neither found a match */
  532. return 0;
  533. }
  534. /*
  535. Pack binary data into a string
  536. */
  537. SWIGRUNTIME char *
  538. SWIG_PackData(char *c, void *ptr, size_t sz) {
  539. static const char hex[17] = "0123456789abcdef";
  540. register const unsigned char *u = (unsigned char *) ptr;
  541. register const unsigned char *eu = u + sz;
  542. for (; u != eu; ++u) {
  543. register unsigned char uu = *u;
  544. *(c++) = hex[(uu & 0xf0) >> 4];
  545. *(c++) = hex[uu & 0xf];
  546. }
  547. return c;
  548. }
  549. /*
  550. Unpack binary data from a string
  551. */
  552. SWIGRUNTIME const char *
  553. SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  554. register unsigned char *u = (unsigned char *) ptr;
  555. register const unsigned char *eu = u + sz;
  556. for (; u != eu; ++u) {
  557. register char d = *(c++);
  558. register unsigned char uu;
  559. if ((d >= '0') && (d <= '9'))
  560. uu = ((d - '0') << 4);
  561. else if ((d >= 'a') && (d <= 'f'))
  562. uu = ((d - ('a'-10)) << 4);
  563. else
  564. return (char *) 0;
  565. d = *(c++);
  566. if ((d >= '0') && (d <= '9'))
  567. uu |= (d - '0');
  568. else if ((d >= 'a') && (d <= 'f'))
  569. uu |= (d - ('a'-10));
  570. else
  571. return (char *) 0;
  572. *u = uu;
  573. }
  574. return c;
  575. }
  576. /*
  577. Pack 'void *' into a string buffer.
  578. */
  579. SWIGRUNTIME char *
  580. SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  581. char *r = buff;
  582. if ((2*sizeof(void *) + 2) > bsz) return 0;
  583. *(r++) = '_';
  584. r = SWIG_PackData(r,&ptr,sizeof(void *));
  585. if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  586. strcpy(r,name);
  587. return buff;
  588. }
  589. SWIGRUNTIME const char *
  590. SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  591. if (*c != '_') {
  592. if (strcmp(c,"NULL") == 0) {
  593. *ptr = (void *) 0;
  594. return name;
  595. } else {
  596. return 0;
  597. }
  598. }
  599. return SWIG_UnpackData(++c,ptr,sizeof(void *));
  600. }
  601. SWIGRUNTIME char *
  602. SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  603. char *r = buff;
  604. size_t lname = (name ? strlen(name) : 0);
  605. if ((2*sz + 2 + lname) > bsz) return 0;
  606. *(r++) = '_';
  607. r = SWIG_PackData(r,ptr,sz);
  608. if (lname) {
  609. strncpy(r,name,lname+1);
  610. } else {
  611. *r = 0;
  612. }
  613. return buff;
  614. }
  615. SWIGRUNTIME const char *
  616. SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  617. if (*c != '_') {
  618. if (strcmp(c,"NULL") == 0) {
  619. memset(ptr,0,sz);
  620. return name;
  621. } else {
  622. return 0;
  623. }
  624. }
  625. return SWIG_UnpackData(++c,ptr,sz);
  626. }
  627. #ifdef __cplusplus
  628. }
  629. #endif
  630. /* Add PyOS_snprintf for old Pythons */
  631. #if PY_VERSION_HEX < 0x02020000
  632. # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
  633. # define PyOS_snprintf _snprintf
  634. # else
  635. # define PyOS_snprintf snprintf
  636. # endif
  637. #endif
  638. /* A crude PyString_FromFormat implementation for old Pythons */
  639. #if PY_VERSION_HEX < 0x02020000
  640. #ifndef SWIG_PYBUFFER_SIZE
  641. # define SWIG_PYBUFFER_SIZE 1024
  642. #endif
  643. static PyObject *
  644. PyString_FromFormat(const char *fmt, ...) {
  645. va_list ap;
  646. char buf[SWIG_PYBUFFER_SIZE * 2];
  647. int res;
  648. va_start(ap, fmt);
  649. res = vsnprintf(buf, sizeof(buf), fmt, ap);
  650. va_end(ap);
  651. return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
  652. }
  653. #endif
  654. /* Add PyObject_Del for old Pythons */
  655. #if PY_VERSION_HEX < 0x01060000
  656. # define PyObject_Del(op) PyMem_DEL((op))
  657. #endif
  658. #ifndef PyObject_DEL
  659. # define PyObject_DEL PyObject_Del
  660. #endif
  661. /* A crude PyExc_StopIteration exception for old Pythons */
  662. #if PY_VERSION_HEX < 0x02020000
  663. # ifndef PyExc_StopIteration
  664. # define PyExc_StopIteration PyExc_RuntimeError
  665. # endif
  666. # ifndef PyObject_GenericGetAttr
  667. # define PyObject_GenericGetAttr 0
  668. # endif
  669. #endif
  670. /* Py_NotImplemented is defined in 2.1 and up. */
  671. #if PY_VERSION_HEX < 0x02010000
  672. # ifndef Py_NotImplemented
  673. # define Py_NotImplemented PyExc_RuntimeError
  674. # endif
  675. #endif
  676. /* A crude PyString_AsStringAndSize implementation for old Pythons */
  677. #if PY_VERSION_HEX < 0x02010000
  678. # ifndef PyString_AsStringAndSize
  679. # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
  680. # endif
  681. #endif
  682. /* PySequence_Size for old Pythons */
  683. #if PY_VERSION_HEX < 0x02000000
  684. # ifndef PySequence_Size
  685. # define PySequence_Size PySequence_Length
  686. # endif
  687. #endif
  688. /* PyBool_FromLong for old Pythons */
  689. #if PY_VERSION_HEX < 0x02030000
  690. static
  691. PyObject *PyBool_FromLong(long ok)
  692. {
  693. PyObject *result = ok ? Py_True : Py_False;
  694. Py_INCREF(result);
  695. return result;
  696. }
  697. #endif
  698. /* Py_ssize_t for old Pythons */
  699. /* This code is as recommended by: */
  700. /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
  701. #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
  702. typedef int Py_ssize_t;
  703. # define PY_SSIZE_T_MAX INT_MAX
  704. # define PY_SSIZE_T_MIN INT_MIN
  705. #endif
  706. /* -----------------------------------------------------------------------------
  707. * error manipulation
  708. * ----------------------------------------------------------------------------- */
  709. SWIGRUNTIME PyObject*
  710. SWIG_Python_ErrorType(int code) {
  711. PyObject* type = 0;
  712. switch(code) {
  713. case SWIG_MemoryError:
  714. type = PyExc_MemoryError;
  715. break;
  716. case SWIG_IOError:
  717. type = PyExc_IOError;
  718. break;
  719. case SWIG_RuntimeError:
  720. type = PyExc_RuntimeError;
  721. break;
  722. case SWIG_IndexError:
  723. type = PyExc_IndexError;
  724. break;
  725. case SWIG_TypeError:
  726. type = PyExc_TypeError;
  727. break;
  728. case SWIG_DivisionByZero:
  729. type = PyExc_ZeroDivisionError;
  730. break;
  731. case SWIG_OverflowError:
  732. type = PyExc_OverflowError;
  733. break;
  734. case SWIG_SyntaxError:
  735. type = PyExc_SyntaxError;
  736. break;
  737. case SWIG_ValueError:
  738. type = PyExc_ValueError;
  739. break;
  740. case SWIG_SystemError:
  741. type = PyExc_SystemError;
  742. break;
  743. case SWIG_AttributeError:
  744. type = PyExc_AttributeError;
  745. break;
  746. default:
  747. type = PyExc_RuntimeError;
  748. }
  749. return type;
  750. }
  751. SWIGRUNTIME void
  752. SWIG_Python_AddErrorMsg(const char* mesg)
  753. {
  754. PyObject *type = 0;
  755. PyObject *value = 0;
  756. PyObject *traceback = 0;
  757. if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
  758. if (value) {
  759. PyObject *old_str = PyObject_Str(value);
  760. PyErr_Clear();
  761. Py_XINCREF(type);
  762. PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
  763. Py_DECREF(old_str);
  764. Py_DECREF(value);
  765. } else {
  766. PyErr_SetString(PyExc_RuntimeError, mesg);
  767. }
  768. }
  769. #if defined(SWIG_PYTHON_NO_THREADS)
  770. # if defined(SWIG_PYTHON_THREADS)
  771. # undef SWIG_PYTHON_THREADS
  772. # endif
  773. #endif
  774. #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
  775. # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
  776. # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
  777. # define SWIG_PYTHON_USE_GIL
  778. # endif
  779. # endif
  780. # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
  781. # ifndef SWIG_PYTHON_INITIALIZE_THREADS
  782. # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
  783. # endif
  784. # ifdef __cplusplus /* C++ code */
  785. class SWIG_Python_Thread_Block {
  786. bool status;
  787. PyGILState_STATE state;
  788. public:
  789. void end() { if (status) { PyGILState_Release(state); status = false;} }
  790. SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
  791. ~SWIG_Python_Thread_Block() { end(); }
  792. };
  793. class SWIG_Python_Thread_Allow {
  794. bool status;
  795. PyThreadState *save;
  796. public:
  797. void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
  798. SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
  799. ~SWIG_Python_Thread_Allow() { end(); }
  800. };
  801. # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
  802. # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
  803. # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
  804. # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
  805. # else /* C code */
  806. # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
  807. # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
  808. # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
  809. # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
  810. # endif
  811. # else /* Old thread way, not implemented, user must provide it */
  812. # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
  813. # define SWIG_PYTHON_INITIALIZE_THREADS
  814. # endif
  815. # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
  816. # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
  817. # endif
  818. # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
  819. # define SWIG_PYTHON_THREAD_END_BLOCK
  820. # endif
  821. # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
  822. # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
  823. # endif
  824. # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
  825. # define SWIG_PYTHON_THREAD_END_ALLOW
  826. # endif
  827. # endif
  828. #else /* No thread support */
  829. # define SWIG_PYTHON_INITIALIZE_THREADS
  830. # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
  831. # define SWIG_PYTHON_THREAD_END_BLOCK
  832. # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
  833. # define SWIG_PYTHON_THREAD_END_ALLOW
  834. #endif
  835. /* -----------------------------------------------------------------------------
  836. * Python API portion that goes into the runtime
  837. * ----------------------------------------------------------------------------- */
  838. #ifdef __cplusplus
  839. extern "C" {
  840. #if 0
  841. } /* cc-mode */
  842. #endif
  843. #endif
  844. /* -----------------------------------------------------------------------------
  845. * Constant declarations
  846. * ----------------------------------------------------------------------------- */
  847. /* Constant Types */
  848. #define SWIG_PY_POINTER 4
  849. #define SWIG_PY_BINARY 5
  850. /* Constant information structure */
  851. typedef struct swig_const_info {
  852. int type;
  853. char *name;
  854. long lvalue;
  855. double dvalue;
  856. void *pvalue;
  857. swig_type_info **ptype;
  858. } swig_const_info;
  859. #ifdef __cplusplus
  860. #if 0
  861. { /* cc-mode */
  862. #endif
  863. }
  864. #endif
  865. /* -----------------------------------------------------------------------------
  866. * See the LICENSE file for information on copyright, usage and redistribution
  867. * of SWIG, and the README file for authors - http://www.swig.org/release.html.
  868. *
  869. * pyrun.swg
  870. *
  871. * This file contains the runtime support for Python modules
  872. * and includes code for managing global variables and pointer
  873. * type checking.
  874. *
  875. * ----------------------------------------------------------------------------- */
  876. /* Common SWIG API */
  877. /* for raw pointers */
  878. #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
  879. #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
  880. #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
  881. #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
  882. #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
  883. #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
  884. #define swig_owntype int
  885. /* for raw packed data */
  886. #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
  887. #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
  888. /* for class or struct pointers */
  889. #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
  890. #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
  891. /* for C or C++ function pointers */
  892. #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
  893. #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0)
  894. /* for C++ member pointers, ie, member methods */
  895. #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
  896. #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
  897. /* Runtime API */
  898. #define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
  899. #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
  900. #define SWIG_NewClientData(obj) PySwigClientData_New(obj)
  901. #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
  902. #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
  903. #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
  904. #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
  905. #define SWIG_fail goto fail
  906. /* Runtime API implementation */
  907. /* Error manipulation */
  908. SWIGINTERN void
  909. SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
  910. SWIG_PYTHON_THREAD_BEGIN_BLOCK;
  911. PyErr_SetObject(errtype, obj);
  912. Py_DECREF(obj);
  913. SWIG_PYTHON_THREAD_END_BLOCK;
  914. }
  915. SWIGINTERN void
  916. SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
  917. SWIG_PYTHON_THREAD_BEGIN_BLOCK;
  918. PyErr_SetString(errtype, (char *) msg);
  919. SWIG_PYTHON_THREAD_END_BLOCK;
  920. }
  921. #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
  922. /* Set a constant value */
  923. SWIGINTERN void
  924. SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
  925. PyDict_SetItemString(d, (char*) name, obj);
  926. Py_DECREF(obj);
  927. }
  928. /* Append a value to the result obj */
  929. SWIGINTERN PyObject*
  930. SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
  931. #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
  932. if (!result) {
  933. result = obj;
  934. } else if (result == Py_None) {
  935. Py_DECREF(result);
  936. result = obj;
  937. } else {
  938. if (!PyList_Check(result)) {
  939. PyObject *o2 = result;
  940. result = PyList_New(1);
  941. PyList_SetItem(result, 0, o2);
  942. }
  943. PyList_Append(result,obj);
  944. Py_DECREF(obj);
  945. }
  946. return result;
  947. #else
  948. PyObject* o2;
  949. PyObject* o3;
  950. if (!result) {
  951. result = obj;
  952. } else if (result == Py_None) {
  953. Py_DECREF(result);
  954. result = obj;
  955. } else {
  956. if (!PyTuple_Check(result)) {
  957. o2 = result;
  958. result = PyTuple_New(1);
  959. PyTuple_SET_ITEM(result, 0, o2);
  960. }
  961. o3 = PyTuple_New(1);
  962. PyTuple_SET_ITEM(o3, 0, obj);
  963. o2 = result;
  964. result = PySequence_Concat(o2, o3);
  965. Py_DECREF(o2);
  966. Py_DECREF(o3);
  967. }
  968. return result;
  969. #endif
  970. }
  971. /* Unpack the argument tuple */
  972. SWIGINTERN int
  973. SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
  974. {
  975. if (!args) {
  976. if (!min && !max) {
  977. return 1;
  978. } else {
  979. PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
  980. name, (min == max ? "" : "at least "), (int)min);
  981. return 0;
  982. }
  983. }
  984. if (!PyTuple_Check(args)) {
  985. PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
  986. return 0;
  987. } else {
  988. register Py_ssize_t l = PyTuple_GET_SIZE(args);
  989. if (l < min) {
  990. PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
  991. name, (min == max ? "" : "at least "), (int)min, (int)l);
  992. return 0;
  993. } else if (l > max) {
  994. PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
  995. name, (min == max ? "" : "at most "), (int)max, (int)l);
  996. return 0;
  997. } else {
  998. register int i;
  999. for (i = 0; i < l; ++i) {
  1000. objs[i] = PyTuple_GET_ITEM(args, i);
  1001. }
  1002. for (; l < max; ++l) {
  1003. objs[l] = 0;
  1004. }
  1005. return i + 1;
  1006. }
  1007. }
  1008. }
  1009. /* A functor is a function object with one single object argument */
  1010. #if PY_VERSION_HEX >= 0x02020000
  1011. #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
  1012. #else
  1013. #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
  1014. #endif
  1015. /*
  1016. Helper for static pointer initialization for both C and C++ code, for example
  1017. static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
  1018. */
  1019. #ifdef __cplusplus
  1020. #define SWIG_STATIC_POINTER(var) var
  1021. #else
  1022. #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
  1023. #endif
  1024. /* -----------------------------------------------------------------------------
  1025. * Pointer declarations
  1026. * ----------------------------------------------------------------------------- */
  1027. /* Flags for new pointer objects */
  1028. #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
  1029. #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
  1030. #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
  1031. #ifdef __cplusplus
  1032. extern "C" {
  1033. #if 0
  1034. } /* cc-mode */
  1035. #endif
  1036. #endif
  1037. /* How to access Py_None */
  1038. #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  1039. # ifndef SWIG_PYTHON_NO_BUILD_NONE
  1040. # ifndef SWIG_PYTHON_BUILD_NONE
  1041. # define SWIG_PYTHON_BUILD_NONE
  1042. # endif
  1043. # endif
  1044. #endif
  1045. #ifdef SWIG_PYTHON_BUILD_NONE
  1046. # ifdef Py_None
  1047. # undef Py_None
  1048. # define Py_None SWIG_Py_None()
  1049. # endif
  1050. SWIGRUNTIMEINLINE PyObject *
  1051. _SWIG_Py_None(void)
  1052. {
  1053. PyObject *none = Py_BuildValue((char*)"");
  1054. Py_DECREF(none);
  1055. return none;
  1056. }
  1057. SWIGRUNTIME PyObject *
  1058. SWIG_Py_None(void)
  1059. {
  1060. static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
  1061. return none;
  1062. }
  1063. #endif
  1064. /* The python void return value */
  1065. SWIGRUNTIMEINLINE PyObject *
  1066. SWIG_Py_Void(void)
  1067. {
  1068. PyObject *none = Py_None;
  1069. Py_INCREF(none);
  1070. return none;
  1071. }
  1072. /* PySwigClientData */
  1073. typedef struct {
  1074. PyObject *klass;
  1075. PyObject *newraw;
  1076. PyObject *newargs;
  1077. PyObject *destroy;
  1078. int delargs;
  1079. int implicitconv;
  1080. } PySwigClientData;
  1081. SWIGRUNTIMEINLINE int
  1082. SWIG_Python_CheckImplicit(swig_type_info *ty)
  1083. {
  1084. PySwigClientData *data = (PySwigClientData *)ty->clientdata;
  1085. return data ? data->implicitconv : 0;
  1086. }
  1087. SWIGRUNTIMEINLINE PyObject *
  1088. SWIG_Python_ExceptionType(swig_type_info *desc) {
  1089. PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
  1090. PyObject *klass = data ? data->klass : 0;
  1091. return (klass ? klass : PyExc_RuntimeError);
  1092. }
  1093. SWIGRUNTIME PySwigClientData *
  1094. PySwigClientData_New(PyObject* obj)
  1095. {
  1096. if (!obj) {
  1097. return 0;
  1098. } else {
  1099. PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
  1100. /* the klass element */
  1101. data->klass = obj;
  1102. Py_INCREF(data->klass);
  1103. /* the newraw method and newargs arguments used to create a new raw instance */
  1104. if (PyClass_Check(obj)) {
  1105. data->newraw = 0;
  1106. data->newargs = obj;
  1107. Py_INCREF(obj);
  1108. } else {
  1109. #if (PY_VERSION_HEX < 0x02020000)
  1110. data->newraw = 0;
  1111. #else
  1112. data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
  1113. #endif
  1114. if (data->newraw) {
  1115. Py_INCREF(data->newraw);
  1116. data->newargs = PyTuple_New(1);
  1117. PyTuple_SetItem(data->newargs, 0, obj);
  1118. } else {
  1119. data->newargs = obj;
  1120. }
  1121. Py_INCREF(data->newargs);
  1122. }
  1123. /* the destroy method, aka as the C++ delete method */
  1124. data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
  1125. if (PyErr_Occurred()) {
  1126. PyErr_Clear();
  1127. data->destroy = 0;
  1128. }
  1129. if (data->destroy) {
  1130. int flags;
  1131. Py_INCREF(data->destroy);
  1132. flags = PyCFunction_GET_FLAGS(data->destroy);
  1133. #ifdef METH_O
  1134. data->delargs = !(flags & (METH_O));
  1135. #else
  1136. data->delargs = 0;
  1137. #endif
  1138. } else {
  1139. data->delargs = 0;
  1140. }
  1141. data->implicitconv = 0;
  1142. return data;
  1143. }
  1144. }
  1145. SWIGRUNTIME void
  1146. PySwigClientData_Del(PySwigClientData* data)
  1147. {
  1148. Py_XDECREF(data->newraw);
  1149. Py_XDECREF(data->newargs);
  1150. Py_XDECREF(data->destroy);
  1151. }
  1152. /* =============== PySwigObject =====================*/
  1153. typedef struct {
  1154. PyObject_HEAD
  1155. void *ptr;
  1156. swig_type_info *ty;
  1157. int own;
  1158. PyObject *next;
  1159. } PySwigObject;
  1160. SWIGRUNTIME PyObject *
  1161. PySwigObject_long(PySwigObject *v)
  1162. {
  1163. return PyLong_FromVoidPtr(v->ptr);
  1164. }
  1165. SWIGRUNTIME PyObject *
  1166. PySwigObject_format(const char* fmt, PySwigObject *v)
  1167. {
  1168. PyObject *res = NULL;
  1169. PyObject *args = PyTuple_New(1);
  1170. if (args) {
  1171. if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
  1172. PyObject *ofmt = PyString_FromString(fmt);
  1173. if (ofmt) {
  1174. res = PyString_Format(ofmt,args);
  1175. Py_DECREF(ofmt);
  1176. }
  1177. Py_DECREF(args);
  1178. }
  1179. }
  1180. return res;
  1181. }
  1182. SWIGRUNTIME PyObject *
  1183. PySwigObject_oct(PySwigObject *v)
  1184. {
  1185. return PySwigObject_format("%o",v);
  1186. }
  1187. SWIGRUNTIME PyObject *
  1188. PySwigObject_hex(PySwigObject *v)
  1189. {
  1190. return PySwigObject_format("%x",v);
  1191. }
  1192. SWIGRUNTIME PyObject *
  1193. #ifdef METH_NOARGS
  1194. PySwigObject_repr(PySwigObject *v)
  1195. #else
  1196. PySwigObject_repr(PySwigObject *v, PyObject *args)
  1197. #endif
  1198. {
  1199. const char *name = SWIG_TypePrettyName(v->ty);
  1200. PyObject *hex = PySwigObject_hex(v);
  1201. PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
  1202. Py_DECREF(hex);
  1203. if (v->next) {
  1204. #ifdef METH_NOARGS
  1205. PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
  1206. #else
  1207. PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
  1208. #endif
  1209. PyString_ConcatAndDel(&repr,nrep);
  1210. }
  1211. return repr;
  1212. }
  1213. SWIGRUNTIME int
  1214. PySwigObject_print(PySwigObject *v, FILE *, int SWIGUNUSEDPARM(flags))
  1215. {
  1216. #ifdef METH_NOARGS
  1217. PyObject *repr = PySwigObject_repr(v);
  1218. #else
  1219. PyObject *repr = PySwigObject_repr(v, NULL);
  1220. #endif
  1221. if (repr) {
  1222. printf(PyString_AsString(repr));
  1223. Py_DECREF(repr);
  1224. return 0;
  1225. } else {
  1226. return 1;
  1227. }
  1228. }
  1229. SWIGRUNTIME PyObject *
  1230. PySwigObject_str(PySwigObject *v)
  1231. {
  1232. char result[SWIG_BUFFER_SIZE];
  1233. return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
  1234. PyString_FromString(result) : 0;
  1235. }
  1236. SWIGRUNTIME int
  1237. PySwigObject_compare(PySwigObject *v, PySwigObject *w)
  1238. {
  1239. void *i = v->ptr;
  1240. void *j = w->ptr;
  1241. return (i < j) ? -1 : ((i > j) ? 1 : 0);
  1242. }
  1243. SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
  1244. SWIGRUNTIME PyTypeObject*
  1245. PySwigObject_type(void) {
  1246. static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
  1247. return type;
  1248. }
  1249. SWIGRUNTIMEINLINE int
  1250. PySwigObject_Check(PyObject *op) {
  1251. return ((op)->ob_type == PySwigObject_type())
  1252. || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
  1253. }
  1254. SWIGRUNTIME PyObject *
  1255. PySwigObject_New(void *ptr, swig_type_info *ty, int own);
  1256. SWIGRUNTIME void
  1257. PySwigObject_dealloc(PyObject *v)
  1258. {
  1259. PySwigObject *sobj = (PySwigObject *) v;
  1260. PyObject *next = sobj->next;
  1261. if (sobj->own == SWIG_POINTER_OWN) {
  1262. swig_type_info *ty = sobj->ty;
  1263. PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
  1264. PyObject *destroy = data ? data->destroy : 0;
  1265. if (destroy) {
  1266. /* destroy is always a VARARGS method */
  1267. PyObject *res;
  1268. if (data->delargs) {
  1269. /* we need to create a temporal object to carry the destroy operation */
  1270. PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
  1271. res = SWIG_Python_CallFunctor(destroy, tmp);
  1272. Py_DECREF(tmp);
  1273. } else {
  1274. PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
  1275. PyObject *mself = PyCFunction_GET_SELF(destroy);
  1276. res = ((*meth)(mself, v));
  1277. }
  1278. Py_XDECREF(res);
  1279. }
  1280. #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
  1281. else {
  1282. const char *name = SWIG_TypePrettyName(ty);
  1283. printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
  1284. }
  1285. #endif
  1286. }
  1287. Py_XDECREF(next);
  1288. PyObject_DEL(v);
  1289. }
  1290. SWIGRUNTIME PyObject*
  1291. PySwigObject_append(PyObject* v, PyObject* next)
  1292. {
  1293. PySwigObject *sobj = (PySwigObject *) v;
  1294. #ifndef METH_O
  1295. PyObject *tmp = 0;
  1296. if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
  1297. next = tmp;
  1298. #endif
  1299. if (!PySwigObject_Check(next)) {
  1300. return NULL;
  1301. }
  1302. sobj->next = next;
  1303. Py_INCREF(next);
  1304. return SWIG_Py_Void();
  1305. }
  1306. SWIGRUNTIME PyObject*
  1307. #ifdef METH_NOARGS
  1308. PySwigObject_next(PyObject* v)
  1309. #else
  1310. PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
  1311. #endif
  1312. {
  1313. PySwigObject *sobj = (PySwigObject *) v;
  1314. if (sobj->next) {
  1315. Py_INCREF(sobj->next);
  1316. return sobj->next;
  1317. } else {
  1318. return SWIG_Py_Void();
  1319. }
  1320. }
  1321. SWIGINTERN PyObject*
  1322. #ifdef METH_NOARGS
  1323. PySwigObject_disown(PyObject *v)
  1324. #else
  1325. PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
  1326. #endif
  1327. {
  1328. PySwigObject *sobj = (PySwigObject *)v;
  1329. sobj->own = 0;
  1330. return SWIG_Py_Void();
  1331. }
  1332. SWIGINTERN PyObject*
  1333. #ifdef METH_NOARGS
  1334. PySwigObject_acquire(PyObject *v)
  1335. #else
  1336. PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
  1337. #endif
  1338. {
  1339. PySwigObject *sobj = (PySwigObject *)v;
  1340. sobj->own = SWIG_POINTER_OWN;
  1341. return SWIG_Py_Void();
  1342. }
  1343. SWIGINTERN PyObject*
  1344. PySwigObject_own(PyObject *v, PyObject *args)
  1345. {
  1346. PyObject *val = 0;
  1347. #if (PY_VERSION_HEX < 0x02020000)
  1348. if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
  1349. #else
  1350. if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
  1351. #endif
  1352. {
  1353. return NULL;
  1354. }
  1355. else
  1356. {
  1357. PySwigObject *sobj = (PySwigObject *)v;
  1358. PyObject *obj = PyBool_FromLong(sobj->own);
  1359. if (val) {
  1360. #ifdef METH_NOARGS
  1361. if (PyObject_IsTrue(val)) {
  1362. PySwigObject_acquire(v);
  1363. } else {
  1364. PySwigObject_disown(v);
  1365. }
  1366. #else
  1367. if (PyObject_IsTrue(val)) {
  1368. PySwigObject_acquire(v,args);
  1369. } else {
  1370. PySwigObject_disown(v,args);
  1371. }
  1372. #endif
  1373. }
  1374. return obj;
  1375. }
  1376. }
  1377. #ifdef METH_O
  1378. static PyMethodDef
  1379. swigobject_methods[] = {
  1380. {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
  1381. {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
  1382. {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
  1383. {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"},
  1384. {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
  1385. {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"},
  1386. {0, 0, 0, 0}
  1387. };
  1388. #else
  1389. static PyMethodDef
  1390. swigobject_methods[] = {
  1391. {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
  1392. {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
  1393. {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
  1394. {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
  1395. {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
  1396. {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"},
  1397. {0, 0, 0, 0}
  1398. };
  1399. #endif
  1400. #if PY_VERSION_HEX < 0x02020000
  1401. SWIGINTERN PyObject *
  1402. PySwigObject_getattr(PySwigObject *sobj,char *name)
  1403. {
  1404. return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
  1405. }
  1406. #endif
  1407. SWIGRUNTIME PyTypeObject*
  1408. _PySwigObject_type(void) {
  1409. static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
  1410. static PyNumberMethods PySwigObject_as_number = {
  1411. (binaryfunc)0, /*nb_add*/
  1412. (binaryfunc)0, /*nb_subtract*/
  1413. (binaryfunc)0, /*nb_multiply*/
  1414. (binaryfunc)0, /*nb_divide*/
  1415. (binaryfunc)0, /*nb_remainder*/
  1416. (binaryfunc)0, /*nb_divmod*/
  1417. (ternaryfunc)0,/*nb_power*/
  1418. (unaryfunc)0, /*nb_negative*/
  1419. (unaryfunc)0, /*nb_positive*/
  1420. (unaryfunc)0, /*nb_absolute*/
  1421. (inquiry)0, /*nb_nonzero*/
  1422. 0, /*nb_invert*/
  1423. 0, /*nb_lshift*/
  1424. 0, /*nb_rshift*/
  1425. 0, /*nb_and*/
  1426. 0, /*nb_xor*/
  1427. 0, /*nb_or*/
  1428. (coercion)0, /*nb_coerce*/
  1429. (unaryfunc)PySwigObject_long, /*nb_int*/
  1430. (unaryfunc)PySwigObject_long, /*nb_long*/
  1431. (unaryfunc)0, /*nb_float*/
  1432. (unaryfunc)PySwigObject_oct, /*nb_oct*/
  1433. (unaryfunc)PySwigObject_hex, /*nb_hex*/
  1434. #if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
  1435. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
  1436. #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
  1437. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
  1438. #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
  1439. 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
  1440. #endif
  1441. };
  1442. static PyTypeObject pyswigobject_type;
  1443. static int type_init = 0;
  1444. if (!type_init) {
  1445. const PyTypeObject tmp
  1446. = {
  1447. PyObject_HEAD_INIT(NULL)
  1448. 0, /* ob_size */
  1449. (char *)"PySwigObject", /* tp_name */
  1450. sizeof(PySwigObject), /* tp_basicsize */
  1451. 0, /* tp_itemsize */
  1452. (destructor)PySwigObject_dealloc, /* tp_dealloc */
  1453. (printfunc)PySwigObject_print, /* tp_print */
  1454. #if PY_VERSION_HEX < 0x02020000
  1455. (getattrfunc)PySwigObject_getattr, /* tp_getattr */
  1456. #else
  1457. (getattrfunc)0, /* tp_getattr */
  1458. #endif
  1459. (setattrfunc)0, /* tp_setattr */
  1460. (cmpfunc)PySwigObject_compare, /* tp_compare */
  1461. (reprfunc)PySwigObject_repr, /* tp_repr */
  1462. &PySwigObject_as_number, /* tp_as_number */
  1463. 0, /* tp_as_sequence */
  1464. 0, /* tp_as_mapping */
  1465. (hashfunc)0, /* tp_hash */
  1466. (ternaryfunc)0, /* tp_call */
  1467. (reprfunc)PySwigObject_str, /* tp_str */
  1468. PyObject_GenericGetAttr, /* tp_getattro */
  1469. 0, /* tp_setattro */
  1470. 0, /* tp_as_buffer */
  1471. Py_TPFLAGS_DEFAULT, /* tp_flags */
  1472. swigobject_doc, /* tp_doc */
  1473. 0, /* tp_traverse */
  1474. 0, /* tp_clear */
  1475. 0, /* tp_richcompare */
  1476. 0, /* tp_weaklistoffset */
  1477. #if PY_VERSION_HEX >= 0x02020000
  1478. 0, /* tp_iter */
  1479. 0, /* tp_iternext */
  1480. swigobject_methods, /* tp_methods */
  1481. 0, /* tp_members */
  1482. 0, /* tp_getset */
  1483. 0, /* tp_base */
  1484. 0, /* tp_dict */
  1485. 0, /* tp_descr_get */
  1486. 0, /* tp_descr_set */
  1487. 0, /* tp_dictoffset */
  1488. 0, /* tp_init */
  1489. 0, /* tp_alloc */
  1490. 0, /* tp_new */
  1491. 0, /* tp_free */
  1492. 0, /* tp_is_gc */
  1493. 0, /* tp_bases */
  1494. 0, /* tp_mro */
  1495. 0, /* tp_cache */
  1496. 0, /* tp_subclasses */
  1497. 0, /* tp_weaklist */
  1498. #endif
  1499. #if PY_VERSION_HEX >= 0x02030000
  1500. 0, /* tp_del */
  1501. #endif
  1502. #ifdef COUNT_ALLOCS
  1503. 0,0,0,0 /* tp_alloc -> tp_next */
  1504. #endif
  1505. };
  1506. pyswigobject_type = tmp;
  1507. pyswigobject_type.ob_type = &PyType_Type;
  1508. type_init = 1;
  1509. }
  1510. return &pyswigobject_type;
  1511. }
  1512. SWIGRUNTIME PyObject *
  1513. PySwigObject_New(void *ptr, swig_type_info *ty, int own)
  1514. {
  1515. PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
  1516. if (sobj) {
  1517. sobj->ptr = ptr;
  1518. sobj->ty = ty;
  1519. sobj->own = own;
  1520. sobj->next = 0;
  1521. }
  1522. return (PyObject *)sobj;
  1523. }
  1524. /* -----------------------------------------------------------------------------
  1525. * Implements a simple Swig Packed type, and use it instead of string
  1526. * ----------------------------------------------------------------------------- */
  1527. typedef struct {
  1528. PyObject_HEAD
  1529. void *pack;
  1530. swig_type_info *ty;
  1531. size_t size;
  1532. } PySwigPacked;
  1533. SWIGRUNTIME int
  1534. PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
  1535. {
  1536. char result[SWIG_BUFFER_SIZE];
  1537. fputs("<Swig Packed ", fp);
  1538. if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
  1539. fputs("at ", fp);
  1540. fputs(result, fp);
  1541. }
  1542. fputs(v->ty->name,fp);
  1543. fputs(">", fp);
  1544. return 0;
  1545. }
  1546. SWIGRUNTIME PyObject *
  1547. PySwigPacked_repr(PySwigPacked *v)
  1548. {
  1549. char result[SWIG_BUFFER_SIZE];
  1550. if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
  1551. return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
  1552. } else {
  1553. return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
  1554. }
  1555. }
  1556. SWIGRUNTIME PyObject *
  1557. PySwigPacked_str(PySwigPacked *v)
  1558. {
  1559. char result[SWIG_BUFFER_SIZE];
  1560. if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
  1561. return PyString_FromFormat("%s%s", result, v->ty->name);
  1562. } else {
  1563. return PyString_FromString(v->ty->name);
  1564. }
  1565. }
  1566. SWIGRUNTIME int
  1567. PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
  1568. {
  1569. size_t i = v->size;
  1570. size_t j = w->size;
  1571. int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
  1572. return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
  1573. }
  1574. SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
  1575. SWIGRUNTIME PyTypeObject*
  1576. PySwigPacked_type(void) {
  1577. static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
  1578. return type;
  1579. }
  1580. SWIGRUNTIMEINLINE int
  1581. PySwigPacked_Check(PyObject *op) {
  1582. return ((op)->ob_type == _PySwigPacked_type())
  1583. || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
  1584. }
  1585. SWIGRUNTIME void
  1586. PySwigPacked_dealloc(PyObject *v)
  1587. {
  1588. if (PySwigPacked_Check(v)) {
  1589. PySwigPacked *sobj = (PySwigPacked *) v;
  1590. free(sobj->pack);
  1591. }
  1592. PyObject_DEL(v);
  1593. }
  1594. SWIGRUNTIME PyTypeObject*
  1595. _PySwigPacked_type(void) {
  1596. static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
  1597. static PyTypeObject pyswigpacked_type;
  1598. static int type_init = 0;
  1599. if (!type_init) {
  1600. const PyTypeObject tmp
  1601. = {
  1602. PyObject_HEAD_INIT(NULL)
  1603. 0, /* ob_size */
  1604. (char *)"PySwigPacked", /* tp_name */
  1605. sizeof(PySwigPacked), /* tp_basicsize */
  1606. 0, /* tp_itemsize */
  1607. (destructor)PySwigPacked_dealloc, /* tp_dealloc */
  1608. (printfunc)PySwigPacked_print, /* tp_print */
  1609. (getattrfunc)0, /* tp_getattr */
  1610. (setattrfunc)0, /* tp_setattr */
  1611. (cmpfunc)PySwigPacked_compare, /* tp_compare */
  1612. (reprfunc)PySwigPacked_repr, /* tp_repr */
  1613. 0, /* tp_as_number */
  1614. 0, /* tp_as_sequence */
  1615. 0, /* tp_as_mapping */
  1616. (hashfunc)0, /* tp_hash */
  1617. (ternaryfunc)0, /* tp_call */
  1618. (reprfunc)PySwigPacked_str, /* tp_str */
  1619. PyObject_GenericGetAttr, /* tp_getattro */
  1620. 0, /* tp_setattro */
  1621. 0, /* tp_as_buffer */
  1622. Py_TPFLAGS_DEFAULT, /* tp_flags */
  1623. swigpacked_doc, /* tp_doc */
  1624. 0, /* tp_traverse */
  1625. 0, /* tp_clear */
  1626. 0, /* tp_richcompare */
  1627. 0, /* tp_weaklistoffset */
  1628. #if PY_VERSION_HEX >= 0x02020000
  1629. 0, /* tp_iter */
  1630. 0, /* tp_iternext */
  1631. 0, /* tp_methods */
  1632. 0, /* tp_members */
  1633. 0, /* tp_getset */
  1634. 0, /* tp_base */
  1635. 0, /* tp_dict */
  1636. 0, /* tp_descr_get */
  1637. 0, /* tp_descr_set */
  1638. 0, /* tp_dictoffset */
  1639. 0, /* tp_init */
  1640. 0, /* tp_alloc */
  1641. 0, /* tp_new */
  1642. 0, /* tp_free */
  1643. 0, /* tp_is_gc */
  1644. 0, /* tp_bases */
  1645. 0, /* tp_mro */
  1646. 0, /* tp_cache */
  1647. 0, /* tp_subclasses */
  1648. 0, /* tp_weaklist */
  1649. #endif
  1650. #if PY_VERSION_HEX >= 0x02030000
  1651. 0, /* tp_del */
  1652. #endif
  1653. #ifdef COUNT_ALLOCS
  1654. 0,0,0,0 /* tp_alloc -> tp_next */
  1655. #endif
  1656. };
  1657. pyswigpacked_type = tmp;
  1658. pyswigpacked_type.ob_type = &PyType_Type;
  1659. type_init = 1;
  1660. }
  1661. return &pyswigpacked_type;
  1662. }
  1663. SWIGRUNTIME PyObject *
  1664. PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
  1665. {
  1666. PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
  1667. if (sobj) {
  1668. void *pack = malloc(size);
  1669. if (pack) {
  1670. memcpy(pack, ptr, size);
  1671. sobj->pack = pack;
  1672. sobj->ty = ty;
  1673. sobj->size = size;
  1674. } else {
  1675. PyObject_DEL((PyObject *) sobj);
  1676. sobj = 0;
  1677. }
  1678. }
  1679. return (PyObject *) sobj;
  1680. }
  1681. SWIGRUNTIME swig_type_info *
  1682. PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
  1683. {
  1684. if (PySwigPacked_Check(obj)) {
  1685. PySwigPacked *sobj = (PySwigPacked *)obj;
  1686. if (sobj->size != size) return 0;
  1687. memcpy(ptr, sobj->pack, size);
  1688. return sobj->ty;
  1689. } else {
  1690. return 0;
  1691. }
  1692. }
  1693. /* -----------------------------------------------------------------------------
  1694. * pointers/data manipulation
  1695. * ----------------------------------------------------------------------------- */
  1696. SWIGRUNTIMEINLINE PyObject *
  1697. _SWIG_This(void)
  1698. {
  1699. return PyString_FromString("this");
  1700. }
  1701. SWIGRUNTIME PyObject *
  1702. SWIG_This(void)
  1703. {
  1704. static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
  1705. return swig_this;
  1706. }
  1707. /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
  1708. SWIGRUNTIME PySwigObject *
  1709. SWIG_Python_GetSwigThis(PyObject *pyobj)
  1710. {
  1711. if (PySwigObject_Check(pyobj)) {
  1712. return (PySwigObject *) pyobj;
  1713. } else {
  1714. PyObject *obj = 0;
  1715. #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
  1716. if (PyInstance_Check(pyobj)) {
  1717. obj = _PyInstance_Lookup(pyobj, SWIG_This());
  1718. } else {
  1719. PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
  1720. if (dictptr != NULL) {
  1721. PyObject *dict = *dictptr;
  1722. obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
  1723. } else {
  1724. #ifdef PyWeakref_CheckProxy
  1725. if (PyWeakref_CheckProxy(pyobj)) {
  1726. PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
  1727. return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
  1728. }
  1729. #endif
  1730. obj = PyObject_GetAttr(pyobj,SWIG_This());
  1731. if (obj) {
  1732. Py_DECREF(obj);
  1733. } else {
  1734. if (PyErr_Occurred()) PyErr_Clear();
  1735. return 0;
  1736. }
  1737. }
  1738. }
  1739. #else
  1740. obj = PyObject_GetAttr(pyobj,SWIG_This());
  1741. if (obj) {
  1742. Py_DECREF(obj);
  1743. } else {
  1744. if (PyErr_Occurred()) PyErr_Clear();
  1745. return 0;
  1746. }
  1747. #endif
  1748. if (obj && !PySwigObject_Check(obj)) {
  1749. /* a PyObject is called 'this', try to get the 'real this'
  1750. PySwigObject from it */
  1751. return SWIG_Python_GetSwigThis(obj);
  1752. }
  1753. return (PySwigObject *)obj;
  1754. }
  1755. }
  1756. /* Acquire a pointer value */
  1757. SWIGRUNTIME int
  1758. SWIG_Python_AcquirePtr(PyObject *obj, int own) {
  1759. if (own == SWIG_POINTER_OWN) {
  1760. PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
  1761. if (sobj) {
  1762. int oldown = sobj->own;
  1763. sobj->own = own;
  1764. return oldown;
  1765. }
  1766. }
  1767. return 0;
  1768. }
  1769. /* Convert a pointer value */
  1770. SWIGRUNTIME int
  1771. SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
  1772. if (!obj) return SWIG_ERROR;
  1773. if (obj == Py_None) {
  1774. if (ptr) *ptr = 0;
  1775. return SWIG_OK;
  1776. } else {
  1777. PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
  1778. if (own)
  1779. *own = 0;
  1780. while (sobj) {
  1781. void *vptr = sobj->ptr;
  1782. if (ty) {
  1783. swig_type_info *to = sobj->ty;
  1784. if (to == ty) {
  1785. /* no type cast needed */
  1786. if (ptr) *ptr = vptr;
  1787. break;
  1788. } else {
  1789. swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
  1790. if (!tc) {
  1791. sobj = (PySwigObject *)sobj->next;
  1792. } else {
  1793. if (ptr) {
  1794. int newmemory = 0;
  1795. *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
  1796. if (newmemory == SWIG_CAST_NEW_MEMORY) {
  1797. assert(own);
  1798. if (own)
  1799. *own = *own | SWIG_CAST_NEW_MEMORY;
  1800. }
  1801. }
  1802. break;
  1803. }
  1804. }
  1805. } else {
  1806. if (ptr) *ptr = vptr;
  1807. break;
  1808. }
  1809. }
  1810. if (sobj) {
  1811. if (own)
  1812. *own = *own | sobj->own;
  1813. if (flags & SWIG_POINTER_DISOWN) {
  1814. sobj->own = 0;
  1815. }
  1816. return SWIG_OK;
  1817. } else {
  1818. int res = SWIG_ERROR;
  1819. if (flags & SWIG_POINTER_IMPLICIT_CONV) {
  1820. PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
  1821. if (data && !data->implicitconv) {
  1822. PyObject *klass = data->klass;
  1823. if (klass) {
  1824. PyObject *impconv;
  1825. data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
  1826. impconv = SWIG_Python_CallFunctor(klass, obj);
  1827. data->implicitconv = 0;
  1828. if (PyErr_Occurred()) {
  1829. PyErr_Clear();
  1830. impconv = 0;
  1831. }
  1832. if (impconv) {
  1833. PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
  1834. if (iobj) {
  1835. void *vptr;
  1836. res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
  1837. if (SWIG_IsOK(res)) {
  1838. if (ptr) {
  1839. *ptr = vptr;
  1840. /* transfer the ownership to 'ptr' */
  1841. iobj->own = 0;
  1842. res = SWIG_AddCast(res);
  1843. res = SWIG_AddNewMask(res);
  1844. } else {
  1845. res = SWIG_AddCast(res);
  1846. }
  1847. }
  1848. }
  1849. Py_DECREF(impconv);
  1850. }
  1851. }
  1852. }
  1853. }
  1854. return res;
  1855. }
  1856. }
  1857. }
  1858. /* Convert a function ptr value */
  1859. SWIGRUNTIME int
  1860. SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
  1861. if (!PyCFunction_Check(obj)) {
  1862. return SWIG_ConvertPtr(obj, ptr, ty, 0);
  1863. } else {
  1864. void *vptr = 0;
  1865. /* here we get the method pointer for callbacks */
  1866. const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
  1867. const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
  1868. if (desc) {
  1869. desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
  1870. if (!desc) return SWIG_ERROR;
  1871. }
  1872. if (ty) {
  1873. swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
  1874. if (tc) {
  1875. int newmemory = 0;
  1876. *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
  1877. assert(!newmemory); /* newmemory handling not yet implemented */
  1878. } else {
  1879. return SWIG_ERROR;
  1880. }
  1881. } else {
  1882. *ptr = vptr;
  1883. }
  1884. return SWIG_OK;
  1885. }
  1886. }
  1887. /* Convert a packed value value */
  1888. SWIGRUNTIME int
  1889. SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
  1890. swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
  1891. if (!to) return SWIG_ERROR;
  1892. if (ty) {
  1893. if (to != ty) {
  1894. /* check type cast? */
  1895. swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
  1896. if (!tc) return SWIG_ERROR;
  1897. }
  1898. }
  1899. return SWIG_OK;
  1900. }
  1901. /* -----------------------------------------------------------------------------
  1902. * Create a new pointer object
  1903. * ----------------------------------------------------------------------------- */
  1904. /*
  1905. Create a new instance object, whitout calling __init__, and set the
  1906. 'this' attribute.
  1907. */
  1908. SWIGRUNTIME PyObject*
  1909. SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
  1910. {
  1911. #if (PY_VERSION_HEX >= 0x02020000)
  1912. PyObject *inst = 0;
  1913. PyObject *newraw = data->newraw;
  1914. if (newraw) {
  1915. inst = PyObject_Call(newraw, data->newargs, NULL);
  1916. if (inst) {
  1917. #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
  1918. PyObject **dictptr = _PyObject_GetDictPtr(inst);
  1919. if (dictptr != NULL) {
  1920. PyObject *dict = *dictptr;
  1921. if (dict == NULL) {
  1922. dict = PyDict_New();
  1923. *dictptr = dict;
  1924. PyDict_SetItem(dict, SWIG_This(), swig_this);
  1925. }
  1926. }
  1927. #else
  1928. PyObject *key = SWIG_This();
  1929. PyObject_SetAttr(inst, key, swig_this);
  1930. #endif
  1931. }
  1932. } else {
  1933. PyObject *dict = PyDict_New();
  1934. PyDict_SetItem(dict, SWIG_This(), swig_this);
  1935. inst = PyInstance_NewRaw(data->newargs, dict);
  1936. Py_DECREF(dict);
  1937. }
  1938. return inst;
  1939. #else
  1940. #if (PY_VERSION_HEX >= 0x02010000)
  1941. PyObject *inst;
  1942. PyObject *dict = PyDict_New();
  1943. PyDict_SetItem(dict, SWIG_This(), swig_this);
  1944. inst = PyInstance_NewRaw(data->newargs, dict);
  1945. Py_DECREF(dict);
  1946. return (PyObject *) inst;
  1947. #else
  1948. PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
  1949. if (inst == NULL) {
  1950. return NULL;
  1951. }
  1952. inst->in_class = (PyClassObject *)data->newargs;
  1953. Py_INCREF(inst->in_class);
  1954. inst->in_dict = PyDict_New();
  1955. if (inst->in_dict == NULL) {
  1956. Py_DECREF(inst);
  1957. return NULL;
  1958. }
  1959. #ifdef Py_TPFLAGS_HAVE_WEAKREFS
  1960. inst->in_weakreflist = NULL;
  1961. #endif
  1962. #ifdef Py_TPFLAGS_GC
  1963. PyObject_GC_Init(inst);
  1964. #endif
  1965. PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
  1966. return (PyObject *) inst;
  1967. #endif
  1968. #endif
  1969. }
  1970. SWIGRUNTIME void
  1971. SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
  1972. {
  1973. PyObject *dict;
  1974. #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
  1975. PyObject **dictptr = _PyObject_GetDictPtr(inst);
  1976. if (dictptr != NULL) {
  1977. dict = *dictptr;
  1978. if (dict == NULL) {
  1979. dict = PyDict_New();
  1980. *dictptr = dict;
  1981. }
  1982. PyDict_SetItem(dict, SWIG_This(), swig_this);
  1983. return;
  1984. }
  1985. #endif
  1986. dict = PyObject_GetAttrString(inst, (char*)"__dict__");
  1987. PyDict_SetItem(dict, SWIG_This(), swig_this);
  1988. Py_DECREF(dict);
  1989. }
  1990. SWIGINTERN PyObject *
  1991. SWIG_Python_InitShadowInstance(PyObject *args) {
  1992. PyObject *obj[2];
  1993. if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
  1994. return NULL;
  1995. } else {
  1996. PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
  1997. if (sthis) {
  1998. PySwigObject_append((PyObject*) sthis, obj[1]);
  1999. } else {
  2000. SWIG_Python_SetSwigThis(obj[0], obj[1]);
  2001. }
  2002. return SWIG_Py_Void();
  2003. }
  2004. }
  2005. /* Create a new pointer object */
  2006. SWIGRUNTIME PyObject *
  2007. SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
  2008. if (!ptr) {
  2009. return SWIG_Py_Void();
  2010. } else {
  2011. int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
  2012. PyObject *robj = PySwigObject_New(ptr, type, own);
  2013. PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
  2014. if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
  2015. PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
  2016. if (inst) {
  2017. Py_DECREF(robj);
  2018. robj = inst;
  2019. }
  2020. }
  2021. return robj;
  2022. }
  2023. }
  2024. /* Create a new packed object */
  2025. SWIGRUNTIMEINLINE PyObject *
  2026. SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
  2027. return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
  2028. }
  2029. /* -----------------------------------------------------------------------------*
  2030. * Get type list
  2031. * -----------------------------------------------------------------------------*/
  2032. #ifdef SWIG_LINK_RUNTIME
  2033. void *SWIG_ReturnGlobalTypeList(void *);
  2034. #endif
  2035. SWIGRUNTIME swig_module_info *
  2036. SWIG_Python_GetModule(void) {
  2037. static void *type_pointer = (void *)0;
  2038. /* first check if module already created */
  2039. if (!type_pointer) {
  2040. #ifdef SWIG_LINK_RUNTIME
  2041. type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
  2042. #else
  2043. type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
  2044. (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
  2045. if (PyErr_Occurred()) {
  2046. PyErr_Clear();
  2047. type_pointer = (void *)0;
  2048. }
  2049. #endif
  2050. }
  2051. return (swig_module_info *) type_pointer;
  2052. }
  2053. #if PY_MAJOR_VERSION < 2
  2054. /* PyModule_AddObject function was introduced in Python 2.0. The following function
  2055. is copied out of Python/modsupport.c in python version 2.3.4 */
  2056. SWIGINTERN int
  2057. PyModule_AddObject(PyObject *m, char *name, PyObject *o)
  2058. {
  2059. PyObject *dict;
  2060. if (!PyModule_Check(m)) {
  2061. PyErr_SetString(PyExc_TypeError,
  2062. "PyModule_AddObject() needs module as first arg");
  2063. return SWIG_ERROR;
  2064. }
  2065. if (!o) {
  2066. PyErr_SetString(PyExc_TypeError,
  2067. "PyModule_AddObject() needs non-NULL value");
  2068. return SWIG_ERROR;
  2069. }
  2070. dict = PyModule_GetDict(m);
  2071. if (dict == NULL) {
  2072. /* Internal error -- modules must have a dict! */
  2073. PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
  2074. PyModule_GetName(m));
  2075. return SWIG_ERROR;
  2076. }
  2077. if (PyDict_SetItemString(dict, name, o))
  2078. return SWIG_ERROR;
  2079. Py_DECREF(o);
  2080. return SWIG_OK;
  2081. }
  2082. #endif
  2083. SWIGRUNTIME void
  2084. SWIG_Python_DestroyModule(void *vptr)
  2085. {
  2086. swig_module_info *swig_module = (swig_module_info *) vptr;
  2087. swig_type_info **types = swig_module->types;
  2088. size_t i;
  2089. for (i =0; i < swig_module->size; ++i) {
  2090. swig_type_info *ty = types[i];
  2091. if (ty->owndata) {
  2092. PySwigClientData *data = (PySwigClientData *) ty->clientdata;
  2093. if (data) PySwigClientData_Del(data);
  2094. }
  2095. }
  2096. Py_DECREF(SWIG_This());
  2097. }
  2098. SWIGRUNTIME void
  2099. SWIG_Python_SetModule(swig_module_info *swig_module) {
  2100. static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
  2101. PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
  2102. swig_empty_runtime_method_table);
  2103. PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
  2104. if (pointer && module) {
  2105. PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
  2106. } else {
  2107. Py_XDECREF(pointer);
  2108. }
  2109. }
  2110. /* The python cached type query */
  2111. SWIGRUNTIME PyObject *
  2112. SWIG_Python_TypeCache(void) {
  2113. static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
  2114. return cache;
  2115. }
  2116. SWIGRUNTIME swig_type_info *
  2117. SWIG_Python_TypeQuery(const char *type)
  2118. {
  2119. PyObject *cache = SWIG_Python_TypeCache();
  2120. PyObject *key = PyString_FromString(type);
  2121. PyObject *obj = PyDict_GetItem(cache, key);
  2122. swig_type_info *descriptor;
  2123. if (obj) {
  2124. descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
  2125. } else {
  2126. swig_module_info *swig_module = SWIG_Python_GetModule();
  2127. descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
  2128. if (descriptor) {
  2129. obj = PyCObject_FromVoidPtr(descriptor, NULL);
  2130. PyDict_SetItem(cache, key, obj);
  2131. Py_DECREF(obj);
  2132. }
  2133. }
  2134. Py_DECREF(key);
  2135. return descriptor;
  2136. }
  2137. /*
  2138. For backward compatibility only
  2139. */
  2140. #define SWIG_POINTER_EXCEPTION 0
  2141. #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
  2142. #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
  2143. SWIGRUNTIME int
  2144. SWIG_Python_AddErrMesg(const char* mesg, int infront)
  2145. {
  2146. if (PyErr_Occurred()) {
  2147. PyObject *type = 0;
  2148. PyObject *value = 0;
  2149. PyObject *traceback = 0;
  2150. PyErr_Fetch(&type, &value, &traceback);
  2151. if (value) {
  2152. PyObject *old_str = PyObject_Str(value);
  2153. Py_XINCREF(type);
  2154. PyErr_Clear();
  2155. if (infront) {
  2156. PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
  2157. } else {
  2158. PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
  2159. }
  2160. Py_DECREF(old_str);
  2161. }
  2162. return 1;
  2163. } else {
  2164. return 0;
  2165. }
  2166. }
  2167. SWIGRUNTIME int
  2168. SWIG_Python_ArgFail(int argnum)
  2169. {
  2170. if (PyErr_Occurred()) {
  2171. /* add information about failing argument */
  2172. char mesg[256];
  2173. PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
  2174. return SWIG_Python_AddErrMesg(mesg, 1);
  2175. } else {
  2176. return 0;
  2177. }
  2178. }
  2179. SWIGRUNTIMEINLINE const char *
  2180. PySwigObject_GetDesc(PyObject *self)
  2181. {
  2182. PySwigObject *v = (PySwigObject *)self;
  2183. swig_type_info *ty = v ? v->ty : 0;
  2184. return ty ? ty->str : (char*)"";
  2185. }
  2186. SWIGRUNTIME void
  2187. SWIG_Python_TypeError(const char *type, PyObject *obj)
  2188. {
  2189. if (type) {
  2190. #if defined(SWIG_COBJECT_TYPES)
  2191. if (obj && PySwigObject_Check(obj)) {
  2192. const char *otype = (const char *) PySwigObject_GetDesc(obj);
  2193. if (otype) {
  2194. PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
  2195. type, otype);
  2196. return;
  2197. }
  2198. } else
  2199. #endif
  2200. {
  2201. const char *otype = (obj ? obj->ob_type->tp_name : 0);
  2202. if (otype) {
  2203. PyObject *str = PyObject_Str(obj);
  2204. const char *cstr = str ? PyString_AsString(str) : 0;
  2205. if (cstr) {
  2206. PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
  2207. type, otype, cstr);
  2208. } else {
  2209. PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
  2210. type, otype);
  2211. }
  2212. Py_XDECREF(str);
  2213. return;
  2214. }
  2215. }
  2216. PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
  2217. } else {
  2218. PyErr_Format(PyExc_TypeError, "unexpected type is received");
  2219. }
  2220. }
  2221. /* Convert a pointer value, signal an exception on a type mismatch */
  2222. SWIGRUNTIME void *
  2223. SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
  2224. void *result;
  2225. if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
  2226. PyErr_Clear();
  2227. if (flags & SWIG_POINTER_EXCEPTION) {
  2228. SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
  2229. SWIG_Python_ArgFail(argnum);
  2230. }
  2231. }
  2232. return result;
  2233. }
  2234. #ifdef __cplusplus
  2235. #if 0
  2236. { /* cc-mode */
  2237. #endif
  2238. }
  2239. #endif
  2240. /* -----------------------------------------------------------------------------*
  2241. Standard SWIG API for use inside user code.
  2242. Don't include this file directly, run the command
  2243. swig -python -external-runtime
  2244. Also, read the Modules chapter of the SWIG Manual.
  2245. * -----------------------------------------------------------------------------*/
  2246. #ifdef SWIG_MODULE_CLIENTDATA_TYPE
  2247. SWIGRUNTIMEINLINE swig_type_info *
  2248. SWIG_TypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
  2249. swig_module_info *module = SWIG_GetModule(clientdata);
  2250. return SWIG_TypeQueryModule(module, module, name);
  2251. }
  2252. SWIGRUNTIMEINLINE swig_type_info *
  2253. SWIG_MangledTypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
  2254. swig_module_info *module = SWIG_GetModule(clientdata);
  2255. return SWIG_MangledTypeQueryModule(module, module, name);
  2256. }
  2257. #else
  2258. SWIGRUNTIMEINLINE swig_type_info *
  2259. SWIG_TypeQuery(const char *name) {
  2260. swig_module_info *module = SWIG_GetModule(NULL);
  2261. return SWIG_TypeQueryModule(module, module, name);
  2262. }
  2263. SWIGRUNTIMEINLINE swig_type_info *
  2264. SWIG_MangledTypeQuery(const char *name) {
  2265. swig_module_info *module = SWIG_GetModule(NULL);
  2266. return SWIG_MangledTypeQueryModule(module, module, name);
  2267. }
  2268. #endif