
/*  A Bison parser, made from rib.y
 by  GNU Bison version 1.25
  */

#define YYBISON 1  /* Identify Bison output.  */

#define alloca

#define	RIB_DECLARE	258
#define	RIB_FRAME_BEGIN	259
#define	RIB_FRAME_END	260
#define	RIB_WORLD_BEGIN	261
#define	RIB_WORLD_END	262
#define	RIB_FORMAT	263
#define	RIB_FRAME_ASPECT_RATIO	264
#define	RIB_SCREEN_WINDOW	265
#define	RIB_CROP_WINDOW	266
#define	RIB_PROJECTION	267
#define	RIB_CLIPPING	268
#define	RIB_CLIPPING_PLANE	269
#define	RIB_DEPTH_OF_FIELD	270
#define	RIB_SHUTTER	271
#define	RIB_PIXEL_VARIANCE	272
#define	RIB_PIXEL_SAMPLES	273
#define	RIB_PIXEL_FILTER	274
#define	RIB_EXPOSURE	275
#define	RIB_IMAGER	276
#define	RIB_QUANTIZE	277
#define	RIB_DISPLAY	278
#define	RIB_HIDER	279
#define	RIB_COLOR_SAMPLES	280
#define	RIB_RELATIVE_DETAIL	281
#define	RIB_OPTION	282
#define	RIB_ATTRIBUTE_BEGIN	283
#define	RIB_ATTRIBUTE_END	284
#define	RIB_COLOR	285
#define	RIB_OPACITY	286
#define	RIB_TEXTURE_COORDINATES	287
#define	RIB_LIGHT_SOURCE	288
#define	RIB_AREA_LIGHT_SOURCE	289
#define	RIB_ILLUMINATE	290
#define	RIB_SURFACE	291
#define	RIB_ATMOSPHERE	292
#define	RIB_INTERIOR	293
#define	RIB_EXTERIOR	294
#define	RIB_SHADING_RATE	295
#define	RIB_SHADING_INTERPOLATION	296
#define	RIB_MATTE	297
#define	RIB_BOUND	298
#define	RIB_DETAIL	299
#define	RIB_DETAIL_RANGE	300
#define	RIB_GEOMETRIC_APPROXIMATION	301
#define	RIB_GEOMETRIC_REPRESENTATION	302
#define	RIB_ORIENTATION	303
#define	RIB_REVERSE_ORIENTATION	304
#define	RIB_SIDES	305
#define	RIB_IDENTITY	306
#define	RIB_TRANSFORM	307
#define	RIB_CONCAT_TRANSFORM	308
#define	RIB_PERSPECTIVE	309
#define	RIB_TRANSLATE	310
#define	RIB_ROTATE	311
#define	RIB_SCALE	312
#define	RIB_SKEW	313
#define	RIB_DEFORMATION	314
#define	RIB_DISPLACEMENT	315
#define	RIB_COORDINATE_SYSTEM	316
#define	RIB_COORDINATE_SYS_TRANSFORM	317
#define	RIB_TRANSFORM_BEGIN	318
#define	RIB_TRANSFORM_END	319
#define	RIB_ATTRIBUTE	320
#define	RIB_POLYGON	321
#define	RIB_GENERAL_POLYGON	322
#define	RIB_POINTS_POLYGONS	323
#define	RIB_POINTS_GENERAL_POLYGONS	324
#define	RIB_BASIS	325
#define	RIB_PATCH	326
#define	RIB_PATCH_MESH	327
#define	RIB_NU_PATCH	328
#define	RIB_TRIM_CURVE	329
#define	RIB_SPHERE	330
#define	RIB_CONE	331
#define	RIB_CYLINDER	332
#define	RIB_HYPERBOLOID	333
#define	RIB_PARABOLOID	334
#define	RIB_DISK	335
#define	RIB_TORUS	336
#define	RIB_CURVES	337
#define	RIB_GEOMETRY	338
#define	RIB_POINTS	339
#define	RIB_SUBDIVISION_MESH	340
#define	RIB_BLOBBY	341
#define	RIB_PROCEDURAL	342
#define	RIB_SOLID_BEGIN	343
#define	RIB_SOLID_END	344
#define	RIB_OBJECT_BEGIN	345
#define	RIB_OBJECT_END	346
#define	RIB_OBJECT_INSTANCE	347
#define	RIB_MOTION_BEGIN	348
#define	RIB_MOTION_END	349
#define	RIB_MAKE_TEXTURE	350
#define	RIB_MAKE_BUMP	351
#define	RIB_MAKE_LAT_LONG_ENVIRONMENT	352
#define	RIB_MAKE_CUBE_FACE_ENVIRONMENT	353
#define	RIB_MAKE_SHADOW	354
#define	RIB_ARCHIVE_RECORD	355
#define	RIB_ERROR_HANDLER	356
#define	RIB_VERSION	357
#define	RIB_VERSION_STRING	358
#define	RIB_ARRAY_BEGIN	359
#define	RIB_ARRAY_END	360
#define	RIB_TEXT	361
#define	RIB_IDENTIFIER	362
#define	RIB_FLOAT	363

#line 1 "rib.y"

///////////////////////////////////////////////////////////////////////
//
//  File				:	rib.y
//  Classes				:	-
//  Description			:	RIB bindings
//
//
//
//
//
////////////////////////////////////////////////////////////////////////

#undef	alloca

#include <math.h>
#include "common/str.h"
#include "common/containers.h"
#include "common/global.h"
#include "ri.h"
#include "renderer.h"
#include "delayed.h"

#include <stdarg.h>
// Some forward definitions
int								riblex(void );				// Forward definition for stupid yacc
void							riberror(char *,...);

// Types for the data encountered in the rib file
// Note that there's no type for integer as they are recovered from floats
typedef enum {
	RT_FLOAT,
	RT_TEXT,
	RT_STAR,
	RT_PL,
	RT_NULL
} ERIBType;

// Every command has an argument list composed of this type
typedef union {
	ERIBType	type;
	float		real;
	int			integer;
	char		*string;
} ERIBValue;

// Holds information about a parameter
typedef struct {
	char		*name;			// Name of the parameter
	ERIBType	type;			// Type of the parameter
	int			numItems;		// Number of items of type ERIBValue
	ERIBValue	*values;		// Points to the array of values for this parameter
	int			valuesStart;	// Index in the argument list where the parameter starts
} TParameter;

char	currentCommand[32];						// Holds the current command being processed
static	CArray<ERIBValue>	*arguments;			// Array of arguments
static	int					currentArgument;	// Index to the current argument
static	int					argumentCounter;	// Number of arguments
static	CArray<TParameter>	*parameterList;		// Parameter list
static	int					numParameters;		// Number of parameters in the list
static	CArray<RtPointer>	*lights;			// Number -> handle mapping for lights
static	CArray<RtPointer>	*objects;			// Number -> handle mapping for objects
static	int					commandIgnore;		// True if the command should be ignored
static	CArray<RtToken>		*tokens;			// Array of tokens
static	CArray<RtPointer>	*vals;				// Array of values for the tokens
static	CList<char *>		*allocatedStrings;	// Strings that have been allocated for the last command

// Some textual descriptions for the rib-ri parser

// Basis functions
const	char	*RI_BEZIERBASIS				=	"bezier";
const	char	*RI_BSPLINEBASIS			=	"b-spline";
const	char	*RI_POWERBASIS				=	"power";
const	char	*RI_CATMULLROMBASIS			=	"catmull-rom";
const	char	*RI_HERMITEBASIS			=	"hermite";

// Filters
const	char	*RI_BOXFILTER				=	"box";
const	char	*RI_TRIANGLEFILTER			=	"triangle";
const	char	*RI_GAUSSIANFILTER			=	"gaussian";
const	char	*RI_SINCFILTER				=	"sinc";
const	char	*RI_CATMULLROMFILTER		=	"catmull-rom";

// Error handlers
const	char	*RI_ERRORIGNORE				=	"ignore";
const	char	*RI_ERRORPRINT				=	"print";
const	char	*RI_ERRORABORT				=	"abort";

// Predefined procedural handlers
const	char	*RI_PROCDELAYEDREADARCHIVE	=	"DelayedReadArchive";
const	char	*RI_PROCRUNPROGRAM			=	"RunProgram";
const	char	*RI_PROCDYNAMICLOAD			=	"DynamicLoad";

// Predefined error handlers
const	char	*RI_ERROR_IGNORE			=	"ignore";
const	char	*RI_ERROR_ABORT				=	"abort";
const	char	*RI_ERROR_PRINT				=	"print";

// Return as floats
float			*getFloat(int i,int s)	{
	return &(*arguments)[i].real;
}

// Return as integers
int				*getInt(int i,int s) {
	int	e;

	for (e=i;e<(i+s);e++) {
		int	value	=	(int) ((*arguments)[e].real);

		if ((float) value != (*arguments)[e].real) {
			riberror("Warning: Possible precision loss between float -> integer\n");
		}

		(*arguments)[e].integer = value;
	}

	return &(*arguments)[i].integer;
}

// Return as strings
char			**getString(int i,int s) {
	return &(*arguments)[i].string;
}


// Convert to lowercase
char			*toLowerCase(char *s) {
	int	i;

	for (i=0;i<slen(s);i++) {
		if ((s[i] >= 'A') && (s[i] <= 'Z'))
			s[i]	=	'a'+s[i]-'A';
	}

	return s;
}

///////////////////////////////////////////////////////////////////////
// Function				:	parameterListCheck
// Description			:	Count the number of variables inb the parameter list
// Return Value			:	TRUE if OK
// Comments				:	(This version is used by the primitives)
// Date last edited		:	8/10/2001
int		parameterListCheck(int *numVertex,int *numVarying,int *numUniform) {
	int			i;
	int			numVertices	=	-1;
	CVariable	tmp;

	numVertex[0]	=	-1;
	numVarying[0]	=	-1;
	numUniform[0]	=	-1;

	for (i=0;i<numParameters;i++) {
		TParameter	*par	=	&(*parameterList)[i];
		CVariable	*var	=	sfRetrieveVariable(par->name);
	
		if (var == NULL)	var = sfDeclareVariable(NULL,par->name);

		// Handle some irregular cases
		if (var == NULL) {
			// Special symbols
			if (scmp(par->name,"Pz") == 0) {
				tmp.cardinality	=	1;
				tmp.numItems	=	1;
				tmp.entry		=	VARIABLE_P;
				tmp.name		=	"Pz";
				tmp.type		=	TYPE_FLOAT;
				tmp.container	=	CONTAINER_VERTEX;
				tmp.usageMarker	=	PARAMETER_P;
				tmp.global		=	TRUE;
				var				=	&tmp;
			} else if (scmp(par->name,"Np") == 0) {
				tmp.cardinality	=	3;
				tmp.numItems	=	1;
				tmp.entry		=	VARIABLE_NG;
				tmp.name		=	"Np";
				tmp.type		=	TYPE_NORMAL;
				tmp.container	=	CONTAINER_VERTEX;
				tmp.usageMarker	=	PARAMETER_NG;
				tmp.global		=	TRUE;
				var				=	&tmp;
			} else if (scmp(par->name,"Pw") == 0) {
				tmp.cardinality	=	4;
				tmp.numItems	=	1;
				tmp.entry		=	VARIABLE_P;
				tmp.name		=	"Pw";
				tmp.type		=	TYPE_POINT;
				tmp.container	=	CONTAINER_VERTEX;
				tmp.usageMarker	=	PARAMETER_P;
				tmp.global		=	TRUE;
				var				=	&tmp;
			}
		}	

		if (var == NULL)	{
			riberror("%s: Parameter \"%s\" is not declared\n",currentCommand,par->name);
			tmp.name	=	NULL;
			return FALSE;
		}

		if ((par->numItems % (var->cardinality*var->numItems)) != 0) {
			riberror("%s: Invalid number of items for the parameter \"%s\"\n",currentCommand,par->name);
			riberror("%s: (This is not necessarily an error as there's ambiguity in the interface\n");
			riberror("%s: about the container classes of global variables)\n");
			tmp.name	=	NULL;
			return FALSE;
		}

		// Type checking
		if (var->type == TYPE_INTEGER) {
			if (par->type == RT_FLOAT) {
				int	j;

				for (j=0;j<par->numItems;j++) {
					par->values[j].integer	=	(int) par->values[j].real;
				}
			} else {
				riberror("%s: Type mismatch for parameter \"%s\"\n",currentCommand,par->name);
				tmp.name	=	NULL;
				return	FALSE;
			}
		} else if (var->type == TYPE_STRING) {
			if (par->type != RT_TEXT) {
				riberror("%s: Type mismatch for parameter \"%s\"\n",currentCommand,par->name);
				tmp.name	=	NULL;
				return	FALSE;
			}
		} else {
			if (par->type != RT_FLOAT) {
				riberror("%s: Type mismatch for parameter \"%s\"\n",currentCommand,par->name);
				tmp.name	=	NULL;
				return	FALSE;
			}
		}

		switch(var->container) {
		case CONTAINER_UNIFORM:
			if (numUniform[0] == -1)
				numUniform[0]	=	par->numItems / (var->cardinality*var->numItems);
			else {
				if (numUniform[0] != (par->numItems / (var->cardinality*var->numItems))) {
					riberror("%s: Invalid number of items for the parameter \"%s\"\n",currentCommand,par->name);
				}
			}

			break;
		case CONTAINER_VERTEX:
			if (numVertex[0] == -1)
				numVertex[0]	=	par->numItems / (var->cardinality*var->numItems);
			else {
				if (numVertex[0] != (par->numItems / (var->cardinality*var->numItems))) {
					riberror("%s: Invalid number of items for the parameter \"%s\"\n",currentCommand,par->name);
				}
			}

			break;
		case CONTAINER_VARYING:
			if (numVarying[0] == -1)
				numVarying[0]	=	par->numItems / (var->cardinality*var->numItems);
			else {
				if (numVarying[0] != (par->numItems / (var->cardinality*var->numItems))) {
					riberror("%s: Invalid number of items for the parameter \"%s\"\n",currentCommand,par->name);
				}
			}

			break;
		default:
			break;
		}
	}

	tmp.name	=	NULL;
	return TRUE;
}

