As an example, to create a strongly-typed OpenGL header file for Pascal, you would do something like this:
Lets try glCullFace, in the XML file we find a list of valid enums for it, but the type name is a comment which makes it hard to extract.
The actual values are easy:Code :<!-- /* CullFaceMode */ --> <enum name="GL_FRONT" /> <enum name="GL_BACK" /> <enum name="GL_FRONT_AND_BACK" />
From this we can define a Pascal type:Code :<enum value="0x0404" name="GL_FRONT" /> <enum value="0x0405" name="GL_BACK" /> <enum value="0x0408" name="GL_FRONT_AND_BACK" />
Now for the command:Code :CullFaceMode = ( GL_FRONT = $0404, GL_BACK = $0405, GL_FRONT_AND_BACK = $0408 );
Not very helpful, the parameter is only listed as GLenum, what we need is some way to create this:Code :<command> <proto> void <name>glCullFace</name> </proto> <param> <ptype>GLenum</ptype> <name>mode</name> </param> <glx type="render" opcode="79" /> </command>
Code :type TCullFace = procedure glCullface( mode: CullFaceMode ); var glCullFace: TCullFace;
For commands like GetIntegerv you could overload the function definition so that if the enum is in one range of values then the second parameter must be a pointer to an integer variable, and for another range it must be a pointer to an array of integer.
For some enums you might specify that it is a pointer to a record type, for example if you are reading a color value you might make a record type containing R,G,B and A values.
This would need the information from the state tables in chapter 23 of the spec.