/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.4
+ * Version 2.0.7
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* ----------------------------------------------------------------------------- */
#define SWIGLUA
+#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA
#define SWIG_LUA_MODULE_GLOBAL
#include <stdlib.h> /* for malloc */
#include <assert.h> /* for a few sanity tests */
+/* -----------------------------------------------------------------------------
+ * Lua flavors
+ * ----------------------------------------------------------------------------- */
+
+#define SWIG_LUA_FLAVOR_LUA 1
+#define SWIG_LUA_FLAVOR_ELUA 2
+#define SWIG_LUA_FLAVOR_ELUAC 3
+
+#if !defined(SWIG_LUA_TARGET)
+# error SWIG_LUA_TARGET not defined
+#endif
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
+# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
+# define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
+# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
+# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C)
+#else /* SWIG_LUA_FLAVOR_LUA */
+# define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0
+# define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0
+# define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0
+# define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0
+#endif
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
+# define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
+# define LSTRVAL LRO_STRVAL
+#endif
+
+/* -----------------------------------------------------------------------------
+ * compatibility defines
+ * ----------------------------------------------------------------------------- */
+
+/* History of Lua C API length functions: In Lua 5.0 (and before?)
+ there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen",
+ but a compatibility define of "lua_strlen" was added. In Lua 5.2,
+ this function was again renamed, to "lua_rawlen" (to emphasize that
+ it doesn't call the "__len" metamethod), and the compatibility
+ define of lua_strlen was removed. All SWIG uses have been updated
+ to "lua_rawlen", and we add our own defines of that here for older
+ versions of Lua. */
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
+# define lua_rawlen lua_strlen
+#elif LUA_VERSION_NUM == 501
+# define lua_rawlen lua_objlen
+#endif
+
+
+/* lua_pushglobaltable is the recommended "future-proof" way to get
+ the global table for Lua 5.2 and later. Here we define
+ lua_pushglobaltable ourselves for Lua versions before 5.2. */
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
+# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
+#endif
+
+
/* -----------------------------------------------------------------------------
* global swig types
* ----------------------------------------------------------------------------- */
lua_tostring(L,2));
*/
/* get the metatable */
- assert(lua_istable(L,1)); /* just in case */
+#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
+ assert(lua_isrotable(L,1)); /* just in case */
+#else
+ assert(lua_istable(L,1)); /* default Lua action */
+#endif
lua_getmetatable(L,1); /* get the metatable */
- assert(lua_istable(L,-1)); /* just in case */
+#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
+ assert(lua_isrotable(L,-1)); /* just in case */
+#else
+ assert(lua_istable(L,-1));
+#endif
SWIG_Lua_get_table(L,".get"); /* get the .get table */
lua_remove(L,3); /* remove metatable */
+#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
+ if (lua_isrotable(L,-1))
+#else
if (lua_istable(L,-1))
+#endif
{
/* look for the key in the .get table */
lua_pushvalue(L,2); /* key */
}
lua_pop(L,1); /* remove the .get */
lua_pushnil(L); /* return a nil */
- return 1;
+ return 1;
}
/* the module.set method used for setting linked data */
(3) any for the new value
*/
/* get the metatable */
- assert(lua_istable(L,1)); /* just in case */
+#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
+ assert(lua_isrotable(L,1)); /* just in case */
+#else
+ assert(lua_istable(L,1)); /* default Lua action */
+#endif
lua_getmetatable(L,1); /* get the metatable */
- assert(lua_istable(L,-1)); /* just in case */
+#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
+ assert(lua_isrotable(L,-1)); /* just in case */
+#else
+ assert(lua_istable(L,-1));
+#endif
SWIG_Lua_get_table(L,".set"); /* get the .set table */
lua_remove(L,4); /* remove metatable */
+#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
+ if (lua_isrotable(L,-1))
+#else
if (lua_istable(L,-1))
+#endif
{
/* look for the key in the .set table */
lua_pushvalue(L,2); /* key */
lua_call(L,1,0);
return 0;
}
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA)
+ else {
+ return 0; // Exits stoically if an invalid key is initialized.
+ }
+#endif
}
lua_settop(L,3); /* reset back to start */
/* we now have the table, key & new value, so just set directly */
return 0;
}
+#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
/* registering a module in lua. Pushes the module table on the stack. */
SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name)
{
}
lua_pop(L,1); /* tidy stack (remove meta) */
}
+#endif
/* adding a function module */
SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
return 0;
}
+/* the class.__tostring method called by the interpreter and print */
+SWIGINTERN int SWIG_Lua_class_tostring(lua_State* L)
+{
+/* there should be 1 param passed in
+ (1) userdata (not the metatable) */
+ assert(lua_isuserdata(L,1)); /* just in case */
+ unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */
+ lua_getmetatable(L,1); /* get the meta table */
+ assert(lua_istable(L,-1)); /* just in case */
+
+ lua_getfield(L, -1, ".type");
+ const char* className = lua_tostring(L, -1);
+
+ char output[256];
+ sprintf(output, "<%s userdata: %lX>", className, userData);
+
+ lua_pushstring(L, (const char*)output);
+ return 1;
+}
+
+/* to manually disown some userdata */
+SWIGINTERN int SWIG_Lua_class_disown(lua_State* L)
+{
+/* there should be 1 params passed in
+ (1) userdata (not the meta table) */
+ swig_lua_userdata* usr;
+ assert(lua_isuserdata(L,-1)); /* just in case */
+ usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
+
+ usr->own = 0; /* clear our ownership */
+ return 0;
+}
+
/* gets the swig class registry (or creates it) */
SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L)
{
/* add a table called ".fn" */
lua_pushstring(L,".fn");
lua_newtable(L);
+ /* add manual disown method */
+ SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown);
lua_rawset(L,-3);
/* add accessor fns for using the .get,.set&.fn */
SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
+ /* add tostring method for better output */
+ SWIG_Lua_add_function(L,"__tostring",SWIG_Lua_class_tostring);
/* add it */
lua_rawset(L,-3); /* metatable into registry */
lua_pop(L,1); /* tidy stack (remove registry) */
usr->ptr=ptr; /* set the ptr */
usr->type=type;
usr->own=own;
+#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
_SWIG_Lua_AddMetatable(L,type); /* add metatable */
+#endif
}
/* takes a object from the lua stack & converts it into an object of the correct type
* global variable support code: class/struct typemap functions
* ----------------------------------------------------------------------------- */
+#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
/* Install Constants */
SWIGINTERN void
SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
}
}
}
+#endif
/* -----------------------------------------------------------------------------
* executing lua code from within the wrapper
#define SWIG_LUACODE luaopen_Mag_luacode
-
namespace swig {
typedef struct{} LANGUAGE_OBJ;
}
static int _wrap_Input_source_get_stream_info(lua_State* L) { int SWIG_arg = 0;
Mag_server::Input_source *arg1 = (Mag_server::Input_source *) 0 ; l4_umword_t arg2 ;
- L4Re::Event_stream_info **arg3 = (L4Re::Event_stream_info **) 0 ; L4Re::Event_stream_info *temp3 ; int result; arg3 = &temp3;
- SWIG_check_num_args("Mag_server::Input_source::get_stream_info",2,2)
+ L4Re::Event_stream_info **arg3 = (L4Re::Event_stream_info **) 0 ; L4Re::Event_stream_info *temp3 ; int result;
+ temp3 = (L4Re::Event_stream_info *)0; arg3 = &temp3; SWIG_check_num_args("Mag_server::Input_source::get_stream_info",2,2)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Mag_server::Input_source::get_stream_info",1,"Mag_server::Input_source *");
if(!lua_isuserdata(L,2)) SWIG_fail_arg("Mag_server::Input_source::get_stream_info",2,"l4_umword_t");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Mag_server__Input_source,0))){
return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }
static int _wrap_Input_source_get_abs_info(lua_State* L) { int SWIG_arg = 0;
Mag_server::Input_source *arg1 = (Mag_server::Input_source *) 0 ; l4_umword_t arg2 ; unsigned int arg3 ;
- Mag_server::Axis_info **arg4 = (Mag_server::Axis_info **) 0 ; Mag_server::Axis_info *temp4 ; int result; arg4 = &temp4;
- SWIG_check_num_args("Mag_server::Input_source::get_abs_info",3,3)
+ Mag_server::Axis_info **arg4 = (Mag_server::Axis_info **) 0 ; Mag_server::Axis_info *temp4 ; int result;
+ temp4 = (Mag_server::Axis_info *)0; arg4 = &temp4; SWIG_check_num_args("Mag_server::Input_source::get_abs_info",3,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Mag_server::Input_source::get_abs_info",1,"Mag_server::Input_source *");
if(!lua_isuserdata(L,2)) SWIG_fail_arg("Mag_server::Input_source::get_abs_info",2,"l4_umword_t");
if(!lua_isnumber(L,3)) SWIG_fail_arg("Mag_server::Input_source::get_abs_info",3,"unsigned int");
// removed: }
#endif
-static const struct luaL_reg swig_commands[] = {
+static const struct luaL_Reg swig_commands[] = {
{ "get_user_state", _wrap_get_user_state},
{0,0}
};
#endif
/* this is the initialization function
added at the very end of the code
- the function is always called SWIG_init, but an eariler #define will rename it
+ the function is always called SWIG_init, but an earlier #define will rename it
*/
-SWIGEXPORT int SWIG_init(lua_State* L)
+#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
+LUALIB_API int SWIG_init(lua_State* L)
+#else
+SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
+#endif
{
+#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */
int i;
/* start with global table */
- lua_pushvalue(L,LUA_GLOBALSINDEX);
+ lua_pushglobaltable (L);
/* SWIG's internal initalisation */
SWIG_InitializeModule((void*)L);
SWIG_PropagateClientData();
+#endif
+
+#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
/* add a global fn */
SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
for (i = 0; swig_variables[i].name; i++){
SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
}
- /* set up base class pointers (the hierachy) */
+#endif
+
+#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
+ /* set up base class pointers (the hierarchy) */
for (i = 0; swig_types[i]; i++){
if (swig_types[i]->clientdata){
SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
}
}
+#endif
+
+#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
/* constants */
SWIG_Lua_InstallConstants(L,swig_constants);
+#endif
+
+#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
/* invoke user-specific initialization */
SWIG_init_user(L);
/* end module */
point, we have the globals table and out module table on the stack. Returning
one value makes the module table the result of the require command. */
return 1;
+#else
+ return 0;
+#endif
}
#ifdef __cplusplus