///////////////////////////////////////////////////////////////////////
// Function				:	parameterListCheck
// Description			:	Check the parameter list, do necessary type conversions
// Return Value			:	TRUE if OK
// Comments				:
// Date last edited		:	8/10/2001
int		parameterListCheck() {
	int			i;
	
	for (i=0;i<numParameters;i++) {
		TParameter	*par	=	&(*parameterList)[i];
		CVariable	*var	=	sfRetrieveVariable(par->name);

		// Only typecheck variables that are defined, othervise assume, the type is ok (float or string)
		if (var == NULL)	{
			riberror("%s: Parameter \"%s\" is not declared\n",currentCommand,par->name);
			return FALSE;
		}

		// We always expect only one of this type on the countary to primitives
		if (par->numItems != (var->cardinality*var->numItems)) {
			riberror("%s: Invalid number of items for the parameter \"%s\"\n",currentCommand,par->name);
			return FALSE;
		}

		// Type checking
		if (var->type == TYPE_INTEGER) {
			if (par->type == RT_FLOAT) {
				int	j;

				for (j=0;j<par->numItems;j++) {
					par->values[j].integer	=	(int) par->values[j].real;
				}
			} else {
				riberror("%s: Type mismatch for parameter \"%s\"\n",currentCommand,par->name);
				return	FALSE;
			}
		} else if (var->type == TYPE_STRING) {
			if (par->type != RT_TEXT) {
				riberror("%s: Type mismatch for parameter \"%s\"\n",currentCommand,par->name);
				return	FALSE;
			}
		} else {
			if (par->type != RT_FLOAT) {
				riberror("%s: Type mismatch for parameter \"%s\"\n",currentCommand,par->name);
				return	FALSE;
			}
		}
	}

	return TRUE;
}

///////////////////////////////////////////////////////////////////////
// Function				:	getBasis
// Description			:	Get the basis matrix from a given text
// Return Value			:	TRUE if OK
// Comments				:
// Date last edited		:	8/10/2001
int		getBasis(RtBasis **a,char *n) {
	char	*name	=	toLowerCase(n);

	if (scmp(name,RI_BEZIERBASIS) == 0)
		a[0]	=	&RiBezierBasis;
	else if (scmp(name,RI_BSPLINEBASIS) == 0)
		a[0]	=	&RiBSplineBasis;
	else if (scmp(name,RI_CATMULLROMBASIS) == 0)
		a[0]	=	&RiCatmullRomBasis;
	else if (scmp(name,RI_HERMITEBASIS) == 0)
		a[0]	=	&RiHermiteBasis;
	else if (scmp(name,RI_POWERBASIS) == 0)
		a[0]	=	&RiPowerBasis;
	else {
		riberror("%s: Unknown basis: \"%s\"\n",currentCommand,name);

		return	FALSE;
	}

	return	TRUE;
}

///////////////////////////////////////////////////////////////////////
// Function				:	getFilter
// Description			:	Get the filter from a given text
// Return Value			:	NULL if failed
// Comments				:
// Date last edited		:	8/10/2001
RtFilterFunc	getFilter(char *name) {
	RtFilterFunc	f	=	NULL;

	if (scmp(name,RI_BOXFILTER) == 0) {
		f = RiBoxFilter;
	} else if (scmp(name,RI_GAUSSIANFILTER) == 0) {
		f = RiGaussianFilter;
	} else if (scmp(name,RI_TRIANGLEFILTER) == 0) {
		f = RiTriangleFilter;
	} else if (scmp(name,RI_CATMULLROMFILTER) == 0) {
		f = RiCatmullRomFilter;
	} else if (scmp(name,RI_SINCFILTER) == 0) {
		f = RiSincFilter;
	} else {
		riberror("%s: Filter \"%s\" not recognised\n",currentCommand,name);
	}

	return f;
}

///////////////////////////////////////////////////////////////////////
// Function				:	getError
// Description			:	Get the error handler from a given text
// Return Value			:	NULL if failed
// Comments				:
// Date last edited		:	8/10/2001
RtErrorHandler	getErrorHandler(char *name) {
	RtErrorHandler	f	=	NULL;

	if (scmp(name,RI_ERRORIGNORE) == 0) {
		f = RiErrorPrint;
	} else if (scmp(name,RI_ERRORPRINT) == 0) {
		f = RiErrorPrint;
	} else if (scmp(name,RI_ERRORABORT) == 0) {
		f = RiErrorAbort;
	} else {
		riberror("%s: Error handler \"%s\" not recognised\n",currentCommand,name);
	}

	return f;
}


#define	badParameters	else riberror("%s: Bad parameters.\n",currentCommand);


#line 411 "rib.y"
typedef union ribval {
	float	real;
	char	string[64];
	int		integer;
} YYSTYPE;
#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		607
#define	YYFLAG		32768
#define	YYNTBASE	109

#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 122)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
    96,    97,    98,    99,   100,   101,   102,   103,   104,   105,
   106,   107,   108
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     2,     3,     7,     9,    10,    14,    16,    20,    22,
    24,    28,    30,    33,    34,    37,    40,    41,    45,    46,
    50,    52,    55,    57,    59,    61,    66,    69,    75,    83,
    89,    97,   101,   105,   113,   118,   120,   124,   127,   131,
   136,   140,   144,   151,   157,   161,   164,   168,   171,   175,
   177,   179,   182,   185,   195,   207,   212,   216,   221,   226,
   230,   234,   238,   242,   246,   249,   252,   255,   265,   273,
   283,   291,   297,   305,   309,   312,   315,   317,   320,   322,
   342,   362,   365,   370,   375,   381,   390,   401,   405,   409,
   412,   415,   417,   419,   423,   426,   430,   435,   441,   447,
   470,   493,   533,   537,   545,   558,   569,   576,   585,   591,
   599,   606,   615,   625,   637,   644,   653,   659,   667,   675,
   685,   691,   694,   700,   704,   716,   719,   721,   724,   726,
   729,   732,   734,   744,   754,   762,   776,   781,   784,   787,
   790
};

static const short yyrhs[] = {   119,
     0,     0,   108,   111,   110,     0,   108,     0,     0,   106,
   113,   112,     0,   106,     0,   104,   110,   105,     0,   114,
     0,   110,     0,   104,   112,   105,     0,   106,     0,   118,
   117,     0,     0,   106,   115,     0,   106,   116,     0,     0,
   121,   120,   119,     0,     0,     3,   106,   106,     0,     4,
     0,     4,   108,     0,     5,     0,     6,     0,     7,     0,
     8,   108,   108,   108,     0,     9,   108,     0,    10,   108,
   108,   108,   108,     0,    10,   104,   108,   108,   108,   108,
   105,     0,    11,   108,   108,   108,   108,     0,    11,   104,
   108,   108,   108,   108,   105,     0,    12,   106,   117,     0,
    13,   108,   108,     0,    14,   108,   108,   108,   108,   108,
   108,     0,    15,   108,   108,   108,     0,    15,     0,    16,
   108,   108,     0,    17,   108,     0,    18,   108,   108,     0,
    19,   106,   108,   108,     0,    20,   108,   108,     0,    21,
   106,   117,     0,    22,   106,   108,   108,   108,   108,     0,
    23,   106,   106,   106,   117,     0,    24,   106,   117,     0,
    25,   115,     0,    25,   114,   114,     0,    26,   108,     0,
    27,   106,   117,     0,    28,     0,    29,     0,    30,   115,
     0,    31,   115,     0,    32,   108,   108,   108,   108,   108,
   108,   108,   108,     0,    32,   104,   108,   108,   108,   108,
   108,   108,   108,   108,   105,     0,    33,   106,   108,   117,
     0,    33,   106,   117,     0,    33,   106,   106,   117,     0,
    34,   106,   108,   117,     0,    35,   108,   108,     0,    36,
   106,   117,     0,    37,   106,   117,     0,    38,   106,   117,
     0,    39,   106,   117,     0,    40,   108,     0,    41,   106,
     0,    42,   108,     0,    43,   104,   108,   108,   108,   108,
   108,   108,   105,     0,    43,   108,   108,   108,   108,   108,
   108,     0,    44,   104,   108,   108,   108,   108,   108,   108,
   105,     0,    44,   108,   108,   108,   108,   108,   108,     0,
    45,   108,   108,   108,   108,     0,    45,   104,   108,   108,
   108,   108,   105,     0,    46,   106,   108,     0,    47,   106,
     0,    48,   106,     0,    49,     0,    50,   108,     0,    51,
     0,    52,   104,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   105,
     0,    53,   104,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   105,
     0,    54,   108,     0,    55,   108,   108,   108,     0,    57,
   108,   108,   108,     0,    56,   108,   108,   108,   108,     0,
    58,   108,   108,   108,   108,   108,   108,   108,     0,    58,
   104,   108,   108,   108,   108,   108,   108,   108,   105,     0,
    59,   106,   117,     0,    60,   106,   117,     0,    61,   106,
     0,    62,   106,     0,    63,     0,    64,     0,    65,   106,
   117,     0,    66,   117,     0,    67,   114,   117,     0,    68,
   114,   114,   117,     0,    69,   114,   114,   114,   117,     0,
    70,   106,   108,   106,   108,     0,    70,   104,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   105,   108,   106,   108,     0,    70,
   106,   108,   104,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   105,
   108,     0,    70,   104,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   108,
   105,   108,   104,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   105,
   108,     0,    71,   106,   117,     0,    72,   106,   108,   106,
   108,   106,   117,     0,    73,   108,   108,   114,   108,   108,
   108,   108,   114,   108,   108,   117,     0,    74,   114,   114,
   114,   114,   114,   114,   114,   114,   114,     0,    75,   108,
   108,   108,   108,   117,     0,    75,   104,   108,   108,   108,
   108,   105,   117,     0,    76,   108,   108,   108,   117,     0,
    76,   104,   108,   108,   108,   105,   117,     0,    77,   108,
   108,   108,   108,   117,     0,    77,   104,   108,   108,   108,
   108,   105,   117,     0,    78,   108,   108,   108,   108,   108,
   108,   108,   117,     0,    78,   104,   108,   108,   108,   108,
   108,   108,   108,   105,   117,     0,    79,   108,   108,   108,
   108,   117,     0,    79,   104,   108,   108,   108,   108,   105,
   117,     0,    80,   108,   108,   108,   117,     0,    80,   104,
   108,   108,   108,   105,   117,     0,    81,   108,   108,   108,
   108,   108,   117,     0,    81,   104,   108,   108,   108,   108,
   108,   105,   117,     0,    82,   106,   114,   106,   117,     0,
    84,   117,     0,    86,   108,   114,   116,   117,     0,    83,
   106,   117,     0,    87,   106,   116,   104,   108,   108,   108,
   108,   108,   108,   105,     0,    88,   106,     0,    89,     0,
    90,   108,     0,    91,     0,    92,   108,     0,    93,   115,
     0,    94,     0,    95,   106,   106,   106,   106,   106,   108,
   108,   117,     0,    96,   106,   106,   106,   106,   106,   108,
   108,   117,     0,    97,   106,   106,   106,   108,   108,   117,
     0,    98,   106,   106,   106,   106,   106,   106,   106,   108,
   106,   108,   108,   117,     0,    99,   106,   106,   117,     0,
   101,   106,     0,   102,   108,     0,   102,   103,     0,     1,
     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
   529,   532,   538,   541,   554,   562,   565,   579,   588,   592,
   599,   605,   619,   623,   636,   648,   663,   676,   676,   682,
   692,   700,   709,   715,   723,   731,   743,   753,   766,   781,
   794,   809,   820,   831,   844,   856,   860,   871,   881,   892,
   906,   917,   929,   943,   956,   967,   981,   996,  1007,  1018,
  1027,  1036,  1051,  1066,  1083,  1102,  1116,  1127,  1148,  1162,
  1175,  1186,  1197,  1208,  1219,  1229,  1239,  1249,  1275,  1299,
  1325,  1349,  1362,  1377,  1388,  1398,  1408,  1417,  1427,  1436,
  1482,  1528,  1538,  1550,  1562,  1575,  1591,  1609,  1620,  1631,
  1641,  1651,  1660,  1669,  1680,  1696,  1714,  1752,  1799,  1814,
  1865,  1916,  1999,  2027,  2105,  2145,  2173,  2193,  2215,  2234,
  2255,  2275,  2297,  2329,  2363,  2383,  2405,  2424,  2445,  2466,
  2489,  2504,  2515,  2528,  2539,  2610,  2620,  2629,  2639,  2648,
  2658,  2670,  2679,  2698,  2717,  2734,  2757,  2769,  2791,  2796,
  2801
};
#endif


