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
|
From: John L. <jr...@us...> - 2008-01-09 05:00:05
|
Update of /cvsroot/wxlua/wxLua/modules/build/msvc6 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13740/wxLua/modules/build/msvc6 Modified Files: modules_mod_wxbindbase.dsp Log Message: Regenerate bakefiles using frm_bakefile 1995295 bytes No changes to the bakefiles and these changes appear to only alphabetize files Index: modules_mod_wxbindbase.dsp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/build/msvc6/modules_mod_wxbindbase.dsp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** modules_mod_wxbindbase.dsp 16 Jul 2007 22:53:31 -0000 1.3 --- modules_mod_wxbindbase.dsp 9 Jan 2008 04:59:57 -0000 1.4 *************** *** 489,492 **** --- 489,496 ---- SOURCE=..\..\wxbind\include\wxbase_bind.h # End Source File + # Begin Source File + + SOURCE=..\..\wxbind\include\wxbinddefs.h + # End Source File # End Group # End Target |
From: John L. <jr...@us...> - 2008-01-09 05:00:03
|
Update of /cvsroot/wxlua/wxLua/modules/build/msvc8 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13740/wxLua/modules/build/msvc8 Modified Files: modules_mod_wxbindbase.vcproj Log Message: Regenerate bakefiles using frm_bakefile 1995295 bytes No changes to the bakefiles and these changes appear to only alphabetize files Index: modules_mod_wxbindbase.vcproj =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/build/msvc8/modules_mod_wxbindbase.vcproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** modules_mod_wxbindbase.vcproj 16 Jul 2007 22:53:31 -0000 1.3 --- modules_mod_wxbindbase.vcproj 9 Jan 2008 04:59:58 -0000 1.4 *************** *** 352,355 **** --- 352,356 ---- <Filter Name="WXBINDBASE headers" UniqueIdentifier="{E846D152-CD05-5687-AD99-87EB24B7F3BD}"> <File RelativePath="..\..\wxbind\include\wxbase_bind.h"/> + <File RelativePath="..\..\wxbind\include\wxbinddefs.h"/> </Filter> </Files> |
From: John L. <jr...@us...> - 2008-01-09 05:00:02
|
Update of /cvsroot/wxlua/wxLua/modules/build/msw In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13740/wxLua/modules/build/msw Modified Files: makefile.bcc makefile.gcc makefile.vc makefile.wat Log Message: Regenerate bakefiles using frm_bakefile 1995295 bytes No changes to the bakefiles and these changes appear to only alphabetize files Index: makefile.vc =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/build/msw/makefile.vc,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** makefile.vc 1 Aug 2007 10:08:23 -0000 1.73 --- makefile.vc 9 Jan 2008 04:59:58 -0000 1.74 *************** *** 196,205 **** $(CPPFLAGS) $(CXXFLAGS) WXLUA_LIB_OBJECTS = \ ! vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlua.obj \ ! vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlcallb.obj \ vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlbind.obj \ vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlstate.obj \ ! vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlua_bind.obj \ ! vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_dummy.obj WXLUA_DLL_CXXFLAGS = /M$(__RUNTIME_LIBS_43)$(VAR_199) /DWIN32 \ /I..\..\..\modules\wxbind\setup $(____WX_SHARED) $(__WXUNICODE_DEFINE_p) \ [...1117 lines suppressed...] + vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxldserv.obj: ..\..\wxluasocket\src\wxldserv.cpp + $(CXX) /c /nologo /TP /Fo$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** + vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxldtarg.obj: ..\..\wxluasocket\src\wxldtarg.cpp $(CXX) /c /nologo /TP /Fo$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** ! vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxlsock.obj: ..\..\wxluasocket\src\wxlsock.cpp $(CXX) /c /nologo /TP /Fo$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** *************** *** 2311,2314 **** --- 2308,2314 ---- $(CXX) /c /nologo /TP /Fo$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** + vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxluasocket_bind.obj: ..\..\wxluasocket\src\wxluasocket_bind.cpp + $(CXX) /c /nologo /TP /Fo$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** + vcmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\mod_luamodule_luamodule.obj: ..\..\luamodule\src\luamodule.cpp $(CXX) /c /nologo /TP /Fo$@ $(MOD_LUAMODULE_CXXFLAGS) $** Index: makefile.bcc =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/build/msw/makefile.bcc,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** makefile.bcc 1 Aug 2007 10:08:23 -0000 1.74 --- makefile.bcc 9 Jan 2008 04:59:58 -0000 1.75 *************** *** 255,264 **** -Hu $(CPPFLAGS) $(CXXFLAGS) WXLUA_LIB_OBJECTS = \ ! bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlua.obj \ ! bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlcallb.obj \ bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlbind.obj \ bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlstate.obj \ ! bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlua_bind.obj \ ! bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_dummy.obj WXLUA_DLL_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include \ -I..\..\..\modules\wxbind\setup $(____WX_SHARED) $(__WXUNICODE_DEFINE_p) \ [...1117 lines suppressed...] + bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxldserv.obj: ..\..\wxluasocket\src\wxldserv.cpp + $(CXX) -q -c -P -o$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** + bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxldtarg.obj: ..\..\wxluasocket\src\wxldtarg.cpp $(CXX) -q -c -P -o$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** ! bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxlsock.obj: ..\..\wxluasocket\src\wxlsock.cpp $(CXX) -q -c -P -o$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** *************** *** 2179,2182 **** --- 2176,2182 ---- $(CXX) -q -c -P -o$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** + bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxluasocket_bind.obj: ..\..\wxluasocket\src\wxluasocket_bind.cpp + $(CXX) -q -c -P -o$@ $(WXLUASOCKET_DLL_CXXFLAGS) $** + bccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\mod_luamodule_luamodule.obj: ..\..\luamodule\src\luamodule.cpp $(CXX) -q -c -P -o$@ $(MOD_LUAMODULE_CXXFLAGS) $** Index: makefile.wat =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/build/msw/makefile.wat,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** makefile.wat 1 Aug 2007 10:08:24 -0000 1.73 --- makefile.wat 9 Jan 2008 04:59:58 -0000 1.74 *************** *** 874,883 **** $(CPPFLAGS) $(CXXFLAGS) WXLUA_LIB_OBJECTS = & ! watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlua.obj & ! watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlcallb.obj & watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlbind.obj & watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlstate.obj & ! watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlua_bind.obj & ! watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_dummy.obj WXLUA_DLL_CXXFLAGS = -bd -i=..\..\..\modules\wxbind\setup $(____WX_SHARED) & $(__WXUNICODE_DEFINE_p) $(__WXDEBUG_DEFINE_p) -d__WXMSW__ & [...1116 lines suppressed...] ! watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxldserv.obj : .AUTODEPEND ..\..\wxluasocket\src\wxldserv.cpp $(CXX) -bt=nt -zq -fo=$^@ $(WXLUASOCKET_DLL_CXXFLAGS) $< --- 2439,2443 ---- $(CXX) -bt=nt -zq -fo=$^@ $(WXLUASOCKET_DLL_CXXFLAGS) $< ! watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxlsock.obj : .AUTODEPEND ..\..\wxluasocket\src\wxlsock.cpp $(CXX) -bt=nt -zq -fo=$^@ $(WXLUASOCKET_DLL_CXXFLAGS) $< *************** *** 2448,2451 **** --- 2445,2451 ---- $(CXX) -bt=nt -zq -fo=$^@ $(WXLUASOCKET_DLL_CXXFLAGS) $< + watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxluasocket_bind.obj : .AUTODEPEND ..\..\wxluasocket\src\wxluasocket_bind.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(WXLUASOCKET_DLL_CXXFLAGS) $< + watmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\mod_luamodule_luamodule.obj : .AUTODEPEND ..\..\luamodule\src\luamodule.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MOD_LUAMODULE_CXXFLAGS) $< Index: makefile.gcc =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/build/msw/makefile.gcc,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** makefile.gcc 1 Aug 2007 10:08:23 -0000 1.73 --- makefile.gcc 9 Jan 2008 04:59:58 -0000 1.74 *************** *** 177,186 **** -I$(LUA_DIR)\include -I$(WX_DIR)\contrib\include $(CPPFLAGS) $(CXXFLAGS) WXLUA_LIB_OBJECTS = \ ! gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlua.o \ ! gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlcallb.o \ gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlbind.o \ gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlstate.o \ ! gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_wxlua_bind.o \ ! gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxlua_lib_dummy.o WXLUA_DLL_CXXFLAGS = -I..\..\..\modules\wxbind\setup -DHAVE_W32API_H \ $(____WX_SHARED) $(__WXUNICODE_DEFINE_p) $(__WXDEBUG_DEFINE_p) -D__WXMSW__ \ [...1116 lines suppressed...] ! gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxldserv.o: ../../wxluasocket/src/wxldserv.cpp $(CXX) -c -o $@ $(WXLUASOCKET_DLL_CXXFLAGS) $(CPPDEPS) $< --- 2155,2159 ---- $(CXX) -c -o $@ $(WXLUASOCKET_DLL_CXXFLAGS) $(CPPDEPS) $< ! gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxlsock.o: ../../wxluasocket/src/wxlsock.cpp $(CXX) -c -o $@ $(WXLUASOCKET_DLL_CXXFLAGS) $(CPPDEPS) $< *************** *** 2164,2167 **** --- 2161,2167 ---- $(CXX) -c -o $@ $(WXLUASOCKET_DLL_CXXFLAGS) $(CPPDEPS) $< + gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\wxluasocket_dll_wxluasocket_bind.o: ../../wxluasocket/src/wxluasocket_bind.cpp + $(CXX) -c -o $@ $(WXLUASOCKET_DLL_CXXFLAGS) $(CPPDEPS) $< + gccmsw$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)\mod_luamodule_luamodule.o: ../../luamodule/src/luamodule.cpp $(CXX) -c -o $@ $(MOD_LUAMODULE_CXXFLAGS) $(CPPDEPS) $< |
From: John L. <jr...@us...> - 2008-01-09 05:00:02
|
Update of /cvsroot/wxlua/wxLua/apps In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13740/wxLua/apps Modified Files: Makefile.in Log Message: Regenerate bakefiles using frm_bakefile 1995295 bytes No changes to the bakefiles and these changes appear to only alphabetize files Index: Makefile.in =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/Makefile.in,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Makefile.in 1 Aug 2007 10:08:22 -0000 1.64 --- Makefile.in 9 Jan 2008 04:59:57 -0000 1.65 *************** *** 59,64 **** -I$(LUA_DIR)/include $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) APP_WXLUA_OBJECTS = \ - app_wxlua_wxlua.o \ app_wxlua_lconsole.o \ $(__app_wxlua___win32rc) APP_WXLUAEDIT_CXXFLAGS = -I$(top_srcdir)/modules -I./$(top_srcdir) \ --- 59,64 ---- -I$(LUA_DIR)/include $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) APP_WXLUA_OBJECTS = \ app_wxlua_lconsole.o \ + app_wxlua_wxlua.o \ $(__app_wxlua___win32rc) APP_WXLUAEDIT_CXXFLAGS = -I$(top_srcdir)/modules -I./$(top_srcdir) \ *************** *** 72,80 **** $(CPPFLAGS) $(CXXFLAGS) APP_WXLUACAN_OBJECTS = \ - app_wxluacan_wxluacan.o \ app_wxluacan_cancom.o \ - app_wxluacan_wxluacan_bind.o \ - app_wxluacan_cansim.o \ app_wxluacan_canlua.o \ $(__app_wxluacan___win32rc) APP_WXLUAFREEZE_CXXFLAGS = -I$(top_srcdir)/modules -I./$(top_srcdir) \ --- 72,80 ---- $(CPPFLAGS) $(CXXFLAGS) APP_WXLUACAN_OBJECTS = \ app_wxluacan_cancom.o \ app_wxluacan_canlua.o \ + app_wxluacan_cansim.o \ + app_wxluacan_wxluacan.o \ + app_wxluacan_wxluacan_bind.o \ $(__app_wxluacan___win32rc) APP_WXLUAFREEZE_CXXFLAGS = -I$(top_srcdir)/modules -I./$(top_srcdir) \ *************** *** 393,402 **** $(CCC) -c -o $@ $(APP_LUAC_CFLAGS) $(srcdir)/../modules/lua/src/print.c - app_wxlua_wxlua.o: $(srcdir)/wxlua/src/wxlua.cpp - $(CXXC) -c -o $@ $(APP_WXLUA_CXXFLAGS) $(srcdir)/wxlua/src/wxlua.cpp - app_wxlua_lconsole.o: $(srcdir)/wxlua/src/lconsole.cpp $(CXXC) -c -o $@ $(APP_WXLUA_CXXFLAGS) $(srcdir)/wxlua/src/lconsole.cpp app_wxlua_wxlua_rc.o: $(srcdir)/wxlua/src/wxlua.rc $(WX_RESCOMP) -i$< -o$@ --include-dir $(top_srcdir)/modules --include-dir ./$(top_srcdir) --include-dir $(LUA_DIR)/include --- 393,402 ---- $(CCC) -c -o $@ $(APP_LUAC_CFLAGS) $(srcdir)/../modules/lua/src/print.c app_wxlua_lconsole.o: $(srcdir)/wxlua/src/lconsole.cpp $(CXXC) -c -o $@ $(APP_WXLUA_CXXFLAGS) $(srcdir)/wxlua/src/lconsole.cpp + app_wxlua_wxlua.o: $(srcdir)/wxlua/src/wxlua.cpp + $(CXXC) -c -o $@ $(APP_WXLUA_CXXFLAGS) $(srcdir)/wxlua/src/wxlua.cpp + app_wxlua_wxlua_rc.o: $(srcdir)/wxlua/src/wxlua.rc $(WX_RESCOMP) -i$< -o$@ --include-dir $(top_srcdir)/modules --include-dir ./$(top_srcdir) --include-dir $(LUA_DIR)/include *************** *** 411,428 **** $(WX_RESCOMP) -i$< -o$@ --include-dir $(top_srcdir)/modules --include-dir ./$(top_srcdir) --include-dir $(LUA_DIR)/include - app_wxluacan_wxluacan.o: $(srcdir)/wxluacan/src/wxluacan.cpp - $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/wxluacan.cpp - app_wxluacan_cancom.o: $(srcdir)/wxluacan/src/cancom.cpp $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/cancom.cpp ! app_wxluacan_wxluacan_bind.o: $(srcdir)/wxluacan/src/wxluacan_bind.cpp ! $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/wxluacan_bind.cpp app_wxluacan_cansim.o: $(srcdir)/wxluacan/src/cansim.cpp $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/cansim.cpp ! app_wxluacan_canlua.o: $(srcdir)/wxluacan/src/canlua.cpp ! $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/canlua.cpp app_wxluacan_cansim_rc.o: $(srcdir)/wxluacan/src/cansim.rc --- 411,428 ---- $(WX_RESCOMP) -i$< -o$@ --include-dir $(top_srcdir)/modules --include-dir ./$(top_srcdir) --include-dir $(LUA_DIR)/include app_wxluacan_cancom.o: $(srcdir)/wxluacan/src/cancom.cpp $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/cancom.cpp ! app_wxluacan_canlua.o: $(srcdir)/wxluacan/src/canlua.cpp ! $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/canlua.cpp app_wxluacan_cansim.o: $(srcdir)/wxluacan/src/cansim.cpp $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/cansim.cpp ! app_wxluacan_wxluacan.o: $(srcdir)/wxluacan/src/wxluacan.cpp ! $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/wxluacan.cpp ! ! app_wxluacan_wxluacan_bind.o: $(srcdir)/wxluacan/src/wxluacan_bind.cpp ! $(CXXC) -c -o $@ $(APP_WXLUACAN_CXXFLAGS) $(srcdir)/wxluacan/src/wxluacan_bind.cpp app_wxluacan_cansim_rc.o: $(srcdir)/wxluacan/src/cansim.rc |
From: John L. <jr...@us...> - 2008-01-08 16:11:21
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18563/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp Log Message: Fix static %member variables and give clearer messages about errors in wxLua udata metatable functions Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** wxlbind.cpp 8 Jan 2008 06:19:53 -0000 1.113 --- wxlbind.cpp 8 Jan 2008 16:11:15 -0000 1.114 *************** *** 347,351 **** int result = 0; wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); void *obj_ptr = wxlua_touserdata(L, 1, false); --- 347,351 ---- int result = 0; wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); // fail hard void *obj_ptr = wxlua_touserdata(L, 1, false); *************** *** 355,362 **** { // 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_luaL_typename(L, 2).c_str(), lua2wx(wxlClass->name).c_str())); } ! else if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_type(L, 1) == *wxlClass->wxluatype)) { // check if we're to call the baseclass function or if it's a Lua derived function --- 355,362 ---- { // 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' wxLua type."), wxlua_luaL_typename(L, 2).c_str(), lua2wx(wxlClass->name).c_str())); } ! else if (wxluaT_type(L, 1) == *wxlClass->wxluatype) { // check if we're to call the baseclass function or if it's a Lua derived function *************** *** 385,390 **** { found = true; ! lua_remove(L, 2); // remove the name of the function ! result = (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); // } else --- 385,394 ---- { found = true; ! if (WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC)) ! lua_pop(L, 2); // remove the userdata and func name ! else ! lua_pop(L, 1); // remove the name of the function ! ! result = (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); } else *************** *** 418,424 **** { found = true; - lua_remove(L, 2); // remove the name of the function if (WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC)) ! lua_remove(L, 1); // remove the userdata result = (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); --- 422,429 ---- { found = true; if (WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC)) ! lua_pop(L, 2); // remove the userdata and func name ! else ! lua_pop(L, 1); // remove the name of the function result = (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); *************** *** 433,437 **** if (!found) { ! wxlua_error(L, wxString::Format(_("wxLua: Attempt to call an unknown method '%s' on a '%s' type."), lua2wx(name).c_str(), lua2wx(wxlClass ? wxlClass->name : "").c_str())); } --- 438,442 ---- if (!found) { ! wxlua_error(L, wxString::Format(_("wxLua: Unable to call an unknown method '%s' on a '%s' type."), lua2wx(name).c_str(), lua2wx(wxlClass ? wxlClass->name : "").c_str())); } *************** *** 447,451 **** { wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); // Lua Stack: 1 = userdata, 2 = key, 3 = value; userdata.key = value --- 452,456 ---- { wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); // fail hard // Lua Stack: 1 = userdata, 2 = key, 3 = value; userdata.key = value *************** *** 457,464 **** { // 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_luaL_typename(L, 2).c_str(), lua2wx(wxlClass->name).c_str())); } ! else if ((wxlClass != NULL) && wxlua_iswxuserdata(L, 1) && (wxluaT_type(L, 1) == *wxlClass->wxluatype)) { // See if there is a WXLUAMETHOD_SETPROP in the wxLuaBindClass's wxLuaBindMethods --- 462,469 ---- { // name is NULL if it's not a string ! wxlua_error(L, wxString::Format(_("wxLua: Attempt to call or add a class method using '%s' on a '%s' type."), wxlua_luaL_typename(L, 2).c_str(), lua2wx(wxlClass->name).c_str())); } ! else if (wxluaT_type(L, 1) == *wxlClass->wxluatype) { // See if there is a WXLUAMETHOD_SETPROP in the wxLuaBindClass's wxLuaBindMethods *************** *** 468,472 **** { found = true; ! lua_remove(L, 2); (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); } --- 473,480 ---- { found = true; ! lua_remove(L, 2); // remove the function name ! if (WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC)) ! lua_remove(L, 1); // remove the userdata too, leaving the value ! (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); } *************** *** 485,489 **** { found = true; ! lua_remove(L, 2); (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); } --- 493,500 ---- { found = true; ! lua_remove(L, 2); // remove the function name ! if (WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC)) ! lua_remove(L, 1); // remove the userdata too, leaving the value ! (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); } *************** *** 493,505 **** if (!found) { wxLuaState wxlState(L); wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); ! void *pObject = wxlua_touserdata(L, 1, false); wxLuaObject* wxlObj = new wxLuaObject(wxlState, 3); ! wxlua_setderivedmethod(L, pObject, name, wxlObj); } } return 0; } --- 504,523 ---- if (!found) { + found = true; wxLuaState wxlState(L); wxCHECK_MSG(wxlState.Ok(), 0, wxT("Invalid wxLuaState")); ! void *obj_ptr = wxlua_touserdata(L, 1, false); wxLuaObject* wxlObj = new wxLuaObject(wxlState, 3); ! wxlua_setderivedmethod(L, obj_ptr, name, wxlObj); } } + if (!found) + { + wxlua_error(L, wxString::Format(_("wxLua: Unable to call or add an unknown method '%s' on a '%s' type."), + lua2wx(name).c_str(), lua2wx(wxlClass ? wxlClass->name : "").c_str())); + } + return 0; } *************** *** 541,548 **** int LUACALL wxlua_wxLuaBindMethod_table__index(lua_State *L) { ! // 1 = table, 2 = key wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); int result = 0; --- 559,566 ---- int LUACALL wxlua_wxLuaBindMethod_table__index(lua_State *L) { ! // Lua stack: 1 = table, 2 = key wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); ! wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); // fail hard int result = 0; *************** *** 562,575 **** { lua_pop(L, 2); // remove the table and the name of the function ! result = (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); // } else { ! lua_pushvalue(L, -1); ! lua_rawget(L, -3); ! if (lua_isnil(L, -1)) ! lua_pop(L, 1); ! else ! result = 1; } --- 580,590 ---- { lua_pop(L, 2); // remove the table and the name of the function ! result = (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); } else { ! lua_pushvalue(L, -1); // copy key ! lua_rawget(L, -3); // get t[key] = value, pops key pushes value ! result = 1; // ok if nil } *************** *** 603,609 **** else { ! lua_pushvalue(L, -2); ! lua_pushvalue(L, -2); ! lua_rawset(L, -5); } --- 618,624 ---- else { ! lua_pushvalue(L, -2); // copy key ! lua_pushvalue(L, -2); // copy value ! lua_rawset(L, -5); // set t[key] = value, pops key and value } |
From: John L. <jr...@us...> - 2008-01-08 06:19:56
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23092/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp Log Message: Little bit of code cleanup Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** wxlbind.cpp 8 Jan 2008 00:55:35 -0000 1.112 --- wxlbind.cpp 8 Jan 2008 06:19:53 -0000 1.113 *************** *** 731,735 **** // We have to count the methods that are displayed to find the one that failed // since we've skipped the ones with wrong number of args. - // Since we're failing anyway, we don't need this to be fast. method = wxlMethod; int i_cfunc = 0; --- 731,734 ---- *************** *** 1121,1125 **** { // we will handle the WXLUAMETHOD_GET/SETPROP|WXLUAMETHOD_STATIC using __index and __newindex ! if (((wxlMethod->method_type & (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) == (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) && (wxlMethod->wxluacfuncs_n > 0)) { --- 1120,1124 ---- { // we will handle the WXLUAMETHOD_GET/SETPROP|WXLUAMETHOD_STATIC using __index and __newindex ! if (((wxlMethod->method_type & (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) == (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) && (wxlMethod->wxluacfuncs_n > 0)) { *************** *** 1146,1150 **** //lua_pushstring(L, "Metatable is not accessible"); //lua_rawset(L, -3); ! lua_setmetatable(L, -2); // Finalize the class table since we may not have a constructor --- 1145,1149 ---- //lua_pushstring(L, "Metatable is not accessible"); //lua_rawset(L, -3); ! lua_setmetatable(L, -2); // pops the metatable // Finalize the class table since we may not have a constructor *************** *** 1279,1283 **** const wxLuaBindEvent* wxLuaBinding::GetBindEvent(wxEventType eventType_) const { - // we've sorted this, see InitBinding() const wxEventType eventType = eventType_; wxLuaBindEvent eventItem = { "", &eventType, NULL }; --- 1278,1281 ---- *************** *** 1310,1314 **** wxLuaBindClassArrayCompareBywxLuaType); ! return wxlClass; // maybe NULL if wxluatype not found } --- 1308,1312 ---- wxLuaBindClassArrayCompareBywxLuaType); ! return wxlClass; } *************** *** 1325,1329 **** wxLuaBindClassArrayCompareFn); ! return wxlClass; // maybe NULL if wxluatype not found } --- 1323,1327 ---- wxLuaBindClassArrayCompareFn); ! return wxlClass; } *************** *** 1575,1582 **** } - // found base class in binding? - //if (basebinding->SetBaseClass(wxlClass)) - // break; - basenode = basenode->GetNext(); } --- 1573,1576 ---- *************** *** 1592,1598 **** while (node) { ! wxLuaBinding* binding = node->GetData(); wxLuaBindClass* wxlClass = binding->GetClassArray(); ! size_t i, class_count = binding->GetClassCount(); for (i = 0; i < class_count; ++i, ++wxlClass) --- 1586,1592 ---- while (node) { ! wxLuaBinding* binding = node->GetData(); wxLuaBindClass* wxlClass = binding->GetClassArray(); ! size_t i, class_count = binding->GetClassCount(); for (i = 0; i < class_count; ++i, ++wxlClass) *************** *** 1643,1662 **** sm_bindingList_initialized = true; } - - bool wxLuaBinding::SetBaseClass(wxLuaBindClass *wxlClass) - { - if (!wxlClass->baseclassName) // check if there is a baseclassName at all - return false; - - wxLuaBindClass* baseClass = m_classArray; // potential base class - for (size_t n = 0; n < m_classCount; ++n, ++baseClass) - { - if (strcmp(baseClass->name, wxlClass->baseclassName) == 0) - { - wxlClass->baseclass = baseClass; - return true; - } - } - - return false; - } --- 1637,1638 ---- Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** wxlcallb.cpp 4 Jan 2008 00:21:08 -0000 1.55 --- wxlcallb.cpp 8 Jan 2008 06:19:53 -0000 1.56 *************** *** 74,80 **** m_luafunc_ref = m_wxlState.wxluaR_Ref(lua_func_stack_idx, &wxlua_lreg_refs_key); ! // Note: We use the callback userdata and not the event sink since the event sink // requires a wxEvtHandler object which is a fairly large class. ! // The userdata is also deleted for us which makes m_evtHandler->Connect(win_id, last_id, eventType, (wxObjectEventFunction)&wxLuaEventCallback::OnAllEvents, --- 74,80 ---- m_luafunc_ref = m_wxlState.wxluaR_Ref(lua_func_stack_idx, &wxlua_lreg_refs_key); ! // Note: We use the callback userdata and not the event sink since the event sink // requires a wxEvtHandler object which is a fairly large class. ! // The userdata is also deleted for us which makes m_evtHandler->Connect(win_id, last_id, eventType, (wxObjectEventFunction)&wxLuaEventCallback::OnAllEvents, *************** *** 100,104 **** wxEventType evtType = event.GetEventType(); ! // Get the wxLuaEventCallback instance to use which is NOT "this" since // "this" is a central event handler function. i.e. this != theCallback wxLuaEventCallback *theCallback = (wxLuaEventCallback *)event.m_callbackUserData; --- 100,104 ---- wxEventType evtType = event.GetEventType(); ! // Get the wxLuaEventCallback instance to use which is NOT "this" since // "this" is a central event handler function. i.e. this != theCallback wxLuaEventCallback *theCallback = (wxLuaEventCallback *)event.m_callbackUserData; *************** *** 163,168 **** if (wxlState.lua_SetFenv(-2) != 0) { ! // Don't track the wxEvent since we don't own it and tracking it ! // causes clashes in the object registry table since many can be // created and deleted and the mem address is resused by C++. wxlState.wxluaT_PushUserDataType(event, event_wxl_type, false); --- 163,168 ---- if (wxlState.lua_SetFenv(-2) != 0) { ! // Don't track the wxEvent since we don't own it and tracking it ! // causes clashes in the object registry table since many can be // created and deleted and the mem address is resused by C++. wxlState.wxluaT_PushUserDataType(event, event_wxl_type, false); |
From: John L. <jr...@us...> - 2008-01-08 06:19:56
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23092/wxLua/modules/wxlua/include Modified Files: wxlbind.h Log Message: Little bit of code cleanup Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** wxlbind.h 4 Jan 2008 00:21:08 -0000 1.77 --- wxlbind.h 8 Jan 2008 06:19:53 -0000 1.78 *************** *** 73,77 **** // Copies of wxLua types that are used very often. ! // Note that we do not use the original since we may not be linked // to the binding library that defines them. extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_NULL; // wxLua type for NULL pointer --- 73,77 ---- // Copies of wxLua types that are used very often. ! // Note that we do not use the original since we may not be linked // to the binding library that defines them. extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_NULL; // wxLua type for NULL pointer *************** *** 207,211 **** // registered since the base class may be from // a different module (a library perhaps). - // See wxLuaBinding::SetBaseClass() wxLuaBindNumber* enums; // Class member enums or NULL if none --- 207,210 ---- *************** *** 247,251 **** // wxLuaObject - Wraps a reference to a Lua object reference inside a // wxObject-derived class so that a Lua object can be used for userdata. ! // Also with a simple extension by a proxy member value it can be used // to provide pointers to the wxValidator classes. // ---------------------------------------------------------------------------- --- 246,250 ---- // wxLuaObject - Wraps a reference to a Lua object reference inside a // wxObject-derived class so that a Lua object can be used for userdata. ! // Also with a simple extension by a proxy member value it can be used // to provide pointers to the wxValidator classes. // ---------------------------------------------------------------------------- *************** *** 277,281 **** // You cannot call this after calling GetXXXPtr(), but only if this wraps a // stack item. ! void SetObject(int stack_idx = 1); // The following methods are used by the wxValidator interface --- 276,280 ---- // You cannot call this after calling GetXXXPtr(), but only if this wraps a // stack item. ! void SetObject(int stack_idx); // The following methods are used by the wxValidator interface *************** *** 375,379 **** void operator = (int *intArr) { m_intArr = intArr; } ! operator int *() { return m_intArr; } private: --- 374,378 ---- void operator = (int *intArr) { m_intArr = intArr; } ! operator int *() { return m_intArr; } // Note: not const for wxGLCanvas private: *************** *** 582,591 **** static void InitAllBindings(bool force_update = false); - // Look for the base class of the input wxLuaBindClass in this binding using the - // baseclassName of the input and if found, set the wxLuaBindClass::baseclass - // member of the input. - // This is called by InitAllBindings() by the wxLuaState and should not be called afterwards. - bool SetBaseClass(wxLuaBindClass* wxlClass); - protected: void InitBinding(); // must called after subclassed version is created --- 581,584 ---- |
From: John L. <jr...@us...> - 2008-01-08 00:55:39
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13069/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Allow "%member static int m_var" to work Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** wxlstate.cpp 7 Jan 2008 19:55:26 -0000 1.160 --- wxlstate.cpp 8 Jan 2008 00:55:35 -0000 1.161 *************** *** 656,660 **** // check if they've dynamic casted the object or if it was casted in C++ ! if (wxlua_iswxuserdata(L, -1) && (wxl_type == wxluaT_type(L, -1))) { if (push_on_stack) --- 656,660 ---- // check if they've dynamic casted the object or if it was casted in C++ ! if (wxl_type == wxluaT_type(L, -1)) { if (push_on_stack) Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** wxlbind.cpp 4 Jan 2008 00:21:08 -0000 1.111 --- wxlbind.cpp 8 Jan 2008 00:55:35 -0000 1.112 *************** *** 335,339 **** // for class instances. ! // Lua stack : 1 = userdata, 2 = "FuncName" // You cannot seem to get the calling convention (. or :) or if it was // called as a function() or a .member? --- 335,339 ---- // for class instances. ! // Lua stack : 1 = userdata, 2 = key; userdata:key() // You cannot seem to get the calling convention (. or :) or if it was // called as a function() or a .member? *************** *** 344,348 **** wxlua_setcallbaseclassfunction(L, false); - bool callbase = false; bool found = false; int result = 0; --- 344,347 ---- *************** *** 350,370 **** wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); - // // See if the function or value is in our metatable - // if (lua_getmetatable(L, 1)) - // { - // lua_pushvalue(L, 2); - // lua_rawget(L, -2); - // - // if (!lua_isnil(L, -1)) - // { - // found = true; - // result = 1; - // lua_remove(L, -2); // remove metatable, leave value - // return result; - // } - // else - // lua_pop(L, 2); // pop nil and metatable - // } - void *obj_ptr = wxlua_touserdata(L, 1, false); const char *name = lua_tostring(L, 2); // name of the __index method called in Lua --- 349,352 ---- *************** *** 379,396 **** { // check if we're to call the baseclass function or if it's a Lua derived function ! if (!found) ! { ! callbase = (name[0] == '_'); ! if (callbase) ! name++; // skip past "_"[FunctionName] ! else { ! // 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 ! } } } --- 361,375 ---- { // check if we're to call the baseclass function or if it's a Lua derived function ! bool callbase = (name[0] == '_'); ! if (callbase) ! name++; // skip past "_"[FunctionName] ! else ! { ! // 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 } } *************** *** 470,474 **** wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); ! // Lua Stack 1 = userdata, 2 = key, 3 = value; userdata.key = value const char *name = lua_tostring(L, 2); --- 449,453 ---- wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); ! // Lua Stack: 1 = userdata, 2 = key, 3 = value; userdata.key = value const char *name = lua_tostring(L, 2); *************** *** 560,563 **** --- 539,614 ---- } + int LUACALL wxlua_wxLuaBindMethod_table__index(lua_State *L) + { + // 1 = table, 2 = key + + wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); + wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); + + int result = 0; + + const char* name = lua_tostring(L, 2); + if (!name) + { + // name is NULL if it's not a string + wxlua_error(L, wxString::Format(_("wxLua: Attempt to call a static class method using '%s' on a '%s' type."), + wxlua_luaL_typename(L, 2).c_str(), lua2wx(wxlClass->name).c_str())); + return 0; + } + + wxLuaBindMethod* wxlMethod = wxLuaBinding::GetClassMethod(wxlClass, name, WXLUAMETHOD_GETPROP, true); + + if (wxlMethod && WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC)) + { + lua_pop(L, 2); // remove the table and the name of the function + result = (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); // + } + else + { + lua_pushvalue(L, -1); + lua_rawget(L, -3); + if (lua_isnil(L, -1)) + lua_pop(L, 1); + else + result = 1; + } + + return result; + } + + int LUACALL wxlua_wxLuaBindMethod_table__newindex(lua_State *L) + { + // 1 = table, 2 = key, 3 = value + + wxLuaBindClass *wxlClass = (wxLuaBindClass *)lua_touserdata(L, lua_upvalueindex(1)); + wxCHECK_MSG(wxlClass, 0, wxT("Invalid wxLuaBindClass")); + + const char* name = lua_tostring(L, 2); + if (!name) + { + // name is NULL if it's not a string + wxlua_error(L, wxString::Format(_("wxLua: Attempt to call a static class method using '%s' on a '%s' type."), + wxlua_luaL_typename(L, 2).c_str(), lua2wx(wxlClass->name).c_str())); + return 0; + } + + wxLuaBindMethod* wxlMethod = wxLuaBinding::GetClassMethod(wxlClass, name, WXLUAMETHOD_SETPROP, true); + + if (wxlMethod && WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC)) + { + lua_remove(L, 2); // remove the key + lua_remove(L, 1); // remove the table + (*wxlMethod->wxluacfuncs[0].lua_cfunc)(L); + } + else + { + lua_pushvalue(L, -2); + lua_pushvalue(L, -2); + lua_rawset(L, -5); + } + + return 0; + } + // ---------------------------------------------------------------------------- // Central function to call for overloaded functions *************** *** 1069,1073 **** for (int i_static_method = 0; i_static_method < method_count; ++i_static_method, ++wxlMethod) { ! if (WXLUA_HASBIT(wxlMethod->method_type, WXLUAMETHOD_STATIC) && wxlMethod->wxluacfuncs_n) { lua_pushstring(L, wxlMethod->name); --- 1120,1126 ---- for (int i_static_method = 0; i_static_method < method_count; ++i_static_method, ++wxlMethod) { ! // we will handle the WXLUAMETHOD_GET/SETPROP|WXLUAMETHOD_STATIC using __index and __newindex ! if (((wxlMethod->method_type & (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) == (WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC)) && ! (wxlMethod->wxluacfuncs_n > 0)) { lua_pushstring(L, wxlMethod->name); *************** *** 1078,1081 **** --- 1131,1151 ---- } + // Create a metatable for the "class" table + lua_newtable(L); + lua_pushlstring(L, "__index", 7); + lua_pushlightuserdata(L, wxlClass); + lua_pushcclosure(L, wxlua_wxLuaBindMethod_table__index, 1); + lua_rawset(L, -3); + + lua_pushlstring(L, "__newindex", 10); + lua_pushlightuserdata(L, wxlClass); + lua_pushcclosure(L, wxlua_wxLuaBindMethod_table__newindex, 1); + lua_rawset(L, -3); + + //lua_pushstring(L, "__metatable"); + //lua_pushstring(L, "Metatable is not accessible"); + //lua_rawset(L, -3); + lua_setmetatable(L, -2); + // Finalize the class table since we may not have a constructor // or have multiple constructors. *************** *** 1107,1112 **** lua_rawset(L, -3); ! // Create the metatable for this table ! lua_newtable(L); lua_pushlstring(L, "__call", 6); --- 1177,1183 ---- lua_rawset(L, -3); ! // Add __call to the metatable for this table ! bool has_meta = (lua_getmetatable(L, -1) != 0); ! if (!has_meta) lua_newtable(L); lua_pushlstring(L, "__call", 6); *************** *** 1119,1123 **** //lua_rawset(L, -3); ! lua_setmetatable(L, -2); // add table to the binding table t[wxlMethod->name] = { this table } --- 1190,1197 ---- //lua_rawset(L, -3); ! if (!has_meta) ! lua_setmetatable(L, -2); ! else ! lua_pop(L, 1); // add table to the binding table t[wxlMethod->name] = { this table } |
From: John L. <jr...@us...> - 2008-01-08 00:55:39
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13069/wxLua/samples Modified Files: controls.wx.lua Log Message: Allow "%member static int m_var" to work Index: controls.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/controls.wx.lua,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** controls.wx.lua 22 Dec 2007 06:07:17 -0000 1.14 --- controls.wx.lua 8 Jan 2008 00:55:36 -0000 1.15 *************** *** 806,810 **** taskbarIcon:SetIcon(icon, "Tooltop for wxTaskBarIcon from controls.wx.lua") icon:delete() ! AddControl("wxTextCtrl", p, taskbarIcon) end --- 806,810 ---- taskbarIcon:SetIcon(icon, "Tooltop for wxTaskBarIcon from controls.wx.lua") icon:delete() ! AddControl("wxTaskBarIcon", p, taskbarIcon) end |
From: John L. <jr...@us...> - 2008-01-08 00:55:39
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13069/wxLua/bindings Modified Files: genwxbind.lua Log Message: Allow "%member static int m_var" to work Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** genwxbind.lua 22 Dec 2007 06:07:07 -0000 1.157 --- genwxbind.lua 8 Jan 2008 00:55:35 -0000 1.158 *************** *** 2239,2242 **** --- 2239,2245 ---- lineState.ActionMandatory = true + elseif tag == "static" then + lineState.IsStaticFunction = true + elseif IsDelimiter(tag) or functionAttribTable[tag] then print("ERROR: Expected Member Name, got Tag='"..tag.."'. "..LineTableErrString(lineTable)) *************** *** 2717,2720 **** --- 2720,2730 ---- end + local funcType = "WXLUAMETHOD_METHOD" + local propType = "" + if member.IsStaticFunction then + funcType = "WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC" + propType = "|WXLUAMETHOD_STATIC" + end + local memberPtr = member.DataTypePointer[1] local indirectionCount = #member.DataTypePointer *************** *** 2746,2757 **** CommentBindingTable(codeList, "// "..interface.lineData[member.LineNumber].LineText.."\n") table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! table.insert(codeList, " wxLuaState wxlState(L);\n") ! CommentBindingTable(codeList, " // get this\n") ! table.insert(codeList, " "..parseObject.Name.." *self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, g_wxluatype_"..MakeClassVar(parseObject.Name)..");\n") ! overload_argList = "&g_wxluatype_"..MakeClassVar(parseObject.Name)..", "..overload_argList if memberType == "wxString" then CommentBindingTable(codeList, " // push the result string\n") ! table.insert(codeList, " wxlua_pushwxString(L, self->"..member.Name..");\n") elseif not numeric and (not memberPtr or (memberPtr == "&")) then CommentBindingTable(codeList, " // push the result datatype\n") --- 2756,2772 ---- CommentBindingTable(codeList, "// "..interface.lineData[member.LineNumber].LineText.."\n") table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! ! local self_name = "self->" ! if member.IsStaticFunction then ! self_name = parseObject.Name.."::" ! else ! CommentBindingTable(codeList, " // get this\n") ! table.insert(codeList, " "..parseObject.Name.." *self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, g_wxluatype_"..MakeClassVar(parseObject.Name)..");\n") ! overload_argList = "&g_wxluatype_"..MakeClassVar(parseObject.Name)..", "..overload_argList ! end if memberType == "wxString" then CommentBindingTable(codeList, " // push the result string\n") ! table.insert(codeList, " wxlua_pushwxString(L, "..self_name..member.Name..");\n") elseif not numeric and (not memberPtr or (memberPtr == "&")) then CommentBindingTable(codeList, " // push the result datatype\n") *************** *** 2760,2776 **** -- table.insert(codeList, " wxluaT_pushuserdatatype(L, "..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") -- else ! table.insert(codeList, " wxluaT_pushuserdatatype(L, &self->"..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") -- end elseif not numeric then CommentBindingTable(codeList, " // push the result datatype\n") ! table.insert(codeList, " wxluaT_pushuserdatatype(L, self->"..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif (memberType == "BOOL") or (memberType == "bool") then CommentBindingTable(codeList, " // push the result flag\n") ! table.insert(codeList, " lua_pushboolean(L, self->"..member.Name..");\n") else CommentBindingTable(codeList, " // push the result number\n") ! table.insert(codeList, " lua_pushnumber(L, self->"..member.Name..");\n") end --- 2775,2791 ---- -- table.insert(codeList, " wxluaT_pushuserdatatype(L, "..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") -- else ! table.insert(codeList, " wxluaT_pushuserdatatype(L, &"..self_name..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") -- end elseif not numeric then CommentBindingTable(codeList, " // push the result datatype\n") ! table.insert(codeList, " wxluaT_pushuserdatatype(L, "..self_name..member.Name..", g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif (memberType == "BOOL") or (memberType == "bool") then CommentBindingTable(codeList, " // push the result flag\n") ! table.insert(codeList, " lua_pushboolean(L, "..self_name..member.Name..");\n") else CommentBindingTable(codeList, " // push the result number\n") ! table.insert(codeList, " lua_pushnumber(L, "..self_name..member.Name..");\n") end *************** *** 2798,2805 **** ArgArray = overload_argList, ArgArrayName = overload_argListName, ! FuncType = "WXLUAMETHOD_METHOD", ! FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD, 1, 1, "..overload_argListName.." }", FuncMapName = funcMapName, ! Map = " { \""..memberGetFunc.."\", WXLUAMETHOD_METHOD, "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2813,2820 ---- ArgArray = overload_argList, ArgArrayName = overload_argListName, ! FuncType = funcType, ! FuncMap = "{ "..funcName..", "..funcType..", 1, 1, "..overload_argListName.." }", FuncMapName = funcMapName, ! Map = " { \""..memberGetFunc.."\", "..funcType..", "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2809,2814 **** { LuaName = member.Name, ! FuncType = "WXLUAMETHOD_GETPROP", ! Map = " { \""..member.Name.."\", WXLUAMETHOD_GETPROP, "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2824,2829 ---- { LuaName = member.Name, ! FuncType = "WXLUAMETHOD_GETPROP"..propType, ! Map = " { \""..member.Name.."\", WXLUAMETHOD_GETPROP"..propType..", "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2836,2875 **** CommentBindingTable(codeList, "// "..interface.lineData[member.LineNumber].LineText.."\n") table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! table.insert(codeList, " wxLuaState wxlState(L);\n") if memberType == "wxString" then overload_argList = overload_argList.."&g_wxluatype_TSTRING, " CommentBindingTable(codeList, " // get the string value\n") ! table.insert(codeList, " wxString val = wxlua_getwxStringtype(L, 2);\n") elseif not numeric and (not memberPtr or (memberPtr == "&")) then overload_argList = overload_argList.."&g_wxluatype_"..MakeClassVar(memberType)..", " CommentBindingTable(codeList, " // get the data type value\n") ! table.insert(codeList, " "..memberType.."* val = ("..memberType.."*)wxluaT_getuserdatatype(L, 2, g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif not numeric then overload_argList = overload_argList.."&g_wxluatype_"..MakeClassVar(memberType)..", " CommentBindingTable(codeList, " // get the data type value\n") ! table.insert(codeList, " "..memberType.."* val = ("..memberType.."*)wxluaT_getuserdatatype(L, 2, g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif (memberType == "BOOL") or (memberType == "bool") then overload_argList = overload_argList.."&g_wxluatype_TBOOLEAN, " CommentBindingTable(codeList, " // get the boolean value\n") ! table.insert(codeList, " bool val = wxlua_getbooleantype(L, 2);\n") elseif IsDataTypeEnum(memberType) then overload_argList = overload_argList.."&g_wxluatype_TINTEGER, " CommentBindingTable(codeList, " // get the number value\n") ! table.insert(codeList, " "..memberType.." val = ("..memberType..")wxlua_getintegertype(L, 2);\n") else overload_argList = overload_argList.."&g_wxluatype_TNUMBER, " CommentBindingTable(codeList, " // get the number value\n") ! table.insert(codeList, " "..memberType.." val = ("..memberType..")wxlua_getnumbertype(L, 2);\n") end ! CommentBindingTable(codeList, " // get this\n") ! table.insert(codeList, " "..parseObject.Name.." *self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, g_wxluatype_"..MakeClassVar(parseObject.Name)..");\n") ! overload_argList = "&g_wxluatype_"..MakeClassVar(parseObject.Name)..", "..overload_argList ! ! if not numeric and (not memberPtr or (memberPtr == "&")) then ! table.insert(codeList, " self->"..member.Name.." = *val;\n") else ! table.insert(codeList, " self->"..member.Name.." = val;\n") end --- 2851,2899 ---- CommentBindingTable(codeList, "// "..interface.lineData[member.LineNumber].LineText.."\n") table.insert(codeList, "static int LUACALL "..funcName.."(lua_State *L)\n{\n") ! ! local stack_idx = iff(member.IsStaticFunction, "1", "2") if memberType == "wxString" then overload_argList = overload_argList.."&g_wxluatype_TSTRING, " CommentBindingTable(codeList, " // get the string value\n") ! table.insert(codeList, " wxString val = wxlua_getwxStringtype(L, "..stack_idx..");\n") elseif not numeric and (not memberPtr or (memberPtr == "&")) then overload_argList = overload_argList.."&g_wxluatype_"..MakeClassVar(memberType)..", " CommentBindingTable(codeList, " // get the data type value\n") ! table.insert(codeList, " "..memberType.."* val = ("..memberType.."*)wxluaT_getuserdatatype(L, "..stack_idx..", g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif not numeric then overload_argList = overload_argList.."&g_wxluatype_"..MakeClassVar(memberType)..", " CommentBindingTable(codeList, " // get the data type value\n") ! table.insert(codeList, " "..memberType.."* val = ("..memberType.."*)wxluaT_getuserdatatype(L, "..stack_idx..", g_wxluatype_"..MakeClassVar(memberType)..");\n") elseif (memberType == "BOOL") or (memberType == "bool") then overload_argList = overload_argList.."&g_wxluatype_TBOOLEAN, " CommentBindingTable(codeList, " // get the boolean value\n") ! table.insert(codeList, " bool val = wxlua_getbooleantype(L, "..stack_idx..");\n") elseif IsDataTypeEnum(memberType) then overload_argList = overload_argList.."&g_wxluatype_TINTEGER, " CommentBindingTable(codeList, " // get the number value\n") ! table.insert(codeList, " "..memberType.." val = ("..memberType..")wxlua_getintegertype(L, "..stack_idx..");\n") else overload_argList = overload_argList.."&g_wxluatype_TNUMBER, " CommentBindingTable(codeList, " // get the number value\n") ! table.insert(codeList, " "..memberType.." val = ("..memberType..")wxlua_getnumbertype(L, "..stack_idx..");\n") end ! if member.IsStaticFunction then ! if not numeric and (not memberPtr or (memberPtr == "&")) then ! table.insert(codeList, " "..parseObject.Name.."::"..member.Name.." = *val;\n") ! else ! table.insert(codeList, " "..parseObject.Name.."::"..member.Name.." = val;\n") ! end else ! CommentBindingTable(codeList, " // get this\n") ! table.insert(codeList, " "..parseObject.Name.." *self = ("..parseObject.Name.." *)wxluaT_getuserdatatype(L, 1, g_wxluatype_"..MakeClassVar(parseObject.Name)..");\n") ! overload_argList = "&g_wxluatype_"..MakeClassVar(parseObject.Name)..", "..overload_argList ! ! if not numeric and (not memberPtr or (memberPtr == "&")) then ! table.insert(codeList, " self->"..member.Name.." = *val;\n") ! else ! table.insert(codeList, " self->"..member.Name.." = val;\n") ! end end *************** *** 2897,2904 **** ArgArray = overload_argList, ArgArrayName = overload_argListName, ! FuncType = "WXLUAMETHOD_METHOD", ! FuncMap = "{ "..funcName..", WXLUAMETHOD_METHOD, 2, 2, "..overload_argListName.." }", -- FIXME make sure this is right FuncMapName = funcMapName, ! Map = " { \""..memberSetFunc.."\", WXLUAMETHOD_METHOD, "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2921,2928 ---- ArgArray = overload_argList, ArgArrayName = overload_argListName, ! FuncType = funcType, ! FuncMap = "{ "..funcName..", "..funcType..", 2, 2, "..overload_argListName.." }", -- FIXME make sure this is right FuncMapName = funcMapName, ! Map = " { \""..memberSetFunc.."\", "..funcType..", "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 2908,2913 **** { LuaName = member.Name, ! FuncType = "WXLUAMETHOD_SETPROP", ! Map = " { \""..member.Name.."\", WXLUAMETHOD_SETPROP, "..funcMapName..", 1, NULL },\n", Condition = membercondition } --- 2932,2937 ---- { LuaName = member.Name, ! FuncType = "WXLUAMETHOD_SETPROP"..propType, ! Map = " { \""..member.Name.."\", WXLUAMETHOD_SETPROP"..propType..", "..funcMapName..", 1, NULL },\n", Condition = membercondition } *************** *** 4848,4852 **** if not rulesFilename then print("ERROR: No rules filename set!") ! rulesFilename = "" end --- 4872,4876 ---- if not rulesFilename then print("ERROR: No rules filename set!") ! do return end end *************** *** 4856,4859 **** --- 4880,4886 ---- print("Loaded rules file: "..rulesFilename) CheckRules() + else + print("ERROR: Unable to load rules file: '"..tostring(rulesFilename).."'") + do return end end *************** *** 4866,4870 **** print("Loaded datatypes cache file: "..filename) else ! print("ERROR: Unable to load datatypes cache file: "..filename) end end --- 4893,4897 ---- print("Loaded datatypes cache file: "..filename) else ! print("ERROR: Unable to load datatypes cache file: '"..filename.."'") end end |
From: John L. <jr...@us...> - 2008-01-08 00:55:39
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13069/wxLua/modules/wxbind/src Modified Files: wxadv_adv.cpp wxcore_print.cpp wxcore_wxlprint.cpp Log Message: Allow "%member static int m_var" to work Index: wxcore_wxlprint.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_wxlprint.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxcore_wxlprint.cpp 22 Dec 2007 06:07:14 -0000 1.6 --- wxcore_wxlprint.cpp 8 Jan 2008 00:55:35 -0000 1.7 *************** *** 31,34 **** --- 31,36 ---- // ---------------------------------------------------------------------------- + int wxLuaPrintout::ms_test_int = -1; + IMPLEMENT_ABSTRACT_CLASS(wxLuaPrintout, wxPrintout) Index: wxadv_adv.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxadv_adv.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxadv_adv.cpp 22 Dec 2007 06:07:11 -0000 1.10 --- wxadv_adv.cpp 8 Jan 2008 00:55:35 -0000 1.11 *************** *** 5300,5303 **** --- 5300,5324 ---- #endif // (wxCHECK_VERSION(2,4,0)) && (wxLUA_USE_wxTaskBarIcon && defined (wxHAS_TASK_BAR_ICON )) + #if (wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxTaskBarIcon && defined (wxHAS_TASK_BAR_ICON )) + static wxLuaArgType s_wxluatypeArray_wxLua_wxTaskBarIcon_PopupMenu[] = { &g_wxluatype_wxTaskBarIcon, &g_wxluatype_wxMenu, NULL }; + static int LUACALL wxLua_wxTaskBarIcon_PopupMenu(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxTaskBarIcon_PopupMenu[1] = {{ wxLua_wxTaskBarIcon_PopupMenu, WXLUAMETHOD_METHOD, 2, 2, s_wxluatypeArray_wxLua_wxTaskBarIcon_PopupMenu }}; + // virtual bool PopupMenu(wxMenu* menu) + static int LUACALL wxLua_wxTaskBarIcon_PopupMenu(lua_State *L) + { + // wxMenu menu + wxMenu * menu = (wxMenu *)wxluaT_getuserdatatype(L, 2, g_wxluatype_wxMenu); + // get this + wxTaskBarIcon * self = (wxTaskBarIcon *)wxluaT_getuserdatatype(L, 1, g_wxluatype_wxTaskBarIcon); + // call PopupMenu + bool returns = (self->PopupMenu(menu)); + // push the result flag + lua_pushboolean(L, returns); + + return 1; + } + + #endif // (wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxTaskBarIcon && defined (wxHAS_TASK_BAR_ICON )) + static wxLuaArgType s_wxluatypeArray_wxLua_wxTaskBarIcon_RemoveIcon[] = { &g_wxluatype_wxTaskBarIcon, NULL }; static int LUACALL wxLua_wxTaskBarIcon_RemoveIcon(lua_State *L); *************** *** 5369,5372 **** --- 5390,5397 ---- #endif // (wxCHECK_VERSION(2,4,0)) && (wxLUA_USE_wxTaskBarIcon && defined (wxHAS_TASK_BAR_ICON )) + #if (wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxTaskBarIcon && defined (wxHAS_TASK_BAR_ICON )) + { "PopupMenu", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTaskBarIcon_PopupMenu, 1, NULL }, + #endif // (wxLUA_USE_wxMenu && wxUSE_MENUS) && (wxLUA_USE_wxTaskBarIcon && defined (wxHAS_TASK_BAR_ICON )) + { "RemoveIcon", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxTaskBarIcon_RemoveIcon, 1, NULL }, Index: wxcore_print.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_print.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wxcore_print.cpp 22 Dec 2007 06:07:14 -0000 1.10 --- wxcore_print.cpp 8 Jan 2008 00:55:35 -0000 1.11 *************** *** 358,361 **** --- 358,372 ---- } + static int LUACALL wxLua_wxLuaPrintout_Get_ms_test_int(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaPrintout_Get_ms_test_int[1] = {{ wxLua_wxLuaPrintout_Get_ms_test_int, WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, 1, 1, g_wxluaargtypeArray_None }}; + // %member static int ms_test_int + static int LUACALL wxLua_wxLuaPrintout_Get_ms_test_int(lua_State *L) + { + // push the result number + lua_pushnumber(L, wxLuaPrintout::ms_test_int); + // return the number of values + return 1; + } + static wxLuaArgType s_wxluatypeArray_wxLua_wxLuaPrintout_SetPageInfo[] = { &g_wxluatype_wxLuaPrintout, &g_wxluatype_TNUMBER, &g_wxluatype_TNUMBER, &g_wxluatype_TNUMBER, &g_wxluatype_TNUMBER, NULL }; static int LUACALL wxLua_wxLuaPrintout_SetPageInfo(lua_State *L); *************** *** 382,385 **** --- 393,409 ---- } + static wxLuaArgType s_wxluatypeArray_wxLua_wxLuaPrintout_Set_ms_test_int[] = { &g_wxluatype_TNUMBER, NULL }; + static int LUACALL wxLua_wxLuaPrintout_Set_ms_test_int(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxLuaPrintout_Set_ms_test_int[1] = {{ wxLua_wxLuaPrintout_Set_ms_test_int, WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, 2, 2, s_wxluatypeArray_wxLua_wxLuaPrintout_Set_ms_test_int }}; + // %member static int ms_test_int + static int LUACALL wxLua_wxLuaPrintout_Set_ms_test_int(lua_State *L) + { + // get the number value + int val = (int)wxlua_getnumbertype(L, 1); + wxLuaPrintout::ms_test_int = val; + // return the number of values + return 0; + } + static wxLuaArgType s_wxluatypeArray_wxLua_wxLuaPrintout_TestVirtualFunctionBinding[] = { &g_wxluatype_wxLuaPrintout, &g_wxluatype_TSTRING, NULL }; static int LUACALL wxLua_wxLuaPrintout_TestVirtualFunctionBinding(lua_State *L); *************** *** 435,441 **** --- 459,469 ---- wxLuaBindMethod wxLuaPrintout_methods[] = { { "GetID", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaPrintout_GetID, 1, NULL }, + // %member { "Get_ms_test_int", WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, s_wxluafunc_wxLua_wxLuaPrintout_Get_ms_test_int, 1, NULL }, { "SetPageInfo", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaPrintout_SetPageInfo, 1, NULL }, + // %member { "Set_ms_test_int", WXLUAMETHOD_METHOD|WXLUAMETHOD_STATIC, s_wxluafunc_wxLua_wxLuaPrintout_Set_ms_test_int, 1, NULL }, { "TestVirtualFunctionBinding", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxLuaPrintout_TestVirtualFunctionBinding, 1, NULL }, { "delete", WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, s_wxluafunc_wxLua_wxLuaPrintout_delete, 1, NULL }, + { "ms_test_int", WXLUAMETHOD_SETPROP|WXLUAMETHOD_STATIC, s_wxluafunc_wxLua_wxLuaPrintout_Set_ms_test_int, 1, NULL }, + { "ms_test_int", WXLUAMETHOD_GETPROP|WXLUAMETHOD_STATIC, s_wxluafunc_wxLua_wxLuaPrintout_Get_ms_test_int, 1, NULL }, { "wxLuaPrintout", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxLuaPrintout_constructor, 1, NULL }, |
From: John L. <jr...@us...> - 2008-01-08 00:55:38
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13069/wxLua/modules/wxbind/include Modified Files: wxcore_wxlprint.h Log Message: Allow "%member static int m_var" to work Index: wxcore_wxlprint.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/include/wxcore_wxlprint.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxcore_wxlprint.h 10 Dec 2007 05:39:06 -0000 1.3 --- wxcore_wxlprint.h 8 Jan 2008 00:55:35 -0000 1.4 *************** *** 47,50 **** --- 47,51 ---- // Dummy test function to directly verify that the binding virtual functions really work. virtual wxString TestVirtualFunctionBinding(const wxString& val); + static int ms_test_int; private: |
From: John L. <jr...@us...> - 2008-01-08 00:55:38
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13069/wxLua/bindings/wxwidgets Modified Files: wxadv_adv.i wxcore_print.i Log Message: Allow "%member static int m_var" to work Index: wxcore_print.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_print.i,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxcore_print.i 18 Dec 2007 01:03:32 -0000 1.3 --- wxcore_print.i 8 Jan 2008 00:55:35 -0000 1.4 *************** *** 85,88 **** --- 85,90 ---- virtual wxString TestVirtualFunctionBinding(const wxString& val) // { return val + wxT("-Base"); } + %member static int ms_test_int + %endclass Index: wxadv_adv.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxadv_adv.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxadv_adv.i 10 Dec 2007 05:39:05 -0000 1.2 --- wxadv_adv.i 8 Jan 2008 00:55:35 -0000 1.3 *************** *** 598,602 **** bool IsIconInstalled() %wxchkver_2_4 bool IsOk() ! // virtual bool PopupMenu(wxMenu* menu) // call RemoveIcon() or delete this if you want your program to exit, must have called SetIcon() --- 598,602 ---- bool IsIconInstalled() %wxchkver_2_4 bool IsOk() ! virtual bool PopupMenu(wxMenu* menu) // call RemoveIcon() or delete this if you want your program to exit, must have called SetIcon() |
From: John L. <jr...@us...> - 2008-01-07 19:55:29
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11837/modules/wxlua/src Modified Files: wxlstate.cpp Log Message: Pop userdata that is the wrong type in wxluaO_istrackedweakobject Hopefully fixes: [wxlua-users] wrap acces violation Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** wxlstate.cpp 5 Jan 2008 00:15:46 -0000 1.159 --- wxlstate.cpp 7 Jan 2008 19:55:26 -0000 1.160 *************** *** 668,674 **** return true; } } ! lua_pop(L, 2); // pop the table and the nil. return false; } --- 668,676 ---- return true; } + else + lua_pop(L, 1); // pop the userdata that is not the right type } ! lua_pop(L, 2); // pop the weakobj table and the nil. return false; } |
From: John L. <jr...@us...> - 2008-01-07 19:11:16
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21524/bindings Modified Files: genwxbind.bat Log Message: Update paths for the rules files. Index: genwxbind.bat =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.bat,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** genwxbind.bat 14 Jun 2007 01:23:07 -0000 1.10 --- genwxbind.bat 7 Jan 2008 19:11:12 -0000 1.11 *************** *** 24,44 **** IF EXIST ..\bin\vc_dll\lua.exe SET LUA=..\bin\vc_dll\lua.exe ! echo Generating wxWidgets Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wx_rules.lua\"" genwxbind.lua > wxwidgets_error.txt ! echo Generating wxStyledTextCtrl Binding ! %LUA% -e"rulesFilename=\"wxstc/wxstc_rules.lua\"" genwxbind.lua > wxstc_error.txt ! echo Generating wxLua Binding ! %LUA% -e"rulesFilename=\"wxlua/wxlua_rules.lua\"" genwxbind.lua > wxlua_error.txt - echo Generating wxLuaDebugger Binding - %LUA% -e"rulesFilename=\"wxluasocket/wxluasocket_rules.lua\"" genwxbind.lua > wxluasocket_error.txt echo Generating wxLuaCan app Binding cd ..\apps\wxluacan\src ! ..\..\..\bindings\%LUA% -e"rulesFilename=\"wxluacan_rules.lua\"" ../../../bindings/genwxbind.lua > error.txt cd ..\..\..\bindings echo Done. - --- 24,81 ---- IF EXIST ..\bin\vc_dll\lua.exe SET LUA=..\bin\vc_dll\lua.exe ! echo Using this Lua executable: %LUA% ! echo Generating wxWidgets wxbase Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxbase_rules.lua\"" genwxbind.lua ! echo Generating wxWidgets wxcore Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxcore_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxadv Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxadv_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxaui Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxaui_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxgl Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxgl_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxhtml Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxhtml_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxnet Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxnet_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxmedia Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxmedia_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxstc Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxstc_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxxml Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxxml_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxxrc Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxxrc_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxrichtext Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxrichtext_rules.lua\"" genwxbind.lua ! ! ! echo Generating wxWidgets wxlua Binding ! %LUA% -e"rulesFilename=\"wxlua/wxlua_rules.lua\"" genwxbind.lua ! ! echo Generating wxWidgets wxluasocket Binding ! %LUA% -e"rulesFilename=\"wxluasocket/wxluasocket_rules.lua\"" genwxbind.lua ! ! ! echo Generating wxWidgets wxdatatypes Binding ! %LUA% -e"rulesFilename=\"wxwidgets/wxdatatypes_rules.lua\"" genwxbind.lua echo Generating wxLuaCan app Binding cd ..\apps\wxluacan\src ! ..\..\..\bindings\%LUA% -e"rulesFilename=\"wxluacan_rules.lua\"" ../../../bindings/genwxbind.lua cd ..\..\..\bindings echo Done. |
From: John L. <jr...@us...> - 2008-01-05 00:15:50
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10306/wxLua/modules/wxlua/src Modified Files: wxlstate.cpp wxlua_bind.cpp Log Message: A little more cleanup. Fix for Lua clearing weak refs even before the __gc call is made so we miscounted how many instances of the userdata we had and deleted it thinking it was the last. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** wxlstate.cpp 4 Jan 2008 00:21:08 -0000 1.158 --- wxlstate.cpp 5 Jan 2008 00:15:46 -0000 1.159 *************** *** 27,32 **** const char* wxlua_lreg_types_key = "wxLua metatable class types"; ! const char* wxlua_lreg_refs_key = "wxLua object references"; ! const char* wxlua_lreg_debug_refs_key = "wxLuaDebugData references"; const char* wxlua_lreg_classes_key = "wxLuaBindClass structs"; const char* wxlua_lreg_derivedmethods_key = "wxLua derived class methods"; --- 27,32 ---- const char* wxlua_lreg_types_key = "wxLua metatable class types"; ! const char* wxlua_lreg_refs_key = "wxLua Lua object refs"; ! const char* wxlua_lreg_debug_refs_key = "wxLuaDebugData refs"; const char* wxlua_lreg_classes_key = "wxLuaBindClass structs"; const char* wxlua_lreg_derivedmethods_key = "wxLua derived class methods"; *************** *** 42,47 **** const char* wxlua_lreg_regtable_key = "wxLua LUA_REGISTRYINDEX tables"; ! const char* wxlua_metatable_type_key = "wxLua Metatable class type"; ! const char* wxlua_metatable_wxluabindclass_key = "wxLua Metatable wxLuaBindClass"; wxLuaState wxNullLuaState(false); --- 42,47 ---- const char* wxlua_lreg_regtable_key = "wxLua LUA_REGISTRYINDEX tables"; ! const char* wxlua_metatable_type_key = "wxLua metatable class type"; ! const char* wxlua_metatable_wxluabindclass_key = "wxLua metatable wxLuaBindClass"; wxLuaState wxNullLuaState(false); *************** *** 186,195 **** lua_pushnil(L); // push value lua_rawset(L, -3); // clear t[key] = nil ! lua_pop(L, 1); } else lua_pop(L, 2); // pop nil and wxlua_lreg_regtable_key table ! // Add new LUA_REGISTRYINDEX[lightuserdata_reg_key table] = lightuserdata_reg_key lua_pushlightuserdata(L, lightuserdata_reg_key); // push key lua_createtable(L, narr, nrec); // push value --- 186,195 ---- lua_pushnil(L); // push value lua_rawset(L, -3); // clear t[key] = nil ! lua_pop(L, 1); // pop wxlua_lreg_regtable_key table } else lua_pop(L, 2); // pop nil and wxlua_lreg_regtable_key table ! // Add new LUA_REGISTRYINDEX[&wxlua_lreg_regtable_key][lightuserdata_reg_key table] = lightuserdata_reg_key lua_pushlightuserdata(L, lightuserdata_reg_key); // push key lua_createtable(L, narr, nrec); // push value *************** *** 280,284 **** // call ref 3 times and the new references will be 4, 3, 6 ! int wxluaR_ref(lua_State* L, int stack_idx, const void* lightuserdata_reg_key) { // nothing on stack to insert and don't bother inserting nil --- 280,284 ---- // call ref 3 times and the new references will be 4, 3, 6 ! int wxluaR_ref(lua_State* L, int stack_idx, void* lightuserdata_reg_key) { // nothing on stack to insert and don't bother inserting nil *************** *** 286,316 **** return LUA_REFNIL; ! lua_pushlightuserdata(L, (void*)lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push value to store ! int ref_idx = luaL_ref(L, -2); // t[ref_idx] = value; pops value // We also store t[value] = table_idx for this table for faster lookup if (lightuserdata_reg_key == &wxlua_lreg_debug_refs_key) { ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push key ! lua_pushnumber(L, ref_idx); // push value ! lua_rawset(L, -3); // set t[key] = value; pops key and value } ! lua_pop(L, 1); // pop table return ref_idx; } ! bool wxluaR_unref(lua_State* L, int ref_idx, const void* lightuserdata_reg_key) { ! if (ref_idx == LUA_REFNIL) // nothing to remove return false; ! lua_pushlightuserdata(L, (void*)lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) // Also remove the t[value] = table_idx for this table --- 286,316 ---- return LUA_REFNIL; ! lua_pushlightuserdata(L, lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push value to store ! int ref_idx = luaL_ref(L, -2); // t[ref_idx] = value; pops value // We also store t[value] = table_idx for this table for faster lookup if (lightuserdata_reg_key == &wxlua_lreg_debug_refs_key) { ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push key ! lua_pushnumber(L, ref_idx); // push value ! lua_rawset(L, -3); // set t[key] = value; pops key and value } ! lua_pop(L, 1); // pop table return ref_idx; } ! bool wxluaR_unref(lua_State* L, int ref_idx, void* lightuserdata_reg_key) { ! if (ref_idx == LUA_REFNIL) // nothing to remove return false; ! lua_pushlightuserdata(L, lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) // Also remove the t[value] = table_idx for this table *************** *** 325,329 **** luaL_unref(L, -1, ref_idx); // remove key and value in refs table ! // note: this key will be used for the next wxluaR_ref lua_pop(L, 1); // pop table --- 325,329 ---- luaL_unref(L, -1, ref_idx); // remove key and value in refs table ! // note: this key will be used for the next wxluaR_ref() lua_pop(L, 1); // pop table *************** *** 332,371 **** } ! bool LUACALL wxluaR_getref(lua_State *L, int ref_idx, const void* lightuserdata_reg_key) { ! if (ref_idx == LUA_REFNIL) // nothing to get return false; ! lua_pushlightuserdata(L, (void*)lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_rawgeti(L, -1, ref_idx); // get t[ref_idx] = value; push value ! if (lua_isnil(L, -1)) // not a valid table key { ! lua_pop(L, 2); // pop nil and table return false; } ! lua_remove(L, -2); // remove table, leaving value on top return true; // return if table has a valid value and it's on the stack } ! int LUACALL wxluaR_isrefed(lua_State* L, int stack_idx, const void* lightuserdata_reg_key) { int ref_idx = LUA_NOREF; ! lua_pushlightuserdata(L, (void*)lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) if (lightuserdata_reg_key == &wxlua_lreg_debug_refs_key) { ! // For this table we've push the value for a faster index ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push key (the value) ! lua_rawget(L, -2); // get t[key] = value; pop key push value ref_idx = (int)lua_tonumber(L, -1); ! if ((ref_idx == 0) && !lua_isnumber(L, -1)) // if !isnumber it returns 0 (faster) ref_idx = LUA_NOREF; --- 332,371 ---- } ! bool LUACALL wxluaR_getref(lua_State *L, int ref_idx, void* lightuserdata_reg_key) { ! if (ref_idx == LUA_REFNIL) // nothing to get return false; ! lua_pushlightuserdata(L, lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) ! lua_rawgeti(L, -1, ref_idx); // get t[ref_idx] = value; push value ! if (lua_isnil(L, -1)) // not a valid table key { ! lua_pop(L, 2); // pop nil and table return false; } ! lua_remove(L, -2); // remove table, leaving value on top return true; // return if table has a valid value and it's on the stack } ! int LUACALL wxluaR_isrefed(lua_State* L, int stack_idx, void* lightuserdata_reg_key) { int ref_idx = LUA_NOREF; ! lua_pushlightuserdata(L, lightuserdata_reg_key); // push key ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) if (lightuserdata_reg_key == &wxlua_lreg_debug_refs_key) { ! // For this table we've pushed the value for a faster lookup ! lua_pushvalue(L, ABS_LUA_STKIDX(stack_idx,1)); // push key (the value) ! lua_rawget(L, -2); // get t[key] = value; pop key push value ref_idx = (int)lua_tonumber(L, -1); ! if ((ref_idx == 0) && !lua_isnumber(L, -1)) // if !isnumber it returns 0 (faster) ref_idx = LUA_NOREF; *************** *** 403,407 **** wxluaO_addgcobject(L, (void*)wxobj, wxobj); } ! void LUACALL wxluaO_addgcobject(lua_State *L, const void *obj_ptr, wxObject* wxobj) { lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key --- 403,407 ---- wxluaO_addgcobject(L, (void*)wxobj, wxobj); } ! void LUACALL wxluaO_addgcobject(lua_State *L, void *obj_ptr, wxObject* wxobj) { lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key *************** *** 409,414 **** // Check if it's already tracked since that means the weak udata table isn't working right ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_rawget(L, -2); // get t[key] = value, pops key if (!lua_isnil(L, -1)) { --- 409,414 ---- // Check if it's already tracked since that means the weak udata table isn't working right ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_rawget(L, -2); // get t[key] = value, pops key if (!lua_isnil(L, -1)) { *************** *** 420,426 **** // Then add it ! lua_pushlightuserdata(L, (void*)obj_ptr); // push key ! lua_pushlightuserdata(L, wxobj); // push value ! lua_rawset(L, -3); // set t[key] = value, pops key and value lua_pop(L, 1); // pop table --- 420,426 ---- // Then add it ! lua_pushlightuserdata(L, obj_ptr); // push key ! lua_pushlightuserdata(L, wxobj); // push value ! lua_rawset(L, -3); // set t[key] = value, pops key and value lua_pop(L, 1); // pop table *************** *** 429,433 **** bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags) { ! if (obj_ptr == 0) return false; // can happen bool delete_all = WXLUA_HASBIT(flags, WXLUA_DELETE_OBJECT_ALL); --- 429,433 ---- bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags) { ! if (obj_ptr == NULL) return false; // can happen bool delete_all = WXLUA_HASBIT(flags, WXLUA_DELETE_OBJECT_ALL); *************** *** 436,440 **** int udata_count = wxluaO_untrackweakobject(L, delete_all ? NULL : udata, obj_ptr); ! if (delete_all || (udata_count < 2)) { wxlua_removederivedmethods(L, obj_ptr); --- 436,440 ---- int udata_count = wxluaO_untrackweakobject(L, delete_all ? NULL : udata, obj_ptr); ! if (delete_all || (udata_count < 1)) { wxlua_removederivedmethods(L, obj_ptr); *************** *** 476,480 **** bool LUACALL wxluaO_undeletegcobject(lua_State *L, void *obj_ptr) { ! if (obj_ptr == 0) return false; lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key --- 476,480 ---- bool LUACALL wxluaO_undeletegcobject(lua_State *L, void *obj_ptr) { ! if (obj_ptr == NULL) return false; lua_pushlightuserdata(L, &wxlua_lreg_gcobjects_key); // push key *************** *** 558,564 **** lua_newtable(L); lua_newtable(L); // metatable ! lua_pushlstring(L, "__mode", 6); ! lua_pushlstring(L, "v", 1); ! lua_rawset(L, -3); // set mode of main table lua_setmetatable(L, -2); // via the metatable lua_rawset(L, -3); --- 558,564 ---- lua_newtable(L); lua_newtable(L); // metatable ! lua_pushlstring(L, "__mode", 6); ! lua_pushlstring(L, "v", 1); ! lua_rawset(L, -3); // set mode of main table lua_setmetatable(L, -2); // via the metatable lua_rawset(L, -3); *************** *** 592,596 **** int count = 0; - bool cleared_udata = false; if (lua_istable(L, -1)) --- 592,595 ---- *************** *** 602,606 **** // value = -1, key = -2, table = -3 void *u = lua_touserdata(L, -1); - ++count; if ((udata == NULL) || (udata == u)) --- 601,604 ---- *************** *** 612,616 **** if (udata == u) { - cleared_udata = true; lua_pop(L, 1); // pop value --- 610,613 ---- *************** *** 620,630 **** } else lua_pop(L, 1); // pop value, leave key for next iteration } lua_pop(L, 1); // pop obj_ptr table ! if ((udata == NULL) || (count == 0) || ((count == 1) && cleared_udata)) { lua_pushlightuserdata(L, (void*)obj_ptr); // push key lua_pushnil(L); // push value --- 617,632 ---- } else + { + ++count; // only count ones that still exist lua_pop(L, 1); // pop value, leave key for next iteration + } } lua_pop(L, 1); // pop obj_ptr table ! // If we've cleared everything then remove the table ! if ((udata == NULL) || (count == 0)) { + count = 0; // removed them all lua_pushlightuserdata(L, (void*)obj_ptr); // push key lua_pushnil(L); // push value *************** *** 672,675 **** --- 674,714 ---- } + wxArrayString LUACALL wxluaO_gettrackedweakobjectinfo(lua_State *L) + { + wxArrayString arrStr; + + lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key + lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) + + lua_pushnil(L); + while (lua_next(L, -2) != 0) + { + // value = -1, key = -2, table = -3 + void* obj_ptr = lua_touserdata(L, -2); // actually lightuserdata + + wxString name; + + // iterate the table of userdata + lua_pushnil(L); + while (lua_next(L, -2) != 0) + { + // value = -1, key = -2, table = -3 + int wxl_type = (int)lua_tonumber(L, -2); + if (!name.IsEmpty()) name += wxT(", "); + name += wxString::Format(wxT("%s(%p, type=%d)"), wxluaT_typename(L, wxl_type).c_str(), lua_touserdata(L, -1), wxl_type); + lua_pop(L, 1); // pop value, lua_next will pop key at end + } + + arrStr.Add(wxString::Format(wxT("%p = %s"), obj_ptr, name.c_str())); + + lua_pop(L, 1); // pop value, lua_next will pop key at end + } + + lua_pop(L, 1); // pop table + + arrStr.Sort(); + return arrStr; + } + // ---------------------------------------------------------------------------- // wxluaW_XXX - functions operate on tracked wxWindows *************** *** 1496,1500 **** for (idx = 0; idx < count; ++idx) { ! lua_pushstring(L, wx2lua(strArray[idx])); lua_rawseti(L, -2, idx + 1); } --- 1535,1539 ---- for (idx = 0; idx < count; ++idx) { ! wxlua_pushwxString(L, strArray[idx]); lua_rawseti(L, -2, idx + 1); } *************** *** 1520,1523 **** --- 1559,1575 ---- } + wxString wxlua_concatwxArrayString(const wxArrayString& arr, const wxString& sep) + { + wxString s; + size_t n, count = arr.GetCount(); + for (n = 0; n < count; ++n) + { + s += arr[n]; + if (n < count - 1) s += sep; + } + + return s; + } + //---------------------------------------------------------------------------- // Derived class member functions for classes in wxLua *************** *** 2768,2772 **** } ! void wxLuaState::AddGCObject(const void* obj_ptr, wxObject *wxobj) { wxCHECK_RET(Ok() && wxobj, wxT("Invalid wxLuaState or wxObject to track")); --- 2820,2824 ---- } ! void wxLuaState::AddGCObject(void* obj_ptr, wxObject *wxobj) { wxCHECK_RET(Ok() && wxobj, wxT("Invalid wxLuaState or wxObject to track")); *************** *** 2956,2960 **** // wxLua Lua Registry Table Functions ! int wxLuaState::wxluaR_Ref(int stack_idx, const void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), LUA_REFNIL, wxT("Invalid wxLuaState")); --- 3008,3012 ---- // wxLua Lua Registry Table Functions ! int wxLuaState::wxluaR_Ref(int stack_idx, void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), LUA_REFNIL, wxT("Invalid wxLuaState")); *************** *** 2962,2966 **** } ! bool wxLuaState::wxluaR_Unref(int wxlref_index, const void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); --- 3014,3018 ---- } ! bool wxLuaState::wxluaR_Unref(int wxlref_index, void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); *************** *** 2968,2972 **** } ! bool wxLuaState::wxluaR_GetRef(int wxlref_index, const void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); --- 3020,3024 ---- } ! bool wxLuaState::wxluaR_GetRef(int wxlref_index, void* lightuserdata_reg_key) { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); Index: wxlua_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua_bind.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wxlua_bind.cpp 22 Dec 2007 06:07:16 -0000 1.19 --- wxlua_bind.cpp 5 Jan 2008 00:15:46 -0000 1.20 *************** *** 724,768 **** static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetBindings[1] = {{ wxLua_function_GetBindings, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_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, g_wxluaargtypeArray_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, g_wxluaargtypeArray_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, g_wxluaargtypeArray_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, g_wxluaargtypeArray_None }}; static wxLuaArgType s_wxluatypeArray_wxLua_function_iswxluatype[] = { &g_wxluatype_TNUMBER, &g_wxluatype_TNUMBER, NULL }; --- 724,808 ---- static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetBindings[1] = {{ wxLua_function_GetBindings, WXLUAMETHOD_CFUNCTION, 0, 0, g_wxluaargtypeArray_None }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetGCUserdataInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; // %override wxLua_function_GetGCUserdataInfo ! // %function LuaTable GetGCUserdataInfo(bool as_string = false) static int LUACALL wxLua_function_GetGCUserdataInfo(lua_State *L) { ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaO_getgcobjectinfo(L))); ! else ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectinfo(L)); ! return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetGCUserdataInfo[1] = {{ wxLua_function_GetGCUserdataInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetGCUserdataInfo }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedEventCallbackInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; // %override wxLua_function_GetTrackedEventCallbackInfo ! // %function LuaTable GetTrackedEventCallbackInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedEventCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxlState.GetTrackedEventCallbackInfo())); ! else ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedEventCallbackInfo()); ! return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo[1] = {{ wxLua_function_GetTrackedEventCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedEventCallbackInfo }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedObjectInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; + // %override wxLua_function_GetTrackedObjectInfo + // %function LuaTable GetTrackedObjectInfo(bool as_string = false) + static int LUACALL wxLua_function_GetTrackedObjectInfo(lua_State *L) + { + bool as_string = lua_toboolean(L, 1); // ok if nil + if (as_string) + wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaO_gettrackedweakobjectinfo(L))); + else + wxlua_pushwxArrayStringtable(L, wxluaO_gettrackedweakobjectinfo(L)); + + return 1; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedObjectInfo[1] = {{ wxLua_function_GetTrackedObjectInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedObjectInfo }}; + + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedWinDestroyCallbackInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; // %override wxLua_function_GetTrackedWinDestroyCallbackInfo ! // %function LuaTable GetTrackedWinDestroyCallbackInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedWinDestroyCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxlState.GetTrackedWinDestroyCallbackInfo())); ! else ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackInfo()); ! return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo[1] = {{ wxLua_function_GetTrackedWinDestroyCallbackInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedWinDestroyCallbackInfo }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_GetTrackedWindowInfo[] = { &g_wxluatype_TBOOLEAN, NULL }; // %override wxLua_function_GetTrackedWindowInfo ! // %function LuaTable GetTrackedWindowInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedWindowInfo(lua_State *L) { ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaW_gettrackedwindowinfo(L))); ! else ! wxlua_pushwxArrayStringtable(L, wxluaW_gettrackedwindowinfo(L)); ! return 1; } ! static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWindowInfo[1] = {{ wxLua_function_GetTrackedWindowInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedWindowInfo }}; static wxLuaArgType s_wxluatypeArray_wxLua_function_iswxluatype[] = { &g_wxluatype_TNUMBER, &g_wxluatype_TNUMBER, NULL }; *************** *** 875,878 **** --- 915,919 ---- { "GetGCUserdataInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetGCUserdataInfo, 1, NULL }, { "GetTrackedEventCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedEventCallbackInfo, 1, NULL }, + { "GetTrackedObjectInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedObjectInfo, 1, NULL }, { "GetTrackedWinDestroyCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo, 1, NULL }, { "GetTrackedWindowInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWindowInfo, 1, NULL }, |
From: John L. <jr...@us...> - 2008-01-05 00:15:49
|
Update of /cvsroot/wxlua/wxLua/bindings/wxlua In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10306/wxLua/bindings/wxlua Modified Files: override.hpp wxlua.i Log Message: A little more cleanup. Fix for Lua clearing weak refs even before the __gc call is made so we miscounted how many instances of the userdata we had and deleted it thinking it was the last. Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/wxlua.i,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** wxlua.i 22 Dec 2007 06:07:08 -0000 1.14 --- wxlua.i 5 Jan 2008 00:15:45 -0000 1.15 *************** *** 29,50 **** // Get information about the status of wxLua. ! // 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() // --------------------------------------------------------------------------- --- 29,55 ---- // Get information about the status of wxLua. ! // Get a table or string of all tracked top level windows that wxLua will ! // Destroy() when lua is closed. // Example output : { "ClassName(&win id=wxWindowID)", ...} ! %function LuaTable GetTrackedWindowInfo(bool as_string = false) ! // Get a table or string of all tracked userdata wxLua will delete when lua ! // is closed or lua will eventually garbage collect. // Example output : { "ClassName(&obj)", ... } ! %function LuaTable GetGCUserdataInfo(bool as_string = false) ! // Get a table or string of all tracked userdata wxLua has pushed. ! // A single object may have multiple types if it has been casted. ! // Example output : { "&obj wxLuaTypeName(type#), ...", ... } ! %function LuaTable GetTrackedObjectInfo(bool as_string = false) ! ! // Get a table or string 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(bool as_string = false) ! // Get a table or string of all wxWindow derived classes that have been created in wxLua. // "wxWindowClassName(&win, id=%d)|wxLuaDestroyCallback(&callback)" ! %function LuaTable GetTrackedWinDestroyCallbackInfo(bool as_string = false) // --------------------------------------------------------------------------- Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/override.hpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** override.hpp 22 Dec 2007 06:07:08 -0000 1.16 --- override.hpp 5 Jan 2008 00:15:45 -0000 1.17 *************** *** 32,39 **** %override wxLua_function_GetTrackedWindowInfo ! // %function LuaTable GetTrackedTopLevelWindows() static int LUACALL wxLua_function_GetTrackedWindowInfo(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaW_gettrackedwindowinfo(L)); return 1; } --- 32,44 ---- %override wxLua_function_GetTrackedWindowInfo ! // %function LuaTable GetTrackedWindowInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedWindowInfo(lua_State *L) { ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaW_gettrackedwindowinfo(L))); ! else ! wxlua_pushwxArrayStringtable(L, wxluaW_gettrackedwindowinfo(L)); ! return 1; } *************** *** 41,48 **** %override wxLua_function_GetGCUserdataInfo ! // %function LuaTable GetTrackedUserData() static int LUACALL wxLua_function_GetGCUserdataInfo(lua_State *L) { ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectinfo(L)); return 1; } --- 46,72 ---- %override wxLua_function_GetGCUserdataInfo ! // %function LuaTable GetGCUserdataInfo(bool as_string = false) static int LUACALL wxLua_function_GetGCUserdataInfo(lua_State *L) { ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaO_getgcobjectinfo(L))); ! else ! wxlua_pushwxArrayStringtable(L, wxluaO_getgcobjectinfo(L)); ! ! return 1; ! } ! %end ! ! %override wxLua_function_GetTrackedObjectInfo ! // %function LuaTable GetTrackedObjectInfo(bool as_string = false) ! static int LUACALL wxLua_function_GetTrackedObjectInfo(lua_State *L) ! { ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxluaO_gettrackedweakobjectinfo(L))); ! else ! wxlua_pushwxArrayStringtable(L, wxluaO_gettrackedweakobjectinfo(L)); ! return 1; } *************** *** 50,58 **** %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; } --- 74,87 ---- %override wxLua_function_GetTrackedEventCallbackInfo ! // %function LuaTable GetTrackedEventCallbackInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedEventCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxlState.GetTrackedEventCallbackInfo())); ! else ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedEventCallbackInfo()); ! return 1; } *************** *** 60,68 **** %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; } --- 89,102 ---- %override wxLua_function_GetTrackedWinDestroyCallbackInfo ! // %function LuaTable GetTrackedWinDestroyCallbackInfo(bool as_string = false) static int LUACALL wxLua_function_GetTrackedWinDestroyCallbackInfo(lua_State *L) { wxLuaState wxlState(L); ! bool as_string = lua_toboolean(L, 1); // ok if nil ! if (as_string) ! wxlua_pushwxString(L, wxlua_concatwxArrayString(wxlState.GetTrackedWinDestroyCallbackInfo())); ! else ! wxlua_pushwxArrayStringtable(L, wxlState.GetTrackedWinDestroyCallbackInfo()); ! return 1; } |
From: John L. <jr...@us...> - 2008-01-05 00:15:49
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10306/wxLua/modules/wxlua/include Modified Files: wxlstate.h Log Message: A little more cleanup. Fix for Lua clearing weak refs even before the __gc call is made so we miscounted how many instances of the userdata we had and deleted it thinking it was the last. Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** wxlstate.h 4 Jan 2008 00:21:08 -0000 1.113 --- wxlstate.h 5 Jan 2008 00:15:45 -0000 1.114 *************** *** 224,228 **** // // Possible values for the "void* lightuserdata_reg_key" are ! // wxlua_lreg_types_key, wxlua_lreg_refs_key, wxlua_lreg_debug_refs_key // unless you are using these functions for your own table in the LUA_REGISTRYINDEX. //---------------------------------------------------------------------------- --- 224,228 ---- // // Possible values for the "void* lightuserdata_reg_key" are ! // &wxlua_lreg_types_key, &wxlua_lreg_refs_key, &wxlua_lreg_debug_refs_key // unless you are using these functions for your own table in the LUA_REGISTRYINDEX. //---------------------------------------------------------------------------- *************** *** 231,245 **** // lightuserdata_reg_key in the LUA_REGISTRYINDEX table. Does not pop the object. // Returns the table index or LUA_REFNIL if the item on the stack is none or nil (an error). ! WXDLLIMPEXP_WXLUA int LUACALL wxluaR_ref(lua_State* L, int stack_idx, const void* lightuserdata_reg_key); // Remove a reference to the object at the index in a table with the key // lightuserdata_reg_key in the LUA_REGISTRYINDEX table, returns success. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaR_unref(lua_State* L, int wxlref_idx, const void* lightuserdata_reg_key); // Push onto the top of the stack the object at the index in a table with the key // lightuserdata_reg_key in the LUA_REGISTRYINDEX table, if the index is LUA_REFNIL or the // value is nil it returns false and doesn't leave anything on the stack. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaR_getref(lua_State* L, int wxlref_idx, const void* lightuserdata_reg_key); // Is the item at the stack_idx in the table with the key lightuserdata_reg_key // in the LUA_REGISTRYINDEX table. Returns the ref index or LUA_NOREF if it's not. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaR_isrefed(lua_State* L, int stack_idx, const void* lightuserdata_reg_key); //---------------------------------------------------------------------------- --- 231,245 ---- // lightuserdata_reg_key in the LUA_REGISTRYINDEX table. Does not pop the object. // Returns the table index or LUA_REFNIL if the item on the stack is none or nil (an error). ! WXDLLIMPEXP_WXLUA int LUACALL wxluaR_ref(lua_State* L, int stack_idx, void* lightuserdata_reg_key); // Remove a reference to the object at the index in a table with the key // lightuserdata_reg_key in the LUA_REGISTRYINDEX table, returns success. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaR_unref(lua_State* L, int wxlref_idx, void* lightuserdata_reg_key); // Push onto the top of the stack the object at the index in a table with the key // lightuserdata_reg_key in the LUA_REGISTRYINDEX table, if the index is LUA_REFNIL or the // value is nil it returns false and doesn't leave anything on the stack. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaR_getref(lua_State* L, int wxlref_idx, void* lightuserdata_reg_key); // Is the item at the stack_idx in the table with the key lightuserdata_reg_key // in the LUA_REGISTRYINDEX table. Returns the ref index or LUA_NOREF if it's not. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaR_isrefed(lua_State* L, int stack_idx, void* lightuserdata_reg_key); //---------------------------------------------------------------------------- *************** *** 265,273 **** // 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. ! // If WXLUA_DELETE_OBJECT_ALL or if this is the last userdata it will also remove all // wxlua_lreg_weakobjects_key and wxlua_lreg_derivedmethods_key since the object is gone. WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags); --- 265,273 ---- // 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, 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. ! // If flags = WXLUA_DELETE_OBJECT_ALL or if this is the last userdata it will also remove all // wxlua_lreg_weakobjects_key and wxlua_lreg_derivedmethods_key since the object is gone. WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags); *************** *** 295,303 **** WXDLLIMPEXP_WXLUA int LUACALL wxluaO_untrackweakobject(lua_State *L, void* udata, void *obj_ptr); // Check if this object with the given wxLua type is in the wxlua_lreg_weakobjects_key ! // table of the LUA_REGISTRYINDEX. // If the object is found with the right wxLua type and push_on_stack is true ! // the Lua userdata for the object is pushed on top of the stack. If it's not ! // found then it returns false and nothing is left on the stack. WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_istrackedweakobject(lua_State *L, void *obj_ptr, int wxl_type, bool push_on_stack); //---------------------------------------------------------------------------- --- 295,307 ---- WXDLLIMPEXP_WXLUA int LUACALL wxluaO_untrackweakobject(lua_State *L, void* udata, void *obj_ptr); // Check if this object with the given wxLua type is in the wxlua_lreg_weakobjects_key ! // table of the LUA_REGISTRYINDEX. // If the object is found with the right wxLua type and push_on_stack is true ! // the Lua userdata for the object is pushed on top of the stack. If it's not ! // found then it returns false and nothing is left on the stack. WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_istrackedweakobject(lua_State *L, void *obj_ptr, int wxl_type, bool push_on_stack); + // Get a wxArrayString of the info in the wxlua_lreg_weakobjects_key LUA_REGISTRYINDEX table. + // Strings are of the form "&obj_ptr = wxLuaTypeName1(&udata, type=wxLuaType), ..." + // If the object is casted to multiple types there will be wxLuaTypeName2(...) and so on. + WXDLLIMPEXP_WXLUA wxArrayString LUACALL wxluaO_gettrackedweakobjectinfo(lua_State *L); //---------------------------------------------------------------------------- *************** *** 493,496 **** --- 497,503 ---- WXDLLIMPEXP_WXLUA void LUACALL wxlua_pushwxString(lua_State* L, const wxString& str); + // Helper function to concatenate a wxArrayString into a wxString. + WXDLLIMPEXP_WXLUA wxString wxlua_concatwxArrayString(const wxArrayString& arr, const wxString& sep = wxT("\n")); + //---------------------------------------------------------------------------- // Derived class member functions for classes in wxLua. The data is stored *************** *** 870,874 **** void AddGCObject(wxObject *wxobj); // See wxluaO_addgcobject(). ! void AddGCObject(const void* obj_ptr, wxObject *wxobj); // See wxluaO_deletegcobject(). bool DeleteGCObject(void* udata, void *obj_ptr, int flags); --- 877,881 ---- void AddGCObject(wxObject *wxobj); // See wxluaO_addgcobject(). ! void AddGCObject(void* obj_ptr, wxObject *wxobj); // See wxluaO_deletegcobject(). bool DeleteGCObject(void* udata, void *obj_ptr, int flags); *************** *** 919,925 **** // wxLua Lua Registry Table Functions ! int wxluaR_Ref(int stack_idx, const void* lightuserdata_reg_key); ! bool wxluaR_Unref(int wxlref_index, const void* lightuserdata_reg_key); ! bool wxluaR_GetRef(int wxlref_index, const void* lightuserdata_reg_key); int wxluaT_NewMetatable(); --- 926,932 ---- // wxLua Lua Registry Table Functions ! int wxluaR_Ref(int stack_idx, void* lightuserdata_reg_key); ! bool wxluaR_Unref(int wxlref_index, void* lightuserdata_reg_key); ! bool wxluaR_GetRef(int wxlref_index, void* lightuserdata_reg_key); int wxluaT_NewMetatable(); |
From: John L. <jr...@us...> - 2008-01-04 05:36:12
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29155/samples Modified Files: scribble.wx.lua Log Message: Make scribble a little nicer with a scrolled window and allow setting the size Index: scribble.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/scribble.wx.lua,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** scribble.wx.lua 22 Jul 2007 04:38:30 -0000 1.23 --- scribble.wx.lua 4 Jan 2008 05:36:07 -0000 1.24 *************** *** 12,16 **** frame = nil -- the main wxFrame ! panel = nil -- the child wxPanel in the wxFrame to draw on mouseDown = false -- left mouse button is down pointsList = {} -- list of the points added to the drawing --- 12,17 ---- frame = nil -- the main wxFrame ! scrollwin = nil -- the child of the frame ! panel = nil -- the child wxPanel of the wxScrolledWindow to draw on mouseDown = false -- left mouse button is down pointsList = {} -- list of the points added to the drawing *************** *** 310,314 **** -- Create the menubar local fileMenu = wx.wxMenu() ! fileMenu:Append(wx.wxID_NEW, "&New\tCtrl+N", "Begin a new drawing") fileMenu:Append(wx.wxID_OPEN, "&Open...\tCtrl+O", "Open an existing drawing") fileMenu:AppendSeparator() --- 311,315 ---- -- Create the menubar local fileMenu = wx.wxMenu() ! fileMenu:Append(wx.wxID_NEW, "&New...\tCtrl+N", "Begin a new drawing") fileMenu:Append(wx.wxID_OPEN, "&Open...\tCtrl+O", "Open an existing drawing") fileMenu:AppendSeparator() *************** *** 320,325 **** local editMenu = wx.wxMenu() ! editMenu:Append(ID_PENCOLOUR, "Set pen &Color\tCtrl+R", "Set the color of the pen to draw with") ! editMenu:Append(ID_PENWIDTH, "Set pen &Width\tCtrl+T", "Set width of the pen to draw with") -- Styles really only work for long lines, when you change direction the styles -- blur into each other and just look like a solid line. --- 321,326 ---- local editMenu = wx.wxMenu() ! editMenu:Append(ID_PENCOLOUR, "Set pen &color\tCtrl+R", "Set the color of the pen to draw with") ! editMenu:Append(ID_PENWIDTH, "Set pen &width\tCtrl+T", "Set width of the pen to draw with") -- Styles really only work for long lines, when you change direction the styles -- blur into each other and just look like a solid line. *************** *** 356,360 **** penWidthSpinCtrl = wx.wxSpinCtrl(toolBar, ID_PENWIDTH_SPINCTRL, "3", wx.wxDefaultPosition, wx.wxDefaultSize, ! wx.wxSP_ARROW_KEYS, 1, 100, 3) local w, h = penWidthSpinCtrl:GetSizeWH() penWidthSpinCtrl:SetSize(3*h, -1) --- 357,361 ---- penWidthSpinCtrl = wx.wxSpinCtrl(toolBar, ID_PENWIDTH_SPINCTRL, "3", wx.wxDefaultPosition, wx.wxDefaultSize, ! wx.wxSP_ARROW_KEYS, 1, 100, currentPen:GetWidth()) local w, h = penWidthSpinCtrl:GetSizeWH() penWidthSpinCtrl:SetSize(3*h, -1) *************** *** 363,369 **** toolBar:AddSeparator() ! colourPicker = wx.wxColourPickerCtrl(toolBar, ID_PENCOLOUR, wx.wxBLACK, wx.wxDefaultPosition, toolBmpSize:op_sub(wx.wxSize(2,2)), wx.wxCLRP_DEFAULT_STYLE) colourPicker:SetToolTip("Choose pen color") colourPicker:Connect(wx.wxEVT_COMMAND_COLOURPICKER_CHANGED, --- 364,372 ---- toolBar:AddSeparator() ! local c = currentPen:GetColour() ! colourPicker = wx.wxColourPickerCtrl(toolBar, ID_PENCOLOUR, c, wx.wxDefaultPosition, toolBmpSize:op_sub(wx.wxSize(2,2)), wx.wxCLRP_DEFAULT_STYLE) + c:delete() colourPicker:SetToolTip("Choose pen color") colourPicker:Connect(wx.wxEVT_COMMAND_COLOURPICKER_CHANGED, *************** *** 389,392 **** --- 392,396 ---- "white", "light grey", "tan", "pink", "yellow", "turquoise", "sky blue", "maroon" } + -- Note: this bitmap is local, but is used in the event handlers local colourWinBmp = wx.wxBitmap(4*colourWin_height, colourWin_height) do *************** *** 454,459 **** frame:SetStatusText("Welcome to wxLua Scribble.") ! -- Create a wxPanel to draw on, always a good idea, it will fill the frame ! panel = wx.wxPanel(frame, wx.wxID_ANY) panel:Connect(wx.wxEVT_PAINT, OnPaint) --- 458,469 ---- frame:SetStatusText("Welcome to wxLua Scribble.") ! -- Create a wxScrolledWindow to hold drawing window, it will fill the frame ! scrollwin = wx.wxScrolledWindow(frame, wx.wxID_ANY) ! scrollwin:SetScrollbars(1, 1, bitmap:GetWidth(), bitmap:GetHeight()) ! ! -- Create the panel that's the correct size of the bitmap on the scrolled ! -- window so we don't have to worry about calculating the scrolled position ! -- for drawing and the mouse position. ! panel = wx.wxPanel(scrollwin, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxSize(bitmap:GetWidth(), bitmap:GetHeight())) panel:Connect(wx.wxEVT_PAINT, OnPaint) *************** *** 472,475 **** --- 482,511 ---- end + local w, h = bitmap:GetWidth(), bitmap:GetHeight() + + local ok = true + repeat + local s = wx.wxGetTextFromUser("Enter the image size to use as 'width height'", "Set new image size", + string.format("%d %d", bitmap:GetWidth(), bitmap:GetHeight()), frame) + if (#s == 0) then + return -- they canceled the dialog + end + w, h = string.match(s, "(%d+) (%d+)") + + w = tonumber(w) + h = tonumber(h) + if (w == nil) or (h == nil) or (w < 2) or (h < 2) or (w > 10000) or (h > 10000) then + wx.wxMessageBox("Please enter two positive numbers for the width and height separated by a space", + "Invalid image width or height", wx.wxOK + wx.wxCENTRE + wx.wxICON_ERROR, frame) + ok = false + end + until ok + + -- resize all the drawing objects + bitmap:delete() + bitmap = wx.wxBitmap(w, h) + panel:SetSize(w, h) + scrollwin:SetScrollbars(1, 1, w, h) + fileName = "" frame:SetTitle("wxLua Scribble") *************** *** 633,640 **** "Save changes before exiting?", "Save Changes?", ! wx.wxYES_NO + wx.wxCENTRE + wx.wxICON_QUESTION ) local result = dialog:ShowModal() dialog:Destroy() ! if result == wx.wxID_YES then isOkToClose = SaveChanges() end --- 669,678 ---- "Save changes before exiting?", "Save Changes?", ! wx.wxYES_NO + wx.wxCANCEL + wx.wxCENTRE + wx.wxICON_QUESTION ) local result = dialog:ShowModal() dialog:Destroy() ! if result == wx.wxID_CANCEL then ! return ! elseif result == wx.wxID_YES then isOkToClose = SaveChanges() end *************** *** 649,652 **** --- 687,693 ---- end ) + -- delete all locals vars like the temporary wxArtProvider bitmaps + collectgarbage("collect") + frame:Show(true) end |
From: John L. <jr...@us...> - 2008-01-04 00:21:19
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6007/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp wxlstate.cpp Log Message: Fix typos in comments Only need wxWindow = wxLuaWinDestroyCallback in the wxlua_lreg_windestroycallbacks_key table Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** wxlstate.cpp 3 Jan 2008 00:05:58 -0000 1.157 --- wxlstate.cpp 4 Jan 2008 00:21:08 -0000 1.158 *************** *** 1,4 **** ///////////////////////////////////////////////////////////////////////////// ! // Purpose: wxWidgets interface to Lua // Author: Ray Gilbert, John Labenski, J Winwood (Reuben Thomas for bitlib at bottom) // Created: 14/11/2001 --- 1,5 ---- ///////////////////////////////////////////////////////////////////////////// ! // Name: wxlstate.cpp ! // Purpose: wxLuaState, a wxWidgets interface to Lua // Author: Ray Gilbert, John Labenski, J Winwood (Reuben Thomas for bitlib at bottom) // Created: 14/11/2001 *************** *** 2053,2061 **** { // value = -1, key = -2, table = -3 ! if (lua_type(L, -1) == LUA_TNUMBER) ! { ! wxLuaWinDestroyCallback* cb = (wxLuaWinDestroyCallback*)lua_touserdata(L, -2); ! cb->ClearwxLuaState(); ! } lua_pop(L, 1); // pop value, lua_next will pop key at end --- 2054,2059 ---- { // value = -1, key = -2, table = -3 ! wxLuaWinDestroyCallback* cb = (wxLuaWinDestroyCallback*)lua_touserdata(L, -1); ! cb->ClearwxLuaState(); lua_pop(L, 1); // pop value, lua_next will pop key at end *************** *** 2892,2902 **** lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) - // Note: We push t[callback] = 1 so that we can determine later - // what datatypes the key and values are. - - lua_pushlightuserdata(L, callback); // push key - lua_pushnumber(L, 1); // push value - lua_rawset(L, -3); // set t[key] = value; pops key and value - lua_pushlightuserdata(L, callback->GetWindow()); // push key lua_pushlightuserdata(L, callback); // push value --- 2890,2893 ---- *************** *** 2913,2920 **** lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push value (table) - lua_pushlightuserdata(L, callback); // push key - lua_pushnil(L); // push value - lua_rawset(L, -3); // set t[key] = value; pops key and value - lua_pushlightuserdata(L, callback->GetWindow()); // push key lua_pushnil(L); // push value --- 2904,2907 ---- *************** *** 2940,2950 **** { // value = -1, key = -2, table = -3 ! if (lua_type(L, -2) == LUA_TUSERDATA) ! { ! wxLuaWinDestroyCallback* wxlDestroyCallBack = (wxLuaWinDestroyCallback*)lua_touserdata(L, -2); ! wxCHECK_MSG(wxlDestroyCallBack, names, wxT("Invalid wxLuaWinDestroyCallback")); ! names.Add(wxlDestroyCallBack->GetInfo()); ! } lua_pop(L, 1); // pop value, lua_next will pop key at end --- 2927,2934 ---- { // value = -1, key = -2, table = -3 ! wxLuaWinDestroyCallback* wxlDestroyCallBack = (wxLuaWinDestroyCallback*)lua_touserdata(L, -1); ! wxCHECK_MSG(wxlDestroyCallBack, names, wxT("Invalid wxLuaWinDestroyCallback")); ! names.Add(wxlDestroyCallBack->GetInfo()); lua_pop(L, 1); // pop value, lua_next will pop key at end Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** wxlbind.cpp 22 Dec 2007 06:07:15 -0000 1.110 --- wxlbind.cpp 4 Jan 2008 00:21:08 -0000 1.111 *************** *** 1,3 **** --- 1,4 ---- ///////////////////////////////////////////////////////////////////////////// + // Name: wxlbind.cpp // Purpose: wxLuaBinding // Author: Ray Gilbert, John Labenski, J Winwood Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** wxlcallb.cpp 3 Jan 2008 00:05:58 -0000 1.54 --- wxlcallb.cpp 4 Jan 2008 00:21:08 -0000 1.55 *************** *** 27,31 **** wxLuaEventCallback::wxLuaEventCallback() ! : m_luafunc_ref(0), m_wxlState(wxNullLuaState), m_evtHandler(NULL), m_id(wxID_ANY), m_last_id(wxID_ANY), m_wxlBindEvent(NULL) --- 27,31 ---- wxLuaEventCallback::wxLuaEventCallback() ! : m_luafunc_ref(0), //m_wxlState(wxNullLuaState), m_evtHandler(NULL), m_id(wxID_ANY), m_last_id(wxID_ANY), m_wxlBindEvent(NULL) *************** *** 48,51 **** --- 48,52 ---- wxEventType eventType, wxEvtHandler *evtHandler) { + // Assert too since these errors are serious and not just bad Lua code. wxCHECK_MSG(evtHandler != NULL, wxT("Invalid wxEvtHandler in wxLuaEventCallback::Connect()"), wxT("Invalid wxEvtHandler in wxLuaEventCallback::Connect()")); wxCHECK_MSG((m_evtHandler == NULL) && (m_luafunc_ref == 0), wxT("Attempting to reconnect a wxLuaEventCallback"), wxT("Attempting to reconnect a wxLuaEventCallback")); *************** *** 59,66 **** m_wxlBindEvent = wxlState.GetBindEvent(eventType); if (m_wxlBindEvent == NULL) { - // Do not install this invalid or unknown event type since we won't know - // what wxEvent type class to use and someone probably made a mistake. return wxString::Format(wxT("wxLua: Invalid or unknown wxEventType for wxEvtHandler::Connect() : %d, winIds %d, %d."), (int)eventType, win_id, last_id); --- 60,67 ---- m_wxlBindEvent = wxlState.GetBindEvent(eventType); + // Do not install this invalid or unknown event type since we won't know + // what wxEvent type class to use and someone probably made a mistake. if (m_wxlBindEvent == NULL) { return wxString::Format(wxT("wxLua: Invalid or unknown wxEventType for wxEvtHandler::Connect() : %d, winIds %d, %d."), (int)eventType, win_id, last_id); *************** *** 75,78 **** --- 76,80 ---- // Note: We use the callback userdata and not the event sink since the event sink // requires a wxEvtHandler object which is a fairly large class. + // The userdata is also deleted for us which makes m_evtHandler->Connect(win_id, last_id, eventType, (wxObjectEventFunction)&wxLuaEventCallback::OnAllEvents, *************** *** 98,106 **** 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 a destroy event wxLuaState wxlState(theCallback->GetwxLuaState()); if (wxlState.Ok()) --- 100,109 ---- wxEventType evtType = event.GetEventType(); ! // Get the wxLuaEventCallback instance to use which is NOT "this" since ! // "this" is a central event handler function. i.e. this != theCallback wxLuaEventCallback *theCallback = (wxLuaEventCallback *)event.m_callbackUserData; wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaEventCallback in wxEvent user data")); ! // Not an error if !Ok(), the wxLuaState is cleared during shutdown or after a destroy event. wxLuaState wxlState(theCallback->GetwxLuaState()); if (wxlState.Ok()) *************** *** 120,124 **** // Cannot call it if Lua is gone or the interpreter has been destroyed // This can happen when the program exists since windows may be destroyed ! // after Lua has been deleted if (!m_wxlState.Ok()) return; --- 123,127 ---- // Cannot call it if Lua is gone or the interpreter has been destroyed // This can happen when the program exists since windows may be destroyed ! // after Lua has been deleted. if (!m_wxlState.Ok()) return; *************** *** 127,133 **** wxLuaState wxlState(m_wxlState); ! int event_wxl_type = 0; ! // If !m_wxlBindEvent, we would have errored in Connect(), but... if (m_wxlBindEvent != NULL) { --- 130,136 ---- wxLuaState wxlState(m_wxlState); ! int event_wxl_type = WXLUA_TUNKNOWN; ! // If !m_wxlBindEvent, we would have errored in Connect(), but don't crash... if (m_wxlBindEvent != NULL) { *************** *** 144,152 **** event_wxl_type = *wxlClass->wxluatype; else ! event_wxl_type = g_wxluatag_wxEvent; // get the s_wxluatag_wxEvent } } else ! event_wxl_type = g_wxluatag_wxEvent; // get the s_wxluatag_wxEvent // Should never get here, but error out in case we do --- 147,155 ---- event_wxl_type = *wxlClass->wxluatype; else ! event_wxl_type = g_wxluatag_wxEvent; // get the g_wxluatag_wxEvent } } else ! event_wxl_type = g_wxluatag_wxEvent; // get the g_wxluatag_wxEvent // Should never get here, but error out in case we do *************** *** 160,174 **** if (wxlState.lua_SetFenv(-2) != 0) { ! // don't track this since we don't own it ! // Tracking this causes clashes in the object registry table ! // since many can be created and deleted and the mem address is resused by C++. wxlState.wxluaT_PushUserDataType(event, event_wxl_type, false); ! wxlState.LuaPCall(1, 0); } 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) --- 163,177 ---- if (wxlState.lua_SetFenv(-2) != 0) { ! // Don't track the wxEvent since we don't own it and tracking it ! // causes clashes in the object registry table since many can be ! // created and deleted and the mem address is resused by C++. wxlState.wxluaT_PushUserDataType(event, event_wxl_type, false); ! wxlState.LuaPCall(1, 0); // one input no returns } else ! wxlState.wxlua_Error("wxLua: wxEvtHandler::Connect() in wxLuaEventCallback::OnEvent(), function is not a Lua function."); } else ! wxlState.wxlua_Error("wxLua: wxEvtHandler::Connect() in wxLuaEventCallback::OnEvent(), function to call is not refed."); wxlState.lua_SetTop(oldTop); // pop function from the stack (if it's there) *************** *** 185,188 **** --- 188,192 ---- { wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); + wxCHECK_RET(m_window != NULL, wxT("Invalid wxWindow")); m_wxlState.AddTrackedWinDestroyCallback(this); *************** *** 211,215 **** { wxString winName(wxT("wxWindow?")); ! if (m_window && m_window->GetClassInfo() && m_window->GetClassInfo()->GetClassName()) winName = m_window->GetClassInfo()->GetClassName(); --- 215,219 ---- { wxString winName(wxT("wxWindow?")); ! if (m_window && m_window->GetClassInfo()) winName = m_window->GetClassInfo()->GetClassName(); *************** *** 240,244 **** if (m_wxlState.Ok()) { ! // clear the metatable for the copy of the we are tracking (clears it for all copies too) wxluaO_untrackweakobject(m_wxlState.GetLuaState(), NULL, m_window); wxlua_removederivedmethods(m_wxlState.GetLuaState(), m_window); --- 244,248 ---- if (m_wxlState.Ok()) { ! // clear the metatable for all userdata we're tracking. wxluaO_untrackweakobject(m_wxlState.GetLuaState(), NULL, m_window); wxlua_removederivedmethods(m_wxlState.GetLuaState(), m_window); *************** *** 277,280 **** --- 281,287 ---- lua_pop(L, 1); // pop value + // The code below is the equivalent of this, but works while iterating + // "m_wxlState.RemoveTrackedEventCallback(wxlCallback);" + lua_pushvalue(L, -1); // copy key for next iteration lua_pushnil(L); |
From: John L. <jr...@us...> - 2008-01-04 00:21:19
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6007/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp Log Message: Fix typos in comments Only need wxWindow = wxLuaWinDestroyCallback in the wxlua_lreg_windestroycallbacks_key table Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** wxldebug.cpp 22 Dec 2007 16:42:01 -0000 1.63 --- wxldebug.cpp 4 Jan 2008 00:21:08 -0000 1.64 *************** *** 376,381 **** value = s.AfterFirst(wxT('|')); } ! else if ((lightuserdata_reg_key == &wxlua_lreg_windestroycallbacks_key) && ! (lua_type(L, -1) == LUA_TLIGHTUSERDATA)) { // only handle t[wxWindow*] = wxLuaWinDestroyCallback* --- 376,380 ---- value = s.AfterFirst(wxT('|')); } ! else if (lightuserdata_reg_key == &wxlua_lreg_windestroycallbacks_key) { // only handle t[wxWindow*] = wxLuaWinDestroyCallback* |
From: John L. <jr...@us...> - 2008-01-04 00:21:19
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6007/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlcallb.h wxldefs.h wxlstate.h wxlua.h Log Message: Fix typos in comments Only need wxWindow = wxLuaWinDestroyCallback in the wxlua_lreg_windestroycallbacks_key table Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** wxldefs.h 22 Dec 2007 06:07:15 -0000 1.40 --- wxldefs.h 4 Jan 2008 00:21:08 -0000 1.41 *************** *** 3,9 **** // Purpose: wxLua common defines // Author: John Labenski - // Modified by: // Created: 5/28/2005 - // RCS-ID: // Copyright: (c) John Labenski // Licence: wxWidgets licence --- 3,7 ---- Index: wxlcallb.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlcallb.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** wxlcallb.h 3 Jan 2008 00:05:58 -0000 1.27 --- wxlcallb.h 4 Jan 2008 00:21:08 -0000 1.28 *************** *** 19,23 **** // 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 used with wxEvtHandler::Connect() with this as the // callback user data for event. // --- 19,23 ---- // 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 used with wxEvtHandler::Connect() with "this" as the // callback user data for event. // *************** *** 41,45 **** virtual ~wxLuaEventCallback(); ! // Verifies the inputs and calls evtHandler->Connect() with this as // the callback userdata. // lua_func_stack_idx is the Lua stack index of a function to call with --- 41,45 ---- virtual ~wxLuaEventCallback(); ! // Verifies the inputs and calls evtHandler->Connect() with "this" as // the callback userdata. // lua_func_stack_idx is the Lua stack index of a function to call with *************** *** 64,74 **** const wxLuaBindEvent* GetwxLuaBindEvent() const { return m_wxlBindEvent; } ! // 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 OnEvent() for the actual ! // wxLuaEventCallback callback userdata. This function is treated like a ! // static function that all handlers of this class will call. void OnAllEvents(wxEvent& event); --- 64,75 ---- const wxLuaBindEvent* GetwxLuaBindEvent() const { return m_wxlBindEvent; } ! // Get a human readable string about this callback. // "wxEVT_XXX(evt#) -> wxLuaEventCallback(&callback, ids %d %d)|wxEvtHandler(&evthandler) -> wxEvtHandlerClassName" wxString GetInfo() const; // Get a human readable string // Central event handler that calls OnEvent() for the actual ! // wxLuaEventCallback callback userdata. ! // This function is treated like a static function that all handlers of ! // this class will call. void OnAllEvents(wxEvent& event); *************** *** 78,83 **** protected: ! int m_luafunc_ref; // ref to the Lua routine to call in the wxlua_lreg_refs_key registry table ! wxLuaState m_wxlState; // store it since we're added to a list of its callbacks. wxEvtHandler* m_evtHandler; wxWindowID m_id; --- 79,84 ---- protected: ! int m_luafunc_ref; // ref of the Lua routine to call in the wxlua_lreg_refs_key registry table ! wxLuaState m_wxlState; // stored to verify that that lua_State is still active wxEvtHandler* m_evtHandler; wxWindowID m_id; *************** *** 119,127 **** // Central event handler that calls OnDestroy() for the actual ! // wxLuaWinDestroyCallback callback user data. This function is treated like a ! // static function that all handlers of this class will call. void OnAllDestroyEvents(wxWindowDestroyEvent& event); ! // Handle the event by clearing the metatable for the window virtual void OnDestroy(wxWindowDestroyEvent& event); --- 120,129 ---- // Central event handler that calls OnDestroy() for the actual ! // wxLuaWinDestroyCallback callback user data. ! // This function is treated like a static function that all handlers of ! // this class will call. void OnAllDestroyEvents(wxWindowDestroyEvent& event); ! // Handle the event by clearing the metatable for the window. virtual void OnDestroy(wxWindowDestroyEvent& event); Index: wxlua.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlua.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxlua.h 23 Feb 2006 05:51:46 -0000 1.6 --- wxlua.h 4 Jan 2008 00:21:08 -0000 1.7 *************** *** 1,3 **** --- 1,4 ---- ///////////////////////////////////////////////////////////////////////////// + // Name: wxlua.h // Purpose: Single header to include for wxLua // Author: J Winwood Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** wxlbind.h 3 Jan 2008 00:05:58 -0000 1.76 --- wxlbind.h 4 Jan 2008 00:21:08 -0000 1.77 *************** *** 1,7 **** ///////////////////////////////////////////////////////////////////////////// // Purpose: wxLuaBinding // Author: Ray Gilbert, John Labenski, J Winwood // Created: 14/11/2001 ! // Copyright: // Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// --- 1,8 ---- ///////////////////////////////////////////////////////////////////////////// + // Name: wxlbind.h // Purpose: wxLuaBinding // Author: Ray Gilbert, John Labenski, J Winwood // Created: 14/11/2001 ! // Copyright: Ray Gilbert // Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** wxlstate.h 22 Dec 2007 06:07:15 -0000 1.112 --- wxlstate.h 4 Jan 2008 00:21:08 -0000 1.113 *************** *** 1,4 **** ///////////////////////////////////////////////////////////////////////////// ! // Purpose: wxWidgets interface to Lua // Author: Ray Gilbert, John Labenski, J Winwood // Created: 14/11/2001 --- 1,5 ---- ///////////////////////////////////////////////////////////////////////////// ! // Name: wxlstate.h ! // Purpose: wxLuaState - a wxWidgets interface to Lua // Author: Ray Gilbert, John Labenski, J Winwood // Created: 14/11/2001 *************** *** 70,74 **** // ---------------------------------------------------------------------------- ! // Special keys used by wxLua // // Note: We do not push a human readable string for these because Lua always --- 71,75 ---- // ---------------------------------------------------------------------------- ! // Special keys used by wxLua in the LUA_REGISTRYINDEX table. // // Note: We do not push a human readable string for these because Lua always *************** *** 77,84 **** // ---------------------------------------------------------------------------- ! // Light userdata used as keys in the Lua LUA_REGISTRYINDEX table for wxLua items. // Note that even though these keys have values, they're not used, just the memory address. ! // The key in the LUA_REGISTRYINDEX table that is a table indexed // on the wxLua types where each item is a userdata metatable for a C++ class. // Note: The wxLua types WXLUA_TXXX that correspond to the Lua LUA_TXXX types --- 78,85 ---- // ---------------------------------------------------------------------------- ! // Light userdata used as keys in the Lua LUA_REGISTRYINDEX table for wxLua. // Note that even though these keys have values, they're not used, just the memory address. ! // The key in the LUA_REGISTRYINDEX table that is a numerically keyed table indexed // on the wxLua types where each item is a userdata metatable for a C++ class. // Note: The wxLua types WXLUA_TXXX that correspond to the Lua LUA_TXXX types *************** *** 93,106 **** 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 extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_debug_refs_key; ! // The key that in the LUA_REGISTRYINDEX table that is a table of ! // C++ classname keys and lightuserdata pointers to the associated wxLuaBindClass. // LUA_REGISTRYINDEX[&wxlua_lreg_debug_refs_key][wxLuaBindClass.name] = lightuserdata(&wxLuaBindClass) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_classes_key; // 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), ...} --- 94,107 ---- 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 and ! // stores their value for lookup. It is used only for the wxLuaDebugData. // LUA_REGISTRYINDEX[&wxlua_lreg_debug_refs_key][ref number] = Lua object extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_debug_refs_key; ! // The key that in the LUA_REGISTRYINDEX table that is a lookup table of string ! // C++ classname keys and lightuserdata pointers to the associated wxLuaBindClass struct. // LUA_REGISTRYINDEX[&wxlua_lreg_debug_refs_key][wxLuaBindClass.name] = lightuserdata(&wxLuaBindClass) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_classes_key; // The key in the LUA_REGISTRYINDEX table that is a table ! // of Lua objects/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), ...} *************** *** 110,114 **** // LUA_REGISTRYINDEX[&wxlua_lreg_wxluastate_key] = lightuserdata(&wxLuaState) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_wxluastate_key; ! // The key in the LUA_REGISTRYINDEX table that is table of all // objects that we've pushed into Lua using wxluaT_pushuserdatatype(). // Note: A single object like a wxWindow may be pushed with multiple wxLua types. --- 111,115 ---- // LUA_REGISTRYINDEX[&wxlua_lreg_wxluastate_key] = lightuserdata(&wxLuaState) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_wxluastate_key; ! // The key in the LUA_REGISTRYINDEX table that is a table of all // objects that we've pushed into Lua using wxluaT_pushuserdatatype(). // Note: A single object like a wxWindow may be pushed with multiple wxLua types. *************** *** 117,141 **** // { wxLua type1 = weak fulluserdata, wxLua type2 = weak fulluserdata... } extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_weakobjects_key; ! // The key in the LUA_REGISTRYINDEX table that is table of all ! // objects tracked using wxluaO_addgcobject() to delete them when done. // Note that non wxObject classes use wxLUA_DECLARE_ENCAPSULATION so // the key is the object pointer and the value is the wxObject encapsulation. ! // Both the key and the value are the same if not encapsulated . // 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; ! // The key in the LUA_REGISTRYINDEX table that is table of all // top level wxWindows that we've created and need to destroy when closed. // LUA_REGISTRYINDEX[&wxlua_lreg_topwindows_key][lightuserdata(&wxWindow)] = 1 --- 118,140 ---- // { wxLua type1 = weak fulluserdata, wxLua type2 = weak fulluserdata... } extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_weakobjects_key; ! // The key in the LUA_REGISTRYINDEX table that is a table of all ! // objects to delete that were added using wxluaO_addgcobject(). // Note that non wxObject classes use wxLUA_DECLARE_ENCAPSULATION so // the key is the object pointer and the value is the wxObject encapsulation. ! // Both the key and the value are the same if not encapsulated. // 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 a 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 a table of wxWindow keys and ! // wxLuaWinDestroyCallback values that we've created. // LUA_REGISTRYINDEX[&wxlua_lreg_windestroycallbacks_key][lightuserdata(&wxWindow)] = // lightuserdata(wxLuaWinDestroyCallback) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_windestroycallbacks_key; ! // The key in the LUA_REGISTRYINDEX table that is a table of all // top level wxWindows that we've created and need to destroy when closed. // LUA_REGISTRYINDEX[&wxlua_lreg_topwindows_key][lightuserdata(&wxWindow)] = 1 |
From: John L. <jr...@us...> - 2008-01-03 00:06:03
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27681/wxLua/modules/wxlua/src Modified Files: wxlcallb.cpp wxlstate.cpp Log Message: Change wxLuaEventCallback so it doesn't connect in the constructor to allow deleting it if it fails before calling lua_error() and it's long jmp. Renamed the event handler functions to OnEvent() to match the wxWidgets semantics. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** wxlstate.cpp 22 Dec 2007 06:07:16 -0000 1.156 --- wxlstate.cpp 3 Jan 2008 00:05:58 -0000 1.157 *************** *** 992,996 **** wxCHECK_MSG(wxlState.Ok(), false, wxT("Invalid wxLuaState")); wxLuaWinDestroyCallback *pCallback = ! new wxLuaWinDestroyCallback(wxlState, win, wxl_type); if (pCallback == NULL) --- 992,996 ---- wxCHECK_MSG(wxlState.Ok(), false, wxT("Invalid wxLuaState")); wxLuaWinDestroyCallback *pCallback = ! new wxLuaWinDestroyCallback(wxlState, win); if (pCallback == NULL) Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** wxlcallb.cpp 22 Dec 2007 06:07:15 -0000 1.53 --- wxlcallb.cpp 3 Jan 2008 00:05:58 -0000 1.54 *************** *** 26,42 **** 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) { ! wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); ! m_wxlBindEvent = wxlState.GetBindEvent(eventType); ! m_wxlState.AddTrackedEventCallback(this); if (m_wxlBindEvent == NULL) --- 26,61 ---- IMPLEMENT_ABSTRACT_CLASS(wxLuaEventCallback, wxObject) ! wxLuaEventCallback::wxLuaEventCallback() ! : m_luafunc_ref(0), m_wxlState(wxNullLuaState), ! m_evtHandler(NULL), m_id(wxID_ANY), m_last_id(wxID_ANY), m_wxlBindEvent(NULL) + { + } + wxLuaEventCallback::~wxLuaEventCallback() { ! // Remove the reference to the Lua function that we call ! if (m_wxlState.Ok()) ! { ! m_wxlState.wxluaR_Unref(m_luafunc_ref, &wxlua_lreg_refs_key); ! // delete the reference to this handler ! m_wxlState.RemoveTrackedEventCallback(this); ! } ! } ! wxString wxLuaEventCallback::Connect(const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID win_id, wxWindowID last_id, ! wxEventType eventType, wxEvtHandler *evtHandler) ! { ! wxCHECK_MSG(evtHandler != NULL, wxT("Invalid wxEvtHandler in wxLuaEventCallback::Connect()"), wxT("Invalid wxEvtHandler in wxLuaEventCallback::Connect()")); ! wxCHECK_MSG((m_evtHandler == NULL) && (m_luafunc_ref == 0), wxT("Attempting to reconnect a wxLuaEventCallback"), wxT("Attempting to reconnect a wxLuaEventCallback")); ! wxCHECK_MSG(wxlState.Ok(), wxT("Invalid wxLuaState"), wxT("Invalid wxLuaState")); ! m_wxlState = wxlState; ! m_evtHandler = evtHandler; ! m_id = win_id; ! m_last_id = last_id; ! ! m_wxlBindEvent = wxlState.GetBindEvent(eventType); if (m_wxlBindEvent == NULL) *************** *** 44,71 **** // Do not install this invalid or unknown event type since we won't know // what wxEvent type class to use and someone probably made a mistake. ! wxString msg = wxString::Format(wxT("Invalid or unknown wxEventType : %d, winIds %d %d."), ! (int)eventType, win_id, last_id); ! m_wxlState.wxlua_Error(msg); ! return; } // 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 ! if (m_wxlState.Ok()) ! { ! m_wxlState.wxluaR_Unref(m_routine, &wxlua_lreg_refs_key); ! // delete the reference to this handler ! m_wxlState.RemoveTrackedEventCallback(this); ! } } --- 63,82 ---- // Do not install this invalid or unknown event type since we won't know // what wxEvent type class to use and someone probably made a mistake. ! return wxString::Format(wxT("wxLua: Invalid or unknown wxEventType for wxEvtHandler::Connect() : %d, winIds %d, %d."), ! (int)eventType, win_id, last_id); } + m_wxlState.AddTrackedEventCallback(this); + // create a reference to the Lua event handler function if (lua_func_stack_idx != WXLUAEVENTCALLBACK_NOROUTINE) ! m_luafunc_ref = m_wxlState.wxluaR_Ref(lua_func_stack_idx, &wxlua_lreg_refs_key); + // Note: We use the callback userdata and not the event sink since the event sink + // requires a wxEvtHandler object which is a fairly large class. m_evtHandler->Connect(win_id, last_id, eventType, ! (wxObjectEventFunction)&wxLuaEventCallback::OnAllEvents, this); ! return wxEmptyString; } *************** *** 83,87 **** } ! void wxLuaEventCallback::EventHandler(wxEvent& event) { wxEventType evtType = event.GetEventType(); --- 94,98 ---- } ! void wxLuaEventCallback::OnAllEvents(wxEvent& event) { wxEventType evtType = event.GetEventType(); *************** *** 91,100 **** 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 wxLuaState wxlState(theCallback->GetwxLuaState()); if (wxlState.Ok()) { wxlState.SetInEventType(evtType); ! theCallback->CallFunction(&event); wxlState.SetInEventType(wxEVT_NULL); } --- 102,111 ---- wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaEventCallback in wxEvent user data")); ! // Ok if !Ok() since the wxLuaState may been cleared during shutdown or after a destroy event wxLuaState wxlState(theCallback->GetwxLuaState()); if (wxlState.Ok()) { wxlState.SetInEventType(evtType); ! theCallback->OnEvent(&event); wxlState.SetInEventType(wxEVT_NULL); } *************** *** 102,109 **** // we want the wxLuaWinDestroyCallback to get this too if (evtType == wxEVT_DESTROY) ! event.Skip(); } ! void wxLuaEventCallback::CallFunction(wxEvent *event) { // Cannot call it if Lua is gone or the interpreter has been destroyed --- 113,120 ---- // we want the wxLuaWinDestroyCallback to get this too if (evtType == wxEVT_DESTROY) ! event.Skip(true); } ! void wxLuaEventCallback::OnEvent(wxEvent *event) { // Cannot call it if Lua is gone or the interpreter has been destroyed *************** *** 118,122 **** int event_wxl_type = 0; ! // If !m_wxlBindEvent, we would have errored in the constructor, but... if (m_wxlBindEvent != NULL) { --- 129,133 ---- int event_wxl_type = 0; ! // If !m_wxlBindEvent, we would have errored in Connect(), but... if (m_wxlBindEvent != NULL) { *************** *** 144,153 **** wxlState.lua_CheckStack(LUA_MINSTACK); int oldTop = wxlState.lua_GetTop(); ! if (wxlState.wxluaR_GetRef(m_routine, &wxlua_lreg_refs_key)) { wxlState.lua_PushValue(LUA_GLOBALSINDEX); if (wxlState.lua_SetFenv(-2) != 0) { ! // don't track this since we didn't create it // Tracking this causes clashes in the object registry table // since many can be created and deleted and the mem address is resused by C++. --- 155,164 ---- wxlState.lua_CheckStack(LUA_MINSTACK); int oldTop = wxlState.lua_GetTop(); ! if (wxlState.wxluaR_GetRef(m_luafunc_ref, &wxlua_lreg_refs_key)) { wxlState.lua_PushValue(LUA_GLOBALSINDEX); if (wxlState.lua_SetFenv(-2) != 0) { ! // don't track this since we don't own it // Tracking this causes clashes in the object registry table // since many can be created and deleted and the mem address is resused by C++. *************** *** 170,174 **** wxLuaWinDestroyCallback::wxLuaWinDestroyCallback(const wxLuaState& wxlState, ! wxWindow* win, int iTag) :m_wxlState(wxlState), m_window(win) { --- 181,185 ---- wxLuaWinDestroyCallback::wxLuaWinDestroyCallback(const wxLuaState& wxlState, ! wxWindow* win) :m_wxlState(wxlState), m_window(win) { *************** *** 179,183 **** // connect the event handler m_window->Connect(m_window->GetId(), wxEVT_DESTROY, ! (wxObjectEventFunction)&wxLuaWinDestroyCallback::EventHandler, this); } --- 190,194 ---- // connect the event handler m_window->Connect(m_window->GetId(), wxEVT_DESTROY, ! (wxObjectEventFunction)&wxLuaWinDestroyCallback::OnAllDestroyEvents, this); } *************** *** 208,212 **** } ! void wxLuaWinDestroyCallback::EventHandler(wxWindowDestroyEvent& event) { // Central handler for events, forward to the specific instance --- 219,223 ---- } ! void wxLuaWinDestroyCallback::OnAllDestroyEvents(wxWindowDestroyEvent& event) { // Central handler for events, forward to the specific instance *************** *** 261,265 **** // 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(); --- 272,276 ---- // remove the ref to the routine since we're clearing the wxLuaState // See ~wxLuaEventCallback ! m_wxlState.wxluaR_Unref(wxlCallback->GetLuaFuncRef(), &wxlua_lreg_refs_key); wxlCallback->ClearwxLuaState(); |
From: John L. <jr...@us...> - 2008-01-03 00:06:01
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27681/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlcallb.h Log Message: Change wxLuaEventCallback so it doesn't connect in the constructor to allow deleting it if it fails before calling lua_error() and it's long jmp. Renamed the event handler functions to OnEvent() to match the wxWidgets semantics. Index: wxlcallb.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlcallb.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wxlcallb.h 22 Dec 2007 06:07:15 -0000 1.26 --- wxlcallb.h 3 Jan 2008 00:05:58 -0000 1.27 *************** *** 15,29 **** // ---------------------------------------------------------------------------- ! // 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 // callback user data for event. // ! // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. // ! // The function EventHandler() generically handles the events and forwards them ! // to the event's wxLuaEventCallback callback user data function CallFunction(). // ---------------------------------------------------------------------------- --- 15,31 ---- // ---------------------------------------------------------------------------- ! // wxLuaEventCallback - Forward events from 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 used with wxEvtHandler::Connect() with this as the // callback user data for event. // ! // Do NOT delete wxLuaEventCallbacks since the wxEvtHandler deletes the ! // callback user data itself. // ! // The function wxLuaEventCallback::OnAllEvents() generically handles all wxEvents ! // by retrieving the wxLuaEventCallback instance from the wxEvent userdata ! // to call wxLuaEventCallback::OnEvent() on the correct instance. // ---------------------------------------------------------------------------- *************** *** 34,45 **** { 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() --- 36,56 ---- { public: ! // default constructor, call Connect() to actually connect the event ! wxLuaEventCallback(); virtual ~wxLuaEventCallback(); + // Verifies the inputs and calls evtHandler->Connect() with this as + // the callback userdata. + // lua_func_stack_idx is the Lua stack index of a function to call with + // the wxEvent as the single parameter. + // win_id and last_id follow the same notation as wxEvtHandler::Connect(). + // If only one event Id is needed set last_id = wxID_ANY + // Returns an empty string on success and the wxEvtHandler takes ownership of this, + // otherwise an error message and you must delete this since nobody else will. + virtual wxString Connect( const wxLuaState& wxlState, int lua_func_stack_idx, + wxWindowID win_id, wxWindowID last_id, + wxEventType eventType, wxEvtHandler *evtHandler ); + void ClearwxLuaState(); // m_wxlState.UnRef() *************** *** 49,53 **** wxEventType GetEventType() const { return m_wxlBindEvent ? *m_wxlBindEvent->eventType : wxEVT_NULL; } wxEvtHandler* GetEvtHandler() const { return m_evtHandler; } ! int GetLuaRoutine() const { return m_routine; } const wxLuaBindEvent* GetwxLuaBindEvent() const { return m_wxlBindEvent; } --- 60,64 ---- wxEventType GetEventType() const { return m_wxlBindEvent ? *m_wxlBindEvent->eventType : wxEVT_NULL; } wxEvtHandler* GetEvtHandler() const { return m_evtHandler; } ! int GetLuaFuncRef() const { return m_luafunc_ref; } const wxLuaBindEvent* GetwxLuaBindEvent() const { return m_wxlBindEvent; } *************** *** 57,72 **** 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); ! // Handle the event by calling the Lua function to handle the event. ! // The Lua function will receive a single parameter, the type of event. ! virtual void CallFunction(wxEvent *event); protected: ! int m_routine; // ref to the Lua routine to call in the wxlua_lreg_refs_key registry table ! wxLuaState m_wxlState; // store it since we're added to a list of its callbacks. wxEvtHandler* m_evtHandler; wxWindowID m_id; --- 68,83 ---- wxString GetInfo() const; // Get a human readable string ! // Central event handler that calls OnEvent() for the actual ! // wxLuaEventCallback callback userdata. This function is treated like a // static function that all handlers of this class will call. ! void OnAllEvents(wxEvent& event); ! // Handle the wxEvent by calling the Lua function to handle the event. ! // The Lua function will receive a single parameter, the wxEvent. ! virtual void OnEvent(wxEvent *event); protected: ! int m_luafunc_ref; // ref to the Lua routine to call in the wxlua_lreg_refs_key registry table ! wxLuaState m_wxlState; // store it since we're added to a list of its callbacks. wxEvtHandler* m_evtHandler; wxWindowID m_id; *************** *** 83,92 **** // Clears the metatable for the wxWindow userdata so that after a call to // win:Destroy() calling a function on win won't crash wxLua, but will generate ! // an error in Lua. // // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. // ! // The function EventHandler() generically handles the events and forwards them ! // to the event's wxLuaWinDestroyCallback callback user data function OnDestroy(). // ---------------------------------------------------------------------------- --- 94,103 ---- // Clears the metatable for the wxWindow userdata so that after a call to // win:Destroy() calling a function on win won't crash wxLua, but will generate ! // an error message in Lua. // // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. // ! // The function OnAllDestroyEvents() generically handles the events and forwards them ! // to the wxEvent's wxLuaWinDestroyCallback callback user data function OnDestroy(). // ---------------------------------------------------------------------------- *************** *** 94,98 **** { public: ! wxLuaWinDestroyCallback(const wxLuaState& state, wxWindow *win, int iTag); virtual ~wxLuaWinDestroyCallback(); --- 105,109 ---- { public: ! wxLuaWinDestroyCallback(const wxLuaState& state, wxWindow *win); virtual ~wxLuaWinDestroyCallback(); *************** *** 110,114 **** // wxLuaWinDestroyCallback callback user data. This function is treated like a // static function that all handlers of this class will call. ! void EventHandler(wxWindowDestroyEvent& event); // Handle the event by clearing the metatable for the window --- 121,125 ---- // wxLuaWinDestroyCallback callback user data. This function is treated like a // static function that all handlers of this class will call. ! void OnAllDestroyEvents(wxWindowDestroyEvent& event); // Handle the event by clearing the metatable for the window Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** wxlbind.h 22 Dec 2007 06:07:15 -0000 1.75 --- wxlbind.h 3 Jan 2008 00:05:58 -0000 1.76 *************** *** 24,33 **** // Binding wxLua types are positive integers generated automatically when initialized ! // so the inbuilt wxLua types (WXLUA_TXXX) corresponding to Lua types // (LUA_TXXX) are negative values. // *Use the function bool wxlua_iswxuserdatatype(wxl_type) if you want to // differentiate between the two. // ! // Note that WXLUA_TUNKNOWN is use as initialiser for class types // and is used as an end marker for the wxLuaArgType array that // represents function prototype argument types in the wxLuaBindCFunc struct. --- 24,33 ---- // Binding wxLua types are positive integers generated automatically when initialized ! // and the inbuilt wxLua types (WXLUA_TXXX) corresponding to Lua types // (LUA_TXXX) are negative values. // *Use the function bool wxlua_iswxuserdatatype(wxl_type) if you want to // differentiate between the two. // ! // Note that WXLUA_TUNKNOWN is used as an initialiser for class types // and is used as an end marker for the wxLuaArgType array that // represents function prototype argument types in the wxLuaBindCFunc struct. *************** *** 52,60 **** // Blindly convert the lua_type to the wxlua_type. Note: WXLUA_TXXX = -1*LUA_TXXX - 2 ! // *** See wxlua_luatowxluatype() for better function *** #define LUAT_TO_WXLUAT(luatype) (-1*(luatype) - 2) // Variables used in the wxLuaArgType member of the wxLuaBindCFunc for ! // Lua types. The binding generator will use these and generate new ones for // classes and structs as specified in the bindings. extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatype_TNONE; --- 52,60 ---- // Blindly convert the lua_type to the wxlua_type. Note: WXLUA_TXXX = -1*LUA_TXXX - 2 ! // *** See wxlua_luatowxluatype() for a better function *** #define LUAT_TO_WXLUAT(luatype) (-1*(luatype) - 2) // Variables used in the wxLuaArgType member of the wxLuaBindCFunc for ! // Lua types. The binding generator uses these and generates new ones for // classes and structs as specified in the bindings. extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatype_TNONE; *************** *** 71,75 **** extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatype_TCFUNCTION; ! // copies of wxLua types for binding types that are used very often extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_NULL; // wxLua type for NULL pointer extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxEvent; // wxLua type for wxEvents --- 71,77 ---- extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatype_TCFUNCTION; ! // Copies of wxLua types that are used very often. ! // Note that we do not use the original since we may not be linked ! // to the binding library that defines them. extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_NULL; // wxLua type for NULL pointer extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxEvent; // wxLua type for wxEvents *************** *** 81,85 **** // ---------------------------------------------------------------------------- ! // wxLuaBindCFunc and friends - Defines a single C func for a LUA method // ---------------------------------------------------------------------------- --- 83,87 ---- // ---------------------------------------------------------------------------- ! // wxLuaArgType a pointer to a declared wxLua type, see wxLuaBindCFunc::argtypes // ---------------------------------------------------------------------------- *************** *** 87,91 **** extern WXDLLIMPEXP_DATA_WXLUA(wxLuaArgType) g_wxluaargtypeArray_None[1]; // = {0} ! // Values for the wxLuaBindMethod::type and wxLuaBindCFunc::type enum wxLuaMethod_Type { --- 89,95 ---- extern WXDLLIMPEXP_DATA_WXLUA(wxLuaArgType) g_wxluaargtypeArray_None[1]; // = {0} ! // ---------------------------------------------------------------------------- ! // wxLuaMethod_Type: Values for the wxLuaBindMethod::method_type and wxLuaBindCFunc::method_type ! // ---------------------------------------------------------------------------- enum wxLuaMethod_Type { *************** *** 112,115 **** --- 116,123 ---- }; + // ---------------------------------------------------------------------------- + // wxLuaBindCFunc - Defines a single function for wxLua + // ---------------------------------------------------------------------------- + struct WXDLLIMPEXP_WXLUA wxLuaBindCFunc { *************** *** 117,126 **** int method_type; // enum wxLuaMethod_Type flags for this function int minargs; // Min number of required args ! int maxargs; // Total number of args allowed wxLuaArgType* argtypes; // Array of wxLua types representing each argument, zero terminated. }; // ---------------------------------------------------------------------------- ! // wxLuaBindMethod - Defines a LUA method or property // ---------------------------------------------------------------------------- --- 125,134 ---- int method_type; // enum wxLuaMethod_Type flags for this function int minargs; // Min number of required args ! int maxargs; // Max number of args allowed wxLuaArgType* argtypes; // Array of wxLua types representing each argument, zero terminated. }; // ---------------------------------------------------------------------------- ! // wxLuaBindMethod - Defines a method or property (a function) for wxLua // ---------------------------------------------------------------------------- *************** *** 183,205 **** // ---------------------------------------------------------------------------- ! // wxLuaBindClass - Defines a LUA C++ class interface // ---------------------------------------------------------------------------- struct WXDLLIMPEXP_WXLUA wxLuaBindClass { ! const char* name; // Name of the class ! wxLuaBindMethod* wxluamethods; // Pointer to methods for this class ! int wxluamethods_n; // Number of methods ! wxClassInfo* classInfo; // Pointer to the wxClassInfo associated with this class or NULL. ! int* wxluatype; // wxLua class type for userdata ! const char* baseclassName; // Name of base class, or NULL if none. ! wxLuaBindClass* baseclass; // Pointer to the base class or NULL for none. ! // This member is set after all the bindings are ! // registered since the base class may be from ! // a different module (a library perhaps). ! // See wxLuaBinding::SetBaseClass() ! wxLuaBindNumber* enums; // Class member enums or NULL if none ! int enums_n; // number of enums }; --- 191,213 ---- // ---------------------------------------------------------------------------- ! // wxLuaBindClass - Defines a C++ class or struct for wxLua // ---------------------------------------------------------------------------- struct WXDLLIMPEXP_WXLUA wxLuaBindClass { ! const char* name; // Name of the class or struct ! wxLuaBindMethod* wxluamethods; // Pointer to methods for this class ! int wxluamethods_n; // Number of methods ! wxClassInfo* classInfo; // Pointer to the wxClassInfo associated with this class or NULL. ! int* wxluatype; // wxLua class type for userdata ! const char* baseclassName; // Name of base class, or NULL if none. ! wxLuaBindClass* baseclass; // Pointer to the base class or NULL for none. ! // This member is set after all the bindings are ! // registered since the base class may be from ! // a different module (a library perhaps). ! // See wxLuaBinding::SetBaseClass() ! wxLuaBindNumber* enums; // Class member enums or NULL if none ! int enums_n; // number of enums }; *************** *** 221,225 **** // ---------------------------------------------------------------------------- ! // Central function to call for overloaded functions // ---------------------------------------------------------------------------- --- 229,233 ---- // ---------------------------------------------------------------------------- ! // Overloaded binding function call helper functions. // ---------------------------------------------------------------------------- *************** *** 236,243 **** // ---------------------------------------------------------------------------- ! // wxLuaObject - wraps a reference to a Lua object reference inside a ! // wxObject-derived class so that a Lua object can be used for ! // user data, and also with a simple extension by a proxy member ! // value it can be used to provide pointers to the wxValidator classes. // ---------------------------------------------------------------------------- --- 244,251 ---- // ---------------------------------------------------------------------------- ! // wxLuaObject - Wraps a reference to a Lua object reference inside a ! // wxObject-derived class so that a Lua object can be used for userdata. ! // Also with a simple extension by a proxy member value it can be used ! // to provide pointers to the wxValidator classes. // ---------------------------------------------------------------------------- *************** *** 287,291 **** wxLuaState GetwxLuaState() const; ! private: wxLuaState* m_wxlState; // a pointer due to #include recursion. int m_reference; // reference in wxlua_lreg_refs_key registry table --- 295,299 ---- wxLuaState GetwxLuaState() const; ! protected: wxLuaState* m_wxlState; // a pointer due to #include recursion. int m_reference; // reference in wxlua_lreg_refs_key registry table *************** *** 301,304 **** --- 309,313 ---- }; + private: DECLARE_ABSTRACT_CLASS(wxLuaObject) }; *************** *** 339,343 **** // ---------------------------------------------------------------------------- // wxLuaSmartStringArray - Wraps a "new" array of wxStrings with an automatic ! // destructor to delete them to make binding easier // ---------------------------------------------------------------------------- class WXDLLIMPEXP_WXLUA wxLuaSmartStringArray --- 348,352 ---- // ---------------------------------------------------------------------------- // wxLuaSmartStringArray - Wraps a "new" array of wxStrings with an automatic ! // destructor that deletes them to make binding easier. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_WXLUA wxLuaSmartStringArray *************** *** 356,360 **** // ---------------------------------------------------------------------------- // wxLuaSmartIntArray - Wraps a "new" array of ints with an automatic ! // destructor to delete them to make binding easier. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_WXLUA wxLuaSmartIntArray --- 365,369 ---- // ---------------------------------------------------------------------------- // wxLuaSmartIntArray - Wraps a "new" array of ints with an automatic ! // destructor that deletes them to make binding easier. // ---------------------------------------------------------------------------- class WXDLLIMPEXP_WXLUA wxLuaSmartIntArray *************** *** 373,377 **** // ---------------------------------------------------------------------------- // wxLuaSmartwxArrayString - Wraps a "new" wxArrayString with an automatic ! // destructor to delete them to make binding easier // ---------------------------------------------------------------------------- --- 382,386 ---- // ---------------------------------------------------------------------------- // wxLuaSmartwxArrayString - Wraps a "new" wxArrayString with an automatic ! // destructor that deletes them to make binding easier. // ---------------------------------------------------------------------------- *************** *** 399,403 **** // ---------------------------------------------------------------------------- // wxLuaSmartwxSortedArrayString - Wraps a "new" wxSortedArrayString with an automatic ! // destructor to delete them to make binding easier // ---------------------------------------------------------------------------- --- 408,412 ---- // ---------------------------------------------------------------------------- // wxLuaSmartwxSortedArrayString - Wraps a "new" wxSortedArrayString with an automatic ! // destructor that deletes them to make binding easier. // ---------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2008-01-03 00:06:01
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27681/wxLua/bindings/wxwidgets Modified Files: wxcore_override.hpp Log Message: Change wxLuaEventCallback so it doesn't connect in the constructor to allow deleting it if it fails before calling lua_error() and it's long jmp. Renamed the event handler functions to OnEvent() to match the wxWidgets semantics. Index: wxcore_override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** wxcore_override.hpp 22 Dec 2007 06:07:08 -0000 1.15 --- wxcore_override.hpp 3 Jan 2008 00:05:56 -0000 1.16 *************** *** 1076,1081 **** wxWindowID winId = wxID_ANY; wxWindowID lastId = wxID_ANY; ! wxEventType eventType = 0; ! wxLuaEventCallback *pCallback = NULL; int nParams = lua_gettop(L); --- 1076,1080 ---- wxWindowID winId = wxID_ANY; wxWindowID lastId = wxID_ANY; ! wxEventType eventType = wxEVT_NULL; int nParams = lua_gettop(L); *************** *** 1173,1177 **** // Create and connect the callback ! pCallback = new wxLuaEventCallback(wxlState, func_idx, winId, lastId, eventType, evtHandler); return 0; --- 1172,1182 ---- // Create and connect the callback ! wxLuaEventCallback* pCallback = new wxLuaEventCallback; ! wxString errMsg(pCallback->Connect(wxlState, func_idx, winId, lastId, eventType, evtHandler)); ! if (!errMsg.IsEmpty()) ! { ! delete pCallback; ! wxlua_error(L, errMsg); ! } return 0; *************** *** 1191,1195 **** wxWindowID winId = wxID_ANY; wxWindowID lastId = wxID_ANY; ! wxEventType eventType = 0; int nParams = lua_gettop(L); --- 1196,1200 ---- wxWindowID winId = wxID_ANY; wxWindowID lastId = wxID_ANY; ! wxEventType eventType = wxEVT_NULL; int nParams = lua_gettop(L); *************** *** 1261,1266 **** } ! // Try to disconnect from the callback ! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaEventCallback::EventHandler); lua_pushboolean(L, returns); --- 1266,1271 ---- } ! // Try to disconnect from the callback, it will delete the wxLuaEventCallback. ! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaEventCallback::OnAllEvents); lua_pushboolean(L, returns); |