Compile fix

This commit is contained in:
Pali Rohár 2010-11-12 16:08:29 +01:00
parent 0bf0e6985c
commit d71529b3a4
7 changed files with 40 additions and 40 deletions

View file

@ -140,13 +140,13 @@ static inline const char* tolua_tocppstring (lua_State* L, int narg, const char*
const char* s = tolua_tostring(L, narg, def);
return s?s:"";
};
}
static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) {
const char* s = tolua_tofieldstring(L, lo, index, def);
return s?s:"";
};
}
#else
#define tolua_tocppstring tolua_tostring

View file

@ -20415,6 +20415,6 @@ TOLUA_API int tolua_stratagus_open (lua_State* tolua_S)
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
TOLUA_API int luaopen_stratagus (lua_State* tolua_S) {
return tolua_stratagus_open(tolua_S);
};
}
#endif

View file

@ -29,7 +29,7 @@ static void storeatubox (lua_State* L, int lo)
lua_newtable(L);
lua_pushvalue(L, -1);
lua_setfenv(L, lo); /* stack: k,v,table */
};
}
lua_insert(L, -3);
lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */
lua_pop(L, 1);
@ -147,7 +147,7 @@ static int class_index_event (lua_State* L)
lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */
if (!lua_isnil(L, -1))
return 1;
};
}
#else
lua_pushstring(L,"tolua_peers");
lua_rawget(L,LUA_REGISTRYINDEX); /* stack: obj key ubox */
@ -308,11 +308,11 @@ static int class_call_event(lua_State* L) {
lua_call(L, lua_gettop(L)-1, 1);
return 1;
};
};
}
}
tolua_error(L,"Attempt to call a non-callable object.",NULL);
return 0;
};
}
static int do_operator (lua_State* L, const char* op)
{

View file

@ -32,7 +32,7 @@ TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int sup
} else {
lua_pushliteral(L,"tolua_super");
lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */
};
}
lua_pushvalue(L,mt_indexa); /* stack: super mta */
lua_rawget(L,-2); /* stack: super super[mta] */
lua_pushvalue(L,mt_indexb); /* stack: super super[mta] mtb */
@ -152,13 +152,13 @@ int push_table_instance(lua_State* L, int lo) {
lua_pop(L, 1);
return 0;
};
}
} else {
return 0;
};
}
return 0;
};
}
/* the equivalent of lua_is* for usertype */
static int lua_isusertype (lua_State* L, int lo, const char* type)
@ -166,8 +166,8 @@ static int lua_isusertype (lua_State* L, int lo, const char* type)
if (!lua_isuserdata(L,lo)) {
if (!push_table_instance(L, lo)) {
return 0;
};
};
}
}
{
/* check if it is of the same type */
int r;
@ -297,7 +297,7 @@ TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err) {
err->array = 0;
err->type = "value";
return 1;
};
}
TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err)
{
@ -322,7 +322,7 @@ TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def,
}
TOLUA_API int tolua_isvaluearray
(lua_State* L, int lo, int dim, int def, tolua_Error* err)
(lua_State* L, int lo, int /*dim*/, int def, tolua_Error* err)
{
if (!tolua_istable(L,lo,def,err))
return 0;

View file

@ -34,7 +34,7 @@ static int tolua_newmetatable (lua_State* L, const char* name)
lua_pushvalue(L, -1);
lua_pushstring(L, name);
lua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */
};
}
#endif
if (r)
@ -96,7 +96,7 @@ static void set_ubox(lua_State* L) {
lua_rawget(L,-2);
} else {
lua_pushnil(L);
};
}
/* mt basemt base_ubox */
if (!lua_isnil(L,-1)) {
lua_pushstring(L, "tolua_ubox");
@ -113,9 +113,9 @@ static void set_ubox(lua_State* L) {
lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */
lua_setmetatable(L, -2); /* stack:mt basemt string ubox */
lua_rawset(L,-4);
};
}
};
}
/* Map inheritance
* It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name'
@ -132,9 +132,9 @@ static void mapinheritance (lua_State* L, const char* name, const char* base)
if (lua_getmetatable(L, -1)) { /* already has a mt, we don't overwrite it */
lua_pop(L, 2);
return;
};
}
luaL_getmetatable(L,"tolua_commonclass");
};
}
set_ubox(L);
@ -226,7 +226,7 @@ static int tolua_bnd_cast (lua_State* L)
v = tolua_touserdata(L, 1, NULL);
} else {
v = tolua_tousertype(L, 1, 0);
};
}
s = tolua_tostring(L,2,NULL);
if (v && s)
@ -247,7 +247,7 @@ static int tolua_bnd_inherit (lua_State* L) {
/* l_obj[".c_instance"] = c_obj */
return 0;
};
}
#ifdef LUA_VERSION_NUM /* lua 5.1 */
static int tolua_bnd_setpeer(lua_State* L) {
@ -256,17 +256,17 @@ static int tolua_bnd_setpeer(lua_State* L) {
if (!lua_isuserdata(L, -2)) {
lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected.");
lua_error(L);
};
}
if (lua_isnil(L, -1)) {
lua_pop(L, 1);
lua_pushvalue(L, TOLUA_NOPEER);
};
}
lua_setfenv(L, -2);
return 0;
};
}
static int tolua_bnd_getpeer(lua_State* L) {
@ -275,9 +275,9 @@ static int tolua_bnd_getpeer(lua_State* L) {
if (lua_rawequal(L, -1, TOLUA_NOPEER)) {
lua_pop(L, 1);
lua_pushnil(L);
};
}
return 1;
};
}
#endif
/* static int class_gc_event (lua_State* L); */
@ -505,15 +505,15 @@ static void push_collector(lua_State* L, const char* type, lua_CFunction col) {
if (!lua_isnil(L, -1)) {
lua_pop(L, 3);
return;
};
}
lua_pop(L, 1);
};
}
// */
lua_pushcfunction(L,col);
lua_rawset(L,-3);
lua_pop(L, 1);
};
}
/* Map C class
* It maps a C class, setting the appropriate inheritance and super classes.
@ -571,7 +571,7 @@ TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) {
mapsuper(L,cname,cbase);
mapsuper(L,name,base);
};
}
*/
/* Map function
@ -594,7 +594,7 @@ TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type
lua_pushcfunction(L,func);
lua_rawset(L,-3);
lua_pop(L, 1);
};
}
*/
/* Map constant number
@ -700,5 +700,5 @@ TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const ch
#else
lua_dobuffer(L, B, size, name);
#endif
};
}

View file

@ -61,7 +61,7 @@ TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type)
lua_pop(L, 1);
lua_pushstring(L, "tolua_ubox");
lua_rawget(L, LUA_REGISTRYINDEX);
};
}
lua_pushlightuserdata(L,value);
lua_rawget(L,-2); /* stack: mt ubox ubox[u] */
if (lua_isnil(L,-1))

View file

@ -34,12 +34,12 @@ TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def)
if (lua_gettop(L)<abs(narg)) {
return def;
};
}
if (lua_islightuserdata(L, narg)) {
return lua_touserdata(L,narg);
};
}
return tolua_tousertype(L, narg, def);
}
@ -55,7 +55,7 @@ TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def)
void* u;
if (!lua_isuserdata(L, narg)) {
if (!push_table_instance(L, narg)) return NULL;
};
}
u = lua_touserdata(L,narg);
return (u==NULL) ? NULL : *((void**)u); /* nil represents NULL */
}
@ -122,7 +122,7 @@ TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def)
return v;
}
TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def)
TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int /*def*/)
{
int v;
lua_pushnumber(L,index);