From: k. h. <kla...@nl...> - 2005-12-21 15:06:35
|
Hi John, Trying to make a start here for external programs. Read in the docs directory building.txt, arrived at the line: If you wish to use the build files for modlues/wxbind that exist in wxLua for your own project along with your own wxluasetup.h you need to... ;-)) So let me see. WXLUASETUP_DIR has made it, so setting the include path to my own luasetup.h is fine. What i am puzzled with is the generation of bindings. Am i right that those binding are now platform and settings independent, in can be in principle become part of the wxLua distribution? Meaning i do not have to generate those in the future and they have no relation with my own bindings? And if i only want part of the wxLua bindings, this is just a matter of changing my own luasetup.h and rebuild the wxlua library? I assume genwxbind.bat can be used for my own wxart2d.rules file. My wxart2.rules file contains this at the top, but i wonder if this is needed? wxlua_dir = os.getenv("WXLUA") But reading this in wx.rules, i get the feeling that i need to change more, in order to get my own binding in the right place, assuming there is no need to have them in the same place as the wxWidget bindings. In other words i will get a seperate library for my own bindings, next to the one containing the wxWidget bindings. Something like: wxart2d_dir = os.getenv("WXART2D") interface_dir = wxart2d_dir.."/bindings" output_dir = wxart2d_dir.."/src" output_header_dir = wxart2d_dir.."/include" And in the interfaceFileList = { wxart2d.i } This seems to work, many things are generated, and they contain things related to what is in wxart2d.i ;-) What should i do with the next, should i call it wxart2d? Is that oke/wise?: hook_namespace = "wx" If i do, does that require something from my site to have both bindings active? Is this more or less the approach you have in mind too? I think that once we have a working approach, we should add an app which uses this approach. So all users will know how to include and use/extend wxLua in their own application. This is what wx(lua) is all about, so we better make as easy as possible. Thanks for some advice, Klaas -- Unclassified |
From: John L. <jla...@gm...> - 2005-12-21 22:44:36
Attachments:
plottorules.lua
|
On 12/21/05, k. holwerda <kla...@nl...> wrote: > Trying to make a start here for external programs. > Read in the docs directory building.txt, arrived at the line: > > If you wish to use the build files for modlues/wxbind that exist in wxLua > for your own project along with your own wxluasetup.h you need to... > > ;-)) Heh, that should be finished. > So let me see. > WXLUASETUP_DIR has made it, so setting the include path to my own > luasetup.h is fine. > > What i am puzzled with is the generation of bindings. > Am i right that those binding are now platform and settings independent, > in can be in principle become part of the wxLua distribution? Yes, there is one last issue of the static int variables used as the tags for lua userdata types. These variables are shared among all off the lua states created and the names of them need to be known if you wish to get a variable from lua to C++. I have been thinking about just using a hashtable for them, but I cannot decide. Currently you must always add bindings to wxLua in the same order, which is done by default, but things will break if you change the order or remove one. > Meaning i do not have to generate those in the future and they have no > relation with my own bindings? Right, they are only for wxWidgets and eventually wxLua will compile without them at all. Though, in that case you don't get any wxWidgets functionality in lua, but you do get a C++ interface for lua. > And if i only want part of the wxLua bindings, this is just a matter of > changing my own luasetup.h and rebuild the wxlua library? Yep, hopefully. > I assume genwxbind.bat can be used for my own wxart2d.rules file. > My wxart2.rules file contains this at the top, but i wonder if this is > needed? > wxlua_dir =3D os.getenv("WXLUA") If you like, it's up to you how you implement it. I've attached a rules file I use for a program of mine. You can compare it with the one in wxLua for the wxWidgets bindings, bindings/wxwidgets/wx.rules. > But reading this in wx.rules, i get the feeling that i need to change > more, in order to > get my own binding in the right place, assuming there is no need to have > them in the same place as the wxWidget bindings. You'll want to put them in your own dir. I have made the bindings completely insulated as a library with no need for any external header files. Everything works by adding new bindings to a static member variable of the wxLuaBinding class. You can compile your bindings however you want, as a separate library or together with your program as object files. Just make sure that you link to your library after linking to wxLua. > In other words i will get a seperate library for my own bindings, next > to the one containing the wxWidget bindings. > Something like: > > wxart2d_dir =3D os.getenv("WXART2D") > > interface_dir =3D wxart2d_dir.."/bindings" > output_dir =3D wxart2d_dir.."/src" > output_header_dir =3D wxart2d_dir.."/include" > > And in the > > interfaceFileList =3D > { > wxart2d.i > } > > This seems to work, many things are generated, and they contain things > related to what is in wxart2d.i ;-) > > What should i do with the next, should i call it wxart2d? Is that oke/wis= e?: > > hook_namespace =3D "wx" I am unsure about this. I have not actually tested what happens if you try to put two bindings into the same namespace. Maybe it works, maybe not. This should be clarified and made to work eventually. > If i do, does that require something from my site to have both bindings > active? No, they'll be loaded automatically. > Is this more or less the approach you have in mind too? > > I think that once we have a working approach, we should add an app which > uses this approach. > So all users will know how to include and use/extend wxLua in their own > application. > This is what wx(lua) is all about, so we better make as easy as possibl= e. This would be a good idea. I can make a very small demo, maybe just a single little class, like a subclassed button. I hope this helps, John Labenski ps. I think I am very close to being done. I have removed the wxLuaInterpreter class and replaced it completely with the wxLuaState class in my own copy of the sources. The result of this seems to be that it's fairly straightforward to understand the inner workings now. |
From: klaas.holwerda <kho...@xs...> - 2005-12-22 17:03:02
|
Hi John, Thanks for the quick responses (always). John Labenski wrote: >This would be a good idea. I can make a very small demo, maybe just a >single little class, like a subclassed button. > > > I would be really glad with that. If i understand you well, running a lua script from within the application would display this button. And if possible, when pressing the button a function in C++ calls a second lua script. What i am special interested in is how to call lua script from C++ objects, and how to interface information back to lua. I understand this is based on ConnectEvent(), and the event is bringing the C++ info to the lua function. In the end i want to have a2dCanvasObject draw itself using a luascript. And this will have its own eventhandler class and customevents and id's. So i need to understand the mechanism, and how i can use it. Anyway a sample explaining how to write your own bindings and how to use them in an application is i think very welcome. >I hope this helps, > Sure, it looks i am on the right track. > >ps. I think I am very close to being done. I have removed the >wxLuaInterpreter class and replaced it completely with the wxLuaState >class in my own copy of the sources. > But when i grep i still see wxLuaInterpreter. I am not yet at the level of understanding those changes. I saw wxLuaState all around, it seems you now use a class for the luastate. Would it be possible you write a small introduction on how this all works, and add it to the docs dir? I am now trying to search the mailing list for this information, but this is not so easy. What is your opinion on using Doxygen for documenting the code. Doxygen always helps be to understand the structure of code, because it makes it so easy to browse to almost anything right away. > The result of this seems to be >that it's fairly straightforward to understand the inner workings now. > > :-) I am sure you are making things much easier. Still a small help on where to start, like the most important classes and how they interact would be cool. Sorry for asking so much, i would prefer to help you instead, but first i need to understand :-( Thanks, Klaas |
From: John L. <jla...@gm...> - 2005-12-22 19:36:57
|
> >This would be a good idea. I can make a very small demo, maybe just a > >single little class, like a subclassed button. > > > I would be really glad with that. If i understand you well, running a > lua script from within the application would display this button. And if > possible, when pressing the button a function in C++ calls a second lua > script. > What i am special interested in is how to call lua script from C++ > objects, and how to interface information back to lua. I understand this > is based on ConnectEvent(), and the event is bringing the C++ info to > the lua function. You're right, the button is too simple. I think a nice calculator program could be made. Something simple that shows both the C++ end and lua end. You can type things into the window and lua will run them as is and print out the answer, also the C++ side can run lua scripts to implement the buttons. > In the end i want to have a2dCanvasObject draw itself using a luascript. > And this will have its own eventhandler class and customevents and id's. > So i need to understand the mechanism, and how i can use it. > Anyway a sample explaining how to write your own bindings and how to use > them in an application is i think very welcome. I've been doing the simplest thing. I write little lua scripts and send them to wxLuaState::RunString. So, in C++ you get an event from a button or menu item and in the handler call RunString with the appropriate wxLua code. > But when i grep i still see wxLuaInterpreter. I am not yet at the level > of understanding those changes. > I saw wxLuaState all around, it seems you now use a class for the luasta= te. > Would it be possible you write a small introduction on how this all > works, and add it to the docs dir? wxLuaInterpreter is now gone, it's typedefed to the wxLuaState so it should be a seamless change. I am slowly adding some docs. > I am now trying to search the mailing list for this information, but > this is not so easy. > > What is your opinion on using Doxygen for documenting the code. Doxygen > always helps be to understand the structure of code, because it makes it > so easy to browse to almost anything right away. You can run doxygen in the docs dir using the doxygen.cfg file. Let me know if I set it up right, I don't fully understand some of the doxygen settings. > > The result of this seems to be > >that it's fairly straightforward to understand the inner workings now. > > > :-) I am sure you are making things much easier. > Still a small help on where to start, like the most important classes > and how they interact would be cool. > > Sorry for asking so much, i would prefer to help you instead, but first > i need to understand :-( The first thing to do is to walk yourself though the wxLuaState class. From the constructor to adding the bindings, and finally, pushing our print and error handlers into lua. Regards, John Labenski |