2134
|
1 /* ----------------------------------------------------------------------------
|
|
2 * This file was automatically generated by SWIG (http://www.swig.org).
|
|
3 * Version 2.0.11
|
|
4 *
|
|
5 * This file is not intended to be easily readable and contains a number of
|
|
6 * coding conventions designed to improve portability and efficiency. Do not make
|
|
7 * changes to this file unless you know what you are doing--modify the SWIG
|
|
8 * interface file instead.
|
|
9 * ----------------------------------------------------------------------------- */
|
|
10
|
|
11 #define SWIGLUA
|
|
12 #define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA
|
|
13 #define SWIG_LUA_MODULE_GLOBAL
|
|
14
|
|
15
|
|
16 #ifdef __cplusplus
|
|
17 /* SwigValueWrapper is described in swig.swg */
|
|
18 template<typename T> class SwigValueWrapper {
|
|
19 struct SwigMovePointer {
|
|
20 T *ptr;
|
|
21 SwigMovePointer(T *p) : ptr(p) { }
|
|
22 ~SwigMovePointer() { delete ptr; }
|
|
23 SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
|
|
24 } pointer;
|
|
25 SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
|
|
26 SwigValueWrapper(const SwigValueWrapper<T>& rhs);
|
|
27 public:
|
|
28 SwigValueWrapper() : pointer(0) { }
|
|
29 SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
|
|
30 operator T&() const { return *pointer.ptr; }
|
|
31 T *operator&() { return pointer.ptr; }
|
|
32 };
|
|
33
|
|
34 template <typename T> T SwigValueInit() {
|
|
35 return T();
|
|
36 }
|
|
37 #endif
|
|
38
|
|
39 /* -----------------------------------------------------------------------------
|
|
40 * This section contains generic SWIG labels for method/variable
|
|
41 * declarations/attributes, and other compiler dependent labels.
|
|
42 * ----------------------------------------------------------------------------- */
|
|
43
|
|
44 /* template workaround for compilers that cannot correctly implement the C++ standard */
|
|
45 #ifndef SWIGTEMPLATEDISAMBIGUATOR
|
|
46 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
|
|
47 # define SWIGTEMPLATEDISAMBIGUATOR template
|
|
48 # elif defined(__HP_aCC)
|
|
49 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
|
|
50 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
|
|
51 # define SWIGTEMPLATEDISAMBIGUATOR template
|
|
52 # else
|
|
53 # define SWIGTEMPLATEDISAMBIGUATOR
|
|
54 # endif
|
|
55 #endif
|
|
56
|
|
57 /* inline attribute */
|
|
58 #ifndef SWIGINLINE
|
|
59 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
|
60 # define SWIGINLINE inline
|
|
61 # else
|
|
62 # define SWIGINLINE
|
|
63 # endif
|
|
64 #endif
|
|
65
|
|
66 /* attribute recognised by some compilers to avoid 'unused' warnings */
|
|
67 #ifndef SWIGUNUSED
|
|
68 # if defined(__GNUC__)
|
|
69 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
|
70 # define SWIGUNUSED __attribute__ ((__unused__))
|
|
71 # else
|
|
72 # define SWIGUNUSED
|
|
73 # endif
|
|
74 # elif defined(__ICC)
|
|
75 # define SWIGUNUSED __attribute__ ((__unused__))
|
|
76 # else
|
|
77 # define SWIGUNUSED
|
|
78 # endif
|
|
79 #endif
|
|
80
|
|
81 #ifndef SWIG_MSC_UNSUPPRESS_4505
|
|
82 # if defined(_MSC_VER)
|
|
83 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
|
|
84 # endif
|
|
85 #endif
|
|
86
|
|
87 #ifndef SWIGUNUSEDPARM
|
|
88 # ifdef __cplusplus
|
|
89 # define SWIGUNUSEDPARM(p)
|
|
90 # else
|
|
91 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
|
|
92 # endif
|
|
93 #endif
|
|
94
|
|
95 /* internal SWIG method */
|
|
96 #ifndef SWIGINTERN
|
|
97 # define SWIGINTERN static SWIGUNUSED
|
|
98 #endif
|
|
99
|
|
100 /* internal inline SWIG method */
|
|
101 #ifndef SWIGINTERNINLINE
|
|
102 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
|
103 #endif
|
|
104
|
|
105 /* exporting methods */
|
|
106 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
|
107 # ifndef GCC_HASCLASSVISIBILITY
|
|
108 # define GCC_HASCLASSVISIBILITY
|
|
109 # endif
|
|
110 #endif
|
|
111
|
|
112 #ifndef SWIGEXPORT
|
|
113 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
114 # if defined(STATIC_LINKED)
|
|
115 # define SWIGEXPORT
|
|
116 # else
|
|
117 # define SWIGEXPORT __declspec(dllexport)
|
|
118 # endif
|
|
119 # else
|
|
120 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
|
121 # define SWIGEXPORT __attribute__ ((visibility("default")))
|
|
122 # else
|
|
123 # define SWIGEXPORT
|
|
124 # endif
|
|
125 # endif
|
|
126 #endif
|
|
127
|
|
128 /* calling conventions for Windows */
|
|
129 #ifndef SWIGSTDCALL
|
|
130 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
131 # define SWIGSTDCALL __stdcall
|
|
132 # else
|
|
133 # define SWIGSTDCALL
|
|
134 # endif
|
|
135 #endif
|
|
136
|
|
137 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
|
138 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
|
139 # define _CRT_SECURE_NO_DEPRECATE
|
|
140 #endif
|
|
141
|
|
142 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
|
|
143 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
|
|
144 # define _SCL_SECURE_NO_DEPRECATE
|
|
145 #endif
|
|
146
|
|
147
|
|
148 /* -----------------------------------------------------------------------------
|
|
149 * swigrun.swg
|
|
150 *
|
|
151 * This file contains generic C API SWIG runtime support for pointer
|
|
152 * type checking.
|
|
153 * ----------------------------------------------------------------------------- */
|
|
154
|
|
155 /* This should only be incremented when either the layout of swig_type_info changes,
|
|
156 or for whatever reason, the runtime changes incompatibly */
|
|
157 #define SWIG_RUNTIME_VERSION "4"
|
|
158
|
|
159 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
|
|
160 #ifdef SWIG_TYPE_TABLE
|
|
161 # define SWIG_QUOTE_STRING(x) #x
|
|
162 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
|
|
163 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
|
|
164 #else
|
|
165 # define SWIG_TYPE_TABLE_NAME
|
|
166 #endif
|
|
167
|
|
168 /*
|
|
169 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
|
|
170 creating a static or dynamic library from the SWIG runtime code.
|
|
171 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
|
|
172
|
|
173 But only do this if strictly necessary, ie, if you have problems
|
|
174 with your compiler or suchlike.
|
|
175 */
|
|
176
|
|
177 #ifndef SWIGRUNTIME
|
|
178 # define SWIGRUNTIME SWIGINTERN
|
|
179 #endif
|
|
180
|
|
181 #ifndef SWIGRUNTIMEINLINE
|
|
182 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
|
|
183 #endif
|
|
184
|
|
185 /* Generic buffer size */
|
|
186 #ifndef SWIG_BUFFER_SIZE
|
|
187 # define SWIG_BUFFER_SIZE 1024
|
|
188 #endif
|
|
189
|
|
190 /* Flags for pointer conversions */
|
|
191 #define SWIG_POINTER_DISOWN 0x1
|
|
192 #define SWIG_CAST_NEW_MEMORY 0x2
|
|
193
|
|
194 /* Flags for new pointer objects */
|
|
195 #define SWIG_POINTER_OWN 0x1
|
|
196
|
|
197
|
|
198 /*
|
|
199 Flags/methods for returning states.
|
|
200
|
|
201 The SWIG conversion methods, as ConvertPtr, return an integer
|
|
202 that tells if the conversion was successful or not. And if not,
|
|
203 an error code can be returned (see swigerrors.swg for the codes).
|
|
204
|
|
205 Use the following macros/flags to set or process the returning
|
|
206 states.
|
|
207
|
|
208 In old versions of SWIG, code such as the following was usually written:
|
|
209
|
|
210 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
|
|
211 // success code
|
|
212 } else {
|
|
213 //fail code
|
|
214 }
|
|
215
|
|
216 Now you can be more explicit:
|
|
217
|
|
218 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
|
|
219 if (SWIG_IsOK(res)) {
|
|
220 // success code
|
|
221 } else {
|
|
222 // fail code
|
|
223 }
|
|
224
|
|
225 which is the same really, but now you can also do
|
|
226
|
|
227 Type *ptr;
|
|
228 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
|
|
229 if (SWIG_IsOK(res)) {
|
|
230 // success code
|
|
231 if (SWIG_IsNewObj(res) {
|
|
232 ...
|
|
233 delete *ptr;
|
|
234 } else {
|
|
235 ...
|
|
236 }
|
|
237 } else {
|
|
238 // fail code
|
|
239 }
|
|
240
|
|
241 I.e., now SWIG_ConvertPtr can return new objects and you can
|
|
242 identify the case and take care of the deallocation. Of course that
|
|
243 also requires SWIG_ConvertPtr to return new result values, such as
|
|
244
|
|
245 int SWIG_ConvertPtr(obj, ptr,...) {
|
|
246 if (<obj is ok>) {
|
|
247 if (<need new object>) {
|
|
248 *ptr = <ptr to new allocated object>;
|
|
249 return SWIG_NEWOBJ;
|
|
250 } else {
|
|
251 *ptr = <ptr to old object>;
|
|
252 return SWIG_OLDOBJ;
|
|
253 }
|
|
254 } else {
|
|
255 return SWIG_BADOBJ;
|
|
256 }
|
|
257 }
|
|
258
|
|
259 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
|
|
260 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
|
|
261 SWIG errors code.
|
|
262
|
|
263 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
|
|
264 allows to return the 'cast rank', for example, if you have this
|
|
265
|
|
266 int food(double)
|
|
267 int fooi(int);
|
|
268
|
|
269 and you call
|
|
270
|
|
271 food(1) // cast rank '1' (1 -> 1.0)
|
|
272 fooi(1) // cast rank '0'
|
|
273
|
|
274 just use the SWIG_AddCast()/SWIG_CheckState()
|
|
275 */
|
|
276
|
|
277 #define SWIG_OK (0)
|
|
278 #define SWIG_ERROR (-1)
|
|
279 #define SWIG_IsOK(r) (r >= 0)
|
|
280 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
|
|
281
|
|
282 /* The CastRankLimit says how many bits are used for the cast rank */
|
|
283 #define SWIG_CASTRANKLIMIT (1 << 8)
|
|
284 /* The NewMask denotes the object was created (using new/malloc) */
|
|
285 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
|
|
286 /* The TmpMask is for in/out typemaps that use temporal objects */
|
|
287 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
|
|
288 /* Simple returning values */
|
|
289 #define SWIG_BADOBJ (SWIG_ERROR)
|
|
290 #define SWIG_OLDOBJ (SWIG_OK)
|
|
291 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
|
|
292 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
|
|
293 /* Check, add and del mask methods */
|
|
294 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
|
|
295 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
|
|
296 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
|
|
297 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
|
|
298 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
|
|
299 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
|
|
300
|
|
301 /* Cast-Rank Mode */
|
|
302 #if defined(SWIG_CASTRANK_MODE)
|
|
303 # ifndef SWIG_TypeRank
|
|
304 # define SWIG_TypeRank unsigned long
|
|
305 # endif
|
|
306 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
|
|
307 # define SWIG_MAXCASTRANK (2)
|
|
308 # endif
|
|
309 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
|
|
310 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
|
|
311 SWIGINTERNINLINE int SWIG_AddCast(int r) {
|
|
312 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
|
|
313 }
|
|
314 SWIGINTERNINLINE int SWIG_CheckState(int r) {
|
|
315 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
|
|
316 }
|
|
317 #else /* no cast-rank mode */
|
|
318 # define SWIG_AddCast(r) (r)
|
|
319 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
|
|
320 #endif
|
|
321
|
|
322
|
|
323 #include <string.h>
|
|
324
|
|
325 #ifdef __cplusplus
|
|
326 extern "C" {
|
|
327 #endif
|
|
328
|
|
329 typedef void *(*swig_converter_func)(void *, int *);
|
|
330 typedef struct swig_type_info *(*swig_dycast_func)(void **);
|
|
331
|
|
332 /* Structure to store information on one type */
|
|
333 typedef struct swig_type_info {
|
|
334 const char *name; /* mangled name of this type */
|
|
335 const char *str; /* human readable name of this type */
|
|
336 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
|
|
337 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
|
|
338 void *clientdata; /* language specific type data */
|
|
339 int owndata; /* flag if the structure owns the clientdata */
|
|
340 } swig_type_info;
|
|
341
|
|
342 /* Structure to store a type and conversion function used for casting */
|
|
343 typedef struct swig_cast_info {
|
|
344 swig_type_info *type; /* pointer to type that is equivalent to this type */
|
|
345 swig_converter_func converter; /* function to cast the void pointers */
|
|
346 struct swig_cast_info *next; /* pointer to next cast in linked list */
|
|
347 struct swig_cast_info *prev; /* pointer to the previous cast */
|
|
348 } swig_cast_info;
|
|
349
|
|
350 /* Structure used to store module information
|
|
351 * Each module generates one structure like this, and the runtime collects
|
|
352 * all of these structures and stores them in a circularly linked list.*/
|
|
353 typedef struct swig_module_info {
|
|
354 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
|
|
355 size_t size; /* Number of types in this module */
|
|
356 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
|
|
357 swig_type_info **type_initial; /* Array of initially generated type structures */
|
|
358 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
|
|
359 void *clientdata; /* Language specific module data */
|
|
360 } swig_module_info;
|
|
361
|
|
362 /*
|
|
363 Compare two type names skipping the space characters, therefore
|
|
364 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
|
|
365
|
|
366 Return 0 when the two name types are equivalent, as in
|
|
367 strncmp, but skipping ' '.
|
|
368 */
|
|
369 SWIGRUNTIME int
|
|
370 SWIG_TypeNameComp(const char *f1, const char *l1,
|
|
371 const char *f2, const char *l2) {
|
|
372 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
|
|
373 while ((*f1 == ' ') && (f1 != l1)) ++f1;
|
|
374 while ((*f2 == ' ') && (f2 != l2)) ++f2;
|
|
375 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
|
|
376 }
|
|
377 return (int)((l1 - f1) - (l2 - f2));
|
|
378 }
|
|
379
|
|
380 /*
|
|
381 Check type equivalence in a name list like <name1>|<name2>|...
|
|
382 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
|
|
383 */
|
|
384 SWIGRUNTIME int
|
|
385 SWIG_TypeCmp(const char *nb, const char *tb) {
|
|
386 int equiv = 1;
|
|
387 const char* te = tb + strlen(tb);
|
|
388 const char* ne = nb;
|
|
389 while (equiv != 0 && *ne) {
|
|
390 for (nb = ne; *ne; ++ne) {
|
|
391 if (*ne == '|') break;
|
|
392 }
|
|
393 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
|
|
394 if (*ne) ++ne;
|
|
395 }
|
|
396 return equiv;
|
|
397 }
|
|
398
|
|
399 /*
|
|
400 Check type equivalence in a name list like <name1>|<name2>|...
|
|
401 Return 0 if not equal, 1 if equal
|
|
402 */
|
|
403 SWIGRUNTIME int
|
|
404 SWIG_TypeEquiv(const char *nb, const char *tb) {
|
|
405 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
|
|
406 }
|
|
407
|
|
408 /*
|
|
409 Check the typename
|
|
410 */
|
|
411 SWIGRUNTIME swig_cast_info *
|
|
412 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
|
|
413 if (ty) {
|
|
414 swig_cast_info *iter = ty->cast;
|
|
415 while (iter) {
|
|
416 if (strcmp(iter->type->name, c) == 0) {
|
|
417 if (iter == ty->cast)
|
|
418 return iter;
|
|
419 /* Move iter to the top of the linked list */
|
|
420 iter->prev->next = iter->next;
|
|
421 if (iter->next)
|
|
422 iter->next->prev = iter->prev;
|
|
423 iter->next = ty->cast;
|
|
424 iter->prev = 0;
|
|
425 if (ty->cast) ty->cast->prev = iter;
|
|
426 ty->cast = iter;
|
|
427 return iter;
|
|
428 }
|
|
429 iter = iter->next;
|
|
430 }
|
|
431 }
|
|
432 return 0;
|
|
433 }
|
|
434
|
|
435 /*
|
|
436 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
|
|
437 */
|
|
438 SWIGRUNTIME swig_cast_info *
|
|
439 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
|
|
440 if (ty) {
|
|
441 swig_cast_info *iter = ty->cast;
|
|
442 while (iter) {
|
|
443 if (iter->type == from) {
|
|
444 if (iter == ty->cast)
|
|
445 return iter;
|
|
446 /* Move iter to the top of the linked list */
|
|
447 iter->prev->next = iter->next;
|
|
448 if (iter->next)
|
|
449 iter->next->prev = iter->prev;
|
|
450 iter->next = ty->cast;
|
|
451 iter->prev = 0;
|
|
452 if (ty->cast) ty->cast->prev = iter;
|
|
453 ty->cast = iter;
|
|
454 return iter;
|
|
455 }
|
|
456 iter = iter->next;
|
|
457 }
|
|
458 }
|
|
459 return 0;
|
|
460 }
|
|
461
|
|
462 /*
|
|
463 Cast a pointer up an inheritance hierarchy
|
|
464 */
|
|
465 SWIGRUNTIMEINLINE void *
|
|
466 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
|
|
467 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
|
|
468 }
|
|
469
|
|
470 /*
|
|
471 Dynamic pointer casting. Down an inheritance hierarchy
|
|
472 */
|
|
473 SWIGRUNTIME swig_type_info *
|
|
474 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
|
|
475 swig_type_info *lastty = ty;
|
|
476 if (!ty || !ty->dcast) return ty;
|
|
477 while (ty && (ty->dcast)) {
|
|
478 ty = (*ty->dcast)(ptr);
|
|
479 if (ty) lastty = ty;
|
|
480 }
|
|
481 return lastty;
|
|
482 }
|
|
483
|
|
484 /*
|
|
485 Return the name associated with this type
|
|
486 */
|
|
487 SWIGRUNTIMEINLINE const char *
|
|
488 SWIG_TypeName(const swig_type_info *ty) {
|
|
489 return ty->name;
|
|
490 }
|
|
491
|
|
492 /*
|
|
493 Return the pretty name associated with this type,
|
|
494 that is an unmangled type name in a form presentable to the user.
|
|
495 */
|
|
496 SWIGRUNTIME const char *
|
|
497 SWIG_TypePrettyName(const swig_type_info *type) {
|
|
498 /* The "str" field contains the equivalent pretty names of the
|
|
499 type, separated by vertical-bar characters. We choose
|
|
500 to print the last name, as it is often (?) the most
|
|
501 specific. */
|
|
502 if (!type) return NULL;
|
|
503 if (type->str != NULL) {
|
|
504 const char *last_name = type->str;
|
|
505 const char *s;
|
|
506 for (s = type->str; *s; s++)
|
|
507 if (*s == '|') last_name = s+1;
|
|
508 return last_name;
|
|
509 }
|
|
510 else
|
|
511 return type->name;
|
|
512 }
|
|
513
|
|
514 /*
|
|
515 Set the clientdata field for a type
|
|
516 */
|
|
517 SWIGRUNTIME void
|
|
518 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
|
519 swig_cast_info *cast = ti->cast;
|
|
520 /* if (ti->clientdata == clientdata) return; */
|
|
521 ti->clientdata = clientdata;
|
|
522
|
|
523 while (cast) {
|
|
524 if (!cast->converter) {
|
|
525 swig_type_info *tc = cast->type;
|
|
526 if (!tc->clientdata) {
|
|
527 SWIG_TypeClientData(tc, clientdata);
|
|
528 }
|
|
529 }
|
|
530 cast = cast->next;
|
|
531 }
|
|
532 }
|
|
533 SWIGRUNTIME void
|
|
534 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
|
|
535 SWIG_TypeClientData(ti, clientdata);
|
|
536 ti->owndata = 1;
|
|
537 }
|
|
538
|
|
539 /*
|
|
540 Search for a swig_type_info structure only by mangled name
|
|
541 Search is a O(log #types)
|
|
542
|
|
543 We start searching at module start, and finish searching when start == end.
|
|
544 Note: if start == end at the beginning of the function, we go all the way around
|
|
545 the circular list.
|
|
546 */
|
|
547 SWIGRUNTIME swig_type_info *
|
|
548 SWIG_MangledTypeQueryModule(swig_module_info *start,
|
|
549 swig_module_info *end,
|
|
550 const char *name) {
|
|
551 swig_module_info *iter = start;
|
|
552 do {
|
|
553 if (iter->size) {
|
|
554 register size_t l = 0;
|
|
555 register size_t r = iter->size - 1;
|
|
556 do {
|
|
557 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
|
|
558 register size_t i = (l + r) >> 1;
|
|
559 const char *iname = iter->types[i]->name;
|
|
560 if (iname) {
|
|
561 register int compare = strcmp(name, iname);
|
|
562 if (compare == 0) {
|
|
563 return iter->types[i];
|
|
564 } else if (compare < 0) {
|
|
565 if (i) {
|
|
566 r = i - 1;
|
|
567 } else {
|
|
568 break;
|
|
569 }
|
|
570 } else if (compare > 0) {
|
|
571 l = i + 1;
|
|
572 }
|
|
573 } else {
|
|
574 break; /* should never happen */
|
|
575 }
|
|
576 } while (l <= r);
|
|
577 }
|
|
578 iter = iter->next;
|
|
579 } while (iter != end);
|
|
580 return 0;
|
|
581 }
|
|
582
|
|
583 /*
|
|
584 Search for a swig_type_info structure for either a mangled name or a human readable name.
|
|
585 It first searches the mangled names of the types, which is a O(log #types)
|
|
586 If a type is not found it then searches the human readable names, which is O(#types).
|
|
587
|
|
588 We start searching at module start, and finish searching when start == end.
|
|
589 Note: if start == end at the beginning of the function, we go all the way around
|
|
590 the circular list.
|
|
591 */
|
|
592 SWIGRUNTIME swig_type_info *
|
|
593 SWIG_TypeQueryModule(swig_module_info *start,
|
|
594 swig_module_info *end,
|
|
595 const char *name) {
|
|
596 /* STEP 1: Search the name field using binary search */
|
|
597 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
|
|
598 if (ret) {
|
|
599 return ret;
|
|
600 } else {
|
|
601 /* STEP 2: If the type hasn't been found, do a complete search
|
|
602 of the str field (the human readable name) */
|
|
603 swig_module_info *iter = start;
|
|
604 do {
|
|
605 register size_t i = 0;
|
|
606 for (; i < iter->size; ++i) {
|
|
607 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
|
|
608 return iter->types[i];
|
|
609 }
|
|
610 iter = iter->next;
|
|
611 } while (iter != end);
|
|
612 }
|
|
613
|
|
614 /* neither found a match */
|
|
615 return 0;
|
|
616 }
|
|
617
|
|
618 /*
|
|
619 Pack binary data into a string
|
|
620 */
|
|
621 SWIGRUNTIME char *
|
|
622 SWIG_PackData(char *c, void *ptr, size_t sz) {
|
|
623 static const char hex[17] = "0123456789abcdef";
|
|
624 register const unsigned char *u = (unsigned char *) ptr;
|
|
625 register const unsigned char *eu = u + sz;
|
|
626 for (; u != eu; ++u) {
|
|
627 register unsigned char uu = *u;
|
|
628 *(c++) = hex[(uu & 0xf0) >> 4];
|
|
629 *(c++) = hex[uu & 0xf];
|
|
630 }
|
|
631 return c;
|
|
632 }
|
|
633
|
|
634 /*
|
|
635 Unpack binary data from a string
|
|
636 */
|
|
637 SWIGRUNTIME const char *
|
|
638 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|
639 register unsigned char *u = (unsigned char *) ptr;
|
|
640 register const unsigned char *eu = u + sz;
|
|
641 for (; u != eu; ++u) {
|
|
642 register char d = *(c++);
|
|
643 register unsigned char uu;
|
|
644 if ((d >= '0') && (d <= '9'))
|
|
645 uu = ((d - '0') << 4);
|
|
646 else if ((d >= 'a') && (d <= 'f'))
|
|
647 uu = ((d - ('a'-10)) << 4);
|
|
648 else
|
|
649 return (char *) 0;
|
|
650 d = *(c++);
|
|
651 if ((d >= '0') && (d <= '9'))
|
|
652 uu |= (d - '0');
|
|
653 else if ((d >= 'a') && (d <= 'f'))
|
|
654 uu |= (d - ('a'-10));
|
|
655 else
|
|
656 return (char *) 0;
|
|
657 *u = uu;
|
|
658 }
|
|
659 return c;
|
|
660 }
|
|
661
|
|
662 /*
|
|
663 Pack 'void *' into a string buffer.
|
|
664 */
|
|
665 SWIGRUNTIME char *
|
|
666 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
|
|
667 char *r = buff;
|
|
668 if ((2*sizeof(void *) + 2) > bsz) return 0;
|
|
669 *(r++) = '_';
|
|
670 r = SWIG_PackData(r,&ptr,sizeof(void *));
|
|
671 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
|
|
672 strcpy(r,name);
|
|
673 return buff;
|
|
674 }
|
|
675
|
|
676 SWIGRUNTIME const char *
|
|
677 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
|
|
678 if (*c != '_') {
|
|
679 if (strcmp(c,"NULL") == 0) {
|
|
680 *ptr = (void *) 0;
|
|
681 return name;
|
|
682 } else {
|
|
683 return 0;
|
|
684 }
|
|
685 }
|
|
686 return SWIG_UnpackData(++c,ptr,sizeof(void *));
|
|
687 }
|
|
688
|
|
689 SWIGRUNTIME char *
|
|
690 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
|
|
691 char *r = buff;
|
|
692 size_t lname = (name ? strlen(name) : 0);
|
|
693 if ((2*sz + 2 + lname) > bsz) return 0;
|
|
694 *(r++) = '_';
|
|
695 r = SWIG_PackData(r,ptr,sz);
|
|
696 if (lname) {
|
|
697 strncpy(r,name,lname+1);
|
|
698 } else {
|
|
699 *r = 0;
|
|
700 }
|
|
701 return buff;
|
|
702 }
|
|
703
|
|
704 SWIGRUNTIME const char *
|
|
705 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|
706 if (*c != '_') {
|
|
707 if (strcmp(c,"NULL") == 0) {
|
|
708 memset(ptr,0,sz);
|
|
709 return name;
|
|
710 } else {
|
|
711 return 0;
|
|
712 }
|
|
713 }
|
|
714 return SWIG_UnpackData(++c,ptr,sz);
|
|
715 }
|
|
716
|
|
717 #ifdef __cplusplus
|
|
718 }
|
|
719 #endif
|
|
720
|
|
721 /* -----------------------------------------------------------------------------
|
|
722 * luarun.swg
|
|
723 *
|
|
724 * This file contains the runtime support for Lua modules
|
|
725 * and includes code for managing global variables and pointer
|
|
726 * type checking.
|
|
727 * ----------------------------------------------------------------------------- */
|
|
728
|
|
729 #include "lib/lua/lua.h"
|
|
730 #ifdef __cplusplus
|
|
731 extern "C" {
|
|
732 #endif
|
|
733
|
|
734 //#include "lua.h"
|
|
735 //#include "lauxlib.h"
|
|
736 #include <stdlib.h> /* for malloc */
|
|
737 #include <assert.h> /* for a few sanity tests */
|
|
738
|
|
739 /* -----------------------------------------------------------------------------
|
|
740 * Lua flavors
|
|
741 * ----------------------------------------------------------------------------- */
|
|
742
|
|
743 #define SWIG_LUA_FLAVOR_LUA 1
|
|
744 #define SWIG_LUA_FLAVOR_ELUA 2
|
|
745 #define SWIG_LUA_FLAVOR_ELUAC 3
|
|
746
|
|
747 #if !defined(SWIG_LUA_TARGET)
|
|
748 # error SWIG_LUA_TARGET not defined
|
|
749 #endif
|
|
750
|
|
751 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
|
|
752 # define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
|
|
753 # define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
|
|
754 # define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
|
|
755 # define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
|
|
756 #else /* SWIG_LUA_FLAVOR_LUA */
|
|
757 # define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
|
|
758 # define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
|
|
759 # define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
|
|
760 # define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
|
|
761 #endif
|
|
762
|
|
763 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
|
|
764 # define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
|
|
765 # define LSTRVAL LRO_STRVAL
|
|
766 #endif
|
|
767
|
|
768 /* -----------------------------------------------------------------------------
|
|
769 * compatibility defines
|
|
770 * ----------------------------------------------------------------------------- */
|
|
771
|
|
772 /* History of Lua C API length functions: In Lua 5.0 (and before?)
|
|
773 there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen",
|
|
774 but a compatibility define of "lua_strlen" was added. In Lua 5.2,
|
|
775 this function was again renamed, to "lua_rawlen" (to emphasize that
|
|
776 it doesn't call the "__len" metamethod), and the compatibility
|
|
777 define of lua_strlen was removed. All SWIG uses have been updated
|
|
778 to "lua_rawlen", and we add our own defines of that here for older
|
|
779 versions of Lua. */
|
|
780 #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
|
|
781 # define lua_rawlen lua_strlen
|
|
782 #elif LUA_VERSION_NUM == 501
|
|
783 # define lua_rawlen lua_objlen
|
|
784 #endif
|
|
785
|
|
786
|
|
787 /* lua_pushglobaltable is the recommended "future-proof" way to get
|
|
788 the global table for Lua 5.2 and later. Here we define
|
|
789 lua_pushglobaltable ourselves for Lua versions before 5.2. */
|
|
790 #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
|
|
791 # define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
|
|
792 #endif
|
|
793
|
|
794
|
|
795 /* --------------------------------------------------------------------------
|
|
796 * Helper functions for error handling
|
|
797 * -------------------------------------------------------------------------- */
|
|
798
|
|
799 /* Push the string STR on the Lua stack, like lua_pushstring, but
|
|
800 prefixed with the the location of the innermost Lua call-point
|
|
801 (as formated by luaL_where). */
|
|
802 SWIGRUNTIME void
|
|
803 SWIG_Lua_pusherrstring (lua_State *L, const char *str)
|
|
804 {
|
|
805 luaL_where (L, 1);
|
|
806 lua_pushstring (L, str);
|
|
807 lua_concat (L, 2);
|
|
808 }
|
|
809
|
|
810 /* Push a formatted string generated from FMT and following args on
|
|
811 the Lua stack, like lua_pushfstring, but prefixed with the the
|
|
812 location of the innermost Lua call-point (as formated by luaL_where). */
|
|
813 SWIGRUNTIME void
|
|
814 SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
|
|
815 {
|
|
816 va_list argp;
|
|
817 va_start(argp, fmt);
|
|
818 luaL_where(L, 1);
|
|
819 lua_pushvfstring(L, fmt, argp);
|
|
820 va_end(argp);
|
|
821 lua_concat(L, 2);
|
|
822 }
|
|
823
|
|
824
|
|
825 /* -----------------------------------------------------------------------------
|
|
826 * global swig types
|
|
827 * ----------------------------------------------------------------------------- */
|
|
828 /* Constant table */
|
|
829 #define SWIG_LUA_INT 1
|
|
830 #define SWIG_LUA_FLOAT 2
|
|
831 #define SWIG_LUA_STRING 3
|
|
832 #define SWIG_LUA_POINTER 4
|
|
833 #define SWIG_LUA_BINARY 5
|
|
834 #define SWIG_LUA_CHAR 6
|
|
835
|
|
836 /* Structure for variable linking table */
|
|
837 typedef struct {
|
|
838 const char *name;
|
|
839 lua_CFunction get;
|
|
840 lua_CFunction set;
|
|
841 } swig_lua_var_info;
|
|
842
|
|
843 /* Constant information structure */
|
|
844 typedef struct {
|
|
845 int type;
|
|
846 char *name;
|
|
847 long lvalue;
|
|
848 double dvalue;
|
|
849 void *pvalue;
|
|
850 swig_type_info **ptype;
|
|
851 } swig_lua_const_info;
|
|
852
|
|
853 typedef struct {
|
|
854 const char *name;
|
|
855 lua_CFunction method;
|
|
856 } swig_lua_method;
|
|
857
|
|
858 typedef struct {
|
|
859 const char *name;
|
|
860 lua_CFunction getmethod;
|
|
861 lua_CFunction setmethod;
|
|
862 } swig_lua_attribute;
|
|
863
|
|
864 // Can be used to create namespaces. Currently used to
|
|
865 // wrap class static methods/variables/constants
|
|
866 typedef struct {
|
|
867 const char *name;
|
|
868 swig_lua_method *ns_methods;
|
|
869 swig_lua_attribute *ns_attributes;
|
|
870 swig_lua_const_info *ns_constants;
|
|
871 } swig_lua_namespace;
|
|
872
|
|
873 typedef struct swig_lua_class {
|
|
874 const char *name;
|
|
875 swig_type_info **type;
|
|
876 lua_CFunction constructor;
|
|
877 void (*destructor)(void *);
|
|
878 swig_lua_method *methods;
|
|
879 swig_lua_attribute *attributes;
|
|
880 swig_lua_namespace cls_static;
|
|
881 struct swig_lua_class **bases;
|
|
882 const char **base_names;
|
|
883 } swig_lua_class;
|
|
884
|
|
885 /* this is the struct for wrapping all pointers in SwigLua
|
|
886 */
|
|
887 typedef struct {
|
|
888 swig_type_info *type;
|
|
889 int own; /* 1 if owned & must be destroyed */
|
|
890 void *ptr;
|
|
891 } swig_lua_userdata;
|
|
892
|
|
893 /* this is the struct for wrapping arbitrary packed binary data
|
|
894 (currently it is only used for member function pointers)
|
|
895 the data ordering is similar to swig_lua_userdata, but it is currently not possible
|
|
896 to tell the two structures apart within SWIG, other than by looking at the type
|
|
897 */
|
|
898 typedef struct {
|
|
899 swig_type_info *type;
|
|
900 int own; /* 1 if owned & must be destroyed */
|
|
901 char data[1]; /* arbitary amount of data */
|
|
902 } swig_lua_rawdata;
|
|
903
|
|
904 /* Common SWIG API */
|
|
905 #define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
|
|
906 #define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
|
|
907 #define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
|
|
908 /* for C++ member pointers, ie, member methods */
|
|
909 #define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
|
|
910 #define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type)
|
|
911
|
|
912 /* Runtime API */
|
|
913 #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
|
|
914 #define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
|
|
915 #define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
|
|
916
|
|
917 /* Contract support */
|
|
918 #define SWIG_contract_assert(expr, msg) \
|
|
919 if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else
|
|
920
|
|
921
|
|
922 /* helper #defines */
|
|
923 #define SWIG_fail {goto fail;}
|
|
924 #define SWIG_fail_arg(func_name,argnum,type) \
|
|
925 {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
|
|
926 func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
|
|
927 goto fail;}
|
|
928 #define SWIG_fail_ptr(func_name,argnum,type) \
|
|
929 SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
|
|
930 #define SWIG_check_num_args(func_name,a,b) \
|
|
931 if (lua_gettop(L)<a || lua_gettop(L)>b) \
|
|
932 {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
|
|
933 goto fail;}
|
|
934
|
|
935
|
|
936 #define SWIG_Lua_get_table(L,n) \
|
|
937 (lua_pushstring(L, n), lua_rawget(L,-2))
|
|
938
|
|
939 #define SWIG_Lua_add_function(L,n,f) \
|
|
940 (lua_pushstring(L, n), \
|
|
941 lua_pushcfunction(L, f), \
|
|
942 lua_rawset(L,-3))
|
|
943
|
|
944 /* special helper for allowing 'nil' for usertypes */
|
|
945 #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
|
|
946
|
|
947 #ifdef __cplusplus
|
|
948 /* Special helper for member function pointers
|
|
949 it gets the address, casts it, then dereferences it */
|
|
950 //#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a)))
|
|
951 #endif
|
|
952
|
|
953 /* storing/access of swig_module_info */
|
|
954 SWIGRUNTIME swig_module_info *
|
|
955 SWIG_Lua_GetModule(lua_State* L) {
|
|
956 swig_module_info *ret = 0;
|
|
957 lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
|
958 lua_rawget(L,LUA_REGISTRYINDEX);
|
|
959 if (lua_islightuserdata(L,-1))
|
|
960 ret=(swig_module_info*)lua_touserdata(L,-1);
|
|
961 lua_pop(L,1); /* tidy */
|
|
962 return ret;
|
|
963 }
|
|
964
|
|
965 SWIGRUNTIME void
|
|
966 SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) {
|
|
967 /* add this all into the Lua registry: */
|
|
968 lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
|
|
969 lua_pushlightuserdata(L,(void*)module);
|
|
970 lua_rawset(L,LUA_REGISTRYINDEX);
|
|
971 }
|
|
972
|
|
973 /* -----------------------------------------------------------------------------
|
|
974 * global variable support code: modules
|
|
975 * ----------------------------------------------------------------------------- */
|
|
976
|
|
977 /* this function is called when trying to set an immutable.
|
|
978 default action is to print an error.
|
|
979 This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
|
|
980 SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L)
|
|
981 {
|
|
982 /* there should be 1 param passed in: the new value */
|
|
983 #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
|
|
984 lua_pop(L,1); /* remove it */
|
|
985 luaL_error(L,"This variable is immutable");
|
|
986 #endif
|
|
987 return 0; /* should not return anything */
|
|
988 }
|
|
989
|
|
990 /* the module.get method used for getting linked data */
|
|
991 SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
|
|
992 {
|
|
993 /* there should be 2 params passed in
|
|
994 (1) table (not the meta table)
|
|
995 (2) string name of the attribute
|
|
996 printf("SWIG_Lua_module_get %p(%s) '%s'\n",
|
|
997 lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
|
|
998 lua_tostring(L,2));
|
|
999 */
|
|
1000 /* get the metatable */
|
|
1001 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
|
1002 assert(lua_isrotable(L,1)); /* just in case */
|
|
1003 #else
|
|
1004 assert(lua_istable(L,1)); /* default Lua action */
|
|
1005 #endif
|
|
1006 lua_getmetatable(L,1); /* get the metatable */
|
|
1007 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
|
1008 assert(lua_isrotable(L,-1)); /* just in case */
|
|
1009 #else
|
|
1010 assert(lua_istable(L,-1));
|
|
1011 #endif
|
|
1012 SWIG_Lua_get_table(L,".get"); /* get the .get table */
|
|
1013 lua_remove(L,3); /* remove metatable */
|
|
1014 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
|
1015 if (lua_isrotable(L,-1))
|
|
1016 #else
|
|
1017 if (lua_istable(L,-1))
|
|
1018 #endif
|
|
1019 {
|
|
1020 /* look for the key in the .get table */
|
|
1021 lua_pushvalue(L,2); /* key */
|
|
1022 lua_rawget(L,-2);
|
|
1023 lua_remove(L,3); /* remove .get */
|
|
1024 if (lua_iscfunction(L,-1))
|
|
1025 { /* found it so call the fn & return its value */
|
|
1026 lua_call(L,0,1);
|
|
1027 return 1;
|
|
1028 }
|
|
1029 lua_pop(L,1); /* remove the top */
|
|
1030 }
|
|
1031 lua_pop(L,1); /* remove the .get */
|
|
1032 lua_pushnil(L); /* return a nil */
|
|
1033 return 1;
|
|
1034 }
|
|
1035
|
|
1036 /* the module.set method used for setting linked data */
|
|
1037 SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
|
|
1038 {
|
|
1039 /* there should be 3 params passed in
|
|
1040 (1) table (not the meta table)
|
|
1041 (2) string name of the attribute
|
|
1042 (3) any for the new value
|
|
1043 */
|
|
1044 /* get the metatable */
|
|
1045 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
|
1046 assert(lua_isrotable(L,1)); /* just in case */
|
|
1047 #else
|
|
1048 assert(lua_istable(L,1)); /* default Lua action */
|
|
1049 #endif
|
|
1050 lua_getmetatable(L,1); /* get the metatable */
|
|
1051 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
|
1052 assert(lua_isrotable(L,-1)); /* just in case */
|
|
1053 #else
|
|
1054 assert(lua_istable(L,-1));
|
|
1055 #endif
|
|
1056 SWIG_Lua_get_table(L,".set"); /* get the .set table */
|
|
1057 lua_remove(L,4); /* remove metatable */
|
|
1058 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
|
1059 if (lua_isrotable(L,-1))
|
|
1060 #else
|
|
1061 if (lua_istable(L,-1))
|
|
1062 #endif
|
|
1063 {
|
|
1064 /* look for the key in the .set table */
|
|
1065 lua_pushvalue(L,2); /* key */
|
|
1066 lua_rawget(L,-2);
|
|
1067 lua_remove(L,4); /* remove .set */
|
|
1068 if (lua_iscfunction(L,-1))
|
|
1069 { /* found it so call the fn & return its value */
|
|
1070 lua_pushvalue(L,3); /* value */
|
|
1071 lua_call(L,1,0);
|
|
1072 return 0;
|
|
1073 }
|
|
1074 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA)
|
|
1075 else {
|
|
1076 return 0; // Exits stoically if an invalid key is initialized.
|
|
1077 }
|
|
1078 #endif
|
|
1079 }
|
|
1080 lua_settop(L,3); /* reset back to start */
|
|
1081 /* we now have the table, key & new value, so just set directly */
|
|
1082 lua_rawset(L,1); /* add direct */
|
|
1083 return 0;
|
|
1084 }
|
|
1085
|
|
1086 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
|
|
1087 /* registering a module in lua. Pushes the module table on the stack. */
|
|
1088 SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name)
|
|
1089 {
|
|
1090 assert(lua_istable(L,-1)); /* just in case */
|
|
1091 lua_pushstring(L,name);
|
|
1092 lua_newtable(L); /* the table */
|
|
1093 /* add meta table */
|
|
1094 lua_newtable(L); /* the meta table */
|
|
1095 SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get);
|
|
1096 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set);
|
|
1097 lua_pushstring(L,".get");
|
|
1098 lua_newtable(L); /* the .get table */
|
|
1099 lua_rawset(L,-3); /* add .get into metatable */
|
|
1100 lua_pushstring(L,".set");
|
|
1101 lua_newtable(L); /* the .set table */
|
|
1102 lua_rawset(L,-3); /* add .set into metatable */
|
|
1103 lua_setmetatable(L,-2); /* sets meta table in module */
|
|
1104 #ifdef SWIG_LUA_MODULE_GLOBAL
|
|
1105 /* If requested, install the module directly into the global namespace. */
|
|
1106 lua_rawset(L,-3); /* add module into parent */
|
|
1107 SWIG_Lua_get_table(L,name); /* get the table back out */
|
|
1108 #else
|
|
1109 /* Do not install the module table as global name. The stack top has
|
|
1110 the module table with the name below. We pop the top and replace
|
|
1111 the name with it. */
|
|
1112 lua_replace(L,-2);
|
|
1113 #endif
|
|
1114 }
|
|
1115
|
|
1116 /* ending the register */
|
|
1117 SWIGINTERN void SWIG_Lua_module_end(lua_State* L)
|
|
1118 {
|
|
1119 lua_pop(L,1); /* tidy stack (remove module) */
|
|
1120 }
|
|
1121
|
|
1122 /* adding a linked variable to the module */
|
|
1123 SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
|
|
1124 {
|
|
1125 assert(lua_istable(L,-1)); /* just in case */
|
|
1126 lua_getmetatable(L,-1); /* get the metatable */
|
|
1127 assert(lua_istable(L,-1)); /* just in case */
|
|
1128 SWIG_Lua_get_table(L,".get"); /* find the .get table */
|
|
1129 assert(lua_istable(L,-1)); /* should be a table: */
|
|
1130 SWIG_Lua_add_function(L,name,getFn);
|
|
1131 lua_pop(L,1); /* tidy stack (remove table) */
|
|
1132 if (setFn) /* if there is a set fn */
|
|
1133 {
|
|
1134 SWIG_Lua_get_table(L,".set"); /* find the .set table */
|
|
1135 assert(lua_istable(L,-1)); /* should be a table: */
|
|
1136 SWIG_Lua_add_function(L,name,setFn);
|
|
1137 lua_pop(L,1); /* tidy stack (remove table) */
|
|
1138 }
|
|
1139 lua_pop(L,1); /* tidy stack (remove meta) */
|
|
1140 }
|
|
1141 #endif
|
|
1142
|
|
1143 /* adding a function module */
|
|
1144 SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
|
|
1145 {
|
|
1146 SWIG_Lua_add_function(L,name,fn);
|
|
1147 }
|
|
1148
|
|
1149 /* -----------------------------------------------------------------------------
|
|
1150 * global variable support code: namespaces
|
|
1151 * ----------------------------------------------------------------------------- */
|
|
1152
|
|
1153 SWIGINTERN int SWIG_Lua_namespace_get(lua_State* L)
|
|
1154 {
|
|
1155 /* there should be 2 params passed in
|
|
1156 (1) table (not the meta table)
|
|
1157 (2) string name of the attribute
|
|
1158 */
|
|
1159 assert(lua_istable(L,-2)); /* just in case */
|
|
1160 lua_getmetatable(L,-2);
|
|
1161 assert(lua_istable(L,-1));
|
|
1162 SWIG_Lua_get_table(L,".get"); /* find the .get table */
|
|
1163 assert(lua_istable(L,-1));
|
|
1164 /* look for the key in the .get table */
|
|
1165 lua_pushvalue(L,2); /* key */
|
|
1166 lua_rawget(L,-2);
|
|
1167 lua_remove(L,-2); /* stack tidy, remove .get table */
|
|
1168 if (lua_iscfunction(L,-1))
|
|
1169 { /* found it so call the fn & return its value */
|
|
1170 lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */
|
|
1171 lua_remove(L,-2); /* stack tidy, remove metatable */
|
|
1172 return 1;
|
|
1173 }
|
|
1174 lua_pop(L,1); /* remove whatever was there */
|
|
1175 /* ok, so try the .fn table */
|
|
1176 SWIG_Lua_get_table(L,".fn"); /* find the .get table */
|
|
1177 assert(lua_istable(L,-1)); /* just in case */
|
|
1178 lua_pushvalue(L,2); /* key */
|
|
1179 lua_rawget(L,-2); /* look for the fn */
|
|
1180 lua_remove(L,-2); /* stack tidy, remove .fn table */
|
|
1181 if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */
|
|
1182 { /* found it so return the fn & let lua call it */
|
|
1183 lua_remove(L,-2); /* stack tidy, remove metatable */
|
|
1184 return 1;
|
|
1185 }
|
|
1186 lua_pop(L,1); /* remove whatever was there */
|
|
1187 return 0;
|
|
1188 }
|
|
1189
|
|
1190 SWIGINTERN int SWIG_Lua_namespace_set(lua_State* L)
|
|
1191 {
|
|
1192 /* there should be 3 params passed in
|
|
1193 (1) table (not the meta table)
|
|
1194 (2) string name of the attribute
|
|
1195 (3) any for the new value
|
|
1196 */
|
|
1197
|
|
1198 assert(lua_istable(L,1));
|
|
1199 lua_getmetatable(L,1); /* get the meta table */
|
|
1200 assert(lua_istable(L,-1));
|
|
1201
|
|
1202 SWIG_Lua_get_table(L,".set"); /* find the .set table */
|
|
1203 if (lua_istable(L,-1))
|
|
1204 {
|
|
1205 /* look for the key in the .set table */
|
|
1206 lua_pushvalue(L,2); /* key */
|
|
1207 lua_rawget(L,-2);
|
|
1208 if (lua_iscfunction(L,-1))
|
|
1209 { /* found it so call the fn & return its value */
|
|
1210 lua_pushvalue(L,3); /* value */
|
|
1211 lua_call(L,1,0);
|
|
1212 return 0;
|
|
1213 }
|
|
1214 lua_pop(L,1); /* remove the value */
|
|
1215 }
|
|
1216 lua_pop(L,1); /* remove the value .set table */
|
|
1217 return 0;
|
|
1218 }
|
|
1219
|
|
1220 SWIGINTERN void SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]); // forward declaration
|
|
1221 SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn); // forward declaration
|
|
1222
|
|
1223 /* helper function - register namespace methods and attributes into namespace */
|
|
1224 SWIGINTERN void SWIG_Lua_add_namespace_details(lua_State* L, swig_lua_namespace* ns)
|
|
1225 {
|
|
1226 int i = 0;
|
|
1227 assert(lua_istable(L,-1));
|
|
1228 /* There must be table at the top of the stack */
|
|
1229 SWIG_Lua_InstallConstants(L, ns->ns_constants);
|
|
1230
|
|
1231 lua_getmetatable(L,-1);
|
|
1232
|
|
1233 /* add fns */
|
|
1234 for(i=0;ns->ns_attributes[i].name;i++){
|
|
1235 SWIG_Lua_add_class_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod);
|
|
1236 }
|
|
1237
|
|
1238 /* add methods to the metatable */
|
|
1239 SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
|
|
1240 assert(lua_istable(L,-1)); /* just in case */
|
|
1241 for(i=0;ns->ns_methods[i].name;i++){
|
|
1242 SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].method);
|
|
1243 }
|
|
1244 lua_pop(L,1);
|
|
1245
|
|
1246 /* clear stack - remove metatble */
|
|
1247 lua_pop(L,1);
|
|
1248
|
|
1249 }
|
|
1250
|
|
1251 /* helper function. creates namespace table and add it to module table */
|
|
1252 SWIGINTERN void SWIG_Lua_namespace_register(lua_State* L, swig_lua_namespace* ns)
|
|
1253 {
|
|
1254 assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table */
|
|
1255 lua_checkstack(L,5);
|
|
1256 lua_pushstring(L, ns->name);
|
|
1257 lua_newtable(L); /* namespace itself */
|
|
1258 lua_newtable(L); /* metatable for namespace */
|
|
1259
|
|
1260 /* add a table called ".get" */
|
|
1261 lua_pushstring(L,".get");
|
|
1262 lua_newtable(L);
|
|
1263 lua_rawset(L,-3);
|
|
1264 /* add a table called ".set" */
|
|
1265 lua_pushstring(L,".set");
|
|
1266 lua_newtable(L);
|
|
1267 lua_rawset(L,-3);
|
|
1268 /* add a table called ".fn" */
|
|
1269 lua_pushstring(L,".fn");
|
|
1270 lua_newtable(L);
|
|
1271 lua_rawset(L,-3);
|
|
1272
|
|
1273 /* add accessor fns for using the .get,.set&.fn */
|
|
1274 SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get);
|
|
1275 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set);
|
|
1276
|
|
1277 lua_setmetatable(L,-2); /* set metatable */
|
|
1278 lua_rawset(L,-3); /* add namespace to module table */
|
|
1279 }
|
|
1280 /* -----------------------------------------------------------------------------
|
|
1281 * global variable support code: classes
|
|
1282 * ----------------------------------------------------------------------------- */
|
|
1283
|
|
1284 /* the class.get method, performs the lookup of class attributes */
|
|
1285 SWIGINTERN int SWIG_Lua_class_get(lua_State* L)
|
|
1286 {
|
|
1287 /* there should be 2 params passed in
|
|
1288 (1) userdata (not the meta table)
|
|
1289 (2) string name of the attribute
|
|
1290 */
|
|
1291 assert(lua_isuserdata(L,-2)); /* just in case */
|
|
1292 lua_getmetatable(L,-2); /* get the meta table */
|
|
1293 assert(lua_istable(L,-1)); /* just in case */
|
|
1294 SWIG_Lua_get_table(L,".get"); /* find the .get table */
|
|
1295 assert(lua_istable(L,-1)); /* just in case */
|
|
1296 /* look for the key in the .get table */
|
|
1297 lua_pushvalue(L,2); /* key */
|
|
1298 lua_rawget(L,-2);
|
|
1299 lua_remove(L,-2); /* stack tidy, remove .get table */
|
|
1300 if (lua_iscfunction(L,-1))
|
|
1301 { /* found it so call the fn & return its value */
|
|
1302 lua_pushvalue(L,1); /* the userdata */
|
|
1303 lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */
|
|
1304 lua_remove(L,-2); /* stack tidy, remove metatable */
|
|
1305 return 1;
|
|
1306 }
|
|
1307 lua_pop(L,1); /* remove whatever was there */
|
|
1308 /* ok, so try the .fn table */
|
|
1309 SWIG_Lua_get_table(L,".fn"); /* find the .get table */
|
|
1310 assert(lua_istable(L,-1)); /* just in case */
|
|
1311 lua_pushvalue(L,2); /* key */
|
|
1312 lua_rawget(L,-2); /* look for the fn */
|
|
1313 lua_remove(L,-2); /* stack tidy, remove .fn table */
|
|
1314 if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
|
|
1315 { /* found it so return the fn & let lua call it */
|
|
1316 lua_remove(L,-2); /* stack tidy, remove metatable */
|
|
1317 return 1;
|
|
1318 }
|
|
1319 lua_pop(L,1); /* remove whatever was there */
|
|
1320 /* NEW: looks for the __getitem() fn
|
|
1321 this is a user provided get fn */
|
|
1322 SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
|
|
1323 if (lua_iscfunction(L,-1)) /* if its there */
|
|
1324 { /* found it so call the fn & return its value */
|
|
1325 lua_pushvalue(L,1); /* the userdata */
|
|
1326 lua_pushvalue(L,2); /* the parameter */
|
|
1327 lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
|
|
1328 lua_remove(L,-2); /* stack tidy, remove metatable */
|
|
1329 return 1;
|
|
1330 }
|
|
1331 return 0; /* sorry not known */
|
|
1332 }
|
|
1333
|
|
1334 /* the class.set method, performs the lookup of class attributes */
|
|
1335 SWIGINTERN int SWIG_Lua_class_set(lua_State* L)
|
|
1336 {
|
|
1337 /* there should be 3 params passed in
|
|
1338 (1) table (not the meta table)
|
|
1339 (2) string name of the attribute
|
|
1340 (3) any for the new value
|
|
1341 printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n",
|
|
1342 lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
|
|
1343 lua_tostring(L,2),
|
|
1344 lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/
|
|
1345
|
|
1346 assert(lua_isuserdata(L,1)); /* just in case */
|
|
1347 lua_getmetatable(L,1); /* get the meta table */
|
|
1348 assert(lua_istable(L,-1)); /* just in case */
|
|
1349
|
|
1350 SWIG_Lua_get_table(L,".set"); /* find the .set table */
|
|
1351 if (lua_istable(L,-1))
|
|
1352 {
|
|
1353 /* look for the key in the .set table */
|
|
1354 lua_pushvalue(L,2); /* key */
|
|
1355 lua_rawget(L,-2);
|
|
1356 if (lua_iscfunction(L,-1))
|
|
1357 { /* found it so call the fn & return its value */
|
|
1358 lua_pushvalue(L,1); /* userdata */
|
|
1359 lua_pushvalue(L,3); /* value */
|
|
1360 lua_call(L,2,0);
|
|
1361 return 0;
|
|
1362 }
|
|
1363 lua_pop(L,1); /* remove the value */
|
|
1364 }
|
|
1365 lua_pop(L,1); /* remove the value .set table */
|
|
1366 /* NEW: looks for the __setitem() fn
|
|
1367 this is a user provided set fn */
|
|
1368 SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
|
|
1369 if (lua_iscfunction(L,-1)) /* if its there */
|
|
1370 { /* found it so call the fn & return its value */
|
|
1371 lua_pushvalue(L,1); /* the userdata */
|
|
1372 lua_pushvalue(L,2); /* the parameter */
|
|
1373 lua_pushvalue(L,3); /* the value */
|
|
1374 lua_call(L,3,0); /* 3 values in ,0 out */
|
|
1375 lua_remove(L,-2); /* stack tidy, remove metatable */
|
|
1376 return 1;
|
|
1377 }
|
|
1378 return 0;
|
|
1379 }
|
|
1380
|
|
1381 /* the class.destruct method called by the interpreter */
|
|
1382 SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L)
|
|
1383 {
|
|
1384 /* there should be 1 params passed in
|
|
1385 (1) userdata (not the meta table) */
|
|
1386 swig_lua_userdata* usr;
|
|
1387 swig_lua_class* clss;
|
|
1388 assert(lua_isuserdata(L,-1)); /* just in case */
|
|
1389 usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
|
|
1390 /* if must be destroyed & has a destructor */
|
|
1391 if (usr->own) /* if must be destroyed */
|
|
1392 {
|
|
1393 clss=(swig_lua_class*)usr->type->clientdata; /* get the class */
|
|
1394 if (clss && clss->destructor) /* there is a destroy fn */
|
|
1395 {
|
|
1396 clss->destructor(usr->ptr); /* bye bye */
|
|
1397 }
|
|
1398 }
|
|
1399 return 0;
|
|
1400 }
|
|
1401
|
|
1402 /* the class.__tostring method called by the interpreter and print */
|
|
1403 SWIGINTERN int SWIG_Lua_class_tostring(lua_State* L)
|
|
1404 {
|
|
1405 /* there should be 1 param passed in
|
|
1406 (1) userdata (not the metatable) */
|
|
1407 assert(lua_isuserdata(L,1)); /* just in case */
|
|
1408 unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */
|
|
1409 lua_getmetatable(L,1); /* get the meta table */
|
|
1410 assert(lua_istable(L,-1)); /* just in case */
|
|
1411
|
|
1412 lua_getfield(L, -1, ".type");
|
|
1413 const char* className = lua_tostring(L, -1);
|
|
1414
|
|
1415 char output[256];
|
|
1416 sprintf(output, "<%s userdata: %lX>", className, userData);
|
|
1417
|
|
1418 lua_pushstring(L, (const char*)output);
|
|
1419 return 1;
|
|
1420 }
|
|
1421
|
|
1422 /* to manually disown some userdata */
|
|
1423 SWIGINTERN int SWIG_Lua_class_disown(lua_State* L)
|
|
1424 {
|
|
1425 /* there should be 1 params passed in
|
|
1426 (1) userdata (not the meta table) */
|
|
1427 swig_lua_userdata* usr;
|
|
1428 assert(lua_isuserdata(L,-1)); /* just in case */
|
|
1429 usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
|
|
1430
|
|
1431 usr->own = 0; /* clear our ownership */
|
|
1432 return 0;
|
|
1433 }
|
|
1434
|
|
1435 /* Constructor proxy. Used when class name entry in module is not class constructor,
|
|
1436 but special table instead. */
|
|
1437 SWIGINTERN int SWIG_Lua_constructor_proxy(lua_State* L)
|
|
1438 {
|
|
1439 /* unlimited number of parameters
|
|
1440 First one is our proxy table and we should remove it
|
|
1441 Other we should pass to real constructor
|
|
1442 */
|
|
1443 assert(lua_istable(L,1));
|
|
1444 lua_pushstring(L,".constructor");
|
|
1445 lua_rawget(L,1);
|
|
1446 assert(!lua_isnil(L,-1));
|
|
1447 lua_replace(L,1); /* replace our table with real constructor */
|
|
1448 lua_call(L,lua_gettop(L)-1,1);
|
|
1449 return 1;
|
|
1450 }
|
|
1451
|
|
1452 /* gets the swig class registry (or creates it) */
|
|
1453 SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L)
|
|
1454 {
|
|
1455 /* add this all into the swig registry: */
|
|
1456 lua_pushstring(L,"SWIG");
|
|
1457 lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */
|
|
1458 if (!lua_istable(L,-1)) /* not there */
|
|
1459 { /* must be first time, so add it */
|
|
1460 lua_pop(L,1); /* remove the result */
|
|
1461 lua_pushstring(L,"SWIG");
|
|
1462 lua_newtable(L);
|
|
1463 lua_rawset(L,LUA_REGISTRYINDEX);
|
|
1464 /* then get it */
|
|
1465 lua_pushstring(L,"SWIG");
|
|
1466 lua_rawget(L,LUA_REGISTRYINDEX);
|
|
1467 }
|
|
1468 }
|
|
1469
|
|
1470 /* helper fn to get the classes metatable from the register */
|
|
1471 SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname)
|
|
1472 {
|
|
1473 SWIG_Lua_get_class_registry(L); /* get the registry */
|
|
1474 lua_pushstring(L,cname); /* get the name */
|
|
1475 lua_rawget(L,-2); /* get it */
|
|
1476 lua_remove(L,-2); /* tidy up (remove registry) */
|
|
1477 }
|
|
1478
|
|
1479 /* helper add a variable to a registered class */
|
|
1480 SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
|
|
1481 {
|
|
1482 assert(lua_istable(L,-1)); /* just in case */
|
|
1483 SWIG_Lua_get_table(L,".get"); /* find the .get table */
|
|
1484 assert(lua_istable(L,-1)); /* just in case */
|
|
1485 SWIG_Lua_add_function(L,name,getFn);
|
|
1486 lua_pop(L,1); /* tidy stack (remove table) */
|
|
1487 if (setFn)
|
|
1488 {
|
|
1489 SWIG_Lua_get_table(L,".set"); /* find the .set table */
|
|
1490 assert(lua_istable(L,-1)); /* just in case */
|
|
1491 SWIG_Lua_add_function(L,name,setFn);
|
|
1492 lua_pop(L,1); /* tidy stack (remove table) */
|
|
1493 }
|
|
1494 }
|
|
1495
|
|
1496 /* helper to recursively add class static details (static attributes, operations and constants) */
|
|
1497 SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State* L, swig_lua_class* clss)
|
|
1498 {
|
|
1499 int i = 0;
|
|
1500 /* The class namespace table must be on the top of the stack */
|
|
1501 assert(lua_istable(L,-1));
|
|
1502 /* call all the base classes first: we can then override these later: */
|
|
1503 for(i=0;clss->bases[i];i++)
|
|
1504 {
|
|
1505 SWIG_Lua_add_class_static_details(L,clss->bases[i]);
|
|
1506 }
|
|
1507
|
|
1508 SWIG_Lua_add_namespace_details(L, &clss->cls_static);
|
|
1509 }
|
|
1510
|
|
1511 /* helper to recursively add class details (attributes & operations) */
|
|
1512 SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss)
|
|
1513 {
|
|
1514 int i;
|
|
1515 /* call all the base classes first: we can then override these later: */
|
|
1516 for(i=0;clss->bases[i];i++)
|
|
1517 {
|
|
1518 SWIG_Lua_add_class_details(L,clss->bases[i]);
|
|
1519 }
|
|
1520 /* add fns */
|
|
1521 for(i=0;clss->attributes[i].name;i++){
|
|
1522 SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
|
|
1523 }
|
|
1524 /* add methods to the metatable */
|
|
1525 SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
|
|
1526 assert(lua_istable(L,-1)); /* just in case */
|
|
1527 for(i=0;clss->methods[i].name;i++){
|
|
1528 SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
|
|
1529 }
|
|
1530 lua_pop(L,1); /* tidy stack (remove table) */
|
|
1531 /* add operator overloads
|
|
1532 these look ANY method which start with "__" and assume they
|
|
1533 are operator overloads & add them to the metatable
|
|
1534 (this might mess up is someone defines a method __gc (the destructor)*/
|
|
1535 for(i=0;clss->methods[i].name;i++){
|
|
1536 if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){
|
|
1537 SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
|
|
1538 }
|
|
1539 }
|
|
1540 }
|
|
1541
|
|
1542 /* set up the base classes pointers.
|
|
1543 Each class structure has a list of pointers to the base class structures.
|
|
1544 This function fills them.
|
|
1545 It cannot be done at compile time, as this will not work with hireachies
|
|
1546 spread over more than one swig file.
|
|
1547 Therefore it must be done at runtime, querying the SWIG type system.
|
|
1548 */
|
|
1549 SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss)
|
|
1550 {
|
|
1551 int i=0;
|
|
1552 swig_module_info* module=SWIG_GetModule(L);
|
|
1553 for(i=0;clss->base_names[i];i++)
|
|
1554 {
|
|
1555 if (clss->bases[i]==0) /* not found yet */
|
|
1556 {
|
|
1557 /* lookup and cache the base class */
|
|
1558 swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
|
|
1559 if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
|
|
1560 }
|
|
1561 }
|
|
1562 }
|
|
1563
|
|
1564 /* Register class static methods,attributes etc as well as constructor proxy */
|
|
1565 SWIGINTERN void SWIG_Lua_class_register_static(lua_State* L, swig_lua_class* clss)
|
|
1566 {
|
|
1567 lua_checkstack(L,5); /* just in case */
|
|
1568 assert(lua_istable(L,-1)); /* just in case */
|
|
1569 assert(strcmp(clss->name, clss->cls_static.name) == 0); /* in class those 2 must be equal */
|
|
1570
|
|
1571 SWIG_Lua_namespace_register(L,&clss->cls_static);
|
|
1572
|
|
1573 SWIG_Lua_get_table(L,clss->name); // Get namespace table back
|
|
1574 assert(lua_istable(L,-1)); /* just in case */
|
|
1575
|
|
1576 /* add its constructor to module with the name of the class
|
|
1577 so you can do MyClass(...) as well as new_MyClass(...)
|
|
1578 BUT only if a constructor is defined
|
|
1579 (this overcomes the problem of pure virtual classes without constructors)*/
|
|
1580 if (clss->constructor)
|
|
1581 {
|
|
1582 SWIG_Lua_add_function(L,".constructor", clss->constructor);
|
|
1583 lua_getmetatable(L,-1);
|
|
1584 assert(lua_istable(L,-1)); /* just in case */
|
|
1585 SWIG_Lua_add_function(L,"__call", SWIG_Lua_constructor_proxy);
|
|
1586 lua_pop(L,1);
|
|
1587 }
|
|
1588
|
|
1589 assert(lua_istable(L,-1)); /* just in case */
|
|
1590 SWIG_Lua_add_class_static_details(L, clss);
|
|
1591
|
|
1592 /* clear stack */
|
|
1593 lua_pop(L,1);
|
|
1594 }
|
|
1595
|
|
1596 /* performs the entire class registration process */
|
|
1597 SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss)
|
|
1598 {
|
|
1599 SWIG_Lua_class_register_static(L,clss);
|
|
1600
|
|
1601 SWIG_Lua_get_class_registry(L); /* get the registry */
|
|
1602 lua_pushstring(L,clss->name); /* get the name */
|
|
1603 lua_newtable(L); /* create the metatable */
|
|
1604 /* add string of class name called ".type" */
|
|
1605 lua_pushstring(L,".type");
|
|
1606 lua_pushstring(L,clss->name);
|
|
1607 lua_rawset(L,-3);
|
|
1608 /* add a table called ".get" */
|
|
1609 lua_pushstring(L,".get");
|
|
1610 lua_newtable(L);
|
|
1611 lua_rawset(L,-3);
|
|
1612 /* add a table called ".set" */
|
|
1613 lua_pushstring(L,".set");
|
|
1614 lua_newtable(L);
|
|
1615 lua_rawset(L,-3);
|
|
1616 /* add a table called ".fn" */
|
|
1617 lua_pushstring(L,".fn");
|
|
1618 lua_newtable(L);
|
|
1619 /* add manual disown method */
|
|
1620 SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown);
|
|
1621 lua_rawset(L,-3);
|
|
1622 /* add accessor fns for using the .get,.set&.fn */
|
|
1623 SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
|
|
1624 SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
|
|
1625 SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
|
|
1626 /* add tostring method for better output */
|
|
1627 SWIG_Lua_add_function(L,"__tostring",SWIG_Lua_class_tostring);
|
|
1628 /* add it */
|
|
1629 lua_rawset(L,-3); /* metatable into registry */
|
|
1630 lua_pop(L,1); /* tidy stack (remove registry) */
|
|
1631
|
|
1632 SWIG_Lua_get_class_metatable(L,clss->name);
|
|
1633 SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */
|
|
1634 lua_pop(L,1); /* tidy stack (remove class metatable) */
|
|
1635 }
|
|
1636
|
|
1637 /* -----------------------------------------------------------------------------
|
|
1638 * Class/structure conversion fns
|
|
1639 * ----------------------------------------------------------------------------- */
|
|
1640
|
|
1641 /* helper to add metatable to new lua object */
|
|
1642 SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type)
|
|
1643 {
|
|
1644 if (type->clientdata) /* there is clientdata: so add the metatable */
|
|
1645 {
|
|
1646 SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name);
|
|
1647 if (lua_istable(L,-1))
|
|
1648 {
|
|
1649 lua_setmetatable(L,-2);
|
|
1650 }
|
|
1651 else
|
|
1652 {
|
|
1653 lua_pop(L,1);
|
|
1654 }
|
|
1655 }
|
|
1656 }
|
|
1657
|
|
1658 /* pushes a new object into the lua stack */
|
|
1659 SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own)
|
|
1660 {
|
|
1661 swig_lua_userdata* usr;
|
|
1662 if (!ptr){
|
|
1663 lua_pushnil(L);
|
|
1664 return;
|
|
1665 }
|
|
1666 usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */
|
|
1667 usr->ptr=ptr; /* set the ptr */
|
|
1668 usr->type=type;
|
|
1669 usr->own=own;
|
|
1670 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
|
|
1671 _SWIG_Lua_AddMetatable(L,type); /* add metatable */
|
|
1672 #endif
|
|
1673 }
|
|
1674
|
|
1675 /* takes a object from the lua stack & converts it into an object of the correct type
|
|
1676 (if possible) */
|
|
1677 SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags)
|
|
1678 {
|
|
1679 swig_lua_userdata* usr;
|
|
1680 swig_cast_info *cast;
|
|
1681 if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
|
|
1682 usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
|
|
1683 if (usr)
|
|
1684 {
|
|
1685 if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
|
|
1686 {
|
|
1687 usr->own=0;
|
|
1688 }
|
|
1689 if (!type) /* special cast void*, no casting fn */
|
|
1690 {
|
|
1691 *ptr=usr->ptr;
|
|
1692 return SWIG_OK; /* ok */
|
|
1693 }
|
|
1694 cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
|
|
1695 if (cast)
|
|
1696 {
|
|
1697 int newmemory = 0;
|
|
1698 *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
|
|
1699 assert(!newmemory); /* newmemory handling not yet implemented */
|
|
1700 return SWIG_OK; /* ok */
|
|
1701 }
|
|
1702 }
|
|
1703 return SWIG_ERROR; /* error */
|
|
1704 }
|
|
1705
|
|
1706 SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags,
|
|
1707 int argnum,const char* func_name){
|
|
1708 void* result;
|
|
1709 if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
|
|
1710 luaL_error (L,"Error in %s, expected a %s at argument number %d\n",
|
|
1711 func_name,(type && type->str)?type->str:"void*",argnum);
|
|
1712 }
|
|
1713 return result;
|
|
1714 }
|
|
1715
|
|
1716 /* pushes a packed userdata. user for member fn pointers only */
|
|
1717 SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type)
|
|
1718 {
|
|
1719 swig_lua_rawdata* raw;
|
|
1720 assert(ptr); /* not acceptable to pass in a NULL value */
|
|
1721 raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */
|
|
1722 raw->type=type;
|
|
1723 raw->own=0;
|
|
1724 memcpy(raw->data,ptr,size); /* copy the data */
|
|
1725 _SWIG_Lua_AddMetatable(L,type); /* add metatable */
|
|
1726 }
|
|
1727
|
|
1728 /* converts a packed userdata. user for member fn pointers only */
|
|
1729 SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type)
|
|
1730 {
|
|
1731 swig_lua_rawdata* raw;
|
|
1732 raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */
|
|
1733 if (!raw) return SWIG_ERROR; /* error */
|
|
1734 if (type==0 || type==raw->type) /* void* or identical type */
|
|
1735 {
|
|
1736 memcpy(ptr,raw->data,size); /* copy it */
|
|
1737 return SWIG_OK; /* ok */
|
|
1738 }
|
|
1739 return SWIG_ERROR; /* error */
|
|
1740 }
|
|
1741
|
|
1742 /* a function to get the typestring of a piece of data */
|
|
1743 SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
|
|
1744 {
|
|
1745 swig_lua_userdata* usr;
|
|
1746 if (lua_isuserdata(L,tp))
|
|
1747 {
|
|
1748 usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */
|
|
1749 if (usr && usr->type && usr->type->str)
|
|
1750 return usr->type->str;
|
|
1751 return "userdata (unknown type)";
|
|
1752 }
|
|
1753 return lua_typename(L,lua_type(L,tp));
|
|
1754 }
|
|
1755
|
|
1756 /* lua callable function to get the userdata's type */
|
|
1757 SWIGRUNTIME int SWIG_Lua_type(lua_State* L)
|
|
1758 {
|
|
1759 lua_pushstring(L,SWIG_Lua_typename(L,1));
|
|
1760 return 1;
|
|
1761 }
|
|
1762
|
|
1763 /* lua callable function to compare userdata's value
|
|
1764 the issue is that two userdata may point to the same thing
|
|
1765 but to lua, they are different objects */
|
|
1766 SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
|
|
1767 {
|
|
1768 int result;
|
|
1769 swig_lua_userdata *usr1,*usr2;
|
|
1770 if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
|
|
1771 return 0; /* nil reply */
|
|
1772 usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
|
|
1773 usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
|
|
1774 /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
|
|
1775 result=(usr1->ptr==usr2->ptr);
|
|
1776 lua_pushboolean(L,result);
|
|
1777 return 1;
|
|
1778 }
|
|
1779
|
|
1780 /* -----------------------------------------------------------------------------
|
|
1781 * global variable support code: class/struct typemap functions
|
|
1782 * ----------------------------------------------------------------------------- */
|
|
1783
|
|
1784 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
|
|
1785 /* Install Constants */
|
|
1786 SWIGINTERN void
|
|
1787 SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
|
|
1788 int i;
|
|
1789 for (i = 0; constants[i].type; i++) {
|
|
1790 switch(constants[i].type) {
|
|
1791 case SWIG_LUA_INT:
|
|
1792 lua_pushstring(L,constants[i].name);
|
|
1793 lua_pushnumber(L,(lua_Number)constants[i].lvalue);
|
|
1794 lua_rawset(L,-3);
|
|
1795 break;
|
|
1796 case SWIG_LUA_FLOAT:
|
|
1797 lua_pushstring(L,constants[i].name);
|
|
1798 lua_pushnumber(L,(lua_Number)constants[i].dvalue);
|
|
1799 lua_rawset(L,-3);
|
|
1800 break;
|
|
1801 case SWIG_LUA_CHAR:
|
|
1802 lua_pushstring(L,constants[i].name);
|
|
1803 lua_pushfstring(L,"%c",(char)constants[i].lvalue);
|
|
1804 lua_rawset(L,-3);
|
|
1805 break;
|
|
1806 case SWIG_LUA_STRING:
|
|
1807 lua_pushstring(L,constants[i].name);
|
|
1808 lua_pushstring(L,(char *) constants[i].pvalue);
|
|
1809 lua_rawset(L,-3);
|
|
1810 break;
|
|
1811 case SWIG_LUA_POINTER:
|
|
1812 lua_pushstring(L,constants[i].name);
|
|
1813 SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
|
|
1814 lua_rawset(L,-3);
|
|
1815 break;
|
|
1816 case SWIG_LUA_BINARY:
|
|
1817 lua_pushstring(L,constants[i].name);
|
|
1818 SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
|
|
1819 lua_rawset(L,-3);
|
|
1820 break;
|
|
1821 default:
|
|
1822 break;
|
|
1823 }
|
|
1824 }
|
|
1825 }
|
|
1826 #endif
|
|
1827
|
|
1828 /* -----------------------------------------------------------------------------
|
|
1829 * executing lua code from within the wrapper
|
|
1830 * ----------------------------------------------------------------------------- */
|
|
1831
|
|
1832 #ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
|
|
1833 #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
|
|
1834 #endif
|
|
1835 /* Executes a C string in Lua which is a really simple way of calling lua from C
|
|
1836 Unfortunately lua keeps changing its APIs, so we need a conditional compile
|
|
1837 In lua 5.0.X its lua_dostring()
|
|
1838 In lua 5.1.X its luaL_dostring()
|
|
1839 */
|
|
1840 SWIGINTERN int
|
|
1841 SWIG_Lua_dostring(lua_State *L, const char* str) {
|
|
1842 int ok,top;
|
|
1843 if (str==0 || str[0]==0) return 0; /* nothing to do */
|
|
1844 top=lua_gettop(L); /* save stack */
|
|
1845 #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
|
|
1846 ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */
|
|
1847 #else
|
|
1848 ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */
|
|
1849 #endif
|
|
1850 if (ok!=0) {
|
|
1851 SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
|
|
1852 }
|
|
1853 lua_settop(L,top); /* restore the stack */
|
|
1854 return ok;
|
|
1855 }
|
|
1856
|
|
1857 #ifdef __cplusplus
|
|
1858 }
|
|
1859 #endif
|
|
1860
|
|
1861 /* ------------------------------ end luarun.swg ------------------------------ */
|
|
1862
|
|
1863
|
|
1864 /* -------- TYPES TABLE (BEGIN) -------- */
|
|
1865
|
|
1866 #define SWIGTYPE_p_UIControl swig_types[0]
|
|
1867 static swig_type_info *swig_types[2];
|
|
1868 static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
|
|
1869 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
|
|
1870 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
|
|
1871
|
|
1872 /* -------- TYPES TABLE (END) -------- */
|
|
1873
|
|
1874 #define SWIG_name "UIControl"
|
|
1875 #define SWIG_init luaopen_UIControl
|
|
1876 #define SWIG_init_user luaopen_UIControl_user
|
|
1877
|
|
1878 #define SWIG_LUACODE luaopen_UIControl_luacode
|
|
1879
|
|
1880 namespace swig {
|
|
1881 typedef struct{} LANGUAGE_OBJ;
|
|
1882 }
|
|
1883
|
|
1884
|
|
1885 #include "UIControl.h"
|
|
1886
|
|
1887 #ifdef __cplusplus
|
|
1888 extern "C" {
|
|
1889 #endif
|
|
1890 static int _wrap_UIControl_Show(lua_State* L) {
|
|
1891 int SWIG_arg = 0;
|
|
1892 UIControl *arg1 = (UIControl *) 0 ;
|
|
1893
|
|
1894 SWIG_check_num_args("UIControl::Show",1,1)
|
|
1895 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::Show",1,"UIControl *");
|
|
1896
|
|
1897 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
1898 SWIG_fail_ptr("UIControl_Show",1,SWIGTYPE_p_UIControl);
|
|
1899 }
|
|
1900
|
|
1901 (arg1)->Show();
|
|
1902
|
|
1903 return SWIG_arg;
|
|
1904
|
|
1905 if(0) SWIG_fail;
|
|
1906
|
|
1907 fail:
|
|
1908 lua_error(L);
|
|
1909 return SWIG_arg;
|
|
1910 }
|
|
1911
|
|
1912
|
|
1913 static int _wrap_UIControl_Focused(lua_State* L) {
|
|
1914 int SWIG_arg = 0;
|
|
1915 UIControl *arg1 = (UIControl *) 0 ;
|
|
1916 bool result;
|
|
1917
|
|
1918 SWIG_check_num_args("UIControl::Focused",1,1)
|
|
1919 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::Focused",1,"UIControl *");
|
|
1920
|
|
1921 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
1922 SWIG_fail_ptr("UIControl_Focused",1,SWIGTYPE_p_UIControl);
|
|
1923 }
|
|
1924
|
|
1925 result = (bool)(arg1)->Focused();
|
|
1926 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
|
|
1927 return SWIG_arg;
|
|
1928
|
|
1929 if(0) SWIG_fail;
|
|
1930
|
|
1931 fail:
|
|
1932 lua_error(L);
|
|
1933 return SWIG_arg;
|
|
1934 }
|
|
1935
|
|
1936
|
|
1937 static int _wrap_UIControl_OnKey(lua_State* L) {
|
|
1938 int SWIG_arg = 0;
|
|
1939 UIControl *arg1 = (UIControl *) 0 ;
|
|
1940 int arg2 ;
|
|
1941 bool result;
|
|
1942
|
|
1943 SWIG_check_num_args("UIControl::OnKey",2,2)
|
|
1944 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnKey",1,"UIControl *");
|
|
1945 if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnKey",2,"int");
|
|
1946
|
|
1947 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
1948 SWIG_fail_ptr("UIControl_OnKey",1,SWIGTYPE_p_UIControl);
|
|
1949 }
|
|
1950
|
|
1951 arg2 = (int)lua_tonumber(L, 2);
|
|
1952 result = (bool)(arg1)->OnKey(arg2);
|
|
1953 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
|
|
1954 return SWIG_arg;
|
|
1955
|
|
1956 if(0) SWIG_fail;
|
|
1957
|
|
1958 fail:
|
|
1959 lua_error(L);
|
|
1960 return SWIG_arg;
|
|
1961 }
|
|
1962
|
|
1963
|
|
1964 static int _wrap_UIControl_OnMouseLeftClick(lua_State* L) {
|
|
1965 int SWIG_arg = 0;
|
|
1966 UIControl *arg1 = (UIControl *) 0 ;
|
|
1967 int arg2 ;
|
|
1968 int arg3 ;
|
|
1969 bool result;
|
|
1970
|
|
1971 SWIG_check_num_args("UIControl::OnMouseLeftClick",3,3)
|
|
1972 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseLeftClick",1,"UIControl *");
|
|
1973 if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnMouseLeftClick",2,"int");
|
|
1974 if(!lua_isnumber(L,3)) SWIG_fail_arg("UIControl::OnMouseLeftClick",3,"int");
|
|
1975
|
|
1976 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
1977 SWIG_fail_ptr("UIControl_OnMouseLeftClick",1,SWIGTYPE_p_UIControl);
|
|
1978 }
|
|
1979
|
|
1980 arg2 = (int)lua_tonumber(L, 2);
|
|
1981 arg3 = (int)lua_tonumber(L, 3);
|
|
1982 result = (bool)(arg1)->OnMouseLeftClick(arg2,arg3);
|
|
1983 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
|
|
1984 return SWIG_arg;
|
|
1985
|
|
1986 if(0) SWIG_fail;
|
|
1987
|
|
1988 fail:
|
|
1989 lua_error(L);
|
|
1990 return SWIG_arg;
|
|
1991 }
|
|
1992
|
|
1993
|
|
1994 static int _wrap_UIControl_OnMouseRightClick(lua_State* L) {
|
|
1995 int SWIG_arg = 0;
|
|
1996 UIControl *arg1 = (UIControl *) 0 ;
|
|
1997 int arg2 ;
|
|
1998 int arg3 ;
|
|
1999 bool result;
|
|
2000
|
|
2001 SWIG_check_num_args("UIControl::OnMouseRightClick",3,3)
|
|
2002 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseRightClick",1,"UIControl *");
|
|
2003 if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnMouseRightClick",2,"int");
|
|
2004 if(!lua_isnumber(L,3)) SWIG_fail_arg("UIControl::OnMouseRightClick",3,"int");
|
|
2005
|
|
2006 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
2007 SWIG_fail_ptr("UIControl_OnMouseRightClick",1,SWIGTYPE_p_UIControl);
|
|
2008 }
|
|
2009
|
|
2010 arg2 = (int)lua_tonumber(L, 2);
|
|
2011 arg3 = (int)lua_tonumber(L, 3);
|
|
2012 result = (bool)(arg1)->OnMouseRightClick(arg2,arg3);
|
|
2013 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
|
|
2014 return SWIG_arg;
|
|
2015
|
|
2016 if(0) SWIG_fail;
|
|
2017
|
|
2018 fail:
|
|
2019 lua_error(L);
|
|
2020 return SWIG_arg;
|
|
2021 }
|
|
2022
|
|
2023
|
|
2024 static int _wrap_UIControl_OnMouseEnter(lua_State* L) {
|
|
2025 int SWIG_arg = 0;
|
|
2026 UIControl *arg1 = (UIControl *) 0 ;
|
|
2027 bool result;
|
|
2028
|
|
2029 SWIG_check_num_args("UIControl::OnMouseEnter",1,1)
|
|
2030 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseEnter",1,"UIControl *");
|
|
2031
|
|
2032 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
2033 SWIG_fail_ptr("UIControl_OnMouseEnter",1,SWIGTYPE_p_UIControl);
|
|
2034 }
|
|
2035
|
|
2036 result = (bool)(arg1)->OnMouseEnter();
|
|
2037 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
|
|
2038 return SWIG_arg;
|
|
2039
|
|
2040 if(0) SWIG_fail;
|
|
2041
|
|
2042 fail:
|
|
2043 lua_error(L);
|
|
2044 return SWIG_arg;
|
|
2045 }
|
|
2046
|
|
2047
|
|
2048 static int _wrap_UIControl_OnMouseLeave(lua_State* L) {
|
|
2049 int SWIG_arg = 0;
|
|
2050 UIControl *arg1 = (UIControl *) 0 ;
|
|
2051 bool result;
|
|
2052
|
|
2053 SWIG_check_num_args("UIControl::OnMouseLeave",1,1)
|
|
2054 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseLeave",1,"UIControl *");
|
|
2055
|
|
2056 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
2057 SWIG_fail_ptr("UIControl_OnMouseLeave",1,SWIGTYPE_p_UIControl);
|
|
2058 }
|
|
2059
|
|
2060 result = (bool)(arg1)->OnMouseLeave();
|
|
2061 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
|
|
2062 return SWIG_arg;
|
|
2063
|
|
2064 if(0) SWIG_fail;
|
|
2065
|
|
2066 fail:
|
|
2067 lua_error(L);
|
|
2068 return SWIG_arg;
|
|
2069 }
|
|
2070
|
|
2071
|
|
2072 static int _wrap_UIControl_AddControl(lua_State* L) {
|
|
2073 int SWIG_arg = 0;
|
|
2074 UIControl *arg1 = (UIControl *) 0 ;
|
|
2075 UIControl *arg2 = (UIControl *) 0 ;
|
|
2076 bool result;
|
|
2077
|
|
2078 SWIG_check_num_args("UIControl::AddControl",2,2)
|
|
2079 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::AddControl",1,"UIControl *");
|
|
2080 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("UIControl::AddControl",2,"UIControl *");
|
|
2081
|
|
2082 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
2083 SWIG_fail_ptr("UIControl_AddControl",1,SWIGTYPE_p_UIControl);
|
|
2084 }
|
|
2085
|
|
2086
|
|
2087 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_UIControl,0))){
|
|
2088 SWIG_fail_ptr("UIControl_AddControl",2,SWIGTYPE_p_UIControl);
|
|
2089 }
|
|
2090
|
|
2091 result = (bool)(arg1)->AddControl(arg2);
|
|
2092 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
|
|
2093 return SWIG_arg;
|
|
2094
|
|
2095 if(0) SWIG_fail;
|
|
2096
|
|
2097 fail:
|
|
2098 lua_error(L);
|
|
2099 return SWIG_arg;
|
|
2100 }
|
|
2101
|
|
2102
|
|
2103 static int _wrap_UIControl_RemoveControl(lua_State* L) {
|
|
2104 int SWIG_arg = 0;
|
|
2105 UIControl *arg1 = (UIControl *) 0 ;
|
|
2106 UIControl *arg2 = (UIControl *) 0 ;
|
|
2107 bool result;
|
|
2108
|
|
2109 SWIG_check_num_args("UIControl::RemoveControl",2,2)
|
|
2110 if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::RemoveControl",1,"UIControl *");
|
|
2111 if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("UIControl::RemoveControl",2,"UIControl *");
|
|
2112
|
|
2113 if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){
|
|
2114 SWIG_fail_ptr("UIControl_RemoveControl",1,SWIGTYPE_p_UIControl);
|
|
2115 }
|
|
2116
|
|
2117
|
|
2118 if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_UIControl,0))){
|
|
2119 SWIG_fail_ptr("UIControl_RemoveControl",2,SWIGTYPE_p_UIControl);
|
|
2120 }
|
|
2121
|
|
2122 result = (bool)(arg1)->RemoveControl(arg2);
|
|
2123 lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
|
|
2124 return SWIG_arg;
|
|
2125
|
|
2126 if(0) SWIG_fail;
|
|
2127
|
|
2128 fail:
|
|
2129 lua_error(L);
|
|
2130 return SWIG_arg;
|
|
2131 }
|
|
2132
|
|
2133
|
|
2134 static void swig_delete_UIControl(void *obj) {
|
|
2135 UIControl *arg1 = (UIControl *) obj;
|
|
2136 delete arg1;
|
|
2137 }
|
|
2138 static swig_lua_method swig_UIControl_methods[] = {
|
|
2139 {"Show", _wrap_UIControl_Show},
|
|
2140 {"Focused", _wrap_UIControl_Focused},
|
|
2141 {"OnKey", _wrap_UIControl_OnKey},
|
|
2142 {"OnMouseLeftClick", _wrap_UIControl_OnMouseLeftClick},
|
|
2143 {"OnMouseRightClick", _wrap_UIControl_OnMouseRightClick},
|
|
2144 {"OnMouseEnter", _wrap_UIControl_OnMouseEnter},
|
|
2145 {"OnMouseLeave", _wrap_UIControl_OnMouseLeave},
|
|
2146 {"AddControl", _wrap_UIControl_AddControl},
|
|
2147 {"RemoveControl", _wrap_UIControl_RemoveControl},
|
|
2148 {0,0}
|
|
2149 };
|
|
2150 static swig_lua_attribute swig_UIControl_attributes[] = {
|
|
2151 {0,0,0}
|
|
2152 };
|
|
2153 static swig_lua_attribute swig_UIControl_cls_attributes[] = {
|
|
2154 {0,0,0}
|
|
2155 };
|
|
2156 static swig_lua_method swig_UIControl_cls_methods[] = {
|
|
2157 {0,0}
|
|
2158 };
|
|
2159 static swig_lua_const_info swig_UIControl_cls_constants[] = {
|
|
2160 {0,0,0,0,0,0}
|
|
2161 };
|
|
2162 static swig_lua_class *swig_UIControl_bases[] = {0};
|
|
2163 static const char *swig_UIControl_base_names[] = {0};
|
|
2164 static swig_lua_class _wrap_class_UIControl = { "UIControl", &SWIGTYPE_p_UIControl,0, swig_delete_UIControl, swig_UIControl_methods, swig_UIControl_attributes, { "UIControl", swig_UIControl_cls_methods, swig_UIControl_cls_attributes, swig_UIControl_cls_constants }, swig_UIControl_bases, swig_UIControl_base_names };
|
|
2165
|
|
2166 #ifdef __cplusplus
|
|
2167 }
|
|
2168 #endif
|
|
2169
|
|
2170 static const struct luaL_Reg swig_commands[] = {
|
|
2171 {0,0}
|
|
2172 };
|
|
2173
|
|
2174 static swig_lua_var_info swig_variables[] = {
|
|
2175 {0,0,0}
|
|
2176 };
|
|
2177
|
|
2178 static swig_lua_const_info swig_constants[] = {
|
|
2179 {0,0,0,0,0,0}
|
|
2180 };
|
|
2181
|
|
2182 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
|
|
2183
|
|
2184 static swig_type_info _swigt__p_UIControl = {"_p_UIControl", "UIControl *", 0, 0, (void*)&_wrap_class_UIControl, 0};
|
|
2185
|
|
2186 static swig_type_info *swig_type_initial[] = {
|
|
2187 &_swigt__p_UIControl,
|
|
2188 };
|
|
2189
|
|
2190 static swig_cast_info _swigc__p_UIControl[] = { {&_swigt__p_UIControl, 0, 0, 0},{0, 0, 0, 0}};
|
|
2191
|
|
2192 static swig_cast_info *swig_cast_initial[] = {
|
|
2193 _swigc__p_UIControl,
|
|
2194 };
|
|
2195
|
|
2196
|
|
2197 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
|
|
2198
|
|
2199 /* -----------------------------------------------------------------------------
|
|
2200 * Type initialization:
|
|
2201 * This problem is tough by the requirement that no dynamic
|
|
2202 * memory is used. Also, since swig_type_info structures store pointers to
|
|
2203 * swig_cast_info structures and swig_cast_info structures store pointers back
|
|
2204 * to swig_type_info structures, we need some lookup code at initialization.
|
|
2205 * The idea is that swig generates all the structures that are needed.
|
|
2206 * The runtime then collects these partially filled structures.
|
|
2207 * The SWIG_InitializeModule function takes these initial arrays out of
|
|
2208 * swig_module, and does all the lookup, filling in the swig_module.types
|
|
2209 * array with the correct data and linking the correct swig_cast_info
|
|
2210 * structures together.
|
|
2211 *
|
|
2212 * The generated swig_type_info structures are assigned staticly to an initial
|
|
2213 * array. We just loop through that array, and handle each type individually.
|
|
2214 * First we lookup if this type has been already loaded, and if so, use the
|
|
2215 * loaded structure instead of the generated one. Then we have to fill in the
|
|
2216 * cast linked list. The cast data is initially stored in something like a
|
|
2217 * two-dimensional array. Each row corresponds to a type (there are the same
|
|
2218 * number of rows as there are in the swig_type_initial array). Each entry in
|
|
2219 * a column is one of the swig_cast_info structures for that type.
|
|
2220 * The cast_initial array is actually an array of arrays, because each row has
|
|
2221 * a variable number of columns. So to actually build the cast linked list,
|
|
2222 * we find the array of casts associated with the type, and loop through it
|
|
2223 * adding the casts to the list. The one last trick we need to do is making
|
|
2224 * sure the type pointer in the swig_cast_info struct is correct.
|
|
2225 *
|
|
2226 * First off, we lookup the cast->type name to see if it is already loaded.
|
|
2227 * There are three cases to handle:
|
|
2228 * 1) If the cast->type has already been loaded AND the type we are adding
|
|
2229 * casting info to has not been loaded (it is in this module), THEN we
|
|
2230 * replace the cast->type pointer with the type pointer that has already
|
|
2231 * been loaded.
|
|
2232 * 2) If BOTH types (the one we are adding casting info to, and the
|
|
2233 * cast->type) are loaded, THEN the cast info has already been loaded by
|
|
2234 * the previous module so we just ignore it.
|
|
2235 * 3) Finally, if cast->type has not already been loaded, then we add that
|
|
2236 * swig_cast_info to the linked list (because the cast->type) pointer will
|
|
2237 * be correct.
|
|
2238 * ----------------------------------------------------------------------------- */
|
|
2239
|
|
2240 #ifdef __cplusplus
|
|
2241 extern "C" {
|
|
2242 #if 0
|
|
2243 } /* c-mode */
|
|
2244 #endif
|
|
2245 #endif
|
|
2246
|
|
2247 #if 0
|
|
2248 #define SWIGRUNTIME_DEBUG
|
|
2249 #endif
|
|
2250
|
|
2251
|
|
2252 SWIGRUNTIME void
|
|
2253 SWIG_InitializeModule(void *clientdata) {
|
|
2254 size_t i;
|
|
2255 swig_module_info *module_head, *iter;
|
|
2256 int found, init;
|
|
2257
|
|
2258 /* check to see if the circular list has been setup, if not, set it up */
|
|
2259 if (swig_module.next==0) {
|
|
2260 /* Initialize the swig_module */
|
|
2261 swig_module.type_initial = swig_type_initial;
|
|
2262 swig_module.cast_initial = swig_cast_initial;
|
|
2263 swig_module.next = &swig_module;
|
|
2264 init = 1;
|
|
2265 } else {
|
|
2266 init = 0;
|
|
2267 }
|
|
2268
|
|
2269 /* Try and load any already created modules */
|
|
2270 module_head = SWIG_GetModule(clientdata);
|
|
2271 if (!module_head) {
|
|
2272 /* This is the first module loaded for this interpreter */
|
|
2273 /* so set the swig module into the interpreter */
|
|
2274 SWIG_SetModule(clientdata, &swig_module);
|
|
2275 module_head = &swig_module;
|
|
2276 } else {
|
|
2277 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
|
|
2278 found=0;
|
|
2279 iter=module_head;
|
|
2280 do {
|
|
2281 if (iter==&swig_module) {
|
|
2282 found=1;
|
|
2283 break;
|
|
2284 }
|
|
2285 iter=iter->next;
|
|
2286 } while (iter!= module_head);
|
|
2287
|
|
2288 /* if the is found in the list, then all is done and we may leave */
|
|
2289 if (found) return;
|
|
2290 /* otherwise we must add out module into the list */
|
|
2291 swig_module.next = module_head->next;
|
|
2292 module_head->next = &swig_module;
|
|
2293 }
|
|
2294
|
|
2295 /* When multiple interpreters are used, a module could have already been initialized in
|
|
2296 a different interpreter, but not yet have a pointer in this interpreter.
|
|
2297 In this case, we do not want to continue adding types... everything should be
|
|
2298 set up already */
|
|
2299 if (init == 0) return;
|
|
2300
|
|
2301 /* Now work on filling in swig_module.types */
|
|
2302 #ifdef SWIGRUNTIME_DEBUG
|
|
2303 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
|
|
2304 #endif
|
|
2305 for (i = 0; i < swig_module.size; ++i) {
|
|
2306 swig_type_info *type = 0;
|
|
2307 swig_type_info *ret;
|
|
2308 swig_cast_info *cast;
|
|
2309
|
|
2310 #ifdef SWIGRUNTIME_DEBUG
|
|
2311 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
|
|
2312 #endif
|
|
2313
|
|
2314 /* if there is another module already loaded */
|
|
2315 if (swig_module.next != &swig_module) {
|
|
2316 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
|
|
2317 }
|
|
2318 if (type) {
|
|
2319 /* Overwrite clientdata field */
|
|
2320 #ifdef SWIGRUNTIME_DEBUG
|
|
2321 printf("SWIG_InitializeModule: found type %s\n", type->name);
|
|
2322 #endif
|
|
2323 if (swig_module.type_initial[i]->clientdata) {
|
|
2324 type->clientdata = swig_module.type_initial[i]->clientdata;
|
|
2325 #ifdef SWIGRUNTIME_DEBUG
|
|
2326 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
|
|
2327 #endif
|
|
2328 }
|
|
2329 } else {
|
|
2330 type = swig_module.type_initial[i];
|
|
2331 }
|
|
2332
|
|
2333 /* Insert casting types */
|
|
2334 cast = swig_module.cast_initial[i];
|
|
2335 while (cast->type) {
|
|
2336
|
|
2337 /* Don't need to add information already in the list */
|
|
2338 ret = 0;
|
|
2339 #ifdef SWIGRUNTIME_DEBUG
|
|
2340 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
|
|
2341 #endif
|
|
2342 if (swig_module.next != &swig_module) {
|
|
2343 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
|
|
2344 #ifdef SWIGRUNTIME_DEBUG
|
|
2345 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
|
|
2346 #endif
|
|
2347 }
|
|
2348 if (ret) {
|
|
2349 if (type == swig_module.type_initial[i]) {
|
|
2350 #ifdef SWIGRUNTIME_DEBUG
|
|
2351 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
|
|
2352 #endif
|
|
2353 cast->type = ret;
|
|
2354 ret = 0;
|
|
2355 } else {
|
|
2356 /* Check for casting already in the list */
|
|
2357 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
|
|
2358 #ifdef SWIGRUNTIME_DEBUG
|
|
2359 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
|
|
2360 #endif
|
|
2361 if (!ocast) ret = 0;
|
|
2362 }
|
|
2363 }
|
|
2364
|
|
2365 if (!ret) {
|
|
2366 #ifdef SWIGRUNTIME_DEBUG
|
|
2367 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
|
|
2368 #endif
|
|
2369 if (type->cast) {
|
|
2370 type->cast->prev = cast;
|
|
2371 cast->next = type->cast;
|
|
2372 }
|
|
2373 type->cast = cast;
|
|
2374 }
|
|
2375 cast++;
|
|
2376 }
|
|
2377 /* Set entry in modules->types array equal to the type */
|
|
2378 swig_module.types[i] = type;
|
|
2379 }
|
|
2380 swig_module.types[i] = 0;
|
|
2381
|
|
2382 #ifdef SWIGRUNTIME_DEBUG
|
|
2383 printf("**** SWIG_InitializeModule: Cast List ******\n");
|
|
2384 for (i = 0; i < swig_module.size; ++i) {
|
|
2385 int j = 0;
|
|
2386 swig_cast_info *cast = swig_module.cast_initial[i];
|
|
2387 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
|
|
2388 while (cast->type) {
|
|
2389 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
|
|
2390 cast++;
|
|
2391 ++j;
|
|
2392 }
|
|
2393 printf("---- Total casts: %d\n",j);
|
|
2394 }
|
|
2395 printf("**** SWIG_InitializeModule: Cast List ******\n");
|
|
2396 #endif
|
|
2397 }
|
|
2398
|
|
2399 /* This function will propagate the clientdata field of type to
|
|
2400 * any new swig_type_info structures that have been added into the list
|
|
2401 * of equivalent types. It is like calling
|
|
2402 * SWIG_TypeClientData(type, clientdata) a second time.
|
|
2403 */
|
|
2404 SWIGRUNTIME void
|
|
2405 SWIG_PropagateClientData(void) {
|
|
2406 size_t i;
|
|
2407 swig_cast_info *equiv;
|
|
2408 static int init_run = 0;
|
|
2409
|
|
2410 if (init_run) return;
|
|
2411 init_run = 1;
|
|
2412
|
|
2413 for (i = 0; i < swig_module.size; i++) {
|
|
2414 if (swig_module.types[i]->clientdata) {
|
|
2415 equiv = swig_module.types[i]->cast;
|
|
2416 while (equiv) {
|
|
2417 if (!equiv->converter) {
|
|
2418 if (equiv->type && !equiv->type->clientdata)
|
|
2419 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
|
|
2420 }
|
|
2421 equiv = equiv->next;
|
|
2422 }
|
|
2423 }
|
|
2424 }
|
|
2425 }
|
|
2426
|
|
2427 #ifdef __cplusplus
|
|
2428 #if 0
|
|
2429 { /* c-mode */
|
|
2430 #endif
|
|
2431 }
|
|
2432 #endif
|
|
2433
|
|
2434
|
|
2435
|
|
2436 /* Forward declaration of where the user's %init{} gets inserted */
|
|
2437 void SWIG_init_user(lua_State* L );
|
|
2438
|
|
2439 #ifdef __cplusplus
|
|
2440 extern "C" {
|
|
2441 #endif
|
|
2442 /* this is the initialization function
|
|
2443 added at the very end of the code
|
|
2444 the function is always called SWIG_init, but an earlier #define will rename it
|
|
2445 */
|
|
2446 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
|
2447 LUALIB_API int SWIG_init(lua_State* L)
|
|
2448 #else
|
|
2449 SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
|
|
2450 #endif
|
|
2451 {
|
|
2452 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
|
|
2453 int i;
|
|
2454 /* start with global table */
|
|
2455 lua_pushglobaltable (L);
|
|
2456 /* SWIG's internal initalisation */
|
|
2457 SWIG_InitializeModule((void*)L);
|
|
2458 SWIG_PropagateClientData();
|
|
2459 #endif
|
|
2460
|
|
2461 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
|
|
2462 /* add a global fn */
|
|
2463 SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
|
|
2464 SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
|
|
2465 /* begin the module (its a table with the same name as the module) */
|
|
2466 SWIG_Lua_module_begin(L,SWIG_name);
|
|
2467 /* add commands/functions */
|
|
2468 for (i = 0; swig_commands[i].name; i++){
|
|
2469 SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
|
|
2470 }
|
|
2471 /* add variables */
|
|
2472 for (i = 0; swig_variables[i].name; i++){
|
|
2473 SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
|
|
2474 }
|
|
2475 #endif
|
|
2476
|
|
2477 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
|
|
2478 /* set up base class pointers (the hierarchy) */
|
|
2479 for (i = 0; swig_types[i]; i++){
|
|
2480 if (swig_types[i]->clientdata){
|
|
2481 SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
|
|
2482 }
|
|
2483 }
|
|
2484 /* additional registration structs & classes in lua */
|
|
2485 for (i = 0; swig_types[i]; i++){
|
|
2486 if (swig_types[i]->clientdata){
|
|
2487 SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
|
|
2488 }
|
|
2489 }
|
|
2490 #endif
|
|
2491
|
|
2492 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
|
|
2493 /* constants */
|
|
2494 SWIG_Lua_InstallConstants(L,swig_constants);
|
|
2495 #endif
|
|
2496
|
|
2497 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
|
|
2498 /* invoke user-specific initialization */
|
|
2499 SWIG_init_user(L);
|
|
2500 /* end module */
|
|
2501 /* Note: We do not clean up the stack here (Lua will do this for us). At this
|
|
2502 point, we have the globals table and out module table on the stack. Returning
|
|
2503 one value makes the module table the result of the require command. */
|
|
2504 return 1;
|
|
2505 #else
|
|
2506 return 0;
|
|
2507 #endif
|
|
2508 }
|
|
2509
|
|
2510 #ifdef __cplusplus
|
|
2511 }
|
|
2512 #endif
|
|
2513
|
|
2514
|
|
2515 const char* SWIG_LUACODE=
|
|
2516 "";
|
|
2517
|
|
2518 void SWIG_init_user(lua_State* L)
|
|
2519 {
|
|
2520 /* exec Lua code if applicable */
|
|
2521 SWIG_Lua_dostring(L,SWIG_LUACODE);
|
|
2522 }
|
|
2523
|