From: John L. <jr...@us...> - 2007-12-20 02:27:03
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: - Removed wxluabind_removetableforcall(L) used in the bindings to determine if the function was called from the tables used for class constructors. It makes more sense to call an intermediatary function to remove the table before calling the real function. - Removed the wxLuaFunction class since we no longer need it. It was a userdata with a __call metatable to call the real function we want. We now push the actual function or an overload function helper with the wxLuaBindMethod struct as an upvalue to give better error messages. The new way should be faster since it doesn't generate as much garbage. - Added wxlua_argerror(L, stack_idx, type_str) to give a far more informative message from the bindings when the wrong type is an arg to a function. - Renamed WXLUAARG_XXX to WXLUA_TXXX to match LUA_TXXX. * Do not create a separate overload function in the bindings since we can just as easily check for multiple functions using the wxLuaBindMethod and call the generic overload function or just the single function. Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** wxlstack.cpp 13 Dec 2007 00:47:53 -0000 1.28 --- wxlstack.cpp 20 Dec 2007 02:26:58 -0000 1.29 *************** *** 440,456 **** switch (dbgItem->GetValueType()) { ! case WXLUAARG_None : img = IMG_NONE; break; ! case WXLUAARG_Unknown : img = IMG_UNKNOWN; break; ! case WXLUAARG_Nil : img = IMG_NIL; break; ! case WXLUAARG_Boolean : img = IMG_BOOLEAN; break; ! case WXLUAARG_LightUserData : img = IMG_LIGHTUSERDATA; break; ! case WXLUAARG_Number : img = IMG_NUMBER; break; ! case WXLUAARG_String : img = IMG_STRING; break; ! case WXLUAARG_Table : img = IMG_TABLE; break; ! case WXLUAARG_Function : img = IMG_LUAFUNCTION; break; ! case WXLUAARG_UserData : img = IMG_USERDATA; break; ! case WXLUAARG_Thread : img = IMG_THREAD; break; ! case WXLUAARG_Integer : img = IMG_INTEGER; break; ! case WXLUAARG_CFunction : img = IMG_CFUNCTION; break; } } --- 440,456 ---- switch (dbgItem->GetValueType()) { ! case WXLUA_TUNKNOWN : img = IMG_UNKNOWN; break; ! case WXLUA_TNONE : img = IMG_NONE; break; ! case WXLUA_TNIL : img = IMG_NIL; break; ! case WXLUA_TBOOLEAN : img = IMG_BOOLEAN; break; ! case WXLUA_TLIGHTUSERDATA : img = IMG_LIGHTUSERDATA; break; ! case WXLUA_TNUMBER : img = IMG_NUMBER; break; ! case WXLUA_TSTRING : img = IMG_STRING; break; ! case WXLUA_TTABLE : img = IMG_TABLE; break; ! case WXLUA_TFUNCTION : img = IMG_LUAFUNCTION; break; ! case WXLUA_TUSERDATA : img = IMG_USERDATA; break; ! case WXLUA_TTHREAD : img = IMG_THREAD; break; ! case WXLUA_TINTEGER : img = IMG_INTEGER; break; ! case WXLUA_TCFUNCTION : img = IMG_CFUNCTION; break; } } *************** *** 576,581 **** // 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 --- 576,581 ---- // Add the locals, fake a debug item to get it setup right ! wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), WXLUA_TNONE, ! wxString::Format(wxT("%d Items"), (int)debugData.GetCount()), WXLUA_TNONE, wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED|WXLUA_DEBUGITEM_LOCALS|WXLUA_DEBUGITEM_VALUE_REF); wxLuaDebugData localData(true); // this deletes the items Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** wxldebug.cpp 15 Dec 2007 16:56:41 -0000 1.60 --- wxldebug.cpp 20 Dec 2007 02:26:58 -0000 1.61 *************** *** 139,144 **** long l1 = 0, l2 = 0; ! if ((elem1->m_itemKeyType == WXLUAARG_Number) && ! (elem2->m_itemKeyType == WXLUAARG_Number) && elem1->m_itemKey.BeforeFirst(wxT(' ')).ToLong(&l1) && elem2->m_itemKey.BeforeFirst(wxT(' ')).ToLong(&l2)) --- 139,144 ---- long l1 = 0, l2 = 0; ! if ((elem1->m_itemKeyType == WXLUA_TNUMBER) && ! (elem2->m_itemKeyType == WXLUA_TNUMBER) && elem1->m_itemKey.BeforeFirst(wxT(' ')).ToLong(&l1) && elem2->m_itemKey.BeforeFirst(wxT(' ')).ToLong(&l2)) *************** *** 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; } --- 201,205 ---- name = wxString::Format(_("line %d"), currentLine); ! Add(new wxLuaDebugItem(name, WXLUA_TNONE, wxT(""), WXLUA_TNONE, source, LUA_NOREF, stack_frame, WXLUA_DEBUGITEM_LOCALS)); ++count; } *************** *** 230,234 **** //wxPrintf(wxString(lua_Debug_to_wxString(luaDebug) + wxT(" lua_getlocal :") + name + wxT("\n")).c_str()); ! int wxl_valuetype = WXLUAARG_None; wxString value; wxString source(lua2wx(luaDebug.source)); --- 230,234 ---- //wxPrintf(wxString(lua_Debug_to_wxString(luaDebug) + wxT(" lua_getlocal :") + name + wxT("\n")).c_str()); ! int wxl_valuetype = WXLUA_TNONE; wxString value; wxString source(lua2wx(luaDebug.source)); *************** *** 248,252 **** lua_pop(L, 1); // remove variable value ! Add(new wxLuaDebugItem(name, WXLUAARG_None, value, wxl_valuetype, source, nRef, 0, flag_type)); ++count; --- 248,252 ---- lua_pop(L, 1); // remove variable value ! Add(new wxLuaDebugItem(name, WXLUA_TNONE, value, wxl_valuetype, source, nRef, 0, flag_type)); ++count; *************** *** 277,282 **** int count = 0; ! int wxl_keytype = WXLUAARG_None; ! int wxl_valuetype = WXLUAARG_None; wxString value; wxString name; --- 277,282 ---- int count = 0; ! int wxl_keytype = WXLUA_TNONE; ! int wxl_valuetype = WXLUA_TNONE; wxString value; wxString name; *************** *** 291,295 **** 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) --- 291,295 ---- lua_pop(L, 1); // pop globals table ! Add(new wxLuaDebugItem(wxT("Globals"), WXLUA_TNONE, value, WXLUA_TTABLE, wxT(""), val_ref, 0, flag_type)); } else if (tableRef == LUA_REGISTRYINDEX) *************** *** 302,306 **** lua_pop(L, 1); // pop registry table ! Add(new wxLuaDebugItem(wxT("Registry"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), val_ref, 0, flag_type)); } else --- 302,306 ---- lua_pop(L, 1); // pop registry table ! Add(new wxLuaDebugItem(wxT("Registry"), WXLUA_TNONE, value, WXLUA_TTABLE, wxT(""), val_ref, 0, flag_type)); } else *************** *** 336,340 **** // 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; --- 336,340 ---- // leading space so it's first when sorted ! Add(new wxLuaDebugItem(wxT(" __metatable"), WXLUA_TTABLE, value, wxl_valuetype, wxT(""), val_ref, nIndex, flag_type)); ++count; *************** *** 553,557 **** if (lua_iscfunction(L, stack_idx)) ! wxl_type = WXLUAARG_CFunction; break; --- 553,557 ---- if (lua_iscfunction(L, stack_idx)) ! wxl_type = WXLUA_TCFUNCTION; break; *************** *** 820,824 **** if (tableArray.Index(value) == wxNOT_FOUND) { ! if (valueType == WXLUAARG_Table) { tableArray.Add(value); --- 820,824 ---- if (tableArray.Index(value) == wxNOT_FOUND) { ! if (valueType == WXLUA_TTABLE) { tableArray.Add(value); |