Number of callbacks

Started by sunmountain, November 12, 2011, 11:47:23 AM

Previous topic - Next topic

sunmountain

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

Lutz

#1
(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">http://www.newlisp.org/syntax.cgi?downl ... mo-lsp.txt">http://www.newlisp.org/syntax.cgi?downloads/OpenGL/opengl-demo-lsp.txt

sunmountain

#2
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

#3
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

#4
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 http://common-lisp.net/project/cffi/manual/html_node/defcstruct.html">defcstruct is really sexy.



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