remove carriage returns
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 15 Apr 2005 16:05:14 +0000 (16:05 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 15 Apr 2005 16:05:14 +0000 (16:05 +0000)
src/mesa/main/config.h
src/mesa/main/get.c
src/mesa/main/mtypes.h
src/mesa/shader/slang/library/slang_shader_syn.h
src/mesa/shader/slang/slang_compile.c
src/mesa/shader/slang/slang_compile.h

index fb975d672933f404f2a40549c5ad125de1626a6a..a5c4d2c0d930aa822b8ea01cec47cb3d20f05138 100644 (file)
 #define MAX_PROGRAM_LOCAL_PARAMS 96
 #define MAX_PROGRAM_MATRICES 8
 #define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
-/*@}*/\r
-\r
-/** For GL_ARB_fragment_shader */\r
-/*@{*/\r
-#define MAX_FRAGMENT_UNIFORM_COMPONENTS 64\r
-/*@}*/\r
-\r
-/** For GL_ARB_vertex_shader */\r
-/*@{*/\r
-#define MAX_VERTEX_UNIFORM_COMPONENTS 512\r
-#define MAX_VARYING_FLOATS 32\r
-#define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0\r
-#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS)\r
+/*@}*/
+
+/** For GL_ARB_fragment_shader */
+/*@{*/
+#define MAX_FRAGMENT_UNIFORM_COMPONENTS 64
+/*@}*/
+
+/** For GL_ARB_vertex_shader */
+/*@{*/
+#define MAX_VERTEX_UNIFORM_COMPONENTS 512
+#define MAX_VARYING_FLOATS 32
+#define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0
+#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS)
 /*@}*/
 
 
 #define FEATURE_windowpos  _HAVE_FULL_GL
 #define FEATURE_ARB_vertex_shader _HAVE_FULL_GL
 #define FEATURE_ARB_fragment_shader _HAVE_FULL_GL
-#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)\r
+#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)
 #define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects
 #define FEATURE_ATI_fragment_shader _HAVE_FULL_GL
 #define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL
index 629de5b72b9d627895f52b2fc11ab9f25403d73e..4e346fb14bf8ae2515bc02e037f7f0a4d5955f3e 100644 (file)
-\r
-/***\r
- ***  NOTE!!!  DO NOT EDIT THIS FILE!!!  IT IS GENERATED BY get_gen.py\r
- ***/\r
-\r
-#include "glheader.h"\r
-#include "context.h"\r
-#include "enable.h"\r
-#include "extensions.h"\r
-#include "fbobject.h"\r
-#include "get.h"\r
-#include "macros.h"\r
-#include "mtypes.h"\r
-#include "texcompress.h"\r
-\r
-\r
-#define FLOAT_TO_BOOLEAN(X)   ( (X) ? GL_TRUE : GL_FALSE )\r
-\r
-#define INT_TO_BOOLEAN(I)     ( (I) ? GL_TRUE : GL_FALSE )\r
-\r
-#define ENUM_TO_BOOLEAN(E)    ( (E) ? GL_TRUE : GL_FALSE )\r
-#define ENUM_TO_INT(E)        ( (GLint) (E) )\r
-#define ENUM_TO_FLOAT(E)      ( (GLfloat) (E) )\r
-\r
-#define BOOLEAN_TO_INT(B)     ( (GLint) (B) )\r
-#define BOOLEAN_TO_FLOAT(B)   ( (B) ? 1.0F : 0.0F )\r
-\r
-\r
-/* Check if named extension is enabled, if not generate error and return */\r
-\r
-#define CHECK1(E1, str, PNAME)                         \\r
-   if (!ctx->Extensions.E1) {                          \\r
-      _mesa_error(ctx, GL_INVALID_VALUE,               \\r
-                  "glGet" str "v(0x%x)", (int) PNAME); \\r
-      return;                                          \\r
-   }\r
-    \r
-#define CHECK2(E1, E2, str, PNAME)                     \\r
-   if (!ctx->Extensions.E1 && !ctx->Extensions.E2) {   \\r
-      _mesa_error(ctx, GL_INVALID_VALUE,               \\r
-                  "glGet" str "v(0x%x)", (int) PNAME); \\r
-      return;                                          \\r
-   }\r
-    \r
-#define CHECK_EXTENSION_B(EXTNAME, PNAME)      \\r
-   CHECK1(EXTNAME, "Boolean", PNAME )\r
-\r
-#define CHECK_EXTENSION_I(EXTNAME, PNAME)      \\r
-   CHECK1(EXTNAME, "Integer", PNAME )\r
-\r
-#define CHECK_EXTENSION_F(EXTNAME, PNAME)      \\r
-   CHECK1(EXTNAME, "Float", PNAME )\r
-\r
-\r
-/**\r
- * Helper routine.\r
- */\r
-static GLenum\r
-pixel_texgen_mode(const GLcontext *ctx)\r
-{\r
-   if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) {\r
-      if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {\r
-         return GL_RGBA;\r
-      }\r
-      else {\r
-         return GL_RGB;\r
-      }\r
-   }\r
-   else {\r
-      if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {\r
-         return GL_ALPHA;\r
-      }\r
-      else {\r
-         return GL_NONE;\r
-      }\r
-   }\r
-}\r
-\r
-void GLAPIENTRY\r
-_mesa_GetBooleanv( GLenum pname, GLboolean *params )\r
-{\r
-   GET_CURRENT_CONTEXT(ctx);\r
-   ASSERT_OUTSIDE_BEGIN_END(ctx);\r
-\r
-   if (!params)\r
-      return;\r
-\r
-   if (ctx->Driver.GetBooleanv &&\r
-       ctx->Driver.GetBooleanv(ctx, pname, params))\r
-      return;\r
-\r
-   switch (pname) {\r
-      case GL_ACCUM_RED_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.accumRedBits);\r
-         break;\r
-      case GL_ACCUM_GREEN_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.accumGreenBits);\r
-         break;\r
-      case GL_ACCUM_BLUE_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.accumBlueBits);\r
-         break;\r
-      case GL_ACCUM_ALPHA_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.accumAlphaBits);\r
-         break;\r
-      case GL_ACCUM_CLEAR_VALUE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[3]);\r
-         break;\r
-      case GL_ALPHA_BIAS:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias);\r
-         break;\r
-      case GL_ALPHA_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.alphaBits);\r
-         break;\r
-      case GL_ALPHA_SCALE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaScale);\r
-         break;\r
-      case GL_ALPHA_TEST:\r
-         params[0] = ctx->Color.AlphaEnabled;\r
-         break;\r
-      case GL_ALPHA_TEST_FUNC:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.AlphaFunc);\r
-         break;\r
-      case GL_ALPHA_TEST_REF:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Color.AlphaRef);\r
-         break;\r
-      case GL_ATTRIB_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(ctx->AttribStackDepth);\r
-         break;\r
-      case GL_AUTO_NORMAL:\r
-         params[0] = ctx->Eval.AutoNormal;\r
-         break;\r
-      case GL_AUX_BUFFERS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.numAuxBuffers);\r
-         break;\r
-      case GL_BLEND:\r
-         params[0] = ctx->Color.BlendEnabled;\r
-         break;\r
-      case GL_BLEND_DST:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB);\r
-         break;\r
-      case GL_BLEND_SRC:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB);\r
-         break;\r
-      case GL_BLEND_SRC_RGB_EXT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB);\r
-         break;\r
-      case GL_BLEND_DST_RGB_EXT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB);\r
-         break;\r
-      case GL_BLEND_SRC_ALPHA_EXT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcA);\r
-         break;\r
-      case GL_BLEND_DST_ALPHA_EXT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstA);\r
-         break;\r
-      case GL_BLEND_EQUATION:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationRGB );\r
-         break;\r
-      case GL_BLEND_EQUATION_ALPHA_EXT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationA );\r
-         break;\r
-      case GL_BLEND_COLOR_EXT:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[3]);\r
-         break;\r
-      case GL_BLUE_BIAS:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias);\r
-         break;\r
-      case GL_BLUE_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.blueBits);\r
-         break;\r
-      case GL_BLUE_SCALE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueScale);\r
-         break;\r
-      case GL_CLIENT_ATTRIB_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(ctx->ClientAttribStackDepth);\r
-         break;\r
-      case GL_CLIP_PLANE0:\r
-         params[0] = (ctx->Transform.ClipPlanesEnabled >> 0) & 1;\r
-         break;\r
-      case GL_CLIP_PLANE1:\r
-         params[0] = (ctx->Transform.ClipPlanesEnabled >> 1) & 1;\r
-         break;\r
-      case GL_CLIP_PLANE2:\r
-         params[0] = (ctx->Transform.ClipPlanesEnabled >> 2) & 1;\r
-         break;\r
-      case GL_CLIP_PLANE3:\r
-         params[0] = (ctx->Transform.ClipPlanesEnabled >> 3) & 1;\r
-         break;\r
-      case GL_CLIP_PLANE4:\r
-         params[0] = (ctx->Transform.ClipPlanesEnabled >> 4) & 1;\r
-         break;\r
-      case GL_CLIP_PLANE5:\r
-         params[0] = (ctx->Transform.ClipPlanesEnabled >> 5) & 1;\r
-         break;\r
-      case GL_COLOR_CLEAR_VALUE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[3]);\r
-         break;\r
-      case GL_COLOR_MATERIAL:\r
-         params[0] = ctx->Light.ColorMaterialEnabled;\r
-         break;\r
-      case GL_COLOR_MATERIAL_FACE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialFace);\r
-         break;\r
-      case GL_COLOR_MATERIAL_PARAMETER:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialMode);\r
-         break;\r
-      case GL_COLOR_WRITEMASK:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[RCOMP] ? 1 : 0);\r
-         params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[GCOMP] ? 1 : 0);\r
-         params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[BCOMP] ? 1 : 0);\r
-         params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[ACOMP] ? 1 : 0);\r
-         break;\r
-      case GL_CULL_FACE:\r
-         params[0] = ctx->Polygon.CullFlag;\r
-         break;\r
-      case GL_CULL_FACE_MODE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode);\r
-         break;\r
-      case GL_CURRENT_COLOR:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);\r
-         }\r
-         break;\r
-      case GL_CURRENT_INDEX:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Index);\r
-         }\r
-         break;\r
-      case GL_CURRENT_NORMAL:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);\r
-         }\r
-         break;\r
-      case GL_CURRENT_RASTER_COLOR:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[3]);\r
-         break;\r
-      case GL_CURRENT_RASTER_DISTANCE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterDistance);\r
-         break;\r
-      case GL_CURRENT_RASTER_INDEX:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterIndex);\r
-         break;\r
-      case GL_CURRENT_RASTER_POSITION:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[3]);\r
-         break;\r
-      case GL_CURRENT_RASTER_TEXTURE_COORDS:\r
-         {\r
-         const GLuint texUnit = ctx->Texture.CurrentUnit;\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][3]);\r
-         }\r
-         break;\r
-      case GL_CURRENT_RASTER_POSITION_VALID:\r
-         params[0] = ctx->Current.RasterPosValid;\r
-         break;\r
-      case GL_CURRENT_TEXTURE_COORDS:\r
-         {\r
-         const GLuint texUnit = ctx->Texture.CurrentUnit;\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]);\r
-         }\r
-         break;\r
-      case GL_DEPTH_BIAS:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthBias);\r
-         break;\r
-      case GL_DEPTH_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.depthBits);\r
-         break;\r
-      case GL_DEPTH_CLEAR_VALUE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.Clear);\r
-         break;\r
-      case GL_DEPTH_FUNC:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Depth.Func);\r
-         break;\r
-      case GL_DEPTH_RANGE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Viewport.Near);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Viewport.Far);\r
-         break;\r
-      case GL_DEPTH_SCALE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthScale);\r
-         break;\r
-      case GL_DEPTH_TEST:\r
-         params[0] = ctx->Depth.Test;\r
-         break;\r
-      case GL_DEPTH_WRITEMASK:\r
-         params[0] = ctx->Depth.Mask;\r
-         break;\r
-      case GL_DITHER:\r
-         params[0] = ctx->Color.DitherFlag;\r
-         break;\r
-      case GL_DOUBLEBUFFER:\r
-         params[0] = ctx->Visual.doubleBufferMode;\r
-         break;\r
-      case GL_DRAW_BUFFER:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.DrawBuffer[0]);\r
-         break;\r
-      case GL_EDGE_FLAG:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = ctx->Current.EdgeFlag;\r
-         }\r
-         break;\r
-      case GL_FEEDBACK_BUFFER_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize);\r
-         break;\r
-      case GL_FEEDBACK_BUFFER_TYPE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Feedback.Type);\r
-         break;\r
-      case GL_FOG:\r
-         params[0] = ctx->Fog.Enabled;\r
-         break;\r
-      case GL_FOG_COLOR:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[3]);\r
-         break;\r
-      case GL_FOG_DENSITY:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Density);\r
-         break;\r
-      case GL_FOG_END:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.End);\r
-         break;\r
-      case GL_FOG_HINT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.Fog);\r
-         break;\r
-      case GL_FOG_INDEX:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Index);\r
-         break;\r
-      case GL_FOG_MODE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Fog.Mode);\r
-         break;\r
-      case GL_FOG_START:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Start);\r
-         break;\r
-      case GL_FRONT_FACE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontFace);\r
-         break;\r
-      case GL_GREEN_BIAS:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias);\r
-         break;\r
-      case GL_GREEN_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.greenBits);\r
-         break;\r
-      case GL_GREEN_SCALE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale);\r
-         break;\r
-      case GL_INDEX_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.indexBits);\r
-         break;\r
-      case GL_INDEX_CLEAR_VALUE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Color.ClearIndex);\r
-         break;\r
-      case GL_INDEX_MODE:\r
-         params[0] = !ctx->Visual.rgbMode;\r
-         break;\r
-      case GL_INDEX_OFFSET:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexOffset);\r
-         break;\r
-      case GL_INDEX_SHIFT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexShift);\r
-         break;\r
-      case GL_INDEX_WRITEMASK:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Color.IndexMask);\r
-         break;\r
-      case GL_LIGHT0:\r
-         params[0] = ctx->Light.Light[0].Enabled;\r
-         break;\r
-      case GL_LIGHT1:\r
-         params[0] = ctx->Light.Light[1].Enabled;\r
-         break;\r
-      case GL_LIGHT2:\r
-         params[0] = ctx->Light.Light[2].Enabled;\r
-         break;\r
-      case GL_LIGHT3:\r
-         params[0] = ctx->Light.Light[3].Enabled;\r
-         break;\r
-      case GL_LIGHT4:\r
-         params[0] = ctx->Light.Light[4].Enabled;\r
-         break;\r
-      case GL_LIGHT5:\r
-         params[0] = ctx->Light.Light[5].Enabled;\r
-         break;\r
-      case GL_LIGHT6:\r
-         params[0] = ctx->Light.Light[6].Enabled;\r
-         break;\r
-      case GL_LIGHT7:\r
-         params[0] = ctx->Light.Light[7].Enabled;\r
-         break;\r
-      case GL_LIGHTING:\r
-         params[0] = ctx->Light.Enabled;\r
-         break;\r
-      case GL_LIGHT_MODEL_AMBIENT:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[3]);\r
-         break;\r
-      case GL_LIGHT_MODEL_COLOR_CONTROL:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Light.Model.ColorControl);\r
-         break;\r
-      case GL_LIGHT_MODEL_LOCAL_VIEWER:\r
-         params[0] = ctx->Light.Model.LocalViewer;\r
-         break;\r
-      case GL_LIGHT_MODEL_TWO_SIDE:\r
-         params[0] = ctx->Light.Model.TwoSide;\r
-         break;\r
-      case GL_LINE_SMOOTH:\r
-         params[0] = ctx->Line.SmoothFlag;\r
-         break;\r
-      case GL_LINE_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.LineSmooth);\r
-         break;\r
-      case GL_LINE_STIPPLE:\r
-         params[0] = ctx->Line.StippleFlag;\r
-         break;\r
-      case GL_LINE_STIPPLE_PATTERN:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Line.StipplePattern);\r
-         break;\r
-      case GL_LINE_STIPPLE_REPEAT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Line.StippleFactor);\r
-         break;\r
-      case GL_LINE_WIDTH:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Line.Width);\r
-         break;\r
-      case GL_LINE_WIDTH_GRANULARITY:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.LineWidthGranularity);\r
-         break;\r
-      case GL_LINE_WIDTH_RANGE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidthAA);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidthAA);\r
-         break;\r
-      case GL_ALIASED_LINE_WIDTH_RANGE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidth);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidth);\r
-         break;\r
-      case GL_LIST_BASE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->List.ListBase);\r
-         break;\r
-      case GL_LIST_INDEX:\r
-         params[0] = INT_TO_BOOLEAN(ctx->ListState.CurrentListNum);\r
-         break;\r
-      case GL_LIST_MODE:\r
-         {\r
-         GLenum mode;\r
-         if (!ctx->CompileFlag)\r
-            mode = 0;\r
-         else if (ctx->ExecuteFlag)\r
-            mode = GL_COMPILE_AND_EXECUTE;\r
-         else\r
-            mode = GL_COMPILE;\r
-         params[0] = ENUM_TO_BOOLEAN(mode);\r
-         }\r
-         break;\r
-      case GL_INDEX_LOGIC_OP:\r
-         params[0] = ctx->Color.IndexLogicOpEnabled;\r
-         break;\r
-      case GL_COLOR_LOGIC_OP:\r
-         params[0] = ctx->Color.ColorLogicOpEnabled;\r
-         break;\r
-      case GL_LOGIC_OP_MODE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.LogicOp);\r
-         break;\r
-      case GL_MAP1_COLOR_4:\r
-         params[0] = ctx->Eval.Map1Color4;\r
-         break;\r
-      case GL_MAP1_GRID_DOMAIN:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u1);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u2);\r
-         break;\r
-      case GL_MAP1_GRID_SEGMENTS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid1un);\r
-         break;\r
-      case GL_MAP1_INDEX:\r
-         params[0] = ctx->Eval.Map1Index;\r
-         break;\r
-      case GL_MAP1_NORMAL:\r
-         params[0] = ctx->Eval.Map1Normal;\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_1:\r
-         params[0] = ctx->Eval.Map1TextureCoord1;\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_2:\r
-         params[0] = ctx->Eval.Map1TextureCoord2;\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_3:\r
-         params[0] = ctx->Eval.Map1TextureCoord3;\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_4:\r
-         params[0] = ctx->Eval.Map1TextureCoord4;\r
-         break;\r
-      case GL_MAP1_VERTEX_3:\r
-         params[0] = ctx->Eval.Map1Vertex3;\r
-         break;\r
-      case GL_MAP1_VERTEX_4:\r
-         params[0] = ctx->Eval.Map1Vertex4;\r
-         break;\r
-      case GL_MAP2_COLOR_4:\r
-         params[0] = ctx->Eval.Map2Color4;\r
-         break;\r
-      case GL_MAP2_GRID_DOMAIN:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u1);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u2);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v1);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v2);\r
-         break;\r
-      case GL_MAP2_GRID_SEGMENTS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2un);\r
-         params[1] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2vn);\r
-         break;\r
-      case GL_MAP2_INDEX:\r
-         params[0] = ctx->Eval.Map2Index;\r
-         break;\r
-      case GL_MAP2_NORMAL:\r
-         params[0] = ctx->Eval.Map2Normal;\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_1:\r
-         params[0] = ctx->Eval.Map2TextureCoord1;\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_2:\r
-         params[0] = ctx->Eval.Map2TextureCoord2;\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_3:\r
-         params[0] = ctx->Eval.Map2TextureCoord3;\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_4:\r
-         params[0] = ctx->Eval.Map2TextureCoord4;\r
-         break;\r
-      case GL_MAP2_VERTEX_3:\r
-         params[0] = ctx->Eval.Map2Vertex3;\r
-         break;\r
-      case GL_MAP2_VERTEX_4:\r
-         params[0] = ctx->Eval.Map2Vertex4;\r
-         break;\r
-      case GL_MAP_COLOR:\r
-         params[0] = ctx->Pixel.MapColorFlag;\r
-         break;\r
-      case GL_MAP_STENCIL:\r
-         params[0] = ctx->Pixel.MapStencilFlag;\r
-         break;\r
-      case GL_MATRIX_MODE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Transform.MatrixMode);\r
-         break;\r
-      case GL_MAX_ATTRIB_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(MAX_ATTRIB_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(MAX_CLIENT_ATTRIB_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_CLIP_PLANES:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxClipPlanes);\r
-         break;\r
-      case GL_MAX_ELEMENTS_VERTICES:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize);\r
-         break;\r
-      case GL_MAX_ELEMENTS_INDICES:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize);\r
-         break;\r
-      case GL_MAX_EVAL_ORDER:\r
-         params[0] = INT_TO_BOOLEAN(MAX_EVAL_ORDER);\r
-         break;\r
-      case GL_MAX_LIGHTS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxLights);\r
-         break;\r
-      case GL_MAX_LIST_NESTING:\r
-         params[0] = INT_TO_BOOLEAN(MAX_LIST_NESTING);\r
-         break;\r
-      case GL_MAX_MODELVIEW_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(MAX_MODELVIEW_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_NAME_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(MAX_NAME_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_PIXEL_MAP_TABLE:\r
-         params[0] = INT_TO_BOOLEAN(MAX_PIXEL_MAP_TABLE);\r
-         break;\r
-      case GL_MAX_PROJECTION_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(MAX_PROJECTION_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_TEXTURE_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.MaxTextureLevels - 1));\r
-         break;\r
-      case GL_MAX_3D_TEXTURE_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.Max3DTextureLevels - 1));\r
-         break;\r
-      case GL_MAX_TEXTURE_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(MAX_TEXTURE_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_VIEWPORT_DIMS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxViewportWidth);\r
-         params[1] = INT_TO_BOOLEAN(ctx->Const.MaxViewportHeight);\r
-         break;\r
-      case GL_MODELVIEW_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_MODELVIEW_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(ctx->ModelviewMatrixStack.Depth + 1);\r
-         break;\r
-      case GL_NAME_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Select.NameStackDepth);\r
-         break;\r
-      case GL_NORMALIZE:\r
-         params[0] = ctx->Transform.Normalize;\r
-         break;\r
-      case GL_PACK_ALIGNMENT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pack.Alignment);\r
-         break;\r
-      case GL_PACK_LSB_FIRST:\r
-         params[0] = ctx->Pack.LsbFirst;\r
-         break;\r
-      case GL_PACK_ROW_LENGTH:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pack.RowLength);\r
-         break;\r
-      case GL_PACK_SKIP_PIXELS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipPixels);\r
-         break;\r
-      case GL_PACK_SKIP_ROWS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipRows);\r
-         break;\r
-      case GL_PACK_SWAP_BYTES:\r
-         params[0] = ctx->Pack.SwapBytes;\r
-         break;\r
-      case GL_PACK_SKIP_IMAGES_EXT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipImages);\r
-         break;\r
-      case GL_PACK_IMAGE_HEIGHT_EXT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pack.ImageHeight);\r
-         break;\r
-      case GL_PACK_INVERT_MESA:\r
-         params[0] = ctx->Pack.Invert;\r
-         break;\r
-      case GL_PERSPECTIVE_CORRECTION_HINT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection);\r
-         break;\r
-      case GL_PIXEL_MAP_A_TO_A_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapAtoAsize);\r
-         break;\r
-      case GL_PIXEL_MAP_B_TO_B_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapBtoBsize);\r
-         break;\r
-      case GL_PIXEL_MAP_G_TO_G_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapGtoGsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_A_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoAsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_B_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoBsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_G_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoGsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_I_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoIsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_R_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoRsize);\r
-         break;\r
-      case GL_PIXEL_MAP_R_TO_R_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapRtoRsize);\r
-         break;\r
-      case GL_PIXEL_MAP_S_TO_S_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapStoSsize);\r
-         break;\r
-      case GL_POINT_SIZE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size);\r
-         break;\r
-      case GL_POINT_SIZE_GRANULARITY:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.PointSizeGranularity);\r
-         break;\r
-      case GL_POINT_SIZE_RANGE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSizeAA);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSizeAA);\r
-         break;\r
-      case GL_ALIASED_POINT_SIZE_RANGE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSize);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSize);\r
-         break;\r
-      case GL_POINT_SMOOTH:\r
-         params[0] = ctx->Point.SmoothFlag;\r
-         break;\r
-      case GL_POINT_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PointSmooth);\r
-         break;\r
-      case GL_POINT_SIZE_MIN_EXT:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MinSize);\r
-         break;\r
-      case GL_POINT_SIZE_MAX_EXT:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MaxSize);\r
-         break;\r
-      case GL_POINT_FADE_THRESHOLD_SIZE_EXT:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Threshold);\r
-         break;\r
-      case GL_DISTANCE_ATTENUATION_EXT:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Params[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Point.Params[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Point.Params[2]);\r
-         break;\r
-      case GL_POLYGON_MODE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontMode);\r
-         params[1] = ENUM_TO_BOOLEAN(ctx->Polygon.BackMode);\r
-         break;\r
-      case GL_POLYGON_OFFSET_BIAS_EXT:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits);\r
-         break;\r
-      case GL_POLYGON_OFFSET_FACTOR:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetFactor );\r
-         break;\r
-      case GL_POLYGON_OFFSET_UNITS:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits );\r
-         break;\r
-      case GL_POLYGON_SMOOTH:\r
-         params[0] = ctx->Polygon.SmoothFlag;\r
-         break;\r
-      case GL_POLYGON_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PolygonSmooth);\r
-         break;\r
-      case GL_POLYGON_STIPPLE:\r
-         params[0] = ctx->Polygon.StippleFlag;\r
-         break;\r
-      case GL_PROJECTION_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_PROJECTION_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(ctx->ProjectionMatrixStack.Depth + 1);\r
-         break;\r
-      case GL_READ_BUFFER:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Pixel.ReadBuffer);\r
-         break;\r
-      case GL_RED_BIAS:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias);\r
-         break;\r
-      case GL_RED_BITS:\r
-         params[0] = INT_TO_BOOLEAN( ctx->Visual.redBits );\r
-         break;\r
-      case GL_RED_SCALE:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedScale);\r
-         break;\r
-      case GL_RENDER_MODE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->RenderMode);\r
-         break;\r
-      case GL_RESCALE_NORMAL:\r
-         params[0] = ctx->Transform.RescaleNormals;\r
-         break;\r
-      case GL_RGBA_MODE:\r
-         params[0] = ctx->Visual.rgbMode;\r
-         break;\r
-      case GL_SCISSOR_BOX:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Scissor.X);\r
-         params[1] = INT_TO_BOOLEAN(ctx->Scissor.Y);\r
-         params[2] = INT_TO_BOOLEAN(ctx->Scissor.Width);\r
-         params[3] = INT_TO_BOOLEAN(ctx->Scissor.Height);\r
-         break;\r
-      case GL_SCISSOR_TEST:\r
-         params[0] = ctx->Scissor.Enabled;\r
-         break;\r
-      case GL_SELECTION_BUFFER_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Select.BufferSize);\r
-         break;\r
-      case GL_SHADE_MODEL:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Light.ShadeModel);\r
-         break;\r
-      case GL_SHARED_TEXTURE_PALETTE_EXT:\r
-         params[0] = ctx->Texture.SharedPalette;\r
-         break;\r
-      case GL_STENCIL_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Visual.stencilBits);\r
-         break;\r
-      case GL_STENCIL_CLEAR_VALUE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Stencil.Clear);\r
-         break;\r
-      case GL_STENCIL_FAIL:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_FUNC:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_PASS_DEPTH_FAIL:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_PASS_DEPTH_PASS:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_REF:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_TEST:\r
-         params[0] = ctx->Stencil.Enabled;\r
-         break;\r
-      case GL_STENCIL_VALUE_MASK:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_WRITEMASK:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STEREO:\r
-         params[0] = ctx->Visual.stereoMode;\r
-         break;\r
-      case GL_SUBPIXEL_BITS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.SubPixelBits);\r
-         break;\r
-      case GL_TEXTURE_1D:\r
-         params[0] = _mesa_IsEnabled(GL_TEXTURE_1D);\r
-         break;\r
-      case GL_TEXTURE_2D:\r
-         params[0] = _mesa_IsEnabled(GL_TEXTURE_2D);\r
-         break;\r
-      case GL_TEXTURE_3D:\r
-         params[0] = _mesa_IsEnabled(GL_TEXTURE_3D);\r
-         break;\r
-      case GL_TEXTURE_BINDING_1D:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name);\r
-         break;\r
-      case GL_TEXTURE_BINDING_2D:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name);\r
-         break;\r
-      case GL_TEXTURE_BINDING_3D:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name);\r
-         break;\r
-      case GL_TEXTURE_ENV_COLOR:\r
-         {\r
-         const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;\r
-         params[0] = FLOAT_TO_BOOLEAN(color[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(color[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(color[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(color[3]);\r
-         }\r
-         break;\r
-      case GL_TEXTURE_ENV_MODE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);\r
-         break;\r
-      case GL_TEXTURE_GEN_S:\r
-         params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0);\r
-         break;\r
-      case GL_TEXTURE_GEN_T:\r
-         params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0);\r
-         break;\r
-      case GL_TEXTURE_GEN_R:\r
-         params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0);\r
-         break;\r
-      case GL_TEXTURE_GEN_Q:\r
-         params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0);\r
-         break;\r
-      case GL_TEXTURE_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_TEXTURE_STACK_DEPTH:\r
-         params[0] = INT_TO_BOOLEAN(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1);\r
-         break;\r
-      case GL_UNPACK_ALIGNMENT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Unpack.Alignment);\r
-         break;\r
-      case GL_UNPACK_LSB_FIRST:\r
-         params[0] = ctx->Unpack.LsbFirst;\r
-         break;\r
-      case GL_UNPACK_ROW_LENGTH:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Unpack.RowLength);\r
-         break;\r
-      case GL_UNPACK_SKIP_PIXELS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipPixels);\r
-         break;\r
-      case GL_UNPACK_SKIP_ROWS:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipRows);\r
-         break;\r
-      case GL_UNPACK_SWAP_BYTES:\r
-         params[0] = ctx->Unpack.SwapBytes;\r
-         break;\r
-      case GL_UNPACK_SKIP_IMAGES_EXT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipImages);\r
-         break;\r
-      case GL_UNPACK_IMAGE_HEIGHT_EXT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Unpack.ImageHeight);\r
-         break;\r
-      case GL_UNPACK_CLIENT_STORAGE_APPLE:\r
-         params[0] = ctx->Unpack.ClientStorage;\r
-         break;\r
-      case GL_VIEWPORT:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Viewport.X);\r
-         params[1] = INT_TO_BOOLEAN(ctx->Viewport.Y);\r
-         params[2] = INT_TO_BOOLEAN(ctx->Viewport.Width);\r
-         params[3] = INT_TO_BOOLEAN(ctx->Viewport.Height);\r
-         break;\r
-      case GL_ZOOM_X:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomX);\r
-         break;\r
-      case GL_ZOOM_Y:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomY);\r
-         break;\r
-      case GL_VERTEX_ARRAY:\r
-         params[0] = ctx->Array.Vertex.Enabled;\r
-         break;\r
-      case GL_VERTEX_ARRAY_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.Size);\r
-         break;\r
-      case GL_VERTEX_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Vertex.Type);\r
-         break;\r
-      case GL_VERTEX_ARRAY_STRIDE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.Stride);\r
-         break;\r
-      case GL_VERTEX_ARRAY_COUNT_EXT:\r
-         params[0] = INT_TO_BOOLEAN(0);\r
-         break;\r
-      case GL_NORMAL_ARRAY:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Normal.Enabled);\r
-         break;\r
-      case GL_NORMAL_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Normal.Type);\r
-         break;\r
-      case GL_NORMAL_ARRAY_STRIDE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Normal.Stride);\r
-         break;\r
-      case GL_NORMAL_ARRAY_COUNT_EXT:\r
-         params[0] = INT_TO_BOOLEAN(0);\r
-         break;\r
-      case GL_COLOR_ARRAY:\r
-         params[0] = ctx->Array.Color.Enabled;\r
-         break;\r
-      case GL_COLOR_ARRAY_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Color.Size);\r
-         break;\r
-      case GL_COLOR_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Color.Type);\r
-         break;\r
-      case GL_COLOR_ARRAY_STRIDE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Color.Stride);\r
-         break;\r
-      case GL_COLOR_ARRAY_COUNT_EXT:\r
-         params[0] = INT_TO_BOOLEAN(0);\r
-         break;\r
-      case GL_INDEX_ARRAY:\r
-         params[0] = ctx->Array.Index.Enabled;\r
-         break;\r
-      case GL_INDEX_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Index.Type);\r
-         break;\r
-      case GL_INDEX_ARRAY_STRIDE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Index.Stride);\r
-         break;\r
-      case GL_INDEX_ARRAY_COUNT_EXT:\r
-         params[0] = INT_TO_BOOLEAN(0);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY:\r
-         params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_SIZE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_STRIDE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:\r
-         params[0] = INT_TO_BOOLEAN(0);\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY:\r
-         params[0] = ctx->Array.EdgeFlag.Enabled;\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_STRIDE:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.EdgeFlag.Stride);\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_COUNT_EXT:\r
-         params[0] = INT_TO_BOOLEAN(0);\r
-         break;\r
-      case GL_MAX_TEXTURE_UNITS_ARB:\r
-         CHECK_EXTENSION_B(ARB_multitexture, pname);\r
-         params[0] = INT_TO_BOOLEAN(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));\r
-         break;\r
-      case GL_ACTIVE_TEXTURE_ARB:\r
-         CHECK_EXTENSION_B(ARB_multitexture, pname);\r
-         params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit);\r
-         break;\r
-      case GL_CLIENT_ACTIVE_TEXTURE_ARB:\r
-         CHECK_EXTENSION_B(ARB_multitexture, pname);\r
-         params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);\r
-         break;\r
-      case GL_TEXTURE_CUBE_MAP_ARB:\r
-         CHECK_EXTENSION_B(ARB_texture_cube_map, pname);\r
-         params[0] = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);\r
-         break;\r
-      case GL_TEXTURE_BINDING_CUBE_MAP_ARB:\r
-         CHECK_EXTENSION_B(ARB_texture_cube_map, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name);\r
-         break;\r
-      case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:\r
-         CHECK_EXTENSION_B(ARB_texture_cube_map, pname);\r
-         params[0] = INT_TO_BOOLEAN((1 << (ctx->Const.MaxCubeTextureLevels - 1)));\r
-         break;\r
-      case GL_TEXTURE_COMPRESSION_HINT_ARB:\r
-         CHECK_EXTENSION_B(ARB_texture_compression, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Hint.TextureCompression);\r
-         break;\r
-      case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:\r
-         CHECK_EXTENSION_B(ARB_texture_compression, pname);\r
-         params[0] = INT_TO_BOOLEAN(_mesa_get_compressed_formats(ctx, NULL));\r
-         break;\r
-      case GL_COMPRESSED_TEXTURE_FORMATS_ARB:\r
-         CHECK_EXTENSION_B(ARB_texture_compression, pname);\r
-         {\r
-         GLint formats[100];\r
-         GLuint i, n = _mesa_get_compressed_formats(ctx, formats);\r
-         for (i = 0; i < n; i++)\r
-            params[i] = ENUM_TO_BOOLEAN(formats[i]);\r
-         }\r
-         break;\r
-      case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:\r
-         CHECK_EXTENSION_B(EXT_compiled_vertex_array, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.LockFirst);\r
-         break;\r
-      case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:\r
-         CHECK_EXTENSION_B(EXT_compiled_vertex_array, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.LockCount);\r
-         break;\r
-      case GL_TRANSPOSE_COLOR_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_OCCLUSION_TEST_HP:\r
-         CHECK_EXTENSION_B(HP_occlusion_test, pname);\r
-         params[0] = ctx->Depth.OcclusionTest;\r
-         break;\r
-      case GL_OCCLUSION_TEST_RESULT_HP:\r
-         CHECK_EXTENSION_B(HP_occlusion_test, pname);\r
-         {\r
-         if (ctx->Depth.OcclusionTest)\r
-            params[0] = ctx->OcclusionResult;\r
-         else\r
-            params[0] = ctx->OcclusionResultSaved;\r
-         /* reset flag now */\r
-         ctx->OcclusionResult = GL_FALSE;\r
-         ctx->OcclusionResultSaved = GL_FALSE;\r
-         return;\r
-         }\r
-         break;\r
-      case GL_PIXEL_TEXTURE_SGIS:\r
-         CHECK_EXTENSION_B(SGIS_pixel_texture, pname);\r
-         params[0] = ctx->Pixel.PixelTextureEnabled;\r
-         break;\r
-      case GL_PIXEL_TEX_GEN_SGIX:\r
-         CHECK_EXTENSION_B(SGIX_pixel_texture, pname);\r
-         params[0] = ctx->Pixel.PixelTextureEnabled;\r
-         break;\r
-      case GL_PIXEL_TEX_GEN_MODE_SGIX:\r
-         CHECK_EXTENSION_B(SGIX_pixel_texture, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(pixel_texgen_mode(ctx));\r
-         break;\r
-      case GL_COLOR_MATRIX_SGI:\r
-         {\r
-         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_COLOR_MATRIX_STACK_DEPTH_SGI:\r
-         params[0] = INT_TO_BOOLEAN(ctx->ColorMatrixStack.Depth + 1);\r
-         break;\r
-      case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:\r
-         params[0] = INT_TO_BOOLEAN(MAX_COLOR_STACK_DEPTH);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[0]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[1]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[2]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[3]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[0]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[1]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[2]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[3]);\r
-         break;\r
-      case GL_CONVOLUTION_1D_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.Convolution1DEnabled;\r
-         break;\r
-      case GL_CONVOLUTION_2D_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.Convolution2DEnabled;\r
-         break;\r
-      case GL_SEPARABLE_2D_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.Separable2DEnabled;\r
-         break;\r
-      case GL_POST_CONVOLUTION_RED_SCALE_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[0]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[1]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[2]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[3]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_RED_BIAS_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[0]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[1]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[2]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:\r
-         CHECK_EXTENSION_B(EXT_convolution, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[3]);\r
-         break;\r
-      case GL_HISTOGRAM:\r
-         CHECK_EXTENSION_B(EXT_histogram, pname);\r
-         params[0] = ctx->Pixel.HistogramEnabled;\r
-         break;\r
-      case GL_MINMAX:\r
-         CHECK_EXTENSION_B(EXT_histogram, pname);\r
-         params[0] = ctx->Pixel.MinMaxEnabled;\r
-         break;\r
-      case GL_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_B(SGI_color_table, pname);\r
-         params[0] = ctx->Pixel.ColorTableEnabled;\r
-         break;\r
-      case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_B(SGI_color_table, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionColorTableEnabled;\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_B(SGI_color_table, pname);\r
-         params[0] = ctx->Pixel.PostColorMatrixColorTableEnabled;\r
-         break;\r
-      case GL_TEXTURE_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_B(SGI_texture_color_table, pname);\r
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled;\r
-         break;\r
-      case GL_COLOR_SUM_EXT:\r
-         CHECK_EXTENSION_B(EXT_secondary_color, pname);\r
-         params[0] = ctx->Fog.ColorSumEnabled;\r
-         break;\r
-      case GL_CURRENT_SECONDARY_COLOR_EXT:\r
-         CHECK_EXTENSION_B(EXT_secondary_color, pname);\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);\r
-         }\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_EXT:\r
-         CHECK_EXTENSION_B(EXT_secondary_color, pname);\r
-         params[0] = ctx->Array.SecondaryColor.Enabled;\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:\r
-         CHECK_EXTENSION_B(EXT_secondary_color, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Array.SecondaryColor.Type);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:\r
-         CHECK_EXTENSION_B(EXT_secondary_color, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.Stride);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:\r
-         CHECK_EXTENSION_B(EXT_secondary_color, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.Size);\r
-         break;\r
-      case GL_CURRENT_FOG_COORDINATE_EXT:\r
-         CHECK_EXTENSION_B(EXT_fog_coord, pname);\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);\r
-         }\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_EXT:\r
-         CHECK_EXTENSION_B(EXT_fog_coord, pname);\r
-         params[0] = ctx->Array.FogCoord.Enabled;\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:\r
-         CHECK_EXTENSION_B(EXT_fog_coord, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Array.FogCoord.Type);\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:\r
-         CHECK_EXTENSION_B(EXT_fog_coord, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.FogCoord.Stride);\r
-         break;\r
-      case GL_FOG_COORDINATE_SOURCE_EXT:\r
-         CHECK_EXTENSION_B(EXT_fog_coord, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Fog.FogCoordinateSource);\r
-         break;\r
-      case GL_MAX_TEXTURE_LOD_BIAS_EXT:\r
-         CHECK_EXTENSION_B(EXT_texture_lod_bias, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureLodBias);\r
-         break;\r
-      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:\r
-         CHECK_EXTENSION_B(EXT_texture_filter_anisotropic, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureMaxAnisotropy);\r
-         break;\r
-      case GL_MULTISAMPLE_ARB:\r
-         CHECK_EXTENSION_B(ARB_multisample, pname);\r
-         params[0] = ctx->Multisample.Enabled;\r
-         break;\r
-      case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:\r
-         CHECK_EXTENSION_B(ARB_multisample, pname);\r
-         params[0] = ctx->Multisample.SampleAlphaToCoverage;\r
-         break;\r
-      case GL_SAMPLE_ALPHA_TO_ONE_ARB:\r
-         CHECK_EXTENSION_B(ARB_multisample, pname);\r
-         params[0] = ctx->Multisample.SampleAlphaToOne;\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_ARB:\r
-         CHECK_EXTENSION_B(ARB_multisample, pname);\r
-         params[0] = ctx->Multisample.SampleCoverage;\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_VALUE_ARB:\r
-         CHECK_EXTENSION_B(ARB_multisample, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Multisample.SampleCoverageValue);\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_INVERT_ARB:\r
-         CHECK_EXTENSION_B(ARB_multisample, pname);\r
-         params[0] = ctx->Multisample.SampleCoverageInvert;\r
-         break;\r
-      case GL_SAMPLE_BUFFERS_ARB:\r
-         CHECK_EXTENSION_B(ARB_multisample, pname);\r
-         params[0] = INT_TO_BOOLEAN(0);\r
-         break;\r
-      case GL_SAMPLES_ARB:\r
-         CHECK_EXTENSION_B(ARB_multisample, pname);\r
-         params[0] = INT_TO_BOOLEAN(0);\r
-         break;\r
-      case GL_RASTER_POSITION_UNCLIPPED_IBM:\r
-         CHECK_EXTENSION_B(IBM_rasterpos_clip, pname);\r
-         params[0] = ctx->Transform.RasterPositionUnclipped;\r
-         break;\r
-      case GL_POINT_SPRITE_NV:\r
-         CHECK_EXTENSION_B(NV_point_sprite, pname);\r
-         params[0] = ctx->Point.PointSprite;\r
-         break;\r
-      case GL_POINT_SPRITE_R_MODE_NV:\r
-         CHECK_EXTENSION_B(NV_point_sprite, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteRMode);\r
-         break;\r
-      case GL_POINT_SPRITE_COORD_ORIGIN:\r
-         CHECK_EXTENSION_B(NV_point_sprite, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteOrigin);\r
-         break;\r
-      case GL_GENERATE_MIPMAP_HINT_SGIS:\r
-         CHECK_EXTENSION_B(SGIS_generate_mipmap, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.GenerateMipmap);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->VertexProgram.Enabled;\r
-         break;\r
-      case GL_VERTEX_PROGRAM_POINT_SIZE_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->VertexProgram.PointSizeEnabled;\r
-         break;\r
-      case GL_VERTEX_PROGRAM_TWO_SIDE_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->VertexProgram.TwoSideEnabled;\r
-         break;\r
-      case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrixStackDepth);\r
-         break;\r
-      case GL_MAX_TRACK_MATRICES_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrices);\r
-         break;\r
-      case GL_CURRENT_MATRIX_STACK_DEPTH_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->CurrentStack->Depth + 1;\r
-         break;\r
-      case GL_CURRENT_MATRIX_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         {\r
-         const GLfloat *matrix = ctx->CurrentStack->Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_VERTEX_PROGRAM_BINDING_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = INT_TO_BOOLEAN((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0));\r
-         break;\r
-      case GL_PROGRAM_ERROR_POSITION_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Program.ErrorPos);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY0_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[0].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY1_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[1].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY2_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[2].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY3_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[3].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[4].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY5_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[5].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY6_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[6].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY7_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[7].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY8_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[8].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY9_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[9].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY10_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[10].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY11_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[11].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY12_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[12].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY13_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[13].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY14_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[14].Enabled;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY15_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Array.VertexAttrib[15].Enabled;\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB0_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[0];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB1_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[1];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB2_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[2];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB3_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[3];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB4_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[4];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB5_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[5];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB6_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[6];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB7_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[7];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB8_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[8];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB9_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[9];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB10_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[10];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB11_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[11];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB12_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[12];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB13_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[13];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB14_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[14];\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB15_4_NV:\r
-         CHECK_EXTENSION_B(NV_vertex_program, pname);\r
-         params[0] = ctx->Eval.Map1Attrib[15];\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_NV:\r
-         CHECK_EXTENSION_B(NV_fragment_program, pname);\r
-         params[0] = ctx->FragmentProgram.Enabled;\r
-         break;\r
-      case GL_MAX_TEXTURE_COORDS_NV:\r
-         CHECK_EXTENSION_B(NV_fragment_program, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureCoordUnits);\r
-         break;\r
-      case GL_MAX_TEXTURE_IMAGE_UNITS_NV:\r
-         CHECK_EXTENSION_B(NV_fragment_program, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureImageUnits);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_BINDING_NV:\r
-         CHECK_EXTENSION_B(NV_fragment_program, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0);\r
-         break;\r
-      case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:\r
-         CHECK_EXTENSION_B(NV_fragment_program, pname);\r
-         params[0] = INT_TO_BOOLEAN(MAX_NV_FRAGMENT_PROGRAM_PARAMS);\r
-         break;\r
-      case GL_TEXTURE_RECTANGLE_NV:\r
-         CHECK_EXTENSION_B(NV_texture_rectangle, pname);\r
-         params[0] = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);\r
-         break;\r
-      case GL_TEXTURE_BINDING_RECTANGLE_NV:\r
-         CHECK_EXTENSION_B(NV_texture_rectangle, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name);\r
-         break;\r
-      case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:\r
-         CHECK_EXTENSION_B(NV_texture_rectangle, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureRectSize);\r
-         break;\r
-      case GL_STENCIL_TEST_TWO_SIDE_EXT:\r
-         CHECK_EXTENSION_B(EXT_stencil_two_side, pname);\r
-         params[0] = ctx->Stencil.TestTwoSide;\r
-         break;\r
-      case GL_ACTIVE_STENCIL_FACE_EXT:\r
-         CHECK_EXTENSION_B(EXT_stencil_two_side, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);\r
-         break;\r
-      case GL_MAX_SHININESS_NV:\r
-         CHECK_EXTENSION_B(NV_light_max_exponent, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxShininess);\r
-         break;\r
-      case GL_MAX_SPOT_EXPONENT_NV:\r
-         CHECK_EXTENSION_B(NV_light_max_exponent, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxSpotExponent);\r
-         break;\r
-      case GL_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayBufferObj->Name);\r
-         break;\r
-      case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.BufferObj->Name);\r
-         break;\r
-      case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Normal.BufferObj->Name);\r
-         break;\r
-      case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Color.BufferObj->Name);\r
-         break;\r
-      case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.Index.BufferObj->Name);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name);\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.EdgeFlag.BufferObj->Name);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.BufferObj->Name);\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.FogCoord.BufferObj->Name);\r
-         break;\r
-      case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Array.ElementArrayBufferObj->Name);\r
-         break;\r
-      case GL_PIXEL_PACK_BUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Pack.BufferObj->Name);\r
-         break;\r
-      case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Unpack.BufferObj->Name);\r
-         break;\r
-      case GL_MAX_VERTEX_ATTRIBS_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_program, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVertexProgramAttribs);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_ARB:\r
-         CHECK_EXTENSION_B(ARB_fragment_program, pname);\r
-         params[0] = ctx->FragmentProgram.Enabled;\r
-         break;\r
-      case GL_TRANSPOSE_CURRENT_MATRIX_ARB:\r
-         CHECK_EXTENSION_B(ARB_fragment_program, pname);\r
-         {\r
-         const GLfloat *matrix = ctx->CurrentStack->Top->m;\r
-         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);\r
-         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);\r
-         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);\r
-         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);\r
-         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);\r
-         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);\r
-         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);\r
-         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);\r
-         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);\r
-         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);\r
-         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);\r
-         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);\r
-         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);\r
-         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);\r
-         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);\r
-         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_DEPTH_BOUNDS_TEST_EXT:\r
-         CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);\r
-         params[0] = ctx->Depth.BoundsTest;\r
-         break;\r
-      case GL_DEPTH_BOUNDS_EXT:\r
-         CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);\r
-         params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin);\r
-         params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:\r
-         CHECK_EXTENSION_B(MESA_program_debug, pname);\r
-         params[0] = ctx->FragmentProgram.CallbackEnabled;\r
-         break;\r
-      case GL_VERTEX_PROGRAM_CALLBACK_MESA:\r
-         CHECK_EXTENSION_B(MESA_program_debug, pname);\r
-         params[0] = ctx->VertexProgram.CallbackEnabled;\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_POSITION_MESA:\r
-         CHECK_EXTENSION_B(MESA_program_debug, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.CurrentPosition);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_POSITION_MESA:\r
-         CHECK_EXTENSION_B(MESA_program_debug, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->VertexProgram.CurrentPosition);\r
-         break;\r
-      case GL_MAX_DRAW_BUFFERS_ARB:\r
-         CHECK_EXTENSION_B(ARB_draw_buffers, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers);\r
-         break;\r
-      case GL_DRAW_BUFFER0_ARB:\r
-         CHECK_EXTENSION_B(ARB_draw_buffers, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Color.DrawBuffer[0]);\r
-         break;\r
-      case GL_DRAW_BUFFER1_ARB:\r
-         CHECK_EXTENSION_B(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[1];\r
-         params[0] = ENUM_TO_BOOLEAN(buffer);\r
-         }\r
-         break;\r
-      case GL_DRAW_BUFFER2_ARB:\r
-         CHECK_EXTENSION_B(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[2];\r
-         params[0] = ENUM_TO_BOOLEAN(buffer);\r
-         }\r
-         break;\r
-      case GL_DRAW_BUFFER3_ARB:\r
-         CHECK_EXTENSION_B(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[3];\r
-         params[0] = ENUM_TO_BOOLEAN(buffer);\r
-         }\r
-         break;\r
-      case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:\r
-         CHECK_EXTENSION_B(OES_read_format, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType);\r
-         break;\r
-      case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:\r
-         CHECK_EXTENSION_B(OES_read_format, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat);\r
-         break;\r
-      case GL_NUM_FRAGMENT_REGISTERS_ATI:\r
-         CHECK_EXTENSION_B(ATI_fragment_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(6);\r
-         break;\r
-      case GL_NUM_FRAGMENT_CONSTANTS_ATI:\r
-         CHECK_EXTENSION_B(ATI_fragment_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(8);\r
-         break;\r
-      case GL_NUM_PASSES_ATI:\r
-         CHECK_EXTENSION_B(ATI_fragment_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(2);\r
-         break;\r
-      case GL_NUM_INSTRUCTIONS_PER_PASS_ATI:\r
-         CHECK_EXTENSION_B(ATI_fragment_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(8);\r
-         break;\r
-      case GL_NUM_INSTRUCTIONS_TOTAL_ATI:\r
-         CHECK_EXTENSION_B(ATI_fragment_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(16);\r
-         break;\r
-      case GL_COLOR_ALPHA_PAIRING_ATI:\r
-         CHECK_EXTENSION_B(ATI_fragment_shader, pname);\r
-         params[0] = GL_TRUE;\r
-         break;\r
-      case GL_NUM_LOOPBACK_COMPONENTS_ATI:\r
-         CHECK_EXTENSION_B(ATI_fragment_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(3);\r
-         break;\r
-      case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI:\r
-         CHECK_EXTENSION_B(ATI_fragment_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(3);\r
-         break;\r
-      case GL_STENCIL_BACK_FUNC:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_VALUE_MASK:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_REF:\r
-         params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_FAIL:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_PASS_DEPTH_PASS:\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[1]);\r
-         break;\r
-      case GL_FRAMEBUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_B(EXT_framebuffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->CurrentFramebuffer ? ctx->CurrentFramebuffer->Name : 0);\r
-         break;\r
-      case GL_RENDERBUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_B(EXT_framebuffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0);\r
-         break;\r
-      case GL_MAX_COLOR_ATTACHMENTS_EXT:\r
-         CHECK_EXTENSION_B(EXT_framebuffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxColorAttachments);\r
-         break;\r
-      case GL_MAX_RENDERBUFFER_SIZE_EXT:\r
-         CHECK_EXTENSION_B(EXT_framebuffer_object, pname);\r
-         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxRenderbufferSize);\r
-         break;\r
-      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:\r
-         CHECK_EXTENSION_B(ARB_fragment_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(MAX_FRAGMENT_UNIFORM_COMPONENTS);\r
-         break;\r
-      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:\r
-         CHECK_EXTENSION_B(ARB_fragment_shader, pname);\r
-         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.FragmentShaderDerivative);\r
-         break;\r
-      case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(MAX_VERTEX_UNIFORM_COMPONENTS);\r
-         break;\r
-      case GL_MAX_VARYING_FLOATS_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(MAX_VARYING_FLOATS);\r
-         break;\r
-      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(MAX_VERTEX_TEXTURE_IMAGE_UNITS);\r
-         break;\r
-      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:\r
-         CHECK_EXTENSION_B(ARB_vertex_shader, pname);\r
-         params[0] = INT_TO_BOOLEAN(MAX_COMBINED_TEXTURE_IMAGE_UNITS);\r
-         break;\r
-      default:\r
-         _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);\r
-   }\r
-}\r
-\r
-void GLAPIENTRY\r
-_mesa_GetFloatv( GLenum pname, GLfloat *params )\r
-{\r
-   GET_CURRENT_CONTEXT(ctx);\r
-   ASSERT_OUTSIDE_BEGIN_END(ctx);\r
-\r
-   if (!params)\r
-      return;\r
-\r
-   if (ctx->Driver.GetFloatv &&\r
-       ctx->Driver.GetFloatv(ctx, pname, params))\r
-      return;\r
-\r
-   switch (pname) {\r
-      case GL_ACCUM_RED_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.accumRedBits);\r
-         break;\r
-      case GL_ACCUM_GREEN_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.accumGreenBits);\r
-         break;\r
-      case GL_ACCUM_BLUE_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.accumBlueBits);\r
-         break;\r
-      case GL_ACCUM_ALPHA_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.accumAlphaBits);\r
-         break;\r
-      case GL_ACCUM_CLEAR_VALUE:\r
-         params[0] = ctx->Accum.ClearColor[0];\r
-         params[1] = ctx->Accum.ClearColor[1];\r
-         params[2] = ctx->Accum.ClearColor[2];\r
-         params[3] = ctx->Accum.ClearColor[3];\r
-         break;\r
-      case GL_ALPHA_BIAS:\r
-         params[0] = ctx->Pixel.AlphaBias;\r
-         break;\r
-      case GL_ALPHA_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.alphaBits);\r
-         break;\r
-      case GL_ALPHA_SCALE:\r
-         params[0] = ctx->Pixel.AlphaScale;\r
-         break;\r
-      case GL_ALPHA_TEST:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.AlphaEnabled);\r
-         break;\r
-      case GL_ALPHA_TEST_FUNC:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.AlphaFunc);\r
-         break;\r
-      case GL_ALPHA_TEST_REF:\r
-         params[0] = ctx->Color.AlphaRef;\r
-         break;\r
-      case GL_ATTRIB_STACK_DEPTH:\r
-         params[0] = (GLfloat)(ctx->AttribStackDepth);\r
-         break;\r
-      case GL_AUTO_NORMAL:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.AutoNormal);\r
-         break;\r
-      case GL_AUX_BUFFERS:\r
-         params[0] = (GLfloat)(ctx->Visual.numAuxBuffers);\r
-         break;\r
-      case GL_BLEND:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.BlendEnabled);\r
-         break;\r
-      case GL_BLEND_DST:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB);\r
-         break;\r
-      case GL_BLEND_SRC:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB);\r
-         break;\r
-      case GL_BLEND_SRC_RGB_EXT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB);\r
-         break;\r
-      case GL_BLEND_DST_RGB_EXT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB);\r
-         break;\r
-      case GL_BLEND_SRC_ALPHA_EXT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcA);\r
-         break;\r
-      case GL_BLEND_DST_ALPHA_EXT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstA);\r
-         break;\r
-      case GL_BLEND_EQUATION:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationRGB );\r
-         break;\r
-      case GL_BLEND_EQUATION_ALPHA_EXT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationA );\r
-         break;\r
-      case GL_BLEND_COLOR_EXT:\r
-         params[0] = ctx->Color.BlendColor[0];\r
-         params[1] = ctx->Color.BlendColor[1];\r
-         params[2] = ctx->Color.BlendColor[2];\r
-         params[3] = ctx->Color.BlendColor[3];\r
-         break;\r
-      case GL_BLUE_BIAS:\r
-         params[0] = ctx->Pixel.BlueBias;\r
-         break;\r
-      case GL_BLUE_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.blueBits);\r
-         break;\r
-      case GL_BLUE_SCALE:\r
-         params[0] = ctx->Pixel.BlueScale;\r
-         break;\r
-      case GL_CLIENT_ATTRIB_STACK_DEPTH:\r
-         params[0] = (GLfloat)(ctx->ClientAttribStackDepth);\r
-         break;\r
-      case GL_CLIP_PLANE0:\r
-         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 0) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE1:\r
-         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 1) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE2:\r
-         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 2) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE3:\r
-         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 3) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE4:\r
-         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 4) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE5:\r
-         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 5) & 1);\r
-         break;\r
-      case GL_COLOR_CLEAR_VALUE:\r
-         params[0] = ctx->Color.ClearColor[0];\r
-         params[1] = ctx->Color.ClearColor[1];\r
-         params[2] = ctx->Color.ClearColor[2];\r
-         params[3] = ctx->Color.ClearColor[3];\r
-         break;\r
-      case GL_COLOR_MATERIAL:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ColorMaterialEnabled);\r
-         break;\r
-      case GL_COLOR_MATERIAL_FACE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace);\r
-         break;\r
-      case GL_COLOR_MATERIAL_PARAMETER:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode);\r
-         break;\r
-      case GL_COLOR_WRITEMASK:\r
-         params[0] = (GLfloat)(ctx->Color.ColorMask[RCOMP] ? 1 : 0);\r
-         params[1] = (GLfloat)(ctx->Color.ColorMask[GCOMP] ? 1 : 0);\r
-         params[2] = (GLfloat)(ctx->Color.ColorMask[BCOMP] ? 1 : 0);\r
-         params[3] = (GLfloat)(ctx->Color.ColorMask[ACOMP] ? 1 : 0);\r
-         break;\r
-      case GL_CULL_FACE:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.CullFlag);\r
-         break;\r
-      case GL_CULL_FACE_MODE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);\r
-         break;\r
-      case GL_CURRENT_COLOR:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];\r
-         params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];\r
-         params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];\r
-         params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];\r
-         }\r
-         break;\r
-      case GL_CURRENT_INDEX:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = ctx->Current.Index;\r
-         }\r
-         break;\r
-      case GL_CURRENT_NORMAL:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];\r
-         params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];\r
-         params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];\r
-         }\r
-         break;\r
-      case GL_CURRENT_RASTER_COLOR:\r
-         params[0] = ctx->Current.RasterColor[0];\r
-         params[1] = ctx->Current.RasterColor[1];\r
-         params[2] = ctx->Current.RasterColor[2];\r
-         params[3] = ctx->Current.RasterColor[3];\r
-         break;\r
-      case GL_CURRENT_RASTER_DISTANCE:\r
-         params[0] = ctx->Current.RasterDistance;\r
-         break;\r
-      case GL_CURRENT_RASTER_INDEX:\r
-         params[0] = ctx->Current.RasterIndex;\r
-         break;\r
-      case GL_CURRENT_RASTER_POSITION:\r
-         params[0] = ctx->Current.RasterPos[0];\r
-         params[1] = ctx->Current.RasterPos[1];\r
-         params[2] = ctx->Current.RasterPos[2];\r
-         params[3] = ctx->Current.RasterPos[3];\r
-         break;\r
-      case GL_CURRENT_RASTER_TEXTURE_COORDS:\r
-         {\r
-         const GLuint texUnit = ctx->Texture.CurrentUnit;\r
-         params[0] = ctx->Current.RasterTexCoords[texUnit][0];\r
-         params[1] = ctx->Current.RasterTexCoords[texUnit][1];\r
-         params[2] = ctx->Current.RasterTexCoords[texUnit][2];\r
-         params[3] = ctx->Current.RasterTexCoords[texUnit][3];\r
-         }\r
-         break;\r
-      case GL_CURRENT_RASTER_POSITION_VALID:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Current.RasterPosValid);\r
-         break;\r
-      case GL_CURRENT_TEXTURE_COORDS:\r
-         {\r
-         const GLuint texUnit = ctx->Texture.CurrentUnit;\r
-         params[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0];\r
-         params[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1];\r
-         params[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2];\r
-         params[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3];\r
-         }\r
-         break;\r
-      case GL_DEPTH_BIAS:\r
-         params[0] = ctx->Pixel.DepthBias;\r
-         break;\r
-      case GL_DEPTH_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.depthBits);\r
-         break;\r
-      case GL_DEPTH_CLEAR_VALUE:\r
-         params[0] = ctx->Depth.Clear;\r
-         break;\r
-      case GL_DEPTH_FUNC:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Depth.Func);\r
-         break;\r
-      case GL_DEPTH_RANGE:\r
-         params[0] = ctx->Viewport.Near;\r
-         params[1] = ctx->Viewport.Far;\r
-         break;\r
-      case GL_DEPTH_SCALE:\r
-         params[0] = ctx->Pixel.DepthScale;\r
-         break;\r
-      case GL_DEPTH_TEST:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Test);\r
-         break;\r
-      case GL_DEPTH_WRITEMASK:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Mask);\r
-         break;\r
-      case GL_DITHER:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.DitherFlag);\r
-         break;\r
-      case GL_DOUBLEBUFFER:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Visual.doubleBufferMode);\r
-         break;\r
-      case GL_DRAW_BUFFER:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]);\r
-         break;\r
-      case GL_EDGE_FLAG:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Current.EdgeFlag);\r
-         }\r
-         break;\r
-      case GL_FEEDBACK_BUFFER_SIZE:\r
-         params[0] = (GLfloat)(ctx->Feedback.BufferSize);\r
-         break;\r
-      case GL_FEEDBACK_BUFFER_TYPE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Feedback.Type);\r
-         break;\r
-      case GL_FOG:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.Enabled);\r
-         break;\r
-      case GL_FOG_COLOR:\r
-         params[0] = ctx->Fog.Color[0];\r
-         params[1] = ctx->Fog.Color[1];\r
-         params[2] = ctx->Fog.Color[2];\r
-         params[3] = ctx->Fog.Color[3];\r
-         break;\r
-      case GL_FOG_DENSITY:\r
-         params[0] = ctx->Fog.Density;\r
-         break;\r
-      case GL_FOG_END:\r
-         params[0] = ctx->Fog.End;\r
-         break;\r
-      case GL_FOG_HINT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Hint.Fog);\r
-         break;\r
-      case GL_FOG_INDEX:\r
-         params[0] = ctx->Fog.Index;\r
-         break;\r
-      case GL_FOG_MODE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Fog.Mode);\r
-         break;\r
-      case GL_FOG_START:\r
-         params[0] = ctx->Fog.Start;\r
-         break;\r
-      case GL_FRONT_FACE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontFace);\r
-         break;\r
-      case GL_GREEN_BIAS:\r
-         params[0] = ctx->Pixel.GreenBias;\r
-         break;\r
-      case GL_GREEN_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.greenBits);\r
-         break;\r
-      case GL_GREEN_SCALE:\r
-         params[0] = ctx->Pixel.GreenScale;\r
-         break;\r
-      case GL_INDEX_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.indexBits);\r
-         break;\r
-      case GL_INDEX_CLEAR_VALUE:\r
-         params[0] = (GLfloat)(ctx->Color.ClearIndex);\r
-         break;\r
-      case GL_INDEX_MODE:\r
-         params[0] = BOOLEAN_TO_FLOAT(!ctx->Visual.rgbMode);\r
-         break;\r
-      case GL_INDEX_OFFSET:\r
-         params[0] = (GLfloat)(ctx->Pixel.IndexOffset);\r
-         break;\r
-      case GL_INDEX_SHIFT:\r
-         params[0] = (GLfloat)(ctx->Pixel.IndexShift);\r
-         break;\r
-      case GL_INDEX_WRITEMASK:\r
-         params[0] = (GLfloat)(ctx->Color.IndexMask);\r
-         break;\r
-      case GL_LIGHT0:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[0].Enabled);\r
-         break;\r
-      case GL_LIGHT1:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[1].Enabled);\r
-         break;\r
-      case GL_LIGHT2:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[2].Enabled);\r
-         break;\r
-      case GL_LIGHT3:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[3].Enabled);\r
-         break;\r
-      case GL_LIGHT4:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[4].Enabled);\r
-         break;\r
-      case GL_LIGHT5:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[5].Enabled);\r
-         break;\r
-      case GL_LIGHT6:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[6].Enabled);\r
-         break;\r
-      case GL_LIGHT7:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[7].Enabled);\r
-         break;\r
-      case GL_LIGHTING:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Enabled);\r
-         break;\r
-      case GL_LIGHT_MODEL_AMBIENT:\r
-         params[0] = ctx->Light.Model.Ambient[0];\r
-         params[1] = ctx->Light.Model.Ambient[1];\r
-         params[2] = ctx->Light.Model.Ambient[2];\r
-         params[3] = ctx->Light.Model.Ambient[3];\r
-         break;\r
-      case GL_LIGHT_MODEL_COLOR_CONTROL:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Light.Model.ColorControl);\r
-         break;\r
-      case GL_LIGHT_MODEL_LOCAL_VIEWER:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.LocalViewer);\r
-         break;\r
-      case GL_LIGHT_MODEL_TWO_SIDE:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.TwoSide);\r
-         break;\r
-      case GL_LINE_SMOOTH:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Line.SmoothFlag);\r
-         break;\r
-      case GL_LINE_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Hint.LineSmooth);\r
-         break;\r
-      case GL_LINE_STIPPLE:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Line.StippleFlag);\r
-         break;\r
-      case GL_LINE_STIPPLE_PATTERN:\r
-         params[0] = (GLfloat)(ctx->Line.StipplePattern);\r
-         break;\r
-      case GL_LINE_STIPPLE_REPEAT:\r
-         params[0] = (GLfloat)(ctx->Line.StippleFactor);\r
-         break;\r
-      case GL_LINE_WIDTH:\r
-         params[0] = ctx->Line.Width;\r
-         break;\r
-      case GL_LINE_WIDTH_GRANULARITY:\r
-         params[0] = ctx->Const.LineWidthGranularity;\r
-         break;\r
-      case GL_LINE_WIDTH_RANGE:\r
-         params[0] = ctx->Const.MinLineWidthAA;\r
-         params[1] = ctx->Const.MaxLineWidthAA;\r
-         break;\r
-      case GL_ALIASED_LINE_WIDTH_RANGE:\r
-         params[0] = ctx->Const.MinLineWidth;\r
-         params[1] = ctx->Const.MaxLineWidth;\r
-         break;\r
-      case GL_LIST_BASE:\r
-         params[0] = (GLfloat)(ctx->List.ListBase);\r
-         break;\r
-      case GL_LIST_INDEX:\r
-         params[0] = (GLfloat)(ctx->ListState.CurrentListNum);\r
-         break;\r
-      case GL_LIST_MODE:\r
-         {\r
-         GLenum mode;\r
-         if (!ctx->CompileFlag)\r
-            mode = 0;\r
-         else if (ctx->ExecuteFlag)\r
-            mode = GL_COMPILE_AND_EXECUTE;\r
-         else\r
-            mode = GL_COMPILE;\r
-         params[0] = ENUM_TO_FLOAT(mode);\r
-         }\r
-         break;\r
-      case GL_INDEX_LOGIC_OP:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.IndexLogicOpEnabled);\r
-         break;\r
-      case GL_COLOR_LOGIC_OP:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.ColorLogicOpEnabled);\r
-         break;\r
-      case GL_LOGIC_OP_MODE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.LogicOp);\r
-         break;\r
-      case GL_MAP1_COLOR_4:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Color4);\r
-         break;\r
-      case GL_MAP1_GRID_DOMAIN:\r
-         params[0] = ctx->Eval.MapGrid1u1;\r
-         params[1] = ctx->Eval.MapGrid1u2;\r
-         break;\r
-      case GL_MAP1_GRID_SEGMENTS:\r
-         params[0] = (GLfloat)(ctx->Eval.MapGrid1un);\r
-         break;\r
-      case GL_MAP1_INDEX:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Index);\r
-         break;\r
-      case GL_MAP1_NORMAL:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Normal);\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_1:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord1);\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_2:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord2);\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_3:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord3);\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_4:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord4);\r
-         break;\r
-      case GL_MAP1_VERTEX_3:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex3);\r
-         break;\r
-      case GL_MAP1_VERTEX_4:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex4);\r
-         break;\r
-      case GL_MAP2_COLOR_4:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Color4);\r
-         break;\r
-      case GL_MAP2_GRID_DOMAIN:\r
-         params[0] = ctx->Eval.MapGrid2u1;\r
-         params[1] = ctx->Eval.MapGrid2u2;\r
-         params[2] = ctx->Eval.MapGrid2v1;\r
-         params[3] = ctx->Eval.MapGrid2v2;\r
-         break;\r
-      case GL_MAP2_GRID_SEGMENTS:\r
-         params[0] = (GLfloat)(ctx->Eval.MapGrid2un);\r
-         params[1] = (GLfloat)(ctx->Eval.MapGrid2vn);\r
-         break;\r
-      case GL_MAP2_INDEX:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Index);\r
-         break;\r
-      case GL_MAP2_NORMAL:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Normal);\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_1:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord1);\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_2:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord2);\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_3:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord3);\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_4:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord4);\r
-         break;\r
-      case GL_MAP2_VERTEX_3:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex3);\r
-         break;\r
-      case GL_MAP2_VERTEX_4:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex4);\r
-         break;\r
-      case GL_MAP_COLOR:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapColorFlag);\r
-         break;\r
-      case GL_MAP_STENCIL:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapStencilFlag);\r
-         break;\r
-      case GL_MATRIX_MODE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Transform.MatrixMode);\r
-         break;\r
-      case GL_MAX_ATTRIB_STACK_DEPTH:\r
-         params[0] = (GLfloat)(MAX_ATTRIB_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:\r
-         params[0] = (GLfloat)(MAX_CLIENT_ATTRIB_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_CLIP_PLANES:\r
-         params[0] = (GLfloat)(ctx->Const.MaxClipPlanes);\r
-         break;\r
-      case GL_MAX_ELEMENTS_VERTICES:\r
-         params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize);\r
-         break;\r
-      case GL_MAX_ELEMENTS_INDICES:\r
-         params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize);\r
-         break;\r
-      case GL_MAX_EVAL_ORDER:\r
-         params[0] = (GLfloat)(MAX_EVAL_ORDER);\r
-         break;\r
-      case GL_MAX_LIGHTS:\r
-         params[0] = (GLfloat)(ctx->Const.MaxLights);\r
-         break;\r
-      case GL_MAX_LIST_NESTING:\r
-         params[0] = (GLfloat)(MAX_LIST_NESTING);\r
-         break;\r
-      case GL_MAX_MODELVIEW_STACK_DEPTH:\r
-         params[0] = (GLfloat)(MAX_MODELVIEW_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_NAME_STACK_DEPTH:\r
-         params[0] = (GLfloat)(MAX_NAME_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_PIXEL_MAP_TABLE:\r
-         params[0] = (GLfloat)(MAX_PIXEL_MAP_TABLE);\r
-         break;\r
-      case GL_MAX_PROJECTION_STACK_DEPTH:\r
-         params[0] = (GLfloat)(MAX_PROJECTION_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_TEXTURE_SIZE:\r
-         params[0] = (GLfloat)(1 << (ctx->Const.MaxTextureLevels - 1));\r
-         break;\r
-      case GL_MAX_3D_TEXTURE_SIZE:\r
-         params[0] = (GLfloat)(1 << (ctx->Const.Max3DTextureLevels - 1));\r
-         break;\r
-      case GL_MAX_TEXTURE_STACK_DEPTH:\r
-         params[0] = (GLfloat)(MAX_TEXTURE_STACK_DEPTH);\r
-         break;\r
-      case GL_MAX_VIEWPORT_DIMS:\r
-         params[0] = (GLfloat)(ctx->Const.MaxViewportWidth);\r
-         params[1] = (GLfloat)(ctx->Const.MaxViewportHeight);\r
-         break;\r
-      case GL_MODELVIEW_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[1];\r
-         params[2] = matrix[2];\r
-         params[3] = matrix[3];\r
-         params[4] = matrix[4];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[6];\r
-         params[7] = matrix[7];\r
-         params[8] = matrix[8];\r
-         params[9] = matrix[9];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[11];\r
-         params[12] = matrix[12];\r
-         params[13] = matrix[13];\r
-         params[14] = matrix[14];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_MODELVIEW_STACK_DEPTH:\r
-         params[0] = (GLfloat)(ctx->ModelviewMatrixStack.Depth + 1);\r
-         break;\r
-      case GL_NAME_STACK_DEPTH:\r
-         params[0] = (GLfloat)(ctx->Select.NameStackDepth);\r
-         break;\r
-      case GL_NORMALIZE:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.Normalize);\r
-         break;\r
-      case GL_PACK_ALIGNMENT:\r
-         params[0] = (GLfloat)(ctx->Pack.Alignment);\r
-         break;\r
-      case GL_PACK_LSB_FIRST:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.LsbFirst);\r
-         break;\r
-      case GL_PACK_ROW_LENGTH:\r
-         params[0] = (GLfloat)(ctx->Pack.RowLength);\r
-         break;\r
-      case GL_PACK_SKIP_PIXELS:\r
-         params[0] = (GLfloat)(ctx->Pack.SkipPixels);\r
-         break;\r
-      case GL_PACK_SKIP_ROWS:\r
-         params[0] = (GLfloat)(ctx->Pack.SkipRows);\r
-         break;\r
-      case GL_PACK_SWAP_BYTES:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.SwapBytes);\r
-         break;\r
-      case GL_PACK_SKIP_IMAGES_EXT:\r
-         params[0] = (GLfloat)(ctx->Pack.SkipImages);\r
-         break;\r
-      case GL_PACK_IMAGE_HEIGHT_EXT:\r
-         params[0] = (GLfloat)(ctx->Pack.ImageHeight);\r
-         break;\r
-      case GL_PACK_INVERT_MESA:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.Invert);\r
-         break;\r
-      case GL_PERSPECTIVE_CORRECTION_HINT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);\r
-         break;\r
-      case GL_PIXEL_MAP_A_TO_A_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapAtoAsize);\r
-         break;\r
-      case GL_PIXEL_MAP_B_TO_B_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapBtoBsize);\r
-         break;\r
-      case GL_PIXEL_MAP_G_TO_G_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapGtoGsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_A_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapItoAsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_B_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapItoBsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_G_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapItoGsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_I_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapItoIsize);\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_R_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapItoRsize);\r
-         break;\r
-      case GL_PIXEL_MAP_R_TO_R_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapRtoRsize);\r
-         break;\r
-      case GL_PIXEL_MAP_S_TO_S_SIZE:\r
-         params[0] = (GLfloat)(ctx->Pixel.MapStoSsize);\r
-         break;\r
-      case GL_POINT_SIZE:\r
-         params[0] = ctx->Point.Size;\r
-         break;\r
-      case GL_POINT_SIZE_GRANULARITY:\r
-         params[0] = ctx->Const.PointSizeGranularity;\r
-         break;\r
-      case GL_POINT_SIZE_RANGE:\r
-         params[0] = ctx->Const.MinPointSizeAA;\r
-         params[1] = ctx->Const.MaxPointSizeAA;\r
-         break;\r
-      case GL_ALIASED_POINT_SIZE_RANGE:\r
-         params[0] = ctx->Const.MinPointSize;\r
-         params[1] = ctx->Const.MaxPointSize;\r
-         break;\r
-      case GL_POINT_SMOOTH:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Point.SmoothFlag);\r
-         break;\r
-      case GL_POINT_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Hint.PointSmooth);\r
-         break;\r
-      case GL_POINT_SIZE_MIN_EXT:\r
-         params[0] = ctx->Point.MinSize;\r
-         break;\r
-      case GL_POINT_SIZE_MAX_EXT:\r
-         params[0] = ctx->Point.MaxSize;\r
-         break;\r
-      case GL_POINT_FADE_THRESHOLD_SIZE_EXT:\r
-         params[0] = ctx->Point.Threshold;\r
-         break;\r
-      case GL_DISTANCE_ATTENUATION_EXT:\r
-         params[0] = ctx->Point.Params[0];\r
-         params[1] = ctx->Point.Params[1];\r
-         params[2] = ctx->Point.Params[2];\r
-         break;\r
-      case GL_POLYGON_MODE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode);\r
-         params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode);\r
-         break;\r
-      case GL_POLYGON_OFFSET_BIAS_EXT:\r
-         params[0] = ctx->Polygon.OffsetUnits;\r
-         break;\r
-      case GL_POLYGON_OFFSET_FACTOR:\r
-         params[0] = ctx->Polygon.OffsetFactor ;\r
-         break;\r
-      case GL_POLYGON_OFFSET_UNITS:\r
-         params[0] = ctx->Polygon.OffsetUnits ;\r
-         break;\r
-      case GL_POLYGON_SMOOTH:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.SmoothFlag);\r
-         break;\r
-      case GL_POLYGON_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth);\r
-         break;\r
-      case GL_POLYGON_STIPPLE:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.StippleFlag);\r
-         break;\r
-      case GL_PROJECTION_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[1];\r
-         params[2] = matrix[2];\r
-         params[3] = matrix[3];\r
-         params[4] = matrix[4];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[6];\r
-         params[7] = matrix[7];\r
-         params[8] = matrix[8];\r
-         params[9] = matrix[9];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[11];\r
-         params[12] = matrix[12];\r
-         params[13] = matrix[13];\r
-         params[14] = matrix[14];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_PROJECTION_STACK_DEPTH:\r
-         params[0] = (GLfloat)(ctx->ProjectionMatrixStack.Depth + 1);\r
-         break;\r
-      case GL_READ_BUFFER:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Pixel.ReadBuffer);\r
-         break;\r
-      case GL_RED_BIAS:\r
-         params[0] = ctx->Pixel.RedBias;\r
-         break;\r
-      case GL_RED_BITS:\r
-         params[0] = (GLfloat)( ctx->Visual.redBits );\r
-         break;\r
-      case GL_RED_SCALE:\r
-         params[0] = ctx->Pixel.RedScale;\r
-         break;\r
-      case GL_RENDER_MODE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->RenderMode);\r
-         break;\r
-      case GL_RESCALE_NORMAL:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RescaleNormals);\r
-         break;\r
-      case GL_RGBA_MODE:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Visual.rgbMode);\r
-         break;\r
-      case GL_SCISSOR_BOX:\r
-         params[0] = (GLfloat)(ctx->Scissor.X);\r
-         params[1] = (GLfloat)(ctx->Scissor.Y);\r
-         params[2] = (GLfloat)(ctx->Scissor.Width);\r
-         params[3] = (GLfloat)(ctx->Scissor.Height);\r
-         break;\r
-      case GL_SCISSOR_TEST:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Scissor.Enabled);\r
-         break;\r
-      case GL_SELECTION_BUFFER_SIZE:\r
-         params[0] = (GLfloat)(ctx->Select.BufferSize);\r
-         break;\r
-      case GL_SHADE_MODEL:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Light.ShadeModel);\r
-         break;\r
-      case GL_SHARED_TEXTURE_PALETTE_EXT:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.SharedPalette);\r
-         break;\r
-      case GL_STENCIL_BITS:\r
-         params[0] = (GLfloat)(ctx->Visual.stencilBits);\r
-         break;\r
-      case GL_STENCIL_CLEAR_VALUE:\r
-         params[0] = (GLfloat)(ctx->Stencil.Clear);\r
-         break;\r
-      case GL_STENCIL_FAIL:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_FUNC:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_PASS_DEPTH_FAIL:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_PASS_DEPTH_PASS:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_REF:\r
-         params[0] = (GLfloat)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_TEST:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.Enabled);\r
-         break;\r
-      case GL_STENCIL_VALUE_MASK:\r
-         params[0] = (GLfloat)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_WRITEMASK:\r
-         params[0] = (GLfloat)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STEREO:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Visual.stereoMode);\r
-         break;\r
-      case GL_SUBPIXEL_BITS:\r
-         params[0] = (GLfloat)(ctx->Const.SubPixelBits);\r
-         break;\r
-      case GL_TEXTURE_1D:\r
-         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D));\r
-         break;\r
-      case GL_TEXTURE_2D:\r
-         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D));\r
-         break;\r
-      case GL_TEXTURE_3D:\r
-         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D));\r
-         break;\r
-      case GL_TEXTURE_BINDING_1D:\r
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name);\r
-         break;\r
-      case GL_TEXTURE_BINDING_2D:\r
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name);\r
-         break;\r
-      case GL_TEXTURE_BINDING_3D:\r
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name);\r
-         break;\r
-      case GL_TEXTURE_ENV_COLOR:\r
-         {\r
-         const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;\r
-         params[0] = color[0];\r
-         params[1] = color[1];\r
-         params[2] = color[2];\r
-         params[3] = color[3];\r
-         }\r
-         break;\r
-      case GL_TEXTURE_ENV_MODE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);\r
-         break;\r
-      case GL_TEXTURE_GEN_S:\r
-         params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));\r
-         break;\r
-      case GL_TEXTURE_GEN_T:\r
-         params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0));\r
-         break;\r
-      case GL_TEXTURE_GEN_R:\r
-         params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0));\r
-         break;\r
-      case GL_TEXTURE_GEN_Q:\r
-         params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0));\r
-         break;\r
-      case GL_TEXTURE_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[1];\r
-         params[2] = matrix[2];\r
-         params[3] = matrix[3];\r
-         params[4] = matrix[4];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[6];\r
-         params[7] = matrix[7];\r
-         params[8] = matrix[8];\r
-         params[9] = matrix[9];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[11];\r
-         params[12] = matrix[12];\r
-         params[13] = matrix[13];\r
-         params[14] = matrix[14];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_TEXTURE_STACK_DEPTH:\r
-         params[0] = (GLfloat)(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1);\r
-         break;\r
-      case GL_UNPACK_ALIGNMENT:\r
-         params[0] = (GLfloat)(ctx->Unpack.Alignment);\r
-         break;\r
-      case GL_UNPACK_LSB_FIRST:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.LsbFirst);\r
-         break;\r
-      case GL_UNPACK_ROW_LENGTH:\r
-         params[0] = (GLfloat)(ctx->Unpack.RowLength);\r
-         break;\r
-      case GL_UNPACK_SKIP_PIXELS:\r
-         params[0] = (GLfloat)(ctx->Unpack.SkipPixels);\r
-         break;\r
-      case GL_UNPACK_SKIP_ROWS:\r
-         params[0] = (GLfloat)(ctx->Unpack.SkipRows);\r
-         break;\r
-      case GL_UNPACK_SWAP_BYTES:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.SwapBytes);\r
-         break;\r
-      case GL_UNPACK_SKIP_IMAGES_EXT:\r
-         params[0] = (GLfloat)(ctx->Unpack.SkipImages);\r
-         break;\r
-      case GL_UNPACK_IMAGE_HEIGHT_EXT:\r
-         params[0] = (GLfloat)(ctx->Unpack.ImageHeight);\r
-         break;\r
-      case GL_UNPACK_CLIENT_STORAGE_APPLE:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.ClientStorage);\r
-         break;\r
-      case GL_VIEWPORT:\r
-         params[0] = (GLfloat)(ctx->Viewport.X);\r
-         params[1] = (GLfloat)(ctx->Viewport.Y);\r
-         params[2] = (GLfloat)(ctx->Viewport.Width);\r
-         params[3] = (GLfloat)(ctx->Viewport.Height);\r
-         break;\r
-      case GL_ZOOM_X:\r
-         params[0] = ctx->Pixel.ZoomX;\r
-         break;\r
-      case GL_ZOOM_Y:\r
-         params[0] = ctx->Pixel.ZoomY;\r
-         break;\r
-      case GL_VERTEX_ARRAY:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Vertex.Enabled);\r
-         break;\r
-      case GL_VERTEX_ARRAY_SIZE:\r
-         params[0] = (GLfloat)(ctx->Array.Vertex.Size);\r
-         break;\r
-      case GL_VERTEX_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Array.Vertex.Type);\r
-         break;\r
-      case GL_VERTEX_ARRAY_STRIDE:\r
-         params[0] = (GLfloat)(ctx->Array.Vertex.Stride);\r
-         break;\r
-      case GL_VERTEX_ARRAY_COUNT_EXT:\r
-         params[0] = (GLfloat)(0);\r
-         break;\r
-      case GL_NORMAL_ARRAY:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Array.Normal.Enabled);\r
-         break;\r
-      case GL_NORMAL_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Array.Normal.Type);\r
-         break;\r
-      case GL_NORMAL_ARRAY_STRIDE:\r
-         params[0] = (GLfloat)(ctx->Array.Normal.Stride);\r
-         break;\r
-      case GL_NORMAL_ARRAY_COUNT_EXT:\r
-         params[0] = (GLfloat)(0);\r
-         break;\r
-      case GL_COLOR_ARRAY:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Color.Enabled);\r
-         break;\r
-      case GL_COLOR_ARRAY_SIZE:\r
-         params[0] = (GLfloat)(ctx->Array.Color.Size);\r
-         break;\r
-      case GL_COLOR_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Array.Color.Type);\r
-         break;\r
-      case GL_COLOR_ARRAY_STRIDE:\r
-         params[0] = (GLfloat)(ctx->Array.Color.Stride);\r
-         break;\r
-      case GL_COLOR_ARRAY_COUNT_EXT:\r
-         params[0] = (GLfloat)(0);\r
-         break;\r
-      case GL_INDEX_ARRAY:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Index.Enabled);\r
-         break;\r
-      case GL_INDEX_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Array.Index.Type);\r
-         break;\r
-      case GL_INDEX_ARRAY_STRIDE:\r
-         params[0] = (GLfloat)(ctx->Array.Index.Stride);\r
-         break;\r
-      case GL_INDEX_ARRAY_COUNT_EXT:\r
-         params[0] = (GLfloat)(0);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_SIZE:\r
-         params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_STRIDE:\r
-         params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:\r
-         params[0] = (GLfloat)(0);\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY:\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.EdgeFlag.Enabled);\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_STRIDE:\r
-         params[0] = (GLfloat)(ctx->Array.EdgeFlag.Stride);\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_COUNT_EXT:\r
-         params[0] = (GLfloat)(0);\r
-         break;\r
-      case GL_MAX_TEXTURE_UNITS_ARB:\r
-         CHECK_EXTENSION_F(ARB_multitexture, pname);\r
-         params[0] = (GLfloat)(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));\r
-         break;\r
-      case GL_ACTIVE_TEXTURE_ARB:\r
-         CHECK_EXTENSION_F(ARB_multitexture, pname);\r
-         params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit);\r
-         break;\r
-      case GL_CLIENT_ACTIVE_TEXTURE_ARB:\r
-         CHECK_EXTENSION_F(ARB_multitexture, pname);\r
-         params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);\r
-         break;\r
-      case GL_TEXTURE_CUBE_MAP_ARB:\r
-         CHECK_EXTENSION_F(ARB_texture_cube_map, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB));\r
-         break;\r
-      case GL_TEXTURE_BINDING_CUBE_MAP_ARB:\r
-         CHECK_EXTENSION_F(ARB_texture_cube_map, pname);\r
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name);\r
-         break;\r
-      case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:\r
-         CHECK_EXTENSION_F(ARB_texture_cube_map, pname);\r
-         params[0] = (GLfloat)((1 << (ctx->Const.MaxCubeTextureLevels - 1)));\r
-         break;\r
-      case GL_TEXTURE_COMPRESSION_HINT_ARB:\r
-         CHECK_EXTENSION_F(ARB_texture_compression, pname);\r
-         params[0] = (GLfloat)(ctx->Hint.TextureCompression);\r
-         break;\r
-      case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:\r
-         CHECK_EXTENSION_F(ARB_texture_compression, pname);\r
-         params[0] = (GLfloat)(_mesa_get_compressed_formats(ctx, NULL));\r
-         break;\r
-      case GL_COMPRESSED_TEXTURE_FORMATS_ARB:\r
-         CHECK_EXTENSION_F(ARB_texture_compression, pname);\r
-         {\r
-         GLint formats[100];\r
-         GLuint i, n = _mesa_get_compressed_formats(ctx, formats);\r
-         for (i = 0; i < n; i++)\r
-            params[i] = ENUM_TO_BOOLEAN(formats[i]);\r
-         }\r
-         break;\r
-      case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:\r
-         CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname);\r
-         params[0] = (GLfloat)(ctx->Array.LockFirst);\r
-         break;\r
-      case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:\r
-         CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname);\r
-         params[0] = (GLfloat)(ctx->Array.LockCount);\r
-         break;\r
-      case GL_TRANSPOSE_COLOR_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[4];\r
-         params[2] = matrix[8];\r
-         params[3] = matrix[12];\r
-         params[4] = matrix[1];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[9];\r
-         params[7] = matrix[13];\r
-         params[8] = matrix[2];\r
-         params[9] = matrix[6];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[14];\r
-         params[12] = matrix[3];\r
-         params[13] = matrix[7];\r
-         params[14] = matrix[11];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[4];\r
-         params[2] = matrix[8];\r
-         params[3] = matrix[12];\r
-         params[4] = matrix[1];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[9];\r
-         params[7] = matrix[13];\r
-         params[8] = matrix[2];\r
-         params[9] = matrix[6];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[14];\r
-         params[12] = matrix[3];\r
-         params[13] = matrix[7];\r
-         params[14] = matrix[11];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[4];\r
-         params[2] = matrix[8];\r
-         params[3] = matrix[12];\r
-         params[4] = matrix[1];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[9];\r
-         params[7] = matrix[13];\r
-         params[8] = matrix[2];\r
-         params[9] = matrix[6];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[14];\r
-         params[12] = matrix[3];\r
-         params[13] = matrix[7];\r
-         params[14] = matrix[11];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[4];\r
-         params[2] = matrix[8];\r
-         params[3] = matrix[12];\r
-         params[4] = matrix[1];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[9];\r
-         params[7] = matrix[13];\r
-         params[8] = matrix[2];\r
-         params[9] = matrix[6];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[14];\r
-         params[12] = matrix[3];\r
-         params[13] = matrix[7];\r
-         params[14] = matrix[11];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_OCCLUSION_TEST_HP:\r
-         CHECK_EXTENSION_F(HP_occlusion_test, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.OcclusionTest);\r
-         break;\r
-      case GL_OCCLUSION_TEST_RESULT_HP:\r
-         CHECK_EXTENSION_F(HP_occlusion_test, pname);\r
-         {\r
-         if (ctx->Depth.OcclusionTest)\r
-            params[0] = ctx->OcclusionResult;\r
-         else\r
-            params[0] = ctx->OcclusionResultSaved;\r
-         /* reset flag now */\r
-         ctx->OcclusionResult = GL_FALSE;\r
-         ctx->OcclusionResultSaved = GL_FALSE;\r
-         return;\r
-         }\r
-         break;\r
-      case GL_PIXEL_TEXTURE_SGIS:\r
-         CHECK_EXTENSION_F(SGIS_pixel_texture, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled);\r
-         break;\r
-      case GL_PIXEL_TEX_GEN_SGIX:\r
-         CHECK_EXTENSION_F(SGIX_pixel_texture, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled);\r
-         break;\r
-      case GL_PIXEL_TEX_GEN_MODE_SGIX:\r
-         CHECK_EXTENSION_F(SGIX_pixel_texture, pname);\r
-         params[0] = ENUM_TO_FLOAT(pixel_texgen_mode(ctx));\r
-         break;\r
-      case GL_COLOR_MATRIX_SGI:\r
-         {\r
-         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[1];\r
-         params[2] = matrix[2];\r
-         params[3] = matrix[3];\r
-         params[4] = matrix[4];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[6];\r
-         params[7] = matrix[7];\r
-         params[8] = matrix[8];\r
-         params[9] = matrix[9];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[11];\r
-         params[12] = matrix[12];\r
-         params[13] = matrix[13];\r
-         params[14] = matrix[14];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_COLOR_MATRIX_STACK_DEPTH_SGI:\r
-         params[0] = (GLfloat)(ctx->ColorMatrixStack.Depth + 1);\r
-         break;\r
-      case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:\r
-         params[0] = (GLfloat)(MAX_COLOR_STACK_DEPTH);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:\r
-         params[0] = ctx->Pixel.PostColorMatrixScale[0];\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:\r
-         params[0] = ctx->Pixel.PostColorMatrixScale[1];\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:\r
-         params[0] = ctx->Pixel.PostColorMatrixScale[2];\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:\r
-         params[0] = ctx->Pixel.PostColorMatrixScale[3];\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:\r
-         params[0] = ctx->Pixel.PostColorMatrixBias[0];\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:\r
-         params[0] = ctx->Pixel.PostColorMatrixBias[1];\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:\r
-         params[0] = ctx->Pixel.PostColorMatrixBias[2];\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:\r
-         params[0] = ctx->Pixel.PostColorMatrixBias[3];\r
-         break;\r
-      case GL_CONVOLUTION_1D_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution1DEnabled);\r
-         break;\r
-      case GL_CONVOLUTION_2D_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution2DEnabled);\r
-         break;\r
-      case GL_SEPARABLE_2D_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Separable2DEnabled);\r
-         break;\r
-      case GL_POST_CONVOLUTION_RED_SCALE_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionScale[0];\r
-         break;\r
-      case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionScale[1];\r
-         break;\r
-      case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionScale[2];\r
-         break;\r
-      case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionScale[3];\r
-         break;\r
-      case GL_POST_CONVOLUTION_RED_BIAS_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionBias[0];\r
-         break;\r
-      case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionBias[1];\r
-         break;\r
-      case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionBias[2];\r
-         break;\r
-      case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:\r
-         CHECK_EXTENSION_F(EXT_convolution, pname);\r
-         params[0] = ctx->Pixel.PostConvolutionBias[3];\r
-         break;\r
-      case GL_HISTOGRAM:\r
-         CHECK_EXTENSION_F(EXT_histogram, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.HistogramEnabled);\r
-         break;\r
-      case GL_MINMAX:\r
-         CHECK_EXTENSION_F(EXT_histogram, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MinMaxEnabled);\r
-         break;\r
-      case GL_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_F(SGI_color_table, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled);\r
-         break;\r
-      case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_F(SGI_color_table, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostConvolutionColorTableEnabled);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_F(SGI_color_table, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostColorMatrixColorTableEnabled);\r
-         break;\r
-      case GL_TEXTURE_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_F(SGI_texture_color_table, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled);\r
-         break;\r
-      case GL_COLOR_SUM_EXT:\r
-         CHECK_EXTENSION_F(EXT_secondary_color, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.ColorSumEnabled);\r
-         break;\r
-      case GL_CURRENT_SECONDARY_COLOR_EXT:\r
-         CHECK_EXTENSION_F(EXT_secondary_color, pname);\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0];\r
-         params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1];\r
-         params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2];\r
-         params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3];\r
-         }\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_EXT:\r
-         CHECK_EXTENSION_F(EXT_secondary_color, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.SecondaryColor.Enabled);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:\r
-         CHECK_EXTENSION_F(EXT_secondary_color, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Array.SecondaryColor.Type);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:\r
-         CHECK_EXTENSION_F(EXT_secondary_color, pname);\r
-         params[0] = (GLfloat)(ctx->Array.SecondaryColor.Stride);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:\r
-         CHECK_EXTENSION_F(EXT_secondary_color, pname);\r
-         params[0] = (GLfloat)(ctx->Array.SecondaryColor.Size);\r
-         break;\r
-      case GL_CURRENT_FOG_COORDINATE_EXT:\r
-         CHECK_EXTENSION_F(EXT_fog_coord, pname);\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];\r
-         }\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_EXT:\r
-         CHECK_EXTENSION_F(EXT_fog_coord, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.FogCoord.Enabled);\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:\r
-         CHECK_EXTENSION_F(EXT_fog_coord, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Array.FogCoord.Type);\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:\r
-         CHECK_EXTENSION_F(EXT_fog_coord, pname);\r
-         params[0] = (GLfloat)(ctx->Array.FogCoord.Stride);\r
-         break;\r
-      case GL_FOG_COORDINATE_SOURCE_EXT:\r
-         CHECK_EXTENSION_F(EXT_fog_coord, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Fog.FogCoordinateSource);\r
-         break;\r
-      case GL_MAX_TEXTURE_LOD_BIAS_EXT:\r
-         CHECK_EXTENSION_F(EXT_texture_lod_bias, pname);\r
-         params[0] = ctx->Const.MaxTextureLodBias;\r
-         break;\r
-      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:\r
-         CHECK_EXTENSION_F(EXT_texture_filter_anisotropic, pname);\r
-         params[0] = ctx->Const.MaxTextureMaxAnisotropy;\r
-         break;\r
-      case GL_MULTISAMPLE_ARB:\r
-         CHECK_EXTENSION_F(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.Enabled);\r
-         break;\r
-      case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:\r
-         CHECK_EXTENSION_F(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToCoverage);\r
-         break;\r
-      case GL_SAMPLE_ALPHA_TO_ONE_ARB:\r
-         CHECK_EXTENSION_F(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToOne);\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_ARB:\r
-         CHECK_EXTENSION_F(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverage);\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_VALUE_ARB:\r
-         CHECK_EXTENSION_F(ARB_multisample, pname);\r
-         params[0] = ctx->Multisample.SampleCoverageValue;\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_INVERT_ARB:\r
-         CHECK_EXTENSION_F(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverageInvert);\r
-         break;\r
-      case GL_SAMPLE_BUFFERS_ARB:\r
-         CHECK_EXTENSION_F(ARB_multisample, pname);\r
-         params[0] = (GLfloat)(0);\r
-         break;\r
-      case GL_SAMPLES_ARB:\r
-         CHECK_EXTENSION_F(ARB_multisample, pname);\r
-         params[0] = (GLfloat)(0);\r
-         break;\r
-      case GL_RASTER_POSITION_UNCLIPPED_IBM:\r
-         CHECK_EXTENSION_F(IBM_rasterpos_clip, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RasterPositionUnclipped);\r
-         break;\r
-      case GL_POINT_SPRITE_NV:\r
-         CHECK_EXTENSION_F(NV_point_sprite, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Point.PointSprite);\r
-         break;\r
-      case GL_POINT_SPRITE_R_MODE_NV:\r
-         CHECK_EXTENSION_F(NV_point_sprite, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteRMode);\r
-         break;\r
-      case GL_POINT_SPRITE_COORD_ORIGIN:\r
-         CHECK_EXTENSION_F(NV_point_sprite, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteOrigin);\r
-         break;\r
-      case GL_GENERATE_MIPMAP_HINT_SGIS:\r
-         CHECK_EXTENSION_F(SGIS_generate_mipmap, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Hint.GenerateMipmap);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.Enabled);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_POINT_SIZE_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.PointSizeEnabled);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_TWO_SIDE_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.TwoSideEnabled);\r
-         break;\r
-      case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxProgramMatrixStackDepth);\r
-         break;\r
-      case GL_MAX_TRACK_MATRICES_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxProgramMatrices);\r
-         break;\r
-      case GL_CURRENT_MATRIX_STACK_DEPTH_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->CurrentStack->Depth + 1);\r
-         break;\r
-      case GL_CURRENT_MATRIX_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         {\r
-         const GLfloat *matrix = ctx->CurrentStack->Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[1];\r
-         params[2] = matrix[2];\r
-         params[3] = matrix[3];\r
-         params[4] = matrix[4];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[6];\r
-         params[7] = matrix[7];\r
-         params[8] = matrix[8];\r
-         params[9] = matrix[9];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[11];\r
-         params[12] = matrix[12];\r
-         params[13] = matrix[13];\r
-         params[14] = matrix[14];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_VERTEX_PROGRAM_BINDING_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = (GLfloat)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0));\r
-         break;\r
-      case GL_PROGRAM_ERROR_POSITION_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = (GLfloat)(ctx->Program.ErrorPos);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY0_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[0].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY1_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[1].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY2_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[2].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY3_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[3].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[4].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY5_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[5].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY6_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[6].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY7_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[7].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY8_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[8].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY9_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[9].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY10_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[10].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY11_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[11].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY12_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[12].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY13_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[13].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY14_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[14].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY15_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[15].Enabled);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB0_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[0]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB1_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[1]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB2_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[2]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB3_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[3]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB4_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[4]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB5_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[5]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB6_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[6]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB7_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[7]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB8_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[8]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB9_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[9]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB10_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[10]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB11_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[11]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB12_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[12]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB13_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[13]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB14_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[14]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB15_4_NV:\r
-         CHECK_EXTENSION_F(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[15]);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_NV:\r
-         CHECK_EXTENSION_F(NV_fragment_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled);\r
-         break;\r
-      case GL_MAX_TEXTURE_COORDS_NV:\r
-         CHECK_EXTENSION_F(NV_fragment_program, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxTextureCoordUnits);\r
-         break;\r
-      case GL_MAX_TEXTURE_IMAGE_UNITS_NV:\r
-         CHECK_EXTENSION_F(NV_fragment_program, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxTextureImageUnits);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_BINDING_NV:\r
-         CHECK_EXTENSION_F(NV_fragment_program, pname);\r
-         params[0] = (GLfloat)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0);\r
-         break;\r
-      case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:\r
-         CHECK_EXTENSION_F(NV_fragment_program, pname);\r
-         params[0] = (GLfloat)(MAX_NV_FRAGMENT_PROGRAM_PARAMS);\r
-         break;\r
-      case GL_TEXTURE_RECTANGLE_NV:\r
-         CHECK_EXTENSION_F(NV_texture_rectangle, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV));\r
-         break;\r
-      case GL_TEXTURE_BINDING_RECTANGLE_NV:\r
-         CHECK_EXTENSION_F(NV_texture_rectangle, pname);\r
-         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name);\r
-         break;\r
-      case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:\r
-         CHECK_EXTENSION_F(NV_texture_rectangle, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxTextureRectSize);\r
-         break;\r
-      case GL_STENCIL_TEST_TWO_SIDE_EXT:\r
-         CHECK_EXTENSION_F(EXT_stencil_two_side, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.TestTwoSide);\r
-         break;\r
-      case GL_ACTIVE_STENCIL_FACE_EXT:\r
-         CHECK_EXTENSION_F(EXT_stencil_two_side, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);\r
-         break;\r
-      case GL_MAX_SHININESS_NV:\r
-         CHECK_EXTENSION_F(NV_light_max_exponent, pname);\r
-         params[0] = ctx->Const.MaxShininess;\r
-         break;\r
-      case GL_MAX_SPOT_EXPONENT_NV:\r
-         CHECK_EXTENSION_F(NV_light_max_exponent, pname);\r
-         params[0] = ctx->Const.MaxSpotExponent;\r
-         break;\r
-      case GL_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.ArrayBufferObj->Name);\r
-         break;\r
-      case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.Vertex.BufferObj->Name);\r
-         break;\r
-      case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.Normal.BufferObj->Name);\r
-         break;\r
-      case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.Color.BufferObj->Name);\r
-         break;\r
-      case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.Index.BufferObj->Name);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name);\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.EdgeFlag.BufferObj->Name);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.SecondaryColor.BufferObj->Name);\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.FogCoord.BufferObj->Name);\r
-         break;\r
-      case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Array.ElementArrayBufferObj->Name);\r
-         break;\r
-      case GL_PIXEL_PACK_BUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Pack.BufferObj->Name);\r
-         break;\r
-      case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Unpack.BufferObj->Name);\r
-         break;\r
-      case GL_MAX_VERTEX_ATTRIBS_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_program, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxVertexProgramAttribs);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_ARB:\r
-         CHECK_EXTENSION_F(ARB_fragment_program, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled);\r
-         break;\r
-      case GL_TRANSPOSE_CURRENT_MATRIX_ARB:\r
-         CHECK_EXTENSION_F(ARB_fragment_program, pname);\r
-         {\r
-         const GLfloat *matrix = ctx->CurrentStack->Top->m;\r
-         params[0] = matrix[0];\r
-         params[1] = matrix[4];\r
-         params[2] = matrix[8];\r
-         params[3] = matrix[12];\r
-         params[4] = matrix[1];\r
-         params[5] = matrix[5];\r
-         params[6] = matrix[9];\r
-         params[7] = matrix[13];\r
-         params[8] = matrix[2];\r
-         params[9] = matrix[6];\r
-         params[10] = matrix[10];\r
-         params[11] = matrix[14];\r
-         params[12] = matrix[3];\r
-         params[13] = matrix[7];\r
-         params[14] = matrix[11];\r
-         params[15] = matrix[15];\r
-         }\r
-         break;\r
-      case GL_DEPTH_BOUNDS_TEST_EXT:\r
-         CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.BoundsTest);\r
-         break;\r
-      case GL_DEPTH_BOUNDS_EXT:\r
-         CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);\r
-         params[0] = ctx->Depth.BoundsMin;\r
-         params[1] = ctx->Depth.BoundsMax;\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:\r
-         CHECK_EXTENSION_F(MESA_program_debug, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.CallbackEnabled);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_CALLBACK_MESA:\r
-         CHECK_EXTENSION_F(MESA_program_debug, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.CallbackEnabled);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_POSITION_MESA:\r
-         CHECK_EXTENSION_F(MESA_program_debug, pname);\r
-         params[0] = (GLfloat)(ctx->FragmentProgram.CurrentPosition);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_POSITION_MESA:\r
-         CHECK_EXTENSION_F(MESA_program_debug, pname);\r
-         params[0] = (GLfloat)(ctx->VertexProgram.CurrentPosition);\r
-         break;\r
-      case GL_MAX_DRAW_BUFFERS_ARB:\r
-         CHECK_EXTENSION_F(ARB_draw_buffers, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers);\r
-         break;\r
-      case GL_DRAW_BUFFER0_ARB:\r
-         CHECK_EXTENSION_F(ARB_draw_buffers, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]);\r
-         break;\r
-      case GL_DRAW_BUFFER1_ARB:\r
-         CHECK_EXTENSION_F(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[1];\r
-         params[0] = ENUM_TO_FLOAT(buffer);\r
-         }\r
-         break;\r
-      case GL_DRAW_BUFFER2_ARB:\r
-         CHECK_EXTENSION_F(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[2];\r
-         params[0] = ENUM_TO_FLOAT(buffer);\r
-         }\r
-         break;\r
-      case GL_DRAW_BUFFER3_ARB:\r
-         CHECK_EXTENSION_F(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[3];\r
-         params[0] = ENUM_TO_FLOAT(buffer);\r
-         }\r
-         break;\r
-      case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:\r
-         CHECK_EXTENSION_F(OES_read_format, pname);\r
-         params[0] = (GLfloat)(ctx->Const.ColorReadType);\r
-         break;\r
-      case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:\r
-         CHECK_EXTENSION_F(OES_read_format, pname);\r
-         params[0] = (GLfloat)(ctx->Const.ColorReadFormat);\r
-         break;\r
-      case GL_NUM_FRAGMENT_REGISTERS_ATI:\r
-         CHECK_EXTENSION_F(ATI_fragment_shader, pname);\r
-         params[0] = (GLfloat)(6);\r
-         break;\r
-      case GL_NUM_FRAGMENT_CONSTANTS_ATI:\r
-         CHECK_EXTENSION_F(ATI_fragment_shader, pname);\r
-         params[0] = (GLfloat)(8);\r
-         break;\r
-      case GL_NUM_PASSES_ATI:\r
-         CHECK_EXTENSION_F(ATI_fragment_shader, pname);\r
-         params[0] = (GLfloat)(2);\r
-         break;\r
-      case GL_NUM_INSTRUCTIONS_PER_PASS_ATI:\r
-         CHECK_EXTENSION_F(ATI_fragment_shader, pname);\r
-         params[0] = (GLfloat)(8);\r
-         break;\r
-      case GL_NUM_INSTRUCTIONS_TOTAL_ATI:\r
-         CHECK_EXTENSION_F(ATI_fragment_shader, pname);\r
-         params[0] = (GLfloat)(16);\r
-         break;\r
-      case GL_COLOR_ALPHA_PAIRING_ATI:\r
-         CHECK_EXTENSION_F(ATI_fragment_shader, pname);\r
-         params[0] = BOOLEAN_TO_FLOAT(GL_TRUE);\r
-         break;\r
-      case GL_NUM_LOOPBACK_COMPONENTS_ATI:\r
-         CHECK_EXTENSION_F(ATI_fragment_shader, pname);\r
-         params[0] = (GLfloat)(3);\r
-         break;\r
-      case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI:\r
-         CHECK_EXTENSION_F(ATI_fragment_shader, pname);\r
-         params[0] = (GLfloat)(3);\r
-         break;\r
-      case GL_STENCIL_BACK_FUNC:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_VALUE_MASK:\r
-         params[0] = (GLfloat)(ctx->Stencil.ValueMask[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_REF:\r
-         params[0] = (GLfloat)(ctx->Stencil.Ref[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_FAIL:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_PASS_DEPTH_PASS:\r
-         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[1]);\r
-         break;\r
-      case GL_FRAMEBUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_F(EXT_framebuffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->CurrentFramebuffer ? ctx->CurrentFramebuffer->Name : 0);\r
-         break;\r
-      case GL_RENDERBUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_F(EXT_framebuffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0);\r
-         break;\r
-      case GL_MAX_COLOR_ATTACHMENTS_EXT:\r
-         CHECK_EXTENSION_F(EXT_framebuffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxColorAttachments);\r
-         break;\r
-      case GL_MAX_RENDERBUFFER_SIZE_EXT:\r
-         CHECK_EXTENSION_F(EXT_framebuffer_object, pname);\r
-         params[0] = (GLfloat)(ctx->Const.MaxRenderbufferSize);\r
-         break;\r
-      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:\r
-         CHECK_EXTENSION_F(ARB_fragment_shader, pname);\r
-         params[0] = (GLfloat)(MAX_FRAGMENT_UNIFORM_COMPONENTS);\r
-         break;\r
-      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:\r
-         CHECK_EXTENSION_F(ARB_fragment_shader, pname);\r
-         params[0] = ENUM_TO_FLOAT(ctx->Hint.FragmentShaderDerivative);\r
-         break;\r
-      case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_shader, pname);\r
-         params[0] = (GLfloat)(MAX_VERTEX_UNIFORM_COMPONENTS);\r
-         break;\r
-      case GL_MAX_VARYING_FLOATS_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_shader, pname);\r
-         params[0] = (GLfloat)(MAX_VARYING_FLOATS);\r
-         break;\r
-      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_shader, pname);\r
-         params[0] = (GLfloat)(MAX_VERTEX_TEXTURE_IMAGE_UNITS);\r
-         break;\r
-      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:\r
-         CHECK_EXTENSION_F(ARB_vertex_shader, pname);\r
-         params[0] = (GLfloat)(MAX_COMBINED_TEXTURE_IMAGE_UNITS);\r
-         break;\r
-      default:\r
-         _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname);\r
-   }\r
-}\r
-\r
-void GLAPIENTRY\r
-_mesa_GetIntegerv( GLenum pname, GLint *params )\r
-{\r
-   GET_CURRENT_CONTEXT(ctx);\r
-   ASSERT_OUTSIDE_BEGIN_END(ctx);\r
-\r
-   if (!params)\r
-      return;\r
-\r
-   if (ctx->Driver.GetIntegerv &&\r
-       ctx->Driver.GetIntegerv(ctx, pname, params))\r
-      return;\r
-\r
-   switch (pname) {\r
-      case GL_ACCUM_RED_BITS:\r
-         params[0] = ctx->Visual.accumRedBits;\r
-         break;\r
-      case GL_ACCUM_GREEN_BITS:\r
-         params[0] = ctx->Visual.accumGreenBits;\r
-         break;\r
-      case GL_ACCUM_BLUE_BITS:\r
-         params[0] = ctx->Visual.accumBlueBits;\r
-         break;\r
-      case GL_ACCUM_ALPHA_BITS:\r
-         params[0] = ctx->Visual.accumAlphaBits;\r
-         break;\r
-      case GL_ACCUM_CLEAR_VALUE:\r
-         params[0] = FLOAT_TO_INT(ctx->Accum.ClearColor[0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Accum.ClearColor[1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Accum.ClearColor[2]);\r
-         params[3] = FLOAT_TO_INT(ctx->Accum.ClearColor[3]);\r
-         break;\r
-      case GL_ALPHA_BIAS:\r
-         params[0] = IROUND(ctx->Pixel.AlphaBias);\r
-         break;\r
-      case GL_ALPHA_BITS:\r
-         params[0] = ctx->Visual.alphaBits;\r
-         break;\r
-      case GL_ALPHA_SCALE:\r
-         params[0] = IROUND(ctx->Pixel.AlphaScale);\r
-         break;\r
-      case GL_ALPHA_TEST:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Color.AlphaEnabled);\r
-         break;\r
-      case GL_ALPHA_TEST_FUNC:\r
-         params[0] = ENUM_TO_INT(ctx->Color.AlphaFunc);\r
-         break;\r
-      case GL_ALPHA_TEST_REF:\r
-         params[0] = FLOAT_TO_INT(ctx->Color.AlphaRef);\r
-         break;\r
-      case GL_ATTRIB_STACK_DEPTH:\r
-         params[0] = ctx->AttribStackDepth;\r
-         break;\r
-      case GL_AUTO_NORMAL:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.AutoNormal);\r
-         break;\r
-      case GL_AUX_BUFFERS:\r
-         params[0] = ctx->Visual.numAuxBuffers;\r
-         break;\r
-      case GL_BLEND:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Color.BlendEnabled);\r
-         break;\r
-      case GL_BLEND_DST:\r
-         params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB);\r
-         break;\r
-      case GL_BLEND_SRC:\r
-         params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB);\r
-         break;\r
-      case GL_BLEND_SRC_RGB_EXT:\r
-         params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB);\r
-         break;\r
-      case GL_BLEND_DST_RGB_EXT:\r
-         params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB);\r
-         break;\r
-      case GL_BLEND_SRC_ALPHA_EXT:\r
-         params[0] = ENUM_TO_INT(ctx->Color.BlendSrcA);\r
-         break;\r
-      case GL_BLEND_DST_ALPHA_EXT:\r
-         params[0] = ENUM_TO_INT(ctx->Color.BlendDstA);\r
-         break;\r
-      case GL_BLEND_EQUATION:\r
-         params[0] = ENUM_TO_INT(ctx->Color.BlendEquationRGB );\r
-         break;\r
-      case GL_BLEND_EQUATION_ALPHA_EXT:\r
-         params[0] = ENUM_TO_INT(ctx->Color.BlendEquationA );\r
-         break;\r
-      case GL_BLEND_COLOR_EXT:\r
-         params[0] = FLOAT_TO_INT(ctx->Color.BlendColor[0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Color.BlendColor[1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Color.BlendColor[2]);\r
-         params[3] = FLOAT_TO_INT(ctx->Color.BlendColor[3]);\r
-         break;\r
-      case GL_BLUE_BIAS:\r
-         params[0] = IROUND(ctx->Pixel.BlueBias);\r
-         break;\r
-      case GL_BLUE_BITS:\r
-         params[0] = ctx->Visual.blueBits;\r
-         break;\r
-      case GL_BLUE_SCALE:\r
-         params[0] = IROUND(ctx->Pixel.BlueScale);\r
-         break;\r
-      case GL_CLIENT_ATTRIB_STACK_DEPTH:\r
-         params[0] = ctx->ClientAttribStackDepth;\r
-         break;\r
-      case GL_CLIP_PLANE0:\r
-         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 0) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE1:\r
-         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 1) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE2:\r
-         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 2) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE3:\r
-         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 3) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE4:\r
-         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 4) & 1);\r
-         break;\r
-      case GL_CLIP_PLANE5:\r
-         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 5) & 1);\r
-         break;\r
-      case GL_COLOR_CLEAR_VALUE:\r
-         params[0] = FLOAT_TO_INT(ctx->Color.ClearColor[0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Color.ClearColor[1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Color.ClearColor[2]);\r
-         params[3] = FLOAT_TO_INT(ctx->Color.ClearColor[3]);\r
-         break;\r
-      case GL_COLOR_MATERIAL:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.ColorMaterialEnabled);\r
-         break;\r
-      case GL_COLOR_MATERIAL_FACE:\r
-         params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialFace);\r
-         break;\r
-      case GL_COLOR_MATERIAL_PARAMETER:\r
-         params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialMode);\r
-         break;\r
-      case GL_COLOR_WRITEMASK:\r
-         params[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0;\r
-         params[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0;\r
-         params[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0;\r
-         params[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0;\r
-         break;\r
-      case GL_CULL_FACE:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Polygon.CullFlag);\r
-         break;\r
-      case GL_CULL_FACE_MODE:\r
-         params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode);\r
-         break;\r
-      case GL_CURRENT_COLOR:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);\r
-         params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);\r
-         }\r
-         break;\r
-      case GL_CURRENT_INDEX:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = IROUND(ctx->Current.Index);\r
-         }\r
-         break;\r
-      case GL_CURRENT_NORMAL:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);\r
-         }\r
-         break;\r
-      case GL_CURRENT_RASTER_COLOR:\r
-         params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Current.RasterColor[1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Current.RasterColor[2]);\r
-         params[3] = FLOAT_TO_INT(ctx->Current.RasterColor[3]);\r
-         break;\r
-      case GL_CURRENT_RASTER_DISTANCE:\r
-         params[0] = IROUND(ctx->Current.RasterDistance);\r
-         break;\r
-      case GL_CURRENT_RASTER_INDEX:\r
-         params[0] = IROUND(ctx->Current.RasterIndex);\r
-         break;\r
-      case GL_CURRENT_RASTER_POSITION:\r
-         params[0] = IROUND(ctx->Current.RasterPos[0]);\r
-         params[1] = IROUND(ctx->Current.RasterPos[1]);\r
-         params[2] = IROUND(ctx->Current.RasterPos[2]);\r
-         params[3] = IROUND(ctx->Current.RasterPos[3]);\r
-         break;\r
-      case GL_CURRENT_RASTER_TEXTURE_COORDS:\r
-         {\r
-         const GLuint texUnit = ctx->Texture.CurrentUnit;\r
-         params[0] = IROUND(ctx->Current.RasterTexCoords[texUnit][0]);\r
-         params[1] = IROUND(ctx->Current.RasterTexCoords[texUnit][1]);\r
-         params[2] = IROUND(ctx->Current.RasterTexCoords[texUnit][2]);\r
-         params[3] = IROUND(ctx->Current.RasterTexCoords[texUnit][3]);\r
-         }\r
-         break;\r
-      case GL_CURRENT_RASTER_POSITION_VALID:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Current.RasterPosValid);\r
-         break;\r
-      case GL_CURRENT_TEXTURE_COORDS:\r
-         {\r
-         const GLuint texUnit = ctx->Texture.CurrentUnit;\r
-         params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]);\r
-         params[1] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]);\r
-         params[2] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]);\r
-         params[3] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]);\r
-         }\r
-         break;\r
-      case GL_DEPTH_BIAS:\r
-         params[0] = IROUND(ctx->Pixel.DepthBias);\r
-         break;\r
-      case GL_DEPTH_BITS:\r
-         params[0] = ctx->Visual.depthBits;\r
-         break;\r
-      case GL_DEPTH_CLEAR_VALUE:\r
-         params[0] = IROUND(ctx->Depth.Clear);\r
-         break;\r
-      case GL_DEPTH_FUNC:\r
-         params[0] = ENUM_TO_INT(ctx->Depth.Func);\r
-         break;\r
-      case GL_DEPTH_RANGE:\r
-         params[0] = FLOAT_TO_INT(ctx->Viewport.Near);\r
-         params[1] = FLOAT_TO_INT(ctx->Viewport.Far);\r
-         break;\r
-      case GL_DEPTH_SCALE:\r
-         params[0] = IROUND(ctx->Pixel.DepthScale);\r
-         break;\r
-      case GL_DEPTH_TEST:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Depth.Test);\r
-         break;\r
-      case GL_DEPTH_WRITEMASK:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Depth.Mask);\r
-         break;\r
-      case GL_DITHER:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Color.DitherFlag);\r
-         break;\r
-      case GL_DOUBLEBUFFER:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Visual.doubleBufferMode);\r
-         break;\r
-      case GL_DRAW_BUFFER:\r
-         params[0] = ENUM_TO_INT(ctx->Color.DrawBuffer[0]);\r
-         break;\r
-      case GL_EDGE_FLAG:\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Current.EdgeFlag);\r
-         }\r
-         break;\r
-      case GL_FEEDBACK_BUFFER_SIZE:\r
-         params[0] = ctx->Feedback.BufferSize;\r
-         break;\r
-      case GL_FEEDBACK_BUFFER_TYPE:\r
-         params[0] = ENUM_TO_INT(ctx->Feedback.Type);\r
-         break;\r
-      case GL_FOG:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Fog.Enabled);\r
-         break;\r
-      case GL_FOG_COLOR:\r
-         params[0] = FLOAT_TO_INT(ctx->Fog.Color[0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Fog.Color[1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Fog.Color[2]);\r
-         params[3] = FLOAT_TO_INT(ctx->Fog.Color[3]);\r
-         break;\r
-      case GL_FOG_DENSITY:\r
-         params[0] = IROUND(ctx->Fog.Density);\r
-         break;\r
-      case GL_FOG_END:\r
-         params[0] = IROUND(ctx->Fog.End);\r
-         break;\r
-      case GL_FOG_HINT:\r
-         params[0] = ENUM_TO_INT(ctx->Hint.Fog);\r
-         break;\r
-      case GL_FOG_INDEX:\r
-         params[0] = IROUND(ctx->Fog.Index);\r
-         break;\r
-      case GL_FOG_MODE:\r
-         params[0] = ENUM_TO_INT(ctx->Fog.Mode);\r
-         break;\r
-      case GL_FOG_START:\r
-         params[0] = IROUND(ctx->Fog.Start);\r
-         break;\r
-      case GL_FRONT_FACE:\r
-         params[0] = ENUM_TO_INT(ctx->Polygon.FrontFace);\r
-         break;\r
-      case GL_GREEN_BIAS:\r
-         params[0] = IROUND(ctx->Pixel.GreenBias);\r
-         break;\r
-      case GL_GREEN_BITS:\r
-         params[0] = ctx->Visual.greenBits;\r
-         break;\r
-      case GL_GREEN_SCALE:\r
-         params[0] = IROUND(ctx->Pixel.GreenScale);\r
-         break;\r
-      case GL_INDEX_BITS:\r
-         params[0] = ctx->Visual.indexBits;\r
-         break;\r
-      case GL_INDEX_CLEAR_VALUE:\r
-         params[0] = ctx->Color.ClearIndex;\r
-         break;\r
-      case GL_INDEX_MODE:\r
-         params[0] = BOOLEAN_TO_INT(!ctx->Visual.rgbMode);\r
-         break;\r
-      case GL_INDEX_OFFSET:\r
-         params[0] = ctx->Pixel.IndexOffset;\r
-         break;\r
-      case GL_INDEX_SHIFT:\r
-         params[0] = ctx->Pixel.IndexShift;\r
-         break;\r
-      case GL_INDEX_WRITEMASK:\r
-         params[0] = ctx->Color.IndexMask;\r
-         break;\r
-      case GL_LIGHT0:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[0].Enabled);\r
-         break;\r
-      case GL_LIGHT1:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[1].Enabled);\r
-         break;\r
-      case GL_LIGHT2:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[2].Enabled);\r
-         break;\r
-      case GL_LIGHT3:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[3].Enabled);\r
-         break;\r
-      case GL_LIGHT4:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[4].Enabled);\r
-         break;\r
-      case GL_LIGHT5:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[5].Enabled);\r
-         break;\r
-      case GL_LIGHT6:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[6].Enabled);\r
-         break;\r
-      case GL_LIGHT7:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[7].Enabled);\r
-         break;\r
-      case GL_LIGHTING:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Enabled);\r
-         break;\r
-      case GL_LIGHT_MODEL_AMBIENT:\r
-         params[0] = FLOAT_TO_INT(ctx->Light.Model.Ambient[0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Light.Model.Ambient[1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Light.Model.Ambient[2]);\r
-         params[3] = FLOAT_TO_INT(ctx->Light.Model.Ambient[3]);\r
-         break;\r
-      case GL_LIGHT_MODEL_COLOR_CONTROL:\r
-         params[0] = ENUM_TO_INT(ctx->Light.Model.ColorControl);\r
-         break;\r
-      case GL_LIGHT_MODEL_LOCAL_VIEWER:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Model.LocalViewer);\r
-         break;\r
-      case GL_LIGHT_MODEL_TWO_SIDE:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Light.Model.TwoSide);\r
-         break;\r
-      case GL_LINE_SMOOTH:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Line.SmoothFlag);\r
-         break;\r
-      case GL_LINE_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_INT(ctx->Hint.LineSmooth);\r
-         break;\r
-      case GL_LINE_STIPPLE:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Line.StippleFlag);\r
-         break;\r
-      case GL_LINE_STIPPLE_PATTERN:\r
-         params[0] = ctx->Line.StipplePattern;\r
-         break;\r
-      case GL_LINE_STIPPLE_REPEAT:\r
-         params[0] = ctx->Line.StippleFactor;\r
-         break;\r
-      case GL_LINE_WIDTH:\r
-         params[0] = IROUND(ctx->Line.Width);\r
-         break;\r
-      case GL_LINE_WIDTH_GRANULARITY:\r
-         params[0] = IROUND(ctx->Const.LineWidthGranularity);\r
-         break;\r
-      case GL_LINE_WIDTH_RANGE:\r
-         params[0] = IROUND(ctx->Const.MinLineWidthAA);\r
-         params[1] = IROUND(ctx->Const.MaxLineWidthAA);\r
-         break;\r
-      case GL_ALIASED_LINE_WIDTH_RANGE:\r
-         params[0] = IROUND(ctx->Const.MinLineWidth);\r
-         params[1] = IROUND(ctx->Const.MaxLineWidth);\r
-         break;\r
-      case GL_LIST_BASE:\r
-         params[0] = ctx->List.ListBase;\r
-         break;\r
-      case GL_LIST_INDEX:\r
-         params[0] = ctx->ListState.CurrentListNum;\r
-         break;\r
-      case GL_LIST_MODE:\r
-         {\r
-         GLenum mode;\r
-         if (!ctx->CompileFlag)\r
-            mode = 0;\r
-         else if (ctx->ExecuteFlag)\r
-            mode = GL_COMPILE_AND_EXECUTE;\r
-         else\r
-            mode = GL_COMPILE;\r
-         params[0] = ENUM_TO_INT(mode);\r
-         }\r
-         break;\r
-      case GL_INDEX_LOGIC_OP:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Color.IndexLogicOpEnabled);\r
-         break;\r
-      case GL_COLOR_LOGIC_OP:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Color.ColorLogicOpEnabled);\r
-         break;\r
-      case GL_LOGIC_OP_MODE:\r
-         params[0] = ENUM_TO_INT(ctx->Color.LogicOp);\r
-         break;\r
-      case GL_MAP1_COLOR_4:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Color4);\r
-         break;\r
-      case GL_MAP1_GRID_DOMAIN:\r
-         params[0] = IROUND(ctx->Eval.MapGrid1u1);\r
-         params[1] = IROUND(ctx->Eval.MapGrid1u2);\r
-         break;\r
-      case GL_MAP1_GRID_SEGMENTS:\r
-         params[0] = ctx->Eval.MapGrid1un;\r
-         break;\r
-      case GL_MAP1_INDEX:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Index);\r
-         break;\r
-      case GL_MAP1_NORMAL:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Normal);\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_1:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord1);\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_2:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord2);\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_3:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord3);\r
-         break;\r
-      case GL_MAP1_TEXTURE_COORD_4:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord4);\r
-         break;\r
-      case GL_MAP1_VERTEX_3:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex3);\r
-         break;\r
-      case GL_MAP1_VERTEX_4:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex4);\r
-         break;\r
-      case GL_MAP2_COLOR_4:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Color4);\r
-         break;\r
-      case GL_MAP2_GRID_DOMAIN:\r
-         params[0] = IROUND(ctx->Eval.MapGrid2u1);\r
-         params[1] = IROUND(ctx->Eval.MapGrid2u2);\r
-         params[2] = IROUND(ctx->Eval.MapGrid2v1);\r
-         params[3] = IROUND(ctx->Eval.MapGrid2v2);\r
-         break;\r
-      case GL_MAP2_GRID_SEGMENTS:\r
-         params[0] = ctx->Eval.MapGrid2un;\r
-         params[1] = ctx->Eval.MapGrid2vn;\r
-         break;\r
-      case GL_MAP2_INDEX:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Index);\r
-         break;\r
-      case GL_MAP2_NORMAL:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Normal);\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_1:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord1);\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_2:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord2);\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_3:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord3);\r
-         break;\r
-      case GL_MAP2_TEXTURE_COORD_4:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord4);\r
-         break;\r
-      case GL_MAP2_VERTEX_3:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex3);\r
-         break;\r
-      case GL_MAP2_VERTEX_4:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex4);\r
-         break;\r
-      case GL_MAP_COLOR:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapColorFlag);\r
-         break;\r
-      case GL_MAP_STENCIL:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapStencilFlag);\r
-         break;\r
-      case GL_MATRIX_MODE:\r
-         params[0] = ENUM_TO_INT(ctx->Transform.MatrixMode);\r
-         break;\r
-      case GL_MAX_ATTRIB_STACK_DEPTH:\r
-         params[0] = MAX_ATTRIB_STACK_DEPTH;\r
-         break;\r
-      case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:\r
-         params[0] = MAX_CLIENT_ATTRIB_STACK_DEPTH;\r
-         break;\r
-      case GL_MAX_CLIP_PLANES:\r
-         params[0] = ctx->Const.MaxClipPlanes;\r
-         break;\r
-      case GL_MAX_ELEMENTS_VERTICES:\r
-         params[0] = ctx->Const.MaxArrayLockSize;\r
-         break;\r
-      case GL_MAX_ELEMENTS_INDICES:\r
-         params[0] = ctx->Const.MaxArrayLockSize;\r
-         break;\r
-      case GL_MAX_EVAL_ORDER:\r
-         params[0] = MAX_EVAL_ORDER;\r
-         break;\r
-      case GL_MAX_LIGHTS:\r
-         params[0] = ctx->Const.MaxLights;\r
-         break;\r
-      case GL_MAX_LIST_NESTING:\r
-         params[0] = MAX_LIST_NESTING;\r
-         break;\r
-      case GL_MAX_MODELVIEW_STACK_DEPTH:\r
-         params[0] = MAX_MODELVIEW_STACK_DEPTH;\r
-         break;\r
-      case GL_MAX_NAME_STACK_DEPTH:\r
-         params[0] = MAX_NAME_STACK_DEPTH;\r
-         break;\r
-      case GL_MAX_PIXEL_MAP_TABLE:\r
-         params[0] = MAX_PIXEL_MAP_TABLE;\r
-         break;\r
-      case GL_MAX_PROJECTION_STACK_DEPTH:\r
-         params[0] = MAX_PROJECTION_STACK_DEPTH;\r
-         break;\r
-      case GL_MAX_TEXTURE_SIZE:\r
-         params[0] = 1 << (ctx->Const.MaxTextureLevels - 1);\r
-         break;\r
-      case GL_MAX_3D_TEXTURE_SIZE:\r
-         params[0] = 1 << (ctx->Const.Max3DTextureLevels - 1);\r
-         break;\r
-      case GL_MAX_TEXTURE_STACK_DEPTH:\r
-         params[0] = MAX_TEXTURE_STACK_DEPTH;\r
-         break;\r
-      case GL_MAX_VIEWPORT_DIMS:\r
-         params[0] = ctx->Const.MaxViewportWidth;\r
-         params[1] = ctx->Const.MaxViewportHeight;\r
-         break;\r
-      case GL_MODELVIEW_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[1]);\r
-         params[2] = IROUND(matrix[2]);\r
-         params[3] = IROUND(matrix[3]);\r
-         params[4] = IROUND(matrix[4]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[6]);\r
-         params[7] = IROUND(matrix[7]);\r
-         params[8] = IROUND(matrix[8]);\r
-         params[9] = IROUND(matrix[9]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[11]);\r
-         params[12] = IROUND(matrix[12]);\r
-         params[13] = IROUND(matrix[13]);\r
-         params[14] = IROUND(matrix[14]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_MODELVIEW_STACK_DEPTH:\r
-         params[0] = ctx->ModelviewMatrixStack.Depth + 1;\r
-         break;\r
-      case GL_NAME_STACK_DEPTH:\r
-         params[0] = ctx->Select.NameStackDepth;\r
-         break;\r
-      case GL_NORMALIZE:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Transform.Normalize);\r
-         break;\r
-      case GL_PACK_ALIGNMENT:\r
-         params[0] = ctx->Pack.Alignment;\r
-         break;\r
-      case GL_PACK_LSB_FIRST:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pack.LsbFirst);\r
-         break;\r
-      case GL_PACK_ROW_LENGTH:\r
-         params[0] = ctx->Pack.RowLength;\r
-         break;\r
-      case GL_PACK_SKIP_PIXELS:\r
-         params[0] = ctx->Pack.SkipPixels;\r
-         break;\r
-      case GL_PACK_SKIP_ROWS:\r
-         params[0] = ctx->Pack.SkipRows;\r
-         break;\r
-      case GL_PACK_SWAP_BYTES:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pack.SwapBytes);\r
-         break;\r
-      case GL_PACK_SKIP_IMAGES_EXT:\r
-         params[0] = ctx->Pack.SkipImages;\r
-         break;\r
-      case GL_PACK_IMAGE_HEIGHT_EXT:\r
-         params[0] = ctx->Pack.ImageHeight;\r
-         break;\r
-      case GL_PACK_INVERT_MESA:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pack.Invert);\r
-         break;\r
-      case GL_PERSPECTIVE_CORRECTION_HINT:\r
-         params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection);\r
-         break;\r
-      case GL_PIXEL_MAP_A_TO_A_SIZE:\r
-         params[0] = ctx->Pixel.MapAtoAsize;\r
-         break;\r
-      case GL_PIXEL_MAP_B_TO_B_SIZE:\r
-         params[0] = ctx->Pixel.MapBtoBsize;\r
-         break;\r
-      case GL_PIXEL_MAP_G_TO_G_SIZE:\r
-         params[0] = ctx->Pixel.MapGtoGsize;\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_A_SIZE:\r
-         params[0] = ctx->Pixel.MapItoAsize;\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_B_SIZE:\r
-         params[0] = ctx->Pixel.MapItoBsize;\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_G_SIZE:\r
-         params[0] = ctx->Pixel.MapItoGsize;\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_I_SIZE:\r
-         params[0] = ctx->Pixel.MapItoIsize;\r
-         break;\r
-      case GL_PIXEL_MAP_I_TO_R_SIZE:\r
-         params[0] = ctx->Pixel.MapItoRsize;\r
-         break;\r
-      case GL_PIXEL_MAP_R_TO_R_SIZE:\r
-         params[0] = ctx->Pixel.MapRtoRsize;\r
-         break;\r
-      case GL_PIXEL_MAP_S_TO_S_SIZE:\r
-         params[0] = ctx->Pixel.MapStoSsize;\r
-         break;\r
-      case GL_POINT_SIZE:\r
-         params[0] = IROUND(ctx->Point.Size);\r
-         break;\r
-      case GL_POINT_SIZE_GRANULARITY:\r
-         params[0] = IROUND(ctx->Const.PointSizeGranularity);\r
-         break;\r
-      case GL_POINT_SIZE_RANGE:\r
-         params[0] = IROUND(ctx->Const.MinPointSizeAA);\r
-         params[1] = IROUND(ctx->Const.MaxPointSizeAA);\r
-         break;\r
-      case GL_ALIASED_POINT_SIZE_RANGE:\r
-         params[0] = IROUND(ctx->Const.MinPointSize);\r
-         params[1] = IROUND(ctx->Const.MaxPointSize);\r
-         break;\r
-      case GL_POINT_SMOOTH:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Point.SmoothFlag);\r
-         break;\r
-      case GL_POINT_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_INT(ctx->Hint.PointSmooth);\r
-         break;\r
-      case GL_POINT_SIZE_MIN_EXT:\r
-         params[0] = IROUND(ctx->Point.MinSize);\r
-         break;\r
-      case GL_POINT_SIZE_MAX_EXT:\r
-         params[0] = IROUND(ctx->Point.MaxSize);\r
-         break;\r
-      case GL_POINT_FADE_THRESHOLD_SIZE_EXT:\r
-         params[0] = IROUND(ctx->Point.Threshold);\r
-         break;\r
-      case GL_DISTANCE_ATTENUATION_EXT:\r
-         params[0] = IROUND(ctx->Point.Params[0]);\r
-         params[1] = IROUND(ctx->Point.Params[1]);\r
-         params[2] = IROUND(ctx->Point.Params[2]);\r
-         break;\r
-      case GL_POLYGON_MODE:\r
-         params[0] = ENUM_TO_INT(ctx->Polygon.FrontMode);\r
-         params[1] = ENUM_TO_INT(ctx->Polygon.BackMode);\r
-         break;\r
-      case GL_POLYGON_OFFSET_BIAS_EXT:\r
-         params[0] = IROUND(ctx->Polygon.OffsetUnits);\r
-         break;\r
-      case GL_POLYGON_OFFSET_FACTOR:\r
-         params[0] = IROUND(ctx->Polygon.OffsetFactor );\r
-         break;\r
-      case GL_POLYGON_OFFSET_UNITS:\r
-         params[0] = IROUND(ctx->Polygon.OffsetUnits );\r
-         break;\r
-      case GL_POLYGON_SMOOTH:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Polygon.SmoothFlag);\r
-         break;\r
-      case GL_POLYGON_SMOOTH_HINT:\r
-         params[0] = ENUM_TO_INT(ctx->Hint.PolygonSmooth);\r
-         break;\r
-      case GL_POLYGON_STIPPLE:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Polygon.StippleFlag);\r
-         break;\r
-      case GL_PROJECTION_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[1]);\r
-         params[2] = IROUND(matrix[2]);\r
-         params[3] = IROUND(matrix[3]);\r
-         params[4] = IROUND(matrix[4]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[6]);\r
-         params[7] = IROUND(matrix[7]);\r
-         params[8] = IROUND(matrix[8]);\r
-         params[9] = IROUND(matrix[9]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[11]);\r
-         params[12] = IROUND(matrix[12]);\r
-         params[13] = IROUND(matrix[13]);\r
-         params[14] = IROUND(matrix[14]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_PROJECTION_STACK_DEPTH:\r
-         params[0] = ctx->ProjectionMatrixStack.Depth + 1;\r
-         break;\r
-      case GL_READ_BUFFER:\r
-         params[0] = ENUM_TO_INT(ctx->Pixel.ReadBuffer);\r
-         break;\r
-      case GL_RED_BIAS:\r
-         params[0] = IROUND(ctx->Pixel.RedBias);\r
-         break;\r
-      case GL_RED_BITS:\r
-         params[0] =  ctx->Visual.redBits ;\r
-         break;\r
-      case GL_RED_SCALE:\r
-         params[0] = IROUND(ctx->Pixel.RedScale);\r
-         break;\r
-      case GL_RENDER_MODE:\r
-         params[0] = ENUM_TO_INT(ctx->RenderMode);\r
-         break;\r
-      case GL_RESCALE_NORMAL:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Transform.RescaleNormals);\r
-         break;\r
-      case GL_RGBA_MODE:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Visual.rgbMode);\r
-         break;\r
-      case GL_SCISSOR_BOX:\r
-         params[0] = ctx->Scissor.X;\r
-         params[1] = ctx->Scissor.Y;\r
-         params[2] = ctx->Scissor.Width;\r
-         params[3] = ctx->Scissor.Height;\r
-         break;\r
-      case GL_SCISSOR_TEST:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Scissor.Enabled);\r
-         break;\r
-      case GL_SELECTION_BUFFER_SIZE:\r
-         params[0] = ctx->Select.BufferSize;\r
-         break;\r
-      case GL_SHADE_MODEL:\r
-         params[0] = ENUM_TO_INT(ctx->Light.ShadeModel);\r
-         break;\r
-      case GL_SHARED_TEXTURE_PALETTE_EXT:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Texture.SharedPalette);\r
-         break;\r
-      case GL_STENCIL_BITS:\r
-         params[0] = ctx->Visual.stencilBits;\r
-         break;\r
-      case GL_STENCIL_CLEAR_VALUE:\r
-         params[0] = ctx->Stencil.Clear;\r
-         break;\r
-      case GL_STENCIL_FAIL:\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_FUNC:\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_PASS_DEPTH_FAIL:\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_PASS_DEPTH_PASS:\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);\r
-         break;\r
-      case GL_STENCIL_REF:\r
-         params[0] = ctx->Stencil.Ref[ctx->Stencil.ActiveFace];\r
-         break;\r
-      case GL_STENCIL_TEST:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Stencil.Enabled);\r
-         break;\r
-      case GL_STENCIL_VALUE_MASK:\r
-         params[0] = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace];\r
-         break;\r
-      case GL_STENCIL_WRITEMASK:\r
-         params[0] = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace];\r
-         break;\r
-      case GL_STEREO:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Visual.stereoMode);\r
-         break;\r
-      case GL_SUBPIXEL_BITS:\r
-         params[0] = ctx->Const.SubPixelBits;\r
-         break;\r
-      case GL_TEXTURE_1D:\r
-         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D));\r
-         break;\r
-      case GL_TEXTURE_2D:\r
-         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D));\r
-         break;\r
-      case GL_TEXTURE_3D:\r
-         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D));\r
-         break;\r
-      case GL_TEXTURE_BINDING_1D:\r
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name;\r
-         break;\r
-      case GL_TEXTURE_BINDING_2D:\r
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name;\r
-         break;\r
-      case GL_TEXTURE_BINDING_3D:\r
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name;\r
-         break;\r
-      case GL_TEXTURE_ENV_COLOR:\r
-         {\r
-         const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;\r
-         params[0] = FLOAT_TO_INT(color[0]);\r
-         params[1] = FLOAT_TO_INT(color[1]);\r
-         params[2] = FLOAT_TO_INT(color[2]);\r
-         params[3] = FLOAT_TO_INT(color[3]);\r
-         }\r
-         break;\r
-      case GL_TEXTURE_ENV_MODE:\r
-         params[0] = ENUM_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);\r
-         break;\r
-      case GL_TEXTURE_GEN_S:\r
-         params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));\r
-         break;\r
-      case GL_TEXTURE_GEN_T:\r
-         params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0));\r
-         break;\r
-      case GL_TEXTURE_GEN_R:\r
-         params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0));\r
-         break;\r
-      case GL_TEXTURE_GEN_Q:\r
-         params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0));\r
-         break;\r
-      case GL_TEXTURE_MATRIX:\r
-         {\r
-         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[1]);\r
-         params[2] = IROUND(matrix[2]);\r
-         params[3] = IROUND(matrix[3]);\r
-         params[4] = IROUND(matrix[4]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[6]);\r
-         params[7] = IROUND(matrix[7]);\r
-         params[8] = IROUND(matrix[8]);\r
-         params[9] = IROUND(matrix[9]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[11]);\r
-         params[12] = IROUND(matrix[12]);\r
-         params[13] = IROUND(matrix[13]);\r
-         params[14] = IROUND(matrix[14]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_TEXTURE_STACK_DEPTH:\r
-         params[0] = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1;\r
-         break;\r
-      case GL_UNPACK_ALIGNMENT:\r
-         params[0] = ctx->Unpack.Alignment;\r
-         break;\r
-      case GL_UNPACK_LSB_FIRST:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Unpack.LsbFirst);\r
-         break;\r
-      case GL_UNPACK_ROW_LENGTH:\r
-         params[0] = ctx->Unpack.RowLength;\r
-         break;\r
-      case GL_UNPACK_SKIP_PIXELS:\r
-         params[0] = ctx->Unpack.SkipPixels;\r
-         break;\r
-      case GL_UNPACK_SKIP_ROWS:\r
-         params[0] = ctx->Unpack.SkipRows;\r
-         break;\r
-      case GL_UNPACK_SWAP_BYTES:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Unpack.SwapBytes);\r
-         break;\r
-      case GL_UNPACK_SKIP_IMAGES_EXT:\r
-         params[0] = ctx->Unpack.SkipImages;\r
-         break;\r
-      case GL_UNPACK_IMAGE_HEIGHT_EXT:\r
-         params[0] = ctx->Unpack.ImageHeight;\r
-         break;\r
-      case GL_UNPACK_CLIENT_STORAGE_APPLE:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Unpack.ClientStorage);\r
-         break;\r
-      case GL_VIEWPORT:\r
-         params[0] = ctx->Viewport.X;\r
-         params[1] = ctx->Viewport.Y;\r
-         params[2] = ctx->Viewport.Width;\r
-         params[3] = ctx->Viewport.Height;\r
-         break;\r
-      case GL_ZOOM_X:\r
-         params[0] = IROUND(ctx->Pixel.ZoomX);\r
-         break;\r
-      case GL_ZOOM_Y:\r
-         params[0] = IROUND(ctx->Pixel.ZoomY);\r
-         break;\r
-      case GL_VERTEX_ARRAY:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.Vertex.Enabled);\r
-         break;\r
-      case GL_VERTEX_ARRAY_SIZE:\r
-         params[0] = ctx->Array.Vertex.Size;\r
-         break;\r
-      case GL_VERTEX_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_INT(ctx->Array.Vertex.Type);\r
-         break;\r
-      case GL_VERTEX_ARRAY_STRIDE:\r
-         params[0] = ctx->Array.Vertex.Stride;\r
-         break;\r
-      case GL_VERTEX_ARRAY_COUNT_EXT:\r
-         params[0] = 0;\r
-         break;\r
-      case GL_NORMAL_ARRAY:\r
-         params[0] = ENUM_TO_INT(ctx->Array.Normal.Enabled);\r
-         break;\r
-      case GL_NORMAL_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_INT(ctx->Array.Normal.Type);\r
-         break;\r
-      case GL_NORMAL_ARRAY_STRIDE:\r
-         params[0] = ctx->Array.Normal.Stride;\r
-         break;\r
-      case GL_NORMAL_ARRAY_COUNT_EXT:\r
-         params[0] = 0;\r
-         break;\r
-      case GL_COLOR_ARRAY:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.Color.Enabled);\r
-         break;\r
-      case GL_COLOR_ARRAY_SIZE:\r
-         params[0] = ctx->Array.Color.Size;\r
-         break;\r
-      case GL_COLOR_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_INT(ctx->Array.Color.Type);\r
-         break;\r
-      case GL_COLOR_ARRAY_STRIDE:\r
-         params[0] = ctx->Array.Color.Stride;\r
-         break;\r
-      case GL_COLOR_ARRAY_COUNT_EXT:\r
-         params[0] = 0;\r
-         break;\r
-      case GL_INDEX_ARRAY:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.Index.Enabled);\r
-         break;\r
-      case GL_INDEX_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_INT(ctx->Array.Index.Type);\r
-         break;\r
-      case GL_INDEX_ARRAY_STRIDE:\r
-         params[0] = ctx->Array.Index.Stride;\r
-         break;\r
-      case GL_INDEX_ARRAY_COUNT_EXT:\r
-         params[0] = 0;\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_SIZE:\r
-         params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size;\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_TYPE:\r
-         params[0] = ENUM_TO_INT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type);\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_STRIDE:\r
-         params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride;\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:\r
-         params[0] = 0;\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY:\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.EdgeFlag.Enabled);\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_STRIDE:\r
-         params[0] = ctx->Array.EdgeFlag.Stride;\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_COUNT_EXT:\r
-         params[0] = 0;\r
-         break;\r
-      case GL_MAX_TEXTURE_UNITS_ARB:\r
-         CHECK_EXTENSION_I(ARB_multitexture, pname);\r
-         params[0] = MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits);\r
-         break;\r
-      case GL_ACTIVE_TEXTURE_ARB:\r
-         CHECK_EXTENSION_I(ARB_multitexture, pname);\r
-         params[0] = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit;\r
-         break;\r
-      case GL_CLIENT_ACTIVE_TEXTURE_ARB:\r
-         CHECK_EXTENSION_I(ARB_multitexture, pname);\r
-         params[0] = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture;\r
-         break;\r
-      case GL_TEXTURE_CUBE_MAP_ARB:\r
-         CHECK_EXTENSION_I(ARB_texture_cube_map, pname);\r
-         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB));\r
-         break;\r
-      case GL_TEXTURE_BINDING_CUBE_MAP_ARB:\r
-         CHECK_EXTENSION_I(ARB_texture_cube_map, pname);\r
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name;\r
-         break;\r
-      case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:\r
-         CHECK_EXTENSION_I(ARB_texture_cube_map, pname);\r
-         params[0] = (1 << (ctx->Const.MaxCubeTextureLevels - 1));\r
-         break;\r
-      case GL_TEXTURE_COMPRESSION_HINT_ARB:\r
-         CHECK_EXTENSION_I(ARB_texture_compression, pname);\r
-         params[0] = ctx->Hint.TextureCompression;\r
-         break;\r
-      case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:\r
-         CHECK_EXTENSION_I(ARB_texture_compression, pname);\r
-         params[0] = _mesa_get_compressed_formats(ctx, NULL);\r
-         break;\r
-      case GL_COMPRESSED_TEXTURE_FORMATS_ARB:\r
-         CHECK_EXTENSION_I(ARB_texture_compression, pname);\r
-         {\r
-         GLint formats[100];\r
-         GLuint i, n = _mesa_get_compressed_formats(ctx, formats);\r
-         for (i = 0; i < n; i++)\r
-            params[i] = ENUM_TO_BOOLEAN(formats[i]);\r
-         }\r
-         break;\r
-      case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:\r
-         CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname);\r
-         params[0] = ctx->Array.LockFirst;\r
-         break;\r
-      case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:\r
-         CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname);\r
-         params[0] = ctx->Array.LockCount;\r
-         break;\r
-      case GL_TRANSPOSE_COLOR_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[4]);\r
-         params[2] = IROUND(matrix[8]);\r
-         params[3] = IROUND(matrix[12]);\r
-         params[4] = IROUND(matrix[1]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[9]);\r
-         params[7] = IROUND(matrix[13]);\r
-         params[8] = IROUND(matrix[2]);\r
-         params[9] = IROUND(matrix[6]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[14]);\r
-         params[12] = IROUND(matrix[3]);\r
-         params[13] = IROUND(matrix[7]);\r
-         params[14] = IROUND(matrix[11]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[4]);\r
-         params[2] = IROUND(matrix[8]);\r
-         params[3] = IROUND(matrix[12]);\r
-         params[4] = IROUND(matrix[1]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[9]);\r
-         params[7] = IROUND(matrix[13]);\r
-         params[8] = IROUND(matrix[2]);\r
-         params[9] = IROUND(matrix[6]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[14]);\r
-         params[12] = IROUND(matrix[3]);\r
-         params[13] = IROUND(matrix[7]);\r
-         params[14] = IROUND(matrix[11]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[4]);\r
-         params[2] = IROUND(matrix[8]);\r
-         params[3] = IROUND(matrix[12]);\r
-         params[4] = IROUND(matrix[1]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[9]);\r
-         params[7] = IROUND(matrix[13]);\r
-         params[8] = IROUND(matrix[2]);\r
-         params[9] = IROUND(matrix[6]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[14]);\r
-         params[12] = IROUND(matrix[3]);\r
-         params[13] = IROUND(matrix[7]);\r
-         params[14] = IROUND(matrix[11]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:\r
-         {\r
-         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[4]);\r
-         params[2] = IROUND(matrix[8]);\r
-         params[3] = IROUND(matrix[12]);\r
-         params[4] = IROUND(matrix[1]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[9]);\r
-         params[7] = IROUND(matrix[13]);\r
-         params[8] = IROUND(matrix[2]);\r
-         params[9] = IROUND(matrix[6]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[14]);\r
-         params[12] = IROUND(matrix[3]);\r
-         params[13] = IROUND(matrix[7]);\r
-         params[14] = IROUND(matrix[11]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_OCCLUSION_TEST_HP:\r
-         CHECK_EXTENSION_I(HP_occlusion_test, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Depth.OcclusionTest);\r
-         break;\r
-      case GL_OCCLUSION_TEST_RESULT_HP:\r
-         CHECK_EXTENSION_I(HP_occlusion_test, pname);\r
-         {\r
-         if (ctx->Depth.OcclusionTest)\r
-            params[0] = ctx->OcclusionResult;\r
-         else\r
-            params[0] = ctx->OcclusionResultSaved;\r
-         /* reset flag now */\r
-         ctx->OcclusionResult = GL_FALSE;\r
-         ctx->OcclusionResultSaved = GL_FALSE;\r
-         return;\r
-         }\r
-         break;\r
-      case GL_PIXEL_TEXTURE_SGIS:\r
-         CHECK_EXTENSION_I(SGIS_pixel_texture, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled);\r
-         break;\r
-      case GL_PIXEL_TEX_GEN_SGIX:\r
-         CHECK_EXTENSION_I(SGIX_pixel_texture, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled);\r
-         break;\r
-      case GL_PIXEL_TEX_GEN_MODE_SGIX:\r
-         CHECK_EXTENSION_I(SGIX_pixel_texture, pname);\r
-         params[0] = ENUM_TO_INT(pixel_texgen_mode(ctx));\r
-         break;\r
-      case GL_COLOR_MATRIX_SGI:\r
-         {\r
-         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[1]);\r
-         params[2] = IROUND(matrix[2]);\r
-         params[3] = IROUND(matrix[3]);\r
-         params[4] = IROUND(matrix[4]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[6]);\r
-         params[7] = IROUND(matrix[7]);\r
-         params[8] = IROUND(matrix[8]);\r
-         params[9] = IROUND(matrix[9]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[11]);\r
-         params[12] = IROUND(matrix[12]);\r
-         params[13] = IROUND(matrix[13]);\r
-         params[14] = IROUND(matrix[14]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_COLOR_MATRIX_STACK_DEPTH_SGI:\r
-         params[0] = ctx->ColorMatrixStack.Depth + 1;\r
-         break;\r
-      case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:\r
-         params[0] = MAX_COLOR_STACK_DEPTH;\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:\r
-         params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[0]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:\r
-         params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[1]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:\r
-         params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[2]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:\r
-         params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[3]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:\r
-         params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[0]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:\r
-         params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[1]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:\r
-         params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[2]);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:\r
-         params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[3]);\r
-         break;\r
-      case GL_CONVOLUTION_1D_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution1DEnabled);\r
-         break;\r
-      case GL_CONVOLUTION_2D_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution2DEnabled);\r
-         break;\r
-      case GL_SEPARABLE_2D_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.Separable2DEnabled);\r
-         break;\r
-      case GL_POST_CONVOLUTION_RED_SCALE_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = IROUND(ctx->Pixel.PostConvolutionScale[0]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = IROUND(ctx->Pixel.PostConvolutionScale[1]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = IROUND(ctx->Pixel.PostConvolutionScale[2]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = IROUND(ctx->Pixel.PostConvolutionScale[3]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_RED_BIAS_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = IROUND(ctx->Pixel.PostConvolutionBias[0]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = IROUND(ctx->Pixel.PostConvolutionBias[1]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = IROUND(ctx->Pixel.PostConvolutionBias[2]);\r
-         break;\r
-      case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:\r
-         CHECK_EXTENSION_I(EXT_convolution, pname);\r
-         params[0] = IROUND(ctx->Pixel.PostConvolutionBias[3]);\r
-         break;\r
-      case GL_HISTOGRAM:\r
-         CHECK_EXTENSION_I(EXT_histogram, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.HistogramEnabled);\r
-         break;\r
-      case GL_MINMAX:\r
-         CHECK_EXTENSION_I(EXT_histogram, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.MinMaxEnabled);\r
-         break;\r
-      case GL_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_I(SGI_color_table, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled);\r
-         break;\r
-      case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_I(SGI_color_table, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostConvolutionColorTableEnabled);\r
-         break;\r
-      case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_I(SGI_color_table, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostColorMatrixColorTableEnabled);\r
-         break;\r
-      case GL_TEXTURE_COLOR_TABLE_SGI:\r
-         CHECK_EXTENSION_I(SGI_texture_color_table, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled);\r
-         break;\r
-      case GL_COLOR_SUM_EXT:\r
-         CHECK_EXTENSION_I(EXT_secondary_color, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Fog.ColorSumEnabled);\r
-         break;\r
-      case GL_CURRENT_SECONDARY_COLOR_EXT:\r
-         CHECK_EXTENSION_I(EXT_secondary_color, pname);\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);\r
-         params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);\r
-         params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);\r
-         params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);\r
-         }\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_EXT:\r
-         CHECK_EXTENSION_I(EXT_secondary_color, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.SecondaryColor.Enabled);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:\r
-         CHECK_EXTENSION_I(EXT_secondary_color, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Array.SecondaryColor.Type);\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:\r
-         CHECK_EXTENSION_I(EXT_secondary_color, pname);\r
-         params[0] = ctx->Array.SecondaryColor.Stride;\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:\r
-         CHECK_EXTENSION_I(EXT_secondary_color, pname);\r
-         params[0] = ctx->Array.SecondaryColor.Size;\r
-         break;\r
-      case GL_CURRENT_FOG_COORDINATE_EXT:\r
-         CHECK_EXTENSION_I(EXT_fog_coord, pname);\r
-         {\r
-         FLUSH_CURRENT(ctx, 0);\r
-         params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);\r
-         }\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_EXT:\r
-         CHECK_EXTENSION_I(EXT_fog_coord, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.FogCoord.Enabled);\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:\r
-         CHECK_EXTENSION_I(EXT_fog_coord, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Array.FogCoord.Type);\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:\r
-         CHECK_EXTENSION_I(EXT_fog_coord, pname);\r
-         params[0] = ctx->Array.FogCoord.Stride;\r
-         break;\r
-      case GL_FOG_COORDINATE_SOURCE_EXT:\r
-         CHECK_EXTENSION_I(EXT_fog_coord, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Fog.FogCoordinateSource);\r
-         break;\r
-      case GL_MAX_TEXTURE_LOD_BIAS_EXT:\r
-         CHECK_EXTENSION_I(EXT_texture_lod_bias, pname);\r
-         params[0] = IROUND(ctx->Const.MaxTextureLodBias);\r
-         break;\r
-      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:\r
-         CHECK_EXTENSION_I(EXT_texture_filter_anisotropic, pname);\r
-         params[0] = IROUND(ctx->Const.MaxTextureMaxAnisotropy);\r
-         break;\r
-      case GL_MULTISAMPLE_ARB:\r
-         CHECK_EXTENSION_I(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Multisample.Enabled);\r
-         break;\r
-      case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:\r
-         CHECK_EXTENSION_I(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToCoverage);\r
-         break;\r
-      case GL_SAMPLE_ALPHA_TO_ONE_ARB:\r
-         CHECK_EXTENSION_I(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToOne);\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_ARB:\r
-         CHECK_EXTENSION_I(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverage);\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_VALUE_ARB:\r
-         CHECK_EXTENSION_I(ARB_multisample, pname);\r
-         params[0] = IROUND(ctx->Multisample.SampleCoverageValue);\r
-         break;\r
-      case GL_SAMPLE_COVERAGE_INVERT_ARB:\r
-         CHECK_EXTENSION_I(ARB_multisample, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverageInvert);\r
-         break;\r
-      case GL_SAMPLE_BUFFERS_ARB:\r
-         CHECK_EXTENSION_I(ARB_multisample, pname);\r
-         params[0] = 0;\r
-         break;\r
-      case GL_SAMPLES_ARB:\r
-         CHECK_EXTENSION_I(ARB_multisample, pname);\r
-         params[0] = 0;\r
-         break;\r
-      case GL_RASTER_POSITION_UNCLIPPED_IBM:\r
-         CHECK_EXTENSION_I(IBM_rasterpos_clip, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Transform.RasterPositionUnclipped);\r
-         break;\r
-      case GL_POINT_SPRITE_NV:\r
-         CHECK_EXTENSION_I(NV_point_sprite, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Point.PointSprite);\r
-         break;\r
-      case GL_POINT_SPRITE_R_MODE_NV:\r
-         CHECK_EXTENSION_I(NV_point_sprite, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Point.SpriteRMode);\r
-         break;\r
-      case GL_POINT_SPRITE_COORD_ORIGIN:\r
-         CHECK_EXTENSION_I(NV_point_sprite, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Point.SpriteOrigin);\r
-         break;\r
-      case GL_GENERATE_MIPMAP_HINT_SGIS:\r
-         CHECK_EXTENSION_I(SGIS_generate_mipmap, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Hint.GenerateMipmap);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.Enabled);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_POINT_SIZE_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.PointSizeEnabled);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_TWO_SIDE_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.TwoSideEnabled);\r
-         break;\r
-      case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = ctx->Const.MaxProgramMatrixStackDepth;\r
-         break;\r
-      case GL_MAX_TRACK_MATRICES_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = ctx->Const.MaxProgramMatrices;\r
-         break;\r
-      case GL_CURRENT_MATRIX_STACK_DEPTH_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->CurrentStack->Depth + 1);\r
-         break;\r
-      case GL_CURRENT_MATRIX_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         {\r
-         const GLfloat *matrix = ctx->CurrentStack->Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[1]);\r
-         params[2] = IROUND(matrix[2]);\r
-         params[3] = IROUND(matrix[3]);\r
-         params[4] = IROUND(matrix[4]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[6]);\r
-         params[7] = IROUND(matrix[7]);\r
-         params[8] = IROUND(matrix[8]);\r
-         params[9] = IROUND(matrix[9]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[11]);\r
-         params[12] = IROUND(matrix[12]);\r
-         params[13] = IROUND(matrix[13]);\r
-         params[14] = IROUND(matrix[14]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_VERTEX_PROGRAM_BINDING_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = (ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0);\r
-         break;\r
-      case GL_PROGRAM_ERROR_POSITION_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = ctx->Program.ErrorPos;\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY0_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[0].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY1_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[1].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY2_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[2].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY3_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[3].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[4].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY5_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[5].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY6_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[6].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY7_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[7].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY8_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[8].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY9_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[9].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY10_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[10].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY11_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[11].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY12_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[12].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY13_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[13].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY14_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[14].Enabled);\r
-         break;\r
-      case GL_VERTEX_ATTRIB_ARRAY15_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[15].Enabled);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB0_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[0]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB1_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[1]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB2_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[2]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB3_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[3]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB4_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[4]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB5_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[5]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB6_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[6]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB7_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[7]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB8_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[8]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB9_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[9]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB10_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[10]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB11_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[11]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB12_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[12]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB13_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[13]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB14_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[14]);\r
-         break;\r
-      case GL_MAP1_VERTEX_ATTRIB15_4_NV:\r
-         CHECK_EXTENSION_I(NV_vertex_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[15]);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_NV:\r
-         CHECK_EXTENSION_I(NV_fragment_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled);\r
-         break;\r
-      case GL_MAX_TEXTURE_COORDS_NV:\r
-         CHECK_EXTENSION_I(NV_fragment_program, pname);\r
-         params[0] = ctx->Const.MaxTextureCoordUnits;\r
-         break;\r
-      case GL_MAX_TEXTURE_IMAGE_UNITS_NV:\r
-         CHECK_EXTENSION_I(NV_fragment_program, pname);\r
-         params[0] = ctx->Const.MaxTextureImageUnits;\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_BINDING_NV:\r
-         CHECK_EXTENSION_I(NV_fragment_program, pname);\r
-         params[0] = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0;\r
-         break;\r
-      case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:\r
-         CHECK_EXTENSION_I(NV_fragment_program, pname);\r
-         params[0] = MAX_NV_FRAGMENT_PROGRAM_PARAMS;\r
-         break;\r
-      case GL_TEXTURE_RECTANGLE_NV:\r
-         CHECK_EXTENSION_I(NV_texture_rectangle, pname);\r
-         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV));\r
-         break;\r
-      case GL_TEXTURE_BINDING_RECTANGLE_NV:\r
-         CHECK_EXTENSION_I(NV_texture_rectangle, pname);\r
-         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name;\r
-         break;\r
-      case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:\r
-         CHECK_EXTENSION_I(NV_texture_rectangle, pname);\r
-         params[0] = ctx->Const.MaxTextureRectSize;\r
-         break;\r
-      case GL_STENCIL_TEST_TWO_SIDE_EXT:\r
-         CHECK_EXTENSION_I(EXT_stencil_two_side, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Stencil.TestTwoSide);\r
-         break;\r
-      case GL_ACTIVE_STENCIL_FACE_EXT:\r
-         CHECK_EXTENSION_I(EXT_stencil_two_side, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);\r
-         break;\r
-      case GL_MAX_SHININESS_NV:\r
-         CHECK_EXTENSION_I(NV_light_max_exponent, pname);\r
-         params[0] = IROUND(ctx->Const.MaxShininess);\r
-         break;\r
-      case GL_MAX_SPOT_EXPONENT_NV:\r
-         CHECK_EXTENSION_I(NV_light_max_exponent, pname);\r
-         params[0] = IROUND(ctx->Const.MaxSpotExponent);\r
-         break;\r
-      case GL_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.ArrayBufferObj->Name;\r
-         break;\r
-      case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.Vertex.BufferObj->Name;\r
-         break;\r
-      case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.Normal.BufferObj->Name;\r
-         break;\r
-      case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.Color.BufferObj->Name;\r
-         break;\r
-      case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.Index.BufferObj->Name;\r
-         break;\r
-      case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name;\r
-         break;\r
-      case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.EdgeFlag.BufferObj->Name;\r
-         break;\r
-      case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.SecondaryColor.BufferObj->Name;\r
-         break;\r
-      case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.FogCoord.BufferObj->Name;\r
-         break;\r
-      case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);\r
-         params[0] = ctx->Array.ElementArrayBufferObj->Name;\r
-         break;\r
-      case GL_PIXEL_PACK_BUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname);\r
-         params[0] = ctx->Pack.BufferObj->Name;\r
-         break;\r
-      case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname);\r
-         params[0] = ctx->Unpack.BufferObj->Name;\r
-         break;\r
-      case GL_MAX_VERTEX_ATTRIBS_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_program, pname);\r
-         params[0] = ctx->Const.MaxVertexProgramAttribs;\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_ARB:\r
-         CHECK_EXTENSION_I(ARB_fragment_program, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled);\r
-         break;\r
-      case GL_TRANSPOSE_CURRENT_MATRIX_ARB:\r
-         CHECK_EXTENSION_I(ARB_fragment_program, pname);\r
-         {\r
-         const GLfloat *matrix = ctx->CurrentStack->Top->m;\r
-         params[0] = IROUND(matrix[0]);\r
-         params[1] = IROUND(matrix[4]);\r
-         params[2] = IROUND(matrix[8]);\r
-         params[3] = IROUND(matrix[12]);\r
-         params[4] = IROUND(matrix[1]);\r
-         params[5] = IROUND(matrix[5]);\r
-         params[6] = IROUND(matrix[9]);\r
-         params[7] = IROUND(matrix[13]);\r
-         params[8] = IROUND(matrix[2]);\r
-         params[9] = IROUND(matrix[6]);\r
-         params[10] = IROUND(matrix[10]);\r
-         params[11] = IROUND(matrix[14]);\r
-         params[12] = IROUND(matrix[3]);\r
-         params[13] = IROUND(matrix[7]);\r
-         params[14] = IROUND(matrix[11]);\r
-         params[15] = IROUND(matrix[15]);\r
-         }\r
-         break;\r
-      case GL_DEPTH_BOUNDS_TEST_EXT:\r
-         CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->Depth.BoundsTest);\r
-         break;\r
-      case GL_DEPTH_BOUNDS_EXT:\r
-         CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);\r
-         params[0] = IROUND(ctx->Depth.BoundsMin);\r
-         params[1] = IROUND(ctx->Depth.BoundsMax);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:\r
-         CHECK_EXTENSION_I(MESA_program_debug, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.CallbackEnabled);\r
-         break;\r
-      case GL_VERTEX_PROGRAM_CALLBACK_MESA:\r
-         CHECK_EXTENSION_I(MESA_program_debug, pname);\r
-         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.CallbackEnabled);\r
-         break;\r
-      case GL_FRAGMENT_PROGRAM_POSITION_MESA:\r
-         CHECK_EXTENSION_I(MESA_program_debug, pname);\r
-         params[0] = ctx->FragmentProgram.CurrentPosition;\r
-         break;\r
-      case GL_VERTEX_PROGRAM_POSITION_MESA:\r
-         CHECK_EXTENSION_I(MESA_program_debug, pname);\r
-         params[0] = ctx->VertexProgram.CurrentPosition;\r
-         break;\r
-      case GL_MAX_DRAW_BUFFERS_ARB:\r
-         CHECK_EXTENSION_I(ARB_draw_buffers, pname);\r
-         params[0] = ctx->Const.MaxDrawBuffers;\r
-         break;\r
-      case GL_DRAW_BUFFER0_ARB:\r
-         CHECK_EXTENSION_I(ARB_draw_buffers, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Color.DrawBuffer[0]);\r
-         break;\r
-      case GL_DRAW_BUFFER1_ARB:\r
-         CHECK_EXTENSION_I(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[1];\r
-         params[0] = ENUM_TO_INT(buffer);\r
-         }\r
-         break;\r
-      case GL_DRAW_BUFFER2_ARB:\r
-         CHECK_EXTENSION_I(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[2];\r
-         params[0] = ENUM_TO_INT(buffer);\r
-         }\r
-         break;\r
-      case GL_DRAW_BUFFER3_ARB:\r
-         CHECK_EXTENSION_I(ARB_draw_buffers, pname);\r
-         {\r
-         GLenum buffer;\r
-         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {\r
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");\r
-            return;\r
-         }\r
-         buffer = ctx->Color.DrawBuffer[3];\r
-         params[0] = ENUM_TO_INT(buffer);\r
-         }\r
-         break;\r
-      case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:\r
-         CHECK_EXTENSION_I(OES_read_format, pname);\r
-         params[0] = ctx->Const.ColorReadType;\r
-         break;\r
-      case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:\r
-         CHECK_EXTENSION_I(OES_read_format, pname);\r
-         params[0] = ctx->Const.ColorReadFormat;\r
-         break;\r
-      case GL_NUM_FRAGMENT_REGISTERS_ATI:\r
-         CHECK_EXTENSION_I(ATI_fragment_shader, pname);\r
-         params[0] = 6;\r
-         break;\r
-      case GL_NUM_FRAGMENT_CONSTANTS_ATI:\r
-         CHECK_EXTENSION_I(ATI_fragment_shader, pname);\r
-         params[0] = 8;\r
-         break;\r
-      case GL_NUM_PASSES_ATI:\r
-         CHECK_EXTENSION_I(ATI_fragment_shader, pname);\r
-         params[0] = 2;\r
-         break;\r
-      case GL_NUM_INSTRUCTIONS_PER_PASS_ATI:\r
-         CHECK_EXTENSION_I(ATI_fragment_shader, pname);\r
-         params[0] = 8;\r
-         break;\r
-      case GL_NUM_INSTRUCTIONS_TOTAL_ATI:\r
-         CHECK_EXTENSION_I(ATI_fragment_shader, pname);\r
-         params[0] = 16;\r
-         break;\r
-      case GL_COLOR_ALPHA_PAIRING_ATI:\r
-         CHECK_EXTENSION_I(ATI_fragment_shader, pname);\r
-         params[0] = BOOLEAN_TO_INT(GL_TRUE);\r
-         break;\r
-      case GL_NUM_LOOPBACK_COMPONENTS_ATI:\r
-         CHECK_EXTENSION_I(ATI_fragment_shader, pname);\r
-         params[0] = 3;\r
-         break;\r
-      case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI:\r
-         CHECK_EXTENSION_I(ATI_fragment_shader, pname);\r
-         params[0] = 3;\r
-         break;\r
-      case GL_STENCIL_BACK_FUNC:\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.Function[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_VALUE_MASK:\r
-         params[0] = ctx->Stencil.ValueMask[1];\r
-         break;\r
-      case GL_STENCIL_BACK_REF:\r
-         params[0] = ctx->Stencil.Ref[1];\r
-         break;\r
-      case GL_STENCIL_BACK_FAIL:\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[1]);\r
-         break;\r
-      case GL_STENCIL_BACK_PASS_DEPTH_PASS:\r
-         params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[1]);\r
-         break;\r
-      case GL_FRAMEBUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_I(EXT_framebuffer_object, pname);\r
-         params[0] = ctx->CurrentFramebuffer ? ctx->CurrentFramebuffer->Name : 0;\r
-         break;\r
-      case GL_RENDERBUFFER_BINDING_EXT:\r
-         CHECK_EXTENSION_I(EXT_framebuffer_object, pname);\r
-         params[0] = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;\r
-         break;\r
-      case GL_MAX_COLOR_ATTACHMENTS_EXT:\r
-         CHECK_EXTENSION_I(EXT_framebuffer_object, pname);\r
-         params[0] = ctx->Const.MaxColorAttachments;\r
-         break;\r
-      case GL_MAX_RENDERBUFFER_SIZE_EXT:\r
-         CHECK_EXTENSION_I(EXT_framebuffer_object, pname);\r
-         params[0] = ctx->Const.MaxRenderbufferSize;\r
-         break;\r
-      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:\r
-         CHECK_EXTENSION_I(ARB_fragment_shader, pname);\r
-         params[0] = MAX_FRAGMENT_UNIFORM_COMPONENTS;\r
-         break;\r
-      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:\r
-         CHECK_EXTENSION_I(ARB_fragment_shader, pname);\r
-         params[0] = ENUM_TO_INT(ctx->Hint.FragmentShaderDerivative);\r
-         break;\r
-      case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_shader, pname);\r
-         params[0] = MAX_VERTEX_UNIFORM_COMPONENTS;\r
-         break;\r
-      case GL_MAX_VARYING_FLOATS_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_shader, pname);\r
-         params[0] = MAX_VARYING_FLOATS;\r
-         break;\r
-      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_shader, pname);\r
-         params[0] = MAX_VERTEX_TEXTURE_IMAGE_UNITS;\r
-         break;\r
-      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:\r
-         CHECK_EXTENSION_I(ARB_vertex_shader, pname);\r
-         params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS;\r
-         break;\r
-      default:\r
-         _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);\r
-   }\r
-}\r
-\r
-\r
-void GLAPIENTRY\r
-_mesa_GetDoublev( GLenum pname, GLdouble *params )\r
-{\r
-   const GLfloat magic = -1234.5F;\r
-   GLfloat values[16];\r
-   GLuint i;\r
-\r
-   if (!params)\r
-      return;\r
-\r
-   /* Init temp array to magic numbers so we can figure out how many values\r
-    * are returned by the GetFloatv() call.\r
-    */\r
-   for (i = 0; i < 16; i++)\r
-      values[i] = magic;\r
-\r
-   _mesa_GetFloatv(pname, values);\r
-   \r
-   for (i = 0; values[i] != magic && i < 16; i++)\r
-      params[i] = (GLdouble) values[i];\r
-}\r
-\r
+
+/***
+ ***  NOTE!!!  DO NOT EDIT THIS FILE!!!  IT IS GENERATED BY get_gen.py
+ ***/
+
+#include "glheader.h"
+#include "context.h"
+#include "enable.h"
+#include "extensions.h"
+#include "fbobject.h"
+#include "get.h"
+#include "macros.h"
+#include "mtypes.h"
+#include "texcompress.h"
+
+
+#define FLOAT_TO_BOOLEAN(X)   ( (X) ? GL_TRUE : GL_FALSE )
+
+#define INT_TO_BOOLEAN(I)     ( (I) ? GL_TRUE : GL_FALSE )
+
+#define ENUM_TO_BOOLEAN(E)    ( (E) ? GL_TRUE : GL_FALSE )
+#define ENUM_TO_INT(E)        ( (GLint) (E) )
+#define ENUM_TO_FLOAT(E)      ( (GLfloat) (E) )
+
+#define BOOLEAN_TO_INT(B)     ( (GLint) (B) )
+#define BOOLEAN_TO_FLOAT(B)   ( (B) ? 1.0F : 0.0F )
+
+
+/* Check if named extension is enabled, if not generate error and return */
+
+#define CHECK1(E1, str, PNAME)                         \
+   if (!ctx->Extensions.E1) {                          \
+      _mesa_error(ctx, GL_INVALID_VALUE,               \
+                  "glGet" str "v(0x%x)", (int) PNAME); \
+      return;                                          \
+   }
+    
+#define CHECK2(E1, E2, str, PNAME)                     \
+   if (!ctx->Extensions.E1 && !ctx->Extensions.E2) {   \
+      _mesa_error(ctx, GL_INVALID_VALUE,               \
+                  "glGet" str "v(0x%x)", (int) PNAME); \
+      return;                                          \
+   }
+    
+#define CHECK_EXTENSION_B(EXTNAME, PNAME)      \
+   CHECK1(EXTNAME, "Boolean", PNAME )
+
+#define CHECK_EXTENSION_I(EXTNAME, PNAME)      \
+   CHECK1(EXTNAME, "Integer", PNAME )
+
+#define CHECK_EXTENSION_F(EXTNAME, PNAME)      \
+   CHECK1(EXTNAME, "Float", PNAME )
+
+
+/**
+ * Helper routine.
+ */
+static GLenum
+pixel_texgen_mode(const GLcontext *ctx)
+{
+   if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) {
+      if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {
+         return GL_RGBA;
+      }
+      else {
+         return GL_RGB;
+      }
+   }
+   else {
+      if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) {
+         return GL_ALPHA;
+      }
+      else {
+         return GL_NONE;
+      }
+   }
+}
+
+void GLAPIENTRY
+_mesa_GetBooleanv( GLenum pname, GLboolean *params )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (!params)
+      return;
+
+   if (ctx->Driver.GetBooleanv &&
+       ctx->Driver.GetBooleanv(ctx, pname, params))
+      return;
+
+   switch (pname) {
+      case GL_ACCUM_RED_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.accumRedBits);
+         break;
+      case GL_ACCUM_GREEN_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.accumGreenBits);
+         break;
+      case GL_ACCUM_BLUE_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.accumBlueBits);
+         break;
+      case GL_ACCUM_ALPHA_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.accumAlphaBits);
+         break;
+      case GL_ACCUM_CLEAR_VALUE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[3]);
+         break;
+      case GL_ALPHA_BIAS:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias);
+         break;
+      case GL_ALPHA_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.alphaBits);
+         break;
+      case GL_ALPHA_SCALE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaScale);
+         break;
+      case GL_ALPHA_TEST:
+         params[0] = ctx->Color.AlphaEnabled;
+         break;
+      case GL_ALPHA_TEST_FUNC:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.AlphaFunc);
+         break;
+      case GL_ALPHA_TEST_REF:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Color.AlphaRef);
+         break;
+      case GL_ATTRIB_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(ctx->AttribStackDepth);
+         break;
+      case GL_AUTO_NORMAL:
+         params[0] = ctx->Eval.AutoNormal;
+         break;
+      case GL_AUX_BUFFERS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.numAuxBuffers);
+         break;
+      case GL_BLEND:
+         params[0] = ctx->Color.BlendEnabled;
+         break;
+      case GL_BLEND_DST:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB);
+         break;
+      case GL_BLEND_SRC:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB);
+         break;
+      case GL_BLEND_SRC_RGB_EXT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB);
+         break;
+      case GL_BLEND_DST_RGB_EXT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB);
+         break;
+      case GL_BLEND_SRC_ALPHA_EXT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcA);
+         break;
+      case GL_BLEND_DST_ALPHA_EXT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstA);
+         break;
+      case GL_BLEND_EQUATION:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationRGB );
+         break;
+      case GL_BLEND_EQUATION_ALPHA_EXT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationA );
+         break;
+      case GL_BLEND_COLOR_EXT:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[3]);
+         break;
+      case GL_BLUE_BIAS:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias);
+         break;
+      case GL_BLUE_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.blueBits);
+         break;
+      case GL_BLUE_SCALE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueScale);
+         break;
+      case GL_CLIENT_ATTRIB_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(ctx->ClientAttribStackDepth);
+         break;
+      case GL_CLIP_PLANE0:
+         params[0] = (ctx->Transform.ClipPlanesEnabled >> 0) & 1;
+         break;
+      case GL_CLIP_PLANE1:
+         params[0] = (ctx->Transform.ClipPlanesEnabled >> 1) & 1;
+         break;
+      case GL_CLIP_PLANE2:
+         params[0] = (ctx->Transform.ClipPlanesEnabled >> 2) & 1;
+         break;
+      case GL_CLIP_PLANE3:
+         params[0] = (ctx->Transform.ClipPlanesEnabled >> 3) & 1;
+         break;
+      case GL_CLIP_PLANE4:
+         params[0] = (ctx->Transform.ClipPlanesEnabled >> 4) & 1;
+         break;
+      case GL_CLIP_PLANE5:
+         params[0] = (ctx->Transform.ClipPlanesEnabled >> 5) & 1;
+         break;
+      case GL_COLOR_CLEAR_VALUE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[3]);
+         break;
+      case GL_COLOR_MATERIAL:
+         params[0] = ctx->Light.ColorMaterialEnabled;
+         break;
+      case GL_COLOR_MATERIAL_FACE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialFace);
+         break;
+      case GL_COLOR_MATERIAL_PARAMETER:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialMode);
+         break;
+      case GL_COLOR_WRITEMASK:
+         params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[RCOMP] ? 1 : 0);
+         params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[GCOMP] ? 1 : 0);
+         params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[BCOMP] ? 1 : 0);
+         params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[ACOMP] ? 1 : 0);
+         break;
+      case GL_CULL_FACE:
+         params[0] = ctx->Polygon.CullFlag;
+         break;
+      case GL_CULL_FACE_MODE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode);
+         break;
+      case GL_CURRENT_COLOR:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
+         }
+         break;
+      case GL_CURRENT_INDEX:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Index);
+         }
+         break;
+      case GL_CURRENT_NORMAL:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
+         }
+         break;
+      case GL_CURRENT_RASTER_COLOR:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[3]);
+         break;
+      case GL_CURRENT_RASTER_DISTANCE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterDistance);
+         break;
+      case GL_CURRENT_RASTER_INDEX:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterIndex);
+         break;
+      case GL_CURRENT_RASTER_POSITION:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[3]);
+         break;
+      case GL_CURRENT_RASTER_TEXTURE_COORDS:
+         {
+         const GLuint texUnit = ctx->Texture.CurrentUnit;
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][3]);
+         }
+         break;
+      case GL_CURRENT_RASTER_POSITION_VALID:
+         params[0] = ctx->Current.RasterPosValid;
+         break;
+      case GL_CURRENT_TEXTURE_COORDS:
+         {
+         const GLuint texUnit = ctx->Texture.CurrentUnit;
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]);
+         }
+         break;
+      case GL_DEPTH_BIAS:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthBias);
+         break;
+      case GL_DEPTH_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.depthBits);
+         break;
+      case GL_DEPTH_CLEAR_VALUE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.Clear);
+         break;
+      case GL_DEPTH_FUNC:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Depth.Func);
+         break;
+      case GL_DEPTH_RANGE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Viewport.Near);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Viewport.Far);
+         break;
+      case GL_DEPTH_SCALE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthScale);
+         break;
+      case GL_DEPTH_TEST:
+         params[0] = ctx->Depth.Test;
+         break;
+      case GL_DEPTH_WRITEMASK:
+         params[0] = ctx->Depth.Mask;
+         break;
+      case GL_DITHER:
+         params[0] = ctx->Color.DitherFlag;
+         break;
+      case GL_DOUBLEBUFFER:
+         params[0] = ctx->Visual.doubleBufferMode;
+         break;
+      case GL_DRAW_BUFFER:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.DrawBuffer[0]);
+         break;
+      case GL_EDGE_FLAG:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = ctx->Current.EdgeFlag;
+         }
+         break;
+      case GL_FEEDBACK_BUFFER_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize);
+         break;
+      case GL_FEEDBACK_BUFFER_TYPE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Feedback.Type);
+         break;
+      case GL_FOG:
+         params[0] = ctx->Fog.Enabled;
+         break;
+      case GL_FOG_COLOR:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[3]);
+         break;
+      case GL_FOG_DENSITY:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Density);
+         break;
+      case GL_FOG_END:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.End);
+         break;
+      case GL_FOG_HINT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.Fog);
+         break;
+      case GL_FOG_INDEX:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Index);
+         break;
+      case GL_FOG_MODE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Fog.Mode);
+         break;
+      case GL_FOG_START:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Start);
+         break;
+      case GL_FRONT_FACE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontFace);
+         break;
+      case GL_GREEN_BIAS:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias);
+         break;
+      case GL_GREEN_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.greenBits);
+         break;
+      case GL_GREEN_SCALE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale);
+         break;
+      case GL_INDEX_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.indexBits);
+         break;
+      case GL_INDEX_CLEAR_VALUE:
+         params[0] = INT_TO_BOOLEAN(ctx->Color.ClearIndex);
+         break;
+      case GL_INDEX_MODE:
+         params[0] = !ctx->Visual.rgbMode;
+         break;
+      case GL_INDEX_OFFSET:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexOffset);
+         break;
+      case GL_INDEX_SHIFT:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexShift);
+         break;
+      case GL_INDEX_WRITEMASK:
+         params[0] = INT_TO_BOOLEAN(ctx->Color.IndexMask);
+         break;
+      case GL_LIGHT0:
+         params[0] = ctx->Light.Light[0].Enabled;
+         break;
+      case GL_LIGHT1:
+         params[0] = ctx->Light.Light[1].Enabled;
+         break;
+      case GL_LIGHT2:
+         params[0] = ctx->Light.Light[2].Enabled;
+         break;
+      case GL_LIGHT3:
+         params[0] = ctx->Light.Light[3].Enabled;
+         break;
+      case GL_LIGHT4:
+         params[0] = ctx->Light.Light[4].Enabled;
+         break;
+      case GL_LIGHT5:
+         params[0] = ctx->Light.Light[5].Enabled;
+         break;
+      case GL_LIGHT6:
+         params[0] = ctx->Light.Light[6].Enabled;
+         break;
+      case GL_LIGHT7:
+         params[0] = ctx->Light.Light[7].Enabled;
+         break;
+      case GL_LIGHTING:
+         params[0] = ctx->Light.Enabled;
+         break;
+      case GL_LIGHT_MODEL_AMBIENT:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[3]);
+         break;
+      case GL_LIGHT_MODEL_COLOR_CONTROL:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Light.Model.ColorControl);
+         break;
+      case GL_LIGHT_MODEL_LOCAL_VIEWER:
+         params[0] = ctx->Light.Model.LocalViewer;
+         break;
+      case GL_LIGHT_MODEL_TWO_SIDE:
+         params[0] = ctx->Light.Model.TwoSide;
+         break;
+      case GL_LINE_SMOOTH:
+         params[0] = ctx->Line.SmoothFlag;
+         break;
+      case GL_LINE_SMOOTH_HINT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.LineSmooth);
+         break;
+      case GL_LINE_STIPPLE:
+         params[0] = ctx->Line.StippleFlag;
+         break;
+      case GL_LINE_STIPPLE_PATTERN:
+         params[0] = INT_TO_BOOLEAN(ctx->Line.StipplePattern);
+         break;
+      case GL_LINE_STIPPLE_REPEAT:
+         params[0] = INT_TO_BOOLEAN(ctx->Line.StippleFactor);
+         break;
+      case GL_LINE_WIDTH:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Line.Width);
+         break;
+      case GL_LINE_WIDTH_GRANULARITY:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.LineWidthGranularity);
+         break;
+      case GL_LINE_WIDTH_RANGE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidthAA);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidthAA);
+         break;
+      case GL_ALIASED_LINE_WIDTH_RANGE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidth);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidth);
+         break;
+      case GL_LIST_BASE:
+         params[0] = INT_TO_BOOLEAN(ctx->List.ListBase);
+         break;
+      case GL_LIST_INDEX:
+         params[0] = INT_TO_BOOLEAN(ctx->ListState.CurrentListNum);
+         break;
+      case GL_LIST_MODE:
+         {
+         GLenum mode;
+         if (!ctx->CompileFlag)
+            mode = 0;
+         else if (ctx->ExecuteFlag)
+            mode = GL_COMPILE_AND_EXECUTE;
+         else
+            mode = GL_COMPILE;
+         params[0] = ENUM_TO_BOOLEAN(mode);
+         }
+         break;
+      case GL_INDEX_LOGIC_OP:
+         params[0] = ctx->Color.IndexLogicOpEnabled;
+         break;
+      case GL_COLOR_LOGIC_OP:
+         params[0] = ctx->Color.ColorLogicOpEnabled;
+         break;
+      case GL_LOGIC_OP_MODE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.LogicOp);
+         break;
+      case GL_MAP1_COLOR_4:
+         params[0] = ctx->Eval.Map1Color4;
+         break;
+      case GL_MAP1_GRID_DOMAIN:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u1);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u2);
+         break;
+      case GL_MAP1_GRID_SEGMENTS:
+         params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid1un);
+         break;
+      case GL_MAP1_INDEX:
+         params[0] = ctx->Eval.Map1Index;
+         break;
+      case GL_MAP1_NORMAL:
+         params[0] = ctx->Eval.Map1Normal;
+         break;
+      case GL_MAP1_TEXTURE_COORD_1:
+         params[0] = ctx->Eval.Map1TextureCoord1;
+         break;
+      case GL_MAP1_TEXTURE_COORD_2:
+         params[0] = ctx->Eval.Map1TextureCoord2;
+         break;
+      case GL_MAP1_TEXTURE_COORD_3:
+         params[0] = ctx->Eval.Map1TextureCoord3;
+         break;
+      case GL_MAP1_TEXTURE_COORD_4:
+         params[0] = ctx->Eval.Map1TextureCoord4;
+         break;
+      case GL_MAP1_VERTEX_3:
+         params[0] = ctx->Eval.Map1Vertex3;
+         break;
+      case GL_MAP1_VERTEX_4:
+         params[0] = ctx->Eval.Map1Vertex4;
+         break;
+      case GL_MAP2_COLOR_4:
+         params[0] = ctx->Eval.Map2Color4;
+         break;
+      case GL_MAP2_GRID_DOMAIN:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u1);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u2);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v1);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v2);
+         break;
+      case GL_MAP2_GRID_SEGMENTS:
+         params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2un);
+         params[1] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2vn);
+         break;
+      case GL_MAP2_INDEX:
+         params[0] = ctx->Eval.Map2Index;
+         break;
+      case GL_MAP2_NORMAL:
+         params[0] = ctx->Eval.Map2Normal;
+         break;
+      case GL_MAP2_TEXTURE_COORD_1:
+         params[0] = ctx->Eval.Map2TextureCoord1;
+         break;
+      case GL_MAP2_TEXTURE_COORD_2:
+         params[0] = ctx->Eval.Map2TextureCoord2;
+         break;
+      case GL_MAP2_TEXTURE_COORD_3:
+         params[0] = ctx->Eval.Map2TextureCoord3;
+         break;
+      case GL_MAP2_TEXTURE_COORD_4:
+         params[0] = ctx->Eval.Map2TextureCoord4;
+         break;
+      case GL_MAP2_VERTEX_3:
+         params[0] = ctx->Eval.Map2Vertex3;
+         break;
+      case GL_MAP2_VERTEX_4:
+         params[0] = ctx->Eval.Map2Vertex4;
+         break;
+      case GL_MAP_COLOR:
+         params[0] = ctx->Pixel.MapColorFlag;
+         break;
+      case GL_MAP_STENCIL:
+         params[0] = ctx->Pixel.MapStencilFlag;
+         break;
+      case GL_MATRIX_MODE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Transform.MatrixMode);
+         break;
+      case GL_MAX_ATTRIB_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(MAX_ATTRIB_STACK_DEPTH);
+         break;
+      case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(MAX_CLIENT_ATTRIB_STACK_DEPTH);
+         break;
+      case GL_MAX_CLIP_PLANES:
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxClipPlanes);
+         break;
+      case GL_MAX_ELEMENTS_VERTICES:
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize);
+         break;
+      case GL_MAX_ELEMENTS_INDICES:
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize);
+         break;
+      case GL_MAX_EVAL_ORDER:
+         params[0] = INT_TO_BOOLEAN(MAX_EVAL_ORDER);
+         break;
+      case GL_MAX_LIGHTS:
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxLights);
+         break;
+      case GL_MAX_LIST_NESTING:
+         params[0] = INT_TO_BOOLEAN(MAX_LIST_NESTING);
+         break;
+      case GL_MAX_MODELVIEW_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(MAX_MODELVIEW_STACK_DEPTH);
+         break;
+      case GL_MAX_NAME_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(MAX_NAME_STACK_DEPTH);
+         break;
+      case GL_MAX_PIXEL_MAP_TABLE:
+         params[0] = INT_TO_BOOLEAN(MAX_PIXEL_MAP_TABLE);
+         break;
+      case GL_MAX_PROJECTION_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(MAX_PROJECTION_STACK_DEPTH);
+         break;
+      case GL_MAX_TEXTURE_SIZE:
+         params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.MaxTextureLevels - 1));
+         break;
+      case GL_MAX_3D_TEXTURE_SIZE:
+         params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.Max3DTextureLevels - 1));
+         break;
+      case GL_MAX_TEXTURE_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(MAX_TEXTURE_STACK_DEPTH);
+         break;
+      case GL_MAX_VIEWPORT_DIMS:
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxViewportWidth);
+         params[1] = INT_TO_BOOLEAN(ctx->Const.MaxViewportHeight);
+         break;
+      case GL_MODELVIEW_MATRIX:
+         {
+         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_MODELVIEW_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(ctx->ModelviewMatrixStack.Depth + 1);
+         break;
+      case GL_NAME_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(ctx->Select.NameStackDepth);
+         break;
+      case GL_NORMALIZE:
+         params[0] = ctx->Transform.Normalize;
+         break;
+      case GL_PACK_ALIGNMENT:
+         params[0] = INT_TO_BOOLEAN(ctx->Pack.Alignment);
+         break;
+      case GL_PACK_LSB_FIRST:
+         params[0] = ctx->Pack.LsbFirst;
+         break;
+      case GL_PACK_ROW_LENGTH:
+         params[0] = INT_TO_BOOLEAN(ctx->Pack.RowLength);
+         break;
+      case GL_PACK_SKIP_PIXELS:
+         params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipPixels);
+         break;
+      case GL_PACK_SKIP_ROWS:
+         params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipRows);
+         break;
+      case GL_PACK_SWAP_BYTES:
+         params[0] = ctx->Pack.SwapBytes;
+         break;
+      case GL_PACK_SKIP_IMAGES_EXT:
+         params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipImages);
+         break;
+      case GL_PACK_IMAGE_HEIGHT_EXT:
+         params[0] = INT_TO_BOOLEAN(ctx->Pack.ImageHeight);
+         break;
+      case GL_PACK_INVERT_MESA:
+         params[0] = ctx->Pack.Invert;
+         break;
+      case GL_PERSPECTIVE_CORRECTION_HINT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection);
+         break;
+      case GL_PIXEL_MAP_A_TO_A_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapAtoAsize);
+         break;
+      case GL_PIXEL_MAP_B_TO_B_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapBtoBsize);
+         break;
+      case GL_PIXEL_MAP_G_TO_G_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapGtoGsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_A_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoAsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_B_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoBsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_G_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoGsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_I_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoIsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_R_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoRsize);
+         break;
+      case GL_PIXEL_MAP_R_TO_R_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapRtoRsize);
+         break;
+      case GL_PIXEL_MAP_S_TO_S_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapStoSsize);
+         break;
+      case GL_POINT_SIZE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size);
+         break;
+      case GL_POINT_SIZE_GRANULARITY:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.PointSizeGranularity);
+         break;
+      case GL_POINT_SIZE_RANGE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSizeAA);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSizeAA);
+         break;
+      case GL_ALIASED_POINT_SIZE_RANGE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSize);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSize);
+         break;
+      case GL_POINT_SMOOTH:
+         params[0] = ctx->Point.SmoothFlag;
+         break;
+      case GL_POINT_SMOOTH_HINT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PointSmooth);
+         break;
+      case GL_POINT_SIZE_MIN_EXT:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MinSize);
+         break;
+      case GL_POINT_SIZE_MAX_EXT:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MaxSize);
+         break;
+      case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Threshold);
+         break;
+      case GL_DISTANCE_ATTENUATION_EXT:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Params[0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Point.Params[1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Point.Params[2]);
+         break;
+      case GL_POLYGON_MODE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontMode);
+         params[1] = ENUM_TO_BOOLEAN(ctx->Polygon.BackMode);
+         break;
+      case GL_POLYGON_OFFSET_BIAS_EXT:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits);
+         break;
+      case GL_POLYGON_OFFSET_FACTOR:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetFactor );
+         break;
+      case GL_POLYGON_OFFSET_UNITS:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits );
+         break;
+      case GL_POLYGON_SMOOTH:
+         params[0] = ctx->Polygon.SmoothFlag;
+         break;
+      case GL_POLYGON_SMOOTH_HINT:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PolygonSmooth);
+         break;
+      case GL_POLYGON_STIPPLE:
+         params[0] = ctx->Polygon.StippleFlag;
+         break;
+      case GL_PROJECTION_MATRIX:
+         {
+         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_PROJECTION_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(ctx->ProjectionMatrixStack.Depth + 1);
+         break;
+      case GL_READ_BUFFER:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Pixel.ReadBuffer);
+         break;
+      case GL_RED_BIAS:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias);
+         break;
+      case GL_RED_BITS:
+         params[0] = INT_TO_BOOLEAN( ctx->Visual.redBits );
+         break;
+      case GL_RED_SCALE:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedScale);
+         break;
+      case GL_RENDER_MODE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->RenderMode);
+         break;
+      case GL_RESCALE_NORMAL:
+         params[0] = ctx->Transform.RescaleNormals;
+         break;
+      case GL_RGBA_MODE:
+         params[0] = ctx->Visual.rgbMode;
+         break;
+      case GL_SCISSOR_BOX:
+         params[0] = INT_TO_BOOLEAN(ctx->Scissor.X);
+         params[1] = INT_TO_BOOLEAN(ctx->Scissor.Y);
+         params[2] = INT_TO_BOOLEAN(ctx->Scissor.Width);
+         params[3] = INT_TO_BOOLEAN(ctx->Scissor.Height);
+         break;
+      case GL_SCISSOR_TEST:
+         params[0] = ctx->Scissor.Enabled;
+         break;
+      case GL_SELECTION_BUFFER_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Select.BufferSize);
+         break;
+      case GL_SHADE_MODEL:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Light.ShadeModel);
+         break;
+      case GL_SHARED_TEXTURE_PALETTE_EXT:
+         params[0] = ctx->Texture.SharedPalette;
+         break;
+      case GL_STENCIL_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Visual.stencilBits);
+         break;
+      case GL_STENCIL_CLEAR_VALUE:
+         params[0] = INT_TO_BOOLEAN(ctx->Stencil.Clear);
+         break;
+      case GL_STENCIL_FAIL:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_FUNC:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_PASS_DEPTH_FAIL:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_PASS_DEPTH_PASS:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_REF:
+         params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_TEST:
+         params[0] = ctx->Stencil.Enabled;
+         break;
+      case GL_STENCIL_VALUE_MASK:
+         params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_WRITEMASK:
+         params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STEREO:
+         params[0] = ctx->Visual.stereoMode;
+         break;
+      case GL_SUBPIXEL_BITS:
+         params[0] = INT_TO_BOOLEAN(ctx->Const.SubPixelBits);
+         break;
+      case GL_TEXTURE_1D:
+         params[0] = _mesa_IsEnabled(GL_TEXTURE_1D);
+         break;
+      case GL_TEXTURE_2D:
+         params[0] = _mesa_IsEnabled(GL_TEXTURE_2D);
+         break;
+      case GL_TEXTURE_3D:
+         params[0] = _mesa_IsEnabled(GL_TEXTURE_3D);
+         break;
+      case GL_TEXTURE_BINDING_1D:
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name);
+         break;
+      case GL_TEXTURE_BINDING_2D:
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name);
+         break;
+      case GL_TEXTURE_BINDING_3D:
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name);
+         break;
+      case GL_TEXTURE_ENV_COLOR:
+         {
+         const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
+         params[0] = FLOAT_TO_BOOLEAN(color[0]);
+         params[1] = FLOAT_TO_BOOLEAN(color[1]);
+         params[2] = FLOAT_TO_BOOLEAN(color[2]);
+         params[3] = FLOAT_TO_BOOLEAN(color[3]);
+         }
+         break;
+      case GL_TEXTURE_ENV_MODE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);
+         break;
+      case GL_TEXTURE_GEN_S:
+         params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0);
+         break;
+      case GL_TEXTURE_GEN_T:
+         params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0);
+         break;
+      case GL_TEXTURE_GEN_R:
+         params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0);
+         break;
+      case GL_TEXTURE_GEN_Q:
+         params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0);
+         break;
+      case GL_TEXTURE_MATRIX:
+         {
+         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_TEXTURE_STACK_DEPTH:
+         params[0] = INT_TO_BOOLEAN(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1);
+         break;
+      case GL_UNPACK_ALIGNMENT:
+         params[0] = INT_TO_BOOLEAN(ctx->Unpack.Alignment);
+         break;
+      case GL_UNPACK_LSB_FIRST:
+         params[0] = ctx->Unpack.LsbFirst;
+         break;
+      case GL_UNPACK_ROW_LENGTH:
+         params[0] = INT_TO_BOOLEAN(ctx->Unpack.RowLength);
+         break;
+      case GL_UNPACK_SKIP_PIXELS:
+         params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipPixels);
+         break;
+      case GL_UNPACK_SKIP_ROWS:
+         params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipRows);
+         break;
+      case GL_UNPACK_SWAP_BYTES:
+         params[0] = ctx->Unpack.SwapBytes;
+         break;
+      case GL_UNPACK_SKIP_IMAGES_EXT:
+         params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipImages);
+         break;
+      case GL_UNPACK_IMAGE_HEIGHT_EXT:
+         params[0] = INT_TO_BOOLEAN(ctx->Unpack.ImageHeight);
+         break;
+      case GL_UNPACK_CLIENT_STORAGE_APPLE:
+         params[0] = ctx->Unpack.ClientStorage;
+         break;
+      case GL_VIEWPORT:
+         params[0] = INT_TO_BOOLEAN(ctx->Viewport.X);
+         params[1] = INT_TO_BOOLEAN(ctx->Viewport.Y);
+         params[2] = INT_TO_BOOLEAN(ctx->Viewport.Width);
+         params[3] = INT_TO_BOOLEAN(ctx->Viewport.Height);
+         break;
+      case GL_ZOOM_X:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomX);
+         break;
+      case GL_ZOOM_Y:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomY);
+         break;
+      case GL_VERTEX_ARRAY:
+         params[0] = ctx->Array.Vertex.Enabled;
+         break;
+      case GL_VERTEX_ARRAY_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.Size);
+         break;
+      case GL_VERTEX_ARRAY_TYPE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Vertex.Type);
+         break;
+      case GL_VERTEX_ARRAY_STRIDE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.Stride);
+         break;
+      case GL_VERTEX_ARRAY_COUNT_EXT:
+         params[0] = INT_TO_BOOLEAN(0);
+         break;
+      case GL_NORMAL_ARRAY:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Normal.Enabled);
+         break;
+      case GL_NORMAL_ARRAY_TYPE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Normal.Type);
+         break;
+      case GL_NORMAL_ARRAY_STRIDE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Normal.Stride);
+         break;
+      case GL_NORMAL_ARRAY_COUNT_EXT:
+         params[0] = INT_TO_BOOLEAN(0);
+         break;
+      case GL_COLOR_ARRAY:
+         params[0] = ctx->Array.Color.Enabled;
+         break;
+      case GL_COLOR_ARRAY_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Color.Size);
+         break;
+      case GL_COLOR_ARRAY_TYPE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Color.Type);
+         break;
+      case GL_COLOR_ARRAY_STRIDE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Color.Stride);
+         break;
+      case GL_COLOR_ARRAY_COUNT_EXT:
+         params[0] = INT_TO_BOOLEAN(0);
+         break;
+      case GL_INDEX_ARRAY:
+         params[0] = ctx->Array.Index.Enabled;
+         break;
+      case GL_INDEX_ARRAY_TYPE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Array.Index.Type);
+         break;
+      case GL_INDEX_ARRAY_STRIDE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Index.Stride);
+         break;
+      case GL_INDEX_ARRAY_COUNT_EXT:
+         params[0] = INT_TO_BOOLEAN(0);
+         break;
+      case GL_TEXTURE_COORD_ARRAY:
+         params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
+         break;
+      case GL_TEXTURE_COORD_ARRAY_SIZE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_TYPE:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_STRIDE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
+         params[0] = INT_TO_BOOLEAN(0);
+         break;
+      case GL_EDGE_FLAG_ARRAY:
+         params[0] = ctx->Array.EdgeFlag.Enabled;
+         break;
+      case GL_EDGE_FLAG_ARRAY_STRIDE:
+         params[0] = INT_TO_BOOLEAN(ctx->Array.EdgeFlag.Stride);
+         break;
+      case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
+         params[0] = INT_TO_BOOLEAN(0);
+         break;
+      case GL_MAX_TEXTURE_UNITS_ARB:
+         CHECK_EXTENSION_B(ARB_multitexture, pname);
+         params[0] = INT_TO_BOOLEAN(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));
+         break;
+      case GL_ACTIVE_TEXTURE_ARB:
+         CHECK_EXTENSION_B(ARB_multitexture, pname);
+         params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit);
+         break;
+      case GL_CLIENT_ACTIVE_TEXTURE_ARB:
+         CHECK_EXTENSION_B(ARB_multitexture, pname);
+         params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);
+         break;
+      case GL_TEXTURE_CUBE_MAP_ARB:
+         CHECK_EXTENSION_B(ARB_texture_cube_map, pname);
+         params[0] = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+         break;
+      case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+         CHECK_EXTENSION_B(ARB_texture_cube_map, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name);
+         break;
+      case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+         CHECK_EXTENSION_B(ARB_texture_cube_map, pname);
+         params[0] = INT_TO_BOOLEAN((1 << (ctx->Const.MaxCubeTextureLevels - 1)));
+         break;
+      case GL_TEXTURE_COMPRESSION_HINT_ARB:
+         CHECK_EXTENSION_B(ARB_texture_compression, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Hint.TextureCompression);
+         break;
+      case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
+         CHECK_EXTENSION_B(ARB_texture_compression, pname);
+         params[0] = INT_TO_BOOLEAN(_mesa_get_compressed_formats(ctx, NULL));
+         break;
+      case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
+         CHECK_EXTENSION_B(ARB_texture_compression, pname);
+         {
+         GLint formats[100];
+         GLuint i, n = _mesa_get_compressed_formats(ctx, formats);
+         for (i = 0; i < n; i++)
+            params[i] = ENUM_TO_BOOLEAN(formats[i]);
+         }
+         break;
+      case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
+         CHECK_EXTENSION_B(EXT_compiled_vertex_array, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.LockFirst);
+         break;
+      case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:
+         CHECK_EXTENSION_B(EXT_compiled_vertex_array, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.LockCount);
+         break;
+      case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_OCCLUSION_TEST_HP:
+         CHECK_EXTENSION_B(HP_occlusion_test, pname);
+         params[0] = ctx->Depth.OcclusionTest;
+         break;
+      case GL_OCCLUSION_TEST_RESULT_HP:
+         CHECK_EXTENSION_B(HP_occlusion_test, pname);
+         {
+         if (ctx->Depth.OcclusionTest)
+            params[0] = ctx->OcclusionResult;
+         else
+            params[0] = ctx->OcclusionResultSaved;
+         /* reset flag now */
+         ctx->OcclusionResult = GL_FALSE;
+         ctx->OcclusionResultSaved = GL_FALSE;
+         return;
+         }
+         break;
+      case GL_PIXEL_TEXTURE_SGIS:
+         CHECK_EXTENSION_B(SGIS_pixel_texture, pname);
+         params[0] = ctx->Pixel.PixelTextureEnabled;
+         break;
+      case GL_PIXEL_TEX_GEN_SGIX:
+         CHECK_EXTENSION_B(SGIX_pixel_texture, pname);
+         params[0] = ctx->Pixel.PixelTextureEnabled;
+         break;
+      case GL_PIXEL_TEX_GEN_MODE_SGIX:
+         CHECK_EXTENSION_B(SGIX_pixel_texture, pname);
+         params[0] = ENUM_TO_BOOLEAN(pixel_texgen_mode(ctx));
+         break;
+      case GL_COLOR_MATRIX_SGI:
+         {
+         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+         params[0] = INT_TO_BOOLEAN(ctx->ColorMatrixStack.Depth + 1);
+         break;
+      case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+         params[0] = INT_TO_BOOLEAN(MAX_COLOR_STACK_DEPTH);
+         break;
+      case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[0]);
+         break;
+      case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[1]);
+         break;
+      case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[2]);
+         break;
+      case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[3]);
+         break;
+      case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[0]);
+         break;
+      case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[1]);
+         break;
+      case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[2]);
+         break;
+      case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[3]);
+         break;
+      case GL_CONVOLUTION_1D_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = ctx->Pixel.Convolution1DEnabled;
+         break;
+      case GL_CONVOLUTION_2D_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = ctx->Pixel.Convolution2DEnabled;
+         break;
+      case GL_SEPARABLE_2D_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = ctx->Pixel.Separable2DEnabled;
+         break;
+      case GL_POST_CONVOLUTION_RED_SCALE_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[0]);
+         break;
+      case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[1]);
+         break;
+      case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[2]);
+         break;
+      case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[3]);
+         break;
+      case GL_POST_CONVOLUTION_RED_BIAS_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[0]);
+         break;
+      case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[1]);
+         break;
+      case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[2]);
+         break;
+      case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:
+         CHECK_EXTENSION_B(EXT_convolution, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[3]);
+         break;
+      case GL_HISTOGRAM:
+         CHECK_EXTENSION_B(EXT_histogram, pname);
+         params[0] = ctx->Pixel.HistogramEnabled;
+         break;
+      case GL_MINMAX:
+         CHECK_EXTENSION_B(EXT_histogram, pname);
+         params[0] = ctx->Pixel.MinMaxEnabled;
+         break;
+      case GL_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_B(SGI_color_table, pname);
+         params[0] = ctx->Pixel.ColorTableEnabled;
+         break;
+      case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_B(SGI_color_table, pname);
+         params[0] = ctx->Pixel.PostConvolutionColorTableEnabled;
+         break;
+      case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_B(SGI_color_table, pname);
+         params[0] = ctx->Pixel.PostColorMatrixColorTableEnabled;
+         break;
+      case GL_TEXTURE_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_B(SGI_texture_color_table, pname);
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled;
+         break;
+      case GL_COLOR_SUM_EXT:
+         CHECK_EXTENSION_B(EXT_secondary_color, pname);
+         params[0] = ctx->Fog.ColorSumEnabled;
+         break;
+      case GL_CURRENT_SECONDARY_COLOR_EXT:
+         CHECK_EXTENSION_B(EXT_secondary_color, pname);
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
+         params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
+         params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
+         }
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_EXT:
+         CHECK_EXTENSION_B(EXT_secondary_color, pname);
+         params[0] = ctx->Array.SecondaryColor.Enabled;
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+         CHECK_EXTENSION_B(EXT_secondary_color, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Array.SecondaryColor.Type);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+         CHECK_EXTENSION_B(EXT_secondary_color, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.Stride);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+         CHECK_EXTENSION_B(EXT_secondary_color, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.Size);
+         break;
+      case GL_CURRENT_FOG_COORDINATE_EXT:
+         CHECK_EXTENSION_B(EXT_fog_coord, pname);
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
+         }
+         break;
+      case GL_FOG_COORDINATE_ARRAY_EXT:
+         CHECK_EXTENSION_B(EXT_fog_coord, pname);
+         params[0] = ctx->Array.FogCoord.Enabled;
+         break;
+      case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+         CHECK_EXTENSION_B(EXT_fog_coord, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Array.FogCoord.Type);
+         break;
+      case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+         CHECK_EXTENSION_B(EXT_fog_coord, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.FogCoord.Stride);
+         break;
+      case GL_FOG_COORDINATE_SOURCE_EXT:
+         CHECK_EXTENSION_B(EXT_fog_coord, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Fog.FogCoordinateSource);
+         break;
+      case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+         CHECK_EXTENSION_B(EXT_texture_lod_bias, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureLodBias);
+         break;
+      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+         CHECK_EXTENSION_B(EXT_texture_filter_anisotropic, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureMaxAnisotropy);
+         break;
+      case GL_MULTISAMPLE_ARB:
+         CHECK_EXTENSION_B(ARB_multisample, pname);
+         params[0] = ctx->Multisample.Enabled;
+         break;
+      case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+         CHECK_EXTENSION_B(ARB_multisample, pname);
+         params[0] = ctx->Multisample.SampleAlphaToCoverage;
+         break;
+      case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+         CHECK_EXTENSION_B(ARB_multisample, pname);
+         params[0] = ctx->Multisample.SampleAlphaToOne;
+         break;
+      case GL_SAMPLE_COVERAGE_ARB:
+         CHECK_EXTENSION_B(ARB_multisample, pname);
+         params[0] = ctx->Multisample.SampleCoverage;
+         break;
+      case GL_SAMPLE_COVERAGE_VALUE_ARB:
+         CHECK_EXTENSION_B(ARB_multisample, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Multisample.SampleCoverageValue);
+         break;
+      case GL_SAMPLE_COVERAGE_INVERT_ARB:
+         CHECK_EXTENSION_B(ARB_multisample, pname);
+         params[0] = ctx->Multisample.SampleCoverageInvert;
+         break;
+      case GL_SAMPLE_BUFFERS_ARB:
+         CHECK_EXTENSION_B(ARB_multisample, pname);
+         params[0] = INT_TO_BOOLEAN(0);
+         break;
+      case GL_SAMPLES_ARB:
+         CHECK_EXTENSION_B(ARB_multisample, pname);
+         params[0] = INT_TO_BOOLEAN(0);
+         break;
+      case GL_RASTER_POSITION_UNCLIPPED_IBM:
+         CHECK_EXTENSION_B(IBM_rasterpos_clip, pname);
+         params[0] = ctx->Transform.RasterPositionUnclipped;
+         break;
+      case GL_POINT_SPRITE_NV:
+         CHECK_EXTENSION_B(NV_point_sprite, pname);
+         params[0] = ctx->Point.PointSprite;
+         break;
+      case GL_POINT_SPRITE_R_MODE_NV:
+         CHECK_EXTENSION_B(NV_point_sprite, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteRMode);
+         break;
+      case GL_POINT_SPRITE_COORD_ORIGIN:
+         CHECK_EXTENSION_B(NV_point_sprite, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteOrigin);
+         break;
+      case GL_GENERATE_MIPMAP_HINT_SGIS:
+         CHECK_EXTENSION_B(SGIS_generate_mipmap, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.GenerateMipmap);
+         break;
+      case GL_VERTEX_PROGRAM_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->VertexProgram.Enabled;
+         break;
+      case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->VertexProgram.PointSizeEnabled;
+         break;
+      case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->VertexProgram.TwoSideEnabled;
+         break;
+      case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrixStackDepth);
+         break;
+      case GL_MAX_TRACK_MATRICES_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrices);
+         break;
+      case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->CurrentStack->Depth + 1;
+         break;
+      case GL_CURRENT_MATRIX_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         {
+         const GLfloat *matrix = ctx->CurrentStack->Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_VERTEX_PROGRAM_BINDING_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = INT_TO_BOOLEAN((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0));
+         break;
+      case GL_PROGRAM_ERROR_POSITION_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Program.ErrorPos);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY0_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[0].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY1_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[1].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY2_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[2].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY3_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[3].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[4].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY5_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[5].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY6_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[6].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY7_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[7].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY8_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[8].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY9_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[9].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY10_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[10].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY11_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[11].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY12_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[12].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY13_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[13].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY14_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[14].Enabled;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY15_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Array.VertexAttrib[15].Enabled;
+         break;
+      case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[0];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[1];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[2];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[3];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[4];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[5];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[6];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[7];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[8];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[9];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[10];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[11];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[12];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[13];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[14];
+         break;
+      case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+         CHECK_EXTENSION_B(NV_vertex_program, pname);
+         params[0] = ctx->Eval.Map1Attrib[15];
+         break;
+      case GL_FRAGMENT_PROGRAM_NV:
+         CHECK_EXTENSION_B(NV_fragment_program, pname);
+         params[0] = ctx->FragmentProgram.Enabled;
+         break;
+      case GL_MAX_TEXTURE_COORDS_NV:
+         CHECK_EXTENSION_B(NV_fragment_program, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureCoordUnits);
+         break;
+      case GL_MAX_TEXTURE_IMAGE_UNITS_NV:
+         CHECK_EXTENSION_B(NV_fragment_program, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureImageUnits);
+         break;
+      case GL_FRAGMENT_PROGRAM_BINDING_NV:
+         CHECK_EXTENSION_B(NV_fragment_program, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0);
+         break;
+      case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:
+         CHECK_EXTENSION_B(NV_fragment_program, pname);
+         params[0] = INT_TO_BOOLEAN(MAX_NV_FRAGMENT_PROGRAM_PARAMS);
+         break;
+      case GL_TEXTURE_RECTANGLE_NV:
+         CHECK_EXTENSION_B(NV_texture_rectangle, pname);
+         params[0] = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+         break;
+      case GL_TEXTURE_BINDING_RECTANGLE_NV:
+         CHECK_EXTENSION_B(NV_texture_rectangle, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name);
+         break;
+      case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+         CHECK_EXTENSION_B(NV_texture_rectangle, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureRectSize);
+         break;
+      case GL_STENCIL_TEST_TWO_SIDE_EXT:
+         CHECK_EXTENSION_B(EXT_stencil_two_side, pname);
+         params[0] = ctx->Stencil.TestTwoSide;
+         break;
+      case GL_ACTIVE_STENCIL_FACE_EXT:
+         CHECK_EXTENSION_B(EXT_stencil_two_side, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
+         break;
+      case GL_MAX_SHININESS_NV:
+         CHECK_EXTENSION_B(NV_light_max_exponent, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxShininess);
+         break;
+      case GL_MAX_SPOT_EXPONENT_NV:
+         CHECK_EXTENSION_B(NV_light_max_exponent, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxSpotExponent);
+         break;
+      case GL_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayBufferObj->Name);
+         break;
+      case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.BufferObj->Name);
+         break;
+      case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Normal.BufferObj->Name);
+         break;
+      case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Color.BufferObj->Name);
+         break;
+      case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.Index.BufferObj->Name);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name);
+         break;
+      case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.EdgeFlag.BufferObj->Name);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.BufferObj->Name);
+         break;
+      case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.FogCoord.BufferObj->Name);
+         break;
+      case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Array.ElementArrayBufferObj->Name);
+         break;
+      case GL_PIXEL_PACK_BUFFER_BINDING_EXT:
+         CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Pack.BufferObj->Name);
+         break;
+      case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:
+         CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Unpack.BufferObj->Name);
+         break;
+      case GL_MAX_VERTEX_ATTRIBS_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_program, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVertexProgramAttribs);
+         break;
+      case GL_FRAGMENT_PROGRAM_ARB:
+         CHECK_EXTENSION_B(ARB_fragment_program, pname);
+         params[0] = ctx->FragmentProgram.Enabled;
+         break;
+      case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+         CHECK_EXTENSION_B(ARB_fragment_program, pname);
+         {
+         const GLfloat *matrix = ctx->CurrentStack->Top->m;
+         params[0] = FLOAT_TO_BOOLEAN(matrix[0]);
+         params[1] = FLOAT_TO_BOOLEAN(matrix[4]);
+         params[2] = FLOAT_TO_BOOLEAN(matrix[8]);
+         params[3] = FLOAT_TO_BOOLEAN(matrix[12]);
+         params[4] = FLOAT_TO_BOOLEAN(matrix[1]);
+         params[5] = FLOAT_TO_BOOLEAN(matrix[5]);
+         params[6] = FLOAT_TO_BOOLEAN(matrix[9]);
+         params[7] = FLOAT_TO_BOOLEAN(matrix[13]);
+         params[8] = FLOAT_TO_BOOLEAN(matrix[2]);
+         params[9] = FLOAT_TO_BOOLEAN(matrix[6]);
+         params[10] = FLOAT_TO_BOOLEAN(matrix[10]);
+         params[11] = FLOAT_TO_BOOLEAN(matrix[14]);
+         params[12] = FLOAT_TO_BOOLEAN(matrix[3]);
+         params[13] = FLOAT_TO_BOOLEAN(matrix[7]);
+         params[14] = FLOAT_TO_BOOLEAN(matrix[11]);
+         params[15] = FLOAT_TO_BOOLEAN(matrix[15]);
+         }
+         break;
+      case GL_DEPTH_BOUNDS_TEST_EXT:
+         CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);
+         params[0] = ctx->Depth.BoundsTest;
+         break;
+      case GL_DEPTH_BOUNDS_EXT:
+         CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);
+         params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin);
+         params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax);
+         break;
+      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+         CHECK_EXTENSION_B(MESA_program_debug, pname);
+         params[0] = ctx->FragmentProgram.CallbackEnabled;
+         break;
+      case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+         CHECK_EXTENSION_B(MESA_program_debug, pname);
+         params[0] = ctx->VertexProgram.CallbackEnabled;
+         break;
+      case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+         CHECK_EXTENSION_B(MESA_program_debug, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.CurrentPosition);
+         break;
+      case GL_VERTEX_PROGRAM_POSITION_MESA:
+         CHECK_EXTENSION_B(MESA_program_debug, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->VertexProgram.CurrentPosition);
+         break;
+      case GL_MAX_DRAW_BUFFERS_ARB:
+         CHECK_EXTENSION_B(ARB_draw_buffers, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers);
+         break;
+      case GL_DRAW_BUFFER0_ARB:
+         CHECK_EXTENSION_B(ARB_draw_buffers, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Color.DrawBuffer[0]);
+         break;
+      case GL_DRAW_BUFFER1_ARB:
+         CHECK_EXTENSION_B(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[1];
+         params[0] = ENUM_TO_BOOLEAN(buffer);
+         }
+         break;
+      case GL_DRAW_BUFFER2_ARB:
+         CHECK_EXTENSION_B(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[2];
+         params[0] = ENUM_TO_BOOLEAN(buffer);
+         }
+         break;
+      case GL_DRAW_BUFFER3_ARB:
+         CHECK_EXTENSION_B(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[3];
+         params[0] = ENUM_TO_BOOLEAN(buffer);
+         }
+         break;
+      case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
+         CHECK_EXTENSION_B(OES_read_format, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType);
+         break;
+      case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
+         CHECK_EXTENSION_B(OES_read_format, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat);
+         break;
+      case GL_NUM_FRAGMENT_REGISTERS_ATI:
+         CHECK_EXTENSION_B(ATI_fragment_shader, pname);
+         params[0] = INT_TO_BOOLEAN(6);
+         break;
+      case GL_NUM_FRAGMENT_CONSTANTS_ATI:
+         CHECK_EXTENSION_B(ATI_fragment_shader, pname);
+         params[0] = INT_TO_BOOLEAN(8);
+         break;
+      case GL_NUM_PASSES_ATI:
+         CHECK_EXTENSION_B(ATI_fragment_shader, pname);
+         params[0] = INT_TO_BOOLEAN(2);
+         break;
+      case GL_NUM_INSTRUCTIONS_PER_PASS_ATI:
+         CHECK_EXTENSION_B(ATI_fragment_shader, pname);
+         params[0] = INT_TO_BOOLEAN(8);
+         break;
+      case GL_NUM_INSTRUCTIONS_TOTAL_ATI:
+         CHECK_EXTENSION_B(ATI_fragment_shader, pname);
+         params[0] = INT_TO_BOOLEAN(16);
+         break;
+      case GL_COLOR_ALPHA_PAIRING_ATI:
+         CHECK_EXTENSION_B(ATI_fragment_shader, pname);
+         params[0] = GL_TRUE;
+         break;
+      case GL_NUM_LOOPBACK_COMPONENTS_ATI:
+         CHECK_EXTENSION_B(ATI_fragment_shader, pname);
+         params[0] = INT_TO_BOOLEAN(3);
+         break;
+      case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI:
+         CHECK_EXTENSION_B(ATI_fragment_shader, pname);
+         params[0] = INT_TO_BOOLEAN(3);
+         break;
+      case GL_STENCIL_BACK_FUNC:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[1]);
+         break;
+      case GL_STENCIL_BACK_VALUE_MASK:
+         params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[1]);
+         break;
+      case GL_STENCIL_BACK_REF:
+         params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[1]);
+         break;
+      case GL_STENCIL_BACK_FAIL:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[1]);
+         break;
+      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[1]);
+         break;
+      case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+         params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[1]);
+         break;
+      case GL_FRAMEBUFFER_BINDING_EXT:
+         CHECK_EXTENSION_B(EXT_framebuffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->CurrentFramebuffer ? ctx->CurrentFramebuffer->Name : 0);
+         break;
+      case GL_RENDERBUFFER_BINDING_EXT:
+         CHECK_EXTENSION_B(EXT_framebuffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0);
+         break;
+      case GL_MAX_COLOR_ATTACHMENTS_EXT:
+         CHECK_EXTENSION_B(EXT_framebuffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxColorAttachments);
+         break;
+      case GL_MAX_RENDERBUFFER_SIZE_EXT:
+         CHECK_EXTENSION_B(EXT_framebuffer_object, pname);
+         params[0] = INT_TO_BOOLEAN(ctx->Const.MaxRenderbufferSize);
+         break;
+      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:
+         CHECK_EXTENSION_B(ARB_fragment_shader, pname);
+         params[0] = INT_TO_BOOLEAN(MAX_FRAGMENT_UNIFORM_COMPONENTS);
+         break;
+      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
+         CHECK_EXTENSION_B(ARB_fragment_shader, pname);
+         params[0] = ENUM_TO_BOOLEAN(ctx->Hint.FragmentShaderDerivative);
+         break;
+      case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_shader, pname);
+         params[0] = INT_TO_BOOLEAN(MAX_VERTEX_UNIFORM_COMPONENTS);
+         break;
+      case GL_MAX_VARYING_FLOATS_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_shader, pname);
+         params[0] = INT_TO_BOOLEAN(MAX_VARYING_FLOATS);
+         break;
+      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_shader, pname);
+         params[0] = INT_TO_BOOLEAN(MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+         break;
+      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
+         CHECK_EXTENSION_B(ARB_vertex_shader, pname);
+         params[0] = INT_TO_BOOLEAN(MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+         break;
+      default:
+         _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
+   }
+}
+
+void GLAPIENTRY
+_mesa_GetFloatv( GLenum pname, GLfloat *params )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (!params)
+      return;
+
+   if (ctx->Driver.GetFloatv &&
+       ctx->Driver.GetFloatv(ctx, pname, params))
+      return;
+
+   switch (pname) {
+      case GL_ACCUM_RED_BITS:
+         params[0] = (GLfloat)(ctx->Visual.accumRedBits);
+         break;
+      case GL_ACCUM_GREEN_BITS:
+         params[0] = (GLfloat)(ctx->Visual.accumGreenBits);
+         break;
+      case GL_ACCUM_BLUE_BITS:
+         params[0] = (GLfloat)(ctx->Visual.accumBlueBits);
+         break;
+      case GL_ACCUM_ALPHA_BITS:
+         params[0] = (GLfloat)(ctx->Visual.accumAlphaBits);
+         break;
+      case GL_ACCUM_CLEAR_VALUE:
+         params[0] = ctx->Accum.ClearColor[0];
+         params[1] = ctx->Accum.ClearColor[1];
+         params[2] = ctx->Accum.ClearColor[2];
+         params[3] = ctx->Accum.ClearColor[3];
+         break;
+      case GL_ALPHA_BIAS:
+         params[0] = ctx->Pixel.AlphaBias;
+         break;
+      case GL_ALPHA_BITS:
+         params[0] = (GLfloat)(ctx->Visual.alphaBits);
+         break;
+      case GL_ALPHA_SCALE:
+         params[0] = ctx->Pixel.AlphaScale;
+         break;
+      case GL_ALPHA_TEST:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.AlphaEnabled);
+         break;
+      case GL_ALPHA_TEST_FUNC:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.AlphaFunc);
+         break;
+      case GL_ALPHA_TEST_REF:
+         params[0] = ctx->Color.AlphaRef;
+         break;
+      case GL_ATTRIB_STACK_DEPTH:
+         params[0] = (GLfloat)(ctx->AttribStackDepth);
+         break;
+      case GL_AUTO_NORMAL:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.AutoNormal);
+         break;
+      case GL_AUX_BUFFERS:
+         params[0] = (GLfloat)(ctx->Visual.numAuxBuffers);
+         break;
+      case GL_BLEND:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.BlendEnabled);
+         break;
+      case GL_BLEND_DST:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB);
+         break;
+      case GL_BLEND_SRC:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB);
+         break;
+      case GL_BLEND_SRC_RGB_EXT:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB);
+         break;
+      case GL_BLEND_DST_RGB_EXT:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB);
+         break;
+      case GL_BLEND_SRC_ALPHA_EXT:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcA);
+         break;
+      case GL_BLEND_DST_ALPHA_EXT:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstA);
+         break;
+      case GL_BLEND_EQUATION:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationRGB );
+         break;
+      case GL_BLEND_EQUATION_ALPHA_EXT:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationA );
+         break;
+      case GL_BLEND_COLOR_EXT:
+         params[0] = ctx->Color.BlendColor[0];
+         params[1] = ctx->Color.BlendColor[1];
+         params[2] = ctx->Color.BlendColor[2];
+         params[3] = ctx->Color.BlendColor[3];
+         break;
+      case GL_BLUE_BIAS:
+         params[0] = ctx->Pixel.BlueBias;
+         break;
+      case GL_BLUE_BITS:
+         params[0] = (GLfloat)(ctx->Visual.blueBits);
+         break;
+      case GL_BLUE_SCALE:
+         params[0] = ctx->Pixel.BlueScale;
+         break;
+      case GL_CLIENT_ATTRIB_STACK_DEPTH:
+         params[0] = (GLfloat)(ctx->ClientAttribStackDepth);
+         break;
+      case GL_CLIP_PLANE0:
+         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 0) & 1);
+         break;
+      case GL_CLIP_PLANE1:
+         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 1) & 1);
+         break;
+      case GL_CLIP_PLANE2:
+         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 2) & 1);
+         break;
+      case GL_CLIP_PLANE3:
+         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 3) & 1);
+         break;
+      case GL_CLIP_PLANE4:
+         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 4) & 1);
+         break;
+      case GL_CLIP_PLANE5:
+         params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 5) & 1);
+         break;
+      case GL_COLOR_CLEAR_VALUE:
+         params[0] = ctx->Color.ClearColor[0];
+         params[1] = ctx->Color.ClearColor[1];
+         params[2] = ctx->Color.ClearColor[2];
+         params[3] = ctx->Color.ClearColor[3];
+         break;
+      case GL_COLOR_MATERIAL:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ColorMaterialEnabled);
+         break;
+      case GL_COLOR_MATERIAL_FACE:
+         params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace);
+         break;
+      case GL_COLOR_MATERIAL_PARAMETER:
+         params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode);
+         break;
+      case GL_COLOR_WRITEMASK:
+         params[0] = (GLfloat)(ctx->Color.ColorMask[RCOMP] ? 1 : 0);
+         params[1] = (GLfloat)(ctx->Color.ColorMask[GCOMP] ? 1 : 0);
+         params[2] = (GLfloat)(ctx->Color.ColorMask[BCOMP] ? 1 : 0);
+         params[3] = (GLfloat)(ctx->Color.ColorMask[ACOMP] ? 1 : 0);
+         break;
+      case GL_CULL_FACE:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.CullFlag);
+         break;
+      case GL_CULL_FACE_MODE:
+         params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
+         break;
+      case GL_CURRENT_COLOR:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
+         params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
+         params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
+         params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
+         }
+         break;
+      case GL_CURRENT_INDEX:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = ctx->Current.Index;
+         }
+         break;
+      case GL_CURRENT_NORMAL:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
+         params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
+         params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
+         }
+         break;
+      case GL_CURRENT_RASTER_COLOR:
+         params[0] = ctx->Current.RasterColor[0];
+         params[1] = ctx->Current.RasterColor[1];
+         params[2] = ctx->Current.RasterColor[2];
+         params[3] = ctx->Current.RasterColor[3];
+         break;
+      case GL_CURRENT_RASTER_DISTANCE:
+         params[0] = ctx->Current.RasterDistance;
+         break;
+      case GL_CURRENT_RASTER_INDEX:
+         params[0] = ctx->Current.RasterIndex;
+         break;
+      case GL_CURRENT_RASTER_POSITION:
+         params[0] = ctx->Current.RasterPos[0];
+         params[1] = ctx->Current.RasterPos[1];
+         params[2] = ctx->Current.RasterPos[2];
+         params[3] = ctx->Current.RasterPos[3];
+         break;
+      case GL_CURRENT_RASTER_TEXTURE_COORDS:
+         {
+         const GLuint texUnit = ctx->Texture.CurrentUnit;
+         params[0] = ctx->Current.RasterTexCoords[texUnit][0];
+         params[1] = ctx->Current.RasterTexCoords[texUnit][1];
+         params[2] = ctx->Current.RasterTexCoords[texUnit][2];
+         params[3] = ctx->Current.RasterTexCoords[texUnit][3];
+         }
+         break;
+      case GL_CURRENT_RASTER_POSITION_VALID:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Current.RasterPosValid);
+         break;
+      case GL_CURRENT_TEXTURE_COORDS:
+         {
+         const GLuint texUnit = ctx->Texture.CurrentUnit;
+         params[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0];
+         params[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1];
+         params[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2];
+         params[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3];
+         }
+         break;
+      case GL_DEPTH_BIAS:
+         params[0] = ctx->Pixel.DepthBias;
+         break;
+      case GL_DEPTH_BITS:
+         params[0] = (GLfloat)(ctx->Visual.depthBits);
+         break;
+      case GL_DEPTH_CLEAR_VALUE:
+         params[0] = ctx->Depth.Clear;
+         break;
+      case GL_DEPTH_FUNC:
+         params[0] = ENUM_TO_FLOAT(ctx->Depth.Func);
+         break;
+      case GL_DEPTH_RANGE:
+         params[0] = ctx->Viewport.Near;
+         params[1] = ctx->Viewport.Far;
+         break;
+      case GL_DEPTH_SCALE:
+         params[0] = ctx->Pixel.DepthScale;
+         break;
+      case GL_DEPTH_TEST:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Test);
+         break;
+      case GL_DEPTH_WRITEMASK:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Mask);
+         break;
+      case GL_DITHER:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.DitherFlag);
+         break;
+      case GL_DOUBLEBUFFER:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Visual.doubleBufferMode);
+         break;
+      case GL_DRAW_BUFFER:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]);
+         break;
+      case GL_EDGE_FLAG:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Current.EdgeFlag);
+         }
+         break;
+      case GL_FEEDBACK_BUFFER_SIZE:
+         params[0] = (GLfloat)(ctx->Feedback.BufferSize);
+         break;
+      case GL_FEEDBACK_BUFFER_TYPE:
+         params[0] = ENUM_TO_FLOAT(ctx->Feedback.Type);
+         break;
+      case GL_FOG:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.Enabled);
+         break;
+      case GL_FOG_COLOR:
+         params[0] = ctx->Fog.Color[0];
+         params[1] = ctx->Fog.Color[1];
+         params[2] = ctx->Fog.Color[2];
+         params[3] = ctx->Fog.Color[3];
+         break;
+      case GL_FOG_DENSITY:
+         params[0] = ctx->Fog.Density;
+         break;
+      case GL_FOG_END:
+         params[0] = ctx->Fog.End;
+         break;
+      case GL_FOG_HINT:
+         params[0] = ENUM_TO_FLOAT(ctx->Hint.Fog);
+         break;
+      case GL_FOG_INDEX:
+         params[0] = ctx->Fog.Index;
+         break;
+      case GL_FOG_MODE:
+         params[0] = ENUM_TO_FLOAT(ctx->Fog.Mode);
+         break;
+      case GL_FOG_START:
+         params[0] = ctx->Fog.Start;
+         break;
+      case GL_FRONT_FACE:
+         params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontFace);
+         break;
+      case GL_GREEN_BIAS:
+         params[0] = ctx->Pixel.GreenBias;
+         break;
+      case GL_GREEN_BITS:
+         params[0] = (GLfloat)(ctx->Visual.greenBits);
+         break;
+      case GL_GREEN_SCALE:
+         params[0] = ctx->Pixel.GreenScale;
+         break;
+      case GL_INDEX_BITS:
+         params[0] = (GLfloat)(ctx->Visual.indexBits);
+         break;
+      case GL_INDEX_CLEAR_VALUE:
+         params[0] = (GLfloat)(ctx->Color.ClearIndex);
+         break;
+      case GL_INDEX_MODE:
+         params[0] = BOOLEAN_TO_FLOAT(!ctx->Visual.rgbMode);
+         break;
+      case GL_INDEX_OFFSET:
+         params[0] = (GLfloat)(ctx->Pixel.IndexOffset);
+         break;
+      case GL_INDEX_SHIFT:
+         params[0] = (GLfloat)(ctx->Pixel.IndexShift);
+         break;
+      case GL_INDEX_WRITEMASK:
+         params[0] = (GLfloat)(ctx->Color.IndexMask);
+         break;
+      case GL_LIGHT0:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[0].Enabled);
+         break;
+      case GL_LIGHT1:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[1].Enabled);
+         break;
+      case GL_LIGHT2:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[2].Enabled);
+         break;
+      case GL_LIGHT3:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[3].Enabled);
+         break;
+      case GL_LIGHT4:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[4].Enabled);
+         break;
+      case GL_LIGHT5:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[5].Enabled);
+         break;
+      case GL_LIGHT6:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[6].Enabled);
+         break;
+      case GL_LIGHT7:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[7].Enabled);
+         break;
+      case GL_LIGHTING:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Enabled);
+         break;
+      case GL_LIGHT_MODEL_AMBIENT:
+         params[0] = ctx->Light.Model.Ambient[0];
+         params[1] = ctx->Light.Model.Ambient[1];
+         params[2] = ctx->Light.Model.Ambient[2];
+         params[3] = ctx->Light.Model.Ambient[3];
+         break;
+      case GL_LIGHT_MODEL_COLOR_CONTROL:
+         params[0] = ENUM_TO_FLOAT(ctx->Light.Model.ColorControl);
+         break;
+      case GL_LIGHT_MODEL_LOCAL_VIEWER:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.LocalViewer);
+         break;
+      case GL_LIGHT_MODEL_TWO_SIDE:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.TwoSide);
+         break;
+      case GL_LINE_SMOOTH:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Line.SmoothFlag);
+         break;
+      case GL_LINE_SMOOTH_HINT:
+         params[0] = ENUM_TO_FLOAT(ctx->Hint.LineSmooth);
+         break;
+      case GL_LINE_STIPPLE:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Line.StippleFlag);
+         break;
+      case GL_LINE_STIPPLE_PATTERN:
+         params[0] = (GLfloat)(ctx->Line.StipplePattern);
+         break;
+      case GL_LINE_STIPPLE_REPEAT:
+         params[0] = (GLfloat)(ctx->Line.StippleFactor);
+         break;
+      case GL_LINE_WIDTH:
+         params[0] = ctx->Line.Width;
+         break;
+      case GL_LINE_WIDTH_GRANULARITY:
+         params[0] = ctx->Const.LineWidthGranularity;
+         break;
+      case GL_LINE_WIDTH_RANGE:
+         params[0] = ctx->Const.MinLineWidthAA;
+         params[1] = ctx->Const.MaxLineWidthAA;
+         break;
+      case GL_ALIASED_LINE_WIDTH_RANGE:
+         params[0] = ctx->Const.MinLineWidth;
+         params[1] = ctx->Const.MaxLineWidth;
+         break;
+      case GL_LIST_BASE:
+         params[0] = (GLfloat)(ctx->List.ListBase);
+         break;
+      case GL_LIST_INDEX:
+         params[0] = (GLfloat)(ctx->ListState.CurrentListNum);
+         break;
+      case GL_LIST_MODE:
+         {
+         GLenum mode;
+         if (!ctx->CompileFlag)
+            mode = 0;
+         else if (ctx->ExecuteFlag)
+            mode = GL_COMPILE_AND_EXECUTE;
+         else
+            mode = GL_COMPILE;
+         params[0] = ENUM_TO_FLOAT(mode);
+         }
+         break;
+      case GL_INDEX_LOGIC_OP:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.IndexLogicOpEnabled);
+         break;
+      case GL_COLOR_LOGIC_OP:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Color.ColorLogicOpEnabled);
+         break;
+      case GL_LOGIC_OP_MODE:
+         params[0] = ENUM_TO_FLOAT(ctx->Color.LogicOp);
+         break;
+      case GL_MAP1_COLOR_4:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Color4);
+         break;
+      case GL_MAP1_GRID_DOMAIN:
+         params[0] = ctx->Eval.MapGrid1u1;
+         params[1] = ctx->Eval.MapGrid1u2;
+         break;
+      case GL_MAP1_GRID_SEGMENTS:
+         params[0] = (GLfloat)(ctx->Eval.MapGrid1un);
+         break;
+      case GL_MAP1_INDEX:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Index);
+         break;
+      case GL_MAP1_NORMAL:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Normal);
+         break;
+      case GL_MAP1_TEXTURE_COORD_1:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord1);
+         break;
+      case GL_MAP1_TEXTURE_COORD_2:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord2);
+         break;
+      case GL_MAP1_TEXTURE_COORD_3:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord3);
+         break;
+      case GL_MAP1_TEXTURE_COORD_4:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord4);
+         break;
+      case GL_MAP1_VERTEX_3:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex3);
+         break;
+      case GL_MAP1_VERTEX_4:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex4);
+         break;
+      case GL_MAP2_COLOR_4:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Color4);
+         break;
+      case GL_MAP2_GRID_DOMAIN:
+         params[0] = ctx->Eval.MapGrid2u1;
+         params[1] = ctx->Eval.MapGrid2u2;
+         params[2] = ctx->Eval.MapGrid2v1;
+         params[3] = ctx->Eval.MapGrid2v2;
+         break;
+      case GL_MAP2_GRID_SEGMENTS:
+         params[0] = (GLfloat)(ctx->Eval.MapGrid2un);
+         params[1] = (GLfloat)(ctx->Eval.MapGrid2vn);
+         break;
+      case GL_MAP2_INDEX:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Index);
+         break;
+      case GL_MAP2_NORMAL:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Normal);
+         break;
+      case GL_MAP2_TEXTURE_COORD_1:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord1);
+         break;
+      case GL_MAP2_TEXTURE_COORD_2:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord2);
+         break;
+      case GL_MAP2_TEXTURE_COORD_3:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord3);
+         break;
+      case GL_MAP2_TEXTURE_COORD_4:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord4);
+         break;
+      case GL_MAP2_VERTEX_3:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex3);
+         break;
+      case GL_MAP2_VERTEX_4:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex4);
+         break;
+      case GL_MAP_COLOR:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapColorFlag);
+         break;
+      case GL_MAP_STENCIL:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapStencilFlag);
+         break;
+      case GL_MATRIX_MODE:
+         params[0] = ENUM_TO_FLOAT(ctx->Transform.MatrixMode);
+         break;
+      case GL_MAX_ATTRIB_STACK_DEPTH:
+         params[0] = (GLfloat)(MAX_ATTRIB_STACK_DEPTH);
+         break;
+      case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+         params[0] = (GLfloat)(MAX_CLIENT_ATTRIB_STACK_DEPTH);
+         break;
+      case GL_MAX_CLIP_PLANES:
+         params[0] = (GLfloat)(ctx->Const.MaxClipPlanes);
+         break;
+      case GL_MAX_ELEMENTS_VERTICES:
+         params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize);
+         break;
+      case GL_MAX_ELEMENTS_INDICES:
+         params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize);
+         break;
+      case GL_MAX_EVAL_ORDER:
+         params[0] = (GLfloat)(MAX_EVAL_ORDER);
+         break;
+      case GL_MAX_LIGHTS:
+         params[0] = (GLfloat)(ctx->Const.MaxLights);
+         break;
+      case GL_MAX_LIST_NESTING:
+         params[0] = (GLfloat)(MAX_LIST_NESTING);
+         break;
+      case GL_MAX_MODELVIEW_STACK_DEPTH:
+         params[0] = (GLfloat)(MAX_MODELVIEW_STACK_DEPTH);
+         break;
+      case GL_MAX_NAME_STACK_DEPTH:
+         params[0] = (GLfloat)(MAX_NAME_STACK_DEPTH);
+         break;
+      case GL_MAX_PIXEL_MAP_TABLE:
+         params[0] = (GLfloat)(MAX_PIXEL_MAP_TABLE);
+         break;
+      case GL_MAX_PROJECTION_STACK_DEPTH:
+         params[0] = (GLfloat)(MAX_PROJECTION_STACK_DEPTH);
+         break;
+      case GL_MAX_TEXTURE_SIZE:
+         params[0] = (GLfloat)(1 << (ctx->Const.MaxTextureLevels - 1));
+         break;
+      case GL_MAX_3D_TEXTURE_SIZE:
+         params[0] = (GLfloat)(1 << (ctx->Const.Max3DTextureLevels - 1));
+         break;
+      case GL_MAX_TEXTURE_STACK_DEPTH:
+         params[0] = (GLfloat)(MAX_TEXTURE_STACK_DEPTH);
+         break;
+      case GL_MAX_VIEWPORT_DIMS:
+         params[0] = (GLfloat)(ctx->Const.MaxViewportWidth);
+         params[1] = (GLfloat)(ctx->Const.MaxViewportHeight);
+         break;
+      case GL_MODELVIEW_MATRIX:
+         {
+         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[1];
+         params[2] = matrix[2];
+         params[3] = matrix[3];
+         params[4] = matrix[4];
+         params[5] = matrix[5];
+         params[6] = matrix[6];
+         params[7] = matrix[7];
+         params[8] = matrix[8];
+         params[9] = matrix[9];
+         params[10] = matrix[10];
+         params[11] = matrix[11];
+         params[12] = matrix[12];
+         params[13] = matrix[13];
+         params[14] = matrix[14];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_MODELVIEW_STACK_DEPTH:
+         params[0] = (GLfloat)(ctx->ModelviewMatrixStack.Depth + 1);
+         break;
+      case GL_NAME_STACK_DEPTH:
+         params[0] = (GLfloat)(ctx->Select.NameStackDepth);
+         break;
+      case GL_NORMALIZE:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.Normalize);
+         break;
+      case GL_PACK_ALIGNMENT:
+         params[0] = (GLfloat)(ctx->Pack.Alignment);
+         break;
+      case GL_PACK_LSB_FIRST:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.LsbFirst);
+         break;
+      case GL_PACK_ROW_LENGTH:
+         params[0] = (GLfloat)(ctx->Pack.RowLength);
+         break;
+      case GL_PACK_SKIP_PIXELS:
+         params[0] = (GLfloat)(ctx->Pack.SkipPixels);
+         break;
+      case GL_PACK_SKIP_ROWS:
+         params[0] = (GLfloat)(ctx->Pack.SkipRows);
+         break;
+      case GL_PACK_SWAP_BYTES:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.SwapBytes);
+         break;
+      case GL_PACK_SKIP_IMAGES_EXT:
+         params[0] = (GLfloat)(ctx->Pack.SkipImages);
+         break;
+      case GL_PACK_IMAGE_HEIGHT_EXT:
+         params[0] = (GLfloat)(ctx->Pack.ImageHeight);
+         break;
+      case GL_PACK_INVERT_MESA:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.Invert);
+         break;
+      case GL_PERSPECTIVE_CORRECTION_HINT:
+         params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
+         break;
+      case GL_PIXEL_MAP_A_TO_A_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapAtoAsize);
+         break;
+      case GL_PIXEL_MAP_B_TO_B_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapBtoBsize);
+         break;
+      case GL_PIXEL_MAP_G_TO_G_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapGtoGsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_A_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapItoAsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_B_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapItoBsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_G_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapItoGsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_I_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapItoIsize);
+         break;
+      case GL_PIXEL_MAP_I_TO_R_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapItoRsize);
+         break;
+      case GL_PIXEL_MAP_R_TO_R_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapRtoRsize);
+         break;
+      case GL_PIXEL_MAP_S_TO_S_SIZE:
+         params[0] = (GLfloat)(ctx->Pixel.MapStoSsize);
+         break;
+      case GL_POINT_SIZE:
+         params[0] = ctx->Point.Size;
+         break;
+      case GL_POINT_SIZE_GRANULARITY:
+         params[0] = ctx->Const.PointSizeGranularity;
+         break;
+      case GL_POINT_SIZE_RANGE:
+         params[0] = ctx->Const.MinPointSizeAA;
+         params[1] = ctx->Const.MaxPointSizeAA;
+         break;
+      case GL_ALIASED_POINT_SIZE_RANGE:
+         params[0] = ctx->Const.MinPointSize;
+         params[1] = ctx->Const.MaxPointSize;
+         break;
+      case GL_POINT_SMOOTH:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Point.SmoothFlag);
+         break;
+      case GL_POINT_SMOOTH_HINT:
+         params[0] = ENUM_TO_FLOAT(ctx->Hint.PointSmooth);
+         break;
+      case GL_POINT_SIZE_MIN_EXT:
+         params[0] = ctx->Point.MinSize;
+         break;
+      case GL_POINT_SIZE_MAX_EXT:
+         params[0] = ctx->Point.MaxSize;
+         break;
+      case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
+         params[0] = ctx->Point.Threshold;
+         break;
+      case GL_DISTANCE_ATTENUATION_EXT:
+         params[0] = ctx->Point.Params[0];
+         params[1] = ctx->Point.Params[1];
+         params[2] = ctx->Point.Params[2];
+         break;
+      case GL_POLYGON_MODE:
+         params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode);
+         params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode);
+         break;
+      case GL_POLYGON_OFFSET_BIAS_EXT:
+         params[0] = ctx->Polygon.OffsetUnits;
+         break;
+      case GL_POLYGON_OFFSET_FACTOR:
+         params[0] = ctx->Polygon.OffsetFactor ;
+         break;
+      case GL_POLYGON_OFFSET_UNITS:
+         params[0] = ctx->Polygon.OffsetUnits ;
+         break;
+      case GL_POLYGON_SMOOTH:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.SmoothFlag);
+         break;
+      case GL_POLYGON_SMOOTH_HINT:
+         params[0] = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth);
+         break;
+      case GL_POLYGON_STIPPLE:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.StippleFlag);
+         break;
+      case GL_PROJECTION_MATRIX:
+         {
+         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[1];
+         params[2] = matrix[2];
+         params[3] = matrix[3];
+         params[4] = matrix[4];
+         params[5] = matrix[5];
+         params[6] = matrix[6];
+         params[7] = matrix[7];
+         params[8] = matrix[8];
+         params[9] = matrix[9];
+         params[10] = matrix[10];
+         params[11] = matrix[11];
+         params[12] = matrix[12];
+         params[13] = matrix[13];
+         params[14] = matrix[14];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_PROJECTION_STACK_DEPTH:
+         params[0] = (GLfloat)(ctx->ProjectionMatrixStack.Depth + 1);
+         break;
+      case GL_READ_BUFFER:
+         params[0] = ENUM_TO_FLOAT(ctx->Pixel.ReadBuffer);
+         break;
+      case GL_RED_BIAS:
+         params[0] = ctx->Pixel.RedBias;
+         break;
+      case GL_RED_BITS:
+         params[0] = (GLfloat)( ctx->Visual.redBits );
+         break;
+      case GL_RED_SCALE:
+         params[0] = ctx->Pixel.RedScale;
+         break;
+      case GL_RENDER_MODE:
+         params[0] = ENUM_TO_FLOAT(ctx->RenderMode);
+         break;
+      case GL_RESCALE_NORMAL:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RescaleNormals);
+         break;
+      case GL_RGBA_MODE:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Visual.rgbMode);
+         break;
+      case GL_SCISSOR_BOX:
+         params[0] = (GLfloat)(ctx->Scissor.X);
+         params[1] = (GLfloat)(ctx->Scissor.Y);
+         params[2] = (GLfloat)(ctx->Scissor.Width);
+         params[3] = (GLfloat)(ctx->Scissor.Height);
+         break;
+      case GL_SCISSOR_TEST:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Scissor.Enabled);
+         break;
+      case GL_SELECTION_BUFFER_SIZE:
+         params[0] = (GLfloat)(ctx->Select.BufferSize);
+         break;
+      case GL_SHADE_MODEL:
+         params[0] = ENUM_TO_FLOAT(ctx->Light.ShadeModel);
+         break;
+      case GL_SHARED_TEXTURE_PALETTE_EXT:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.SharedPalette);
+         break;
+      case GL_STENCIL_BITS:
+         params[0] = (GLfloat)(ctx->Visual.stencilBits);
+         break;
+      case GL_STENCIL_CLEAR_VALUE:
+         params[0] = (GLfloat)(ctx->Stencil.Clear);
+         break;
+      case GL_STENCIL_FAIL:
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_FUNC:
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_PASS_DEPTH_FAIL:
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_PASS_DEPTH_PASS:
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_REF:
+         params[0] = (GLfloat)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_TEST:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.Enabled);
+         break;
+      case GL_STENCIL_VALUE_MASK:
+         params[0] = (GLfloat)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_WRITEMASK:
+         params[0] = (GLfloat)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STEREO:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Visual.stereoMode);
+         break;
+      case GL_SUBPIXEL_BITS:
+         params[0] = (GLfloat)(ctx->Const.SubPixelBits);
+         break;
+      case GL_TEXTURE_1D:
+         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D));
+         break;
+      case GL_TEXTURE_2D:
+         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D));
+         break;
+      case GL_TEXTURE_3D:
+         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D));
+         break;
+      case GL_TEXTURE_BINDING_1D:
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name);
+         break;
+      case GL_TEXTURE_BINDING_2D:
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name);
+         break;
+      case GL_TEXTURE_BINDING_3D:
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name);
+         break;
+      case GL_TEXTURE_ENV_COLOR:
+         {
+         const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
+         params[0] = color[0];
+         params[1] = color[1];
+         params[2] = color[2];
+         params[3] = color[3];
+         }
+         break;
+      case GL_TEXTURE_ENV_MODE:
+         params[0] = ENUM_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);
+         break;
+      case GL_TEXTURE_GEN_S:
+         params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
+         break;
+      case GL_TEXTURE_GEN_T:
+         params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0));
+         break;
+      case GL_TEXTURE_GEN_R:
+         params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0));
+         break;
+      case GL_TEXTURE_GEN_Q:
+         params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0));
+         break;
+      case GL_TEXTURE_MATRIX:
+         {
+         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[1];
+         params[2] = matrix[2];
+         params[3] = matrix[3];
+         params[4] = matrix[4];
+         params[5] = matrix[5];
+         params[6] = matrix[6];
+         params[7] = matrix[7];
+         params[8] = matrix[8];
+         params[9] = matrix[9];
+         params[10] = matrix[10];
+         params[11] = matrix[11];
+         params[12] = matrix[12];
+         params[13] = matrix[13];
+         params[14] = matrix[14];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_TEXTURE_STACK_DEPTH:
+         params[0] = (GLfloat)(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1);
+         break;
+      case GL_UNPACK_ALIGNMENT:
+         params[0] = (GLfloat)(ctx->Unpack.Alignment);
+         break;
+      case GL_UNPACK_LSB_FIRST:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.LsbFirst);
+         break;
+      case GL_UNPACK_ROW_LENGTH:
+         params[0] = (GLfloat)(ctx->Unpack.RowLength);
+         break;
+      case GL_UNPACK_SKIP_PIXELS:
+         params[0] = (GLfloat)(ctx->Unpack.SkipPixels);
+         break;
+      case GL_UNPACK_SKIP_ROWS:
+         params[0] = (GLfloat)(ctx->Unpack.SkipRows);
+         break;
+      case GL_UNPACK_SWAP_BYTES:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.SwapBytes);
+         break;
+      case GL_UNPACK_SKIP_IMAGES_EXT:
+         params[0] = (GLfloat)(ctx->Unpack.SkipImages);
+         break;
+      case GL_UNPACK_IMAGE_HEIGHT_EXT:
+         params[0] = (GLfloat)(ctx->Unpack.ImageHeight);
+         break;
+      case GL_UNPACK_CLIENT_STORAGE_APPLE:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.ClientStorage);
+         break;
+      case GL_VIEWPORT:
+         params[0] = (GLfloat)(ctx->Viewport.X);
+         params[1] = (GLfloat)(ctx->Viewport.Y);
+         params[2] = (GLfloat)(ctx->Viewport.Width);
+         params[3] = (GLfloat)(ctx->Viewport.Height);
+         break;
+      case GL_ZOOM_X:
+         params[0] = ctx->Pixel.ZoomX;
+         break;
+      case GL_ZOOM_Y:
+         params[0] = ctx->Pixel.ZoomY;
+         break;
+      case GL_VERTEX_ARRAY:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Vertex.Enabled);
+         break;
+      case GL_VERTEX_ARRAY_SIZE:
+         params[0] = (GLfloat)(ctx->Array.Vertex.Size);
+         break;
+      case GL_VERTEX_ARRAY_TYPE:
+         params[0] = ENUM_TO_FLOAT(ctx->Array.Vertex.Type);
+         break;
+      case GL_VERTEX_ARRAY_STRIDE:
+         params[0] = (GLfloat)(ctx->Array.Vertex.Stride);
+         break;
+      case GL_VERTEX_ARRAY_COUNT_EXT:
+         params[0] = (GLfloat)(0);
+         break;
+      case GL_NORMAL_ARRAY:
+         params[0] = ENUM_TO_FLOAT(ctx->Array.Normal.Enabled);
+         break;
+      case GL_NORMAL_ARRAY_TYPE:
+         params[0] = ENUM_TO_FLOAT(ctx->Array.Normal.Type);
+         break;
+      case GL_NORMAL_ARRAY_STRIDE:
+         params[0] = (GLfloat)(ctx->Array.Normal.Stride);
+         break;
+      case GL_NORMAL_ARRAY_COUNT_EXT:
+         params[0] = (GLfloat)(0);
+         break;
+      case GL_COLOR_ARRAY:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Color.Enabled);
+         break;
+      case GL_COLOR_ARRAY_SIZE:
+         params[0] = (GLfloat)(ctx->Array.Color.Size);
+         break;
+      case GL_COLOR_ARRAY_TYPE:
+         params[0] = ENUM_TO_FLOAT(ctx->Array.Color.Type);
+         break;
+      case GL_COLOR_ARRAY_STRIDE:
+         params[0] = (GLfloat)(ctx->Array.Color.Stride);
+         break;
+      case GL_COLOR_ARRAY_COUNT_EXT:
+         params[0] = (GLfloat)(0);
+         break;
+      case GL_INDEX_ARRAY:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Index.Enabled);
+         break;
+      case GL_INDEX_ARRAY_TYPE:
+         params[0] = ENUM_TO_FLOAT(ctx->Array.Index.Type);
+         break;
+      case GL_INDEX_ARRAY_STRIDE:
+         params[0] = (GLfloat)(ctx->Array.Index.Stride);
+         break;
+      case GL_INDEX_ARRAY_COUNT_EXT:
+         params[0] = (GLfloat)(0);
+         break;
+      case GL_TEXTURE_COORD_ARRAY:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_SIZE:
+         params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_TYPE:
+         params[0] = ENUM_TO_FLOAT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_STRIDE:
+         params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
+         params[0] = (GLfloat)(0);
+         break;
+      case GL_EDGE_FLAG_ARRAY:
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.EdgeFlag.Enabled);
+         break;
+      case GL_EDGE_FLAG_ARRAY_STRIDE:
+         params[0] = (GLfloat)(ctx->Array.EdgeFlag.Stride);
+         break;
+      case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
+         params[0] = (GLfloat)(0);
+         break;
+      case GL_MAX_TEXTURE_UNITS_ARB:
+         CHECK_EXTENSION_F(ARB_multitexture, pname);
+         params[0] = (GLfloat)(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits));
+         break;
+      case GL_ACTIVE_TEXTURE_ARB:
+         CHECK_EXTENSION_F(ARB_multitexture, pname);
+         params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit);
+         break;
+      case GL_CLIENT_ACTIVE_TEXTURE_ARB:
+         CHECK_EXTENSION_F(ARB_multitexture, pname);
+         params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);
+         break;
+      case GL_TEXTURE_CUBE_MAP_ARB:
+         CHECK_EXTENSION_F(ARB_texture_cube_map, pname);
+         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB));
+         break;
+      case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+         CHECK_EXTENSION_F(ARB_texture_cube_map, pname);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name);
+         break;
+      case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+         CHECK_EXTENSION_F(ARB_texture_cube_map, pname);
+         params[0] = (GLfloat)((1 << (ctx->Const.MaxCubeTextureLevels - 1)));
+         break;
+      case GL_TEXTURE_COMPRESSION_HINT_ARB:
+         CHECK_EXTENSION_F(ARB_texture_compression, pname);
+         params[0] = (GLfloat)(ctx->Hint.TextureCompression);
+         break;
+      case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
+         CHECK_EXTENSION_F(ARB_texture_compression, pname);
+         params[0] = (GLfloat)(_mesa_get_compressed_formats(ctx, NULL));
+         break;
+      case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
+         CHECK_EXTENSION_F(ARB_texture_compression, pname);
+         {
+         GLint formats[100];
+         GLuint i, n = _mesa_get_compressed_formats(ctx, formats);
+         for (i = 0; i < n; i++)
+            params[i] = ENUM_TO_BOOLEAN(formats[i]);
+         }
+         break;
+      case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
+         CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname);
+         params[0] = (GLfloat)(ctx->Array.LockFirst);
+         break;
+      case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:
+         CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname);
+         params[0] = (GLfloat)(ctx->Array.LockCount);
+         break;
+      case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[4];
+         params[2] = matrix[8];
+         params[3] = matrix[12];
+         params[4] = matrix[1];
+         params[5] = matrix[5];
+         params[6] = matrix[9];
+         params[7] = matrix[13];
+         params[8] = matrix[2];
+         params[9] = matrix[6];
+         params[10] = matrix[10];
+         params[11] = matrix[14];
+         params[12] = matrix[3];
+         params[13] = matrix[7];
+         params[14] = matrix[11];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[4];
+         params[2] = matrix[8];
+         params[3] = matrix[12];
+         params[4] = matrix[1];
+         params[5] = matrix[5];
+         params[6] = matrix[9];
+         params[7] = matrix[13];
+         params[8] = matrix[2];
+         params[9] = matrix[6];
+         params[10] = matrix[10];
+         params[11] = matrix[14];
+         params[12] = matrix[3];
+         params[13] = matrix[7];
+         params[14] = matrix[11];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[4];
+         params[2] = matrix[8];
+         params[3] = matrix[12];
+         params[4] = matrix[1];
+         params[5] = matrix[5];
+         params[6] = matrix[9];
+         params[7] = matrix[13];
+         params[8] = matrix[2];
+         params[9] = matrix[6];
+         params[10] = matrix[10];
+         params[11] = matrix[14];
+         params[12] = matrix[3];
+         params[13] = matrix[7];
+         params[14] = matrix[11];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[4];
+         params[2] = matrix[8];
+         params[3] = matrix[12];
+         params[4] = matrix[1];
+         params[5] = matrix[5];
+         params[6] = matrix[9];
+         params[7] = matrix[13];
+         params[8] = matrix[2];
+         params[9] = matrix[6];
+         params[10] = matrix[10];
+         params[11] = matrix[14];
+         params[12] = matrix[3];
+         params[13] = matrix[7];
+         params[14] = matrix[11];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_OCCLUSION_TEST_HP:
+         CHECK_EXTENSION_F(HP_occlusion_test, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.OcclusionTest);
+         break;
+      case GL_OCCLUSION_TEST_RESULT_HP:
+         CHECK_EXTENSION_F(HP_occlusion_test, pname);
+         {
+         if (ctx->Depth.OcclusionTest)
+            params[0] = ctx->OcclusionResult;
+         else
+            params[0] = ctx->OcclusionResultSaved;
+         /* reset flag now */
+         ctx->OcclusionResult = GL_FALSE;
+         ctx->OcclusionResultSaved = GL_FALSE;
+         return;
+         }
+         break;
+      case GL_PIXEL_TEXTURE_SGIS:
+         CHECK_EXTENSION_F(SGIS_pixel_texture, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled);
+         break;
+      case GL_PIXEL_TEX_GEN_SGIX:
+         CHECK_EXTENSION_F(SGIX_pixel_texture, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled);
+         break;
+      case GL_PIXEL_TEX_GEN_MODE_SGIX:
+         CHECK_EXTENSION_F(SGIX_pixel_texture, pname);
+         params[0] = ENUM_TO_FLOAT(pixel_texgen_mode(ctx));
+         break;
+      case GL_COLOR_MATRIX_SGI:
+         {
+         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[1];
+         params[2] = matrix[2];
+         params[3] = matrix[3];
+         params[4] = matrix[4];
+         params[5] = matrix[5];
+         params[6] = matrix[6];
+         params[7] = matrix[7];
+         params[8] = matrix[8];
+         params[9] = matrix[9];
+         params[10] = matrix[10];
+         params[11] = matrix[11];
+         params[12] = matrix[12];
+         params[13] = matrix[13];
+         params[14] = matrix[14];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+         params[0] = (GLfloat)(ctx->ColorMatrixStack.Depth + 1);
+         break;
+      case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+         params[0] = (GLfloat)(MAX_COLOR_STACK_DEPTH);
+         break;
+      case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+         params[0] = ctx->Pixel.PostColorMatrixScale[0];
+         break;
+      case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+         params[0] = ctx->Pixel.PostColorMatrixScale[1];
+         break;
+      case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+         params[0] = ctx->Pixel.PostColorMatrixScale[2];
+         break;
+      case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+         params[0] = ctx->Pixel.PostColorMatrixScale[3];
+         break;
+      case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+         params[0] = ctx->Pixel.PostColorMatrixBias[0];
+         break;
+      case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+         params[0] = ctx->Pixel.PostColorMatrixBias[1];
+         break;
+      case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+         params[0] = ctx->Pixel.PostColorMatrixBias[2];
+         break;
+      case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+         params[0] = ctx->Pixel.PostColorMatrixBias[3];
+         break;
+      case GL_CONVOLUTION_1D_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution1DEnabled);
+         break;
+      case GL_CONVOLUTION_2D_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution2DEnabled);
+         break;
+      case GL_SEPARABLE_2D_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Separable2DEnabled);
+         break;
+      case GL_POST_CONVOLUTION_RED_SCALE_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = ctx->Pixel.PostConvolutionScale[0];
+         break;
+      case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = ctx->Pixel.PostConvolutionScale[1];
+         break;
+      case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = ctx->Pixel.PostConvolutionScale[2];
+         break;
+      case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = ctx->Pixel.PostConvolutionScale[3];
+         break;
+      case GL_POST_CONVOLUTION_RED_BIAS_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = ctx->Pixel.PostConvolutionBias[0];
+         break;
+      case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = ctx->Pixel.PostConvolutionBias[1];
+         break;
+      case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = ctx->Pixel.PostConvolutionBias[2];
+         break;
+      case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:
+         CHECK_EXTENSION_F(EXT_convolution, pname);
+         params[0] = ctx->Pixel.PostConvolutionBias[3];
+         break;
+      case GL_HISTOGRAM:
+         CHECK_EXTENSION_F(EXT_histogram, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.HistogramEnabled);
+         break;
+      case GL_MINMAX:
+         CHECK_EXTENSION_F(EXT_histogram, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MinMaxEnabled);
+         break;
+      case GL_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_F(SGI_color_table, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled);
+         break;
+      case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_F(SGI_color_table, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostConvolutionColorTableEnabled);
+         break;
+      case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_F(SGI_color_table, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostColorMatrixColorTableEnabled);
+         break;
+      case GL_TEXTURE_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_F(SGI_texture_color_table, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled);
+         break;
+      case GL_COLOR_SUM_EXT:
+         CHECK_EXTENSION_F(EXT_secondary_color, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.ColorSumEnabled);
+         break;
+      case GL_CURRENT_SECONDARY_COLOR_EXT:
+         CHECK_EXTENSION_F(EXT_secondary_color, pname);
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0];
+         params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1];
+         params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2];
+         params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3];
+         }
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_EXT:
+         CHECK_EXTENSION_F(EXT_secondary_color, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.SecondaryColor.Enabled);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+         CHECK_EXTENSION_F(EXT_secondary_color, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Array.SecondaryColor.Type);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+         CHECK_EXTENSION_F(EXT_secondary_color, pname);
+         params[0] = (GLfloat)(ctx->Array.SecondaryColor.Stride);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+         CHECK_EXTENSION_F(EXT_secondary_color, pname);
+         params[0] = (GLfloat)(ctx->Array.SecondaryColor.Size);
+         break;
+      case GL_CURRENT_FOG_COORDINATE_EXT:
+         CHECK_EXTENSION_F(EXT_fog_coord, pname);
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
+         }
+         break;
+      case GL_FOG_COORDINATE_ARRAY_EXT:
+         CHECK_EXTENSION_F(EXT_fog_coord, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.FogCoord.Enabled);
+         break;
+      case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+         CHECK_EXTENSION_F(EXT_fog_coord, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Array.FogCoord.Type);
+         break;
+      case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+         CHECK_EXTENSION_F(EXT_fog_coord, pname);
+         params[0] = (GLfloat)(ctx->Array.FogCoord.Stride);
+         break;
+      case GL_FOG_COORDINATE_SOURCE_EXT:
+         CHECK_EXTENSION_F(EXT_fog_coord, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Fog.FogCoordinateSource);
+         break;
+      case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+         CHECK_EXTENSION_F(EXT_texture_lod_bias, pname);
+         params[0] = ctx->Const.MaxTextureLodBias;
+         break;
+      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+         CHECK_EXTENSION_F(EXT_texture_filter_anisotropic, pname);
+         params[0] = ctx->Const.MaxTextureMaxAnisotropy;
+         break;
+      case GL_MULTISAMPLE_ARB:
+         CHECK_EXTENSION_F(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.Enabled);
+         break;
+      case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+         CHECK_EXTENSION_F(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToCoverage);
+         break;
+      case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+         CHECK_EXTENSION_F(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToOne);
+         break;
+      case GL_SAMPLE_COVERAGE_ARB:
+         CHECK_EXTENSION_F(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverage);
+         break;
+      case GL_SAMPLE_COVERAGE_VALUE_ARB:
+         CHECK_EXTENSION_F(ARB_multisample, pname);
+         params[0] = ctx->Multisample.SampleCoverageValue;
+         break;
+      case GL_SAMPLE_COVERAGE_INVERT_ARB:
+         CHECK_EXTENSION_F(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverageInvert);
+         break;
+      case GL_SAMPLE_BUFFERS_ARB:
+         CHECK_EXTENSION_F(ARB_multisample, pname);
+         params[0] = (GLfloat)(0);
+         break;
+      case GL_SAMPLES_ARB:
+         CHECK_EXTENSION_F(ARB_multisample, pname);
+         params[0] = (GLfloat)(0);
+         break;
+      case GL_RASTER_POSITION_UNCLIPPED_IBM:
+         CHECK_EXTENSION_F(IBM_rasterpos_clip, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RasterPositionUnclipped);
+         break;
+      case GL_POINT_SPRITE_NV:
+         CHECK_EXTENSION_F(NV_point_sprite, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Point.PointSprite);
+         break;
+      case GL_POINT_SPRITE_R_MODE_NV:
+         CHECK_EXTENSION_F(NV_point_sprite, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteRMode);
+         break;
+      case GL_POINT_SPRITE_COORD_ORIGIN:
+         CHECK_EXTENSION_F(NV_point_sprite, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteOrigin);
+         break;
+      case GL_GENERATE_MIPMAP_HINT_SGIS:
+         CHECK_EXTENSION_F(SGIS_generate_mipmap, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Hint.GenerateMipmap);
+         break;
+      case GL_VERTEX_PROGRAM_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.Enabled);
+         break;
+      case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.PointSizeEnabled);
+         break;
+      case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.TwoSideEnabled);
+         break;
+      case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxProgramMatrixStackDepth);
+         break;
+      case GL_MAX_TRACK_MATRICES_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxProgramMatrices);
+         break;
+      case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->CurrentStack->Depth + 1);
+         break;
+      case GL_CURRENT_MATRIX_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         {
+         const GLfloat *matrix = ctx->CurrentStack->Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[1];
+         params[2] = matrix[2];
+         params[3] = matrix[3];
+         params[4] = matrix[4];
+         params[5] = matrix[5];
+         params[6] = matrix[6];
+         params[7] = matrix[7];
+         params[8] = matrix[8];
+         params[9] = matrix[9];
+         params[10] = matrix[10];
+         params[11] = matrix[11];
+         params[12] = matrix[12];
+         params[13] = matrix[13];
+         params[14] = matrix[14];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_VERTEX_PROGRAM_BINDING_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = (GLfloat)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0));
+         break;
+      case GL_PROGRAM_ERROR_POSITION_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = (GLfloat)(ctx->Program.ErrorPos);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY0_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[0].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY1_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[1].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY2_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[2].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY3_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[3].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[4].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY5_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[5].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY6_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[6].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY7_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[7].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY8_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[8].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY9_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[9].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY10_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[10].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY11_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[11].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY12_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[12].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY13_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[13].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY14_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[14].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY15_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[15].Enabled);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[0]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[1]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[2]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[3]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[4]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[5]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[6]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[7]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[8]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[9]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[10]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[11]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[12]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[13]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[14]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+         CHECK_EXTENSION_F(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[15]);
+         break;
+      case GL_FRAGMENT_PROGRAM_NV:
+         CHECK_EXTENSION_F(NV_fragment_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled);
+         break;
+      case GL_MAX_TEXTURE_COORDS_NV:
+         CHECK_EXTENSION_F(NV_fragment_program, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxTextureCoordUnits);
+         break;
+      case GL_MAX_TEXTURE_IMAGE_UNITS_NV:
+         CHECK_EXTENSION_F(NV_fragment_program, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxTextureImageUnits);
+         break;
+      case GL_FRAGMENT_PROGRAM_BINDING_NV:
+         CHECK_EXTENSION_F(NV_fragment_program, pname);
+         params[0] = (GLfloat)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0);
+         break;
+      case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:
+         CHECK_EXTENSION_F(NV_fragment_program, pname);
+         params[0] = (GLfloat)(MAX_NV_FRAGMENT_PROGRAM_PARAMS);
+         break;
+      case GL_TEXTURE_RECTANGLE_NV:
+         CHECK_EXTENSION_F(NV_texture_rectangle, pname);
+         params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV));
+         break;
+      case GL_TEXTURE_BINDING_RECTANGLE_NV:
+         CHECK_EXTENSION_F(NV_texture_rectangle, pname);
+         params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name);
+         break;
+      case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+         CHECK_EXTENSION_F(NV_texture_rectangle, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxTextureRectSize);
+         break;
+      case GL_STENCIL_TEST_TWO_SIDE_EXT:
+         CHECK_EXTENSION_F(EXT_stencil_two_side, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.TestTwoSide);
+         break;
+      case GL_ACTIVE_STENCIL_FACE_EXT:
+         CHECK_EXTENSION_F(EXT_stencil_two_side, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
+         break;
+      case GL_MAX_SHININESS_NV:
+         CHECK_EXTENSION_F(NV_light_max_exponent, pname);
+         params[0] = ctx->Const.MaxShininess;
+         break;
+      case GL_MAX_SPOT_EXPONENT_NV:
+         CHECK_EXTENSION_F(NV_light_max_exponent, pname);
+         params[0] = ctx->Const.MaxSpotExponent;
+         break;
+      case GL_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.ArrayBufferObj->Name);
+         break;
+      case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.Vertex.BufferObj->Name);
+         break;
+      case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.Normal.BufferObj->Name);
+         break;
+      case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.Color.BufferObj->Name);
+         break;
+      case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.Index.BufferObj->Name);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name);
+         break;
+      case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.EdgeFlag.BufferObj->Name);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.SecondaryColor.BufferObj->Name);
+         break;
+      case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.FogCoord.BufferObj->Name);
+         break;
+      case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Array.ElementArrayBufferObj->Name);
+         break;
+      case GL_PIXEL_PACK_BUFFER_BINDING_EXT:
+         CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Pack.BufferObj->Name);
+         break;
+      case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:
+         CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname);
+         params[0] = (GLfloat)(ctx->Unpack.BufferObj->Name);
+         break;
+      case GL_MAX_VERTEX_ATTRIBS_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_program, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxVertexProgramAttribs);
+         break;
+      case GL_FRAGMENT_PROGRAM_ARB:
+         CHECK_EXTENSION_F(ARB_fragment_program, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled);
+         break;
+      case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+         CHECK_EXTENSION_F(ARB_fragment_program, pname);
+         {
+         const GLfloat *matrix = ctx->CurrentStack->Top->m;
+         params[0] = matrix[0];
+         params[1] = matrix[4];
+         params[2] = matrix[8];
+         params[3] = matrix[12];
+         params[4] = matrix[1];
+         params[5] = matrix[5];
+         params[6] = matrix[9];
+         params[7] = matrix[13];
+         params[8] = matrix[2];
+         params[9] = matrix[6];
+         params[10] = matrix[10];
+         params[11] = matrix[14];
+         params[12] = matrix[3];
+         params[13] = matrix[7];
+         params[14] = matrix[11];
+         params[15] = matrix[15];
+         }
+         break;
+      case GL_DEPTH_BOUNDS_TEST_EXT:
+         CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.BoundsTest);
+         break;
+      case GL_DEPTH_BOUNDS_EXT:
+         CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);
+         params[0] = ctx->Depth.BoundsMin;
+         params[1] = ctx->Depth.BoundsMax;
+         break;
+      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+         CHECK_EXTENSION_F(MESA_program_debug, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.CallbackEnabled);
+         break;
+      case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+         CHECK_EXTENSION_F(MESA_program_debug, pname);
+         params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.CallbackEnabled);
+         break;
+      case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+         CHECK_EXTENSION_F(MESA_program_debug, pname);
+         params[0] = (GLfloat)(ctx->FragmentProgram.CurrentPosition);
+         break;
+      case GL_VERTEX_PROGRAM_POSITION_MESA:
+         CHECK_EXTENSION_F(MESA_program_debug, pname);
+         params[0] = (GLfloat)(ctx->VertexProgram.CurrentPosition);
+         break;
+      case GL_MAX_DRAW_BUFFERS_ARB:
+         CHECK_EXTENSION_F(ARB_draw_buffers, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers);
+         break;
+      case GL_DRAW_BUFFER0_ARB:
+         CHECK_EXTENSION_F(ARB_draw_buffers, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]);
+         break;
+      case GL_DRAW_BUFFER1_ARB:
+         CHECK_EXTENSION_F(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[1];
+         params[0] = ENUM_TO_FLOAT(buffer);
+         }
+         break;
+      case GL_DRAW_BUFFER2_ARB:
+         CHECK_EXTENSION_F(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[2];
+         params[0] = ENUM_TO_FLOAT(buffer);
+         }
+         break;
+      case GL_DRAW_BUFFER3_ARB:
+         CHECK_EXTENSION_F(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[3];
+         params[0] = ENUM_TO_FLOAT(buffer);
+         }
+         break;
+      case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
+         CHECK_EXTENSION_F(OES_read_format, pname);
+         params[0] = (GLfloat)(ctx->Const.ColorReadType);
+         break;
+      case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
+         CHECK_EXTENSION_F(OES_read_format, pname);
+         params[0] = (GLfloat)(ctx->Const.ColorReadFormat);
+         break;
+      case GL_NUM_FRAGMENT_REGISTERS_ATI:
+         CHECK_EXTENSION_F(ATI_fragment_shader, pname);
+         params[0] = (GLfloat)(6);
+         break;
+      case GL_NUM_FRAGMENT_CONSTANTS_ATI:
+         CHECK_EXTENSION_F(ATI_fragment_shader, pname);
+         params[0] = (GLfloat)(8);
+         break;
+      case GL_NUM_PASSES_ATI:
+         CHECK_EXTENSION_F(ATI_fragment_shader, pname);
+         params[0] = (GLfloat)(2);
+         break;
+      case GL_NUM_INSTRUCTIONS_PER_PASS_ATI:
+         CHECK_EXTENSION_F(ATI_fragment_shader, pname);
+         params[0] = (GLfloat)(8);
+         break;
+      case GL_NUM_INSTRUCTIONS_TOTAL_ATI:
+         CHECK_EXTENSION_F(ATI_fragment_shader, pname);
+         params[0] = (GLfloat)(16);
+         break;
+      case GL_COLOR_ALPHA_PAIRING_ATI:
+         CHECK_EXTENSION_F(ATI_fragment_shader, pname);
+         params[0] = BOOLEAN_TO_FLOAT(GL_TRUE);
+         break;
+      case GL_NUM_LOOPBACK_COMPONENTS_ATI:
+         CHECK_EXTENSION_F(ATI_fragment_shader, pname);
+         params[0] = (GLfloat)(3);
+         break;
+      case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI:
+         CHECK_EXTENSION_F(ATI_fragment_shader, pname);
+         params[0] = (GLfloat)(3);
+         break;
+      case GL_STENCIL_BACK_FUNC:
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[1]);
+         break;
+      case GL_STENCIL_BACK_VALUE_MASK:
+         params[0] = (GLfloat)(ctx->Stencil.ValueMask[1]);
+         break;
+      case GL_STENCIL_BACK_REF:
+         params[0] = (GLfloat)(ctx->Stencil.Ref[1]);
+         break;
+      case GL_STENCIL_BACK_FAIL:
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[1]);
+         break;
+      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[1]);
+         break;
+      case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+         params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[1]);
+         break;
+      case GL_FRAMEBUFFER_BINDING_EXT:
+         CHECK_EXTENSION_F(EXT_framebuffer_object, pname);
+         params[0] = (GLfloat)(ctx->CurrentFramebuffer ? ctx->CurrentFramebuffer->Name : 0);
+         break;
+      case GL_RENDERBUFFER_BINDING_EXT:
+         CHECK_EXTENSION_F(EXT_framebuffer_object, pname);
+         params[0] = (GLfloat)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0);
+         break;
+      case GL_MAX_COLOR_ATTACHMENTS_EXT:
+         CHECK_EXTENSION_F(EXT_framebuffer_object, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxColorAttachments);
+         break;
+      case GL_MAX_RENDERBUFFER_SIZE_EXT:
+         CHECK_EXTENSION_F(EXT_framebuffer_object, pname);
+         params[0] = (GLfloat)(ctx->Const.MaxRenderbufferSize);
+         break;
+      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:
+         CHECK_EXTENSION_F(ARB_fragment_shader, pname);
+         params[0] = (GLfloat)(MAX_FRAGMENT_UNIFORM_COMPONENTS);
+         break;
+      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
+         CHECK_EXTENSION_F(ARB_fragment_shader, pname);
+         params[0] = ENUM_TO_FLOAT(ctx->Hint.FragmentShaderDerivative);
+         break;
+      case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_shader, pname);
+         params[0] = (GLfloat)(MAX_VERTEX_UNIFORM_COMPONENTS);
+         break;
+      case GL_MAX_VARYING_FLOATS_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_shader, pname);
+         params[0] = (GLfloat)(MAX_VARYING_FLOATS);
+         break;
+      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_shader, pname);
+         params[0] = (GLfloat)(MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+         break;
+      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
+         CHECK_EXTENSION_F(ARB_vertex_shader, pname);
+         params[0] = (GLfloat)(MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+         break;
+      default:
+         _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname);
+   }
+}
+
+void GLAPIENTRY
+_mesa_GetIntegerv( GLenum pname, GLint *params )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (!params)
+      return;
+
+   if (ctx->Driver.GetIntegerv &&
+       ctx->Driver.GetIntegerv(ctx, pname, params))
+      return;
+
+   switch (pname) {
+      case GL_ACCUM_RED_BITS:
+         params[0] = ctx->Visual.accumRedBits;
+         break;
+      case GL_ACCUM_GREEN_BITS:
+         params[0] = ctx->Visual.accumGreenBits;
+         break;
+      case GL_ACCUM_BLUE_BITS:
+         params[0] = ctx->Visual.accumBlueBits;
+         break;
+      case GL_ACCUM_ALPHA_BITS:
+         params[0] = ctx->Visual.accumAlphaBits;
+         break;
+      case GL_ACCUM_CLEAR_VALUE:
+         params[0] = FLOAT_TO_INT(ctx->Accum.ClearColor[0]);
+         params[1] = FLOAT_TO_INT(ctx->Accum.ClearColor[1]);
+         params[2] = FLOAT_TO_INT(ctx->Accum.ClearColor[2]);
+         params[3] = FLOAT_TO_INT(ctx->Accum.ClearColor[3]);
+         break;
+      case GL_ALPHA_BIAS:
+         params[0] = IROUND(ctx->Pixel.AlphaBias);
+         break;
+      case GL_ALPHA_BITS:
+         params[0] = ctx->Visual.alphaBits;
+         break;
+      case GL_ALPHA_SCALE:
+         params[0] = IROUND(ctx->Pixel.AlphaScale);
+         break;
+      case GL_ALPHA_TEST:
+         params[0] = BOOLEAN_TO_INT(ctx->Color.AlphaEnabled);
+         break;
+      case GL_ALPHA_TEST_FUNC:
+         params[0] = ENUM_TO_INT(ctx->Color.AlphaFunc);
+         break;
+      case GL_ALPHA_TEST_REF:
+         params[0] = FLOAT_TO_INT(ctx->Color.AlphaRef);
+         break;
+      case GL_ATTRIB_STACK_DEPTH:
+         params[0] = ctx->AttribStackDepth;
+         break;
+      case GL_AUTO_NORMAL:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.AutoNormal);
+         break;
+      case GL_AUX_BUFFERS:
+         params[0] = ctx->Visual.numAuxBuffers;
+         break;
+      case GL_BLEND:
+         params[0] = BOOLEAN_TO_INT(ctx->Color.BlendEnabled);
+         break;
+      case GL_BLEND_DST:
+         params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB);
+         break;
+      case GL_BLEND_SRC:
+         params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB);
+         break;
+      case GL_BLEND_SRC_RGB_EXT:
+         params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB);
+         break;
+      case GL_BLEND_DST_RGB_EXT:
+         params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB);
+         break;
+      case GL_BLEND_SRC_ALPHA_EXT:
+         params[0] = ENUM_TO_INT(ctx->Color.BlendSrcA);
+         break;
+      case GL_BLEND_DST_ALPHA_EXT:
+         params[0] = ENUM_TO_INT(ctx->Color.BlendDstA);
+         break;
+      case GL_BLEND_EQUATION:
+         params[0] = ENUM_TO_INT(ctx->Color.BlendEquationRGB );
+         break;
+      case GL_BLEND_EQUATION_ALPHA_EXT:
+         params[0] = ENUM_TO_INT(ctx->Color.BlendEquationA );
+         break;
+      case GL_BLEND_COLOR_EXT:
+         params[0] = FLOAT_TO_INT(ctx->Color.BlendColor[0]);
+         params[1] = FLOAT_TO_INT(ctx->Color.BlendColor[1]);
+         params[2] = FLOAT_TO_INT(ctx->Color.BlendColor[2]);
+         params[3] = FLOAT_TO_INT(ctx->Color.BlendColor[3]);
+         break;
+      case GL_BLUE_BIAS:
+         params[0] = IROUND(ctx->Pixel.BlueBias);
+         break;
+      case GL_BLUE_BITS:
+         params[0] = ctx->Visual.blueBits;
+         break;
+      case GL_BLUE_SCALE:
+         params[0] = IROUND(ctx->Pixel.BlueScale);
+         break;
+      case GL_CLIENT_ATTRIB_STACK_DEPTH:
+         params[0] = ctx->ClientAttribStackDepth;
+         break;
+      case GL_CLIP_PLANE0:
+         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 0) & 1);
+         break;
+      case GL_CLIP_PLANE1:
+         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 1) & 1);
+         break;
+      case GL_CLIP_PLANE2:
+         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 2) & 1);
+         break;
+      case GL_CLIP_PLANE3:
+         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 3) & 1);
+         break;
+      case GL_CLIP_PLANE4:
+         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 4) & 1);
+         break;
+      case GL_CLIP_PLANE5:
+         params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 5) & 1);
+         break;
+      case GL_COLOR_CLEAR_VALUE:
+         params[0] = FLOAT_TO_INT(ctx->Color.ClearColor[0]);
+         params[1] = FLOAT_TO_INT(ctx->Color.ClearColor[1]);
+         params[2] = FLOAT_TO_INT(ctx->Color.ClearColor[2]);
+         params[3] = FLOAT_TO_INT(ctx->Color.ClearColor[3]);
+         break;
+      case GL_COLOR_MATERIAL:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.ColorMaterialEnabled);
+         break;
+      case GL_COLOR_MATERIAL_FACE:
+         params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialFace);
+         break;
+      case GL_COLOR_MATERIAL_PARAMETER:
+         params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialMode);
+         break;
+      case GL_COLOR_WRITEMASK:
+         params[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0;
+         params[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0;
+         params[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0;
+         params[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0;
+         break;
+      case GL_CULL_FACE:
+         params[0] = BOOLEAN_TO_INT(ctx->Polygon.CullFlag);
+         break;
+      case GL_CULL_FACE_MODE:
+         params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode);
+         break;
+      case GL_CURRENT_COLOR:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
+         params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
+         params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
+         params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
+         }
+         break;
+      case GL_CURRENT_INDEX:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = IROUND(ctx->Current.Index);
+         }
+         break;
+      case GL_CURRENT_NORMAL:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
+         params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
+         params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
+         }
+         break;
+      case GL_CURRENT_RASTER_COLOR:
+         params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]);
+         params[1] = FLOAT_TO_INT(ctx->Current.RasterColor[1]);
+         params[2] = FLOAT_TO_INT(ctx->Current.RasterColor[2]);
+         params[3] = FLOAT_TO_INT(ctx->Current.RasterColor[3]);
+         break;
+      case GL_CURRENT_RASTER_DISTANCE:
+         params[0] = IROUND(ctx->Current.RasterDistance);
+         break;
+      case GL_CURRENT_RASTER_INDEX:
+         params[0] = IROUND(ctx->Current.RasterIndex);
+         break;
+      case GL_CURRENT_RASTER_POSITION:
+         params[0] = IROUND(ctx->Current.RasterPos[0]);
+         params[1] = IROUND(ctx->Current.RasterPos[1]);
+         params[2] = IROUND(ctx->Current.RasterPos[2]);
+         params[3] = IROUND(ctx->Current.RasterPos[3]);
+         break;
+      case GL_CURRENT_RASTER_TEXTURE_COORDS:
+         {
+         const GLuint texUnit = ctx->Texture.CurrentUnit;
+         params[0] = IROUND(ctx->Current.RasterTexCoords[texUnit][0]);
+         params[1] = IROUND(ctx->Current.RasterTexCoords[texUnit][1]);
+         params[2] = IROUND(ctx->Current.RasterTexCoords[texUnit][2]);
+         params[3] = IROUND(ctx->Current.RasterTexCoords[texUnit][3]);
+         }
+         break;
+      case GL_CURRENT_RASTER_POSITION_VALID:
+         params[0] = BOOLEAN_TO_INT(ctx->Current.RasterPosValid);
+         break;
+      case GL_CURRENT_TEXTURE_COORDS:
+         {
+         const GLuint texUnit = ctx->Texture.CurrentUnit;
+         params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]);
+         params[1] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]);
+         params[2] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]);
+         params[3] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]);
+         }
+         break;
+      case GL_DEPTH_BIAS:
+         params[0] = IROUND(ctx->Pixel.DepthBias);
+         break;
+      case GL_DEPTH_BITS:
+         params[0] = ctx->Visual.depthBits;
+         break;
+      case GL_DEPTH_CLEAR_VALUE:
+         params[0] = IROUND(ctx->Depth.Clear);
+         break;
+      case GL_DEPTH_FUNC:
+         params[0] = ENUM_TO_INT(ctx->Depth.Func);
+         break;
+      case GL_DEPTH_RANGE:
+         params[0] = FLOAT_TO_INT(ctx->Viewport.Near);
+         params[1] = FLOAT_TO_INT(ctx->Viewport.Far);
+         break;
+      case GL_DEPTH_SCALE:
+         params[0] = IROUND(ctx->Pixel.DepthScale);
+         break;
+      case GL_DEPTH_TEST:
+         params[0] = BOOLEAN_TO_INT(ctx->Depth.Test);
+         break;
+      case GL_DEPTH_WRITEMASK:
+         params[0] = BOOLEAN_TO_INT(ctx->Depth.Mask);
+         break;
+      case GL_DITHER:
+         params[0] = BOOLEAN_TO_INT(ctx->Color.DitherFlag);
+         break;
+      case GL_DOUBLEBUFFER:
+         params[0] = BOOLEAN_TO_INT(ctx->Visual.doubleBufferMode);
+         break;
+      case GL_DRAW_BUFFER:
+         params[0] = ENUM_TO_INT(ctx->Color.DrawBuffer[0]);
+         break;
+      case GL_EDGE_FLAG:
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = BOOLEAN_TO_INT(ctx->Current.EdgeFlag);
+         }
+         break;
+      case GL_FEEDBACK_BUFFER_SIZE:
+         params[0] = ctx->Feedback.BufferSize;
+         break;
+      case GL_FEEDBACK_BUFFER_TYPE:
+         params[0] = ENUM_TO_INT(ctx->Feedback.Type);
+         break;
+      case GL_FOG:
+         params[0] = BOOLEAN_TO_INT(ctx->Fog.Enabled);
+         break;
+      case GL_FOG_COLOR:
+         params[0] = FLOAT_TO_INT(ctx->Fog.Color[0]);
+         params[1] = FLOAT_TO_INT(ctx->Fog.Color[1]);
+         params[2] = FLOAT_TO_INT(ctx->Fog.Color[2]);
+         params[3] = FLOAT_TO_INT(ctx->Fog.Color[3]);
+         break;
+      case GL_FOG_DENSITY:
+         params[0] = IROUND(ctx->Fog.Density);
+         break;
+      case GL_FOG_END:
+         params[0] = IROUND(ctx->Fog.End);
+         break;
+      case GL_FOG_HINT:
+         params[0] = ENUM_TO_INT(ctx->Hint.Fog);
+         break;
+      case GL_FOG_INDEX:
+         params[0] = IROUND(ctx->Fog.Index);
+         break;
+      case GL_FOG_MODE:
+         params[0] = ENUM_TO_INT(ctx->Fog.Mode);
+         break;
+      case GL_FOG_START:
+         params[0] = IROUND(ctx->Fog.Start);
+         break;
+      case GL_FRONT_FACE:
+         params[0] = ENUM_TO_INT(ctx->Polygon.FrontFace);
+         break;
+      case GL_GREEN_BIAS:
+         params[0] = IROUND(ctx->Pixel.GreenBias);
+         break;
+      case GL_GREEN_BITS:
+         params[0] = ctx->Visual.greenBits;
+         break;
+      case GL_GREEN_SCALE:
+         params[0] = IROUND(ctx->Pixel.GreenScale);
+         break;
+      case GL_INDEX_BITS:
+         params[0] = ctx->Visual.indexBits;
+         break;
+      case GL_INDEX_CLEAR_VALUE:
+         params[0] = ctx->Color.ClearIndex;
+         break;
+      case GL_INDEX_MODE:
+         params[0] = BOOLEAN_TO_INT(!ctx->Visual.rgbMode);
+         break;
+      case GL_INDEX_OFFSET:
+         params[0] = ctx->Pixel.IndexOffset;
+         break;
+      case GL_INDEX_SHIFT:
+         params[0] = ctx->Pixel.IndexShift;
+         break;
+      case GL_INDEX_WRITEMASK:
+         params[0] = ctx->Color.IndexMask;
+         break;
+      case GL_LIGHT0:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[0].Enabled);
+         break;
+      case GL_LIGHT1:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[1].Enabled);
+         break;
+      case GL_LIGHT2:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[2].Enabled);
+         break;
+      case GL_LIGHT3:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[3].Enabled);
+         break;
+      case GL_LIGHT4:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[4].Enabled);
+         break;
+      case GL_LIGHT5:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[5].Enabled);
+         break;
+      case GL_LIGHT6:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[6].Enabled);
+         break;
+      case GL_LIGHT7:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Light[7].Enabled);
+         break;
+      case GL_LIGHTING:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Enabled);
+         break;
+      case GL_LIGHT_MODEL_AMBIENT:
+         params[0] = FLOAT_TO_INT(ctx->Light.Model.Ambient[0]);
+         params[1] = FLOAT_TO_INT(ctx->Light.Model.Ambient[1]);
+         params[2] = FLOAT_TO_INT(ctx->Light.Model.Ambient[2]);
+         params[3] = FLOAT_TO_INT(ctx->Light.Model.Ambient[3]);
+         break;
+      case GL_LIGHT_MODEL_COLOR_CONTROL:
+         params[0] = ENUM_TO_INT(ctx->Light.Model.ColorControl);
+         break;
+      case GL_LIGHT_MODEL_LOCAL_VIEWER:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Model.LocalViewer);
+         break;
+      case GL_LIGHT_MODEL_TWO_SIDE:
+         params[0] = BOOLEAN_TO_INT(ctx->Light.Model.TwoSide);
+         break;
+      case GL_LINE_SMOOTH:
+         params[0] = BOOLEAN_TO_INT(ctx->Line.SmoothFlag);
+         break;
+      case GL_LINE_SMOOTH_HINT:
+         params[0] = ENUM_TO_INT(ctx->Hint.LineSmooth);
+         break;
+      case GL_LINE_STIPPLE:
+         params[0] = BOOLEAN_TO_INT(ctx->Line.StippleFlag);
+         break;
+      case GL_LINE_STIPPLE_PATTERN:
+         params[0] = ctx->Line.StipplePattern;
+         break;
+      case GL_LINE_STIPPLE_REPEAT:
+         params[0] = ctx->Line.StippleFactor;
+         break;
+      case GL_LINE_WIDTH:
+         params[0] = IROUND(ctx->Line.Width);
+         break;
+      case GL_LINE_WIDTH_GRANULARITY:
+         params[0] = IROUND(ctx->Const.LineWidthGranularity);
+         break;
+      case GL_LINE_WIDTH_RANGE:
+         params[0] = IROUND(ctx->Const.MinLineWidthAA);
+         params[1] = IROUND(ctx->Const.MaxLineWidthAA);
+         break;
+      case GL_ALIASED_LINE_WIDTH_RANGE:
+         params[0] = IROUND(ctx->Const.MinLineWidth);
+         params[1] = IROUND(ctx->Const.MaxLineWidth);
+         break;
+      case GL_LIST_BASE:
+         params[0] = ctx->List.ListBase;
+         break;
+      case GL_LIST_INDEX:
+         params[0] = ctx->ListState.CurrentListNum;
+         break;
+      case GL_LIST_MODE:
+         {
+         GLenum mode;
+         if (!ctx->CompileFlag)
+            mode = 0;
+         else if (ctx->ExecuteFlag)
+            mode = GL_COMPILE_AND_EXECUTE;
+         else
+            mode = GL_COMPILE;
+         params[0] = ENUM_TO_INT(mode);
+         }
+         break;
+      case GL_INDEX_LOGIC_OP:
+         params[0] = BOOLEAN_TO_INT(ctx->Color.IndexLogicOpEnabled);
+         break;
+      case GL_COLOR_LOGIC_OP:
+         params[0] = BOOLEAN_TO_INT(ctx->Color.ColorLogicOpEnabled);
+         break;
+      case GL_LOGIC_OP_MODE:
+         params[0] = ENUM_TO_INT(ctx->Color.LogicOp);
+         break;
+      case GL_MAP1_COLOR_4:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Color4);
+         break;
+      case GL_MAP1_GRID_DOMAIN:
+         params[0] = IROUND(ctx->Eval.MapGrid1u1);
+         params[1] = IROUND(ctx->Eval.MapGrid1u2);
+         break;
+      case GL_MAP1_GRID_SEGMENTS:
+         params[0] = ctx->Eval.MapGrid1un;
+         break;
+      case GL_MAP1_INDEX:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Index);
+         break;
+      case GL_MAP1_NORMAL:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Normal);
+         break;
+      case GL_MAP1_TEXTURE_COORD_1:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord1);
+         break;
+      case GL_MAP1_TEXTURE_COORD_2:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord2);
+         break;
+      case GL_MAP1_TEXTURE_COORD_3:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord3);
+         break;
+      case GL_MAP1_TEXTURE_COORD_4:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord4);
+         break;
+      case GL_MAP1_VERTEX_3:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex3);
+         break;
+      case GL_MAP1_VERTEX_4:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex4);
+         break;
+      case GL_MAP2_COLOR_4:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Color4);
+         break;
+      case GL_MAP2_GRID_DOMAIN:
+         params[0] = IROUND(ctx->Eval.MapGrid2u1);
+         params[1] = IROUND(ctx->Eval.MapGrid2u2);
+         params[2] = IROUND(ctx->Eval.MapGrid2v1);
+         params[3] = IROUND(ctx->Eval.MapGrid2v2);
+         break;
+      case GL_MAP2_GRID_SEGMENTS:
+         params[0] = ctx->Eval.MapGrid2un;
+         params[1] = ctx->Eval.MapGrid2vn;
+         break;
+      case GL_MAP2_INDEX:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Index);
+         break;
+      case GL_MAP2_NORMAL:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Normal);
+         break;
+      case GL_MAP2_TEXTURE_COORD_1:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord1);
+         break;
+      case GL_MAP2_TEXTURE_COORD_2:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord2);
+         break;
+      case GL_MAP2_TEXTURE_COORD_3:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord3);
+         break;
+      case GL_MAP2_TEXTURE_COORD_4:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord4);
+         break;
+      case GL_MAP2_VERTEX_3:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex3);
+         break;
+      case GL_MAP2_VERTEX_4:
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex4);
+         break;
+      case GL_MAP_COLOR:
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapColorFlag);
+         break;
+      case GL_MAP_STENCIL:
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapStencilFlag);
+         break;
+      case GL_MATRIX_MODE:
+         params[0] = ENUM_TO_INT(ctx->Transform.MatrixMode);
+         break;
+      case GL_MAX_ATTRIB_STACK_DEPTH:
+         params[0] = MAX_ATTRIB_STACK_DEPTH;
+         break;
+      case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
+         params[0] = MAX_CLIENT_ATTRIB_STACK_DEPTH;
+         break;
+      case GL_MAX_CLIP_PLANES:
+         params[0] = ctx->Const.MaxClipPlanes;
+         break;
+      case GL_MAX_ELEMENTS_VERTICES:
+         params[0] = ctx->Const.MaxArrayLockSize;
+         break;
+      case GL_MAX_ELEMENTS_INDICES:
+         params[0] = ctx->Const.MaxArrayLockSize;
+         break;
+      case GL_MAX_EVAL_ORDER:
+         params[0] = MAX_EVAL_ORDER;
+         break;
+      case GL_MAX_LIGHTS:
+         params[0] = ctx->Const.MaxLights;
+         break;
+      case GL_MAX_LIST_NESTING:
+         params[0] = MAX_LIST_NESTING;
+         break;
+      case GL_MAX_MODELVIEW_STACK_DEPTH:
+         params[0] = MAX_MODELVIEW_STACK_DEPTH;
+         break;
+      case GL_MAX_NAME_STACK_DEPTH:
+         params[0] = MAX_NAME_STACK_DEPTH;
+         break;
+      case GL_MAX_PIXEL_MAP_TABLE:
+         params[0] = MAX_PIXEL_MAP_TABLE;
+         break;
+      case GL_MAX_PROJECTION_STACK_DEPTH:
+         params[0] = MAX_PROJECTION_STACK_DEPTH;
+         break;
+      case GL_MAX_TEXTURE_SIZE:
+         params[0] = 1 << (ctx->Const.MaxTextureLevels - 1);
+         break;
+      case GL_MAX_3D_TEXTURE_SIZE:
+         params[0] = 1 << (ctx->Const.Max3DTextureLevels - 1);
+         break;
+      case GL_MAX_TEXTURE_STACK_DEPTH:
+         params[0] = MAX_TEXTURE_STACK_DEPTH;
+         break;
+      case GL_MAX_VIEWPORT_DIMS:
+         params[0] = ctx->Const.MaxViewportWidth;
+         params[1] = ctx->Const.MaxViewportHeight;
+         break;
+      case GL_MODELVIEW_MATRIX:
+         {
+         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[1]);
+         params[2] = IROUND(matrix[2]);
+         params[3] = IROUND(matrix[3]);
+         params[4] = IROUND(matrix[4]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[6]);
+         params[7] = IROUND(matrix[7]);
+         params[8] = IROUND(matrix[8]);
+         params[9] = IROUND(matrix[9]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[11]);
+         params[12] = IROUND(matrix[12]);
+         params[13] = IROUND(matrix[13]);
+         params[14] = IROUND(matrix[14]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_MODELVIEW_STACK_DEPTH:
+         params[0] = ctx->ModelviewMatrixStack.Depth + 1;
+         break;
+      case GL_NAME_STACK_DEPTH:
+         params[0] = ctx->Select.NameStackDepth;
+         break;
+      case GL_NORMALIZE:
+         params[0] = BOOLEAN_TO_INT(ctx->Transform.Normalize);
+         break;
+      case GL_PACK_ALIGNMENT:
+         params[0] = ctx->Pack.Alignment;
+         break;
+      case GL_PACK_LSB_FIRST:
+         params[0] = BOOLEAN_TO_INT(ctx->Pack.LsbFirst);
+         break;
+      case GL_PACK_ROW_LENGTH:
+         params[0] = ctx->Pack.RowLength;
+         break;
+      case GL_PACK_SKIP_PIXELS:
+         params[0] = ctx->Pack.SkipPixels;
+         break;
+      case GL_PACK_SKIP_ROWS:
+         params[0] = ctx->Pack.SkipRows;
+         break;
+      case GL_PACK_SWAP_BYTES:
+         params[0] = BOOLEAN_TO_INT(ctx->Pack.SwapBytes);
+         break;
+      case GL_PACK_SKIP_IMAGES_EXT:
+         params[0] = ctx->Pack.SkipImages;
+         break;
+      case GL_PACK_IMAGE_HEIGHT_EXT:
+         params[0] = ctx->Pack.ImageHeight;
+         break;
+      case GL_PACK_INVERT_MESA:
+         params[0] = BOOLEAN_TO_INT(ctx->Pack.Invert);
+         break;
+      case GL_PERSPECTIVE_CORRECTION_HINT:
+         params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection);
+         break;
+      case GL_PIXEL_MAP_A_TO_A_SIZE:
+         params[0] = ctx->Pixel.MapAtoAsize;
+         break;
+      case GL_PIXEL_MAP_B_TO_B_SIZE:
+         params[0] = ctx->Pixel.MapBtoBsize;
+         break;
+      case GL_PIXEL_MAP_G_TO_G_SIZE:
+         params[0] = ctx->Pixel.MapGtoGsize;
+         break;
+      case GL_PIXEL_MAP_I_TO_A_SIZE:
+         params[0] = ctx->Pixel.MapItoAsize;
+         break;
+      case GL_PIXEL_MAP_I_TO_B_SIZE:
+         params[0] = ctx->Pixel.MapItoBsize;
+         break;
+      case GL_PIXEL_MAP_I_TO_G_SIZE:
+         params[0] = ctx->Pixel.MapItoGsize;
+         break;
+      case GL_PIXEL_MAP_I_TO_I_SIZE:
+         params[0] = ctx->Pixel.MapItoIsize;
+         break;
+      case GL_PIXEL_MAP_I_TO_R_SIZE:
+         params[0] = ctx->Pixel.MapItoRsize;
+         break;
+      case GL_PIXEL_MAP_R_TO_R_SIZE:
+         params[0] = ctx->Pixel.MapRtoRsize;
+         break;
+      case GL_PIXEL_MAP_S_TO_S_SIZE:
+         params[0] = ctx->Pixel.MapStoSsize;
+         break;
+      case GL_POINT_SIZE:
+         params[0] = IROUND(ctx->Point.Size);
+         break;
+      case GL_POINT_SIZE_GRANULARITY:
+         params[0] = IROUND(ctx->Const.PointSizeGranularity);
+         break;
+      case GL_POINT_SIZE_RANGE:
+         params[0] = IROUND(ctx->Const.MinPointSizeAA);
+         params[1] = IROUND(ctx->Const.MaxPointSizeAA);
+         break;
+      case GL_ALIASED_POINT_SIZE_RANGE:
+         params[0] = IROUND(ctx->Const.MinPointSize);
+         params[1] = IROUND(ctx->Const.MaxPointSize);
+         break;
+      case GL_POINT_SMOOTH:
+         params[0] = BOOLEAN_TO_INT(ctx->Point.SmoothFlag);
+         break;
+      case GL_POINT_SMOOTH_HINT:
+         params[0] = ENUM_TO_INT(ctx->Hint.PointSmooth);
+         break;
+      case GL_POINT_SIZE_MIN_EXT:
+         params[0] = IROUND(ctx->Point.MinSize);
+         break;
+      case GL_POINT_SIZE_MAX_EXT:
+         params[0] = IROUND(ctx->Point.MaxSize);
+         break;
+      case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
+         params[0] = IROUND(ctx->Point.Threshold);
+         break;
+      case GL_DISTANCE_ATTENUATION_EXT:
+         params[0] = IROUND(ctx->Point.Params[0]);
+         params[1] = IROUND(ctx->Point.Params[1]);
+         params[2] = IROUND(ctx->Point.Params[2]);
+         break;
+      case GL_POLYGON_MODE:
+         params[0] = ENUM_TO_INT(ctx->Polygon.FrontMode);
+         params[1] = ENUM_TO_INT(ctx->Polygon.BackMode);
+         break;
+      case GL_POLYGON_OFFSET_BIAS_EXT:
+         params[0] = IROUND(ctx->Polygon.OffsetUnits);
+         break;
+      case GL_POLYGON_OFFSET_FACTOR:
+         params[0] = IROUND(ctx->Polygon.OffsetFactor );
+         break;
+      case GL_POLYGON_OFFSET_UNITS:
+         params[0] = IROUND(ctx->Polygon.OffsetUnits );
+         break;
+      case GL_POLYGON_SMOOTH:
+         params[0] = BOOLEAN_TO_INT(ctx->Polygon.SmoothFlag);
+         break;
+      case GL_POLYGON_SMOOTH_HINT:
+         params[0] = ENUM_TO_INT(ctx->Hint.PolygonSmooth);
+         break;
+      case GL_POLYGON_STIPPLE:
+         params[0] = BOOLEAN_TO_INT(ctx->Polygon.StippleFlag);
+         break;
+      case GL_PROJECTION_MATRIX:
+         {
+         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[1]);
+         params[2] = IROUND(matrix[2]);
+         params[3] = IROUND(matrix[3]);
+         params[4] = IROUND(matrix[4]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[6]);
+         params[7] = IROUND(matrix[7]);
+         params[8] = IROUND(matrix[8]);
+         params[9] = IROUND(matrix[9]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[11]);
+         params[12] = IROUND(matrix[12]);
+         params[13] = IROUND(matrix[13]);
+         params[14] = IROUND(matrix[14]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_PROJECTION_STACK_DEPTH:
+         params[0] = ctx->ProjectionMatrixStack.Depth + 1;
+         break;
+      case GL_READ_BUFFER:
+         params[0] = ENUM_TO_INT(ctx->Pixel.ReadBuffer);
+         break;
+      case GL_RED_BIAS:
+         params[0] = IROUND(ctx->Pixel.RedBias);
+         break;
+      case GL_RED_BITS:
+         params[0] =  ctx->Visual.redBits ;
+         break;
+      case GL_RED_SCALE:
+         params[0] = IROUND(ctx->Pixel.RedScale);
+         break;
+      case GL_RENDER_MODE:
+         params[0] = ENUM_TO_INT(ctx->RenderMode);
+         break;
+      case GL_RESCALE_NORMAL:
+         params[0] = BOOLEAN_TO_INT(ctx->Transform.RescaleNormals);
+         break;
+      case GL_RGBA_MODE:
+         params[0] = BOOLEAN_TO_INT(ctx->Visual.rgbMode);
+         break;
+      case GL_SCISSOR_BOX:
+         params[0] = ctx->Scissor.X;
+         params[1] = ctx->Scissor.Y;
+         params[2] = ctx->Scissor.Width;
+         params[3] = ctx->Scissor.Height;
+         break;
+      case GL_SCISSOR_TEST:
+         params[0] = BOOLEAN_TO_INT(ctx->Scissor.Enabled);
+         break;
+      case GL_SELECTION_BUFFER_SIZE:
+         params[0] = ctx->Select.BufferSize;
+         break;
+      case GL_SHADE_MODEL:
+         params[0] = ENUM_TO_INT(ctx->Light.ShadeModel);
+         break;
+      case GL_SHARED_TEXTURE_PALETTE_EXT:
+         params[0] = BOOLEAN_TO_INT(ctx->Texture.SharedPalette);
+         break;
+      case GL_STENCIL_BITS:
+         params[0] = ctx->Visual.stencilBits;
+         break;
+      case GL_STENCIL_CLEAR_VALUE:
+         params[0] = ctx->Stencil.Clear;
+         break;
+      case GL_STENCIL_FAIL:
+         params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_FUNC:
+         params[0] = ENUM_TO_INT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_PASS_DEPTH_FAIL:
+         params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_PASS_DEPTH_PASS:
+         params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]);
+         break;
+      case GL_STENCIL_REF:
+         params[0] = ctx->Stencil.Ref[ctx->Stencil.ActiveFace];
+         break;
+      case GL_STENCIL_TEST:
+         params[0] = BOOLEAN_TO_INT(ctx->Stencil.Enabled);
+         break;
+      case GL_STENCIL_VALUE_MASK:
+         params[0] = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace];
+         break;
+      case GL_STENCIL_WRITEMASK:
+         params[0] = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace];
+         break;
+      case GL_STEREO:
+         params[0] = BOOLEAN_TO_INT(ctx->Visual.stereoMode);
+         break;
+      case GL_SUBPIXEL_BITS:
+         params[0] = ctx->Const.SubPixelBits;
+         break;
+      case GL_TEXTURE_1D:
+         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D));
+         break;
+      case GL_TEXTURE_2D:
+         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D));
+         break;
+      case GL_TEXTURE_3D:
+         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D));
+         break;
+      case GL_TEXTURE_BINDING_1D:
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name;
+         break;
+      case GL_TEXTURE_BINDING_2D:
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name;
+         break;
+      case GL_TEXTURE_BINDING_3D:
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name;
+         break;
+      case GL_TEXTURE_ENV_COLOR:
+         {
+         const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
+         params[0] = FLOAT_TO_INT(color[0]);
+         params[1] = FLOAT_TO_INT(color[1]);
+         params[2] = FLOAT_TO_INT(color[2]);
+         params[3] = FLOAT_TO_INT(color[3]);
+         }
+         break;
+      case GL_TEXTURE_ENV_MODE:
+         params[0] = ENUM_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode);
+         break;
+      case GL_TEXTURE_GEN_S:
+         params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
+         break;
+      case GL_TEXTURE_GEN_T:
+         params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0));
+         break;
+      case GL_TEXTURE_GEN_R:
+         params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0));
+         break;
+      case GL_TEXTURE_GEN_Q:
+         params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0));
+         break;
+      case GL_TEXTURE_MATRIX:
+         {
+         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[1]);
+         params[2] = IROUND(matrix[2]);
+         params[3] = IROUND(matrix[3]);
+         params[4] = IROUND(matrix[4]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[6]);
+         params[7] = IROUND(matrix[7]);
+         params[8] = IROUND(matrix[8]);
+         params[9] = IROUND(matrix[9]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[11]);
+         params[12] = IROUND(matrix[12]);
+         params[13] = IROUND(matrix[13]);
+         params[14] = IROUND(matrix[14]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_TEXTURE_STACK_DEPTH:
+         params[0] = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1;
+         break;
+      case GL_UNPACK_ALIGNMENT:
+         params[0] = ctx->Unpack.Alignment;
+         break;
+      case GL_UNPACK_LSB_FIRST:
+         params[0] = BOOLEAN_TO_INT(ctx->Unpack.LsbFirst);
+         break;
+      case GL_UNPACK_ROW_LENGTH:
+         params[0] = ctx->Unpack.RowLength;
+         break;
+      case GL_UNPACK_SKIP_PIXELS:
+         params[0] = ctx->Unpack.SkipPixels;
+         break;
+      case GL_UNPACK_SKIP_ROWS:
+         params[0] = ctx->Unpack.SkipRows;
+         break;
+      case GL_UNPACK_SWAP_BYTES:
+         params[0] = BOOLEAN_TO_INT(ctx->Unpack.SwapBytes);
+         break;
+      case GL_UNPACK_SKIP_IMAGES_EXT:
+         params[0] = ctx->Unpack.SkipImages;
+         break;
+      case GL_UNPACK_IMAGE_HEIGHT_EXT:
+         params[0] = ctx->Unpack.ImageHeight;
+         break;
+      case GL_UNPACK_CLIENT_STORAGE_APPLE:
+         params[0] = BOOLEAN_TO_INT(ctx->Unpack.ClientStorage);
+         break;
+      case GL_VIEWPORT:
+         params[0] = ctx->Viewport.X;
+         params[1] = ctx->Viewport.Y;
+         params[2] = ctx->Viewport.Width;
+         params[3] = ctx->Viewport.Height;
+         break;
+      case GL_ZOOM_X:
+         params[0] = IROUND(ctx->Pixel.ZoomX);
+         break;
+      case GL_ZOOM_Y:
+         params[0] = IROUND(ctx->Pixel.ZoomY);
+         break;
+      case GL_VERTEX_ARRAY:
+         params[0] = BOOLEAN_TO_INT(ctx->Array.Vertex.Enabled);
+         break;
+      case GL_VERTEX_ARRAY_SIZE:
+         params[0] = ctx->Array.Vertex.Size;
+         break;
+      case GL_VERTEX_ARRAY_TYPE:
+         params[0] = ENUM_TO_INT(ctx->Array.Vertex.Type);
+         break;
+      case GL_VERTEX_ARRAY_STRIDE:
+         params[0] = ctx->Array.Vertex.Stride;
+         break;
+      case GL_VERTEX_ARRAY_COUNT_EXT:
+         params[0] = 0;
+         break;
+      case GL_NORMAL_ARRAY:
+         params[0] = ENUM_TO_INT(ctx->Array.Normal.Enabled);
+         break;
+      case GL_NORMAL_ARRAY_TYPE:
+         params[0] = ENUM_TO_INT(ctx->Array.Normal.Type);
+         break;
+      case GL_NORMAL_ARRAY_STRIDE:
+         params[0] = ctx->Array.Normal.Stride;
+         break;
+      case GL_NORMAL_ARRAY_COUNT_EXT:
+         params[0] = 0;
+         break;
+      case GL_COLOR_ARRAY:
+         params[0] = BOOLEAN_TO_INT(ctx->Array.Color.Enabled);
+         break;
+      case GL_COLOR_ARRAY_SIZE:
+         params[0] = ctx->Array.Color.Size;
+         break;
+      case GL_COLOR_ARRAY_TYPE:
+         params[0] = ENUM_TO_INT(ctx->Array.Color.Type);
+         break;
+      case GL_COLOR_ARRAY_STRIDE:
+         params[0] = ctx->Array.Color.Stride;
+         break;
+      case GL_COLOR_ARRAY_COUNT_EXT:
+         params[0] = 0;
+         break;
+      case GL_INDEX_ARRAY:
+         params[0] = BOOLEAN_TO_INT(ctx->Array.Index.Enabled);
+         break;
+      case GL_INDEX_ARRAY_TYPE:
+         params[0] = ENUM_TO_INT(ctx->Array.Index.Type);
+         break;
+      case GL_INDEX_ARRAY_STRIDE:
+         params[0] = ctx->Array.Index.Stride;
+         break;
+      case GL_INDEX_ARRAY_COUNT_EXT:
+         params[0] = 0;
+         break;
+      case GL_TEXTURE_COORD_ARRAY:
+         params[0] = BOOLEAN_TO_INT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_SIZE:
+         params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size;
+         break;
+      case GL_TEXTURE_COORD_ARRAY_TYPE:
+         params[0] = ENUM_TO_INT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type);
+         break;
+      case GL_TEXTURE_COORD_ARRAY_STRIDE:
+         params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride;
+         break;
+      case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
+         params[0] = 0;
+         break;
+      case GL_EDGE_FLAG_ARRAY:
+         params[0] = BOOLEAN_TO_INT(ctx->Array.EdgeFlag.Enabled);
+         break;
+      case GL_EDGE_FLAG_ARRAY_STRIDE:
+         params[0] = ctx->Array.EdgeFlag.Stride;
+         break;
+      case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
+         params[0] = 0;
+         break;
+      case GL_MAX_TEXTURE_UNITS_ARB:
+         CHECK_EXTENSION_I(ARB_multitexture, pname);
+         params[0] = MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits);
+         break;
+      case GL_ACTIVE_TEXTURE_ARB:
+         CHECK_EXTENSION_I(ARB_multitexture, pname);
+         params[0] = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit;
+         break;
+      case GL_CLIENT_ACTIVE_TEXTURE_ARB:
+         CHECK_EXTENSION_I(ARB_multitexture, pname);
+         params[0] = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture;
+         break;
+      case GL_TEXTURE_CUBE_MAP_ARB:
+         CHECK_EXTENSION_I(ARB_texture_cube_map, pname);
+         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB));
+         break;
+      case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+         CHECK_EXTENSION_I(ARB_texture_cube_map, pname);
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name;
+         break;
+      case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+         CHECK_EXTENSION_I(ARB_texture_cube_map, pname);
+         params[0] = (1 << (ctx->Const.MaxCubeTextureLevels - 1));
+         break;
+      case GL_TEXTURE_COMPRESSION_HINT_ARB:
+         CHECK_EXTENSION_I(ARB_texture_compression, pname);
+         params[0] = ctx->Hint.TextureCompression;
+         break;
+      case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
+         CHECK_EXTENSION_I(ARB_texture_compression, pname);
+         params[0] = _mesa_get_compressed_formats(ctx, NULL);
+         break;
+      case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
+         CHECK_EXTENSION_I(ARB_texture_compression, pname);
+         {
+         GLint formats[100];
+         GLuint i, n = _mesa_get_compressed_formats(ctx, formats);
+         for (i = 0; i < n; i++)
+            params[i] = ENUM_TO_BOOLEAN(formats[i]);
+         }
+         break;
+      case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
+         CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname);
+         params[0] = ctx->Array.LockFirst;
+         break;
+      case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT:
+         CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname);
+         params[0] = ctx->Array.LockCount;
+         break;
+      case GL_TRANSPOSE_COLOR_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[4]);
+         params[2] = IROUND(matrix[8]);
+         params[3] = IROUND(matrix[12]);
+         params[4] = IROUND(matrix[1]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[9]);
+         params[7] = IROUND(matrix[13]);
+         params[8] = IROUND(matrix[2]);
+         params[9] = IROUND(matrix[6]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[14]);
+         params[12] = IROUND(matrix[3]);
+         params[13] = IROUND(matrix[7]);
+         params[14] = IROUND(matrix[11]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[4]);
+         params[2] = IROUND(matrix[8]);
+         params[3] = IROUND(matrix[12]);
+         params[4] = IROUND(matrix[1]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[9]);
+         params[7] = IROUND(matrix[13]);
+         params[8] = IROUND(matrix[2]);
+         params[9] = IROUND(matrix[6]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[14]);
+         params[12] = IROUND(matrix[3]);
+         params[13] = IROUND(matrix[7]);
+         params[14] = IROUND(matrix[11]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_TRANSPOSE_PROJECTION_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[4]);
+         params[2] = IROUND(matrix[8]);
+         params[3] = IROUND(matrix[12]);
+         params[4] = IROUND(matrix[1]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[9]);
+         params[7] = IROUND(matrix[13]);
+         params[8] = IROUND(matrix[2]);
+         params[9] = IROUND(matrix[6]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[14]);
+         params[12] = IROUND(matrix[3]);
+         params[13] = IROUND(matrix[7]);
+         params[14] = IROUND(matrix[11]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_TRANSPOSE_TEXTURE_MATRIX_ARB:
+         {
+         const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[4]);
+         params[2] = IROUND(matrix[8]);
+         params[3] = IROUND(matrix[12]);
+         params[4] = IROUND(matrix[1]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[9]);
+         params[7] = IROUND(matrix[13]);
+         params[8] = IROUND(matrix[2]);
+         params[9] = IROUND(matrix[6]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[14]);
+         params[12] = IROUND(matrix[3]);
+         params[13] = IROUND(matrix[7]);
+         params[14] = IROUND(matrix[11]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_OCCLUSION_TEST_HP:
+         CHECK_EXTENSION_I(HP_occlusion_test, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Depth.OcclusionTest);
+         break;
+      case GL_OCCLUSION_TEST_RESULT_HP:
+         CHECK_EXTENSION_I(HP_occlusion_test, pname);
+         {
+         if (ctx->Depth.OcclusionTest)
+            params[0] = ctx->OcclusionResult;
+         else
+            params[0] = ctx->OcclusionResultSaved;
+         /* reset flag now */
+         ctx->OcclusionResult = GL_FALSE;
+         ctx->OcclusionResultSaved = GL_FALSE;
+         return;
+         }
+         break;
+      case GL_PIXEL_TEXTURE_SGIS:
+         CHECK_EXTENSION_I(SGIS_pixel_texture, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled);
+         break;
+      case GL_PIXEL_TEX_GEN_SGIX:
+         CHECK_EXTENSION_I(SGIX_pixel_texture, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled);
+         break;
+      case GL_PIXEL_TEX_GEN_MODE_SGIX:
+         CHECK_EXTENSION_I(SGIX_pixel_texture, pname);
+         params[0] = ENUM_TO_INT(pixel_texgen_mode(ctx));
+         break;
+      case GL_COLOR_MATRIX_SGI:
+         {
+         const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[1]);
+         params[2] = IROUND(matrix[2]);
+         params[3] = IROUND(matrix[3]);
+         params[4] = IROUND(matrix[4]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[6]);
+         params[7] = IROUND(matrix[7]);
+         params[8] = IROUND(matrix[8]);
+         params[9] = IROUND(matrix[9]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[11]);
+         params[12] = IROUND(matrix[12]);
+         params[13] = IROUND(matrix[13]);
+         params[14] = IROUND(matrix[14]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
+         params[0] = ctx->ColorMatrixStack.Depth + 1;
+         break;
+      case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI:
+         params[0] = MAX_COLOR_STACK_DEPTH;
+         break;
+      case GL_POST_COLOR_MATRIX_RED_SCALE_SGI:
+         params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[0]);
+         break;
+      case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI:
+         params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[1]);
+         break;
+      case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI:
+         params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[2]);
+         break;
+      case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI:
+         params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[3]);
+         break;
+      case GL_POST_COLOR_MATRIX_RED_BIAS_SGI:
+         params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[0]);
+         break;
+      case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI:
+         params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[1]);
+         break;
+      case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI:
+         params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[2]);
+         break;
+      case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI:
+         params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[3]);
+         break;
+      case GL_CONVOLUTION_1D_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution1DEnabled);
+         break;
+      case GL_CONVOLUTION_2D_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution2DEnabled);
+         break;
+      case GL_SEPARABLE_2D_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.Separable2DEnabled);
+         break;
+      case GL_POST_CONVOLUTION_RED_SCALE_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = IROUND(ctx->Pixel.PostConvolutionScale[0]);
+         break;
+      case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = IROUND(ctx->Pixel.PostConvolutionScale[1]);
+         break;
+      case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = IROUND(ctx->Pixel.PostConvolutionScale[2]);
+         break;
+      case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = IROUND(ctx->Pixel.PostConvolutionScale[3]);
+         break;
+      case GL_POST_CONVOLUTION_RED_BIAS_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = IROUND(ctx->Pixel.PostConvolutionBias[0]);
+         break;
+      case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = IROUND(ctx->Pixel.PostConvolutionBias[1]);
+         break;
+      case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = IROUND(ctx->Pixel.PostConvolutionBias[2]);
+         break;
+      case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:
+         CHECK_EXTENSION_I(EXT_convolution, pname);
+         params[0] = IROUND(ctx->Pixel.PostConvolutionBias[3]);
+         break;
+      case GL_HISTOGRAM:
+         CHECK_EXTENSION_I(EXT_histogram, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.HistogramEnabled);
+         break;
+      case GL_MINMAX:
+         CHECK_EXTENSION_I(EXT_histogram, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.MinMaxEnabled);
+         break;
+      case GL_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_I(SGI_color_table, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled);
+         break;
+      case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_I(SGI_color_table, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostConvolutionColorTableEnabled);
+         break;
+      case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_I(SGI_color_table, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostColorMatrixColorTableEnabled);
+         break;
+      case GL_TEXTURE_COLOR_TABLE_SGI:
+         CHECK_EXTENSION_I(SGI_texture_color_table, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled);
+         break;
+      case GL_COLOR_SUM_EXT:
+         CHECK_EXTENSION_I(EXT_secondary_color, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Fog.ColorSumEnabled);
+         break;
+      case GL_CURRENT_SECONDARY_COLOR_EXT:
+         CHECK_EXTENSION_I(EXT_secondary_color, pname);
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
+         params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
+         params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
+         params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
+         }
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_EXT:
+         CHECK_EXTENSION_I(EXT_secondary_color, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.SecondaryColor.Enabled);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+         CHECK_EXTENSION_I(EXT_secondary_color, pname);
+         params[0] = ENUM_TO_INT(ctx->Array.SecondaryColor.Type);
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+         CHECK_EXTENSION_I(EXT_secondary_color, pname);
+         params[0] = ctx->Array.SecondaryColor.Stride;
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+         CHECK_EXTENSION_I(EXT_secondary_color, pname);
+         params[0] = ctx->Array.SecondaryColor.Size;
+         break;
+      case GL_CURRENT_FOG_COORDINATE_EXT:
+         CHECK_EXTENSION_I(EXT_fog_coord, pname);
+         {
+         FLUSH_CURRENT(ctx, 0);
+         params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
+         }
+         break;
+      case GL_FOG_COORDINATE_ARRAY_EXT:
+         CHECK_EXTENSION_I(EXT_fog_coord, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.FogCoord.Enabled);
+         break;
+      case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+         CHECK_EXTENSION_I(EXT_fog_coord, pname);
+         params[0] = ENUM_TO_INT(ctx->Array.FogCoord.Type);
+         break;
+      case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+         CHECK_EXTENSION_I(EXT_fog_coord, pname);
+         params[0] = ctx->Array.FogCoord.Stride;
+         break;
+      case GL_FOG_COORDINATE_SOURCE_EXT:
+         CHECK_EXTENSION_I(EXT_fog_coord, pname);
+         params[0] = ENUM_TO_INT(ctx->Fog.FogCoordinateSource);
+         break;
+      case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+         CHECK_EXTENSION_I(EXT_texture_lod_bias, pname);
+         params[0] = IROUND(ctx->Const.MaxTextureLodBias);
+         break;
+      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+         CHECK_EXTENSION_I(EXT_texture_filter_anisotropic, pname);
+         params[0] = IROUND(ctx->Const.MaxTextureMaxAnisotropy);
+         break;
+      case GL_MULTISAMPLE_ARB:
+         CHECK_EXTENSION_I(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Multisample.Enabled);
+         break;
+      case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+         CHECK_EXTENSION_I(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToCoverage);
+         break;
+      case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+         CHECK_EXTENSION_I(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToOne);
+         break;
+      case GL_SAMPLE_COVERAGE_ARB:
+         CHECK_EXTENSION_I(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverage);
+         break;
+      case GL_SAMPLE_COVERAGE_VALUE_ARB:
+         CHECK_EXTENSION_I(ARB_multisample, pname);
+         params[0] = IROUND(ctx->Multisample.SampleCoverageValue);
+         break;
+      case GL_SAMPLE_COVERAGE_INVERT_ARB:
+         CHECK_EXTENSION_I(ARB_multisample, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverageInvert);
+         break;
+      case GL_SAMPLE_BUFFERS_ARB:
+         CHECK_EXTENSION_I(ARB_multisample, pname);
+         params[0] = 0;
+         break;
+      case GL_SAMPLES_ARB:
+         CHECK_EXTENSION_I(ARB_multisample, pname);
+         params[0] = 0;
+         break;
+      case GL_RASTER_POSITION_UNCLIPPED_IBM:
+         CHECK_EXTENSION_I(IBM_rasterpos_clip, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Transform.RasterPositionUnclipped);
+         break;
+      case GL_POINT_SPRITE_NV:
+         CHECK_EXTENSION_I(NV_point_sprite, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Point.PointSprite);
+         break;
+      case GL_POINT_SPRITE_R_MODE_NV:
+         CHECK_EXTENSION_I(NV_point_sprite, pname);
+         params[0] = ENUM_TO_INT(ctx->Point.SpriteRMode);
+         break;
+      case GL_POINT_SPRITE_COORD_ORIGIN:
+         CHECK_EXTENSION_I(NV_point_sprite, pname);
+         params[0] = ENUM_TO_INT(ctx->Point.SpriteOrigin);
+         break;
+      case GL_GENERATE_MIPMAP_HINT_SGIS:
+         CHECK_EXTENSION_I(SGIS_generate_mipmap, pname);
+         params[0] = ENUM_TO_INT(ctx->Hint.GenerateMipmap);
+         break;
+      case GL_VERTEX_PROGRAM_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.Enabled);
+         break;
+      case GL_VERTEX_PROGRAM_POINT_SIZE_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.PointSizeEnabled);
+         break;
+      case GL_VERTEX_PROGRAM_TWO_SIDE_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.TwoSideEnabled);
+         break;
+      case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = ctx->Const.MaxProgramMatrixStackDepth;
+         break;
+      case GL_MAX_TRACK_MATRICES_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = ctx->Const.MaxProgramMatrices;
+         break;
+      case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->CurrentStack->Depth + 1);
+         break;
+      case GL_CURRENT_MATRIX_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         {
+         const GLfloat *matrix = ctx->CurrentStack->Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[1]);
+         params[2] = IROUND(matrix[2]);
+         params[3] = IROUND(matrix[3]);
+         params[4] = IROUND(matrix[4]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[6]);
+         params[7] = IROUND(matrix[7]);
+         params[8] = IROUND(matrix[8]);
+         params[9] = IROUND(matrix[9]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[11]);
+         params[12] = IROUND(matrix[12]);
+         params[13] = IROUND(matrix[13]);
+         params[14] = IROUND(matrix[14]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_VERTEX_PROGRAM_BINDING_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = (ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0);
+         break;
+      case GL_PROGRAM_ERROR_POSITION_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = ctx->Program.ErrorPos;
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY0_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[0].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY1_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[1].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY2_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[2].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY3_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[3].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[4].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY5_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[5].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY6_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[6].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY7_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[7].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY8_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[8].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY9_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[9].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY10_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[10].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY11_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[11].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY12_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[12].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY13_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[13].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY14_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[14].Enabled);
+         break;
+      case GL_VERTEX_ATTRIB_ARRAY15_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[15].Enabled);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB0_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[0]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB1_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[1]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB2_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[2]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB3_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[3]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB4_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[4]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB5_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[5]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB6_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[6]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB7_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[7]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB8_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[8]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB9_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[9]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB10_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[10]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB11_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[11]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB12_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[12]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB13_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[13]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB14_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[14]);
+         break;
+      case GL_MAP1_VERTEX_ATTRIB15_4_NV:
+         CHECK_EXTENSION_I(NV_vertex_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[15]);
+         break;
+      case GL_FRAGMENT_PROGRAM_NV:
+         CHECK_EXTENSION_I(NV_fragment_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled);
+         break;
+      case GL_MAX_TEXTURE_COORDS_NV:
+         CHECK_EXTENSION_I(NV_fragment_program, pname);
+         params[0] = ctx->Const.MaxTextureCoordUnits;
+         break;
+      case GL_MAX_TEXTURE_IMAGE_UNITS_NV:
+         CHECK_EXTENSION_I(NV_fragment_program, pname);
+         params[0] = ctx->Const.MaxTextureImageUnits;
+         break;
+      case GL_FRAGMENT_PROGRAM_BINDING_NV:
+         CHECK_EXTENSION_I(NV_fragment_program, pname);
+         params[0] = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0;
+         break;
+      case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV:
+         CHECK_EXTENSION_I(NV_fragment_program, pname);
+         params[0] = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
+         break;
+      case GL_TEXTURE_RECTANGLE_NV:
+         CHECK_EXTENSION_I(NV_texture_rectangle, pname);
+         params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV));
+         break;
+      case GL_TEXTURE_BINDING_RECTANGLE_NV:
+         CHECK_EXTENSION_I(NV_texture_rectangle, pname);
+         params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name;
+         break;
+      case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+         CHECK_EXTENSION_I(NV_texture_rectangle, pname);
+         params[0] = ctx->Const.MaxTextureRectSize;
+         break;
+      case GL_STENCIL_TEST_TWO_SIDE_EXT:
+         CHECK_EXTENSION_I(EXT_stencil_two_side, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Stencil.TestTwoSide);
+         break;
+      case GL_ACTIVE_STENCIL_FACE_EXT:
+         CHECK_EXTENSION_I(EXT_stencil_two_side, pname);
+         params[0] = ENUM_TO_INT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
+         break;
+      case GL_MAX_SHININESS_NV:
+         CHECK_EXTENSION_I(NV_light_max_exponent, pname);
+         params[0] = IROUND(ctx->Const.MaxShininess);
+         break;
+      case GL_MAX_SPOT_EXPONENT_NV:
+         CHECK_EXTENSION_I(NV_light_max_exponent, pname);
+         params[0] = IROUND(ctx->Const.MaxSpotExponent);
+         break;
+      case GL_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.ArrayBufferObj->Name;
+         break;
+      case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.Vertex.BufferObj->Name;
+         break;
+      case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.Normal.BufferObj->Name;
+         break;
+      case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.Color.BufferObj->Name;
+         break;
+      case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.Index.BufferObj->Name;
+         break;
+      case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name;
+         break;
+      case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.EdgeFlag.BufferObj->Name;
+         break;
+      case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.SecondaryColor.BufferObj->Name;
+         break;
+      case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.FogCoord.BufferObj->Name;
+         break;
+      case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+         params[0] = ctx->Array.ElementArrayBufferObj->Name;
+         break;
+      case GL_PIXEL_PACK_BUFFER_BINDING_EXT:
+         CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname);
+         params[0] = ctx->Pack.BufferObj->Name;
+         break;
+      case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT:
+         CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname);
+         params[0] = ctx->Unpack.BufferObj->Name;
+         break;
+      case GL_MAX_VERTEX_ATTRIBS_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_program, pname);
+         params[0] = ctx->Const.MaxVertexProgramAttribs;
+         break;
+      case GL_FRAGMENT_PROGRAM_ARB:
+         CHECK_EXTENSION_I(ARB_fragment_program, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled);
+         break;
+      case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+         CHECK_EXTENSION_I(ARB_fragment_program, pname);
+         {
+         const GLfloat *matrix = ctx->CurrentStack->Top->m;
+         params[0] = IROUND(matrix[0]);
+         params[1] = IROUND(matrix[4]);
+         params[2] = IROUND(matrix[8]);
+         params[3] = IROUND(matrix[12]);
+         params[4] = IROUND(matrix[1]);
+         params[5] = IROUND(matrix[5]);
+         params[6] = IROUND(matrix[9]);
+         params[7] = IROUND(matrix[13]);
+         params[8] = IROUND(matrix[2]);
+         params[9] = IROUND(matrix[6]);
+         params[10] = IROUND(matrix[10]);
+         params[11] = IROUND(matrix[14]);
+         params[12] = IROUND(matrix[3]);
+         params[13] = IROUND(matrix[7]);
+         params[14] = IROUND(matrix[11]);
+         params[15] = IROUND(matrix[15]);
+         }
+         break;
+      case GL_DEPTH_BOUNDS_TEST_EXT:
+         CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->Depth.BoundsTest);
+         break;
+      case GL_DEPTH_BOUNDS_EXT:
+         CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);
+         params[0] = IROUND(ctx->Depth.BoundsMin);
+         params[1] = IROUND(ctx->Depth.BoundsMax);
+         break;
+      case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+         CHECK_EXTENSION_I(MESA_program_debug, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.CallbackEnabled);
+         break;
+      case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+         CHECK_EXTENSION_I(MESA_program_debug, pname);
+         params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.CallbackEnabled);
+         break;
+      case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+         CHECK_EXTENSION_I(MESA_program_debug, pname);
+         params[0] = ctx->FragmentProgram.CurrentPosition;
+         break;
+      case GL_VERTEX_PROGRAM_POSITION_MESA:
+         CHECK_EXTENSION_I(MESA_program_debug, pname);
+         params[0] = ctx->VertexProgram.CurrentPosition;
+         break;
+      case GL_MAX_DRAW_BUFFERS_ARB:
+         CHECK_EXTENSION_I(ARB_draw_buffers, pname);
+         params[0] = ctx->Const.MaxDrawBuffers;
+         break;
+      case GL_DRAW_BUFFER0_ARB:
+         CHECK_EXTENSION_I(ARB_draw_buffers, pname);
+         params[0] = ENUM_TO_INT(ctx->Color.DrawBuffer[0]);
+         break;
+      case GL_DRAW_BUFFER1_ARB:
+         CHECK_EXTENSION_I(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[1];
+         params[0] = ENUM_TO_INT(buffer);
+         }
+         break;
+      case GL_DRAW_BUFFER2_ARB:
+         CHECK_EXTENSION_I(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[2];
+         params[0] = ENUM_TO_INT(buffer);
+         }
+         break;
+      case GL_DRAW_BUFFER3_ARB:
+         CHECK_EXTENSION_I(ARB_draw_buffers, pname);
+         {
+         GLenum buffer;
+         if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+            _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+            return;
+         }
+         buffer = ctx->Color.DrawBuffer[3];
+         params[0] = ENUM_TO_INT(buffer);
+         }
+         break;
+      case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
+         CHECK_EXTENSION_I(OES_read_format, pname);
+         params[0] = ctx->Const.ColorReadType;
+         break;
+      case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
+         CHECK_EXTENSION_I(OES_read_format, pname);
+         params[0] = ctx->Const.ColorReadFormat;
+         break;
+      case GL_NUM_FRAGMENT_REGISTERS_ATI:
+         CHECK_EXTENSION_I(ATI_fragment_shader, pname);
+         params[0] = 6;
+         break;
+      case GL_NUM_FRAGMENT_CONSTANTS_ATI:
+         CHECK_EXTENSION_I(ATI_fragment_shader, pname);
+         params[0] = 8;
+         break;
+      case GL_NUM_PASSES_ATI:
+         CHECK_EXTENSION_I(ATI_fragment_shader, pname);
+         params[0] = 2;
+         break;
+      case GL_NUM_INSTRUCTIONS_PER_PASS_ATI:
+         CHECK_EXTENSION_I(ATI_fragment_shader, pname);
+         params[0] = 8;
+         break;
+      case GL_NUM_INSTRUCTIONS_TOTAL_ATI:
+         CHECK_EXTENSION_I(ATI_fragment_shader, pname);
+         params[0] = 16;
+         break;
+      case GL_COLOR_ALPHA_PAIRING_ATI:
+         CHECK_EXTENSION_I(ATI_fragment_shader, pname);
+         params[0] = BOOLEAN_TO_INT(GL_TRUE);
+         break;
+      case GL_NUM_LOOPBACK_COMPONENTS_ATI:
+         CHECK_EXTENSION_I(ATI_fragment_shader, pname);
+         params[0] = 3;
+         break;
+      case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI:
+         CHECK_EXTENSION_I(ATI_fragment_shader, pname);
+         params[0] = 3;
+         break;
+      case GL_STENCIL_BACK_FUNC:
+         params[0] = ENUM_TO_INT(ctx->Stencil.Function[1]);
+         break;
+      case GL_STENCIL_BACK_VALUE_MASK:
+         params[0] = ctx->Stencil.ValueMask[1];
+         break;
+      case GL_STENCIL_BACK_REF:
+         params[0] = ctx->Stencil.Ref[1];
+         break;
+      case GL_STENCIL_BACK_FAIL:
+         params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[1]);
+         break;
+      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+         params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[1]);
+         break;
+      case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+         params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[1]);
+         break;
+      case GL_FRAMEBUFFER_BINDING_EXT:
+         CHECK_EXTENSION_I(EXT_framebuffer_object, pname);
+         params[0] = ctx->CurrentFramebuffer ? ctx->CurrentFramebuffer->Name : 0;
+         break;
+      case GL_RENDERBUFFER_BINDING_EXT:
+         CHECK_EXTENSION_I(EXT_framebuffer_object, pname);
+         params[0] = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;
+         break;
+      case GL_MAX_COLOR_ATTACHMENTS_EXT:
+         CHECK_EXTENSION_I(EXT_framebuffer_object, pname);
+         params[0] = ctx->Const.MaxColorAttachments;
+         break;
+      case GL_MAX_RENDERBUFFER_SIZE_EXT:
+         CHECK_EXTENSION_I(EXT_framebuffer_object, pname);
+         params[0] = ctx->Const.MaxRenderbufferSize;
+         break;
+      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:
+         CHECK_EXTENSION_I(ARB_fragment_shader, pname);
+         params[0] = MAX_FRAGMENT_UNIFORM_COMPONENTS;
+         break;
+      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
+         CHECK_EXTENSION_I(ARB_fragment_shader, pname);
+         params[0] = ENUM_TO_INT(ctx->Hint.FragmentShaderDerivative);
+         break;
+      case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_shader, pname);
+         params[0] = MAX_VERTEX_UNIFORM_COMPONENTS;
+         break;
+      case GL_MAX_VARYING_FLOATS_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_shader, pname);
+         params[0] = MAX_VARYING_FLOATS;
+         break;
+      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_shader, pname);
+         params[0] = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
+         break;
+      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
+         CHECK_EXTENSION_I(ARB_vertex_shader, pname);
+         params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
+         break;
+      default:
+         _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
+   }
+}
+
+
+void GLAPIENTRY
+_mesa_GetDoublev( GLenum pname, GLdouble *params )
+{
+   const GLfloat magic = -1234.5F;
+   GLfloat values[16];
+   GLuint i;
+
+   if (!params)
+      return;
+
+   /* Init temp array to magic numbers so we can figure out how many values
+    * are returned by the GetFloatv() call.
+    */
+   for (i = 0; i < 16; i++)
+      values[i] = magic;
+
+   _mesa_GetFloatv(pname, values);
+   
+   for (i = 0; values[i] != magic && i < 16; i++)
+      params[i] = (GLdouble) values[i];
+}
+
index 4be5c28fdf0ea2c0090feb075daae47fb82be32e..37803b7b4bd57d2c6f8f4f77b399cf7ac5bb7858 100644 (file)
@@ -706,7 +706,7 @@ struct gl_hint_attrib
    GLenum Fog;
    GLenum ClipVolumeClipping;   /**< GL_EXT_clip_volume_hint */
    GLenum TextureCompression;   /**< GL_ARB_texture_compression */
-   GLenum GenerateMipmap;       /**< GL_SGIS_generate_mipmap */\r
+   GLenum GenerateMipmap;       /**< GL_SGIS_generate_mipmap */
    GLenum FragmentShaderDerivative; /**< GL_ARB_fragment_shader */
 };
 
@@ -2126,7 +2126,7 @@ struct gl_extensions
    GLboolean ARB_multitexture;
    GLboolean ARB_occlusion_query;
    GLboolean ARB_point_sprite;
-   GLboolean ARB_shader_objects;\r
+   GLboolean ARB_shader_objects;
    GLboolean ARB_shading_language_100;
    GLboolean ARB_shadow;
    GLboolean ARB_texture_border_clamp;
index dece1e95fe364ca3a694f4ef27bfebda9bee79bf..08a0d1bd589c8bd927641cbc3108c78f76644e59 100644 (file)
-".syntax translation_unit;\n"\r
-".emtcode REVISION 2\n"\r
-".emtcode EXTERNAL_NULL 0\n"\r
-".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n"\r
-".emtcode EXTERNAL_DECLARATION 2\n"\r
-".emtcode DECLARATION_FUNCTION_PROTOTYPE 1\n"\r
-".emtcode DECLARATION_INIT_DECLARATOR_LIST 2\n"\r
-".emtcode FUNCTION_ORDINARY 0\n"\r
-".emtcode FUNCTION_CONSTRUCTOR 1\n"\r
-".emtcode FUNCTION_OPERATOR 2\n"\r
-".emtcode OPERATOR_ASSIGN 1\n"\r
-".emtcode OPERATOR_ADDASSIGN 2\n"\r
-".emtcode OPERATOR_SUBASSIGN 3\n"\r
-".emtcode OPERATOR_MULASSIGN 4\n"\r
-".emtcode OPERATOR_DIVASSIGN 5\n"\r
-".emtcode OPERATOR_LOGICALXOR 12\n"\r
-".emtcode OPERATOR_EQUAL 16\n"\r
-".emtcode OPERATOR_NOTEQUAL 17\n"\r
-".emtcode OPERATOR_LESS 18\n"\r
-".emtcode OPERATOR_GREATER 19\n"\r
-".emtcode OPERATOR_LESSEQUAL 20\n"\r
-".emtcode OPERATOR_GREATEREQUAL 21\n"\r
-".emtcode OPERATOR_MULTIPLY 24\n"\r
-".emtcode OPERATOR_DIVIDE 25\n"\r
-".emtcode OPERATOR_INCREMENT 27\n"\r
-".emtcode OPERATOR_DECREMENT 28\n"\r
-".emtcode OPERATOR_PLUS 29\n"\r
-".emtcode OPERATOR_MINUS 30\n"\r
-".emtcode OPERATOR_NOT 32\n"\r
-".emtcode DECLARATOR_NONE 0\n"\r
-".emtcode DECLARATOR_NEXT 1\n"\r
-".emtcode VARIABLE_NONE 0\n"\r
-".emtcode VARIABLE_IDENTIFIER 1\n"\r
-".emtcode VARIABLE_INITIALIZER 2\n"\r
-".emtcode VARIABLE_ARRAY_EXPLICIT 3\n"\r
-".emtcode VARIABLE_ARRAY_UNKNOWN 4\n"\r
-".emtcode TYPE_QUALIFIER_NONE 0\n"\r
-".emtcode TYPE_QUALIFIER_CONST 1\n"\r
-".emtcode TYPE_QUALIFIER_ATTRIBUTE 2\n"\r
-".emtcode TYPE_QUALIFIER_VARYING 3\n"\r
-".emtcode TYPE_QUALIFIER_UNIFORM 4\n"\r
-".emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5\n"\r
-".emtcode TYPE_QUALIFIER_FIXEDINPUT 6\n"\r
-".emtcode TYPE_SPECIFIER_VOID 0\n"\r
-".emtcode TYPE_SPECIFIER_BOOL 1\n"\r
-".emtcode TYPE_SPECIFIER_BVEC2 2\n"\r
-".emtcode TYPE_SPECIFIER_BVEC3 3\n"\r
-".emtcode TYPE_SPECIFIER_BVEC4 4\n"\r
-".emtcode TYPE_SPECIFIER_INT 5\n"\r
-".emtcode TYPE_SPECIFIER_IVEC2 6\n"\r
-".emtcode TYPE_SPECIFIER_IVEC3 7\n"\r
-".emtcode TYPE_SPECIFIER_IVEC4 8\n"\r
-".emtcode TYPE_SPECIFIER_FLOAT 9\n"\r
-".emtcode TYPE_SPECIFIER_VEC2 10\n"\r
-".emtcode TYPE_SPECIFIER_VEC3 11\n"\r
-".emtcode TYPE_SPECIFIER_VEC4 12\n"\r
-".emtcode TYPE_SPECIFIER_MAT2 13\n"\r
-".emtcode TYPE_SPECIFIER_MAT3 14\n"\r
-".emtcode TYPE_SPECIFIER_MAT4 15\n"\r
-".emtcode TYPE_SPECIFIER_SAMPLER1D 16\n"\r
-".emtcode TYPE_SPECIFIER_SAMPLER2D 17\n"\r
-".emtcode TYPE_SPECIFIER_SAMPLER3D 18\n"\r
-".emtcode TYPE_SPECIFIER_SAMPLERCUBE 19\n"\r
-".emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20\n"\r
-".emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21\n"\r
-".emtcode TYPE_SPECIFIER_STRUCT 22\n"\r
-".emtcode TYPE_SPECIFIER_TYPENAME 23\n"\r
-".emtcode FIELD_NONE 0\n"\r
-".emtcode FIELD_NEXT 1\n"\r
-".emtcode FIELD_ARRAY 2\n"\r
-".emtcode OP_END 0\n"\r
-".emtcode OP_BLOCK_BEGIN_NO_NEW_SCOPE 1\n"\r
-".emtcode OP_BLOCK_BEGIN_NEW_SCOPE 2\n"\r
-".emtcode OP_DECLARE 3\n"\r
-".emtcode OP_ASM 4\n"\r
-".emtcode OP_BREAK 5\n"\r
-".emtcode OP_CONTINUE 6\n"\r
-".emtcode OP_DISCARD 7\n"\r
-".emtcode OP_RETURN 8\n"\r
-".emtcode OP_EXPRESSION 9\n"\r
-".emtcode OP_IF 10\n"\r
-".emtcode OP_WHILE 11\n"\r
-".emtcode OP_DO 12\n"\r
-".emtcode OP_FOR 13\n"\r
-".emtcode OP_PUSH_VOID 14\n"\r
-".emtcode OP_PUSH_BOOL 15\n"\r
-".emtcode OP_PUSH_INT 16\n"\r
-".emtcode OP_PUSH_FLOAT 17\n"\r
-".emtcode OP_PUSH_IDENTIFIER 18\n"\r
-".emtcode OP_SEQUENCE 19\n"\r
-".emtcode OP_ASSIGN 20\n"\r
-".emtcode OP_ADDASSIGN 21\n"\r
-".emtcode OP_SUBASSIGN 22\n"\r
-".emtcode OP_MULASSIGN 23\n"\r
-".emtcode OP_DIVASSIGN 24\n"\r
-".emtcode OP_SELECT 31\n"\r
-".emtcode OP_LOGICALOR 32\n"\r
-".emtcode OP_LOGICALXOR 33\n"\r
-".emtcode OP_LOGICALAND 34\n"\r
-".emtcode OP_EQUAL 38\n"\r
-".emtcode OP_NOTEQUAL 39\n"\r
-".emtcode OP_LESS 40\n"\r
-".emtcode OP_GREATER 41\n"\r
-".emtcode OP_LESSEQUAL 42\n"\r
-".emtcode OP_GREATEREQUAL 43\n"\r
-".emtcode OP_ADD 46\n"\r
-".emtcode OP_SUBTRACT 47\n"\r
-".emtcode OP_MULTIPLY 48\n"\r
-".emtcode OP_DIVIDE 49\n"\r
-".emtcode OP_PREINCREMENT 51\n"\r
-".emtcode OP_PREDECREMENT 52\n"\r
-".emtcode OP_PLUS 53\n"\r
-".emtcode OP_MINUS 54\n"\r
-".emtcode OP_NOT 56\n"\r
-".emtcode OP_SUBSCRIPT 57\n"\r
-".emtcode OP_CALL 58\n"\r
-".emtcode OP_FIELD 59\n"\r
-".emtcode OP_POSTINCREMENT 60\n"\r
-".emtcode OP_POSTDECREMENT 61\n"\r
-".emtcode PARAM_QUALIFIER_IN 0\n"\r
-".emtcode PARAM_QUALIFIER_OUT 1\n"\r
-".emtcode PARAM_QUALIFIER_INOUT 2\n"\r
-".emtcode PARAMETER_NONE 0\n"\r
-".emtcode PARAMETER_NEXT 1\n"\r
-".emtcode PARAMETER_ARRAY_NOT_PRESENT 0\n"\r
-".emtcode PARAMETER_ARRAY_PRESENT 1\n"\r
-".errtext INVALID_EXTERNAL_DECLARATION \"error 2001: invalid external declaration\"\n"\r
-".errtext INVALID_OPERATOR_OVERRIDE \"error 2002: invalid operator override\"\n"\r
-".errtext LBRACE_EXPECTED \"error 2003: '{' expected but '$err_token$' found\"\n"\r
-".errtext LPAREN_EXPECTED \"error 2004: '(' expected but '$err_token$' found\"\n"\r
-".errtext RPAREN_EXPECTED \"error 2005: ')' expected but '$err_token$' found\"\n"\r
-".regbyte parsing_builtin 0\n"\r
-".regbyte shader_type 0\n"\r
-"variable_identifier\n"\r
-" identifier .emit OP_PUSH_IDENTIFIER;\n"\r
-"primary_expression\n"\r
-" floatconstant .or boolconstant .or intconstant .or variable_identifier .or primary_expression_1;\n"\r
-"primary_expression_1\n"\r
-" lparen .and expression .and rparen;\n"\r
-"postfix_expression\n"\r
-" postfix_expression_1 .and .loop postfix_expression_2;\n"\r
-"postfix_expression_1\n"\r
-" function_call .or primary_expression;\n"\r
-"postfix_expression_2\n"\r
-" postfix_expression_3 .or postfix_expression_4 .or\n"\r
-" plusplus .emit OP_POSTINCREMENT .or\n"\r
-" minusminus .emit OP_POSTDECREMENT;\n"\r
-"postfix_expression_3\n"\r
-" lbracket .and integer_expression .and rbracket .emit OP_SUBSCRIPT;\n"\r
-"postfix_expression_4\n"\r
-" dot .and field_selection .emit OP_FIELD;\n"\r
-"integer_expression\n"\r
-" expression;\n"\r
-"function_call\n"\r
-" function_call_generic .emit OP_CALL .and .true .emit OP_END;\n"\r
-"function_call_generic\n"\r
-" function_call_generic_1 .or function_call_generic_2;\n"\r
-"function_call_generic_1\n"\r
-" function_call_header_with_parameters .and rparen .error RPAREN_EXPECTED;\n"\r
-"function_call_generic_2\n"\r
-" function_call_header_no_parameters .and rparen .error RPAREN_EXPECTED;\n"\r
-"function_call_header_no_parameters\n"\r
-" function_call_header .and function_call_header_no_parameters_1;\n"\r
-"function_call_header_no_parameters_1\n"\r
-" \"void\" .or .true;\n"\r
-"function_call_header_with_parameters\n"\r
-" function_call_header .and assignment_expression .and .true .emit OP_END .and\n"\r
-" .loop function_call_header_with_parameters_1;\n"\r
-"function_call_header_with_parameters_1\n"\r
-" comma .and assignment_expression .and .true .emit OP_END;\n"\r
-"function_call_header\n"\r
-" function_identifier .and lparen;\n"\r
-"function_identifier\n"\r
-" identifier;\n"\r
-"unary_expression\n"\r
-" postfix_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or\n"\r
-" unary_expression_4 .or unary_expression_5;\n"\r
-"unary_expression_1\n"\r
-" plusplus .and unary_expression .and .true .emit OP_PREINCREMENT;\n"\r
-"unary_expression_2\n"\r
-" minusminus .and unary_expression .and .true .emit OP_PREDECREMENT;\n"\r
-"unary_expression_3\n"\r
-" plus .and unary_expression .and .true .emit OP_PLUS;\n"\r
-"unary_expression_4\n"\r
-" minus .and unary_expression .and .true .emit OP_MINUS;\n"\r
-"unary_expression_5\n"\r
-" bang .and unary_expression .and .true .emit OP_NOT;\n"\r
-"multiplicative_expression\n"\r
-" unary_expression .and .loop multiplicative_expression_1;\n"\r
-"multiplicative_expression_1\n"\r
-" multiplicative_expression_2 .or multiplicative_expression_3;\n"\r
-"multiplicative_expression_2\n"\r
-" star .and unary_expression .and .true .emit OP_MULTIPLY;\n"\r
-"multiplicative_expression_3\n"\r
-" slash .and unary_expression .and .true .emit OP_DIVIDE;\n"\r
-"additive_expression\n"\r
-" multiplicative_expression .and .loop additive_expression_1;\n"\r
-"additive_expression_1\n"\r
-" additive_expression_2 .or additive_expression_3;\n"\r
-"additive_expression_2\n"\r
-" plus .and multiplicative_expression .and .true .emit OP_ADD;\n"\r
-"additive_expression_3\n"\r
-" minus .and multiplicative_expression .and .true .emit OP_SUBTRACT;\n"\r
-"shift_expression\n"\r
-" additive_expression;\n"\r
-"relational_expression\n"\r
-" shift_expression .and .loop relational_expression_1;\n"\r
-"relational_expression_1\n"\r
-" relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or\n"\r
-" relational_expression_5;\n"\r
-"relational_expression_2\n"\r
-" lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;\n"\r
-"relational_expression_3\n"\r
-" greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;\n"\r
-"relational_expression_4\n"\r
-" less .and shift_expression .and .true .emit OP_LESS;\n"\r
-"relational_expression_5\n"\r
-" greater .and shift_expression .and .true .emit OP_GREATER;\n"\r
-"equality_expression\n"\r
-" relational_expression .and .loop equality_expression_1;\n"\r
-"equality_expression_1\n"\r
-" equality_expression_2 .or equality_expression_3;\n"\r
-"equality_expression_2\n"\r
-" equalsequals .and relational_expression .and .true .emit OP_EQUAL;\n"\r
-"equality_expression_3\n"\r
-" bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;\n"\r
-"and_expression\n"\r
-" equality_expression;\n"\r
-"exclusive_or_expression\n"\r
-" and_expression;\n"\r
-"inclusive_or_expression\n"\r
-" exclusive_or_expression;\n"\r
-"logical_and_expression\n"\r
-" inclusive_or_expression .and .loop logical_and_expression_1;\n"\r
-"logical_and_expression_1\n"\r
-" ampersandampersand .and inclusive_or_expression .and .true .emit OP_LOGICALAND;\n"\r
-"logical_xor_expression\n"\r
-" logical_and_expression .and .loop logical_xor_expression_1;\n"\r
-"logical_xor_expression_1\n"\r
-" caretcaret .and logical_and_expression .and .true .emit OP_LOGICALXOR;\n"\r
-"logical_or_expression\n"\r
-" logical_xor_expression .and .loop logical_or_expression_1;\n"\r
-"logical_or_expression_1\n"\r
-" barbar .and logical_xor_expression .and .true .emit OP_LOGICALOR;\n"\r
-"conditional_expression\n"\r
-" logical_or_expression .and .loop conditional_expression_1;\n"\r
-"conditional_expression_1\n"\r
-" question .and expression .and colon .and conditional_expression .and .true .emit OP_SELECT;\n"\r
-"assignment_expression\n"\r
-" assignment_expression_1 .or assignment_expression_2 .or assignment_expression_3 .or\n"\r
-" assignment_expression_4 .or assignment_expression_5 .or conditional_expression;\n"\r
-"assignment_expression_1\n"\r
-" unary_expression .and equals .and assignment_expression .and .true .emit OP_ASSIGN;\n"\r
-"assignment_expression_2\n"\r
-" unary_expression .and starequals .and assignment_expression .and .true .emit OP_MULASSIGN;\n"\r
-"assignment_expression_3\n"\r
-" unary_expression .and slashequals .and assignment_expression .and .true .emit OP_DIVASSIGN;\n"\r
-"assignment_expression_4\n"\r
-" unary_expression .and plusequals .and assignment_expression .and .true .emit OP_ADDASSIGN;\n"\r
-"assignment_expression_5\n"\r
-" unary_expression .and minusequals .and assignment_expression .and .true .emit OP_SUBASSIGN;\n"\r
-"expression\n"\r
-" assignment_expression .and .loop expression_1;\n"\r
-"expression_1\n"\r
-" comma .and assignment_expression .and .true .emit OP_SEQUENCE;\n"\r
-"constant_expression\n"\r
-" conditional_expression .and .true .emit OP_END;\n"\r
-"declaration\n"\r
-" declaration_1 .or declaration_2;\n"\r
-"declaration_1\n"\r
-" function_prototype .emit DECLARATION_FUNCTION_PROTOTYPE .and semicolon;\n"\r
-"declaration_2\n"\r
-" init_declarator_list .emit DECLARATION_INIT_DECLARATOR_LIST .and semicolon;\n"\r
-"function_prototype\n"\r
-" function_declarator .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;\n"\r
-"function_declarator\n"\r
-" function_header_with_parameters .or function_header;\n"\r
-"function_header_with_parameters\n"\r
-" function_header .and parameter_declaration .and .loop function_header_with_parameters_1;\n"\r
-"function_header_with_parameters_1\n"\r
-" comma .and parameter_declaration;\n"\r
-"function_header\n"\r
-" function_header_nospace .or function_header_space;\n"\r
-"function_header_space\n"\r
-" fully_specified_type_space .and space .and function_decl_identifier .and lparen;\n"\r
-"function_header_nospace\n"\r
-" fully_specified_type_nospace .and function_decl_identifier .and lparen;\n"\r
-"function_decl_identifier\n"\r
-" .if (parsing_builtin != 0) __operator .emit FUNCTION_OPERATOR .or\n"\r
-" .if (parsing_builtin != 0) \"__constructor\" .emit FUNCTION_CONSTRUCTOR .or\n"\r
-" identifier .emit FUNCTION_ORDINARY;\n"\r
-"__operator\n"\r
-" \"__operator\" .and overriden_operator .error INVALID_OPERATOR_OVERRIDE;\n"\r
-"overriden_operator\n"\r
-" plusplus .emit OPERATOR_INCREMENT .or\n"\r
-" plusequals .emit OPERATOR_ADDASSIGN .or\n"\r
-" plus .emit OPERATOR_PLUS .or\n"\r
-" minusminus .emit OPERATOR_DECREMENT .or\n"\r
-" minusequals .emit OPERATOR_SUBASSIGN .or\n"\r
-" minus .emit OPERATOR_MINUS .or\n"\r
-" bangequals .emit OPERATOR_NOTEQUAL .or\n"\r
-" bang .emit OPERATOR_NOT .or\n"\r
-" starequals .emit OPERATOR_MULASSIGN .or\n"\r
-" star .emit OPERATOR_MULTIPLY .or\n"\r
-" slashequals .emit OPERATOR_DIVASSIGN .or\n"\r
-" slash .emit OPERATOR_DIVIDE .or\n"\r
-" lessequals .emit OPERATOR_LESSEQUAL .or\n"\r
-" \n"\r
-" \n"\r
-" less .emit OPERATOR_LESS .or\n"\r
-" greaterequals .emit OPERATOR_GREATEREQUAL .or\n"\r
-" \n"\r
-" \n"\r
-" greater .emit OPERATOR_GREATER .or\n"\r
-" equalsequals .emit OPERATOR_EQUAL .or\n"\r
-" equals .emit OPERATOR_ASSIGN .or\n"\r
-" \n"\r
-" \n"\r
-" \n"\r
-" \n"\r
-" \n"\r
-" \n"\r
-" \n"\r
-" \n"\r
-" caretcaret .emit OPERATOR_LOGICALXOR ;\n"\r
-"parameter_declarator\n"\r
-" parameter_declarator_nospace .or parameter_declarator_space;\n"\r
-"parameter_declarator_nospace\n"\r
-" type_specifier_nospace .and identifier .and parameter_declarator_1;\n"\r
-"parameter_declarator_space\n"\r
-" type_specifier_space .and space .and identifier .and parameter_declarator_1;\n"\r
-"parameter_declarator_1\n"\r
-" parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or\n"\r
-" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n"\r
-"parameter_declarator_2\n"\r
-" lbracket .and constant_expression .and rbracket;\n"\r
-"parameter_declaration\n"\r
-" parameter_declaration_1 .emit PARAMETER_NEXT;\n"\r
-"parameter_declaration_1\n"\r
-" parameter_declaration_2 .or parameter_declaration_3;\n"\r
-"parameter_declaration_2\n"\r
-" type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;\n"\r
-"parameter_declaration_3\n"\r
-" parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;\n"\r
-"parameter_declaration_4\n"\r
-" parameter_declarator .or parameter_type_specifier;\n"\r
-"parameter_qualifier\n"\r
-" parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;\n"\r
-"parameter_qualifier_1\n"\r
-" parameter_qualifier_2 .and space;\n"\r
-"parameter_qualifier_2\n"\r
-" \"in\" .emit PARAM_QUALIFIER_IN .or\n"\r
-" \"out\" .emit PARAM_QUALIFIER_OUT .or\n"\r
-" \"inout\" .emit PARAM_QUALIFIER_INOUT;\n"\r
-"parameter_type_specifier\n"\r
-" parameter_type_specifier_1 .and .true .emit '\\0' .and parameter_type_specifier_2;\n"\r
-"parameter_type_specifier_1\n"\r
-" type_specifier_nospace .or type_specifier_space;\n"\r
-"parameter_type_specifier_2\n"\r
-" parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or\n"\r
-" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n"\r
-"parameter_type_specifier_3\n"\r
-" lbracket .and constant_expression .and rbracket;\n"\r
-"init_declarator_list\n"\r
-" single_declaration .and .loop init_declarator_list_1 .emit DECLARATOR_NEXT .and\n"\r
-" .true .emit DECLARATOR_NONE;\n"\r
-"init_declarator_list_1\n"\r
-" comma .and identifier .emit VARIABLE_IDENTIFIER .and init_declarator_list_2;\n"\r
-"init_declarator_list_2\n"\r
-" init_declarator_list_3 .or init_declarator_list_4 .or .true .emit VARIABLE_NONE;\n"\r
-"init_declarator_list_3\n"\r
-" equals .and initializer .emit VARIABLE_INITIALIZER;\n"\r
-"init_declarator_list_4\n"\r
-" lbracket .and init_declarator_list_5 .and rbracket;\n"\r
-"init_declarator_list_5\n"\r
-" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n"\r
-"single_declaration\n"\r
-" single_declaration_nospace .or single_declaration_space;\n"\r
-"single_declaration_space\n"\r
-" fully_specified_type_space .and single_declaration_space_1;\n"\r
-"single_declaration_nospace\n"\r
-" fully_specified_type_nospace .and single_declaration_nospace_1;\n"\r
-"single_declaration_space_1\n"\r
-" single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n"\r
-"single_declaration_nospace_1\n"\r
-" single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n"\r
-"single_declaration_space_2\n"\r
-" space .and identifier .and single_declaration_3;\n"\r
-"single_declaration_nospace_2\n"\r
-" identifier .and single_declaration_3;\n"\r
-"single_declaration_3\n"\r
-" single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;\n"\r
-"single_declaration_4\n"\r
-" equals .and initializer .emit VARIABLE_INITIALIZER;\n"\r
-"single_declaration_5\n"\r
-" lbracket .and single_declaration_6 .and rbracket;\n"\r
-"single_declaration_6\n"\r
-" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n"\r
-"fully_specified_type_space\n"\r
-" fully_specified_type_1 .and type_specifier_space;\n"\r
-"fully_specified_type_nospace\n"\r
-" fully_specified_type_1 .and type_specifier_nospace;\n"\r
-"fully_specified_type_1\n"\r
-" fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;\n"\r
-"fully_specified_type_2\n"\r
-" type_qualifier .and space;\n"\r
-"type_qualifier\n"\r
-" \"const\" .emit TYPE_QUALIFIER_CONST .or\n"\r
-" .if (shader_type == 2) \"attribute\" .emit TYPE_QUALIFIER_ATTRIBUTE .or\n"\r
-" \"varying\" .emit TYPE_QUALIFIER_VARYING .or\n"\r
-" \"uniform\" .emit TYPE_QUALIFIER_UNIFORM .or\n"\r
-"      .if (parsing_builtin != 0) \"__fixed_output\" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or\n"\r
-"      .if (parsing_builtin != 0) \"__fixed_input\" .emit TYPE_QUALIFIER_FIXEDINPUT;\n"\r
-"type_specifier_space\n"\r
-" \"void\" .emit TYPE_SPECIFIER_VOID .or\n"\r
-" \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n"\r
-" \"int\" .emit TYPE_SPECIFIER_INT .or\n"\r
-" \"bool\" .emit TYPE_SPECIFIER_BOOL .or\n"\r
-" \"vec2\" .emit TYPE_SPECIFIER_VEC2 .or\n"\r
-" \"vec3\" .emit TYPE_SPECIFIER_VEC3 .or\n"\r
-" \"vec4\" .emit TYPE_SPECIFIER_VEC4 .or\n"\r
-" \"bvec2\" .emit TYPE_SPECIFIER_BVEC2 .or\n"\r
-" \"bvec3\" .emit TYPE_SPECIFIER_BVEC3 .or\n"\r
-" \"bvec4\" .emit TYPE_SPECIFIER_BVEC4 .or\n"\r
-" \"ivec2\" .emit TYPE_SPECIFIER_IVEC2 .or\n"\r
-" \"ivec3\" .emit TYPE_SPECIFIER_IVEC3 .or\n"\r
-" \"ivec4\" .emit TYPE_SPECIFIER_IVEC4 .or\n"\r
-" \"mat2\" .emit TYPE_SPECIFIER_MAT2 .or\n"\r
-" \"mat3\" .emit TYPE_SPECIFIER_MAT3 .or\n"\r
-" \"mat4\" .emit TYPE_SPECIFIER_MAT4 .or\n"\r
-" \"sampler1D\" .emit TYPE_SPECIFIER_SAMPLER1D .or\n"\r
-" \"sampler2D\" .emit TYPE_SPECIFIER_SAMPLER2D .or\n"\r
-" \"sampler3D\" .emit TYPE_SPECIFIER_SAMPLER3D .or\n"\r
-" \"samplerCube\" .emit TYPE_SPECIFIER_SAMPLERCUBE .or\n"\r
-" \"sampler1DShadow\" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or\n"\r
-" \"sampler2DShadow\" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or\n"\r
-" type_name .emit TYPE_SPECIFIER_TYPENAME;\n"\r
-"type_specifier_nospace\n"\r
-" struct_specifier .emit TYPE_SPECIFIER_STRUCT;\n"\r
-"struct_specifier\n"\r
-" \"struct\" .and struct_specifier_1 .and optional_space .and lbrace .error LBRACE_EXPECTED .and\n"\r
-" struct_declaration_list .and rbrace .emit FIELD_NONE;\n"\r
-"struct_specifier_1\n"\r
-" struct_specifier_2 .or .true .emit '\\0';\n"\r
-"struct_specifier_2\n"\r
-" space .and identifier;\n"\r
-"struct_declaration_list\n"\r
-" struct_declaration .and .loop struct_declaration .emit FIELD_NEXT;\n"\r
-"struct_declaration\n"\r
-" struct_declaration_nospace .or struct_declaration_space;\n"\r
-"struct_declaration_space\n"\r
-" type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n"\r
-"struct_declaration_nospace\n"\r
-" type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n"\r
-"struct_declarator_list\n"\r
-" struct_declarator .and .loop struct_declarator_list_1 .emit FIELD_NEXT;\n"\r
-"struct_declarator_list_1\n"\r
-" comma .and struct_declarator;\n"\r
-"struct_declarator\n"\r
-" identifier .and struct_declarator_1;\n"\r
-"struct_declarator_1\n"\r
-" struct_declarator_2 .emit FIELD_ARRAY .or .true .emit FIELD_NONE;\n"\r
-"struct_declarator_2\n"\r
-" lbracket .and constant_expression .and rbracket;\n"\r
-"initializer\n"\r
-" assignment_expression .and .true .emit OP_END;\n"\r
-"declaration_statement\n"\r
-" declaration;\n"\r
-"statement\n"\r
-" compound_statement .or simple_statement;\n"\r
-"statement_space\n"\r
-" compound_statement .or statement_space_1;\n"\r
-"statement_space_1\n"\r
-" space .and simple_statement;\n"\r
-"simple_statement\n"\r
-" .if (parsing_builtin != 0) __asm_statement .emit OP_ASM .or\n"\r
-" selection_statement .or\n"\r
-" iteration_statement .or\n"\r
-" jump_statement .or\n"\r
-" expression_statement .emit OP_EXPRESSION .or\n"\r
-" declaration_statement .emit OP_DECLARE;\n"\r
-"compound_statement\n"\r
-" compound_statement_1 .emit OP_BLOCK_BEGIN_NEW_SCOPE .and .true .emit OP_END;\n"\r
-"compound_statement_1\n"\r
-" compound_statement_2 .or compound_statement_3;\n"\r
-"compound_statement_2\n"\r
-" lbrace .and rbrace;\n"\r
-"compound_statement_3\n"\r
-" lbrace .and statement_list .and rbrace;\n"\r
-"statement_no_new_scope\n"\r
-" compound_statement_no_new_scope .or simple_statement;\n"\r
-"compound_statement_no_new_scope\n"\r
-" compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n"\r
-"compound_statement_no_new_scope_1\n"\r
-" compound_statement_no_new_scope_2 .or compound_statement_no_new_scope_3;\n"\r
-"compound_statement_no_new_scope_2\n"\r
-" lbrace .and rbrace;\n"\r
-"compound_statement_no_new_scope_3\n"\r
-" lbrace .and statement_list .and rbrace;\n"\r
-"statement_list\n"\r
-" statement .and .loop statement;\n"\r
-"expression_statement\n"\r
-" expression_statement_1 .or expression_statement_2;\n"\r
-"expression_statement_1\n"\r
-" semicolon .emit OP_PUSH_VOID .emit OP_END;\n"\r
-"expression_statement_2\n"\r
-" expression .and semicolon .emit OP_END;\n"\r
-"selection_statement\n"\r
-" \"if\" .emit OP_IF .and lparen .error LPAREN_EXPECTED .and expression .and\n"\r
-" rparen .error RPAREN_EXPECTED .emit OP_END .and selection_rest_statement;\n"\r
-"selection_rest_statement\n"\r
-" statement .and selection_rest_statement_1;\n"\r
-"selection_rest_statement_1\n"\r
-" selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;\n"\r
-"selection_rest_statement_2\n"\r
-" \"else\" .and optional_space .and statement;\n"\r
-"condition\n"\r
-" condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or\n"\r
-" condition_3 .emit OP_EXPRESSION;\n"\r
-"condition_1\n"\r
-" condition_1_nospace .or condition_1_space;\n"\r
-"condition_1_nospace\n"\r
-" fully_specified_type_nospace .and condition_2;\n"\r
-"condition_1_space\n"\r
-" fully_specified_type_space .and space .and condition_2;\n"\r
-"condition_2\n"\r
-" identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and\n"\r
-" initializer .and .true .emit DECLARATOR_NONE;\n"\r
-"condition_3\n"\r
-" expression .and .true .emit OP_END;\n"\r
-"iteration_statement\n"\r
-" iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;\n"\r
-"iteration_statement_1\n"\r
-" \"while\" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and\n"\r
-" rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"\r
-"iteration_statement_2\n"\r
-" \"do\" .emit OP_DO .and statement_space .and \"while\" .and lparen .error LPAREN_EXPECTED .and\n"\r
-" expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n"\r
-"iteration_statement_3\n"\r
-" \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n"\r
-" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"\r
-"for_init_statement\n"\r
-" expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n"\r
-"conditionopt\n"\r
-" condition .or\n"\r
-" .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\\0' .emit OP_END;\n"\r
-"for_rest_statement\n"\r
-" conditionopt .and semicolon .and for_rest_statement_1;\n"\r
-"for_rest_statement_1\n"\r
-" for_rest_statement_2 .or .true .emit OP_PUSH_VOID .emit OP_END;\n"\r
-"for_rest_statement_2\n"\r
-" expression .and .true .emit OP_END;\n"\r
-"jump_statement\n"\r
-" jump_statement_1 .or jump_statement_2 .or jump_statement_3 .or jump_statement_4 .or\n"\r
-" .if (shader_type == 1) jump_statement_5;\n"\r
-"jump_statement_1\n"\r
-" \"continue\" .and semicolon .emit OP_CONTINUE;\n"\r
-"jump_statement_2\n"\r
-" \"break\" .and semicolon .emit OP_BREAK;\n"\r
-"jump_statement_3\n"\r
-" \"return\" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;\n"\r
-"jump_statement_4\n"\r
-" \"return\" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;\n"\r
-"jump_statement_5\n"\r
-" \"discard\" .and semicolon .emit OP_DISCARD;\n"\r
-"__asm_statement\n"\r
-" \"__asm\" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;\n"\r
-"asm_arguments\n"\r
-" variable_identifier .and .true .emit OP_END .and .loop asm_arguments_1;\n"\r
-"asm_arguments_1\n"\r
-" comma .and variable_identifier .and .true .emit OP_END;\n"\r
-"translation_unit\n"\r
-" optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and\n"\r
-" .loop external_declaration .and optional_space .and\n"\r
-" '\\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;\n"\r
-"external_declaration\n"\r
-" function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or\n"\r
-" declaration .emit EXTERNAL_DECLARATION;\n"\r
-"function_definition\n"\r
-" function_prototype .and compound_statement_no_new_scope;\n"\r
-"digit_oct\n"\r
-" '0'-'7';\n"\r
-"digit_dec\n"\r
-" '0'-'9';\n"\r
-"digit_hex\n"\r
-" '0'-'9' .or 'A'-'F' .or 'a'-'f';\n"\r
-"id_character_first\n"\r
-" 'a'-'z' .or 'A'-'Z' .or '_';\n"\r
-"id_character_next\n"\r
-" id_character_first .or digit_dec;\n"\r
-"identifier\n"\r
-" id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\\0';\n"\r
-"float\n"\r
-" float_1 .or float_2;\n"\r
-"float_1\n"\r
-" float_fractional_constant .and float_optional_exponent_part;\n"\r
-"float_2\n"\r
-" float_digit_sequence .and .true .emit '\\0' .and float_exponent_part;\n"\r
-"float_fractional_constant\n"\r
-" float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;\n"\r
-"float_fractional_constant_1\n"\r
-" float_digit_sequence .and '.' .and float_digit_sequence;\n"\r
-"float_fractional_constant_2\n"\r
-" float_digit_sequence .and '.' .and .true .emit '\\0';\n"\r
-"float_fractional_constant_3\n"\r
-" '.' .emit '\\0' .and float_digit_sequence;\n"\r
-"float_optional_exponent_part\n"\r
-" float_exponent_part .or .true .emit '\\0';\n"\r
-"float_digit_sequence\n"\r
-" digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"\r
-"float_exponent_part\n"\r
-" float_exponent_part_1 .or float_exponent_part_2;\n"\r
-"float_exponent_part_1\n"\r
-" 'e' .and float_optional_sign .and float_digit_sequence;\n"\r
-"float_exponent_part_2\n"\r
-" 'E' .and float_optional_sign .and float_digit_sequence;\n"\r
-"float_optional_sign\n"\r
-" float_sign .or .true;\n"\r
-"float_sign\n"\r
-" '+' .or '-' .emit '-';\n"\r
-"integer\n"\r
-" integer_hex .or integer_oct .or integer_dec;\n"\r
-"integer_hex\n"\r
-" '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and\n"\r
-" .true .emit '\\0';\n"\r
-"integer_hex_1\n"\r
-" 'x' .or 'X';\n"\r
-"integer_oct\n"\r
-" '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\\0';\n"\r
-"integer_dec\n"\r
-" digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"\r
-"boolean\n"\r
-" \"true\" .emit 2 .emit '1' .emit '\\0' .or\n"\r
-" \"false\" .emit 2 .emit '0' .emit '\\0';\n"\r
-"type_name\n"\r
-" identifier;\n"\r
-"field_selection\n"\r
-" identifier;\n"\r
-"floatconstant\n"\r
-" float .emit OP_PUSH_FLOAT;\n"\r
-"intconstant\n"\r
-" integer .emit OP_PUSH_INT;\n"\r
-"boolconstant\n"\r
-" boolean .emit OP_PUSH_BOOL;\n"\r
-"optional_space\n"\r
-" .loop single_space;\n"\r
-"space\n"\r
-" single_space .and .loop single_space;\n"\r
-"single_space\n"\r
-" white_char .or c_style_comment_block .or cpp_style_comment_block;\n"\r
-"white_char\n"\r
-" ' ' .or '\\t' .or new_line .or '\\v' .or '\\f';\n"\r
-"new_line\n"\r
-" cr_lf .or lf_cr .or '\\n' .or '\\r';\n"\r
-"cr_lf\n"\r
-" '\\r' .and '\\n';\n"\r
-"lf_cr\n"\r
-" '\\n' .and '\\r';\n"\r
-"c_style_comment_block\n"\r
-" '/' .and '*' .and c_style_comment_rest;\n"\r
-"c_style_comment_rest\n"\r
-" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"\r
-"c_style_comment_rest_1\n"\r
-" c_style_comment_end .or c_style_comment_rest_2;\n"\r
-"c_style_comment_rest_2\n"\r
-" '*' .and c_style_comment_rest;\n"\r
-"c_style_comment_char_no_star\n"\r
-" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"\r
-"c_style_comment_end\n"\r
-" '*' .and '/';\n"\r
-"cpp_style_comment_block\n"\r
-" '/' .and '/' .and cpp_style_comment_block_1;\n"\r
-"cpp_style_comment_block_1\n"\r
-" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"\r
-"cpp_style_comment_block_2\n"\r
-" .loop cpp_style_comment_char .and new_line;\n"\r
-"cpp_style_comment_block_3\n"\r
-" .loop cpp_style_comment_char;\n"\r
-"cpp_style_comment_char\n"\r
-" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"\r
-"ampersandampersand\n"\r
-" optional_space .and '&' .and '&' .and optional_space;\n"\r
-"barbar\n"\r
-" optional_space .and '|' .and '|' .and optional_space;\n"\r
-"bang\n"\r
-" optional_space .and '!' .and optional_space;\n"\r
-"bangequals\n"\r
-" optional_space .and '!' .and '=' .and optional_space;\n"\r
-"caretcaret\n"\r
-" optional_space .and '^' .and '^' .and optional_space;\n"\r
-"colon\n"\r
-" optional_space .and ':' .and optional_space;\n"\r
-"comma\n"\r
-" optional_space .and ',' .and optional_space;\n"\r
-"dot\n"\r
-" optional_space .and '.' .and optional_space;\n"\r
-"equals\n"\r
-" optional_space .and '=' .and optional_space;\n"\r
-"equalsequals\n"\r
-" optional_space .and '=' .and '=' .and optional_space;\n"\r
-"greater\n"\r
-" optional_space .and '>' .and optional_space;\n"\r
-"greaterequals\n"\r
-" optional_space .and '>' .and '=' .and optional_space;\n"\r
-"lbrace\n"\r
-" optional_space .and '{' .and optional_space;\n"\r
-"lbracket\n"\r
-" optional_space .and '[' .and optional_space;\n"\r
-"less\n"\r
-" optional_space .and '<' .and optional_space;\n"\r
-"lessequals\n"\r
-" optional_space .and '<' .and '=' .and optional_space;\n"\r
-"lparen\n"\r
-" optional_space .and '(' .and optional_space;\n"\r
-"minus\n"\r
-" optional_space .and '-' .and optional_space;\n"\r
-"minusequals\n"\r
-" optional_space .and '-' .and '=' .and optional_space;\n"\r
-"minusminus\n"\r
-" optional_space .and '-' .and '-' .and optional_space;\n"\r
-"plus\n"\r
-" optional_space .and '+' .and optional_space;\n"\r
-"plusequals\n"\r
-" optional_space .and '+' .and '=' .and optional_space;\n"\r
-"plusplus\n"\r
-" optional_space .and '+' .and '+' .and optional_space;\n"\r
-"question\n"\r
-" optional_space .and '?' .and optional_space;\n"\r
-"rbrace\n"\r
-" optional_space .and '}' .and optional_space;\n"\r
-"rbracket\n"\r
-" optional_space .and ']' .and optional_space;\n"\r
-"rparen\n"\r
-" optional_space .and ')' .and optional_space;\n"\r
-"semicolon\n"\r
-" optional_space .and ';' .and optional_space;\n"\r
-"slash\n"\r
-" optional_space .and '/' .and optional_space;\n"\r
-"slashequals\n"\r
-" optional_space .and '/' .and '=' .and optional_space;\n"\r
-"star\n"\r
-" optional_space .and '*' .and optional_space;\n"\r
-"starequals\n"\r
-" optional_space .and '*' .and '=' .and optional_space;\n"\r
-".string string_lexer;\n"\r
-"string_lexer\n"\r
-" lex_first_identifier_character .and .loop lex_next_identifier_character;\n"\r
-"lex_first_identifier_character\n"\r
-" 'a'-'z' .or 'A'-'Z' .or '_';\n"\r
-"lex_next_identifier_character\n"\r
-" 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\n"\r
-"err_token\n"\r
-" '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or\n"\r
-" '-' .or '+' .or '=' .or '|' .or '\\\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '\"' .or\n"\r
-" '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n"\r
-"err_identifier\n"\r
-" id_character_first .and .loop id_character_next;\n"\r
+".syntax translation_unit;\n"
+".emtcode REVISION 2\n"
+".emtcode EXTERNAL_NULL 0\n"
+".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n"
+".emtcode EXTERNAL_DECLARATION 2\n"
+".emtcode DECLARATION_FUNCTION_PROTOTYPE 1\n"
+".emtcode DECLARATION_INIT_DECLARATOR_LIST 2\n"
+".emtcode FUNCTION_ORDINARY 0\n"
+".emtcode FUNCTION_CONSTRUCTOR 1\n"
+".emtcode FUNCTION_OPERATOR 2\n"
+".emtcode OPERATOR_ASSIGN 1\n"
+".emtcode OPERATOR_ADDASSIGN 2\n"
+".emtcode OPERATOR_SUBASSIGN 3\n"
+".emtcode OPERATOR_MULASSIGN 4\n"
+".emtcode OPERATOR_DIVASSIGN 5\n"
+".emtcode OPERATOR_LOGICALXOR 12\n"
+".emtcode OPERATOR_EQUAL 16\n"
+".emtcode OPERATOR_NOTEQUAL 17\n"
+".emtcode OPERATOR_LESS 18\n"
+".emtcode OPERATOR_GREATER 19\n"
+".emtcode OPERATOR_LESSEQUAL 20\n"
+".emtcode OPERATOR_GREATEREQUAL 21\n"
+".emtcode OPERATOR_MULTIPLY 24\n"
+".emtcode OPERATOR_DIVIDE 25\n"
+".emtcode OPERATOR_INCREMENT 27\n"
+".emtcode OPERATOR_DECREMENT 28\n"
+".emtcode OPERATOR_PLUS 29\n"
+".emtcode OPERATOR_MINUS 30\n"
+".emtcode OPERATOR_NOT 32\n"
+".emtcode DECLARATOR_NONE 0\n"
+".emtcode DECLARATOR_NEXT 1\n"
+".emtcode VARIABLE_NONE 0\n"
+".emtcode VARIABLE_IDENTIFIER 1\n"
+".emtcode VARIABLE_INITIALIZER 2\n"
+".emtcode VARIABLE_ARRAY_EXPLICIT 3\n"
+".emtcode VARIABLE_ARRAY_UNKNOWN 4\n"
+".emtcode TYPE_QUALIFIER_NONE 0\n"
+".emtcode TYPE_QUALIFIER_CONST 1\n"
+".emtcode TYPE_QUALIFIER_ATTRIBUTE 2\n"
+".emtcode TYPE_QUALIFIER_VARYING 3\n"
+".emtcode TYPE_QUALIFIER_UNIFORM 4\n"
+".emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5\n"
+".emtcode TYPE_QUALIFIER_FIXEDINPUT 6\n"
+".emtcode TYPE_SPECIFIER_VOID 0\n"
+".emtcode TYPE_SPECIFIER_BOOL 1\n"
+".emtcode TYPE_SPECIFIER_BVEC2 2\n"
+".emtcode TYPE_SPECIFIER_BVEC3 3\n"
+".emtcode TYPE_SPECIFIER_BVEC4 4\n"
+".emtcode TYPE_SPECIFIER_INT 5\n"
+".emtcode TYPE_SPECIFIER_IVEC2 6\n"
+".emtcode TYPE_SPECIFIER_IVEC3 7\n"
+".emtcode TYPE_SPECIFIER_IVEC4 8\n"
+".emtcode TYPE_SPECIFIER_FLOAT 9\n"
+".emtcode TYPE_SPECIFIER_VEC2 10\n"
+".emtcode TYPE_SPECIFIER_VEC3 11\n"
+".emtcode TYPE_SPECIFIER_VEC4 12\n"
+".emtcode TYPE_SPECIFIER_MAT2 13\n"
+".emtcode TYPE_SPECIFIER_MAT3 14\n"
+".emtcode TYPE_SPECIFIER_MAT4 15\n"
+".emtcode TYPE_SPECIFIER_SAMPLER1D 16\n"
+".emtcode TYPE_SPECIFIER_SAMPLER2D 17\n"
+".emtcode TYPE_SPECIFIER_SAMPLER3D 18\n"
+".emtcode TYPE_SPECIFIER_SAMPLERCUBE 19\n"
+".emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20\n"
+".emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21\n"
+".emtcode TYPE_SPECIFIER_STRUCT 22\n"
+".emtcode TYPE_SPECIFIER_TYPENAME 23\n"
+".emtcode FIELD_NONE 0\n"
+".emtcode FIELD_NEXT 1\n"
+".emtcode FIELD_ARRAY 2\n"
+".emtcode OP_END 0\n"
+".emtcode OP_BLOCK_BEGIN_NO_NEW_SCOPE 1\n"
+".emtcode OP_BLOCK_BEGIN_NEW_SCOPE 2\n"
+".emtcode OP_DECLARE 3\n"
+".emtcode OP_ASM 4\n"
+".emtcode OP_BREAK 5\n"
+".emtcode OP_CONTINUE 6\n"
+".emtcode OP_DISCARD 7\n"
+".emtcode OP_RETURN 8\n"
+".emtcode OP_EXPRESSION 9\n"
+".emtcode OP_IF 10\n"
+".emtcode OP_WHILE 11\n"
+".emtcode OP_DO 12\n"
+".emtcode OP_FOR 13\n"
+".emtcode OP_PUSH_VOID 14\n"
+".emtcode OP_PUSH_BOOL 15\n"
+".emtcode OP_PUSH_INT 16\n"
+".emtcode OP_PUSH_FLOAT 17\n"
+".emtcode OP_PUSH_IDENTIFIER 18\n"
+".emtcode OP_SEQUENCE 19\n"
+".emtcode OP_ASSIGN 20\n"
+".emtcode OP_ADDASSIGN 21\n"
+".emtcode OP_SUBASSIGN 22\n"
+".emtcode OP_MULASSIGN 23\n"
+".emtcode OP_DIVASSIGN 24\n"
+".emtcode OP_SELECT 31\n"
+".emtcode OP_LOGICALOR 32\n"
+".emtcode OP_LOGICALXOR 33\n"
+".emtcode OP_LOGICALAND 34\n"
+".emtcode OP_EQUAL 38\n"
+".emtcode OP_NOTEQUAL 39\n"
+".emtcode OP_LESS 40\n"
+".emtcode OP_GREATER 41\n"
+".emtcode OP_LESSEQUAL 42\n"
+".emtcode OP_GREATEREQUAL 43\n"
+".emtcode OP_ADD 46\n"
+".emtcode OP_SUBTRACT 47\n"
+".emtcode OP_MULTIPLY 48\n"
+".emtcode OP_DIVIDE 49\n"
+".emtcode OP_PREINCREMENT 51\n"
+".emtcode OP_PREDECREMENT 52\n"
+".emtcode OP_PLUS 53\n"
+".emtcode OP_MINUS 54\n"
+".emtcode OP_NOT 56\n"
+".emtcode OP_SUBSCRIPT 57\n"
+".emtcode OP_CALL 58\n"
+".emtcode OP_FIELD 59\n"
+".emtcode OP_POSTINCREMENT 60\n"
+".emtcode OP_POSTDECREMENT 61\n"
+".emtcode PARAM_QUALIFIER_IN 0\n"
+".emtcode PARAM_QUALIFIER_OUT 1\n"
+".emtcode PARAM_QUALIFIER_INOUT 2\n"
+".emtcode PARAMETER_NONE 0\n"
+".emtcode PARAMETER_NEXT 1\n"
+".emtcode PARAMETER_ARRAY_NOT_PRESENT 0\n"
+".emtcode PARAMETER_ARRAY_PRESENT 1\n"
+".errtext INVALID_EXTERNAL_DECLARATION \"error 2001: invalid external declaration\"\n"
+".errtext INVALID_OPERATOR_OVERRIDE \"error 2002: invalid operator override\"\n"
+".errtext LBRACE_EXPECTED \"error 2003: '{' expected but '$err_token$' found\"\n"
+".errtext LPAREN_EXPECTED \"error 2004: '(' expected but '$err_token$' found\"\n"
+".errtext RPAREN_EXPECTED \"error 2005: ')' expected but '$err_token$' found\"\n"
+".regbyte parsing_builtin 0\n"
+".regbyte shader_type 0\n"
+"variable_identifier\n"
+" identifier .emit OP_PUSH_IDENTIFIER;\n"
+"primary_expression\n"
+" floatconstant .or boolconstant .or intconstant .or variable_identifier .or primary_expression_1;\n"
+"primary_expression_1\n"
+" lparen .and expression .and rparen;\n"
+"postfix_expression\n"
+" postfix_expression_1 .and .loop postfix_expression_2;\n"
+"postfix_expression_1\n"
+" function_call .or primary_expression;\n"
+"postfix_expression_2\n"
+" postfix_expression_3 .or postfix_expression_4 .or\n"
+" plusplus .emit OP_POSTINCREMENT .or\n"
+" minusminus .emit OP_POSTDECREMENT;\n"
+"postfix_expression_3\n"
+" lbracket .and integer_expression .and rbracket .emit OP_SUBSCRIPT;\n"
+"postfix_expression_4\n"
+" dot .and field_selection .emit OP_FIELD;\n"
+"integer_expression\n"
+" expression;\n"
+"function_call\n"
+" function_call_generic .emit OP_CALL .and .true .emit OP_END;\n"
+"function_call_generic\n"
+" function_call_generic_1 .or function_call_generic_2;\n"
+"function_call_generic_1\n"
+" function_call_header_with_parameters .and rparen .error RPAREN_EXPECTED;\n"
+"function_call_generic_2\n"
+" function_call_header_no_parameters .and rparen .error RPAREN_EXPECTED;\n"
+"function_call_header_no_parameters\n"
+" function_call_header .and function_call_header_no_parameters_1;\n"
+"function_call_header_no_parameters_1\n"
+" \"void\" .or .true;\n"
+"function_call_header_with_parameters\n"
+" function_call_header .and assignment_expression .and .true .emit OP_END .and\n"
+" .loop function_call_header_with_parameters_1;\n"
+"function_call_header_with_parameters_1\n"
+" comma .and assignment_expression .and .true .emit OP_END;\n"
+"function_call_header\n"
+" function_identifier .and lparen;\n"
+"function_identifier\n"
+" identifier;\n"
+"unary_expression\n"
+" postfix_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or\n"
+" unary_expression_4 .or unary_expression_5;\n"
+"unary_expression_1\n"
+" plusplus .and unary_expression .and .true .emit OP_PREINCREMENT;\n"
+"unary_expression_2\n"
+" minusminus .and unary_expression .and .true .emit OP_PREDECREMENT;\n"
+"unary_expression_3\n"
+" plus .and unary_expression .and .true .emit OP_PLUS;\n"
+"unary_expression_4\n"
+" minus .and unary_expression .and .true .emit OP_MINUS;\n"
+"unary_expression_5\n"
+" bang .and unary_expression .and .true .emit OP_NOT;\n"
+"multiplicative_expression\n"
+" unary_expression .and .loop multiplicative_expression_1;\n"
+"multiplicative_expression_1\n"
+" multiplicative_expression_2 .or multiplicative_expression_3;\n"
+"multiplicative_expression_2\n"
+" star .and unary_expression .and .true .emit OP_MULTIPLY;\n"
+"multiplicative_expression_3\n"
+" slash .and unary_expression .and .true .emit OP_DIVIDE;\n"
+"additive_expression\n"
+" multiplicative_expression .and .loop additive_expression_1;\n"
+"additive_expression_1\n"
+" additive_expression_2 .or additive_expression_3;\n"
+"additive_expression_2\n"
+" plus .and multiplicative_expression .and .true .emit OP_ADD;\n"
+"additive_expression_3\n"
+" minus .and multiplicative_expression .and .true .emit OP_SUBTRACT;\n"
+"shift_expression\n"
+" additive_expression;\n"
+"relational_expression\n"
+" shift_expression .and .loop relational_expression_1;\n"
+"relational_expression_1\n"
+" relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or\n"
+" relational_expression_5;\n"
+"relational_expression_2\n"
+" lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;\n"
+"relational_expression_3\n"
+" greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;\n"
+"relational_expression_4\n"
+" less .and shift_expression .and .true .emit OP_LESS;\n"
+"relational_expression_5\n"
+" greater .and shift_expression .and .true .emit OP_GREATER;\n"
+"equality_expression\n"
+" relational_expression .and .loop equality_expression_1;\n"
+"equality_expression_1\n"
+" equality_expression_2 .or equality_expression_3;\n"
+"equality_expression_2\n"
+" equalsequals .and relational_expression .and .true .emit OP_EQUAL;\n"
+"equality_expression_3\n"
+" bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;\n"
+"and_expression\n"
+" equality_expression;\n"
+"exclusive_or_expression\n"
+" and_expression;\n"
+"inclusive_or_expression\n"
+" exclusive_or_expression;\n"
+"logical_and_expression\n"
+" inclusive_or_expression .and .loop logical_and_expression_1;\n"
+"logical_and_expression_1\n"
+" ampersandampersand .and inclusive_or_expression .and .true .emit OP_LOGICALAND;\n"
+"logical_xor_expression\n"
+" logical_and_expression .and .loop logical_xor_expression_1;\n"
+"logical_xor_expression_1\n"
+" caretcaret .and logical_and_expression .and .true .emit OP_LOGICALXOR;\n"
+"logical_or_expression\n"
+" logical_xor_expression .and .loop logical_or_expression_1;\n"
+"logical_or_expression_1\n"
+" barbar .and logical_xor_expression .and .true .emit OP_LOGICALOR;\n"
+"conditional_expression\n"
+" logical_or_expression .and .loop conditional_expression_1;\n"
+"conditional_expression_1\n"
+" question .and expression .and colon .and conditional_expression .and .true .emit OP_SELECT;\n"
+"assignment_expression\n"
+" assignment_expression_1 .or assignment_expression_2 .or assignment_expression_3 .or\n"
+" assignment_expression_4 .or assignment_expression_5 .or conditional_expression;\n"
+"assignment_expression_1\n"
+" unary_expression .and equals .and assignment_expression .and .true .emit OP_ASSIGN;\n"
+"assignment_expression_2\n"
+" unary_expression .and starequals .and assignment_expression .and .true .emit OP_MULASSIGN;\n"
+"assignment_expression_3\n"
+" unary_expression .and slashequals .and assignment_expression .and .true .emit OP_DIVASSIGN;\n"
+"assignment_expression_4\n"
+" unary_expression .and plusequals .and assignment_expression .and .true .emit OP_ADDASSIGN;\n"
+"assignment_expression_5\n"
+" unary_expression .and minusequals .and assignment_expression .and .true .emit OP_SUBASSIGN;\n"
+"expression\n"
+" assignment_expression .and .loop expression_1;\n"
+"expression_1\n"
+" comma .and assignment_expression .and .true .emit OP_SEQUENCE;\n"
+"constant_expression\n"
+" conditional_expression .and .true .emit OP_END;\n"
+"declaration\n"
+" declaration_1 .or declaration_2;\n"
+"declaration_1\n"
+" function_prototype .emit DECLARATION_FUNCTION_PROTOTYPE .and semicolon;\n"
+"declaration_2\n"
+" init_declarator_list .emit DECLARATION_INIT_DECLARATOR_LIST .and semicolon;\n"
+"function_prototype\n"
+" function_declarator .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;\n"
+"function_declarator\n"
+" function_header_with_parameters .or function_header;\n"
+"function_header_with_parameters\n"
+" function_header .and parameter_declaration .and .loop function_header_with_parameters_1;\n"
+"function_header_with_parameters_1\n"
+" comma .and parameter_declaration;\n"
+"function_header\n"
+" function_header_nospace .or function_header_space;\n"
+"function_header_space\n"
+" fully_specified_type_space .and space .and function_decl_identifier .and lparen;\n"
+"function_header_nospace\n"
+" fully_specified_type_nospace .and function_decl_identifier .and lparen;\n"
+"function_decl_identifier\n"
+" .if (parsing_builtin != 0) __operator .emit FUNCTION_OPERATOR .or\n"
+" .if (parsing_builtin != 0) \"__constructor\" .emit FUNCTION_CONSTRUCTOR .or\n"
+" identifier .emit FUNCTION_ORDINARY;\n"
+"__operator\n"
+" \"__operator\" .and overriden_operator .error INVALID_OPERATOR_OVERRIDE;\n"
+"overriden_operator\n"
+" plusplus .emit OPERATOR_INCREMENT .or\n"
+" plusequals .emit OPERATOR_ADDASSIGN .or\n"
+" plus .emit OPERATOR_PLUS .or\n"
+" minusminus .emit OPERATOR_DECREMENT .or\n"
+" minusequals .emit OPERATOR_SUBASSIGN .or\n"
+" minus .emit OPERATOR_MINUS .or\n"
+" bangequals .emit OPERATOR_NOTEQUAL .or\n"
+" bang .emit OPERATOR_NOT .or\n"
+" starequals .emit OPERATOR_MULASSIGN .or\n"
+" star .emit OPERATOR_MULTIPLY .or\n"
+" slashequals .emit OPERATOR_DIVASSIGN .or\n"
+" slash .emit OPERATOR_DIVIDE .or\n"
+" lessequals .emit OPERATOR_LESSEQUAL .or\n"
+" \n"
+" \n"
+" less .emit OPERATOR_LESS .or\n"
+" greaterequals .emit OPERATOR_GREATEREQUAL .or\n"
+" \n"
+" \n"
+" greater .emit OPERATOR_GREATER .or\n"
+" equalsequals .emit OPERATOR_EQUAL .or\n"
+" equals .emit OPERATOR_ASSIGN .or\n"
+" \n"
+" \n"
+" \n"
+" \n"
+" \n"
+" \n"
+" \n"
+" \n"
+" caretcaret .emit OPERATOR_LOGICALXOR ;\n"
+"parameter_declarator\n"
+" parameter_declarator_nospace .or parameter_declarator_space;\n"
+"parameter_declarator_nospace\n"
+" type_specifier_nospace .and identifier .and parameter_declarator_1;\n"
+"parameter_declarator_space\n"
+" type_specifier_space .and space .and identifier .and parameter_declarator_1;\n"
+"parameter_declarator_1\n"
+" parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or\n"
+" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n"
+"parameter_declarator_2\n"
+" lbracket .and constant_expression .and rbracket;\n"
+"parameter_declaration\n"
+" parameter_declaration_1 .emit PARAMETER_NEXT;\n"
+"parameter_declaration_1\n"
+" parameter_declaration_2 .or parameter_declaration_3;\n"
+"parameter_declaration_2\n"
+" type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;\n"
+"parameter_declaration_3\n"
+" parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;\n"
+"parameter_declaration_4\n"
+" parameter_declarator .or parameter_type_specifier;\n"
+"parameter_qualifier\n"
+" parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;\n"
+"parameter_qualifier_1\n"
+" parameter_qualifier_2 .and space;\n"
+"parameter_qualifier_2\n"
+" \"in\" .emit PARAM_QUALIFIER_IN .or\n"
+" \"out\" .emit PARAM_QUALIFIER_OUT .or\n"
+" \"inout\" .emit PARAM_QUALIFIER_INOUT;\n"
+"parameter_type_specifier\n"
+" parameter_type_specifier_1 .and .true .emit '\\0' .and parameter_type_specifier_2;\n"
+"parameter_type_specifier_1\n"
+" type_specifier_nospace .or type_specifier_space;\n"
+"parameter_type_specifier_2\n"
+" parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or\n"
+" .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n"
+"parameter_type_specifier_3\n"
+" lbracket .and constant_expression .and rbracket;\n"
+"init_declarator_list\n"
+" single_declaration .and .loop init_declarator_list_1 .emit DECLARATOR_NEXT .and\n"
+" .true .emit DECLARATOR_NONE;\n"
+"init_declarator_list_1\n"
+" comma .and identifier .emit VARIABLE_IDENTIFIER .and init_declarator_list_2;\n"
+"init_declarator_list_2\n"
+" init_declarator_list_3 .or init_declarator_list_4 .or .true .emit VARIABLE_NONE;\n"
+"init_declarator_list_3\n"
+" equals .and initializer .emit VARIABLE_INITIALIZER;\n"
+"init_declarator_list_4\n"
+" lbracket .and init_declarator_list_5 .and rbracket;\n"
+"init_declarator_list_5\n"
+" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n"
+"single_declaration\n"
+" single_declaration_nospace .or single_declaration_space;\n"
+"single_declaration_space\n"
+" fully_specified_type_space .and single_declaration_space_1;\n"
+"single_declaration_nospace\n"
+" fully_specified_type_nospace .and single_declaration_nospace_1;\n"
+"single_declaration_space_1\n"
+" single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n"
+"single_declaration_nospace_1\n"
+" single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n"
+"single_declaration_space_2\n"
+" space .and identifier .and single_declaration_3;\n"
+"single_declaration_nospace_2\n"
+" identifier .and single_declaration_3;\n"
+"single_declaration_3\n"
+" single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;\n"
+"single_declaration_4\n"
+" equals .and initializer .emit VARIABLE_INITIALIZER;\n"
+"single_declaration_5\n"
+" lbracket .and single_declaration_6 .and rbracket;\n"
+"single_declaration_6\n"
+" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n"
+"fully_specified_type_space\n"
+" fully_specified_type_1 .and type_specifier_space;\n"
+"fully_specified_type_nospace\n"
+" fully_specified_type_1 .and type_specifier_nospace;\n"
+"fully_specified_type_1\n"
+" fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;\n"
+"fully_specified_type_2\n"
+" type_qualifier .and space;\n"
+"type_qualifier\n"
+" \"const\" .emit TYPE_QUALIFIER_CONST .or\n"
+" .if (shader_type == 2) \"attribute\" .emit TYPE_QUALIFIER_ATTRIBUTE .or\n"
+" \"varying\" .emit TYPE_QUALIFIER_VARYING .or\n"
+" \"uniform\" .emit TYPE_QUALIFIER_UNIFORM .or\n"
+"      .if (parsing_builtin != 0) \"__fixed_output\" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or\n"
+"      .if (parsing_builtin != 0) \"__fixed_input\" .emit TYPE_QUALIFIER_FIXEDINPUT;\n"
+"type_specifier_space\n"
+" \"void\" .emit TYPE_SPECIFIER_VOID .or\n"
+" \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n"
+" \"int\" .emit TYPE_SPECIFIER_INT .or\n"
+" \"bool\" .emit TYPE_SPECIFIER_BOOL .or\n"
+" \"vec2\" .emit TYPE_SPECIFIER_VEC2 .or\n"
+" \"vec3\" .emit TYPE_SPECIFIER_VEC3 .or\n"
+" \"vec4\" .emit TYPE_SPECIFIER_VEC4 .or\n"
+" \"bvec2\" .emit TYPE_SPECIFIER_BVEC2 .or\n"
+" \"bvec3\" .emit TYPE_SPECIFIER_BVEC3 .or\n"
+" \"bvec4\" .emit TYPE_SPECIFIER_BVEC4 .or\n"
+" \"ivec2\" .emit TYPE_SPECIFIER_IVEC2 .or\n"
+" \"ivec3\" .emit TYPE_SPECIFIER_IVEC3 .or\n"
+" \"ivec4\" .emit TYPE_SPECIFIER_IVEC4 .or\n"
+" \"mat2\" .emit TYPE_SPECIFIER_MAT2 .or\n"
+" \"mat3\" .emit TYPE_SPECIFIER_MAT3 .or\n"
+" \"mat4\" .emit TYPE_SPECIFIER_MAT4 .or\n"
+" \"sampler1D\" .emit TYPE_SPECIFIER_SAMPLER1D .or\n"
+" \"sampler2D\" .emit TYPE_SPECIFIER_SAMPLER2D .or\n"
+" \"sampler3D\" .emit TYPE_SPECIFIER_SAMPLER3D .or\n"
+" \"samplerCube\" .emit TYPE_SPECIFIER_SAMPLERCUBE .or\n"
+" \"sampler1DShadow\" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or\n"
+" \"sampler2DShadow\" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or\n"
+" type_name .emit TYPE_SPECIFIER_TYPENAME;\n"
+"type_specifier_nospace\n"
+" struct_specifier .emit TYPE_SPECIFIER_STRUCT;\n"
+"struct_specifier\n"
+" \"struct\" .and struct_specifier_1 .and optional_space .and lbrace .error LBRACE_EXPECTED .and\n"
+" struct_declaration_list .and rbrace .emit FIELD_NONE;\n"
+"struct_specifier_1\n"
+" struct_specifier_2 .or .true .emit '\\0';\n"
+"struct_specifier_2\n"
+" space .and identifier;\n"
+"struct_declaration_list\n"
+" struct_declaration .and .loop struct_declaration .emit FIELD_NEXT;\n"
+"struct_declaration\n"
+" struct_declaration_nospace .or struct_declaration_space;\n"
+"struct_declaration_space\n"
+" type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n"
+"struct_declaration_nospace\n"
+" type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n"
+"struct_declarator_list\n"
+" struct_declarator .and .loop struct_declarator_list_1 .emit FIELD_NEXT;\n"
+"struct_declarator_list_1\n"
+" comma .and struct_declarator;\n"
+"struct_declarator\n"
+" identifier .and struct_declarator_1;\n"
+"struct_declarator_1\n"
+" struct_declarator_2 .emit FIELD_ARRAY .or .true .emit FIELD_NONE;\n"
+"struct_declarator_2\n"
+" lbracket .and constant_expression .and rbracket;\n"
+"initializer\n"
+" assignment_expression .and .true .emit OP_END;\n"
+"declaration_statement\n"
+" declaration;\n"
+"statement\n"
+" compound_statement .or simple_statement;\n"
+"statement_space\n"
+" compound_statement .or statement_space_1;\n"
+"statement_space_1\n"
+" space .and simple_statement;\n"
+"simple_statement\n"
+" .if (parsing_builtin != 0) __asm_statement .emit OP_ASM .or\n"
+" selection_statement .or\n"
+" iteration_statement .or\n"
+" jump_statement .or\n"
+" expression_statement .emit OP_EXPRESSION .or\n"
+" declaration_statement .emit OP_DECLARE;\n"
+"compound_statement\n"
+" compound_statement_1 .emit OP_BLOCK_BEGIN_NEW_SCOPE .and .true .emit OP_END;\n"
+"compound_statement_1\n"
+" compound_statement_2 .or compound_statement_3;\n"
+"compound_statement_2\n"
+" lbrace .and rbrace;\n"
+"compound_statement_3\n"
+" lbrace .and statement_list .and rbrace;\n"
+"statement_no_new_scope\n"
+" compound_statement_no_new_scope .or simple_statement;\n"
+"compound_statement_no_new_scope\n"
+" compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n"
+"compound_statement_no_new_scope_1\n"
+" compound_statement_no_new_scope_2 .or compound_statement_no_new_scope_3;\n"
+"compound_statement_no_new_scope_2\n"
+" lbrace .and rbrace;\n"
+"compound_statement_no_new_scope_3\n"
+" lbrace .and statement_list .and rbrace;\n"
+"statement_list\n"
+" statement .and .loop statement;\n"
+"expression_statement\n"
+" expression_statement_1 .or expression_statement_2;\n"
+"expression_statement_1\n"
+" semicolon .emit OP_PUSH_VOID .emit OP_END;\n"
+"expression_statement_2\n"
+" expression .and semicolon .emit OP_END;\n"
+"selection_statement\n"
+" \"if\" .emit OP_IF .and lparen .error LPAREN_EXPECTED .and expression .and\n"
+" rparen .error RPAREN_EXPECTED .emit OP_END .and selection_rest_statement;\n"
+"selection_rest_statement\n"
+" statement .and selection_rest_statement_1;\n"
+"selection_rest_statement_1\n"
+" selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;\n"
+"selection_rest_statement_2\n"
+" \"else\" .and optional_space .and statement;\n"
+"condition\n"
+" condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or\n"
+" condition_3 .emit OP_EXPRESSION;\n"
+"condition_1\n"
+" condition_1_nospace .or condition_1_space;\n"
+"condition_1_nospace\n"
+" fully_specified_type_nospace .and condition_2;\n"
+"condition_1_space\n"
+" fully_specified_type_space .and space .and condition_2;\n"
+"condition_2\n"
+" identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and\n"
+" initializer .and .true .emit DECLARATOR_NONE;\n"
+"condition_3\n"
+" expression .and .true .emit OP_END;\n"
+"iteration_statement\n"
+" iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;\n"
+"iteration_statement_1\n"
+" \"while\" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and\n"
+" rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"
+"iteration_statement_2\n"
+" \"do\" .emit OP_DO .and statement_space .and \"while\" .and lparen .error LPAREN_EXPECTED .and\n"
+" expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n"
+"iteration_statement_3\n"
+" \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n"
+" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"
+"for_init_statement\n"
+" expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n"
+"conditionopt\n"
+" condition .or\n"
+" .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\\0' .emit OP_END;\n"
+"for_rest_statement\n"
+" conditionopt .and semicolon .and for_rest_statement_1;\n"
+"for_rest_statement_1\n"
+" for_rest_statement_2 .or .true .emit OP_PUSH_VOID .emit OP_END;\n"
+"for_rest_statement_2\n"
+" expression .and .true .emit OP_END;\n"
+"jump_statement\n"
+" jump_statement_1 .or jump_statement_2 .or jump_statement_3 .or jump_statement_4 .or\n"
+" .if (shader_type == 1) jump_statement_5;\n"
+"jump_statement_1\n"
+" \"continue\" .and semicolon .emit OP_CONTINUE;\n"
+"jump_statement_2\n"
+" \"break\" .and semicolon .emit OP_BREAK;\n"
+"jump_statement_3\n"
+" \"return\" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;\n"
+"jump_statement_4\n"
+" \"return\" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;\n"
+"jump_statement_5\n"
+" \"discard\" .and semicolon .emit OP_DISCARD;\n"
+"__asm_statement\n"
+" \"__asm\" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;\n"
+"asm_arguments\n"
+" variable_identifier .and .true .emit OP_END .and .loop asm_arguments_1;\n"
+"asm_arguments_1\n"
+" comma .and variable_identifier .and .true .emit OP_END;\n"
+"translation_unit\n"
+" optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and\n"
+" .loop external_declaration .and optional_space .and\n"
+" '\\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;\n"
+"external_declaration\n"
+" function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or\n"
+" declaration .emit EXTERNAL_DECLARATION;\n"
+"function_definition\n"
+" function_prototype .and compound_statement_no_new_scope;\n"
+"digit_oct\n"
+" '0'-'7';\n"
+"digit_dec\n"
+" '0'-'9';\n"
+"digit_hex\n"
+" '0'-'9' .or 'A'-'F' .or 'a'-'f';\n"
+"id_character_first\n"
+" 'a'-'z' .or 'A'-'Z' .or '_';\n"
+"id_character_next\n"
+" id_character_first .or digit_dec;\n"
+"identifier\n"
+" id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\\0';\n"
+"float\n"
+" float_1 .or float_2;\n"
+"float_1\n"
+" float_fractional_constant .and float_optional_exponent_part;\n"
+"float_2\n"
+" float_digit_sequence .and .true .emit '\\0' .and float_exponent_part;\n"
+"float_fractional_constant\n"
+" float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;\n"
+"float_fractional_constant_1\n"
+" float_digit_sequence .and '.' .and float_digit_sequence;\n"
+"float_fractional_constant_2\n"
+" float_digit_sequence .and '.' .and .true .emit '\\0';\n"
+"float_fractional_constant_3\n"
+" '.' .emit '\\0' .and float_digit_sequence;\n"
+"float_optional_exponent_part\n"
+" float_exponent_part .or .true .emit '\\0';\n"
+"float_digit_sequence\n"
+" digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
+"float_exponent_part\n"
+" float_exponent_part_1 .or float_exponent_part_2;\n"
+"float_exponent_part_1\n"
+" 'e' .and float_optional_sign .and float_digit_sequence;\n"
+"float_exponent_part_2\n"
+" 'E' .and float_optional_sign .and float_digit_sequence;\n"
+"float_optional_sign\n"
+" float_sign .or .true;\n"
+"float_sign\n"
+" '+' .or '-' .emit '-';\n"
+"integer\n"
+" integer_hex .or integer_oct .or integer_dec;\n"
+"integer_hex\n"
+" '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and\n"
+" .true .emit '\\0';\n"
+"integer_hex_1\n"
+" 'x' .or 'X';\n"
+"integer_oct\n"
+" '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\\0';\n"
+"integer_dec\n"
+" digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
+"boolean\n"
+" \"true\" .emit 2 .emit '1' .emit '\\0' .or\n"
+" \"false\" .emit 2 .emit '0' .emit '\\0';\n"
+"type_name\n"
+" identifier;\n"
+"field_selection\n"
+" identifier;\n"
+"floatconstant\n"
+" float .emit OP_PUSH_FLOAT;\n"
+"intconstant\n"
+" integer .emit OP_PUSH_INT;\n"
+"boolconstant\n"
+" boolean .emit OP_PUSH_BOOL;\n"
+"optional_space\n"
+" .loop single_space;\n"
+"space\n"
+" single_space .and .loop single_space;\n"
+"single_space\n"
+" white_char .or c_style_comment_block .or cpp_style_comment_block;\n"
+"white_char\n"
+" ' ' .or '\\t' .or new_line .or '\\v' .or '\\f';\n"
+"new_line\n"
+" cr_lf .or lf_cr .or '\\n' .or '\\r';\n"
+"cr_lf\n"
+" '\\r' .and '\\n';\n"
+"lf_cr\n"
+" '\\n' .and '\\r';\n"
+"c_style_comment_block\n"
+" '/' .and '*' .and c_style_comment_rest;\n"
+"c_style_comment_rest\n"
+" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"
+"c_style_comment_rest_1\n"
+" c_style_comment_end .or c_style_comment_rest_2;\n"
+"c_style_comment_rest_2\n"
+" '*' .and c_style_comment_rest;\n"
+"c_style_comment_char_no_star\n"
+" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
+"c_style_comment_end\n"
+" '*' .and '/';\n"
+"cpp_style_comment_block\n"
+" '/' .and '/' .and cpp_style_comment_block_1;\n"
+"cpp_style_comment_block_1\n"
+" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"
+"cpp_style_comment_block_2\n"
+" .loop cpp_style_comment_char .and new_line;\n"
+"cpp_style_comment_block_3\n"
+" .loop cpp_style_comment_char;\n"
+"cpp_style_comment_char\n"
+" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"
+"ampersandampersand\n"
+" optional_space .and '&' .and '&' .and optional_space;\n"
+"barbar\n"
+" optional_space .and '|' .and '|' .and optional_space;\n"
+"bang\n"
+" optional_space .and '!' .and optional_space;\n"
+"bangequals\n"
+" optional_space .and '!' .and '=' .and optional_space;\n"
+"caretcaret\n"
+" optional_space .and '^' .and '^' .and optional_space;\n"
+"colon\n"
+" optional_space .and ':' .and optional_space;\n"
+"comma\n"
+" optional_space .and ',' .and optional_space;\n"
+"dot\n"
+" optional_space .and '.' .and optional_space;\n"
+"equals\n"
+" optional_space .and '=' .and optional_space;\n"
+"equalsequals\n"
+" optional_space .and '=' .and '=' .and optional_space;\n"
+"greater\n"
+" optional_space .and '>' .and optional_space;\n"
+"greaterequals\n"
+" optional_space .and '>' .and '=' .and optional_space;\n"
+"lbrace\n"
+" optional_space .and '{' .and optional_space;\n"
+"lbracket\n"
+" optional_space .and '[' .and optional_space;\n"
+"less\n"
+" optional_space .and '<' .and optional_space;\n"
+"lessequals\n"
+" optional_space .and '<' .and '=' .and optional_space;\n"
+"lparen\n"
+" optional_space .and '(' .and optional_space;\n"
+"minus\n"
+" optional_space .and '-' .and optional_space;\n"
+"minusequals\n"
+" optional_space .and '-' .and '=' .and optional_space;\n"
+"minusminus\n"
+" optional_space .and '-' .and '-' .and optional_space;\n"
+"plus\n"
+" optional_space .and '+' .and optional_space;\n"
+"plusequals\n"
+" optional_space .and '+' .and '=' .and optional_space;\n"
+"plusplus\n"
+" optional_space .and '+' .and '+' .and optional_space;\n"
+"question\n"
+" optional_space .and '?' .and optional_space;\n"
+"rbrace\n"
+" optional_space .and '}' .and optional_space;\n"
+"rbracket\n"
+" optional_space .and ']' .and optional_space;\n"
+"rparen\n"
+" optional_space .and ')' .and optional_space;\n"
+"semicolon\n"
+" optional_space .and ';' .and optional_space;\n"
+"slash\n"
+" optional_space .and '/' .and optional_space;\n"
+"slashequals\n"
+" optional_space .and '/' .and '=' .and optional_space;\n"
+"star\n"
+" optional_space .and '*' .and optional_space;\n"
+"starequals\n"
+" optional_space .and '*' .and '=' .and optional_space;\n"
+".string string_lexer;\n"
+"string_lexer\n"
+" lex_first_identifier_character .and .loop lex_next_identifier_character;\n"
+"lex_first_identifier_character\n"
+" 'a'-'z' .or 'A'-'Z' .or '_';\n"
+"lex_next_identifier_character\n"
+" 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\n"
+"err_token\n"
+" '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or\n"
+" '-' .or '+' .or '=' .or '|' .or '\\\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '\"' .or\n"
+" '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n"
+"err_identifier\n"
+" id_character_first .and .loop id_character_next;\n"
 ""
\ No newline at end of file
index 70e84ca52c1ba9c422d319df76e6115070628e90..1fed790bdf78fb6664fc0ea8f13b759e1c310894 100644 (file)
-/*\r
- * Mesa 3-D graphics library\r
- * Version:  6.3\r
- *\r
- * Copyright (C) 2005  Brian Paul   All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included\r
- * in all copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-/**\r
- * \file slang_compile.c\r
- * slang front-end compiler\r
- * \author Michal Krol\r
- */\r
-\r
-#include "imports.h" \r
-#include "slang_compile.h"\r
-#include "grammar_mesa.h"\r
-#include "slang_preprocess.h"\r
-\r
-/*\r
-       This is a straightforward implementation of the slang front-end compiler.\r
-       Lots of error-checking functionality is missing but every well-formed shader source should\r
-       compile successfully and execute as expected. However, some semantically ill-formed shaders\r
-       may be accepted resulting in undefined behaviour.\r
-*/\r
-\r
-void slang_alloc_free (void *ptr)\r
-{\r
-       _mesa_free (ptr);\r
-}\r
-\r
-void *slang_alloc_malloc (unsigned int size)\r
-{\r
-       return _mesa_malloc (size);\r
-}\r
-\r
-void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)\r
-{\r
-       return _mesa_realloc (ptr, old_size, size);\r
-}\r
-\r
-int slang_string_compare (const char *str1, const char *str2)\r
-{\r
-       return _mesa_strcmp (str1, str2);\r
-}\r
-\r
-char *slang_string_copy (char *dst, const char *src)\r
-{\r
-       return _mesa_strcpy (dst, src);\r
-}\r
-\r
-char *slang_string_concat (char *dst, const char *src)\r
-{\r
-       return _mesa_strcpy (dst + _mesa_strlen (dst), src);\r
-}\r
-\r
-char *slang_string_duplicate (const char *src)\r
-{\r
-       return _mesa_strdup (src);\r
-}\r
-\r
-unsigned int slang_string_length (const char *str)\r
-{\r
-       return _mesa_strlen (str);\r
-}\r
-\r
-static void slang_variable_construct (slang_variable *);\r
-static int slang_variable_copy (slang_variable *, const slang_variable *);\r
-static void slang_struct_construct (slang_struct *);\r
-static void slang_struct_destruct (slang_struct *);\r
-static int slang_struct_copy (slang_struct *, const slang_struct *);\r
-static int slang_struct_equal (const slang_struct *, const slang_struct *);\r
-static void slang_variable_destruct (slang_variable *);\r
-\r
-/* slang_type_specifier */\r
-\r
-static void slang_type_specifier_construct (slang_type_specifier *spec)\r
-{\r
-       spec->type = slang_spec_void;\r
-       spec->_struct = NULL;\r
-       spec->_array = NULL;\r
-}\r
-\r
-static void slang_type_specifier_destruct (slang_type_specifier *spec)\r
-{\r
-       if (spec->_struct != NULL)\r
-       {\r
-               slang_struct_destruct (spec->_struct);\r
-               slang_alloc_free (spec->_struct);\r
-       }\r
-       if (spec->_array != NULL)\r
-       {\r
-               slang_type_specifier_destruct (spec->_array);\r
-               slang_alloc_free (spec->_array);\r
-       }\r
-}\r
-\r
-static int slang_type_specifier_copy (slang_type_specifier *x, const slang_type_specifier *y)\r
-{\r
-       slang_type_specifier_destruct (x);\r
-       slang_type_specifier_construct (x);\r
-       x->type = y->type;\r
-       if (x->type == slang_spec_struct)\r
-       {\r
-               x->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));\r
-               slang_struct_construct (x->_struct);\r
-               return slang_struct_copy (x->_struct, y->_struct);\r
-       }\r
-       if (x->type == slang_spec_array)\r
-       {\r
-               x->_array = (slang_type_specifier *) slang_alloc_malloc (sizeof (slang_type_specifier));\r
-               slang_type_specifier_construct (x->_array);\r
-               return slang_type_specifier_copy (x->_array, y->_array);\r
-       }\r
-       return 1;\r
-}\r
-\r
-static int slang_type_specifier_equal (const slang_type_specifier *x, const slang_type_specifier *y)\r
-{\r
-       if (x->type != y->type)\r
-               return 0;\r
-       if (x->type == slang_spec_struct)\r
-               return slang_struct_equal (x->_struct, y->_struct);\r
-       if (x->type == slang_spec_array)\r
-               return slang_type_specifier_equal (x->_array, y->_array);\r
-       return 1;\r
-}\r
-\r
-/* slang_fully_specified_type */\r
-\r
-static void slang_fully_specified_type_construct (slang_fully_specified_type *type)\r
-{\r
-       type->qualifier = slang_qual_none;\r
-       slang_type_specifier_construct (&type->specifier);\r
-}\r
-\r
-static void slang_fully_specified_type_destruct (slang_fully_specified_type *type)\r
-{\r
-       slang_type_specifier_destruct (&type->specifier);\r
-}\r
-\r
-static int slang_fully_specified_type_copy (slang_fully_specified_type *x,\r
-       const slang_fully_specified_type *y)\r
-{\r
-       slang_fully_specified_type_construct (x);\r
-       slang_fully_specified_type_destruct (x);\r
-       x->qualifier = y->qualifier;\r
-       return slang_type_specifier_copy (&x->specifier, &y->specifier);\r
-}\r
-\r
-/* slang_variable_scope */\r
-\r
-static void slang_variable_scope_construct (slang_variable_scope *scope)\r
-{\r
-       scope->variables = NULL;\r
-       scope->num_variables = 0;\r
-       scope->outer_scope = NULL;\r
-}\r
-\r
-static void slang_variable_scope_destruct (slang_variable_scope *scope)\r
-{\r
-       unsigned int i;\r
-       for (i = 0; i < scope->num_variables; i++)\r
-               slang_variable_destruct (scope->variables + i);\r
-       slang_alloc_free (scope->variables);\r
-}\r
-\r
-static int slang_variable_scope_copy (slang_variable_scope *x, const slang_variable_scope *y)\r
-{\r
-       unsigned int i;\r
-       slang_variable_scope_destruct (x);\r
-       slang_variable_scope_construct (x);\r
-       x->variables = (slang_variable *) slang_alloc_malloc (y->num_variables * sizeof (\r
-               slang_variable));\r
-       if (x->variables == NULL)\r
-               return 0;\r
-       x->num_variables = y->num_variables;\r
-       for (i = 0; i < x->num_variables; i++)\r
-               slang_variable_construct (x->variables + i);\r
-       for (i = 0; i < x->num_variables; i++)\r
-               if (!slang_variable_copy (x->variables + i, y->variables + i))\r
-                       return 0;\r
-       x->outer_scope = y->outer_scope;\r
-       return 1;\r
-}\r
-\r
-/* slang_operation */\r
-/* XXX mem! */\r
-static void slang_operation_construct (slang_operation *oper)\r
-{\r
-       oper->type = slang_oper_none;\r
-       oper->children = NULL;\r
-       oper->num_children = 0;\r
-       oper->literal = (float) 0;\r
-       oper->identifier = NULL;\r
-       oper->locals = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));\r
-       slang_variable_scope_construct (oper->locals);\r
-}\r
-\r
-static void slang_operation_destruct (slang_operation *oper)\r
-{\r
-       unsigned int i;\r
-       for (i = 0; i < oper->num_children; i++)\r
-               slang_operation_destruct (oper->children + i);\r
-       slang_alloc_free (oper->children);\r
-       slang_alloc_free (oper->identifier);\r
-       slang_variable_scope_destruct (oper->locals);\r
-       slang_alloc_free (oper->locals);\r
-}\r
-\r
-static int slang_operation_copy (slang_operation *x, const slang_operation *y)\r
-{\r
-       unsigned int i;\r
-       slang_operation_destruct (x);\r
-       slang_operation_construct (x);\r
-       x->type = y->type;\r
-       x->children = (slang_operation *) slang_alloc_malloc (y->num_children * sizeof (\r
-               slang_operation));\r
-       if (x->children == NULL)\r
-               return 0;\r
-       x->num_children = y->num_children;\r
-       for (i = 0; i < x->num_children; i++)\r
-               slang_operation_construct (x->children + i);\r
-       for (i = 0; i < x->num_children; i++)\r
-               if (!slang_operation_copy (x->children + i, y->children + i))\r
-                       return 0;\r
-       x->literal = y->literal;\r
-       if (y->identifier != NULL)\r
-       {\r
-               x->identifier = slang_string_duplicate (y->identifier);\r
-               if (x->identifier == NULL)\r
-                       return 0;\r
-       }\r
-       if (!slang_variable_scope_copy (x->locals, y->locals))\r
-               return 0;\r
-       return 1;\r
-}\r
-\r
-/* slang_variable */\r
-\r
-static void slang_variable_construct (slang_variable *var)\r
-{\r
-       slang_fully_specified_type_construct (&var->type);\r
-       var->name = NULL;\r
-       var->array_size = NULL;\r
-       var->initializer = NULL;\r
-}\r
-\r
-static void slang_variable_destruct (slang_variable *var)\r
-{\r
-       slang_fully_specified_type_destruct (&var->type);\r
-       slang_alloc_free (var->name);\r
-       if (var->array_size != NULL)\r
-       {\r
-               slang_operation_destruct (var->array_size);\r
-               slang_alloc_free (var->array_size);\r
-       }\r
-       if (var->initializer != NULL)\r
-       {\r
-               slang_operation_destruct (var->initializer);\r
-               slang_alloc_free (var->initializer);\r
-       }\r
-}\r
-\r
-static int slang_variable_copy (slang_variable *x, const slang_variable *y)\r
-{\r
-       slang_variable_destruct (x);\r
-       slang_variable_construct (x);\r
-       if (!slang_fully_specified_type_copy (&x->type, &y->type))\r
-               return 0;\r
-       if (y->name != NULL)\r
-       {\r
-               x->name = slang_string_duplicate (y->name);\r
-               if (x->name == NULL)\r
-                       return 0;\r
-       }\r
-       if (y->array_size != NULL)\r
-       {\r
-               x->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));\r
-               if (x->array_size == NULL)\r
-                       return 0;\r
-               slang_operation_construct (x->array_size);\r
-               if (!slang_operation_copy (x->array_size, y->array_size))\r
-                       return 0;\r
-       }\r
-       if (y->initializer != NULL)\r
-       {\r
-               x->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));\r
-               if (x->initializer == NULL)\r
-                       return 0;\r
-               slang_operation_construct (x->initializer);\r
-               if (!slang_operation_copy (x->initializer, y->initializer))\r
-                       return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-/* slang_struct_scope */\r
-\r
-static void slang_struct_scope_construct (slang_struct_scope *scope)\r
-{\r
-       scope->structs = NULL;\r
-       scope->num_structs = 0;\r
-       scope->outer_scope = NULL;\r
-}\r
-\r
-static void slang_struct_scope_destruct (slang_struct_scope *scope)\r
-{\r
-       unsigned int i;\r
-       for (i = 0; i < scope->num_structs; i++)\r
-               slang_struct_destruct (scope->structs + i);\r
-       slang_alloc_free (scope->structs);\r
-}\r
-\r
-static int slang_struct_scope_copy (slang_struct_scope *x, const slang_struct_scope *y)\r
-{\r
-       unsigned int i;\r
-       slang_struct_scope_destruct (x);\r
-       slang_struct_scope_construct (x);\r
-       x->structs = (slang_struct *) slang_alloc_malloc (y->num_structs * sizeof (slang_struct));\r
-       if (x->structs == NULL)\r
-               return 0;\r
-       x->num_structs = y->num_structs;\r
-       for (i = 0; i < x->num_structs; i++)\r
-               slang_struct_construct (x->structs + i);\r
-       for (i = 0; i < x->num_structs; i++)\r
-               if (!slang_struct_copy (x->structs + i, y->structs + i))\r
-                       return 0;\r
-       x->outer_scope = y->outer_scope;\r
-       return 1;\r
-}\r
-\r
-static slang_struct *slang_struct_scope_find (slang_struct_scope *stru, const char *name,\r
-       int all_scopes)\r
-{\r
-       unsigned int i;\r
-       for (i = 0; i < stru->num_structs; i++)\r
-               if (slang_string_compare (name, stru->structs[i].name) == 0)\r
-                       return stru->structs + i;\r
-       if (all_scopes && stru->outer_scope != NULL)\r
-               return slang_struct_scope_find (stru->outer_scope, name, 1);\r
-       return NULL;\r
-}\r
-\r
-/* slang_struct */\r
-/* XXX mem! */\r
-static void slang_struct_construct (slang_struct *stru)\r
-{\r
-       stru->name = NULL;\r
-       stru->fields = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));\r
-       slang_variable_scope_construct (stru->fields);\r
-       stru->structs = (slang_struct_scope *) slang_alloc_malloc (sizeof (slang_struct_scope));\r
-       slang_struct_scope_construct (stru->structs);\r
-}\r
-\r
-static void slang_struct_destruct (slang_struct *stru)\r
-{\r
-       slang_alloc_free (stru->name);\r
-       slang_variable_scope_destruct (stru->fields);\r
-       slang_alloc_free (stru->fields);\r
-       slang_struct_scope_destruct (stru->structs);\r
-       slang_alloc_free (stru->structs);\r
-}\r
-\r
-static int slang_struct_copy (slang_struct *x, const slang_struct *y)\r
-{\r
-       slang_struct_destruct (x);\r
-       slang_struct_construct (x);\r
-       if (y->name != NULL)\r
-       {\r
-               x->name = slang_string_duplicate (y->name);\r
-               if (x->name == NULL)\r
-                       return 0;\r
-       }\r
-       if (!slang_variable_scope_copy (x->fields, y->fields))\r
-               return 0;\r
-       if (!slang_struct_scope_copy (x->structs, y->structs))\r
-               return 0;\r
-       return 1;\r
-}\r
-\r
-static int slang_struct_equal (const slang_struct *x, const slang_struct *y)\r
-{\r
-       unsigned int i;\r
-       if (x->fields->num_variables != y->fields->num_variables)\r
-               return 0;\r
-       for (i = 0; i < x->fields->num_variables; i++)\r
-       {\r
-               slang_variable *varx = x->fields->variables + i;\r
-               slang_variable *vary = y->fields->variables + i;\r
-               if (slang_string_compare (varx->name, vary->name) != 0)\r
-                       return 0;\r
-               if (!slang_type_specifier_equal (&varx->type.specifier, &vary->type.specifier))\r
-                       return 0;\r
-               if (varx->type.specifier.type == slang_spec_array)\r
-               {\r
-                       /* TODO compare array sizes */\r
-               }\r
-       }\r
-       return 1;\r
-}\r
-\r
-/* slang_function */\r
-/* XXX mem! */\r
-static void slang_function_construct (slang_function *func)\r
-{\r
-       func->kind = slang_func_ordinary;\r
-       slang_variable_construct (&func->header);\r
-       func->parameters = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));\r
-       slang_variable_scope_construct (func->parameters);\r
-       func->body = NULL;\r
-}\r
-\r
-static void slang_function_destruct (slang_function *func)\r
-{\r
-       slang_variable_destruct (&func->header);\r
-       slang_variable_scope_destruct (func->parameters);\r
-       slang_alloc_free (func->parameters);\r
-       if (func->body != NULL)\r
-       {\r
-               slang_operation_destruct (func->body);\r
-               slang_alloc_free (func->body);\r
-       }\r
-}\r
-\r
-/* slang_function_scope */\r
-\r
-static void slang_function_scope_construct (slang_function_scope *scope)\r
-{\r
-       scope->functions = NULL;\r
-       scope->num_functions = 0;\r
-       scope->outer_scope = NULL;\r
-}\r
-\r
-static void slang_function_scope_destruct (slang_function_scope *scope)\r
-{\r
-       unsigned int i;\r
-       for (i = 0; i < scope->num_functions; i++)\r
-               slang_function_destruct (scope->functions + i);\r
-       slang_alloc_free (scope->functions);\r
-}\r
-\r
-static slang_function *slang_function_scope_find (slang_function_scope *funcs, slang_function *fun,\r
-       int all_scopes)\r
-{\r
-       unsigned int i;\r
-       for (i = 0; i < funcs->num_functions; i++)\r
-       {\r
-               slang_function *f = funcs->functions + i;\r
-               unsigned int j;\r
-               if (slang_string_compare (fun->header.name, f->header.name) != 0)\r
-                       continue;\r
-               if (fun->param_count != f->param_count)\r
-                       continue;\r
-               for (j = 0; j < fun->param_count; j++)\r
-               {\r
-                       if (!slang_type_specifier_equal (&fun->parameters->variables[j].type.specifier,\r
-                               &f->parameters->variables[j].type.specifier))\r
-                       {\r
-                               break;\r
-                       }\r
-               }\r
-               if (j == fun->param_count)\r
-                       return f;\r
-       }\r
-       if (all_scopes && funcs->outer_scope != NULL)\r
-               return slang_function_scope_find (funcs->outer_scope, fun, 1);\r
-       return NULL;\r
-}\r
-\r
-/* slang_translation_unit */\r
-/* XXX mem! */\r
-static void slang_translation_unit_construct (slang_translation_unit *unit)\r
-{\r
-       unit->globals = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));\r
-       slang_variable_scope_construct (unit->globals);\r
-       slang_function_scope_construct (&unit->functions);\r
-       unit->structs = (slang_struct_scope *) slang_alloc_malloc (sizeof (slang_struct_scope));\r
-       slang_struct_scope_construct (unit->structs);\r
-}\r
-\r
-static void slang_translation_unit_destruct (slang_translation_unit *unit)\r
-{\r
-       slang_variable_scope_destruct (unit->globals);\r
-       slang_alloc_free (unit->globals);\r
-       slang_function_scope_destruct (&unit->functions);\r
-       slang_struct_scope_destruct (unit->structs);\r
-       slang_alloc_free (unit->structs);\r
-}\r
-\r
-/* slang_info_log */\r
-\r
-static char *out_of_memory = "error: out of memory\n";\r
-\r
-void slang_info_log_construct (slang_info_log *log)\r
-{\r
-       log->text = NULL;\r
-       log->dont_free_text = 0;\r
-}\r
-\r
-void slang_info_log_destruct (slang_info_log *log)\r
-{\r
-       if (!log->dont_free_text)\r
-               slang_alloc_free (log->text);\r
-}\r
-\r
-static int slang_info_log_message (slang_info_log *log, const char *prefix, const char *msg)\r
-{\r
-       unsigned int new_size;\r
-       if (log->dont_free_text)\r
-               return 0;\r
-       new_size = slang_string_length (prefix) + 3 + slang_string_length (msg);\r
-       if (log->text != NULL)\r
-       {\r
-               log->text = (char *) slang_alloc_realloc (log->text, slang_string_length (log->text) + 1,\r
-                       new_size + slang_string_length (log->text) + 1);\r
-       }\r
-       else\r
-       {\r
-               log->text = (char *) slang_alloc_malloc (new_size + 1);\r
-               if (log->text != NULL)\r
-                       *log->text = '\0';\r
-       }\r
-       if (log->text == NULL)\r
-               return 0;\r
-       slang_string_concat (log->text, prefix);\r
-       slang_string_concat (log->text, ": ");\r
-       slang_string_concat (log->text, msg);\r
-       slang_string_concat (log->text, "\n");\r
-       return 1;\r
-}\r
-\r
-int slang_info_log_error (slang_info_log *log, const char *msg, ...)\r
-{\r
-       if (slang_info_log_message (log, "error", msg))\r
-               return 1;\r
-       slang_info_log_memory (log);\r
-       return 0;\r
-}\r
-\r
-int slang_info_log_warning (slang_info_log *log, const char *msg, ...)\r
-{\r
-       if (slang_info_log_message (log, "warning", msg))\r
-               return 1;\r
-       slang_info_log_memory (log);\r
-       return 0;\r
-}\r
-\r
-void slang_info_log_memory (slang_info_log *log)\r
-{\r
-       if (!slang_info_log_message (log, "error", "out of memory"))\r
-       {\r
-               log->dont_free_text = 1;\r
-               log->text = out_of_memory;\r
-       }\r
-}\r
-\r
-/* slang_parse_ctx */\r
-\r
-typedef struct slang_parse_ctx_\r
-{\r
-       const byte *I;\r
-       slang_info_log *L;\r
-} slang_parse_ctx;\r
-\r
-/* --- */\r
-\r
-static int parse_identifier (slang_parse_ctx *C, char **id)\r
-{\r
-       *id = slang_string_duplicate ((const char *) C->I);\r
-       if (*id == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       C->I += strlen ((const char *) C->I) + 1;\r
-       return 1;\r
-}\r
-\r
-static int parse_number (slang_parse_ctx *C, int *number)\r
-{\r
-       const int radix = (int) (*C->I++);\r
-       *number = 0;\r
-       while (*C->I != '\0')\r
-       {\r
-               int digit;\r
-               if (*C->I >= '0' && *C->I <= '9')\r
-                       digit = (int) (*C->I - '0');\r
-               else if (*C->I >= 'A' && *C->I <= 'Z')\r
-                       digit = (int) (*C->I - 'A') + 10;\r
-               else\r
-                       digit = (int) (*C->I - 'a') + 10;\r
-               *number = *number * radix + digit;\r
-               C->I++;\r
-       }\r
-       C->I++;\r
-       if (*number > 65535)\r
-               slang_info_log_warning (C->L, "%d: literal integer overflow", *number);\r
-       return 1;\r
-}\r
-\r
-static int parse_float (slang_parse_ctx *C, float *number)\r
-{\r
-       char *integral = NULL;\r
-       char *fractional = NULL;\r
-       char *exponent = NULL;\r
-       char *whole = NULL;\r
-\r
-       if (!parse_identifier (C, &integral))\r
-               return 0;\r
-\r
-       if (!parse_identifier (C, &fractional))\r
-       {\r
-               slang_alloc_free (integral);\r
-               return 0;\r
-       }\r
-\r
-       if (!parse_identifier (C, &exponent))\r
-       {\r
-               slang_alloc_free (fractional);\r
-               slang_alloc_free (integral);\r
-               return 0;\r
-       }\r
-\r
-       whole = (char *) (slang_alloc_malloc ((strlen (integral) + strlen (fractional) + strlen (\r
-               exponent) + 3) * sizeof (char)));\r
-       if (whole == NULL)\r
-       {\r
-               slang_alloc_free (exponent);\r
-               slang_alloc_free (fractional);\r
-               slang_alloc_free (integral);\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-\r
-       slang_string_copy (whole, integral);\r
-       slang_string_concat (whole, ".");\r
-       slang_string_concat (whole, fractional);\r
-       slang_string_concat (whole, "E");\r
-       slang_string_concat (whole, exponent);\r
-\r
-       *number = (float) (atof (whole));\r
-\r
-       slang_alloc_free (whole);\r
-       slang_alloc_free (exponent);\r
-       slang_alloc_free (fractional);\r
-       slang_alloc_free (integral);\r
-       return 1;\r
-}\r
-\r
-/* revision number - increment after each change affecting emitted output */\r
-#define REVISION 2\r
-\r
-static int check_revision (slang_parse_ctx *C)\r
-{\r
-       if (*C->I != REVISION)\r
-       {\r
-               slang_info_log_error (C->L, "internal compiler error");\r
-               return 0;\r
-       }\r
-       C->I++;\r
-       return 1;\r
-}\r
-\r
-static int parse_statement (slang_parse_ctx *, slang_operation *, slang_variable_scope *,\r
-       slang_struct_scope *);\r
-static int parse_expression (slang_parse_ctx *, slang_operation *, slang_variable_scope *,\r
-       slang_struct_scope *);\r
-\r
-/* type qualifier */\r
-#define TYPE_QUALIFIER_NONE 0\r
-#define TYPE_QUALIFIER_CONST 1\r
-#define TYPE_QUALIFIER_ATTRIBUTE 2\r
-#define TYPE_QUALIFIER_VARYING 3\r
-#define TYPE_QUALIFIER_UNIFORM 4\r
-#define TYPE_QUALIFIER_FIXEDOUTPUT 5\r
-#define TYPE_QUALIFIER_FIXEDINPUT 6\r
-\r
-static int parse_type_qualifier (slang_parse_ctx *C, slang_type_qualifier *qual)\r
-{\r
-       switch (*C->I++)\r
-       {\r
-       case TYPE_QUALIFIER_NONE:\r
-               *qual = slang_qual_none;\r
-               break;\r
-       case TYPE_QUALIFIER_CONST:\r
-               *qual = slang_qual_const;\r
-               break;\r
-       case TYPE_QUALIFIER_ATTRIBUTE:\r
-               *qual = slang_qual_attribute;\r
-               break;\r
-       case TYPE_QUALIFIER_VARYING:\r
-               *qual = slang_qual_varying;\r
-               break;\r
-       case TYPE_QUALIFIER_UNIFORM:\r
-               *qual = slang_qual_uniform;\r
-               break;\r
-       case TYPE_QUALIFIER_FIXEDOUTPUT:\r
-               *qual = slang_qual_fixedoutput;\r
-               break;\r
-       case TYPE_QUALIFIER_FIXEDINPUT:\r
-               *qual = slang_qual_fixedinput;\r
-               break;\r
-       default:\r
-               return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-/* type specifier */\r
-#define TYPE_SPECIFIER_VOID 0\r
-#define TYPE_SPECIFIER_BOOL 1\r
-#define TYPE_SPECIFIER_BVEC2 2\r
-#define TYPE_SPECIFIER_BVEC3 3\r
-#define TYPE_SPECIFIER_BVEC4 4\r
-#define TYPE_SPECIFIER_INT 5\r
-#define TYPE_SPECIFIER_IVEC2 6\r
-#define TYPE_SPECIFIER_IVEC3 7\r
-#define TYPE_SPECIFIER_IVEC4 8\r
-#define TYPE_SPECIFIER_FLOAT 9\r
-#define TYPE_SPECIFIER_VEC2 10\r
-#define TYPE_SPECIFIER_VEC3 11\r
-#define TYPE_SPECIFIER_VEC4 12\r
-#define TYPE_SPECIFIER_MAT2 13\r
-#define TYPE_SPECIFIER_MAT3 14\r
-#define TYPE_SPECIFIER_MAT4 15\r
-#define TYPE_SPECIFIER_SAMPLER1D 16\r
-#define TYPE_SPECIFIER_SAMPLER2D 17\r
-#define TYPE_SPECIFIER_SAMPLER3D 18\r
-#define TYPE_SPECIFIER_SAMPLERCUBE 19\r
-#define TYPE_SPECIFIER_SAMPLER1DSHADOW 20\r
-#define TYPE_SPECIFIER_SAMPLER2DSHADOW 21\r
-#define TYPE_SPECIFIER_STRUCT 22\r
-#define TYPE_SPECIFIER_TYPENAME 23\r
-\r
-/* structure field */\r
-#define FIELD_NONE 0\r
-#define FIELD_NEXT 1\r
-#define FIELD_ARRAY 2\r
-\r
-static int parse_type_specifier (slang_parse_ctx *C, slang_type_specifier *spec,\r
-       slang_struct_scope *structs, slang_variable_scope *scope)\r
-{\r
-       switch (*C->I++)\r
-       {\r
-       case TYPE_SPECIFIER_VOID:\r
-               spec->type = slang_spec_void;\r
-               break;\r
-       case TYPE_SPECIFIER_BOOL:\r
-               spec->type = slang_spec_bool;\r
-               break;\r
-       case TYPE_SPECIFIER_BVEC2:\r
-               spec->type = slang_spec_bvec2;\r
-               break;\r
-       case TYPE_SPECIFIER_BVEC3:\r
-               spec->type = slang_spec_bvec3;\r
-               break;\r
-       case TYPE_SPECIFIER_BVEC4:\r
-               spec->type = slang_spec_bvec4;\r
-               break;\r
-       case TYPE_SPECIFIER_INT:\r
-               spec->type = slang_spec_int;\r
-               break;\r
-       case TYPE_SPECIFIER_IVEC2:\r
-               spec->type = slang_spec_ivec2;\r
-               break;\r
-       case TYPE_SPECIFIER_IVEC3:\r
-               spec->type = slang_spec_ivec3;\r
-               break;\r
-       case TYPE_SPECIFIER_IVEC4:\r
-               spec->type = slang_spec_ivec4;\r
-               break;\r
-       case TYPE_SPECIFIER_FLOAT:\r
-               spec->type = slang_spec_float;\r
-               break;\r
-       case TYPE_SPECIFIER_VEC2:\r
-               spec->type = slang_spec_vec2;\r
-               break;\r
-       case TYPE_SPECIFIER_VEC3:\r
-               spec->type = slang_spec_vec3;\r
-               break;\r
-       case TYPE_SPECIFIER_VEC4:\r
-               spec->type = slang_spec_vec4;\r
-               break;\r
-       case TYPE_SPECIFIER_MAT2:\r
-               spec->type = slang_spec_mat2;\r
-               break;\r
-       case TYPE_SPECIFIER_MAT3:\r
-               spec->type = slang_spec_mat3;\r
-               break;\r
-       case TYPE_SPECIFIER_MAT4:\r
-               spec->type = slang_spec_mat4;\r
-               break;\r
-       case TYPE_SPECIFIER_SAMPLER1D:\r
-               spec->type = slang_spec_sampler1D;\r
-               break;\r
-       case TYPE_SPECIFIER_SAMPLER2D:\r
-               spec->type = slang_spec_sampler2D;\r
-               break;\r
-       case TYPE_SPECIFIER_SAMPLER3D:\r
-               spec->type = slang_spec_sampler3D;\r
-               break;\r
-       case TYPE_SPECIFIER_SAMPLERCUBE:\r
-               spec->type = slang_spec_samplerCube;\r
-               break;\r
-       case TYPE_SPECIFIER_SAMPLER1DSHADOW:\r
-               spec->type = slang_spec_sampler1DShadow;\r
-               break;\r
-       case TYPE_SPECIFIER_SAMPLER2DSHADOW:\r
-               spec->type = slang_spec_sampler2DShadow;\r
-               break;\r
-       case TYPE_SPECIFIER_STRUCT:\r
-               spec->type = slang_spec_struct;\r
-               {\r
-                       char *name;\r
-                       if (!parse_identifier (C, &name))\r
-                               return 0;\r
-                       if (*name != '\0' && slang_struct_scope_find (structs, name, 0) != NULL)\r
-                       {\r
-                               slang_info_log_error (C->L, "%s: duplicate type name", name);\r
-                               slang_alloc_free (name);\r
-                               return 0;\r
-                       }\r
-                       spec->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));\r
-                       if (spec->_struct == NULL)\r
-                       {\r
-                               slang_alloc_free (name);\r
-                               slang_info_log_memory (C->L);\r
-                               return 0;\r
-                       }\r
-                       slang_struct_construct (spec->_struct);\r
-                       spec->_struct->name = name;\r
-                       spec->_struct->structs->outer_scope = structs;\r
-               }\r
-               do\r
-               {\r
-                       slang_type_specifier sp;\r
-                       slang_type_specifier_construct (&sp);\r
-                       if (!parse_type_specifier (C, &sp, spec->_struct->structs, scope))\r
-                       {\r
-                               slang_type_specifier_destruct (&sp);\r
-                               return 0;\r
-                       }\r
-                       do\r
-                       {\r
-                               slang_variable *var;\r
-                               spec->_struct->fields->variables = (slang_variable *) slang_alloc_realloc (\r
-                                       spec->_struct->fields->variables,\r
-                                       spec->_struct->fields->num_variables * sizeof (slang_variable),\r
-                                       (spec->_struct->fields->num_variables + 1) * sizeof (slang_variable));\r
-                               if (spec->_struct->fields->variables == NULL)\r
-                               {\r
-                                       slang_type_specifier_destruct (&sp);\r
-                                       slang_info_log_memory (C->L);\r
-                                       return 0;\r
-                               }\r
-                               var = spec->_struct->fields->variables + spec->_struct->fields->num_variables;\r
-                               spec->_struct->fields->num_variables++;\r
-                               slang_variable_construct (var);\r
-                               if (!slang_type_specifier_copy (&var->type.specifier, &sp))\r
-                               {\r
-                                       slang_type_specifier_destruct (&sp);\r
-                                       return 0;\r
-                               }\r
-                               if (!parse_identifier (C, &var->name))\r
-                               {\r
-                                       slang_type_specifier_destruct (&sp);\r
-                                       return 0;\r
-                               }\r
-                               switch (*C->I++)\r
-                               {\r
-                               case FIELD_NONE:\r
-                                       break;\r
-                               case FIELD_ARRAY:\r
-                                       var->array_size = (slang_operation *) slang_alloc_malloc (sizeof (\r
-                                               slang_operation));\r
-                                       if (var->array_size == NULL)\r
-                                       {\r
-                                               slang_type_specifier_destruct (&sp);\r
-                                               slang_info_log_memory (C->L);\r
-                                               return 0;\r
-                                       }\r
-                                       slang_operation_construct (var->array_size);\r
-                                       if (!parse_expression (C, var->array_size, scope, structs))\r
-                                       {\r
-                                               slang_type_specifier_destruct (&sp);\r
-                                               return 0;\r
-                                       }\r
-                                       break;\r
-                               default:\r
-                                       return 0;\r
-                               }\r
-                       }\r
-                       while (*C->I++ != FIELD_NONE);\r
-               }\r
-               while (*C->I++ != FIELD_NONE);\r
-               if (*spec->_struct->name != '\0')\r
-               {\r
-                       slang_struct *s;\r
-                       structs->structs = (slang_struct *) slang_alloc_realloc (structs->structs,\r
-                               structs->num_structs * sizeof (slang_struct),\r
-                               (structs->num_structs + 1) * sizeof (slang_struct));\r
-                       if (structs->structs == NULL)\r
-                       {\r
-                               slang_info_log_memory (C->L);\r
-                               return 0;\r
-                       }\r
-                       s = structs->structs + structs->num_structs;\r
-                       structs->num_structs++;\r
-                       slang_struct_construct (s);\r
-                       if (!slang_struct_copy (s, spec->_struct))\r
-                               return 0;\r
-               }\r
-               break;\r
-       case TYPE_SPECIFIER_TYPENAME:\r
-               spec->type = slang_spec_struct;\r
-               {\r
-                       char *name;\r
-                       slang_struct *stru;\r
-                       if (!parse_identifier (C, &name))\r
-                               return 0;\r
-                       stru = slang_struct_scope_find (structs, name, 1);\r
-                       if (stru == NULL)\r
-                       {\r
-                               slang_info_log_error (C->L, "%s: undeclared type name", name);\r
-                               slang_alloc_free (name);\r
-                               return 0;\r
-                       }\r
-                       slang_alloc_free (name);\r
-                       spec->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));\r
-                       if (spec->_struct == NULL)\r
-                       {\r
-                               slang_info_log_memory (C->L);\r
-                               return 0;\r
-                       }\r
-                       slang_struct_construct (spec->_struct);\r
-                       if (!slang_struct_copy (spec->_struct, stru))\r
-                               return 0;\r
-               }\r
-               break;\r
-       default:\r
-               return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-static int parse_fully_specified_type (slang_parse_ctx *C, slang_fully_specified_type *type,\r
-       slang_struct_scope *structs, slang_variable_scope *scope)\r
-{\r
-       if (!parse_type_qualifier (C, &type->qualifier))\r
-               return 0;\r
-       return parse_type_specifier (C, &type->specifier, structs, scope);\r
-}\r
-\r
-/* operation */\r
-#define OP_END 0\r
-#define OP_BLOCK_BEGIN_NO_NEW_SCOPE 1\r
-#define OP_BLOCK_BEGIN_NEW_SCOPE 2\r
-#define OP_DECLARE 3\r
-#define OP_ASM 4\r
-#define OP_BREAK 5\r
-#define OP_CONTINUE 6\r
-#define OP_DISCARD 7\r
-#define OP_RETURN 8\r
-#define OP_EXPRESSION 9\r
-#define OP_IF 10\r
-#define OP_WHILE 11\r
-#define OP_DO 12\r
-#define OP_FOR 13\r
-#define OP_PUSH_VOID 14\r
-#define OP_PUSH_BOOL 15\r
-#define OP_PUSH_INT 16\r
-#define OP_PUSH_FLOAT 17\r
-#define OP_PUSH_IDENTIFIER 18\r
-#define OP_SEQUENCE 19\r
-#define OP_ASSIGN 20\r
-#define OP_ADDASSIGN 21\r
-#define OP_SUBASSIGN 22\r
-#define OP_MULASSIGN 23\r
-#define OP_DIVASSIGN 24\r
-/*#define OP_MODASSIGN 25*/\r
-/*#define OP_LSHASSIGN 26*/\r
-/*#define OP_RSHASSIGN 27*/\r
-/*#define OP_ORASSIGN 28*/\r
-/*#define OP_XORASSIGN 29*/\r
-/*#define OP_ANDASSIGN 30*/\r
-#define OP_SELECT 31\r
-#define OP_LOGICALOR 32\r
-#define OP_LOGICALXOR 33\r
-#define OP_LOGICALAND 34\r
-/*#define OP_BITOR 35*/\r
-/*#define OP_BITXOR 36*/\r
-/*#define OP_BITAND 37*/\r
-#define OP_EQUAL 38\r
-#define OP_NOTEQUAL 39\r
-#define OP_LESS 40\r
-#define OP_GREATER 41\r
-#define OP_LESSEQUAL 42\r
-#define OP_GREATEREQUAL 43\r
-/*#define OP_LSHIFT 44*/\r
-/*#define OP_RSHIFT 45*/\r
-#define OP_ADD 46\r
-#define OP_SUBTRACT 47\r
-#define OP_MULTIPLY 48\r
-#define OP_DIVIDE 49\r
-/*#define OP_MODULUS 50*/\r
-#define OP_PREINCREMENT 51\r
-#define OP_PREDECREMENT 52\r
-#define OP_PLUS 53\r
-#define OP_MINUS 54\r
-/*#define OP_COMPLEMENT 55*/\r
-#define OP_NOT 56\r
-#define OP_SUBSCRIPT 57\r
-#define OP_CALL 58\r
-#define OP_FIELD 59\r
-#define OP_POSTINCREMENT 60\r
-#define OP_POSTDECREMENT 61\r
-\r
-static int parse_child_operation (slang_parse_ctx *C, slang_operation *oper, int statement,\r
-       slang_variable_scope *scope, slang_struct_scope *structs)\r
-{\r
-       oper->children = (slang_operation *) slang_alloc_realloc (oper->children,\r
-               oper->num_children * sizeof (slang_operation),\r
-               (oper->num_children + 1) * sizeof (slang_operation));\r
-       if (oper->children == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       slang_operation_construct (oper->children + oper->num_children);\r
-       oper->num_children++;\r
-       if (statement)\r
-               return parse_statement (C, oper->children + oper->num_children - 1, scope, structs);\r
-       return parse_expression (C, oper->children + oper->num_children - 1, scope, structs);\r
-}\r
-\r
-static int parse_declaration (slang_parse_ctx *C, slang_variable_scope *, slang_struct_scope *,\r
-       slang_function_scope *);\r
-\r
-static int parse_statement (slang_parse_ctx *C, slang_operation *oper, slang_variable_scope *scope,\r
-       slang_struct_scope *structs)\r
-{\r
-       oper->locals->outer_scope = scope;\r
-       switch (*C->I++)\r
-       {\r
-       case OP_BLOCK_BEGIN_NO_NEW_SCOPE:\r
-               oper->type = slang_oper_block_no_new_scope;\r
-               while (*C->I != OP_END)\r
-                       if (!parse_child_operation (C, oper, 1, scope, structs))\r
-                               return 0;\r
-               C->I++;\r
-               break;\r
-       case OP_BLOCK_BEGIN_NEW_SCOPE:\r
-               oper->type = slang_oper_block_new_scope;\r
-               while (*C->I != OP_END)\r
-                       if (!parse_child_operation (C, oper, 1, oper->locals, structs))\r
-                               return 0;\r
-               C->I++;\r
-               break;\r
-       case OP_DECLARE:\r
-               oper->type = slang_oper_variable_decl;\r
-               {\r
-                       const unsigned int first_var = scope->num_variables;\r
-                       if (!parse_declaration (C, scope, structs, NULL))\r
-                               return 0;\r
-                       if (first_var < scope->num_variables)\r
-                       {\r
-                               const unsigned int num_vars = scope->num_variables - first_var;\r
-                               unsigned int i;\r
-                               oper->children = (slang_operation *) slang_alloc_malloc (num_vars * sizeof (\r
-                                       slang_operation));\r
-                               if (oper->children == NULL)\r
-                               {\r
-                                       slang_info_log_memory (C->L);\r
-                                       return 0;\r
-                               }\r
-                               for (i = 0; i < num_vars; i++)\r
-                                       slang_operation_construct (oper->children + i);\r
-                               oper->num_children = num_vars;\r
-                               for (i = first_var; i < scope->num_variables; i++)\r
-                               {\r
-                                       slang_operation *o = oper->children + i - first_var;\r
-                                       o->type = slang_oper_identifier;\r
-                                       o->locals->outer_scope = scope;\r
-                                       o->identifier = slang_string_duplicate (scope->variables[i].name);\r
-                                       if (o->identifier == NULL)\r
-                                       {\r
-                                               slang_info_log_memory (C->L);\r
-                                               return 0;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-               break;\r
-       case OP_ASM:\r
-               oper->type = slang_oper_asm;\r
-               if (!parse_identifier (C, &oper->identifier))\r
-                       return 0;\r
-               while (*C->I != OP_END)\r
-                       if (!parse_child_operation (C, oper, 0, scope, structs))\r
-                               return 0;\r
-               C->I++;\r
-               break;\r
-       case OP_BREAK:\r
-               oper->type = slang_oper_break;\r
-               break;\r
-       case OP_CONTINUE:\r
-               oper->type = slang_oper_continue;\r
-               break;\r
-       case OP_DISCARD:\r
-               oper->type = slang_oper_discard;\r
-               break;\r
-       case OP_RETURN:\r
-               oper->type = slang_oper_return;\r
-               if (!parse_child_operation (C, oper, 0, scope, structs))\r
-                       return 0;\r
-               break;\r
-       case OP_EXPRESSION:\r
-               oper->type = slang_oper_expression;\r
-               if (!parse_child_operation (C, oper, 0, scope, structs))\r
-                       return 0;\r
-               break;\r
-       case OP_IF:\r
-               oper->type = slang_oper_if;\r
-               if (!parse_child_operation (C, oper, 0, scope, structs))\r
-                       return 0;\r
-               if (!parse_child_operation (C, oper, 1, scope, structs))\r
-                       return 0;\r
-               if (!parse_child_operation (C, oper, 1, scope, structs))\r
-                       return 0;\r
-               break;\r
-       case OP_WHILE:\r
-               oper->type = slang_oper_while;\r
-               if (!parse_child_operation (C, oper, 1, oper->locals, structs))\r
-                       return 0;\r
-               if (!parse_child_operation (C, oper, 1, oper->locals, structs))\r
-                       return 0;\r
-               break;\r
-       case OP_DO:\r
-               oper->type = slang_oper_do;\r
-               if (!parse_child_operation (C, oper, 1, scope, structs))\r
-                       return 0;\r
-               if (!parse_child_operation (C, oper, 0, scope, structs))\r
-                       return 0;\r
-               break;\r
-       case OP_FOR:\r
-               oper->type = slang_oper_for;\r
-               if (!parse_child_operation (C, oper, 1, oper->locals, structs))\r
-                       return 0;\r
-               if (!parse_child_operation (C, oper, 1, oper->locals, structs))\r
-                       return 0;\r
-               if (!parse_child_operation (C, oper, 0, oper->locals, structs))\r
-                       return 0;\r
-               if (!parse_child_operation (C, oper, 1, oper->locals, structs))\r
-                       return 0;\r
-               break;\r
-       default:\r
-               return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-static int handle_trinary_expression (slang_parse_ctx *C, slang_operation *op,\r
-       slang_operation **ops, unsigned int *num_ops)\r
-{\r
-       op->num_children = 3;\r
-       op->children = (slang_operation *) slang_alloc_malloc (3 * sizeof (slang_operation));\r
-       if (op->children == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       op->children[0] = (*ops)[*num_ops - 4];\r
-       op->children[1] = (*ops)[*num_ops - 3];\r
-       op->children[2] = (*ops)[*num_ops - 2];\r
-       (*ops)[*num_ops - 4] = (*ops)[*num_ops - 1];\r
-       *num_ops -= 3;\r
-       *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 3) * sizeof (slang_operation),\r
-               *num_ops * sizeof (slang_operation));\r
-       if (*ops == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-static int handle_binary_expression (slang_parse_ctx *C, slang_operation *op,\r
-       slang_operation **ops, unsigned int *num_ops)\r
-{\r
-       op->num_children = 2;\r
-       op->children = (slang_operation *) slang_alloc_malloc (2 * sizeof (slang_operation));\r
-       if (op->children == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       op->children[0] = (*ops)[*num_ops - 3];\r
-       op->children[1] = (*ops)[*num_ops - 2];\r
-       (*ops)[*num_ops - 3] = (*ops)[*num_ops - 1];\r
-       *num_ops -= 2;\r
-       *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 2) * sizeof (slang_operation),\r
-               *num_ops * sizeof (slang_operation));\r
-       if (*ops == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-static int handle_unary_expression (slang_parse_ctx *C, slang_operation *op,\r
-       slang_operation **ops, unsigned int *num_ops)\r
-{\r
-       op->num_children = 1;\r
-       op->children = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));\r
-       if (op->children == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       op->children[0] = (*ops)[*num_ops - 2];\r
-       (*ops)[*num_ops - 2] = (*ops)[*num_ops - 1];\r
-       (*num_ops)--;\r
-       *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 1) * sizeof (slang_operation),\r
-               *num_ops * sizeof (slang_operation));\r
-       if (*ops == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-static int parse_expression (slang_parse_ctx *C, slang_operation *oper, slang_variable_scope *scope,\r
-       slang_struct_scope *structs)\r
-{\r
-       slang_operation *ops = NULL;\r
-       unsigned int num_ops = 0;\r
-       int number;\r
-\r
-       while (*C->I != OP_END)\r
-       {\r
-               slang_operation *op;\r
-               const unsigned int op_code = *C->I++;\r
-               ops = (slang_operation *) slang_alloc_realloc (ops,\r
-                       num_ops * sizeof (slang_operation), (num_ops + 1) * sizeof (slang_operation));\r
-               if (ops == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       return 0;\r
-               }\r
-               op = ops + num_ops;\r
-               num_ops++;\r
-               slang_operation_construct (op);\r
-               op->locals->outer_scope = scope;\r
-               switch (op_code)\r
-               {\r
-               case OP_PUSH_VOID:\r
-                       op->type = slang_oper_void;\r
-                       break;\r
-               case OP_PUSH_BOOL:\r
-                       op->type = slang_oper_literal_bool;\r
-                       if (!parse_number (C, &number))\r
-                               return 0;\r
-                       op->literal = (float) number;\r
-                       break;\r
-               case OP_PUSH_INT:\r
-                       op->type = slang_oper_literal_int;\r
-                       if (!parse_number (C, &number))\r
-                               return 0;\r
-                       op->literal = (float) number;\r
-                       break;\r
-               case OP_PUSH_FLOAT:\r
-                       op->type = slang_oper_literal_float;\r
-                       if (!parse_float (C, &op->literal))\r
-                               return 0;\r
-                       break;\r
-               case OP_PUSH_IDENTIFIER:\r
-                       op->type = slang_oper_identifier;\r
-                       if (!parse_identifier (C, &op->identifier))\r
-                               return 0;\r
-                       break;\r
-               case OP_SEQUENCE:\r
-                       op->type = slang_oper_sequence;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_ASSIGN:\r
-                       op->type = slang_oper_assign;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_ADDASSIGN:\r
-                       op->type = slang_oper_addassign;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_SUBASSIGN:\r
-                       op->type = slang_oper_subassign;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_MULASSIGN:\r
-                       op->type = slang_oper_mulassign;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_DIVASSIGN:\r
-                       op->type = slang_oper_divassign;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               /*case OP_MODASSIGN:*/\r
-               /*case OP_LSHASSIGN:*/\r
-               /*case OP_RSHASSIGN:*/\r
-               /*case OP_ORASSIGN:*/\r
-               /*case OP_XORASSIGN:*/\r
-               /*case OP_ANDASSIGN:*/\r
-               case OP_SELECT:\r
-                       op->type = slang_oper_select;\r
-                       if (!handle_trinary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_LOGICALOR:\r
-                       op->type = slang_oper_logicalor;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_LOGICALXOR:\r
-                       op->type = slang_oper_logicalxor;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_LOGICALAND:\r
-                       op->type = slang_oper_logicaland;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               /*case OP_BITOR:*/\r
-               /*case OP_BITXOR:*/\r
-               /*case OP_BITAND:*/\r
-               case OP_EQUAL:\r
-                       op->type = slang_oper_equal;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_NOTEQUAL:\r
-                       op->type = slang_oper_notequal;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_LESS:\r
-                       op->type = slang_oper_less;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_GREATER:\r
-                       op->type = slang_oper_greater;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_LESSEQUAL:\r
-                       op->type = slang_oper_lessequal;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_GREATEREQUAL:\r
-                       op->type = slang_oper_greaterequal;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               /*case OP_LSHIFT:*/\r
-               /*case OP_RSHIFT:*/\r
-               case OP_ADD:\r
-                       op->type = slang_oper_add;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_SUBTRACT:\r
-                       op->type = slang_oper_subtract;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_MULTIPLY:\r
-                       op->type = slang_oper_multiply;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_DIVIDE:\r
-                       op->type = slang_oper_divide;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               /*case OP_MODULUS:*/\r
-               case OP_PREINCREMENT:\r
-                       op->type = slang_oper_preincrement;\r
-                       if (!handle_unary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_PREDECREMENT:\r
-                       op->type = slang_oper_predecrement;\r
-                       if (!handle_unary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_PLUS:\r
-                       op->type = slang_oper_plus;\r
-                       if (!handle_unary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_MINUS:\r
-                       op->type = slang_oper_minus;\r
-                       if (!handle_unary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_NOT:\r
-                       op->type = slang_oper_not;\r
-                       if (!handle_unary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               /*case OP_COMPLEMENT:*/\r
-               case OP_SUBSCRIPT:\r
-                       op->type = slang_oper_subscript;\r
-                       if (!handle_binary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_CALL:\r
-                       op->type = slang_oper_call;\r
-                       if (!parse_identifier (C, &op->identifier))\r
-                               return 0;\r
-                       while (*C->I != OP_END)\r
-                               if (!parse_child_operation (C, op, 0, scope, structs))\r
-                                       return 0;\r
-                       C->I++;\r
-                       break;\r
-               case OP_FIELD:\r
-                       op->type = slang_oper_field;\r
-                       if (!parse_identifier (C, &op->identifier))\r
-                               return 0;\r
-                       if (!handle_unary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_POSTINCREMENT:\r
-                       op->type = slang_oper_postincrement;\r
-                       if (!handle_unary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               case OP_POSTDECREMENT:\r
-                       op->type = slang_oper_postdecrement;\r
-                       if (!handle_unary_expression (C, op, &ops, &num_ops))\r
-                               return 0;\r
-                       break;\r
-               default:\r
-                       return 0;\r
-               }\r
-       }\r
-       C->I++;\r
-       *oper = *ops;\r
-       slang_alloc_free (ops);\r
-       return 1;\r
-}\r
-\r
-/* parameter qualifier */\r
-#define PARAM_QUALIFIER_IN 0\r
-#define PARAM_QUALIFIER_OUT 1\r
-#define PARAM_QUALIFIER_INOUT 2\r
-\r
-/* function parameter array presence */\r
-#define PARAMETER_ARRAY_NOT_PRESENT 0\r
-#define PARAMETER_ARRAY_PRESENT 1\r
-\r
-static int parse_parameter_declaration (slang_parse_ctx *C, slang_variable *param,\r
-       slang_struct_scope *structs, slang_variable_scope *scope)\r
-{\r
-       if (!parse_type_qualifier (C, &param->type.qualifier))\r
-               return 0;\r
-       switch (*C->I++)\r
-       {\r
-       case PARAM_QUALIFIER_IN:\r
-               if (param->type.qualifier != slang_qual_const && param->type.qualifier != slang_qual_none)\r
-               {\r
-                       slang_info_log_error (C->L, "invalid type qualifier");\r
-                       return 0;\r
-               }\r
-               break;\r
-       case PARAM_QUALIFIER_OUT:\r
-               if (param->type.qualifier == slang_qual_none)\r
-                       param->type.qualifier = slang_qual_out;\r
-               else\r
-               {\r
-                       slang_info_log_error (C->L, "invalid type qualifier");\r
-                       return 0;\r
-               }\r
-               break;\r
-       case PARAM_QUALIFIER_INOUT:\r
-               if (param->type.qualifier == slang_qual_none)\r
-                       param->type.qualifier = slang_qual_inout;\r
-               else\r
-               {\r
-                       slang_info_log_error (C->L, "invalid type qualifier");\r
-                       return 0;\r
-               }\r
-               break;\r
-       default:\r
-               return 0;\r
-       }\r
-       if (!parse_type_specifier (C, &param->type.specifier, structs, scope))\r
-               return 0;\r
-       if (!parse_identifier (C, &param->name))\r
-               return 0;\r
-       if (*C->I++ == PARAMETER_ARRAY_PRESENT)\r
-       {\r
-               param->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));\r
-               if (param->array_size == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       return 0;\r
-               }\r
-               slang_operation_construct (param->array_size);\r
-               if (!parse_expression (C, param->array_size, scope, structs))\r
-                       return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-/* function type */\r
-#define FUNCTION_ORDINARY 0\r
-#define FUNCTION_CONSTRUCTOR 1\r
-#define FUNCTION_OPERATOR 2\r
-\r
-/* function parameter */\r
-#define PARAMETER_NONE 0\r
-#define PARAMETER_NEXT 1\r
-\r
-/* operator type */\r
-#define OPERATOR_ASSIGN 1\r
-#define OPERATOR_ADDASSIGN 2\r
-#define OPERATOR_SUBASSIGN 3\r
-#define OPERATOR_MULASSIGN 4\r
-#define OPERATOR_DIVASSIGN 5\r
-/*#define OPERATOR_MODASSIGN 6*/\r
-/*#define OPERATOR_LSHASSIGN 7*/\r
-/*#define OPERATOR_RSHASSIGN 8*/\r
-/*#define OPERATOR_ANDASSIGN 9*/\r
-/*#define OPERATOR_XORASSIGN 10*/\r
-/*#define OPERATOR_ORASSIGN 11*/\r
-#define OPERATOR_LOGICALXOR 12\r
-/*#define OPERATOR_BITOR 13*/\r
-/*#define OPERATOR_BITXOR 14*/\r
-/*#define OPERATOR_BITAND 15*/\r
-#define OPERATOR_EQUAL 16\r
-#define OPERATOR_NOTEQUAL 17\r
-#define OPERATOR_LESS 18\r
-#define OPERATOR_GREATER 19\r
-#define OPERATOR_LESSEQUAL 20\r
-#define OPERATOR_GREATEREQUAL 21\r
-/*#define OPERATOR_LSHIFT 22*/\r
-/*#define OPERATOR_RSHIFT 23*/\r
-#define OPERATOR_MULTIPLY 24\r
-#define OPERATOR_DIVIDE 25\r
-/*#define OPERATOR_MODULUS 26*/\r
-#define OPERATOR_INCREMENT 27\r
-#define OPERATOR_DECREMENT 28\r
-#define OPERATOR_PLUS 29\r
-#define OPERATOR_MINUS 30\r
-/*#define OPERATOR_COMPLEMENT 31*/\r
-#define OPERATOR_NOT 32\r
-\r
-/* these must match with slang_type_specifier_type enum */\r
-static const char *type_specifier_names[] = {\r
-       "void",\r
-       "bool",\r
-       "bvec2",\r
-       "bvec3",\r
-       "bvec4",\r
-       "int",\r
-       "ivec2",\r
-       "ivec3",\r
-       "ivec4",\r
-       "float",\r
-       "vec2",\r
-       "vec3",\r
-       "vec4",\r
-       "mat2",\r
-       "mat3",\r
-       "mat4",\r
-       "sampler1D",\r
-       "sampler2D",\r
-       "sampler3D",\r
-       "samplerCube",\r
-       "sampler1DShadow",\r
-       "sampler2DShadow"\r
-};\r
-\r
-static const struct {\r
-       unsigned int o_code;\r
-       const char *o_name;\r
-} operator_names[] = {\r
-       { OPERATOR_INCREMENT, "++" },\r
-       { OPERATOR_ADDASSIGN, "+=" },\r
-       { OPERATOR_PLUS, "+" },\r
-       { OPERATOR_DECREMENT, "--" },\r
-       { OPERATOR_SUBASSIGN, "-=" },\r
-       { OPERATOR_MINUS, "-" },\r
-       { OPERATOR_NOTEQUAL, "!=" },\r
-       { OPERATOR_NOT, "!" },\r
-       { OPERATOR_MULASSIGN, "*=" },\r
-       { OPERATOR_MULTIPLY, "*" },\r
-       { OPERATOR_DIVASSIGN, "/=" },\r
-       { OPERATOR_DIVIDE, "/" },\r
-       { OPERATOR_LESSEQUAL, "<=" },\r
-       /*{ OPERATOR_LSHASSIGN, "<<=" },*/\r
-       /*{ OPERATOR_LSHIFT, "<<" },*/\r
-       { OPERATOR_LESS, "<" },\r
-       { OPERATOR_GREATEREQUAL, ">=" },\r
-       /*{ OPERATOR_RSHASSIGN, ">>=" },*/\r
-       /*{ OPERATOR_RSHIFT, ">>" },*/\r
-       { OPERATOR_GREATER, ">" },\r
-       { OPERATOR_EQUAL, "==" },\r
-       { OPERATOR_ASSIGN, "=" },\r
-       /*{ OPERATOR_MODASSIGN, "%=" },*/\r
-       /*{ OPERATOR_MODULUS, "%" },*/\r
-       /*{ OPERATOR_ANDASSIGN, "&=" },*/\r
-       /*{ OPERATOR_BITAND, "&" },*/\r
-       /*{ OPERATOR_ORASSIGN, "|=" },*/\r
-       /*{ OPERATOR_BITOR, "|" },*/\r
-       /*{ OPERATOR_COMPLEMENT, "~" },*/\r
-       /*{ OPERATOR_XORASSIGN, "^=" },*/\r
-       { OPERATOR_LOGICALXOR, "^^" }/*,*/\r
-       /*{ OPERATOR_BITXOR, "^" }*/\r
-};\r
-\r
-static int parse_operator_name (slang_parse_ctx *C, char **pname)\r
-{\r
-       unsigned int i;\r
-       for (i = 0; i < sizeof (operator_names) / sizeof (*operator_names); i++)\r
-               if (operator_names[i].o_code == (unsigned int) (*C->I))\r
-               {\r
-                       *pname = slang_string_duplicate (operator_names[i].o_name);\r
-                       if (*pname == NULL)\r
-                       {\r
-                               slang_info_log_memory (C->L);\r
-                               return 0;\r
-                       }\r
-                       C->I++;\r
-                       return 1;\r
-               }\r
-       return 0;\r
-}\r
-\r
-static int parse_function_prototype (slang_parse_ctx *C, slang_function *func,\r
-       slang_struct_scope *structs, slang_variable_scope *scope)\r
-{\r
-       if (!parse_fully_specified_type (C, &func->header.type, structs, scope))\r
-               return 0;\r
-       switch (*C->I++)\r
-       {\r
-       case FUNCTION_ORDINARY:\r
-               func->kind = slang_func_ordinary;\r
-               if (!parse_identifier (C, &func->header.name))\r
-                       return 0;\r
-               break;\r
-       case FUNCTION_CONSTRUCTOR:\r
-               func->kind = slang_func_constructor;\r
-               if (func->header.type.specifier.type == slang_spec_struct)\r
-                       return 0;\r
-               func->header.name = slang_string_duplicate (\r
-                       type_specifier_names[func->header.type.specifier.type]);\r
-               if (func->header.name == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       return 0;\r
-               }\r
-               break;\r
-       case FUNCTION_OPERATOR:\r
-               func->kind = slang_func_operator;\r
-               if (!parse_operator_name (C, &func->header.name))\r
-                       return 0;\r
-               break;\r
-       default:\r
-               return 0;\r
-       }\r
-       func->parameters->outer_scope = scope;\r
-       while (*C->I++ == PARAMETER_NEXT)\r
-       {\r
-               func->parameters->variables = (slang_variable *) slang_alloc_realloc (\r
-                       func->parameters->variables,\r
-                       func->parameters->num_variables * sizeof (slang_variable),\r
-                       (func->parameters->num_variables + 1) * sizeof (slang_variable));\r
-               if (func->parameters->variables == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       return 0;\r
-               }\r
-               slang_variable_construct (func->parameters->variables + func->parameters->num_variables);\r
-               func->parameters->num_variables++;\r
-               if (!parse_parameter_declaration (C, func->parameters->variables +\r
-                       func->parameters->num_variables - 1, structs, scope))\r
-                       return 0;\r
-       }\r
-       func->param_count = func->parameters->num_variables;\r
-       return 1;\r
-}\r
-\r
-static int parse_function_definition (slang_parse_ctx *C, slang_function *func,\r
-       slang_struct_scope *structs, slang_variable_scope *scope)\r
-{\r
-       if (!parse_function_prototype (C, func, structs, scope))\r
-               return 0;\r
-       func->body = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));\r
-       if (func->body == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       slang_operation_construct (func->body);\r
-       if (!parse_statement (C, func->body, func->parameters, structs))\r
-               return 0;\r
-       return 1;\r
-}\r
-\r
-/* init declarator list */\r
-#define DECLARATOR_NONE 0\r
-#define DECLARATOR_NEXT 1\r
-\r
-/* variable declaration */\r
-#define VARIABLE_NONE 0\r
-#define VARIABLE_IDENTIFIER 1\r
-#define VARIABLE_INITIALIZER 2\r
-#define VARIABLE_ARRAY_EXPLICIT 3\r
-#define VARIABLE_ARRAY_UNKNOWN 4\r
-\r
-static int parse_init_declarator (slang_parse_ctx *C, const slang_fully_specified_type *type,\r
-       slang_variable_scope *vars, slang_struct_scope *structs)\r
-{\r
-       slang_variable *var;\r
-\r
-       if (*C->I++ == VARIABLE_NONE)\r
-               return 1;\r
-       vars->variables = (slang_variable *) slang_alloc_realloc (vars->variables,\r
-               vars->num_variables * sizeof (slang_variable),\r
-               (vars->num_variables + 1) * sizeof (slang_variable));\r
-       if (vars->variables == NULL)\r
-       {\r
-               slang_info_log_memory (C->L);\r
-               return 0;\r
-       }\r
-       var = vars->variables + vars->num_variables;\r
-       vars->num_variables++;\r
-       slang_variable_construct (var);\r
-       var->type.qualifier = type->qualifier;\r
-       if (!parse_identifier (C, &var->name))\r
-               return 0;\r
-       switch (*C->I++)\r
-       {\r
-       case VARIABLE_NONE:\r
-               if (!slang_type_specifier_copy (&var->type.specifier, &type->specifier))\r
-                       return 0;\r
-               break;\r
-       case VARIABLE_INITIALIZER:\r
-               if (!slang_type_specifier_copy (&var->type.specifier, &type->specifier))\r
-                       return 0;\r
-               var->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));\r
-               if (var->initializer == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       return 0;\r
-               }\r
-               slang_operation_construct (var->initializer);\r
-               if (!parse_expression (C, var->initializer, vars, structs))\r
-                       return 0;\r
-               break;\r
-       case VARIABLE_ARRAY_UNKNOWN:\r
-               var->type.specifier.type = slang_spec_array;\r
-               var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof (\r
-                       slang_type_specifier));\r
-               if (var->type.specifier._array == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       return 0;\r
-               }\r
-               slang_type_specifier_construct (var->type.specifier._array);\r
-               if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier))\r
-                       return 0;\r
-               break;\r
-       case VARIABLE_ARRAY_EXPLICIT:\r
-               var->type.specifier.type = slang_spec_array;\r
-               var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof (\r
-                       slang_type_specifier));\r
-               if (var->type.specifier._array == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       return 0;\r
-               }\r
-               slang_type_specifier_construct (var->type.specifier._array);\r
-               if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier))\r
-                       return 0;\r
-               var->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));\r
-               if (var->array_size == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       return 0;\r
-               }\r
-               slang_operation_construct (var->array_size);\r
-               if (!parse_expression (C, var->array_size, vars, structs))\r
-                       return 0;\r
-               break;\r
-       default:\r
-               return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-static int parse_init_declarator_list (slang_parse_ctx *C, slang_variable_scope *vars,\r
-       slang_struct_scope *structs)\r
-{\r
-       slang_fully_specified_type type;\r
-\r
-       slang_fully_specified_type_construct (&type);\r
-       if (!parse_fully_specified_type (C, &type, structs, vars))\r
-       {\r
-               slang_fully_specified_type_destruct (&type);\r
-               return 0;\r
-       }\r
-       do\r
-       {\r
-               if (!parse_init_declarator (C, &type, vars, structs))\r
-               {\r
-                       slang_fully_specified_type_destruct (&type);\r
-                       return 0;\r
-               }\r
-       }\r
-       while (*C->I++ == DECLARATOR_NEXT);\r
-       slang_fully_specified_type_destruct (&type);\r
-       return 1;\r
-}\r
-\r
-static int parse_function (slang_parse_ctx *C, int definition, slang_struct_scope *structs,\r
-       slang_function_scope *funcs, slang_variable_scope *scope)\r
-{\r
-       slang_function parsed_func, *found_func;\r
-\r
-       slang_function_construct (&parsed_func);\r
-       if (definition)\r
-       {\r
-               if (!parse_function_definition (C, &parsed_func, structs, scope))\r
-               {\r
-                       slang_function_destruct (&parsed_func);\r
-                       return 0;\r
-               }\r
-       }\r
-       else\r
-       {\r
-               if (!parse_function_prototype (C, &parsed_func, structs, scope))\r
-               {\r
-                       slang_function_destruct (&parsed_func);\r
-                       return 0;\r
-               }\r
-       }\r
-       found_func = slang_function_scope_find (funcs, &parsed_func, 0);\r
-       if (found_func == NULL)\r
-       {\r
-               funcs->functions = (slang_function *) slang_alloc_realloc (funcs->functions,\r
-                       funcs->num_functions * sizeof (slang_function), (funcs->num_functions + 1) * sizeof (\r
-                       slang_function));\r
-               if (funcs->functions == NULL)\r
-               {\r
-                       slang_info_log_memory (C->L);\r
-                       slang_function_destruct (&parsed_func);\r
-                       return 0;\r
-               }\r
-               funcs->functions[funcs->num_functions] = parsed_func;\r
-               funcs->num_functions++;\r
-       }\r
-       else\r
-       {\r
-               /* TODO check function return type qualifiers and specifiers */\r
-               if (definition)\r
-               {\r
-                       if (found_func->body != NULL)\r
-                       {\r
-                               slang_info_log_error (C->L, "%s: function already has a body",\r
-                                       parsed_func.header.name);\r
-                               slang_function_destruct (&parsed_func);\r
-                               return 0;\r
-                       }\r
-                       slang_function_destruct (found_func);\r
-                       *found_func = parsed_func;\r
-               }\r
-               else\r
-               {\r
-                       slang_function_destruct (&parsed_func);\r
-               }\r
-       }\r
-       return 1;\r
-}\r
-\r
-/* declaration */\r
-#define DECLARATION_FUNCTION_PROTOTYPE 1\r
-#define DECLARATION_INIT_DECLARATOR_LIST 2\r
-\r
-static int parse_declaration (slang_parse_ctx *C, slang_variable_scope *scope,\r
-       slang_struct_scope *structs, slang_function_scope *funcs)\r
-{\r
-       switch (*C->I++)\r
-       {\r
-       case DECLARATION_INIT_DECLARATOR_LIST:\r
-               if (!parse_init_declarator_list (C, scope, structs))\r
-                       return 0;\r
-               break;\r
-       case DECLARATION_FUNCTION_PROTOTYPE:\r
-               if (!parse_function (C, 0, structs, funcs, scope))\r
-                       return 0;\r
-               break;\r
-       default:\r
-               return 0;\r
-       }\r
-       return 1;\r
-}\r
-\r
-/* external declaration */\r
-#define EXTERNAL_NULL 0\r
-#define EXTERNAL_FUNCTION_DEFINITION 1\r
-#define EXTERNAL_DECLARATION 2\r
-\r
-static int parse_translation_unit (slang_parse_ctx *C, slang_translation_unit *unit)\r
-{\r
-       while (*C->I != EXTERNAL_NULL)\r
-       {\r
-               switch (*C->I++)\r
-               {\r
-               case EXTERNAL_FUNCTION_DEFINITION:\r
-                       if (!parse_function (C, 1, unit->structs, &unit->functions, unit->globals))\r
-                               return 0;\r
-                       break;\r
-               case EXTERNAL_DECLARATION:\r
-                       if (!parse_declaration (C, unit->globals, unit->structs, &unit->functions))\r
-                               return 0;\r
-                       break;\r
-               default:\r
-                       return 0;\r
-               }\r
-       }\r
-       C->I++;\r
-       return 1;\r
-}\r
-\r
-static int compile_with_grammar (grammar id, const char *source, slang_translation_unit *unit,\r
-       slang_unit_type type, slang_info_log *log)\r
-{\r
-       byte *prod;\r
-       unsigned int size, start, version;\r
-       slang_parse_ctx C;\r
-\r
-       /* retrieve version */\r
-       if (!_slang_preprocess_version (source, &version, &start, log))\r
-               return 0;\r
-\r
-       slang_translation_unit_construct (unit);\r
-       unit->type = type;\r
-       if (!grammar_fast_check (id, (const byte *) source + start, &prod, &size, 65536))\r
-       {\r
-               char buf[1024];\r
-               unsigned int pos;\r
-               grammar_get_last_error (buf, 1024, &pos);\r
-               slang_info_log_error (log, buf);\r
-               return 0;\r
-       }\r
-       C.I = prod;\r
-       C.L = log;\r
-       if (!check_revision (&C))\r
-       {\r
-               grammar_alloc_free (prod);\r
-               return 0;\r
-       }\r
-       if (!parse_translation_unit (&C, unit))\r
-       {\r
-               slang_translation_unit_destruct (unit);\r
-               grammar_alloc_free (prod);\r
-               return 0;\r
-       }\r
-       grammar_alloc_free (prod);\r
-       return 1;\r
-}\r
-\r
-static const char *slang_shader_syn =\r
-#include "library/slang_shader_syn.h"\r
-;\r
-\r
-int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit_type type,\r
-       slang_info_log *log)\r
-{\r
-       grammar id;\r
-\r
-       id = grammar_load_from_text ((const byte *) slang_shader_syn);\r
-       if (id == 0)\r
-       {\r
-               char buf[1024];\r
-               unsigned int pos;\r
-               grammar_get_last_error (buf, 1024, &pos);\r
-               slang_info_log_error (log, buf);\r
-               return 0;\r
-       }\r
-\r
-       grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1);\r
-       if (type == slang_unit_fragment_shader)\r
-               grammar_set_reg8 (id, (const byte *) "shader_type", 1);\r
-       else\r
-               grammar_set_reg8 (id, (const byte *) "shader_type", 2);\r
-\r
-       if (!compile_with_grammar (id, source, unit, type, log))\r
-       {\r
-               grammar_destroy (id);\r
-               return 0;\r
-       }\r
-\r
-       grammar_destroy (id);\r
-       return 1;\r
-}\r
-\r
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.3
+ *
+ * Copyright (C) 2005  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_compile.c
+ * slang front-end compiler
+ * \author Michal Krol
+ */
+
+#include "imports.h" 
+#include "slang_compile.h"
+#include "grammar_mesa.h"
+#include "slang_preprocess.h"
+
+/*
+       This is a straightforward implementation of the slang front-end compiler.
+       Lots of error-checking functionality is missing but every well-formed shader source should
+       compile successfully and execute as expected. However, some semantically ill-formed shaders
+       may be accepted resulting in undefined behaviour.
+*/
+
+void slang_alloc_free (void *ptr)
+{
+       _mesa_free (ptr);
+}
+
+void *slang_alloc_malloc (unsigned int size)
+{
+       return _mesa_malloc (size);
+}
+
+void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
+{
+       return _mesa_realloc (ptr, old_size, size);
+}
+
+int slang_string_compare (const char *str1, const char *str2)
+{
+       return _mesa_strcmp (str1, str2);
+}
+
+char *slang_string_copy (char *dst, const char *src)
+{
+       return _mesa_strcpy (dst, src);
+}
+
+char *slang_string_concat (char *dst, const char *src)
+{
+       return _mesa_strcpy (dst + _mesa_strlen (dst), src);
+}
+
+char *slang_string_duplicate (const char *src)
+{
+       return _mesa_strdup (src);
+}
+
+unsigned int slang_string_length (const char *str)
+{
+       return _mesa_strlen (str);
+}
+
+static void slang_variable_construct (slang_variable *);
+static int slang_variable_copy (slang_variable *, const slang_variable *);
+static void slang_struct_construct (slang_struct *);
+static void slang_struct_destruct (slang_struct *);
+static int slang_struct_copy (slang_struct *, const slang_struct *);
+static int slang_struct_equal (const slang_struct *, const slang_struct *);
+static void slang_variable_destruct (slang_variable *);
+
+/* slang_type_specifier */
+
+static void slang_type_specifier_construct (slang_type_specifier *spec)
+{
+       spec->type = slang_spec_void;
+       spec->_struct = NULL;
+       spec->_array = NULL;
+}
+
+static void slang_type_specifier_destruct (slang_type_specifier *spec)
+{
+       if (spec->_struct != NULL)
+       {
+               slang_struct_destruct (spec->_struct);
+               slang_alloc_free (spec->_struct);
+       }
+       if (spec->_array != NULL)
+       {
+               slang_type_specifier_destruct (spec->_array);
+               slang_alloc_free (spec->_array);
+       }
+}
+
+static int slang_type_specifier_copy (slang_type_specifier *x, const slang_type_specifier *y)
+{
+       slang_type_specifier_destruct (x);
+       slang_type_specifier_construct (x);
+       x->type = y->type;
+       if (x->type == slang_spec_struct)
+       {
+               x->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
+               slang_struct_construct (x->_struct);
+               return slang_struct_copy (x->_struct, y->_struct);
+       }
+       if (x->type == slang_spec_array)
+       {
+               x->_array = (slang_type_specifier *) slang_alloc_malloc (sizeof (slang_type_specifier));
+               slang_type_specifier_construct (x->_array);
+               return slang_type_specifier_copy (x->_array, y->_array);
+       }
+       return 1;
+}
+
+static int slang_type_specifier_equal (const slang_type_specifier *x, const slang_type_specifier *y)
+{
+       if (x->type != y->type)
+               return 0;
+       if (x->type == slang_spec_struct)
+               return slang_struct_equal (x->_struct, y->_struct);
+       if (x->type == slang_spec_array)
+               return slang_type_specifier_equal (x->_array, y->_array);
+       return 1;
+}
+
+/* slang_fully_specified_type */
+
+static void slang_fully_specified_type_construct (slang_fully_specified_type *type)
+{
+       type->qualifier = slang_qual_none;
+       slang_type_specifier_construct (&type->specifier);
+}
+
+static void slang_fully_specified_type_destruct (slang_fully_specified_type *type)
+{
+       slang_type_specifier_destruct (&type->specifier);
+}
+
+static int slang_fully_specified_type_copy (slang_fully_specified_type *x,
+       const slang_fully_specified_type *y)
+{
+       slang_fully_specified_type_construct (x);
+       slang_fully_specified_type_destruct (x);
+       x->qualifier = y->qualifier;
+       return slang_type_specifier_copy (&x->specifier, &y->specifier);
+}
+
+/* slang_variable_scope */
+
+static void slang_variable_scope_construct (slang_variable_scope *scope)
+{
+       scope->variables = NULL;
+       scope->num_variables = 0;
+       scope->outer_scope = NULL;
+}
+
+static void slang_variable_scope_destruct (slang_variable_scope *scope)
+{
+       unsigned int i;
+       for (i = 0; i < scope->num_variables; i++)
+               slang_variable_destruct (scope->variables + i);
+       slang_alloc_free (scope->variables);
+}
+
+static int slang_variable_scope_copy (slang_variable_scope *x, const slang_variable_scope *y)
+{
+       unsigned int i;
+       slang_variable_scope_destruct (x);
+       slang_variable_scope_construct (x);
+       x->variables = (slang_variable *) slang_alloc_malloc (y->num_variables * sizeof (
+               slang_variable));
+       if (x->variables == NULL)
+               return 0;
+       x->num_variables = y->num_variables;
+       for (i = 0; i < x->num_variables; i++)
+               slang_variable_construct (x->variables + i);
+       for (i = 0; i < x->num_variables; i++)
+               if (!slang_variable_copy (x->variables + i, y->variables + i))
+                       return 0;
+       x->outer_scope = y->outer_scope;
+       return 1;
+}
+
+/* slang_operation */
+/* XXX mem! */
+static void slang_operation_construct (slang_operation *oper)
+{
+       oper->type = slang_oper_none;
+       oper->children = NULL;
+       oper->num_children = 0;
+       oper->literal = (float) 0;
+       oper->identifier = NULL;
+       oper->locals = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
+       slang_variable_scope_construct (oper->locals);
+}
+
+static void slang_operation_destruct (slang_operation *oper)
+{
+       unsigned int i;
+       for (i = 0; i < oper->num_children; i++)
+               slang_operation_destruct (oper->children + i);
+       slang_alloc_free (oper->children);
+       slang_alloc_free (oper->identifier);
+       slang_variable_scope_destruct (oper->locals);
+       slang_alloc_free (oper->locals);
+}
+
+static int slang_operation_copy (slang_operation *x, const slang_operation *y)
+{
+       unsigned int i;
+       slang_operation_destruct (x);
+       slang_operation_construct (x);
+       x->type = y->type;
+       x->children = (slang_operation *) slang_alloc_malloc (y->num_children * sizeof (
+               slang_operation));
+       if (x->children == NULL)
+               return 0;
+       x->num_children = y->num_children;
+       for (i = 0; i < x->num_children; i++)
+               slang_operation_construct (x->children + i);
+       for (i = 0; i < x->num_children; i++)
+               if (!slang_operation_copy (x->children + i, y->children + i))
+                       return 0;
+       x->literal = y->literal;
+       if (y->identifier != NULL)
+       {
+               x->identifier = slang_string_duplicate (y->identifier);
+               if (x->identifier == NULL)
+                       return 0;
+       }
+       if (!slang_variable_scope_copy (x->locals, y->locals))
+               return 0;
+       return 1;
+}
+
+/* slang_variable */
+
+static void slang_variable_construct (slang_variable *var)
+{
+       slang_fully_specified_type_construct (&var->type);
+       var->name = NULL;
+       var->array_size = NULL;
+       var->initializer = NULL;
+}
+
+static void slang_variable_destruct (slang_variable *var)
+{
+       slang_fully_specified_type_destruct (&var->type);
+       slang_alloc_free (var->name);
+       if (var->array_size != NULL)
+       {
+               slang_operation_destruct (var->array_size);
+               slang_alloc_free (var->array_size);
+       }
+       if (var->initializer != NULL)
+       {
+               slang_operation_destruct (var->initializer);
+               slang_alloc_free (var->initializer);
+       }
+}
+
+static int slang_variable_copy (slang_variable *x, const slang_variable *y)
+{
+       slang_variable_destruct (x);
+       slang_variable_construct (x);
+       if (!slang_fully_specified_type_copy (&x->type, &y->type))
+               return 0;
+       if (y->name != NULL)
+       {
+               x->name = slang_string_duplicate (y->name);
+               if (x->name == NULL)
+                       return 0;
+       }
+       if (y->array_size != NULL)
+       {
+               x->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
+               if (x->array_size == NULL)
+                       return 0;
+               slang_operation_construct (x->array_size);
+               if (!slang_operation_copy (x->array_size, y->array_size))
+                       return 0;
+       }
+       if (y->initializer != NULL)
+       {
+               x->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
+               if (x->initializer == NULL)
+                       return 0;
+               slang_operation_construct (x->initializer);
+               if (!slang_operation_copy (x->initializer, y->initializer))
+                       return 0;
+       }
+       return 1;
+}
+
+/* slang_struct_scope */
+
+static void slang_struct_scope_construct (slang_struct_scope *scope)
+{
+       scope->structs = NULL;
+       scope->num_structs = 0;
+       scope->outer_scope = NULL;
+}
+
+static void slang_struct_scope_destruct (slang_struct_scope *scope)
+{
+       unsigned int i;
+       for (i = 0; i < scope->num_structs; i++)
+               slang_struct_destruct (scope->structs + i);
+       slang_alloc_free (scope->structs);
+}
+
+static int slang_struct_scope_copy (slang_struct_scope *x, const slang_struct_scope *y)
+{
+       unsigned int i;
+       slang_struct_scope_destruct (x);
+       slang_struct_scope_construct (x);
+       x->structs = (slang_struct *) slang_alloc_malloc (y->num_structs * sizeof (slang_struct));
+       if (x->structs == NULL)
+               return 0;
+       x->num_structs = y->num_structs;
+       for (i = 0; i < x->num_structs; i++)
+               slang_struct_construct (x->structs + i);
+       for (i = 0; i < x->num_structs; i++)
+               if (!slang_struct_copy (x->structs + i, y->structs + i))
+                       return 0;
+       x->outer_scope = y->outer_scope;
+       return 1;
+}
+
+static slang_struct *slang_struct_scope_find (slang_struct_scope *stru, const char *name,
+       int all_scopes)
+{
+       unsigned int i;
+       for (i = 0; i < stru->num_structs; i++)
+               if (slang_string_compare (name, stru->structs[i].name) == 0)
+                       return stru->structs + i;
+       if (all_scopes && stru->outer_scope != NULL)
+               return slang_struct_scope_find (stru->outer_scope, name, 1);
+       return NULL;
+}
+
+/* slang_struct */
+/* XXX mem! */
+static void slang_struct_construct (slang_struct *stru)
+{
+       stru->name = NULL;
+       stru->fields = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
+       slang_variable_scope_construct (stru->fields);
+       stru->structs = (slang_struct_scope *) slang_alloc_malloc (sizeof (slang_struct_scope));
+       slang_struct_scope_construct (stru->structs);
+}
+
+static void slang_struct_destruct (slang_struct *stru)
+{
+       slang_alloc_free (stru->name);
+       slang_variable_scope_destruct (stru->fields);
+       slang_alloc_free (stru->fields);
+       slang_struct_scope_destruct (stru->structs);
+       slang_alloc_free (stru->structs);
+}
+
+static int slang_struct_copy (slang_struct *x, const slang_struct *y)
+{
+       slang_struct_destruct (x);
+       slang_struct_construct (x);
+       if (y->name != NULL)
+       {
+               x->name = slang_string_duplicate (y->name);
+               if (x->name == NULL)
+                       return 0;
+       }
+       if (!slang_variable_scope_copy (x->fields, y->fields))
+               return 0;
+       if (!slang_struct_scope_copy (x->structs, y->structs))
+               return 0;
+       return 1;
+}
+
+static int slang_struct_equal (const slang_struct *x, const slang_struct *y)
+{
+       unsigned int i;
+       if (x->fields->num_variables != y->fields->num_variables)
+               return 0;
+       for (i = 0; i < x->fields->num_variables; i++)
+       {
+               slang_variable *varx = x->fields->variables + i;
+               slang_variable *vary = y->fields->variables + i;
+               if (slang_string_compare (varx->name, vary->name) != 0)
+                       return 0;
+               if (!slang_type_specifier_equal (&varx->type.specifier, &vary->type.specifier))
+                       return 0;
+               if (varx->type.specifier.type == slang_spec_array)
+               {
+                       /* TODO compare array sizes */
+               }
+       }
+       return 1;
+}
+
+/* slang_function */
+/* XXX mem! */
+static void slang_function_construct (slang_function *func)
+{
+       func->kind = slang_func_ordinary;
+       slang_variable_construct (&func->header);
+       func->parameters = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
+       slang_variable_scope_construct (func->parameters);
+       func->body = NULL;
+}
+
+static void slang_function_destruct (slang_function *func)
+{
+       slang_variable_destruct (&func->header);
+       slang_variable_scope_destruct (func->parameters);
+       slang_alloc_free (func->parameters);
+       if (func->body != NULL)
+       {
+               slang_operation_destruct (func->body);
+               slang_alloc_free (func->body);
+       }
+}
+
+/* slang_function_scope */
+
+static void slang_function_scope_construct (slang_function_scope *scope)
+{
+       scope->functions = NULL;
+       scope->num_functions = 0;
+       scope->outer_scope = NULL;
+}
+
+static void slang_function_scope_destruct (slang_function_scope *scope)
+{
+       unsigned int i;
+       for (i = 0; i < scope->num_functions; i++)
+               slang_function_destruct (scope->functions + i);
+       slang_alloc_free (scope->functions);
+}
+
+static slang_function *slang_function_scope_find (slang_function_scope *funcs, slang_function *fun,
+       int all_scopes)
+{
+       unsigned int i;
+       for (i = 0; i < funcs->num_functions; i++)
+       {
+               slang_function *f = funcs->functions + i;
+               unsigned int j;
+               if (slang_string_compare (fun->header.name, f->header.name) != 0)
+                       continue;
+               if (fun->param_count != f->param_count)
+                       continue;
+               for (j = 0; j < fun->param_count; j++)
+               {
+                       if (!slang_type_specifier_equal (&fun->parameters->variables[j].type.specifier,
+                               &f->parameters->variables[j].type.specifier))
+                       {
+                               break;
+                       }
+               }
+               if (j == fun->param_count)
+                       return f;
+       }
+       if (all_scopes && funcs->outer_scope != NULL)
+               return slang_function_scope_find (funcs->outer_scope, fun, 1);
+       return NULL;
+}
+
+/* slang_translation_unit */
+/* XXX mem! */
+static void slang_translation_unit_construct (slang_translation_unit *unit)
+{
+       unit->globals = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
+       slang_variable_scope_construct (unit->globals);
+       slang_function_scope_construct (&unit->functions);
+       unit->structs = (slang_struct_scope *) slang_alloc_malloc (sizeof (slang_struct_scope));
+       slang_struct_scope_construct (unit->structs);
+}
+
+static void slang_translation_unit_destruct (slang_translation_unit *unit)
+{
+       slang_variable_scope_destruct (unit->globals);
+       slang_alloc_free (unit->globals);
+       slang_function_scope_destruct (&unit->functions);
+       slang_struct_scope_destruct (unit->structs);
+       slang_alloc_free (unit->structs);
+}
+
+/* slang_info_log */
+
+static char *out_of_memory = "error: out of memory\n";
+
+void slang_info_log_construct (slang_info_log *log)
+{
+       log->text = NULL;
+       log->dont_free_text = 0;
+}
+
+void slang_info_log_destruct (slang_info_log *log)
+{
+       if (!log->dont_free_text)
+               slang_alloc_free (log->text);
+}
+
+static int slang_info_log_message (slang_info_log *log, const char *prefix, const char *msg)
+{
+       unsigned int new_size;
+       if (log->dont_free_text)
+               return 0;
+       new_size = slang_string_length (prefix) + 3 + slang_string_length (msg);
+       if (log->text != NULL)
+       {
+               log->text = (char *) slang_alloc_realloc (log->text, slang_string_length (log->text) + 1,
+                       new_size + slang_string_length (log->text) + 1);
+       }
+       else
+       {
+               log->text = (char *) slang_alloc_malloc (new_size + 1);
+               if (log->text != NULL)
+                       *log->text = '\0';
+       }
+       if (log->text == NULL)
+               return 0;
+       slang_string_concat (log->text, prefix);
+       slang_string_concat (log->text, ": ");
+       slang_string_concat (log->text, msg);
+       slang_string_concat (log->text, "\n");
+       return 1;
+}
+
+int slang_info_log_error (slang_info_log *log, const char *msg, ...)
+{
+       if (slang_info_log_message (log, "error", msg))
+               return 1;
+       slang_info_log_memory (log);
+       return 0;
+}
+
+int slang_info_log_warning (slang_info_log *log, const char *msg, ...)
+{
+       if (slang_info_log_message (log, "warning", msg))
+               return 1;
+       slang_info_log_memory (log);
+       return 0;
+}
+
+void slang_info_log_memory (slang_info_log *log)
+{
+       if (!slang_info_log_message (log, "error", "out of memory"))
+       {
+               log->dont_free_text = 1;
+               log->text = out_of_memory;
+       }
+}
+
+/* slang_parse_ctx */
+
+typedef struct slang_parse_ctx_
+{
+       const byte *I;
+       slang_info_log *L;
+} slang_parse_ctx;
+
+/* --- */
+
+static int parse_identifier (slang_parse_ctx *C, char **id)
+{
+       *id = slang_string_duplicate ((const char *) C->I);
+       if (*id == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       C->I += strlen ((const char *) C->I) + 1;
+       return 1;
+}
+
+static int parse_number (slang_parse_ctx *C, int *number)
+{
+       const int radix = (int) (*C->I++);
+       *number = 0;
+       while (*C->I != '\0')
+       {
+               int digit;
+               if (*C->I >= '0' && *C->I <= '9')
+                       digit = (int) (*C->I - '0');
+               else if (*C->I >= 'A' && *C->I <= 'Z')
+                       digit = (int) (*C->I - 'A') + 10;
+               else
+                       digit = (int) (*C->I - 'a') + 10;
+               *number = *number * radix + digit;
+               C->I++;
+       }
+       C->I++;
+       if (*number > 65535)
+               slang_info_log_warning (C->L, "%d: literal integer overflow", *number);
+       return 1;
+}
+
+static int parse_float (slang_parse_ctx *C, float *number)
+{
+       char *integral = NULL;
+       char *fractional = NULL;
+       char *exponent = NULL;
+       char *whole = NULL;
+
+       if (!parse_identifier (C, &integral))
+               return 0;
+
+       if (!parse_identifier (C, &fractional))
+       {
+               slang_alloc_free (integral);
+               return 0;
+       }
+
+       if (!parse_identifier (C, &exponent))
+       {
+               slang_alloc_free (fractional);
+               slang_alloc_free (integral);
+               return 0;
+       }
+
+       whole = (char *) (slang_alloc_malloc ((strlen (integral) + strlen (fractional) + strlen (
+               exponent) + 3) * sizeof (char)));
+       if (whole == NULL)
+       {
+               slang_alloc_free (exponent);
+               slang_alloc_free (fractional);
+               slang_alloc_free (integral);
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+
+       slang_string_copy (whole, integral);
+       slang_string_concat (whole, ".");
+       slang_string_concat (whole, fractional);
+       slang_string_concat (whole, "E");
+       slang_string_concat (whole, exponent);
+
+       *number = (float) (atof (whole));
+
+       slang_alloc_free (whole);
+       slang_alloc_free (exponent);
+       slang_alloc_free (fractional);
+       slang_alloc_free (integral);
+       return 1;
+}
+
+/* revision number - increment after each change affecting emitted output */
+#define REVISION 2
+
+static int check_revision (slang_parse_ctx *C)
+{
+       if (*C->I != REVISION)
+       {
+               slang_info_log_error (C->L, "internal compiler error");
+               return 0;
+       }
+       C->I++;
+       return 1;
+}
+
+static int parse_statement (slang_parse_ctx *, slang_operation *, slang_variable_scope *,
+       slang_struct_scope *);
+static int parse_expression (slang_parse_ctx *, slang_operation *, slang_variable_scope *,
+       slang_struct_scope *);
+
+/* type qualifier */
+#define TYPE_QUALIFIER_NONE 0
+#define TYPE_QUALIFIER_CONST 1
+#define TYPE_QUALIFIER_ATTRIBUTE 2
+#define TYPE_QUALIFIER_VARYING 3
+#define TYPE_QUALIFIER_UNIFORM 4
+#define TYPE_QUALIFIER_FIXEDOUTPUT 5
+#define TYPE_QUALIFIER_FIXEDINPUT 6
+
+static int parse_type_qualifier (slang_parse_ctx *C, slang_type_qualifier *qual)
+{
+       switch (*C->I++)
+       {
+       case TYPE_QUALIFIER_NONE:
+               *qual = slang_qual_none;
+               break;
+       case TYPE_QUALIFIER_CONST:
+               *qual = slang_qual_const;
+               break;
+       case TYPE_QUALIFIER_ATTRIBUTE:
+               *qual = slang_qual_attribute;
+               break;
+       case TYPE_QUALIFIER_VARYING:
+               *qual = slang_qual_varying;
+               break;
+       case TYPE_QUALIFIER_UNIFORM:
+               *qual = slang_qual_uniform;
+               break;
+       case TYPE_QUALIFIER_FIXEDOUTPUT:
+               *qual = slang_qual_fixedoutput;
+               break;
+       case TYPE_QUALIFIER_FIXEDINPUT:
+               *qual = slang_qual_fixedinput;
+               break;
+       default:
+               return 0;
+       }
+       return 1;
+}
+
+/* type specifier */
+#define TYPE_SPECIFIER_VOID 0
+#define TYPE_SPECIFIER_BOOL 1
+#define TYPE_SPECIFIER_BVEC2 2
+#define TYPE_SPECIFIER_BVEC3 3
+#define TYPE_SPECIFIER_BVEC4 4
+#define TYPE_SPECIFIER_INT 5
+#define TYPE_SPECIFIER_IVEC2 6
+#define TYPE_SPECIFIER_IVEC3 7
+#define TYPE_SPECIFIER_IVEC4 8
+#define TYPE_SPECIFIER_FLOAT 9
+#define TYPE_SPECIFIER_VEC2 10
+#define TYPE_SPECIFIER_VEC3 11
+#define TYPE_SPECIFIER_VEC4 12
+#define TYPE_SPECIFIER_MAT2 13
+#define TYPE_SPECIFIER_MAT3 14
+#define TYPE_SPECIFIER_MAT4 15
+#define TYPE_SPECIFIER_SAMPLER1D 16
+#define TYPE_SPECIFIER_SAMPLER2D 17
+#define TYPE_SPECIFIER_SAMPLER3D 18
+#define TYPE_SPECIFIER_SAMPLERCUBE 19
+#define TYPE_SPECIFIER_SAMPLER1DSHADOW 20
+#define TYPE_SPECIFIER_SAMPLER2DSHADOW 21
+#define TYPE_SPECIFIER_STRUCT 22
+#define TYPE_SPECIFIER_TYPENAME 23
+
+/* structure field */
+#define FIELD_NONE 0
+#define FIELD_NEXT 1
+#define FIELD_ARRAY 2
+
+static int parse_type_specifier (slang_parse_ctx *C, slang_type_specifier *spec,
+       slang_struct_scope *structs, slang_variable_scope *scope)
+{
+       switch (*C->I++)
+       {
+       case TYPE_SPECIFIER_VOID:
+               spec->type = slang_spec_void;
+               break;
+       case TYPE_SPECIFIER_BOOL:
+               spec->type = slang_spec_bool;
+               break;
+       case TYPE_SPECIFIER_BVEC2:
+               spec->type = slang_spec_bvec2;
+               break;
+       case TYPE_SPECIFIER_BVEC3:
+               spec->type = slang_spec_bvec3;
+               break;
+       case TYPE_SPECIFIER_BVEC4:
+               spec->type = slang_spec_bvec4;
+               break;
+       case TYPE_SPECIFIER_INT:
+               spec->type = slang_spec_int;
+               break;
+       case TYPE_SPECIFIER_IVEC2:
+               spec->type = slang_spec_ivec2;
+               break;
+       case TYPE_SPECIFIER_IVEC3:
+               spec->type = slang_spec_ivec3;
+               break;
+       case TYPE_SPECIFIER_IVEC4:
+               spec->type = slang_spec_ivec4;
+               break;
+       case TYPE_SPECIFIER_FLOAT:
+               spec->type = slang_spec_float;
+               break;
+       case TYPE_SPECIFIER_VEC2:
+               spec->type = slang_spec_vec2;
+               break;
+       case TYPE_SPECIFIER_VEC3:
+               spec->type = slang_spec_vec3;
+               break;
+       case TYPE_SPECIFIER_VEC4:
+               spec->type = slang_spec_vec4;
+               break;
+       case TYPE_SPECIFIER_MAT2:
+               spec->type = slang_spec_mat2;
+               break;
+       case TYPE_SPECIFIER_MAT3:
+               spec->type = slang_spec_mat3;
+               break;
+       case TYPE_SPECIFIER_MAT4:
+               spec->type = slang_spec_mat4;
+               break;
+       case TYPE_SPECIFIER_SAMPLER1D:
+               spec->type = slang_spec_sampler1D;
+               break;
+       case TYPE_SPECIFIER_SAMPLER2D:
+               spec->type = slang_spec_sampler2D;
+               break;
+       case TYPE_SPECIFIER_SAMPLER3D:
+               spec->type = slang_spec_sampler3D;
+               break;
+       case TYPE_SPECIFIER_SAMPLERCUBE:
+               spec->type = slang_spec_samplerCube;
+               break;
+       case TYPE_SPECIFIER_SAMPLER1DSHADOW:
+               spec->type = slang_spec_sampler1DShadow;
+               break;
+       case TYPE_SPECIFIER_SAMPLER2DSHADOW:
+               spec->type = slang_spec_sampler2DShadow;
+               break;
+       case TYPE_SPECIFIER_STRUCT:
+               spec->type = slang_spec_struct;
+               {
+                       char *name;
+                       if (!parse_identifier (C, &name))
+                               return 0;
+                       if (*name != '\0' && slang_struct_scope_find (structs, name, 0) != NULL)
+                       {
+                               slang_info_log_error (C->L, "%s: duplicate type name", name);
+                               slang_alloc_free (name);
+                               return 0;
+                       }
+                       spec->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
+                       if (spec->_struct == NULL)
+                       {
+                               slang_alloc_free (name);
+                               slang_info_log_memory (C->L);
+                               return 0;
+                       }
+                       slang_struct_construct (spec->_struct);
+                       spec->_struct->name = name;
+                       spec->_struct->structs->outer_scope = structs;
+               }
+               do
+               {
+                       slang_type_specifier sp;
+                       slang_type_specifier_construct (&sp);
+                       if (!parse_type_specifier (C, &sp, spec->_struct->structs, scope))
+                       {
+                               slang_type_specifier_destruct (&sp);
+                               return 0;
+                       }
+                       do
+                       {
+                               slang_variable *var;
+                               spec->_struct->fields->variables = (slang_variable *) slang_alloc_realloc (
+                                       spec->_struct->fields->variables,
+                                       spec->_struct->fields->num_variables * sizeof (slang_variable),
+                                       (spec->_struct->fields->num_variables + 1) * sizeof (slang_variable));
+                               if (spec->_struct->fields->variables == NULL)
+                               {
+                                       slang_type_specifier_destruct (&sp);
+                                       slang_info_log_memory (C->L);
+                                       return 0;
+                               }
+                               var = spec->_struct->fields->variables + spec->_struct->fields->num_variables;
+                               spec->_struct->fields->num_variables++;
+                               slang_variable_construct (var);
+                               if (!slang_type_specifier_copy (&var->type.specifier, &sp))
+                               {
+                                       slang_type_specifier_destruct (&sp);
+                                       return 0;
+                               }
+                               if (!parse_identifier (C, &var->name))
+                               {
+                                       slang_type_specifier_destruct (&sp);
+                                       return 0;
+                               }
+                               switch (*C->I++)
+                               {
+                               case FIELD_NONE:
+                                       break;
+                               case FIELD_ARRAY:
+                                       var->array_size = (slang_operation *) slang_alloc_malloc (sizeof (
+                                               slang_operation));
+                                       if (var->array_size == NULL)
+                                       {
+                                               slang_type_specifier_destruct (&sp);
+                                               slang_info_log_memory (C->L);
+                                               return 0;
+                                       }
+                                       slang_operation_construct (var->array_size);
+                                       if (!parse_expression (C, var->array_size, scope, structs))
+                                       {
+                                               slang_type_specifier_destruct (&sp);
+                                               return 0;
+                                       }
+                                       break;
+                               default:
+                                       return 0;
+                               }
+                       }
+                       while (*C->I++ != FIELD_NONE);
+               }
+               while (*C->I++ != FIELD_NONE);
+               if (*spec->_struct->name != '\0')
+               {
+                       slang_struct *s;
+                       structs->structs = (slang_struct *) slang_alloc_realloc (structs->structs,
+                               structs->num_structs * sizeof (slang_struct),
+                               (structs->num_structs + 1) * sizeof (slang_struct));
+                       if (structs->structs == NULL)
+                       {
+                               slang_info_log_memory (C->L);
+                               return 0;
+                       }
+                       s = structs->structs + structs->num_structs;
+                       structs->num_structs++;
+                       slang_struct_construct (s);
+                       if (!slang_struct_copy (s, spec->_struct))
+                               return 0;
+               }
+               break;
+       case TYPE_SPECIFIER_TYPENAME:
+               spec->type = slang_spec_struct;
+               {
+                       char *name;
+                       slang_struct *stru;
+                       if (!parse_identifier (C, &name))
+                               return 0;
+                       stru = slang_struct_scope_find (structs, name, 1);
+                       if (stru == NULL)
+                       {
+                               slang_info_log_error (C->L, "%s: undeclared type name", name);
+                               slang_alloc_free (name);
+                               return 0;
+                       }
+                       slang_alloc_free (name);
+                       spec->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
+                       if (spec->_struct == NULL)
+                       {
+                               slang_info_log_memory (C->L);
+                               return 0;
+                       }
+                       slang_struct_construct (spec->_struct);
+                       if (!slang_struct_copy (spec->_struct, stru))
+                               return 0;
+               }
+               break;
+       default:
+               return 0;
+       }
+       return 1;
+}
+
+static int parse_fully_specified_type (slang_parse_ctx *C, slang_fully_specified_type *type,
+       slang_struct_scope *structs, slang_variable_scope *scope)
+{
+       if (!parse_type_qualifier (C, &type->qualifier))
+               return 0;
+       return parse_type_specifier (C, &type->specifier, structs, scope);
+}
+
+/* operation */
+#define OP_END 0
+#define OP_BLOCK_BEGIN_NO_NEW_SCOPE 1
+#define OP_BLOCK_BEGIN_NEW_SCOPE 2
+#define OP_DECLARE 3
+#define OP_ASM 4
+#define OP_BREAK 5
+#define OP_CONTINUE 6
+#define OP_DISCARD 7
+#define OP_RETURN 8
+#define OP_EXPRESSION 9
+#define OP_IF 10
+#define OP_WHILE 11
+#define OP_DO 12
+#define OP_FOR 13
+#define OP_PUSH_VOID 14
+#define OP_PUSH_BOOL 15
+#define OP_PUSH_INT 16
+#define OP_PUSH_FLOAT 17
+#define OP_PUSH_IDENTIFIER 18
+#define OP_SEQUENCE 19
+#define OP_ASSIGN 20
+#define OP_ADDASSIGN 21
+#define OP_SUBASSIGN 22
+#define OP_MULASSIGN 23
+#define OP_DIVASSIGN 24
+/*#define OP_MODASSIGN 25*/
+/*#define OP_LSHASSIGN 26*/
+/*#define OP_RSHASSIGN 27*/
+/*#define OP_ORASSIGN 28*/
+/*#define OP_XORASSIGN 29*/
+/*#define OP_ANDASSIGN 30*/
+#define OP_SELECT 31
+#define OP_LOGICALOR 32
+#define OP_LOGICALXOR 33
+#define OP_LOGICALAND 34
+/*#define OP_BITOR 35*/
+/*#define OP_BITXOR 36*/
+/*#define OP_BITAND 37*/
+#define OP_EQUAL 38
+#define OP_NOTEQUAL 39
+#define OP_LESS 40
+#define OP_GREATER 41
+#define OP_LESSEQUAL 42
+#define OP_GREATEREQUAL 43
+/*#define OP_LSHIFT 44*/
+/*#define OP_RSHIFT 45*/
+#define OP_ADD 46
+#define OP_SUBTRACT 47
+#define OP_MULTIPLY 48
+#define OP_DIVIDE 49
+/*#define OP_MODULUS 50*/
+#define OP_PREINCREMENT 51
+#define OP_PREDECREMENT 52
+#define OP_PLUS 53
+#define OP_MINUS 54
+/*#define OP_COMPLEMENT 55*/
+#define OP_NOT 56
+#define OP_SUBSCRIPT 57
+#define OP_CALL 58
+#define OP_FIELD 59
+#define OP_POSTINCREMENT 60
+#define OP_POSTDECREMENT 61
+
+static int parse_child_operation (slang_parse_ctx *C, slang_operation *oper, int statement,
+       slang_variable_scope *scope, slang_struct_scope *structs)
+{
+       oper->children = (slang_operation *) slang_alloc_realloc (oper->children,
+               oper->num_children * sizeof (slang_operation),
+               (oper->num_children + 1) * sizeof (slang_operation));
+       if (oper->children == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       slang_operation_construct (oper->children + oper->num_children);
+       oper->num_children++;
+       if (statement)
+               return parse_statement (C, oper->children + oper->num_children - 1, scope, structs);
+       return parse_expression (C, oper->children + oper->num_children - 1, scope, structs);
+}
+
+static int parse_declaration (slang_parse_ctx *C, slang_variable_scope *, slang_struct_scope *,
+       slang_function_scope *);
+
+static int parse_statement (slang_parse_ctx *C, slang_operation *oper, slang_variable_scope *scope,
+       slang_struct_scope *structs)
+{
+       oper->locals->outer_scope = scope;
+       switch (*C->I++)
+       {
+       case OP_BLOCK_BEGIN_NO_NEW_SCOPE:
+               oper->type = slang_oper_block_no_new_scope;
+               while (*C->I != OP_END)
+                       if (!parse_child_operation (C, oper, 1, scope, structs))
+                               return 0;
+               C->I++;
+               break;
+       case OP_BLOCK_BEGIN_NEW_SCOPE:
+               oper->type = slang_oper_block_new_scope;
+               while (*C->I != OP_END)
+                       if (!parse_child_operation (C, oper, 1, oper->locals, structs))
+                               return 0;
+               C->I++;
+               break;
+       case OP_DECLARE:
+               oper->type = slang_oper_variable_decl;
+               {
+                       const unsigned int first_var = scope->num_variables;
+                       if (!parse_declaration (C, scope, structs, NULL))
+                               return 0;
+                       if (first_var < scope->num_variables)
+                       {
+                               const unsigned int num_vars = scope->num_variables - first_var;
+                               unsigned int i;
+                               oper->children = (slang_operation *) slang_alloc_malloc (num_vars * sizeof (
+                                       slang_operation));
+                               if (oper->children == NULL)
+                               {
+                                       slang_info_log_memory (C->L);
+                                       return 0;
+                               }
+                               for (i = 0; i < num_vars; i++)
+                                       slang_operation_construct (oper->children + i);
+                               oper->num_children = num_vars;
+                               for (i = first_var; i < scope->num_variables; i++)
+                               {
+                                       slang_operation *o = oper->children + i - first_var;
+                                       o->type = slang_oper_identifier;
+                                       o->locals->outer_scope = scope;
+                                       o->identifier = slang_string_duplicate (scope->variables[i].name);
+                                       if (o->identifier == NULL)
+                                       {
+                                               slang_info_log_memory (C->L);
+                                               return 0;
+                                       }
+                               }
+                       }
+               }
+               break;
+       case OP_ASM:
+               oper->type = slang_oper_asm;
+               if (!parse_identifier (C, &oper->identifier))
+                       return 0;
+               while (*C->I != OP_END)
+                       if (!parse_child_operation (C, oper, 0, scope, structs))
+                               return 0;
+               C->I++;
+               break;
+       case OP_BREAK:
+               oper->type = slang_oper_break;
+               break;
+       case OP_CONTINUE:
+               oper->type = slang_oper_continue;
+               break;
+       case OP_DISCARD:
+               oper->type = slang_oper_discard;
+               break;
+       case OP_RETURN:
+               oper->type = slang_oper_return;
+               if (!parse_child_operation (C, oper, 0, scope, structs))
+                       return 0;
+               break;
+       case OP_EXPRESSION:
+               oper->type = slang_oper_expression;
+               if (!parse_child_operation (C, oper, 0, scope, structs))
+                       return 0;
+               break;
+       case OP_IF:
+               oper->type = slang_oper_if;
+               if (!parse_child_operation (C, oper, 0, scope, structs))
+                       return 0;
+               if (!parse_child_operation (C, oper, 1, scope, structs))
+                       return 0;
+               if (!parse_child_operation (C, oper, 1, scope, structs))
+                       return 0;
+               break;
+       case OP_WHILE:
+               oper->type = slang_oper_while;
+               if (!parse_child_operation (C, oper, 1, oper->locals, structs))
+                       return 0;
+               if (!parse_child_operation (C, oper, 1, oper->locals, structs))
+                       return 0;
+               break;
+       case OP_DO:
+               oper->type = slang_oper_do;
+               if (!parse_child_operation (C, oper, 1, scope, structs))
+                       return 0;
+               if (!parse_child_operation (C, oper, 0, scope, structs))
+                       return 0;
+               break;
+       case OP_FOR:
+               oper->type = slang_oper_for;
+               if (!parse_child_operation (C, oper, 1, oper->locals, structs))
+                       return 0;
+               if (!parse_child_operation (C, oper, 1, oper->locals, structs))
+                       return 0;
+               if (!parse_child_operation (C, oper, 0, oper->locals, structs))
+                       return 0;
+               if (!parse_child_operation (C, oper, 1, oper->locals, structs))
+                       return 0;
+               break;
+       default:
+               return 0;
+       }
+       return 1;
+}
+
+static int handle_trinary_expression (slang_parse_ctx *C, slang_operation *op,
+       slang_operation **ops, unsigned int *num_ops)
+{
+       op->num_children = 3;
+       op->children = (slang_operation *) slang_alloc_malloc (3 * sizeof (slang_operation));
+       if (op->children == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       op->children[0] = (*ops)[*num_ops - 4];
+       op->children[1] = (*ops)[*num_ops - 3];
+       op->children[2] = (*ops)[*num_ops - 2];
+       (*ops)[*num_ops - 4] = (*ops)[*num_ops - 1];
+       *num_ops -= 3;
+       *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 3) * sizeof (slang_operation),
+               *num_ops * sizeof (slang_operation));
+       if (*ops == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       return 1;
+}
+
+static int handle_binary_expression (slang_parse_ctx *C, slang_operation *op,
+       slang_operation **ops, unsigned int *num_ops)
+{
+       op->num_children = 2;
+       op->children = (slang_operation *) slang_alloc_malloc (2 * sizeof (slang_operation));
+       if (op->children == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       op->children[0] = (*ops)[*num_ops - 3];
+       op->children[1] = (*ops)[*num_ops - 2];
+       (*ops)[*num_ops - 3] = (*ops)[*num_ops - 1];
+       *num_ops -= 2;
+       *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 2) * sizeof (slang_operation),
+               *num_ops * sizeof (slang_operation));
+       if (*ops == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       return 1;
+}
+
+static int handle_unary_expression (slang_parse_ctx *C, slang_operation *op,
+       slang_operation **ops, unsigned int *num_ops)
+{
+       op->num_children = 1;
+       op->children = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
+       if (op->children == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       op->children[0] = (*ops)[*num_ops - 2];
+       (*ops)[*num_ops - 2] = (*ops)[*num_ops - 1];
+       (*num_ops)--;
+       *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 1) * sizeof (slang_operation),
+               *num_ops * sizeof (slang_operation));
+       if (*ops == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       return 1;
+}
+
+static int parse_expression (slang_parse_ctx *C, slang_operation *oper, slang_variable_scope *scope,
+       slang_struct_scope *structs)
+{
+       slang_operation *ops = NULL;
+       unsigned int num_ops = 0;
+       int number;
+
+       while (*C->I != OP_END)
+       {
+               slang_operation *op;
+               const unsigned int op_code = *C->I++;
+               ops = (slang_operation *) slang_alloc_realloc (ops,
+                       num_ops * sizeof (slang_operation), (num_ops + 1) * sizeof (slang_operation));
+               if (ops == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       return 0;
+               }
+               op = ops + num_ops;
+               num_ops++;
+               slang_operation_construct (op);
+               op->locals->outer_scope = scope;
+               switch (op_code)
+               {
+               case OP_PUSH_VOID:
+                       op->type = slang_oper_void;
+                       break;
+               case OP_PUSH_BOOL:
+                       op->type = slang_oper_literal_bool;
+                       if (!parse_number (C, &number))
+                               return 0;
+                       op->literal = (float) number;
+                       break;
+               case OP_PUSH_INT:
+                       op->type = slang_oper_literal_int;
+                       if (!parse_number (C, &number))
+                               return 0;
+                       op->literal = (float) number;
+                       break;
+               case OP_PUSH_FLOAT:
+                       op->type = slang_oper_literal_float;
+                       if (!parse_float (C, &op->literal))
+                               return 0;
+                       break;
+               case OP_PUSH_IDENTIFIER:
+                       op->type = slang_oper_identifier;
+                       if (!parse_identifier (C, &op->identifier))
+                               return 0;
+                       break;
+               case OP_SEQUENCE:
+                       op->type = slang_oper_sequence;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_ASSIGN:
+                       op->type = slang_oper_assign;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_ADDASSIGN:
+                       op->type = slang_oper_addassign;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_SUBASSIGN:
+                       op->type = slang_oper_subassign;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_MULASSIGN:
+                       op->type = slang_oper_mulassign;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_DIVASSIGN:
+                       op->type = slang_oper_divassign;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               /*case OP_MODASSIGN:*/
+               /*case OP_LSHASSIGN:*/
+               /*case OP_RSHASSIGN:*/
+               /*case OP_ORASSIGN:*/
+               /*case OP_XORASSIGN:*/
+               /*case OP_ANDASSIGN:*/
+               case OP_SELECT:
+                       op->type = slang_oper_select;
+                       if (!handle_trinary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_LOGICALOR:
+                       op->type = slang_oper_logicalor;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_LOGICALXOR:
+                       op->type = slang_oper_logicalxor;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_LOGICALAND:
+                       op->type = slang_oper_logicaland;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               /*case OP_BITOR:*/
+               /*case OP_BITXOR:*/
+               /*case OP_BITAND:*/
+               case OP_EQUAL:
+                       op->type = slang_oper_equal;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_NOTEQUAL:
+                       op->type = slang_oper_notequal;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_LESS:
+                       op->type = slang_oper_less;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_GREATER:
+                       op->type = slang_oper_greater;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_LESSEQUAL:
+                       op->type = slang_oper_lessequal;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_GREATEREQUAL:
+                       op->type = slang_oper_greaterequal;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               /*case OP_LSHIFT:*/
+               /*case OP_RSHIFT:*/
+               case OP_ADD:
+                       op->type = slang_oper_add;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_SUBTRACT:
+                       op->type = slang_oper_subtract;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_MULTIPLY:
+                       op->type = slang_oper_multiply;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_DIVIDE:
+                       op->type = slang_oper_divide;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               /*case OP_MODULUS:*/
+               case OP_PREINCREMENT:
+                       op->type = slang_oper_preincrement;
+                       if (!handle_unary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_PREDECREMENT:
+                       op->type = slang_oper_predecrement;
+                       if (!handle_unary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_PLUS:
+                       op->type = slang_oper_plus;
+                       if (!handle_unary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_MINUS:
+                       op->type = slang_oper_minus;
+                       if (!handle_unary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_NOT:
+                       op->type = slang_oper_not;
+                       if (!handle_unary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               /*case OP_COMPLEMENT:*/
+               case OP_SUBSCRIPT:
+                       op->type = slang_oper_subscript;
+                       if (!handle_binary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_CALL:
+                       op->type = slang_oper_call;
+                       if (!parse_identifier (C, &op->identifier))
+                               return 0;
+                       while (*C->I != OP_END)
+                               if (!parse_child_operation (C, op, 0, scope, structs))
+                                       return 0;
+                       C->I++;
+                       break;
+               case OP_FIELD:
+                       op->type = slang_oper_field;
+                       if (!parse_identifier (C, &op->identifier))
+                               return 0;
+                       if (!handle_unary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_POSTINCREMENT:
+                       op->type = slang_oper_postincrement;
+                       if (!handle_unary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               case OP_POSTDECREMENT:
+                       op->type = slang_oper_postdecrement;
+                       if (!handle_unary_expression (C, op, &ops, &num_ops))
+                               return 0;
+                       break;
+               default:
+                       return 0;
+               }
+       }
+       C->I++;
+       *oper = *ops;
+       slang_alloc_free (ops);
+       return 1;
+}
+
+/* parameter qualifier */
+#define PARAM_QUALIFIER_IN 0
+#define PARAM_QUALIFIER_OUT 1
+#define PARAM_QUALIFIER_INOUT 2
+
+/* function parameter array presence */
+#define PARAMETER_ARRAY_NOT_PRESENT 0
+#define PARAMETER_ARRAY_PRESENT 1
+
+static int parse_parameter_declaration (slang_parse_ctx *C, slang_variable *param,
+       slang_struct_scope *structs, slang_variable_scope *scope)
+{
+       if (!parse_type_qualifier (C, &param->type.qualifier))
+               return 0;
+       switch (*C->I++)
+       {
+       case PARAM_QUALIFIER_IN:
+               if (param->type.qualifier != slang_qual_const && param->type.qualifier != slang_qual_none)
+               {
+                       slang_info_log_error (C->L, "invalid type qualifier");
+                       return 0;
+               }
+               break;
+       case PARAM_QUALIFIER_OUT:
+               if (param->type.qualifier == slang_qual_none)
+                       param->type.qualifier = slang_qual_out;
+               else
+               {
+                       slang_info_log_error (C->L, "invalid type qualifier");
+                       return 0;
+               }
+               break;
+       case PARAM_QUALIFIER_INOUT:
+               if (param->type.qualifier == slang_qual_none)
+                       param->type.qualifier = slang_qual_inout;
+               else
+               {
+                       slang_info_log_error (C->L, "invalid type qualifier");
+                       return 0;
+               }
+               break;
+       default:
+               return 0;
+       }
+       if (!parse_type_specifier (C, &param->type.specifier, structs, scope))
+               return 0;
+       if (!parse_identifier (C, &param->name))
+               return 0;
+       if (*C->I++ == PARAMETER_ARRAY_PRESENT)
+       {
+               param->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
+               if (param->array_size == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       return 0;
+               }
+               slang_operation_construct (param->array_size);
+               if (!parse_expression (C, param->array_size, scope, structs))
+                       return 0;
+       }
+       return 1;
+}
+
+/* function type */
+#define FUNCTION_ORDINARY 0
+#define FUNCTION_CONSTRUCTOR 1
+#define FUNCTION_OPERATOR 2
+
+/* function parameter */
+#define PARAMETER_NONE 0
+#define PARAMETER_NEXT 1
+
+/* operator type */
+#define OPERATOR_ASSIGN 1
+#define OPERATOR_ADDASSIGN 2
+#define OPERATOR_SUBASSIGN 3
+#define OPERATOR_MULASSIGN 4
+#define OPERATOR_DIVASSIGN 5
+/*#define OPERATOR_MODASSIGN 6*/
+/*#define OPERATOR_LSHASSIGN 7*/
+/*#define OPERATOR_RSHASSIGN 8*/
+/*#define OPERATOR_ANDASSIGN 9*/
+/*#define OPERATOR_XORASSIGN 10*/
+/*#define OPERATOR_ORASSIGN 11*/
+#define OPERATOR_LOGICALXOR 12
+/*#define OPERATOR_BITOR 13*/
+/*#define OPERATOR_BITXOR 14*/
+/*#define OPERATOR_BITAND 15*/
+#define OPERATOR_EQUAL 16
+#define OPERATOR_NOTEQUAL 17
+#define OPERATOR_LESS 18
+#define OPERATOR_GREATER 19
+#define OPERATOR_LESSEQUAL 20
+#define OPERATOR_GREATEREQUAL 21
+/*#define OPERATOR_LSHIFT 22*/
+/*#define OPERATOR_RSHIFT 23*/
+#define OPERATOR_MULTIPLY 24
+#define OPERATOR_DIVIDE 25
+/*#define OPERATOR_MODULUS 26*/
+#define OPERATOR_INCREMENT 27
+#define OPERATOR_DECREMENT 28
+#define OPERATOR_PLUS 29
+#define OPERATOR_MINUS 30
+/*#define OPERATOR_COMPLEMENT 31*/
+#define OPERATOR_NOT 32
+
+/* these must match with slang_type_specifier_type enum */
+static const char *type_specifier_names[] = {
+       "void",
+       "bool",
+       "bvec2",
+       "bvec3",
+       "bvec4",
+       "int",
+       "ivec2",
+       "ivec3",
+       "ivec4",
+       "float",
+       "vec2",
+       "vec3",
+       "vec4",
+       "mat2",
+       "mat3",
+       "mat4",
+       "sampler1D",
+       "sampler2D",
+       "sampler3D",
+       "samplerCube",
+       "sampler1DShadow",
+       "sampler2DShadow"
+};
+
+static const struct {
+       unsigned int o_code;
+       const char *o_name;
+} operator_names[] = {
+       { OPERATOR_INCREMENT, "++" },
+       { OPERATOR_ADDASSIGN, "+=" },
+       { OPERATOR_PLUS, "+" },
+       { OPERATOR_DECREMENT, "--" },
+       { OPERATOR_SUBASSIGN, "-=" },
+       { OPERATOR_MINUS, "-" },
+       { OPERATOR_NOTEQUAL, "!=" },
+       { OPERATOR_NOT, "!" },
+       { OPERATOR_MULASSIGN, "*=" },
+       { OPERATOR_MULTIPLY, "*" },
+       { OPERATOR_DIVASSIGN, "/=" },
+       { OPERATOR_DIVIDE, "/" },
+       { OPERATOR_LESSEQUAL, "<=" },
+       /*{ OPERATOR_LSHASSIGN, "<<=" },*/
+       /*{ OPERATOR_LSHIFT, "<<" },*/
+       { OPERATOR_LESS, "<" },
+       { OPERATOR_GREATEREQUAL, ">=" },
+       /*{ OPERATOR_RSHASSIGN, ">>=" },*/
+       /*{ OPERATOR_RSHIFT, ">>" },*/
+       { OPERATOR_GREATER, ">" },
+       { OPERATOR_EQUAL, "==" },
+       { OPERATOR_ASSIGN, "=" },
+       /*{ OPERATOR_MODASSIGN, "%=" },*/
+       /*{ OPERATOR_MODULUS, "%" },*/
+       /*{ OPERATOR_ANDASSIGN, "&=" },*/
+       /*{ OPERATOR_BITAND, "&" },*/
+       /*{ OPERATOR_ORASSIGN, "|=" },*/
+       /*{ OPERATOR_BITOR, "|" },*/
+       /*{ OPERATOR_COMPLEMENT, "~" },*/
+       /*{ OPERATOR_XORASSIGN, "^=" },*/
+       { OPERATOR_LOGICALXOR, "^^" }/*,*/
+       /*{ OPERATOR_BITXOR, "^" }*/
+};
+
+static int parse_operator_name (slang_parse_ctx *C, char **pname)
+{
+       unsigned int i;
+       for (i = 0; i < sizeof (operator_names) / sizeof (*operator_names); i++)
+               if (operator_names[i].o_code == (unsigned int) (*C->I))
+               {
+                       *pname = slang_string_duplicate (operator_names[i].o_name);
+                       if (*pname == NULL)
+                       {
+                               slang_info_log_memory (C->L);
+                               return 0;
+                       }
+                       C->I++;
+                       return 1;
+               }
+       return 0;
+}
+
+static int parse_function_prototype (slang_parse_ctx *C, slang_function *func,
+       slang_struct_scope *structs, slang_variable_scope *scope)
+{
+       if (!parse_fully_specified_type (C, &func->header.type, structs, scope))
+               return 0;
+       switch (*C->I++)
+       {
+       case FUNCTION_ORDINARY:
+               func->kind = slang_func_ordinary;
+               if (!parse_identifier (C, &func->header.name))
+                       return 0;
+               break;
+       case FUNCTION_CONSTRUCTOR:
+               func->kind = slang_func_constructor;
+               if (func->header.type.specifier.type == slang_spec_struct)
+                       return 0;
+               func->header.name = slang_string_duplicate (
+                       type_specifier_names[func->header.type.specifier.type]);
+               if (func->header.name == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       return 0;
+               }
+               break;
+       case FUNCTION_OPERATOR:
+               func->kind = slang_func_operator;
+               if (!parse_operator_name (C, &func->header.name))
+                       return 0;
+               break;
+       default:
+               return 0;
+       }
+       func->parameters->outer_scope = scope;
+       while (*C->I++ == PARAMETER_NEXT)
+       {
+               func->parameters->variables = (slang_variable *) slang_alloc_realloc (
+                       func->parameters->variables,
+                       func->parameters->num_variables * sizeof (slang_variable),
+                       (func->parameters->num_variables + 1) * sizeof (slang_variable));
+               if (func->parameters->variables == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       return 0;
+               }
+               slang_variable_construct (func->parameters->variables + func->parameters->num_variables);
+               func->parameters->num_variables++;
+               if (!parse_parameter_declaration (C, func->parameters->variables +
+                       func->parameters->num_variables - 1, structs, scope))
+                       return 0;
+       }
+       func->param_count = func->parameters->num_variables;
+       return 1;
+}
+
+static int parse_function_definition (slang_parse_ctx *C, slang_function *func,
+       slang_struct_scope *structs, slang_variable_scope *scope)
+{
+       if (!parse_function_prototype (C, func, structs, scope))
+               return 0;
+       func->body = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
+       if (func->body == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       slang_operation_construct (func->body);
+       if (!parse_statement (C, func->body, func->parameters, structs))
+               return 0;
+       return 1;
+}
+
+/* init declarator list */
+#define DECLARATOR_NONE 0
+#define DECLARATOR_NEXT 1
+
+/* variable declaration */
+#define VARIABLE_NONE 0
+#define VARIABLE_IDENTIFIER 1
+#define VARIABLE_INITIALIZER 2
+#define VARIABLE_ARRAY_EXPLICIT 3
+#define VARIABLE_ARRAY_UNKNOWN 4
+
+static int parse_init_declarator (slang_parse_ctx *C, const slang_fully_specified_type *type,
+       slang_variable_scope *vars, slang_struct_scope *structs)
+{
+       slang_variable *var;
+
+       if (*C->I++ == VARIABLE_NONE)
+               return 1;
+       vars->variables = (slang_variable *) slang_alloc_realloc (vars->variables,
+               vars->num_variables * sizeof (slang_variable),
+               (vars->num_variables + 1) * sizeof (slang_variable));
+       if (vars->variables == NULL)
+       {
+               slang_info_log_memory (C->L);
+               return 0;
+       }
+       var = vars->variables + vars->num_variables;
+       vars->num_variables++;
+       slang_variable_construct (var);
+       var->type.qualifier = type->qualifier;
+       if (!parse_identifier (C, &var->name))
+               return 0;
+       switch (*C->I++)
+       {
+       case VARIABLE_NONE:
+               if (!slang_type_specifier_copy (&var->type.specifier, &type->specifier))
+                       return 0;
+               break;
+       case VARIABLE_INITIALIZER:
+               if (!slang_type_specifier_copy (&var->type.specifier, &type->specifier))
+                       return 0;
+               var->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
+               if (var->initializer == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       return 0;
+               }
+               slang_operation_construct (var->initializer);
+               if (!parse_expression (C, var->initializer, vars, structs))
+                       return 0;
+               break;
+       case VARIABLE_ARRAY_UNKNOWN:
+               var->type.specifier.type = slang_spec_array;
+               var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof (
+                       slang_type_specifier));
+               if (var->type.specifier._array == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       return 0;
+               }
+               slang_type_specifier_construct (var->type.specifier._array);
+               if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier))
+                       return 0;
+               break;
+       case VARIABLE_ARRAY_EXPLICIT:
+               var->type.specifier.type = slang_spec_array;
+               var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof (
+                       slang_type_specifier));
+               if (var->type.specifier._array == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       return 0;
+               }
+               slang_type_specifier_construct (var->type.specifier._array);
+               if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier))
+                       return 0;
+               var->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
+               if (var->array_size == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       return 0;
+               }
+               slang_operation_construct (var->array_size);
+               if (!parse_expression (C, var->array_size, vars, structs))
+                       return 0;
+               break;
+       default:
+               return 0;
+       }
+       return 1;
+}
+
+static int parse_init_declarator_list (slang_parse_ctx *C, slang_variable_scope *vars,
+       slang_struct_scope *structs)
+{
+       slang_fully_specified_type type;
+
+       slang_fully_specified_type_construct (&type);
+       if (!parse_fully_specified_type (C, &type, structs, vars))
+       {
+               slang_fully_specified_type_destruct (&type);
+               return 0;
+       }
+       do
+       {
+               if (!parse_init_declarator (C, &type, vars, structs))
+               {
+                       slang_fully_specified_type_destruct (&type);
+                       return 0;
+               }
+       }
+       while (*C->I++ == DECLARATOR_NEXT);
+       slang_fully_specified_type_destruct (&type);
+       return 1;
+}
+
+static int parse_function (slang_parse_ctx *C, int definition, slang_struct_scope *structs,
+       slang_function_scope *funcs, slang_variable_scope *scope)
+{
+       slang_function parsed_func, *found_func;
+
+       slang_function_construct (&parsed_func);
+       if (definition)
+       {
+               if (!parse_function_definition (C, &parsed_func, structs, scope))
+               {
+                       slang_function_destruct (&parsed_func);
+                       return 0;
+               }
+       }
+       else
+       {
+               if (!parse_function_prototype (C, &parsed_func, structs, scope))
+               {
+                       slang_function_destruct (&parsed_func);
+                       return 0;
+               }
+       }
+       found_func = slang_function_scope_find (funcs, &parsed_func, 0);
+       if (found_func == NULL)
+       {
+               funcs->functions = (slang_function *) slang_alloc_realloc (funcs->functions,
+                       funcs->num_functions * sizeof (slang_function), (funcs->num_functions + 1) * sizeof (
+                       slang_function));
+               if (funcs->functions == NULL)
+               {
+                       slang_info_log_memory (C->L);
+                       slang_function_destruct (&parsed_func);
+                       return 0;
+               }
+               funcs->functions[funcs->num_functions] = parsed_func;
+               funcs->num_functions++;
+       }
+       else
+       {
+               /* TODO check function return type qualifiers and specifiers */
+               if (definition)
+               {
+                       if (found_func->body != NULL)
+                       {
+                               slang_info_log_error (C->L, "%s: function already has a body",
+                                       parsed_func.header.name);
+                               slang_function_destruct (&parsed_func);
+                               return 0;
+                       }
+                       slang_function_destruct (found_func);
+                       *found_func = parsed_func;
+               }
+               else
+               {
+                       slang_function_destruct (&parsed_func);
+               }
+       }
+       return 1;
+}
+
+/* declaration */
+#define DECLARATION_FUNCTION_PROTOTYPE 1
+#define DECLARATION_INIT_DECLARATOR_LIST 2
+
+static int parse_declaration (slang_parse_ctx *C, slang_variable_scope *scope,
+       slang_struct_scope *structs, slang_function_scope *funcs)
+{
+       switch (*C->I++)
+       {
+       case DECLARATION_INIT_DECLARATOR_LIST:
+               if (!parse_init_declarator_list (C, scope, structs))
+                       return 0;
+               break;
+       case DECLARATION_FUNCTION_PROTOTYPE:
+               if (!parse_function (C, 0, structs, funcs, scope))
+                       return 0;
+               break;
+       default:
+               return 0;
+       }
+       return 1;
+}
+
+/* external declaration */
+#define EXTERNAL_NULL 0
+#define EXTERNAL_FUNCTION_DEFINITION 1
+#define EXTERNAL_DECLARATION 2
+
+static int parse_translation_unit (slang_parse_ctx *C, slang_translation_unit *unit)
+{
+       while (*C->I != EXTERNAL_NULL)
+       {
+               switch (*C->I++)
+               {
+               case EXTERNAL_FUNCTION_DEFINITION:
+                       if (!parse_function (C, 1, unit->structs, &unit->functions, unit->globals))
+                               return 0;
+                       break;
+               case EXTERNAL_DECLARATION:
+                       if (!parse_declaration (C, unit->globals, unit->structs, &unit->functions))
+                               return 0;
+                       break;
+               default:
+                       return 0;
+               }
+       }
+       C->I++;
+       return 1;
+}
+
+static int compile_with_grammar (grammar id, const char *source, slang_translation_unit *unit,
+       slang_unit_type type, slang_info_log *log)
+{
+       byte *prod;
+       unsigned int size, start, version;
+       slang_parse_ctx C;
+
+       /* retrieve version */
+       if (!_slang_preprocess_version (source, &version, &start, log))
+               return 0;
+
+       slang_translation_unit_construct (unit);
+       unit->type = type;
+       if (!grammar_fast_check (id, (const byte *) source + start, &prod, &size, 65536))
+       {
+               char buf[1024];
+               unsigned int pos;
+               grammar_get_last_error (buf, 1024, &pos);
+               slang_info_log_error (log, buf);
+               return 0;
+       }
+       C.I = prod;
+       C.L = log;
+       if (!check_revision (&C))
+       {
+               grammar_alloc_free (prod);
+               return 0;
+       }
+       if (!parse_translation_unit (&C, unit))
+       {
+               slang_translation_unit_destruct (unit);
+               grammar_alloc_free (prod);
+               return 0;
+       }
+       grammar_alloc_free (prod);
+       return 1;
+}
+
+static const char *slang_shader_syn =
+#include "library/slang_shader_syn.h"
+;
+
+int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit_type type,
+       slang_info_log *log)
+{
+       grammar id;
+
+       id = grammar_load_from_text ((const byte *) slang_shader_syn);
+       if (id == 0)
+       {
+               char buf[1024];
+               unsigned int pos;
+               grammar_get_last_error (buf, 1024, &pos);
+               slang_info_log_error (log, buf);
+               return 0;
+       }
+
+       grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1);
+       if (type == slang_unit_fragment_shader)
+               grammar_set_reg8 (id, (const byte *) "shader_type", 1);
+       else
+               grammar_set_reg8 (id, (const byte *) "shader_type", 2);
+
+       if (!compile_with_grammar (id, source, unit, type, log))
+       {
+               grammar_destroy (id);
+               return 0;
+       }
+
+       grammar_destroy (id);
+       return 1;
+}
+
index 59e7ee8f029a5d11a1b5c6a9e5ba927b8be35f67..0458f3a2b2a2c696a7161aa6f6195b5e3effb5d8 100644 (file)
-/*\r
- * Mesa 3-D graphics library\r
- * Version:  6.3\r
- *\r
- * Copyright (C) 2005  Brian Paul   All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included\r
- * in all copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-#if !defined SLANG_COMPILE_H\r
-#define SLANG_COMPILE_H\r
-\r
-#if defined __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-typedef enum slang_type_qualifier_\r
-{\r
-       slang_qual_none,\r
-       slang_qual_const,\r
-       slang_qual_attribute,\r
-       slang_qual_varying,\r
-       slang_qual_uniform,\r
-       slang_qual_out,\r
-       slang_qual_inout,\r
-       slang_qual_fixedoutput, /* internal */\r
-       slang_qual_fixedinput   /* internal */\r
-} slang_type_qualifier;\r
-\r
-typedef enum slang_type_specifier_type_\r
-{\r
-       slang_spec_void,\r
-       slang_spec_bool,\r
-       slang_spec_bvec2,\r
-       slang_spec_bvec3,\r
-       slang_spec_bvec4,\r
-       slang_spec_int,\r
-       slang_spec_ivec2,\r
-       slang_spec_ivec3,\r
-       slang_spec_ivec4,\r
-       slang_spec_float,\r
-       slang_spec_vec2,\r
-       slang_spec_vec3,\r
-       slang_spec_vec4,\r
-       slang_spec_mat2,\r
-       slang_spec_mat3,\r
-       slang_spec_mat4,\r
-       slang_spec_sampler1D,\r
-       slang_spec_sampler2D,\r
-       slang_spec_sampler3D,\r
-       slang_spec_samplerCube,\r
-       slang_spec_sampler1DShadow,\r
-       slang_spec_sampler2DShadow,\r
-       slang_spec_struct,\r
-       slang_spec_array\r
-} slang_type_specifier_type;\r
-\r
-typedef struct slang_type_specifier_\r
-{\r
-       slang_type_specifier_type type;\r
-       struct slang_struct_ *_struct;          /* spec_struct */\r
-       struct slang_type_specifier_ *_array;   /* spec_array */\r
-} slang_type_specifier;\r
-\r
-typedef struct slang_fully_specified_type_\r
-{\r
-       slang_type_qualifier qualifier;\r
-       slang_type_specifier specifier;\r
-} slang_fully_specified_type;\r
-\r
-typedef struct slang_variable_scope_\r
-{\r
-       struct slang_variable_ *variables;\r
-       unsigned int num_variables;\r
-       struct slang_variable_scope_ *outer_scope;\r
-} slang_variable_scope;\r
-\r
-typedef enum slang_operation_type_\r
-{\r
-       slang_oper_none,\r
-       slang_oper_block_no_new_scope,\r
-       slang_oper_block_new_scope,\r
-       slang_oper_variable_decl,\r
-       slang_oper_asm,\r
-       slang_oper_break,\r
-       slang_oper_continue,\r
-       slang_oper_discard,\r
-       slang_oper_return,\r
-       slang_oper_expression,\r
-       slang_oper_if,\r
-       slang_oper_while,\r
-       slang_oper_do,\r
-       slang_oper_for,\r
-       slang_oper_void,\r
-       slang_oper_literal_bool,\r
-       slang_oper_literal_int,\r
-       slang_oper_literal_float,\r
-       slang_oper_identifier,\r
-       slang_oper_sequence,\r
-       slang_oper_assign,\r
-       slang_oper_addassign,\r
-       slang_oper_subassign,\r
-       slang_oper_mulassign,\r
-       slang_oper_divassign,\r
-       /*slang_oper_modassign,*/\r
-       /*slang_oper_lshassign,*/\r
-       /*slang_oper_rshassign,*/\r
-       /*slang_oper_orassign,*/\r
-       /*slang_oper_xorassign,*/\r
-       /*slang_oper_andassign,*/\r
-       slang_oper_select,\r
-       slang_oper_logicalor,\r
-       slang_oper_logicalxor,\r
-       slang_oper_logicaland,\r
-       /*slang_oper_bitor,*/\r
-       /*slang_oper_bitxor,*/\r
-       /*slang_oper_bitand,*/\r
-       slang_oper_equal,\r
-       slang_oper_notequal,\r
-       slang_oper_less,\r
-       slang_oper_greater,\r
-       slang_oper_lessequal,\r
-       slang_oper_greaterequal,\r
-       /*slang_oper_lshift,*/\r
-       /*slang_oper_rshift,*/\r
-       slang_oper_add,\r
-       slang_oper_subtract,\r
-       slang_oper_multiply,\r
-       slang_oper_divide,\r
-       /*slang_oper_modulus,*/\r
-       slang_oper_preincrement,\r
-       slang_oper_predecrement,\r
-       slang_oper_plus,\r
-       slang_oper_minus,\r
-       /*slang_oper_complement,*/\r
-       slang_oper_not,\r
-       slang_oper_subscript,\r
-       slang_oper_call,\r
-       slang_oper_field,\r
-       slang_oper_postincrement,\r
-       slang_oper_postdecrement\r
-} slang_operation_type;\r
-\r
-typedef struct slang_operation_\r
-{\r
-       slang_operation_type type;\r
-       struct slang_operation_ *children;\r
-       unsigned int num_children;\r
-       float literal;          /* bool, literal_int, literal_float */\r
-       char *identifier;       /* asm, identifier, call, field */\r
-       slang_variable_scope *locals;\r
-} slang_operation;\r
-\r
-typedef struct slang_variable_\r
-{\r
-       slang_fully_specified_type type;\r
-       char *name;\r
-       slang_operation *array_size;    /* spec_array */\r
-       slang_operation *initializer;\r
-} slang_variable;\r
-\r
-typedef struct slang_struct_scope_\r
-{\r
-       struct slang_struct_ *structs;\r
-       unsigned int num_structs;\r
-       struct slang_struct_scope_ *outer_scope;\r
-} slang_struct_scope;\r
-\r
-typedef struct slang_struct_\r
-{\r
-       char *name;\r
-       slang_variable_scope *fields;\r
-       slang_struct_scope *structs;\r
-} slang_struct;\r
-\r
-typedef enum slang_function_kind_\r
-{\r
-       slang_func_ordinary,\r
-       slang_func_constructor,\r
-       slang_func_operator\r
-} slang_function_kind;\r
-\r
-typedef struct slang_function_\r
-{\r
-       slang_function_kind kind;\r
-       slang_variable header;\r
-       slang_variable_scope *parameters;\r
-       unsigned int param_count;\r
-       slang_operation *body;\r
-} slang_function;\r
-\r
-typedef struct slang_function_scope_\r
-{\r
-       slang_function *functions;\r
-       unsigned int num_functions;\r
-       struct slang_function_scope_ *outer_scope;\r
-} slang_function_scope;\r
-\r
-typedef enum slang_unit_type_\r
-{\r
-       slang_unit_fragment_shader,\r
-       slang_unit_vertex_shader\r
-} slang_unit_type;\r
-       \r
-typedef struct slang_translation_unit_\r
-{\r
-       slang_variable_scope *globals;\r
-       slang_function_scope functions;\r
-       slang_struct_scope *structs;\r
-       slang_unit_type type;\r
-} slang_translation_unit;\r
-\r
-typedef struct slang_info_log_\r
-{\r
-       char *text;\r
-       int dont_free_text;\r
-} slang_info_log;\r
-\r
-void slang_info_log_construct (slang_info_log *);\r
-void slang_info_log_destruct (slang_info_log *);\r
-int slang_info_log_error (slang_info_log *, const char *, ...);\r
-int slang_info_log_warning (slang_info_log *, const char *, ...);\r
-void slang_info_log_memory (slang_info_log *);\r
-\r
-int _slang_compile (const char *, slang_translation_unit *, slang_unit_type type, slang_info_log *);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
-\r
+/*
+ * Mesa 3-D graphics library
+ * Version:  6.3
+ *
+ * Copyright (C) 2005  Brian Paul   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_COMPILE_H
+#define SLANG_COMPILE_H
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+typedef enum slang_type_qualifier_
+{
+       slang_qual_none,
+       slang_qual_const,
+       slang_qual_attribute,
+       slang_qual_varying,
+       slang_qual_uniform,
+       slang_qual_out,
+       slang_qual_inout,
+       slang_qual_fixedoutput, /* internal */
+       slang_qual_fixedinput   /* internal */
+} slang_type_qualifier;
+
+typedef enum slang_type_specifier_type_
+{
+       slang_spec_void,
+       slang_spec_bool,
+       slang_spec_bvec2,
+       slang_spec_bvec3,
+       slang_spec_bvec4,
+       slang_spec_int,
+       slang_spec_ivec2,
+       slang_spec_ivec3,
+       slang_spec_ivec4,
+       slang_spec_float,
+       slang_spec_vec2,
+       slang_spec_vec3,
+       slang_spec_vec4,
+       slang_spec_mat2,
+       slang_spec_mat3,
+       slang_spec_mat4,
+       slang_spec_sampler1D,
+       slang_spec_sampler2D,
+       slang_spec_sampler3D,
+       slang_spec_samplerCube,
+       slang_spec_sampler1DShadow,
+       slang_spec_sampler2DShadow,
+       slang_spec_struct,
+       slang_spec_array
+} slang_type_specifier_type;
+
+typedef struct slang_type_specifier_
+{
+       slang_type_specifier_type type;
+       struct slang_struct_ *_struct;          /* spec_struct */
+       struct slang_type_specifier_ *_array;   /* spec_array */
+} slang_type_specifier;
+
+typedef struct slang_fully_specified_type_
+{
+       slang_type_qualifier qualifier;
+       slang_type_specifier specifier;
+} slang_fully_specified_type;
+
+typedef struct slang_variable_scope_
+{
+       struct slang_variable_ *variables;
+       unsigned int num_variables;
+       struct slang_variable_scope_ *outer_scope;
+} slang_variable_scope;
+
+typedef enum slang_operation_type_
+{
+       slang_oper_none,
+       slang_oper_block_no_new_scope,
+       slang_oper_block_new_scope,
+       slang_oper_variable_decl,
+       slang_oper_asm,
+       slang_oper_break,
+       slang_oper_continue,
+       slang_oper_discard,
+       slang_oper_return,
+       slang_oper_expression,
+       slang_oper_if,
+       slang_oper_while,
+       slang_oper_do,
+       slang_oper_for,
+       slang_oper_void,
+       slang_oper_literal_bool,
+       slang_oper_literal_int,
+       slang_oper_literal_float,
+       slang_oper_identifier,
+       slang_oper_sequence,
+       slang_oper_assign,
+       slang_oper_addassign,
+       slang_oper_subassign,
+       slang_oper_mulassign,
+       slang_oper_divassign,
+       /*slang_oper_modassign,*/
+       /*slang_oper_lshassign,*/
+       /*slang_oper_rshassign,*/
+       /*slang_oper_orassign,*/
+       /*slang_oper_xorassign,*/
+       /*slang_oper_andassign,*/
+       slang_oper_select,
+       slang_oper_logicalor,
+       slang_oper_logicalxor,
+       slang_oper_logicaland,
+       /*slang_oper_bitor,*/
+       /*slang_oper_bitxor,*/
+       /*slang_oper_bitand,*/
+       slang_oper_equal,
+       slang_oper_notequal,
+       slang_oper_less,
+       slang_oper_greater,
+       slang_oper_lessequal,
+       slang_oper_greaterequal,
+       /*slang_oper_lshift,*/
+       /*slang_oper_rshift,*/
+       slang_oper_add,
+       slang_oper_subtract,
+       slang_oper_multiply,
+       slang_oper_divide,
+       /*slang_oper_modulus,*/
+       slang_oper_preincrement,
+       slang_oper_predecrement,
+       slang_oper_plus,
+       slang_oper_minus,
+       /*slang_oper_complement,*/
+       slang_oper_not,
+       slang_oper_subscript,
+       slang_oper_call,
+       slang_oper_field,
+       slang_oper_postincrement,
+       slang_oper_postdecrement
+} slang_operation_type;
+
+typedef struct slang_operation_
+{
+       slang_operation_type type;
+       struct slang_operation_ *children;
+       unsigned int num_children;
+       float literal;          /* bool, literal_int, literal_float */
+       char *identifier;       /* asm, identifier, call, field */
+       slang_variable_scope *locals;
+} slang_operation;
+
+typedef struct slang_variable_
+{
+       slang_fully_specified_type type;
+       char *name;
+       slang_operation *array_size;    /* spec_array */
+       slang_operation *initializer;
+} slang_variable;
+
+typedef struct slang_struct_scope_
+{
+       struct slang_struct_ *structs;
+       unsigned int num_structs;
+       struct slang_struct_scope_ *outer_scope;
+} slang_struct_scope;
+
+typedef struct slang_struct_
+{
+       char *name;
+       slang_variable_scope *fields;
+       slang_struct_scope *structs;
+} slang_struct;
+
+typedef enum slang_function_kind_
+{
+       slang_func_ordinary,
+       slang_func_constructor,
+       slang_func_operator
+} slang_function_kind;
+
+typedef struct slang_function_
+{
+       slang_function_kind kind;
+       slang_variable header;
+       slang_variable_scope *parameters;
+       unsigned int param_count;
+       slang_operation *body;
+} slang_function;
+
+typedef struct slang_function_scope_
+{
+       slang_function *functions;
+       unsigned int num_functions;
+       struct slang_function_scope_ *outer_scope;
+} slang_function_scope;
+
+typedef enum slang_unit_type_
+{
+       slang_unit_fragment_shader,
+       slang_unit_vertex_shader
+} slang_unit_type;
+       
+typedef struct slang_translation_unit_
+{
+       slang_variable_scope *globals;
+       slang_function_scope functions;
+       slang_struct_scope *structs;
+       slang_unit_type type;
+} slang_translation_unit;
+
+typedef struct slang_info_log_
+{
+       char *text;
+       int dont_free_text;
+} slang_info_log;
+
+void slang_info_log_construct (slang_info_log *);
+void slang_info_log_destruct (slang_info_log *);
+int slang_info_log_error (slang_info_log *, const char *, ...);
+int slang_info_log_warning (slang_info_log *, const char *, ...);
+void slang_info_log_memory (slang_info_log *);
+
+int _slang_compile (const char *, slang_translation_unit *, slang_unit_type type, slang_info_log *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+