From: John L. <jr...@us...> - 2007-06-08 03:40:56
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30668/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Move all lua includes to wxldefs.h Fix node != NULL warning Make wxImageHistogram::iterator::SetFirst error out since you cannot set first value of a wxHashMap Fix unicode error in wxlbind.cpp Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** wxlstate.cpp 6 Jun 2007 23:43:16 -0000 1.103 --- wxlstate.cpp 8 Jun 2007 03:40:51 -0000 1.104 *************** *** 40,48 **** #include "wx/tokenzr.h" - extern "C" - { - #include "lua/src/lstate.h" - } - extern int wxLuaEventListCompareFn(const void *p1, const void *p2); // wxlbind.cpp extern int wxLuaClassListCompareByTag(const void *p1, const void *p2); // wxlbind.cpp --- 40,43 ---- *************** *** 534,538 **** case WXLUAARG_LuaThread : return wxT("thread"); case WXLUAARG_Enum : return wxT("enum"); ! } return wxEmptyString; --- 529,533 ---- case WXLUAARG_LuaThread : return wxT("thread"); case WXLUAARG_Enum : return wxT("enum"); ! } return wxEmptyString; *************** *** 833,837 **** wxWindowList::compatibility_iterator node = list->GetFirst(); ! while (node != NULL) { wxWindow *win = (wxWindow *)node->GetData(); --- 828,832 ---- wxWindowList::compatibility_iterator node = list->GetFirst(); ! while (node) { wxWindow *win = (wxWindow *)node->GetData(); *************** *** 2439,2443 **** } ! baseClass = baseClass->baseclass; } } --- 2434,2438 ---- } ! baseClass = baseClass->baseclass; } } *************** *** 3259,3263 **** wxArrayString wxLuaState::CreateMethodArgTagsMsg(struct wxLuaBindMethod* wxlMethod) { ! wxArrayString overloadMethodArray; wxCHECK_MSG(wxlMethod, overloadMethodArray, wxT("Invalid method table")); --- 3254,3258 ---- wxArrayString wxLuaState::CreateMethodArgTagsMsg(struct wxLuaBindMethod* wxlMethod) { ! wxArrayString overloadMethodArray; wxCHECK_MSG(wxlMethod, overloadMethodArray, wxT("Invalid method table")); *************** *** 3303,3308 **** fnOverload += GetLuaTagName(tag); ! ! if ((arg == 0) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && --- 3298,3303 ---- fnOverload += GetLuaTagName(tag); ! ! if ((arg == 0) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && *************** *** 3389,3393 **** if (!func->argtags[arg_wxlua]) { ! funcArray.RemoveAt(i); i--; continue; --- 3384,3388 ---- if (!func->argtags[arg_wxlua]) { ! funcArray.RemoveAt(i); i--; continue; *************** *** 3399,3403 **** //wxPrintf(wxT("ARG '%s' type %d argCount %d arg %d arg_lua %d arg_wxlua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, argCount, arg, arg_lua, arg_wxlua, ltype, tag, i, funcArray.GetCount()); ! // Does the lua type match the wxlua arg tag type int is_ok = wxlua_iswxluatype(ltype, tag); --- 3394,3398 ---- //wxPrintf(wxT("ARG '%s' type %d argCount %d arg %d arg_lua %d arg_wxlua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, argCount, arg, arg_lua, arg_wxlua, ltype, tag, i, funcArray.GetCount()); ! // Does the lua type match the wxlua arg tag type int is_ok = wxlua_iswxluatype(ltype, tag); *************** *** 3405,3409 **** if (is_ok == -1) { ! is_ok = (IsUserDataType(arg_lua, tag) || (tag == M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_NULL)) ? 1 : 0; } --- 3400,3404 ---- if (is_ok == -1) { ! is_ok = (IsUserDataType(arg_lua, tag) || (tag == M_WXLSTATEDATA->m_wxlStateData->m_wxluatag_NULL)) ? 1 : 0; } *************** *** 3412,3416 **** if (is_ok == 0) { ! funcArray.RemoveAt(i); i--; continue; --- 3407,3411 ---- if (is_ok == 0) { ! funcArray.RemoveAt(i); i--; continue; *************** *** 3419,3423 **** } ! // If there was a function that matched run it, if > 1 ??? // Note that the top function is the one that is highest in the // derived functions from any baseclasses and should be the best choice. --- 3414,3418 ---- } ! // If there was a function that matched run it, if > 1 ??? // Note that the top function is the one that is highest in the // derived functions from any baseclasses and should be the best choice. *************** *** 3447,3451 **** { fnCall += lua_TypeName(ltype); ! } else { --- 3442,3446 ---- { fnCall += lua_TypeName(ltype); ! } else { *************** *** 3469,3473 **** } ! if (bestFunc == NULL) errmsg += wxString::Format(wxT("wxLua overloaded function %s has invalid argument\n%s"), fnCall.c_str(), fnOverloadList.c_str()); else --- 3464,3468 ---- } ! if (bestFunc == NULL) errmsg += wxString::Format(wxT("wxLua overloaded function %s has invalid argument\n%s"), fnCall.c_str(), fnOverloadList.c_str()); else *************** *** 3488,3492 **** } } ! method = method->basemethod; } --- 3483,3487 ---- } } ! method = method->basemethod; } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** wxlbind.cpp 8 Jun 2007 01:36:31 -0000 1.66 --- wxlbind.cpp 8 Jun 2007 03:40:51 -0000 1.67 *************** *** 1004,1012 **** wxLuaBindMethod* wxlMethod_i = NULL; ! for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass_i) { wxlMethod_i = wxlClass_i->methods; int i_method, methods_n = wxlClass_i->methods_n; ! for (i_method = 0; i_method < methods_n; ++i_method, ++wxlMethod_i) { --- 1004,1012 ---- wxLuaBindMethod* wxlMethod_i = NULL; ! for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass_i) { wxlMethod_i = wxlClass_i->methods; int i_method, methods_n = wxlClass_i->methods_n; ! for (i_method = 0; i_method < methods_n; ++i_method, ++wxlMethod_i) { *************** *** 1025,1033 **** wxLuaBindCFunc* wxlCFunc_i = NULL; ! for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass_i) { wxlMethod_i = wxlClass_i->methods; int i_method, methods_n = wxlClass_i->methods_n; ! for (i_method = 0; i_method < methods_n; ++i_method, ++wxlMethod_i) { --- 1025,1033 ---- wxLuaBindCFunc* wxlCFunc_i = NULL; ! for (size_t i_class = 0; i_class < m_classCount; ++i_class, ++wxlClass_i) { wxlMethod_i = wxlClass_i->methods; int i_method, methods_n = wxlClass_i->methods_n; ! for (i_method = 0; i_method < methods_n; ++i_method, ++wxlMethod_i) { *************** *** 1057,1061 **** void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindCFunc* wxlCFunc= (wxLuaBindCFunc*)*ptr; ! wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1)); int idx_type = lua_type(L, 2); --- 1057,1061 ---- void **ptr = (void **)lua_touserdata(L, 1); wxLuaBindCFunc* wxlCFunc= (wxLuaBindCFunc*)*ptr; ! //wxLuaBinding *wxlBinding = (wxLuaBinding *)lua_touserdata(L, lua_upvalueindex(1)); int idx_type = lua_type(L, 2); *************** *** 1093,1100 **** for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) { ! lua_pushnumber(L, *wxlCFunc->argtags[idx]); lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1093,1100 ---- for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) { ! lua_pushnumber(L, *wxlCFunc->argtags[idx]); lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1107,1114 **** for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) { ! lua_pushstring(L, wxlState.GetLuaTagName(*wxlCFunc->argtags[idx])); lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1107,1114 ---- for (idx = 0; (idx < count) && wxlCFunc->argtags[idx]; ++idx) { ! lua_pushstring(L, wx2lua(wxlState.GetLuaTagName(*wxlCFunc->argtags[idx]))); lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1161,1167 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindCFunc_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); --- 1161,1167 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindCFunc_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); *************** *** 1184,1190 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); --- 1184,1190 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); *************** *** 1230,1234 **** size_t idx, count = wxlClass->methods_n; lua_createtable(L, count, 0); ! for (idx = 0; idx < count; ++idx, ++wxlMethod) { --- 1230,1234 ---- size_t idx, count = wxlClass->methods_n; lua_createtable(L, count, 0); ! for (idx = 0; idx < count; ++idx, ++wxlMethod) { *************** *** 1241,1249 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } --- 1241,1249 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } *************** *** 1251,1255 **** return 1; } ! return 0; } --- 1251,1255 ---- return 1; } ! return 0; } *************** *** 1291,1297 **** 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); --- 1291,1297 ---- 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); *************** *** 1319,1326 **** lua_pushnumber(L, wxlDefine->value); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1319,1326 ---- lua_pushnumber(L, wxlDefine->value); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1343,1347 **** int LUACALL wxluabind_wxLuaBinding_index(lua_State* L) ! { wxLuaState wxlState(L); wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); --- 1343,1347 ---- int LUACALL wxluabind_wxLuaBinding_index(lua_State* L) ! { wxLuaState wxlState(L); wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); *************** *** 1349,1353 **** void **ptr = (void **)lua_touserdata(L, 1); wxLuaBinding* wxlBinding = (wxLuaBinding*)*ptr; ! int idx_type = lua_type(L, 2); --- 1349,1353 ---- void **ptr = (void **)lua_touserdata(L, 1); wxLuaBinding* wxlBinding = (wxLuaBinding*)*ptr; ! int idx_type = lua_type(L, 2); *************** *** 1404,1415 **** 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, idx + 1); } ! return 1; } --- 1404,1415 ---- 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, idx + 1); } ! return 1; } *************** *** 1427,1438 **** lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1427,1438 ---- lua_newtable(L); lua_pushstring(L, "__index"); ! lua_pushlightuserdata(L, wxlBinding); lua_pushcclosure(L, wxluabind_wxLuaBindMethod_index, 1); // push func with tag as upvalue ! lua_rawset(L, -3); lua_setmetatable(L, -2); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1453,1460 **** lua_pushnumber(L, wxlDefine->value); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1453,1460 ---- lua_pushnumber(L, wxlDefine->value); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1475,1482 **** lua_pushstring(L, wx2lua(wxlString->value)); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1475,1482 ---- lua_pushstring(L, wx2lua(wxlString->value)); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1500,1507 **** lua_pushnumber(L, *wxlEvent->class_tag); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } --- 1500,1507 ---- lua_pushnumber(L, *wxlEvent->class_tag); lua_rawset(L, -3); ! lua_rawseti(L, -2, idx + 1); } ! return 1; } *************** *** 1526,1530 **** wxlState.tpushusertag(*wxlObject->pObjPtr, *wxlObject->class_tag); lua_rawset(L, -3); ! lua_pushstring(L, "class_tag"); lua_pushnumber(L, *wxlObject->class_tag); --- 1526,1530 ---- wxlState.tpushusertag(*wxlObject->pObjPtr, *wxlObject->class_tag); lua_rawset(L, -3); ! lua_pushstring(L, "class_tag"); lua_pushnumber(L, *wxlObject->class_tag); *************** *** 1533,1541 **** lua_rawseti(L, -2, idx + 1); } ! return 1; ! } } ! return 0; } --- 1533,1541 ---- lua_rawseti(L, -2, idx + 1); } ! return 1; ! } } ! return 0; } |