You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(191) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(238) |
Dec
(68) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(104) |
Feb
(518) |
Mar
(302) |
Apr
(211) |
May
(311) |
Jun
(55) |
Jul
(6) |
Aug
(35) |
Sep
(76) |
Oct
(50) |
Nov
(37) |
Dec
(340) |
2007 |
Jan
(23) |
Feb
(107) |
Mar
(98) |
Apr
(60) |
May
(136) |
Jun
(371) |
Jul
(175) |
Aug
(74) |
Sep
(3) |
Oct
(2) |
Nov
(53) |
Dec
(129) |
2008 |
Jan
(337) |
Feb
(23) |
Mar
(18) |
Apr
(4) |
May
(3) |
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
(33) |
Nov
|
Dec
(26) |
2009 |
Jan
(4) |
Feb
(1) |
Mar
(15) |
Apr
|
May
(35) |
Jun
(11) |
Jul
|
Aug
|
Sep
(19) |
Oct
(26) |
Nov
(11) |
Dec
(11) |
2010 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
(8) |
Dec
(7) |
2011 |
Jan
|
Feb
|
Mar
(4) |
Apr
(8) |
May
(5) |
Jun
(8) |
Jul
(1) |
Aug
|
Sep
|
Oct
(5) |
Nov
(13) |
Dec
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/modules/wxbind/src Modified Files: wxadv_adv.cpp wxadv_grid.cpp wxaui_aui.cpp wxbase_base.cpp wxbase_config.cpp wxbase_data.cpp wxbase_datetime.cpp wxbase_file.cpp wxcore_appframe.cpp wxcore_clipdrag.cpp wxcore_controls.cpp wxcore_core.cpp wxcore_defsutils.cpp wxcore_dialogs.cpp wxcore_event.cpp wxcore_gdi.cpp wxcore_geometry.cpp wxcore_help.cpp wxcore_image.cpp wxcore_mdi.cpp wxcore_menutool.cpp wxcore_picker.cpp wxcore_print.cpp wxcore_sizer.cpp wxcore_windows.cpp wxgl_gl.cpp wxhtml_html.cpp wxmedia_media.cpp wxnet_net.cpp wxstc_stc.cpp wxxml_xml.cpp wxxrc_xrc.cpp 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: wxnet_net.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxnet_net.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxnet_net.cpp 13 Dec 2007 00:47:51 -0000 1.7 --- wxnet_net.cpp 20 Dec 2007 02:26:57 -0000 1.8 *************** *** 727,731 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketClient_delete[] = { &s_wxluatag_wxSocketClient, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketClient_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketClient_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketClient_constructor[] = { &s_wxluaarg_Integer, NULL }; --- 727,731 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketClient_delete[] = { &s_wxluatag_wxSocketClient, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketClient_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketClient_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketClient_constructor[] = { &s_wxluaarg_Integer, NULL }; *************** *** 735,739 **** static int LUACALL wxLua_wxSocketClient_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 735,738 ---- *************** *** 841,845 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketServer_delete[] = { &s_wxluatag_wxSocketServer, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketServer_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketServer_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketServer_constructor[] = { &s_wxluatag_wxSockAddress, &s_wxluaarg_Integer, NULL }; --- 840,844 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketServer_delete[] = { &s_wxluatag_wxSocketServer, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketServer_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketServer_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketServer_constructor[] = { &s_wxluatag_wxSockAddress, &s_wxluaarg_Integer, NULL }; *************** *** 849,853 **** static int LUACALL wxLua_wxSocketServer_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 848,851 ---- *************** *** 942,946 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketEvent_delete[] = { &s_wxluatag_wxSocketEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketEvent_constructor[] = { &s_wxluaarg_Number, NULL }; --- 940,944 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketEvent_delete[] = { &s_wxluatag_wxSocketEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSocketEvent_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSocketEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxSocketEvent_constructor[] = { &s_wxluaarg_Number, NULL }; *************** *** 950,954 **** static int LUACALL wxLua_wxSocketEvent_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 948,951 ---- *************** *** 1180,1184 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxIPaddress_delete[] = { &s_wxluatag_wxIPaddress, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPaddress_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxIPaddress_delete }}; --- 1177,1181 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxIPaddress_delete[] = { &s_wxluatag_wxIPaddress, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPaddress_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxIPaddress_delete }}; *************** *** 1186,1210 **** #if (wxLUA_USE_wxSocket && wxUSE_SOCKETS) - static int LUACALL wxLua_wxIPaddress_Hostname_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPaddress_Hostname_overload[] = { - { wxLua_wxIPaddress_Hostname_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 1, 2, s_wxluaargArray_None }, { wxLua_wxIPaddress_Hostname1, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxIPaddress_Hostname1 }, { wxLua_wxIPaddress_Hostname, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxIPaddress_Hostname }, }; static int s_wxluafunc_wxLua_wxIPaddress_Hostname_overload_count = sizeof(s_wxluafunc_wxLua_wxIPaddress_Hostname_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxIPaddress::Hostname ! static int LUACALL wxLua_wxIPaddress_Hostname_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "Hostname", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxIPaddress_Hostname_overload, s_wxluafunc_wxLua_wxIPaddress_Hostname_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } ! static int LUACALL wxLua_wxIPaddress_Service_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPaddress_Service_overload[] = { - { wxLua_wxIPaddress_Service_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 1, 2, s_wxluaargArray_None }, { wxLua_wxIPaddress_Service2, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxIPaddress_Service2 }, { wxLua_wxIPaddress_Service1, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxIPaddress_Service1 }, --- 1183,1197 ---- #if (wxLUA_USE_wxSocket && wxUSE_SOCKETS) // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPaddress_Hostname_overload[] = { { wxLua_wxIPaddress_Hostname1, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxIPaddress_Hostname1 }, { wxLua_wxIPaddress_Hostname, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxIPaddress_Hostname }, }; static int s_wxluafunc_wxLua_wxIPaddress_Hostname_overload_count = sizeof(s_wxluafunc_wxLua_wxIPaddress_Hostname_overload)/sizeof(wxLuaBindCFunc); ! // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPaddress_Service_overload[] = { { wxLua_wxIPaddress_Service2, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxIPaddress_Service2 }, { wxLua_wxIPaddress_Service1, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxIPaddress_Service1 }, *************** *** 1212,1222 **** }; static int s_wxluafunc_wxLua_wxIPaddress_Service_overload_count = sizeof(s_wxluafunc_wxLua_wxIPaddress_Service_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxIPaddress::Service ! static int LUACALL wxLua_wxIPaddress_Service_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "Service", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxIPaddress_Service_overload, s_wxluafunc_wxLua_wxIPaddress_Service_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // (wxLUA_USE_wxSocket && wxUSE_SOCKETS) --- 1199,1203 ---- }; static int s_wxluafunc_wxLua_wxIPaddress_Service_overload_count = sizeof(s_wxluafunc_wxLua_wxIPaddress_Service_overload)/sizeof(wxLuaBindCFunc); ! #endif // (wxLUA_USE_wxSocket && wxUSE_SOCKETS) *************** *** 1274,1278 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxIPV4address_delete[] = { &s_wxluatag_wxIPV4address, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPV4address_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxIPV4address_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxIPV4address_constructor1[] = { &s_wxluatag_wxIPV4address, NULL }; --- 1255,1259 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxIPV4address_delete[] = { &s_wxluatag_wxIPV4address, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPV4address_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxIPV4address_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxIPV4address_constructor1[] = { &s_wxluatag_wxIPV4address, NULL }; *************** *** 1282,1286 **** static int LUACALL wxLua_wxIPV4address_constructor1(lua_State *L) { - wxluabind_removetableforcall(L); // const wxIPV4address other const wxIPV4address * other = (const wxIPV4address *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxIPV4address); --- 1263,1266 ---- *************** *** 1300,1304 **** static int LUACALL wxLua_wxIPV4address_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // call constructor wxIPV4address* returns = new wxIPV4address(); --- 1280,1283 ---- *************** *** 1315,1334 **** #if (wxLUA_USE_wxSocket && wxUSE_SOCKETS) - static int LUACALL wxLua_wxIPV4address_constructor_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPV4address_constructor_overload[] = { - { wxLua_wxIPV4address_constructor_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 0, 1, s_wxluaargArray_None }, { wxLua_wxIPV4address_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxIPV4address_constructor1 }, { wxLua_wxIPV4address_constructor, WXLUAMETHOD_CONSTRUCTOR, 0, 0, s_wxluaargArray_None }, }; static int s_wxluafunc_wxLua_wxIPV4address_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxIPV4address_constructor_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxIPV4address::wxIPV4address ! static int LUACALL wxLua_wxIPV4address_constructor_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "wxIPV4address", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxIPV4address_constructor_overload, s_wxluafunc_wxLua_wxIPV4address_constructor_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // (wxLUA_USE_wxSocket && wxUSE_SOCKETS) --- 1294,1305 ---- #if (wxLUA_USE_wxSocket && wxUSE_SOCKETS) // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxIPV4address_constructor_overload[] = { { wxLua_wxIPV4address_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxIPV4address_constructor1 }, { wxLua_wxIPV4address_constructor, WXLUAMETHOD_CONSTRUCTOR, 0, 0, s_wxluaargArray_None }, }; static int s_wxluafunc_wxLua_wxIPV4address_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxIPV4address_constructor_overload)/sizeof(wxLuaBindCFunc); ! #endif // (wxLUA_USE_wxSocket && wxUSE_SOCKETS) *************** *** 1477,1481 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxProtocol_delete[] = { &s_wxluatag_wxProtocol, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxProtocol_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxProtocol_delete }}; --- 1448,1452 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxProtocol_delete[] = { &s_wxluatag_wxProtocol, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxProtocol_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxProtocol_delete }}; *************** *** 1566,1570 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxHTTP_delete[] = { &s_wxluatag_wxHTTP, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxHTTP_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxHTTP_delete }}; static int LUACALL wxLua_wxHTTP_constructor(lua_State *L); --- 1537,1541 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxHTTP_delete[] = { &s_wxluatag_wxHTTP, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxHTTP_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxHTTP_delete }}; static int LUACALL wxLua_wxHTTP_constructor(lua_State *L); *************** *** 1573,1577 **** static int LUACALL wxLua_wxHTTP_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // call constructor wxHTTP* returns = new wxHTTP(); --- 1544,1547 ---- *************** *** 1950,1954 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxFTP_delete[] = { &s_wxluatag_wxFTP, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxFTP_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxFTP_delete }}; static int LUACALL wxLua_wxFTP_constructor(lua_State *L); --- 1920,1924 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxFTP_delete[] = { &s_wxluatag_wxFTP, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxFTP_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxFTP_delete }}; static int LUACALL wxLua_wxFTP_constructor(lua_State *L); *************** *** 1957,1961 **** static int LUACALL wxLua_wxFTP_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // call constructor wxFTP* returns = new wxFTP(); --- 1927,1930 ---- *************** *** 2407,2411 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxURI_delete[] = { &s_wxluatag_wxURI, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURI_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURI_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxURI_op_eq[] = { &s_wxluatag_wxURI, &s_wxluatag_wxURI, NULL }; --- 2376,2380 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxURI_delete[] = { &s_wxluatag_wxURI, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURI_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURI_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxURI_op_eq[] = { &s_wxluatag_wxURI, &s_wxluatag_wxURI, NULL }; *************** *** 2452,2456 **** static int LUACALL wxLua_wxURI_constructor2(lua_State *L) { - wxluabind_removetableforcall(L); // const wxURI uri const wxURI * uri = (const wxURI *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxURI); --- 2421,2424 ---- *************** *** 2471,2475 **** static int LUACALL wxLua_wxURI_constructor1(lua_State *L) { - wxluabind_removetableforcall(L); // const wxString uri const wxString uri = wxlua_getwxStringtype(L, 1); --- 2439,2442 ---- *************** *** 2489,2493 **** static int LUACALL wxLua_wxURI_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // call constructor wxURI* returns = new wxURI(); --- 2456,2459 ---- *************** *** 2504,2512 **** #if (wxLUA_USE_wxSocket && wxUSE_SOCKETS) - static int LUACALL wxLua_wxURI_constructor_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxURI_constructor_overload[] = { - { wxLua_wxURI_constructor_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 0, 1, s_wxluaargArray_None }, { wxLua_wxURI_constructor2, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxURI_constructor2 }, { wxLua_wxURI_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxURI_constructor1 }, --- 2470,2476 ---- *************** *** 2514,2524 **** }; static int s_wxluafunc_wxLua_wxURI_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxURI_constructor_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxURI::wxURI ! static int LUACALL wxLua_wxURI_constructor_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "wxURI", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxURI_constructor_overload, s_wxluafunc_wxLua_wxURI_constructor_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // (wxLUA_USE_wxSocket && wxUSE_SOCKETS) --- 2478,2482 ---- }; static int s_wxluafunc_wxLua_wxURI_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxURI_constructor_overload)/sizeof(wxLuaBindCFunc); ! #endif // (wxLUA_USE_wxSocket && wxUSE_SOCKETS) *************** *** 2678,2682 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxURL_delete[] = { &s_wxluatag_wxURL, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURL_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURL_delete }}; --- 2636,2640 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxURL_delete[] = { &s_wxluatag_wxURL, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURL_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURL_delete }}; *************** *** 2688,2692 **** static int LUACALL wxLua_wxURL_constructor1(lua_State *L) { - wxluabind_removetableforcall(L); // const wxURI url const wxURI * url = (const wxURI *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxURI); --- 2646,2649 ---- *************** *** 2709,2713 **** static int LUACALL wxLua_wxURL_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // const wxString sUrl const wxString sUrl = wxlua_getwxStringtype(L, 1); --- 2666,2669 ---- *************** *** 2726,2734 **** #if (((wxLUA_USE_wxSocket && wxUSE_SOCKETS) && (wxUSE_URL)) && (wxLUA_USE_wxSocket && wxUSE_SOCKETS))||((wxLUA_USE_wxSocket && wxUSE_SOCKETS) && (wxUSE_URL)) - static int LUACALL wxLua_wxURL_constructor_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxURL_constructor_overload[] = { - { wxLua_wxURL_constructor_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 1, 1, s_wxluaargArray_None }, #if ((wxLUA_USE_wxSocket && wxUSE_SOCKETS) && (wxUSE_URL)) && (wxLUA_USE_wxSocket && wxUSE_SOCKETS) --- 2682,2688 ---- *************** *** 2738,2748 **** }; static int s_wxluafunc_wxLua_wxURL_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxURL_constructor_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxURL::wxURL ! static int LUACALL wxLua_wxURL_constructor_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "wxURL", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxURL_constructor_overload, s_wxluafunc_wxLua_wxURL_constructor_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // (((wxLUA_USE_wxSocket && wxUSE_SOCKETS) && (wxUSE_URL)) && (wxLUA_USE_wxSocket && wxUSE_SOCKETS))||((wxLUA_USE_wxSocket && wxUSE_SOCKETS) && (wxUSE_URL)) --- 2692,2696 ---- }; static int s_wxluafunc_wxLua_wxURL_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxURL_constructor_overload)/sizeof(wxLuaBindCFunc); ! #endif // (((wxLUA_USE_wxSocket && wxUSE_SOCKETS) && (wxUSE_URL)) && (wxLUA_USE_wxSocket && wxUSE_SOCKETS))||((wxLUA_USE_wxSocket && wxUSE_SOCKETS) && (wxUSE_URL)) Index: wxstc_stc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxstc_stc.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wxstc_stc.cpp 18 Dec 2007 01:03:34 -0000 1.9 --- wxstc_stc.cpp 20 Dec 2007 02:26:57 -0000 1.10 *************** *** 7364,7368 **** static int LUACALL wxLua_wxStyledTextCtrl_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 7364,7367 ---- *************** *** 8662,8666 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxStyledTextEvent_delete[] = { &s_wxluatag_wxStyledTextEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxStyledTextEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxStyledTextEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxStyledTextEvent_constructor[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; --- 8661,8665 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxStyledTextEvent_delete[] = { &s_wxluatag_wxStyledTextEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxStyledTextEvent_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxStyledTextEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxStyledTextEvent_constructor[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; *************** *** 8670,8674 **** static int LUACALL wxLua_wxStyledTextEvent_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 8669,8672 ---- Index: wxxrc_xrc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxxrc_xrc.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxxrc_xrc.cpp 13 Dec 2007 06:23:54 -0000 1.8 --- wxxrc_xrc.cpp 20 Dec 2007 02:26:57 -0000 1.9 *************** *** 501,505 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxXmlResource_delete[] = { &s_wxluatag_wxXmlResource, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxXmlResource_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxXmlResource_constructor1[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_String, NULL }; --- 501,505 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxXmlResource_delete[] = { &s_wxluatag_wxXmlResource, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxXmlResource_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxXmlResource_constructor1[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_String, NULL }; *************** *** 509,513 **** static int LUACALL wxLua_wxXmlResource_constructor1(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 509,512 ---- *************** *** 534,538 **** static int LUACALL wxLua_wxXmlResource_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 533,536 ---- *************** *** 555,563 **** #if ((wxLUA_USE_wxDialog) && (wxLUA_USE_wxXRC && wxUSE_XRC)) - static int LUACALL wxLua_wxXmlResource_LoadDialog_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_LoadDialog_overload[] = { - { wxLua_wxXmlResource_LoadDialog_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 3, 4, s_wxluaargArray_None }, #if (wxLUA_USE_wxDialog) && (wxLUA_USE_wxXRC && wxUSE_XRC) --- 553,559 ---- *************** *** 570,588 **** }; static int s_wxluafunc_wxLua_wxXmlResource_LoadDialog_overload_count = sizeof(s_wxluafunc_wxLua_wxXmlResource_LoadDialog_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxXmlResource::LoadDialog ! static int LUACALL wxLua_wxXmlResource_LoadDialog_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "LoadDialog", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxXmlResource_LoadDialog_overload, s_wxluafunc_wxLua_wxXmlResource_LoadDialog_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // ((wxLUA_USE_wxDialog) && (wxLUA_USE_wxXRC && wxUSE_XRC)) #if ((wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxXRC && wxUSE_XRC)) - static int LUACALL wxLua_wxXmlResource_LoadMenuBar_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_LoadMenuBar_overload[] = { - { wxLua_wxXmlResource_LoadMenuBar_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 2, 3, s_wxluaargArray_None }, #if (wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxXRC && wxUSE_XRC) --- 566,576 ---- }; static int s_wxluafunc_wxLua_wxXmlResource_LoadDialog_overload_count = sizeof(s_wxluafunc_wxLua_wxXmlResource_LoadDialog_overload)/sizeof(wxLuaBindCFunc); ! #endif // ((wxLUA_USE_wxDialog) && (wxLUA_USE_wxXRC && wxUSE_XRC)) #if ((wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxXRC && wxUSE_XRC)) // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_LoadMenuBar_overload[] = { #if (wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxXRC && wxUSE_XRC) *************** *** 595,640 **** }; static int s_wxluafunc_wxLua_wxXmlResource_LoadMenuBar_overload_count = sizeof(s_wxluafunc_wxLua_wxXmlResource_LoadMenuBar_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxXmlResource::LoadMenuBar ! static int LUACALL wxLua_wxXmlResource_LoadMenuBar_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "LoadMenuBar", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxXmlResource_LoadMenuBar_overload, s_wxluafunc_wxLua_wxXmlResource_LoadMenuBar_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // ((wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxXRC && wxUSE_XRC)) #if (wxLUA_USE_wxXRC && wxUSE_XRC) - static int LUACALL wxLua_wxXmlResource_LoadPanel_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_LoadPanel_overload[] = { - { wxLua_wxXmlResource_LoadPanel_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 3, 4, s_wxluaargArray_None }, { wxLua_wxXmlResource_LoadPanel1, WXLUAMETHOD_METHOD, 4, 4, s_wxluatagArray_wxLua_wxXmlResource_LoadPanel1 }, { wxLua_wxXmlResource_LoadPanel, WXLUAMETHOD_METHOD, 3, 3, s_wxluatagArray_wxLua_wxXmlResource_LoadPanel }, }; static int s_wxluafunc_wxLua_wxXmlResource_LoadPanel_overload_count = sizeof(s_wxluafunc_wxLua_wxXmlResource_LoadPanel_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxXmlResource::LoadPanel ! static int LUACALL wxLua_wxXmlResource_LoadPanel_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "LoadPanel", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxXmlResource_LoadPanel_overload, s_wxluafunc_wxLua_wxXmlResource_LoadPanel_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } ! static int LUACALL wxLua_wxXmlResource_constructor_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_constructor_overload[] = { - { wxLua_wxXmlResource_constructor_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 0, 3, s_wxluaargArray_None }, { wxLua_wxXmlResource_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 3, s_wxluatagArray_wxLua_wxXmlResource_constructor1 }, { wxLua_wxXmlResource_constructor, WXLUAMETHOD_CONSTRUCTOR, 0, 2, s_wxluatagArray_wxLua_wxXmlResource_constructor }, }; static int s_wxluafunc_wxLua_wxXmlResource_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxXmlResource_constructor_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxXmlResource::wxXmlResource ! static int LUACALL wxLua_wxXmlResource_constructor_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "wxXmlResource", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxXmlResource_constructor_overload, s_wxluafunc_wxLua_wxXmlResource_constructor_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // (wxLUA_USE_wxXRC && wxUSE_XRC) --- 583,606 ---- }; static int s_wxluafunc_wxLua_wxXmlResource_LoadMenuBar_overload_count = sizeof(s_wxluafunc_wxLua_wxXmlResource_LoadMenuBar_overload)/sizeof(wxLuaBindCFunc); ! #endif // ((wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxXRC && wxUSE_XRC)) #if (wxLUA_USE_wxXRC && wxUSE_XRC) // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_LoadPanel_overload[] = { { wxLua_wxXmlResource_LoadPanel1, WXLUAMETHOD_METHOD, 4, 4, s_wxluatagArray_wxLua_wxXmlResource_LoadPanel1 }, { wxLua_wxXmlResource_LoadPanel, WXLUAMETHOD_METHOD, 3, 3, s_wxluatagArray_wxLua_wxXmlResource_LoadPanel }, }; static int s_wxluafunc_wxLua_wxXmlResource_LoadPanel_overload_count = sizeof(s_wxluafunc_wxLua_wxXmlResource_LoadPanel_overload)/sizeof(wxLuaBindCFunc); ! // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxXmlResource_constructor_overload[] = { { wxLua_wxXmlResource_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 3, s_wxluatagArray_wxLua_wxXmlResource_constructor1 }, { wxLua_wxXmlResource_constructor, WXLUAMETHOD_CONSTRUCTOR, 0, 2, s_wxluatagArray_wxLua_wxXmlResource_constructor }, }; static int s_wxluafunc_wxLua_wxXmlResource_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxXmlResource_constructor_overload)/sizeof(wxLuaBindCFunc); ! #endif // (wxLUA_USE_wxXRC && wxUSE_XRC) Index: wxcore_core.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_core.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxcore_core.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxcore_core.cpp 20 Dec 2007 02:26:56 -0000 1.8 *************** *** 36,40 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLogGui_delete[] = { &s_wxluatag_wxLogGui, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogGui_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogGui_delete }}; static int LUACALL wxLua_wxLogGui_constructor(lua_State *L); --- 36,40 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLogGui_delete[] = { &s_wxluatag_wxLogGui, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogGui_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogGui_delete }}; static int LUACALL wxLua_wxLogGui_constructor(lua_State *L); *************** *** 43,47 **** static int LUACALL wxLua_wxLogGui_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // call constructor wxLogGui* returns = new wxLogGui(); --- 43,46 ---- *************** *** 79,83 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLogTextCtrl_delete[] = { &s_wxluatag_wxLogTextCtrl, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogTextCtrl_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogTextCtrl_delete }}; --- 78,82 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLogTextCtrl_delete[] = { &s_wxluatag_wxLogTextCtrl, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogTextCtrl_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogTextCtrl_delete }}; *************** *** 89,93 **** static int LUACALL wxLua_wxLogTextCtrl_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // wxTextCtrl textCtrl wxTextCtrl * textCtrl = (wxTextCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxTextCtrl); --- 88,91 ---- *************** *** 168,172 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLogWindow_delete[] = { &s_wxluatag_wxLogWindow, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogWindow_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogWindow_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxLogWindow_constructor[] = { &s_wxluatag_wxWindow, &s_wxluaarg_String, &s_wxluaarg_Boolean, &s_wxluaarg_Boolean, NULL }; --- 166,170 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLogWindow_delete[] = { &s_wxluatag_wxLogWindow, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLogWindow_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLogWindow_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxLogWindow_constructor[] = { &s_wxluatag_wxWindow, &s_wxluaarg_String, &s_wxluaarg_Boolean, &s_wxluaarg_Boolean, NULL }; *************** *** 176,180 **** static int LUACALL wxLua_wxLogWindow_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 174,177 ---- *************** *** 611,615 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxTextValidator_delete[] = { &s_wxluatag_wxTextValidator, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextValidator_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxTextValidator_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxTextValidator_constructor[] = { &s_wxluaarg_Number, &s_wxluatag_wxLuaObject, NULL }; --- 608,612 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxTextValidator_delete[] = { &s_wxluatag_wxTextValidator, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextValidator_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxTextValidator_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxTextValidator_constructor[] = { &s_wxluaarg_Number, &s_wxluatag_wxLuaObject, NULL }; *************** *** 620,625 **** static int LUACALL wxLua_wxTextValidator_constructor(lua_State *L) { - wxluabind_removetableforcall(L); - wxTextValidator *returns; // get number of arguments --- 617,620 ---- *************** *** 682,686 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxGenericValidator_delete[] = { &s_wxluatag_wxGenericValidator, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxGenericValidator_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxGenericValidator_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxGenericValidatorArrayInt_constructor[] = { &s_wxluatag_wxLuaObject, NULL }; --- 677,681 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxGenericValidator_delete[] = { &s_wxluatag_wxGenericValidator, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxGenericValidator_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxGenericValidator_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxGenericValidatorArrayInt_constructor[] = { &s_wxluatag_wxLuaObject, NULL }; *************** *** 691,696 **** static int LUACALL wxLua_wxGenericValidatorArrayInt_constructor(lua_State *L) { - wxluabind_removetableforcall(L); - // wxLuaObject *valPtr wxLuaObject *valPtr = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); --- 686,689 ---- *************** *** 713,718 **** static int LUACALL wxLua_wxGenericValidatorBool_constructor(lua_State *L) { - wxluabind_removetableforcall(L); - // wxLuaObject *boolPtr wxLuaObject *boolPtr = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); --- 706,709 ---- *************** *** 735,740 **** static int LUACALL wxLua_wxGenericValidatorInt_constructor(lua_State *L) { - wxluabind_removetableforcall(L); - // wxLuaObject *valPtr wxLuaObject *valPtr = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); --- 726,729 ---- *************** *** 757,762 **** static int LUACALL wxLua_wxGenericValidatorString_constructor(lua_State *L) { - wxluabind_removetableforcall(L); - // wxLuaObject *valPtr wxLuaObject *valPtr = (wxLuaObject *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxLuaObject); --- 746,749 ---- Index: wxcore_clipdrag.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_clipdrag.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxcore_clipdrag.cpp 13 Dec 2007 06:23:54 -0000 1.8 --- wxcore_clipdrag.cpp 20 Dec 2007 02:26:56 -0000 1.9 *************** *** 286,290 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxClipboardTextEvent_delete[] = { &s_wxluatag_wxClipboardTextEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxClipboardTextEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxClipboardTextEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxClipboardTextEvent_constructor[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; --- 286,290 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxClipboardTextEvent_delete[] = { &s_wxluatag_wxClipboardTextEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxClipboardTextEvent_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxClipboardTextEvent_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxClipboardTextEvent_constructor[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; *************** *** 294,298 **** static int LUACALL wxLua_wxClipboardTextEvent_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 294,297 ---- *************** *** 400,404 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxDataFormat_delete[] = { &s_wxluatag_wxDataFormat, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataFormat_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataFormat_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxDataFormat_op_eq[] = { &s_wxluatag_wxDataFormat, &s_wxluatag_wxDataFormat, NULL }; --- 399,403 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxDataFormat_delete[] = { &s_wxluatag_wxDataFormat, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataFormat_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataFormat_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxDataFormat_op_eq[] = { &s_wxluatag_wxDataFormat, &s_wxluatag_wxDataFormat, NULL }; *************** *** 426,430 **** static int LUACALL wxLua_wxDataFormat_constructor1(lua_State *L) { - wxluabind_removetableforcall(L); // const wxString format const wxString format = wxlua_getwxStringtype(L, 1); --- 425,428 ---- *************** *** 445,449 **** static int LUACALL wxLua_wxDataFormat_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 443,446 ---- *************** *** 464,483 **** #if (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ) - static int LUACALL wxLua_wxDataFormat_constructor_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataFormat_constructor_overload[] = { - { wxLua_wxDataFormat_constructor_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 0, 1, s_wxluaargArray_None }, { wxLua_wxDataFormat_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxDataFormat_constructor1 }, { wxLua_wxDataFormat_constructor, WXLUAMETHOD_CONSTRUCTOR, 0, 1, s_wxluatagArray_wxLua_wxDataFormat_constructor }, }; static int s_wxluafunc_wxLua_wxDataFormat_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxDataFormat_constructor_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxDataFormat::wxDataFormat ! static int LUACALL wxLua_wxDataFormat_constructor_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "wxDataFormat", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxDataFormat_constructor_overload, s_wxluafunc_wxLua_wxDataFormat_constructor_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ) --- 461,472 ---- #if (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ) // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataFormat_constructor_overload[] = { { wxLua_wxDataFormat_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxDataFormat_constructor1 }, { wxLua_wxDataFormat_constructor, WXLUAMETHOD_CONSTRUCTOR, 0, 1, s_wxluatagArray_wxLua_wxDataFormat_constructor }, }; static int s_wxluafunc_wxLua_wxDataFormat_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxDataFormat_constructor_overload)/sizeof(wxLuaBindCFunc); ! #endif // (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ) *************** *** 811,815 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectSimple_delete[] = { &s_wxluatag_wxDataObjectSimple, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataObjectSimple_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataObjectSimple_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectSimple_constructor[] = { &s_wxluatag_wxDataFormat, NULL }; --- 800,804 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectSimple_delete[] = { &s_wxluatag_wxDataObjectSimple, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataObjectSimple_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataObjectSimple_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectSimple_constructor[] = { &s_wxluatag_wxDataFormat, NULL }; *************** *** 819,823 **** static int LUACALL wxLua_wxDataObjectSimple_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 808,811 ---- *************** *** 908,912 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectComposite_delete[] = { &s_wxluatag_wxDataObjectComposite, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataObjectComposite_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataObjectComposite_delete }}; static int LUACALL wxLua_wxDataObjectComposite_constructor(lua_State *L); --- 896,900 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxDataObjectComposite_delete[] = { &s_wxluatag_wxDataObjectComposite, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDataObjectComposite_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDataObjectComposite_delete }}; static int LUACALL wxLua_wxDataObjectComposite_constructor(lua_State *L); *************** *** 915,919 **** static int LUACALL wxLua_wxDataObjectComposite_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // call constructor wxDataObjectComposite* returns = new wxDataObjectComposite(); --- 903,906 ---- *************** *** 996,1000 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxFileDataObject_delete[] = { &s_wxluatag_wxFileDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxFileDataObject_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxFileDataObject_delete }}; static int LUACALL wxLua_wxFileDataObject_constructor(lua_State *L); --- 983,987 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxFileDataObject_delete[] = { &s_wxluatag_wxFileDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxFileDataObject_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxFileDataObject_delete }}; static int LUACALL wxLua_wxFileDataObject_constructor(lua_State *L); *************** *** 1003,1007 **** static int LUACALL wxLua_wxFileDataObject_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // call constructor wxFileDataObject* returns = new wxFileDataObject(); --- 990,993 ---- *************** *** 1093,1097 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxTextDataObject_delete[] = { &s_wxluatag_wxTextDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextDataObject_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxTextDataObject_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxTextDataObject_constructor[] = { &s_wxluaarg_String, NULL }; --- 1079,1083 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxTextDataObject_delete[] = { &s_wxluatag_wxTextDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxTextDataObject_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxTextDataObject_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxTextDataObject_constructor[] = { &s_wxluaarg_String, NULL }; *************** *** 1101,1105 **** static int LUACALL wxLua_wxTextDataObject_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1087,1090 ---- *************** *** 1182,1186 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmapDataObject_delete[] = { &s_wxluatag_wxBitmapDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmapDataObject_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxBitmapDataObject_delete }}; --- 1167,1171 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmapDataObject_delete[] = { &s_wxluatag_wxBitmapDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmapDataObject_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxBitmapDataObject_delete }}; *************** *** 1192,1196 **** static int LUACALL wxLua_wxBitmapDataObject_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1177,1180 ---- *************** *** 1273,1277 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxURLDataObject_delete[] = { &s_wxluatag_wxURLDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURLDataObject_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURLDataObject_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxURLDataObject_constructor[] = { &s_wxluaarg_String, NULL }; --- 1257,1261 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxURLDataObject_delete[] = { &s_wxluatag_wxURLDataObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxURLDataObject_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxURLDataObject_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxURLDataObject_constructor[] = { &s_wxluaarg_String, NULL }; *************** *** 1281,1285 **** static int LUACALL wxLua_wxURLDataObject_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1265,1268 ---- *************** *** 1440,1444 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxDropSource_delete[] = { &s_wxluatag_wxDropSource, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDropSource_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDropSource_delete }}; --- 1423,1427 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxDropSource_delete[] = { &s_wxluatag_wxDropSource, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDropSource_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDropSource_delete }}; *************** *** 1450,1454 **** static int LUACALL wxLua_wxDropSource_constructor3(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1433,1436 ---- *************** *** 1482,1486 **** static int LUACALL wxLua_wxDropSource_constructor2(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1464,1467 ---- *************** *** 1514,1518 **** static int LUACALL wxLua_wxDropSource_constructor1(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1495,1498 ---- *************** *** 1544,1548 **** static int LUACALL wxLua_wxDropSource_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1524,1527 ---- *************** *** 1570,1578 **** #if ((((wxLUA_USE_wxIcon) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && ((defined(__WXGTK__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP))) && (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ))||(((((defined(__WXMSW__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ)) && (wxLUA_USE_wxCursor))||(((wxLUA_USE_wxIcon) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && ((defined(__WXGTK__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)))||(((wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP) && (wxLUA_USE_wxCursor)) && ((defined(__WXMSW__) || defined(__WXMAC__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP))) - static int LUACALL wxLua_wxDropSource_constructor_overload(lua_State *L); // function overload table static wxLuaBindCFunc s_wxluafunc_wxLua_wxDropSource_constructor_overload[] = { - { wxLua_wxDropSource_constructor_overload, WXLUAMETHOD_METHOD|WXLUAMETHOD_OVERLOAD, 0, 5, s_wxluaargArray_None }, #if (((wxLUA_USE_wxIcon) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && ((defined(__WXGTK__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP))) && (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ) --- 1549,1555 ---- *************** *** 1593,1603 **** }; static int s_wxluafunc_wxLua_wxDropSource_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxDropSource_constructor_overload)/sizeof(wxLuaBindCFunc); ! // Overloaded function for wxDropSource::wxDropSource ! static int LUACALL wxLua_wxDropSource_constructor_overload(lua_State *L) ! { ! static wxLuaBindMethod overload_method = ! { "wxDropSource", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxDropSource_constructor_overload, s_wxluafunc_wxLua_wxDropSource_constructor_overload_count, 0 }; ! return wxlua_CallOverloadedFunction(L, &overload_method); ! } #endif // ((((wxLUA_USE_wxIcon) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && ((defined(__WXGTK__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP))) && (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ))||(((((defined(__WXMSW__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ)) && (wxLUA_USE_wxCursor))||(((wxLUA_USE_wxIcon) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && ((defined(__WXGTK__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)))||(((wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP) && (wxLUA_USE_wxCursor)) && ((defined(__WXMSW__) || defined(__WXMAC__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP))) --- 1570,1574 ---- }; static int s_wxluafunc_wxLua_wxDropSource_constructor_overload_count = sizeof(s_wxluafunc_wxLua_wxDropSource_constructor_overload)/sizeof(wxLuaBindCFunc); ! #endif // ((((wxLUA_USE_wxIcon) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && ((defined(__WXGTK__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP))) && (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ))||(((((defined(__WXMSW__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && (wxLUA_USE_wxDataObject && wxUSE_DATAOBJ)) && (wxLUA_USE_wxCursor))||(((wxLUA_USE_wxIcon) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)) && ((defined(__WXGTK__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP)))||(((wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP) && (wxLUA_USE_wxCursor)) && ((defined(__WXMSW__) || defined(__WXMAC__)) && (wxLUA_USE_wxDragDrop && wxUSE_DRAG_AND_DROP))) *************** *** 1706,1710 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxDropFilesEvent_delete[] = { &s_wxluatag_wxDropFilesEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDropFilesEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDropFilesEvent_delete }}; --- 1677,1681 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxDropFilesEvent_delete[] = { &s_wxluatag_wxDropFilesEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxDropFilesEvent_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxDropFilesEvent_delete }}; *************** *** 1799,1803 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxMetafile_delete[] = { &s_wxluatag_wxMetafile, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxMetafile_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxMetafile_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxMetafile_constructor[] = { &s_wxluaarg_String, NULL }; --- 1770,1774 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxMetafile_delete[] = { &s_wxluatag_wxMetafile, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxMetafile_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxMetafile_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxMetafile_constructor[] = { &s_wxluaarg_String, NULL }; *************** *** 1807,1811 **** static int LUACALL wxLua_wxMetafile_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1778,1781 ---- *************** *** 1874,1878 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxMetafileDC_delete[] = { &s_wxluatag_wxMetafileDC, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxMetafileDC_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxMetafileDC_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxMetafileDC_constructor[] = { &s_wxluaarg_String, NULL }; --- 1844,1848 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxMetafileDC_delete[] = { &s_wxluatag_wxMetafileDC, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxMetafileDC_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxMetafileDC_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxMetafileDC_constructor[] = { &s_wxluaarg_String, NULL }; *************** *** 1882,1886 **** static int LUACALL wxLua_wxMetafileDC_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 1852,1855 ---- Index: wxcore_help.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_help.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxcore_help.cpp 13 Dec 2007 06:23:54 -0000 1.8 --- wxcore_help.cpp 20 Dec 2007 02:26:57 -0000 1.9 *************** *** 70,74 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxContextHelp_delete[] = { &s_wxluatag_wxContextHelp, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxContextHelp_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxContextHelp_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxContextHelp_constructor[] = { &s_wxluatag_wxWindow, &s_wxluaarg_Boolean, NULL }; --- 70,74 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxContextHelp_delete[] = { &s_wxluatag_wxContextHelp, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxContextHelp_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxContextHelp_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxContextHelp_constructor[] = { &s_wxluatag_wxWindow, &s_wxluaarg_Boolean, NULL }; *************** *** 78,82 **** static int LUACALL wxLua_wxContextHelp_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 78,81 ---- *************** *** 128,132 **** static int LUACALL wxLua_wxContextHelpButton_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // get number of arguments int argCount = lua_gettop(L); --- 127,130 ---- *************** *** 305,309 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxHelpProvider_delete[] = { &s_wxluatag_wxHelpProvider, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxHelpProvider_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxHelpProvider_delete }}; --- 303,307 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxHelpProvider_delete[] = { &s_wxluatag_wxHelpProvider, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxHelpProvider_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxHelpProvider_delete }}; *************** *** 342,346 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxSimpleHelpProvider_delete[] = { &s_wxluatag_wxSimpleHelpProvider, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSimpleHelpProvider_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSimpleHelpProvider_delete }}; static int LUACALL wxLua_wxSimpleHelpProvider_constructor(lua_State *L); --- 340,344 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxSimpleHelpProvider_delete[] = { &s_wxluatag_wxSimpleHelpProvider, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxSimpleHelpProvider_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxSimpleHelpProvider_delete }}; static int LUACALL wxLua_wxSimpleHelpProvider_constructor(lua_State *L); *************** *** 349,353 **** static int LUACALL wxLua_wxSimpleHelpProvider_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // call constructor wxSimpleHelpProvider* returns = new wxSimpleHelpProvider(); --- 347,350 ---- *************** *** 417,421 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxHelpControllerHelpProvider_delete[] = { &s_wxluatag_wxHelpControllerHelpProvider, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxHelpControllerHelpProvider_delete[1] = {{ wxLua_wxluabind_delet... [truncated message content] |
From: John L. <jr...@us...> - 2007-12-20 02:27:04
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp wxlua.cpp wxlua_bind.cpp 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: wxlua.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxlua.cpp 13 Dec 2007 00:47:52 -0000 1.8 --- wxlua.cpp 20 Dec 2007 02:26:58 -0000 1.9 *************** *** 34,38 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaState_delete[] = { &s_wxluatag_wxLuaState, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaState_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaState_delete }}; --- 34,38 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaState_delete[] = { &s_wxluatag_wxLuaState, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaState_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaState_delete }}; *************** *** 104,108 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaObject_delete[] = { &s_wxluatag_wxLuaObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaObject_delete }}; static int LUACALL wxLua_wxLuaObject_constructor(lua_State *L); --- 104,108 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaObject_delete[] = { &s_wxluatag_wxLuaObject, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaObject_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaObject_delete }}; static int LUACALL wxLua_wxLuaObject_constructor(lua_State *L); *************** *** 112,116 **** static int LUACALL wxLua_wxLuaObject_constructor(lua_State *L) { - wxluabind_removetableforcall(L); wxLuaState wxlState(L); --- 112,115 ---- Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** wxlstate.cpp 19 Dec 2007 06:16:36 -0000 1.154 --- wxlstate.cpp 20 Dec 2007 02:26:58 -0000 1.155 *************** *** 227,231 **** } ! int start_arg = wxluabind_removetableforcall(L, true) ? 2 : 1; wxString argMsg = wxlua_getLuaArgsMsg(L, start_arg, lua_gettop(L)); --- 227,231 ---- } ! int start_arg = 1; wxString argMsg = wxlua_getLuaArgsMsg(L, start_arg, lua_gettop(L)); *************** *** 235,240 **** { // guarantee that this is a wxLuaBindMethod of ours so we don't crash const wxLuaBindClass* wxlClass = wxLuaBinding::GetBindClass(wxlMethod, NULL); ! if (wxlClass != NULL) { wxArrayString a = wxlua_getBindMethodArgsMsg(L, wxlMethod); --- 235,248 ---- { // guarantee that this is a wxLuaBindMethod of ours so we don't crash + + // check if this methid is part of a class const wxLuaBindClass* wxlClass = wxLuaBinding::GetBindClass(wxlMethod, NULL); ! ! // if not, check if it's a global C style function ! wxLuaBinding* binding = NULL; ! if (wxlClass == NULL) ! binding = wxLuaBinding::GetFunctionBinding(wxlMethod, NULL); ! ! if ((wxlClass != NULL) || (binding != NULL)) { wxArrayString a = wxlua_getBindMethodArgsMsg(L, wxlMethod); *************** *** 482,486 **** wxString LUACALL wxluaT_gettagname(lua_State* L, int wxl_tag) { ! // This is a predefined WXLUAARG_XXX type if (wxl_tag <= 0) return wxlua_getwxluatypename(wxl_tag); --- 490,494 ---- wxString LUACALL wxluaT_gettagname(lua_State* L, int wxl_tag) { ! // This is a predefined WXLUA_TXXX type if (wxl_tag <= 0) return wxlua_getwxluatypename(wxl_tag); *************** *** 488,493 **** if (wxl_tag == g_wxluatag_NULL) return wxT("NULL"); - if (wxl_tag == g_wxluatag_wxLuaFunction) - return wxT("wxLuaFunction"); const wxLuaBindClass* wxlClass = wxluaT_getclass(L, wxl_tag); --- 496,499 ---- *************** *** 514,519 **** if ((g_wxluatag_NULL == stack_tag) || // FIXME, how to check when NULL is valid or not? ! (g_wxluatag_wxLuaFunction == stack_tag) || ! ((wxl_tag == WXLUAARG_String) && (wxlua_isderivedclass(L, stack_tag, g_wxluatag_wxString) >= 0)) || (wxlua_isderivedclass(L, stack_tag, wxl_tag) >= 0)) return true; --- 520,524 ---- if ((g_wxluatag_NULL == stack_tag) || // FIXME, how to check when NULL is valid or not? ! ((wxl_tag == WXLUA_TSTRING) && (wxlua_isderivedclass(L, stack_tag, g_wxluatag_wxString) >= 0)) || (wxlua_isderivedclass(L, stack_tag, wxl_tag) >= 0)) return true; *************** *** 529,538 **** int stack_tag = wxluaT_gettag(L, stack_idx); ! if (g_wxluatag_wxLuaFunction == stack_tag) ! { ! wxLuaFunction *pFunction = (wxLuaFunction *)wxlua_touserdata(L, stack_idx, false); ! return pFunction->GetObject(); ! } ! else if (g_wxluatag_NULL == stack_tag) return NULL; else if (wxlua_isderivedclass(L, stack_tag, wxl_tag) >= 0) --- 534,538 ---- int stack_tag = wxluaT_gettag(L, stack_idx); ! if (g_wxluatag_NULL == stack_tag) return NULL; else if (wxlua_isderivedclass(L, stack_tag, wxl_tag) >= 0) *************** *** 553,562 **** // When il2 gets gc it will delete il even though il may still be valid and used by the notebook. ! // we don't track the wxLuaFunctions for speed ! if (wxl_tag != g_wxluatag_wxLuaFunction) ! { ! if (wxluaO_istrackedweakobject(L, (void*)obj_ptr, wxl_tag, true)) ! return true; ! } // Wrap the void* pointer in a newuserdata --- 553,558 ---- // When il2 gets gc it will delete il even though il may still be valid and used by the notebook. ! if (wxluaO_istrackedweakobject(L, (void*)obj_ptr, wxl_tag, true)) ! return true; // Wrap the void* pointer in a newuserdata *************** *** 911,925 **** // ---------------------------------------------------------------------------- ! void LUACALL wxluaW_addtrackedwindow(lua_State *L, wxObject* obj) { ! if (!obj) return; // allow NULL w/o error // don't track these "windows" since they're supposed to be attached // and their parents are not properly set so we can't tell if // their parents are tracked. ! if (wxDynamicCast(obj, wxMenuBar) != NULL) return; ! if (wxDynamicCast(obj, wxToolBar) != NULL) return; ! wxWindow* win = wxDynamicCast(obj, wxWindow); // only need to track parent window, it deletes children for us --- 907,921 ---- // ---------------------------------------------------------------------------- ! void LUACALL wxluaW_addtrackedwindow(lua_State *L, wxObject* wxobj) { ! if (!wxobj) return; // allow NULL w/o error // don't track these "windows" since they're supposed to be attached // and their parents are not properly set so we can't tell if // their parents are tracked. ! if (wxDynamicCast(wxobj, wxMenuBar) != NULL) return; ! if (wxDynamicCast(wxobj, wxToolBar) != NULL) return; ! wxWindow* win = wxDynamicCast(wxobj, wxWindow); // only need to track parent window, it deletes children for us *************** *** 1047,1071 **** } ! int LUACALL wxlua_iswxluatype(int luatype, int wxluaarg_tag, lua_State* L /* = NULL */) { int ret = -1; // unknown wxlua arg type ! switch (wxluaarg_tag) { ! case WXLUAARG_None : ret = (luatype == LUA_TNONE) ? 1 : 0; break; ! case WXLUAARG_Nil : ret = (luatype == LUA_TNIL) ? 1 : 0; break; ! case WXLUAARG_Boolean : // LUA_TNIL: nil == false // LUA_TNUMBER: 0 == false as in C ret = ((luatype == LUA_TBOOLEAN) || (luatype == LUA_TNUMBER) || (luatype == LUA_TNIL)) ? 1 : 0; break; ! case WXLUAARG_LightUserData : ret = (luatype == LUA_TLIGHTUSERDATA) ? 1 : 0; break; ! case WXLUAARG_Number : // LUA_TNIL: evaluates to 0, too easy to have a typo // LUA_TSTRING: will be 0 unless really a number "2" --- 1043,1067 ---- } ! int LUACALL wxlua_iswxluatype(int luatype, int wxlarg_tag, lua_State* L /* = NULL */) { int ret = -1; // unknown wxlua arg type ! switch (wxlarg_tag) { ! case WXLUA_TNONE : ret = (luatype == LUA_TNONE) ? 1 : 0; break; ! case WXLUA_TNIL : ret = (luatype == LUA_TNIL) ? 1 : 0; break; ! case WXLUA_TBOOLEAN : // LUA_TNIL: nil == false // LUA_TNUMBER: 0 == false as in C ret = ((luatype == LUA_TBOOLEAN) || (luatype == LUA_TNUMBER) || (luatype == LUA_TNIL)) ? 1 : 0; break; ! case WXLUA_TLIGHTUSERDATA: ret = (luatype == LUA_TLIGHTUSERDATA) ? 1 : 0; break; ! case WXLUA_TNUMBER : // LUA_TNIL: evaluates to 0, too easy to have a typo // LUA_TSTRING: will be 0 unless really a number "2" *************** *** 1073,1098 **** ret = ((luatype == LUA_TNUMBER) || (luatype == LUA_TBOOLEAN)) ? 1 : 0; break; ! case WXLUAARG_String : // LUA_TNIL: too easy to have a variable typo, use (str or "") // LUA_TNUMBER: can convert easily, always works, but breaks overload bindings ret = (luatype == LUA_TSTRING) ? 1 : 0; break; ! case WXLUAARG_Table : ret = (luatype == LUA_TTABLE) ? 1 : 0; break; ! case WXLUAARG_Function : ret = (luatype == LUA_TFUNCTION) ? 1 : 0; break; ! case WXLUAARG_UserData : ret = (luatype == LUA_TUSERDATA) ? 1 : 0; break; ! case WXLUAARG_Thread : ret = (luatype == LUA_TTHREAD) ? 1 : 0; break; ! case WXLUAARG_Integer : // LUA_TNIL: evaluates to 0 so wx.ENUM_typo = 0 ret = (luatype == LUA_TNUMBER) ? 1 : 0; break; ! case WXLUAARG_CFunction : ret = (luatype == LUA_TFUNCTION) ? 1 : 0; break; --- 1069,1094 ---- ret = ((luatype == LUA_TNUMBER) || (luatype == LUA_TBOOLEAN)) ? 1 : 0; break; ! case WXLUA_TSTRING : // LUA_TNIL: too easy to have a variable typo, use (str or "") // LUA_TNUMBER: can convert easily, always works, but breaks overload bindings ret = (luatype == LUA_TSTRING) ? 1 : 0; break; ! case WXLUA_TTABLE : ret = (luatype == LUA_TTABLE) ? 1 : 0; break; ! case WXLUA_TFUNCTION : ret = (luatype == LUA_TFUNCTION) ? 1 : 0; break; ! case WXLUA_TUSERDATA : ret = (luatype == LUA_TUSERDATA) ? 1 : 0; break; ! case WXLUA_TTHREAD : ret = (luatype == LUA_TTHREAD) ? 1 : 0; break; ! case WXLUA_TINTEGER : // LUA_TNIL: evaluates to 0 so wx.ENUM_typo = 0 ret = (luatype == LUA_TNUMBER) ? 1 : 0; break; ! case WXLUA_TCFUNCTION : ret = (luatype == LUA_TFUNCTION) ? 1 : 0; break; *************** *** 1102,1106 **** if ((ret < 0) && L &&(luatype == LUA_TTABLE)) { ! const wxLuaBindClass* wxlClass = wxluaT_getclass(L, wxluaarg_tag); if (wxlua_isderivedclass(wxlClass, wxluaT_getclass(L, "wxArrayString")) >= 0) --- 1098,1102 ---- if ((ret < 0) && L &&(luatype == LUA_TTABLE)) { ! const wxLuaBindClass* wxlClass = wxluaT_getclass(L, wxlarg_tag); if (wxlua_isderivedclass(wxlClass, wxluaT_getclass(L, "wxArrayString")) >= 0) *************** *** 1115,1119 **** } ! wxString wxlua_getwxluatypename(int wxluaarg_tag) { // try to use wxString's ref counting and return this existing copy --- 1111,1115 ---- } ! wxString wxlua_getwxluatypename(int wxlarg_tag, lua_State* L) { // try to use wxString's ref counting and return this existing copy *************** *** 1133,1151 **** }; ! switch (wxluaarg_tag) { ! case WXLUAARG_None : return s[0]; ! case WXLUAARG_Nil : return s[1]; ! case WXLUAARG_Boolean : return s[2]; ! case WXLUAARG_LightUserData : return s[3]; ! case WXLUAARG_Number : return s[4]; ! case WXLUAARG_String : return s[5]; ! case WXLUAARG_Table : return s[6]; ! case WXLUAARG_Function : return s[7]; ! case WXLUAARG_UserData : return s[8]; ! case WXLUAARG_Thread : return s[9]; ! case WXLUAARG_Integer : return s[10]; ! case WXLUAARG_CFunction : return s[11]; } --- 1129,1150 ---- }; ! if ((L != NULL) && (wxlarg_tag > 0)) ! return wxluaT_gettagname(L, wxlarg_tag); ! ! switch (wxlarg_tag) { ! case WXLUA_TNONE : return s[0]; ! case WXLUA_TNIL : return s[1]; ! case WXLUA_TBOOLEAN : return s[2]; ! case WXLUA_TLIGHTUSERDATA : return s[3]; ! case WXLUA_TNUMBER : return s[4]; ! case WXLUA_TSTRING : return s[5]; ! case WXLUA_TTABLE : return s[6]; ! case WXLUA_TFUNCTION : return s[7]; ! case WXLUA_TUSERDATA : return s[8]; ! case WXLUA_TTHREAD : return s[9]; ! case WXLUA_TINTEGER : return s[10]; ! case WXLUA_TCFUNCTION : return s[11]; } *************** *** 1155,1193 **** int wxlua_getwxluatype(int luatype) { switch (luatype) { ! case LUA_TNONE : return WXLUAARG_None; ! case LUA_TNIL : return WXLUAARG_Nil; ! case LUA_TBOOLEAN : return WXLUAARG_Boolean; ! case LUA_TLIGHTUSERDATA : return WXLUAARG_LightUserData; ! case LUA_TNUMBER : return WXLUAARG_Number; ! case LUA_TSTRING : return WXLUAARG_String; ! case LUA_TTABLE : return WXLUAARG_Table; ! case LUA_TFUNCTION : return WXLUAARG_Function; ! case LUA_TUSERDATA : return WXLUAARG_UserData; ! case LUA_TTHREAD : return WXLUAARG_Thread; ! //case LUA_T??? : return WXLUAARG_Integer; ! //case LUA_T??? : return WXLUAARG_CFunction; } ! return -1; } ! int wxlua_getluatype(int wxluaarg_tag) { ! switch (wxluaarg_tag) { ! case WXLUAARG_None : return LUA_TNONE; ! case WXLUAARG_Nil : return LUA_TNIL; ! case WXLUAARG_Boolean : return LUA_TBOOLEAN; ! case WXLUAARG_LightUserData : return LUA_TLIGHTUSERDATA; ! case WXLUAARG_Number : return LUA_TNUMBER; ! case WXLUAARG_String : return LUA_TSTRING; ! case WXLUAARG_Table : return LUA_TTABLE; ! case WXLUAARG_Function : return LUA_TFUNCTION; ! case WXLUAARG_UserData : return LUA_TUSERDATA; ! case WXLUAARG_Thread : return LUA_TTHREAD; ! case WXLUAARG_Integer : return LUA_TNUMBER; ! case WXLUAARG_CFunction : return LUA_TFUNCTION; } --- 1154,1197 ---- int wxlua_getwxluatype(int luatype) { + //int wxltype = LUAT_TO_WXLUAT(luatype); + //if ((wxltype > WXLUA_T_MAX) || (wxltype < WXLUA_T_MIN)) + // return WXLUA_TUNKNOWN; + //return wxltype; + switch (luatype) { ! case LUA_TNONE : return WXLUA_TNONE; ! case LUA_TNIL : return WXLUA_TNIL; ! case LUA_TBOOLEAN : return WXLUA_TBOOLEAN; ! case LUA_TLIGHTUSERDATA : return WXLUA_TLIGHTUSERDATA; ! case LUA_TNUMBER : return WXLUA_TNUMBER; ! case LUA_TSTRING : return WXLUA_TSTRING; ! case LUA_TTABLE : return WXLUA_TTABLE; ! case LUA_TFUNCTION : return WXLUA_TFUNCTION; ! case LUA_TUSERDATA : return WXLUA_TUSERDATA; ! case LUA_TTHREAD : return WXLUA_TTHREAD; ! //case LUA_T??? : return WXLUA_TINTEGER; ! //case LUA_T??? : return WXLUA_TCFUNCTION; } ! return WXLUA_TUNKNOWN; } ! int wxlua_getluatype(int wxlarg) { ! switch (wxlarg) { ! case WXLUA_TNONE : return LUA_TNONE; ! case WXLUA_TNIL : return LUA_TNIL; ! case WXLUA_TBOOLEAN : return LUA_TBOOLEAN; ! case WXLUA_TLIGHTUSERDATA : return LUA_TLIGHTUSERDATA; ! case WXLUA_TNUMBER : return LUA_TNUMBER; ! case WXLUA_TSTRING : return LUA_TSTRING; ! case WXLUA_TTABLE : return LUA_TTABLE; ! case WXLUA_TFUNCTION : return LUA_TFUNCTION; ! case WXLUA_TUSERDATA : return LUA_TUSERDATA; ! case WXLUA_TTHREAD : return LUA_TTHREAD; ! case WXLUA_TINTEGER : return LUA_TNUMBER; ! case WXLUA_TCFUNCTION : return LUA_TFUNCTION; } *************** *** 1202,1206 **** bool wxlua_iswxstringtype(lua_State* L, int stack_idx) { ! if (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUAARG_String) == 1) return true; else if (wxlua_iswxuserdata(L, stack_idx)) --- 1206,1210 ---- bool wxlua_iswxstringtype(lua_State* L, int stack_idx) { ! if (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TSTRING) == 1) return true; else if (wxlua_iswxuserdata(L, stack_idx)) *************** *** 1245,1249 **** int l_type = lua_type(L, stack_idx); ! if (!wxlua_iswxluatype(l_type, WXLUAARG_Boolean)) wxlua_argerror(L, stack_idx, wxT("a 'boolean'")); --- 1249,1253 ---- int l_type = lua_type(L, stack_idx); ! if (!wxlua_iswxluatype(l_type, WXLUA_TBOOLEAN)) wxlua_argerror(L, stack_idx, wxT("a 'boolean'")); *************** *** 1261,1265 **** int l_type = lua_type(L, stack_idx); ! if (!wxlua_iswxluatype(l_type, WXLUAARG_Integer)) wxlua_argerror(L, stack_idx, wxT("an 'integer'")); --- 1265,1269 ---- int l_type = lua_type(L, stack_idx); ! if (!wxlua_iswxluatype(l_type, WXLUA_TINTEGER)) wxlua_argerror(L, stack_idx, wxT("an 'integer'")); *************** *** 1280,1284 **** int l_type = lua_type(L, stack_idx); ! if (!wxlua_iswxluatype(l_type, WXLUAARG_Number)) wxlua_argerror(L, stack_idx, wxT("a 'number'")); --- 1284,1288 ---- int l_type = lua_type(L, stack_idx); ! if (!wxlua_iswxluatype(l_type, WXLUA_TNUMBER)) wxlua_argerror(L, stack_idx, wxT("a 'number'")); *************** *** 2688,2702 **** lua_State* L = M_WXLSTATEDATA->m_lua_State; - // Create a metatable for our C function wrapper wxLuaFunction - g_wxluatag_wxLuaFunction = wxluaT_NewTag(); - lua_pushstring(L, "__gc"); - lua_pushcfunction(L, wxlua__gc_wxLuaFunction); - lua_rawset(L, -3); // t["method_name"] = closure of func - - lua_pushstring(L, "__call"); - lua_pushcfunction(L, wxlua__call_wxLuaFunction); - lua_rawset(L, -3); // t["method_name"] = closure of func - lua_pop(L, 1); // remove the new table from wxluaT_NewTag() - // Finally - set the global tags from the bindings we've just installed --- 2692,2695 ---- Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** wxlbind.cpp 19 Dec 2007 06:16:36 -0000 1.108 --- wxlbind.cpp 20 Dec 2007 02:26:58 -0000 1.109 *************** *** 28,45 **** wxLuaBindDefine s_wxluadefineArray_None[1] = {{0, 0}}; ! int s_wxluaarg_None = WXLUAARG_None; ! int s_wxluaarg_Nil = WXLUAARG_Nil; ! int s_wxluaarg_Boolean = WXLUAARG_Boolean; ! int s_wxluaarg_LightUserData = WXLUAARG_LightUserData; // raw data ! int s_wxluaarg_Number = WXLUAARG_Number; ! int s_wxluaarg_String = WXLUAARG_String; ! int s_wxluaarg_Table = WXLUAARG_Table; ! int s_wxluaarg_Function = WXLUAARG_Function; ! int s_wxluaarg_UserData = WXLUAARG_UserData; // raw data ! int s_wxluaarg_Thread = WXLUAARG_Thread; ! int s_wxluaarg_Integer = WXLUAARG_Integer; ! int s_wxluaarg_CFunction = WXLUAARG_CFunction; - int g_wxluatag_wxLuaFunction = WXLUA_NOTAG; int g_wxluatag_NULL = WXLUA_NOTAG; int g_wxluatag_wxEvent = WXLUA_NOTAG; --- 28,44 ---- wxLuaBindDefine s_wxluadefineArray_None[1] = {{0, 0}}; ! int s_wxluaarg_None = WXLUA_TNONE; ! int s_wxluaarg_Nil = WXLUA_TNIL; ! int s_wxluaarg_Boolean = WXLUA_TBOOLEAN; ! int s_wxluaarg_LightUserData = WXLUA_TLIGHTUSERDATA; // raw data ! int s_wxluaarg_Number = WXLUA_TNUMBER; ! int s_wxluaarg_String = WXLUA_TSTRING; ! int s_wxluaarg_Table = WXLUA_TTABLE; ! int s_wxluaarg_Function = WXLUA_TFUNCTION; ! int s_wxluaarg_UserData = WXLUA_TUSERDATA; // raw data ! int s_wxluaarg_Thread = WXLUA_TTHREAD; ! int s_wxluaarg_Integer = WXLUA_TINTEGER; ! int s_wxluaarg_CFunction = WXLUA_TCFUNCTION; int g_wxluatag_NULL = WXLUA_NOTAG; int g_wxluatag_wxEvent = WXLUA_NOTAG; *************** *** 50,105 **** int g_wxluatag_wxArrayInt = WXLUA_NOTAG; - //----------------------------------------------------------------------------- - // wxLuaFunction - //----------------------------------------------------------------------------- - - int wxLuaFunction::CallMethod(lua_State *L) - { - // remove this line to restore calling methods using the dot notation - // otherwise the colon notation *must* be used. - lua_remove(L, 1); // remove the wxLuaFunction userdata from the stack - - if (m_wxlMethod->basemethod) - return wxlua_CallOverloadedFunction(L, m_wxlMethod); - - return (*m_wxlMethod->funcs[0].func)(L); - } - - int LUACALL wxlua__gc_wxLuaFunction(lua_State *L) - { - // Sanity check, but this is only attached to a wxLuaFunction, so it has to be ok. - //if (wxlua_iswxuserdata(L, 1) && (wxluaT_gettag(L, 1) == g_wxluatag_wxLuaFunction)) - { - wxLuaFunction *wxlFunction = (wxLuaFunction *)wxlua_touserdata(L, 1, true); - if (wxlFunction != NULL) - delete wxlFunction; - } - return 0; - } - - int LUACALL wxlua__call_wxLuaFunction(lua_State *L) - { - // Sanity check, but this is only attached to a wxLuaFunction, so it has to be ok. - //if (wxlua_iswxuserdata(L, 1) && (wxluaT_gettag(L, 1) == g_wxluatag_wxLuaFunction)) - { - wxLuaFunction *f = (wxLuaFunction *)wxlua_touserdata(L, 1, false); - return f->CallMethod(L); - } - return 0; - } - // ---------------------------------------------------------------------------- // Central function to call for overloaded functions // ---------------------------------------------------------------------------- ! ! static int LUACALL wxlua_CallOverloadedFunction(lua_State* L) { wxLuaBindMethod* wxlMethod = (wxLuaBindMethod *)lua_touserdata(L, lua_upvalueindex(1)); // lightuserdata wxCHECK_MSG(wxlMethod, 0, wxT("Invalid wxLuaBindMethod")); ! return wxlua_CallOverloadedFunction(L, wxlMethod); } ! int LUACALL wxlua_CallOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod) { int i, arg; --- 49,68 ---- int g_wxluatag_wxArrayInt = WXLUA_NOTAG; // ---------------------------------------------------------------------------- // Central function to call for overloaded functions // ---------------------------------------------------------------------------- ! int LUACALL wxlua_callOverloadedFunction(lua_State* L) { wxLuaBindMethod* wxlMethod = (wxLuaBindMethod *)lua_touserdata(L, lua_upvalueindex(1)); // lightuserdata wxCHECK_MSG(wxlMethod, 0, wxT("Invalid wxLuaBindMethod")); ! ! if ((wxlMethod->funcs_n > 1) || (wxlMethod->basemethod)) ! return wxlua_callOverloadedFunction(L, wxlMethod); ! else ! return (*wxlMethod->funcs[0].func)(L); } ! int LUACALL wxlua_callOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod) { int i, arg; *************** *** 109,119 **** int arg_lua_start = 1; - // don't remove the table, but do skip past it when counting args - if (wxluabind_removetableforcall(L, true)) - { - arg_lua_count--; - arg_lua_start++; - } - // only look at the methods that could possibly work and traverse base classes wxArrayPtrVoid funcArray; --- 72,75 ---- *************** *** 125,135 **** for (i = 0; i < method->funcs_n; ++i, ++bindFunc) { ! if (!WXLUA_HASBIT(bindFunc->type, WXLUAMETHOD_OVERLOAD) && ! (arg_lua_count >= bindFunc->minargs) && (arg_lua_count <= bindFunc->maxargs)) { funcArray.Add(bindFunc); } - } --- 81,89 ---- for (i = 0; i < method->funcs_n; ++i, ++bindFunc) { ! if ((arg_lua_count >= bindFunc->minargs) && (arg_lua_count <= bindFunc->maxargs)) { funcArray.Add(bindFunc); } } *************** *** 171,175 **** // unknown/invalid standard wxlua arg type, check binding tag ! if ((is_ok == -1) || ((is_ok == 0) && (tag == WXLUAARG_String))) { is_ok = (wxluaT_isuserdatatype(L, arg_lua, tag) || --- 125,129 ---- // unknown/invalid standard wxlua arg type, check binding tag ! if ((is_ok == -1) || ((is_ok == 0) && (tag == WXLUA_TSTRING))) { is_ok = (wxluaT_isuserdatatype(L, arg_lua, tag) || *************** *** 305,346 **** wxString funcStr = wxString::Format(wxT("%02d. %s%s("), i_func, className.c_str(), lua2wx(method->name).c_str()); ! // overloaded function has invalid tags ! if (WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_OVERLOAD)) ! { ! // However, we do print that there is an overload so that in CallOverloadedFunction ! // we can find what function we were closest too. ! funcStr += wxT(" ... ) - overloaded function"); ! } ! else { ! for (arg = 0; arg < funcs[i].maxargs; ++arg) ! { ! // optional args? ! if ((funcs[i].minargs < funcs[i].maxargs) && (arg == funcs[i].minargs)) ! funcStr += wxT("["); ! if (arg > 0) ! funcStr += wxT(", "); ! int tag = (int)*(funcs[i].argtags[arg]); ! funcStr += wxluaT_gettagname(L, tag); ! if ((arg == 0) && ! !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC) && ! !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && ! !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CFUNCTION)) ! funcStr += wxT("(self)"); ! } ! // close optional args ! if (funcs[i].minargs < funcs[i].maxargs) ! funcStr += wxT("]"); ! funcStr += wxT(")"); ! if (WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC)) ! funcStr += wxT(" - static"); ! } overloadMethodArray.Add(funcStr); --- 259,290 ---- wxString funcStr = wxString::Format(wxT("%02d. %s%s("), i_func, className.c_str(), lua2wx(method->name).c_str()); ! for (arg = 0; arg < funcs[i].maxargs; ++arg) { ! // optional args? ! if ((funcs[i].minargs < funcs[i].maxargs) && (arg == funcs[i].minargs)) ! funcStr += wxT("["); ! if (arg > 0) ! funcStr += wxT(", "); ! int tag = (int)*(funcs[i].argtags[arg]); ! funcStr += wxluaT_gettagname(L, tag); ! if ((arg == 0) && ! !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC) && ! !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && ! !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CFUNCTION)) ! funcStr += wxT("(self)"); ! } ! // close optional args ! if (funcs[i].minargs < funcs[i].maxargs) ! funcStr += wxT("]"); ! funcStr += wxT(")"); ! if (WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC)) ! funcStr += wxT(" - static"); overloadMethodArray.Add(funcStr); *************** *** 586,590 **** // ---------------------------------------------------------------------------- ! int LUACALL wxLua_wxluabind_delete(lua_State *L) { void* udata = lua_touserdata(L, 1); --- 530,534 ---- // ---------------------------------------------------------------------------- ! int LUACALL wxlua_userdata_delete(lua_State *L) { void* udata = lua_touserdata(L, 1); *************** *** 611,615 **** // ---------------------------------------------------------------------------- ! int LUACALL wxluabind__gc_wxLuaBindClass(lua_State *L) { wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); --- 555,559 ---- // ---------------------------------------------------------------------------- ! int LUACALL wxlua_wxLuaBindClass__gc(lua_State *L) { wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); *************** *** 630,639 **** // Called by LUA to find the method that corresponds to a given method name. // The class to lookup is in an upvalue. (gettable tag method). - // If the method is a function method push a wxLuaFunction object - // onto the Lua stack, setting its metatable so that when Lua calls __call - // the wxLuaFunction will run the actual method we set for it. // ---------------------------------------------------------------------------- ! int LUACALL wxluabind__index_wxLuaBindClass(lua_State *L) { // This function is called for the __index metable of the wxLua userdata --- 574,580 ---- // Called by LUA to find the method that corresponds to a given method name. // The class to lookup is in an upvalue. (gettable tag method). // ---------------------------------------------------------------------------- ! int LUACALL wxlua_wxLuaBindClass__index(lua_State *L) { // This function is called for the __index metable of the wxLua userdata *************** *** 717,733 **** result = 1; - #if 1 lua_pushlightuserdata(L, wxlMethod); ! // experimental function calls w/o using the wxLuaFunction ! if (wxlMethod->basemethod) ! lua_pushcclosure(L, wxlua_CallOverloadedFunction, 1); else lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); - #else - wxLuaFunction *wxlFunc = new wxLuaFunction(wxlMethod, obj_ptr); - // Don't track the wxLuaFunction for speed - wxluaT_pushusertag(L, wxlFunc, g_wxluatag_wxLuaFunction, false); - #endif } } --- 658,667 ---- result = 1; lua_pushlightuserdata(L, wxlMethod); ! if ((wxlMethod->funcs_n > 1) || (wxlMethod->basemethod)) ! lua_pushcclosure(L, wxlua_callOverloadedFunction, 1); else lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); } } *************** *** 776,780 **** // ---------------------------------------------------------------------------- ! int LUACALL wxluabind__newindex_wxLuaBindClass(lua_State *L) { wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); --- 710,714 ---- // ---------------------------------------------------------------------------- ! int LUACALL wxlua_wxLuaBindClass__newindex(lua_State *L) { wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); *************** *** 831,835 **** // ---------------------------------------------------------------------------- ! int LUACALL wxluabind__tostring_wxLuaBindClass(lua_State *L) { wxLuaState wxlState(L); --- 765,769 ---- // ---------------------------------------------------------------------------- ! int LUACALL wxlua_wxLuaBindClass__tostring(lua_State *L) { wxLuaState wxlState(L); *************** *** 857,874 **** // ---------------------------------------------------------------------------- ! // Use the pointer to this int as a special tag to know that __call has been ! // made on a table and that we want to remove the table for the bindings to ! // work. This is because Lua always pushes the table on the stack if '.' or ':' ! // is used for the __call metamethod. // ---------------------------------------------------------------------------- - static int wxluabind_checkremovetable = 0; ! int wxluabind_removetableforcall(lua_State* L, bool only_check) { ! void* p = (void *)lua_touserdata(L, lua_upvalueindex(2)); // lightuserdata ! if (!only_check && (p == &wxluabind_checkremovetable)) ! lua_remove(L, 1); ! return p == &wxluabind_checkremovetable; } --- 791,802 ---- // ---------------------------------------------------------------------------- ! // // ---------------------------------------------------------------------------- ! int LUACALL wxlua_wxLuaBindMethod_table__call(lua_State *L) { ! lua_remove(L, 1); // remove the table ! return wxlua_callOverloadedFunction(L); } *************** *** 1072,1079 **** static const luaL_reg s_funcTable[] = { ! {"__gc", wxluabind__gc_wxLuaBindClass }, ! {"__index", wxluabind__index_wxLuaBindClass }, ! {"__newindex", wxluabind__newindex_wxLuaBindClass }, ! {"__tostring", wxluabind__tostring_wxLuaBindClass } }; static const size_t s_funcCount = sizeof(s_funcTable)/sizeof(s_funcTable[0]); --- 1000,1007 ---- static const luaL_reg s_funcTable[] = { ! {"__gc", wxlua_wxLuaBindClass__gc }, ! {"__index", wxlua_wxLuaBindClass__index }, ! {"__newindex", wxlua_wxLuaBindClass__newindex }, ! {"__tostring", wxlua_wxLuaBindClass__tostring } }; static const size_t s_funcCount = sizeof(s_funcTable)/sizeof(s_funcTable[0]); *************** *** 1177,1182 **** lua_pushlstring(L, "new", 3); lua_pushlightuserdata(L, wxlMethod); ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); ! lua_rawset(L, -3); // same as lua_setfield(L, -2, "key") // Create the metatable for this table --- 1105,1110 ---- lua_pushlstring(L, "new", 3); lua_pushlightuserdata(L, wxlMethod); ! lua_pushcclosure(L, wxlua_callOverloadedFunction, 1); ! lua_rawset(L, -3); // Create the metatable for this table *************** *** 1185,1190 **** lua_pushlstring(L, "__call", 6); lua_pushlightuserdata(L, wxlMethod); ! lua_pushlightuserdata(L, &wxluabind_checkremovetable); // push tag to recognize table call ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 2); // push func with tag as upvalue lua_rawset(L, -3); --- 1113,1117 ---- lua_pushlstring(L, "__call", 6); lua_pushlightuserdata(L, wxlMethod); ! lua_pushcclosure(L, wxlua_wxLuaBindMethod_table__call, 1); lua_rawset(L, -3); *************** *** 1480,1483 **** --- 1407,1435 ---- } + // static + wxLuaBinding* wxLuaBinding::GetFunctionBinding(const wxLuaBindMethod* method, const wxLuaBindingList* bindingList_) + { + const wxLuaBindingList* bindingList = bindingList_ ? bindingList_ : &sm_bindingList; + wxLuaBindingList::compatibility_iterator node = bindingList->GetFirst(); + + while (node) + { + wxLuaBinding* binding = node->GetData(); + size_t n, count = binding->GetFunctionCount(); + wxLuaBindMethod* m = binding->GetFunctionArray(); + + for (n = 0; n < count; ++n, ++m) + { + if (m == method) + return binding; + } + + node = node->GetNext(); + } + + return NULL; + } + + // -------------------------------------------------------------------------- *************** *** 1541,1553 **** for (i_method = 0; i_method < method_count; ++i_method, ++wxlMethod) { ! if (isLuaSetProp) ! { ! if (WXLUA_HASBIT(wxlMethod->type, WXLUAMETHOD_SETPROP) && (strcmp(wxlMethod->name, propName) == 0)) ! return wxlMethod; ! } ! else { ! if (WXLUA_HASBIT(wxlMethod->type, WXLUAMETHOD_GETPROP) && (strcmp(wxlMethod->name, propName) == 0)) ! return wxlMethod; } } --- 1493,1501 ---- for (i_method = 0; i_method < method_count; ++i_method, ++wxlMethod) { ! if (((isLuaSetProp && WXLUA_HASBIT(wxlMethod->type, WXLUAMETHOD_SETPROP)) || ! (!isLuaSetProp && WXLUA_HASBIT(wxlMethod->type, WXLUAMETHOD_GETPROP))) && ! (strcmp(wxlMethod->name, propName) == 0)) { ! return wxlMethod; } } Index: wxlua_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua_bind.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** wxlua_bind.cpp 15 Dec 2007 16:56:41 -0000 1.17 --- wxlua_bind.cpp 20 Dec 2007 02:26:58 -0000 1.18 *************** *** 59,73 **** { "LUA_TTHREAD", LUA_TTHREAD }, { "LUA_TUSERDATA", LUA_TUSERDATA }, - { "WXLUAARG_Boolean", WXLUAARG_Boolean }, - { "WXLUAARG_Function", WXLUAARG_Function }, - { "WXLUAARG_Integer", WXLUAARG_Integer }, - { "WXLUAARG_LightUserData", WXLUAARG_LightUserData }, - { "WXLUAARG_Nil", WXLUAARG_Nil }, - { "WXLUAARG_None", WXLUAARG_None }, - { "WXLUAARG_Number", WXLUAARG_Number }, - { "WXLUAARG_String", WXLUAARG_String }, - { "WXLUAARG_Table", WXLUAARG_Table }, - { "WXLUAARG_Thread", WXLUAARG_Thread }, - { "WXLUAARG_UserData", WXLUAARG_UserData }, { "WXLUAMETHOD_CFUNCTION", WXLUAMETHOD_CFUNCTION }, { "WXLUAMETHOD_CONSTRUCTOR", WXLUAMETHOD_CONSTRUCTOR }, --- 59,62 ---- *************** *** 75,82 **** { "WXLUAMETHOD_GETPROP", WXLUAMETHOD_GETPROP }, { "WXLUAMETHOD_METHOD", WXLUAMETHOD_METHOD }, - { "WXLUAMETHOD_OVERLOAD", WXLUAMETHOD_OVERLOAD }, { "WXLUAMETHOD_OVERLOAD_BASE", WXLUAMETHOD_OVERLOAD_BASE }, { "WXLUAMETHOD_SETPROP", WXLUAMETHOD_SETPROP }, { "WXLUAMETHOD_STATIC", WXLUAMETHOD_STATIC }, { "wxLUAOBJECT_ARRAYINT", wxLUAOBJECT_ARRAYINT }, { "wxLUAOBJECT_BOOL", wxLUAOBJECT_BOOL }, --- 64,82 ---- { "WXLUAMETHOD_GETPROP", WXLUAMETHOD_GETPROP }, { "WXLUAMETHOD_METHOD", WXLUAMETHOD_METHOD }, { "WXLUAMETHOD_OVERLOAD_BASE", WXLUAMETHOD_OVERLOAD_BASE }, { "WXLUAMETHOD_SETPROP", WXLUAMETHOD_SETPROP }, { "WXLUAMETHOD_STATIC", WXLUAMETHOD_STATIC }, + { "WXLUA_TBOOLEAN", WXLUA_TBOOLEAN }, + { "WXLUA_TCFUNCTION", WXLUA_TCFUNCTION }, + { "WXLUA_TFUNCTION", WXLUA_TFUNCTION }, + { "WXLUA_TINTEGER", WXLUA_TINTEGER }, + { "WXLUA_TLIGHTUSERDATA", WXLUA_TLIGHTUSERDATA }, + { "WXLUA_TNIL", WXLUA_TNIL }, + { "WXLUA_TNONE", WXLUA_TNONE }, + { "WXLUA_TNUMBER", WXLUA_TNUMBER }, + { "WXLUA_TSTRING", WXLUA_TSTRING }, + { "WXLUA_TTABLE", WXLUA_TTABLE }, + { "WXLUA_TTHREAD", WXLUA_TTHREAD }, + { "WXLUA_TUSERDATA", WXLUA_TUSERDATA }, { "wxLUAOBJECT_ARRAYINT", wxLUAOBJECT_ARRAYINT }, { "wxLUAOBJECT_BOOL", wxLUAOBJECT_BOOL }, |
From: John L. <jr...@us...> - 2007-12-20 02:27:03
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/modules/wxluasocket/src Modified Files: wxluasocket.cpp 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: wxluasocket.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxluasocket.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** wxluasocket.cpp 13 Dec 2007 00:47:53 -0000 1.35 --- wxluasocket.cpp 20 Dec 2007 02:26:58 -0000 1.36 *************** *** 346,350 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerServer_delete[] = { &s_wxluatag_wxLuaDebuggerServer, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaDebuggerServer_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaDebuggerServer_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerServer_constructor[] = { &s_wxluaarg_Number, NULL }; --- 346,350 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerServer_delete[] = { &s_wxluatag_wxLuaDebuggerServer, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaDebuggerServer_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaDebuggerServer_delete }}; static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerServer_constructor[] = { &s_wxluaarg_Number, NULL }; *************** *** 354,358 **** static int LUACALL wxLua_wxLuaDebuggerServer_constructor(lua_State *L) { - wxluabind_removetableforcall(L); // int portNumber int portNumber = (int)wxlua_getnumbertype(L, 1); --- 354,357 ---- *************** *** 470,474 **** static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerEvent_delete[] = { &s_wxluatag_wxLuaDebuggerEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaDebuggerEvent_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaDebuggerEvent_delete }}; --- 469,473 ---- static wxLuaArgTag s_wxluatagArray_wxLua_wxLuaDebuggerEvent_delete[] = { &s_wxluatag_wxLuaDebuggerEvent, NULL }; ! static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaDebuggerEvent_delete[1] = {{ wxlua_userdata_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxLuaDebuggerEvent_delete }}; |
From: John L. <jr...@us...> - 2007-12-20 02:27:03
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/samples Modified Files: bindings.wx.lua unittest.wx.lua 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: bindings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/bindings.wx.lua,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** bindings.wx.lua 17 Jul 2007 14:45:21 -0000 1.17 --- bindings.wx.lua 20 Dec 2007 02:26:58 -0000 1.18 *************** *** 291,295 **** t = HasBit(t, wxlua.WXLUAMETHOD_OVERLOAD_BASE, nil, nil) -- nobody should care about this t = HasBit(t, wxlua.WXLUAMETHOD_DELETE, s, "Delete") - t = HasBit(t, wxlua.WXLUAMETHOD_OVERLOAD, s, "Overload") t = HasBit(t, wxlua.WXLUAMETHOD_STATIC, s, "Static") t = HasBit(t, wxlua.WXLUAMETHOD_SETPROP, s, "SetProp") --- 291,294 ---- *************** *** 877,891 **** local wxltype_names = { ! "WXLUAARG_None", ! "WXLUAARG_Nil", ! "WXLUAARG_Boolean", ! "WXLUAARG_LightUserData", ! "WXLUAARG_Number", ! "WXLUAARG_String", ! "WXLUAARG_Table", ! "WXLUAARG_Function", ! "WXLUAARG_UserData", ! "WXLUAARG_Thread", ! "WXLUAARG_Integer" } --- 876,891 ---- local wxltype_names = { ! "WXLUA_TNONE", ! "WXLUA_TNIL", ! "WXLUA_TBOOLEAN", ! "WXLUA_TLIGHTUSERDATA", ! "WXLUA_TNUMBER", ! "WXLUA_TSTRING", ! "WXLUA_TTABLE", ! "WXLUA_TFUNCTION", ! "WXLUA_TUSERDATA", ! "WXLUA_TTHREAD", ! "WXLUA_TINTEGER", ! "WXLUA_TCFUNCTION" } Index: unittest.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/unittest.wx.lua,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** unittest.wx.lua 13 Dec 2007 00:47:53 -0000 1.18 --- unittest.wx.lua 20 Dec 2007 02:26:59 -0000 1.19 *************** *** 90,94 **** end ! PrintOk(wxlua.WXLUAARG_Nil == -2, "Test wxlua bindings wxlua.WXLUAARG_Nil == -2") -- --------------------------------------------------------------------------- --- 90,94 ---- end ! PrintOk(wxlua.WXLUA_TNIL == -2, "Test wxlua bindings wxlua.WXLUA_TNIL == -2") -- --------------------------------------------------------------------------- *************** *** 212,216 **** -- Test new() constructor function and copying it f = wx.wxImage.new ! PrintOk(f(5,5):Ok(), "Calling wx.wxImage.new(5,5) function as constructor.") -- Test calling a baseclass function a few levels deep --- 212,222 ---- -- Test new() constructor function and copying it f = wx.wxImage.new ! PrintOk(f(5,6):Ok(), "Calling wx.wxImage.new(5,6) function as constructor.") ! ! f = wx.wxImage(5,6) ! g = f.GetWidth ! PrintOk(type(g) == "function", "Type f = wx.wxImage(5,6); f.GetWidth is a function.") ! ! PrintOk(g(f) == 5, "Calling f = wx.wxImage(5,6); g = f.GetWidth; g(f) == 5; function is callable outside of userdata.") -- Test calling a baseclass function a few levels deep |
From: John L. <jr...@us...> - 2007-12-20 02:27:03
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp 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: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** wxlstack.cpp 13 Dec 2007 00:47:53 -0000 1.28 --- wxlstack.cpp 20 Dec 2007 02:26:58 -0000 1.29 *************** *** 440,456 **** switch (dbgItem->GetValueType()) { ! case WXLUAARG_None : img = IMG_NONE; break; ! case WXLUAARG_Unknown : img = IMG_UNKNOWN; break; ! case WXLUAARG_Nil : img = IMG_NIL; break; ! case WXLUAARG_Boolean : img = IMG_BOOLEAN; break; ! case WXLUAARG_LightUserData : img = IMG_LIGHTUSERDATA; break; ! case WXLUAARG_Number : img = IMG_NUMBER; break; ! case WXLUAARG_String : img = IMG_STRING; break; ! case WXLUAARG_Table : img = IMG_TABLE; break; ! case WXLUAARG_Function : img = IMG_LUAFUNCTION; break; ! case WXLUAARG_UserData : img = IMG_USERDATA; break; ! case WXLUAARG_Thread : img = IMG_THREAD; break; ! case WXLUAARG_Integer : img = IMG_INTEGER; break; ! case WXLUAARG_CFunction : img = IMG_CFUNCTION; break; } } --- 440,456 ---- switch (dbgItem->GetValueType()) { ! case WXLUA_TUNKNOWN : img = IMG_UNKNOWN; break; ! case WXLUA_TNONE : img = IMG_NONE; break; ! case WXLUA_TNIL : img = IMG_NIL; break; ! case WXLUA_TBOOLEAN : img = IMG_BOOLEAN; break; ! case WXLUA_TLIGHTUSERDATA : img = IMG_LIGHTUSERDATA; break; ! case WXLUA_TNUMBER : img = IMG_NUMBER; break; ! case WXLUA_TSTRING : img = IMG_STRING; break; ! case WXLUA_TTABLE : img = IMG_TABLE; break; ! case WXLUA_TFUNCTION : img = IMG_LUAFUNCTION; break; ! case WXLUA_TUSERDATA : img = IMG_USERDATA; break; ! case WXLUA_TTHREAD : img = IMG_THREAD; break; ! case WXLUA_TINTEGER : img = IMG_INTEGER; break; ! case WXLUA_TCFUNCTION : img = IMG_CFUNCTION; break; } } *************** *** 576,581 **** // Add the locals, fake a debug item to get it setup right ! wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), WXLUAARG_None, ! wxString::Format(wxT("%d Items"), (int)debugData.GetCount()), WXLUAARG_None, wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED|WXLUA_DEBUGITEM_LOCALS|WXLUA_DEBUGITEM_VALUE_REF); wxLuaDebugData localData(true); // this deletes the items --- 576,581 ---- // Add the locals, fake a debug item to get it setup right ! wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), WXLUA_TNONE, ! wxString::Format(wxT("%d Items"), (int)debugData.GetCount()), WXLUA_TNONE, wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED|WXLUA_DEBUGITEM_LOCALS|WXLUA_DEBUGITEM_VALUE_REF); wxLuaDebugData localData(true); // this deletes the items Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** wxldebug.cpp 15 Dec 2007 16:56:41 -0000 1.60 --- wxldebug.cpp 20 Dec 2007 02:26:58 -0000 1.61 *************** *** 139,144 **** long l1 = 0, l2 = 0; ! if ((elem1->m_itemKeyType == WXLUAARG_Number) && ! (elem2->m_itemKeyType == WXLUAARG_Number) && elem1->m_itemKey.BeforeFirst(wxT(' ')).ToLong(&l1) && elem2->m_itemKey.BeforeFirst(wxT(' ')).ToLong(&l2)) --- 139,144 ---- long l1 = 0, l2 = 0; ! if ((elem1->m_itemKeyType == WXLUA_TNUMBER) && ! (elem2->m_itemKeyType == WXLUA_TNUMBER) && elem1->m_itemKey.BeforeFirst(wxT(' ')).ToLong(&l1) && elem2->m_itemKey.BeforeFirst(wxT(' ')).ToLong(&l2)) *************** *** 201,205 **** name = wxString::Format(_("line %d"), currentLine); ! Add(new wxLuaDebugItem(name, WXLUAARG_None, wxT(""), WXLUAARG_None, source, LUA_NOREF, stack_frame, WXLUA_DEBUGITEM_LOCALS)); ++count; } --- 201,205 ---- name = wxString::Format(_("line %d"), currentLine); ! Add(new wxLuaDebugItem(name, WXLUA_TNONE, wxT(""), WXLUA_TNONE, source, LUA_NOREF, stack_frame, WXLUA_DEBUGITEM_LOCALS)); ++count; } *************** *** 230,234 **** //wxPrintf(wxString(lua_Debug_to_wxString(luaDebug) + wxT(" lua_getlocal :") + name + wxT("\n")).c_str()); ! int wxl_valuetype = WXLUAARG_None; wxString value; wxString source(lua2wx(luaDebug.source)); --- 230,234 ---- //wxPrintf(wxString(lua_Debug_to_wxString(luaDebug) + wxT(" lua_getlocal :") + name + wxT("\n")).c_str()); ! int wxl_valuetype = WXLUA_TNONE; wxString value; wxString source(lua2wx(luaDebug.source)); *************** *** 248,252 **** lua_pop(L, 1); // remove variable value ! Add(new wxLuaDebugItem(name, WXLUAARG_None, value, wxl_valuetype, source, nRef, 0, flag_type)); ++count; --- 248,252 ---- lua_pop(L, 1); // remove variable value ! Add(new wxLuaDebugItem(name, WXLUA_TNONE, value, wxl_valuetype, source, nRef, 0, flag_type)); ++count; *************** *** 277,282 **** int count = 0; ! int wxl_keytype = WXLUAARG_None; ! int wxl_valuetype = WXLUAARG_None; wxString value; wxString name; --- 277,282 ---- int count = 0; ! int wxl_keytype = WXLUA_TNONE; ! int wxl_valuetype = WXLUA_TNONE; wxString value; wxString name; *************** *** 291,295 **** lua_pop(L, 1); // pop globals table ! Add(new wxLuaDebugItem(wxT("Globals"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), val_ref, 0, flag_type)); } else if (tableRef == LUA_REGISTRYINDEX) --- 291,295 ---- lua_pop(L, 1); // pop globals table ! Add(new wxLuaDebugItem(wxT("Globals"), WXLUA_TNONE, value, WXLUA_TTABLE, wxT(""), val_ref, 0, flag_type)); } else if (tableRef == LUA_REGISTRYINDEX) *************** *** 302,306 **** lua_pop(L, 1); // pop registry table ! Add(new wxLuaDebugItem(wxT("Registry"), WXLUAARG_None, value, WXLUAARG_Table, wxT(""), val_ref, 0, flag_type)); } else --- 302,306 ---- lua_pop(L, 1); // pop registry table ! Add(new wxLuaDebugItem(wxT("Registry"), WXLUA_TNONE, value, WXLUA_TTABLE, wxT(""), val_ref, 0, flag_type)); } else *************** *** 336,340 **** // leading space so it's first when sorted ! Add(new wxLuaDebugItem(wxT(" __metatable"), WXLUAARG_Table, value, wxl_valuetype, wxT(""), val_ref, nIndex, flag_type)); ++count; --- 336,340 ---- // leading space so it's first when sorted ! Add(new wxLuaDebugItem(wxT(" __metatable"), WXLUA_TTABLE, value, wxl_valuetype, wxT(""), val_ref, nIndex, flag_type)); ++count; *************** *** 553,557 **** if (lua_iscfunction(L, stack_idx)) ! wxl_type = WXLUAARG_CFunction; break; --- 553,557 ---- if (lua_iscfunction(L, stack_idx)) ! wxl_type = WXLUA_TCFUNCTION; break; *************** *** 820,824 **** if (tableArray.Index(value) == wxNOT_FOUND) { ! if (valueType == WXLUAARG_Table) { tableArray.Add(value); --- 820,824 ---- if (tableArray.Index(value) == wxNOT_FOUND) { ! if (valueType == WXLUA_TTABLE) { tableArray.Add(value); |
From: John L. <jr...@us...> - 2007-12-20 02:27:02
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/modules/wxluasocket/include Modified Files: wxluasocket_bind.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: wxluasocket_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxluasocket_bind.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** wxluasocket_bind.h 10 Dec 2007 05:39:10 -0000 1.29 --- wxluasocket_bind.h 20 Dec 2007 02:26:58 -0000 1.30 *************** *** 21,27 **** // 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 // --------------------------------------------------------------------------- --- 21,27 ---- // 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 // --------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-12-20 02:27:02
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h wxlstate.h wxlua_bind.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: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** wxldefs.h 18 Dec 2007 01:03:34 -0000 1.38 --- wxldefs.h 20 Dec 2007 02:26:57 -0000 1.39 *************** *** 67,71 **** //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 19 // ---------------------------------------------------------------------------- --- 67,71 ---- //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 20 // ---------------------------------------------------------------------------- Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** wxlbind.h 19 Dec 2007 06:16:35 -0000 1.73 --- wxlbind.h 20 Dec 2007 02:26:57 -0000 1.74 *************** *** 23,42 **** // ---------------------------------------------------------------------------- ! // Generic delete function for binding objects ! WXDLLIMPEXP_WXLUA int LUACALL wxLua_wxluabind_delete(lua_State *L); // memory deallocation function for created wxLuaBindClass defined objects, Lua's __gc metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind__gc_wxLuaBindClass(lua_State *L); // Lua 'set table' function for created wxLuaBindClass defined objects, Lua's __newindex metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind__newindex_wxLuaBindClass(lua_State *L); // Lua 'get table' function for created wxLuaBindClass defined objects, Lua's __index metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind__index_wxLuaBindClass(lua_State *L); // Lua 'tostring' function for created wxLuaBindClass defined objects, Lua's __tostring metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind__tostring_wxLuaBindClass(lua_State *L); ! ! // If there is a special userdata upvalue, remove 1 value if !only_check ! // (hack to remove the table Lua pushes onto the stack when calling the ! // __call metatable function for class constructors) ! WXDLLIMPEXP_WXLUA int wxluabind_removetableforcall(lua_State* L, bool only_check = false); // ---------------------------------------------------------------------------- --- 23,37 ---- // ---------------------------------------------------------------------------- ! // Generic delete function for userdata binding objects ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_userdata_delete(lua_State *L); // memory deallocation function for created wxLuaBindClass defined objects, Lua's __gc metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_wxLuaBindClass__gc(lua_State *L); // Lua 'set table' function for created wxLuaBindClass defined objects, Lua's __newindex metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_wxLuaBindClass__newindex(lua_State *L); // Lua 'get table' function for created wxLuaBindClass defined objects, Lua's __index metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_wxLuaBindClass__index(lua_State *L); // Lua 'tostring' function for created wxLuaBindClass defined objects, Lua's __tostring metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_wxLuaBindClass__tostring(lua_State *L); // ---------------------------------------------------------------------------- *************** *** 51,70 **** // represents function prototype argument types. // wxlua arg tags for common Lua types - #define WXLUAARG_None 0 // LUA_TNONE - #define WXLUAARG_Unknown -1 // unset and invalid - #define WXLUAARG_Nil -2 // LUA_TNIL - #define WXLUAARG_Boolean -3 // LUA_TBOOLEAN - #define WXLUAARG_LightUserData -4 // LUA_TLIGHTUSERDATA - #define WXLUAARG_Number -5 // LUA_TNUMBER - #define WXLUAARG_String -6 // LUA_TSTRING - #define WXLUAARG_Table -7 // LUA_TTABLE - #define WXLUAARG_Function -8 // LUA_TFUNCTION - #define WXLUAARG_UserData -9 // LUA_TUSERDATA - #define WXLUAARG_Thread -10 // LUA_TTHREAD - #define WXLUAARG_Integer -11 // LUA_TNUMBER bit wants only an integer - #define WXLUAARG_CFunction -12 // LUA_TFUNCTION & lua_iscfunction, not a LUA_TXXX ! #define WXLUAARG__MIN -13 // Min of the WXLUAARG_XXX values // Variables used in the wxLuaArgTag member of the wxLuaBindCFunc for --- 46,72 ---- // represents function prototype argument types. + // Note: WXLUA_TXXX = -1*LUA_TXXX - 2 + // wxlua arg tags for common Lua types ! #define WXLUA_TUNKNOWN 0 // unset and invalid, not a LUA_TXXX ! #define WXLUA_TNONE -1 // LUA_TNONE -1 ! #define WXLUA_TNIL -2 // LUA_TNIL 0 ! #define WXLUA_TBOOLEAN -3 // LUA_TBOOLEAN 1 ! #define WXLUA_TLIGHTUSERDATA -4 // LUA_TLIGHTUSERDATA 2 ! #define WXLUA_TNUMBER -5 // LUA_TNUMBER 3 ! #define WXLUA_TSTRING -6 // LUA_TSTRING 4 ! #define WXLUA_TTABLE -7 // LUA_TTABLE 5 ! #define WXLUA_TFUNCTION -8 // LUA_TFUNCTION 6 ! #define WXLUA_TUSERDATA -9 // LUA_TUSERDATA 7 ! #define WXLUA_TTHREAD -10 // LUA_TTHREAD 8 ! #define WXLUA_TINTEGER -11 // LUA_TNUMBER but integer only, not a LUA_TXXX ! #define WXLUA_TCFUNCTION -12 // LUA_TFUNCTION & lua_iscfunction(), not a LUA_TXXX ! ! #define WXLUA_T_MAX 0 // Max of the WXLUA_TXXX values ! #define WXLUA_T_MIN -12 // Min of the WXLUA_TXXX values ! ! // Blindly convert the lua_type to the wxlua_type, see wxlua_getwxluatype() for better function ! #define LUAT_TO_WXLUAT(luatype) (-1*(luatype) - 2) // Variables used in the wxLuaArgTag member of the wxLuaBindCFunc for *************** *** 85,89 **** // copies of wxlua arg tags for binding types that are used very often - extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxLuaFunction; // The Lua tag for wxLuaFunctions extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_NULL; // The Lua tag for NULL pointer extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxEvent; // The Lua tag for wxEvents --- 87,90 ---- *************** *** 110,126 **** WXLUAMETHOD_STATIC = 0x1000, // Class member function is static - WXLUAMETHOD_OVERLOAD = 0x2000, // This is an overload function that will call others - // and the min/maxargs for it are not valid, - // but are the min and max of all functions ! WXLUAMETHOD_DELETE = 0x4000, // This is the delete function that wxLua has generated // to delete this class and is not part of the // original class. ! WXLUAMETHOD_OVERLOAD_BASE = 0x8000, // Class method has been checked to see if it is ! // overloaded from the base class by the function ! // wxLuaState::RegisterBindings() ! // Check wxLuaBindMethod::basemethod and if !NULL ! // this method is an overload from the base class }; --- 111,124 ---- WXLUAMETHOD_STATIC = 0x1000, // Class member function is static ! WXLUAMETHOD_DELETE = 0x2000, // This is the delete function that wxLua has generated // to delete this class and is not part of the // original class. ! WXLUAMETHOD_OVERLOAD_BASE = 0x10000, // Class method has been checked to see if it is ! // overloaded from the base class by the function ! // wxLuaState::RegisterBindings() ! // Check wxLuaBindMethod::basemethod and if !NULL ! // this method is an overload from the base class }; *************** *** 220,257 **** // ---------------------------------------------------------------------------- - // wxLuaFunction - a proxy class to store a reference to a Lua function. - // ---------------------------------------------------------------------------- - - class WXDLLIMPEXP_WXLUA wxLuaFunction - { - public: - wxLuaFunction(wxLuaBindMethod *wxlMethod, void *pObject) - : m_wxlMethod(wxlMethod), m_pObject(pObject) {} - - ~wxLuaFunction() {} - - int CallMethod(lua_State *L); // call wxLuaBindMethod->func[0](L) - void *GetObject() const { return m_pObject; } - - wxLuaBindMethod *m_wxlMethod; // Method to call for Lua's __call - void *m_pObject; // the actual object wrapped by a Lua userdata - }; - - // Garbage collect and free memory associated with the wxLuaFunction class - // Lua's __gc metatable function. - int LUACALL wxlua__gc_wxLuaFunction(lua_State *L); - // call a wxLuaFunction, Lua's __call metatable function. - int LUACALL wxlua__call_wxLuaFunction(lua_State *L); - - // ---------------------------------------------------------------------------- // Central function to call for overloaded functions // ---------------------------------------------------------------------------- // Redirect Lua function call to 1 method from a list of overloaded functions ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_CallOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod); ! // Get a human readable string of the Lua args (items on the stack) for a function call WXDLLIMPEXP_WXLUA wxString wxlua_getLuaArgsMsg(lua_State* L, int start_stack_idx, int end_stack_idx); - // Get a human readable wxArrayString of the wxLua args for the functions in the method WXDLLIMPEXP_WXLUA wxArrayString wxlua_getBindMethodArgsMsg(lua_State* L, struct wxLuaBindMethod* method); --- 218,232 ---- // ---------------------------------------------------------------------------- // Central function to call for overloaded functions // ---------------------------------------------------------------------------- // Redirect Lua function call to 1 method from a list of overloaded functions ! // if the 1st upvalue is a wxLuaBindMethod. ! int LUACALL wxlua_callOverloadedFunction(lua_State* L); ! // Redirect Lua function call to 1 method from a list of overloaded functions declared ! // in the wxLuaBindMethod. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_callOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod); // Get a human readable string of the Lua args (items on the stack) for a function call WXDLLIMPEXP_WXLUA wxString wxlua_getLuaArgsMsg(lua_State* L, int start_stack_idx, int end_stack_idx); // Get a human readable wxArrayString of the wxLua args for the functions in the method WXDLLIMPEXP_WXLUA wxArrayString wxlua_getBindMethodArgsMsg(lua_State* L, struct wxLuaBindMethod* method); *************** *** 568,571 **** --- 543,550 ---- static const wxLuaBindEvent* GetBindEvent(wxEventType eventType_, const wxLuaBindingList* bindingList); + // Get the wxLuaBinding that has this wxLuaBindMethod in it's wxLuaBinding::GetFunctionArray(). + // returns NULL on failure. + static wxLuaBinding* GetFunctionBinding(const wxLuaBindMethod* method, const wxLuaBindingList* bindingList); + // ----------------------------------------------------------------------- // These functions search through the input struct Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** wxlstate.h 19 Dec 2007 06:16:35 -0000 1.110 --- wxlstate.h 20 Dec 2007 02:26:57 -0000 1.111 *************** *** 240,249 **** // Leaves the new table on the top of the stack. WXDLLIMPEXP_WXLUA int LUACALL wxluaT_newtag(lua_State* L); ! // Get the numeric tag of the object at the stack index using the metatable's wxlua_metatable_tag_key key. ! // Returns WXLUA_NOTAG if the metatable of the object doesn't have a wxlua_metatable_tag_key // key or it isn't a number. The tag is presumedly the index into the wxlua_lreg_tags_key // LUA_REGISTRYINDEX table and denotes what type of C++ object this is. WXDLLIMPEXP_WXLUA int LUACALL wxluaT_gettag(lua_State* L, int stack_idx); ! // Set the metatable of the object at top of stack to the table stored in the // wxlua_lreg_tags_key LUA_REGISTRYINDEX table using wxluaR_getref(L, wxl_tag). WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_settag(lua_State* L, int wxl_tag); --- 240,249 ---- // Leaves the new table on the top of the stack. WXDLLIMPEXP_WXLUA int LUACALL wxluaT_newtag(lua_State* L); ! // Get the numeric tag of the userdata at the stack index using the metatable's wxlua_metatable_tag_key key. ! // Returns WXLUA_NOTAG if the metatable of the userdata doesn't have a wxlua_metatable_tag_key // key or it isn't a number. The tag is presumedly the index into the wxlua_lreg_tags_key // LUA_REGISTRYINDEX table and denotes what type of C++ object this is. WXDLLIMPEXP_WXLUA int LUACALL wxluaT_gettag(lua_State* L, int stack_idx); ! // Set the metatable of the userdata at top of stack to the table stored in the // wxlua_lreg_tags_key LUA_REGISTRYINDEX table using wxluaR_getref(L, wxl_tag). WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_settag(lua_State* L, int wxl_tag); *************** *** 264,268 **** // Get the userdata object at the stack_idx that is of the class type tag or a ! // class derived from the tag. If the data type does not have the correct tag, // or if the parameter isn't a userdata then wxlua_error() is called and NULL is returned. WXDLLIMPEXP_WXLUA void* LUACALL wxluaT_getuserdatatype(lua_State* L, int stack_idx, int wxl_tag); --- 264,268 ---- // Get the userdata object at the stack_idx that is of the class type tag or a ! // class derived from the tag. If the userdata does not have the correct tag, // or if the parameter isn't a userdata then wxlua_error() is called and NULL is returned. WXDLLIMPEXP_WXLUA void* LUACALL wxluaT_getuserdatatype(lua_State* L, int stack_idx, int wxl_tag); *************** *** 272,276 **** // If track=true then push the obj_ptr as a lightuser data key into the // wxlua_lreg_weakobjects_key table of the Lua LUA_REGISTRYINDEX table so ! // that if we need to push it again we just push the full userdata value. WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_pushusertag(lua_State* L, const void* obj_ptr, int wxl_tag, bool track); // Push a data type onto the stack and set its tag by calling wxluaT_pushusertag() --- 272,276 ---- // If track=true then push the obj_ptr as a lightuser data key into the // wxlua_lreg_weakobjects_key table of the Lua LUA_REGISTRYINDEX table so ! // that if we need to push it again we just push the already created full userdata value. WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_pushusertag(lua_State* L, const void* obj_ptr, int wxl_tag, bool track); // Push a data type onto the stack and set its tag by calling wxluaT_pushusertag() *************** *** 342,346 **** // to the wxlua_lreg_topwindows_key table of the LUA_REGISTRYINDEX table if // it has not already been added. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaW_addtrackedwindow(lua_State *L, wxObject* obj); // Remove the wxWindow from the wxlua_lreg_topwindows_key table of the // LUA_REGISTRYINDEX table. --- 342,346 ---- // to the wxlua_lreg_topwindows_key table of the LUA_REGISTRYINDEX table if // it has not already been added. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaW_addtrackedwindow(lua_State *L, wxObject* wxobj); // Remove the wxWindow from the wxlua_lreg_topwindows_key table of the // LUA_REGISTRYINDEX table. *************** *** 366,383 **** WXDLLIMPEXP_WXLUA int LUACALL wxlua_isderivedclass(const wxLuaBindClass* wxlClass, const wxLuaBindClass* base_wxlClass); // Verify if the luatype = lua_type(L, stack_idx) is valid for the ! // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. // Note that this function does not do a direct mapping between wxlua_getwxluatype() // and wxlua_getluatype() since it allows a small amount of coersion between types. // If the input lua_State is not NULL it will account for the automatic conversion of ! // (wxString, wxArrayString, wxArrayInt) to and from Lua types to wxluatypes, ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_iswxluatype(int luatype, int wxluaarg_tag, lua_State* L = NULL); ! // Get a human readable name for the predefined WXLUAARG_XXX or s_wxluaarg_XXX tags. ! // returns empty string if the tag was not one of the predefined types. ! WXDLLIMPEXP_WXLUA wxString wxlua_getwxluatypename(int wxluaarg_tag); // Get the wxluaarg_tag for the lua_type() = LUA_TXXX. // returns -1 if the tag was not one of the predefined types. WXDLLIMPEXP_WXLUA int wxlua_getwxluatype(int luatype); ! // Get the lua_type() = LUA_TXXX for the predefined WXLUAARG_XXX or s_wxluaarg_XXX tags. // returns -1 (LUA_TNONE) if the tag was not one of the predefined types. WXDLLIMPEXP_WXLUA int wxlua_getluatype(int wxluatype); --- 366,384 ---- WXDLLIMPEXP_WXLUA int LUACALL wxlua_isderivedclass(const wxLuaBindClass* wxlClass, const wxLuaBindClass* base_wxlClass); // Verify if the luatype = lua_type(L, stack_idx) is valid for the ! // wxluaarg_tag which is one of the predefined WXLUA_TXXX or s_wxluaarg_XXX types. // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. // Note that this function does not do a direct mapping between wxlua_getwxluatype() // and wxlua_getluatype() since it allows a small amount of coersion between types. // If the input lua_State is not NULL it will account for the automatic conversion of ! // (wxString, wxArrayString, wxArrayInt) from the Lua type to wxlua tags, ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_iswxluatype(int luatype, int wxlarg_tag, lua_State* L = NULL); ! // Get a human readable name for the predefined WXLUA_TXXX or s_wxluaarg_XXX tags. ! // returns empty string if the tag was not one of the predefined arg types. ! // If the lua_State is not NULL then return the wxLua tag (C++ class) name. ! WXDLLIMPEXP_WXLUA wxString wxlua_getwxluatypename(int wxlarg_tag, lua_State* L = NULL); // Get the wxluaarg_tag for the lua_type() = LUA_TXXX. // returns -1 if the tag was not one of the predefined types. WXDLLIMPEXP_WXLUA int wxlua_getwxluatype(int luatype); ! // Get the lua_type() = LUA_TXXX for the predefined WXLUA_TXXX or s_wxluaarg_XXX tags. // returns -1 (LUA_TNONE) if the tag was not one of the predefined types. WXDLLIMPEXP_WXLUA int wxlua_getluatype(int wxluatype); *************** *** 396,403 **** // always allow coersion between types since oftentimes there's an error. WXDLLIMPEXP_WXLUA bool wxlua_iswxstringtype(lua_State* L, int stack_idx); ! #define wxlua_isstringtype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUAARG_String) == 1) ! #define wxlua_isbooleantype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUAARG_Boolean) == 1) ! #define wxlua_isintegertype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUAARG_Integer) == 1) ! #define wxlua_isnumbertype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUAARG_Number) == 1) // After verifying using wxlua_isXXXtype return the value, else call --- 397,404 ---- // always allow coersion between types since oftentimes there's an error. WXDLLIMPEXP_WXLUA bool wxlua_iswxstringtype(lua_State* L, int stack_idx); ! #define wxlua_isstringtype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TSTRING) == 1) ! #define wxlua_isbooleantype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TBOOLEAN) == 1) ! #define wxlua_isintegertype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TINTEGER) == 1) ! #define wxlua_isnumbertype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TNUMBER) == 1) // After verifying using wxlua_isXXXtype return the value, else call *************** *** 910,914 **** // Verify if the luatype = lua_type(L, stack_idx) is valid for the ! // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. // Note that this function does not do a direct mapping between wxlua_getwxluatype() --- 911,915 ---- // Verify if the luatype = lua_type(L, stack_idx) is valid for the ! // wxluaarg_tag which is one of the predefined WXLUA_TXXX or s_wxluaarg_XXX types. // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. // Note that this function does not do a direct mapping between wxlua_getwxluatype() Index: wxlua_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlua_bind.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxlua_bind.h 10 Dec 2007 05:39:10 -0000 1.8 --- wxlua_bind.h 20 Dec 2007 02:26:57 -0000 1.9 *************** *** 17,23 **** // 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 // --------------------------------------------------------------------------- --- 17,23 ---- // 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 // --------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-12-20 02:27:01
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8597/wxLua/modules/wxluadebug/include Modified Files: wxldebug.h wxlstack.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: wxldebug.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxldebug.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** wxldebug.h 13 Dec 2007 00:47:52 -0000 1.48 --- wxldebug.h 20 Dec 2007 02:26:58 -0000 1.49 *************** *** 147,151 **** // Get information about the item at the 'stack_idx'. Returns the lua_type(L, stack_idx), ! // fills 'wxl_type' with the WXLUAARG_XXX type and 'value' with a human readable value. static int GetTypeValue(const wxLuaState& wxlState, int stack_idx, int* wxl_type, wxString& value); // Get a wxString description about the table at the stack_idx in the Lua stack --- 147,151 ---- // Get information about the item at the 'stack_idx'. Returns the lua_type(L, stack_idx), ! // fills 'wxl_type' with the WXLUA_TXXX type and 'value' with a human readable value. static int GetTypeValue(const wxLuaState& wxlState, int stack_idx, int* wxl_type, wxString& value); // Get a wxString description about the table at the stack_idx in the Lua stack Index: wxlstack.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxlstack.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** wxlstack.h 13 Dec 2007 00:47:52 -0000 1.16 --- wxlstack.h 20 Dec 2007 02:26:58 -0000 1.17 *************** *** 127,132 **** enum { - IMG_NONE, IMG_UNKNOWN, IMG_NIL, IMG_BOOLEAN, --- 127,132 ---- enum { IMG_UNKNOWN, + IMG_NONE, IMG_NIL, IMG_BOOLEAN, |
From: John L. <jr...@us...> - 2007-12-19 06:16:42
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10699/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Give better error messages using the upvalue wxLuaBindMethod we push for function calls. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** wxlstate.cpp 19 Dec 2007 00:42:11 -0000 1.153 --- wxlstate.cpp 19 Dec 2007 06:16:36 -0000 1.154 *************** *** 213,216 **** --- 213,255 ---- } + void LUACALL wxlua_argerror(lua_State *L, int stack_idx, const wxString& expectedType) + { + wxString argType = wxlua_gettypename(L, stack_idx); + + wxString funcArgs; + + if (lua_type(L, stack_idx) == LUA_TUSERDATA) + { + int wxl_tag = wxluaT_gettag(L, stack_idx); + + if (wxl_tag != WXLUA_NOTAG) + argType = wxluaT_gettagname(L, wxl_tag); + } + + int start_arg = wxluabind_removetableforcall(L, true) ? 2 : 1; + + wxString argMsg = wxlua_getLuaArgsMsg(L, start_arg, lua_gettop(L)); + + wxLuaBindMethod* wxlMethod = (wxLuaBindMethod *)lua_touserdata(L, lua_upvalueindex(1)); // lightuserdata + if (wxlMethod != NULL) + { + // guarantee that this is a wxLuaBindMethod of ours so we don't crash + const wxLuaBindClass* wxlClass = wxLuaBinding::GetBindClass(wxlMethod, NULL); + if (wxlClass != NULL) + { + wxArrayString a = wxlua_getBindMethodArgsMsg(L, wxlMethod); + for (size_t n = 0; n < a.GetCount(); ++n) + funcArgs += a[n] + wxT("\n"); + } + } + + wxString msg(wxString::Format(_("wxLua: Expected %s for parameter %d, but got a '%s'."), + expectedType.c_str(), stack_idx, argType.c_str())); + + msg += wxT("\nFunction called: '") + argMsg + wxT("'\n") + funcArgs; + + wxlua_error(L, msg); + } + void* LUACALL wxlua_touserdata(lua_State *L, int stack_idx, bool null_ptr /*= false*/) { *************** *** 441,456 **** } ! wxString LUACALL wxluaT_gettagname(lua_State* L, int class_tag) { // This is a predefined WXLUAARG_XXX type ! if (class_tag <= 0) ! return wxlua_getwxluatypename(class_tag); ! if (class_tag == g_wxluatag_NULL) return wxT("NULL"); ! if (class_tag == g_wxluatag_wxLuaFunction) return wxT("wxLuaFunction"); ! const wxLuaBindClass* wxlClass = wxluaT_getclass(L, class_tag); if (wxlClass) return lua2wx(wxlClass->name); --- 480,495 ---- } ! wxString LUACALL wxluaT_gettagname(lua_State* L, int wxl_tag) { // This is a predefined WXLUAARG_XXX type ! if (wxl_tag <= 0) ! return wxlua_getwxluatypename(wxl_tag); ! if (wxl_tag == g_wxluatag_NULL) return wxT("NULL"); ! if (wxl_tag == g_wxluatag_wxLuaFunction) return wxT("wxLuaFunction"); ! const wxLuaBindClass* wxlClass = wxluaT_getclass(L, wxl_tag); if (wxlClass) return lua2wx(wxlClass->name); *************** *** 501,506 **** } ! wxlua_error(L, wxString::Format(_("wxLua: Expected user defined data type '%s' for parameter %d, but got '%s'."), ! wxluaT_gettagname(L, wxl_tag).c_str(), stack_idx, wxlua_gettypename(L, stack_idx).c_str())); return NULL; --- 540,544 ---- } ! wxlua_argerror(L, stack_idx, wxT("a '") + wxluaT_gettagname(L, wxl_tag) + wxT("'")); return NULL; *************** *** 567,571 **** { // Connect the wxWindow to wxEVT_DESTROY callback so if Lua has ! // a copy(s) of it we can clear the metatable when we get the // event so we don't segfault if we try to access it by accident. wxLuaState wxlState(L); --- 605,609 ---- { // Connect the wxWindow to wxEVT_DESTROY callback so if Lua has ! // a copy(s) of it we can clear the metatable when we get the // event so we don't segfault if we try to access it by accident. wxLuaState wxlState(L); *************** *** 767,771 **** { // check for dupes since that's what we're trying to avoid ! lua_pushnumber(L, tag); lua_rawget(L, -2); // this must never happen --- 805,809 ---- { // check for dupes since that's what we're trying to avoid ! lua_pushnumber(L, tag); lua_rawget(L, -2); // this must never happen *************** *** 1178,1186 **** { if (!wxlua_isstringtype(L, stack_idx)) ! { ! wxString msg(wxString::Format(_("wxLua: Expected a string for parameter %d, but got a '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); ! } return lua_tostring(L, stack_idx); --- 1216,1220 ---- { if (!wxlua_isstringtype(L, stack_idx)) ! wxlua_argerror(L, stack_idx, wxT("a 'string'")); return lua_tostring(L, stack_idx); *************** *** 1202,1208 **** } ! wxString msg(wxString::Format(_("wxLua: Expected a string or wxString for parameter %d, but got '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); return wxEmptyString; --- 1236,1240 ---- } ! wxlua_argerror(L, stack_idx, wxT("a 'string' or 'wxString'")); return wxEmptyString; *************** *** 1214,1222 **** if (!wxlua_iswxluatype(l_type, WXLUAARG_Boolean)) ! { ! wxString msg(wxString::Format(_("wxLua: Expected a boolean for parameter %d, but got a '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); ! } int num = 0; --- 1246,1250 ---- if (!wxlua_iswxluatype(l_type, WXLUAARG_Boolean)) ! wxlua_argerror(L, stack_idx, wxT("a 'boolean'")); int num = 0; *************** *** 1234,1242 **** if (!wxlua_iswxluatype(l_type, WXLUAARG_Integer)) ! { ! wxString msg(wxString::Format(_("wxLua: Expected an integer for parameter %d, but got a '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); ! } double value = 0; --- 1262,1266 ---- if (!wxlua_iswxluatype(l_type, WXLUAARG_Integer)) ! wxlua_argerror(L, stack_idx, wxT("an 'integer'")); double value = 0; *************** *** 1248,1256 **** if (value != (long)value) ! { ! wxString msg(wxString::Format(_("wxLua: Expected an integer for parameter %d, but got a floating point number '%lf'."), ! stack_idx, value)); ! wxlua_error(L, msg); ! } return (long)value; --- 1272,1276 ---- if (value != (long)value) ! wxlua_argerror(L, stack_idx, wxT("an 'integer'")); return (long)value; *************** *** 1261,1269 **** if (!wxlua_iswxluatype(l_type, WXLUAARG_Number)) ! { ! wxString msg(wxString::Format(_("wxLua: Expected a number for parameter %d, but got a '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); ! } double value = 0; --- 1281,1285 ---- if (!wxlua_iswxluatype(l_type, WXLUAARG_Number)) ! wxlua_argerror(L, stack_idx, wxT("a 'number'")); double value = 0; *************** *** 1302,1310 **** } else ! { ! wxString msg(wxString::Format(_("wxLua: Expected a table of strings for parameter %d, but got a '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); ! } return arrChar; --- 1318,1322 ---- } else ! wxlua_argerror(L, stack_idx, wxT("a 'table' array of strings")); return arrChar; *************** *** 1366,1372 **** else { ! wxString msg(wxString::Format(_("wxLua: Expected a wxArrayString or table of strings for parameter %d, but table index %d is '%s'."), ! stack_idx, count+1, wxlua_gettypename(L, -1).c_str())); ! wxlua_error(L, msg); return arr; } --- 1378,1382 ---- else { ! wxlua_argerror(L, stack_idx, wxT("a 'wxArrayString' or table array of strings")); return arr; } *************** *** 1389,1397 **** if (count < 0) ! { ! wxString msg(wxString::Format(_("wxLua: Expected a wxArrayString or table of strings for parameter %d, but got '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); ! } return arr; --- 1399,1403 ---- if (count < 0) ! wxlua_argerror(L, stack_idx, wxT("a 'wxArrayString' or table array of strings")); return arr; *************** *** 1425,1433 **** if (count < 0) ! { ! wxString msg(wxString::Format(_("wxLua: Expected a wxArrayString or table of strings for parameter %d, but got '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); ! } return arr; --- 1431,1435 ---- if (count < 0) ! wxlua_argerror(L, stack_idx, wxT("a 'wxArrayString' or table array of strings")); return arr; *************** *** 1461,1467 **** else { ! wxString msg(wxString::Format(_("wxLua: Expected a wxArrayInt or a table of integers for parameter %d, but table index %d is '%s'."), ! stack_idx, count+1, wxlua_gettypename(L, -1).c_str())); ! wxlua_error(L, msg); return arr; } --- 1463,1467 ---- else { ! wxlua_argerror(L, stack_idx, wxT("a 'wxArrayInt' or a table array of integers")); return arr; } *************** *** 1484,1492 **** if (count < 0) ! { ! wxString msg(wxString::Format(_("wxLua: Expected a wxArrayInt or a table of integers for parameter %d, but got '%s'."), ! stack_idx, wxlua_gettypename(L, stack_idx).c_str())); ! wxlua_error(L, msg); ! } return arr; --- 1484,1488 ---- if (count < 0) ! wxlua_argerror(L, stack_idx, wxT("a 'wxArrayInt' or a table array of integers")); return arr; Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** wxlbind.cpp 19 Dec 2007 00:42:11 -0000 1.107 --- wxlbind.cpp 19 Dec 2007 06:16:36 -0000 1.108 *************** *** 101,106 **** } - wxString wxlua_CreateArgsMsg(lua_State* L, int start_stack_idx, int end_stack_idx); - int LUACALL wxlua_CallOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod) { --- 101,104 ---- *************** *** 204,211 **** // Did not find a suitable function to call, post error ! wxString fnCall = wxlua_CreateArgsMsg(L, arg_lua_start, arg_lua_start+arg_lua_count-1); ! wxString fnOverloadList = wxT("wxLua Function Overload Table:\n"); ! wxArrayString overloadMethodArray = wxlua_CreateMethodArgTagsMsg(L, wxlMethod); for (i = 0; i < (int)overloadMethodArray.GetCount(); ++i) fnOverloadList += overloadMethodArray[i] + wxT("\n"); --- 202,209 ---- // Did not find a suitable function to call, post error ! wxString fnCall = wxlua_getLuaArgsMsg(L, arg_lua_start, arg_lua_start+arg_lua_count-1); ! wxString fnOverloadList = wxString::Format(wxT("Function called: '%s'\n"), fnCall.c_str()); ! wxArrayString overloadMethodArray = wxlua_getBindMethodArgsMsg(L, wxlMethod); for (i = 0; i < (int)overloadMethodArray.GetCount(); ++i) fnOverloadList += overloadMethodArray[i] + wxT("\n"); *************** *** 219,223 **** if (bestFunc == NULL) ! errmsg += wxString::Format(wxT("wxLua: Function call '%s' has invalid arguments.\n%s"), fnCall.c_str(), fnOverloadList.c_str()); else { --- 217,221 ---- if (bestFunc == NULL) ! errmsg += wxString::Format(wxT("wxLua: Function call has invalid arguments.\n%s"), fnOverloadList.c_str()); else { *************** *** 242,246 **** } ! errmsg += wxString::Format(wxT("wxLua: Function call '%s' has invalid argument %d on method %02d.\n%s"), fnCall.c_str(), invalid_lua_arg, i_func, fnOverloadList.c_str()); } --- 240,244 ---- } ! errmsg += wxString::Format(wxT("wxLua: Function call has invalid argument %d on method %02d.\n%s"), invalid_lua_arg, i_func, fnOverloadList.c_str()); } *************** *** 250,254 **** } ! wxString wxlua_CreateArgsMsg(lua_State* L, int start_stack_idx, int end_stack_idx) { lua_Debug ar; --- 248,252 ---- } ! wxString wxlua_getLuaArgsMsg(lua_State* L, int start_stack_idx, int end_stack_idx) { lua_Debug ar; *************** *** 257,261 **** wxString funcName = lua2wx(ar.name); - // Build an error message wxString funcCall = funcName + wxT("("); --- 255,258 ---- *************** *** 281,285 **** } ! wxArrayString wxlua_CreateMethodArgTagsMsg(lua_State* L, struct wxLuaBindMethod* wxlMethod) { wxArrayString overloadMethodArray; --- 278,282 ---- } ! wxArrayString wxlua_getBindMethodArgsMsg(lua_State* L, struct wxLuaBindMethod* wxlMethod) { wxArrayString overloadMethodArray; *************** *** 948,952 **** bool wxLuaBinding::sm_bindingList_initialized = false; ! wxLuaBinding::wxLuaBinding() :m_classCount(0), m_classArray(NULL), m_defineCount(0), m_defineArray(NULL), --- 945,949 ---- bool wxLuaBinding::sm_bindingList_initialized = false; ! wxLuaBinding::wxLuaBinding() :m_classCount(0), m_classArray(NULL), m_defineCount(0), m_defineArray(NULL), |
From: John L. <jr...@us...> - 2007-12-19 06:16:41
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10699/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlstate.h Log Message: Give better error messages using the upvalue wxLuaBindMethod we push for function calls. Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** wxlbind.h 15 Dec 2007 16:56:41 -0000 1.72 --- wxlbind.h 19 Dec 2007 06:16:35 -0000 1.73 *************** *** 251,256 **** WXDLLIMPEXP_WXLUA int LUACALL wxlua_CallOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod); ! // Return a human readable string of the args for the functions in the method ! WXDLLIMPEXP_WXLUA wxArrayString wxlua_CreateMethodArgTagsMsg(lua_State* L, struct wxLuaBindMethod* method); // ---------------------------------------------------------------------------- --- 251,259 ---- WXDLLIMPEXP_WXLUA int LUACALL wxlua_CallOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod); ! // Get a human readable string of the Lua args (items on the stack) for a function call ! WXDLLIMPEXP_WXLUA wxString wxlua_getLuaArgsMsg(lua_State* L, int start_stack_idx, int end_stack_idx); ! ! // Get a human readable wxArrayString of the wxLua args for the functions in the method ! WXDLLIMPEXP_WXLUA wxArrayString wxlua_getBindMethodArgsMsg(lua_State* L, struct wxLuaBindMethod* method); // ---------------------------------------------------------------------------- Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** wxlstate.h 19 Dec 2007 00:42:10 -0000 1.109 --- wxlstate.h 19 Dec 2007 06:16:35 -0000 1.110 *************** *** 90,94 **** extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_refs_key; // The key in the LUA_REGISTRYINDEX table that is a numerically keyed table ! // with references to objects the wxLuaDebugData wants to keep a handle to. It // stores their value for faster lookup. It is used only for the wxLuaDebugData. // LUA_REGISTRYINDEX[&wxlua_lreg_debug_refs_key][ref number] = Lua object --- 90,94 ---- extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_refs_key; // The key in the LUA_REGISTRYINDEX table that is a numerically keyed table ! // with references to objects the wxLuaDebugData wants to keep a handle to. It // stores their value for faster lookup. It is used only for the wxLuaDebugData. // LUA_REGISTRYINDEX[&wxlua_lreg_debug_refs_key][ref number] = Lua object *************** *** 100,104 **** // The key in the LUA_REGISTRYINDEX table that is a table // of Lua functions assigned to wxLua userdata programatically in Lua. ! // LUA_REGISTRYINDEX[&wxlua_lreg_derivedmethods_key][lightuserdata(obj_ptr)] = // {["derived func/value name"] = wxLuaObject(Lua function/value), ...} extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_derivedmethods_key; --- 100,104 ---- // The key in the LUA_REGISTRYINDEX table that is a table // of Lua functions assigned to wxLua userdata programatically in Lua. ! // LUA_REGISTRYINDEX[&wxlua_lreg_derivedmethods_key][lightuserdata(obj_ptr)] = // {["derived func/value name"] = wxLuaObject(Lua function/value), ...} extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_derivedmethods_key; *************** *** 111,115 **** // Note: A single object like a wxWindow may be pushed with multiple tags. // e.g. wxWindow* w = wx.wxWindow() retrieve the window later from wxObject* wxEvent:GetEventObject() ! // LUA_REGISTRYINDEX[&wxlua_lreg_weakobjects_key][lightuserdata(obj_ptr)] = // { tag1 = weak fulluserdata, tag2 = weak fulluserdata... } extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_weakobjects_key; --- 111,115 ---- // Note: A single object like a wxWindow may be pushed with multiple tags. // e.g. wxWindow* w = wx.wxWindow() retrieve the window later from wxObject* wxEvent:GetEventObject() ! // LUA_REGISTRYINDEX[&wxlua_lreg_weakobjects_key][lightuserdata(obj_ptr)] = // { tag1 = weak fulluserdata, tag2 = weak fulluserdata... } extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_weakobjects_key; *************** *** 119,135 **** // the key is the object pointer and the value is the wxObject encapsulation. // If not encapsulated both the key and the value are the same. ! // LUA_REGISTRYINDEX[&wxlua_lreg_gcobjects_key][lightuserdata(obj_ptr)] = // lightuserdata(wxObject derived class) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_gcobjects_key; // The key in the LUA_REGISTRYINDEX table that is table of all // wxLuaEventCallbacks that we've created. ! // LUA_REGISTRYINDEX[&wxlua_lreg_evtcallbacks_key][lightuserdata(&wxLuaEventCallback)] = // lightuserdata(&wxEvtHandler) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_evtcallbacks_key; // The key in the LUA_REGISTRYINDEX table that is table of all ! // wxLuaWinDestroyCallbacks that we've created. // Two key/value pairs are created for fast lookup. // LUA_REGISTRYINDEX[&wxlua_lreg_windestroycallbacks_key][lightuserdata(&wxLuaWinDestroyCallback)] = 1 ! // LUA_REGISTRYINDEX[&wxlua_lreg_windestroycallbacks_key][lightuserdata(&wxWindow)] = // lightuserdata(wxLuaWinDestroyCallback) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_windestroycallbacks_key; --- 119,135 ---- // the key is the object pointer and the value is the wxObject encapsulation. // If not encapsulated both the key and the value are the same. ! // LUA_REGISTRYINDEX[&wxlua_lreg_gcobjects_key][lightuserdata(obj_ptr)] = // lightuserdata(wxObject derived class) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_gcobjects_key; // The key in the LUA_REGISTRYINDEX table that is table of all // wxLuaEventCallbacks that we've created. ! // LUA_REGISTRYINDEX[&wxlua_lreg_evtcallbacks_key][lightuserdata(&wxLuaEventCallback)] = // lightuserdata(&wxEvtHandler) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_evtcallbacks_key; // The key in the LUA_REGISTRYINDEX table that is table of all ! // wxLuaWinDestroyCallbacks that we've created. // Two key/value pairs are created for fast lookup. // LUA_REGISTRYINDEX[&wxlua_lreg_windestroycallbacks_key][lightuserdata(&wxLuaWinDestroyCallback)] = 1 ! // LUA_REGISTRYINDEX[&wxlua_lreg_windestroycallbacks_key][lightuserdata(&wxWindow)] = // lightuserdata(wxLuaWinDestroyCallback) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_windestroycallbacks_key; *************** *** 155,159 **** // This is used by the wxLuaDebugData to know if the table is one of the wxLua // registry tables for better wxLuaStackDialog performance. ! // LUA_REGISTRYINDEX[&wxlua_lreg_regtable_key][weak {wxlua_lreg_XXX_key table}] = // lightuserdata(&wxlua_lreg_XXX_key) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_regtable_key; --- 155,159 ---- // This is used by the wxLuaDebugData to know if the table is one of the wxLua // registry tables for better wxLuaStackDialog performance. ! // LUA_REGISTRYINDEX[&wxlua_lreg_regtable_key][weak {wxlua_lreg_XXX_key table}] = // lightuserdata(&wxlua_lreg_XXX_key) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_regtable_key; *************** *** 175,179 **** // wxlua_lreg_tags_key table this metatable is for. extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_metatable_tag_key; ! // The key of a metatable used for wxLua userdata that stores a lightuserdata // of the wxLuaBindClass struct for this class. extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_metatable_wxluabindclass_key; --- 175,179 ---- // wxlua_lreg_tags_key table this metatable is for. extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_metatable_tag_key; ! // The key of a metatable used for wxLua userdata that stores a lightuserdata // of the wxLuaBindClass struct for this class. extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_metatable_wxluabindclass_key; *************** *** 196,199 **** --- 196,203 ---- wxLUA_UNICODE_ONLY(WXDLLIMPEXP_WXLUA inline void LUACALL wxlua_error(lua_State* L, const wxString& errorMsg) { wxlua_error(L, wx2lua(errorMsg)); }) + // Create an error message that the item at the stack_idx is not of the type wxl_tag + // and call wxlua_error(). + WXDLLIMPEXP_WXLUA void LUACALL wxlua_argerror(lua_State *L, int stack_idx, const wxString& expectedType); + // Get the userdata at the stack index, if null_ptr then set the pointer wrapped // by Lua's userdata to NULL to clear it. *************** *** 260,264 **** // Get the userdata object at the stack_idx that is of the class type tag or a ! // class derived from the tag. If the data type does not have the correct tag, // or if the parameter isn't a userdata then wxlua_error() is called and NULL is returned. WXDLLIMPEXP_WXLUA void* LUACALL wxluaT_getuserdatatype(lua_State* L, int stack_idx, int wxl_tag); --- 264,268 ---- // Get the userdata object at the stack_idx that is of the class type tag or a ! // class derived from the tag. If the data type does not have the correct tag, // or if the parameter isn't a userdata then wxlua_error() is called and NULL is returned. WXDLLIMPEXP_WXLUA void* LUACALL wxluaT_getuserdatatype(lua_State* L, int stack_idx, int wxl_tag); *************** *** 277,281 **** //---------------------------------------------------------------------------- // wxluaO_XXX - functions operate on wxLua "Objects" which are userdata wrapping ! // C++ class objects and are stored in the wxlua_lreg_weakobjects_key // and the wxlua_lreg_gcobjects_key table in the LUA_REGISTRYINDEX. //---------------------------------------------------------------------------- --- 281,285 ---- //---------------------------------------------------------------------------- // wxluaO_XXX - functions operate on wxLua "Objects" which are userdata wrapping ! // C++ class objects and are stored in the wxlua_lreg_weakobjects_key // and the wxlua_lreg_gcobjects_key table in the LUA_REGISTRYINDEX. //---------------------------------------------------------------------------- *************** *** 286,290 **** // last userdata referece to it. ! WXLUA_DELETE_OBJECT_ALL = 0x0001, // Delete the object and clear all // userdata references to it. }; --- 290,294 ---- // last userdata referece to it. ! WXLUA_DELETE_OBJECT_ALL = 0x0001, // Delete the object and clear all // userdata references to it. }; *************** *** 292,302 **** // Track this wxObject and delete it when Lua calls the __gc method for it. // The object is stored in the wxlua_lreg_gcobjects_key of the LUA_REGISTRYINDEX. ! // The second version is used when a non-wxObject class is encapsulated and // the obj_ptr points to the actual object that the wxObject encapsulates. // Note that the lua userdata internal pointer is the obj_ptr and the ! // wxobj is *only* stored in the wxlua_lreg_gcobjects_key. WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, wxObject* wxobj); WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, const void* obj_ptr, wxObject* wxobj); ! // Remove this obj_ptr wrapped in a Lua userdata, udata, from the // wxlua_lreg_gcobjects_key table of the LUA_REGISTRYINDEX. // It is deleted depending on the flags enum wxLuaGCObject_Flags. --- 296,306 ---- // Track this wxObject and delete it when Lua calls the __gc method for it. // The object is stored in the wxlua_lreg_gcobjects_key of the LUA_REGISTRYINDEX. ! // The second version is used when a non-wxObject class is encapsulated and // the obj_ptr points to the actual object that the wxObject encapsulates. // Note that the lua userdata internal pointer is the obj_ptr and the ! // wxobj is *only* stored in the wxlua_lreg_gcobjects_key. WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, wxObject* wxobj); WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, const void* obj_ptr, wxObject* wxobj); ! // Remove this obj_ptr wrapped in a Lua userdata, udata, from the // wxlua_lreg_gcobjects_key table of the LUA_REGISTRYINDEX. // It is deleted depending on the flags enum wxLuaGCObject_Flags. *************** *** 315,327 **** WXDLLIMPEXP_WXLUA wxArrayString LUACALL wxluaO_getgcobjectinfo(lua_State *L); ! // Track the obj_ptr and it's Lua userdata at udata_stack_idx in the // wxlua_lreg_weakobjects_key table of the LUA_REGISTRYINDEX so we can push // it again if needed. WXDLLIMPEXP_WXLUA void LUACALL wxluaO_trackweakobject(lua_State *L, int udata_stack_idx, void *obj_ptr, int tag); // Remove the obj_ptr key from the wxlua_lreg_weakobjects_key table of ! // the LUA_REGISTRYINDEX. It removes the metatable for the single Lua userdata, ! // "udata", since this function is called before the object is deleted. // e.g. p1 = wx.wxPoint(); p2 = p1; p2:delete(); p1:SetX(5) errors, but doesn't segfault ! // If udata == NULL it removes ALL tracked userdata for this obj_ptr and clears // all of their metatables. WXDLLIMPEXP_WXLUA int LUACALL wxluaO_untrackweakobject(lua_State *L, void* udata, void *obj_ptr); --- 319,331 ---- WXDLLIMPEXP_WXLUA wxArrayString LUACALL wxluaO_getgcobjectinfo(lua_State *L); ! // Track the obj_ptr and it's Lua userdata at udata_stack_idx in the // wxlua_lreg_weakobjects_key table of the LUA_REGISTRYINDEX so we can push // it again if needed. WXDLLIMPEXP_WXLUA void LUACALL wxluaO_trackweakobject(lua_State *L, int udata_stack_idx, void *obj_ptr, int tag); // Remove the obj_ptr key from the wxlua_lreg_weakobjects_key table of ! // the LUA_REGISTRYINDEX. It removes the metatable for the single Lua userdata, ! // "udata", since this function is called before the object is deleted. // e.g. p1 = wx.wxPoint(); p2 = p1; p2:delete(); p1:SetX(5) errors, but doesn't segfault ! // If udata == NULL it removes ALL tracked userdata for this obj_ptr and clears // all of their metatables. WXDLLIMPEXP_WXLUA int LUACALL wxluaO_untrackweakobject(lua_State *L, void* udata, void *obj_ptr); *************** *** 350,355 **** // ---------------------------------------------------------------------------- ! // Functions to get info about the tags or the args wxLua uses to determine ! // the lua_type() or C++ class type. // Used to determine what to expect for a function call in the bindings. // ---------------------------------------------------------------------------- --- 354,359 ---- // ---------------------------------------------------------------------------- ! // Functions to get info about the tags or the args wxLua uses to determine ! // the lua_type() or C++ class type. // Used to determine what to expect for a function call in the bindings. // ---------------------------------------------------------------------------- *************** *** 378,382 **** // returns -1 (LUA_TNONE) if the tag was not one of the predefined types. WXDLLIMPEXP_WXLUA int wxlua_getluatype(int wxluatype); ! // Get the lua_typename(lua_type(stack_idx)) as a wxString WXDLLIMPEXP_WXLUA wxString LUACALL wxlua_gettypename(lua_State* L, int stack_idx); --- 382,386 ---- // returns -1 (LUA_TNONE) if the tag was not one of the predefined types. WXDLLIMPEXP_WXLUA int wxlua_getluatype(int wxluatype); ! // Get the lua_typename(lua_type(L, stack_idx)) as a wxString WXDLLIMPEXP_WXLUA wxString LUACALL wxlua_gettypename(lua_State* L, int stack_idx); *************** *** 454,458 **** //---------------------------------------------------------------------------- ! // Derived class member functions for classes in wxLua. The data is stored // in the wxlua_lreg_derivedmethods_key table in the LUA_REGISTRYINDEX. //---------------------------------------------------------------------------- --- 458,462 ---- //---------------------------------------------------------------------------- ! // Derived class member functions for classes in wxLua. The data is stored // in the wxlua_lreg_derivedmethods_key table in the LUA_REGISTRYINDEX. //---------------------------------------------------------------------------- *************** *** 461,472 **** // wxLua userdata object that we will push onto the stack when they access // the __index of the object with the "method_name". The obj_ptr is the ! // object the Lua userdata stores and the new wxLuaObject wraps the Lua // function or value which will be deleted by wxLua when the userdata is deleted. WXDLLIMPEXP_WXLUA bool LUACALL wxlua_setderivedmethod(lua_State* L, void *obj_ptr, const char *method_name, wxLuaObject* wxlObj); ! // Is there a derived method for the given obj_ptr with the method_name that was // added by calling wxlua_setderivedmethod()? // If push_method then push the method onto the stack. WXDLLIMPEXP_WXLUA bool LUACALL wxlua_hasderivedmethod(lua_State* L, void *obj_ptr, const char *method_name, bool push_method); ! // Remove any derived functions or values for the obj_ptr that have been added with // wxlua_setderivedmethod(). // This is called when an object is being garbage collected by wxluaO_deletegcobject() --- 465,476 ---- // wxLua userdata object that we will push onto the stack when they access // the __index of the object with the "method_name". The obj_ptr is the ! // object the Lua userdata stores and the new wxLuaObject wraps the Lua // function or value which will be deleted by wxLua when the userdata is deleted. WXDLLIMPEXP_WXLUA bool LUACALL wxlua_setderivedmethod(lua_State* L, void *obj_ptr, const char *method_name, wxLuaObject* wxlObj); ! // Is there a derived method for the given obj_ptr with the method_name that was // added by calling wxlua_setderivedmethod()? // If push_method then push the method onto the stack. WXDLLIMPEXP_WXLUA bool LUACALL wxlua_hasderivedmethod(lua_State* L, void *obj_ptr, const char *method_name, bool push_method); ! // Remove any derived functions or values for the obj_ptr that have been added with // wxlua_setderivedmethod(). // This is called when an object is being garbage collected by wxluaO_deletegcobject() *************** *** 490,494 **** // Get the wxlua_lreg_wxeventtype_key value of the LUA_REGISTRYINDEX table // to see if we're currently in a wxEvent callback. ! // Returns wxEVT_NULL if not in an event handler. // Be careful about destroying Lua when in an event handler. WXDLLIMPEXP_WXLUA wxEventType LUACALL wxlua_getwxeventtype(lua_State* L); --- 494,498 ---- // Get the wxlua_lreg_wxeventtype_key value of the LUA_REGISTRYINDEX table // to see if we're currently in a wxEvent callback. ! // Returns wxEVT_NULL if not in an event handler. // Be careful about destroying Lua when in an event handler. WXDLLIMPEXP_WXLUA wxEventType LUACALL wxlua_getwxeventtype(lua_State* L); *************** *** 510,515 **** public: wxLuaDebugHookData() : m_lua_debug_hook_count(100), m_lua_debug_hook_yield(50), ! m_lua_debug_hook(0), m_lua_debug_hook_send_evt(false), ! m_last_debug_hook_time(0), m_debug_hook_break(false), m_debug_hook_break_msg(wxT("Break")) {} --- 514,519 ---- public: wxLuaDebugHookData() : m_lua_debug_hook_count(100), m_lua_debug_hook_yield(50), ! m_lua_debug_hook(0), m_lua_debug_hook_send_evt(false), ! m_last_debug_hook_time(0), m_debug_hook_break(false), m_debug_hook_break_msg(wxT("Break")) {} |
From: John L. <jr...@us...> - 2007-12-19 00:42:15
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1877/wxLua/modules/wxlua/include Modified Files: wxlstate.h Log Message: Add wxLuaState::lua_TowxString and make lua_ToString return const char* Cleanup the overload function code and give better messages. Set the wxLuaBindMethod struct as an upvalue for C function calls TODO: give better error messages using it. Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** wxlstate.h 18 Dec 2007 01:03:34 -0000 1.108 --- wxlstate.h 19 Dec 2007 00:42:10 -0000 1.109 *************** *** 1011,1024 **** // which will be deleted by this. // See wxlua_setderivedmethod ! bool SetDerivedMethod(void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. // If push_method then push the method onto the stack. // A derived method is when a function or value is set to a wxLua userdata. // See wxlua_hasderivedmethod(). ! bool HasDerivedMethod(void *pObject, const char *method_name, bool push_method) const; // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. // See wxlua_removederivedmethods() ! bool RemoveDerivedMethods(void *pObject) const; // Find a derived method given an object and and a method name. // If the method can be found, return the valid wxLuaState it belongs to. --- 1011,1024 ---- // which will be deleted by this. // See wxlua_setderivedmethod ! bool SetDerivedMethod(void *obj_ptr, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. // If push_method then push the method onto the stack. // A derived method is when a function or value is set to a wxLua userdata. // See wxlua_hasderivedmethod(). ! bool HasDerivedMethod(void *obj_ptr, const char *method_name, bool push_method) const; // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. // See wxlua_removederivedmethods() ! bool RemoveDerivedMethods(void *obj_ptr) const; // Find a derived method given an object and and a method name. // If the method can be found, return the valid wxLuaState it belongs to. *************** *** 1027,1031 **** // It is probably easier to merely make a wxLuaState a class member for // faster lookup though. ! static wxLuaState GetDerivedMethodState(void *pObject, const char *method); // ----------------------------------------------------------------------- --- 1027,1031 ---- // It is probably easier to merely make a wxLuaState a class member for // faster lookup though. ! static wxLuaState GetDerivedMethodState(void *obj_ptr, const char *method_name); // ----------------------------------------------------------------------- *************** *** 1063,1067 **** int lua_ToInteger(int index) const; int lua_ToBoolean(int index) const; ! wxString lua_ToString(int index) const; size_t lua_StrLen(int index) const; size_t luaL_ObjLen(int index) const; --- 1063,1068 ---- int lua_ToInteger(int index) const; int lua_ToBoolean(int index) const; ! const char* lua_ToString(int index) const; ! wxString lua_TowxString(int index) const; // wxLua added size_t lua_StrLen(int index) const; size_t luaL_ObjLen(int index) const; |
From: John L. <jr...@us...> - 2007-12-19 00:42:15
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1877/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Add wxLuaState::lua_TowxString and make lua_ToString return const char* Cleanup the overload function code and give better messages. Set the wxLuaBindMethod struct as an upvalue for C function calls TODO: give better error messages using it. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** wxlstate.cpp 15 Dec 2007 16:56:41 -0000 1.152 --- wxlstate.cpp 19 Dec 2007 00:42:11 -0000 1.153 *************** *** 2785,2797 **** // memory tracking functions ! void wxLuaState::AddGCObject(wxObject *pObject) { ! AddGCObject(pObject, pObject); } ! void wxLuaState::AddGCObject(const void* obj_ptr, wxObject *pObject) { ! wxCHECK_RET(Ok() && pObject, wxT("Invalid wxLuaState or wxObject to track")); ! wxluaO_addgcobject(M_WXLSTATEDATA->m_lua_State, obj_ptr, pObject); } --- 2785,2797 ---- // memory tracking functions ! void wxLuaState::AddGCObject(wxObject *wxobj) { ! AddGCObject(wxobj, wxobj); } ! void wxLuaState::AddGCObject(const void* obj_ptr, wxObject *wxobj) { ! wxCHECK_RET(Ok() && wxobj, wxT("Invalid wxLuaState or wxObject to track")); ! wxluaO_addgcobject(M_WXLSTATEDATA->m_lua_State, obj_ptr, wxobj); } *************** *** 3183,3187 **** } ! wxLuaState wxLuaState::GetDerivedMethodState(void *obj_ptr, const char *method) { wxCHECK_MSG(obj_ptr, wxNullLuaState, wxT("Invalid object to wxLuaState::GetDerivedMethod")); --- 3183,3187 ---- } ! wxLuaState wxLuaState::GetDerivedMethodState(void *obj_ptr, const char *method_name) { wxCHECK_MSG(obj_ptr, wxNullLuaState, wxT("Invalid object to wxLuaState::GetDerivedMethod")); *************** *** 3192,3196 **** { wxLuaState wxlState((wxLuaState*)it->second); ! if (wxlState.HasDerivedMethod(obj_ptr, method, false)) return wxlState; } --- 3192,3196 ---- { wxLuaState wxlState((wxLuaState*)it->second); ! if (wxlState.HasDerivedMethod(obj_ptr, method_name, false)) return wxlState; } *************** *** 3313,3317 **** return lua_toboolean(M_WXLSTATEDATA->m_lua_State, index); } ! wxString wxLuaState::lua_ToString(int index) const { wxCHECK_MSG(Ok(), wxEmptyString, wxT("Invalid wxLuaState")); --- 3313,3322 ---- return lua_toboolean(M_WXLSTATEDATA->m_lua_State, index); } ! const char* wxLuaState::lua_ToString(int index) const ! { ! wxCHECK_MSG(Ok(), NULL, wxT("Invalid wxLuaState")); ! return lua_tostring(M_WXLSTATEDATA->m_lua_State, index); ! } ! wxString wxLuaState::lua_TowxString(int index) const { wxCHECK_MSG(Ok(), wxEmptyString, wxT("Invalid wxLuaState")); *************** *** 3869,3873 **** wxCHECK_MSG(Ok(), wxEmptyString, wxT("Invalid wxLuaState")); lua_GetGlobal(LUA_PATH); ! wxString path = lua_ToString(-1); lua_Pop(1); --- 3874,3878 ---- wxCHECK_MSG(Ok(), wxEmptyString, wxT("Invalid wxLuaState")); lua_GetGlobal(LUA_PATH); ! wxString path = lua_TowxString(-1); lua_Pop(1); Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** wxlbind.cpp 18 Dec 2007 05:56:15 -0000 1.106 --- wxlbind.cpp 19 Dec 2007 00:42:11 -0000 1.107 *************** *** 101,104 **** --- 101,106 ---- } + wxString wxlua_CreateArgsMsg(lua_State* L, int start_stack_idx, int end_stack_idx); + int LUACALL wxlua_CallOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod) { *************** *** 106,117 **** // get number of arguments called from Lua ! int arg_count = lua_gettop(L); ! int arg_start = 0; // don't remove the table, but do skip past it when counting args if (wxluabind_removetableforcall(L, true)) { ! arg_count--; ! arg_start++; } --- 108,119 ---- // get number of arguments called from Lua ! int arg_lua_count = lua_gettop(L); ! int arg_lua_start = 1; // don't remove the table, but do skip past it when counting args if (wxluabind_removetableforcall(L, true)) { ! arg_lua_count--; ! arg_lua_start++; } *************** *** 121,131 **** while (method) { ! for (i = 0; i < method->funcs_n; ++i) { ! if (!WXLUA_HASBIT(method->funcs[i].type, WXLUAMETHOD_OVERLOAD) && ! (arg_count >= method->funcs[i].minargs) && ! (arg_count <= method->funcs[i].maxargs)) { ! funcArray.Add(&method->funcs[i]); } --- 123,135 ---- while (method) { ! wxLuaBindCFunc* bindFunc = method->funcs; ! ! for (i = 0; i < method->funcs_n; ++i, ++bindFunc) { ! if (!WXLUA_HASBIT(bindFunc->type, WXLUAMETHOD_OVERLOAD) && ! (arg_lua_count >= bindFunc->minargs) && ! (arg_lua_count <= bindFunc->maxargs)) { ! funcArray.Add(bindFunc); } *************** *** 136,156 **** wxLuaBindCFunc* bestFunc = NULL; // stores the last function that worked. ! int invalidArg = 0; // arg that failed int func_count = funcArray.GetCount(); // Look at the available functions in parallel, per arg ! for (arg = 0; (arg < arg_count) && (func_count != 0); ++arg) { ! int arg_lua = arg+1+arg_start; // arg N on the Lua stack int ltype = lua_type(L, arg_lua); for (i = 0; i < func_count; ++i) { ! wxLuaBindCFunc* func = (wxLuaBindCFunc*)funcArray[i]; ! bestFunc = func; ! invalidArg = arg; // does this method have any more arguments? ! if (!func->argtags[arg]) { funcArray.RemoveAt(i); --- 140,160 ---- wxLuaBindCFunc* bestFunc = NULL; // stores the last function that worked. ! int invalid_lua_arg = 1; // arg that failed int func_count = funcArray.GetCount(); // Look at the available functions in parallel, per arg ! for (arg = 0; (arg < arg_lua_count) && (func_count != 0); ++arg) { ! int arg_lua = arg+arg_lua_start; // arg N on the Lua stack int ltype = lua_type(L, arg_lua); for (i = 0; i < func_count; ++i) { ! wxLuaBindCFunc* bindFunc = (wxLuaBindCFunc*)funcArray[i]; ! bestFunc = bindFunc; ! invalid_lua_arg = arg_lua+1-arg_lua_start; // does this method have any more arguments? ! if (!bindFunc->argtags[arg]) { funcArray.RemoveAt(i); *************** *** 161,165 **** // get argument tag id ! int tag = (int)*(func->argtags[arg]); //wxPrintf(wxT("ARG '%s' type %d arg_count %d arg %d arg_lua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, arg_count, arg, arg_lua, ltype, tag, i, funcArray.GetCount()); --- 165,169 ---- // get argument tag id ! int tag = (int)*(bindFunc->argtags[arg]); //wxPrintf(wxT("ARG '%s' type %d arg_count %d arg %d arg_lua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, arg_count, arg, arg_lua, ltype, tag, i, funcArray.GetCount()); *************** *** 189,193 **** // derived functions from any baseclasses and should be the best choice. // Example is wxBookCtrlBaseEvent::GetSelection() and wxCommandEvent::GetSelection() ! if (funcArray.GetCount() > 0) { lua_CFunction func = ((wxLuaBindCFunc*)funcArray[0])->func; --- 193,197 ---- // derived functions from any baseclasses and should be the best choice. // Example is wxBookCtrlBaseEvent::GetSelection() and wxCommandEvent::GetSelection() ! if (func_count > 0) { lua_CFunction func = ((wxLuaBindCFunc*)funcArray[0])->func; *************** *** 197,225 **** } ! lua_Debug ar; ! lua_getstack(L, 0, &ar); ! lua_getinfo(L, "n", &ar); ! wxString name = lua2wx(ar.name); ! ! // Build an error message ! wxString fnCall = name + wxT("("); ! for (arg = 0; arg < arg_count; ++arg) ! { ! if (arg > 0) fnCall += wxT(", "); ! ! int ltype = lua_type(L, arg+1+arg_start); ! ! if (ltype != LUA_TUSERDATA) ! { ! fnCall += lua2wx(lua_typename(L, ltype)); ! } ! else ! { ! int tag = wxluaT_gettag(L, arg+1+arg_start); ! fnCall += wxluaT_gettagname(L, tag); ! } ! } ! fnCall += wxT(")"); wxString fnOverloadList = wxT("wxLua Function Overload Table:\n"); --- 201,208 ---- } ! // ---------------------------------------------------------------------- ! // Did not find a suitable function to call, post error + wxString fnCall = wxlua_CreateArgsMsg(L, arg_lua_start, arg_lua_start+arg_lua_count-1); wxString fnOverloadList = wxT("wxLua Function Overload Table:\n"); *************** *** 230,240 **** wxString errmsg; ! if (funcArray.GetCount() > 1) { ! errmsg = wxT("wxLua Overloaded function call is ambiguous.\nTry coercing values to proper types using tostring/number as appropriate.\n"); } if (bestFunc == NULL) ! errmsg += wxString::Format(wxT("wxLua overloaded function %s has invalid argument\n%s"), fnCall.c_str(), fnOverloadList.c_str()); else { --- 213,223 ---- wxString errmsg; ! if (func_count > 1) // Note: we actually allow this.. for now { ! errmsg = wxT("wxLua: Function call is ambiguous.\nTry coercing values to proper types using tostring/number as appropriate.\n"); } if (bestFunc == NULL) ! errmsg += wxString::Format(wxT("wxLua: Function call '%s' has invalid arguments.\n%s"), fnCall.c_str(), fnOverloadList.c_str()); else { *************** *** 259,263 **** } ! errmsg += wxString::Format(wxT("wxLua overloaded function %s has invalid argument %d on method %02d\n%s"), fnCall.c_str(), (invalidArg), i_func, fnOverloadList.c_str()); } --- 242,246 ---- } ! errmsg += wxString::Format(wxT("wxLua: Function call '%s' has invalid argument %d on method %02d.\n%s"), fnCall.c_str(), invalid_lua_arg, i_func, fnOverloadList.c_str()); } *************** *** 267,270 **** --- 250,284 ---- } + wxString wxlua_CreateArgsMsg(lua_State* L, int start_stack_idx, int end_stack_idx) + { + lua_Debug ar; + lua_getstack(L, 0, &ar); + lua_getinfo(L, "n", &ar); + wxString funcName = lua2wx(ar.name); + + // Build an error message + wxString funcCall = funcName + wxT("("); + + for (int arg = start_stack_idx; arg <= end_stack_idx; ++arg) + { + if (arg > start_stack_idx) funcCall += wxT(", "); + + int ltype = lua_type(L, arg); + + if (ltype != LUA_TUSERDATA) + { + funcCall += lua2wx(lua_typename(L, ltype)); + } + else + { + int tag = wxluaT_gettag(L, arg); + funcCall += wxluaT_gettagname(L, tag); + } + } + funcCall += wxT(")"); + + return funcCall; + } + wxArrayString wxlua_CreateMethodArgTagsMsg(lua_State* L, struct wxLuaBindMethod* wxlMethod) { *************** *** 292,296 **** i_func++; ! wxString fnOverload = wxString::Format(wxT("%02d. %s%s("), i_func, className.c_str(), lua2wx(method->name).c_str()); // overloaded function has invalid tags --- 306,310 ---- i_func++; ! wxString funcStr = wxString::Format(wxT("%02d. %s%s("), i_func, className.c_str(), lua2wx(method->name).c_str()); // overloaded function has invalid tags *************** *** 299,303 **** // However, we do print that there is an overload so that in CallOverloadedFunction // we can find what function we were closest too. ! fnOverload += wxT(" ... ) - overloaded function"); } else --- 313,317 ---- // However, we do print that there is an overload so that in CallOverloadedFunction // we can find what function we were closest too. ! funcStr += wxT(" ... ) - overloaded function"); } else *************** *** 307,318 **** // optional args? if ((funcs[i].minargs < funcs[i].maxargs) && (arg == funcs[i].minargs)) ! fnOverload += wxT("["); if (arg > 0) ! fnOverload += wxT(", "); int tag = (int)*(funcs[i].argtags[arg]); ! fnOverload += wxluaT_gettagname(L, tag); if ((arg == 0) && --- 321,332 ---- // optional args? if ((funcs[i].minargs < funcs[i].maxargs) && (arg == funcs[i].minargs)) ! funcStr += wxT("["); if (arg > 0) ! funcStr += wxT(", "); int tag = (int)*(funcs[i].argtags[arg]); ! funcStr += wxluaT_gettagname(L, tag); if ((arg == 0) && *************** *** 320,337 **** !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CFUNCTION)) ! fnOverload += wxT("(self)"); } // close optional args if (funcs[i].minargs < funcs[i].maxargs) ! fnOverload += wxT("]"); ! fnOverload += wxT(")"); if (WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC)) ! fnOverload += wxT(" - static"); } ! overloadMethodArray.Add(fnOverload); } --- 334,351 ---- !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CONSTRUCTOR) && !WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_CFUNCTION)) ! funcStr += wxT("(self)"); } // close optional args if (funcs[i].minargs < funcs[i].maxargs) ! funcStr += wxT("]"); ! funcStr += wxT(")"); if (WXLUA_HASBIT(funcs[i].type, WXLUAMETHOD_STATIC)) ! funcStr += wxT(" - static"); } ! overloadMethodArray.Add(funcStr); } *************** *** 401,405 **** return true; } ! else if (m_wxlState->wxluaR_GetRef(m_reference, &wxlua_lreg_refs_key)) return true; --- 415,419 ---- return true; } ! else if (wxluaR_getref(L, m_reference, &wxlua_lreg_refs_key)) return true; *************** *** 420,428 **** { wxCHECK_MSG(m_wxlState->Ok(), 0, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(m_alloc_flag == wxLUAOBJECT_NONE, 0, wxT("wxLuaObject already initialized")); if ((m_reference != LUA_NOREF) && GetObject()) { ! m_bool = (lua_toboolean(m_wxlState->GetLuaState(), -1) != 0); m_alloc_flag = wxLUAOBJECT_BOOL; m_wxlState->lua_Pop(1); --- 434,442 ---- { wxCHECK_MSG(m_wxlState->Ok(), 0, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(m_alloc_flag == wxLUAOBJECT_NONE, 0, wxT("wxLuaObject already initialized in wxLuaObject::GetBoolPtr")); if ((m_reference != LUA_NOREF) && GetObject()) { ! m_bool = (m_wxlState->lua_ToBoolean(-1) != 0); m_alloc_flag = wxLUAOBJECT_BOOL; m_wxlState->lua_Pop(1); *************** *** 434,442 **** { wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(m_alloc_flag == wxLUAOBJECT_NONE, 0, wxT("wxLuaObject already initialized")); if ((m_reference != LUA_NOREF) && GetObject()) { ! m_int = (int)lua_tonumber(m_wxlState->GetLuaState(), -1); m_alloc_flag = wxLUAOBJECT_INT; m_wxlState->lua_Pop(1); --- 448,456 ---- { wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(m_alloc_flag == wxLUAOBJECT_NONE, 0, wxT("wxLuaObject already initialized in wxLuaObject::GetIntPtr")); if ((m_reference != LUA_NOREF) && GetObject()) { ! m_int = (int)m_wxlState->lua_ToNumber(-1); m_alloc_flag = wxLUAOBJECT_INT; m_wxlState->lua_Pop(1); *************** *** 448,452 **** { wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(m_alloc_flag == wxLUAOBJECT_NONE, 0, wxT("wxLuaObject already initialized")); m_string = new wxString(); // create valid string for return --- 462,466 ---- { wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(m_alloc_flag == wxLUAOBJECT_NONE, 0, wxT("wxLuaObject already initialized in wxLuaObject::GetStringPtr")); m_string = new wxString(); // create valid string for return *************** *** 454,458 **** if ((m_reference != LUA_NOREF) && GetObject()) { ! *m_string = lua2wx(lua_tostring(m_wxlState->GetLuaState(), -1)); m_alloc_flag = wxLUAOBJECT_STRING; m_wxlState->lua_Pop(1); --- 468,472 ---- if ((m_reference != LUA_NOREF) && GetObject()) { ! *m_string = m_wxlState->lua_TowxString(-1); m_alloc_flag = wxLUAOBJECT_STRING; m_wxlState->lua_Pop(1); *************** *** 465,469 **** { wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(m_alloc_flag == wxLUAOBJECT_NONE, 0, wxT("wxLuaObject already initialized")); m_arrayInt = new wxArrayInt(); // create valid array for return --- 479,483 ---- { wxCHECK_MSG(m_wxlState->Ok(), false, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(m_alloc_flag == wxLUAOBJECT_NONE, 0, wxT("wxLuaObject already initialized in wxLuaObject::GetArrayPtr")); m_arrayInt = new wxArrayInt(); // create valid array for return *************** *** 471,475 **** if ((m_reference != LUA_NOREF) && GetObject()) { ! *m_arrayInt = (wxArrayInt&)m_wxlState->GetwxArrayInt(-1); m_alloc_flag = wxLUAOBJECT_ARRAYINT; m_wxlState->lua_Pop(1); --- 485,489 ---- if ((m_reference != LUA_NOREF) && GetObject()) { ! *m_arrayInt = (wxArrayInt&)m_wxlState->GetwxArrayInt(-1); // coerce wxLuaSmartwxArrayInt m_alloc_flag = wxLUAOBJECT_ARRAYINT; m_wxlState->lua_Pop(1); *************** *** 579,583 **** void* udata = lua_touserdata(L, 1); void* obj_ptr = wxlua_touserdata(L, 1, false); ! // if removed from tracked mem list, reset the tag so that gc() is not called on this object. if ((obj_ptr != NULL) && wxluaO_deletegcobject(L, udata, obj_ptr, WXLUA_DELETE_OBJECT_ALL)) { --- 593,598 ---- void* udata = lua_touserdata(L, 1); void* obj_ptr = wxlua_touserdata(L, 1, false); ! ! // if removed from tracked mem list, remove the metatable so that __gc is not called on this object. if ((obj_ptr != NULL) && wxluaO_deletegcobject(L, udata, obj_ptr, WXLUA_DELETE_OBJECT_ALL)) { *************** *** 606,610 **** { void* udata = lua_touserdata(L, 1); ! void* obj_ptr = wxlua_touserdata(L, 1, true); // clean up the rest of this, this won't error if the key doesn't exist --- 621,625 ---- { void* udata = lua_touserdata(L, 1); ! void* obj_ptr = wxlua_touserdata(L, 1, true); // clear lua userdata's ptr // clean up the rest of this, this won't error if the key doesn't exist *************** *** 635,641 **** wxlua_setcallbaseclassfunction(L, false); ! bool callbase = false; ! bool found = false; ! int result = 0; wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); --- 650,656 ---- wxlua_setcallbaseclassfunction(L, false); ! bool callbase = false; ! bool found = false; ! int result = 0; wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); *************** *** 658,661 **** --- 673,677 ---- // } + void *obj_ptr = wxlua_touserdata(L, 1, false); const char *name = lua_tostring(L, 2); // name of the __index method called in Lua *************** *** 668,674 **** else if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_gettag(L, 1) == *wxlClass->class_tag)) { - void *pObject = wxlua_touserdata(L, 1, false); - - // check if we're to call the baseclass function or if it's a Lua derived function if (!found) --- 684,687 ---- *************** *** 681,688 **** { // if there's a derived method, push it onto the stack to be run ! if (wxlua_hasderivedmethod(L, pObject, name, true)) { found = true; ! result = 1; // the function for Lua to call } } --- 694,701 ---- { // if there's a derived method, push it onto the stack to be run ! if (wxlua_hasderivedmethod(L, obj_ptr, name, true)) { found = true; ! result = 1; // the function for Lua to call is on the stack } } *************** *** 708,721 **** #if 1 // experimental function calls w/o using the wxLuaFunction if (wxlMethod->basemethod) - { - lua_pushlightuserdata(L, wxlMethod); lua_pushcclosure(L, wxlua_CallOverloadedFunction, 1); - } else ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 0); #else ! wxLuaFunction *wxlFunc = new wxLuaFunction(wxlMethod, pObject); // Don't track the wxLuaFunction for speed wxluaT_pushusertag(L, wxlFunc, g_wxluatag_wxLuaFunction, false); --- 721,733 ---- #if 1 + lua_pushlightuserdata(L, wxlMethod); + // experimental function calls w/o using the wxLuaFunction if (wxlMethod->basemethod) lua_pushcclosure(L, wxlua_CallOverloadedFunction, 1); else ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); #else ! wxLuaFunction *wxlFunc = new wxLuaFunction(wxlMethod, obj_ptr); // Don't track the wxLuaFunction for speed wxluaT_pushusertag(L, wxlFunc, g_wxluatag_wxLuaFunction, false); *************** *** 857,861 **** int wxluabind_removetableforcall(lua_State* L, bool only_check) { ! void* p = (void *)lua_touserdata(L, lua_upvalueindex(1)); // lightuserdata if (!only_check && (p == &wxluabind_checkremovetable)) lua_remove(L, 1); --- 869,873 ---- int wxluabind_removetableforcall(lua_State* L, bool only_check) { ! void* p = (void *)lua_touserdata(L, lua_upvalueindex(2)); // lightuserdata if (!only_check && (p == &wxluabind_checkremovetable)) lua_remove(L, 1); *************** *** 936,950 **** bool wxLuaBinding::sm_bindingList_initialized = false; ! wxLuaBinding::wxLuaBinding() : wxObject(), ! m_classCount(0), m_classArray(NULL), ! m_defineCount(0), m_defineArray(NULL), ! m_stringCount(0), m_stringArray(NULL), ! m_eventCount(0), m_eventArray(NULL), ! m_objectCount(0), m_objectArray(NULL), ! m_functionCount(0), m_functionArray(NULL), ! m_bindings_registered(false), ! m_start_tag(0), ! m_last_tag(0), ! m_luaTable_ref(-1) { } --- 948,962 ---- bool wxLuaBinding::sm_bindingList_initialized = false; ! wxLuaBinding::wxLuaBinding() ! :m_classCount(0), m_classArray(NULL), ! m_defineCount(0), m_defineArray(NULL), ! m_stringCount(0), m_stringArray(NULL), ! m_eventCount(0), m_eventArray(NULL), ! m_objectCount(0), m_objectArray(NULL), ! m_functionCount(0), m_functionArray(NULL), ! m_bindings_registered(false), ! m_start_tag(0), ! m_last_tag(0), ! m_luaTable_ref(-1) { } *************** *** 984,992 **** } ! bool wxLuaBinding::RegisterBinding(const wxLuaState& wxlState_) { ! wxCHECK_MSG(wxlState_.Ok(), false, wxT("Invalid wxLuaState")); ! wxLuaState wxlState(wxlState_); // unconst the state ! lua_State *L = wxlState.GetLuaState(); --- 996,1002 ---- } ! bool wxLuaBinding::RegisterBinding(const wxLuaState& wxlState) { ! wxCHECK_MSG(wxlState.Ok(), false, wxT("Invalid wxLuaState")); lua_State *L = wxlState.GetLuaState(); *************** *** 996,1000 **** s.Printf(wxT("wxLua: Bindings '%s' in Lua namespace '%s' are already registered."), m_bindingName.c_str(), m_nameSpace.c_str()); ! wxlState.wxlua_Error(wx2lua(s)); return false; } --- 1006,1010 ---- s.Printf(wxT("wxLua: Bindings '%s' in Lua namespace '%s' are already registered."), m_bindingName.c_str(), m_nameSpace.c_str()); ! wxlua_error(L, s); return false; } *************** *** 1045,1049 **** { // create a ref for the wxLua table we're filling ! m_luaTable_ref = wxlState.wxluaR_Ref(-1, &wxlua_lreg_refs_key); } --- 1055,1059 ---- { // create a ref for the wxLua table we're filling ! m_luaTable_ref = wxluaR_ref(L, -1, &wxlua_lreg_refs_key); } *************** *** 1060,1064 **** } ! void wxLuaBinding::DoRegisterBinding(const wxLuaState& wxlState_, int tableOffset) { // Replace the metatable functions for the classes we push into Lua --- 1070,1074 ---- } ! void wxLuaBinding::DoRegisterBinding(const wxLuaState& wxlState, int tableOffset) { // Replace the metatable functions for the classes we push into Lua *************** *** 1072,1080 **** static const size_t s_funcCount = sizeof(s_funcTable)/sizeof(s_funcTable[0]); ! wxCHECK_RET(wxlState_.Ok(), wxT("Invalid wxLuaState")); ! wxLuaState wxlState(wxlState_); lua_State *L = wxlState.GetLuaState(); ! int iTag = m_start_tag; // install the classes, functions and methods, creating new tags --- 1082,1089 ---- static const size_t s_funcCount = sizeof(s_funcTable)/sizeof(s_funcTable[0]); ! wxCHECK_RET(wxlState.Ok(), wxT("Invalid wxLuaState")); lua_State *L = wxlState.GetLuaState(); ! int wxl_tag = m_start_tag; // install the classes, functions and methods, creating new tags *************** *** 1086,1107 **** // Add to the lookup table for "class name" to wxLuaBindClass struct lua_pushlightuserdata(L, &wxlua_lreg_classes_key); ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the classes table) ! lua_pushstring(L, wxlClass->name); ! lua_pushlightuserdata(L, (void *)wxlClass); ! lua_rawset(L, -3); // t[name] = tag ! lua_remove(L, -1); // remove wxLua's registry wxLuaClasses table // ------------------------------------------------------------------ // Create a new metatable for this class with a numerical tag index ! iTag = wxlState.wxluaT_NewTag(); ! *wxlClass->class_tag = iTag; if (i_class == 0) ! m_start_tag = iTag; // store a lookup in the class metatable to the wxLuaBindClass struct ! lua_pushlightuserdata(L, &wxlua_metatable_wxluabindclass_key); ! lua_pushlightuserdata(L, (void *)wxlClass); ! lua_rawset(L, -3); // t[name] = tag // set the functions for the class in the metatable --- 1095,1116 ---- // Add to the lookup table for "class name" to wxLuaBindClass struct lua_pushlightuserdata(L, &wxlua_lreg_classes_key); ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the classes table) ! lua_pushstring(L, wxlClass->name); // push key ! lua_pushlightuserdata(L, (void *)wxlClass); // push value ! lua_rawset(L, -3); // set t[key] = value, pops key and value ! lua_pop(L, 1); // pop wxlua_lreg_classes_key table // ------------------------------------------------------------------ // Create a new metatable for this class with a numerical tag index ! wxl_tag = wxluaT_newtag(L); // create metatable, is on top of stack ! *wxlClass->class_tag = wxl_tag; if (i_class == 0) ! m_start_tag = wxl_tag; // store a lookup in the class metatable to the wxLuaBindClass struct ! lua_pushlightuserdata(L, &wxlua_metatable_wxluabindclass_key); // push key ! lua_pushlightuserdata(L, (void *)wxlClass); // push value ! lua_rawset(L, -3); // set t[key] = value, pops key and value // set the functions for the class in the metatable *************** *** 1114,1124 **** } ! lua_remove(L, -1); // remove metatable we got from wxluaR_getref() // ------------------------------------------------------------------ ! // install the table for the class ! lua_pushstring(L, wxlClass->name); ! lua_newtable(L); // Install the member enums for the classname table --- 1123,1133 ---- } ! lua_pop(L, 1); // pop metatable from wxluaT_newtag() // ------------------------------------------------------------------ ! // Create and install the table for the class ! lua_pushstring(L, wxlClass->name); // push key ! lua_newtable(L); // push value, the table we use as the class // Install the member enums for the classname table *************** *** 1139,1148 **** { lua_pushstring(L, wxlMethod->name); ! lua_pushcfunction(L, wxlMethod->funcs[0].func); lua_rawset(L, -3); } } ! lua_rawset(L, -3); // same as lua_settable(L, tableOffset); // ------------------------------------------------------------------ --- 1148,1160 ---- { lua_pushstring(L, wxlMethod->name); ! lua_pushlightuserdata(L, wxlMethod); ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); lua_rawset(L, -3); } } ! // Finalize the class table since we may not have a constructor ! // or have multiple constructors. ! lua_rawset(L, -3); // set t[key] = value, pops key and value // ------------------------------------------------------------------ *************** *** 1154,1157 **** --- 1166,1170 ---- { #if 1 // C++ class constructors are tables and use the __call metatable to make them "functions" + // push name of nested table and create the table or use existing // we do it this way since we can have multiple constructors (renamed) *************** *** 1166,1170 **** // add the items to the table as t[first pushed] = second pushed lua_pushlstring(L, "new", 3); ! lua_pushcfunction(L, wxlMethod->funcs[0].func); lua_rawset(L, -3); // same as lua_setfield(L, -2, "key") --- 1179,1184 ---- // add the items to the table as t[first pushed] = second pushed lua_pushlstring(L, "new", 3); ! lua_pushlightuserdata(L, wxlMethod); ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); lua_rawset(L, -3); // same as lua_setfield(L, -2, "key") *************** *** 1173,1178 **** lua_pushlstring(L, "__call", 6); lua_pushlightuserdata(L, &wxluabind_checkremovetable); // push tag to recognize table call ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); // push func with tag as upvalue lua_rawset(L, -3); --- 1187,1193 ---- lua_pushlstring(L, "__call", 6); + lua_pushlightuserdata(L, wxlMethod); lua_pushlightuserdata(L, &wxluabind_checkremovetable); // push tag to recognize table call ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 2); // push func with tag as upvalue lua_rawset(L, -3); *************** *** 1184,1188 **** // add table to the binding table t[wxlMethod->name] = { this table } ! lua_rawset(L, -3); #elif 0 // C++ constructors are userdata, use metatable for access to items. --- 1199,1203 ---- // add table to the binding table t[wxlMethod->name] = { this table } ! lua_rawset(L, -3); // set t[key] = value, pops key and value #elif 0 // C++ constructors are userdata, use metatable for access to items. *************** *** 1211,1222 **** } ! m_last_tag = iTag; ! // register all the builtin functions, global C style functions wxLuaBindMethod* wxlMethod = m_functionArray; for (size_t i_func = 0; i_func < m_functionCount; ++i_func, ++wxlMethod) { lua_pushstring(L, wxlMethod->name); ! lua_pushcfunction(L, wxlMethod->funcs[0].func); lua_rawset(L, -3); } --- 1226,1238 ---- } ! m_last_tag = wxl_tag; ! // register the global C style functions wxLuaBindMethod* wxlMethod = m_functionArray; for (size_t i_func = 0; i_func < m_functionCount; ++i_func, ++wxlMethod) { lua_pushstring(L, wxlMethod->name); ! lua_pushlightuserdata(L, wxlMethod); ! lua_pushcclosure(L, wxlMethod->funcs[0].func, 1); lua_rawset(L, -3); } *************** *** 1254,1258 **** } ! // register all the wxevent types wxLuaBindEvent *wxlEvent = m_eventArray; for (size_t i_event = 0; i_event < m_eventCount; ++i_event, ++wxlEvent) --- 1270,1274 ---- } ! // register the wxEvent types wxLuaBindEvent *wxlEvent = m_eventArray; for (size_t i_event = 0; i_event < m_eventCount; ++i_event, ++wxlEvent) *************** *** 1286,1290 **** // we've sorted this, see InitBinding() const wxEventType eventType = eventType_; ! wxLuaBindEvent eventItem = { "", &eventType }; const wxLuaBindEvent *pLuaEvent = (wxLuaBindEvent *)bsearch(&eventItem, --- 1302,1306 ---- // we've sorted this, see InitBinding() const wxEventType eventType = eventType_; ! wxLuaBindEvent eventItem = { "", &eventType, NULL }; const wxLuaBindEvent *pLuaEvent = (wxLuaBindEvent *)bsearch(&eventItem, *************** *** 1523,1531 **** wxCHECK_MSG(wxlClass, NULL, wxT("Invalid wxLuaBindClass in wxLuaState::GetClassProperty")); int i_method, method_count = wxlClass->methods_n; // find a method in the class, recurse through classes from which this class is derived. ! for (i_method = 0; i_method < method_count; ++i_method) { - wxLuaBindMethod *wxlMethod = wxlClass->methods + i_method; if (isLuaSetProp) { --- 1539,1547 ---- wxCHECK_MSG(wxlClass, NULL, wxT("Invalid wxLuaBindClass in wxLuaState::GetClassProperty")); + wxLuaBindMethod *wxlMethod = wxlClass->methods; int i_method, method_count = wxlClass->methods_n; // find a method in the class, recurse through classes from which this class is derived. ! for (i_method = 0; i_method < method_count; ++i_method, ++wxlMethod) { if (isLuaSetProp) { |
From: John L. <jr...@us...> - 2007-12-18 05:56:20
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8412/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp Log Message: Test using experimental function calls w/o the wxLuaFunction userdata intermediatary with the __call metatable function. Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** wxlbind.cpp 13 Dec 2007 06:23:55 -0000 1.105 --- wxlbind.cpp 18 Dec 2007 05:56:15 -0000 1.106 *************** *** 93,96 **** --- 93,104 ---- // ---------------------------------------------------------------------------- + + static int LUACALL wxlua_CallOverloadedFunction(lua_State* L) + { + wxLuaBindMethod* wxlMethod = (wxLuaBindMethod *)lua_touserdata(L, lua_upvalueindex(1)); // lightuserdata + wxCHECK_MSG(wxlMethod, 0, wxT("Invalid wxLuaBindMethod")); + return wxlua_CallOverloadedFunction(L, wxlMethod); + } + int LUACALL wxlua_CallOverloadedFunction(lua_State* L, struct wxLuaBindMethod* wxlMethod) { *************** *** 656,660 **** // name is NULL if it's not a string wxlua_error(L, wxString::Format(_("wxLua: Attempt to call a class method using '%s' on a '%s' type."), ! lua2wx(lua_typename(L, lua_type(L, 2))).c_str(), lua2wx(wxlClass ? wxlClass->name : "").c_str())); } else if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_gettag(L, 1) == *wxlClass->class_tag)) --- 664,668 ---- // name is NULL if it's not a string wxlua_error(L, wxString::Format(_("wxLua: Attempt to call a class method using '%s' on a '%s' type."), ! wxlua_gettypename(L, 2).c_str(), lua2wx(wxlClass ? wxlClass->name : "").c_str())); } else if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_gettag(L, 1) == *wxlClass->class_tag)) *************** *** 698,704 **** --- 706,724 ---- found = true; result = 1; + + #if 1 + // experimental function calls w/o using the wxLuaFunction + if (wxlMethod->basemethod) + { + lua_pushlightuserdata(L, wxlMethod); + lua_pushcclosure(L, wxlua_CallOverloadedFunction, 1); + } + else + lua_pushcclosure(L, wxlMethod->funcs[0].func, 0); + #else wxLuaFunction *wxlFunc = new wxLuaFunction(wxlMethod, pObject); // Don't track the wxLuaFunction for speed wxluaT_pushusertag(L, wxlFunc, g_wxluatag_wxLuaFunction, false); + #endif } } |
From: John L. <jr...@us...> - 2007-12-18 01:04:05
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19598/wxLua/bindings Modified Files: genidocs.lua genidocs_rules.lua Log Message: Cleanup: lua to Lua Fix various binding errors, wrong params for static wxFile functions Bump version to 2.8.7 Add wxImage::GetData(), wxMemoryInputStream Index: genidocs_rules.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genidocs_rules.lua,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** genidocs_rules.lua 16 Jul 2007 19:34:13 -0000 1.5 --- genidocs_rules.lua 18 Dec 2007 01:03:32 -0000 1.6 *************** *** 173,176 **** --- 173,178 ---- -- A message to append to the class name in the index for classes. msgForClassInIndex = { + ["wxAccessible"] = "MS Windows only and disabled by default in wxWidgets", + ["wxAppTraits"] = "Most functions are available elsewhere", ["wxArray"] = "Not a real class, see implementations (wxArrayInt)", ["wxArrayInt"] = "Interchangeable with a numeric indexed lua table", *************** *** 180,183 **** --- 182,199 ---- ["wxCmdLineParser"] = "Easier to implement in lua", ["wxCSConv"] = "Lua uses ANSI 8-bit strings", + + ["wxDb"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbColDataPtr"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbColDef"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbColFor"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbColInf"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbConnectInf"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbGridColInfo"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbGridTableBase"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbIdxDef"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbInf"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbTable"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDbTableInf"] = "Deprecated and will not be in wxWidgets 3.0", + ["wxDirTraverser"] = "Use wxDir::GetFirst() and GetNext()", ["wxDllLoader"] = "Deprecated since version 2.4, see wxDynamicLibrary", *************** *** 222,226 **** <body> ! <h1>wxLua 2.8.4.0 Reference Manual for wxWidgets 2.8.4</h1> ]] --- 238,242 ---- <body> ! <h1>wxLua 2.8.4.0 Reference Manual for wxWidgets 2.8.7</h1> ]] Index: genidocs.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genidocs.lua,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** genidocs.lua 16 Jul 2007 19:34:13 -0000 1.11 --- genidocs.lua 18 Dec 2007 01:03:32 -0000 1.12 *************** *** 142,146 **** for k, v in pairs(dataTypeTable) do -- hack for special classes ! if (v.DefType == "class") or (v.DefType == "struct") or (v.DefType == "wx2lua") then allClasses[k] = true -- the ones we wrap end --- 142,146 ---- for k, v in pairs(dataTypeTable) do -- hack for special classes ! if (v.ValueType == "class") or (v.ValueType == "struct") or (v.ValueType == "wx2lua") then allClasses[k] = true -- the ones we wrap end *************** *** 222,226 **** for k, v in pairs(dataTypeTable) do ! if v.DefType == "enum" then table.insert(names, k) end --- 222,226 ---- for k, v in pairs(dataTypeTable) do ! if v.ValueType == "enum" then table.insert(names, k) end *************** *** 419,424 **** if ((string.len(cname) == 0) or (not string.find(w, cname, 1, 1))) and (not used[w]) and ! dataTypeTable[w] and (dataTypeTable[w].DefType ~= "number") and ! (dataTypeTable[w].DefType ~= "wxtypedef") and (dataTypeTable[w].DefType ~= "special") then used[w] = true --- 419,424 ---- if ((string.len(cname) == 0) or (not string.find(w, cname, 1, 1))) and (not used[w]) and ! dataTypeTable[w] and (dataTypeTable[w].ValueType ~= "number") and ! (dataTypeTable[w].ValueType ~= "wxtypedef") and (dataTypeTable[w].ValueType ~= "special") then used[w] = true *************** *** 586,590 **** end ! dataTypeTable["wxString"].DefType = "class" -- FIXME hack for wxString DefType as "special" if completeClassRefFileTable then --- 586,590 ---- end ! dataTypeTable["wxString"].ValueType = "class" -- FIXME hack for wxString DefType as "special" if completeClassRefFileTable then |
From: John L. <jr...@us...> - 2007-12-18 01:03:41
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19598/wxLua/modules/wxbind/src Modified Files: wxaui_aui.cpp wxbase_bind.cpp wxbase_datetime.cpp wxbase_file.cpp wxcore_appframe.cpp wxcore_bind.cpp wxcore_gdi.cpp wxcore_image.cpp wxstc_stc.cpp Log Message: Cleanup: lua to Lua Fix various binding errors, wrong params for static wxFile functions Bump version to 2.8.7 Add wxImage::GetData(), wxMemoryInputStream Index: wxaui_aui.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxaui_aui.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wxaui_aui.cpp 13 Dec 2007 06:23:54 -0000 1.11 --- wxaui_aui.cpp 18 Dec 2007 01:03:34 -0000 1.12 *************** *** 1661,1668 **** } static wxLuaArgTag s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging[] = { &s_wxluatag_wxAuiTabCtrl, NULL }; static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxAuiTabCtrl_IsDragging[1] = {{ wxLua_wxAuiTabCtrl_IsDragging, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging }}; ! // bool IsDragging() const static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L) { --- 1661,1670 ---- } + + #if (wxCHECK_VERSION(2,8,5)) && (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) static wxLuaArgTag s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging[] = { &s_wxluatag_wxAuiTabCtrl, NULL }; static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxAuiTabCtrl_IsDragging[1] = {{ wxLua_wxAuiTabCtrl_IsDragging, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxAuiTabCtrl_IsDragging }}; ! // %wxchkver_2_8_5 bool IsDragging() const static int LUACALL wxLua_wxAuiTabCtrl_IsDragging(lua_State *L) { *************** *** 1677,1680 **** --- 1679,1683 ---- } + #endif // (wxCHECK_VERSION(2,8,5)) && (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) #if (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxLUA_USE_wxDC) *************** *** 2068,2072 **** --- 2071,2078 ---- { "GetWindowFromIdx", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxAuiTabCtrl_GetWindowFromIdx, 1, NULL }, { "InsertPage", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxAuiTabCtrl_InsertPage, 1, NULL }, + + #if (wxCHECK_VERSION(2,8,5)) && (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) { "IsDragging", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxAuiTabCtrl_IsDragging, 1, NULL }, + #endif // (wxCHECK_VERSION(2,8,5)) && (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) #if (wxLUA_USE_wxAUI && wxCHECK_VERSION(2,8,0) && wxUSE_AUI) && (wxLUA_USE_wxDC) Index: wxbase_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_bind.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxbase_bind.cpp 13 Dec 2007 00:47:49 -0000 1.8 --- wxbase_bind.cpp 18 Dec 2007 01:03:34 -0000 1.9 *************** *** 2281,2284 **** --- 2281,2288 ---- #endif // wxLUA_USE_wxConfig && wxUSE_CONFIG + #if wxUSE_STREAMS + { "wxMemoryInputStream", wxMemoryInputStream_methods, wxMemoryInputStream_methodCount, NULL, &s_wxluatag_wxMemoryInputStream, "wxInputStream", NULL ,s_wxluadefineArray_None, 0, }, + #endif // wxUSE_STREAMS + { "wxMimeTypesManager", wxMimeTypesManager_methods, wxMimeTypesManager_methodCount, NULL, &s_wxluatag_wxMimeTypesManager, NULL, NULL ,s_wxluadefineArray_None, 0, }, *************** *** 2534,2537 **** --- 2538,2542 ---- wxLUA_IMPLEMENT_ENCAPSULATION(wxFileInputStream, wxFileInputStream) wxLUA_IMPLEMENT_ENCAPSULATION(wxFileOutputStream, wxFileOutputStream) + wxLUA_IMPLEMENT_ENCAPSULATION(wxMemoryInputStream, wxMemoryInputStream) #endif // wxUSE_STREAMS Index: wxcore_appframe.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_appframe.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxcore_appframe.cpp 13 Dec 2007 00:47:49 -0000 1.5 --- wxcore_appframe.cpp 18 Dec 2007 01:03:34 -0000 1.6 *************** *** 175,181 **** --- 175,195 ---- } + static int LUACALL wxLua_wxApp_IsMainLoopRunning(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxApp_IsMainLoopRunning[1] = {{ wxLua_wxApp_IsMainLoopRunning, WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, 0, 0, s_wxluaargArray_None }}; + // static bool IsMainLoopRunning() + static int LUACALL wxLua_wxApp_IsMainLoopRunning(lua_State *L) + { + // call IsMainLoopRunning + bool returns = (wxApp::IsMainLoopRunning()); + // push the result flag + lua_pushboolean(L, returns); + + return 1; + } + static wxLuaArgTag s_wxluatagArray_wxLua_wxApp_MainLoop[] = { &s_wxluatag_wxApp, NULL }; static int LUACALL wxLua_wxApp_MainLoop(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxApp_MainLoop[1] = {{ wxLua_wxApp_MainLoop, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxApp_MainLoop }}; + // %override wxLua_wxApp_MainLoop // int MainLoop() static int LUACALL wxLua_wxApp_MainLoop(lua_State *L) *************** *** 184,188 **** wxApp * self = (wxApp *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxApp); // call MainLoop ! int returns = (self->MainLoop()); // push the result number lua_pushnumber(L, returns); --- 198,202 ---- wxApp * self = (wxApp *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxApp); // call MainLoop ! int returns = !wxApp::IsMainLoopRunning() ? (self->MainLoop()) : 0; // push the result number lua_pushnumber(L, returns); *************** *** 191,194 **** --- 205,209 ---- } + static wxLuaArgTag s_wxluatagArray_wxLua_wxApp_Pending[] = { &s_wxluatag_wxApp, NULL }; static int LUACALL wxLua_wxApp_Pending(lua_State *L); *************** *** 341,344 **** --- 356,360 ---- { "GetVendorName", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxApp_GetVendorName, 1, NULL }, { "IsActive", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxApp_IsActive, 1, NULL }, + { "IsMainLoopRunning", WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, s_wxluafunc_wxLua_wxApp_IsMainLoopRunning, 1, NULL }, { "MainLoop", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxApp_MainLoop, 1, NULL }, { "Pending", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxApp_Pending, 1, NULL }, Index: wxstc_stc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxstc_stc.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxstc_stc.cpp 13 Dec 2007 00:47:51 -0000 1.8 --- wxstc_stc.cpp 18 Dec 2007 01:03:34 -0000 1.9 *************** *** 5892,5896 **** { // const wxString &styleBytes ! wxCharBuffer styleBytes(lua_tostring(L, 3)); // int length int length = (int)lua_tonumber(L, 2); --- 5892,5896 ---- { // const wxString &styleBytes ! char* styleBytes = (char*)lua_tostring(L, 3); // int length int length = (int)lua_tonumber(L, 2); *************** *** 5898,5906 **** wxStyledTextCtrl *self = (wxStyledTextCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxStyledTextCtrl); // call SetStyleBytes ! self->SetStyleBytes(length, styleBytes.data()); ! // push result ! lua_pushstring(L, styleBytes); // return the number of parameters ! return 1; } --- 5898,5904 ---- wxStyledTextCtrl *self = (wxStyledTextCtrl *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxStyledTextCtrl); // call SetStyleBytes ! self->SetStyleBytes(length, styleBytes); // return the number of parameters ! return 0; } Index: wxbase_datetime.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_datetime.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxbase_datetime.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxbase_datetime.cpp 18 Dec 2007 01:03:34 -0000 1.8 *************** *** 798,802 **** static int LUACALL wxLua_wxDateTime_Set(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxDateTime_Set[1] = {{ wxLua_wxDateTime_Set, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxDateTime_Set }}; ! // wxDateTime& Set(time_t time) // use with lua's os.time() on MSW, Linux, others? static int LUACALL wxLua_wxDateTime_Set(lua_State *L) { --- 798,802 ---- static int LUACALL wxLua_wxDateTime_Set(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxDateTime_Set[1] = {{ wxLua_wxDateTime_Set, WXLUAMETHOD_METHOD, 2, 2, s_wxluatagArray_wxLua_wxDateTime_Set }}; ! // wxDateTime& Set(time_t time) // use with Lua's os.time() on MSW, Linux, others? static int LUACALL wxLua_wxDateTime_Set(lua_State *L) { *************** *** 1300,1304 **** static int LUACALL wxLua_wxDateTime_constructor1(lua_State *L); // static wxLuaBindCFunc s_wxluafunc_wxLua_wxDateTime_constructor1[1] = {{ wxLua_wxDateTime_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxDateTime_constructor1 }}; ! // wxDateTime(time_t dateTime) // use with lua's os.time() on MSW, Linux, others? static int LUACALL wxLua_wxDateTime_constructor1(lua_State *L) { --- 1300,1304 ---- static int LUACALL wxLua_wxDateTime_constructor1(lua_State *L); // static wxLuaBindCFunc s_wxluafunc_wxLua_wxDateTime_constructor1[1] = {{ wxLua_wxDateTime_constructor1, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxDateTime_constructor1 }}; ! // wxDateTime(time_t dateTime) // use with Lua's os.time() on MSW, Linux, others? static int LUACALL wxLua_wxDateTime_constructor1(lua_State *L) { Index: wxcore_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_bind.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxcore_bind.cpp 13 Dec 2007 00:47:49 -0000 1.10 --- wxcore_bind.cpp 18 Dec 2007 01:03:34 -0000 1.11 *************** *** 2595,2598 **** --- 2595,2605 ---- #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxUSE_LIBTIFF) { "wxIMAGE_OPTION_BITSPERSAMPLE", _T("BitsPerSample") }, + #endif // (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxUSE_LIBTIFF) + + #if wxLUA_USE_wxImage && wxUSE_IMAGE + { "wxIMAGE_OPTION_BMP_FORMAT", wxIMAGE_OPTION_BMP_FORMAT }, + #endif // wxLUA_USE_wxImage && wxUSE_IMAGE + + #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxUSE_LIBTIFF) { "wxIMAGE_OPTION_COMPRESSION", _T("Compression") }, #endif // (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxUSE_LIBTIFF) Index: wxbase_file.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxbase_file.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxbase_file.cpp 13 Dec 2007 00:47:49 -0000 1.7 --- wxbase_file.cpp 18 Dec 2007 01:03:34 -0000 1.8 *************** *** 2014,2023 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); wxString ext; wxString name; wxString path; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 2); // call SplitPath wxFileName::SplitPath(fullpath, &path, &name, &ext, format); --- 2014,2023 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); wxString ext; wxString name; wxString path; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 1); // call SplitPath wxFileName::SplitPath(fullpath, &path, &name, &ext, format); *************** *** 2041,2045 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); wxString ext; wxString name; --- 2041,2045 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); wxString ext; wxString name; *************** *** 2047,2051 **** wxString volume; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 2); // call SplitPath wxFileName::SplitPath(fullpath, &volume, &path, &name, &ext, format); --- 2047,2051 ---- wxString volume; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 1); // call SplitPath wxFileName::SplitPath(fullpath, &volume, &path, &name, &ext, format); *************** *** 2070,2076 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 3 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); // const wxString fullpath ! const wxString fullpath = wxlua_getwxStringtype(L, 2); wxString volume; wxString path; --- 2070,2076 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); // const wxString fullpath ! const wxString fullpath = wxlua_getwxStringtype(L, 1); wxString volume; wxString path; *************** *** 2918,2922 **** // push the result number lua_pushnumber(L, returns); ! lua_pushlstring(L, (const char *) buffer, count); free(buffer); // return the number of parameters --- 2918,2922 ---- // push the result number lua_pushnumber(L, returns); ! lua_pushlstring(L, (const char *) buffer, returns); free(buffer); // return the number of parameters *************** *** 5696,5699 **** --- 5696,5749 ---- #if wxUSE_STREAMS // --------------------------------------------------------------------------- + // Bind class wxMemoryInputStream + // --------------------------------------------------------------------------- + + // Lua MetaTable Tag for Class 'wxMemoryInputStream' + int s_wxluatag_wxMemoryInputStream = -1; + + static wxLuaArgTag s_wxluatagArray_wxLua_wxMemoryInputStream_delete[] = { &s_wxluatag_wxMemoryInputStream, NULL }; + static wxLuaBindCFunc s_wxluafunc_wxLua_wxMemoryInputStream_delete[1] = {{ wxLua_wxluabind_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxMemoryInputStream_delete }}; + + static wxLuaArgTag s_wxluatagArray_wxLua_wxMemoryInputStream_constructor[] = { &s_wxluaarg_String, &s_wxluaarg_Number, NULL }; + static int LUACALL wxLua_wxMemoryInputStream_constructor(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxMemoryInputStream_constructor[1] = {{ wxLua_wxMemoryInputStream_constructor, WXLUAMETHOD_CONSTRUCTOR, 2, 2, s_wxluatagArray_wxLua_wxMemoryInputStream_constructor }}; + // %override wxLua_wxMemoryInputStream_constructor + // wxMemoryInputStream(const char *data, size_t length) + static int LUACALL wxLua_wxMemoryInputStream_constructor(lua_State *L) + { + wxluabind_removetableforcall(L); + // size_t length + size_t length = (size_t)wxlua_getnumbertype(L, 2); + // const char data + const char* data = (const char*)wxlua_getstringtype(L, 1); + // call constructor + wxMemoryInputStream* returns = new wxMemoryInputStream(data, length); + // add to tracked memory list + wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxMemoryInputStream((wxMemoryInputStream*)returns)); + // push the constructed class pointer + wxluaT_pushuserdatatype(L, s_wxluatag_wxMemoryInputStream, returns); + + return 1; + } + + + + + + // Map Lua Class Methods to C Binding Functions + wxLuaBindMethod wxMemoryInputStream_methods[] = { + { "delete", WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, s_wxluafunc_wxLua_wxMemoryInputStream_delete, 1, NULL }, + { "wxMemoryInputStream", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxMemoryInputStream_constructor, 1, NULL }, + + { 0, 0, 0, 0 }, + }; + + int wxMemoryInputStream_methodCount = sizeof(wxMemoryInputStream_methods)/sizeof(wxLuaBindMethod) - 1; + + #endif // wxUSE_STREAMS + + + #if wxUSE_STREAMS + // --------------------------------------------------------------------------- // Bind class wxDataInputStream // --------------------------------------------------------------------------- Index: wxcore_gdi.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_gdi.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxcore_gdi.cpp 13 Dec 2007 06:23:54 -0000 1.10 --- wxcore_gdi.cpp 18 Dec 2007 01:03:34 -0000 1.11 *************** *** 8071,8078 **** #if (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! #define wxLua_wxBitmap_constructor6 wxLua_wxBitmapFromData_constructor ! static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor6[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; ! static int LUACALL wxLua_wxBitmap_constructor6(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor6[1] = {{ wxLua_wxBitmap_constructor6, WXLUAMETHOD_CONSTRUCTOR, 4, 5, s_wxluatagArray_wxLua_wxBitmap_constructor6 }}; // %override wxLua_wxBitmapFromData_constructor // %win wxBitmap(void* data, int type, int width, int height, int depth = -1) --- 8071,8078 ---- #if (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! #define wxLua_wxBitmap_constructor7 wxLua_wxBitmapFromData_constructor ! static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor7[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; ! static int LUACALL wxLua_wxBitmap_constructor7(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor7[1] = {{ wxLua_wxBitmap_constructor7, WXLUAMETHOD_CONSTRUCTOR, 5, 5, s_wxluatagArray_wxLua_wxBitmap_constructor7 }}; // %override wxLua_wxBitmapFromData_constructor // %win wxBitmap(void* data, int type, int width, int height, int depth = -1) *************** *** 8108,8115 **** #endif // (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! #define wxLua_wxBitmap_constructor5 wxLua_wxBitmapFromXPMData_constructor ! static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor5[] = { &s_wxluaarg_Table, NULL }; ! static int LUACALL wxLua_wxBitmap_constructor5(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor5[1] = {{ wxLua_wxBitmap_constructor5, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxBitmap_constructor5 }}; // %override wxLua_wxBitmapFromXPMData_constructor // %constructor wxXmlResourceGetDefault() --- 8108,8115 ---- #endif // (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! #define wxLua_wxBitmap_constructor6 wxLua_wxBitmapFromXPMData_constructor ! static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor6[] = { &s_wxluaarg_Table, NULL }; ! static int LUACALL wxLua_wxBitmap_constructor6(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor6[1] = {{ wxLua_wxBitmap_constructor6, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxBitmap_constructor6 }}; // %override wxLua_wxBitmapFromXPMData_constructor // %constructor wxXmlResourceGetDefault() *************** *** 8138,8141 **** --- 8138,8172 ---- + #define wxLua_wxBitmap_constructor5 wxLua_wxBitmapFromBits_constructor + static wxLuaArgTag s_wxluatagArray_wxLua_wxBitmap_constructor5[] = { &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; + static int LUACALL wxLua_wxBitmap_constructor5(lua_State *L); + // static wxLuaBindCFunc s_wxluafunc_wxLua_wxBitmap_constructor5[1] = {{ wxLua_wxBitmap_constructor5, WXLUAMETHOD_CONSTRUCTOR, 4, 4, s_wxluatagArray_wxLua_wxBitmap_constructor5 }}; + // %override wxLua_wxBitmapFromBits_constructor + // %win wxBitmap(const char* bits, int width, int height, int depth = -1) + static int LUACALL wxLua_wxBitmapFromBits_constructor(lua_State *L) + { + wxluabind_removetableforcall(L); + + // get number of arguments + int argCount = lua_gettop(L); + // int depth = -1 + int depth = (argCount >= 4 ? (int)wxlua_getintegertype(L, 4) : -1); + // int height + int height = (int)wxlua_getintegertype(L, 3); + // int width + int width = (int)wxlua_getintegertype(L, 2); + // const char* bits + const char *bits = (const char *)lua_tostring(L, 1); + // call constructor + wxBitmap *returns = new wxBitmap(bits, width, height, depth); + // add to tracked memory list + wxluaO_addgcobject(L, returns); + // push the constructed class pointer + wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); + // return the number of parameters + return 1; + } + + #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxLUA_USE_wxBitmap) *************** *** 8259,8265 **** #if (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! { wxLua_wxBitmap_constructor6, WXLUAMETHOD_CONSTRUCTOR, 4, 5, s_wxluatagArray_wxLua_wxBitmap_constructor6 }, #endif // (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! { wxLua_wxBitmap_constructor5, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxBitmap_constructor5 }, #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxLUA_USE_wxBitmap) --- 8290,8297 ---- #if (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! { wxLua_wxBitmap_constructor7, WXLUAMETHOD_CONSTRUCTOR, 5, 5, s_wxluatagArray_wxLua_wxBitmap_constructor7 }, #endif // (wxLUA_USE_wxBitmap) && ((defined(__WXMSW__)) && (wxLUA_USE_wxBitmap)) ! { wxLua_wxBitmap_constructor6, WXLUAMETHOD_CONSTRUCTOR, 1, 1, s_wxluatagArray_wxLua_wxBitmap_constructor6 }, ! { wxLua_wxBitmap_constructor5, WXLUAMETHOD_CONSTRUCTOR, 4, 4, s_wxluatagArray_wxLua_wxBitmap_constructor5 }, #if (wxLUA_USE_wxImage && wxUSE_IMAGE) && (wxLUA_USE_wxBitmap) Index: wxcore_image.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_image.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wxcore_image.cpp 13 Dec 2007 06:23:54 -0000 1.9 --- wxcore_image.cpp 18 Dec 2007 01:03:34 -0000 1.10 *************** *** 393,396 **** --- 393,414 ---- } + static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_GetData[] = { &s_wxluatag_wxImage, NULL }; + static int LUACALL wxLua_wxImage_GetData(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_GetData[1] = {{ wxLua_wxImage_GetData, WXLUAMETHOD_METHOD, 1, 1, s_wxluatagArray_wxLua_wxImage_GetData }}; + // %override wxLua_wxImage_GetData + // unsigned char* GetData() const + static int LUACALL wxLua_wxImage_GetData(lua_State *L) + { + // get this + wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); + // call GetData + char* returns = (char*)self->GetData(); + // push the result pointer + lua_pushlstring(L, returns, self->GetWidth()*self->GetHeight()*3); + + return 1; + } + + static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_GetGreen[] = { &s_wxluatag_wxImage, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_GetGreen(lua_State *L); *************** *** 833,840 **** #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile2[] = { &s_wxluatag_wxImage, &s_wxluatag_wxInputStream, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile2(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile2[1] = {{ wxLua_wxImage_LoadFile2, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile2 }}; ! // bool LoadFile(wxInputStream& stream, long type, int index = -1) static int LUACALL wxLua_wxImage_LoadFile2(lua_State *L) { --- 851,882 ---- #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) + static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile3[] = { &s_wxluatag_wxImage, &s_wxluatag_wxInputStream, &s_wxluaarg_String, &s_wxluaarg_Number, NULL }; + static int LUACALL wxLua_wxImage_LoadFile3(lua_State *L); + // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile3[1] = {{ wxLua_wxImage_LoadFile3, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile3 }}; + // bool LoadFile(wxInputStream& stream, const wxString& mimetype, int index = -1) + static int LUACALL wxLua_wxImage_LoadFile3(lua_State *L) + { + // get number of arguments + int argCount = lua_gettop(L); + // int index = -1 + int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); + // const wxString mimetype + const wxString mimetype = wxlua_getwxStringtype(L, 3); + // wxInputStream stream + wxInputStream * stream = (wxInputStream *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxInputStream); + // get this + wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); + // call LoadFile + bool returns = (self->LoadFile(*stream, mimetype, index)); + // push the result flag + lua_pushboolean(L, returns); + + return 1; + } + static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile2[] = { &s_wxluatag_wxImage, &s_wxluatag_wxInputStream, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile2(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile2[1] = {{ wxLua_wxImage_LoadFile2, WXLUAMETHOD_METHOD, 2, 4, s_wxluatagArray_wxLua_wxImage_LoadFile2 }}; ! // bool LoadFile(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1) static int LUACALL wxLua_wxImage_LoadFile2(lua_State *L) { *************** *** 843,848 **** // int index = -1 int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); ! // long type ! long type = (long)wxlua_getnumbertype(L, 3); // wxInputStream stream wxInputStream * stream = (wxInputStream *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxInputStream); --- 885,890 ---- // int index = -1 int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); ! // long type = wxBITMAP_TYPE_ANY ! long type = (argCount >= 3 ? (long)wxlua_getnumbertype(L, 3) : wxBITMAP_TYPE_ANY); // wxInputStream stream wxInputStream * stream = (wxInputStream *)wxluaT_getuserdatatype(L, 2, s_wxluatag_wxInputStream); *************** *** 859,868 **** #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile1[] = { &s_wxluatag_wxImage, &s_wxluaarg_String, &s_wxluaarg_String, NULL }; static int LUACALL wxLua_wxImage_LoadFile1(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile1[1] = {{ wxLua_wxImage_LoadFile1, WXLUAMETHOD_METHOD, 3, 3, s_wxluatagArray_wxLua_wxImage_LoadFile1 }}; ! // bool LoadFile(const wxString& name, const wxString& mimetype) static int LUACALL wxLua_wxImage_LoadFile1(lua_State *L) { // const wxString mimetype const wxString mimetype = wxlua_getwxStringtype(L, 3); --- 901,914 ---- #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile1[] = { &s_wxluatag_wxImage, &s_wxluaarg_String, &s_wxluaarg_String, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile1(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile1[1] = {{ wxLua_wxImage_LoadFile1, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile1 }}; ! // bool LoadFile(const wxString& name, const wxString& mimetype, int index = -1) static int LUACALL wxLua_wxImage_LoadFile1(lua_State *L) { + // get number of arguments + int argCount = lua_gettop(L); + // int index = -1 + int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); // const wxString mimetype const wxString mimetype = wxlua_getwxStringtype(L, 3); *************** *** 872,876 **** wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); // call LoadFile ! bool returns = (self->LoadFile(name, mimetype)); // push the result flag lua_pushboolean(L, returns); --- 918,922 ---- wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); // call LoadFile ! bool returns = (self->LoadFile(name, mimetype, index)); // push the result flag lua_pushboolean(L, returns); *************** *** 879,890 **** } ! static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile[] = { &s_wxluatag_wxImage, &s_wxluaarg_String, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile[1] = {{ wxLua_wxImage_LoadFile, WXLUAMETHOD_METHOD, 2, 3, s_wxluatagArray_wxLua_wxImage_LoadFile }}; ! // bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_ANY) static int LUACALL wxLua_wxImage_LoadFile(lua_State *L) { // get number of arguments int argCount = lua_gettop(L); // long type = wxBITMAP_TYPE_ANY long type = (argCount >= 3 ? (long)wxlua_getnumbertype(L, 3) : wxBITMAP_TYPE_ANY); --- 925,938 ---- } ! static wxLuaArgTag s_wxluatagArray_wxLua_wxImage_LoadFile[] = { &s_wxluatag_wxImage, &s_wxluaarg_String, &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; static int LUACALL wxLua_wxImage_LoadFile(lua_State *L); ! // static wxLuaBindCFunc s_wxluafunc_wxLua_wxImage_LoadFile[1] = {{ wxLua_wxImage_LoadFile, WXLUAMETHOD_METHOD, 2, 4, s_wxluatagArray_wxLua_wxImage_LoadFile }}; ! // bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1) static int LUACALL wxLua_wxImage_LoadFile(lua_State *L) { // get number of arguments int argCount = lua_gettop(L); + // int index = -1 + int index = (argCount >= 4 ? (int)wxlua_getnumbertype(L, 4) : -1); // long type = wxBITMAP_TYPE_ANY long type = (argCount >= 3 ? (long)wxlua_getnumbertype(L, 3) : wxBITMAP_TYPE_ANY); *************** *** 894,898 **** wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); // call LoadFile ! bool returns = (self->LoadFile(name, type)); // push the result flag lua_pushboolean(L, returns); --- 942,946 ---- wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); // call LoadFile ! bool returns = (self->LoadFile(name, type, index)); // push the result flag lua_pushboolean(L, returns); *************** *** 1800,1807 **** #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile2, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile2 }, #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile1, WXLUAMETHOD_METHOD, 3, 3, s_wxluatagArray_wxLua_wxImage_LoadFile1 }, ! { wxLua_wxImage_LoadFile, WXLUAMETHOD_METHOD, 2, 3, s_wxluatagArray_wxLua_wxImage_LoadFile }, }; static int s_wxluafunc_wxLua_wxImage_LoadFile_overload_count = sizeof(s_wxluafunc_wxLua_wxImage_LoadFile_overload)/sizeof(wxLuaBindCFunc); --- 1848,1859 ---- #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile3, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile3 }, #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! ! #if (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile2, WXLUAMETHOD_METHOD, 2, 4, s_wxluatagArray_wxLua_wxImage_LoadFile2 }, ! #endif // (wxUSE_STREAMS) && (wxLUA_USE_wxImage && wxUSE_IMAGE) ! { wxLua_wxImage_LoadFile1, WXLUAMETHOD_METHOD, 3, 4, s_wxluatagArray_wxLua_wxImage_LoadFile1 }, ! { wxLua_wxImage_LoadFile, WXLUAMETHOD_METHOD, 2, 4, s_wxluatagArray_wxLua_wxImage_LoadFile }, }; static int s_wxluafunc_wxLua_wxImage_LoadFile_overload_count = sizeof(s_wxluafunc_wxLua_wxImage_LoadFile_overload)/sizeof(wxLuaBindCFunc); *************** *** 1998,2001 **** --- 2050,2054 ---- { "GetAlpha", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxImage_GetAlpha, 1, NULL }, { "GetBlue", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxImage_GetBlue, 1, NULL }, + { "GetData", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxImage_GetData, 1, NULL }, { "GetGreen", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxImage_GetGreen, 1, NULL }, |
From: John L. <jr...@us...> - 2007-12-18 01:03:40
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19598/wxLua/modules/wxlua/include Modified Files: wxldefs.h wxlstate.h Log Message: Cleanup: lua to Lua Fix various binding errors, wrong params for static wxFile functions Bump version to 2.8.7 Add wxImage::GetData(), wxMemoryInputStream Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** wxldefs.h 7 Dec 2007 02:13:14 -0000 1.37 --- wxldefs.h 18 Dec 2007 01:03:34 -0000 1.38 *************** *** 38,44 **** #define wxLUA_MAJOR_VERSION 2 #define wxLUA_MINOR_VERSION 8 ! #define wxLUA_RELEASE_NUMBER 6 #define wxLUA_SUBRELEASE_NUMBER 0 ! #define wxLUA_VERSION_STRING wxT("wxLua 2.8.6.0") // For non-Unix systems (i.e. when building without a configure script), --- 38,44 ---- #define wxLUA_MAJOR_VERSION 2 #define wxLUA_MINOR_VERSION 8 ! #define wxLUA_RELEASE_NUMBER 7 #define wxLUA_SUBRELEASE_NUMBER 0 ! #define wxLUA_VERSION_STRING wxT("wxLua 2.8.7.0") // For non-Unix systems (i.e. when building without a configure script), Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** wxlstate.h 15 Dec 2007 16:56:41 -0000 1.107 --- wxlstate.h 18 Dec 2007 01:03:34 -0000 1.108 *************** *** 194,198 **** // Push the errorMsg on the stack and call luaL_error WXDLLIMPEXP_WXLUA void LUACALL wxlua_error(lua_State* L, const char* errorMsg); ! wxLUA_UNICODE_ONLY(WXDLLIMPEXP_WXLUA void LUACALL wxlua_error(lua_State* L, const wxString& errorMsg) { wxlua_error(L, wx2lua(errorMsg)); }) // Get the userdata at the stack index, if null_ptr then set the pointer wrapped --- 194,198 ---- // Push the errorMsg on the stack and call luaL_error WXDLLIMPEXP_WXLUA void LUACALL wxlua_error(lua_State* L, const char* errorMsg); ! wxLUA_UNICODE_ONLY(WXDLLIMPEXP_WXLUA inline void LUACALL wxlua_error(lua_State* L, const wxString& errorMsg) { wxlua_error(L, wx2lua(errorMsg)); }) // Get the userdata at the stack index, if null_ptr then set the pointer wrapped |
From: John L. <jr...@us...> - 2007-12-18 01:03:39
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19598/wxLua/modules/wxbind/include Modified Files: wxbase_bind.h Log Message: Cleanup: lua to Lua Fix various binding errors, wrong params for static wxFile functions Bump version to 2.8.7 Add wxImage::GetData(), wxMemoryInputStream Index: wxbase_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxbase_bind.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxbase_bind.h 10 Dec 2007 05:39:06 -0000 1.7 --- wxbase_bind.h 18 Dec 2007 01:03:33 -0000 1.8 *************** *** 148,151 **** --- 148,152 ---- #if wxUSE_STREAMS #include "wx/datstrm.h" + #include "wx/mstream.h" #include "wx/stream.h" #include "wx/txtstrm.h" *************** *** 425,428 **** --- 426,432 ---- extern WXDLLIMPEXP_BINDWXBASE wxLuaBindMethod wxInputStream_methods[]; extern WXDLLIMPEXP_DATA_BINDWXBASE(int) wxInputStream_methodCount; + extern WXDLLIMPEXP_DATA_BINDWXBASE(int) s_wxluatag_wxMemoryInputStream; + extern WXDLLIMPEXP_BINDWXBASE wxLuaBindMethod wxMemoryInputStream_methods[]; + extern WXDLLIMPEXP_DATA_BINDWXBASE(int) wxMemoryInputStream_methodCount; extern WXDLLIMPEXP_DATA_BINDWXBASE(int) s_wxluatag_wxOutputStream; extern WXDLLIMPEXP_BINDWXBASE wxLuaBindMethod wxOutputStream_methods[]; *************** *** 540,543 **** --- 544,548 ---- wxLUA_DECLARE_ENCAPSULATION(WXDLLIMPEXP_BINDWXBASE, wxFileInputStream, wxFileInputStream) wxLUA_DECLARE_ENCAPSULATION(WXDLLIMPEXP_BINDWXBASE, wxFileOutputStream, wxFileOutputStream) + wxLUA_DECLARE_ENCAPSULATION(WXDLLIMPEXP_BINDWXBASE, wxMemoryInputStream, wxMemoryInputStream) #endif // wxUSE_STREAMS |
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19598/wxLua/bindings/wxwidgets Modified Files: wx_datatypes.lua wxaui_aui.i wxbase_base.i wxbase_config.i wxbase_data.i wxbase_datetime.i wxbase_file.i wxbase_override.hpp wxclassref.txt wxcore_appframe.i wxcore_clipdrag.i wxcore_controls.i wxcore_core.i wxcore_defsutils.i wxcore_dialogs.i wxcore_event.i wxcore_gdi.i wxcore_image.i wxcore_menutool.i wxcore_override.hpp wxcore_print.i wxcore_windows.i wxhtml_html.i wxnet_net.i wxstc_override.hpp wxstc_stc.i wxxml_xml.i Log Message: Cleanup: lua to Lua Fix various binding errors, wrong params for static wxFile functions Bump version to 2.8.7 Add wxImage::GetData(), wxMemoryInputStream Index: wxcore_event.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_event.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxcore_event.i 16 Jul 2007 19:34:25 -0000 1.1 --- wxcore_event.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 18,27 **** void AddPendingEvent(wxEvent& event) ! // NOTE: Connect used to be called ConnectEvent which is not the name of any C++ function. ! // %override wxEvtHandler::Connect(int id, int lastId, wxEventType eventType, lua function) ! // %override wxEvtHandler::Connect(int id, wxEventType eventType, lua function) ! // %override wxEvtHandler::Connect(wxEventType eventType, lua function) // The function type above is determined at runtime depending on the inputs. // Note: wxLua uses the userdata and the event sink and so they're not available void Connect(int id, int lastId, wxEventType eventType, LuaFunction func) --- 18,28 ---- void AddPendingEvent(wxEvent& event) ! // NOTE: Connect used to be called ConnectEvent in wxLua which is not the name of any C++ function. ! // %override wxEvtHandler::Connect(int id, int lastId, wxEventType eventType, Lua function) ! // %override wxEvtHandler::Connect(int id, wxEventType eventType, Lua function) ! // %override wxEvtHandler::Connect(wxEventType eventType, Lua function) // The function type above is determined at runtime depending on the inputs. + // C++ Func: void Connect(int id, int lastId, wxEventType eventType, wxObjectEventFunction function, wxObject* userData = NULL, wxEvtHandler* eventSink = NULL) // Note: wxLua uses the userdata and the event sink and so they're not available void Connect(int id, int lastId, wxEventType eventType, LuaFunction func) *************** *** 31,34 **** --- 32,37 ---- // %override bool Disconnect(wxEventType eventType) // The function type above is determined at runtime depending on the inputs. + // C++ Func: bool Disconnect(int id, int lastId = wxID_ANY, wxEventType eventType = wxEVT_NULL, wxObjectEventFunction function = NULL, wxObject* userData = NULL, wxEvtHandler* eventSink = NULL) + // Note: wxLua uses the userdata and the event sink and so they're not available bool Disconnect(int id, int lastId, wxEventType eventType) *************** *** 82,86 **** %class %delete %noclassinfo %encapsulate wxPropagationDisabler ! // NOTE: ALWAYS delete() this when done since lua's gc may not delete it soon enough wxPropagationDisabler(wxEvent& event) --- 85,89 ---- %class %delete %noclassinfo %encapsulate wxPropagationDisabler ! // NOTE: ALWAYS delete() this when done since Lua's gc may not delete it soon enough wxPropagationDisabler(wxEvent& event) *************** *** 93,97 **** %class %delete %noclassinfo %encapsulate wxPropagateOnce ! // NOTE: ALWAYS delete() this when done since lua's gc may not delete it soon enough wxPropagateOnce(wxEvent& event) --- 96,100 ---- %class %delete %noclassinfo %encapsulate wxPropagateOnce ! // NOTE: ALWAYS delete() this when done since Lua's gc may not delete it soon enough wxPropagateOnce(wxEvent& event) Index: wxcore_gdi.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_gdi.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxcore_gdi.i 16 Jul 2007 19:34:25 -0000 1.1 --- wxcore_gdi.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 23,27 **** wxPoint(const wxPoint& pt) ! // %override [int, x, int y] wxPoint::GetXY() // wxLua added function int GetXY() const --- 23,27 ---- wxPoint(const wxPoint& pt) ! // %override [int x, int y] wxPoint::GetXY() // wxLua added function int GetXY() const *************** *** 490,494 **** static wxFontMapper *Get() ! // %override [bool, wxFontEncoding *altEncoding] GetAltForEncoding(wxFontEncoding encoding, const wxString &faceName = "", bool interactive = true) // C++ Func: bool GetAltForEncoding(wxFontEncoding encoding, wxFontEncoding *altEncoding, const wxString &faceName = "", bool interactive = true) bool GetAltForEncoding(wxFontEncoding encoding, const wxString &faceName = "", bool interactive = true) --- 490,494 ---- static wxFontMapper *Get() ! // %override [bool, wxFontEncoding *altEncoding] wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, const wxString &faceName = "", bool interactive = true) // C++ Func: bool GetAltForEncoding(wxFontEncoding encoding, wxFontEncoding *altEncoding, const wxString &faceName = "", bool interactive = true) bool GetAltForEncoding(wxFontEncoding encoding, const wxString &faceName = "", bool interactive = true) *************** *** 809,813 **** wxPalette(const wxPalette& palette) ! // %override bool wxPalette::Create(int n, lua string red, lua string green, lua string blue) // C++ Func: bool Create(int n, const unsigned char* red, const unsigned char* green, const unsigned char* blue) bool Create(int n, const unsigned char* red, const unsigned char* green, const unsigned char* blue) --- 809,813 ---- wxPalette(const wxPalette& palette) ! // %override bool wxPalette::Create(int n, Lua string red, Lua string green, Lua string blue) // C++ Func: bool Create(int n, const unsigned char* red, const unsigned char* green, const unsigned char* blue) bool Create(int n, const unsigned char* red, const unsigned char* green, const unsigned char* blue) *************** *** 896,906 **** wxBitmap(const wxImage &image, int depth = -1) // %override wxBitmap(LuaTable stringTable where each index is a row in the image) // C++ Func: wxBitmap(const char **data) Load from XPM %override_name wxLua_wxBitmapFromXPMData_constructor wxBitmap(LuaTable charTable) ! // %override wxBitmap(lua string of data, int type, int width, int height, int depth = -1) // C++ Func: wxBitmap(const void* data, int type, int width, int height, int depth = -1) ! %override_name wxLua_wxBitmapFromData_constructor %win wxBitmap(const wxString& data, int type, int width, int height, int depth = -1) //%win static void AddHandler(wxBitmapHandler* handler) --- 896,910 ---- wxBitmap(const wxImage &image, int depth = -1) + // C++ Func: wxBitmap(const char bits[], int width, int height, int depth = 1) + // Creates a bitmap from an array of bits in the form of a Lua string. + %override_name wxLua_wxBitmapFromBits_constructor wxBitmap(const char* mono_bits, int width, int height, int depth /* = 1 */); + // %override wxBitmap(LuaTable stringTable where each index is a row in the image) // C++ Func: wxBitmap(const char **data) Load from XPM %override_name wxLua_wxBitmapFromXPMData_constructor wxBitmap(LuaTable charTable) ! // %override wxBitmap(Lua string of data, int type, int width, int height, int depth = -1) // C++ Func: wxBitmap(const void* data, int type, int width, int height, int depth = -1) ! %override_name wxLua_wxBitmapFromData_constructor %win wxBitmap(const wxString& data, int type, int width, int height, int depth /* = -1 */) //%win static void AddHandler(wxBitmapHandler* handler) *************** *** 1440,1444 **** %class %delete %noclassinfo %encapsulate wxCaretSuspend ! // NOTE: ALWAYS delete() this when done since lua's gc may not delete it soon enough wxCaretSuspend(wxWindow *win = NULL) %endclass --- 1444,1448 ---- %class %delete %noclassinfo %encapsulate wxCaretSuspend ! // NOTE: ALWAYS delete() this when done since Lua's gc may not delete it soon enough wxCaretSuspend(wxWindow *win = NULL) %endclass Index: wxbase_file.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_file.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxbase_file.i 10 Dec 2007 05:39:05 -0000 1.2 --- wxbase_file.i 18 Dec 2007 01:03:32 -0000 1.3 *************** *** 16,20 **** %function bool wxFileExists(const wxString& filename) ! // %override [new lua string] wxDos2UnixFilename(lua string) // C++ Func: void wxDos2UnixFilename(wxChar *s) %function wxString wxDos2UnixFilename(const wxString& s) --- 16,20 ---- %function bool wxFileExists(const wxString& filename) ! // %override [new Lua string] wxDos2UnixFilename(Lua string) // C++ Func: void wxDos2UnixFilename(wxChar *s) %function wxString wxDos2UnixFilename(const wxString& s) *************** *** 30,34 **** %function bool wxIsAbsolutePath(const wxString& filename) %function wxString wxPathOnly(const wxString& path) ! // %override [new lua string] wxUnix2DosFilename(lua string) // C++ Func: void wxUnix2DosFilename(wxChar *s) %function wxString wxUnix2DosFilename(const wxString& s) --- 30,34 ---- %function bool wxIsAbsolutePath(const wxString& filename) %function wxString wxPathOnly(const wxString& path) ! // %override [new Lua string] wxUnix2DosFilename(Lua string) // C++ Func: void wxUnix2DosFilename(wxChar *s) %function wxString wxUnix2DosFilename(const wxString& s) *************** *** 222,226 **** int GetDirCount() const ! // %override [lua string table] wxFileName::GetDirs() // C++ Func: const wxArrayString& GetDirs() const const wxArrayString& GetDirs() const --- 222,226 ---- int GetDirCount() const ! // %override [Lua string table] wxFileName::GetDirs() // C++ Func: const wxArrayString& GetDirs() const const wxArrayString& GetDirs() const *************** *** 385,390 **** bool Open(const wxString& filename, wxFile::OpenMode mode = wxFile::read) ! // %override [size_t count, lua string] wxFile::Read(unsigned int count) ! // C++ Func: size_t Read(void* buffer, unsigned int count) size_t Read(unsigned int count) --- 385,390 ---- bool Open(const wxString& filename, wxFile::OpenMode mode = wxFile::read) ! // %override [size_t count, Lua string] wxFile::Read(unsigned int count) ! // C++ Func: size_t Read(void* buffer, unsigned int count) size_t Read(unsigned int count) *************** *** 393,397 **** wxFileOffset Tell() const ! // %override size_t wxFile::Write(lua string, unsigned int count) // C++ Func: size_t Write(const void* buffer, unsigned int count) size_t Write(const wxString& buffer, unsigned int count) --- 393,397 ---- wxFileOffset Tell() const ! // %override size_t wxFile::Write(Lua string, unsigned int count) // C++ Func: size_t Write(const void* buffer, unsigned int count) size_t Write(const wxString& buffer, unsigned int count) *************** *** 454,458 **** static bool Exists(const wxString& dir) ! // %override [unsigned int, lua string table] wxDir::GetAllFiles(const wxString& dirname, const wxString& filespec = "", int flags = wxDIR_DEFAULT) // C++ Func: static unsigned int GetAllFiles(const wxString& dirname, wxArrayString *files, const wxString& filespec = "", int flags = wxDIR_DEFAULT) static unsigned int GetAllFiles(const wxString& dirname, const wxString& filespec = "", int flags = wxDIR_DEFAULT) --- 454,458 ---- static bool Exists(const wxString& dir) ! // %override [unsigned int, Lua string table] wxDir::GetAllFiles(const wxString& dirname, const wxString& filespec = "", int flags = wxDIR_DEFAULT) // C++ Func: static unsigned int GetAllFiles(const wxString& dirname, wxArrayString *files, const wxString& filespec = "", int flags = wxDIR_DEFAULT) static unsigned int GetAllFiles(const wxString& dirname, const wxString& filespec = "", int flags = wxDIR_DEFAULT) *************** *** 571,575 **** // get a brief file type description ("*.txt" => "text document") ! // %override [bool lua string] GetDescription() const; // C++ Func: bool GetDescription(wxString *desc) const bool GetDescription() const --- 571,575 ---- // get a brief file type description ("*.txt" => "text document") ! // %override [bool Lua string] wxFileType::GetDescription() const; // C++ Func: bool GetDescription(wxString *desc) const bool GetDescription() const *************** *** 582,586 **** // get the command to print the file of given type ! // %override [bool lua string] GetPrintCommand(const wxFileType::MessageParameters& params) const; // C++ Func: bool GetPrintCommand(wxString *printCmd, const wxFileType::MessageParameters& params) const; bool GetPrintCommand(const wxFileType::MessageParameters& params) const; --- 582,586 ---- // get the command to print the file of given type ! // %override [bool Lua string] wxFileType::GetPrintCommand(const wxFileType::MessageParameters& params) const; // C++ Func: bool GetPrintCommand(wxString *printCmd, const wxFileType::MessageParameters& params) const; bool GetPrintCommand(const wxFileType::MessageParameters& params) const; *************** *** 708,712 **** char Peek() ! // %override [lua string] wxInputStream::Read(size_t size) // C++ Func: wxInputStream& Read(void *buffer, size_t size) wxString Read(size_t size) --- 708,712 ---- char Peek() ! // %override [Lua string] wxInputStream::Read(size_t size) // C++ Func: wxInputStream& Read(void *buffer, size_t size) wxString Read(size_t size) *************** *** 716,720 **** wxFileOffset TellI() const ! // %override size_t wxInputStream::Ungetch(lua string, size_t size) // C++ Func: size_t Ungetch(const char* buffer, size_t size) %override_name wxLua_wxInputStream_UngetchString size_t Ungetch(const wxString& str, size_t size) --- 716,720 ---- wxFileOffset TellI() const ! // %override size_t wxInputStream::Ungetch(Lua string, size_t size) // C++ Func: size_t Ungetch(const char* buffer, size_t size) %override_name wxLua_wxInputStream_UngetchString size_t Ungetch(const wxString& str, size_t size) *************** *** 735,739 **** wxFileOffset TellO() const ! // %override wxOutputStream& wxOutputStream::Write(lua string, size_t size) // C++ Func: wxOutputStream& Write(const void *buffer, size_t size) wxOutputStream& Write(const wxString& buffer, size_t size) --- 735,739 ---- wxFileOffset TellO() const ! // %override wxOutputStream& wxOutputStream::Write(Lua string, size_t size) // C++ Func: wxOutputStream& Write(const void *buffer, size_t size) wxOutputStream& Write(const wxString& buffer, size_t size) *************** *** 767,770 **** --- 767,791 ---- // --------------------------------------------------------------------------- + // wxMemoryInputStream + + %include "wx/mstream.h" + + %class %delete %noclassinfo %encapsulate wxMemoryInputStream, wxInputStream + wxMemoryInputStream(const char *data, size_t length) + //wxMemoryInputStream(const wxMemoryOutputStream& stream) + + %endclass + + // --------------------------------------------------------------------------- + // wxMemoryOutputStream + + //%include "wx/mstream.h" + + //%class %delete %noclassinfo %encapsulate wxMemoryInputStream, wxInputStream + // wxMemoryOutputStream(void *data, size_t length) + // wxMemoryInputStream(const wxMemoryOutputStream& stream) + //%endclass + + // --------------------------------------------------------------------------- // wxDataInputStream *************** *** 854,856 **** --- 875,878 ---- %endclass + %endif // wxUSE_STREAMS Index: wxcore_core.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_core.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxcore_core.i 16 Jul 2007 19:34:24 -0000 1.1 --- wxcore_core.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 252,256 **** %class %delete wxGenericValidator, wxValidator ! // See the validator.wx.lua sample for usage of this class // %override wxGenericValidatorBool(wxLuaObject* boolObj) --- 252,256 ---- %class %delete wxGenericValidator, wxValidator ! // See the validator.wx.Lua sample for usage of this class // %override wxGenericValidatorBool(wxLuaObject* boolObj) Index: wxxml_xml.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxxml_xml.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxxml_xml.i 22 Aug 2007 20:17:09 -0000 1.2 --- wxxml_xml.i 18 Dec 2007 01:03:32 -0000 1.3 *************** *** 42,46 **** void InsertChild(%ungc wxXmlNode *child, wxXmlNode *before_node) ! // %override bool RemoveChild(%gc wxXmlNode *child) // C++ Func: No change: only if child is removed will we garbage collect it bool RemoveChild(%gc wxXmlNode *child) --- 42,46 ---- void InsertChild(%ungc wxXmlNode *child, wxXmlNode *before_node) ! // %override bool wxXmlNode::RemoveChild(%gc wxXmlNode *child) // C++ Func: No change: only if child is removed will we garbage collect it bool RemoveChild(%gc wxXmlNode *child) Index: wxcore_menutool.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_menutool.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxcore_menutool.i 10 Dec 2007 05:39:05 -0000 1.2 --- wxcore_menutool.i 18 Dec 2007 01:03:32 -0000 1.3 *************** *** 31,35 **** // %override wxMenu* wxMenu({{wx.wxID_NEW, "&New\tCtrl-N", "New doc", [wx.wxITEM_NORMAL]}, {}, {item 2}}, const wxString& title = "", long style = "") - empty tables are separators // wxLua provides this function ! %override_name wxLua_wxCreateMenu_constructor wxMenu(LuaTable luatable, const wxString& title = "", long style = 0) wxMenuItem* Append(int id, const wxString& item, const wxString& helpString = "", wxItemKind kind = wxITEM_NORMAL) --- 31,35 ---- // %override wxMenu* wxMenu({{wx.wxID_NEW, "&New\tCtrl-N", "New doc", [wx.wxITEM_NORMAL]}, {}, {item 2}}, const wxString& title = "", long style = "") - empty tables are separators // wxLua provides this function ! %override_name wxLua_wxCreateMenu_constructor wxMenu(LuaTable, const wxString& title = "", long style = 0) wxMenuItem* Append(int id, const wxString& item, const wxString& helpString = "", wxItemKind kind = wxITEM_NORMAL) *************** *** 350,354 **** %define_object wxNullAcceleratorTable ! // %override wxAcceleratorTable(lua table with this format) // { { wx.wxACCEL_NORMAL, string.byte('0'), ID_0 }, // { wx.wxACCEL_NORMAL, wx.VXK_NUMPAD0, ID_0 } } --- 350,354 ---- %define_object wxNullAcceleratorTable ! // %override wxAcceleratorTable(Lua table with this format) // { { wx.wxACCEL_NORMAL, string.byte('0'), ID_0 }, // { wx.wxACCEL_NORMAL, wx.VXK_NUMPAD0, ID_0 } } Index: wxbase_datetime.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_datetime.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxbase_datetime.i 16 Jul 2007 19:34:23 -0000 1.1 --- wxbase_datetime.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 138,142 **** wxDateTime() ! wxDateTime(time_t dateTime) // use with lua's os.time() on MSW, Linux, others? %rename wxDateTimeFromJDN wxDateTime(double dateTime) %rename wxDateTimeFromHMS wxDateTime(int hour, int minute, int second, int millisec) --- 138,142 ---- wxDateTime() ! wxDateTime(time_t dateTime) // use with Lua's os.time() on MSW, Linux, others? %rename wxDateTimeFromJDN wxDateTime(double dateTime) %rename wxDateTimeFromHMS wxDateTime(int hour, int minute, int second, int millisec) *************** *** 144,148 **** wxDateTime& SetToCurrent() ! wxDateTime& Set(time_t time) // use with lua's os.time() on MSW, Linux, others? %rename SetToJDN wxDateTime& Set(double dateTime) %rename SetToHMS wxDateTime& Set(int hour, int minute, int second, int millisec) --- 144,148 ---- wxDateTime& SetToCurrent() ! wxDateTime& Set(time_t time) // use with Lua's os.time() on MSW, Linux, others? %rename SetToJDN wxDateTime& Set(double dateTime) %rename SetToHMS wxDateTime& Set(int hour, int minute, int second, int millisec) Index: wxcore_defsutils.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_defsutils.i,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxcore_defsutils.i 7 Aug 2007 20:23:25 -0000 1.3 --- wxcore_defsutils.i 18 Dec 2007 01:03:32 -0000 1.4 *************** *** 103,109 **** !%wxchkver_2_6 %function long wxExecute(const wxString& command, bool sync = false, wxProcess *callback = NULL) %wxchkver_2_6 %function long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, wxProcess *process = NULL) ! // %override [long, lua table of output strings] wxExecuteStdout(const wxString& command, int flags = 0) %function %rename wxExecuteStdout long wxExecute(const wxString& command, wxArrayString& output, int flags = 0) ! // %override [long, lua table of output strings, lua table of error strings] wxExecuteStdoutStderr(const wxString& command, int flags = 0) %function %rename wxExecuteStdoutStderr long wxExecute(const wxString& command, wxArrayString& output, wxArrayString& errors, int flags = 0) %function void wxExit() --- 103,109 ---- !%wxchkver_2_6 %function long wxExecute(const wxString& command, bool sync = false, wxProcess *callback = NULL) %wxchkver_2_6 %function long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, wxProcess *process = NULL) ! // %override [long, Lua table of output strings] wxExecuteStdout(const wxString& command, int flags = 0) %function %rename wxExecuteStdout long wxExecute(const wxString& command, wxArrayString& output, int flags = 0) ! // %override [long, Lua table of output strings, Lua table of error strings] wxExecuteStdoutStderr(const wxString& command, int flags = 0) %function %rename wxExecuteStdoutStderr long wxExecute(const wxString& command, wxArrayString& output, wxArrayString& errors, int flags = 0) %function void wxExit() *************** *** 497,511 **** %class %delete %noclassinfo %encapsulate wxBusyCursor ! // NOTE: ALWAYS delete() this when done since lua's gc may not delete it soon enough wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR) %endclass // --------------------------------------------------------------------------- ! // wxBusyCursorSuspender - we don't wrap this since lua's garbage collector doesn't // automatically collect items when they go out of scope so you would have to // delete() this anyway which is just as easy as wxBegin/EndBusyCursor //%class %delete %noclassinfo %encapsulate wxBusyCursorSuspender ! // NOTE: ALWAYS delete() this when done since lua's gc may not delete it soon enough // wxBusyCursorSuspender() --- 497,511 ---- %class %delete %noclassinfo %encapsulate wxBusyCursor ! // NOTE: ALWAYS delete() this when done since Lua's gc may not delete it soon enough wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR) %endclass // --------------------------------------------------------------------------- ! // wxBusyCursorSuspender - we don't wrap this since Lua's garbage collector doesn't // automatically collect items when they go out of scope so you would have to // delete() this anyway which is just as easy as wxBegin/EndBusyCursor //%class %delete %noclassinfo %encapsulate wxBusyCursorSuspender ! // NOTE: ALWAYS delete() this when done since Lua's gc may not delete it soon enough // wxBusyCursorSuspender() *************** *** 522,526 **** %class %delete %noclassinfo wxBusyInfo, wxObject ! // NOTE: ALWAYS delete() this when done since lua's gc may not delete it soon enough wxBusyInfo(const wxString& message, wxWindow *parent = NULL) %endclass --- 522,526 ---- %class %delete %noclassinfo wxBusyInfo, wxObject ! // NOTE: ALWAYS delete() this when done since Lua's gc may not delete it soon enough wxBusyInfo(const wxString& message, wxWindow *parent = NULL) %endclass Index: wx_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wx_datatypes.lua,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** wx_datatypes.lua 10 Dec 2007 05:39:05 -0000 1.89 --- wx_datatypes.lua 18 Dec 2007 01:03:32 -0000 1.90 *************** *** 2664,2667 **** --- 2664,2675 ---- ValueType = "class", }, + wxMemoryInputStream = { + ["%encapsulate"] = true, + BaseClass = "wxInputStream", + Condition = "wxUSE_STREAMS", + IsNumber = false, + Name = "wxMemoryInputStream", + ValueType = "class", + }, wxMemorySize = { IsNumber = true, Index: wxcore_appframe.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_appframe.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxcore_appframe.i 10 Dec 2007 05:39:05 -0000 1.2 --- wxcore_appframe.i 18 Dec 2007 01:03:32 -0000 1.3 *************** *** 23,27 **** // wxApp() NO CONSTRUCTOR! the wxApp is created in C++, use wxGetApp() ! // These two are pushed into lua by C++ at startup as table arg = { argv } // int wxApp::argc // wxChar** wxApp::argv --- 23,27 ---- // wxApp() NO CONSTRUCTOR! the wxApp is created in C++, use wxGetApp() ! // These two are pushed into Lua by C++ at startup as table arg = { argv } // int wxApp::argc // wxChar** wxApp::argv *************** *** 40,46 **** wxString GetVendorName() const bool IsActive() const ! // static bool IsMainLoopRunning() // bool Initialized() obsolete in wxWidgets int MainLoop() // virtual int OnExit() nothing we can do here // virtual bool OnInit() nothing we can do here --- 40,50 ---- wxString GetVendorName() const bool IsActive() const ! static bool IsMainLoopRunning() // bool Initialized() obsolete in wxWidgets + + // %override int wxApp::MainLoop() Only calls it if !IsMainLoopRunning(), returns 0 if it already is + // C++ Func: int MainLoop() int MainLoop() + // virtual int OnExit() nothing we can do here // virtual bool OnInit() nothing we can do here *************** *** 162,166 **** virtual void SetStatusText(const wxString& text, int number = 0) ! // void wxFrame::SetStatusWidths(lua table with number indexes and values) // C++ Func: virtual void SetStatusWidths(int n, int *widths) virtual void SetStatusWidths(IntArray_FromLuaTable intTable) --- 166,170 ---- virtual void SetStatusText(const wxString& text, int number = 0) ! // void wxFrame::SetStatusWidths(Lua table with number indexes and values) // C++ Func: virtual void SetStatusWidths(int n, int *widths) virtual void SetStatusWidths(IntArray_FromLuaTable intTable) *************** *** 212,216 **** void PushStatusText(const wxString& string, int field = 0) ! // %override void wxStatusBar::SetFieldsCount(either a single number or a lua table with number indexes and values) // C++ Func: virtual void SetFieldsCount(int number = 1, int* widths = NULL) virtual void SetFieldsCount(LuaTable intTable) --- 216,220 ---- void PushStatusText(const wxString& string, int field = 0) ! // %override void wxStatusBar::SetFieldsCount(either a single number or a Lua table with number indexes and values) // C++ Func: virtual void SetFieldsCount(int number = 1, int* widths = NULL) virtual void SetFieldsCount(LuaTable intTable) *************** *** 219,227 **** virtual void SetStatusText(const wxString& text, int i = 0) ! // void wxStatusBar::SetStatusWidths(lua table with number indexes and values) // C++ Func: virtual void SetStatusWidths(int n, int *widths) virtual void SetStatusWidths(IntArray_FromLuaTable intTable) ! // void wxStatusBar::SetStatusStyles(lua table with number indexes and values) // C++ Func: virtual void SetStatusStyles(int n, int *styles) virtual void SetStatusStyles(IntArray_FromLuaTable intTable) --- 223,231 ---- virtual void SetStatusText(const wxString& text, int i = 0) ! // void wxStatusBar::SetStatusWidths(Lua table with number indexes and values) // C++ Func: virtual void SetStatusWidths(int n, int *widths) virtual void SetStatusWidths(IntArray_FromLuaTable intTable) ! // void wxStatusBar::SetStatusStyles(Lua table with number indexes and values) // C++ Func: virtual void SetStatusStyles(int n, int *styles) virtual void SetStatusStyles(IntArray_FromLuaTable intTable) Index: wxstc_stc.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxstc_stc.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxstc_stc.i 16 Jul 2007 19:34:26 -0000 1.1 --- wxstc_stc.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 1800,1804 **** // wxString GetCurLine(int* OUTPUT); //#else ! // %override [int linePos] GetCurLine() // C++ Func: wxString GetCurLine(int* linePos=NULL); wxString GetCurLine(); --- 1800,1804 ---- // wxString GetCurLine(int* OUTPUT); //#else ! // %override [int linePos] wxStyledTextCtrl::GetCurLine() // C++ Func: wxString GetCurLine(int* linePos=NULL); wxString GetCurLine(); *************** *** 1955,1959 **** // Set the styles for a segment of the document. ! // %override [lua string styleBytes] SetStyleBytes(int length, lua string styleBytes) // C++ Func: void SetStyleBytes(int length, char* styleBytes); void SetStyleBytes(int length, char* styleBytes); --- 1955,1959 ---- // Set the styles for a segment of the document. ! // %override [Lua string styleBytes] wxStyledTextCtrl::SetStyleBytes(int length, Lua string styleBytes) // C++ Func: void SetStyleBytes(int length, char* styleBytes); void SetStyleBytes(int length, char* styleBytes); *************** *** 3100,3104 **** // void GetSelection(int* OUTPUT, int* OUTPUT); //#else ! // %override [int startPos, int endPos] GetSelection() // C++ Func: void GetSelection(int* startPos, int* endPos); void GetSelection(); --- 3100,3104 ---- // void GetSelection(int* OUTPUT, int* OUTPUT); //#else ! // %override [int startPos, int endPos] wxStyledTextCtrl::GetSelection() // C++ Func: void GetSelection(int* startPos, int* endPos); void GetSelection(); Index: wxcore_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** wxcore_override.hpp 15 Dec 2007 16:56:40 -0000 1.12 --- wxcore_override.hpp 18 Dec 2007 01:03:32 -0000 1.13 *************** *** 23,26 **** --- 23,41 ---- %end + %override wxLua_wxApp_MainLoop + // int MainLoop() + static int LUACALL wxLua_wxApp_MainLoop(lua_State *L) + { + // get this + wxApp * self = (wxApp *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxApp); + // call MainLoop + int returns = !wxApp::IsMainLoopRunning() ? (self->MainLoop()) : 0; + // push the result number + lua_pushnumber(L, returns); + + return 1; + } + %end + %override wxLua_wxStatusBar_SetFieldsCount // virtual void SetFieldsCount(int number = 1, int* widths = NULL) *************** *** 1453,1456 **** --- 1468,1498 ---- %end + %override wxLua_wxBitmapFromBits_constructor + // %win wxBitmap(const char* bits, int width, int height, int depth = -1) + static int LUACALL wxLua_wxBitmapFromBits_constructor(lua_State *L) + { + wxluabind_removetableforcall(L); + + // get number of arguments + int argCount = lua_gettop(L); + // int depth = -1 + int depth = (argCount >= 4 ? (int)wxlua_getintegertype(L, 4) : -1); + // int height + int height = (int)wxlua_getintegertype(L, 3); + // int width + int width = (int)wxlua_getintegertype(L, 2); + // const char* bits + const char *bits = (const char *)lua_tostring(L, 1); + // call constructor + wxBitmap *returns = new wxBitmap(bits, width, height, depth); + // add to tracked memory list + wxluaO_addgcobject(L, returns); + // push the constructed class pointer + wxluaT_pushuserdatatype(L, s_wxluatag_wxBitmap, returns); + // return the number of parameters + return 1; + } + %end + %override wxLua_wxBitmapFromData_constructor // %win wxBitmap(void* data, int type, int width, int height, int depth = -1) *************** *** 1747,1750 **** --- 1789,1807 ---- %end + %override wxLua_wxImage_GetData + // unsigned char* GetData() const + static int LUACALL wxLua_wxImage_GetData(lua_State *L) + { + // get this + wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, s_wxluatag_wxImage); + // call GetData + char* returns = (char*)self->GetData(); + // push the result pointer + lua_pushlstring(L, returns, self->GetWidth()*self->GetHeight()*3); + + return 1; + } + %end + %override wxLua_wxImage_GetOrFindMaskColour // bool GetOrFindMaskColour(unsigned char *r, unsigned char *g, unsigned char *b) const Index: wxcore_print.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_print.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxcore_print.i 10 Dec 2007 05:39:05 -0000 1.2 --- wxcore_print.i 18 Dec 2007 01:03:32 -0000 1.3 *************** *** 70,74 **** void SetPageInfo(int minPage, int maxPage, int pageFrom = 0, int pageTo = 0) ! // The functions below are all virtual functions that you can override in lua. // See the printing sample and wxPrintout for proper parameters and usage. //void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) --- 70,74 ---- void SetPageInfo(int minPage, int maxPage, int pageFrom = 0, int pageTo = 0) ! // The functions below are all virtual functions that you can override in Lua. // See the printing sample and wxPrintout for proper parameters and usage. //void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) Index: wxbase_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_override.hpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wxbase_override.hpp 13 Dec 2007 06:23:53 -0000 1.11 --- wxbase_override.hpp 18 Dec 2007 01:03:32 -0000 1.12 *************** *** 597,606 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); wxString ext; wxString name; wxString path; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 2); // call SplitPath wxFileName::SplitPath(fullpath, &path, &name, &ext, format); --- 597,606 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); wxString ext; wxString name; wxString path; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 1); // call SplitPath wxFileName::SplitPath(fullpath, &path, &name, &ext, format); *************** *** 621,625 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); wxString ext; wxString name; --- 621,625 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); wxString ext; wxString name; *************** *** 627,631 **** wxString volume; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 2); // call SplitPath wxFileName::SplitPath(fullpath, &volume, &path, &name, &ext, format); --- 627,631 ---- wxString volume; // const wxString& fullpath ! wxString fullpath = wxlua_getwxStringtype(L, 1); // call SplitPath wxFileName::SplitPath(fullpath, &volume, &path, &name, &ext, format); *************** *** 647,653 **** int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 3 ? (wxPathFormat)wxlua_getintegertype(L, 3) : wxPATH_NATIVE); // const wxString fullpath ! const wxString fullpath = wxlua_getwxStringtype(L, 2); wxString volume; wxString path; --- 647,653 ---- int argCount = lua_gettop(L); // wxPathFormat format = wxPATH_NATIVE ! wxPathFormat format = (argCount >= 2 ? (wxPathFormat)wxlua_getintegertype(L, 2) : wxPATH_NATIVE); // const wxString fullpath ! const wxString fullpath = wxlua_getwxStringtype(L, 1); wxString volume; wxString path; *************** *** 743,747 **** // push the result number lua_pushnumber(L, returns); ! lua_pushlstring(L, (const char *) buffer, count); free(buffer); // return the number of parameters --- 743,747 ---- // push the result number lua_pushnumber(L, returns); ! lua_pushlstring(L, (const char *) buffer, returns); free(buffer); // return the number of parameters *************** *** 873,874 **** --- 873,895 ---- } %end + + + %override wxLua_wxMemoryInputStream_constructor + // wxMemoryInputStream(const char *data, size_t length) + static int LUACALL wxLua_wxMemoryInputStream_constructor(lua_State *L) + { + wxluabind_removetableforcall(L); + // size_t length + size_t length = (size_t)wxlua_getnumbertype(L, 2); + // const char data + const char* data = (const char*)wxlua_getstringtype(L, 1); + // call constructor + wxMemoryInputStream* returns = new wxMemoryInputStream(data, length); + // add to tracked memory list + wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxMemoryInputStream((wxMemoryInputStream*)returns)); + // push the constructed class pointer + wxluaT_pushuserdatatype(L, s_wxluatag_wxMemoryInputStream, returns); + + return 1; + } + %end Index: wxbase_config.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_config.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxbase_config.i 16 Jul 2007 19:34:23 -0000 1.1 --- wxbase_config.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 43,47 **** // deleting them. This is because the wxConfig you install using // wxConfigBase::Set may need to exist outside of the scope it was created ! // in and we don't want lua to garbage collect it. //void delete() --- 43,47 ---- // deleting them. This is because the wxConfig you install using // wxConfigBase::Set may need to exist outside of the scope it was created ! // in and we don't want Lua to garbage collect it. //void delete() *************** *** 89,93 **** bool Read(const wxString& key, const wxString& defaultVal = "") const ! // Since lua uses double as it's number type, we only read/write doubles // %override [bool, double] wxConfigBase::Read(const wxString& key, double defaultVal = 0) --- 89,93 ---- bool Read(const wxString& key, const wxString& defaultVal = "") const ! // Since Lua uses double as it's number type, we only read/write doubles // %override [bool, double] wxConfigBase::Read(const wxString& key, double defaultVal = 0) *************** *** 111,115 **** bool Write(const wxString& key, wxString &value) ! // Since lua uses double as it's number type, we only read/write doubles bool Write(const wxString &key, double value) --- 111,115 ---- bool Write(const wxString& key, wxString &value) ! // Since Lua uses double as it's number type, we only read/write doubles bool Write(const wxString &key, double value) *************** *** 154,158 **** %class %delete %noclassinfo %encapsulate wxConfigPathChanger ! // NOTE: ALWAYS delete() this when done since lua's gc may not delete it soon enough wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry) --- 154,158 ---- %class %delete %noclassinfo %encapsulate wxConfigPathChanger ! // NOTE: ALWAYS delete() this when done since Lua's gc may not delete it soon enough wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry) Index: wxcore_controls.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_controls.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxcore_controls.i 16 Jul 2007 19:34:24 -0000 1.1 --- wxcore_controls.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 272,276 **** void Deselect(int n) ! // %override [lua table of int selections] wxListBox::GetSelections() // C++ Func: int GetSelections(wxArrayInt& selections) const int GetSelections() const --- 272,276 ---- void Deselect(int n) ! // %override [Lua table of int selections] wxListBox::GetSelections() // C++ Func: int GetSelections(wxArrayInt& selections) const int GetSelections() const *************** *** 451,455 **** //void SetWindowStyleFlag(long style) - see wxWindow ! // %override bool SortItems(lua function(long item1, long item2, long data) returning int, long data) // C++ Func: bool SortItems(wxListCtrlCompare fnSortCallBack, long data) // Note: the data can only be a number, but you can create a table where the data is --- 451,455 ---- //void SetWindowStyleFlag(long style) - see wxWindow ! // %override bool SortItems(Lua function(long item1, long item2, long data) returning int, long data) // C++ Func: bool SortItems(wxListCtrlCompare fnSortCallBack, long data) // Note: the data can only be a number, but you can create a table where the data is *************** *** 459,463 **** // you may want to make this "data" equal to an index in a table where you // store more information needed for sorting. ! // Your lua function should return 1, 0, -1 for item1 > item2, item1 == item2, item1 < item2 bool SortItems(LuaFunction fnSortCallBack, long data) %endclass --- 459,463 ---- // you may want to make this "data" equal to an index in a table where you // store more information needed for sorting. ! // Your Lua function should return 1, 0, -1 for item1 > item2, item1 == item2, item1 < item2 bool SortItems(LuaFunction fnSortCallBack, long data) %endclass *************** *** 1062,1066 **** wxTreeItemId GetSelection() const ! // %override [size_t, lua table of wxTreeItemIds] wxTreeCtrl::GetSelections() // C++ Func: size_t GetSelections(wxArrayTreeItemIds& selection) const size_t GetSelections() const --- 1062,1066 ---- wxTreeItemId GetSelection() const ! // %override [size_t, Lua table of wxTreeItemIds] wxTreeCtrl::GetSelections() // C++ Func: size_t GetSelections(wxArrayTreeItemIds& selection) const size_t GetSelections() const *************** *** 1139,1143 **** %enum wxTreeItemIdValue // FAKE enum, actually typedef void* wxTreeItemIdValue ! // but lua only uses double. This gets around compiler errors/warnings %endenum --- 1139,1143 ---- %enum wxTreeItemIdValue // FAKE enum, actually typedef void* wxTreeItemIdValue ! // but Lua only uses double. This gets around compiler errors/warnings %endenum *************** *** 1147,1151 **** bool IsOk() ! wxTreeItemIdValue GetValue() const // get a pointer to the internal data to use as a reference in a lua table %operator wxTreeItemId& operator=(const wxTreeItemId& otherId) --- 1147,1151 ---- bool IsOk() ! wxTreeItemIdValue GetValue() const // get a pointer to the internal data to use as a reference in a Lua table %operator wxTreeItemId& operator=(const wxTreeItemId& otherId) Index: wxhtml_html.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxhtml_html.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxhtml_html.i 16 Jul 2007 19:34:25 -0000 1.1 --- wxhtml_html.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 35,39 **** //virtual void DrawInvisible(wxDC& dc, int x, int y, wxHtmlRenderingInfo& info) ! // %override wxHtmlCell* Find(int condition, [none, string, or int]) // C++ Func: virtual const wxHtmlCell* Find(int condition, void *param = 0) virtual const wxHtmlCell* Find(int condition, void *param = 0) --- 35,39 ---- //virtual void DrawInvisible(wxDC& dc, int x, int y, wxHtmlRenderingInfo& info) ! // %override wxHtmlCell* wxHtmlCell::Find(int condition, [none, string, or int]) // C++ Func: virtual const wxHtmlCell* Find(int condition, void *param = 0) virtual const wxHtmlCell* Find(int condition, void *param = 0) *************** *** 241,245 **** void SetBorders(int b) ! // %override void SetFonts(wxString normal_face, wxString fixed_face, lua int table) // C++ Func: void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes) void SetFonts(wxString normal_face, wxString fixed_face, LuaTable intTable) --- 241,245 ---- void SetBorders(int b) ! // %override void wxHtmlWindow::SetFonts(wxString normal_face, wxString fixed_face, Lua int table) // C++ Func: void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes) void SetFonts(wxString normal_face, wxString fixed_face, LuaTable intTable) *************** *** 263,267 **** wxLuaHtmlWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHW_SCROLLBAR_AUTO, const wxString& name = "wxLuaHtmlWindow") ! // The functions below are all virtual functions that you can override in lua. // See the html sample and wxHtmlWindow for proper parameters and usage. //bool OnCellClicked(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& event) --- 263,267 ---- wxLuaHtmlWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHW_SCROLLBAR_AUTO, const wxString& name = "wxLuaHtmlWindow") ! // The functions below are all virtual functions that you can override in Lua. // See the html sample and wxHtmlWindow for proper parameters and usage. //bool OnCellClicked(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& event) *************** *** 355,359 **** void SetFontUnderlined(int x) ! // %override void SetFonts(wxString normal_face, wxString fixed_face, lua int table) // C++ Func: void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes) void SetFonts(wxString normal_face, wxString fixed_face, LuaTable intTable) --- 355,359 ---- void SetFontUnderlined(int x) ! // %override void wxHtmlWinParser::SetFonts(wxString normal_face, wxString fixed_face, Lua int table) // C++ Func: void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes) void SetFonts(wxString normal_face, wxString fixed_face, LuaTable intTable) Index: wxnet_net.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxnet_net.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxnet_net.i 16 Jul 2007 19:34:26 -0000 1.1 --- wxnet_net.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 85,101 **** void SetTimeout(int seconds) ! // %override [lua string] wxSocketBase::Peek(unsigned long nbytes) // C++ Func: void Peek(void * buffer, unsigned long nbytes) void Peek(unsigned long nbytes) ! // %override [lua string] wxSocketBase::Read(unsigned long nbytes) // C++ Func: void Read(unsigned long nbytes) void Read(void * buffer, unsigned long nbytes) ! // %override [lua string] wxSocketBase::ReadMsg(unsigned long nbytes) // C++ Func: void ReadMsg(void * buffer, unsigned long nbytes) void ReadMsg(unsigned long nbytes) ! // %override void wxSocketBase::Unread(lua string, [optional unsigned long nbytes]) // C++ Func: void Unread(const void * buffer, unsigned long nbytes) void Unread(const char* buffer, unsigned long nbytes) --- 85,101 ---- void SetTimeout(int seconds) ! // %override [Lua string] wxSocketBase::Peek(unsigned long nbytes) // C++ Func: void Peek(void * buffer, unsigned long nbytes) void Peek(unsigned long nbytes) ! // %override [Lua string] wxSocketBase::Read(unsigned long nbytes) // C++ Func: void Read(unsigned long nbytes) void Read(void * buffer, unsigned long nbytes) ! // %override [Lua string] wxSocketBase::ReadMsg(unsigned long nbytes) // C++ Func: void ReadMsg(void * buffer, unsigned long nbytes) void ReadMsg(unsigned long nbytes) ! // %override void wxSocketBase::Unread(Lua string, [optional unsigned long nbytes]) // C++ Func: void Unread(const void * buffer, unsigned long nbytes) void Unread(const char* buffer, unsigned long nbytes) *************** *** 106,114 **** bool WaitForWrite(long seconds = -1, long millisecond = 0) ! // %override void wxSocketBase::Write(lua string, [optional unsigned long nbytes]) // C++ Func: void Write(const void * buffer, unsigned long nbytes) void Write(const char* buffer, unsigned long nbytes) ! // %override void wxSocketBase::WriteMsg(lua string, [optional unsigned long nbytes]) // C++ Func: void WriteMsg(const void * buffer, wxUint32 nbytes) void WriteMsg(const char* buffer, wxUint32 nbytes) --- 106,114 ---- bool WaitForWrite(long seconds = -1, long millisecond = 0) ! // %override void wxSocketBase::Write(Lua string, [optional unsigned long nbytes]) // C++ Func: void Write(const void * buffer, unsigned long nbytes) void Write(const char* buffer, unsigned long nbytes) ! // %override void wxSocketBase::WriteMsg(Lua string, [optional unsigned long nbytes]) // C++ Func: void WriteMsg(const void * buffer, wxUint32 nbytes) void WriteMsg(const char* buffer, wxUint32 nbytes) Index: wxcore_image.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_image.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxcore_image.i 10 Dec 2007 05:39:05 -0000 1.2 --- wxcore_image.i 18 Dec 2007 01:03:32 -0000 1.3 *************** *** 62,65 **** --- 62,66 ---- //%define_string wxIMAGE_OPTION_PNG_FORMAT see wxPNGHandler //%define_string wxIMAGE_OPTION_PNG_BITDEPTH see wxPNGHandler + //%define_string wxIMAGE_OPTION_BMP_FORMAT see wxBMPHandler %define_string wxIMAGE_OPTION_QUALITY _T("quality") *************** *** 109,113 **** void Destroy() ! // %override [bool, uchar r, uchar g, char b] FindFirstUnusedColour(unsigned char startR = 1, unsigned char startG = 0, unsigned char startB = 0) // C++ Func: bool FindFirstUnusedColour(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char startR = 1, unsigned char startG = 0, unsigned char startB = 0) bool FindFirstUnusedColour(unsigned char startR = 1, unsigned char startG = 0, unsigned char startB = 0) --- 110,114 ---- void Destroy() ! // %override [bool, uchar r, uchar g, char b] wxImage::FindFirstUnusedColour(unsigned char startR = 1, unsigned char startG = 0, unsigned char startB = 0) // C++ Func: bool FindFirstUnusedColour(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char startR = 1, unsigned char startG = 0, unsigned char startB = 0) bool FindFirstUnusedColour(unsigned char startR = 1, unsigned char startG = 0, unsigned char startB = 0) *************** *** 120,124 **** unsigned char GetAlpha(int x, int y) const unsigned char GetBlue(int x, int y) const ! //unsigned char* GetData() const unsigned char GetGreen(int x, int y) const static int GetImageCount(const wxString& filename, long type = wxBITMAP_TYPE_ANY) --- 121,129 ---- unsigned char GetAlpha(int x, int y) const unsigned char GetBlue(int x, int y) const ! ! // %override [Lua string] wxImage::GetData() const ! // C++ Func: unsigned char* GetData() const ! unsigned char* GetData() const ! unsigned char GetGreen(int x, int y) const static int GetImageCount(const wxString& filename, long type = wxBITMAP_TYPE_ANY) *************** *** 130,134 **** unsigned char GetMaskRed() const ! // %override [bool, uchar r, uchar g, uchar b] GetOrFindMaskColour() const // C++ Func: bool GetOrFindMaskColour(unsigned char *r, unsigned char *g, unsigned char *b) const bool GetOrFindMaskColour() const --- 135,139 ---- unsigned char GetMaskRed() const ! // %override [bool, uchar r, uchar g, uchar b] wxImage::GetOrFindMaskColour() const // C++ Func: bool GetOrFindMaskColour(unsigned char *r, unsigned char *g, unsigned char *b) const bool GetOrFindMaskColour() const *************** *** 140,148 **** // note: we're tricking generator to not gag on RGB/HSVValue, so pretend to return an int ! // %override [r, g, b] HSVtoRGB(double h, double s, double v) // C++ Func: static RGBValue HSVtoRGB(const HSVValue& hsv) static int HSVtoRGB(double h, double s, double v) ! // %override [h, s, v] RGBtoHSV(unsigned char r, unsigned char g, unsigned char b) // C++ Func: static HSVValue RGBtoHSV(const RGBValue& rgb) static int RGBtoHSV(unsigned char r, unsigned char g, unsigned char b) --- 145,153 ---- // note: we're tricking generator to not gag on RGB/HSVValue, so pretend to return an int ! // %override [r, g, b] wxImage::HSVtoRGB(double h, double s, double v) // C++ Func: static RGBValue HSVtoRGB(const HSVValue& hsv) static int HSVtoRGB(double h, double s, double v) ! // %override [h, s, v] wxImage::RGBtoHSV(unsigned char r, unsigned char g, unsigned char b) // C++ Func: static HSVValue RGBtoHSV(const RGBValue& rgb) static int RGBtoHSV(unsigned char r, unsigned char g, unsigned char b) *************** *** 157,163 **** static void InsertHandler(%ungc wxImageHandler* handler) bool IsTransparent(int x, int y, unsigned char threshold = 128) const ! bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_ANY) ! bool LoadFile(const wxString& name, const wxString& mimetype) ! bool LoadFile(wxInputStream& stream, long type, int index = -1) bool Ok() const static bool RemoveHandler(const wxString& name) --- 162,171 ---- static void InsertHandler(%ungc wxImageHandler* handler) bool IsTransparent(int x, int y, unsigned char threshold = 128) const ! ! bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1) ! bool LoadFile(const wxString& name, const wxString& mimetype, int index = -1) ! bool LoadFile(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1) ! bool LoadFile(wxInputStream& stream, const wxString& mimetype, int index = -1) ! bool Ok() const static bool RemoveHandler(const wxString& name) *************** *** 180,188 **** void SetAlpha(int x, int y, unsigned char alpha) ! // %override void wxImage::SetAlpha(lua string) - copy contents of string to image // C++ Func: void SetAlpha(unsigned char *alpha = NULL,bool static_data = false) %override_name wxLua_wxImage_SetAlphaData void SetAlpha(const wxString& dataStr) ! // %override void SetData(lua string) - copy contents of string to image // C++ Func: void SetData(unsigned char *data) void SetData(const wxString& data) --- 188,196 ---- void SetAlpha(int x, int y, unsigned char alpha) ! // %override void wxImage::SetAlpha(Lua string) - copy contents of string to image // C++ Func: void SetAlpha(unsigned char *alpha = NULL,bool static_data = false) %override_name wxLua_wxImage_SetAlphaData void SetAlpha(const wxString& dataStr) ! // %override void wxImage::SetData(Lua string) - copy contents of string to image // C++ Func: void SetData(unsigned char *data) void SetData(const wxString& data) *************** *** 300,303 **** --- 308,313 ---- %endenum + %define_string wxIMAGE_OPTION_BMP_FORMAT // wxString(_T("wxBMP_FORMAT")) + %class %delete wxBMPHandler, wxImageHandler wxBMPHandler() Index: wxaui_aui.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxaui_aui.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxaui_aui.i 25 Nov 2007 21:34:04 -0000 1.2 --- wxaui_aui.i 18 Dec 2007 01:03:32 -0000 1.3 *************** *** 218,222 **** void MakeTabVisible(int tabPage, wxWindow* win); ! bool IsDragging() const %endclass --- 218,222 ---- void MakeTabVisible(int tabPage, wxWindow* win); ! %wxchkver_2_8_5 bool IsDragging() const %endclass Index: wxbase_base.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxbase_base.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxbase_base.i 16 Jul 2007 19:34:23 -0000 1.1 --- wxbase_base.i 18 Dec 2007 01:03:32 -0000 1.2 *************** *** 321,325 **** // All of the wxLogXXX functions take only a single string, ! // use string.format(...) to format the string in lua. // C++ Func: void wxLogError(const char *formatString, ...) --- 321,325 ---- // All of the wxLogXXX functions take only a single string, ! // use string.format(...) to format the string in Lua. // C++ Func: void wxLogError(const char *formatString, ...) *************** *** 439,443 **** %class %delete %noclassinfo %encapsulate wxLogNull, wxLog ! // NOTE: ALWAYS delete() this when done since lua's gc may not delete it soon enough wxLogNull() --- 439,443 ---- %class %delete %noclassinfo %encapsulate wxLogNull, wxLog ! // NOTE: ALWAYS delete() this when done since Lua's gc may not delete it soon enough wxLogNull() *************** *** 691,703 **** bool Matches(const wxString &text, int flags = 0) const ! // %override... [truncated message content] |
From: John L. <jr...@us...> - 2007-12-18 01:03:38
|
Update of /cvsroot/wxlua/wxLua/docs In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19598/wxLua/docs Modified Files: wxluaref.html Log Message: Cleanup: lua to Lua Fix various binding errors, wrong params for static wxFile functions Bump version to 2.8.7 Add wxImage::GetData(), wxMemoryInputStream Index: wxluaref.html =================================================================== RCS file: /cvsroot/wxlua/wxLua/docs/wxluaref.html,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** wxluaref.html 14 Aug 2007 13:42:14 -0000 1.43 --- wxluaref.html 18 Dec 2007 01:03:32 -0000 1.44 *************** *** 8,12 **** <body> ! <h1>wxLua 2.8.4.0 Reference Manual for wxWidgets 2.8.4</h1> <h2>Classes</h2> --- 8,12 ---- <body> ! <h1>wxLua 2.8.4.0 Reference Manual for wxWidgets 2.8.7</h1> [...2201 lines suppressed...] <font color=#009900>// Given any type of object, returns four values:</font><br> <font color=#009900>// wxlua name of the type - wxLuaState::GetLuaTagName(wxlua_type)</font><br> ! <font color=#009900>// wxlua number of the type - wxlua_getwxluatype(lua_type(L, stack_idx)) or wxluaT_tag</font><br> <font color=#009900>// lua name of the type - lua_typename(L, lua_type(L, stack_idx))</font><br> <font color=#009900>// lua number of the type - lua_type(L, stack_idx)</font><br> *************** *** 24318,24323 **** <font color=#009900>// These items follow the structure below and ALL items are called as if they</font><br> <font color=#009900>// were table members.</font><br> ! <font color=#009900>// Example : print(wxlua.GetBindings()[1].binding.GetClassCount)</font><br> ! <font color=#009900>// Example : print(wxlua.GetBindings()[1].binding.GetClassArray[1].methods[1].name)</font><br> <font color=#009900>// Note: Use only '.' and NO () to make it a function call, also check to see</font><br> <font color=#009900>// if the item exists first (unlike the example above)!</font><br> --- 24568,24573 ---- <font color=#009900>// These items follow the structure below and ALL items are called as if they</font><br> <font color=#009900>// were table members.</font><br> ! <font color=#009900>// Example : print(wxlua.GetBindings()[1].GetClassCount)</font><br> ! <font color=#009900>// Example : print(wxlua.GetBindings()[1].GetClassArray[1].methods[1].name)</font><br> <font color=#009900>// Note: Use only '.' and NO () to make it a function call, also check to see</font><br> <font color=#009900>// if the item exists first (unlike the example above)!</font><br> |
From: John L. <jr...@us...> - 2007-12-15 16:56:46
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24974/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp Log Message: * Changed signature of the function wxLuaState::SetLuaDebugHook() so that the inputs to lua_sethook() are together and in the same order. - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that it is a callback for the wxEvents using wxEvtHandlers. Cleaned up the comments in the headers. Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** wxldebug.cpp 13 Dec 2007 00:47:53 -0000 1.59 --- wxldebug.cpp 15 Dec 2007 16:56:41 -0000 1.60 *************** *** 369,374 **** else if (lightuserdata_reg_key == &wxlua_lreg_evtcallbacks_key) { ! wxLuaCallback* wxlCallback = (wxLuaCallback*)lua_touserdata(L, -2); ! wxCHECK_MSG(wxlCallback, count, wxT("Invalid wxLuaCallback")); wxString s(wxlCallback->GetInfo()); --- 369,374 ---- else if (lightuserdata_reg_key == &wxlua_lreg_evtcallbacks_key) { ! wxLuaEventCallback* wxlCallback = (wxLuaEventCallback*)lua_touserdata(L, -2); ! wxCHECK_MSG(wxlCallback, count, wxT("Invalid wxLuaEventCallback")); wxString s(wxlCallback->GetInfo()); |
From: John L. <jr...@us...> - 2007-12-15 16:56:46
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24974/wxLua/modules/wxlua/src Modified Files: wxlcallb.cpp wxlstate.cpp wxlua_bind.cpp Log Message: * Changed signature of the function wxLuaState::SetLuaDebugHook() so that the inputs to lua_sethook() are together and in the same order. - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that it is a callback for the wxEvents using wxEvtHandlers. Cleaned up the comments in the headers. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** wxlstate.cpp 13 Dec 2007 06:23:55 -0000 1.151 --- wxlstate.cpp 15 Dec 2007 16:56:41 -0000 1.152 *************** *** 33,37 **** const char* wxlua_lreg_weakobjects_key = "wxLua objects pushed"; const char* wxlua_lreg_gcobjects_key = "wxLua gc objects to delete"; ! const char* wxlua_lreg_evtcallbacks_key = "wxLuaCallbacks"; const char* wxlua_lreg_windestroycallbacks_key = "wxLuaWinDestoyCallbacks"; const char* wxlua_lreg_topwindows_key = "wxLua top level wxWindows"; --- 33,37 ---- const char* wxlua_lreg_weakobjects_key = "wxLua objects pushed"; const char* wxlua_lreg_gcobjects_key = "wxLua gc objects to delete"; ! const char* wxlua_lreg_evtcallbacks_key = "wxLuaEventCallbacks"; const char* wxlua_lreg_windestroycallbacks_key = "wxLuaWinDestoyCallbacks"; [...1186 lines suppressed...] --- 2890,2895 ---- { // value = -1, key = -2, table = -3 ! wxLuaEventCallback* wxlCallback = (wxLuaEventCallback*)lua_touserdata(L, -2); ! wxCHECK_MSG(wxlCallback, names, wxT("Invalid wxLuaEventCallback")); names.Add(wxlCallback->GetInfo()); *************** *** 2955,2959 **** } ! wxArrayString wxLuaState::GetTrackedWinDestroyCallbackStrings() const { wxArrayString names; --- 2946,2950 ---- } ! wxArrayString wxLuaState::GetTrackedWinDestroyCallbackInfo() const { wxArrayString names; Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** wxlcallb.cpp 13 Dec 2007 06:23:55 -0000 1.51 --- wxlcallb.cpp 15 Dec 2007 16:56:41 -0000 1.52 *************** *** 1,5 **** ///////////////////////////////////////////////////////////////////////////// // Name: wxlcallb.cpp ! // Purpose: wxLuaCallback and wxLuaWinDestroyCallback // Author: Francis Irving, John Labenski // Created: 11/05/2002 --- 1,5 ---- ///////////////////////////////////////////////////////////////////////////// // Name: wxlcallb.cpp ! // Purpose: wxLuaEventCallback and wxLuaWinDestroyCallback // Author: Francis Irving, John Labenski // Created: 11/05/2002 *************** *** 22,35 **** //----------------------------------------------------------------------------- ! // wxLuaCallback //----------------------------------------------------------------------------- ! IMPLEMENT_ABSTRACT_CLASS(wxLuaCallback, wxObject) ! wxLuaCallback::wxLuaCallback(const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID win_id, wxWindowID last_id, ! wxEventType eventType, wxEvtHandler *evtHandler) ! : m_routine(0), m_wxlState(wxlState), ! m_evtHandler(evtHandler), m_id(win_id), m_last_id(last_id), ! m_wxlBindEvent(NULL) { --- 22,35 ---- //----------------------------------------------------------------------------- ! // wxLuaEventCallback //----------------------------------------------------------------------------- ! IMPLEMENT_ABSTRACT_CLASS(wxLuaEventCallback, wxObject) ! wxLuaEventCallback::wxLuaEventCallback(const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID win_id, wxWindowID last_id, ! wxEventType eventType, wxEvtHandler *evtHandler) ! : m_routine(0), m_wxlState(wxlState), ! m_evtHandler(evtHandler), m_id(win_id), m_last_id(last_id), ! m_wxlBindEvent(NULL) { *************** *** 38,42 **** m_wxlBindEvent = wxlState.GetBindEvent(eventType); ! m_wxlState.AddTrackedCallback(this); if (m_wxlBindEvent == NULL) --- 38,42 ---- m_wxlBindEvent = wxlState.GetBindEvent(eventType); ! m_wxlState.AddTrackedEventCallback(this); if (m_wxlBindEvent == NULL) *************** *** 51,63 **** // create a reference to the Lua event handler function ! if (lua_func_stack_idx != WXLUACALLBACK_NOROUTINE) m_routine = m_wxlState.wxluaR_Ref(lua_func_stack_idx, &wxlua_lreg_refs_key); m_evtHandler->Connect(win_id, last_id, eventType, ! (wxObjectEventFunction)&wxLuaCallback::EventHandler, this); } ! wxLuaCallback::~wxLuaCallback() { // Remove the reference to the Lua function that we are going to call --- 51,63 ---- // create a reference to the Lua event handler function ! if (lua_func_stack_idx != WXLUAEVENTCALLBACK_NOROUTINE) m_routine = m_wxlState.wxluaR_Ref(lua_func_stack_idx, &wxlua_lreg_refs_key); m_evtHandler->Connect(win_id, last_id, eventType, ! (wxObjectEventFunction)&wxLuaEventCallback::EventHandler, this); } ! wxLuaEventCallback::~wxLuaEventCallback() { // Remove the reference to the Lua function that we are going to call *************** *** 66,81 **** m_wxlState.wxluaR_Unref(m_routine, &wxlua_lreg_refs_key); // delete the reference to this handler ! m_wxlState.RemoveTrackedCallback(this); } } ! void wxLuaCallback::ClearwxLuaState() { m_wxlState.UnRef(); } ! wxString wxLuaCallback::GetInfo() const { ! return wxString::Format(wxT("%s(%d) -> wxLuaCallback(%p, ids %d, %d)|wxEvtHandler(%p) -> %s"), lua2wx(m_wxlBindEvent ? m_wxlBindEvent->name : "?").c_str(), (int)GetEventType(), this, m_id, m_last_id, --- 66,81 ---- m_wxlState.wxluaR_Unref(m_routine, &wxlua_lreg_refs_key); // delete the reference to this handler ! m_wxlState.RemoveTrackedEventCallback(this); } } ! void wxLuaEventCallback::ClearwxLuaState() { m_wxlState.UnRef(); } ! wxString wxLuaEventCallback::GetInfo() const { ! return wxString::Format(wxT("%s(%d) -> wxLuaEventCallback(%p, ids %d, %d)|wxEvtHandler(%p) -> %s"), lua2wx(m_wxlBindEvent ? m_wxlBindEvent->name : "?").c_str(), (int)GetEventType(), this, m_id, m_last_id, *************** *** 83,93 **** } ! void wxLuaCallback::EventHandler(wxEvent& event) { wxEventType evtType = event.GetEventType(); ! // Get the wxLuaCallback to use, NOT "this" since "this" is a central event handler function ! wxLuaCallback *theCallback = (wxLuaCallback *)event.m_callbackUserData; ! wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaCallback in wxEvent user data")); // Ok if !Ok() since the wxLuaState may been cleared during shutdown or after destroy event --- 83,93 ---- } ! void wxLuaEventCallback::EventHandler(wxEvent& event) { wxEventType evtType = event.GetEventType(); ! // Get the wxLuaEventCallback to use, NOT "this" since "this" is a central event handler function ! wxLuaEventCallback *theCallback = (wxLuaEventCallback *)event.m_callbackUserData; ! wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaEventCallback in wxEvent user data")); // Ok if !Ok() since the wxLuaState may been cleared during shutdown or after destroy event *************** *** 105,109 **** } ! void wxLuaCallback::CallFunction(wxEvent *event) { // Cannot call it if Lua is gone or the interpreter has been destroyed --- 105,109 ---- } ! void wxLuaEventCallback::CallFunction(wxEvent *event) { // Cannot call it if Lua is gone or the interpreter has been destroyed *************** *** 156,163 **** } else ! wxlState.wxlua_Error("wxLua: wxEvtHandler::Connect in wxLuaCallback::CallFunction: function is not a Lua function."); } else ! wxlState.wxlua_Error("wxLua: wxEvtHandler::Connect in wxLuaCallback::CallFunction: function has been garbage collected."); wxlState.lua_SetTop(oldTop); // pop function from the stack (if it's there) --- 156,163 ---- } else ! wxlState.wxlua_Error("wxLua: wxEvtHandler::Connect in wxLuaEventCallback::CallFunction: function is not a Lua function."); } else ! wxlState.wxlua_Error("wxLua: wxEvtHandler::Connect in wxLuaEventCallback::CallFunction: function has been garbage collected."); wxlState.lua_SetTop(oldTop); // pop function from the stack (if it's there) *************** *** 238,242 **** wxEvtHandler* evtHandler = m_window->GetEventHandler(); ! // Finally, clear out the wxLuaCallbacks for the very odd cases where // (activation) events can be sent during destruction. These can happen // if you pop up a modal dialog (asking if they want to save perhaps) --- 238,242 ---- wxEvtHandler* evtHandler = m_window->GetEventHandler(); ! // Finally, clear out the wxLuaEventCallbacks for the very odd cases where // (activation) events can be sent during destruction. These can happen // if you pop up a modal dialog (asking if they want to save perhaps) *************** *** 253,258 **** { // value = -1, key = -2, table = -3 ! wxLuaCallback* wxlCallback = (wxLuaCallback*)lua_touserdata(L, -2); ! wxCHECK_RET(wxlCallback, wxT("Invalid wxLuaCallback")); if ((wxlCallback->GetEvtHandler() == evtHandler) || --- 253,258 ---- { // value = -1, key = -2, table = -3 ! wxLuaEventCallback* wxlCallback = (wxLuaEventCallback*)lua_touserdata(L, -2); ! wxCHECK_RET(wxlCallback, wxT("Invalid wxLuaEventCallback")); if ((wxlCallback->GetEvtHandler() == evtHandler) || *************** *** 260,264 **** { // remove the ref to the routine since we're clearing the wxLuaState ! // See ~wxLuaCallback m_wxlState.wxluaR_Unref(wxlCallback->GetLuaRoutine(), &wxlua_lreg_refs_key); wxlCallback->ClearwxLuaState(); --- 260,264 ---- { // remove the ref to the routine since we're clearing the wxLuaState ! // See ~wxLuaEventCallback m_wxlState.wxluaR_Unref(wxlCallback->GetLuaRoutine(), &wxlua_lreg_refs_key); wxlCallback->ClearwxLuaState(); Index: wxlua_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua_bind.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** wxlua_bind.cpp 13 Dec 2007 00:47:52 -0000 1.16 --- wxlua_bind.cpp 15 Dec 2007 16:56:41 -0000 1.17 *************** *** 727,772 **** static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetBindings[1] = {{ wxLua_function_GetBindings, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedEventCallbacks ! // %function LuaTable GetTrackedEventCallbacks() ! static int LUACALL wxLua_function_GetTrackedEventCallbacks(lua_State *L) { ! wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedCallbackStrings()); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedEventCallbacks[1] = {{ wxLua_function_GetTrackedEventCallbacks, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedTopLevelWindows ! // %function LuaTable GetTrackedTopLevelWindows() ! static int LUACALL wxLua_function_GetTrackedTopLevelWindows(lua_State *L) { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWindowStrings()); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedTopLevelWindows[1] = {{ wxLua_function_GetTrackedTopLevelWindows, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedUserdata ! // %function LuaTable GetTrackedUserData() ! static int LUACALL wxLua_function_GetTrackedUserdata(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectstrings(L)); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedUserdata[1] = {{ wxLua_function_GetTrackedUserdata, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedWindows ! // %function LuaTable GetTrackedWindows() ! static int LUACALL wxLua_function_GetTrackedWindows(lua_State *L) { ! wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackStrings()); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWindows[1] = {{ wxLua_function_GetTrackedWindows, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; static wxLuaArgTag s_wxluatagArray_wxLua_function_iswxluatype[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; --- 727,771 ---- static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetBindings[1] = {{ wxLua_function_GetBindings, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetGCUserdataInfo ! // %function LuaTable GetTrackedUserData() ! static int LUACALL wxLua_function_GetGCUserdataInfo(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectinfo(L)); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetGCUserdataInfo[1] = {{ wxLua_function_GetGCUserdataInfo, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedEventCallbackInfo ! // %function LuaTable GetTrackedEventCallbackInfo() ! static int LUACALL wxLua_function_GetTrackedEventCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedEventCallbackInfo()); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo[1] = {{ wxLua_function_GetTrackedEventCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedWinDestroyCallbackInfo ! // %function LuaTable GetTrackedWinDestroyCallbackInfo() ! static int LUACALL wxLua_function_GetTrackedWinDestroyCallbackInfo(lua_State *L) { ! wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackInfo()); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo[1] = {{ wxLua_function_GetTrackedWinDestroyCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; ! // %override wxLua_function_GetTrackedWindowInfo ! // %function LuaTable GetTrackedTopLevelWindows() ! static int LUACALL wxLua_function_GetTrackedWindowInfo(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaW_gettrackedwindowinfo(L)); return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWindowInfo[1] = {{ wxLua_function_GetTrackedWindowInfo, WXLUAMETHOD_CFUNCTION, 0, 0, s_wxluaargArray_None }}; static wxLuaArgTag s_wxluatagArray_wxLua_function_iswxluatype[] = { &s_wxluaarg_Number, &s_wxluaarg_Number, NULL }; *************** *** 887,894 **** { "CompileLuaScript", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_CompileLuaScript, 1, NULL }, { "GetBindings", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetBindings, 1, NULL }, ! { "GetTrackedEventCallbacks", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedEventCallbacks, 1, NULL }, ! { "GetTrackedTopLevelWindows", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedTopLevelWindows, 1, NULL }, ! { "GetTrackedUserdata", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedUserdata, 1, NULL }, ! { "GetTrackedWindows", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWindows, 1, NULL }, { "iswxluatype", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_iswxluatype, 1, NULL }, { "type", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_type, 1, NULL }, --- 886,893 ---- { "CompileLuaScript", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_CompileLuaScript, 1, NULL }, { "GetBindings", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetBindings, 1, NULL }, ! { "GetGCUserdataInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetGCUserdataInfo, 1, NULL }, ! { "GetTrackedEventCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo, 1, NULL }, ! { "GetTrackedWinDestroyCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo, 1, NULL }, ! { "GetTrackedWindowInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWindowInfo, 1, NULL }, { "iswxluatype", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_iswxluatype, 1, NULL }, { "type", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_type, 1, NULL }, |
From: John L. <jr...@us...> - 2007-12-15 16:56:45
|
Update of /cvsroot/wxlua/wxLua/docs In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24974/wxLua/docs Modified Files: changelog.txt Log Message: * Changed signature of the function wxLuaState::SetLuaDebugHook() so that the inputs to lua_sethook() are together and in the same order. - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that it is a callback for the wxEvents using wxEvtHandlers. Cleaned up the comments in the headers. Index: changelog.txt =================================================================== RCS file: /cvsroot/wxlua/wxLua/docs/changelog.txt,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** changelog.txt 13 Dec 2007 00:47:48 -0000 1.52 --- changelog.txt 15 Dec 2007 16:56:40 -0000 1.53 *************** *** 62,65 **** --- 62,69 ---- - Created a central luauserdata:delete() function for the bindings to reduce code. wxLua_wxluabind_delete(L) + * Changed signature of the function wxLuaState::SetLuaDebugHook() so that + the inputs to lua_sethook() are together and in the same order. + - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that + it is a callback for the wxEvents using wxEvtHandlers. version 2.8.4.2 |
From: John L. <jr...@us...> - 2007-12-15 16:56:45
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24974/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlcallb.h wxlstate.h Log Message: * Changed signature of the function wxLuaState::SetLuaDebugHook() so that the inputs to lua_sethook() are together and in the same order. - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that it is a callback for the wxEvents using wxEvtHandlers. Cleaned up the comments in the headers. Index: wxlcallb.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlcallb.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** wxlcallb.h 7 Dec 2007 06:44:46 -0000 1.24 --- wxlcallb.h 15 Dec 2007 16:56:41 -0000 1.25 *************** *** 1,5 **** ///////////////////////////////////////////////////////////////////////////// // Name: wxlcallb.h ! // Purpose: wxLuaCallback and wxLuaWinDestroyCallback // Author: Francis Irving, John Labenski // Created: 21/01/2002 --- 1,5 ---- ///////////////////////////////////////////////////////////////////////////// // Name: wxlcallb.h ! // Purpose: wxLuaEventCallback and wxLuaWinDestroyCallback // Author: Francis Irving, John Labenski // Created: 21/01/2002 *************** *** 15,21 **** // ---------------------------------------------------------------------------- ! // wxLuaCallback - Forward events from C++ wxWidgets wxEvtHandlers to Lua functions // ! // The wxLuaCallback is created with the wxLuaState, the stack index of a // Lua function to call when a wxEvent is received, the window id ranges, and // the wxEventType to connect using wxEvtHandler::Connect() with this as the --- 15,21 ---- // ---------------------------------------------------------------------------- ! // wxLuaEventCallback - Forward events from C++ wxWidgets wxEvtHandlers to Lua functions // ! // The wxLuaEventCallback is created with the wxLuaState, the stack index of a // Lua function to call when a wxEvent is received, the window id ranges, and // the wxEventType to connect using wxEvtHandler::Connect() with this as the *************** *** 25,44 **** // // The function EventHandler() generically handles the events and forwards them ! // to the event's wxLuaCallback callback user data function CallFunction(). // ---------------------------------------------------------------------------- ! #define WXLUACALLBACK_NOROUTINE 1000000 // use this for the lua_func_stack_idx ! // param of the constructor for no Lua routine ! class WXDLLIMPEXP_WXLUA wxLuaCallback : public wxObject { public: // winID and lastID follow the same notation as wxEvtHandler::Connect // if only one event Id is needed set lastId = wxID_ANY ! wxLuaCallback( const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID win_id, wxWindowID last_id, ! wxEventType eventType, wxEvtHandler *evtHandler ); ! virtual ~wxLuaCallback(); void ClearwxLuaState(); // m_wxlState.UnRef() --- 25,44 ---- // // The function EventHandler() generically handles the events and forwards them ! // to the event's wxLuaEventCallback callback user data function CallFunction(). // ---------------------------------------------------------------------------- ! #define WXLUAEVENTCALLBACK_NOROUTINE 1000000 // use this for the lua_func_stack_idx ! // param of the constructor for no Lua routine ! class WXDLLIMPEXP_WXLUA wxLuaEventCallback : public wxObject { public: // winID and lastID follow the same notation as wxEvtHandler::Connect // if only one event Id is needed set lastId = wxID_ANY ! wxLuaEventCallback( const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID win_id, wxWindowID last_id, ! wxEventType eventType, wxEvtHandler *evtHandler ); ! virtual ~wxLuaEventCallback(); void ClearwxLuaState(); // m_wxlState.UnRef() *************** *** 54,62 **** // Get a human readable string ! // "wxEVT_XXX(evt#) -> wxLuaCallback(&callback, ids %d %d)|wxEvtHandler(&evthandler) -> wxEvtHandlerClassName" wxString GetInfo() const; // Get a human readable string // Central event handler that calls CallFunction() for the actual ! // wxLuaCallback callback user data. This function is treated like a // static function that all handlers of this class will call. void EventHandler(wxEvent& event); --- 54,62 ---- // Get a human readable string ! // "wxEVT_XXX(evt#) -> wxLuaEventCallback(&callback, ids %d %d)|wxEvtHandler(&evthandler) -> wxEvtHandlerClassName" wxString GetInfo() const; // Get a human readable string // Central event handler that calls CallFunction() for the actual ! // wxLuaEventCallback callback user data. This function is treated like a // static function that all handlers of this class will call. void EventHandler(wxEvent& event); *************** *** 75,79 **** private: ! DECLARE_ABSTRACT_CLASS(wxLuaCallback) }; --- 75,79 ---- private: ! DECLARE_ABSTRACT_CLASS(wxLuaEventCallback) }; Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** wxlbind.h 13 Dec 2007 00:47:51 -0000 1.71 --- wxlbind.h 15 Dec 2007 16:56:41 -0000 1.72 *************** *** 407,410 **** --- 407,412 ---- operator wxArrayString &() { return *GetArray(); } + // You may have to cast the wxLuaSmartwxArrayString with (wxArrayString&) + // e.g. wxLuaSmartwxArrayString arr; ((wxArrayString&)arr).Add(wxT("hello")); wxLuaSmartwxArrayString& operator = (const wxLuaSmartwxArrayString& arr) { *************** *** 431,434 **** --- 433,438 ---- operator wxSortedArrayString &() { return *GetArray(); } + // You may have to cast the wxLuaSmartwxSortedArrayString with (wxSortedArrayString&) + // e.g. wxLuaSmartwxSortedArrayString arr; ((wxSortedArrayString&)arr).Add(wxT("hello")); wxLuaSmartwxSortedArrayString& operator = (const wxLuaSmartwxSortedArrayString& arr) { *************** *** 455,458 **** --- 459,464 ---- operator wxArrayInt &() { return *GetArray(); } + // You may have to cast the wxLuaSmartwxArrayInt with (wxArrayInt&) + // e.g. wxLuaSmartwxArrayInt arr; ((wxArrayInt&)arr).Add(5); wxLuaSmartwxArrayInt& operator = (const wxLuaSmartwxArrayInt& arr) { Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** wxlstate.h 13 Dec 2007 06:23:54 -0000 1.106 --- wxlstate.h 15 Dec 2007 16:56:41 -0000 1.107 *************** *** 19,23 **** class WXDLLIMPEXP_WXLUA wxLuaState; class WXDLLIMPEXP_WXLUA wxLuaStateRefData; ! class WXDLLIMPEXP_WXLUA wxLuaCallback; class WXDLLIMPEXP_WXLUA wxLuaWinDestroyCallback; class WXDLLIMPEXP_WXLUA wxLuaDebugHookData; --- 19,23 ---- class WXDLLIMPEXP_WXLUA wxLuaState; class WXDLLIMPEXP_WXLUA wxLuaStateRefData; ! class WXDLLIMPEXP_WXLUA wxLuaEventCallback; class WXDLLIMPEXP_WXLUA wxLuaWinDestroyCallback; [...1271 lines suppressed...] bool HasDerivedMethod(void *pObject, const char *method_name, bool push_method) const; // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. bool RemoveDerivedMethods(void *pObject) const; // Find a derived method given an object and and a method name. --- 1010,1023 ---- // userdata and the new wxLuaObject wraps the Lua function or value // which will be deleted by this. ! // See wxlua_setderivedmethod bool SetDerivedMethod(void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. // If push_method then push the method onto the stack. // A derived method is when a function or value is set to a wxLua userdata. + // See wxlua_hasderivedmethod(). bool HasDerivedMethod(void *pObject, const char *method_name, bool push_method) const; // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. + // See wxlua_removederivedmethods() bool RemoveDerivedMethods(void *pObject) const; // Find a derived method given an object and and a method name. |
From: John L. <jr...@us...> - 2007-12-15 16:56:45
|
Update of /cvsroot/wxlua/wxLua/bindings/wxlua In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24974/wxLua/bindings/wxlua Modified Files: override.hpp wxlua.i Log Message: * Changed signature of the function wxLuaState::SetLuaDebugHook() so that the inputs to lua_sethook() are together and in the same order. - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that it is a callback for the wxEvents using wxEvtHandlers. Cleaned up the comments in the headers. Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/wxlua.i,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wxlua.i 13 Dec 2007 00:47:48 -0000 1.11 --- wxlua.i 15 Dec 2007 16:56:40 -0000 1.12 *************** *** 31,50 **** // Get a table of all tracked top level windows that wxLua will Destroy() // when lua is closed. ! // Example output : { ["wxFrame"] = 1, ["wxDialog"] = 2 } ! %function LuaTable GetTrackedTopLevelWindows() // Get a table of all tracked userdata wxLua will delete when lua is closed // or lua will eventually garbage collect. ! // Example output : { ["wxPoint"] = 3, ["wxPen"] = 5 } ! %function LuaTable GetTrackedUserdata() // Get a table of all tracked wxEvent callbacks that have been installed using // wxEvtHandler::Connect(...) ! // "wxEVT_XXX(evt#) -> wxLuaCallback(&callback, ids %d %d)|wxEvtHandler(&evthandler) -> wxEvtHandlerClassName" ! %function LuaTable GetTrackedEventCallbacks() // Get a table of all wxWindow derived classes that have been created in wxLua. // "wxWindowClassName(&win, id=%d)|wxLuaDestroyCallback(&callback)" ! %function LuaTable GetTrackedWindows() // --------------------------------------------------------------------------- --- 31,50 ---- // Get a table of all tracked top level windows that wxLua will Destroy() // when lua is closed. ! // Example output : { "ClassName(&win id=wxWindowID)", ...} ! %function LuaTable GetTrackedWindowInfo() // Get a table of all tracked userdata wxLua will delete when lua is closed // or lua will eventually garbage collect. ! // Example output : { "ClassName(&obj)", ... } ! %function LuaTable GetGCUserdataInfo() // Get a table of all tracked wxEvent callbacks that have been installed using // wxEvtHandler::Connect(...) ! // "wxEVT_XXX(evt#) -> wxLuaEventCallback(&callback, ids %d %d)|wxEvtHandler(&evthandler) -> wxEvtHandlerClassName" ! %function LuaTable GetTrackedEventCallbackInfo() // Get a table of all wxWindow derived classes that have been created in wxLua. // "wxWindowClassName(&win, id=%d)|wxLuaDestroyCallback(&callback)" ! %function LuaTable GetTrackedWinDestroyCallbackInfo() // --------------------------------------------------------------------------- Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/override.hpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** override.hpp 13 Dec 2007 00:47:48 -0000 1.13 --- override.hpp 15 Dec 2007 16:56:40 -0000 1.14 *************** *** 31,69 **** %end ! %override wxLua_function_GetTrackedTopLevelWindows // %function LuaTable GetTrackedTopLevelWindows() ! static int LUACALL wxLua_function_GetTrackedTopLevelWindows(lua_State *L) { ! wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWindowStrings()); return 1; } %end ! %override wxLua_function_GetTrackedUserdata // %function LuaTable GetTrackedUserData() ! static int LUACALL wxLua_function_GetTrackedUserdata(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectstrings(L)); return 1; } %end ! %override wxLua_function_GetTrackedEventCallbacks ! // %function LuaTable GetTrackedEventCallbacks() ! static int LUACALL wxLua_function_GetTrackedEventCallbacks(lua_State *L) { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedCallbackStrings()); return 1; } %end ! %override wxLua_function_GetTrackedWindows ! // %function LuaTable GetTrackedWindows() ! static int LUACALL wxLua_function_GetTrackedWindows(lua_State *L) { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackStrings()); return 1; } --- 31,68 ---- %end ! %override wxLua_function_GetTrackedWindowInfo // %function LuaTable GetTrackedTopLevelWindows() ! static int LUACALL wxLua_function_GetTrackedWindowInfo(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaW_gettrackedwindowinfo(L)); return 1; } %end ! %override wxLua_function_GetGCUserdataInfo // %function LuaTable GetTrackedUserData() ! static int LUACALL wxLua_function_GetGCUserdataInfo(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectinfo(L)); return 1; } %end ! %override wxLua_function_GetTrackedEventCallbackInfo ! // %function LuaTable GetTrackedEventCallbackInfo() ! static int LUACALL wxLua_function_GetTrackedEventCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedEventCallbackInfo()); return 1; } %end ! %override wxLua_function_GetTrackedWinDestroyCallbackInfo ! // %function LuaTable GetTrackedWinDestroyCallbackInfo() ! static int LUACALL wxLua_function_GetTrackedWinDestroyCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackInfo()); return 1; } |
From: John L. <jr...@us...> - 2007-12-15 16:56:45
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24974/wxLua/modules/wxbind/src Modified Files: wxcore_event.cpp Log Message: * Changed signature of the function wxLuaState::SetLuaDebugHook() so that the inputs to lua_sethook() are together and in the same order. - Renamed wxLuaCallback to wxLuaEventCallback to make it more clear that it is a callback for the wxEvents using wxEvtHandlers. Cleaned up the comments in the headers. Index: wxcore_event.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_event.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wxcore_event.cpp 13 Dec 2007 00:47:49 -0000 1.8 --- wxcore_event.cpp 15 Dec 2007 16:56:40 -0000 1.9 *************** *** 74,78 **** wxWindowID lastId = wxID_ANY; wxEventType eventType = 0; ! wxLuaCallback *pCallback = NULL; int nParams = lua_gettop(L); --- 74,78 ---- wxWindowID lastId = wxID_ANY; wxEventType eventType = 0; ! wxLuaEventCallback *pCallback = NULL; int nParams = lua_gettop(L); *************** *** 172,176 **** // Create and connect the callback ! pCallback = new wxLuaCallback(wxlState, nParams, winId, lastId, eventType, evtHandler); return 0; --- 172,176 ---- // Create and connect the callback ! pCallback = new wxLuaEventCallback(wxlState, nParams, winId, lastId, eventType, evtHandler); return 0; *************** *** 265,269 **** // Try to disconnect from the callback ! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaCallback::EventHandler); lua_pushboolean(L, returns); --- 265,269 ---- // Try to disconnect from the callback ! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaEventCallback::EventHandler); lua_pushboolean(L, returns); |