From: John L. <jr...@us...> - 2007-12-22 06:07:22
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16833/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp Log Message: * Updated the naming conventions of the wxLua C/C++ functions to get rid of the term "tag" which dates back to Lua 4. Lua 5 does not use "tags", but rather metatables to attach functions to userdata in Lua. The new term for the C++ objects that wxLua wraps in Lua userdata and assigns a metatable to are wxLua types. wxLua types < 0, the WXLUA_TXXX types, correspond to the LUA_TXXX Lua types. wxLua types > 0 are types from the bindings and denote a class or struct. - Most notably for people who have written their own overrides for their bindings will be that wxLuaState::PushUserTag() is now wxluaT_PushUserDataType(). Those two functions existed before, but basically did the same thing. The calling arguments of PushUserTag() were taken however and were the reverse of what PushUserDataType() had. - wxluaT_new/get/set/tag() are now wxluaT_new/setmetatable() and wxluaT_type() where the latter works just like lua_type(), but returns one of the wxLua types. - Fix crash in wxListCtrl and wxTreeCtrl::AssignImageList() to use the %ungc tag to release wxLua from deleting the input wxImageList. Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** wxldebug.cpp 20 Dec 2007 02:26:58 -0000 1.61 --- wxldebug.cpp 22 Dec 2007 06:07:16 -0000 1.62 *************** *** 160,164 **** if (ret == 0) ! ret = int(elem2->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)) - int(elem1->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)); } --- 160,164 ---- if (ret == 0) ! ret = int(elem2->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)) - int(elem1->GetFlagBit(WXLUA_DEBUGITEM_KEY_REF)); } *************** *** 261,269 **** { 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); } --- 261,269 ---- { wxCHECK_MSG(wxlClass, wxEmptyString, wxT("Invalid wxLuaBindClass")); ! return wxString::Format(wxT(" (%s, wxluatype=%d, classinfo=%s, baseclass=%s, methods=%d, enums=%d)"), ! lua2wx(wxlClass->name).c_str(), *wxlClass->wxluatype, wxString(wxlClass->classInfo ? wxlClass->classInfo->GetClassName() : wxEmptyString).c_str(), lua2wx(wxlClass->baseclassName).c_str(), ! wxlClass->wxluamethods_n, wxlClass->enums_n); } *************** *** 358,364 **** if (lightuserdata_reg_key != NULL) { ! if (lightuserdata_reg_key == &wxlua_lreg_tags_key) { ! value += wxT(" (") + wxluaT_gettagname(L, (int)lua_tonumber(L, -2)) + wxT(")"); } else if (lightuserdata_reg_key == &wxlua_lreg_classes_key) --- 358,364 ---- if (lightuserdata_reg_key != NULL) { ! if (lightuserdata_reg_key == &wxlua_lreg_types_key) { ! value += wxT(" (") + wxluaT_typename(L, (int)lua_tonumber(L, -2)) + wxT(")"); } else if (lightuserdata_reg_key == &wxlua_lreg_classes_key) *************** *** 404,410 **** 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) --- 404,410 ---- void* key = lua_touserdata(L, -2); ! if (key == &wxlua_metatable_type_key) { ! value += wxT(" (") + wxluaT_typename(L, (int)lua_tonumber(L, -1)) + wxT(")"); } else if (key == &wxlua_metatable_wxluabindclass_key) *************** *** 434,438 **** // 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)); --- 434,438 ---- // 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)); *************** *** 501,505 **** lua_State* L = wxlState.GetLuaState(); int l_type = lua_type(L, stack_idx); ! int wxl_type = wxlua_getwxluatype(l_type); if (wxl_type_) *wxl_type_ = wxl_type; --- 501,505 ---- lua_State* L = wxlState.GetLuaState(); int l_type = lua_type(L, stack_idx); ! int wxl_type = wxlua_luatowxluatype(l_type); if (wxl_type_) *wxl_type_ = wxl_type; *************** *** 582,588 **** lua_State* L = wxlState.GetLuaState(); ! int nTag = wxluaT_gettag(L, stack_idx); ! int nItems = luaL_getn(L, stack_idx); ! const void *pItem = lua_topointer(L, stack_idx); wxString s(wxString::Format(wxT("%p"), pItem)); --- 582,588 ---- lua_State* L = wxlState.GetLuaState(); ! int wxl_type = wxluaT_type(L, stack_idx); ! int nItems = luaL_getn(L, stack_idx); ! const void *pItem = lua_topointer(L, stack_idx); wxString s(wxString::Format(wxT("%p"), pItem)); *************** *** 591,596 **** s += wxString::Format(wxT(" (approx %d items)"), nItems); ! if (nTag != WXLUA_NOTAG) ! s += wxString::Format(wxT(" (tag %d)"), nTag); return s; --- 591,596 ---- s += wxString::Format(wxT(" (approx %d items)"), nItems); ! if (wxlua_iswxuserdatatype(wxl_type)) ! s += wxString::Format(wxT(" (wxltype %d)"), wxl_type); return s; *************** *** 609,613 **** { // Convert our known keys to something more readable ! if ((udata == &wxlua_lreg_tags_key) || (udata == &wxlua_lreg_refs_key) || (udata == &wxlua_lreg_debug_refs_key) || --- 609,613 ---- { // Convert our known keys to something more readable ! if ((udata == &wxlua_lreg_types_key) || (udata == &wxlua_lreg_refs_key) || (udata == &wxlua_lreg_debug_refs_key) || *************** *** 624,628 **** (udata == &wxlua_lreg_regtable_key) || ! (udata == &wxlua_metatable_tag_key) || (udata == &wxlua_lreg_topwindows_key) || (udata == &wxlua_metatable_wxluabindclass_key)) --- 624,628 ---- (udata == &wxlua_lreg_regtable_key) || ! (udata == &wxlua_metatable_type_key) || (udata == &wxlua_lreg_topwindows_key) || (udata == &wxlua_metatable_wxluabindclass_key)) *************** *** 634,646 **** else // is full userdata { ! int nTag = wxluaT_gettag(L, stack_idx); ! if (nTag != WXLUA_NOTAG) { ! s += wxString::Format(wxT(" (tag %d)"), nTag); ! wxString tagName(wxlState.GetLuaTagName(nTag)); ! if (!tagName.IsEmpty()) ! s += wxString::Format(wxT(" '%s'"), tagName.c_str()); } } --- 634,646 ---- else // is full userdata { ! int wxl_type = wxluaT_type(L, stack_idx); ! if (wxlua_iswxuserdatatype(wxl_type)) { ! s += wxString::Format(wxT(" (wxltype %d)"), wxl_type); ! wxString wxltypeName(wxluaT_typename(L, wxl_type)); ! if (!wxltypeName.IsEmpty()) ! s += wxString::Format(wxT(" '%s'"), wxltypeName.c_str()); } } *************** *** 702,706 **** str.Printf(wxT(" idx %d: l_type = %d, wxl_type = %d : '%s'='%s'\n"), ! i, l_type, wxl_type, wxlua_getwxluatypename(wxl_type).c_str(), value.c_str()); retStr += str; OutputMsg(str); --- 702,706 ---- str.Printf(wxT(" idx %d: l_type = %d, wxl_type = %d : '%s'='%s'\n"), ! i, l_type, wxl_type, wxluaT_typename(L, wxl_type).c_str(), value.c_str()); retStr += str; OutputMsg(str); *************** *** 814,818 **** wxString info = wxString::Format(wxT("%s%-32s\t%-16s\t%-20s\t%-16s\n"), ! indentStr.c_str(), key.c_str(), wxlua_getwxluatypename(keyType).c_str(), value.c_str(), wxlua_getwxluatypename(valueType).c_str()); s += info; OutputMsg(info); --- 814,818 ---- wxString info = wxString::Format(wxT("%s%-32s\t%-16s\t%-20s\t%-16s\n"), ! indentStr.c_str(), key.c_str(), wxluaT_typename(L, keyType).c_str(), value.c_str(), wxluaT_typename(L, valueType).c_str()); s += info; OutputMsg(info); |