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