From: John L. <jr...@us...> - 2007-02-26 05:17:33
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16333/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp Log Message: rem out debugging code in wxlbind.cpp only measure the text height once for the stack window make scribble faster by drawing to the window first Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** wxlbind.cpp 26 Feb 2007 01:57:06 -0000 1.51 --- wxlbind.cpp 26 Feb 2007 05:17:29 -0000 1.52 *************** *** 93,100 **** wxLuaObject::wxLuaObject(const wxLuaState& wxlState, int iParam) ! : m_wxlState(NULL), m_bool(false), m_int(0), m_alloc_flags(wxLUAOBJECT_NONE) { - m_wxlState = new wxLuaState(wxlState); // set up the reference m_iReference = m_wxlState->tinsert(iParam); --- 93,99 ---- wxLuaObject::wxLuaObject(const wxLuaState& wxlState, int iParam) ! : m_wxlState(new wxLuaState(wxlState)), m_bool(false), m_int(0), m_alloc_flags(wxLUAOBJECT_NONE) { // set up the reference m_iReference = m_wxlState->tinsert(iParam); *************** *** 114,121 **** return (m_wxlState != NULL) ? *m_wxlState : wxNullLuaState; } - lua_State* wxLuaObject::GetLuaState() const - { - return GetwxLuaState().GetLuaState(); - } int wxLuaObject::SetAllocationFlag(wxLuaObject_Type flag, bool set) --- 113,116 ---- *************** *** 131,136 **** bool wxLuaObject::GetObject() { ! lua_State* L = GetLuaState(); ! wxCHECK_MSG(L, false, wxT("Invalid wxLuaState")); if (HasAllocationFlag(wxLUAOBJECT_BOOL)) --- 126,131 ---- bool wxLuaObject::GetObject() { ! wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); ! lua_State* L = m_wxlState->GetLuaState(); if (HasAllocationFlag(wxLUAOBJECT_BOOL)) *************** *** 167,170 **** --- 162,166 ---- void wxLuaObject::SetObject(int iParam) { + wxCHECK_RET(m_wxlState->Ok(), wxT("Invalid wxLuaState")); if (m_wxlState->Ok() && (m_iReference != LUA_NOREF)) // FIXME should this error out? m_wxlState->tremove(m_iReference); *************** *** 178,184 **** bool *wxLuaObject::GetBoolPtr() { if (m_wxlState->Ok() && (m_iReference != LUA_NOREF) && GetObject()) { ! m_bool = (lua_tonumber(GetLuaState(), -1) != 0); m_alloc_flags |= wxLUAOBJECT_BOOL; } --- 174,181 ---- bool *wxLuaObject::GetBoolPtr() { + wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); if (m_wxlState->Ok() && (m_iReference != LUA_NOREF) && GetObject()) { ! m_bool = (lua_tonumber(m_wxlState->GetLuaState(), -1) != 0); m_alloc_flags |= wxLUAOBJECT_BOOL; } *************** *** 188,194 **** int *wxLuaObject::GetIntPtr() { if (m_wxlState->Ok() && (m_iReference != LUA_NOREF) && GetObject()) { ! m_int = (int) lua_tonumber(GetLuaState(), -1); m_alloc_flags |= wxLUAOBJECT_INT; } --- 185,192 ---- int *wxLuaObject::GetIntPtr() { + wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); if (m_wxlState->Ok() && (m_iReference != LUA_NOREF) && GetObject()) { ! m_int = (int) lua_tonumber(m_wxlState->GetLuaState(), -1); m_alloc_flags |= wxLUAOBJECT_INT; } *************** *** 198,204 **** wxString *wxLuaObject::GetStringPtr() { if (m_wxlState->Ok() && (m_iReference != LUA_NOREF) && GetObject()) { ! m_string = lua2wx(lua_tostring(GetLuaState(), -1)); m_alloc_flags |= wxLUAOBJECT_STRING; } --- 196,203 ---- wxString *wxLuaObject::GetStringPtr() { + wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); if (m_wxlState->Ok() && (m_iReference != LUA_NOREF) && GetObject()) { ! m_string = lua2wx(lua_tostring(m_wxlState->GetLuaState(), -1)); m_alloc_flags |= wxLUAOBJECT_STRING; } *************** *** 208,214 **** wxArrayInt *wxLuaObject::GetArrayPtr() { if (m_wxlState->Ok() && (m_iReference != LUA_NOREF) && GetObject()) { ! lua_State* L = GetLuaState(); if (lua_istable(L, -1)) { --- 207,214 ---- wxArrayInt *wxLuaObject::GetArrayPtr() { + wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); if (m_wxlState->Ok() && (m_iReference != LUA_NOREF) && GetObject()) { ! lua_State* L = m_wxlState->GetLuaState(); if (lua_istable(L, -1)) { *************** *** 278,283 **** wxLuaStringToLongHashMap *pHashTable = (wxLuaStringToLongHashMap *)it->second; ! if (pHashTable != NULL) ! delete pHashTable; it->second = 0; --- 278,282 ---- wxLuaStringToLongHashMap *pHashTable = (wxLuaStringToLongHashMap *)it->second; ! delete pHashTable; it->second = 0; *************** *** 288,295 **** // LuaDelete is placed at the end, so start there first and if found // call the function ! int iMethod, method_count = pClass->num_methods; ! for (iMethod = method_count-1; iMethod >= 0; --iMethod) { ! WXLUAMETHOD *pMethod = pClass->methods + iMethod; if (pMethod->type == LuaDelete) { --- 287,294 ---- // LuaDelete is placed at the end, so start there first and if found // call the function ! int i_method, method_count = pClass->num_methods; ! for (i_method = method_count-1; i_method >= 0; --i_method) { ! WXLUAMETHOD *pMethod = pClass->methods + i_method; if (pMethod->type == LuaDelete) { *************** *** 415,419 **** const char *cpIndex = lua_tostring(L, 2); ! wxPrintf(wxT("wxLua_lua_setTableFunc '%s'\n"), lua2wx(cpIndex).c_str()); if ((pClass != NULL) && lua_isuserdata(L, 1) && --- 414,418 ---- const char *cpIndex = lua_tostring(L, 2); ! //wxPrintf(wxT("wxLua_lua_setTableFunc '%s'\n"), lua2wx(cpIndex).c_str()); if ((pClass != NULL) && lua_isuserdata(L, 1) && *************** *** 447,451 **** } ! wxString index = lua2wx(cpIndex); if (!fCreated) { --- 446,450 ---- } ! wxString index(lua2wx(cpIndex)); if (!fCreated) { |