#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)

static const char * const yytname[] = {   "$","error","$undefined.","RIB_DECLARE",
"RIB_FRAME_BEGIN","RIB_FRAME_END","RIB_WORLD_BEGIN","RIB_WORLD_END","RIB_FORMAT",
"RIB_FRAME_ASPECT_RATIO","RIB_SCREEN_WINDOW","RIB_CROP_WINDOW","RIB_PROJECTION",
"RIB_CLIPPING","RIB_CLIPPING_PLANE","RIB_DEPTH_OF_FIELD","RIB_SHUTTER","RIB_PIXEL_VARIANCE",
"RIB_PIXEL_SAMPLES","RIB_PIXEL_FILTER","RIB_EXPOSURE","RIB_IMAGER","RIB_QUANTIZE",
"RIB_DISPLAY","RIB_HIDER","RIB_COLOR_SAMPLES","RIB_RELATIVE_DETAIL","RIB_OPTION",
"RIB_ATTRIBUTE_BEGIN","RIB_ATTRIBUTE_END","RIB_COLOR","RIB_OPACITY","RIB_TEXTURE_COORDINATES",
"RIB_LIGHT_SOURCE","RIB_AREA_LIGHT_SOURCE","RIB_ILLUMINATE","RIB_SURFACE","RIB_ATMOSPHERE",
"RIB_INTERIOR","RIB_EXTERIOR","RIB_SHADING_RATE","RIB_SHADING_INTERPOLATION",
"RIB_MATTE","RIB_BOUND","RIB_DETAIL","RIB_DETAIL_RANGE","RIB_GEOMETRIC_APPROXIMATION",
"RIB_GEOMETRIC_REPRESENTATION","RIB_ORIENTATION","RIB_REVERSE_ORIENTATION","RIB_SIDES",
"RIB_IDENTITY","RIB_TRANSFORM","RIB_CONCAT_TRANSFORM","RIB_PERSPECTIVE","RIB_TRANSLATE",
"RIB_ROTATE","RIB_SCALE","RIB_SKEW","RIB_DEFORMATION","RIB_DISPLACEMENT","RIB_COORDINATE_SYSTEM",
"RIB_COORDINATE_SYS_TRANSFORM","RIB_TRANSFORM_BEGIN","RIB_TRANSFORM_END","RIB_ATTRIBUTE",
"RIB_POLYGON","RIB_GENERAL_POLYGON","RIB_POINTS_POLYGONS","RIB_POINTS_GENERAL_POLYGONS",
"RIB_BASIS","RIB_PATCH","RIB_PATCH_MESH","RIB_NU_PATCH","RIB_TRIM_CURVE","RIB_SPHERE",
"RIB_CONE","RIB_CYLINDER","RIB_HYPERBOLOID","RIB_PARABOLOID","RIB_DISK","RIB_TORUS",
"RIB_CURVES","RIB_GEOMETRY","RIB_POINTS","RIB_SUBDIVISION_MESH","RIB_BLOBBY",
"RIB_PROCEDURAL","RIB_SOLID_BEGIN","RIB_SOLID_END","RIB_OBJECT_BEGIN","RIB_OBJECT_END",
"RIB_OBJECT_INSTANCE","RIB_MOTION_BEGIN","RIB_MOTION_END","RIB_MAKE_TEXTURE",
"RIB_MAKE_BUMP","RIB_MAKE_LAT_LONG_ENVIRONMENT","RIB_MAKE_CUBE_FACE_ENVIRONMENT",
"RIB_MAKE_SHADOW","RIB_ARCHIVE_RECORD","RIB_ERROR_HANDLER","RIB_VERSION","RIB_VERSION_STRING",
"RIB_ARRAY_BEGIN","RIB_ARRAY_END","RIB_TEXT","RIB_IDENTIFIER","RIB_FLOAT","start",
"ribFloatString","@1","ribTextString","@2","ribFloatArray","ribFloats","ribTextArray",
"ribPL","ribParameter","ribCommands","@3","ribComm", NULL
};
#endif

static const short yyr1[] = {     0,
   109,   111,   110,   110,   113,   112,   112,   114,   115,   115,
   116,   116,   117,   117,   118,   118,   120,   119,   119,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
   121
};

static const short yyr2[] = {     0,
     1,     0,     3,     1,     0,     3,     1,     3,     1,     1,
     3,     1,     2,     0,     2,     2,     0,     3,     0,     3,
     1,     2,     1,     1,     1,     4,     2,     5,     7,     5,
     7,     3,     3,     7,     4,     1,     3,     2,     3,     4,
     3,     3,     6,     5,     3,     2,     3,     2,     3,     1,
     1,     2,     2,     9,    11,     4,     3,     4,     4,     3,
     3,     3,     3,     3,     2,     2,     2,     9,     7,     9,
     7,     5,     7,     3,     2,     2,     1,     2,     1,    19,
    19,     2,     4,     4,     5,     8,    10,     3,     3,     2,
     2,     1,     1,     3,     2,     3,     4,     5,     5,    22,
    22,    39,     3,     7,    12,    10,     6,     8,     5,     7,
     6,     8,     9,    11,     6,     8,     5,     7,     7,     9,
     5,     2,     5,     3,    11,     2,     1,     2,     1,     2,
     2,     1,     9,     9,     7,    13,     4,     2,     2,     2,
     1
};

static const short yydefact[] = {     0,
   141,     0,    21,    23,    24,    25,     0,     0,     0,     0,
     0,     0,     0,    36,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,    50,    51,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,    77,     0,    79,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,    92,    93,     0,    14,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,    14,     0,     0,     0,   127,     0,   129,     0,
     0,   132,     0,     0,     0,     0,     0,     0,     0,     1,
    17,     0,    22,     0,    27,     0,     0,     0,     0,    14,
     0,     0,     0,     0,    38,     0,     0,     0,    14,     0,
     0,    14,     0,     4,    10,     9,    46,    48,    14,     9,
    52,    53,     0,     0,    14,     0,     0,    14,    14,    14,
    14,    65,    66,    67,     0,     0,     0,     0,     0,     0,
     0,    75,    76,    78,     0,     0,    82,     0,     0,     0,
     0,     0,    14,    14,    90,    91,    14,     0,    95,    14,
    14,     0,     0,     0,     0,    14,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,    14,   122,     0,     0,   126,   128,
   130,   131,     0,     0,     0,     0,     0,   138,   140,   139,
     0,    20,     0,     0,     0,     0,     0,    32,    33,     0,
     0,    37,    39,     0,    41,    42,     0,     0,    45,     0,
     0,    47,    49,     0,     0,    14,    14,    57,    14,    60,
    61,    62,    63,    64,     0,     0,     0,     0,     0,     0,
    74,     0,     0,     0,     0,     0,     0,     0,    88,    89,
    94,     0,    12,    15,    16,    13,    96,    14,     0,     0,
     0,   103,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
   124,     0,     0,     0,     0,     0,     0,     0,    14,    18,
    26,     0,     0,     0,     0,     0,    35,    40,     0,    14,
     8,     3,     0,     0,    12,    58,    56,    59,     0,     0,
     0,     0,     0,     0,     0,     0,    83,     0,    84,     0,
     0,     5,     0,    97,    14,     0,     0,     0,     0,     0,
     0,     0,     0,     0,    14,     0,     0,     0,     0,     0,
     0,     0,    14,     0,     0,    14,    14,     0,     0,     0,
     0,     0,   137,     0,    28,     0,    30,     0,     0,    44,
     0,     0,     0,     0,     0,     0,     0,    72,     0,     0,
    85,     0,     0,     0,    11,    98,     0,     0,    99,     0,
     0,     0,     0,    14,     0,   109,     0,    14,     0,     0,
     0,    14,     0,   117,     0,     0,   121,   123,     0,     0,
     0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     6,     0,
     0,    14,     0,     0,     0,   107,    14,     0,   111,     0,
     0,     0,   115,    14,     0,    14,     0,     0,     0,    14,
     0,    29,    31,    34,     0,     0,     0,    69,     0,    71,
    73,     0,     0,     0,     0,     0,     0,   104,     0,     0,
    14,   110,    14,     0,     0,    14,   118,     0,   119,     0,
     0,     0,   135,     0,     0,     0,     0,     0,     0,     0,
     0,    86,     0,     0,     0,     0,   108,   112,     0,    14,
   116,    14,     0,    14,    14,     0,     0,    54,    68,    70,
     0,     0,     0,     0,     0,     0,     0,     0,   113,   120,
     0,   133,   134,     0,     0,     0,     0,    87,     0,     0,
     0,   106,    14,     0,     0,    55,     0,     0,     0,     0,
    14,   114,   125,     0,     0,     0,     0,     0,   105,    14,
     0,     0,     0,     0,   136,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,    80,    81,     0,     0,     0,
     0,     0,     0,     0,     0,   100,   101,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,   102,     0,     0,     0
};

static const short yydefgoto[] = {   605,
   125,   231,   333,   384,   130,   264,   265,   169,   170,   100,
   211,   101
};

