1 
2 // SWIGFUSION ^.^
3 
4 // Lua
5 struct lua_State;
6 
7 // Forward declarations of fused methods:
8 namespace love_physfs
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 #define SWIGTYPE_p_boost__shared_ptrT_love__File_t swig_types[0]
1501 #define SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t swig_types[1]
1502 #define SWIGTYPE_p_love__File swig_types[2]
1503 #define SWIGTYPE_p_love_physfs__File swig_types[3]
1504 static swig_type_info *swig_types[5];
1505 static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
1506 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1507 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1508 
1509 /* -------- TYPES TABLE (END) -------- */
1510 
1511 #define SWIG_name      "mod_physfs"
1512 #define SWIG_init      luaopen_mod_physfs
1513 #define SWIG_init_user luaopen_mod_physfs_user
1514 
1515 #define SWIG_LUACODE   luaopen_mod_physfs_luacode
1516 
1517 
1518 namespace swig {
1519 typedef struct{} LANGUAGE_OBJ;
1520 }
1521 
1522 
1523 #include <boost/shared_ptr.hpp>
1524 #include "love_physfs.h"
1525 
1526 #include <love/File.h>
1527 #include "File.h"
1528 #ifdef __cplusplus
1529 extern "C" {
1530 #endif
_wrap_delete_shared_File(lua_State * L)1531 static int _wrap_delete_shared_File(lua_State* L) {
1532   int SWIG_arg = -1;
1533   love::File *arg1 = (love::File *) 0 ;
1534 
1535   SWIG_check_num_args("love::File::~File",1,1)
1536   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("love::File::~File",1,"love::File *");
1537 
1538   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_love__File,SWIG_POINTER_DISOWN))){
1539     SWIG_fail_ptr("delete_shared_File",1,SWIGTYPE_p_love__File);
1540   }
1541 
1542   delete arg1;
1543 
1544   SWIG_arg=0;
1545 
1546   return SWIG_arg;
1547 
1548   if(0) SWIG_fail;
1549 
1550 fail:
1551   lua_error(L);
1552   return SWIG_arg;
1553 }
1554 
1555 
swig_delete_shared_File(void * obj)1556 static void swig_delete_shared_File(void *obj) {
1557 love::File *arg1 = (love::File *) obj;
1558 delete arg1;
1559 }
1560 static swig_lua_method swig_love_File_methods[] = {
1561     {0,0}
1562 };
1563 static swig_lua_attribute swig_love_File_attributes[] = {
1564     {0,0,0}
1565 };
1566 static swig_lua_class *swig_love_File_bases[] = {0};
1567 static const char *swig_love_File_base_names[] = {0};
1568 static swig_lua_class _wrap_class_love_File = { "shared_File", &SWIGTYPE_p_love__File,0, swig_delete_shared_File, swig_love_File_methods, swig_love_File_attributes, swig_love_File_bases, swig_love_File_base_names };
1569 
_wrap_File_getSize(lua_State * L)1570 static int _wrap_File_getSize(lua_State* L) {
1571   int SWIG_arg = -1;
1572   love_physfs::File *arg1 = (love_physfs::File *) 0 ;
1573   int result;
1574 
1575   SWIG_check_num_args("getSize",1,1)
1576   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getSize",1,"love_physfs::File *");
1577 
1578   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_love_physfs__File,0))){
1579     SWIG_fail_ptr("File_getSize",1,SWIGTYPE_p_love_physfs__File);
1580   }
1581 
1582   result = (int)(arg1)->getSize();
1583   SWIG_arg=0;
1584   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
1585   return SWIG_arg;
1586 
1587   if(0) SWIG_fail;
1588 
1589 fail:
1590   lua_error(L);
1591   return SWIG_arg;
1592 }
1593 
1594 
_wrap_delete_File(lua_State * L)1595 static int _wrap_delete_File(lua_State* L) {
1596   int SWIG_arg = -1;
1597   love_physfs::File *arg1 = (love_physfs::File *) 0 ;
1598 
1599   SWIG_check_num_args("love_physfs::File::~File",1,1)
1600   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("love_physfs::File::~File",1,"love_physfs::File *");
1601 
1602   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_love_physfs__File,SWIG_POINTER_DISOWN))){
1603     SWIG_fail_ptr("delete_File",1,SWIGTYPE_p_love_physfs__File);
1604   }
1605 
1606   delete arg1;
1607 
1608   SWIG_arg=0;
1609 
1610   return SWIG_arg;
1611 
1612   if(0) SWIG_fail;
1613 
1614 fail:
1615   lua_error(L);
1616   return SWIG_arg;
1617 }
1618 
1619 
swig_delete_File(void * obj)1620 static void swig_delete_File(void *obj) {
1621 love_physfs::File *arg1 = (love_physfs::File *) obj;
1622 delete arg1;
1623 }
1624 static swig_lua_method swig_love_physfs_File_methods[] = {
1625     {"getSize", _wrap_File_getSize},
1626     {0,0}
1627 };
1628 static swig_lua_attribute swig_love_physfs_File_attributes[] = {
1629     {0,0,0}
1630 };
1631 static swig_lua_class *swig_love_physfs_File_bases[] = {0,0};
1632 static const char *swig_love_physfs_File_base_names[] = {"love::File *",0};
1633 static swig_lua_class _wrap_class_love_physfs_File = { "File", &SWIGTYPE_p_love_physfs__File,0, swig_delete_File, swig_love_physfs_File_methods, swig_love_physfs_File_attributes, swig_love_physfs_File_bases, swig_love_physfs_File_base_names };
1634 
_wrap_SmartFile_physfs___deref__(lua_State * L)1635 static int _wrap_SmartFile_physfs___deref__(lua_State* L) {
1636   int SWIG_arg = -1;
1637   boost::shared_ptr< love_physfs::File > *arg1 = (boost::shared_ptr< love_physfs::File > *) 0 ;
1638   love_physfs::File *result = 0 ;
1639 
1640   SWIG_check_num_args("operator ->",1,1)
1641   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("operator ->",1,"boost::shared_ptr< love_physfs::File > const *");
1642 
1643   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
1644     SWIG_fail_ptr("SmartFile_physfs___deref__",1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
1645   }
1646 
1647   result = (love_physfs::File *)((boost::shared_ptr< love_physfs::File > const *)arg1)->operator ->();
1648   SWIG_arg=0;
1649   SWIG_NewPointerObj(L,result,SWIGTYPE_p_love_physfs__File,0); SWIG_arg++;
1650   return SWIG_arg;
1651 
1652   if(0) SWIG_fail;
1653 
1654 fail:
1655   lua_error(L);
1656   return SWIG_arg;
1657 }
1658 
1659 
_wrap_delete_SmartFile_physfs(lua_State * L)1660 static int _wrap_delete_SmartFile_physfs(lua_State* L) {
1661   int SWIG_arg = -1;
1662   boost::shared_ptr< love_physfs::File > *arg1 = (boost::shared_ptr< love_physfs::File > *) 0 ;
1663 
1664   SWIG_check_num_args("boost::shared_ptr<(love_physfs::File)>::~shared_ptr<(love_physfs::File)>",1,1)
1665   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("boost::shared_ptr<(love_physfs::File)>::~shared_ptr<(love_physfs::File)>",1,"boost::shared_ptr< love_physfs::File > *");
1666 
1667   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,SWIG_POINTER_DISOWN))){
1668     SWIG_fail_ptr("delete_SmartFile_physfs",1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
1669   }
1670 
1671   delete arg1;
1672 
1673   SWIG_arg=0;
1674 
1675   return SWIG_arg;
1676 
1677   if(0) SWIG_fail;
1678 
1679 fail:
1680   lua_error(L);
1681   return SWIG_arg;
1682 }
1683 
1684 
_wrap_SmartFile_physfs_getSize(lua_State * L)1685 static int _wrap_SmartFile_physfs_getSize(lua_State* L) {
1686   int SWIG_arg = -1;
1687   boost::shared_ptr< love_physfs::File > *arg1 = (boost::shared_ptr< love_physfs::File > *) 0 ;
1688   int result;
1689 
1690   SWIG_check_num_args("getSize",1,1)
1691   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getSize",1,"boost::shared_ptr< love_physfs::File > *");
1692 
1693   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
1694     SWIG_fail_ptr("SmartFile_physfs_getSize",1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
1695   }
1696 
1697   result = (int)(*arg1)->getSize();
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 
swig_delete_SmartFile_physfs(void * obj)1710 static void swig_delete_SmartFile_physfs(void *obj) {
1711 boost::shared_ptr< love_physfs::File > *arg1 = (boost::shared_ptr< love_physfs::File > *) obj;
1712 delete arg1;
1713 }
1714 static swig_lua_method swig_boost_shared_ptr_Sl_love_physfs_File_Sg__methods[] = {
1715     {"__deref__", _wrap_SmartFile_physfs___deref__},
1716     {"getSize", _wrap_SmartFile_physfs_getSize},
1717     {0,0}
1718 };
1719 static swig_lua_attribute swig_boost_shared_ptr_Sl_love_physfs_File_Sg__attributes[] = {
1720     {0,0,0}
1721 };
1722 static swig_lua_class *swig_boost_shared_ptr_Sl_love_physfs_File_Sg__bases[] = {0};
1723 static const char *swig_boost_shared_ptr_Sl_love_physfs_File_Sg__base_names[] = {0};
1724 static swig_lua_class _wrap_class_boost_shared_ptr_Sl_love_physfs_File_Sg_ = { "SmartFile_physfs", &SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0, swig_delete_SmartFile_physfs, swig_boost_shared_ptr_Sl_love_physfs_File_Sg__methods, swig_boost_shared_ptr_Sl_love_physfs_File_Sg__attributes, swig_boost_shared_ptr_Sl_love_physfs_File_Sg__bases, swig_boost_shared_ptr_Sl_love_physfs_File_Sg__base_names };
1725 
_wrap_newFile__SWIG_0(lua_State * L)1726 static int _wrap_newFile__SWIG_0(lua_State* L) {
1727   int SWIG_arg = -1;
1728   char *arg1 = (char *) 0 ;
1729   int arg2 ;
1730   love_physfs::pFile result;
1731 
1732   SWIG_check_num_args("love_physfs::newFile",2,2)
1733   if(!lua_isstring(L,1)) SWIG_fail_arg("love_physfs::newFile",1,"char const *");
1734   if(!lua_isnumber(L,2)) SWIG_fail_arg("love_physfs::newFile",2,"int");
1735   arg1 = (char *)lua_tostring(L, 1);
1736   arg2 = (int)lua_tonumber(L, 2);
1737   result = love_physfs::newFile((char const *)arg1,arg2);
1738   SWIG_arg=0;
1739   {
1740     love_physfs::pFile * resultptr = new love_physfs::pFile((love_physfs::pFile &) result);
1741     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,1); SWIG_arg++;
1742   }
1743   return SWIG_arg;
1744 
1745   if(0) SWIG_fail;
1746 
1747 fail:
1748   lua_error(L);
1749   return SWIG_arg;
1750 }
1751 
1752 
_wrap_newFile__SWIG_1(lua_State * L)1753 static int _wrap_newFile__SWIG_1(lua_State* L) {
1754   int SWIG_arg = -1;
1755   char *arg1 = (char *) 0 ;
1756   love_physfs::pFile result;
1757 
1758   SWIG_check_num_args("love_physfs::newFile",1,1)
1759   if(!lua_isstring(L,1)) SWIG_fail_arg("love_physfs::newFile",1,"char const *");
1760   arg1 = (char *)lua_tostring(L, 1);
1761   result = love_physfs::newFile((char const *)arg1);
1762   SWIG_arg=0;
1763   {
1764     love_physfs::pFile * resultptr = new love_physfs::pFile((love_physfs::pFile &) result);
1765     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,1); SWIG_arg++;
1766   }
1767   return SWIG_arg;
1768 
1769   if(0) SWIG_fail;
1770 
1771 fail:
1772   lua_error(L);
1773   return SWIG_arg;
1774 }
1775 
1776 
_wrap_newFile(lua_State * L)1777 static int _wrap_newFile(lua_State* L) {
1778   int argc;
1779   int argv[3]={
1780     1,2,3
1781   };
1782 
1783   argc = lua_gettop(L);
1784   if (argc == 1) {
1785     int _v;
1786     {
1787       _v = lua_isstring(L,argv[0]);
1788     }
1789     if (_v) {
1790       return _wrap_newFile__SWIG_1(L);
1791     }
1792   }
1793   if (argc == 2) {
1794     int _v;
1795     {
1796       _v = lua_isstring(L,argv[0]);
1797     }
1798     if (_v) {
1799       {
1800         _v = lua_isnumber(L,argv[1]);
1801       }
1802       if (_v) {
1803         return _wrap_newFile__SWIG_0(L);
1804       }
1805     }
1806   }
1807 
1808   lua_pushstring(L,"No matching function for overloaded 'newFile'");
1809   lua_error(L);return 0;
1810 }
1811 
1812 
_wrap_getWorkingDirectory(lua_State * L)1813 static int _wrap_getWorkingDirectory(lua_State* L) {
1814   int SWIG_arg = -1;
1815   char *result = 0 ;
1816 
1817   SWIG_check_num_args("love_physfs::getWorkingDirectory",0,0)
1818   result = (char *)love_physfs::getWorkingDirectory();
1819   SWIG_arg=0;
1820   lua_pushstring(L,(const char*)result); SWIG_arg++;
1821   return SWIG_arg;
1822 
1823   if(0) SWIG_fail;
1824 
1825 fail:
1826   lua_error(L);
1827   return SWIG_arg;
1828 }
1829 
1830 
_wrap_exists(lua_State * L)1831 static int _wrap_exists(lua_State* L) {
1832   int SWIG_arg = -1;
1833   char *arg1 = (char *) 0 ;
1834   bool result;
1835 
1836   SWIG_check_num_args("love_physfs::exists",1,1)
1837   if(!lua_isstring(L,1)) SWIG_fail_arg("love_physfs::exists",1,"char const *");
1838   arg1 = (char *)lua_tostring(L, 1);
1839   result = (bool)love_physfs::exists((char const *)arg1);
1840   SWIG_arg=0;
1841   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1842   return SWIG_arg;
1843 
1844   if(0) SWIG_fail;
1845 
1846 fail:
1847   lua_error(L);
1848   return SWIG_arg;
1849 }
1850 
1851 
_wrap_isDirectory(lua_State * L)1852 static int _wrap_isDirectory(lua_State* L) {
1853   int SWIG_arg = -1;
1854   char *arg1 = (char *) 0 ;
1855   bool result;
1856 
1857   SWIG_check_num_args("love_physfs::isDirectory",1,1)
1858   if(!lua_isstring(L,1)) SWIG_fail_arg("love_physfs::isDirectory",1,"char const *");
1859   arg1 = (char *)lua_tostring(L, 1);
1860   result = (bool)love_physfs::isDirectory((char const *)arg1);
1861   SWIG_arg=0;
1862   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1863   return SWIG_arg;
1864 
1865   if(0) SWIG_fail;
1866 
1867 fail:
1868   lua_error(L);
1869   return SWIG_arg;
1870 }
1871 
1872 
_wrap_isFile(lua_State * L)1873 static int _wrap_isFile(lua_State* L) {
1874   int SWIG_arg = -1;
1875   char *arg1 = (char *) 0 ;
1876   bool result;
1877 
1878   SWIG_check_num_args("love_physfs::isFile",1,1)
1879   if(!lua_isstring(L,1)) SWIG_fail_arg("love_physfs::isFile",1,"char const *");
1880   arg1 = (char *)lua_tostring(L, 1);
1881   result = (bool)love_physfs::isFile((char const *)arg1);
1882   SWIG_arg=0;
1883   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1884   return SWIG_arg;
1885 
1886   if(0) SWIG_fail;
1887 
1888 fail:
1889   lua_error(L);
1890   return SWIG_arg;
1891 }
1892 
1893 
_wrap_mkdir(lua_State * L)1894 static int _wrap_mkdir(lua_State* L) {
1895   int SWIG_arg = -1;
1896   char *arg1 = (char *) 0 ;
1897   bool result;
1898 
1899   SWIG_check_num_args("love_physfs::mkdir",1,1)
1900   if(!lua_isstring(L,1)) SWIG_fail_arg("love_physfs::mkdir",1,"char const *");
1901   arg1 = (char *)lua_tostring(L, 1);
1902   result = (bool)love_physfs::mkdir((char const *)arg1);
1903   SWIG_arg=0;
1904   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1905   return SWIG_arg;
1906 
1907   if(0) SWIG_fail;
1908 
1909 fail:
1910   lua_error(L);
1911   return SWIG_arg;
1912 }
1913 
1914 
_wrap_remove(lua_State * L)1915 static int _wrap_remove(lua_State* L) {
1916   int SWIG_arg = -1;
1917   char *arg1 = (char *) 0 ;
1918   bool result;
1919 
1920   SWIG_check_num_args("love_physfs::remove",1,1)
1921   if(!lua_isstring(L,1)) SWIG_fail_arg("love_physfs::remove",1,"char const *");
1922   arg1 = (char *)lua_tostring(L, 1);
1923   result = (bool)love_physfs::remove((char const *)arg1);
1924   SWIG_arg=0;
1925   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1926   return SWIG_arg;
1927 
1928   if(0) SWIG_fail;
1929 
1930 fail:
1931   lua_error(L);
1932   return SWIG_arg;
1933 }
1934 
1935 
_wrap_open(lua_State * L)1936 static int _wrap_open(lua_State* L) {
1937   int SWIG_arg = -1;
1938   love_physfs::pFile *arg1 = 0 ;
1939   bool result;
1940 
1941   SWIG_check_num_args("love_physfs::open",1,1)
1942   if(!lua_isuserdata(L,1)) SWIG_fail_arg("love_physfs::open",1,"love_physfs::pFile &");
1943 
1944   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
1945     SWIG_fail_ptr("open",1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
1946   }
1947 
1948   result = (bool)love_physfs::open(*arg1);
1949   SWIG_arg=0;
1950   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1951   return SWIG_arg;
1952 
1953   if(0) SWIG_fail;
1954 
1955 fail:
1956   lua_error(L);
1957   return SWIG_arg;
1958 }
1959 
1960 
_wrap_close(lua_State * L)1961 static int _wrap_close(lua_State* L) {
1962   int SWIG_arg = -1;
1963   love_physfs::pFile *arg1 = 0 ;
1964   bool result;
1965 
1966   SWIG_check_num_args("love_physfs::close",1,1)
1967   if(!lua_isuserdata(L,1)) SWIG_fail_arg("love_physfs::close",1,"love_physfs::pFile &");
1968 
1969   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
1970     SWIG_fail_ptr("close",1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
1971   }
1972 
1973   result = (bool)love_physfs::close(*arg1);
1974   SWIG_arg=0;
1975   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
1976   return SWIG_arg;
1977 
1978   if(0) SWIG_fail;
1979 
1980 fail:
1981   lua_error(L);
1982   return SWIG_arg;
1983 }
1984 
1985 
_wrap_eof(lua_State * L)1986 static int _wrap_eof(lua_State* L) {
1987   int SWIG_arg = -1;
1988   love_physfs::pFile *arg1 = 0 ;
1989   bool result;
1990 
1991   SWIG_check_num_args("love_physfs::eof",1,1)
1992   if(!lua_isuserdata(L,1)) SWIG_fail_arg("love_physfs::eof",1,"love_physfs::pFile &");
1993 
1994   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
1995     SWIG_fail_ptr("eof",1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
1996   }
1997 
1998   result = (bool)love_physfs::eof(*arg1);
1999   SWIG_arg=0;
2000   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
2001   return SWIG_arg;
2002 
2003   if(0) SWIG_fail;
2004 
2005 fail:
2006   lua_error(L);
2007   return SWIG_arg;
2008 }
2009 
2010 
_wrap_tell(lua_State * L)2011 static int _wrap_tell(lua_State* L) {
2012   int SWIG_arg = -1;
2013   love_physfs::pFile *arg1 = 0 ;
2014   int result;
2015 
2016   SWIG_check_num_args("love_physfs::tell",1,1)
2017   if(!lua_isuserdata(L,1)) SWIG_fail_arg("love_physfs::tell",1,"love_physfs::pFile &");
2018 
2019   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
2020     SWIG_fail_ptr("tell",1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
2021   }
2022 
2023   result = (int)love_physfs::tell(*arg1);
2024   SWIG_arg=0;
2025   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
2026   return SWIG_arg;
2027 
2028   if(0) SWIG_fail;
2029 
2030 fail:
2031   lua_error(L);
2032   return SWIG_arg;
2033 }
2034 
2035 
_wrap_seek(lua_State * L)2036 static int _wrap_seek(lua_State* L) {
2037   int SWIG_arg = -1;
2038   love_physfs::pFile *arg1 = 0 ;
2039   int arg2 ;
2040   bool result;
2041 
2042   SWIG_check_num_args("love_physfs::seek",2,2)
2043   if(!lua_isuserdata(L,1)) SWIG_fail_arg("love_physfs::seek",1,"love_physfs::pFile &");
2044   if(!lua_isnumber(L,2)) SWIG_fail_arg("love_physfs::seek",2,"int");
2045 
2046   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
2047     SWIG_fail_ptr("seek",1,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
2048   }
2049 
2050   arg2 = (int)lua_tonumber(L, 2);
2051   result = (bool)love_physfs::seek(*arg1,arg2);
2052   SWIG_arg=0;
2053   lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
2054   return SWIG_arg;
2055 
2056   if(0) SWIG_fail;
2057 
2058 fail:
2059   lua_error(L);
2060   return SWIG_arg;
2061 }
2062 
2063 
2064 #ifdef __cplusplus
2065 }
2066 #endif
2067 
2068 static const struct luaL_reg swig_commands[] = {
2069     { "newFile",_wrap_newFile},
2070     { "getWorkingDirectory", _wrap_getWorkingDirectory},
2071     { "exists", _wrap_exists},
2072     { "isDirectory", _wrap_isDirectory},
2073     { "isFile", _wrap_isFile},
2074     { "mkdir", _wrap_mkdir},
2075     { "remove", _wrap_remove},
2076     { "open", _wrap_open},
2077     { "close", _wrap_close},
2078     { "eof", _wrap_eof},
2079     { "tell", _wrap_tell},
2080     { "seek", _wrap_seek},
2081     { "enumerate",love_physfs::enumerate},
2082     { "lines",love_physfs::lines},
2083     { "read",love_physfs::read},
2084     { "write",love_physfs::write},
2085     { "load",love_physfs::load},
2086     { "getSaveDirectory",love_physfs::getSaveDirectory},
2087     {0,0}
2088 };
2089 
2090 static swig_lua_var_info swig_variables[] = {
2091     {0,0,0}
2092 };
2093 
2094 static swig_lua_const_info swig_constants[] = {
2095     {0,0,0,0,0,0}
2096 };
2097 
2098 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2099 
_p_love_physfs__FileTo_p_love__File(void * x,int * newmemory)2100 static void *_p_love_physfs__FileTo_p_love__File(void *x, int *newmemory) {
2101     return (void *)((love::File *)  ((love_physfs::File *) x));
2102 }
2103 static swig_type_info _swigt__p_boost__shared_ptrT_love__File_t = {"_p_boost__shared_ptrT_love__File_t", "love::pFile *|boost::shared_ptr< love::File > *", 0, 0, (void*)0, 0};
2104 static swig_type_info _swigt__p_boost__shared_ptrT_love_physfs__File_t = {"_p_boost__shared_ptrT_love_physfs__File_t", "love_physfs::pFile *|boost::shared_ptr< love_physfs::File > *", 0, 0, (void*)&_wrap_class_boost_shared_ptr_Sl_love_physfs_File_Sg_, 0};
2105 static swig_type_info _swigt__p_love__File = {"_p_love__File", "love::File *", 0, 0, (void*)&_wrap_class_love_File, 0};
2106 static swig_type_info _swigt__p_love_physfs__File = {"_p_love_physfs__File", "love_physfs::File *", 0, 0, (void*)&_wrap_class_love_physfs_File, 0};
2107 
2108 static swig_type_info *swig_type_initial[] = {
2109   &_swigt__p_boost__shared_ptrT_love__File_t,
2110   &_swigt__p_boost__shared_ptrT_love_physfs__File_t,
2111   &_swigt__p_love__File,
2112   &_swigt__p_love_physfs__File,
2113 };
2114 
2115 static swig_cast_info _swigc__p_boost__shared_ptrT_love__File_t[] = {  {&_swigt__p_boost__shared_ptrT_love__File_t, 0, 0, 0},{0, 0, 0, 0}};
2116 static swig_cast_info _swigc__p_boost__shared_ptrT_love_physfs__File_t[] = {  {&_swigt__p_boost__shared_ptrT_love_physfs__File_t, 0, 0, 0},{0, 0, 0, 0}};
2117 static swig_cast_info _swigc__p_love__File[] = {  {&_swigt__p_love__File, 0, 0, 0},  {&_swigt__p_love_physfs__File, _p_love_physfs__FileTo_p_love__File, 0, 0},{0, 0, 0, 0}};
2118 static swig_cast_info _swigc__p_love_physfs__File[] = {  {&_swigt__p_love_physfs__File, 0, 0, 0},{0, 0, 0, 0}};
2119 
2120 static swig_cast_info *swig_cast_initial[] = {
2121   _swigc__p_boost__shared_ptrT_love__File_t,
2122   _swigc__p_boost__shared_ptrT_love_physfs__File_t,
2123   _swigc__p_love__File,
2124   _swigc__p_love_physfs__File,
2125 };
2126 
2127 
2128 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2129 
2130 /* -----------------------------------------------------------------------------
2131  * Type initialization:
2132  * This problem is tough by the requirement that no dynamic
2133  * memory is used. Also, since swig_type_info structures store pointers to
2134  * swig_cast_info structures and swig_cast_info structures store pointers back
2135  * to swig_type_info structures, we need some lookup code at initialization.
2136  * The idea is that swig generates all the structures that are needed.
2137  * The runtime then collects these partially filled structures.
2138  * The SWIG_InitializeModule function takes these initial arrays out of
2139  * swig_module, and does all the lookup, filling in the swig_module.types
2140  * array with the correct data and linking the correct swig_cast_info
2141  * structures together.
2142  *
2143  * The generated swig_type_info structures are assigned staticly to an initial
2144  * array. We just loop through that array, and handle each type individually.
2145  * First we lookup if this type has been already loaded, and if so, use the
2146  * loaded structure instead of the generated one. Then we have to fill in the
2147  * cast linked list. The cast data is initially stored in something like a
2148  * two-dimensional array. Each row corresponds to a type (there are the same
2149  * number of rows as there are in the swig_type_initial array). Each entry in
2150  * a column is one of the swig_cast_info structures for that type.
2151  * The cast_initial array is actually an array of arrays, because each row has
2152  * a variable number of columns. So to actually build the cast linked list,
2153  * we find the array of casts associated with the type, and loop through it
2154  * adding the casts to the list. The one last trick we need to do is making
2155  * sure the type pointer in the swig_cast_info struct is correct.
2156  *
2157  * First off, we lookup the cast->type name to see if it is already loaded.
2158  * There are three cases to handle:
2159  *  1) If the cast->type has already been loaded AND the type we are adding
2160  *     casting info to has not been loaded (it is in this module), THEN we
2161  *     replace the cast->type pointer with the type pointer that has already
2162  *     been loaded.
2163  *  2) If BOTH types (the one we are adding casting info to, and the
2164  *     cast->type) are loaded, THEN the cast info has already been loaded by
2165  *     the previous module so we just ignore it.
2166  *  3) Finally, if cast->type has not already been loaded, then we add that
2167  *     swig_cast_info to the linked list (because the cast->type) pointer will
2168  *     be correct.
2169  * ----------------------------------------------------------------------------- */
2170 
2171 #ifdef __cplusplus
2172 extern "C" {
2173 #if 0
2174 } /* c-mode */
2175 #endif
2176 #endif
2177 
2178 #if 0
2179 #define SWIGRUNTIME_DEBUG
2180 #endif
2181 
2182 
2183 SWIGRUNTIME void
SWIG_InitializeModule(void * clientdata)2184 SWIG_InitializeModule(void *clientdata) {
2185   size_t i;
2186   swig_module_info *module_head, *iter;
2187   int found, init;
2188 
2189   clientdata = clientdata;
2190 
2191   /* check to see if the circular list has been setup, if not, set it up */
2192   if (swig_module.next==0) {
2193     /* Initialize the swig_module */
2194     swig_module.type_initial = swig_type_initial;
2195     swig_module.cast_initial = swig_cast_initial;
2196     swig_module.next = &swig_module;
2197     init = 1;
2198   } else {
2199     init = 0;
2200   }
2201 
2202   /* Try and load any already created modules */
2203   module_head = SWIG_GetModule(clientdata);
2204   if (!module_head) {
2205     /* This is the first module loaded for this interpreter */
2206     /* so set the swig module into the interpreter */
2207     SWIG_SetModule(clientdata, &swig_module);
2208     module_head = &swig_module;
2209   } else {
2210     /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2211     found=0;
2212     iter=module_head;
2213     do {
2214       if (iter==&swig_module) {
2215         found=1;
2216         break;
2217       }
2218       iter=iter->next;
2219     } while (iter!= module_head);
2220 
2221     /* if the is found in the list, then all is done and we may leave */
2222     if (found) return;
2223     /* otherwise we must add out module into the list */
2224     swig_module.next = module_head->next;
2225     module_head->next = &swig_module;
2226   }
2227 
2228   /* When multiple interpeters are used, a module could have already been initialized in
2229      a different interpreter, but not yet have a pointer in this interpreter.
2230      In this case, we do not want to continue adding types... everything should be
2231      set up already */
2232   if (init == 0) return;
2233 
2234   /* Now work on filling in swig_module.types */
2235 #ifdef SWIGRUNTIME_DEBUG
2236   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2237 #endif
2238   for (i = 0; i < swig_module.size; ++i) {
2239     swig_type_info *type = 0;
2240     swig_type_info *ret;
2241     swig_cast_info *cast;
2242 
2243 #ifdef SWIGRUNTIME_DEBUG
2244     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2245 #endif
2246 
2247     /* if there is another module already loaded */
2248     if (swig_module.next != &swig_module) {
2249       type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2250     }
2251     if (type) {
2252       /* Overwrite clientdata field */
2253 #ifdef SWIGRUNTIME_DEBUG
2254       printf("SWIG_InitializeModule: found type %s\n", type->name);
2255 #endif
2256       if (swig_module.type_initial[i]->clientdata) {
2257 	type->clientdata = swig_module.type_initial[i]->clientdata;
2258 #ifdef SWIGRUNTIME_DEBUG
2259       printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2260 #endif
2261       }
2262     } else {
2263       type = swig_module.type_initial[i];
2264     }
2265 
2266     /* Insert casting types */
2267     cast = swig_module.cast_initial[i];
2268     while (cast->type) {
2269 
2270       /* Don't need to add information already in the list */
2271       ret = 0;
2272 #ifdef SWIGRUNTIME_DEBUG
2273       printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2274 #endif
2275       if (swig_module.next != &swig_module) {
2276         ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2277 #ifdef SWIGRUNTIME_DEBUG
2278 	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2279 #endif
2280       }
2281       if (ret) {
2282 	if (type == swig_module.type_initial[i]) {
2283 #ifdef SWIGRUNTIME_DEBUG
2284 	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2285 #endif
2286 	  cast->type = ret;
2287 	  ret = 0;
2288 	} else {
2289 	  /* Check for casting already in the list */
2290 	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2291 #ifdef SWIGRUNTIME_DEBUG
2292 	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2293 #endif
2294 	  if (!ocast) ret = 0;
2295 	}
2296       }
2297 
2298       if (!ret) {
2299 #ifdef SWIGRUNTIME_DEBUG
2300 	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2301 #endif
2302         if (type->cast) {
2303           type->cast->prev = cast;
2304           cast->next = type->cast;
2305         }
2306         type->cast = cast;
2307       }
2308       cast++;
2309     }
2310     /* Set entry in modules->types array equal to the type */
2311     swig_module.types[i] = type;
2312   }
2313   swig_module.types[i] = 0;
2314 
2315 #ifdef SWIGRUNTIME_DEBUG
2316   printf("**** SWIG_InitializeModule: Cast List ******\n");
2317   for (i = 0; i < swig_module.size; ++i) {
2318     int j = 0;
2319     swig_cast_info *cast = swig_module.cast_initial[i];
2320     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2321     while (cast->type) {
2322       printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2323       cast++;
2324       ++j;
2325     }
2326   printf("---- Total casts: %d\n",j);
2327   }
2328   printf("**** SWIG_InitializeModule: Cast List ******\n");
2329 #endif
2330 }
2331 
2332 /* This function will propagate the clientdata field of type to
2333 * any new swig_type_info structures that have been added into the list
2334 * of equivalent types.  It is like calling
2335 * SWIG_TypeClientData(type, clientdata) a second time.
2336 */
2337 SWIGRUNTIME void
SWIG_PropagateClientData(void)2338 SWIG_PropagateClientData(void) {
2339   size_t i;
2340   swig_cast_info *equiv;
2341   static int init_run = 0;
2342 
2343   if (init_run) return;
2344   init_run = 1;
2345 
2346   for (i = 0; i < swig_module.size; i++) {
2347     if (swig_module.types[i]->clientdata) {
2348       equiv = swig_module.types[i]->cast;
2349       while (equiv) {
2350         if (!equiv->converter) {
2351           if (equiv->type && !equiv->type->clientdata)
2352             SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2353         }
2354         equiv = equiv->next;
2355       }
2356     }
2357   }
2358 }
2359 
2360 #ifdef __cplusplus
2361 #if 0
2362 { /* c-mode */
2363 #endif
2364 }
2365 #endif
2366 
2367 
2368 
2369 /* Forward declaration of where the user's %init{} gets inserted */
2370 void SWIG_init_user(lua_State* L );
2371 
2372 #ifdef __cplusplus
2373 extern "C" {
2374 #endif
2375 /* this is the initialization function
2376   added at the very end of the code
2377   the function is always called SWIG_init, but an eariler #define will rename it
2378 */
SWIG_init(lua_State * L)2379 SWIGEXPORT int SWIG_init(lua_State* L)
2380 {
2381   int i;
2382   /* start with global table */
2383   lua_pushvalue(L,LUA_GLOBALSINDEX);
2384   /* SWIG's internal initalisation */
2385   SWIG_InitializeModule((void*)L);
2386   SWIG_PropagateClientData();
2387   /* add a global fn */
2388   SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
2389   SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
2390   /* begin the module (its a table with the same name as the module) */
2391   SWIG_Lua_module_begin(L,SWIG_name);
2392   /* add commands/functions */
2393   for (i = 0; swig_commands[i].name; i++){
2394     SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
2395   }
2396   /* add variables */
2397   for (i = 0; swig_variables[i].name; i++){
2398     SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
2399   }
2400   /* set up base class pointers (the hierachy) */
2401   for (i = 0; swig_types[i]; i++){
2402     if (swig_types[i]->clientdata){
2403       SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
2404     }
2405   }
2406   /* additional registration structs & classes in lua */
2407   for (i = 0; swig_types[i]; i++){
2408     if (swig_types[i]->clientdata){
2409       SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
2410     }
2411   }
2412   /* constants */
2413   SWIG_Lua_InstallConstants(L,swig_constants);
2414   /* invoke user-specific initialization */
2415   SWIG_init_user(L);
2416   /* end module */
2417   lua_pop(L,1);  /* tidy stack (remove module table)*/
2418   lua_pop(L,1);  /* tidy stack (remove global table)*/
2419   return 1;
2420 }
2421 
2422 #ifdef __cplusplus
2423 }
2424 #endif
2425 
2426 
2427 const char* SWIG_LUACODE=
2428   "\n"
2429   "love.filesystem = mod_physfs\n"
2430   "\n"
2431   "-- Contains included files.\n"
2432   "love.filesystem.is_included = {}\n"
2433   "\n"
2434   "function love.filesystem.include(filename)\n"
2435   "	return love.system.include(filename)\n"
2436   "end\n"
2437   "\n"
2438   "function love.filesystem.require(filename)\n"
2439   "	if not love.filesystem.is_included[filename] then\n"
2440   "		love.filesystem.include(filename)\n"
2441   "		love.filesystem.is_included[filename] = true\n"
2442   "	end\n"
2443   "end";
2444 
SWIG_init_user(lua_State * L)2445 void SWIG_init_user(lua_State* L)
2446 {
2447   /* exec Lua code if applicable */
2448   SWIG_Lua_dostring(L,SWIG_LUACODE);
2449 }
2450 
2451 namespace love_physfs
2452 {
__error_index(lua_State * L)2453 	int __error_index(lua_State * L)
2454 	{
2455 		return luaL_error(L, "Attempt to index destroyed object.");
2456 	}
2457 
mod_is_file(lua_State * L,int idx)2458 	bool mod_is_file(lua_State * L, int idx)
2459     {
2460         swig_lua_userdata* usr = 0;
2461         swig_cast_info *cast = 0;
2462         usr=(swig_lua_userdata*)lua_touserdata(L,idx);
2463         if(!usr) return false;
2464         cast=SWIG_TypeCheckStruct(usr->type,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t);
2465         if(cast) return true;
2466         return false;
2467     }
2468 
mod_to_file(lua_State * L,int idx)2469 	boost::shared_ptr<File> mod_to_file(lua_State * L, int idx)
2470     {
2471         love_physfs::pFile * arg;
2472         if(!lua_isuserdata(L,idx)) luaL_error(L, "Error, argument is not userdata.");
2473         if (!SWIG_IsOK(SWIG_ConvertPtr(L,idx,(void**)&arg,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
2474               luaL_error(L, "Error, argument is not type File.");
2475         }
2476         return *arg;
2477     }
2478 
mod_to_file_ptr(lua_State * L,int idx)2479 	boost::shared_ptr<File> * mod_to_file_ptr(lua_State * L, int idx)
2480     {
2481         love_physfs::pFile * arg;
2482         if(!lua_isuserdata(L,idx)) luaL_error(L, "Error, argument is not userdata.");
2483         if (!SWIG_IsOK(SWIG_ConvertPtr(L,idx,(void**)&arg,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,0))){
2484               luaL_error(L, "Error, argument is not type File.");
2485         }
2486         return arg;
2487     }
2488 
mod_push_file(lua_State * L,boost::shared_ptr<File> file)2489 	void mod_push_file(lua_State * L, boost::shared_ptr<File> file)
2490     {
2491         love_physfs::pFile * resultptr = new love_physfs::pFile((love_physfs::pFile &) file);
2492         SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_boost__shared_ptrT_love_physfs__File_t,1);
2493     }
2494 
2495 }
2496 
2497