esl_wrap.cpp 143 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 3.0.2
  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 SWIGLUA
  11. #define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA
  12. #define SWIG_LUA_MODULE_GLOBAL
  13. #ifdef __cplusplus
  14. /* SwigValueWrapper is described in swig.swg */
  15. template<typename T> class SwigValueWrapper {
  16. struct SwigMovePointer {
  17. T *ptr;
  18. SwigMovePointer(T *p) : ptr(p) { }
  19. ~SwigMovePointer() { delete ptr; }
  20. SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
  21. } pointer;
  22. SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
  23. SwigValueWrapper(const SwigValueWrapper<T>& rhs);
  24. public:
  25. SwigValueWrapper() : pointer(0) { }
  26. SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
  27. operator T&() const { return *pointer.ptr; }
  28. T *operator&() { return pointer.ptr; }
  29. };
  30. template <typename T> T SwigValueInit() {
  31. return T();
  32. }
  33. #endif
  34. /* -----------------------------------------------------------------------------
  35. * This section contains generic SWIG labels for method/variable
  36. * declarations/attributes, and other compiler dependent labels.
  37. * ----------------------------------------------------------------------------- */
  38. /* template workaround for compilers that cannot correctly implement the C++ standard */
  39. #ifndef SWIGTEMPLATEDISAMBIGUATOR
  40. # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
  41. # define SWIGTEMPLATEDISAMBIGUATOR template
  42. # elif defined(__HP_aCC)
  43. /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
  44. /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
  45. # define SWIGTEMPLATEDISAMBIGUATOR template
  46. # else
  47. # define SWIGTEMPLATEDISAMBIGUATOR
  48. # endif
  49. #endif
  50. /* inline attribute */
  51. #ifndef SWIGINLINE
  52. # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
  53. # define SWIGINLINE inline
  54. # else
  55. # define SWIGINLINE
  56. # endif
  57. #endif
  58. /* attribute recognised by some compilers to avoid 'unused' warnings */
  59. #ifndef SWIGUNUSED
  60. # if defined(__GNUC__)
  61. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  62. # define SWIGUNUSED __attribute__ ((__unused__))
  63. # else
  64. # define SWIGUNUSED
  65. # endif
  66. # elif defined(__ICC)
  67. # define SWIGUNUSED __attribute__ ((__unused__))
  68. # else
  69. # define SWIGUNUSED
  70. # endif
  71. #endif
  72. #ifndef SWIG_MSC_UNSUPPRESS_4505
  73. # if defined(_MSC_VER)
  74. # pragma warning(disable : 4505) /* unreferenced local function has been removed */
  75. # endif
  76. #endif
  77. #ifndef SWIGUNUSEDPARM
  78. # ifdef __cplusplus
  79. # define SWIGUNUSEDPARM(p)
  80. # else
  81. # define SWIGUNUSEDPARM(p) p SWIGUNUSED
  82. # endif
  83. #endif
  84. /* internal SWIG method */
  85. #ifndef SWIGINTERN
  86. # define SWIGINTERN static SWIGUNUSED
  87. #endif
  88. /* internal inline SWIG method */
  89. #ifndef SWIGINTERNINLINE
  90. # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
  91. #endif
  92. /* exporting methods */
  93. #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
  94. # ifndef GCC_HASCLASSVISIBILITY
  95. # define GCC_HASCLASSVISIBILITY
  96. # endif
  97. #endif
  98. #ifndef SWIGEXPORT
  99. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  100. # if defined(STATIC_LINKED)
  101. # define SWIGEXPORT
  102. # else
  103. # define SWIGEXPORT __declspec(dllexport)
  104. # endif
  105. # else
  106. # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
  107. # define SWIGEXPORT __attribute__ ((visibility("default")))
  108. # else
  109. # define SWIGEXPORT
  110. # endif
  111. # endif
  112. #endif
  113. /* calling conventions for Windows */
  114. #ifndef SWIGSTDCALL
  115. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  116. # define SWIGSTDCALL __stdcall
  117. # else
  118. # define SWIGSTDCALL
  119. # endif
  120. #endif
  121. /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
  122. #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
  123. # define _CRT_SECURE_NO_DEPRECATE
  124. #endif
  125. /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
  126. #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
  127. # define _SCL_SECURE_NO_DEPRECATE
  128. #endif
  129. /* -----------------------------------------------------------------------------
  130. * swigrun.swg
  131. *
  132. * This file contains generic C API SWIG runtime support for pointer
  133. * type checking.
  134. * ----------------------------------------------------------------------------- */
  135. /* This should only be incremented when either the layout of swig_type_info changes,
  136. or for whatever reason, the runtime changes incompatibly */
  137. #define SWIG_RUNTIME_VERSION "4"
  138. /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
  139. #ifdef SWIG_TYPE_TABLE
  140. # define SWIG_QUOTE_STRING(x) #x
  141. # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
  142. # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
  143. #else
  144. # define SWIG_TYPE_TABLE_NAME
  145. #endif
  146. /*
  147. You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  148. creating a static or dynamic library from the SWIG runtime code.
  149. In 99.9% of the cases, SWIG just needs to declare them as 'static'.
  150. But only do this if strictly necessary, ie, if you have problems
  151. with your compiler or suchlike.
  152. */
  153. #ifndef SWIGRUNTIME
  154. # define SWIGRUNTIME SWIGINTERN
  155. #endif
  156. #ifndef SWIGRUNTIMEINLINE
  157. # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
  158. #endif
  159. /* Generic buffer size */
  160. #ifndef SWIG_BUFFER_SIZE
  161. # define SWIG_BUFFER_SIZE 1024
  162. #endif
  163. /* Flags for pointer conversions */
  164. #define SWIG_POINTER_DISOWN 0x1
  165. #define SWIG_CAST_NEW_MEMORY 0x2
  166. /* Flags for new pointer objects */
  167. #define SWIG_POINTER_OWN 0x1
  168. /*
  169. Flags/methods for returning states.
  170. The SWIG conversion methods, as ConvertPtr, return an integer
  171. that tells if the conversion was successful or not. And if not,
  172. an error code can be returned (see swigerrors.swg for the codes).
  173. Use the following macros/flags to set or process the returning
  174. states.
  175. In old versions of SWIG, code such as the following was usually written:
  176. if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
  177. // success code
  178. } else {
  179. //fail code
  180. }
  181. Now you can be more explicit:
  182. int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
  183. if (SWIG_IsOK(res)) {
  184. // success code
  185. } else {
  186. // fail code
  187. }
  188. which is the same really, but now you can also do
  189. Type *ptr;
  190. int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
  191. if (SWIG_IsOK(res)) {
  192. // success code
  193. if (SWIG_IsNewObj(res) {
  194. ...
  195. delete *ptr;
  196. } else {
  197. ...
  198. }
  199. } else {
  200. // fail code
  201. }
  202. I.e., now SWIG_ConvertPtr can return new objects and you can
  203. identify the case and take care of the deallocation. Of course that
  204. also requires SWIG_ConvertPtr to return new result values, such as
  205. int SWIG_ConvertPtr(obj, ptr,...) {
  206. if (<obj is ok>) {
  207. if (<need new object>) {
  208. *ptr = <ptr to new allocated object>;
  209. return SWIG_NEWOBJ;
  210. } else {
  211. *ptr = <ptr to old object>;
  212. return SWIG_OLDOBJ;
  213. }
  214. } else {
  215. return SWIG_BADOBJ;
  216. }
  217. }
  218. Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
  219. more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
  220. SWIG errors code.
  221. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
  222. allows to return the 'cast rank', for example, if you have this
  223. int food(double)
  224. int fooi(int);
  225. and you call
  226. food(1) // cast rank '1' (1 -> 1.0)
  227. fooi(1) // cast rank '0'
  228. just use the SWIG_AddCast()/SWIG_CheckState()
  229. */
  230. #define SWIG_OK (0)
  231. #define SWIG_ERROR (-1)
  232. #define SWIG_IsOK(r) (r >= 0)
  233. #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
  234. /* The CastRankLimit says how many bits are used for the cast rank */
  235. #define SWIG_CASTRANKLIMIT (1 << 8)
  236. /* The NewMask denotes the object was created (using new/malloc) */
  237. #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
  238. /* The TmpMask is for in/out typemaps that use temporal objects */
  239. #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
  240. /* Simple returning values */
  241. #define SWIG_BADOBJ (SWIG_ERROR)
  242. #define SWIG_OLDOBJ (SWIG_OK)
  243. #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
  244. #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
  245. /* Check, add and del mask methods */
  246. #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
  247. #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
  248. #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
  249. #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
  250. #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
  251. #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
  252. /* Cast-Rank Mode */
  253. #if defined(SWIG_CASTRANK_MODE)
  254. # ifndef SWIG_TypeRank
  255. # define SWIG_TypeRank unsigned long
  256. # endif
  257. # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
  258. # define SWIG_MAXCASTRANK (2)
  259. # endif
  260. # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
  261. # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
  262. SWIGINTERNINLINE int SWIG_AddCast(int r) {
  263. return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
  264. }
  265. SWIGINTERNINLINE int SWIG_CheckState(int r) {
  266. return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
  267. }
  268. #else /* no cast-rank mode */
  269. # define SWIG_AddCast(r) (r)
  270. # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
  271. #endif
  272. #include <string.h>
  273. #ifdef __cplusplus
  274. extern "C" {
  275. #endif
  276. typedef void *(*swig_converter_func)(void *, int *);
  277. typedef struct swig_type_info *(*swig_dycast_func)(void **);
  278. /* Structure to store information on one type */
  279. typedef struct swig_type_info {
  280. const char *name; /* mangled name of this type */
  281. const char *str; /* human readable name of this type */
  282. swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
  283. struct swig_cast_info *cast; /* linked list of types that can cast into this type */
  284. void *clientdata; /* language specific type data */
  285. int owndata; /* flag if the structure owns the clientdata */
  286. } swig_type_info;
  287. /* Structure to store a type and conversion function used for casting */
  288. typedef struct swig_cast_info {
  289. swig_type_info *type; /* pointer to type that is equivalent to this type */
  290. swig_converter_func converter; /* function to cast the void pointers */
  291. struct swig_cast_info *next; /* pointer to next cast in linked list */
  292. struct swig_cast_info *prev; /* pointer to the previous cast */
  293. } swig_cast_info;
  294. /* Structure used to store module information
  295. * Each module generates one structure like this, and the runtime collects
  296. * all of these structures and stores them in a circularly linked list.*/
  297. typedef struct swig_module_info {
  298. swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
  299. size_t size; /* Number of types in this module */
  300. struct swig_module_info *next; /* Pointer to next element in circularly linked list */
  301. swig_type_info **type_initial; /* Array of initially generated type structures */
  302. swig_cast_info **cast_initial; /* Array of initially generated casting structures */
  303. void *clientdata; /* Language specific module data */
  304. } swig_module_info;
  305. /*
  306. Compare two type names skipping the space characters, therefore
  307. "char*" == "char *" and "Class<int>" == "Class<int >", etc.
  308. Return 0 when the two name types are equivalent, as in
  309. strncmp, but skipping ' '.
  310. */
  311. SWIGRUNTIME int
  312. SWIG_TypeNameComp(const char *f1, const char *l1,
  313. const char *f2, const char *l2) {
  314. for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
  315. while ((*f1 == ' ') && (f1 != l1)) ++f1;
  316. while ((*f2 == ' ') && (f2 != l2)) ++f2;
  317. if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  318. }
  319. return (int)((l1 - f1) - (l2 - f2));
  320. }
  321. /*
  322. Check type equivalence in a name list like <name1>|<name2>|...
  323. Return 0 if equal, -1 if nb < tb, 1 if nb > tb
  324. */
  325. SWIGRUNTIME int
  326. SWIG_TypeCmp(const char *nb, const char *tb) {
  327. int equiv = 1;
  328. const char* te = tb + strlen(tb);
  329. const char* ne = nb;
  330. while (equiv != 0 && *ne) {
  331. for (nb = ne; *ne; ++ne) {
  332. if (*ne == '|') break;
  333. }
  334. equiv = SWIG_TypeNameComp(nb, ne, tb, te);
  335. if (*ne) ++ne;
  336. }
  337. return equiv;
  338. }
  339. /*
  340. Check type equivalence in a name list like <name1>|<name2>|...
  341. Return 0 if not equal, 1 if equal
  342. */
  343. SWIGRUNTIME int
  344. SWIG_TypeEquiv(const char *nb, const char *tb) {
  345. return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
  346. }
  347. /*
  348. Check the typename
  349. */
  350. SWIGRUNTIME swig_cast_info *
  351. SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  352. if (ty) {
  353. swig_cast_info *iter = ty->cast;
  354. while (iter) {
  355. if (strcmp(iter->type->name, c) == 0) {
  356. if (iter == ty->cast)
  357. return iter;
  358. /* Move iter to the top of the linked list */
  359. iter->prev->next = iter->next;
  360. if (iter->next)
  361. iter->next->prev = iter->prev;
  362. iter->next = ty->cast;
  363. iter->prev = 0;
  364. if (ty->cast) ty->cast->prev = iter;
  365. ty->cast = iter;
  366. return iter;
  367. }
  368. iter = iter->next;
  369. }
  370. }
  371. return 0;
  372. }
  373. /*
  374. Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
  375. */
  376. SWIGRUNTIME swig_cast_info *
  377. SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
  378. if (ty) {
  379. swig_cast_info *iter = ty->cast;
  380. while (iter) {
  381. if (iter->type == from) {
  382. if (iter == ty->cast)
  383. return iter;
  384. /* Move iter to the top of the linked list */
  385. iter->prev->next = iter->next;
  386. if (iter->next)
  387. iter->next->prev = iter->prev;
  388. iter->next = ty->cast;
  389. iter->prev = 0;
  390. if (ty->cast) ty->cast->prev = iter;
  391. ty->cast = iter;
  392. return iter;
  393. }
  394. iter = iter->next;
  395. }
  396. }
  397. return 0;
  398. }
  399. /*
  400. Cast a pointer up an inheritance hierarchy
  401. */
  402. SWIGRUNTIMEINLINE void *
  403. SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  404. return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
  405. }
  406. /*
  407. Dynamic pointer casting. Down an inheritance hierarchy
  408. */
  409. SWIGRUNTIME swig_type_info *
  410. SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  411. swig_type_info *lastty = ty;
  412. if (!ty || !ty->dcast) return ty;
  413. while (ty && (ty->dcast)) {
  414. ty = (*ty->dcast)(ptr);
  415. if (ty) lastty = ty;
  416. }
  417. return lastty;
  418. }
  419. /*
  420. Return the name associated with this type
  421. */
  422. SWIGRUNTIMEINLINE const char *
  423. SWIG_TypeName(const swig_type_info *ty) {
  424. return ty->name;
  425. }
  426. /*
  427. Return the pretty name associated with this type,
  428. that is an unmangled type name in a form presentable to the user.
  429. */
  430. SWIGRUNTIME const char *
  431. SWIG_TypePrettyName(const swig_type_info *type) {
  432. /* The "str" field contains the equivalent pretty names of the
  433. type, separated by vertical-bar characters. We choose
  434. to print the last name, as it is often (?) the most
  435. specific. */
  436. if (!type) return NULL;
  437. if (type->str != NULL) {
  438. const char *last_name = type->str;
  439. const char *s;
  440. for (s = type->str; *s; s++)
  441. if (*s == '|') last_name = s+1;
  442. return last_name;
  443. }
  444. else
  445. return type->name;
  446. }
  447. /*
  448. Set the clientdata field for a type
  449. */
  450. SWIGRUNTIME void
  451. SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  452. swig_cast_info *cast = ti->cast;
  453. /* if (ti->clientdata == clientdata) return; */
  454. ti->clientdata = clientdata;
  455. while (cast) {
  456. if (!cast->converter) {
  457. swig_type_info *tc = cast->type;
  458. if (!tc->clientdata) {
  459. SWIG_TypeClientData(tc, clientdata);
  460. }
  461. }
  462. cast = cast->next;
  463. }
  464. }
  465. SWIGRUNTIME void
  466. SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  467. SWIG_TypeClientData(ti, clientdata);
  468. ti->owndata = 1;
  469. }
  470. /*
  471. Search for a swig_type_info structure only by mangled name
  472. Search is a O(log #types)
  473. We start searching at module start, and finish searching when start == end.
  474. Note: if start == end at the beginning of the function, we go all the way around
  475. the circular list.
  476. */
  477. SWIGRUNTIME swig_type_info *
  478. SWIG_MangledTypeQueryModule(swig_module_info *start,
  479. swig_module_info *end,
  480. const char *name) {
  481. swig_module_info *iter = start;
  482. do {
  483. if (iter->size) {
  484. size_t l = 0;
  485. size_t r = iter->size - 1;
  486. do {
  487. /* since l+r >= 0, we can (>> 1) instead (/ 2) */
  488. size_t i = (l + r) >> 1;
  489. const char *iname = iter->types[i]->name;
  490. if (iname) {
  491. int compare = strcmp(name, iname);
  492. if (compare == 0) {
  493. return iter->types[i];
  494. } else if (compare < 0) {
  495. if (i) {
  496. r = i - 1;
  497. } else {
  498. break;
  499. }
  500. } else if (compare > 0) {
  501. l = i + 1;
  502. }
  503. } else {
  504. break; /* should never happen */
  505. }
  506. } while (l <= r);
  507. }
  508. iter = iter->next;
  509. } while (iter != end);
  510. return 0;
  511. }
  512. /*
  513. Search for a swig_type_info structure for either a mangled name or a human readable name.
  514. It first searches the mangled names of the types, which is a O(log #types)
  515. If a type is not found it then searches the human readable names, which is O(#types).
  516. We start searching at module start, and finish searching when start == end.
  517. Note: if start == end at the beginning of the function, we go all the way around
  518. the circular list.
  519. */
  520. SWIGRUNTIME swig_type_info *
  521. SWIG_TypeQueryModule(swig_module_info *start,
  522. swig_module_info *end,
  523. const char *name) {
  524. /* STEP 1: Search the name field using binary search */
  525. swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  526. if (ret) {
  527. return ret;
  528. } else {
  529. /* STEP 2: If the type hasn't been found, do a complete search
  530. of the str field (the human readable name) */
  531. swig_module_info *iter = start;
  532. do {
  533. size_t i = 0;
  534. for (; i < iter->size; ++i) {
  535. if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
  536. return iter->types[i];
  537. }
  538. iter = iter->next;
  539. } while (iter != end);
  540. }
  541. /* neither found a match */
  542. return 0;
  543. }
  544. /*
  545. Pack binary data into a string
  546. */
  547. SWIGRUNTIME char *
  548. SWIG_PackData(char *c, void *ptr, size_t sz) {
  549. static const char hex[17] = "0123456789abcdef";
  550. const unsigned char *u = (unsigned char *) ptr;
  551. const unsigned char *eu = u + sz;
  552. for (; u != eu; ++u) {
  553. unsigned char uu = *u;
  554. *(c++) = hex[(uu & 0xf0) >> 4];
  555. *(c++) = hex[uu & 0xf];
  556. }
  557. return c;
  558. }
  559. /*
  560. Unpack binary data from a string
  561. */
  562. SWIGRUNTIME const char *
  563. SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  564. unsigned char *u = (unsigned char *) ptr;
  565. const unsigned char *eu = u + sz;
  566. for (; u != eu; ++u) {
  567. char d = *(c++);
  568. unsigned char uu;
  569. if ((d >= '0') && (d <= '9'))
  570. uu = ((d - '0') << 4);
  571. else if ((d >= 'a') && (d <= 'f'))
  572. uu = ((d - ('a'-10)) << 4);
  573. else
  574. return (char *) 0;
  575. d = *(c++);
  576. if ((d >= '0') && (d <= '9'))
  577. uu |= (d - '0');
  578. else if ((d >= 'a') && (d <= 'f'))
  579. uu |= (d - ('a'-10));
  580. else
  581. return (char *) 0;
  582. *u = uu;
  583. }
  584. return c;
  585. }
  586. /*
  587. Pack 'void *' into a string buffer.
  588. */
  589. SWIGRUNTIME char *
  590. SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  591. char *r = buff;
  592. if ((2*sizeof(void *) + 2) > bsz) return 0;
  593. *(r++) = '_';
  594. r = SWIG_PackData(r,&ptr,sizeof(void *));
  595. if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  596. strcpy(r,name);
  597. return buff;
  598. }
  599. SWIGRUNTIME const char *
  600. SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  601. if (*c != '_') {
  602. if (strcmp(c,"NULL") == 0) {
  603. *ptr = (void *) 0;
  604. return name;
  605. } else {
  606. return 0;
  607. }
  608. }
  609. return SWIG_UnpackData(++c,ptr,sizeof(void *));
  610. }
  611. SWIGRUNTIME char *
  612. SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  613. char *r = buff;
  614. size_t lname = (name ? strlen(name) : 0);
  615. if ((2*sz + 2 + lname) > bsz) return 0;
  616. *(r++) = '_';
  617. r = SWIG_PackData(r,ptr,sz);
  618. if (lname) {
  619. strncpy(r,name,lname+1);
  620. } else {
  621. *r = 0;
  622. }
  623. return buff;
  624. }
  625. SWIGRUNTIME const char *
  626. SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  627. if (*c != '_') {
  628. if (strcmp(c,"NULL") == 0) {
  629. memset(ptr,0,sz);
  630. return name;
  631. } else {
  632. return 0;
  633. }
  634. }
  635. return SWIG_UnpackData(++c,ptr,sz);
  636. }
  637. #ifdef __cplusplus
  638. }
  639. #endif
  640. /* -----------------------------------------------------------------------------
  641. * luarun.swg
  642. *
  643. * This file contains the runtime support for Lua modules
  644. * and includes code for managing global variables and pointer
  645. * type checking.
  646. * ----------------------------------------------------------------------------- */
  647. #ifdef __cplusplus
  648. extern "C" {
  649. #endif
  650. #include "lua.h"
  651. #include "lauxlib.h"
  652. #include <stdlib.h> /* for malloc */
  653. #include <assert.h> /* for a few sanity tests */
  654. /* -----------------------------------------------------------------------------
  655. * Lua flavors
  656. * ----------------------------------------------------------------------------- */
  657. #define SWIG_LUA_FLAVOR_LUA 1
  658. #define SWIG_LUA_FLAVOR_ELUA 2
  659. #define SWIG_LUA_FLAVOR_ELUAC 3
  660. #if !defined(SWIG_LUA_TARGET)
  661. # error SWIG_LUA_TARGET not defined
  662. #endif
  663. #if defined(SWIG_LUA_ELUA_EMULATE)
  664. struct swig_elua_entry;
  665. typedef struct swig_elua_key {
  666. int type;
  667. union {
  668. const char* strkey;
  669. lua_Number numkey;
  670. } key;
  671. } swig_elua_key;
  672. typedef struct swig_elua_val {
  673. int type;
  674. union {
  675. lua_Number number;
  676. const struct swig_elua_entry *table;
  677. const char *string;
  678. lua_CFunction function;
  679. struct {
  680. char member;
  681. long lvalue;
  682. void *pvalue;
  683. swig_type_info **ptype;
  684. } userdata;
  685. } value;
  686. } swig_elua_val;
  687. typedef struct swig_elua_entry {
  688. swig_elua_key key;
  689. swig_elua_val value;
  690. } swig_elua_entry;
  691. #define LSTRKEY(x) {LUA_TSTRING, {.strkey = x} }
  692. #define LNUMKEY(x) {LUA_TNUMBER, {.numkey = x} }
  693. #define LNILKEY {LUA_TNIL, {.strkey = 0} }
  694. #define LNUMVAL(x) {LUA_TNUMBER, {.number = x} }
  695. #define LFUNCVAL(x) {LUA_TFUNCTION, {.function = x} }
  696. #define LROVAL(x) {LUA_TTABLE, {.table = x} }
  697. #define LNILVAL {LUA_TNIL, {.string = 0} }
  698. #define LSTRVAL(x) {LUA_TSTRING, {.string = x} }
  699. #define LUA_REG_TYPE swig_elua_entry
  700. #define SWIG_LUA_ELUA_EMUL_METATABLE_KEY "__metatable"
  701. #define lua_pushrotable(L,p)\
  702. lua_newtable(L);\
  703. assert(p);\
  704. SWIG_Lua_elua_emulate_register(L,(swig_elua_entry*)(p));
  705. #define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\
  706. LSTRKEY(B), {LUA_TUSERDATA, { .userdata={0,0,(void*)(C),&D} } }
  707. #define SWIG_LUA_CONSTTAB_BINARY(B,S,C,D)\
  708. LSTRKEY(B), {LUA_TUSERDATA, { .userdata={1,S,(void*)(C),&D} } }
  709. #endif
  710. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
  711. # define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
  712. # define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
  713. # define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
  714. # define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
  715. /* Those two types of constants are not supported in elua */
  716. #ifndef SWIG_LUA_CONSTTAB_POINTER
  717. #warning eLua does not support pointers as constants. By default, nil will be used as value
  718. #define SWIG_LUA_CONSTTAB_POINTER(B,C,D) LSTRKEY(B), LNILVAL
  719. #endif
  720. #ifndef SWIG_LUA_CONSTTAB_BINARY
  721. #warning eLua does not support pointers to member as constants. By default, nil will be used as value
  722. #define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D) LSTRKEY(B), LNILVAL
  723. #endif
  724. #else /* SWIG_LUA_FLAVOR_LUA */
  725. # define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
  726. # define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
  727. # define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
  728. # define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
  729. # define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\
  730. SWIG_LUA_POINTER, (char *)B, 0, 0, (void *)C, &D
  731. # define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D)\
  732. SWIG_LUA_BINARY, (char *)B, S, 0, (void *)C, &D
  733. #endif
  734. #ifndef SWIG_LUA_ELUA_EMULATE
  735. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
  736. # define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
  737. # define LSTRVAL LRO_STRVAL
  738. #endif
  739. #endif /* SWIG_LUA_ELUA_EMULATE*/
  740. #ifndef SWIG_LUA_ELUA_EMULATE
  741. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
  742. #ifndef MIN_OPT_LEVEL
  743. #define MIN_OPT_LEVEL 2
  744. #endif
  745. #include "lrodefs.h"
  746. #include "lrotable.h"
  747. #endif
  748. #endif /* SWIG_LUA_ELUA_EMULATE*/
  749. /* -----------------------------------------------------------------------------
  750. * compatibility defines
  751. * ----------------------------------------------------------------------------- */
  752. /* History of Lua C API length functions: In Lua 5.0 (and before?)
  753. there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen",
  754. but a compatibility define of "lua_strlen" was added. In Lua 5.2,
  755. this function was again renamed, to "lua_rawlen" (to emphasize that
  756. it doesn't call the "__len" metamethod), and the compatibility
  757. define of lua_strlen was removed. All SWIG uses have been updated
  758. to "lua_rawlen", and we add our own defines of that here for older
  759. versions of Lua. */
  760. #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
  761. # define lua_rawlen lua_strlen
  762. #elif LUA_VERSION_NUM == 501
  763. # define lua_rawlen lua_objlen
  764. #endif
  765. /* lua_pushglobaltable is the recommended "future-proof" way to get
  766. the global table for Lua 5.2 and later. Here we define
  767. lua_pushglobaltable ourselves for Lua versions before 5.2. */
  768. #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
  769. # define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
  770. #endif
  771. /* lua_absindex was introduced in Lua 5.2 */
  772. #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
  773. # define lua_absindex(L,i) ((i)>0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
  774. #endif
  775. /* lua_rawsetp was introduced in Lua 5.2 */
  776. #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
  777. #define lua_rawsetp(L,index,ptr)\
  778. lua_pushlightuserdata(L,(void*)(ptr));\
  779. lua_insert(L,-2);\
  780. lua_rawset(L,index);
  781. #define lua_rawgetp(L,index,ptr)\
  782. lua_pushlightuserdata(L,(void*)(ptr));\
  783. lua_rawget(L,index);
  784. #endif
  785. /* --------------------------------------------------------------------------
  786. * Helper functions for error handling
  787. * -------------------------------------------------------------------------- */
  788. /* Push the string STR on the Lua stack, like lua_pushstring, but
  789. prefixed with the the location of the innermost Lua call-point
  790. (as formated by luaL_where). */
  791. SWIGRUNTIME void
  792. SWIG_Lua_pusherrstring (lua_State *L, const char *str)
  793. {
  794. luaL_where (L, 1);
  795. lua_pushstring (L, str);
  796. lua_concat (L, 2);
  797. }
  798. /* Push a formatted string generated from FMT and following args on
  799. the Lua stack, like lua_pushfstring, but prefixed with the the
  800. location of the innermost Lua call-point (as formated by luaL_where). */
  801. SWIGRUNTIME void
  802. SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
  803. {
  804. va_list argp;
  805. va_start(argp, fmt);
  806. luaL_where(L, 1);
  807. lua_pushvfstring(L, fmt, argp);
  808. va_end(argp);
  809. lua_concat(L, 2);
  810. }
  811. /* -----------------------------------------------------------------------------
  812. * global swig types
  813. * ----------------------------------------------------------------------------- */
  814. /* Constant table */
  815. #define SWIG_LUA_INT 1
  816. #define SWIG_LUA_FLOAT 2
  817. #define SWIG_LUA_STRING 3
  818. #define SWIG_LUA_POINTER 4
  819. #define SWIG_LUA_BINARY 5
  820. #define SWIG_LUA_CHAR 6
  821. /* Structure for variable linking table */
  822. typedef struct {
  823. const char *name;
  824. lua_CFunction get;
  825. lua_CFunction set;
  826. } swig_lua_var_info;
  827. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
  828. typedef const LUA_REG_TYPE swig_lua_method;
  829. typedef const LUA_REG_TYPE swig_lua_const_info;
  830. #else /* Normal lua */
  831. typedef luaL_Reg swig_lua_method;
  832. /* Constant information structure */
  833. typedef struct {
  834. int type;
  835. char *name;
  836. long lvalue;
  837. double dvalue;
  838. void *pvalue;
  839. swig_type_info **ptype;
  840. } swig_lua_const_info;
  841. #endif
  842. typedef struct {
  843. const char *name;
  844. lua_CFunction getmethod;
  845. lua_CFunction setmethod;
  846. } swig_lua_attribute;
  847. struct swig_lua_class;
  848. /* Can be used to create namespaces. Currently used to wrap class static methods/variables/constants */
  849. typedef struct swig_lua_namespace {
  850. const char *name;
  851. swig_lua_method *ns_methods;
  852. swig_lua_attribute *ns_attributes;
  853. swig_lua_const_info *ns_constants;
  854. struct swig_lua_class **ns_classes;
  855. struct swig_lua_namespace **ns_namespaces;
  856. } swig_lua_namespace;
  857. typedef struct swig_lua_class {
  858. const char *name; /* Name that this class has in Lua */
  859. const char *fqname; /* Fully qualified name - Scope + class name */
  860. swig_type_info **type;
  861. lua_CFunction constructor;
  862. void (*destructor)(void *);
  863. swig_lua_method *methods;
  864. swig_lua_attribute *attributes;
  865. swig_lua_namespace *cls_static;
  866. swig_lua_method *metatable; /* 0 for -eluac */
  867. struct swig_lua_class **bases;
  868. const char **base_names;
  869. } swig_lua_class;
  870. /* this is the struct for wrapping all pointers in SwigLua
  871. */
  872. typedef struct {
  873. swig_type_info *type;
  874. int own; /* 1 if owned & must be destroyed */
  875. void *ptr;
  876. } swig_lua_userdata;
  877. /* this is the struct for wrapping arbitrary packed binary data
  878. (currently it is only used for member function pointers)
  879. the data ordering is similar to swig_lua_userdata, but it is currently not possible
  880. to tell the two structures apart within SWIG, other than by looking at the type
  881. */
  882. typedef struct {
  883. swig_type_info *type;
  884. int own; /* 1 if owned & must be destroyed */
  885. char data[1]; /* arbitary amount of data */
  886. } swig_lua_rawdata;
  887. /* Common SWIG API */
  888. #define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
  889. #define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
  890. #define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
  891. /* for C++ member pointers, ie, member methods */
  892. #define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
  893. #define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type)
  894. /* Runtime API */
  895. #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
  896. #define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
  897. #define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
  898. /* Contract support */
  899. #define SWIG_contract_assert(expr, msg) \
  900. if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else
  901. /* helper #defines */
  902. #define SWIG_fail {goto fail;}
  903. #define SWIG_fail_arg(func_name,argnum,type) \
  904. {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
  905. func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
  906. goto fail;}
  907. #define SWIG_fail_ptr(func_name,argnum,type) \
  908. SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
  909. #define SWIG_check_num_args(func_name,a,b) \
  910. if (lua_gettop(L)<a || lua_gettop(L)>b) \
  911. {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
  912. goto fail;}
  913. #define SWIG_Lua_get_table(L,n) \
  914. (lua_pushstring(L, n), lua_rawget(L,-2))
  915. #define SWIG_Lua_add_function(L,n,f) \
  916. (lua_pushstring(L, n), \
  917. lua_pushcfunction(L, f), \
  918. lua_rawset(L,-3))
  919. #define SWIG_Lua_add_boolean(L,n,b) \
  920. (lua_pushstring(L, n), \
  921. lua_pushboolean(L, b), \
  922. lua_rawset(L,-3))
  923. /* special helper for allowing 'nil' for usertypes */
  924. #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
  925. #ifdef __cplusplus
  926. /* Special helper for member function pointers
  927. it gets the address, casts it, then dereferences it */
  928. /*#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) */
  929. #endif
  930. /* storing/access of swig_module_info */
  931. SWIGRUNTIME swig_module_info *
  932. SWIG_Lua_GetModule(lua_State *L) {
  933. swig_module_info *ret = 0;
  934. lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
  935. lua_rawget(L,LUA_REGISTRYINDEX);
  936. if (lua_islightuserdata(L,-1))
  937. ret=(swig_module_info*)lua_touserdata(L,-1);
  938. lua_pop(L,1); /* tidy */
  939. return ret;
  940. }
  941. SWIGRUNTIME void
  942. SWIG_Lua_SetModule(lua_State *L, swig_module_info *module) {
  943. /* add this all into the Lua registry: */
  944. lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
  945. lua_pushlightuserdata(L,(void*)module);
  946. lua_rawset(L,LUA_REGISTRYINDEX);
  947. }
  948. /* -----------------------------------------------------------------------------
  949. * global variable support code: modules
  950. * ----------------------------------------------------------------------------- */
  951. /* this function is called when trying to set an immutable.
  952. default action is to print an error.
  953. This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
  954. SWIGINTERN int SWIG_Lua_set_immutable(lua_State *L)
  955. {
  956. /* there should be 1 param passed in: the new value */
  957. #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
  958. lua_pop(L,1); /* remove it */
  959. luaL_error(L,"This variable is immutable");
  960. #endif
  961. return 0; /* should not return anything */
  962. }
  963. #ifdef SWIG_LUA_ELUA_EMULATE
  964. SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own);
  965. SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type);
  966. static int swig_lua_elua_emulate_unique_key;
  967. /* This function emulates eLua rotables behaviour. It loads a rotable definition into the usual lua table. */
  968. SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_entry *table)
  969. {
  970. int i, table_parsed, parsed_tables_array, target_table;
  971. assert(lua_istable(L,-1));
  972. target_table = lua_gettop(L);
  973. /* Get the registry where we put all parsed tables to avoid loops */
  974. lua_rawgetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
  975. if(lua_isnil(L,-1)) {
  976. lua_pop(L,1);
  977. lua_newtable(L);
  978. lua_pushvalue(L,-1);
  979. lua_rawsetp(L,LUA_REGISTRYINDEX,(void*)(&swig_lua_elua_emulate_unique_key));
  980. }
  981. parsed_tables_array = lua_gettop(L);
  982. lua_pushvalue(L,target_table);
  983. lua_rawsetp(L, parsed_tables_array, table);
  984. table_parsed = 0;
  985. const int SWIGUNUSED pairs_start = lua_gettop(L);
  986. for(i = 0;table[i].key.type != LUA_TNIL || table[i].value.type != LUA_TNIL;i++)
  987. {
  988. const swig_elua_entry *entry = table + i;
  989. int is_metatable = 0;
  990. switch(entry->key.type) {
  991. case LUA_TSTRING:
  992. lua_pushstring(L,entry->key.key.strkey);
  993. if(strcmp(entry->key.key.strkey, SWIG_LUA_ELUA_EMUL_METATABLE_KEY) == 0)
  994. is_metatable = 1;
  995. break;
  996. case LUA_TNUMBER:
  997. lua_pushnumber(L,entry->key.key.numkey);
  998. break;
  999. case LUA_TNIL:
  1000. lua_pushnil(L);
  1001. break;
  1002. default:
  1003. assert(0);
  1004. }
  1005. switch(entry->value.type) {
  1006. case LUA_TSTRING:
  1007. lua_pushstring(L,entry->value.value.string);
  1008. break;
  1009. case LUA_TNUMBER:
  1010. lua_pushnumber(L,entry->value.value.number);
  1011. break;
  1012. case LUA_TFUNCTION:
  1013. lua_pushcfunction(L,entry->value.value.function);
  1014. break;
  1015. case LUA_TTABLE:
  1016. lua_rawgetp(L,parsed_tables_array, entry->value.value.table);
  1017. table_parsed = !lua_isnil(L,-1);
  1018. if(!table_parsed) {
  1019. lua_pop(L,1); /*remove nil */
  1020. lua_newtable(L);
  1021. SWIG_Lua_elua_emulate_register(L,entry->value.value.table);
  1022. }
  1023. if(is_metatable) {
  1024. assert(lua_istable(L,-1));
  1025. lua_pushvalue(L,-1);
  1026. lua_setmetatable(L,target_table);
  1027. }
  1028. break;
  1029. case LUA_TUSERDATA:
  1030. if(entry->value.value.userdata.member)
  1031. SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue,
  1032. entry->value.value.userdata.lvalue,
  1033. *(entry->value.value.userdata.ptype));
  1034. else
  1035. SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue,
  1036. *(entry->value.value.userdata.ptype),0);
  1037. break;
  1038. case LUA_TNIL:
  1039. lua_pushnil(L);
  1040. break;
  1041. default:
  1042. assert(0);
  1043. }
  1044. assert(lua_gettop(L) == pairs_start + 2);
  1045. lua_rawset(L,target_table);
  1046. }
  1047. lua_pop(L,1); /* Removing parsed tables storage */
  1048. assert(lua_gettop(L) == target_table);
  1049. }
  1050. SWIGINTERN void SWIG_Lua_elua_emulate_register_clear(lua_State *L)
  1051. {
  1052. lua_pushnil(L);
  1053. lua_rawsetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
  1054. }
  1055. SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L);
  1056. SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L)
  1057. {
  1058. SWIG_check_num_args("getmetatable(SWIG eLua emulation)", 1, 1);
  1059. SWIG_Lua_get_class_registry(L);
  1060. lua_getfield(L,-1,"lua_getmetatable");
  1061. lua_remove(L,-2); /* remove the registry*/
  1062. assert(!lua_isnil(L,-1));
  1063. lua_pushvalue(L,1);
  1064. assert(lua_gettop(L) == 3); /* object | function | object again */
  1065. lua_call(L,1,1);
  1066. if(!lua_isnil(L,-1)) /*There is an ordinary metatable */
  1067. return 1;
  1068. /*if it is a table, then emulate elua behaviour - check for __metatable attribute of a table*/
  1069. assert(lua_gettop(L) == 2);
  1070. if(lua_istable(L,-2)) {
  1071. lua_pop(L,1); /*remove the nil*/
  1072. lua_getfield(L,-1, SWIG_LUA_ELUA_EMUL_METATABLE_KEY);
  1073. }
  1074. assert(lua_gettop(L) == 2);
  1075. return 1;
  1076. fail:
  1077. lua_error(L);
  1078. return 0;
  1079. }
  1080. SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L)
  1081. {
  1082. SWIG_Lua_get_class_registry(L);
  1083. lua_pushglobaltable(L);
  1084. lua_pushstring(L,"lua_getmetatable");
  1085. lua_getfield(L,-2,"getmetatable");
  1086. assert(!lua_isnil(L,-1));
  1087. lua_rawset(L,-4);
  1088. lua_pushstring(L, "getmetatable");
  1089. lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable);
  1090. lua_rawset(L,-3);
  1091. lua_pop(L,2);
  1092. }
  1093. /* END OF REMOVE */
  1094. #endif
  1095. /* -----------------------------------------------------------------------------
  1096. * global variable support code: namespaces and modules (which are the same thing)
  1097. * ----------------------------------------------------------------------------- */
  1098. SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L)
  1099. {
  1100. /* there should be 2 params passed in
  1101. (1) table (not the meta table)
  1102. (2) string name of the attribute
  1103. */
  1104. assert(lua_istable(L,-2)); /* just in case */
  1105. lua_getmetatable(L,-2);
  1106. assert(lua_istable(L,-1));
  1107. SWIG_Lua_get_table(L,".get"); /* find the .get table */
  1108. assert(lua_istable(L,-1));
  1109. /* look for the key in the .get table */
  1110. lua_pushvalue(L,2); /* key */
  1111. lua_rawget(L,-2);
  1112. lua_remove(L,-2); /* stack tidy, remove .get table */
  1113. if (lua_iscfunction(L,-1))
  1114. { /* found it so call the fn & return its value */
  1115. lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */
  1116. lua_remove(L,-2); /* stack tidy, remove metatable */
  1117. return 1;
  1118. }
  1119. lua_pop(L,1); /* remove whatever was there */
  1120. /* ok, so try the .fn table */
  1121. SWIG_Lua_get_table(L,".fn"); /* find the .get table */
  1122. assert(lua_istable(L,-1)); /* just in case */
  1123. lua_pushvalue(L,2); /* key */
  1124. lua_rawget(L,-2); /* look for the fn */
  1125. lua_remove(L,-2); /* stack tidy, remove .fn table */
  1126. if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */
  1127. { /* found it so return the fn & let lua call it */
  1128. lua_remove(L,-2); /* stack tidy, remove metatable */
  1129. return 1;
  1130. }
  1131. lua_pop(L,1); /* remove whatever was there */
  1132. return 0;
  1133. }
  1134. SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L)
  1135. {
  1136. /* there should be 3 params passed in
  1137. (1) table (not the meta table)
  1138. (2) string name of the attribute
  1139. (3) any for the new value
  1140. */
  1141. assert(lua_istable(L,1));
  1142. lua_getmetatable(L,1); /* get the meta table */
  1143. assert(lua_istable(L,-1));
  1144. SWIG_Lua_get_table(L,".set"); /* find the .set table */
  1145. if (lua_istable(L,-1))
  1146. {
  1147. /* look for the key in the .set table */
  1148. lua_pushvalue(L,2); /* key */
  1149. lua_rawget(L,-2);
  1150. if (lua_iscfunction(L,-1))
  1151. { /* found it so call the fn & return its value */
  1152. lua_pushvalue(L,3); /* value */
  1153. lua_call(L,1,0);
  1154. return 0;
  1155. }
  1156. lua_pop(L,1); /* remove the value */
  1157. }
  1158. lua_pop(L,1); /* remove the value .set table */
  1159. lua_pop(L,1); /* remote metatable */
  1160. lua_rawset(L,-3);
  1161. return 0;
  1162. }
  1163. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
  1164. SWIGINTERN void SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]); /* forward declaration */
  1165. SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn); /* forward declaration */
  1166. SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss);
  1167. /* helper function - register namespace methods and attributes into namespace */
  1168. SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *ns)
  1169. {
  1170. int i;
  1171. /* There must be namespace table (not metatable) at the top of the stack */
  1172. assert(lua_istable(L,-1));
  1173. SWIG_Lua_InstallConstants(L, ns->ns_constants);
  1174. /* add methods to the namespace/module table */
  1175. for(i=0;ns->ns_methods[i].name;i++){
  1176. SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].func);
  1177. }
  1178. lua_getmetatable(L,-1);
  1179. /* add fns */
  1180. for(i=0;ns->ns_attributes[i].name;i++){
  1181. SWIG_Lua_add_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod);
  1182. }
  1183. /* clear stack - remove metatble */
  1184. lua_pop(L,1);
  1185. return 0;
  1186. }
  1187. /* Register all classes in the namespace */
  1188. SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace *ns)
  1189. {
  1190. swig_lua_class **classes;
  1191. /* There must be a module/namespace table at the top of the stack */
  1192. assert(lua_istable(L,-1));
  1193. classes = ns->ns_classes;
  1194. if( classes != 0 ) {
  1195. while(*classes != 0) {
  1196. SWIG_Lua_class_register(L, *classes);
  1197. classes++;
  1198. }
  1199. }
  1200. }
  1201. /* Helper function. Creates namespace table and adds it to module table
  1202. if 'reg' is true, then will register namespace table to parent one (must be on top of the stack
  1203. when function is called).
  1204. Function always returns newly registered table on top of the stack.
  1205. */
  1206. SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns, int reg)
  1207. {
  1208. swig_lua_namespace **sub_namespace;
  1209. /* 1 argument - table on the top of the stack */
  1210. const int SWIGUNUSED begin = lua_gettop(L);
  1211. assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table or parent namespace table */
  1212. lua_checkstack(L,5);
  1213. lua_newtable(L); /* namespace itself */
  1214. lua_newtable(L); /* metatable for namespace */
  1215. /* add a table called ".get" */
  1216. lua_pushstring(L,".get");
  1217. lua_newtable(L);
  1218. lua_rawset(L,-3);
  1219. /* add a table called ".set" */
  1220. lua_pushstring(L,".set");
  1221. lua_newtable(L);
  1222. lua_rawset(L,-3);
  1223. /* add a table called ".fn" */
  1224. lua_pushstring(L,".fn");
  1225. lua_newtable(L);
  1226. lua_rawset(L,-3);
  1227. /* add accessor fns for using the .get,.set&.fn */
  1228. SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get);
  1229. SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set);
  1230. lua_setmetatable(L,-2); /* set metatable */
  1231. /* Register all functions, variables etc */
  1232. SWIG_Lua_add_namespace_details(L,ns);
  1233. /* Register classes */
  1234. SWIG_Lua_add_namespace_classes(L,ns);
  1235. sub_namespace = ns->ns_namespaces;
  1236. if( sub_namespace != 0) {
  1237. while(*sub_namespace != 0) {
  1238. SWIG_Lua_namespace_register(L, *sub_namespace, 1);
  1239. lua_pop(L,1); /* removing sub-namespace table */
  1240. sub_namespace++;
  1241. }
  1242. }
  1243. if (reg) {
  1244. lua_pushstring(L,ns->name);
  1245. lua_pushvalue(L,-2);
  1246. lua_rawset(L,-4); /* add namespace to module table */
  1247. }
  1248. assert(lua_gettop(L) == begin+1);
  1249. }
  1250. #endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
  1251. /* -----------------------------------------------------------------------------
  1252. * global variable support code: classes
  1253. * ----------------------------------------------------------------------------- */
  1254. SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname);
  1255. typedef int (*swig_lua_base_iterator_func)(lua_State*,swig_type_info*, int, int *ret);
  1256. SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED swig_type,
  1257. int first_arg, swig_lua_base_iterator_func func, int *const ret)
  1258. {
  1259. /* first_arg - position of the object in stack. Everything that is above are arguments
  1260. * and is passed to every evocation of the func */
  1261. int last_arg = lua_gettop(L);/* position of last argument */
  1262. int original_metatable = last_arg + 1;
  1263. size_t bases_count;
  1264. int result = SWIG_ERROR;
  1265. int bases_table;
  1266. (void)swig_type;
  1267. lua_getmetatable(L,first_arg);
  1268. /* initialise base search */
  1269. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
  1270. SWIG_Lua_get_table(L,".bases");
  1271. assert(lua_istable(L,-1));
  1272. bases_count = lua_rawlen(L,-1);
  1273. bases_table = lua_gettop(L);
  1274. #else
  1275. /* In elua .bases table doesn't exist. Use table from swig_lua_class */
  1276. (void)bases_table;
  1277. assert(swig_type!=0);
  1278. swig_module_info *module=SWIG_GetModule(L);
  1279. swig_lua_class **bases= ((swig_lua_class*)(swig_type->clientdata))->bases;
  1280. const char **base_names= ((swig_lua_class*)(swig_type->clientdata))->base_names;
  1281. bases_count = 0;
  1282. for(;base_names[bases_count];
  1283. bases_count++);/* get length of bases */
  1284. #endif
  1285. if(ret)
  1286. *ret = 0;
  1287. if(bases_count>0)
  1288. {
  1289. int to_remove;
  1290. size_t i;
  1291. int j;
  1292. int subcall_last_arg;
  1293. int subcall_first_arg = lua_gettop(L) + 1;/* Here a copy of first_arg and arguments begin */
  1294. int valid = 1;
  1295. swig_type_info *base_swig_type = 0;
  1296. for(j=first_arg;j<=last_arg;j++)
  1297. lua_pushvalue(L,j);
  1298. subcall_last_arg = lua_gettop(L);
  1299. /* Trick: temporarily replacing original metatable with metatable for base class and call getter */
  1300. for(i=0;i<bases_count;i++) {
  1301. /* Iteration through class bases */
  1302. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
  1303. lua_rawgeti(L,bases_table,i+1);
  1304. base_swig_type = 0;
  1305. if(lua_isnil(L,-1)) {
  1306. valid = 0;
  1307. lua_pop(L,1);
  1308. } else {
  1309. valid = 1;
  1310. }
  1311. #else /* In elua .bases table doesn't exist. Use table from swig_lua_class */
  1312. swig_lua_class *base_class = bases[i];
  1313. if(!base_class) {
  1314. valid = 0;
  1315. } else {
  1316. valid = 1;
  1317. SWIG_Lua_get_class_metatable(L,base_class->fqname);
  1318. base_swig_type = SWIG_TypeQueryModule(module,module,base_names[i]);
  1319. assert(base_swig_type != 0);
  1320. }
  1321. #endif
  1322. if(!valid)
  1323. continue;
  1324. assert(lua_isuserdata(L, subcall_first_arg));
  1325. assert(lua_istable(L,-1));
  1326. lua_setmetatable(L,subcall_first_arg); /* Set new metatable */
  1327. assert(lua_gettop(L) == subcall_last_arg);
  1328. result = func(L, base_swig_type,subcall_first_arg, ret); /* Forward call */
  1329. if(result != SWIG_ERROR) {
  1330. break;
  1331. }
  1332. }
  1333. /* Restore original metatable */
  1334. lua_pushvalue(L,original_metatable);
  1335. lua_setmetatable(L,first_arg);
  1336. /* Clear - remove everything between last_arg and subcall_last_arg including */
  1337. to_remove = subcall_last_arg - last_arg;
  1338. for(j=0;j<to_remove;j++)
  1339. lua_remove(L,last_arg+1);
  1340. } else {
  1341. /* Remove everything after last_arg */
  1342. lua_pop(L, lua_gettop(L) - last_arg);
  1343. }
  1344. if(ret) assert(lua_gettop(L) == last_arg + *ret);
  1345. return result;
  1346. }
  1347. /* The class.get method helper, performs the lookup of class attributes.
  1348. * It returns an error code. Number of function return values is passed inside 'ret'.
  1349. * first_arg is not used in this function because function always has 2 arguments.
  1350. */
  1351. SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
  1352. {
  1353. /* there should be 2 params passed in
  1354. (1) userdata (not the meta table)
  1355. (2) string name of the attribute
  1356. */
  1357. int bases_search_result;
  1358. int substack_start = lua_gettop(L)-2;
  1359. assert(first_arg == substack_start+1);
  1360. lua_checkstack(L,5);
  1361. assert(lua_isuserdata(L,-2)); /* just in case */
  1362. lua_getmetatable(L,-2); /* get the meta table */
  1363. assert(lua_istable(L,-1)); /* just in case */
  1364. SWIG_Lua_get_table(L,".get"); /* find the .get table */
  1365. assert(lua_istable(L,-1)); /* just in case */
  1366. /* look for the key in the .get table */
  1367. lua_pushvalue(L,substack_start+2); /* key */
  1368. lua_rawget(L,-2);
  1369. lua_remove(L,-2); /* stack tidy, remove .get table */
  1370. if (lua_iscfunction(L,-1))
  1371. { /* found it so call the fn & return its value */
  1372. lua_pushvalue(L,substack_start+1); /* the userdata */
  1373. lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */
  1374. lua_remove(L,-2); /* stack tidy, remove metatable */
  1375. if(ret)
  1376. *ret = 1;
  1377. return SWIG_OK;
  1378. }
  1379. lua_pop(L,1); /* remove whatever was there */
  1380. /* ok, so try the .fn table */
  1381. SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
  1382. assert(lua_istable(L,-1)); /* just in case */
  1383. lua_pushvalue(L,substack_start+2); /* key */
  1384. lua_rawget(L,-2); /* look for the fn */
  1385. lua_remove(L,-2); /* stack tidy, remove .fn table */
  1386. if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
  1387. { /* found it so return the fn & let lua call it */
  1388. lua_remove(L,-2); /* stack tidy, remove metatable */
  1389. if(ret)
  1390. *ret = 1;
  1391. return SWIG_OK;
  1392. }
  1393. lua_pop(L,1); /* remove whatever was there */
  1394. /* NEW: looks for the __getitem() fn
  1395. this is a user provided get fn */
  1396. SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
  1397. if (lua_iscfunction(L,-1)) /* if its there */
  1398. { /* found it so call the fn & return its value */
  1399. lua_pushvalue(L,substack_start+1); /* the userdata */
  1400. lua_pushvalue(L,substack_start+2); /* the parameter */
  1401. lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
  1402. lua_remove(L,-2); /* stack tidy, remove metatable */
  1403. if(ret) *ret = 1;
  1404. return SWIG_OK;
  1405. }
  1406. lua_pop(L,1);
  1407. /* Remove the metatable */
  1408. lua_pop(L,1);
  1409. /* Search in base classes */
  1410. bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get,ret);
  1411. return bases_search_result; /* sorry not known */
  1412. }
  1413. /* the class.get method, performs the lookup of class attributes
  1414. */
  1415. SWIGINTERN int SWIG_Lua_class_get(lua_State *L)
  1416. {
  1417. /* there should be 2 params passed in
  1418. (1) userdata (not the meta table)
  1419. (2) string name of the attribute
  1420. */
  1421. int result;
  1422. swig_lua_userdata *usr;
  1423. swig_type_info *type;
  1424. int ret = 0;
  1425. assert(lua_isuserdata(L,1));
  1426. usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
  1427. type = usr->type;
  1428. result = SWIG_Lua_class_do_get(L,type,1,&ret);
  1429. if(result == SWIG_OK)
  1430. return ret;
  1431. return 0;
  1432. }
  1433. /* helper for the class.set method, performs the lookup of class attributes
  1434. * It returns error code. Number of function return values is passed inside 'ret'
  1435. */
  1436. SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int first_arg, int *ret)
  1437. {
  1438. /* there should be 3 params passed in
  1439. (1) table (not the meta table)
  1440. (2) string name of the attribute
  1441. (3) any for the new value
  1442. */
  1443. int bases_search_result;
  1444. int substack_start = lua_gettop(L) - 3;
  1445. lua_checkstack(L,5);
  1446. assert(lua_isuserdata(L,substack_start+1)); /* just in case */
  1447. lua_getmetatable(L,substack_start+1); /* get the meta table */
  1448. assert(lua_istable(L,-1)); /* just in case */
  1449. if(ret)
  1450. *ret = 0; /* it is setter - number of return values is always 0 */
  1451. SWIG_Lua_get_table(L,".set"); /* find the .set table */
  1452. if (lua_istable(L,-1))
  1453. {
  1454. /* look for the key in the .set table */
  1455. lua_pushvalue(L,substack_start+2); /* key */
  1456. lua_rawget(L,-2);
  1457. lua_remove(L,-2); /* tidy stack, remove .set table */
  1458. if (lua_iscfunction(L,-1))
  1459. { /* found it so call the fn & return its value */
  1460. lua_pushvalue(L,substack_start+1); /* userdata */
  1461. lua_pushvalue(L,substack_start+3); /* value */
  1462. lua_call(L,2,0);
  1463. lua_remove(L,substack_start+4); /*remove metatable*/
  1464. return SWIG_OK;
  1465. }
  1466. lua_pop(L,1); /* remove the value */
  1467. } else {
  1468. lua_pop(L,1); /* remove the answer for .set table request*/
  1469. }
  1470. /* NEW: looks for the __setitem() fn
  1471. this is a user provided set fn */
  1472. SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
  1473. if (lua_iscfunction(L,-1)) /* if its there */
  1474. { /* found it so call the fn & return its value */
  1475. lua_pushvalue(L,substack_start+1); /* the userdata */
  1476. lua_pushvalue(L,substack_start+2); /* the parameter */
  1477. lua_pushvalue(L,substack_start+3); /* the value */
  1478. lua_call(L,3,0); /* 3 values in ,0 out */
  1479. lua_remove(L,-2); /* stack tidy, remove metatable */
  1480. return SWIG_OK;
  1481. }
  1482. lua_pop(L,1); /* remove value */
  1483. lua_pop(L,1); /* remove metatable */
  1484. /* Search among bases */
  1485. bases_search_result = SWIG_Lua_iterate_bases(L,type,first_arg,SWIG_Lua_class_do_set,ret);
  1486. if(ret)
  1487. assert(*ret == 0);
  1488. assert(lua_gettop(L) == substack_start + 3);
  1489. return bases_search_result;
  1490. }
  1491. /* This is the actual method exported to Lua. It calls SWIG_Lua_class_do_set and correctly
  1492. * handles return values.
  1493. */
  1494. SWIGINTERN int SWIG_Lua_class_set(lua_State *L)
  1495. {
  1496. /* There should be 3 params passed in
  1497. (1) table (not the meta table)
  1498. (2) string name of the attribute
  1499. (3) any for the new value
  1500. */
  1501. int ret = 0;
  1502. int result;
  1503. swig_lua_userdata *usr;
  1504. swig_type_info *type;
  1505. assert(lua_isuserdata(L,1));
  1506. usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
  1507. type = usr->type;
  1508. result = SWIG_Lua_class_do_set(L,type,1,&ret);
  1509. if(result != SWIG_OK) {
  1510. SWIG_Lua_pushferrstring(L,"Assignment not possible. No setter/member with this name. For custom assignments implement __setitem method.");
  1511. lua_error(L);
  1512. } else {
  1513. assert(ret==0);
  1514. }
  1515. return 0;
  1516. }
  1517. /* the class.destruct method called by the interpreter */
  1518. SWIGINTERN int SWIG_Lua_class_destruct(lua_State *L)
  1519. {
  1520. /* there should be 1 params passed in
  1521. (1) userdata (not the meta table) */
  1522. swig_lua_userdata *usr;
  1523. swig_lua_class *clss;
  1524. assert(lua_isuserdata(L,-1)); /* just in case */
  1525. usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
  1526. /* if must be destroyed & has a destructor */
  1527. if (usr->own) /* if must be destroyed */
  1528. {
  1529. clss=(swig_lua_class*)usr->type->clientdata; /* get the class */
  1530. if (clss && clss->destructor) /* there is a destroy fn */
  1531. {
  1532. clss->destructor(usr->ptr); /* bye bye */
  1533. }
  1534. }
  1535. return 0;
  1536. }
  1537. /* the class.__tostring method called by the interpreter and print */
  1538. SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L)
  1539. {
  1540. /* there should be 1 param passed in
  1541. (1) userdata (not the metatable) */
  1542. const char *className;
  1543. void* userData;
  1544. assert(lua_isuserdata(L,1)); /* just in case */
  1545. userData = lua_touserdata(L,1); /* get the userdata address for later */
  1546. lua_getmetatable(L,1); /* get the meta table */
  1547. assert(lua_istable(L,-1)); /* just in case */
  1548. lua_getfield(L, -1, ".type");
  1549. className = lua_tostring(L, -1);
  1550. lua_pushfstring(L, "<%s userdata: %p>", className, userData);
  1551. return 1;
  1552. }
  1553. /* to manually disown some userdata */
  1554. SWIGINTERN int SWIG_Lua_class_disown(lua_State *L)
  1555. {
  1556. /* there should be 1 params passed in
  1557. (1) userdata (not the meta table) */
  1558. swig_lua_userdata *usr;
  1559. assert(lua_isuserdata(L,-1)); /* just in case */
  1560. usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
  1561. usr->own = 0; /* clear our ownership */
  1562. return 0;
  1563. }
  1564. /* lua callable function to compare userdata's value
  1565. the issue is that two userdata may point to the same thing
  1566. but to lua, they are different objects */
  1567. SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L)
  1568. {
  1569. int result;
  1570. swig_lua_userdata *usr1,*usr2;
  1571. if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
  1572. return 0; /* nil reply */
  1573. usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
  1574. usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
  1575. /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
  1576. result=(usr1->ptr==usr2->ptr);
  1577. lua_pushboolean(L,result);
  1578. return 1;
  1579. }
  1580. /* populate table at the top of the stack with metamethods that ought to be inherited */
  1581. SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L)
  1582. {
  1583. SWIG_Lua_add_boolean(L, "__add", 1);
  1584. SWIG_Lua_add_boolean(L, "__sub", 1);
  1585. SWIG_Lua_add_boolean(L, "__mul", 1);
  1586. SWIG_Lua_add_boolean(L, "__div", 1);
  1587. SWIG_Lua_add_boolean(L, "__mod", 1);
  1588. SWIG_Lua_add_boolean(L, "__pow", 1);
  1589. SWIG_Lua_add_boolean(L, "__unm", 1);
  1590. SWIG_Lua_add_boolean(L, "__len", 1 );
  1591. SWIG_Lua_add_boolean(L, "__concat", 1 );
  1592. SWIG_Lua_add_boolean(L, "__eq", 1);
  1593. SWIG_Lua_add_boolean(L, "__lt", 1);
  1594. SWIG_Lua_add_boolean(L, "__le", 1);
  1595. SWIG_Lua_add_boolean(L, "__call", 1);
  1596. SWIG_Lua_add_boolean(L, "__tostring", 1);
  1597. SWIG_Lua_add_boolean(L, "__gc", 0);
  1598. }
  1599. /* creates the swig registry */
  1600. SWIGINTERN void SWIG_Lua_create_class_registry(lua_State *L)
  1601. {
  1602. /* create main SWIG registry table */
  1603. lua_pushstring(L,"SWIG");
  1604. lua_newtable(L);
  1605. /* populate it with some predefined data */
  1606. /* .library table. Placeholder */
  1607. lua_pushstring(L,".library");
  1608. lua_newtable(L);
  1609. {
  1610. /* list of metamethods that class inherits from its bases */
  1611. lua_pushstring(L,"inheritable_metamethods");
  1612. lua_newtable(L);
  1613. /* populate with list of metamethods */
  1614. SWIG_Lua_populate_inheritable_metamethods(L);
  1615. lua_rawset(L,-3);
  1616. }
  1617. lua_rawset(L,-3);
  1618. lua_rawset(L,LUA_REGISTRYINDEX);
  1619. }
  1620. /* gets the swig registry (or creates it) */
  1621. SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L)
  1622. {
  1623. /* add this all into the swig registry: */
  1624. lua_pushstring(L,"SWIG");
  1625. lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */
  1626. if (!lua_istable(L,-1)) /* not there */
  1627. { /* must be first time, so add it */
  1628. lua_pop(L,1); /* remove the result */
  1629. SWIG_Lua_create_class_registry(L);
  1630. /* then get it */
  1631. lua_pushstring(L,"SWIG");
  1632. lua_rawget(L,LUA_REGISTRYINDEX);
  1633. }
  1634. }
  1635. SWIGINTERN void SWIG_Lua_get_inheritable_metamethods(lua_State *L)
  1636. {
  1637. SWIG_Lua_get_class_registry(L);
  1638. lua_pushstring(L, ".library");
  1639. lua_rawget(L,-2);
  1640. assert( !lua_isnil(L,-1) );
  1641. lua_pushstring(L, "inheritable_metamethods");
  1642. lua_rawget(L,-2);
  1643. /* Remove class registry and library table */
  1644. lua_remove(L,-2);
  1645. lua_remove(L,-2);
  1646. }
  1647. /* Helper function to get the classes metatable from the register */
  1648. SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname)
  1649. {
  1650. SWIG_Lua_get_class_registry(L); /* get the registry */
  1651. lua_pushstring(L,cname); /* get the name */
  1652. lua_rawget(L,-2); /* get it */
  1653. lua_remove(L,-2); /* tidy up (remove registry) */
  1654. }
  1655. /* Set up the base classes pointers.
  1656. Each class structure has a list of pointers to the base class structures.
  1657. This function fills them.
  1658. It cannot be done at compile time, as this will not work with hireachies
  1659. spread over more than one swig file.
  1660. Therefore it must be done at runtime, querying the SWIG type system.
  1661. */
  1662. SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss)
  1663. {
  1664. int i=0;
  1665. swig_module_info *module=SWIG_GetModule(L);
  1666. for(i=0;clss->base_names[i];i++)
  1667. {
  1668. if (clss->bases[i]==0) /* not found yet */
  1669. {
  1670. /* lookup and cache the base class */
  1671. swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
  1672. if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
  1673. }
  1674. }
  1675. }
  1676. #if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
  1677. /* Merges two tables */
  1678. SWIGINTERN int SWIG_Lua_merge_tables_by_index(lua_State *L, int target, int source)
  1679. {
  1680. /* iterating */
  1681. lua_pushnil(L);
  1682. while (lua_next(L,source) != 0) {
  1683. /* -1 - value, -2 - index */
  1684. /* have to copy to assign */
  1685. lua_pushvalue(L,-2); /* copy of index */
  1686. lua_pushvalue(L,-2); /* copy of value */
  1687. lua_rawset(L, target);
  1688. lua_pop(L,1);
  1689. /* only key is left */
  1690. }
  1691. }
  1692. /* Merges two tables with given name. original - index of target metatable, base - index of source metatable */
  1693. SWIGINTERN int SWIG_Lua_merge_tables(lua_State *L, const char* name, int original, int base)
  1694. {
  1695. /* push original[name], then base[name] */
  1696. lua_pushstring(L,name);
  1697. lua_rawget(L,original);
  1698. int original_table = lua_gettop(L);
  1699. lua_pushstring(L,name);
  1700. lua_rawget(L,base);
  1701. int base_table = lua_gettop(L);
  1702. SWIG_Lua_merge_tables_by_index(L, original_table, base_table);
  1703. /* clearing stack */
  1704. lua_pop(L,2);
  1705. }
  1706. /* Function takes all symbols from base and adds it to derived class. It's just a helper. */
  1707. SWIGINTERN int SWIG_Lua_class_squash_base(lua_State *L, swig_lua_class *base_cls)
  1708. {
  1709. /* There is one parameter - original, i.e. 'derived' class metatable */
  1710. assert(lua_istable(L,-1));
  1711. int original = lua_gettop(L);
  1712. SWIG_Lua_get_class_metatable(L,base_cls->fqname);
  1713. int base = lua_gettop(L);
  1714. SWIG_Lua_merge_tables(L, ".fn", original, base );
  1715. SWIG_Lua_merge_tables(L, ".set", original, base );
  1716. SWIG_Lua_merge_tables(L, ".get", original, base );
  1717. lua_pop(L,1);
  1718. }
  1719. /* Function squashes all symbols from 'clss' bases into itself */
  1720. SWIGINTERN int SWIG_Lua_class_squash_bases(lua_State *L, swig_lua_class *clss)
  1721. {
  1722. int i;
  1723. SWIG_Lua_get_class_metatable(L,clss->fqname);
  1724. for(i=0;clss->base_names[i];i++)
  1725. {
  1726. if (clss->bases[i]==0) /* Somehow it's not found. Skip it */
  1727. continue;
  1728. /* Thing is: all bases are already registered. Thus they have already executed
  1729. * this function. So we just need to squash them into us, because their bases
  1730. * are already squashed into them. No need for recursion here!
  1731. */
  1732. SWIG_Lua_class_squash_base(L, clss->bases[i]);
  1733. }
  1734. lua_pop(L,1); /*tidy stack*/
  1735. }
  1736. #endif
  1737. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
  1738. /* helper add a variable to a registered class */
  1739. SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn)
  1740. {
  1741. assert(lua_istable(L,-1)); /* just in case */
  1742. SWIG_Lua_get_table(L,".get"); /* find the .get table */
  1743. assert(lua_istable(L,-1)); /* just in case */
  1744. SWIG_Lua_add_function(L,name,getFn);
  1745. lua_pop(L,1); /* tidy stack (remove table) */
  1746. if (setFn)
  1747. {
  1748. SWIG_Lua_get_table(L,".set"); /* find the .set table */
  1749. assert(lua_istable(L,-1)); /* just in case */
  1750. SWIG_Lua_add_function(L,name,setFn);
  1751. lua_pop(L,1); /* tidy stack (remove table) */
  1752. }
  1753. }
  1754. /* helper to recursively add class static details (static attributes, operations and constants) */
  1755. SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State *L, swig_lua_class *clss)
  1756. {
  1757. int i = 0;
  1758. /* The class namespace table must be on the top of the stack */
  1759. assert(lua_istable(L,-1));
  1760. /* call all the base classes first: we can then override these later: */
  1761. for(i=0;clss->bases[i];i++)
  1762. {
  1763. SWIG_Lua_add_class_static_details(L,clss->bases[i]);
  1764. }
  1765. SWIG_Lua_add_namespace_details(L, clss->cls_static);
  1766. }
  1767. SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss); /* forward declaration */
  1768. /* helper to recursively add class details (attributes & operations) */
  1769. SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_class *clss)
  1770. {
  1771. int i;
  1772. size_t bases_count = 0;
  1773. /* Add bases to .bases table */
  1774. SWIG_Lua_get_table(L,".bases");
  1775. assert(lua_istable(L,-1)); /* just in case */
  1776. for(i=0;clss->bases[i];i++)
  1777. {
  1778. SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
  1779. /* Base class must be already registered */
  1780. assert(lua_istable(L,-1));
  1781. lua_rawseti(L,-2,i+1); /* In lua indexing starts from 1 */
  1782. bases_count++;
  1783. }
  1784. assert(lua_rawlen(L,-1) == bases_count);
  1785. lua_pop(L,1); /* remove .bases table */
  1786. /* add attributes */
  1787. for(i=0;clss->attributes[i].name;i++){
  1788. SWIG_Lua_add_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
  1789. }
  1790. /* add methods to the metatable */
  1791. SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
  1792. assert(lua_istable(L,-1)); /* just in case */
  1793. for(i=0;clss->methods[i].name;i++){
  1794. SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].func);
  1795. }
  1796. lua_pop(L,1); /* tidy stack (remove table) */
  1797. /* add operator overloads
  1798. This adds methods from metatable array to metatable. Can mess up garbage
  1799. collectind if someone defines __gc method
  1800. */
  1801. if(clss->metatable) {
  1802. for(i=0;clss->metatable[i].name;i++) {
  1803. SWIG_Lua_add_function(L,clss->metatable[i].name,clss->metatable[i].func);
  1804. }
  1805. }
  1806. #if !defined(SWIG_LUA_SQUASH_BASES)
  1807. /* Adding metamethods that are defined in base classes. If bases were squashed
  1808. * then it is obviously unnecessary
  1809. */
  1810. SWIG_Lua_add_class_user_metamethods(L, clss);
  1811. #endif
  1812. }
  1813. /* Helpers to add user defined class metamedhods - __add, __sub etc. The helpers are needed
  1814. for the following issue: Lua runtime checks for metamethod existence with rawget function
  1815. ignoring our SWIG-provided __index and __newindex functions. Thus our inheritance-aware method
  1816. search algorithm doesn't work in such case. (Not to say that Lua runtime queries metamethod directly
  1817. in metatable and not in object).
  1818. Current solution is this: if somewhere in hierarchy metamethod __x is defined, then all descendants
  1819. are automatically given a special proxy __x that calls the real __x method.
  1820. Obvious idea - to copy __x instead of creating __x-proxy is wrong because if someone changes __x in runtime,
  1821. those changes must be reflected in all descendants.
  1822. */
  1823. SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration*/
  1824. /* The real function that resolves a metamethod.
  1825. * Function searches given class and all it's bases(recursively) for first instance of something that is
  1826. * not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actual metamethod implementation
  1827. * and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the
  1828. * answer.
  1829. * Returns 1 if found, 0 otherwise.
  1830. * clss is class which metatable we will search for method
  1831. * metamethod_name_idx is index in L where metamethod name (as string) lies
  1832. * skip_check allows to skip searching metamethod in givel clss and immideatelly go to searching in bases. skip_check
  1833. * is not caried to subsequent recursive calls - false is always passed. It is set to true only at first call from
  1834. * SWIG_Lua_resolve_metamethod
  1835. * */
  1836. SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx,
  1837. int skip_check)
  1838. {
  1839. /* This function is called recursively */
  1840. int result = 0;
  1841. int i = 0;
  1842. if (!skip_check) {
  1843. SWIG_Lua_get_class_metatable(L, clss->fqname);
  1844. lua_pushvalue(L, metamethod_name_idx);
  1845. lua_rawget(L,-2);
  1846. /* If this is cfunction and it is equal to SWIG_Lua_resolve_metamethod then
  1847. * this isn't the function we are looking for :)
  1848. * lua_tocfunction will return NULL if not cfunction
  1849. */
  1850. if (!lua_isnil(L,-1) && lua_tocfunction(L,-1) != SWIG_Lua_resolve_metamethod ) {
  1851. lua_remove(L,-2); /* removing class metatable */
  1852. return 1;
  1853. }
  1854. lua_pop(L,2); /* remove class metatable and query result */
  1855. }
  1856. /* Forwarding calls to bases */
  1857. for(i=0;clss->bases[i];i++)
  1858. {
  1859. result = SWIG_Lua_do_resolve_metamethod(L, clss->bases[i], metamethod_name_idx, 0);
  1860. if (result)
  1861. break;
  1862. }
  1863. return result;
  1864. }
  1865. /* The proxy function for metamethod. All parameters are passed as cclosure. Searches for actual method
  1866. * and calls it */
  1867. SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
  1868. {
  1869. int numargs;
  1870. int metamethod_name_idx;
  1871. const swig_lua_class* clss;
  1872. int result;
  1873. lua_checkstack(L,5);
  1874. numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */
  1875. /* Get upvalues from closure */
  1876. lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/
  1877. metamethod_name_idx = lua_gettop(L);
  1878. lua_pushvalue(L, lua_upvalueindex(2));
  1879. clss = (const swig_lua_class*)(lua_touserdata(L,-1));
  1880. lua_pop(L,1); /* remove lightuserdata with clss from stack */
  1881. /* Actual work */
  1882. result = SWIG_Lua_do_resolve_metamethod(L, clss, metamethod_name_idx, 1);
  1883. if (!result) {
  1884. SWIG_Lua_pushferrstring(L,"The metamethod proxy is set, but it failed to find actual metamethod. Memory corruption is most likely explanation.");
  1885. lua_error(L);
  1886. return 0;
  1887. }
  1888. lua_remove(L,-2); /* remove metamethod key */
  1889. lua_insert(L,1); /* move function to correct position */
  1890. lua_call(L, numargs, LUA_MULTRET);
  1891. return lua_gettop(L); /* return all results */
  1892. }
  1893. /* If given metamethod must be present in given class, then creates appropriate proxy
  1894. * Returns 1 if successfully added, 0 if not added because no base class has it, -1
  1895. * if method is defined in the class metatable itself
  1896. */
  1897. SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *clss, const int metatable_index)
  1898. {
  1899. int key_index;
  1900. int success = 0;
  1901. int i = 0;
  1902. /* metamethod name - on the top of the stack */
  1903. assert(lua_isstring(L,-1));
  1904. key_index = lua_gettop(L);
  1905. /* Check whether method is already defined in metatable */
  1906. lua_pushvalue(L,key_index); /* copy of the key */
  1907. lua_gettable(L,metatable_index);
  1908. if( !lua_isnil(L,-1) ) {
  1909. lua_pop(L,1);
  1910. return -1;
  1911. }
  1912. lua_pop(L,1);
  1913. /* Iterating over immediate bases */
  1914. for(i=0;clss->bases[i];i++)
  1915. {
  1916. const swig_lua_class *base = clss->bases[i];
  1917. SWIG_Lua_get_class_metatable(L, base->fqname);
  1918. lua_pushvalue(L, key_index);
  1919. lua_rawget(L, -2);
  1920. if( !lua_isnil(L,-1) ) {
  1921. lua_pushvalue(L, key_index);
  1922. /* Add proxy function */
  1923. lua_pushvalue(L, key_index); /* first closure value is function name */
  1924. lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */
  1925. lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2);
  1926. lua_rawset(L, metatable_index);
  1927. success = 1;
  1928. }
  1929. lua_pop(L,1); /* remove function or nil */
  1930. lua_pop(L,1); /* remove base class metatable */
  1931. if( success )
  1932. break;
  1933. }
  1934. return success;
  1935. }
  1936. SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
  1937. {
  1938. int metatable_index;
  1939. int metamethods_info_index;
  1940. int tostring_undefined;
  1941. int eq_undefined = 0;
  1942. SWIG_Lua_get_class_metatable(L, clss->fqname);
  1943. metatable_index = lua_gettop(L);
  1944. SWIG_Lua_get_inheritable_metamethods(L);
  1945. assert(lua_istable(L,-1));
  1946. metamethods_info_index = lua_gettop(L);
  1947. lua_pushnil(L); /* first key */
  1948. while(lua_next(L, metamethods_info_index) != 0 ) {
  1949. /* key at index -2, value at index -1 */
  1950. const int is_inheritable = lua_toboolean(L,-2);
  1951. lua_pop(L,1); /* remove value - we don't need it anymore */
  1952. if(is_inheritable) { /* if metamethod is inheritable */
  1953. SWIG_Lua_add_class_user_metamethod(L,clss,metatable_index);
  1954. }
  1955. }
  1956. lua_pop(L,1); /* remove inheritable metatmethods table */
  1957. /* Special handling for __tostring method */
  1958. lua_pushstring(L, "__tostring");
  1959. lua_pushvalue(L,-1);
  1960. lua_rawget(L,metatable_index);
  1961. tostring_undefined = lua_isnil(L,-1);
  1962. lua_pop(L,1);
  1963. if( tostring_undefined ) {
  1964. lua_pushcfunction(L, SWIG_Lua_class_tostring);
  1965. lua_rawset(L, metatable_index);
  1966. } else {
  1967. lua_pop(L,1); /* remove copy of the key */
  1968. }
  1969. /* Special handling for __eq method */
  1970. lua_pushstring(L, "__eq");
  1971. lua_pushvalue(L,-1);
  1972. lua_rawget(L,metatable_index);
  1973. eq_undefined = lua_isnil(L,-1);
  1974. lua_pop(L,1);
  1975. if( eq_undefined ) {
  1976. lua_pushcfunction(L, SWIG_Lua_class_equal);
  1977. lua_rawset(L, metatable_index);
  1978. } else {
  1979. lua_pop(L,1); /* remove copy of the key */
  1980. }
  1981. /* Warning: __index and __newindex are SWIG-defined. For user-defined operator[]
  1982. * a __getitem/__setitem method should be defined
  1983. */
  1984. lua_pop(L,1); /* pop class metatable */
  1985. }
  1986. /* Register class static methods,attributes etc as well as constructor proxy */
  1987. SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *clss)
  1988. {
  1989. const int SWIGUNUSED begin = lua_gettop(L);
  1990. lua_checkstack(L,5); /* just in case */
  1991. assert(lua_istable(L,-1)); /* just in case */
  1992. assert(strcmp(clss->name, clss->cls_static->name) == 0); /* in class those 2 must be equal */
  1993. SWIG_Lua_namespace_register(L,clss->cls_static, 1);
  1994. assert(lua_istable(L,-1)); /* just in case */
  1995. /* add its constructor to module with the name of the class
  1996. so you can do MyClass(...) as well as new_MyClass(...)
  1997. BUT only if a constructor is defined
  1998. (this overcomes the problem of pure virtual classes without constructors)*/
  1999. if (clss->constructor)
  2000. {
  2001. lua_getmetatable(L,-1);
  2002. assert(lua_istable(L,-1)); /* just in case */
  2003. SWIG_Lua_add_function(L,"__call", clss->constructor);
  2004. lua_pop(L,1);
  2005. }
  2006. assert(lua_istable(L,-1)); /* just in case */
  2007. SWIG_Lua_add_class_static_details(L, clss);
  2008. /* clear stack */
  2009. lua_pop(L,1);
  2010. assert( lua_gettop(L) == begin );
  2011. }
  2012. /* Performs the instance (non-static) class registration process. Metatable for class is created
  2013. * and added to the class registry.
  2014. */
  2015. SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *clss)
  2016. {
  2017. const int SWIGUNUSED begin = lua_gettop(L);
  2018. int i;
  2019. /* if name already there (class is already registered) then do nothing */
  2020. SWIG_Lua_get_class_registry(L); /* get the registry */
  2021. lua_pushstring(L,clss->fqname); /* get the name */
  2022. lua_rawget(L,-2);
  2023. if(!lua_isnil(L,-1)) {
  2024. lua_pop(L,2);
  2025. assert(lua_gettop(L)==begin);
  2026. return;
  2027. }
  2028. lua_pop(L,2); /* tidy stack */
  2029. /* Recursively initialize all bases */
  2030. for(i=0;clss->bases[i];i++)
  2031. {
  2032. SWIG_Lua_class_register_instance(L,clss->bases[i]);
  2033. }
  2034. /* Again, get registry and push name */
  2035. SWIG_Lua_get_class_registry(L); /* get the registry */
  2036. lua_pushstring(L,clss->fqname); /* get the name */
  2037. lua_newtable(L); /* create the metatable */
  2038. #if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
  2039. /* If squashing is requested, then merges all bases metatable into this one.
  2040. * It would get us all special methods: __getitem, __add etc.
  2041. * This would set .fn, .type, and other .xxx incorrectly, but we will overwrite it right away
  2042. */
  2043. {
  2044. int new_metatable_index = lua_absindex(L,-1);
  2045. for(i=0;clss->bases[i];i++)
  2046. {
  2047. int base_metatable;
  2048. SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
  2049. base_metatable = lua_absindex(L,-1);
  2050. SWIG_Lua_merge_tables_by_index(L,new_metatable_index, base_metatable);
  2051. lua_pop(L,1);
  2052. }
  2053. }
  2054. /* And now we will overwrite all incorrectly set data */
  2055. #endif
  2056. /* add string of class name called ".type" */
  2057. lua_pushstring(L,".type");
  2058. lua_pushstring(L,clss->fqname);
  2059. lua_rawset(L,-3);
  2060. /* add a table called bases */
  2061. lua_pushstring(L,".bases");
  2062. lua_newtable(L);
  2063. lua_rawset(L,-3);
  2064. /* add a table called ".get" */
  2065. lua_pushstring(L,".get");
  2066. lua_newtable(L);
  2067. lua_rawset(L,-3);
  2068. /* add a table called ".set" */
  2069. lua_pushstring(L,".set");
  2070. lua_newtable(L);
  2071. lua_rawset(L,-3);
  2072. /* add a table called ".fn" */
  2073. lua_pushstring(L,".fn");
  2074. lua_newtable(L);
  2075. /* add manual disown method */
  2076. SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown);
  2077. lua_rawset(L,-3);
  2078. /* add accessor fns for using the .get,.set&.fn */
  2079. SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
  2080. SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
  2081. SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
  2082. /* add it */
  2083. lua_rawset(L,-3); /* metatable into registry */
  2084. lua_pop(L,1); /* tidy stack (remove registry) */
  2085. assert(lua_gettop(L) == begin);
  2086. #if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
  2087. /* Now merge all symbols from .fn, .set, .get etc from bases to our tables */
  2088. SWIG_Lua_class_squash_bases(L,clss);
  2089. #endif
  2090. SWIG_Lua_get_class_metatable(L,clss->fqname);
  2091. SWIG_Lua_add_class_instance_details(L,clss); /* recursive adding of details (atts & ops) */
  2092. lua_pop(L,1); /* tidy stack (remove class metatable) */
  2093. assert( lua_gettop(L) == begin );
  2094. }
  2095. SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss)
  2096. {
  2097. int SWIGUNUSED begin;
  2098. assert(lua_istable(L,-1)); /* This is a table (module or namespace) where classes will be added */
  2099. SWIG_Lua_class_register_instance(L,clss);
  2100. SWIG_Lua_class_register_static(L,clss);
  2101. /* Add links from static part to instance part and vice versa */
  2102. /* [SWIG registry] [Module]
  2103. * "MyClass" ----> [MyClass metatable] <===== "MyClass" -+> [static part]
  2104. * ".get" ----> ... | | getmetatable()----|
  2105. * ".set" ----> ... | | |
  2106. * ".static" --------------)----------------/ [static part metatable]
  2107. * | ".get" --> ...
  2108. * | ".set" --> ....
  2109. * |=============================== ".instance"
  2110. */
  2111. begin = lua_gettop(L);
  2112. lua_pushstring(L,clss->cls_static->name);
  2113. lua_rawget(L,-2); /* get class static table */
  2114. assert(lua_istable(L,-1));
  2115. lua_getmetatable(L,-1);
  2116. assert(lua_istable(L,-1)); /* get class static metatable */
  2117. lua_pushstring(L,".instance"); /* prepare key */
  2118. SWIG_Lua_get_class_metatable(L,clss->fqname); /* get class metatable */
  2119. assert(lua_istable(L,-1));
  2120. lua_pushstring(L,".static"); /* prepare key */
  2121. lua_pushvalue(L, -4); /* push static class TABLE */
  2122. assert(lua_istable(L,-1));
  2123. lua_rawset(L,-3); /* assign static class table(!NOT metatable) as ".static" member of class metatable */
  2124. lua_rawset(L,-3); /* assign class metatable as ".instance" member of class static METATABLE */
  2125. lua_pop(L,2);
  2126. assert(lua_gettop(L) == begin);
  2127. }
  2128. #endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
  2129. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
  2130. SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_class *clss)
  2131. {
  2132. const int SWIGUNUSED begin = lua_gettop(L);
  2133. int i;
  2134. /* if name already there (class is already registered) then do nothing */
  2135. SWIG_Lua_get_class_registry(L); /* get the registry */
  2136. lua_pushstring(L,clss->fqname); /* get the name */
  2137. lua_rawget(L,-2);
  2138. if(!lua_isnil(L,-1)) {
  2139. lua_pop(L,2);
  2140. assert(lua_gettop(L)==begin);
  2141. return;
  2142. }
  2143. lua_pop(L,2); /* tidy stack */
  2144. /* Recursively initialize all bases */
  2145. for(i=0;clss->bases[i];i++)
  2146. {
  2147. SWIG_Lua_elua_class_register_instance(L,clss->bases[i]);
  2148. }
  2149. /* Again, get registry and push name */
  2150. SWIG_Lua_get_class_registry(L); /* get the registry */
  2151. lua_pushstring(L,clss->fqname); /* get the name */
  2152. assert(clss->metatable);
  2153. lua_pushrotable(L, (void*)(clss->metatable)); /* create the metatable */
  2154. lua_rawset(L,-3);
  2155. lua_pop(L,1);
  2156. assert(lua_gettop(L) == begin);
  2157. }
  2158. #endif /* elua && eluac */
  2159. /* -----------------------------------------------------------------------------
  2160. * Class/structure conversion fns
  2161. * ----------------------------------------------------------------------------- */
  2162. /* helper to add metatable to new lua object */
  2163. SWIGINTERN void SWIG_Lua_AddMetatable(lua_State *L,swig_type_info *type)
  2164. {
  2165. if (type->clientdata) /* there is clientdata: so add the metatable */
  2166. {
  2167. SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->fqname);
  2168. if (lua_istable(L,-1))
  2169. {
  2170. lua_setmetatable(L,-2);
  2171. }
  2172. else
  2173. {
  2174. lua_pop(L,1);
  2175. }
  2176. }
  2177. }
  2178. /* pushes a new object into the lua stack */
  2179. SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own)
  2180. {
  2181. swig_lua_userdata *usr;
  2182. if (!ptr){
  2183. lua_pushnil(L);
  2184. return;
  2185. }
  2186. usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */
  2187. usr->ptr=ptr; /* set the ptr */
  2188. usr->type=type;
  2189. usr->own=own;
  2190. #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
  2191. SWIG_Lua_AddMetatable(L,type); /* add metatable */
  2192. #endif
  2193. }
  2194. /* takes a object from the lua stack & converts it into an object of the correct type
  2195. (if possible) */
  2196. SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags)
  2197. {
  2198. swig_lua_userdata *usr;
  2199. swig_cast_info *cast;
  2200. if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
  2201. usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
  2202. if (usr)
  2203. {
  2204. if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
  2205. {
  2206. usr->own=0;
  2207. }
  2208. if (!type) /* special cast void*, no casting fn */
  2209. {
  2210. *ptr=usr->ptr;
  2211. return SWIG_OK; /* ok */
  2212. }
  2213. cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
  2214. if (cast)
  2215. {
  2216. int newmemory = 0;
  2217. *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
  2218. assert(!newmemory); /* newmemory handling not yet implemented */
  2219. return SWIG_OK; /* ok */
  2220. }
  2221. }
  2222. return SWIG_ERROR; /* error */
  2223. }
  2224. SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags,
  2225. int argnum,const char *func_name){
  2226. void *result;
  2227. if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
  2228. luaL_error (L,"Error in %s, expected a %s at argument number %d\n",
  2229. func_name,(type && type->str)?type->str:"void*",argnum);
  2230. }
  2231. return result;
  2232. }
  2233. /* pushes a packed userdata. user for member fn pointers only */
  2234. SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type)
  2235. {
  2236. swig_lua_rawdata *raw;
  2237. assert(ptr); /* not acceptable to pass in a NULL value */
  2238. raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */
  2239. raw->type=type;
  2240. raw->own=0;
  2241. memcpy(raw->data,ptr,size); /* copy the data */
  2242. SWIG_Lua_AddMetatable(L,type); /* add metatable */
  2243. }
  2244. /* converts a packed userdata. user for member fn pointers only */
  2245. SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type)
  2246. {
  2247. swig_lua_rawdata *raw;
  2248. raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */
  2249. if (!raw) return SWIG_ERROR; /* error */
  2250. if (type==0 || type==raw->type) /* void* or identical type */
  2251. {
  2252. memcpy(ptr,raw->data,size); /* copy it */
  2253. return SWIG_OK; /* ok */
  2254. }
  2255. return SWIG_ERROR; /* error */
  2256. }
  2257. /* a function to get the typestring of a piece of data */
  2258. SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
  2259. {
  2260. swig_lua_userdata *usr;
  2261. if (lua_isuserdata(L,tp))
  2262. {
  2263. usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */
  2264. if (usr && usr->type && usr->type->str)
  2265. return usr->type->str;
  2266. return "userdata (unknown type)";
  2267. }
  2268. return lua_typename(L,lua_type(L,tp));
  2269. }
  2270. /* lua callable function to get the userdata's type */
  2271. SWIGRUNTIME int SWIG_Lua_type(lua_State *L)
  2272. {
  2273. lua_pushstring(L,SWIG_Lua_typename(L,1));
  2274. return 1;
  2275. }
  2276. /* -----------------------------------------------------------------------------
  2277. * global variable support code: class/struct typemap functions
  2278. * ----------------------------------------------------------------------------- */
  2279. #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
  2280. /* Install Constants */
  2281. SWIGINTERN void
  2282. SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
  2283. int i;
  2284. for (i = 0; constants[i].type; i++) {
  2285. switch(constants[i].type) {
  2286. case SWIG_LUA_INT:
  2287. lua_pushstring(L,constants[i].name);
  2288. lua_pushnumber(L,(lua_Number)constants[i].lvalue);
  2289. lua_rawset(L,-3);
  2290. break;
  2291. case SWIG_LUA_FLOAT:
  2292. lua_pushstring(L,constants[i].name);
  2293. lua_pushnumber(L,(lua_Number)constants[i].dvalue);
  2294. lua_rawset(L,-3);
  2295. break;
  2296. case SWIG_LUA_CHAR:
  2297. lua_pushstring(L,constants[i].name);
  2298. lua_pushfstring(L,"%c",(char)constants[i].lvalue);
  2299. lua_rawset(L,-3);
  2300. break;
  2301. case SWIG_LUA_STRING:
  2302. lua_pushstring(L,constants[i].name);
  2303. lua_pushstring(L,(char *) constants[i].pvalue);
  2304. lua_rawset(L,-3);
  2305. break;
  2306. case SWIG_LUA_POINTER:
  2307. lua_pushstring(L,constants[i].name);
  2308. SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
  2309. lua_rawset(L,-3);
  2310. break;
  2311. case SWIG_LUA_BINARY:
  2312. lua_pushstring(L,constants[i].name);
  2313. SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
  2314. lua_rawset(L,-3);
  2315. break;
  2316. default:
  2317. break;
  2318. }
  2319. }
  2320. }
  2321. #endif
  2322. /* -----------------------------------------------------------------------------
  2323. * executing lua code from within the wrapper
  2324. * ----------------------------------------------------------------------------- */
  2325. #ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
  2326. #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
  2327. #endif
  2328. /* Executes a C string in Lua which is a really simple way of calling lua from C
  2329. Unfortunately lua keeps changing its APIs, so we need a conditional compile
  2330. In lua 5.0.X it's lua_dostring()
  2331. In lua 5.1.X it's luaL_dostring()
  2332. */
  2333. SWIGINTERN int
  2334. SWIG_Lua_dostring(lua_State *L, const char *str) {
  2335. int ok,top;
  2336. if (str==0 || str[0]==0) return 0; /* nothing to do */
  2337. top=lua_gettop(L); /* save stack */
  2338. #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
  2339. ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */
  2340. #else
  2341. ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */
  2342. #endif
  2343. if (ok!=0) {
  2344. SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
  2345. }
  2346. lua_settop(L,top); /* restore the stack */
  2347. return ok;
  2348. }
  2349. #ifdef __cplusplus
  2350. }
  2351. #endif
  2352. /* ------------------------------ end luarun.swg ------------------------------ */
  2353. /* -------- TYPES TABLE (BEGIN) -------- */
  2354. #define SWIGTYPE_p_ESLconnection swig_types[0]
  2355. #define SWIGTYPE_p_ESLevent swig_types[1]
  2356. #define SWIGTYPE_p_esl_event_t swig_types[2]
  2357. #define SWIGTYPE_p_esl_priority_t swig_types[3]
  2358. static swig_type_info *swig_types[5];
  2359. static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
  2360. #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
  2361. #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
  2362. /* -------- TYPES TABLE (END) -------- */
  2363. #define SWIG_name "ESL"
  2364. #define SWIG_init luaopen_ESL
  2365. #define SWIG_init_user luaopen_ESL_user
  2366. #define SWIG_LUACODE luaopen_ESL_luacode
  2367. namespace swig {
  2368. typedef struct{} LANGUAGE_OBJ;
  2369. }
  2370. #include "esl.h"
  2371. #include "esl_oop.h"
  2372. SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
  2373. int ret = lua_isstring(L, idx);
  2374. if (!ret)
  2375. ret = lua_isnil(L, idx);
  2376. return ret;
  2377. }
  2378. #ifdef __cplusplus
  2379. extern "C" {
  2380. #endif
  2381. static int _wrap_ESLevent_event_set(lua_State* L) {
  2382. int SWIG_arg = 0;
  2383. ESLevent *arg1 = (ESLevent *) 0 ;
  2384. esl_event_t *arg2 = (esl_event_t *) 0 ;
  2385. SWIG_check_num_args("ESLevent::event",2,2)
  2386. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::event",1,"ESLevent *");
  2387. if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("ESLevent::event",2,"esl_event_t *");
  2388. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2389. SWIG_fail_ptr("ESLevent_event_set",1,SWIGTYPE_p_ESLevent);
  2390. }
  2391. if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_esl_event_t,SWIG_POINTER_DISOWN))){
  2392. SWIG_fail_ptr("ESLevent_event_set",2,SWIGTYPE_p_esl_event_t);
  2393. }
  2394. if (arg1) (arg1)->event = arg2;
  2395. return SWIG_arg;
  2396. if(0) SWIG_fail;
  2397. fail:
  2398. lua_error(L);
  2399. return SWIG_arg;
  2400. }
  2401. static int _wrap_ESLevent_event_get(lua_State* L) {
  2402. int SWIG_arg = 0;
  2403. ESLevent *arg1 = (ESLevent *) 0 ;
  2404. esl_event_t *result = 0 ;
  2405. SWIG_check_num_args("ESLevent::event",1,1)
  2406. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::event",1,"ESLevent *");
  2407. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2408. SWIG_fail_ptr("ESLevent_event_get",1,SWIGTYPE_p_ESLevent);
  2409. }
  2410. result = (esl_event_t *) ((arg1)->event);
  2411. SWIG_NewPointerObj(L,result,SWIGTYPE_p_esl_event_t,0); SWIG_arg++;
  2412. return SWIG_arg;
  2413. if(0) SWIG_fail;
  2414. fail:
  2415. lua_error(L);
  2416. return SWIG_arg;
  2417. }
  2418. static int _wrap_ESLevent_serialized_string_set(lua_State* L) {
  2419. int SWIG_arg = 0;
  2420. ESLevent *arg1 = (ESLevent *) 0 ;
  2421. char *arg2 = (char *) 0 ;
  2422. SWIG_check_num_args("ESLevent::serialized_string",2,2)
  2423. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::serialized_string",1,"ESLevent *");
  2424. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::serialized_string",2,"char *");
  2425. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2426. SWIG_fail_ptr("ESLevent_serialized_string_set",1,SWIGTYPE_p_ESLevent);
  2427. }
  2428. arg2 = (char *)lua_tostring(L, 2);
  2429. {
  2430. delete [] arg1->serialized_string;
  2431. if (arg2) {
  2432. arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
  2433. strcpy((char *)arg1->serialized_string, (const char *)arg2);
  2434. } else {
  2435. arg1->serialized_string = 0;
  2436. }
  2437. }
  2438. return SWIG_arg;
  2439. if(0) SWIG_fail;
  2440. fail:
  2441. lua_error(L);
  2442. return SWIG_arg;
  2443. }
  2444. static int _wrap_ESLevent_serialized_string_get(lua_State* L) {
  2445. int SWIG_arg = 0;
  2446. ESLevent *arg1 = (ESLevent *) 0 ;
  2447. char *result = 0 ;
  2448. SWIG_check_num_args("ESLevent::serialized_string",1,1)
  2449. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::serialized_string",1,"ESLevent *");
  2450. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2451. SWIG_fail_ptr("ESLevent_serialized_string_get",1,SWIGTYPE_p_ESLevent);
  2452. }
  2453. result = (char *) ((arg1)->serialized_string);
  2454. lua_pushstring(L,(const char *)result); SWIG_arg++;
  2455. return SWIG_arg;
  2456. if(0) SWIG_fail;
  2457. fail:
  2458. lua_error(L);
  2459. return SWIG_arg;
  2460. }
  2461. static int _wrap_ESLevent_mine_set(lua_State* L) {
  2462. int SWIG_arg = 0;
  2463. ESLevent *arg1 = (ESLevent *) 0 ;
  2464. int arg2 ;
  2465. SWIG_check_num_args("ESLevent::mine",2,2)
  2466. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::mine",1,"ESLevent *");
  2467. if(!lua_isnumber(L,2)) SWIG_fail_arg("ESLevent::mine",2,"int");
  2468. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2469. SWIG_fail_ptr("ESLevent_mine_set",1,SWIGTYPE_p_ESLevent);
  2470. }
  2471. arg2 = (int)lua_tonumber(L, 2);
  2472. if (arg1) (arg1)->mine = arg2;
  2473. return SWIG_arg;
  2474. if(0) SWIG_fail;
  2475. fail:
  2476. lua_error(L);
  2477. return SWIG_arg;
  2478. }
  2479. static int _wrap_ESLevent_mine_get(lua_State* L) {
  2480. int SWIG_arg = 0;
  2481. ESLevent *arg1 = (ESLevent *) 0 ;
  2482. int result;
  2483. SWIG_check_num_args("ESLevent::mine",1,1)
  2484. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::mine",1,"ESLevent *");
  2485. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2486. SWIG_fail_ptr("ESLevent_mine_get",1,SWIGTYPE_p_ESLevent);
  2487. }
  2488. result = (int) ((arg1)->mine);
  2489. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  2490. return SWIG_arg;
  2491. if(0) SWIG_fail;
  2492. fail:
  2493. lua_error(L);
  2494. return SWIG_arg;
  2495. }
  2496. static int _wrap_new_ESLevent__SWIG_0(lua_State* L) {
  2497. int SWIG_arg = 0;
  2498. char *arg1 = (char *) 0 ;
  2499. char *arg2 = (char *) NULL ;
  2500. ESLevent *result = 0 ;
  2501. SWIG_check_num_args("ESLevent::ESLevent",1,2)
  2502. if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("ESLevent::ESLevent",1,"char const *");
  2503. if(lua_gettop(L)>=2 && !SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::ESLevent",2,"char const *");
  2504. arg1 = (char *)lua_tostring(L, 1);
  2505. if(lua_gettop(L)>=2){
  2506. arg2 = (char *)lua_tostring(L, 2);
  2507. }
  2508. result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
  2509. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  2510. return SWIG_arg;
  2511. if(0) SWIG_fail;
  2512. fail:
  2513. lua_error(L);
  2514. return SWIG_arg;
  2515. }
  2516. static int _wrap_new_ESLevent__SWIG_1(lua_State* L) {
  2517. int SWIG_arg = 0;
  2518. esl_event_t *arg1 = (esl_event_t *) 0 ;
  2519. int arg2 = (int) 0 ;
  2520. ESLevent *result = 0 ;
  2521. SWIG_check_num_args("ESLevent::ESLevent",1,2)
  2522. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::ESLevent",1,"esl_event_t *");
  2523. if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg("ESLevent::ESLevent",2,"int");
  2524. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_esl_event_t,0))){
  2525. SWIG_fail_ptr("new_ESLevent",1,SWIGTYPE_p_esl_event_t);
  2526. }
  2527. if(lua_gettop(L)>=2){
  2528. arg2 = (int)lua_tonumber(L, 2);
  2529. }
  2530. result = (ESLevent *)new ESLevent(arg1,arg2);
  2531. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  2532. return SWIG_arg;
  2533. if(0) SWIG_fail;
  2534. fail:
  2535. lua_error(L);
  2536. return SWIG_arg;
  2537. }
  2538. static int _wrap_new_ESLevent__SWIG_2(lua_State* L) {
  2539. int SWIG_arg = 0;
  2540. ESLevent *arg1 = (ESLevent *) 0 ;
  2541. ESLevent *result = 0 ;
  2542. SWIG_check_num_args("ESLevent::ESLevent",1,1)
  2543. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::ESLevent",1,"ESLevent *");
  2544. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2545. SWIG_fail_ptr("new_ESLevent",1,SWIGTYPE_p_ESLevent);
  2546. }
  2547. result = (ESLevent *)new ESLevent(arg1);
  2548. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  2549. return SWIG_arg;
  2550. if(0) SWIG_fail;
  2551. fail:
  2552. lua_error(L);
  2553. return SWIG_arg;
  2554. }
  2555. static int _wrap_new_ESLevent(lua_State* L) {
  2556. int argc;
  2557. int argv[3]={
  2558. 1,2,3
  2559. };
  2560. argc = lua_gettop(L);
  2561. if ((argc >= 1) && (argc <= 2)) {
  2562. int _v;
  2563. {
  2564. void *ptr;
  2565. if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_esl_event_t, 0)) {
  2566. _v = 0;
  2567. } else {
  2568. _v = 1;
  2569. }
  2570. }
  2571. if (_v) {
  2572. if (argc <= 1) {
  2573. return _wrap_new_ESLevent__SWIG_1(L);
  2574. }
  2575. {
  2576. _v = lua_isnumber(L,argv[1]);
  2577. }
  2578. if (_v) {
  2579. return _wrap_new_ESLevent__SWIG_1(L);
  2580. }
  2581. }
  2582. }
  2583. if (argc == 1) {
  2584. int _v;
  2585. {
  2586. void *ptr;
  2587. if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_ESLevent, 0)) {
  2588. _v = 0;
  2589. } else {
  2590. _v = 1;
  2591. }
  2592. }
  2593. if (_v) {
  2594. return _wrap_new_ESLevent__SWIG_2(L);
  2595. }
  2596. }
  2597. if ((argc >= 1) && (argc <= 2)) {
  2598. int _v;
  2599. {
  2600. _v = SWIG_lua_isnilstring(L,argv[0]);
  2601. }
  2602. if (_v) {
  2603. if (argc <= 1) {
  2604. return _wrap_new_ESLevent__SWIG_0(L);
  2605. }
  2606. {
  2607. _v = SWIG_lua_isnilstring(L,argv[1]);
  2608. }
  2609. if (_v) {
  2610. return _wrap_new_ESLevent__SWIG_0(L);
  2611. }
  2612. }
  2613. }
  2614. SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_ESLevent'\n"
  2615. " Possible C/C++ prototypes are:\n"
  2616. " ESLevent::ESLevent(char const *,char const *)\n"
  2617. " ESLevent::ESLevent(esl_event_t *,int)\n"
  2618. " ESLevent::ESLevent(ESLevent *)\n");
  2619. lua_error(L);return 0;
  2620. }
  2621. static int _wrap_ESLevent_serialize(lua_State* L) {
  2622. int SWIG_arg = 0;
  2623. ESLevent *arg1 = (ESLevent *) 0 ;
  2624. char *arg2 = (char *) NULL ;
  2625. char *result = 0 ;
  2626. SWIG_check_num_args("ESLevent::serialize",1,2)
  2627. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::serialize",1,"ESLevent *");
  2628. if(lua_gettop(L)>=2 && !SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::serialize",2,"char const *");
  2629. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2630. SWIG_fail_ptr("ESLevent_serialize",1,SWIGTYPE_p_ESLevent);
  2631. }
  2632. if(lua_gettop(L)>=2){
  2633. arg2 = (char *)lua_tostring(L, 2);
  2634. }
  2635. result = (char *)(arg1)->serialize((char const *)arg2);
  2636. lua_pushstring(L,(const char *)result); SWIG_arg++;
  2637. return SWIG_arg;
  2638. if(0) SWIG_fail;
  2639. fail:
  2640. lua_error(L);
  2641. return SWIG_arg;
  2642. }
  2643. static int _wrap_ESLevent_setPriority(lua_State* L) {
  2644. int SWIG_arg = 0;
  2645. ESLevent *arg1 = (ESLevent *) 0 ;
  2646. esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
  2647. esl_priority_t *argp2 ;
  2648. bool result;
  2649. SWIG_check_num_args("ESLevent::setPriority",1,2)
  2650. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::setPriority",1,"ESLevent *");
  2651. if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg("ESLevent::setPriority",2,"esl_priority_t");
  2652. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2653. SWIG_fail_ptr("ESLevent_setPriority",1,SWIGTYPE_p_ESLevent);
  2654. }
  2655. if(lua_gettop(L)>=2){
  2656. if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_esl_priority_t,0))){
  2657. SWIG_fail_ptr("ESLevent_setPriority",2,SWIGTYPE_p_esl_priority_t);
  2658. }
  2659. arg2 = *argp2;
  2660. }
  2661. result = (bool)(arg1)->setPriority(arg2);
  2662. lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
  2663. return SWIG_arg;
  2664. if(0) SWIG_fail;
  2665. fail:
  2666. lua_error(L);
  2667. return SWIG_arg;
  2668. }
  2669. static int _wrap_ESLevent_getHeader(lua_State* L) {
  2670. int SWIG_arg = 0;
  2671. ESLevent *arg1 = (ESLevent *) 0 ;
  2672. char *arg2 = (char *) 0 ;
  2673. int arg3 = (int) -1 ;
  2674. char *result = 0 ;
  2675. SWIG_check_num_args("ESLevent::getHeader",2,3)
  2676. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::getHeader",1,"ESLevent *");
  2677. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::getHeader",2,"char const *");
  2678. if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg("ESLevent::getHeader",3,"int");
  2679. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2680. SWIG_fail_ptr("ESLevent_getHeader",1,SWIGTYPE_p_ESLevent);
  2681. }
  2682. arg2 = (char *)lua_tostring(L, 2);
  2683. if(lua_gettop(L)>=3){
  2684. arg3 = (int)lua_tonumber(L, 3);
  2685. }
  2686. result = (char *)(arg1)->getHeader((char const *)arg2,arg3);
  2687. lua_pushstring(L,(const char *)result); SWIG_arg++;
  2688. return SWIG_arg;
  2689. if(0) SWIG_fail;
  2690. fail:
  2691. lua_error(L);
  2692. return SWIG_arg;
  2693. }
  2694. static int _wrap_ESLevent_getBody(lua_State* L) {
  2695. int SWIG_arg = 0;
  2696. ESLevent *arg1 = (ESLevent *) 0 ;
  2697. char *result = 0 ;
  2698. SWIG_check_num_args("ESLevent::getBody",1,1)
  2699. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::getBody",1,"ESLevent *");
  2700. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2701. SWIG_fail_ptr("ESLevent_getBody",1,SWIGTYPE_p_ESLevent);
  2702. }
  2703. result = (char *)(arg1)->getBody();
  2704. lua_pushstring(L,(const char *)result); SWIG_arg++;
  2705. return SWIG_arg;
  2706. if(0) SWIG_fail;
  2707. fail:
  2708. lua_error(L);
  2709. return SWIG_arg;
  2710. }
  2711. static int _wrap_ESLevent_getType(lua_State* L) {
  2712. int SWIG_arg = 0;
  2713. ESLevent *arg1 = (ESLevent *) 0 ;
  2714. char *result = 0 ;
  2715. SWIG_check_num_args("ESLevent::getType",1,1)
  2716. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::getType",1,"ESLevent *");
  2717. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2718. SWIG_fail_ptr("ESLevent_getType",1,SWIGTYPE_p_ESLevent);
  2719. }
  2720. result = (char *)(arg1)->getType();
  2721. lua_pushstring(L,(const char *)result); SWIG_arg++;
  2722. return SWIG_arg;
  2723. if(0) SWIG_fail;
  2724. fail:
  2725. lua_error(L);
  2726. return SWIG_arg;
  2727. }
  2728. static int _wrap_ESLevent_addBody(lua_State* L) {
  2729. int SWIG_arg = 0;
  2730. ESLevent *arg1 = (ESLevent *) 0 ;
  2731. char *arg2 = (char *) 0 ;
  2732. bool result;
  2733. SWIG_check_num_args("ESLevent::addBody",2,2)
  2734. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::addBody",1,"ESLevent *");
  2735. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::addBody",2,"char const *");
  2736. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2737. SWIG_fail_ptr("ESLevent_addBody",1,SWIGTYPE_p_ESLevent);
  2738. }
  2739. arg2 = (char *)lua_tostring(L, 2);
  2740. result = (bool)(arg1)->addBody((char const *)arg2);
  2741. lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
  2742. return SWIG_arg;
  2743. if(0) SWIG_fail;
  2744. fail:
  2745. lua_error(L);
  2746. return SWIG_arg;
  2747. }
  2748. static int _wrap_ESLevent_addHeader(lua_State* L) {
  2749. int SWIG_arg = 0;
  2750. ESLevent *arg1 = (ESLevent *) 0 ;
  2751. char *arg2 = (char *) 0 ;
  2752. char *arg3 = (char *) 0 ;
  2753. bool result;
  2754. SWIG_check_num_args("ESLevent::addHeader",3,3)
  2755. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::addHeader",1,"ESLevent *");
  2756. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::addHeader",2,"char const *");
  2757. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLevent::addHeader",3,"char const *");
  2758. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2759. SWIG_fail_ptr("ESLevent_addHeader",1,SWIGTYPE_p_ESLevent);
  2760. }
  2761. arg2 = (char *)lua_tostring(L, 2);
  2762. arg3 = (char *)lua_tostring(L, 3);
  2763. result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
  2764. lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
  2765. return SWIG_arg;
  2766. if(0) SWIG_fail;
  2767. fail:
  2768. lua_error(L);
  2769. return SWIG_arg;
  2770. }
  2771. static int _wrap_ESLevent_pushHeader(lua_State* L) {
  2772. int SWIG_arg = 0;
  2773. ESLevent *arg1 = (ESLevent *) 0 ;
  2774. char *arg2 = (char *) 0 ;
  2775. char *arg3 = (char *) 0 ;
  2776. bool result;
  2777. SWIG_check_num_args("ESLevent::pushHeader",3,3)
  2778. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::pushHeader",1,"ESLevent *");
  2779. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::pushHeader",2,"char const *");
  2780. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLevent::pushHeader",3,"char const *");
  2781. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2782. SWIG_fail_ptr("ESLevent_pushHeader",1,SWIGTYPE_p_ESLevent);
  2783. }
  2784. arg2 = (char *)lua_tostring(L, 2);
  2785. arg3 = (char *)lua_tostring(L, 3);
  2786. result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3);
  2787. lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
  2788. return SWIG_arg;
  2789. if(0) SWIG_fail;
  2790. fail:
  2791. lua_error(L);
  2792. return SWIG_arg;
  2793. }
  2794. static int _wrap_ESLevent_unshiftHeader(lua_State* L) {
  2795. int SWIG_arg = 0;
  2796. ESLevent *arg1 = (ESLevent *) 0 ;
  2797. char *arg2 = (char *) 0 ;
  2798. char *arg3 = (char *) 0 ;
  2799. bool result;
  2800. SWIG_check_num_args("ESLevent::unshiftHeader",3,3)
  2801. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::unshiftHeader",1,"ESLevent *");
  2802. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::unshiftHeader",2,"char const *");
  2803. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLevent::unshiftHeader",3,"char const *");
  2804. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2805. SWIG_fail_ptr("ESLevent_unshiftHeader",1,SWIGTYPE_p_ESLevent);
  2806. }
  2807. arg2 = (char *)lua_tostring(L, 2);
  2808. arg3 = (char *)lua_tostring(L, 3);
  2809. result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3);
  2810. lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
  2811. return SWIG_arg;
  2812. if(0) SWIG_fail;
  2813. fail:
  2814. lua_error(L);
  2815. return SWIG_arg;
  2816. }
  2817. static int _wrap_ESLevent_delHeader(lua_State* L) {
  2818. int SWIG_arg = 0;
  2819. ESLevent *arg1 = (ESLevent *) 0 ;
  2820. char *arg2 = (char *) 0 ;
  2821. bool result;
  2822. SWIG_check_num_args("ESLevent::delHeader",2,2)
  2823. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::delHeader",1,"ESLevent *");
  2824. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLevent::delHeader",2,"char const *");
  2825. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2826. SWIG_fail_ptr("ESLevent_delHeader",1,SWIGTYPE_p_ESLevent);
  2827. }
  2828. arg2 = (char *)lua_tostring(L, 2);
  2829. result = (bool)(arg1)->delHeader((char const *)arg2);
  2830. lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
  2831. return SWIG_arg;
  2832. if(0) SWIG_fail;
  2833. fail:
  2834. lua_error(L);
  2835. return SWIG_arg;
  2836. }
  2837. static int _wrap_ESLevent_firstHeader(lua_State* L) {
  2838. int SWIG_arg = 0;
  2839. ESLevent *arg1 = (ESLevent *) 0 ;
  2840. char *result = 0 ;
  2841. SWIG_check_num_args("ESLevent::firstHeader",1,1)
  2842. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::firstHeader",1,"ESLevent *");
  2843. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2844. SWIG_fail_ptr("ESLevent_firstHeader",1,SWIGTYPE_p_ESLevent);
  2845. }
  2846. result = (char *)(arg1)->firstHeader();
  2847. lua_pushstring(L,(const char *)result); SWIG_arg++;
  2848. return SWIG_arg;
  2849. if(0) SWIG_fail;
  2850. fail:
  2851. lua_error(L);
  2852. return SWIG_arg;
  2853. }
  2854. static int _wrap_ESLevent_nextHeader(lua_State* L) {
  2855. int SWIG_arg = 0;
  2856. ESLevent *arg1 = (ESLevent *) 0 ;
  2857. char *result = 0 ;
  2858. SWIG_check_num_args("ESLevent::nextHeader",1,1)
  2859. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLevent::nextHeader",1,"ESLevent *");
  2860. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
  2861. SWIG_fail_ptr("ESLevent_nextHeader",1,SWIGTYPE_p_ESLevent);
  2862. }
  2863. result = (char *)(arg1)->nextHeader();
  2864. lua_pushstring(L,(const char *)result); SWIG_arg++;
  2865. return SWIG_arg;
  2866. if(0) SWIG_fail;
  2867. fail:
  2868. lua_error(L);
  2869. return SWIG_arg;
  2870. }
  2871. static void swig_delete_ESLevent(void *obj) {
  2872. ESLevent *arg1 = (ESLevent *) obj;
  2873. delete arg1;
  2874. }
  2875. static int _proxy__wrap_new_ESLevent(lua_State *L) {
  2876. assert(lua_istable(L,1));
  2877. lua_pushcfunction(L,_wrap_new_ESLevent);
  2878. assert(!lua_isnil(L,-1));
  2879. lua_replace(L,1); /* replace our table with real constructor */
  2880. lua_call(L,lua_gettop(L)-1,1);
  2881. return 1;
  2882. }
  2883. static swig_lua_attribute swig_ESLevent_attributes[] = {
  2884. { "event", _wrap_ESLevent_event_get, _wrap_ESLevent_event_set },
  2885. { "serialized_string", _wrap_ESLevent_serialized_string_get, _wrap_ESLevent_serialized_string_set },
  2886. { "mine", _wrap_ESLevent_mine_get, _wrap_ESLevent_mine_set },
  2887. {0,0,0}
  2888. };
  2889. static swig_lua_method swig_ESLevent_methods[]= {
  2890. { "serialize", _wrap_ESLevent_serialize},
  2891. { "setPriority", _wrap_ESLevent_setPriority},
  2892. { "getHeader", _wrap_ESLevent_getHeader},
  2893. { "getBody", _wrap_ESLevent_getBody},
  2894. { "getType", _wrap_ESLevent_getType},
  2895. { "addBody", _wrap_ESLevent_addBody},
  2896. { "addHeader", _wrap_ESLevent_addHeader},
  2897. { "pushHeader", _wrap_ESLevent_pushHeader},
  2898. { "unshiftHeader", _wrap_ESLevent_unshiftHeader},
  2899. { "delHeader", _wrap_ESLevent_delHeader},
  2900. { "firstHeader", _wrap_ESLevent_firstHeader},
  2901. { "nextHeader", _wrap_ESLevent_nextHeader},
  2902. {0,0}
  2903. };
  2904. static swig_lua_method swig_ESLevent_meta[] = {
  2905. {0,0}
  2906. };
  2907. static swig_lua_attribute swig_ESLevent_Sf_SwigStatic_attributes[] = {
  2908. {0,0,0}
  2909. };
  2910. static swig_lua_const_info swig_ESLevent_Sf_SwigStatic_constants[]= {
  2911. {0,0,0,0,0,0}
  2912. };
  2913. static swig_lua_method swig_ESLevent_Sf_SwigStatic_methods[]= {
  2914. {0,0}
  2915. };
  2916. static swig_lua_class* swig_ESLevent_Sf_SwigStatic_classes[]= {
  2917. 0
  2918. };
  2919. static swig_lua_namespace swig_ESLevent_Sf_SwigStatic = {
  2920. "ESLevent",
  2921. swig_ESLevent_Sf_SwigStatic_methods,
  2922. swig_ESLevent_Sf_SwigStatic_attributes,
  2923. swig_ESLevent_Sf_SwigStatic_constants,
  2924. swig_ESLevent_Sf_SwigStatic_classes,
  2925. 0
  2926. };
  2927. static swig_lua_class *swig_ESLevent_bases[] = {0};
  2928. static const char *swig_ESLevent_base_names[] = {0};
  2929. static swig_lua_class _wrap_class_ESLevent = { "ESLevent", "ESLevent", &SWIGTYPE_p_ESLevent,_proxy__wrap_new_ESLevent, swig_delete_ESLevent, swig_ESLevent_methods, swig_ESLevent_attributes, &swig_ESLevent_Sf_SwigStatic, swig_ESLevent_meta, swig_ESLevent_bases, swig_ESLevent_base_names };
  2930. static int _wrap_new_ESLconnection__SWIG_0(lua_State* L) {
  2931. int SWIG_arg = 0;
  2932. char *arg1 = (char *) 0 ;
  2933. int arg2 ;
  2934. char *arg3 = (char *) 0 ;
  2935. char *arg4 = (char *) 0 ;
  2936. ESLconnection *result = 0 ;
  2937. SWIG_check_num_args("ESLconnection::ESLconnection",4,4)
  2938. if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("ESLconnection::ESLconnection",1,"char const *");
  2939. if(!lua_isnumber(L,2)) SWIG_fail_arg("ESLconnection::ESLconnection",2,"int const");
  2940. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::ESLconnection",3,"char const *");
  2941. if(!SWIG_lua_isnilstring(L,4)) SWIG_fail_arg("ESLconnection::ESLconnection",4,"char const *");
  2942. arg1 = (char *)lua_tostring(L, 1);
  2943. arg2 = (int const)lua_tonumber(L, 2);
  2944. arg3 = (char *)lua_tostring(L, 3);
  2945. arg4 = (char *)lua_tostring(L, 4);
  2946. result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4);
  2947. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++;
  2948. return SWIG_arg;
  2949. if(0) SWIG_fail;
  2950. fail:
  2951. lua_error(L);
  2952. return SWIG_arg;
  2953. }
  2954. static int _wrap_new_ESLconnection__SWIG_1(lua_State* L) {
  2955. int SWIG_arg = 0;
  2956. char *arg1 = (char *) 0 ;
  2957. int arg2 ;
  2958. char *arg3 = (char *) 0 ;
  2959. ESLconnection *result = 0 ;
  2960. SWIG_check_num_args("ESLconnection::ESLconnection",3,3)
  2961. if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("ESLconnection::ESLconnection",1,"char const *");
  2962. if(!lua_isnumber(L,2)) SWIG_fail_arg("ESLconnection::ESLconnection",2,"int const");
  2963. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::ESLconnection",3,"char const *");
  2964. arg1 = (char *)lua_tostring(L, 1);
  2965. arg2 = (int const)lua_tonumber(L, 2);
  2966. arg3 = (char *)lua_tostring(L, 3);
  2967. result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3);
  2968. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++;
  2969. return SWIG_arg;
  2970. if(0) SWIG_fail;
  2971. fail:
  2972. lua_error(L);
  2973. return SWIG_arg;
  2974. }
  2975. static int _wrap_new_ESLconnection__SWIG_2(lua_State* L) {
  2976. int SWIG_arg = 0;
  2977. char *arg1 = (char *) 0 ;
  2978. char *arg2 = (char *) 0 ;
  2979. char *arg3 = (char *) 0 ;
  2980. char *arg4 = (char *) 0 ;
  2981. ESLconnection *result = 0 ;
  2982. SWIG_check_num_args("ESLconnection::ESLconnection",4,4)
  2983. if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("ESLconnection::ESLconnection",1,"char const *");
  2984. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::ESLconnection",2,"char const *");
  2985. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::ESLconnection",3,"char const *");
  2986. if(!SWIG_lua_isnilstring(L,4)) SWIG_fail_arg("ESLconnection::ESLconnection",4,"char const *");
  2987. arg1 = (char *)lua_tostring(L, 1);
  2988. arg2 = (char *)lua_tostring(L, 2);
  2989. arg3 = (char *)lua_tostring(L, 3);
  2990. arg4 = (char *)lua_tostring(L, 4);
  2991. result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
  2992. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++;
  2993. return SWIG_arg;
  2994. if(0) SWIG_fail;
  2995. fail:
  2996. lua_error(L);
  2997. return SWIG_arg;
  2998. }
  2999. static int _wrap_new_ESLconnection__SWIG_3(lua_State* L) {
  3000. int SWIG_arg = 0;
  3001. char *arg1 = (char *) 0 ;
  3002. char *arg2 = (char *) 0 ;
  3003. char *arg3 = (char *) 0 ;
  3004. ESLconnection *result = 0 ;
  3005. SWIG_check_num_args("ESLconnection::ESLconnection",3,3)
  3006. if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("ESLconnection::ESLconnection",1,"char const *");
  3007. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::ESLconnection",2,"char const *");
  3008. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::ESLconnection",3,"char const *");
  3009. arg1 = (char *)lua_tostring(L, 1);
  3010. arg2 = (char *)lua_tostring(L, 2);
  3011. arg3 = (char *)lua_tostring(L, 3);
  3012. result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
  3013. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++;
  3014. return SWIG_arg;
  3015. if(0) SWIG_fail;
  3016. fail:
  3017. lua_error(L);
  3018. return SWIG_arg;
  3019. }
  3020. static int _wrap_new_ESLconnection__SWIG_4(lua_State* L) {
  3021. int SWIG_arg = 0;
  3022. int arg1 ;
  3023. ESLconnection *result = 0 ;
  3024. SWIG_check_num_args("ESLconnection::ESLconnection",1,1)
  3025. if(!lua_isnumber(L,1)) SWIG_fail_arg("ESLconnection::ESLconnection",1,"int");
  3026. arg1 = (int)lua_tonumber(L, 1);
  3027. result = (ESLconnection *)new ESLconnection(arg1);
  3028. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++;
  3029. return SWIG_arg;
  3030. if(0) SWIG_fail;
  3031. fail:
  3032. lua_error(L);
  3033. return SWIG_arg;
  3034. }
  3035. static int _wrap_new_ESLconnection(lua_State* L) {
  3036. int argc;
  3037. int argv[5]={
  3038. 1,2,3,4,5
  3039. };
  3040. argc = lua_gettop(L);
  3041. if (argc == 1) {
  3042. int _v;
  3043. {
  3044. _v = lua_isnumber(L,argv[0]);
  3045. }
  3046. if (_v) {
  3047. return _wrap_new_ESLconnection__SWIG_4(L);
  3048. }
  3049. }
  3050. if (argc == 3) {
  3051. int _v;
  3052. {
  3053. _v = SWIG_lua_isnilstring(L,argv[0]);
  3054. }
  3055. if (_v) {
  3056. {
  3057. _v = lua_isnumber(L,argv[1]);
  3058. }
  3059. if (_v) {
  3060. {
  3061. _v = SWIG_lua_isnilstring(L,argv[2]);
  3062. }
  3063. if (_v) {
  3064. return _wrap_new_ESLconnection__SWIG_1(L);
  3065. }
  3066. }
  3067. }
  3068. }
  3069. if (argc == 3) {
  3070. int _v;
  3071. {
  3072. _v = SWIG_lua_isnilstring(L,argv[0]);
  3073. }
  3074. if (_v) {
  3075. {
  3076. _v = SWIG_lua_isnilstring(L,argv[1]);
  3077. }
  3078. if (_v) {
  3079. {
  3080. _v = SWIG_lua_isnilstring(L,argv[2]);
  3081. }
  3082. if (_v) {
  3083. return _wrap_new_ESLconnection__SWIG_3(L);
  3084. }
  3085. }
  3086. }
  3087. }
  3088. if (argc == 4) {
  3089. int _v;
  3090. {
  3091. _v = SWIG_lua_isnilstring(L,argv[0]);
  3092. }
  3093. if (_v) {
  3094. {
  3095. _v = lua_isnumber(L,argv[1]);
  3096. }
  3097. if (_v) {
  3098. {
  3099. _v = SWIG_lua_isnilstring(L,argv[2]);
  3100. }
  3101. if (_v) {
  3102. {
  3103. _v = SWIG_lua_isnilstring(L,argv[3]);
  3104. }
  3105. if (_v) {
  3106. return _wrap_new_ESLconnection__SWIG_0(L);
  3107. }
  3108. }
  3109. }
  3110. }
  3111. }
  3112. if (argc == 4) {
  3113. int _v;
  3114. {
  3115. _v = SWIG_lua_isnilstring(L,argv[0]);
  3116. }
  3117. if (_v) {
  3118. {
  3119. _v = SWIG_lua_isnilstring(L,argv[1]);
  3120. }
  3121. if (_v) {
  3122. {
  3123. _v = SWIG_lua_isnilstring(L,argv[2]);
  3124. }
  3125. if (_v) {
  3126. {
  3127. _v = SWIG_lua_isnilstring(L,argv[3]);
  3128. }
  3129. if (_v) {
  3130. return _wrap_new_ESLconnection__SWIG_2(L);
  3131. }
  3132. }
  3133. }
  3134. }
  3135. }
  3136. SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_ESLconnection'\n"
  3137. " Possible C/C++ prototypes are:\n"
  3138. " ESLconnection::ESLconnection(char const *,int const,char const *,char const *)\n"
  3139. " ESLconnection::ESLconnection(char const *,int const,char const *)\n"
  3140. " ESLconnection::ESLconnection(char const *,char const *,char const *,char const *)\n"
  3141. " ESLconnection::ESLconnection(char const *,char const *,char const *)\n"
  3142. " ESLconnection::ESLconnection(int)\n");
  3143. lua_error(L);return 0;
  3144. }
  3145. static int _wrap_ESLconnection_socketDescriptor(lua_State* L) {
  3146. int SWIG_arg = 0;
  3147. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3148. int result;
  3149. SWIG_check_num_args("ESLconnection::socketDescriptor",1,1)
  3150. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::socketDescriptor",1,"ESLconnection *");
  3151. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3152. SWIG_fail_ptr("ESLconnection_socketDescriptor",1,SWIGTYPE_p_ESLconnection);
  3153. }
  3154. result = (int)(arg1)->socketDescriptor();
  3155. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  3156. return SWIG_arg;
  3157. if(0) SWIG_fail;
  3158. fail:
  3159. lua_error(L);
  3160. return SWIG_arg;
  3161. }
  3162. static int _wrap_ESLconnection_connected(lua_State* L) {
  3163. int SWIG_arg = 0;
  3164. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3165. int result;
  3166. SWIG_check_num_args("ESLconnection::connected",1,1)
  3167. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::connected",1,"ESLconnection *");
  3168. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3169. SWIG_fail_ptr("ESLconnection_connected",1,SWIGTYPE_p_ESLconnection);
  3170. }
  3171. result = (int)(arg1)->connected();
  3172. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  3173. return SWIG_arg;
  3174. if(0) SWIG_fail;
  3175. fail:
  3176. lua_error(L);
  3177. return SWIG_arg;
  3178. }
  3179. static int _wrap_ESLconnection_getInfo(lua_State* L) {
  3180. int SWIG_arg = 0;
  3181. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3182. ESLevent *result = 0 ;
  3183. SWIG_check_num_args("ESLconnection::getInfo",1,1)
  3184. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::getInfo",1,"ESLconnection *");
  3185. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3186. SWIG_fail_ptr("ESLconnection_getInfo",1,SWIGTYPE_p_ESLconnection);
  3187. }
  3188. result = (ESLevent *)(arg1)->getInfo();
  3189. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3190. return SWIG_arg;
  3191. if(0) SWIG_fail;
  3192. fail:
  3193. lua_error(L);
  3194. return SWIG_arg;
  3195. }
  3196. static int _wrap_ESLconnection_send(lua_State* L) {
  3197. int SWIG_arg = 0;
  3198. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3199. char *arg2 = (char *) 0 ;
  3200. int result;
  3201. SWIG_check_num_args("ESLconnection::send",2,2)
  3202. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::send",1,"ESLconnection *");
  3203. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::send",2,"char const *");
  3204. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3205. SWIG_fail_ptr("ESLconnection_send",1,SWIGTYPE_p_ESLconnection);
  3206. }
  3207. arg2 = (char *)lua_tostring(L, 2);
  3208. result = (int)(arg1)->send((char const *)arg2);
  3209. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  3210. return SWIG_arg;
  3211. if(0) SWIG_fail;
  3212. fail:
  3213. lua_error(L);
  3214. return SWIG_arg;
  3215. }
  3216. static int _wrap_ESLconnection_sendRecv(lua_State* L) {
  3217. int SWIG_arg = 0;
  3218. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3219. char *arg2 = (char *) 0 ;
  3220. ESLevent *result = 0 ;
  3221. SWIG_check_num_args("ESLconnection::sendRecv",2,2)
  3222. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::sendRecv",1,"ESLconnection *");
  3223. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::sendRecv",2,"char const *");
  3224. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3225. SWIG_fail_ptr("ESLconnection_sendRecv",1,SWIGTYPE_p_ESLconnection);
  3226. }
  3227. arg2 = (char *)lua_tostring(L, 2);
  3228. result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
  3229. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3230. return SWIG_arg;
  3231. if(0) SWIG_fail;
  3232. fail:
  3233. lua_error(L);
  3234. return SWIG_arg;
  3235. }
  3236. static int _wrap_ESLconnection_api(lua_State* L) {
  3237. int SWIG_arg = 0;
  3238. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3239. char *arg2 = (char *) 0 ;
  3240. char *arg3 = (char *) NULL ;
  3241. ESLevent *result = 0 ;
  3242. SWIG_check_num_args("ESLconnection::api",2,3)
  3243. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::api",1,"ESLconnection *");
  3244. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::api",2,"char const *");
  3245. if(lua_gettop(L)>=3 && !SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::api",3,"char const *");
  3246. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3247. SWIG_fail_ptr("ESLconnection_api",1,SWIGTYPE_p_ESLconnection);
  3248. }
  3249. arg2 = (char *)lua_tostring(L, 2);
  3250. if(lua_gettop(L)>=3){
  3251. arg3 = (char *)lua_tostring(L, 3);
  3252. }
  3253. result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
  3254. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3255. return SWIG_arg;
  3256. if(0) SWIG_fail;
  3257. fail:
  3258. lua_error(L);
  3259. return SWIG_arg;
  3260. }
  3261. static int _wrap_ESLconnection_bgapi(lua_State* L) {
  3262. int SWIG_arg = 0;
  3263. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3264. char *arg2 = (char *) 0 ;
  3265. char *arg3 = (char *) NULL ;
  3266. char *arg4 = (char *) NULL ;
  3267. ESLevent *result = 0 ;
  3268. SWIG_check_num_args("ESLconnection::bgapi",2,4)
  3269. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::bgapi",1,"ESLconnection *");
  3270. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::bgapi",2,"char const *");
  3271. if(lua_gettop(L)>=3 && !SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::bgapi",3,"char const *");
  3272. if(lua_gettop(L)>=4 && !SWIG_lua_isnilstring(L,4)) SWIG_fail_arg("ESLconnection::bgapi",4,"char const *");
  3273. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3274. SWIG_fail_ptr("ESLconnection_bgapi",1,SWIGTYPE_p_ESLconnection);
  3275. }
  3276. arg2 = (char *)lua_tostring(L, 2);
  3277. if(lua_gettop(L)>=3){
  3278. arg3 = (char *)lua_tostring(L, 3);
  3279. }
  3280. if(lua_gettop(L)>=4){
  3281. arg4 = (char *)lua_tostring(L, 4);
  3282. }
  3283. result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3,(char const *)arg4);
  3284. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3285. return SWIG_arg;
  3286. if(0) SWIG_fail;
  3287. fail:
  3288. lua_error(L);
  3289. return SWIG_arg;
  3290. }
  3291. static int _wrap_ESLconnection_sendEvent(lua_State* L) {
  3292. int SWIG_arg = 0;
  3293. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3294. ESLevent *arg2 = (ESLevent *) 0 ;
  3295. ESLevent *result = 0 ;
  3296. SWIG_check_num_args("ESLconnection::sendEvent",2,2)
  3297. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::sendEvent",1,"ESLconnection *");
  3298. if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("ESLconnection::sendEvent",2,"ESLevent *");
  3299. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3300. SWIG_fail_ptr("ESLconnection_sendEvent",1,SWIGTYPE_p_ESLconnection);
  3301. }
  3302. if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_ESLevent,0))){
  3303. SWIG_fail_ptr("ESLconnection_sendEvent",2,SWIGTYPE_p_ESLevent);
  3304. }
  3305. result = (ESLevent *)(arg1)->sendEvent(arg2);
  3306. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3307. return SWIG_arg;
  3308. if(0) SWIG_fail;
  3309. fail:
  3310. lua_error(L);
  3311. return SWIG_arg;
  3312. }
  3313. static int _wrap_ESLconnection_sendMSG(lua_State* L) {
  3314. int SWIG_arg = 0;
  3315. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3316. ESLevent *arg2 = (ESLevent *) 0 ;
  3317. char *arg3 = (char *) NULL ;
  3318. int result;
  3319. SWIG_check_num_args("ESLconnection::sendMSG",2,3)
  3320. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::sendMSG",1,"ESLconnection *");
  3321. if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("ESLconnection::sendMSG",2,"ESLevent *");
  3322. if(lua_gettop(L)>=3 && !SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::sendMSG",3,"char const *");
  3323. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3324. SWIG_fail_ptr("ESLconnection_sendMSG",1,SWIGTYPE_p_ESLconnection);
  3325. }
  3326. if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_ESLevent,0))){
  3327. SWIG_fail_ptr("ESLconnection_sendMSG",2,SWIGTYPE_p_ESLevent);
  3328. }
  3329. if(lua_gettop(L)>=3){
  3330. arg3 = (char *)lua_tostring(L, 3);
  3331. }
  3332. result = (int)(arg1)->sendMSG(arg2,(char const *)arg3);
  3333. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  3334. return SWIG_arg;
  3335. if(0) SWIG_fail;
  3336. fail:
  3337. lua_error(L);
  3338. return SWIG_arg;
  3339. }
  3340. static int _wrap_ESLconnection_recvEvent(lua_State* L) {
  3341. int SWIG_arg = 0;
  3342. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3343. ESLevent *result = 0 ;
  3344. SWIG_check_num_args("ESLconnection::recvEvent",1,1)
  3345. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::recvEvent",1,"ESLconnection *");
  3346. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3347. SWIG_fail_ptr("ESLconnection_recvEvent",1,SWIGTYPE_p_ESLconnection);
  3348. }
  3349. result = (ESLevent *)(arg1)->recvEvent();
  3350. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3351. return SWIG_arg;
  3352. if(0) SWIG_fail;
  3353. fail:
  3354. lua_error(L);
  3355. return SWIG_arg;
  3356. }
  3357. static int _wrap_ESLconnection_recvEventTimed(lua_State* L) {
  3358. int SWIG_arg = 0;
  3359. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3360. int arg2 ;
  3361. ESLevent *result = 0 ;
  3362. SWIG_check_num_args("ESLconnection::recvEventTimed",2,2)
  3363. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::recvEventTimed",1,"ESLconnection *");
  3364. if(!lua_isnumber(L,2)) SWIG_fail_arg("ESLconnection::recvEventTimed",2,"int");
  3365. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3366. SWIG_fail_ptr("ESLconnection_recvEventTimed",1,SWIGTYPE_p_ESLconnection);
  3367. }
  3368. arg2 = (int)lua_tonumber(L, 2);
  3369. result = (ESLevent *)(arg1)->recvEventTimed(arg2);
  3370. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3371. return SWIG_arg;
  3372. if(0) SWIG_fail;
  3373. fail:
  3374. lua_error(L);
  3375. return SWIG_arg;
  3376. }
  3377. static int _wrap_ESLconnection_filter(lua_State* L) {
  3378. int SWIG_arg = 0;
  3379. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3380. char *arg2 = (char *) 0 ;
  3381. char *arg3 = (char *) 0 ;
  3382. ESLevent *result = 0 ;
  3383. SWIG_check_num_args("ESLconnection::filter",3,3)
  3384. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::filter",1,"ESLconnection *");
  3385. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::filter",2,"char const *");
  3386. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::filter",3,"char const *");
  3387. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3388. SWIG_fail_ptr("ESLconnection_filter",1,SWIGTYPE_p_ESLconnection);
  3389. }
  3390. arg2 = (char *)lua_tostring(L, 2);
  3391. arg3 = (char *)lua_tostring(L, 3);
  3392. result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
  3393. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3394. return SWIG_arg;
  3395. if(0) SWIG_fail;
  3396. fail:
  3397. lua_error(L);
  3398. return SWIG_arg;
  3399. }
  3400. static int _wrap_ESLconnection_events(lua_State* L) {
  3401. int SWIG_arg = 0;
  3402. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3403. char *arg2 = (char *) 0 ;
  3404. char *arg3 = (char *) 0 ;
  3405. int result;
  3406. SWIG_check_num_args("ESLconnection::events",3,3)
  3407. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::events",1,"ESLconnection *");
  3408. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::events",2,"char const *");
  3409. if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::events",3,"char const *");
  3410. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3411. SWIG_fail_ptr("ESLconnection_events",1,SWIGTYPE_p_ESLconnection);
  3412. }
  3413. arg2 = (char *)lua_tostring(L, 2);
  3414. arg3 = (char *)lua_tostring(L, 3);
  3415. result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
  3416. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  3417. return SWIG_arg;
  3418. if(0) SWIG_fail;
  3419. fail:
  3420. lua_error(L);
  3421. return SWIG_arg;
  3422. }
  3423. static int _wrap_ESLconnection_execute(lua_State* L) {
  3424. int SWIG_arg = 0;
  3425. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3426. char *arg2 = (char *) 0 ;
  3427. char *arg3 = (char *) NULL ;
  3428. char *arg4 = (char *) NULL ;
  3429. ESLevent *result = 0 ;
  3430. SWIG_check_num_args("ESLconnection::execute",2,4)
  3431. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::execute",1,"ESLconnection *");
  3432. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::execute",2,"char const *");
  3433. if(lua_gettop(L)>=3 && !SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::execute",3,"char const *");
  3434. if(lua_gettop(L)>=4 && !SWIG_lua_isnilstring(L,4)) SWIG_fail_arg("ESLconnection::execute",4,"char const *");
  3435. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3436. SWIG_fail_ptr("ESLconnection_execute",1,SWIGTYPE_p_ESLconnection);
  3437. }
  3438. arg2 = (char *)lua_tostring(L, 2);
  3439. if(lua_gettop(L)>=3){
  3440. arg3 = (char *)lua_tostring(L, 3);
  3441. }
  3442. if(lua_gettop(L)>=4){
  3443. arg4 = (char *)lua_tostring(L, 4);
  3444. }
  3445. result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
  3446. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3447. return SWIG_arg;
  3448. if(0) SWIG_fail;
  3449. fail:
  3450. lua_error(L);
  3451. return SWIG_arg;
  3452. }
  3453. static int _wrap_ESLconnection_executeAsync(lua_State* L) {
  3454. int SWIG_arg = 0;
  3455. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3456. char *arg2 = (char *) 0 ;
  3457. char *arg3 = (char *) NULL ;
  3458. char *arg4 = (char *) NULL ;
  3459. ESLevent *result = 0 ;
  3460. SWIG_check_num_args("ESLconnection::executeAsync",2,4)
  3461. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::executeAsync",1,"ESLconnection *");
  3462. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::executeAsync",2,"char const *");
  3463. if(lua_gettop(L)>=3 && !SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("ESLconnection::executeAsync",3,"char const *");
  3464. if(lua_gettop(L)>=4 && !SWIG_lua_isnilstring(L,4)) SWIG_fail_arg("ESLconnection::executeAsync",4,"char const *");
  3465. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3466. SWIG_fail_ptr("ESLconnection_executeAsync",1,SWIGTYPE_p_ESLconnection);
  3467. }
  3468. arg2 = (char *)lua_tostring(L, 2);
  3469. if(lua_gettop(L)>=3){
  3470. arg3 = (char *)lua_tostring(L, 3);
  3471. }
  3472. if(lua_gettop(L)>=4){
  3473. arg4 = (char *)lua_tostring(L, 4);
  3474. }
  3475. result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
  3476. SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++;
  3477. return SWIG_arg;
  3478. if(0) SWIG_fail;
  3479. fail:
  3480. lua_error(L);
  3481. return SWIG_arg;
  3482. }
  3483. static int _wrap_ESLconnection_setAsyncExecute(lua_State* L) {
  3484. int SWIG_arg = 0;
  3485. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3486. char *arg2 = (char *) 0 ;
  3487. int result;
  3488. SWIG_check_num_args("ESLconnection::setAsyncExecute",2,2)
  3489. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::setAsyncExecute",1,"ESLconnection *");
  3490. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::setAsyncExecute",2,"char const *");
  3491. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3492. SWIG_fail_ptr("ESLconnection_setAsyncExecute",1,SWIGTYPE_p_ESLconnection);
  3493. }
  3494. arg2 = (char *)lua_tostring(L, 2);
  3495. result = (int)(arg1)->setAsyncExecute((char const *)arg2);
  3496. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  3497. return SWIG_arg;
  3498. if(0) SWIG_fail;
  3499. fail:
  3500. lua_error(L);
  3501. return SWIG_arg;
  3502. }
  3503. static int _wrap_ESLconnection_setEventLock(lua_State* L) {
  3504. int SWIG_arg = 0;
  3505. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3506. char *arg2 = (char *) 0 ;
  3507. int result;
  3508. SWIG_check_num_args("ESLconnection::setEventLock",2,2)
  3509. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::setEventLock",1,"ESLconnection *");
  3510. if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("ESLconnection::setEventLock",2,"char const *");
  3511. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3512. SWIG_fail_ptr("ESLconnection_setEventLock",1,SWIGTYPE_p_ESLconnection);
  3513. }
  3514. arg2 = (char *)lua_tostring(L, 2);
  3515. result = (int)(arg1)->setEventLock((char const *)arg2);
  3516. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  3517. return SWIG_arg;
  3518. if(0) SWIG_fail;
  3519. fail:
  3520. lua_error(L);
  3521. return SWIG_arg;
  3522. }
  3523. static int _wrap_ESLconnection_disconnect(lua_State* L) {
  3524. int SWIG_arg = 0;
  3525. ESLconnection *arg1 = (ESLconnection *) 0 ;
  3526. int result;
  3527. SWIG_check_num_args("ESLconnection::disconnect",1,1)
  3528. if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ESLconnection::disconnect",1,"ESLconnection *");
  3529. if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
  3530. SWIG_fail_ptr("ESLconnection_disconnect",1,SWIGTYPE_p_ESLconnection);
  3531. }
  3532. result = (int)(arg1)->disconnect();
  3533. lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
  3534. return SWIG_arg;
  3535. if(0) SWIG_fail;
  3536. fail:
  3537. lua_error(L);
  3538. return SWIG_arg;
  3539. }
  3540. static void swig_delete_ESLconnection(void *obj) {
  3541. ESLconnection *arg1 = (ESLconnection *) obj;
  3542. delete arg1;
  3543. }
  3544. static int _proxy__wrap_new_ESLconnection(lua_State *L) {
  3545. assert(lua_istable(L,1));
  3546. lua_pushcfunction(L,_wrap_new_ESLconnection);
  3547. assert(!lua_isnil(L,-1));
  3548. lua_replace(L,1); /* replace our table with real constructor */
  3549. lua_call(L,lua_gettop(L)-1,1);
  3550. return 1;
  3551. }
  3552. static swig_lua_attribute swig_ESLconnection_attributes[] = {
  3553. {0,0,0}
  3554. };
  3555. static swig_lua_method swig_ESLconnection_methods[]= {
  3556. { "socketDescriptor", _wrap_ESLconnection_socketDescriptor},
  3557. { "connected", _wrap_ESLconnection_connected},
  3558. { "getInfo", _wrap_ESLconnection_getInfo},
  3559. { "send", _wrap_ESLconnection_send},
  3560. { "sendRecv", _wrap_ESLconnection_sendRecv},
  3561. { "api", _wrap_ESLconnection_api},
  3562. { "bgapi", _wrap_ESLconnection_bgapi},
  3563. { "sendEvent", _wrap_ESLconnection_sendEvent},
  3564. { "sendMSG", _wrap_ESLconnection_sendMSG},
  3565. { "recvEvent", _wrap_ESLconnection_recvEvent},
  3566. { "recvEventTimed", _wrap_ESLconnection_recvEventTimed},
  3567. { "filter", _wrap_ESLconnection_filter},
  3568. { "events", _wrap_ESLconnection_events},
  3569. { "execute", _wrap_ESLconnection_execute},
  3570. { "executeAsync", _wrap_ESLconnection_executeAsync},
  3571. { "setAsyncExecute", _wrap_ESLconnection_setAsyncExecute},
  3572. { "setEventLock", _wrap_ESLconnection_setEventLock},
  3573. { "disconnect", _wrap_ESLconnection_disconnect},
  3574. {0,0}
  3575. };
  3576. static swig_lua_method swig_ESLconnection_meta[] = {
  3577. {0,0}
  3578. };
  3579. static swig_lua_attribute swig_ESLconnection_Sf_SwigStatic_attributes[] = {
  3580. {0,0,0}
  3581. };
  3582. static swig_lua_const_info swig_ESLconnection_Sf_SwigStatic_constants[]= {
  3583. {0,0,0,0,0,0}
  3584. };
  3585. static swig_lua_method swig_ESLconnection_Sf_SwigStatic_methods[]= {
  3586. {0,0}
  3587. };
  3588. static swig_lua_class* swig_ESLconnection_Sf_SwigStatic_classes[]= {
  3589. 0
  3590. };
  3591. static swig_lua_namespace swig_ESLconnection_Sf_SwigStatic = {
  3592. "ESLconnection",
  3593. swig_ESLconnection_Sf_SwigStatic_methods,
  3594. swig_ESLconnection_Sf_SwigStatic_attributes,
  3595. swig_ESLconnection_Sf_SwigStatic_constants,
  3596. swig_ESLconnection_Sf_SwigStatic_classes,
  3597. 0
  3598. };
  3599. static swig_lua_class *swig_ESLconnection_bases[] = {0};
  3600. static const char *swig_ESLconnection_base_names[] = {0};
  3601. static swig_lua_class _wrap_class_ESLconnection = { "ESLconnection", "ESLconnection", &SWIGTYPE_p_ESLconnection,_proxy__wrap_new_ESLconnection, swig_delete_ESLconnection, swig_ESLconnection_methods, swig_ESLconnection_attributes, &swig_ESLconnection_Sf_SwigStatic, swig_ESLconnection_meta, swig_ESLconnection_bases, swig_ESLconnection_base_names };
  3602. static int _wrap_eslSetLogLevel(lua_State* L) {
  3603. int SWIG_arg = 0;
  3604. int arg1 ;
  3605. SWIG_check_num_args("eslSetLogLevel",1,1)
  3606. if(!lua_isnumber(L,1)) SWIG_fail_arg("eslSetLogLevel",1,"int");
  3607. arg1 = (int)lua_tonumber(L, 1);
  3608. eslSetLogLevel(arg1);
  3609. return SWIG_arg;
  3610. if(0) SWIG_fail;
  3611. fail:
  3612. lua_error(L);
  3613. return SWIG_arg;
  3614. }
  3615. static swig_lua_attribute swig_SwigModule_attributes[] = {
  3616. {0,0,0}
  3617. };
  3618. static swig_lua_const_info swig_SwigModule_constants[]= {
  3619. {0,0,0,0,0,0}
  3620. };
  3621. static swig_lua_method swig_SwigModule_methods[]= {
  3622. { "eslSetLogLevel", _wrap_eslSetLogLevel},
  3623. {0,0}
  3624. };
  3625. static swig_lua_class* swig_SwigModule_classes[]= {
  3626. &_wrap_class_ESLevent,
  3627. &_wrap_class_ESLconnection,
  3628. 0
  3629. };
  3630. static swig_lua_namespace* swig_SwigModule_namespaces[] = {
  3631. 0
  3632. };
  3633. static swig_lua_namespace swig_SwigModule = {
  3634. "ESL",
  3635. swig_SwigModule_methods,
  3636. swig_SwigModule_attributes,
  3637. swig_SwigModule_constants,
  3638. swig_SwigModule_classes,
  3639. swig_SwigModule_namespaces
  3640. };
  3641. #ifdef __cplusplus
  3642. }
  3643. #endif
  3644. /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
  3645. static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)&_wrap_class_ESLconnection, 0};
  3646. static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)&_wrap_class_ESLevent, 0};
  3647. static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0};
  3648. static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0};
  3649. static swig_type_info *swig_type_initial[] = {
  3650. &_swigt__p_ESLconnection,
  3651. &_swigt__p_ESLevent,
  3652. &_swigt__p_esl_event_t,
  3653. &_swigt__p_esl_priority_t,
  3654. };
  3655. static swig_cast_info _swigc__p_ESLconnection[] = { {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}};
  3656. static swig_cast_info _swigc__p_ESLevent[] = { {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}};
  3657. static swig_cast_info _swigc__p_esl_event_t[] = { {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}};
  3658. static swig_cast_info _swigc__p_esl_priority_t[] = { {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}};
  3659. static swig_cast_info *swig_cast_initial[] = {
  3660. _swigc__p_ESLconnection,
  3661. _swigc__p_ESLevent,
  3662. _swigc__p_esl_event_t,
  3663. _swigc__p_esl_priority_t,
  3664. };
  3665. /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
  3666. /* -----------------------------------------------------------------------------
  3667. * Type initialization:
  3668. * This problem is tough by the requirement that no dynamic
  3669. * memory is used. Also, since swig_type_info structures store pointers to
  3670. * swig_cast_info structures and swig_cast_info structures store pointers back
  3671. * to swig_type_info structures, we need some lookup code at initialization.
  3672. * The idea is that swig generates all the structures that are needed.
  3673. * The runtime then collects these partially filled structures.
  3674. * The SWIG_InitializeModule function takes these initial arrays out of
  3675. * swig_module, and does all the lookup, filling in the swig_module.types
  3676. * array with the correct data and linking the correct swig_cast_info
  3677. * structures together.
  3678. *
  3679. * The generated swig_type_info structures are assigned statically to an initial
  3680. * array. We just loop through that array, and handle each type individually.
  3681. * First we lookup if this type has been already loaded, and if so, use the
  3682. * loaded structure instead of the generated one. Then we have to fill in the
  3683. * cast linked list. The cast data is initially stored in something like a
  3684. * two-dimensional array. Each row corresponds to a type (there are the same
  3685. * number of rows as there are in the swig_type_initial array). Each entry in
  3686. * a column is one of the swig_cast_info structures for that type.
  3687. * The cast_initial array is actually an array of arrays, because each row has
  3688. * a variable number of columns. So to actually build the cast linked list,
  3689. * we find the array of casts associated with the type, and loop through it
  3690. * adding the casts to the list. The one last trick we need to do is making
  3691. * sure the type pointer in the swig_cast_info struct is correct.
  3692. *
  3693. * First off, we lookup the cast->type name to see if it is already loaded.
  3694. * There are three cases to handle:
  3695. * 1) If the cast->type has already been loaded AND the type we are adding
  3696. * casting info to has not been loaded (it is in this module), THEN we
  3697. * replace the cast->type pointer with the type pointer that has already
  3698. * been loaded.
  3699. * 2) If BOTH types (the one we are adding casting info to, and the
  3700. * cast->type) are loaded, THEN the cast info has already been loaded by
  3701. * the previous module so we just ignore it.
  3702. * 3) Finally, if cast->type has not already been loaded, then we add that
  3703. * swig_cast_info to the linked list (because the cast->type) pointer will
  3704. * be correct.
  3705. * ----------------------------------------------------------------------------- */
  3706. #ifdef __cplusplus
  3707. extern "C" {
  3708. #if 0
  3709. } /* c-mode */
  3710. #endif
  3711. #endif
  3712. #if 0
  3713. #define SWIGRUNTIME_DEBUG
  3714. #endif
  3715. SWIGRUNTIME void
  3716. SWIG_InitializeModule(void *clientdata) {
  3717. size_t i;
  3718. swig_module_info *module_head, *iter;
  3719. int found, init;
  3720. /* check to see if the circular list has been setup, if not, set it up */
  3721. if (swig_module.next==0) {
  3722. /* Initialize the swig_module */
  3723. swig_module.type_initial = swig_type_initial;
  3724. swig_module.cast_initial = swig_cast_initial;
  3725. swig_module.next = &swig_module;
  3726. init = 1;
  3727. } else {
  3728. init = 0;
  3729. }
  3730. /* Try and load any already created modules */
  3731. module_head = SWIG_GetModule(clientdata);
  3732. if (!module_head) {
  3733. /* This is the first module loaded for this interpreter */
  3734. /* so set the swig module into the interpreter */
  3735. SWIG_SetModule(clientdata, &swig_module);
  3736. module_head = &swig_module;
  3737. } else {
  3738. /* the interpreter has loaded a SWIG module, but has it loaded this one? */
  3739. found=0;
  3740. iter=module_head;
  3741. do {
  3742. if (iter==&swig_module) {
  3743. found=1;
  3744. break;
  3745. }
  3746. iter=iter->next;
  3747. } while (iter!= module_head);
  3748. /* if the is found in the list, then all is done and we may leave */
  3749. if (found) return;
  3750. /* otherwise we must add out module into the list */
  3751. swig_module.next = module_head->next;
  3752. module_head->next = &swig_module;
  3753. }
  3754. /* When multiple interpreters are used, a module could have already been initialized in
  3755. a different interpreter, but not yet have a pointer in this interpreter.
  3756. In this case, we do not want to continue adding types... everything should be
  3757. set up already */
  3758. if (init == 0) return;
  3759. /* Now work on filling in swig_module.types */
  3760. #ifdef SWIGRUNTIME_DEBUG
  3761. printf("SWIG_InitializeModule: size %d\n", swig_module.size);
  3762. #endif
  3763. for (i = 0; i < swig_module.size; ++i) {
  3764. swig_type_info *type = 0;
  3765. swig_type_info *ret;
  3766. swig_cast_info *cast;
  3767. #ifdef SWIGRUNTIME_DEBUG
  3768. printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
  3769. #endif
  3770. /* if there is another module already loaded */
  3771. if (swig_module.next != &swig_module) {
  3772. type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
  3773. }
  3774. if (type) {
  3775. /* Overwrite clientdata field */
  3776. #ifdef SWIGRUNTIME_DEBUG
  3777. printf("SWIG_InitializeModule: found type %s\n", type->name);
  3778. #endif
  3779. if (swig_module.type_initial[i]->clientdata) {
  3780. type->clientdata = swig_module.type_initial[i]->clientdata;
  3781. #ifdef SWIGRUNTIME_DEBUG
  3782. printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
  3783. #endif
  3784. }
  3785. } else {
  3786. type = swig_module.type_initial[i];
  3787. }
  3788. /* Insert casting types */
  3789. cast = swig_module.cast_initial[i];
  3790. while (cast->type) {
  3791. /* Don't need to add information already in the list */
  3792. ret = 0;
  3793. #ifdef SWIGRUNTIME_DEBUG
  3794. printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
  3795. #endif
  3796. if (swig_module.next != &swig_module) {
  3797. ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
  3798. #ifdef SWIGRUNTIME_DEBUG
  3799. if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
  3800. #endif
  3801. }
  3802. if (ret) {
  3803. if (type == swig_module.type_initial[i]) {
  3804. #ifdef SWIGRUNTIME_DEBUG
  3805. printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
  3806. #endif
  3807. cast->type = ret;
  3808. ret = 0;
  3809. } else {
  3810. /* Check for casting already in the list */
  3811. swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
  3812. #ifdef SWIGRUNTIME_DEBUG
  3813. if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
  3814. #endif
  3815. if (!ocast) ret = 0;
  3816. }
  3817. }
  3818. if (!ret) {
  3819. #ifdef SWIGRUNTIME_DEBUG
  3820. printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
  3821. #endif
  3822. if (type->cast) {
  3823. type->cast->prev = cast;
  3824. cast->next = type->cast;
  3825. }
  3826. type->cast = cast;
  3827. }
  3828. cast++;
  3829. }
  3830. /* Set entry in modules->types array equal to the type */
  3831. swig_module.types[i] = type;
  3832. }
  3833. swig_module.types[i] = 0;
  3834. #ifdef SWIGRUNTIME_DEBUG
  3835. printf("**** SWIG_InitializeModule: Cast List ******\n");
  3836. for (i = 0; i < swig_module.size; ++i) {
  3837. int j = 0;
  3838. swig_cast_info *cast = swig_module.cast_initial[i];
  3839. printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
  3840. while (cast->type) {
  3841. printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
  3842. cast++;
  3843. ++j;
  3844. }
  3845. printf("---- Total casts: %d\n",j);
  3846. }
  3847. printf("**** SWIG_InitializeModule: Cast List ******\n");
  3848. #endif
  3849. }
  3850. /* This function will propagate the clientdata field of type to
  3851. * any new swig_type_info structures that have been added into the list
  3852. * of equivalent types. It is like calling
  3853. * SWIG_TypeClientData(type, clientdata) a second time.
  3854. */
  3855. SWIGRUNTIME void
  3856. SWIG_PropagateClientData(void) {
  3857. size_t i;
  3858. swig_cast_info *equiv;
  3859. static int init_run = 0;
  3860. if (init_run) return;
  3861. init_run = 1;
  3862. for (i = 0; i < swig_module.size; i++) {
  3863. if (swig_module.types[i]->clientdata) {
  3864. equiv = swig_module.types[i]->cast;
  3865. while (equiv) {
  3866. if (!equiv->converter) {
  3867. if (equiv->type && !equiv->type->clientdata)
  3868. SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
  3869. }
  3870. equiv = equiv->next;
  3871. }
  3872. }
  3873. }
  3874. }
  3875. #ifdef __cplusplus
  3876. #if 0
  3877. { /* c-mode */
  3878. #endif
  3879. }
  3880. #endif
  3881. /* Forward declaration of where the user's %init{} gets inserted */
  3882. void SWIG_init_user(lua_State* L );
  3883. #ifdef __cplusplus
  3884. extern "C" {
  3885. #endif
  3886. /* this is the initialization function
  3887. added at the very end of the code
  3888. the function is always called SWIG_init, but an earlier #define will rename it
  3889. */
  3890. #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
  3891. LUALIB_API int SWIG_init(lua_State* L)
  3892. #else
  3893. SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
  3894. #endif
  3895. {
  3896. #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
  3897. int i;
  3898. int globalRegister = 0;
  3899. /* start with global table */
  3900. lua_pushglobaltable (L);
  3901. /* SWIG's internal initialisation */
  3902. SWIG_InitializeModule((void*)L);
  3903. SWIG_PropagateClientData();
  3904. #endif
  3905. #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE)
  3906. /* add a global fn */
  3907. SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
  3908. SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_class_equal);
  3909. #endif
  3910. #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
  3911. /* set up base class pointers (the hierarchy) */
  3912. for (i = 0; swig_types[i]; i++){
  3913. if (swig_types[i]->clientdata){
  3914. SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
  3915. }
  3916. }
  3917. #ifdef SWIG_LUA_MODULE_GLOBAL
  3918. globalRegister = 1;
  3919. #endif
  3920. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
  3921. SWIG_Lua_namespace_register(L,&swig_SwigModule, globalRegister);
  3922. #endif
  3923. #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
  3924. for (i = 0; swig_types[i]; i++){
  3925. if (swig_types[i]->clientdata){
  3926. SWIG_Lua_elua_class_register_instance(L,(swig_lua_class*)(swig_types[i]->clientdata));
  3927. }
  3928. }
  3929. #endif
  3930. #if defined(SWIG_LUA_ELUA_EMULATE)
  3931. lua_newtable(L);
  3932. SWIG_Lua_elua_emulate_register(L,swig_SwigModule.ns_methods);
  3933. SWIG_Lua_elua_emulate_register_clear(L);
  3934. if(globalRegister) {
  3935. lua_pushstring(L,swig_SwigModule.name);
  3936. lua_pushvalue(L,-2);
  3937. lua_rawset(L,-4);
  3938. }
  3939. #endif
  3940. #endif
  3941. #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
  3942. /* invoke user-specific initialization */
  3943. SWIG_init_user(L);
  3944. /* end module */
  3945. /* Note: We do not clean up the stack here (Lua will do this for us). At this
  3946. point, we have the globals table and out module table on the stack. Returning
  3947. one value makes the module table the result of the require command. */
  3948. return 1;
  3949. #else
  3950. return 0;
  3951. #endif
  3952. }
  3953. #ifdef __cplusplus
  3954. }
  3955. #endif
  3956. const char* SWIG_LUACODE=
  3957. "";
  3958. void SWIG_init_user(lua_State* L)
  3959. {
  3960. /* exec Lua code if applicable */
  3961. SWIG_Lua_dostring(L,SWIG_LUACODE);
  3962. }