static const short yypact[] = {   491,
-32768,   -99,   -74,-32768,-32768,-32768,   -63,   -62,   -86,   -85,
   -41,   -55,   -30,   -28,   -27,   -26,   -25,   -22,   -23,   -20,
   -19,   -18,   -17,   -84,   -15,   -16,-32768,-32768,   -84,   -84,
   -83,   -12,    -9,    -8,    -5,    -3,    -1,     0,     2,     1,
     3,   -78,   -77,   -76,     6,     7,     8,-32768,     9,-32768,
     4,    11,    10,    12,    13,    14,   -75,    18,    19,    20,
    21,-32768,-32768,    22,    23,    15,    15,    15,  -100,    24,
    25,    26,    15,   -69,   -68,   -67,   -56,   -53,   -50,   -48,
    27,    29,    23,    28,    31,    32,-32768,    33,-32768,    34,
   -84,-32768,    37,    38,    39,    40,    41,    44,   -98,-32768,
-32768,    45,-32768,    46,-32768,    48,    49,    50,    51,    23,
    52,    53,    54,    55,-32768,    58,    60,    61,    23,    63,
    47,    23,    64,    66,-32768,    15,-32768,-32768,    23,-32768,
-32768,-32768,    67,    68,   -47,    69,    70,    23,    23,    23,
    23,-32768,-32768,-32768,    71,    72,    73,    74,    75,    76,
    77,-32768,-32768,-32768,    78,    79,-32768,    80,    81,    82,
    83,    84,    23,    23,-32768,-32768,    23,   -92,-32768,    23,
    23,    15,    15,    85,    86,    23,    87,    89,    15,    90,
    91,    92,    93,    94,    95,    96,    97,    98,    99,   100,
   101,   102,   103,    15,    23,-32768,    15,   -42,-32768,-32768,
-32768,-32768,   106,   107,   108,   109,   110,-32768,-32768,-32768,
   491,-32768,   111,   112,   113,   114,   115,-32768,-32768,   116,
   117,-32768,-32768,   118,-32768,-32768,   120,   123,-32768,   125,
    64,-32768,-32768,   124,   126,   -91,    23,-32768,    23,-32768,
-32768,-32768,-32768,-32768,   127,   128,   129,   131,   132,   133,
-32768,   134,   135,   136,   138,   139,   140,   141,-32768,-32768,
-32768,   -35,-32768,-32768,-32768,-32768,-32768,    23,    15,   144,
   -32,-32768,   147,    15,    15,   146,   148,   149,   150,   151,
   152,   153,   154,   156,   157,   158,   159,   160,   161,   164,
-32768,   -42,   165,    35,   166,   168,   169,   170,    23,-32768,
-32768,   171,   172,   174,   175,   178,-32768,-32768,   179,    23,
-32768,-32768,   180,   181,   -92,-32768,-32768,-32768,   182,   183,
   184,   185,   186,   187,   188,   189,-32768,   190,-32768,   191,
   192,   173,   196,-32768,    23,   194,   195,   197,   198,   199,
    15,   200,   201,   202,    23,   203,   204,   205,   206,   207,
   208,   210,    23,   211,   212,    23,    23,   213,   217,   218,
   219,   222,-32768,   221,-32768,   223,-32768,   224,   225,-32768,
   226,   227,   228,   229,   230,   231,   232,-32768,   233,   234,
-32768,   235,   236,   165,-32768,-32768,   237,   238,-32768,   241,
   240,    15,   242,    23,   220,-32768,   243,    23,   244,   245,
   246,    23,   250,-32768,   248,   249,-32768,-32768,   251,   252,
   255,   254,   257,   259,   261,   262,-32768,   263,   265,   267,
   268,   269,   271,   264,   272,   273,   274,   275,-32768,   276,
   277,    23,   278,    15,   282,-32768,    23,   283,-32768,   281,
   284,   285,-32768,    23,   286,    23,   287,   288,   289,    23,
   292,-32768,-32768,-32768,   294,   295,   297,-32768,   298,-32768,
-32768,   299,   300,   301,   303,   304,   305,-32768,   306,    15,
    23,-32768,    23,   307,   308,    23,-32768,   312,-32768,   310,
   311,   313,-32768,   314,   315,   316,   317,   320,   318,   319,
   321,-32768,   323,   326,    15,    15,-32768,-32768,   327,    23,
-32768,    23,   328,    23,    23,   329,   330,-32768,-32768,-32768,
   331,   332,   336,   334,   335,   337,    15,   339,-32768,-32768,
   340,-32768,-32768,   341,   344,   342,   343,-32768,   345,   346,
   347,-32768,    23,   351,   349,-32768,   350,   352,   354,   355,
    23,-32768,-32768,   356,   357,   358,   359,   360,-32768,    23,
   362,   365,   366,   367,-32768,   368,   369,   371,   372,   373,
   374,   375,   376,   377,   378,   379,   380,   381,   382,   468,
   483,   489,   490,   492,   488,-32768,-32768,   493,   494,   -29,
   495,   496,   497,   498,   499,-32768,-32768,   500,   501,   502,
   503,   504,   505,   506,   507,   508,   509,   510,   511,   512,
   513,   517,   515,-32768,   391,   393,-32768
};

static const short yypgoto[] = {-32768,
  -122,-32768,  -308,-32768,   -24,   -21,  -196,   -72,-32768,  -132,
-32768,-32768
};


#define	YYLAST		623


static const short yytable[] = {   126,
   230,   294,   127,   174,   209,   175,   102,   131,   132,   210,
   196,   262,   262,   263,   315,   124,   124,   106,   108,   123,
   133,   107,   109,   124,   134,   145,   147,   149,   161,   146,
   148,   150,   162,   103,   180,   182,   184,   218,   181,   183,
   185,   171,   172,   173,   104,   105,   226,   186,   179,   229,
   188,   187,   111,   190,   189,   192,   233,   191,   236,   193,
   237,   293,   238,   263,   110,   241,   242,   243,   244,   202,
   332,   337,   124,   338,   582,   429,   583,   112,   300,   113,
   114,   115,   116,   117,   118,   119,   120,   121,   122,   129,
   259,   260,   128,   135,   261,   357,   136,   266,   267,   137,
   138,   232,   139,   272,   140,   141,   143,   155,   312,   142,
   144,   151,   152,   153,   156,     0,   154,   157,   123,   158,
   159,   160,   291,   163,   164,   165,   166,   167,   168,   176,
   177,     0,   194,   178,   195,   197,   198,   199,   358,   230,
   200,   201,   203,   204,   205,   206,   207,   268,   269,   208,
   212,     0,   228,   213,   275,   214,   215,   216,   217,   219,
   220,   221,   222,   316,   317,   223,   318,   224,   225,   290,
   227,   124,   292,    -2,   234,   235,   239,   240,   245,   246,
   247,   248,   249,   250,   251,   252,   253,   254,   255,   256,
   257,   258,   270,   271,   273,   334,   274,   276,   277,   278,
   279,   280,   281,   282,   283,   284,   285,   286,   287,   288,
   289,   295,   296,   297,   298,   299,     0,     0,   301,   302,
   303,   304,   305,   306,   307,   308,   363,   309,   310,   311,
     0,   313,     0,   314,   319,   320,   321,   370,   322,   323,
   324,   325,   326,   327,   335,   328,   329,   330,   331,   340,
   341,   336,   339,   342,     0,   343,   344,   345,   346,   347,
   348,   349,   386,   350,   351,   352,   353,   354,   355,   356,
   332,   359,   396,   360,   361,   362,     0,    -7,   364,   365,
   404,   366,   367,   407,   408,   368,   369,   371,   372,   373,
   374,   375,   376,   377,   378,   379,   380,   381,   382,   383,
   385,   387,   388,     0,   389,   390,   391,   393,   394,   395,
   397,   398,   399,   400,   401,   402,   392,   403,   405,   406,
   409,   436,   410,   411,   437,   439,   412,   413,   414,   443,
   415,   416,   417,   418,   419,   420,   421,   422,   423,   424,
   425,   426,   427,   428,   430,   431,   432,   433,     0,   435,
   438,   440,   441,   442,   444,   445,   446,   448,   447,   468,
   449,   450,   451,   452,   472,   453,     0,   434,   461,   454,
   455,   477,   456,   479,   457,   458,   459,   483,   460,   462,
   463,   464,   465,   466,   467,   469,   471,   473,   474,   476,
   606,   475,   607,   478,   480,   481,   482,   484,   497,     0,
   498,   485,   486,   501,   487,   488,   489,   490,   491,   470,
   492,   493,   494,   495,   499,   500,   502,   503,   504,   506,
   505,   509,   507,   508,   510,   511,   512,   519,   513,   520,
   514,   522,   523,   515,   518,   521,   524,   525,   526,   527,
   528,   529,   530,   533,   531,   496,   535,   534,   536,   537,
   538,     0,   539,   540,   541,   543,   544,   545,     0,   546,
   542,   547,   548,   550,   551,   552,   553,   554,   549,   556,
   516,   517,   557,   558,   559,   560,   561,   555,   562,   563,
   564,   565,   566,   567,   568,   569,   570,   571,   572,   573,
   -19,     1,   532,     2,     3,     4,     5,     6,     7,     8,
     9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
    19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
    29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
    39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
    49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
    59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
    69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
    79,    80,    81,    82,    83,   574,    84,    85,    86,    87,
    88,    89,    90,    91,    92,    93,    94,    95,    96,    97,
   575,    98,    99,   576,   577,   579,   578,     0,     0,   584,
   580,   581,     0,   585,   586,   587,   588,   589,   590,   591,
   592,   593,   594,   595,   596,   597,   598,   599,   600,   601,
   602,   603,   604
};

static const short yycheck[] = {    24,
   123,   198,    24,   104,   103,   106,   106,    29,    30,   108,
    83,   104,   104,   106,   106,   108,   108,   104,   104,   104,
   104,   108,   108,   108,   108,   104,   104,   104,   104,   108,
   108,   108,   108,   108,   104,   104,   104,   110,   108,   108,
   108,    66,    67,    68,   108,   108,   119,   104,    73,   122,
   104,   108,   108,   104,   108,   104,   129,   108,   106,   108,
   108,   104,   135,   106,   106,   138,   139,   140,   141,    91,
   106,   104,   108,   106,   104,   384,   106,   108,   211,   108,
   108,   108,   108,   106,   108,   106,   106,   106,   106,   106,
   163,   164,   108,   106,   167,   292,   106,   170,   171,   108,
   106,   126,   106,   176,   106,   106,   106,   104,   231,   108,
   108,   106,   106,   106,   104,    -1,   108,   108,   104,   108,
   108,   108,   195,   106,   106,   106,   106,   106,   106,   106,
   106,    -1,   106,   108,   106,   108,   106,   106,   104,   262,
   108,   108,   106,   106,   106,   106,   106,   172,   173,   106,
   106,    -1,   106,   108,   179,   108,   108,   108,   108,   108,
   108,   108,   108,   236,   237,   108,   239,   108,   108,   194,
   108,   108,   197,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   268,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   108,
   108,   106,   106,   106,   106,   106,    -1,    -1,   108,   108,
   108,   108,   108,   108,   108,   108,   299,   108,   106,   105,
    -1,   108,    -1,   108,   108,   108,   108,   310,   108,   108,
   108,   108,   108,   108,   269,   108,   108,   108,   108,   274,
   275,   108,   106,   108,    -1,   108,   108,   108,   108,   108,
   108,   108,   335,   108,   108,   108,   108,   108,   108,   106,
   106,   106,   345,   106,   106,   106,    -1,   105,   108,   108,
   353,   108,   108,   356,   357,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   108,
   105,   108,   108,    -1,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   341,   108,   108,   108,
   108,   394,   106,   106,   105,   398,   108,   106,   108,   402,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   106,   108,    -1,   108,
   108,   108,   108,   108,   105,   108,   108,   106,   108,   432,
   106,   108,   106,   105,   437,   105,    -1,   392,   105,   108,
   108,   444,   108,   446,   108,   108,   108,   450,   108,   108,
   108,   108,   108,   108,   108,   108,   105,   105,   108,   105,
     0,   108,     0,   108,   108,   108,   108,   106,   471,    -1,
   473,   108,   108,   476,   108,   108,   108,   108,   108,   434,
   108,   108,   108,   108,   108,   108,   105,   108,   108,   106,
   108,   105,   108,   108,   105,   108,   108,   500,   108,   502,
   108,   504,   505,   108,   108,   108,   108,   108,   108,   108,
   105,   108,   108,   105,   108,   470,   106,   108,   105,   108,
   108,    -1,   108,   108,   108,   105,   108,   108,    -1,   108,
   533,   108,   108,   108,   108,   108,   108,   108,   541,   108,
   495,   496,   108,   108,   108,   108,   108,   550,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   108,
     0,     1,   517,     3,     4,     5,     6,     7,     8,     9,
    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
    20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
    30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
    40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
    50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
    60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
    70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
    80,    81,    82,    83,    84,   108,    86,    87,    88,    89,
    90,    91,    92,    93,    94,    95,    96,    97,    98,    99,
   108,   101,   102,   105,   105,   108,   105,    -1,    -1,   105,
   108,   108,    -1,   108,   108,   108,   108,   108,   108,   108,
   108,   108,   108,   108,   108,   108,   108,   108,   108,   108,
   108,   105,   108
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
 #pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc.  */
#endif /* not GNU C.  */
#endif /* alloca not defined.  */

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	return(0)
#define YYABORT 	return(1)
#define YYERROR		goto yyerrlab1
/* Like YYERROR except do call yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(token, value) \
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    { yychar = (token), yylval = (value);			\
      yychar1 = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

int	yychar;			/*  the lookahead symbol		*/
YYSTYPE	yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

#ifdef YYLSP_NEEDED
YYLTYPE yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/
#endif

int yynerrs;			/*  number of parse errors so far       */
#endif  /* not YYPURE */

#if YYDEBUG != 0
int yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

/*  YYMAXDEPTH is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
int yyparse (void);
#endif

#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
#define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
#else				/* not GNU C or C++ */
#ifndef __cplusplus

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (to, from, count)
     char *to;
     char *from;
     int count;
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#else /* __cplusplus */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (char *to, char *from, int count)
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#endif
#endif


/* The user can define YYPARSE_PARAM as the name of an argument to be passed
   into yyparse.  The argument should have type void *.
   It should actually point to an object.
   Grammar actions can access the variable by casting it
   to the proper pointer type.  */

#ifdef YYPARSE_PARAM
#ifdef __cplusplus
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* not __cplusplus */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#endif /* not __cplusplus */
#else /* not YYPARSE_PARAM */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */

int
yyparse(YYPARSE_PARAM_ARG)
     YYPARSE_PARAM_DECL
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/

  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */

#ifdef YYLSP_NEEDED
  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
  YYLTYPE *yyls = yylsa;
  YYLTYPE *yylsp;

#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  int yystacksize = YYINITDEPTH;

#ifdef YYPURE
  int yychar;
  YYSTYPE yylval;
  int yynerrs;
#ifdef YYLSP_NEEDED
  YYLTYPE yylloc;
#endif
#endif

  YYSTYPE yyval;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int yylen;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
#ifdef YYLSP_NEEDED
  yylsp = yyls;
#endif

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
      YYLTYPE *yyls1 = yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
#ifdef YYLSP_NEEDED
      /* This used to be a conditional around just the two extra args,
	 but that might be undefined if yyoverflow is a macro.  */
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yyls1, size * sizeof (*yylsp),
		 &yystacksize);
