You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(191) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(238) |
Dec
(68) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(104) |
Feb
(518) |
Mar
(302) |
Apr
(211) |
May
(311) |
Jun
(55) |
Jul
(6) |
Aug
(35) |
Sep
(76) |
Oct
(50) |
Nov
(37) |
Dec
(340) |
2007 |
Jan
(23) |
Feb
(107) |
Mar
(98) |
Apr
(60) |
May
(136) |
Jun
(371) |
Jul
(175) |
Aug
(74) |
Sep
(3) |
Oct
(2) |
Nov
(53) |
Dec
(129) |
2008 |
Jan
(337) |
Feb
(23) |
Mar
(18) |
Apr
(4) |
May
(3) |
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
(33) |
Nov
|
Dec
(26) |
2009 |
Jan
(4) |
Feb
(1) |
Mar
(15) |
Apr
|
May
(35) |
Jun
(11) |
Jul
|
Aug
|
Sep
(19) |
Oct
(26) |
Nov
(11) |
Dec
(11) |
2010 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
(8) |
Dec
(7) |
2011 |
Jan
|
Feb
|
Mar
(4) |
Apr
(8) |
May
(5) |
Jun
(8) |
Jul
(1) |
Aug
|
Sep
|
Oct
(5) |
Nov
(13) |
Dec
|
From: John L. <jr...@us...> - 2007-12-15 16:56:43
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24974/wxLua/bindings/wxwidgets Modified Files: wxcore_override.hpp Log Message: * Changed signature of the function wxLuaState::SetLuaDebugHook() so that the inputs to lua_sethook() are together and in the same order. - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that it is a callback for the wxEvents using wxEvtHandlers. Cleaned up the comments in the headers. Index: wxcore_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wxcore_override.hpp 13 Dec 2007 06:23:53 -0000 1.11 --- wxcore_override.hpp 15 Dec 2007 16:56:40 -0000 1.12 *************** *** 1077,1081 **** wxWindowID lastId = wxID_ANY; wxEventType eventType = 0; ! wxLuaCallback *pCallback = NULL; int nParams = lua_gettop(L); --- 1077,1081 ---- wxWindowID lastId = wxID_ANY; wxEventType eventType = 0; ! wxLuaEventCallback *pCallback = NULL; int nParams = lua_gettop(L); *************** *** 1175,1179 **** // Create and connect the callback ! pCallback = new wxLuaCallback(wxlState, nParams, winId, lastId, eventType, evtHandler); return 0; --- 1175,1179 ---- // Create and connect the callback ! pCallback = new wxLuaEventCallback(wxlState, nParams, winId, lastId, eventType, evtHandler); return 0; *************** *** 1265,1269 **** // Try to disconnect from the callback ! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaCallback::EventHandler); lua_pushboolean(L, returns); --- 1265,1269 ---- // Try to disconnect from the callback ! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaEventCallback::EventHandler); lua_pushboolean(L, returns); |
From: John L. <jr...@us...> - 2007-12-15 16:56:43
|
Update of /cvsroot/wxlua/wxLua/apps/wxluaedit/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24974/wxLua/apps/wxluaedit/src Modified Files: wxledit.cpp Log Message: * Changed signature of the function wxLuaState::SetLuaDebugHook() so that the inputs to lua_sethook() are together and in the same order. - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that it is a callback for the wxEvents using wxEvtHandlers. Cleaned up the comments in the headers. Index: wxledit.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluaedit/src/wxledit.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** wxledit.cpp 31 Jul 2007 20:54:02 -0000 1.33 --- wxledit.cpp 15 Dec 2007 16:56:40 -0000 1.34 *************** *** 120,124 **** { wxLuaState wxlState = wxLuaState(wxlStateEvtHandler, win_id); ! wxlState.SetLuaDebugHook( 1000, 50, false, LUA_MASKCOUNT ); SetwxLuaState(wxlState, false); } --- 120,124 ---- { wxLuaState wxlState = wxLuaState(wxlStateEvtHandler, win_id); ! wxlState.SetLuaDebugHook( LUA_MASKCOUNT, 1000, 50, false ); SetwxLuaState(wxlState, false); } *************** *** 586,590 **** { wxLuaState wxlState = wxLuaState(wxlStateEvtHandler, win_id); ! wxlState.SetLuaDebugHook( 1000, 50, false, LUA_MASKCOUNT ); SetwxLuaState(wxlState, false); } --- 586,590 ---- { wxLuaState wxlState = wxLuaState(wxlStateEvtHandler, win_id); ! wxlState.SetLuaDebugHook( LUA_MASKCOUNT, 1000, 50, false ); SetwxLuaState(wxlState, false); } *************** *** 700,706 **** if (editor->HasBreakpoint(-1)) ! m_wxlState.SetLuaDebugHook(1, 50, true, LUA_MASKCALL|LUA_MASKRET|LUA_MASKLINE|LUA_MASKCOUNT); else ! m_wxlState.SetLuaDebugHook(1000, 100, false, LUA_MASKCALL|LUA_MASKRET|LUA_MASKLINE|LUA_MASKCOUNT); m_luaOutput->SetReadOnly(true); --- 700,706 ---- if (editor->HasBreakpoint(-1)) ! m_wxlState.SetLuaDebugHook(LUA_MASKCALL|LUA_MASKRET|LUA_MASKLINE|LUA_MASKCOUNT, 1, 50, true); else ! m_wxlState.SetLuaDebugHook(LUA_MASKCALL|LUA_MASKRET|LUA_MASKLINE|LUA_MASKCOUNT, 1000, 100, false); m_luaOutput->SetReadOnly(true); *************** *** 761,767 **** int hook_mask = wxlState.GetLuaDebugHook(); ! wxlState.SetLuaDebugHook(1, -1, true); wxlState.RunString(wxT("print(\"Showing stack\")")); ! wxlState.SetLuaDebugHook(hook_count, hook_yield, hook_send, hook_mask); luaShell->CheckPrompt(true); err = false; --- 761,767 ---- int hook_mask = wxlState.GetLuaDebugHook(); ! wxlState.SetLuaDebugHook(LUA_MASKCALL|LUA_MASKRET|LUA_MASKLINE|LUA_MASKCOUNT, 1, -1, true); wxlState.RunString(wxT("print(\"Showing stack\")")); ! wxlState.SetLuaDebugHook(hook_mask, hook_count, hook_yield, hook_send); luaShell->CheckPrompt(true); err = false; |
From: John L. <jr...@us...> - 2007-12-13 06:23:59
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11381/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp wxlstate.cpp Log Message: Second try at really allowing pushing the same object, but with different tags by tracking the userdata and have it fully clean up after itself. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** wxlstate.cpp 13 Dec 2007 00:47:51 -0000 1.150 --- wxlstate.cpp 13 Dec 2007 06:23:55 -0000 1.151 *************** *** 629,645 **** } ! bool LUACALL wxluaO_deletegcobject(lua_State *L, void *obj_ptr, int flags) { if (obj_ptr == 0) return false; ! // No derived methods and remove weak refs to it ! if (WXLUA_HASBIT(flags, wxLUA_REMOVE_OBJECT)) ! { ! wxlua_removederivedmethod(L, obj_ptr); ! wxluaO_untrackweakobject(L, obj_ptr); ! } ! if (WXLUA_HASBIT(flags, wxLUA_UNDELETE_OBJECT|wxLUA_DELETE_OBJECT)) { lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) --- 629,645 ---- } ! bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags) { if (obj_ptr == 0) return false; ! bool delete_all = WXLUA_HASBIT(flags, WXLUA_DELETE_OBJECT_ALL); ! // Remove the weak ref to it ! int udata_count = wxluaO_untrackweakobject(L, delete_all ? NULL : udata, obj_ptr); ! ! if (delete_all || (udata_count < 2)) { + wxlua_removederivedmethods(L, obj_ptr); + lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) *************** *** 651,659 **** { // delete the real object for the case where it's encapsulated ! if (WXLUA_HASBIT(flags, wxLUA_DELETE_OBJECT)) ! { ! wxObject *wxobj_ptr = (wxObject*)lua_touserdata(L, -1); ! delete wxobj_ptr; ! } lua_pop(L, 1); // pop lightuserdata --- 651,657 ---- { // delete the real object for the case where it's encapsulated ! ! wxObject *wxobj_ptr = (wxObject*)lua_touserdata(L, -1); ! delete wxobj_ptr; lua_pop(L, 1); // pop lightuserdata *************** *** 671,674 **** --- 669,673 ---- // no error message since we're called from wxluabind__gc_wxLuaBindClass // automatically for all our objects and this table stores which ones to delete + // so we don't want to have to check first and then call this. lua_pop(L, 2); // pop nil and delobj } *************** *** 678,681 **** --- 677,707 ---- } + bool LUACALL wxluaO_undeletegcobject(lua_State *L, void *obj_ptr) + { + if (obj_ptr == 0) return false; + + lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key + lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) + + lua_pushlightuserdata(L, obj_ptr); // push key + lua_rawget(L, -2); // get t[key] = value, pops key + + if (lua_islightuserdata(L, -1)) // is the wxObject* we delete + { + lua_pop(L, 1); // pop lightuserdata + + lua_pushlightuserdata(L, obj_ptr); // push key + lua_pushnil(L); // push value + lua_rawset(L, -3); // set t[key] = value, pops key and value + + lua_pop(L, 1); // pop delobj table + return true; + } + else + lua_pop(L, 2); // pop nil and delobj + + return false; + } + bool LUACALL wxluaO_isgcobject(lua_State *L, void *obj_ptr) { *************** *** 740,744 **** lua_setmetatable(L, -2); // via the metatable lua_rawset(L, -3); ! lua_pushlightuserdata(L, obj_ptr); // get the table back lua_rawget(L, -2); --- 766,770 ---- lua_setmetatable(L, -2); // via the metatable lua_rawset(L, -3); ! lua_pushlightuserdata(L, obj_ptr); // get the table back lua_rawget(L, -2); *************** *** 752,756 **** lua_pop(L, 1); // pop nil } ! lua_pushnumber(L, tag); lua_pushvalue(L, ABS_LUA_STKIDX(udata_stack_idx, 3)); // push the Lua userdata as the value (note: weak valued table) --- 778,782 ---- lua_pop(L, 1); // pop nil } ! lua_pushnumber(L, tag); lua_pushvalue(L, ABS_LUA_STKIDX(udata_stack_idx, 3)); // push the Lua userdata as the value (note: weak valued table) *************** *** 759,763 **** } ! bool LUACALL wxluaO_untrackweakobject(lua_State *L, void *obj_ptr) { lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key --- 785,789 ---- } ! int LUACALL wxluaO_untrackweakobject(lua_State *L, void* udata, void *obj_ptr) { lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key *************** *** 767,770 **** --- 793,799 ---- lua_rawget(L, -2); // get t[key] = value; pop key push value + int count = 0; + bool cleared_udata = false; + if (lua_istable(L, -1)) { *************** *** 774,794 **** { // value = -1, key = -2, table = -3 ! lua_pushnil(L); ! lua_setmetatable(L, -2); // remove value's metatable ! lua_pop(L, 1); // pop value, leave key for next iteration } lua_pop(L, 1); // pop obj_ptr table ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_pushnil(L); // push value ! lua_rawset(L, -3); // set t[key] = nil; pops key and value lua_pop(L, 1); // pop objects table - return true; } else lua_pop(L, 2); // pop nil and weakobj table ! return false; } --- 803,843 ---- { // value = -1, key = -2, table = -3 ! void *u = lua_touserdata(L, -1); ! ++count; ! ! if ((udata == NULL) || (udata == u)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); // remove value's metatable ! } ! ! if (udata == u) ! { ! cleared_udata = true; ! lua_pop(L, 1); // pop value ! ! lua_pushvalue(L, -1); // copy key for next iteration ! lua_pushnil(L); ! lua_rawset(L, -4); // set t[key] = nil to remove it ! } ! else ! lua_pop(L, 1); // pop value, leave key for next iteration } lua_pop(L, 1); // pop obj_ptr table ! if ((udata == NULL) || (count == 0) || ((count == 1) && cleared_udata)) ! { ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_pushnil(L); // push value ! lua_rawset(L, -3); // set t[key] = nil; pops key and value ! } ! lua_pop(L, 1); // pop objects table } else lua_pop(L, 2); // pop nil and weakobj table ! return count; } *************** *** 1566,1570 **** return found; } ! bool LUACALL wxlua_removederivedmethod(lua_State* L, void *pObject) { bool found = false; --- 1615,1619 ---- return found; } ! bool LUACALL wxlua_removederivedmethods(lua_State* L, void *obj_ptr) { bool found = false; *************** *** 1573,1577 **** lua_rawget( L, LUA_REGISTRYINDEX ); // pop key, push table ! lua_pushlightuserdata(L, (void *)pObject); lua_rawget(L, -2); // pop key, push table or nil --- 1622,1626 ---- lua_rawget( L, LUA_REGISTRYINDEX ); // pop key, push table ! lua_pushlightuserdata(L, (void *)obj_ptr); lua_rawget(L, -2); // pop key, push table or nil *************** *** 1596,1600 **** lua_pop(L, 1); // pop the obj table ! lua_pushlightuserdata(L, (void *)pObject); // push key lua_pushnil(L); // push value, to remove it lua_rawset(L, -3); // set t[key] = value; pop key and value --- 1645,1649 ---- lua_pop(L, 1); // pop the obj table ! lua_pushlightuserdata(L, (void *)obj_ptr); // push key lua_pushnil(L); // push value, to remove it lua_rawset(L, -3); // set t[key] = value; pop key and value *************** *** 2756,2763 **** } ! bool wxLuaState::DeleteGCObject(void *obj_ptr, int flags) { wxCHECK_MSG(Ok() && obj_ptr, false, wxT("Invalid wxLuaState or object")); ! return wxluaO_deletegcobject(M_WXLSTATEDATA->m_lua_State, obj_ptr, flags); } --- 2805,2812 ---- } ! bool wxLuaState::DeleteGCObject(void* udata, void *obj_ptr, int flags) { wxCHECK_MSG(Ok() && obj_ptr, false, wxT("Invalid wxLuaState or object")); ! return wxluaO_deletegcobject(M_WXLSTATEDATA->m_lua_State, udata, obj_ptr, flags); } *************** *** 3125,3149 **** } ! bool wxLuaState::SetDerivedMethod(void *pObject, const char *method_name, wxLuaObject* wxlObj) { ! wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to set derived method for.")); ! return wxlua_setderivedmethod(M_WXLSTATEDATA->m_lua_State, pObject, method_name, wxlObj); } ! bool wxLuaState::HasDerivedMethod(void *pObject, const char *method_name, bool push_method) const { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! return wxlua_hasderivedmethod(M_WXLSTATEDATA->m_lua_State, pObject, method_name, push_method); } ! bool wxLuaState::RemoveDerivedMethod(void *pObject) const { ! wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to remove.")); ! return wxlua_removederivedmethod(M_WXLSTATEDATA->m_lua_State, pObject); } ! wxLuaState wxLuaState::GetDerivedMethodState(void *pObject, const char *method) { ! wxCHECK_MSG(pObject, wxNullLuaState, wxT("Invalid object to wxLuaState::GetDerivedMethod")); wxHashMapLuaState::iterator it; --- 3174,3198 ---- } ! bool wxLuaState::SetDerivedMethod(void *obj_ptr, const char *method_name, wxLuaObject* wxlObj) { ! wxCHECK_MSG(Ok() && obj_ptr, false, wxT("Invalid wxLuaState or object to set derived method for.")); ! return wxlua_setderivedmethod(M_WXLSTATEDATA->m_lua_State, obj_ptr, method_name, wxlObj); } ! bool wxLuaState::HasDerivedMethod(void *obj_ptr, const char *method_name, bool push_method) const { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! return wxlua_hasderivedmethod(M_WXLSTATEDATA->m_lua_State, obj_ptr, method_name, push_method); } ! bool wxLuaState::RemoveDerivedMethods(void *obj_ptr) const { ! wxCHECK_MSG(Ok() && obj_ptr, false, wxT("Invalid wxLuaState or object to remove.")); ! return wxlua_removederivedmethods(M_WXLSTATEDATA->m_lua_State, obj_ptr); } ! wxLuaState wxLuaState::GetDerivedMethodState(void *obj_ptr, const char *method) { ! wxCHECK_MSG(obj_ptr, wxNullLuaState, wxT("Invalid object to wxLuaState::GetDerivedMethod")); wxHashMapLuaState::iterator it; *************** *** 3152,3156 **** { wxLuaState wxlState((wxLuaState*)it->second); ! if (wxlState.HasDerivedMethod(pObject, method, false)) return wxlState; } --- 3201,3205 ---- { wxLuaState wxlState((wxLuaState*)it->second); ! if (wxlState.HasDerivedMethod(obj_ptr, method, false)) return wxlState; } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** wxlbind.cpp 13 Dec 2007 00:47:51 -0000 1.104 --- wxlbind.cpp 13 Dec 2007 06:23:55 -0000 1.105 *************** *** 569,575 **** int LUACALL wxLua_wxluabind_delete(lua_State *L) { ! void* self = wxlua_touserdata(L, 1, false); // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_deletegcobject(L, self, wxLUA_DELETE_REMOVE_OBJECT)) { lua_pushnil(L); --- 569,576 ---- int LUACALL wxLua_wxluabind_delete(lua_State *L) { ! void* udata = lua_touserdata(L, 1); ! void* obj_ptr = wxlua_touserdata(L, 1, false); // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((obj_ptr != NULL) && wxluaO_deletegcobject(L, udata, obj_ptr, WXLUA_DELETE_OBJECT_ALL)) { lua_pushnil(L); *************** *** 579,584 **** { // leave this printf since we really want to know if this happens ! wxPrintf(wxT("Unable to call wxuserdata:delete() on object %p\n"), self); ! wxlua_error(L, wxString::Format(wxT("Unable to call wxuserdata:delete() on object %p"), self)); } --- 580,585 ---- { // leave this printf since we really want to know if this happens ! wxPrintf(wxT("Unable to call wxuserdata:delete() on object %p\n"), obj_ptr); ! wxlua_error(L, wxString::Format(wxT("Unable to call wxuserdata:delete() on object %p"), obj_ptr)); } *************** *** 596,603 **** if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_gettag(L, 1) == *wxlClass->class_tag)) { ! void* key = wxlua_touserdata(L, 1, true); // clean up the rest of this, this won't error if the key doesn't exist ! wxluaO_deletegcobject(L, key, wxLUA_DELETE_REMOVE_OBJECT); } --- 597,605 ---- if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_gettag(L, 1) == *wxlClass->class_tag)) { ! void* udata = lua_touserdata(L, 1); ! void* obj_ptr = wxlua_touserdata(L, 1, true); // clean up the rest of this, this won't error if the key doesn't exist ! wxluaO_deletegcobject(L, udata, obj_ptr, WXLUA_DELETE_OBJECT_LAST); } *************** *** 1225,1231 **** if (wxlObject->objPtr != 0) ! wxlState.wxluaT_PushUserTag(wxlObject->objPtr, *wxlObject->class_tag, true); else ! wxlState.wxluaT_PushUserTag(*wxlObject->pObjPtr, *wxlObject->class_tag, true); lua_rawset(L, -3); --- 1227,1233 ---- if (wxlObject->objPtr != 0) ! wxluaT_pushusertag(L, wxlObject->objPtr, *wxlObject->class_tag, true); else ! wxluaT_pushusertag(L, *wxlObject->pObjPtr, *wxlObject->class_tag, true); lua_rawset(L, -3); Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** wxlcallb.cpp 13 Dec 2007 00:47:51 -0000 1.50 --- wxlcallb.cpp 13 Dec 2007 06:23:55 -0000 1.51 *************** *** 230,236 **** { // clear the metatable for the copy of the we are tracking (clears it for all copies too) ! wxluaO_deletegcobject(m_wxlState.GetLuaState(), m_window, wxLUA_REMOVE_OBJECT); ! // Now remove the object since it's gone ! m_wxlState.DeleteGCObject(m_window, wxLUA_REMOVE_OBJECT); // Clear our own pointer to this window m_wxlState.RemoveTrackedWindow(m_window); --- 230,236 ---- { // clear the metatable for the copy of the we are tracking (clears it for all copies too) ! wxluaO_untrackweakobject(m_wxlState.GetLuaState(), NULL, m_window); ! wxlua_removederivedmethods(m_wxlState.GetLuaState(), m_window); ! // Clear our own pointer to this window m_wxlState.RemoveTrackedWindow(m_window); |
From: John L. <jr...@us...> - 2007-12-13 06:23:59
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11381/wxLua/modules/wxbind/src Modified Files: wxadv_adv.cpp wxaui_aui.cpp wxbase_base.cpp wxbase_config.cpp wxcore_clipdrag.cpp wxcore_gdi.cpp wxcore_help.cpp wxcore_image.cpp wxcore_mdi.cpp wxcore_menutool.cpp wxcore_print.cpp wxcore_windows.cpp wxxml_xml.cpp wxxrc_xrc.cpp Log Message: Second try at really allowing pushing the same object, but with different tags by tracking the userdata and have it fully clean up after itself. Index: wxbase_base.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_base.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxbase_base.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxbase_base.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 1282,1286 **** // wxLog pLogger wxLog * pLogger = (wxLog *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLog); ! if (wxluaO_isgcobject(L, pLogger)) wxluaO_deletegcobject(L, pLogger, wxLUA_UNDELETE_OBJECT); // call SetActiveTarget wxLog* returns = (wxLog*)wxLog::SetActiveTarget(pLogger); --- 1282,1286 ---- // wxLog pLogger wxLog * pLogger = (wxLog *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLog); ! if (wxluaO_isgcobject(L, pLogger)) wxluaO_undeletegcobject(L, pLogger); // call SetActiveTarget wxLog* returns = (wxLog*)wxLog::SetActiveTarget(pLogger); Index: wxxrc_xrc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxxrc_xrc.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxxrc_xrc.cpp 13 Dec 2007 00:47:51 -0000 1.7 --- wxxrc_xrc.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 440,444 **** // wxXmlResource res wxXmlResource * res = (wxXmlResource *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlResource); ! if (wxluaO_isgcobject(L, res)) wxluaO_deletegcobject(L, res, wxLUA_UNDELETE_OBJECT); // call Set wxXmlResource* returns = (wxXmlResource*)wxXmlResource::Set(res); --- 440,444 ---- // wxXmlResource res wxXmlResource * res = (wxXmlResource *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlResource); ! if (wxluaO_isgcobject(L, res)) wxluaO_undeletegcobject(L, res); // call Set wxXmlResource* returns = (wxXmlResource*)wxXmlResource::Set(res); Index: wxbase_config.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_config.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxbase_config.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxbase_config.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 554,558 **** // wxConfigBase pConfig = NULL wxConfigBase * pConfig = (argCount >= 1 ? (wxConfigBase *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase) : NULL); ! if (wxluaO_isgcobject(L, pConfig)) wxluaO_deletegcobject(L, pConfig, wxLUA_UNDELETE_OBJECT); // call Set wxConfigBase* returns = (wxConfigBase*)wxConfigBase::Set(pConfig); --- 554,558 ---- // wxConfigBase pConfig = NULL wxConfigBase * pConfig = (argCount >= 1 ? (wxConfigBase *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase) : NULL); ! if (wxluaO_isgcobject(L, pConfig)) wxluaO_undeletegcobject(L, pConfig); // call Set wxConfigBase* returns = (wxConfigBase*)wxConfigBase::Set(pConfig); *************** *** 670,674 **** // we may not be tracked, but delete us anyway ! if (!wxluaO_deletegcobject(L, self, wxLUA_DELETE_REMOVE_OBJECT)) delete self; --- 670,674 ---- // we may not be tracked, but delete us anyway ! if (!wxluaO_deletegcobject(L, lua_touserdata(L, 1), self, WXLUA_DELETE_OBJECT_ALL)) delete self; Index: wxcore_print.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_print.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxcore_print.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxcore_print.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 3375,3380 **** // we must disconnect them from our tracking list if (printoutForPrinting != NULL) ! wxluaO_deletegcobject(L, printoutForPrinting, wxLUA_UNDELETE_OBJECT); ! wxluaO_deletegcobject(L, printout, wxLUA_UNDELETE_OBJECT); // call constructor --- 3375,3380 ---- // we must disconnect them from our tracking list if (printoutForPrinting != NULL) ! wxluaO_undeletegcobject(L, printoutForPrinting); ! wxluaO_undeletegcobject(L, printout); // call constructor Index: wxcore_windows.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_windows.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxcore_windows.cpp 13 Dec 2007 00:47:49 -0000 1.8 --- wxcore_windows.cpp 13 Dec 2007 06:23:54 -0000 1.9 *************** *** 3511,3515 **** // wxToolTip tip wxToolTip * tip = (wxToolTip *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxToolTip); ! if (wxluaO_isgcobject(L, tip)) wxluaO_deletegcobject(L, tip, wxLUA_UNDELETE_OBJECT); // get this wxWindow * self = (wxWindow *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxWindow); --- 3511,3515 ---- // wxToolTip tip wxToolTip * tip = (wxToolTip *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxToolTip); ! if (wxluaO_isgcobject(L, tip)) wxluaO_undeletegcobject(L, tip); // get this wxWindow * self = (wxWindow *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxWindow); Index: wxxml_xml.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxxml_xml.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxxml_xml.cpp 13 Dec 2007 00:47:51 -0000 1.8 --- wxxml_xml.cpp 13 Dec 2007 06:23:54 -0000 1.9 *************** *** 37,41 **** // wxXmlNode child wxXmlNode * child = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); ! if (wxluaO_isgcobject(L, child)) wxluaO_deletegcobject(L, child, wxLUA_UNDELETE_OBJECT); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); --- 37,41 ---- // wxXmlNode child wxXmlNode * child = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); ! if (wxluaO_isgcobject(L, child)) wxluaO_undeletegcobject(L, child); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); *************** *** 54,58 **** // wxXmlProperty prop wxXmlProperty * prop = (wxXmlProperty *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlProperty); ! if (wxluaO_isgcobject(L, prop)) wxluaO_deletegcobject(L, prop, wxLUA_UNDELETE_OBJECT); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); --- 54,58 ---- // wxXmlProperty prop wxXmlProperty * prop = (wxXmlProperty *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlProperty); ! if (wxluaO_isgcobject(L, prop)) wxluaO_undeletegcobject(L, prop); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); *************** *** 284,288 **** // wxXmlNode child wxXmlNode * child = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); ! if (wxluaO_isgcobject(L, child)) wxluaO_deletegcobject(L, child, wxLUA_UNDELETE_OBJECT); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); --- 284,288 ---- // wxXmlNode child wxXmlNode * child = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); ! if (wxluaO_isgcobject(L, child)) wxluaO_undeletegcobject(L, child); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); *************** *** 325,329 **** // wxXmlNode child wxXmlNode * child = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); ! if (wxluaO_isgcobject(L, child)) wxluaO_deletegcobject(L, child, wxLUA_UNDELETE_OBJECT); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); --- 325,329 ---- // wxXmlNode child wxXmlNode * child = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); ! if (wxluaO_isgcobject(L, child)) wxluaO_undeletegcobject(L, child); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); *************** *** 406,410 **** // wxXmlProperty prop wxXmlProperty * prop = (wxXmlProperty *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlProperty); ! if (wxluaO_isgcobject(L, prop)) wxluaO_deletegcobject(L, prop, wxLUA_UNDELETE_OBJECT); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); --- 406,410 ---- // wxXmlProperty prop wxXmlProperty * prop = (wxXmlProperty *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlProperty); ! if (wxluaO_isgcobject(L, prop)) wxluaO_undeletegcobject(L, prop); // get this wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); *************** *** 934,938 **** // wxXmlNode node wxXmlNode * node = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); ! if (wxluaO_isgcobject(L, node)) wxluaO_deletegcobject(L, node, wxLUA_UNDELETE_OBJECT); // get this wxXmlDocument * self = (wxXmlDocument *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlDocument); --- 934,938 ---- // wxXmlNode node wxXmlNode * node = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); ! if (wxluaO_isgcobject(L, node)) wxluaO_undeletegcobject(L, node); // get this wxXmlDocument * self = (wxXmlDocument *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlDocument); Index: wxaui_aui.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxaui_aui.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxaui_aui.cpp 13 Dec 2007 00:47:49 -0000 1.10 --- wxaui_aui.cpp 13 Dec 2007 06:23:54 -0000 1.11 *************** *** 6412,6416 **** // wxAuiDockArt art_provider wxAuiDockArt * art_provider = (wxAuiDockArt *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxAuiDockArt); ! if (wxluaO_isgcobject(L, art_provider)) wxluaO_deletegcobject(L, art_provider, wxLUA_UNDELETE_OBJECT); // get this wxAuiManager * self = (wxAuiManager *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxAuiManager); --- 6412,6416 ---- // wxAuiDockArt art_provider wxAuiDockArt * art_provider = (wxAuiDockArt *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxAuiDockArt); ! if (wxluaO_isgcobject(L, art_provider)) wxluaO_undeletegcobject(L, art_provider); // get this wxAuiManager * self = (wxAuiManager *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxAuiManager); *************** *** 8160,8164 **** // wxAuiTabArt provider wxAuiTabArt * provider = (wxAuiTabArt *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxAuiTabArt); ! if (wxluaO_isgcobject(L, provider)) wxluaO_deletegcobject(L, provider, wxLUA_UNDELETE_OBJECT); // get this wxAuiMDIParentFrame * self = (wxAuiMDIParentFrame *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxAuiMDIParentFrame); --- 8160,8164 ---- // wxAuiTabArt provider wxAuiTabArt * provider = (wxAuiTabArt *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxAuiTabArt); ! if (wxluaO_isgcobject(L, provider)) wxluaO_undeletegcobject(L, provider); // get this wxAuiMDIParentFrame * self = (wxAuiMDIParentFrame *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxAuiMDIParentFrame); Index: wxadv_adv.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxadv_adv.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxadv_adv.cpp 13 Dec 2007 00:47:48 -0000 1.7 --- wxadv_adv.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 2114,2118 **** // size_t day size_t day = (size_t)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, attr)) wxluaO_deletegcobject(L, attr, wxLUA_UNDELETE_OBJECT); // get this wxCalendarCtrl * self = (wxCalendarCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxCalendarCtrl); --- 2114,2118 ---- // size_t day size_t day = (size_t)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, attr)) wxluaO_undeletegcobject(L, attr); // get this wxCalendarCtrl * self = (wxCalendarCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxCalendarCtrl); Index: wxcore_clipdrag.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_clipdrag.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxcore_clipdrag.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxcore_clipdrag.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 44,48 **** // wxDataObject data wxDataObject * data = (wxDataObject *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObject); ! if (wxluaO_isgcobject(L, data)) wxluaO_deletegcobject(L, data, wxLUA_UNDELETE_OBJECT); // get this wxClipboard * self = (wxClipboard *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboard); --- 44,48 ---- // wxDataObject data wxDataObject * data = (wxDataObject *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObject); ! if (wxluaO_isgcobject(L, data)) wxluaO_undeletegcobject(L, data); // get this wxClipboard * self = (wxClipboard *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboard); *************** *** 203,207 **** // wxDataObject data wxDataObject * data = (wxDataObject *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObject); ! if (wxluaO_isgcobject(L, data)) wxluaO_deletegcobject(L, data, wxLUA_UNDELETE_OBJECT); // get this wxClipboard * self = (wxClipboard *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboard); --- 203,207 ---- // wxDataObject data wxDataObject * data = (wxDataObject *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObject); ! if (wxluaO_isgcobject(L, data)) wxluaO_undeletegcobject(L, data); // get this wxClipboard * self = (wxClipboard *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboard); *************** *** 875,879 **** // wxDataObjectSimple dataObject wxDataObjectSimple * dataObject = (wxDataObjectSimple *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObjectSimple); ! if (wxluaO_isgcobject(L, dataObject)) wxluaO_deletegcobject(L, dataObject, wxLUA_UNDELETE_OBJECT); // get this wxDataObjectComposite * self = (wxDataObjectComposite *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDataObjectComposite); --- 875,879 ---- // wxDataObjectSimple dataObject wxDataObjectSimple * dataObject = (wxDataObjectSimple *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObjectSimple); ! if (wxluaO_isgcobject(L, dataObject)) wxluaO_undeletegcobject(L, dataObject); // get this wxDataObjectComposite * self = (wxDataObjectComposite *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDataObjectComposite); Index: wxcore_help.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_help.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxcore_help.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxcore_help.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 250,254 **** // wxHelpProvider helpProvider wxHelpProvider * helpProvider = (wxHelpProvider *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHelpProvider); ! if (wxluaO_isgcobject(L, helpProvider)) wxluaO_deletegcobject(L, helpProvider, wxLUA_UNDELETE_OBJECT); // call Set wxHelpProvider* returns = (wxHelpProvider*)wxHelpProvider::Set(helpProvider); --- 250,254 ---- // wxHelpProvider helpProvider wxHelpProvider * helpProvider = (wxHelpProvider *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHelpProvider); ! if (wxluaO_isgcobject(L, helpProvider)) wxluaO_undeletegcobject(L, helpProvider); // call Set wxHelpProvider* returns = (wxHelpProvider*)wxHelpProvider::Set(helpProvider); Index: wxcore_gdi.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_gdi.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wxcore_gdi.cpp 13 Dec 2007 00:47:49 -0000 1.9 --- wxcore_gdi.cpp 13 Dec 2007 06:23:54 -0000 1.10 *************** *** 8001,8005 **** // wxMask mask wxMask * mask = (wxMask *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMask); ! if (wxluaO_isgcobject(L, mask)) wxluaO_deletegcobject(L, mask, wxLUA_UNDELETE_OBJECT); // get this wxBitmap * self = (wxBitmap *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxBitmap); --- 8001,8005 ---- // wxMask mask wxMask * mask = (wxMask *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMask); ! if (wxluaO_isgcobject(L, mask)) wxluaO_undeletegcobject(L, mask); // get this wxBitmap * self = (wxBitmap *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxBitmap); *************** *** 14692,14696 **** // wxRendererNative renderer wxRendererNative * renderer = (wxRendererNative *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRendererNative); ! if (wxluaO_isgcobject(L, renderer)) wxluaO_deletegcobject(L, renderer, wxLUA_UNDELETE_OBJECT); // call Set wxRendererNative* returns = (wxRendererNative*)wxRendererNative::Set(renderer); --- 14692,14696 ---- // wxRendererNative renderer wxRendererNative * renderer = (wxRendererNative *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRendererNative); ! if (wxluaO_isgcobject(L, renderer)) wxluaO_undeletegcobject(L, renderer); // call Set wxRendererNative* returns = (wxRendererNative*)wxRendererNative::Set(renderer); Index: wxcore_menutool.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_menutool.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxcore_menutool.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxcore_menutool.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 43,47 **** // wxMenuItem menuItem wxMenuItem * menuItem = (wxMenuItem *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMenuItem); ! if (wxluaO_isgcobject(L, menuItem)) wxluaO_deletegcobject(L, menuItem, wxLUA_UNDELETE_OBJECT); // get this wxMenu * self = (wxMenu *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenu); --- 43,47 ---- // wxMenuItem menuItem wxMenuItem * menuItem = (wxMenuItem *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMenuItem); ! if (wxluaO_isgcobject(L, menuItem)) wxluaO_undeletegcobject(L, menuItem); // get this wxMenu * self = (wxMenu *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenu); *************** *** 70,74 **** // int id int id = (int)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, subMenu)) wxluaO_deletegcobject(L, subMenu, wxLUA_UNDELETE_OBJECT); // get this wxMenu * self = (wxMenu *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenu); --- 70,74 ---- // int id int id = (int)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, subMenu)) wxluaO_undeletegcobject(L, subMenu); // get this wxMenu * self = (wxMenu *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenu); *************** *** 442,446 **** // size_t pos size_t pos = (size_t)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, item)) wxluaO_deletegcobject(L, item, wxLUA_UNDELETE_OBJECT); // get this wxMenu * self = (wxMenu *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenu); --- 442,446 ---- // size_t pos size_t pos = (size_t)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, item)) wxluaO_undeletegcobject(L, item); // get this wxMenu * self = (wxMenu *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenu); *************** *** 595,599 **** // wxMenuItem item wxMenuItem * item = (wxMenuItem *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMenuItem); ! if (wxluaO_isgcobject(L, item)) wxluaO_deletegcobject(L, item, wxLUA_UNDELETE_OBJECT); // get this wxMenu * self = (wxMenu *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenu); --- 595,599 ---- // wxMenuItem item wxMenuItem * item = (wxMenuItem *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMenuItem); ! if (wxluaO_isgcobject(L, item)) wxluaO_undeletegcobject(L, item); // get this wxMenu * self = (wxMenu *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenu); *************** *** 1132,1136 **** // wxMenu menu wxMenu * menu = (wxMenu *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMenu); ! if (wxluaO_isgcobject(L, menu)) wxluaO_deletegcobject(L, menu, wxLUA_UNDELETE_OBJECT); // get this wxMenuBar * self = (wxMenuBar *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenuBar); --- 1132,1136 ---- // wxMenu menu wxMenu * menu = (wxMenu *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMenu); ! if (wxluaO_isgcobject(L, menu)) wxluaO_undeletegcobject(L, menu); // get this wxMenuBar * self = (wxMenuBar *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenuBar); *************** *** 1361,1365 **** // size_t pos size_t pos = (size_t)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, menu)) wxluaO_deletegcobject(L, menu, wxLUA_UNDELETE_OBJECT); // get this wxMenuBar * self = (wxMenuBar *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenuBar); --- 1361,1365 ---- // size_t pos size_t pos = (size_t)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, menu)) wxluaO_undeletegcobject(L, menu); // get this wxMenuBar * self = (wxMenuBar *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenuBar); *************** *** 1453,1457 **** // size_t pos size_t pos = (size_t)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, menu)) wxluaO_deletegcobject(L, menu, wxLUA_UNDELETE_OBJECT); // get this wxMenuBar * self = (wxMenuBar *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenuBar); --- 1453,1457 ---- // size_t pos size_t pos = (size_t)wxlua_getnumbertype(L, 2); ! if (wxluaO_isgcobject(L, menu)) wxluaO_undeletegcobject(L, menu); // get this wxMenuBar * self = (wxMenuBar *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMenuBar); Index: wxcore_image.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_image.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxcore_image.cpp 13 Dec 2007 00:47:49 -0000 1.8 --- wxcore_image.cpp 13 Dec 2007 06:23:54 -0000 1.9 *************** *** 43,47 **** // wxImageHandler handler wxImageHandler * handler = (wxImageHandler *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImageHandler); ! if (wxluaO_isgcobject(L, handler)) wxluaO_deletegcobject(L, handler, wxLUA_UNDELETE_OBJECT); // call AddHandler wxImage::AddHandler(handler); --- 43,47 ---- // wxImageHandler handler wxImageHandler * handler = (wxImageHandler *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImageHandler); ! if (wxluaO_isgcobject(L, handler)) wxluaO_undeletegcobject(L, handler); // call AddHandler wxImage::AddHandler(handler); *************** *** 800,804 **** // wxImageHandler handler wxImageHandler * handler = (wxImageHandler *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImageHandler); ! if (wxluaO_isgcobject(L, handler)) wxluaO_deletegcobject(L, handler, wxLUA_UNDELETE_OBJECT); // call InsertHandler wxImage::InsertHandler(handler); --- 800,804 ---- // wxImageHandler handler wxImageHandler * handler = (wxImageHandler *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImageHandler); ! if (wxluaO_isgcobject(L, handler)) wxluaO_undeletegcobject(L, handler); // call InsertHandler wxImage::InsertHandler(handler); *************** *** 3446,3450 **** // wxArtProvider provider wxArtProvider * provider = (wxArtProvider *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxArtProvider); ! if (wxluaO_isgcobject(L, provider)) wxluaO_deletegcobject(L, provider, wxLUA_UNDELETE_OBJECT); // call Delete bool returns = (wxArtProvider::Delete(provider)); --- 3446,3450 ---- // wxArtProvider provider wxArtProvider * provider = (wxArtProvider *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxArtProvider); ! if (wxluaO_isgcobject(L, provider)) wxluaO_undeletegcobject(L, provider); // call Delete bool returns = (wxArtProvider::Delete(provider)); *************** *** 3548,3552 **** // wxArtProvider provider wxArtProvider * provider = (wxArtProvider *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxArtProvider); ! if (wxluaO_isgcobject(L, provider)) wxluaO_deletegcobject(L, provider, wxLUA_UNDELETE_OBJECT); // call Insert wxArtProvider::Insert(provider); --- 3548,3552 ---- // wxArtProvider provider wxArtProvider * provider = (wxArtProvider *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxArtProvider); ! if (wxluaO_isgcobject(L, provider)) wxluaO_undeletegcobject(L, provider); // call Insert wxArtProvider::Insert(provider); *************** *** 3582,3586 **** // wxArtProvider provider wxArtProvider * provider = (wxArtProvider *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxArtProvider); ! if (wxluaO_isgcobject(L, provider)) wxluaO_deletegcobject(L, provider, wxLUA_UNDELETE_OBJECT); // call Push wxArtProvider::Push(provider); --- 3582,3586 ---- // wxArtProvider provider wxArtProvider * provider = (wxArtProvider *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxArtProvider); ! if (wxluaO_isgcobject(L, provider)) wxluaO_undeletegcobject(L, provider); // call Push wxArtProvider::Push(provider); Index: wxcore_mdi.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_mdi.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxcore_mdi.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxcore_mdi.cpp 13 Dec 2007 06:23:54 -0000 1.8 *************** *** 205,209 **** // wxMenu menu wxMenu * menu = (wxMenu *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMenu); ! if (wxluaO_isgcobject(L, menu)) wxluaO_deletegcobject(L, menu, wxLUA_UNDELETE_OBJECT); // get this wxMDIParentFrame * self = (wxMDIParentFrame *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMDIParentFrame); --- 205,209 ---- // wxMenu menu wxMenu * menu = (wxMenu *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxMenu); ! if (wxluaO_isgcobject(L, menu)) wxluaO_undeletegcobject(L, menu); // get this wxMDIParentFrame * self = (wxMDIParentFrame *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxMDIParentFrame); |
From: John L. <jr...@us...> - 2007-12-13 06:23:58
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11381/wxLua/modules/wxlua/include Modified Files: wxlstate.h Log Message: Second try at really allowing pushing the same object, but with different tags by tracking the userdata and have it fully clean up after itself. Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** wxlstate.h 13 Dec 2007 00:47:51 -0000 1.105 --- wxlstate.h 13 Dec 2007 06:23:54 -0000 1.106 *************** *** 101,105 **** extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_wxluastate_key; // The key in the LUA_REGISTRYINDEX table that is table of all ! // objects that we've pushed into Lua. // t[lightuserdata of obj_ptr] = { tag1 = [weak full userdata], tag2... } // Note: a single object like a wxWindow may be pushed as multiple tags when --- 101,105 ---- extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_wxluastate_key; // The key in the LUA_REGISTRYINDEX table that is table of all ! // objects that we've pushed into Lua. // t[lightuserdata of obj_ptr] = { tag1 = [weak full userdata], tag2... } // Note: a single object like a wxWindow may be pushed as multiple tags when *************** *** 253,269 **** //---------------------------------------------------------------------------- ! enum wxLuaGCObject_flags { ! wxLUA_UNDELETE_OBJECT = 0x0001, // Remove from the wxlua_lreg_gcobjects_key table ! // so we won't delete it (someone else should), ! // but keep the userdata in the wxlua_lreg_weakobjects_key ! // table, it's still in Lua and is usable. ! wxLUA_DELETE_OBJECT = 0x0002, // Literally delete the object and remove it from the ! // wxlua_lreg_gcobjects_key table. See remove... ! wxLUA_REMOVE_OBJECT = 0x0004, // Clear tracking the object in the wxlua_lreg_weakobjects_key ! // and wxlua_lreg_derivedmethods_key since ! // it's gone from Lua. ! wxLUA_DELETE_REMOVE_OBJECT = wxLUA_DELETE_OBJECT|wxLUA_REMOVE_OBJECT }; --- 253,263 ---- //---------------------------------------------------------------------------- ! enum wxLuaGCObject_Flags { ! WXLUA_DELETE_OBJECT_LAST = 0x0000, // Delete the object if this is the last ! // userdata referece to it. ! WXLUA_DELETE_OBJECT_ALL = 0x0001, // Delete the object and clear all userdata ! // references to it. }; *************** *** 276,283 **** WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, const void* obj_ptr, wxObject* wxobj); // Remove this tracked wxObject from the wxlua_lreg_gcobjects_key table of the ! // LUA_REGISTRYINDEX. ! // The object can be deleted and other items associated with it may be removed ! // by setting the "flags" from ored values of enum wxLuaGCObject_flags ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_deletegcobject(lua_State *L, void *obj_ptr, int flags); // Check if this object is in the wxlua_lreg_gcobjects_key table of the // LUA_REGISTRYINDEX. --- 270,283 ---- WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, const void* obj_ptr, wxObject* wxobj); // Remove this tracked wxObject from the wxlua_lreg_gcobjects_key table of the ! // LUA_REGISTRYINDEX and delete it depending on the flags enum wxLuaGCObject_Flags. ! // If WXLUA_DELETE_OBJECT_ALL or if this is the last userdata it will also remove all ! // wxlua_lreg_weakobjects_key and wxlua_lreg_derivedmethods_key since the object is gone. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags); ! ! // Remove this tracked wxObject from the wxlua_lreg_gcobjects_key table of the ! // LUA_REGISTRYINDEX. The Lua userdata for the object stays in Lua and it's ! // assumed that someone else will delete the object (took ownership of it). ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_undeletegcobject(lua_State *L, void *obj_ptr); ! // Check if this object is in the wxlua_lreg_gcobjects_key table of the // LUA_REGISTRYINDEX. *************** *** 289,297 **** // table of the LUA_REGISTRYINDEX so we can push it again if needed. WXDLLIMPEXP_WXLUA void LUACALL wxluaO_trackweakobject(lua_State *L, int udata_stack_idx, void *obj_ptr, int tag); ! // Remove the obj_ptr key from the wxlua_lreg_weakobjects_key table of ! // the LUA_REGISTRYINDEX. It also removes the metatable for ALL Lua userdata ! // that are associated with this obj_ptr since this function is called when the ! // object is deleted. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_untrackweakobject(lua_State *L, void *obj_ptr); // Check if this object with the given tag is in the wxlua_lreg_weakobjects_key // table of the LUA_REGISTRYINDEX. If push_on_stack then push on top of the stack. --- 289,298 ---- // table of the LUA_REGISTRYINDEX so we can push it again if needed. WXDLLIMPEXP_WXLUA void LUACALL wxluaO_trackweakobject(lua_State *L, int udata_stack_idx, void *obj_ptr, int tag); ! // Remove the obj_ptr key from the wxlua_lreg_weakobjects_key table of ! // the LUA_REGISTRYINDEX. It removes the metatable for the Lua userdata, "udata", ! // that are associated with this obj_ptr since this function is called when the ! // object is deleted. If udata == NULL it removes ALL tracked userdata and clears ! // all of their metatables. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaO_untrackweakobject(lua_State *L, void* udata, void *obj_ptr); // Check if this object with the given tag is in the wxlua_lreg_weakobjects_key // table of the LUA_REGISTRYINDEX. If push_on_stack then push on top of the stack. *************** *** 428,433 **** // userdata and the new wxLuaObject wraps the Lua function or value // which will be deleted by this. ! // The derived methods are stored in the "wxLuaDerivedMethods" table in the ! // Lua registry table. WXDLLIMPEXP_WXLUA bool LUACALL wxlua_setderivedmethod(lua_State* L, void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. --- 429,434 ---- // userdata and the new wxLuaObject wraps the Lua function or value // which will be deleted by this. ! // The derived methods are stored in the wxlua_lreg_derivedmethods_key table ! // in the LUA_REGISTRYINDEX. WXDLLIMPEXP_WXLUA bool LUACALL wxlua_setderivedmethod(lua_State* L, void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. *************** *** 437,441 **** // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_removederivedmethod(lua_State* L, void *pObject); //---------------------------------------------------------------------------- --- 438,442 ---- // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_removederivedmethods(lua_State* L, void *pObject); //---------------------------------------------------------------------------- *************** *** 790,803 **** // Track this object and delete it when Lua calls the gc method for it ! void AddGCObject(wxObject *pObject); // Track this object, but hash it on the obj_ptr which may differ from the // pObject and delete it when Lua calls the gc method for it. // This is used for encapsulated classes that are wrapped in a wxObject. ! void AddGCObject(const void* obj_ptr, wxObject *pObject); // Remove the object from the tracked memory and optionally delete it. // flags are ored values of enum wxLuaGCObject_flags ! bool DeleteGCObject(void *pObject, int flags); // Is this object currently tracked? ! bool IsGCObject(void *pObject) const; // Get an array of strings "wxObject_classname count#" wxArrayString GetGCObjectStrings(); --- 791,804 ---- // Track this object and delete it when Lua calls the gc method for it ! void AddGCObject(wxObject *wxobj); // Track this object, but hash it on the obj_ptr which may differ from the // pObject and delete it when Lua calls the gc method for it. // This is used for encapsulated classes that are wrapped in a wxObject. ! void AddGCObject(const void* obj_ptr, wxObject *wxobj); // Remove the object from the tracked memory and optionally delete it. // flags are ored values of enum wxLuaGCObject_flags ! bool DeleteGCObject(void* udata, void *obj_ptr, int flags); // Is this object currently tracked? ! bool IsGCObject(void *obj_ptr) const; // Get an array of strings "wxObject_classname count#" wxArrayString GetGCObjectStrings(); *************** *** 953,957 **** // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. ! bool RemoveDerivedMethod(void *pObject) const; // Find a derived method given an object and and a method name. // If the method can be found, return the valid wxLuaState it belongs to. --- 954,958 ---- // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. ! bool RemoveDerivedMethods(void *pObject) const; // Find a derived method given an object and and a method name. // If the method can be found, return the valid wxLuaState it belongs to. |
From: John L. <jr...@us...> - 2007-12-13 06:23:57
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11381/wxLua/bindings Modified Files: genwxbind.lua Log Message: Second try at really allowing pushing the same object, but with different tags by tracking the userdata and have it fully clean up after itself. Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** genwxbind.lua 13 Dec 2007 00:47:47 -0000 1.154 --- genwxbind.lua 13 Dec 2007 06:23:53 -0000 1.155 *************** *** 3254,3258 **** end elseif param.UnGC then ! table.insert(gcList, " if (wxluaO_isgcobject(L, "..argName..")) wxluaO_deletegcobject(L, "..argName..", wxLUA_UNDELETE_OBJECT);\n") end --- 3254,3258 ---- end elseif param.UnGC then ! table.insert(gcList, " if (wxluaO_isgcobject(L, "..argName..")) wxluaO_undeletegcobject(L, "..argName..");\n") end *************** *** 3591,3595 **** if parseObject["%ungc_this"] then ! table.insert(codeList, " wxluaO_deletegcobject(L, self, wxLUA_UNDELETE_OBJECT);\n") elseif parseObject["%gc_this"] then if parseObject["%encapsulate"] then --- 3591,3595 ---- if parseObject["%ungc_this"] then ! table.insert(codeList, " wxluaO_undeletegcobject(L, self);\n") elseif parseObject["%gc_this"] then if parseObject["%encapsulate"] then *************** *** 3671,3675 **** end elseif member.UnGC then ! table.insert(codeList, " if (wxluaO_isgcobject(L, returns)) wxluaO_deletegcobject(L, returns, wxLUA_UNDELETE_OBJECT);\n") end --- 3671,3675 ---- end elseif member.UnGC then ! table.insert(codeList, " if (wxluaO_isgcobject(L, returns)) wxluaO_undeletegcobject(L, returns);\n") end *************** *** 3828,3846 **** local funcName_ = funcName ! if false then ! table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! table.insert(codeList, " return wxLua_wxlua_delete(L);\n") ! --[[ ! table.insert(codeList, " "..parseObject.Name.." * self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, s_wxluatag_"..MakeClassVar(parseObject.Name)..");\n") ! CommentBindingTable(codeList, " // if removed from tracked mem list, reset the tag so that gc() is not called on this object.\n") ! table.insert(codeList, " if ((self != NULL) && wxluaO_deletegcobject(L, self, wxLUA_DELETE_REMOVE_OBJECT))\n") ! table.insert(codeList, " {\n") ! table.insert(codeList, " lua_pushnil(L);\n") ! table.insert(codeList, " lua_setmetatable(L, -2);\n") ! table.insert(codeList, " }\n") ! table.insert(codeList, " return 0;\n") ! table.insert(codeList, "}\n") ! --]] ! elseif not overrideTable[funcName] then funcName_ = "wxLua_wxluabind_delete" end --- 3828,3832 ---- local funcName_ = funcName ! if not overrideTable[funcName] then funcName_ = "wxLua_wxluabind_delete" end |
From: John L. <jr...@us...> - 2007-12-13 06:23:57
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11381/wxLua/bindings/wxwidgets Modified Files: wxbase_override.hpp wxcore_override.hpp Log Message: Second try at really allowing pushing the same object, but with different tags by tracking the userdata and have it fully clean up after itself. Index: wxbase_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_override.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxbase_override.hpp 13 Dec 2007 00:47:48 -0000 1.10 --- wxbase_override.hpp 13 Dec 2007 06:23:53 -0000 1.11 *************** *** 166,170 **** // we may not be tracked, but delete us anyway ! if (!wxluaO_deletegcobject(L, self, wxLUA_DELETE_REMOVE_OBJECT)) delete self; --- 166,170 ---- // we may not be tracked, but delete us anyway ! if (!wxluaO_deletegcobject(L, lua_touserdata(L, 1), self, WXLUA_DELETE_OBJECT_ALL)) delete self; Index: wxcore_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxcore_override.hpp 13 Dec 2007 00:47:48 -0000 1.10 --- wxcore_override.hpp 13 Dec 2007 06:23:53 -0000 1.11 *************** *** 2354,2359 **** // we must disconnect them from our tracking list if (printoutForPrinting != NULL) ! wxluaO_deletegcobject(L, printoutForPrinting, wxLUA_UNDELETE_OBJECT); ! wxluaO_deletegcobject(L, printout, wxLUA_UNDELETE_OBJECT); // call constructor --- 2354,2359 ---- // we must disconnect them from our tracking list if (printoutForPrinting != NULL) ! wxluaO_undeletegcobject(L, printoutForPrinting); ! wxluaO_undeletegcobject(L, printout); // call constructor |
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/modules/wxbind/src Modified Files: wxadv_adv.cpp wxadv_grid.cpp wxaui_aui.cpp wxbase_base.cpp wxbase_bind.cpp wxbase_config.cpp wxbase_data.cpp wxbase_datetime.cpp wxbase_file.cpp wxcore_appframe.cpp wxcore_bind.cpp wxcore_clipdrag.cpp wxcore_controls.cpp wxcore_core.cpp wxcore_defsutils.cpp wxcore_dialogs.cpp wxcore_event.cpp wxcore_gdi.cpp wxcore_geometry.cpp wxcore_help.cpp wxcore_image.cpp wxcore_mdi.cpp wxcore_menutool.cpp wxcore_picker.cpp wxcore_print.cpp wxcore_sizer.cpp wxcore_windows.cpp wxcore_wxlprint.cpp wxhtml_html.cpp wxmedia_media.cpp wxnet_net.cpp wxstc_stc.cpp wxxml_xml.cpp wxxrc_xrc.cpp Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: wxnet_net.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxnet_net.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxnet_net.cpp 10 Dec 2007 05:39:08 -0000 1.6 --- wxnet_net.cpp 13 Dec 2007 00:47:51 -0000 1.7 *************** *** 727,743 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketClient_delete[] = { &s_wxluatag_wxSocketClient, NULL }; ! static int LUACALL wxLua_wxSocketClient_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketClient_delete[1] = {{ wxLua_wxSocketClient_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketClient_delete }}; ! static int LUACALL wxLua_wxSocketClient_delete(lua_State *L) ! { ! wxSocketClient * self = (wxSocketClient *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxSocketClient); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketClient_constructor[] = { &s_wxluaarg_Integer, NULL }; --- 727,731 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketClient_delete[] = { &s_wxluatag_wxSocketClient, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketClient_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketClient_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketClient_constructor[] = { &s_wxluaarg_Integer, NULL }; *************** *** 755,759 **** wxSocketClient* returns = new wxSocketClient(flags); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxSocketClient, returns); --- 743,747 ---- wxSocketClient* returns = new wxSocketClient(flags); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxSocketClient, returns); *************** *** 853,869 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketServer_delete[] = { &s_wxluatag_wxSocketServer, NULL }; ! static int LUACALL wxLua_wxSocketServer_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketServer_delete[1] = {{ wxLua_wxSocketServer_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketServer_delete }}; ! static int LUACALL wxLua_wxSocketServer_delete(lua_State *L) ! { ! wxSocketServer * self = (wxSocketServer *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxSocketServer); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketServer_constructor[] = { &s_wxluatag_wxSockAddress, &s_wxluaarg_Integer, NULL }; --- 841,845 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketServer_delete[] = { &s_wxluatag_wxSocketServer, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketServer_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketServer_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketServer_constructor[] = { &s_wxluatag_wxSockAddress, &s_wxluaarg_Integer, NULL }; *************** *** 883,887 **** wxSocketServer* returns = new wxSocketServer(*address, flags); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxSocketServer, returns); --- 859,863 ---- wxSocketServer* returns = new wxSocketServer(*address, flags); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxSocketServer, returns); *************** *** 966,982 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketEvent_delete[] = { &s_wxluatag_wxSocketEvent, NULL }; ! static int LUACALL wxLua_wxSocketEvent_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketEvent_delete[1] = {{ wxLua_wxSocketEvent_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketEvent_delete }}; ! static int LUACALL wxLua_wxSocketEvent_delete(lua_State *L) ! { ! wxSocketEvent * self = (wxSocketEvent *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxSocketEvent); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketEvent_constructor[] = { &s_wxluaarg_Number, NULL }; --- 942,946 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketEvent_delete[] = { &s_wxluatag_wxSocketEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketEvent_constructor[] = { &s_wxluaarg_Number, NULL }; *************** *** 994,998 **** wxSocketEvent* returns = new wxSocketEvent(id); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxSocketEvent, returns); --- 958,962 ---- wxSocketEvent* returns = new wxSocketEvent(id); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxSocketEvent, returns); *************** *** 1216,1232 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxIPaddress_delete[] = { &s_wxluatag_wxIPaddress, NULL }; ! static int LUACALL wxLua_wxIPaddress_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPaddress_delete[1] = {{ wxLua_wxIPaddress_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxIPaddress_delete }}; ! static int LUACALL wxLua_wxIPaddress_delete(lua_State *L) ! { ! wxIPaddress * self = (wxIPaddress *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxIPaddress); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } --- 1180,1184 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxIPaddress_delete[] = { &s_wxluatag_wxIPaddress, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPaddress_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxIPaddress_delete }}; *************** *** 1322,1338 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxIPV4address_delete[] = { &s_wxluatag_wxIPV4address, NULL }; ! static int LUACALL wxLua_wxIPV4address_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPV4address_delete[1] = {{ wxLua_wxIPV4address_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxIPV4address_delete }}; ! static int LUACALL wxLua_wxIPV4address_delete(lua_State *L) ! { ! wxIPV4address * self = (wxIPV4address *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxIPV4address); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxIPV4address_constructor1[] = { &s_wxluatag_wxIPV4address, NULL }; --- 1274,1278 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxIPV4address_delete[] = { &s_wxluatag_wxIPV4address, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPV4address_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxIPV4address_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxIPV4address_constructor1[] = { &s_wxluatag_wxIPV4address, NULL }; *************** *** 1348,1352 **** wxIPV4address* returns = new wxIPV4address(*other); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxIPV4address, returns); --- 1288,1292 ---- wxIPV4address* returns = new wxIPV4address(*other); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxIPV4address, returns); *************** *** 1364,1368 **** wxIPV4address* returns = new wxIPV4address(); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxIPV4address, returns); --- 1304,1308 ---- wxIPV4address* returns = new wxIPV4address(); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxIPV4address, returns); *************** *** 1537,1553 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxProtocol_delete[] = { &s_wxluatag_wxProtocol, NULL }; ! static int LUACALL wxLua_wxProtocol_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxProtocol_delete[1] = {{ wxLua_wxProtocol_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxProtocol_delete }}; ! static int LUACALL wxLua_wxProtocol_delete(lua_State *L) ! { ! wxProtocol * self = (wxProtocol *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxProtocol); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } --- 1477,1481 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxProtocol_delete[] = { &s_wxluatag_wxProtocol, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxProtocol_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxProtocol_delete }}; *************** *** 1638,1654 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxHTTP_delete[] = { &s_wxluatag_wxHTTP, NULL }; ! static int LUACALL wxLua_wxHTTP_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxHTTP_delete[1] = {{ wxLua_wxHTTP_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxHTTP_delete }}; ! static int LUACALL wxLua_wxHTTP_delete(lua_State *L) ! { ! wxHTTP * self = (wxHTTP *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHTTP); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static int LUACALL wxLua_wxHTTP_constructor(lua_State *L); --- 1566,1570 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxHTTP_delete[] = { &s_wxluatag_wxHTTP, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxHTTP_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxHTTP_delete }}; static int LUACALL wxLua_wxHTTP_constructor(lua_State *L); *************** *** 1661,1665 **** wxHTTP* returns = new wxHTTP(); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxHTTP, returns); --- 1577,1581 ---- wxHTTP* returns = new wxHTTP(); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxHTTP, returns); *************** *** 2034,2050 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxFTP_delete[] = { &s_wxluatag_wxFTP, NULL }; ! static int LUACALL wxLua_wxFTP_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxFTP_delete[1] = {{ wxLua_wxFTP_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxFTP_delete }}; ! static int LUACALL wxLua_wxFTP_delete(lua_State *L) ! { ! wxFTP * self = (wxFTP *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFTP); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static int LUACALL wxLua_wxFTP_constructor(lua_State *L); --- 1950,1954 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxFTP_delete[] = { &s_wxluatag_wxFTP, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxFTP_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxFTP_delete }}; static int LUACALL wxLua_wxFTP_constructor(lua_State *L); *************** *** 2057,2061 **** wxFTP* returns = new wxFTP(); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxFTP, returns); --- 1961,1965 ---- wxFTP* returns = new wxFTP(); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxFTP, returns); *************** *** 2503,2519 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxURI_delete[] = { &s_wxluatag_wxURI, NULL }; ! static int LUACALL wxLua_wxURI_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURI_delete[1] = {{ wxLua_wxURI_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURI_delete }}; ! static int LUACALL wxLua_wxURI_delete(lua_State *L) ! { ! wxURI * self = (wxURI *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxURI); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxURI_op_eq[] = { &s_wxluatag_wxURI, &s_wxluatag_wxURI, NULL }; --- 2407,2411 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxURI_delete[] = { &s_wxluatag_wxURI, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURI_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURI_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxURI_op_eq[] = { &s_wxluatag_wxURI, &s_wxluatag_wxURI, NULL }; *************** *** 2566,2570 **** wxURI* returns = new wxURI(*uri); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURI, returns); --- 2458,2462 ---- wxURI* returns = new wxURI(*uri); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURI, returns); *************** *** 2585,2589 **** wxURI* returns = new wxURI(uri); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURI, returns); --- 2477,2481 ---- wxURI* returns = new wxURI(uri); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURI, returns); *************** *** 2601,2605 **** wxURI* returns = new wxURI(); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURI, returns); --- 2493,2497 ---- wxURI* returns = new wxURI(); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURI, returns); *************** *** 2786,2802 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxURL_delete[] = { &s_wxluatag_wxURL, NULL }; ! static int LUACALL wxLua_wxURL_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURL_delete[1] = {{ wxLua_wxURL_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURL_delete }}; ! static int LUACALL wxLua_wxURL_delete(lua_State *L) ! { ! wxURL * self = (wxURL *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxURL); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } --- 2678,2682 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxURL_delete[] = { &s_wxluatag_wxURL, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURL_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURL_delete }}; *************** *** 2814,2818 **** wxURL* returns = new wxURL(*url); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURL, returns); --- 2694,2698 ---- wxURL* returns = new wxURL(*url); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURL, returns); *************** *** 2835,2839 **** wxURL* returns = new wxURL(sUrl); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURL, returns); --- 2715,2719 ---- wxURL* returns = new wxURL(sUrl); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxURL, returns); Index: wxstc_stc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxstc_stc.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxstc_stc.cpp 10 Dec 2007 05:39:08 -0000 1.7 --- wxstc_stc.cpp 13 Dec 2007 00:47:51 -0000 1.8 *************** *** 1551,1555 **** wxColour* returns = new wxColour(self->GetCaretForeground()); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); --- 1551,1555 ---- wxColour* returns = new wxColour(self->GetCaretForeground()); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); *************** *** 1573,1577 **** wxColour* returns = new wxColour(self->GetCaretLineBack()); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); --- 1573,1577 ---- wxColour* returns = new wxColour(self->GetCaretLineBack()); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); *************** *** 1595,1599 **** wxColour* returns = new wxColour(self->GetCaretLineBackground()); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); --- 1595,1599 ---- wxColour* returns = new wxColour(self->GetCaretLineBackground()); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); *************** *** 1834,1838 **** wxColour* returns = new wxColour(self->GetEdgeColour()); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); --- 1834,1838 ---- wxColour* returns = new wxColour(self->GetEdgeColour()); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); *************** *** 3338,3342 **** wxColour* returns = new wxColour(self->IndicatorGetForeground(indic)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); --- 3338,3342 ---- wxColour* returns = new wxColour(self->IndicatorGetForeground(indic)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); *************** *** 4304,4308 **** wxPoint* returns = new wxPoint(self->PointFromPosition(pos)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxPoint((wxPoint*)returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxPoint, returns); --- 4304,4308 ---- wxPoint* returns = new wxPoint(self->PointFromPosition(pos)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxPoint((wxPoint*)returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxPoint, returns); *************** *** 8664,8680 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxStyledTextEvent_delete[] = { &s_wxluatag_wxStyledTextEvent, NULL }; ! static int LUACALL wxLua_wxStyledTextEvent_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxStyledTextEvent_delete[1] = {{ wxLua_wxStyledTextEvent_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxStyledTextEvent_delete }}; ! static int LUACALL wxLua_wxStyledTextEvent_delete(lua_State *L) ! { ! wxStyledTextEvent * self = (wxStyledTextEvent *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxStyledTextEvent); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxStyledTextEvent_constructor[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; --- 8664,8668 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxStyledTextEvent_delete[] = { &s_wxluatag_wxStyledTextEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxStyledTextEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxStyledTextEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxStyledTextEvent_constructor[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; *************** *** 8694,8698 **** wxStyledTextEvent* returns = new wxStyledTextEvent(commandType, id); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxStyledTextEvent, returns); --- 8682,8686 ---- wxStyledTextEvent* returns = new wxStyledTextEvent(commandType, id); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxStyledTextEvent, returns); Index: wxxrc_xrc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxxrc_xrc.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxxrc_xrc.cpp 10 Dec 2007 05:39:09 -0000 1.6 --- wxxrc_xrc.cpp 13 Dec 2007 00:47:51 -0000 1.7 *************** *** 204,208 **** wxBitmap* returns = new wxBitmap(self->LoadBitmap(name)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxBitmap*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); --- 204,208 ---- wxBitmap* returns = new wxBitmap(self->LoadBitmap(name)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxBitmap*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); *************** *** 298,302 **** wxIcon* returns = new wxIcon(self->LoadIcon(name)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxIcon*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxIcon, returns); --- 298,302 ---- wxIcon* returns = new wxIcon(self->LoadIcon(name)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxIcon*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxIcon, returns); *************** *** 440,447 **** // wxXmlResource res wxXmlResource * res = (wxXmlResource *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlResource); ! if (wxluaO_istrackedobject(L, res)) wxluaO_removetrackedobject(L, res, wxLUA_UNDELETE_OBJECT); // call Set wxXmlResource* returns = (wxXmlResource*)wxXmlResource::Set(res); ! if (!wxluaO_istrackedobject(L, returns)) wxluaO_addtrackedobject(L, returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxXmlResource, returns); --- 440,447 ---- // wxXmlResource res wxXmlResource * res = (wxXmlResource *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlResource); ! if (wxluaO_isgcobject(L, res)) wxluaO_deletegcobject(L, res, wxLUA_UNDELETE_OBJECT); // call Set wxXmlResource* returns = (wxXmlResource*)wxXmlResource::Set(res); ! if (!wxluaO_isgcobject(L, returns)) wxluaO_addgcobject(L, returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxXmlResource, returns); *************** *** 501,517 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxXmlResource_delete[] = { &s_wxluatag_wxXmlResource, NULL }; ! static int LUACALL wxLua_wxXmlResource_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_delete[1] = {{ wxLua_wxXmlResource_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxXmlResource_delete }}; ! static int LUACALL wxLua_wxXmlResource_delete(lua_State *L) ! { ! wxXmlResource * self = (wxXmlResource *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlResource); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxXmlResource_constructor1[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_String, NULL }; --- 501,505 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxXmlResource_delete[] = { &s_wxluatag_wxXmlResource, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxXmlResource_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxXmlResource_constructor1[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_String, NULL }; *************** *** 533,537 **** wxXmlResource* returns = new wxXmlResource(filemask, flags, domain); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxXmlResource, returns); --- 521,525 ---- wxXmlResource* returns = new wxXmlResource(filemask, flags, domain); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxXmlResource, returns); *************** *** 556,560 **** wxXmlResource* returns = new wxXmlResource(flags, domain); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxXmlResource, returns); --- 544,548 ---- wxXmlResource* returns = new wxXmlResource(flags, domain); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxXmlResource, returns); Index: wxcore_core.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_core.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxcore_core.cpp 10 Dec 2007 05:39:07 -0000 1.6 --- wxcore_core.cpp 13 Dec 2007 00:47:49 -0000 1.7 *************** *** 36,52 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLogGui_delete[] = { &s_wxluatag_wxLogGui, NULL }; ! static int LUACALL wxLua_wxLogGui_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogGui_delete[1] = {{ wxLua_wxLogGui_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogGui_delete }}; ! static int LUACALL wxLua_wxLogGui_delete(lua_State *L) ! { ! wxLogGui * self = (wxLogGui *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLogGui); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static int LUACALL wxLua_wxLogGui_constructor(lua_State *L); --- 36,40 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLogGui_delete[] = { &s_wxluatag_wxLogGui, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogGui_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogGui_delete }}; static int LUACALL wxLua_wxLogGui_constructor(lua_State *L); *************** *** 59,63 **** wxLogGui* returns = new wxLogGui(); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxLogGui((wxLogGui*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLogGui, returns); --- 47,51 ---- wxLogGui* returns = new wxLogGui(); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxLogGui((wxLogGui*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLogGui, returns); *************** *** 91,107 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLogTextCtrl_delete[] = { &s_wxluatag_wxLogTextCtrl, NULL }; ! static int LUACALL wxLua_wxLogTextCtrl_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogTextCtrl_delete[1] = {{ wxLua_wxLogTextCtrl_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogTextCtrl_delete }}; ! static int LUACALL wxLua_wxLogTextCtrl_delete(lua_State *L) ! { ! wxLogTextCtrl * self = (wxLogTextCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLogTextCtrl); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } --- 79,83 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLogTextCtrl_delete[] = { &s_wxluatag_wxLogTextCtrl, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogTextCtrl_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogTextCtrl_delete }}; *************** *** 119,123 **** wxLogTextCtrl* returns = new wxLogTextCtrl(textCtrl); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxLogTextCtrl((wxLogTextCtrl*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLogTextCtrl, returns); --- 95,99 ---- wxLogTextCtrl* returns = new wxLogTextCtrl(textCtrl); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxLogTextCtrl((wxLogTextCtrl*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLogTextCtrl, returns); *************** *** 192,208 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLogWindow_delete[] = { &s_wxluatag_wxLogWindow, NULL }; ! static int LUACALL wxLua_wxLogWindow_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogWindow_delete[1] = {{ wxLua_wxLogWindow_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogWindow_delete }}; ! static int LUACALL wxLua_wxLogWindow_delete(lua_State *L) ! { ! wxLogWindow * self = (wxLogWindow *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLogWindow); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxLogWindow_constructor[] = { &s_wxluatag_wxWindow, &s_wxluaarg_String, &s_wxluaarg_Boolean, &s_wxluaarg_Boolean, NULL }; --- 168,172 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLogWindow_delete[] = { &s_wxluatag_wxLogWindow, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogWindow_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogWindow_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxLogWindow_constructor[] = { &s_wxluatag_wxWindow, &s_wxluaarg_String, &s_wxluaarg_Boolean, &s_wxluaarg_Boolean, NULL }; *************** *** 226,230 **** wxLogWindow* returns = new wxLogWindow(pParent, szTitle, bShow, bPassToOld); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxLogWindow((wxLogWindow*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLogWindow, returns); --- 190,194 ---- wxLogWindow* returns = new wxLogWindow(pParent, szTitle, bShow, bPassToOld); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxLogWindow((wxLogWindow*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLogWindow, returns); *************** *** 275,279 **** wxColour* returns = new wxColour(wxSystemSettings::GetColour(index)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); --- 239,243 ---- wxColour* returns = new wxColour(wxSystemSettings::GetColour(index)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxColour*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxColour, returns); *************** *** 297,301 **** wxFont* returns = new wxFont(wxSystemSettings::GetFont(index)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (wxFont*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxFont, returns); --- 261,265 ---- wxFont* returns = new wxFont(wxSystemSettings::GetFont(index)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (wxFont*)returns); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxFont, returns); *************** *** 647,663 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxTextValidator_delete[] = { &s_wxluatag_wxTextValidator, NULL }; ! static int LUACALL wxLua_wxTextValidator_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextValidator_delete[1] = {{ wxLua_wxTextValidator_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxTextValidator_delete }}; ! static int LUACALL wxLua_wxTextValidator_delete(lua_State *L) ! { ! wxTextValidator * self = (wxTextValidator *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxTextValidator); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxTextValidator_constructor[] = { &s_wxluaarg_Number, &s_wxluatag_wxLuaObject, NULL }; --- 611,615 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxTextValidator_delete[] = { &s_wxluatag_wxTextValidator, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextValidator_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxTextValidator_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxTextValidator_constructor[] = { &s_wxluaarg_Number, &s_wxluatag_wxLuaObject, NULL }; *************** *** 730,746 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxGenericValidator_delete[] = { &s_wxluatag_wxGenericValidator, NULL }; ! static int LUACALL wxLua_wxGenericValidator_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxGenericValidator_delete[1] = {{ wxLua_wxGenericValidator_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxGenericValidator_delete }}; ! static int LUACALL wxLua_wxGenericValidator_delete(lua_State *L) ! { ! wxGenericValidator * self = (wxGenericValidator *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxGenericValidator); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxGenericValidatorArrayInt_constructor[] = { &s_wxluatag_wxLuaObject, NULL }; --- 682,686 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxGenericValidator_delete[] = { &s_wxluatag_wxGenericValidator, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxGenericValidator_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxGenericValidator_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxGenericValidatorArrayInt_constructor[] = { &s_wxluatag_wxLuaObject, NULL }; *************** *** 758,762 **** wxGenericValidator *returns = new wxGenericValidator(valPtr->GetArrayPtr()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); --- 698,702 ---- wxGenericValidator *returns = new wxGenericValidator(valPtr->GetArrayPtr()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); *************** *** 780,784 **** wxGenericValidator *returns = new wxGenericValidator(boolPtr->GetBoolPtr()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); --- 720,724 ---- wxGenericValidator *returns = new wxGenericValidator(boolPtr->GetBoolPtr()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); *************** *** 802,806 **** wxGenericValidator *returns = new wxGenericValidator(valPtr->GetIntPtr()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); --- 742,746 ---- wxGenericValidator *returns = new wxGenericValidator(valPtr->GetIntPtr()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); *************** *** 824,828 **** wxGenericValidator *returns = new wxGenericValidator(valPtr->GetStringPtr()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); --- 764,768 ---- wxGenericValidator *returns = new wxGenericValidator(valPtr->GetStringPtr()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); Index: wxcore_clipdrag.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_clipdrag.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxcore_clipdrag.cpp 10 Dec 2007 05:39:07 -0000 1.6 --- wxcore_clipdrag.cpp 13 Dec 2007 00:47:49 -0000 1.7 *************** *** 44,48 **** // wxDataObject data wxDataObject * data = (wxDataObject *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObject); ! if (wxluaO_istrackedobject(L, data)) wxluaO_removetrackedobject(L, data, wxLUA_UNDELETE_OBJECT); // get this wxClipboard * self = (wxClipboard *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboard); --- 44,48 ---- // wxDataObject data wxDataObject * data = (wxDataObject *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObject); ! if (wxluaO_isgcobject(L, data)) wxluaO_deletegcobject(L, data, wxLUA_UNDELETE_OBJECT); // get this wxClipboard * self = (wxClipboard *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboard); *************** *** 203,207 **** // wxDataObject data wxDataObject * data = (wxDataObject *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObject); ! if (wxluaO_istrackedobject(L, data)) wxluaO_removetrackedobject(L, data, wxLUA_UNDELETE_OBJECT); // get this wxClipboard * self = (wxClipboard *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboard); --- 203,207 ---- // wxDataObject data wxDataObject * data = (wxDataObject *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObject); ! if (wxluaO_isgcobject(L, data)) wxluaO_deletegcobject(L, data, wxLUA_UNDELETE_OBJECT); // get this wxClipboard * self = (wxClipboard *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboard); *************** *** 286,302 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxClipboardTextEvent_delete[] = { &s_wxluatag_wxClipboardTextEvent, NULL }; ! static int LUACALL wxLua_wxClipboardTextEvent_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxClipboardTextEvent_delete[1] = {{ wxLua_wxClipboardTextEvent_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxClipboardTextEvent_delete }}; ! static int LUACALL wxLua_wxClipboardTextEvent_delete(lua_State *L) ! { ! wxClipboardTextEvent * self = (wxClipboardTextEvent *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxClipboardTextEvent); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxClipboardTextEvent_constructor[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; --- 286,290 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxClipboardTextEvent_delete[] = { &s_wxluatag_wxClipboardTextEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxClipboardTextEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxClipboardTextEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxClipboardTextEvent_constructor[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; *************** *** 316,320 **** wxClipboardTextEvent* returns = new wxClipboardTextEvent(type, winid); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxClipboardTextEvent, returns); --- 304,308 ---- wxClipboardTextEvent* returns = new wxClipboardTextEvent(type, winid); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxClipboardTextEvent, returns); *************** *** 412,428 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxDataFormat_delete[] = { &s_wxluatag_wxDataFormat, NULL }; ! static int LUACALL wxLua_wxDataFormat_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataFormat_delete[1] = {{ wxLua_wxDataFormat_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataFormat_delete }}; ! static int LUACALL wxLua_wxDataFormat_delete(lua_State *L) ! { ! wxDataFormat * self = (wxDataFormat *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDataFormat); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxDataFormat_op_eq[] = { &s_wxluatag_wxDataFormat, &s_wxluatag_wxDataFormat, NULL }; --- 400,404 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxDataFormat_delete[] = { &s_wxluatag_wxDataFormat, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataFormat_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataFormat_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxDataFormat_op_eq[] = { &s_wxluatag_wxDataFormat, &s_wxluatag_wxDataFormat, NULL }; *************** *** 456,460 **** wxDataFormat* returns = new wxDataFormat(format); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxDataFormat((wxDataFormat*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxDataFormat, returns); --- 432,436 ---- wxDataFormat* returns = new wxDataFormat(format); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxDataFormat((wxDataFormat*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxDataFormat, returns); *************** *** 477,481 **** wxDataFormat* returns = new wxDataFormat(format); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxDataFormat((wxDataFormat*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxDataFormat, returns); --- 453,457 ---- wxDataFormat* returns = new wxDataFormat(format); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxDataFormat((wxDataFormat*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxDataFormat, returns); *************** *** 664,668 **** wxDataFormat* returns = new wxDataFormat(self->GetPreferredFormat(dir)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxDataFormat((wxDataFormat*)returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxDataFormat, returns); --- 640,644 ---- wxDataFormat* returns = new wxDataFormat(self->GetPreferredFormat(dir)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxDataFormat((wxDataFormat*)returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxDataFormat, returns); *************** *** 835,851 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectSimple_delete[] = { &s_wxluatag_wxDataObjectSimple, NULL }; ! static int LUACALL wxLua_wxDataObjectSimple_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataObjectSimple_delete[1] = {{ wxLua_wxDataObjectSimple_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataObjectSimple_delete }}; ! static int LUACALL wxLua_wxDataObjectSimple_delete(lua_State *L) ! { ! wxDataObjectSimple * self = (wxDataObjectSimple *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDataObjectSimple); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectSimple_constructor[] = { &s_wxluatag_wxDataFormat, NULL }; --- 811,815 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectSimple_delete[] = { &s_wxluatag_wxDataObjectSimple, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataObjectSimple_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataObjectSimple_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectSimple_constructor[] = { &s_wxluatag_wxDataFormat, NULL }; *************** *** 863,867 **** wxDataObjectSimple* returns = new wxDataObjectSimple(*format); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxDataObjectSimple((wxDataObjectSimple*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxDataObjectSimple, returns); --- 827,831 ---- wxDataObjectSimple* returns = new wxDataObjectSimple(*format); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxDataObjectSimple((wxDataObjectSimple*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxDataObjectSimple, returns); *************** *** 911,915 **** // wxDataObjectSimple dataObject wxDataObjectSimple * dataObject = (wxDataObjectSimple *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObjectSimple); ! if (wxluaO_istrackedobject(L, dataObject)) wxluaO_removetrackedobject(L, dataObject, wxLUA_UNDELETE_OBJECT); // get this wxDataObjectComposite * self = (wxDataObjectComposite *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDataObjectComposite); --- 875,879 ---- // wxDataObjectSimple dataObject wxDataObjectSimple * dataObject = (wxDataObjectSimple *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxDataObjectSimple); ! if (wxluaO_isgcobject(L, dataObject)) wxluaO_deletegcobject(L, dataObject, wxLUA_UNDELETE_OBJECT); // get this wxDataObjectComposite * self = (wxDataObjectComposite *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDataObjectComposite); *************** *** 934,938 **** wxDataFormat* returns = new wxDataFormat(self->GetReceivedFormat()); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxDataFormat((wxDataFormat*)returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxDataFormat, returns); --- 898,902 ---- wxDataFormat* returns = new wxDataFormat(self->GetReceivedFormat()); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxDataFormat((wxDataFormat*)returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxDataFormat, returns); *************** *** 944,960 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectComposite_delete[] = { &s_wxluatag_wxDataObjectComposite, NULL }; ! static int LUACALL wxLua_wxDataObjectComposite_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataObjectComposite_delete[1] = {{ wxLua_wxDataObjectComposite_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataObjectComposite_delete }}; ! static int LUACALL wxLua_wxDataObjectComposite_delete(lua_State *L) ! { ! wxDataObjectComposite * self = (wxDataObjectComposite *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDataObjectComposite); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static int LUACALL wxLua_wxDataObjectComposite_constructor(lua_State *L); --- 908,912 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectComposite_delete[] = { &s_wxluatag_wxDataObjectComposite, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataObjectComposite_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataObjectComposite_delete }}; static int LUACALL wxLua_wxDataObjectComposite_constructor(lua_State *L); *************** *** 967,971 **** wxDataObjectComposite* returns = new wxDataObjectComposite(); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxDataObjectComposite((wxDataObjectComposite*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxDataObjectComposite, returns); --- 919,923 ---- wxDataObjectComposite* returns = new wxDataObjectComposite(); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxDataObjectComposite((wxDataObjectComposite*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxDataObjectComposite, returns); *************** *** 1034,1038 **** wxArrayString* returns = new wxArrayString(self->GetFilenames()); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxArrayString((wxArrayString*)returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxArrayString, returns); --- 986,990 ---- wxArrayString* returns = new wxArrayString(self->GetFilenames()); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxArrayString((wxArrayString*)returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxArrayString, returns); *************** *** 1044,1060 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxFileDataObject_delete[] = { &s_wxluatag_wxFileDataObject, NULL }; ! static int LUACALL wxLua_wxFileDataObject_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxFileDataObject_delete[1] = {{ wxLua_wxFileDataObject_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxFileDataObject_delete }}; ! static int LUACALL wxLua_wxFileDataObject_delete(lua_State *L) ! { ! wxFileDataObject * self = (wxFileDataObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileDataObject); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static int LUACALL wxLua_wxFileDataObject_constructor(lua_State *L); --- 996,1000 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxFileDataObject_delete[] = { &s_wxluatag_wxFileDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxFileDataObject_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxFileDataObject_delete }}; static int LUACALL wxLua_wxFileDataObject_constructor(lua_State *L); *************** *** 1067,1071 **** wxFileDataObject* returns = new wxFileDataObject(); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxFileDataObject((wxFileDataObject*)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxFileDataObject, returns); --- 1007,1011 ---- wxFileDataObject* returns = new wxFileDataObject(); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)retu... [truncated message content] |
From: John L. <jr...@us...> - 2007-12-13 00:48:25
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlstate.h Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** wxlbind.h 10 Dec 2007 05:39:09 -0000 1.70 --- wxlbind.h 13 Dec 2007 00:47:51 -0000 1.71 *************** *** 23,26 **** --- 23,29 ---- // ---------------------------------------------------------------------------- + // Generic delete function for binding objects + WXDLLIMPEXP_WXLUA int LUACALL wxLua_wxluabind_delete(lua_State *L); + // memory deallocation function for created wxLuaBindClass defined objects, Lua's __gc metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__gc_wxLuaBindClass(lua_State *L); Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** wxlstate.h 10 Dec 2007 05:39:09 -0000 1.104 --- wxlstate.h 13 Dec 2007 00:47:51 -0000 1.105 *************** *** 101,105 **** extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_wxluastate_key; // The key in the LUA_REGISTRYINDEX table that is table of all ! // objects that we've pushed into Lua. t[lightuserdata] = [weak valued full userdata] extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_weakobjects_key; // The key in the LUA_REGISTRYINDEX table that is table of all --- 101,108 ---- extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_wxluastate_key; // The key in the LUA_REGISTRYINDEX table that is table of all ! // objects that we've pushed into Lua. ! // t[lightuserdata of obj_ptr] = { tag1 = [weak full userdata], tag2... } ! // Note: a single object like a wxWindow may be pushed as multiple tags when ! // they create it wxWindow* = wx.wxWindow... later from wxObject* wxEvent.GetEventObject() extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_weakobjects_key; // The key in the LUA_REGISTRYINDEX table that is table of all *************** *** 108,112 **** // Note that non wxObject classes use wxLUA_DECLARE_ENCAPSULATION so // the key is the object pointer and the value is the wxObject encapsulation. ! extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_delobjects_key; // The key in the LUA_REGISTRYINDEX table that is table of all // wxLuaCallbacks that we've created. --- 111,116 ---- // Note that non wxObject classes use wxLUA_DECLARE_ENCAPSULATION so // the key is the object pointer and the value is the wxObject encapsulation. ! // If not encapsulated both the key and the value are the same ! extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_gcobjects_key; // The key in the LUA_REGISTRYINDEX table that is table of all // wxLuaCallbacks that we've created. *************** *** 246,283 **** // wxluaO_XXX - functions operate on the "Objects" which are userdata wrapping // C++ class objects and are stored in the wxlua_lreg_weakobjects_key table ! // and the wxlua_lreg_delobjects_key in Lua's LUA_REGISTRYINDEX. //---------------------------------------------------------------------------- ! enum wxLuaRemoveTrackedObject_flags { ! wxLUA_UNDELETE_OBJECT = 0, // stop tracking for deletion (someone else owns this) ! wxLUA_DELETE_OBJECT = 0x0001, // delete the object ! wxLUA_CLEAR_TRACKED_OBJECT = 0x0002, // clear tracking the object in Lua reg table ! wxLUA_CLEAR_DERIVED_METHODS = 0x0004, // clear any derived methods in Lua reg table ! wxLUA_DELETE_CLEAR_OBJECT = wxLUA_DELETE_OBJECT|wxLUA_CLEAR_TRACKED_OBJECT|wxLUA_CLEAR_DERIVED_METHODS }; // Track this wxObject and delete it when Lua calls the __gc method for it. ! // The object is stored in the wxlua_lreg_delobjects_key of the LUA_REGISTRYINDEX // as t[lightuserdata(obj_ptr)] = lightuserdata(wxobj). // The second version is used when the non-wxObject class is encapsulated and so // the obj_ptr points to the actual object that the wxObject encapsulates. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addtrackedobject(lua_State* L, wxObject* wxobj); ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addtrackedobject(lua_State* L, const void* obj_ptr, wxObject* wxobj); ! // Remove this tracked wxObject from the wxlua_lreg_delobjects_key table of the // LUA_REGISTRYINDEX. ! // The object can be deleted and other items assicated may be cleared ! // by setting the "flags" from ored values of enum wxLuaRemoveTrackedObject_flags ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_removetrackedobject(lua_State *L, void *obj_ptr, int flags); ! // Check if this object is in the wxlua_lreg_delobjects_key table of the // LUA_REGISTRYINDEX. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_istrackedobject(lua_State *L, void *obj_ptr); ! // Get a wxArrayString of the info in the wxlua_lreg_delobjects_key LUA_REGISTRYINDEX table. ! WXDLLIMPEXP_WXLUA wxArrayString LUACALL wxluaO_gettrackedobjectstrings(lua_State *L); ! // If an object was pushed into Lua using wxluaT_pushusertag with track=true ! // then this function will remove the metable of the object being tracked in the ! // wxlua_lreg_weakobjects_key Lua LUA_REGISTRYINDEX table. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_cleartrackedmetatable(lua_State* L, const void* u); //---------------------------------------------------------------------------- --- 250,300 ---- // wxluaO_XXX - functions operate on the "Objects" which are userdata wrapping // C++ class objects and are stored in the wxlua_lreg_weakobjects_key table ! // and the wxlua_lreg_gcobjects_key in Lua's LUA_REGISTRYINDEX. //---------------------------------------------------------------------------- ! enum wxLuaGCObject_flags { ! wxLUA_UNDELETE_OBJECT = 0x0001, // Remove from the wxlua_lreg_gcobjects_key table ! // so we won't delete it (someone else should), ! // but keep the userdata in the wxlua_lreg_weakobjects_key ! // table, it's still in Lua and is usable. ! wxLUA_DELETE_OBJECT = 0x0002, // Literally delete the object and remove it from the ! // wxlua_lreg_gcobjects_key table. See remove... ! wxLUA_REMOVE_OBJECT = 0x0004, // Clear tracking the object in the wxlua_lreg_weakobjects_key ! // and wxlua_lreg_derivedmethods_key since ! // it's gone from Lua. ! ! wxLUA_DELETE_REMOVE_OBJECT = wxLUA_DELETE_OBJECT|wxLUA_REMOVE_OBJECT }; // Track this wxObject and delete it when Lua calls the __gc method for it. ! // The object is stored in the wxlua_lreg_gcobjects_key of the LUA_REGISTRYINDEX // as t[lightuserdata(obj_ptr)] = lightuserdata(wxobj). // The second version is used when the non-wxObject class is encapsulated and so // the obj_ptr points to the actual object that the wxObject encapsulates. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, wxObject* wxobj); ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, const void* obj_ptr, wxObject* wxobj); ! // Remove this tracked wxObject from the wxlua_lreg_gcobjects_key table of the // LUA_REGISTRYINDEX. ! // The object can be deleted and other items associated with it may be removed ! // by setting the "flags" from ored values of enum wxLuaGCObject_flags ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_deletegcobject(lua_State *L, void *obj_ptr, int flags); ! // Check if this object is in the wxlua_lreg_gcobjects_key table of the // LUA_REGISTRYINDEX. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_isgcobject(lua_State *L, void *obj_ptr); ! // Get a wxArrayString of the info in the wxlua_lreg_gcobjects_key LUA_REGISTRYINDEX table. ! WXDLLIMPEXP_WXLUA wxArrayString LUACALL wxluaO_getgcobjectstrings(lua_State *L); ! // Track the obj_ptr and it's Lua userdata in the wxlua_lreg_weakobjects_key ! // table of the LUA_REGISTRYINDEX so we can push it again if needed. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_trackweakobject(lua_State *L, int udata_stack_idx, void *obj_ptr, int tag); ! // Remove the obj_ptr key from the wxlua_lreg_weakobjects_key table of ! // the LUA_REGISTRYINDEX. It also removes the metatable for ALL Lua userdata ! // that are associated with this obj_ptr since this function is called when the ! // object is deleted. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_untrackweakobject(lua_State *L, void *obj_ptr); ! // Check if this object with the given tag is in the wxlua_lreg_weakobjects_key ! // table of the LUA_REGISTRYINDEX. If push_on_stack then push on top of the stack. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_istrackedweakobject(lua_State *L, void *obj_ptr, int tag, bool push_on_stack); //---------------------------------------------------------------------------- *************** *** 773,788 **** // Track this object and delete it when Lua calls the gc method for it ! void AddTrackedObject(wxObject *pObject); // Track this object, but hash it on the obj_ptr which may differ from the // pObject and delete it when Lua calls the gc method for it. // This is used for encapsulated classes that are wrapped in a wxObject. ! void AddTrackedObject(const void* obj_ptr, wxObject *pObject); // Remove the object from the tracked memory and optionally delete it. ! // flags are ored values of enum wxLuaRemoveTrackedObject_flags ! bool RemoveTrackedObject(void *pObject, int flags); // Is this object currently tracked? ! bool IsTrackedObject(void *pObject) const; // Get an array of strings "wxObject_classname count#" ! wxArrayString GetTrackedObjectStrings(); // Add a wxWindow to track and delete when we're closed, only track --- 790,805 ---- // Track this object and delete it when Lua calls the gc method for it ! void AddGCObject(wxObject *pObject); // Track this object, but hash it on the obj_ptr which may differ from the // pObject and delete it when Lua calls the gc method for it. // This is used for encapsulated classes that are wrapped in a wxObject. ! void AddGCObject(const void* obj_ptr, wxObject *pObject); // Remove the object from the tracked memory and optionally delete it. ! // flags are ored values of enum wxLuaGCObject_flags ! bool DeleteGCObject(void *pObject, int flags); // Is this object currently tracked? ! bool IsGCObject(void *pObject) const; // Get an array of strings "wxObject_classname count#" ! wxArrayString GetGCObjectStrings(); // Add a wxWindow to track and delete when we're closed, only track |
From: John L. <jr...@us...> - 2007-12-13 00:48:22
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/bindings/wxwidgets Modified Files: wxbase_override.hpp wxcore_override.hpp wxxml_override.hpp Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: wxbase_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_override.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wxbase_override.hpp 10 Dec 2007 05:39:05 -0000 1.9 --- wxbase_override.hpp 13 Dec 2007 00:47:48 -0000 1.10 *************** *** 166,170 **** // we may not be tracked, but delete us anyway ! if (!wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) delete self; --- 166,170 ---- // we may not be tracked, but delete us anyway ! if (!wxluaO_deletegcobject(L, self, wxLUA_DELETE_REMOVE_OBJECT)) delete self; *************** *** 355,359 **** wxString* returns = new wxString(str); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxString(returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxString, returns); --- 355,359 ---- wxString* returns = new wxString(str); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxString(returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxString, returns); *************** *** 401,405 **** if (pObject->IsKindOf(pClass->classInfo)) { ! wxluaT_settag(L, *pClass->class_tag); iResult = 1; } --- 401,409 ---- if (pObject->IsKindOf(pClass->classInfo)) { ! if (*pClass->class_tag != wxluaT_gettag(L, 1)) ! wxluaT_pushuserdatatype(L, *pClass->class_tag, pObject); ! else ! lua_pushvalue(L, 1); // return same userdata ! iResult = 1; } *************** *** 572,578 **** bool returns = self->GetTimes(dtAccess, dtMod, dtCreate); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)dtAccess, new wxLua_wxObject_wxDateTime(dtAccess)); ! wxluaO_addtrackedobject(L, (void*)dtMod, new wxLua_wxObject_wxDateTime(dtMod)); ! wxluaO_addtrackedobject(L, (void*)dtCreate, new wxLua_wxObject_wxDateTime(dtCreate)); // push the constructed class pointers wxluaT_pushuserdatatype(L, s_wxluatag_wxDateTime, dtAccess); --- 576,582 ---- bool returns = self->GetTimes(dtAccess, dtMod, dtCreate); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)dtAccess, new wxLua_wxObject_wxDateTime(dtAccess)); ! wxluaO_addgcobject(L, (void*)dtMod, new wxLua_wxObject_wxDateTime(dtMod)); ! wxluaO_addgcobject(L, (void*)dtCreate, new wxLua_wxObject_wxDateTime(dtCreate)); // push the constructed class pointers wxluaT_pushuserdatatype(L, s_wxluatag_wxDateTime, dtAccess); Index: wxcore_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wxcore_override.hpp 10 Dec 2007 05:39:05 -0000 1.9 --- wxcore_override.hpp 13 Dec 2007 00:47:48 -0000 1.10 *************** *** 127,131 **** if (returns != NULL) { ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxAcceleratorTable, returns); --- 127,131 ---- if (returns != NULL) { ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxAcceleratorTable, returns); *************** *** 525,529 **** wxTreeItemId *returns = new wxTreeItemId(self->GetFirstChild(*item, cookie)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxTreeItemId(returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxTreeItemId, returns); --- 525,529 ---- wxTreeItemId *returns = new wxTreeItemId(self->GetFirstChild(*item, cookie)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxTreeItemId(returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxTreeItemId, returns); *************** *** 557,561 **** wxTreeItemId *returns = new wxTreeItemId(self->GetNextChild(*item, cookie)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxTreeItemId(returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxTreeItemId, returns); --- 557,561 ---- wxTreeItemId *returns = new wxTreeItemId(self->GetNextChild(*item, cookie)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxTreeItemId(returns)); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxTreeItemId, returns); *************** *** 587,591 **** { wxTreeItemId* treeId = new wxTreeItemId(selection[idx]); ! wxluaO_addtrackedobject(L, (void*)treeId, new wxLua_wxObject_wxTreeItemId(treeId)); wxluaT_pushuserdatatype(L, s_wxluatag_wxTreeItemId, treeId); lua_rawseti(L, -2, idx + 1); --- 587,591 ---- { wxTreeItemId* treeId = new wxTreeItemId(selection[idx]); ! wxluaO_addgcobject(L, (void*)treeId, new wxLua_wxObject_wxTreeItemId(treeId)); wxluaT_pushuserdatatype(L, s_wxluatag_wxTreeItemId, treeId); lua_rawseti(L, -2, idx + 1); *************** *** 610,614 **** wxTreeItemId *returns = new wxTreeItemId(self->HitTest(*point, flags)); // add the new object to the tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxTreeItemId(returns)); // push the result datatype --- 610,614 ---- wxTreeItemId *returns = new wxTreeItemId(self->HitTest(*point, flags)); // add the new object to the tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxTreeItemId(returns)); // push the result datatype *************** *** 660,664 **** wxGenericValidator *returns = new wxGenericValidator(boolPtr->GetBoolPtr()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); --- 660,664 ---- wxGenericValidator *returns = new wxGenericValidator(boolPtr->GetBoolPtr()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); *************** *** 679,683 **** wxGenericValidator *returns = new wxGenericValidator(valPtr->GetStringPtr()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); --- 679,683 ---- wxGenericValidator *returns = new wxGenericValidator(valPtr->GetStringPtr()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); *************** *** 698,702 **** wxGenericValidator *returns = new wxGenericValidator(valPtr->GetIntPtr()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); --- 698,702 ---- wxGenericValidator *returns = new wxGenericValidator(valPtr->GetIntPtr()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); *************** *** 717,721 **** wxGenericValidator *returns = new wxGenericValidator(valPtr->GetArrayPtr()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); --- 717,721 ---- wxGenericValidator *returns = new wxGenericValidator(valPtr->GetArrayPtr()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxGenericValidator, returns); *************** *** 880,884 **** wxBusyCursor *returns = new wxBusyCursor(cursor); // add to tracked memory list ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxBusyCursor((wxBusyCursor *)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxBusyCursor, returns); --- 880,884 ---- wxBusyCursor *returns = new wxBusyCursor(cursor); // add to tracked memory list ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxBusyCursor((wxBusyCursor *)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxBusyCursor, returns); *************** *** 1475,1479 **** wxBitmap *returns = new wxBitmap(data, type, width, height, depth); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); --- 1475,1479 ---- wxBitmap *returns = new wxBitmap(data, type, width, height, depth); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); *************** *** 1499,1503 **** delete [] sizeArray; // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); --- 1499,1503 ---- delete [] sizeArray; // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); *************** *** 1693,1697 **** wxImage *returns = new wxImage(width, height, data, static_data); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxImage, returns); --- 1693,1697 ---- wxImage *returns = new wxImage(width, height, data, static_data); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxImage, returns); *************** *** 1712,1716 **** wxImage *returns = new wxImage(bitmap->ConvertToImage()); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxImage, returns); --- 1712,1716 ---- wxImage *returns = new wxImage(bitmap->ConvertToImage()); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxImage, returns); *************** *** 1940,1944 **** wxLuaArtProvider *returns = new wxLuaArtProvider(wxlState); // add to tracked memory list ! wxluaO_addtrackedobject(L, (wxLuaArtProvider *)returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaArtProvider, returns); --- 1940,1944 ---- wxLuaArtProvider *returns = new wxLuaArtProvider(wxlState); // add to tracked memory list ! wxluaO_addgcobject(L, (wxLuaArtProvider *)returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaArtProvider, returns); *************** *** 2310,2314 **** *returns = *self; // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxPrintData, returns); --- 2310,2314 ---- *returns = *self; // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxPrintData, returns); *************** *** 2327,2331 **** *returns = *self; // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxPageSetupDialogData, returns); --- 2327,2331 ---- *returns = *self; // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxPageSetupDialogData, returns); *************** *** 2354,2359 **** // we must disconnect them from our tracking list if (printoutForPrinting != NULL) ! wxluaO_removetrackedobject(L, printoutForPrinting, wxLUA_UNDELETE_OBJECT); ! wxluaO_removetrackedobject(L, printout, wxLUA_UNDELETE_OBJECT); // call constructor --- 2354,2359 ---- // we must disconnect them from our tracking list if (printoutForPrinting != NULL) ! wxluaO_deletegcobject(L, printoutForPrinting, wxLUA_UNDELETE_OBJECT); ! wxluaO_deletegcobject(L, printout, wxLUA_UNDELETE_OBJECT); // call constructor *************** *** 2728,2732 **** wxLuaPrintout *returns = new wxLuaPrintout(wxlState, title, pObject); // add to tracked memory list ! wxluaO_addtrackedobject(L, (wxLuaPrintout *)returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaPrintout, returns); --- 2728,2732 ---- wxLuaPrintout *returns = new wxLuaPrintout(wxlState, title, pObject); // add to tracked memory list ! wxluaO_addgcobject(L, (wxLuaPrintout *)returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaPrintout, returns); Index: wxxml_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxxml_override.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxxml_override.hpp 10 Dec 2007 05:39:05 -0000 1.5 --- wxxml_override.hpp 13 Dec 2007 00:47:48 -0000 1.6 *************** *** 32,36 **** // add to tracked memory list if (parent == NULL) ! wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxXmlNode((wxXmlNode *)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxXmlNode, returns); --- 32,36 ---- // add to tracked memory list if (parent == NULL) ! wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxXmlNode((wxXmlNode *)returns)); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxXmlNode, returns); *************** *** 51,56 **** bool returns = (self->RemoveChild(child)); ! if (returns && !wxluaO_istrackedobject(L, child)) ! wxluaO_addtrackedobject(L, (void*)child, new wxLua_wxObject_wxXmlNode(child)); // push the result flag --- 51,56 ---- bool returns = (self->RemoveChild(child)); ! if (returns && !wxluaO_isgcobject(L, child)) ! wxluaO_addgcobject(L, (void*)child, new wxLua_wxObject_wxXmlNode(child)); // push the result flag |
From: John L. <jr...@us...> - 2007-12-13 00:48:22
|
Update of /cvsroot/wxlua/wxLua/docs In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/docs Modified Files: changelog.txt Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: changelog.txt =================================================================== RCS file: /cvsroot/wxlua/wxLua/docs/changelog.txt,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** changelog.txt 10 Dec 2007 05:39:05 -0000 1.51 --- changelog.txt 13 Dec 2007 00:47:48 -0000 1.52 *************** *** 19,23 **** - wxLuaStackDialog has better search for all columns, collapse and expand tables, and show metatables. It also now uses a virtual wxListCtrl so ! it's much faster. - Separated the "tags" for C++ classes from "refs" for objects we want a handle on in the Lua registry by putting them in separate tables. --- 19,24 ---- - wxLuaStackDialog has better search for all columns, collapse and expand tables, and show metatables. It also now uses a virtual wxListCtrl so ! it's much faster. You can expand both key and values of a table and ! more information is provided about items wxLua knows about. - Separated the "tags" for C++ classes from "refs" for objects we want a handle on in the Lua registry by putting them in separate tables. *************** *** 41,45 **** lua_setfenv may crash if called over an invalid object. - Made the garbage collector more aggressive since we push void* pointers ! but the data behind them may be quite large. Unfortunately there is no mechanism to give a size hint to Lua without modifying Lua. lua_gc(L, LUA_GCSETPAUSE, 120); lua_gc(L, LUA_GCSETSTEPMUL, 400); --- 42,46 ---- lua_setfenv may crash if called over an invalid object. - Made the garbage collector more aggressive since we push void* pointers ! but the data behind them may be quite large. Unfortunately there is no mechanism to give a size hint to Lua without modifying Lua. lua_gc(L, LUA_GCSETPAUSE, 120); lua_gc(L, LUA_GCSETSTEPMUL, 400); *************** *** 47,50 **** --- 48,66 ---- wxArtProviders in Lua. + * Allowed using wxObject:DynamicCast() on an object and be able to use the + object as both types. The problem was that wxEvent:GetEventObject() + returned a wxObject which overwrote the wxWindow (perhaps) that you had as + a userdata in Lua already. + Additionally, if you delete an object all of the userdata that wrap it + have their metatables cleared for safety. + + Functions renamed since they didn't do the same thing or behave the same. + wxluaO_istrackedobject -> wxluaO_isgcobject + wxluaO_addtrackedobject -> wxluaO_addgcobject + wxluaO_removetrackedobject -> wxluaO_deletegcobject + + - Created a central luauserdata:delete() function for the bindings to reduce + code. wxLua_wxluabind_delete(L) + version 2.8.4.2 -------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-12-13 00:48:21
|
Update of /cvsroot/wxlua/wxLua/bindings/wxlua In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/bindings/wxlua Modified Files: override.hpp wxlua.i Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/wxlua.i,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxlua.i 7 Dec 2007 02:13:09 -0000 1.10 --- wxlua.i 13 Dec 2007 00:47:48 -0000 1.11 *************** *** 37,41 **** // or lua will eventually garbage collect. // Example output : { ["wxPoint"] = 3, ["wxPen"] = 5 } ! %function LuaTable GetTrackedUserData() // Get a table of all tracked wxEvent callbacks that have been installed using --- 37,41 ---- // or lua will eventually garbage collect. // Example output : { ["wxPoint"] = 3, ["wxPen"] = 5 } ! %function LuaTable GetTrackedUserdata() // Get a table of all tracked wxEvent callbacks that have been installed using Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/override.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** override.hpp 7 Dec 2007 06:44:41 -0000 1.12 --- override.hpp 13 Dec 2007 00:47:48 -0000 1.13 *************** *** 41,50 **** %end ! %override wxLua_function_GetTrackedUserData // %function LuaTable GetTrackedUserData() ! static int LUACALL wxLua_function_GetTrackedUserData(lua_State *L) { ! wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedObjectStrings()); return 1; } --- 41,49 ---- %end ! %override wxLua_function_GetTrackedUserdata // %function LuaTable GetTrackedUserData() ! static int LUACALL wxLua_function_GetTrackedUserdata(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectstrings(L)); return 1; } *************** *** 707,711 **** returns = new wxLuaObject(wxlState, 1); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaObject, returns); --- 706,710 ---- returns = new wxLuaObject(wxlState, 1); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaObject, returns); |
From: John L. <jr...@us...> - 2007-12-13 00:48:21
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/bindings Modified Files: genwxbind.lua Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** genwxbind.lua 10 Dec 2007 05:39:04 -0000 1.153 --- genwxbind.lua 13 Dec 2007 00:47:47 -0000 1.154 *************** *** 3249,3258 **** if param.GC then if dataTypeTable[argType]["%encapsulate"] then ! table.insert(gcList, " if (!wxluaO_istrackedobject(L, "..argName..")) wxluaO_addtrackedobject(L, (void*)"..argName..", new wxLua_wxObject_"..MakeVar(argType).."("..argName.."));\n") else ! table.insert(gcList, " if (!wxluaO_istrackedobject(L, "..argName..")) wxluaO_addtrackedobject(L, "..argName..");\n") end elseif param.UnGC then ! table.insert(gcList, " if (wxluaO_istrackedobject(L, "..argName..")) wxluaO_removetrackedobject(L, "..argName..", wxLUA_UNDELETE_OBJECT);\n") end --- 3249,3258 ---- if param.GC then if dataTypeTable[argType]["%encapsulate"] then ! table.insert(gcList, " if (!wxluaO_isgcobject(L, "..argName..")) wxluaO_addgcobject(L, (void*)"..argName..", new wxLua_wxObject_"..MakeVar(argType).."("..argName.."));\n") else ! table.insert(gcList, " if (!wxluaO_isgcobject(L, "..argName..")) wxluaO_addgcobject(L, "..argName..");\n") end elseif param.UnGC then ! table.insert(gcList, " if (wxluaO_isgcobject(L, "..argName..")) wxluaO_deletegcobject(L, "..argName..", wxLUA_UNDELETE_OBJECT);\n") end *************** *** 3564,3570 **** if parseObject["%encapsulate"] then ! table.insert(codeList, " wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_"..MakeVar(parseObject.Name).."(("..returnCast..")returns));\n") else ! table.insert(codeList, " wxluaO_addtrackedobject(L, returns);\n") end elseif not parseObject["%noclassinfo"] then --- 3564,3570 ---- if parseObject["%encapsulate"] then ! table.insert(codeList, " wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_"..MakeVar(parseObject.Name).."(("..returnCast..")returns));\n") else ! table.insert(codeList, " wxluaO_addgcobject(L, returns);\n") end elseif not parseObject["%noclassinfo"] then *************** *** 3591,3600 **** if parseObject["%ungc_this"] then ! table.insert(codeList, " wxluaO_removetrackedobject(L, self, wxLUA_UNDELETE_OBJECT);\n") elseif parseObject["%gc_this"] then if parseObject["%encapsulate"] then ! table.insert(codeList, " if (!wxluaO_istrackedobject(L, self)) wxluaO_addtrackedobject(L, (void*)self, new wxLua_wxObject_"..MakeClassVar(parseObject.Name).."(self));\n") else ! table.insert(codeList, " wxluaO_addtrackedobject(L, self);\n") end end --- 3591,3600 ---- if parseObject["%ungc_this"] then ! table.insert(codeList, " wxluaO_deletegcobject(L, self, wxLUA_UNDELETE_OBJECT);\n") elseif parseObject["%gc_this"] then if parseObject["%encapsulate"] then ! table.insert(codeList, " if (!wxluaO_isgcobject(L, self)) wxluaO_addgcobject(L, (void*)self, new wxLua_wxObject_"..MakeClassVar(parseObject.Name).."(self));\n") else ! table.insert(codeList, " wxluaO_addgcobject(L, self);\n") end end *************** *** 3654,3660 **** if dataTypeTable[memberType]["%encapsulate"] then ! table.insert(codeList, " wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_"..MakeVar(memberType).."(("..returnCast..")returns));\n") else ! table.insert(codeList, " wxluaO_addtrackedobject(L, ("..returnCast..")returns);\n") end --- 3654,3660 ---- if dataTypeTable[memberType]["%encapsulate"] then ! table.insert(codeList, " wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_"..MakeVar(memberType).."(("..returnCast..")returns));\n") else ! table.insert(codeList, " wxluaO_addgcobject(L, ("..returnCast..")returns);\n") end *************** *** 3666,3675 **** if member.GC then if dataTypeTable[memberType]["%encapsulate"] then ! table.insert(codeList, " if (!wxluaO_istrackedobject(L, returns)) wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_"..MakeVar(memberType).."(returns));\n") else ! table.insert(codeList, " if (!wxluaO_istrackedobject(L, returns)) wxluaO_addtrackedobject(L, returns);\n") end elseif member.UnGC then ! table.insert(codeList, " if (wxluaO_istrackedobject(L, returns)) wxluaO_removetrackedobject(L, returns, wxLUA_UNDELETE_OBJECT);\n") end --- 3666,3675 ---- if member.GC then if dataTypeTable[memberType]["%encapsulate"] then ! table.insert(codeList, " if (!wxluaO_isgcobject(L, returns)) wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_"..MakeVar(memberType).."(returns));\n") else ! table.insert(codeList, " if (!wxluaO_isgcobject(L, returns)) wxluaO_addgcobject(L, returns);\n") end elseif member.UnGC then ! table.insert(codeList, " if (wxluaO_isgcobject(L, returns)) wxluaO_deletegcobject(L, returns, wxLUA_UNDELETE_OBJECT);\n") end *************** *** 3825,3840 **** -- delete routine codeList = {} ! local funcName = "wxLua_"..MakeVar(parseObject.Name).."_delete" ! table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! table.insert(codeList, " wxLuaState wxlState(L);\n") ! table.insert(codeList, " "..parseObject.Name.." * self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, s_wxluatag_"..MakeClassVar(parseObject.Name)..");\n") ! CommentBindingTable(codeList, " // if removed from tracked mem list, reset the tag so that gc() is not called on this object.\n") ! table.insert(codeList, " if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT))\n") ! table.insert(codeList, " {\n") ! table.insert(codeList, " lua_pushnil(L);\n") ! table.insert(codeList, " lua_setmetatable(L, -2);\n") ! table.insert(codeList, " }\n") ! table.insert(codeList, " return 0;\n") ! table.insert(codeList, "}\n") local funcMapName = "s_wxluafunc_"..funcName --- 3825,3848 ---- -- delete routine codeList = {} ! local funcName = "wxLua_"..MakeVar(parseObject.Name).."_delete" ! local funcName_ = funcName ! ! if false then ! table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! table.insert(codeList, " return wxLua_wxlua_delete(L);\n") ! --[[ ! table.insert(codeList, " "..parseObject.Name.." * self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, s_wxluatag_"..MakeClassVar(parseObject.Name)..");\n") ! CommentBindingTable(codeList, " // if removed from tracked mem list, reset the tag so that gc() is not called on this object.\n") ! table.insert(codeList, " if ((self != NULL) && wxluaO_deletegcobject(L, self, wxLUA_DELETE_REMOVE_OBJECT))\n") ! table.insert(codeList, " {\n") ! table.insert(codeList, " lua_pushnil(L);\n") ! table.insert(codeList, " lua_setmetatable(L, -2);\n") ! table.insert(codeList, " }\n") ! table.insert(codeList, " return 0;\n") ! table.insert(codeList, "}\n") ! --]] ! elseif not overrideTable[funcName] then ! funcName_ = "wxLua_wxluabind_delete" ! end local funcMapName = "s_wxluafunc_"..funcName *************** *** 3850,3857 **** { LuaName = "delete", ! CFunctionName = funcName, Method = codeList, FuncType = "WXLUAMETHOD_METHOD", ! FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, "..overload_argListName.." }", FuncMapName = funcMapName, ArgArray = overload_argList, --- 3858,3865 ---- { LuaName = "delete", ! CFunctionName = funcName_, Method = codeList, FuncType = "WXLUAMETHOD_METHOD", ! FuncMap = "{ "..funcName_..", WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, "..overload_argListName.." }", FuncMapName = funcMapName, ArgArray = overload_argList, *************** *** 3864,3870 **** -- Override Generated Method Code ! if overrideTable[delMethodBinding.CFunctionName] then ! delMethodBinding.Method = overrideTable[delMethodBinding.CFunctionName] ! overrideTableUsed[delMethodBinding.CFunctionName] = true end --- 3872,3878 ---- -- Override Generated Method Code ! if overrideTable[funcName] then ! delMethodBinding.Method = overrideTable[funcName] ! overrideTableUsed[funcName] = true end *************** *** 4658,4662 **** end if functionBinding.FuncMapName then ! table.insert(fileData, "static int LUACALL "..functionBinding.CFunctionName.."(lua_State *L);\n") table.insert(fileData, "static wxLuaBindCFunc "..functionBinding.FuncMapName.."[1] = {"..functionBinding.FuncMap.."};\n") end --- 4666,4672 ---- end if functionBinding.FuncMapName then ! if functionBinding.CFunctionName ~= "wxLua_wxluabind_delete" then ! table.insert(fileData, "static int LUACALL "..functionBinding.CFunctionName.."(lua_State *L);\n") ! end table.insert(fileData, "static wxLuaBindCFunc "..functionBinding.FuncMapName.."[1] = {"..functionBinding.FuncMap.."};\n") end |
From: John L. <jr...@us...> - 2007-12-13 00:48:00
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** wxlstack.cpp 10 Dec 2007 23:20:19 -0000 1.27 --- wxlstack.cpp 13 Dec 2007 00:47:53 -0000 1.28 *************** *** 82,86 **** int wxLuaStackListCtrl::OnGetItemColumnImage(long item, long column) const { ! if (column == 0) { wxLuaStackListData* stkListData = (wxLuaStackListData*)m_stkDlg->m_listData[item]; --- 82,88 ---- int wxLuaStackListCtrl::OnGetItemColumnImage(long item, long column) const { ! if ((column == wxLuaStackDialog::LIST_COL_KEY) || ! (column == wxLuaStackDialog::LIST_COL_KEY_TYPE) || ! (column == wxLuaStackDialog::LIST_COL_VALUE_TYPE)) { wxLuaStackListData* stkListData = (wxLuaStackListData*)m_stkDlg->m_listData[item]; *************** *** 88,93 **** wxLuaDebugItem* debugItem = stkListData->GetDebugItem(); wxCHECK_MSG(debugItem, NULL, wxT("Invalid wxLuaDebugItem item")); ! ! return m_stkDlg->GetItemImage(debugItem); } --- 90,116 ---- wxLuaDebugItem* debugItem = stkListData->GetDebugItem(); wxCHECK_MSG(debugItem, NULL, wxT("Invalid wxLuaDebugItem item")); ! ! if (column == wxLuaStackDialog::LIST_COL_KEY) ! return m_stkDlg->GetItemImage(debugItem); ! else if (column == wxLuaStackDialog::LIST_COL_KEY_TYPE) ! { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)) ! { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! return wxLuaStackDialog::IMG_TABLE_OPEN; ! else ! return wxLuaStackDialog::IMG_TABLE; ! } ! } ! else if (column == wxLuaStackDialog::LIST_COL_VALUE_TYPE) ! { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_VALUE_REF)) ! { ! if (debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) ! return wxLuaStackDialog::IMG_TABLE_OPEN; ! else ! return wxLuaStackDialog::IMG_TABLE; ! } ! } } *************** *** 113,117 **** } - // ---------------------------------------------------------------------------- // wxLuaStackDialog --- 136,139 ---- *************** *** 154,157 **** --- 176,180 ---- m_imageList = NULL; + m_img_font_size = 15; // largest font size we'll use is 14 m_show_dup_expand_msg = true; *************** *** 311,325 **** m_listCtrl->SetImageList(m_imageList, wxIMAGE_LIST_SMALL); ! m_listCtrl->InsertColumn(0, wxT("Name"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(1, wxT("Level"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(2, wxT("Key Type"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(3, wxT("Value Type"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(4, wxT("Value"), wxLIST_FORMAT_LEFT, -1); int txt_width = 0, txt_height = 0; ! m_listCtrl->GetTextExtent(wxT("WWWWWWWWWWWWWWWWWWWW"), &txt_width, &txt_height); m_listCtrl->SetColumnWidth(0, txt_width); ! m_listCtrl->SetColumnWidth(4, txt_width); // make it wide since it's the last m_listCtrl->GetTextExtent(wxT("555:5555"), &txt_width, &txt_height); m_listCtrl->SetColumnWidth(1, txt_width); --- 334,350 ---- m_listCtrl->SetImageList(m_imageList, wxIMAGE_LIST_SMALL); ! m_listCtrl->InsertColumn(LIST_COL_KEY, wxT("Name"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(LIST_COL_LEVEL, wxT("Level"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(LIST_COL_KEY_TYPE, wxT("Key Type"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(LIST_COL_VALUE_TYPE, wxT("Value Type"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(LIST_COL_VALUE, wxT("Value"), wxLIST_FORMAT_LEFT, -1); int txt_width = 0, txt_height = 0; ! m_listCtrl->GetTextExtent(wxString(wxT('W'), 25), &txt_width, &txt_height); ! ! m_listCtrl->SetColumnWidth(0, txt_width); ! m_listCtrl->SetColumnWidth(4, 4*txt_width); // make it wide since it's the last m_listCtrl->GetTextExtent(wxT("555:5555"), &txt_width, &txt_height); m_listCtrl->SetColumnWidth(1, txt_width); *************** *** 379,397 **** dc.SelectObject(bmp); wxCoord w = 0, h = 0; ! for (int n = 14; n > 3; n--) { ! wxFont f(n, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); ! dc.GetTextExtent(s, &w, &h, NULL, NULL, &f); if ((w < bmp_w) && (h < bmp_h)) - { - dc.SetFont(f); break; ! } } dc.DrawText(s, (bmp_w-w)/2, (bmp_h-h)/2); - dc.SelectObject(wxNullBitmap); --- 404,423 ---- dc.SelectObject(bmp); + wxFont font(m_img_font_size, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); wxCoord w = 0, h = 0; ! ! // after first time to find font size, run once to get the text extent ! for ( ; m_img_font_size > 3; --m_img_font_size) { ! dc.GetTextExtent(s, &w, &h, NULL, NULL, &font); if ((w < bmp_w) && (h < bmp_h)) break; ! ! font.SetPointSize(m_img_font_size); } + dc.SetFont(font); dc.DrawText(s, (bmp_w-w)/2, (bmp_h-h)/2); dc.SelectObject(wxNullBitmap); *************** *** 408,411 **** --- 434,439 ---- if (dbgItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) img = IMG_TABLE_OPEN; + else if (dbgItem->GetFlagBit(WXLUA_DEBUGITEM_LOCALS)) + img = IMG_TABLE; else { *************** *** 440,444 **** switch (column) { ! case 0: { if (exact_value) --- 468,472 ---- switch (column) { ! case LIST_COL_KEY: { if (exact_value) *************** *** 455,465 **** return debugItem->GetKey(); } ! case 1: return wxString::Format(wxT("%d:%d"), stkListData->m_level+1, stkListData->m_item_idx+1); ! case 2: return debugItem->GetKeyTypeString(); ! case 3: return debugItem->GetValueTypeString(); ! case 4: { if (exact_value) --- 483,493 ---- return debugItem->GetKey(); } ! case LIST_COL_LEVEL: return wxString::Format(wxT("%d:%d"), stkListData->m_level+1, stkListData->m_item_idx+1); ! case LIST_COL_KEY_TYPE: return debugItem->GetKeyTypeString(); ! case LIST_COL_VALUE_TYPE: return debugItem->GetValueTypeString(); ! case LIST_COL_VALUE: { if (exact_value) *************** *** 549,554 **** // Add the locals, fake a debug item to get it setup right wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), WXLUAARG_None, ! wxString::Format(wxT("Count %d"), (int)debugData.GetCount()), WXLUAARG_None, ! wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED); wxLuaDebugData localData(true); // this deletes the items localData.Add(localItem); --- 577,582 ---- // Add the locals, fake a debug item to get it setup right wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), WXLUAARG_None, ! wxString::Format(wxT("%d Items"), (int)debugData.GetCount()), WXLUAARG_None, ! wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED|WXLUA_DEBUGITEM_LOCALS|WXLUA_DEBUGITEM_VALUE_REF); wxLuaDebugData localData(true); // this deletes the items localData.Add(localItem); *************** *** 624,628 **** int img = GetItemImage(debugItem); ! if (debugItem->GetReference() != LUA_NOREF) { wxTreeItemId id = m_treeCtrl->AppendItem(treeId, debugItem->GetKey(), -1, -1, new wxLuaStackTreeData(stkListData)); --- 652,657 ---- int img = GetItemImage(debugItem); ! if ((debugItem->GetRef() != LUA_NOREF) || ! debugItem->GetFlagBit(WXLUA_DEBUGITEM_LOCALS)) { wxTreeItemId id = m_treeCtrl->AppendItem(treeId, debugItem->GetKey(), -1, -1, new wxLuaStackTreeData(stkListData)); *************** *** 990,994 **** wxCHECK_MSG(debugItem != NULL, false, wxT("Invalid debug item")); ! int nRef = debugItem->GetReference(); if (!debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) --- 1019,1023 ---- wxCHECK_MSG(debugItem != NULL, false, wxT("Invalid debug item")); ! int nRef = debugItem->GetRef(); if (!debugItem->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) *************** *** 999,1006 **** debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); ! wxString val(debugItem->GetValue()); ! long vkey = 0; ! if (val.BeforeFirst(wxT(' ')).ToLong(&vkey, 16)) ! m_expandedItems[vkey] = (long)stkListData; FillTableEntry(lc_item, stkListData->m_childrenDebugData); --- 1028,1034 ---- debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); ! long long_key = 0; ! if (debugItem->GetRefPtr(long_key)) ! m_expandedItems[long_key] = (long)stkListData; FillTableEntry(lc_item, stkListData->m_childrenDebugData); *************** *** 1010,1020 **** // Check and block linked tables already shown, select it and return ! if (debugItem->GetValueType() == WXLUAARG_Table) { ! wxString val(debugItem->GetValue()); ! long vkey = 0; ! wxCHECK_MSG(val.BeforeFirst(wxT(' ')).ToLong(&vkey, 16), false, wxT("Invalid table item")); ! if (m_expandedItems[vkey]) { if (m_show_dup_expand_msg) --- 1038,1047 ---- // Check and block linked tables already shown, select it and return ! if (debugItem->GetRef() != LUA_NOREF) { ! long long_key = 0; ! wxCHECK_MSG(debugItem->GetRefPtr(long_key), false, wxT("Invalid table item")); ! if (m_expandedItems[long_key]) { if (m_show_dup_expand_msg) *************** *** 1023,1027 **** wxT("wxLua Stack"), wxOK | wxCENTRE, this); ! int n = m_listData.Index((void*)m_expandedItems[vkey]); wxCHECK_MSG(n != wxNOT_FOUND, false, wxT("Unable to find hash of expanded items.")); --- 1050,1054 ---- wxT("wxLua Stack"), wxOK | wxCENTRE, this); ! int n = m_listData.Index((void*)m_expandedItems[long_key]); wxCHECK_MSG(n != wxNOT_FOUND, false, wxT("Unable to find hash of expanded items.")); *************** *** 1039,1046 **** debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); ! wxString val(debugItem->GetValue()); ! long vkey = 0; ! wxCHECK_MSG(val.BeforeFirst(wxT(' ')).ToLong(&vkey, 16), false, wxT("Invalid table item")); ! m_expandedItems[vkey] = (long)stkListData; int nIndex = debugItem->GetIndex() + 1; --- 1066,1072 ---- debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, true); ! long long_key = 0; ! wxCHECK_MSG(debugItem->GetRefPtr(long_key), false, wxT("Invalid table item")); ! m_expandedItems[long_key] = (long)stkListData; int nIndex = debugItem->GetIndex() + 1; *************** *** 1136,1143 **** stkListData_n->GetDebugItem()->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) { ! wxString val(stkListData_n->GetDebugItem()->GetValue()); ! long vkey = 0; ! if (val.BeforeFirst(wxT(' ')).ToLong(&vkey, 16)) ! m_expandedItems.erase(vkey); CollapseItem(n); --- 1162,1168 ---- stkListData_n->GetDebugItem()->GetFlagBit(WXLUA_DEBUGITEM_EXPANDED)) { ! long long_key = 0; ! if (stkListData_n->GetDebugItem()->GetRefPtr(long_key)) ! m_expandedItems.erase(long_key); CollapseItem(n); *************** *** 1170,1177 **** debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, false); ! wxString val(debugItem->GetValue()); ! long vkey = 0; ! if (val.BeforeFirst(wxT(' ')).ToLong(&vkey, 16)) ! m_expandedItems.erase(vkey); } --- 1195,1201 ---- debugItem->SetFlagBit(WXLUA_DEBUGITEM_EXPANDED, false); ! long long_key = 0; ! if (debugItem->GetRefPtr(long_key)) ! m_expandedItems.erase(long_key); } *************** *** 1217,1224 **** wxLuaDebugItem* debugItem = stkListData->GetDebugItem(); ! if (debugItem && (debugItem->GetReference() != LUA_NOREF) && debugItem->GetFlagBit(WXLUA_DEBUGITEM_LUAREFED)) { ! int lua_ref = debugItem->GetReference(); int ok = m_wxlState.wxluaR_Unref(lua_ref); debugItem->SetReference(LUA_NOREF); --- 1241,1248 ---- wxLuaDebugItem* debugItem = stkListData->GetDebugItem(); ! if (debugItem && (debugItem->GetRef() != LUA_NOREF) && debugItem->GetFlagBit(WXLUA_DEBUGITEM_LUAREFED)) { ! int lua_ref = debugItem->GetRef(); int ok = m_wxlState.wxluaR_Unref(lua_ref); debugItem->SetReference(LUA_NOREF); *************** *** 1228,1232 **** m_luaReferences.RemoveAt(idx); else ! wxPrintf(wxT("Missing Lua reference in listctrl #%d ok %d ref %d count %d idx %d\n"), i, ok, debugItem->GetReference(), m_luaReferences.GetCount(), idx); } } --- 1252,1256 ---- m_luaReferences.RemoveAt(idx); else ! wxPrintf(wxT("Missing Lua reference in listctrl #%d ok %d ref %d count %d idx %d\n"), i, ok, debugItem->GetRef(), m_luaReferences.GetCount(), idx); } } Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** wxldebug.cpp 10 Dec 2007 23:20:19 -0000 1.58 --- wxldebug.cpp 13 Dec 2007 00:47:53 -0000 1.59 *************** *** 29,40 **** const wxString &itemValue, int itemValueType, const wxString &itemSource, ! int lua_ref, ! int idx, ! int flag) :m_itemKey(itemKey), m_itemKeyType(itemKeyType), m_itemValue(itemValue), m_itemValueType(itemValueType), m_itemSource(itemSource), ! m_lua_ref(lua_ref), m_index(idx), ! m_flag(flag) { } --- 29,37 ---- const wxString &itemValue, int itemValueType, const wxString &itemSource, ! int lua_ref, int idx, int flag) :m_itemKey(itemKey), m_itemKeyType(itemKeyType), m_itemValue(itemValue), m_itemValueType(itemValueType), m_itemSource(itemSource), ! m_lua_ref(lua_ref), m_index(idx), m_flag(flag) { } *************** *** 49,52 **** --- 46,61 ---- } + bool wxLuaDebugItem::GetRefPtr(long& ptr) const + { + bool key_ref = GetFlagBit(WXLUA_DEBUGITEM_KEY_REF); + bool val_ref = GetFlagBit(WXLUA_DEBUGITEM_VALUE_REF); + + // sanity checks + wxCHECK_MSG((key_ref || val_ref), false, wxT("wxLuaDebugItem has neither key or value reference")); + wxCHECK_MSG(!(key_ref && val_ref), false, wxT("wxLuaDebugItem has both key and value reference")); + + return wxString(key_ref ? m_itemKey: m_itemValue).BeforeFirst(wxT(' ')).ToLong(&ptr, 16); + } + // ---------------------------------------------------------------------------- // wxLuaDebugData - Debug Info sent via socket to debugger client *************** *** 140,151 **** if (ret == 0) // can be true for unnamed "(*temporary)" vars { ! ret = elem1->GetKeyType() - elem2->GetKeyType(); if (ret == 0) { ! ret = elem1->GetValueType() - elem2->GetValueType(); if (ret == 0) ! ret = elem1->GetValue().Cmp(elem2->GetValue()); } } --- 149,166 ---- if (ret == 0) // can be true for unnamed "(*temporary)" vars { ! ret = elem1->m_itemKeyType - elem2->m_itemKeyType; if (ret == 0) { ! ret = elem1->m_itemValueType - elem2->m_itemValueType; if (ret == 0) ! { ! ret = elem1->m_itemValue.Cmp(elem2->m_itemValue); ! ! if (ret == 0) ! ret = int(elem2->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)) - ! int(elem1->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)); ! } } } *************** *** 186,190 **** name = wxString::Format(_("line %d"), currentLine); ! Add(new wxLuaDebugItem(name, WXLUAARG_None, wxT(""), WXLUAARG_None, source, LUA_NOREF, stack_frame, 0)); ++count; } --- 201,205 ---- name = wxString::Format(_("line %d"), currentLine); ! Add(new wxLuaDebugItem(name, WXLUAARG_None, wxT(""), WXLUAARG_None, source, LUA_NOREF, stack_frame, WXLUA_DEBUGITEM_LOCALS)); ++count; } *************** *** 273,280 **** int flag_type = 0; ! int nRef = RefTable(L, -1, &flag_type, references); lua_pop(L, 1); // pop globals table ! Add(new wxLuaDebugItem(wxT("Globals"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, flag_type)); } else if (tableRef == LUA_REGISTRYINDEX) --- 288,295 ---- int flag_type = 0; ! int val_ref = RefTable(L, -1, &flag_type, WXLUA_DEBUGITEM_VALUE_REF, references); lua_pop(L, 1); // pop globals table ! Add(new wxLuaDebugItem(wxT("Globals"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), val_ref, 0, flag_type)); } else if (tableRef == LUA_REGISTRYINDEX) *************** *** 284,291 **** int flag_type = 0; ! int nRef = RefTable(L, -1, &flag_type, references); lua_pop(L, 1); // pop registry table ! Add(new wxLuaDebugItem(wxT("Registry"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), nRef, 0, WXLUA_DEBUGITEM_LUAREFED)); } else --- 299,306 ---- int flag_type = 0; ! int val_ref = RefTable(L, -1, &flag_type, WXLUA_DEBUGITEM_VALUE_REF, references); lua_pop(L, 1); // pop registry table ! Add(new wxLuaDebugItem(wxT("Registry"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), val_ref, 0, flag_type)); } else *************** *** 318,325 **** int flag_type = 0; ! int nRef = RefTable(L, -1, &flag_type, references); // leading space so it's first when sorted ! Add(new wxLuaDebugItem(wxT(" __metatable"), WXLUAARG_Table, value, wxl_valuetype, wxT(""), nRef, nIndex, flag_type)); ++count; --- 333,340 ---- int flag_type = 0; ! int val_ref = RefTable(L, -1, &flag_type, WXLUA_DEBUGITEM_VALUE_REF, references); // leading space so it's first when sorted ! Add(new wxLuaDebugItem(wxT(" __metatable"), WXLUAARG_Table, value, wxl_valuetype, wxT(""), val_ref, nIndex, flag_type)); ++count; *************** *** 377,381 **** name += wxT(" ") + wxString(win->GetClassInfo()->GetClassName()); } ! else if (lightuserdata_reg_key == &wxlua_lreg_delobjects_key) { wxObject* obj = (wxObject*)lua_touserdata(L, -1); --- 392,396 ---- name += wxT(" ") + wxString(win->GetClassInfo()->GetClassName()); } ! else if (lightuserdata_reg_key == &wxlua_lreg_gcobjects_key) { wxObject* obj = (wxObject*)lua_touserdata(L, -1); *************** *** 400,419 **** } ! int flag_type = 0; ! int nRef = LUA_NOREF; // don't ref anything in this table since it's already refed if ((lua_value_type == LUA_TTABLE) && (lightuserdata_reg_key != &wxlua_lreg_debug_refs_key)) ! nRef = RefTable(L, -1, &flag_type, references); else if (lua_value_type == LUA_TUSERDATA) { if (lua_getmetatable(L, -1)) // doesn't push anything if nil { ! nRef = RefTable(L, -1, &flag_type, references); lua_pop(L, 1); } } ! Add(new wxLuaDebugItem(name, wxl_keytype, value, wxl_valuetype, wxT(""), nRef, nIndex, flag_type)); ! ++count; lua_pop(L, 1); // pop value, leave key --- 415,466 ---- } ! // ---------------------------------------------------------- ! // Handle the key ! ! int key_flag_type = 0; ! int key_ref = LUA_NOREF; ! ! // don't ref anything in this table since it's already refed ! if ((lua_key_type == LUA_TTABLE) && (lightuserdata_reg_key != &wxlua_lreg_debug_refs_key)) ! key_ref = RefTable(L, -2, &key_flag_type, WXLUA_DEBUGITEM_KEY_REF, references); ! else if (lua_key_type == LUA_TUSERDATA) ! { ! if (lua_getmetatable(L, -2)) // doesn't push anything if nil ! { ! key_ref = RefTable(L, -2, &key_flag_type, WXLUA_DEBUGITEM_KEY_REF, references); ! lua_pop(L, 1); ! } ! } ! ! // only add the key if we refed it so it can be viewed in the stack dialog ! if (key_flag_type != 0) ! { ! Add(new wxLuaDebugItem(name, wxl_keytype, value, wxl_valuetype, wxT(""), key_ref, nIndex, key_flag_type)); ! ++count; ! } ! ! // ---------------------------------------------------------- ! // Handle the value ! ! int val_flag_type = 0; ! int val_ref = LUA_NOREF; ! // don't ref anything in this table since it's already refed if ((lua_value_type == LUA_TTABLE) && (lightuserdata_reg_key != &wxlua_lreg_debug_refs_key)) ! val_ref = RefTable(L, -1, &val_flag_type, WXLUA_DEBUGITEM_VALUE_REF, references); else if (lua_value_type == LUA_TUSERDATA) { if (lua_getmetatable(L, -1)) // doesn't push anything if nil { ! val_ref = RefTable(L, -1, &val_flag_type, WXLUA_DEBUGITEM_VALUE_REF, references); lua_pop(L, 1); } } ! if ((key_flag_type == 0) || ((key_flag_type != 0) && (val_flag_type != 0))) ! { ! Add(new wxLuaDebugItem(name, wxl_keytype, value, wxl_valuetype, wxT(""), val_ref, nIndex, val_flag_type)); ! ++count; ! } lua_pop(L, 1); // pop value, leave key *************** *** 428,449 **** } ! int wxLuaDebugData::RefTable(lua_State* L, int stack_idx, int* flag_type, wxArrayInt& references) { wxCHECK_MSG(L, LUA_NOREF, wxT("Invalid lua_State")); ! int nRef = LUA_NOREF; //if (lua_istable(L, stack_idx)) { //nRef = wxluaR_isrefed(L, stack_idx, &wxlua_lreg_debug_refs_key); // don't duplicate refs ! if (nRef == LUA_NOREF) { ! if (flag_type) *flag_type |= WXLUA_DEBUGITEM_LUAREFED; ! nRef = wxluaR_ref(L, -1, &wxlua_lreg_debug_refs_key); ! references.Add(nRef); } } ! return nRef; } --- 475,496 ---- } ! int wxLuaDebugData::RefTable(lua_State* L, int stack_idx, int* flag_type, int extra_flag, wxArrayInt& references) { wxCHECK_MSG(L, LUA_NOREF, wxT("Invalid lua_State")); ! int lua_ref = LUA_NOREF; //if (lua_istable(L, stack_idx)) { //nRef = wxluaR_isrefed(L, stack_idx, &wxlua_lreg_debug_refs_key); // don't duplicate refs ! if (lua_ref == LUA_NOREF) { ! if (flag_type) *flag_type |= (WXLUA_DEBUGITEM_IS_REFED | extra_flag); ! lua_ref = wxluaR_ref(L, stack_idx, &wxlua_lreg_debug_refs_key); ! references.Add(lua_ref); } } ! return lua_ref; } *************** *** 569,573 **** (udata == &wxlua_lreg_wxluastate_key) || (udata == &wxlua_lreg_weakobjects_key) || ! (udata == &wxlua_lreg_delobjects_key) || (udata == &wxlua_lreg_evtcallbacks_key) || (udata == &wxlua_lreg_windestroycallbacks_key) || --- 616,620 ---- (udata == &wxlua_lreg_wxluastate_key) || (udata == &wxlua_lreg_weakobjects_key) || ! (udata == &wxlua_lreg_gcobjects_key) || (udata == &wxlua_lreg_evtcallbacks_key) || (udata == &wxlua_lreg_windestroycallbacks_key) || *************** *** 626,629 **** --- 673,678 ---- m_luaState, m_msg.c_str(), msg.c_str(), m_top, lua_gettop(m_luaState)); + if (m_top != lua_gettop(m_luaState)) s += wxT(" **********"); // easy to find + OutputMsg(s); |
From: John L. <jr...@us...> - 2007-12-13 00:47:59
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp wxlstate.cpp wxlua.cpp wxlua_bind.cpp Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: wxlua.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxlua.cpp 10 Dec 2007 05:39:10 -0000 1.7 --- wxlua.cpp 13 Dec 2007 00:47:52 -0000 1.8 *************** *** 34,50 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaState_delete[] = { &s_wxluatag_wxLuaState, NULL }; ! static int LUACALL wxLua_wxLuaState_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaState_delete[1] = {{ wxLua_wxLuaState_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaState_delete }}; ! static int LUACALL wxLua_wxLuaState_delete(lua_State *L) ! { ! wxLuaState * self = (wxLuaState *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaState); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } --- 34,38 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaState_delete[] = { &s_wxluatag_wxLuaState, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaState_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaState_delete }}; *************** *** 116,132 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaObject_delete[] = { &s_wxluatag_wxLuaObject, NULL }; ! static int LUACALL wxLua_wxLuaObject_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_delete[1] = {{ wxLua_wxLuaObject_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaObject_delete }}; ! static int LUACALL wxLua_wxLuaObject_delete(lua_State *L) ! { ! wxLuaObject * self = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static int LUACALL wxLua_wxLuaObject_constructor(lua_State *L); --- 104,108 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaObject_delete[] = { &s_wxluatag_wxLuaObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaObject_delete }}; static int LUACALL wxLua_wxLuaObject_constructor(lua_State *L); *************** *** 143,147 **** returns = new wxLuaObject(wxlState, 1); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaObject, returns); --- 119,123 ---- returns = new wxLuaObject(wxlState, 1); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaObject, returns); Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** wxlstate.cpp 10 Dec 2007 05:39:10 -0000 1.149 --- wxlstate.cpp 13 Dec 2007 00:47:51 -0000 1.150 *************** *** 23,26 **** --- 23,28 ---- #include "wx/tokenzr.h" + //#include "wxluadebug/include/wxldebug.h" // for debugging only + const char* wxlua_lreg_tags_key = "wxLua metatable class tags"; const char* wxlua_lreg_refs_key = "wxLua object references"; *************** *** 30,34 **** const char* wxlua_lreg_wxluastate_key = "wxLuaState"; const char* wxlua_lreg_weakobjects_key = "wxLua objects pushed"; ! const char* wxlua_lreg_delobjects_key = "wxLua objects to delete"; const char* wxlua_lreg_evtcallbacks_key = "wxLuaCallbacks"; const char* wxlua_lreg_windestroycallbacks_key = "wxLuaWinDestoyCallbacks"; --- 32,36 ---- const char* wxlua_lreg_wxluastate_key = "wxLuaState"; const char* wxlua_lreg_weakobjects_key = "wxLua objects pushed"; ! const char* wxlua_lreg_gcobjects_key = "wxLua gc objects to delete"; const char* wxlua_lreg_evtcallbacks_key = "wxLuaCallbacks"; const char* wxlua_lreg_windestroycallbacks_key = "wxLuaWinDestoyCallbacks"; *************** *** 503,507 **** } ! bool LUACALL wxluaT_pushusertag(lua_State *L, const void *u, int tag, bool track) { // First check to see if we've already pushed this object into Lua. --- 505,509 ---- } ! bool LUACALL wxluaT_pushusertag(lua_State *L, const void *obj_ptr, int tag, bool track) { // First check to see if we've already pushed this object into Lua. *************** *** 514,530 **** if (tag != g_wxluatag_wxLuaFunction) { ! lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (the obj table) ! ! lua_pushlightuserdata(L, (void*)u); // push key ! lua_rawget(L, -2); // get t[key] value; pop key push value ! ! if (wxlua_iswxuserdata(L, -1)) ! { ! lua_remove(L, -2); // remove the obj table, leave value on the stack return true; - } - - lua_pop(L, 2); // pop the table and the nil. } --- 516,521 ---- if (tag != g_wxluatag_wxLuaFunction) { ! if (wxluaO_istrackedweakobject(L, (void*)obj_ptr, tag, true)) return true; } *************** *** 533,537 **** if (ptr != NULL) { ! *ptr = u; // try to get the object's references table and set the metatable to the object if (wxluaR_getref(L, tag, &wxlua_lreg_tags_key)) --- 524,528 ---- if (ptr != NULL) { ! *ptr = obj_ptr; // try to get the object's references table and set the metatable to the object if (wxluaR_getref(L, tag, &wxlua_lreg_tags_key)) *************** *** 541,554 **** { if (track) ! { ! lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (the obj table) ! ! lua_pushlightuserdata(L, (void*)u); // key on the object since we can reuse the userdata ! lua_pushvalue(L, -3); // push the Lua userdata as the value (note: weak valued table) ! ! lua_rawset(L, -3); // t[key] = value; pops key and value ! lua_pop(L, 1); // pop obj table ! } return true; // leave value on the stack --- 532,536 ---- { if (track) ! wxluaO_trackweakobject(L, -1, (void*)obj_ptr, tag); return true; // leave value on the stack *************** *** 619,630 **** // ---------------------------------------------------------------------------- ! void LUACALL wxluaO_addtrackedobject(lua_State *L, wxObject* wxobj) { ! wxluaO_addtrackedobject(L, (void*)wxobj, wxobj); } ! void LUACALL wxluaO_addtrackedobject(lua_State *L, const void *obj_ptr, wxObject* wxobj) { ! lua_pushlightuserdata(L, &wxlua_lreg_delobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) // Check if it's already tracked since there's a serious problem if it is --- 601,612 ---- // ---------------------------------------------------------------------------- ! void LUACALL wxluaO_addgcobject(lua_State *L, wxObject* wxobj) { ! wxluaO_addgcobject(L, (void*)wxobj, wxobj); } ! void LUACALL wxluaO_addgcobject(lua_State *L, const void *obj_ptr, wxObject* wxobj) { ! lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) // Check if it's already tracked since there's a serious problem if it is *************** *** 634,638 **** { lua_pop(L, 2); // pop table and value ! wxFAIL_MSG(wxT("Tracking an object the second time in wxluaO_addtrackedobject")); return; } --- 616,620 ---- { lua_pop(L, 2); // pop table and value ! wxFAIL_MSG(wxT("Tracking an object twice in wxluaO_addgcobject: ") + wxString(wxobj->GetClassInfo()->GetClassName())); return; } *************** *** 647,703 **** } ! bool LUACALL wxluaO_removetrackedobject(lua_State *L, void *obj_ptr, int flags) { ! // No derived methods anymore ! if (WXLUA_HASBIT(flags, wxLUA_CLEAR_DERIVED_METHODS)) ! wxlua_removederivedmethod(L, obj_ptr); ! // Nor are we tracking it as a weak object ! if (WXLUA_HASBIT(flags, wxLUA_CLEAR_TRACKED_OBJECT)) { ! lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (the object table) ! ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_pushnil(L); // push value ! lua_rawset(L, -3); // set t[key] = nil; pops key and value ! lua_pop(L, 1); // pop objects table } ! lua_pushlightuserdata(L, &wxlua_lreg_delobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_rawget(L, -2); // get t[key] = value, pops key ! if (lua_islightuserdata(L, -1)) ! { ! // delete the real object for the case where it's encapsulated ! if (WXLUA_HASBIT(flags, wxLUA_DELETE_OBJECT)) { ! wxObject *del_obj = (wxObject*)lua_touserdata(L, -1); ! delete del_obj; ! } ! lua_pop(L, 1); // pop lightuserdata ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_pushnil(L); // push value ! lua_rawset(L, -3); // set t[key] = value, pops key and value ! lua_pop(L, 1); // pop delobj table ! return true; } - else - lua_pop(L, 2); // pop nil and delobj return false; } ! bool LUACALL wxluaO_istrackedobject(lua_State *L, void *obj_ptr) { ! lua_pushlightuserdata(L, &wxlua_lreg_delobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) lua_pushlightuserdata(L, obj_ptr); // push key --- 629,685 ---- } ! bool LUACALL wxluaO_deletegcobject(lua_State *L, void *obj_ptr, int flags) { ! if (obj_ptr == 0) return false; ! // No derived methods and remove weak refs to it ! if (WXLUA_HASBIT(flags, wxLUA_REMOVE_OBJECT)) { ! wxlua_removederivedmethod(L, obj_ptr); ! wxluaO_untrackweakobject(L, obj_ptr); } ! if (WXLUA_HASBIT(flags, wxLUA_UNDELETE_OBJECT|wxLUA_DELETE_OBJECT)) ! { ! lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_rawget(L, -2); // get t[key] = value, pops key ! if (lua_islightuserdata(L, -1)) // is the wxObject* we delete { ! // delete the real object for the case where it's encapsulated ! if (WXLUA_HASBIT(flags, wxLUA_DELETE_OBJECT)) ! { ! wxObject *wxobj_ptr = (wxObject*)lua_touserdata(L, -1); ! delete wxobj_ptr; ! } ! lua_pop(L, 1); // pop lightuserdata ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_pushnil(L); // push value ! lua_rawset(L, -3); // set t[key] = value, pops key and value ! lua_pop(L, 1); // pop delobj table ! return true; ! } ! else ! { ! // no error message since we're called from wxluabind__gc_wxLuaBindClass ! // automatically for all our objects and this table stores which ones to delete ! lua_pop(L, 2); // pop nil and delobj ! } } return false; } ! bool LUACALL wxluaO_isgcobject(lua_State *L, void *obj_ptr) { ! lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) lua_pushlightuserdata(L, obj_ptr); // push key *************** *** 710,719 **** } ! wxArrayString LUACALL wxluaO_gettrackedobjectstrings(lua_State *L) { wxArrayString arrStr; ! lua_pushlightuserdata(L, &wxlua_lreg_delobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) lua_pushnil(L); --- 692,701 ---- } ! wxArrayString LUACALL wxluaO_getgcobjectstrings(lua_State *L) { wxArrayString arrStr; ! lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) lua_pushnil(L); *************** *** 738,756 **** } ! void LUACALL wxluaO_cleartrackedmetatable(lua_State *L, const void *u) { lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (the object table) ! lua_pushlightuserdata(L, (void*)u); // push key ! lua_rawget(L, -2); // get t[key] = value; pop key push value ! if (lua_isuserdata(L, -1)) { lua_pushnil(L); ! lua_setmetatable(L, -2); // set nil to metatable } ! lua_pop(L, 2); // pop object table and [userdata or nil] } --- 720,826 ---- } ! void LUACALL wxluaO_trackweakobject(lua_State *L, int udata_stack_idx, void *obj_ptr, int tag) ! { ! lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (the obj table) ! ! lua_pushlightuserdata(L, obj_ptr); // key on the object since we can reuse the userdata ! lua_rawget(L, -2); ! ! if (lua_isnil(L, -1)) ! { ! lua_pop(L, 1); // pop nil ! ! lua_pushlightuserdata(L, obj_ptr); ! lua_newtable(L); ! lua_newtable(L); // metatable ! lua_pushlstring(L, "__mode", 6); ! lua_pushlstring(L, "v", 1); ! lua_rawset(L, -3); // set mode of main table ! lua_setmetatable(L, -2); // via the metatable ! lua_rawset(L, -3); ! ! lua_pushlightuserdata(L, obj_ptr); // get the table back ! lua_rawget(L, -2); ! } ! else ! { ! lua_pushnumber(L, tag); // check for dupes since that's what we're trying to avoid ! lua_rawget(L, -2); ! // this must never happen ! if (!lua_isnil(L, -1)) wxFAIL_MSG(wxT("Trying to push userdata for object with same tag twice")); ! lua_pop(L, 1); // pop nil ! } ! ! lua_pushnumber(L, tag); ! lua_pushvalue(L, ABS_LUA_STKIDX(udata_stack_idx, 3)); // push the Lua userdata as the value (note: weak valued table) ! lua_rawset(L, -3); // t[key] = value; pops key and value ! lua_pop(L, 2); // pop weakobj table and obj table ! } ! ! bool LUACALL wxluaO_untrackweakobject(lua_State *L, void *obj_ptr) { lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (the object table) ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_rawget(L, -2); // get t[key] = value; pop key push value ! if (lua_istable(L, -1)) { + // clear the metatables for all the userdata since the object is gone! lua_pushnil(L); ! while (lua_next(L, -2) != 0) ! { ! // value = -1, key = -2, table = -3 ! lua_pushnil(L); ! lua_setmetatable(L, -2); // remove value's metatable ! lua_pop(L, 1); // pop value, leave key for next iteration ! } ! ! lua_pop(L, 1); // pop obj_ptr table ! ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_pushnil(L); // push value ! lua_rawset(L, -3); // set t[key] = nil; pops key and value ! lua_pop(L, 1); // pop objects table ! return true; } + else + lua_pop(L, 2); // pop nil and weakobj table ! return false; ! } ! ! bool LUACALL wxluaO_istrackedweakobject(lua_State *L, void *obj_ptr, int tag, bool push_on_stack) ! { ! lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (the obj table) ! ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_rawget(L, -2); // get t[key] value; pop key push value ! ! if (lua_istable(L, -1)) ! { ! lua_pushnumber(L, tag); // push key ! lua_rawget(L, -2); // get t[key] = value; pops key ! ! // check if they've dynamic casted the object or if it was casted in C++ ! if (wxlua_iswxuserdata(L, -1) && (tag == wxluaT_gettag(L, -1))) ! { ! if (push_on_stack) ! { ! lua_remove(L, -3); // remove the obj table, leave value on the stack ! lua_remove(L, -2); // remove table of userdata, leave value on the stack ! } ! else ! lua_pop(L, 3); ! ! return true; ! } ! } ! ! lua_pop(L, 2); // pop the table and the nil. ! return false; } *************** *** 1861,1865 **** // Delete all the wxObject data ! lua_pushlightuserdata(m_lua_State, &wxlua_lreg_delobjects_key); lua_rawget(m_lua_State, LUA_REGISTRYINDEX); --- 1931,1935 ---- // Delete all the wxObject data ! lua_pushlightuserdata(m_lua_State, &wxlua_lreg_gcobjects_key); lua_rawget(m_lua_State, LUA_REGISTRYINDEX); *************** *** 1877,1881 **** // remove table since we've deleted everything in it ! lua_pushlightuserdata(m_lua_State, &wxlua_lreg_delobjects_key); lua_newtable(m_lua_State); lua_rawset(m_lua_State, LUA_REGISTRYINDEX); --- 1947,1951 ---- // remove table since we've deleted everything in it ! lua_pushlightuserdata(m_lua_State, &wxlua_lreg_gcobjects_key); lua_newtable(m_lua_State); lua_rawset(m_lua_State, LUA_REGISTRYINDEX); *************** *** 2084,2098 **** // Use weak values so the gc works on them wxlua_lreg_createtable(L, &wxlua_lreg_weakobjects_key); - lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); - lua_rawget(L, LUA_REGISTRYINDEX); - lua_newtable(L); // metatable - lua_pushlstring(L, "__mode", 6); - lua_pushlstring(L, "v", 1); - lua_rawset(L, -3); // set mode of main table - lua_setmetatable(L, -2); // via the metatable - lua_pop(L, 1); // Create a table for objects to delete ! wxlua_lreg_createtable(L, &wxlua_lreg_delobjects_key); // Create a table for wxLuaCallbacks --- 2154,2160 ---- // Use weak values so the gc works on them wxlua_lreg_createtable(L, &wxlua_lreg_weakobjects_key); // Create a table for objects to delete ! wxlua_lreg_createtable(L, &wxlua_lreg_gcobjects_key); // Create a table for wxLuaCallbacks *************** *** 2683,2713 **** // memory tracking functions ! void wxLuaState::AddTrackedObject(wxObject *pObject) { ! AddTrackedObject(pObject, pObject); } ! void wxLuaState::AddTrackedObject(const void* obj_ptr, wxObject *pObject) { wxCHECK_RET(Ok() && pObject, wxT("Invalid wxLuaState or wxObject to track")); ! wxluaO_addtrackedobject(M_WXLSTATEDATA->m_lua_State, obj_ptr, pObject); } ! bool wxLuaState::RemoveTrackedObject(void *obj_ptr, int flags) { wxCHECK_MSG(Ok() && obj_ptr, false, wxT("Invalid wxLuaState or object")); ! return wxluaO_removetrackedobject(M_WXLSTATEDATA->m_lua_State, obj_ptr, flags); } ! bool wxLuaState::IsTrackedObject(void *obj_ptr) const { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! return wxluaO_istrackedobject(M_WXLSTATEDATA->m_lua_State, obj_ptr); } ! wxArrayString wxLuaState::GetTrackedObjectStrings() { wxCHECK_MSG(Ok(), wxArrayString(), wxT("Invalid wxLuaState")); ! return wxluaO_gettrackedobjectstrings(M_WXLSTATEDATA->m_lua_State); } --- 2745,2775 ---- // memory tracking functions ! void wxLuaState::AddGCObject(wxObject *pObject) { ! AddGCObject(pObject, pObject); } ! void wxLuaState::AddGCObject(const void* obj_ptr, wxObject *pObject) { wxCHECK_RET(Ok() && pObject, wxT("Invalid wxLuaState or wxObject to track")); ! wxluaO_addgcobject(M_WXLSTATEDATA->m_lua_State, obj_ptr, pObject); } ! bool wxLuaState::DeleteGCObject(void *obj_ptr, int flags) { wxCHECK_MSG(Ok() && obj_ptr, false, wxT("Invalid wxLuaState or object")); ! return wxluaO_deletegcobject(M_WXLSTATEDATA->m_lua_State, obj_ptr, flags); } ! bool wxLuaState::IsGCObject(void *obj_ptr) const { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! return wxluaO_isgcobject(M_WXLSTATEDATA->m_lua_State, obj_ptr); } ! wxArrayString wxLuaState::GetGCObjectStrings() { wxCHECK_MSG(Ok(), wxArrayString(), wxT("Invalid wxLuaState")); ! return wxluaO_getgcobjectstrings(M_WXLSTATEDATA->m_lua_State); } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** wxlbind.cpp 10 Dec 2007 05:39:10 -0000 1.103 --- wxlbind.cpp 13 Dec 2007 00:47:51 -0000 1.104 *************** *** 20,24 **** #include "wxlua/include/wxlstate.h" ! #include "wxluadebug/include/wxldebug.h" // for debugging only #include "wx/listimpl.cpp" --- 20,24 ---- #include "wxlua/include/wxlstate.h" ! //#include "wxluadebug/include/wxldebug.h" // for debugging only #include "wx/listimpl.cpp" *************** *** 564,567 **** --- 564,590 ---- // ---------------------------------------------------------------------------- + // Generic delete function for bindings + // ---------------------------------------------------------------------------- + + int LUACALL wxLua_wxluabind_delete(lua_State *L) + { + void* self = wxlua_touserdata(L, 1, false); + // if removed from tracked mem list, reset the tag so that gc() is not called on this object. + if ((self != NULL) && wxluaO_deletegcobject(L, self, wxLUA_DELETE_REMOVE_OBJECT)) + { + lua_pushnil(L); + lua_setmetatable(L, -2); + } + else + { + // leave this printf since we really want to know if this happens + wxPrintf(wxT("Unable to call wxuserdata:delete() on object %p\n"), self); + wxlua_error(L, wxString::Format(wxT("Unable to call wxuserdata:delete() on object %p"), self)); + } + + return 0; + } + + // ---------------------------------------------------------------------------- // If the class defines a gc function, then call it. // ---------------------------------------------------------------------------- *************** *** 575,583 **** void* key = wxlua_touserdata(L, 1, true); - //wxPrintf(wxT("__gcClass '%s' %p\n"), wxlState.GetLuaTagName(*wxlClass->class_tag).c_str(), key); - //wxCHECK_MSG(key != 0, 0, wxT("NULL user data in wxluabind_gc_wxLuaBindClass")); - // clean up the rest of this, this won't error if the key doesn't exist ! wxluaO_removetrackedobject(L, key, wxLUA_DELETE_CLEAR_OBJECT); } --- 598,603 ---- void* key = wxlua_touserdata(L, 1, true); // clean up the rest of this, this won't error if the key doesn't exist ! wxluaO_deletegcobject(L, key, wxLUA_DELETE_REMOVE_OBJECT); } Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** wxlcallb.cpp 10 Dec 2007 05:39:10 -0000 1.49 --- wxlcallb.cpp 13 Dec 2007 00:47:51 -0000 1.50 *************** *** 230,236 **** { // clear the metatable for the copy of the we are tracking (clears it for all copies too) ! wxluaO_cleartrackedmetatable(m_wxlState.GetLuaState(), m_window); // Now remove the object since it's gone ! m_wxlState.RemoveTrackedObject(m_window, wxLUA_CLEAR_TRACKED_OBJECT|wxLUA_CLEAR_DERIVED_METHODS); // Clear our own pointer to this window m_wxlState.RemoveTrackedWindow(m_window); --- 230,236 ---- { // clear the metatable for the copy of the we are tracking (clears it for all copies too) ! wxluaO_deletegcobject(m_wxlState.GetLuaState(), m_window, wxLUA_REMOVE_OBJECT); // Now remove the object since it's gone ! m_wxlState.DeleteGCObject(m_window, wxLUA_REMOVE_OBJECT); // Clear our own pointer to this window m_wxlState.RemoveTrackedWindow(m_window); Index: wxlua_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua_bind.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** wxlua_bind.cpp 10 Dec 2007 05:39:10 -0000 1.15 --- wxlua_bind.cpp 13 Dec 2007 00:47:52 -0000 1.16 *************** *** 749,762 **** static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedTopLevelWindows[1] = {{ wxLua_function_GetTrackedTopLevelWindows, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedUserData // %function LuaTable GetTrackedUserData() ! static int LUACALL wxLua_function_GetTrackedUserData(lua_State *L) { ! wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedObjectStrings()); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedUserData[1] = {{ wxLua_function_GetTrackedUserData, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; // %override wxLua_function_GetTrackedWindows --- 749,761 ---- static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedTopLevelWindows[1] = {{ wxLua_function_GetTrackedTopLevelWindows, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedUserdata // %function LuaTable GetTrackedUserData() ! static int LUACALL wxLua_function_GetTrackedUserdata(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectstrings(L)); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedUserdata[1] = {{ wxLua_function_GetTrackedUserdata, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; // %override wxLua_function_GetTrackedWindows *************** *** 890,894 **** { "GetTrackedEventCallbacks", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedEventCallbacks, 1, NULL }, { "GetTrackedTopLevelWindows", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedTopLevelWindows, 1, NULL }, ! { "GetTrackedUserData", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedUserData, 1, NULL }, { "GetTrackedWindows", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWindows, 1, NULL }, { "iswxluatype", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_iswxluatype, 1, NULL }, --- 889,893 ---- { "GetTrackedEventCallbacks", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedEventCallbacks, 1, NULL }, { "GetTrackedTopLevelWindows", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedTopLevelWindows, 1, NULL }, ! { "GetTrackedUserdata", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedUserdata, 1, NULL }, { "GetTrackedWindows", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWindows, 1, NULL }, { "iswxluatype", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_iswxluatype, 1, NULL }, |
From: John L. <jr...@us...> - 2007-12-13 00:47:59
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/modules/wxluadebug/include Modified Files: wxldebug.h wxlstack.h Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: wxldebug.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxldebug.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** wxldebug.h 4 Dec 2007 16:26:11 -0000 1.47 --- wxldebug.h 13 Dec 2007 00:47:52 -0000 1.48 *************** *** 27,35 **** enum wxLuaDebugItem_Type { ! WXLUA_DEBUGITEM_EXPANDABLE = 0x0200, // for wxLuaStackDialog ! WXLUA_DEBUGITEM_EXPANDED = 0x0400, // for wxLuaStackDialog ! WXLUA_DEBUGITEM_LUAREFED = 0x0800 // This item was created with a ! // new wxluaR_ref() reference ! // rather than using an existing one. }; --- 27,38 ---- enum wxLuaDebugItem_Type { ! WXLUA_DEBUGITEM_LOCALS = 0x0100, // This wxLuaDebugItem is the parent for local variables ! ! WXLUA_DEBUGITEM_EXPANDED = 0x0200, // for wxLuaStackDialog ! ! WXLUA_DEBUGITEM_IS_REFED = 0x1000, // This item was created with a new ! // wxluaR_ref() rather than using an existing one. ! WXLUA_DEBUGITEM_KEY_REF = 0x2000, // The ref is for the key ! WXLUA_DEBUGITEM_VALUE_REF = 0x4000, // The ref is for the value }; *************** *** 41,47 **** const wxString &itemValue, int itemValueType, const wxString &itemSource, ! int lua_ref, ! int idx = 0, ! int flag = 0); // The key has the typical meaning of the key in a Lua table --- 44,48 ---- const wxString &itemValue, int itemValueType, const wxString &itemSource, ! int lua_ref, int idx = 0, int flag = 0); // The key has the typical meaning of the key in a Lua table *************** *** 58,74 **** wxString GetSource() const { return m_itemSource; } ! int GetReference() const { return m_lua_ref; } // wxluaT_gettag() reference int GetIndex() const { return m_index; } // stack index or table level index int GetFlag() const { return m_flag; } // see wxLuaDebugItem_Type bool GetFlagBit(int mask) const { return WXLUA_HASBIT(m_flag, mask); } void SetFlag(int flag) { m_flag = flag; } void SetFlagBit(int bit, bool set) { m_flag = WXLUA_SETBIT(m_flag, bit, set); } ! void SetReference(int lua_ref) { m_lua_ref = lua_ref; } // only if you've wxluaR_unref()ed it // Get a human readable string for debugging wxString ToString() const { ! return wxString::Format(wxT("Key: '%s' KeyType: %d '%s' Value: '%s' ValueType: %d '%s' Ref: %d Idx: %d Flag: %d HasSrc: %d"), m_itemKey.c_str(), m_itemKeyType, GetKeyTypeString().c_str(), m_itemValue.c_str(), m_itemValueType, GetValueTypeString().c_str(), --- 59,80 ---- wxString GetSource() const { return m_itemSource; } ! int GetRef() const { return m_lua_ref; } // wxluaR_ref() reference int GetIndex() const { return m_index; } // stack index or table level index int GetFlag() const { return m_flag; } // see wxLuaDebugItem_Type bool GetFlagBit(int mask) const { return WXLUA_HASBIT(m_flag, mask); } + // If GetFlagBit(WXLUA_DEBUGITEM_KEY_REFED) try to convert GetKey() to a number + // else if GetFlagBit(WXLUA_DEBUGITEM_VALUE_REFED) try to convert GetValue() to a number + // Asserts if neither or both of the bits are set. + bool GetRefPtr(long& ptr) const; + void SetFlag(int flag) { m_flag = flag; } void SetFlagBit(int bit, bool set) { m_flag = WXLUA_SETBIT(m_flag, bit, set); } ! void SetRef(int lua_ref) { m_lua_ref = lua_ref; } // only if you've wxluaR_unref()ed it // Get a human readable string for debugging wxString ToString() const { ! return wxString::Format(wxT("Key: '%s' KeyType: %d '%s' Value: '%s' ValueType: %d '%s' Ref: %d Idx: %d Flag: %x HasSrc: %d"), m_itemKey.c_str(), m_itemKeyType, GetKeyTypeString().c_str(), m_itemValue.c_str(), m_itemValueType, GetValueTypeString().c_str(), *************** *** 155,159 **** // Ref this table if it hasn't been refed already, returns ref # or LUA_NOREF if not refed ! int RefTable(lua_State* L, int stack_idx, int* flag_type, wxArrayInt& references); // Sorting function for the wxLuaDebugItemArray, sorts by name --- 161,165 ---- // Ref this table if it hasn't been refed already, returns ref # or LUA_NOREF if not refed ! int RefTable(lua_State* L, int stack_idx, int* flag_type, int extra_flag, wxArrayInt& references); // Sorting function for the wxLuaDebugItemArray, sorts by name Index: wxlstack.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxlstack.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** wxlstack.h 7 Dec 2007 02:13:14 -0000 1.15 --- wxlstack.h 13 Dec 2007 00:47:52 -0000 1.16 *************** *** 145,148 **** --- 145,159 ---- }; + // Columns in the wxListCtrl + enum + { + LIST_COL_KEY, + LIST_COL_LEVEL, + LIST_COL_KEY_TYPE, + LIST_COL_VALUE_TYPE, + LIST_COL_VALUE + }; + + // Draw the string centered in the bitmap virtual wxBitmap CreateBmpString(const wxBitmap& bmp, const wxString& s); *************** *** 221,224 **** --- 232,236 ---- wxImageList* m_imageList; // image list for listctrl wxColour m_typeColours[IMG__COUNT]; + int m_img_font_size; bool m_show_dup_expand_msg; |
From: John L. <jr...@us...> - 2007-12-13 00:47:58
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/samples Modified Files: unittest.wx.lua Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: unittest.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/unittest.wx.lua,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** unittest.wx.lua 7 Dec 2007 02:13:16 -0000 1.17 --- unittest.wx.lua 13 Dec 2007 00:47:53 -0000 1.18 *************** *** 224,227 **** --- 224,249 ---- -- --------------------------------------------------------------------------- + print("\nTest wxObject::DynamicCast.\n") + -- --------------------------------------------------------------------------- + + a = wx.wxCommandEvent() + b = a:DynamicCast("wxObject") + PrintOk((a ~= b) and string.find(tostring(a), "wxCommandEvent", 1, 1) and string.find(tostring(b), "wxObject", 1, 1), + "wxObject::DynamicCast a wxCommandEvent to a wxObject") + + b = b:DynamicCast("wxCommandEvent") + PrintOk((a == b) and string.find(tostring(a), "wxCommandEvent", 1, 1) and string.find(tostring(b), "wxCommandEvent", 1, 1), + "wxObject::DynamicCast the wxObject back to a wxCommandEvent to get original userdata back") + + b = b:DynamicCast("wxCommandEvent") + PrintOk((a == b) and string.find(tostring(a), "wxCommandEvent", 1, 1) and string.find(tostring(b), "wxCommandEvent", 1, 1), + "wxObject::DynamicCast a wxCommandEvent to a wxCommandEvent to get same userdata back") + + b = b:DynamicCast("wxEvent") + b:delete() + PrintOk((a ~= b) and not (string.find(tostring(a), "wx", 1, 1) or string.find(tostring(b), "wx", 1, 1)), + "wxObject::DynamicCast a wxCommandEvent to a wxEvent then delete the wxEvent, both should be deleted") + + -- --------------------------------------------------------------------------- print("\nTest adding a methods to a class object userdata.\n") -- --------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-12-13 00:47:58
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15370/wxLua/modules/wxluasocket/src Modified Files: wxlsock.cpp wxluasocket.cpp Log Message: * Allowed using wxObject:DynamicCast() on an object and be able to use the object as both types. The problem was that wxEvent:GetEventObject() returned a wxObject which overwrote the wxWindow (perhaps) that you had as a userdata in Lua already. Additionally, if you delete an object all of the userdata that wrap it have their metatables cleared for safety. Functions renamed since they didn't do the same thing or behave the same. wxluaO_istrackedobject -> wxluaO_isgcobject wxluaO_addtrackedobject -> wxluaO_addgcobject wxluaO_removetrackedobject -> wxluaO_deletegcobject - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) wxLuaStackDialog: You can expand both key and values of a table and more information is provided about items wxLua knows about. Index: wxluasocket.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxluasocket.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** wxluasocket.cpp 10 Dec 2007 05:39:10 -0000 1.34 --- wxluasocket.cpp 13 Dec 2007 00:47:53 -0000 1.35 *************** *** 346,362 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerServer_delete[] = { &s_wxluatag_wxLuaDebuggerServer, NULL }; ! static int LUACALL wxLua_wxLuaDebuggerServer_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaDebuggerServer_delete[1] = {{ wxLua_wxLuaDebuggerServer_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaDebuggerServer_delete }}; ! static int LUACALL wxLua_wxLuaDebuggerServer_delete(lua_State *L) ! { ! wxLuaDebuggerServer * self = (wxLuaDebuggerServer *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaDebuggerServer); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerServer_constructor[] = { &s_wxluaarg_Number, NULL }; --- 346,350 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerServer_delete[] = { &s_wxluatag_wxLuaDebuggerServer, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaDebuggerServer_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaDebuggerServer_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerServer_constructor[] = { &s_wxluaarg_Number, NULL }; *************** *** 372,376 **** wxLuaDebuggerServer* returns = new wxLuaDebuggerServer(portNumber); // add to tracked memory list ! wxluaO_addtrackedobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaDebuggerServer, returns); --- 360,364 ---- wxLuaDebuggerServer* returns = new wxLuaDebuggerServer(portNumber); // add to tracked memory list ! wxluaO_addgcobject(L, returns); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxLuaDebuggerServer, returns); *************** *** 482,498 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerEvent_delete[] = { &s_wxluatag_wxLuaDebuggerEvent, NULL }; ! static int LUACALL wxLua_wxLuaDebuggerEvent_delete(lua_State *L); ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaDebuggerEvent_delete[1] = {{ wxLua_wxLuaDebuggerEvent_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaDebuggerEvent_delete }}; ! static int LUACALL wxLua_wxLuaDebuggerEvent_delete(lua_State *L) ! { ! wxLuaDebuggerEvent * self = (wxLuaDebuggerEvent *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaDebuggerEvent); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. ! if ((self != NULL) && wxluaO_removetrackedobject(L, self, wxLUA_DELETE_CLEAR_OBJECT)) ! { ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } ! return 0; ! } --- 470,474 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerEvent_delete[] = { &s_wxluatag_wxLuaDebuggerEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaDebuggerEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaDebuggerEvent_delete }}; Index: wxlsock.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxlsock.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** wxlsock.cpp 10 Dec 2007 05:39:10 -0000 1.33 --- wxlsock.cpp 13 Dec 2007 00:47:53 -0000 1.34 *************** *** 275,279 **** if (!ok) break; ! *(wxInt32 *) pMemory = (wxInt32)item->GetReference(); pMemory += sizeof(wxInt32); --- 275,279 ---- if (!ok) break; ! *(wxInt32 *) pMemory = (wxInt32)item->GetRef(); pMemory += sizeof(wxInt32); |
From: John L. <jr...@us...> - 2007-12-11 15:21:17
|
Update of /cvsroot/wxlua/website In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv5680/website Modified Files: luasample.lua luasample.lua.html Log Message: Use wx.NULL not wx.wxNull Index: luasample.lua =================================================================== RCS file: /cvsroot/wxlua/website/luasample.lua,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** luasample.lua 20 Dec 2006 12:04:10 -0000 1.4 --- luasample.lua 11 Dec 2007 15:21:08 -0000 1.5 *************** *** 1,3 **** ! frame = wx.wxFrame(wx.wxNull, wx.wxID_ANY, "wxLua Minimal Demo", wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE) --- 1,3 ---- ! frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Minimal Demo", wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE) Index: luasample.lua.html =================================================================== RCS file: /cvsroot/wxlua/website/luasample.lua.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** luasample.lua.html 20 Dec 2006 12:04:10 -0000 1.4 --- luasample.lua.html 11 Dec 2007 15:21:08 -0000 1.5 *************** *** 1,3 **** ! <pre><tt>frame <span style="color: #990000">=</span> wx<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">wxFrame</span></span><span style="color: #990000">(</span>wx<span style="color: #990000">.</span>wxNull<span style="color: #990000">,</span> wx<span style="color: #990000">.</span>wxID_ANY<span style="color: #990000">,</span> <span style="color: #FF0000">"wxLua Minimal Demo"</span><span style="color: #990000">,</span> wx<span style="color: #990000">.</span>wxDefaultPosition<span style="color: #990000">,</span> wx<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">wxSize</span></span><span style="color: #990000">(</span><span style="color: #993399">450</span><span style="color: #990000">,</span> <span style="color: #993399">450</span><span style="color: #990000">)</span><span style="color: #990000">,</span> wx<span style="color: #990000">.</span>wxDEFAULT_FRAME_STYLE<span style="color: #990000">)</span> --- 1,3 ---- ! <pre><tt>frame <span style="color: #990000">=</span> wx<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">wxFrame</span></span><span style="color: #990000">(</span>wx<span style="color: #990000">.</span>NULL<span style="color: #990000">,</span> wx<span style="color: #990000">.</span>wxID_ANY<span style="color: #990000">,</span> <span style="color: #FF0000">"wxLua Minimal Demo"</span><span style="color: #990000">,</span> wx<span style="color: #990000">.</span>wxDefaultPosition<span style="color: #990000">,</span> wx<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">wxSize</span></span><span style="color: #990000">(</span><span style="color: #993399">450</span><span style="color: #990000">,</span> <span style="color: #993399">450</span><span style="color: #990000">)</span><span style="color: #990000">,</span> wx<span style="color: #990000">.</span>wxDEFAULT_FRAME_STYLE<span style="color: #990000">)</span> |
From: John L. <jr...@us...> - 2007-12-10 23:20:51
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15373/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: Allow browsing userdata's metatables in wxLuaStackDialog and give more info about wxLua's structs Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wxlstack.cpp 10 Dec 2007 05:39:10 -0000 1.26 --- wxlstack.cpp 10 Dec 2007 23:20:19 -0000 1.27 *************** *** 624,628 **** int img = GetItemImage(debugItem); ! if ((img == IMG_TABLE) || (img == IMG_TABLE_OPEN)) { wxTreeItemId id = m_treeCtrl->AppendItem(treeId, debugItem->GetKey(), -1, -1, new wxLuaStackTreeData(stkListData)); --- 624,628 ---- int img = GetItemImage(debugItem); ! if (debugItem->GetReference() != LUA_NOREF) { wxTreeItemId id = m_treeCtrl->AppendItem(treeId, debugItem->GetKey(), -1, -1, new wxLuaStackTreeData(stkListData)); Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** wxldebug.cpp 10 Dec 2007 05:39:10 -0000 1.57 --- wxldebug.cpp 10 Dec 2007 23:20:19 -0000 1.58 *************** *** 243,246 **** --- 243,256 ---- } + wxString wxLuaBindClassString(wxLuaBindClass* wxlClass) + { + wxCHECK_MSG(wxlClass, wxEmptyString, wxT("Invalid wxLuaBindClass")); + return wxString::Format(wxT(" (%s, tag=%d, classinfo=%s, baseclass=%s, methods=%d, enums=%d)"), + lua2wx(wxlClass->name).c_str(), *wxlClass->class_tag, + wxString(wxlClass->classInfo ? wxlClass->classInfo->GetClassName() : wxEmptyString).c_str(), + lua2wx(wxlClass->baseclassName).c_str(), + wxlClass->methods_n, wxlClass->enums_n); + } + int wxLuaDebugData::EnumerateTable(const wxLuaState& wxlState_, int tableRef, int nIndex, wxArrayInt& references) { *************** *** 259,263 **** if ((tableRef == -1) || (tableRef == LUA_GLOBALSINDEX)) { ! wxlState.GetGlobals(); GetTypeValue(wxlState, -1, &wxl_valuetype, value); --- 269,273 ---- if ((tableRef == -1) || (tableRef == LUA_GLOBALSINDEX)) { ! lua_pushvalue(L, LUA_GLOBALSINDEX); GetTypeValue(wxlState, -1, &wxl_valuetype, value); *************** *** 270,274 **** else if (tableRef == LUA_REGISTRYINDEX) { ! wxlState.lua_PushValue(LUA_REGISTRYINDEX); GetTypeValue(wxlState, -1, &wxl_valuetype, value); --- 280,284 ---- else if (tableRef == LUA_REGISTRYINDEX) { ! lua_pushvalue(L, LUA_REGISTRYINDEX); GetTypeValue(wxlState, -1, &wxl_valuetype, value); *************** *** 282,287 **** { // push the table onto the stack to iterate through ! if (wxlState.wxluaR_GetRef(tableRef, &wxlua_lreg_debug_refs_key)) { // Check to see if this is a wxLua LUA_REGISTRYINDEX table void *lightuserdata_reg_key = NULL; --- 292,305 ---- { // push the table onto the stack to iterate through ! if (wxluaR_getref(L, tableRef, &wxlua_lreg_debug_refs_key)) { + if (lua_isnil(L, -1)) + { + // assert so we don't crash mysteriously inside Lua on nil + lua_pop(L, 1); // pop nil + wxFAIL_MSG(wxT("Invalid wxLua debug reference")); + return count; + } + // Check to see if this is a wxLua LUA_REGISTRYINDEX table void *lightuserdata_reg_key = NULL; *************** *** 293,297 **** lua_pop(L, 2); // pop wxlua_lreg_regtable_key table and (nil or lightuserdata) ! // Check if it has a metatable if (lua_getmetatable(L, -1)) // if no metatable then nothing is pushed { --- 311,315 ---- lua_pop(L, 2); // pop wxlua_lreg_regtable_key table and (nil or lightuserdata) ! // Check if the table/userdata has a metatable if (lua_getmetatable(L, -1)) // if no metatable then nothing is pushed { *************** *** 310,313 **** --- 328,333 ---- // start iterating + if (lua_istable(L, -1)) + { lua_pushnil(L); while (lua_next(L, -2) != 0) *************** *** 315,322 **** // value at -1, key at -2, table at -3 ! // get the index, just want the name=value, type is dummy here ! GetTypeValue(wxlState, -2, &wxl_keytype, name); ! // get the type and value ! GetTypeValue(wxlState, -1, &wxl_valuetype, value); // Handle wxLua LUA_REGISTRYINDEX tables to give more information --- 335,342 ---- // value at -1, key at -2, table at -3 ! // get the key type and value ! int lua_key_type = GetTypeValue(wxlState, -2, &wxl_keytype, name); ! // get the value type and value ! int lua_value_type = GetTypeValue(wxlState, -1, &wxl_valuetype, value); // Handle wxLua LUA_REGISTRYINDEX tables to give more information *************** *** 327,330 **** --- 347,355 ---- value += wxT(" (") + wxluaT_gettagname(L, (int)lua_tonumber(L, -2)) + wxT(")"); } + else if (lightuserdata_reg_key == &wxlua_lreg_classes_key) + { + wxLuaBindClass* wxlClass = (wxLuaBindClass*)lua_touserdata(L, -1); + value += wxLuaBindClassString(wxlClass); + } else if (lightuserdata_reg_key == &wxlua_lreg_evtcallbacks_key) { *************** *** 359,367 **** } int flag_type = 0; int nRef = LUA_NOREF; // don't ref anything in this table since it's already refed ! if (lightuserdata_reg_key != &wxlua_lreg_debug_refs_key) nRef = RefTable(L, -1, &flag_type, references); Add(new wxLuaDebugItem(name, wxl_keytype, value, wxl_valuetype, wxT(""), nRef, nIndex, flag_type)); --- 384,416 ---- } + // For these keys we know what is in the value to give more information + if (lua_key_type == LUA_TLIGHTUSERDATA) + { + void* key = lua_touserdata(L, -2); + + if (key == &wxlua_metatable_tag_key) + { + value += wxT(" (") + wxluaT_gettagname(L, (int)lua_tonumber(L, -1)) + wxT(")"); + } + else if (key == &wxlua_metatable_wxluabindclass_key) + { + wxLuaBindClass* wxlClass = (wxLuaBindClass*)lua_touserdata(L, -1); + value += wxLuaBindClassString(wxlClass); + } + } + int flag_type = 0; int nRef = LUA_NOREF; // don't ref anything in this table since it's already refed ! if ((lua_value_type == LUA_TTABLE) && (lightuserdata_reg_key != &wxlua_lreg_debug_refs_key)) nRef = RefTable(L, -1, &flag_type, references); + else if (lua_value_type == LUA_TUSERDATA) + { + if (lua_getmetatable(L, -1)) // doesn't push anything if nil + { + nRef = RefTable(L, -1, &flag_type, references); + lua_pop(L, 1); + } + } Add(new wxLuaDebugItem(name, wxl_keytype, value, wxl_valuetype, wxT(""), nRef, nIndex, flag_type)); *************** *** 370,373 **** --- 419,423 ---- lua_pop(L, 1); // pop value, leave key } + } lua_pop(L, 1); // remove reference *************** *** 383,387 **** int nRef = LUA_NOREF; ! if (lua_istable(L, stack_idx)) { //nRef = wxluaR_isrefed(L, stack_idx, &wxlua_lreg_debug_refs_key); // don't duplicate refs --- 433,437 ---- int nRef = LUA_NOREF; ! //if (lua_istable(L, stack_idx)) { //nRef = wxluaR_isrefed(L, stack_idx, &wxlua_lreg_debug_refs_key); // don't duplicate refs *************** *** 532,536 **** { const char* ss = *(const char**)udata; ! s += wxString::Format(wxT(" : %s"), lua2wx(ss).c_str()); } } --- 582,586 ---- { const char* ss = *(const char**)udata; ! s += wxT(" (") + lua2wx(ss) + wxT(")"); } } |
From: John L. <jr...@us...> - 2007-12-10 05:39:42
|
Update of /cvsroot/wxlua/wxLua/modules/lua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23281/wxLua/modules/lua/src Modified Files: lapi.c lstrlib.c ltablib.c lua.c Log Message: genwxbind.lua - don't create "returns" variable before use to save a line of code. Applied Lua patches for 5.1.2 8-11 Added wxlua_lreg_createtable(..) to create the LUA_REGISTRYINDEX tables for wxLua Added wxlua_lreg_regtable_key in LUA_REGISTRYINDEX to help the wxLuaDebugData find wxLua's tables faster to give more information Index: lstrlib.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lstrlib.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lstrlib.c 25 Apr 2007 02:52:20 -0000 1.3 --- lstrlib.c 10 Dec 2007 05:39:05 -0000 1.4 *************** *** 630,637 **** break; } - default: { - luaL_argerror(L, 3, "string/function/table expected"); - return; - } } if (!lua_toboolean(L, -1)) { /* nil or false? */ --- 630,633 ---- *************** *** 640,644 **** } else if (!lua_isstring(L, -1)) ! luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); luaL_addvalue(b); /* add result to accumulator */ } --- 636,640 ---- } else if (!lua_isstring(L, -1)) ! luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); luaL_addvalue(b); /* add result to accumulator */ } *************** *** 649,652 **** --- 645,649 ---- const char *src = luaL_checklstring(L, 1, &srcl); const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); int max_s = luaL_optint(L, 4, srcl+1); int anchor = (*p == '^') ? (p++, 1) : 0; *************** *** 654,657 **** --- 651,657 ---- MatchState ms; luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); luaL_buffinit(L, &b); ms.L = L; Index: lapi.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lapi.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lapi.c 12 Jun 2006 03:50:37 -0000 1.3 --- lapi.c 10 Dec 2007 05:39:05 -0000 1.4 *************** *** 208,212 **** if (idx == LUA_ENVIRONINDEX) { Closure *func = curr_func(L); ! api_check(L, ttistable(L->top - 1)); func->c.env = hvalue(L->top - 1); luaC_barrier(L, func, L->top - 1); --- 208,212 ---- if (idx == LUA_ENVIRONINDEX) { Closure *func = curr_func(L); ! api_check(L, ttistable(L->top - 1)); func->c.env = hvalue(L->top - 1); luaC_barrier(L, func, L->top - 1); *************** *** 750,754 **** break; } ! luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); L->top--; lua_unlock(L); --- 750,754 ---- break; } ! if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); L->top--; lua_unlock(L); *************** *** 768,772 **** #define checkresults(L,na,nr) \ api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) ! LUA_API void lua_call (lua_State *L, int nargs, int nresults) { --- 768,772 ---- #define checkresults(L,na,nr) \ api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) ! LUA_API void lua_call (lua_State *L, int nargs, int nresults) { Index: ltablib.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/ltablib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ltablib.c 29 Mar 2006 06:00:00 -0000 1.1 --- ltablib.c 10 Dec 2007 05:39:05 -0000 1.2 *************** *** 119,123 **** int e = aux_getn(L, 1); int pos = luaL_optint(L, 2, e); ! if (e == 0) return 0; /* table is `empty' */ luaL_setn(L, 1, e - 1); /* t.n = n-1 */ lua_rawgeti(L, 1, pos); /* result = t[pos] */ --- 119,124 ---- int e = aux_getn(L, 1); int pos = luaL_optint(L, 2, e); ! if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ ! return 0; /* nothing to remove */ luaL_setn(L, 1, e - 1); /* t.n = n-1 */ lua_rawgeti(L, 1, pos); /* result = t[pos] */ Index: lua.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lua.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lua.c 12 Jun 2006 03:50:38 -0000 1.2 --- lua.c 10 Dec 2007 05:39:05 -0000 1.3 *************** *** 145,149 **** lua_getglobal(L, "require"); lua_pushstring(L, name); ! return report(L, lua_pcall(L, 1, 0, 0)); } --- 145,149 ---- lua_getglobal(L, "require"); lua_pushstring(L, name); ! return report(L, docall(L, 1, 1)); } *************** *** 241,245 **** lua_setglobal(L, "arg"); fname = argv[n]; ! if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) fname = NULL; /* stdin */ status = luaL_loadfile(L, fname); --- 241,245 ---- lua_setglobal(L, "arg"); fname = argv[n]; ! if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) fname = NULL; /* stdin */ status = luaL_loadfile(L, fname); *************** *** 248,252 **** status = docall(L, narg, 0); else ! lua_pop(L, narg); return report(L, status); } --- 248,252 ---- status = docall(L, narg, 0); else ! lua_pop(L, narg); return report(L, status); } |
From: John L. <jr...@us...> - 2007-12-10 05:39:42
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23281/wxLua/bindings Modified Files: genwxbind.lua Log Message: genwxbind.lua - don't create "returns" variable before use to save a line of code. Applied Lua patches for 5.1.2 8-11 Added wxlua_lreg_createtable(..) to create the LUA_REGISTRYINDEX tables for wxLua Added wxlua_lreg_regtable_key in LUA_REGISTRYINDEX to help the wxLuaDebugData find wxLua's tables faster to give more information Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** genwxbind.lua 7 Dec 2007 06:44:41 -0000 1.152 --- genwxbind.lua 10 Dec 2007 05:39:04 -0000 1.153 *************** *** 3490,3494 **** memberCast = origMemberTypeWithAttrib else ! memberTypeWithAttrib = memberTypeWithAttrib.." "..returnPtr end --- 3490,3494 ---- memberCast = origMemberTypeWithAttrib else ! memberTypeWithAttrib = memberTypeWithAttrib..returnPtr end *************** *** 3498,3506 **** end ! if memberTypeWithAttrib == "voidptr_long " then memberTypeWithAttrib = "long " end - - table.insert(codeList, " "..memberTypeWithAttrib.."returns;\n") end --- 3498,3504 ---- end ! if string.find("voidptr_long", memberTypeWithAttrib, 1, 1) then memberTypeWithAttrib = "long " end end *************** *** 3554,3558 **** if member.IsConstructor then CommentBindingTable(codeList, " // call constructor\n") ! table.insert(codeList, " returns = new "..parseObject.Name.."("..argList..");\n") if parseObject["%gc_this"] or (parseObject["%delete"] and (not parseObject["%ungc_this"])) then --- 3552,3556 ---- if member.IsConstructor then CommentBindingTable(codeList, " // call constructor\n") ! table.insert(codeList, " "..memberTypeWithAttrib.." returns = new "..parseObject.Name.."("..argList..");\n") if parseObject["%gc_this"] or (parseObject["%delete"] and (not parseObject["%ungc_this"])) then *************** *** 3642,3650 **** -- call function, get return value if member["%operator"] and origMemberPtr and string.find(origMemberPtr, "&", 1, 1) then ! table.insert(codeList, " returns = self;\n") table.insert(codeList, " *returns = ("..functor..");\n") elseif (not numeric) and (not memberPtr) then CommentBindingTable(codeList, " // allocate a new object using the copy constructor\n") ! table.insert(codeList, " returns = new "..memberType.."("..functor..");\n") CommentBindingTable(codeList, " // add the new object to the tracked memory list\n") --- 3640,3648 ---- -- call function, get return value if member["%operator"] and origMemberPtr and string.find(origMemberPtr, "&", 1, 1) then ! table.insert(codeList, " "..memberTypeWithAttrib.." returns = self;\n") table.insert(codeList, " *returns = ("..functor..");\n") elseif (not numeric) and (not memberPtr) then CommentBindingTable(codeList, " // allocate a new object using the copy constructor\n") ! table.insert(codeList, " "..memberTypeWithAttrib.." returns = new "..memberType.."("..functor..");\n") CommentBindingTable(codeList, " // add the new object to the tracked memory list\n") *************** *** 3662,3668 **** elseif (not member["%operator"]) and (memberPtr == "&") and (memberType ~= "wxString") then ! table.insert(codeList, " returns = &"..functor..";\n") elseif (memberPtr == "*") or (memberType == "voidptr_long") then ! table.insert(codeList, " returns = ("..memberTypeWithAttrib..")"..functor..";\n") if member.GC then --- 3660,3666 ---- elseif (not member["%operator"]) and (memberPtr == "&") and (memberType ~= "wxString") then ! table.insert(codeList, " "..memberTypeWithAttrib.." returns = &"..functor..";\n") elseif (memberPtr == "*") or (memberType == "voidptr_long") then ! table.insert(codeList, " "..memberTypeWithAttrib.." returns = ("..memberTypeWithAttrib..")"..functor..";\n") if member.GC then *************** *** 3677,3681 **** else ! table.insert(codeList, " returns = ("..functor..");\n") end --- 3675,3679 ---- else ! table.insert(codeList, " "..memberTypeWithAttrib.." returns = ("..functor..");\n") end *************** *** 4070,4073 **** --- 4068,4082 ---- table.insert(fileData, "\n") + table.insert(fileData, "// ---------------------------------------------------------------------------\n") + table.insert(fileData, "// Functions to access wxLuaBindXXX structs\n") + table.insert(fileData, "// ---------------------------------------------------------------------------\n\n") + + table.insert(fileData, "extern wxLuaBindClass *"..hook_cpp_class_funcname.."(size_t &count);\n") + table.insert(fileData, "extern wxLuaBindDefine *"..hook_cpp_define_funcname.."(size_t &count);\n") + table.insert(fileData, "extern wxLuaBindString *"..hook_cpp_string_funcname.."(size_t &count);\n") + table.insert(fileData, "extern wxLuaBindEvent *"..hook_cpp_event_funcname.."(size_t &count);\n") + table.insert(fileData, "extern wxLuaBindObject *"..hook_cpp_object_funcname.."(size_t &count);\n") + table.insert(fileData, "extern wxLuaBindMethod *"..hook_cpp_function_funcname.."(size_t &count);\n\n") + -- ------------------------------------------------------------------------ -- Class Tag Declaration - sorted by condition for the C++ compiler *************** *** 4103,4107 **** end ! table.insert(fileData, "\n\n") -- ------------------------------------------------------------------------ --- 4112,4116 ---- end ! table.insert(fileData, "\n") -- ------------------------------------------------------------------------ *************** *** 4202,4208 **** table.insert(fileData, " count = sizeof(classList)/sizeof(wxLuaBindClass) - 1;\n\n") table.insert(fileData, " return classList;\n") ! table.insert(fileData, "}\n") ! ! table.insert(fileData, "\n\n") table.insert(fileData, "// ---------------------------------------------------------------------------\n") --- 4211,4215 ---- table.insert(fileData, " count = sizeof(classList)/sizeof(wxLuaBindClass) - 1;\n\n") table.insert(fileData, " return classList;\n") ! table.insert(fileData, "}\n\n") table.insert(fileData, "// ---------------------------------------------------------------------------\n") *************** *** 4214,4227 **** end ! table.insert(fileData, "// binding class\n") ! table.insert(fileData, "extern wxLuaBindClass *"..hook_cpp_class_funcname.."(size_t &count);\n") ! table.insert(fileData, "extern wxLuaBindDefine *"..hook_cpp_define_funcname.."(size_t &count);\n") ! table.insert(fileData, "extern wxLuaBindString *"..hook_cpp_string_funcname.."(size_t &count);\n") ! table.insert(fileData, "extern wxLuaBindEvent *"..hook_cpp_event_funcname.."(size_t &count);\n") ! table.insert(fileData, "extern wxLuaBindObject *"..hook_cpp_object_funcname.."(size_t &count);\n") ! table.insert(fileData, "extern wxLuaBindMethod *"..hook_cpp_function_funcname.."(size_t &count);\n") ! table.insert(fileData, "\n\n") ! table.insert(fileData, "IMPLEMENT_DYNAMIC_CLASS("..hook_cpp_binding_classname..", wxLuaBinding)\n") ! table.insert(fileData, "\n") table.insert(fileData, ""..hook_cpp_binding_classname.."::"..hook_cpp_binding_classname.."() : wxLuaBinding()\n") table.insert(fileData, "{\n") --- 4221,4225 ---- end ! table.insert(fileData, "IMPLEMENT_DYNAMIC_CLASS("..hook_cpp_binding_classname..", wxLuaBinding)\n\n") table.insert(fileData, ""..hook_cpp_binding_classname.."::"..hook_cpp_binding_classname.."() : wxLuaBinding()\n") table.insert(fileData, "{\n") *************** *** 4235,4240 **** table.insert(fileData, " m_functionArray = "..hook_cpp_function_funcname.."(m_functionCount);\n") table.insert(fileData, " InitBinding();\n") ! table.insert(fileData, "}\n") ! table.insert(fileData, "\n") -- load preregister fn from rules file --- 4233,4237 ---- table.insert(fileData, " m_functionArray = "..hook_cpp_function_funcname.."(m_functionCount);\n") table.insert(fileData, " InitBinding();\n") ! table.insert(fileData, "}\n\n") -- load preregister fn from rules file *************** *** 4255,4263 **** table.insert(fileData, "{\n") table.insert(fileData, wxLuaBinding_PostRegister or "") ! table.insert(fileData, "}\n") ! table.insert(fileData, "\n\n") - table.insert(fileData, "// bind "..hook_cpp_binding_classname.." to a single wxLuaState\n") table.insert(fileData, "bool "..hook_cpp_binding_classname.."_bind(const wxLuaState& wxlState_)\n") table.insert(fileData, "{\n") --- 4252,4259 ---- table.insert(fileData, "{\n") table.insert(fileData, wxLuaBinding_PostRegister or "") ! table.insert(fileData, "}\n\n") ! table.insert(fileData, "// ---------------------------------------------------------------------------\n\n") table.insert(fileData, "bool "..hook_cpp_binding_classname.."_bind(const wxLuaState& wxlState_)\n") table.insert(fileData, "{\n") *************** *** 4275,4281 **** table.insert(fileData, "\n") table.insert(fileData, " return true;\n") ! table.insert(fileData, "}\n") - table.insert(fileData, "// initialize "..hook_cpp_binding_classname.." for all wxLuaStates\n") table.insert(fileData, "bool "..hook_cpp_binding_classname.."_init()\n") table.insert(fileData, "{\n") --- 4271,4276 ---- table.insert(fileData, "\n") table.insert(fileData, " return true;\n") ! table.insert(fileData, "}\n\n") table.insert(fileData, "bool "..hook_cpp_binding_classname.."_init()\n") table.insert(fileData, "{\n") |
From: John L. <jr...@us...> - 2007-12-10 05:39:40
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23281/wxLua/modules/wxbind/include Modified Files: wxadv_bind.h wxaui_bind.h wxbase_bind.h wxcore_bind.h wxcore_wxlprint.h wxgl_bind.h wxhtml_bind.h wxmedia_bind.h wxnet_bind.h wxrichtext_bind.h wxstc_bind.h wxxml_bind.h wxxrc_bind.h Log Message: genwxbind.lua - don't create "returns" variable before use to save a line of code. Applied Lua patches for 5.1.2 8-11 Added wxlua_lreg_createtable(..) to create the LUA_REGISTRYINDEX tables for wxLua Added wxlua_lreg_regtable_key in LUA_REGISTRYINDEX to help the wxLuaDebugData find wxLua's tables faster to give more information Index: wxadv_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxadv_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxadv_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxadv_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 109,112 **** --- 109,123 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxadv(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxadv(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxadv(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxadv(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxadv(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxadv(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 324,328 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 335,338 ---- Index: wxcore_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxcore_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxcore_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxcore_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 522,525 **** --- 522,536 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxcore(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxcore(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxcore(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxcore(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxcore(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxcore(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 1097,1100 **** --- 1108,1114 ---- extern WXDLLIMPEXP_BINDWXCORE wxLuaBindMethod wxArtProvider_methods[]; extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxArtProvider_methodCount; + extern WXDLLIMPEXP_DATA_BINDWXCORE(int) s_wxluatag_wxLuaArtProvider; + extern WXDLLIMPEXP_BINDWXCORE wxLuaBindMethod wxLuaArtProvider_methods[]; + extern WXDLLIMPEXP_DATA_BINDWXCORE(int) wxLuaArtProvider_methodCount; #endif // wxLUA_USE_wxArtProvider *************** *** 1806,1810 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 1820,1823 ---- Index: wxrichtext_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxrichtext_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxrichtext_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxrichtext_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 52,58 **** // --------------------------------------------------------------------------- ! // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- --- 52,68 ---- // --------------------------------------------------------------------------- ! // Functions to access wxLuaBindXXX structs // --------------------------------------------------------------------------- + extern wxLuaBindClass *wxLuaGetClassList_wxrichtext(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxrichtext(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxrichtext(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxrichtext(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxrichtext(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxrichtext(size_t &count); + + // --------------------------------------------------------------------------- + // Lua Tag Method Values and Tables for each Class + // --------------------------------------------------------------------------- Index: wxxrc_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxxrc_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxxrc_bind.h 7 Dec 2007 02:13:11 -0000 1.6 --- wxxrc_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 56,59 **** --- 56,70 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxxrc(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxxrc(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxxrc(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxxrc(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxxrc(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxxrc(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 66,70 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 77,80 ---- Index: wxnet_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxnet_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxnet_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxnet_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 73,76 **** --- 73,87 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxnet(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxnet(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxnet(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxnet(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxnet(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxnet(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 130,134 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 141,144 ---- Index: wxbase_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxbase_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxbase_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxbase_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 155,158 **** --- 155,169 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxbase(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxbase(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxbase(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxbase(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxbase(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxbase(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 423,427 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 434,437 ---- Index: wxmedia_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxmedia_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxmedia_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxmedia_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 57,60 **** --- 57,71 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxmedia(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxmedia(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxmedia(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxmedia(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxmedia(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxmedia(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 70,74 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 81,84 ---- Index: wxcore_wxlprint.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxcore_wxlprint.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxcore_wxlprint.h 17 Jul 2007 23:09:17 -0000 1.2 --- wxcore_wxlprint.h 10 Dec 2007 05:39:06 -0000 1.3 *************** *** 60,62 **** --- 60,88 ---- #endif //wxLUA_USE_wxLuaPrintout + + #if wxLUA_USE_wxArtProvider + + #include "wx/artprov.h" + + class WXDLLIMPEXP_BINDWXCORE wxLuaArtProvider : public wxArtProvider + { + public: + wxLuaArtProvider(const wxLuaState& wxlState); + + // Get the default size of an icon for a specific client + virtual wxSize DoGetSizeHint(const wxArtClient& client); + + // Derived classes must override this method to create requested + // art resource. This method is called only once per instance's + // lifetime for each requested wxArtID. + virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size); + + private: + wxLuaState m_wxlState; + + DECLARE_ABSTRACT_CLASS(wxLuaArtProvider) + }; + + #endif // wxLUA_USE_wxArtProvider + #endif //WX_LUA_PRINTING_H Index: wxgl_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxgl_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxgl_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxgl_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 56,59 **** --- 56,70 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxgl(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxgl(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxgl(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxgl(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxgl(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxgl(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 69,73 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 80,83 ---- Index: wxstc_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxstc_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxstc_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxstc_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 54,57 **** --- 54,68 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxstc(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxstc(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxstc(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxstc(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxstc(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxstc(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 65,69 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 76,79 ---- Index: wxaui_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxaui_bind.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxaui_bind.h 7 Dec 2007 02:13:10 -0000 1.7 --- wxaui_bind.h 10 Dec 2007 05:39:06 -0000 1.8 *************** *** 56,59 **** --- 56,70 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxaui(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxaui(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxaui(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxaui(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxaui(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxaui(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 133,137 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 144,147 ---- Index: wxhtml_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxhtml_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxhtml_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxhtml_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 74,77 **** --- 74,88 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxhtml(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxhtml(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxhtml(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxhtml(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxhtml(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxhtml(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 152,156 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 163,166 ---- Index: wxxml_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxxml_bind.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxxml_bind.h 7 Dec 2007 02:13:10 -0000 1.6 --- wxxml_bind.h 10 Dec 2007 05:39:06 -0000 1.7 *************** *** 56,59 **** --- 56,70 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxxml(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxxml(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxxml(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxxml(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxxml(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxxml(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 72,76 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 83,86 ---- |
From: John L. <jr...@us...> - 2007-12-10 05:39:40
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23281/wxLua/bindings/wxwidgets Modified Files: wx_datatypes.lua wxadv_adv.i wxadv_override.hpp wxbase_file.i wxbase_override.hpp wxcore_appframe.i wxcore_image.i wxcore_menutool.i wxcore_override.hpp wxcore_print.i wxhtml_override.hpp wxstc_override.hpp wxxml_override.hpp Log Message: genwxbind.lua - don't create "returns" variable before use to save a line of code. Applied Lua patches for 5.1.2 8-11 Added wxlua_lreg_createtable(..) to create the LUA_REGISTRYINDEX tables for wxLua Added wxlua_lreg_regtable_key in LUA_REGISTRYINDEX to help the wxLuaDebugData find wxLua's tables faster to give more information Index: wxbase_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_override.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxbase_override.hpp 7 Dec 2007 06:44:41 -0000 1.8 --- wxbase_override.hpp 10 Dec 2007 05:39:05 -0000 1.9 *************** *** 14,18 **** static int LUACALL wxLua_function_wxGetOsVersion(lua_State *L) { - int returns; // int *minor = NULL int minor= 0; --- 14,17 ---- *************** *** 20,24 **** int major = 0; // call wxGetOsVersion ! returns = wxGetOsVersion(&major, &minor); // push the result numbers lua_pushnumber(L, returns); --- 19,23 ---- int major = 0; // call wxGetOsVersion ! int returns = wxGetOsVersion(&major, &minor); // push the result numbers lua_pushnumber(L, returns); *************** *** 34,42 **** static int LUACALL wxLua_function_wxGetEnv(lua_State *L) { - bool returns; wxString var = wxlua_getwxStringtype(L, 1); wxString value; // call wxGetEnv ! returns = wxGetEnv(var, &value); // push the result number lua_pushboolean(L, returns); --- 33,40 ---- static int LUACALL wxLua_function_wxGetEnv(lua_State *L) { wxString var = wxlua_getwxStringtype(L, 1); wxString value; // call wxGetEnv ! bool returns = wxGetEnv(var, &value); // push the result number lua_pushboolean(L, returns); *************** *** 51,57 **** static int LUACALL wxLua_wxStandardPaths_Get(lua_State *L) { - wxStandardPathsBase *returns; // call Get ! returns = &wxStandardPaths::Get(); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxStandardPaths, returns); --- 49,54 ---- static int LUACALL wxLua_wxStandardPaths_Get(lua_State *L) { // call Get ! wxStandardPathsBase *returns = &wxStandardPaths::Get(); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxStandardPaths, returns); *************** *** 65,69 **** static int LUACALL wxLua_wxRegEx_GetMatchIndexes(lua_State *L) { - bool returns; // get number of arguments int argCount = lua_gettop(L); --- 62,65 ---- *************** *** 77,81 **** wxRegEx *self = (wxRegEx *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRegEx); // call GetMatch ! returns = self->GetMatch(&start, &len, index); // push the result number lua_pushboolean(L, returns); --- 73,77 ---- wxRegEx *self = (wxRegEx *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRegEx); // call GetMatch ! bool returns = self->GetMatch(&start, &len, index); // push the result number lua_pushboolean(L, returns); *************** *** 92,96 **** static int LUACALL wxLua_wxRegEx_Replace(lua_State *L) { - int returns; // get number of arguments int argCount = lua_gettop(L); --- 88,91 ---- *************** *** 104,108 **** wxRegEx *self = (wxRegEx *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRegEx); // call Replace ! returns = self->Replace(&text, replacement, maxMatches); // push the result number lua_pushnumber(L, returns); --- 99,103 ---- wxRegEx *self = (wxRegEx *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRegEx); // call Replace ! int returns = self->Replace(&text, replacement, maxMatches); // push the result number lua_pushnumber(L, returns); *************** *** 118,122 **** static int LUACALL wxLua_wxRegEx_ReplaceAll(lua_State *L) { - int returns; // const wxString& replacement wxString replacement = wxlua_getwxStringtype(L, 3); --- 113,116 ---- *************** *** 126,130 **** wxRegEx *self = (wxRegEx *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRegEx); // call ReplaceAll ! returns = self->ReplaceAll(&text, replacement); // push the result number lua_pushnumber(L, returns); --- 120,124 ---- wxRegEx *self = (wxRegEx *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRegEx); // call ReplaceAll ! int returns = self->ReplaceAll(&text, replacement); // push the result number lua_pushnumber(L, returns); *************** *** 140,144 **** static int LUACALL wxLua_wxRegEx_ReplaceFirst(lua_State *L) { - int returns; // const wxString& replacement wxString replacement = wxlua_getwxStringtype(L, 3); --- 134,137 ---- *************** *** 148,152 **** wxRegEx *self = (wxRegEx *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRegEx); // call ReplaceFirst ! returns = self->ReplaceFirst(&text, replacement); // push the result number lua_pushnumber(L, returns); --- 141,145 ---- wxRegEx *self = (wxRegEx *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxRegEx); // call ReplaceFirst ! int returns = self->ReplaceFirst(&text, replacement); // push the result number lua_pushnumber(L, returns); *************** *** 257,261 **** static int LUACALL wxLua_wxConfigBase_GetFirstGroup(lua_State *L) { - bool returns; // get number of arguments int argCount = lua_gettop(L); --- 250,253 ---- *************** *** 266,270 **** wxConfig *self = (wxConfig *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase); // call GetFirstGroup ! returns = self->GetFirstGroup(str, index); // push the result number lua_pushboolean(L, returns); --- 258,262 ---- wxConfig *self = (wxConfig *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase); // call GetFirstGroup ! bool returns = self->GetFirstGroup(str, index); // push the result number lua_pushboolean(L, returns); *************** *** 282,286 **** static int LUACALL wxLua_wxConfigBase_GetFirstEntry(lua_State *L) { - bool returns; // get number of arguments int argCount = lua_gettop(L); --- 274,277 ---- *************** *** 291,295 **** wxConfig *self = (wxConfig *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase); // call GetFirstEntry ! returns = self->GetFirstEntry(str, index); // push the result number lua_pushboolean(L, returns); --- 282,286 ---- wxConfig *self = (wxConfig *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase); // call GetFirstEntry ! bool returns = self->GetFirstEntry(str, index); // push the result number lua_pushboolean(L, returns); *************** *** 307,311 **** static int LUACALL wxLua_wxConfigBase_GetNextGroup(lua_State *L) { - bool returns; // only the number is needed long index = (long)wxlua_getintegertype(L, 2); --- 298,301 ---- *************** *** 314,318 **** wxConfig *self = (wxConfig *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase); // call GetNextGroup ! returns = self->GetNextGroup(str, index); // push the result number lua_pushboolean(L, returns); --- 304,308 ---- wxConfig *self = (wxConfig *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase); // call GetNextGroup ! bool returns = self->GetNextGroup(str, index); // push the result number lua_pushboolean(L, returns); *************** *** 330,334 **** static int LUACALL wxLua_wxConfigBase_GetNextEntry(lua_State *L) { - bool returns; // only the number is needed long index = (long)wxlua_getintegertype(L, 2); --- 320,323 ---- *************** *** 337,341 **** wxConfig *self = (wxConfig *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase); // call GetNextEntry ! returns = self->GetNextEntry(str, index); // push the result number lua_pushboolean(L, returns); --- 326,330 ---- wxConfig *self = (wxConfig *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxConfigBase); // call GetNextEntry ! bool returns = self->GetNextEntry(str, index); // push the result number lua_pushboolean(L, returns); *************** *** 359,363 **** wxluabind_removetableforcall(L); - wxString* returns; // get number of arguments int argCount = lua_gettop(L); --- 348,351 ---- *************** *** 365,369 **** const wxString str = (argCount >= 1 ? wxlua_getwxStringtype(L, 1) : wxString(wxEmptyString)); // call constructor ! returns = new wxString(str); // add to tracked memory list wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxString(returns)); --- 353,357 ---- const wxString str = (argCount >= 1 ? wxlua_getwxStringtype(L, 1) : wxString(wxEmptyString)); // call constructor ! wxString* returns = new wxString(str); // add to tracked memory list wxluaO_addtrackedobject(L, (void*)returns, new wxLua_wxObject_wxString(returns)); *************** *** 381,389 **** wxluabind_removetableforcall(L); - wxClassInfo *returns; // const wxString &name wxString name = wxlua_getwxStringtype(L, 1); // call constructor ! returns = wxClassInfo::FindClass((wxChar *)name.c_str()); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxClassInfo, returns); --- 369,376 ---- wxluabind_removetableforcall(L); // const wxString &name wxString name = wxlua_getwxStringtype(L, 1); // call constructor ! wxClassInfo *returns = wxClassInfo::FindClass((wxChar *)name.c_str()); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxClassInfo, returns); *************** *** 432,436 **** %override wxLua_wxArrayInt_ToLuaTable ! // int ToLuaTable const static int LUACALL wxLua_wxArrayInt_ToLuaTable(lua_State *L) { --- 419,423 ---- %override wxLua_wxArrayInt_ToLuaTable ! // int ToLuaTable() const static int LUACALL wxLua_wxArrayInt_ToLuaTable(lua_State *L) { *************** *** 442,446 **** %override wxLua_wxArrayString_ToLuaTable ! // int ToLuaTable const static int LUACALL wxLua_wxArrayString_ToLuaTable(lua_State *L) { --- 429,433 ---- %override wxLua_wxArrayString_ToLuaTable ! // int ToLuaTable() const static int LUACALL wxLua_wxArrayString_ToLuaTable(lua_State *L) { *************** *** 457,463 **** wxluabind_removetableforcall(L); - wxStringList *returns; // call constructor ! returns = new wxStringList(); int argCount = lua_gettop(L); --- 444,449 ---- wxluabind_removetableforcall(L); // call constructor ! wxStringList *returns = new wxStringList(); int argCount = lua_gettop(L); *************** *** 530,538 **** static int LUACALL wxLua_function_wxGetTempFileName(lua_State *L) { - wxString returns; // const wxString& prefix wxString prefix = lua2wx(wxlua_getstringtype(L, 1)); // call wxGetTempFileName ! returns = wxGetTempFileName(prefix, NULL); // push the result number lua_pushstring(L, wx2lua(returns)); --- 516,523 ---- static int LUACALL wxLua_function_wxGetTempFileName(lua_State *L) { // const wxString& prefix wxString prefix = lua2wx(wxlua_getstringtype(L, 1)); // call wxGetTempFileName ! wxString returns = wxGetTempFileName(prefix, NULL); // push the result number lua_pushstring(L, wx2lua(returns)); *************** *** 564,572 **** static int LUACALL wxLua_wxFileName_GetDirs(lua_State *L) { - wxArrayString returns; // get this wxFileName * self = (wxFileName *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileName); // call GetDirs ! returns = self->GetDirs(); // push the result datatype wxlua_pushwxArrayStringtable(L, returns); --- 549,556 ---- static int LUACALL wxLua_wxFileName_GetDirs(lua_State *L) { // get this wxFileName * self = (wxFileName *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileName); // call GetDirs ! wxArrayString returns = self->GetDirs(); // push the result datatype wxlua_pushwxArrayStringtable(L, returns); *************** *** 580,584 **** static int LUACALL wxLua_wxFileName_GetTimes(lua_State *L) { - bool returns; wxDateTime *dtCreate = new wxDateTime(); wxDateTime *dtMod = new wxDateTime(); --- 564,567 ---- *************** *** 587,591 **** wxFileName *self = (wxFileName *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileName); // call GetTimes ! returns = self->GetTimes(dtAccess, dtMod, dtCreate); // add to tracked memory list wxluaO_addtrackedobject(L, (void*)dtAccess, new wxLua_wxObject_wxDateTime(dtAccess)); --- 570,574 ---- wxFileName *self = (wxFileName *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileName); // call GetTimes ! bool returns = self->GetTimes(dtAccess, dtMod, dtCreate); // add to tracked memory list wxluaO_addtrackedobject(L, (void*)dtAccess, new wxLua_wxObject_wxDateTime(dtAccess)); *************** *** 678,682 **** static int LUACALL wxLua_wxDir_GetFirst(lua_State *L) { - bool returns; // get number of arguments int argCount = lua_gettop(L); --- 661,664 ---- *************** *** 690,694 **** wxDir *self = (wxDir *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDir); // call GetFirst ! returns = self->GetFirst(&filename, filespec, flags); lua_pushboolean(L, returns); // push the result number --- 672,676 ---- wxDir *self = (wxDir *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDir); // call GetFirst ! bool returns = self->GetFirst(&filename, filespec, flags); lua_pushboolean(L, returns); // push the result number *************** *** 703,707 **** static int LUACALL wxLua_wxDir_GetNext(lua_State *L) { - bool returns; // wxString * filename wxString filename; --- 685,688 ---- *************** *** 709,713 **** wxDir *self = (wxDir *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDir); // call GetNext ! returns = self->GetNext(&filename); lua_pushboolean(L, returns); // push the result number --- 690,694 ---- wxDir *self = (wxDir *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxDir); // call GetNext ! bool returns = self->GetNext(&filename); lua_pushboolean(L, returns); // push the result number *************** *** 722,726 **** static int LUACALL wxLua_wxDir_GetAllFiles(lua_State *L) { - unsigned int returns; // get number of arguments int argCount = lua_gettop(L); --- 703,706 ---- *************** *** 734,738 **** wxString dirname = wxlua_getwxStringtype(L, 1); // call GetAllFiles ! returns = wxDir::GetAllFiles(dirname, &files, filespec, flags); // push the result number lua_pushnumber(L, returns); --- 714,718 ---- wxString dirname = wxlua_getwxStringtype(L, 1); // call GetAllFiles ! unsigned int returns = wxDir::GetAllFiles(dirname, &files, filespec, flags); // push the result number lua_pushnumber(L, returns); *************** *** 747,751 **** static int LUACALL wxLua_wxFile_Read(lua_State *L) { - unsigned int returns; // unsigned int count unsigned int count = (unsigned int)wxlua_getintegertype(L, 2); --- 727,730 ---- *************** *** 757,761 **** wxFile *self = (wxFile *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFile); // call Read ! returns = self->Read(buffer, count); // push the result number lua_pushnumber(L, returns); --- 736,740 ---- wxFile *self = (wxFile *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFile); // call Read ! unsigned int returns = self->Read(buffer, count); // push the result number lua_pushnumber(L, returns); *************** *** 773,777 **** static int LUACALL wxLua_wxFile_Write(lua_State *L) { - unsigned int returns; // get number of arguments int argCount = lua_gettop(L); --- 752,755 ---- *************** *** 783,787 **** wxFile *self = (wxFile *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFile); // call Write ! returns = self->Write(buffer, nbytes); // push the result number lua_pushnumber(L, returns); --- 761,765 ---- wxFile *self = (wxFile *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFile); // call Write ! unsigned int returns = self->Write(buffer, nbytes); // push the result number lua_pushnumber(L, returns); *************** *** 795,799 **** static int LUACALL wxLua_wxFileType_GetDescription(lua_State *L) { - bool returns; // wxString desc wxString desc; // = wxlua_getwxStringtype(L, 2); --- 773,776 ---- *************** *** 801,805 **** wxFileType * self = (wxFileType *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileType); // call GetDescription ! returns = (self->GetDescription(&desc)); // push the result flag lua_pushboolean(L, returns); --- 778,782 ---- wxFileType * self = (wxFileType *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileType); // call GetDescription ! bool returns = (self->GetDescription(&desc)); // push the result flag lua_pushboolean(L, returns); *************** *** 814,818 **** static int LUACALL wxLua_wxFileType_GetPrintCommand(lua_State *L) { - bool returns; // const wxFileType::MessageParameters params const wxFileType::MessageParameters * params = (const wxFileType::MessageParameters *)wxluaT_getuserdatatype(L, 3, s_wxluatag_wxFileType_MessageParameters); --- 791,794 ---- *************** *** 822,826 **** wxFileType * self = (wxFileType *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileType); // call GetPrintCommand ! returns = (self->GetPrintCommand(&printCmd, *params)); // push the result flag lua_pushboolean(L, returns); --- 798,802 ---- wxFileType * self = (wxFileType *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxFileType); // call GetPrintCommand ! bool returns = (self->GetPrintCommand(&printCmd, *params)); // push the result flag lua_pushboolean(L, returns); *************** *** 835,839 **** static int LUACALL wxLua_wxInputStream_Read(lua_State *L) { - wxInputStream *returns; // size_t size size_t size = (size_t)wxlua_getintegertype(L, 2); --- 811,814 ---- *************** *** 845,849 **** { // call Read ! returns = &self->Read(buffer, size); // only return the data that was read, they already have self //wxluaT_pushuserdatatype(L, s_wxluatag_wxInputStream, returns); --- 820,825 ---- { // call Read ! // wxInputStream *returns = & // we don't return wxInputStream ! self->Read(buffer, size); // only return the data that was read, they already have self //wxluaT_pushuserdatatype(L, s_wxluatag_wxInputStream, returns); *************** *** 860,864 **** static int LUACALL wxLua_wxInputStream_UngetchString(lua_State *L) { - size_t returns; // size_t size size_t size = (size_t)wxlua_getintegertype(L, 3); --- 836,839 ---- *************** *** 868,872 **** wxInputStream *self = (wxInputStream *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxInputStream); // call Ungetch ! returns = self->Ungetch(buffer, size); // push the result number lua_pushnumber(L, returns); --- 843,847 ---- wxInputStream *self = (wxInputStream *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxInputStream); // call Ungetch ! size_t returns = self->Ungetch(buffer, size); // push the result number lua_pushnumber(L, returns); *************** *** 880,884 **** static int LUACALL wxLua_wxOutputStream_Write(lua_State *L) { - wxOutputStream *returns; // size_t size size_t size = (size_t)wxlua_getintegertype(L, 3); --- 855,858 ---- *************** *** 888,892 **** wxOutputStream *self = (wxOutputStream *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxOutputStream); // call Write ! returns = &self->Write(buffer, size); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxOutputStream, returns); --- 862,866 ---- wxOutputStream *self = (wxOutputStream *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxOutputStream); // call Write ! wxOutputStream *returns = &self->Write(buffer, size); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxOutputStream, returns); Index: wx_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wx_datatypes.lua,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** wx_datatypes.lua 25 Nov 2007 21:34:04 -0000 1.88 --- wx_datatypes.lua 10 Dec 2007 05:39:05 -0000 1.89 *************** *** 2549,2552 **** --- 2549,2559 ---- ValueType = "class", }, + wxLuaArtProvider = { + BaseClass = "wxArtProvider", + Condition = "wxLUA_USE_wxArtProvider", + IsNumber = false, + Name = "wxLuaArtProvider", + ValueType = "class", + }, wxLuaHtmlWinTagEvent = { BaseClass = "wxEvent", Index: wxbase_file.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_file.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxbase_file.i 16 Jul 2007 19:34:24 -0000 1.1 --- wxbase_file.i 10 Dec 2007 05:39:05 -0000 1.2 *************** *** 15,21 **** --- 15,24 ---- %function bool wxDirExists(const wxString& dirname) %function bool wxFileExists(const wxString& filename) + // %override [new lua string] wxDos2UnixFilename(lua string) + // C++ Func: void wxDos2UnixFilename(wxChar *s) %function wxString wxDos2UnixFilename(const wxString& s) // %override wxDateTime wxFileModificationTime(const wxString& filename) (not overridden, just return wxDateTime) + // C++ Func: time_t wxFileModificationTime(const wxString& filename) %function wxDateTime wxFileModificationTime(const wxString& filename) //%function wxString wxFileNameFromPath(const wxString& path) // obsolete use wxFileName::SplitPath *************** *** 28,31 **** --- 31,35 ---- %function wxString wxPathOnly(const wxString& path) // %override [new lua string] wxUnix2DosFilename(lua string) + // C++ Func: void wxUnix2DosFilename(wxChar *s) %function wxString wxUnix2DosFilename(const wxString& s) %function bool wxConcatFiles(const wxString& file1, const wxString& file2,const wxString& file3) Index: wxcore_print.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_print.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxcore_print.i 16 Jul 2007 19:34:25 -0000 1.1 --- wxcore_print.i 10 Dec 2007 05:39:05 -0000 1.2 *************** *** 62,65 **** --- 62,66 ---- %class %delete wxLuaPrintout, wxPrintout + // %override - the C++ function takes the wxLuaState as the first param wxLuaPrintout(const wxString& title = "Printout", wxLuaObject *pObject = NULL) Index: wxadv_adv.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxadv_adv.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxadv_adv.i 16 Jul 2007 19:34:23 -0000 1.1 --- wxadv_adv.i 10 Dec 2007 05:39:05 -0000 1.2 *************** *** 42,46 **** wxIcon GetIcon() const ! void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString) bool HasWebSite() const --- 42,46 ---- wxIcon GetIcon() const ! void SetWebSite(const wxString& url, const wxString& desc = "") bool HasWebSite() const *************** *** 70,75 **** // implementation only // ------------------- ! //bool IsSimple() const ! //wxString GetDescriptionAndCredits() const %endclass --- 70,75 ---- // implementation only // ------------------- ! bool IsSimple() const ! wxString GetDescriptionAndCredits() const %endclass *************** *** 94,98 **** %endenum ! %class %delete wxAnimation, wxGDIObject wxAnimation() wxAnimation(const wxAnimation& anim) --- 94,98 ---- %endenum ! %class %delete wxAnimation, wxGDIObject // ignore platform independent wxAnimationBase wxAnimation() wxAnimation(const wxAnimation& anim) *************** *** 113,117 **** %define wxAC_NO_AUTORESIZE ! %define wxAC_DEFAULT_STYLE %class wxAnimationCtrl, wxControl --- 113,117 ---- %define wxAC_NO_AUTORESIZE ! %define wxAC_DEFAULT_STYLE // = wxNO_BORDER %class wxAnimationCtrl, wxControl Index: wxadv_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxadv_override.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxadv_override.hpp 7 Dec 2007 02:13:09 -0000 1.2 --- wxadv_override.hpp 10 Dec 2007 05:39:05 -0000 1.3 *************** *** 14,18 **** static int LUACALL wxLua_wxCalendarCtrl_HitTest(lua_State *L) { - wxCalendarHitTestResult returns; // const wxPoint pos const wxPoint * pos = (const wxPoint *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxPoint); --- 14,17 ---- *************** *** 23,27 **** wxDateTime::WeekDay wd = wxDateTime::Inv_WeekDay; ! returns = self->HitTest(*pos, date, &wd); // push the result number lua_pushnumber(L, returns); --- 22,26 ---- wxDateTime::WeekDay wd = wxDateTime::Inv_WeekDay; ! wxCalendarHitTestResult returns = self->HitTest(*pos, date, &wd); // push the result number lua_pushnumber(L, returns); Index: wxstc_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxstc_override.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxstc_override.hpp 7 Dec 2007 02:13:10 -0000 1.2 --- wxstc_override.hpp 10 Dec 2007 05:39:05 -0000 1.3 *************** *** 14,23 **** static int LUACALL wxLua_wxStyledTextCtrl_GetCurLine(lua_State *L) { - wxString returns; int linePos; // get this wxStyledTextCtrl *self = (wxStyledTextCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxStyledTextCtrl); // call GetCurLine ! returns = self->GetCurLine(&linePos); // push the result string lua_pushstring(L, wx2lua(returns)); --- 14,22 ---- static int LUACALL wxLua_wxStyledTextCtrl_GetCurLine(lua_State *L) { int linePos; // get this wxStyledTextCtrl *self = (wxStyledTextCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxStyledTextCtrl); // call GetCurLine ! wxString returns = self->GetCurLine(&linePos); // push the result string lua_pushstring(L, wx2lua(returns)); Index: wxhtml_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxhtml_override.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxhtml_override.hpp 7 Dec 2007 06:44:41 -0000 1.4 --- wxhtml_override.hpp 10 Dec 2007 05:39:05 -0000 1.5 *************** *** 16,20 **** static int LUACALL wxLua_wxHtmlCell_AdjustPagebreak(lua_State *L) { - bool returns; // int * pagebreak int pagebreak = (int)wxlua_getintegertype(L, 2); --- 16,19 ---- *************** *** 22,26 **** wxHtmlCell *self = (wxHtmlCell *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHtmlCell); // call AdjustPagebreak ! returns = self->AdjustPagebreak(&pagebreak); // push the result number lua_pushboolean(L, returns); --- 21,25 ---- wxHtmlCell *self = (wxHtmlCell *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHtmlCell); // call AdjustPagebreak ! bool returns = self->AdjustPagebreak(&pagebreak); // push the result number lua_pushboolean(L, returns); *************** *** 34,38 **** static int LUACALL wxLua_wxHtmlCell_AdjustPagebreak(lua_State *L) { - bool returns; // int * pagebreak int pagebreak = (int)wxlua_getintegertype(L, 3); --- 33,36 ---- *************** *** 42,46 **** wxHtmlCell *self = (wxHtmlCell *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHtmlCell); // call AdjustPagebreak ! returns = self->AdjustPagebreak(&pagebreak, *known_pagebreaks); // push the result number lua_pushboolean(L, returns); --- 40,44 ---- wxHtmlCell *self = (wxHtmlCell *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHtmlCell); // call AdjustPagebreak ! bool returns = self->AdjustPagebreak(&pagebreak, *known_pagebreaks); // push the result number lua_pushboolean(L, returns); *************** *** 99,103 **** static int LUACALL wxLua_wxHtmlTag_GetParamAsColour(lua_State *L) { - bool returns; wxColour *retColour = new wxColour; // const wxString& par --- 97,100 ---- *************** *** 106,110 **** wxHtmlTag *self = (wxHtmlTag *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHtmlTag); // call GetParamAsColour ! returns = self->GetParamAsColour(par, retColour); // // push the result number --- 103,107 ---- wxHtmlTag *self = (wxHtmlTag *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHtmlTag); // call GetParamAsColour ! bool returns = self->GetParamAsColour(par, retColour); // // push the result number *************** *** 120,124 **** static int LUACALL wxLua_wxHtmlTag_GetParamAsInt(lua_State *L) { - bool returns; int value; // const wxString& par --- 117,120 ---- *************** *** 127,131 **** wxHtmlTag *self = (wxHtmlTag *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHtmlTag); // call GetParamAsInt ! returns = self->GetParamAsInt(par, &value); // push the result number lua_pushboolean(L, returns); --- 123,127 ---- wxHtmlTag *self = (wxHtmlTag *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxHtmlTag); // call GetParamAsInt ! bool returns = self->GetParamAsInt(par, &value); // push the result number lua_pushboolean(L, returns); *************** *** 254,258 **** wxluabind_removetableforcall(L); wxLuaState wxlState(L); - wxLuaHtmlWindow *returns; // get number of arguments int argCount = lua_gettop(L); --- 250,253 ---- *************** *** 270,274 **** wxWindow * parent = (wxWindow *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxWindow); // call constructor ! returns = new wxLuaHtmlWindow(wxlState, parent, id, *pos, *size, style, name); // add to tracked window list if (returns && returns->IsKindOf(CLASSINFO(wxWindow))) --- 265,269 ---- wxWindow * parent = (wxWindow *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxWindow); // call constructor ! wxLuaHtmlWindow *returns = new wxLuaHtmlWindow(wxlState, parent, id, *pos, *size, style, name); // add to tracked window list if (returns && returns->IsKindOf(CLASSINFO(wxWindow))) Index: wxcore_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxcore_override.hpp 7 Dec 2007 06:44:41 -0000 1.8 --- wxcore_override.hpp 10 Dec 2007 05:39:05 -0000 1.9 *************** *** 14,20 **** static int LUACALL wxLua_function_wxGetApp(lua_State *L) { - wxApp *returns; // call wxGetApp(), actually not since you have to have IMPLEMENT_APP ! returns = wxTheApp; // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxApp, returns); --- 14,19 ---- static int LUACALL wxLua_function_wxGetApp(lua_State *L) { [...1149 lines suppressed...] int argCount = lua_gettop(L); --- 2718,2722 ---- wxluabind_removetableforcall(L); wxLuaState wxlState(L); ! // get number of arguments int argCount = lua_gettop(L); *************** *** 2767,2771 **** const wxString title = (argCount >= 1 ? wxlua_getwxStringtype(L, 1) : wxString(wxT("Printout"))); // call constructor ! returns = new wxLuaPrintout(wxlState, title, pObject); // add to tracked memory list wxluaO_addtrackedobject(L, (wxLuaPrintout *)returns); --- 2726,2730 ---- const wxString title = (argCount >= 1 ? wxlua_getwxStringtype(L, 1) : wxString(wxT("Printout"))); // call constructor ! wxLuaPrintout *returns = new wxLuaPrintout(wxlState, title, pObject); // add to tracked memory list wxluaO_addtrackedobject(L, (wxLuaPrintout *)returns); Index: wxcore_image.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_image.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxcore_image.i 16 Jul 2007 19:34:25 -0000 1.1 --- wxcore_image.i 10 Dec 2007 05:39:05 -0000 1.2 *************** *** 517,521 **** %define_string wxART_INFORMATION %define_string wxART_MISSING_IMAGE - %define_string wxART_COPY %define_string wxART_CUT --- 517,520 ---- *************** *** 532,547 **** %define_string wxART_FIND_AND_REPLACE - // All the public functions are static so we rename them and use builtin - // also just use wxString instead of wxArtID and wxArtClient - %class wxArtProvider, wxObject // wxArtProvider() - abstract class %if %wxchkver_2_8 ! static void Push(wxArtProvider *provider) ! static void Insert(wxArtProvider *provider) static bool Pop() ! static bool Remove(wxArtProvider *provider) ! static bool Delete(wxArtProvider *provider) %endif // %wxchkver_2_8 --- 531,543 ---- %define_string wxART_FIND_AND_REPLACE %class wxArtProvider, wxObject // wxArtProvider() - abstract class %if %wxchkver_2_8 ! static void Push(%ungc wxArtProvider *provider) ! static void Insert(%ungc wxArtProvider *provider) static bool Pop() ! static bool Remove(%gc wxArtProvider *provider) // FIXME - mem leak if not found ! static bool Delete(%ungc wxArtProvider *provider) %endif // %wxchkver_2_8 *************** *** 557,559 **** --- 553,571 ---- %endclass + %class %delete wxLuaArtProvider, wxArtProvider + // %override - the C++ function takes the wxLuaState as the first param + wxLuaArtProvider() + + // virtual function that you can override in Lua. + virtual wxSize DoGetSizeHint(const wxString& client) // { return GetSizeHint(client, true); } + + // virtual function that you can override in Lua. + + // Derived classes must override this method to create requested + // art resource. This method is called only once per instance's + // lifetime for each requested wxArtID. + virtual wxBitmap CreateBitmap(const wxString& id, const wxString& client, const wxSize& size); + + %endclass + %endif //wxLUA_USE_wxArtProvider Index: wxcore_appframe.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_appframe.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxcore_appframe.i 16 Jul 2007 19:34:24 -0000 1.1 --- wxcore_appframe.i 10 Dec 2007 05:39:05 -0000 1.2 *************** *** 16,19 **** --- 16,21 ---- %include "wx/app.h" + // %override wxApp* wxGetApp() + // C++ func: wxApp* wxGetApp() - use wxTheApp* since this requires IMPLEMENT_APP() %function wxApp* wxGetApp() Index: wxcore_menutool.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_menutool.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxcore_menutool.i 16 Jul 2007 19:34:25 -0000 1.1 --- wxcore_menutool.i 10 Dec 2007 05:39:05 -0000 1.2 *************** *** 358,361 **** --- 358,362 ---- bool Ok() const + //%wxchkver_2_8 bool IsOk() const // believe it or not, there aren't functions to add or remove wxAcceleratorEntries for MSW *************** *** 369,372 **** --- 370,375 ---- %wxcompat_2_6 %function wxAcceleratorEntry* wxGetAccelFromString(const wxString& label) // deprecated in 2.8 use wxAcceleratorEntry::Create() or FromString() + %include "wx/accel.h" + %enum wxACCEL_NORMAL *************** *** 378,382 **** %class %delete %noclassinfo %encapsulate wxAcceleratorEntry ! wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0) wxAcceleratorEntry(const wxAcceleratorEntry& entry) --- 381,385 ---- %class %delete %noclassinfo %encapsulate wxAcceleratorEntry ! wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, wxMenuItem *item = NULL) wxAcceleratorEntry(const wxAcceleratorEntry& entry) *************** *** 384,388 **** int GetFlags() const int GetKeyCode() const ! void Set(int flags, int keyCode, int Cmd) %if %wxchkver_2_8 --- 387,391 ---- int GetFlags() const int GetKeyCode() const ! void Set(int flags, int keyCode, int Cmd, wxMenuItem *item = NULL) %if %wxchkver_2_8 *************** *** 391,394 **** --- 394,398 ---- wxString ToString() const bool FromString(const wxString& str) + wxMenuItem *GetMenuItem() const %endif // %wxchkver_2_8 Index: wxxml_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxxml_override.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxxml_override.hpp 7 Dec 2007 06:44:41 -0000 1.4 --- wxxml_override.hpp 10 Dec 2007 05:39:05 -0000 1.5 *************** *** 16,20 **** wxluabind_removetableforcall(L); - wxXmlNode *returns; // wxXmlNode next wxXmlNode * next = (wxXmlNode *)wxluaT_getuserdatatype(L, 6, s_wxluatag_wxXmlNode); --- 16,19 ---- *************** *** 30,34 **** wxXmlNode * parent = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); // call constructor ! returns = new wxXmlNode(parent, type, name, content, props, next); // add to tracked memory list if (parent == NULL) --- 29,33 ---- wxXmlNode * parent = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); // call constructor ! wxXmlNode *returns = new wxXmlNode(parent, type, name, content, props, next); // add to tracked memory list if (parent == NULL) *************** *** 45,49 **** static int LUACALL wxLua_wxXmlNode_RemoveChild(lua_State *L) { - bool returns; // wxXmlNode child wxXmlNode * child = (wxXmlNode *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxXmlNode); --- 44,47 ---- *************** *** 51,55 **** wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); // call RemoveChild ! returns = (self->RemoveChild(child)); if (returns && !wxluaO_istrackedobject(L, child)) --- 49,53 ---- wxXmlNode * self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); // call RemoveChild ! bool returns = (self->RemoveChild(child)); if (returns && !wxluaO_istrackedobject(L, child)) *************** *** 67,71 **** static int LUACALL wxLua_wxXmlNode_GetPropValPtr(lua_State *L) { - bool returns; // wxString *value wxString value; --- 65,68 ---- *************** *** 75,79 **** wxXmlNode *self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); // call GetPropVal ! returns = self->GetPropVal(propName, &value); // push the result number lua_pushboolean(L, returns); --- 72,76 ---- wxXmlNode *self = (wxXmlNode *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxXmlNode); // call GetPropVal ! bool returns = self->GetPropVal(propName, &value); // push the result number lua_pushboolean(L, returns); |
From: John L. <jr...@us...> - 2007-12-10 05:39:39
|
Update of /cvsroot/wxlua/wxLua/apps/wxluacan/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23281/wxLua/apps/wxluacan/src Modified Files: wxluacan.cpp wxluacan.h wxluacan_bind.cpp Log Message: genwxbind.lua - don't create "returns" variable before use to save a line of code. Applied Lua patches for 5.1.2 8-11 Added wxlua_lreg_createtable(..) to create the LUA_REGISTRYINDEX tables for wxLua Added wxlua_lreg_regtable_key in LUA_REGISTRYINDEX to help the wxLuaDebugData find wxLua's tables faster to give more information Index: wxluacan.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** wxluacan.cpp 7 Dec 2007 06:44:40 -0000 1.35 --- wxluacan.cpp 10 Dec 2007 05:39:03 -0000 1.36 *************** *** 49,57 **** static int LUACALL wxLua_wxlCanObj_GetX(lua_State *L) { - double returns; // get this wxlCanObj * self = (wxlCanObj *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCanObj); // call GetX ! returns = (self->GetX()); // push the result number lua_pushnumber(L, returns); --- 49,56 ---- static int LUACALL wxLua_wxlCanObj_GetX(lua_State *L) { // get this wxlCanObj * self = (wxlCanObj *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCanObj); // call GetX ! double returns = (self->GetX()); // push the result number lua_pushnumber(L, returns); *************** *** 66,74 **** static int LUACALL wxLua_wxlCanObj_GetY(lua_State *L) { - double returns; // get this wxlCanObj * self = (wxlCanObj *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCanObj); // call GetY ! returns = (self->GetY()); // push the result number lua_pushnumber(L, returns); --- 65,72 ---- static int LUACALL wxLua_wxlCanObj_GetY(lua_State *L) { // get this wxlCanObj * self = (wxlCanObj *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCanObj); // call GetY ! double returns = (self->GetY()); // push the result number lua_pushnumber(L, returns); *************** *** 156,160 **** { wxluabind_removetableforcall(L); - wxlCanObj *returns; // get number of arguments int argCount = lua_gettop(L); --- 154,157 ---- *************** *** 164,168 **** double x = (argCount >= 1 ? (double)wxlua_getnumbertype(L, 1) : 0); // call constructor ! returns = new wxlCanObj(x, y); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObj, returns); --- 161,165 ---- double x = (argCount >= 1 ? (double)wxlua_getnumbertype(L, 1) : 0); // call constructor ! wxlCanObj* returns = new wxlCanObj(x, y); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObj, returns); *************** *** 207,211 **** { wxluabind_removetableforcall(L); - wxlCanObjRect *returns; // double h double h = (double)wxlua_getnumbertype(L, 4); --- 204,207 ---- *************** *** 217,221 **** double x = (double)wxlua_getnumbertype(L, 1); // call constructor ! returns = new wxlCanObjRect(x, y, w, h); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObjRect, returns); --- 213,217 ---- double x = (double)wxlua_getnumbertype(L, 1); // call constructor ! wxlCanObjRect* returns = new wxlCanObjRect(x, y, w, h); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObjRect, returns); *************** *** 249,253 **** { wxluabind_removetableforcall(L); - wxlCanObjCircle *returns; // double r double r = (double)wxlua_getnumbertype(L, 3); --- 245,248 ---- *************** *** 257,261 **** double x = (double)wxlua_getnumbertype(L, 1); // call constructor ! returns = new wxlCanObjCircle(x, y, r); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObjCircle, returns); --- 252,256 ---- double x = (double)wxlua_getnumbertype(L, 1); // call constructor ! wxlCanObjCircle* returns = new wxlCanObjCircle(x, y, r); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObjCircle, returns); *************** *** 289,293 **** { wxluabind_removetableforcall(L); - wxlCanObjScript *returns; // const wxString name const wxString name = wxlua_getwxStringtype(L, 3); --- 284,287 ---- *************** *** 297,301 **** double x = (double)wxlua_getnumbertype(L, 1); // call constructor ! returns = new wxlCanObjScript(x, y, name); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObjScript, returns); --- 291,295 ---- double x = (double)wxlua_getnumbertype(L, 1); // call constructor ! wxlCanObjScript* returns = new wxlCanObjScript(x, y, name); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObjScript, returns); *************** *** 345,349 **** { wxluabind_removetableforcall(L); - wxlCanObjAddScript *returns; // const wxString script const wxString script = wxlua_getwxStringtype(L, 3); --- 339,342 ---- *************** *** 353,357 **** double x = (double)wxlua_getnumbertype(L, 1); // call constructor ! returns = new wxlCanObjAddScript(x, y, script); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObjAddScript, returns); --- 346,350 ---- double x = (double)wxlua_getnumbertype(L, 1); // call constructor ! wxlCanObjAddScript* returns = new wxlCanObjAddScript(x, y, script); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCanObjAddScript, returns); *************** *** 401,409 **** static int LUACALL wxLua_wxlCan_GetCmdh(lua_State *L) { - wxlLuaCanCmd *returns; // get this wxlCan * self = (wxlCan *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCan); // call GetCmdh ! returns = (wxlLuaCanCmd *)self->GetCmdh(); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxlLuaCanCmd, returns); --- 394,401 ---- static int LUACALL wxLua_wxlCan_GetCmdh(lua_State *L) { // get this wxlCan * self = (wxlCan *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCan); // call GetCmdh ! wxlLuaCanCmd* returns = (wxlLuaCanCmd*)self->GetCmdh(); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxlLuaCanCmd, returns); *************** *** 418,426 **** static int LUACALL wxLua_wxlCan_GetYaxis(lua_State *L) { - bool returns; // get this wxlCan * self = (wxlCan *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCan); // call GetYaxis ! returns = (self->GetYaxis()); // push the result flag lua_pushboolean(L, returns); --- 410,417 ---- static int LUACALL wxLua_wxlCan_GetYaxis(lua_State *L) { // get this wxlCan * self = (wxlCan *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCan); // call GetYaxis ! bool returns = (self->GetYaxis()); // push the result flag lua_pushboolean(L, returns); *************** *** 438,442 **** { wxluabind_removetableforcall(L); - wxlCan *returns; // get number of arguments int argCount = lua_gettop(L); --- 429,432 ---- *************** *** 450,454 **** wxWindow * parent = (wxWindow *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxWindow); // call constructor ! returns = new wxlCan(parent, id, *pos, *size); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCan, returns); --- 440,444 ---- wxWindow * parent = (wxWindow *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxWindow); // call constructor ! wxlCan* returns = new wxlCan(parent, id, *pos, *size); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlCan, returns); *************** *** 511,515 **** { wxluabind_removetableforcall(L); - wxlLuaCanCmd *returns; // get number of arguments int argCount = lua_gettop(L); --- 501,504 ---- *************** *** 519,523 **** wxlCan * canvas = (wxlCan *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCan); // call constructor ! returns = new wxlLuaCanCmd(canvas, maxCommands); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlLuaCanCmd, returns); --- 508,512 ---- wxlCan * canvas = (wxlCan *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxlCan); // call constructor ! wxlLuaCanCmd* returns = new wxlLuaCanCmd(canvas, maxCommands); // push the constructed class pointer wxluaT_pushuserdatatype(L, s_wxluatag_wxlLuaCanCmd, returns); Index: wxluacan_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan_bind.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wxluacan_bind.cpp 7 Dec 2007 02:13:09 -0000 1.26 --- wxluacan_bind.cpp 10 Dec 2007 05:39:04 -0000 1.27 *************** *** 88,94 **** static int LUACALL wxLua_function_GetCan(lua_State *L) { - wxlCan *returns; // call GetCan ! returns = (wxlCan *)GetCan(); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxlCan, returns); --- 88,93 ---- static int LUACALL wxLua_function_GetCan(lua_State *L) { // call GetCan ! wxlCan* returns = (wxlCan*)GetCan(); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxlCan, returns); *************** *** 101,107 **** static int LUACALL wxLua_function_GetCmdhMain(lua_State *L) { - wxlLuaCanCmd *returns; // call GetCmdhMain ! returns = (wxlLuaCanCmd *)GetCmdhMain(); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxlLuaCanCmd, returns); --- 100,105 ---- static int LUACALL wxLua_function_GetCmdhMain(lua_State *L) { // call GetCmdhMain ! wxlLuaCanCmd* returns = (wxlLuaCanCmd*)GetCmdhMain(); // push the result datatype wxluaT_pushuserdatatype(L, s_wxluatag_wxlLuaCanCmd, returns); *************** *** 153,170 **** } - // --------------------------------------------------------------------------- // wxLuaBinding_wxluacan() - the binding class // --------------------------------------------------------------------------- - // binding class - extern wxLuaBindClass *wxLuaGetClassList_wxluacan(size_t &count); - extern wxLuaBindDefine *wxLuaGetDefineList_wxluacan(size_t &count); - extern wxLuaBindString *wxLuaGetStringList_wxluacan(size_t &count); - extern wxLuaBindEvent *wxLuaGetEventList_wxluacan(size_t &count); - extern wxLuaBindObject *wxLuaGetObjectList_wxluacan(size_t &count); - extern wxLuaBindMethod *wxLuaGetFunctionList_wxluacan(size_t &count); - - IMPLEMENT_DYNAMIC_CLASS(wxLuaBinding_wxluacan, wxLuaBinding) --- 151,158 ---- *************** *** 189,194 **** } - // bind wxLuaBinding_wxluacan to a single wxLuaState bool wxLuaBinding_wxluacan_bind(const wxLuaState& wxlState_) { --- 177,182 ---- } + // --------------------------------------------------------------------------- bool wxLuaBinding_wxluacan_bind(const wxLuaState& wxlState_) { *************** *** 207,211 **** return true; } ! // initialize wxLuaBinding_wxluacan for all wxLuaStates bool wxLuaBinding_wxluacan_init() { --- 195,199 ---- return true; } ! bool wxLuaBinding_wxluacan_init() { Index: wxluacan.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** wxluacan.h 7 Dec 2007 02:13:09 -0000 1.36 --- wxluacan.h 10 Dec 2007 05:39:04 -0000 1.37 *************** *** 54,57 **** --- 54,68 ---- // --------------------------------------------------------------------------- + // Functions to access wxLuaBindXXX structs + // --------------------------------------------------------------------------- + + extern wxLuaBindClass *wxLuaGetClassList_wxluacan(size_t &count); + extern wxLuaBindDefine *wxLuaGetDefineList_wxluacan(size_t &count); + extern wxLuaBindString *wxLuaGetStringList_wxluacan(size_t &count); + extern wxLuaBindEvent *wxLuaGetEventList_wxluacan(size_t &count); + extern wxLuaBindObject *wxLuaGetObjectList_wxluacan(size_t &count); + extern wxLuaBindMethod *wxLuaGetFunctionList_wxluacan(size_t &count); + + // --------------------------------------------------------------------------- // Lua Tag Method Values and Tables for each Class // --------------------------------------------------------------------------- *************** *** 80,84 **** - // --------------------------------------------------------------------------- // Encapsulation Declarations - need to be public for other bindings. --- 91,94 ---- |