Slight change to the Lua macro names to separate ELUA and ELUAC from normal Lua - patch from Raman Gopalan

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12896 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-01-16 22:50:07 +00:00
commit 6c80f765ca
4 changed files with 44 additions and 42 deletions

View file

@ -7,23 +7,23 @@
%insert("runtime") %{
/* Lua flavors */
#define SWIG_LUA_LUA 1
#define SWIG_LUA_ELUA 2
#define SWIG_LUA_ELUAC 3
#define SWIG_LUA_FLAVOR_LUA 1
#define SWIG_LUA_FLAVOR_ELUA 2
#define SWIG_LUA_FLAVOR_ELUAC 3
#if (SWIG_LUA_TARGET == SWIG_LUA_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
# else
#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_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_ELUAC)
#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

View file

@ -181,23 +181,23 @@ SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
lua_tostring(L,2));
*/
/* get the metatable */
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
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_isrotable(L,1));
assert(lua_istable(L,1)); /* default Lua action */
#endif
lua_getmetatable(L,1); /* get the metatable */
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
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_isrotable(L,-1));
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_LUA)
if (lua_istable(L,-1))
#else
#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 */
@ -225,23 +225,23 @@ SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
(3) any for the new value
*/
/* get the metatable */
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
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_isrotable(L,1));
assert(lua_istable(L,1)); /* default Lua action */
#endif
lua_getmetatable(L,1); /* get the metatable */
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
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_isrotable(L,-1));
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_LUA)
if (lua_istable(L,-1))
#else
#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 */
@ -254,7 +254,7 @@ SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
lua_call(L,1,0);
return 0;
}
#if (SWIG_LUA_TARGET == SWIG_LUA_ELUA)
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA)
else {
return 0; // Exits stoically if an invalid key is initialized.
}
@ -266,7 +266,7 @@ SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
return 0;
}
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
#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)
{
@ -623,7 +623,9 @@ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *t
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
@ -736,7 +738,7 @@ SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
* global variable support code: class/struct typemap functions
* ----------------------------------------------------------------------------- */
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
#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[]) {

View file

@ -21,13 +21,13 @@ extern "C" {
added at the very end of the code
the function is always called SWIG_init, but an eariler #define will rename it
*/
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
SWIGEXPORT int SWIG_init(lua_State* L)
#else
#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_LUA) || (SWIG_LUA_TARGET == SWIG_LUA_ELUA)
#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);
@ -36,7 +36,7 @@ LUALIB_API int SWIG_init(lua_State* L)
SWIG_PropagateClientData();
#endif
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
#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);
@ -52,7 +52,7 @@ LUALIB_API int SWIG_init(lua_State* L)
}
#endif
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA) || (SWIG_LUA_TARGET == SWIG_LUA_ELUA)
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
/* set up base class pointers (the hierachy) */
for (i = 0; swig_types[i]; i++){
if (swig_types[i]->clientdata){
@ -67,12 +67,12 @@ LUALIB_API int SWIG_init(lua_State* L)
}
#endif
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
#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_LUA) || (SWIG_LUA_TARGET == SWIG_LUA_ELUA)
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
/* invoke user-specific initialization */
SWIG_init_user(L);
/* end module */