Crystal Space
Welcome, Guest. Please login or register.
November 01, 2014, 03:00:00 am

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8902 Members
Latest Member: Nelmczyk
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Project Development
| |-+  Development Discussion
| | |-+  Python bindings fixed (new event handling issue)
« previous next »
Pages: [1] Print
Author Topic: Python bindings fixed (new event handling issue)  (Read 3444 times)
rhohr
Newbie
*
Posts: 6


View Profile
« on: February 24, 2006, 06:23:29 pm »

Hello:

  Before anything.. sorry for my english.. hope this is understandable..

  I thanks caedes for all the work and support.

  I would like to explain what were the changes we need to make (and some attempts) to fix the event system in the python binding. Hope this helps to understand the patch (not so difficult..) and helps if other bindings needs fix too.

  The patch is in CVS, and in a few hours an improvement will be there to anonymous CVSers too..

  These are the changes, with a sort description. Ask if need details for anything.. I'll try to answer. Keep in mind I'm not swig expert nor C++ (far from it) Due to this maybe some technical words are missused. Sorry about that.
 
.The ignore/rename in cspace.i was rewriten because the parameters changed.

."no constructor defined" error
This was raised because the struct fails to complete the new virtual functions created in the eventHandler system change.

   -included SCF_IMPLEMENTS_INTERFACE(iEventHandler). Good.
   -derived from scfImplementation1<_csPyEventHandler,iEventHandler>. Create constructor but the instance is not detected as iEventHandler from swig and fails to match a constructor. Bad.
   -derived from iEventHandler and complete the interface with macro but swig doesn't honor functions in the macro, or the macro is too complex, or something else... "No constructor defined". Bad.
   -derived from iEventHandler, manual writting of functions but now fails to match the list with csEventID[]. This is a good step.
   
"crystalspace.cspython" is used for StaticHandlerName() any name suggestion is welcome..
   
.Converting the list into array
   -change some csev* in the list that are incorrect. Good.
   -added constant CS_EVENTLIST_END for list termination. Good.
   -try to create a typemap for csEventID[] parameter with some macros that Rene wrote, but failed to do, even with some modifications. Bad.
   -created the typemap(in), based on Rene code and swig docs, and the list is correctly converted to an array and swig executes SetupEventHandler from Rene wrapping code (class csPyEventHandler, etc..). Good. Maybe swig allows this to be more simple, but this works and swig is huge.. Any suggestion is, of course, welcome.

.Then, only python code: the tutorials. Here the changes are straightforward..
   -change some cscmd* -> csev* and .Type -> .Name / used some 'cache' vars as res2k suggested, thanks.
   -delete duplicated if() about KeyboardDown
   -GetFactory() was removed from iThingState so we need to addapt the code (release notes explains this change)
   -Grouped the not recomended cscmdProcess and cscmdFinalProcess into csevFrame. This is done roughly and I think that, for this examples, is fine, but others uses needs other technique (see Release notes in CS manual)

Note that some tutorials give an assert when exiting..

Grettings,
rhohr.-

PD: I'll post this to ML too when my SF account works (it seems it takes some time)
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.454 seconds with 16 queries.