/* A Bison parser, made by GNU Bison 1.875d.  */

/* Skeleton parser for Yacc-like parsing with Bison,
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, 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.  */

/* Written by Richard Stallman by simplifying the original so called
   ``semantic'' parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

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

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 0

/* Using locations.  */
#define YYLSP_NEEDED 0

/* If NAME_PREFIX is specified substitute the variables and functions
   names.  */
#define yyparse ribparse
#define yylex   riblex
#define yyerror riberror
#define yylval  riblval
#define yychar  ribchar
#define yydebug ribdebug
#define yynerrs ribnerrs


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




/* Copy the first part of user declarations.  */
#line 1 "rib.y"

//////////////////////////////////////////////////////////////////////
//
//                             Pixie
//
// Copyright © 1999 - 2003, Okan Arikan
//
// Contact: okan@cs.berkeley.edu
//
// This library 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 of the License, or (at your option) any later version.
// 
// This library 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 library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
//
//  File				:	rib.y
//  Classes				:	-
//  Description			:	RIB bindings
//
////////////////////////////////////////////////////////////////////////
#undef alloca
#define	YYMAXDEPTH	100000

#include <math.h>
#include <string.h>
#include <stdarg.h>

#include "common/global.h"
#include "common/containers.h"
#include "ri.h"
#include "renderer.h"
#include "delayed.h"
#include "stats.h"
#include "rib.h"
#include "error.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;

static	int					ribDepth					=	0;		// The rib parsing stack depth
static	int					numConstant					=	0;		// The number of constant
static	int					numVertex					=	0;		// The number of vertices
static	int					numVarying					=	0;		// The number of varyings
static	int					numFaceVarying				=	0;		// The number of facevaryings
static	int					numUniform					=	0;		// The number of uniforms
static	CArray<RtPointer>	*lights						=	NULL;	// Number -> handle mapping for lights
static	CTrie<RtPointer>	*lightNames					=	NULL;	// Name -> handle mapping for lights
static	CArray<RtPointer>	*ribObjects					=	NULL;	// Number -> handle mapping for ribObjects
static	CArray<char *>		*allocatedStrings			=	NULL;	// Strings that have been allocated for the last command
static	CArray<char *>		*permaStrings				=	NULL;	// Strings that have been allocated for the whole rib stack
static	void				(*callback)(const char *)	=	NULL;	// The callback function for the parser
static	ERIBValue			*args						=	NULL;
static	int					numArguments				=	0;
static	int					argumentStepSize			=	100000;
static	int					maxArgument					=	0;
static	int					numParameters				=	0;
static	int					maxParameter				=	0;
static	RtToken				*tokens						=	NULL;
static	RtPointer			*vals						=	NULL;
static	TParameter			*parameters					=	NULL;

		const char			*ribFile					=	NULL;	// The RIB file that we're parsing now
		int					ribLineno					=	-1;		// The line number in the rib file (where the parser is at)
		int					ribCommandLineno			=	-1;		// The line number of the last executed command in the RIB


#define	argCheck()															\
	if (numArguments == maxArgument) {										\
		ERIBValue	*tmp	=	new ERIBValue[maxArgument+argumentStepSize];\
																			\
		memcpy(tmp,args,numArguments*sizeof(ERIBValue));					\
																			\
		maxArgument			+=	argumentStepSize;							\
		argumentStepSize	*=	2;											\
																			\
		delete [] args;														\
		args				=	tmp;										\
	}

#define	paramCheck()														\
	if (numParameters == maxParameter) {									\
		RtToken		*tmpTokens		=	new RtToken[maxParameter+10];		\
		RtPointer	*tmpVals		=	new RtPointer[maxParameter+10];		\
		TParameter	*tmpParameters	=	new TParameter[maxParameter+10];	\
																			\
		memcpy(tmpTokens,		tokens,maxParameter*sizeof(RtToken));		\
		memcpy(tmpVals,			vals,maxParameter*sizeof(RtPointer));		\
		memcpy(tmpParameters,	parameters,maxParameter*sizeof(TParameter));\
																			\
		delete [] tokens;													\
		delete [] vals;														\
		delete [] parameters;												\
																			\
		tokens						=	tmpTokens;							\
		vals						=	tmpVals;							\
		parameters					=	tmpParameters;						\
																			\
		maxParameter				+=	10;									\
	}

#define	get(__n)		(args + __n)


// 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";

// 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";

void	test();

