From: John L. <jr...@us...> - 2010-01-30 19:00:58
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30377/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Make wxluaO_addgcobject return a bool instead of void. Silence XRC warnings in calculator.wx.lua since we provide them. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** wxlstate.cpp 21 Dec 2009 04:06:14 -0000 1.187 --- wxlstate.cpp 30 Jan 2010 19:00:49 -0000 1.188 *************** *** 487,491 **** // ---------------------------------------------------------------------------- ! void LUACALL wxluaO_addgcobject(lua_State *L, void *obj_ptr, int wxl_type) { lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key --- 487,491 ---- // ---------------------------------------------------------------------------- ! bool LUACALL wxluaO_addgcobject(lua_State *L, void *obj_ptr, int wxl_type) { lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key *************** *** 495,504 **** lua_pushlightuserdata(L, obj_ptr); // push key lua_rawget(L, -2); // get t[key] = value, pops key if (!lua_isnil(L, -1)) { lua_pop(L, 2); // pop table and value ! wxFAIL_MSG(wxT("Tracking an object twice in wxluaO_addgcobject: ") + wxluaT_typename(L, wxl_type)); ! return; } lua_pop(L, 1); // pop nil --- 495,506 ---- lua_pushlightuserdata(L, obj_ptr); // push key lua_rawget(L, -2); // get t[key] = value, pops key + if (!lua_isnil(L, -1)) { lua_pop(L, 2); // pop table and value ! wxCHECK_MSG(false, false, wxT("Tracking an object twice in wxluaO_addgcobject: ") + wxluaT_typename(L, wxl_type)); ! return false; } + lua_pop(L, 1); // pop nil *************** *** 509,512 **** --- 511,516 ---- lua_pop(L, 1); // pop table + + return true; } *************** *** 1072,1076 **** const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, int wxl_type) { ! // note: wxluaR_getref() doesn't leave anything on the stack on failure if (wxluaT_getmetatable(L, wxl_type)) { --- 1076,1080 ---- const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, int wxl_type) { ! // note: wxluaT_getmetatable() doesn't leave anything on the stack on failure if (wxluaT_getmetatable(L, wxl_type)) { Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** wxlbind.cpp 21 Dec 2009 04:06:13 -0000 1.127 --- wxlbind.cpp 30 Jan 2010 19:00:48 -0000 1.128 *************** *** 367,371 **** else { ! // if there's a derived method, push it onto the stack to be run if (wxlua_hasderivedmethod(L, obj_ptr, name, true)) { --- 367,371 ---- else { ! // if there's a derived method in Lua, push it onto the stack to be run if (wxlua_hasderivedmethod(L, obj_ptr, name, true)) { *************** *** 384,387 **** --- 384,391 ---- if (WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_GETPROP)) { + // The user wants to call the C++ function as a property + // which is treated as though it were a member variable. + // It shouldn't have been called as a function with () + // and so we call the function here and leave the value on the stack. found = true; if (WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC)) *************** *** 394,397 **** --- 398,404 ---- else { + // The user has called a real C++ function and if it's + // overloaded we call wxlua_callOverloadedFunction() to + // find the correct one to call. found = true; result = 1; |