#else
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yystacksize);
#endif

      yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
      yyls = yyls1;
#endif
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	{
	  yyerror("parser stack overflow");
	  return 2;
	}
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;
      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

  goto yybackup;
 yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(yychar);

#if YYDEBUG != 0
      if (yydebug)
	{
	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise meaning
	     of a token, for further debugging info.  */
#ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
#endif
	  fprintf (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* count tokens shifted since error; after three, turn off error status.  */
  if (yyerrstatus) yyerrstatus--;

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (yydebug)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
	       yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif


  switch (yyn) {

case 2:
#line 533 "rib.y"
{
					(*arguments)[currentArgument++].real		=	yyvsp[0].real;
					argumentCounter++;
				;
    break;}
case 3:
#line 538 "rib.y"
{
					yyval.integer	=	yyvsp[0].integer;
				;
    break;}
case 4:
#line 543 "rib.y"
{
					int	arr;

					(*arguments)[currentArgument++].real		=	yyvsp[0].real;
					argumentCounter++;
					arr											=	argumentCounter;
					argumentCounter								=	0;
					yyval.integer = arr;
				;
    break;}
case 5:
#line 555 "rib.y"
{
					char	*theString	=	sdup(yyvsp[0].string);
					(*arguments)[currentArgument++].string		=	theString;
					allocatedStrings->push(theString);
					argumentCounter++;
				;
    break;}
case 6:
#line 562 "rib.y"
{
					yyval.integer	=	yyvsp[0].integer;
				;
    break;}
case 7:
#line 567 "rib.y"
{
					int	arr;
					char	*theString	=	sdup(yyvsp[0].string);
					(*arguments)[currentArgument++].string		=	theString;
					allocatedStrings->push(theString);
					argumentCounter++;
					arr											=	argumentCounter;
					argumentCounter								=	0;
					yyval.integer = arr;
				;
    break;}
case 8:
#line 582 "rib.y"
{
					yyval.integer = yyvsp[-1].integer;
				;
    break;}
case 9:
#line 589 "rib.y"
{
					yyval.integer	=	yyvsp[0].integer;
				;
    break;}
case 10:
#line 594 "rib.y"
{
					yyval.integer	=	yyvsp[0].integer;
				;
    break;}
case 11:
#line 602 "rib.y"
{
					yyval.integer	=	yyvsp[-1].integer;
				;
    break;}
case 12:
#line 607 "rib.y"
{
					int	arr;
					char	*theString	=	sdup(yyvsp[0].string);
					(*arguments)[currentArgument++].string		=	theString;
					allocatedStrings->push(theString);
					argumentCounter++;
					arr											=	argumentCounter;
					argumentCounter								=	0;
					yyval.integer = arr;
				;
    break;}
case 13:
#line 621 "rib.y"
{
				;
    break;}
case 14:
#line 624 "rib.y"
{
					int	i;

					// Fix the pointers
					for (i=0;i<numParameters;i++) {
						(*tokens)[i]				=	(*parameterList)[i].name;
						(*vals)[i]					=	(RtPointer) &(*arguments)[(*parameterList)[i].valuesStart];
						(*parameterList)[i].values	=	&(*arguments)[(*parameterList)[i].valuesStart];
					}
				;
    break;}
case 15:
#line 638 "rib.y"
{
					// A parameter is either a float array
					(*parameterList)[numParameters].name		=	yyvsp[-1].string;
					(*parameterList)[numParameters].type		=	RT_FLOAT;
					(*parameterList)[numParameters].numItems	=	yyvsp[0].integer;
					(*parameterList)[numParameters].valuesStart	=	currentArgument-yyvsp[0].integer;
					(*tokens)[numParameters]					=	yyvsp[-1].string;
					(*vals)[numParameters]						=	(RtPointer) getFloat(currentArgument-yyvsp[0].integer,yyvsp[0].integer);
					numParameters++;
				;
    break;}
case 16:
#line 651 "rib.y"
{
					// Or a string array
					(*parameterList)[numParameters].name		=	yyvsp[-1].string;
					(*parameterList)[numParameters].type		=	RT_TEXT;
					(*parameterList)[numParameters].numItems	=	yyvsp[0].integer;
					(*parameterList)[numParameters].valuesStart	=	currentArgument-yyvsp[0].integer;
					(*tokens)[numParameters]					=	yyvsp[-1].string;
					(*vals)[numParameters]						=	(RtPointer) getString(currentArgument-yyvsp[0].integer,yyvsp[0].integer);
					numParameters++;
				;
    break;}
case 17:
#line 665 "rib.y"
{
					char	*currentString;
					currentArgument	=	0;
					argumentCounter	=	0;
					numParameters	=	0;
					commandIgnore	=	FALSE;
					while((currentString=allocatedStrings->pop()) != NULL)
						sfree(currentString);

				;
    break;}
case 19:
#line 677 "rib.y"
{
				;
    break;}
case 20:
#line 685 "rib.y"
{
					if (!commandIgnore) {
						RiDeclare(yyvsp[-1].string,yyvsp[0].string);
					}

					badParameters;
				;
    break;}
case 21:
#line 694 "rib.y"
{
					if (!commandIgnore)
						RiFrameBegin(0);

					badParameters;
				;
    break;}
case 22:
#line 703 "rib.y"
{
					if (!commandIgnore)
						RiFrameBegin((int) yyvsp[0].real);

					badParameters;
				;
    break;}
case 23:
#line 711 "rib.y"
{
					if (!commandIgnore)
						RiFrameEnd();
				;
    break;}
case 24:
#line 717 "rib.y"
{
					if (!commandIgnore)
						RiWorldBegin();

					badParameters;
				;
    break;}
case 25:
#line 725 "rib.y"
{
					if (!commandIgnore)
						RiWorldEnd();

					badParameters;
				;
    break;}
case 26:
#line 736 "rib.y"
{
					if (!commandIgnore) {
						RiFormat((int) yyvsp[-2].real,(int) yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 27:
#line 746 "rib.y"
{
					if (!commandIgnore) {
						RiFrameAspectRatio(yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 28:
#line 759 "rib.y"
{
					if (!commandIgnore) {
						RiScreenWindow(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 29:
#line 774 "rib.y"
{
					if (!commandIgnore) {
						RiScreenWindow(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
					}

					badParameters;
				;
    break;}
case 30:
#line 787 "rib.y"
{
					if (!commandIgnore) {
						RiCropWindow(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 31:
#line 802 "rib.y"
{
					if (!commandIgnore) {
						RiCropWindow(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
					}

					badParameters;
				;
    break;}
case 32:
#line 813 "rib.y"
{
					if ((!commandIgnore) && (parameterListCheck())) {
						RiProjectionV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 33:
#line 824 "rib.y"
{
					if (!commandIgnore) {
						RiClipping(yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 34:
#line 839 "rib.y"
{
					if (!commandIgnore) {
						RiClippingPlane(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}
				;
    break;}
case 35:
#line 849 "rib.y"
{
					if (!commandIgnore) {
						RiDepthOfField(yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 36:
#line 858 "rib.y"
{
				;
    break;}
case 37:
#line 864 "rib.y"
{
					if (!commandIgnore) {
						RiShutter(yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 38:
#line 874 "rib.y"
{
					if (!commandIgnore) {
						RiPixelVariance(yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 39:
#line 885 "rib.y"
{
					if (!commandIgnore) {
						RiPixelSamples(yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 40:
#line 897 "rib.y"
{
					RtFilterFunc	f;

					if ((!commandIgnore) && ((f = getFilter(yyvsp[-2].string)) != NULL)) {
						RiPixelFilter(f,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 41:
#line 910 "rib.y"
{
					if (!commandIgnore) {
						RiExposure(yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 42:
#line 921 "rib.y"
{
					// No parameter list checking is performed for the shaders
					if (!commandIgnore) {
						RiImagerV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 43:
#line 936 "rib.y"
{
					if (!commandIgnore) {
						RiQuantize(yyvsp[-4].string,(int) yyvsp[-3].real,(int) yyvsp[-2].real,(int) yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 44:
#line 949 "rib.y"
{
					if ((!commandIgnore) && (parameterListCheck())) {
						RiDisplayV(yyvsp[-3].string,yyvsp[-2].string,yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 45:
#line 960 "rib.y"
{
					if ((!commandIgnore) && (parameterListCheck())) {
						RiHiderV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 46:
#line 970 "rib.y"
{
					if ((currentArgument & 1) || ((currentArgument % 6) != 0)) {
						riberror("ColorSamples: Invalid number of arguments (\"%d\") \n",currentArgument);
					} else {
						int		n		=	currentArgument/6;
						float	*argf1	=	getFloat(0,n*3);
						float	*argf2	=	getFloat(n*3,n*6);

						RiColorSamples(n,argf1,argf2);
					}
				;
    break;}
case 47:
#line 985 "rib.y"
{
					if ((yyvsp[-1].integer != yyvsp[0].integer) || ((currentArgument % 6) != 0)) {
						riberror("ColorSamples: Invalid number of arguments (\"%d\") \n",currentArgument);
					} else {
						int		n		=	currentArgument/6;
						float	*argf1	=	getFloat(0,n*3);
						float	*argf2	=	getFloat(n*3,n*6);

						RiColorSamples(n,argf1,argf2);
					}
				;
    break;}
case 48:
#line 999 "rib.y"
{
					if (!commandIgnore) {
						RiRelativeDetail(yyvsp[0].real);
					}

					badParameters;
					
				;
    break;}
case 49:
#line 1011 "rib.y"
{
					if ((!commandIgnore) && (parameterListCheck())) {
						RiOptionV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 50:
#line 1020 "rib.y"
{
					if (!commandIgnore) {
						RiAttributeBegin();
					}

					badParameters;
				;
    break;}
case 51:
#line 1029 "rib.y"
{
					if (!commandIgnore) {
						RiAttributeEnd();
					}

					badParameters;
				;
    break;}
case 52:
#line 1039 "rib.y"
{
					COptions	*options	=	sfGetOptions(FALSE);
					float		*argf		=	getFloat(0,options->nColorComps);

					if (options != NULL) {
						if ((!commandIgnore) && (currentArgument == options->nColorComps)) {
							RiColor(argf);
						}

						badParameters;
					}
				;
    break;}
case 53:
#line 1054 "rib.y"
{
					COptions	*options	=	sfGetOptions(FALSE);
					float		*argf		=	getFloat(0,options->nColorComps);

					if (options != NULL) {
						if ((!commandIgnore) && (currentArgument == options->nColorComps)) {
							RiOpacity(argf);
						}

						badParameters;
					}
				;
    break;}
case 54:
#line 1076 "rib.y"
{
					if (!commandIgnore) {
						RiTextureCoordinates(yyvsp[-7].real,yyvsp[-6].real,yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 55:
#line 1095 "rib.y"
{
					if (!commandIgnore) {
						RiTextureCoordinates(yyvsp[-8].real,yyvsp[-7].real,yyvsp[-6].real,yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
					}

					badParameters;
				;
    break;}
case 56:
#line 1107 "rib.y"
{
					if (!commandIgnore) {
						if (lights == NULL)	lights	=	new CArray<RtLightHandle>;

						(*lights)[(int) yyvsp[-1].real]	=	RiLightSourceV(yyvsp[-2].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 57:
#line 1120 "rib.y"
{
					if (!commandIgnore) {
						RiLightSourceV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 58:
#line 1132 "rib.y"
{
					if (!commandIgnore) {
						RtLightHandle	cLight;
						CShaderInstance	*cInstance;

						cLight	=	RiLightSourceV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());

						if (cLight != NULL) {
							cInstance			=	(CShaderInstance *) cLight;

							cInstance->group	=	sdup(yyvsp[-2].string);
						}
					}

					badParameters;
				;
    break;}
case 59:
#line 1153 "rib.y"
{
					if (!commandIgnore) {
						if (lights == NULL)	lights	=	new CArray<RtLightHandle>;

						(*lights)[(int) yyvsp[-1].real]	=	RiAreaLightSourceV(yyvsp[-2].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 60:
#line 1166 "rib.y"
{
					if (!commandIgnore) {
						if (lights == NULL)	lights	=	new CArray<RtLightHandle>;

						RiIlluminate((*lights)[(int) yyvsp[-1].real],(int) yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 61:
#line 1179 "rib.y"
{
					if (!commandIgnore) {
						RiSurfaceV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 62:
#line 1190 "rib.y"
{
					if (!commandIgnore) {
						RiAtmosphereV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 63:
#line 1201 "rib.y"
{
					if (!commandIgnore) {
						RiInteriorV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 64:
#line 1212 "rib.y"
{
					if (!commandIgnore) {
						RiExteriorV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 65:
#line 1222 "rib.y"
{
					if (!commandIgnore) {
						RiShadingRate(yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 66:
#line 1232 "rib.y"
{
					if (!commandIgnore) {
						RiShadingInterpolation(yyvsp[0].string);
					}

					badParameters;
				;
    break;}
case 67:
#line 1242 "rib.y"
{
					if (!commandIgnore) {
						RiMatte((RtBoolean) yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 68:
#line 1259 "rib.y"
{
					if (!commandIgnore) {
						RtBound	bound;

						bound[0]	=	yyvsp[-6].real;
						bound[1]	=	yyvsp[-5].real;
						bound[2]	=	yyvsp[-4].real;
						bound[3]	=	yyvsp[-3].real;
						bound[4]	=	yyvsp[-2].real;
						bound[5]	=	yyvsp[-1].real;

						RiBound(bound);
					}

					badParameters;
				;
    break;}
case 69:
#line 1283 "rib.y"
{
					if (!commandIgnore) {
						RtBound	bound;

						bound[0]	=	yyvsp[-5].real;
						bound[1]	=	yyvsp[-4].real;
						bound[2]	=	yyvsp[-3].real;
						bound[3]	=	yyvsp[-2].real;
						bound[4]	=	yyvsp[-1].real;
						bound[5]	=	yyvsp[0].real;

						RiBound(bound);
					}

					badParameters;
				;
    break;}
case 70:
#line 1309 "rib.y"
{
					if (!commandIgnore) {
						RtBound	bound;

						bound[0]	=	yyvsp[-6].real;
						bound[1]	=	yyvsp[-5].real;
						bound[2]	=	yyvsp[-4].real;
						bound[3]	=	yyvsp[-3].real;
						bound[4]	=	yyvsp[-2].real;
						bound[5]	=	yyvsp[-1].real;

						RiDetail(bound);
					}

					badParameters;
				;
    break;}
case 71:
#line 1333 "rib.y"
{
					if (!commandIgnore) {
						RtBound	bound;

						bound[0]	=	yyvsp[-5].real;
						bound[1]	=	yyvsp[-4].real;
						bound[2]	=	yyvsp[-3].real;
						bound[3]	=	yyvsp[-2].real;
						bound[4]	=	yyvsp[-1].real;
						bound[5]	=	yyvsp[0].real;

						RiDetail(bound);
					}

					badParameters;
				;
    break;}
case 72:
#line 1355 "rib.y"
{
					if (!commandIgnore) {
						RiDetailRange(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 73:
#line 1370 "rib.y"
{
					if (!commandIgnore) {
						RiDetailRange(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
					}

					badParameters;
				;
    break;}
case 74:
#line 1381 "rib.y"
{
					if (!commandIgnore) {
						RiGeometricApproximation(yyvsp[-1].string,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 75:
#line 1391 "rib.y"
{
					if (!commandIgnore) {
						RiGeometricRepresentation(yyvsp[0].string);
					}

					badParameters;
				;
    break;}
case 76:
#line 1401 "rib.y"
{
					if (!commandIgnore) {
						RiOrientation(yyvsp[0].string);
					}

					badParameters;
				;
    break;}
case 77:
#line 1410 "rib.y"
{
					if (!commandIgnore) {
						RiReverseOrientation();
					}

					badParameters;
				;
    break;}
case 78:
#line 1420 "rib.y"
{
					if (!commandIgnore) {
						RiSides((int) yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 79:
#line 1429 "rib.y"
{
					if (!commandIgnore) {
						RiIdentity();
					}

					badParameters;
				;
    break;}
case 80:
#line 1456 "rib.y"
{
					if (!commandIgnore)  {
						RtMatrix	tmp;

						tmp[0][0]	=	yyvsp[-16].real;
						tmp[0][1]	=	yyvsp[-15].real;
						tmp[0][2]	=	yyvsp[-14].real;
						tmp[0][3]	=	yyvsp[-13].real;
						tmp[1][0]	=	yyvsp[-12].real;
						tmp[1][1]	=	yyvsp[-11].real;
						tmp[1][2]	=	yyvsp[-10].real;
						tmp[1][3]	=	yyvsp[-9].real;
						tmp[2][0]	=	yyvsp[-8].real;
						tmp[2][1]	=	yyvsp[-7].real;
						tmp[2][2]	=	yyvsp[-6].real;
						tmp[2][3]	=	yyvsp[-5].real;
						tmp[3][0]	=	yyvsp[-4].real;
						tmp[3][1]	=	yyvsp[-3].real;
						tmp[3][2]	=	yyvsp[-2].real;
						tmp[3][3]	=	yyvsp[-1].real;

						RiTransform(tmp);
					}

					badParameters;
				;
    break;}
case 81:
#line 1502 "rib.y"
{
					if (!commandIgnore) {
						RtMatrix	tmp;

						tmp[0][0]	=	yyvsp[-16].real;
						tmp[0][1]	=	yyvsp[-15].real	;
						tmp[0][2]	=	yyvsp[-14].real;
						tmp[0][3]	=	yyvsp[-13].real;
						tmp[1][0]	=	yyvsp[-12].real;
						tmp[1][1]	=	yyvsp[-11].real;
						tmp[1][2]	=	yyvsp[-10].real;
						tmp[1][3]	=	yyvsp[-9].real;
						tmp[2][0]	=	yyvsp[-8].real;
						tmp[2][1]	=	yyvsp[-7].real;
						tmp[2][2]	=	yyvsp[-6].real;
						tmp[2][3]	=	yyvsp[-5].real;
						tmp[3][0]	=	yyvsp[-4].real;
						tmp[3][1]	=	yyvsp[-3].real;
						tmp[3][2]	=	yyvsp[-2].real;
						tmp[3][3]	=	yyvsp[-1].real;

						RiConcatTransform(tmp);
					}

					badParameters;
				;
    break;}
case 82:
#line 1531 "rib.y"
{
					if (!commandIgnore) {
						RiPerspective(yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 83:
#line 1543 "rib.y"
{
					if (!commandIgnore) {
						RiTranslate(yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 84:
#line 1555 "rib.y"
{
					if (!commandIgnore) {
						RiScale(yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 85:
#line 1568 "rib.y"
{
					if (!commandIgnore) {
						RiRotate(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 86:
#line 1584 "rib.y"
{
					if (!commandIgnore)  {
						RiSkew(yyvsp[-6].real,yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 87:
#line 1602 "rib.y"
{
					if (!commandIgnore)  {
						RiSkew(yyvsp[-7].real,yyvsp[-6].real,yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
					}

					badParameters;
				;
    break;}
case 88:
#line 1613 "rib.y"
{
					if (!commandIgnore) {
						RiDeformationV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 89:
#line 1624 "rib.y"
{
					if (!commandIgnore) {
						RiDisplacementV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 90:
#line 1634 "rib.y"
{
					if (!commandIgnore) {
						RiCoordinateSystem(yyvsp[0].string);
					}

					badParameters;
				;
    break;}
case 91:
#line 1644 "rib.y"
{
					if (!commandIgnore) {
						RiCoordSysTransform(yyvsp[0].string);
					}

					badParameters;
				;
    break;}
case 92:
#line 1653 "rib.y"
{
					if (!commandIgnore) {
						RiTransformBegin();
					}

					badParameters;
				;
    break;}
case 93:
#line 1662 "rib.y"
{
					if (!commandIgnore) {
						RiTransformEnd();
					}

					badParameters;
				;
    break;}
case 94:
#line 1673 "rib.y"
{
					if ((!commandIgnore) && (parameterListCheck())) {
						RiAttributeV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 95:
#line 1683 "rib.y"
{
					int	numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {	
						if ((numVertex <= 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a polygon\n");
						} else {
							RiPolygonV(numVertex,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 96:
#line 1700 "rib.y"
{
					int		*argi	=	getInt(0,yyvsp[-1].integer);
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex <= 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a polygon\n");
						} else {
							RiGeneralPolygonV(yyvsp[-1].integer,argi,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 97:
#line 1719 "rib.y"
{
					int	*argi1		=	getInt(0,yyvsp[-2].integer);
					int	*argi2		=	getInt(yyvsp[-2].integer,yyvsp[-1].integer);
					int	numVertex,numUniform,numVarying;
					int	nvertices	=	0;
					int	i;
					int	maxVertex	=	0;

					// Find out how many items are in verts array
					for (i=0;i<yyvsp[-2].integer;i++) {
						nvertices	+=	argi1[i];
					}

					if (nvertices != yyvsp[-1].integer) {
						riberror("Number of vertices in the array doesn't match the one counted in the loops array\n");
					} else {
						// Find out the number of vertices required
						for (i=0,maxVertex=0;i<nvertices;i++) {
							if (argi2[i] > maxVertex)
								maxVertex	=	argi2[i];
						}

						if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
							if ((numVertex != maxVertex) || ((numUniform != -1) && (numUniform != yyvsp[-2].integer)) || ((numVarying != -1) && (numVarying != 4*(yyvsp[-2].integer)))) {
								riberror("Invalid number of parameters for a polygon\n");
							} else {
								RiPointsPolygonsV(yyvsp[-2].integer,argi1,argi2,numParameters,tokens->getArray(),vals->getArray());
							}
						}

						badParameters;
					}
				;
    break;}
case 98:
#line 1758 "rib.y"
{
					int	*argi1		=	getInt(0,yyvsp[-3].integer);
					int	*argi2		=	getInt(yyvsp[-3].integer,yyvsp[-2].integer);
					int	*argi3		=	getInt(yyvsp[-2].integer,yyvsp[-1].integer);
					int	numVertex,numUniform,numVarying;
					int	numvertices	=	0;
					int	numloops	=	0;
					int	maxVertex	=	0;
					int	i;

					for (i=0;i<yyvsp[-3].integer;i++) {
						numloops	+=	argi1[i];
					}

					if (numloops != yyvsp[-2].integer) {
						riberror("Number of loops doesn't match the one counted in the loops array\n");
					} else {
						for (i=0;i<yyvsp[-2].integer;i++) {
							numvertices	+=	argi2[i];
						}

						if (numvertices != yyvsp[-1].integer) {
							riberror("Number of vertices doesn't match the one counted in the loops array\n");
						} else {
							for (i=0;i<numvertices;i++) {
								if (argi3[i] > maxVertex)
									maxVertex	=	argi3[i];
							}

							if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
								if ((numVertex != maxVertex) || ((numUniform != -1) && (numUniform != yyvsp[-3].integer)) || ((numVarying != -1) && (numVarying != 4*(yyvsp[-3].integer)))) {
									riberror("Invalid number of parameters for a polygon\n");
								} else {
									RiPointsGeneralPolygonsV(yyvsp[-3].integer,argi1,argi2,argi3,numParameters,tokens->getArray(),vals->getArray());
								}
							}

							badParameters;
						}
					}
				;
    break;}
case 99:
#line 1805 "rib.y"
{
					RtBasis	*argf1,*argf2;

					if ((!commandIgnore) && (getBasis(&argf1,yyvsp[-3].string)) && (getBasis(&argf2,yyvsp[-1].string))) {
						RiBasis(argf1[0],(int) yyvsp[-2].real, argf2[0],(int) yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 100:
#line 1837 "rib.y"
{
					RtBasis	*argf2;

					if ((!commandIgnore) && (getBasis(&argf2,yyvsp[-1].string))) {
						RtBasis	tmp;
					
						tmp[0][0]	=	yyvsp[-19].real;
						tmp[0][1]	=	yyvsp[-18].real;
						tmp[0][2]	=	yyvsp[-17].real;
						tmp[0][3]	=	yyvsp[-16].real;
						tmp[1][0]	=	yyvsp[-15].real;
						tmp[1][1]	=	yyvsp[-14].real;
						tmp[1][2]	=	yyvsp[-13].real;
						tmp[1][3]	=	yyvsp[-12].real;
						tmp[2][0]	=	yyvsp[-11].real;
						tmp[2][1]	=	yyvsp[-10].real;
						tmp[2][2]	=	yyvsp[-9].real;
						tmp[2][3]	=	yyvsp[-8].real;
						tmp[3][0]	=	yyvsp[-7].real;
						tmp[3][1]	=	yyvsp[-6].real;
						tmp[3][2]	=	yyvsp[-5].real;
						tmp[3][3]	=	yyvsp[-4].real;
										
						RiBasis(tmp,(int) yyvsp[-2].real,argf2[0],(int) yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 101:
#line 1888 "rib.y"
{
					RtBasis	*argf1;

					if ((!commandIgnore) && (getBasis(&argf1,yyvsp[-20].string))) {
						RtBasis	tmp;
					
						tmp[0][0]	=	yyvsp[-17].real;
						tmp[0][1]	=	yyvsp[-16].real;
						tmp[0][2]	=	yyvsp[-15].real;
						tmp[0][3]	=	yyvsp[-14].real;
						tmp[1][0]	=	yyvsp[-13].real;
						tmp[1][1]	=	yyvsp[-12].real;
						tmp[1][2]	=	yyvsp[-11].real;
						tmp[1][3]	=	yyvsp[-10].real;
						tmp[2][0]	=	yyvsp[-9].real;
						tmp[2][1]	=	yyvsp[-8].real;
						tmp[2][2]	=	yyvsp[-7].real;
						tmp[2][3]	=	yyvsp[-6].real;
						tmp[3][0]	=	yyvsp[-5].real;
						tmp[3][1]	=	yyvsp[-4].real;
						tmp[3][2]	=	yyvsp[-3].real;
						tmp[3][3]	=	yyvsp[-2].real;

						RiBasis(argf1[0],(int) yyvsp[-19].real,tmp,(int) yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 102:
#line 1956 "rib.y"
{
					if (!commandIgnore) {
						RtBasis	b1,b2;

						b1[0][0]	=	yyvsp[-36].real;
						b1[0][1]	=	yyvsp[-35].real;
						b1[0][2]	=	yyvsp[-34].real;
						b1[0][3]	=	yyvsp[-33].real;
						b1[1][0]	=	yyvsp[-32].real;
						b1[1][1]	=	yyvsp[-31].real;
						b1[1][2]	=	yyvsp[-30].real;
						b1[1][3]	=	yyvsp[-29].real;
						b1[2][0]	=	yyvsp[-28].real;
						b1[2][1]	=	yyvsp[-27].real;
						b1[2][2]	=	yyvsp[-26].real;
						b1[2][3]	=	yyvsp[-25].real;
						b1[3][0]	=	yyvsp[-24].real;
						b1[3][1]	=	yyvsp[-23].real;
						b1[3][2]	=	yyvsp[-22].real;
						b1[3][3]	=	yyvsp[-21].real;

						b2[0][0]	=	yyvsp[-17].real;
						b2[0][1]	=	yyvsp[-16].real;
						b2[0][2]	=	yyvsp[-15].real;
						b2[0][3]	=	yyvsp[-14].real;
						b2[1][0]	=	yyvsp[-13].real;
						b2[1][1]	=	yyvsp[-12].real;
						b2[1][2]	=	yyvsp[-11].real;
						b2[1][3]	=	yyvsp[-10].real;
						b2[2][0]	=	yyvsp[-9].real;
						b2[2][1]	=	yyvsp[-8].real;
						b2[2][2]	=	yyvsp[-7].real;
						b2[2][3]	=	yyvsp[-6].real;
						b2[3][0]	=	yyvsp[-5].real;
						b2[3][1]	=	yyvsp[-4].real;
						b2[3][2]	=	yyvsp[-3].real;
						b2[3][3]	=	yyvsp[-2].real;

						RiBasis(b1,(int) yyvsp[-19].real,b2,(int) yyvsp[0].real);
					}

					badParameters;
				;
    break;}
case 103:
#line 2003 "rib.y"
{
					int	numVertex,numUniform,numVarying;
					int	numExpectedVertices;
					int	numExpectedPatches	=	1;


					if (scmp(yyvsp[-1].string,RI_BILINEAR) == 0) {
						numExpectedVertices	=	4;
					} else if (scmp(yyvsp[-1].string,RI_BICUBIC) == 0) {
						numExpectedVertices	=	16;
					} else {
						numExpectedVertices	=	0;
					}

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != numExpectedVertices) || ((numUniform != -1) && (numUniform != numExpectedPatches)) || ((numVarying != -1) && (numVarying != 4*numExpectedPatches))) {
							riberror("Invalid number of parameters for a patch\n");
						} else {
							RiPatchV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 104:
#line 2035 "rib.y"
{
					int	numVertex,numUniform,numVarying;
					int	numExpectedVertices;
					int	numExpectedPatches	=	1;
					int	numuPatches,numvPatches;
					int	nu	=	(int) yyvsp[-4].real;
					int	nv	=	(int) yyvsp[-2].real;
					CAttributes	*attributes	=	sfGetAttributes(FALSE);
					int	uw,vw;

					if (attributes != NULL) {
						if (scmp(yyvsp[-3].string,RI_PERIODIC) == 0) {
							uw	=	TRUE;
						} else {
							uw	=	FALSE;
						}

						if (scmp(yyvsp[-1].string,RI_PERIODIC) == 0) {
							vw	=	TRUE;
						} else {
							vw	=	FALSE;
						}

						if (scmp(yyvsp[-5].string,RI_BILINEAR) == 0) {
							numExpectedVertices	=	nu*nv;

							if (uw) {
								numuPatches	=	nu;
							} else {
								numuPatches	=	nu-1;
							}


							if (vw) {
								numvPatches	=	nv;
							} else {
								numvPatches	=	nv-1;
							}
						} else if (scmp(yyvsp[-5].string,RI_BICUBIC) == 0) {
							numExpectedVertices	=	nu*nv;

							if (uw) {
								numuPatches	=	nu / attributes->uStep;
							} else {
								numuPatches	=	(nu - 4) / attributes->uStep + 1;
							}


							if (vw) {
								numvPatches	=	nv / attributes->vStep;
							} else {
								numvPatches	=	(nv - 4) / attributes->vStep + 1;
							}
						} else {
							numExpectedVertices	=	0;
						}

						numExpectedPatches	=	numuPatches*numvPatches;

						if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
							if ((numVertex != numExpectedVertices) || ((numUniform != -1) && (numUniform != numExpectedPatches)) || ((numVarying != -1) && (numVarying != 4*numExpectedPatches))) {
								riberror("Invalid number of parameters for a patch\n");
							} else {
								RiPatchMeshV(yyvsp[-5].string,(int) yyvsp[-4].real,yyvsp[-3].string,(int) yyvsp[-2].real,yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
							}
						}

						badParameters;
					}
				;
    break;}
case 105:
#line 2118 "rib.y"
{
					float	*argf1	=	getFloat(0,yyvsp[-8].integer);
					float	*argf2	=	getFloat(yyvsp[-8].integer,yyvsp[-3].integer);

					int		uPoints	=	(int) yyvsp[-10].real;
					int		uOrder	=	(int) yyvsp[-9].real;
					int		vPoints	=	(int) yyvsp[-5].real;
					int		vOrder	=	(int) yyvsp[-4].real;

					int		uPatches	=	uPoints - uOrder+1;
					int		vPatches	=	vPoints - vOrder+1;

					int		numVertex,numUniform,numVarying;

					int		numExpectedVertices	=	uPoints*vPoints;
					int		numExpectedPatches	=	uPatches*vPatches;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != numExpectedVertices) || ((numUniform != -1) && (numUniform != numExpectedPatches)) || ((numVarying != -1) && (numVarying != 4*numExpectedPatches))) {
							riberror("Invalid number of parameters for a NURBS patch\n");
						} else {
							RiNuPatchV((int) yyvsp[-10].real,(int) yyvsp[-9].real,argf1,yyvsp[-7].real,yyvsp[-6].real,(int) yyvsp[-5].real,(int) yyvsp[-4].real,argf1,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 106:
#line 2156 "rib.y"
{
					int		*argi1	=	getInt(0,yyvsp[-8].integer);
					int		*argi2	=	getInt(yyvsp[-8].integer,yyvsp[-7].integer);
					float	*argf3	=	getFloat(yyvsp[-7].integer,yyvsp[-6].integer);
					float	*argf4	=	getFloat(yyvsp[-6].integer,yyvsp[-5].integer);
					float	*argf5	=	getFloat(yyvsp[-5].integer,yyvsp[-4].integer);
					int		*argi6	=	getInt(yyvsp[-4].integer,yyvsp[-3].integer);
					float	*argf7	=	getFloat(yyvsp[-3].integer,yyvsp[-2].integer);
					float	*argf8	=	getFloat(yyvsp[-2].integer,yyvsp[-1].integer);
					float	*argf9	=	getFloat(yyvsp[-1].integer,yyvsp[0].integer);

					if (!commandIgnore) {
						RiTrimCurve(yyvsp[-8].integer,argi1,argi2,argf3,argf4,argf5,argi6,argf7,argf8,argf9);
					}

					badParameters;
				;
    break;}
case 107:
#line 2180 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != -1) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a sphere\n");
						} else {
							RiSphereV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 108:
#line 2202 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != -1) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a sphere\n");
						} else {
							RiSphereV(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 109:
#line 2221 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a cone\n");
						} else {
							RiConeV(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 110:
#line 2242 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a cone\n");
						} else {
							RiConeV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 111:
#line 2262 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a cylinder\n");
						} else {
							RiCylinderV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 112:
#line 2284 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a cylinder\n");
						} else {
							RiCylinderV(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 113:
#line 2307 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a hyperboloid\n");
						} else {
							RtPoint	p1,p2;

							p1[0]	=	yyvsp[-7].real;
							p1[1]	=	yyvsp[-6].real;
							p1[2]	=	yyvsp[-5].real;
							p2[0]	=	yyvsp[-4].real;
							p2[1]	=	yyvsp[-3].real;
							p2[2]	=	yyvsp[-2].real;

							RiHyperboloidV(p1,p2,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 114:
#line 2341 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a hyperboloid\n");
						} else {
							RtPoint	p1,p2;

							p1[0]	=	yyvsp[-8].real;
							p1[1]	=	yyvsp[-7].real;
							p1[2]	=	yyvsp[-6].real;
							p2[0]	=	yyvsp[-5].real;
							p2[1]	=	yyvsp[-4].real;
							p2[2]	=	yyvsp[-3].real;

							RiHyperboloidV(p1,p2,yyvsp[-2].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 115:
#line 2370 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a paraboloid\n");
						} else {
							RiParaboloidV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 116:
#line 2392 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a paraboloid\n");
						} else {
							RiParaboloidV(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 117:
#line 2411 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a disk\n");
						} else {
							RiDiskV(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 118:
#line 2432 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a disk\n");
						} else {
							RiDiskV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 119:
#line 2453 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a torus\n");
						} else {
							RiTorusV(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 120:
#line 2476 "rib.y"
{
					int		numVertex,numUniform,numVarying;

					if ((!commandIgnore) && (parameterListCheck(&numVertex,&numVarying,&numUniform))) {
						if ((numVertex != 0) || ((numUniform != -1) && (numUniform != 1)) || ((numVarying != -1) && (numVarying != 4))) {
							riberror("Invalid number of parameters for a torus\n");
						} else {
							RiTorusV(yyvsp[-6].real,yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens->getArray(),vals->getArray());
						}
					}

					badParameters;
				;
    break;}
case 121:
#line 2495 "rib.y"
{
					int	*argi1	=	getInt(0,yyvsp[-2].integer);

					if (!commandIgnore) {
						RiCurvesV(yyvsp[-3].string,yyvsp[-2].integer,argi1,yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 122:
#line 2507 "rib.y"
{
					if (!commandIgnore) {
						// FIXME: Not implemented
					}

					badParameters;

				;
    break;}
case 123:
#line 2521 "rib.y"
{
					if (!commandIgnore) {
						// FIXME: Not implemented
					}

					badParameters;
				;
    break;}
case 124:
#line 2532 "rib.y"
{
					if (!commandIgnore) {
						RiGeometryV(yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 125:
#line 2551 "rib.y"
{
					if (!commandIgnore) {
						RtBound			bound;
						CDelayedData	*cData	=	new CDelayedData;
						char			**arg;

						bound[0]	=	yyvsp[-6].real;
						bound[1]	=	yyvsp[-5].real;
						bound[2]	=	yyvsp[-4].real;
						bound[3]	=	yyvsp[-3].real;
						bound[4]	=	yyvsp[-2].real;
						bound[5]	=	yyvsp[-1].real;

						cData->bmin[COMP_X]	=	yyvsp[-6].real;
						cData->bmin[COMP_Y]	=	yyvsp[-5].real;
						cData->bmin[COMP_Z]	=	yyvsp[-4].real;

						cData->bmax[COMP_X]	=	yyvsp[-3].real;
						cData->bmax[COMP_Y]	=	yyvsp[-2].real;
						cData->bmax[COMP_Z]	=	yyvsp[-1].real;

						if (scmp(yyvsp[-9].string,RI_PROCDELAYEDREADARCHIVE) == 0) {
							if (yyvsp[-8].integer != 1) {
								riberror("Proc delayed archive expects one argument (given %d)\n",yyvsp[-8].integer);
							} else {
								arg		=	getString(0,1);

								cData->generator	=	sdup(arg[0]);

								RiProcedural((RtPointer) cData,bound,RiProcDelayedReadArchive,RiProcFree);
							}
						} else if (scmp(yyvsp[-9].string,RI_PROCRUNPROGRAM) == 0) {
							if (yyvsp[-8].integer != 2) {
								riberror("Proc delayed archive expects two arguments (given %d)\n",yyvsp[-8].integer);
							} else {
								arg		=	getString(0,2);

								cData->generator	=	sdup(arg[0]);
								cData->helper		=	sdup(arg[1]);

								RiProcedural((RtPointer) cData,bound,RiProcRunProgram,RiProcFree);
							}
						} else if (scmp(yyvsp[-9].string,RI_PROCDYNAMICLOAD) == 0) {
							if (yyvsp[-8].integer != 2) {
								riberror("Proc delayed archive expects two arguments (given %d)\n",yyvsp[-8].integer);
							} else {
								arg		=	getString(0,2);

								cData->generator	=	sdup(arg[0]);
								cData->helper		=	sdup(arg[1]);

								RiProcedural((RtPointer) cData,bound,RiProcDynamicLoad,RiProcFree);
							}
						} else {
							riberror("Unknown procedural: %s\n",yyvsp[-9].string);
							delete cData;
						}
					}
				;
    break;}
case 126:
#line 2613 "rib.y"
{
					if (!commandIgnore) {
						RiSolidBegin(yyvsp[0].string);
					}

					badParameters;
				;
    break;}
case 127:
#line 2622 "rib.y"
{
					if (!commandIgnore) {
						RiSolidEnd();
					}

					badParameters;
				;
    break;}
case 128:
#line 2632 "rib.y"
{
					if (!commandIgnore) {
						(*objects)[(int) yyvsp[0].real]	=	RiObjectBegin();
					}

					badParameters;
				;
    break;}
case 129:
#line 2641 "rib.y"
{
					if (!commandIgnore) {
						RiObjectEnd();
					}

					badParameters;
				;
    break;}
case 130:
#line 2651 "rib.y"
{
					if (!commandIgnore) {
						RiObjectInstance((*objects)[(int) yyvsp[0].real]);
					}

					badParameters;
				;
    break;}
case 131:
#line 2661 "rib.y"
{
					float	*argf	=	getFloat(0,yyvsp[0].integer);

					if (!commandIgnore) {
						RiMotionBegin(yyvsp[0].integer,argf);
					}

					badParameters;
				;
    break;}
case 132:
#line 2672 "rib.y"
{
					if (!commandIgnore) {
						RiMotionEnd();
					}

					badParameters;
				;
    break;}
case 133:
#line 2689 "rib.y"
{
					RtFilterFunc	f;

					if ((!commandIgnore) && ((f		=	getFilter(yyvsp[-3].string)) != NULL))  {
						RiMakeTextureV(yyvsp[-7].string,yyvsp[-6].string,yyvsp[-5].string,yyvsp[-4].string,f,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 134:
#line 2708 "rib.y"
{
					RtFilterFunc	f;

					if ((!commandIgnore) && ((f		=	getFilter(yyvsp[-3].string)) != NULL)) {
						RiMakeBumpV(yyvsp[-7].string,yyvsp[-6].string,yyvsp[-5].string,yyvsp[-4].string,f,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 135:
#line 2725 "rib.y"
{
					RtFilterFunc	f;

					if ((!commandIgnore) && ((f		=	getFilter(yyvsp[-3].string)) != NULL)) {
						RiMakeLatLongEnvironmentV(yyvsp[-5].string,yyvsp[-4].string,f,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 136:
#line 2748 "rib.y"
{
					RtFilterFunc	f;

					if ((!commandIgnore) &&  ((f =	getFilter(yyvsp[-3].string)) != NULL)) {
						RiMakeCubeFaceEnvironmentV(yyvsp[-11].string,yyvsp[-10].string,yyvsp[-9].string,yyvsp[-8].string,yyvsp[-7].string,yyvsp[-6].string,yyvsp[-5].string,yyvsp[-4].real,f,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 137:
#line 2762 "rib.y"
{
					if (!commandIgnore) {
						RiMakeShadowV(yyvsp[-2].string,yyvsp[-1].string,numParameters,tokens->getArray(),vals->getArray());
					}

					badParameters;
				;
    break;}
case 138:
#line 2772 "rib.y"
{
					if (!commandIgnore) {
						RtErrorHandler 	e	=	NULL;

						if (scmp(yyvsp[0].string,RI_ERROR_IGNORE) == 0) {
							e	=	RiErrorIgnore;
						} else if (scmp(yyvsp[0].string,RI_ERROR_PRINT) == 0) {
							e	=	RiErrorPrint;
						} else if (scmp(yyvsp[0].string,RI_ERROR_ABORT) == 0) {
							e	=	RiErrorAbort;
						} else {
						}

						if (e != NULL)
							RiErrorHandler(e);
					}

					badParameters;
				;
    break;}
case 139:
#line 2794 "rib.y"
{
				;
    break;}
case 140:
#line 2799 "rib.y"
{
				;
    break;}
case 141:
#line 2803 "rib.y"
{
					riberror("%s: Syntax error.",currentCommand);
				;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
	  for (x = (yyn < 0 ? -yyn : 0);
	       x < (sizeof(yytname) / sizeof(char *)); x++)
	    if (yycheck[x + yyn] == x)
	      size += strlen(yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (yyn < 0 ? -yyn : 0);
		       x < (sizeof(yytname) / sizeof(char *)); x++)
		    if (yycheck[x + yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      yyerror(msg);
	      free(msg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;
}
#line 2808 "rib.y"

#include "lex.rib.cpp"

int	ribLineno	=	0;
int	numErrors	=	0;

void	riberror(char *s,...) {
	char	tmp[256];
	va_list	args;

	va_start(args,s);
	vsprintf(tmp,s,args);
	sfError(SVR_WARNING,CODE_BADFILE,"Rib (%d): %s\n",ribLineno,tmp);
	numErrors++;
}

void	parseRib(FILE *in) {
	ribin	=	in;

	if (ribin != NULL) {
		CArray<ERIBValue>	*savedArguments			=	arguments;
		int					savedCurrentArgument	=	currentArgument;
		int					savedArgumentCounter	=	argumentCounter;
		CArray<TParameter>	*savedParameterList		=	parameterList;
		int					savedNumParameters		=	numParameters;
		CArray<RtPointer>	*savedLights			=	lights;
		CArray<RtPointer>	*savedObjects			=	objects;
		int					savedCommandIgnore		=	commandIgnore;
		CArray<RtToken>		*savedTokens			=	tokens;
		CArray<RtPointer>	*savedVals				=	vals;
		int					savedRibLineno			=	ribLineno;
		int					savedNumErrors			=	numErrors;
		CList<char *>		*savedAllocatedStrings	=	allocatedStrings;


		// Init the environment
		arguments			=	new CArray<ERIBValue>;
		currentArgument		=	0;
		argumentCounter		=	0;
		parameterList		=	new CArray<TParameter>;
		numParameters		=	0;
		lights				=	NULL;
		objects				=	NULL;
		commandIgnore		=	FALSE;
		tokens				=	new CArray<RtToken>;
		vals				=	new CArray<RtPointer>;
		allocatedStrings	=	new CList<char *>;
		ribLineno			=	1;
		numErrors			=	0;

		ribparse();

		delete arguments;
		delete parameterList;
		if (lights != NULL)		delete lights;
		if (objects != NULL)	delete objects;
		delete tokens;
		delete vals;
		delete allocatedStrings;

		arguments			=	savedArguments;
		currentArgument		=	savedCurrentArgument;
		argumentCounter		=	savedArgumentCounter;
		parameterList		=	savedParameterList;
		numParameters		=	savedNumParameters;
		lights				=	savedLights;
		objects				=	savedObjects;
		commandIgnore		=	savedCommandIgnore;
		tokens				=	savedTokens;
		vals				=	savedVals;
		ribLineno			=	savedRibLineno;
		numErrors			=	savedNumErrors;
		allocatedStrings	=	savedAllocatedStrings;
	}
}
