@table(Name, Type, Arguments)
OpenGLFunctions:
{
    {BindTexture                  `void`               `GLenum target, GLuint texture`}
    {BlendFunc                    `void`               `GLenum sfactor, GLenum dfactor`}
    {Clear                        `void`               `GLbitfield mask`}
    {ClearAccum                   `void`               `GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha`}
    {ClearColor                   `void`               `GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha`}
    {ClearDepth                   `void`               `GLclampd depth`}
    {ClearIndex                   `void`               `GLfloat c`}
    {ClearStencil                 `void`               `GLint s`}
    {ClipPlane                    `void`               `GLenum plane, const GLdouble *equation`}
    {CullFace                     `void`               `GLenum mode`}
    {DeleteTextures               `void`               `GLsizei n, const GLuint *textures`}
    {Disable                      `void`               `GLenum cap`}
    {DrawArrays                   `void`               `GLenum mode, GLint first, GLsizei count`}
    {DrawBuffer                   `void`               `GLenum mode`}
    {DrawElements                 `void`               `GLenum mode, GLsizei count, GLenum type, const GLvoid *indices`}
    {DrawArraysInstanced          `void`               `GLenum mode, GLint first, GLsizei count, GLsizei instancecount`}
    {Enable                       `void`               `GLenum cap`}
    {GenTextures                  `void`               `GLsizei n, GLuint *textures`}
    {GetClipPlane                 `void`               `GLenum plane, GLdouble *equation`}
    {GetDoublev                   `void`               `GLenum pname, GLdouble *params`}
    {GetError                     `GLenum`             `void`}
    {GetFloatv                    `void`               `GLenum pname, GLfloat *params`}
    {GetIntegerv                  `void`               `GLenum pname, GLint *params`}
    {GetPointerv                  `void`               `GLenum pname, GLvoid* *params`}
    {GetString                    `const GLubyte *`    `GLenum name`}
    {GetTexEnvfv                  `void`               `GLenum target, GLenum pname, GLfloat *params`}
    {GetTexEnviv                  `void`               `GLenum target, GLenum pname, GLint *params`}
    {GetTexGendv                  `void`               `GLenum coord, GLenum pname, GLdouble *params`}
    {GetTexGenfv                  `void`               `GLenum coord, GLenum pname, GLfloat *params`}
    {GetTexGeniv                  `void`               `GLenum coord, GLenum pname, GLint *params`}
    {GetTexImage                  `void`               `GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels`}
    {GetTexLevelParameterfv       `void`               `GLenum target, GLint level, GLenum pname, GLfloat *params`}
    {GetTexLevelParameteriv       `void`               `GLenum target, GLint level, GLenum pname, GLint *params`}
    {GetTexParameterfv            `void`               `GLenum target, GLenum pname, GLfloat *params`}
    {GetTexParameteriv            `void`               `GLenum target, GLenum pname, GLint *params`}
    {Hint                         `void`               `GLenum target, GLenum mode`}
    {IsTexture                    `GLboolean`          `GLuint texture`}
    {LineWidth                    `void`               `GLfloat width`}
    {ListBase                     `void`               `GLuint base`}
    {LoadName                     `void`               `GLuint name`}
    {LogicOp                      `void`               `GLenum opcode`}
    {PointSize                    `void`               `GLfloat size`}
    {PolygonMode                  `void`               `GLenum face, GLenum mode`}
    {Scissor                      `void`               `GLint x, GLint y, GLsizei width, GLsizei height`}
    {TexImage1D                   `void`               `GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels`}
    {TexImage2D                   `void`               `GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels`}
    {TexParameterf                `void`               `GLenum target, GLenum pname, GLfloat param`}
    {TexParameterfv               `void`               `GLenum target, GLenum pname, const GLfloat *params`}
    {TexParameteri                `void`               `GLenum target, GLenum pname, GLint param`}
    {TexParameteriv               `void`               `GLenum target, GLenum pname, const GLint *params`}
    {TexSubImage1D                `void`               `GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels`}
    {TexSubImage2D                `void`               `GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels`}
    {CompressedTexImage2D         `void`               `GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *pixels`}
    {ActiveTexture                `void`               `GLenum texture`}
    {Viewport                     `void`               `GLint x, GLint y, GLsizei width, GLsizei height`}
    {GenBuffers                   `void`               `GLsizei n, GLuint *buffers`}
    {BindBuffer                   `void`               `GLenum target, GLuint buffer`}
    {BufferData                   `void`               `GLenum target, GLsizeiptr size, const void *data, GLenum usage`}
    {BufferSubData                `void`               `GLenum target, GLintptr offset, GLsizeiptr size, const void *data`}
    {GenVertexArrays              `void`               `GLsizei n, GLuint *arrays`}
    {BindVertexArray              `void`               `GLenum array`}
    {GetAttribLocation            `GLint`              `GLuint program, const GLchar *name`}
    {EnableVertexAttribArray      `void`               `GLuint index`}
    {DisableVertexAttribArray     `void`               `GLuint index`}
    {VertexAttribPointer          `void`               `GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer`}
    {VertexAttribIPointer         `void`               `GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer`}
    {VertexAttribLPointer         `void`               `GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer`}
    {VertexAttribDivisor          `void`               `GLuint index, GLuint divisor`}
    {CreateShader                 `GLuint`             `GLenum type`}
    {ShaderSource                 `void`               `GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length`}
    {CompileShader                `void`               `GLuint shader`}
    {DeleteShader                 `void`               `GLuint shader`}
    {GetShaderiv                  `void`               `GLuint shader, GLenum pname, GLint *params`}
    {GetShaderInfoLog             `void`               `GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog`}
    {CreateProgram                `GLuint`             `void`}
    {UseProgram                   `void`               `GLuint program`}
    {AttachShader                 `void`               `GLuint program, GLuint shader`}
    {DeleteProgram                `void`               `GLuint program`}
    {LinkProgram                  `void`               `GLuint program`}
    {GetProgramiv                 `void`               `GLuint program, GLenum pname, GLint *params`}
    {GetProgramInfoLog            `void`               `GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog`}
    {GetUniformLocation           `GLint`              `GLuint program, const GLchar *name`}
    {Uniform1i                    `void`               `GLint location, GLint v0`}
    {Uniform2f                    `void`               `GLint location, GLfloat v0, GLfloat v1`}
    {Uniform3f                    `void`               `GLint location, GLfloat v0, GLfloat v1, GLfloat v2`}
    {UniformMatrix4fv             `void`               `GLint location, GLsizei count, GLboolean transpose, const GLfloat *value`}
    {DebugMessageCallback         `void`               `void (*)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *, const void *), const void *userParam`}
}

// sixten: Generate the typedefs.
@table_gen
{
	@expand(OpenGLFunctions s) `typedef $(s.Type) opengl_$(s.Name)($(s.Arguments));`;
}

// sixten: Generate the global pointers.
@table_gen
{
	@expand(OpenGLFunctions s) `global opengl_$(s.Name) *gl$(s.Name) = 0;`;
}

// sixten: Generate OpenGL_LoadAllFunctions
@table_gen
{
	`extern void *OpenGL_LoadFunction(char *);`;
	`static void OpenGL_LoadAllFunctions(void)`;
	`{`;
        @expand(OpenGLFunctions s) `gl$(s.Name) = (opengl_$(s.Name) *)OpenGL_LoadFunction("gl$(s.Name)");`;
        `}`;
}