On 2/7/07, Ryan Pusztai <[EMAIL PROTECTED]> wrote:
> On 2/7/07, John Labenski <[EMAIL PROTECTED]> wrote:
> > The easiest thing to do is to merely add the *.cpp files to your
> > project (or apps/wxlua) and then recompile. I suppose you could build
> > your own lib, like wxbindstc for example and then link to that, but
> > adding the cpp files is much easier.
>
> Great. I found that and it built!
>
> > You must call the init function to add the bindings to the lua
> > bindings. For example the wxStyledTextCtrl bindings uses this function
> > in modules/wxbindstc/include/wxbind.h
> > extern WXDLLIMPEXP_WXBINDSTC bool wxLuaBinding_wxstc_init();
> > See also apps/wxlua/src/wxlua.cpp and search for this function.
> >
> > We tried hard to make this automatic, but different compilers made
> > this impossible to do.
>
> Too bad. This is awesome!!!! I can't believe I will be able to script
> our test software.
>
> > No problem, the bindings should be easy to do, but I'm sure that the
> > first time through things are not as clear as they could be. Was there
> > anything that should be added to the documentation binding.html file?
>
> Really the documentation was good at describing the functionality, but
> these emails with the "How-To" style and always an example are great.
> I guess what I am saying is see if you can give the general
> step-by-step for all the steps from start to finish. Plus I would not
> have known that wxLua had such a great framework for creating
> bindings. You should advertise this on your website. Along with in the
> documentation. It is really good.
>
> Also I don't know if you want to get into Lua internals on your
> website, but I still have know idea what the "wxlstate" is and its
> makeup, so some tutorials on interfacing C++ code and Lua would be
> greatly appreciated. If there are great links to already existing
> articles, maybe that could be all that tutorial shows. I have been to
> the Lua site and I think there documentation is written as a
> specification and I would love a more tutorial articles on the
> interface.
>
> OK another question. How do I call a function like this:
>
> Open() is the function I am wrapping and here is its documentation.
> /*!
>       \param devname name of the interface, we want to open
>       \param dcs a untyped pointer to a device control struct. If
>       he is NULL, the default device parameter will be used.
>       \return the new file descriptor, or -1 if an error occurred
>
>       The pointer dcs will be used for special device dependent
>       settings. Because this is very specific, the struct or
>       destination of the pointer will be defined by every device
>       itself. (For example: a serial device class should refer
>       things like parity, word length and count of stop bits,
>       a IEEE class adress and EOS character).
> */
>
> Interface file:
> %class %delete %noclassinfo %encapsulate wxSerialPort, wxSerialPort_x
>         wxSerialPort()
>
>         // Serial port initilization
>         ...
>         int Open(const char* devname, void* dcs)
>         ...
> %endclass
>
> Generated function:
>
> static int LUACALL wxLua_wxSerialPort_Open(lua_State *L)
> {
>     wxLuaState wxlState(L);
>     int returns;
>     // void dcs
>     void * dcs = (void *)wxlState.ttouserdata(3);
>     // const char devname
>     const char * devname = (const char *)wxlState.ttouserdata(2);
>     // get this
>     wxSerialPort * self = (wxSerialPort *)wxlState.GetUserDataType(1,
> s_wxluatag_wxSerialPort);
>     // call Open
>     returns = self->Open(devname, dcs);
>     // push the result number
>     lua_pushnumber(L, returns);
>
>     return 1;
> }
>
> Using it in wxLua:
>
> -- device control struct for additional (and device specific
> -- settings)
> dcs = wxctb.wxSerialPort_DCS()
>
> -- dcs was initiate with 19200 1N8, but you can change
> -- these with your own settings
> dcs:SetBaud( baudrate )
> dcs:SetWordLen( 8 )
> dcs:SetParity( wxctb.wxPARITY_NONE )
> dcs:SetStopBits( 1 )
>
> -- Create the wxSerialPort variable.
> com = wxctb.wxSerialPort()
>
> -- try to open the given comport
> if ( com:Open( devname, dcs ) < 0 ) then -- <- this call fails everytime
>    -- port is not available (wrong or in use)
>    print( "An error occurred when opening serial port \""..devname.."\"" )
>    return 1
> end
>
> It keeps failing. I can call other functions that I have wrapped, but
> the reference to a class doesn't seem to work well for me,

Jon and all,
Any ideas on this? I am stuck till I can figure this out.

Thanks for your time and help.
-- 
Regards,
Ryan
RJP Computing

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to