<div dir="ltr">Well, considering that enumerated values are just names mapped to integers, I would personally have:<br><br>(define SDL_GL_RED_SIZE 0)<br>(define SDL_GL_GREEN_SIZE 1)<br>
(define SDL_GL_BLUE_SIZE 2)<br>
...<br><br>By doing this, you lose the type information, but provided you scheme wrapper is sound, that should generate no compilation nor runtime issues, should it? If needed, you should be able to cast from integer to SDL_GLattr in your calls (and hopefully, this should only be a compile time check, and have no incidence on actual execution).<br>
<br>I know it's not exactly what you wanted, but this should do the job until someone points out the right thing to do.<br><br>P! <br><br><div class="gmail_quote">2008/8/15 Frederick LeMaster <span dir="ltr"><<a href="mailto:fred.lemaster@gmail.com">fred.lemaster@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">In the FFI you can take an enum such as the following from the SDL library:<br>
<br>
typedef enum {<br>
    SDL_GL_RED_SIZE,<br>
    SDL_GL_GREEN_SIZE,<br>
    SDL_GL_BLUE_SIZE,<br>
    SDL_GL_ALPHA_SIZE,<br>
    SDL_GL_BUFFER_SIZE,<br>
    SDL_GL_DOUBLEBUFFER,<br>
    SDL_GL_DEPTH_SIZE,<br>
    SDL_GL_STENCIL_SIZE,<br>
    SDL_GL_ACCUM_RED_SIZE,<br>
    SDL_GL_ACCUM_GREEN_SIZE,<br>
    SDL_GL_ACCUM_BLUE_SIZE,<br>
    SDL_GL_ACCUM_ALPHA_SIZE,<br>
    SDL_GL_STEREO,<br>
    SDL_GL_MULTISAMPLEBUFFERS,<br>
    SDL_GL_MULTISAMPLESAMPLES<br>
} SDL_GLattr;<br>
<br>
What is the best way to define this as a foreign type?<br>
<br>
 If you do the following:<br>
(c-define-type SDL_GLattr "SDL_GLattr")<br>
Then to get at the values you have to assign a pointer to the enum value<br>
(c-lambda ()<br>
                SDL_GLattr<br>
                "___result_voidstar = &SDL_GL_SWAP_CONTROL;")<br>
<br>
Seems like passing the actual value would be preferable. Am I missing<br>
something obvious?<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>
</blockquote></div><br><br clear="all"><br>-- <br>Français, English, 日本語, 한국어<br><br>
</div>