Page 1 of 1

Number of callbacks

Posted: Sat Nov 12, 2011 7:47 pm
by sunmountain
Hi,
yould someone show me some code for this:
If more than sixteen callback functions are required, slots can be reassigned to a different callback function.
Please :-)

Re: Number of callbacks

Posted: Sat Nov 12, 2011 8:03 pm
by Lutz

Code: Select all

(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?downl ... mo-lsp.txt

Re: Number of callbacks

Posted: Sat Nov 12, 2011 10:55 pm
by sunmountain
And later here means later in program flow ?
So you override the callback no. 4 with another one ?

Any plans to adopt to libffi ?

Re: Number of callbacks

Posted: Sat Nov 12, 2011 11:11 pm
by Lutz
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.

Re: Number of callbacks

Posted: Sat Nov 12, 2011 11:24 pm
by sunmountain
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 is really sexy.

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