cuser_form_wrap.c 88 KB

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