///////////////////////////////////////////////////////////////////////
// Function				:	toLowerCase
// Description			:	Convert the argument to lowercase
// Return Value			:	Pointer to the argument
// Comments				:
// Date last edited		:	8/10/2001
static	char			*toLowerCase(char *s) {
	int	i;
	int	l	=	strlen(s);

	for (i=0;i<l;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
static	int		parameterListCheck() {
	int			i;
	CVariable	tmp;

	// Set the number of variables
	numConstant		=	0;
	numVertex		=	0;
	numVarying		=	0;
	numFaceVarying	=	0;
	numUniform		=	0;

	// For each parameter encountered
	for (i=0;i<numParameters;i++) {
		TParameter		*par	=	parameters+i;
		CVariable		*var	=	currentRenderer->retrieveVariable(par->name);
		EVariableClass	container;

		// Try to define the variable for later usage	
		if (var == NULL) {
			if (parseVariable(&tmp,NULL,par->name)) {
				container	=	tmp.container;

				var			=	currentRenderer->retrieveVariable(tmp.name);
				if (var == NULL) {
					var = currentRenderer->declareVariable(NULL,par->name);
				}
			}
		} else {
			container	=	var->container;
		}

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

		if (var == NULL)	{
			error(CODE_BADTOKEN,"Parameter \"%s\" is not declared\n",par->name);
			return FALSE;
		}

		if ((par->numItems % var->numFloats) != 0) {
			error(CODE_MISSINGDATA,"Invalid number of items for the parameter \"%s\" (expecting n*%d, found %d)\n",par->name,var->numFloats,par->numItems);
			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 {
				error(CODE_RANGE,"Type mismatch for parameter \"%s\" (expecting integer, found string)\n",par->name);
				return	FALSE;
			}
		} else if (var->type == TYPE_STRING) {
			if (par->type != RT_TEXT) {
				error(CODE_RANGE,"Type mismatch for parameter \"%s\" (expecting string, found float)\n",par->name);
				return	FALSE;
			}
		} else {
			if (par->type != RT_FLOAT) {
				error(CODE_RANGE,"Type mismatch for parameter \"%s\" (expecting float, found string)\n",par->name);
				return	FALSE;
			}
		}

#define	SIZECHECK(dest)																		\
			if (dest == 0) {																\
				dest = (par->numItems / var->numFloats);									\
			} else {																		\
				if (dest != (par->numItems / var->numFloats)) {								\
					error(CODE_RANGE,"Invalid number of items for the parameter \"%s\" (expecting %d, found %d)\n",par->name,dest,par->numItems/var->numFloats);	\
					return FALSE;															\
				}																			\
			}

		switch(container) {
		case CONTAINER_UNIFORM:
			SIZECHECK(numUniform);
			break;
		case CONTAINER_VERTEX:
			SIZECHECK(numVertex);
			break;
		case CONTAINER_VARYING:
			SIZECHECK(numVarying);
			break;
		case CONTAINER_FACEVARYING:
			SIZECHECK(numFaceVarying);
			break;
		case CONTAINER_CONSTANT:
			SIZECHECK(numConstant);
			break;
		default:
			error(CODE_BUG,"Unknown container class in parameter list.\n");
			return FALSE;
			break;
		}

#undef SIZECHECK

	}

	return TRUE;
}

///////////////////////////////////////////////////////////////////////
// Function				:	getBasis
// Description			:	Get the basis matrix from a given text
// Return Value			:	TRUE if OK
// Comments				:
// Date last edited		:	8/20/2003
static	int		sizeCheck(int numExpVertex,int numExpVarying,int numExpFaceVarying,int numExpUniform) {
	if (numExpVarying == 0)		numExpVarying		=	numExpVertex;
	if (numExpVertex == 0)		numExpVertex		=	numExpVarying;
	if (numExpFaceVarying == 0)	numExpFaceVarying	=	numExpVertex;

	if (numConstant != 0) {
		if (numConstant != 1) {
			error(CODE_CONSISTENCY,"Unexpected number of constants (1 expected, %d found)\n",numVarying);
			return FALSE;
		}
	}

	if (numVertex != 0) {
		if (numExpVertex != numVertex) {
			error(CODE_CONSISTENCY,"Unexpected number of vertices (%d expected, %d found)\n",numExpVertex,numVertex);
			return FALSE;
		}
	}

	if (numVarying != 0) {
		if (numExpVarying != numVarying) {
			error(CODE_CONSISTENCY,"Unexpected number of varyings (%d expected, %d found)\n",numExpVarying,numVarying);
			return FALSE;
		}
	}

	if (numFaceVarying != 0) {
		if (numExpFaceVarying != numFaceVarying) {
			error(CODE_CONSISTENCY,"Unexpected number of facevaryings (%d expected, %d found)\n",numExpFaceVarying,numFaceVarying);
			return FALSE;
		}
	}

	if (numUniform != 0) {
		if (numExpUniform != numUniform) {
			error(CODE_CONSISTENCY,"Unexpected number of uniforms (%d expected, %d found)\n",numExpUniform,numUniform);
			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
static	int		getBasis(RtBasis **a,char *n) {
	char	*name	=	toLowerCase(n);

	if (strcmp(name,RI_BEZIERBASIS) == 0)
		a[0]	=	&RiBezierBasis;
	else if (strcmp(name,RI_BSPLINEBASIS) == 0)
		a[0]	=	&RiBSplineBasis;
	else if (strcmp(name,RI_CATMULLROMBASIS) == 0)
		a[0]	=	&RiCatmullRomBasis;
	else if (strcmp(name,RI_HERMITEBASIS) == 0)
		a[0]	=	&RiHermiteBasis;
	else if (strcmp(name,RI_POWERBASIS) == 0)
		a[0]	=	&RiPowerBasis;
	else {
		error(CODE_BADTOKEN,"Unknown basis: \"%s\"\n",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
static	RtFilterFunc	getFilter(char *n) {
	char			*name	=	toLowerCase(n);
	RtFilterFunc	f		=	NULL;

	if (strcmp(name,RI_BOXFILTER) == 0) {
		f = RiBoxFilter;
	} else if (strcmp(name,RI_GAUSSIANFILTER) == 0) {
		f = RiGaussianFilter;
	} else if (strcmp(name,RI_TRIANGLEFILTER) == 0) {
		f = RiTriangleFilter;
	} else if (strcmp(name,RI_CATMULLROMFILTER) == 0) {
		f = RiCatmullRomFilter;
	} else if (strcmp(name,RI_SINCFILTER) == 0) {
		f = RiSincFilter;
	} else {
		error(CODE_BADTOKEN,"Filter \"%s\" not recognised\n",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
static	RtErrorHandler	getErrorHandler(char *n) {
	char			*name	=	toLowerCase(n);
	RtErrorHandler	f		=	NULL;

	if (strcmp(name,RI_ERRORIGNORE) == 0) {
		f = RiErrorPrint;
	} else if (strcmp(name,RI_ERRORPRINT) == 0) {
		f = RiErrorPrint;
	} else if (strcmp(name,RI_ERRORABORT) == 0) {
		f = RiErrorAbort;
	} else {
		error(CODE_BADTOKEN,"Error handler \"%s\" not recognised\n",name);
	}

	return f;
}




/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 462 "rib.y"
typedef union ribval {
	float	real;
	char	string[2048];
	int		integer;
} YYSTYPE;
/* Line 191 of yacc.c.  */
#line 773 "rib.cpp"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif



/* Copy the second part of user declarations.  */


/* Line 214 of yacc.c.  */
#line 785 "rib.cpp"

#if ! defined (yyoverflow) || YYERROR_VERBOSE

# ifndef YYFREE
#  define YYFREE free
# endif
# ifndef YYMALLOC
#  define YYMALLOC malloc
# endif

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   define YYSTACK_ALLOC alloca
#  endif
# else
#  if defined (alloca) || defined (_ALLOCA_H)
#   define YYSTACK_ALLOC alloca
#  else
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning. */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
#  if defined (__STDC__) || defined (__cplusplus)
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T size_t
#  endif
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */


#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \
	 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  short int yyss;
  YYSTYPE yyvs;
  };

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short int) + sizeof (YYSTYPE))			\
      + YYSTACK_GAP_MAXIMUM)

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined (__GNUC__) && 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)		\
      do					\
	{					\
	  register YYSIZE_T yyi;		\
	  for (yyi = 0; yyi < (Count); yyi++)	\
	    (To)[yyi] = (From)[yyi];		\
	}					\
      while (0)
#  endif
# endif

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack)					\
    do									\
      {									\
	YYSIZE_T yynewbytes;						\
	YYCOPY (&yyptr->Stack, Stack, yysize);				\
	Stack = &yyptr->Stack;						\
	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
	yyptr += yynewbytes / sizeof (*yyptr);				\
      }									\
    while (0)

#endif

#if defined (__STDC__) || defined (__cplusplus)
   typedef signed char yysigned_char;
#else
   typedef short int yysigned_char;
#endif

/* YYFINAL -- State number of the termination state. */
#define YYFINAL  3
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   664

/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS  111
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS  16
/* YYNRULES -- Number of rules. */
#define YYNRULES  156
/* YYNRULES -- Number of states. */
#define YYNSTATES  647

/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   365

#define YYTRANSLATE(YYX) 						\
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const unsigned 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,   109,   110
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const unsigned short int yyprhs[] =
{
       0,     0,     3,     5,     8,    10,    13,    15,    18,    20,
      24,    27,    29,    31,    35,    38,    42,    44,    47,    49,
      51,    54,    55,    58,    61,    62,    66,    67,    69,    73,
      75,    78,    80,    82,    84,    89,    92,    98,   106,   112,
     120,   124,   128,   136,   141,   143,   147,   150,   154,   159,
     163,   167,   174,   180,   184,   188,   191,   195,   198,   202,
     204,   206,   211,   216,   223,   230,   240,   252,   257,   262,
     266,   271,   276,   280,   284,   288,   292,   296,   300,   303,
     306,   309,   319,   327,   337,   345,   351,   359,   363,   366,
     369,   371,   374,   376,   396,   416,   419,   424,   429,   435,
     444,   455,   459,   463,   466,   469,   471,   473,   477,   480,
     484,   489,   495,   501,   524,   547,   587,   591,   599,   612,
     623,   630,   639,   645,   653,   660,   669,   679,   691,   698,
     707,   713,   721,   729,   739,   745,   748,   758,   764,   770,
     774,   786,   789,   791,   794,   796,   799,   802,   804,   814,
     824,   832,   846,   851,   854,   857,   860
};

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

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const unsigned short int yyrline[] =
{
       0,   585,   585,   588,   596,   605,   613,   621,   631,   641,
     648,   656,   661,   667,   674,   682,   689,   700,   705,   710,
     717,   722,   741,   753,   767,   766,   780,   784,   791,   798,
     803,   809,   814,   819,   824,   832,   838,   847,   858,   867,
     878,   885,   892,   903,   911,   916,   923,   929,   936,   948,
     955,   965,   975,   984,   991,  1000,  1014,  1029,  1035,  1044,
    1049,  1054,  1068,  1082,  1098,  1114,  1127,  1142,  1152,  1164,
    1171,  1181,  1193,  1202,  1214,  1221,  1228,  1235,  1242,  1248,
    1254,  1260,  1282,  1302,  1324,  1344,  1353,  1364,  1371,  1377,
    1383,  1388,  1394,  1399,  1441,  1483,  1489,  1497,  1505,  1514,
    1526,  1540,  1547,  1554,  1560,  1566,  1571,  1576,  1585,  1595,
    1608,  1644,  1688,  1701,  1750,  1799,  1878,  1904,  1980,  2014,
    2038,  2052,  2068,  2081,  2096,  2110,  2126,  2152,  2180,  2194,
    2210,  2223,  2238,  2253,  2270,  2316,  2326,  2364,  2392,  2401,
    2410,  2479,  2485,  2490,  2498,  2503,  2513,  2521,  2526,  2543,
    2560,  2575,  2596,  2604,  2614,  2619,  2624
};
#endif

#if YYDEBUG || YYERROR_VERBOSE
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
  "$end", "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_DISPLAYCHANNEL", "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", "RIB_STRUCTURE_COMMENT", "$accept",
  "start", "ribIntString", "ribFloatString", "ribTextString",
  "ribFloatArray", "ribFloats", "ribIntArray", "ribTextArray",
  "ribEmptyArray", "ribTexts", "ribPL", "ribParameter", "ribCommands",
  "@1", "ribComm", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const unsigned short int yytoknum[] =
{
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
     355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
     365
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const unsigned char yyr1[] =
{
       0,   111,   112,   113,   113,   114,   114,   115,   115,   116,
     116,   117,   117,   118,   118,   119,   119,   120,   121,   121,
     122,   122,   123,   123,   125,   124,   124,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
     126,   126,   126,   126,   126,   126,   126
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
static const unsigned char yyr2[] =
{
       0,     2,     1,     2,     1,     2,     1,     2,     1,     3,
       2,     1,     1,     3,     2,     3,     1,     2,     1,     1,
       2,     0,     2,     2,     0,     3,     0,     1,     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,     3,     2,     3,     2,     3,     1,
       1,     4,     4,     6,     6,     9,    11,     4,     4,     3,
       4,     4,     3,     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,     9,     5,     5,     3,
      11,     2,     1,     2,     1,     2,     2,     1,     9,     9,
       7,    13,     4,     2,     2,     2,     1
};

/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   means the default is an error.  */
static const unsigned char yydefact[] =
{
      26,     0,    24,     1,     0,   156,     0,    29,    31,    32,
      33,     0,     0,     0,     0,     0,     0,     0,    44,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    59,    60,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    90,     0,    92,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,   105,   106,     0,
      21,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,    21,     0,
       0,     0,     0,   142,     0,   144,     0,     0,   147,     0,
       0,     0,     0,     0,     0,     0,    27,    25,     0,    30,
       0,    35,     0,     0,     0,     0,    21,     0,     0,     0,
       0,    46,     0,     0,     0,    21,     0,     0,    21,    21,
       0,     6,    12,    11,    55,    57,    21,     0,     0,     0,
       0,     0,     0,    21,     0,     0,     0,    21,    21,    21,
      21,    78,    79,    80,     0,     0,     0,     0,     0,     0,
       0,    88,    89,    91,     0,     0,    95,     0,     0,     0,
       0,     0,    21,    21,   103,   104,    21,     0,   108,    21,
       0,    21,     0,     0,     0,     0,    21,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,    21,   135,     0,     0,     0,
     141,   143,   145,    11,   146,     0,     0,     0,     0,     0,
     153,   155,   154,    28,     0,     0,     0,     0,     0,    40,
      41,     0,     0,    45,    47,     0,    49,    50,     0,     0,
      53,    54,    10,     0,     5,    56,    58,     0,     0,     0,
       0,     0,     0,    21,    21,    69,    21,    21,    73,    72,
      74,    75,    76,    77,     0,     0,     0,     0,     0,     0,
      87,     0,     0,     0,     0,     0,     0,     0,   101,   102,
     107,     0,    16,    22,    23,    20,    14,     4,     0,   109,
      21,     0,     0,     0,   116,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,   139,     0,     0,     0,     0,     0,     0,
       0,     0,    21,    34,     0,     0,     0,     0,     0,    43,
      48,     0,    21,     9,     0,    61,     0,    62,     0,     0,
      16,    68,    67,    71,    70,     0,     0,     0,     0,     0,
       0,     0,     0,    96,     0,    97,     0,     0,     8,     0,
      13,     3,   110,    21,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    21,     0,     0,     0,     0,     0,     0,
       0,    21,     0,     0,    21,    21,    21,     0,     0,     0,
       0,     0,   152,     0,    36,     0,    38,     0,     0,    52,
       0,     0,     0,     0,     0,     0,     0,     0,     0,    85,
       0,     0,    98,     0,     0,    15,     7,   111,     0,     0,
     112,     0,     0,     0,     0,    21,     0,   122,     0,    21,
       0,     0,     0,    21,     0,   130,     0,     0,   134,     0,
      19,    18,     0,   137,   138,     0,     0,     0,     0,     0,
       0,     0,     0,    51,    63,    64,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,    21,
       0,     0,     0,   120,    21,     0,   124,     0,     0,     0,
     128,    21,     0,    21,    17,     0,     0,     0,     0,    21,
       0,    37,    39,    42,     0,     0,     0,    82,     0,    84,
      86,     0,     0,     0,     0,     0,     0,   117,     0,     0,
      21,   123,    21,     0,     0,    21,   131,     0,   132,     0,
       0,     0,     0,   150,     0,     0,     0,     0,     0,     0,
       0,     0,    99,     0,     0,     0,     0,   121,   125,     0,
      21,   129,    21,    21,     0,    21,    21,     0,     0,    65,
      81,    83,     0,     0,     0,     0,     0,     0,     0,     0,
     126,   133,   136,     0,   148,   149,     0,     0,     0,     0,
     100,     0,     0,     0,   119,    21,     0,     0,    66,     0,
       0,     0,     0,    21,   127,   140,     0,     0,     0,     0,
       0,   118,    21,     0,     0,     0,     0,   151,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,    93,    94,
       0,     0,     0,     0,     0,     0,     0,     0,   113,   114,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,   115
};

/* YYDEFGOTO[NTERM-NUM]. */
static const short int yydefgoto[] =
{
      -1,     1,   288,   132,   359,   213,   283,   181,   284,   441,
     442,   178,   179,     2,     4,   107
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -203
static const short int yypact[] =
{
    -203,     9,    21,  -203,   527,  -203,   -26,   -61,  -203,  -203,
    -203,   -32,   -19,   -91,   -89,   -20,    -1,     1,     5,     6,
       7,     8,     2,    10,    11,    13,    15,    16,    17,   -86,
      18,    19,  -203,  -203,   -83,   -81,   -80,    22,    23,   -27,
      24,    25,    27,    28,    29,    30,    31,   -78,   -75,   -72,
      32,    34,    35,  -203,    36,  -203,    20,    38,    37,    39,
      40,    41,   -70,    44,    45,    46,    48,  -203,  -203,    49,
      50,    42,    42,    42,   -22,    51,    52,    53,    56,   -69,
     -67,   -62,   -59,   -54,   -52,   -51,    57,    58,    50,    59,
      54,    60,    61,  -203,    62,  -203,    65,   -86,  -203,    68,
      69,    70,    71,    73,    74,   -98,  -203,  -203,    75,  -203,
      76,  -203,    77,    78,    79,    80,    50,    81,    82,    83,
      84,  -203,    85,    86,    87,    50,    88,    91,    50,    50,
     -37,  -203,    90,    56,  -203,  -203,    50,    92,    93,    94,
      95,    96,    98,   -23,   -16,    99,   100,    50,    50,    50,
      50,  -203,  -203,  -203,   101,   102,   103,   104,   105,   106,
     107,  -203,  -203,  -203,   108,   109,  -203,   110,   112,   113,
     114,   115,    50,    50,  -203,  -203,    50,   -97,  -203,    50,
     -35,    50,    42,    42,   116,   117,    50,   118,   119,    56,
     120,   121,   122,   123,   124,   125,   126,   127,   128,   130,
     131,   132,   133,   135,    42,    50,  -203,    42,    56,   -11,
    -203,  -203,  -203,  -203,  -203,   138,   139,   140,   142,   143,
    -203,  -203,  -203,  -203,   144,   145,   146,   147,   148,  -203,
    -203,   149,   150,  -203,  -203,   151,  -203,  -203,   152,   155,
    -203,  -203,  -203,   -31,  -203,  -203,  -203,   154,   156,   157,
     160,   161,   162,   -92,    50,  -203,    50,    50,  -203,  -203,
    -203,  -203,  -203,  -203,   163,   164,   165,   166,   167,   168,
    -203,   169,   171,   172,   173,   174,   175,   176,  -203,  -203,
    -203,   -39,  -203,  -203,  -203,  -203,  -203,  -203,   -30,  -203,
      50,    42,   177,    -7,  -203,   180,    56,    56,   179,   181,
     182,   183,   184,   185,   186,   187,   189,   190,   194,   195,
     196,   197,   200,  -203,    42,   -11,   201,   159,   202,   203,
     204,   205,    50,  -203,   206,   207,   208,   209,   210,  -203,
    -203,   211,    50,  -203,   212,  -203,   213,  -203,   214,   215,
     -49,  -203,  -203,  -203,  -203,   216,   217,   218,   219,   220,
     221,   222,   223,  -203,   224,  -203,   225,   226,  -203,   -45,
    -203,  -203,  -203,    50,   227,   228,   229,   230,   233,    56,
     234,   235,   237,    50,   238,   239,   241,   242,   243,   244,
     245,    50,   246,   247,    50,    -6,    50,   248,   251,   252,
     253,   254,  -203,   255,  -203,   256,  -203,   257,   258,  -203,
     262,   263,   261,   264,   265,   266,   267,   268,   269,  -203,
     270,   271,  -203,   272,   273,  -203,  -203,  -203,   274,   275,
    -203,   279,   278,    56,   280,    50,   282,  -203,   283,    50,
     284,   286,   287,    50,   285,  -203,   289,   291,  -203,     0,
    -203,  -203,    42,  -203,  -203,   292,   295,   296,   297,   300,
     298,   302,   301,  -203,  -203,  -203,   303,   304,   306,   307,
     308,   309,   305,   310,   311,   312,   313,   314,   315,    50,
     316,    56,   321,  -203,    50,   323,  -203,   324,   325,   326,
    -203,    50,   327,    50,  -203,    42,   328,   329,   330,    50,
     333,  -203,  -203,  -203,   332,   334,   335,  -203,   336,  -203,
    -203,   337,   338,   339,   340,   341,   342,  -203,   343,    56,
      50,  -203,    50,   344,   345,    50,  -203,   349,  -203,    56,
     348,   351,   354,  -203,   357,   356,   358,   360,   362,   361,
     363,   364,  -203,   365,   366,    56,    56,  -203,  -203,   367,
      50,  -203,    50,    50,   368,    50,    50,   369,   370,  -203,
    -203,  -203,   372,   373,   377,   375,   376,   378,    56,   380,
    -203,  -203,  -203,   379,  -203,  -203,   382,   386,   384,   385,
    -203,   387,   388,   389,  -203,    50,   394,   392,  -203,   393,
     395,   396,   400,    50,  -203,  -203,   401,   402,   403,   404,
     405,  -203,    50,   406,   407,   408,   409,  -203,   410,   411,
     412,   413,   414,   415,   416,   417,   418,   519,   522,   523,
     524,   525,   526,   529,   397,   530,   533,   531,  -203,  -203,
     532,   534,    -2,   536,   535,   537,   538,   539,  -203,  -203,
     540,   541,   542,   543,   544,   545,   546,   547,   548,   549,
     550,   551,   552,   553,   557,   555,  -203
};

/* YYPGOTO[NTERM-NUM].  */
static const short int yypgoto[] =
{
    -203,  -203,  -203,  -127,  -203,   -29,   -24,   -71,  -202,  -203,
    -203,   -84,  -203,  -203,  -203,  -203
};

/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule which
   number is the opposite.  If zero, do what YYDEFACT says.
   If YYTABLE_NINF, syntax error.  */
#define YYTABLE_NINF -3
static const short int yytable[] =
{
     133,   182,   183,   243,   206,   134,   221,   317,   281,     3,
     282,   222,   131,   281,   112,   340,   114,   131,   113,   130,
     115,    -2,   137,   131,   139,   141,   138,   154,   140,   142,
     156,   155,   229,   158,   157,   170,   190,   159,   192,   171,
     191,   237,   193,   194,   240,   241,   196,   195,   109,   189,
     197,   198,   246,   200,   202,   199,   281,   201,   203,   255,
     131,   415,   416,   260,   261,   262,   263,   242,   358,   242,
     131,   286,   131,   214,   287,   333,   360,   110,   244,   361,
     145,   108,   146,   184,   253,   185,   254,   116,   278,   279,
     111,   256,   280,   257,   316,   285,   282,   289,   365,   439,
     366,   340,   294,   624,   245,   625,   484,   358,   117,   123,
     118,   290,   291,   386,   119,   120,   121,   122,   125,   124,
     126,   313,   127,   128,   129,   164,   136,   135,     0,   143,
     144,   147,   148,   312,   149,   150,   314,   152,   151,   160,
     153,   161,   162,   165,     0,   163,   166,   180,   167,   168,
     169,   172,   173,   174,   243,   175,   176,   177,   186,   187,
     297,   130,   188,   208,   204,   205,   207,   209,   210,   341,
     342,   211,   343,   344,   212,   215,   216,   217,   218,   315,
     219,   220,   223,   440,     0,   224,   225,   226,   227,   228,
     230,   231,   232,   233,   234,   235,   236,   238,   239,   244,
       0,   247,   248,   249,   250,   251,   362,   252,   258,   259,
     264,   265,   266,   267,   268,   269,   270,   271,   272,   273,
     363,   274,   275,   276,   277,   292,   293,   295,   296,   298,
     299,   300,   301,   302,   303,   304,   305,   306,   392,   307,
     308,   309,   310,   385,   311,   318,   319,   320,   399,   321,
     322,     0,     0,   323,   324,   325,   326,   327,   328,   329,
     330,   331,   332,   334,   387,   335,   336,   368,   369,   337,
     338,   339,   345,   346,   347,   348,   349,   350,   351,   417,
     352,   353,   354,   355,   356,   357,   364,   367,   370,   427,
     371,   372,   373,   374,   375,   376,   377,   435,   378,   379,
     438,   443,   444,   380,   381,   382,   383,   384,   358,   388,
     389,   390,   391,     0,     0,   393,   394,   395,   396,   397,
     398,   400,   401,   402,   403,   404,   405,   406,   407,   408,
     409,   410,   411,   412,   413,   414,   418,   419,   420,   421,
     423,   473,   422,   424,   425,   476,   426,   428,   429,   480,
     430,   431,   432,   433,   434,   436,   437,   445,   446,   447,
       0,   449,   448,     0,   450,   451,   452,   453,   454,   455,
     456,   485,     0,   457,   458,   459,   460,   461,   462,   463,
     464,   465,   466,   467,   468,   507,   469,   470,   474,   472,
     511,   481,   475,   477,   471,   478,   479,   516,   482,   518,
     483,   486,   487,   488,   491,   523,   489,   490,   492,     0,
     493,   500,   494,   495,   519,   496,   497,   498,   499,   501,
     502,   503,   504,   505,   506,   508,   537,   510,   538,   512,
       0,   541,   515,   513,   514,     0,   517,   520,   521,   522,
     524,   525,   509,   526,   527,   528,   529,   530,   531,   532,
     533,   534,   535,   539,   540,   542,   560,   544,   561,   562,
     545,   564,   565,   546,   547,   548,   550,   549,   551,     0,
     552,     0,   553,   554,   555,   556,   559,   563,   566,   567,
     536,   568,   569,   570,   571,   572,   575,   573,   576,   577,
     543,   584,   578,   579,   580,     0,   581,   582,   583,   591,
     585,   586,   587,   618,   588,   589,   557,   558,   597,   590,
     592,   593,   594,   595,   596,   598,   599,   600,   601,   602,
     603,   604,   605,   606,   607,   608,   609,   610,     5,   574,
       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,   611,   104,
     105,   612,   613,   614,   615,   616,   619,   106,   617,   620,
     621,   622,   626,   623,   627,     0,   628,   629,   630,   631,
     632,   633,   634,   635,   636,   637,   638,   639,   640,   641,
     642,   643,   644,   645,   646
};

static const short int yycheck[] =
{
      29,    72,    73,   130,    88,    29,   104,   209,   105,     0,
     107,   109,   109,   105,   105,   107,   105,   109,   109,   105,
     109,     0,   105,   109,   105,   105,   109,   105,   109,   109,
     105,   109,   116,   105,   109,   105,   105,   109,   105,   109,
     109,   125,   109,   105,   128,   129,   105,   109,   109,    78,
     109,   105,   136,   105,   105,   109,   105,   109,   109,   143,
     109,   106,   107,   147,   148,   149,   150,   106,   107,   106,
     109,   106,   109,    97,   109,   106,   106,   109,   109,   109,
     107,   107,   109,   105,   107,   107,   109,   107,   172,   173,
     109,   107,   176,   109,   105,   179,   107,   181,   105,   105,
     107,   107,   186,   105,   133,   107,   106,   107,   109,   107,
     109,   182,   183,   315,   109,   109,   109,   109,   107,   109,
     107,   205,   107,   107,   107,   105,   107,   109,    -1,   107,
     107,   107,   107,   204,   107,   107,   207,   107,   109,   107,
     109,   107,   107,   105,    -1,   109,   109,   105,   109,   109,
     109,   107,   107,   107,   281,   107,   107,   107,   107,   107,
     189,   105,   109,   109,   107,   107,   107,   107,   107,   253,
     254,   109,   256,   257,   109,   107,   107,   107,   107,   208,
     107,   107,   107,   385,    -1,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   107,   109,
      -1,   109,   109,   109,   109,   109,   290,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     291,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   322,   109,
     109,   109,   109,   314,   109,   107,   107,   107,   332,   107,
     107,    -1,    -1,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   107,   109,   105,   109,   109,   296,   297,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   363,
     109,   109,   109,   109,   109,   109,   109,   107,   109,   373,
     109,   109,   109,   109,   109,   109,   109,   381,   109,   109,
     384,   385,   386,   109,   109,   109,   109,   107,   107,   107,
     107,   107,   107,    -1,    -1,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     369,   425,   109,   109,   109,   429,   109,   109,   109,   433,
     109,   109,   109,   109,   109,   109,   109,   109,   107,   107,
      -1,   107,   109,    -1,   109,   109,   109,   109,   106,   106,
     109,   442,    -1,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   469,   107,   109,   106,   109,
     474,   106,   109,   109,   423,   109,   109,   481,   109,   483,
     109,   109,   107,   107,   106,   489,   109,   107,   106,    -1,
     109,   106,   109,   109,   485,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   510,   106,   512,   106,
      -1,   515,   106,   109,   109,    -1,   109,   109,   109,   109,
     107,   109,   471,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   106,   540,   109,   542,   543,
     109,   545,   546,   109,   107,   109,   106,   109,   106,    -1,
     109,    -1,   109,   109,   109,   109,   109,   109,   109,   109,
     509,   109,   109,   106,   109,   109,   106,   109,   109,   107,
     519,   575,   106,   109,   109,    -1,   109,   109,   109,   583,
     106,   109,   109,   106,   109,   109,   535,   536,   592,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,     1,   558,
       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,   109,   102,
     103,   109,   109,   109,   109,   109,   106,   110,   109,   106,
     109,   109,   106,   109,   109,    -1,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   106,   109
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   symbol of state STATE-NUM.  */
static const unsigned char yystos[] =
{
       0,   112,   124,     0,   125,     1,     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,   102,   103,   110,   126,   107,   109,
     109,   109,   105,   109,   105,   109,   107,   109,   109,   109,
     109,   109,   109,   107,   109,   107,   107,   107,   107,   107,
     105,   109,   114,   116,   117,   109,   107,   105,   109,   105,
     109,   105,   109,   107,   107,   107,   109,   107,   107,   107,
     107,   109,   107,   109,   105,   109,   105,   109,   105,   109,
     107,   107,   107,   109,   105,   105,   109,   109,   109,   109,
     105,   109,   107,   107,   107,   107,   107,   107,   122,   123,
     105,   118,   118,   118,   105,   107,   107,   107,   109,   116,
     105,   109,   105,   109,   105,   109,   105,   109,   105,   109,
     105,   109,   105,   109,   107,   107,   122,   107,   109,   107,
     107,   109,   109,   116,   117,   107,   107,   107,   107,   107,
     107,   104,   109,   107,   109,   109,   109,   109,   109,   122,
     109,   109,   109,   109,   109,   109,   109,   122,   109,   107,
     122,   122,   106,   114,   109,   116,   122,   109,   109,   109,
     109,   109,   109,   107,   109,   122,   107,   109,   109,   109,
     122,   122,   122,   122,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   122,   122,
     122,   105,   107,   117,   119,   122,   106,   109,   113,   122,
     118,   118,   109,   109,   122,   109,   109,   116,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   118,   122,   118,   116,   105,   119,   107,   107,
     107,   107,   107,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   107,   106,   109,   109,   109,   109,   109,   109,
     107,   122,   122,   122,   122,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   107,   115,
     106,   109,   122,   118,   109,   105,   107,   107,   116,   116,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   107,   118,   119,   105,   107,   107,
     107,   107,   122,   109,   109,   109,   109,   109,   109,   122,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   106,   107,   122,   109,   109,
     109,   109,   109,   116,   109,   109,   109,   122,   109,   109,
     109,   109,   109,   109,   109,   122,   109,   109,   122,   105,
     119,   120,   121,   122,   122,   109,   107,   107,   109,   107,
     109,   109,   109,   109,   106,   106,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   107,
     109,   116,   109,   122,   106,   109,   122,   109,   109,   109,
     122,   106,   109,   109,   106,   118,   109,   107,   107,   109,
     107,   106,   106,   109,   109,   109,   109,   109,   109,   109,
     106,   109,   109,   109,   109,   109,   109,   122,   109,   116,
     106,   122,   106,   109,   109,   106,   122,   109,   122,   118,
     109,   109,   109,   122,   107,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   116,   122,   122,   109,
     109,   122,   106,   116,   109,   109,   109,   107,   109,   109,
     106,   106,   109,   109,   109,   109,   109,   116,   116,   109,
     122,   122,   122,   109,   122,   122,   109,   109,   109,   109,
     106,   109,   109,   109,   116,   106,   109,   107,   106,   109,
     109,   109,   109,   109,   122,   106,   109,   109,   109,   109,
     109,   122,   109,   109,   109,   109,   109,   122,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   106,   106,
     106,   109,   109,   109,   105,   107,   106,   109,   109,   109,
     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
     109,   109,   109,   109,   109,   106,   109
};

#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		(-2)
#define YYEOF		0

#define YYACCEPT	goto yyacceptlab
#define YYABORT		goto yyabortlab
#define YYERROR		goto yyerrorlab


/* 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);						\
      yytoken = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { 								\
      yyerror ("syntax error: cannot back up");\
      YYERROR;							\
    }								\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

/* YYLLOC_DEFAULT -- Compute the default location (before the actions
   are run).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)		\
   ((Current).first_line   = (Rhs)[1].first_line,	\
    (Current).first_column = (Rhs)[1].first_column,	\
    (Current).last_line    = (Rhs)[N].last_line,	\
    (Current).last_column  = (Rhs)[N].last_column)
#endif

/* YYLEX -- calling `yylex' with the right arguments.  */

#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)			\
do {						\
  if (yydebug)					\
    YYFPRINTF Args;				\
} while (0)

# define YYDSYMPRINT(Args)			\
do {						\
  if (yydebug)					\
    yysymprint Args;				\
} while (0)

# define YYDSYMPRINTF(Title, Token, Value, Location)		\
do {								\
  if (yydebug)							\
    {								\
      YYFPRINTF (stderr, "%s ", Title);				\
      yysymprint (stderr, 					\
                  Token, Value);	\
      YYFPRINTF (stderr, "\n");					\
    }								\
} while (0)

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_stack_print (short int *bottom, short int *top)
#else
static void
yy_stack_print (bottom, top)
    short int *bottom;
    short int *top;
#endif
{
  YYFPRINTF (stderr, "Stack now");
  for (/* Nothing. */; bottom <= top; ++bottom)
    YYFPRINTF (stderr, " %d", *bottom);
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)				\
do {								\
  if (yydebug)							\
    yy_stack_print ((Bottom), (Top));				\
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_reduce_print (int yyrule)
#else
static void
yy_reduce_print (yyrule)
    int yyrule;
#endif
{
  int yyi;
  unsigned int yylno = yyrline[yyrule];
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
             yyrule - 1, yylno);
  /* Print the symbols being reduced, and their result.  */
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
}

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug)				\
    yy_reduce_print (Rule);		\
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
# define YYDSYMPRINTF(Title, Token, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef	YYINITDEPTH
# define YYINITDEPTH 200
#endif

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

   Do not make this value too large; the results are undefined if
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif



#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined (__GLIBC__) && defined (_STRING_H)
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
static YYSIZE_T
#   if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
#   else
yystrlen (yystr)
     const char *yystr;
#   endif
{
  register const char *yys = yystr;

  while (*yys++ != '\0')
    continue;

  return yys - yystr - 1;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
#   if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
#   else
yystpcpy (yydest, yysrc)
     char *yydest;
     const char *yysrc;
#   endif
{
  register char *yyd = yydest;
  register const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

#endif /* !YYERROR_VERBOSE */



#if YYDEBUG
/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
#else
static void
yysymprint (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  if (yytype < YYNTOKENS)
    {
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
# ifdef YYPRINT
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
    }
  else
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);

  switch (yytype)
    {
      default:
        break;
    }
  YYFPRINTF (yyoutput, ")");
}

#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yydestruct (int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yytype, yyvaluep)
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  switch (yytype)
    {

      default:
        break;
    }
}


/* Prevent warnings from -Wmissing-prototypes.  */

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM);
# else
int yyparse ();
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */



/* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;

/* Number of syntax errors so far.  */
int yynerrs;



/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM)
# else
int yyparse (YYPARSE_PARAM)
  void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{
  
  register int yystate;
  register int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken = 0;

  /* Three stacks and their tools:
     `yyss': related to states,
     `yyvs': related to semantic values,
     `yyls': related to locations.

     Refer to the stacks thru separate pointers, to allow yyoverflow
     to reallocate them elsewhere.  */

  /* The state stack.  */
  short int yyssa[YYINITDEPTH];
  short int *yyss = yyssa;
  register short int *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  register YYSTYPE *yyvsp;



#define YYPOPSTACK   (yyvsp--, yyssp--)

  YYSIZE_T yystacksize = YYINITDEPTH;

  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;


  /* When reducing, the number of symbols on the RHS of the reduced
     rule.  */
  int yylen;

  YYDPRINTF ((stderr, "Starting parse\n"));

  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;
  yyvsp = yyvs;


  goto yysetstate;

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

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
	/* 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 int *yyss1 = yyss;


	/* Each stack pointer address is followed by the size of the
	   data in use in that stack, in bytes.  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, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),

		    &yystacksize);

	yyss = yyss1;
	yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
	goto yyoverflowlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
	yystacksize = YYMAXDEPTH;

      {
	short int *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyoverflowlab;
	YYSTACK_RELOCATE (yyss);
	YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;


      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

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

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;

/*-----------.
| 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 == YYPACT_NINF)
    goto yydefault;

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

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));

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

  *++yyvsp = yylval;


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

  yystate = yyn;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 3:
#line 590 "rib.y"
    {
					args[numArguments++].integer				=	(int) yyvsp[0].real;
					argCheck();
					yyval.integer	=	yyvsp[-1].integer	+	1;
				;}
    break;

  case 4:
#line 597 "rib.y"
    {
					args[numArguments++].integer				=	(int) yyvsp[0].real;
					argCheck();
					yyval.integer	=	1;
				;}
    break;

  case 5:
#line 607 "rib.y"
    {
					args[numArguments++].real					=	yyvsp[0].real;
					argCheck();
					yyval.integer	=	yyvsp[-1].integer	+	1;
				;}
    break;

  case 6:
#line 614 "rib.y"
    {
					args[numArguments++].real					=	yyvsp[0].real;
					argCheck();
					yyval.integer	=	1;
				;}
    break;

  case 7:
#line 623 "rib.y"
    {
					char	*theString	=	strdup(yyvsp[0].string);
					args[numArguments++].string					=	theString;
					allocatedStrings->push(theString);
					argCheck();
					yyval.integer	=	yyvsp[-1].integer	+	1;
				;}
    break;

  case 8:
#line 632 "rib.y"
    {
					char	*theString	=	strdup(yyvsp[0].string);
					args[numArguments++].string					=	theString;
					allocatedStrings->push(theString);
					argCheck();
					yyval.integer	=	1;
				;}
    break;

  case 9:
#line 644 "rib.y"
    {
					yyval.integer = yyvsp[-1].integer;
				;}
    break;

  case 10:
#line 650 "rib.y"
    {
					yyval.integer = 0;
				;}
    break;

  case 11:
#line 657 "rib.y"
    {
					yyval.integer	=	yyvsp[0].integer;
				;}
    break;

  case 12:
#line 662 "rib.y"
    {
					yyval.integer	=	yyvsp[0].integer;
				;}
    break;

  case 13:
#line 670 "rib.y"
    {
					yyval.integer = yyvsp[-1].integer;
				;}
    break;

  case 14:
#line 676 "rib.y"
    {
					yyval.integer = 0;
				;}
    break;

  case 15:
#line 685 "rib.y"
    {
					yyval.integer	=	yyvsp[-1].integer;
				;}
    break;

  case 16:
#line 690 "rib.y"
    {
					char	*theString	=	strdup(yyvsp[0].string);
					args[numArguments++].string					=	theString;
					allocatedStrings->push(theString);
					argCheck();
					yyval.integer	= 1;
				;}
    break;

  case 18:
#line 706 "rib.y"
    {
					yyval.integer	=	0;
				;}
    break;

  case 19:
#line 711 "rib.y"
    {
					yyval.integer	=	yyvsp[0].integer;
				;}
    break;

  case 20:
#line 719 "rib.y"
    {
				;}
    break;

  case 21:
#line 722 "rib.y"
    {
					int	i;

					assert(numParameters < maxParameter);

					// Fix the pointers
					for (i=0;i<numParameters;i++) {
						tokens[i]				=	parameters[i].name;

						if (parameters[i].type == RT_TEXT)
							vals[i]				=	(RtPointer) &args[parameters[i].valuesStart].string;
						else
							vals[i]				=	(RtPointer) &args[parameters[i].valuesStart];

						parameters[i].values	=	args + parameters[i].valuesStart;
					}
				;}
    break;

  case 22:
#line 743 "rib.y"
    {
					// A parameter is either a float array
					parameters[numParameters].name			=	yyvsp[-1].string;
					parameters[numParameters].type			=	RT_FLOAT;
					parameters[numParameters].numItems		=	yyvsp[0].integer;
					parameters[numParameters].valuesStart	=	numArguments-yyvsp[0].integer;
					numParameters++;
					paramCheck();
				;}
    break;

  case 23:
#line 755 "rib.y"
    {	
					// Or a string array
					parameters[numParameters].name			=	yyvsp[-1].string;
					parameters[numParameters].type			=	RT_TEXT;
					parameters[numParameters].numItems		=	yyvsp[0].integer;
					parameters[numParameters].valuesStart	=	numArguments-yyvsp[0].integer;
					numParameters++;
					paramCheck();
				;}
    break;

  case 24:
#line 767 "rib.y"
    {
					// Save the line number in case we have an error
					ribCommandLineno	=	ribLineno;
				;}
    break;

  case 25:
#line 772 "rib.y"
    {
					char	*currentString;
					numArguments	=	0;
					numParameters	=	0;
					while((currentString=allocatedStrings->pop()) != NULL)
						free(currentString);

				;}
    break;

  case 27:
#line 785 "rib.y"
    {
					if (callback != NULL) {
						callback(yyvsp[0].string);
					}
				;}
    break;

  case 28:
#line 794 "rib.y"
    {
					RiDeclare(yyvsp[-1].string,yyvsp[0].string);
				;}
    break;

  case 29:
#line 799 "rib.y"
    {
					RiFrameBegin(0);
				;}
    break;

  case 30:
#line 805 "rib.y"
    {
					RiFrameBegin((int) yyvsp[0].real);
				;}
    break;

  case 31:
#line 810 "rib.y"
    {
					RiFrameEnd();
				;}
    break;

  case 32:
#line 815 "rib.y"
    {
					RiWorldBegin();
				;}
    break;

  case 33:
#line 820 "rib.y"
    {
					RiWorldEnd();
				;}
    break;

  case 34:
#line 828 "rib.y"
    {
					RiFormat((int) yyvsp[-2].real,(int) yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 35:
#line 834 "rib.y"
    {
					RiFrameAspectRatio(yyvsp[0].real);
				;}
    break;

  case 36:
#line 843 "rib.y"
    {
					RiScreenWindow(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 37:
#line 854 "rib.y"
    {
					RiScreenWindow(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
				;}
    break;

  case 38:
#line 863 "rib.y"
    {
					RiCropWindow(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 39:
#line 874 "rib.y"
    {
					RiCropWindow(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
				;}
    break;

  case 40:
#line 881 "rib.y"
    {
					RiProjectionV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 41:
#line 888 "rib.y"
    {
					RiClipping(yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 42:
#line 899 "rib.y"
    {
					RiClippingPlane(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 43:
#line 907 "rib.y"
    {
					RiDepthOfField(yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 44:
#line 912 "rib.y"
    {
					RiDepthOfField(C_INFINITY,1,1);
				;}
    break;

  case 45:
#line 919 "rib.y"
    {
					RiShutter(yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 46:
#line 925 "rib.y"
    {
					RiPixelVariance(yyvsp[0].real);
				;}
    break;

  case 47:
#line 932 "rib.y"
    {
					RiPixelSamples(yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 48:
#line 940 "rib.y"
    {
					RtFilterFunc	f;

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

  case 49:
#line 951 "rib.y"
    {
					RiExposure(yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 50:
#line 958 "rib.y"
    {
					// No parameter list checking is performed for the shaders
					if (parameterListCheck()) {
						RiImagerV(yyvsp[-1].string,numParameters,tokens,vals);
					}
				;}
    break;

  case 51:
#line 971 "rib.y"
    {
					RiQuantize(yyvsp[-4].string,(int) yyvsp[-3].real,(int) yyvsp[-2].real,(int) yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 52:
#line 980 "rib.y"
    {
					RiDisplayV(yyvsp[-3].string,yyvsp[-2].string,yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 53:
#line 987 "rib.y"
    {
					RiDisplayChannelV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 54:
#line 994 "rib.y"
    {
					if (parameterListCheck()) {
						RiHiderV(yyvsp[-1].string,numParameters,tokens,vals);
					}
				;}
    break;

  case 55:
#line 1002 "rib.y"
    {
					if ((numArguments & 1) || ((numArguments % 6) != 0)) {
						error(CODE_MISSINGDATA,"ColorSamples: Invalid number of arguments (\"%d\") \n",numArguments);
					} else {
						int		n		=	numArguments/6;
						float	*argf1	=	(float *) get(0);
						float	*argf2	=	(float *) get(n*3);

						RiColorSamples(n,argf1,argf2);
					}
				;}
    break;

  case 56:
#line 1017 "rib.y"
    {
					if ((yyvsp[-1].integer != yyvsp[0].integer) || ((numArguments % 6) != 0)) {
						error(CODE_MISSINGDATA,"ColorSamples: Invalid number of arguments (\"%d\") \n",numArguments);
					} else {
						int		n		=	numArguments/6;
						float	*argf1	=	(float *) get(0);
						float	*argf2	=	(float *) get(n*3);

						RiColorSamples(n,argf1,argf2);
					}
				;}
    break;

  case 57:
#line 1031 "rib.y"
    {
					RiRelativeDetail(yyvsp[0].real);	
				;}
    break;

  case 58:
#line 1038 "rib.y"
    {
					if (parameterListCheck()) {
						RiOptionV(yyvsp[-1].string,numParameters,tokens,vals);
					}
				;}
    break;

  case 59:
#line 1045 "rib.y"
    {
					RiAttributeBegin();
				;}
    break;

  case 60:
#line 1050 "rib.y"
    {
					RiAttributeEnd();
				;}
    break;

  case 61:
#line 1058 "rib.y"
    {
					RtColor	color;

					color[0]	=	yyvsp[-2].real;
					color[1]	=	yyvsp[-1].real;
					color[2]	=	yyvsp[0].real;

					RiColor(color);
				;}
    break;

  case 62:
#line 1072 "rib.y"
    {
					RtColor	color;

					color[0]	=	yyvsp[-2].real;
					color[1]	=	yyvsp[-1].real;
					color[2]	=	yyvsp[0].real;

					RiOpacity(color);
				;}
    break;

  case 63:
#line 1088 "rib.y"
    {
					RtColor	color;

					color[0]	=	yyvsp[-3].real;
					color[1]	=	yyvsp[-2].real;
					color[2]	=	yyvsp[-1].real;

					RiColor(color);
				;}
    break;

  case 64:
#line 1104 "rib.y"
    {
					RtColor	color;

					color[0]	=	yyvsp[-3].real;
					color[1]	=	yyvsp[-2].real;
					color[2]	=	yyvsp[-1].real;

					RiOpacity(color);
				;}
    break;

  case 65:
#line 1123 "rib.y"
    {
					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);
				;}
    break;

  case 66:
#line 1138 "rib.y"
    {
					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);
				;}
    break;

  case 67:
#line 1146 "rib.y"
    {
					if (lights == NULL)	lights	=	new CArray<RtLightHandle>;

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

  case 68:
#line 1156 "rib.y"
    {
					if (lightNames == NULL)	lightNames	=	new CTrie<RtLightHandle>;
					
					char *lName = strdup(yyvsp[-1].string);
					permaStrings->push(lName);
					lightNames->insert(lName,RiLightSourceV(yyvsp[-2].string,numParameters,tokens,vals));
				;}
    break;

  case 69:
#line 1167 "rib.y"
    {
					RiLightSourceV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 70:
#line 1175 "rib.y"
    {
					if (lights == NULL)	lights	=	new CArray<RtLightHandle>;

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

  case 71:
#line 1185 "rib.y"
    {
					if (lightNames == NULL)	lightNames	=	new CTrie<RtLightHandle>;
					
					char *lName = strdup(yyvsp[-1].string);
					permaStrings->push(lName);
					lightNames->insert(lName,RiLightSourceV(yyvsp[-2].string,numParameters,tokens,vals));
				;}
    break;

  case 72:
#line 1196 "rib.y"
    {
					if (lights == NULL)	lights	=	new CArray<RtLightHandle>;

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

  case 73:
#line 1205 "rib.y"
    {
					if (lightNames == NULL)	lightNames	=	new CTrie<RtLightHandle>;
					RtLightHandle lightHandle = NULL;
					
					if(lightNames->find(yyvsp[-1].string,lightHandle)){
						RiIlluminate(lightHandle,(int) yyvsp[0].real);
					}
				;}
    break;

  case 74:
#line 1217 "rib.y"
    {
					RiSurfaceV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 75:
#line 1224 "rib.y"
    {
					RiAtmosphereV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 76:
#line 1231 "rib.y"
    {
					RiInteriorV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 77:
#line 1238 "rib.y"
    {
					RiExteriorV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 78:
#line 1244 "rib.y"
    {
					RiShadingRate(yyvsp[0].real);
				;}
    break;

  case 79:
#line 1250 "rib.y"
    {
					RiShadingInterpolation(yyvsp[0].string);
				;}
    break;

  case 80:
#line 1256 "rib.y"
    {
					RiMatte((RtBoolean) yyvsp[0].real);
				;}
    break;

  case 81:
#line 1269 "rib.y"
    {
					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);
				;}
    break;

  case 82:
#line 1289 "rib.y"
    {
					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);
				;}
    break;

  case 83:
#line 1311 "rib.y"
    {
					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);
				;}
    break;

  case 84:
#line 1331 "rib.y"
    {
					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);
				;}
    break;

  case 85:
#line 1349 "rib.y"
    {
					RiDetailRange(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 86:
#line 1360 "rib.y"
    {
					RiDetailRange(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
				;}
    break;

  case 87:
#line 1367 "rib.y"
    {
					RiGeometricApproximation(yyvsp[-1].string,yyvsp[0].real);
				;}
    break;

  case 88:
#line 1373 "rib.y"
    {
					RiGeometricRepresentation(yyvsp[0].string);
				;}
    break;

  case 89:
#line 1379 "rib.y"
    {
					RiOrientation(yyvsp[0].string);
				;}
    break;

  case 90:
#line 1384 "rib.y"
    {
					RiReverseOrientation();
				;}
    break;

  case 91:
#line 1390 "rib.y"
    {
					RiSides((int) yyvsp[0].real);
				;}
    break;

  case 92:
#line 1395 "rib.y"
    {
					RiIdentity();
				;}
    break;

  case 93:
#line 1418 "rib.y"
    {
					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);
				;}
    break;

  case 94:
#line 1460 "rib.y"
    {
					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);
				;}
    break;

  case 95:
#line 1485 "rib.y"
    {
					RiPerspective(yyvsp[0].real);
				;}
    break;

  case 96:
#line 1493 "rib.y"
    {
					RiTranslate(yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 97:
#line 1501 "rib.y"
    {
					RiScale(yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 98:
#line 1510 "rib.y"
    {
					RiRotate(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 99:
#line 1522 "rib.y"
    {
					RiSkew(yyvsp[-6].real,yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,yyvsp[0].real);
				;}
    break;

  case 100:
#line 1536 "rib.y"
    {
					RiSkew(yyvsp[-7].real,yyvsp[-6].real,yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real);
				;}
    break;

  case 101:
#line 1543 "rib.y"
    {
					RiDeformationV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 102:
#line 1550 "rib.y"
    {
					RiDisplacementV(yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 103:
#line 1556 "rib.y"
    {
					RiCoordinateSystem(yyvsp[0].string);
				;}
    break;

  case 104:
#line 1562 "rib.y"
    {
					RiCoordSysTransform(yyvsp[0].string);
				;}
    break;

  case 105:
#line 1567 "rib.y"
    {
					RiTransformBegin();
				;}
    break;

  case 106:
#line 1572 "rib.y"
    {
					RiTransformEnd();
				;}
    break;

  case 107:
#line 1579 "rib.y"
    {
					if (parameterListCheck()) {
						RiAttributeV(yyvsp[-1].string,numParameters,tokens,vals);
					}
				;}
    break;

  case 108:
#line 1587 "rib.y"
    {
					if (parameterListCheck()) {	
						if (sizeCheck(numVertex,0,0,1)) {
							RiPolygonV(numVertex,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 109:
#line 1598 "rib.y"
    {
					int		*argi	=	(int *) get(0);

					if (parameterListCheck()) {
						if (sizeCheck(numVertex,0,0,1)) {
							RiGeneralPolygonV(yyvsp[-1].integer,argi,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 110:
#line 1612 "rib.y"
    {
					int	*argi1		=	(int *) get(0);
					int	*argi2		=	(int *) get(yyvsp[-2].integer);
					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) {
						error(CODE_MISSINGDATA,"Vertex count mismatch (%d != %d)\n",nvertices,yyvsp[-1].integer);
					} else {
						// Find out the number of vertices required
						for (i=0,maxVertex=0;i<nvertices;i++) {
							if (argi2[i] > maxVertex)
								maxVertex	=	argi2[i];
						}

						maxVertex++;

						if (parameterListCheck()) {
							if (sizeCheck(maxVertex,0,nvertices,yyvsp[-2].integer)) {
								RiPointsPolygonsV(yyvsp[-2].integer,argi1,argi2,numParameters,tokens,vals);
							}
						}
					}
				;}
    break;

  case 111:
#line 1649 "rib.y"
    {
					int	*argi1		=	(int *) get(0);
					int	*argi2		=	(int *) get(yyvsp[-3].integer);
					int	*argi3		=	(int *) get(yyvsp[-2].integer+yyvsp[-3].integer);
					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) {
						error(CODE_MISSINGDATA,"Loop count mismatch (%d != %d)\n",numloops,yyvsp[-2].integer);
					} else {
						for (i=0;i<yyvsp[-2].integer;i++) {
							numvertices	+=	argi2[i];
						}

						if (numvertices != yyvsp[-1].integer) {
							error(CODE_MISSINGDATA,"Vertex count mismatch (%d != %d)\n",numvertices,yyvsp[-1].integer);
						} else {
							for (i=0;i<numvertices;i++) {
								if (argi3[i] > maxVertex)
									maxVertex	=	argi3[i];
							}

							maxVertex++;

							if (parameterListCheck()) {
								if (sizeCheck(maxVertex,0,numvertices,yyvsp[-3].integer)) {
									RiPointsGeneralPolygonsV(yyvsp[-3].integer,argi1,argi2,argi3,numParameters,tokens,vals);
								}
							}
						}
					}
				;}
    break;

  case 112:
#line 1693 "rib.y"
    {
					RtBasis	*argf1,*argf2;

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

  case 113:
#line 1723 "rib.y"
    {
					RtBasis	*argf2;

					if (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);
					}
				;}
    break;

  case 114:
#line 1772 "rib.y"
    {
					RtBasis	*argf1;

					if (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);
					}
				;}
    break;

  case 115:
#line 1838 "rib.y"
    {
					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);
				;}
    break;

  case 116:
#line 1881 "rib.y"
    {
					int	numExpectedVertices;
					int	numExpectedPatches	=	1;


					if (strcmp(yyvsp[-1].string,RI_BILINEAR) == 0) {
						numExpectedVertices	=	4;
					} else if (strcmp(yyvsp[-1].string,RI_BICUBIC) == 0) {
						numExpectedVertices	=	16;
					} else {
						error(CODE_BADTOKEN,"Unknown patch type: \"%s\"\n",yyvsp[-1].string);
						numExpectedVertices	=	0;
					}

					if (numExpectedVertices > 0) {
						if (parameterListCheck()) {
							if (sizeCheck(numExpectedVertices,4,4,1)) {
								RiPatchV(yyvsp[-1].string,numParameters,tokens,vals);
							}
						}
					}
				;}
    break;

  case 117:
#line 1911 "rib.y"
    {
					int	numExpectedVertices;
					int	numuPatches,numvPatches;
					int	nu	=	(int) yyvsp[-4].real;
					int	nv	=	(int) yyvsp[-2].real;
					CAttributes	*attributes	=	currentRenderer->getAttributes(FALSE);
					int	uw,vw;
					int	numVaryings;

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

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

					if (strcmp(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;
						}

						numVaryings		=	nu*nv;
					} else if (strcmp(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;
						}

						numVaryings		=	(numuPatches+1-uw)*(numvPatches+1-vw);
					} else {
						error(CODE_BADTOKEN,"Unknown patch type: \"%s\"\n",yyvsp[-5].string);
						numExpectedVertices	=	0;
					}

					if (numExpectedVertices > 0) {
						if (parameterListCheck()) {
							if (sizeCheck(numExpectedVertices,numVaryings,numuPatches*numvPatches*4,numuPatches*numvPatches)) {
								RiPatchMeshV(yyvsp[-5].string,(int) yyvsp[-4].real,yyvsp[-3].string,(int) yyvsp[-2].real,yyvsp[-1].string,numParameters,tokens,vals);
							}
						}
					}
				;}
    break;

  case 118:
#line 1992 "rib.y"
    {
					float	*argf1	=	(float *) get(0);
					float	*argf2	=	(float *) get(yyvsp[-8].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		numExpectedVertices	=	uPoints*vPoints;
					int		numExpectedPatches	=	uPatches*vPatches;

					if (parameterListCheck()) {
						if (sizeCheck(numExpectedVertices,(uPoints-uOrder+2)*(vPoints-vOrder+2),uPatches*vPatches*4,uPatches*vPatches)) {
							RiNuPatchV((int) yyvsp[-10].real,(int) yyvsp[-9].real,argf1,yyvsp[-7].real,yyvsp[-6].real,(int) yyvsp[-5].real,(int) yyvsp[-4].real,argf2,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 119:
#line 2024 "rib.y"
    {
					int		*argi1	=	(int *)		get(0);
					int		*argi2	=	(int *)		get(yyvsp[-8].integer);
					float	*argf3	=	(float *)	get(yyvsp[-7].integer+yyvsp[-8].integer);
					float	*argf4	=	(float *)	get(yyvsp[-6].integer+yyvsp[-7].integer+yyvsp[-7].integer);
					float	*argf5	=	(float *)	get(yyvsp[-5].integer+yyvsp[-6].integer+yyvsp[-7].integer+yyvsp[-8].integer);
					int		*argi6	=	(int *)		get(yyvsp[-4].integer+yyvsp[-5].integer+yyvsp[-6].integer+yyvsp[-7].integer+yyvsp[-8].integer);
					float	*argf7	=	(float *)	get(yyvsp[-3].integer+yyvsp[-4].integer+yyvsp[-5].integer+yyvsp[-6].integer+yyvsp[-7].integer+yyvsp[-8].integer);
					float	*argf8	=	(float *)	get(yyvsp[-2].integer+yyvsp[-3].integer+yyvsp[-4].integer+yyvsp[-5].integer+yyvsp[-6].integer+yyvsp[-7].integer+yyvsp[-8].integer);
					float	*argf9	=	(float *)	get(yyvsp[-1].integer+yyvsp[-2].integer+yyvsp[-3].integer+yyvsp[-4].integer+yyvsp[-5].integer+yyvsp[-6].integer+yyvsp[-7].integer+yyvsp[-8].integer);

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

  case 120:
#line 2044 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiSphereV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 121:
#line 2060 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiSphereV(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 122:
#line 2073 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiConeV(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 123:
#line 2088 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiConeV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 124:
#line 2102 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiCylinderV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 125:
#line 2118 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiCylinderV(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 126:
#line 2135 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							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,vals);
						}
					}
				;}
    break;

  case 127:
#line 2163 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							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,vals);
						}
					}
				;}
    break;

  case 128:
#line 2186 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiParaboloidV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 129:
#line 2202 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiParaboloidV(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 130:
#line 2215 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiDiskV(yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 131:
#line 2230 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiDiskV(yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 132:
#line 2245 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiTorusV(yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,yyvsp[-1].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 133:
#line 2262 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(0,4,4,1)) {
							RiTorusV(yyvsp[-6].real,yyvsp[-5].real,yyvsp[-4].real,yyvsp[-3].real,yyvsp[-2].real,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 134:
#line 2275 "rib.y"
    {
					int			*argi1		=	(int *) get(0);
					int			numVertices,numUniforms;
					CAttributes	*attributes	=	currentRenderer->getAttributes(FALSE);
					int			wrap;
					int			numVaryings,i;

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

					if (strcmp(yyvsp[-3].string,RI_LINEAR) == 0) {
						for (i=0,numVertices=0;i<yyvsp[-2].integer;i++) {
							numVertices	+=	argi1[i];
						}

						numVaryings		=	numVertices;
						numUniforms		=	yyvsp[-2].integer;
					} else if (strcmp(yyvsp[-3].string,RI_CUBIC) == 0) {
						for (i=0,numVertices=0,numVaryings=0,numUniforms=0;i<yyvsp[-2].integer;i++) {
							int	j		=	(argi1[i] - 4) / attributes->vStep + 1;
							numVertices	+=	argi1[0];
							numVaryings	+=	j + (1 - wrap);
						}
						numUniforms		=	yyvsp[-2].integer;
					} else {
						error(CODE_BADTOKEN,"Unknown patch type: \"%s\"\n",yyvsp[-3].string);
						numVertices	=	0;
					}

					if (numVertices > 0) {
						if (parameterListCheck()) {
							if (sizeCheck(numVertices,numVaryings,0,numUniforms)) {
								RiCurvesV(yyvsp[-3].string,yyvsp[-2].integer,argi1,yyvsp[-1].string,numParameters,tokens,vals);
							}
						}
					}
				;}
    break;

  case 135:
#line 2318 "rib.y"
    {
					if (parameterListCheck()) {
						if (sizeCheck(numVertex,0,0,1)) {
							RiPointsV(numVertex,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 136:
#line 2335 "rib.y"
    {
					int		*argi1,*argi2,*argi3,*argi4;
					char	**args1;
					float	*argf1;
					int		numVertices,i,j;

					if (parameterListCheck()) {
						argi1	=	(int *)		get(0);
						argi2	=	(int *)		get(yyvsp[-6].integer);
						args1	=	(char **)	get(yyvsp[-6].integer+yyvsp[-5].integer);
						argi3	=	(int *)		get(yyvsp[-6].integer+yyvsp[-5].integer+yyvsp[-4].integer);
						argi4	=	(int *)		get(yyvsp[-6].integer+yyvsp[-5].integer+yyvsp[-4].integer+yyvsp[-3].integer);
						argf1	=	(float *)	get(yyvsp[-6].integer+yyvsp[-5].integer+yyvsp[-4].integer+yyvsp[-3].integer+yyvsp[-2].integer);

						// Count the number of faces / vertices
						for (i=0,j=0;i<yyvsp[-6].integer;j+=argi1[i],i++);

						for (numVertices=-1,i=0;i<j;i++) {
							if (argi2[i] > numVertices)	numVertices	=	argi2[i];
						}
						numVertices++;


						if (sizeCheck(numVertices,numVertices,j,yyvsp[-6].integer)) {
							RiSubdivisionMeshV(yyvsp[-7].string,yyvsp[-6].integer,argi1,argi2,yyvsp[-4].integer,args1,argi3,argi4,argf1,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 137:
#line 2369 "rib.y"
    {
					int		*argi1,*argi2;
					int		numVertices,i,j;

					if (parameterListCheck()) {
						argi1	=	(int *) get(0);
						argi2	=	(int *) get(yyvsp[-2].integer);

						// Count the number of faces / vertices
						for (i=0,j=0;i<yyvsp[-2].integer;j+=argi1[i],i++);

						for (numVertices=-1,i=0;i<j;i++) {
							if (argi2[i] > numVertices)	numVertices	=	argi2[i];
						}
						numVertices++;


						if (sizeCheck(numVertices,numVertices,j,yyvsp[-2].integer)) {
							RiSubdivisionMeshV(yyvsp[-3].string,yyvsp[-2].integer,argi1,argi2,0,NULL,NULL,NULL,NULL,numParameters,tokens,vals);
						}
					}
				;}
    break;

  case 138:
#line 2397 "rib.y"
    {
					// FIXME: Not implemented
				;}
    break;

  case 139:
#line 2404 "rib.y"
    {
					if (parameterListCheck()) {
						RiGeometryV(yyvsp[-1].string,numParameters,tokens,vals);
					}
				;}
    break;

  case 140:
#line 2421 "rib.y"
    {
					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 (strcmp(yyvsp[-9].string,RI_PROCDELAYEDREADARCHIVE) == 0) {
						if (yyvsp[-8].integer != 1) {
							error(CODE_MISSINGDATA,"Proc delayed archive expects one argument (given %d)\n",yyvsp[-8].integer);
						} else {
							arg		=	(char **) get(0);

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

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

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

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

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

							RiProcedural((RtPointer) cData,bound,RiProcDynamicLoad,RiProcFree);
						}
					} else {
						error(CODE_BADTOKEN,"Unknown procedural: %s\n",yyvsp[-9].string);
						delete cData;
					}
				;}
    break;

  case 141:
#line 2481 "rib.y"
    {
					RiSolidBegin(yyvsp[0].string);
				;}
    break;

  case 142:
#line 2486 "rib.y"
    {
					RiSolidEnd();
				;}
    break;

  case 143:
#line 2492 "rib.y"
    {
					if (ribObjects == NULL)	ribObjects	=	new CArray<RtPointer>;

					(*ribObjects)[(int) yyvsp[0].real]	=	RiObjectBegin();
				;}
    break;

  case 144:
#line 2499 "rib.y"
    {
					RiObjectEnd();
				;}
    break;

  case 145:
#line 2505 "rib.y"
    {
					if (ribObjects != NULL) {
						RiObjectInstance((*ribObjects)[(int) yyvsp[0].real]);
					} else {
						error(CODE_MISSINGDATA,"Object %d is not found\n",(int) yyvsp[0].real);
					}
				;}
    break;

  case 146:
#line 2515 "rib.y"
    {
					float	*argf	=	(float *) get(0);

					RiMotionBeginV(yyvsp[0].integer,argf);
				;}
    break;

  case 147:
#line 2522 "rib.y"
    {
					RiMotionEnd();
				;}
    break;

  case 148:
#line 2535 "rib.y"
    {
					RtFilterFunc	f;

					if ((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,vals);
					}
				;}
    break;

  case 149:
#line 2552 "rib.y"
    {
					RtFilterFunc	f;

					if ((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,vals);
					}
				;}
    break;

  case 150:
#line 2567 "rib.y"
    {
					RtFilterFunc	f;

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

  case 151:
#line 2588 "rib.y"
    {
					RtFilterFunc	f;

					if ((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,vals);
					}
				;}
    break;

  case 152:
#line 2600 "rib.y"
    {
					RiMakeShadowV(yyvsp[-2].string,yyvsp[-1].string,numParameters,tokens,vals);
				;}
    break;

  case 153:
#line 2606 "rib.y"
    {
					RtErrorHandler 	e	=	getErrorHandler(yyvsp[0].string);

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

  case 154:
#line 2616 "rib.y"
    {
				;}
    break;

  case 155:
#line 2621 "rib.y"
    {
				;}
    break;

  case 156:
#line 2625 "rib.y"
    {
					if (YYRECOVERING() == 0) {
						error(CODE_BADFILE,"Syntax error.\n");
					}
				;}
    break;


    }

/* Line 1010 of yacc.c.  */
#line 3960 "rib.cpp"

  yyvsp -= yylen;
  yyssp -= yylen;


  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;


  /* 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 - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (YYPACT_NINF < yyn && yyn < YYLAST)
	{
	  YYSIZE_T yysize = 0;
	  int yytype = YYTRANSLATE (yychar);
	  const char* yyprefix;
	  char *yymsg;
	  int yyx;

	  /* Start YYX at -YYN if negative to avoid negative indexes in
	     YYCHECK.  */
	  int yyxbegin = yyn < 0 ? -yyn : 0;

	  /* Stay within bounds of both yycheck and yytname.  */
	  int yychecklim = YYLAST - yyn;
	  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
	  int yycount = 0;

	  yyprefix = ", expecting ";
	  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
	      {
		yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
		yycount += 1;
		if (yycount == 5)
		  {
		    yysize = 0;
		    break;
		  }
	      }
	  yysize += (sizeof ("syntax error, unexpected ")
		     + yystrlen (yytname[yytype]));
	  yymsg = (char *) YYSTACK_ALLOC (yysize);
	  if (yymsg != 0)
	    {
	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
	      yyp = yystpcpy (yyp, yytname[yytype]);

	      if (yycount < 5)
		{
		  yyprefix = ", expecting ";
		  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
		      {
			yyp = yystpcpy (yyp, yyprefix);
			yyp = yystpcpy (yyp, yytname[yyx]);
			yyprefix = " or ";
		      }
		}
	      yyerror (yymsg);
	      YYSTACK_FREE (yymsg);
	    }
	  else
	    yyerror ("syntax error; also virtual memory exhausted");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror ("syntax error");
    }



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

      if (yychar <= YYEOF)
        {
          /* If at end of input, pop the error token,
	     then the rest of the stack, then return failure.  */
	  if (yychar == YYEOF)
	     for (;;)
	       {
		 YYPOPSTACK;
		 if (yyssp == yyss)
		   YYABORT;
		 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
		 yydestruct (yystos[*yyssp], yyvsp);
	       }
        }
      else
	{
	  YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
	  yydestruct (yytoken, &yylval);
	  yychar = YYEMPTY;

	}
    }

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


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

#ifdef __GNUC__
  /* Pacify GCC when the user code never invokes YYERROR and the label
     yyerrorlab therefore never appears in user code.  */
  if (0)
     goto yyerrorlab;
#endif

  yyvsp -= yylen;
  yyssp -= yylen;
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
	{
	  yyn += YYTERROR;
	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
	    {
	      yyn = yytable[yyn];
	      if (0 < yyn)
		break;
	    }
	}

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
	YYABORT;

      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
      yydestruct (yystos[yystate], yyvsp);
      YYPOPSTACK;
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  YYDPRINTF ((stderr, "Shifting error token, "));

  *++yyvsp = yylval;


  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here.  |
`----------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
  return yyresult;
}


#line 2632 "rib.y"


#include "lex.rib.cpp"

// Our position in the rib file
static	int		ribStart	=	0;
static	int		ribStep		=	5*(1<<10);	// Parse 5 KB at a time

///////////////////////////////////////////////////////////////////////
// Function				:	riberror
// Description			:	Parser error file
// Return Value			:	-
// Comments				:
// Date last edited		:	10/8/2001
void	riberror(char *s,...) {
	warning(CODE_BADFILE,"RIB Parse error\n");
}

///////////////////////////////////////////////////////////////////////
// Function				:	parseRib
// Description			:	Parse a rib file
// Return Value			:	-
// Comments				:
// Date last edited		:	10/8/2001
void	ribParse(FILE *in,void (*c)(const char *)) {
	if (in != NULL) {
		ribin		=	in;

		// Save the environment first
		CArray<RtPointer>	*savedLights					=	lights;
		CTrie<RtPointer>	*savedLightNames				=	lightNames;
		CArray<RtPointer>	*savedObjects					=	ribObjects;
		CArray<char *>		*savedAllocatedStrings			=	allocatedStrings;
		int					savedRibLineno					=	ribLineno;
		const char			*savedActivity					=	stats.activity;
		void				(*savedCallback)(const char *)	=	callback;
		ERIBValue			*savedArgs						=	args;
		int					savedNumArguments				=	numArguments;
		int					savedMaxArgument				=	maxArgument;
		int					savedArgumentStepSize			=	argumentStepSize;
		int					savedNumParameters				=	numParameters;
		int					savedMaxParameter				=	maxParameter;
		TParameter			*savedParameters				=	parameters;
		RtToken				*savedTokens					=	tokens;
		RtPointer			*savedVals						=	vals;
		int					savedRibDepth					=	ribDepth;

		// Init the environment
		lights				=	NULL;
		lightNames			=	NULL;
		ribObjects			=	NULL;
		allocatedStrings	=	new CArray<char *>;
		stats.activity		=	"Rib parsing";
		callback			=	c;
		maxArgument			=	1000;
		argumentStepSize	=	100000;
		numArguments		=	0;
		args				=	new ERIBValue[maxArgument];
		maxParameter		=	20;
		numParameters		=	0;
		parameters			=	new TParameter[maxParameter];
		tokens				=	new RtToken[maxParameter];
		vals				=	new RtPointer[maxParameter];
		
		if ( ribDepth++ == 0) {
			// for the outermost depth only,
			// allocate storage for strings valid over the while rib
			permaStrings	=	new CArray<char *>;
		}
		
		ribLineno			=	1;

		ribparse();

		if (lights != NULL)		delete lights;
		if (lightNames != NULL)	delete lightNames;
		if (ribObjects != NULL)	delete ribObjects;
		delete allocatedStrings;
		delete [] args;
		delete [] parameters;
		delete [] tokens;
		delete [] vals;
		

		tokens				=	savedTokens;
		vals				=	savedVals;
		parameters			=	savedParameters;
		numParameters		=	savedNumParameters;
		maxParameter		=	savedMaxParameter;
		maxArgument			=	savedMaxArgument;
		numArguments		=	savedNumArguments;
		argumentStepSize	=	savedArgumentStepSize;
		args				=	savedArgs;
		lightNames			=	savedLightNames;
		lights				=	savedLights;
		ribObjects			=	savedObjects;
		ribLineno			=	savedRibLineno;
		allocatedStrings	=	savedAllocatedStrings;
		stats.activity		=	savedActivity;
		callback			=	savedCallback;
		
		if ((ribDepth = savedRibDepth) == 0) {
			// for the outermost depth only,
			// deallocate storage for strings valid over the while rib
			char *currentString;
			while((currentString=permaStrings->pop()) != NULL) {
				free(currentString);
			}
			
			delete permaStrings;
		}
	}
}

///////////////////////////////////////////////////////////////////////
// Function				:	parseRib
// Description			:	Parse a rib file
// Return Value			:	-
// Comments				:
// Date last edited		:	10/8/2001
int		ribwrap(void) {
	return 1;
}



///////////////////////////////////////////////////////////////////////
// Function				:	parserCleanup
// Description			:	Clean the memory allocated by the parser
// Return Value			:	-
// Comments				:
// Date last edited		:	10/8/2001
void		parserCleanup() {
	yy_delete_buffer(yy_current_buffer);
	yy_init				= 1;
}


