See 19.4 The c-lambda special form in the Gambit manual<br><br><div class="gmail_quote">On Mon, Feb 16, 2009 at 6:24 PM, Pavel Dudrenov <span dir="ltr"><<a href="mailto:dudrenov@gmail.com">dudrenov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Does Marc have the ___NAME stuff documented somewhere? I know that if<br>
I read the compiler code I'd probably figure it out, but someone might<br>
have done that already. From the small bits and peaces I've seen,<br>
mainly from FFI code in gambit, it reminds me of an assembly/register<br>
machine in C.<br>
<font color="#888888"><br>
Pavel<br>
</font><div><div></div><div class="Wj3C7c"><br>
<br>
On Mon, Feb 16, 2009 at 3:17 PM, Guillaume Cartier<br>
<<a href="mailto:gcartier@jazzscheme.org">gcartier@jazzscheme.org</a>> wrote:<br>
> Here's how Marc does it in his Xlib.scm example :<br>
> (define GCFunction<br>
>   ((c-lambda () unsigned-long "___result = GCFunction;")))<br>
> (define GCPlaneMask<br>
>   ((c-lambda () unsigned-long "___result = GCPlaneMask;")))<br>
> (define GCForeground<br>
>   ((c-lambda () unsigned-long "___result = GCForeground;")))<br>
> (define GCBackground<br>
>   ((c-lambda () unsigned-long "___result = GCBackground;")))<br>
> (define GCLineWidth<br>
>   ((c-lambda () unsigned-long "___result = GCLineWidth;")))<br>
><br>
> On Mon, Feb 16, 2009 at 5:40 PM, lowly coder <<a href="mailto:lowlycoder@huoyanjinjing.com">lowlycoder@huoyanjinjing.com</a>><br>
> wrote:<br>
>><br>
>> looking at the glut ffi at the dumping grounds, we have lines like:<br>
>><br>
>> (define GL_NORMAL_ARRAY #x8075)<br>
>> (define GL_COLOR_ARRAY #x8076)<br>
>> (define GL_INDEX_ARRAY #x8077)<br>
>> (define GL_TEXTURE_COORD_ARRAY #x8078)<br>
>><br>
>> this is really cool because ... now, in scheme land, I also know the<br>
>> values of these defines<br>
>><br>
>> suppose however, I didn't care about the values of these globals in scheme<br>
>> land ... and suppose, i'm writing the ffi for naother library and I don't<br>
>> want to manually (or write a script) to get the value of each of these<br>
>> constants, is there anyway I can do something like:<br>
>><br>
>> (c-define-foreign-varaible gl_normal_array "GL_NORMAL_ARRAY")<br>
>><br>
>> and have gl_normal_array (only in compiled mode, I recognize this will<br>
>> fail in interpted mode) just get expanded to "GL_NORMAL_ARRAY" during<br>
>> compilation?<br>
>><br>
>> thanks!<br>
>><br>
>> (I also dislike the eralier method in that ... if API changes causes the<br>
>> global vars to have different values ... i'll have lots of fun with silent<br>
>> var value changes<br>
>><br>
>> _______________________________________________<br>
>> Gambit-list mailing list<br>
>> <a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
>> <a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Gambit-list mailing list<br>
> <a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
> <a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
><br>
><br>
<br>
</div></div></blockquote></div><br>