Hi list,

On 04/09/2011 05:51 AM, Jay Kominek wrote:
The OpenGL APIs, all the versions, all the
extensions, are described in some fairly parseable files available
fromhttp://www.opengl.org/registry/  - look for the .spec files
towards the bottom. I'm pretty sure you should be able to generate the
bindings from those files, and more easily than dealing with C
headers.

I wrote a bit of code to parse these files and it works fine so far.
I would like some advice though on how to wrap arrays in "output" mode.

Take for example the following function:

GetTexLevelParameteriv(target, level, pname, params)
        return          void
        param           target          TextureTarget in value
        param           level           CheckedInt32 in value
        param           pname           GetTextureParameter in value
        param           params          Int32 out array [COMPSIZE(pname)]

This corresponds to the C header:

   void glGetTexLevelParameteriv( GLenum target,
                                      GLint level,
                                      GLenum pname,
                                      GLint *params )



This function fills array "params" with some data.
The length of params depends on pname and is not directly specified.

I now wrap this as follows:

(_fun (target : _int32) (level : _int32) (pname : _int32) (params : _pointer) 
-> _void)

So params is just a raw pointer. I should perhaps use _i32vector in "output" 
mode instead but:
1. I don't have an expression for the length, and
2. I don't want to have the wrapper allocate and return an array; rather I want 
to mirror
   the C api exactly and pass in an array which is filled by the function.

The latter I consider especially important, since it ensures that all the docs 
for the C API can be used directly.

So what I really want is that a _i32vector is passed in for parameter "params", 
and then filled
by the function, so that the Racket program can observe the mutated vector.
Can this be achieved?

Thanks,

Stephan
_________________________________________________
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

Reply via email to