From: John L. <jr...@us...> - 2006-12-11 23:25:08
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4363/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: cleanup all the comments, code, func/var names in the wxLuaState Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** wxlstate.cpp 8 Dec 2006 06:16:17 -0000 1.81 --- wxlstate.cpp 11 Dec 2006 23:25:05 -0000 1.82 *************** *** 56,61 **** const char wxLuaNull[] = "wxNull"; - //extern int s_wxluatag_wxWindow; - wxLuaState wxNullLuaState(false); --- 56,59 ---- *************** *** 86,91 **** int LUACALL wxLua_lua_printFunction( lua_State *L ) [...1505 lines suppressed...] } --- 3416,3420 ---- int tag = ttag(arg+1+lua_argStart); ! fnCall += GetLuaTagName(tag); } } *************** *** 3500,3504 **** else { ! fnOverload += lua2wx(GetLuaTagName(tag)); } } --- 3475,3479 ---- else { ! fnOverload += GetLuaTagName(tag); } } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** wxlbind.cpp 1 Dec 2006 18:53:48 -0000 1.43 --- wxlbind.cpp 11 Dec 2006 23:25:05 -0000 1.44 *************** *** 46,49 **** --- 46,94 ---- //----------------------------------------------------------------------------- + // wxLuaFunction + //----------------------------------------------------------------------------- + + int wxLuaFunction::CallMethod(lua_State *L) + { + // remove this line to restore calling methods using the dot notation + // otherwise the colon notation *must* be used. + lua_remove(L, 1); + + return (*m_pMethod->func)(L); + } + + // A function object needs to be deleted because the object is being + // garbage collected. + int LUACALL wxLua_lua_gc_wxLuaFunction(lua_State *L) + { + wxLuaState wxlState(L); + wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); + + if (lua_isuserdata(L, 1) && (lua_islightuserdata(L, 1) == 0) && + (wxlState.ttag(1) == wxlState.GetwxLuaFunctionTag())) + { + wxLuaFunction *pFunction = (wxLuaFunction *)wxlState.ttouserdata(1, true); + if (pFunction != NULL) + delete pFunction; + } + return 0; + } + + // Handler for the 'function' tag method. + int LUACALL wxLua_lua_call_wxLuaFunction(lua_State *L) + { + wxLuaState wxlState(L); + wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); + + if (lua_isuserdata(L, 1) && (lua_islightuserdata(L, 1) == 0) && + (wxlState.ttag(1) == wxlState.GetwxLuaFunctionTag())) + { + wxLuaFunction *pFunction = (wxLuaFunction *)wxlState.ttouserdata(1); + return pFunction->CallMethod(L); + } + return 0; + } + + //----------------------------------------------------------------------------- // wxLuaObject //----------------------------------------------------------------------------- *************** *** 335,339 **** if (pFunction != NULL) { ! wxlState.tpushusertag(pFunction, wxlState.GetLuaFunctionTag()); result = 1; fFound = true; --- 380,384 ---- if (pFunction != NULL) { ! wxlState.tpushusertag(pFunction, wxlState.GetwxLuaFunctionTag()); result = 1; fFound = true; |