From: John L. <jr...@us...> - 2007-11-17 00:16:56
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/bindings/wxwidgets Modified Files: wxbase_override.hpp wxbase_rules.lua wxcore_override.hpp wxhtml_override.hpp Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxhtml_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxhtml_override.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxhtml_override.hpp 16 Jul 2007 19:34:26 -0000 1.1 --- wxhtml_override.hpp 17 Nov 2007 00:14:55 -0000 1.2 *************** *** 87,91 **** default: ! wxlState.terror("wxLua: Expected simple type for parameter 3."); break; } --- 87,91 ---- default: ! wxlState.wxlua_Error("wxLua: Expected simple type for parameter 3."); break; } Index: wxbase_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_override.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxbase_override.hpp 1 Aug 2007 19:15:31 -0000 1.4 --- wxbase_override.hpp 17 Nov 2007 00:14:55 -0000 1.5 *************** *** 424,428 **** { lua_pushvalue(L, 1); ! wxObject *pObject = (wxObject *)wxlState.ttouserdata( 1 ); const wxLuaBindClass *pClass = wxlState.GetLuaClass(className); --- 424,428 ---- { lua_pushvalue(L, 1); ! wxObject *pObject = (wxObject *)wxlState.wxlua_ToUserdata( 1 ); const wxLuaBindClass *pClass = wxlState.GetLuaClass(className); *************** *** 431,446 **** if (pObject->IsKindOf(pClass->classInfo)) { ! wxlState.tsettag(*pClass->class_tag); iResult = 1; } else ! wxlState.terror("wxLua: DynamicCast: Unable to cast to a class of this type."); } if (iResult == 0) ! wxlState.terror("wxObject:DynamicCast: Class not found."); } else ! wxlState.terror("wxObject:DynamicCast: Expected a string name of the class for parameter 2."); return iResult; --- 431,446 ---- if (pObject->IsKindOf(pClass->classInfo)) { ! wxlState.wxluaT_SetTag(*pClass->class_tag); iResult = 1; } else ! wxlState.wxlua_Error("wxLua: DynamicCast: Unable to cast to a class of this type."); } if (iResult == 0) ! wxlState.wxlua_Error("wxObject:DynamicCast: Class not found."); } else ! wxlState.wxlua_Error("wxObject:DynamicCast: Expected a string name of the class for parameter 2."); return iResult; Index: wxbase_rules.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_rules.lua,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxbase_rules.lua 19 Jul 2007 03:09:46 -0000 1.3 --- wxbase_rules.lua 17 Nov 2007 00:14:55 -0000 1.4 *************** *** 138,146 **** lua_State* L = wxLS.GetLuaState(); ! if (registerTypes) ! g_wxluatag_NULL = wxLS.tnewtag(); lua_pushlstring(L, "NULL", 4); ! wxLS.tpushusertag(NULL, g_wxluatag_NULL, true); lua_rawset(L, luaTable); ]] --- 138,145 ---- lua_State* L = wxLS.GetLuaState(); ! g_wxluatag_NULL = wxLS.wxluaT_NewTag(); lua_pushlstring(L, "NULL", 4); ! wxLS.wxluaT_PushUserTag(NULL, g_wxluatag_NULL, true); lua_rawset(L, luaTable); ]] Index: wxcore_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxcore_override.hpp 1 Aug 2007 19:15:31 -0000 1.4 --- wxcore_override.hpp 17 Nov 2007 00:14:55 -0000 1.5 *************** *** 413,417 **** } else ! wxlState.terror(wxString::Format(_("wxLua: Expected lua function(long item1, long item2, long data) for parameter %d, but got '%s'."), 2, wxlState.lua_TypeNameIndex(1).c_str())); // get this --- 413,417 ---- } else ! wxlState.wxlua_Error(wxString::Format(_("wxLua: Expected lua function(long item1, long item2, long data) for parameter %d, but got '%s'."), 2, wxlState.lua_TypeNameIndex(1).c_str())); // get this *************** *** 807,811 **** // wxKillError rc = NULL wxKillError rc = wxKILL_OK; ! //wxKillError * rc = (argCount >= 3 ? (wxKillError *)wxlState.ttouserdata(3) : NULL); // wxSignal sig = wxSIGTERM wxSignal sig = (argCount >= 2 ? (wxSignal)wxlua_getintegertype(L, 2) : wxSIGTERM); --- 807,811 ---- // wxKillError rc = NULL wxKillError rc = wxKILL_OK; ! //wxKillError * rc = (argCount >= 3 ? (wxKillError *)wxlState.wxluaT_ToUserdata(3) : NULL); // wxSignal sig = wxSIGTERM wxSignal sig = (argCount >= 2 ? (wxSignal)wxlua_getintegertype(L, 2) : wxSIGTERM); *************** *** 1157,1161 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; --- 1157,1161 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; *************** *** 1166,1170 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 1166,1170 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 1182,1186 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 1182,1186 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 1205,1209 **** else { ! wxlState.terror("wxLua: Connect: Unexpected event object type, expected a wxWindow."); return 0; } --- 1205,1209 ---- else { ! wxlState.wxlua_Error("wxLua: Connect: Unexpected event object type, expected a wxWindow."); return 0; } *************** *** 1213,1217 **** default: { ! wxlState.terror("wxLua: wxEvtHandler Connect: Incorrect number of parameters."); return 0; } --- 1213,1217 ---- default: { ! wxlState.wxlua_Error("wxLua: wxEvtHandler Connect: Incorrect number of parameters."); return 0; } *************** *** 1220,1224 **** if (!lua_isfunction(L, func_idx)) { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Callback function is not a valid Lua function for parameter %d."), func_idx-1)); // -1 for self return 0; --- 1220,1224 ---- if (!lua_isfunction(L, func_idx)) { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Callback function is not a valid Lua function for parameter %d."), func_idx-1)); // -1 for self return 0; *************** *** 1229,1233 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Connect: Invalid wxEvent type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; --- 1229,1233 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Connect: Invalid wxEvent type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; *************** *** 1271,1275 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; --- 1271,1275 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid lastId, expected a number for parameter 2, got '%s'."), wxlState.lua_TypeNameIndex(3).c_str())); return 0; *************** *** 1280,1284 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 1280,1284 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid winId, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 1295,1299 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; --- 1295,1299 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid id, expected a number for parameter 1, got '%s'."), wxlState.lua_TypeNameIndex(2).c_str())); return 0; *************** *** 1310,1314 **** default: { ! wxlState.terror("wxLua: Disconnect: Incorrect number of parameters."); return 0; } --- 1310,1314 ---- default: { ! wxlState.wxlua_Error("wxLua: Disconnect: Incorrect number of parameters."); return 0; } *************** *** 1319,1323 **** else { ! wxlState.terror(wxString::Format(wxT("wxLua: Disconnect: Invalid event type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; --- 1319,1323 ---- else { ! wxlState.wxlua_Error(wxString::Format(wxT("wxLua: Disconnect: Invalid event type, expected a number for parameter %d, got '%s'."), evttype_idx - 1, wxlState.lua_TypeNameIndex(evttype_idx).c_str())); return 0; *************** *** 1453,1457 **** size_t nn = (size_t)n; if ((nn > blue_len)||(nn > green_len)||(nn > red_len)) ! wxlState.terror("Invalid palette lengths for wxPalette constructor"); // get this wxPalette *self = (wxPalette *)wxlState.GetUserDataType(1, s_wxluatag_wxPalette); --- 1453,1457 ---- size_t nn = (size_t)n; if ((nn > blue_len)||(nn > green_len)||(nn > red_len)) ! wxlState.wxlua_Error("Invalid palette lengths for wxPalette constructor"); // get this wxPalette *self = (wxPalette *)wxlState.GetUserDataType(1, s_wxluatag_wxPalette); *************** *** 1916,1920 **** wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.terror("Invalid data or wxImage to SetAlphaData to"); // don't actually call SetAlpha since it takes ownership of data // just copy it to the image --- 1916,1920 ---- wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.wxlua_Error("Invalid data or wxImage to SetAlphaData to"); // don't actually call SetAlpha since it takes ownership of data // just copy it to the image *************** *** 1938,1942 **** wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.terror("Invalid data or wxImage to SetData to"); // don't actually call SetData since it takes ownership of data // just copy it to the image --- 1938,1942 ---- wxImage *self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); // call SetData ! if ((len == 0) || !self->Ok()) wxlState.wxlua_Error("Invalid data or wxImage to SetData to"); // don't actually call SetData since it takes ownership of data // just copy it to the image *************** *** 1966,1970 **** static int LUACALL wxLua_wxImageHistogram_iterator_Set_first(lua_State *L) { ! wxlua_terror(L, "You cannot set the first element of a wxHashTable, do not use wxImageHistogram::iterator::SetFirst()."); return 0; /* --- 1966,1970 ---- static int LUACALL wxLua_wxImageHistogram_iterator_Set_first(lua_State *L) { ! wxlua_error(L, "You cannot set the first element of a wxHashTable, do not use wxImageHistogram::iterator::SetFirst()."); return 0; /* |