From: John L. <jr...@us...> - 2007-12-20 02:27:27
|
Update of /cvsroot/wxlua/wxLua/apps/wxluacan/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/apps/wxluacan/src Modified Files: wxluacan.cpp wxluacan.h 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: wxluacan.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** wxluacan.cpp 10 Dec 2007 05:39:03 -0000 1.36 --- wxluacan.cpp 20 Dec 2007 02:26:54 -0000 1.37 *************** *** 153,157 **** static int LUACALL wxLua_wxlCanObj_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 153,156 ---- *************** *** 203,207 **** static int LUACALL wxLua_wxlCanObjRect_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // double h double h = (double)wxlua_getnumbertype(L, 4); --- 202,205 ---- *************** *** 244,248 **** static int LUACALL wxLua_wxlCanObjCircle_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // double r double r = (double)wxlua_getnumbertype(L, 3); --- 242,245 ---- *************** *** 283,287 **** static int LUACALL wxLua_wxlCanObjScript_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // const wxString name const wxString name = wxlua_getwxStringtype(L, 3); --- 280,283 ---- *************** *** 338,342 **** static int LUACALL wxLua_wxlCanObjAddScript_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // const wxString script const wxString script = wxlua_getwxStringtype(L, 3); --- 334,337 ---- *************** *** 428,432 **** static int LUACALL wxLua_wxlCan_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 423,426 ---- *************** *** 500,504 **** static int LUACALL wxLua_wxlLuaCanCmd_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 494,497 ---- Index: wxluacan.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** wxluacan.h 10 Dec 2007 05:39:04 -0000 1.37 --- wxluacan.h 20 Dec 2007 02:26:54 -0000 1.38 *************** *** 18,24 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 19 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 19 // --------------------------------------------------------------------------- --- 18,24 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 20 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 20 // --------------------------------------------------------------------------- |