1
2 // SWIGFUSION ^.^
3
4 // Lua
5 struct lua_State;
6
7 // Forward declarations of fused methods:
8 namespace love_sdlmouse
9 {
10 }
11
12
13 /* ----------------------------------------------------------------------------
14 * This file was automatically generated by SWIG (http://www.swig.org).
15 * Version 1.3.35
16 *
17 * This file is not intended to be easily readable and contains a number of
18 * coding conventions designed to improve portability and efficiency. Do not make
19 * changes to this file unless you know what you are doing--modify the SWIG
20 * interface file instead.
21 * ----------------------------------------------------------------------------- */
22
23
24 #ifdef __cplusplus
25 template<typename T> class SwigValueWrapper {
26 T *tt;
27 public:
SwigValueWrapper()28 SwigValueWrapper() : tt(0) { }
SwigValueWrapper(const SwigValueWrapper<T> & rhs)29 SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
SwigValueWrapper(const T & t)30 SwigValueWrapper(const T& t) : tt(new T(t)) { }
~SwigValueWrapper()31 ~SwigValueWrapper() { delete tt; }
operator =(const T & t)32 SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
operator T&() const33 operator T&() const { return *tt; }
operator &()34 T *operator&() { return tt; }
35 private:
36 SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
37 };
38
SwigValueInit()39 template <typename T> T SwigValueInit() {
40 return T();
41 }
42 #endif
43
44 /* -----------------------------------------------------------------------------
45 * This section contains generic SWIG labels for method/variable
46 * declarations/attributes, and other compiler dependent labels.
47 * ----------------------------------------------------------------------------- */
48
49 /* template workaround for compilers that cannot correctly implement the C++ standard */
50 #ifndef SWIGTEMPLATEDISAMBIGUATOR
51 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
52 # define SWIGTEMPLATEDISAMBIGUATOR template
53 # elif defined(__HP_aCC)
54 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
55 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
56 # define SWIGTEMPLATEDISAMBIGUATOR template
57 # else
58 # define SWIGTEMPLATEDISAMBIGUATOR
59 # endif
60 #endif
61
62 /* inline attribute */
63 #ifndef SWIGINLINE
64 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
65 # define SWIGINLINE inline
66 # else
67 # define SWIGINLINE
68 # endif
69 #endif
70
71 /* attribute recognised by some compilers to avoid 'unused' warnings */
72 #ifndef SWIGUNUSED
73 # if defined(__GNUC__)
74 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
75 # define SWIGUNUSED __attribute__ ((__unused__))
76 # else
77 # define SWIGUNUSED
78 # endif
79 # elif defined(__ICC)
80 # define SWIGUNUSED __attribute__ ((__unused__))
81 # else
82 # define SWIGUNUSED
83 # endif
84 #endif
85
86 #ifndef SWIGUNUSEDPARM
87 # ifdef __cplusplus
88 # define SWIGUNUSEDPARM(p)
89 # else
90 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
91 # endif
92 #endif
93
94 /* internal SWIG method */
95 #ifndef SWIGINTERN
96 # define SWIGINTERN static SWIGUNUSED
97 #endif
98
99 /* internal inline SWIG method */
100 #ifndef SWIGINTERNINLINE
101 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
102 #endif
103
104 /* exporting methods */
105 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
106 # ifndef GCC_HASCLASSVISIBILITY
107 # define GCC_HASCLASSVISIBILITY
108 # endif
109 #endif
110
111 #ifndef SWIGEXPORT
112 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
113 # if defined(STATIC_LINKED)
114 # define SWIGEXPORT
115 # else
116 # define SWIGEXPORT __declspec(dllexport)
117 # endif
118 # else
119 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
120 # define SWIGEXPORT __attribute__ ((visibility("default")))
121 # else
122 # define SWIGEXPORT
123 # endif
124 # endif
125 #endif
126
127 /* calling conventions for Windows */
128 #ifndef SWIGSTDCALL
129 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
130 # define SWIGSTDCALL __stdcall
131 # else
132 # define SWIGSTDCALL
133 # endif
134 #endif
135
136 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
137 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
138 # define _CRT_SECURE_NO_DEPRECATE
139 #endif
140
141 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
142 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
143 # define _SCL_SECURE_NO_DEPRECATE
144 #endif
145
146
147 /* -----------------------------------------------------------------------------
148 * swigrun.swg
149 *
150 * This file contains generic CAPI SWIG runtime support for pointer
151 * type checking.
152 * ----------------------------------------------------------------------------- */
153
154 /* This should only be incremented when either the layout of swig_type_info changes,
155 or for whatever reason, the runtime changes incompatibly */
156 #define SWIG_RUNTIME_VERSION "4"
157
158 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
159 #ifdef SWIG_TYPE_TABLE
160 # define SWIG_QUOTE_STRING(x) #x
161 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
162 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
163 #else
164 # define SWIG_TYPE_TABLE_NAME
165 #endif
166
167 /*
168 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
169 creating a static or dynamic library from the swig runtime code.
170 In 99.9% of the cases, swig just needs to declare them as 'static'.
171
172 But only do this if is strictly necessary, ie, if you have problems
173 with your compiler or so.
174 */
175
176 #ifndef SWIGRUNTIME
177 # define SWIGRUNTIME SWIGINTERN
178 #endif
179
180 #ifndef SWIGRUNTIMEINLINE
181 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
182 #endif
183
184 /* Generic buffer size */
185 #ifndef SWIG_BUFFER_SIZE
186 # define SWIG_BUFFER_SIZE 1024
187 #endif
188
189 /* Flags for pointer conversions */
190 #define SWIG_POINTER_DISOWN 0x1
191 #define SWIG_CAST_NEW_MEMORY 0x2
192
193 /* Flags for new pointer objects */
194 #define SWIG_POINTER_OWN 0x1
195
196
197 /*
198 Flags/methods for returning states.
199
200 The swig conversion methods, as ConvertPtr, return and integer
201 that tells if the conversion was successful or not. And if not,
202 an error code can be returned (see swigerrors.swg for the codes).
203
204 Use the following macros/flags to set or process the returning
205 states.
206
207 In old swig versions, you usually write code as:
208
209 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
210 // success code
211 } else {
212 //fail code
213 }
214
215 Now you can be more explicit as:
216
217 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
218 if (SWIG_IsOK(res)) {
219 // success code
220 } else {
221 // fail code
222 }
223
224 that seems to be the same, but now you can also do
225
226 Type *ptr;
227 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
228 if (SWIG_IsOK(res)) {
229 // success code
230 if (SWIG_IsNewObj(res) {
231 ...
232 delete *ptr;
233 } else {
234 ...
235 }
236 } else {
237 // fail code
238 }
239
240 I.e., now SWIG_ConvertPtr can return new objects and you can
241 identify the case and take care of the deallocation. Of course that
242 requires also to SWIG_ConvertPtr to return new result values, as
243
244 int SWIG_ConvertPtr(obj, ptr,...) {
245 if (<obj is ok>) {
246 if (<need new object>) {
247 *ptr = <ptr to new allocated object>;
248 return SWIG_NEWOBJ;
249 } else {
250 *ptr = <ptr to old object>;
251 return SWIG_OLDOBJ;
252 }
253 } else {
254 return SWIG_BADOBJ;
255 }
256 }
257
258 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
259 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
260 swig errors code.
261
262 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
263 allows to return the 'cast rank', for example, if you have this
264
265 int food(double)
266 int fooi(int);
267
268 and you call
269
270 food(1) // cast rank '1' (1 -> 1.0)
271 fooi(1) // cast rank '0'
272
273 just use the SWIG_AddCast()/SWIG_CheckState()
274
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
302 /* Cast-Rank Mode */
303 #if defined(SWIG_CASTRANK_MODE)
304 # ifndef SWIG_TypeRank
305 # define SWIG_TypeRank unsigned long
306 # endif
307 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
308 # define SWIG_MAXCASTRANK (2)
309 # endif
310 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
311 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIG_AddCast(int r)312 SWIGINTERNINLINE int SWIG_AddCast(int r) {
313 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
314 }
SWIG_CheckState(int r)315 SWIGINTERNINLINE int SWIG_CheckState(int r) {
316 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
317 }
318 #else /* no cast-rank mode */
319 # define SWIG_AddCast
320 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
321 #endif
322
323
324
325
326 #include <string.h>
327
328 #ifdef __cplusplus
329 extern "C" {
330 #endif
331
332 typedef void *(*swig_converter_func)(void *, int *);
333 typedef struct swig_type_info *(*swig_dycast_func)(void **);
334
335 /* Structure to store information on one type */
336 typedef struct swig_type_info {
337 const char *name; /* mangled name of this type */
338 const char *str; /* human readable name of this type */
339 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
340 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
341 void *clientdata; /* language specific type data */
342 int owndata; /* flag if the structure owns the clientdata */
343 } swig_type_info;
344
345 /* Structure to store a type and conversion function used for casting */
346 typedef struct swig_cast_info {
347 swig_type_info *type; /* pointer to type that is equivalent to this type */
348 swig_converter_func converter; /* function to cast the void pointers */
349 struct swig_cast_info *next; /* pointer to next cast in linked list */
350 struct swig_cast_info *prev; /* pointer to the previous cast */
351 } swig_cast_info;
352
353 /* Structure used to store module information
354 * Each module generates one structure like this, and the runtime collects
355 * all of these structures and stores them in a circularly linked list.*/
356 typedef struct swig_module_info {
357 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
358 size_t size; /* Number of types in this module */
359 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
360 swig_type_info **type_initial; /* Array of initially generated type structures */
361 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
362 void *clientdata; /* Language specific module data */
363 } swig_module_info;
364
365 /*
366 Compare two type names skipping the space characters, therefore
367 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
368
369 Return 0 when the two name types are equivalent, as in
370 strncmp, but skipping ' '.
371 */
372 SWIGRUNTIME int
SWIG_TypeNameComp(const char * f1,const char * l1,const char * f2,const char * l2)373 SWIG_TypeNameComp(const char *f1, const char *l1,
374 const char *f2, const char *l2) {
375 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
376 while ((*f1 == ' ') && (f1 != l1)) ++f1;
377 while ((*f2 == ' ') && (f2 != l2)) ++f2;
378 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
379 }
380 return (int)((l1 - f1) - (l2 - f2));
381 }
382
383 /*
384 Check type equivalence in a name list like <name1>|<name2>|...
385 Return 0 if not equal, 1 if equal
386 */
387 SWIGRUNTIME int
SWIG_TypeEquiv(const char * nb,const char * tb)388 SWIG_TypeEquiv(const char *nb, const char *tb) {
389 int equiv = 0;
390 const char* te = tb + strlen(tb);
391 const char* ne = nb;
392 while (!equiv && *ne) {
393 for (nb = ne; *ne; ++ne) {
394 if (*ne == '|') break;
395 }
396 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
397 if (*ne) ++ne;
398 }
399 return equiv;
400 }
401
402 /*
403 Check type equivalence in a name list like <name1>|<name2>|...
404 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
405 */
406 SWIGRUNTIME int
SWIG_TypeCompare(const char * nb,const char * tb)407 SWIG_TypeCompare(const char *nb, const char *tb) {
408 int equiv = 0;
409 const char* te = tb + strlen(tb);
410 const char* ne = nb;
411 while (!equiv && *ne) {
412 for (nb = ne; *ne; ++ne) {
413 if (*ne == '|') break;
414 }
415 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
416 if (*ne) ++ne;
417 }
418 return equiv;
419 }
420
421
422 /* think of this as a c++ template<> or a scheme macro */
423 #define SWIG_TypeCheck_Template(comparison, ty) \
424 if (ty) { \
425 swig_cast_info *iter = ty->cast; \
426 while (iter) { \
427 if (comparison) { \
428 if (iter == ty->cast) return iter; \
429 /* Move iter to the top of the linked list */ \
430 iter->prev->next = iter->next; \
431 if (iter->next) \
432 iter->next->prev = iter->prev; \
433 iter->next = ty->cast; \
434 iter->prev = 0; \
435 if (ty->cast) ty->cast->prev = iter; \
436 ty->cast = iter; \
437 return iter; \
438 } \
439 iter = iter->next; \
440 } \
441 } \
442 return 0
443
444 /*
445 Check the typename
446 */
447 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char * c,swig_type_info * ty)448 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
449 SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
450 }
451
452 /* Same as previous function, except strcmp is replaced with a pointer comparison */
453 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info * from,swig_type_info * into)454 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
455 SWIG_TypeCheck_Template(iter->type == from, into);
456 }
457
458 /*
459 Cast a pointer up an inheritance hierarchy
460 */
461 SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info * ty,void * ptr,int * newmemory)462 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
463 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
464 }
465
466 /*
467 Dynamic pointer casting. Down an inheritance hierarchy
468 */
469 SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info * ty,void ** ptr)470 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
471 swig_type_info *lastty = ty;
472 if (!ty || !ty->dcast) return ty;
473 while (ty && (ty->dcast)) {
474 ty = (*ty->dcast)(ptr);
475 if (ty) lastty = ty;
476 }
477 return lastty;
478 }
479
480 /*
481 Return the name associated with this type
482 */
483 SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info * ty)484 SWIG_TypeName(const swig_type_info *ty) {
485 return ty->name;
486 }
487
488 /*
489 Return the pretty name associated with this type,
490 that is an unmangled type name in a form presentable to the user.
491 */
492 SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info * type)493 SWIG_TypePrettyName(const swig_type_info *type) {
494 /* The "str" field contains the equivalent pretty names of the
495 type, separated by vertical-bar characters. We choose
496 to print the last name, as it is often (?) the most
497 specific. */
498 if (!type) return NULL;
499 if (type->str != NULL) {
500 const char *last_name = type->str;
501 const char *s;
502 for (s = type->str; *s; s++)
503 if (*s == '|') last_name = s+1;
504 return last_name;
505 }
506 else
507 return type->name;
508 }
509
510 /*
511 Set the clientdata field for a type
512 */
513 SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info * ti,void * clientdata)514 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
515 swig_cast_info *cast = ti->cast;
516 /* if (ti->clientdata == clientdata) return; */
517 ti->clientdata = clientdata;
518
519 while (cast) {
520 if (!cast->converter) {
521 swig_type_info *tc = cast->type;
522 if (!tc->clientdata) {
523 SWIG_TypeClientData(tc, clientdata);
524 }
525 }
526 cast = cast->next;
527 }
528 }
529 SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info * ti,void * clientdata)530 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
531 SWIG_TypeClientData(ti, clientdata);
532 ti->owndata = 1;
533 }
534
535 /*
536 Search for a swig_type_info structure only by mangled name
537 Search is a O(log #types)
538
539 We start searching at module start, and finish searching when start == end.
540 Note: if start == end at the beginning of the function, we go all the way around
541 the circular list.
542 */
543 SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)544 SWIG_MangledTypeQueryModule(swig_module_info *start,
545 swig_module_info *end,
546 const char *name) {
547 swig_module_info *iter = start;
548 do {
549 if (iter->size) {
550 register size_t l = 0;
551 register size_t r = iter->size - 1;
552 do {
553 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
554 register size_t i = (l + r) >> 1;
555 const char *iname = iter->types[i]->name;
556 if (iname) {
557 register int compare = strcmp(name, iname);
558 if (compare == 0) {
559 return iter->types[i];
560 } else if (compare < 0) {
561 if (i) {
562 r = i - 1;
563 } else {
564 break;
565 }
566 } else if (compare > 0) {
567 l = i + 1;
568 }
569 } else {
570 break; /* should never happen */
571 }
572 } while (l <= r);
573 }
574 iter = iter->next;
575 } while (iter != end);
576 return 0;
577 }
578
579 /*
580 Search for a swig_type_info structure for either a mangled name or a human readable name.
581 It first searches the mangled names of the types, which is a O(log #types)
582 If a type is not found it then searches the human readable names, which is O(#types).
583
584 We start searching at module start, and finish searching when start == end.
585 Note: if start == end at the beginning of the function, we go all the way around
586 the circular list.
587 */
588 SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)589 SWIG_TypeQueryModule(swig_module_info *start,
590 swig_module_info *end,
591 const char *name) {
592 /* STEP 1: Search the name field using binary search */
593 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
594 if (ret) {
595 return ret;
596 } else {
597 /* STEP 2: If the type hasn't been found, do a complete search
598 of the str field (the human readable name) */
599 swig_module_info *iter = start;
600 do {
601 register size_t i = 0;
602 for (; i < iter->size; ++i) {
603 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
604 return iter->types[i];
605 }
606 iter = iter->next;
607 } while (iter != end);
608 }
609
610 /* neither found a match */
611 return 0;
612 }
613
614 /*
615 Pack binary data into a string
616 */
617 SWIGRUNTIME char *
SWIG_PackData(char * c,void * ptr,size_t sz)618 SWIG_PackData(char *c, void *ptr, size_t sz) {
619 static const char hex[17] = "0123456789abcdef";
620 register const unsigned char *u = (unsigned char *) ptr;
621 register const unsigned char *eu = u + sz;
622 for (; u != eu; ++u) {
623 register unsigned char uu = *u;
624 *(c++) = hex[(uu & 0xf0) >> 4];
625 *(c++) = hex[uu & 0xf];
626 }
627 return c;
628 }
629
630 /*
631 Unpack binary data from a string
632 */
633 SWIGRUNTIME const char *
SWIG_UnpackData(const char * c,void * ptr,size_t sz)634 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
635 register unsigned char *u = (unsigned char *) ptr;
636 register const unsigned char *eu = u + sz;
637 for (; u != eu; ++u) {
638 register char d = *(c++);
639 register unsigned char uu;
640 if ((d >= '0') && (d <= '9'))
641 uu = ((d - '0') << 4);
642 else if ((d >= 'a') && (d <= 'f'))
643 uu = ((d - ('a'-10)) << 4);
644 else
645 return (char *) 0;
646 d = *(c++);
647 if ((d >= '0') && (d <= '9'))
648 uu |= (d - '0');
649 else if ((d >= 'a') && (d <= 'f'))
650 uu |= (d - ('a'-10));
651 else
652 return (char *) 0;
653 *u = uu;
654 }
655 return c;
656 }
657
658 /*
659 Pack 'void *' into a string buffer.
660 */
661 SWIGRUNTIME char *
SWIG_PackVoidPtr(char * buff,void * ptr,const char * name,size_t bsz)662 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
663 char *r = buff;
664 if ((2*sizeof(void *) + 2) > bsz) return 0;
665 *(r++) = '_';
666 r = SWIG_PackData(r,&ptr,sizeof(void *));
667 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
668 strcpy(r,name);
669 return buff;
670 }
671
672 SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char * c,void ** ptr,const char * name)673 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
674 if (*c != '_') {
675 if (strcmp(c,"NULL") == 0) {
676 *ptr = (void *) 0;
677 return name;
678 } else {
679 return 0;
680 }
681 }
682 return SWIG_UnpackData(++c,ptr,sizeof(void *));
683 }
684
685 SWIGRUNTIME char *
SWIG_PackDataName(char * buff,void * ptr,size_t sz,const char * name,size_t bsz)686 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
687 char *r = buff;
688 size_t lname = (name ? strlen(name) : 0);
689 if ((2*sz + 2 + lname) > bsz) return 0;
690 *(r++) = '_';
691 r = SWIG_PackData(r,ptr,sz);
692 if (lname) {
693 strncpy(r,name,lname+1);
694 } else {
695 *r = 0;
696 }
697 return buff;
698 }
699
700 SWIGRUNTIME const char *
SWIG_UnpackDataName(const char * c,void * ptr,size_t sz,const char * name)701 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
702 if (*c != '_') {
703 if (strcmp(c,"NULL") == 0) {
704 memset(ptr,0,sz);
705 return name;
706 } else {
707 return 0;
708 }
709 }
710 return SWIG_UnpackData(++c,ptr,sz);
711 }
712
713 #ifdef __cplusplus
714 }
715 #endif
716
717 /* -----------------------------------------------------------------------------
718 * See the LICENSE file for information on copyright, usage and redistribution
719 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
720 *
721 * luarun.swg
722 *
723 * This file contains the runtime support for Lua modules
724 * and includes code for managing global variables and pointer
725 * type checking.
726 * ----------------------------------------------------------------------------- */
727
728 #ifdef __cplusplus
729 extern "C" {
730 #endif
731
732 #include "lua.h"
733 #include "lauxlib.h"
734 #include <stdlib.h> /* for malloc */
735 #include <assert.h> /* for a few sanity tests */
736
737 /* -----------------------------------------------------------------------------
738 * global swig types
739 * ----------------------------------------------------------------------------- */
740 /* Constant table */
741 #define SWIG_LUA_INT 1
742 #define SWIG_LUA_FLOAT 2
743 #define SWIG_LUA_STRING 3
744 #define SWIG_LUA_POINTER 4
745 #define SWIG_LUA_BINARY 5
746 #define SWIG_LUA_CHAR 6
747
748 /* Structure for variable linking table */
749 typedef struct {
750 const char *name;
751 lua_CFunction get;
752 lua_CFunction set;
753 } swig_lua_var_info;
754
755 /* Constant information structure */
756 typedef struct {
757 int type;
758 char *name;
759 long lvalue;
760 double dvalue;
761 void *pvalue;
762 swig_type_info **ptype;
763 } swig_lua_const_info;
764
765 typedef struct {
766 const char *name;
767 lua_CFunction method;
768 } swig_lua_method;
769
770 typedef struct {
771 const char *name;
772 lua_CFunction getmethod;
773 lua_CFunction setmethod;
774 } swig_lua_attribute;
775
776 typedef struct swig_lua_class {
777 const char *name;
778 swig_type_info **type;
779 lua_CFunction constructor;
780 void (*destructor)(void *);
781 swig_lua_method *methods;
782 swig_lua_attribute *attributes;
783 struct swig_lua_class **bases;
784 const char **base_names;
785 } swig_lua_class;
786
787 /* this is the struct for wrappering all pointers in SwigLua
788 */
789 typedef struct {
790 swig_type_info *type;
791 int own; /* 1 if owned & must be destroyed */
792 void *ptr;
793 } swig_lua_userdata;
794
795 /* this is the struct for wrapping arbitary packed binary data
796 (currently it is only used for member function pointers)
797 the data ordering is similar to swig_lua_userdata, but it is currently not possible
798 to tell the two structures apart within Swig, other than by looking at the type
799 */
800 typedef struct {
801 swig_type_info *type;
802 int own; /* 1 if owned & must be destroyed */
803 char data[1]; /* arbitary amount of data */
804 } swig_lua_rawdata;
805
806 /* Common SWIG API */
807 #define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
808 #define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
809 #define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
810 /* for C++ member pointers, ie, member methods */
811 #define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
812 #define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type)
813
814 /* Runtime API */
815 #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
816 #define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
817 #define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
818
819 /* Contract support */
820 #define SWIG_contract_assert(expr, msg) \
821 if (!(expr)) { lua_pushstring(L, (char *) msg); goto fail; } else
822
823 /* helper #defines */
824 #define SWIG_fail {goto fail;}
825 #define SWIG_fail_arg(func_name,argnum,type) \
826 {lua_pushfstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
827 func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
828 goto fail;}
829 #define SWIG_fail_ptr(func_name,argnum,type) \
830 SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
831 #define SWIG_check_num_args(func_name,a,b) \
832 if (lua_gettop(L)<a || lua_gettop(L)>b) \
833 {lua_pushfstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
834 goto fail;}
835
836
837 #define SWIG_Lua_get_table(L,n) \
838 (lua_pushstring(L, n), lua_rawget(L,-2))
839
840 #define SWIG_Lua_add_function(L,n,f) \
841 (lua_pushstring(L, n), \
842 lua_pushcfunction(L, f), \
843 lua_rawset(L,-3))
844
845 /* special helper for allowing 'nil' for usertypes */
846 #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
847
848 #ifdef __cplusplus
849 /* Special helper for member function pointers
850 it gets the address, casts it, then dereferences it */
851 //#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a)))
852 #endif
853
854 /* storing/access of swig_module_info */
855 SWIGRUNTIME swig_module_info *
SWIG_Lua_GetModule(lua_State * L)856 SWIG_Lua_GetModule(lua_State* L) {
857 swig_module_info *ret = 0;
858 lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
859 lua_rawget(L,LUA_REGISTRYINDEX);
860 if (lua_islightuserdata(L,-1))
861 ret=(swig_module_info*)lua_touserdata(L,-1);
862 lua_pop(L,1); /* tidy */
863 return ret;
864 }
865
866 SWIGRUNTIME void
SWIG_Lua_SetModule(lua_State * L,swig_module_info * module)867 SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) {
868 /* add this all into the Lua registry: */
869 lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
870 lua_pushlightuserdata(L,(void*)module);
871 lua_rawset(L,LUA_REGISTRYINDEX);
872 }
873
874 /* -----------------------------------------------------------------------------
875 * global variable support code: modules
876 * ----------------------------------------------------------------------------- */
877
878 /* this function is called when trying to set an immutable.
879 default value is to print an error.
880 This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
SWIG_Lua_set_immutable(lua_State * L)881 SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L)
882 {
883 /* there should be 1 param passed in: the new value */
884 #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
885 lua_pop(L,1); /* remove it */
886 lua_pushstring(L,"This variable is immutable");
887 lua_error(L);
888 #endif
889 return 0; /* should not return anything */
890 }
891
892 /* the module.get method used for getting linked data */
SWIG_Lua_module_get(lua_State * L)893 SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
894 {
895 /* there should be 2 params passed in
896 (1) table (not the meta table)
897 (2) string name of the attribute
898 printf("SWIG_Lua_module_get %p(%s) '%s'\n",
899 lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
900 lua_tostring(L,2));
901 */
902 /* get the metatable */
903 assert(lua_istable(L,1)); /* just in case */
904 lua_getmetatable(L,1); /* get the metatable */
905 assert(lua_istable(L,-1)); /* just in case */
906 SWIG_Lua_get_table(L,".get"); /* get the .get table */
907 lua_remove(L,3); /* remove metatable */
908 if (lua_istable(L,-1))
909 {
910 /* look for the key in the .get table */
911 lua_pushvalue(L,2); /* key */
912 lua_rawget(L,-2);
913 lua_remove(L,3); /* remove .get */
914 if (lua_iscfunction(L,-1))
915 { /* found it so call the fn & return its value */
916 lua_call(L,0,1);
917 return 1;
918 }
919 lua_pop(L,1); /* remove the top */
920 }
921 lua_pop(L,1); /* remove the .get */
922 lua_pushnil(L); /* return a nil */
923 return 1;
924 }
925
926 /* the module.set method used for setting linked data */
SWIG_Lua_module_set(lua_State * L)927 SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
928 {
929 /* there should be 3 params passed in
930 (1) table (not the meta table)
931 (2) string name of the attribute
932 (3) any for the new value
933 */
934 /* get the metatable */
935 assert(lua_istable(L,1)); /* just in case */
936 lua_getmetatable(L,1); /* get the metatable */
937 assert(lua_istable(L,-1)); /* just in case */
938 SWIG_Lua_get_table(L,".set"); /* get the .set table */
939 lua_remove(L,4); /* remove metatable */
940 if (lua_istable(L,-1))
941 {
942 /* look for the key in the .set table */
943 lua_pushvalue(L,2); /* key */
944 lua_rawget(L,-2);
945 lua_remove(L,4); /* remove .set */
946 if (lua_iscfunction(L,-1))
947 { /* found it so call the fn & return its value */
948 lua_pushvalue(L,3); /* value */
949 lua_call(L,1,0);
950 return 0;
951 }
952 }
953 lua_settop(L,3); /* reset back to start */
954 /* we now have the table, key & new value, so just set directly */
955 lua_rawset(L,1); /* add direct */
956 return 0;
957 }
958
959 /* registering a module in lua */
SWIG_Lua_module_begin(lua_State * L,const char * name)960 SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name)
961 {
962 assert(lua_istable(L,-1)); /* just in case */
963 lua_pushstring(L,name);
964 lua_newtable(L); /* the table */
965 /* add meta table */
966 lua_newtable(L); /* the meta table */
967 SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get);
968 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set);
969 lua_pushstring(L,".get");
970 lua_newtable(L); /* the .get table */
971 lua_rawset(L,-3); /* add .get into metatable */
972 lua_pushstring(L,".set");
973 lua_newtable(L); /* the .set table */
974 lua_rawset(L,-3); /* add .set into metatable */
975 lua_setmetatable(L,-2); /* sets meta table in module */
976 lua_rawset(L,-3); /* add module into parent */
977 SWIG_Lua_get_table(L,name); /* get the table back out */
978 }
979
980 /* ending the register */
SWIG_Lua_module_end(lua_State * L)981 SWIGINTERN void SWIG_Lua_module_end(lua_State* L)
982 {
983 lua_pop(L,1); /* tidy stack (remove module) */
984 }
985
986 /* adding a linked variable to the module */
SWIG_Lua_module_add_variable(lua_State * L,const char * name,lua_CFunction getFn,lua_CFunction setFn)987 SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
988 {
989 assert(lua_istable(L,-1)); /* just in case */
990 lua_getmetatable(L,-1); /* get the metatable */
991 assert(lua_istable(L,-1)); /* just in case */
992 SWIG_Lua_get_table(L,".get"); /* find the .get table */
993 assert(lua_istable(L,-1)); /* should be a table: */
994 SWIG_Lua_add_function(L,name,getFn);
995 lua_pop(L,1); /* tidy stack (remove table) */
996 if (setFn) /* if there is a set fn */
997 {
998 SWIG_Lua_get_table(L,".set"); /* find the .set table */
999 assert(lua_istable(L,-1)); /* should be a table: */
1000 SWIG_Lua_add_function(L,name,setFn);
1001 lua_pop(L,1); /* tidy stack (remove table) */
1002 }
1003 lua_pop(L,1); /* tidy stack (remove meta) */
1004 }
1005
1006 /* adding a function module */
SWIG_Lua_module_add_function(lua_State * L,const char * name,lua_CFunction fn)1007 SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
1008 {
1009 SWIG_Lua_add_function(L,name,fn);
1010 }
1011
1012 /* -----------------------------------------------------------------------------
1013 * global variable support code: classes
1014 * ----------------------------------------------------------------------------- */
1015
1016 /* the class.get method, performs the lookup of class attributes */
SWIG_Lua_class_get(lua_State * L)1017 SWIGINTERN int SWIG_Lua_class_get(lua_State* L)
1018 {
1019 /* there should be 2 params passed in
1020 (1) userdata (not the meta table)
1021 (2) string name of the attribute
1022 */
1023 assert(lua_isuserdata(L,-2)); /* just in case */
1024 lua_getmetatable(L,-2); /* get the meta table */
1025 assert(lua_istable(L,-1)); /* just in case */
1026 SWIG_Lua_get_table(L,".get"); /* find the .get table */
1027 assert(lua_istable(L,-1)); /* just in case */
1028 /* look for the key in the .get table */
1029 lua_pushvalue(L,2); /* key */
1030 lua_rawget(L,-2);
1031 lua_remove(L,-2); /* stack tidy, remove .get table */
1032 if (lua_iscfunction(L,-1))
1033 { /* found it so call the fn & return its value */
1034 lua_pushvalue(L,1); /* the userdata */
1035 lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */
1036 lua_remove(L,-2); /* stack tidy, remove metatable */
1037 return 1;
1038 }
1039 lua_pop(L,1); /* remove whatever was there */
1040 /* ok, so try the .fn table */
1041 SWIG_Lua_get_table(L,".fn"); /* find the .get table */
1042 assert(lua_istable(L,-1)); /* just in case */
1043 lua_pushvalue(L,2); /* key */
1044 lua_rawget(L,-2); /* look for the fn */
1045 lua_remove(L,-2); /* stack tidy, remove .fn table */
1046 if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
1047 { /* found it so return the fn & let lua call it */
1048 lua_remove(L,-2); /* stack tidy, remove metatable */
1049 return 1;
1050 }
1051 lua_pop(L,1); /* remove whatever was there */
1052 /* NEW: looks for the __getitem() fn
1053 this is a user provided get fn */
1054 SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
1055 if (lua_iscfunction(L,-1)) /* if its there */
1056 { /* found it so call the fn & return its value */
1057 lua_pushvalue(L,1); /* the userdata */
1058 lua_pushvalue(L,2); /* the parameter */
1059 lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
1060 lua_remove(L,-2); /* stack tidy, remove metatable */
1061 return 1;
1062 }
1063 return 0; /* sorry not known */
1064 }
1065
1066 /* the class.set method, performs the lookup of class attributes */
SWIG_Lua_class_set(lua_State * L)1067 SWIGINTERN int SWIG_Lua_class_set(lua_State* L)
1068 {
1069 /* there should be 3 params passed in
1070 (1) table (not the meta table)
1071 (2) string name of the attribute
1072 (3) any for the new value
1073 printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n",
1074 lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
1075 lua_tostring(L,2),
1076 lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/
1077
1078 assert(lua_isuserdata(L,1)); /* just in case */
1079 lua_getmetatable(L,1); /* get the meta table */
1080 assert(lua_istable(L,-1)); /* just in case */
1081
1082 SWIG_Lua_get_table(L,".set"); /* find the .set table */
1083 if (lua_istable(L,-1))
1084 {
1085 /* look for the key in the .set table */
1086 lua_pushvalue(L,2); /* key */
1087 lua_rawget(L,-2);
1088 if (lua_iscfunction(L,-1))
1089 { /* found it so call the fn & return its value */
1090 lua_pushvalue(L,1); /* userdata */
1091 lua_pushvalue(L,3); /* value */
1092 lua_call(L,2,0);
1093 return 0;
1094 }
1095 lua_pop(L,1); /* remove the value */
1096 }
1097 lua_pop(L,1); /* remove the value .set table */
1098 /* NEW: looks for the __setitem() fn
1099 this is a user provided set fn */
1100 SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
1101 if (lua_iscfunction(L,-1)) /* if its there */
1102 { /* found it so call the fn & return its value */
1103 lua_pushvalue(L,1); /* the userdata */
1104 lua_pushvalue(L,2); /* the parameter */
1105 lua_pushvalue(L,3); /* the value */
1106 lua_call(L,3,0); /* 3 values in ,0 out */
1107 lua_remove(L,-2); /* stack tidy, remove metatable */
1108 return 1;
1109 }
1110 return 0;
1111 }
1112
1113 /* the class.destruct method called by the interpreter */
SWIG_Lua_class_destruct(lua_State * L)1114 SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L)
1115 {
1116 /* there should be 1 params passed in
1117 (1) userdata (not the meta table) */
1118 swig_lua_userdata* usr;
1119 swig_lua_class* clss;
1120 assert(lua_isuserdata(L,-1)); /* just in case */
1121 usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
1122 /* if must be destroyed & has a destructor */
1123 if (usr->own) /* if must be destroyed */
1124 {
1125 clss=(swig_lua_class*)usr->type->clientdata; /* get the class */
1126 if (clss && clss->destructor) /* there is a destroy fn */
1127 {
1128 clss->destructor(usr->ptr); /* bye bye */
1129 }
1130 }
1131 return 0;
1132 }
1133
1134 /* gets the swig class registry (or creates it) */
SWIG_Lua_get_class_registry(lua_State * L)1135 SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L)
1136 {
1137 /* add this all into the swig registry: */
1138 lua_pushstring(L,"SWIG");
1139 lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */
1140 if (!lua_istable(L,-1)) /* not there */
1141 { /* must be first time, so add it */
1142 lua_pop(L,1); /* remove the result */
1143 lua_pushstring(L,"SWIG");
1144 lua_newtable(L);
1145 lua_rawset(L,LUA_REGISTRYINDEX);
1146 /* then get it */
1147 lua_pushstring(L,"SWIG");
1148 lua_rawget(L,LUA_REGISTRYINDEX);
1149 }
1150 }
1151
1152 /* helper fn to get the classes metatable from the register */
SWIG_Lua_get_class_metatable(lua_State * L,const char * cname)1153 SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname)
1154 {
1155 SWIG_Lua_get_class_registry(L); /* get the registry */
1156 lua_pushstring(L,cname); /* get the name */
1157 lua_rawget(L,-2); /* get it */
1158 lua_remove(L,-2); /* tidy up (remove registry) */
1159 }
1160
1161 /* helper add a variable to a registered class */
SWIG_Lua_add_class_variable(lua_State * L,const char * name,lua_CFunction getFn,lua_CFunction setFn)1162 SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
1163 {
1164 assert(lua_istable(L,-1)); /* just in case */
1165 SWIG_Lua_get_table(L,".get"); /* find the .get table */
1166 assert(lua_istable(L,-1)); /* just in case */
1167 SWIG_Lua_add_function(L,name,getFn);
1168 lua_pop(L,1); /* tidy stack (remove table) */
1169 if (setFn)
1170 {
1171 SWIG_Lua_get_table(L,".set"); /* find the .set table */
1172 assert(lua_istable(L,-1)); /* just in case */
1173 SWIG_Lua_add_function(L,name,setFn);
1174 lua_pop(L,1); /* tidy stack (remove table) */
1175 }
1176 }
1177
1178 /* helper to recursively add class details (attributes & operations) */
SWIG_Lua_add_class_details(lua_State * L,swig_lua_class * clss)1179 SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss)
1180 {
1181 int i;
1182 /* call all the base classes first: we can then override these later: */
1183 for(i=0;clss->bases[i];i++)
1184 {
1185 SWIG_Lua_add_class_details(L,clss->bases[i]);
1186 }
1187 /* add fns */
1188 for(i=0;clss->attributes[i].name;i++){
1189 SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
1190 }
1191 /* add methods to the metatable */
1192 SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
1193 assert(lua_istable(L,-1)); /* just in case */
1194 for(i=0;clss->methods[i].name;i++){
1195 SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
1196 }
1197 lua_pop(L,1); /* tidy stack (remove table) */
1198 /* add operator overloads
1199 these look ANY method which start with "__" and assume they
1200 are operator overloads & add them to the metatable
1201 (this might mess up is someone defines a method __gc (the destructor)*/
1202 for(i=0;clss->methods[i].name;i++){
1203 if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){
1204 SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
1205 }
1206 }
1207 }
1208
1209 /* set up the base classes pointers.
1210 Each class structure has a list of pointers to the base class structures.
1211 This function fills them.
1212 It cannot be done at compile time, as this will not work with hireachies
1213 spread over more than one swig file.
1214 Therefore it must be done at runtime, querying the SWIG type system.
1215 */
SWIG_Lua_init_base_class(lua_State * L,swig_lua_class * clss)1216 SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss)
1217 {
1218 int i=0;
1219 swig_module_info* module=SWIG_GetModule(L);
1220 for(i=0;clss->base_names[i];i++)
1221 {
1222 if (clss->bases[i]==0) /* not found yet */
1223 {
1224 /* lookup and cache the base class */
1225 swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
1226 if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
1227 }
1228 }
1229 }
1230
1231 /* performs the entire class registration process */
SWIG_Lua_class_register(lua_State * L,swig_lua_class * clss)1232 SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss)
1233 {
1234 /* add its constructor to module with the name of the class
1235 so you can do MyClass(...) as well as new_MyClass(...)
1236 BUT only if a constructor is defined
1237 (this overcomes the problem of pure virtual classes without constructors)*/
1238 if (clss->constructor)
1239 SWIG_Lua_add_function(L,clss->name,clss->constructor);
1240
1241 SWIG_Lua_get_class_registry(L); /* get the registry */
1242 lua_pushstring(L,clss->name); /* get the name */
1243 lua_newtable(L); /* create the metatable */
1244 /* add string of class name called ".type" */
1245 lua_pushstring(L,".type");
1246 lua_pushstring(L,clss->name);
1247 lua_rawset(L,-3);
1248 /* add a table called ".get" */
1249 lua_pushstring(L,".get");
1250 lua_newtable(L);
1251 lua_rawset(L,-3);
1252 /* add a table called ".set" */
1253 lua_pushstring(L,".set");
1254 lua_newtable(L);
1255 lua_rawset(L,-3);
1256 /* add a table called ".fn" */
1257 lua_pushstring(L,".fn");
1258 lua_newtable(L);
1259 lua_rawset(L,-3);
1260 /* add accessor fns for using the .get,.set&.fn */
1261 SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
1262 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
1263 SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
1264 /* add it */
1265 lua_rawset(L,-3); /* metatable into registry */
1266 lua_pop(L,1); /* tidy stack (remove registry) */
1267
1268 SWIG_Lua_get_class_metatable(L,clss->name);
1269 SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */
1270 lua_pop(L,1); /* tidy stack (remove class metatable) */
1271 }
1272
1273 /* -----------------------------------------------------------------------------
1274 * Class/structure conversion fns
1275 * ----------------------------------------------------------------------------- */
1276
1277 /* helper to add metatable to new lua object */
_SWIG_Lua_AddMetatable(lua_State * L,swig_type_info * type)1278 SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type)
1279 {
1280 if (type->clientdata) /* there is clientdata: so add the metatable */
1281 {
1282 SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name);
1283 if (lua_istable(L,-1))
1284 {
1285 lua_setmetatable(L,-2);
1286 }
1287 else
1288 {
1289 lua_pop(L,1);
1290 }
1291 }
1292 }
1293
1294 /* pushes a new object into the lua stack */
SWIG_Lua_NewPointerObj(lua_State * L,void * ptr,swig_type_info * type,int own)1295 SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own)
1296 {
1297 swig_lua_userdata* usr;
1298 if (!ptr){
1299 lua_pushnil(L);
1300 return;
1301 }
1302 usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */
1303 usr->ptr=ptr; /* set the ptr */
1304 usr->type=type;
1305 usr->own=own;
1306 _SWIG_Lua_AddMetatable(L,type); /* add metatable */
1307 }
1308
1309 /* takes a object from the lua stack & converts it into an object of the correct type
1310 (if possible) */
SWIG_Lua_ConvertPtr(lua_State * L,int index,void ** ptr,swig_type_info * type,int flags)1311 SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags)
1312 {
1313 swig_lua_userdata* usr;
1314 swig_cast_info *cast;
1315 if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
1316 usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
1317 if (usr)
1318 {
1319 if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
1320 {
1321 usr->own=0;
1322 }
1323 if (!type) /* special cast void*, no casting fn */
1324 {
1325 *ptr=usr->ptr;
1326 return SWIG_OK; /* ok */
1327 }
1328 cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
1329 if (cast)
1330 {
1331 int newmemory = 0;
1332 *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
1333 assert(!newmemory); /* newmemory handling not yet implemented */
1334 return SWIG_OK; /* ok */
1335 }
1336 }
1337 return SWIG_ERROR; /* error */
1338 }
1339
SWIG_Lua_MustGetPtr(lua_State * L,int index,swig_type_info * type,int flags,int argnum,const char * func_name)1340 SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags,
1341 int argnum,const char* func_name){
1342 void* result;
1343 if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
1344 lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n",
1345 func_name,(type && type->str)?type->str:"void*",argnum);
1346 lua_error(L);
1347 }
1348 return result;
1349 }
1350
1351 /* 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)1352 SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type)
1353 {
1354 swig_lua_rawdata* raw;
1355 assert(ptr); /* not acceptable to pass in a NULL value */
1356 raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */
1357 raw->type=type;
1358 raw->own=0;
1359 memcpy(raw->data,ptr,size); /* copy the data */
1360 _SWIG_Lua_AddMetatable(L,type); /* add metatable */
1361 }
1362
1363 /* 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)1364 SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type)
1365 {
1366 swig_lua_rawdata* raw;
1367 raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */
1368 if (!raw) return SWIG_ERROR; /* error */
1369 if (type==0 || type==raw->type) /* void* or identical type */
1370 {
1371 memcpy(ptr,raw->data,size); /* copy it */
1372 return SWIG_OK; /* ok */
1373 }
1374 return SWIG_ERROR; /* error */
1375 }
1376
1377 /* a function to get the typestring of a piece of data */
SWIG_Lua_typename(lua_State * L,int tp)1378 SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
1379 {
1380 swig_lua_userdata* usr;
1381 if (lua_isuserdata(L,tp))
1382 {
1383 usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
1384 if (usr && usr->type && usr->type->str)
1385 return usr->type->str;
1386 return "userdata (unknown type)";
1387 }
1388 return lua_typename(L,lua_type(L,tp));
1389 }
1390
1391 /* lua callable function to get the userdata's type */
SWIG_Lua_type(lua_State * L)1392 SWIGRUNTIME int SWIG_Lua_type(lua_State* L)
1393 {
1394 lua_pushstring(L,SWIG_Lua_typename(L,1));
1395 return 1;
1396 }
1397
1398 /* lua callable function to compare userdata's value
1399 the issue is that two userdata may point to the same thing
1400 but to lua, they are different objects */
SWIG_Lua_equal(lua_State * L)1401 SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
1402 {
1403 int result;
1404 swig_lua_userdata *usr1,*usr2;
1405 if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
1406 return 0; /* nil reply */
1407 usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
1408 usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
1409 /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
1410 result=(usr1->ptr==usr2->ptr);
1411 lua_pushboolean(L,result);
1412 return 1;
1413 }
1414
1415 /* -----------------------------------------------------------------------------
1416 * global variable support code: class/struct typemap functions
1417 * ----------------------------------------------------------------------------- */
1418
1419 /* Install Constants */
1420 SWIGINTERN void
SWIG_Lua_InstallConstants(lua_State * L,swig_lua_const_info constants[])1421 SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
1422 int i;
1423 for (i = 0; constants[i].type; i++) {
1424 switch(constants[i].type) {
1425 case SWIG_LUA_INT:
1426 lua_pushstring(L,constants[i].name);
1427 lua_pushnumber(L,(lua_Number)constants[i].lvalue);
1428 lua_rawset(L,-3);
1429 break;
1430 case SWIG_LUA_FLOAT:
1431 lua_pushstring(L,constants[i].name);
1432 lua_pushnumber(L,(lua_Number)constants[i].dvalue);
1433 lua_rawset(L,-3);
1434 break;
1435 case SWIG_LUA_CHAR:
1436 lua_pushstring(L,constants[i].name);
1437 lua_pushfstring(L,"%c",(char)constants[i].lvalue);
1438 lua_rawset(L,-3);
1439 break;
1440 case SWIG_LUA_STRING:
1441 lua_pushstring(L,constants[i].name);
1442 lua_pushstring(L,(char *) constants[i].pvalue);
1443 lua_rawset(L,-3);
1444 break;
1445 case SWIG_LUA_POINTER:
1446 lua_pushstring(L,constants[i].name);
1447 SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
1448 lua_rawset(L,-3);
1449 break;
1450 case SWIG_LUA_BINARY:
1451 lua_pushstring(L,constants[i].name);
1452 SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
1453 lua_rawset(L,-3);
1454 break;
1455 default:
1456 break;
1457 }
1458 }
1459 }
1460
1461 /* -----------------------------------------------------------------------------
1462 * executing lua code from within the wrapper
1463 * ----------------------------------------------------------------------------- */
1464
1465 #ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
1466 #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
1467 #endif
1468 /* Executes a C string in Lua a really simple way of calling lua from C
1469 Unfortunately lua keeps changing its API's, so we need a conditional compile
1470 In lua 5.0.X its lua_dostring()
1471 In lua 5.1.X its luaL_dostring()
1472 */
1473 SWIGINTERN int
SWIG_Lua_dostring(lua_State * L,const char * str)1474 SWIG_Lua_dostring(lua_State *L, const char* str) {
1475 int ok,top;
1476 if (str==0 || str[0]==0) return 0; /* nothing to do */
1477 top=lua_gettop(L); /* save stack */
1478 #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
1479 ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */
1480 #else
1481 ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */
1482 #endif
1483 if (ok!=0) {
1484 SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
1485 }
1486 lua_settop(L,top); /* restore the stack */
1487 return ok;
1488 }
1489
1490 #ifdef __cplusplus
1491 }
1492 #endif
1493
1494 /* ------------------------------ end luarun.swg ------------------------------ */
1495
1496
1497 /* -------- TYPES TABLE (BEGIN) -------- */
1498
1499 static swig_type_info *swig_types[1];
1500 static swig_module_info swig_module = {swig_types, 0, 0, 0, 0, 0};
1501 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1502 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1503
1504 /* -------- TYPES TABLE (END) -------- */
1505
1506 #define SWIG_name "mod_sdlmouse"
1507 #define SWIG_init luaopen_mod_sdlmouse
1508 #define SWIG_init_user luaopen_mod_sdlmouse_user
1509
1510 #define SWIG_LUACODE luaopen_mod_sdlmouse_luacode
1511
1512
1513 namespace swig {
1514 typedef struct{} LANGUAGE_OBJ;
1515 }
1516
1517 #include "love_sdlmouse.h"
1518 #ifdef __cplusplus
1519 extern "C" {
1520 #endif
_wrap_getX(lua_State * L)1521 static int _wrap_getX(lua_State* L) {
1522 int SWIG_arg = -1;
1523 float result;
1524
1525 SWIG_check_num_args("love_sdlmouse::getX",0,0)
1526 result = (float)love_sdlmouse::getX();
1527 SWIG_arg=0;
1528 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
1529 return SWIG_arg;
1530
1531 if(0) SWIG_fail;
1532
1533 fail:
1534 lua_error(L);
1535 return SWIG_arg;
1536 }
1537
1538
_wrap_getY(lua_State * L)1539 static int _wrap_getY(lua_State* L) {
1540 int SWIG_arg = -1;
1541 float result;
1542
1543 SWIG_check_num_args("love_sdlmouse::getY",0,0)
1544 result = (float)love_sdlmouse::getY();
1545 SWIG_arg=0;
1546 lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
1547 return SWIG_arg;
1548
1549 if(0) SWIG_fail;
1550
1551 fail:
1552 lua_error(L);
1553 return SWIG_arg;
1554 }
1555
1556
_wrap_setPosition(lua_State * L)1557 static int _wrap_setPosition(lua_State* L) {
1558 int SWIG_arg = -1;
1559 float arg1 ;
1560 float arg2 ;
1561
1562 SWIG_check_num_args("love_sdlmouse::setPosition",2,2)
1563 if(!lua_isnumber(L,1)) SWIG_fail_arg("love_sdlmouse::setPosition",1,"float");
1564 if(!lua_isnumber(L,2)) SWIG_fail_arg("love_sdlmouse::setPosition",2,"float");
1565 arg1 = (float)lua_tonumber(L, 1);
1566 arg2 = (float)lua_tonumber(L, 2);
1567 love_sdlmouse::setPosition(arg1,arg2);
1568 SWIG_arg=0;
1569
1570 return SWIG_arg;
1571
1572 if(0) SWIG_fail;
1573
1574 fail:
1575 lua_error(L);
1576 return SWIG_arg;
1577 }
1578
1579
_wrap_isDown(lua_State * L)1580 static int _wrap_isDown(lua_State* L) {
1581 int SWIG_arg = -1;
1582 int arg1 ;
1583 bool result;
1584
1585 SWIG_check_num_args("love_sdlmouse::isDown",1,1)
1586 if(!lua_isnumber(L,1)) SWIG_fail_arg("love_sdlmouse::isDown",1,"int");
1587 arg1 = (int)lua_tonumber(L, 1);
1588 result = (bool)love_sdlmouse::isDown(arg1);
1589 SWIG_arg=0;
1590 lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1591 return SWIG_arg;
1592
1593 if(0) SWIG_fail;
1594
1595 fail:
1596 lua_error(L);
1597 return SWIG_arg;
1598 }
1599
1600
_wrap_setVisible(lua_State * L)1601 static int _wrap_setVisible(lua_State* L) {
1602 int SWIG_arg = -1;
1603 bool arg1 ;
1604
1605 SWIG_check_num_args("love_sdlmouse::setVisible",1,1)
1606 if(!lua_isboolean(L,1)) SWIG_fail_arg("love_sdlmouse::setVisible",1,"bool");
1607 arg1 = (lua_toboolean(L, 1)!=0);
1608 love_sdlmouse::setVisible(arg1);
1609 SWIG_arg=0;
1610
1611 return SWIG_arg;
1612
1613 if(0) SWIG_fail;
1614
1615 fail:
1616 lua_error(L);
1617 return SWIG_arg;
1618 }
1619
1620
_wrap_isVisible(lua_State * L)1621 static int _wrap_isVisible(lua_State* L) {
1622 int SWIG_arg = -1;
1623 bool result;
1624
1625 SWIG_check_num_args("love_sdlmouse::isVisible",0,0)
1626 result = (bool)love_sdlmouse::isVisible();
1627 SWIG_arg=0;
1628 lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1629 return SWIG_arg;
1630
1631 if(0) SWIG_fail;
1632
1633 fail:
1634 lua_error(L);
1635 return SWIG_arg;
1636 }
1637
1638
1639 #ifdef __cplusplus
1640 }
1641 #endif
1642
1643 static const struct luaL_reg swig_commands[] = {
1644 { "getX", _wrap_getX},
1645 { "getY", _wrap_getY},
1646 { "setPosition", _wrap_setPosition},
1647 { "isDown", _wrap_isDown},
1648 { "setVisible", _wrap_setVisible},
1649 { "isVisible", _wrap_isVisible},
1650 { "getPosition",love_sdlmouse::getPosition},
1651 {0,0}
1652 };
1653
1654 static swig_lua_var_info swig_variables[] = {
1655 {0,0,0}
1656 };
1657
1658 static swig_lua_const_info swig_constants[] = {
1659 {0,0,0,0,0,0}
1660 };
1661
1662 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
1663
1664
1665 static swig_type_info *swig_type_initial[] = {
1666 NULL
1667 };
1668
1669
1670 static swig_cast_info *swig_cast_initial[] = {
1671 NULL
1672 };
1673
1674
1675 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
1676
1677 /* -----------------------------------------------------------------------------
1678 * Type initialization:
1679 * This problem is tough by the requirement that no dynamic
1680 * memory is used. Also, since swig_type_info structures store pointers to
1681 * swig_cast_info structures and swig_cast_info structures store pointers back
1682 * to swig_type_info structures, we need some lookup code at initialization.
1683 * The idea is that swig generates all the structures that are needed.
1684 * The runtime then collects these partially filled structures.
1685 * The SWIG_InitializeModule function takes these initial arrays out of
1686 * swig_module, and does all the lookup, filling in the swig_module.types
1687 * array with the correct data and linking the correct swig_cast_info
1688 * structures together.
1689 *
1690 * The generated swig_type_info structures are assigned staticly to an initial
1691 * array. We just loop through that array, and handle each type individually.
1692 * First we lookup if this type has been already loaded, and if so, use the
1693 * loaded structure instead of the generated one. Then we have to fill in the
1694 * cast linked list. The cast data is initially stored in something like a
1695 * two-dimensional array. Each row corresponds to a type (there are the same
1696 * number of rows as there are in the swig_type_initial array). Each entry in
1697 * a column is one of the swig_cast_info structures for that type.
1698 * The cast_initial array is actually an array of arrays, because each row has
1699 * a variable number of columns. So to actually build the cast linked list,
1700 * we find the array of casts associated with the type, and loop through it
1701 * adding the casts to the list. The one last trick we need to do is making
1702 * sure the type pointer in the swig_cast_info struct is correct.
1703 *
1704 * First off, we lookup the cast->type name to see if it is already loaded.
1705 * There are three cases to handle:
1706 * 1) If the cast->type has already been loaded AND the type we are adding
1707 * casting info to has not been loaded (it is in this module), THEN we
1708 * replace the cast->type pointer with the type pointer that has already
1709 * been loaded.
1710 * 2) If BOTH types (the one we are adding casting info to, and the
1711 * cast->type) are loaded, THEN the cast info has already been loaded by
1712 * the previous module so we just ignore it.
1713 * 3) Finally, if cast->type has not already been loaded, then we add that
1714 * swig_cast_info to the linked list (because the cast->type) pointer will
1715 * be correct.
1716 * ----------------------------------------------------------------------------- */
1717
1718 #ifdef __cplusplus
1719 extern "C" {
1720 #if 0
1721 } /* c-mode */
1722 #endif
1723 #endif
1724
1725 #if 0
1726 #define SWIGRUNTIME_DEBUG
1727 #endif
1728
1729
1730 SWIGRUNTIME void
SWIG_InitializeModule(void * clientdata)1731 SWIG_InitializeModule(void *clientdata) {
1732 size_t i;
1733 swig_module_info *module_head, *iter;
1734 int found, init;
1735
1736 clientdata = clientdata;
1737
1738 /* check to see if the circular list has been setup, if not, set it up */
1739 if (swig_module.next==0) {
1740 /* Initialize the swig_module */
1741 swig_module.type_initial = swig_type_initial;
1742 swig_module.cast_initial = swig_cast_initial;
1743 swig_module.next = &swig_module;
1744 init = 1;
1745 } else {
1746 init = 0;
1747 }
1748
1749 /* Try and load any already created modules */
1750 module_head = SWIG_GetModule(clientdata);
1751 if (!module_head) {
1752 /* This is the first module loaded for this interpreter */
1753 /* so set the swig module into the interpreter */
1754 SWIG_SetModule(clientdata, &swig_module);
1755 module_head = &swig_module;
1756 } else {
1757 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
1758 found=0;
1759 iter=module_head;
1760 do {
1761 if (iter==&swig_module) {
1762 found=1;
1763 break;
1764 }
1765 iter=iter->next;
1766 } while (iter!= module_head);
1767
1768 /* if the is found in the list, then all is done and we may leave */
1769 if (found) return;
1770 /* otherwise we must add out module into the list */
1771 swig_module.next = module_head->next;
1772 module_head->next = &swig_module;
1773 }
1774
1775 /* When multiple interpeters are used, a module could have already been initialized in
1776 a different interpreter, but not yet have a pointer in this interpreter.
1777 In this case, we do not want to continue adding types... everything should be
1778 set up already */
1779 if (init == 0) return;
1780
1781 /* Now work on filling in swig_module.types */
1782 #ifdef SWIGRUNTIME_DEBUG
1783 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
1784 #endif
1785 for (i = 0; i < swig_module.size; ++i) {
1786 swig_type_info *type = 0;
1787 swig_type_info *ret;
1788 swig_cast_info *cast;
1789
1790 #ifdef SWIGRUNTIME_DEBUG
1791 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
1792 #endif
1793
1794 /* if there is another module already loaded */
1795 if (swig_module.next != &swig_module) {
1796 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
1797 }
1798 if (type) {
1799 /* Overwrite clientdata field */
1800 #ifdef SWIGRUNTIME_DEBUG
1801 printf("SWIG_InitializeModule: found type %s\n", type->name);
1802 #endif
1803 if (swig_module.type_initial[i]->clientdata) {
1804 type->clientdata = swig_module.type_initial[i]->clientdata;
1805 #ifdef SWIGRUNTIME_DEBUG
1806 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
1807 #endif
1808 }
1809 } else {
1810 type = swig_module.type_initial[i];
1811 }
1812
1813 /* Insert casting types */
1814 cast = swig_module.cast_initial[i];
1815 while (cast->type) {
1816
1817 /* Don't need to add information already in the list */
1818 ret = 0;
1819 #ifdef SWIGRUNTIME_DEBUG
1820 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
1821 #endif
1822 if (swig_module.next != &swig_module) {
1823 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
1824 #ifdef SWIGRUNTIME_DEBUG
1825 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
1826 #endif
1827 }
1828 if (ret) {
1829 if (type == swig_module.type_initial[i]) {
1830 #ifdef SWIGRUNTIME_DEBUG
1831 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
1832 #endif
1833 cast->type = ret;
1834 ret = 0;
1835 } else {
1836 /* Check for casting already in the list */
1837 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
1838 #ifdef SWIGRUNTIME_DEBUG
1839 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
1840 #endif
1841 if (!ocast) ret = 0;
1842 }
1843 }
1844
1845 if (!ret) {
1846 #ifdef SWIGRUNTIME_DEBUG
1847 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
1848 #endif
1849 if (type->cast) {
1850 type->cast->prev = cast;
1851 cast->next = type->cast;
1852 }
1853 type->cast = cast;
1854 }
1855 cast++;
1856 }
1857 /* Set entry in modules->types array equal to the type */
1858 swig_module.types[i] = type;
1859 }
1860 swig_module.types[i] = 0;
1861
1862 #ifdef SWIGRUNTIME_DEBUG
1863 printf("**** SWIG_InitializeModule: Cast List ******\n");
1864 for (i = 0; i < swig_module.size; ++i) {
1865 int j = 0;
1866 swig_cast_info *cast = swig_module.cast_initial[i];
1867 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
1868 while (cast->type) {
1869 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
1870 cast++;
1871 ++j;
1872 }
1873 printf("---- Total casts: %d\n",j);
1874 }
1875 printf("**** SWIG_InitializeModule: Cast List ******\n");
1876 #endif
1877 }
1878
1879 /* This function will propagate the clientdata field of type to
1880 * any new swig_type_info structures that have been added into the list
1881 * of equivalent types. It is like calling
1882 * SWIG_TypeClientData(type, clientdata) a second time.
1883 */
1884 SWIGRUNTIME void
SWIG_PropagateClientData(void)1885 SWIG_PropagateClientData(void) {
1886 size_t i;
1887 swig_cast_info *equiv;
1888 static int init_run = 0;
1889
1890 if (init_run) return;
1891 init_run = 1;
1892
1893 for (i = 0; i < swig_module.size; i++) {
1894 if (swig_module.types[i]->clientdata) {
1895 equiv = swig_module.types[i]->cast;
1896 while (equiv) {
1897 if (!equiv->converter) {
1898 if (equiv->type && !equiv->type->clientdata)
1899 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
1900 }
1901 equiv = equiv->next;
1902 }
1903 }
1904 }
1905 }
1906
1907 #ifdef __cplusplus
1908 #if 0
1909 { /* c-mode */
1910 #endif
1911 }
1912 #endif
1913
1914
1915
1916 /* Forward declaration of where the user's %init{} gets inserted */
1917 void SWIG_init_user(lua_State* L );
1918
1919 #ifdef __cplusplus
1920 extern "C" {
1921 #endif
1922 /* this is the initialization function
1923 added at the very end of the code
1924 the function is always called SWIG_init, but an eariler #define will rename it
1925 */
SWIG_init(lua_State * L)1926 SWIGEXPORT int SWIG_init(lua_State* L)
1927 {
1928 int i;
1929 /* start with global table */
1930 lua_pushvalue(L,LUA_GLOBALSINDEX);
1931 /* SWIG's internal initalisation */
1932 SWIG_InitializeModule((void*)L);
1933 SWIG_PropagateClientData();
1934 /* add a global fn */
1935 SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
1936 SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
1937 /* begin the module (its a table with the same name as the module) */
1938 SWIG_Lua_module_begin(L,SWIG_name);
1939 /* add commands/functions */
1940 for (i = 0; swig_commands[i].name; i++){
1941 SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
1942 }
1943 /* add variables */
1944 for (i = 0; swig_variables[i].name; i++){
1945 SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
1946 }
1947 /* set up base class pointers (the hierachy) */
1948 for (i = 0; swig_types[i]; i++){
1949 if (swig_types[i]->clientdata){
1950 SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
1951 }
1952 }
1953 /* additional registration structs & classes in lua */
1954 for (i = 0; swig_types[i]; i++){
1955 if (swig_types[i]->clientdata){
1956 SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
1957 }
1958 }
1959 /* constants */
1960 SWIG_Lua_InstallConstants(L,swig_constants);
1961 /* invoke user-specific initialization */
1962 SWIG_init_user(L);
1963 /* end module */
1964 lua_pop(L,1); /* tidy stack (remove module table)*/
1965 lua_pop(L,1); /* tidy stack (remove global table)*/
1966 return 1;
1967 }
1968
1969 #ifdef __cplusplus
1970 }
1971 #endif
1972
1973
1974 const char* SWIG_LUACODE=
1975 "\n"
1976 "love.mouse = mod_sdlmouse";
1977
SWIG_init_user(lua_State * L)1978 void SWIG_init_user(lua_State* L)
1979 {
1980 /* exec Lua code if applicable */
1981 SWIG_Lua_dostring(L,SWIG_LUACODE);
1982 }
1983