LCOV - code coverage report
Current view: top level - build directory/src/bindings/swig/lua - kdbLUA_wrap.cxx (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 1190 2654 44.8 %
Date: 2019-09-12 12:28:41 Functions: 118 201 58.7 %

          Line data    Source code
       1             : /* ----------------------------------------------------------------------------
       2             :  * This file was automatically generated by SWIG (http://www.swig.org).
       3             :  * Version 3.0.10
       4             :  *
       5             :  * This file is not intended to be easily readable and contains a number of
       6             :  * coding conventions designed to improve portability and efficiency. Do not make
       7             :  * changes to this file unless you know what you are doing--modify the SWIG
       8             :  * interface file instead.
       9             :  * ----------------------------------------------------------------------------- */
      10             : 
      11             : 
      12             : #ifndef SWIGLUA
      13             : #define SWIGLUA
      14             : #endif
      15             : 
      16             : #define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA
      17             : #define SWIG_LUA_MODULE_GLOBAL
      18             : 
      19             : 
      20             : #ifdef __cplusplus
      21             : /* SwigValueWrapper is described in swig.swg */
      22             : template<typename T> class SwigValueWrapper {
      23             :   struct SwigMovePointer {
      24             :     T *ptr;
      25             :     SwigMovePointer(T *p) : ptr(p) { }
      26             :     ~SwigMovePointer() { delete ptr; }
      27             :     SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
      28             :   } pointer;
      29             :   SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
      30             :   SwigValueWrapper(const SwigValueWrapper<T>& rhs);
      31             : public:
      32             :   SwigValueWrapper() : pointer(0) { }
      33             :   SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
      34             :   operator T&() const { return *pointer.ptr; }
      35             :   T *operator&() { return pointer.ptr; }
      36             : };
      37             : 
      38             : template <typename T> T SwigValueInit() {
      39             :   return T();
      40             : }
      41             : #endif
      42             : 
      43             : /* -----------------------------------------------------------------------------
      44             :  *  This section contains generic SWIG labels for method/variable
      45             :  *  declarations/attributes, and other compiler dependent labels.
      46             :  * ----------------------------------------------------------------------------- */
      47             : 
      48             : /* template workaround for compilers that cannot correctly implement the C++ standard */
      49             : #ifndef SWIGTEMPLATEDISAMBIGUATOR
      50             : # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
      51             : #  define SWIGTEMPLATEDISAMBIGUATOR template
      52             : # elif defined(__HP_aCC)
      53             : /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
      54             : /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
      55             : #  define SWIGTEMPLATEDISAMBIGUATOR template
      56             : # else
      57             : #  define SWIGTEMPLATEDISAMBIGUATOR
      58             : # endif
      59             : #endif
      60             : 
      61             : /* inline attribute */
      62             : #ifndef SWIGINLINE
      63             : # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
      64             : #   define SWIGINLINE inline
      65             : # else
      66             : #   define SWIGINLINE
      67             : # endif
      68             : #endif
      69             : 
      70             : /* attribute recognised by some compilers to avoid 'unused' warnings */
      71             : #ifndef SWIGUNUSED
      72             : # if defined(__GNUC__)
      73             : #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
      74             : #     define SWIGUNUSED __attribute__ ((__unused__))
      75             : #   else
      76             : #     define SWIGUNUSED
      77             : #   endif
      78             : # elif defined(__ICC)
      79             : #   define SWIGUNUSED __attribute__ ((__unused__))
      80             : # else
      81             : #   define SWIGUNUSED
      82             : # endif
      83             : #endif
      84             : 
      85             : #ifndef SWIG_MSC_UNSUPPRESS_4505
      86             : # if defined(_MSC_VER)
      87             : #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
      88             : # endif
      89             : #endif
      90             : 
      91             : #ifndef SWIGUNUSEDPARM
      92             : # ifdef __cplusplus
      93             : #   define SWIGUNUSEDPARM(p)
      94             : # else
      95             : #   define SWIGUNUSEDPARM(p) p SWIGUNUSED
      96             : # endif
      97             : #endif
      98             : 
      99             : /* internal SWIG method */
     100             : #ifndef SWIGINTERN
     101             : # define SWIGINTERN static SWIGUNUSED
     102             : #endif
     103             : 
     104             : /* internal inline SWIG method */
     105             : #ifndef SWIGINTERNINLINE
     106             : # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
     107             : #endif
     108             : 
     109             : /* exporting methods */
     110             : #if defined(__GNUC__)
     111             : #  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
     112             : #    ifndef GCC_HASCLASSVISIBILITY
     113             : #      define GCC_HASCLASSVISIBILITY
     114             : #    endif
     115             : #  endif
     116             : #endif
     117             : 
     118             : #ifndef SWIGEXPORT
     119             : # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
     120             : #   if defined(STATIC_LINKED)
     121             : #     define SWIGEXPORT
     122             : #   else
     123             : #     define SWIGEXPORT __declspec(dllexport)
     124             : #   endif
     125             : # else
     126             : #   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
     127             : #     define SWIGEXPORT __attribute__ ((visibility("default")))
     128             : #   else
     129             : #     define SWIGEXPORT
     130             : #   endif
     131             : # endif
     132             : #endif
     133             : 
     134             : /* calling conventions for Windows */
     135             : #ifndef SWIGSTDCALL
     136             : # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
     137             : #   define SWIGSTDCALL __stdcall
     138             : # else
     139             : #   define SWIGSTDCALL
     140             : # endif
     141             : #endif
     142             : 
     143             : /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
     144             : #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
     145             : # define _CRT_SECURE_NO_DEPRECATE
     146             : #endif
     147             : 
     148             : /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
     149             : #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
     150             : # define _SCL_SECURE_NO_DEPRECATE
     151             : #endif
     152             : 
     153             : /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
     154             : #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
     155             : # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
     156             : #endif
     157             : 
     158             : /* Intel's compiler complains if a variable which was never initialised is
     159             :  * cast to void, which is a common idiom which we use to indicate that we
     160             :  * are aware a variable isn't used.  So we just silence that warning.
     161             :  * See: https://github.com/swig/swig/issues/192 for more discussion.
     162             :  */
     163             : #ifdef __INTEL_COMPILER
     164             : # pragma warning disable 592
     165             : #endif
     166             : 
     167             : /* -----------------------------------------------------------------------------
     168             :  * swigrun.swg
     169             :  *
     170             :  * This file contains generic C API SWIG runtime support for pointer
     171             :  * type checking.
     172             :  * ----------------------------------------------------------------------------- */
     173             : 
     174             : /* This should only be incremented when either the layout of swig_type_info changes,
     175             :    or for whatever reason, the runtime changes incompatibly */
     176             : #define SWIG_RUNTIME_VERSION "4"
     177             : 
     178             : /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
     179             : #ifdef SWIG_TYPE_TABLE
     180             : # define SWIG_QUOTE_STRING(x) #x
     181             : # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
     182             : # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
     183             : #else
     184             : # define SWIG_TYPE_TABLE_NAME
     185             : #endif
     186             : 
     187             : /*
     188             :   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
     189             :   creating a static or dynamic library from the SWIG runtime code.
     190             :   In 99.9% of the cases, SWIG just needs to declare them as 'static'.
     191             : 
     192             :   But only do this if strictly necessary, ie, if you have problems
     193             :   with your compiler or suchlike.
     194             : */
     195             : 
     196             : #ifndef SWIGRUNTIME
     197             : # define SWIGRUNTIME SWIGINTERN
     198             : #endif
     199             : 
     200             : #ifndef SWIGRUNTIMEINLINE
     201             : # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
     202             : #endif
     203             : 
     204             : /*  Generic buffer size */
     205             : #ifndef SWIG_BUFFER_SIZE
     206             : # define SWIG_BUFFER_SIZE 1024
     207             : #endif
     208             : 
     209             : /* Flags for pointer conversions */
     210             : #define SWIG_POINTER_DISOWN        0x1
     211             : #define SWIG_CAST_NEW_MEMORY       0x2
     212             : 
     213             : /* Flags for new pointer objects */
     214             : #define SWIG_POINTER_OWN           0x1
     215             : 
     216             : 
     217             : /*
     218             :    Flags/methods for returning states.
     219             : 
     220             :    The SWIG conversion methods, as ConvertPtr, return an integer
     221             :    that tells if the conversion was successful or not. And if not,
     222             :    an error code can be returned (see swigerrors.swg for the codes).
     223             : 
     224             :    Use the following macros/flags to set or process the returning
     225             :    states.
     226             : 
     227             :    In old versions of SWIG, code such as the following was usually written:
     228             : 
     229             :      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
     230             :        // success code
     231             :      } else {
     232             :        //fail code
     233             :      }
     234             : 
     235             :    Now you can be more explicit:
     236             : 
     237             :     int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
     238             :     if (SWIG_IsOK(res)) {
     239             :       // success code
     240             :     } else {
     241             :       // fail code
     242             :     }
     243             : 
     244             :    which is the same really, but now you can also do
     245             : 
     246             :     Type *ptr;
     247             :     int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
     248             :     if (SWIG_IsOK(res)) {
     249             :       // success code
     250             :       if (SWIG_IsNewObj(res) {
     251             :         ...
     252             :         delete *ptr;
     253             :       } else {
     254             :         ...
     255             :       }
     256             :     } else {
     257             :       // fail code
     258             :     }
     259             : 
     260             :    I.e., now SWIG_ConvertPtr can return new objects and you can
     261             :    identify the case and take care of the deallocation. Of course that
     262             :    also requires SWIG_ConvertPtr to return new result values, such as
     263             : 
     264             :       int SWIG_ConvertPtr(obj, ptr,...) {
     265             :         if (<obj is ok>) {
     266             :           if (<need new object>) {
     267             :             *ptr = <ptr to new allocated object>;
     268             :             return SWIG_NEWOBJ;
     269             :           } else {
     270             :             *ptr = <ptr to old object>;
     271             :             return SWIG_OLDOBJ;
     272             :           }
     273             :         } else {
     274             :           return SWIG_BADOBJ;
     275             :         }
     276             :       }
     277             : 
     278             :    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
     279             :    more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
     280             :    SWIG errors code.
     281             : 
     282             :    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
     283             :    allows to return the 'cast rank', for example, if you have this
     284             : 
     285             :        int food(double)
     286             :        int fooi(int);
     287             : 
     288             :    and you call
     289             : 
     290             :       food(1)   // cast rank '1'  (1 -> 1.0)
     291             :       fooi(1)   // cast rank '0'
     292             : 
     293             :    just use the SWIG_AddCast()/SWIG_CheckState()
     294             : */
     295             : 
     296             : #define SWIG_OK                    (0)
     297             : #define SWIG_ERROR                 (-1)
     298             : #define SWIG_IsOK(r)               (r >= 0)
     299             : #define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
     300             : 
     301             : /* The CastRankLimit says how many bits are used for the cast rank */
     302             : #define SWIG_CASTRANKLIMIT         (1 << 8)
     303             : /* The NewMask denotes the object was created (using new/malloc) */
     304             : #define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
     305             : /* The TmpMask is for in/out typemaps that use temporal objects */
     306             : #define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
     307             : /* Simple returning values */
     308             : #define SWIG_BADOBJ                (SWIG_ERROR)
     309             : #define SWIG_OLDOBJ                (SWIG_OK)
     310             : #define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
     311             : #define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
     312             : /* Check, add and del mask methods */
     313             : #define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
     314             : #define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
     315             : #define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
     316             : #define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
     317             : #define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
     318             : #define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
     319             : 
     320             : /* Cast-Rank Mode */
     321             : #if defined(SWIG_CASTRANK_MODE)
     322             : #  ifndef SWIG_TypeRank
     323             : #    define SWIG_TypeRank             unsigned long
     324             : #  endif
     325             : #  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
     326             : #    define SWIG_MAXCASTRANK          (2)
     327             : #  endif
     328             : #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
     329             : #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
     330             : SWIGINTERNINLINE int SWIG_AddCast(int r) {
     331             :   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
     332             : }
     333             : SWIGINTERNINLINE int SWIG_CheckState(int r) {
     334             :   return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
     335             : }
     336             : #else /* no cast-rank mode */
     337             : #  define SWIG_AddCast(r) (r)
     338             : #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
     339             : #endif
     340             : 
     341             : 
     342             : #include <string.h>
     343             : 
     344             : #ifdef __cplusplus
     345             : extern "C" {
     346             : #endif
     347             : 
     348             : typedef void *(*swig_converter_func)(void *, int *);
     349             : typedef struct swig_type_info *(*swig_dycast_func)(void **);
     350             : 
     351             : /* Structure to store information on one type */
     352             : typedef struct swig_type_info {
     353             :   const char             *name;                 /* mangled name of this type */
     354             :   const char             *str;                  /* human readable name of this type */
     355             :   swig_dycast_func        dcast;                /* dynamic cast function down a hierarchy */
     356             :   struct swig_cast_info  *cast;                 /* linked list of types that can cast into this type */
     357             :   void                   *clientdata;           /* language specific type data */
     358             :   int                    owndata;               /* flag if the structure owns the clientdata */
     359             : } swig_type_info;
     360             : 
     361             : /* Structure to store a type and conversion function used for casting */
     362             : typedef struct swig_cast_info {
     363             :   swig_type_info         *type;                 /* pointer to type that is equivalent to this type */
     364             :   swig_converter_func     converter;            /* function to cast the void pointers */
     365             :   struct swig_cast_info  *next;                 /* pointer to next cast in linked list */
     366             :   struct swig_cast_info  *prev;                 /* pointer to the previous cast */
     367             : } swig_cast_info;
     368             : 
     369             : /* Structure used to store module information
     370             :  * Each module generates one structure like this, and the runtime collects
     371             :  * all of these structures and stores them in a circularly linked list.*/
     372             : typedef struct swig_module_info {
     373             :   swig_type_info         **types;               /* Array of pointers to swig_type_info structures that are in this module */
     374             :   size_t                 size;                  /* Number of types in this module */
     375             :   struct swig_module_info *next;                /* Pointer to next element in circularly linked list */
     376             :   swig_type_info         **type_initial;        /* Array of initially generated type structures */
     377             :   swig_cast_info         **cast_initial;        /* Array of initially generated casting structures */
     378             :   void                    *clientdata;          /* Language specific module data */
     379             : } swig_module_info;
     380             : 
     381             : /*
     382             :   Compare two type names skipping the space characters, therefore
     383             :   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
     384             : 
     385             :   Return 0 when the two name types are equivalent, as in
     386             :   strncmp, but skipping ' '.
     387             : */
     388             : SWIGRUNTIME int
     389           0 : SWIG_TypeNameComp(const char *f1, const char *l1,
     390             :                   const char *f2, const char *l2) {
     391           0 :   for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
     392           0 :     while ((*f1 == ' ') && (f1 != l1)) ++f1;
     393           0 :     while ((*f2 == ' ') && (f2 != l2)) ++f2;
     394           0 :     if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
     395             :   }
     396           0 :   return (int)((l1 - f1) - (l2 - f2));
     397             : }
     398             : 
     399             : /*
     400             :   Check type equivalence in a name list like <name1>|<name2>|...
     401             :   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
     402             : */
     403             : SWIGRUNTIME int
     404           0 : SWIG_TypeCmp(const char *nb, const char *tb) {
     405           0 :   int equiv = 1;
     406           0 :   const char* te = tb + strlen(tb);
     407           0 :   const char* ne = nb;
     408           0 :   while (equiv != 0 && *ne) {
     409           0 :     for (nb = ne; *ne; ++ne) {
     410           0 :       if (*ne == '|') break;
     411             :     }
     412           0 :     equiv = SWIG_TypeNameComp(nb, ne, tb, te);
     413           0 :     if (*ne) ++ne;
     414             :   }
     415           0 :   return equiv;
     416             : }
     417             : 
     418             : /*
     419             :   Check type equivalence in a name list like <name1>|<name2>|...
     420             :   Return 0 if not equal, 1 if equal
     421             : */
     422             : SWIGRUNTIME int
     423             : SWIG_TypeEquiv(const char *nb, const char *tb) {
     424           0 :   return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
     425             : }
     426             : 
     427             : /*
     428             :   Check the typename
     429             : */
     430             : SWIGRUNTIME swig_cast_info *
     431           0 : SWIG_TypeCheck(const char *c, swig_type_info *ty) {
     432           0 :   if (ty) {
     433           0 :     swig_cast_info *iter = ty->cast;
     434           0 :     while (iter) {
     435           0 :       if (strcmp(iter->type->name, c) == 0) {
     436           0 :         if (iter == ty->cast)
     437             :           return iter;
     438             :         /* Move iter to the top of the linked list */
     439           0 :         iter->prev->next = iter->next;
     440           0 :         if (iter->next)
     441           0 :           iter->next->prev = iter->prev;
     442           0 :         iter->next = ty->cast;
     443           0 :         iter->prev = 0;
     444           0 :         if (ty->cast) ty->cast->prev = iter;
     445           0 :         ty->cast = iter;
     446           0 :         return iter;
     447             :       }
     448           0 :       iter = iter->next;
     449             :     }
     450             :   }
     451             :   return 0;
     452             : }
     453             : 
     454             : /*
     455             :   Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
     456             : */
     457             : SWIGRUNTIME swig_cast_info *
     458         248 : SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
     459         248 :   if (ty) {
     460         248 :     swig_cast_info *iter = ty->cast;
     461         254 :     while (iter) {
     462         248 :       if (iter->type == from) {
     463         245 :         if (iter == ty->cast)
     464             :           return iter;
     465             :         /* Move iter to the top of the linked list */
     466           0 :         iter->prev->next = iter->next;
     467           0 :         if (iter->next)
     468           0 :           iter->next->prev = iter->prev;
     469           0 :         iter->next = ty->cast;
     470           0 :         iter->prev = 0;
     471           0 :         if (ty->cast) ty->cast->prev = iter;
     472           0 :         ty->cast = iter;
     473           0 :         return iter;
     474             :       }
     475           3 :       iter = iter->next;
     476             :     }
     477             :   }
     478             :   return 0;
     479             : }
     480             : 
     481             : /*
     482             :   Cast a pointer up an inheritance hierarchy
     483             : */
     484             : SWIGRUNTIMEINLINE void *
     485             : SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
     486         245 :   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
     487             : }
     488             : 
     489             : /*
     490             :    Dynamic pointer casting. Down an inheritance hierarchy
     491             : */
     492             : SWIGRUNTIME swig_type_info *
     493             : SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
     494             :   swig_type_info *lastty = ty;
     495             :   if (!ty || !ty->dcast) return ty;
     496             :   while (ty && (ty->dcast)) {
     497             :     ty = (*ty->dcast)(ptr);
     498             :     if (ty) lastty = ty;
     499             :   }
     500             :   return lastty;
     501             : }
     502             : 
     503             : /*
     504             :   Return the name associated with this type
     505             : */
     506             : SWIGRUNTIMEINLINE const char *
     507             : SWIG_TypeName(const swig_type_info *ty) {
     508             :   return ty->name;
     509             : }
     510             : 
     511             : /*
     512             :   Return the pretty name associated with this type,
     513             :   that is an unmangled type name in a form presentable to the user.
     514             : */
     515             : SWIGRUNTIME const char *
     516             : SWIG_TypePrettyName(const swig_type_info *type) {
     517             :   /* The "str" field contains the equivalent pretty names of the
     518             :      type, separated by vertical-bar characters.  We choose
     519             :      to print the last name, as it is often (?) the most
     520             :      specific. */
     521             :   if (!type) return NULL;
     522             :   if (type->str != NULL) {
     523             :     const char *last_name = type->str;
     524             :     const char *s;
     525             :     for (s = type->str; *s; s++)
     526             :       if (*s == '|') last_name = s+1;
     527             :     return last_name;
     528             :   }
     529             :   else
     530             :     return type->name;
     531             : }
     532             : 
     533             : /*
     534             :    Set the clientdata field for a type
     535             : */
     536             : SWIGRUNTIME void
     537           0 : SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
     538           0 :   swig_cast_info *cast = ti->cast;
     539             :   /* if (ti->clientdata == clientdata) return; */
     540           0 :   ti->clientdata = clientdata;
     541             : 
     542           0 :   while (cast) {
     543           0 :     if (!cast->converter) {
     544           0 :       swig_type_info *tc = cast->type;
     545           0 :       if (!tc->clientdata) {
     546           0 :         SWIG_TypeClientData(tc, clientdata);
     547             :       }
     548             :     }
     549           0 :     cast = cast->next;
     550             :   }
     551           0 : }
     552             : SWIGRUNTIME void
     553             : SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
     554             :   SWIG_TypeClientData(ti, clientdata);
     555             :   ti->owndata = 1;
     556             : }
     557             : 
     558             : /*
     559             :   Search for a swig_type_info structure only by mangled name
     560             :   Search is a O(log #types)
     561             : 
     562             :   We start searching at module start, and finish searching when start == end.
     563             :   Note: if start == end at the beginning of the function, we go all the way around
     564             :   the circular list.
     565             : */
     566             : SWIGRUNTIME swig_type_info *
     567           0 : SWIG_MangledTypeQueryModule(swig_module_info *start,
     568             :                             swig_module_info *end,
     569             :                             const char *name) {
     570           0 :   swig_module_info *iter = start;
     571             :   do {
     572           0 :     if (iter->size) {
     573           0 :       size_t l = 0;
     574           0 :       size_t r = iter->size - 1;
     575             :       do {
     576             :         /* since l+r >= 0, we can (>> 1) instead (/ 2) */
     577           0 :         size_t i = (l + r) >> 1;
     578           0 :         const char *iname = iter->types[i]->name;
     579           0 :         if (iname) {
     580           0 :           int compare = strcmp(name, iname);
     581           0 :           if (compare == 0) {
     582             :             return iter->types[i];
     583           0 :           } else if (compare < 0) {
     584           0 :             if (i) {
     585           0 :               r = i - 1;
     586             :             } else {
     587             :               break;
     588             :             }
     589           0 :           } else if (compare > 0) {
     590           0 :             l = i + 1;
     591             :           }
     592             :         } else {
     593             :           break; /* should never happen */
     594             :         }
     595           0 :       } while (l <= r);
     596             :     }
     597           0 :     iter = iter->next;
     598           0 :   } while (iter != end);
     599             :   return 0;
     600             : }
     601             : 
     602             : /*
     603             :   Search for a swig_type_info structure for either a mangled name or a human readable name.
     604             :   It first searches the mangled names of the types, which is a O(log #types)
     605             :   If a type is not found it then searches the human readable names, which is O(#types).
     606             : 
     607             :   We start searching at module start, and finish searching when start == end.
     608             :   Note: if start == end at the beginning of the function, we go all the way around
     609             :   the circular list.
     610             : */
     611             : SWIGRUNTIME swig_type_info *
     612           0 : SWIG_TypeQueryModule(swig_module_info *start,
     613             :                      swig_module_info *end,
     614             :                      const char *name) {
     615             :   /* STEP 1: Search the name field using binary search */
     616           0 :   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
     617           0 :   if (ret) {
     618             :     return ret;
     619             :   } else {
     620             :     /* STEP 2: If the type hasn't been found, do a complete search
     621             :        of the str field (the human readable name) */
     622             :     swig_module_info *iter = start;
     623             :     do {
     624           0 :       size_t i = 0;
     625           0 :       for (; i < iter->size; ++i) {
     626           0 :         if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
     627             :           return iter->types[i];
     628             :       }
     629           0 :       iter = iter->next;
     630           0 :     } while (iter != end);
     631             :   }
     632             : 
     633             :   /* neither found a match */
     634             :   return 0;
     635             : }
     636             : 
     637             : /*
     638             :    Pack binary data into a string
     639             : */
     640             : SWIGRUNTIME char *
     641             : SWIG_PackData(char *c, void *ptr, size_t sz) {
     642             :   static const char hex[17] = "0123456789abcdef";
     643             :   const unsigned char *u = (unsigned char *) ptr;
     644             :   const unsigned char *eu =  u + sz;
     645             :   for (; u != eu; ++u) {
     646             :     unsigned char uu = *u;
     647             :     *(c++) = hex[(uu & 0xf0) >> 4];
     648             :     *(c++) = hex[uu & 0xf];
     649             :   }
     650             :   return c;
     651             : }
     652             : 
     653             : /*
     654             :    Unpack binary data from a string
     655             : */
     656             : SWIGRUNTIME const char *
     657             : SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
     658             :   unsigned char *u = (unsigned char *) ptr;
     659             :   const unsigned char *eu = u + sz;
     660             :   for (; u != eu; ++u) {
     661             :     char d = *(c++);
     662             :     unsigned char uu;
     663             :     if ((d >= '0') && (d <= '9'))
     664             :       uu = (unsigned char)((d - '0') << 4);
     665             :     else if ((d >= 'a') && (d <= 'f'))
     666             :       uu = (unsigned char)((d - ('a'-10)) << 4);
     667             :     else
     668             :       return (char *) 0;
     669             :     d = *(c++);
     670             :     if ((d >= '0') && (d <= '9'))
     671             :       uu |= (unsigned char)(d - '0');
     672             :     else if ((d >= 'a') && (d <= 'f'))
     673             :       uu |= (unsigned char)(d - ('a'-10));
     674             :     else
     675             :       return (char *) 0;
     676             :     *u = uu;
     677             :   }
     678             :   return c;
     679             : }
     680             : 
     681             : /*
     682             :    Pack 'void *' into a string buffer.
     683             : */
     684             : SWIGRUNTIME char *
     685             : SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
     686             :   char *r = buff;
     687             :   if ((2*sizeof(void *) + 2) > bsz) return 0;
     688             :   *(r++) = '_';
     689             :   r = SWIG_PackData(r,&ptr,sizeof(void *));
     690             :   if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
     691             :   strcpy(r,name);
     692             :   return buff;
     693             : }
     694             : 
     695             : SWIGRUNTIME const char *
     696             : SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
     697             :   if (*c != '_') {
     698             :     if (strcmp(c,"NULL") == 0) {
     699             :       *ptr = (void *) 0;
     700             :       return name;
     701             :     } else {
     702             :       return 0;
     703             :     }
     704             :   }
     705             :   return SWIG_UnpackData(++c,ptr,sizeof(void *));
     706             : }
     707             : 
     708             : SWIGRUNTIME char *
     709             : SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
     710             :   char *r = buff;
     711             :   size_t lname = (name ? strlen(name) : 0);
     712             :   if ((2*sz + 2 + lname) > bsz) return 0;
     713             :   *(r++) = '_';
     714             :   r = SWIG_PackData(r,ptr,sz);
     715             :   if (lname) {
     716             :     strncpy(r,name,lname+1);
     717             :   } else {
     718             :     *r = 0;
     719             :   }
     720             :   return buff;
     721             : }
     722             : 
     723             : SWIGRUNTIME const char *
     724             : SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
     725             :   if (*c != '_') {
     726             :     if (strcmp(c,"NULL") == 0) {
     727             :       memset(ptr,0,sz);
     728             :       return name;
     729             :     } else {
     730             :       return 0;
     731             :     }
     732             :   }
     733             :   return SWIG_UnpackData(++c,ptr,sz);
     734             : }
     735             : 
     736             : #ifdef __cplusplus
     737             : }
     738             : #endif
     739             : 
     740             : /* -----------------------------------------------------------------------------
     741             :  * luarun.swg
     742             :  *
     743             :  * This file contains the runtime support for Lua modules
     744             :  * and includes code for managing global variables and pointer
     745             :  * type checking.
     746             :  * ----------------------------------------------------------------------------- */
     747             : 
     748             : #ifdef __cplusplus
     749             : extern "C" {
     750             : #endif
     751             : 
     752             : #include "lua.h"
     753             : #include "lauxlib.h"
     754             : #include <stdlib.h>  /* for malloc */
     755             : #include <assert.h>  /* for a few sanity tests */
     756             : 
     757             : /* -----------------------------------------------------------------------------
     758             :  * Lua flavors
     759             :  * ----------------------------------------------------------------------------- */
     760             : 
     761             : #define SWIG_LUA_FLAVOR_LUA 1
     762             : #define SWIG_LUA_FLAVOR_ELUA 2
     763             : #define SWIG_LUA_FLAVOR_ELUAC 3
     764             : 
     765             : #if !defined(SWIG_LUA_TARGET)
     766             : # error SWIG_LUA_TARGET not defined
     767             : #endif
     768             : 
     769             : #if defined(SWIG_LUA_ELUA_EMULATE)
     770             : 
     771             : struct swig_elua_entry;
     772             : 
     773             : typedef struct swig_elua_key {
     774             :   int type;
     775             :   union {
     776             :     const char* strkey;
     777             :     lua_Number numkey;
     778             :   } key;
     779             : } swig_elua_key;
     780             : 
     781             : typedef struct swig_elua_val {
     782             :   int type;
     783             :   union {
     784             :     lua_Number number;
     785             :     const struct swig_elua_entry *table;
     786             :     const char *string;
     787             :     lua_CFunction function;
     788             :     struct {
     789             :       char member;
     790             :       long lvalue;
     791             :       void *pvalue;
     792             :       swig_type_info **ptype;
     793             :     } userdata;
     794             :   } value;
     795             : } swig_elua_val;
     796             : 
     797             : typedef struct swig_elua_entry {
     798             :   swig_elua_key key;
     799             :   swig_elua_val value;
     800             : } swig_elua_entry;
     801             : 
     802             : #define LSTRKEY(x) {LUA_TSTRING, {.strkey = x} }
     803             : #define LNUMKEY(x) {LUA_TNUMBER, {.numkey = x} }
     804             : #define LNILKEY {LUA_TNIL, {.strkey = 0} }
     805             : 
     806             : #define LNUMVAL(x) {LUA_TNUMBER, {.number = x} }
     807             : #define LFUNCVAL(x) {LUA_TFUNCTION, {.function = x} }
     808             : #define LROVAL(x) {LUA_TTABLE, {.table = x} }
     809             : #define LNILVAL {LUA_TNIL, {.string = 0} }
     810             : #define LSTRVAL(x) {LUA_TSTRING, {.string = x} }
     811             : 
     812             : #define LUA_REG_TYPE swig_elua_entry
     813             : 
     814             : #define SWIG_LUA_ELUA_EMUL_METATABLE_KEY "__metatable"
     815             : 
     816             : #define lua_pushrotable(L,p)\
     817             :   lua_newtable(L);\
     818             :   assert(p);\
     819             :   SWIG_Lua_elua_emulate_register(L,(swig_elua_entry*)(p));
     820             : 
     821             : #define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\
     822             :   LSTRKEY(B), {LUA_TUSERDATA, { .userdata={0,0,(void*)(C),&D} } }
     823             : 
     824             : #define SWIG_LUA_CONSTTAB_BINARY(B,S,C,D)\
     825             :   LSTRKEY(B), {LUA_TUSERDATA, { .userdata={1,S,(void*)(C),&D} } }
     826             : #endif
     827             : 
     828             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
     829             : #  define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
     830             : #  define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
     831             : #  define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
     832             : #  define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
     833             :     /* Those two types of constants are not supported in elua */
     834             : 
     835             : #ifndef SWIG_LUA_CONSTTAB_POINTER
     836             : #warning eLua does not support pointers as constants. By default, nil will be used as value
     837             : #define SWIG_LUA_CONSTTAB_POINTER(B,C,D) LSTRKEY(B), LNILVAL
     838             : #endif
     839             : 
     840             : #ifndef SWIG_LUA_CONSTTAB_BINARY
     841             : #warning eLua does not support pointers to member as constants. By default, nil will be used as value
     842             : #define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D) LSTRKEY(B), LNILVAL
     843             : #endif
     844             : #else /* SWIG_LUA_FLAVOR_LUA */
     845             : #  define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
     846             : #  define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
     847             : #  define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
     848             : #  define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
     849             : #  define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\
     850             :        SWIG_LUA_POINTER, (char *)B, 0, 0, (void *)C, &D
     851             : #  define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D)\
     852             :        SWIG_LUA_BINARY,  (char *)B, S, 0, (void *)C, &D
     853             : #endif
     854             : 
     855             : #ifndef SWIG_LUA_ELUA_EMULATE
     856             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
     857             : #  define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
     858             : #  define LSTRVAL LRO_STRVAL
     859             : #endif
     860             : #endif /* SWIG_LUA_ELUA_EMULATE*/
     861             : 
     862             : #ifndef SWIG_LUA_ELUA_EMULATE
     863             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
     864             : 
     865             : #ifndef MIN_OPT_LEVEL
     866             : #define MIN_OPT_LEVEL 2
     867             : #endif
     868             : 
     869             : #include "lrodefs.h"
     870             : #include "lrotable.h"
     871             : #endif
     872             : #endif /* SWIG_LUA_ELUA_EMULATE*/
     873             : /* -----------------------------------------------------------------------------
     874             :  * compatibility defines
     875             :  * ----------------------------------------------------------------------------- */
     876             : 
     877             : /* History of Lua C API length functions:  In Lua 5.0 (and before?)
     878             :    there was "lua_strlen".  In Lua 5.1, this was renamed "lua_objlen",
     879             :    but a compatibility define of "lua_strlen" was added.  In Lua 5.2,
     880             :    this function was again renamed, to "lua_rawlen" (to emphasize that
     881             :    it doesn't call the "__len" metamethod), and the compatibility
     882             :    define of lua_strlen was removed.  All SWIG uses have been updated
     883             :    to "lua_rawlen", and we add our own defines of that here for older
     884             :    versions of Lua.  */
     885             : #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
     886             : # define lua_rawlen lua_strlen
     887             : #elif LUA_VERSION_NUM == 501
     888             : # define lua_rawlen lua_objlen
     889             : #endif
     890             : 
     891             : 
     892             : /* lua_pushglobaltable is the recommended "future-proof" way to get
     893             :    the global table for Lua 5.2 and later.  Here we define
     894             :    lua_pushglobaltable ourselves for Lua versions before 5.2.  */
     895             : #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
     896             : # define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
     897             : #endif
     898             : 
     899             : /* lua_absindex was introduced in Lua 5.2 */
     900             : #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
     901             : # define lua_absindex(L,i) ((i)>0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
     902             : #endif
     903             : 
     904             : /* lua_rawsetp was introduced in Lua 5.2 */
     905             : #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
     906             : #define lua_rawsetp(L,index,ptr)\
     907             :   lua_pushlightuserdata(L,(void*)(ptr));\
     908             :   lua_insert(L,-2);\
     909             :   lua_rawset(L,index);
     910             : 
     911             : #define lua_rawgetp(L,index,ptr)\
     912             :   lua_pushlightuserdata(L,(void*)(ptr));\
     913             :   lua_rawget(L,index);
     914             : 
     915             : #endif
     916             : 
     917             : /* --------------------------------------------------------------------------
     918             :  * Helper functions for error handling
     919             :  * -------------------------------------------------------------------------- */
     920             : 
     921             : /* Push the string STR on the Lua stack, like lua_pushstring, but
     922             :    prefixed with the the location of the innermost Lua call-point
     923             :    (as formated by luaL_where).  */
     924             : SWIGRUNTIME void
     925           0 : SWIG_Lua_pusherrstring (lua_State *L, const char *str)
     926             : {
     927           0 :   luaL_where (L, 1);
     928           0 :   lua_pushstring (L, str);
     929           0 :   lua_concat (L, 2);
     930           0 : }
     931             : 
     932             : /* Push a formatted string generated from FMT and following args on
     933             :    the Lua stack, like lua_pushfstring, but prefixed with the the
     934             :    location of the innermost Lua call-point (as formated by luaL_where).  */
     935             : SWIGRUNTIME void
     936           0 : SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
     937             : {
     938             :   va_list argp;
     939           0 :   va_start(argp, fmt);
     940           0 :   luaL_where(L, 1);
     941           0 :   lua_pushvfstring(L, fmt, argp);
     942           0 :   va_end(argp);
     943           0 :   lua_concat(L, 2);
     944           0 : }
     945             : 
     946             : 
     947             : /* -----------------------------------------------------------------------------
     948             :  * global swig types
     949             :  * ----------------------------------------------------------------------------- */
     950             : /* Constant table */
     951             : #define SWIG_LUA_INT     1
     952             : #define SWIG_LUA_FLOAT   2
     953             : #define SWIG_LUA_STRING  3
     954             : #define SWIG_LUA_POINTER 4
     955             : #define SWIG_LUA_BINARY  5
     956             : #define SWIG_LUA_CHAR    6
     957             : 
     958             : /* Structure for variable linking table */
     959             : typedef struct {
     960             :   const char *name;
     961             :   lua_CFunction get;
     962             :   lua_CFunction set;
     963             : } swig_lua_var_info;
     964             : 
     965             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
     966             : typedef const LUA_REG_TYPE swig_lua_method;
     967             : typedef const LUA_REG_TYPE swig_lua_const_info;
     968             : #else /* Normal lua */
     969             : typedef luaL_Reg swig_lua_method;
     970             : 
     971             : /* Constant information structure */
     972             : typedef struct {
     973             :     int type;
     974             :     char *name;
     975             :     long lvalue;
     976             :     double dvalue;
     977             :     void   *pvalue;
     978             :     swig_type_info **ptype;
     979             : } swig_lua_const_info;
     980             : 
     981             : #endif
     982             : 
     983             : typedef struct {
     984             :   const char     *name;
     985             :   lua_CFunction   getmethod;
     986             :   lua_CFunction   setmethod;
     987             : } swig_lua_attribute;
     988             : 
     989             : 
     990             : struct swig_lua_class;
     991             : /* Can be used to create namespaces. Currently used to wrap class static methods/variables/constants */
     992             : typedef struct swig_lua_namespace {
     993             :   const char            *name;
     994             :   swig_lua_method       *ns_methods;
     995             :   swig_lua_attribute    *ns_attributes;
     996             :   swig_lua_const_info   *ns_constants;
     997             :   struct swig_lua_class        **ns_classes;
     998             :   struct swig_lua_namespace    **ns_namespaces;
     999             : } swig_lua_namespace;
    1000             : 
    1001             : typedef struct swig_lua_class {
    1002             :   const char    *name; /* Name that this class has in Lua */
    1003             :   const char    *fqname; /* Fully qualified name - Scope + class name */
    1004             :   swig_type_info   **type;
    1005             :   lua_CFunction  constructor;
    1006             :   void    (*destructor)(void *);
    1007             :   swig_lua_method   *methods;
    1008             :   swig_lua_attribute     *attributes;
    1009             :   swig_lua_namespace    *cls_static;
    1010             :   swig_lua_method   *metatable; /* 0 for -eluac */
    1011             :   struct swig_lua_class **bases;
    1012             :   const char **base_names;
    1013             : } swig_lua_class;
    1014             : 
    1015             : /* this is the struct for wrapping all pointers in SwigLua
    1016             : */
    1017             : typedef struct {
    1018             :   swig_type_info   *type;
    1019             :   int     own;  /* 1 if owned & must be destroyed */
    1020             :   void        *ptr;
    1021             : } swig_lua_userdata;
    1022             : 
    1023             : /* this is the struct for wrapping arbitrary packed binary data
    1024             : (currently it is only used for member function pointers)
    1025             : the data ordering is similar to swig_lua_userdata, but it is currently not possible
    1026             : to tell the two structures apart within SWIG, other than by looking at the type
    1027             : */
    1028             : typedef struct {
    1029             :   swig_type_info   *type;
    1030             :   int     own;  /* 1 if owned & must be destroyed */
    1031             :   char data[1];       /* arbitary amount of data */    
    1032             : } swig_lua_rawdata;
    1033             : 
    1034             : /* Common SWIG API */
    1035             : #define SWIG_NewPointerObj(L, ptr, type, owner)       SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
    1036             : #define SWIG_ConvertPtr(L,idx, ptr, type, flags)    SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
    1037             : #define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname)  SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
    1038             : /* for C++ member pointers, ie, member methods */
    1039             : #define SWIG_ConvertMember(L, idx, ptr, sz, ty)       SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
    1040             : #define SWIG_NewMemberObj(L, ptr, sz, type)      SWIG_Lua_NewPackedObj(L, ptr, sz, type)
    1041             : 
    1042             : /* Runtime API */
    1043             : #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
    1044             : #define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
    1045             : #define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
    1046             : 
    1047             : /* Contract support */
    1048             : #define SWIG_contract_assert(expr, msg)  \
    1049             :   if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else
    1050             : 
    1051             : 
    1052             : /* helper #defines */
    1053             : #define SWIG_fail {goto fail;}
    1054             : #define SWIG_fail_arg(func_name,argnum,type) \
    1055             :   {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
    1056             :   func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
    1057             :   goto fail;}
    1058             : #define SWIG_fail_ptr(func_name,argnum,type) \
    1059             :   SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
    1060             : #define SWIG_check_num_args(func_name,a,b) \
    1061             :   if (lua_gettop(L)<a || lua_gettop(L)>b) \
    1062             :   {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
    1063             :   goto fail;}
    1064             : 
    1065             : 
    1066             : #define SWIG_Lua_get_table(L,n) \
    1067             :   (lua_pushstring(L, n), lua_rawget(L,-2))
    1068             : 
    1069             : #define SWIG_Lua_add_function(L,n,f) \
    1070             :   (lua_pushstring(L, n), \
    1071             :       lua_pushcfunction(L, f), \
    1072             :       lua_rawset(L,-3))
    1073             : 
    1074             : #define SWIG_Lua_add_boolean(L,n,b) \
    1075             :   (lua_pushstring(L, n), \
    1076             :       lua_pushboolean(L, b), \
    1077             :       lua_rawset(L,-3))
    1078             : 
    1079             : /* special helper for allowing 'nil' for usertypes */
    1080             : #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
    1081             : 
    1082             : #ifdef __cplusplus
    1083             : /* Special helper for member function pointers 
    1084             : it gets the address, casts it, then dereferences it */
    1085             : /*#define SWIG_mem_fn_as_voidptr(a)  (*((char**)&(a))) */
    1086             : #endif
    1087             : 
    1088             : /* storing/access of swig_module_info */
    1089             : SWIGRUNTIME swig_module_info *
    1090          40 : SWIG_Lua_GetModule(lua_State *L) {
    1091          40 :   swig_module_info *ret = 0;
    1092          40 :   lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
    1093          40 :   lua_rawget(L,LUA_REGISTRYINDEX);
    1094          40 :   if (lua_islightuserdata(L,-1))
    1095          32 :     ret=(swig_module_info*)lua_touserdata(L,-1);
    1096          40 :   lua_pop(L,1);  /* tidy */
    1097          40 :   return ret;
    1098             : }
    1099             : 
    1100             : SWIGRUNTIME void
    1101           8 : SWIG_Lua_SetModule(lua_State *L, swig_module_info *module) {
    1102             :   /* add this all into the Lua registry: */
    1103           8 :   lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
    1104           8 :   lua_pushlightuserdata(L,(void*)module);
    1105           8 :   lua_rawset(L,LUA_REGISTRYINDEX);
    1106           8 : }
    1107             : 
    1108             : /* -----------------------------------------------------------------------------
    1109             :  * global variable support code: modules
    1110             :  * ----------------------------------------------------------------------------- */
    1111             : 
    1112             : /* this function is called when trying to set an immutable.
    1113             : default action is to print an error.
    1114             : This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
    1115           0 : SWIGINTERN int SWIG_Lua_set_immutable(lua_State *L)
    1116             : {
    1117             : /*  there should be 1 param passed in: the new value */
    1118             : #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
    1119           0 :   lua_pop(L,1);  /* remove it */
    1120           0 :   luaL_error(L,"This variable is immutable");
    1121             : #endif
    1122           0 :     return 0;   /* should not return anything */
    1123             : }
    1124             : 
    1125             : #ifdef SWIG_LUA_ELUA_EMULATE
    1126             : 
    1127             : SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own);
    1128             : SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type);
    1129             : static int swig_lua_elua_emulate_unique_key;
    1130             : 
    1131             : /* This function emulates eLua rotables behaviour. It loads a rotable definition into the usual lua table. */
    1132             : SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_entry *table)
    1133             : {
    1134             :   int i, table_parsed, parsed_tables_array, target_table;
    1135             :   assert(lua_istable(L,-1));
    1136             :   target_table = lua_gettop(L);
    1137             :   /* Get the registry where we put all parsed tables to avoid loops */
    1138             :   lua_rawgetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
    1139             :   if(lua_isnil(L,-1)) {
    1140             :     lua_pop(L,1);
    1141             :     lua_newtable(L);
    1142             :     lua_pushvalue(L,-1);
    1143             :     lua_rawsetp(L,LUA_REGISTRYINDEX,(void*)(&swig_lua_elua_emulate_unique_key));
    1144             :   }
    1145             :   parsed_tables_array = lua_gettop(L);
    1146             :   lua_pushvalue(L,target_table);
    1147             :   lua_rawsetp(L, parsed_tables_array, table);
    1148             :   table_parsed = 0;
    1149             :   const int SWIGUNUSED pairs_start = lua_gettop(L);
    1150             :   for(i = 0;table[i].key.type != LUA_TNIL || table[i].value.type != LUA_TNIL;i++)
    1151             :   {
    1152             :     const swig_elua_entry *entry = table + i;
    1153             :     int is_metatable = 0;
    1154             :     switch(entry->key.type) {
    1155             :       case LUA_TSTRING:
    1156             :         lua_pushstring(L,entry->key.key.strkey);
    1157             :         if(strcmp(entry->key.key.strkey, SWIG_LUA_ELUA_EMUL_METATABLE_KEY) == 0)
    1158             :           is_metatable = 1;
    1159             :         break;
    1160             :       case  LUA_TNUMBER:
    1161             :         lua_pushnumber(L,entry->key.key.numkey);
    1162             :         break;
    1163             :       case LUA_TNIL:
    1164             :         lua_pushnil(L);
    1165             :         break;
    1166             :       default:
    1167             :         assert(0);
    1168             :     }
    1169             :     switch(entry->value.type) {
    1170             :       case LUA_TSTRING:
    1171             :         lua_pushstring(L,entry->value.value.string);
    1172             :         break;
    1173             :       case  LUA_TNUMBER:
    1174             :         lua_pushnumber(L,entry->value.value.number);
    1175             :         break;
    1176             :       case LUA_TFUNCTION:
    1177             :         lua_pushcfunction(L,entry->value.value.function);
    1178             :         break;
    1179             :       case LUA_TTABLE:
    1180             :         lua_rawgetp(L,parsed_tables_array, entry->value.value.table);
    1181             :         table_parsed = !lua_isnil(L,-1);
    1182             :         if(!table_parsed) {
    1183             :           lua_pop(L,1); /*remove nil */
    1184             :           lua_newtable(L);
    1185             :           SWIG_Lua_elua_emulate_register(L,entry->value.value.table);
    1186             :         } 
    1187             :         if(is_metatable) {
    1188             :           assert(lua_istable(L,-1));
    1189             :           lua_pushvalue(L,-1);
    1190             :           lua_setmetatable(L,target_table);
    1191             :         }
    1192             : 
    1193             :         break;
    1194             :       case LUA_TUSERDATA:
    1195             :         if(entry->value.value.userdata.member) 
    1196             :           SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue,
    1197             :               entry->value.value.userdata.lvalue,
    1198             :               *(entry->value.value.userdata.ptype));
    1199             :         else 
    1200             :           SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue,
    1201             :               *(entry->value.value.userdata.ptype),0);
    1202             :         break;
    1203             :       case LUA_TNIL:
    1204             :         lua_pushnil(L);
    1205             :         break;
    1206             :       default:
    1207             :         assert(0);
    1208             :     }
    1209             :     assert(lua_gettop(L) == pairs_start + 2);
    1210             :     lua_rawset(L,target_table);
    1211             :   }
    1212             :   lua_pop(L,1); /* Removing parsed tables storage */
    1213             :   assert(lua_gettop(L) == target_table);
    1214             : }
    1215             : 
    1216             : SWIGINTERN void SWIG_Lua_elua_emulate_register_clear(lua_State *L)
    1217             : {
    1218             :   lua_pushnil(L);
    1219             :   lua_rawsetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
    1220             : }
    1221             : 
    1222             : SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L);
    1223             : 
    1224             : SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L)
    1225             : {
    1226             :   SWIG_check_num_args("getmetatable(SWIG eLua emulation)", 1, 1);
    1227             :   SWIG_Lua_get_class_registry(L);
    1228             :   lua_getfield(L,-1,"lua_getmetatable");
    1229             :   lua_remove(L,-2); /* remove the registry*/
    1230             :   assert(!lua_isnil(L,-1));
    1231             :   lua_pushvalue(L,1);
    1232             :   assert(lua_gettop(L) == 3); /* object | function | object again */
    1233             :   lua_call(L,1,1);
    1234             :   if(!lua_isnil(L,-1)) /*There is an ordinary metatable */
    1235             :     return 1;
    1236             :   /*if it is a table, then emulate elua behaviour - check for __metatable attribute of a table*/
    1237             :   assert(lua_gettop(L) == 2);
    1238             :   if(lua_istable(L,-2)) {
    1239             :     lua_pop(L,1); /*remove the nil*/
    1240             :     lua_getfield(L,-1, SWIG_LUA_ELUA_EMUL_METATABLE_KEY);
    1241             :   }
    1242             :   assert(lua_gettop(L) == 2);
    1243             :   return 1;
    1244             :   
    1245             : fail:
    1246             :   lua_error(L);
    1247             :   return 0;
    1248             : }
    1249             : 
    1250             : SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L)
    1251             : {
    1252             :   SWIG_Lua_get_class_registry(L);
    1253             :   lua_pushglobaltable(L);
    1254             :   lua_pushstring(L,"lua_getmetatable");
    1255             :   lua_getfield(L,-2,"getmetatable");
    1256             :   assert(!lua_isnil(L,-1));
    1257             :   lua_rawset(L,-4);
    1258             :   lua_pushstring(L, "getmetatable");
    1259             :   lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable);
    1260             :   lua_rawset(L,-3);
    1261             :   lua_pop(L,2);
    1262             :       
    1263             : }
    1264             : /* END OF REMOVE */
    1265             : 
    1266             : #endif
    1267             : /* -----------------------------------------------------------------------------
    1268             :  * global variable support code: namespaces and modules (which are the same thing)
    1269             :  * ----------------------------------------------------------------------------- */
    1270             : 
    1271           2 : SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L)
    1272             : {
    1273             : /*  there should be 2 params passed in
    1274             :   (1) table (not the meta table)
    1275             :   (2) string name of the attribute
    1276             : */
    1277             :   assert(lua_istable(L,-2));  /* just in case */
    1278           2 :   lua_getmetatable(L,-2);
    1279             :   assert(lua_istable(L,-1));
    1280           2 :   SWIG_Lua_get_table(L,".get"); /* find the .get table */
    1281             :   assert(lua_istable(L,-1));
    1282             :   /* look for the key in the .get table */
    1283           2 :   lua_pushvalue(L,2);  /* key */
    1284           2 :   lua_rawget(L,-2);
    1285           2 :   lua_remove(L,-2); /* stack tidy, remove .get table */
    1286           2 :   if (lua_iscfunction(L,-1))
    1287             :   {  /* found it so call the fn & return its value */
    1288           0 :     lua_call(L,0,1);  /* 1 value in (userdata),1 out (result) */
    1289           0 :     lua_remove(L,-2); /* stack tidy, remove metatable */
    1290           0 :     return 1;
    1291             :   }
    1292           2 :   lua_pop(L,1);  /* remove whatever was there */
    1293             :   /* ok, so try the .fn table */
    1294           2 :   SWIG_Lua_get_table(L,".fn"); /* find the .get table */
    1295             :   assert(lua_istable(L,-1));  /* just in case */
    1296           2 :   lua_pushvalue(L,2);  /* key */
    1297           2 :   lua_rawget(L,-2);  /* look for the fn */
    1298           2 :   lua_remove(L,-2); /* stack tidy, remove .fn table */
    1299           2 :   if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */
    1300             :   {  /* found it so return the fn & let lua call it */
    1301           0 :     lua_remove(L,-2); /* stack tidy, remove metatable */
    1302           0 :     return 1;
    1303             :   }
    1304           2 :   lua_pop(L,1);  /* remove whatever was there */
    1305           2 :   return 0;
    1306             : }
    1307             : 
    1308           0 : SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L)
    1309             : {
    1310             : /*  there should be 3 params passed in
    1311             :   (1) table (not the meta table)
    1312             :   (2) string name of the attribute
    1313             :   (3) any for the new value
    1314             : */
    1315             : 
    1316             :   assert(lua_istable(L,1));
    1317           0 :   lua_getmetatable(L,1);    /* get the meta table */
    1318             :   assert(lua_istable(L,-1));
    1319             : 
    1320           0 :   SWIG_Lua_get_table(L,".set"); /* find the .set table */
    1321           0 :   if (lua_istable(L,-1))
    1322             :   {
    1323             :     /* look for the key in the .set table */
    1324           0 :     lua_pushvalue(L,2);  /* key */
    1325           0 :     lua_rawget(L,-2);
    1326           0 :     if (lua_iscfunction(L,-1))
    1327             :     {  /* found it so call the fn & return its value */
    1328           0 :       lua_pushvalue(L,3);  /* value */
    1329           0 :       lua_call(L,1,0);
    1330           0 :       return 0;
    1331             :     }
    1332           0 :     lua_pop(L,1);  /* remove the value */
    1333             :   }
    1334           0 :   lua_pop(L,1);  /* remove the value .set table */
    1335           0 :   lua_pop(L,1); /* remote metatable */
    1336           0 :   lua_rawset(L,-3);
    1337           0 :   return 0;
    1338             : }
    1339             : 
    1340             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
    1341             : SWIGINTERN void SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]); /* forward declaration */
    1342             : SWIGINTERN void  SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn); /* forward declaration */
    1343             : SWIGINTERN void  SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss);
    1344             : 
    1345             : /* helper function - register namespace methods and attributes into namespace */
    1346          72 : SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *ns)
    1347             : {
    1348             :   int i;
    1349             :   /* There must be namespace table (not metatable) at the top of the stack */
    1350             :   assert(lua_istable(L,-1));
    1351          72 :   SWIG_Lua_InstallConstants(L, ns->ns_constants);
    1352             : 
    1353             :   /* add methods to the namespace/module table */
    1354          80 :   for(i=0;ns->ns_methods[i].name;i++){
    1355           8 :     SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].func);
    1356             :   }
    1357          72 :   lua_getmetatable(L,-1);
    1358             : 
    1359             :   /* add fns */
    1360          72 :   for(i=0;ns->ns_attributes[i].name;i++){
    1361           0 :     SWIG_Lua_add_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod);
    1362             :   }
    1363             : 
    1364             :   /* clear stack - remove metatble */
    1365          72 :   lua_pop(L,1);
    1366          72 :   return 0;
    1367             : }
    1368             : 
    1369             : /* Register all classes in the namespace */
    1370             : SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace *ns)
    1371             : {
    1372             :   swig_lua_class **classes;
    1373             : 
    1374             :   /* There must be a module/namespace table at the top of the stack */
    1375             :   assert(lua_istable(L,-1));
    1376             : 
    1377          40 :   classes = ns->ns_classes;
    1378             : 
    1379          40 :   if( classes != 0 ) {
    1380          72 :     while(*classes != 0) {
    1381          32 :       SWIG_Lua_class_register(L, *classes);
    1382          32 :       classes++;
    1383             :     }
    1384             :   }
    1385             : }
    1386             : 
    1387             : /* Helper function. Creates namespace table and adds it to module table
    1388             :    if 'reg' is true, then will register namespace table to parent one (must be on top of the stack
    1389             :    when function is called).
    1390             :    Function always returns newly registered table on top of the stack.
    1391             : */
    1392          40 : SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns, int reg)
    1393             : {
    1394             :   swig_lua_namespace **sub_namespace;
    1395             :   /* 1 argument - table on the top of the stack */
    1396          40 :   const int SWIGUNUSED begin = lua_gettop(L);
    1397             :   assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table or parent namespace table */
    1398          40 :   lua_checkstack(L,5);
    1399          40 :   lua_newtable(L); /* namespace itself */
    1400          40 :   lua_newtable(L); /* metatable for namespace */
    1401             : 
    1402             :   /* add a table called ".get" */
    1403          40 :   lua_pushstring(L,".get");
    1404          40 :   lua_newtable(L);
    1405          40 :   lua_rawset(L,-3);
    1406             :   /* add a table called ".set" */
    1407          40 :   lua_pushstring(L,".set");
    1408          40 :   lua_newtable(L);
    1409          40 :   lua_rawset(L,-3);
    1410             :   /* add a table called ".fn" */
    1411          40 :   lua_pushstring(L,".fn");
    1412          40 :   lua_newtable(L);
    1413          40 :   lua_rawset(L,-3);
    1414             : 
    1415             :   /* add accessor fns for using the .get,.set&.fn */
    1416          40 :   SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get);
    1417          40 :   SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set);
    1418             : 
    1419          40 :   lua_setmetatable(L,-2); /* set metatable */
    1420             : 
    1421             :   /* Register all functions, variables etc */
    1422          40 :   SWIG_Lua_add_namespace_details(L,ns);
    1423             :   /* Register classes */
    1424          80 :   SWIG_Lua_add_namespace_classes(L,ns);
    1425             : 
    1426          40 :   sub_namespace = ns->ns_namespaces;
    1427          40 :   if( sub_namespace != 0) {
    1428           8 :     while(*sub_namespace != 0) {
    1429           0 :       SWIG_Lua_namespace_register(L, *sub_namespace, 1);
    1430           0 :       lua_pop(L,1); /* removing sub-namespace table */
    1431           0 :       sub_namespace++;
    1432             :     }
    1433             :   }
    1434             : 
    1435          40 :   if (reg) {
    1436          40 :     lua_pushstring(L,ns->name);
    1437          40 :     lua_pushvalue(L,-2);
    1438          40 :     lua_rawset(L,-4); /* add namespace to module table */
    1439             :   }
    1440             :   assert(lua_gettop(L) == begin+1);
    1441          40 : }
    1442             : #endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
    1443             : 
    1444             : /* -----------------------------------------------------------------------------
    1445             :  * global variable support code: classes
    1446             :  * ----------------------------------------------------------------------------- */
    1447             : 
    1448             : SWIGINTERN void  SWIG_Lua_get_class_metatable(lua_State *L,const char *cname);
    1449             : 
    1450             : typedef int (*swig_lua_base_iterator_func)(lua_State*,swig_type_info*, int, int *ret);
    1451             : 
    1452          18 : SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED swig_type,
    1453             :   int first_arg, swig_lua_base_iterator_func func, int  *const ret)
    1454             : {
    1455             :     /* first_arg - position of the object in stack. Everything that is above are arguments
    1456             :      * and is passed to every evocation of the func */
    1457          18 :     int last_arg = lua_gettop(L);/* position of last argument */
    1458          18 :     int original_metatable = last_arg + 1;
    1459             :     size_t bases_count;
    1460          18 :     int result = SWIG_ERROR;
    1461             :     int bases_table;
    1462             :     (void)swig_type;
    1463          18 :     lua_getmetatable(L,first_arg);
    1464             : 
    1465             :     /* initialise base search */
    1466             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
    1467          18 :     SWIG_Lua_get_table(L,".bases");
    1468             :     assert(lua_istable(L,-1));
    1469          18 :     bases_count = lua_rawlen(L,-1);
    1470          18 :     bases_table = lua_gettop(L);
    1471             : #else
    1472             :     /* In elua .bases table doesn't exist. Use table from swig_lua_class */
    1473             :     (void)bases_table;
    1474             :     assert(swig_type!=0);
    1475             :     swig_module_info *module=SWIG_GetModule(L);
    1476             :     swig_lua_class **bases= ((swig_lua_class*)(swig_type->clientdata))->bases;
    1477             :     const char **base_names= ((swig_lua_class*)(swig_type->clientdata))->base_names;
    1478             :     bases_count = 0;
    1479             :     for(;base_names[bases_count];
    1480             :       bases_count++);/* get length of bases */
    1481             : #endif
    1482             : 
    1483          18 :     if(ret)
    1484          18 :       *ret = 0;
    1485          18 :     if(bases_count>0)
    1486             :     {
    1487             :       int to_remove;
    1488             :       size_t i;
    1489             :       int j;
    1490             :       int subcall_last_arg;
    1491           0 :       int subcall_first_arg = lua_gettop(L) + 1;/* Here a copy of first_arg and arguments begin */
    1492           0 :       int valid = 1;
    1493           0 :       swig_type_info *base_swig_type = 0;
    1494           0 :       for(j=first_arg;j<=last_arg;j++)
    1495           0 :         lua_pushvalue(L,j);
    1496           0 :       subcall_last_arg = lua_gettop(L);
    1497             : 
    1498             :       /* Trick: temporarily replacing original metatable with metatable for base class and call getter */
    1499           0 :       for(i=0;i<bases_count;i++) {
    1500             :         /* Iteration through class bases */
    1501             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
    1502           0 :         lua_rawgeti(L,bases_table,i+1);
    1503           0 :         base_swig_type = 0;
    1504           0 :         if(lua_isnil(L,-1)) {
    1505           0 :           valid = 0;
    1506           0 :           lua_pop(L,1);
    1507             :         } else {
    1508             :           valid = 1;
    1509             :         }
    1510             : #else /* In elua .bases table doesn't exist. Use table from swig_lua_class */
    1511             :         swig_lua_class *base_class = bases[i];
    1512             :         if(!base_class) {
    1513             :           valid = 0;
    1514             :         } else {
    1515             :           valid = 1;
    1516             :           SWIG_Lua_get_class_metatable(L,base_class->fqname);
    1517             :           base_swig_type = SWIG_TypeQueryModule(module,module,base_names[i]);
    1518             :           assert(base_swig_type != 0);
    1519             :         }
    1520             : #endif
    1521             : 
    1522           0 :         if(!valid)
    1523             :           continue;
    1524             :         assert(lua_isuserdata(L, subcall_first_arg));
    1525             :         assert(lua_istable(L,-1));
    1526           0 :         lua_setmetatable(L,subcall_first_arg); /* Set new metatable */
    1527             :         assert(lua_gettop(L) == subcall_last_arg);
    1528           0 :         result = func(L, base_swig_type,subcall_first_arg, ret); /* Forward call */
    1529           0 :         if(result != SWIG_ERROR) {
    1530             :           break;
    1531             :         }
    1532             :       }
    1533             :       /* Restore original metatable */
    1534           0 :       lua_pushvalue(L,original_metatable);
    1535           0 :       lua_setmetatable(L,first_arg);
    1536             :       /* Clear - remove everything between last_arg and subcall_last_arg including */
    1537           0 :       to_remove = subcall_last_arg - last_arg;
    1538           0 :       for(j=0;j<to_remove;j++)
    1539           0 :         lua_remove(L,last_arg+1);
    1540             :     } else {
    1541             :       /* Remove everything after last_arg */
    1542          18 :       lua_pop(L, lua_gettop(L) - last_arg);
    1543             :     }
    1544             :     if(ret) assert(lua_gettop(L) == last_arg + *ret);
    1545          18 :     return result;
    1546             : }
    1547             : 
    1548             : /* The class.get method helper, performs the lookup of class attributes.
    1549             :  * It returns an error code. Number of function return values is passed inside 'ret'.
    1550             :  * first_arg is not used in this function because function always has 2 arguments.
    1551             :  */
    1552           9 : SWIGINTERN int  SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
    1553             : {
    1554             : /*  there should be 2 params passed in
    1555             :   (1) userdata (not the meta table)
    1556             :   (2) string name of the attribute
    1557             : */
    1558             :   int bases_search_result;
    1559           9 :   int substack_start = lua_gettop(L)-2;
    1560             :   assert(first_arg == substack_start+1);
    1561           9 :   lua_checkstack(L,5);
    1562             :   assert(lua_isuserdata(L,-2));  /* just in case */
    1563           9 :   lua_getmetatable(L,-2);    /* get the meta table */
    1564             :   assert(lua_istable(L,-1));  /* just in case */
    1565             :   /* NEW: looks for the __getitem() fn
    1566             :   this is a user provided get fn */
    1567           9 :   SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
    1568           9 :   if (lua_iscfunction(L,-1))  /* if its there */
    1569             :   {  /* found it so call the fn & return its value */
    1570           0 :     lua_pushvalue(L,substack_start+1);  /* the userdata */
    1571           0 :     lua_pushvalue(L,substack_start+2);  /* the parameter */
    1572           0 :     lua_call(L,2,1);  /* 2 value in (userdata),1 out (result) */
    1573           0 :     lua_remove(L,-2); /* stack tidy, remove metatable */
    1574           0 :     if(ret) *ret = 1;
    1575             :     return SWIG_OK;
    1576             :   }
    1577           9 :   lua_pop(L,1);
    1578             :   /* Remove the metatable */
    1579           9 :   lua_pop(L,1);
    1580             :   /* Search in base classes */
    1581           9 :   bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get_item,ret);
    1582           9 :   return bases_search_result;  /* sorry not known */
    1583             : }
    1584             : 
    1585             : 
    1586             : /* The class.get method helper, performs the lookup of class attributes.
    1587             :  * It returns an error code. Number of function return values is passed inside 'ret'.
    1588             :  * first_arg is not used in this function because function always has 2 arguments.
    1589             :  */
    1590         181 : SWIGINTERN int  SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
    1591             : {
    1592             : /*  there should be 2 params passed in
    1593             :   (1) userdata (not the meta table)
    1594             :   (2) string name of the attribute
    1595             : */
    1596             :   int bases_search_result;
    1597         181 :   int substack_start = lua_gettop(L)-2;
    1598             :   assert(first_arg == substack_start+1);
    1599         181 :   lua_checkstack(L,5);
    1600             :   assert(lua_isuserdata(L,-2));  /* just in case */
    1601         181 :   lua_getmetatable(L,-2);    /* get the meta table */
    1602             :   assert(lua_istable(L,-1));  /* just in case */
    1603         181 :   SWIG_Lua_get_table(L,".get"); /* find the .get table */
    1604             :   assert(lua_istable(L,-1));  /* just in case */
    1605             :   /* look for the key in the .get table */
    1606         181 :   lua_pushvalue(L,substack_start+2);  /* key */
    1607         181 :   lua_rawget(L,-2);
    1608         181 :   lua_remove(L,-2); /* stack tidy, remove .get table */
    1609         181 :   if (lua_iscfunction(L,-1))
    1610             :   {  /* found it so call the fn & return its value */
    1611          30 :     lua_pushvalue(L,substack_start+1);  /* the userdata */
    1612          30 :     lua_call(L,1,1);  /* 1 value in (userdata),1 out (result) */
    1613          30 :     lua_remove(L,-2); /* stack tidy, remove metatable */
    1614          30 :     if(ret)
    1615          30 :       *ret = 1;
    1616             :     return SWIG_OK;
    1617             :   }
    1618         151 :   lua_pop(L,1);  /* remove whatever was there */
    1619             :   /* ok, so try the .fn table */
    1620         151 :   SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
    1621             :   assert(lua_istable(L,-1));  /* just in case */
    1622         151 :   lua_pushvalue(L,substack_start+2);  /* key */
    1623         151 :   lua_rawget(L,-2);  /* look for the fn */
    1624         151 :   lua_remove(L,-2); /* stack tidy, remove .fn table */
    1625         151 :   if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
    1626             :   {  /* found it so return the fn & let lua call it */
    1627         142 :     lua_remove(L,-2); /* stack tidy, remove metatable */
    1628         142 :     if(ret)
    1629         142 :       *ret = 1;
    1630             :     return SWIG_OK;
    1631             :   }
    1632           9 :   lua_pop(L,1);  /* remove whatever was there */
    1633             :   /* Remove the metatable */
    1634           9 :   lua_pop(L,1);
    1635             :   /* Search in base classes */
    1636           9 :   bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get,ret);
    1637           9 :   return bases_search_result;  /* sorry not known */
    1638             : }
    1639             : 
    1640             : /* the class.get method, performs the lookup of class attributes
    1641             :  */
    1642         181 : SWIGINTERN int  SWIG_Lua_class_get(lua_State *L)
    1643             : {
    1644             : /*  there should be 2 params passed in
    1645             :   (1) userdata (not the meta table)
    1646             :   (2) string name of the attribute
    1647             : */
    1648             :   int result;
    1649             :   swig_lua_userdata *usr;
    1650             :   swig_type_info *type;
    1651         181 :   int ret = 0;
    1652             :   assert(lua_isuserdata(L,1));
    1653         181 :   usr=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
    1654         181 :   type = usr->type;
    1655         181 :   result = SWIG_Lua_class_do_get(L,type,1,&ret);
    1656         181 :   if(result == SWIG_OK)
    1657         172 :     return ret;
    1658             : 
    1659           9 :   result = SWIG_Lua_class_do_get_item(L,type,1,&ret);
    1660           9 :   if(result == SWIG_OK)
    1661           0 :     return ret;
    1662             : 
    1663             :   return 0;
    1664             : }
    1665             : 
    1666             : /* helper for the class.set method, performs the lookup of class attributes
    1667             :  * It returns error code. Number of function return values is passed inside 'ret'
    1668             :  */
    1669          11 : SWIGINTERN int  SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int first_arg, int *ret)
    1670             : {
    1671             : /*  there should be 3 params passed in
    1672             :   (1) table (not the meta table)
    1673             :   (2) string name of the attribute
    1674             :   (3) any for the new value
    1675             :   */
    1676             : 
    1677             :   int bases_search_result;
    1678          11 :   int substack_start = lua_gettop(L) - 3;
    1679          11 :   lua_checkstack(L,5);
    1680             :   assert(lua_isuserdata(L,substack_start+1));  /* just in case */
    1681          11 :   lua_getmetatable(L,substack_start+1);    /* get the meta table */
    1682             :   assert(lua_istable(L,-1));  /* just in case */
    1683          11 :   if(ret)
    1684          11 :     *ret = 0; /* it is setter - number of return values is always 0 */
    1685             : 
    1686          11 :   SWIG_Lua_get_table(L,".set"); /* find the .set table */
    1687          11 :   if (lua_istable(L,-1))
    1688             :   {
    1689             :     /* look for the key in the .set table */
    1690          11 :     lua_pushvalue(L,substack_start+2);  /* key */
    1691          11 :     lua_rawget(L,-2);
    1692          11 :     lua_remove(L,-2); /* tidy stack, remove .set table */
    1693          11 :     if (lua_iscfunction(L,-1))
    1694             :     {  /* found it so call the fn & return its value */
    1695          11 :       lua_pushvalue(L,substack_start+1);  /* userdata */
    1696          11 :       lua_pushvalue(L,substack_start+3);  /* value */
    1697          11 :       lua_call(L,2,0);
    1698          10 :       lua_remove(L,substack_start+4); /*remove metatable*/
    1699          10 :       return SWIG_OK;
    1700             :     }
    1701           0 :     lua_pop(L,1);  /* remove the value */
    1702             :   } else {
    1703           0 :     lua_pop(L,1);  /* remove the answer for .set table request*/
    1704             :   }
    1705             :   /* NEW: looks for the __setitem() fn
    1706             :   this is a user provided set fn */
    1707           0 :   SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
    1708           0 :   if (lua_iscfunction(L,-1))  /* if its there */
    1709             :   {  /* found it so call the fn & return its value */
    1710           0 :     lua_pushvalue(L,substack_start+1);  /* the userdata */
    1711           0 :     lua_pushvalue(L,substack_start+2);  /* the parameter */
    1712           0 :     lua_pushvalue(L,substack_start+3);  /* the value */
    1713           0 :     lua_call(L,3,0);  /* 3 values in ,0 out */
    1714           0 :     lua_remove(L,-2); /* stack tidy, remove metatable */
    1715           0 :     return SWIG_OK;
    1716             :   }
    1717           0 :   lua_pop(L,1); /* remove value */
    1718             : 
    1719           0 :   lua_pop(L,1); /* remove metatable */
    1720             :   /* Search among bases */
    1721           0 :   bases_search_result = SWIG_Lua_iterate_bases(L,type,first_arg,SWIG_Lua_class_do_set,ret);
    1722             :   if(ret)
    1723             :     assert(*ret == 0);
    1724             :   assert(lua_gettop(L) == substack_start + 3);
    1725           0 :   return bases_search_result;
    1726             : }
    1727             : 
    1728             : /* This is the actual method exported to Lua. It calls SWIG_Lua_class_do_set and correctly
    1729             :  * handles return values.
    1730             :  */
    1731          11 : SWIGINTERN int  SWIG_Lua_class_set(lua_State *L)
    1732             : {
    1733             : /*  There should be 3 params passed in
    1734             :   (1) table (not the meta table)
    1735             :   (2) string name of the attribute
    1736             :   (3) any for the new value
    1737             :   */
    1738          11 :   int ret = 0;
    1739             :   int result;
    1740             :   swig_lua_userdata *usr;
    1741             :   swig_type_info *type;
    1742             :   assert(lua_isuserdata(L,1));
    1743          11 :   usr=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
    1744          11 :   type = usr->type;
    1745          11 :   result = SWIG_Lua_class_do_set(L,type,1,&ret);
    1746          10 :   if(result != SWIG_OK) {
    1747           0 :    SWIG_Lua_pushferrstring(L,"Assignment not possible. No setter/member with this name. For custom assignments implement __setitem method.");
    1748           0 :    lua_error(L);
    1749             :   } else {
    1750             :     assert(ret==0);
    1751             :   }
    1752          10 :   return 0;
    1753             : }
    1754             : 
    1755             : /* the class.destruct method called by the interpreter */
    1756         138 : SWIGINTERN int  SWIG_Lua_class_destruct(lua_State *L)
    1757             : {
    1758             : /*  there should be 1 params passed in
    1759             :   (1) userdata (not the meta table) */
    1760             :   swig_lua_userdata *usr;
    1761             :   swig_lua_class *clss;
    1762             :   assert(lua_isuserdata(L,-1));  /* just in case */
    1763         138 :   usr=(swig_lua_userdata*)lua_touserdata(L,-1);  /* get it */
    1764             :   /* if must be destroyed & has a destructor */
    1765         138 :   if (usr->own) /* if must be destroyed */
    1766             :   {
    1767         120 :     clss=(swig_lua_class*)usr->type->clientdata;  /* get the class */
    1768         120 :     if (clss && clss->destructor)  /* there is a destroy fn */
    1769             :     {
    1770         120 :       clss->destructor(usr->ptr);  /* bye bye */
    1771             :     }
    1772             :   }
    1773         138 :   return 0;
    1774             : }
    1775             : 
    1776             : /* the class.__tostring method called by the interpreter and print */
    1777           0 : SWIGINTERN int  SWIG_Lua_class_tostring(lua_State *L)
    1778             : {
    1779             : /*  there should be 1 param passed in
    1780             :   (1) userdata (not the metatable) */
    1781             :   const char *className;
    1782             :   void* userData;
    1783             :   assert(lua_isuserdata(L,1));  /* just in case */
    1784           0 :   userData = lua_touserdata(L,1); /* get the userdata address for later */
    1785           0 :   lua_getmetatable(L,1);    /* get the meta table */
    1786             :   assert(lua_istable(L,-1));  /* just in case */
    1787             : 
    1788           0 :   lua_getfield(L, -1, ".type");
    1789           0 :   className = lua_tostring(L, -1);
    1790             : 
    1791           0 :   lua_pushfstring(L, "<%s userdata: %p>", className, userData);
    1792           0 :   return 1;
    1793             : }
    1794             : 
    1795             : /* to manually disown some userdata */
    1796           0 : SWIGINTERN int  SWIG_Lua_class_disown(lua_State *L)
    1797             : {
    1798             : /*  there should be 1 params passed in
    1799             :   (1) userdata (not the meta table) */
    1800             :   swig_lua_userdata *usr;
    1801             :   assert(lua_isuserdata(L,-1));  /* just in case */
    1802           0 :   usr=(swig_lua_userdata*)lua_touserdata(L,-1);  /* get it */
    1803             :   
    1804           0 :   usr->own = 0; /* clear our ownership */
    1805           0 :   return 0;
    1806             : }
    1807             : 
    1808             : /* lua callable function to compare userdata's value
    1809             : the issue is that two userdata may point to the same thing
    1810             : but to lua, they are different objects */
    1811           0 : SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L)
    1812             : {
    1813             :   int result;
    1814             :   swig_lua_userdata *usr1,*usr2;
    1815           0 :   if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2))  /* just in case */
    1816             :     return 0;  /* nil reply */
    1817           0 :   usr1=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
    1818           0 :   usr2=(swig_lua_userdata*)lua_touserdata(L,2);  /* get data */
    1819             :   /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
    1820           0 :   result=(usr1->ptr==usr2->ptr);
    1821           0 :    lua_pushboolean(L,result);
    1822           0 :   return 1;
    1823             : }
    1824             : 
    1825             : /* populate table at the top of the stack with metamethods that ought to be inherited */
    1826           8 : SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L)
    1827             : {
    1828           8 :   SWIG_Lua_add_boolean(L, "__add", 1);
    1829           8 :   SWIG_Lua_add_boolean(L, "__sub", 1);
    1830           8 :   SWIG_Lua_add_boolean(L, "__mul", 1);
    1831           8 :   SWIG_Lua_add_boolean(L, "__div", 1);
    1832           8 :   SWIG_Lua_add_boolean(L, "__mod", 1);
    1833           8 :   SWIG_Lua_add_boolean(L, "__pow", 1);
    1834           8 :   SWIG_Lua_add_boolean(L, "__unm", 1);
    1835           8 :   SWIG_Lua_add_boolean(L, "__len", 1 );
    1836           8 :   SWIG_Lua_add_boolean(L, "__concat", 1 );
    1837           8 :   SWIG_Lua_add_boolean(L, "__eq", 1);
    1838           8 :   SWIG_Lua_add_boolean(L, "__lt", 1);
    1839           8 :   SWIG_Lua_add_boolean(L, "__le", 1);
    1840           8 :   SWIG_Lua_add_boolean(L, "__call", 1);
    1841           8 :   SWIG_Lua_add_boolean(L, "__tostring", 1);
    1842           8 :   SWIG_Lua_add_boolean(L, "__gc", 0);
    1843           8 : }
    1844             : 
    1845             : /* creates the swig registry */
    1846           8 : SWIGINTERN void SWIG_Lua_create_class_registry(lua_State *L)
    1847             : {
    1848             :   /* create main SWIG registry table */
    1849           8 :   lua_pushstring(L,"SWIG");
    1850           8 :   lua_newtable(L);
    1851             :   /* populate it with some predefined data */
    1852             : 
    1853             :   /* .library table. Placeholder */
    1854           8 :   lua_pushstring(L,".library");
    1855           8 :   lua_newtable(L);
    1856             :   {
    1857             :     /* list of metamethods that class inherits from its bases */
    1858           8 :     lua_pushstring(L,"inheritable_metamethods");
    1859           8 :     lua_newtable(L);
    1860             :     /* populate with list of metamethods */
    1861           8 :     SWIG_Lua_populate_inheritable_metamethods(L);
    1862           8 :     lua_rawset(L,-3);
    1863             :   }
    1864           8 :   lua_rawset(L,-3);
    1865             : 
    1866           8 :   lua_rawset(L,LUA_REGISTRYINDEX);
    1867           8 : }
    1868             : 
    1869             : /* gets the swig registry (or creates it) */
    1870         352 : SWIGINTERN void  SWIG_Lua_get_class_registry(lua_State *L)
    1871             : {
    1872             :   /* add this all into the swig registry: */
    1873         352 :   lua_pushstring(L,"SWIG");
    1874         352 :   lua_rawget(L,LUA_REGISTRYINDEX);  /* get the registry */
    1875         352 :   if (!lua_istable(L,-1))  /* not there */
    1876             :   {  /* must be first time, so add it */
    1877           8 :     lua_pop(L,1);  /* remove the result */
    1878           8 :     SWIG_Lua_create_class_registry(L);
    1879             :     /* then get it */
    1880           8 :     lua_pushstring(L,"SWIG");
    1881           8 :     lua_rawget(L,LUA_REGISTRYINDEX);
    1882             :   }
    1883         352 : }
    1884             : 
    1885          32 : SWIGINTERN void SWIG_Lua_get_inheritable_metamethods(lua_State *L)
    1886             : {
    1887          32 :   SWIG_Lua_get_class_registry(L);
    1888          32 :   lua_pushstring(L, ".library");
    1889          32 :   lua_rawget(L,-2);
    1890             :   assert( !lua_isnil(L,-1) );
    1891          32 :   lua_pushstring(L, "inheritable_metamethods");
    1892          32 :   lua_rawget(L,-2);
    1893             : 
    1894             :   /* Remove class registry and library table */
    1895          32 :   lua_remove(L,-2);
    1896          32 :   lua_remove(L,-2);
    1897          32 : }
    1898             : 
    1899             : /* Helper function to get the classes metatable from the register */
    1900         256 : SWIGINTERN void  SWIG_Lua_get_class_metatable(lua_State *L,const char *cname)
    1901             : {
    1902         256 :   SWIG_Lua_get_class_registry(L);  /* get the registry */
    1903         256 :   lua_pushstring(L,cname);  /* get the name */
    1904         256 :   lua_rawget(L,-2);    /* get it */
    1905         256 :   lua_remove(L,-2);    /* tidy up (remove registry) */
    1906         256 : }
    1907             : 
    1908             : /* Set up the base classes pointers.
    1909             : Each class structure has a list of pointers to the base class structures.
    1910             : This function fills them.
    1911             : It cannot be done at compile time, as this will not work with hireachies
    1912             : spread over more than one swig file. 
    1913             : Therefore it must be done at runtime, querying the SWIG type system.
    1914             : */
    1915          32 : SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss)
    1916             : {
    1917          32 :   int i=0;
    1918          32 :   swig_module_info *module=SWIG_GetModule(L);
    1919          32 :   for(i=0;clss->base_names[i];i++)
    1920             :   {
    1921           0 :     if (clss->bases[i]==0) /* not found yet */
    1922             :     {
    1923             :       /* lookup and cache the base class */
    1924           0 :       swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
    1925           0 :       if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
    1926             :     }
    1927             :   }
    1928          32 : }
    1929             : 
    1930             : #if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
    1931             : /* Merges two tables  */
    1932             : SWIGINTERN void SWIG_Lua_merge_tables_by_index(lua_State *L, int target, int source)
    1933             : {
    1934             :   /* iterating */
    1935             :   lua_pushnil(L);
    1936             :   while (lua_next(L,source) != 0) {
    1937             :     /* -1 - value, -2 - index */
    1938             :     /* have to copy to assign */
    1939             :     lua_pushvalue(L,-2); /* copy of index */
    1940             :     lua_pushvalue(L,-2); /* copy of value */
    1941             :     lua_rawset(L, target);
    1942             :     lua_pop(L,1);
    1943             :     /* only key is left */
    1944             :   }
    1945             : }
    1946             : 
    1947             : /* Merges two tables with given name. original - index of target metatable, base - index of source metatable */
    1948             : SWIGINTERN void SWIG_Lua_merge_tables(lua_State *L, const char* name, int original, int base)
    1949             : {
    1950             :   /* push original[name], then base[name] */
    1951             :   lua_pushstring(L,name);
    1952             :   lua_rawget(L,original);
    1953             :   int original_table = lua_gettop(L);
    1954             :   lua_pushstring(L,name);
    1955             :   lua_rawget(L,base);
    1956             :   int base_table = lua_gettop(L);
    1957             :   SWIG_Lua_merge_tables_by_index(L, original_table, base_table);
    1958             :   /* clearing stack */
    1959             :   lua_pop(L,2);
    1960             : }
    1961             : 
    1962             : /* Function takes all symbols from base and adds it to derived class. It's just a helper. */
    1963             : SWIGINTERN void SWIG_Lua_class_squash_base(lua_State *L, swig_lua_class *base_cls)
    1964             : {
    1965             :   /* There is one parameter - original, i.e. 'derived' class metatable */
    1966             :   assert(lua_istable(L,-1));
    1967             :   int original = lua_gettop(L);
    1968             :   SWIG_Lua_get_class_metatable(L,base_cls->fqname);
    1969             :   int base = lua_gettop(L);
    1970             :   SWIG_Lua_merge_tables(L, ".fn", original, base );
    1971             :   SWIG_Lua_merge_tables(L, ".set", original, base );
    1972             :   SWIG_Lua_merge_tables(L, ".get", original, base );
    1973             :   lua_pop(L,1);
    1974             : }
    1975             : 
    1976             : /* Function squashes all symbols from 'clss' bases into itself */
    1977             : SWIGINTERN void  SWIG_Lua_class_squash_bases(lua_State *L, swig_lua_class *clss)
    1978             : {
    1979             :   int i;
    1980             :   SWIG_Lua_get_class_metatable(L,clss->fqname);
    1981             :   for(i=0;clss->base_names[i];i++)
    1982             :   {
    1983             :     if (clss->bases[i]==0) /* Somehow it's not found. Skip it */
    1984             :       continue;
    1985             :     /* Thing is: all bases are already registered. Thus they have already executed
    1986             :      * this function. So we just need to squash them into us, because their bases
    1987             :      * are already squashed into them. No need for recursion here!
    1988             :      */
    1989             :     SWIG_Lua_class_squash_base(L, clss->bases[i]);
    1990             :   }
    1991             :   lua_pop(L,1); /*tidy stack*/
    1992             : }
    1993             : #endif
    1994             : 
    1995             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
    1996             : /* helper add a variable to a registered class */
    1997          48 : SWIGINTERN void  SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn)
    1998             : {
    1999             :   assert(lua_istable(L,-1));  /* just in case */
    2000          48 :   SWIG_Lua_get_table(L,".get"); /* find the .get table */
    2001             :   assert(lua_istable(L,-1));  /* just in case */
    2002          48 :   SWIG_Lua_add_function(L,name,getFn);
    2003          48 :   lua_pop(L,1);       /* tidy stack (remove table) */
    2004          48 :   if (setFn)
    2005             :   {
    2006          48 :     SWIG_Lua_get_table(L,".set"); /* find the .set table */
    2007             :     assert(lua_istable(L,-1));  /* just in case */
    2008          48 :     SWIG_Lua_add_function(L,name,setFn);
    2009          48 :     lua_pop(L,1);       /* tidy stack (remove table) */
    2010             :   }
    2011          48 : }
    2012             : 
    2013             : /* helper to recursively add class static details (static attributes, operations and constants) */
    2014          32 : SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State *L, swig_lua_class *clss)
    2015             : {
    2016          32 :   int i = 0;
    2017             :   /* The class namespace table must be on the top of the stack */
    2018             :   assert(lua_istable(L,-1));
    2019             :   /* call all the base classes first: we can then override these later: */
    2020          32 :   for(i=0;clss->bases[i];i++)
    2021             :   {
    2022           0 :     SWIG_Lua_add_class_static_details(L,clss->bases[i]);
    2023             :   }
    2024             : 
    2025          32 :   SWIG_Lua_add_namespace_details(L, clss->cls_static);
    2026          32 : }
    2027             : 
    2028             : SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss); /* forward declaration */
    2029             : 
    2030             : /* helper to recursively add class details (attributes & operations) */
    2031          32 : SWIGINTERN void  SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_class *clss)
    2032             : {
    2033             :   int i;
    2034          32 :   size_t bases_count = 0;
    2035             :   /* Add bases to .bases table */
    2036          32 :   SWIG_Lua_get_table(L,".bases");
    2037             :   assert(lua_istable(L,-1));  /* just in case */
    2038          32 :   for(i=0;clss->bases[i];i++)
    2039             :   {
    2040           0 :     SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
    2041             :     /* Base class must be already registered */
    2042             :     assert(lua_istable(L,-1));
    2043           0 :     lua_rawseti(L,-2,i+1); /* In lua indexing starts from 1 */
    2044           0 :     bases_count++;
    2045             :   }
    2046             :   assert(lua_rawlen(L,-1) == bases_count);
    2047          32 :   lua_pop(L,1); /* remove .bases table */
    2048             :   /* add attributes */
    2049          56 :   for(i=0;clss->attributes[i].name;i++){
    2050          24 :     SWIG_Lua_add_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
    2051             :   }
    2052             :   /* add methods to the metatable */
    2053          32 :   SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
    2054             :   assert(lua_istable(L,-1));  /* just in case */
    2055         704 :   for(i=0;clss->methods[i].name;i++){
    2056         672 :     SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].func);
    2057             :   }
    2058          32 :   lua_pop(L,1);       /* tidy stack (remove table) */
    2059             :   /* add operator overloads
    2060             :     This adds methods from metatable array to metatable. Can mess up garbage
    2061             :     collectind if someone defines __gc method
    2062             :     */
    2063          32 :   if(clss->metatable) {
    2064         128 :     for(i=0;clss->metatable[i].name;i++) {
    2065          48 :       SWIG_Lua_add_function(L,clss->metatable[i].name,clss->metatable[i].func);
    2066             :     }
    2067             :   }
    2068             : 
    2069             : #if !defined(SWIG_LUA_SQUASH_BASES)
    2070             :   /* Adding metamethods that are defined in base classes. If bases were squashed
    2071             :    * then it is obviously unnecessary
    2072             :    */
    2073          32 :   SWIG_Lua_add_class_user_metamethods(L, clss);
    2074             : #endif
    2075          32 : }
    2076             : 
    2077             : /* Helpers to add user defined class metamedhods - __add, __sub etc. The helpers are needed
    2078             :    for the following issue: Lua runtime checks for metamethod existence with rawget function
    2079             :    ignoring our SWIG-provided __index and __newindex functions. Thus our inheritance-aware method
    2080             :    search algorithm doesn't work in such case. (Not to say that Lua runtime queries metamethod directly
    2081             :    in metatable and not in object).
    2082             :    Current solution is this: if somewhere in hierarchy metamethod __x is defined, then all descendants
    2083             :    are automatically given a special proxy __x that calls the real __x method.
    2084             :    Obvious idea - to copy __x instead of creating __x-proxy is wrong because if someone changes __x in runtime,
    2085             :    those changes must be reflected in all descendants.
    2086             : */
    2087             : 
    2088             : SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration*/
    2089             : 
    2090             : /* The real function that resolves a metamethod.
    2091             :  * Function searches given class and all it's bases(recursively) for first instance of something that is
    2092             :  * not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actual metamethod implementation
    2093             :  * and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the
    2094             :  * answer.
    2095             :  * Returns 1 if found, 0 otherwise.
    2096             :  * clss is class which metatable we will search for method
    2097             :  * metamethod_name_idx is index in L where metamethod name (as string) lies
    2098             :  * skip_check allows to skip searching metamethod in givel clss and immideatelly go to searching in bases. skip_check
    2099             :  * is not caried to subsequent recursive calls - false is always passed. It is set to true only at first call from
    2100             :  * SWIG_Lua_resolve_metamethod
    2101             :  * */
    2102           0 : SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx,
    2103             :     int skip_check)
    2104             : {
    2105             :   /* This function is called recursively */
    2106           0 :   int result = 0;
    2107           0 :   int i = 0;
    2108             : 
    2109           0 :   if (!skip_check) {
    2110           0 :     SWIG_Lua_get_class_metatable(L, clss->fqname);
    2111           0 :     lua_pushvalue(L, metamethod_name_idx);
    2112           0 :     lua_rawget(L,-2);
    2113             :     /* If this is cfunction and it is equal to SWIG_Lua_resolve_metamethod then
    2114             :      * this isn't the function we are looking for :)
    2115             :      * lua_tocfunction will return NULL if not cfunction
    2116             :      */
    2117           0 :     if (!lua_isnil(L,-1) && lua_tocfunction(L,-1) != SWIG_Lua_resolve_metamethod ) {
    2118           0 :       lua_remove(L,-2); /* removing class metatable */
    2119             :       return 1;
    2120             :     }
    2121           0 :     lua_pop(L,2); /* remove class metatable and query result */
    2122             :   }
    2123             : 
    2124             :   /* Forwarding calls to bases */
    2125           0 :   for(i=0;clss->bases[i];i++)
    2126             :   {
    2127           0 :     result = SWIG_Lua_do_resolve_metamethod(L, clss->bases[i], metamethod_name_idx, 0);
    2128           0 :     if (result)
    2129             :       break;
    2130             :   }
    2131             : 
    2132             :   return result;
    2133             : }
    2134             : 
    2135             : /* The proxy function for metamethod. All parameters are passed as cclosure. Searches for actual method
    2136             :  * and calls it */
    2137           0 : SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
    2138             : {
    2139             :   int numargs;
    2140             :   int metamethod_name_idx;
    2141             :   const swig_lua_class* clss;
    2142             :   int result;
    2143             : 
    2144           0 :   lua_checkstack(L,5);
    2145           0 :   numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */
    2146             :   
    2147             :   /* Get upvalues from closure */
    2148           0 :   lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/
    2149           0 :   metamethod_name_idx = lua_gettop(L);
    2150             :   
    2151           0 :   lua_pushvalue(L, lua_upvalueindex(2));
    2152           0 :   clss = (const swig_lua_class*)(lua_touserdata(L,-1));
    2153           0 :   lua_pop(L,1); /* remove lightuserdata with clss from stack */
    2154             : 
    2155             :   /* Actual work */
    2156           0 :   result = SWIG_Lua_do_resolve_metamethod(L, clss, metamethod_name_idx, 1);
    2157           0 :   if (!result) {
    2158           0 :    SWIG_Lua_pushferrstring(L,"The metamethod proxy is set, but it failed to find actual metamethod. Memory corruption is most likely explanation.");
    2159           0 :    lua_error(L);
    2160           0 :    return 0;
    2161             :   }
    2162             : 
    2163           0 :   lua_remove(L,-2); /* remove metamethod key */
    2164           0 :   lua_insert(L,1); /* move function to correct position */
    2165           0 :   lua_call(L, numargs, LUA_MULTRET);
    2166           0 :   return lua_gettop(L); /* return all results */
    2167             : }
    2168             : 
    2169             : 
    2170             : /* If given metamethod must be present in given class, then creates appropriate proxy
    2171             :  * Returns 1 if successfully added, 0 if not added because no base class has it, -1
    2172             :  * if method is defined in the class metatable itself
    2173             :  */
    2174         480 : SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *clss, const int metatable_index)
    2175             : {
    2176             :   int key_index;
    2177         480 :   int success = 0;
    2178         480 :   int i = 0;
    2179             : 
    2180             :   /* metamethod name - on the top of the stack */
    2181             :   assert(lua_isstring(L,-1));
    2182             :   
    2183         480 :   key_index = lua_gettop(L);
    2184             : 
    2185             :   /* Check whether method is already defined in metatable */
    2186         480 :   lua_pushvalue(L,key_index); /* copy of the key */
    2187         480 :   lua_gettable(L,metatable_index);
    2188         480 :   if( !lua_isnil(L,-1) ) {
    2189          72 :     lua_pop(L,1);
    2190          72 :     return -1;
    2191             :   }
    2192         408 :   lua_pop(L,1); 
    2193             : 
    2194             :   /* Iterating over immediate bases */
    2195         408 :   for(i=0;clss->bases[i];i++)
    2196             :   {
    2197           0 :     const swig_lua_class *base = clss->bases[i];
    2198           0 :     SWIG_Lua_get_class_metatable(L, base->fqname);
    2199           0 :     lua_pushvalue(L, key_index);
    2200           0 :     lua_rawget(L, -2);
    2201           0 :     if( !lua_isnil(L,-1) ) {
    2202           0 :       lua_pushvalue(L, key_index); 
    2203             : 
    2204             :       /* Add proxy function */
    2205           0 :       lua_pushvalue(L, key_index); /* first closure value is function name */
    2206           0 :       lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */
    2207           0 :       lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2);
    2208             :       
    2209           0 :       lua_rawset(L, metatable_index);
    2210           0 :       success = 1;
    2211             :     }
    2212           0 :     lua_pop(L,1); /* remove function or nil */
    2213           0 :     lua_pop(L,1); /* remove base class metatable */
    2214             : 
    2215           0 :     if( success )
    2216             :       break;
    2217             :   }
    2218             : 
    2219             :   return success; 
    2220             : }
    2221             : 
    2222          32 : SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
    2223             : {
    2224             :   int metatable_index;
    2225             :   int metamethods_info_index;
    2226             :   int tostring_undefined;
    2227          32 :   int eq_undefined = 0;
    2228             : 
    2229          32 :   SWIG_Lua_get_class_metatable(L, clss->fqname);
    2230          32 :   metatable_index = lua_gettop(L);
    2231          32 :   SWIG_Lua_get_inheritable_metamethods(L);
    2232             :   assert(lua_istable(L,-1));
    2233          32 :   metamethods_info_index = lua_gettop(L);
    2234          32 :   lua_pushnil(L); /* first key */
    2235         512 :   while(lua_next(L, metamethods_info_index) != 0 ) {
    2236             :     /* key at index -2, value at index -1 */
    2237         480 :     const int is_inheritable = lua_toboolean(L,-2);
    2238         480 :     lua_pop(L,1); /* remove value - we don't need it anymore */
    2239             : 
    2240         480 :     if(is_inheritable) { /* if metamethod is inheritable */
    2241         480 :       SWIG_Lua_add_class_user_metamethod(L,clss,metatable_index);
    2242             :     }
    2243             :   }
    2244             : 
    2245          32 :   lua_pop(L,1); /* remove inheritable metatmethods table */
    2246             : 
    2247             :   /* Special handling for __tostring method */
    2248          32 :   lua_pushstring(L, "__tostring");
    2249          32 :   lua_pushvalue(L,-1);
    2250          32 :   lua_rawget(L,metatable_index);
    2251          32 :   tostring_undefined = lua_isnil(L,-1);
    2252          32 :   lua_pop(L,1);
    2253          32 :   if( tostring_undefined ) {
    2254          24 :     lua_pushcfunction(L, SWIG_Lua_class_tostring);
    2255          24 :     lua_rawset(L, metatable_index);
    2256             :   } else {
    2257           8 :     lua_pop(L,1); /* remove copy of the key */
    2258             :   }
    2259             : 
    2260             :   /* Special handling for __eq method */
    2261          32 :   lua_pushstring(L, "__eq");
    2262          32 :   lua_pushvalue(L,-1);
    2263          32 :   lua_rawget(L,metatable_index);
    2264          32 :   eq_undefined = lua_isnil(L,-1);
    2265          32 :   lua_pop(L,1);
    2266          32 :   if( eq_undefined ) {
    2267          24 :     lua_pushcfunction(L, SWIG_Lua_class_equal);
    2268          24 :     lua_rawset(L, metatable_index);
    2269             :   } else {
    2270           8 :     lua_pop(L,1); /* remove copy of the key */
    2271             :   }
    2272             :   /* Warning: __index and __newindex are SWIG-defined. For user-defined operator[]
    2273             :    * a __getitem/__setitem method should be defined
    2274             :    */
    2275          32 :   lua_pop(L,1); /* pop class metatable */
    2276          32 : }
    2277             : 
    2278             : /* Register class static methods,attributes etc as well as constructor proxy */
    2279          32 : SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *clss)
    2280             : {
    2281          32 :   const int SWIGUNUSED begin = lua_gettop(L);
    2282          32 :   lua_checkstack(L,5); /* just in case */
    2283             :   assert(lua_istable(L,-1));  /* just in case */
    2284             :   assert(strcmp(clss->name, clss->cls_static->name) == 0); /* in class those 2 must be equal */
    2285             : 
    2286          32 :   SWIG_Lua_namespace_register(L,clss->cls_static, 1);
    2287             : 
    2288             :   assert(lua_istable(L,-1)); /* just in case */
    2289             : 
    2290             :   /*  add its constructor to module with the name of the class
    2291             :   so you can do MyClass(...) as well as new_MyClass(...)
    2292             :   BUT only if a constructor is defined
    2293             :   (this overcomes the problem of pure virtual classes without constructors)*/
    2294          32 :   if (clss->constructor)
    2295             :   {
    2296          32 :     lua_getmetatable(L,-1);
    2297             :     assert(lua_istable(L,-1)); /* just in case */
    2298          32 :     SWIG_Lua_add_function(L,"__call", clss->constructor);
    2299          32 :     lua_pop(L,1);
    2300             :   }
    2301             : 
    2302             :   assert(lua_istable(L,-1)); /* just in case */
    2303          32 :   SWIG_Lua_add_class_static_details(L, clss);
    2304             : 
    2305             :   /* clear stack */
    2306          32 :   lua_pop(L,1);
    2307             :   assert( lua_gettop(L) == begin );
    2308          32 : }
    2309             : 
    2310             : /* Performs the instance (non-static) class registration process. Metatable for class is created
    2311             :  * and added to the class registry.
    2312             :  */
    2313          32 : SWIGINTERN void  SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *clss)
    2314             : {
    2315          32 :   const int SWIGUNUSED begin = lua_gettop(L);
    2316             :   int i;
    2317             :   /* if name already there (class is already registered) then do nothing */
    2318          32 :   SWIG_Lua_get_class_registry(L);  /* get the registry */
    2319          32 :   lua_pushstring(L,clss->fqname);  /* get the name */
    2320          32 :   lua_rawget(L,-2);
    2321          32 :   if(!lua_isnil(L,-1)) {
    2322           0 :     lua_pop(L,2);
    2323             :     assert(lua_gettop(L)==begin);
    2324           0 :     return;
    2325             :   }
    2326          32 :   lua_pop(L,2); /* tidy stack */
    2327             :   /* Recursively initialize all bases */
    2328          32 :   for(i=0;clss->bases[i];i++)
    2329             :   {
    2330           0 :     SWIG_Lua_class_register_instance(L,clss->bases[i]);
    2331             :   }
    2332             :   /* Again, get registry and push name */
    2333          32 :   SWIG_Lua_get_class_registry(L);  /* get the registry */
    2334          32 :   lua_pushstring(L,clss->fqname);  /* get the name */
    2335          32 :   lua_newtable(L);    /* create the metatable */
    2336             : #if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
    2337             :   /* If squashing is requested, then merges all bases metatable into this one.
    2338             :    * It would get us all special methods: __getitem, __add etc.
    2339             :    * This would set .fn, .type, and other .xxx incorrectly, but we will overwrite it right away
    2340             :    */
    2341             :   {
    2342             :     int new_metatable_index = lua_absindex(L,-1);
    2343             :     for(i=0;clss->bases[i];i++)
    2344             :     {
    2345             :       int base_metatable;
    2346             :       SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
    2347             :       base_metatable = lua_absindex(L,-1);
    2348             :       SWIG_Lua_merge_tables_by_index(L,new_metatable_index, base_metatable);
    2349             :       lua_pop(L,1);
    2350             :     }
    2351             :   }
    2352             :   /* And now we will overwrite all incorrectly set data */
    2353             : #endif
    2354             :   /* add string of class name called ".type" */
    2355          32 :   lua_pushstring(L,".type");
    2356          32 :   lua_pushstring(L,clss->fqname);
    2357          32 :   lua_rawset(L,-3);
    2358             :   /* add a table called bases */
    2359          32 :   lua_pushstring(L,".bases");
    2360          32 :   lua_newtable(L);
    2361          32 :   lua_rawset(L,-3);
    2362             :   /* add a table called ".get" */
    2363          32 :   lua_pushstring(L,".get");
    2364          32 :   lua_newtable(L);
    2365          32 :   lua_rawset(L,-3);
    2366             :   /* add a table called ".set" */
    2367          32 :   lua_pushstring(L,".set");
    2368          32 :   lua_newtable(L);
    2369          32 :   lua_rawset(L,-3);
    2370             :   /* add a table called ".fn" */
    2371          32 :   lua_pushstring(L,".fn");
    2372          32 :   lua_newtable(L);
    2373             :   /* add manual disown method */
    2374          32 :   SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown);
    2375          32 :   lua_rawset(L,-3);
    2376             :   /* add accessor fns for using the .get,.set&.fn */
    2377          32 :   SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
    2378          32 :   SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
    2379          32 :   SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
    2380             :   /* add it */
    2381          32 :   lua_rawset(L,-3);  /* metatable into registry */
    2382          32 :   lua_pop(L,1);      /* tidy stack (remove registry) */
    2383             :   assert(lua_gettop(L) == begin);
    2384             : 
    2385             : #if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
    2386             :   /* Now merge all symbols from .fn, .set, .get etc from bases to our tables */
    2387             :   SWIG_Lua_class_squash_bases(L,clss);
    2388             : #endif
    2389          32 :   SWIG_Lua_get_class_metatable(L,clss->fqname);
    2390          32 :   SWIG_Lua_add_class_instance_details(L,clss);  /* recursive adding of details (atts & ops) */
    2391          32 :   lua_pop(L,1);      /* tidy stack (remove class metatable) */
    2392             :   assert( lua_gettop(L) == begin );
    2393             : }
    2394             : 
    2395          32 : SWIGINTERN void  SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss)
    2396             : {
    2397             :   int SWIGUNUSED begin;
    2398             :   assert(lua_istable(L,-1)); /* This is a table (module or namespace) where classes will be added */
    2399          32 :   SWIG_Lua_class_register_instance(L,clss);
    2400          32 :   SWIG_Lua_class_register_static(L,clss);
    2401             : 
    2402             :   /* Add links from static part to instance part and vice versa */
    2403             :   /* [SWIG registry]                                   [Module]
    2404             :    *    "MyClass" ----> [MyClass metatable] <=====     "MyClass" -+> [static part]
    2405             :    *                     ".get" ----> ...        |                |     getmetatable()----|
    2406             :    *                     ".set" ----> ...        |                |                       |
    2407             :    *                     ".static" --------------)----------------/           [static part metatable]
    2408             :    *                                             |                                ".get" --> ...
    2409             :    *                                             |                                ".set" --> ....
    2410             :    *                                             |=============================== ".instance"
    2411             :    */
    2412          32 :   begin = lua_gettop(L);
    2413          32 :   lua_pushstring(L,clss->cls_static->name);
    2414          32 :   lua_rawget(L,-2); /* get class static table */
    2415             :   assert(lua_istable(L,-1));
    2416          32 :   lua_getmetatable(L,-1);
    2417             :   assert(lua_istable(L,-1)); /* get class static metatable */
    2418          32 :   lua_pushstring(L,".instance"); /* prepare key */
    2419             : 
    2420          32 :   SWIG_Lua_get_class_metatable(L,clss->fqname); /* get class metatable */
    2421             :   assert(lua_istable(L,-1));
    2422          32 :   lua_pushstring(L,".static"); /* prepare key */
    2423          32 :   lua_pushvalue(L, -4); /* push static class TABLE */
    2424             :   assert(lua_istable(L,-1));
    2425          32 :   lua_rawset(L,-3); /* assign static class table(!NOT metatable) as ".static" member of class metatable */
    2426          32 :   lua_rawset(L,-3); /* assign class metatable as ".instance" member of class static METATABLE */
    2427          32 :   lua_pop(L,2);
    2428             :   assert(lua_gettop(L) == begin);
    2429          32 : }
    2430             : #endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
    2431             : 
    2432             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
    2433             : SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_class *clss)
    2434             : {
    2435             :   const int SWIGUNUSED begin = lua_gettop(L);
    2436             :   int i;
    2437             :   /* if name already there (class is already registered) then do nothing */
    2438             :   SWIG_Lua_get_class_registry(L);  /* get the registry */
    2439             :   lua_pushstring(L,clss->fqname);  /* get the name */
    2440             :   lua_rawget(L,-2);
    2441             :   if(!lua_isnil(L,-1)) {
    2442             :     lua_pop(L,2);
    2443             :     assert(lua_gettop(L)==begin);
    2444             :     return;
    2445             :   }
    2446             :   lua_pop(L,2); /* tidy stack */
    2447             :   /* Recursively initialize all bases */
    2448             :   for(i=0;clss->bases[i];i++)
    2449             :   {
    2450             :     SWIG_Lua_elua_class_register_instance(L,clss->bases[i]);
    2451             :   }
    2452             :   /* Again, get registry and push name */
    2453             :   SWIG_Lua_get_class_registry(L);  /* get the registry */
    2454             :   lua_pushstring(L,clss->fqname);  /* get the name */
    2455             :   assert(clss->metatable);
    2456             :   lua_pushrotable(L, (void*)(clss->metatable));    /* create the metatable */
    2457             :   lua_rawset(L,-3);
    2458             :   lua_pop(L,1);
    2459             :   assert(lua_gettop(L) == begin);
    2460             : }
    2461             : #endif /* elua && eluac */
    2462             : 
    2463             : /* -----------------------------------------------------------------------------
    2464             :  * Class/structure conversion fns
    2465             :  * ----------------------------------------------------------------------------- */
    2466             : 
    2467             : /* helper to add metatable to new lua object */
    2468         122 : SWIGINTERN void SWIG_Lua_AddMetatable(lua_State *L,swig_type_info *type)
    2469             : {
    2470         122 :   if (type->clientdata)  /* there is clientdata: so add the metatable */
    2471             :   {
    2472         120 :     SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->fqname);
    2473         120 :     if (lua_istable(L,-1))
    2474             :     {
    2475         120 :       lua_setmetatable(L,-2);
    2476             :     }
    2477             :     else
    2478             :     {
    2479           0 :       lua_pop(L,1);
    2480             :     }
    2481             :   }
    2482         122 : }
    2483             : 
    2484             : /* pushes a new object into the lua stack */
    2485         130 : SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own)
    2486             : {
    2487             :   swig_lua_userdata *usr;
    2488         130 :   if (!ptr){
    2489           8 :     lua_pushnil(L);
    2490           8 :     return;
    2491             :   }
    2492         122 :   usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata));  /* get data */
    2493         122 :   usr->ptr=ptr;  /* set the ptr */
    2494         122 :   usr->type=type;
    2495         122 :   usr->own=own;
    2496             : #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
    2497         122 :   SWIG_Lua_AddMetatable(L,type); /* add metatable */
    2498             : #endif
    2499             : }
    2500             : 
    2501             : /* takes a object from the lua stack & converts it into an object of the correct type
    2502             :  (if possible) */
    2503         271 : SWIGRUNTIME int  SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags)
    2504             : {
    2505             :   swig_lua_userdata *usr;
    2506             :   swig_cast_info *cast;
    2507         271 :   if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;}    /* special case: lua nil => NULL pointer */
    2508         255 :   usr=(swig_lua_userdata*)lua_touserdata(L,index);  /* get data */
    2509         255 :   if (usr)
    2510             :   {
    2511         255 :     if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
    2512             :     {
    2513           0 :         usr->own=0;
    2514             :     }
    2515         255 :     if (!type)            /* special cast void*, no casting fn */
    2516             :     {
    2517           7 :       *ptr=usr->ptr;
    2518           7 :       return SWIG_OK; /* ok */
    2519             :     }
    2520         248 :     cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
    2521         248 :     if (cast)
    2522             :     {
    2523         245 :       int newmemory = 0;
    2524         490 :       *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
    2525             :       assert(!newmemory); /* newmemory handling not yet implemented */
    2526             :       return SWIG_OK;  /* ok */
    2527             :     }
    2528             :   }
    2529             :   return SWIG_ERROR;  /* error */
    2530             : }
    2531             : 
    2532           7 : SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags,
    2533             :        int argnum,const char *func_name){
    2534             :   void *result;
    2535           7 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
    2536           0 :     luaL_error (L,"Error in %s, expected a %s at argument number %d\n",
    2537           0 :                 func_name,(type && type->str)?type->str:"void*",argnum);
    2538             :   }
    2539           7 :   return result;
    2540             : }
    2541             : 
    2542             : /* pushes a packed userdata. user for member fn pointers only */
    2543           0 : SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type)
    2544             : {
    2545             :   swig_lua_rawdata *raw;
    2546             :   assert(ptr); /* not acceptable to pass in a NULL value */
    2547           0 :   raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size);  /* alloc data */
    2548           0 :   raw->type=type;
    2549           0 :   raw->own=0;
    2550           0 :   memcpy(raw->data,ptr,size); /* copy the data */
    2551           0 :   SWIG_Lua_AddMetatable(L,type); /* add metatable */
    2552           0 : }
    2553             :     
    2554             : /* converts a packed userdata. user for member fn pointers only */
    2555             : SWIGRUNTIME int  SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type)
    2556             : {
    2557             :   swig_lua_rawdata *raw;
    2558             :   raw=(swig_lua_rawdata*)lua_touserdata(L,index);  /* get data */
    2559             :   if (!raw) return SWIG_ERROR;  /* error */
    2560             :   if (type==0 || type==raw->type) /* void* or identical type */
    2561             :   {
    2562             :     memcpy(ptr,raw->data,size); /* copy it */
    2563             :     return SWIG_OK; /* ok */
    2564             :   }
    2565             :   return SWIG_ERROR;  /* error */
    2566             : }
    2567             : 
    2568             : /* a function to get the typestring of a piece of data */
    2569          19 : SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
    2570             : {
    2571             :   swig_lua_userdata *usr;
    2572          19 :   if (lua_isuserdata(L,tp))
    2573             :   {
    2574          14 :     usr=(swig_lua_userdata*)lua_touserdata(L,tp);  /* get data */
    2575          14 :     if (usr && usr->type && usr->type->str)
    2576          14 :       return usr->type->str;
    2577             :     return "userdata (unknown type)";
    2578             :   }
    2579           5 :   return lua_typename(L,lua_type(L,tp));
    2580             : }
    2581             : 
    2582             : /* lua callable function to get the userdata's type */
    2583          19 : SWIGRUNTIME int SWIG_Lua_type(lua_State *L)
    2584             : {
    2585          19 :   lua_pushstring(L,SWIG_Lua_typename(L,1));
    2586          19 :   return 1;
    2587             : }
    2588             : 
    2589             : /* -----------------------------------------------------------------------------
    2590             :  * global variable support code: class/struct typemap functions
    2591             :  * ----------------------------------------------------------------------------- */
    2592             : 
    2593             : #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
    2594             : /* Install Constants */
    2595             : SWIGINTERN void
    2596          72 : SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
    2597             :   int i;
    2598         536 :   for (i = 0; constants[i].type; i++) {
    2599         464 :     switch(constants[i].type) {
    2600             :     case SWIG_LUA_INT:
    2601         416 :       lua_pushstring(L,constants[i].name);
    2602         416 :       lua_pushinteger(L,(lua_Number)constants[i].lvalue);
    2603         416 :       lua_rawset(L,-3);
    2604         416 :       break;
    2605             :     case SWIG_LUA_FLOAT:
    2606           0 :       lua_pushstring(L,constants[i].name);
    2607           0 :       lua_pushnumber(L,(lua_Number)constants[i].dvalue);
    2608           0 :       lua_rawset(L,-3);
    2609           0 :       break;
    2610             :     case SWIG_LUA_CHAR:
    2611           0 :       lua_pushstring(L,constants[i].name);
    2612             :       {
    2613           0 :         char c = constants[i].lvalue;
    2614           0 :         lua_pushlstring(L,&c,1);
    2615             :       }
    2616           0 :       lua_rawset(L,-3);
    2617           0 :       break;
    2618             :     case SWIG_LUA_STRING:
    2619          40 :       lua_pushstring(L,constants[i].name);
    2620          40 :       lua_pushstring(L,(char *) constants[i].pvalue);
    2621          40 :       lua_rawset(L,-3);
    2622          40 :       break;
    2623             :     case SWIG_LUA_POINTER:
    2624           8 :       lua_pushstring(L,constants[i].name);
    2625           8 :       SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
    2626           8 :       lua_rawset(L,-3);
    2627           8 :       break;
    2628             :     case SWIG_LUA_BINARY:
    2629           0 :       lua_pushstring(L,constants[i].name);
    2630           0 :       SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
    2631           0 :       lua_rawset(L,-3);
    2632           0 :       break;
    2633             :     default:
    2634             :       break;
    2635             :     }
    2636             :   }
    2637          72 : }
    2638             : #endif
    2639             : 
    2640             : /* -----------------------------------------------------------------------------
    2641             :  * executing lua code from within the wrapper
    2642             :  * ----------------------------------------------------------------------------- */
    2643             : 
    2644             : #ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
    2645             : #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
    2646             : #endif
    2647             : /* Executes a C string in Lua which is a really simple way of calling lua from C
    2648             : Unfortunately lua keeps changing its APIs, so we need a conditional compile
    2649             : In lua 5.0.X it's lua_dostring()
    2650             : In lua 5.1.X it's luaL_dostring()
    2651             : */
    2652             : SWIGINTERN int 
    2653           8 : SWIG_Lua_dostring(lua_State *L, const char *str) {
    2654             :   int ok,top;
    2655           8 :   if (str==0 || str[0]==0) return 0; /* nothing to do */
    2656           8 :   top=lua_gettop(L); /* save stack */
    2657             : #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
    2658           8 :   ok=luaL_dostring(L,str);      /* looks like this is lua 5.1.X or later, good */
    2659             : #else
    2660             :   ok=lua_dostring(L,str);       /* might be lua 5.0.x, using lua_dostring */
    2661             : #endif
    2662           8 :   if (ok!=0) {
    2663           0 :     SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
    2664             :   }
    2665           8 :   lua_settop(L,top); /* restore the stack */
    2666           8 :   return ok;
    2667             : }    
    2668             : 
    2669             : #ifdef __cplusplus
    2670             : }
    2671             : #endif
    2672             : 
    2673             : /* ------------------------------ end luarun.swg  ------------------------------ */
    2674             : 
    2675             : /*  Errors in SWIG */
    2676             : #define  SWIG_UnknownError         -1
    2677             : #define  SWIG_IOError              -2
    2678             : #define  SWIG_RuntimeError         -3
    2679             : #define  SWIG_IndexError           -4
    2680             : #define  SWIG_TypeError            -5
    2681             : #define  SWIG_DivisionByZero       -6
    2682             : #define  SWIG_OverflowError        -7
    2683             : #define  SWIG_SyntaxError          -8
    2684             : #define  SWIG_ValueError           -9
    2685             : #define  SWIG_SystemError          -10
    2686             : #define  SWIG_AttributeError       -11
    2687             : #define  SWIG_MemoryError          -12
    2688             : #define  SWIG_NullReferenceError   -13
    2689             : 
    2690             : 
    2691             : 
    2692             : 
    2693             : /* -------- TYPES TABLE (BEGIN) -------- */
    2694             : 
    2695             : #define SWIGTYPE_p__Key swig_types[0]
    2696             : #define SWIGTYPE_p__KeySet swig_types[1]
    2697             : #define SWIGTYPE_p_f___void swig_types[2]
    2698             : #define SWIGTYPE_p_f_p__KeySet_p__Key_p__Key_option_t__p__Key swig_types[3]
    2699             : #define SWIGTYPE_p_int swig_types[4]
    2700             : #define SWIGTYPE_p_kdb__KDB swig_types[5]
    2701             : #define SWIGTYPE_p_kdb__Key swig_types[6]
    2702             : #define SWIGTYPE_p_kdb__KeySet swig_types[7]
    2703             : #define SWIGTYPE_p_long_long swig_types[8]
    2704             : #define SWIGTYPE_p_option_t swig_types[9]
    2705             : #define SWIGTYPE_p_short swig_types[10]
    2706             : #define SWIGTYPE_p_signed_char swig_types[11]
    2707             : #define SWIGTYPE_p_std__string swig_types[12]
    2708             : #define SWIGTYPE_p_unsigned_char swig_types[13]
    2709             : #define SWIGTYPE_p_unsigned_int swig_types[14]
    2710             : #define SWIGTYPE_p_unsigned_long_long swig_types[15]
    2711             : #define SWIGTYPE_p_unsigned_short swig_types[16]
    2712             : #define SWIGTYPE_p_void swig_types[17]
    2713             : static swig_type_info *swig_types[19];
    2714             : static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
    2715             : #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
    2716             : #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
    2717             : 
    2718             : /* -------- TYPES TABLE (END) -------- */
    2719             : 
    2720             : #define SWIG_name      "kdb"
    2721             : #define SWIG_init      luaopen_kdb
    2722             : #define SWIG_init_user luaopen_kdb_user
    2723             : 
    2724             : #define SWIG_LUACODE   luaopen_kdb_luacode
    2725             : 
    2726             : namespace swig {
    2727             : typedef struct{} LANGUAGE_OBJ;
    2728             : }
    2729             : 
    2730             : 
    2731             : #include <stdio.h>
    2732             : 
    2733             : 
    2734             : #include <string>
    2735             : 
    2736             : 
    2737          45 : SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
    2738          45 :   int ret = lua_isstring(L, idx);
    2739          45 :   if (!ret)
    2740           0 :    ret = lua_isnil(L, idx);
    2741          45 :   return ret;
    2742             : }
    2743             : 
    2744             : 
    2745             : #include <stdint.h>               // Use the C99 official header
    2746             : 
    2747             : 
    2748             : #define SWIG_exception(a,b)\
    2749             : { lua_pushfstring(L,"%s:%s",#a,b);SWIG_fail; }
    2750             : 
    2751             : 
    2752             : #include <stdexcept>
    2753             : 
    2754             : 
    2755             :   extern "C" {
    2756             :     #include "kdbconfig.h"
    2757             :     #include "kdb.h"
    2758             :   }
    2759             : 
    2760             :   #include "keyexcept.hpp"
    2761             :   #include "kdbexcept.hpp"
    2762             :   #include "key.hpp"
    2763             :   #include "keyset.hpp"
    2764             :   #include "kdb.hpp"
    2765             :   using namespace kdb;
    2766             : 
    2767             : 
    2768             :   #define KEY_EXCEPTIONS \
    2769             :     KDB_CATCH_EX(kdb, KeyTypeMismatch) \
    2770             :     KDB_CATCH_EX(kdb, KeyInvalidName) \
    2771             :     KDB_CATCH_EX(kdb, KeyTypeConversion) \
    2772             :     KDB_CATCH_EX(kdb, KeyException) \
    2773             :     KDB_CATCH_EX(kdb, Exception)
    2774             : 
    2775             :   #define KDB_EXCEPTIONS \
    2776             :     KDB_CATCH_EX(kdb, KDBException) \
    2777             :     KDB_CATCH_EX(kdb, Exception)
    2778             : 
    2779             : 
    2780             :   #define KDB_CATCH_EX(namespace, exception) \
    2781             :     catch(const namespace::exception &e) \
    2782             :     { \
    2783             :       lua_pushfstring(L, "%s:%s", #namespace, e.what()); \
    2784             :       SWIG_fail; \
    2785             :     }
    2786             : 
    2787             : 
    2788             : #define kdb_Key_name_get(self_) *new std::string(self_->getName())
    2789             :   
    2790             : 
    2791             : #define kdb_Key_name_set(self_, val_) self_->setName(val_)
    2792             :     
    2793             : 
    2794             : #define kdb_Key_basename_get(self_) *new std::string(self_->getBaseName())
    2795             :   
    2796             : 
    2797             : #define kdb_Key_basename_set(self_, val_) self_->setBaseName(val_)
    2798             :     
    2799             : 
    2800             : #define kdb_Key_fullname_get(self_) *new std::string(self_->getFullName())
    2801             :   
    2802             : 
    2803             :   namespace myswig
    2804             :   {
    2805             :     /* simple class holding a STL forward iterator */
    2806             :     template<typename STLIterator,
    2807             :       typename Reference = typename std::iterator_traits<STLIterator>::reference >
    2808             :     class LuaSTLIterator_T
    2809             :     {
    2810             :     public:
    2811             :       typedef STLIterator iterator;
    2812             :       typedef Reference reference;
    2813             : 
    2814           4 :       LuaSTLIterator_T(iterator cur, iterator _begin, iterator _end)
    2815           4 :         : current(cur), begin(_begin), end(_end)
    2816             :       {}
    2817             : 
    2818             :       reference value()
    2819             :       {
    2820          32 :         return *current;
    2821             :       }
    2822             : 
    2823           4 :       reference next()
    2824             :       {
    2825           8 :         reference cur = value();
    2826           8 :         incr();
    2827           4 :         return cur;
    2828             :       }
    2829             : 
    2830             :       LuaSTLIterator_T *incr()
    2831             :       {
    2832          16 :         ++current;
    2833             :         return this;
    2834             :       }
    2835             : 
    2836             :       bool hasNext()
    2837             :       {
    2838          20 :         return (current != end);
    2839             :       }
    2840             : 
    2841             :     private:
    2842             :       iterator current;
    2843             :       iterator begin;
    2844             :       iterator end;
    2845             :     };
    2846             : 
    2847             :     template<typename STLIterator>
    2848             :     inline LuaSTLIterator_T<STLIterator> *
    2849           4 :     make_lua_iterator(const STLIterator& current, const STLIterator& begin,
    2850             :       const STLIterator& end)
    2851             :     {
    2852           8 :       return new LuaSTLIterator_T<STLIterator>(current, begin, end);
    2853             :     }
    2854             :   }
    2855             : 
    2856             : 
    2857             :   inline static void name_iterator_iter(lua_State *L,
    2858             :     myswig::LuaSTLIterator_T<kdb::Key::iterator>::reference val)
    2859             :   {
    2860          16 :     lua_pushlstring(L, val.data(), val.size());
    2861             :   }
    2862             : 
    2863             : 
    2864             :   namespace myswig {
    2865             :     template <class Type> struct LuaSTLIterator { };
    2866             :   }
    2867             : 
    2868             : 
    2869             :   namespace myswig {
    2870             :     template <>  struct LuaSTLIterator< myswig::LuaSTLIterator_T< kdb::Key::iterator > > {
    2871             :       typedef myswig::LuaSTLIterator_T< kdb::Key::iterator > luaiterator;
    2872             : 
    2873           2 :       static int gc(lua_State *L) {
    2874           2 :         luaiterator *iter = *(luaiterator **)lua_touserdata(L, 1);
    2875           2 :         delete iter;
    2876           2 :         return 0;
    2877             :       }
    2878             : 
    2879           5 :       static int iter(lua_State *L) {
    2880           5 :         luaiterator *iter = *(luaiterator **)lua_touserdata(L, lua_upvalueindex(1));
    2881           5 :         if (!iter->hasNext())
    2882             :           return 0;
    2883          12 :         name_iterator_iter(L, iter->value());
    2884           8 :         iter->next();
    2885           4 :         return 1;
    2886             :       }
    2887             :     };
    2888             :   }
    2889             : 
    2890             : 
    2891             :   namespace myswig {
    2892             :     template <>  struct LuaSTLIterator< myswig::LuaSTLIterator_T< kdb::Key::reverse_iterator > > {
    2893             :       typedef myswig::LuaSTLIterator_T< kdb::Key::reverse_iterator > luaiterator;
    2894             : 
    2895           2 :       static int gc(lua_State *L) {
    2896           2 :         luaiterator *iter = *(luaiterator **)lua_touserdata(L, 1);
    2897           2 :         delete iter;
    2898           2 :         return 0;
    2899             :       }
    2900             : 
    2901           5 :       static int iter(lua_State *L) {
    2902           5 :         luaiterator *iter = *(luaiterator **)lua_touserdata(L, lua_upvalueindex(1));
    2903           5 :         if (!iter->hasNext())
    2904             :           return 0;
    2905          12 :         name_iterator_iter(L, iter->value());
    2906           8 :         iter->next();
    2907           4 :         return 1;
    2908             :       }
    2909             :     };
    2910             :   }
    2911             : 
    2912             : 
    2913             :   /*
    2914             :    * returns string or binary value depending on the type of the key
    2915             :    */
    2916          10 :   static int _my_Key_getValue(lua_State* L)
    2917             :   {
    2918          10 :     lua_pushvalue(L, 1); /* push copy of self */
    2919          10 :     lua_getfield(L, -1, "isBinary");
    2920          10 :     lua_insert(L, -2);   /* insert function in the middle */
    2921          10 :     lua_call(L, 1, 1);
    2922          10 :     bool binary = lua_toboolean(L, -1);
    2923          10 :     lua_pop(L, 1);      /* remove result */
    2924          10 :     lua_getfield(L, -1, (binary) ? "binary" : "string");
    2925          10 :     return 1;
    2926             :   }
    2927             : 
    2928          45 : SWIGINTERN kdb::Key *new_kdb_Key__SWIG_3(char const *name,int flags=0){
    2929             :     return new kdb::Key(name,
    2930             :       KEY_FLAGS, flags,
    2931          45 :       KEY_END);
    2932             :   }
    2933             : SWIGINTERN bool kdb_Key_isNull__SWIG_1(kdb::Key *self){
    2934          31 :     return !bool(*self);
    2935             :   }
    2936             : SWIGINTERN std::string kdb_Key___tostring(kdb::Key *self){
    2937           2 :     return self->getName();
    2938             :   }
    2939           2 : SWIGINTERN myswig::LuaSTLIterator_T< kdb::Key::iterator > *kdb_Key_name_iterator(kdb::Key *self){
    2940           6 :     return myswig::make_lua_iterator(self->begin(), self->begin(), self->end());
    2941             :   }
    2942           2 : SWIGINTERN myswig::LuaSTLIterator_T< kdb::Key::reverse_iterator > *kdb_Key_reverse_name_iterator(kdb::Key *self){
    2943           6 :     return myswig::make_lua_iterator(self->rbegin(), self->rbegin(), self->rend());
    2944             :   }
    2945             : 
    2946           6 :   static int _my_KeySet_ipairs_it(lua_State *L)
    2947             :   {
    2948             :     const KeySet *ks;
    2949             :     lua_Integer i;
    2950             : 
    2951           6 :     if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **)&ks, SWIGTYPE_p_kdb__KeySet, 0)))
    2952           0 :       SWIG_fail_ptr("ipairs_it", 1, SWIGTYPE_p_kdb__KeySet);
    2953             : 
    2954           6 :     i = lua_tointeger(L, 2);
    2955           6 :     lua_pop(L, 2);
    2956          12 :     if (i == ks->size())
    2957             :       return 0;
    2958             : 
    2959           4 :     lua_pushnumber(L, i + 1);
    2960           4 :     SWIG_NewPointerObj(L, (void *)new kdb::Key(ks->at(i)), SWIGTYPE_p_kdb__Key, 1);
    2961             :     return 2;
    2962             : 
    2963             :   fail:
    2964           0 :     lua_error(L);
    2965             :     return 0;
    2966             :   }
    2967             : 
    2968             :   /* simple cursor variant: use the index param as cursor position */
    2969           2 :   static int _my_KeySet_ipairs(lua_State *L)
    2970             :   {
    2971           2 :     lua_pushcfunction(L, _my_KeySet_ipairs_it); /* callback function */
    2972           2 :     lua_pushvalue(L, 1);  /* param (copy of Key) */
    2973           2 :     lua_pushnumber(L, 0); /* start value (index param) */
    2974           2 :     return 3;
    2975             :   }
    2976             : 
    2977           9 : SWIGINTERN kdb::KeySet *new_kdb_KeySet__SWIG_3(size_t alloc){
    2978           9 :     return new kdb::KeySet(alloc, KS_END);
    2979             :   }
    2980             : SWIGINTERN size_t kdb_KeySet___len(kdb::KeySet *self,void *){
    2981           7 :     return self->size();
    2982             :   }
    2983             : #ifdef __cplusplus
    2984             : extern "C" {
    2985             : #endif
    2986           0 : static int _wrap_new_string__SWIG_0(lua_State* L) {
    2987           0 :   int SWIG_arg = 0;
    2988           0 :   std::string *result = 0 ;
    2989             :   
    2990           0 :   SWIG_check_num_args("std::string::string",0,0)
    2991           0 :   result = (std::string *)new std::string();
    2992           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_std__string,1); SWIG_arg++; 
    2993           0 :   return SWIG_arg;
    2994             :   
    2995             :   if(0) SWIG_fail;
    2996             :   
    2997             : fail:
    2998           0 :   lua_error(L);
    2999           0 :   return SWIG_arg;
    3000             : }
    3001             : 
    3002             : 
    3003           0 : static int _wrap_new_string__SWIG_1(lua_State* L) {
    3004           0 :   int SWIG_arg = 0;
    3005           0 :   char *arg1 = (char *) 0 ;
    3006           0 :   std::string *result = 0 ;
    3007             :   
    3008           0 :   SWIG_check_num_args("std::string::string",1,1)
    3009           0 :   if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("std::string::string",1,"char const *");
    3010           0 :   arg1 = (char *)lua_tostring(L, 1);
    3011           0 :   result = (std::string *)new std::string((char const *)arg1);
    3012           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_std__string,1); SWIG_arg++; 
    3013           0 :   return SWIG_arg;
    3014             :   
    3015             :   if(0) SWIG_fail;
    3016             :   
    3017             : fail:
    3018           0 :   lua_error(L);
    3019           0 :   return SWIG_arg;
    3020             : }
    3021             : 
    3022             : 
    3023           0 : static int _wrap_new_string(lua_State* L) {
    3024             :   int argc;
    3025             :   int argv[2]={
    3026             :     1,2
    3027           0 :   };
    3028             :   
    3029           0 :   argc = lua_gettop(L);
    3030           0 :   if (argc == 0) {
    3031           0 :     return _wrap_new_string__SWIG_0(L);
    3032             :   }
    3033           0 :   if (argc == 1) {
    3034           0 :     return _wrap_new_string__SWIG_1(L);
    3035             :   }
    3036             :   
    3037             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_string'\n"
    3038             :     "  Possible C/C++ prototypes are:\n"
    3039             :     "    std::string::string()\n"
    3040           0 :     "    std::string::string(char const *)\n");
    3041           0 :   lua_error(L);return 0;
    3042             : }
    3043             : 
    3044             : 
    3045           0 : static int _wrap_string_size(lua_State* L) {
    3046           0 :   int SWIG_arg = 0;
    3047           0 :   std::string *arg1 = (std::string *) 0 ;
    3048             :   unsigned int result;
    3049             :   
    3050           0 :   SWIG_check_num_args("std::string::size",1,1)
    3051           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::size",1,"std::string const *");
    3052             :   
    3053           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
    3054           0 :     SWIG_fail_ptr("string_size",1,SWIGTYPE_p_std__string);
    3055             :   }
    3056             :   
    3057           0 :   result = (unsigned int)((std::string const *)arg1)->size();
    3058           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    3059             :   return SWIG_arg;
    3060             :   
    3061             :   if(0) SWIG_fail;
    3062             :   
    3063             : fail:
    3064           0 :   lua_error(L);
    3065             :   return SWIG_arg;
    3066             : }
    3067             : 
    3068             : 
    3069           0 : static int _wrap_string_length(lua_State* L) {
    3070           0 :   int SWIG_arg = 0;
    3071           0 :   std::string *arg1 = (std::string *) 0 ;
    3072             :   unsigned int result;
    3073             :   
    3074           0 :   SWIG_check_num_args("std::string::length",1,1)
    3075           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::length",1,"std::string const *");
    3076             :   
    3077           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
    3078           0 :     SWIG_fail_ptr("string_length",1,SWIGTYPE_p_std__string);
    3079             :   }
    3080             :   
    3081           0 :   result = (unsigned int)((std::string const *)arg1)->length();
    3082           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    3083             :   return SWIG_arg;
    3084             :   
    3085             :   if(0) SWIG_fail;
    3086             :   
    3087             : fail:
    3088           0 :   lua_error(L);
    3089             :   return SWIG_arg;
    3090             : }
    3091             : 
    3092             : 
    3093           0 : static int _wrap_string_empty(lua_State* L) {
    3094           0 :   int SWIG_arg = 0;
    3095           0 :   std::string *arg1 = (std::string *) 0 ;
    3096             :   bool result;
    3097             :   
    3098           0 :   SWIG_check_num_args("std::string::empty",1,1)
    3099           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::empty",1,"std::string const *");
    3100             :   
    3101           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
    3102           0 :     SWIG_fail_ptr("string_empty",1,SWIGTYPE_p_std__string);
    3103             :   }
    3104             :   
    3105           0 :   result = (bool)((std::string const *)arg1)->empty();
    3106           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    3107             :   return SWIG_arg;
    3108             :   
    3109             :   if(0) SWIG_fail;
    3110             :   
    3111             : fail:
    3112           0 :   lua_error(L);
    3113             :   return SWIG_arg;
    3114             : }
    3115             : 
    3116             : 
    3117           0 : static int _wrap_string_c_str(lua_State* L) {
    3118           0 :   int SWIG_arg = 0;
    3119           0 :   std::string *arg1 = (std::string *) 0 ;
    3120           0 :   char *result = 0 ;
    3121             :   
    3122           0 :   SWIG_check_num_args("std::string::c_str",1,1)
    3123           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::c_str",1,"std::string const *");
    3124             :   
    3125           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
    3126           0 :     SWIG_fail_ptr("string_c_str",1,SWIGTYPE_p_std__string);
    3127             :   }
    3128             :   
    3129           0 :   result = (char *)((std::string const *)arg1)->c_str();
    3130           0 :   lua_pushstring(L,(const char *)result); SWIG_arg++;
    3131             :   return SWIG_arg;
    3132             :   
    3133             :   if(0) SWIG_fail;
    3134             :   
    3135             : fail:
    3136           0 :   lua_error(L);
    3137             :   return SWIG_arg;
    3138             : }
    3139             : 
    3140             : 
    3141           0 : static int _wrap_string_data(lua_State* L) {
    3142           0 :   int SWIG_arg = 0;
    3143           0 :   std::string *arg1 = (std::string *) 0 ;
    3144           0 :   char *result = 0 ;
    3145             :   
    3146           0 :   SWIG_check_num_args("std::string::data",1,1)
    3147           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::data",1,"std::string const *");
    3148             :   
    3149           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
    3150           0 :     SWIG_fail_ptr("string_data",1,SWIGTYPE_p_std__string);
    3151             :   }
    3152             :   
    3153           0 :   result = (char *)((std::string const *)arg1)->data();
    3154           0 :   lua_pushstring(L,(const char *)result); SWIG_arg++;
    3155             :   return SWIG_arg;
    3156             :   
    3157             :   if(0) SWIG_fail;
    3158             :   
    3159             : fail:
    3160           0 :   lua_error(L);
    3161             :   return SWIG_arg;
    3162             : }
    3163             : 
    3164             : 
    3165           0 : static int _wrap_string_assign(lua_State* L) {
    3166           0 :   int SWIG_arg = 0;
    3167           0 :   std::string *arg1 = (std::string *) 0 ;
    3168           0 :   char *arg2 = (char *) 0 ;
    3169             :   
    3170           0 :   SWIG_check_num_args("std::string::assign",2,2)
    3171           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("std::string::assign",1,"std::string *");
    3172           0 :   if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("std::string::assign",2,"char const *");
    3173             :   
    3174           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_std__string,0))){
    3175           0 :     SWIG_fail_ptr("string_assign",1,SWIGTYPE_p_std__string);
    3176             :   }
    3177             :   
    3178           0 :   arg2 = (char *)lua_tostring(L, 2);
    3179           0 :   (arg1)->assign((char const *)arg2);
    3180             :   
    3181             :   return SWIG_arg;
    3182             :   
    3183             :   if(0) SWIG_fail;
    3184             :   
    3185             : fail:
    3186           0 :   lua_error(L);
    3187             :   return SWIG_arg;
    3188             : }
    3189             : 
    3190             : 
    3191           0 : static void swig_delete_string(void *obj) {
    3192           0 : std::string *arg1 = (std::string *) obj;
    3193           0 : delete arg1;
    3194           0 : }
    3195           0 : static int _proxy__wrap_new_string(lua_State *L) {
    3196             :     assert(lua_istable(L,1));
    3197           0 :     lua_pushcfunction(L,_wrap_new_string);
    3198             :     assert(!lua_isnil(L,-1));
    3199           0 :     lua_replace(L,1); /* replace our table with real constructor */
    3200           0 :     lua_call(L,lua_gettop(L)-1,1);
    3201           0 :     return 1;
    3202             : }
    3203             : static swig_lua_attribute swig_string_attributes[] = {
    3204             :     {0,0,0}
    3205             : };
    3206             : static swig_lua_method swig_string_methods[]= {
    3207             :     { "size", _wrap_string_size},
    3208             :     { "length", _wrap_string_length},
    3209             :     { "empty", _wrap_string_empty},
    3210             :     { "c_str", _wrap_string_c_str},
    3211             :     { "data", _wrap_string_data},
    3212             :     { "assign", _wrap_string_assign},
    3213             :     {0,0}
    3214             : };
    3215             : static swig_lua_method swig_string_meta[] = {
    3216             :     {0,0}
    3217             : };
    3218             : 
    3219             : static swig_lua_attribute swig_string_Sf_SwigStatic_attributes[] = {
    3220             :     {0,0,0}
    3221             : };
    3222             : static swig_lua_const_info swig_string_Sf_SwigStatic_constants[]= {
    3223             :     {0,0,0,0,0,0}
    3224             : };
    3225             : static swig_lua_method swig_string_Sf_SwigStatic_methods[]= {
    3226             :     {0,0}
    3227             : };
    3228             : static swig_lua_class* swig_string_Sf_SwigStatic_classes[]= {
    3229             :     0
    3230             : };
    3231             : 
    3232             : static swig_lua_namespace swig_string_Sf_SwigStatic = {
    3233             :     "string",
    3234             :     swig_string_Sf_SwigStatic_methods,
    3235             :     swig_string_Sf_SwigStatic_attributes,
    3236             :     swig_string_Sf_SwigStatic_constants,
    3237             :     swig_string_Sf_SwigStatic_classes,
    3238             :     0
    3239             : };
    3240             : static swig_lua_class *swig_string_bases[] = {0};
    3241             : static const char *swig_string_base_names[] = {0};
    3242             : static swig_lua_class _wrap_class_string = { "string", "string", &SWIGTYPE_p_std__string,_proxy__wrap_new_string, swig_delete_string, swig_string_methods, swig_string_attributes, &swig_string_Sf_SwigStatic, swig_string_meta, swig_string_bases, swig_string_base_names };
    3243             : 
    3244             : 
    3245             :   /* adds a variable/property to a class */
    3246          24 :   void add_class_variable(lua_State *L, const char *classname,
    3247             :     const char *name, lua_CFunction getFn,lua_CFunction setFn)
    3248             :   {
    3249          24 :     SWIG_Lua_get_class_metatable(L, classname);
    3250             : 
    3251          24 :     SWIG_Lua_add_variable(L, name, getFn, setFn);
    3252             : 
    3253             : 
    3254             : 
    3255          24 :     lua_pop(L, 1);
    3256          24 :   }
    3257             : 
    3258             :   /* adds a method to a class */
    3259           8 :   void add_class_method(lua_State *L, const char *classname,
    3260             :     const char *method, lua_CFunction fn)
    3261             :   {
    3262           8 :     SWIG_Lua_get_class_metatable(L, classname);
    3263             : 
    3264           8 :     if (lua_istable(L,-1))
    3265             :     {
    3266           8 :       SWIG_Lua_get_table(L, ".fn");
    3267           8 :       SWIG_Lua_add_function(L, method, fn);
    3268           8 :       lua_pop(L, 1);
    3269             :     }
    3270           8 :     lua_pop(L, 1);
    3271           8 :   }
    3272             : 
    3273          12 : static int _wrap_new_Key__SWIG_0(lua_State* L) {
    3274          12 :   int SWIG_arg = 0;
    3275          12 :   kdb::Key *result = 0 ;
    3276             :   
    3277          12 :   SWIG_check_num_args("kdb::Key::Key",0,0)
    3278             :   {
    3279             :     try {
    3280          24 :       result = (kdb::Key *)new kdb::Key();    
    3281           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3282           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3283           0 :     }    catch (...) {
    3284           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::Key()");    
    3285             :     }
    3286             :   }
    3287          12 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__Key,1); SWIG_arg++; 
    3288          12 :   return SWIG_arg;
    3289             :   
    3290             :   if(0) SWIG_fail;
    3291             :   
    3292             : fail:
    3293           0 :   lua_error(L);
    3294           0 :   return SWIG_arg;
    3295             : }
    3296             : 
    3297             : 
    3298           1 : static int _wrap_new_Key__SWIG_1(lua_State* L) {
    3299           1 :   int SWIG_arg = 0;
    3300           1 :   ckdb::Key *arg1 = (ckdb::Key *) 0 ;
    3301           1 :   kdb::Key *result = 0 ;
    3302             :   
    3303           1 :   SWIG_check_num_args("kdb::Key::Key",1,1)
    3304           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::Key",1,"ckdb::Key *");
    3305             :   
    3306           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p__Key,0))){
    3307           0 :     SWIG_fail_ptr("new_Key",1,SWIGTYPE_p__Key);
    3308             :   }
    3309             :   
    3310             :   {
    3311             :     try {
    3312           2 :       result = (kdb::Key *)new kdb::Key(arg1);    
    3313           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3314           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3315           0 :     }    catch (...) {
    3316           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::Key(ckdb::Key *)");    
    3317             :     }
    3318             :   }
    3319           1 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__Key,1); SWIG_arg++; 
    3320             :   return SWIG_arg;
    3321             :   
    3322             :   if(0) SWIG_fail;
    3323             :   
    3324             : fail:
    3325           0 :   lua_error(L);
    3326             :   return SWIG_arg;
    3327             : }
    3328             : 
    3329             : 
    3330           2 : static int _wrap_new_Key__SWIG_2(lua_State* L) {
    3331           2 :   int SWIG_arg = 0;
    3332           2 :   kdb::Key *arg1 = 0 ;
    3333           2 :   kdb::Key *result = 0 ;
    3334             :   
    3335           2 :   SWIG_check_num_args("kdb::Key::Key",1,1)
    3336           2 :   if(!lua_isuserdata(L,1)) SWIG_fail_arg("kdb::Key::Key",1,"kdb::Key &");
    3337             :   
    3338           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3339           0 :     SWIG_fail_ptr("new_Key",1,SWIGTYPE_p_kdb__Key);
    3340             :   }
    3341             :   
    3342             :   {
    3343             :     try {
    3344           4 :       result = (kdb::Key *)new kdb::Key(*arg1);    
    3345           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3346           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3347           0 :     }    catch (...) {
    3348           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::Key(kdb::Key &)");    
    3349             :     }
    3350             :   }
    3351           2 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__Key,1); SWIG_arg++; 
    3352             :   return SWIG_arg;
    3353             :   
    3354             :   if(0) SWIG_fail;
    3355             :   
    3356             : fail:
    3357           0 :   lua_error(L);
    3358             :   return SWIG_arg;
    3359             : }
    3360             : 
    3361             : 
    3362           0 : static int _wrap_Key__incRef(lua_State* L) {
    3363           0 :   int SWIG_arg = 0;
    3364           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3365             :   
    3366           0 :   SWIG_check_num_args("kdb::Key::operator ++",1,1)
    3367           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::operator ++",1,"kdb::Key const *");
    3368             :   
    3369           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3370           0 :     SWIG_fail_ptr("Key__incRef",1,SWIGTYPE_p_kdb__Key);
    3371             :   }
    3372             :   
    3373             :   {
    3374             :     try {
    3375           0 :       ((kdb::Key const *)arg1)->operator ++();    
    3376           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3377           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3378           0 :     }    catch (...) {
    3379           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::operator ++() const");    
    3380             :     }
    3381             :   }
    3382             :   
    3383             :   return SWIG_arg;
    3384             :   
    3385             :   if(0) SWIG_fail;
    3386             :   
    3387             : fail:
    3388           0 :   lua_error(L);
    3389             :   return SWIG_arg;
    3390             : }
    3391             : 
    3392             : 
    3393           0 : static int _wrap_Key__decRef(lua_State* L) {
    3394           0 :   int SWIG_arg = 0;
    3395           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3396             :   
    3397           0 :   SWIG_check_num_args("kdb::Key::operator --",1,1)
    3398           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::operator --",1,"kdb::Key const *");
    3399             :   
    3400           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3401           0 :     SWIG_fail_ptr("Key__decRef",1,SWIGTYPE_p_kdb__Key);
    3402             :   }
    3403             :   
    3404             :   {
    3405             :     try {
    3406           0 :       ((kdb::Key const *)arg1)->operator --();    
    3407           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3408           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3409           0 :     }    catch (...) {
    3410           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::operator --() const");    
    3411             :     }
    3412             :   }
    3413             :   
    3414             :   return SWIG_arg;
    3415             :   
    3416             :   if(0) SWIG_fail;
    3417             :   
    3418             : fail:
    3419           0 :   lua_error(L);
    3420             :   return SWIG_arg;
    3421             : }
    3422             : 
    3423             : 
    3424           0 : static int _wrap_Key_getReferenceCounter(lua_State* L) {
    3425           0 :   int SWIG_arg = 0;
    3426           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3427             :   ssize_t result;
    3428             :   
    3429           0 :   SWIG_check_num_args("kdb::Key::getReferenceCounter",1,1)
    3430           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getReferenceCounter",1,"kdb::Key const *");
    3431             :   
    3432           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3433           0 :     SWIG_fail_ptr("Key_getReferenceCounter",1,SWIGTYPE_p_kdb__Key);
    3434             :   }
    3435             :   
    3436             :   {
    3437             :     try {
    3438           0 :       result = ((kdb::Key const *)arg1)->getReferenceCounter();    
    3439           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3440           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3441           0 :     }    catch (...) {
    3442           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getReferenceCounter() const");    
    3443             :     }
    3444             :   }
    3445           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    3446             :   return SWIG_arg;
    3447             :   
    3448             :   if(0) SWIG_fail;
    3449             :   
    3450             : fail:
    3451           0 :   lua_error(L);
    3452             :   return SWIG_arg;
    3453             : }
    3454             : 
    3455             : 
    3456           0 : static int _wrap_Key_copy(lua_State* L) {
    3457           0 :   int SWIG_arg = 0;
    3458           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3459           0 :   kdb::Key *arg2 = 0 ;
    3460             :   
    3461           0 :   SWIG_check_num_args("kdb::Key::copy",2,2)
    3462           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::copy",1,"kdb::Key *");
    3463           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::copy",2,"kdb::Key const &");
    3464             :   
    3465           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3466           0 :     SWIG_fail_ptr("Key_copy",1,SWIGTYPE_p_kdb__Key);
    3467             :   }
    3468             :   
    3469             :   
    3470           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    3471           0 :     SWIG_fail_ptr("Key_copy",2,SWIGTYPE_p_kdb__Key);
    3472             :   }
    3473             :   
    3474             :   {
    3475             :     try {
    3476           0 :       (arg1)->copy((kdb::Key const &)*arg2);    
    3477           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3478           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3479           0 :     }    catch (...) {
    3480           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::copy(kdb::Key const &)");    
    3481             :     }
    3482             :   }
    3483             :   
    3484             :   return SWIG_arg;
    3485             :   
    3486             :   if(0) SWIG_fail;
    3487             :   
    3488             : fail:
    3489           0 :   lua_error(L);
    3490             :   return SWIG_arg;
    3491             : }
    3492             : 
    3493             : 
    3494           0 : static int _wrap_Key_clear(lua_State* L) {
    3495           0 :   int SWIG_arg = 0;
    3496           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3497             :   
    3498           0 :   SWIG_check_num_args("kdb::Key::clear",1,1)
    3499           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::clear",1,"kdb::Key *");
    3500             :   
    3501           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3502           0 :     SWIG_fail_ptr("Key_clear",1,SWIGTYPE_p_kdb__Key);
    3503             :   }
    3504             :   
    3505             :   {
    3506             :     try {
    3507           0 :       (arg1)->clear();    
    3508           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3509           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3510           0 :     }    catch (...) {
    3511           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::clear()");    
    3512             :     }
    3513             :   }
    3514             :   
    3515             :   return SWIG_arg;
    3516             :   
    3517             :   if(0) SWIG_fail;
    3518             :   
    3519             : fail:
    3520           0 :   lua_error(L);
    3521             :   return SWIG_arg;
    3522             : }
    3523             : 
    3524             : 
    3525           0 : static int _wrap_Key_getKey(lua_State* L) {
    3526           0 :   int SWIG_arg = 0;
    3527           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3528           0 :   ckdb::Key *result = 0 ;
    3529             :   
    3530           0 :   SWIG_check_num_args("kdb::Key::getKey",1,1)
    3531           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getKey",1,"kdb::Key const *");
    3532             :   
    3533           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3534           0 :     SWIG_fail_ptr("Key_getKey",1,SWIGTYPE_p_kdb__Key);
    3535             :   }
    3536             :   
    3537             :   {
    3538             :     try {
    3539           0 :       result = (ckdb::Key *)((kdb::Key const *)arg1)->getKey();    
    3540             :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3541             :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3542             :     }    catch (...) {
    3543             :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getKey() const");    
    3544             :     }
    3545             :   }
    3546           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p__Key,0); SWIG_arg++; 
    3547             :   return SWIG_arg;
    3548             :   
    3549             :   if(0) SWIG_fail;
    3550             :   
    3551             : fail:
    3552           0 :   lua_error(L);
    3553             :   return SWIG_arg;
    3554             : }
    3555             : 
    3556             : 
    3557           0 : static int _wrap_Key___ref__(lua_State* L) {
    3558           0 :   int SWIG_arg = 0;
    3559           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3560           0 :   ckdb::Key *result = 0 ;
    3561             :   
    3562           0 :   SWIG_check_num_args("kdb::Key::operator *",1,1)
    3563           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::operator *",1,"kdb::Key const *");
    3564             :   
    3565           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3566           0 :     SWIG_fail_ptr("Key___ref__",1,SWIGTYPE_p_kdb__Key);
    3567             :   }
    3568             :   
    3569             :   {
    3570             :     try {
    3571           0 :       result = (ckdb::Key *)((kdb::Key const *)arg1)->operator *();    
    3572             :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3573             :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3574             :     }    catch (...) {
    3575             :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::operator *() const");    
    3576             :     }
    3577             :   }
    3578           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p__Key,0); SWIG_arg++; 
    3579             :   return SWIG_arg;
    3580             :   
    3581             :   if(0) SWIG_fail;
    3582             :   
    3583             : fail:
    3584           0 :   lua_error(L);
    3585             :   return SWIG_arg;
    3586             : }
    3587             : 
    3588             : 
    3589           0 : static int _wrap_Key_release(lua_State* L) {
    3590           0 :   int SWIG_arg = 0;
    3591           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3592           0 :   ckdb::Key *result = 0 ;
    3593             :   
    3594           0 :   SWIG_check_num_args("kdb::Key::release",1,1)
    3595           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::release",1,"kdb::Key *");
    3596             :   
    3597           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3598           0 :     SWIG_fail_ptr("Key_release",1,SWIGTYPE_p_kdb__Key);
    3599             :   }
    3600             :   
    3601             :   {
    3602             :     try {
    3603           0 :       result = (ckdb::Key *)(arg1)->release();    
    3604           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3605           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3606           0 :     }    catch (...) {
    3607           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::release()");    
    3608             :     }
    3609             :   }
    3610           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p__Key,0); SWIG_arg++; 
    3611             :   return SWIG_arg;
    3612             :   
    3613             :   if(0) SWIG_fail;
    3614             :   
    3615             : fail:
    3616           0 :   lua_error(L);
    3617             :   return SWIG_arg;
    3618             : }
    3619             : 
    3620             : 
    3621           1 : static int _wrap_Key_dup(lua_State* L) {
    3622           1 :   int SWIG_arg = 0;
    3623           1 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3624           1 :   ckdb::Key *result = 0 ;
    3625             :   
    3626           1 :   SWIG_check_num_args("kdb::Key::dup",1,1)
    3627           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::dup",1,"kdb::Key const *");
    3628             :   
    3629           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3630           0 :     SWIG_fail_ptr("Key_dup",1,SWIGTYPE_p_kdb__Key);
    3631             :   }
    3632             :   
    3633             :   {
    3634             :     try {
    3635           2 :       result = (ckdb::Key *)((kdb::Key const *)arg1)->dup();    
    3636           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3637           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3638           0 :     }    catch (...) {
    3639           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::dup() const");    
    3640             :     }
    3641             :   }
    3642           1 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p__Key,0); SWIG_arg++; 
    3643             :   return SWIG_arg;
    3644             :   
    3645             :   if(0) SWIG_fail;
    3646             :   
    3647             : fail:
    3648           0 :   lua_error(L);
    3649             :   return SWIG_arg;
    3650             : }
    3651             : 
    3652             : 
    3653           0 : static int _wrap_Key__getNameSize(lua_State* L) {
    3654           0 :   int SWIG_arg = 0;
    3655           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3656             :   ssize_t result;
    3657             :   
    3658           0 :   SWIG_check_num_args("kdb::Key::getNameSize",1,1)
    3659           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getNameSize",1,"kdb::Key const *");
    3660             :   
    3661           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3662           0 :     SWIG_fail_ptr("Key__getNameSize",1,SWIGTYPE_p_kdb__Key);
    3663             :   }
    3664             :   
    3665             :   {
    3666             :     try {
    3667           0 :       result = ((kdb::Key const *)arg1)->getNameSize();    
    3668           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3669           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3670           0 :     }    catch (...) {
    3671           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getNameSize() const");    
    3672             :     }
    3673             :   }
    3674           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    3675             :   return SWIG_arg;
    3676             :   
    3677             :   if(0) SWIG_fail;
    3678             :   
    3679             : fail:
    3680           0 :   lua_error(L);
    3681             :   return SWIG_arg;
    3682             : }
    3683             : 
    3684             : 
    3685           0 : static int _wrap_Key__getBaseNameSize(lua_State* L) {
    3686           0 :   int SWIG_arg = 0;
    3687           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3688             :   ssize_t result;
    3689             :   
    3690           0 :   SWIG_check_num_args("kdb::Key::getBaseNameSize",1,1)
    3691           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getBaseNameSize",1,"kdb::Key const *");
    3692             :   
    3693           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3694           0 :     SWIG_fail_ptr("Key__getBaseNameSize",1,SWIGTYPE_p_kdb__Key);
    3695             :   }
    3696             :   
    3697             :   {
    3698             :     try {
    3699           0 :       result = ((kdb::Key const *)arg1)->getBaseNameSize();    
    3700           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3701           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3702           0 :     }    catch (...) {
    3703           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getBaseNameSize() const");    
    3704             :     }
    3705             :   }
    3706           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    3707             :   return SWIG_arg;
    3708             :   
    3709             :   if(0) SWIG_fail;
    3710             :   
    3711             : fail:
    3712           0 :   lua_error(L);
    3713             :   return SWIG_arg;
    3714             : }
    3715             : 
    3716             : 
    3717           0 : static int _wrap_Key_addName(lua_State* L) {
    3718           0 :   int SWIG_arg = 0;
    3719           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3720           0 :   std::string *arg2 = 0 ;
    3721           0 :   std::string temp2 ;
    3722             :   
    3723           0 :   SWIG_check_num_args("kdb::Key::addName",2,2)
    3724           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::addName",1,"kdb::Key *");
    3725           0 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::addName",2,"std::string const &");
    3726             :   
    3727           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3728           0 :     SWIG_fail_ptr("Key_addName",1,SWIGTYPE_p_kdb__Key);
    3729             :   }
    3730             :   
    3731           0 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    3732             :   {
    3733             :     try {
    3734           0 :       (arg1)->addName((std::string const &)*arg2);    
    3735           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3736           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3737           0 :     }    catch (...) {
    3738           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::addName(std::string const &)");    
    3739             :     }
    3740             :   }
    3741             :   
    3742             :   return SWIG_arg;
    3743             :   
    3744             :   if(0) SWIG_fail;
    3745             :   
    3746             : fail:
    3747           0 :   lua_error(L);
    3748             :   return SWIG_arg;
    3749             : }
    3750             : 
    3751             : 
    3752           0 : static int _wrap_Key_addBaseName(lua_State* L) {
    3753           0 :   int SWIG_arg = 0;
    3754           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3755           0 :   std::string *arg2 = 0 ;
    3756           0 :   std::string temp2 ;
    3757             :   
    3758           0 :   SWIG_check_num_args("kdb::Key::addBaseName",2,2)
    3759           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::addBaseName",1,"kdb::Key *");
    3760           0 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::addBaseName",2,"std::string const &");
    3761             :   
    3762           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3763           0 :     SWIG_fail_ptr("Key_addBaseName",1,SWIGTYPE_p_kdb__Key);
    3764             :   }
    3765             :   
    3766           0 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    3767             :   {
    3768             :     try {
    3769           0 :       (arg1)->addBaseName((std::string const &)*arg2);    
    3770           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3771           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3772           0 :     }    catch (...) {
    3773           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::addBaseName(std::string const &)");    
    3774             :     }
    3775             :   }
    3776             :   
    3777             :   return SWIG_arg;
    3778             :   
    3779             :   if(0) SWIG_fail;
    3780             :   
    3781             : fail:
    3782           0 :   lua_error(L);
    3783             :   return SWIG_arg;
    3784             : }
    3785             : 
    3786             : 
    3787           0 : static int _wrap_Key_delBaseName(lua_State* L) {
    3788           0 :   int SWIG_arg = 0;
    3789           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3790             :   
    3791           0 :   SWIG_check_num_args("kdb::Key::delBaseName",1,1)
    3792           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::delBaseName",1,"kdb::Key *");
    3793             :   
    3794           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3795           0 :     SWIG_fail_ptr("Key_delBaseName",1,SWIGTYPE_p_kdb__Key);
    3796             :   }
    3797             :   
    3798             :   {
    3799             :     try {
    3800           0 :       (arg1)->delBaseName();    
    3801           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3802           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3803           0 :     }    catch (...) {
    3804           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::delBaseName()");    
    3805             :     }
    3806             :   }
    3807             :   
    3808             :   return SWIG_arg;
    3809             :   
    3810             :   if(0) SWIG_fail;
    3811             :   
    3812             : fail:
    3813           0 :   lua_error(L);
    3814             :   return SWIG_arg;
    3815             : }
    3816             : 
    3817             : 
    3818           0 : static int _wrap_Key__getFullNameSize(lua_State* L) {
    3819           0 :   int SWIG_arg = 0;
    3820           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3821             :   ssize_t result;
    3822             :   
    3823           0 :   SWIG_check_num_args("kdb::Key::getFullNameSize",1,1)
    3824           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getFullNameSize",1,"kdb::Key const *");
    3825             :   
    3826           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3827           0 :     SWIG_fail_ptr("Key__getFullNameSize",1,SWIGTYPE_p_kdb__Key);
    3828             :   }
    3829             :   
    3830             :   {
    3831             :     try {
    3832           0 :       result = ((kdb::Key const *)arg1)->getFullNameSize();    
    3833           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3834           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3835           0 :     }    catch (...) {
    3836           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getFullNameSize() const");    
    3837             :     }
    3838             :   }
    3839           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    3840             :   return SWIG_arg;
    3841             :   
    3842             :   if(0) SWIG_fail;
    3843             :   
    3844             : fail:
    3845           0 :   lua_error(L);
    3846             :   return SWIG_arg;
    3847             : }
    3848             : 
    3849             : 
    3850          17 : static int _wrap_Key___eq(lua_State* L) {
    3851          17 :   int SWIG_arg = 0;
    3852          17 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3853          17 :   kdb::Key *arg2 = 0 ;
    3854             :   bool result;
    3855             :   
    3856          17 :   SWIG_check_num_args("kdb::Key::operator ==",2,2)
    3857          17 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::operator ==",1,"kdb::Key const *");
    3858          17 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::operator ==",2,"kdb::Key const &");
    3859             :   
    3860          17 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3861           0 :     SWIG_fail_ptr("Key___eq",1,SWIGTYPE_p_kdb__Key);
    3862             :   }
    3863             :   
    3864             :   
    3865          17 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    3866           0 :     SWIG_fail_ptr("Key___eq",2,SWIGTYPE_p_kdb__Key);
    3867             :   }
    3868             :   
    3869             :   {
    3870             :     try {
    3871          34 :       result = (bool)((kdb::Key const *)arg1)->operator ==((kdb::Key const &)*arg2);    
    3872           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3873           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3874           0 :     }    catch (...) {
    3875           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::operator ==(kdb::Key const &) const");    
    3876             :     }
    3877             :   }
    3878          17 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    3879             :   return SWIG_arg;
    3880             :   
    3881             :   if(0) SWIG_fail;
    3882             :   
    3883             : fail:
    3884           0 :   lua_error(L);
    3885             :   return SWIG_arg;
    3886             : }
    3887             : 
    3888             : 
    3889           2 : static int _wrap_Key___lt(lua_State* L) {
    3890           2 :   int SWIG_arg = 0;
    3891           2 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3892           2 :   kdb::Key *arg2 = 0 ;
    3893             :   bool result;
    3894             :   
    3895           2 :   SWIG_check_num_args("kdb::Key::operator <",2,2)
    3896           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::operator <",1,"kdb::Key const *");
    3897           2 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::operator <",2,"kdb::Key const &");
    3898             :   
    3899           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3900           0 :     SWIG_fail_ptr("Key___lt",1,SWIGTYPE_p_kdb__Key);
    3901             :   }
    3902             :   
    3903             :   
    3904           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    3905           0 :     SWIG_fail_ptr("Key___lt",2,SWIGTYPE_p_kdb__Key);
    3906             :   }
    3907             :   
    3908             :   {
    3909             :     try {
    3910           4 :       result = (bool)((kdb::Key const *)arg1)->operator <((kdb::Key const &)*arg2);    
    3911           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3912           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3913           0 :     }    catch (...) {
    3914           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::operator <(kdb::Key const &) const");    
    3915             :     }
    3916             :   }
    3917           2 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    3918             :   return SWIG_arg;
    3919             :   
    3920             :   if(0) SWIG_fail;
    3921             :   
    3922             : fail:
    3923           0 :   lua_error(L);
    3924             :   return SWIG_arg;
    3925             : }
    3926             : 
    3927             : 
    3928           2 : static int _wrap_Key___le(lua_State* L) {
    3929           2 :   int SWIG_arg = 0;
    3930           2 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3931           2 :   kdb::Key *arg2 = 0 ;
    3932             :   bool result;
    3933             :   
    3934           2 :   SWIG_check_num_args("kdb::Key::operator <=",2,2)
    3935           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::operator <=",1,"kdb::Key const *");
    3936           2 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::operator <=",2,"kdb::Key const &");
    3937             :   
    3938           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3939           0 :     SWIG_fail_ptr("Key___le",1,SWIGTYPE_p_kdb__Key);
    3940             :   }
    3941             :   
    3942             :   
    3943           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    3944           0 :     SWIG_fail_ptr("Key___le",2,SWIGTYPE_p_kdb__Key);
    3945             :   }
    3946             :   
    3947             :   {
    3948             :     try {
    3949           4 :       result = (bool)((kdb::Key const *)arg1)->operator <=((kdb::Key const &)*arg2);    
    3950           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3951           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3952           0 :     }    catch (...) {
    3953           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::operator <=(kdb::Key const &) const");    
    3954             :     }
    3955             :   }
    3956           2 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    3957             :   return SWIG_arg;
    3958             :   
    3959             :   if(0) SWIG_fail;
    3960             :   
    3961             : fail:
    3962           0 :   lua_error(L);
    3963             :   return SWIG_arg;
    3964             : }
    3965             : 
    3966             : 
    3967             : static int _wrap_Key_isNull__SWIG_0(lua_State* L) {
    3968             :   int SWIG_arg = 0;
    3969             :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    3970             :   bool result;
    3971             :   
    3972             :   SWIG_check_num_args("kdb::Key::isNull",1,1)
    3973             :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isNull",1,"kdb::Key const *");
    3974             :   
    3975             :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    3976             :     SWIG_fail_ptr("Key_isNull",1,SWIGTYPE_p_kdb__Key);
    3977             :   }
    3978             :   
    3979             :   {
    3980             :     try {
    3981             :       result = (bool)((kdb::Key const *)arg1)->isNull();    
    3982             :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    3983             :       SWIG_exception(SWIG_RuntimeError, e.what());    
    3984             :     }    catch (...) {
    3985             :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isNull() const");    
    3986             :     }
    3987             :   }
    3988             :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    3989             :   return SWIG_arg;
    3990             :   
    3991             :   if(0) SWIG_fail;
    3992             :   
    3993             : fail:
    3994             :   lua_error(L);
    3995             :   return SWIG_arg;
    3996             : }
    3997             : 
    3998             : 
    3999           0 : static int _wrap_Key_needSync(lua_State* L) {
    4000           0 :   int SWIG_arg = 0;
    4001           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4002             :   bool result;
    4003             :   
    4004           0 :   SWIG_check_num_args("kdb::Key::needSync",1,1)
    4005           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::needSync",1,"kdb::Key const *");
    4006             :   
    4007           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4008           0 :     SWIG_fail_ptr("Key_needSync",1,SWIGTYPE_p_kdb__Key);
    4009             :   }
    4010             :   
    4011             :   {
    4012             :     try {
    4013           0 :       result = (bool)((kdb::Key const *)arg1)->needSync();    
    4014           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4015           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4016           0 :     }    catch (...) {
    4017           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::needSync() const");    
    4018             :     }
    4019             :   }
    4020           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4021             :   return SWIG_arg;
    4022             :   
    4023             :   if(0) SWIG_fail;
    4024             :   
    4025             : fail:
    4026           0 :   lua_error(L);
    4027             :   return SWIG_arg;
    4028             : }
    4029             : 
    4030             : 
    4031           8 : static int _wrap_Key__getString(lua_State* L) {
    4032           8 :   int SWIG_arg = 0;
    4033           8 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4034          16 :   std::string result;
    4035             :   
    4036           8 :   SWIG_check_num_args("kdb::Key::getString",1,1)
    4037           8 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getString",1,"kdb::Key const *");
    4038             :   
    4039           8 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4040           0 :     SWIG_fail_ptr("Key__getString",1,SWIGTYPE_p_kdb__Key);
    4041             :   }
    4042             :   
    4043             :   {
    4044             :     try {
    4045          16 :       result = ((kdb::Key const *)arg1)->getString();    
    4046           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4047           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4048           0 :     }    catch (...) {
    4049           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getString() const");    
    4050             :     }
    4051             :   }
    4052          16 :   lua_pushlstring(L,(&result)->data(),(&result)->size()); SWIG_arg++;
    4053             :   return SWIG_arg;
    4054             :   
    4055             :   if(0) SWIG_fail;
    4056             :   
    4057             : fail:
    4058           0 :   lua_error(L);
    4059             :   return SWIG_arg;
    4060             : }
    4061             : 
    4062             : 
    4063           4 : static int _wrap_Key__setString(lua_State* L) {
    4064           4 :   int SWIG_arg = 0;
    4065           4 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4066           8 :   std::string arg2 ;
    4067             :   
    4068           4 :   SWIG_check_num_args("kdb::Key::setString",2,2)
    4069           4 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::setString",1,"kdb::Key *");
    4070           4 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::setString",2,"std::string");
    4071             :   
    4072           4 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4073           0 :     SWIG_fail_ptr("Key__setString",1,SWIGTYPE_p_kdb__Key);
    4074             :   }
    4075             :   
    4076           8 :   (&arg2)->assign(lua_tostring(L,2),lua_rawlen(L,2));
    4077             :   {
    4078             :     try {
    4079          12 :       (arg1)->setString(arg2);    
    4080           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4081           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4082           0 :     }    catch (...) {
    4083           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::setString(std::string)");    
    4084             :     }
    4085             :   }
    4086             :   
    4087           4 :   return SWIG_arg;
    4088             :   
    4089             :   if(0) SWIG_fail;
    4090             :   
    4091             : fail:
    4092           0 :   lua_error(L);
    4093             :   return SWIG_arg;
    4094             : }
    4095             : 
    4096             : 
    4097           0 : static int _wrap_Key__getStringSize(lua_State* L) {
    4098           0 :   int SWIG_arg = 0;
    4099           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4100             :   ssize_t result;
    4101             :   
    4102           0 :   SWIG_check_num_args("kdb::Key::getStringSize",1,1)
    4103           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getStringSize",1,"kdb::Key const *");
    4104             :   
    4105           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4106           0 :     SWIG_fail_ptr("Key__getStringSize",1,SWIGTYPE_p_kdb__Key);
    4107             :   }
    4108             :   
    4109             :   {
    4110             :     try {
    4111           0 :       result = ((kdb::Key const *)arg1)->getStringSize();    
    4112           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4113           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4114           0 :     }    catch (...) {
    4115           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getStringSize() const");    
    4116             :     }
    4117             :   }
    4118           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    4119             :   return SWIG_arg;
    4120             :   
    4121             :   if(0) SWIG_fail;
    4122             :   
    4123             : fail:
    4124           0 :   lua_error(L);
    4125             :   return SWIG_arg;
    4126             : }
    4127             : 
    4128             : 
    4129           0 : static int _wrap_Key__getFunc(lua_State* L) {
    4130           0 :   int SWIG_arg = 0;
    4131           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4132             :   kdb::Key::func_t result;
    4133             :   
    4134           0 :   SWIG_check_num_args("kdb::Key::getFunc",1,1)
    4135           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getFunc",1,"kdb::Key const *");
    4136             :   
    4137           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4138           0 :     SWIG_fail_ptr("Key__getFunc",1,SWIGTYPE_p_kdb__Key);
    4139             :   }
    4140             :   
    4141             :   {
    4142             :     try {
    4143           0 :       result = (kdb::Key::func_t)((kdb::Key const *)arg1)->getFunc();    
    4144           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4145           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4146           0 :     }    catch (...) {
    4147           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getFunc() const");    
    4148             :     }
    4149             :   }
    4150           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_f___void,0); SWIG_arg++; 
    4151             :   return SWIG_arg;
    4152             :   
    4153             :   if(0) SWIG_fail;
    4154             :   
    4155             : fail:
    4156           0 :   lua_error(L);
    4157             :   return SWIG_arg;
    4158             : }
    4159             : 
    4160             : 
    4161           0 : static int _wrap_Key_setCallback(lua_State* L) {
    4162           0 :   int SWIG_arg = 0;
    4163           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4164           0 :   kdb::Key::callback_t arg2 = (kdb::Key::callback_t) 0 ;
    4165             :   
    4166           0 :   SWIG_check_num_args("kdb::Key::setCallback",2,2)
    4167           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::setCallback",1,"kdb::Key *");
    4168           0 :   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("kdb::Key::setCallback",2,"kdb::Key::callback_t");
    4169             :   
    4170           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4171           0 :     SWIG_fail_ptr("Key_setCallback",1,SWIGTYPE_p_kdb__Key);
    4172             :   }
    4173             :   
    4174             :   
    4175           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_f_p__KeySet_p__Key_p__Key_option_t__p__Key,0))){
    4176           0 :     SWIG_fail_ptr("Key_setCallback",2,SWIGTYPE_p_f_p__KeySet_p__Key_p__Key_option_t__p__Key);
    4177             :   }
    4178             :   
    4179             :   {
    4180             :     try {
    4181           0 :       (arg1)->setCallback(arg2);    
    4182           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4183           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4184           0 :     }    catch (...) {
    4185           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::setCallback(kdb::Key::callback_t)");    
    4186             :     }
    4187             :   }
    4188             :   
    4189             :   return SWIG_arg;
    4190             :   
    4191             :   if(0) SWIG_fail;
    4192             :   
    4193             : fail:
    4194           0 :   lua_error(L);
    4195             :   return SWIG_arg;
    4196             : }
    4197             : 
    4198             : 
    4199           0 : static int _wrap_Key__getValue(lua_State* L) {
    4200           0 :   int SWIG_arg = 0;
    4201           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4202           0 :   void *result = 0 ;
    4203             :   
    4204           0 :   SWIG_check_num_args("kdb::Key::getValue",1,1)
    4205           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getValue",1,"kdb::Key const *");
    4206             :   
    4207           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4208           0 :     SWIG_fail_ptr("Key__getValue",1,SWIGTYPE_p_kdb__Key);
    4209             :   }
    4210             :   
    4211             :   {
    4212             :     try {
    4213           0 :       result = (void *)((kdb::Key const *)arg1)->getValue();    
    4214           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4215           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4216           0 :     }    catch (...) {
    4217           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getValue() const");    
    4218             :     }
    4219             :   }
    4220             :   {
    4221           0 :     ssize_t size = arg1->getBinarySize();
    4222           0 :     lua_pushlstring(L, (const char *)result, (size > 0) ? size : 0);
    4223             :     SWIG_arg++;
    4224             :   }
    4225             :   return SWIG_arg;
    4226             :   
    4227             :   if(0) SWIG_fail;
    4228             :   
    4229             : fail:
    4230           0 :   lua_error(L);
    4231             :   return SWIG_arg;
    4232             : }
    4233             : 
    4234             : 
    4235           5 : static int _wrap_Key__getBinary(lua_State* L) {
    4236           5 :   int SWIG_arg = 0;
    4237           5 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4238          10 :   std::string result;
    4239             :   
    4240           5 :   SWIG_check_num_args("kdb::Key::getBinary",1,1)
    4241           5 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getBinary",1,"kdb::Key const *");
    4242             :   
    4243           5 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4244           0 :     SWIG_fail_ptr("Key__getBinary",1,SWIGTYPE_p_kdb__Key);
    4245             :   }
    4246             :   
    4247             :   {
    4248             :     try {
    4249          10 :       result = ((kdb::Key const *)arg1)->getBinary();    
    4250           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4251           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4252           0 :     }    catch (...) {
    4253           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getBinary() const");    
    4254             :     }
    4255             :   }
    4256             :   {
    4257          10 :     lua_pushlstring(L, (&result)->data(), (&result)->size());
    4258             :     SWIG_arg++;
    4259             :   }
    4260             :   return SWIG_arg;
    4261             :   
    4262             :   if(0) SWIG_fail;
    4263             :   
    4264             : fail:
    4265           0 :   lua_error(L);
    4266             :   return SWIG_arg;
    4267             : }
    4268             : 
    4269             : 
    4270           0 : static int _wrap_Key__getBinarySize(lua_State* L) {
    4271           0 :   int SWIG_arg = 0;
    4272           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4273             :   ssize_t result;
    4274             :   
    4275           0 :   SWIG_check_num_args("kdb::Key::getBinarySize",1,1)
    4276           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getBinarySize",1,"kdb::Key const *");
    4277             :   
    4278           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4279           0 :     SWIG_fail_ptr("Key__getBinarySize",1,SWIGTYPE_p_kdb__Key);
    4280             :   }
    4281             :   
    4282             :   {
    4283             :     try {
    4284           0 :       result = ((kdb::Key const *)arg1)->getBinarySize();    
    4285           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4286           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4287           0 :     }    catch (...) {
    4288           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getBinarySize() const");    
    4289             :     }
    4290             :   }
    4291           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    4292             :   return SWIG_arg;
    4293             :   
    4294             :   if(0) SWIG_fail;
    4295             :   
    4296             : fail:
    4297           0 :   lua_error(L);
    4298             :   return SWIG_arg;
    4299             : }
    4300             : 
    4301             : 
    4302           3 : static int _wrap_Key__setBinary(lua_State* L) {
    4303           3 :   int SWIG_arg = 0;
    4304           3 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4305           3 :   void *arg2 = (void *) 0 ;
    4306             :   size_t arg3 ;
    4307             :   ssize_t result;
    4308             :   
    4309           3 :   SWIG_check_num_args("kdb::Key::setBinary",2,2)
    4310           3 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::setBinary",1,"kdb::Key *");
    4311           3 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::setBinary",2,"void const *");
    4312             :   
    4313           3 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4314           0 :     SWIG_fail_ptr("Key__setBinary",1,SWIGTYPE_p_kdb__Key);
    4315             :   }
    4316             :   
    4317             :   {
    4318           3 :     arg3 = lua_rawlen(L, 2);
    4319           3 :     arg2 = const_cast<char *>(lua_tostring(L, 2));
    4320             :   }
    4321             :   {
    4322             :     try {
    4323           6 :       result = (arg1)->setBinary((void const *)arg2,arg3);    
    4324           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4325           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4326           0 :     }    catch (...) {
    4327           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::setBinary(void const *,size_t)");    
    4328             :     }
    4329             :   }
    4330           3 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    4331             :   return SWIG_arg;
    4332             :   
    4333             :   if(0) SWIG_fail;
    4334             :   
    4335             : fail:
    4336           0 :   lua_error(L);
    4337             :   return SWIG_arg;
    4338             : }
    4339             : 
    4340             : 
    4341           1 : static int _wrap_Key_hasMeta(lua_State* L) {
    4342           1 :   int SWIG_arg = 0;
    4343           1 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4344           1 :   std::string *arg2 = 0 ;
    4345           2 :   std::string temp2 ;
    4346             :   bool result;
    4347             :   
    4348           1 :   SWIG_check_num_args("kdb::Key::hasMeta",2,2)
    4349           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::hasMeta",1,"kdb::Key const *");
    4350           1 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::hasMeta",2,"std::string const &");
    4351             :   
    4352           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4353           0 :     SWIG_fail_ptr("Key_hasMeta",1,SWIGTYPE_p_kdb__Key);
    4354             :   }
    4355             :   
    4356           2 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    4357             :   {
    4358             :     try {
    4359           1 :       result = (bool)((kdb::Key const *)arg1)->hasMeta((std::string const &)*arg2);    
    4360           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4361           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4362           0 :     }    catch (...) {
    4363           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::hasMeta(std::string const &) const");    
    4364             :     }
    4365             :   }
    4366           1 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4367             :   return SWIG_arg;
    4368             :   
    4369             :   if(0) SWIG_fail;
    4370             :   
    4371             : fail:
    4372           0 :   lua_error(L);
    4373             :   return SWIG_arg;
    4374             : }
    4375             : 
    4376             : 
    4377           0 : static int _wrap_Key_delMeta(lua_State* L) {
    4378           0 :   int SWIG_arg = 0;
    4379           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4380           0 :   std::string *arg2 = 0 ;
    4381           0 :   std::string temp2 ;
    4382             :   
    4383           0 :   SWIG_check_num_args("kdb::Key::delMeta",2,2)
    4384           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::delMeta",1,"kdb::Key *");
    4385           0 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::delMeta",2,"std::string const &");
    4386             :   
    4387           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4388           0 :     SWIG_fail_ptr("Key_delMeta",1,SWIGTYPE_p_kdb__Key);
    4389             :   }
    4390             :   
    4391           0 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    4392             :   {
    4393             :     try {
    4394           0 :       (arg1)->delMeta((std::string const &)*arg2);    
    4395           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4396           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4397           0 :     }    catch (...) {
    4398           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::delMeta(std::string const &)");    
    4399             :     }
    4400             :   }
    4401             :   
    4402             :   return SWIG_arg;
    4403             :   
    4404             :   if(0) SWIG_fail;
    4405             :   
    4406             : fail:
    4407           0 :   lua_error(L);
    4408             :   return SWIG_arg;
    4409             : }
    4410             : 
    4411             : 
    4412           0 : static int _wrap_Key_copyMeta(lua_State* L) {
    4413           0 :   int SWIG_arg = 0;
    4414           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4415           0 :   kdb::Key *arg2 = 0 ;
    4416           0 :   std::string *arg3 = 0 ;
    4417           0 :   std::string temp3 ;
    4418             :   
    4419           0 :   SWIG_check_num_args("kdb::Key::copyMeta",3,3)
    4420           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::copyMeta",1,"kdb::Key *");
    4421           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::copyMeta",2,"kdb::Key const &");
    4422           0 :   if(!lua_isstring(L,3)) SWIG_fail_arg("kdb::Key::copyMeta",3,"std::string const &");
    4423             :   
    4424           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4425           0 :     SWIG_fail_ptr("Key_copyMeta",1,SWIGTYPE_p_kdb__Key);
    4426             :   }
    4427             :   
    4428             :   
    4429           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    4430           0 :     SWIG_fail_ptr("Key_copyMeta",2,SWIGTYPE_p_kdb__Key);
    4431             :   }
    4432             :   
    4433           0 :   temp3.assign(lua_tostring(L,3),lua_rawlen(L,3)); arg3=&temp3;
    4434             :   {
    4435             :     try {
    4436           0 :       (arg1)->copyMeta((kdb::Key const &)*arg2,(std::string const &)*arg3);    
    4437           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4438           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4439           0 :     }    catch (...) {
    4440           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::copyMeta(kdb::Key const &,std::string const &)");    
    4441             :     }
    4442             :   }
    4443             :   
    4444             :   return SWIG_arg;
    4445             :   
    4446             :   if(0) SWIG_fail;
    4447             :   
    4448             : fail:
    4449           0 :   lua_error(L);
    4450             :   return SWIG_arg;
    4451             : }
    4452             : 
    4453             : 
    4454           0 : static int _wrap_Key_copyAllMeta(lua_State* L) {
    4455           0 :   int SWIG_arg = 0;
    4456           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4457           0 :   kdb::Key *arg2 = 0 ;
    4458             :   
    4459           0 :   SWIG_check_num_args("kdb::Key::copyAllMeta",2,2)
    4460           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::copyAllMeta",1,"kdb::Key *");
    4461           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::copyAllMeta",2,"kdb::Key const &");
    4462             :   
    4463           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4464           0 :     SWIG_fail_ptr("Key_copyAllMeta",1,SWIGTYPE_p_kdb__Key);
    4465             :   }
    4466             :   
    4467             :   
    4468           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    4469           0 :     SWIG_fail_ptr("Key_copyAllMeta",2,SWIGTYPE_p_kdb__Key);
    4470             :   }
    4471             :   
    4472             :   {
    4473             :     try {
    4474           0 :       (arg1)->copyAllMeta((kdb::Key const &)*arg2);    
    4475           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4476           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4477           0 :     }    catch (...) {
    4478           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::copyAllMeta(kdb::Key const &)");    
    4479             :     }
    4480             :   }
    4481             :   
    4482             :   return SWIG_arg;
    4483             :   
    4484             :   if(0) SWIG_fail;
    4485             :   
    4486             : fail:
    4487           0 :   lua_error(L);
    4488             :   return SWIG_arg;
    4489             : }
    4490             : 
    4491             : 
    4492           2 : static int _wrap_Key__rewindMeta(lua_State* L) {
    4493           2 :   int SWIG_arg = 0;
    4494           2 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4495             :   
    4496           2 :   SWIG_check_num_args("kdb::Key::rewindMeta",1,1)
    4497           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::rewindMeta",1,"kdb::Key *");
    4498             :   
    4499           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4500           0 :     SWIG_fail_ptr("Key__rewindMeta",1,SWIGTYPE_p_kdb__Key);
    4501             :   }
    4502             :   
    4503             :   {
    4504             :     try {
    4505           2 :       (arg1)->rewindMeta();    
    4506           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4507           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4508           0 :     }    catch (...) {
    4509           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::rewindMeta()");    
    4510             :     }
    4511             :   }
    4512             :   
    4513             :   return SWIG_arg;
    4514             :   
    4515             :   if(0) SWIG_fail;
    4516             :   
    4517             : fail:
    4518           0 :   lua_error(L);
    4519             :   return SWIG_arg;
    4520             : }
    4521             : 
    4522             : 
    4523           5 : static int _wrap_Key__nextMeta(lua_State* L) {
    4524           5 :   int SWIG_arg = 0;
    4525           5 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4526          10 :   kdb::Key result;
    4527             :   
    4528           5 :   SWIG_check_num_args("kdb::Key::nextMeta",1,1)
    4529           5 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::nextMeta",1,"kdb::Key *");
    4530             :   
    4531           5 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4532           0 :     SWIG_fail_ptr("Key__nextMeta",1,SWIGTYPE_p_kdb__Key);
    4533             :   }
    4534             :   
    4535             :   {
    4536             :     try {
    4537          20 :       result = (arg1)->nextMeta();    
    4538           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4539           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4540           0 :     }    catch (...) {
    4541           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::nextMeta()");    
    4542             :     }
    4543             :   }
    4544             :   {
    4545          10 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    4546           5 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    4547             :   }
    4548             :   return SWIG_arg;
    4549             :   
    4550             :   if(0) SWIG_fail;
    4551             :   
    4552             : fail:
    4553           0 :   lua_error(L);
    4554             :   return SWIG_arg;
    4555             : }
    4556             : 
    4557             : 
    4558           0 : static int _wrap_Key__currentMeta(lua_State* L) {
    4559           0 :   int SWIG_arg = 0;
    4560           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4561           0 :   kdb::Key result;
    4562             :   
    4563           0 :   SWIG_check_num_args("kdb::Key::currentMeta",1,1)
    4564           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::currentMeta",1,"kdb::Key const *");
    4565             :   
    4566           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4567           0 :     SWIG_fail_ptr("Key__currentMeta",1,SWIGTYPE_p_kdb__Key);
    4568             :   }
    4569             :   
    4570             :   {
    4571             :     try {
    4572           0 :       result = ((kdb::Key const *)arg1)->currentMeta();    
    4573           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4574           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4575           0 :     }    catch (...) {
    4576           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::currentMeta() const");    
    4577             :     }
    4578             :   }
    4579             :   {
    4580           0 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    4581           0 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    4582             :   }
    4583             :   return SWIG_arg;
    4584             :   
    4585             :   if(0) SWIG_fail;
    4586             :   
    4587             : fail:
    4588           0 :   lua_error(L);
    4589             :   return SWIG_arg;
    4590             : }
    4591             : 
    4592             : 
    4593           4 : static int _wrap_Key_isValid(lua_State* L) {
    4594           4 :   int SWIG_arg = 0;
    4595           4 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4596             :   bool result;
    4597             :   
    4598           4 :   SWIG_check_num_args("kdb::Key::isValid",1,1)
    4599           4 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isValid",1,"kdb::Key const *");
    4600             :   
    4601           4 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4602           0 :     SWIG_fail_ptr("Key_isValid",1,SWIGTYPE_p_kdb__Key);
    4603             :   }
    4604             :   
    4605             :   {
    4606             :     try {
    4607           8 :       result = (bool)((kdb::Key const *)arg1)->isValid();    
    4608           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4609           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4610           0 :     }    catch (...) {
    4611           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isValid() const");    
    4612             :     }
    4613             :   }
    4614           4 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4615             :   return SWIG_arg;
    4616             :   
    4617             :   if(0) SWIG_fail;
    4618             :   
    4619             : fail:
    4620           0 :   lua_error(L);
    4621             :   return SWIG_arg;
    4622             : }
    4623             : 
    4624             : 
    4625           0 : static int _wrap_Key_getNamespace(lua_State* L) {
    4626           0 :   int SWIG_arg = 0;
    4627           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4628           0 :   std::string result;
    4629             :   
    4630           0 :   SWIG_check_num_args("kdb::Key::getNamespace",1,1)
    4631           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getNamespace",1,"kdb::Key const *");
    4632             :   
    4633           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4634           0 :     SWIG_fail_ptr("Key_getNamespace",1,SWIGTYPE_p_kdb__Key);
    4635             :   }
    4636             :   
    4637             :   {
    4638             :     try {
    4639           0 :       result = ((kdb::Key const *)arg1)->getNamespace();    
    4640           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4641           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4642           0 :     }    catch (...) {
    4643           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getNamespace() const");    
    4644             :     }
    4645             :   }
    4646           0 :   lua_pushlstring(L,(&result)->data(),(&result)->size()); SWIG_arg++;
    4647             :   return SWIG_arg;
    4648             :   
    4649             :   if(0) SWIG_fail;
    4650             :   
    4651             : fail:
    4652           0 :   lua_error(L);
    4653             :   return SWIG_arg;
    4654             : }
    4655             : 
    4656             : 
    4657           0 : static int _wrap_Key_isCascading(lua_State* L) {
    4658           0 :   int SWIG_arg = 0;
    4659           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4660             :   bool result;
    4661             :   
    4662           0 :   SWIG_check_num_args("kdb::Key::isCascading",1,1)
    4663           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isCascading",1,"kdb::Key const *");
    4664             :   
    4665           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4666           0 :     SWIG_fail_ptr("Key_isCascading",1,SWIGTYPE_p_kdb__Key);
    4667             :   }
    4668             :   
    4669             :   {
    4670             :     try {
    4671           0 :       result = (bool)((kdb::Key const *)arg1)->isCascading();    
    4672           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4673           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4674           0 :     }    catch (...) {
    4675           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isCascading() const");    
    4676             :     }
    4677             :   }
    4678           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4679             :   return SWIG_arg;
    4680             :   
    4681             :   if(0) SWIG_fail;
    4682             :   
    4683             : fail:
    4684           0 :   lua_error(L);
    4685             :   return SWIG_arg;
    4686             : }
    4687             : 
    4688             : 
    4689           0 : static int _wrap_Key_isSpec(lua_State* L) {
    4690           0 :   int SWIG_arg = 0;
    4691           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4692             :   bool result;
    4693             :   
    4694           0 :   SWIG_check_num_args("kdb::Key::isSpec",1,1)
    4695           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isSpec",1,"kdb::Key const *");
    4696             :   
    4697           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4698           0 :     SWIG_fail_ptr("Key_isSpec",1,SWIGTYPE_p_kdb__Key);
    4699             :   }
    4700             :   
    4701             :   {
    4702             :     try {
    4703           0 :       result = (bool)((kdb::Key const *)arg1)->isSpec();    
    4704           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4705           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4706           0 :     }    catch (...) {
    4707           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isSpec() const");    
    4708             :     }
    4709             :   }
    4710           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4711             :   return SWIG_arg;
    4712             :   
    4713             :   if(0) SWIG_fail;
    4714             :   
    4715             : fail:
    4716           0 :   lua_error(L);
    4717             :   return SWIG_arg;
    4718             : }
    4719             : 
    4720             : 
    4721           0 : static int _wrap_Key_isProc(lua_State* L) {
    4722           0 :   int SWIG_arg = 0;
    4723           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4724             :   bool result;
    4725             :   
    4726           0 :   SWIG_check_num_args("kdb::Key::isProc",1,1)
    4727           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isProc",1,"kdb::Key const *");
    4728             :   
    4729           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4730           0 :     SWIG_fail_ptr("Key_isProc",1,SWIGTYPE_p_kdb__Key);
    4731             :   }
    4732             :   
    4733             :   {
    4734             :     try {
    4735           0 :       result = (bool)((kdb::Key const *)arg1)->isProc();    
    4736           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4737           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4738           0 :     }    catch (...) {
    4739           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isProc() const");    
    4740             :     }
    4741             :   }
    4742           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4743             :   return SWIG_arg;
    4744             :   
    4745             :   if(0) SWIG_fail;
    4746             :   
    4747             : fail:
    4748           0 :   lua_error(L);
    4749             :   return SWIG_arg;
    4750             : }
    4751             : 
    4752             : 
    4753           0 : static int _wrap_Key_isDir(lua_State* L) {
    4754           0 :   int SWIG_arg = 0;
    4755           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4756             :   bool result;
    4757             :   
    4758           0 :   SWIG_check_num_args("kdb::Key::isDir",1,1)
    4759           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isDir",1,"kdb::Key const *");
    4760             :   
    4761           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4762           0 :     SWIG_fail_ptr("Key_isDir",1,SWIGTYPE_p_kdb__Key);
    4763             :   }
    4764             :   
    4765             :   {
    4766             :     try {
    4767           0 :       result = (bool)((kdb::Key const *)arg1)->isDir();    
    4768           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4769           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4770           0 :     }    catch (...) {
    4771           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isDir() const");    
    4772             :     }
    4773             :   }
    4774           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4775             :   return SWIG_arg;
    4776             :   
    4777             :   if(0) SWIG_fail;
    4778             :   
    4779             : fail:
    4780           0 :   lua_error(L);
    4781             :   return SWIG_arg;
    4782             : }
    4783             : 
    4784             : 
    4785           1 : static int _wrap_Key_isUser(lua_State* L) {
    4786           1 :   int SWIG_arg = 0;
    4787           1 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4788             :   bool result;
    4789             :   
    4790           1 :   SWIG_check_num_args("kdb::Key::isUser",1,1)
    4791           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isUser",1,"kdb::Key const *");
    4792             :   
    4793           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4794           0 :     SWIG_fail_ptr("Key_isUser",1,SWIGTYPE_p_kdb__Key);
    4795             :   }
    4796             :   
    4797             :   {
    4798             :     try {
    4799           2 :       result = (bool)((kdb::Key const *)arg1)->isUser();    
    4800           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4801           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4802           0 :     }    catch (...) {
    4803           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isUser() const");    
    4804             :     }
    4805             :   }
    4806           1 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4807             :   return SWIG_arg;
    4808             :   
    4809             :   if(0) SWIG_fail;
    4810             :   
    4811             : fail:
    4812           0 :   lua_error(L);
    4813             :   return SWIG_arg;
    4814             : }
    4815             : 
    4816             : 
    4817           1 : static int _wrap_Key_isSystem(lua_State* L) {
    4818           1 :   int SWIG_arg = 0;
    4819           1 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4820             :   bool result;
    4821             :   
    4822           1 :   SWIG_check_num_args("kdb::Key::isSystem",1,1)
    4823           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isSystem",1,"kdb::Key const *");
    4824             :   
    4825           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4826           0 :     SWIG_fail_ptr("Key_isSystem",1,SWIGTYPE_p_kdb__Key);
    4827             :   }
    4828             :   
    4829             :   {
    4830             :     try {
    4831           2 :       result = (bool)((kdb::Key const *)arg1)->isSystem();    
    4832           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4833           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4834           0 :     }    catch (...) {
    4835           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isSystem() const");    
    4836             :     }
    4837             :   }
    4838           1 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4839             :   return SWIG_arg;
    4840             :   
    4841             :   if(0) SWIG_fail;
    4842             :   
    4843             : fail:
    4844           0 :   lua_error(L);
    4845             :   return SWIG_arg;
    4846             : }
    4847             : 
    4848             : 
    4849           1 : static int _wrap_Key_isString(lua_State* L) {
    4850           1 :   int SWIG_arg = 0;
    4851           1 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4852             :   bool result;
    4853             :   
    4854           1 :   SWIG_check_num_args("kdb::Key::isString",1,1)
    4855           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isString",1,"kdb::Key const *");
    4856             :   
    4857           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4858           0 :     SWIG_fail_ptr("Key_isString",1,SWIGTYPE_p_kdb__Key);
    4859             :   }
    4860             :   
    4861             :   {
    4862             :     try {
    4863           2 :       result = (bool)((kdb::Key const *)arg1)->isString();    
    4864           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4865           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4866           0 :     }    catch (...) {
    4867           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isString() const");    
    4868             :     }
    4869             :   }
    4870           1 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4871             :   return SWIG_arg;
    4872             :   
    4873             :   if(0) SWIG_fail;
    4874             :   
    4875             : fail:
    4876           0 :   lua_error(L);
    4877             :   return SWIG_arg;
    4878             : }
    4879             : 
    4880             : 
    4881          17 : static int _wrap_Key_isBinary(lua_State* L) {
    4882          17 :   int SWIG_arg = 0;
    4883          17 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4884             :   bool result;
    4885             :   
    4886          17 :   SWIG_check_num_args("kdb::Key::isBinary",1,1)
    4887          17 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isBinary",1,"kdb::Key const *");
    4888             :   
    4889          17 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4890           0 :     SWIG_fail_ptr("Key_isBinary",1,SWIGTYPE_p_kdb__Key);
    4891             :   }
    4892             :   
    4893             :   {
    4894             :     try {
    4895          34 :       result = (bool)((kdb::Key const *)arg1)->isBinary();    
    4896           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4897           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4898           0 :     }    catch (...) {
    4899           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isBinary() const");    
    4900             :     }
    4901             :   }
    4902          17 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4903             :   return SWIG_arg;
    4904             :   
    4905             :   if(0) SWIG_fail;
    4906             :   
    4907             : fail:
    4908           0 :   lua_error(L);
    4909             :   return SWIG_arg;
    4910             : }
    4911             : 
    4912             : 
    4913           0 : static int _wrap_Key_isInactive(lua_State* L) {
    4914           0 :   int SWIG_arg = 0;
    4915           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4916             :   bool result;
    4917             :   
    4918           0 :   SWIG_check_num_args("kdb::Key::isInactive",1,1)
    4919           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isInactive",1,"kdb::Key const *");
    4920             :   
    4921           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4922           0 :     SWIG_fail_ptr("Key_isInactive",1,SWIGTYPE_p_kdb__Key);
    4923             :   }
    4924             :   
    4925             :   {
    4926             :     try {
    4927           0 :       result = (bool)((kdb::Key const *)arg1)->isInactive();    
    4928           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4929           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4930           0 :     }    catch (...) {
    4931           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isInactive() const");    
    4932             :     }
    4933             :   }
    4934           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4935             :   return SWIG_arg;
    4936             :   
    4937             :   if(0) SWIG_fail;
    4938             :   
    4939             : fail:
    4940           0 :   lua_error(L);
    4941             :   return SWIG_arg;
    4942             : }
    4943             : 
    4944             : 
    4945           1 : static int _wrap_Key_isBelow(lua_State* L) {
    4946           1 :   int SWIG_arg = 0;
    4947           1 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4948           1 :   kdb::Key *arg2 = 0 ;
    4949             :   bool result;
    4950             :   
    4951           1 :   SWIG_check_num_args("kdb::Key::isBelow",2,2)
    4952           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isBelow",1,"kdb::Key const *");
    4953           1 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::isBelow",2,"kdb::Key const &");
    4954             :   
    4955           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4956           0 :     SWIG_fail_ptr("Key_isBelow",1,SWIGTYPE_p_kdb__Key);
    4957             :   }
    4958             :   
    4959             :   
    4960           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    4961           0 :     SWIG_fail_ptr("Key_isBelow",2,SWIGTYPE_p_kdb__Key);
    4962             :   }
    4963             :   
    4964             :   {
    4965             :     try {
    4966           2 :       result = (bool)((kdb::Key const *)arg1)->isBelow((kdb::Key const &)*arg2);    
    4967           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    4968           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    4969           0 :     }    catch (...) {
    4970           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isBelow(kdb::Key const &) const");    
    4971             :     }
    4972             :   }
    4973           1 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    4974             :   return SWIG_arg;
    4975             :   
    4976             :   if(0) SWIG_fail;
    4977             :   
    4978             : fail:
    4979           0 :   lua_error(L);
    4980             :   return SWIG_arg;
    4981             : }
    4982             : 
    4983             : 
    4984           0 : static int _wrap_Key_isBelowOrSame(lua_State* L) {
    4985           0 :   int SWIG_arg = 0;
    4986           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    4987           0 :   kdb::Key *arg2 = 0 ;
    4988             :   bool result;
    4989             :   
    4990           0 :   SWIG_check_num_args("kdb::Key::isBelowOrSame",2,2)
    4991           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isBelowOrSame",1,"kdb::Key const *");
    4992           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::isBelowOrSame",2,"kdb::Key const &");
    4993             :   
    4994           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    4995           0 :     SWIG_fail_ptr("Key_isBelowOrSame",1,SWIGTYPE_p_kdb__Key);
    4996             :   }
    4997             :   
    4998             :   
    4999           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    5000           0 :     SWIG_fail_ptr("Key_isBelowOrSame",2,SWIGTYPE_p_kdb__Key);
    5001             :   }
    5002             :   
    5003             :   {
    5004             :     try {
    5005           0 :       result = (bool)((kdb::Key const *)arg1)->isBelowOrSame((kdb::Key const &)*arg2);    
    5006           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5007           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5008           0 :     }    catch (...) {
    5009           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isBelowOrSame(kdb::Key const &) const");    
    5010             :     }
    5011             :   }
    5012           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    5013             :   return SWIG_arg;
    5014             :   
    5015             :   if(0) SWIG_fail;
    5016             :   
    5017             : fail:
    5018           0 :   lua_error(L);
    5019             :   return SWIG_arg;
    5020             : }
    5021             : 
    5022             : 
    5023           0 : static int _wrap_Key_isDirectBelow(lua_State* L) {
    5024           0 :   int SWIG_arg = 0;
    5025           0 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5026           0 :   kdb::Key *arg2 = 0 ;
    5027             :   bool result;
    5028             :   
    5029           0 :   SWIG_check_num_args("kdb::Key::isDirectBelow",2,2)
    5030           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isDirectBelow",1,"kdb::Key const *");
    5031           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::Key::isDirectBelow",2,"kdb::Key const &");
    5032             :   
    5033           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5034           0 :     SWIG_fail_ptr("Key_isDirectBelow",1,SWIGTYPE_p_kdb__Key);
    5035             :   }
    5036             :   
    5037             :   
    5038           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    5039           0 :     SWIG_fail_ptr("Key_isDirectBelow",2,SWIGTYPE_p_kdb__Key);
    5040             :   }
    5041             :   
    5042             :   {
    5043             :     try {
    5044           0 :       result = (bool)((kdb::Key const *)arg1)->isDirectBelow((kdb::Key const &)*arg2);    
    5045           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5046           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5047           0 :     }    catch (...) {
    5048           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isDirectBelow(kdb::Key const &) const");    
    5049             :     }
    5050             :   }
    5051           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    5052             :   return SWIG_arg;
    5053             :   
    5054             :   if(0) SWIG_fail;
    5055             :   
    5056             : fail:
    5057           0 :   lua_error(L);
    5058             :   return SWIG_arg;
    5059             : }
    5060             : 
    5061             : 
    5062           3 : static int _wrap_Key_name_set(lua_State* L) {
    5063           3 :   int SWIG_arg = 0;
    5064           3 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5065           3 :   std::string *arg2 = 0 ;
    5066           5 :   std::string temp2 ;
    5067             :   
    5068           3 :   SWIG_check_num_args("kdb::Key::name",2,2)
    5069           3 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::name",1,"kdb::Key *");
    5070           3 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::name",2,"std::string const &");
    5071             :   
    5072           3 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5073           0 :     SWIG_fail_ptr("Key_name_set",1,SWIGTYPE_p_kdb__Key);
    5074             :   }
    5075             :   
    5076           6 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    5077             :   {
    5078             :     try {
    5079           3 :       kdb_Key_name_set(arg1,(std::string const &)*arg2);    
    5080           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5081           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5082           0 :     }    catch (...) {
    5083           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::name");    
    5084             :     }
    5085             :   }
    5086             :   
    5087             :   return SWIG_arg;
    5088             :   
    5089             :   if(0) SWIG_fail;
    5090             :   
    5091             : fail:
    5092           1 :   lua_error(L);
    5093             :   return SWIG_arg;
    5094             : }
    5095             : 
    5096             : 
    5097           5 : static int _wrap_Key_name_get(lua_State* L) {
    5098           5 :   int SWIG_arg = 0;
    5099           5 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5100           5 :   std::string *result = 0 ;
    5101             :   
    5102           5 :   SWIG_check_num_args("kdb::Key::name",1,1)
    5103           5 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::name",1,"kdb::Key *");
    5104             :   
    5105           5 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5106           0 :     SWIG_fail_ptr("Key_name_get",1,SWIGTYPE_p_kdb__Key);
    5107             :   }
    5108             :   
    5109             :   {
    5110             :     try {
    5111           5 :       result = (std::string *) &kdb_Key_name_get(arg1);    
    5112           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5113           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5114           0 :     }    catch (...) {
    5115           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::name");    
    5116             :     }
    5117             :   }
    5118          10 :   lua_pushlstring(L,result->data(),result->size()); SWIG_arg++;
    5119          10 :   delete result;
    5120             :   return SWIG_arg;
    5121             :   
    5122             :   if(0) SWIG_fail;
    5123             :   
    5124             : fail:
    5125           0 :   lua_error(L);
    5126             :   return SWIG_arg;
    5127             : }
    5128             : 
    5129             : 
    5130           1 : static int _wrap_Key_basename_set(lua_State* L) {
    5131           1 :   int SWIG_arg = 0;
    5132           1 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5133           1 :   std::string *arg2 = 0 ;
    5134           2 :   std::string temp2 ;
    5135             :   
    5136           1 :   SWIG_check_num_args("kdb::Key::basename",2,2)
    5137           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::basename",1,"kdb::Key *");
    5138           1 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::basename",2,"std::string const &");
    5139             :   
    5140           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5141           0 :     SWIG_fail_ptr("Key_basename_set",1,SWIGTYPE_p_kdb__Key);
    5142             :   }
    5143             :   
    5144           2 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    5145             :   {
    5146             :     try {
    5147           1 :       kdb_Key_basename_set(arg1,(std::string const &)*arg2);    
    5148           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5149           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5150           0 :     }    catch (...) {
    5151           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::basename");    
    5152             :     }
    5153             :   }
    5154             :   
    5155             :   return SWIG_arg;
    5156             :   
    5157             :   if(0) SWIG_fail;
    5158             :   
    5159             : fail:
    5160           0 :   lua_error(L);
    5161             :   return SWIG_arg;
    5162             : }
    5163             : 
    5164             : 
    5165           2 : static int _wrap_Key_basename_get(lua_State* L) {
    5166           2 :   int SWIG_arg = 0;
    5167           2 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5168           2 :   std::string *result = 0 ;
    5169             :   
    5170           2 :   SWIG_check_num_args("kdb::Key::basename",1,1)
    5171           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::basename",1,"kdb::Key *");
    5172             :   
    5173           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5174           0 :     SWIG_fail_ptr("Key_basename_get",1,SWIGTYPE_p_kdb__Key);
    5175             :   }
    5176             :   
    5177             :   {
    5178             :     try {
    5179           4 :       result = (std::string *) &kdb_Key_basename_get(arg1);    
    5180           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5181           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5182           0 :     }    catch (...) {
    5183           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::basename");    
    5184             :     }
    5185             :   }
    5186           4 :   lua_pushlstring(L,result->data(),result->size()); SWIG_arg++;
    5187           4 :   delete result;
    5188             :   return SWIG_arg;
    5189             :   
    5190             :   if(0) SWIG_fail;
    5191             :   
    5192             : fail:
    5193           0 :   lua_error(L);
    5194             :   return SWIG_arg;
    5195             : }
    5196             : 
    5197             : 
    5198           2 : static int _wrap_Key_fullname_get(lua_State* L) {
    5199           2 :   int SWIG_arg = 0;
    5200           2 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5201           2 :   std::string *result = 0 ;
    5202             :   
    5203           2 :   SWIG_check_num_args("kdb::Key::fullname",1,1)
    5204           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::fullname",1,"kdb::Key *");
    5205             :   
    5206           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5207           0 :     SWIG_fail_ptr("Key_fullname_get",1,SWIGTYPE_p_kdb__Key);
    5208             :   }
    5209             :   
    5210             :   {
    5211             :     try {
    5212           2 :       result = (std::string *) &kdb_Key_fullname_get(arg1);    
    5213           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5214           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5215           0 :     }    catch (...) {
    5216           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::fullname");    
    5217             :     }
    5218             :   }
    5219           4 :   lua_pushlstring(L,result->data(),result->size()); SWIG_arg++;
    5220           4 :   delete result;
    5221             :   return SWIG_arg;
    5222             :   
    5223             :   if(0) SWIG_fail;
    5224             :   
    5225             : fail:
    5226           0 :   lua_error(L);
    5227             :   return SWIG_arg;
    5228             : }
    5229             : 
    5230             : 
    5231           1 : static int _wrap_new_Key__SWIG_3(lua_State* L) {
    5232           1 :   int SWIG_arg = 0;
    5233           1 :   char *arg1 = (char *) 0 ;
    5234             :   int arg2 ;
    5235           1 :   kdb::Key *result = 0 ;
    5236             :   
    5237           1 :   SWIG_check_num_args("kdb::Key::Key",2,2)
    5238           1 :   if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("kdb::Key::Key",1,"char const *");
    5239           1 :   if(!lua_isnumber(L,2)) SWIG_fail_arg("kdb::Key::Key",2,"int");
    5240           1 :   arg1 = (char *)lua_tostring(L, 1);
    5241           1 :   arg2 = (int)lua_tonumber(L, 2);
    5242             :   {
    5243             :     try {
    5244           1 :       result = (kdb::Key *)new_kdb_Key__SWIG_3((char const *)arg1,arg2);    
    5245           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5246           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5247           0 :     }    catch (...) {
    5248           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::Key(char const *,int)");    
    5249             :     }
    5250             :   }
    5251           1 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__Key,1); SWIG_arg++; 
    5252           1 :   return SWIG_arg;
    5253             :   
    5254             :   if(0) SWIG_fail;
    5255             :   
    5256             : fail:
    5257           0 :   lua_error(L);
    5258           0 :   return SWIG_arg;
    5259             : }
    5260             : 
    5261             : 
    5262          44 : static int _wrap_new_Key__SWIG_4(lua_State* L) {
    5263          44 :   int SWIG_arg = 0;
    5264          44 :   char *arg1 = (char *) 0 ;
    5265          44 :   kdb::Key *result = 0 ;
    5266             :   
    5267          44 :   SWIG_check_num_args("kdb::Key::Key",1,1)
    5268          44 :   if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("kdb::Key::Key",1,"char const *");
    5269          44 :   arg1 = (char *)lua_tostring(L, 1);
    5270             :   {
    5271             :     try {
    5272          44 :       result = (kdb::Key *)new_kdb_Key__SWIG_3((char const *)arg1);    
    5273           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5274           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5275           0 :     }    catch (...) {
    5276           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::Key(char const *)");    
    5277             :     }
    5278             :   }
    5279          44 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__Key,1); SWIG_arg++; 
    5280          44 :   return SWIG_arg;
    5281             :   
    5282             :   if(0) SWIG_fail;
    5283             :   
    5284             : fail:
    5285           0 :   lua_error(L);
    5286           0 :   return SWIG_arg;
    5287             : }
    5288             : 
    5289             : 
    5290          60 : static int _wrap_new_Key(lua_State* L) {
    5291             :   int argc;
    5292             :   int argv[3]={
    5293             :     1,2,3
    5294          60 :   };
    5295             :   
    5296          60 :   argc = lua_gettop(L);
    5297          60 :   if (argc == 0) {
    5298          12 :     return _wrap_new_Key__SWIG_0(L);
    5299             :   }
    5300          48 :   if (argc == 1) {
    5301          47 :     int _v = 0;
    5302             :     {
    5303             :       {
    5304             :         void *ptr;
    5305          47 :         if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p__Key, 0)) {
    5306             :           _v = 0;
    5307             :         } else {
    5308           1 :           _v = 1;
    5309             :         }
    5310             :       }
    5311             :     }
    5312          47 :     if (!_v) goto check_2;
    5313           1 :     return _wrap_new_Key__SWIG_1(L);
    5314             :   }
    5315             : check_2:
    5316             :   
    5317          47 :   if (argc == 1) {
    5318          46 :     int _v = 0;
    5319             :     {
    5320             :       {
    5321             :         void *ptr;
    5322          46 :         if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_kdb__Key, 0)) {
    5323             :           _v = 0;
    5324             :         } else {
    5325           2 :           _v = 1;
    5326             :         }
    5327             :       }
    5328             :     }
    5329          46 :     if (!_v) goto check_3;
    5330           2 :     return _wrap_new_Key__SWIG_2(L);
    5331             :   }
    5332             : check_3:
    5333             :   
    5334          45 :   if (argc == 1) {
    5335          44 :     return _wrap_new_Key__SWIG_4(L);
    5336             :   }
    5337           1 :   if (argc == 2) {
    5338           1 :     return _wrap_new_Key__SWIG_3(L);
    5339             :   }
    5340             :   
    5341             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_Key'\n"
    5342             :     "  Possible C/C++ prototypes are:\n"
    5343             :     "    kdb::Key::Key()\n"
    5344             :     "    kdb::Key::Key(ckdb::Key *)\n"
    5345             :     "    kdb::Key::Key(kdb::Key &)\n"
    5346             :     "    kdb::Key::Key(char const *,int)\n"
    5347           0 :     "    kdb::Key::Key(char const *)\n");
    5348           0 :   lua_error(L);return 0;
    5349             : }
    5350             : 
    5351             : 
    5352          31 : static int _wrap_Key_isNull__SWIG_1(lua_State* L) {
    5353          31 :   int SWIG_arg = 0;
    5354          31 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5355             :   bool result;
    5356             :   
    5357          31 :   SWIG_check_num_args("kdb::Key::isNull",1,1)
    5358          31 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::isNull",1,"kdb::Key *");
    5359             :   
    5360          31 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5361           0 :     SWIG_fail_ptr("Key_isNull",1,SWIGTYPE_p_kdb__Key);
    5362             :   }
    5363             :   
    5364             :   {
    5365             :     try {
    5366          62 :       result = (bool)kdb_Key_isNull__SWIG_1(arg1);    
    5367             :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5368             :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5369             :     }    catch (...) {
    5370             :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::isNull()");    
    5371             :     }
    5372             :   }
    5373          31 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    5374             :   return SWIG_arg;
    5375             :   
    5376             :   if(0) SWIG_fail;
    5377             :   
    5378             : fail:
    5379           0 :   lua_error(L);
    5380             :   return SWIG_arg;
    5381             : }
    5382             : 
    5383             : 
    5384          31 : static int _wrap_Key_isNull(lua_State* L) {
    5385             :   int argc;
    5386             :   int argv[2]={
    5387             :     1,2
    5388          31 :   };
    5389             :   
    5390          31 :   argc = lua_gettop(L);
    5391          31 :   if (argc == 1) {
    5392          31 :     return _wrap_Key_isNull__SWIG_1(L);
    5393             :   }
    5394             :   if (argc == 1) {
    5395             :     return _wrap_Key_isNull__SWIG_0(L);
    5396             :   }
    5397             :   
    5398             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'Key_isNull'\n"
    5399             :     "  Possible C/C++ prototypes are:\n"
    5400             :     "    kdb::Key::isNull() const\n"
    5401           0 :     "    kdb::Key::isNull()\n");
    5402           0 :   lua_error(L);return 0;
    5403             : }
    5404             : 
    5405             : 
    5406           2 : static int _wrap_Key___tostring(lua_State* L) {
    5407           2 :   int SWIG_arg = 0;
    5408           2 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5409           4 :   std::string result;
    5410             :   
    5411           2 :   SWIG_check_num_args("kdb::Key::__tostring",1,1)
    5412           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::__tostring",1,"kdb::Key *");
    5413             :   
    5414           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5415           0 :     SWIG_fail_ptr("Key___tostring",1,SWIGTYPE_p_kdb__Key);
    5416             :   }
    5417             :   
    5418             :   {
    5419             :     try {
    5420           6 :       result = kdb_Key___tostring(arg1);    
    5421           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5422           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5423           0 :     }    catch (...) {
    5424           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::__tostring()");    
    5425             :     }
    5426             :   }
    5427           4 :   lua_pushlstring(L,(&result)->data(),(&result)->size()); SWIG_arg++;
    5428             :   return SWIG_arg;
    5429             :   
    5430             :   if(0) SWIG_fail;
    5431             :   
    5432             : fail:
    5433           0 :   lua_error(L);
    5434             :   return SWIG_arg;
    5435             : }
    5436             : 
    5437             : 
    5438           2 : static int _wrap_Key_name_iterator(lua_State* L) {
    5439           2 :   int SWIG_arg = 0;
    5440           2 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5441           2 :   myswig::LuaSTLIterator_T< kdb::Key::iterator > *result = 0 ;
    5442             :   
    5443           2 :   SWIG_check_num_args("kdb::Key::name_iterator",1,1)
    5444           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::name_iterator",1,"kdb::Key *");
    5445             :   
    5446           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5447           0 :     SWIG_fail_ptr("Key_name_iterator",1,SWIGTYPE_p_kdb__Key);
    5448             :   }
    5449             :   
    5450             :   {
    5451             :     try {
    5452           2 :       result = (myswig::LuaSTLIterator_T< kdb::Key::iterator > *)kdb_Key_name_iterator(arg1);    
    5453           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5454           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5455           0 :     }    catch (...) {
    5456           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::name_iterator()");    
    5457             :     }
    5458             :   }
    5459             :   {
    5460             :     typedef myswig::LuaSTLIterator_T< kdb::Key::iterator > luaiterator;
    5461             :     
    5462           2 :     luaiterator **iter = (luaiterator **)lua_newuserdata(L, sizeof(luaiterator *));
    5463           2 :     *iter = result;
    5464             :     
    5465             :     /* create and set metatable */
    5466           2 :     lua_newtable(L);
    5467           2 :     lua_pushcfunction(L, myswig::LuaSTLIterator< luaiterator >::gc);
    5468           2 :     lua_setfield(L, -2, "__gc");
    5469           2 :     lua_setmetatable(L, -2);
    5470             :     
    5471           2 :     lua_pushcclosure(L, myswig::LuaSTLIterator< luaiterator >::iter, 1);
    5472             :     SWIG_arg++;
    5473             :   }
    5474             :   return SWIG_arg;
    5475             :   
    5476             :   if(0) SWIG_fail;
    5477             :   
    5478             : fail:
    5479           0 :   lua_error(L);
    5480             :   return SWIG_arg;
    5481             : }
    5482             : 
    5483             : 
    5484           2 : static int _wrap_Key_reverse_name_iterator(lua_State* L) {
    5485           2 :   int SWIG_arg = 0;
    5486           2 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5487           2 :   myswig::LuaSTLIterator_T< kdb::Key::reverse_iterator > *result = 0 ;
    5488             :   
    5489           2 :   SWIG_check_num_args("kdb::Key::reverse_name_iterator",1,1)
    5490           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::reverse_name_iterator",1,"kdb::Key *");
    5491             :   
    5492           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5493           0 :     SWIG_fail_ptr("Key_reverse_name_iterator",1,SWIGTYPE_p_kdb__Key);
    5494             :   }
    5495             :   
    5496             :   {
    5497             :     try {
    5498           2 :       result = (myswig::LuaSTLIterator_T< kdb::Key::reverse_iterator > *)kdb_Key_reverse_name_iterator(arg1);    
    5499           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5500           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5501           0 :     }    catch (...) {
    5502           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::reverse_name_iterator()");    
    5503             :     }
    5504             :   }
    5505             :   {
    5506             :     typedef myswig::LuaSTLIterator_T< kdb::Key::reverse_iterator > luaiterator;
    5507             :     
    5508           2 :     luaiterator **iter = (luaiterator **)lua_newuserdata(L, sizeof(luaiterator *));
    5509           2 :     *iter = result;
    5510             :     
    5511             :     /* create and set metatable */
    5512           2 :     lua_newtable(L);
    5513           2 :     lua_pushcfunction(L, myswig::LuaSTLIterator< luaiterator >::gc);
    5514           2 :     lua_setfield(L, -2, "__gc");
    5515           2 :     lua_setmetatable(L, -2);
    5516             :     
    5517           2 :     lua_pushcclosure(L, myswig::LuaSTLIterator< luaiterator >::iter, 1);
    5518             :     SWIG_arg++;
    5519             :   }
    5520             :   return SWIG_arg;
    5521             :   
    5522             :   if(0) SWIG_fail;
    5523             :   
    5524             : fail:
    5525           0 :   lua_error(L);
    5526             :   return SWIG_arg;
    5527             : }
    5528             : 
    5529             : 
    5530          10 : static int _wrap_Key__getMeta(lua_State* L) {
    5531          10 :   int SWIG_arg = 0;
    5532          10 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5533          10 :   std::string *arg2 = 0 ;
    5534          20 :   std::string temp2 ;
    5535          20 :   kdb::Key result;
    5536             :   
    5537          10 :   SWIG_check_num_args("kdb::Key::getMeta< kdb::Key const >",2,2)
    5538          10 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::getMeta< kdb::Key const >",1,"kdb::Key const *");
    5539          10 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::getMeta< kdb::Key const >",2,"std::string const &");
    5540             :   
    5541          10 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5542           0 :     SWIG_fail_ptr("Key__getMeta",1,SWIGTYPE_p_kdb__Key);
    5543             :   }
    5544             :   
    5545          20 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    5546             :   {
    5547             :     try {
    5548          40 :       result = ((kdb::Key const *)arg1)->SWIGTEMPLATEDISAMBIGUATOR getMeta< kdb::Key const >((std::string const &)*arg2);    
    5549           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5550           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5551           0 :     }    catch (...) {
    5552           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::getMeta< kdb::Key const >(std::string const &) const");    
    5553             :     }
    5554             :   }
    5555             :   {
    5556          20 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    5557          10 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    5558             :   }
    5559             :   return SWIG_arg;
    5560             :   
    5561             :   if(0) SWIG_fail;
    5562             :   
    5563             : fail:
    5564           0 :   lua_error(L);
    5565             :   return SWIG_arg;
    5566             : }
    5567             : 
    5568             : 
    5569           4 : static int _wrap_Key_setMeta(lua_State* L) {
    5570           4 :   int SWIG_arg = 0;
    5571           4 :   kdb::Key *arg1 = (kdb::Key *) 0 ;
    5572           4 :   std::string *arg2 = 0 ;
    5573           8 :   std::string arg3 ;
    5574           8 :   std::string temp2 ;
    5575             :   
    5576           4 :   SWIG_check_num_args("kdb::Key::setMeta< std::string >",3,3)
    5577           4 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::Key::setMeta< std::string >",1,"kdb::Key *");
    5578           4 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::Key::setMeta< std::string >",2,"std::string const &");
    5579           4 :   if(!lua_isstring(L,3)) SWIG_fail_arg("kdb::Key::setMeta< std::string >",3,"std::string");
    5580             :   
    5581           4 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    5582           0 :     SWIG_fail_ptr("Key_setMeta",1,SWIGTYPE_p_kdb__Key);
    5583             :   }
    5584             :   
    5585           8 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    5586           8 :   (&arg3)->assign(lua_tostring(L,3),lua_rawlen(L,3));
    5587             :   {
    5588             :     try {
    5589           8 :       (arg1)->SWIGTEMPLATEDISAMBIGUATOR setMeta< std::string >((std::string const &)*arg2,arg3);    
    5590           0 :     }    KEY_EXCEPTIONS    catch (const std::exception & e) {
    5591           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    5592           0 :     }    catch (...) {
    5593           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::Key::setMeta< std::string >(std::string const &,std::string)");    
    5594             :     }
    5595             :   }
    5596             :   
    5597           4 :   return SWIG_arg;
    5598             :   
    5599             :   if(0) SWIG_fail;
    5600             :   
    5601             : fail:
    5602           0 :   lua_error(L);
    5603             :   return SWIG_arg;
    5604             : }
    5605             : 
    5606             : 
    5607          93 : static void swig_delete_Key(void *obj) {
    5608          93 : kdb::Key *arg1 = (kdb::Key *) obj;
    5609         186 : delete arg1;
    5610          93 : }
    5611          60 : static int _proxy__wrap_new_Key(lua_State *L) {
    5612             :     assert(lua_istable(L,1));
    5613          60 :     lua_pushcfunction(L,_wrap_new_Key);
    5614             :     assert(!lua_isnil(L,-1));
    5615          60 :     lua_replace(L,1); /* replace our table with real constructor */
    5616          60 :     lua_call(L,lua_gettop(L)-1,1);
    5617          60 :     return 1;
    5618             : }
    5619             : static swig_lua_attribute swig_Key_attributes[] = {
    5620             :     { "name", _wrap_Key_name_get, _wrap_Key_name_set },
    5621             :     { "basename", _wrap_Key_basename_get, _wrap_Key_basename_set },
    5622             :     { "fullname", _wrap_Key_fullname_get, SWIG_Lua_set_immutable },
    5623             :     {0,0,0}
    5624             : };
    5625             : static swig_lua_method swig_Key_methods[]= {
    5626             :     { "_incRef", _wrap_Key__incRef},
    5627             :     { "_decRef", _wrap_Key__decRef},
    5628             :     { "getReferenceCounter", _wrap_Key_getReferenceCounter},
    5629             :     { "copy", _wrap_Key_copy},
    5630             :     { "clear", _wrap_Key_clear},
    5631             :     { "getKey", _wrap_Key_getKey},
    5632             :     { "__ref__", _wrap_Key___ref__},
    5633             :     { "release", _wrap_Key_release},
    5634             :     { "dup", _wrap_Key_dup},
    5635             :     { "_getNameSize", _wrap_Key__getNameSize},
    5636             :     { "_getBaseNameSize", _wrap_Key__getBaseNameSize},
    5637             :     { "addName", _wrap_Key_addName},
    5638             :     { "addBaseName", _wrap_Key_addBaseName},
    5639             :     { "delBaseName", _wrap_Key_delBaseName},
    5640             :     { "_getFullNameSize", _wrap_Key__getFullNameSize},
    5641             :     { "__eq", _wrap_Key___eq},
    5642             :     { "__lt", _wrap_Key___lt},
    5643             :     { "__le", _wrap_Key___le},
    5644             :     { "needSync", _wrap_Key_needSync},
    5645             :     { "_getString", _wrap_Key__getString},
    5646             :     { "_setString", _wrap_Key__setString},
    5647             :     { "_getStringSize", _wrap_Key__getStringSize},
    5648             :     { "_getFunc", _wrap_Key__getFunc},
    5649             :     { "setCallback", _wrap_Key_setCallback},
    5650             :     { "_getValue", _wrap_Key__getValue},
    5651             :     { "_getBinary", _wrap_Key__getBinary},
    5652             :     { "_getBinarySize", _wrap_Key__getBinarySize},
    5653             :     { "_setBinary", _wrap_Key__setBinary},
    5654             :     { "hasMeta", _wrap_Key_hasMeta},
    5655             :     { "delMeta", _wrap_Key_delMeta},
    5656             :     { "copyMeta", _wrap_Key_copyMeta},
    5657             :     { "copyAllMeta", _wrap_Key_copyAllMeta},
    5658             :     { "_rewindMeta", _wrap_Key__rewindMeta},
    5659             :     { "_nextMeta", _wrap_Key__nextMeta},
    5660             :     { "_currentMeta", _wrap_Key__currentMeta},
    5661             :     { "isValid", _wrap_Key_isValid},
    5662             :     { "getNamespace", _wrap_Key_getNamespace},
    5663             :     { "isCascading", _wrap_Key_isCascading},
    5664             :     { "isSpec", _wrap_Key_isSpec},
    5665             :     { "isProc", _wrap_Key_isProc},
    5666             :     { "isDir", _wrap_Key_isDir},
    5667             :     { "isUser", _wrap_Key_isUser},
    5668             :     { "isSystem", _wrap_Key_isSystem},
    5669             :     { "isString", _wrap_Key_isString},
    5670             :     { "isBinary", _wrap_Key_isBinary},
    5671             :     { "isInactive", _wrap_Key_isInactive},
    5672             :     { "isBelow", _wrap_Key_isBelow},
    5673             :     { "isBelowOrSame", _wrap_Key_isBelowOrSame},
    5674             :     { "isDirectBelow", _wrap_Key_isDirectBelow},
    5675             :     { "isNull", _wrap_Key_isNull},
    5676             :     { "__tostring", _wrap_Key___tostring},
    5677             :     { "name_iterator", _wrap_Key_name_iterator},
    5678             :     { "reverse_name_iterator", _wrap_Key_reverse_name_iterator},
    5679             :     { "_getMeta", _wrap_Key__getMeta},
    5680             :     { "setMeta", _wrap_Key_setMeta},
    5681             :     {0,0}
    5682             : };
    5683             : static swig_lua_method swig_Key_meta[] = {
    5684             :     { "__ref__", _wrap_Key___ref__},
    5685             :     { "__eq", _wrap_Key___eq},
    5686             :     { "__lt", _wrap_Key___lt},
    5687             :     { "__le", _wrap_Key___le},
    5688             :     { "__tostring", _wrap_Key___tostring},
    5689             :     {0,0}
    5690             : };
    5691             : 
    5692             : static swig_lua_attribute swig_Key_Sf_SwigStatic_attributes[] = {
    5693             :     {0,0,0}
    5694             : };
    5695             : static swig_lua_const_info swig_Key_Sf_SwigStatic_constants[]= {
    5696             :     {0,0,0,0,0,0}
    5697             : };
    5698             : static swig_lua_method swig_Key_Sf_SwigStatic_methods[]= {
    5699             :     {0,0}
    5700             : };
    5701             : static swig_lua_class* swig_Key_Sf_SwigStatic_classes[]= {
    5702             :     0
    5703             : };
    5704             : 
    5705             : static swig_lua_namespace swig_Key_Sf_SwigStatic = {
    5706             :     "Key",
    5707             :     swig_Key_Sf_SwigStatic_methods,
    5708             :     swig_Key_Sf_SwigStatic_attributes,
    5709             :     swig_Key_Sf_SwigStatic_constants,
    5710             :     swig_Key_Sf_SwigStatic_classes,
    5711             :     0
    5712             : };
    5713             : static swig_lua_class *swig_Key_bases[] = {0};
    5714             : static const char *swig_Key_base_names[] = {0};
    5715             : static swig_lua_class _wrap_class_Key = { "Key", "Key", &SWIGTYPE_p_kdb__Key,_proxy__wrap_new_Key, swig_delete_Key, swig_Key_methods, swig_Key_attributes, &swig_Key_Sf_SwigStatic, swig_Key_meta, swig_Key_bases, swig_Key_base_names };
    5716             : 
    5717           0 : static int _wrap_new_KeySet__SWIG_0(lua_State* L) {
    5718           0 :   int SWIG_arg = 0;
    5719           0 :   kdb::KeySet *result = 0 ;
    5720             :   
    5721           0 :   SWIG_check_num_args("kdb::KeySet::KeySet",0,0)
    5722           0 :   result = (kdb::KeySet *)new kdb::KeySet();
    5723           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__KeySet,1); SWIG_arg++; 
    5724           0 :   return SWIG_arg;
    5725             :   
    5726             :   if(0) SWIG_fail;
    5727             :   
    5728             : fail:
    5729           0 :   lua_error(L);
    5730           0 :   return SWIG_arg;
    5731             : }
    5732             : 
    5733             : 
    5734           9 : static int _wrap_new_KeySet__SWIG_1(lua_State* L) {
    5735           9 :   int SWIG_arg = 0;
    5736           9 :   ckdb::KeySet *arg1 = (ckdb::KeySet *) 0 ;
    5737           9 :   kdb::KeySet *result = 0 ;
    5738             :   
    5739           9 :   SWIG_check_num_args("kdb::KeySet::KeySet",1,1)
    5740           9 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::KeySet",1,"ckdb::KeySet *");
    5741             :   
    5742           9 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p__KeySet,0))){
    5743           0 :     SWIG_fail_ptr("new_KeySet",1,SWIGTYPE_p__KeySet);
    5744             :   }
    5745             :   
    5746          18 :   result = (kdb::KeySet *)new kdb::KeySet(arg1);
    5747           9 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__KeySet,1); SWIG_arg++; 
    5748             :   return SWIG_arg;
    5749             :   
    5750             :   if(0) SWIG_fail;
    5751             :   
    5752             : fail:
    5753           0 :   lua_error(L);
    5754             :   return SWIG_arg;
    5755             : }
    5756             : 
    5757             : 
    5758           1 : static int _wrap_new_KeySet__SWIG_2(lua_State* L) {
    5759           1 :   int SWIG_arg = 0;
    5760           1 :   kdb::KeySet *arg1 = 0 ;
    5761           1 :   kdb::KeySet *result = 0 ;
    5762             :   
    5763           1 :   SWIG_check_num_args("kdb::KeySet::KeySet",1,1)
    5764           1 :   if(!lua_isuserdata(L,1)) SWIG_fail_arg("kdb::KeySet::KeySet",1,"kdb::KeySet const &");
    5765             :   
    5766           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5767           0 :     SWIG_fail_ptr("new_KeySet",1,SWIGTYPE_p_kdb__KeySet);
    5768             :   }
    5769             :   
    5770           2 :   result = (kdb::KeySet *)new kdb::KeySet((kdb::KeySet const &)*arg1);
    5771           1 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__KeySet,1); SWIG_arg++; 
    5772             :   return SWIG_arg;
    5773             :   
    5774             :   if(0) SWIG_fail;
    5775             :   
    5776             : fail:
    5777           0 :   lua_error(L);
    5778             :   return SWIG_arg;
    5779             : }
    5780             : 
    5781             : 
    5782           0 : static int _wrap_KeySet_release(lua_State* L) {
    5783           0 :   int SWIG_arg = 0;
    5784           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    5785           0 :   ckdb::KeySet *result = 0 ;
    5786             :   
    5787           0 :   SWIG_check_num_args("kdb::KeySet::release",1,1)
    5788           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::release",1,"kdb::KeySet *");
    5789             :   
    5790           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5791           0 :     SWIG_fail_ptr("KeySet_release",1,SWIGTYPE_p_kdb__KeySet);
    5792             :   }
    5793             :   
    5794           0 :   result = (ckdb::KeySet *)(arg1)->release();
    5795           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p__KeySet,0); SWIG_arg++; 
    5796             :   return SWIG_arg;
    5797             :   
    5798             :   if(0) SWIG_fail;
    5799             :   
    5800             : fail:
    5801           0 :   lua_error(L);
    5802             :   return SWIG_arg;
    5803             : }
    5804             : 
    5805             : 
    5806           0 : static int _wrap_KeySet_getKeySet(lua_State* L) {
    5807           0 :   int SWIG_arg = 0;
    5808           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    5809           0 :   ckdb::KeySet *result = 0 ;
    5810             :   
    5811           0 :   SWIG_check_num_args("kdb::KeySet::getKeySet",1,1)
    5812           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::getKeySet",1,"kdb::KeySet const *");
    5813             :   
    5814           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5815           0 :     SWIG_fail_ptr("KeySet_getKeySet",1,SWIGTYPE_p_kdb__KeySet);
    5816             :   }
    5817             :   
    5818           0 :   result = (ckdb::KeySet *)((kdb::KeySet const *)arg1)->getKeySet();
    5819           0 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p__KeySet,0); SWIG_arg++; 
    5820             :   return SWIG_arg;
    5821             :   
    5822             :   if(0) SWIG_fail;
    5823             :   
    5824             : fail:
    5825           0 :   lua_error(L);
    5826             :   return SWIG_arg;
    5827             : }
    5828             : 
    5829             : 
    5830           0 : static int _wrap_KeySet_setKeySet(lua_State* L) {
    5831           0 :   int SWIG_arg = 0;
    5832           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    5833           0 :   ckdb::KeySet *arg2 = (ckdb::KeySet *) 0 ;
    5834             :   
    5835           0 :   SWIG_check_num_args("kdb::KeySet::setKeySet",2,2)
    5836           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::setKeySet",1,"kdb::KeySet *");
    5837           0 :   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("kdb::KeySet::setKeySet",2,"ckdb::KeySet *");
    5838             :   
    5839           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5840           0 :     SWIG_fail_ptr("KeySet_setKeySet",1,SWIGTYPE_p_kdb__KeySet);
    5841             :   }
    5842             :   
    5843             :   
    5844           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p__KeySet,0))){
    5845           0 :     SWIG_fail_ptr("KeySet_setKeySet",2,SWIGTYPE_p__KeySet);
    5846             :   }
    5847             :   
    5848           0 :   (arg1)->setKeySet(arg2);
    5849             :   
    5850           0 :   return SWIG_arg;
    5851             :   
    5852             :   if(0) SWIG_fail;
    5853             :   
    5854             : fail:
    5855           0 :   lua_error(L);
    5856             :   return SWIG_arg;
    5857             : }
    5858             : 
    5859             : 
    5860           1 : static int _wrap_KeySet_dup(lua_State* L) {
    5861           1 :   int SWIG_arg = 0;
    5862           1 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    5863           1 :   ckdb::KeySet *result = 0 ;
    5864             :   
    5865           1 :   SWIG_check_num_args("kdb::KeySet::dup",1,1)
    5866           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::dup",1,"kdb::KeySet const *");
    5867             :   
    5868           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5869           0 :     SWIG_fail_ptr("KeySet_dup",1,SWIGTYPE_p_kdb__KeySet);
    5870             :   }
    5871             :   
    5872           2 :   result = (ckdb::KeySet *)((kdb::KeySet const *)arg1)->dup();
    5873           1 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p__KeySet,0); SWIG_arg++; 
    5874             :   return SWIG_arg;
    5875             :   
    5876             :   if(0) SWIG_fail;
    5877             :   
    5878             : fail:
    5879           0 :   lua_error(L);
    5880             :   return SWIG_arg;
    5881             : }
    5882             : 
    5883             : 
    5884           0 : static int _wrap_KeySet_copy(lua_State* L) {
    5885           0 :   int SWIG_arg = 0;
    5886           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    5887           0 :   kdb::KeySet *arg2 = 0 ;
    5888             :   
    5889           0 :   SWIG_check_num_args("kdb::KeySet::copy",2,2)
    5890           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::copy",1,"kdb::KeySet *");
    5891           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KeySet::copy",2,"kdb::KeySet const &");
    5892             :   
    5893           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5894           0 :     SWIG_fail_ptr("KeySet_copy",1,SWIGTYPE_p_kdb__KeySet);
    5895             :   }
    5896             :   
    5897             :   
    5898           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__KeySet,0))){
    5899           0 :     SWIG_fail_ptr("KeySet_copy",2,SWIGTYPE_p_kdb__KeySet);
    5900             :   }
    5901             :   
    5902           0 :   (arg1)->copy((kdb::KeySet const &)*arg2);
    5903             :   
    5904             :   return SWIG_arg;
    5905             :   
    5906             :   if(0) SWIG_fail;
    5907             :   
    5908             : fail:
    5909           0 :   lua_error(L);
    5910             :   return SWIG_arg;
    5911             : }
    5912             : 
    5913             : 
    5914           0 : static int _wrap_KeySet_clear(lua_State* L) {
    5915           0 :   int SWIG_arg = 0;
    5916           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    5917             :   
    5918           0 :   SWIG_check_num_args("kdb::KeySet::clear",1,1)
    5919           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::clear",1,"kdb::KeySet *");
    5920             :   
    5921           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5922           0 :     SWIG_fail_ptr("KeySet_clear",1,SWIGTYPE_p_kdb__KeySet);
    5923             :   }
    5924             :   
    5925           0 :   (arg1)->clear();
    5926             :   
    5927             :   return SWIG_arg;
    5928             :   
    5929             :   if(0) SWIG_fail;
    5930             :   
    5931             : fail:
    5932           0 :   lua_error(L);
    5933             :   return SWIG_arg;
    5934             : }
    5935             : 
    5936             : 
    5937           8 : static int _wrap_KeySet_append__SWIG_0(lua_State* L) {
    5938           8 :   int SWIG_arg = 0;
    5939           8 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    5940           8 :   kdb::Key *arg2 = 0 ;
    5941             :   ssize_t result;
    5942             :   
    5943           8 :   SWIG_check_num_args("kdb::KeySet::append",2,2)
    5944           8 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::append",1,"kdb::KeySet *");
    5945           8 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KeySet::append",2,"kdb::Key const &");
    5946             :   
    5947           8 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5948           0 :     SWIG_fail_ptr("KeySet_append",1,SWIGTYPE_p_kdb__KeySet);
    5949             :   }
    5950             :   
    5951             :   
    5952           8 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    5953           0 :     SWIG_fail_ptr("KeySet_append",2,SWIGTYPE_p_kdb__Key);
    5954             :   }
    5955             :   
    5956          16 :   result = (arg1)->append((kdb::Key const &)*arg2);
    5957           8 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    5958             :   return SWIG_arg;
    5959             :   
    5960             :   if(0) SWIG_fail;
    5961             :   
    5962             : fail:
    5963           0 :   lua_error(L);
    5964             :   return SWIG_arg;
    5965             : }
    5966             : 
    5967             : 
    5968           0 : static int _wrap_KeySet_append__SWIG_1(lua_State* L) {
    5969           0 :   int SWIG_arg = 0;
    5970           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    5971           0 :   kdb::KeySet *arg2 = 0 ;
    5972             :   ssize_t result;
    5973             :   
    5974           0 :   SWIG_check_num_args("kdb::KeySet::append",2,2)
    5975           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::append",1,"kdb::KeySet *");
    5976           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KeySet::append",2,"kdb::KeySet const &");
    5977             :   
    5978           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    5979           0 :     SWIG_fail_ptr("KeySet_append",1,SWIGTYPE_p_kdb__KeySet);
    5980             :   }
    5981             :   
    5982             :   
    5983           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__KeySet,0))){
    5984           0 :     SWIG_fail_ptr("KeySet_append",2,SWIGTYPE_p_kdb__KeySet);
    5985             :   }
    5986             :   
    5987           0 :   result = (arg1)->append((kdb::KeySet const &)*arg2);
    5988           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    5989             :   return SWIG_arg;
    5990             :   
    5991             :   if(0) SWIG_fail;
    5992             :   
    5993             : fail:
    5994           0 :   lua_error(L);
    5995             :   return SWIG_arg;
    5996             : }
    5997             : 
    5998             : 
    5999           8 : static int _wrap_KeySet_append(lua_State* L) {
    6000             :   int argc;
    6001             :   int argv[3]={
    6002             :     1,2,3
    6003           8 :   };
    6004             :   
    6005           8 :   argc = lua_gettop(L);
    6006           8 :   if (argc == 2) {
    6007           8 :     int _v = 0;
    6008             :     {
    6009             :       {
    6010             :         void *ptr;
    6011           8 :         if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_kdb__Key, 0)) {
    6012             :           _v = 0;
    6013             :         } else {
    6014           8 :           _v = 1;
    6015             :         }
    6016             :       }
    6017             :     }
    6018           8 :     if (!_v) goto check_1;
    6019           8 :     return _wrap_KeySet_append__SWIG_0(L);
    6020             :   }
    6021             : check_1:
    6022             :   
    6023           0 :   if (argc == 2) {
    6024           0 :     return _wrap_KeySet_append__SWIG_1(L);
    6025             :   }
    6026             :   
    6027             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'KeySet_append'\n"
    6028             :     "  Possible C/C++ prototypes are:\n"
    6029             :     "    kdb::KeySet::append(kdb::Key const &)\n"
    6030           0 :     "    kdb::KeySet::append(kdb::KeySet const &)\n");
    6031           0 :   lua_error(L);return 0;
    6032             : }
    6033             : 
    6034             : 
    6035           0 : static int _wrap_KeySet_head(lua_State* L) {
    6036           0 :   int SWIG_arg = 0;
    6037           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6038           0 :   kdb::Key result;
    6039             :   
    6040           0 :   SWIG_check_num_args("kdb::KeySet::head",1,1)
    6041           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::head",1,"kdb::KeySet const *");
    6042             :   
    6043           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6044           0 :     SWIG_fail_ptr("KeySet_head",1,SWIGTYPE_p_kdb__KeySet);
    6045             :   }
    6046             :   
    6047           0 :   result = ((kdb::KeySet const *)arg1)->head();
    6048             :   {
    6049           0 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6050           0 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6051             :   }
    6052             :   return SWIG_arg;
    6053             :   
    6054             :   if(0) SWIG_fail;
    6055             :   
    6056             : fail:
    6057           0 :   lua_error(L);
    6058             :   return SWIG_arg;
    6059             : }
    6060             : 
    6061             : 
    6062           0 : static int _wrap_KeySet_tail(lua_State* L) {
    6063           0 :   int SWIG_arg = 0;
    6064           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6065           0 :   kdb::Key result;
    6066             :   
    6067           0 :   SWIG_check_num_args("kdb::KeySet::tail",1,1)
    6068           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::tail",1,"kdb::KeySet const *");
    6069             :   
    6070           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6071           0 :     SWIG_fail_ptr("KeySet_tail",1,SWIGTYPE_p_kdb__KeySet);
    6072             :   }
    6073             :   
    6074           0 :   result = ((kdb::KeySet const *)arg1)->tail();
    6075             :   {
    6076           0 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6077           0 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6078             :   }
    6079             :   return SWIG_arg;
    6080             :   
    6081             :   if(0) SWIG_fail;
    6082             :   
    6083             : fail:
    6084           0 :   lua_error(L);
    6085             :   return SWIG_arg;
    6086             : }
    6087             : 
    6088             : 
    6089           0 : static int _wrap_KeySet__rewind(lua_State* L) {
    6090           0 :   int SWIG_arg = 0;
    6091           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6092             :   
    6093           0 :   SWIG_check_num_args("kdb::KeySet::rewind",1,1)
    6094           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::rewind",1,"kdb::KeySet const *");
    6095             :   
    6096           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6097           0 :     SWIG_fail_ptr("KeySet__rewind",1,SWIGTYPE_p_kdb__KeySet);
    6098             :   }
    6099             :   
    6100           0 :   ((kdb::KeySet const *)arg1)->rewind();
    6101             :   
    6102             :   return SWIG_arg;
    6103             :   
    6104             :   if(0) SWIG_fail;
    6105             :   
    6106             : fail:
    6107           0 :   lua_error(L);
    6108             :   return SWIG_arg;
    6109             : }
    6110             : 
    6111             : 
    6112           0 : static int _wrap_KeySet__next(lua_State* L) {
    6113           0 :   int SWIG_arg = 0;
    6114           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6115           0 :   kdb::Key result;
    6116             :   
    6117           0 :   SWIG_check_num_args("kdb::KeySet::next",1,1)
    6118           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::next",1,"kdb::KeySet const *");
    6119             :   
    6120           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6121           0 :     SWIG_fail_ptr("KeySet__next",1,SWIGTYPE_p_kdb__KeySet);
    6122             :   }
    6123             :   
    6124           0 :   result = ((kdb::KeySet const *)arg1)->next();
    6125             :   {
    6126           0 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6127           0 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6128             :   }
    6129             :   return SWIG_arg;
    6130             :   
    6131             :   if(0) SWIG_fail;
    6132             :   
    6133             : fail:
    6134           0 :   lua_error(L);
    6135             :   return SWIG_arg;
    6136             : }
    6137             : 
    6138             : 
    6139           0 : static int _wrap_KeySet__current(lua_State* L) {
    6140           0 :   int SWIG_arg = 0;
    6141           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6142           0 :   kdb::Key result;
    6143             :   
    6144           0 :   SWIG_check_num_args("kdb::KeySet::current",1,1)
    6145           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::current",1,"kdb::KeySet const *");
    6146             :   
    6147           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6148           0 :     SWIG_fail_ptr("KeySet__current",1,SWIGTYPE_p_kdb__KeySet);
    6149             :   }
    6150             :   
    6151           0 :   result = ((kdb::KeySet const *)arg1)->current();
    6152             :   {
    6153           0 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6154           0 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6155             :   }
    6156             :   return SWIG_arg;
    6157             :   
    6158             :   if(0) SWIG_fail;
    6159             :   
    6160             : fail:
    6161           0 :   lua_error(L);
    6162             :   return SWIG_arg;
    6163             : }
    6164             : 
    6165             : 
    6166           0 : static int _wrap_KeySet_setCursor(lua_State* L) {
    6167           0 :   int SWIG_arg = 0;
    6168           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6169             :   cursor_t arg2 ;
    6170             :   
    6171           0 :   SWIG_check_num_args("kdb::KeySet::setCursor",2,2)
    6172           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::setCursor",1,"kdb::KeySet const *");
    6173           0 :   if(!lua_isnumber(L,2)) SWIG_fail_arg("kdb::KeySet::setCursor",2,"cursor_t");
    6174             :   
    6175           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6176           0 :     SWIG_fail_ptr("KeySet_setCursor",1,SWIGTYPE_p_kdb__KeySet);
    6177             :   }
    6178             :   
    6179           0 :   arg2 = (cursor_t)lua_tonumber(L, 2);
    6180           0 :   ((kdb::KeySet const *)arg1)->setCursor(arg2);
    6181             :   
    6182             :   return SWIG_arg;
    6183             :   
    6184             :   if(0) SWIG_fail;
    6185             :   
    6186             : fail:
    6187           0 :   lua_error(L);
    6188             :   return SWIG_arg;
    6189             : }
    6190             : 
    6191             : 
    6192           0 : static int _wrap_KeySet_getCursor(lua_State* L) {
    6193           0 :   int SWIG_arg = 0;
    6194           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6195             :   cursor_t result;
    6196             :   
    6197           0 :   SWIG_check_num_args("kdb::KeySet::getCursor",1,1)
    6198           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::getCursor",1,"kdb::KeySet const *");
    6199             :   
    6200           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6201           0 :     SWIG_fail_ptr("KeySet_getCursor",1,SWIGTYPE_p_kdb__KeySet);
    6202             :   }
    6203             :   
    6204           0 :   result = ((kdb::KeySet const *)arg1)->getCursor();
    6205           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    6206             :   return SWIG_arg;
    6207             :   
    6208             :   if(0) SWIG_fail;
    6209             :   
    6210             : fail:
    6211           0 :   lua_error(L);
    6212             :   return SWIG_arg;
    6213             : }
    6214             : 
    6215             : 
    6216           1 : static int _wrap_KeySet_pop(lua_State* L) {
    6217           1 :   int SWIG_arg = 0;
    6218           1 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6219           2 :   kdb::Key result;
    6220             :   
    6221           1 :   SWIG_check_num_args("kdb::KeySet::pop",1,1)
    6222           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::pop",1,"kdb::KeySet *");
    6223             :   
    6224           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6225           0 :     SWIG_fail_ptr("KeySet_pop",1,SWIGTYPE_p_kdb__KeySet);
    6226             :   }
    6227             :   
    6228           4 :   result = (arg1)->pop();
    6229             :   {
    6230           2 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6231           1 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6232             :   }
    6233             :   return SWIG_arg;
    6234             :   
    6235             :   if(0) SWIG_fail;
    6236             :   
    6237             : fail:
    6238           0 :   lua_error(L);
    6239             :   return SWIG_arg;
    6240             : }
    6241             : 
    6242             : 
    6243           4 : static int _wrap_KeySet__lookup__SWIG_0(lua_State* L) {
    6244           4 :   int SWIG_arg = 0;
    6245           4 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6246             :   cursor_t arg2 ;
    6247           8 :   kdb::Key result;
    6248             :   
    6249           4 :   SWIG_check_num_args("kdb::KeySet::at",2,2)
    6250           4 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::at",1,"kdb::KeySet const *");
    6251           4 :   if(!lua_isnumber(L,2)) SWIG_fail_arg("kdb::KeySet::at",2,"cursor_t");
    6252             :   
    6253           4 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6254           0 :     SWIG_fail_ptr("KeySet__lookup",1,SWIGTYPE_p_kdb__KeySet);
    6255             :   }
    6256             :   
    6257           4 :   arg2 = (cursor_t)lua_tonumber(L, 2);
    6258          12 :   result = ((kdb::KeySet const *)arg1)->at(arg2);
    6259             :   {
    6260           8 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6261           4 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6262             :   }
    6263             :   return SWIG_arg;
    6264             :   
    6265             :   if(0) SWIG_fail;
    6266             :   
    6267             : fail:
    6268           0 :   lua_error(L);
    6269             :   return SWIG_arg;
    6270             : }
    6271             : 
    6272             : 
    6273           1 : static int _wrap_KeySet_cut(lua_State* L) {
    6274           1 :   int SWIG_arg = 0;
    6275           1 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6276           2 :   kdb::Key arg2 ;
    6277             :   kdb::Key *argp2 ;
    6278           2 :   kdb::KeySet result;
    6279             :   
    6280           1 :   SWIG_check_num_args("kdb::KeySet::cut",2,2)
    6281           1 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::cut",1,"kdb::KeySet *");
    6282           1 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KeySet::cut",2,"kdb::Key");
    6283             :   
    6284           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6285           0 :     SWIG_fail_ptr("KeySet_cut",1,SWIGTYPE_p_kdb__KeySet);
    6286             :   }
    6287             :   
    6288             :   
    6289           1 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_kdb__Key,0))){
    6290           0 :     SWIG_fail_ptr("KeySet_cut",2,SWIGTYPE_p_kdb__Key);
    6291             :   }
    6292           2 :   arg2 = *argp2;
    6293             :   
    6294           5 :   result = (arg1)->cut(arg2);
    6295             :   {
    6296           2 :     kdb::KeySet * resultptr = new kdb::KeySet((const kdb::KeySet &) result);
    6297           1 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__KeySet,1); SWIG_arg++;
    6298             :   }
    6299             :   return SWIG_arg;
    6300             :   
    6301             :   if(0) SWIG_fail;
    6302             :   
    6303             : fail:
    6304           0 :   lua_error(L);
    6305             :   return SWIG_arg;
    6306             : }
    6307             : 
    6308             : 
    6309           0 : static int _wrap_KeySet__lookup__SWIG_1(lua_State* L) {
    6310           0 :   int SWIG_arg = 0;
    6311           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6312           0 :   kdb::Key *arg2 = 0 ;
    6313             :   option_t arg3 ;
    6314             :   option_t *argp3 ;
    6315           0 :   kdb::Key result;
    6316             :   
    6317           0 :   SWIG_check_num_args("kdb::KeySet::lookup",3,3)
    6318           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::lookup",1,"kdb::KeySet const *");
    6319           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KeySet::lookup",2,"kdb::Key const &");
    6320           0 :   if(!lua_isuserdata(L,3)) SWIG_fail_arg("kdb::KeySet::lookup",3,"option_t const");
    6321             :   
    6322           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6323           0 :     SWIG_fail_ptr("KeySet__lookup",1,SWIGTYPE_p_kdb__KeySet);
    6324             :   }
    6325             :   
    6326             :   
    6327           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    6328           0 :     SWIG_fail_ptr("KeySet__lookup",2,SWIGTYPE_p_kdb__Key);
    6329             :   }
    6330             :   
    6331             :   
    6332           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_option_t,0))){
    6333           0 :     SWIG_fail_ptr("KeySet__lookup",3,SWIGTYPE_p_option_t);
    6334             :   }
    6335           0 :   arg3 = *argp3;
    6336             :   
    6337           0 :   result = ((kdb::KeySet const *)arg1)->lookup((kdb::Key const &)*arg2,arg3);
    6338             :   {
    6339           0 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6340           0 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6341             :   }
    6342             :   return SWIG_arg;
    6343             :   
    6344             :   if(0) SWIG_fail;
    6345             :   
    6346             : fail:
    6347           0 :   lua_error(L);
    6348             :   return SWIG_arg;
    6349             : }
    6350             : 
    6351             : 
    6352           3 : static int _wrap_KeySet__lookup__SWIG_2(lua_State* L) {
    6353           3 :   int SWIG_arg = 0;
    6354           3 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6355           3 :   kdb::Key *arg2 = 0 ;
    6356           6 :   kdb::Key result;
    6357             :   
    6358           3 :   SWIG_check_num_args("kdb::KeySet::lookup",2,2)
    6359           3 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::lookup",1,"kdb::KeySet const *");
    6360           3 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KeySet::lookup",2,"kdb::Key const &");
    6361             :   
    6362           3 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6363           0 :     SWIG_fail_ptr("KeySet__lookup",1,SWIGTYPE_p_kdb__KeySet);
    6364             :   }
    6365             :   
    6366             :   
    6367           3 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    6368           0 :     SWIG_fail_ptr("KeySet__lookup",2,SWIGTYPE_p_kdb__Key);
    6369             :   }
    6370             :   
    6371          12 :   result = ((kdb::KeySet const *)arg1)->lookup((kdb::Key const &)*arg2);
    6372             :   {
    6373           6 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6374           3 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6375             :   }
    6376             :   return SWIG_arg;
    6377             :   
    6378             :   if(0) SWIG_fail;
    6379             :   
    6380             : fail:
    6381           0 :   lua_error(L);
    6382             :   return SWIG_arg;
    6383             : }
    6384             : 
    6385             : 
    6386           0 : static int _wrap_KeySet__lookup__SWIG_3(lua_State* L) {
    6387           0 :   int SWIG_arg = 0;
    6388           0 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6389           0 :   std::string *arg2 = 0 ;
    6390             :   option_t arg3 ;
    6391           0 :   std::string temp2 ;
    6392             :   option_t *argp3 ;
    6393           0 :   kdb::Key result;
    6394             :   
    6395           0 :   SWIG_check_num_args("kdb::KeySet::lookup",3,3)
    6396           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::lookup",1,"kdb::KeySet const *");
    6397           0 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::KeySet::lookup",2,"std::string const &");
    6398           0 :   if(!lua_isuserdata(L,3)) SWIG_fail_arg("kdb::KeySet::lookup",3,"option_t const");
    6399             :   
    6400           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6401           0 :     SWIG_fail_ptr("KeySet__lookup",1,SWIGTYPE_p_kdb__KeySet);
    6402             :   }
    6403             :   
    6404           0 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    6405             :   
    6406           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_option_t,0))){
    6407           0 :     SWIG_fail_ptr("KeySet__lookup",3,SWIGTYPE_p_option_t);
    6408             :   }
    6409           0 :   arg3 = *argp3;
    6410             :   
    6411           0 :   result = ((kdb::KeySet const *)arg1)->lookup((std::string const &)*arg2,arg3);
    6412             :   {
    6413           0 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6414           0 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6415             :   }
    6416             :   return SWIG_arg;
    6417             :   
    6418             :   if(0) SWIG_fail;
    6419             :   
    6420             : fail:
    6421           0 :   lua_error(L);
    6422             :   return SWIG_arg;
    6423             : }
    6424             : 
    6425             : 
    6426           6 : static int _wrap_KeySet__lookup__SWIG_4(lua_State* L) {
    6427           6 :   int SWIG_arg = 0;
    6428           6 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6429           6 :   std::string *arg2 = 0 ;
    6430          12 :   std::string temp2 ;
    6431          12 :   kdb::Key result;
    6432             :   
    6433           6 :   SWIG_check_num_args("kdb::KeySet::lookup",2,2)
    6434           6 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::lookup",1,"kdb::KeySet const *");
    6435           6 :   if(!lua_isstring(L,2)) SWIG_fail_arg("kdb::KeySet::lookup",2,"std::string const &");
    6436             :   
    6437           6 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6438           0 :     SWIG_fail_ptr("KeySet__lookup",1,SWIGTYPE_p_kdb__KeySet);
    6439             :   }
    6440             :   
    6441          12 :   temp2.assign(lua_tostring(L,2),lua_rawlen(L,2)); arg2=&temp2;
    6442          24 :   result = ((kdb::KeySet const *)arg1)->lookup((std::string const &)*arg2);
    6443             :   {
    6444          12 :     kdb::Key * resultptr = new kdb::Key((const kdb::Key &) result);
    6445           6 :     SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_kdb__Key,1); SWIG_arg++;
    6446             :   }
    6447             :   return SWIG_arg;
    6448             :   
    6449             :   if(0) SWIG_fail;
    6450             :   
    6451             : fail:
    6452           0 :   lua_error(L);
    6453             :   return SWIG_arg;
    6454             : }
    6455             : 
    6456             : 
    6457          13 : static int _wrap_KeySet__lookup(lua_State* L) {
    6458             :   int argc;
    6459             :   int argv[4]={
    6460             :     1,2,3,4
    6461          13 :   };
    6462             :   
    6463          13 :   argc = lua_gettop(L);
    6464          13 :   if (argc == 2) {
    6465          13 :     int _v = 0;
    6466             :     {
    6467             :       {
    6468             :         void *ptr;
    6469          13 :         if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_kdb__Key, 0)) {
    6470             :           _v = 0;
    6471             :         } else {
    6472           3 :           _v = 1;
    6473             :         }
    6474             :       }
    6475             :     }
    6476          13 :     if (!_v) goto check_1;
    6477           3 :     return _wrap_KeySet__lookup__SWIG_2(L);
    6478             :   }
    6479             : check_1:
    6480             :   
    6481          10 :   if (argc == 2) {
    6482          10 :     int _v = 0;
    6483             :     {
    6484             :       {
    6485          10 :         _v = lua_isnumber(L,argv[1]);
    6486             :       }
    6487             :     }
    6488          10 :     if (!_v) goto check_2;
    6489           4 :     return _wrap_KeySet__lookup__SWIG_0(L);
    6490             :   }
    6491             : check_2:
    6492             :   
    6493           6 :   if (argc == 2) {
    6494           6 :     return _wrap_KeySet__lookup__SWIG_4(L);
    6495             :   }
    6496           0 :   if (argc == 3) {
    6497           0 :     int _v = 0;
    6498             :     {
    6499             :       {
    6500             :         void *ptr;
    6501           0 :         if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_kdb__Key, 0)) {
    6502             :           _v = 0;
    6503             :         } else {
    6504           0 :           _v = 1;
    6505             :         }
    6506             :       }
    6507             :     }
    6508           0 :     if (!_v) goto check_4;
    6509           0 :     return _wrap_KeySet__lookup__SWIG_1(L);
    6510             :   }
    6511             : check_4:
    6512             :   
    6513           0 :   if (argc == 3) {
    6514           0 :     return _wrap_KeySet__lookup__SWIG_3(L);
    6515             :   }
    6516             :   
    6517             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'KeySet__lookup'\n"
    6518             :     "  Possible C/C++ prototypes are:\n"
    6519             :     "    kdb::KeySet::at(cursor_t) const\n"
    6520             :     "    kdb::KeySet::lookup(kdb::Key const &,option_t const) const\n"
    6521             :     "    kdb::KeySet::lookup(kdb::Key const &) const\n"
    6522             :     "    kdb::KeySet::lookup(std::string const &,option_t const) const\n"
    6523           0 :     "    kdb::KeySet::lookup(std::string const &) const\n");
    6524           0 :   lua_error(L);return 0;
    6525             : }
    6526             : 
    6527             : 
    6528           9 : static int _wrap_new_KeySet__SWIG_3(lua_State* L) {
    6529           9 :   int SWIG_arg = 0;
    6530             :   size_t arg1 ;
    6531           9 :   kdb::KeySet *result = 0 ;
    6532             :   
    6533           9 :   SWIG_check_num_args("kdb::KeySet::KeySet",1,1)
    6534           9 :   if(!lua_isnumber(L,1)) SWIG_fail_arg("kdb::KeySet::KeySet",1,"size_t");
    6535           9 :   SWIG_contract_assert((lua_tonumber(L,1)>=0),"number must not be negative")
    6536           9 :   arg1 = (size_t)lua_tonumber(L, 1);
    6537           9 :   result = (kdb::KeySet *)new_kdb_KeySet__SWIG_3(arg1);
    6538           9 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__KeySet,1); SWIG_arg++; 
    6539           9 :   return SWIG_arg;
    6540             :   
    6541             :   if(0) SWIG_fail;
    6542             :   
    6543             : fail:
    6544           0 :   lua_error(L);
    6545           0 :   return SWIG_arg;
    6546             : }
    6547             : 
    6548             : 
    6549          19 : static int _wrap_new_KeySet(lua_State* L) {
    6550             :   int argc;
    6551             :   int argv[2]={
    6552             :     1,2
    6553          19 :   };
    6554             :   
    6555          19 :   argc = lua_gettop(L);
    6556          19 :   if (argc == 0) {
    6557           0 :     return _wrap_new_KeySet__SWIG_0(L);
    6558             :   }
    6559          19 :   if (argc == 1) {
    6560          19 :     int _v = 0;
    6561             :     {
    6562             :       {
    6563             :         void *ptr;
    6564          19 :         if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p__KeySet, 0)) {
    6565             :           _v = 0;
    6566             :         } else {
    6567           9 :           _v = 1;
    6568             :         }
    6569             :       }
    6570             :     }
    6571          19 :     if (!_v) goto check_2;
    6572           9 :     return _wrap_new_KeySet__SWIG_1(L);
    6573             :   }
    6574             : check_2:
    6575             :   
    6576          10 :   if (argc == 1) {
    6577          10 :     int _v = 0;
    6578             :     {
    6579             :       {
    6580             :         void *ptr;
    6581          10 :         if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_kdb__KeySet, 0)) {
    6582             :           _v = 0;
    6583             :         } else {
    6584           1 :           _v = 1;
    6585             :         }
    6586             :       }
    6587             :     }
    6588          10 :     if (!_v) goto check_3;
    6589           1 :     return _wrap_new_KeySet__SWIG_2(L);
    6590             :   }
    6591             : check_3:
    6592             :   
    6593           9 :   if (argc == 1) {
    6594           9 :     return _wrap_new_KeySet__SWIG_3(L);
    6595             :   }
    6596             :   
    6597             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_KeySet'\n"
    6598             :     "  Possible C/C++ prototypes are:\n"
    6599             :     "    kdb::KeySet::KeySet()\n"
    6600             :     "    kdb::KeySet::KeySet(ckdb::KeySet *)\n"
    6601             :     "    kdb::KeySet::KeySet(kdb::KeySet const &)\n"
    6602           0 :     "    kdb::KeySet::KeySet(size_t)\n");
    6603           0 :   lua_error(L);return 0;
    6604             : }
    6605             : 
    6606             : 
    6607           7 : static int _wrap_KeySet___len(lua_State* L) {
    6608           7 :   int SWIG_arg = 0;
    6609           7 :   kdb::KeySet *arg1 = (kdb::KeySet *) 0 ;
    6610           7 :   void *arg2 = (void *) 0 ;
    6611             :   size_t result;
    6612             :   
    6613           7 :   SWIG_check_num_args("kdb::KeySet::__len",2,2)
    6614           7 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KeySet::__len",1,"kdb::KeySet *");
    6615           7 :   if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("kdb::KeySet::__len",2,"void *");
    6616             :   
    6617           7 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6618           0 :     SWIG_fail_ptr("KeySet___len",1,SWIGTYPE_p_kdb__KeySet);
    6619             :   }
    6620             :   
    6621           7 :   arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"KeySet___len");
    6622          14 :   result = kdb_KeySet___len(arg1,arg2);
    6623           7 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    6624             :   return SWIG_arg;
    6625             :   
    6626             :   if(0) SWIG_fail;
    6627             :   
    6628             : fail:
    6629           0 :   lua_error(L);
    6630             :   return SWIG_arg;
    6631             : }
    6632             : 
    6633             : 
    6634          20 : static void swig_delete_KeySet(void *obj) {
    6635          20 : kdb::KeySet *arg1 = (kdb::KeySet *) obj;
    6636          40 : delete arg1;
    6637          20 : }
    6638          19 : static int _proxy__wrap_new_KeySet(lua_State *L) {
    6639             :     assert(lua_istable(L,1));
    6640          19 :     lua_pushcfunction(L,_wrap_new_KeySet);
    6641             :     assert(!lua_isnil(L,-1));
    6642          19 :     lua_replace(L,1); /* replace our table with real constructor */
    6643          19 :     lua_call(L,lua_gettop(L)-1,1);
    6644          19 :     return 1;
    6645             : }
    6646             : static swig_lua_attribute swig_KeySet_attributes[] = {
    6647             :     {0,0,0}
    6648             : };
    6649             : static swig_lua_method swig_KeySet_methods[]= {
    6650             :     { "release", _wrap_KeySet_release},
    6651             :     { "getKeySet", _wrap_KeySet_getKeySet},
    6652             :     { "setKeySet", _wrap_KeySet_setKeySet},
    6653             :     { "dup", _wrap_KeySet_dup},
    6654             :     { "copy", _wrap_KeySet_copy},
    6655             :     { "clear", _wrap_KeySet_clear},
    6656             :     { "append", _wrap_KeySet_append},
    6657             :     { "head", _wrap_KeySet_head},
    6658             :     { "tail", _wrap_KeySet_tail},
    6659             :     { "_rewind", _wrap_KeySet__rewind},
    6660             :     { "_next", _wrap_KeySet__next},
    6661             :     { "_current", _wrap_KeySet__current},
    6662             :     { "setCursor", _wrap_KeySet_setCursor},
    6663             :     { "getCursor", _wrap_KeySet_getCursor},
    6664             :     { "pop", _wrap_KeySet_pop},
    6665             :     { "cut", _wrap_KeySet_cut},
    6666             :     { "_lookup", _wrap_KeySet__lookup},
    6667             :     { "__len", _wrap_KeySet___len},
    6668             :     {0,0}
    6669             : };
    6670             : static swig_lua_method swig_KeySet_meta[] = {
    6671             :     { "__len", _wrap_KeySet___len},
    6672             :     {0,0}
    6673             : };
    6674             : 
    6675             : static swig_lua_attribute swig_KeySet_Sf_SwigStatic_attributes[] = {
    6676             :     {0,0,0}
    6677             : };
    6678             : static swig_lua_const_info swig_KeySet_Sf_SwigStatic_constants[]= {
    6679             :     {0,0,0,0,0,0}
    6680             : };
    6681             : static swig_lua_method swig_KeySet_Sf_SwigStatic_methods[]= {
    6682             :     {0,0}
    6683             : };
    6684             : static swig_lua_class* swig_KeySet_Sf_SwigStatic_classes[]= {
    6685             :     0
    6686             : };
    6687             : 
    6688             : static swig_lua_namespace swig_KeySet_Sf_SwigStatic = {
    6689             :     "KeySet",
    6690             :     swig_KeySet_Sf_SwigStatic_methods,
    6691             :     swig_KeySet_Sf_SwigStatic_attributes,
    6692             :     swig_KeySet_Sf_SwigStatic_constants,
    6693             :     swig_KeySet_Sf_SwigStatic_classes,
    6694             :     0
    6695             : };
    6696             : static swig_lua_class *swig_KeySet_bases[] = {0};
    6697             : static const char *swig_KeySet_base_names[] = {0};
    6698             : static swig_lua_class _wrap_class_KeySet = { "KeySet", "KeySet", &SWIGTYPE_p_kdb__KeySet,_proxy__wrap_new_KeySet, swig_delete_KeySet, swig_KeySet_methods, swig_KeySet_attributes, &swig_KeySet_Sf_SwigStatic, swig_KeySet_meta, swig_KeySet_bases, swig_KeySet_base_names };
    6699             : 
    6700           0 : static int _wrap___eq(lua_State* L) {
    6701           0 :   int SWIG_arg = 0;
    6702           0 :   kdb::KeySet *arg1 = 0 ;
    6703           0 :   kdb::KeySet *arg2 = 0 ;
    6704             :   bool result;
    6705             :   
    6706           0 :   SWIG_check_num_args("kdb::operator ==",2,2)
    6707           0 :   if(!lua_isuserdata(L,1)) SWIG_fail_arg("kdb::operator ==",1,"kdb::KeySet const &");
    6708           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::operator ==",2,"kdb::KeySet const &");
    6709             :   
    6710           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KeySet,0))){
    6711           0 :     SWIG_fail_ptr("__eq",1,SWIGTYPE_p_kdb__KeySet);
    6712             :   }
    6713             :   
    6714             :   
    6715           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__KeySet,0))){
    6716           0 :     SWIG_fail_ptr("__eq",2,SWIGTYPE_p_kdb__KeySet);
    6717             :   }
    6718             :   
    6719           0 :   result = (bool)kdb::operator ==((kdb::KeySet const &)*arg1,(kdb::KeySet const &)*arg2);
    6720           0 :   lua_pushboolean(L,(int)(result!=0)); SWIG_arg++;
    6721             :   return SWIG_arg;
    6722             :   
    6723             :   if(0) SWIG_fail;
    6724             :   
    6725             : fail:
    6726           0 :   lua_error(L);
    6727             :   return SWIG_arg;
    6728             : }
    6729             : 
    6730             : 
    6731           5 : static int _wrap_new_KDB__SWIG_0(lua_State* L) {
    6732           5 :   int SWIG_arg = 0;
    6733           5 :   kdb::KDB *result = 0 ;
    6734             :   
    6735           5 :   SWIG_check_num_args("kdb::KDB::KDB",0,0)
    6736             :   {
    6737             :     try {
    6738           5 :       result = (kdb::KDB *)new kdb::KDB();    
    6739           0 :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    6740           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    6741           0 :     }    catch (...) {
    6742           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::KDB()");    
    6743             :     }
    6744             :   }
    6745           5 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__KDB,1); SWIG_arg++; 
    6746           5 :   return SWIG_arg;
    6747             :   
    6748             :   if(0) SWIG_fail;
    6749             :   
    6750             : fail:
    6751           0 :   lua_error(L);
    6752           0 :   return SWIG_arg;
    6753             : }
    6754             : 
    6755             : 
    6756           2 : static int _wrap_new_KDB__SWIG_1(lua_State* L) {
    6757           2 :   int SWIG_arg = 0;
    6758           2 :   kdb::Key *arg1 = 0 ;
    6759           2 :   kdb::KDB *result = 0 ;
    6760             :   
    6761           2 :   SWIG_check_num_args("kdb::KDB::KDB",1,1)
    6762           2 :   if(!lua_isuserdata(L,1)) SWIG_fail_arg("kdb::KDB::KDB",1,"kdb::Key &");
    6763             :   
    6764           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__Key,0))){
    6765           0 :     SWIG_fail_ptr("new_KDB",1,SWIGTYPE_p_kdb__Key);
    6766             :   }
    6767             :   
    6768             :   {
    6769             :     try {
    6770           4 :       result = (kdb::KDB *)new kdb::KDB(*arg1);    
    6771           0 :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    6772           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    6773           0 :     }    catch (...) {
    6774           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::KDB(kdb::Key &)");    
    6775             :     }
    6776             :   }
    6777           2 :   SWIG_NewPointerObj(L,result,SWIGTYPE_p_kdb__KDB,1); SWIG_arg++; 
    6778             :   return SWIG_arg;
    6779             :   
    6780             :   if(0) SWIG_fail;
    6781             :   
    6782             : fail:
    6783           0 :   lua_error(L);
    6784             :   return SWIG_arg;
    6785             : }
    6786             : 
    6787             : 
    6788           7 : static int _wrap_new_KDB(lua_State* L) {
    6789             :   int argc;
    6790             :   int argv[2]={
    6791             :     1,2
    6792           7 :   };
    6793             :   
    6794           7 :   argc = lua_gettop(L);
    6795           7 :   if (argc == 0) {
    6796           5 :     return _wrap_new_KDB__SWIG_0(L);
    6797             :   }
    6798           2 :   if (argc == 1) {
    6799           2 :     return _wrap_new_KDB__SWIG_1(L);
    6800             :   }
    6801             :   
    6802             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'new_KDB'\n"
    6803             :     "  Possible C/C++ prototypes are:\n"
    6804             :     "    kdb::KDB::KDB()\n"
    6805           0 :     "    kdb::KDB::KDB(kdb::Key &)\n");
    6806           0 :   lua_error(L);return 0;
    6807             : }
    6808             : 
    6809             : 
    6810           0 : static int _wrap_KDB_open(lua_State* L) {
    6811           0 :   int SWIG_arg = 0;
    6812           0 :   kdb::KDB *arg1 = (kdb::KDB *) 0 ;
    6813           0 :   kdb::Key *arg2 = 0 ;
    6814             :   
    6815           0 :   SWIG_check_num_args("kdb::KDB::open",2,2)
    6816           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KDB::open",1,"kdb::KDB *");
    6817           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KDB::open",2,"kdb::Key &");
    6818             :   
    6819           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KDB,0))){
    6820           0 :     SWIG_fail_ptr("KDB_open",1,SWIGTYPE_p_kdb__KDB);
    6821             :   }
    6822             :   
    6823             :   
    6824           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    6825           0 :     SWIG_fail_ptr("KDB_open",2,SWIGTYPE_p_kdb__Key);
    6826             :   }
    6827             :   
    6828             :   {
    6829             :     try {
    6830           0 :       (arg1)->open(*arg2);    
    6831           0 :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    6832           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    6833           0 :     }    catch (...) {
    6834           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::open(kdb::Key &)");    
    6835             :     }
    6836             :   }
    6837             :   
    6838             :   return SWIG_arg;
    6839             :   
    6840             :   if(0) SWIG_fail;
    6841             :   
    6842             : fail:
    6843           0 :   lua_error(L);
    6844             :   return SWIG_arg;
    6845             : }
    6846             : 
    6847             : 
    6848           0 : static int _wrap_KDB_close__SWIG_0(lua_State* L) {
    6849           0 :   int SWIG_arg = 0;
    6850           0 :   kdb::KDB *arg1 = (kdb::KDB *) 0 ;
    6851             :   
    6852           0 :   SWIG_check_num_args("kdb::KDB::close",1,1)
    6853           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KDB::close",1,"kdb::KDB *");
    6854             :   
    6855           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KDB,0))){
    6856           0 :     SWIG_fail_ptr("KDB_close",1,SWIGTYPE_p_kdb__KDB);
    6857             :   }
    6858             :   
    6859             :   {
    6860             :     try {
    6861           0 :       (arg1)->close();    
    6862             :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    6863             :       SWIG_exception(SWIG_RuntimeError, e.what());    
    6864             :     }    catch (...) {
    6865             :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::close()");    
    6866             :     }
    6867             :   }
    6868             :   
    6869           0 :   return SWIG_arg;
    6870             :   
    6871             :   if(0) SWIG_fail;
    6872             :   
    6873             : fail:
    6874           0 :   lua_error(L);
    6875             :   return SWIG_arg;
    6876             : }
    6877             : 
    6878             : 
    6879           0 : static int _wrap_KDB_close__SWIG_1(lua_State* L) {
    6880           0 :   int SWIG_arg = 0;
    6881           0 :   kdb::KDB *arg1 = (kdb::KDB *) 0 ;
    6882           0 :   kdb::Key *arg2 = 0 ;
    6883             :   
    6884           0 :   SWIG_check_num_args("kdb::KDB::close",2,2)
    6885           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KDB::close",1,"kdb::KDB *");
    6886           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KDB::close",2,"kdb::Key &");
    6887             :   
    6888           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KDB,0))){
    6889           0 :     SWIG_fail_ptr("KDB_close",1,SWIGTYPE_p_kdb__KDB);
    6890             :   }
    6891             :   
    6892             :   
    6893           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__Key,0))){
    6894           0 :     SWIG_fail_ptr("KDB_close",2,SWIGTYPE_p_kdb__Key);
    6895             :   }
    6896             :   
    6897             :   {
    6898             :     try {
    6899           0 :       (arg1)->close(*arg2);    
    6900             :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    6901             :       SWIG_exception(SWIG_RuntimeError, e.what());    
    6902             :     }    catch (...) {
    6903             :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::close(kdb::Key &)");    
    6904             :     }
    6905             :   }
    6906             :   
    6907           0 :   return SWIG_arg;
    6908             :   
    6909             :   if(0) SWIG_fail;
    6910             :   
    6911             : fail:
    6912           0 :   lua_error(L);
    6913             :   return SWIG_arg;
    6914             : }
    6915             : 
    6916             : 
    6917           0 : static int _wrap_KDB_close(lua_State* L) {
    6918             :   int argc;
    6919             :   int argv[3]={
    6920             :     1,2,3
    6921           0 :   };
    6922             :   
    6923           0 :   argc = lua_gettop(L);
    6924           0 :   if (argc == 1) {
    6925           0 :     return _wrap_KDB_close__SWIG_0(L);
    6926             :   }
    6927           0 :   if (argc == 2) {
    6928           0 :     return _wrap_KDB_close__SWIG_1(L);
    6929             :   }
    6930             :   
    6931             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'KDB_close'\n"
    6932             :     "  Possible C/C++ prototypes are:\n"
    6933             :     "    kdb::KDB::close()\n"
    6934           0 :     "    kdb::KDB::close(kdb::Key &)\n");
    6935           0 :   lua_error(L);return 0;
    6936             : }
    6937             : 
    6938             : 
    6939           4 : static int _wrap_KDB_get__SWIG_0(lua_State* L) {
    6940           4 :   int SWIG_arg = 0;
    6941           4 :   kdb::KDB *arg1 = (kdb::KDB *) 0 ;
    6942           4 :   kdb::KeySet *arg2 = 0 ;
    6943           4 :   std::string *arg3 = 0 ;
    6944           8 :   std::string temp3 ;
    6945             :   int result;
    6946             :   
    6947           4 :   SWIG_check_num_args("kdb::KDB::get",3,3)
    6948           4 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KDB::get",1,"kdb::KDB *");
    6949           4 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KDB::get",2,"kdb::KeySet &");
    6950           4 :   if(!lua_isstring(L,3)) SWIG_fail_arg("kdb::KDB::get",3,"std::string const &");
    6951             :   
    6952           4 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KDB,0))){
    6953           0 :     SWIG_fail_ptr("KDB_get",1,SWIGTYPE_p_kdb__KDB);
    6954             :   }
    6955             :   
    6956             :   
    6957           4 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__KeySet,0))){
    6958           0 :     SWIG_fail_ptr("KDB_get",2,SWIGTYPE_p_kdb__KeySet);
    6959             :   }
    6960             :   
    6961           8 :   temp3.assign(lua_tostring(L,3),lua_rawlen(L,3)); arg3=&temp3;
    6962             :   {
    6963             :     try {
    6964           4 :       result = (int)(arg1)->get(*arg2,(std::string const &)*arg3);    
    6965           0 :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    6966           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    6967           0 :     }    catch (...) {
    6968           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::get(kdb::KeySet &,std::string const &)");    
    6969             :     }
    6970             :   }
    6971           4 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    6972             :   return SWIG_arg;
    6973             :   
    6974             :   if(0) SWIG_fail;
    6975             :   
    6976             : fail:
    6977           0 :   lua_error(L);
    6978             :   return SWIG_arg;
    6979             : }
    6980             : 
    6981             : 
    6982           0 : static int _wrap_KDB_get__SWIG_1(lua_State* L) {
    6983           0 :   int SWIG_arg = 0;
    6984           0 :   kdb::KDB *arg1 = (kdb::KDB *) 0 ;
    6985           0 :   kdb::KeySet *arg2 = 0 ;
    6986           0 :   kdb::Key *arg3 = 0 ;
    6987             :   int result;
    6988             :   
    6989           0 :   SWIG_check_num_args("kdb::KDB::get",3,3)
    6990           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KDB::get",1,"kdb::KDB *");
    6991           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KDB::get",2,"kdb::KeySet &");
    6992           0 :   if(!lua_isuserdata(L,3)) SWIG_fail_arg("kdb::KDB::get",3,"kdb::Key &");
    6993             :   
    6994           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KDB,0))){
    6995           0 :     SWIG_fail_ptr("KDB_get",1,SWIGTYPE_p_kdb__KDB);
    6996             :   }
    6997             :   
    6998             :   
    6999           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__KeySet,0))){
    7000           0 :     SWIG_fail_ptr("KDB_get",2,SWIGTYPE_p_kdb__KeySet);
    7001             :   }
    7002             :   
    7003             :   
    7004           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_kdb__Key,0))){
    7005           0 :     SWIG_fail_ptr("KDB_get",3,SWIGTYPE_p_kdb__Key);
    7006             :   }
    7007             :   
    7008             :   {
    7009             :     try {
    7010           0 :       result = (int)(arg1)->get(*arg2,*arg3);    
    7011           0 :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    7012           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    7013           0 :     }    catch (...) {
    7014           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::get(kdb::KeySet &,kdb::Key &)");    
    7015             :     }
    7016             :   }
    7017           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    7018             :   return SWIG_arg;
    7019             :   
    7020             :   if(0) SWIG_fail;
    7021             :   
    7022             : fail:
    7023           0 :   lua_error(L);
    7024             :   return SWIG_arg;
    7025             : }
    7026             : 
    7027             : 
    7028           4 : static int _wrap_KDB_get(lua_State* L) {
    7029             :   int argc;
    7030             :   int argv[4]={
    7031             :     1,2,3,4
    7032           4 :   };
    7033             :   
    7034           4 :   argc = lua_gettop(L);
    7035           4 :   if (argc == 3) {
    7036           4 :     int _v = 0;
    7037             :     {
    7038             :       {
    7039             :         void *ptr;
    7040           4 :         if (lua_isuserdata(L,argv[2])==0 || SWIG_ConvertPtr(L,argv[2], (void **) &ptr, SWIGTYPE_p_kdb__Key, 0)) {
    7041             :           _v = 0;
    7042             :         } else {
    7043           0 :           _v = 1;
    7044             :         }
    7045             :       }
    7046             :     }
    7047           4 :     if (!_v) goto check_1;
    7048           0 :     return _wrap_KDB_get__SWIG_1(L);
    7049             :   }
    7050             : check_1:
    7051             :   
    7052           4 :   if (argc == 3) {
    7053           4 :     return _wrap_KDB_get__SWIG_0(L);
    7054             :   }
    7055             :   
    7056             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'KDB_get'\n"
    7057             :     "  Possible C/C++ prototypes are:\n"
    7058             :     "    kdb::KDB::get(kdb::KeySet &,std::string const &)\n"
    7059           0 :     "    kdb::KDB::get(kdb::KeySet &,kdb::Key &)\n");
    7060           0 :   lua_error(L);return 0;
    7061             : }
    7062             : 
    7063             : 
    7064           2 : static int _wrap_KDB_set__SWIG_0(lua_State* L) {
    7065           2 :   int SWIG_arg = 0;
    7066           2 :   kdb::KDB *arg1 = (kdb::KDB *) 0 ;
    7067           2 :   kdb::KeySet *arg2 = 0 ;
    7068           2 :   std::string *arg3 = 0 ;
    7069           4 :   std::string temp3 ;
    7070             :   int result;
    7071             :   
    7072           2 :   SWIG_check_num_args("kdb::KDB::set",3,3)
    7073           2 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KDB::set",1,"kdb::KDB *");
    7074           2 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KDB::set",2,"kdb::KeySet &");
    7075           2 :   if(!lua_isstring(L,3)) SWIG_fail_arg("kdb::KDB::set",3,"std::string const &");
    7076             :   
    7077           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KDB,0))){
    7078           0 :     SWIG_fail_ptr("KDB_set",1,SWIGTYPE_p_kdb__KDB);
    7079             :   }
    7080             :   
    7081             :   
    7082           2 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__KeySet,0))){
    7083           0 :     SWIG_fail_ptr("KDB_set",2,SWIGTYPE_p_kdb__KeySet);
    7084             :   }
    7085             :   
    7086           4 :   temp3.assign(lua_tostring(L,3),lua_rawlen(L,3)); arg3=&temp3;
    7087             :   {
    7088             :     try {
    7089           2 :       result = (int)(arg1)->set(*arg2,(std::string const &)*arg3);    
    7090           0 :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    7091           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    7092           0 :     }    catch (...) {
    7093           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::set(kdb::KeySet &,std::string const &)");    
    7094             :     }
    7095             :   }
    7096           2 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    7097             :   return SWIG_arg;
    7098             :   
    7099             :   if(0) SWIG_fail;
    7100             :   
    7101             : fail:
    7102           0 :   lua_error(L);
    7103             :   return SWIG_arg;
    7104             : }
    7105             : 
    7106             : 
    7107           0 : static int _wrap_KDB_set__SWIG_1(lua_State* L) {
    7108           0 :   int SWIG_arg = 0;
    7109           0 :   kdb::KDB *arg1 = (kdb::KDB *) 0 ;
    7110           0 :   kdb::KeySet *arg2 = 0 ;
    7111           0 :   kdb::Key *arg3 = 0 ;
    7112             :   int result;
    7113             :   
    7114           0 :   SWIG_check_num_args("kdb::KDB::set",3,3)
    7115           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KDB::set",1,"kdb::KDB *");
    7116           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KDB::set",2,"kdb::KeySet &");
    7117           0 :   if(!lua_isuserdata(L,3)) SWIG_fail_arg("kdb::KDB::set",3,"kdb::Key &");
    7118             :   
    7119           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KDB,0))){
    7120           0 :     SWIG_fail_ptr("KDB_set",1,SWIGTYPE_p_kdb__KDB);
    7121             :   }
    7122             :   
    7123             :   
    7124           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__KeySet,0))){
    7125           0 :     SWIG_fail_ptr("KDB_set",2,SWIGTYPE_p_kdb__KeySet);
    7126             :   }
    7127             :   
    7128             :   
    7129           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_kdb__Key,0))){
    7130           0 :     SWIG_fail_ptr("KDB_set",3,SWIGTYPE_p_kdb__Key);
    7131             :   }
    7132             :   
    7133             :   {
    7134             :     try {
    7135           0 :       result = (int)(arg1)->set(*arg2,*arg3);    
    7136           0 :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    7137           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    7138           0 :     }    catch (...) {
    7139           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::set(kdb::KeySet &,kdb::Key &)");    
    7140             :     }
    7141             :   }
    7142           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    7143             :   return SWIG_arg;
    7144             :   
    7145             :   if(0) SWIG_fail;
    7146             :   
    7147             : fail:
    7148           0 :   lua_error(L);
    7149             :   return SWIG_arg;
    7150             : }
    7151             : 
    7152             : 
    7153           2 : static int _wrap_KDB_set(lua_State* L) {
    7154             :   int argc;
    7155             :   int argv[4]={
    7156             :     1,2,3,4
    7157           2 :   };
    7158             :   
    7159           2 :   argc = lua_gettop(L);
    7160           2 :   if (argc == 3) {
    7161           2 :     int _v = 0;
    7162             :     {
    7163             :       {
    7164             :         void *ptr;
    7165           2 :         if (lua_isuserdata(L,argv[2])==0 || SWIG_ConvertPtr(L,argv[2], (void **) &ptr, SWIGTYPE_p_kdb__Key, 0)) {
    7166             :           _v = 0;
    7167             :         } else {
    7168           0 :           _v = 1;
    7169             :         }
    7170             :       }
    7171             :     }
    7172           2 :     if (!_v) goto check_1;
    7173           0 :     return _wrap_KDB_set__SWIG_1(L);
    7174             :   }
    7175             : check_1:
    7176             :   
    7177           2 :   if (argc == 3) {
    7178           2 :     return _wrap_KDB_set__SWIG_0(L);
    7179             :   }
    7180             :   
    7181             :   SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'KDB_set'\n"
    7182             :     "  Possible C/C++ prototypes are:\n"
    7183             :     "    kdb::KDB::set(kdb::KeySet &,std::string const &)\n"
    7184           0 :     "    kdb::KDB::set(kdb::KeySet &,kdb::Key &)\n");
    7185           0 :   lua_error(L);return 0;
    7186             : }
    7187             : 
    7188             : 
    7189           0 : static int _wrap_KDB_ensure(lua_State* L) {
    7190           0 :   int SWIG_arg = 0;
    7191           0 :   kdb::KDB *arg1 = (kdb::KDB *) 0 ;
    7192           0 :   kdb::KeySet *arg2 = 0 ;
    7193           0 :   kdb::Key *arg3 = 0 ;
    7194             :   int result;
    7195             :   
    7196           0 :   SWIG_check_num_args("kdb::KDB::ensure",3,3)
    7197           0 :   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("kdb::KDB::ensure",1,"kdb::KDB *");
    7198           0 :   if(!lua_isuserdata(L,2)) SWIG_fail_arg("kdb::KDB::ensure",2,"kdb::KeySet const &");
    7199           0 :   if(!lua_isuserdata(L,3)) SWIG_fail_arg("kdb::KDB::ensure",3,"kdb::Key &");
    7200             :   
    7201           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_kdb__KDB,0))){
    7202           0 :     SWIG_fail_ptr("KDB_ensure",1,SWIGTYPE_p_kdb__KDB);
    7203             :   }
    7204             :   
    7205             :   
    7206           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_kdb__KeySet,0))){
    7207           0 :     SWIG_fail_ptr("KDB_ensure",2,SWIGTYPE_p_kdb__KeySet);
    7208             :   }
    7209             :   
    7210             :   
    7211           0 :   if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&arg3,SWIGTYPE_p_kdb__Key,0))){
    7212           0 :     SWIG_fail_ptr("KDB_ensure",3,SWIGTYPE_p_kdb__Key);
    7213             :   }
    7214             :   
    7215             :   {
    7216             :     try {
    7217           0 :       result = (int)(arg1)->ensure((kdb::KeySet const &)*arg2,*arg3);    
    7218           0 :     }    KDB_EXCEPTIONS    catch (const std::exception & e) {
    7219           0 :       SWIG_exception(SWIG_RuntimeError, e.what());    
    7220           0 :     }    catch (...) {
    7221           0 :       SWIG_exception(SWIG_UnknownError, "unknown error in kdb::KDB::ensure(kdb::KeySet const &,kdb::Key &)");    
    7222             :     }
    7223             :   }
    7224           0 :   lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
    7225             :   return SWIG_arg;
    7226             :   
    7227             :   if(0) SWIG_fail;
    7228             :   
    7229             : fail:
    7230           0 :   lua_error(L);
    7231             :   return SWIG_arg;
    7232             : }
    7233             : 
    7234             : 
    7235           7 : static void swig_delete_KDB(void *obj) {
    7236           7 : kdb::KDB *arg1 = (kdb::KDB *) obj;
    7237           7 : delete arg1;
    7238           7 : }
    7239           7 : static int _proxy__wrap_new_KDB(lua_State *L) {
    7240             :     assert(lua_istable(L,1));
    7241           7 :     lua_pushcfunction(L,_wrap_new_KDB);
    7242             :     assert(!lua_isnil(L,-1));
    7243           7 :     lua_replace(L,1); /* replace our table with real constructor */
    7244           7 :     lua_call(L,lua_gettop(L)-1,1);
    7245           7 :     return 1;
    7246             : }
    7247             : static swig_lua_attribute swig_KDB_attributes[] = {
    7248             :     {0,0,0}
    7249             : };
    7250             : static swig_lua_method swig_KDB_methods[]= {
    7251             :     { "open", _wrap_KDB_open},
    7252             :     { "close", _wrap_KDB_close},
    7253             :     { "get", _wrap_KDB_get},
    7254             :     { "set", _wrap_KDB_set},
    7255             :     { "ensure", _wrap_KDB_ensure},
    7256             :     {0,0}
    7257             : };
    7258             : static swig_lua_method swig_KDB_meta[] = {
    7259             :     {0,0}
    7260             : };
    7261             : 
    7262             : static swig_lua_attribute swig_KDB_Sf_SwigStatic_attributes[] = {
    7263             :     {0,0,0}
    7264             : };
    7265             : static swig_lua_const_info swig_KDB_Sf_SwigStatic_constants[]= {
    7266             :     {0,0,0,0,0,0}
    7267             : };
    7268             : static swig_lua_method swig_KDB_Sf_SwigStatic_methods[]= {
    7269             :     {0,0}
    7270             : };
    7271             : static swig_lua_class* swig_KDB_Sf_SwigStatic_classes[]= {
    7272             :     0
    7273             : };
    7274             : 
    7275             : static swig_lua_namespace swig_KDB_Sf_SwigStatic = {
    7276             :     "KDB",
    7277             :     swig_KDB_Sf_SwigStatic_methods,
    7278             :     swig_KDB_Sf_SwigStatic_attributes,
    7279             :     swig_KDB_Sf_SwigStatic_constants,
    7280             :     swig_KDB_Sf_SwigStatic_classes,
    7281             :     0
    7282             : };
    7283             : static swig_lua_class *swig_KDB_bases[] = {0};
    7284             : static const char *swig_KDB_base_names[] = {0};
    7285             : static swig_lua_class _wrap_class_KDB = { "KDB", "KDB", &SWIGTYPE_p_kdb__KDB,_proxy__wrap_new_KDB, swig_delete_KDB, swig_KDB_methods, swig_KDB_attributes, &swig_KDB_Sf_SwigStatic, swig_KDB_meta, swig_KDB_bases, swig_KDB_base_names };
    7286             : 
    7287             : static swig_lua_attribute swig_SwigModule_attributes[] = {
    7288             :     {0,0,0}
    7289             : };
    7290             : static swig_lua_const_info swig_SwigModule_constants[]= {
    7291             :     {SWIG_LUA_CONSTTAB_STRING("DB_SYSTEM", KDB_DB_SYSTEM)},
    7292             :     {SWIG_LUA_CONSTTAB_STRING("DB_USER", KDB_DB_USER)},
    7293             :     {SWIG_LUA_CONSTTAB_STRING("DB_HOME", KDB_DB_HOME)},
    7294             :     {SWIG_LUA_CONSTTAB_INT("DEBUG", DEBUG)},
    7295             :     { SWIG_LUA_CONSTTAB_POINTER("KS_END",KS_END, SWIGTYPE_p_void) },
    7296             :     {SWIG_LUA_CONSTTAB_STRING("VERSION", KDB_VERSION)},
    7297             :     {SWIG_LUA_CONSTTAB_INT("VERSION_MAJOR", KDB_VERSION_MAJOR)},
    7298             :     {SWIG_LUA_CONSTTAB_INT("VERSION_MINOR", KDB_VERSION_MINOR)},
    7299             :     {SWIG_LUA_CONSTTAB_INT("VERSION_MICRO", KDB_VERSION_MICRO)},
    7300             :     {SWIG_LUA_CONSTTAB_STRING("KDB_VERSION", "0.9.0")},
    7301             :     {SWIG_LUA_CONSTTAB_INT("KDB_VERSION_MAJOR", 0)},
    7302             :     {SWIG_LUA_CONSTTAB_INT("KDB_VERSION_MINOR", 9)},
    7303             :     {SWIG_LUA_CONSTTAB_INT("KDB_VERSION_MICRO", 0)},
    7304             :     {SWIG_LUA_CONSTTAB_INT("KEY_NAME", KEY_NAME)},
    7305             :     {SWIG_LUA_CONSTTAB_INT("KEY_VALUE", KEY_VALUE)},
    7306             :     {SWIG_LUA_CONSTTAB_INT("KEY_FLAGS", KEY_FLAGS)},
    7307             :     {SWIG_LUA_CONSTTAB_INT("KEY_OWNER", KEY_OWNER)},
    7308             :     {SWIG_LUA_CONSTTAB_INT("KEY_COMMENT", KEY_COMMENT)},
    7309             :     {SWIG_LUA_CONSTTAB_INT("KEY_BINARY", KEY_BINARY)},
    7310             :     {SWIG_LUA_CONSTTAB_INT("KEY_UID", KEY_UID)},
    7311             :     {SWIG_LUA_CONSTTAB_INT("KEY_GID", KEY_GID)},
    7312             :     {SWIG_LUA_CONSTTAB_INT("KEY_MODE", KEY_MODE)},
    7313             :     {SWIG_LUA_CONSTTAB_INT("KEY_ATIME", KEY_ATIME)},
    7314             :     {SWIG_LUA_CONSTTAB_INT("KEY_MTIME", KEY_MTIME)},
    7315             :     {SWIG_LUA_CONSTTAB_INT("KEY_CTIME", KEY_CTIME)},
    7316             :     {SWIG_LUA_CONSTTAB_INT("KEY_SIZE", KEY_SIZE)},
    7317             :     {SWIG_LUA_CONSTTAB_INT("KEY_FUNC", KEY_FUNC)},
    7318             :     {SWIG_LUA_CONSTTAB_INT("KEY_DIR", KEY_DIR)},
    7319             :     {SWIG_LUA_CONSTTAB_INT("KEY_META", KEY_META)},
    7320             :     {SWIG_LUA_CONSTTAB_INT("KEY_NULL", KEY_NULL)},
    7321             :     {SWIG_LUA_CONSTTAB_INT("KEY_CASCADING_NAME", KEY_CASCADING_NAME)},
    7322             :     {SWIG_LUA_CONSTTAB_INT("KEY_META_NAME", KEY_META_NAME)},
    7323             :     {SWIG_LUA_CONSTTAB_INT("KEY_END", KEY_END)},
    7324             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_NONE", KDB_O_NONE)},
    7325             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_DEL", KDB_O_DEL)},
    7326             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_POP", KDB_O_POP)},
    7327             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_NODIR", KDB_O_NODIR)},
    7328             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_DIRONLY", KDB_O_DIRONLY)},
    7329             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_NOREMOVE", KDB_O_NOREMOVE)},
    7330             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_REMOVEONLY", KDB_O_REMOVEONLY)},
    7331             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_INACTIVE", KDB_O_INACTIVE)},
    7332             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_SYNC", KDB_O_SYNC)},
    7333             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_SORT", KDB_O_SORT)},
    7334             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_NORECURSIVE", KDB_O_NORECURSIVE)},
    7335             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_NOCASE", KDB_O_NOCASE)},
    7336             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_WITHOWNER", KDB_O_WITHOWNER)},
    7337             :     {SWIG_LUA_CONSTTAB_INT("KDB_O_NOALL", KDB_O_NOALL)},
    7338             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_NONE", KEY_NS_NONE)},
    7339             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_EMPTY", KEY_NS_EMPTY)},
    7340             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_META", KEY_NS_META)},
    7341             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_CASCADING", KEY_NS_CASCADING)},
    7342             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_FIRST", KEY_NS_FIRST)},
    7343             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_SPEC", KEY_NS_SPEC)},
    7344             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_PROC", KEY_NS_PROC)},
    7345             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_DIR", KEY_NS_DIR)},
    7346             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_USER", KEY_NS_USER)},
    7347             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_SYSTEM", KEY_NS_SYSTEM)},
    7348             :     {SWIG_LUA_CONSTTAB_INT("KEY_NS_LAST", KEY_NS_LAST)},
    7349             :     {0,0,0,0,0,0}
    7350             : };
    7351             : static swig_lua_method swig_SwigModule_methods[]= {
    7352             :     { "__eq", _wrap___eq},
    7353             :     {0,0}
    7354             : };
    7355             : static swig_lua_class* swig_SwigModule_classes[]= {
    7356             : &_wrap_class_string,
    7357             : &_wrap_class_Key,
    7358             : &_wrap_class_KeySet,
    7359             : &_wrap_class_KDB,
    7360             :     0
    7361             : };
    7362             : static swig_lua_namespace* swig_SwigModule_namespaces[] = {
    7363             :     0
    7364             : };
    7365             : 
    7366             : static swig_lua_namespace swig_SwigModule = {
    7367             :     "kdb",
    7368             :     swig_SwigModule_methods,
    7369             :     swig_SwigModule_attributes,
    7370             :     swig_SwigModule_constants,
    7371             :     swig_SwigModule_classes,
    7372             :     swig_SwigModule_namespaces
    7373             : };
    7374             : #ifdef __cplusplus
    7375             : }
    7376             : #endif
    7377             : 
    7378             : /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
    7379             : 
    7380             : static swig_type_info _swigt__p__Key = {"_p__Key", "_Key *|ckdb::Key *", 0, 0, (void*)0, 0};
    7381             : static swig_type_info _swigt__p__KeySet = {"_p__KeySet", "_KeySet *|ckdb::KeySet *", 0, 0, (void*)0, 0};
    7382             : static swig_type_info _swigt__p_f___void = {"_p_f___void", "void (*)()|kdb::Key::func_t", 0, 0, (void*)0, 0};
    7383             : static swig_type_info _swigt__p_f_p__KeySet_p__Key_p__Key_option_t__p__Key = {"_p_f_p__KeySet_p__Key_p__Key_option_t__p__Key", "_Key *(*)(_KeySet *,_Key *,_Key *,option_t)|kdb::Key::callback_t", 0, 0, (void*)0, 0};
    7384             : static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
    7385             : static swig_type_info _swigt__p_kdb__KDB = {"_p_kdb__KDB", "kdb::KDB *", 0, 0, (void*)&_wrap_class_KDB, 0};
    7386             : static swig_type_info _swigt__p_kdb__Key = {"_p_kdb__Key", "kdb::Key *", 0, 0, (void*)&_wrap_class_Key, 0};
    7387             : static swig_type_info _swigt__p_kdb__KeySet = {"_p_kdb__KeySet", "kdb::KeySet *", 0, 0, (void*)&_wrap_class_KeySet, 0};
    7388             : static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
    7389             : static swig_type_info _swigt__p_option_t = {"_p_option_t", "option_t *", 0, 0, (void*)0, 0};
    7390             : static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
    7391             : static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
    7392             : static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)&_wrap_class_string, 0};
    7393             : static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
    7394             : static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
    7395             : static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
    7396             : static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
    7397             : static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
    7398             : 
    7399             : static swig_type_info *swig_type_initial[] = {
    7400             :   &_swigt__p__Key,
    7401             :   &_swigt__p__KeySet,
    7402             :   &_swigt__p_f___void,
    7403             :   &_swigt__p_f_p__KeySet_p__Key_p__Key_option_t__p__Key,
    7404             :   &_swigt__p_int,
    7405             :   &_swigt__p_kdb__KDB,
    7406             :   &_swigt__p_kdb__Key,
    7407             :   &_swigt__p_kdb__KeySet,
    7408             :   &_swigt__p_long_long,
    7409             :   &_swigt__p_option_t,
    7410             :   &_swigt__p_short,
    7411             :   &_swigt__p_signed_char,
    7412             :   &_swigt__p_std__string,
    7413             :   &_swigt__p_unsigned_char,
    7414             :   &_swigt__p_unsigned_int,
    7415             :   &_swigt__p_unsigned_long_long,
    7416             :   &_swigt__p_unsigned_short,
    7417             :   &_swigt__p_void,
    7418             : };
    7419             : 
    7420             : static swig_cast_info _swigc__p__Key[] = {  {&_swigt__p__Key, 0, 0, 0},{0, 0, 0, 0}};
    7421             : static swig_cast_info _swigc__p__KeySet[] = {  {&_swigt__p__KeySet, 0, 0, 0},{0, 0, 0, 0}};
    7422             : static swig_cast_info _swigc__p_f___void[] = {  {&_swigt__p_f___void, 0, 0, 0},{0, 0, 0, 0}};
    7423             : static swig_cast_info _swigc__p_f_p__KeySet_p__Key_p__Key_option_t__p__Key[] = {  {&_swigt__p_f_p__KeySet_p__Key_p__Key_option_t__p__Key, 0, 0, 0},{0, 0, 0, 0}};
    7424             : static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
    7425             : static swig_cast_info _swigc__p_kdb__KDB[] = {  {&_swigt__p_kdb__KDB, 0, 0, 0},{0, 0, 0, 0}};
    7426             : static swig_cast_info _swigc__p_kdb__Key[] = {  {&_swigt__p_kdb__Key, 0, 0, 0},{0, 0, 0, 0}};
    7427             : static swig_cast_info _swigc__p_kdb__KeySet[] = {  {&_swigt__p_kdb__KeySet, 0, 0, 0},{0, 0, 0, 0}};
    7428             : static swig_cast_info _swigc__p_long_long[] = {  {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
    7429             : static swig_cast_info _swigc__p_option_t[] = {  {&_swigt__p_option_t, 0, 0, 0},{0, 0, 0, 0}};
    7430             : static swig_cast_info _swigc__p_short[] = {  {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
    7431             : static swig_cast_info _swigc__p_signed_char[] = {  {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
    7432             : static swig_cast_info _swigc__p_std__string[] = {  {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
    7433             : static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
    7434             : static swig_cast_info _swigc__p_unsigned_int[] = {  {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
    7435             : static swig_cast_info _swigc__p_unsigned_long_long[] = {  {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
    7436             : static swig_cast_info _swigc__p_unsigned_short[] = {  {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
    7437             : static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
    7438             : 
    7439             : static swig_cast_info *swig_cast_initial[] = {
    7440             :   _swigc__p__Key,
    7441             :   _swigc__p__KeySet,
    7442             :   _swigc__p_f___void,
    7443             :   _swigc__p_f_p__KeySet_p__Key_p__Key_option_t__p__Key,
    7444             :   _swigc__p_int,
    7445             :   _swigc__p_kdb__KDB,
    7446             :   _swigc__p_kdb__Key,
    7447             :   _swigc__p_kdb__KeySet,
    7448             :   _swigc__p_long_long,
    7449             :   _swigc__p_option_t,
    7450             :   _swigc__p_short,
    7451             :   _swigc__p_signed_char,
    7452             :   _swigc__p_std__string,
    7453             :   _swigc__p_unsigned_char,
    7454             :   _swigc__p_unsigned_int,
    7455             :   _swigc__p_unsigned_long_long,
    7456             :   _swigc__p_unsigned_short,
    7457             :   _swigc__p_void,
    7458             : };
    7459             : 
    7460             : 
    7461             : /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
    7462             : 
    7463             : /* -----------------------------------------------------------------------------
    7464             :  * Type initialization:
    7465             :  * This problem is tough by the requirement that no dynamic
    7466             :  * memory is used. Also, since swig_type_info structures store pointers to
    7467             :  * swig_cast_info structures and swig_cast_info structures store pointers back
    7468             :  * to swig_type_info structures, we need some lookup code at initialization.
    7469             :  * The idea is that swig generates all the structures that are needed.
    7470             :  * The runtime then collects these partially filled structures.
    7471             :  * The SWIG_InitializeModule function takes these initial arrays out of
    7472             :  * swig_module, and does all the lookup, filling in the swig_module.types
    7473             :  * array with the correct data and linking the correct swig_cast_info
    7474             :  * structures together.
    7475             :  *
    7476             :  * The generated swig_type_info structures are assigned statically to an initial
    7477             :  * array. We just loop through that array, and handle each type individually.
    7478             :  * First we lookup if this type has been already loaded, and if so, use the
    7479             :  * loaded structure instead of the generated one. Then we have to fill in the
    7480             :  * cast linked list. The cast data is initially stored in something like a
    7481             :  * two-dimensional array. Each row corresponds to a type (there are the same
    7482             :  * number of rows as there are in the swig_type_initial array). Each entry in
    7483             :  * a column is one of the swig_cast_info structures for that type.
    7484             :  * The cast_initial array is actually an array of arrays, because each row has
    7485             :  * a variable number of columns. So to actually build the cast linked list,
    7486             :  * we find the array of casts associated with the type, and loop through it
    7487             :  * adding the casts to the list. The one last trick we need to do is making
    7488             :  * sure the type pointer in the swig_cast_info struct is correct.
    7489             :  *
    7490             :  * First off, we lookup the cast->type name to see if it is already loaded.
    7491             :  * There are three cases to handle:
    7492             :  *  1) If the cast->type has already been loaded AND the type we are adding
    7493             :  *     casting info to has not been loaded (it is in this module), THEN we
    7494             :  *     replace the cast->type pointer with the type pointer that has already
    7495             :  *     been loaded.
    7496             :  *  2) If BOTH types (the one we are adding casting info to, and the
    7497             :  *     cast->type) are loaded, THEN the cast info has already been loaded by
    7498             :  *     the previous module so we just ignore it.
    7499             :  *  3) Finally, if cast->type has not already been loaded, then we add that
    7500             :  *     swig_cast_info to the linked list (because the cast->type) pointer will
    7501             :  *     be correct.
    7502             :  * ----------------------------------------------------------------------------- */
    7503             : 
    7504             : #ifdef __cplusplus
    7505             : extern "C" {
    7506             : #if 0
    7507             : } /* c-mode */
    7508             : #endif
    7509             : #endif
    7510             : 
    7511             : #if 0
    7512             : #define SWIGRUNTIME_DEBUG
    7513             : #endif
    7514             : 
    7515             : 
    7516             : SWIGRUNTIME void
    7517           8 : SWIG_InitializeModule(void *clientdata) {
    7518             :   size_t i;
    7519             :   swig_module_info *module_head, *iter;
    7520             :   int init;
    7521             : 
    7522             :   /* check to see if the circular list has been setup, if not, set it up */
    7523           8 :   if (swig_module.next==0) {
    7524             :     /* Initialize the swig_module */
    7525           7 :     swig_module.type_initial = swig_type_initial;
    7526           7 :     swig_module.cast_initial = swig_cast_initial;
    7527           7 :     swig_module.next = &swig_module;
    7528           7 :     init = 1;
    7529             :   } else {
    7530             :     init = 0;
    7531             :   }
    7532             : 
    7533             :   /* Try and load any already created modules */
    7534           8 :   module_head = SWIG_GetModule(clientdata);
    7535           8 :   if (!module_head) {
    7536             :     /* This is the first module loaded for this interpreter */
    7537             :     /* so set the swig module into the interpreter */
    7538           8 :     SWIG_SetModule(clientdata, &swig_module);
    7539             :   } else {
    7540             :     /* the interpreter has loaded a SWIG module, but has it loaded this one? */
    7541             :     iter=module_head;
    7542             :     do {
    7543           0 :       if (iter==&swig_module) {
    7544             :         /* Our module is already in the list, so there's nothing more to do. */
    7545             :         return;
    7546             :       }
    7547           0 :       iter=iter->next;
    7548           0 :     } while (iter!= module_head);
    7549             : 
    7550             :     /* otherwise we must add our module into the list */
    7551           0 :     swig_module.next = module_head->next;
    7552           0 :     module_head->next = &swig_module;
    7553             :   }
    7554             : 
    7555             :   /* When multiple interpreters are used, a module could have already been initialized in
    7556             :      a different interpreter, but not yet have a pointer in this interpreter.
    7557             :      In this case, we do not want to continue adding types... everything should be
    7558             :      set up already */
    7559           8 :   if (init == 0) return;
    7560             : 
    7561             :   /* Now work on filling in swig_module.types */
    7562             : #ifdef SWIGRUNTIME_DEBUG
    7563             :   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
    7564             : #endif
    7565         259 :   for (i = 0; i < swig_module.size; ++i) {
    7566         126 :     swig_type_info *type = 0;
    7567             :     swig_type_info *ret;
    7568             :     swig_cast_info *cast;
    7569             : 
    7570             : #ifdef SWIGRUNTIME_DEBUG
    7571             :     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
    7572             : #endif
    7573             : 
    7574             :     /* if there is another module already loaded */
    7575         126 :     if (swig_module.next != &swig_module) {
    7576           0 :       type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
    7577             :     }
    7578         126 :     if (type) {
    7579             :       /* Overwrite clientdata field */
    7580             : #ifdef SWIGRUNTIME_DEBUG
    7581             :       printf("SWIG_InitializeModule: found type %s\n", type->name);
    7582             : #endif
    7583           0 :       if (swig_module.type_initial[i]->clientdata) {
    7584           0 :         type->clientdata = swig_module.type_initial[i]->clientdata;
    7585             : #ifdef SWIGRUNTIME_DEBUG
    7586             :       printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
    7587             : #endif
    7588             :       }
    7589             :     } else {
    7590         126 :       type = swig_module.type_initial[i];
    7591             :     }
    7592             : 
    7593             :     /* Insert casting types */
    7594         126 :     cast = swig_module.cast_initial[i];
    7595         378 :     while (cast->type) {
    7596             : 
    7597             :       /* Don't need to add information already in the list */
    7598         126 :       ret = 0;
    7599             : #ifdef SWIGRUNTIME_DEBUG
    7600             :       printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
    7601             : #endif
    7602         126 :       if (swig_module.next != &swig_module) {
    7603           0 :         ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
    7604             : #ifdef SWIGRUNTIME_DEBUG
    7605             :         if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
    7606             : #endif
    7607             :       }
    7608         126 :       if (ret) {
    7609           0 :         if (type == swig_module.type_initial[i]) {
    7610             : #ifdef SWIGRUNTIME_DEBUG
    7611             :           printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
    7612             : #endif
    7613           0 :           cast->type = ret;
    7614           0 :           ret = 0;
    7615             :         } else {
    7616             :           /* Check for casting already in the list */
    7617           0 :           swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
    7618             : #ifdef SWIGRUNTIME_DEBUG
    7619             :           if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
    7620             : #endif
    7621           0 :           if (!ocast) ret = 0;
    7622             :         }
    7623             :       }
    7624             : 
    7625         126 :       if (!ret) {
    7626             : #ifdef SWIGRUNTIME_DEBUG
    7627             :         printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
    7628             : #endif
    7629         126 :         if (type->cast) {
    7630           0 :           type->cast->prev = cast;
    7631           0 :           cast->next = type->cast;
    7632             :         }
    7633         126 :         type->cast = cast;
    7634             :       }
    7635         126 :       cast++;
    7636             :     }
    7637             :     /* Set entry in modules->types array equal to the type */
    7638         126 :     swig_module.types[i] = type;
    7639             :   }
    7640           7 :   swig_module.types[i] = 0;
    7641             : 
    7642             : #ifdef SWIGRUNTIME_DEBUG
    7643             :   printf("**** SWIG_InitializeModule: Cast List ******\n");
    7644             :   for (i = 0; i < swig_module.size; ++i) {
    7645             :     int j = 0;
    7646             :     swig_cast_info *cast = swig_module.cast_initial[i];
    7647             :     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
    7648             :     while (cast->type) {
    7649             :       printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
    7650             :       cast++;
    7651             :       ++j;
    7652             :     }
    7653             :   printf("---- Total casts: %d\n",j);
    7654             :   }
    7655             :   printf("**** SWIG_InitializeModule: Cast List ******\n");
    7656             : #endif
    7657             : }
    7658             : 
    7659             : /* This function will propagate the clientdata field of type to
    7660             : * any new swig_type_info structures that have been added into the list
    7661             : * of equivalent types.  It is like calling
    7662             : * SWIG_TypeClientData(type, clientdata) a second time.
    7663             : */
    7664             : SWIGRUNTIME void
    7665           8 : SWIG_PropagateClientData(void) {
    7666             :   size_t i;
    7667             :   swig_cast_info *equiv;
    7668             :   static int init_run = 0;
    7669             : 
    7670           8 :   if (init_run) return;
    7671           7 :   init_run = 1;
    7672             : 
    7673         133 :   for (i = 0; i < swig_module.size; i++) {
    7674         126 :     if (swig_module.types[i]->clientdata) {
    7675          28 :       equiv = swig_module.types[i]->cast;
    7676          84 :       while (equiv) {
    7677          28 :         if (!equiv->converter) {
    7678          28 :           if (equiv->type && !equiv->type->clientdata)
    7679           0 :             SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
    7680             :         }
    7681          28 :         equiv = equiv->next;
    7682             :       }
    7683             :     }
    7684             :   }
    7685             : }
    7686             : 
    7687             : #ifdef __cplusplus
    7688             : #if 0
    7689             : { /* c-mode */
    7690             : #endif
    7691             : }
    7692             : #endif
    7693             : 
    7694             : 
    7695             : 
    7696             : /* Forward declaration of where the user's %init{} gets inserted */
    7697             : void SWIG_init_user(lua_State* L );
    7698             :     
    7699             : #ifdef __cplusplus
    7700             : extern "C" {
    7701             : #endif
    7702             : /* this is the initialization function
    7703             :   added at the very end of the code
    7704             :   the function is always called SWIG_init, but an earlier #define will rename it
    7705             : */
    7706             : #if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
    7707             : LUALIB_API int SWIG_init(lua_State* L)
    7708             : #else
    7709           8 : SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
    7710             : #endif
    7711             : {
    7712             : #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
    7713             :   int i;
    7714           8 :   int globalRegister = 0;
    7715             :   /* start with global table */
    7716           8 :   lua_pushglobaltable (L);
    7717             :   /* SWIG's internal initialisation */
    7718           8 :   SWIG_InitializeModule((void*)L);
    7719           8 :   SWIG_PropagateClientData();
    7720             : #endif
    7721             : 
    7722             : #if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE)
    7723             :   /* add a global fn */
    7724           8 :   SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
    7725           8 :   SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_class_equal);
    7726             : #endif
    7727             : 
    7728             : #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
    7729             :   /* set up base class pointers (the hierarchy) */
    7730         152 :   for (i = 0; swig_types[i]; i++){
    7731         144 :     if (swig_types[i]->clientdata){
    7732          32 :       SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
    7733             :     }
    7734             :   }
    7735             : #ifdef SWIG_LUA_MODULE_GLOBAL
    7736           8 :   globalRegister = 1;
    7737             : #endif
    7738             : 
    7739             : 
    7740             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
    7741           8 :   SWIG_Lua_namespace_register(L,&swig_SwigModule, globalRegister);
    7742             : #endif
    7743             : 
    7744             : #if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
    7745             :   for (i = 0; swig_types[i]; i++){
    7746             :     if (swig_types[i]->clientdata){
    7747             :       SWIG_Lua_elua_class_register_instance(L,(swig_lua_class*)(swig_types[i]->clientdata));
    7748             :     }
    7749             :   }
    7750             : #endif
    7751             : 
    7752             : #if defined(SWIG_LUA_ELUA_EMULATE)
    7753             :   lua_newtable(L);
    7754             :   SWIG_Lua_elua_emulate_register(L,swig_SwigModule.ns_methods);
    7755             :   SWIG_Lua_elua_emulate_register_clear(L);
    7756             :   if(globalRegister) {
    7757             :     lua_pushstring(L,swig_SwigModule.name);
    7758             :     lua_pushvalue(L,-2);
    7759             :     lua_rawset(L,-4);
    7760             :   }
    7761             : #endif
    7762             : 
    7763             : #endif
    7764             : 
    7765             : #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
    7766             :   /* invoke user-specific initialization */
    7767           8 :   SWIG_init_user(L);
    7768             :   /* end module */
    7769             :   /* Note: We do not clean up the stack here (Lua will do this for us). At this
    7770             :      point, we have the globals table and out module table on the stack. Returning
    7771             :      one value makes the module table the result of the require command. */
    7772           8 :   return 1;
    7773             : #else
    7774             :   return 0;
    7775             : #endif
    7776             : }
    7777             : 
    7778             : #ifdef __cplusplus
    7779             : }
    7780             : #endif
    7781             : 
    7782             : 
    7783             : const char* SWIG_LUACODE=
    7784             :   "\n"
    7785             :   "  local orig_call = kdb.Key\n"
    7786             :   "  kdb.Key = function(arg0, ...)\n"
    7787             :   "    local flags = 0\n"
    7788             :   "    local value = Nil\n"
    7789             :   "    local meta  = {}\n"
    7790             :   "    if select(\"#\", ...) > 0 and swig_type(arg0) ~= \"kdb.Key *\" then\n"
    7791             :   "      local t = { ... }\n"
    7792             :   "      local i, arg = next(t, nil)\n"
    7793             :   "      while i do\n"
    7794             :   "        if arg == kdb.KEY_END then\n"
    7795             :   "          break\n"
    7796             :   "        elseif arg == kdb.KEY_SIZE then\n"
    7797             :   "          -- ignore value\n"
    7798             :   "          next(t, i)\n"
    7799             :   "        elseif arg == kdb.KEY_VALUE then\n"
    7800             :   "          i, value = next(t, i)\n"
    7801             :   "        elseif arg == kdb.KEY_FUNC then\n"
    7802             :   "          error(\"Unsupported meta type\")\n"
    7803             :   "        elseif arg == kdb.KEY_FLAGS then\n"
    7804             :   "          i, flags = next(t, i)\n"
    7805             :   "        elseif arg == kdb.KEY_META then\n"
    7806             :   "          i, k = next(t, i)\n"
    7807             :   "          i, meta[k] = next(t, i)\n"
    7808             :   "        elseif type(arg) == \"number\" then\n"
    7809             :   "          io.stderr:write(\"Deprecated option in keyNew: \", arg, \"\\n\")\n"
    7810             :   "          flags = bit32.bor(flags, arg)\n"
    7811             :   "        elseif kdb.DEBUG > 0 then\n"
    7812             :   "          io.stderr:write(\"Unknown option in keyNew: \", arg, \"\\n\")\n"
    7813             :   "        end\n"
    7814             :   "        i, arg = next(t, i)\n"
    7815             :   "      end\n"
    7816             :   "    end\n"
    7817             :   "\n"
    7818             :   "    -- make sure we call the proper constructor\n"
    7819             :   "    local key = flags > 0 and orig_call(arg0, flags)\n"
    7820             :   "      or arg0 and orig_call(arg0) or orig_call()\n"
    7821             :   "\n"
    7822             :   "    if value then\n"
    7823             :   "      if key:isBinary() then\n"
    7824             :   "        key.binary = value\n"
    7825             :   "      else\n"
    7826             :   "        key.string = value\n"
    7827             :   "      end\n"
    7828             :   "    end\n"
    7829             :   "    for k, v in pairs(meta) do\n"
    7830             :   "      key:setMeta(k, v)\n"
    7831             :   "    end\n"
    7832             :   "\n"
    7833             :   "    return key\n"
    7834             :   "  end\n"
    7835             :   "\n"
    7836             :   "  local mt = getmetatable(kdb.Key())\n"
    7837             :   "  mt[\".fn\"][\"__metaIter\"] = function(self)\n"
    7838             :   "     return coroutine.wrap(\n"
    7839             :   "      function()\n"
    7840             :   "        self:_rewindMeta()\n"
    7841             :   "        local meta = self:_nextMeta()\n"
    7842             :   "        while not meta:isNull() do\n"
    7843             :   "          coroutine.yield(meta)\n"
    7844             :   "          meta = self:_nextMeta()\n"
    7845             :   "        end\n"
    7846             :   "      end\n"
    7847             :   "    )\n"
    7848             :   "  end\n"
    7849             :   "\n"
    7850             :   "  mt[\".fn\"][\"getMeta\"] = function(self, ...)\n"
    7851             :   "    if select(\"#\", ...) > 0 then\n"
    7852             :   "      local meta = self:_getMeta(...)\n"
    7853             :   "      return not meta:isNull() and meta or nil\n"
    7854             :   "    end\n"
    7855             :   "    return self:__metaIter()\n"
    7856             :   "  end\n"
    7857             :   "\n"
    7858             :   "\n"
    7859             :   "  local orig_call = kdb.KeySet\n"
    7860             :   "  kdb.KeySet = function(alloc, ...)\n"
    7861             :   "    local ks = orig_call(alloc)\n"
    7862             :   "\n"
    7863             :   "    if select(\"#\", ...) > 0 then\n"
    7864             :   "      -- there's no need to check for KS_END\n"
    7865             :   "      -- ipairs will do this for us\n"
    7866             :   "      for _, arg in ipairs({...}) do\n"
    7867             :   "        ks:append(arg)\n"
    7868             :   "      end\n"
    7869             :   "    end\n"
    7870             :   "\n"
    7871             :   "    return ks\n"
    7872             :   "  end\n"
    7873             :   "\n"
    7874             :   "  local mt = getmetatable(kdb.KeySet())\n"
    7875             :   "  mt[\".fn\"][\"lookup\"] = function(self, ...)\n"
    7876             :   "    local key = self:_lookup(...)\n"
    7877             :   "    return not key:isNull() and key or nil\n"
    7878             :   "  end\n"
    7879             :   "\n"
    7880             :   "  -- table-like key lookup\n"
    7881             :   "  -- NOTE: this also returns all available class methods\n"
    7882             :   "  -- e.g. ks[\"lookup\"] will return above function\n"
    7883             :   "  local orig_index = mt[\"__index\"]\n"
    7884             :   "  mt[\"__index\"] = function(self, prop)\n"
    7885             :   "    local val = orig_index(self, prop)\n"
    7886             :   "    if val then\n"
    7887             :   "      return val\n"
    7888             :   "    end\n"
    7889             :   "\n"
    7890             :   "    return self:lookup(prop)\n"
    7891             :   "  end";
    7892             : 
    7893           8 : void SWIG_init_user(lua_State* L)
    7894             : {
    7895             :   // other methods/properties aliases
    7896           8 :   add_class_method(L,   "Key", "get",    _my_Key_getValue);
    7897           8 :   add_class_variable(L, "Key", "value",  _my_Key_getValue,     SWIG_Lua_set_immutable);
    7898           8 :   add_class_variable(L, "Key", "string", _wrap_Key__getString, _wrap_Key__setString);
    7899           8 :   add_class_variable(L, "Key", "binary", _wrap_Key__getBinary, _wrap_Key__setBinary);
    7900             :   
    7901             :   
    7902           8 :   SWIG_Lua_get_class_metatable(L, "KeySet");
    7903           8 :   SWIG_Lua_add_function(L, "__ipairs", _my_KeySet_ipairs);
    7904           8 :   lua_pop(L, 1);
    7905             :   
    7906             :   /* exec Lua code if applicable */
    7907           8 :   SWIG_Lua_dostring(L,SWIG_LUACODE);
    7908           8 : }
    7909             : 

Generated by: LCOV version 1.13