From: Gustl B. <gu...@gm...> - 2005-12-13 17:51:43
|
Hi, I have downloaded the wxLua Windows binaries a few months ago from the official site. It is really great. I tried to compile it under Linux but it did not work. So I wanted to download the current version, but the website seems to be a little out of date (some downloads are broken and the downloadable version is half a year old). Sourceforge has disabled CVS imports for annonymous users (for more than 3 weeks now)... Maybe someone could upload a CVS snapshot to the Sourceforge download section? Thanks, Houdini |
From: John L. <jla...@gm...> - 2005-12-14 05:31:12
|
On 12/13/05, Gustl Berger <gu...@gm...> wrote: > Hi, > I have downloaded the wxLua Windows binaries a few months ago from the > official site. It is really great. > I tried to compile it under Linux but it did not work. So I wanted to > download the current version, but the website seems to be a little out > of date (some downloads are broken and the downloadable version is half > a year old). Sourceforge has disabled CVS imports for annonymous users > (for more than 3 weeks now)... Really? You mean that you cannot checkout anything using an anonymous user from SF? This command seems to work for me at least. cvs -z3 -d:pserver:ano...@cv...:/cvsroot/wxlua co -P wxLua You can compile it all using the Makefile in apps/wxlua/src, then run $make in bindings/wxwidgets, the rerun $make in apps/wxlua/src. I still want to tweak the bindings a little before they're committed so that's why you have to do this extra step. Let me know if anything doesn't work for you. > Maybe someone could upload a CVS snapshot to the Sourceforge download > section? Let me know if the above anonymous cvs command doesn't work for you and also if you find any bugs. Regards, John Labenski |
From: Gustl B. <gu...@gm...> - 2005-12-15 20:10:35
|
Hi, > >Let me know if the above anonymous cvs command doesn't work for you > You were right, Sourceforge was not the problem (I tried and failed several times, then I read that something was wrong with anonymous CVS...). Compiling it under Visual Studio 2005 worked fine. >and also if you find any bugs. > As I wrote in the previous mail, I have already written an application with an old version of wxLua. But when I run the script in the new version, coroutines do not work anymore. wxLua: Error while running chunk wxLua: Attempt to call an invalid method '{unknown}'. stack traceback: [C]: in function 'resume' ... I saw that you made some changes in the lua code. I tried disabling them / replacing the lua library with the original version, but that did not solve the problem. Houdini |
From: John L. <jla...@gm...> - 2005-12-15 21:39:14
|
On 12/15/05, Gustl Berger <gu...@gm...> wrote: > >Let me know if the above anonymous cvs command doesn't work for you > > > You were right, Sourceforge was not the problem (I tried and failed > several times, then I read that something was wrong with anonymous CVS...= ). > Compiling it under Visual Studio 2005 worked fine. good. > >and also if you find any bugs. > > > As I wrote in the previous mail, I have already written an application > with an old version of wxLua. But when I run the script in the new > version, coroutines do not work anymore. > > wxLua: Error while running chunk > wxLua: Attempt to call an invalid method '{unknown}'. > stack traceback: > [C]: in function 'resume' > ... Humm, do you have a smallish wxLua script that demonstrates the problem? I think I know what the problem is, but I don't have any coroutine code. We had to make a small modification to lua to stick the wxLuaInterpreter into any new lua_States created by coroutines, but I think I need to do the same for the wxLuaState. I have added this code already, could you try again in a couple hours (for SF to sync it's cvs). > I saw that you made some changes in the lua code. I tried disabling them > / replacing the lua library with the original version, but that did not > solve the problem. I think you're refering to the above, this change in lua itself is unfortunately necessary otherwise the new lua_State created by the coroutine doesn't know anything about the wxLua wrappers. Regards, John Labenski |
From: Gustl B. <gu...@gm...> - 2005-12-15 23:04:24
|
Hi > >Humm, do you have a smallish wxLua script that demonstrates the >problem? I think I know what the problem is, but I don't have any >coroutine code. We had to make a small modification to lua to stick >the wxLuaInterpreter into any new lua_States created by coroutines, >but I think I need to do the same for the wxLuaState. > It was not easy to reproduce the situation in a small app but here it is: frame = wx.wxFrame(wx.wxNull, -1, "App", wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxDEFAULT_FRAME_STYLE); list = wx.wxListCtrl(frame, -1, wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxLC_SINGLE_SEL + wx.wxLC_REPORT + wx.wxLC_AUTOARRANGE); -- works print(list:GetItemCount()); function func() -- crashes print(list:GetItemCount()); coroutine.yield(); print(3); end cr = coroutine.create(func); coroutine.resume(cr); print(2); coroutine.resume(cr); >I have added >this code already, could you try again in a couple hours (for SF to >sync it's cvs). > No sync yet, so I could not test the changes. Houdini |
From: John L. <jla...@gm...> - 2005-12-16 05:13:10
|
> It was not easy to reproduce the situation in a small app but here it is: Ok so it stops as you say, on the line print(list:GetItemCount()); in function func(). I dug a little deeper and the problem is this. In modules/wxlua/wxlbind.cpp int LUACALL wxLua_lua_getTableFunc(lua_State *L) I added this printf statement, where init_xxx are the values by the same name used in the if() statement at the top. wxPrintf(wxT("wxLua_lua_getTableFunc '%s' pClass %d, userdata %d, lightuserdata %d, ttag %d, class_tag %d lua_State %d wxLuaStateRefData %d\n"), lua2wx(cpIndex).c_str(), (long)pClass, init_isuserdata, init_islightuserdata, init_ttag, init_class_tag, (long)L, (long)wxlState.GetRefData()); Here's the results #### the first print(list:GetItemCount()); that works wxLuaState::ttag 1 has metatable and is number 119 wxLuaState::ttag 1 has metatable and is number 119 wxLua_lua_getTableFunc 'GetItemCount' pClass -1218929716, userdata 1, lightuserdata 0, ttag 119, class_tag 119 lua_State 138563408 wxLuaStateRefData 136376552 # not really sure where these come from? but I suppose its ok wxLuaState::ttag 1 has metatable and is number 284 wxLuaState::ttag 1 has metatable and is number 119 #### the coroutine creates a new lua_State and we add ourselves to it (note the memory locations of the old and new (L1) lua_States) wxLuaInterpreter_newthread_handler new lua_State from a thread L=3D138563408 L1=3D138743720 #### we fail on trying to run wxLuaState::ttag(1) in wxLua_lua_getTableFunc (see ttag below) wxLuaState::ttag 1 wxLuaState::ttag 1 #### so the only thing wrong is ttag, we're got the new lua_State for the coroutine and we're still using the old wxLuaStateRefData (eg. the class that holds the wxLua data) wxLua_lua_getTableFunc '{unknown}' pClass -1218929716, userdata 1, lightuserdata 0, ttag 0, class_tag 119 lua_State 138743720 wxLuaStateRefData 136376552 The coroutine fails on lua_getmetatable() for the coroutine in this functio= n int wxLuaState::ttag(int index) { wxCHECK_MSG(Ok(), TLUA_NOTAG, wxT("Invalid wxLuaState")) lua_State* L =3D M_WXLSTATEDATA->m_lua_State; wxPrintf(wxT("wxLuaState::ttag %d"), index); int tag =3D TLUA_NOTAG; if (lua_getmetatable(L, index) !=3D 0) { wxPrintf(wxT(" has metatable")); lua_pushliteral(L, "tag"); lua_rawget(L, -2); if (lua_isnumber(L, -1)) { tag =3D (int) lua_tonumber(L, -1); wxPrintf(wxT(" and is number %d"), tag); } lua_pop(L, 2); } wxPrintf(wxT("\n")); return tag; } > frame =3D wx.wxFrame(wx.wxNull, -1, "App", > wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxDEFAULT_FRAME_STYLE)= ; > > list =3D wx.wxListCtrl(frame, -1, > wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxLC_SINGLE_SEL + > wx.wxLC_REPORT + wx.wxLC_AUTOARRANGE); > > -- works > print(list:GetItemCount()); > > function func() > > -- crashes > print(list:GetItemCount()); > > coroutine.yield(); > print(3); > end > > cr =3D coroutine.create(func); > > coroutine.resume(cr); > print(2); > coroutine.resume(cr); > > >I have added > >this code already, could you try again in a couple hours (for SF to > >sync it's cvs). > > > No sync yet, so I could not test the changes. I'm a little stumped, did this code of yours ever work with wxLua in any version? I'm not sure how to handle the failing lua_getmetatable in ttag for the coroutine since I thought that the new lua_State copied everything from the old one. Anyone have any ideas? I've committed by debugging printf statements to hel= p. Thanks, John Labenski |
From: Gustl B. <gu...@gm...> - 2005-12-16 06:59:01
|
Hi >I'm a little stumped, did this code of yours ever work with wxLua in >any version? > Yes, it worked with the version 26.254, which you can download from the official site. I tested the small test script I sent with it. >I'm not sure how to handle the failing lua_getmetatable >in ttag for the coroutine since I thought that the new lua_State >copied everything from the old one. > I don't know the internals of lua, maybe it does not support this yet. I have found this site: http://lua-users.org/wiki/ResumableVmPatch Maybe that's the problem? Do you really have to make a copy of the lua_State when creating a coroutine? Houdini |
From: John L. <jla...@gm...> - 2005-12-16 15:37:26
|
On 12/16/05, Gustl Berger <gu...@gm...> wrote: > >I'm a little stumped, did this code of yours ever work with wxLua in > >any version? > > > Yes, it worked with the version 26.254, which you can download from the > official site. > I tested the small test script I sent with it. This code is based directly on that with some modifictions of my own. The current code base is very restructured, but should be logically the same. I'll look into it. > >I'm not sure how to handle the failing lua_getmetatable > >in ttag for the coroutine since I thought that the new lua_State > >copied everything from the old one. > > > I don't know the internals of lua, maybe it does not support this yet. > I have found this site: > > http://lua-users.org/wiki/ResumableVmPatch > Maybe that's the problem? Probably not, the lua at SF is identical to the lua in 26.254 and if you say it works there then it should still work. > Do you really have to make a copy of the lua_State when creating a > coroutine? The problem is that lua itself "copies" the lua_State, maybe not literally, but in my testing of the program gpeddler I found that a new lua_State was created for coroutines and that you had to reassociate the lua_State with wxLua's variables. Regards, John Labenski |