From: John L. <jr...@us...> - 2009-05-14 05:06:28
|
Update of /cvsroot/wxlua/wxLua/bindings/wxlua In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9404/wxLua/bindings/wxlua Modified Files: override.hpp wxlua.i Log Message: Allow multiple inheritance in the bindings. Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/wxlua.i,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wxlua.i 17 Mar 2008 03:05:01 -0000 1.19 --- wxlua.i 14 May 2009 05:06:21 -0000 1.20 *************** *** 70,78 **** // Add the userdata object to the list of objects that will be deleted when ! // it does out of scope and the Lua garbage collector runs. // %function bool gcobject(void* object) // Remove the userdata object from the list of objects that will be deleted when ! // it does out of scope and the Lua garbage collector runs. %function bool ungcobject(void* object) --- 70,78 ---- // Add the userdata object to the list of objects that will be deleted when ! // it goes out of scope and the Lua garbage collector runs. // %function bool gcobject(void* object) // Remove the userdata object from the list of objects that will be deleted when ! // it goes out of scope and the Lua garbage collector runs. %function bool ungcobject(void* object) *************** *** 136,142 **** %function wxString type(void* object) ! // %override wString typename(int wxluaarg_tag) ! // Returns the wxLua tag name for both the predefined (negative) as well as the ! // binding class tag numbers. %function wxString typename(int wxluaarg_tag) --- 136,141 ---- %function wxString type(void* object) ! // %override wxString typename(int wxluaarg_tag) ! // Returns the wxLua name binding wxLua class type numbers. %function wxString typename(int wxluaarg_tag) *************** *** 174,183 **** int GetFunctionCount ! {wxLuaBindClass*} GetClassArray ! {wxLuaBindMethod*} GetFunctionArray ! {name, value} GetNumberArray ! {name, value} GetStringArray ! {name, eventType, wxluatype} GetEventArray ! {name, object, wxluatype} GetObjectArray %endclass --- 173,182 ---- int GetFunctionCount ! {wxLuaBindClass*} GetClassArray ! {wxLuaBindMethod*} GetFunctionArray ! {name, value} GetNumberArray ! {name, value} GetStringArray ! {name, eventType, wxluatype, wxLuaBindClass} GetEventArray ! {name, object, wxluatype, wxLuaBindClass} GetObjectArray %endclass *************** *** 191,196 **** wxClassInfo* classInfo int wxluatype ! wxString baseclassName ! wxLuaBindClass* baseclass {name, value} enums int enums_n --- 190,195 ---- wxClassInfo* classInfo int wxluatype ! {wxString} baseclassNames ! {wxLuaBindClass*} baseBindClasses {name, value} enums int enums_n Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/override.hpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** override.hpp 26 Mar 2008 05:01:29 -0000 1.22 --- override.hpp 14 May 2009 05:06:21 -0000 1.23 *************** *** 175,181 **** if (!wxlua_iswxluatype(l_type, WXLUA_TUSERDATA)) wxlua_argerror(L, 1, wxT("a 'userdata'")); ! void* o = wxlua_touserdata(L, 1, false); ! if (wxluaO_isgcobject(L, o)) { --- 175,181 ---- if (!wxlua_iswxluatype(l_type, WXLUA_TUSERDATA)) wxlua_argerror(L, 1, wxT("a 'userdata'")); ! void* o = wxlua_touserdata(L, 1, false); ! if (wxluaO_isgcobject(L, o)) { *************** *** 525,545 **** return 1; } ! else if (strcmp(idx_str, "baseclassName") == 0) { ! lua_pushstring(L, wxlClass->baseclassName); ! return 1; } ! else if (strcmp(idx_str, "baseclass") == 0) { ! if (wxlClass->baseclass) { ! const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *)); ! *ptr = wxlClass->baseclass; ! lua_newtable(L); ! lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); ! lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); ! lua_setmetatable(L, -2); return 1; --- 525,568 ---- return 1; } ! else if (strcmp(idx_str, "baseclassNames") == 0) { ! if (wxlClass->baseclassNames) ! { ! lua_newtable(L); ! for (size_t i = 0; wxlClass->baseclassNames[i]; ++i) ! { ! lua_pushstring(L, wxlClass->baseclassNames[i]); ! lua_rawseti(L, -2, i + 1); ! } ! return 1; ! } ! ! return 0; } ! else if (strcmp(idx_str, "baseBindClasses") == 0) { ! if (wxlClass->baseBindClasses) { ! lua_newtable(L); ! for (size_t i = 0; wxlClass->baseclassNames[i]; ++i) // use names to check for terminating NULL ! { ! if (wxlClass->baseBindClasses[i] == NULL) // may be NULL if not loaded ! { ! lua_pushnil(L); ! } ! else ! { ! const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *)); ! *ptr = wxlClass->baseBindClasses[i]; ! lua_newtable(L); ! lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); ! lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); ! lua_setmetatable(L, -2); ! } ! ! lua_rawseti(L, -2, i + 1); ! } return 1; *************** *** 754,757 **** --- 777,799 ---- lua_rawset(L, -3); + lua_pushstring(L, "wxLuaBindClass"); + const wxLuaBindClass* wxlClass = wxlBinding->GetBindClass(*wxlEvent->wxluatype); + if (wxlClass == NULL) + { + lua_pushnil(L); + } + else + { + const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *)); + *ptr = wxlClass; + lua_newtable(L); + lua_pushstring(L, "__index"); + lua_pushlightuserdata(L, wxlBinding); + lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1); // push func with tag as upvalue + lua_rawset(L, -3); + lua_setmetatable(L, -2); + } + lua_rawset(L, -3); + lua_rawseti(L, -2, idx + 1); } *************** *** 784,787 **** --- 826,848 ---- lua_rawset(L, -3); + lua_pushstring(L, "wxLuaBindClass"); + const wxLuaBindClass* wxlClass = wxlBinding->GetBindClass(*wxlObject->wxluatype); + if (wxlClass == NULL) + { + lua_pushnil(L); + } + else + { + const void **ptr = (const void **)lua_newuserdata(L, sizeof(void *)); + *ptr = wxlClass; + lua_newtable(L); + lua_pushstring(L, "__index"); + lua_pushlightuserdata(L, wxlBinding); + lua_pushcclosure(L, wxluabind_wxLuaBindClass__index, 1); // push func with tag as upvalue + lua_rawset(L, -3); + lua_setmetatable(L, -2); + } + lua_rawset(L, -3); + lua_rawseti(L, -2, idx + 1); } |