cuser_form54_wrap.c 95 KB

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