PageRenderTime 49ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/xcc-python/xcc/xcc-python.c

http://github.com/marklogic/libmlxcc
C | 3367 lines | 2720 code | 414 blank | 233 comment | 467 complexity | 42e5c139a2cae04c5dd793c1a48fd9cf MD5 | raw file
Possible License(s): Apache-2.0

Large files files are truncated, but you can click here to view the full file

  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 1.3.24
  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. #define SWIGPYTHON
  11. #ifndef SWIG_TEMPLATE_DISAMBIGUATOR
  12. # if defined(__SUNPRO_CC)
  13. # define SWIG_TEMPLATE_DISAMBIGUATOR template
  14. # else
  15. # define SWIG_TEMPLATE_DISAMBIGUATOR
  16. # endif
  17. #endif
  18. #include <Python.h>
  19. /***********************************************************************
  20. * swigrun.swg
  21. *
  22. * This file contains generic CAPI SWIG runtime support for pointer
  23. * type checking.
  24. *
  25. ************************************************************************/
  26. /* This should only be incremented when either the layout of swig_type_info changes,
  27. or for whatever reason, the runtime changes incompatibly */
  28. #define SWIG_RUNTIME_VERSION "1"
  29. /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
  30. #ifdef SWIG_TYPE_TABLE
  31. #define SWIG_QUOTE_STRING(x) #x
  32. #define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
  33. #define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
  34. #else
  35. #define SWIG_TYPE_TABLE_NAME
  36. #endif
  37. #include <string.h>
  38. #ifndef SWIGINLINE
  39. #if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
  40. # define SWIGINLINE inline
  41. #else
  42. # define SWIGINLINE
  43. #endif
  44. #endif
  45. /*
  46. You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  47. creating a static or dynamic library from the swig runtime code.
  48. In 99.9% of the cases, swig just needs to declare them as 'static'.
  49. But only do this if is strictly necessary, ie, if you have problems
  50. with your compiler or so.
  51. */
  52. #ifndef SWIGRUNTIME
  53. #define SWIGRUNTIME static
  54. #endif
  55. #ifndef SWIGRUNTIMEINLINE
  56. #define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
  57. #endif
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61. typedef void *(*swig_converter_func)(void *);
  62. typedef struct swig_type_info *(*swig_dycast_func)(void **);
  63. typedef struct swig_type_info {
  64. const char *name;
  65. swig_converter_func converter;
  66. const char *str;
  67. void *clientdata;
  68. swig_dycast_func dcast;
  69. struct swig_type_info *next;
  70. struct swig_type_info *prev;
  71. } swig_type_info;
  72. /*
  73. Compare two type names skipping the space characters, therefore
  74. "char*" == "char *" and "Class<int>" == "Class<int >", etc.
  75. Return 0 when the two name types are equivalent, as in
  76. strncmp, but skipping ' '.
  77. */
  78. SWIGRUNTIME int
  79. SWIG_TypeNameComp(const char *f1, const char *l1,
  80. const char *f2, const char *l2) {
  81. for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
  82. while ((*f1 == ' ') && (f1 != l1)) ++f1;
  83. while ((*f2 == ' ') && (f2 != l2)) ++f2;
  84. if (*f1 != *f2) return *f1 - *f2;
  85. }
  86. return (l1 - f1) - (l2 - f2);
  87. }
  88. /*
  89. Check type equivalence in a name list like <name1>|<name2>|...
  90. */
  91. SWIGRUNTIME int
  92. SWIG_TypeEquiv(const char *nb, const char *tb) {
  93. int equiv = 0;
  94. const char* te = tb + strlen(tb);
  95. const char* ne = nb;
  96. while (!equiv && *ne) {
  97. for (nb = ne; *ne; ++ne) {
  98. if (*ne == '|') break;
  99. }
  100. equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0;
  101. if (*ne) ++ne;
  102. }
  103. return equiv;
  104. }
  105. /*
  106. Register a type mapping with the type-checking
  107. */
  108. SWIGRUNTIME swig_type_info *
  109. SWIG_TypeRegisterTL(swig_type_info **tl, swig_type_info *ti) {
  110. swig_type_info *tc, *head, *ret, *next;
  111. /* Check to see if this type has already been registered */
  112. tc = *tl;
  113. while (tc) {
  114. /* check simple type equivalence */
  115. int typeequiv = (strcmp(tc->name, ti->name) == 0);
  116. /* check full type equivalence, resolving typedefs */
  117. if (!typeequiv) {
  118. /* only if tc is not a typedef (no '|' on it) */
  119. if (tc->str && ti->str && !strstr(tc->str,"|")) {
  120. typeequiv = SWIG_TypeEquiv(ti->str,tc->str);
  121. }
  122. }
  123. if (typeequiv) {
  124. /* Already exists in the table. Just add additional types to the list */
  125. if (ti->clientdata) tc->clientdata = ti->clientdata;
  126. head = tc;
  127. next = tc->next;
  128. goto l1;
  129. }
  130. tc = tc->prev;
  131. }
  132. head = ti;
  133. next = 0;
  134. /* Place in list */
  135. ti->prev = *tl;
  136. *tl = ti;
  137. /* Build linked lists */
  138. l1:
  139. ret = head;
  140. tc = ti + 1;
  141. /* Patch up the rest of the links */
  142. while (tc->name) {
  143. head->next = tc;
  144. tc->prev = head;
  145. head = tc;
  146. tc++;
  147. }
  148. if (next) next->prev = head;
  149. head->next = next;
  150. return ret;
  151. }
  152. /*
  153. Check the typename
  154. */
  155. SWIGRUNTIME swig_type_info *
  156. SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  157. swig_type_info *s;
  158. if (!ty) return 0; /* Void pointer */
  159. s = ty->next; /* First element always just a name */
  160. do {
  161. if (strcmp(s->name,c) == 0) {
  162. if (s == ty->next) return s;
  163. /* Move s to the top of the linked list */
  164. s->prev->next = s->next;
  165. if (s->next) {
  166. s->next->prev = s->prev;
  167. }
  168. /* Insert s as second element in the list */
  169. s->next = ty->next;
  170. if (ty->next) ty->next->prev = s;
  171. ty->next = s;
  172. s->prev = ty;
  173. return s;
  174. }
  175. s = s->next;
  176. } while (s && (s != ty->next));
  177. return 0;
  178. }
  179. /*
  180. Cast a pointer up an inheritance hierarchy
  181. */
  182. SWIGRUNTIMEINLINE void *
  183. SWIG_TypeCast(swig_type_info *ty, void *ptr) {
  184. return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
  185. }
  186. /*
  187. Dynamic pointer casting. Down an inheritance hierarchy
  188. */
  189. SWIGRUNTIME swig_type_info *
  190. SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  191. swig_type_info *lastty = ty;
  192. if (!ty || !ty->dcast) return ty;
  193. while (ty && (ty->dcast)) {
  194. ty = (*ty->dcast)(ptr);
  195. if (ty) lastty = ty;
  196. }
  197. return lastty;
  198. }
  199. /*
  200. Return the name associated with this type
  201. */
  202. SWIGRUNTIMEINLINE const char *
  203. SWIG_TypeName(const swig_type_info *ty) {
  204. return ty->name;
  205. }
  206. /*
  207. Return the pretty name associated with this type,
  208. that is an unmangled type name in a form presentable to the user.
  209. */
  210. SWIGRUNTIME const char *
  211. SWIG_TypePrettyName(const swig_type_info *type) {
  212. /* The "str" field contains the equivalent pretty names of the
  213. type, separated by vertical-bar characters. We choose
  214. to print the last name, as it is often (?) the most
  215. specific. */
  216. if (type->str != NULL) {
  217. const char *last_name = type->str;
  218. const char *s;
  219. for (s = type->str; *s; s++)
  220. if (*s == '|') last_name = s+1;
  221. return last_name;
  222. }
  223. else
  224. return type->name;
  225. }
  226. /*
  227. Search for a swig_type_info structure
  228. */
  229. SWIGRUNTIME swig_type_info *
  230. SWIG_TypeQueryTL(swig_type_info *tl, const char *name) {
  231. swig_type_info *ty = tl;
  232. while (ty) {
  233. if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
  234. if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
  235. ty = ty->prev;
  236. }
  237. return 0;
  238. }
  239. /*
  240. Set the clientdata field for a type
  241. */
  242. SWIGRUNTIME void
  243. SWIG_TypeClientDataTL(swig_type_info *tl, swig_type_info *ti, void *clientdata) {
  244. swig_type_info *tc, *equiv;
  245. if (ti->clientdata) return;
  246. /* if (ti->clientdata == clientdata) return; */
  247. ti->clientdata = clientdata;
  248. equiv = ti->next;
  249. while (equiv) {
  250. if (!equiv->converter) {
  251. tc = tl;
  252. while (tc) {
  253. if ((strcmp(tc->name, equiv->name) == 0))
  254. SWIG_TypeClientDataTL(tl,tc,clientdata);
  255. tc = tc->prev;
  256. }
  257. }
  258. equiv = equiv->next;
  259. }
  260. }
  261. /*
  262. Pack binary data into a string
  263. */
  264. SWIGRUNTIME char *
  265. SWIG_PackData(char *c, void *ptr, size_t sz) {
  266. static char hex[17] = "0123456789abcdef";
  267. unsigned char *u = (unsigned char *) ptr;
  268. const unsigned char *eu = u + sz;
  269. register unsigned char uu;
  270. for (; u != eu; ++u) {
  271. uu = *u;
  272. *(c++) = hex[(uu & 0xf0) >> 4];
  273. *(c++) = hex[uu & 0xf];
  274. }
  275. return c;
  276. }
  277. /*
  278. Unpack binary data from a string
  279. */
  280. SWIGRUNTIME const char *
  281. SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  282. register unsigned char *u = (unsigned char *) ptr;
  283. register const unsigned char *eu = u + sz;
  284. for (; u != eu; ++u) {
  285. register int d = *(c++);
  286. register unsigned char uu = 0;
  287. if ((d >= '0') && (d <= '9'))
  288. uu = ((d - '0') << 4);
  289. else if ((d >= 'a') && (d <= 'f'))
  290. uu = ((d - ('a'-10)) << 4);
  291. else
  292. return (char *) 0;
  293. d = *(c++);
  294. if ((d >= '0') && (d <= '9'))
  295. uu |= (d - '0');
  296. else if ((d >= 'a') && (d <= 'f'))
  297. uu |= (d - ('a'-10));
  298. else
  299. return (char *) 0;
  300. *u = uu;
  301. }
  302. return c;
  303. }
  304. /*
  305. This function will propagate the clientdata field of type to any new
  306. swig_type_info structures that have been added into the list of
  307. equivalent types. It is like calling SWIG_TypeClientData(type,
  308. clientdata) a second time.
  309. */
  310. SWIGRUNTIME void
  311. SWIG_PropagateClientDataTL(swig_type_info *tl, swig_type_info *type) {
  312. swig_type_info *equiv = type->next;
  313. swig_type_info *tc;
  314. if (!type->clientdata) return;
  315. while (equiv) {
  316. if (!equiv->converter) {
  317. tc = tl;
  318. while (tc) {
  319. if ((strcmp(tc->name, equiv->name) == 0) && !tc->clientdata)
  320. SWIG_TypeClientDataTL(tl,tc, type->clientdata);
  321. tc = tc->prev;
  322. }
  323. }
  324. equiv = equiv->next;
  325. }
  326. }
  327. /*
  328. Pack 'void *' into a string buffer.
  329. */
  330. SWIGRUNTIME char *
  331. SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  332. char *r = buff;
  333. if ((2*sizeof(void *) + 2) > bsz) return 0;
  334. *(r++) = '_';
  335. r = SWIG_PackData(r,&ptr,sizeof(void *));
  336. if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  337. strcpy(r,name);
  338. return buff;
  339. }
  340. SWIGRUNTIME const char *
  341. SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  342. if (*c != '_') {
  343. if (strcmp(c,"NULL") == 0) {
  344. *ptr = (void *) 0;
  345. return name;
  346. } else {
  347. return 0;
  348. }
  349. }
  350. return SWIG_UnpackData(++c,ptr,sizeof(void *));
  351. }
  352. SWIGRUNTIME char *
  353. SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  354. char *r = buff;
  355. size_t lname = (name ? strlen(name) : 0);
  356. if ((2*sz + 2 + lname) > bsz) return 0;
  357. *(r++) = '_';
  358. r = SWIG_PackData(r,ptr,sz);
  359. if (lname) {
  360. strncpy(r,name,lname+1);
  361. } else {
  362. *r = 0;
  363. }
  364. return buff;
  365. }
  366. SWIGRUNTIME const char *
  367. SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  368. if (*c != '_') {
  369. if (strcmp(c,"NULL") == 0) {
  370. memset(ptr,0,sz);
  371. return name;
  372. } else {
  373. return 0;
  374. }
  375. }
  376. return SWIG_UnpackData(++c,ptr,sz);
  377. }
  378. #ifdef __cplusplus
  379. }
  380. #endif
  381. /***********************************************************************
  382. * common.swg
  383. *
  384. * This file contains generic SWIG runtime support for pointer
  385. * type checking as well as a few commonly used macros to control
  386. * external linkage.
  387. *
  388. * Author : David Beazley (beazley@cs.uchicago.edu)
  389. *
  390. * Copyright (c) 1999-2000, The University of Chicago
  391. *
  392. * This file may be freely redistributed without license or fee provided
  393. * this copyright message remains intact.
  394. ************************************************************************/
  395. #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  396. # if !defined(STATIC_LINKED)
  397. # define SWIGEXPORT(a) __declspec(dllexport) a
  398. # else
  399. # define SWIGEXPORT(a) a
  400. # endif
  401. #else
  402. # define SWIGEXPORT(a) a
  403. #endif
  404. #ifdef __cplusplus
  405. extern "C" {
  406. #endif
  407. /*************************************************************************/
  408. /* The static type info list */
  409. static swig_type_info *swig_type_list = 0;
  410. static swig_type_info **swig_type_list_handle = &swig_type_list;
  411. /* Register a type mapping with the type-checking */
  412. static swig_type_info *
  413. SWIG_TypeRegister(swig_type_info *ti) {
  414. return SWIG_TypeRegisterTL(swig_type_list_handle, ti);
  415. }
  416. /* Search for a swig_type_info structure */
  417. static swig_type_info *
  418. SWIG_TypeQuery(const char *name) {
  419. return SWIG_TypeQueryTL(*swig_type_list_handle, name);
  420. }
  421. /* Set the clientdata field for a type */
  422. static void
  423. SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  424. SWIG_TypeClientDataTL(*swig_type_list_handle, ti, clientdata);
  425. }
  426. /* This function will propagate the clientdata field of type to
  427. * any new swig_type_info structures that have been added into the list
  428. * of equivalent types. It is like calling
  429. * SWIG_TypeClientData(type, clientdata) a second time.
  430. */
  431. static void
  432. SWIG_PropagateClientData(swig_type_info *type) {
  433. SWIG_PropagateClientDataTL(*swig_type_list_handle, type);
  434. }
  435. #ifdef __cplusplus
  436. }
  437. #endif
  438. /* -----------------------------------------------------------------------------
  439. * SWIG API. Portion that goes into the runtime
  440. * ----------------------------------------------------------------------------- */
  441. #ifdef __cplusplus
  442. extern "C" {
  443. #endif
  444. /* -----------------------------------------------------------------------------
  445. * for internal method declarations
  446. * ----------------------------------------------------------------------------- */
  447. #ifndef SWIGINTERN
  448. #define SWIGINTERN static
  449. #endif
  450. #ifndef SWIGINTERNSHORT
  451. #ifdef __cplusplus
  452. #define SWIGINTERNSHORT static inline
  453. #else /* C case */
  454. #define SWIGINTERNSHORT static
  455. #endif /* __cplusplus */
  456. #endif
  457. /*
  458. Exception handling in wrappers
  459. */
  460. #define SWIG_fail goto fail
  461. #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
  462. #define SWIG_append_errmsg(msg) SWIG_Python_AddErrMesg(msg,0)
  463. #define SWIG_preppend_errmsg(msg) SWIG_Python_AddErrMesg(msg,1)
  464. #define SWIG_type_error(type,obj) SWIG_Python_TypeError(type,obj)
  465. #define SWIG_null_ref(type) SWIG_Python_NullRef(type)
  466. /*
  467. Contract support
  468. */
  469. #define SWIG_contract_assert(expr, msg) \
  470. if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
  471. /* -----------------------------------------------------------------------------
  472. * Constant declarations
  473. * ----------------------------------------------------------------------------- */
  474. /* Constant Types */
  475. #define SWIG_PY_INT 1
  476. #define SWIG_PY_FLOAT 2
  477. #define SWIG_PY_STRING 3
  478. #define SWIG_PY_POINTER 4
  479. #define SWIG_PY_BINARY 5
  480. /* Constant information structure */
  481. typedef struct swig_const_info {
  482. int type;
  483. char *name;
  484. long lvalue;
  485. double dvalue;
  486. void *pvalue;
  487. swig_type_info **ptype;
  488. } swig_const_info;
  489. /* -----------------------------------------------------------------------------
  490. * Alloc. memory flags
  491. * ----------------------------------------------------------------------------- */
  492. #define SWIG_OLDOBJ 1
  493. #define SWIG_NEWOBJ SWIG_OLDOBJ + 1
  494. #define SWIG_PYSTR SWIG_NEWOBJ + 1
  495. #ifdef __cplusplus
  496. }
  497. #endif
  498. /***********************************************************************
  499. * pyrun.swg
  500. *
  501. * This file contains the runtime support for Python modules
  502. * and includes code for managing global variables and pointer
  503. * type checking.
  504. *
  505. * Author : David Beazley (beazley@cs.uchicago.edu)
  506. ************************************************************************/
  507. /* Common SWIG API */
  508. #define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Python_ConvertPtr(obj, pp, type, flags)
  509. #define SWIG_NewPointerObj(p, type, flags) SWIG_Python_NewPointerObj(p, type, flags)
  510. #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
  511. /* Python-specific SWIG API */
  512. #define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
  513. #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
  514. /* -----------------------------------------------------------------------------
  515. * Pointer declarations
  516. * ----------------------------------------------------------------------------- */
  517. /*
  518. Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
  519. C/C++ pointers in the python side. Very useful for debugging, but
  520. not always safe.
  521. */
  522. #if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES)
  523. # define SWIG_COBJECT_TYPES
  524. #endif
  525. /* Flags for pointer conversion */
  526. #define SWIG_POINTER_EXCEPTION 0x1
  527. #define SWIG_POINTER_DISOWN 0x2
  528. #ifdef __cplusplus
  529. extern "C" {
  530. #endif
  531. /* -----------------------------------------------------------------------------
  532. * Create a new pointer string
  533. * ----------------------------------------------------------------------------- */
  534. #ifndef SWIG_BUFFER_SIZE
  535. #define SWIG_BUFFER_SIZE 1024
  536. #endif
  537. #if defined(SWIG_COBJECT_TYPES)
  538. #if !defined(SWIG_COBJECT_PYTHON)
  539. /* -----------------------------------------------------------------------------
  540. * Implements a simple Swig Object type, and use it instead of PyCObject
  541. * ----------------------------------------------------------------------------- */
  542. typedef struct {
  543. PyObject_HEAD
  544. void *ptr;
  545. const char *desc;
  546. } PySwigObject;
  547. /* Declarations for objects of type PySwigObject */
  548. SWIGRUNTIME int
  549. PySwigObject_print(PySwigObject *v, FILE *fp, int flags)
  550. {
  551. char result[SWIG_BUFFER_SIZE];
  552. if (SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result))) {
  553. fputs("<Swig Object at ", fp); fputs(result, fp); fputs(">", fp);
  554. return 0;
  555. } else {
  556. return 1;
  557. }
  558. }
  559. SWIGRUNTIME PyObject *
  560. PySwigObject_repr(PySwigObject *v)
  561. {
  562. char result[SWIG_BUFFER_SIZE];
  563. return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ?
  564. PyString_FromFormat("<Swig Object at %s>", result) : 0;
  565. }
  566. SWIGRUNTIME PyObject *
  567. PySwigObject_str(PySwigObject *v)
  568. {
  569. char result[SWIG_BUFFER_SIZE];
  570. return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ?
  571. PyString_FromString(result) : 0;
  572. }
  573. SWIGRUNTIME PyObject *
  574. PySwigObject_long(PySwigObject *v)
  575. {
  576. return PyLong_FromUnsignedLong((unsigned long) v->ptr);
  577. }
  578. SWIGRUNTIME PyObject *
  579. PySwigObject_oct(PySwigObject *v)
  580. {
  581. char buf[100];
  582. unsigned long x = (unsigned long)v->ptr;
  583. if (x == 0)
  584. strcpy(buf, "0");
  585. else
  586. PyOS_snprintf(buf, sizeof(buf), "0%lo", x);
  587. return PyString_FromString(buf);
  588. }
  589. SWIGRUNTIME PyObject *
  590. PySwigObject_hex(PySwigObject *v)
  591. {
  592. char buf[100];
  593. PyOS_snprintf(buf, sizeof(buf), "0x%lx", (unsigned long)v->ptr);
  594. return PyString_FromString(buf);
  595. }
  596. SWIGRUNTIME int
  597. PySwigObject_compare(PySwigObject *v, PySwigObject *w)
  598. {
  599. int c = strcmp(v->desc, w->desc);
  600. if (c) {
  601. return c;
  602. } else {
  603. void *i = v->ptr;
  604. void *j = w->ptr;
  605. return (i < j) ? -1 : (i > j) ? 1 : 0;
  606. }
  607. }
  608. SWIGRUNTIME void
  609. PySwigObject_dealloc(PySwigObject *self)
  610. {
  611. PyObject_DEL(self);
  612. }
  613. SWIGRUNTIME PyTypeObject*
  614. PySwigObject_GetType() {
  615. static char PySwigObject_Type__doc__[] =
  616. "Swig object carries a C/C++ instance pointer";
  617. static PyNumberMethods PySwigObject_as_number = {
  618. (binaryfunc)0, /*nb_add*/
  619. (binaryfunc)0, /*nb_subtract*/
  620. (binaryfunc)0, /*nb_multiply*/
  621. (binaryfunc)0, /*nb_divide*/
  622. (binaryfunc)0, /*nb_remainder*/
  623. (binaryfunc)0, /*nb_divmod*/
  624. (ternaryfunc)0,/*nb_power*/
  625. (unaryfunc)0, /*nb_negative*/
  626. (unaryfunc)0, /*nb_positive*/
  627. (unaryfunc)0, /*nb_absolute*/
  628. (inquiry)0, /*nb_nonzero*/
  629. 0, /*nb_invert*/
  630. 0, /*nb_lshift*/
  631. 0, /*nb_rshift*/
  632. 0, /*nb_and*/
  633. 0, /*nb_xor*/
  634. 0, /*nb_or*/
  635. (coercion)0, /*nb_coerce*/
  636. (unaryfunc)PySwigObject_long, /*nb_int*/
  637. (unaryfunc)PySwigObject_long, /*nb_long*/
  638. (unaryfunc)0, /*nb_float*/
  639. (unaryfunc)PySwigObject_oct, /*nb_oct*/
  640. (unaryfunc)PySwigObject_hex, /*nb_hex*/
  641. #if PY_VERSION_HEX >= 0x02000000
  642. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
  643. #endif
  644. };
  645. static int type_init = 0;
  646. static PyTypeObject PySwigObject_Type;
  647. if (!type_init) {
  648. PyTypeObject tmp = {
  649. PyObject_HEAD_INIT(&PyType_Type)
  650. 0, /*ob_size*/
  651. "PySwigObject", /*tp_name*/
  652. sizeof(PySwigObject), /*tp_basicsize*/
  653. 0, /*tp_itemsize*/
  654. /* methods */
  655. (destructor)PySwigObject_dealloc, /*tp_dealloc*/
  656. (printfunc)PySwigObject_print, /*tp_print*/
  657. (getattrfunc)0, /*tp_getattr*/
  658. (setattrfunc)0, /*tp_setattr*/
  659. (cmpfunc)PySwigObject_compare, /*tp_compare*/
  660. (reprfunc)PySwigObject_repr, /*tp_repr*/
  661. &PySwigObject_as_number, /*tp_as_number*/
  662. 0, /*tp_as_sequence*/
  663. 0, /*tp_as_mapping*/
  664. (hashfunc)0, /*tp_hash*/
  665. (ternaryfunc)0, /*tp_call*/
  666. (reprfunc)PySwigObject_str, /*tp_str*/
  667. /* Space for future expansion */
  668. 0L,0L,0L,0L,
  669. PySwigObject_Type__doc__, /* Documentation string */
  670. #if PY_VERSION_HEX >= 0x02000000
  671. 0, /* tp_traverse */
  672. 0, /* tp_clear */
  673. #endif
  674. #if PY_VERSION_HEX >= 0x02010000
  675. 0, /* tp_richcompare */
  676. 0, /* tp_weaklistoffset */
  677. #endif
  678. #if PY_VERSION_HEX >= 0x02020000
  679. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
  680. #endif
  681. #if PY_VERSION_HEX >= 0x02030000
  682. 0, /* tp_del */
  683. #endif
  684. #ifdef COUNT_ALLOCS
  685. 0,0,0,0 /* tp_alloc -> tp_next */
  686. #endif
  687. };
  688. PySwigObject_Type = tmp;
  689. type_init = 1;
  690. }
  691. return &PySwigObject_Type;
  692. }
  693. SWIGRUNTIME PyObject *
  694. PySwigObject_FromVoidPtrAndDesc(void *ptr, const char *desc)
  695. {
  696. PySwigObject *self = PyObject_NEW(PySwigObject, PySwigObject_GetType());
  697. if (self == NULL) return NULL;
  698. self->ptr = ptr;
  699. self->desc = desc;
  700. return (PyObject *)self;
  701. }
  702. SWIGRUNTIMEINLINE void *
  703. PySwigObject_AsVoidPtr(PyObject *self)
  704. {
  705. return ((PySwigObject *)self)->ptr;
  706. }
  707. SWIGRUNTIMEINLINE const char *
  708. PySwigObject_GetDesc(PyObject *self)
  709. {
  710. return ((PySwigObject *)self)->desc;
  711. }
  712. SWIGRUNTIMEINLINE int
  713. PySwigObject_Check(PyObject *op) {
  714. return ((op)->ob_type == PySwigObject_GetType())
  715. || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
  716. }
  717. /* -----------------------------------------------------------------------------
  718. * Implements a simple Swig Packed type, and use it instead of string
  719. * ----------------------------------------------------------------------------- */
  720. typedef struct {
  721. PyObject_HEAD
  722. void *pack;
  723. const char *desc;
  724. size_t size;
  725. } PySwigPacked;
  726. SWIGRUNTIME int
  727. PySwigPacked_print(PySwigPacked *v, FILE *fp, int flags)
  728. {
  729. char result[SWIG_BUFFER_SIZE];
  730. fputs("<Swig Packed ", fp);
  731. if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
  732. fputs("at ", fp);
  733. fputs(result, fp);
  734. }
  735. fputs(v->desc,fp);
  736. fputs(">", fp);
  737. return 0;
  738. }
  739. SWIGRUNTIME PyObject *
  740. PySwigPacked_repr(PySwigPacked *v)
  741. {
  742. char result[SWIG_BUFFER_SIZE];
  743. if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
  744. return PyString_FromFormat("<Swig Packed at %s%s>", result, v->desc);
  745. } else {
  746. return PyString_FromFormat("<Swig Packed %s>", v->desc);
  747. }
  748. }
  749. SWIGRUNTIME PyObject *
  750. PySwigPacked_str(PySwigPacked *v)
  751. {
  752. char result[SWIG_BUFFER_SIZE];
  753. if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
  754. return PyString_FromFormat("%s%s", result, v->desc);
  755. } else {
  756. return PyString_FromFormat("%s", v->desc);
  757. }
  758. }
  759. SWIGRUNTIME int
  760. PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
  761. {
  762. int c = strcmp(v->desc, w->desc);
  763. if (c) {
  764. return c;
  765. } else {
  766. size_t i = v->size;
  767. size_t j = w->size;
  768. int s = (i < j) ? -1 : (i > j) ? 1 : 0;
  769. return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
  770. }
  771. }
  772. SWIGRUNTIME void
  773. PySwigPacked_dealloc(PySwigPacked *self)
  774. {
  775. free(self->pack);
  776. PyObject_DEL(self);
  777. }
  778. SWIGRUNTIME PyTypeObject*
  779. PySwigPacked_GetType() {
  780. static char PySwigPacked_Type__doc__[] =
  781. "Swig object carries a C/C++ instance pointer";
  782. static int type_init = 0;
  783. static PyTypeObject PySwigPacked_Type;
  784. if (!type_init) {
  785. PyTypeObject tmp = {
  786. PyObject_HEAD_INIT(&PyType_Type)
  787. 0, /*ob_size*/
  788. "PySwigPacked", /*tp_name*/
  789. sizeof(PySwigPacked), /*tp_basicsize*/
  790. 0, /*tp_itemsize*/
  791. /* methods */
  792. (destructor)PySwigPacked_dealloc, /*tp_dealloc*/
  793. (printfunc)PySwigPacked_print, /*tp_print*/
  794. (getattrfunc)0, /*tp_getattr*/
  795. (setattrfunc)0, /*tp_setattr*/
  796. (cmpfunc)PySwigPacked_compare, /*tp_compare*/
  797. (reprfunc)PySwigPacked_repr, /*tp_repr*/
  798. 0, /*tp_as_number*/
  799. 0, /*tp_as_sequence*/
  800. 0, /*tp_as_mapping*/
  801. (hashfunc)0, /*tp_hash*/
  802. (ternaryfunc)0, /*tp_call*/
  803. (reprfunc)PySwigPacked_str, /*tp_str*/
  804. /* Space for future expansion */
  805. 0L,0L,0L,0L,
  806. PySwigPacked_Type__doc__, /* Documentation string */
  807. #if PY_VERSION_HEX >= 0x02000000
  808. 0, /* tp_traverse */
  809. 0, /* tp_clear */
  810. #endif
  811. #if PY_VERSION_HEX >= 0x02010000
  812. 0, /* tp_richcompare */
  813. 0, /* tp_weaklistoffset */
  814. #endif
  815. #if PY_VERSION_HEX >= 0x02020000
  816. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
  817. #endif
  818. #if PY_VERSION_HEX >= 0x02030000
  819. 0, /* tp_del */
  820. #endif
  821. #ifdef COUNT_ALLOCS
  822. 0,0,0,0 /* tp_alloc -> tp_next */
  823. #endif
  824. };
  825. PySwigPacked_Type = tmp;
  826. type_init = 1;
  827. }
  828. return &PySwigPacked_Type;
  829. }
  830. SWIGRUNTIME PyObject *
  831. PySwigPacked_FromDataAndDesc(void *ptr, size_t size, const char *desc)
  832. {
  833. PySwigPacked *self = PyObject_NEW(PySwigPacked, PySwigPacked_GetType());
  834. if (self == NULL) {
  835. return NULL;
  836. } else {
  837. void *pack = malloc(size);
  838. memcpy(pack, ptr, size);
  839. self->pack = pack;
  840. self->desc = desc;
  841. self->size = size;
  842. return (PyObject *) self;
  843. }
  844. }
  845. SWIGRUNTIMEINLINE const char *
  846. PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
  847. {
  848. PySwigPacked *self = (PySwigPacked *)obj;
  849. if (self->size != size) return 0;
  850. memcpy(ptr, self->pack, size);
  851. return self->desc;
  852. }
  853. SWIGRUNTIMEINLINE const char *
  854. PySwigPacked_GetDesc(PyObject *self)
  855. {
  856. return ((PySwigPacked *)self)->desc;
  857. }
  858. SWIGRUNTIMEINLINE int
  859. PySwigPacked_Check(PyObject *op) {
  860. return ((op)->ob_type == PySwigPacked_GetType())
  861. || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
  862. }
  863. #else
  864. /* -----------------------------------------------------------------------------
  865. * Use the old Python PyCObject instead of PySwigObject
  866. * ----------------------------------------------------------------------------- */
  867. #define PySwigObject_GetDesc(obj) PyCObject_GetDesc(obj)
  868. #define PySwigObject_Check(obj) PyCObject_Check(obj)
  869. #define PySwigObject_AsVoidPtr(obj) PyCObject_AsVoidPtr(obj)
  870. #define PySwigObject_FromVoidPtrAndDesc(p, d) PyCObject_FromVoidPtrAndDesc(p, d, NULL)
  871. #endif
  872. #endif
  873. /* -----------------------------------------------------------------------------
  874. * errors manipulation
  875. * ----------------------------------------------------------------------------- */
  876. SWIGRUNTIME void
  877. SWIG_Python_TypeError(const char *type, PyObject *obj)
  878. {
  879. if (type) {
  880. #if defined(SWIG_COBJECT_TYPES)
  881. if (PySwigObject_Check(obj)) {
  882. const char *otype = (const char *) PySwigObject_GetDesc(obj);
  883. if (otype) {
  884. PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
  885. type, otype);
  886. return;
  887. }
  888. } else
  889. #endif
  890. {
  891. const char *otype = (obj ? obj->ob_type->tp_name : 0);
  892. if (otype) {
  893. PyObject *str = PyObject_Str(obj);
  894. const char *cstr = str ? PyString_AsString(str) : 0;
  895. if (cstr) {
  896. PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
  897. type, otype, cstr);
  898. } else {
  899. PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
  900. type, otype);
  901. }
  902. Py_DECREF(str);
  903. return;
  904. }
  905. }
  906. PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
  907. } else {
  908. PyErr_Format(PyExc_TypeError, "unexpected type is received");
  909. }
  910. }
  911. SWIGRUNTIMEINLINE void
  912. SWIG_Python_NullRef(const char *type)
  913. {
  914. if (type) {
  915. PyErr_Format(PyExc_TypeError, "null reference of type '%s' was received",type);
  916. } else {
  917. PyErr_Format(PyExc_TypeError, "null reference was received");
  918. }
  919. }
  920. SWIGRUNTIME int
  921. SWIG_Python_AddErrMesg(const char* mesg, int infront)
  922. {
  923. if (PyErr_Occurred()) {
  924. PyObject *type = 0;
  925. PyObject *value = 0;
  926. PyObject *traceback = 0;
  927. PyErr_Fetch(&type, &value, &traceback);
  928. if (value) {
  929. PyObject *old_str = PyObject_Str(value);
  930. Py_XINCREF(type);
  931. PyErr_Clear();
  932. if (infront) {
  933. PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
  934. } else {
  935. PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
  936. }
  937. Py_DECREF(old_str);
  938. }
  939. return 1;
  940. } else {
  941. return 0;
  942. }
  943. }
  944. SWIGRUNTIME int
  945. SWIG_Python_ArgFail(int argnum)
  946. {
  947. if (PyErr_Occurred()) {
  948. /* add information about failing argument */
  949. char mesg[256];
  950. sprintf(mesg, "argument number %d:", argnum);
  951. return SWIG_Python_AddErrMesg(mesg, 1);
  952. } else {
  953. return 0;
  954. }
  955. }
  956. /* -----------------------------------------------------------------------------
  957. * pointers/data manipulation
  958. * ----------------------------------------------------------------------------- */
  959. /* Convert a pointer value */
  960. SWIGRUNTIME int
  961. SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
  962. swig_type_info *tc;
  963. const char *c = 0;
  964. static PyObject *SWIG_this = 0;
  965. int newref = 0;
  966. PyObject *pyobj = 0;
  967. void *vptr;
  968. if (!obj) return 0;
  969. if (obj == Py_None) {
  970. *ptr = 0;
  971. return 0;
  972. }
  973. #ifdef SWIG_COBJECT_TYPES
  974. if (!(PySwigObject_Check(obj))) {
  975. if (!SWIG_this)
  976. SWIG_this = PyString_FromString("this");
  977. pyobj = obj;
  978. obj = PyObject_GetAttr(obj,SWIG_this);
  979. newref = 1;
  980. if (!obj) goto type_error;
  981. if (!PySwigObject_Check(obj)) {
  982. Py_DECREF(obj);
  983. goto type_error;
  984. }
  985. }
  986. vptr = PySwigObject_AsVoidPtr(obj);
  987. c = (const char *) PySwigObject_GetDesc(obj);
  988. if (newref) { Py_DECREF(obj); }
  989. goto type_check;
  990. #else
  991. if (!(PyString_Check(obj))) {
  992. if (!SWIG_this)
  993. SWIG_this = PyString_FromString("this");
  994. pyobj = obj;
  995. obj = PyObject_GetAttr(obj,SWIG_this);
  996. newref = 1;
  997. if (!obj) goto type_error;
  998. if (!PyString_Check(obj)) {
  999. Py_DECREF(obj);
  1000. goto type_error;
  1001. }
  1002. }
  1003. c = PyString_AS_STRING(obj);
  1004. /* Pointer values must start with leading underscore */
  1005. c = SWIG_UnpackVoidPtr(c, &vptr, ty->name);
  1006. if (newref) { Py_DECREF(obj); }
  1007. if (!c) goto type_error;
  1008. #endif
  1009. type_check:
  1010. if (ty) {
  1011. tc = SWIG_TypeCheck(c,ty);
  1012. if (!tc) goto type_error;
  1013. *ptr = SWIG_TypeCast(tc,vptr);
  1014. } else {
  1015. *ptr = vptr;
  1016. }
  1017. if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
  1018. PyObject_SetAttrString(pyobj,(char*)"thisown",Py_False);
  1019. }
  1020. return 0;
  1021. type_error:
  1022. PyErr_Clear();
  1023. if (pyobj && !obj) {
  1024. obj = pyobj;
  1025. if (PyCFunction_Check(obj)) {
  1026. /* here we get the method pointer for callbacks */
  1027. char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
  1028. c = doc ? strstr(doc, "swig_ptr: ") : 0;
  1029. if (c) {
  1030. c = SWIG_UnpackVoidPtr(c + 10, &vptr, ty->name);
  1031. if (!c) goto type_error;
  1032. goto type_check;
  1033. }
  1034. }
  1035. }
  1036. if (flags & SWIG_POINTER_EXCEPTION) {
  1037. if (ty) {
  1038. SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
  1039. } else {
  1040. SWIG_Python_TypeError("C/C++ pointer", obj);
  1041. }
  1042. }
  1043. return -1;
  1044. }
  1045. /* Convert a pointer value, signal an exception on a type mismatch */
  1046. SWIGRUNTIME void *
  1047. SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
  1048. void *result;
  1049. if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
  1050. PyErr_Clear();
  1051. if (flags & SWIG_POINTER_EXCEPTION) {
  1052. SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
  1053. SWIG_Python_ArgFail(argnum);
  1054. }
  1055. }
  1056. return result;
  1057. }
  1058. /* Convert a packed value value */
  1059. SWIGRUNTIME int
  1060. SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty, int flags) {
  1061. swig_type_info *tc;
  1062. const char *c = 0;
  1063. #if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON)
  1064. c = PySwigPacked_UnpackData(obj, ptr, sz);
  1065. #else
  1066. if ((!obj) || (!PyString_Check(obj))) goto type_error;
  1067. c = PyString_AS_STRING(obj);
  1068. /* Pointer values must start with leading underscore */
  1069. c = SWIG_UnpackDataName(c, ptr, sz, ty->name);
  1070. #endif
  1071. if (!c) goto type_error;
  1072. if (ty) {
  1073. tc = SWIG_TypeCheck(c,ty);
  1074. if (!tc) goto type_error;
  1075. }
  1076. return 0;
  1077. type_error:
  1078. PyErr_Clear();
  1079. if (flags & SWIG_POINTER_EXCEPTION) {
  1080. if (ty) {
  1081. SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
  1082. } else {
  1083. SWIG_Python_TypeError("C/C++ packed data", obj);
  1084. }
  1085. }
  1086. return -1;
  1087. }
  1088. /* Create a new array object */
  1089. SWIGRUNTIME PyObject *
  1090. SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) {
  1091. PyObject *robj = 0;
  1092. if (!ptr) {
  1093. Py_INCREF(Py_None);
  1094. return Py_None;
  1095. }
  1096. #ifdef SWIG_COBJECT_TYPES
  1097. robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)type->name);
  1098. #else
  1099. {
  1100. char result[SWIG_BUFFER_SIZE];
  1101. robj = SWIG_PackVoidPtr(result, ptr, type->name, sizeof(result)) ?
  1102. PyString_FromString(result) : 0;
  1103. }
  1104. #endif
  1105. if (!robj || (robj == Py_None)) return robj;
  1106. if (type->clientdata) {
  1107. PyObject *inst;
  1108. PyObject *args = Py_BuildValue((char*)"(O)", robj);
  1109. Py_DECREF(robj);
  1110. inst = PyObject_CallObject((PyObject *) type->clientdata, args);
  1111. Py_DECREF(args);
  1112. if (inst) {
  1113. if (own) {
  1114. PyObject_SetAttrString(inst,(char*)"thisown",Py_True);
  1115. }
  1116. robj = inst;
  1117. }
  1118. }
  1119. return robj;
  1120. }
  1121. SWIGRUNTIME PyObject *
  1122. SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
  1123. PyObject *robj = 0;
  1124. if (!ptr) {
  1125. Py_INCREF(Py_None);
  1126. return Py_None;
  1127. }
  1128. #if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON)
  1129. robj = PySwigPacked_FromDataAndDesc((void *) ptr, sz, (char *)type->name);
  1130. #else
  1131. {
  1132. char result[SWIG_BUFFER_SIZE];
  1133. robj = SWIG_PackDataName(result, ptr, sz, type->name, sizeof(result)) ?
  1134. PyString_FromString(result) : 0;
  1135. }
  1136. #endif
  1137. return robj;
  1138. }
  1139. /* -----------------------------------------------------------------------------*
  1140. * Get type list
  1141. * -----------------------------------------------------------------------------*/
  1142. #ifdef SWIG_LINK_RUNTIME
  1143. void *SWIG_ReturnGlobalTypeList(void *);
  1144. #endif
  1145. SWIGRUNTIME swig_type_info **
  1146. SWIG_Python_GetTypeListHandle() {
  1147. static void *type_pointer = (void *)0;
  1148. /* first check if module already created */
  1149. if (!type_pointer) {
  1150. #ifdef SWIG_LINK_RUNTIME
  1151. type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
  1152. #else
  1153. type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
  1154. (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
  1155. if (PyErr_Occurred()) {
  1156. PyErr_Clear();
  1157. type_pointer = (void *)0;
  1158. }
  1159. }
  1160. #endif
  1161. return (swig_type_info **) type_pointer;
  1162. }
  1163. /*
  1164. Search for a swig_type_info structure
  1165. */
  1166. SWIGRUNTIMEINLINE swig_type_info *
  1167. SWIG_Python_GetTypeList() {
  1168. swig_type_info **tlh = SWIG_Python_GetTypeListHandle();
  1169. return tlh ? *tlh : (swig_type_info*)0;
  1170. }
  1171. #define SWIG_Runtime_GetTypeList SWIG_Python_GetTypeList
  1172. #ifdef __cplusplus
  1173. }
  1174. #endif
  1175. /* -------- TYPES TABLE (BEGIN) -------- */
  1176. #define SWIGTYPE_p_XCC_SESS swig_types[0]
  1177. #define SWIGTYPE_p_XCC_REQ swig_types[1]
  1178. #define SWIGTYPE_p_XCC_ITEM swig_types[2]
  1179. #define SWIGTYPE_p_XCC_CONTENT swig_types[3]
  1180. #define SWIGTYPE_p_char swig_types[4]
  1181. #define SWIGTYPE_p_XCC_RES swig_types[5]
  1182. #define SWIGTYPE_size_t swig_types[6]
  1183. #define SWIGTYPE_ptrdiff_t swig_types[7]
  1184. static swig_type_info *swig_types[9];
  1185. /* -------- TYPES TABLE (END) -------- */
  1186. /*-----------------------------------------------
  1187. @(target):= _xcc.so
  1188. ------------------------------------------------*/
  1189. #define SWIG_init init_xcc
  1190. #define SWIG_name "_xcc"
  1191. #include <marklogic/xcc.h>
  1192. static const char *_xcc_error_message = NULL;
  1193. static XCC_ERROR_CODE _xcc_error_code = 0;
  1194. void set_exception(const char *msg, XCC_ERROR_CODE error_code) {
  1195. _xcc_error_message = msg;
  1196. _xcc_error_code = error_code;
  1197. }
  1198. void clear_exception() {
  1199. _xcc_error_code = 0;
  1200. _xcc_error_message = NULL;
  1201. }
  1202. void throw_exception() {
  1203. PyObject *e, *emod, *edict;
  1204. if(!(emod = PyImport_ImportModule("xcc"))) return;
  1205. if(!(edict = PyModule_GetDict(emod))) return;
  1206. if(XCC_ERROR_XQUERY == _xcc_error_code) {
  1207. if(!(e = PyDict_GetItemString(edict, "XQueryError"))) return;
  1208. } else {
  1209. if(!(e = PyDict_GetItemString(edict, "Error"))) return;
  1210. }
  1211. PyObject_SetAttrString(e, "code", PyInt_FromLong((long)_xcc_error_code));
  1212. PyObject_SetAttrString(e, "message", PyString_FromString(_xcc_error_message));
  1213. PyErr_SetObject(e, e);
  1214. }
  1215. #define XccError(num, msg) \
  1216. set_exception(msg, num);
  1217. #define XccErrorXQuery(error_xml) \
  1218. set_exception(error_xml, XCC_ERROR_XQUERY);
  1219. /*@/usr/share/swig1.3/python/pymacros.swg,66,SWIG_define@*/
  1220. #define SWIG_From_int PyInt_FromLong
  1221. /*@@*/
  1222. /* returns SWIG_OLDOBJ if the input is a raw char*, SWIG_PYSTR if is a PyString */
  1223. SWIGINTERN int
  1224. SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize)
  1225. {
  1226. static swig_type_info* pchar_info = 0;
  1227. char* vptr = 0;
  1228. if (!pchar_info) pchar_info = SWIG_TypeQuery("char *");
  1229. if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_info, 0) != -1) {
  1230. if (cptr) *cptr = vptr;
  1231. if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
  1232. return SWIG_OLDOBJ;
  1233. } else {
  1234. PyErr_Clear();
  1235. if (PyString_Check(obj)) {
  1236. if (cptr) {
  1237. *cptr = PyString_AS_STRING(obj);
  1238. if (psize) {
  1239. *psize = PyString_GET_SIZE(obj) + 1;
  1240. }
  1241. }
  1242. return SWIG_PYSTR;
  1243. }
  1244. }
  1245. if (cptr) {
  1246. SWIG_type_error("char *", obj);
  1247. }
  1248. return 0;
  1249. }
  1250. SWIGINTERNSHORT int
  1251. SWIG_AsCharPtr(PyObject *obj, char **val)
  1252. {
  1253. if (SWIG_AsCharPtrAndSize(obj, val, (size_t*)(0))) {
  1254. return 1;
  1255. }
  1256. if (val) {
  1257. PyErr_Clear();
  1258. SWIG_type_error("char *", obj);
  1259. }
  1260. return 0;
  1261. }
  1262. #include <limits.h>
  1263. SWIGINTERN int
  1264. SWIG_CheckLongInRange(long value, long min_value, long max_value,
  1265. const char *errmsg)
  1266. {
  1267. if (value < min_value) {
  1268. if (errmsg) {
  1269. PyErr_Format(PyExc_OverflowError,
  1270. "value %ld is less than '%s' minimum %ld",
  1271. value, errmsg, min_value);
  1272. }
  1273. return 0;
  1274. } else if (value > max_value) {
  1275. if (errmsg) {
  1276. PyErr_Format(PyExc_OverflowError,
  1277. "value %ld is greater than '%s' maximum %ld",
  1278. value, errmsg, max_value);
  1279. }
  1280. return 0;
  1281. }
  1282. return 1;
  1283. }
  1284. SWIGINTERN int
  1285. SWIG_AsVal_long(PyObject * obj, long* val)
  1286. {
  1287. if (PyInt_Check(obj)) {
  1288. if (val) *val = PyInt_AS_LONG(obj);
  1289. return 1;
  1290. }
  1291. if (PyLong_Check(obj)) {
  1292. long v = PyLong_AsLong(obj);
  1293. if (!PyErr_Occurred()) {
  1294. if (val) *val = v;
  1295. return 1;
  1296. } else {
  1297. if (!val) PyErr_Clear();
  1298. return 0;
  1299. }
  1300. }
  1301. if (val) {
  1302. SWIG_type_error("long", obj);
  1303. }
  1304. return 0;
  1305. }
  1306. #if INT_MAX != LONG_MAX
  1307. SWIGINTERN int
  1308. SWIG_AsVal_int(PyObject *obj, int *val)
  1309. {
  1310. const char* errmsg = val ? "int" : (char*)0;
  1311. long v;
  1312. if (SWIG_AsVal_long(obj, &v)) {
  1313. if (SWIG_CheckLongInRange(v, INT_MIN,INT_MAX, errmsg)) {
  1314. if (val) *val = (int)(v);
  1315. return 1;
  1316. } else {
  1317. return 0;
  1318. }
  1319. } else {
  1320. PyErr_Clear();
  1321. }
  1322. if (val) {
  1323. SWIG_type_error(errmsg, obj);
  1324. }
  1325. return 0;
  1326. }
  1327. #else
  1328. SWIGINTERNSHORT int
  1329. SWIG_AsVal_int(PyObject *obj, int *val)
  1330. {
  1331. return SWIG_AsVal_long(obj,(long*)val);
  1332. }
  1333. #endif
  1334. SWIGINTERNSHORT int
  1335. SWIG_As_int(PyObject* obj)
  1336. {
  1337. int v;
  1338. if (!SWIG_AsVal_int(obj, &v)) {
  1339. /*
  1340. this is needed to make valgrind/purify happier.
  1341. */
  1342. memset((void*)&v, 0, sizeof(int));
  1343. }
  1344. return v;
  1345. }
  1346. SWIGINTERNSHORT int
  1347. SWIG_Check_int(PyObject* obj)
  1348. {
  1349. return SWIG_AsVal_int(obj, (int*)0);
  1350. }
  1351. static XCC_SESS *new_XCC_SESS(char const *user,char const *password,char const *host,char const *db,int port){
  1352. XCC_SESS *session = xcc_new_session(user, password, host, db, port);
  1353. if(!session) {
  1354. XccError(XCC_ERROR_CONNECTION, "Failed to create new session");
  1355. }
  1356. return session;
  1357. }
  1358. static void delete_XCC_SESS(XCC_SESS *self){
  1359. xcc_free_session(self);
  1360. }
  1361. static char const *XCC_SESS_server_info(XCC_SESS *self){
  1362. const char *info = xcc_server_info(self);
  1363. if(!info) return "";
  1364. return info;
  1365. }
  1366. SWIGINTERN PyObject *
  1367. SWIG_FromCharPtr(const char* cptr)
  1368. {
  1369. if (cptr) {
  1370. size_t size = strlen(cptr);
  1371. if (size > INT_MAX) {
  1372. return SWIG_NewPointerObj((char*)(cptr),
  1373. SWIG_TypeQuery("char *"), 0);
  1374. } else {
  1375. if (size != 0) {
  1376. return PyString_FromStringAndSize(cptr, size);
  1377. } else {
  1378. return PyString_FromString(cptr);
  1379. }
  1380. }
  1381. }
  1382. Py_INCREF(Py_None);
  1383. return Py_None;
  1384. }
  1385. static XCC_REQ *XCC_SESS_new_adhoc_query(XCC_SESS *self,char const *xquery){
  1386. XCC_REQ *request = xcc_new_adhoc_query(self, xquery);
  1387. if(!request) {
  1388. XccError(xcc_errcode(self), xcc_error(self));
  1389. }
  1390. return request;
  1391. }
  1392. static XCC_REQ *XCC_SESS_new_module_invoke(XCC_SESS *self,char const *module_name){
  1393. XCC_REQ *request = xcc_new_module_invoke(self, module_name);
  1394. if(!request) {
  1395. XccError(xcc_errcode(self), xcc_error(self));
  1396. }
  1397. return request;
  1398. }
  1399. static XCC_REQ *XCC_SESS_new_module_spawn(XCC_SESS *self,char const *module_name){
  1400. XCC_REQ *request = xcc_new_module_spawn(self, module_name);
  1401. if(!request) {
  1402. XccError(xcc_errcode(self), xcc_error(self));
  1403. }
  1404. return request;
  1405. }
  1406. static XCC_CONTENT *XCC_SESS_new_content(XCC_SESS *self){
  1407. XCC_CONTENT *content = xcc_new_content(self);
  1408. if(!content) {
  1409. XccError(xcc_errcode(self), xcc_error(self));
  1410. }
  1411. return content;
  1412. }
  1413. static XCC_RES *XCC_SESS_query(XCC_SESS *self,char const *xquery){
  1414. XCC_RES *result = xcc_query(self, xquery);
  1415. if(!result) {
  1416. XccError(xcc_errcode(self), xcc_error(self));
  1417. }
  1418. return result;
  1419. }
  1420. static XCC_RES *XCC_SESS_invoke(XCC_SESS *self,char const *module){
  1421. XCC_RES *result = xcc_invoke(self, module);
  1422. if(!result) {
  1423. XccError(xcc_errcode(self), xcc_error(self));
  1424. }
  1425. return result;
  1426. }
  1427. static XCC_RES *XCC_SESS_spawn(XCC_SESS *self,char const *module){
  1428. XCC_RES *result = xcc_spawn(self, module);
  1429. if(!result) {
  1430. XccError(xcc_errcode(self), xcc_error(self));
  1431. }
  1432. return result;
  1433. }
  1434. static XCC_REQ *new_XCC_REQ(){
  1435. XccError(XCC_ERROR_INVALID_ARG, "You can't create new Request objects. You must use methods from Session");
  1436. return NULL;
  1437. }
  1438. static void delete_XCC_REQ(XCC_REQ *self){
  1439. xcc_free_request(self);
  1440. }
  1441. static XCC_RES *XCC_REQ_submit(XCC_REQ *self){
  1442. XCC_RES *result = xcc_submit_request(self);
  1443. if(!result) {
  1444. if(XCC_ERROR_XQUERY == xcc_req_errcode(self)) {
  1445. XccErrorXQuery(xcc_req_error(self));
  1446. } else {
  1447. XccError(xcc_req_errcode(self), xcc_req_error(self));
  1448. }
  1449. }
  1450. return result;
  1451. }
  1452. static void XCC_REQ_set_bufsize(XCC_REQ *self,int size){
  1453. XCC_ERROR_CODE ret = xcc_request_setop(self, XCC_REQ_BUFSIZE, size);
  1454. if(ret != XCC_OK) {
  1455. XccError(ret, xcc_error_message(ret));
  1456. }
  1457. }
  1458. static void XCC_REQ_set_timeout(XCC_REQ *self,int seconds){
  1459. XCC_ERROR_CODE ret = xcc_request_setop(self, XCC_REQ_TIMEOUT, seconds);
  1460. if(ret != XCC_OK) {
  1461. XccError(ret, xcc_error_message(ret));
  1462. }
  1463. }
  1464. static void XCC_REQ_set_dbname(XCC_REQ *self,char const *name){
  1465. XCC_ERROR_CODE ret = xcc_request_setop(self, XCC_REQ_DBNAME, name);
  1466. if(ret != XCC_OK) {
  1467. XccError(ret, xcc_error_message(ret));
  1468. }
  1469. }
  1470. static void XCC_REQ_set_dbid(XCC_REQ *self,char const *id){
  1471. XCC_ERROR_CODE ret = xcc_request_setop(self, XCC_REQ_DBID, id);
  1472. if(ret != XCC_OK) {
  1473. XccError(ret, xcc_error_message(ret));
  1474. }
  1475. }
  1476. static void XCC_REQ_set_timestamp(XCC_REQ *self,char const *stamp){
  1477. XCC_ERROR_CODE ret = xcc_request_setop(self, XCC_REQ_TIMESTAMP, stamp);
  1478. if(ret != XCC_OK) {
  1479. XccError(ret, xcc_error_message(ret));
  1480. }
  1481. }
  1482. static void XCC_REQ_set_name(XCC_REQ *self,char const *name){
  1483. XCC_ERROR_CODE ret = xcc_request_setop(self, XCC_REQ_NAME, name);
  1484. if(ret != XCC_OK) {
  1485. XccError(ret, xcc_error_message(ret));
  1486. }
  1487. }
  1488. static void XCC_REQ_set_variable(XCC_REQ *self,int schema_type,char const *ns,char const *name,char const *value){
  1489. XCC_ERROR_CODE ret = xcc_setvar_generic(self, schema_type, ns, name, value);
  1490. if(ret != XCC_OK) {
  1491. XccError(ret, xcc_error_message(ret));
  1492. }
  1493. }
  1494. static XCC_RES *new_XCC_RES(){
  1495. XccError(XCC_ERROR_INVALID_ARG, "You can't create new Result objects. You must use call submit");
  1496. return NULL;
  1497. }
  1498. static void delete_XCC_RES(XCC_RES *self){
  1499. xcc_free_result(self);
  1500. }
  1501. static int XCC_RES_has_next(XCC_RES *self){
  1502. return xcc_has_next(self);
  1503. }
  1504. static XCC_ITEM *XCC_RES_next_item(XCC_RES *self){
  1505. return xcc_next_item(self);
  1506. }
  1507. static XCC_ITEM *new_XCC_ITEM(){
  1508. XccError(XCC_ERROR_INVALID_ARG, "You can't create new Item objects. You must use call Result.next_item()");
  1509. return NULL;
  1510. }
  1511. static void delete_XCC_ITEM(XCC_ITEM *self){
  1512. xcc_free_item(self);
  1513. }
  1514. static char const *XCC_ITEM_to_string(XCC_ITEM *self){
  1515. return xcc_as_string(self);
  1516. }
  1517. static double XCC_ITEM_to_double(XCC_ITEM *self){
  1518. return xcc_as_double(self);
  1519. }
  1520. /*@/usr/share/swig1.3/python/pymacros.swg,66,SWIG_define@*/
  1521. #define SWIG_From_double PyFloat_FromDouble
  1522. /*@@*/
  1523. static int XCC_ITEM_to_int(XCC_ITEM *self){
  1524. return xcc_as_int(self);
  1525. }
  1526. static XCC_SCHEMA_TYPE XCC_ITEM_type(XCC_ITEM *self){
  1527. return xcc_item_type(self);
  1528. }
  1529. static XCC_CONTENT *new_XCC_CONTENT(){
  1530. XccError(XCC_ERROR_INVALID_ARG, "You can't create new Content objects. You must use methods from Sesion");
  1531. return NULL;
  1532. }
  1533. static void delete_XCC_CONTENT(XCC_CONTENT *self){
  1534. xcc_free_content(self);
  1535. }
  1536. static void XCC_CONTENT_clear_collections(XCC_CONTENT *self){
  1537. xcc_clear_collections(self);
  1538. }
  1539. static void XCC_CONTENT_clear_permissions(XCC_CONTENT *self){
  1540. xcc_clear_permissions(self);
  1541. }
  1542. static void XCC_CONTENT_add_collection(XCC_CONTENT *self,char const *col){
  1543. XCC_ERROR_CODE ret = xcc_content_addcol(self, col);
  1544. if(ret != XCC_OK) {
  1545. XccError(ret, xcc_error_message(ret));
  1546. }
  1547. }
  1548. static void XCC_CONTENT_add_permission(XCC_CONTENT *self,int capability,char const *role){
  1549. XCC_ERROR_CODE ret = xcc_content_addperm(self, capability, role);
  1550. if(ret != XCC_OK) {
  1551. XccError(ret, xcc_error_message(ret));
  1552. }
  1553. }
  1554. static xcc_off_t XCC_CONTENT_insert(XCC_CONTENT *self){
  1555. xcc_off_t bytes = xcc_insert_content(self);
  1556. if(!bytes) {
  1557. XccError(xcc_content_errcode(self), xcc_content_error(self));
  1558. }
  1559. return bytes;
  1560. }
  1561. static void XCC_CONTENT_set_file_name(XCC_CONTENT *self,char const *fname){
  1562. XCC_ERROR_CODE ret = xcc_content_setop(self, XCC_CONTENT_OPT_FILE, fname);
  1563. if(ret != XCC_OK) {
  1564. XccError(ret, xcc_error_message(ret));
  1565. }
  1566. }
  1567. static void XCC_CONTENT_set_data(XCC_CONTENT *self,char const *str){
  1568. XCC_ERROR_CODE ret = xcc_content_setop(self, XCC_CONTENT_OPT_DATA, str, -1L);
  1569. if(ret != XCC_OK) {
  1570. XccError(ret, xcc_error_message(ret));
  1571. }
  1572. }
  1573. static void XCC_CONTENT_set_namespace(XCC_CONTENT *self,char const *ns){
  1574. XCC_ERROR_CODE ret = xcc_content_setop(self, XCC_CONTENT_OPT_NS, ns);
  1575. if(ret != XCC_OK) {
  1576. XccError(ret, xcc_error_message(ret));
  1577. }
  1578. }
  1579. static void XCC_CONTENT_set_uri(XCC_CONTENT *self,char const *uri){
  1580. XCC_ERROR_CODE ret = xcc_content_setop(self, XCC_CONTENT_OPT_URI, uri);
  1581. if(ret != XCC_OK) {
  1582. XccError(ret, xcc_error_message(ret));
  1583. }
  1584. }
  1585. static void XCC_CONTENT_set_timeout(XCC_CONTENT *self,int seconds){
  1586. XCC_ERROR_CODE ret = xcc_content_setop(self, XCC_CONTENT_OPT_TIMEOUT, seconds);
  1587. if(ret != XCC_OK) {
  1588. XccError(ret, xcc_error_message(ret));
  1589. }
  1590. }
  1591. static void XCC_CONTENT_set_format(XCC_CONTENT *self,int fmt){
  1592. XCC_ERROR_CODE ret = xcc_content_setop(self, XCC_CONTENT_OPT_FORMAT, fmt);
  1593. if(ret != XCC_OK) {
  1594. XccError(ret, xcc_error_message(ret));
  1595. }
  1596. }
  1597. static void XCC_CONTENT_set_repair(XCC_CONTENT *self,int rpr){
  1598. XCC_ERROR_CODE ret = xcc_content_setop(self, XCC_CONTENT_OPT_REPAIR, rpr);
  1599. if(ret != XCC_OK) {
  1600. XccError(ret, xcc_error_message(ret));
  1601. }
  1602. }
  1603. static void XCC_CONTENT_set_quality(XCC_CONTENT *self,int qlty){
  1604. XCC_ERROR_CODE ret = xcc_content_setop(self, XCC_CONTENT_OPT_QUALITY, qlty);
  1605. if(ret != XCC_OK) {
  1606. XccError(ret, xcc_error_message(ret));
  1607. }
  1608. }
  1609. #ifdef __cplusplus
  1610. extern "C" {
  1611. #endif
  1612. static PyObject *_wrap_new_Session(PyObject *self, PyObject *args) {
  1613. PyObject *resultobj;
  1614. char *arg1 = (char *) 0 ;
  1615. char *arg2 = (char *) 0 ;
  1616. char *arg3 = (char *) 0 ;
  1617. char *arg4 = (char *) 0 ;
  1618. int arg5 ;
  1619. XCC_SESS *result;
  1620. PyObject * obj0 = 0 ;
  1621. PyObject * obj1 = 0 ;
  1622. PyObject * obj2 = 0 ;
  1623. PyObject * obj3 = 0 ;
  1624. PyObject * obj4 = 0 ;
  1625. if(!PyArg_ParseTuple(args,(char *)"OOOOO:new_Session",&obj0,&obj1,&obj2,&obj3,&obj4)) goto fail;
  1626. if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) {
  1627. SWIG_arg_fail(1);SWIG_fail;
  1628. }
  1629. if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
  1630. SWIG_arg_fail(2);SWIG_fail;
  1631. }
  1632. if (!SWIG_AsCharPtr(obj2,

Large files files are truncated, but you can click here to view the full file