]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/io/server/src/lua_glue.swg.cc
update
[l4.git] / l4 / pkg / io / server / src / lua_glue.swg.cc
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 2.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 #define SWIGLUA
12 #define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA
13 #define SWIG_LUA_MODULE_GLOBAL
14
15
16 #ifdef __cplusplus
17 /* SwigValueWrapper is described in swig.swg */
18 template<typename T> class SwigValueWrapper {
19   struct SwigMovePointer {
20     T *ptr;
21     SwigMovePointer(T *p) : ptr(p) { }
22     ~SwigMovePointer() { delete ptr; }
23     SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
24   } pointer;
25   SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
26   SwigValueWrapper(const SwigValueWrapper<T>& rhs);
27 public:
28   SwigValueWrapper() : pointer(0) { }
29   SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
30   operator T&() const { return *pointer.ptr; }
31   T *operator&() { return pointer.ptr; }
32 };
33
34 template <typename T> T SwigValueInit() {
35   return T();
36 }
37 #endif
38
39 /* -----------------------------------------------------------------------------
40  *  This section contains generic SWIG labels for method/variable
41  *  declarations/attributes, and other compiler dependent labels.
42  * ----------------------------------------------------------------------------- */
43
44 /* template workaround for compilers that cannot correctly implement the C++ standard */
45 #ifndef SWIGTEMPLATEDISAMBIGUATOR
46 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
47 #  define SWIGTEMPLATEDISAMBIGUATOR template
48 # elif defined(__HP_aCC)
49 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
50 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
51 #  define SWIGTEMPLATEDISAMBIGUATOR template
52 # else
53 #  define SWIGTEMPLATEDISAMBIGUATOR
54 # endif
55 #endif
56
57 /* inline attribute */
58 #ifndef SWIGINLINE
59 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
60 #   define SWIGINLINE inline
61 # else
62 #   define SWIGINLINE
63 # endif
64 #endif
65
66 /* attribute recognised by some compilers to avoid 'unused' warnings */
67 #ifndef SWIGUNUSED
68 # if defined(__GNUC__)
69 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
70 #     define SWIGUNUSED __attribute__ ((__unused__))
71 #   else
72 #     define SWIGUNUSED
73 #   endif
74 # elif defined(__ICC)
75 #   define SWIGUNUSED __attribute__ ((__unused__))
76 # else
77 #   define SWIGUNUSED
78 # endif
79 #endif
80
81 #ifndef SWIG_MSC_UNSUPPRESS_4505
82 # if defined(_MSC_VER)
83 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
84 # endif
85 #endif
86
87 #ifndef SWIGUNUSEDPARM
88 # ifdef __cplusplus
89 #   define SWIGUNUSEDPARM(p)
90 # else
91 #   define SWIGUNUSEDPARM(p) p SWIGUNUSED
92 # endif
93 #endif
94
95 /* internal SWIG method */
96 #ifndef SWIGINTERN
97 # define SWIGINTERN static SWIGUNUSED
98 #endif
99
100 /* internal inline SWIG method */
101 #ifndef SWIGINTERNINLINE
102 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
103 #endif
104
105 /* exporting methods */
106 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
107 #  ifndef GCC_HASCLASSVISIBILITY
108 #    define GCC_HASCLASSVISIBILITY
109 #  endif
110 #endif
111
112 #ifndef SWIGEXPORT
113 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
114 #   if defined(STATIC_LINKED)
115 #     define SWIGEXPORT
116 #   else
117 #     define SWIGEXPORT __declspec(dllexport)
118 #   endif
119 # else
120 #   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
121 #     define SWIGEXPORT __attribute__ ((visibility("default")))
122 #   else
123 #     define SWIGEXPORT
124 #   endif
125 # endif
126 #endif
127
128 /* calling conventions for Windows */
129 #ifndef SWIGSTDCALL
130 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
131 #   define SWIGSTDCALL __stdcall
132 # else
133 #   define SWIGSTDCALL
134 # endif
135 #endif
136
137 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
138 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
139 # define _CRT_SECURE_NO_DEPRECATE
140 #endif
141
142 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
143 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
144 # define _SCL_SECURE_NO_DEPRECATE
145 #endif
146
147
148 /* -----------------------------------------------------------------------------
149  * swigrun.swg
150  *
151  * This file contains generic C API SWIG runtime support for pointer
152  * type checking.
153  * ----------------------------------------------------------------------------- */
154
155 /* This should only be incremented when either the layout of swig_type_info changes,
156    or for whatever reason, the runtime changes incompatibly */
157 #define SWIG_RUNTIME_VERSION "4"
158
159 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
160 #ifdef SWIG_TYPE_TABLE
161 # define SWIG_QUOTE_STRING(x) #x
162 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
163 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
164 #else
165 # define SWIG_TYPE_TABLE_NAME
166 #endif
167
168 /*
169   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
170   creating a static or dynamic library from the SWIG runtime code.
171   In 99.9% of the cases, SWIG just needs to declare them as 'static'.
172
173   But only do this if strictly necessary, ie, if you have problems
174   with your compiler or suchlike.
175 */
176
177 #ifndef SWIGRUNTIME
178 # define SWIGRUNTIME SWIGINTERN
179 #endif
180
181 #ifndef SWIGRUNTIMEINLINE
182 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
183 #endif
184
185 /*  Generic buffer size */
186 #ifndef SWIG_BUFFER_SIZE
187 # define SWIG_BUFFER_SIZE 1024
188 #endif
189
190 /* Flags for pointer conversions */
191 #define SWIG_POINTER_DISOWN        0x1
192 #define SWIG_CAST_NEW_MEMORY       0x2
193
194 /* Flags for new pointer objects */
195 #define SWIG_POINTER_OWN           0x1
196
197
198 /*
199    Flags/methods for returning states.
200
201    The SWIG conversion methods, as ConvertPtr, return an integer
202    that tells if the conversion was successful or not. And if not,
203    an error code can be returned (see swigerrors.swg for the codes).
204
205    Use the following macros/flags to set or process the returning
206    states.
207
208    In old versions of SWIG, code such as the following was usually written:
209
210      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
211        // success code
212      } else {
213        //fail code
214      }
215
216    Now you can be more explicit:
217
218     int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
219     if (SWIG_IsOK(res)) {
220       // success code
221     } else {
222       // fail code
223     }
224
225    which is the same really, but now you can also do
226
227     Type *ptr;
228     int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
229     if (SWIG_IsOK(res)) {
230       // success code
231       if (SWIG_IsNewObj(res) {
232         ...
233         delete *ptr;
234       } else {
235         ...
236       }
237     } else {
238       // fail code
239     }
240
241    I.e., now SWIG_ConvertPtr can return new objects and you can
242    identify the case and take care of the deallocation. Of course that
243    also requires SWIG_ConvertPtr to return new result values, such as
244
245       int SWIG_ConvertPtr(obj, ptr,...) {
246         if (<obj is ok>) {
247           if (<need new object>) {
248             *ptr = <ptr to new allocated object>;
249             return SWIG_NEWOBJ;
250           } else {
251             *ptr = <ptr to old object>;
252             return SWIG_OLDOBJ;
253           }
254         } else {
255           return SWIG_BADOBJ;
256         }
257       }
258
259    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
260    more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
261    SWIG errors code.
262
263    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
264    allows to return the 'cast rank', for example, if you have this
265
266        int food(double)
267        int fooi(int);
268
269    and you call
270
271       food(1)   // cast rank '1'  (1 -> 1.0)
272       fooi(1)   // cast rank '0'
273
274    just use the SWIG_AddCast()/SWIG_CheckState()
275 */
276
277 #define SWIG_OK                    (0)
278 #define SWIG_ERROR                 (-1)
279 #define SWIG_IsOK(r)               (r >= 0)
280 #define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
281
282 /* The CastRankLimit says how many bits are used for the cast rank */
283 #define SWIG_CASTRANKLIMIT         (1 << 8)
284 /* The NewMask denotes the object was created (using new/malloc) */
285 #define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
286 /* The TmpMask is for in/out typemaps that use temporal objects */
287 #define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
288 /* Simple returning values */
289 #define SWIG_BADOBJ                (SWIG_ERROR)
290 #define SWIG_OLDOBJ                (SWIG_OK)
291 #define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
292 #define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
293 /* Check, add and del mask methods */
294 #define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
295 #define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
296 #define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
297 #define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
298 #define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
299 #define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
300
301 /* Cast-Rank Mode */
302 #if defined(SWIG_CASTRANK_MODE)
303 #  ifndef SWIG_TypeRank
304 #    define SWIG_TypeRank             unsigned long
305 #  endif
306 #  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
307 #    define SWIG_MAXCASTRANK          (2)
308 #  endif
309 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
310 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
311 SWIGINTERNINLINE int SWIG_AddCast(int r) {
312   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
313 }
314 SWIGINTERNINLINE int SWIG_CheckState(int r) {
315   return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
316 }
317 #else /* no cast-rank mode */
318 #  define SWIG_AddCast(r) (r)
319 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
320 #endif
321
322
323 #include <string.h>
324
325 #ifdef __cplusplus
326 // removed: extern "C" {
327 #endif
328
329 typedef void *(*swig_converter_func)(void *, int *);
330 typedef struct swig_type_info *(*swig_dycast_func)(void **);
331
332 /* Structure to store information on one type */
333 typedef struct swig_type_info {
334   const char             *name;                 /* mangled name of this type */
335   const char             *str;                  /* human readable name of this type */
336   swig_dycast_func        dcast;                /* dynamic cast function down a hierarchy */
337   struct swig_cast_info  *cast;                 /* linked list of types that can cast into this type */
338   void                   *clientdata;           /* language specific type data */
339   int                    owndata;               /* flag if the structure owns the clientdata */
340 } swig_type_info;
341
342 /* Structure to store a type and conversion function used for casting */
343 typedef struct swig_cast_info {
344   swig_type_info         *type;                 /* pointer to type that is equivalent to this type */
345   swig_converter_func     converter;            /* function to cast the void pointers */
346   struct swig_cast_info  *next;                 /* pointer to next cast in linked list */
347   struct swig_cast_info  *prev;                 /* pointer to the previous cast */
348 } swig_cast_info;
349
350 /* Structure used to store module information
351  * Each module generates one structure like this, and the runtime collects
352  * all of these structures and stores them in a circularly linked list.*/
353 typedef struct swig_module_info {
354   swig_type_info         **types;               /* Array of pointers to swig_type_info structures that are in this module */
355   size_t                 size;                  /* Number of types in this module */
356   struct swig_module_info *next;                /* Pointer to next element in circularly linked list */
357   swig_type_info         **type_initial;        /* Array of initially generated type structures */
358   swig_cast_info         **cast_initial;        /* Array of initially generated casting structures */
359   void                    *clientdata;          /* Language specific module data */
360 } swig_module_info;
361
362 /*
363   Compare two type names skipping the space characters, therefore
364   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
365
366   Return 0 when the two name types are equivalent, as in
367   strncmp, but skipping ' '.
368 */
369 SWIGRUNTIME int
370 SWIG_TypeNameComp(const char *f1, const char *l1,
371                   const char *f2, const char *l2) {
372   for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
373     while ((*f1 == ' ') && (f1 != l1)) ++f1;
374     while ((*f2 == ' ') && (f2 != l2)) ++f2;
375     if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
376   }
377   return (int)((l1 - f1) - (l2 - f2));
378 }
379
380 /*
381   Check type equivalence in a name list like <name1>|<name2>|...
382   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
383 */
384 SWIGRUNTIME int
385 SWIG_TypeCmp(const char *nb, const char *tb) {
386   int equiv = 1;
387   const char* te = tb + strlen(tb);
388   const char* ne = nb;
389   while (equiv != 0 && *ne) {
390     for (nb = ne; *ne; ++ne) {
391       if (*ne == '|') break;
392     }
393     equiv = SWIG_TypeNameComp(nb, ne, tb, te);
394     if (*ne) ++ne;
395   }
396   return equiv;
397 }
398
399 /*
400   Check type equivalence in a name list like <name1>|<name2>|...
401   Return 0 if not equal, 1 if equal
402 */
403 SWIGRUNTIME int
404 SWIG_TypeEquiv(const char *nb, const char *tb) {
405   return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
406 }
407
408 /*
409   Check the typename
410 */
411 SWIGRUNTIME swig_cast_info *
412 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
413   if (ty) {
414     swig_cast_info *iter = ty->cast;
415     while (iter) {
416       if (strcmp(iter->type->name, c) == 0) {
417         if (iter == ty->cast)
418           return iter;
419         /* Move iter to the top of the linked list */
420         iter->prev->next = iter->next;
421         if (iter->next)
422           iter->next->prev = iter->prev;
423         iter->next = ty->cast;
424         iter->prev = 0;
425         if (ty->cast) ty->cast->prev = iter;
426         ty->cast = iter;
427         return iter;
428       }
429       iter = iter->next;
430     }
431   }
432   return 0;
433 }
434
435 /*
436   Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
437 */
438 SWIGRUNTIME swig_cast_info *
439 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
440   if (ty) {
441     swig_cast_info *iter = ty->cast;
442     while (iter) {
443       if (iter->type == from) {
444         if (iter == ty->cast)
445           return iter;
446         /* Move iter to the top of the linked list */
447         iter->prev->next = iter->next;
448         if (iter->next)
449           iter->next->prev = iter->prev;
450         iter->next = ty->cast;
451         iter->prev = 0;
452         if (ty->cast) ty->cast->prev = iter;
453         ty->cast = iter;
454         return iter;
455       }
456       iter = iter->next;
457     }
458   }
459   return 0;
460 }
461
462 /*
463   Cast a pointer up an inheritance hierarchy
464 */
465 SWIGRUNTIMEINLINE void *
466 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
467   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
468 }
469
470 /*
471    Dynamic pointer casting. Down an inheritance hierarchy
472 */
473 SWIGRUNTIME swig_type_info *
474 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
475   swig_type_info *lastty = ty;
476   if (!ty || !ty->dcast) return ty;
477   while (ty && (ty->dcast)) {
478     ty = (*ty->dcast)(ptr);
479     if (ty) lastty = ty;
480   }
481   return lastty;
482 }
483
484 /*
485   Return the name associated with this type
486 */
487 SWIGRUNTIMEINLINE const char *
488 SWIG_TypeName(const swig_type_info *ty) {
489   return ty->name;
490 }
491
492 /*
493   Return the pretty name associated with this type,
494   that is an unmangled type name in a form presentable to the user.
495 */
496 SWIGRUNTIME const char *
497 SWIG_TypePrettyName(const swig_type_info *type) {
498   /* The "str" field contains the equivalent pretty names of the
499      type, separated by vertical-bar characters.  We choose
500      to print the last name, as it is often (?) the most
501      specific. */
502   if (!type) return NULL;
503   if (type->str != NULL) {
504     const char *last_name = type->str;
505     const char *s;
506     for (s = type->str; *s; s++)
507       if (*s == '|') last_name = s+1;
508     return last_name;
509   }
510   else
511     return type->name;
512 }
513
514 /*
515    Set the clientdata field for a type
516 */
517 SWIGRUNTIME void
518 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
519   swig_cast_info *cast = ti->cast;
520   /* if (ti->clientdata == clientdata) return; */
521   ti->clientdata = clientdata;
522
523   while (cast) {
524     if (!cast->converter) {
525       swig_type_info *tc = cast->type;
526       if (!tc->clientdata) {
527         SWIG_TypeClientData(tc, clientdata);
528       }
529     }
530     cast = cast->next;
531   }
532 }
533 SWIGRUNTIME void
534 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
535   SWIG_TypeClientData(ti, clientdata);
536   ti->owndata = 1;
537 }
538
539 /*
540   Search for a swig_type_info structure only by mangled name
541   Search is a O(log #types)
542
543   We start searching at module start, and finish searching when start == end.
544   Note: if start == end at the beginning of the function, we go all the way around
545   the circular list.
546 */
547 SWIGRUNTIME swig_type_info *
548 SWIG_MangledTypeQueryModule(swig_module_info *start,
549                             swig_module_info *end,
550                             const char *name) {
551   swig_module_info *iter = start;
552   do {
553     if (iter->size) {
554       register size_t l = 0;
555       register size_t r = iter->size - 1;
556       do {
557         /* since l+r >= 0, we can (>> 1) instead (/ 2) */
558         register size_t i = (l + r) >> 1;
559         const char *iname = iter->types[i]->name;
560         if (iname) {
561           register int compare = strcmp(name, iname);
562           if (compare == 0) {
563             return iter->types[i];
564           } else if (compare < 0) {
565             if (i) {
566               r = i - 1;
567             } else {
568               break;
569             }
570           } else if (compare > 0) {
571             l = i + 1;
572           }
573         } else {
574           break; /* should never happen */
575         }
576       } while (l <= r);
577     }
578     iter = iter->next;
579   } while (iter != end);
580   return 0;
581 }
582
583 /*
584   Search for a swig_type_info structure for either a mangled name or a human readable name.
585   It first searches the mangled names of the types, which is a O(log #types)
586   If a type is not found it then searches the human readable names, which is O(#types).
587
588   We start searching at module start, and finish searching when start == end.
589   Note: if start == end at the beginning of the function, we go all the way around
590   the circular list.
591 */
592 SWIGRUNTIME swig_type_info *
593 SWIG_TypeQueryModule(swig_module_info *start,
594                      swig_module_info *end,
595                      const char *name) {
596   /* STEP 1: Search the name field using binary search */
597   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
598   if (ret) {
599     return ret;
600   } else {
601     /* STEP 2: If the type hasn't been found, do a complete search
602        of the str field (the human readable name) */
603     swig_module_info *iter = start;
604     do {
605       register size_t i = 0;
606       for (; i < iter->size; ++i) {
607         if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
608           return iter->types[i];
609       }
610       iter = iter->next;
611     } while (iter != end);
612   }
613
614   /* neither found a match */
615   return 0;
616 }
617
618 /*
619    Pack binary data into a string
620 */
621 SWIGRUNTIME char *
622 SWIG_PackData(char *c, void *ptr, size_t sz) {
623   static const char hex[17] = "0123456789abcdef";
624   register const unsigned char *u = (unsigned char *) ptr;
625   register const unsigned char *eu =  u + sz;
626   for (; u != eu; ++u) {
627     register unsigned char uu = *u;
628     *(c++) = hex[(uu & 0xf0) >> 4];
629     *(c++) = hex[uu & 0xf];
630   }
631   return c;
632 }
633
634 /*
635    Unpack binary data from a string
636 */
637 SWIGRUNTIME const char *
638 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
639   register unsigned char *u = (unsigned char *) ptr;
640   register const unsigned char *eu = u + sz;
641   for (; u != eu; ++u) {
642     register char d = *(c++);
643     register unsigned char uu;
644     if ((d >= '0') && (d <= '9'))
645       uu = ((d - '0') << 4);
646     else if ((d >= 'a') && (d <= 'f'))
647       uu = ((d - ('a'-10)) << 4);
648     else
649       return (char *) 0;
650     d = *(c++);
651     if ((d >= '0') && (d <= '9'))
652       uu |= (d - '0');
653     else if ((d >= 'a') && (d <= 'f'))
654       uu |= (d - ('a'-10));
655     else
656       return (char *) 0;
657     *u = uu;
658   }
659   return c;
660 }
661
662 /*
663    Pack 'void *' into a string buffer.
664 */
665 SWIGRUNTIME char *
666 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
667   char *r = buff;
668   if ((2*sizeof(void *) + 2) > bsz) return 0;
669   *(r++) = '_';
670   r = SWIG_PackData(r,&ptr,sizeof(void *));
671   if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
672   strcpy(r,name);
673   return buff;
674 }
675
676 SWIGRUNTIME const char *
677 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
678   if (*c != '_') {
679     if (strcmp(c,"NULL") == 0) {
680       *ptr = (void *) 0;
681       return name;
682     } else {
683       return 0;
684     }
685   }
686   return SWIG_UnpackData(++c,ptr,sizeof(void *));
687 }
688
689 SWIGRUNTIME char *
690 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
691   char *r = buff;
692   size_t lname = (name ? strlen(name) : 0);
693   if ((2*sz + 2 + lname) > bsz) return 0;
694   *(r++) = '_';
695   r = SWIG_PackData(r,ptr,sz);
696   if (lname) {
697     strncpy(r,name,lname+1);
698   } else {
699     *r = 0;
700   }
701   return buff;
702 }
703
704 SWIGRUNTIME const char *
705 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
706   if (*c != '_') {
707     if (strcmp(c,"NULL") == 0) {
708       memset(ptr,0,sz);
709       return name;
710     } else {
711       return 0;
712     }
713   }
714   return SWIG_UnpackData(++c,ptr,sz);
715 }
716
717 #ifdef __cplusplus
718 // removed: }
719 #endif
720
721 /* -----------------------------------------------------------------------------
722  * luarun.swg
723  *
724  * This file contains the runtime support for Lua modules
725  * and includes code for managing global variables and pointer
726  * type checking.
727  * ----------------------------------------------------------------------------- */
728
729 #ifdef __cplusplus
730 // removed: extern "C" {
731 #endif
732
733 #include "lua.h"
734 #include "lauxlib.h"
735 #include <stdlib.h>  /* for malloc */
736 #include <assert.h>  /* for a few sanity tests */
737
738 /* -----------------------------------------------------------------------------
739  * Lua flavors
740  * ----------------------------------------------------------------------------- */
741
742 #define SWIG_LUA_FLAVOR_LUA 1
743 #define SWIG_LUA_FLAVOR_ELUA 2
744 #define SWIG_LUA_FLAVOR_ELUAC 3
745
746 #if !defined(SWIG_LUA_TARGET)
747 # error SWIG_LUA_TARGET not defined
748 #endif
749
750 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
751 #  define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
752 #  define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
753 #  define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
754 #  define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
755 #else /* SWIG_LUA_FLAVOR_LUA */
756 #  define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
757 #  define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
758 #  define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
759 #  define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
760 #endif
761
762 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
763 #  define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
764 #  define LSTRVAL LRO_STRVAL
765 #endif
766
767 /* -----------------------------------------------------------------------------
768  * compatibility defines
769  * ----------------------------------------------------------------------------- */
770
771 /* History of Lua C API length functions:  In Lua 5.0 (and before?)
772    there was "lua_strlen".  In Lua 5.1, this was renamed "lua_objlen",
773    but a compatibility define of "lua_strlen" was added.  In Lua 5.2,
774    this function was again renamed, to "lua_rawlen" (to emphasize that
775    it doesn't call the "__len" metamethod), and the compatibility
776    define of lua_strlen was removed.  All SWIG uses have been updated
777    to "lua_rawlen", and we add our own defines of that here for older
778    versions of Lua.  */
779 #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
780 # define lua_rawlen lua_strlen
781 #elif LUA_VERSION_NUM == 501
782 # define lua_rawlen lua_objlen
783 #endif
784
785
786 /* lua_pushglobaltable is the recommended "future-proof" way to get
787    the global table for Lua 5.2 and later.  Here we define
788    lua_pushglobaltable ourselves for Lua versions before 5.2.  */
789 #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
790 # define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
791 #endif
792
793
794 /* --------------------------------------------------------------------------
795  * Helper functions for error handling
796  * -------------------------------------------------------------------------- */
797
798 /* Push the string STR on the Lua stack, like lua_pushstring, but
799    prefixed with the the location of the innermost Lua call-point
800    (as formated by luaL_where).  */
801 SWIGRUNTIME void
802 SWIG_Lua_pusherrstring (lua_State *L, const char *str)
803 {
804   luaL_where (L, 1);
805   lua_pushstring (L, str);
806   lua_concat (L, 2);
807 }
808
809 /* Push a formatted string generated from FMT and following args on
810    the Lua stack, like lua_pushfstring, but prefixed with the the
811    location of the innermost Lua call-point (as formated by luaL_where).  */
812 SWIGRUNTIME void
813 SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
814 {
815   va_list argp;
816   va_start(argp, fmt);
817   luaL_where(L, 1);
818   lua_pushvfstring(L, fmt, argp);
819   va_end(argp);
820   lua_concat(L, 2);
821 }
822
823
824 /* -----------------------------------------------------------------------------
825  * global swig types
826  * ----------------------------------------------------------------------------- */
827 /* Constant table */
828 #define SWIG_LUA_INT     1
829 #define SWIG_LUA_FLOAT   2
830 #define SWIG_LUA_STRING  3
831 #define SWIG_LUA_POINTER 4
832 #define SWIG_LUA_BINARY  5
833 #define SWIG_LUA_CHAR    6
834
835 /* Structure for variable linking table */
836 typedef struct {
837   const char *name;
838   lua_CFunction get;
839   lua_CFunction set;
840 } swig_lua_var_info;
841
842 /* Constant information structure */
843 typedef struct {
844     int type;
845     char *name;
846     long lvalue;
847     double dvalue;
848     void   *pvalue;
849     swig_type_info **ptype;
850 } swig_lua_const_info;
851
852 typedef struct {
853   const char     *name;
854   lua_CFunction   method;
855 } swig_lua_method;
856
857 typedef struct {
858   const char     *name;
859   lua_CFunction   getmethod;
860   lua_CFunction   setmethod;
861 } swig_lua_attribute;
862
863 // Can be used to create namespaces. Currently used to
864 // wrap class static methods/variables/constants
865 typedef struct {
866   const char            *name;
867   swig_lua_method       *ns_methods;
868   swig_lua_attribute    *ns_attributes;
869   swig_lua_const_info   *ns_constants;
870 } swig_lua_namespace;
871
872 typedef struct swig_lua_class {
873   const char    *name;
874   swig_type_info   **type;
875   lua_CFunction  constructor;
876   void    (*destructor)(void *);
877   swig_lua_method   *methods;
878   swig_lua_attribute     *attributes;
879   swig_lua_namespace    cls_static;
880   struct swig_lua_class **bases;
881   const char **base_names;
882 } swig_lua_class;
883
884 /* this is the struct for wrapping all pointers in SwigLua
885 */
886 typedef struct {
887   swig_type_info   *type;
888   int     own;  /* 1 if owned & must be destroyed */
889   void        *ptr;
890 } swig_lua_userdata;
891
892 /* this is the struct for wrapping arbitrary packed binary data
893 (currently it is only used for member function pointers)
894 the data ordering is similar to swig_lua_userdata, but it is currently not possible
895 to tell the two structures apart within SWIG, other than by looking at the type
896 */
897 typedef struct {
898   swig_type_info   *type;
899   int     own;  /* 1 if owned & must be destroyed */
900   char data[1];       /* arbitary amount of data */    
901 } swig_lua_rawdata;
902
903 /* Common SWIG API */
904 #define SWIG_NewPointerObj(L, ptr, type, owner)       SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
905 #define SWIG_ConvertPtr(L,idx, ptr, type, flags)    SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
906 #define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname)  SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
907 /* for C++ member pointers, ie, member methods */
908 #define SWIG_ConvertMember(L, idx, ptr, sz, ty)       SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
909 #define SWIG_NewMemberObj(L, ptr, sz, type)      SWIG_Lua_NewPackedObj(L, ptr, sz, type)
910
911 /* Runtime API */
912 #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
913 #define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
914 #define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
915
916 /* Contract support */
917 #define SWIG_contract_assert(expr, msg)  \
918   if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else
919
920
921 /* helper #defines */
922 #define SWIG_fail {goto fail;}
923 #define SWIG_fail_arg(func_name,argnum,type) \
924   {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
925   func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
926   goto fail;}
927 #define SWIG_fail_ptr(func_name,argnum,type) \
928   SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
929 #define SWIG_check_num_args(func_name,a,b) \
930   if (lua_gettop(L)<a || lua_gettop(L)>b) \
931   {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
932   goto fail;}
933
934
935 #define SWIG_Lua_get_table(L,n) \
936   (lua_pushstring(L, n), lua_rawget(L,-2))
937
938 #define SWIG_Lua_add_function(L,n,f) \
939   (lua_pushstring(L, n), \
940       lua_pushcfunction(L, f), \
941       lua_rawset(L,-3))
942
943 /* special helper for allowing 'nil' for usertypes */
944 #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
945
946 #ifdef __cplusplus
947 /* Special helper for member function pointers 
948 it gets the address, casts it, then dereferences it */
949 //#define SWIG_mem_fn_as_voidptr(a)  (*((char**)&(a)))
950 #endif
951
952 /* storing/access of swig_module_info */
953 SWIGRUNTIME swig_module_info *
954 SWIG_Lua_GetModule(lua_State* L) {
955   swig_module_info *ret = 0;
956   lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
957   lua_rawget(L,LUA_REGISTRYINDEX);
958   if (lua_islightuserdata(L,-1))
959     ret=(swig_module_info*)lua_touserdata(L,-1);
960   lua_pop(L,1);  /* tidy */
961   return ret;
962 }
963
964 SWIGRUNTIME void
965 SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) {
966   /* add this all into the Lua registry: */
967   lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
968   lua_pushlightuserdata(L,(void*)module);
969   lua_rawset(L,LUA_REGISTRYINDEX);
970 }
971
972 /* -----------------------------------------------------------------------------
973  * global variable support code: modules
974  * ----------------------------------------------------------------------------- */
975
976 /* this function is called when trying to set an immutable.
977 default action is to print an error.
978 This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
979 SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L)
980 {
981 /*  there should be 1 param passed in: the new value */
982 #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
983   lua_pop(L,1);  /* remove it */
984   luaL_error(L,"This variable is immutable");
985 #endif
986     return 0;   /* should not return anything */
987 }
988
989 /* the module.get method used for getting linked data */
990 SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
991 {
992 /*  there should be 2 params passed in
993   (1) table (not the meta table)
994   (2) string name of the attribute
995   printf("SWIG_Lua_module_get %p(%s) '%s'\n",
996    lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
997    lua_tostring(L,2));
998 */
999   /* get the metatable */
1000 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
1001   assert(lua_isrotable(L,1)); /* just in case */
1002 #else
1003   assert(lua_istable(L,1)); /* default Lua action */
1004 #endif
1005   lua_getmetatable(L,1);  /* get the metatable */
1006 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
1007   assert(lua_isrotable(L,-1));  /* just in case */
1008 #else
1009   assert(lua_istable(L,-1));
1010 #endif
1011   SWIG_Lua_get_table(L,".get");  /* get the .get table */
1012   lua_remove(L,3);  /* remove metatable */
1013 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
1014   if (lua_isrotable(L,-1))
1015 #else
1016   if (lua_istable(L,-1))
1017 #endif
1018   {
1019     /* look for the key in the .get table */
1020     lua_pushvalue(L,2);  /* key */
1021     lua_rawget(L,-2);
1022     lua_remove(L,3);  /* remove .get */
1023     if (lua_iscfunction(L,-1))
1024     {  /* found it so call the fn & return its value */
1025       lua_call(L,0,1);
1026       return 1;
1027     }
1028     lua_pop(L,1);  /* remove the top */
1029   }
1030   lua_pop(L,1);  /* remove the .get */
1031   lua_pushnil(L);  /* return a nil */
1032   return 1;
1033 }
1034
1035 /* the module.set method used for setting linked data */
1036 SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
1037 {
1038 /*  there should be 3 params passed in
1039   (1) table (not the meta table)
1040   (2) string name of the attribute
1041   (3) any for the new value
1042 */
1043   /* get the metatable */
1044 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
1045   assert(lua_isrotable(L,1));  /* just in case */
1046 #else
1047   assert(lua_istable(L,1)); /* default Lua action */
1048 #endif
1049   lua_getmetatable(L,1);  /* get the metatable */
1050 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
1051   assert(lua_isrotable(L,-1));  /* just in case */
1052 #else
1053   assert(lua_istable(L,-1));
1054 #endif
1055   SWIG_Lua_get_table(L,".set");  /* get the .set table */
1056   lua_remove(L,4);  /* remove metatable */
1057 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
1058   if (lua_isrotable(L,-1))
1059 #else
1060   if (lua_istable(L,-1))
1061 #endif
1062   {
1063     /* look for the key in the .set table */
1064     lua_pushvalue(L,2);  /* key */
1065     lua_rawget(L,-2);
1066     lua_remove(L,4);  /* remove .set */
1067     if (lua_iscfunction(L,-1))
1068     {  /* found it so call the fn & return its value */
1069       lua_pushvalue(L,3);  /* value */
1070       lua_call(L,1,0);
1071       return 0;
1072     }
1073 #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) 
1074     else {
1075       return 0; // Exits stoically if an invalid key is initialized.
1076     }
1077 #endif
1078   }
1079   lua_settop(L,3);  /* reset back to start */
1080   /* we now have the table, key & new value, so just set directly */
1081   lua_rawset(L,1);  /* add direct */
1082   return 0;
1083 }
1084
1085 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
1086 /* registering a module in lua. Pushes the module table on the stack. */
1087 SWIGINTERN void  SWIG_Lua_module_begin(lua_State* L,const char* name)
1088 {
1089   assert(lua_istable(L,-1));  /* just in case */
1090   lua_pushstring(L,name);
1091   lua_newtable(L);   /* the table */
1092   /* add meta table */
1093   lua_newtable(L);    /* the meta table */
1094   SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get);
1095   SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set);
1096   lua_pushstring(L,".get");
1097   lua_newtable(L);    /* the .get table */
1098   lua_rawset(L,-3);  /* add .get into metatable */
1099   lua_pushstring(L,".set");
1100   lua_newtable(L);    /* the .set table */
1101   lua_rawset(L,-3);  /* add .set into metatable */
1102   lua_setmetatable(L,-2);  /* sets meta table in module */
1103 #ifdef SWIG_LUA_MODULE_GLOBAL
1104   /* If requested, install the module directly into the global namespace. */
1105   lua_rawset(L,-3);        /* add module into parent */
1106   SWIG_Lua_get_table(L,name);   /* get the table back out */
1107 #else
1108   /* Do not install the module table as global name. The stack top has
1109      the module table with the name below. We pop the top and replace
1110      the name with it. */
1111   lua_replace(L,-2);
1112 #endif
1113 }
1114
1115 /* ending the register */
1116 SWIGINTERN void  SWIG_Lua_module_end(lua_State* L)
1117 {
1118   lua_pop(L,1);       /* tidy stack (remove module) */
1119 }
1120
1121 /* adding a linked variable to the module */
1122 SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
1123 {
1124   assert(lua_istable(L,-1));  /* just in case */
1125   lua_getmetatable(L,-1);  /* get the metatable */
1126   assert(lua_istable(L,-1));  /* just in case */
1127   SWIG_Lua_get_table(L,".get"); /* find the .get table */
1128   assert(lua_istable(L,-1));  /* should be a table: */
1129   SWIG_Lua_add_function(L,name,getFn);
1130   lua_pop(L,1);       /* tidy stack (remove table) */
1131   if (setFn)  /* if there is a set fn */
1132   {
1133     SWIG_Lua_get_table(L,".set"); /* find the .set table */
1134     assert(lua_istable(L,-1));  /* should be a table: */
1135     SWIG_Lua_add_function(L,name,setFn);
1136     lua_pop(L,1);       /* tidy stack (remove table) */
1137   }
1138   lua_pop(L,1);       /* tidy stack (remove meta) */
1139 }
1140 #endif
1141
1142 /* adding a function module */
1143 SWIGINTERN void  SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
1144 {
1145   SWIG_Lua_add_function(L,name,fn);
1146 }
1147
1148 /* -----------------------------------------------------------------------------
1149  * global variable support code: namespaces
1150  * ----------------------------------------------------------------------------- */
1151
1152 SWIGINTERN int SWIG_Lua_namespace_get(lua_State* L)
1153 {
1154 /*  there should be 2 params passed in
1155   (1) table (not the meta table)
1156   (2) string name of the attribute
1157 */
1158   assert(lua_istable(L,-2));  /* just in case */
1159   lua_getmetatable(L,-2);
1160   assert(lua_istable(L,-1));
1161   SWIG_Lua_get_table(L,".get"); /* find the .get table */
1162   assert(lua_istable(L,-1));
1163   /* look for the key in the .get table */
1164   lua_pushvalue(L,2);  /* key */
1165   lua_rawget(L,-2);
1166   lua_remove(L,-2); /* stack tidy, remove .get table */
1167   if (lua_iscfunction(L,-1))
1168   {  /* found it so call the fn & return its value */
1169     lua_call(L,0,1);  /* 1 value in (userdata),1 out (result) */
1170     lua_remove(L,-2); /* stack tidy, remove metatable */
1171     return 1;
1172   }
1173   lua_pop(L,1);  /* remove whatever was there */
1174   /* ok, so try the .fn table */
1175   SWIG_Lua_get_table(L,".fn"); /* find the .get table */
1176   assert(lua_istable(L,-1));  /* just in case */
1177   lua_pushvalue(L,2);  /* key */
1178   lua_rawget(L,-2);  /* look for the fn */
1179   lua_remove(L,-2); /* stack tidy, remove .fn table */
1180   if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */
1181   {  /* found it so return the fn & let lua call it */
1182     lua_remove(L,-2); /* stack tidy, remove metatable */
1183     return 1;
1184   }
1185   lua_pop(L,1);  /* remove whatever was there */
1186   return 0;
1187 }
1188
1189 SWIGINTERN int SWIG_Lua_namespace_set(lua_State* L)
1190 {
1191 /*  there should be 3 params passed in
1192   (1) table (not the meta table)
1193   (2) string name of the attribute
1194   (3) any for the new value
1195 */
1196
1197   assert(lua_istable(L,1));
1198   lua_getmetatable(L,1);    /* get the meta table */
1199   assert(lua_istable(L,-1));
1200
1201   SWIG_Lua_get_table(L,".set"); /* find the .set table */
1202   if (lua_istable(L,-1))
1203   {
1204     /* look for the key in the .set table */
1205     lua_pushvalue(L,2);  /* key */
1206     lua_rawget(L,-2);
1207     if (lua_iscfunction(L,-1))
1208     {  /* found it so call the fn & return its value */
1209       lua_pushvalue(L,3);  /* value */
1210       lua_call(L,1,0);
1211       return 0;
1212     }
1213     lua_pop(L,1);  /* remove the value */
1214   }
1215   lua_pop(L,1);  /* remove the value .set table */
1216   return 0;
1217 }
1218
1219 SWIGINTERN void SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]); // forward declaration
1220 SWIGINTERN void  SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn); // forward declaration
1221
1222 /* helper function - register namespace methods and attributes into namespace */
1223 SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State* L, swig_lua_namespace* ns)
1224 {
1225   int i = 0;
1226   assert(lua_istable(L,-1));
1227   /* There must be table at the top of the stack */
1228   SWIG_Lua_InstallConstants(L, ns->ns_constants);
1229
1230   lua_getmetatable(L,-1);
1231
1232   /* add fns */
1233   for(i=0;ns->ns_attributes[i].name;i++){
1234     SWIG_Lua_add_class_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod);
1235   }
1236
1237   /* add methods to the metatable */
1238   SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
1239   assert(lua_istable(L,-1));  /* just in case */
1240   for(i=0;ns->ns_methods[i].name;i++){
1241     SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].method);
1242   }
1243   lua_pop(L,1);
1244
1245   /* clear stack - remove metatble */
1246   lua_pop(L,1);
1247   return 0;
1248 }
1249
1250 /* helper function. creates namespace table and add it to module table */
1251 SWIGINTERN int SWIG_Lua_namespace_register(lua_State* L, swig_lua_namespace* ns)
1252 {
1253   assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table */
1254   lua_checkstack(L,5);
1255   lua_pushstring(L, ns->name);
1256   lua_newtable(L); /* namespace itself */
1257   lua_newtable(L); /* metatable for namespace */
1258
1259   /* add a table called ".get" */
1260   lua_pushstring(L,".get");
1261   lua_newtable(L);
1262   lua_rawset(L,-3);
1263   /* add a table called ".set" */
1264   lua_pushstring(L,".set");
1265   lua_newtable(L);
1266   lua_rawset(L,-3);
1267   /* add a table called ".fn" */
1268   lua_pushstring(L,".fn");
1269   lua_newtable(L);
1270   lua_rawset(L,-3);
1271
1272   /* add accessor fns for using the .get,.set&.fn */
1273   SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get);
1274   SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set);
1275
1276   lua_setmetatable(L,-2); /* set metatable */
1277   lua_rawset(L,-3); /* add namespace to module table */
1278   return 0;
1279 }
1280 /* -----------------------------------------------------------------------------
1281  * global variable support code: classes
1282  * ----------------------------------------------------------------------------- */
1283
1284 /* the class.get method, performs the lookup of class attributes */
1285 SWIGINTERN int  SWIG_Lua_class_get(lua_State* L)
1286 {
1287 /*  there should be 2 params passed in
1288   (1) userdata (not the meta table)
1289   (2) string name of the attribute
1290 */
1291   assert(lua_isuserdata(L,-2));  /* just in case */
1292   lua_getmetatable(L,-2);    /* get the meta table */
1293   assert(lua_istable(L,-1));  /* just in case */
1294   SWIG_Lua_get_table(L,".get"); /* find the .get table */
1295   assert(lua_istable(L,-1));  /* just in case */
1296   /* look for the key in the .get table */
1297   lua_pushvalue(L,2);  /* key */
1298   lua_rawget(L,-2);
1299   lua_remove(L,-2); /* stack tidy, remove .get table */
1300   if (lua_iscfunction(L,-1))
1301   {  /* found it so call the fn & return its value */
1302     lua_pushvalue(L,1);  /* the userdata */
1303     lua_call(L,1,1);  /* 1 value in (userdata),1 out (result) */
1304     lua_remove(L,-2); /* stack tidy, remove metatable */
1305     return 1;
1306   }
1307   lua_pop(L,1);  /* remove whatever was there */
1308   /* ok, so try the .fn table */
1309   SWIG_Lua_get_table(L,".fn"); /* find the .get table */
1310   assert(lua_istable(L,-1));  /* just in case */
1311   lua_pushvalue(L,2);  /* key */
1312   lua_rawget(L,-2);  /* look for the fn */
1313   lua_remove(L,-2); /* stack tidy, remove .fn table */
1314   if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
1315   {  /* found it so return the fn & let lua call it */
1316     lua_remove(L,-2); /* stack tidy, remove metatable */
1317     return 1;
1318   }
1319   lua_pop(L,1);  /* remove whatever was there */
1320   /* NEW: looks for the __getitem() fn
1321   this is a user provided get fn */
1322   SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
1323   if (lua_iscfunction(L,-1))  /* if its there */
1324   {  /* found it so call the fn & return its value */
1325     lua_pushvalue(L,1);  /* the userdata */
1326     lua_pushvalue(L,2);  /* the parameter */
1327     lua_call(L,2,1);  /* 2 value in (userdata),1 out (result) */
1328     lua_remove(L,-2); /* stack tidy, remove metatable */
1329     return 1;
1330   }
1331   return 0;  /* sorry not known */
1332 }
1333
1334 /* the class.set method, performs the lookup of class attributes */
1335 SWIGINTERN int  SWIG_Lua_class_set(lua_State* L)
1336 {
1337 /*  there should be 3 params passed in
1338   (1) table (not the meta table)
1339   (2) string name of the attribute
1340   (3) any for the new value
1341 printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n",
1342       lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
1343       lua_tostring(L,2),
1344       lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/
1345
1346   assert(lua_isuserdata(L,1));  /* just in case */
1347   lua_getmetatable(L,1);    /* get the meta table */
1348   assert(lua_istable(L,-1));  /* just in case */
1349
1350   SWIG_Lua_get_table(L,".set"); /* find the .set table */
1351   if (lua_istable(L,-1))
1352   {
1353     /* look for the key in the .set table */
1354     lua_pushvalue(L,2);  /* key */
1355     lua_rawget(L,-2);
1356     if (lua_iscfunction(L,-1))
1357     {  /* found it so call the fn & return its value */
1358       lua_pushvalue(L,1);  /* userdata */
1359       lua_pushvalue(L,3);  /* value */
1360       lua_call(L,2,0);
1361       return 0;
1362     }
1363     lua_pop(L,1);  /* remove the value */
1364   }
1365   lua_pop(L,1);  /* remove the value .set table */
1366   /* NEW: looks for the __setitem() fn
1367   this is a user provided set fn */
1368   SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
1369   if (lua_iscfunction(L,-1))  /* if its there */
1370   {  /* found it so call the fn & return its value */
1371     lua_pushvalue(L,1);  /* the userdata */
1372     lua_pushvalue(L,2);  /* the parameter */
1373     lua_pushvalue(L,3);  /* the value */
1374     lua_call(L,3,0);  /* 3 values in ,0 out */
1375     lua_remove(L,-2); /* stack tidy, remove metatable */
1376     return 1;
1377   }
1378   return 0;
1379 }
1380
1381 /* the class.destruct method called by the interpreter */
1382 SWIGINTERN int  SWIG_Lua_class_destruct(lua_State* L)
1383 {
1384 /*  there should be 1 params passed in
1385   (1) userdata (not the meta table) */
1386   swig_lua_userdata* usr;
1387   swig_lua_class* clss;
1388   assert(lua_isuserdata(L,-1));  /* just in case */
1389   usr=(swig_lua_userdata*)lua_touserdata(L,-1);  /* get it */
1390   /* if must be destroyed & has a destructor */
1391   if (usr->own) /* if must be destroyed */
1392   {
1393     clss=(swig_lua_class*)usr->type->clientdata;  /* get the class */
1394     if (clss && clss->destructor)  /* there is a destroy fn */
1395     {
1396       clss->destructor(usr->ptr);  /* bye bye */
1397     }
1398   }
1399   return 0;
1400 }
1401
1402 /* the class.__tostring method called by the interpreter and print */
1403 SWIGINTERN int  SWIG_Lua_class_tostring(lua_State* L)
1404 {
1405 /*  there should be 1 param passed in
1406   (1) userdata (not the metatable) */
1407   assert(lua_isuserdata(L,1));  /* just in case */
1408   unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */
1409   lua_getmetatable(L,1);    /* get the meta table */
1410   assert(lua_istable(L,-1));  /* just in case */
1411   
1412   lua_getfield(L, -1, ".type");
1413   const char* className = lua_tostring(L, -1);
1414   
1415   char output[256];
1416   sprintf(output, "<%s userdata: %lX>", className, userData);
1417   
1418   lua_pushstring(L, (const char*)output);
1419   return 1;
1420 }
1421
1422 /* to manually disown some userdata */
1423 SWIGINTERN int  SWIG_Lua_class_disown(lua_State* L)
1424 {
1425 /*  there should be 1 params passed in
1426   (1) userdata (not the meta table) */
1427   swig_lua_userdata* usr;
1428   assert(lua_isuserdata(L,-1));  /* just in case */
1429   usr=(swig_lua_userdata*)lua_touserdata(L,-1);  /* get it */
1430   
1431   usr->own = 0; /* clear our ownership */
1432   return 0;
1433 }
1434
1435 /* Constructor proxy. Used when class name entry in module is not class constructor,
1436 but special table instead. */
1437 SWIGINTERN int SWIG_Lua_constructor_proxy(lua_State* L)
1438 {
1439   /* unlimited number of parameters
1440      First one is our proxy table and we should remove it
1441      Other we should pass to real constructor
1442    */
1443    assert(lua_istable(L,1));
1444    lua_pushstring(L,".constructor");
1445    lua_rawget(L,1);
1446    assert(!lua_isnil(L,-1));
1447    lua_replace(L,1); /* replace our table with real constructor */
1448    lua_call(L,lua_gettop(L)-1,1);
1449    return 1;
1450 }
1451
1452 /* gets the swig class registry (or creates it) */
1453 SWIGINTERN void  SWIG_Lua_get_class_registry(lua_State* L)
1454 {
1455   /* add this all into the swig registry: */
1456   lua_pushstring(L,"SWIG");
1457   lua_rawget(L,LUA_REGISTRYINDEX);  /* get the registry */
1458   if (!lua_istable(L,-1))  /* not there */
1459   {  /* must be first time, so add it */
1460     lua_pop(L,1);  /* remove the result */
1461     lua_pushstring(L,"SWIG");
1462     lua_newtable(L);
1463     lua_rawset(L,LUA_REGISTRYINDEX);
1464     /* then get it */
1465     lua_pushstring(L,"SWIG");
1466     lua_rawget(L,LUA_REGISTRYINDEX);
1467   }
1468 }
1469
1470 /* helper fn to get the classes metatable from the register */
1471 SWIGINTERN void  SWIG_Lua_get_class_metatable(lua_State* L,const char* cname)
1472 {
1473   SWIG_Lua_get_class_registry(L);  /* get the registry */
1474   lua_pushstring(L,cname);  /* get the name */
1475   lua_rawget(L,-2);    /* get it */
1476   lua_remove(L,-2);    /* tidy up (remove registry) */
1477 }
1478
1479 /* helper add a variable to a registered class */
1480 SWIGINTERN void  SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
1481 {
1482   assert(lua_istable(L,-1));  /* just in case */
1483   SWIG_Lua_get_table(L,".get"); /* find the .get table */
1484   assert(lua_istable(L,-1));  /* just in case */
1485   SWIG_Lua_add_function(L,name,getFn);
1486   lua_pop(L,1);       /* tidy stack (remove table) */
1487   if (setFn)
1488   {
1489     SWIG_Lua_get_table(L,".set"); /* find the .set table */
1490     assert(lua_istable(L,-1));  /* just in case */
1491     SWIG_Lua_add_function(L,name,setFn);
1492     lua_pop(L,1);       /* tidy stack (remove table) */
1493   }
1494 }
1495
1496 /* helper to recursively add class static details (static attributes, operations and constants) */
1497 SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State* L, swig_lua_class* clss)
1498 {
1499   int i = 0;
1500   /* The class namespace table must be on the top of the stack */
1501   assert(lua_istable(L,-1));
1502   /* call all the base classes first: we can then override these later: */
1503   for(i=0;clss->bases[i];i++)
1504   {
1505     SWIG_Lua_add_class_static_details(L,clss->bases[i]);
1506   }
1507
1508   SWIG_Lua_add_namespace_details(L, &clss->cls_static);
1509 }
1510
1511 /* helper to recursively add class details (attributes & operations) */
1512 SWIGINTERN void  SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss)
1513 {
1514   int i;
1515   /* call all the base classes first: we can then override these later: */
1516   for(i=0;clss->bases[i];i++)
1517   {
1518     SWIG_Lua_add_class_details(L,clss->bases[i]);
1519   }
1520   /* add fns */
1521   for(i=0;clss->attributes[i].name;i++){
1522     SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
1523   }
1524   /* add methods to the metatable */
1525   SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
1526   assert(lua_istable(L,-1));  /* just in case */
1527   for(i=0;clss->methods[i].name;i++){
1528     SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
1529   }
1530   lua_pop(L,1);       /* tidy stack (remove table) */
1531   /*   add operator overloads
1532     these look ANY method which start with "__" and assume they
1533     are operator overloads & add them to the metatable
1534     (this might mess up is someone defines a method __gc (the destructor)*/
1535   for(i=0;clss->methods[i].name;i++){
1536     if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){
1537       SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
1538     }
1539   }
1540 }
1541
1542 /* set up the base classes pointers.
1543 Each class structure has a list of pointers to the base class structures.
1544 This function fills them.
1545 It cannot be done at compile time, as this will not work with hireachies
1546 spread over more than one swig file. 
1547 Therefore it must be done at runtime, querying the SWIG type system.
1548 */
1549 SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss)
1550 {
1551   int i=0;
1552   swig_module_info* module=SWIG_GetModule(L);
1553   for(i=0;clss->base_names[i];i++)
1554   {
1555     if (clss->bases[i]==0) /* not found yet */
1556     {
1557       /* lookup and cache the base class */
1558       swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
1559       if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
1560     }
1561   }
1562 }
1563
1564 /* Register class static methods,attributes etc as well as constructor proxy */
1565 SWIGINTERN void SWIG_Lua_class_register_static(lua_State* L, swig_lua_class* clss)
1566 {
1567   lua_checkstack(L,5); /* just in case */
1568   assert(lua_istable(L,-1));  /* just in case */
1569   assert(strcmp(clss->name, clss->cls_static.name) == 0); /* in class those 2 must be equal */
1570
1571   SWIG_Lua_namespace_register(L,&clss->cls_static);
1572
1573   SWIG_Lua_get_table(L,clss->name); // Get namespace table back
1574   assert(lua_istable(L,-1)); /* just in case */
1575
1576   /*  add its constructor to module with the name of the class
1577   so you can do MyClass(...) as well as new_MyClass(...)
1578   BUT only if a constructor is defined
1579   (this overcomes the problem of pure virtual classes without constructors)*/
1580   if (clss->constructor)
1581   {
1582     SWIG_Lua_add_function(L,".constructor", clss->constructor);
1583     lua_getmetatable(L,-1);
1584     assert(lua_istable(L,-1)); /* just in case */
1585     SWIG_Lua_add_function(L,"__call", SWIG_Lua_constructor_proxy);
1586     lua_pop(L,1);
1587   }
1588
1589   assert(lua_istable(L,-1)); /* just in case */
1590   SWIG_Lua_add_class_static_details(L, clss);
1591
1592   /* clear stack */
1593   lua_pop(L,1);
1594 }
1595
1596 /* performs the entire class registration process */
1597 SWIGINTERN void  SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss)
1598 {
1599   SWIG_Lua_class_register_static(L,clss);
1600
1601   SWIG_Lua_get_class_registry(L);  /* get the registry */
1602   lua_pushstring(L,clss->name);  /* get the name */
1603   lua_newtable(L);    /* create the metatable */
1604   /* add string of class name called ".type" */
1605   lua_pushstring(L,".type");
1606   lua_pushstring(L,clss->name);
1607   lua_rawset(L,-3);
1608   /* add a table called ".get" */
1609   lua_pushstring(L,".get");
1610   lua_newtable(L);
1611   lua_rawset(L,-3);
1612   /* add a table called ".set" */
1613   lua_pushstring(L,".set");
1614   lua_newtable(L);
1615   lua_rawset(L,-3);
1616   /* add a table called ".fn" */
1617   lua_pushstring(L,".fn");
1618   lua_newtable(L);
1619   /* add manual disown method */
1620   SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown);
1621   lua_rawset(L,-3);
1622   /* add accessor fns for using the .get,.set&.fn */
1623   SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
1624   SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
1625   SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
1626   /* add tostring method for better output */
1627   SWIG_Lua_add_function(L,"__tostring",SWIG_Lua_class_tostring);
1628   /* add it */
1629   lua_rawset(L,-3);  /* metatable into registry */
1630   lua_pop(L,1);      /* tidy stack (remove registry) */
1631
1632   SWIG_Lua_get_class_metatable(L,clss->name);
1633   SWIG_Lua_add_class_details(L,clss);  /* recursive adding of details (atts & ops) */
1634   lua_pop(L,1);      /* tidy stack (remove class metatable) */
1635 }
1636
1637 /* -----------------------------------------------------------------------------
1638  * Class/structure conversion fns
1639  * ----------------------------------------------------------------------------- */
1640
1641 /* helper to add metatable to new lua object */
1642 SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type)
1643 {
1644   if (type->clientdata)  /* there is clientdata: so add the metatable */
1645   {
1646     SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name);
1647     if (lua_istable(L,-1))
1648     {
1649       lua_setmetatable(L,-2);
1650     }
1651     else
1652     {
1653       lua_pop(L,1);
1654     }
1655   }
1656 }
1657
1658 /* pushes a new object into the lua stack */
1659 SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own)
1660 {
1661   swig_lua_userdata* usr;
1662   if (!ptr){
1663     lua_pushnil(L);
1664     return;
1665   }
1666   usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata));  /* get data */
1667   usr->ptr=ptr;  /* set the ptr */
1668   usr->type=type;
1669   usr->own=own;
1670 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
1671   _SWIG_Lua_AddMetatable(L,type); /* add metatable */
1672 #endif
1673 }
1674
1675 /* takes a object from the lua stack & converts it into an object of the correct type
1676  (if possible) */
1677 SWIGRUNTIME int  SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags)
1678 {
1679   swig_lua_userdata* usr;
1680   swig_cast_info *cast;
1681   if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;}    /* special case: lua nil => NULL pointer */
1682   usr=(swig_lua_userdata*)lua_touserdata(L,index);  /* get data */
1683   if (usr)
1684   {
1685     if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
1686     {
1687         usr->own=0;
1688     }
1689     if (!type)            /* special cast void*, no casting fn */
1690     {
1691       *ptr=usr->ptr;
1692       return SWIG_OK; /* ok */
1693     }
1694     cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
1695     if (cast)
1696     {
1697       int newmemory = 0;
1698       *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
1699       assert(!newmemory); /* newmemory handling not yet implemented */
1700       return SWIG_OK;  /* ok */
1701     }
1702   }
1703   return SWIG_ERROR;  /* error */
1704 }
1705
1706 SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags,
1707        int argnum,const char* func_name){
1708   void* result;
1709   if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
1710     luaL_error (L,"Error in %s, expected a %s at argument number %d\n",
1711                 func_name,(type && type->str)?type->str:"void*",argnum);
1712   }
1713   return result;
1714 }
1715
1716 /* pushes a packed userdata. user for member fn pointers only */
1717 SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type)
1718 {
1719   swig_lua_rawdata* raw;
1720   assert(ptr); /* not acceptable to pass in a NULL value */
1721   raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size);  /* alloc data */
1722   raw->type=type;
1723   raw->own=0;
1724   memcpy(raw->data,ptr,size); /* copy the data */
1725   _SWIG_Lua_AddMetatable(L,type); /* add metatable */
1726 }
1727     
1728 /* converts a packed userdata. user for member fn pointers only */
1729 SWIGRUNTIME int  SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type)
1730 {
1731   swig_lua_rawdata* raw;
1732   raw=(swig_lua_rawdata*)lua_touserdata(L,index);  /* get data */
1733   if (!raw) return SWIG_ERROR;  /* error */
1734   if (type==0 || type==raw->type) /* void* or identical type */
1735   {
1736     memcpy(ptr,raw->data,size); /* copy it */
1737     return SWIG_OK; /* ok */
1738   }
1739   return SWIG_ERROR;  /* error */
1740 }
1741
1742 /* a function to get the typestring of a piece of data */
1743 SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
1744 {
1745   swig_lua_userdata* usr;
1746   if (lua_isuserdata(L,tp))
1747   {
1748     usr=(swig_lua_userdata*)lua_touserdata(L,tp);  /* get data */
1749     if (usr && usr->type && usr->type->str)
1750       return usr->type->str;
1751     return "userdata (unknown type)";
1752   }
1753   return lua_typename(L,lua_type(L,tp));
1754 }
1755
1756 /* lua callable function to get the userdata's type */
1757 SWIGRUNTIME int SWIG_Lua_type(lua_State* L)
1758 {
1759   lua_pushstring(L,SWIG_Lua_typename(L,1));
1760   return 1;
1761 }
1762
1763 /* lua callable function to compare userdata's value
1764 the issue is that two userdata may point to the same thing
1765 but to lua, they are different objects */
1766 SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
1767 {
1768   int result;
1769   swig_lua_userdata *usr1,*usr2;
1770   if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2))  /* just in case */
1771     return 0;  /* nil reply */
1772   usr1=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
1773   usr2=(swig_lua_userdata*)lua_touserdata(L,2);  /* get data */
1774   /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
1775   result=(usr1->ptr==usr2->ptr);
1776    lua_pushboolean(L,result);
1777   return 1;
1778 }
1779
1780 /* -----------------------------------------------------------------------------
1781  * global variable support code: class/struct typemap functions
1782  * ----------------------------------------------------------------------------- */
1783
1784 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
1785 /* Install Constants */
1786 SWIGINTERN void
1787 SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
1788   int i;
1789   for (i = 0; constants[i].type; i++) {
1790     switch(constants[i].type) {
1791     case SWIG_LUA_INT:
1792       lua_pushstring(L,constants[i].name);
1793       lua_pushnumber(L,(lua_Number)constants[i].lvalue);
1794       lua_rawset(L,-3);
1795       break;
1796     case SWIG_LUA_FLOAT:
1797       lua_pushstring(L,constants[i].name);
1798       lua_pushnumber(L,(lua_Number)constants[i].dvalue);
1799       lua_rawset(L,-3);
1800       break;
1801     case SWIG_LUA_CHAR:
1802       lua_pushstring(L,constants[i].name);
1803       lua_pushfstring(L,"%c",(char)constants[i].lvalue);
1804       lua_rawset(L,-3);
1805       break;
1806     case SWIG_LUA_STRING:
1807       lua_pushstring(L,constants[i].name);
1808       lua_pushstring(L,(char *) constants[i].pvalue);
1809       lua_rawset(L,-3);
1810       break;
1811     case SWIG_LUA_POINTER:
1812       lua_pushstring(L,constants[i].name);
1813       SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
1814       lua_rawset(L,-3);
1815       break;
1816     case SWIG_LUA_BINARY:
1817       lua_pushstring(L,constants[i].name);
1818       SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
1819       lua_rawset(L,-3);
1820       break;
1821     default:
1822       break;
1823     }
1824   }
1825 }
1826 #endif
1827
1828 /* -----------------------------------------------------------------------------
1829  * executing lua code from within the wrapper
1830  * ----------------------------------------------------------------------------- */
1831
1832 #ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
1833 #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
1834 #endif
1835 /* Executes a C string in Lua which is a really simple way of calling lua from C
1836 Unfortunately lua keeps changing its APIs, so we need a conditional compile
1837 In lua 5.0.X its lua_dostring()
1838 In lua 5.1.X its luaL_dostring()
1839 */
1840 SWIGINTERN int 
1841 SWIG_Lua_dostring(lua_State *L, const char* str) {
1842   int ok,top;
1843   if (str==0 || str[0]==0) return 0; /* nothing to do */
1844   top=lua_gettop(L); /* save stack */
1845 #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
1846   ok=luaL_dostring(L,str);      /* looks like this is lua 5.1.X or later, good */
1847 #else
1848   ok=lua_dostring(L,str);       /* might be lua 5.0.x, using lua_dostring */
1849 #endif
1850   if (ok!=0) {
1851     SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
1852   }
1853   lua_settop(L,top); /* restore the stack */
1854   return ok;
1855 }    
1856
1857 #ifdef __cplusplus
1858 // removed: }
1859 #endif
1860
1861 /* ------------------------------ end luarun.swg  ------------------------------ */
1862
1863
1864 /* -------- TYPES TABLE (BEGIN) -------- */
1865
1866 #define SWIGTYPE_p_Addr swig_types[0]
1867 #define SWIGTYPE_p_Device swig_types[1]
1868 #define SWIGTYPE_p_Generic_device swig_types[2]
1869 #define SWIGTYPE_p_Gpio_resource swig_types[3]
1870 #define SWIGTYPE_p_Hw__Device swig_types[4]
1871 #define SWIGTYPE_p_Hw__Device__Prop_val swig_types[5]
1872 #define SWIGTYPE_p_Hw__Device_factory swig_types[6]
1873 #define SWIGTYPE_p_L4Re__Rm__Auto_regionT_l4_addr_t_t swig_types[7]
1874 #define SWIGTYPE_p_Mmio_data_space swig_types[8]
1875 #define SWIGTYPE_p_Resource swig_types[9]
1876 #define SWIGTYPE_p_Resource_provider swig_types[10]
1877 #define SWIGTYPE_p_Resource_space swig_types[11]
1878 #define SWIGTYPE_p_Root_resource swig_types[12]
1879 #define SWIGTYPE_p_Size swig_types[13]
1880 #define SWIGTYPE_p_Vi__Dev_factory swig_types[14]
1881 #define SWIGTYPE_p_Vi__Device swig_types[15]
1882 #define SWIGTYPE_p_l4vbus_device_handle_t swig_types[16]
1883 #define SWIGTYPE_p_std__string swig_types[17]
1884 static swig_type_info *swig_types[19];
1885 static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
1886 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1887 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1888
1889 /* -------- TYPES TABLE (END) -------- */
1890
1891 #define SWIG_name      "Io"
1892 #define SWIG_init      luaopen_Io
1893 #define SWIG_init_user luaopen_Io_user
1894
1895 #define SWIG_LUACODE   luaopen_Io_luacode
1896
1897 namespace swig {
1898 typedef struct{} LANGUAGE_OBJ;
1899 }
1900
1901
1902 #ifdef __cplusplus      /* generic alloc/dealloc fns*/
1903 #define SWIG_ALLOC_ARRAY(TYPE,LEN)      new TYPE[LEN]
1904 #define SWIG_FREE_ARRAY(PTR)            delete[] PTR
1905 #else
1906 #define SWIG_ALLOC_ARRAY(TYPE,LEN)      (TYPE *)malloc(LEN*sizeof(TYPE))
1907 #define SWIG_FREE_ARRAY(PTR)            free(PTR)
1908 #endif
1909 /* counting the size of arrays:*/
1910 SWIGINTERN int SWIG_itable_size(lua_State* L, int index)
1911 {
1912         int n=0;
1913         while(1){
1914                 lua_rawgeti(L,index,n+1);
1915                 if (lua_isnil(L,-1))break;
1916                 ++n;
1917                 lua_pop(L,1);
1918         }
1919         lua_pop(L,1);
1920         return n;
1921 }
1922
1923 SWIGINTERN int SWIG_table_size(lua_State* L, int index)
1924 {
1925         int n=0;
1926         lua_pushnil(L);  /* first key*/
1927         while (lua_next(L, index) != 0) {
1928                 ++n;
1929                 lua_pop(L, 1);  /* removes `value'; keeps `key' for next iteration*/
1930         }
1931         return n;
1932 }
1933
1934 /* super macro to declare array typemap helper fns */
1935 #define SWIG_DECLARE_TYPEMAP_ARR_FN(NAME,TYPE)\
1936         SWIGINTERN int SWIG_read_##NAME##_num_array(lua_State* L,int index,TYPE *array,int size){\
1937                 int i;\
1938                 for (i = 0; i < size; i++) {\
1939                         lua_rawgeti(L,index,i+1);\
1940                         if (lua_isnumber(L,-1)){\
1941                                 array[i] = (TYPE)lua_tonumber(L,-1);\
1942                         } else {\
1943                                 lua_pop(L,1);\
1944                                 return 0;\
1945                         }\
1946                         lua_pop(L,1);\
1947                 }\
1948                 return 1;\
1949         }\
1950         SWIGINTERN TYPE* SWIG_get_##NAME##_num_array_fixed(lua_State* L, int index, int size){\
1951                 TYPE *array;\
1952                 if (!lua_istable(L,index) || SWIG_itable_size(L,index) != size) {\
1953                         SWIG_Lua_pushferrstring(L,"expected a table of size %d",size);\
1954                         return 0;\
1955                 }\
1956                 array=SWIG_ALLOC_ARRAY(TYPE,size);\
1957                 if (!SWIG_read_##NAME##_num_array(L,index,array,size)){\
1958                         SWIG_Lua_pusherrstring(L,"table must contain numbers");\
1959                         SWIG_FREE_ARRAY(array);\
1960                         return 0;\
1961                 }\
1962                 return array;\
1963         }\
1964         SWIGINTERN TYPE* SWIG_get_##NAME##_num_array_var(lua_State* L, int index, int* size)\
1965         {\
1966                 TYPE *array;\
1967                 if (!lua_istable(L,index)) {\
1968                         SWIG_Lua_pusherrstring(L,"expected a table");\
1969                         return 0;\
1970                 }\
1971                 *size=SWIG_itable_size(L,index);\
1972                 if (*size<1){\
1973                         SWIG_Lua_pusherrstring(L,"table appears to be empty");\
1974                         return 0;\
1975                 }\
1976                 array=SWIG_ALLOC_ARRAY(TYPE,*size);\
1977                 if (!SWIG_read_##NAME##_num_array(L,index,array,*size)){\
1978                         SWIG_Lua_pusherrstring(L,"table must contain numbers");\
1979                         SWIG_FREE_ARRAY(array);\
1980                         return 0;\
1981                 }\
1982                 return array;\
1983         }\
1984         SWIGINTERN void SWIG_write_##NAME##_num_array(lua_State* L,TYPE *array,int size){\
1985                 int i;\
1986                 lua_newtable(L);\
1987                 for (i = 0; i < size; i++){\
1988                         lua_pushnumber(L,(lua_Number)array[i]);\
1989                         lua_rawseti(L,-2,i+1);/* -1 is the number, -2 is the table*/ \
1990                 }\
1991         }
1992
1993 SWIG_DECLARE_TYPEMAP_ARR_FN(schar,signed char);
1994 SWIG_DECLARE_TYPEMAP_ARR_FN(uchar,unsigned char);
1995 SWIG_DECLARE_TYPEMAP_ARR_FN(int,int);
1996 SWIG_DECLARE_TYPEMAP_ARR_FN(uint,unsigned int);
1997 SWIG_DECLARE_TYPEMAP_ARR_FN(short,short);
1998 SWIG_DECLARE_TYPEMAP_ARR_FN(ushort,unsigned short);
1999 SWIG_DECLARE_TYPEMAP_ARR_FN(long,long);
2000 SWIG_DECLARE_TYPEMAP_ARR_FN(ulong,unsigned long);
2001 SWIG_DECLARE_TYPEMAP_ARR_FN(float,float);
2002 SWIG_DECLARE_TYPEMAP_ARR_FN(double,double);
2003
2004 SWIGINTERN int SWIG_read_ptr_array(lua_State* L,int index,void **array,int size,swig_type_info *type){
2005         int i;
2006         for (i = 0; i < size; i++) {
2007                 lua_rawgeti(L,index,i+1);
2008                 if (!lua_isuserdata(L,-1) || SWIG_ConvertPtr(L,-1,&array[i],type,0)==-1){
2009                         lua_pop(L,1);
2010                         return 0;
2011                 }
2012                 lua_pop(L,1);
2013         }
2014         return 1;
2015 }
2016 SWIGINTERN void** SWIG_get_ptr_array_fixed(lua_State* L, int index, int size,swig_type_info *type){
2017         void **array;
2018         if (!lua_istable(L,index) || SWIG_itable_size(L,index) != size) {
2019                 SWIG_Lua_pushferrstring(L,"expected a table of size %d",size);
2020                 return 0;
2021         }
2022         array=SWIG_ALLOC_ARRAY(void*,size);
2023         if (!SWIG_read_ptr_array(L,index,array,size,type)){
2024                 SWIG_Lua_pushferrstring(L,"table must contain pointers of type %s",type->name);
2025                 SWIG_FREE_ARRAY(array);
2026                 return 0;
2027         }
2028         return array;
2029 }
2030 SWIGINTERN void** SWIG_get_ptr_array_var(lua_State* L, int index, int* size,swig_type_info *type){
2031         void **array;
2032         if (!lua_istable(L,index)) {
2033                 SWIG_Lua_pusherrstring(L,"expected a table");
2034                 return 0;
2035         }
2036         *size=SWIG_itable_size(L,index);
2037         if (*size<1){
2038                 SWIG_Lua_pusherrstring(L,"table appears to be empty");
2039                 return 0;
2040         }
2041         array=SWIG_ALLOC_ARRAY(void*,*size);
2042         if (!SWIG_read_ptr_array(L,index,array,*size,type)){
2043                 SWIG_Lua_pushferrstring(L,"table must contain pointers of type %s",type->name);
2044                 SWIG_FREE_ARRAY(array);
2045                 return 0;
2046         }
2047         return array;
2048 }
2049 SWIGINTERN void SWIG_write_ptr_array(lua_State* L,void **array,int size,swig_type_info *type,int own){
2050         int i;
2051         lua_newtable(L);
2052         for (i = 0; i < size; i++){
2053                 SWIG_NewPointerObj(L,array[i],type,own);
2054                 lua_rawseti(L,-2,i+1);/* -1 is the number, -2 is the table*/
2055         }
2056 }
2057
2058
2059 #define SWIG_RECURSIVE_DEFINED defined
2060
2061
2062 #include <string>
2063
2064
2065 SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
2066   int ret = lua_isstring(L, idx);
2067   if (!ret)
2068    ret = lua_isnil(L, idx);
2069   return ret;
2070 }
2071
2072
2073 inline int swig_class(lua_State *L)
2074 {
2075   char const *name = lua_tostring(L, 1);
2076   SWIG_Lua_get_class_metatable(L, name);
2077   return 1;
2078 }
2079
2080 inline int swig_instance_of(lua_State *L)
2081 {
2082   swig_lua_userdata* usr;
2083   if (lua_isnil(L,1) || !lua_isstring(L,2))
2084     {
2085       lua_pushboolean(L, false);
2086       return 1;
2087     }
2088
2089   char const *type = lua_tostring(L,2);
2090
2091   usr=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
2092   if (!usr)
2093   {
2094     lua_pushboolean(L, false);
2095     return 1;
2096   }
2097
2098   swig_module_info* module=SWIG_GetModule(L);
2099   swig_type_info *to = SWIG_TypeQueryModule(module, module, type);
2100   if (!to)
2101     {
2102       lua_pushboolean(L, false);
2103       return 1;
2104     }
2105
2106   swig_cast_info *iter = to->cast;
2107   while (iter)
2108     {
2109       if (iter->type == usr->type)
2110         {
2111           lua_pushboolean(L, true);
2112           return 1;
2113         }
2114       iter = iter->next;
2115     }
2116   lua_pushboolean(L, false);
2117   return 1;
2118 }
2119
2120
2121
2122 #include "virt/vdevice.h"
2123 #include "virt/vbus_factory.h"
2124 #include "hw_device.h"
2125 #include "gpio"
2126
2127 static int is_lua_propval(lua_State *L, int idx)
2128 {
2129   if (lua_isnumber(L, idx))
2130     return 1;
2131   if (lua_isstring(L, idx))
2132     return 1;
2133   return 0;
2134 }
2135
2136 static Hw::Device::Prop_val to_lua_propval(lua_State *L, int idx)
2137 {
2138   if (lua_isnumber(L, idx))
2139     return Hw::Device::Prop_val(lua_tointeger(L, idx));
2140   else if (lua_isstring(L, idx))
2141     return Hw::Device::Prop_val(lua_tostring(L, idx));
2142   return 0;
2143 }
2144
2145 int luaopen_Io(lua_State *);
2146 int add_vbus(Vi::Device *dev);
2147 void dump_devs(Device *d);
2148
2149
2150 SWIGINTERN int Generic_device_nresources(Generic_device const *self){
2151     return self->resources()->size();
2152   }
2153 SWIGINTERN Resource *Generic_device_resource(Generic_device const *self,int idx){
2154     return self->resources()->at(idx);
2155   }
2156 SWIGINTERN void Vi_Device_set_name(Vi::Device *self,char const *name){ self->name(name); }
2157 SWIGINTERN Hw::Device *Hw_Device_find_by_name(Hw::Device const *self,std::string const &name){
2158     for (Hw::Device::iterator c = self->begin(0);
2159          c != self->end(); ++c)
2160       if (name == (*c)->name())
2161         return *c;
2162
2163     return 0;
2164   }
2165 SWIGINTERN Hw::Device *Hw_Device___getitem(Hw::Device const *self,std::string const &name){
2166     for (Hw::Device::iterator c = self->begin(0);
2167          c != self->end(); ++c)
2168       if (name == (*c)->name())
2169         return *c;
2170
2171     return 0;
2172   }
2173 SWIGINTERN void Hw_Device___setitem(Hw::Device *self,std::string const &name,Hw::Device *dev){
2174     dev->set_name(name);
2175     self->add_child(dev);
2176     if (self->parent() || self == system_bus())
2177       dev->plugin();
2178   }
2179 #ifdef __cplusplus
2180 // removed: extern "C" {
2181 #endif
2182 static int _wrap_new_string__SWIG_0(lua_State* L) { int SWIG_arg = 0; std::string *result = 0 ;
2183   SWIG_check_num_args("std::string::string",0,0) result = (std::string *)new std::string();
2184   SWIG_NewPointerObj(L,result,SWIGTYPE_p_std__string,1); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2185   return SWIG_arg; }
2186 static int _wrap_new_string__SWIG_1(lua_State* L) { int SWIG_arg = 0; char *arg1 = (char *) 0 ; std::string *result = 0 ;
2187   SWIG_check_num_args("std::string::string",1,1)
2188   if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("std::string::string",1,"char const *"); arg1 = (char *)lua_tostring(L, 1);
2189   result = (std::string *)new std::string((char const *)arg1);
2190   SWIG_NewPointerObj(L,result,SWIGTYPE_p_std__string,1); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2191   return SWIG_arg; }
2192 static int _wrap_new_string(lua_State* L) { int argc; int argv[2]={ 1,2} ; argc = lua_gettop(L); if (argc == 0) {
2193     return _wrap_new_string__SWIG_0(L);}  if (argc == 1) { int _v; { _v = SWIG_lua_isnilstring(L,argv[0]); }  if (_v) {
2194       return _wrap_new_string__SWIG_1(L);}  }  SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_string'\n"
2195   "  Possible C/C++ prototypes are:\n" "    std::string::string()\n" "    std::string::string(char const *)\n");
2196   lua_error(L);return 0; }
2197 static int _wrap_string_size(lua_State* L) { int SWIG_arg = 0; std::string *arg1 = (std::string *) 0 ; unsigned int result;
2198   SWIG_check_num_args("std::string::size",1,1)
2199   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::size",1,"std::string const *");
2200   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
2201     SWIG_fail_ptr("string_size",1,SWIGTYPE_p_std__string); }  result = (unsigned int)((std::string const *)arg1)->size();
2202   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2203 static int _wrap_string_length(lua_State* L) { int SWIG_arg = 0; std::string *arg1 = (std::string *) 0 ; unsigned int result;
2204   SWIG_check_num_args("std::string::length",1,1)
2205   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::length",1,"std::string const *");
2206   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
2207     SWIG_fail_ptr("string_length",1,SWIGTYPE_p_std__string); }  result = (unsigned int)((std::string const *)arg1)->length();
2208   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2209 static int _wrap_string_empty(lua_State* L) { int SWIG_arg = 0; std::string *arg1 = (std::string *) 0 ; bool result;
2210   SWIG_check_num_args("std::string::empty",1,1)
2211   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::empty",1,"std::string const *");
2212   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
2213     SWIG_fail_ptr("string_empty",1,SWIGTYPE_p_std__string); }  result = (bool)((std::string const *)arg1)->empty();
2214   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2215 static int _wrap_string_c_str(lua_State* L) { int SWIG_arg = 0; std::string *arg1 = (std::string *) 0 ; char *result = 0 ;
2216   SWIG_check_num_args("std::string::c_str",1,1)
2217   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::c_str",1,"std::string const *");
2218   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
2219     SWIG_fail_ptr("string_c_str",1,SWIGTYPE_p_std__string); }  result = (char *)((std::string const *)arg1)->c_str();
2220   lua_pushstring(L,(const char *)result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2221 static int _wrap_string_data(lua_State* L) { int SWIG_arg = 0; std::string *arg1 = (std::string *) 0 ; char *result = 0 ;
2222   SWIG_check_num_args("std::string::data",1,1)
2223   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::data",1,"std::string const *");
2224   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
2225     SWIG_fail_ptr("string_data",1,SWIGTYPE_p_std__string); }  result = (char *)((std::string const *)arg1)->data();
2226   lua_pushstring(L,(const char *)result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2227 static int _wrap_string_assign(lua_State* L) { int SWIG_arg = 0; std::string *arg1 = (std::string *) 0 ;
2228   char *arg2 = (char *) 0 ; SWIG_check_num_args("std::string::assign",2,2)
2229   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::assign",1,"std::string *");
2230   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("std::string::assign",2,"char const *");
2231   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
2232     SWIG_fail_ptr("string_assign",1,SWIGTYPE_p_std__string); }  arg2 = (char *)lua_tostring(L, 2);
2233   (arg1)->assign((char const *)arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2234 static void swig_delete_string(void *obj) {
2235 std::string *arg1 = (std::string *) obj;
2236 delete arg1;
2237 }
2238 static swig_lua_method swig_std_string_methods[] = {
2239     {"size", _wrap_string_size}, 
2240     {"length", _wrap_string_length}, 
2241     {"empty", _wrap_string_empty}, 
2242     {"c_str", _wrap_string_c_str}, 
2243     {"data", _wrap_string_data}, 
2244     {"assign", _wrap_string_assign}, 
2245     {0,0}
2246 };
2247 static swig_lua_attribute swig_std_string_attributes[] = {
2248     {0,0,0}
2249 };
2250 static swig_lua_attribute swig_std_string_cls_attributes[] = {
2251     {0,0,0}
2252 };
2253 static swig_lua_method swig_std_string_cls_methods[] = {
2254     {0,0}
2255 };
2256 static swig_lua_const_info swig_std_string_cls_constants[] = {
2257     {0,0,0,0,0,0}
2258 };
2259 static swig_lua_class *swig_std_string_bases[] = {0};
2260 static const char *swig_std_string_base_names[] = {0};
2261 static swig_lua_class _wrap_class_std_string = { "string", &SWIGTYPE_p_std__string,_wrap_new_string, swig_delete_string, swig_std_string_methods, swig_std_string_attributes, { "string", swig_std_string_cls_methods, swig_std_string_cls_attributes, swig_std_string_cls_constants }, swig_std_string_bases, swig_std_string_base_names };
2262
2263 static int _wrap_Resource_irq_is_level_triggered(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2264   bool result; SWIG_check_num_args("Resource::irq_is_level_triggered",1,1)
2265   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::irq_is_level_triggered",1,"Resource const *");
2266   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2267     SWIG_fail_ptr("Resource_irq_is_level_triggered",1,SWIGTYPE_p_Resource); } 
2268   result = (bool)((Resource const *)arg1)->irq_is_level_triggered(); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
2269   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2270 static int _wrap_Resource_irq_is_low_polarity(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2271   SWIG_check_num_args("Resource::irq_is_low_polarity",1,1)
2272   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::irq_is_low_polarity",1,"Resource const *");
2273   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2274     SWIG_fail_ptr("Resource_irq_is_low_polarity",1,SWIGTYPE_p_Resource); } 
2275   result = (bool)((Resource const *)arg1)->irq_is_low_polarity(); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
2276   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2277 static int _wrap_new_Resource__SWIG_0(lua_State* L) { int SWIG_arg = 0; unsigned long arg1 ; Resource *result = 0 ;
2278   SWIG_check_num_args("Resource::Resource",1,1) if(!lua_isnumber(L,1)) SWIG_fail_arg("Resource::Resource",1,"unsigned long"); 
2279   arg1 = (unsigned long)lua_tointeger(L, 1); result = (Resource *)new Resource(arg1);
2280   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Resource,1); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2281   return SWIG_arg; }
2282 static int _wrap_new_Resource__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *result = 0 ;
2283   SWIG_check_num_args("Resource::Resource",0,0) result = (Resource *)new Resource();
2284   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Resource,1); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2285   return SWIG_arg; }
2286 static int _wrap_new_Resource__SWIG_2(lua_State* L) { int SWIG_arg = 0; unsigned long arg1 ; Resource::Addr arg2 ;
2287   Resource::Addr arg3 ; Resource *result = 0 ; SWIG_check_num_args("Resource::Resource",3,3)
2288   if(!lua_isnumber(L,1)) SWIG_fail_arg("Resource::Resource",1,"unsigned long"); arg1 = (unsigned long)lua_tointeger(L, 1);
2289 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2290    if (lua_isinteger(L, 2)) arg2 = (l4_uint32_t)lua_tointeger(L, 2);else
2291 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2292    if (lua_isinteger(L, 2)) arg2 = lua_tointeger(L, 2);else
2293 #endif
2294    if (lua_isstring(L, 2)) { char *e = 0; char const *s = lua_tostring(L, 2); l4_uint64_t a = strtoull(s, &e, 0);
2295     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg2 = a; } 
2296   else if (lua_isnumber(L, 2)) arg2 = lua_tonumber(L, 2); else {
2297     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 2))); SWIG_fail; }
2298 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2299    if (lua_isinteger(L, 3)) arg3 = (l4_uint32_t)lua_tointeger(L, 3);else
2300 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2301    if (lua_isinteger(L, 3)) arg3 = lua_tointeger(L, 3);else
2302 #endif
2303    if (lua_isstring(L, 3)) { char *e = 0; char const *s = lua_tostring(L, 3); l4_uint64_t a = strtoull(s, &e, 0);
2304     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg3 = a; } 
2305   else if (lua_isnumber(L, 3)) arg3 = lua_tonumber(L, 3); else {
2306     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 3))); SWIG_fail; } 
2307   result = (Resource *)new Resource(arg1,arg2,arg3); SWIG_NewPointerObj(L,result,SWIGTYPE_p_Resource,1); SWIG_arg++; 
2308   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2309 static int _wrap_new_Resource__SWIG_3(lua_State* L) { int SWIG_arg = 0; unsigned int arg1 ; unsigned long arg2 ;
2310   Resource::Addr arg3 ; Resource::Addr arg4 ; Resource *result = 0 ; SWIG_check_num_args("Resource::Resource",4,4)
2311   if(!lua_isnumber(L,1)) SWIG_fail_arg("Resource::Resource",1,"unsigned int");
2312   if(!lua_isnumber(L,2)) SWIG_fail_arg("Resource::Resource",2,"unsigned long");  arg1 = (unsigned int)lua_tointeger(L, 1); arg2 = (unsigned long)lua_tointeger(L, 2);
2313 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2314    if (lua_isinteger(L, 3)) arg3 = (l4_uint32_t)lua_tointeger(L, 3);else
2315 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2316    if (lua_isinteger(L, 3)) arg3 = lua_tointeger(L, 3);else
2317 #endif
2318    if (lua_isstring(L, 3)) { char *e = 0; char const *s = lua_tostring(L, 3); l4_uint64_t a = strtoull(s, &e, 0);
2319     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg3 = a; } 
2320   else if (lua_isnumber(L, 3)) arg3 = lua_tonumber(L, 3); else {
2321     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 3))); SWIG_fail; }
2322 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2323    if (lua_isinteger(L, 4)) arg4 = (l4_uint32_t)lua_tointeger(L, 4);else
2324 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2325    if (lua_isinteger(L, 4)) arg4 = lua_tointeger(L, 4);else
2326 #endif
2327    if (lua_isstring(L, 4)) { char *e = 0; char const *s = lua_tostring(L, 4); l4_uint64_t a = strtoull(s, &e, 0);
2328     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg4 = a; } 
2329   else if (lua_isnumber(L, 4)) arg4 = lua_tonumber(L, 4); else {
2330     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 4))); SWIG_fail; } 
2331   result = (Resource *)new Resource(arg1,arg2,arg3,arg4); SWIG_NewPointerObj(L,result,SWIGTYPE_p_Resource,1); SWIG_arg++; 
2332   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2333 static int _wrap_new_Resource(lua_State* L) { int argc; int argv[5]={ 1,2,3,4,5} ; argc = lua_gettop(L); if (argc == 0) {
2334     return _wrap_new_Resource__SWIG_1(L);}  if (argc == 1) { int _v; { _v = lua_isnumber(L,argv[0]); }  if (_v) {
2335       return _wrap_new_Resource__SWIG_0(L);}  }  if (argc == 3) { int _v; { _v = lua_isnumber(L,argv[0]); }  if (_v) { {
2336         _v = lua_isnumber(L, argv[1]) || lua_isstring(L, argv[1]); }  if (_v) { {
2337           _v = lua_isnumber(L, argv[2]) || lua_isstring(L, argv[2]); }  if (_v) { return _wrap_new_Resource__SWIG_2(L);}  }  }  }
2338    if (argc == 4) { int _v; { _v = lua_isnumber(L,argv[0]); }  if (_v) { { _v = lua_isnumber(L,argv[1]); }  if (_v) { {
2339           _v = lua_isnumber(L, argv[2]) || lua_isstring(L, argv[2]); }  if (_v) { {
2340             _v = lua_isnumber(L, argv[3]) || lua_isstring(L, argv[3]); }  if (_v) { return _wrap_new_Resource__SWIG_3(L);}  }  }
2341        }  }  SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_Resource'\n"
2342   "  Possible C/C++ prototypes are:\n" "    Resource::Resource(unsigned long)\n" "    Resource::Resource()\n"
2343   "    Resource::Resource(unsigned long,Resource::Addr,Resource::Addr)\n"
2344   "    Resource::Resource(unsigned int,unsigned long,Resource::Addr,Resource::Addr)\n"); lua_error(L);return 0; }
2345 static int _wrap_Resource_flags(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; unsigned long result;
2346   SWIG_check_num_args("Resource::flags",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::flags",1,"Resource const *");
2347   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2348     SWIG_fail_ptr("Resource_flags",1,SWIGTYPE_p_Resource); }  result = (unsigned long)((Resource const *)arg1)->flags();
2349   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2350 static int _wrap_Resource_add_flags(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; unsigned long arg2 ;
2351   SWIG_check_num_args("Resource::add_flags",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::add_flags",1,"Resource *");
2352   if(!lua_isnumber(L,2)) SWIG_fail_arg("Resource::add_flags",2,"unsigned long");
2353   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2354     SWIG_fail_ptr("Resource_add_flags",1,SWIGTYPE_p_Resource); }   arg2 = (unsigned long)lua_tointeger(L, 2);
2355   (arg1)->add_flags(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2356 static int _wrap_Resource_del_flags(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; unsigned long arg2 ;
2357   SWIG_check_num_args("Resource::del_flags",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::del_flags",1,"Resource *");
2358   if(!lua_isnumber(L,2)) SWIG_fail_arg("Resource::del_flags",2,"unsigned long");
2359   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2360     SWIG_fail_ptr("Resource_del_flags",1,SWIGTYPE_p_Resource); }   arg2 = (unsigned long)lua_tointeger(L, 2);
2361   (arg1)->del_flags(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2362 static int _wrap_Resource_hierarchical(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2363   SWIG_check_num_args("Resource::hierarchical",1,1)
2364   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::hierarchical",1,"Resource const *");
2365   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2366     SWIG_fail_ptr("Resource_hierarchical",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->hierarchical();
2367   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2368 static int _wrap_Resource_disabled(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2369   SWIG_check_num_args("Resource::disabled",1,1)
2370   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::disabled",1,"Resource const *");
2371   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2372     SWIG_fail_ptr("Resource_disabled",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->disabled();
2373   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2374 static int _wrap_Resource_prefetchable(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2375   SWIG_check_num_args("Resource::prefetchable",1,1)
2376   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::prefetchable",1,"Resource const *");
2377   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2378     SWIG_fail_ptr("Resource_prefetchable",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->prefetchable();
2379   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2380 static int _wrap_Resource_empty(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2381   SWIG_check_num_args("Resource::empty",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::empty",1,"Resource const *");
2382   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2383     SWIG_fail_ptr("Resource_empty",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->empty();
2384   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2385 static int _wrap_Resource_fixed_addr(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2386   SWIG_check_num_args("Resource::fixed_addr",1,1)
2387   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::fixed_addr",1,"Resource const *");
2388   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2389     SWIG_fail_ptr("Resource_fixed_addr",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->fixed_addr();
2390   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2391 static int _wrap_Resource_fixed_size(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2392   SWIG_check_num_args("Resource::fixed_size",1,1)
2393   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::fixed_size",1,"Resource const *");
2394   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2395     SWIG_fail_ptr("Resource_fixed_size",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->fixed_size();
2396   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2397 static int _wrap_Resource_relative(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2398   SWIG_check_num_args("Resource::relative",1,1)
2399   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::relative",1,"Resource const *");
2400   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2401     SWIG_fail_ptr("Resource_relative",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->relative();
2402   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2403 static int _wrap_Resource_type(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; unsigned int result;
2404   SWIG_check_num_args("Resource::type",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::type",1,"Resource const *");
2405   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2406     SWIG_fail_ptr("Resource_type",1,SWIGTYPE_p_Resource); }  result = (unsigned int)((Resource const *)arg1)->type();
2407   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2408 static int _wrap_Resource_lt_compare(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2409   Resource *arg2 = (Resource *) 0 ; bool result; SWIG_check_num_args("Resource::lt_compare",2,2)
2410   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::lt_compare",1,"Resource const *");
2411   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Resource::lt_compare",2,"Resource const *");
2412   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2413     SWIG_fail_ptr("Resource_lt_compare",1,SWIGTYPE_p_Resource); } 
2414   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Resource,0))){
2415     SWIG_fail_ptr("Resource_lt_compare",2,SWIGTYPE_p_Resource); } 
2416   result = (bool)((Resource const *)arg1)->lt_compare((Resource const *)arg2); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
2417   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2418 static int _wrap_Resource_str_to_id(lua_State* L) { int SWIG_arg = 0; char *arg1 = (char *) 0 ; l4_uint32_t result;
2419   SWIG_check_num_args("Resource::str_to_id",1,1)
2420   if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("Resource::str_to_id",1,"char const *"); arg1 = (char *)lua_tostring(L, 1);
2421   result = Resource::str_to_id((char const *)arg1); lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail;
2422   fail: lua_error(L); return SWIG_arg; }
2423 static int _wrap_Resource_set_id__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; l4_uint32_t arg2 ;
2424   SWIG_check_num_args("Resource::set_id",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::set_id",1,"Resource *");
2425   if(!lua_isnumber(L,2)) SWIG_fail_arg("Resource::set_id",2,"l4_uint32_t");
2426   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2427     SWIG_fail_ptr("Resource_set_id",1,SWIGTYPE_p_Resource); }   arg2 = (l4_uint32_t)lua_tointeger(L, 2); (arg1)->set_id(arg2);
2428   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2429 static int _wrap_Resource_set_id__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2430   char *arg2 = (char *) 0 ; SWIG_check_num_args("Resource::set_id",2,2)
2431   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::set_id",1,"Resource *");
2432   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("Resource::set_id",2,"char const *");
2433   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2434     SWIG_fail_ptr("Resource_set_id",1,SWIGTYPE_p_Resource); }  arg2 = (char *)lua_tostring(L, 2);
2435   (arg1)->set_id((char const *)arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2436 static int _wrap_Resource_set_id(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 2) { int _v;
2437     { void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2438         _v = 0; }  else { _v = 1; }  }  if (_v) { { _v = lua_isnumber(L, argv[1]);}  if (_v) {
2439         return _wrap_Resource_set_id__SWIG_0(L);}  }  }  if (argc == 2) { int _v; { void *ptr;
2440       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2441        else { _v = 1; }  }  if (_v) { { _v = SWIG_lua_isnilstring(L,argv[1]); }  if (_v) {
2442         return _wrap_Resource_set_id__SWIG_1(L);}  }  } 
2443   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_set_id'\n" "  Possible C/C++ prototypes are:\n"
2444   "    Resource::set_id(l4_uint32_t)\n" "    Resource::set_id(char const *)\n"); lua_error(L);return 0; }
2445 static int _wrap_Resource_id(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; l4_uint32_t result;
2446   SWIG_check_num_args("Resource::id",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::id",1,"Resource const *");
2447   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2448     SWIG_fail_ptr("Resource_id",1,SWIGTYPE_p_Resource); }  result = ((Resource const *)arg1)->id();
2449   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2450 static int _wrap_Resource_set_empty__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool arg2 ;
2451   SWIG_check_num_args("Resource::set_empty",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::set_empty",1,"Resource *");
2452   if(!lua_isboolean(L,2)) SWIG_fail_arg("Resource::set_empty",2,"bool");
2453   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2454     SWIG_fail_ptr("Resource_set_empty",1,SWIGTYPE_p_Resource); }  arg2 = (lua_toboolean(L, 2)!=0); (arg1)->set_empty(arg2);
2455   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2456 static int _wrap_Resource_disable(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2457   SWIG_check_num_args("Resource::disable",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::disable",1,"Resource *");
2458   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2459     SWIG_fail_ptr("Resource_disable",1,SWIGTYPE_p_Resource); }  (arg1)->disable(); return SWIG_arg; if(0) SWIG_fail; fail:
2460   lua_error(L); return SWIG_arg; }
2461 static int _wrap_Resource_enable(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2462   SWIG_check_num_args("Resource::enable",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::enable",1,"Resource *");
2463   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2464     SWIG_fail_ptr("Resource_enable",1,SWIGTYPE_p_Resource); }  (arg1)->enable(); return SWIG_arg; if(0) SWIG_fail; fail:
2465   lua_error(L); return SWIG_arg; }
2466 static int _wrap_Resource_provided(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2467   Resource_space *result = 0 ; SWIG_check_num_args("Resource::provided",1,1)
2468   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::provided",1,"Resource const *");
2469   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2470     SWIG_fail_ptr("Resource_provided",1,SWIGTYPE_p_Resource); } 
2471   result = (Resource_space *)((Resource const *)arg1)->provided();
2472   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Resource_space,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2473   return SWIG_arg; }
2474 static int _wrap_Resource_dump__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2475   char *arg2 = (char *) 0 ; int arg3 ; SWIG_check_num_args("Resource::dump",3,3)
2476   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::dump",1,"Resource const *");
2477   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("Resource::dump",2,"char const *");
2478   if(!lua_isnumber(L,3)) SWIG_fail_arg("Resource::dump",3,"int");
2479   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2480     SWIG_fail_ptr("Resource_dump",1,SWIGTYPE_p_Resource); }  arg2 = (char *)lua_tostring(L, 2); arg3 = (int)lua_tointeger(L, 3);
2481   ((Resource const *)arg1)->dump((char const *)arg2,arg3); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2482   return SWIG_arg; }
2483 static int _wrap_Resource_dump__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; int arg2 ;
2484   SWIG_check_num_args("Resource::dump",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::dump",1,"Resource const *");
2485   if(!lua_isnumber(L,2)) SWIG_fail_arg("Resource::dump",2,"int");
2486   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2487     SWIG_fail_ptr("Resource_dump",1,SWIGTYPE_p_Resource); }  arg2 = (int)lua_tointeger(L, 2);
2488   ((Resource const *)arg1)->dump(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2489 static int _wrap_Resource_dump__SWIG_2(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2490   SWIG_check_num_args("Resource::dump",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::dump",1,"Resource const *");
2491   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2492     SWIG_fail_ptr("Resource_dump",1,SWIGTYPE_p_Resource); }  ((Resource const *)arg1)->dump(); return SWIG_arg; if(0) SWIG_fail;
2493   fail: lua_error(L); return SWIG_arg; }
2494 static int _wrap_Resource_dump(lua_State* L) { int argc; int argv[4]={ 1,2,3,4} ; argc = lua_gettop(L); if (argc == 1) { int _v;
2495     { void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2496         _v = 0; }  else { _v = 1; }  }  if (_v) { return _wrap_Resource_dump__SWIG_2(L);}  }  if (argc == 2) { int _v; {
2497       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2498         _v = 0; }  else { _v = 1; }  }  if (_v) { { _v = lua_isnumber(L,argv[1]); }  if (_v) {
2499         return _wrap_Resource_dump__SWIG_1(L);}  }  }  if (argc == 3) { int _v; { void *ptr;
2500       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2501        else { _v = 1; }  }  if (_v) { { _v = SWIG_lua_isnilstring(L,argv[1]); }  if (_v) { { _v = lua_isnumber(L,argv[2]); } 
2502         if (_v) { return _wrap_Resource_dump__SWIG_0(L);}  }  }  } 
2503   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_dump'\n" "  Possible C/C++ prototypes are:\n"
2504   "    Resource::dump(char const *,int) const\n" "    Resource::dump(int) const\n" "    Resource::dump() const\n");
2505   lua_error(L);return 0; }
2506 static int _wrap_Resource_compatible__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2507   Resource *arg2 = (Resource *) 0 ; bool arg3 ; bool result; SWIG_check_num_args("Resource::compatible",3,3)
2508   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::compatible",1,"Resource const *");
2509   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Resource::compatible",2,"Resource *");
2510   if(!lua_isboolean(L,3)) SWIG_fail_arg("Resource::compatible",3,"bool");
2511   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2512     SWIG_fail_ptr("Resource_compatible",1,SWIGTYPE_p_Resource); } 
2513   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Resource,0))){
2514     SWIG_fail_ptr("Resource_compatible",2,SWIGTYPE_p_Resource); }  arg3 = (lua_toboolean(L, 3)!=0);
2515   result = (bool)((Resource const *)arg1)->compatible(arg2,arg3); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
2516   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2517 static int _wrap_Resource_compatible__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2518   Resource *arg2 = (Resource *) 0 ; bool result; SWIG_check_num_args("Resource::compatible",2,2)
2519   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::compatible",1,"Resource const *");
2520   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Resource::compatible",2,"Resource *");
2521   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2522     SWIG_fail_ptr("Resource_compatible",1,SWIGTYPE_p_Resource); } 
2523   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Resource,0))){
2524     SWIG_fail_ptr("Resource_compatible",2,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->compatible(arg2);
2525   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2526 static int _wrap_Resource_compatible(lua_State* L) { int argc; int argv[4]={ 1,2,3,4} ; argc = lua_gettop(L); if (argc == 2) {
2527     int _v; { void *ptr;
2528       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2529        else { _v = 1; }  }  if (_v) { { void *ptr;
2530         if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2531          else { _v = 1; }  }  if (_v) { return _wrap_Resource_compatible__SWIG_1(L);}  }  }  if (argc == 3) { int _v; {
2532       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2533         _v = 0; }  else { _v = 1; }  }  if (_v) { { void *ptr;
2534         if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2535          else { _v = 1; }  }  if (_v) { { _v = lua_isboolean(L,argv[2]); }  if (_v) {
2536           return _wrap_Resource_compatible__SWIG_0(L);}  }  }  } 
2537   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_compatible'\n"
2538   "  Possible C/C++ prototypes are:\n" "    Resource::compatible(Resource *,bool) const\n"
2539   "    Resource::compatible(Resource *) const\n"); lua_error(L);return 0; }
2540 static int _wrap_Resource_parent__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2541   Resource *result = 0 ; SWIG_check_num_args("Resource::parent",1,1)
2542   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::parent",1,"Resource const *");
2543   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2544     SWIG_fail_ptr("Resource_parent",1,SWIGTYPE_p_Resource); }  result = (Resource *)((Resource const *)arg1)->parent();
2545   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Resource,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2546   return SWIG_arg; }
2547 static int _wrap_Resource_parent__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2548   Resource *arg2 = (Resource *) 0 ; SWIG_check_num_args("Resource::parent",2,2)
2549   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::parent",1,"Resource *");
2550   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Resource::parent",2,"Resource *");
2551   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2552     SWIG_fail_ptr("Resource_parent",1,SWIGTYPE_p_Resource); } 
2553   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Resource,0))){
2554     SWIG_fail_ptr("Resource_parent",2,SWIGTYPE_p_Resource); }  (arg1)->parent(arg2); return SWIG_arg; if(0) SWIG_fail; fail:
2555   lua_error(L); return SWIG_arg; }
2556 static int _wrap_Resource_parent(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 1) { int _v;
2557     { void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2558         _v = 0; }  else { _v = 1; }  }  if (_v) { return _wrap_Resource_parent__SWIG_0(L);}  }  if (argc == 2) { int _v; {
2559       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2560         _v = 0; }  else { _v = 1; }  }  if (_v) { { void *ptr;
2561         if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2562          else { _v = 1; }  }  if (_v) { return _wrap_Resource_parent__SWIG_1(L);}  }  } 
2563   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_parent'\n" "  Possible C/C++ prototypes are:\n"
2564   "    Resource::parent() const\n" "    Resource::parent(Resource *)\n"); lua_error(L);return 0; }
2565 static int _wrap_Resource_set_empty__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2566   SWIG_check_num_args("Resource::set_empty",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::set_empty",1,"Resource *");
2567   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2568     SWIG_fail_ptr("Resource_set_empty",1,SWIGTYPE_p_Resource); }  (arg1)->set_empty(); return SWIG_arg; if(0) SWIG_fail; fail:
2569   lua_error(L); return SWIG_arg; }
2570 static int _wrap_Resource_set_empty(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 1) {
2571     int _v; { void *ptr;
2572       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2573        else { _v = 1; }  }  if (_v) { return _wrap_Resource_set_empty__SWIG_1(L);}  }  if (argc == 2) { int _v; { void *ptr;
2574       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2575        else { _v = 1; }  }  if (_v) { { _v = lua_isboolean(L,argv[1]); }  if (_v) { return _wrap_Resource_set_empty__SWIG_0(L);}
2576        }  }  SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_set_empty'\n"
2577   "  Possible C/C++ prototypes are:\n" "    Resource::set_empty(bool)\n" "    Resource::set_empty()\n"); lua_error(L);return 0; }
2578 static int _wrap_Resource_alignment__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2579   Resource::Size arg2 ; SWIG_check_num_args("Resource::alignment",2,2)
2580   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::alignment",1,"Resource *");
2581   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2582     SWIG_fail_ptr("Resource_alignment",1,SWIGTYPE_p_Resource); }
2583 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2584    if (lua_isinteger(L, 2)) arg2 = (l4_int32_t)lua_tointeger(L, 2);else
2585 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2586    if (lua_isinteger(L, 2)) arg2 = lua_tointeger(L, 2);else
2587 #endif
2588    if (lua_isstring(L, 2)) { char *e = 0; char const *s = lua_tostring(L, 2); l4_int64_t a = strtoll(s, &e, 0);
2589     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoll error '%s'", s); SWIG_fail; }  arg2 = a; } 
2590   else if (lua_isnumber(L, 2)) arg2 = lua_tonumber(L, 2); else {
2591     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 2))); SWIG_fail; } 
2592   (arg1)->alignment(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2593 static int _wrap_Resource_valid(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2594   SWIG_check_num_args("Resource::valid",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::valid",1,"Resource const *");
2595   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2596     SWIG_fail_ptr("Resource_valid",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->valid();
2597   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2598 static int _wrap_Resource_validate(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2599   SWIG_check_num_args("Resource::validate",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::validate",1,"Resource *");
2600   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2601     SWIG_fail_ptr("Resource_validate",1,SWIGTYPE_p_Resource); }  (arg1)->validate(); return SWIG_arg; if(0) SWIG_fail; fail:
2602   lua_error(L); return SWIG_arg; }
2603 static int _wrap_Resource_start__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2604   Resource::Addr result; SWIG_check_num_args("Resource::start",1,1)
2605   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::start",1,"Resource const *");
2606   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2607     SWIG_fail_ptr("Resource_start",1,SWIGTYPE_p_Resource); }  result = ((Resource const *)arg1)->start();
2608   lua_pushfstring(L, "0x%llx", result); ++SWIG_arg; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2609 static int _wrap_Resource_end__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; Resource::Addr result;
2610   SWIG_check_num_args("Resource::end",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::end",1,"Resource const *");
2611   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2612     SWIG_fail_ptr("Resource_end",1,SWIGTYPE_p_Resource); }  result = ((Resource const *)arg1)->end();
2613   lua_pushfstring(L, "0x%llx", result); ++SWIG_arg; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2614 static int _wrap_Resource_size__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2615   Resource::Size result; SWIG_check_num_args("Resource::size",1,1)
2616   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::size",1,"Resource const *");
2617   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2618     SWIG_fail_ptr("Resource_size",1,SWIGTYPE_p_Resource); }  result = ((Resource const *)arg1)->size();
2619   lua_pushfstring(L, "0x%llx", result); ++SWIG_arg; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2620 static int _wrap_Resource_contains(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; Resource *arg2 = 0 ;
2621   bool result; SWIG_check_num_args("Resource::contains",2,2)
2622   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::contains",1,"Resource const *");
2623   if(!lua_isuserdata(L,2)) SWIG_fail_arg("Resource::contains",2,"Resource const &");
2624   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2625     SWIG_fail_ptr("Resource_contains",1,SWIGTYPE_p_Resource); } 
2626   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Resource,0))){
2627     SWIG_fail_ptr("Resource_contains",2,SWIGTYPE_p_Resource); } 
2628   result = (bool)((Resource const *)arg1)->contains((Resource const &)*arg2); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
2629   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2630 static int _wrap_Resource_start__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2631   Resource::Addr arg2 ; SWIG_check_num_args("Resource::start",2,2)
2632   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::start",1,"Resource *");
2633   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2634     SWIG_fail_ptr("Resource_start",1,SWIGTYPE_p_Resource); }
2635 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2636    if (lua_isinteger(L, 2)) arg2 = (l4_uint32_t)lua_tointeger(L, 2);else
2637 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2638    if (lua_isinteger(L, 2)) arg2 = lua_tointeger(L, 2);else
2639 #endif
2640    if (lua_isstring(L, 2)) { char *e = 0; char const *s = lua_tostring(L, 2); l4_uint64_t a = strtoull(s, &e, 0);
2641     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg2 = a; } 
2642   else if (lua_isnumber(L, 2)) arg2 = lua_tonumber(L, 2); else {
2643     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 2))); SWIG_fail; } 
2644   (arg1)->start(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2645 static int _wrap_Resource_start(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 1) { int _v;
2646     { void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2647         _v = 0; }  else { _v = 1; }  }  if (_v) { return _wrap_Resource_start__SWIG_0(L);}  }  if (argc == 2) { int _v; {
2648       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2649         _v = 0; }  else { _v = 1; }  }  if (_v) { { _v = lua_isnumber(L, argv[1]) || lua_isstring(L, argv[1]); }  if (_v) {
2650         return _wrap_Resource_start__SWIG_1(L);}  }  } 
2651   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_start'\n" "  Possible C/C++ prototypes are:\n"
2652   "    Resource::start() const\n" "    Resource::start(Resource::Addr)\n"); lua_error(L);return 0; }
2653 static int _wrap_Resource_end__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; Resource::Addr arg2 ;
2654   SWIG_check_num_args("Resource::end",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::end",1,"Resource *");
2655   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2656     SWIG_fail_ptr("Resource_end",1,SWIGTYPE_p_Resource); }
2657 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2658    if (lua_isinteger(L, 2)) arg2 = (l4_uint32_t)lua_tointeger(L, 2);else
2659 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2660    if (lua_isinteger(L, 2)) arg2 = lua_tointeger(L, 2);else
2661 #endif
2662    if (lua_isstring(L, 2)) { char *e = 0; char const *s = lua_tostring(L, 2); l4_uint64_t a = strtoull(s, &e, 0);
2663     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg2 = a; } 
2664   else if (lua_isnumber(L, 2)) arg2 = lua_tonumber(L, 2); else {
2665     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 2))); SWIG_fail; } 
2666   (arg1)->end(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2667 static int _wrap_Resource_end(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 1) { int _v; {
2668       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2669         _v = 0; }  else { _v = 1; }  }  if (_v) { return _wrap_Resource_end__SWIG_0(L);}  }  if (argc == 2) { int _v; {
2670       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2671         _v = 0; }  else { _v = 1; }  }  if (_v) { { _v = lua_isnumber(L, argv[1]) || lua_isstring(L, argv[1]); }  if (_v) {
2672         return _wrap_Resource_end__SWIG_1(L);}  }  } 
2673   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_end'\n" "  Possible C/C++ prototypes are:\n"
2674   "    Resource::end() const\n" "    Resource::end(Resource::Addr)\n"); lua_error(L);return 0; }
2675 static int _wrap_Resource_size__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; Resource::Size arg2 ;
2676   SWIG_check_num_args("Resource::size",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::size",1,"Resource *");
2677   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2678     SWIG_fail_ptr("Resource_size",1,SWIGTYPE_p_Resource); }
2679 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2680    if (lua_isinteger(L, 2)) arg2 = (l4_int32_t)lua_tointeger(L, 2);else
2681 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2682    if (lua_isinteger(L, 2)) arg2 = lua_tointeger(L, 2);else
2683 #endif
2684    if (lua_isstring(L, 2)) { char *e = 0; char const *s = lua_tostring(L, 2); l4_int64_t a = strtoll(s, &e, 0);
2685     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoll error '%s'", s); SWIG_fail; }  arg2 = a; } 
2686   else if (lua_isnumber(L, 2)) arg2 = lua_tonumber(L, 2); else {
2687     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 2))); SWIG_fail; } 
2688   (arg1)->size(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2689 static int _wrap_Resource_size(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 1) { int _v; {
2690       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2691         _v = 0; }  else { _v = 1; }  }  if (_v) { return _wrap_Resource_size__SWIG_0(L);}  }  if (argc == 2) { int _v; {
2692       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) {
2693         _v = 0; }  else { _v = 1; }  }  if (_v) { { _v = lua_isnumber(L, argv[1]) || lua_isstring(L, argv[1]); }  if (_v) {
2694         return _wrap_Resource_size__SWIG_1(L);}  }  } 
2695   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_size'\n" "  Possible C/C++ prototypes are:\n"
2696   "    Resource::size() const\n" "    Resource::size(Resource::Size)\n"); lua_error(L);return 0; }
2697 static int _wrap_Resource_start_end(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; Resource::Addr arg2 ;
2698   Resource::Addr arg3 ; SWIG_check_num_args("Resource::start_end",3,3)
2699   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::start_end",1,"Resource *");
2700   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2701     SWIG_fail_ptr("Resource_start_end",1,SWIGTYPE_p_Resource); }
2702 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2703    if (lua_isinteger(L, 2)) arg2 = (l4_uint32_t)lua_tointeger(L, 2);else
2704 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2705    if (lua_isinteger(L, 2)) arg2 = lua_tointeger(L, 2);else
2706 #endif
2707    if (lua_isstring(L, 2)) { char *e = 0; char const *s = lua_tostring(L, 2); l4_uint64_t a = strtoull(s, &e, 0);
2708     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg2 = a; } 
2709   else if (lua_isnumber(L, 2)) arg2 = lua_tonumber(L, 2); else {
2710     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 2))); SWIG_fail; }
2711 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2712    if (lua_isinteger(L, 3)) arg3 = (l4_uint32_t)lua_tointeger(L, 3);else
2713 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2714    if (lua_isinteger(L, 3)) arg3 = lua_tointeger(L, 3);else
2715 #endif
2716    if (lua_isstring(L, 3)) { char *e = 0; char const *s = lua_tostring(L, 3); l4_uint64_t a = strtoull(s, &e, 0);
2717     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg3 = a; } 
2718   else if (lua_isnumber(L, 3)) arg3 = lua_tonumber(L, 3); else {
2719     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 3))); SWIG_fail; } 
2720   (arg1)->start_end(arg2,arg3); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2721 static int _wrap_Resource_start_size(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; Resource::Addr arg2 ;
2722   Resource::Size arg3 ; SWIG_check_num_args("Resource::start_size",3,3)
2723   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::start_size",1,"Resource *");
2724   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2725     SWIG_fail_ptr("Resource_start_size",1,SWIGTYPE_p_Resource); }
2726 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2727    if (lua_isinteger(L, 2)) arg2 = (l4_uint32_t)lua_tointeger(L, 2);else
2728 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2729    if (lua_isinteger(L, 2)) arg2 = lua_tointeger(L, 2);else
2730 #endif
2731    if (lua_isstring(L, 2)) { char *e = 0; char const *s = lua_tostring(L, 2); l4_uint64_t a = strtoull(s, &e, 0);
2732     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoull error '%s'", s); SWIG_fail; }  arg2 = a; } 
2733   else if (lua_isnumber(L, 2)) arg2 = lua_tonumber(L, 2); else {
2734     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 2))); SWIG_fail; }
2735 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2736    if (lua_isinteger(L, 3)) arg3 = (l4_int32_t)lua_tointeger(L, 3);else
2737 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2738    if (lua_isinteger(L, 3)) arg3 = lua_tointeger(L, 3);else
2739 #endif
2740    if (lua_isstring(L, 3)) { char *e = 0; char const *s = lua_tostring(L, 3); l4_int64_t a = strtoll(s, &e, 0);
2741     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoll error '%s'", s); SWIG_fail; }  arg3 = a; } 
2742   else if (lua_isnumber(L, 3)) arg3 = lua_tonumber(L, 3); else {
2743     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 3))); SWIG_fail; } 
2744   (arg1)->start_size(arg2,arg3); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2745 static int _wrap_Resource_is_64bit(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; bool result;
2746   SWIG_check_num_args("Resource::is_64bit",1,1)
2747   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::is_64bit",1,"Resource const *");
2748   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2749     SWIG_fail_ptr("Resource_is_64bit",1,SWIGTYPE_p_Resource); }  result = (bool)((Resource const *)arg1)->is_64bit();
2750   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2751 static int _wrap_Resource_alignment__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2752   l4_umword_t result; SWIG_check_num_args("Resource::alignment",1,1)
2753   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::alignment",1,"Resource const *");
2754   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2755     SWIG_fail_ptr("Resource_alignment",1,SWIGTYPE_p_Resource); }  result = ((Resource const *)arg1)->alignment();
2756   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2757 static int _wrap_Resource_alignment(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 1) {
2758     int _v; { void *ptr;
2759       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2760        else { _v = 1; }  }  if (_v) { return _wrap_Resource_alignment__SWIG_1(L);}  }  if (argc == 2) { int _v; { void *ptr;
2761       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Resource, 0)) { _v = 0; }
2762        else { _v = 1; }  }  if (_v) { { _v = lua_isnumber(L, argv[1]) || lua_isstring(L, argv[1]); }  if (_v) {
2763         return _wrap_Resource_alignment__SWIG_0(L);}  }  } 
2764   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Resource_alignment'\n" "  Possible C/C++ prototypes are:\n"
2765   "    Resource::alignment(Resource::Size)\n" "    Resource::alignment() const\n"); lua_error(L);return 0; }
2766 static int _wrap_Resource_map_iomem(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ; l4_addr_t result;
2767   SWIG_check_num_args("Resource::map_iomem",1,1)
2768   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::map_iomem",1,"Resource const *");
2769   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2770     SWIG_fail_ptr("Resource_map_iomem",1,SWIGTYPE_p_Resource); }  result = ((Resource const *)arg1)->map_iomem();
2771   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2772 static int _wrap_Resource_provider_device_handle(lua_State* L) { int SWIG_arg = 0; Resource *arg1 = (Resource *) 0 ;
2773   l4vbus_device_handle_t result; SWIG_check_num_args("Resource::provider_device_handle",1,1)
2774   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Resource::provider_device_handle",1,"Resource const *");
2775   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Resource,0))){
2776     SWIG_fail_ptr("Resource_provider_device_handle",1,SWIGTYPE_p_Resource); } 
2777   result = ((Resource const *)arg1)->provider_device_handle(); {
2778     l4vbus_device_handle_t * resultptr = new l4vbus_device_handle_t((const l4vbus_device_handle_t &) result);
2779     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_l4vbus_device_handle_t,1); SWIG_arg++; }  return SWIG_arg;
2780   if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2781 static void swig_delete_Resource(void *obj) {
2782 Resource *arg1 = (Resource *) obj;
2783 delete arg1;
2784 }
2785 static swig_lua_method swig_Resource_methods[] = {
2786     {"irq_is_level_triggered", _wrap_Resource_irq_is_level_triggered}, 
2787     {"irq_is_low_polarity", _wrap_Resource_irq_is_low_polarity}, 
2788     {"flags", _wrap_Resource_flags}, 
2789     {"add_flags", _wrap_Resource_add_flags}, 
2790     {"del_flags", _wrap_Resource_del_flags}, 
2791     {"hierarchical", _wrap_Resource_hierarchical}, 
2792     {"disabled", _wrap_Resource_disabled}, 
2793     {"prefetchable", _wrap_Resource_prefetchable}, 
2794     {"empty", _wrap_Resource_empty}, 
2795     {"fixed_addr", _wrap_Resource_fixed_addr}, 
2796     {"fixed_size", _wrap_Resource_fixed_size}, 
2797     {"relative", _wrap_Resource_relative}, 
2798     {"type", _wrap_Resource_type}, 
2799     {"lt_compare", _wrap_Resource_lt_compare}, 
2800     {"set_id", _wrap_Resource_set_id}, 
2801     {"id", _wrap_Resource_id}, 
2802     {"disable", _wrap_Resource_disable}, 
2803     {"enable", _wrap_Resource_enable}, 
2804     {"provided", _wrap_Resource_provided}, 
2805     {"dump", _wrap_Resource_dump}, 
2806     {"compatible", _wrap_Resource_compatible}, 
2807     {"parent", _wrap_Resource_parent}, 
2808     {"set_empty", _wrap_Resource_set_empty}, 
2809     {"valid", _wrap_Resource_valid}, 
2810     {"validate", _wrap_Resource_validate}, 
2811     {"contains", _wrap_Resource_contains}, 
2812     {"start", _wrap_Resource_start}, 
2813     {"end", _wrap_Resource_end}, 
2814     {"size", _wrap_Resource_size}, 
2815     {"start_end", _wrap_Resource_start_end}, 
2816     {"start_size", _wrap_Resource_start_size}, 
2817     {"is_64bit", _wrap_Resource_is_64bit}, 
2818     {"alignment", _wrap_Resource_alignment}, 
2819     {"map_iomem", _wrap_Resource_map_iomem}, 
2820     {"provider_device_handle", _wrap_Resource_provider_device_handle}, 
2821     {0,0}
2822 };
2823 static swig_lua_attribute swig_Resource_attributes[] = {
2824     {0,0,0}
2825 };
2826 static swig_lua_attribute swig_Resource_cls_attributes[] = {
2827     {0,0,0}
2828 };
2829 static swig_lua_method swig_Resource_cls_methods[] = {
2830     {"str_to_id", _wrap_Resource_str_to_id}, 
2831     {0,0}
2832 };
2833 static swig_lua_const_info swig_Resource_cls_constants[] = {
2834     {SWIG_LUA_CONSTTAB_INT("Invalid_res", Resource::Invalid_res)},
2835     {SWIG_LUA_CONSTTAB_INT("Irq_res", Resource::Irq_res)},
2836     {SWIG_LUA_CONSTTAB_INT("Mmio_res", Resource::Mmio_res)},
2837     {SWIG_LUA_CONSTTAB_INT("Io_res", Resource::Io_res)},
2838     {SWIG_LUA_CONSTTAB_INT("Bus_res", Resource::Bus_res)},
2839     {SWIG_LUA_CONSTTAB_INT("Gpio_res", Resource::Gpio_res)},
2840     {SWIG_LUA_CONSTTAB_INT("F_type_mask", Resource::F_type_mask)},
2841     {SWIG_LUA_CONSTTAB_INT("F_disabled", Resource::F_disabled)},
2842     {SWIG_LUA_CONSTTAB_INT("F_hierarchical", Resource::F_hierarchical)},
2843     {SWIG_LUA_CONSTTAB_INT("F_prefetchable", Resource::F_prefetchable)},
2844     {SWIG_LUA_CONSTTAB_INT("F_size_aligned", Resource::F_size_aligned)},
2845     {SWIG_LUA_CONSTTAB_INT("F_empty", Resource::F_empty)},
2846     {SWIG_LUA_CONSTTAB_INT("F_rom", Resource::F_rom)},
2847     {SWIG_LUA_CONSTTAB_INT("F_can_resize", Resource::F_can_resize)},
2848     {SWIG_LUA_CONSTTAB_INT("F_can_move", Resource::F_can_move)},
2849     {SWIG_LUA_CONSTTAB_INT("F_width_64bit", Resource::F_width_64bit)},
2850     {SWIG_LUA_CONSTTAB_INT("F_relative", Resource::F_relative)},
2851     {SWIG_LUA_CONSTTAB_INT("Irq_type_base", Resource::Irq_type_base)},
2852     {SWIG_LUA_CONSTTAB_INT("Irq_type_mask", Resource::Irq_type_mask)},
2853     {SWIG_LUA_CONSTTAB_INT("Irq_type_none", Resource::Irq_type_none)},
2854     {SWIG_LUA_CONSTTAB_INT("Irq_type_level_high", Resource::Irq_type_level_high)},
2855     {SWIG_LUA_CONSTTAB_INT("Irq_type_level_low", Resource::Irq_type_level_low)},
2856     {SWIG_LUA_CONSTTAB_INT("Irq_type_raising_edge", Resource::Irq_type_raising_edge)},
2857     {SWIG_LUA_CONSTTAB_INT("Irq_type_falling_edge", Resource::Irq_type_falling_edge)},
2858     {SWIG_LUA_CONSTTAB_INT("Irq_type_both_edges", Resource::Irq_type_both_edges)},
2859     {0,0,0,0,0,0}
2860 };
2861 static swig_lua_class *swig_Resource_bases[] = {0};
2862 static const char *swig_Resource_base_names[] = {0};
2863 static swig_lua_class _wrap_class_Resource = { "Resource", &SWIGTYPE_p_Resource,_wrap_new_Resource, swig_delete_Resource, swig_Resource_methods, swig_Resource_attributes, { "Resource", swig_Resource_cls_methods, swig_Resource_cls_attributes, swig_Resource_cls_constants }, swig_Resource_bases, swig_Resource_base_names };
2864
2865 static int _wrap_Mmio_data_space__r_set(lua_State* L) { int SWIG_arg = 0; Mmio_data_space *arg1 = (Mmio_data_space *) 0 ;
2866   L4Re::Rm::Auto_region< l4_addr_t > arg2 ; L4Re::Rm::Auto_region< l4_addr_t > *argp2 ;
2867   SWIG_check_num_args("Mmio_data_space::_r",2,2)
2868   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Mmio_data_space::_r",1,"Mmio_data_space *");
2869   if(!lua_isuserdata(L,2)) SWIG_fail_arg("Mmio_data_space::_r",2,"L4Re::Rm::Auto_region< l4_addr_t >");
2870   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Mmio_data_space,0))){
2871     SWIG_fail_ptr("Mmio_data_space__r_set",1,SWIGTYPE_p_Mmio_data_space); } 
2872   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_L4Re__Rm__Auto_regionT_l4_addr_t_t,0))){
2873     SWIG_fail_ptr("Mmio_data_space__r_set",2,SWIGTYPE_p_L4Re__Rm__Auto_regionT_l4_addr_t_t); }  arg2 = *argp2;
2874   if (arg1) (arg1)->_r = arg2; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2875 static int _wrap_Mmio_data_space__r_get(lua_State* L) { int SWIG_arg = 0; Mmio_data_space *arg1 = (Mmio_data_space *) 0 ;
2876   L4Re::Rm::Auto_region< l4_addr_t > result; SWIG_check_num_args("Mmio_data_space::_r",1,1)
2877   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Mmio_data_space::_r",1,"Mmio_data_space *");
2878   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Mmio_data_space,0))){
2879     SWIG_fail_ptr("Mmio_data_space__r_get",1,SWIGTYPE_p_Mmio_data_space); }  result =  ((arg1)->_r); {
2880     L4Re::Rm::Auto_region< l4_addr_t > * resultptr = new L4Re::Rm::Auto_region< l4_addr_t >((const L4Re::Rm::Auto_region< l4_addr_t > &) result);
2881     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_L4Re__Rm__Auto_regionT_l4_addr_t_t,1); SWIG_arg++; }  return SWIG_arg;
2882   if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2883 static int _wrap_new_Mmio_data_space__SWIG_0(lua_State* L) { int SWIG_arg = 0; Resource::Size arg1 ; unsigned long arg2 ;
2884   Mmio_data_space *result = 0 ; SWIG_check_num_args("Mmio_data_space::Mmio_data_space",2,2)if(!lua_isnumber(L,2)) SWIG_fail_arg("Mmio_data_space::Mmio_data_space",2,"unsigned long");
2885 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2886    if (lua_isinteger(L, 1)) arg1 = (l4_int32_t)lua_tointeger(L, 1);else
2887 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2888    if (lua_isinteger(L, 1)) arg1 = lua_tointeger(L, 1);else
2889 #endif
2890    if (lua_isstring(L, 1)) { char *e = 0; char const *s = lua_tostring(L, 1); l4_int64_t a = strtoll(s, &e, 0);
2891     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoll error '%s'", s); SWIG_fail; }  arg1 = a; } 
2892   else if (lua_isnumber(L, 1)) arg1 = lua_tonumber(L, 1); else {
2893     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 1))); SWIG_fail; }  
2894   arg2 = (unsigned long)lua_tointeger(L, 2); result = (Mmio_data_space *)new Mmio_data_space(arg1,arg2);
2895   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Mmio_data_space,1); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2896   return SWIG_arg; }
2897 static int _wrap_new_Mmio_data_space__SWIG_1(lua_State* L) { int SWIG_arg = 0; Resource::Size arg1 ;
2898   Mmio_data_space *result = 0 ;SWIG_check_num_args("Mmio_data_space::Mmio_data_space",1,1)
2899 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2900    if (lua_isinteger(L, 1)) arg1 = (l4_int32_t)lua_tointeger(L, 1);else
2901 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2902    if (lua_isinteger(L, 1)) arg1 = lua_tointeger(L, 1);else
2903 #endif
2904    if (lua_isstring(L, 1)) { char *e = 0; char const *s = lua_tostring(L, 1); l4_int64_t a = strtoll(s, &e, 0);
2905     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoll error '%s'", s); SWIG_fail; }  arg1 = a; } 
2906   else if (lua_isnumber(L, 1)) arg1 = lua_tonumber(L, 1); else {
2907     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 1))); SWIG_fail; } 
2908   result = (Mmio_data_space *)new Mmio_data_space(arg1); SWIG_NewPointerObj(L,result,SWIGTYPE_p_Mmio_data_space,1); SWIG_arg++; 
2909   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2910 static int _wrap_new_Mmio_data_space(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 1) {
2911     int _v; { _v = lua_isnumber(L, argv[0]) || lua_isstring(L, argv[0]); }  if (_v) {
2912       return _wrap_new_Mmio_data_space__SWIG_1(L);}  }  if (argc == 2) { int _v; {
2913       _v = lua_isnumber(L, argv[0]) || lua_isstring(L, argv[0]); }  if (_v) { { _v = lua_isnumber(L,argv[1]); }  if (_v) {
2914         return _wrap_new_Mmio_data_space__SWIG_0(L);}  }  } 
2915   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_Mmio_data_space'\n"
2916   "  Possible C/C++ prototypes are:\n" "    Mmio_data_space::Mmio_data_space(Resource::Size,unsigned long)\n"
2917   "    Mmio_data_space::Mmio_data_space(Resource::Size)\n"); lua_error(L);return 0; }
2918 static int _wrap_Mmio_data_space_alloc_ram(lua_State* L) { int SWIG_arg = 0; Mmio_data_space *arg1 = (Mmio_data_space *) 0 ;
2919   Resource::Size arg2 ; unsigned long arg3 ; SWIG_check_num_args("Mmio_data_space::alloc_ram",3,3)
2920   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Mmio_data_space::alloc_ram",1,"Mmio_data_space *");
2921   if(!lua_isnumber(L,3)) SWIG_fail_arg("Mmio_data_space::alloc_ram",3,"unsigned long");
2922   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Mmio_data_space,0))){
2923     SWIG_fail_ptr("Mmio_data_space_alloc_ram",1,SWIGTYPE_p_Mmio_data_space); }
2924 #if SWIG_RECURSIVE_DEFINED LNUM_INT32
2925    if (lua_isinteger(L, 2)) arg2 = (l4_int32_t)lua_tointeger(L, 2);else
2926 #elif SWIG_RECURSIVE_DEFINED LNUM_INT64
2927    if (lua_isinteger(L, 2)) arg2 = lua_tointeger(L, 2);else
2928 #endif
2929    if (lua_isstring(L, 2)) { char *e = 0; char const *s = lua_tostring(L, 2); l4_int64_t a = strtoll(s, &e, 0);
2930     if (s == e || *e != 0) { lua_pushfstring(L, "big number strtoll error '%s'", s); SWIG_fail; }  arg2 = a; } 
2931   else if (lua_isnumber(L, 2)) arg2 = lua_tonumber(L, 2); else {
2932     lua_pushfstring(L, "big number expected (string or number) got %s", lua_typename(L, lua_type(L, 2))); SWIG_fail; }  
2933   arg3 = (unsigned long)lua_tointeger(L, 3); (arg1)->alloc_ram(arg2,arg3); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
2934   return SWIG_arg; }
2935 static void swig_delete_Mmio_data_space(void *obj) {
2936 Mmio_data_space *arg1 = (Mmio_data_space *) obj;
2937 delete arg1;
2938 }
2939 static swig_lua_method swig_Mmio_data_space_methods[] = {
2940     {"alloc_ram", _wrap_Mmio_data_space_alloc_ram}, 
2941     {0,0}
2942 };
2943 static swig_lua_attribute swig_Mmio_data_space_attributes[] = {
2944     { "_r", _wrap_Mmio_data_space__r_get, _wrap_Mmio_data_space__r_set},
2945     {0,0,0}
2946 };
2947 static swig_lua_attribute swig_Mmio_data_space_cls_attributes[] = {
2948     {0,0,0}
2949 };
2950 static swig_lua_method swig_Mmio_data_space_cls_methods[] = {
2951     {0,0}
2952 };
2953 static swig_lua_const_info swig_Mmio_data_space_cls_constants[] = {
2954     {0,0,0,0,0,0}
2955 };
2956 static swig_lua_class *swig_Mmio_data_space_bases[] = {0,0};
2957 static const char *swig_Mmio_data_space_base_names[] = {"Resource *",0};
2958 static swig_lua_class _wrap_class_Mmio_data_space = { "Mmio_data_space", &SWIGTYPE_p_Mmio_data_space,_wrap_new_Mmio_data_space, swig_delete_Mmio_data_space, swig_Mmio_data_space_methods, swig_Mmio_data_space_attributes, { "Mmio_data_space", swig_Mmio_data_space_cls_methods, swig_Mmio_data_space_cls_attributes, swig_Mmio_data_space_cls_constants }, swig_Mmio_data_space_bases, swig_Mmio_data_space_base_names };
2959
2960 static void swig_delete_Device(void *obj) {
2961 Device *arg1 = (Device *) obj;
2962 delete arg1;
2963 }
2964 static swig_lua_method swig_Device_methods[] = {
2965     {0,0}
2966 };
2967 static swig_lua_attribute swig_Device_attributes[] = {
2968     {0,0,0}
2969 };
2970 static swig_lua_attribute swig_Device_cls_attributes[] = {
2971     {0,0,0}
2972 };
2973 static swig_lua_method swig_Device_cls_methods[] = {
2974     {0,0}
2975 };
2976 static swig_lua_const_info swig_Device_cls_constants[] = {
2977     {0,0,0,0,0,0}
2978 };
2979 static swig_lua_class *swig_Device_bases[] = {0};
2980 static const char *swig_Device_base_names[] = {0};
2981 static swig_lua_class _wrap_class_Device = { "Device", &SWIGTYPE_p_Device,0, swig_delete_Device, swig_Device_methods, swig_Device_attributes, { "Device", swig_Device_cls_methods, swig_Device_cls_attributes, swig_Device_cls_constants }, swig_Device_bases, swig_Device_base_names };
2982
2983 static int _wrap_Generic_device_add_resource(lua_State* L) { int SWIG_arg = 0; Generic_device *arg1 = (Generic_device *) 0 ;
2984   Resource *arg2 = (Resource *) 0 ; SWIG_check_num_args("Generic_device::add_resource",2,2)
2985   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Generic_device::add_resource",1,"Generic_device *");
2986   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Generic_device::add_resource",2,"Resource *");
2987   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Generic_device,0))){
2988     SWIG_fail_ptr("Generic_device_add_resource",1,SWIGTYPE_p_Generic_device); } 
2989   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Resource,SWIG_POINTER_DISOWN))){
2990     SWIG_fail_ptr("Generic_device_add_resource",2,SWIGTYPE_p_Resource); }  (arg1)->add_resource(arg2); return SWIG_arg;
2991   if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2992 static int _wrap_Generic_device_nresources(lua_State* L) { int SWIG_arg = 0; Generic_device *arg1 = (Generic_device *) 0 ;
2993   int result; SWIG_check_num_args("Generic_device::nresources",1,1)
2994   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Generic_device::nresources",1,"Generic_device const *");
2995   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Generic_device,0))){
2996     SWIG_fail_ptr("Generic_device_nresources",1,SWIGTYPE_p_Generic_device); } 
2997   result = (int)Generic_device_nresources((Generic_device const *)arg1); lua_pushinteger(L, result); SWIG_arg++;
2998   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
2999 static int _wrap_Generic_device_resource(lua_State* L) { int SWIG_arg = 0; Generic_device *arg1 = (Generic_device *) 0 ;
3000   int arg2 ; Resource *result = 0 ; SWIG_check_num_args("Generic_device::resource",2,2)
3001   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Generic_device::resource",1,"Generic_device const *");
3002   if(!lua_isnumber(L,2)) SWIG_fail_arg("Generic_device::resource",2,"int");
3003   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Generic_device,0))){
3004     SWIG_fail_ptr("Generic_device_resource",1,SWIGTYPE_p_Generic_device); }  arg2 = (int)lua_tointeger(L, 2);
3005   result = (Resource *)Generic_device_resource((Generic_device const *)arg1,arg2);
3006   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Resource,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3007   return SWIG_arg; }
3008 static void swig_delete_Generic_device(void *obj) {
3009 Generic_device *arg1 = (Generic_device *) obj;
3010 delete arg1;
3011 }
3012 static swig_lua_method swig_Generic_device_methods[] = {
3013     {"add_resource", _wrap_Generic_device_add_resource}, 
3014     {"nresources", _wrap_Generic_device_nresources}, 
3015     {"resource", _wrap_Generic_device_resource}, 
3016     {0,0}
3017 };
3018 static swig_lua_attribute swig_Generic_device_attributes[] = {
3019     {0,0,0}
3020 };
3021 static swig_lua_attribute swig_Generic_device_cls_attributes[] = {
3022     {0,0,0}
3023 };
3024 static swig_lua_method swig_Generic_device_cls_methods[] = {
3025     {0,0}
3026 };
3027 static swig_lua_const_info swig_Generic_device_cls_constants[] = {
3028     {0,0,0,0,0,0}
3029 };
3030 static swig_lua_class *swig_Generic_device_bases[] = {0,0};
3031 static const char *swig_Generic_device_base_names[] = {"Device *",0};
3032 static swig_lua_class _wrap_class_Generic_device = { "Generic_device", &SWIGTYPE_p_Generic_device,0, swig_delete_Generic_device, swig_Generic_device_methods, swig_Generic_device_attributes, { "Generic_device", swig_Generic_device_cls_methods, swig_Generic_device_cls_attributes, swig_Generic_device_cls_constants }, swig_Generic_device_bases, swig_Generic_device_base_names };
3033
3034 static int _wrap_Vi_device_add_child(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3035   Vi::Device *arg2 = (Vi::Device *) 0 ; SWIG_check_num_args("Vi::Device::add_child",2,2)
3036   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::add_child",1,"Vi::Device *");
3037   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Vi::Device::add_child",2,"Vi::Device *");
3038   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3039     SWIG_fail_ptr("Vi_device_add_child",1,SWIGTYPE_p_Vi__Device); } 
3040   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Vi__Device,SWIG_POINTER_DISOWN))){
3041     SWIG_fail_ptr("Vi_device_add_child",2,SWIGTYPE_p_Vi__Device); }  (arg1)->add_child(arg2); return SWIG_arg; if(0) SWIG_fail;
3042   fail: lua_error(L); return SWIG_arg; }
3043 static int _wrap_Vi_device_name__SWIG_0(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3044   char *arg2 = (char *) 0 ; SWIG_check_num_args("Vi::Device::name",2,2)
3045   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::name",1,"Vi::Device *");
3046   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("Vi::Device::name",2,"char const *");
3047   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3048     SWIG_fail_ptr("Vi_device_name",1,SWIGTYPE_p_Vi__Device); }  arg2 = (char *)lua_tostring(L, 2);
3049   (arg1)->name((char const *)arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3050 static int _wrap_Vi_device_name__SWIG_1(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3051   char *result = 0 ; SWIG_check_num_args("Vi::Device::name",1,1)
3052   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::name",1,"Vi::Device const *");
3053   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3054     SWIG_fail_ptr("Vi_device_name",1,SWIGTYPE_p_Vi__Device); }  result = (char *)((Vi::Device const *)arg1)->name();
3055   lua_pushstring(L,(const char *)result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3056 static int _wrap_Vi_device_name(lua_State* L) { int argc; int argv[3]={ 1,2,3} ; argc = lua_gettop(L); if (argc == 1) { int _v;
3057     { void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Vi__Device, 0)) {
3058         _v = 0; }  else { _v = 1; }  }  if (_v) { return _wrap_Vi_device_name__SWIG_1(L);}  }  if (argc == 2) { int _v; {
3059       void *ptr; if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Vi__Device, 0)) {
3060         _v = 0; }  else { _v = 1; }  }  if (_v) { { _v = SWIG_lua_isnilstring(L,argv[1]); }  if (_v) {
3061         return _wrap_Vi_device_name__SWIG_0(L);}  }  } 
3062   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Vi_device_name'\n" "  Possible C/C++ prototypes are:\n"
3063   "    Vi::Device::name(char const *)\n" "    Vi::Device::name() const\n"); lua_error(L);return 0; }
3064 static int _wrap_Vi_device_parent(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3065   Vi::Device *result = 0 ; SWIG_check_num_args("Vi::Device::parent",1,1)
3066   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::parent",1,"Vi::Device const *");
3067   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3068     SWIG_fail_ptr("Vi_device_parent",1,SWIGTYPE_p_Vi__Device); }  result = (Vi::Device *)((Vi::Device const *)arg1)->parent();
3069   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Vi__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3070   return SWIG_arg; }
3071 static int _wrap_Vi_device_children(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3072   Vi::Device *result = 0 ; SWIG_check_num_args("Vi::Device::children",1,1)
3073   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::children",1,"Vi::Device const *");
3074   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3075     SWIG_fail_ptr("Vi_device_children",1,SWIGTYPE_p_Vi__Device); } 
3076   result = (Vi::Device *)((Vi::Device const *)arg1)->children();
3077   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Vi__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3078   return SWIG_arg; }
3079 static int _wrap_Vi_device_next(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ; Vi::Device *result = 0 ;
3080   SWIG_check_num_args("Vi::Device::next",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::next",1,"Vi::Device const *");
3081   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3082     SWIG_fail_ptr("Vi_device_next",1,SWIGTYPE_p_Vi__Device); }  result = (Vi::Device *)((Vi::Device const *)arg1)->next();
3083   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Vi__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3084   return SWIG_arg; }
3085 static int _wrap_Vi_device_depth(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ; int result;
3086   SWIG_check_num_args("Vi::Device::depth",1,1)
3087   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::depth",1,"Vi::Device const *");
3088   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3089     SWIG_fail_ptr("Vi_device_depth",1,SWIGTYPE_p_Vi__Device); }  result = (int)((Vi::Device const *)arg1)->depth();
3090   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3091 static int _wrap_Vi_device_add_filter__SWIG_0(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3092   cxx::String *arg2 = 0 ; cxx::String *arg3 = 0 ; cxx::String tmp2 ; cxx::String tmp3 ; int result;
3093   SWIG_check_num_args("Vi::Device::add_filter",3,3)
3094   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::add_filter",1,"Vi::Device *");
3095   if(!lua_isstring(L,2)) SWIG_fail_arg("Vi::Device::add_filter",2,"cxx::String const &");
3096   if(!lua_isstring(L,3)) SWIG_fail_arg("Vi::Device::add_filter",3,"cxx::String const &");
3097   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3098     SWIG_fail_ptr("Vi_device_add_filter",1,SWIGTYPE_p_Vi__Device); } 
3099   tmp2 = cxx::String(lua_tostring(L, 2), lua_rawlen(L, 2)); arg2 = &tmp2;
3100   tmp3 = cxx::String(lua_tostring(L, 3), lua_rawlen(L, 3)); arg3 = &tmp3;
3101   result = (int)(arg1)->add_filter((cxx::String const &)*arg2,(cxx::String const &)*arg3);
3102   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3103 static int _wrap_Vi_device_add_filter__SWIG_1(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3104   cxx::String *arg2 = 0 ; unsigned long long arg3 ; cxx::String tmp2 ; int result;
3105   SWIG_check_num_args("Vi::Device::add_filter",3,3)
3106   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::add_filter",1,"Vi::Device *");
3107   if(!lua_isstring(L,2)) SWIG_fail_arg("Vi::Device::add_filter",2,"cxx::String const &");
3108   if(!lua_isnumber(L,3)) SWIG_fail_arg("Vi::Device::add_filter",3,"unsigned long long");
3109   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3110     SWIG_fail_ptr("Vi_device_add_filter",1,SWIGTYPE_p_Vi__Device); } 
3111   tmp2 = cxx::String(lua_tostring(L, 2), lua_rawlen(L, 2)); arg2 = &tmp2; arg3 = (unsigned long long)lua_tonumber(L, 3);
3112   result = (int)(arg1)->add_filter((cxx::String const &)*arg2,arg3); lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg;
3113   if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3114 static int _wrap_Vi_device_add_filter__SWIG_2(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3115   cxx::String *arg2 = 0 ; unsigned long long arg3 ; unsigned long long arg4 ; cxx::String tmp2 ; int result;
3116   SWIG_check_num_args("Vi::Device::add_filter",4,4)
3117   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::add_filter",1,"Vi::Device *");
3118   if(!lua_isstring(L,2)) SWIG_fail_arg("Vi::Device::add_filter",2,"cxx::String const &");
3119   if(!lua_isnumber(L,3)) SWIG_fail_arg("Vi::Device::add_filter",3,"unsigned long long");
3120   if(!lua_isnumber(L,4)) SWIG_fail_arg("Vi::Device::add_filter",4,"unsigned long long");
3121   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3122     SWIG_fail_ptr("Vi_device_add_filter",1,SWIGTYPE_p_Vi__Device); } 
3123   tmp2 = cxx::String(lua_tostring(L, 2), lua_rawlen(L, 2)); arg2 = &tmp2; arg3 = (unsigned long long)lua_tonumber(L, 3);
3124   arg4 = (unsigned long long)lua_tonumber(L, 4); result = (int)(arg1)->add_filter((cxx::String const &)*arg2,arg3,arg4);
3125   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3126 static int _wrap_Vi_device_add_filter(lua_State* L) { int argc; int argv[5]={ 1,2,3,4,5} ; argc = lua_gettop(L);
3127   if (argc == 3) { int _v; { void *ptr;
3128       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Vi__Device, 0)) { _v = 0; }
3129        else { _v = 1; }  }  if (_v) { { _v = lua_isstring(L, argv[1]); }  if (_v) { { _v = lua_isnumber(L,argv[2]); }  if (_v) {
3130           return _wrap_Vi_device_add_filter__SWIG_1(L);}  }  }  }  if (argc == 3) { int _v; { void *ptr;
3131       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Vi__Device, 0)) { _v = 0; }
3132        else { _v = 1; }  }  if (_v) { { _v = lua_isstring(L, argv[1]); }  if (_v) { { _v = lua_isstring(L, argv[2]); } 
3133         if (_v) { return _wrap_Vi_device_add_filter__SWIG_0(L);}  }  }  }  if (argc == 4) { int _v; { void *ptr;
3134       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Vi__Device, 0)) { _v = 0; }
3135        else { _v = 1; }  }  if (_v) { { _v = lua_isstring(L, argv[1]); }  if (_v) { { _v = lua_isnumber(L,argv[2]); }  if (_v) {
3136           { _v = lua_isnumber(L,argv[3]); }  if (_v) { return _wrap_Vi_device_add_filter__SWIG_2(L);}  }  }  }  } 
3137   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Vi_device_add_filter'\n"
3138   "  Possible C/C++ prototypes are:\n" "    Vi::Device::add_filter(cxx::String const &,cxx::String const &)\n"
3139   "    Vi::Device::add_filter(cxx::String const &,unsigned long long)\n"
3140   "    Vi::Device::add_filter(cxx::String const &,unsigned long long,unsigned long long)\n"); lua_error(L);return 0; }
3141 static int _wrap_Vi_device_dump(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ; int arg2 ;
3142   SWIG_check_num_args("Vi::Device::dump",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::dump",1,"Vi::Device const *");
3143   if(!lua_isnumber(L,2)) SWIG_fail_arg("Vi::Device::dump",2,"int");
3144   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3145     SWIG_fail_ptr("Vi_device_dump",1,SWIGTYPE_p_Vi__Device); }  arg2 = (int)lua_tointeger(L, 2);
3146   ((Vi::Device const *)arg1)->dump(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3147 static int _wrap_Vi_device_set_name(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ;
3148   char *arg2 = (char *) 0 ; SWIG_check_num_args("Vi::Device::set_name",2,2)
3149   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Device::set_name",1,"Vi::Device *");
3150   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("Vi::Device::set_name",2,"char const *");
3151   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3152     SWIG_fail_ptr("Vi_device_set_name",1,SWIGTYPE_p_Vi__Device); }  arg2 = (char *)lua_tostring(L, 2);
3153   Vi_Device_set_name(arg1,(char const *)arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3154 static void swig_delete_Vi_device(void *obj) {
3155 Vi::Device *arg1 = (Vi::Device *) obj;
3156 delete arg1;
3157 }
3158 static swig_lua_method swig_Vi_Device_methods[] = {
3159     {"add_child", _wrap_Vi_device_add_child}, 
3160     {"name", _wrap_Vi_device_name}, 
3161     {"parent", _wrap_Vi_device_parent}, 
3162     {"children", _wrap_Vi_device_children}, 
3163     {"next", _wrap_Vi_device_next}, 
3164     {"depth", _wrap_Vi_device_depth}, 
3165     {"add_filter", _wrap_Vi_device_add_filter}, 
3166     {"dump", _wrap_Vi_device_dump}, 
3167     {"set_name", _wrap_Vi_device_set_name}, 
3168     {0,0}
3169 };
3170 static swig_lua_attribute swig_Vi_Device_attributes[] = {
3171     {0,0,0}
3172 };
3173 static swig_lua_attribute swig_Vi_Device_cls_attributes[] = {
3174     {0,0,0}
3175 };
3176 static swig_lua_method swig_Vi_Device_cls_methods[] = {
3177     {0,0}
3178 };
3179 static swig_lua_const_info swig_Vi_Device_cls_constants[] = {
3180     {0,0,0,0,0,0}
3181 };
3182 static swig_lua_class *swig_Vi_Device_bases[] = {0,0};
3183 static const char *swig_Vi_Device_base_names[] = {"Generic_device *",0};
3184 static swig_lua_class _wrap_class_Vi_Device = { "Vi_device", &SWIGTYPE_p_Vi__Device,0, swig_delete_Vi_device, swig_Vi_Device_methods, swig_Vi_Device_attributes, { "Vi_device", swig_Vi_Device_cls_methods, swig_Vi_Device_cls_attributes, swig_Vi_Device_cls_constants }, swig_Vi_Device_bases, swig_Vi_Device_base_names };
3185
3186 static int _wrap_Vi_dev_factory_vcreate(lua_State* L) { int SWIG_arg = 0; Vi::Dev_factory *arg1 = (Vi::Dev_factory *) 0 ;
3187   Vi::Device *result = 0 ; SWIG_check_num_args("Vi::Dev_factory::vcreate",1,1)
3188   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Dev_factory::vcreate",1,"Vi::Dev_factory *");
3189   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Dev_factory,0))){
3190     SWIG_fail_ptr("Vi_dev_factory_vcreate",1,SWIGTYPE_p_Vi__Dev_factory); }  result = (Vi::Device *)(arg1)->vcreate();
3191   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Vi__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3192   return SWIG_arg; }
3193 static int _wrap_Vi_dev_factory_do_match(lua_State* L) { int SWIG_arg = 0; Vi::Dev_factory *arg1 = (Vi::Dev_factory *) 0 ;
3194   Hw::Device *arg2 = (Hw::Device *) 0 ; Vi::Device *result = 0 ; SWIG_check_num_args("Vi::Dev_factory::do_match",2,2)
3195   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Dev_factory::do_match",1,"Vi::Dev_factory *");
3196   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Vi::Dev_factory::do_match",2,"Hw::Device *");
3197   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Dev_factory,0))){
3198     SWIG_fail_ptr("Vi_dev_factory_do_match",1,SWIGTYPE_p_Vi__Dev_factory); } 
3199   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Hw__Device,0))){
3200     SWIG_fail_ptr("Vi_dev_factory_do_match",2,SWIGTYPE_p_Hw__Device); }  result = (Vi::Device *)(arg1)->do_match(arg2);
3201   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Vi__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3202   return SWIG_arg; }
3203 static int _wrap_Vi_dev_factory_create__SWIG_0(lua_State* L) { int SWIG_arg = 0; std::string *arg1 = 0 ; std::string temp1 ;
3204   Vi::Device *result = 0 ; SWIG_check_num_args("Vi::Dev_factory::create",1,1)
3205   if(!lua_isstring(L,1)) SWIG_fail_arg("Vi::Dev_factory::create",1,"std::string const &");
3206   temp1.assign(lua_tostring(L,1),lua_rawlen(L,1)); arg1=&temp1;
3207   result = (Vi::Device *)Vi::Dev_factory::create((std::string const &)*arg1);
3208   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Vi__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3209   return SWIG_arg; }
3210 static int _wrap_Vi_dev_factory_create__SWIG_1(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3211   Vi::Device *result = 0 ; SWIG_check_num_args("Vi::Dev_factory::create",1,1)
3212   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Vi::Dev_factory::create",1,"Hw::Device *");
3213   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3214     SWIG_fail_ptr("Vi_dev_factory_create",1,SWIGTYPE_p_Hw__Device); }  result = (Vi::Device *)Vi::Dev_factory::create(arg1);
3215   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Vi__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3216   return SWIG_arg; }
3217 static int _wrap_Vi_dev_factory_create(lua_State* L) { int argc; int argv[2]={ 1,2} ; argc = lua_gettop(L); if (argc == 1) {
3218     int _v; { void *ptr;
3219       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Hw__Device, 0)) { _v = 0; }
3220        else { _v = 1; }  }  if (_v) { return _wrap_Vi_dev_factory_create__SWIG_1(L);}  }  if (argc == 1) { int _v; {
3221       _v = lua_isstring(L,argv[0]); }  if (_v) { return _wrap_Vi_dev_factory_create__SWIG_0(L);}  } 
3222   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Vi_dev_factory_create'\n"
3223   "  Possible C/C++ prototypes are:\n" "    Vi::Dev_factory::create(std::string const &)\n"
3224   "    Vi::Dev_factory::create(Hw::Device *)\n"); lua_error(L);return 0; }
3225 static swig_lua_method swig_Vi_Dev_factory_methods[] = {
3226     {"vcreate", _wrap_Vi_dev_factory_vcreate}, 
3227     {"do_match", _wrap_Vi_dev_factory_do_match}, 
3228     {0,0}
3229 };
3230 static swig_lua_attribute swig_Vi_Dev_factory_attributes[] = {
3231     {0,0,0}
3232 };
3233 static swig_lua_attribute swig_Vi_Dev_factory_cls_attributes[] = {
3234     {0,0,0}
3235 };
3236 static swig_lua_method swig_Vi_Dev_factory_cls_methods[] = {
3237     {"create", _wrap_Vi_dev_factory_create}, 
3238     {0,0}
3239 };
3240 static swig_lua_const_info swig_Vi_Dev_factory_cls_constants[] = {
3241     {0,0,0,0,0,0}
3242 };
3243 static swig_lua_class *swig_Vi_Dev_factory_bases[] = {0};
3244 static const char *swig_Vi_Dev_factory_base_names[] = {0};
3245 static swig_lua_class _wrap_class_Vi_Dev_factory = { "Vi_dev_factory", &SWIGTYPE_p_Vi__Dev_factory,0,0, swig_Vi_Dev_factory_methods, swig_Vi_Dev_factory_attributes, { "Vi_dev_factory", swig_Vi_Dev_factory_cls_methods, swig_Vi_Dev_factory_cls_attributes, swig_Vi_Dev_factory_cls_constants }, swig_Vi_Dev_factory_bases, swig_Vi_Dev_factory_base_names };
3246
3247 static int _wrap_Hw_device_set_property(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3248   char *arg2 = (char *) 0 ; Hw::Device::Prop_val *arg3 = 0 ; Hw::Device::Prop_val tmp3 ; int result;
3249   SWIG_check_num_args("Hw::Device::set_property",3,3)
3250   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::set_property",1,"Hw::Device *");
3251   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("Hw::Device::set_property",2,"char const *");
3252   if(!is_lua_propval(L,3)) SWIG_fail_arg("Hw::Device::set_property",3,"Hw::Device::Prop_val const &");
3253   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3254     SWIG_fail_ptr("Hw_device_set_property",1,SWIGTYPE_p_Hw__Device); }  arg2 = (char *)lua_tostring(L, 2);
3255   tmp3 = to_lua_propval(L, 3); arg3 = &tmp3; 
3256   result = (int)(arg1)->set_property((char const *)arg2,(Hw::Device::Prop_val const &)*arg3);
3257   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3258 static int _wrap_Hw_device_add_child(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3259   Hw::Device *arg2 = (Hw::Device *) 0 ; SWIG_check_num_args("Hw::Device::add_child",2,2)
3260   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::add_child",1,"Hw::Device *");
3261   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Hw::Device::add_child",2,"Hw::Device *");
3262   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3263     SWIG_fail_ptr("Hw_device_add_child",1,SWIGTYPE_p_Hw__Device); } 
3264   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Hw__Device,SWIG_POINTER_DISOWN))){
3265     SWIG_fail_ptr("Hw_device_add_child",2,SWIGTYPE_p_Hw__Device); }  (arg1)->add_child(arg2); return SWIG_arg; if(0) SWIG_fail;
3266   fail: lua_error(L); return SWIG_arg; }
3267 static int _wrap_Hw_device_add_cid(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3268   char *arg2 = (char *) 0 ; SWIG_check_num_args("Hw::Device::add_cid",2,2)
3269   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::add_cid",1,"Hw::Device *");
3270   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("Hw::Device::add_cid",2,"char const *");
3271   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3272     SWIG_fail_ptr("Hw_device_add_cid",1,SWIGTYPE_p_Hw__Device); }  arg2 = (char *)lua_tostring(L, 2);
3273   (arg1)->add_cid((char const *)arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3274 static int _wrap_Hw_device_set_name(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3275   char *arg2 = (char *) 0 ; SWIG_check_num_args("Hw::Device::set_name",2,2)
3276   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::set_name",1,"Hw::Device *");
3277   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("Hw::Device::set_name",2,"char const *");
3278   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3279     SWIG_fail_ptr("Hw_device_set_name",1,SWIGTYPE_p_Hw__Device); }  arg2 = (char *)lua_tostring(L, 2);
3280   (arg1)->set_name((char const *)arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3281 static int _wrap_Hw_device_name(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ; char *result = 0 ;
3282   SWIG_check_num_args("Hw::Device::name",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::name",1,"Hw::Device const *");
3283   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3284     SWIG_fail_ptr("Hw_device_name",1,SWIGTYPE_p_Hw__Device); }  result = (char *)((Hw::Device const *)arg1)->name();
3285   lua_pushstring(L,(const char *)result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3286 static int _wrap_Hw_device_match_cid(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3287   char *arg2 = (char *) 0 ; bool result; SWIG_check_num_args("Hw::Device::match_cid",2,2)
3288   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::match_cid",1,"Hw::Device const *");
3289   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("Hw::Device::match_cid",2,"char const *");
3290   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3291     SWIG_fail_ptr("Hw_device_match_cid",1,SWIGTYPE_p_Hw__Device); }  arg2 = (char *)lua_tostring(L, 2);
3292   result = (bool)((Hw::Device const *)arg1)->match_cid((char const *)arg2); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
3293   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3294 static int _wrap_Hw_device_parent(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3295   Hw::Device *result = 0 ; SWIG_check_num_args("Hw::Device::parent",1,1)
3296   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::parent",1,"Hw::Device const *");
3297   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3298     SWIG_fail_ptr("Hw_device_parent",1,SWIGTYPE_p_Hw__Device); }  result = (Hw::Device *)((Hw::Device const *)arg1)->parent();
3299   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Hw__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3300   return SWIG_arg; }
3301 static int _wrap_Hw_device_children(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3302   Hw::Device *result = 0 ; SWIG_check_num_args("Hw::Device::children",1,1)
3303   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::children",1,"Hw::Device const *");
3304   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3305     SWIG_fail_ptr("Hw_device_children",1,SWIGTYPE_p_Hw__Device); } 
3306   result = (Hw::Device *)((Hw::Device const *)arg1)->children();
3307   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Hw__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3308   return SWIG_arg; }
3309 static int _wrap_Hw_device_next(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ; Hw::Device *result = 0 ;
3310   SWIG_check_num_args("Hw::Device::next",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::next",1,"Hw::Device const *");
3311   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3312     SWIG_fail_ptr("Hw_device_next",1,SWIGTYPE_p_Hw__Device); }  result = (Hw::Device *)((Hw::Device const *)arg1)->next();
3313   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Hw__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3314   return SWIG_arg; }
3315 static int _wrap_Hw_device_depth(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ; int result;
3316   SWIG_check_num_args("Hw::Device::depth",1,1)
3317   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::depth",1,"Hw::Device const *");
3318   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3319     SWIG_fail_ptr("Hw_device_depth",1,SWIGTYPE_p_Hw__Device); }  result = (int)((Hw::Device const *)arg1)->depth();
3320   lua_pushinteger(L, result); SWIG_arg++; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3321 static int _wrap_Hw_device_plugin(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3322   SWIG_check_num_args("Hw::Device::plugin",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::plugin",1,"Hw::Device *");
3323   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3324     SWIG_fail_ptr("Hw_device_plugin",1,SWIGTYPE_p_Hw__Device); }  (arg1)->plugin(); return SWIG_arg; if(0) SWIG_fail; fail:
3325   lua_error(L); return SWIG_arg; }
3326 static int _wrap_Hw_device_dump(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ; int arg2 ;
3327   SWIG_check_num_args("Hw::Device::dump",2,2) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::dump",1,"Hw::Device const *");
3328   if(!lua_isnumber(L,2)) SWIG_fail_arg("Hw::Device::dump",2,"int");
3329   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3330     SWIG_fail_ptr("Hw_device_dump",1,SWIGTYPE_p_Hw__Device); }  arg2 = (int)lua_tointeger(L, 2);
3331   ((Hw::Device const *)arg1)->dump(arg2); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3332 static int _wrap_Hw_device_find_by_name(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3333   std::string *arg2 = 0 ; std::string temp2 ; Hw::Device *result = 0 ; SWIG_check_num_args("Hw::Device::find_by_name",2,2)
3334   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::find_by_name",1,"Hw::Device const *");
3335   if(!lua_isstring(L,2)) SWIG_fail_arg("Hw::Device::find_by_name",2,"std::string const &");
3336   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3337     SWIG_fail_ptr("Hw_device_find_by_name",1,SWIGTYPE_p_Hw__Device); } 
3338   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
3339   result = (Hw::Device *)Hw_Device_find_by_name((Hw::Device const *)arg1,(std::string const &)*arg2);
3340   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Hw__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3341   return SWIG_arg; }
3342 static int _wrap_Hw_device___getitem(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3343   std::string *arg2 = 0 ; std::string temp2 ; Hw::Device *result = 0 ; SWIG_check_num_args("Hw::Device::__getitem",2,2)
3344   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::__getitem",1,"Hw::Device const *");
3345   if(!lua_isstring(L,2)) SWIG_fail_arg("Hw::Device::__getitem",2,"std::string const &");
3346   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3347     SWIG_fail_ptr("Hw_device___getitem",1,SWIGTYPE_p_Hw__Device); } 
3348   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
3349   result = (Hw::Device *)Hw_Device___getitem((Hw::Device const *)arg1,(std::string const &)*arg2);
3350   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Hw__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3351   return SWIG_arg; }
3352 static int _wrap_Hw_device___setitem(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ;
3353   std::string *arg2 = 0 ; Hw::Device *arg3 = (Hw::Device *) 0 ; std::string temp2 ;
3354   SWIG_check_num_args("Hw::Device::__setitem",3,3)
3355   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device::__setitem",1,"Hw::Device *");
3356   if(!lua_isstring(L,2)) SWIG_fail_arg("Hw::Device::__setitem",2,"std::string const &");
3357   if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("Hw::Device::__setitem",3,"Hw::Device *");
3358   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3359     SWIG_fail_ptr("Hw_device___setitem",1,SWIGTYPE_p_Hw__Device); } 
3360   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
3361   if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_Hw__Device,0))){
3362     SWIG_fail_ptr("Hw_device___setitem",3,SWIGTYPE_p_Hw__Device); }  Hw_Device___setitem(arg1,(std::string const &)*arg2,arg3);
3363   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3364 static void swig_delete_Hw_device(void *obj) {
3365 Hw::Device *arg1 = (Hw::Device *) obj;
3366 delete arg1;
3367 }
3368 static swig_lua_method swig_Hw_Device_methods[] = {
3369     {"set_property", _wrap_Hw_device_set_property}, 
3370     {"add_child", _wrap_Hw_device_add_child}, 
3371     {"add_cid", _wrap_Hw_device_add_cid}, 
3372     {"set_name", _wrap_Hw_device_set_name}, 
3373     {"name", _wrap_Hw_device_name}, 
3374     {"match_cid", _wrap_Hw_device_match_cid}, 
3375     {"parent", _wrap_Hw_device_parent}, 
3376     {"children", _wrap_Hw_device_children}, 
3377     {"next", _wrap_Hw_device_next}, 
3378     {"depth", _wrap_Hw_device_depth}, 
3379     {"plugin", _wrap_Hw_device_plugin}, 
3380     {"dump", _wrap_Hw_device_dump}, 
3381     {"find_by_name", _wrap_Hw_device_find_by_name}, 
3382     {"__getitem", _wrap_Hw_device___getitem}, 
3383     {"__setitem", _wrap_Hw_device___setitem}, 
3384     {0,0}
3385 };
3386 static swig_lua_attribute swig_Hw_Device_attributes[] = {
3387     {0,0,0}
3388 };
3389 static swig_lua_attribute swig_Hw_Device_cls_attributes[] = {
3390     {0,0,0}
3391 };
3392 static swig_lua_method swig_Hw_Device_cls_methods[] = {
3393     {0,0}
3394 };
3395 static swig_lua_const_info swig_Hw_Device_cls_constants[] = {
3396     {0,0,0,0,0,0}
3397 };
3398 static swig_lua_class *swig_Hw_Device_bases[] = {0,0};
3399 static const char *swig_Hw_Device_base_names[] = {"Generic_device *",0};
3400 static swig_lua_class _wrap_class_Hw_Device = { "Hw_device", &SWIGTYPE_p_Hw__Device,0, swig_delete_Hw_device, swig_Hw_Device_methods, swig_Hw_Device_attributes, { "Hw_device", swig_Hw_Device_cls_methods, swig_Hw_Device_cls_attributes, swig_Hw_Device_cls_constants }, swig_Hw_Device_bases, swig_Hw_Device_base_names };
3401
3402 static int _wrap_Hw_dev_factory_create__SWIG_0(lua_State* L) { int SWIG_arg = 0;
3403   Hw::Device_factory *arg1 = (Hw::Device_factory *) 0 ; Hw::Device *result = 0 ;
3404   SWIG_check_num_args("Hw::Device_factory::create",1,1)
3405   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Hw::Device_factory::create",1,"Hw::Device_factory *");
3406   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device_factory,0))){
3407     SWIG_fail_ptr("Hw_dev_factory_create",1,SWIGTYPE_p_Hw__Device_factory); }  result = (Hw::Device *)(arg1)->create();
3408   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Hw__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3409   return SWIG_arg; }
3410 static int _wrap_Hw_dev_factory_create__SWIG_1(lua_State* L) { int SWIG_arg = 0; char *arg1 = (char *) 0 ;
3411   Hw::Device *result = 0 ; SWIG_check_num_args("Hw::Device_factory::create",1,1)
3412   if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("Hw::Device_factory::create",1,"char const *");
3413   arg1 = (char *)lua_tostring(L, 1); result = (Hw::Device *)Hw::Device_factory::create((char const *)arg1);
3414   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Hw__Device,0); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3415   return SWIG_arg; }
3416 static int _wrap_Hw_dev_factory_create(lua_State* L) { int argc; int argv[2]={ 1,2} ; argc = lua_gettop(L); if (argc == 1) {
3417     int _v; { void *ptr;
3418       if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Hw__Device_factory, 0)) {
3419         _v = 0; }  else { _v = 1; }  }  if (_v) { return _wrap_Hw_dev_factory_create__SWIG_0(L);}  }  if (argc == 1) { int _v; {
3420       _v = SWIG_lua_isnilstring(L,argv[0]); }  if (_v) { return _wrap_Hw_dev_factory_create__SWIG_1(L);}  } 
3421   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Hw_dev_factory_create'\n"
3422   "  Possible C/C++ prototypes are:\n" "    Hw::Device_factory::create()\n" "    Hw::Device_factory::create(char const *)\n");
3423   lua_error(L);return 0; }
3424 static swig_lua_method swig_Hw_Device_factory_methods[] = {
3425     {0,0}
3426 };
3427 static swig_lua_attribute swig_Hw_Device_factory_attributes[] = {
3428     {0,0,0}
3429 };
3430 static swig_lua_attribute swig_Hw_Device_factory_cls_attributes[] = {
3431     {0,0,0}
3432 };
3433 static swig_lua_method swig_Hw_Device_factory_cls_methods[] = {
3434     {"create", _wrap_Hw_dev_factory_create}, 
3435     {0,0}
3436 };
3437 static swig_lua_const_info swig_Hw_Device_factory_cls_constants[] = {
3438     {0,0,0,0,0,0}
3439 };
3440 static swig_lua_class *swig_Hw_Device_factory_bases[] = {0};
3441 static const char *swig_Hw_Device_factory_base_names[] = {0};
3442 static swig_lua_class _wrap_class_Hw_Device_factory = { "Hw_dev_factory", &SWIGTYPE_p_Hw__Device_factory,0,0, swig_Hw_Device_factory_methods, swig_Hw_Device_factory_attributes, { "Hw_dev_factory", swig_Hw_Device_factory_cls_methods, swig_Hw_Device_factory_cls_attributes, swig_Hw_Device_factory_cls_constants }, swig_Hw_Device_factory_bases, swig_Hw_Device_factory_base_names };
3443
3444 static int _wrap_system_bus(lua_State* L) { int SWIG_arg = 0; Hw::Device *result = 0 ; SWIG_check_num_args("system_bus",0,0)
3445   result = (Hw::Device *)system_bus(); SWIG_NewPointerObj(L,result,SWIGTYPE_p_Hw__Device,0); SWIG_arg++;  return SWIG_arg;
3446   if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3447 static int _wrap_dump_devs(lua_State* L) { int SWIG_arg = 0; Device *arg1 = (Device *) 0 ; SWIG_check_num_args("dump_devs",1,1)
3448   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("dump_devs",1,"Device *");
3449   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Device,0))){ SWIG_fail_ptr("dump_devs",1,SWIGTYPE_p_Device); } 
3450   dump_devs(arg1); return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3451 static int _wrap_add_vbus(lua_State* L) { int SWIG_arg = 0; Vi::Device *arg1 = (Vi::Device *) 0 ; int result;
3452   SWIG_check_num_args("add_vbus",1,1) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("add_vbus",1,"Vi::Device *");
3453   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Vi__Device,0))){
3454     SWIG_fail_ptr("add_vbus",1,SWIGTYPE_p_Vi__Device); }  result = (int)add_vbus(arg1); lua_pushinteger(L, result); SWIG_arg++;
3455   return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
3456 static int _wrap_new_Gpio_resource(lua_State* L) { int SWIG_arg = 0; Hw::Device *arg1 = (Hw::Device *) 0 ; unsigned int arg2 ;
3457   unsigned int arg3 ; Gpio_resource *result = 0 ; SWIG_check_num_args("Gpio_resource::Gpio_resource",3,3)
3458   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Gpio_resource::Gpio_resource",1,"Hw::Device *");
3459   if(!lua_isnumber(L,2)) SWIG_fail_arg("Gpio_resource::Gpio_resource",2,"unsigned int");
3460   if(!lua_isnumber(L,3)) SWIG_fail_arg("Gpio_resource::Gpio_resource",3,"unsigned int");
3461   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Hw__Device,0))){
3462     SWIG_fail_ptr("new_Gpio_resource",1,SWIGTYPE_p_Hw__Device); }   arg2 = (unsigned int)lua_tointeger(L, 2); 
3463   arg3 = (unsigned int)lua_tointeger(L, 3); try { result = (Gpio_resource *)new Gpio_resource(arg1,arg2,arg3);} 
3464   catch(char const *_e) { lua_pushstring(L,_e);SWIG_fail; } 
3465   SWIG_NewPointerObj(L,result,SWIGTYPE_p_Gpio_resource,1); SWIG_arg++;  return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L);
3466   return SWIG_arg; }
3467 static void swig_delete_Gpio_resource(void *obj) {
3468 Gpio_resource *arg1 = (Gpio_resource *) obj;
3469 delete arg1;
3470 }
3471 static swig_lua_method swig_Gpio_resource_methods[] = {
3472     {0,0}
3473 };
3474 static swig_lua_attribute swig_Gpio_resource_attributes[] = {
3475     {0,0,0}
3476 };
3477 static swig_lua_attribute swig_Gpio_resource_cls_attributes[] = {
3478     {0,0,0}
3479 };
3480 static swig_lua_method swig_Gpio_resource_cls_methods[] = {
3481     {0,0}
3482 };
3483 static swig_lua_const_info swig_Gpio_resource_cls_constants[] = {
3484     {0,0,0,0,0,0}
3485 };
3486 static swig_lua_class *swig_Gpio_resource_bases[] = {0,0};
3487 static const char *swig_Gpio_resource_base_names[] = {"Resource *",0};
3488 static swig_lua_class _wrap_class_Gpio_resource = { "Gpio_resource", &SWIGTYPE_p_Gpio_resource,_wrap_new_Gpio_resource, swig_delete_Gpio_resource, swig_Gpio_resource_methods, swig_Gpio_resource_attributes, { "Gpio_resource", swig_Gpio_resource_cls_methods, swig_Gpio_resource_cls_attributes, swig_Gpio_resource_cls_constants }, swig_Gpio_resource_bases, swig_Gpio_resource_base_names };
3489
3490 #ifdef __cplusplus
3491 // removed: }
3492 #endif
3493
3494 static const struct luaL_Reg swig_commands[] = {
3495     { "swig_class",swig_class},
3496     { "swig_instance_of",swig_instance_of},
3497     { "Resource_str_to_id", _wrap_Resource_str_to_id},
3498     { "Vi_dev_factory_create",_wrap_Vi_dev_factory_create},
3499     { "Hw_dev_factory_create",_wrap_Hw_dev_factory_create},
3500     { "system_bus", _wrap_system_bus},
3501     { "dump_devs", _wrap_dump_devs},
3502     { "add_vbus", _wrap_add_vbus},
3503     {0,0}
3504 };
3505
3506 static swig_lua_var_info swig_variables[] = {
3507     {0,0,0}
3508 };
3509
3510 static swig_lua_const_info swig_constants[] = {
3511     {SWIG_LUA_CONSTTAB_INT("Resource_Invalid_res", Resource::Invalid_res)},
3512     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_res", Resource::Irq_res)},
3513     {SWIG_LUA_CONSTTAB_INT("Resource_Mmio_res", Resource::Mmio_res)},
3514     {SWIG_LUA_CONSTTAB_INT("Resource_Io_res", Resource::Io_res)},
3515     {SWIG_LUA_CONSTTAB_INT("Resource_Bus_res", Resource::Bus_res)},
3516     {SWIG_LUA_CONSTTAB_INT("Resource_Gpio_res", Resource::Gpio_res)},
3517     {SWIG_LUA_CONSTTAB_INT("Resource_F_type_mask", Resource::F_type_mask)},
3518     {SWIG_LUA_CONSTTAB_INT("Resource_F_disabled", Resource::F_disabled)},
3519     {SWIG_LUA_CONSTTAB_INT("Resource_F_hierarchical", Resource::F_hierarchical)},
3520     {SWIG_LUA_CONSTTAB_INT("Resource_F_prefetchable", Resource::F_prefetchable)},
3521     {SWIG_LUA_CONSTTAB_INT("Resource_F_size_aligned", Resource::F_size_aligned)},
3522     {SWIG_LUA_CONSTTAB_INT("Resource_F_empty", Resource::F_empty)},
3523     {SWIG_LUA_CONSTTAB_INT("Resource_F_rom", Resource::F_rom)},
3524     {SWIG_LUA_CONSTTAB_INT("Resource_F_can_resize", Resource::F_can_resize)},
3525     {SWIG_LUA_CONSTTAB_INT("Resource_F_can_move", Resource::F_can_move)},
3526     {SWIG_LUA_CONSTTAB_INT("Resource_F_width_64bit", Resource::F_width_64bit)},
3527     {SWIG_LUA_CONSTTAB_INT("Resource_F_relative", Resource::F_relative)},
3528     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_type_base", Resource::Irq_type_base)},
3529     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_type_mask", Resource::Irq_type_mask)},
3530     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_type_none", Resource::Irq_type_none)},
3531     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_type_level_high", Resource::Irq_type_level_high)},
3532     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_type_level_low", Resource::Irq_type_level_low)},
3533     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_type_raising_edge", Resource::Irq_type_raising_edge)},
3534     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_type_falling_edge", Resource::Irq_type_falling_edge)},
3535     {SWIG_LUA_CONSTTAB_INT("Resource_Irq_type_both_edges", Resource::Irq_type_both_edges)},
3536     {0,0,0,0,0,0}
3537 };
3538
3539 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3540
3541 static void *_p_Vi__DeviceTo_p_Generic_device(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3542     return (void *)((Generic_device *)  ((Vi::Device *) x));
3543 }
3544 static void *_p_Hw__DeviceTo_p_Generic_device(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3545     return (void *)((Generic_device *)  ((Hw::Device *) x));
3546 }
3547 static void *_p_Generic_deviceTo_p_Device(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3548     return (void *)((Device *)  ((Generic_device *) x));
3549 }
3550 static void *_p_Vi__DeviceTo_p_Device(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3551     return (void *)((Device *) (Generic_device *) ((Vi::Device *) x));
3552 }
3553 static void *_p_Hw__DeviceTo_p_Device(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3554     return (void *)((Device *) (Generic_device *) ((Hw::Device *) x));
3555 }
3556 static void *_p_Root_resourceTo_p_Resource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3557     return (void *)((Resource *)  ((Root_resource *) x));
3558 }
3559 static void *_p_Mmio_data_spaceTo_p_Resource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3560     return (void *)((Resource *)  ((Mmio_data_space *) x));
3561 }
3562 static void *_p_Gpio_resourceTo_p_Resource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3563     return (void *)((Resource *)  ((Gpio_resource *) x));
3564 }
3565 static void *_p_Resource_providerTo_p_Resource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
3566     return (void *)((Resource *)  ((Resource_provider *) x));
3567 }
3568 static swig_type_info _swigt__p_Addr = {"_p_Addr", "Addr *", 0, 0, (void*)0, 0};
3569 static swig_type_info _swigt__p_Device = {"_p_Device", "Device *", 0, 0, (void*)&_wrap_class_Device, 0};
3570 static swig_type_info _swigt__p_Generic_device = {"_p_Generic_device", "Generic_device *", 0, 0, (void*)&_wrap_class_Generic_device, 0};
3571 static swig_type_info _swigt__p_Gpio_resource = {"_p_Gpio_resource", "Gpio_resource *", 0, 0, (void*)&_wrap_class_Gpio_resource, 0};
3572 static swig_type_info _swigt__p_Hw__Device = {"_p_Hw__Device", "Device *|Hw::Device *", 0, 0, (void*)&_wrap_class_Hw_Device, 0};
3573 static swig_type_info _swigt__p_Hw__Device__Prop_val = {"_p_Hw__Device__Prop_val", "Hw::Device::Prop_val *", 0, 0, (void*)0, 0};
3574 static swig_type_info _swigt__p_Hw__Device_factory = {"_p_Hw__Device_factory", "Hw::Device_factory *", 0, 0, (void*)&_wrap_class_Hw_Device_factory, 0};
3575 static swig_type_info _swigt__p_L4Re__Rm__Auto_regionT_l4_addr_t_t = {"_p_L4Re__Rm__Auto_regionT_l4_addr_t_t", "L4Re::Rm::Auto_region< l4_addr_t > *", 0, 0, (void*)0, 0};
3576 static swig_type_info _swigt__p_Mmio_data_space = {"_p_Mmio_data_space", "Mmio_data_space *", 0, 0, (void*)&_wrap_class_Mmio_data_space, 0};
3577 static swig_type_info _swigt__p_Resource = {"_p_Resource", "Resource *", 0, 0, (void*)&_wrap_class_Resource, 0};
3578 static swig_type_info _swigt__p_Root_resource = {"_p_Root_resource", 0, 0, 0, 0, 0};
3579 static swig_type_info _swigt__p_Resource_provider = {"_p_Resource_provider", 0, 0, 0, 0, 0};
3580 static swig_type_info _swigt__p_Resource_space = {"_p_Resource_space", "Resource_space *", 0, 0, (void*)0, 0};
3581 static swig_type_info _swigt__p_Size = {"_p_Size", "Size *", 0, 0, (void*)0, 0};
3582 static swig_type_info _swigt__p_Vi__Dev_factory = {"_p_Vi__Dev_factory", "Vi::Dev_factory *", 0, 0, (void*)&_wrap_class_Vi_Dev_factory, 0};
3583 static swig_type_info _swigt__p_Vi__Device = {"_p_Vi__Device", "Device *|Vi::Device *", 0, 0, (void*)&_wrap_class_Vi_Device, 0};
3584 static swig_type_info _swigt__p_l4vbus_device_handle_t = {"_p_l4vbus_device_handle_t", "l4vbus_device_handle_t *", 0, 0, (void*)0, 0};
3585 static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)&_wrap_class_std_string, 0};
3586
3587 static swig_type_info *swig_type_initial[] = {
3588   &_swigt__p_Addr,
3589   &_swigt__p_Device,
3590   &_swigt__p_Generic_device,
3591   &_swigt__p_Gpio_resource,
3592   &_swigt__p_Hw__Device,
3593   &_swigt__p_Hw__Device__Prop_val,
3594   &_swigt__p_Hw__Device_factory,
3595   &_swigt__p_L4Re__Rm__Auto_regionT_l4_addr_t_t,
3596   &_swigt__p_Mmio_data_space,
3597   &_swigt__p_Resource,
3598   &_swigt__p_Resource_provider,
3599   &_swigt__p_Resource_space,
3600   &_swigt__p_Root_resource,
3601   &_swigt__p_Size,
3602   &_swigt__p_Vi__Dev_factory,
3603   &_swigt__p_Vi__Device,
3604   &_swigt__p_l4vbus_device_handle_t,
3605   &_swigt__p_std__string,
3606 };
3607
3608 static swig_cast_info _swigc__p_Addr[] = {  {&_swigt__p_Addr, 0, 0, 0},{0, 0, 0, 0}};
3609 static swig_cast_info _swigc__p_Device[] = {  {&_swigt__p_Generic_device, _p_Generic_deviceTo_p_Device, 0, 0},  {&_swigt__p_Device, 0, 0, 0},  {&_swigt__p_Vi__Device, _p_Vi__DeviceTo_p_Device, 0, 0},  {&_swigt__p_Hw__Device, _p_Hw__DeviceTo_p_Device, 0, 0},{0, 0, 0, 0}};
3610 static swig_cast_info _swigc__p_Generic_device[] = {  {&_swigt__p_Generic_device, 0, 0, 0},  {&_swigt__p_Vi__Device, _p_Vi__DeviceTo_p_Generic_device, 0, 0},  {&_swigt__p_Hw__Device, _p_Hw__DeviceTo_p_Generic_device, 0, 0},{0, 0, 0, 0}};
3611 static swig_cast_info _swigc__p_Gpio_resource[] = {  {&_swigt__p_Gpio_resource, 0, 0, 0},{0, 0, 0, 0}};
3612 static swig_cast_info _swigc__p_Hw__Device[] = {  {&_swigt__p_Hw__Device, 0, 0, 0},{0, 0, 0, 0}};
3613 static swig_cast_info _swigc__p_Hw__Device__Prop_val[] = {  {&_swigt__p_Hw__Device__Prop_val, 0, 0, 0},{0, 0, 0, 0}};
3614 static swig_cast_info _swigc__p_Hw__Device_factory[] = {  {&_swigt__p_Hw__Device_factory, 0, 0, 0},{0, 0, 0, 0}};
3615 static swig_cast_info _swigc__p_L4Re__Rm__Auto_regionT_l4_addr_t_t[] = {  {&_swigt__p_L4Re__Rm__Auto_regionT_l4_addr_t_t, 0, 0, 0},{0, 0, 0, 0}};
3616 static swig_cast_info _swigc__p_Mmio_data_space[] = {  {&_swigt__p_Mmio_data_space, 0, 0, 0},{0, 0, 0, 0}};
3617 static swig_cast_info _swigc__p_Root_resource[] = {{&_swigt__p_Root_resource, 0, 0, 0},{0, 0, 0, 0}};
3618 static swig_cast_info _swigc__p_Resource_provider[] = {{&_swigt__p_Resource_provider, 0, 0, 0},{0, 0, 0, 0}};
3619 static swig_cast_info _swigc__p_Resource[] = {  {&_swigt__p_Resource, 0, 0, 0},  {&_swigt__p_Root_resource, _p_Root_resourceTo_p_Resource, 0, 0},  {&_swigt__p_Mmio_data_space, _p_Mmio_data_spaceTo_p_Resource, 0, 0},  {&_swigt__p_Gpio_resource, _p_Gpio_resourceTo_p_Resource, 0, 0},  {&_swigt__p_Resource_provider, _p_Resource_providerTo_p_Resource, 0, 0},{0, 0, 0, 0}};
3620 static swig_cast_info _swigc__p_Resource_space[] = {  {&_swigt__p_Resource_space, 0, 0, 0},{0, 0, 0, 0}};
3621 static swig_cast_info _swigc__p_Size[] = {  {&_swigt__p_Size, 0, 0, 0},{0, 0, 0, 0}};
3622 static swig_cast_info _swigc__p_Vi__Dev_factory[] = {  {&_swigt__p_Vi__Dev_factory, 0, 0, 0},{0, 0, 0, 0}};
3623 static swig_cast_info _swigc__p_Vi__Device[] = {  {&_swigt__p_Vi__Device, 0, 0, 0},{0, 0, 0, 0}};
3624 static swig_cast_info _swigc__p_l4vbus_device_handle_t[] = {  {&_swigt__p_l4vbus_device_handle_t, 0, 0, 0},{0, 0, 0, 0}};
3625 static swig_cast_info _swigc__p_std__string[] = {  {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
3626
3627 static swig_cast_info *swig_cast_initial[] = {
3628   _swigc__p_Addr,
3629   _swigc__p_Device,
3630   _swigc__p_Generic_device,
3631   _swigc__p_Gpio_resource,
3632   _swigc__p_Hw__Device,
3633   _swigc__p_Hw__Device__Prop_val,
3634   _swigc__p_Hw__Device_factory,
3635   _swigc__p_L4Re__Rm__Auto_regionT_l4_addr_t_t,
3636   _swigc__p_Mmio_data_space,
3637   _swigc__p_Resource,
3638   _swigc__p_Resource_provider,
3639   _swigc__p_Resource_space,
3640   _swigc__p_Root_resource,
3641   _swigc__p_Size,
3642   _swigc__p_Vi__Dev_factory,
3643   _swigc__p_Vi__Device,
3644   _swigc__p_l4vbus_device_handle_t,
3645   _swigc__p_std__string,
3646 };
3647
3648
3649 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3650
3651 /* -----------------------------------------------------------------------------
3652  * Type initialization:
3653  * This problem is tough by the requirement that no dynamic
3654  * memory is used. Also, since swig_type_info structures store pointers to
3655  * swig_cast_info structures and swig_cast_info structures store pointers back
3656  * to swig_type_info structures, we need some lookup code at initialization.
3657  * The idea is that swig generates all the structures that are needed.
3658  * The runtime then collects these partially filled structures.
3659  * The SWIG_InitializeModule function takes these initial arrays out of
3660  * swig_module, and does all the lookup, filling in the swig_module.types
3661  * array with the correct data and linking the correct swig_cast_info
3662  * structures together.
3663  *
3664  * The generated swig_type_info structures are assigned staticly to an initial
3665  * array. We just loop through that array, and handle each type individually.
3666  * First we lookup if this type has been already loaded, and if so, use the
3667  * loaded structure instead of the generated one. Then we have to fill in the
3668  * cast linked list. The cast data is initially stored in something like a
3669  * two-dimensional array. Each row corresponds to a type (there are the same
3670  * number of rows as there are in the swig_type_initial array). Each entry in
3671  * a column is one of the swig_cast_info structures for that type.
3672  * The cast_initial array is actually an array of arrays, because each row has
3673  * a variable number of columns. So to actually build the cast linked list,
3674  * we find the array of casts associated with the type, and loop through it
3675  * adding the casts to the list. The one last trick we need to do is making
3676  * sure the type pointer in the swig_cast_info struct is correct.
3677  *
3678  * First off, we lookup the cast->type name to see if it is already loaded.
3679  * There are three cases to handle:
3680  *  1) If the cast->type has already been loaded AND the type we are adding
3681  *     casting info to has not been loaded (it is in this module), THEN we
3682  *     replace the cast->type pointer with the type pointer that has already
3683  *     been loaded.
3684  *  2) If BOTH types (the one we are adding casting info to, and the
3685  *     cast->type) are loaded, THEN the cast info has already been loaded by
3686  *     the previous module so we just ignore it.
3687  *  3) Finally, if cast->type has not already been loaded, then we add that
3688  *     swig_cast_info to the linked list (because the cast->type) pointer will
3689  *     be correct.
3690  * ----------------------------------------------------------------------------- */
3691
3692 #ifdef __cplusplus
3693 // removed: extern "C" {
3694 #if 0
3695 } /* c-mode */
3696 #endif
3697 #endif
3698
3699 #if 0
3700 #define SWIGRUNTIME_DEBUG
3701 #endif
3702
3703
3704 SWIGRUNTIME void
3705 SWIG_InitializeModule(void *clientdata) {
3706   size_t i;
3707   swig_module_info *module_head, *iter;
3708   int found, init;
3709
3710   /* check to see if the circular list has been setup, if not, set it up */
3711   if (swig_module.next==0) {
3712     /* Initialize the swig_module */
3713     swig_module.type_initial = swig_type_initial;
3714     swig_module.cast_initial = swig_cast_initial;
3715     swig_module.next = &swig_module;
3716     init = 1;
3717   } else {
3718     init = 0;
3719   }
3720
3721   /* Try and load any already created modules */
3722   module_head = SWIG_GetModule(clientdata);
3723   if (!module_head) {
3724     /* This is the first module loaded for this interpreter */
3725     /* so set the swig module into the interpreter */
3726     SWIG_SetModule(clientdata, &swig_module);
3727     module_head = &swig_module;
3728   } else {
3729     /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3730     found=0;
3731     iter=module_head;
3732     do {
3733       if (iter==&swig_module) {
3734         found=1;
3735         break;
3736       }
3737       iter=iter->next;
3738     } while (iter!= module_head);
3739
3740     /* if the is found in the list, then all is done and we may leave */
3741     if (found) return;
3742     /* otherwise we must add out module into the list */
3743     swig_module.next = module_head->next;
3744     module_head->next = &swig_module;
3745   }
3746
3747   /* When multiple interpreters are used, a module could have already been initialized in
3748      a different interpreter, but not yet have a pointer in this interpreter.
3749      In this case, we do not want to continue adding types... everything should be
3750      set up already */
3751   if (init == 0) return;
3752
3753   /* Now work on filling in swig_module.types */
3754 #ifdef SWIGRUNTIME_DEBUG
3755   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
3756 #endif
3757   for (i = 0; i < swig_module.size; ++i) {
3758     swig_type_info *type = 0;
3759     swig_type_info *ret;
3760     swig_cast_info *cast;
3761
3762 #ifdef SWIGRUNTIME_DEBUG
3763     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3764 #endif
3765
3766     /* if there is another module already loaded */
3767     if (swig_module.next != &swig_module) {
3768       type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3769     }
3770     if (type) {
3771       /* Overwrite clientdata field */
3772 #ifdef SWIGRUNTIME_DEBUG
3773       printf("SWIG_InitializeModule: found type %s\n", type->name);
3774 #endif
3775       if (swig_module.type_initial[i]->clientdata) {
3776         type->clientdata = swig_module.type_initial[i]->clientdata;
3777 #ifdef SWIGRUNTIME_DEBUG
3778       printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3779 #endif
3780       }
3781     } else {
3782       type = swig_module.type_initial[i];
3783     }
3784
3785     /* Insert casting types */
3786     cast = swig_module.cast_initial[i];
3787     while (cast->type) {
3788
3789       /* Don't need to add information already in the list */
3790       ret = 0;
3791 #ifdef SWIGRUNTIME_DEBUG
3792       printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3793 #endif
3794       if (swig_module.next != &swig_module) {
3795         ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3796 #ifdef SWIGRUNTIME_DEBUG
3797         if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3798 #endif
3799       }
3800       if (ret) {
3801         if (type == swig_module.type_initial[i]) {
3802 #ifdef SWIGRUNTIME_DEBUG
3803           printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3804 #endif
3805           cast->type = ret;
3806           ret = 0;
3807         } else {
3808           /* Check for casting already in the list */
3809           swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3810 #ifdef SWIGRUNTIME_DEBUG
3811           if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3812 #endif
3813           if (!ocast) ret = 0;
3814         }
3815       }
3816
3817       if (!ret) {
3818 #ifdef SWIGRUNTIME_DEBUG
3819         printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3820 #endif
3821         if (type->cast) {
3822           type->cast->prev = cast;
3823           cast->next = type->cast;
3824         }
3825         type->cast = cast;
3826       }
3827       cast++;
3828     }
3829     /* Set entry in modules->types array equal to the type */
3830     swig_module.types[i] = type;
3831   }
3832   swig_module.types[i] = 0;
3833
3834 #ifdef SWIGRUNTIME_DEBUG
3835   printf("**** SWIG_InitializeModule: Cast List ******\n");
3836   for (i = 0; i < swig_module.size; ++i) {
3837     int j = 0;
3838     swig_cast_info *cast = swig_module.cast_initial[i];
3839     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3840     while (cast->type) {
3841       printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3842       cast++;
3843       ++j;
3844     }
3845   printf("---- Total casts: %d\n",j);
3846   }
3847   printf("**** SWIG_InitializeModule: Cast List ******\n");
3848 #endif
3849 }
3850
3851 /* This function will propagate the clientdata field of type to
3852 * any new swig_type_info structures that have been added into the list
3853 * of equivalent types.  It is like calling
3854 * SWIG_TypeClientData(type, clientdata) a second time.
3855 */
3856 SWIGRUNTIME void
3857 SWIG_PropagateClientData(void) {
3858   size_t i;
3859   swig_cast_info *equiv;
3860   static int init_run = 0;
3861
3862   if (init_run) return;
3863   init_run = 1;
3864
3865   for (i = 0; i < swig_module.size; i++) {
3866     if (swig_module.types[i]->clientdata) {
3867       equiv = swig_module.types[i]->cast;
3868       while (equiv) {
3869         if (!equiv->converter) {
3870           if (equiv->type && !equiv->type->clientdata)
3871             SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3872         }
3873         equiv = equiv->next;
3874       }
3875     }
3876   }
3877 }
3878
3879 #ifdef __cplusplus
3880 #if 0
3881 { /* c-mode */
3882 #endif
3883 // removed: }
3884 #endif
3885
3886
3887
3888 /* Forward declaration of where the user's %init{} gets inserted */
3889 void SWIG_init_user(lua_State* L );
3890     
3891 #ifdef __cplusplus
3892 // removed: extern "C" {
3893 #endif
3894 /* this is the initialization function
3895   added at the very end of the code
3896   the function is always called SWIG_init, but an earlier #define will rename it
3897 */
3898 #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
3899 LUALIB_API int SWIG_init(lua_State* L)
3900 #else
3901 SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
3902 #endif
3903 {
3904 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
3905   int i;
3906   /* start with global table */
3907   lua_pushglobaltable (L);
3908   /* SWIG's internal initalisation */
3909   SWIG_InitializeModule((void*)L);
3910   SWIG_PropagateClientData();
3911 #endif
3912
3913 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
3914   /* add a global fn */
3915   SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
3916   SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
3917   /* begin the module (its a table with the same name as the module) */
3918   SWIG_Lua_module_begin(L,SWIG_name);
3919   /* add commands/functions */
3920   for (i = 0; swig_commands[i].name; i++){
3921     SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
3922   }
3923   /* add variables */
3924   for (i = 0; swig_variables[i].name; i++){
3925     SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
3926   }
3927 #endif
3928
3929 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
3930   /* set up base class pointers (the hierarchy) */
3931   for (i = 0; swig_types[i]; i++){
3932     if (swig_types[i]->clientdata){
3933       SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
3934     }
3935   }
3936   /* additional registration structs & classes in lua */
3937   for (i = 0; swig_types[i]; i++){
3938     if (swig_types[i]->clientdata){
3939       SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
3940     }
3941   }
3942 #endif
3943
3944 #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
3945   /* constants */
3946   SWIG_Lua_InstallConstants(L,swig_constants);
3947 #endif
3948
3949 #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
3950   /* invoke user-specific initialization */
3951   SWIG_init_user(L);
3952   /* end module */
3953   /* Note: We do not clean up the stack here (Lua will do this for us). At this
3954      point, we have the globals table and out module table on the stack. Returning
3955      one value makes the module table the result of the require command. */
3956   return 1;
3957 #else
3958   return 0;
3959 #endif
3960 }
3961
3962 #ifdef __cplusplus
3963 // removed: }
3964 #endif
3965
3966
3967 const char* SWIG_LUACODE=
3968   "\n"
3969   "\n"
3970   "local function check_device(dev, depth, err)\n"
3971   "  if not Io.swig_instance_of(dev, \"Generic_device *\") then\n"
3972   "    local e = err or \"expected device, got: \" .. tostring(dev);\n"
3973   "    error(e, depth + 1);\n"
3974   "  end\n"
3975   "  return dev\n"
3976   "end\n"
3977   "\n"
3978   "Io.Res = {}\n"
3979   "\n"
3980   "function Io.Res.io(start, _end, flags)\n"
3981   "  local f = flags or 0\n"
3982   "  return Io.Resource(Io.Resource_Io_res, f, start, _end or start)\n"
3983   "end\n"
3984   "\n"
3985   "function Io.Res.mmio(start, _end, flags)\n"
3986   "  local f = flags or 0\n"
3987   "  return Io.Resource(Io.Resource_Mmio_res, f, start, _end or start)\n"
3988   "end\n"
3989   "\n"
3990   "function Io.Res.irq(start, flags)\n"
3991   "  local f = flags or 0\n"
3992   "  local s, e\n"
3993   "  if type(start) == \"table\" then\n"
3994   "    s = start[1]\n"
3995   "    e = start[2]\n"
3996   "  else\n"
3997   "    s = start\n"
3998   "    e = start\n"
3999   "  end\n"
4000   "  return Io.Resource(Io.Resource_Irq_res, f, s, e)\n"
4001   "end\n"
4002   "\n"
4003   "Io.Dt = {}\n"
4004   "\n"
4005   "function Io.Dt.add_child(parent, name, dev, idx)\n"
4006   "  parent:add_child(dev)\n"
4007   "  if dev.plugin and (parent:parent() or swig_equals(parent, Io.system_bus())) then\n"
4008   "    dev:plugin()\n"
4009   "  end\n"
4010   "  if type(name) == \"string\" then\n"
4011   "    if idx ~= nil then\n"
4012   "      name = name .. '[' .. idx ..']'\n"
4013   "    end\n"
4014   "    dev:set_name(name)\n"
4015   "  end\n"
4016   "end\n"
4017   "\n"
4018   "function Io.Dt.add_children(parent, bus_func)\n"
4019   "  check_device(parent, 2);\n"
4020   "  if type(bus_func) == \"function\" then\n"
4021   "    local d = {}\n"
4022   "    local my_env = getfenv(1)\n"
4023   "    local old_ENV = my_env._ENV;\n"
4024   "    my_env._ENV = d;\n"
4025   "    setmetatable(d, { __index = my_env })\n"
4026   "    setfenv(bus_func, d)\n"
4027   "    bus_func()\n"
4028   "    my_env._ENV = old_ENV;\n"
4029   "    Io.Dt.add_device_data(parent, d)\n"
4030   "  end\n"
4031   "  return parent;\n"
4032   "end\n"
4033   "\n"
4034   "function Io.Dt.iterator(dev, max_depth)\n"
4035   "  local max_d = (max_depth or 0) + dev:depth()\n"
4036   "  local current = dev\n"
4037   "  local start = dev\n"
4038   "  return function ()\n"
4039   "    local c = current\n"
4040   "    if c == nil then\n"
4041   "      return nil\n"
4042   "    end\n"
4043   "\n"
4044   "    local cd = c:depth()\n"
4045   "    local cc = c:children()\n"
4046   "    if max_d > cd and cc then\n"
4047   "      current = cc\n"
4048   "      return c\n"
4049   "    elseif c:next() then\n"
4050   "      current = c:next()\n"
4051   "      return c\n"
4052   "    else\n"
4053   "      local p = c\n"
4054   "      while (true) do\n"
4055   "        p = p:parent()\n"
4056   "        if (not p) or swig_equals(p, start) then\n"
4057   "          current = nil\n"
4058   "          return c\n"
4059   "        elseif p:next() then\n"
4060   "          current = p:next()\n"
4061   "          return c\n"
4062   "        end\n"
4063   "      end\n"
4064   "    end\n"
4065   "  end\n"
4066   "end\n"
4067   "\n"
4068   "function Io.Dt.match_cids(self, ...)\n"
4069   "  local r = {}\n"
4070   "  for _, v in ipairs{...} do\n"
4071   "    if self:match_cid(v) then\n"
4072   "      return true\n"
4073   "    end\n"
4074   "  end\n"
4075   "  return false\n"
4076   "end\n"
4077   "\n"
4078   "Io.Dt.PCI_cc =\n"
4079   "{\n"
4080   "  storage = \"CC_01\",\n"
4081   "  network = \"CC_02\",\n"
4082   "  display = \"CC_03\",\n"
4083   "  media   = \"CC_04\",\n"
4084   "  bridge  = \"CC_06\",\n"
4085   "  com     = \"CC_07\",\n"
4086   "  usb     = \"CC_0c\",\n"
4087   "  wlan    = \"CC_0d\",\n"
4088   "}\n"
4089   "\n"
4090   "Io.Dt.MAX_DEPTH = 1000\n"
4091   "\n"
4092   "function Io.Dt.Range(start, stop)\n"
4093   "  return { range = true, start, stop }\n"
4094   "end\n"
4095   "\n"
4096   "function Io.Dt.match(self, ...)\n"
4097   "  local cids = {...}\n"
4098   "  for t,v in pairs(Io.Dt.PCI_cc) do\n"
4099   "    for i, cid in ipairs(cids) do\n"
4100   "      cids[i] = cid:gsub(\"(PCI/\"..t..\")\", \"PCI/\" .. v)\n"
4101   "    end\n"
4102   "  end\n"
4103   "\n"
4104   "  local devs = {}\n"
4105   "  for d in self:devices(Io.Dt.MAX_DEPTH) do\n"
4106   "    if d:match_cids(unpack(cids)) then\n"
4107   "      devs[#devs+1] = d\n"
4108   "    end\n"
4109   "  end\n"
4110   "  return devs\n"
4111   "end\n"
4112   "\n"
4113   "function Io.Dt.device(self, path)\n"
4114   "  for i in string.gmatch(path, \"([^%./]+)%.*\") do\n"
4115   "    self = self:find_by_name(i)\n"
4116   "    if self == nil then\n"
4117   "      return nil\n"
4118   "    end\n"
4119   "  end\n"
4120   "  return self\n"
4121   "end\n"
4122   "\n"
4123   "function Io.Dt.resources(self)\n"
4124   "  local n = self:nresources()\n"
4125   "  local c = 0\n"
4126   "  return function ()\n"
4127   "    if c >= n then return nil end\n"
4128   "    c = c + 1\n"
4129   "    return self:resource(c - 1)\n"
4130   "  end\n"
4131   "end\n"
4132   "\n"
4133   "local hwfn = Io.swig_class(\"Hw_device\")[\".fn\"]\n"
4134   "local vifn = Io.swig_class(\"Vi_device\")[\".fn\"]\n"
4135   "\n"
4136   "local dev_fns =\n"
4137   "{\n"
4138   "  resources = Io.Dt.resources,\n"
4139   "  devices = Io.Dt.iterator,\n"
4140   "  match_cids = Io.Dt.match_cids,\n"
4141   "  match = Io.Dt.match,\n"
4142   "  device = Io.Dt.device\n"
4143   "}\n"
4144   "\n"
4145   "for name, func in pairs(dev_fns) do\n"
4146   "  hwfn[name] = func\n"
4147   "  vifn[name] = func\n"
4148   "end\n"
4149   "\n"
4150   "function vifn:add_filter_val(tag, value)\n"
4151   "  if type(value) == \"table\" and value.range then\n"
4152   "    return self:add_filter(tag, value[1], value[2])\n"
4153   "  elseif type(value) == \"table\" then\n"
4154   "    for _, v in ipairs(value) do\n"
4155   "      local res = self:add_filter_val(tag, v)\n"
4156   "      if res < 0 then\n"
4157   "        return res\n"
4158   "      end\n"
4159   "    end\n"
4160   "    return 0\n"
4161   "  else\n"
4162   "    return self:add_filter(tag, value)\n"
4163   "  end\n"
4164   "end\n"
4165   "\n"
4166   "local add_child = Io.Dt.add_child\n"
4167   "\n"
4168   "local function handle_device_member(dev, val, name)\n"
4169   "  if name == \"compatible\" then\n"
4170   "    if type(val) == \"table\" then\n"
4171   "      for k, v in ipairs(val) do\n"
4172   "        dev:add_cid(v)\n"
4173   "      end\n"
4174   "    elseif type(val) == \"string\" then\n"
4175   "      dev:add_cid(val)\n"
4176   "    end\n"
4177   "    return\n"
4178   "  elseif type(val) == \"table\" then\n"
4179   "    for i, v in pairs(val) do\n"
4180   "      handle_device_member(dev, v, name .. '[' .. i .. ']')\n"
4181   "    end\n"
4182   "    return\n"
4183   "  elseif Io.swig_instance_of(val, \"Resource *\") then\n"
4184   "    val:set_id(name)\n"
4185   "    dev:add_resource(val)\n"
4186   "    return\n"
4187   "  elseif Io.swig_instance_of(val, \"Generic_device *\") then\n"
4188   "    add_child(dev, name, val)\n"
4189   "    return\n"
4190   "  else\n"
4191   "    local sp = dev.set_property\n"
4192   "    if type(sp) == \"function\" then\n"
4193   "      sp(dev, name, val)\n"
4194   "      return\n"
4195   "    end\n"
4196   "  end\n"
4197   "  print(\"ERROR: cannot handle device member: \" .. tostring(name) .. \": \" .. tostring(val))\n"
4198   "end\n"
4199   "\n"
4200   "function Io.Dt.add_resource(dev, res)\n"
4201   "  if not Io.swig_instance_of(dev, \"Generic_device *\") then\n"
4202   "    error(\"expected a device got: \" .. tostring(dev), 2)\n"
4203   "  end\n"
4204   "  if not Io.swig_instance_of(res, \"Resource *\") then\n"
4205   "    error(\"expected a resource got: \" .. tostring(res), 2)\n"
4206   "  end\n"
4207   "  dev:add_resource(res)\n"
4208   "end\n"
4209   "\n"
4210   "function Io.Dt.add_device_data(dev, data)\n"
4211   "  local maxi = 0\n"
4212   "  for i, v in ipairs(data) do\n"
4213   "    handle_device_member(dev, v, i)\n"
4214   "    maxi = i\n"
4215   "  end\n"
4216   "  for k, v in pairs(data) do\n"
4217   "    if (type(k) ~= \"number\") or (k > maxi) then\n"
4218   "      handle_device_member(dev, v, k)\n"
4219   "    end\n"
4220   "  end\n"
4221   "end\n"
4222   "\n"
4223   "local set_dev_data = Io.Dt.add_device_data\n"
4224   "local add_children = Io.Dt.add_children\n"
4225   "\n"
4226   "Io.Hw = {}\n"
4227   "\n"
4228   "setmetatable(Io.Hw, { __index = function (self, t)\n"
4229   "  return function (data)\n"
4230   "    local b = check_device(Io.Hw_dev_factory_create(t), 3, \"could not create device: \" .. t)\n"
4231   "    if type(data) == \"function\" then\n"
4232   "      add_children(b, data)\n"
4233   "    elseif type(data) == \"table\" then\n"
4234   "      set_dev_data(b, data)\n"
4235   "    end\n"
4236   "    return b\n"
4237   "  end\n"
4238   "end})\n"
4239   "\n"
4240   "function Io.hw_add_devices(data)\n"
4241   "  local sb = Io.system_bus()\n"
4242   "  local dtype = type(data)\n"
4243   "  if dtype == 'function' then\n"
4244   "    Io.Dt.add_children(sb, data)\n"
4245   "  elseif dtype == 'table' then\n"
4246   "    for n, dev in pairs(data) do\n"
4247   "      if type(n) == \"string\" then\n"
4248   "        dev:set_property(\"name\", n)\n"
4249   "      end\n"
4250   "      sb:add_child(dev)\n"
4251   "      dev:plugin()\n"
4252   "    end\n"
4253   "  end\n"
4254   "  return data\n"
4255   "end\n"
4256   "\n"
4257   "Io.Vi = {}\n"
4258   "\n"
4259   "setmetatable(Io.Vi, { __index = function (self, t)\n"
4260   "  return function (data)\n"
4261   "    local b = Io.Vi_dev_factory_create(t)\n"
4262   "    if type(data) == \"function\" then\n"
4263   "      add_children(b, data)\n"
4264   "    elseif type(data) == \"table\" then\n"
4265   "      set_dev_data(b, data)\n"
4266   "    end\n"
4267   "    return b\n"
4268   "  end\n"
4269   "end})\n"
4270   "\n"
4271   "function wrap(devs_, filter)\n"
4272   "  local devs = devs_\n"
4273   "  if type(devs_) ~= \"table\" then\n"
4274   "    devs = { devs_ }\n"
4275   "  end\n"
4276   "  local v = {}\n"
4277   "  for _, d in ipairs(devs) do\n"
4278   "    local vd = Io.Vi_dev_factory_create(d)\n"
4279   "    if vd then\n"
4280   "      if type(filter) == \"table\" then\n"
4281   "        for tag, val in pairs(filter) do\n"
4282   "          local res = vd:add_filter_val(tag, val)\n"
4283   "          if res < 0 then\n"
4284   "            print(\"ERROR: applying filter expression: \"..tag..\"=...\", debug.traceback(2))\n"
4285   "          end\n"
4286   "        end\n"
4287   "      end\n"
4288   "      v[#v + 1] = vd\n"
4289   "    end\n"
4290   "  end\n"
4291   "  if #v == 1 then\n"
4292   "    return v[1]\n"
4293   "  else\n"
4294   "    return v\n"
4295   "  end\n"
4296   "end\n"
4297   "\n"
4298   "local add_vbus = Io.add_vbus\n"
4299   "\n"
4300   "function Io.add_vbus(name, bus)\n"
4301   "  bus:set_name(name)\n"
4302   "  add_vbus(bus)\n"
4303   "end\n"
4304   "\n"
4305   "function Io.add_vbusses(busses)\n"
4306   "  for name, bus in pairs(busses) do\n"
4307   "    Io.add_vbus(name, bus)\n"
4308   "  end\n"
4309   "  return busses\n"
4310   "end";
4311
4312 void SWIG_init_user(lua_State* L)
4313 {
4314   /* exec Lua code if applicable */
4315   SWIG_Lua_dostring(L,SWIG_LUACODE);
4316 }
4317