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