newLISP Fan Club

Forum => newLISP in the real world => Topic started by: sunmountain on November 12, 2011, 11:47:23 AM

Title: Number of callbacks
Post by: sunmountain on November 12, 2011, 11:47:23 AM
Hi,

yould someone show me some code for this:


Quote
If more than sixteen callback functions are required, slots can be reassigned to a different callback function.


Please :-)
Title: Re: Number of callbacks
Post by: Lutz on November 12, 2011, 12:03:45 PM
(glutKeyboardFunc (callback 1 'keyboard))
(glutMouseFunc (callback 2 'mouse))
(glutMotionFunc (callback 3 'motion))
(glutIdleFunc (callback 4 'rotation))
(glutJoystickFunc (callback 5 'joystick) 50)
....
...
; later 'rotation' isn't used
(registerFunc (callback 4 'do-stuff'))


from: http://www.newlisp.org/syntax.cgi?downloads/OpenGL/opengl-demo-lsp.txt
Title: Re: Number of callbacks
Post by: sunmountain on November 12, 2011, 02:55:50 PM
And later here means later in program flow ?

So you override the callback no. 4 with another one ?



Any plans to adopt to libffi ?
Title: Re: Number of callbacks
Post by: Lutz on November 12, 2011, 03:11:01 PM
Yes, the callback is overwritten later in the program flow.



I looked into it a few years back and thought, it was too big, does too many things. But somebody could build an interface to libffi using the 'import' function?



For 90% of lib imports the existing 'import' facility gives what is needed. For anything else, write a 'C' interface stub, which then gets imported by newLISP.
Title: Re: Number of callbacks
Post by: sunmountain on November 12, 2011, 03:24:01 PM
Quote
I looked into it a few years back and thought, it was too big, does too many things. But somebody could build an interface to libffi using the 'import' function?



For 90% of lib imports the existing 'import' facility gives what is needed. For anything else, write a 'C' interface stub, which then gets imported by newLISP.


Yes, but defcstruct (//http) is really sexy.



I'll take a look at the sources, I can only learn :-)