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:
parent
280666ed38
commit
6c80f765ca
4 changed files with 44 additions and 42 deletions
|
|
@ -7,23 +7,23 @@
|
||||||
|
|
||||||
%insert("runtime") %{
|
%insert("runtime") %{
|
||||||
/* Lua flavors */
|
/* Lua flavors */
|
||||||
#define SWIG_LUA_LUA 1
|
#define SWIG_LUA_FLAVOR_LUA 1
|
||||||
#define SWIG_LUA_ELUA 2
|
#define SWIG_LUA_FLAVOR_ELUA 2
|
||||||
#define SWIG_LUA_ELUAC 3
|
#define SWIG_LUA_FLAVOR_ELUAC 3
|
||||||
|
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
|
||||||
# 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
|
|
||||||
# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C)
|
# 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_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C)
|
||||||
# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
|
# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C)
|
||||||
# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(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
|
#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 LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING}
|
||||||
# define LSTRVAL LRO_STRVAL
|
# define LSTRVAL LRO_STRVAL
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -181,23 +181,23 @@ SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
|
||||||
lua_tostring(L,2));
|
lua_tostring(L,2));
|
||||||
*/
|
*/
|
||||||
/* get the metatable */
|
/* get the metatable */
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
||||||
assert(lua_istable(L,1)); /* just in case */
|
assert(lua_isrotable(L,1)); /* just in case */
|
||||||
#else
|
#else
|
||||||
assert(lua_isrotable(L,1));
|
assert(lua_istable(L,1)); /* default Lua action */
|
||||||
#endif
|
#endif
|
||||||
lua_getmetatable(L,1); /* get the metatable */
|
lua_getmetatable(L,1); /* get the metatable */
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
||||||
assert(lua_istable(L,-1)); /* just in case */
|
assert(lua_isrotable(L,-1)); /* just in case */
|
||||||
#else
|
#else
|
||||||
assert(lua_isrotable(L,-1));
|
assert(lua_istable(L,-1));
|
||||||
#endif
|
#endif
|
||||||
SWIG_Lua_get_table(L,".get"); /* get the .get table */
|
SWIG_Lua_get_table(L,".get"); /* get the .get table */
|
||||||
lua_remove(L,3); /* remove metatable */
|
lua_remove(L,3); /* remove metatable */
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
||||||
if (lua_istable(L,-1))
|
|
||||||
#else
|
|
||||||
if (lua_isrotable(L,-1))
|
if (lua_isrotable(L,-1))
|
||||||
|
#else
|
||||||
|
if (lua_istable(L,-1))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* look for the key in the .get table */
|
/* 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
|
(3) any for the new value
|
||||||
*/
|
*/
|
||||||
/* get the metatable */
|
/* get the metatable */
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
||||||
assert(lua_istable(L,1)); /* just in case */
|
assert(lua_isrotable(L,1)); /* just in case */
|
||||||
#else
|
#else
|
||||||
assert(lua_isrotable(L,1));
|
assert(lua_istable(L,1)); /* default Lua action */
|
||||||
#endif
|
#endif
|
||||||
lua_getmetatable(L,1); /* get the metatable */
|
lua_getmetatable(L,1); /* get the metatable */
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
||||||
assert(lua_istable(L,-1)); /* just in case */
|
assert(lua_isrotable(L,-1)); /* just in case */
|
||||||
#else
|
#else
|
||||||
assert(lua_isrotable(L,-1));
|
assert(lua_istable(L,-1));
|
||||||
#endif
|
#endif
|
||||||
SWIG_Lua_get_table(L,".set"); /* get the .set table */
|
SWIG_Lua_get_table(L,".set"); /* get the .set table */
|
||||||
lua_remove(L,4); /* remove metatable */
|
lua_remove(L,4); /* remove metatable */
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
||||||
if (lua_istable(L,-1))
|
|
||||||
#else
|
|
||||||
if (lua_isrotable(L,-1))
|
if (lua_isrotable(L,-1))
|
||||||
|
#else
|
||||||
|
if (lua_istable(L,-1))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* look for the key in the .set table */
|
/* 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);
|
lua_call(L,1,0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_ELUA)
|
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA)
|
||||||
else {
|
else {
|
||||||
return 0; // Exits stoically if an invalid key is initialized.
|
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;
|
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. */
|
/* registering a module in lua. Pushes the module table on the stack. */
|
||||||
SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name)
|
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->ptr=ptr; /* set the ptr */
|
||||||
usr->type=type;
|
usr->type=type;
|
||||||
usr->own=own;
|
usr->own=own;
|
||||||
|
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
|
||||||
_SWIG_Lua_AddMetatable(L,type); /* add metatable */
|
_SWIG_Lua_AddMetatable(L,type); /* add metatable */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* takes a object from the lua stack & converts it into an object of the correct type
|
/* 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
|
* 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 */
|
/* Install Constants */
|
||||||
SWIGINTERN void
|
SWIGINTERN void
|
||||||
SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
|
SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@ extern "C" {
|
||||||
added at the very end of the code
|
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 eariler #define will rename it
|
||||||
*/
|
*/
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC))
|
||||||
SWIGEXPORT int SWIG_init(lua_State* L)
|
|
||||||
#else
|
|
||||||
LUALIB_API int SWIG_init(lua_State* L)
|
LUALIB_API int SWIG_init(lua_State* L)
|
||||||
|
#else
|
||||||
|
SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
|
||||||
#endif
|
#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;
|
int i;
|
||||||
/* start with global table */
|
/* start with global table */
|
||||||
lua_pushvalue(L,LUA_GLOBALSINDEX);
|
lua_pushvalue(L,LUA_GLOBALSINDEX);
|
||||||
|
|
@ -36,7 +36,7 @@ LUALIB_API int SWIG_init(lua_State* L)
|
||||||
SWIG_PropagateClientData();
|
SWIG_PropagateClientData();
|
||||||
#endif
|
#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 */
|
/* add a global fn */
|
||||||
SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
|
SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
|
||||||
SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
|
SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
|
||||||
|
|
@ -52,7 +52,7 @@ LUALIB_API int SWIG_init(lua_State* L)
|
||||||
}
|
}
|
||||||
#endif
|
#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) */
|
/* set up base class pointers (the hierachy) */
|
||||||
for (i = 0; swig_types[i]; i++){
|
for (i = 0; swig_types[i]; i++){
|
||||||
if (swig_types[i]->clientdata){
|
if (swig_types[i]->clientdata){
|
||||||
|
|
@ -67,12 +67,12 @@ LUALIB_API int SWIG_init(lua_State* L)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (SWIG_LUA_TARGET == SWIG_LUA_LUA)
|
#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
|
||||||
/* constants */
|
/* constants */
|
||||||
SWIG_Lua_InstallConstants(L,swig_constants);
|
SWIG_Lua_InstallConstants(L,swig_constants);
|
||||||
#endif
|
#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 */
|
/* invoke user-specific initialization */
|
||||||
SWIG_init_user(L);
|
SWIG_init_user(L);
|
||||||
/* end module */
|
/* end module */
|
||||||
|
|
|
||||||
|
|
@ -285,11 +285,11 @@ public:
|
||||||
Printf(f_runtime, "#define SWIGLUA\n");
|
Printf(f_runtime, "#define SWIGLUA\n");
|
||||||
|
|
||||||
if (elua_ltr)
|
if (elua_ltr)
|
||||||
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_ELUA\n");
|
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_ELUA\n");
|
||||||
else if (eluac_ltr)
|
else if (eluac_ltr)
|
||||||
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_ELUAC\n");
|
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_ELUAC\n");
|
||||||
else
|
else
|
||||||
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_LUA\n");
|
Printf(f_runtime, "#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA\n");
|
||||||
|
|
||||||
if (nomoduleglobal) {
|
if (nomoduleglobal) {
|
||||||
Printf(f_runtime, "#define SWIG_LUA_NO_MODULE_GLOBAL\n");
|
Printf(f_runtime, "#define SWIG_LUA_NO_MODULE_GLOBAL\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue