From: John L. <jr...@us...> - 2006-05-18 05:47:50
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8015/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: add binding tag for LuaFunction add %overload up to file.i, note static funcs don't work now add SortItems function for wxListCtrl, untested tabs -> spaces Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** wxlstate.cpp 14 May 2006 07:48:09 -0000 1.68 --- wxlstate.cpp 18 May 2006 05:47:40 -0000 1.69 *************** *** 590,594 **** { #ifdef WXLUA_LUA_NEWTHREAD ! wxLuaState_SetupThreadHandlers(); #endif //WXLUA_LUA_NEWTHREAD --- 590,594 ---- { #ifdef WXLUA_LUA_NEWTHREAD ! wxLuaState_SetupThreadHandlers(); #endif //WXLUA_LUA_NEWTHREAD *************** *** 3145,3158 **** int arg; int i; ! int j; int bestMethod = -1; int invalidArg = -1; ! int maxargs = -1; ! int minargs = -1; int ltype; ! // do nothing ! if (!overloadedMethods && overloadedMethodCount == 0) ! return 0; // get number of arguments called from lua --- 3145,3158 ---- int arg; int i; ! int j; int bestMethod = -1; int invalidArg = -1; ! int maxargs = -1; ! int minargs = -1; int ltype; ! // do nothing ! if (!overloadedMethods && overloadedMethodCount == 0) ! return 0; // get number of arguments called from lua *************** *** 3167,3201 **** } ! // prepare overload function table ! WXLUAMETHOD** overloadFunctionTable = new WXLUAMETHOD*[overloadedMethodCount]; for (i = 0; i < overloadedMethodCount; i++) { ! if (maxargs == -1 || maxargs < overloadedMethods[i].maxargs) ! maxargs = overloadedMethods[i].maxargs; ! if (minargs == -1 || minargs > overloadedMethods[i].minargs) ! minargs = overloadedMethods[i].minargs; ! overloadFunctionTable[i] = (overloadedMethods+i); ! } #if !defined(WXLUA_OVERLOAD_SORTED) ! // sort overload on the fly to get proper function selection ! // order by minargs DESC, maxargs DESC for (i = 0; i < overloadedMethodCount; i++) { ! for (j = i + 1; j < overloadedMethodCount; j++) ! { ! if (overloadFunctionTable[j]->minargs > overloadFunctionTable[i]->minargs || ! overloadFunctionTable[j]->minargs == overloadFunctionTable[i]->minargs && ! overloadFunctionTable[j]->maxargs > overloadFunctionTable[i]->maxargs) ! { ! // swap order ! WXLUAMETHOD* swap = overloadFunctionTable[i]; ! overloadFunctionTable[i] = overloadFunctionTable[j]; ! overloadFunctionTable[j] = swap; ! } ! } ! } #endif --- 3167,3201 ---- } ! // prepare overload function table ! WXLUAMETHOD** overloadFunctionTable = new WXLUAMETHOD*[overloadedMethodCount]; for (i = 0; i < overloadedMethodCount; i++) { ! if (maxargs == -1 || maxargs < overloadedMethods[i].maxargs) ! maxargs = overloadedMethods[i].maxargs; ! if (minargs == -1 || minargs > overloadedMethods[i].minargs) ! minargs = overloadedMethods[i].minargs; ! overloadFunctionTable[i] = (overloadedMethods+i); ! } #if !defined(WXLUA_OVERLOAD_SORTED) ! // sort overload on the fly to get proper function selection ! // order by minargs DESC, maxargs DESC for (i = 0; i < overloadedMethodCount; i++) { ! for (j = i + 1; j < overloadedMethodCount; j++) ! { ! if (overloadFunctionTable[j]->minargs > overloadFunctionTable[i]->minargs || ! overloadFunctionTable[j]->minargs == overloadFunctionTable[i]->minargs && ! overloadFunctionTable[j]->maxargs > overloadFunctionTable[i]->maxargs) ! { ! // swap order ! WXLUAMETHOD* swap = overloadFunctionTable[i]; ! overloadFunctionTable[i] = overloadFunctionTable[j]; ! overloadFunctionTable[j] = swap; ! } ! } ! } #endif *************** *** 3210,3217 **** // does this method have any more arguments? if (!overloadFunctionTable[i]->argtags || !overloadFunctionTable[i]->argtags[arg]) ! { ! match = false; break; ! } // get argument tag id --- 3210,3217 ---- // does this method have any more arguments? if (!overloadFunctionTable[i]->argtags || !overloadFunctionTable[i]->argtags[arg]) ! { ! match = false; break; ! } // get argument tag id *************** *** 3275,3278 **** --- 3275,3286 ---- } } + else if (tag == s_wxluaarg_LuaFunction) + { + if (!lua_IsFunction(arg+1+lua_argStart)) + { + match = false; + break; + } + } else if (!IsUserDataType(arg+1+lua_argStart, tag)) { *************** *** 3302,3308 **** } ! lua_Debug ar; ! lua_GetStack(0, &ar); ! lua_GetInfo("n", &ar); wxString name = lua2wx(ar.name); --- 3310,3316 ---- } ! lua_Debug ar; ! lua_GetStack(0, &ar); ! lua_GetInfo("n", &ar); wxString name = lua2wx(ar.name); *************** *** 3392,3407 **** fnOverload += wxT("number"); } ! else if (tag == s_wxluaarg_LightUserData) ! { fnOverload += wxT("lightuserdata"); ! } ! else if (tag == s_wxluaarg_UserData) ! { fnOverload += wxT("userdata"); ! } ! else if (tag == s_wxluaarg_LuaTable) ! { fnOverload += wxT("luatable"); ! } else { --- 3400,3419 ---- fnOverload += wxT("number"); } ! else if (tag == s_wxluaarg_LightUserData) ! { fnOverload += wxT("lightuserdata"); ! } ! else if (tag == s_wxluaarg_UserData) ! { fnOverload += wxT("userdata"); ! } ! else if (tag == s_wxluaarg_LuaTable) ! { fnOverload += wxT("luatable"); ! } ! else if (tag == s_wxluaarg_LuaFunction) ! { ! fnOverload += wxT("luafunction"); ! } else { Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** wxlbind.cpp 14 May 2006 07:48:09 -0000 1.33 --- wxlbind.cpp 18 May 2006 05:47:40 -0000 1.34 *************** *** 34,44 **** // represents prototypes argument types // ! int s_wxluaarg_String = -2; ! int s_wxluaarg_Boolean = -3; ! int s_wxluaarg_Enumeration = -4; ! int s_wxluaarg_Number = -5; ! int s_wxluaarg_LightUserData = -6; // raw data ! int s_wxluaarg_UserData = -7; // raw data ! int s_wxluaarg_LuaTable = -8; WX_DEFINE_LIST(wxLuaBindingList); --- 34,45 ---- // represents prototypes argument types // ! int s_wxluaarg_String = -2; ! int s_wxluaarg_Boolean = -3; ! int s_wxluaarg_Enumeration = -4; ! int s_wxluaarg_Number = -5; ! int s_wxluaarg_LightUserData = -6; // raw data ! int s_wxluaarg_UserData = -7; // raw data ! int s_wxluaarg_LuaTable = -8; ! int s_wxluaarg_LuaFunction = -9; WX_DEFINE_LIST(wxLuaBindingList); *************** *** 483,490 **** // sort the event list into order for faster lookup. ! qsort(m_eventList, ! m_eventCount, ! sizeof(WXLUAEVENT), ! wxLuaEventListCompareFn); } --- 484,488 ---- // sort the event list into order for faster lookup. ! qsort(m_eventList, m_eventCount, sizeof(WXLUAEVENT), wxLuaEventListCompareFn); } |