| 1 | /* ---------------------------------------------------------------------------- |
| 2 | * This file was automatically generated by SWIG (https://www.swig.org). |
| 3 | * Version 4.2.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 0x040200 |
| 11 | #define SWIGPYTHON |
| 12 | #define SWIG_PYTHON_THREADS |
| 13 | #define SWIG_PYTHON_DIRECTOR_NO_VTABLE |
| 14 | |
| 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 __cplusplus >=201103L |
| 140 | # define SWIG_NULLPTR nullptr |
| 141 | #else |
| 142 | # define SWIG_NULLPTR NULL |
| 143 | #endif |
| 144 | |
| 145 | |
| 146 | #if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND) |
| 147 | /* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */ |
| 148 | # include <math.h> |
| 149 | #endif |
| 150 | |
| 151 | #if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN) |
| 152 | #define PY_SSIZE_T_CLEAN |
| 153 | #endif |
| 154 | |
| 155 | #if __GNUC__ >= 7 |
| 156 | #pragma GCC diagnostic push |
| 157 | #if defined(__cplusplus) && __cplusplus >=201703L |
| 158 | #pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */ |
| 159 | #endif |
| 160 | #endif |
| 161 | |
| 162 | #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) |
| 163 | /* Use debug wrappers with the Python release dll */ |
| 164 | |
| 165 | #if defined(_MSC_VER) && _MSC_VER >= 1929 |
| 166 | /* Workaround compilation errors when redefining _DEBUG in MSVC 2019 version 16.10 and later |
| 167 | * See https://github.com/swig/swig/issues/2090 */ |
| 168 | # include <corecrt.h> |
| 169 | #endif |
| 170 | |
| 171 | # undef _DEBUG |
| 172 | # include <Python.h> |
| 173 | # define _DEBUG 1 |
| 174 | #else |
| 175 | # include <Python.h> |
| 176 | #endif |
| 177 | |
| 178 | #if __GNUC__ >= 7 |
| 179 | #pragma GCC diagnostic pop |
| 180 | #endif |
| 181 | |
| 182 | #include <stdio.h> |
| 183 | |
| 184 | /* ----------------------------------------------------------------------------- |
| 185 | * swigrun.swg |
| 186 | * |
| 187 | * This file contains generic C API SWIG runtime support for pointer |
| 188 | * type checking. |
| 189 | * ----------------------------------------------------------------------------- */ |
| 190 | |
| 191 | /* This should only be incremented when either the layout of swig_type_info changes, |
| 192 | or for whatever reason, the runtime changes incompatibly */ |
| 193 | #define SWIG_RUNTIME_VERSION "4" |
| 194 | |
| 195 | /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ |
| 196 | #ifdef SWIG_TYPE_TABLE |
| 197 | # define SWIG_QUOTE_STRING(x) #x |
| 198 | # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) |
| 199 | # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) |
| 200 | #else |
| 201 | # define SWIG_TYPE_TABLE_NAME |
| 202 | #endif |
| 203 | |
| 204 | /* |
| 205 | You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for |
| 206 | creating a static or dynamic library from the SWIG runtime code. |
| 207 | In 99.9% of the cases, SWIG just needs to declare them as 'static'. |
| 208 | |
| 209 | But only do this if strictly necessary, ie, if you have problems |
| 210 | with your compiler or suchlike. |
| 211 | */ |
| 212 | |
| 213 | #ifndef SWIGRUNTIME |
| 214 | # define SWIGRUNTIME SWIGINTERN |
| 215 | #endif |
| 216 | |
| 217 | #ifndef SWIGRUNTIMEINLINE |
| 218 | # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE |
| 219 | #endif |
| 220 | |
| 221 | /* Generic buffer size */ |
| 222 | #ifndef SWIG_BUFFER_SIZE |
| 223 | # define SWIG_BUFFER_SIZE 1024 |
| 224 | #endif |
| 225 | |
| 226 | /* Flags for pointer conversions */ |
| 227 | #define SWIG_POINTER_DISOWN 0x1 |
| 228 | #define SWIG_CAST_NEW_MEMORY 0x2 |
| 229 | #define SWIG_POINTER_NO_NULL 0x4 |
| 230 | #define SWIG_POINTER_CLEAR 0x8 |
| 231 | #define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN) |
| 232 | |
| 233 | /* Flags for new pointer objects */ |
| 234 | #define SWIG_POINTER_OWN 0x1 |
| 235 | |
| 236 | |
| 237 | /* |
| 238 | Flags/methods for returning states. |
| 239 | |
| 240 | The SWIG conversion methods, as ConvertPtr, return an integer |
| 241 | that tells if the conversion was successful or not. And if not, |
| 242 | an error code can be returned (see swigerrors.swg for the codes). |
| 243 | |
| 244 | Use the following macros/flags to set or process the returning |
| 245 | states. |
| 246 | |
| 247 | In old versions of SWIG, code such as the following was usually written: |
| 248 | |
| 249 | if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { |
| 250 | // success code |
| 251 | } else { |
| 252 | //fail code |
| 253 | } |
| 254 | |
| 255 | Now you can be more explicit: |
| 256 | |
| 257 | int res = SWIG_ConvertPtr(obj,vptr,ty.flags); |
| 258 | if (SWIG_IsOK(res)) { |
| 259 | // success code |
| 260 | } else { |
| 261 | // fail code |
| 262 | } |
| 263 | |
| 264 | which is the same really, but now you can also do |
| 265 | |
| 266 | Type *ptr; |
| 267 | int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); |
| 268 | if (SWIG_IsOK(res)) { |
| 269 | // success code |
| 270 | if (SWIG_IsNewObj(res) { |
| 271 | ... |
| 272 | delete *ptr; |
| 273 | } else { |
| 274 | ... |
| 275 | } |
| 276 | } else { |
| 277 | // fail code |
| 278 | } |
| 279 | |
| 280 | I.e., now SWIG_ConvertPtr can return new objects and you can |
| 281 | identify the case and take care of the deallocation. Of course that |
| 282 | also requires SWIG_ConvertPtr to return new result values, such as |
| 283 | |
| 284 | int SWIG_ConvertPtr(obj, ptr,...) { |
| 285 | if (<obj is ok>) { |
| 286 | if (<need new object>) { |
| 287 | *ptr = <ptr to new allocated object>; |
| 288 | return SWIG_NEWOBJ; |
| 289 | } else { |
| 290 | *ptr = <ptr to old object>; |
| 291 | return SWIG_OLDOBJ; |
| 292 | } |
| 293 | } else { |
| 294 | return SWIG_BADOBJ; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | Of course, returning the plain '0(success)/-1(fail)' still works, but you can be |
| 299 | more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the |
| 300 | SWIG errors code. |
| 301 | |
| 302 | Finally, if the SWIG_CASTRANK_MODE is enabled, the result code |
| 303 | allows returning the 'cast rank', for example, if you have this |
| 304 | |
| 305 | int food(double) |
| 306 | int fooi(int); |
| 307 | |
| 308 | and you call |
| 309 | |
| 310 | food(1) // cast rank '1' (1 -> 1.0) |
| 311 | fooi(1) // cast rank '0' |
| 312 | |
| 313 | just use the SWIG_AddCast()/SWIG_CheckState() |
| 314 | */ |
| 315 | |
| 316 | #define SWIG_OK (0) |
| 317 | /* Runtime errors are < 0 */ |
| 318 | #define SWIG_ERROR (-1) |
| 319 | /* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */ |
| 320 | /* Errors in range -100 to -199 are language specific errors defined in *errors.swg */ |
| 321 | /* Errors < -200 are generic runtime specific errors */ |
| 322 | #define SWIG_ERROR_RELEASE_NOT_OWNED (-200) |
| 323 | |
| 324 | #define SWIG_IsOK(r) (r >= 0) |
| 325 | #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) |
| 326 | |
| 327 | /* The CastRankLimit says how many bits are used for the cast rank */ |
| 328 | #define SWIG_CASTRANKLIMIT (1 << 8) |
| 329 | /* The NewMask denotes the object was created (using new/malloc) */ |
| 330 | #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) |
| 331 | /* The TmpMask is for in/out typemaps that use temporary objects */ |
| 332 | #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) |
| 333 | /* Simple returning values */ |
| 334 | #define SWIG_BADOBJ (SWIG_ERROR) |
| 335 | #define SWIG_OLDOBJ (SWIG_OK) |
| 336 | #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) |
| 337 | #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) |
| 338 | /* Check, add and del object mask methods */ |
| 339 | #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) |
| 340 | #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) |
| 341 | #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) |
| 342 | #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) |
| 343 | #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) |
| 344 | #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) |
| 345 | |
| 346 | /* Cast-Rank Mode */ |
| 347 | #if defined(SWIG_CASTRANK_MODE) |
| 348 | # ifndef SWIG_TypeRank |
| 349 | # define SWIG_TypeRank unsigned long |
| 350 | # endif |
| 351 | # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ |
| 352 | # define SWIG_MAXCASTRANK (2) |
| 353 | # endif |
| 354 | # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) |
| 355 | # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) |
| 356 | SWIGINTERNINLINE int SWIG_AddCast(int r) { |
| 357 | return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; |
| 358 | } |
| 359 | SWIGINTERNINLINE int SWIG_CheckState(int r) { |
| 360 | return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; |
| 361 | } |
| 362 | #else /* no cast-rank mode */ |
| 363 | # define SWIG_AddCast(r) (r) |
| 364 | # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) |
| 365 | #endif |
| 366 | |
| 367 | /* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF |
| 368 | * if you're missing it. |
| 369 | */ |
| 370 | #if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ |
| 371 | (defined __cplusplus && __cplusplus >= 201103L) || \ |
| 372 | defined SWIG_HAVE_SNPRINTF) && \ |
| 373 | !defined SWIG_NO_SNPRINTF |
| 374 | # define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) |
| 375 | # define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) |
| 376 | #else |
| 377 | /* Fallback versions ignore the buffer size, but most of our uses either have a |
| 378 | * fixed maximum possible size or dynamically allocate a buffer that's large |
| 379 | * enough. |
| 380 | */ |
| 381 | # define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) |
| 382 | # define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) |
| 383 | #endif |
| 384 | |
| 385 | #include <string.h> |
| 386 | |
| 387 | #ifdef __cplusplus |
| 388 | extern "C" { |
| 389 | #endif |
| 390 | |
| 391 | typedef void *(*swig_converter_func)(void *, int *); |
| 392 | typedef struct swig_type_info *(*swig_dycast_func)(void **); |
| 393 | |
| 394 | /* Structure to store information on one type */ |
| 395 | typedef struct swig_type_info { |
| 396 | const char *name; /* mangled name of this type */ |
| 397 | const char *str; /* human readable name of this type */ |
| 398 | swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ |
| 399 | struct swig_cast_info *cast; /* linked list of types that can cast into this type */ |
| 400 | void *clientdata; /* language specific type data */ |
| 401 | int owndata; /* flag if the structure owns the clientdata */ |
| 402 | } swig_type_info; |
| 403 | |
| 404 | /* Structure to store a type and conversion function used for casting */ |
| 405 | typedef struct swig_cast_info { |
| 406 | swig_type_info *type; /* pointer to type that is equivalent to this type */ |
| 407 | swig_converter_func converter; /* function to cast the void pointers */ |
| 408 | struct swig_cast_info *next; /* pointer to next cast in linked list */ |
| 409 | struct swig_cast_info *prev; /* pointer to the previous cast */ |
| 410 | } swig_cast_info; |
| 411 | |
| 412 | /* Structure used to store module information |
| 413 | * Each module generates one structure like this, and the runtime collects |
| 414 | * all of these structures and stores them in a circularly linked list.*/ |
| 415 | typedef struct swig_module_info { |
| 416 | swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ |
| 417 | size_t size; /* Number of types in this module */ |
| 418 | struct swig_module_info *next; /* Pointer to next element in circularly linked list */ |
| 419 | swig_type_info **type_initial; /* Array of initially generated type structures */ |
| 420 | swig_cast_info **cast_initial; /* Array of initially generated casting structures */ |
| 421 | void *clientdata; /* Language specific module data */ |
| 422 | } swig_module_info; |
| 423 | |
| 424 | /* |
| 425 | Compare two type names skipping the space characters, therefore |
| 426 | "char*" == "char *" and "Class<int>" == "Class<int >", etc. |
| 427 | |
| 428 | Return 0 when the two name types are equivalent, as in |
| 429 | strncmp, but skipping ' '. |
| 430 | */ |
| 431 | SWIGRUNTIME int |
| 432 | SWIG_TypeNameComp(const char *f1, const char *l1, |
| 433 | const char *f2, const char *l2) { |
| 434 | for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { |
| 435 | while ((*f1 == ' ') && (f1 != l1)) ++f1; |
| 436 | while ((*f2 == ' ') && (f2 != l2)) ++f2; |
| 437 | if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; |
| 438 | } |
| 439 | return (int)((l1 - f1) - (l2 - f2)); |
| 440 | } |
| 441 | |
| 442 | /* |
| 443 | Check type equivalence in a name list like <name1>|<name2>|... |
| 444 | Return 0 if equal, -1 if nb < tb, 1 if nb > tb |
| 445 | */ |
| 446 | SWIGRUNTIME int |
| 447 | SWIG_TypeCmp(const char *nb, const char *tb) { |
| 448 | int equiv = 1; |
| 449 | const char* te = tb + strlen(s: tb); |
| 450 | const char* ne = nb; |
| 451 | while (equiv != 0 && *ne) { |
| 452 | for (nb = ne; *ne; ++ne) { |
| 453 | if (*ne == '|') break; |
| 454 | } |
| 455 | equiv = SWIG_TypeNameComp(f1: nb, l1: ne, f2: tb, l2: te); |
| 456 | if (*ne) ++ne; |
| 457 | } |
| 458 | return equiv; |
| 459 | } |
| 460 | |
| 461 | /* |
| 462 | Check type equivalence in a name list like <name1>|<name2>|... |
| 463 | Return 0 if not equal, 1 if equal |
| 464 | */ |
| 465 | SWIGRUNTIME int |
| 466 | SWIG_TypeEquiv(const char *nb, const char *tb) { |
| 467 | return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; |
| 468 | } |
| 469 | |
| 470 | /* |
| 471 | Check the typename |
| 472 | */ |
| 473 | SWIGRUNTIME swig_cast_info * |
| 474 | SWIG_TypeCheck(const char *c, swig_type_info *ty) { |
| 475 | if (ty) { |
| 476 | swig_cast_info *iter = ty->cast; |
| 477 | while (iter) { |
| 478 | if (strcmp(s1: iter->type->name, s2: c) == 0) { |
| 479 | if (iter == ty->cast) |
| 480 | return iter; |
| 481 | /* Move iter to the top of the linked list */ |
| 482 | iter->prev->next = iter->next; |
| 483 | if (iter->next) |
| 484 | iter->next->prev = iter->prev; |
| 485 | iter->next = ty->cast; |
| 486 | iter->prev = 0; |
| 487 | if (ty->cast) ty->cast->prev = iter; |
| 488 | ty->cast = iter; |
| 489 | return iter; |
| 490 | } |
| 491 | iter = iter->next; |
| 492 | } |
| 493 | } |
| 494 | return 0; |
| 495 | } |
| 496 | |
| 497 | /* |
| 498 | Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison |
| 499 | */ |
| 500 | SWIGRUNTIME swig_cast_info * |
| 501 | SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { |
| 502 | if (ty) { |
| 503 | swig_cast_info *iter = ty->cast; |
| 504 | while (iter) { |
| 505 | if (iter->type == from) { |
| 506 | if (iter == ty->cast) |
| 507 | return iter; |
| 508 | /* Move iter to the top of the linked list */ |
| 509 | iter->prev->next = iter->next; |
| 510 | if (iter->next) |
| 511 | iter->next->prev = iter->prev; |
| 512 | iter->next = ty->cast; |
| 513 | iter->prev = 0; |
| 514 | if (ty->cast) ty->cast->prev = iter; |
| 515 | ty->cast = iter; |
| 516 | return iter; |
| 517 | } |
| 518 | iter = iter->next; |
| 519 | } |
| 520 | } |
| 521 | return 0; |
| 522 | } |
| 523 | |
| 524 | /* |
| 525 | Cast a pointer up an inheritance hierarchy |
| 526 | */ |
| 527 | SWIGRUNTIMEINLINE void * |
| 528 | SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { |
| 529 | return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); |
| 530 | } |
| 531 | |
| 532 | /* |
| 533 | Dynamic pointer casting. Down an inheritance hierarchy |
| 534 | */ |
| 535 | SWIGRUNTIME swig_type_info * |
| 536 | SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { |
| 537 | swig_type_info *lastty = ty; |
| 538 | if (!ty || !ty->dcast) return ty; |
| 539 | while (ty && (ty->dcast)) { |
| 540 | ty = (*ty->dcast)(ptr); |
| 541 | if (ty) lastty = ty; |
| 542 | } |
| 543 | return lastty; |
| 544 | } |
| 545 | |
| 546 | /* |
| 547 | Return the name associated with this type |
| 548 | */ |
| 549 | SWIGRUNTIMEINLINE const char * |
| 550 | SWIG_TypeName(const swig_type_info *ty) { |
| 551 | return ty->name; |
| 552 | } |
| 553 | |
| 554 | /* |
| 555 | Return the pretty name associated with this type, |
| 556 | that is an unmangled type name in a form presentable to the user. |
| 557 | */ |
| 558 | SWIGRUNTIME const char * |
| 559 | SWIG_TypePrettyName(const swig_type_info *type) { |
| 560 | /* The "str" field contains the equivalent pretty names of the |
| 561 | type, separated by vertical-bar characters. Choose the last |
| 562 | name. It should be the most specific; a fully resolved name |
| 563 | but not necessarily with default template parameters expanded. */ |
| 564 | if (!type) return NULL; |
| 565 | if (type->str != NULL) { |
| 566 | const char *last_name = type->str; |
| 567 | const char *s; |
| 568 | for (s = type->str; *s; s++) |
| 569 | if (*s == '|') last_name = s+1; |
| 570 | return last_name; |
| 571 | } |
| 572 | else |
| 573 | return type->name; |
| 574 | } |
| 575 | |
| 576 | /* |
| 577 | Set the clientdata field for a type |
| 578 | */ |
| 579 | SWIGRUNTIME void |
| 580 | SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { |
| 581 | swig_cast_info *cast = ti->cast; |
| 582 | /* if (ti->clientdata == clientdata) return; */ |
| 583 | ti->clientdata = clientdata; |
| 584 | |
| 585 | while (cast) { |
| 586 | if (!cast->converter) { |
| 587 | swig_type_info *tc = cast->type; |
| 588 | if (!tc->clientdata) { |
| 589 | SWIG_TypeClientData(ti: tc, clientdata); |
| 590 | } |
| 591 | } |
| 592 | cast = cast->next; |
| 593 | } |
| 594 | } |
| 595 | SWIGRUNTIME void |
| 596 | SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { |
| 597 | SWIG_TypeClientData(ti, clientdata); |
| 598 | ti->owndata = 1; |
| 599 | } |
| 600 | |
| 601 | /* |
| 602 | Search for a swig_type_info structure only by mangled name |
| 603 | Search is a O(log #types) |
| 604 | |
| 605 | We start searching at module start, and finish searching when start == end. |
| 606 | Note: if start == end at the beginning of the function, we go all the way around |
| 607 | the circular list. |
| 608 | */ |
| 609 | SWIGRUNTIME swig_type_info * |
| 610 | SWIG_MangledTypeQueryModule(swig_module_info *start, |
| 611 | swig_module_info *end, |
| 612 | const char *name) { |
| 613 | swig_module_info *iter = start; |
| 614 | do { |
| 615 | if (iter->size) { |
| 616 | size_t l = 0; |
| 617 | size_t r = iter->size - 1; |
| 618 | do { |
| 619 | /* since l+r >= 0, we can (>> 1) instead (/ 2) */ |
| 620 | size_t i = (l + r) >> 1; |
| 621 | const char *iname = iter->types[i]->name; |
| 622 | if (iname) { |
| 623 | int compare = strcmp(s1: name, s2: iname); |
| 624 | if (compare == 0) { |
| 625 | return iter->types[i]; |
| 626 | } else if (compare < 0) { |
| 627 | if (i) { |
| 628 | r = i - 1; |
| 629 | } else { |
| 630 | break; |
| 631 | } |
| 632 | } else if (compare > 0) { |
| 633 | l = i + 1; |
| 634 | } |
| 635 | } else { |
| 636 | break; /* should never happen */ |
| 637 | } |
| 638 | } while (l <= r); |
| 639 | } |
| 640 | iter = iter->next; |
| 641 | } while (iter != end); |
| 642 | return 0; |
| 643 | } |
| 644 | |
| 645 | /* |
| 646 | Search for a swig_type_info structure for either a mangled name or a human readable name. |
| 647 | It first searches the mangled names of the types, which is a O(log #types) |
| 648 | If a type is not found it then searches the human readable names, which is O(#types). |
| 649 | |
| 650 | We start searching at module start, and finish searching when start == end. |
| 651 | Note: if start == end at the beginning of the function, we go all the way around |
| 652 | the circular list. |
| 653 | */ |
| 654 | SWIGRUNTIME swig_type_info * |
| 655 | SWIG_TypeQueryModule(swig_module_info *start, |
| 656 | swig_module_info *end, |
| 657 | const char *name) { |
| 658 | /* STEP 1: Search the name field using binary search */ |
| 659 | swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); |
| 660 | if (ret) { |
| 661 | return ret; |
| 662 | } else { |
| 663 | /* STEP 2: If the type hasn't been found, do a complete search |
| 664 | of the str field (the human readable name) */ |
| 665 | swig_module_info *iter = start; |
| 666 | do { |
| 667 | size_t i = 0; |
| 668 | for (; i < iter->size; ++i) { |
| 669 | if (iter->types[i]->str && (SWIG_TypeEquiv(nb: iter->types[i]->str, tb: name))) |
| 670 | return iter->types[i]; |
| 671 | } |
| 672 | iter = iter->next; |
| 673 | } while (iter != end); |
| 674 | } |
| 675 | |
| 676 | /* neither found a match */ |
| 677 | return 0; |
| 678 | } |
| 679 | |
| 680 | /* |
| 681 | Pack binary data into a string |
| 682 | */ |
| 683 | SWIGRUNTIME char * |
| 684 | SWIG_PackData(char *c, void *ptr, size_t sz) { |
| 685 | static const char hex[17] = "0123456789abcdef" ; |
| 686 | const unsigned char *u = (unsigned char *) ptr; |
| 687 | const unsigned char *eu = u + sz; |
| 688 | for (; u != eu; ++u) { |
| 689 | unsigned char uu = *u; |
| 690 | *(c++) = hex[(uu & 0xf0) >> 4]; |
| 691 | *(c++) = hex[uu & 0xf]; |
| 692 | } |
| 693 | return c; |
| 694 | } |
| 695 | |
| 696 | /* |
| 697 | Unpack binary data from a string |
| 698 | */ |
| 699 | SWIGRUNTIME const char * |
| 700 | SWIG_UnpackData(const char *c, void *ptr, size_t sz) { |
| 701 | unsigned char *u = (unsigned char *) ptr; |
| 702 | const unsigned char *eu = u + sz; |
| 703 | for (; u != eu; ++u) { |
| 704 | char d = *(c++); |
| 705 | unsigned char uu; |
| 706 | if ((d >= '0') && (d <= '9')) |
| 707 | uu = (unsigned char)((d - '0') << 4); |
| 708 | else if ((d >= 'a') && (d <= 'f')) |
| 709 | uu = (unsigned char)((d - ('a'-10)) << 4); |
| 710 | else |
| 711 | return (char *) 0; |
| 712 | d = *(c++); |
| 713 | if ((d >= '0') && (d <= '9')) |
| 714 | uu |= (unsigned char)(d - '0'); |
| 715 | else if ((d >= 'a') && (d <= 'f')) |
| 716 | uu |= (unsigned char)(d - ('a'-10)); |
| 717 | else |
| 718 | return (char *) 0; |
| 719 | *u = uu; |
| 720 | } |
| 721 | return c; |
| 722 | } |
| 723 | |
| 724 | /* |
| 725 | Pack 'void *' into a string buffer. |
| 726 | */ |
| 727 | SWIGRUNTIME char * |
| 728 | SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { |
| 729 | char *r = buff; |
| 730 | if ((2*sizeof(void *) + 2) > bsz) return 0; |
| 731 | *(r++) = '_'; |
| 732 | r = SWIG_PackData(c: r,ptr: &ptr,sz: sizeof(void *)); |
| 733 | if (strlen(s: name) + 1 > (bsz - (r - buff))) return 0; |
| 734 | strcpy(dest: r,src: name); |
| 735 | return buff; |
| 736 | } |
| 737 | |
| 738 | SWIGRUNTIME const char * |
| 739 | SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { |
| 740 | if (*c != '_') { |
| 741 | if (strcmp(s1: c,s2: "NULL" ) == 0) { |
| 742 | *ptr = (void *) 0; |
| 743 | return name; |
| 744 | } else { |
| 745 | return 0; |
| 746 | } |
| 747 | } |
| 748 | return SWIG_UnpackData(c: ++c,ptr,sz: sizeof(void *)); |
| 749 | } |
| 750 | |
| 751 | SWIGRUNTIME char * |
| 752 | SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { |
| 753 | char *r = buff; |
| 754 | size_t lname = (name ? strlen(s: name) : 0); |
| 755 | if ((2*sz + 2 + lname) > bsz) return 0; |
| 756 | *(r++) = '_'; |
| 757 | r = SWIG_PackData(c: r,ptr,sz); |
| 758 | if (lname) { |
| 759 | strncpy(dest: r,src: name,n: lname+1); |
| 760 | } else { |
| 761 | *r = 0; |
| 762 | } |
| 763 | return buff; |
| 764 | } |
| 765 | |
| 766 | SWIGRUNTIME const char * |
| 767 | SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { |
| 768 | if (*c != '_') { |
| 769 | if (strcmp(s1: c,s2: "NULL" ) == 0) { |
| 770 | memset(s: ptr,c: 0,n: sz); |
| 771 | return name; |
| 772 | } else { |
| 773 | return 0; |
| 774 | } |
| 775 | } |
| 776 | return SWIG_UnpackData(c: ++c,ptr,sz); |
| 777 | } |
| 778 | |
| 779 | #ifdef __cplusplus |
| 780 | } |
| 781 | #endif |
| 782 | |
| 783 | /* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */ |
| 784 | #define SWIG_UnknownError -1 |
| 785 | #define SWIG_IOError -2 |
| 786 | #define SWIG_RuntimeError -3 |
| 787 | #define SWIG_IndexError -4 |
| 788 | #define SWIG_TypeError -5 |
| 789 | #define SWIG_DivisionByZero -6 |
| 790 | #define SWIG_OverflowError -7 |
| 791 | #define SWIG_SyntaxError -8 |
| 792 | #define SWIG_ValueError -9 |
| 793 | #define SWIG_SystemError -10 |
| 794 | #define SWIG_AttributeError -11 |
| 795 | #define SWIG_MemoryError -12 |
| 796 | #define SWIG_NullReferenceError -13 |
| 797 | |
| 798 | |
| 799 | /* Compatibility macros for Python 3 */ |
| 800 | #if PY_VERSION_HEX >= 0x03000000 |
| 801 | |
| 802 | #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) |
| 803 | #define PyInt_Check(x) PyLong_Check(x) |
| 804 | #define PyInt_AsLong(x) PyLong_AsLong(x) |
| 805 | #define PyInt_FromLong(x) PyLong_FromLong(x) |
| 806 | #define PyInt_FromSize_t(x) PyLong_FromSize_t(x) |
| 807 | #define PyString_Check(name) PyBytes_Check(name) |
| 808 | #define PyString_FromString(x) PyUnicode_FromString(x) |
| 809 | #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) |
| 810 | #define PyString_AsString(str) PyBytes_AsString(str) |
| 811 | #define PyString_Size(str) PyBytes_Size(str) |
| 812 | #define PyString_InternFromString(key) PyUnicode_InternFromString(key) |
| 813 | #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE |
| 814 | #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) |
| 815 | |
| 816 | #endif |
| 817 | |
| 818 | #ifndef Py_TYPE |
| 819 | # define Py_TYPE(op) ((op)->ob_type) |
| 820 | #endif |
| 821 | |
| 822 | /* SWIG APIs for compatibility of both Python 2 & 3 */ |
| 823 | |
| 824 | #if PY_VERSION_HEX >= 0x03000000 |
| 825 | # define SWIG_Python_str_FromFormat PyUnicode_FromFormat |
| 826 | #else |
| 827 | # define SWIG_Python_str_FromFormat PyString_FromFormat |
| 828 | #endif |
| 829 | |
| 830 | |
| 831 | /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ |
| 832 | SWIGINTERN const char * |
| 833 | SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes) |
| 834 | { |
| 835 | #if PY_VERSION_HEX >= 0x03030000 |
| 836 | # if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000 |
| 837 | *pbytes = NULL; |
| 838 | return PyUnicode_AsUTF8AndSize(unicode: str, size: psize); |
| 839 | # else |
| 840 | *pbytes = PyUnicode_AsUTF8String(str); |
| 841 | const char *chars = *pbytes ? PyBytes_AsString(*pbytes) : NULL; |
| 842 | if (chars && psize) |
| 843 | *psize = PyBytes_Size(*pbytes); |
| 844 | return chars; |
| 845 | # endif |
| 846 | #else |
| 847 | char *chars = NULL; |
| 848 | *pbytes = NULL; |
| 849 | PyString_AsStringAndSize(str, &chars, psize); |
| 850 | return chars; |
| 851 | #endif |
| 852 | } |
| 853 | |
| 854 | SWIGINTERN PyObject* |
| 855 | SWIG_Python_str_FromChar(const char *c) |
| 856 | { |
| 857 | #if PY_VERSION_HEX >= 0x03000000 |
| 858 | return PyUnicode_FromString(u: c); |
| 859 | #else |
| 860 | return PyString_FromString(c); |
| 861 | #endif |
| 862 | } |
| 863 | |
| 864 | #ifndef PyObject_DEL |
| 865 | # define PyObject_DEL PyObject_Del |
| 866 | #endif |
| 867 | |
| 868 | /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ |
| 869 | # define SWIGPY_USE_CAPSULE |
| 870 | #ifdef SWIGPYTHON_BUILTIN |
| 871 | # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule_builtin" SWIG_TYPE_TABLE_NAME |
| 872 | #else |
| 873 | # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME |
| 874 | #endif |
| 875 | # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) |
| 876 | |
| 877 | #if PY_VERSION_HEX < 0x03020000 |
| 878 | #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) |
| 879 | #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) |
| 880 | #define Py_hash_t long |
| 881 | #endif |
| 882 | |
| 883 | #ifdef Py_LIMITED_API |
| 884 | # define PyTuple_GET_ITEM PyTuple_GetItem |
| 885 | /* 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 |
| 886 | 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. */ |
| 887 | # define PyTuple_SET_ITEM PyTuple_SetItem |
| 888 | # define PyTuple_GET_SIZE PyTuple_Size |
| 889 | # define PyCFunction_GET_FLAGS PyCFunction_GetFlags |
| 890 | # define PyCFunction_GET_FUNCTION PyCFunction_GetFunction |
| 891 | # define PyCFunction_GET_SELF PyCFunction_GetSelf |
| 892 | # define PyList_GET_ITEM PyList_GetItem |
| 893 | # define PyList_SET_ITEM PyList_SetItem |
| 894 | # define PySliceObject PyObject |
| 895 | #endif |
| 896 | |
| 897 | /* ----------------------------------------------------------------------------- |
| 898 | * error manipulation |
| 899 | * ----------------------------------------------------------------------------- */ |
| 900 | |
| 901 | SWIGRUNTIME PyObject* |
| 902 | SWIG_Python_ErrorType(int code) { |
| 903 | PyObject* type = 0; |
| 904 | switch(code) { |
| 905 | case SWIG_MemoryError: |
| 906 | type = PyExc_MemoryError; |
| 907 | break; |
| 908 | case SWIG_IOError: |
| 909 | type = PyExc_IOError; |
| 910 | break; |
| 911 | case SWIG_RuntimeError: |
| 912 | type = PyExc_RuntimeError; |
| 913 | break; |
| 914 | case SWIG_IndexError: |
| 915 | type = PyExc_IndexError; |
| 916 | break; |
| 917 | case SWIG_TypeError: |
| 918 | type = PyExc_TypeError; |
| 919 | break; |
| 920 | case SWIG_DivisionByZero: |
| 921 | type = PyExc_ZeroDivisionError; |
| 922 | break; |
| 923 | case SWIG_OverflowError: |
| 924 | type = PyExc_OverflowError; |
| 925 | break; |
| 926 | case SWIG_SyntaxError: |
| 927 | type = PyExc_SyntaxError; |
| 928 | break; |
| 929 | case SWIG_ValueError: |
| 930 | type = PyExc_ValueError; |
| 931 | break; |
| 932 | case SWIG_SystemError: |
| 933 | type = PyExc_SystemError; |
| 934 | break; |
| 935 | case SWIG_AttributeError: |
| 936 | type = PyExc_AttributeError; |
| 937 | break; |
| 938 | default: |
| 939 | type = PyExc_RuntimeError; |
| 940 | } |
| 941 | return type; |
| 942 | } |
| 943 | |
| 944 | |
| 945 | SWIGRUNTIME void |
| 946 | SWIG_Python_AddErrorMsg(const char* mesg) |
| 947 | { |
| 948 | PyObject *type = 0; |
| 949 | PyObject *value = 0; |
| 950 | PyObject *traceback = 0; |
| 951 | |
| 952 | if (PyErr_Occurred()) |
| 953 | PyErr_Fetch(&type, &value, &traceback); |
| 954 | if (value) { |
| 955 | PyObject *old_str = PyObject_Str(value); |
| 956 | PyObject *bytes = NULL; |
| 957 | const char *tmp = SWIG_PyUnicode_AsUTF8AndSize(str: old_str, NULL, pbytes: &bytes); |
| 958 | PyErr_Clear(); |
| 959 | Py_XINCREF(type); |
| 960 | if (tmp) |
| 961 | PyErr_Format(exception: type, format: "%s %s" , tmp, mesg); |
| 962 | else |
| 963 | PyErr_Format(exception: type, format: "%s" , mesg); |
| 964 | Py_XDECREF(bytes); |
| 965 | Py_DECREF(old_str); |
| 966 | Py_DECREF(value); |
| 967 | } else { |
| 968 | PyErr_SetString(exception: PyExc_RuntimeError, string: mesg); |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | SWIGRUNTIME int |
| 973 | SWIG_Python_TypeErrorOccurred(PyObject *obj) |
| 974 | { |
| 975 | PyObject *error; |
| 976 | if (obj) |
| 977 | return 0; |
| 978 | error = PyErr_Occurred(); |
| 979 | return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError); |
| 980 | } |
| 981 | |
| 982 | SWIGRUNTIME void |
| 983 | SWIG_Python_RaiseOrModifyTypeError(const char *message) |
| 984 | { |
| 985 | if (SWIG_Python_TypeErrorOccurred(NULL)) { |
| 986 | /* Use existing TypeError to preserve stacktrace and enhance with given message */ |
| 987 | PyObject *newvalue; |
| 988 | PyObject *type = NULL, *value = NULL, *traceback = NULL; |
| 989 | PyErr_Fetch(&type, &value, &traceback); |
| 990 | #if PY_VERSION_HEX >= 0x03000000 |
| 991 | newvalue = PyUnicode_FromFormat(format: "%S\nAdditional information:\n%s" , value, message); |
| 992 | #else |
| 993 | newvalue = PyString_FromFormat("%s\nAdditional information:\n%s" , PyString_AsString(value), message); |
| 994 | #endif |
| 995 | if (newvalue) { |
| 996 | Py_XDECREF(value); |
| 997 | PyErr_Restore(type, newvalue, traceback); |
| 998 | } else { |
| 999 | PyErr_Restore(type, value, traceback); |
| 1000 | } |
| 1001 | } else { |
| 1002 | /* Raise TypeError using given message */ |
| 1003 | PyErr_SetString(exception: PyExc_TypeError, string: message); |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | #if defined(SWIG_PYTHON_NO_THREADS) |
| 1008 | # if defined(SWIG_PYTHON_THREADS) |
| 1009 | # undef SWIG_PYTHON_THREADS |
| 1010 | # endif |
| 1011 | #endif |
| 1012 | #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ |
| 1013 | # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) |
| 1014 | # define SWIG_PYTHON_USE_GIL |
| 1015 | # endif |
| 1016 | # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ |
| 1017 | # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) |
| 1018 | # if PY_VERSION_HEX < 0x03070000 |
| 1019 | # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() |
| 1020 | # else |
| 1021 | # define SWIG_PYTHON_INITIALIZE_THREADS |
| 1022 | # endif |
| 1023 | # endif |
| 1024 | # ifdef __cplusplus /* C++ code */ |
| 1025 | class SWIG_Python_Thread_Block { |
| 1026 | bool status; |
| 1027 | PyGILState_STATE state; |
| 1028 | public: |
| 1029 | void end() { if (status) { PyGILState_Release(state); status = false;} } |
| 1030 | SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} |
| 1031 | ~SWIG_Python_Thread_Block() { end(); } |
| 1032 | }; |
| 1033 | class SWIG_Python_Thread_Allow { |
| 1034 | bool status; |
| 1035 | PyThreadState *save; |
| 1036 | public: |
| 1037 | void end() { if (status) { status = false; PyEval_RestoreThread(save); }} |
| 1038 | SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} |
| 1039 | ~SWIG_Python_Thread_Allow() { end(); } |
| 1040 | }; |
| 1041 | # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block |
| 1042 | # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() |
| 1043 | # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow |
|---|