UGDK
|
00001 /* ---------------------------------------------------------------------------- 00002 * This file was automatically generated by SWIG (http://www.swig.org). 00003 * Version 2.0.4 00004 * 00005 * This file is not intended to be easily readable and contains a number of 00006 * coding conventions designed to improve portability and efficiency. Do not make 00007 * changes to this file unless you know what you are doing--modify the SWIG 00008 * interface file instead. 00009 * ----------------------------------------------------------------------------- */ 00010 00011 /* ----------------------------------------------------------------------------- 00012 * This section contains generic SWIG labels for method/variable 00013 * declarations/attributes, and other compiler dependent labels. 00014 * ----------------------------------------------------------------------------- */ 00015 00016 /* template workaround for compilers that cannot correctly implement the C++ standard */ 00017 #ifndef SWIGTEMPLATEDISAMBIGUATOR 00018 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) 00019 # define SWIGTEMPLATEDISAMBIGUATOR template 00020 # elif defined(__HP_aCC) 00021 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ 00022 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ 00023 # define SWIGTEMPLATEDISAMBIGUATOR template 00024 # else 00025 # define SWIGTEMPLATEDISAMBIGUATOR 00026 # endif 00027 #endif 00028 00029 /* inline attribute */ 00030 #ifndef SWIGINLINE 00031 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) 00032 # define SWIGINLINE inline 00033 # else 00034 # define SWIGINLINE 00035 # endif 00036 #endif 00037 00038 /* attribute recognised by some compilers to avoid 'unused' warnings */ 00039 #ifndef SWIGUNUSED 00040 # if defined(__GNUC__) 00041 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 00042 # define SWIGUNUSED __attribute__ ((__unused__)) 00043 # else 00044 # define SWIGUNUSED 00045 # endif 00046 # elif defined(__ICC) 00047 # define SWIGUNUSED __attribute__ ((__unused__)) 00048 # else 00049 # define SWIGUNUSED 00050 # endif 00051 #endif 00052 00053 #ifndef SWIG_MSC_UNSUPPRESS_4505 00054 # if defined(_MSC_VER) 00055 # pragma warning(disable : 4505) /* unreferenced local function has been removed */ 00056 # endif 00057 #endif 00058 00059 #ifndef SWIGUNUSEDPARM 00060 # ifdef __cplusplus 00061 # define SWIGUNUSEDPARM(p) 00062 # else 00063 # define SWIGUNUSEDPARM(p) p SWIGUNUSED 00064 # endif 00065 #endif 00066 00067 /* internal SWIG method */ 00068 #ifndef SWIGINTERN 00069 # define SWIGINTERN static SWIGUNUSED 00070 #endif 00071 00072 /* internal inline SWIG method */ 00073 #ifndef SWIGINTERNINLINE 00074 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE 00075 #endif 00076 00077 /* exporting methods */ 00078 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) 00079 # ifndef GCC_HASCLASSVISIBILITY 00080 # define GCC_HASCLASSVISIBILITY 00081 # endif 00082 #endif 00083 00084 #ifndef SWIGEXPORT 00085 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 00086 # if defined(STATIC_LINKED) 00087 # define SWIGEXPORT 00088 # else 00089 # define SWIGEXPORT __declspec(dllexport) 00090 # endif 00091 # else 00092 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) 00093 # define SWIGEXPORT __attribute__ ((visibility("default"))) 00094 # else 00095 # define SWIGEXPORT 00096 # endif 00097 # endif 00098 #endif 00099 00100 /* calling conventions for Windows */ 00101 #ifndef SWIGSTDCALL 00102 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 00103 # define SWIGSTDCALL __stdcall 00104 # else 00105 # define SWIGSTDCALL 00106 # endif 00107 #endif 00108 00109 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ 00110 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) 00111 # define _CRT_SECURE_NO_DEPRECATE 00112 #endif 00113 00114 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ 00115 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) 00116 # define _SCL_SECURE_NO_DEPRECATE 00117 #endif 00118 00119 /* Errors in SWIG */ 00120 #define SWIG_UnknownError -1 00121 #define SWIG_IOError -2 00122 #define SWIG_RuntimeError -3 00123 #define SWIG_IndexError -4 00124 #define SWIG_TypeError -5 00125 #define SWIG_DivisionByZero -6 00126 #define SWIG_OverflowError -7 00127 #define SWIG_SyntaxError -8 00128 #define SWIG_ValueError -9 00129 #define SWIG_SystemError -10 00130 #define SWIG_AttributeError -11 00131 #define SWIG_MemoryError -12 00132 #define SWIG_NullReferenceError -13 00133 00134 00135 /* Errors in SWIG */ 00136 #define SWIG_UnknownError -1 00137 #define SWIG_IOError -2 00138 #define SWIG_RuntimeError -3 00139 #define SWIG_IndexError -4 00140 #define SWIG_TypeError -5 00141 #define SWIG_DivisionByZero -6 00142 #define SWIG_OverflowError -7 00143 #define SWIG_SyntaxError -8 00144 #define SWIG_ValueError -9 00145 #define SWIG_SystemError -10 00146 #define SWIG_AttributeError -11 00147 #define SWIG_MemoryError -12 00148 #define SWIG_NullReferenceError -13 00149 00150 00151 /* ----------------------------------------------------------------------------- 00152 * swigrun.swg 00153 * 00154 * This file contains generic C API SWIG runtime support for pointer 00155 * type checking. 00156 * ----------------------------------------------------------------------------- */ 00157 00158 /* This should only be incremented when either the layout of swig_type_info changes, 00159 or for whatever reason, the runtime changes incompatibly */ 00160 #define SWIG_RUNTIME_VERSION "4" 00161 00162 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ 00163 #ifdef SWIG_TYPE_TABLE 00164 # define SWIG_QUOTE_STRING(x) #x 00165 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) 00166 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) 00167 #else 00168 # define SWIG_TYPE_TABLE_NAME 00169 #endif 00170 00171 /* 00172 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for 00173 creating a static or dynamic library from the SWIG runtime code. 00174 In 99.9% of the cases, SWIG just needs to declare them as 'static'. 00175 00176 But only do this if strictly necessary, ie, if you have problems 00177 with your compiler or suchlike. 00178 */ 00179 00180 #ifndef SWIGRUNTIME 00181 # define SWIGRUNTIME SWIGINTERN 00182 #endif 00183 00184 #ifndef SWIGRUNTIMEINLINE 00185 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE 00186 #endif 00187 00188 /* Generic buffer size */ 00189 #ifndef SWIG_BUFFER_SIZE 00190 # define SWIG_BUFFER_SIZE 1024 00191 #endif 00192 00193 /* Flags for pointer conversions */ 00194 #define SWIG_POINTER_DISOWN 0x1 00195 #define SWIG_CAST_NEW_MEMORY 0x2 00196 00197 /* Flags for new pointer objects */ 00198 #define SWIG_POINTER_OWN 0x1 00199 00200 00201 /* 00202 Flags/methods for returning states. 00203 00204 The SWIG conversion methods, as ConvertPtr, return an integer 00205 that tells if the conversion was successful or not. And if not, 00206 an error code can be returned (see swigerrors.swg for the codes). 00207 00208 Use the following macros/flags to set or process the returning 00209 states. 00210 00211 In old versions of SWIG, code such as the following was usually written: 00212 00213 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { 00214 // success code 00215 } else { 00216 //fail code 00217 } 00218 00219 Now you can be more explicit: 00220 00221 int res = SWIG_ConvertPtr(obj,vptr,ty.flags); 00222 if (SWIG_IsOK(res)) { 00223 // success code 00224 } else { 00225 // fail code 00226 } 00227 00228 which is the same really, but now you can also do 00229 00230 Type *ptr; 00231 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); 00232 if (SWIG_IsOK(res)) { 00233 // success code 00234 if (SWIG_IsNewObj(res) { 00235 ... 00236 delete *ptr; 00237 } else { 00238 ... 00239 } 00240 } else { 00241 // fail code 00242 } 00243 00244 I.e., now SWIG_ConvertPtr can return new objects and you can 00245 identify the case and take care of the deallocation. Of course that 00246 also requires SWIG_ConvertPtr to return new result values, such as 00247 00248 int SWIG_ConvertPtr(obj, ptr,...) { 00249 if (<obj is ok>) { 00250 if (<need new object>) { 00251 *ptr = <ptr to new allocated object>; 00252 return SWIG_NEWOBJ; 00253 } else { 00254 *ptr = <ptr to old object>; 00255 return SWIG_OLDOBJ; 00256 } 00257 } else { 00258 return SWIG_BADOBJ; 00259 } 00260 } 00261 00262 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be 00263 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the 00264 SWIG errors code. 00265 00266 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code 00267 allows to return the 'cast rank', for example, if you have this 00268 00269 int food(double) 00270 int fooi(int); 00271 00272 and you call 00273 00274 food(1) // cast rank '1' (1 -> 1.0) 00275 fooi(1) // cast rank '0' 00276 00277 just use the SWIG_AddCast()/SWIG_CheckState() 00278 */ 00279 00280 #define SWIG_OK (0) 00281 #define SWIG_ERROR (-1) 00282 #define SWIG_IsOK(r) (r >= 0) 00283 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) 00284 00285 /* The CastRankLimit says how many bits are used for the cast rank */ 00286 #define SWIG_CASTRANKLIMIT (1 << 8) 00287 /* The NewMask denotes the object was created (using new/malloc) */ 00288 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) 00289 /* The TmpMask is for in/out typemaps that use temporal objects */ 00290 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) 00291 /* Simple returning values */ 00292 #define SWIG_BADOBJ (SWIG_ERROR) 00293 #define SWIG_OLDOBJ (SWIG_OK) 00294 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) 00295 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) 00296 /* Check, add and del mask methods */ 00297 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) 00298 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) 00299 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) 00300 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) 00301 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) 00302 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) 00303 00304 /* Cast-Rank Mode */ 00305 #if defined(SWIG_CASTRANK_MODE) 00306 # ifndef SWIG_TypeRank 00307 # define SWIG_TypeRank unsigned long 00308 # endif 00309 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ 00310 # define SWIG_MAXCASTRANK (2) 00311 # endif 00312 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) 00313 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) 00314 SWIGINTERNINLINE int SWIG_AddCast(int r) { 00315 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; 00316 } 00317 SWIGINTERNINLINE int SWIG_CheckState(int r) { 00318 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 00319 } 00320 #else /* no cast-rank mode */ 00321 # define SWIG_AddCast 00322 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) 00323 #endif 00324 00325 00326 #include <string.h> 00327 00328 #ifdef __cplusplus 00329 extern "C" { 00330 #endif 00331 00332 typedef void *(*swig_converter_func)(void *, int *); 00333 typedef struct swig_type_info *(*swig_dycast_func)(void **); 00334 00335 /* Structure to store information on one type */ 00336 typedef struct swig_type_info { 00337 const char *name; /* mangled name of this type */ 00338 const char *str; /* human readable name of this type */ 00339 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ 00340 struct swig_cast_info *cast; /* linked list of types that can cast into this type */ 00341 void *clientdata; /* language specific type data */ 00342 int owndata; /* flag if the structure owns the clientdata */ 00343 } swig_type_info; 00344 00345 /* Structure to store a type and conversion function used for casting */ 00346 typedef struct swig_cast_info { 00347 swig_type_info *type; /* pointer to type that is equivalent to this type */ 00348 swig_converter_func converter; /* function to cast the void pointers */ 00349 struct swig_cast_info *next; /* pointer to next cast in linked list */ 00350 struct swig_cast_info *prev; /* pointer to the previous cast */ 00351 } swig_cast_info; 00352 00353 /* Structure used to store module information 00354 * Each module generates one structure like this, and the runtime collects 00355 * all of these structures and stores them in a circularly linked list.*/ 00356 typedef struct swig_module_info { 00357 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ 00358 size_t size; /* Number of types in this module */ 00359 struct swig_module_info *next; /* Pointer to next element in circularly linked list */ 00360 swig_type_info **type_initial; /* Array of initially generated type structures */ 00361 swig_cast_info **cast_initial; /* Array of initially generated casting structures */ 00362 void *clientdata; /* Language specific module data */ 00363 } swig_module_info; 00364 00365 /* 00366 Compare two type names skipping the space characters, therefore 00367 "char*" == "char *" and "Class<int>" == "Class<int >", etc. 00368 00369 Return 0 when the two name types are equivalent, as in 00370 strncmp, but skipping ' '. 00371 */ 00372 SWIGRUNTIME int 00373 SWIG_TypeNameComp(const char *f1, const char *l1, 00374 const char *f2, const char *l2) { 00375 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { 00376 while ((*f1 == ' ') && (f1 != l1)) ++f1; 00377 while ((*f2 == ' ') && (f2 != l2)) ++f2; 00378 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; 00379 } 00380 return (int)((l1 - f1) - (l2 - f2)); 00381 } 00382 00383 /* 00384 Check type equivalence in a name list like <name1>|<name2>|... 00385 Return 0 if not equal, 1 if equal 00386 */ 00387 SWIGRUNTIME int 00388 SWIG_TypeEquiv(const char *nb, const char *tb) { 00389 int equiv = 0; 00390 const char* te = tb + strlen(tb); 00391 const char* ne = nb; 00392 while (!equiv && *ne) { 00393 for (nb = ne; *ne; ++ne) { 00394 if (*ne == '|') break; 00395 } 00396 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; 00397 if (*ne) ++ne; 00398 } 00399 return equiv; 00400 } 00401 00402 /* 00403 Check type equivalence in a name list like <name1>|<name2>|... 00404 Return 0 if equal, -1 if nb < tb, 1 if nb > tb 00405 */ 00406 SWIGRUNTIME int 00407 SWIG_TypeCompare(const char *nb, const char *tb) { 00408 int equiv = 0; 00409 const char* te = tb + strlen(tb); 00410 const char* ne = nb; 00411 while (!equiv && *ne) { 00412 for (nb = ne; *ne; ++ne) { 00413 if (*ne == '|') break; 00414 } 00415 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; 00416 if (*ne) ++ne; 00417 } 00418 return equiv; 00419 } 00420 00421 00422 /* 00423 Check the typename 00424 */ 00425 SWIGRUNTIME swig_cast_info * 00426 SWIG_TypeCheck(const char *c, swig_type_info *ty) { 00427 if (ty) { 00428 swig_cast_info *iter = ty->cast; 00429 while (iter) { 00430 if (strcmp(iter->type->name, c) == 0) { 00431 if (iter == ty->cast) 00432 return iter; 00433 /* Move iter to the top of the linked list */ 00434 iter->prev->next = iter->next; 00435 if (iter->next) 00436 iter->next->prev = iter->prev; 00437 iter->next = ty->cast; 00438 iter->prev = 0; 00439 if (ty->cast) ty->cast->prev = iter; 00440 ty->cast = iter; 00441 return iter; 00442 } 00443 iter = iter->next; 00444 } 00445 } 00446 return 0; 00447 } 00448 00449 /* 00450 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison 00451 */ 00452 SWIGRUNTIME swig_cast_info * 00453 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { 00454 if (ty) { 00455 swig_cast_info *iter = ty->cast; 00456 while (iter) { 00457 if (iter->type == from) { 00458 if (iter == ty->cast) 00459 return iter; 00460 /* Move iter to the top of the linked list */ 00461 iter->prev->next = iter->next; 00462 if (iter->next) 00463 iter->next->prev = iter->prev; 00464 iter->next = ty->cast; 00465 iter->prev = 0; 00466 if (ty->cast) ty->cast->prev = iter; 00467 ty->cast = iter; 00468 return iter; 00469 } 00470 iter = iter->next; 00471 } 00472 } 00473 return 0; 00474 } 00475 00476 /* 00477 Cast a pointer up an inheritance hierarchy 00478 */ 00479 SWIGRUNTIMEINLINE void * 00480 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { 00481 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); 00482 } 00483 00484 /* 00485 Dynamic pointer casting. Down an inheritance hierarchy 00486 */ 00487 SWIGRUNTIME swig_type_info * 00488 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { 00489 swig_type_info *lastty = ty; 00490 if (!ty || !ty->dcast) return ty; 00491 while (ty && (ty->dcast)) { 00492 ty = (*ty->dcast)(ptr); 00493 if (ty) lastty = ty; 00494 } 00495 return lastty; 00496 } 00497 00498 /* 00499 Return the name associated with this type 00500 */ 00501 SWIGRUNTIMEINLINE const char * 00502 SWIG_TypeName(const swig_type_info *ty) { 00503 return ty->name; 00504 } 00505 00506 /* 00507 Return the pretty name associated with this type, 00508 that is an unmangled type name in a form presentable to the user. 00509 */ 00510 SWIGRUNTIME const char * 00511 SWIG_TypePrettyName(const swig_type_info *type) { 00512 /* The "str" field contains the equivalent pretty names of the 00513 type, separated by vertical-bar characters. We choose 00514 to print the last name, as it is often (?) the most 00515 specific. */ 00516 if (!type) return NULL; 00517 if (type->str != NULL) { 00518 const char *last_name = type->str; 00519 const char *s; 00520 for (s = type->str; *s; s++) 00521 if (*s == '|') last_name = s+1; 00522 return last_name; 00523 } 00524 else 00525 return type->name; 00526 } 00527 00528 /* 00529 Set the clientdata field for a type 00530 */ 00531 SWIGRUNTIME void 00532 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { 00533 swig_cast_info *cast = ti->cast; 00534 /* if (ti->clientdata == clientdata) return; */ 00535 ti->clientdata = clientdata; 00536 00537 while (cast) { 00538 if (!cast->converter) { 00539 swig_type_info *tc = cast->type; 00540 if (!tc->clientdata) { 00541 SWIG_TypeClientData(tc, clientdata); 00542 } 00543 } 00544 cast = cast->next; 00545 } 00546 } 00547 SWIGRUNTIME void 00548 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { 00549 SWIG_TypeClientData(ti, clientdata); 00550 ti->owndata = 1; 00551 } 00552 00553 /* 00554 Search for a swig_type_info structure only by mangled name 00555 Search is a O(log #types) 00556 00557 We start searching at module start, and finish searching when start == end. 00558 Note: if start == end at the beginning of the function, we go all the way around 00559 the circular list. 00560 */ 00561 SWIGRUNTIME swig_type_info * 00562 SWIG_MangledTypeQueryModule(swig_module_info *start, 00563 swig_module_info *end, 00564 const char *name) { 00565 swig_module_info *iter = start; 00566 do { 00567 if (iter->size) { 00568 register size_t l = 0; 00569 register size_t r = iter->size - 1; 00570 do { 00571 /* since l+r >= 0, we can (>> 1) instead (/ 2) */ 00572 register size_t i = (l + r) >> 1; 00573 const char *iname = iter->types[i]->name; 00574 if (iname) { 00575 register int compare = strcmp(name, iname); 00576 if (compare == 0) { 00577 return iter->types[i]; 00578 } else if (compare < 0) { 00579 if (i) { 00580 r = i - 1; 00581 } else { 00582 break; 00583 } 00584 } else if (compare > 0) { 00585 l = i + 1; 00586 } 00587 } else { 00588 break; /* should never happen */ 00589 } 00590 } while (l <= r); 00591 } 00592 iter = iter->next; 00593 } while (iter != end); 00594 return 0; 00595 } 00596 00597 /* 00598 Search for a swig_type_info structure for either a mangled name or a human readable name. 00599 It first searches the mangled names of the types, which is a O(log #types) 00600 If a type is not found it then searches the human readable names, which is O(#types). 00601 00602 We start searching at module start, and finish searching when start == end. 00603 Note: if start == end at the beginning of the function, we go all the way around 00604 the circular list. 00605 */ 00606 SWIGRUNTIME swig_type_info * 00607 SWIG_TypeQueryModule(swig_module_info *start, 00608 swig_module_info *end, 00609 const char *name) { 00610 /* STEP 1: Search the name field using binary search */ 00611 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); 00612 if (ret) { 00613 return ret; 00614 } else { 00615 /* STEP 2: If the type hasn't been found, do a complete search 00616 of the str field (the human readable name) */ 00617 swig_module_info *iter = start; 00618 do { 00619 register size_t i = 0; 00620 for (; i < iter->size; ++i) { 00621 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) 00622 return iter->types[i]; 00623 } 00624 iter = iter->next; 00625 } while (iter != end); 00626 } 00627 00628 /* neither found a match */ 00629 return 0; 00630 } 00631 00632 /* 00633 Pack binary data into a string 00634 */ 00635 SWIGRUNTIME char * 00636 SWIG_PackData(char *c, void *ptr, size_t sz) { 00637 static const char hex[17] = "0123456789abcdef"; 00638 register const unsigned char *u = (unsigned char *) ptr; 00639 register const unsigned char *eu = u + sz; 00640 for (; u != eu; ++u) { 00641 register unsigned char uu = *u; 00642 *(c++) = hex[(uu & 0xf0) >> 4]; 00643 *(c++) = hex[uu & 0xf]; 00644 } 00645 return c; 00646 } 00647 00648 /* 00649 Unpack binary data from a string 00650 */ 00651 SWIGRUNTIME const char * 00652 SWIG_UnpackData(const char *c, void *ptr, size_t sz) { 00653 register unsigned char *u = (unsigned char *) ptr; 00654 register const unsigned char *eu = u + sz; 00655 for (; u != eu; ++u) { 00656 register char d = *(c++); 00657 register unsigned char uu; 00658 if ((d >= '0') && (d <= '9')) 00659 uu = ((d - '0') << 4); 00660 else if ((d >= 'a') && (d <= 'f')) 00661 uu = ((d - ('a'-10)) << 4); 00662 else 00663 return (char *) 0; 00664 d = *(c++); 00665 if ((d >= '0') && (d <= '9')) 00666 uu |= (d - '0'); 00667 else if ((d >= 'a') && (d <= 'f')) 00668 uu |= (d - ('a'-10)); 00669 else 00670 return (char *) 0; 00671 *u = uu; 00672 } 00673 return c; 00674 } 00675 00676 /* 00677 Pack 'void *' into a string buffer. 00678 */ 00679 SWIGRUNTIME char * 00680 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { 00681 char *r = buff; 00682 if ((2*sizeof(void *) + 2) > bsz) return 0; 00683 *(r++) = '_'; 00684 r = SWIG_PackData(r,&ptr,sizeof(void *)); 00685 if (strlen(name) + 1 > (bsz - (r - buff))) return 0; 00686 strcpy(r,name); 00687 return buff; 00688 } 00689 00690 SWIGRUNTIME const char * 00691 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { 00692 if (*c != '_') { 00693 if (strcmp(c,"NULL") == 0) { 00694 *ptr = (void *) 0; 00695 return name; 00696 } else { 00697 return 0; 00698 } 00699 } 00700 return SWIG_UnpackData(++c,ptr,sizeof(void *)); 00701 } 00702 00703 SWIGRUNTIME char * 00704 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { 00705 char *r = buff; 00706 size_t lname = (name ? strlen(name) : 0); 00707 if ((2*sz + 2 + lname) > bsz) return 0; 00708 *(r++) = '_'; 00709 r = SWIG_PackData(r,ptr,sz); 00710 if (lname) { 00711 strncpy(r,name,lname+1); 00712 } else { 00713 *r = 0; 00714 } 00715 return buff; 00716 } 00717 00718 SWIGRUNTIME const char * 00719 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { 00720 if (*c != '_') { 00721 if (strcmp(c,"NULL") == 0) { 00722 memset(ptr,0,sz); 00723 return name; 00724 } else { 00725 return 0; 00726 } 00727 } 00728 return SWIG_UnpackData(++c,ptr,sz); 00729 } 00730 00731 #ifdef __cplusplus 00732 } 00733 #endif 00734 /* Compatibility macros for Python 3 */ 00735 #if PY_VERSION_HEX >= 0x03000000 00736 00737 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) 00738 #define PyInt_Check(x) PyLong_Check(x) 00739 #define PyInt_AsLong(x) PyLong_AsLong(x) 00740 #define PyInt_FromLong(x) PyLong_FromLong(x) 00741 #define PyString_Check(name) PyBytes_Check(name) 00742 #define PyString_FromString(x) PyUnicode_FromString(x) 00743 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) 00744 #define PyString_AsString(str) PyBytes_AsString(str) 00745 #define PyString_Size(str) PyBytes_Size(str) 00746 #define PyString_InternFromString(key) PyUnicode_InternFromString(key) 00747 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE 00748 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) 00749 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) 00750 00751 #endif 00752 00753 #ifndef Py_TYPE 00754 # define Py_TYPE(op) ((op)->ob_type) 00755 #endif 00756 00757 /* SWIG APIs for compatibility of both Python 2 & 3 */ 00758 00759 #if PY_VERSION_HEX >= 0x03000000 00760 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat 00761 #else 00762 # define SWIG_Python_str_FromFormat PyString_FromFormat 00763 #endif 00764 00765 00766 /* Warning: This function will allocate a new string in Python 3, 00767 * so please call SWIG_Python_str_DelForPy3(x) to free the space. 00768 */ 00769 SWIGINTERN char* 00770 SWIG_Python_str_AsChar(PyObject *str) 00771 { 00772 #if PY_VERSION_HEX >= 0x03000000 00773 char *cstr; 00774 char *newstr; 00775 Py_ssize_t len; 00776 str = PyUnicode_AsUTF8String(str); 00777 PyBytes_AsStringAndSize(str, &cstr, &len); 00778 newstr = (char *) malloc(len+1); 00779 memcpy(newstr, cstr, len+1); 00780 Py_XDECREF(str); 00781 return newstr; 00782 #else 00783 return PyString_AsString(str); 00784 #endif 00785 } 00786 00787 #if PY_VERSION_HEX >= 0x03000000 00788 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) 00789 #else 00790 # define SWIG_Python_str_DelForPy3(x) 00791 #endif 00792 00793 00794 SWIGINTERN PyObject* 00795 SWIG_Python_str_FromChar(const char *c) 00796 { 00797 #if PY_VERSION_HEX >= 0x03000000 00798 return PyUnicode_FromString(c); 00799 #else 00800 return PyString_FromString(c); 00801 #endif 00802 } 00803 00804 /* Add PyOS_snprintf for old Pythons */ 00805 #if PY_VERSION_HEX < 0x02020000 00806 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) 00807 # define PyOS_snprintf _snprintf 00808 # else 00809 # define PyOS_snprintf snprintf 00810 # endif 00811 #endif 00812 00813 /* A crude PyString_FromFormat implementation for old Pythons */ 00814 #if PY_VERSION_HEX < 0x02020000 00815 00816 #ifndef SWIG_PYBUFFER_SIZE 00817 # define SWIG_PYBUFFER_SIZE 1024 00818 #endif 00819 00820 static PyObject * 00821 PyString_FromFormat(const char *fmt, ...) { 00822 va_list ap; 00823 char buf[SWIG_PYBUFFER_SIZE * 2]; 00824 int res; 00825 va_start(ap, fmt); 00826 res = vsnprintf(buf, sizeof(buf), fmt, ap); 00827 va_end(ap); 00828 return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); 00829 } 00830 #endif 00831 00832 /* Add PyObject_Del for old Pythons */ 00833 #if PY_VERSION_HEX < 0x01060000 00834 # define PyObject_Del(op) PyMem_DEL((op)) 00835 #endif 00836 #ifndef PyObject_DEL 00837 # define PyObject_DEL PyObject_Del 00838 #endif 00839 00840 /* A crude PyExc_StopIteration exception for old Pythons */ 00841 #if PY_VERSION_HEX < 0x02020000 00842 # ifndef PyExc_StopIteration 00843 # define PyExc_StopIteration PyExc_RuntimeError 00844 # endif 00845 # ifndef PyObject_GenericGetAttr 00846 # define PyObject_GenericGetAttr 0 00847 # endif 00848 #endif 00849 00850 /* Py_NotImplemented is defined in 2.1 and up. */ 00851 #if PY_VERSION_HEX < 0x02010000 00852 # ifndef Py_NotImplemented 00853 # define Py_NotImplemented PyExc_RuntimeError 00854 # endif 00855 #endif 00856 00857 /* A crude PyString_AsStringAndSize implementation for old Pythons */ 00858 #if PY_VERSION_HEX < 0x02010000 00859 # ifndef PyString_AsStringAndSize 00860 # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} 00861 # endif 00862 #endif 00863 00864 /* PySequence_Size for old Pythons */ 00865 #if PY_VERSION_HEX < 0x02000000 00866 # ifndef PySequence_Size 00867 # define PySequence_Size PySequence_Length 00868 # endif 00869 #endif 00870 00871 /* PyBool_FromLong for old Pythons */ 00872 #if PY_VERSION_HEX < 0x02030000 00873 static 00874 PyObject *PyBool_FromLong(long ok) 00875 { 00876 PyObject *result = ok ? Py_True : Py_False; 00877 Py_INCREF(result); 00878 return result; 00879 } 00880 #endif 00881 00882 /* Py_ssize_t for old Pythons */ 00883 /* This code is as recommended by: */ 00884 /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ 00885 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) 00886 typedef int Py_ssize_t; 00887 # define PY_SSIZE_T_MAX INT_MAX 00888 # define PY_SSIZE_T_MIN INT_MIN 00889 typedef inquiry lenfunc; 00890 typedef intargfunc ssizeargfunc; 00891 typedef intintargfunc ssizessizeargfunc; 00892 typedef intobjargproc ssizeobjargproc; 00893 typedef intintobjargproc ssizessizeobjargproc; 00894 typedef getreadbufferproc readbufferproc; 00895 typedef getwritebufferproc writebufferproc; 00896 typedef getsegcountproc segcountproc; 00897 typedef getcharbufferproc charbufferproc; 00898 static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) 00899 { 00900 long result = 0; 00901 PyObject *i = PyNumber_Int(x); 00902 if (i) { 00903 result = PyInt_AsLong(i); 00904 Py_DECREF(i); 00905 } 00906 return result; 00907 } 00908 #endif 00909 00910 #if PY_VERSION_HEX < 0x02040000 00911 #define Py_VISIT(op) \ 00912 do { \ 00913 if (op) { \ 00914 int vret = visit((op), arg); \ 00915 if (vret) \ 00916 return vret; \ 00917 } \ 00918 } while (0) 00919 #endif 00920 00921 #if PY_VERSION_HEX < 0x02030000 00922 typedef struct { 00923 PyTypeObject type; 00924 PyNumberMethods as_number; 00925 PyMappingMethods as_mapping; 00926 PySequenceMethods as_sequence; 00927 PyBufferProcs as_buffer; 00928 PyObject *name, *slots; 00929 } PyHeapTypeObject; 00930 #endif 00931 00932 #if PY_VERSION_HEX < 0x02030000 00933 typedef destructor freefunc; 00934 #endif 00935 00936 #if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ 00937 (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \ 00938 (PY_MAJOR_VERSION > 3)) 00939 # define SWIGPY_USE_CAPSULE 00940 # define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) 00941 #endif 00942 00943 #if PY_VERSION_HEX < 0x03020000 00944 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) 00945 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) 00946 #endif 00947 /* ----------------------------------------------------------------------------- 00948 * error manipulation 00949 * ----------------------------------------------------------------------------- */ 00950 00951 SWIGRUNTIME PyObject* 00952 SWIG_Python_ErrorType(int code) { 00953 PyObject* type = 0; 00954 switch(code) { 00955 case SWIG_MemoryError: 00956 type = PyExc_MemoryError; 00957 break; 00958 case SWIG_IOError: 00959 type = PyExc_IOError; 00960 break; 00961 case SWIG_RuntimeError: 00962 type = PyExc_RuntimeError; 00963 break; 00964 case SWIG_IndexError: 00965 type = PyExc_IndexError; 00966 break; 00967 case SWIG_TypeError: 00968 type = PyExc_TypeError; 00969 break; 00970 case SWIG_DivisionByZero: 00971 type = PyExc_ZeroDivisionError; 00972 break; 00973 case SWIG_OverflowError: 00974 type = PyExc_OverflowError; 00975 break; 00976 case SWIG_SyntaxError: 00977 type = PyExc_SyntaxError; 00978 break; 00979 case SWIG_ValueError: 00980 type = PyExc_ValueError; 00981 break; 00982 case SWIG_SystemError: 00983 type = PyExc_SystemError; 00984 break; 00985 case SWIG_AttributeError: 00986 type = PyExc_AttributeError; 00987 break; 00988 default: 00989 type = PyExc_RuntimeError; 00990 } 00991 return type; 00992 } 00993 00994 00995 SWIGRUNTIME void 00996 SWIG_Python_AddErrorMsg(const char* mesg) 00997 { 00998 PyObject *type = 0; 00999 PyObject *value = 0; 01000 PyObject *traceback = 0; 01001 01002 if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); 01003 if (value) { 01004 char *tmp; 01005 PyObject *old_str = PyObject_Str(value); 01006 PyErr_Clear(); 01007 Py_XINCREF(type); 01008 01009 PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); 01010 SWIG_Python_str_DelForPy3(tmp); 01011 Py_DECREF(old_str); 01012 Py_DECREF(value); 01013 } else { 01014 PyErr_SetString(PyExc_RuntimeError, mesg); 01015 } 01016 } 01017 #if defined(SWIG_PYTHON_NO_THREADS) 01018 # if defined(SWIG_PYTHON_THREADS) 01019 # undef SWIG_PYTHON_THREADS 01020 # endif 01021 #endif 01022 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ 01023 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) 01024 # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ 01025 # define SWIG_PYTHON_USE_GIL 01026 # endif 01027 # endif 01028 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ 01029 # ifndef SWIG_PYTHON_INITIALIZE_THREADS 01030 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() 01031 # endif 01032 # ifdef __cplusplus /* C++ code */ 01033 class SWIG_Python_Thread_Block { 01034 bool status; 01035 PyGILState_STATE state; 01036 public: 01037 void end() { if (status) { PyGILState_Release(state); status = false;} } 01038 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} 01039 ~SWIG_Python_Thread_Block() { end(); } 01040 }; 01041 class SWIG_Python_Thread_Allow { 01042 bool status; 01043 PyThreadState *save; 01044 public: 01045 void end() { if (status) { PyEval_RestoreThread(save); status = false; }} 01046 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} 01047 ~SWIG_Python_Thread_Allow() { end(); } 01048 }; 01049 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block 01050 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() 01051 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow 01052 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() 01053 # else /* C code */ 01054 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() 01055 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) 01056 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() 01057 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) 01058 # endif 01059 # else /* Old thread way, not implemented, user must provide it */ 01060 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS) 01061 # define SWIG_PYTHON_INITIALIZE_THREADS 01062 # endif 01063 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) 01064 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK 01065 # endif 01066 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK) 01067 # define SWIG_PYTHON_THREAD_END_BLOCK 01068 # endif 01069 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) 01070 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW 01071 # endif 01072 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW) 01073 # define SWIG_PYTHON_THREAD_END_ALLOW 01074 # endif 01075 # endif 01076 #else /* No thread support */ 01077 # define SWIG_PYTHON_INITIALIZE_THREADS 01078 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK 01079 # define SWIG_PYTHON_THREAD_END_BLOCK 01080 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW 01081 # define SWIG_PYTHON_THREAD_END_ALLOW 01082 #endif 01083 /* ----------------------------------------------------------------------------- 01084 * Python API portion that goes into the runtime 01085 * ----------------------------------------------------------------------------- */ 01086 01087 #ifdef __cplusplus 01088 extern "C" { 01089 #endif 01090 01091 /* ----------------------------------------------------------------------------- 01092 * Constant declarations 01093 * ----------------------------------------------------------------------------- */ 01094 01095 /* Constant Types */ 01096 #define SWIG_PY_POINTER 4 01097 #define SWIG_PY_BINARY 5 01098 01099 /* Constant information structure */ 01100 typedef struct swig_const_info { 01101 int type; 01102 char *name; 01103 long lvalue; 01104 double dvalue; 01105 void *pvalue; 01106 swig_type_info **ptype; 01107 } swig_const_info; 01108 01109 01110 /* ----------------------------------------------------------------------------- 01111 * Wrapper of PyInstanceMethod_New() used in Python 3 01112 * It is exported to the generated module, used for -fastproxy 01113 * ----------------------------------------------------------------------------- */ 01114 #if PY_VERSION_HEX >= 0x03000000 01115 SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) 01116 { 01117 return PyInstanceMethod_New(func); 01118 } 01119 #else 01120 SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func)) 01121 { 01122 return NULL; 01123 } 01124 #endif 01125 01126 #ifdef __cplusplus 01127 } 01128 #endif 01129 01130 /* ----------------------------------------------------------------------------- 01131 * pyrun.swg 01132 * 01133 * This file contains the runtime support for Python modules 01134 * and includes code for managing global variables and pointer 01135 * type checking. 01136 * 01137 * ----------------------------------------------------------------------------- */ 01138 01139 /* Common SWIG API */ 01140 01141 /* for raw pointers */ 01142 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) 01143 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) 01144 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) 01145 01146 #ifdef SWIGPYTHON_BUILTIN 01147 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) 01148 #else 01149 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) 01150 #endif 01151 01152 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) 01153 01154 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) 01155 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) 01156 #define swig_owntype int 01157 01158 /* for raw packed data */ 01159 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) 01160 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) 01161 01162 /* for class or struct pointers */ 01163 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) 01164 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) 01165 01166 /* for C or C++ function pointers */ 01167 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) 01168 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) 01169 01170 /* for C++ member pointers, ie, member methods */ 01171 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) 01172 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) 01173 01174 01175 /* Runtime API */ 01176 01177 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule() 01178 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) 01179 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) 01180 01181 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj 01182 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg 01183 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) 01184 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 01185 #define SWIG_fail goto fail 01186 01187 01188 /* Runtime API implementation */ 01189 01190 /* Error manipulation */ 01191 01192 SWIGINTERN void 01193 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { 01194 SWIG_PYTHON_THREAD_BEGIN_BLOCK; 01195 PyErr_SetObject(errtype, obj); 01196 Py_DECREF(obj); 01197 SWIG_PYTHON_THREAD_END_BLOCK; 01198 } 01199 01200 SWIGINTERN void 01201 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { 01202 SWIG_PYTHON_THREAD_BEGIN_BLOCK; 01203 PyErr_SetString(errtype, (char *) msg); 01204 SWIG_PYTHON_THREAD_END_BLOCK; 01205 } 01206 01207 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) 01208 01209 /* Set a constant value */ 01210 01211 #if defined(SWIGPYTHON_BUILTIN) 01212 01213 SWIGINTERN void 01214 SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { 01215 PyObject *s = PyString_InternFromString(key); 01216 PyList_Append(seq, s); 01217 Py_DECREF(s); 01218 } 01219 01220 SWIGINTERN void 01221 SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { 01222 PyDict_SetItemString(d, (char *)name, obj); 01223 Py_DECREF(obj); 01224 if (public_interface) 01225 SwigPyBuiltin_AddPublicSymbol(public_interface, name); 01226 } 01227 01228 #else 01229 01230 SWIGINTERN void 01231 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { 01232 PyDict_SetItemString(d, (char *)name, obj); 01233 Py_DECREF(obj); 01234 } 01235 01236 #endif 01237 01238 /* Append a value to the result obj */ 01239 01240 SWIGINTERN PyObject* 01241 SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { 01242 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE) 01243 if (!result) { 01244 result = obj; 01245 } else if (result == Py_None) { 01246 Py_DECREF(result); 01247 result = obj; 01248 } else { 01249 if (!PyList_Check(result)) { 01250 PyObject *o2 = result; 01251 result = PyList_New(1); 01252 PyList_SetItem(result, 0, o2); 01253 } 01254 PyList_Append(result,obj); 01255 Py_DECREF(obj); 01256 } 01257 return result; 01258 #else 01259 PyObject* o2; 01260 PyObject* o3; 01261 if (!result) { 01262 result = obj; 01263 } else if (result == Py_None) { 01264 Py_DECREF(result); 01265 result = obj; 01266 } else { 01267 if (!PyTuple_Check(result)) { 01268 o2 = result; 01269 result = PyTuple_New(1); 01270 PyTuple_SET_ITEM(result, 0, o2); 01271 } 01272 o3 = PyTuple_New(1); 01273 PyTuple_SET_ITEM(o3, 0, obj); 01274 o2 = result; 01275 result = PySequence_Concat(o2, o3); 01276 Py_DECREF(o2); 01277 Py_DECREF(o3); 01278 } 01279 return result; 01280 #endif 01281 } 01282 01283 /* Unpack the argument tuple */ 01284 01285 SWIGINTERN int 01286 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) 01287 { 01288 if (!args) { 01289 if (!min && !max) { 01290 return 1; 01291 } else { 01292 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 01293 name, (min == max ? "" : "at least "), (int)min); 01294 return 0; 01295 } 01296 } 01297 if (!PyTuple_Check(args)) { 01298 if (min <= 1 && max >= 1) { 01299 register int i; 01300 objs[0] = args; 01301 for (i = 1; i < max; ++i) { 01302 objs[i] = 0; 01303 } 01304 return 2; 01305 } 01306 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); 01307 return 0; 01308 } else { 01309 register Py_ssize_t l = PyTuple_GET_SIZE(args); 01310 if (l < min) { 01311 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 01312 name, (min == max ? "" : "at least "), (int)min, (int)l); 01313 return 0; 01314 } else if (l > max) { 01315 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 01316 name, (min == max ? "" : "at most "), (int)max, (int)l); 01317 return 0; 01318 } else { 01319 register int i; 01320 for (i = 0; i < l; ++i) { 01321 objs[i] = PyTuple_GET_ITEM(args, i); 01322 } 01323 for (; l < max; ++l) { 01324 objs[l] = 0; 01325 } 01326 return i + 1; 01327 } 01328 } 01329 } 01330 01331 /* A functor is a function object with one single object argument */ 01332 #if PY_VERSION_HEX >= 0x02020000 01333 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); 01334 #else 01335 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); 01336 #endif 01337 01338 /* 01339 Helper for static pointer initialization for both C and C++ code, for example 01340 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); 01341 */ 01342 #ifdef __cplusplus 01343 #define SWIG_STATIC_POINTER(var) var 01344 #else 01345 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var 01346 #endif 01347 01348 /* ----------------------------------------------------------------------------- 01349 * Pointer declarations 01350 * ----------------------------------------------------------------------------- */ 01351 01352 /* Flags for new pointer objects */ 01353 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) 01354 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) 01355 01356 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) 01357 01358 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) 01359 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) 01360 01361 #ifdef __cplusplus 01362 extern "C" { 01363 #endif 01364 01365 /* How to access Py_None */ 01366 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 01367 # ifndef SWIG_PYTHON_NO_BUILD_NONE 01368 # ifndef SWIG_PYTHON_BUILD_NONE 01369 # define SWIG_PYTHON_BUILD_NONE 01370 # endif 01371 # endif 01372 #endif 01373 01374 #ifdef SWIG_PYTHON_BUILD_NONE 01375 # ifdef Py_None 01376 # undef Py_None 01377 # define Py_None SWIG_Py_None() 01378 # endif 01379 SWIGRUNTIMEINLINE PyObject * 01380 _SWIG_Py_None(void) 01381 { 01382 PyObject *none = Py_BuildValue((char*)""); 01383 Py_DECREF(none); 01384 return none; 01385 } 01386 SWIGRUNTIME PyObject * 01387 SWIG_Py_None(void) 01388 { 01389 static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); 01390 return none; 01391 } 01392 #endif 01393 01394 /* The python void return value */ 01395 01396 SWIGRUNTIMEINLINE PyObject * 01397 SWIG_Py_Void(void) 01398 { 01399 PyObject *none = Py_None; 01400 Py_INCREF(none); 01401 return none; 01402 } 01403 01404 /* SwigPyClientData */ 01405 01406 typedef struct { 01407 PyObject *klass; 01408 PyObject *newraw; 01409 PyObject *newargs; 01410 PyObject *destroy; 01411 int delargs; 01412 int implicitconv; 01413 PyTypeObject *pytype; 01414 } SwigPyClientData; 01415 01416 SWIGRUNTIMEINLINE int 01417 SWIG_Python_CheckImplicit(swig_type_info *ty) 01418 { 01419 SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; 01420 return data ? data->implicitconv : 0; 01421 } 01422 01423 SWIGRUNTIMEINLINE PyObject * 01424 SWIG_Python_ExceptionType(swig_type_info *desc) { 01425 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; 01426 PyObject *klass = data ? data->klass : 0; 01427 return (klass ? klass : PyExc_RuntimeError); 01428 } 01429 01430 01431 SWIGRUNTIME SwigPyClientData * 01432 SwigPyClientData_New(PyObject* obj) 01433 { 01434 if (!obj) { 01435 return 0; 01436 } else { 01437 SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); 01438 /* the klass element */ 01439 data->klass = obj; 01440 Py_INCREF(data->klass); 01441 /* the newraw method and newargs arguments used to create a new raw instance */ 01442 if (PyClass_Check(obj)) { 01443 data->newraw = 0; 01444 data->newargs = obj; 01445 Py_INCREF(obj); 01446 } else { 01447 #if (PY_VERSION_HEX < 0x02020000) 01448 data->newraw = 0; 01449 #else 01450 data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); 01451 #endif 01452 if (data->newraw) { 01453 Py_INCREF(data->newraw); 01454 data->newargs = PyTuple_New(1); 01455 PyTuple_SetItem(data->newargs, 0, obj); 01456 } else { 01457 data->newargs = obj; 01458 } 01459 Py_INCREF(data->newargs); 01460 } 01461 /* the destroy method, aka as the C++ delete method */ 01462 data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); 01463 if (PyErr_Occurred()) { 01464 PyErr_Clear(); 01465 data->destroy = 0; 01466 } 01467 if (data->destroy) { 01468 int flags; 01469 Py_INCREF(data->destroy); 01470 flags = PyCFunction_GET_FLAGS(data->destroy); 01471 #ifdef METH_O 01472 data->delargs = !(flags & (METH_O)); 01473 #else 01474 data->delargs = 0; 01475 #endif 01476 } else { 01477 data->delargs = 0; 01478 } 01479 data->implicitconv = 0; 01480 data->pytype = 0; 01481 return data; 01482 } 01483 } 01484 01485 SWIGRUNTIME void 01486 SwigPyClientData_Del(SwigPyClientData *data) { 01487 Py_XDECREF(data->newraw); 01488 Py_XDECREF(data->newargs); 01489 Py_XDECREF(data->destroy); 01490 } 01491 01492 /* =============== SwigPyObject =====================*/ 01493 01494 typedef struct { 01495 PyObject_HEAD 01496 void *ptr; 01497 swig_type_info *ty; 01498 int own; 01499 PyObject *next; 01500 #ifdef SWIGPYTHON_BUILTIN 01501 PyObject *dict; 01502 #endif 01503 } SwigPyObject; 01504 01505 SWIGRUNTIME PyObject * 01506 SwigPyObject_long(SwigPyObject *v) 01507 { 01508 return PyLong_FromVoidPtr(v->ptr); 01509 } 01510 01511 SWIGRUNTIME PyObject * 01512 SwigPyObject_format(const char* fmt, SwigPyObject *v) 01513 { 01514 PyObject *res = NULL; 01515 PyObject *args = PyTuple_New(1); 01516 if (args) { 01517 if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { 01518 PyObject *ofmt = SWIG_Python_str_FromChar(fmt); 01519 if (ofmt) { 01520 #if PY_VERSION_HEX >= 0x03000000 01521 res = PyUnicode_Format(ofmt,args); 01522 #else 01523 res = PyString_Format(ofmt,args); 01524 #endif 01525 Py_DECREF(ofmt); 01526 } 01527 Py_DECREF(args); 01528 } 01529 } 01530 return res; 01531 } 01532 01533 SWIGRUNTIME PyObject * 01534 SwigPyObject_oct(SwigPyObject *v) 01535 { 01536 return SwigPyObject_format("%o",v); 01537 } 01538 01539 SWIGRUNTIME PyObject * 01540 SwigPyObject_hex(SwigPyObject *v) 01541 { 01542 return SwigPyObject_format("%x",v); 01543 } 01544 01545 SWIGRUNTIME PyObject * 01546 #ifdef METH_NOARGS 01547 SwigPyObject_repr(SwigPyObject *v) 01548 #else 01549 SwigPyObject_repr(SwigPyObject *v, PyObject *args) 01550 #endif 01551 { 01552 const char *name = SWIG_TypePrettyName(v->ty); 01553 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, (void *)v); 01554 if (v->next) { 01555 # ifdef METH_NOARGS 01556 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); 01557 # else 01558 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); 01559 # endif 01560 # if PY_VERSION_HEX >= 0x03000000 01561 PyObject *joined = PyUnicode_Concat(repr, nrep); 01562 Py_DecRef(repr); 01563 Py_DecRef(nrep); 01564 repr = joined; 01565 # else 01566 PyString_ConcatAndDel(&repr,nrep); 01567 # endif 01568 } 01569 return repr; 01570 } 01571 01572 SWIGRUNTIME int 01573 SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) 01574 { 01575 char *str; 01576 #ifdef METH_NOARGS 01577 PyObject *repr = SwigPyObject_repr(v); 01578 #else 01579 PyObject *repr = SwigPyObject_repr(v, NULL); 01580 #endif 01581 if (repr) { 01582 str = SWIG_Python_str_AsChar(repr); 01583 fputs(str, fp); 01584 SWIG_Python_str_DelForPy3(str); 01585 Py_DECREF(repr); 01586 return 0; 01587 } else { 01588 return 1; 01589 } 01590 } 01591 01592 SWIGRUNTIME PyObject * 01593 SwigPyObject_str(SwigPyObject *v) 01594 { 01595 char result[SWIG_BUFFER_SIZE]; 01596 return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? 01597 SWIG_Python_str_FromChar(result) : 0; 01598 } 01599 01600 SWIGRUNTIME int 01601 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) 01602 { 01603 void *i = v->ptr; 01604 void *j = w->ptr; 01605 return (i < j) ? -1 : ((i > j) ? 1 : 0); 01606 } 01607 01608 /* Added for Python 3.x, would it also be useful for Python 2.x? */ 01609 SWIGRUNTIME PyObject* 01610 SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) 01611 { 01612 PyObject* res; 01613 if( op != Py_EQ && op != Py_NE ) { 01614 Py_INCREF(Py_NotImplemented); 01615 return Py_NotImplemented; 01616 } 01617 res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); 01618 return res; 01619 } 01620 01621 01622 SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); 01623 01624 #ifdef SWIGPYTHON_BUILTIN 01625 static swig_type_info *SwigPyObject_stype = 0; 01626 SWIGRUNTIME PyTypeObject* 01627 SwigPyObject_type(void) { 01628 SwigPyClientData *cd; 01629 assert(SwigPyObject_stype); 01630 cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; 01631 assert(cd); 01632 assert(cd->pytype); 01633 return cd->pytype; 01634 } 01635 #else 01636 SWIGRUNTIME PyTypeObject* 01637 SwigPyObject_type(void) { 01638 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); 01639 return type; 01640 } 01641 #endif 01642 01643 SWIGRUNTIMEINLINE int 01644 SwigPyObject_Check(PyObject *op) { 01645 #ifdef SWIGPYTHON_BUILTIN 01646 PyTypeObject *target_tp = SwigPyObject_type(); 01647 if (PyType_IsSubtype(op->ob_type, target_tp)) 01648 return 1; 01649 return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); 01650 #else 01651 return (Py_TYPE(op) == SwigPyObject_type()) 01652 || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); 01653 #endif 01654 } 01655 01656 SWIGRUNTIME PyObject * 01657 SwigPyObject_New(void *ptr, swig_type_info *ty, int own); 01658 01659 SWIGRUNTIME void 01660 SwigPyObject_dealloc(PyObject *v) 01661 { 01662 SwigPyObject *sobj = (SwigPyObject *) v; 01663 PyObject *next = sobj->next; 01664 if (sobj->own == SWIG_POINTER_OWN) { 01665 swig_type_info *ty = sobj->ty; 01666 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; 01667 PyObject *destroy = data ? data->destroy : 0; 01668 if (destroy) { 01669 /* destroy is always a VARARGS method */ 01670 PyObject *res; 01671 if (data->delargs) { 01672 /* we need to create a temporary object to carry the destroy operation */ 01673 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); 01674 res = SWIG_Python_CallFunctor(destroy, tmp); 01675 Py_DECREF(tmp); 01676 } else { 01677 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); 01678 PyObject *mself = PyCFunction_GET_SELF(destroy); 01679 res = ((*meth)(mself, v)); 01680 } 01681 Py_XDECREF(res); 01682 } 01683 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) 01684 else { 01685 const char *name = SWIG_TypePrettyName(ty); 01686 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); 01687 } 01688 #endif 01689 } 01690 Py_XDECREF(next); 01691 PyObject_DEL(v); 01692 } 01693 01694 SWIGRUNTIME PyObject* 01695 SwigPyObject_append(PyObject* v, PyObject* next) 01696 { 01697 SwigPyObject *sobj = (SwigPyObject *) v; 01698 #ifndef METH_O 01699 PyObject *tmp = 0; 01700 if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; 01701 next = tmp; 01702 #endif 01703 if (!SwigPyObject_Check(next)) { 01704 return NULL; 01705 } 01706 sobj->next = next; 01707 Py_INCREF(next); 01708 return SWIG_Py_Void(); 01709 } 01710 01711 SWIGRUNTIME PyObject* 01712 #ifdef METH_NOARGS 01713 SwigPyObject_next(PyObject* v) 01714 #else 01715 SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) 01716 #endif 01717 { 01718 SwigPyObject *sobj = (SwigPyObject *) v; 01719 if (sobj->next) { 01720 Py_INCREF(sobj->next); 01721 return sobj->next; 01722 } else { 01723 return SWIG_Py_Void(); 01724 } 01725 } 01726 01727 SWIGINTERN PyObject* 01728 #ifdef METH_NOARGS 01729 SwigPyObject_disown(PyObject *v) 01730 #else 01731 SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) 01732 #endif 01733 { 01734 SwigPyObject *sobj = (SwigPyObject *)v; 01735 sobj->own = 0; 01736 return SWIG_Py_Void(); 01737 } 01738 01739 SWIGINTERN PyObject* 01740 #ifdef METH_NOARGS 01741 SwigPyObject_acquire(PyObject *v) 01742 #else 01743 SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) 01744 #endif 01745 { 01746 SwigPyObject *sobj = (SwigPyObject *)v; 01747 sobj->own = SWIG_POINTER_OWN; 01748 return SWIG_Py_Void(); 01749 } 01750 01751 SWIGINTERN PyObject* 01752 SwigPyObject_own(PyObject *v, PyObject *args) 01753 { 01754 PyObject *val = 0; 01755 #if (PY_VERSION_HEX < 0x02020000) 01756 if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) 01757 #else 01758 if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 01759 #endif 01760 { 01761 return NULL; 01762 } 01763 else 01764 { 01765 SwigPyObject *sobj = (SwigPyObject *)v; 01766 PyObject *obj = PyBool_FromLong(sobj->own); 01767 if (val) { 01768 #ifdef METH_NOARGS 01769 if (PyObject_IsTrue(val)) { 01770 SwigPyObject_acquire(v); 01771 } else { 01772 SwigPyObject_disown(v); 01773 } 01774 #else 01775 if (PyObject_IsTrue(val)) { 01776 SwigPyObject_acquire(v,args); 01777 } else { 01778 SwigPyObject_disown(v,args); 01779 } 01780 #endif 01781 } 01782 return obj; 01783 } 01784 } 01785 01786 #ifdef METH_O 01787 static PyMethodDef 01788 swigobject_methods[] = { 01789 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, 01790 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, 01791 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, 01792 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, 01793 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, 01794 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, 01795 {0, 0, 0, 0} 01796 }; 01797 #else 01798 static PyMethodDef 01799 swigobject_methods[] = { 01800 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, 01801 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, 01802 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, 01803 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, 01804 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, 01805 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, 01806 {0, 0, 0, 0} 01807 }; 01808 #endif 01809 01810 #if PY_VERSION_HEX < 0x02020000 01811 SWIGINTERN PyObject * 01812 SwigPyObject_getattr(SwigPyObject *sobj,char *name) 01813 { 01814 return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); 01815 } 01816 #endif 01817 01818 SWIGRUNTIME PyTypeObject* 01819 SwigPyObject_TypeOnce(void) { 01820 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; 01821 01822 static PyNumberMethods SwigPyObject_as_number = { 01823 (binaryfunc)0, /*nb_add*/ 01824 (binaryfunc)0, /*nb_subtract*/ 01825 (binaryfunc)0, /*nb_multiply*/ 01826 /* nb_divide removed in Python 3 */ 01827 #if PY_VERSION_HEX < 0x03000000 01828 (binaryfunc)0, /*nb_divide*/ 01829 #endif 01830 (binaryfunc)0, /*nb_remainder*/ 01831 (binaryfunc)0, /*nb_divmod*/ 01832 (ternaryfunc)0,/*nb_power*/ 01833 (unaryfunc)0, /*nb_negative*/ 01834 (unaryfunc)0, /*nb_positive*/ 01835 (unaryfunc)0, /*nb_absolute*/ 01836 (inquiry)0, /*nb_nonzero*/ 01837 0, /*nb_invert*/ 01838 0, /*nb_lshift*/ 01839 0, /*nb_rshift*/ 01840 0, /*nb_and*/ 01841 0, /*nb_xor*/ 01842 0, /*nb_or*/ 01843 #if PY_VERSION_HEX < 0x03000000 01844 0, /*nb_coerce*/ 01845 #endif 01846 (unaryfunc)SwigPyObject_long, /*nb_int*/ 01847 #if PY_VERSION_HEX < 0x03000000 01848 (unaryfunc)SwigPyObject_long, /*nb_long*/ 01849 #else 01850 0, /*nb_reserved*/ 01851 #endif 01852 (unaryfunc)0, /*nb_float*/ 01853 #if PY_VERSION_HEX < 0x03000000 01854 (unaryfunc)SwigPyObject_oct, /*nb_oct*/ 01855 (unaryfunc)SwigPyObject_hex, /*nb_hex*/ 01856 #endif 01857 #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 01858 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ 01859 #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 01860 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ 01861 #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 01862 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ 01863 #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ 01864 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ 01865 #endif 01866 }; 01867 01868 static PyTypeObject swigpyobject_type; 01869 static int type_init = 0; 01870 if (!type_init) { 01871 const PyTypeObject tmp = { 01872 /* PyObject header changed in Python 3 */ 01873 #if PY_VERSION_HEX >= 0x03000000 01874 PyVarObject_HEAD_INIT(NULL, 0) 01875 #else 01876 PyObject_HEAD_INIT(NULL) 01877 0, /* ob_size */ 01878 #endif 01879 (char *)"SwigPyObject", /* tp_name */ 01880 sizeof(SwigPyObject), /* tp_basicsize */ 01881 0, /* tp_itemsize */ 01882 (destructor)SwigPyObject_dealloc, /* tp_dealloc */ 01883 (printfunc)SwigPyObject_print, /* tp_print */ 01884 #if PY_VERSION_HEX < 0x02020000 01885 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ 01886 #else 01887 (getattrfunc)0, /* tp_getattr */ 01888 #endif 01889 (setattrfunc)0, /* tp_setattr */ 01890 #if PY_VERSION_HEX >= 0x03000000 01891 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ 01892 #else 01893 (cmpfunc)SwigPyObject_compare, /* tp_compare */ 01894 #endif 01895 (reprfunc)SwigPyObject_repr, /* tp_repr */ 01896 &SwigPyObject_as_number, /* tp_as_number */ 01897 0, /* tp_as_sequence */ 01898 0, /* tp_as_mapping */ 01899 (hashfunc)0, /* tp_hash */ 01900 (ternaryfunc)0, /* tp_call */ 01901 (reprfunc)SwigPyObject_str, /* tp_str */ 01902 PyObject_GenericGetAttr, /* tp_getattro */ 01903 0, /* tp_setattro */ 01904 0, /* tp_as_buffer */ 01905 Py_TPFLAGS_DEFAULT, /* tp_flags */ 01906 swigobject_doc, /* tp_doc */ 01907 0, /* tp_traverse */ 01908 0, /* tp_clear */ 01909 (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ 01910 0, /* tp_weaklistoffset */ 01911 #if PY_VERSION_HEX >= 0x02020000 01912 0, /* tp_iter */ 01913 0, /* tp_iternext */ 01914 swigobject_methods, /* tp_methods */ 01915 0, /* tp_members */ 01916 0, /* tp_getset */ 01917 0, /* tp_base */ 01918 0, /* tp_dict */ 01919 0, /* tp_descr_get */ 01920 0, /* tp_descr_set */ 01921 0, /* tp_dictoffset */ 01922 0, /* tp_init */ 01923 0, /* tp_alloc */ 01924 0, /* tp_new */ 01925 0, /* tp_free */ 01926 0, /* tp_is_gc */ 01927 0, /* tp_bases */ 01928 0, /* tp_mro */ 01929 0, /* tp_cache */ 01930 0, /* tp_subclasses */ 01931 0, /* tp_weaklist */ 01932 #endif 01933 #if PY_VERSION_HEX >= 0x02030000 01934 0, /* tp_del */ 01935 #endif 01936 #if PY_VERSION_HEX >= 0x02060000 01937 0, /* tp_version */ 01938 #endif 01939 #ifdef COUNT_ALLOCS 01940 0,0,0,0 /* tp_alloc -> tp_next */ 01941 #endif 01942 }; 01943 swigpyobject_type = tmp; 01944 type_init = 1; 01945 #if PY_VERSION_HEX < 0x02020000 01946 swigpyobject_type.ob_type = &PyType_Type; 01947 #else 01948 if (PyType_Ready(&swigpyobject_type) < 0) 01949 return NULL; 01950 #endif 01951 } 01952 return &swigpyobject_type; 01953 } 01954 01955 SWIGRUNTIME PyObject * 01956 SwigPyObject_New(void *ptr, swig_type_info *ty, int own) 01957 { 01958 SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); 01959 if (sobj) { 01960 sobj->ptr = ptr; 01961 sobj->ty = ty; 01962 sobj->own = own; 01963 sobj->next = 0; 01964 } 01965 return (PyObject *)sobj; 01966 } 01967 01968 /* ----------------------------------------------------------------------------- 01969 * Implements a simple Swig Packed type, and use it instead of string 01970 * ----------------------------------------------------------------------------- */ 01971 01972 typedef struct { 01973 PyObject_HEAD 01974 void *pack; 01975 swig_type_info *ty; 01976 size_t size; 01977 } SwigPyPacked; 01978 01979 SWIGRUNTIME int 01980 SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) 01981 { 01982 char result[SWIG_BUFFER_SIZE]; 01983 fputs("<Swig Packed ", fp); 01984 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { 01985 fputs("at ", fp); 01986 fputs(result, fp); 01987 } 01988 fputs(v->ty->name,fp); 01989 fputs(">", fp); 01990 return 0; 01991 } 01992 01993 SWIGRUNTIME PyObject * 01994 SwigPyPacked_repr(SwigPyPacked *v) 01995 { 01996 char result[SWIG_BUFFER_SIZE]; 01997 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { 01998 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); 01999 } else { 02000 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); 02001 } 02002 } 02003 02004 SWIGRUNTIME PyObject * 02005 SwigPyPacked_str(SwigPyPacked *v) 02006 { 02007 char result[SWIG_BUFFER_SIZE]; 02008 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ 02009 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); 02010 } else { 02011 return SWIG_Python_str_FromChar(v->ty->name); 02012 } 02013 } 02014 02015 SWIGRUNTIME int 02016 SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) 02017 { 02018 size_t i = v->size; 02019 size_t j = w->size; 02020 int s = (i < j) ? -1 : ((i > j) ? 1 : 0); 02021 return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); 02022 } 02023 02024 SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); 02025 02026 SWIGRUNTIME PyTypeObject* 02027 SwigPyPacked_type(void) { 02028 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); 02029 return type; 02030 } 02031 02032 SWIGRUNTIMEINLINE int 02033 SwigPyPacked_Check(PyObject *op) { 02034 return ((op)->ob_type == SwigPyPacked_TypeOnce()) 02035 || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); 02036 } 02037 02038 SWIGRUNTIME void 02039 SwigPyPacked_dealloc(PyObject *v) 02040 { 02041 if (SwigPyPacked_Check(v)) { 02042 SwigPyPacked *sobj = (SwigPyPacked *) v; 02043 free(sobj->pack); 02044 } 02045 PyObject_DEL(v); 02046 } 02047 02048 SWIGRUNTIME PyTypeObject* 02049 SwigPyPacked_TypeOnce(void) { 02050 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; 02051 static PyTypeObject swigpypacked_type; 02052 static int type_init = 0; 02053 if (!type_init) { 02054 const PyTypeObject tmp = { 02055 /* PyObject header changed in Python 3 */ 02056 #if PY_VERSION_HEX>=0x03000000 02057 PyVarObject_HEAD_INIT(NULL, 0) 02058 #else 02059 PyObject_HEAD_INIT(NULL) 02060 0, /* ob_size */ 02061 #endif 02062 (char *)"SwigPyPacked", /* tp_name */ 02063 sizeof(SwigPyPacked), /* tp_basicsize */ 02064 0, /* tp_itemsize */ 02065 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ 02066 (printfunc)SwigPyPacked_print, /* tp_print */ 02067 (getattrfunc)0, /* tp_getattr */ 02068 (setattrfunc)0, /* tp_setattr */ 02069 #if PY_VERSION_HEX>=0x03000000 02070 0, /* tp_reserved in 3.0.1 */ 02071 #else 02072 (cmpfunc)SwigPyPacked_compare, /* tp_compare */ 02073 #endif 02074 (reprfunc)SwigPyPacked_repr, /* tp_repr */ 02075 0, /* tp_as_number */ 02076 0, /* tp_as_sequence */ 02077 0, /* tp_as_mapping */ 02078 (hashfunc)0, /* tp_hash */ 02079 (ternaryfunc)0, /* tp_call */ 02080 (reprfunc)SwigPyPacked_str, /* tp_str */ 02081 PyObject_GenericGetAttr, /* tp_getattro */ 02082 0, /* tp_setattro */ 02083 0, /* tp_as_buffer */ 02084 Py_TPFLAGS_DEFAULT, /* tp_flags */ 02085 swigpacked_doc, /* tp_doc */ 02086 0, /* tp_traverse */ 02087 0, /* tp_clear */ 02088 0, /* tp_richcompare */ 02089 0, /* tp_weaklistoffset */ 02090 #if PY_VERSION_HEX >= 0x02020000 02091 0, /* tp_iter */ 02092 0, /* tp_iternext */ 02093 0, /* tp_methods */ 02094 0, /* tp_members */ 02095 0, /* tp_getset */ 02096 0, /* tp_base */ 02097 0, /* tp_dict */ 02098 0, /* tp_descr_get */ 02099 0, /* tp_descr_set */ 02100 0, /* tp_dictoffset */ 02101 0, /* tp_init */ 02102 0, /* tp_alloc */ 02103 0, /* tp_new */ 02104 0, /* tp_free */ 02105 0, /* tp_is_gc */ 02106 0, /* tp_bases */ 02107 0, /* tp_mro */ 02108 0, /* tp_cache */ 02109 0, /* tp_subclasses */ 02110 0, /* tp_weaklist */ 02111 #endif 02112 #if PY_VERSION_HEX >= 0x02030000 02113 0, /* tp_del */ 02114 #endif 02115 #if PY_VERSION_HEX >= 0x02060000 02116 0, /* tp_version */ 02117 #endif 02118 #ifdef COUNT_ALLOCS 02119 0,0,0,0 /* tp_alloc -> tp_next */ 02120 #endif 02121 }; 02122 swigpypacked_type = tmp; 02123 type_init = 1; 02124 #if PY_VERSION_HEX < 0x02020000 02125 swigpypacked_type.ob_type = &PyType_Type; 02126 #else 02127 if (PyType_Ready(&swigpypacked_type) < 0) 02128 return NULL; 02129 #endif 02130 } 02131 return &swigpypacked_type; 02132 } 02133 02134 SWIGRUNTIME PyObject * 02135 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) 02136 { 02137 SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); 02138 if (sobj) { 02139 void *pack = malloc(size); 02140 if (pack) { 02141 memcpy(pack, ptr, size); 02142 sobj->pack = pack; 02143 sobj->ty = ty; 02144 sobj->size = size; 02145 } else { 02146 PyObject_DEL((PyObject *) sobj); 02147 sobj = 0; 02148 } 02149 } 02150 return (PyObject *) sobj; 02151 } 02152 02153 SWIGRUNTIME swig_type_info * 02154 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) 02155 { 02156 if (SwigPyPacked_Check(obj)) { 02157 SwigPyPacked *sobj = (SwigPyPacked *)obj; 02158 if (sobj->size != size) return 0; 02159 memcpy(ptr, sobj->pack, size); 02160 return sobj->ty; 02161 } else { 02162 return 0; 02163 } 02164 } 02165 02166 /* ----------------------------------------------------------------------------- 02167 * pointers/data manipulation 02168 * ----------------------------------------------------------------------------- */ 02169 02170 SWIGRUNTIMEINLINE PyObject * 02171 _SWIG_This(void) 02172 { 02173 return SWIG_Python_str_FromChar("this"); 02174 } 02175 02176 static PyObject *swig_this = NULL; 02177 02178 SWIGRUNTIME PyObject * 02179 SWIG_This(void) 02180 { 02181 if (swig_this == NULL) 02182 swig_this = _SWIG_This(); 02183 return swig_this; 02184 } 02185 02186 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ 02187 02188 /* TODO: I don't know how to implement the fast getset in Python 3 right now */ 02189 #if PY_VERSION_HEX>=0x03000000 02190 #define SWIG_PYTHON_SLOW_GETSET_THIS 02191 #endif 02192 02193 SWIGRUNTIME SwigPyObject * 02194 SWIG_Python_GetSwigThis(PyObject *pyobj) 02195 { 02196 PyObject *obj; 02197 02198 if (SwigPyObject_Check(pyobj)) 02199 return (SwigPyObject *) pyobj; 02200 02201 #ifdef SWIGPYTHON_BUILTIN 02202 (void)obj; 02203 # ifdef PyWeakref_CheckProxy 02204 if (PyWeakref_CheckProxy(pyobj)) { 02205 pyobj = PyWeakref_GET_OBJECT(pyobj); 02206 if (pyobj && SwigPyObject_Check(pyobj)) 02207 return (SwigPyObject*) pyobj; 02208 } 02209 # endif 02210 return NULL; 02211 #else 02212 02213 obj = 0; 02214 02215 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) 02216 if (PyInstance_Check(pyobj)) { 02217 obj = _PyInstance_Lookup(pyobj, SWIG_This()); 02218 } else { 02219 PyObject **dictptr = _PyObject_GetDictPtr(pyobj); 02220 if (dictptr != NULL) { 02221 PyObject *dict = *dictptr; 02222 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; 02223 } else { 02224 #ifdef PyWeakref_CheckProxy 02225 if (PyWeakref_CheckProxy(pyobj)) { 02226 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); 02227 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; 02228 } 02229 #endif 02230 obj = PyObject_GetAttr(pyobj,SWIG_This()); 02231 if (obj) { 02232 Py_DECREF(obj); 02233 } else { 02234 if (PyErr_Occurred()) PyErr_Clear(); 02235 return 0; 02236 } 02237 } 02238 } 02239 #else 02240 obj = PyObject_GetAttr(pyobj,SWIG_This()); 02241 if (obj) { 02242 Py_DECREF(obj); 02243 } else { 02244 if (PyErr_Occurred()) PyErr_Clear(); 02245 return 0; 02246 } 02247 #endif 02248 if (obj && !SwigPyObject_Check(obj)) { 02249 /* a PyObject is called 'this', try to get the 'real this' 02250 SwigPyObject from it */ 02251 return SWIG_Python_GetSwigThis(obj); 02252 } 02253 return (SwigPyObject *)obj; 02254 #endif 02255 } 02256 02257 /* Acquire a pointer value */ 02258 02259 SWIGRUNTIME int 02260 SWIG_Python_AcquirePtr(PyObject *obj, int own) { 02261 if (own == SWIG_POINTER_OWN) { 02262 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); 02263 if (sobj) { 02264 int oldown = sobj->own; 02265 sobj->own = own; 02266 return oldown; 02267 } 02268 } 02269 return 0; 02270 } 02271 02272 /* Convert a pointer value */ 02273 02274 SWIGRUNTIME int 02275 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { 02276 int res; 02277 SwigPyObject *sobj; 02278 02279 if (!obj) 02280 return SWIG_ERROR; 02281 if (obj == Py_None) { 02282 if (ptr) 02283 *ptr = 0; 02284 return SWIG_OK; 02285 } 02286 02287 res = SWIG_ERROR; 02288 02289 sobj = SWIG_Python_GetSwigThis(obj); 02290 if (own) 02291 *own = 0; 02292 while (sobj) { 02293 void *vptr = sobj->ptr; 02294 if (ty) { 02295 swig_type_info *to = sobj->ty; 02296 if (to == ty) { 02297 /* no type cast needed */ 02298 if (ptr) *ptr = vptr; 02299 break; 02300 } else { 02301 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); 02302 if (!tc) { 02303 sobj = (SwigPyObject *)sobj->next; 02304 } else { 02305 if (ptr) { 02306 int newmemory = 0; 02307 *ptr = SWIG_TypeCast(tc,vptr,&newmemory); 02308 if (newmemory == SWIG_CAST_NEW_MEMORY) { 02309 assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ 02310 if (own) 02311 *own = *own | SWIG_CAST_NEW_MEMORY; 02312 } 02313 } 02314 break; 02315 } 02316 } 02317 } else { 02318 if (ptr) *ptr = vptr; 02319 break; 02320 } 02321 } 02322 if (sobj) { 02323 if (own) 02324 *own = *own | sobj->own; 02325 if (flags & SWIG_POINTER_DISOWN) { 02326 sobj->own = 0; 02327 } 02328 res = SWIG_OK; 02329 } else { 02330 if (flags & SWIG_POINTER_IMPLICIT_CONV) { 02331 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; 02332 if (data && !data->implicitconv) { 02333 PyObject *klass = data->klass; 02334 if (klass) { 02335 PyObject *impconv; 02336 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ 02337 impconv = SWIG_Python_CallFunctor(klass, obj); 02338 data->implicitconv = 0; 02339 if (PyErr_Occurred()) { 02340 PyErr_Clear(); 02341 impconv = 0; 02342 } 02343 if (impconv) { 02344 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); 02345 if (iobj) { 02346 void *vptr; 02347 res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); 02348 if (SWIG_IsOK(res)) { 02349 if (ptr) { 02350 *ptr = vptr; 02351 /* transfer the ownership to 'ptr' */ 02352 iobj->own = 0; 02353 res = SWIG_AddCast(res); 02354 res = SWIG_AddNewMask(res); 02355 } else { 02356 res = SWIG_AddCast(res); 02357 } 02358 } 02359 } 02360 Py_DECREF(impconv); 02361 } 02362 } 02363 } 02364 } 02365 } 02366 return res; 02367 } 02368 02369 /* Convert a function ptr value */ 02370 02371 SWIGRUNTIME int 02372 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { 02373 if (!PyCFunction_Check(obj)) { 02374 return SWIG_ConvertPtr(obj, ptr, ty, 0); 02375 } else { 02376 void *vptr = 0; 02377 02378 /* here we get the method pointer for callbacks */ 02379 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); 02380 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; 02381 if (desc) 02382 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; 02383 if (!desc) 02384 return SWIG_ERROR; 02385 if (ty) { 02386 swig_cast_info *tc = SWIG_TypeCheck(desc,ty); 02387 if (tc) { 02388 int newmemory = 0; 02389 *ptr = SWIG_TypeCast(tc,vptr,&newmemory); 02390 assert(!newmemory); /* newmemory handling not yet implemented */ 02391 } else { 02392 return SWIG_ERROR; 02393 } 02394 } else { 02395 *ptr = vptr; 02396 } 02397 return SWIG_OK; 02398 } 02399 } 02400 02401 /* Convert a packed value value */ 02402 02403 SWIGRUNTIME int 02404 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { 02405 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); 02406 if (!to) return SWIG_ERROR; 02407 if (ty) { 02408 if (to != ty) { 02409 /* check type cast? */ 02410 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); 02411 if (!tc) return SWIG_ERROR; 02412 } 02413 } 02414 return SWIG_OK; 02415 } 02416 02417 /* ----------------------------------------------------------------------------- 02418 * Create a new pointer object 02419 * ----------------------------------------------------------------------------- */ 02420 02421 /* 02422 Create a new instance object, without calling __init__, and set the 02423 'this' attribute. 02424 */ 02425 02426 SWIGRUNTIME PyObject* 02427 SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) 02428 { 02429 #if (PY_VERSION_HEX >= 0x02020000) 02430 PyObject *inst = 0; 02431 PyObject *newraw = data->newraw; 02432 if (newraw) { 02433 inst = PyObject_Call(newraw, data->newargs, NULL); 02434 if (inst) { 02435 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) 02436 PyObject **dictptr = _PyObject_GetDictPtr(inst); 02437 if (dictptr != NULL) { 02438 PyObject *dict = *dictptr; 02439 if (dict == NULL) { 02440 dict = PyDict_New(); 02441 *dictptr = dict; 02442 PyDict_SetItem(dict, SWIG_This(), swig_this); 02443 } 02444 } 02445 #else 02446 PyObject *key = SWIG_This(); 02447 PyObject_SetAttr(inst, key, swig_this); 02448 #endif 02449 } 02450 } else { 02451 #if PY_VERSION_HEX >= 0x03000000 02452 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); 02453 PyObject_SetAttr(inst, SWIG_This(), swig_this); 02454 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; 02455 #else 02456 PyObject *dict = PyDict_New(); 02457 PyDict_SetItem(dict, SWIG_This(), swig_this); 02458 inst = PyInstance_NewRaw(data->newargs, dict); 02459 Py_DECREF(dict); 02460 #endif 02461 } 02462 return inst; 02463 #else 02464 #if (PY_VERSION_HEX >= 0x02010000) 02465 PyObject *inst; 02466 PyObject *dict = PyDict_New(); 02467 PyDict_SetItem(dict, SWIG_This(), swig_this); 02468 inst = PyInstance_NewRaw(data->newargs, dict); 02469 Py_DECREF(dict); 02470 return (PyObject *) inst; 02471 #else 02472 PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); 02473 if (inst == NULL) { 02474 return NULL; 02475 } 02476 inst->in_class = (PyClassObject *)data->newargs; 02477 Py_INCREF(inst->in_class); 02478 inst->in_dict = PyDict_New(); 02479 if (inst->in_dict == NULL) { 02480 Py_DECREF(inst); 02481 return NULL; 02482 } 02483 #ifdef Py_TPFLAGS_HAVE_WEAKREFS 02484 inst->in_weakreflist = NULL; 02485 #endif 02486 #ifdef Py_TPFLAGS_GC 02487 PyObject_GC_Init(inst); 02488 #endif 02489 PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); 02490 return (PyObject *) inst; 02491 #endif 02492 #endif 02493 } 02494 02495 SWIGRUNTIME void 02496 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) 02497 { 02498 PyObject *dict; 02499 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) 02500 PyObject **dictptr = _PyObject_GetDictPtr(inst); 02501 if (dictptr != NULL) { 02502 dict = *dictptr; 02503 if (dict == NULL) { 02504 dict = PyDict_New(); 02505 *dictptr = dict; 02506 } 02507 PyDict_SetItem(dict, SWIG_This(), swig_this); 02508 return; 02509 } 02510 #endif 02511 dict = PyObject_GetAttrString(inst, (char*)"__dict__"); 02512 PyDict_SetItem(dict, SWIG_This(), swig_this); 02513 Py_DECREF(dict); 02514 } 02515 02516 02517 SWIGINTERN PyObject * 02518 SWIG_Python_InitShadowInstance(PyObject *args) { 02519 PyObject *obj[2]; 02520 if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { 02521 return NULL; 02522 } else { 02523 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); 02524 if (sthis) { 02525 SwigPyObject_append((PyObject*) sthis, obj[1]); 02526 } else { 02527 SWIG_Python_SetSwigThis(obj[0], obj[1]); 02528 } 02529 return SWIG_Py_Void(); 02530 } 02531 } 02532 02533 /* Create a new pointer object */ 02534 02535 SWIGRUNTIME PyObject * 02536 SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { 02537 SwigPyClientData *clientdata; 02538 PyObject * robj; 02539 int own; 02540 02541 if (!ptr) 02542 return SWIG_Py_Void(); 02543 02544 clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; 02545 own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; 02546 if (clientdata && clientdata->pytype) { 02547 SwigPyObject *newobj; 02548 if (flags & SWIG_BUILTIN_TP_INIT) { 02549 newobj = (SwigPyObject*) self; 02550 if (newobj->ptr) { 02551 PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); 02552 while (newobj->next) 02553 newobj = (SwigPyObject *) newobj->next; 02554 newobj->next = next_self; 02555 newobj = (SwigPyObject *)next_self; 02556 } 02557 } else { 02558 newobj = PyObject_New(SwigPyObject, clientdata->pytype); 02559 } 02560 if (newobj) { 02561 newobj->ptr = ptr; 02562 newobj->ty = type; 02563 newobj->own = own; 02564 newobj->next = 0; 02565 #ifdef SWIGPYTHON_BUILTIN 02566 newobj->dict = 0; 02567 #endif 02568 return (PyObject*) newobj; 02569 } 02570 return SWIG_Py_Void(); 02571 } 02572 02573 assert(!(flags & SWIG_BUILTIN_TP_INIT)); 02574 02575 robj = SwigPyObject_New(ptr, type, own); 02576 if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { 02577 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); 02578 if (inst) { 02579 Py_DECREF(robj); 02580 robj = inst; 02581 } 02582 } 02583 return robj; 02584 } 02585 02586 /* Create a new packed object */ 02587 02588 SWIGRUNTIMEINLINE PyObject * 02589 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { 02590 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); 02591 } 02592 02593 /* -----------------------------------------------------------------------------* 02594 * Get type list 02595 * -----------------------------------------------------------------------------*/ 02596 02597 #ifdef SWIG_LINK_RUNTIME 02598 void *SWIG_ReturnGlobalTypeList(void *); 02599 #endif 02600 02601 SWIGRUNTIME swig_module_info * 02602 SWIG_Python_GetModule(void) { 02603 static void *type_pointer = (void *)0; 02604 /* first check if module already created */ 02605 if (!type_pointer) { 02606 #ifdef SWIG_LINK_RUNTIME 02607 type_pointer = SWIG_ReturnGlobalTypeList((void *)0); 02608 #else 02609 # ifdef SWIGPY_USE_CAPSULE 02610 type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); 02611 # else 02612 type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, 02613 (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); 02614 # endif 02615 if (PyErr_Occurred()) { 02616 PyErr_Clear(); 02617 type_pointer = (void *)0; 02618 } 02619 #endif 02620 } 02621 return (swig_module_info *) type_pointer; 02622 } 02623 02624 #if PY_MAJOR_VERSION < 2 02625 /* PyModule_AddObject function was introduced in Python 2.0. The following function 02626 is copied out of Python/modsupport.c in python version 2.3.4 */ 02627 SWIGINTERN int 02628 PyModule_AddObject(PyObject *m, char *name, PyObject *o) 02629 { 02630 PyObject *dict; 02631 if (!PyModule_Check(m)) { 02632 PyErr_SetString(PyExc_TypeError, 02633 "PyModule_AddObject() needs module as first arg"); 02634 return SWIG_ERROR; 02635 } 02636 if (!o) { 02637 PyErr_SetString(PyExc_TypeError, 02638 "PyModule_AddObject() needs non-NULL value"); 02639 return SWIG_ERROR; 02640 } 02641 02642 dict = PyModule_GetDict(m); 02643 if (dict == NULL) { 02644 /* Internal error -- modules must have a dict! */ 02645 PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", 02646 PyModule_GetName(m)); 02647 return SWIG_ERROR; 02648 } 02649 if (PyDict_SetItemString(dict, name, o)) 02650 return SWIG_ERROR; 02651 Py_DECREF(o); 02652 return SWIG_OK; 02653 } 02654 #endif 02655 02656 SWIGRUNTIME void 02657 #ifdef SWIGPY_USE_CAPSULE 02658 SWIG_Python_DestroyModule(PyObject *obj) 02659 #else 02660 SWIG_Python_DestroyModule(void *vptr) 02661 #endif 02662 { 02663 #ifdef SWIGPY_USE_CAPSULE 02664 swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); 02665 #else 02666 swig_module_info *swig_module = (swig_module_info *) vptr; 02667 #endif 02668 swig_type_info **types = swig_module->types; 02669 size_t i; 02670 for (i =0; i < swig_module->size; ++i) { 02671 swig_type_info *ty = types[i]; 02672 if (ty->owndata) { 02673 SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; 02674 if (data) SwigPyClientData_Del(data); 02675 } 02676 } 02677 Py_DECREF(SWIG_This()); 02678 swig_this = NULL; 02679 } 02680 02681 SWIGRUNTIME void 02682 SWIG_Python_SetModule(swig_module_info *swig_module) { 02683 #if PY_VERSION_HEX >= 0x03000000 02684 /* Add a dummy module object into sys.modules */ 02685 PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); 02686 #else 02687 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ 02688 PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); 02689 #endif 02690 #ifdef SWIGPY_USE_CAPSULE 02691 PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); 02692 if (pointer && module) { 02693 PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); 02694 } else { 02695 Py_XDECREF(pointer); 02696 } 02697 #else 02698 PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); 02699 if (pointer && module) { 02700 PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); 02701 } else { 02702 Py_XDECREF(pointer); 02703 } 02704 #endif 02705 } 02706 02707 /* The python cached type query */ 02708 SWIGRUNTIME PyObject * 02709 SWIG_Python_TypeCache(void) { 02710 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); 02711 return cache; 02712 } 02713 02714 SWIGRUNTIME swig_type_info * 02715 SWIG_Python_TypeQuery(const char *type) 02716 { 02717 PyObject *cache = SWIG_Python_TypeCache(); 02718 PyObject *key = SWIG_Python_str_FromChar(type); 02719 PyObject *obj = PyDict_GetItem(cache, key); 02720 swig_type_info *descriptor; 02721 if (obj) { 02722 #ifdef SWIGPY_USE_CAPSULE 02723 descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); 02724 #else 02725 descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); 02726 #endif 02727 } else { 02728 swig_module_info *swig_module = SWIG_Python_GetModule(); 02729 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); 02730 if (descriptor) { 02731 #ifdef SWIGPY_USE_CAPSULE 02732 obj = PyCapsule_New((void*) descriptor, NULL, NULL); 02733 #else 02734 obj = PyCObject_FromVoidPtr(descriptor, NULL); 02735 #endif 02736 PyDict_SetItem(cache, key, obj); 02737 Py_DECREF(obj); 02738 } 02739 } 02740 Py_DECREF(key); 02741 return descriptor; 02742 } 02743 02744 /* 02745 For backward compatibility only 02746 */ 02747 #define SWIG_POINTER_EXCEPTION 0 02748 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) 02749 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) 02750 02751 SWIGRUNTIME int 02752 SWIG_Python_AddErrMesg(const char* mesg, int infront) 02753 { 02754 if (PyErr_Occurred()) { 02755 PyObject *type = 0; 02756 PyObject *value = 0; 02757 PyObject *traceback = 0; 02758 PyErr_Fetch(&type, &value, &traceback); 02759 if (value) { 02760 char *tmp; 02761 PyObject *old_str = PyObject_Str(value); 02762 Py_XINCREF(type); 02763 PyErr_Clear(); 02764 if (infront) { 02765 PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); 02766 } else { 02767 PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); 02768 } 02769 SWIG_Python_str_DelForPy3(tmp); 02770 Py_DECREF(old_str); 02771 } 02772 return 1; 02773 } else { 02774 return 0; 02775 } 02776 } 02777 02778 SWIGRUNTIME int 02779 SWIG_Python_ArgFail(int argnum) 02780 { 02781 if (PyErr_Occurred()) { 02782 /* add information about failing argument */ 02783 char mesg[256]; 02784 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); 02785 return SWIG_Python_AddErrMesg(mesg, 1); 02786 } else { 02787 return 0; 02788 } 02789 } 02790 02791 SWIGRUNTIMEINLINE const char * 02792 SwigPyObject_GetDesc(PyObject *self) 02793 { 02794 SwigPyObject *v = (SwigPyObject *)self; 02795 swig_type_info *ty = v ? v->ty : 0; 02796 return ty ? ty->str : (char*)""; 02797 } 02798 02799 SWIGRUNTIME void 02800 SWIG_Python_TypeError(const char *type, PyObject *obj) 02801 { 02802 if (type) { 02803 #if defined(SWIG_COBJECT_TYPES) 02804 if (obj && SwigPyObject_Check(obj)) { 02805 const char *otype = (const char *) SwigPyObject_GetDesc(obj); 02806 if (otype) { 02807 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", 02808 type, otype); 02809 return; 02810 } 02811 } else 02812 #endif 02813 { 02814 const char *otype = (obj ? obj->ob_type->tp_name : 0); 02815 if (otype) { 02816 PyObject *str = PyObject_Str(obj); 02817 const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; 02818 if (cstr) { 02819 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", 02820 type, otype, cstr); 02821 SWIG_Python_str_DelForPy3(cstr); 02822 } else { 02823 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", 02824 type, otype); 02825 } 02826 Py_XDECREF(str); 02827 return; 02828 } 02829 } 02830 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); 02831 } else { 02832 PyErr_Format(PyExc_TypeError, "unexpected type is received"); 02833 } 02834 } 02835 02836 02837 /* Convert a pointer value, signal an exception on a type mismatch */ 02838 SWIGRUNTIME void * 02839 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { 02840 void *result; 02841 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { 02842 PyErr_Clear(); 02843 #if SWIG_POINTER_EXCEPTION 02844 if (flags) { 02845 SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); 02846 SWIG_Python_ArgFail(argnum); 02847 } 02848 #endif 02849 } 02850 return result; 02851 } 02852 02853 SWIGRUNTIME int 02854 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { 02855 PyTypeObject *tp = obj->ob_type; 02856 PyObject *descr; 02857 PyObject *encoded_name; 02858 descrsetfunc f; 02859 int res; 02860 02861 #ifdef Py_USING_UNICODE 02862 if (PyString_Check(name)) { 02863 name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); 02864 if (!name) 02865 return -1; 02866 } else if (!PyUnicode_Check(name)) 02867 #else 02868 if (!PyString_Check(name)) 02869 #endif 02870 { 02871 PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); 02872 return -1; 02873 } else { 02874 Py_INCREF(name); 02875 } 02876 02877 if (!tp->tp_dict) { 02878 if (PyType_Ready(tp) < 0) 02879 goto done; 02880 } 02881 02882 res = -1; 02883 descr = _PyType_Lookup(tp, name); 02884 f = NULL; 02885 if (descr != NULL) 02886 f = descr->ob_type->tp_descr_set; 02887 if (!f) { 02888 if (PyString_Check(name)) { 02889 encoded_name = name; 02890 Py_INCREF(name); 02891 } else { 02892 encoded_name = PyUnicode_AsUTF8String(name); 02893 } 02894 PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); 02895 Py_DECREF(encoded_name); 02896 } else { 02897 res = f(descr, obj, value); 02898 } 02899 02900 done: 02901 Py_DECREF(name); 02902 return res; 02903 } 02904 02905 02906 #ifdef __cplusplus 02907 } 02908 #endif 02909 /* -----------------------------------------------------------------------------* 02910 Standard SWIG API for use inside user code. 02911 02912 Don't include this file directly, run the command 02913 swig -python -external-runtime 02914 Also, read the Modules chapter of the SWIG Manual. 02915 02916 * -----------------------------------------------------------------------------*/ 02917 02918 #ifdef SWIG_MODULE_CLIENTDATA_TYPE 02919 02920 SWIGRUNTIMEINLINE swig_type_info * 02921 SWIG_TypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) { 02922 swig_module_info *module = SWIG_GetModule(clientdata); 02923 return SWIG_TypeQueryModule(module, module, name); 02924 } 02925 02926 SWIGRUNTIMEINLINE swig_type_info * 02927 SWIG_MangledTypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) { 02928 swig_module_info *module = SWIG_GetModule(clientdata); 02929 return SWIG_MangledTypeQueryModule(module, module, name); 02930 } 02931 02932 #else 02933 02934 SWIGRUNTIMEINLINE swig_type_info * 02935 SWIG_TypeQuery(const char *name) { 02936 swig_module_info *module = SWIG_GetModule(NULL); 02937 return SWIG_TypeQueryModule(module, module, name); 02938 } 02939 02940 SWIGRUNTIMEINLINE swig_type_info * 02941 SWIG_MangledTypeQuery(const char *name) { 02942 swig_module_info *module = SWIG_GetModule(NULL); 02943 return SWIG_MangledTypeQueryModule(module, module, name); 02944 } 02945 02946 #endif