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