From: John L. <jr...@us...> - 2007-01-21 23:13:11
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv17508/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp wxlstate.cpp Log Message: fix wxPrintout::OnBeginDocument binding to not directly call wxPrintout::OnBeginDocument but just OnBeginDocument on the object on the stack, allows base_OnBeginDocument to work properly Add better descriptions to functions in wxlstate.h GetLuaNULL() -> GetLuaNULLTag() GetLuaWinDestroyTable() -> GetLuaWinDestroyTableTag() wxLua_lua_isenumerationtype does not take nil as a valid enum anymore Add wxLuaDebugDataItem::ToString for debugging Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** wxlstate.cpp 14 Dec 2006 01:01:26 -0000 1.85 --- wxlstate.cpp 21 Jan 2007 23:13:07 -0000 1.86 *************** *** 479,484 **** switch (ltype) { ! case LUA_TNIL: // evaluates to 0 so wx.ENUM_typo = 0 ! case LUA_TNUMBER: // make sure it's only a number for an enum return true; default: --- 479,484 ---- switch (ltype) { ! //case LUA_TNIL: // evaluates to 0 so wx.ENUM_typo = 0 ! case LUA_TNUMBER: // make sure it's only a number for an enum return true; default: *************** *** 1672,1676 **** // setup base class tags, must do it here since we can have many bindings ! // that have subclassed classes for (node = M_WXLSTATEDATA->m_wxlStateData->m_bindingList.GetFirst(); node; node = node->GetNext() ) { --- 1672,1677 ---- // setup base class tags, must do it here since we can have many bindings ! // that have subclassed classes and they have to be installed first to get ! // their tags initialized. for (node = M_WXLSTATEDATA->m_wxlStateData->m_bindingList.GetFirst(); node; node = node->GetNext() ) { *************** *** 1832,1841 **** return M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_wxLuaFunction; } ! int wxLuaState::GetLuaNULL() const { wxCHECK_MSG(GetRefData() != NULL, 0, wxT("Invalid wxLuaState")); return M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_NULL; } ! int wxLuaState::GetLuaWinDestroyTable() const { wxCHECK_MSG(GetRefData() != NULL, 0, wxT("Invalid wxLuaState")); --- 1833,1842 ---- return M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_wxLuaFunction; } ! int wxLuaState::GetLuaNULLTag() const { wxCHECK_MSG(GetRefData() != NULL, 0, wxT("Invalid wxLuaState")); return M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_NULL; } ! int wxLuaState::GetLuaWinDestroyTableTag() const { wxCHECK_MSG(GetRefData() != NULL, 0, wxT("Invalid wxLuaState")); *************** *** 2241,2251 **** return pFunction->GetObject(); } ! else ! { ! if (IsDerivedClass(stack_tag, tag)) ! return ttouserdata(stack_idx); ! else if (M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_NULL == stack_tag) ! return NULL; ! } } --- 2242,2249 ---- return pFunction->GetObject(); } ! else if (M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_NULL == stack_tag) ! return NULL; ! else if (IsDerivedClass(stack_tag, tag)) ! return ttouserdata(stack_idx); } *************** *** 2289,2293 **** { handled = true; ! wxLuaWinDestroyCallback *pCallback = new wxLuaWinDestroyCallback(*this, win->GetId(), (wxEvtHandler*)win, tag); --- 2287,2291 ---- { handled = true; ! wxLuaWinDestroyCallback *pCallback = new wxLuaWinDestroyCallback(*this, win->GetId(), (wxEvtHandler*)win, tag); Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** wxlbind.cpp 17 Dec 2006 07:47:17 -0000 1.48 --- wxlbind.cpp 21 Jan 2007 23:13:07 -0000 1.49 *************** *** 330,337 **** --- 330,339 ---- wxCHECK_MSG(!wxlState.GetCallBaseClassFunction(), 0, wxT("Base class function call not reset")); + bool fCallbase = false; bool fFound = false; int result = 0; WXLUACLASS *pClass = (WXLUACLASS *)lua_touserdata(L, lua_upvalueindex(1)); const char *cpIndex = "{unknown}"; + wxCharBuffer funcName; // debugging code for the table function, see print statement below *************** *** 345,352 **** { void *pObject = wxlState.ttouserdata(1); ! wxCharBuffer funcName(lua_tostring(L, 2)); // make a copy of the string cpIndex = funcName.data(); ! bool fCallbase = (memcmp(cpIndex, CALL_BASECLASS_FUNC, CALL_BASECLASS_FUNC_LEN) == 0); if (fCallbase) --- 347,354 ---- { void *pObject = wxlState.ttouserdata(1); ! funcName = lua_tostring(L, 2); // make a copy of the string cpIndex = funcName.data(); ! fCallbase = (memcmp(cpIndex, CALL_BASECLASS_FUNC, CALL_BASECLASS_FUNC_LEN) == 0); if (fCallbase) *************** *** 390,395 **** } ! //wxPrintf(wxT("wxLua_lua_getTableFunc func '%s' pClass %d, userdata %d, lightuserdata %d, ttag %d, class_tag %d lua_State %d wxLuaStateRefData %d\n"), ! // lua2wx(cpIndex).c_str(), (long)pClass, init_isuserdata, init_islightuserdata, init_ttag, init_class_tag, (long)L, (long)wxlState.GetRefData()); if (!fFound) --- 392,397 ---- } ! //wxPrintf(wxT("wxLua_lua_getTableFunc func '%s' pClass %d '%s', userdata %d, lightuserdata %d, ttag %d, class_tag %d lua_State %d wxLuaStateRefData %d call base %d\n"), ! // lua2wx(funcName).c_str(), (long)pClass, pClass ? lua2wx(pClass->name).c_str() : wxT(""), init_isuserdata, init_islightuserdata, init_ttag, init_class_tag, (long)L, (long)wxlState.GetRefData(), (int)wxlState.GetCallBaseClassFunction()); if (!fFound) *************** *** 664,668 **** //lua_pushboolean(L, false); //lua_rawset(L, tableOffset); - //lua_pushliteral(L, "TRUE"); //lua_pushboolean(L, true); --- 666,669 ---- Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** wxlcallb.cpp 14 Dec 2006 01:01:26 -0000 1.23 --- wxlcallb.cpp 21 Jan 2007 23:13:07 -0000 1.24 *************** *** 35,39 **** wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); ! // create a reference to the lua function m_routine = m_wxlState.tinsert(lua_func_stack_idx); --- 35,39 ---- wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); ! // create a reference to the lua function m_routine = m_wxlState.tinsert(lua_func_stack_idx); *************** *** 169,173 **** // get a reference to the destroy handler table ! if (m_wxlState.tget(m_wxlState.GetLuaWinDestroyTable())) { // create a reference to object --- 169,173 ---- // get a reference to the destroy handler table ! if (m_wxlState.tget(m_wxlState.GetLuaWinDestroyTableTag())) { // create a reference to object *************** *** 220,224 **** // Note: do not remove from wxLuaState's destroyHandlerList here, wait 'till destructor ! if (m_wxlState.tget(m_wxlState.GetLuaWinDestroyTable())) { lua_State* L = m_wxlState.GetLuaState(); --- 220,224 ---- // Note: do not remove from wxLuaState's destroyHandlerList here, wait 'till destructor ! if (m_wxlState.tget(m_wxlState.GetLuaWinDestroyTableTag())) { lua_State* L = m_wxlState.GetLuaState(); |