* 'class_p1' of github.com:v-for-vandal/swig: Fixing registerClass. No more wrap: unnecessary attributes Fixed registerMethod to work like registerVariable Switched to Swig_name_* functions Return MIN_OPT_LEVEL for elua add nspace_extend test case updated documentation following comd options renaming Options in alphabetical order Members renaming target_name -> lua_name Fixing cmd options, again Fixing segfault Removed class_parent_nspace Fixes to module options Rename methods to make it clear what 'symbols table' they operate on. Small documenation fixes Updating Lua documentation Eliminating namespaces_hash and using symbols table instead Attempt to catch unreproducable bug from Travis CI build Small bugfixes Bugfixes for eLua. eLua emulation mode Add compatibility option for old-style inheritance Add support for C-style enums in C mode. And tests. Style fixes. Comments fixes. Fixing cmd options. etc Some fixes for elua Attempt to fix unreproducable bug (from Travis CI build) Fixes for examples. Wrapped keywords into guardian in keyword_rename test Remove some typos Remove some obsolete code Manually beautifying luarun.swg Code beautifier Valuewrapper test Removing obsolete debug code Bugfixes A few bugfixes Some class bases iteration improvements Fixes for elua Bugfixes Bugfixes. CMD args handling. Code cleanup Bugfixes Preparations before pull request - part 1 More changes. Mostly to the would-be class library Fixing issuse with v2-compatible static function names Add pointer guard Add runtime test Bugfixes nspace.i example is working Initial implementation - everything compiles but might not work
103 lines
2.9 KiB
Text
103 lines
2.9 KiB
Text
/* -----------------------------------------------------------------------------
|
|
* luaruntime.swg
|
|
*
|
|
* all the runtime code for .
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
%runtime "swigrun.swg"; /* Common C API type-checking code */
|
|
%runtime "luarun.swg"; /* Lua runtime stuff */
|
|
|
|
%insert(initbeforefunc) "swiginit.swg"
|
|
|
|
%insert(initbeforefunc) %{
|
|
|
|
/* Forward declaration of where the user's %init{} gets inserted */
|
|
void SWIG_init_user(lua_State* L );
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
/* this is the initialization function
|
|
added at the very end of the code
|
|
the function is always called SWIG_init, but an earlier #define will rename it
|
|
*/
|
|
#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_pushglobaltable (L);
|
|
/* SWIG's internal initialisation */
|
|
SWIG_InitializeModule((void*)L);
|
|
SWIG_PropagateClientData();
|
|
#endif
|
|
|
|
#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE)
|
|
/* add a global fn */
|
|
SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
|
|
SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
|
|
#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));
|
|
}
|
|
}
|
|
int globalRegister = 0;
|
|
#ifdef SWIG_LUA_MODULE_GLOBAL
|
|
globalRegister = 1;
|
|
#endif
|
|
|
|
|
|
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
|
|
SWIG_Lua_namespace_register(L,&swig___Module, globalRegister);
|
|
#endif
|
|
|
|
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
|
|
for (i = 0; swig_types[i]; i++){
|
|
if (swig_types[i]->clientdata){
|
|
SWIG_Lua_elua_class_register_instance(L,(swig_lua_class*)(swig_types[i]->clientdata));
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if defined(SWIG_LUA_ELUA_EMULATE)
|
|
lua_newtable(L);
|
|
SWIG_Lua_elua_emulate_register(L,swig___Module.ns_methods);
|
|
SWIG_Lua_elua_emulate_register_clear(L);
|
|
if(globalRegister) {
|
|
lua_pushstring(L,swig___Module.name);
|
|
lua_pushvalue(L,-2);
|
|
lua_rawset(L,-4);
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
|
|
/* invoke user-specific initialization */
|
|
SWIG_init_user(L);
|
|
/* end module */
|
|
/* Note: We do not clean up the stack here (Lua will do this for us). At this
|
|
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
|
|
}
|
|
#endif
|
|
|
|
%}
|
|
|
|
/* Note: the initialization function is closed after all code is generated */
|
|
|