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