looking at the glut ffi at the dumping grounds, we have lines like:
(define GL_NORMAL_ARRAY #x8075) (define GL_COLOR_ARRAY #x8076) (define GL_INDEX_ARRAY #x8077) (define GL_TEXTURE_COORD_ARRAY #x8078)
this is really cool because ... now, in scheme land, I also know the values of these defines
suppose however, I didn't care about the values of these globals in scheme land ... and suppose, i'm writing the ffi for naother library and I don't want to manually (or write a script) to get the value of each of these constants, is there anyway I can do something like:
(c-define-foreign-varaible gl_normal_array "GL_NORMAL_ARRAY")
and have gl_normal_array (only in compiled mode, I recognize this will fail in interpted mode) just get expanded to "GL_NORMAL_ARRAY" during compilation?
thanks!
(I also dislike the eralier method in that ... if API changes causes the global vars to have different values ... i'll have lots of fun with silent var value changes
Afficher les réponses par date
Here's how Marc does it in his Xlib.scm example :
(define GCFunction ((c-lambda () unsigned-long "___result = GCFunction;")))
(define GCPlaneMask ((c-lambda () unsigned-long "___result = GCPlaneMask;")))
(define GCForeground ((c-lambda () unsigned-long "___result = GCForeground;")))
(define GCBackground ((c-lambda () unsigned-long "___result = GCBackground;")))
(define GCLineWidth ((c-lambda () unsigned-long "___result = GCLineWidth;")))
On Mon, Feb 16, 2009 at 5:40 PM, lowly coder lowlycoder@huoyanjinjing.comwrote:
looking at the glut ffi at the dumping grounds, we have lines like:
(define GL_NORMAL_ARRAY #x8075) (define GL_COLOR_ARRAY #x8076) (define GL_INDEX_ARRAY #x8077) (define GL_TEXTURE_COORD_ARRAY #x8078)
this is really cool because ... now, in scheme land, I also know the values of these defines
suppose however, I didn't care about the values of these globals in scheme land ... and suppose, i'm writing the ffi for naother library and I don't want to manually (or write a script) to get the value of each of these constants, is there anyway I can do something like:
(c-define-foreign-varaible gl_normal_array "GL_NORMAL_ARRAY")
and have gl_normal_array (only in compiled mode, I recognize this will fail in interpted mode) just get expanded to "GL_NORMAL_ARRAY" during compilation?
thanks!
(I also dislike the eralier method in that ... if API changes causes the global vars to have different values ... i'll have lots of fun with silent var value changes
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Does Marc have the ___NAME stuff documented somewhere? I know that if I read the compiler code I'd probably figure it out, but someone might have done that already. From the small bits and peaces I've seen, mainly from FFI code in gambit, it reminds me of an assembly/register machine in C.
Pavel
On Mon, Feb 16, 2009 at 3:17 PM, Guillaume Cartier gcartier@jazzscheme.org wrote:
Here's how Marc does it in his Xlib.scm example : (define GCFunction ((c-lambda () unsigned-long "___result = GCFunction;"))) (define GCPlaneMask ((c-lambda () unsigned-long "___result = GCPlaneMask;"))) (define GCForeground ((c-lambda () unsigned-long "___result = GCForeground;"))) (define GCBackground ((c-lambda () unsigned-long "___result = GCBackground;"))) (define GCLineWidth ((c-lambda () unsigned-long "___result = GCLineWidth;")))
On Mon, Feb 16, 2009 at 5:40 PM, lowly coder lowlycoder@huoyanjinjing.com wrote:
looking at the glut ffi at the dumping grounds, we have lines like:
(define GL_NORMAL_ARRAY #x8075) (define GL_COLOR_ARRAY #x8076) (define GL_INDEX_ARRAY #x8077) (define GL_TEXTURE_COORD_ARRAY #x8078)
this is really cool because ... now, in scheme land, I also know the values of these defines
suppose however, I didn't care about the values of these globals in scheme land ... and suppose, i'm writing the ffi for naother library and I don't want to manually (or write a script) to get the value of each of these constants, is there anyway I can do something like:
(c-define-foreign-varaible gl_normal_array "GL_NORMAL_ARRAY")
and have gl_normal_array (only in compiled mode, I recognize this will fail in interpted mode) just get expanded to "GL_NORMAL_ARRAY" during compilation?
thanks!
(I also dislike the eralier method in that ... if API changes causes the global vars to have different values ... i'll have lots of fun with silent var value changes
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
By the way, I'm surprised that there is no prefix to that NAME part to avoid possible name clashes with other libs, especially in a FFI. I'd expect ___gambc_result or something like that, shouldn't I?
2009/2/17 Pavel Dudrenov dudrenov@gmail.com
Does Marc have the ___NAME stuff documented somewhere? I know that if I read the compiler code I'd probably figure it out, but someone might have done that already. From the small bits and peaces I've seen, mainly from FFI code in gambit, it reminds me of an assembly/register machine in C.
Pavel
On Mon, Feb 16, 2009 at 3:17 PM, Guillaume Cartier
((c-lambda () unsigned-long "___result = GCFunction;")))
You've been looking at Gambit generated code too long... so long that you no longer notice the triple underscore prefix! That is the Gambit prefix!
Marc
On 16-Feb-09, at 9:20 PM, Adrien Piérard wrote:
By the way, I'm surprised that there is no prefix to that NAME part to avoid possible name clashes with other libs, especially in a FFI. I'd expect ___gambc_result or something like that, shouldn't I?
2009/2/17 Pavel Dudrenov dudrenov@gmail.com Does Marc have the ___NAME stuff documented somewhere? I know that if I read the compiler code I'd probably figure it out, but someone might have done that already. From the small bits and peaces I've seen, mainly from FFI code in gambit, it reminds me of an assembly/register machine in C.
Pavel
On Mon, Feb 16, 2009 at 3:17 PM, Guillaume Cartier
((c-lambda () unsigned-long "___result = GCFunction;")))
-- Français, English, 日本語, 한국어
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
See 19.4 The c-lambda special form in the Gambit manual
On Mon, Feb 16, 2009 at 6:24 PM, Pavel Dudrenov dudrenov@gmail.com wrote:
Does Marc have the ___NAME stuff documented somewhere? I know that if I read the compiler code I'd probably figure it out, but someone might have done that already. From the small bits and peaces I've seen, mainly from FFI code in gambit, it reminds me of an assembly/register machine in C.
Pavel
On Mon, Feb 16, 2009 at 3:17 PM, Guillaume Cartier gcartier@jazzscheme.org wrote:
Here's how Marc does it in his Xlib.scm example : (define GCFunction ((c-lambda () unsigned-long "___result = GCFunction;"))) (define GCPlaneMask ((c-lambda () unsigned-long "___result = GCPlaneMask;"))) (define GCForeground ((c-lambda () unsigned-long "___result = GCForeground;"))) (define GCBackground ((c-lambda () unsigned-long "___result = GCBackground;"))) (define GCLineWidth ((c-lambda () unsigned-long "___result = GCLineWidth;")))
On Mon, Feb 16, 2009 at 5:40 PM, lowly coder <
lowlycoder@huoyanjinjing.com>
wrote:
looking at the glut ffi at the dumping grounds, we have lines like:
(define GL_NORMAL_ARRAY #x8075) (define GL_COLOR_ARRAY #x8076) (define GL_INDEX_ARRAY #x8077) (define GL_TEXTURE_COORD_ARRAY #x8078)
this is really cool because ... now, in scheme land, I also know the values of these defines
suppose however, I didn't care about the values of these globals in
scheme
land ... and suppose, i'm writing the ffi for naother library and I
don't
want to manually (or write a script) to get the value of each of these constants, is there anyway I can do something like:
(c-define-foreign-varaible gl_normal_array "GL_NORMAL_ARRAY")
and have gl_normal_array (only in compiled mode, I recognize this will fail in interpted mode) just get expanded to "GL_NORMAL_ARRAY" during compilation?
thanks!
(I also dislike the eralier method in that ... if API changes causes the global vars to have different values ... i'll have lots of fun with
silent
var value changes
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list