From: John L. <jr...@us...> - 2008-01-08 06:19:56
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23092/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp Log Message: Little bit of code cleanup Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** wxlbind.cpp 8 Jan 2008 00:55:35 -0000 1.112 --- wxlbind.cpp 8 Jan 2008 06:19:53 -0000 1.113 *************** *** 731,735 **** // We have to count the methods that are displayed to find the one that failed // since we've skipped the ones with wrong number of args. - // Since we're failing anyway, we don't need this to be fast. method = wxlMethod; int i_cfunc = 0; --- 731,734 ---- *************** *** 1121,1125 **** { // we will handle the WXLUAMETHOD_GET/SETPROP|WXLUAMETHOD_STATIC using __index and __newindex ! if (((wxlMethod->method_type & (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) == (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) && (wxlMethod->wxluacfuncs_n > 0)) { --- 1120,1124 ---- { // we will handle the WXLUAMETHOD_GET/SETPROP|WXLUAMETHOD_STATIC using __index and __newindex ! if (((wxlMethod->method_type & (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) == (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) && (wxlMethod->wxluacfuncs_n > 0)) { *************** *** 1146,1150 **** //lua_pushstring(L, "Metatable is not accessible"); //lua_rawset(L, -3); ! lua_setmetatable(L, -2); // Finalize the class table since we may not have a constructor --- 1145,1149 ---- //lua_pushstring(L, "Metatable is not accessible"); //lua_rawset(L, -3); ! lua_setmetatable(L, -2); // pops the metatable // Finalize the class table since we may not have a constructor *************** *** 1279,1283 **** const wxLuaBindEvent* wxLuaBinding::GetBindEvent(wxEventType eventType_) const { - // we've sorted this, see InitBinding() const wxEventType eventType = eventType_; wxLuaBindEvent eventItem = { "", &eventType, NULL }; --- 1278,1281 ---- *************** *** 1310,1314 **** wxLuaBindClassArrayCompareBywxLuaType); ! return wxlClass; // maybe NULL if wxluatype not found } --- 1308,1312 ---- wxLuaBindClassArrayCompareBywxLuaType); ! return wxlClass; } *************** *** 1325,1329 **** wxLuaBindClassArrayCompareFn); ! return wxlClass; // maybe NULL if wxluatype not found } --- 1323,1327 ---- wxLuaBindClassArrayCompareFn); ! return wxlClass; } *************** *** 1575,1582 **** } - // found base class in binding? - //if (basebinding->SetBaseClass(wxlClass)) - // break; - basenode = basenode->GetNext(); } --- 1573,1576 ---- *************** *** 1592,1598 **** while (node) { ! wxLuaBinding* binding = node->GetData(); wxLuaBindClass* wxlClass = binding->GetClassArray(); ! size_t i, class_count = binding->GetClassCount(); for (i = 0; i < class_count; ++i, ++wxlClass) --- 1586,1592 ---- while (node) { ! wxLuaBinding* binding = node->GetData(); wxLuaBindClass* wxlClass = binding->GetClassArray(); ! size_t i, class_count = binding->GetClassCount(); for (i = 0; i < class_count; ++i, ++wxlClass) *************** *** 1643,1662 **** sm_bindingList_initialized = true; } - - bool wxLuaBinding::SetBaseClass(wxLuaBindClass *wxlClass) - { - if (!wxlClass->baseclassName) // check if there is a baseclassName at all - return false; - - wxLuaBindClass* baseClass = m_classArray; // potential base class - for (size_t n = 0; n < m_classCount; ++n, ++baseClass) - { - if (strcmp(baseClass->name, wxlClass->baseclassName) == 0) - { - wxlClass->baseclass = baseClass; - return true; - } - } - - return false; - } --- 1637,1638 ---- Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** wxlcallb.cpp 4 Jan 2008 00:21:08 -0000 1.55 --- wxlcallb.cpp 8 Jan 2008 06:19:53 -0000 1.56 *************** *** 74,80 **** m_luafunc_ref = m_wxlState.wxluaR_Ref(lua_func_stack_idx, &wxlua_lreg_refs_key); ! // Note: We use the callback userdata and not the event sink since the event sink // requires a wxEvtHandler object which is a fairly large class. ! // The userdata is also deleted for us which makes m_evtHandler->Connect(win_id, last_id, eventType, (wxObjectEventFunction)&wxLuaEventCallback::OnAllEvents, --- 74,80 ---- m_luafunc_ref = m_wxlState.wxluaR_Ref(lua_func_stack_idx, &wxlua_lreg_refs_key); ! // Note: We use the callback userdata and not the event sink since the event sink // requires a wxEvtHandler object which is a fairly large class. ! // The userdata is also deleted for us which makes m_evtHandler->Connect(win_id, last_id, eventType, (wxObjectEventFunction)&wxLuaEventCallback::OnAllEvents, *************** *** 100,104 **** wxEventType evtType = event.GetEventType(); ! // Get the wxLuaEventCallback instance to use which is NOT "this" since // "this" is a central event handler function. i.e. this != theCallback wxLuaEventCallback *theCallback = (wxLuaEventCallback *)event.m_callbackUserData; --- 100,104 ---- wxEventType evtType = event.GetEventType(); ! // Get the wxLuaEventCallback instance to use which is NOT "this" since // "this" is a central event handler function. i.e. this != theCallback wxLuaEventCallback *theCallback = (wxLuaEventCallback *)event.m_callbackUserData; *************** *** 163,168 **** if (wxlState.lua_SetFenv(-2) != 0) { ! // Don't track the wxEvent since we don't own it and tracking it ! // causes clashes in the object registry table since many can be // created and deleted and the mem address is resused by C++. wxlState.wxluaT_PushUserDataType(event, event_wxl_type, false); --- 163,168 ---- if (wxlState.lua_SetFenv(-2) != 0) { ! // Don't track the wxEvent since we don't own it and tracking it ! // causes clashes in the object registry table since many can be // created and deleted and the mem address is resused by C++. wxlState.wxluaT_PushUserDataType(event, event_wxl_type, false); |