From: John L. <jr...@us...> - 2005-11-29 23:52:21
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1493/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp Log Message: reorder libs in apps.bkl and rebake, (remove -- in bkl, got error) pulled in generic code in wxLuaInterface into the wxLuaState Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxldebug.cpp 29 Nov 2005 05:45:10 -0000 1.4 --- wxldebug.cpp 29 Nov 2005 23:52:12 -0000 1.5 *************** *** 188,306 **** { size_t idx, idxMax = m_references.GetCount(); - lua_State* L = GetLuaState(); for (idx = 0; idx < idxMax; ++idx) { int iItem = m_references.Item(idx); ! tremove(L, iItem); } } - int wxLuaInterface::GetStack(int nIndex, lua_Debug *luaDebug) - { - return lua_getstack(GetLuaState(), nIndex, luaDebug); - } - - bool wxLuaInterface::GetInfo(const wxString &what, lua_Debug *luaDebug) - { - return (lua_getinfo(GetLuaState(), wx2lua(what), luaDebug) != 0); - } - - wxString wxLuaInterface::GetLocal(lua_Debug *luaDebug, int index) - { - return lua2wx(lua_getlocal(GetLuaState(), luaDebug, index)); - } - - void wxLuaInterface::GetGlobals() - { - lua_pushvalue(GetLuaState(), LUA_GLOBALSINDEX); - } - - int wxLuaInterface::GetTop() - { - return lua_gettop(GetLuaState()); - } - - int wxLuaInterface::Type(int index) - { - return lua_type(GetLuaState(), index); - } - - double wxLuaInterface::ToNumber(int index) - { - return lua_tonumber(GetLuaState(), index); - } - - int wxLuaInterface::ToBoolean(int index) - { - return lua_toboolean(GetLuaState(), index); - } - - wxString wxLuaInterface::ToString(int index) - { - return lua2wx(lua_tostring(GetLuaState(), index)); - } - - const void *wxLuaInterface::ToPointer(int index) - { - return lua_topointer(GetLuaState(), index); - } - - bool wxLuaInterface::IsCFunction(int index) - { - return lua_iscfunction(GetLuaState(), index) != 0; - } - - const void *wxLuaInterface::ToCFunction(int index) - { - return (const void *) lua_tocfunction(GetLuaState(), index); - } - - const void *wxLuaInterface::ToUserData(int index) - { - return lua_touserdata(GetLuaState(), index); - } - - int wxLuaInterface::GetTag(int index) - { - return ttag(GetLuaState(), index); - } - - int wxLuaInterface::GetN(int index) - { - return luaL_getn(GetLuaState(), index); - } - int wxLuaInterface::Ref() { ! int nReference = tinsert(GetLuaState(), -1); m_references.Add(nReference); return nReference; } - int wxLuaInterface::GetRef(int ref) - { - return tget(GetLuaState(), ref); - } - - void wxLuaInterface::Pop(int count) - { - lua_pop(GetLuaState(), count); - } - - void wxLuaInterface::PushNil() - { - lua_pushnil(GetLuaState()); - } - - void wxLuaInterface::PushValue(int index) - { - lua_pushvalue(GetLuaState(), index); - } - - int wxLuaInterface::Next(int index) - { - return lua_next(GetLuaState(), index); - } - wxLuaDebugData *wxLuaInterface::BuildStack() { --- 188,205 ---- { size_t idx, idxMax = m_references.GetCount(); for (idx = 0; idx < idxMax; ++idx) { int iItem = m_references.Item(idx); ! m_wxlState.tremove(iItem); } } int wxLuaInterface::Ref() { ! int nReference = m_wxlState.tinsert(-1); m_references.Add(nReference); return nReference; } wxLuaDebugData *wxLuaInterface::BuildStack() { *************** *** 312,318 **** bool fFirst = true; ! while (GetStack(nIndex, &luaDebug) != 0) { ! if (GetInfo(wxT("Sln"), &luaDebug)) { wxString itemName; --- 211,217 ---- bool fFirst = true; ! while (m_wxlState.GetStack(nIndex, &luaDebug) != 0) { ! if (m_wxlState.GetInfo("Sln", &luaDebug) != 0) { wxString itemName; *************** *** 349,356 **** { lua_Debug luaDebug; ! if (GetStack(nEntry, &luaDebug) != 0) { int idx = 1; ! wxString name = GetLocal(&luaDebug, idx); while (!name.IsEmpty()) { --- 248,255 ---- { lua_Debug luaDebug; ! if (m_wxlState.GetStack(nEntry, &luaDebug) != 0) { int idx = 1; ! wxString name = m_wxlState.GetLocalwxString(&luaDebug, idx); while (!name.IsEmpty()) { *************** *** 360,364 **** wxString source = lua2wx(luaDebug.source); ! switch (Type(-1)) { case LUA_TNIL: --- 259,263 ---- wxString source = lua2wx(luaDebug.source); ! switch (m_wxlState.Type(-1)) { case LUA_TNIL: *************** *** 369,383 **** case LUA_TBOOLEAN: type = wxT("Boolean"); ! value = MakeBoolean(ToBoolean(-1)); break; case LUA_TNUMBER: type = wxT("Number"); ! value = MakeNumber(ToNumber(-1)); break; case LUA_TSTRING: type = wxT("String"); ! value = ToString(-1); break; --- 268,282 ---- case LUA_TBOOLEAN: type = wxT("Boolean"); ! value = MakeBoolean(m_wxlState.ToBoolean(-1)); break; case LUA_TNUMBER: type = wxT("Number"); ! value = MakeNumber(m_wxlState.ToNumber(-1)); break; case LUA_TSTRING: type = wxT("String"); ! value = m_wxlState.TowxString(-1); break; *************** *** 389,401 **** case LUA_TFUNCTION: ! if (IsCFunction(-1)) { type = wxT("C Function"); ! value.Printf(wxT("%p"), ToCFunction(-1)); } else { type = wxT("Lua Function"); ! value.Printf(wxT("%p"), ToPointer(-1)); } break; --- 288,300 ---- case LUA_TFUNCTION: ! if (m_wxlState.IsCFunction(-1)) { type = wxT("C Function"); ! value.Printf(wxT("%p"), m_wxlState.ToCFunction(-1)); } else { type = wxT("Lua Function"); ! value.Printf(wxT("%p"), m_wxlState.ToPointer(-1)); } break; *************** *** 413,417 **** case LUA_TTHREAD: type = wxT("Thread"); ! value.Printf(wxT("%p"), ToPointer(-1)); break; } --- 312,316 ---- case LUA_TTHREAD: type = wxT("Thread"); ! value.Printf(wxT("%p"), m_wxlState.ToPointer(-1)); break; } *************** *** 424,433 **** } else ! Pop(1); wxLuaDebugDataItem *item = new wxLuaDebugDataItem(name, type, value, source, nRef, 0); pSortedList->Add(item); ! name = GetLocal(&luaDebug, ++idx); } } --- 323,332 ---- } else ! m_wxlState.Pop(1); wxLuaDebugDataItem *item = new wxLuaDebugDataItem(name, type, value, source, nRef, 0); pSortedList->Add(item); ! name = m_wxlState.GetLocalwxString(&luaDebug, ++idx); } } *************** *** 440,452 **** { wxLuaDebugData *pSortedList = new wxLuaDebugData(); ! if ((pSortedList != NULL) && (GetRef(nRef) != 0)) { ! int nTop = GetTop(); // start iterating ! PushNil(); ! while (Next(nTop) != 0) { ! bool fIsTable = false; wxString type; wxString value; --- 339,351 ---- { wxLuaDebugData *pSortedList = new wxLuaDebugData(); ! if ((pSortedList != NULL) && (m_wxlState.tget(nRef) != 0)) { ! int nTop = m_wxlState.GetTop(); // start iterating ! m_wxlState.PushNil(); ! while (m_wxlState.Next(nTop) != 0) { ! bool fIsTable = false; wxString type; wxString value; *************** *** 455,459 **** // get the index ! switch (Type(-2)) { case LUA_TNIL: --- 354,358 ---- // get the index ! switch (m_wxlState.Type(-2)) { case LUA_TNIL: *************** *** 462,474 **** case LUA_TBOOLEAN: ! name = MakeBoolean(ToBoolean(-2)); break; case LUA_TNUMBER: ! name = MakeNumber(ToNumber(-2)); break; case LUA_TSTRING: ! name = ToString(-2); break; --- 361,373 ---- case LUA_TBOOLEAN: ! name = MakeBoolean(m_wxlState.ToBoolean(-2)); break; case LUA_TNUMBER: ! name = MakeNumber(m_wxlState.ToNumber(-2)); break; case LUA_TSTRING: ! name = m_wxlState.TowxString(-2); break; *************** *** 478,485 **** case LUA_TFUNCTION: ! if (IsCFunction(-2)) ! name.Printf(wxT("%p"), ToCFunction(-2)); else ! name.Printf(wxT("%p"), ToPointer(-2)); break; --- 377,384 ---- case LUA_TFUNCTION: ! if (m_wxlState.IsCFunction(-2)) ! name.Printf(wxT("%p"), m_wxlState.ToCFunction(-2)); else ! name.Printf(wxT("%p"), m_wxlState.ToPointer(-2)); break; *************** *** 494,498 **** // get the value ! switch (Type(-1)) { case LUA_TNIL: --- 393,397 ---- // get the value ! switch (m_wxlState.Type(-1)) { case LUA_TNIL: *************** *** 502,511 **** case LUA_TBOOLEAN: ! value = MakeBoolean(ToBoolean(-1)); type = wxT("Boolean"); break; case LUA_TNUMBER: ! value = MakeNumber(ToNumber(-1)); type = wxT("Number"); break; --- 401,410 ---- case LUA_TBOOLEAN: ! value = MakeBoolean(m_wxlState.ToBoolean(-1)); type = wxT("Boolean"); break; case LUA_TNUMBER: ! value = MakeNumber(m_wxlState.ToNumber(-1)); type = wxT("Number"); break; *************** *** 513,517 **** case LUA_TSTRING: type = wxT("String"); ! value = ToString(-1); break; --- 412,416 ---- case LUA_TSTRING: type = wxT("String"); ! value = m_wxlState.TowxString(-1); break; *************** *** 523,535 **** case LUA_TFUNCTION: ! if (IsCFunction(-1)) { type = wxT("C Function"); ! value.Printf(wxT("%p"), ToCFunction(-1)); } else { type = wxT("Lua Function"); ! value.Printf(wxT("%p"), ToPointer(-1)); } break; --- 422,434 ---- case LUA_TFUNCTION: ! if (m_wxlState.IsCFunction(-1)) { type = wxT("C Function"); ! value.Printf(wxT("%p"), m_wxlState.ToCFunction(-1)); } else { type = wxT("Lua Function"); ! value.Printf(wxT("%p"), m_wxlState.ToPointer(-1)); } break; *************** *** 547,551 **** case LUA_TTHREAD: type = wxT("Thread"); ! value.Printf(wxT("%p"), ToPointer(-1)); break; } --- 446,450 ---- case LUA_TTHREAD: type = wxT("Thread"); ! value.Printf(wxT("%p"), m_wxlState.ToPointer(-1)); break; } *************** *** 555,559 **** nRef = Ref(); else ! Pop(1); wxLuaDebugDataItem *item = new wxLuaDebugDataItem(name, type, value, source, nRef, nIndex); --- 454,458 ---- nRef = Ref(); else ! m_wxlState.Pop(1); wxLuaDebugDataItem *item = new wxLuaDebugDataItem(name, type, value, source, nRef, nIndex); *************** *** 562,566 **** // remove reference ! Pop(1); } return pSortedList; --- 461,465 ---- // remove reference ! m_wxlState.Pop(1); } return pSortedList; *************** *** 571,576 **** wxString tableInfo; ! int nItems = GetN(index); ! const void *pItem = ToPointer(index); if (nItems == 0) --- 470,475 ---- wxString tableInfo; ! int nItems = m_wxlState.GetN(index); ! const void *pItem = m_wxlState.ToPointer(index); if (nItems == 0) *************** *** 589,604 **** { wxString pTagName; ! int nTag = GetTag(index); if (nTag != TLUA_NOTAG) ! pTagName = lua2wx(GetLuaTagName(GetLuaState(), nTag)); if (pTagName != wxEmptyString) ! userdatainfo.Printf(wxT("%p (%s)"), ToUserData(index), pTagName.c_str()); else ! userdatainfo.Printf(wxT("%p (%u)"), ToUserData(index), nTag); } else ! userdatainfo.Printf(wxT("%p"), ToUserData(index)); return userdatainfo; --- 488,503 ---- { wxString pTagName; ! int nTag = m_wxlState.ttag(index); if (nTag != TLUA_NOTAG) ! pTagName = lua2wx(m_wxlState.GetLuaTagName(nTag)); if (pTagName != wxEmptyString) ! userdatainfo.Printf(wxT("%p (%s)"), m_wxlState.ToUserData(index), pTagName.c_str()); else ! userdatainfo.Printf(wxT("%p (%u)"), m_wxlState.ToUserData(index), nTag); } else ! userdatainfo.Printf(wxT("%p"), m_wxlState.ToUserData(index)); return userdatainfo; *************** *** 635,639 **** if (pSortedList != NULL) { ! GetGlobals(); int nRef = Ref(); pSortedList->Add(new wxLuaDebugDataItem(wxT("Globals"), wxT(""), wxT(""), wxT(""), nRef, 0)); --- 534,538 ---- if (pSortedList != NULL) { ! m_wxlState.GetGlobals(); int nRef = Ref(); pSortedList->Add(new wxLuaDebugDataItem(wxT("Globals"), wxT(""), wxT(""), wxT(""), nRef, 0)); |