sidan-gin 0.1.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of sidan-gin might be problematic. Click here for more details.

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