Number of callbacks

Q&A's, tips, howto's
Locked
sunmountain
Posts: 39
Joined: Tue Mar 15, 2011 5:11 am

Number of callbacks

Post 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 :-)

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Number of callbacks

Post 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

sunmountain
Posts: 39
Joined: Tue Mar 15, 2011 5:11 am

Re: Number of callbacks

Post 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 ?

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Number of callbacks

Post 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.

sunmountain
Posts: 39
Joined: Tue Mar 15, 2011 5:11 am

Re: Number of callbacks

Post 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 :-)

Locked