//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
#define UINT_PTR uintptr_t\r
#endif\r
\r
-#include <assert.h>\r
-\r
/* windows only pragma */\r
#ifdef _MSC_VER\r
#pragma warning(disable : 4786) // Don't warn about too long identifiers\r
\r
typedef int TSourceLoc;\r
\r
+#include <assert.h>\r
#include "PoolAlloc.h"\r
\r
//\r
//\r
typedef pool_allocator<char> TStringAllocator;\r
typedef std::basic_string <char, std::char_traits<char>, TStringAllocator > TString;\r
-inline TString* NewPoolTString(char* s)\r
+inline TString* NewPoolTString(const char* s)\r
{\r
void* memory = GlobalPoolAllocator.allocate(sizeof(TString));\r
return new(memory) TString(s);\r
{\r
char text[16]; // 32 bit ints are at most 10 digits in base 10\r
\r
- // we assume base 10 or 16 for all cases\r
- if (base == 10)\r
- sprintf(text, "%d", i);\r
- else if (base == 16)\r
- sprintf(text, "%x", i);\r
- else\r
- assert (!"String(int): unsupported base");\r
+ #ifdef _WIN32\r
+ itoa(i, text, base);\r
+ #else\r
+ // we assume base 10 for all cases\r
+ sprintf(text, "%d", i);\r
+ #endif\r
\r
return text;\r
}\r
\r
return TPersistString(locText);\r
}\r
+typedef TMap<TString, TString> TPragmaTable;\r
+typedef TMap<TString, TString>::tAllocator TPragmaTableAllocator;\r
\r
#endif // _COMMON_INCLUDED_\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
}\r
\r
void check() const {\r
- checkGuardBlock(preGuard(), (unsigned char) (guardBlockBeginVal), "before");\r
- checkGuardBlock(postGuard(), (unsigned char) (guardBlockEndVal), "after");\r
+ checkGuardBlock(preGuard(), guardBlockBeginVal, "before");\r
+ checkGuardBlock(postGuard(), guardBlockEndVal, "after");\r
}\r
\r
void checkAllocList() const;\r
unsigned char* mem; // beginning of our allocation (pts to header)\r
TAllocation* prevAlloc; // prior allocation in the chain\r
\r
- enum {\r
- guardBlockBeginVal = 0xfb,\r
- guardBlockEndVal = 0xfe,\r
- userDataFill = 0xcd\r
- };\r
+ // Support MSVC++ 6.0\r
+ const static unsigned char guardBlockBeginVal;\r
+ const static unsigned char guardBlockEndVal;\r
+ const static unsigned char userDataFill;\r
\r
# ifdef GUARD_BLOCKS\r
- enum {\r
- guardBlockSize = 16\r
- };\r
+ const static size_t guardBlockSize;\r
inline static size_t headerSize() { return sizeof(TAllocation); }\r
# else\r
- enum {\r
- guardBlockSize = 0\r
- };\r
+ const static size_t guardBlockSize;\r
inline static size_t headerSize() { return 0; }\r
# endif\r
};\r
//\r
typedef TPoolAllocator* PoolAllocatorPointer;\r
extern TPoolAllocator& GetGlobalPoolAllocator();\r
-extern PoolAllocatorPointer& GetCompilerPoolAllocator();\r
#define GlobalPoolAllocator GetGlobalPoolAllocator()\r
-#define CompilerPoolAllocator GetCompilerPoolAllocator()\r
struct TThreadGlobalPools\r
{\r
TPoolAllocator* globalPoolAllocator;\r
- TPoolAllocator* compilerPoolAllocator;\r
};\r
\r
//\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
#ifndef _RESOURCE_LIMITS_INCLUDED_\r
#define _RESOURCE_LIMITS_INCLUDED_\r
\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
struct TBuiltInResource {\r
int maxLights;\r
int maxClipPlanes;\r
int maxFragmentUniformComponents;\r
int maxDrawBuffers;\r
};\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
#endif // _RESOURCE_LIMITS_INCLUDED_\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
virtual TCompiler* getAsCompiler() { return this; }\r
virtual bool linkable() { return haveValidObjectCode; }\r
\r
- // Initialize our private pool for a new compilation, and\r
- // return it.\r
- virtual TPoolAllocator& getNewCompilationAllocator()\r
- {\r
- // We do a pop and push on the compiler pool, because compile can\r
- // be called repeatedly on the same compiler handle. Each time,\r
- // we want to pop away the results of any previous compile. We\r
- // could do that with popAll, but this is a somewhat smaller\r
- // hammer.\r
- compilerPool.pop();\r
- compilerPool.push();\r
- \r
- return compilerPool;\r
- }\r
-\r
- TPoolAllocator& getCompilerPoolAllocator() { return compilerPool; }\r
-\r
TInfoSink& infoSink;\r
protected:\r
EShLanguage language;\r
- bool haveValidObjectCode;\r
- \r
- // This is a per-compiler-object pool allocator. Allocations\r
- // who's lifetime need not extend beyond the lifetime of the\r
- // compiler itself can use this private pool.\r
- TPoolAllocator compilerPool; \r
+ bool haveValidObjectCode; \r
};\r
\r
//\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
int line;\r
};\r
\r
+typedef std::map<TTypeList*, TTypeList*> TStructureMap;\r
+typedef std::map<TTypeList*, TTypeList*>::iterator TStructureMapIterator;\r
//\r
// Base class for things that have a type.\r
//\r
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)\r
explicit TType(TBasicType t, TQualifier q = EvqTemporary, int s = 1, bool m = false, bool a = false) :\r
type(t), qualifier(q), size(s), matrix(m), array(a), arraySize(0),\r
- structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0)\r
+ structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0), typeName(0), mangled(0), fieldName(0)\r
{ }\r
explicit TType(TPublicType p) : \r
type(p.type), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(0), \r
- structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0)\r
+ structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0), typeName(0)\r
{\r
if (p.userDef) {\r
structure = p.userDef->getStruct();\r
structureSize = setStructSize(p.userDef->getStruct());\r
- typeName = p.userDef->getTypeName();\r
+ typeName = NewPoolTString(p.userDef->getTypeName().c_str());\r
}\r
}\r
explicit TType(TTypeList* userDef, TString n) : \r
type(EbtStruct), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0),\r
- structure(userDef), typeName(n), maxArraySize(0), arrayInformationType(0) {\r
+ structure(userDef), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0) {\r
structureSize = setStructSize(userDef);\r
+ typeName = NewPoolTString(n.c_str());\r
}\r
- \r
+ explicit TType() {}\r
virtual ~TType() {}\r
+\r
TType (const TType& type) { *this = type; }\r
\r
+ void copyType(const TType& copyOf, TStructureMap& remapper)\r
+ {\r
+ type = copyOf.type;\r
+ qualifier = copyOf.qualifier;\r
+ size = copyOf.size;\r
+ matrix = copyOf.matrix;\r
+ array = copyOf.array;\r
+ arraySize = copyOf.arraySize;\r
+ \r
+ TStructureMapIterator iter;\r
+ if (copyOf.structure) {\r
+ if ((iter = remapper.find(structure)) == remapper.end()) {\r
+ // create the new structure here\r
+ structure = NewPoolTTypeList();\r
+ for (unsigned int i = 0; i < copyOf.structure->size(); ++i) {\r
+ TTypeLine typeLine;\r
+ typeLine.line = (*copyOf.structure)[i].line;\r
+ typeLine.type = (*copyOf.structure)[i].type->clone(remapper);\r
+ structure->push_back(typeLine);\r
+ }\r
+ } else {\r
+ structure = iter->second;\r
+ }\r
+ } else\r
+ structure = 0;\r
+\r
+ fieldName = 0;\r
+ if (copyOf.fieldName)\r
+ fieldName = NewPoolTString(copyOf.fieldName->c_str());\r
+ typeName = 0;\r
+ if (copyOf.typeName)\r
+ typeName = NewPoolTString(copyOf.typeName->c_str());\r
+ \r
+ mangled = 0;\r
+ if (copyOf.mangled)\r
+ mangled = NewPoolTString(copyOf.mangled->c_str());\r
+\r
+ structureSize = copyOf.structureSize;\r
+ maxArraySize = copyOf.maxArraySize;\r
+ assert (copyOf.arrayInformationType == 0);\r
+ arrayInformationType = 0; // arrayInformationType should not be set for builtIn symbol table level\r
+ }\r
+\r
+ TType* clone(TStructureMap& remapper)\r
+ {\r
+ TType *newType = new TType();\r
+ newType->copyType(*this, remapper);\r
+\r
+ return newType;\r
+ }\r
+ \r
int setStructSize(TTypeList* userDef)\r
{\r
int stSize = 0;\r
for (TTypeList::iterator tl = userDef->begin(); tl != userDef->end(); tl++) {\r
if (((*tl).type)->isArray()) { \r
+ if (((*tl).type)->getStruct()) {\r
+ int structSize = setStructSize(((*tl).type)->getStruct());\r
+ stSize += structSize * ((*tl).type)->getArraySize();\r
+ } else {\r
stSize += ((*tl).type)->getInstanceSize() * ((*tl).type)->getArraySize();\r
+ }\r
} else if (((*tl).type)->isMatrix() || ((*tl).type)->isVector()){\r
stSize += ((*tl).type)->getInstanceSize();\r
} else if (((*tl).type)->getStruct()) {\r
structure = userDef->getStruct(); \r
// leave array information intact.\r
}\r
- virtual void setTypeName(const TString& n) { typeName = n; }\r
- virtual void setFieldName(const TString& n) { fieldName = n; }\r
- virtual const TString& getTypeName() const { return typeName; }\r
- virtual const TString& getFieldName() const { return fieldName; }\r
+ virtual void setTypeName(const TString& n) { typeName = NewPoolTString(n.c_str()); }\r
+ virtual void setFieldName(const TString& n) { fieldName = NewPoolTString(n.c_str()); }\r
+ virtual const TString& getTypeName() const\r
+ { \r
+ assert (typeName); \r
+ return *typeName; \r
+ }\r
+\r
+ virtual const TString& getFieldName() const\r
+ { \r
+ assert (fieldName);\r
+ return *fieldName; \r
+ }\r
+ \r
virtual TBasicType getBasicType() const { return type; }\r
virtual TQualifier getQualifier() const { return qualifier; }\r
virtual void changeQualifier(TQualifier q) { qualifier = q; }\r
return size;\r
}\r
\r
- virtual bool isMatrix() const { return matrix; }\r
- virtual bool isArray() const { return array; }\r
+ virtual bool isMatrix() const { return matrix ? true : false; }\r
+ virtual bool isArray() const { return array ? true : false; }\r
int getArraySize() const { return arraySize; }\r
void setArraySize(int s) { array = true; arraySize = s; }\r
void setMaxArraySize (int s) { maxArraySize = s; }\r
const char* getBasicString() const { return TType::getBasicString(type); }\r
const char* getQualifierString() const { return ::getQualifierString(qualifier); }\r
TTypeList* getStruct() { return structure; }\r
- int getStructSize() { return structureSize; }\r
+ int getStructSize() const { return structureSize; }\r
TTypeList* getStruct() const { return structure; }\r
TString& getMangledName() {\r
- if (mangled.size() == 0) {\r
- buildMangledName(mangled); \r
- mangled+=';';\r
+ if (!mangled) {\r
+ mangled = NewPoolTString("");\r
+ buildMangledName(*mangled); \r
+ *mangled+=';';\r
}\r
- return mangled;\r
+ \r
+ return *mangled;\r
}\r
bool operator==(const TType& right) const {\r
return type == right.type &&\r
TString getCompleteString() const;\r
\r
protected:\r
- TBasicType type;\r
- TQualifier qualifier;\r
- int size; // size of vector or matrix, not size of array\r
- bool matrix;\r
- bool array;\r
+ void buildMangledName(TString&);\r
+\r
int arraySize;\r
TTypeList* structure; // 0 unless this is a struct\r
- TString fieldName; // for structure field names\r
- TString typeName; // for structure field type name\r
- TString mangled;\r
+ TString *fieldName; // for structure field names\r
+ TString *typeName; // for structure field type name\r
+ TString *mangled;\r
int structureSize;\r
int maxArraySize;\r
TType* arrayInformationType;\r
\r
- void buildMangledName(TString&);\r
+ TQualifier qualifier : 7;\r
+ TBasicType type : 6;\r
+ int size : 8; // size of vector or matrix, not size of array\r
+ unsigned int matrix : 1;\r
+ unsigned int array : 1;\r
};\r
\r
#endif // _TYPES_INCLUDED_\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
// Operators used by the high-level (parse tree) representation.\r
//\r
-\r
enum TOperator {\r
EOpNull, // if in a node, should only mean a node is still being built\r
EOpSequence, // denotes a list of statements, or parameters, etc.\r
virtual bool promote(TInfoSink&) { return true; }\r
protected:\r
TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat)), op(o) {}\r
- TIntermOperator(TOperator o, TType t) : TIntermTyped(t), op(o) {} \r
+ TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {} \r
TOperator op;\r
};\r
\r
//\r
class TIntermUnary : public TIntermOperator {\r
public:\r
- TIntermUnary(TOperator o, TType t) : TIntermOperator(o, t), operand(0) {}\r
+ TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}\r
TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}\r
virtual void traverse(TIntermTraverser*);\r
virtual void setOperand(TIntermTyped* o) { operand = o; }\r
//\r
class TIntermAggregate : public TIntermOperator {\r
public:\r
- TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false) { }\r
- TIntermAggregate(TOperator o) : TIntermOperator(o) { }\r
+ TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0) { }\r
+ TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { }\r
+ ~TIntermAggregate() { delete pragmaTable; }\r
virtual TIntermAggregate* getAsAggregate() { return this; }\r
virtual void setOperator(TOperator o) { op = o; }\r
virtual TIntermSequence& getSequence() { return sequence; }\r
virtual void setUserDefined() { userDefined = true; }\r
virtual bool isUserDefined() { return userDefined; }\r
virtual TQualifierList& getQualifier() { return qualifier; }\r
+ void setOptimize(bool o) { optimize = o; }\r
+ void setDebug(bool d) { debug = d; }\r
+ bool getOptimize() { return optimize; }\r
+ bool getDebug() { return debug; }\r
+ void addToPragmaTable(const TPragmaTable& pTable);\r
+ const TPragmaTable& getPragmaTable() const { return *pragmaTable; }\r
protected:\r
+ TIntermAggregate(const TIntermAggregate&); // disallow copy constructor\r
+ TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator\r
TIntermSequence sequence;\r
TQualifierList qualifier;\r
TString name;\r
bool userDefined; // used for user defined function names\r
+ bool optimize;\r
+ bool debug;\r
+ TPragmaTable *pragmaTable;\r
};\r
\r
//\r
public:\r
TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) :\r
TIntermTyped(TType(EbtVoid)), condition(cond), trueBlock(trueB), falseBlock(falseB) {}\r
- TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, TType type) :\r
+ TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) :\r
TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB) {}\r
virtual void traverse(TIntermTraverser*);\r
virtual TIntermNode* getCondition() const { return condition; }\r
-#line 2 "Gen_glslang.cpp"\r
-/* A lexical scanner generated by flex */\r
-\r
-/* Scanner skeleton version:\r
- * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/mesa/shader/slang/MachineIndependent/Gen_glslang.cpp,v 1.2 2005/03/14 12:24:32 michal Exp $\r
- */\r
-\r
-#define FLEX_SCANNER\r
-#define YY_FLEX_MAJOR_VERSION 2\r
-#define YY_FLEX_MINOR_VERSION 5\r
-\r
-#include <stdio.h>\r
-\r
-\r
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */\r
-#ifdef c_plusplus\r
-#ifndef __cplusplus\r
-#define __cplusplus\r
-#endif\r
-#endif\r
-\r
-\r
-#ifdef __cplusplus\r
-\r
-#include <stdlib.h>\r
-#include <unistd.h>\r
-\r
-/* Use prototypes in function declarations. */\r
-#define YY_USE_PROTOS\r
-\r
-/* The "const" storage-class-modifier is valid. */\r
-#define YY_USE_CONST\r
-\r
-#else /* ! __cplusplus */\r
-\r
-#if __STDC__\r
-\r
-#define YY_USE_PROTOS\r
-#define YY_USE_CONST\r
-\r
-#endif /* __STDC__ */\r
-#endif /* ! __cplusplus */\r
-\r
-#ifdef __TURBOC__\r
- #pragma warn -rch\r
- #pragma warn -use\r
-#include <io.h>\r
-#include <stdlib.h>\r
-#define YY_USE_CONST\r
-#define YY_USE_PROTOS\r
-#endif\r
-\r
-#ifdef YY_USE_CONST\r
-#define yyconst const\r
-#else\r
-#define yyconst\r
-#endif\r
-\r
-\r
-#ifdef YY_USE_PROTOS\r
-#define YY_PROTO(proto) proto\r
-#else\r
-#define YY_PROTO(proto) ()\r
-#endif\r
-\r
-/* Returned upon end-of-file. */\r
-#define YY_NULL 0\r
-\r
-/* Promotes a possibly negative, possibly signed char to an unsigned\r
- * integer for use as an array index. If the signed char is negative,\r
- * we want to instead treat it as an 8-bit unsigned char, hence the\r
- * double cast.\r
- */\r
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)\r
-\r
-/* Enter a start condition. This macro really ought to take a parameter,\r
- * but we do it the disgusting crufty way forced on us by the ()-less\r
- * definition of BEGIN.\r
- */\r
-#define BEGIN yy_start = 1 + 2 *\r
-\r
-/* Translate the current start state into a value that can be later handed\r
- * to BEGIN to return to the state. The YYSTATE alias is for lex\r
- * compatibility.\r
- */\r
-#define YY_START ((yy_start - 1) / 2)\r
-#define YYSTATE YY_START\r
-\r
-/* Action number for EOF rule of a given start state. */\r
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\r
-\r
-/* Special action meaning "start processing a new file". */\r
-#define YY_NEW_FILE yyrestart( yyin )\r
-\r
-#define YY_END_OF_BUFFER_CHAR 0\r
-\r
-/* Size of default input buffer. */\r
-#define YY_BUF_SIZE 16384\r
-\r
-typedef struct yy_buffer_state *YY_BUFFER_STATE;\r
-\r
-extern int yyleng;\r
-extern FILE *yyin, *yyout;\r
-\r
-#define EOB_ACT_CONTINUE_SCAN 0\r
-#define EOB_ACT_END_OF_FILE 1\r
-#define EOB_ACT_LAST_MATCH 2\r
-\r
-/* The funky do-while in the following #define is used to turn the definition\r
- * int a single C statement (which needs a semi-colon terminator). This\r
- * avoids problems with code like:\r
- *\r
- * if ( condition_holds )\r
- * yyless( 5 );\r
- * else\r
- * do_something_else();\r
- *\r
- * Prior to using the do-while the compiler would get upset at the\r
- * "else" because it interpreted the "if" statement as being all\r
- * done when it reached the ';' after the yyless() call.\r
- */\r
-\r
-/* Return all but the first 'n' matched characters back to the input stream. */\r
-\r
-#define yyless(n) \\r
- do \\r
- { \\r
- /* Undo effects of setting up yytext. */ \\r
- *yy_cp = yy_hold_char; \\r
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \\r
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \\r
- } \\r
- while ( 0 )\r
-\r
-#define unput(c) yyunput( c, yytext_ptr )\r
-\r
-/* The following is because we cannot portably get our hands on size_t\r
- * (without autoconf's help, which isn't available because we want\r
- * flex-generated scanners to compile on their own).\r
- */\r
-typedef unsigned int yy_size_t;\r
-\r
-\r
-struct yy_buffer_state\r
- {\r
- FILE *yy_input_file;\r
-\r
- char *yy_ch_buf; /* input buffer */\r
- char *yy_buf_pos; /* current position in input buffer */\r
-\r
- /* Size of input buffer in bytes, not including room for EOB\r
- * characters.\r
- */\r
- yy_size_t yy_buf_size;\r
-\r
- /* Number of characters read into yy_ch_buf, not including EOB\r
- * characters.\r
- */\r
- int yy_n_chars;\r
-\r
- /* Whether we "own" the buffer - i.e., we know we created it,\r
- * and can realloc() it to grow it, and should free() it to\r
- * delete it.\r
- */\r
- int yy_is_our_buffer;\r
-\r
- /* Whether this is an "interactive" input source; if so, and\r
- * if we're using stdio for input, then we want to use getc()\r
- * instead of fread(), to make sure we stop fetching input after\r
- * each newline.\r
- */\r
- int yy_is_interactive;\r
-\r
- /* Whether we're considered to be at the beginning of a line.\r
- * If so, '^' rules will be active on the next match, otherwise\r
- * not.\r
- */\r
- int yy_at_bol;\r
-\r
- /* Whether to try to fill the input buffer when we reach the\r
- * end of it.\r
- */\r
- int yy_fill_buffer;\r
-\r
- int yy_buffer_status;\r
-#define YY_BUFFER_NEW 0\r
-#define YY_BUFFER_NORMAL 1\r
- /* When an EOF's been seen but there's still some text to process\r
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we\r
- * shouldn't try reading from the input source any more. We might\r
- * still have a bunch of tokens to match, though, because of\r
- * possible backing-up.\r
- *\r
- * When we actually see the EOF, we change the status to "new"\r
- * (via yyrestart()), so that the user can continue scanning by\r
- * just pointing yyin at a new input file.\r
- */\r
-#define YY_BUFFER_EOF_PENDING 2\r
- };\r
-\r
-static YY_BUFFER_STATE yy_current_buffer = 0;\r
-\r
-/* We provide macros for accessing buffer states in case in the\r
- * future we want to put the buffer states in a more general\r
- * "scanner state".\r
- */\r
-#define YY_CURRENT_BUFFER yy_current_buffer\r
-\r
-\r
-/* yy_hold_char holds the character lost when yytext is formed. */\r
-static char yy_hold_char;\r
-\r
-static int yy_n_chars; /* number of characters read into yy_ch_buf */\r
-\r
-\r
-int yyleng;\r
-\r
-/* Points to current character in buffer. */\r
-static char *yy_c_buf_p = (char *) 0;\r
-static int yy_init = 1; /* whether we need to initialize */\r
-static int yy_start = 0; /* start state number */\r
-\r
-/* Flag which is used to allow yywrap()'s to do buffer switches\r
- * instead of setting up a fresh yyin. A bit of a hack ...\r
- */\r
-static int yy_did_buffer_switch_on_eof;\r
-\r
-void yyrestart YY_PROTO(( FILE *input_file ));\r
-\r
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));\r
-void yy_load_buffer_state YY_PROTO(( void ));\r
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));\r
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));\r
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));\r
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));\r
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )\r
-\r
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));\r
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));\r
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));\r
-\r
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));\r
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));\r
-static void yy_flex_free YY_PROTO(( void * ));\r
-\r
-#define yy_new_buffer yy_create_buffer\r
-\r
-#define yy_set_interactive(is_interactive) \\r
- { \\r
- if ( ! yy_current_buffer ) \\r
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \\r
- yy_current_buffer->yy_is_interactive = is_interactive; \\r
- }\r
-\r
-#define yy_set_bol(at_bol) \\r
- { \\r
- if ( ! yy_current_buffer ) \\r
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \\r
- yy_current_buffer->yy_at_bol = at_bol; \\r
- }\r
-\r
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)\r
-\r
-\r
-#define yywrap() 1\r
-#define YY_SKIP_YYWRAP\r
-typedef unsigned char YY_CHAR;\r
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;\r
-typedef int yy_state_type;\r
-extern char *yytext;\r
-#define yytext_ptr yytext\r
-\r
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));\r
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));\r
-static int yy_get_next_buffer YY_PROTO(( void ));\r
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));\r
-\r
-/* Done after the current pattern has been matched and before the\r
- * corresponding action - sets up yytext.\r
- */\r
-#define YY_DO_BEFORE_ACTION \\r
- yytext_ptr = yy_bp; \\r
- yyleng = (int) (yy_cp - yy_bp); \\r
- yy_hold_char = *yy_cp; \\r
- *yy_cp = '\0'; \\r
- yy_c_buf_p = yy_cp;\r
-\r
-#define YY_NUM_RULES 144\r
-#define YY_END_OF_BUFFER 145\r
-static yyconst short int yy_accept[410] =\r
- { 0,\r
- 0, 0, 0, 0, 145, 143, 142, 142, 127, 133,\r
- 138, 122, 123, 131, 130, 119, 128, 126, 132, 90,\r
- 90, 120, 116, 134, 121, 135, 139, 86, 124, 125,\r
- 137, 86, 86, 86, 86, 86, 86, 86, 86, 86,\r
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,\r
- 86, 117, 136, 118, 129, 141, 144, 143, 140, 113,\r
- 99, 118, 107, 102, 97, 105, 95, 106, 96, 93,\r
- 94, 0, 98, 92, 88, 89, 0, 0, 90, 125,\r
- 117, 124, 114, 110, 112, 111, 115, 86, 103, 109,\r
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,\r
-\r
- 8, 86, 86, 86, 86, 86, 86, 86, 86, 86,\r
- 86, 86, 86, 11, 13, 86, 86, 86, 86, 86,\r
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,\r
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 104,\r
- 108, 140, 0, 0, 1, 92, 0, 0, 91, 87,\r
- 100, 101, 43, 86, 86, 86, 86, 86, 86, 86,\r
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,\r
- 9, 86, 86, 86, 86, 86, 86, 86, 17, 86,\r
- 86, 86, 86, 86, 14, 86, 86, 86, 86, 86,\r
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,\r
-\r
- 86, 86, 86, 86, 86, 86, 0, 93, 0, 92,\r
- 86, 19, 86, 86, 83, 86, 86, 86, 86, 86,\r
- 86, 86, 12, 46, 86, 86, 86, 86, 86, 51,\r
- 65, 86, 86, 86, 86, 86, 86, 62, 24, 25,\r
- 26, 86, 86, 86, 86, 86, 86, 86, 86, 86,\r
- 86, 86, 86, 86, 49, 20, 86, 86, 86, 86,\r
- 86, 86, 27, 28, 29, 18, 86, 86, 86, 6,\r
- 33, 34, 35, 44, 3, 86, 86, 86, 86, 76,\r
- 77, 78, 86, 21, 66, 16, 73, 74, 75, 70,\r
- 71, 72, 86, 15, 68, 86, 30, 31, 32, 86,\r
-\r
- 86, 86, 86, 86, 86, 86, 63, 86, 86, 86,\r
- 86, 86, 86, 86, 45, 86, 85, 86, 86, 10,\r
- 86, 86, 86, 86, 64, 59, 54, 86, 86, 86,\r
- 69, 50, 57, 23, 86, 82, 58, 42, 52, 86,\r
- 86, 86, 86, 86, 86, 86, 86, 53, 22, 86,\r
- 86, 86, 86, 86, 86, 47, 4, 86, 5, 86,\r
- 86, 7, 60, 86, 86, 55, 86, 86, 86, 86,\r
- 48, 67, 56, 2, 61, 84, 36, 37, 38, 86,\r
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 39,\r
- 86, 86, 86, 86, 86, 79, 86, 80, 86, 86,\r
-\r
- 86, 40, 86, 41, 86, 86, 86, 81, 0\r
- } ;\r
-\r
-static yyconst int yy_ec[256] =\r
- { 0,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,\r
- 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 2, 4, 1, 1, 1, 5, 6, 1, 7,\r
- 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\r
- 18, 19, 20, 20, 20, 21, 21, 22, 23, 24,\r
- 25, 26, 27, 1, 28, 28, 29, 30, 31, 28,\r
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\r
- 32, 33, 34, 32, 32, 32, 32, 35, 32, 32,\r
- 36, 1, 37, 38, 32, 1, 39, 40, 41, 42,\r
-\r
- 43, 44, 45, 46, 47, 32, 48, 49, 50, 51,\r
- 52, 53, 32, 54, 55, 56, 57, 58, 59, 60,\r
- 61, 62, 63, 64, 65, 66, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
-\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1\r
- } ;\r
-\r
-static yyconst int yy_meta[67] =\r
- { 0,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 2, 1, 3, 3, 3, 3, 3, 3,\r
- 3, 1, 1, 1, 1, 1, 1, 4, 4, 4,\r
- 3, 5, 5, 5, 5, 1, 1, 1, 4, 4,\r
- 4, 4, 3, 4, 5, 5, 5, 5, 5, 5,\r
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,\r
- 5, 5, 1, 1, 1, 1\r
- } ;\r
-\r
-static yyconst short int yy_base[416] =\r
- { 0,\r
- 0, 0, 66, 0, 607, 608, 608, 608, 581, 108,\r
- 129, 608, 608, 580, 126, 608, 125, 123, 138, 151,\r
- 142, 578, 608, 152, 578, 120, 608, 0, 608, 608,\r
- 123, 103, 126, 140, 144, 139, 154, 550, 117, 156,\r
- 549, 561, 110, 542, 126, 555, 169, 175, 154, 174,\r
- 551, 608, 156, 608, 608, 608, 608, 582, 0, 608,\r
- 608, 608, 608, 608, 608, 608, 608, 608, 608, 222,\r
- 608, 592, 608, 229, 162, 220, 258, 0, 221, 608,\r
- 608, 608, 569, 608, 608, 608, 568, 0, 608, 608,\r
- 542, 535, 538, 546, 545, 532, 547, 534, 540, 528,\r
-\r
- 525, 538, 525, 522, 522, 528, 516, 523, 520, 530,\r
- 516, 522, 527, 0, 205, 526, 517, 511, 516, 518,\r
- 508, 522, 522, 505, 510, 507, 496, 156, 510, 506,\r
- 508, 497, 500, 172, 505, 497, 509, 183, 502, 608,\r
- 608, 0, 270, 545, 608, 277, 294, 306, 313, 0,\r
- 608, 608, 0, 493, 497, 506, 503, 487, 487, 168,\r
- 502, 499, 499, 497, 494, 486, 492, 479, 490, 493,\r
- 0, 490, 478, 485, 487, 480, 469, 468, 481, 482,\r
- 477, 282, 478, 469, 466, 470, 468, 459, 462, 460,\r
- 470, 456, 454, 454, 456, 453, 464, 463, 215, 458,\r
-\r
- 453, 442, 299, 460, 462, 451, 320, 327, 334, 341,\r
- 452, 0, 450, 346, 0, 442, 440, 448, 437, 454,\r
- 443, 349, 0, 0, 437, 447, 447, 432, 352, 0,\r
- 0, 355, 436, 430, 429, 430, 358, 0, 0, 0,\r
- 0, 428, 433, 424, 437, 432, 424, 428, 420, 423,\r
- 427, 432, 431, 422, 0, 0, 428, 417, 417, 422,\r
- 421, 418, 0, 0, 0, 0, 408, 420, 422, 0,\r
- 0, 0, 0, 0, 0, 410, 411, 405, 415, 0,\r
- 0, 0, 406, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 413, 0, 0, 411, 0, 0, 0, 401,\r
-\r
- 406, 396, 409, 409, 398, 405, 0, 403, 405, 389,\r
- 398, 404, 399, 387, 0, 389, 0, 388, 391, 0,\r
- 380, 379, 379, 392, 0, 394, 0, 393, 392, 379,\r
- 0, 0, 0, 0, 375, 0, 0, 0, 0, 372,\r
- 383, 376, 382, 379, 374, 366, 378, 0, 0, 371,\r
- 378, 377, 374, 362, 373, 0, 0, 373, 0, 371,\r
- 370, 0, 0, 369, 368, 0, 380, 379, 360, 332,\r
- 0, 0, 0, 0, 0, 0, 354, 222, 354, 346,\r
- 339, 341, 337, 339, 338, 280, 266, 266, 262, 0,\r
- 260, 228, 241, 225, 219, 235, 214, 0, 203, 189,\r
-\r
- 172, 0, 165, 0, 156, 108, 94, 0, 608, 390,\r
- 391, 394, 399, 403, 404\r
- } ;\r
-\r
-static yyconst short int yy_def[416] =\r
- { 0,\r
- 409, 1, 409, 3, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 410, 409, 409, 409, 409, 409, 409, 411, 409, 409,\r
- 409, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 409, 409, 409, 409, 409, 409, 409, 412, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 413, 409, 409, 20, 414, 409, 415, 410, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 411, 409, 409,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
-\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 409,\r
- 409, 412, 409, 413, 409, 409, 409, 409, 409, 415,\r
- 409, 409, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
-\r
- 411, 411, 411, 411, 411, 411, 409, 409, 409, 409,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
-\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
- 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,\r
-\r
- 411, 411, 411, 411, 411, 411, 411, 411, 0, 409,\r
- 409, 409, 409, 409, 409\r
- } ;\r
-\r
-static yyconst short int yy_nxt[675] =\r
- { 0,\r
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\r
- 16, 17, 18, 19, 20, 21, 21, 21, 21, 21,\r
- 21, 22, 23, 24, 25, 26, 27, 28, 28, 28,\r
- 28, 28, 28, 28, 28, 29, 30, 31, 32, 33,\r
- 34, 35, 36, 37, 38, 39, 40, 28, 41, 42,\r
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 28,\r
- 28, 28, 52, 53, 54, 55, 6, 56, 57, 6,\r
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 58,\r
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,\r
- 6, 6, 6, 59, 59, 59, 59, 59, 59, 59,\r
-\r
- 59, 6, 6, 6, 59, 59, 59, 59, 59, 59,\r
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,\r
- 59, 59, 59, 59, 59, 59, 59, 59, 6, 6,\r
- 6, 6, 61, 62, 63, 66, 68, 70, 70, 70,\r
- 70, 70, 70, 70, 86, 87, 71, 89, 119, 69,\r
- 67, 72, 408, 64, 74, 112, 81, 91, 92, 407,\r
- 90, 120, 73, 74, 122, 75, 75, 75, 75, 75,\r
- 75, 76, 77, 82, 113, 83, 84, 93, 96, 94,\r
- 140, 77, 123, 95, 77, 78, 99, 103, 97, 104,\r
- 100, 98, 106, 77, 192, 101, 409, 406, 105, 114,\r
-\r
- 107, 102, 108, 405, 134, 109, 115, 125, 135, 193,\r
- 78, 110, 136, 116, 126, 127, 137, 130, 199, 141,\r
- 131, 409, 217, 218, 128, 138, 200, 129, 132, 204,\r
- 404, 205, 74, 74, 403, 133, 70, 70, 70, 70,\r
- 70, 70, 70, 146, 146, 146, 146, 146, 146, 146,\r
- 77, 77, 143, 176, 382, 383, 177, 178, 258, 147,\r
- 179, 402, 77, 77, 143, 401, 259, 148, 400, 148,\r
- 399, 147, 149, 149, 149, 149, 149, 149, 149, 207,\r
- 398, 207, 397, 396, 208, 208, 208, 208, 208, 208,\r
- 208, 146, 146, 146, 146, 146, 146, 146, 239, 240,\r
-\r
- 241, 395, 394, 209, 393, 209, 392, 147, 210, 210,\r
- 210, 210, 210, 210, 210, 263, 264, 265, 391, 147,\r
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,\r
- 149, 149, 149, 149, 208, 208, 208, 208, 208, 208,\r
- 208, 208, 208, 208, 208, 208, 208, 208, 210, 210,\r
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,\r
- 210, 210, 271, 272, 273, 280, 281, 282, 287, 288,\r
- 289, 290, 291, 292, 297, 298, 299, 367, 368, 369,\r
- 390, 389, 388, 387, 386, 385, 384, 381, 380, 379,\r
- 370, 79, 79, 88, 88, 88, 142, 142, 142, 144,\r
-\r
- 144, 144, 144, 144, 76, 76, 150, 150, 378, 377,\r
- 376, 375, 374, 373, 372, 371, 366, 365, 364, 363,\r
- 362, 361, 360, 359, 358, 357, 356, 355, 354, 353,\r
- 352, 351, 350, 349, 348, 347, 346, 345, 344, 343,\r
- 342, 341, 340, 339, 338, 337, 336, 335, 334, 333,\r
- 332, 331, 330, 329, 328, 327, 326, 325, 324, 323,\r
- 322, 321, 320, 319, 318, 317, 316, 315, 314, 313,\r
- 312, 311, 310, 309, 308, 307, 306, 305, 304, 303,\r
- 302, 301, 300, 296, 295, 294, 293, 286, 285, 284,\r
- 283, 279, 278, 277, 276, 275, 274, 270, 269, 268,\r
-\r
- 267, 266, 262, 261, 260, 257, 256, 255, 254, 253,\r
- 252, 251, 250, 249, 248, 247, 246, 245, 244, 243,\r
- 242, 238, 237, 236, 235, 234, 233, 232, 231, 230,\r
- 229, 228, 227, 226, 225, 224, 223, 222, 221, 220,\r
- 219, 216, 215, 214, 213, 212, 211, 145, 206, 203,\r
- 202, 201, 198, 197, 196, 195, 194, 191, 190, 189,\r
- 188, 187, 186, 185, 184, 183, 182, 181, 180, 175,\r
- 174, 173, 172, 171, 170, 169, 168, 167, 166, 165,\r
- 164, 163, 162, 161, 160, 159, 158, 157, 156, 155,\r
- 154, 153, 152, 151, 145, 72, 139, 124, 121, 118,\r
-\r
- 117, 111, 85, 80, 65, 60, 409, 5, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409\r
- } ;\r
-\r
-static yyconst short int yy_chk[675] =\r
- { 0,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3,\r
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\r
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\r
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\r
-\r
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\r
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\r
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\r
- 3, 3, 10, 10, 11, 15, 17, 18, 18, 18,\r
- 18, 18, 18, 18, 26, 26, 19, 31, 43, 17,\r
- 15, 19, 407, 11, 21, 39, 24, 32, 32, 406,\r
- 31, 43, 19, 20, 45, 20, 20, 20, 20, 20,\r
- 20, 20, 21, 24, 39, 24, 24, 33, 34, 33,\r
- 53, 20, 45, 33, 21, 20, 35, 36, 34, 36,\r
- 35, 34, 37, 20, 128, 35, 75, 405, 36, 40,\r
-\r
- 37, 35, 37, 403, 49, 37, 40, 47, 49, 128,\r
- 20, 37, 50, 40, 47, 47, 50, 48, 134, 53,\r
- 48, 75, 160, 160, 47, 50, 134, 47, 48, 138,\r
- 401, 138, 76, 79, 400, 48, 70, 70, 70, 70,\r
- 70, 70, 70, 74, 74, 74, 74, 74, 74, 74,\r
- 76, 79, 70, 115, 378, 378, 115, 115, 199, 74,\r
- 115, 399, 76, 79, 70, 397, 199, 77, 396, 77,\r
- 395, 74, 77, 77, 77, 77, 77, 77, 77, 143,\r
- 394, 143, 393, 392, 143, 143, 143, 143, 143, 143,\r
- 143, 146, 146, 146, 146, 146, 146, 146, 182, 182,\r
-\r
- 182, 391, 389, 147, 388, 147, 387, 146, 147, 147,\r
- 147, 147, 147, 147, 147, 203, 203, 203, 386, 146,\r
- 148, 148, 148, 148, 148, 148, 148, 149, 149, 149,\r
- 149, 149, 149, 149, 207, 207, 207, 207, 207, 207,\r
- 207, 208, 208, 208, 208, 208, 208, 208, 209, 209,\r
- 209, 209, 209, 209, 209, 210, 210, 210, 210, 210,\r
- 210, 210, 214, 214, 214, 222, 222, 222, 229, 229,\r
- 229, 232, 232, 232, 237, 237, 237, 354, 354, 354,\r
- 385, 384, 383, 382, 381, 380, 379, 377, 370, 369,\r
- 354, 410, 410, 411, 411, 411, 412, 412, 412, 413,\r
-\r
- 413, 413, 413, 413, 414, 414, 415, 415, 368, 367,\r
- 365, 364, 361, 360, 358, 355, 353, 352, 351, 350,\r
- 347, 346, 345, 344, 343, 342, 341, 340, 335, 330,\r
- 329, 328, 326, 324, 323, 322, 321, 319, 318, 316,\r
- 314, 313, 312, 311, 310, 309, 308, 306, 305, 304,\r
- 303, 302, 301, 300, 296, 293, 283, 279, 278, 277,\r
- 276, 269, 268, 267, 262, 261, 260, 259, 258, 257,\r
- 254, 253, 252, 251, 250, 249, 248, 247, 246, 245,\r
- 244, 243, 242, 236, 235, 234, 233, 228, 227, 226,\r
- 225, 221, 220, 219, 218, 217, 216, 213, 211, 206,\r
-\r
- 205, 204, 202, 201, 200, 198, 197, 196, 195, 194,\r
- 193, 192, 191, 190, 189, 188, 187, 186, 185, 184,\r
- 183, 181, 180, 179, 178, 177, 176, 175, 174, 173,\r
- 172, 170, 169, 168, 167, 166, 165, 164, 163, 162,\r
- 161, 159, 158, 157, 156, 155, 154, 144, 139, 137,\r
- 136, 135, 133, 132, 131, 130, 129, 127, 126, 125,\r
- 124, 123, 122, 121, 120, 119, 118, 117, 116, 113,\r
- 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,\r
- 102, 101, 100, 99, 98, 97, 96, 95, 94, 93,\r
- 92, 91, 87, 83, 72, 58, 51, 46, 44, 42,\r
-\r
- 41, 38, 25, 22, 14, 9, 5, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,\r
- 409, 409, 409, 409\r
- } ;\r
-\r
-static yy_state_type yy_last_accepting_state;\r
-static char *yy_last_accepting_cpos;\r
-\r
-/* The intent behind this definition is that it'll catch\r
- * any uses of REJECT which flex missed.\r
- */\r
-#define REJECT reject_used_but_not_detected\r
-#define yymore() yymore_used_but_not_detected\r
-#define YY_MORE_ADJ 0\r
-char *yytext;\r
-#line 1 ".\\glslang\\MachineIndependent\\glslang.l"\r
-#define INITIAL 0\r
+#line 2 "Gen_glslang.cpp"
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/mesa/shader/slang/MachineIndependent/Gen_glslang.cpp,v 1.3 2005/03/18 14:30:27 michal Exp $
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+#include <unistd.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * yyless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ *yy_cp = yy_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+ };
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+
+#define yywrap() 1
+#define YY_SKIP_YYWRAP
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yytext_ptr = yy_bp; \
+ yyleng = (int) (yy_cp - yy_bp); \
+ yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 144
+#define YY_END_OF_BUFFER 145
+static yyconst short int yy_accept[428] =
+ { 0,
+ 0, 0, 0, 0, 145, 143, 142, 142, 127, 133,
+ 138, 122, 123, 131, 130, 119, 128, 126, 132, 143,
+ 143, 120, 116, 134, 121, 135, 139, 143, 124, 125,
+ 137, 143, 143, 143, 143, 143, 143, 143, 143, 143,
+ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
+ 143, 117, 136, 118, 129, 141, 144, 143, 143, 113,
+ 99, 118, 107, 102, 97, 105, 95, 106, 96, 0,
+ 94, 0, 98, 90, 0, 0, 0, 125, 117, 124,
+ 114, 110, 112, 111, 115, 86, 103, 109, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 8, 0,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 11, 13, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 104, 108, 140,
+ 93, 0, 1, 92, 0, 0, 88, 89, 0, 100,
+ 101, 0, 0, 43, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 9, 0, 0, 0, 0, 0, 0, 0, 17,
+ 0, 0, 0, 0, 0, 14, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 87, 86, 0, 19, 0, 0,
+ 83, 0, 0, 0, 0, 0, 0, 0, 12, 46,
+ 0, 0, 0, 0, 0, 51, 65, 0, 0, 0,
+ 0, 0, 0, 62, 24, 25, 26, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 49, 20, 0, 0, 0, 0, 0, 0, 27, 28,
+ 29, 18, 0, 0, 140, 0, 0, 92, 0, 0,
+ 0, 0, 6, 33, 34, 35, 44, 3, 0, 0,
+ 0, 0, 76, 77, 78, 0, 21, 66, 16, 73,
+
+ 74, 75, 70, 71, 72, 0, 15, 68, 0, 30,
+ 31, 32, 0, 0, 0, 0, 0, 0, 0, 63,
+ 0, 0, 0, 0, 0, 0, 0, 45, 0, 85,
+ 0, 0, 10, 0, 0, 91, 0, 0, 0, 0,
+ 64, 59, 54, 0, 0, 0, 69, 50, 57, 23,
+ 0, 82, 58, 42, 52, 0, 0, 0, 0, 0,
+ 0, 93, 92, 0, 0, 53, 22, 0, 0, 0,
+ 0, 0, 0, 47, 4, 0, 5, 0, 0, 7,
+ 60, 0, 0, 55, 0, 0, 0, 0, 48, 67,
+ 56, 2, 61, 84, 36, 37, 38, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0, 0, 39, 0, 0,
+ 0, 0, 0, 79, 0, 80, 0, 0, 0, 40,
+ 0, 41, 0, 0, 0, 81, 0
+ } ;
+
+static yyconst int yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 5, 1, 1, 1, 6, 7, 1, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 21, 21, 22, 22, 23, 24, 25,
+ 26, 27, 28, 1, 29, 29, 30, 31, 32, 29,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 34, 35, 33, 33, 33, 33, 36, 33, 33,
+ 37, 1, 38, 39, 33, 1, 40, 41, 42, 43,
+
+ 44, 45, 46, 47, 48, 33, 49, 50, 51, 52,
+ 53, 54, 33, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst int yy_meta[68] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 1, 1, 1, 1, 1, 1, 2, 2,
+ 2, 2, 3, 3, 3, 3, 1, 1, 1, 2,
+ 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 1, 1, 1, 1
+ } ;
+
+static yyconst short int yy_base[432] =
+ { 0,
+ 0, 0, 67, 0, 678, 679, 679, 679, 651, 109,
+ 130, 679, 679, 650, 127, 679, 126, 124, 139, 151,
+ 671, 647, 679, 151, 647, 121, 679, 668, 679, 679,
+ 124, 147, 154, 155, 158, 171, 174, 157, 156, 184,
+ 175, 160, 178, 162, 176, 181, 190, 197, 193, 195,
+ 179, 679, 193, 679, 679, 679, 679, 656, 666, 679,
+ 679, 679, 679, 679, 679, 679, 679, 679, 679, 665,
+ 679, 665, 679, 246, 663, 662, 0, 679, 679, 679,
+ 639, 679, 679, 679, 638, 253, 679, 679, 612, 605,
+ 608, 616, 615, 602, 617, 604, 610, 598, 595, 608,
+
+ 595, 592, 592, 598, 586, 593, 590, 600, 586, 592,
+ 597, 679, 136, 596, 587, 581, 586, 588, 578, 592,
+ 592, 575, 580, 577, 566, 200, 580, 576, 578, 567,
+ 570, 136, 575, 567, 579, 203, 572, 679, 679, 263,
+ 275, 616, 679, 282, 614, 311, 318, 325, 613, 679,
+ 679, 612, 611, 679, 559, 563, 572, 569, 553, 553,
+ 200, 568, 565, 565, 563, 560, 552, 558, 545, 556,
+ 559, 679, 556, 544, 551, 553, 546, 535, 534, 547,
+ 548, 543, 268, 544, 535, 532, 536, 534, 525, 528,
+ 526, 536, 522, 520, 520, 522, 519, 530, 529, 201,
+
+ 524, 519, 508, 290, 526, 528, 517, 562, 561, 337,
+ 560, 349, 356, 559, 0, 363, 514, 679, 512, 293,
+ 679, 504, 502, 510, 499, 516, 505, 297, 679, 679,
+ 499, 509, 509, 494, 368, 679, 679, 371, 498, 492,
+ 491, 492, 374, 679, 679, 679, 679, 490, 495, 486,
+ 499, 494, 486, 490, 482, 485, 489, 494, 493, 484,
+ 679, 679, 490, 479, 479, 484, 483, 480, 679, 679,
+ 679, 679, 470, 482, 379, 386, 521, 393, 400, 520,
+ 422, 482, 679, 679, 679, 679, 679, 679, 470, 471,
+ 465, 475, 679, 679, 679, 466, 679, 679, 679, 679,
+
+ 679, 679, 679, 679, 679, 473, 679, 679, 471, 679,
+ 679, 679, 461, 466, 456, 469, 469, 458, 465, 679,
+ 463, 465, 449, 458, 464, 459, 447, 679, 449, 679,
+ 448, 451, 679, 429, 448, 679, 440, 439, 439, 452,
+ 679, 454, 679, 453, 452, 439, 679, 679, 679, 679,
+ 435, 679, 679, 679, 679, 432, 443, 436, 442, 439,
+ 434, 679, 679, 426, 438, 679, 679, 431, 438, 437,
+ 419, 441, 418, 679, 679, 418, 679, 413, 412, 679,
+ 679, 411, 410, 679, 422, 405, 404, 376, 679, 679,
+ 679, 679, 679, 679, 397, 242, 397, 389, 382, 384,
+
+ 380, 380, 379, 324, 321, 321, 310, 679, 308, 292,
+ 282, 266, 268, 285, 265, 679, 246, 258, 229, 679,
+ 221, 679, 199, 145, 131, 679, 679, 471, 179, 473,
+ 475
+ } ;
+
+static yyconst short int yy_def[432] =
+ { 0,
+ 427, 1, 427, 3, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 428, 427, 427, 427, 427, 429, 427, 427, 427,
+ 427, 427, 427, 427, 427, 430, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 431,
+ 427, 428, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 429, 430, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 431, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 0, 427, 427, 427,
+ 427
+ } ;
+
+static yyconst short int yy_nxt[747] =
+ { 0,
+ 6, 7, 8, 7, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 21, 21, 21,
+ 21, 21, 22, 23, 24, 25, 26, 27, 28, 28,
+ 28, 28, 28, 28, 28, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 28, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 28, 28, 28, 52, 53, 54, 55, 6, 56, 57,
+ 56, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 58, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 59, 59, 59, 59, 59,
+
+ 59, 59, 59, 6, 6, 6, 59, 59, 59, 59,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+ 6, 6, 6, 6, 61, 62, 63, 66, 68, 70,
+ 70, 70, 70, 70, 70, 70, 84, 85, 71, 87,
+ 86, 69, 67, 72, 74, 64, 79, 86, 86, 86,
+ 86, 86, 88, 86, 73, 86, 75, 75, 75, 75,
+ 75, 75, 76, 80, 86, 81, 82, 86, 86, 86,
+ 149, 86, 86, 200, 86, 177, 77, 86, 178, 179,
+ 426, 201, 180, 86, 94, 110, 86, 425, 86, 116,
+
+ 86, 97, 89, 90, 95, 98, 91, 96, 92, 109,
+ 99, 77, 93, 104, 111, 120, 100, 117, 138, 119,
+ 101, 105, 102, 106, 122, 137, 107, 115, 112, 123,
+ 118, 103, 108, 121, 134, 113, 124, 125, 135, 193,
+ 128, 424, 114, 129, 132, 264, 126, 136, 133, 127,
+ 205, 130, 206, 265, 194, 223, 224, 139, 131, 144,
+ 423, 145, 145, 145, 145, 145, 145, 145, 152, 152,
+ 152, 152, 152, 152, 152, 400, 401, 146, 208, 208,
+ 208, 208, 208, 208, 208, 245, 246, 247, 422, 146,
+ 70, 70, 70, 70, 70, 70, 70, 211, 211, 211,
+
+ 211, 211, 211, 211, 421, 420, 210, 269, 270, 271,
+ 284, 285, 286, 212, 293, 294, 295, 419, 210, 418,
+ 417, 213, 416, 213, 415, 212, 214, 214, 214, 214,
+ 214, 214, 214, 75, 75, 75, 75, 75, 75, 76,
+ 76, 76, 76, 76, 76, 76, 76, 276, 414, 276,
+ 413, 412, 277, 277, 277, 277, 277, 277, 277, 279,
+ 411, 279, 410, 409, 280, 280, 280, 280, 280, 280,
+ 280, 214, 214, 214, 214, 214, 214, 214, 152, 152,
+ 152, 152, 152, 152, 152, 300, 301, 302, 303, 304,
+ 305, 310, 311, 312, 208, 208, 208, 208, 208, 208,
+
+ 208, 277, 277, 277, 277, 277, 277, 277, 211, 211,
+ 211, 211, 211, 211, 211, 280, 280, 280, 280, 280,
+ 280, 280, 408, 407, 212, 336, 406, 405, 404, 403,
+ 402, 399, 362, 398, 397, 396, 212, 214, 214, 214,
+ 214, 214, 214, 214, 277, 277, 277, 277, 277, 277,
+ 277, 363, 395, 394, 393, 392, 391, 385, 386, 387,
+ 390, 389, 384, 280, 280, 280, 280, 280, 280, 280,
+ 388, 142, 142, 142, 153, 153, 209, 209, 383, 382,
+ 381, 380, 379, 378, 377, 376, 375, 374, 373, 372,
+ 371, 370, 369, 368, 367, 366, 365, 364, 361, 360,
+
+ 359, 358, 357, 356, 355, 354, 353, 352, 351, 350,
+ 349, 348, 347, 346, 345, 344, 343, 342, 341, 340,
+ 339, 338, 337, 335, 334, 333, 332, 331, 330, 329,
+ 328, 327, 326, 325, 324, 323, 322, 321, 320, 319,
+ 318, 317, 316, 315, 314, 313, 309, 308, 307, 306,
+ 299, 298, 297, 296, 292, 291, 290, 289, 288, 287,
+ 283, 282, 281, 278, 275, 275, 274, 273, 272, 268,
+ 267, 266, 263, 262, 261, 260, 259, 258, 257, 256,
+ 255, 254, 253, 252, 251, 250, 249, 248, 244, 243,
+ 242, 241, 240, 239, 238, 237, 236, 235, 234, 233,
+
+ 232, 231, 230, 229, 228, 227, 226, 225, 222, 221,
+ 220, 219, 218, 217, 216, 216, 215, 74, 143, 207,
+ 204, 203, 202, 199, 198, 197, 196, 195, 192, 191,
+ 190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
+ 176, 175, 174, 173, 172, 171, 170, 169, 168, 167,
+ 166, 165, 164, 163, 162, 161, 160, 159, 158, 157,
+ 156, 155, 154, 151, 150, 148, 147, 143, 141, 140,
+ 72, 86, 83, 78, 74, 65, 60, 427, 5, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427
+ } ;
+
+static yyconst short int yy_chk[747] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 10, 10, 11, 15, 17, 18,
+ 18, 18, 18, 18, 18, 18, 26, 26, 19, 31,
+ 32, 17, 15, 19, 20, 11, 24, 33, 34, 39,
+ 38, 35, 31, 42, 19, 44, 20, 20, 20, 20,
+ 20, 20, 20, 24, 36, 24, 24, 37, 41, 45,
+ 429, 43, 51, 132, 46, 113, 20, 40, 113, 113,
+ 425, 132, 113, 47, 34, 39, 49, 424, 50, 42,
+
+ 48, 35, 32, 32, 34, 35, 33, 34, 33, 38,
+ 35, 20, 33, 37, 39, 45, 35, 43, 53, 44,
+ 36, 37, 36, 37, 46, 51, 37, 41, 40, 47,
+ 43, 36, 37, 45, 50, 40, 47, 47, 50, 126,
+ 48, 423, 40, 48, 49, 200, 47, 50, 49, 47,
+ 136, 48, 136, 200, 126, 161, 161, 53, 48, 74,
+ 421, 74, 74, 74, 74, 74, 74, 74, 86, 86,
+ 86, 86, 86, 86, 86, 396, 396, 74, 140, 140,
+ 140, 140, 140, 140, 140, 183, 183, 183, 419, 74,
+ 141, 141, 141, 141, 141, 141, 141, 144, 144, 144,
+
+ 144, 144, 144, 144, 418, 417, 141, 204, 204, 204,
+ 220, 220, 220, 144, 228, 228, 228, 415, 141, 414,
+ 413, 146, 412, 146, 411, 144, 146, 146, 146, 146,
+ 146, 146, 146, 147, 147, 147, 147, 147, 147, 147,
+ 148, 148, 148, 148, 148, 148, 148, 210, 410, 210,
+ 409, 407, 210, 210, 210, 210, 210, 210, 210, 212,
+ 406, 212, 405, 404, 212, 212, 212, 212, 212, 212,
+ 212, 213, 213, 213, 213, 213, 213, 213, 216, 216,
+ 216, 216, 216, 216, 216, 235, 235, 235, 238, 238,
+ 238, 243, 243, 243, 275, 275, 275, 275, 275, 275,
+
+ 275, 276, 276, 276, 276, 276, 276, 276, 278, 278,
+ 278, 278, 278, 278, 278, 279, 279, 279, 279, 279,
+ 279, 279, 403, 402, 278, 281, 401, 400, 399, 398,
+ 397, 395, 334, 388, 387, 386, 278, 281, 281, 281,
+ 281, 281, 281, 281, 334, 334, 334, 334, 334, 334,
+ 334, 335, 385, 383, 382, 379, 378, 372, 372, 372,
+ 376, 373, 371, 335, 335, 335, 335, 335, 335, 335,
+ 372, 428, 428, 428, 430, 430, 431, 431, 370, 369,
+ 368, 365, 364, 361, 360, 359, 358, 357, 356, 351,
+ 346, 345, 344, 342, 340, 339, 338, 337, 332, 331,
+
+ 329, 327, 326, 325, 324, 323, 322, 321, 319, 318,
+ 317, 316, 315, 314, 313, 309, 306, 296, 292, 291,
+ 290, 289, 282, 280, 277, 274, 273, 268, 267, 266,
+ 265, 264, 263, 260, 259, 258, 257, 256, 255, 254,
+ 253, 252, 251, 250, 249, 248, 242, 241, 240, 239,
+ 234, 233, 232, 231, 227, 226, 225, 224, 223, 222,
+ 219, 217, 214, 211, 209, 208, 207, 206, 205, 203,
+ 202, 201, 199, 198, 197, 196, 195, 194, 193, 192,
+ 191, 190, 189, 188, 187, 186, 185, 184, 182, 181,
+ 180, 179, 178, 177, 176, 175, 174, 173, 171, 170,
+
+ 169, 168, 167, 166, 165, 164, 163, 162, 160, 159,
+ 158, 157, 156, 155, 153, 152, 149, 145, 142, 137,
+ 135, 134, 133, 131, 130, 129, 128, 127, 125, 124,
+ 123, 122, 121, 120, 119, 118, 117, 116, 115, 114,
+ 111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
+ 101, 100, 99, 98, 97, 96, 95, 94, 93, 92,
+ 91, 90, 89, 85, 81, 76, 75, 72, 70, 59,
+ 58, 28, 25, 22, 21, 14, 9, 5, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
+ 427, 427, 427, 427, 427, 427
+ } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "glslang.l"
+#define INITIAL 0
/*\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
\r
Jutta Degener, 1995 \r
*/\r
-#define YY_NO_UNPUT 1\r
-#line 59 ".\\glslang\\MachineIndependent\\glslang.l"\r
+#define YY_NO_UNPUT 1
+#line 59 "glslang.l"
#include <stdio.h>\r
#include <stdlib.h>\r
#include "ParseHelper.h"\r
#endif\r
\r
int yy_input(char* buf, int max_size);\r
+TSourceLoc yylineno;\r
\r
#ifdef _WIN32\r
extern int yyparse(TParseContext&);\r
#define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext) \r
- TSourceLoc yylineno; \r
#else\r
extern int yyparse(void*);\r
#define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)\r
#define parseContext (*((TParseContext*)(parseContextLocal)))\r
- TSourceLoc yylineno;\r
#endif\r
\r
#define YY_INPUT(buf,result,max_size) (result = yy_input(buf, max_size))\r
\r
-#define YY_NEVER_INTERACTIVE 1\r
-#define FIELDS 1\r
-\r
-#line 729 "Gen_glslang.cpp"\r
-\r
-/* Macros after this point can all be overridden by user definitions in\r
- * section 1.\r
- */\r
-\r
-#ifndef YY_SKIP_YYWRAP\r
-#ifdef __cplusplus\r
-extern "C" int yywrap YY_PROTO(( void ));\r
-#else\r
-extern int yywrap YY_PROTO(( void ));\r
-#endif\r
-#endif\r
-\r
-#ifndef YY_NO_UNPUT\r
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));\r
-#endif\r
-\r
-#ifndef yytext_ptr\r
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));\r
-#endif\r
-\r
-#ifndef YY_NO_INPUT\r
-#ifdef __cplusplus\r
-static int yyinput YY_PROTO(( void ));\r
-#else\r
-static int input YY_PROTO(( void ));\r
-#endif\r
-#endif\r
-\r
-#if YY_STACK_USED\r
-static int yy_start_stack_ptr = 0;\r
-static int yy_start_stack_depth = 0;\r
-static int *yy_start_stack = 0;\r
-#ifndef YY_NO_PUSH_STATE\r
-static void yy_push_state YY_PROTO(( int new_state ));\r
-#endif\r
-#ifndef YY_NO_POP_STATE\r
-static void yy_pop_state YY_PROTO(( void ));\r
-#endif\r
-#ifndef YY_NO_TOP_STATE\r
-static int yy_top_state YY_PROTO(( void ));\r
-#endif\r
-\r
-#else\r
-#define YY_NO_PUSH_STATE 1\r
-#define YY_NO_POP_STATE 1\r
-#define YY_NO_TOP_STATE 1\r
-#endif\r
-\r
-#ifdef YY_MALLOC_DECL\r
-YY_MALLOC_DECL\r
-#else\r
-#if __STDC__\r
-#ifndef __cplusplus\r
-#include <stdlib.h>\r
-#endif\r
-#else\r
-/* Just try to get by without declaring the routines. This will fail\r
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)\r
- * or sizeof(void*) != sizeof(int).\r
- */\r
-#endif\r
-#endif\r
-\r
-/* Amount of stuff to slurp up with each read. */\r
-#ifndef YY_READ_BUF_SIZE\r
-#define YY_READ_BUF_SIZE 8192\r
-#endif\r
-\r
-/* Copy whatever the last rule matched to the standard output. */\r
-\r
-#ifndef ECHO\r
-/* This used to be an fputs(), but since the string might contain NUL's,\r
- * we now use fwrite().\r
- */\r
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )\r
-#endif\r
-\r
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,\r
- * is returned in "result".\r
- */\r
-#ifndef YY_INPUT\r
-#define YY_INPUT(buf,result,max_size) \\r
- if ( yy_current_buffer->yy_is_interactive ) \\r
- { \\r
- int c = '*', n; \\r
- for ( n = 0; n < max_size && \\r
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \\r
- buf[n] = (char) c; \\r
- if ( c == '\n' ) \\r
- buf[n++] = (char) c; \\r
- if ( c == EOF && ferror( yyin ) ) \\r
- YY_FATAL_ERROR( "input in flex scanner failed" ); \\r
- result = n; \\r
- } \\r
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \\r
- && ferror( yyin ) ) \\r
- YY_FATAL_ERROR( "input in flex scanner failed" );\r
-#endif\r
-\r
-/* No semi-colon after return; correct usage is to write "yyterminate();" -\r
- * we don't want an extra ';' after the "return" because that will cause\r
- * some compilers to complain about unreachable statements.\r
- */\r
-#ifndef yyterminate\r
-#define yyterminate() return YY_NULL\r
-#endif\r
-\r
-/* Number of entries by which start-condition stack grows. */\r
-#ifndef YY_START_STACK_INCR\r
-#define YY_START_STACK_INCR 25\r
-#endif\r
-\r
-/* Report a fatal error. */\r
-#ifndef YY_FATAL_ERROR\r
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )\r
-#endif\r
-\r
-/* Default declaration of generated scanner - a define so the user can\r
- * easily add parameters.\r
- */\r
-#ifndef YY_DECL\r
-#define YY_DECL int yylex YY_PROTO(( void ))\r
-#endif\r
-\r
-/* Code executed at the beginning of each rule, after yytext and yyleng\r
- * have been set up.\r
- */\r
-#ifndef YY_USER_ACTION\r
-#define YY_USER_ACTION\r
-#endif\r
-\r
-/* Code executed at the end of each rule. */\r
-#ifndef YY_BREAK\r
-#define YY_BREAK break;\r
-#endif\r
-\r
-#define YY_RULE_SETUP \\r
- YY_USER_ACTION\r
-\r
-YY_DECL\r
- {\r
- register yy_state_type yy_current_state;\r
- register char *yy_cp, *yy_bp;\r
- register int yy_act;\r
-\r
-#line 91 ".\\glslang\\MachineIndependent\\glslang.l"\r
-\r
-#line 878 "Gen_glslang.cpp"\r
-\r
- if ( yy_init )\r
- {\r
- yy_init = 0;\r
-\r
-#ifdef YY_USER_INIT\r
- YY_USER_INIT;\r
-#endif\r
-\r
- if ( ! yy_start )\r
- yy_start = 1; /* first start state */\r
-\r
- if ( ! yyin )\r
- yyin = stdin;\r
-\r
- if ( ! yyout )\r
- yyout = stdout;\r
-\r
- if ( ! yy_current_buffer )\r
- yy_current_buffer =\r
- yy_create_buffer( yyin, YY_BUF_SIZE );\r
-\r
- yy_load_buffer_state();\r
- }\r
-\r
- while ( 1 ) /* loops until end-of-file is reached */\r
- {\r
- yy_cp = yy_c_buf_p;\r
-\r
- /* Support of yytext. */\r
- *yy_cp = yy_hold_char;\r
-\r
- /* yy_bp points to the position in yy_ch_buf of the start of\r
- * the current run.\r
- */\r
- yy_bp = yy_cp;\r
-\r
- yy_current_state = yy_start;\r
-yy_match:\r
- do\r
- {\r
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];\r
- if ( yy_accept[yy_current_state] )\r
- {\r
- yy_last_accepting_state = yy_current_state;\r
- yy_last_accepting_cpos = yy_cp;\r
- }\r
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r
- {\r
- yy_current_state = (int) yy_def[yy_current_state];\r
- if ( yy_current_state >= 410 )\r
- yy_c = yy_meta[(unsigned int) yy_c];\r
- }\r
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r
- ++yy_cp;\r
- }\r
- while ( yy_base[yy_current_state] != 608 );\r
-\r
-yy_find_action:\r
- yy_act = yy_accept[yy_current_state];\r
- if ( yy_act == 0 )\r
- { /* have to back up */\r
- yy_cp = yy_last_accepting_cpos;\r
- yy_current_state = yy_last_accepting_state;\r
- yy_act = yy_accept[yy_current_state];\r
- }\r
-\r
- YY_DO_BEFORE_ACTION;\r
-\r
-\r
-do_action: /* This label is used only to access EOF actions. */\r
-\r
-\r
- switch ( yy_act )\r
- { /* beginning of action switch */\r
- case 0: /* must back up */\r
- /* undo the effects of YY_DO_BEFORE_ACTION */\r
- *yy_cp = yy_hold_char;\r
- yy_cp = yy_last_accepting_cpos;\r
- yy_current_state = yy_last_accepting_state;\r
- goto yy_find_action;\r
-\r
-case 1:\r
-YY_RULE_SETUP\r
-#line 92 ".\\glslang\\MachineIndependent\\glslang.l"\r
+#define YY_NEVER_INTERACTIVE 1
+#define FIELDS 1
+\r
+#line 753 "Gen_glslang.cpp"
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( yy_current_buffer->yy_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+ && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+YY_DECL
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+#line 91 "glslang.l"
+
+#line 906 "Gen_glslang.cpp"
+
+ if ( yy_init )
+ {
+ yy_init = 0;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! yy_start )
+ yy_start = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! yy_current_buffer )
+ yy_current_buffer =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_load_buffer_state();
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yy_start;
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 428 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 679 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = yy_hold_char;
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 92 "glslang.l"
{ /* ?? carriage and/or line-feed? */ };\r
- YY_BREAK\r
-case 2:\r
-YY_RULE_SETUP\r
-#line 94 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 94 "glslang.l"
{ pyylval->lex.line = yylineno; return(ATTRIBUTE); }\r
- YY_BREAK\r
-case 3:\r
-YY_RULE_SETUP\r
-#line 95 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 95 "glslang.l"
{ pyylval->lex.line = yylineno; return(CONST_QUAL); }\r
- YY_BREAK\r
-case 4:\r
-YY_RULE_SETUP\r
-#line 96 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 96 "glslang.l"
{ pyylval->lex.line = yylineno; return(UNIFORM); }\r
- YY_BREAK\r
-case 5:\r
-YY_RULE_SETUP\r
-#line 97 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 97 "glslang.l"
{ pyylval->lex.line = yylineno; return(VARYING); }\r
- YY_BREAK\r
-case 6:\r
-YY_RULE_SETUP\r
-#line 99 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 99 "glslang.l"
{ pyylval->lex.line = yylineno; return(BREAK); }\r
- YY_BREAK\r
-case 7:\r
-YY_RULE_SETUP\r
-#line 100 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 100 "glslang.l"
{ pyylval->lex.line = yylineno; return(CONTINUE); }\r
- YY_BREAK\r
-case 8:\r
-YY_RULE_SETUP\r
-#line 101 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 101 "glslang.l"
{ pyylval->lex.line = yylineno; return(DO); }\r
- YY_BREAK\r
-case 9:\r
-YY_RULE_SETUP\r
-#line 102 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 102 "glslang.l"
{ pyylval->lex.line = yylineno; return(FOR); }\r
- YY_BREAK\r
-case 10:\r
-YY_RULE_SETUP\r
-#line 103 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 103 "glslang.l"
{ pyylval->lex.line = yylineno; return(WHILE); }\r
- YY_BREAK\r
-case 11:\r
-YY_RULE_SETUP\r
-#line 105 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 105 "glslang.l"
{ pyylval->lex.line = yylineno; return(IF); }\r
- YY_BREAK\r
-case 12:\r
-YY_RULE_SETUP\r
-#line 106 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 106 "glslang.l"
{ pyylval->lex.line = yylineno; return(ELSE); }\r
- YY_BREAK\r
-case 13:\r
-YY_RULE_SETUP\r
-#line 108 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 108 "glslang.l"
{ pyylval->lex.line = yylineno; return(IN_QUAL); }\r
- YY_BREAK\r
-case 14:\r
-YY_RULE_SETUP\r
-#line 109 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 109 "glslang.l"
{ pyylval->lex.line = yylineno; return(OUT_QUAL); }\r
- YY_BREAK\r
-case 15:\r
-YY_RULE_SETUP\r
-#line 110 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 110 "glslang.l"
{ pyylval->lex.line = yylineno; return(INOUT_QUAL); }\r
- YY_BREAK\r
-case 16:\r
-YY_RULE_SETUP\r
-#line 112 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 112 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(FLOAT_TYPE); }\r
- YY_BREAK\r
-case 17:\r
-YY_RULE_SETUP\r
-#line 113 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 113 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(INT_TYPE); }\r
- YY_BREAK\r
-case 18:\r
-YY_RULE_SETUP\r
-#line 114 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 114 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(VOID_TYPE); }\r
- YY_BREAK\r
-case 19:\r
-YY_RULE_SETUP\r
-#line 115 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 115 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(BOOL_TYPE); }\r
- YY_BREAK\r
-case 20:\r
-YY_RULE_SETUP\r
-#line 116 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 116 "glslang.l"
{ pyylval->lex.line = yylineno; pyylval->lex.b = true; return(BOOLCONSTANT); }\r
- YY_BREAK\r
-case 21:\r
-YY_RULE_SETUP\r
-#line 117 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 117 "glslang.l"
{ pyylval->lex.line = yylineno; pyylval->lex.b = false; return(BOOLCONSTANT); }\r
- YY_BREAK\r
-case 22:\r
-YY_RULE_SETUP\r
-#line 119 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 119 "glslang.l"
{ pyylval->lex.line = yylineno; return(DISCARD); }\r
- YY_BREAK\r
-case 23:\r
-YY_RULE_SETUP\r
-#line 120 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 120 "glslang.l"
{ pyylval->lex.line = yylineno; return(RETURN); }\r
- YY_BREAK\r
-case 24:\r
-YY_RULE_SETUP\r
-#line 122 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 122 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX2); }\r
- YY_BREAK\r
-case 25:\r
-YY_RULE_SETUP\r
-#line 123 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 123 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX3); }\r
- YY_BREAK\r
-case 26:\r
-YY_RULE_SETUP\r
-#line 124 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 124 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX4); }\r
- YY_BREAK\r
-case 27:\r
-YY_RULE_SETUP\r
-#line 126 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 126 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC2); }\r
- YY_BREAK\r
-case 28:\r
-YY_RULE_SETUP\r
-#line 127 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 127 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC3); }\r
- YY_BREAK\r
-case 29:\r
-YY_RULE_SETUP\r
-#line 128 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 128 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC4); }\r
- YY_BREAK\r
-case 30:\r
-YY_RULE_SETUP\r
-#line 129 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 129 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC2); }\r
- YY_BREAK\r
-case 31:\r
-YY_RULE_SETUP\r
-#line 130 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 130 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC3); }\r
- YY_BREAK\r
-case 32:\r
-YY_RULE_SETUP\r
-#line 131 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 131 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC4); }\r
- YY_BREAK\r
-case 33:\r
-YY_RULE_SETUP\r
-#line 132 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 132 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC2); }\r
- YY_BREAK\r
-case 34:\r
-YY_RULE_SETUP\r
-#line 133 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 133 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC3); }\r
- YY_BREAK\r
-case 35:\r
-YY_RULE_SETUP\r
-#line 134 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 134 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC4); }\r
- YY_BREAK\r
-case 36:\r
-YY_RULE_SETUP\r
-#line 136 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 136 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1D; }\r
- YY_BREAK\r
-case 37:\r
-YY_RULE_SETUP\r
-#line 137 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 137 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2D; }\r
- YY_BREAK\r
-case 38:\r
-YY_RULE_SETUP\r
-#line 138 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 138 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER3D; }\r
- YY_BREAK\r
-case 39:\r
-YY_RULE_SETUP\r
-#line 139 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 139 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBE; }\r
- YY_BREAK\r
-case 40:\r
-YY_RULE_SETUP\r
-#line 140 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 140 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DSHADOW; }\r
- YY_BREAK\r
-case 41:\r
-YY_RULE_SETUP\r
-#line 141 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 141 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DSHADOW; }\r
- YY_BREAK\r
-case 42:\r
-YY_RULE_SETUP\r
-#line 143 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 143 "glslang.l"
{ pyylval->lex.line = yylineno; return(STRUCT); }\r
- YY_BREAK\r
-case 43:\r
-YY_RULE_SETUP\r
-#line 145 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 145 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 44:\r
-YY_RULE_SETUP\r
-#line 147 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 147 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 45:\r
-YY_RULE_SETUP\r
-#line 148 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 148 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 46:\r
-YY_RULE_SETUP\r
-#line 149 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 149 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 47:\r
-YY_RULE_SETUP\r
-#line 150 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 150 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 48:\r
-YY_RULE_SETUP\r
-#line 151 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 151 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 49:\r
-YY_RULE_SETUP\r
-#line 152 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 152 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 50:\r
-YY_RULE_SETUP\r
-#line 153 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 153 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 51:\r
-YY_RULE_SETUP\r
-#line 155 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 155 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 52:\r
-YY_RULE_SETUP\r
-#line 156 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 156 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 53:\r
-YY_RULE_SETUP\r
-#line 157 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 157 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 54:\r
-YY_RULE_SETUP\r
-#line 159 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 159 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 55:\r
-YY_RULE_SETUP\r
-#line 160 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 160 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 56:\r
-YY_RULE_SETUP\r
-#line 161 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 161 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 57:\r
-YY_RULE_SETUP\r
-#line 162 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 162 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 58:\r
-YY_RULE_SETUP\r
-#line 163 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 163 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 59:\r
-YY_RULE_SETUP\r
-#line 164 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 164 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 60:\r
-YY_RULE_SETUP\r
-#line 165 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 165 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 61:\r
-YY_RULE_SETUP\r
-#line 166 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 166 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 62:\r
-YY_RULE_SETUP\r
-#line 168 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 168 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 63:\r
-YY_RULE_SETUP\r
-#line 169 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 169 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 64:\r
-YY_RULE_SETUP\r
-#line 170 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 170 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 65:\r
-YY_RULE_SETUP\r
-#line 171 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 171 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 66:\r
-YY_RULE_SETUP\r
-#line 172 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 172 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 67:\r
-YY_RULE_SETUP\r
-#line 173 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 173 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 68:\r
-YY_RULE_SETUP\r
-#line 175 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 175 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 69:\r
-YY_RULE_SETUP\r
-#line 176 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 176 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 70:\r
-YY_RULE_SETUP\r
-#line 178 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 178 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 71:\r
-YY_RULE_SETUP\r
-#line 179 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 179 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 72:\r
-YY_RULE_SETUP\r
-#line 180 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 180 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 73:\r
-YY_RULE_SETUP\r
-#line 181 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 181 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 74:\r
-YY_RULE_SETUP\r
-#line 182 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 182 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 75:\r
-YY_RULE_SETUP\r
-#line 183 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 183 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 76:\r
-YY_RULE_SETUP\r
-#line 184 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 184 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 77:\r
-YY_RULE_SETUP\r
-#line 185 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 77:
+YY_RULE_SETUP
+#line 185 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 78:\r
-YY_RULE_SETUP\r
-#line 186 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 78:
+YY_RULE_SETUP
+#line 186 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 79:\r
-YY_RULE_SETUP\r
-#line 188 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 79:
+YY_RULE_SETUP
+#line 188 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 80:\r
-YY_RULE_SETUP\r
-#line 189 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 80:
+YY_RULE_SETUP
+#line 189 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 81:\r
-YY_RULE_SETUP\r
-#line 190 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 81:
+YY_RULE_SETUP
+#line 190 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 82:\r
-YY_RULE_SETUP\r
-#line 192 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 82:
+YY_RULE_SETUP
+#line 192 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 83:\r
-YY_RULE_SETUP\r
-#line 193 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 83:
+YY_RULE_SETUP
+#line 193 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 84:\r
-YY_RULE_SETUP\r
-#line 195 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 84:
+YY_RULE_SETUP
+#line 195 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 85:\r
-YY_RULE_SETUP\r
-#line 196 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 85:
+YY_RULE_SETUP
+#line 196 "glslang.l"
{ PaReservedWord(); return 0; }\r
- YY_BREAK\r
-case 86:\r
-YY_RULE_SETUP\r
-#line 198 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 86:
+YY_RULE_SETUP
+#line 198 "glslang.l"
{ \r
pyylval->lex.line = yylineno; \r
pyylval->lex.string = NewPoolTString(yytext); \r
return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol); \r
}\r
- YY_BREAK\r
-case 87:\r
-YY_RULE_SETUP\r
-#line 204 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 87:
+YY_RULE_SETUP
+#line 204 "glslang.l"
{ pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }\r
- YY_BREAK\r
-case 88:\r
-YY_RULE_SETUP\r
-#line 205 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 88:
+YY_RULE_SETUP
+#line 205 "glslang.l"
{ pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }\r
- YY_BREAK\r
-case 89:\r
-YY_RULE_SETUP\r
-#line 206 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 89:
+YY_RULE_SETUP
+#line 206 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.error(yylineno, "Invalid Octal number.", yytext, "", ""); parseContext.recover(); return 0;}\r
- YY_BREAK\r
-case 90:\r
-YY_RULE_SETUP\r
-#line 207 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 90:
+YY_RULE_SETUP
+#line 207 "glslang.l"
{ pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }\r
- YY_BREAK\r
-case 91:\r
-YY_RULE_SETUP\r
-#line 209 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 91:
+YY_RULE_SETUP
+#line 209 "glslang.l"
{ pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }\r
- YY_BREAK\r
-case 92:\r
-YY_RULE_SETUP\r
-#line 210 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 92:
+YY_RULE_SETUP
+#line 210 "glslang.l"
{ pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }\r
- YY_BREAK\r
-case 93:\r
-YY_RULE_SETUP\r
-#line 211 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 93:
+YY_RULE_SETUP
+#line 211 "glslang.l"
{ pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }\r
- YY_BREAK\r
-case 94:\r
-YY_RULE_SETUP\r
-#line 213 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 94:
+YY_RULE_SETUP
+#line 213 "glslang.l"
{ int ret = PaParseComment(pyylval->lex.line, parseContext); if (!ret) return ret; } \r
- YY_BREAK\r
-case 95:\r
-YY_RULE_SETUP\r
-#line 215 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 95:
+YY_RULE_SETUP
+#line 215 "glslang.l"
{ pyylval->lex.line = yylineno; return(ADD_ASSIGN); }\r
- YY_BREAK\r
-case 96:\r
-YY_RULE_SETUP\r
-#line 216 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 96:
+YY_RULE_SETUP
+#line 216 "glslang.l"
{ pyylval->lex.line = yylineno; return(SUB_ASSIGN); }\r
- YY_BREAK\r
-case 97:\r
-YY_RULE_SETUP\r
-#line 217 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 97:
+YY_RULE_SETUP
+#line 217 "glslang.l"
{ pyylval->lex.line = yylineno; return(MUL_ASSIGN); }\r
- YY_BREAK\r
-case 98:\r
-YY_RULE_SETUP\r
-#line 218 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 98:
+YY_RULE_SETUP
+#line 218 "glslang.l"
{ pyylval->lex.line = yylineno; return(DIV_ASSIGN); }\r
- YY_BREAK\r
-case 99:\r
-YY_RULE_SETUP\r
-#line 219 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 99:
+YY_RULE_SETUP
+#line 219 "glslang.l"
{ pyylval->lex.line = yylineno; return(MOD_ASSIGN); }\r
- YY_BREAK\r
-case 100:\r
-YY_RULE_SETUP\r
-#line 220 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 100:
+YY_RULE_SETUP
+#line 220 "glslang.l"
{ pyylval->lex.line = yylineno; return(LEFT_ASSIGN); }\r
- YY_BREAK\r
-case 101:\r
-YY_RULE_SETUP\r
-#line 221 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 101:
+YY_RULE_SETUP
+#line 221 "glslang.l"
{ pyylval->lex.line = yylineno; return(RIGHT_ASSIGN); }\r
- YY_BREAK\r
-case 102:\r
-YY_RULE_SETUP\r
-#line 222 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 102:
+YY_RULE_SETUP
+#line 222 "glslang.l"
{ pyylval->lex.line = yylineno; return(AND_ASSIGN); }\r
- YY_BREAK\r
-case 103:\r
-YY_RULE_SETUP\r
-#line 223 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 103:
+YY_RULE_SETUP
+#line 223 "glslang.l"
{ pyylval->lex.line = yylineno; return(XOR_ASSIGN); }\r
- YY_BREAK\r
-case 104:\r
-YY_RULE_SETUP\r
-#line 224 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 104:
+YY_RULE_SETUP
+#line 224 "glslang.l"
{ pyylval->lex.line = yylineno; return(OR_ASSIGN); }\r
- YY_BREAK\r
-case 105:\r
-YY_RULE_SETUP\r
-#line 226 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 105:
+YY_RULE_SETUP
+#line 226 "glslang.l"
{ pyylval->lex.line = yylineno; return(INC_OP); }\r
- YY_BREAK\r
-case 106:\r
-YY_RULE_SETUP\r
-#line 227 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 106:
+YY_RULE_SETUP
+#line 227 "glslang.l"
{ pyylval->lex.line = yylineno; return(DEC_OP); }\r
- YY_BREAK\r
-case 107:\r
-YY_RULE_SETUP\r
-#line 228 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 107:
+YY_RULE_SETUP
+#line 228 "glslang.l"
{ pyylval->lex.line = yylineno; return(AND_OP); }\r
- YY_BREAK\r
-case 108:\r
-YY_RULE_SETUP\r
-#line 229 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 108:
+YY_RULE_SETUP
+#line 229 "glslang.l"
{ pyylval->lex.line = yylineno; return(OR_OP); }\r
- YY_BREAK\r
-case 109:\r
-YY_RULE_SETUP\r
-#line 230 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 109:
+YY_RULE_SETUP
+#line 230 "glslang.l"
{ pyylval->lex.line = yylineno; return(XOR_OP); }\r
- YY_BREAK\r
-case 110:\r
-YY_RULE_SETUP\r
-#line 231 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 110:
+YY_RULE_SETUP
+#line 231 "glslang.l"
{ pyylval->lex.line = yylineno; return(LE_OP); }\r
- YY_BREAK\r
-case 111:\r
-YY_RULE_SETUP\r
-#line 232 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 111:
+YY_RULE_SETUP
+#line 232 "glslang.l"
{ pyylval->lex.line = yylineno; return(GE_OP); }\r
- YY_BREAK\r
-case 112:\r
-YY_RULE_SETUP\r
-#line 233 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 112:
+YY_RULE_SETUP
+#line 233 "glslang.l"
{ pyylval->lex.line = yylineno; return(EQ_OP); }\r
- YY_BREAK\r
-case 113:\r
-YY_RULE_SETUP\r
-#line 234 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 113:
+YY_RULE_SETUP
+#line 234 "glslang.l"
{ pyylval->lex.line = yylineno; return(NE_OP); }\r
- YY_BREAK\r
-case 114:\r
-YY_RULE_SETUP\r
-#line 235 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 114:
+YY_RULE_SETUP
+#line 235 "glslang.l"
{ pyylval->lex.line = yylineno; return(LEFT_OP); }\r
- YY_BREAK\r
-case 115:\r
-YY_RULE_SETUP\r
-#line 236 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 115:
+YY_RULE_SETUP
+#line 236 "glslang.l"
{ pyylval->lex.line = yylineno; return(RIGHT_OP); }\r
- YY_BREAK\r
-case 116:\r
-YY_RULE_SETUP\r
-#line 237 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 116:
+YY_RULE_SETUP
+#line 237 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(SEMICOLON); }\r
- YY_BREAK\r
-case 117:\r
-YY_RULE_SETUP\r
-#line 238 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 117:
+YY_RULE_SETUP
+#line 238 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(LEFT_BRACE); }\r
- YY_BREAK\r
-case 118:\r
-YY_RULE_SETUP\r
-#line 239 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 118:
+YY_RULE_SETUP
+#line 239 "glslang.l"
{ pyylval->lex.line = yylineno; return(RIGHT_BRACE); }\r
- YY_BREAK\r
-case 119:\r
-YY_RULE_SETUP\r
-#line 240 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 119:
+YY_RULE_SETUP
+#line 240 "glslang.l"
{ pyylval->lex.line = yylineno; if (parseContext.inTypeParen) parseContext.lexAfterType = false; return(COMMA); }\r
- YY_BREAK\r
-case 120:\r
-YY_RULE_SETUP\r
-#line 241 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 120:
+YY_RULE_SETUP
+#line 241 "glslang.l"
{ pyylval->lex.line = yylineno; return(COLON); }\r
- YY_BREAK\r
-case 121:\r
-YY_RULE_SETUP\r
-#line 242 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 121:
+YY_RULE_SETUP
+#line 242 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(EQUAL); }\r
- YY_BREAK\r
-case 122:\r
-YY_RULE_SETUP\r
-#line 243 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 122:
+YY_RULE_SETUP
+#line 243 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.lexAfterType = false; parseContext.inTypeParen = true; return(LEFT_PAREN); }\r
- YY_BREAK\r
-case 123:\r
-YY_RULE_SETUP\r
-#line 244 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 123:
+YY_RULE_SETUP
+#line 244 "glslang.l"
{ pyylval->lex.line = yylineno; parseContext.inTypeParen = false; return(RIGHT_PAREN); }\r
- YY_BREAK\r
-case 124:\r
-YY_RULE_SETUP\r
-#line 245 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 124:
+YY_RULE_SETUP
+#line 245 "glslang.l"
{ pyylval->lex.line = yylineno; return(LEFT_BRACKET); }\r
- YY_BREAK\r
-case 125:\r
-YY_RULE_SETUP\r
-#line 246 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 125:
+YY_RULE_SETUP
+#line 246 "glslang.l"
{ pyylval->lex.line = yylineno; return(RIGHT_BRACKET); }\r
- YY_BREAK\r
-case 126:\r
-YY_RULE_SETUP\r
-#line 247 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 126:
+YY_RULE_SETUP
+#line 247 "glslang.l"
{ BEGIN(FIELDS); return(DOT); }\r
- YY_BREAK\r
-case 127:\r
-YY_RULE_SETUP\r
-#line 248 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 127:
+YY_RULE_SETUP
+#line 248 "glslang.l"
{ pyylval->lex.line = yylineno; return(BANG); }\r
- YY_BREAK\r
-case 128:\r
-YY_RULE_SETUP\r
-#line 249 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 128:
+YY_RULE_SETUP
+#line 249 "glslang.l"
{ pyylval->lex.line = yylineno; return(DASH); }\r
- YY_BREAK\r
-case 129:\r
-YY_RULE_SETUP\r
-#line 250 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 129:
+YY_RULE_SETUP
+#line 250 "glslang.l"
{ pyylval->lex.line = yylineno; return(TILDE); }\r
- YY_BREAK\r
-case 130:\r
-YY_RULE_SETUP\r
-#line 251 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 130:
+YY_RULE_SETUP
+#line 251 "glslang.l"
{ pyylval->lex.line = yylineno; return(PLUS); }\r
- YY_BREAK\r
-case 131:\r
-YY_RULE_SETUP\r
-#line 252 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 131:
+YY_RULE_SETUP
+#line 252 "glslang.l"
{ pyylval->lex.line = yylineno; return(STAR); }\r
- YY_BREAK\r
-case 132:\r
-YY_RULE_SETUP\r
-#line 253 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 132:
+YY_RULE_SETUP
+#line 253 "glslang.l"
{ pyylval->lex.line = yylineno; return(SLASH); }\r
- YY_BREAK\r
-case 133:\r
-YY_RULE_SETUP\r
-#line 254 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 133:
+YY_RULE_SETUP
+#line 254 "glslang.l"
{ pyylval->lex.line = yylineno; return(PERCENT); }\r
- YY_BREAK\r
-case 134:\r
-YY_RULE_SETUP\r
-#line 255 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 134:
+YY_RULE_SETUP
+#line 255 "glslang.l"
{ pyylval->lex.line = yylineno; return(LEFT_ANGLE); }\r
- YY_BREAK\r
-case 135:\r
-YY_RULE_SETUP\r
-#line 256 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 135:
+YY_RULE_SETUP
+#line 256 "glslang.l"
{ pyylval->lex.line = yylineno; return(RIGHT_ANGLE); }\r
- YY_BREAK\r
-case 136:\r
-YY_RULE_SETUP\r
-#line 257 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 136:
+YY_RULE_SETUP
+#line 257 "glslang.l"
{ pyylval->lex.line = yylineno; return(VERTICAL_BAR); }\r
- YY_BREAK\r
-case 137:\r
-YY_RULE_SETUP\r
-#line 258 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 137:
+YY_RULE_SETUP
+#line 258 "glslang.l"
{ pyylval->lex.line = yylineno; return(CARET); }\r
- YY_BREAK\r
-case 138:\r
-YY_RULE_SETUP\r
-#line 259 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 138:
+YY_RULE_SETUP
+#line 259 "glslang.l"
{ pyylval->lex.line = yylineno; return(AMPERSAND); }\r
- YY_BREAK\r
-case 139:\r
-YY_RULE_SETUP\r
-#line 260 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 139:
+YY_RULE_SETUP
+#line 260 "glslang.l"
{ pyylval->lex.line = yylineno; return(QUESTION); }\r
- YY_BREAK\r
-case 140:\r
-YY_RULE_SETUP\r
-#line 262 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 140:
+YY_RULE_SETUP
+#line 262 "glslang.l"
{ \r
BEGIN(INITIAL); \r
pyylval->lex.line = yylineno; \r
pyylval->lex.string = NewPoolTString(yytext); \r
return FIELD_SELECTION; }\r
- YY_BREAK\r
-case 141:\r
-YY_RULE_SETUP\r
-#line 267 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 141:
+YY_RULE_SETUP
+#line 267 "glslang.l"
{}\r
- YY_BREAK\r
-case 142:\r
-YY_RULE_SETUP\r
-#line 269 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 142:
+YY_RULE_SETUP
+#line 269 "glslang.l"
{ }\r
- YY_BREAK\r
-case YY_STATE_EOF(INITIAL):\r
-case YY_STATE_EOF(FIELDS):\r
-#line 270 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(FIELDS):
+#line 270 "glslang.l"
{ (&parseContext)->AfterEOF = true; yy_delete_buffer(YY_CURRENT_BUFFER); yyterminate();}\r
- YY_BREAK\r
-case 143:\r
-YY_RULE_SETUP\r
-#line 271 ".\\glslang\\MachineIndependent\\glslang.l"\r
+ YY_BREAK
+case 143:
+YY_RULE_SETUP
+#line 271 "glslang.l"
{ parseContext.infoSink.info << "FLEX: Unknown char " << yytext << "\n";\r
return 0; }\r
- YY_BREAK\r
-case 144:\r
-YY_RULE_SETUP\r
-#line 274 ".\\glslang\\MachineIndependent\\glslang.l"\r
-ECHO;\r
- YY_BREAK\r
-#line 1695 "Gen_glslang.cpp"\r
-\r
- case YY_END_OF_BUFFER:\r
- {\r
- /* Amount of text matched not including the EOB char. */\r
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;\r
-\r
- /* Undo the effects of YY_DO_BEFORE_ACTION. */\r
- *yy_cp = yy_hold_char;\r
-\r
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )\r
- {\r
- /* We're scanning a new file or input source. It's\r
- * possible that this happened because the user\r
- * just pointed yyin at a new source and called\r
- * yylex(). If so, then we have to assure\r
- * consistency between yy_current_buffer and our\r
- * globals. Here is the right place to do so, because\r
- * this is the first action (other than possibly a\r
- * back-up) that will match for the new input source.\r
- */\r
- yy_n_chars = yy_current_buffer->yy_n_chars;\r
- yy_current_buffer->yy_input_file = yyin;\r
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;\r
- }\r
-\r
- /* Note that here we test for yy_c_buf_p "<=" to the position\r
- * of the first EOB in the buffer, since yy_c_buf_p will\r
- * already have been incremented past the NUL character\r
- * (since all states make transitions on EOB to the\r
- * end-of-buffer state). Contrast this with the test\r
- * in input().\r
- */\r
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )\r
- { /* This was really a NUL. */\r
- yy_state_type yy_next_state;\r
-\r
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;\r
-\r
- yy_current_state = yy_get_previous_state();\r
-\r
- /* Okay, we're now positioned to make the NUL\r
- * transition. We couldn't have\r
- * yy_get_previous_state() go ahead and do it\r
- * for us because it doesn't know how to deal\r
- * with the possibility of jamming (and we don't\r
- * want to build jamming into it because then it\r
- * will run more slowly).\r
- */\r
-\r
- yy_next_state = yy_try_NUL_trans( yy_current_state );\r
-\r
- yy_bp = yytext_ptr + YY_MORE_ADJ;\r
-\r
- if ( yy_next_state )\r
- {\r
- /* Consume the NUL. */\r
- yy_cp = ++yy_c_buf_p;\r
- yy_current_state = yy_next_state;\r
- goto yy_match;\r
- }\r
-\r
- else\r
- {\r
- yy_cp = yy_c_buf_p;\r
- goto yy_find_action;\r
- }\r
- }\r
-\r
- else switch ( yy_get_next_buffer() )\r
- {\r
- case EOB_ACT_END_OF_FILE:\r
- {\r
- yy_did_buffer_switch_on_eof = 0;\r
-\r
- if ( yywrap() )\r
- {\r
- /* Note: because we've taken care in\r
- * yy_get_next_buffer() to have set up\r
- * yytext, we can now set up\r
- * yy_c_buf_p so that if some total\r
- * hoser (like flex itself) wants to\r
- * call the scanner after we return the\r
- * YY_NULL, it'll still work - another\r
- * YY_NULL will get returned.\r
- */\r
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;\r
-\r
- yy_act = YY_STATE_EOF(YY_START);\r
- goto do_action;\r
- }\r
-\r
- else\r
- {\r
- if ( ! yy_did_buffer_switch_on_eof )\r
- YY_NEW_FILE;\r
- }\r
- break;\r
- }\r
-\r
- case EOB_ACT_CONTINUE_SCAN:\r
- yy_c_buf_p =\r
- yytext_ptr + yy_amount_of_matched_text;\r
-\r
- yy_current_state = yy_get_previous_state();\r
-\r
- yy_cp = yy_c_buf_p;\r
- yy_bp = yytext_ptr + YY_MORE_ADJ;\r
- goto yy_match;\r
-\r
- case EOB_ACT_LAST_MATCH:\r
- yy_c_buf_p =\r
- &yy_current_buffer->yy_ch_buf[yy_n_chars];\r
-\r
- yy_current_state = yy_get_previous_state();\r
-\r
- yy_cp = yy_c_buf_p;\r
- yy_bp = yytext_ptr + YY_MORE_ADJ;\r
- goto yy_find_action;\r
- }\r
- break;\r
- }\r
-\r
- default:\r
- YY_FATAL_ERROR(\r
- "fatal flex scanner internal error--no action found" );\r
- } /* end of action switch */\r
- } /* end of scanning one token */\r
- } /* end of yylex */\r
-\r
-\r
-/* yy_get_next_buffer - try to read in a new buffer\r
- *\r
- * Returns a code representing an action:\r
- * EOB_ACT_LAST_MATCH -\r
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position\r
- * EOB_ACT_END_OF_FILE - end of file\r
- */\r
-\r
-static int yy_get_next_buffer()\r
- {\r
- register char *dest = yy_current_buffer->yy_ch_buf;\r
- register char *source = yytext_ptr;\r
- register int number_to_move, i;\r
- int ret_val;\r
-\r
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )\r
- YY_FATAL_ERROR(\r
- "fatal flex scanner internal error--end of buffer missed" );\r
-\r
- if ( yy_current_buffer->yy_fill_buffer == 0 )\r
- { /* Don't try to fill the buffer, so this is an EOF. */\r
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )\r
- {\r
- /* We matched a singled characater, the EOB, so\r
- * treat this as a final EOF.\r
- */\r
- return EOB_ACT_END_OF_FILE;\r
- }\r
-\r
- else\r
- {\r
- /* We matched some text prior to the EOB, first\r
- * process it.\r
- */\r
- return EOB_ACT_LAST_MATCH;\r
- }\r
- }\r
-\r
- /* Try to read more data. */\r
-\r
- /* First move last chars to start of buffer. */\r
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;\r
-\r
- for ( i = 0; i < number_to_move; ++i )\r
- *(dest++) = *(source++);\r
-\r
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )\r
- /* don't do the read, it's not guaranteed to return an EOF,\r
- * just force an EOF\r
- */\r
- yy_n_chars = 0;\r
-\r
- else\r
- {\r
- int num_to_read =\r
- yy_current_buffer->yy_buf_size - number_to_move - 1;\r
-\r
- while ( num_to_read <= 0 )\r
- { /* Not enough room in the buffer - grow it. */\r
-#ifdef YY_USES_REJECT\r
- YY_FATAL_ERROR(\r
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );\r
-#else\r
-\r
- /* just a shorter name for the current buffer */\r
- YY_BUFFER_STATE b = yy_current_buffer;\r
-\r
- int yy_c_buf_p_offset =\r
- (int) (yy_c_buf_p - b->yy_ch_buf);\r
-\r
- if ( b->yy_is_our_buffer )\r
- {\r
- int new_size = b->yy_buf_size * 2;\r
-\r
- if ( new_size <= 0 )\r
- b->yy_buf_size += b->yy_buf_size / 8;\r
- else\r
- b->yy_buf_size *= 2;\r
-\r
- b->yy_ch_buf = (char *)\r
- /* Include room in for 2 EOB chars. */\r
- yy_flex_realloc( (void *) b->yy_ch_buf,\r
- b->yy_buf_size + 2 );\r
- }\r
- else\r
- /* Can't grow it, we don't own it. */\r
- b->yy_ch_buf = 0;\r
-\r
- if ( ! b->yy_ch_buf )\r
- YY_FATAL_ERROR(\r
- "fatal error - scanner input buffer overflow" );\r
-\r
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];\r
-\r
- num_to_read = yy_current_buffer->yy_buf_size -\r
- number_to_move - 1;\r
-#endif\r
- }\r
-\r
- if ( num_to_read > YY_READ_BUF_SIZE )\r
- num_to_read = YY_READ_BUF_SIZE;\r
-\r
- /* Read in more data. */\r
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),\r
- yy_n_chars, num_to_read );\r
- }\r
-\r
- if ( yy_n_chars == 0 )\r
- {\r
- if ( number_to_move == YY_MORE_ADJ )\r
- {\r
- ret_val = EOB_ACT_END_OF_FILE;\r
- yyrestart( yyin );\r
- }\r
-\r
- else\r
- {\r
- ret_val = EOB_ACT_LAST_MATCH;\r
- yy_current_buffer->yy_buffer_status =\r
- YY_BUFFER_EOF_PENDING;\r
- }\r
- }\r
-\r
- else\r
- ret_val = EOB_ACT_CONTINUE_SCAN;\r
-\r
- yy_n_chars += number_to_move;\r
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;\r
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;\r
-\r
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];\r
-\r
- return ret_val;\r
- }\r
-\r
-\r
-/* yy_get_previous_state - get the state just before the EOB char was reached */\r
-\r
-static yy_state_type yy_get_previous_state()\r
- {\r
- register yy_state_type yy_current_state;\r
- register char *yy_cp;\r
-\r
- yy_current_state = yy_start;\r
-\r
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )\r
- {\r
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);\r
- if ( yy_accept[yy_current_state] )\r
- {\r
- yy_last_accepting_state = yy_current_state;\r
- yy_last_accepting_cpos = yy_cp;\r
- }\r
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r
- {\r
- yy_current_state = (int) yy_def[yy_current_state];\r
- if ( yy_current_state >= 410 )\r
- yy_c = yy_meta[(unsigned int) yy_c];\r
- }\r
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r
- }\r
-\r
- return yy_current_state;\r
- }\r
-\r
-\r
-/* yy_try_NUL_trans - try to make a transition on the NUL character\r
- *\r
- * synopsis\r
- * next_state = yy_try_NUL_trans( current_state );\r
- */\r
-\r
-#ifdef YY_USE_PROTOS\r
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )\r
-#else\r
-static yy_state_type yy_try_NUL_trans( yy_current_state )\r
-yy_state_type yy_current_state;\r
-#endif\r
- {\r
- register int yy_is_jam;\r
- register char *yy_cp = yy_c_buf_p;\r
-\r
- register YY_CHAR yy_c = 1;\r
- if ( yy_accept[yy_current_state] )\r
- {\r
- yy_last_accepting_state = yy_current_state;\r
- yy_last_accepting_cpos = yy_cp;\r
- }\r
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r
- {\r
- yy_current_state = (int) yy_def[yy_current_state];\r
- if ( yy_current_state >= 410 )\r
- yy_c = yy_meta[(unsigned int) yy_c];\r
- }\r
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r
- yy_is_jam = (yy_current_state == 409);\r
-\r
- return yy_is_jam ? 0 : yy_current_state;\r
- }\r
-\r
-\r
-#ifndef YY_NO_UNPUT\r
-#ifdef YY_USE_PROTOS\r
-static void yyunput( int c, register char *yy_bp )\r
-#else\r
-static void yyunput( c, yy_bp )\r
-int c;\r
-register char *yy_bp;\r
-#endif\r
- {\r
- register char *yy_cp = yy_c_buf_p;\r
-\r
- /* undo effects of setting up yytext */\r
- *yy_cp = yy_hold_char;\r
-\r
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )\r
- { /* need to shift things up to make room */\r
- /* +2 for EOB chars. */\r
- register int number_to_move = yy_n_chars + 2;\r
- register char *dest = &yy_current_buffer->yy_ch_buf[\r
- yy_current_buffer->yy_buf_size + 2];\r
- register char *source =\r
- &yy_current_buffer->yy_ch_buf[number_to_move];\r
-\r
- while ( source > yy_current_buffer->yy_ch_buf )\r
- *--dest = *--source;\r
-\r
- yy_cp += (int) (dest - source);\r
- yy_bp += (int) (dest - source);\r
- yy_n_chars = yy_current_buffer->yy_buf_size;\r
-\r
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )\r
- YY_FATAL_ERROR( "flex scanner push-back overflow" );\r
- }\r
-\r
- *--yy_cp = (char) c;\r
-\r
-\r
- yytext_ptr = yy_bp;\r
- yy_hold_char = *yy_cp;\r
- yy_c_buf_p = yy_cp;\r
- }\r
-#endif /* ifndef YY_NO_UNPUT */\r
-\r
-\r
-#ifdef __cplusplus\r
-static int yyinput()\r
-#else\r
-static int input()\r
-#endif\r
- {\r
- int c;\r
-\r
- *yy_c_buf_p = yy_hold_char;\r
-\r
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )\r
- {\r
- /* yy_c_buf_p now points to the character we want to return.\r
- * If this occurs *before* the EOB characters, then it's a\r
- * valid NUL; if not, then we've hit the end of the buffer.\r
- */\r
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )\r
- /* This was really a NUL. */\r
- *yy_c_buf_p = '\0';\r
-\r
- else\r
- { /* need more input */\r
- yytext_ptr = yy_c_buf_p;\r
- ++yy_c_buf_p;\r
-\r
- switch ( yy_get_next_buffer() )\r
- {\r
- case EOB_ACT_END_OF_FILE:\r
- {\r
- if ( yywrap() )\r
- {\r
- yy_c_buf_p =\r
- yytext_ptr + YY_MORE_ADJ;\r
- return EOF;\r
- }\r
-\r
- if ( ! yy_did_buffer_switch_on_eof )\r
- YY_NEW_FILE;\r
-#ifdef __cplusplus\r
- return yyinput();\r
-#else\r
- return input();\r
-#endif\r
- }\r
-\r
- case EOB_ACT_CONTINUE_SCAN:\r
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;\r
- break;\r
-\r
- case EOB_ACT_LAST_MATCH:\r
-#ifdef __cplusplus\r
- YY_FATAL_ERROR(\r
- "unexpected last match in yyinput()" );\r
-#else\r
- YY_FATAL_ERROR(\r
- "unexpected last match in input()" );\r
-#endif\r
- }\r
- }\r
- }\r
-\r
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */\r
- *yy_c_buf_p = '\0'; /* preserve yytext */\r
- yy_hold_char = *++yy_c_buf_p;\r
-\r
-\r
- return c;\r
- }\r
-\r
-\r
-#ifdef YY_USE_PROTOS\r
-void yyrestart( FILE *input_file )\r
-#else\r
-void yyrestart( input_file )\r
-FILE *input_file;\r
-#endif\r
- {\r
- if ( ! yy_current_buffer )\r
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );\r
-\r
- yy_init_buffer( yy_current_buffer, input_file );\r
- yy_load_buffer_state();\r
- }\r
-\r
-\r
-#ifdef YY_USE_PROTOS\r
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )\r
-#else\r
-void yy_switch_to_buffer( new_buffer )\r
-YY_BUFFER_STATE new_buffer;\r
-#endif\r
- {\r
- if ( yy_current_buffer == new_buffer )\r
- return;\r
-\r
- if ( yy_current_buffer )\r
- {\r
- /* Flush out information for old buffer. */\r
- *yy_c_buf_p = yy_hold_char;\r
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;\r
- yy_current_buffer->yy_n_chars = yy_n_chars;\r
- }\r
-\r
- yy_current_buffer = new_buffer;\r
- yy_load_buffer_state();\r
-\r
- /* We don't actually know whether we did this switch during\r
- * EOF (yywrap()) processing, but the only time this flag\r
- * is looked at is after yywrap() is called, so it's safe\r
- * to go ahead and always set it.\r
- */\r
- yy_did_buffer_switch_on_eof = 1;\r
- }\r
-\r
-\r
-#ifdef YY_USE_PROTOS\r
-void yy_load_buffer_state( void )\r
-#else\r
-void yy_load_buffer_state()\r
-#endif\r
- {\r
- yy_n_chars = yy_current_buffer->yy_n_chars;\r
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;\r
- yyin = yy_current_buffer->yy_input_file;\r
- yy_hold_char = *yy_c_buf_p;\r
- }\r
-\r
-\r
-#ifdef YY_USE_PROTOS\r
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )\r
-#else\r
-YY_BUFFER_STATE yy_create_buffer( file, size )\r
-FILE *file;\r
-int size;\r
-#endif\r
- {\r
- YY_BUFFER_STATE b;\r
-\r
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );\r
- if ( ! b )\r
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );\r
-\r
- b->yy_buf_size = size;\r
-\r
- /* yy_ch_buf has to be 2 characters longer than the size given because\r
- * we need to put in 2 end-of-buffer characters.\r
- */\r
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );\r
- if ( ! b->yy_ch_buf )\r
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );\r
-\r
- b->yy_is_our_buffer = 1;\r
-\r
- yy_init_buffer( b, file );\r
-\r
- return b;\r
- }\r
-\r
-\r
-#ifdef YY_USE_PROTOS\r
-void yy_delete_buffer( YY_BUFFER_STATE b )\r
-#else\r
-void yy_delete_buffer( b )\r
-YY_BUFFER_STATE b;\r
-#endif\r
- {\r
- if ( ! b )\r
- return;\r
-\r
- if ( b == yy_current_buffer )\r
- yy_current_buffer = (YY_BUFFER_STATE) 0;\r
-\r
- if ( b->yy_is_our_buffer )\r
- yy_flex_free( (void *) b->yy_ch_buf );\r
-\r
- yy_flex_free( (void *) b );\r
- }\r
-\r
-\r
-#ifndef YY_ALWAYS_INTERACTIVE\r
-#ifndef YY_NEVER_INTERACTIVE\r
-extern int isatty YY_PROTO(( int ));\r
-#endif\r
-#endif\r
-\r
-#ifdef YY_USE_PROTOS\r
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )\r
-#else\r
-void yy_init_buffer( b, file )\r
-YY_BUFFER_STATE b;\r
-FILE *file;\r
-#endif\r
-\r
-\r
- {\r
- yy_flush_buffer( b );\r
-\r
- b->yy_input_file = file;\r
- b->yy_fill_buffer = 1;\r
-\r
-#if YY_ALWAYS_INTERACTIVE\r
- b->yy_is_interactive = 1;\r
-#else\r
-#if YY_NEVER_INTERACTIVE\r
- b->yy_is_interactive = 0;\r
-#else\r
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;\r
-#endif\r
-#endif\r
- }\r
-\r
-\r
-#ifdef YY_USE_PROTOS\r
-void yy_flush_buffer( YY_BUFFER_STATE b )\r
-#else\r
-void yy_flush_buffer( b )\r
-YY_BUFFER_STATE b;\r
-#endif\r
-\r
- {\r
- b->yy_n_chars = 0;\r
-\r
- /* We always need two end-of-buffer characters. The first causes\r
- * a transition to the end-of-buffer state. The second causes\r
- * a jam in that state.\r
- */\r
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;\r
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;\r
-\r
- b->yy_buf_pos = &b->yy_ch_buf[0];\r
-\r
- b->yy_at_bol = 1;\r
- b->yy_buffer_status = YY_BUFFER_NEW;\r
-\r
- if ( b == yy_current_buffer )\r
- yy_load_buffer_state();\r
- }\r
-\r
-\r
-#ifndef YY_NO_SCAN_BUFFER\r
-#ifdef YY_USE_PROTOS\r
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )\r
-#else\r
-YY_BUFFER_STATE yy_scan_buffer( base, size )\r
-char *base;\r
-yy_size_t size;\r
-#endif\r
- {\r
- YY_BUFFER_STATE b;\r
-\r
- if ( size < 2 ||\r
- base[size-2] != YY_END_OF_BUFFER_CHAR ||\r
- base[size-1] != YY_END_OF_BUFFER_CHAR )\r
- /* They forgot to leave room for the EOB's. */\r
- return 0;\r
-\r
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );\r
- if ( ! b )\r
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );\r
-\r
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */\r
- b->yy_buf_pos = b->yy_ch_buf = base;\r
- b->yy_is_our_buffer = 0;\r
- b->yy_input_file = 0;\r
- b->yy_n_chars = b->yy_buf_size;\r
- b->yy_is_interactive = 0;\r
- b->yy_at_bol = 1;\r
- b->yy_fill_buffer = 0;\r
- b->yy_buffer_status = YY_BUFFER_NEW;\r
-\r
- yy_switch_to_buffer( b );\r
-\r
- return b;\r
- }\r
-#endif\r
-\r
-\r
-#ifndef YY_NO_SCAN_STRING\r
-#ifdef YY_USE_PROTOS\r
-YY_BUFFER_STATE yy_scan_string( yyconst char *str )\r
-#else\r
-YY_BUFFER_STATE yy_scan_string( str )\r
-yyconst char *str;\r
-#endif\r
- {\r
- int len;\r
- for ( len = 0; str[len]; ++len )\r
- ;\r
-\r
- return yy_scan_bytes( str, len );\r
- }\r
-#endif\r
-\r
-\r
-#ifndef YY_NO_SCAN_BYTES\r
-#ifdef YY_USE_PROTOS\r
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )\r
-#else\r
-YY_BUFFER_STATE yy_scan_bytes( bytes, len )\r
-yyconst char *bytes;\r
-int len;\r
-#endif\r
- {\r
- YY_BUFFER_STATE b;\r
- char *buf;\r
- yy_size_t n;\r
- int i;\r
-\r
- /* Get memory for full buffer, including space for trailing EOB's. */\r
- n = len + 2;\r
- buf = (char *) yy_flex_alloc( n );\r
- if ( ! buf )\r
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );\r
-\r
- for ( i = 0; i < len; ++i )\r
- buf[i] = bytes[i];\r
-\r
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;\r
-\r
- b = yy_scan_buffer( buf, n );\r
- if ( ! b )\r
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );\r
-\r
- /* It's okay to grow etc. this buffer, and we should throw it\r
- * away when we're done.\r
- */\r
- b->yy_is_our_buffer = 1;\r
-\r
- return b;\r
- }\r
-#endif\r
-\r
-\r
-#ifndef YY_NO_PUSH_STATE\r
-#ifdef YY_USE_PROTOS\r
-static void yy_push_state( int new_state )\r
-#else\r
-static void yy_push_state( new_state )\r
-int new_state;\r
-#endif\r
- {\r
- if ( yy_start_stack_ptr >= yy_start_stack_depth )\r
- {\r
- yy_size_t new_size;\r
-\r
- yy_start_stack_depth += YY_START_STACK_INCR;\r
- new_size = yy_start_stack_depth * sizeof( int );\r
-\r
- if ( ! yy_start_stack )\r
- yy_start_stack = (int *) yy_flex_alloc( new_size );\r
-\r
- else\r
- yy_start_stack = (int *) yy_flex_realloc(\r
- (void *) yy_start_stack, new_size );\r
-\r
- if ( ! yy_start_stack )\r
- YY_FATAL_ERROR(\r
- "out of memory expanding start-condition stack" );\r
- }\r
-\r
- yy_start_stack[yy_start_stack_ptr++] = YY_START;\r
-\r
- BEGIN(new_state);\r
- }\r
-#endif\r
-\r
-\r
-#ifndef YY_NO_POP_STATE\r
-static void yy_pop_state()\r
- {\r
- if ( --yy_start_stack_ptr < 0 )\r
- YY_FATAL_ERROR( "start-condition stack underflow" );\r
-\r
- BEGIN(yy_start_stack[yy_start_stack_ptr]);\r
- }\r
-#endif\r
-\r
-\r
-#ifndef YY_NO_TOP_STATE\r
-static int yy_top_state()\r
- {\r
- return yy_start_stack[yy_start_stack_ptr - 1];\r
- }\r
-#endif\r
-\r
-#ifndef YY_EXIT_FAILURE\r
-#define YY_EXIT_FAILURE 2\r
-#endif\r
-\r
-#ifdef YY_USE_PROTOS\r
-static void yy_fatal_error( yyconst char msg[] )\r
-#else\r
-static void yy_fatal_error( msg )\r
-char msg[];\r
-#endif\r
- {\r
- (void) fprintf( stderr, "%s\n", msg );\r
- exit( YY_EXIT_FAILURE );\r
- }\r
-\r
-\r
-\r
-/* Redefine yyless() so it works in section 3 code. */\r
-\r
-#undef yyless\r
-#define yyless(n) \\r
- do \\r
- { \\r
- /* Undo effects of setting up yytext. */ \\r
- yytext[yyleng] = yy_hold_char; \\r
- yy_c_buf_p = yytext + n - YY_MORE_ADJ; \\r
- yy_hold_char = *yy_c_buf_p; \\r
- *yy_c_buf_p = '\0'; \\r
- yyleng = n; \\r
- } \\r
- while ( 0 )\r
-\r
-\r
-/* Internal utility routines. */\r
-\r
-#ifndef yytext_ptr\r
-#ifdef YY_USE_PROTOS\r
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )\r
-#else\r
-static void yy_flex_strncpy( s1, s2, n )\r
-char *s1;\r
-yyconst char *s2;\r
-int n;\r
-#endif\r
- {\r
- register int i;\r
- for ( i = 0; i < n; ++i )\r
- s1[i] = s2[i];\r
- }\r
-#endif\r
-\r
-\r
-#ifdef YY_USE_PROTOS\r
-static void *yy_flex_alloc( yy_size_t size )\r
-#else\r
-static void *yy_flex_alloc( size )\r
-yy_size_t size;\r
-#endif\r
- {\r
- return (void *) malloc( size );\r
- }\r
-\r
-#ifdef YY_USE_PROTOS\r
-static void *yy_flex_realloc( void *ptr, yy_size_t size )\r
-#else\r
-static void *yy_flex_realloc( ptr, size )\r
-void *ptr;\r
-yy_size_t size;\r
-#endif\r
- {\r
- /* The cast to (char *) in the following accommodates both\r
- * implementations that use char* generic pointers, and those\r
- * that use void* generic pointers. It works with the latter\r
- * because both ANSI C and C++ allow castless assignment from\r
- * any pointer type to void*, and deal with argument conversions\r
- * as though doing an assignment.\r
- */\r
- return (void *) realloc( (char *) ptr, size );\r
- }\r
-\r
-#ifdef YY_USE_PROTOS\r
-static void yy_flex_free( void *ptr )\r
-#else\r
-static void yy_flex_free( ptr )\r
-void *ptr;\r
-#endif\r
- {\r
- free( ptr );\r
- }\r
-\r
-#if YY_MAIN\r
-int main()\r
- {\r
- yylex();\r
- return 0;\r
- }\r
-#endif\r
-#line 274 ".\\glslang\\MachineIndependent\\glslang.l"\r
-\r
+ YY_BREAK
+case 144:
+YY_RULE_SETUP
+#line 274 "glslang.l"
+ECHO;
+ YY_BREAK
+#line 1723 "Gen_glslang.cpp"
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between yy_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yy_current_buffer->yy_input_file = yyin;
+ yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yy_c_buf_p;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yy_did_buffer_switch_on_eof = 0;
+
+ if ( yywrap() )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p =
+ yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yy_c_buf_p =
+ &yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+ {
+ register char *dest = yy_current_buffer->yy_ch_buf;
+ register char *source = yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( yy_current_buffer->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = yy_current_buffer;
+
+ int yy_c_buf_p_offset =
+ (int) (yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yy_flex_realloc( (void *) b->yy_ch_buf,
+ b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = yy_current_buffer->yy_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+ yy_n_chars, num_to_read );
+
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ if ( yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ yy_current_buffer->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ yy_n_chars += number_to_move;
+ yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+ yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+ return ret_val;
+ }
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = yy_start;
+
+ for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 428 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+ }
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+ {
+ register int yy_is_jam;
+ register char *yy_cp = yy_c_buf_p;
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 428 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 427);
+
+ return yy_is_jam ? 0 : yy_current_state;
+ }
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+ {
+ register char *yy_cp = yy_c_buf_p;
+
+ /* undo effects of setting up yytext */
+ *yy_cp = yy_hold_char;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = yy_n_chars + 2;
+ register char *dest = &yy_current_buffer->yy_ch_buf[
+ yy_current_buffer->yy_buf_size + 2];
+ register char *source =
+ &yy_current_buffer->yy_ch_buf[number_to_move];
+
+ while ( source > yy_current_buffer->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ yy_current_buffer->yy_n_chars =
+ yy_n_chars = yy_current_buffer->yy_buf_size;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+
+ yytext_ptr = yy_bp;
+ yy_hold_char = *yy_cp;
+ yy_c_buf_p = yy_cp;
+ }
+#endif /* ifndef YY_NO_UNPUT */
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+ {
+ int c;
+
+ *yy_c_buf_p = yy_hold_char;
+
+ if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ /* This was really a NUL. */
+ *yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = yy_c_buf_p - yytext_ptr;
+ ++yy_c_buf_p;
+
+ switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap() )
+ return EOF;
+
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p = yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
+ *yy_c_buf_p = '\0'; /* preserve yytext */
+ yy_hold_char = *++yy_c_buf_p;
+
+
+ return c;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! yy_current_buffer )
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_init_buffer( yy_current_buffer, input_file );
+ yy_load_buffer_state();
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( yy_current_buffer == new_buffer )
+ return;
+
+ if ( yy_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *yy_c_buf_p = yy_hold_char;
+ yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ yy_current_buffer = new_buffer;
+ yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yy_did_buffer_switch_on_eof = 1;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+ {
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+ yyin = yy_current_buffer->yy_input_file;
+ yy_hold_char = *yy_c_buf_p;
+ }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ if ( b == yy_current_buffer )
+ yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yy_flex_free( (void *) b->yy_ch_buf );
+
+ yy_flex_free( (void *) b );
+ }
+
+
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ yy_flush_buffer( b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+ b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+ b->yy_is_interactive = 0;
+#else
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == yy_current_buffer )
+ yy_load_buffer_state();
+ }
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer( b );
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+ {
+ int len;
+ for ( len = 0; yy_str[len]; ++len )
+ ;
+
+ return yy_scan_bytes( yy_str, len );
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+ {
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) yy_flex_alloc( n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer( buf, n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( yy_start_stack_ptr >= yy_start_stack_depth )
+ {
+ yy_size_t new_size;
+
+ yy_start_stack_depth += YY_START_STACK_INCR;
+ new_size = yy_start_stack_depth * sizeof( int );
+
+ if ( ! yy_start_stack )
+ yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+ else
+ yy_start_stack = (int *) yy_flex_realloc(
+ (void *) yy_start_stack, new_size );
+
+ if ( ! yy_start_stack )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+ BEGIN(new_state);
+ }
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+ {
+ if ( --yy_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(yy_start_stack[yy_start_stack_ptr]);
+ }
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+ {
+ return yy_start_stack[yy_start_stack_ptr - 1];
+ }
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ yytext[yyleng] = yy_hold_char; \
+ yy_c_buf_p = yytext + n; \
+ yy_hold_char = *yy_c_buf_p; \
+ *yy_c_buf_p = '\0'; \
+ yyleng = n; \
+ } \
+ while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+
+#if YY_MAIN
+int main()
+ {
+ yylex();
+ return 0;
+ }
+#endif
+#line 274 "glslang.l"
+
\r
\r
//Including Pre-processor.\r
cpp->PaStrLen = strLen;\r
yylineno = 1;\r
\r
- if (*cpp->PaStrLen > 0) { \r
+ if (*cpp->PaStrLen >= 0) { \r
int ret;\r
#ifdef _WIN32\r
ret = yyparse(parseContextLocal);\r
#else\r
ret = yyparse((void*)(&parseContextLocal));\r
#endif\r
- if (cpp->CompileError == 1)\r
+ if (cpp->CompileError == 1 || parseContextLocal.recoveredFromError || parseContextLocal.numErrors > 0)\r
return 1;\r
else\r
- return ret;\r
+ return 0;\r
}\r
else\r
return 0;\r
\r
void yyerror(char *s) \r
{\r
- if (((TParseContext *)cpp->pC)->AfterEOF) \r
- GlobalParseContext->error(yylineno, "syntax error", "pre-mature EOF", s, "");\r
- else\r
+ if (((TParseContext *)cpp->pC)->AfterEOF) {\r
+ if (cpp->tokensBeforeEOF == 1) {\r
+ GlobalParseContext->error(yylineno, "syntax error", "pre-mature EOF", s, "");\r
+ GlobalParseContext->recover();\r
+ }\r
+ } else {\r
GlobalParseContext->error(yylineno, "syntax error", yytext, s, "");\r
- \r
- GlobalParseContext->recover();\r
+ GlobalParseContext->recover();\r
+ } \r
}\r
\r
void PaReservedWord()\r
((TParseContext *)cpp->pC)->infoSink.debug.message(EPrefixNone, msg);\r
}\r
\r
+void CPPWarningToInfoLog(const char *msg)\r
+{\r
+ ((TParseContext *)cpp->pC)->infoSink.info.message(EPrefixWarning, msg, yylineno); \r
+}\r
+\r
void CPPShInfoLogMsg(const char *msg)\r
{\r
((TParseContext *)cpp->pC)->error(yylineno,"", "",msg,"");\r
--yylineno;\r
}\r
\r
-void MapStrings(const char *string1, const char *string2)\r
+void HandlePragma(const char **tokens, int numTokens)\r
{\r
- TString strSrc, strDest;\r
- strSrc = TString(string1);\r
- strDest = TString(string2);\r
-\r
- ((TParseContext *)cpp->pC)->PragmaTable[strSrc] = strDest;\r
+ if (!strcmp(tokens[0], "optimize")) {\r
+ if (numTokens != 4) {\r
+ CPPShInfoLogMsg("optimize pragma syntax is incorrect");\r
+ return;\r
+ }\r
+ \r
+ if (strcmp(tokens[1], "(")) {\r
+ CPPShInfoLogMsg("\"(\" expected after 'optimize' keyword");\r
+ return;\r
+ }\r
+ \r
+ if (!strcmp(tokens[2], "on"))\r
+ ((TParseContext *)cpp->pC)->contextPragma.optimize = true;\r
+ else if (!strcmp(tokens[2], "off"))\r
+ ((TParseContext *)cpp->pC)->contextPragma.optimize = false;\r
+ else {\r
+ CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'optimize' pragma");\r
+ return;\r
+ }\r
+ \r
+ if (strcmp(tokens[3], ")")) {\r
+ CPPShInfoLogMsg("\")\" expected to end 'optimize' pragma");\r
+ return;\r
+ }\r
+ } else if (!strcmp(tokens[0], "debug")) {\r
+ if (numTokens != 4) {\r
+ CPPShInfoLogMsg("debug pragma syntax is incorrect");\r
+ return;\r
+ }\r
+ \r
+ if (strcmp(tokens[1], "(")) {\r
+ CPPShInfoLogMsg("\"(\" expected after 'debug' keyword");\r
+ return;\r
+ }\r
+ \r
+ if (!strcmp(tokens[2], "on"))\r
+ ((TParseContext *)cpp->pC)->contextPragma.debug = true;\r
+ else if (!strcmp(tokens[2], "off"))\r
+ ((TParseContext *)cpp->pC)->contextPragma.debug = false;\r
+ else {\r
+ CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'debug' pragma");\r
+ return;\r
+ }\r
+ \r
+ if (strcmp(tokens[3], ")")) {\r
+ CPPShInfoLogMsg("\")\" expected to end 'debug' pragma");\r
+ return;\r
+ }\r
+ } else {\r
+ /*\r
+ // implementation specific pragma\r
+ // use ((TParseContext *)cpp->pC)->contextPragma.pragmaTable to store the information about pragma\r
+ // For now, just ignore the pragma that the implementation cannot recognize\r
+ // An Example of one such implementation for a pragma that has a syntax like\r
+ // #pragma pragmaname(pragmavalue)\r
+ // This implementation stores the current pragmavalue against the pragma name in pragmaTable.\r
+ if (numTokens == 4 && !strcmp(tokens[1], "(") && !strcmp(tokens[3], ")")) { \r
+ TPragmaTable& pragmaTable = ((TParseContext *)cpp->pC)->contextPragma.pragmaTable;\r
+ TPragmaTable::iterator iter;\r
+ iter = pragmaTable.find(TString(tokens[0]));\r
+ if (iter != pragmaTable.end()) {\r
+ iter->second = tokens[2];\r
+ } else {\r
+ pragmaTable[tokens[0]] = tokens[2];\r
+ } \r
+ }\r
+ */\r
+ }\r
}\r
\r
void StoreStr(char *string)\r
-\r
-/* A Bison parser, made from glslang.y with Bison version GNU Bison version 1.24\r
- */\r
-\r
-#define YYBISON 1 /* Identify Bison output. */\r
-\r
-#define ATTRIBUTE 258\r
-#define CONST_QUAL 259\r
-#define BOOL_TYPE 260\r
-#define FLOAT_TYPE 261\r
-#define INT_TYPE 262\r
-#define BREAK 263\r
-#define CONTINUE 264\r
-#define DO 265\r
-#define ELSE 266\r
-#define FOR 267\r
-#define IF 268\r
-#define DISCARD 269\r
-#define RETURN 270\r
-#define BVEC2 271\r
-#define BVEC3 272\r
-#define BVEC4 273\r
-#define IVEC2 274\r
-#define IVEC3 275\r
-#define IVEC4 276\r
-#define VEC2 277\r
-#define VEC3 278\r
-#define VEC4 279\r
-#define MATRIX2 280\r
-#define MATRIX3 281\r
-#define MATRIX4 282\r
-#define IN_QUAL 283\r
-#define OUT_QUAL 284\r
-#define INOUT_QUAL 285\r
-#define UNIFORM 286\r
-#define VARYING 287\r
-#define STRUCT 288\r
-#define VOID_TYPE 289\r
-#define WHILE 290\r
-#define SAMPLER1D 291\r
-#define SAMPLER2D 292\r
-#define SAMPLER3D 293\r
-#define SAMPLERCUBE 294\r
-#define SAMPLER1DSHADOW 295\r
-#define SAMPLER2DSHADOW 296\r
-#define IDENTIFIER 297\r
-#define TYPE_NAME 298\r
-#define FLOATCONSTANT 299\r
-#define INTCONSTANT 300\r
-#define BOOLCONSTANT 301\r
-#define FIELD_SELECTION 302\r
-#define LEFT_OP 303\r
-#define RIGHT_OP 304\r
-#define INC_OP 305\r
-#define DEC_OP 306\r
-#define LE_OP 307\r
-#define GE_OP 308\r
-#define EQ_OP 309\r
-#define NE_OP 310\r
-#define AND_OP 311\r
-#define OR_OP 312\r
-#define XOR_OP 313\r
-#define MUL_ASSIGN 314\r
-#define DIV_ASSIGN 315\r
-#define ADD_ASSIGN 316\r
-#define MOD_ASSIGN 317\r
-#define LEFT_ASSIGN 318\r
-#define RIGHT_ASSIGN 319\r
-#define AND_ASSIGN 320\r
-#define XOR_ASSIGN 321\r
-#define OR_ASSIGN 322\r
-#define SUB_ASSIGN 323\r
-#define LEFT_PAREN 324\r
-#define RIGHT_PAREN 325\r
-#define LEFT_BRACKET 326\r
-#define RIGHT_BRACKET 327\r
-#define LEFT_BRACE 328\r
-#define RIGHT_BRACE 329\r
-#define DOT 330\r
-#define COMMA 331\r
-#define COLON 332\r
-#define EQUAL 333\r
-#define SEMICOLON 334\r
-#define BANG 335\r
-#define DASH 336\r
-#define TILDE 337\r
-#define PLUS 338\r
-#define STAR 339\r
-#define SLASH 340\r
-#define PERCENT 341\r
-#define LEFT_ANGLE 342\r
-#define RIGHT_ANGLE 343\r
-#define VERTICAL_BAR 344\r
-#define CARET 345\r
-#define AMPERSAND 346\r
-#define QUESTION 347\r
-\r
-#line 39 "glslang.y"\r
-\r
-\r
-/* Based on:\r
-ANSI C Yacc grammar\r
-\r
-In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a \r
-matching Lex specification) for the April 30, 1985 draft version of the \r
-ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that\r
-original, as mentioned in the answer to question 17.25 of the comp.lang.c\r
-FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.\r
- \r
-I intend to keep this version as close to the current C Standard grammar as \r
-possible; please let me know if you discover discrepancies. \r
-\r
-Jutta Degener, 1995 \r
-*/\r
-\r
-#include "SymbolTable.h"\r
-#include "ParseHelper.h"\r
-#include "../Public/ShaderLang.h"\r
-\r
-#ifdef _WIN32\r
- #define YYPARSE_PARAM parseContext\r
- #define YYPARSE_PARAM_DECL TParseContext&\r
- #define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext)\r
- #define YYLEX_PARAM parseContext\r
-#else\r
- #define YYPARSE_PARAM parseContextLocal\r
- #define parseContext (*((TParseContext*)(parseContextLocal)))\r
- #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)\r
- #define YYLEX_PARAM (void*)(parseContextLocal)\r
- extern void yyerror(char*); \r
-#endif\r
-\r
-#define FRAG_VERT_ONLY(S, L) { \\r
- if (parseContext.language != EShLangFragment && \\r
- parseContext.language != EShLangVertex) { \\r
- parseContext.error(L, " supported in vertex/fragment shaders only ", S, "", ""); \\r
- parseContext.recover(); \\r
- } \\r
-}\r
-\r
-#define VERTEX_ONLY(S, L) { \\r
- if (parseContext.language != EShLangVertex) { \\r
- parseContext.error(L, " supported in vertex shaders only ", S, "", ""); \\r
- parseContext.recover(); \\r
- } \\r
-}\r
-\r
-#define FRAG_ONLY(S, L) { \\r
- if (parseContext.language != EShLangFragment) { \\r
- parseContext.error(L, " supported in fragment shaders only ", S, "", ""); \\r
- parseContext.recover(); \\r
- } \\r
-}\r
-\r
-#define PACK_ONLY(S, L) { \\r
- if (parseContext.language != EShLangPack) { \\r
- parseContext.error(L, " supported in pack shaders only ", S, "", ""); \\r
- parseContext.recover(); \\r
- } \\r
-}\r
-\r
-#define UNPACK_ONLY(S, L) { \\r
- if (parseContext.language != EShLangUnpack) { \\r
- parseContext.error(L, " supported in unpack shaders only ", S, "", ""); \\r
- parseContext.recover(); \\r
- } \\r
-}\r
-\r
-#define PACK_UNPACK_ONLY(S, L) { \\r
- if (parseContext.language != EShLangUnpack && \\r
- parseContext.language != EShLangPack) { \\r
- parseContext.error(L, " supported in pack/unpack shaders only ", S, "", ""); \\r
- parseContext.recover(); \\r
- } \\r
-}\r
-\r
-#line 117 "glslang.y"\r
-typedef union {\r
- struct {\r
- TSourceLoc line;\r
- union {\r
- TString *string;\r
- float f;\r
- int i;\r
- bool b;\r
- };\r
- TSymbol* symbol;\r
- } lex;\r
- struct {\r
- TSourceLoc line;\r
- TOperator op;\r
- union {\r
- TIntermNode* intermNode;\r
- TIntermNodePair nodePair;\r
- TIntermTyped* intermTypedNode;\r
- TIntermAggregate* intermAggregate;\r
- };\r
- union {\r
- TPublicType type;\r
- TQualifier qualifier;\r
- TFunction* function;\r
- TParameter param;\r
- TTypeLine typeLine;\r
- TTypeList* typeList;\r
- };\r
- } interm;\r
-} YYSTYPE;\r
-#line 148 "glslang.y"\r
-\r
-#ifndef _WIN32\r
- extern int yylex(YYSTYPE*, void*);\r
-#endif\r
-\r
-#ifndef YYLTYPE\r
-typedef\r
- struct yyltype\r
- {\r
- int timestamp;\r
- int first_line;\r
- int first_column;\r
- int last_line;\r
- int last_column;\r
- char *text;\r
- }\r
- yyltype;\r
-\r
-#define YYLTYPE yyltype\r
-#endif\r
-\r
-#ifndef YYDEBUG\r
-#define YYDEBUG 1\r
-#endif\r
-\r
-#include <stdio.h>\r
-\r
-#ifndef __cplusplus\r
-#ifndef __STDC__\r
-#define const\r
-#endif\r
-#endif\r
-\r
-\r
-\r
-#define YYFINAL 331\r
-#define YYFLAG -32768\r
-#define YYNTBASE 93\r
-\r
-#define YYTRANSLATE(x) ((unsigned)(x) <= 347 ? yytranslate[x] : 167)\r
-\r
-static const char yytranslate[] = { 0,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\r
- 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,\r
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\r
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,\r
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,\r
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,\r
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,\r
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,\r
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,\r
- 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,\r
- 86, 87, 88, 89, 90, 91, 92\r
-};\r
-\r
-#if YYDEBUG != 0\r
-static const short yyprhs[] = { 0,\r
- 0, 2, 4, 6, 8, 10, 14, 16, 21, 23,\r
- 27, 30, 33, 35, 37, 40, 43, 46, 48, 51,\r
- 55, 58, 60, 62, 64, 66, 68, 70, 72, 74,\r
- 76, 78, 80, 82, 84, 86, 88, 90, 92, 94,\r
- 96, 99, 102, 105, 107, 109, 111, 113, 115, 119,\r
- 123, 127, 129, 133, 137, 139, 143, 147, 149, 153,\r
- 157, 161, 165, 167, 171, 175, 177, 181, 183, 187,\r
- 189, 193, 195, 199, 201, 205, 207, 211, 213, 219,\r
- 221, 225, 227, 229, 231, 233, 235, 237, 239, 241,\r
- 243, 245, 247, 249, 253, 255, 258, 261, 264, 266,\r
- 268, 271, 275, 279, 282, 288, 292, 295, 299, 302,\r
- 303, 305, 307, 309, 311, 316, 318, 322, 328, 335,\r
- 341, 343, 346, 351, 357, 362, 364, 367, 369, 371,\r
- 373, 375, 377, 379, 381, 383, 385, 387, 389, 391,\r
- 393, 395, 397, 399, 401, 403, 405, 407, 409, 411,\r
- 413, 415, 417, 419, 421, 423, 429, 434, 436, 439,\r
- 443, 445, 449, 451, 456, 458, 460, 462, 464, 466,\r
- 468, 470, 472, 474, 477, 478, 479, 485, 487, 489,\r
- 492, 496, 498, 501, 503, 506, 512, 516, 518, 520,\r
- 525, 526, 533, 534, 543, 544, 552, 554, 556, 558,\r
- 559, 562, 566, 569, 572, 575, 579, 582, 584, 587,\r
- 589, 591, 592\r
-};\r
-\r
-static const short yyrhs[] = { 42,\r
- 0, 93, 0, 45, 0, 44, 0, 46, 0, 69,\r
- 120, 70, 0, 94, 0, 95, 71, 96, 72, 0,\r
- 97, 0, 95, 75, 47, 0, 95, 50, 0, 95,\r
- 51, 0, 120, 0, 98, 0, 100, 70, 0, 99,\r
- 70, 0, 101, 34, 0, 101, 0, 101, 118, 0,\r
- 100, 76, 118, 0, 102, 69, 0, 103, 0, 42,\r
- 0, 6, 0, 7, 0, 5, 0, 22, 0, 23,\r
- 0, 24, 0, 16, 0, 17, 0, 18, 0, 19,\r
- 0, 20, 0, 21, 0, 25, 0, 26, 0, 27,\r
- 0, 43, 0, 95, 0, 50, 104, 0, 51, 104,\r
- 0, 105, 104, 0, 83, 0, 81, 0, 80, 0,\r
- 82, 0, 104, 0, 106, 84, 104, 0, 106, 85,\r
- 104, 0, 106, 86, 104, 0, 106, 0, 107, 83,\r
- 106, 0, 107, 81, 106, 0, 107, 0, 108, 48,\r
- 107, 0, 108, 49, 107, 0, 108, 0, 109, 87,\r
- 108, 0, 109, 88, 108, 0, 109, 52, 108, 0,\r
- 109, 53, 108, 0, 109, 0, 110, 54, 109, 0,\r
- 110, 55, 109, 0, 110, 0, 111, 91, 110, 0,\r
- 111, 0, 112, 90, 111, 0, 112, 0, 113, 89,\r
- 112, 0, 113, 0, 114, 56, 113, 0, 114, 0,\r
- 115, 58, 114, 0, 115, 0, 116, 57, 115, 0,\r
- 116, 0, 116, 92, 120, 77, 117, 0, 117, 0,\r
- 104, 119, 118, 0, 78, 0, 59, 0, 60, 0,\r
- 62, 0, 61, 0, 68, 0, 63, 0, 64, 0,\r
- 65, 0, 66, 0, 67, 0, 118, 0, 120, 76,\r
- 118, 0, 117, 0, 123, 79, 0, 131, 79, 0,\r
- 124, 70, 0, 126, 0, 125, 0, 126, 128, 0,\r
- 125, 76, 128, 0, 133, 42, 69, 0, 135, 42,\r
- 0, 135, 42, 71, 121, 72, 0, 134, 129, 127,\r
- 0, 129, 127, 0, 134, 129, 130, 0, 129, 130,\r
- 0, 0, 28, 0, 29, 0, 30, 0, 135, 0,\r
- 135, 71, 121, 72, 0, 132, 0, 131, 76, 42,\r
- 0, 131, 76, 42, 71, 72, 0, 131, 76, 42,\r
- 71, 121, 72, 0, 131, 76, 42, 78, 141, 0,\r
- 133, 0, 133, 42, 0, 133, 42, 71, 72, 0,\r
- 133, 42, 71, 121, 72, 0, 133, 42, 78, 141,\r
- 0, 135, 0, 134, 135, 0, 4, 0, 3, 0,\r
- 32, 0, 31, 0, 34, 0, 6, 0, 7, 0,\r
- 5, 0, 22, 0, 23, 0, 24, 0, 16, 0,\r
- 17, 0, 18, 0, 19, 0, 20, 0, 21, 0,\r
- 25, 0, 26, 0, 27, 0, 36, 0, 37, 0,\r
- 38, 0, 39, 0, 40, 0, 41, 0, 136, 0,\r
- 43, 0, 33, 42, 73, 137, 74, 0, 33, 73,\r
- 137, 74, 0, 138, 0, 137, 138, 0, 135, 139,\r
- 79, 0, 140, 0, 139, 76, 140, 0, 42, 0,\r
- 42, 71, 121, 72, 0, 118, 0, 122, 0, 145,\r
- 0, 144, 0, 142, 0, 151, 0, 152, 0, 155,\r
- 0, 162, 0, 73, 74, 0, 0, 0, 73, 146,\r
- 150, 147, 74, 0, 149, 0, 144, 0, 73, 74,\r
- 0, 73, 150, 74, 0, 143, 0, 150, 143, 0,\r
- 79, 0, 120, 79, 0, 13, 69, 120, 70, 153,\r
- 0, 143, 11, 143, 0, 143, 0, 120, 0, 133,\r
- 42, 78, 141, 0, 0, 35, 69, 156, 154, 70,\r
- 148, 0, 0, 10, 157, 143, 35, 69, 120, 70,\r
- 79, 0, 0, 12, 69, 158, 159, 161, 70, 148,\r
- 0, 151, 0, 142, 0, 154, 0, 0, 160, 79,\r
- 0, 160, 79, 120, 0, 9, 79, 0, 8, 79,\r
- 0, 15, 79, 0, 15, 120, 79, 0, 14, 79,\r
- 0, 164, 0, 163, 164, 0, 165, 0, 122, 0,\r
- 0, 123, 166, 149, 0\r
-};\r
-\r
-#endif\r
-\r
-#if YYDEBUG != 0\r
-static const short yyrline[] = { 0,\r
- 210, 244, 247, 260, 265, 270, 276, 279, 347, 350,\r
- 459, 469, 482, 490, 585, 589, 596, 600, 607, 613,\r
- 622, 628, 639, 654, 655, 656, 657, 658, 659, 660,\r
- 661, 662, 663, 664, 665, 666, 667, 668, 669, 680,\r
- 683, 693, 703, 725, 726, 727, 728, 734, 735, 744,\r
- 753, 765, 766, 774, 785, 786, 795, 807, 808, 818,\r
- 828, 838, 851, 852, 862, 875, 876, 888, 889, 901,\r
- 902, 914, 915, 928, 929, 942, 943, 956, 957, 971,\r
- 972, 985, 986, 987, 988, 989, 990, 991, 992, 993,\r
- 994, 995, 999, 1002, 1010, 1018, 1019, 1027, 1063, 1066,\r
- 1073, 1081, 1102, 1120, 1131, 1158, 1163, 1173, 1178, 1188,\r
- 1191, 1194, 1197, 1203, 1208, 1226, 1229, 1237, 1245, 1253,\r
- 1275, 1279, 1288, 1297, 1306, 1396, 1399, 1416, 1420, 1427,\r
- 1435, 1444, 1449, 1454, 1459, 1470, 1475, 1480, 1485, 1490,\r
- 1495, 1500, 1505, 1510, 1515, 1521, 1527, 1533, 1539, 1545,\r
- 1551, 1557, 1563, 1569, 1574, 1587, 1597, 1605, 1608, 1623,\r
- 1641, 1645, 1651, 1656, 1672, 1676, 1680, 1681, 1687, 1688,\r
- 1689, 1690, 1691, 1695, 1696, 1696, 1696, 1704, 1705, 1710,\r
- 1713, 1721, 1724, 1730, 1731, 1735, 1743, 1747, 1757, 1762,\r
- 1779, 1779, 1784, 1784, 1791, 1791, 1804, 1807, 1813, 1816,\r
- 1822, 1826, 1833, 1840, 1847, 1854, 1865, 1874, 1878, 1885,\r
- 1888, 1894, 1979\r
-};\r
-\r
-static const char * const yytname[] = { "$","error","$undefined.","ATTRIBUTE",\r
-"CONST_QUAL","BOOL_TYPE","FLOAT_TYPE","INT_TYPE","BREAK","CONTINUE","DO","ELSE",\r
-"FOR","IF","DISCARD","RETURN","BVEC2","BVEC3","BVEC4","IVEC2","IVEC3","IVEC4",\r
-"VEC2","VEC3","VEC4","MATRIX2","MATRIX3","MATRIX4","IN_QUAL","OUT_QUAL","INOUT_QUAL",\r
-"UNIFORM","VARYING","STRUCT","VOID_TYPE","WHILE","SAMPLER1D","SAMPLER2D","SAMPLER3D",\r
-"SAMPLERCUBE","SAMPLER1DSHADOW","SAMPLER2DSHADOW","IDENTIFIER","TYPE_NAME","FLOATCONSTANT",\r
-"INTCONSTANT","BOOLCONSTANT","FIELD_SELECTION","LEFT_OP","RIGHT_OP","INC_OP",\r
-"DEC_OP","LE_OP","GE_OP","EQ_OP","NE_OP","AND_OP","OR_OP","XOR_OP","MUL_ASSIGN",\r
-"DIV_ASSIGN","ADD_ASSIGN","MOD_ASSIGN","LEFT_ASSIGN","RIGHT_ASSIGN","AND_ASSIGN",\r
-"XOR_ASSIGN","OR_ASSIGN","SUB_ASSIGN","LEFT_PAREN","RIGHT_PAREN","LEFT_BRACKET",\r
-"RIGHT_BRACKET","LEFT_BRACE","RIGHT_BRACE","DOT","COMMA","COLON","EQUAL","SEMICOLON",\r
-"BANG","DASH","TILDE","PLUS","STAR","SLASH","PERCENT","LEFT_ANGLE","RIGHT_ANGLE",\r
-"VERTICAL_BAR","CARET","AMPERSAND","QUESTION","variable_identifier","primary_expression",\r
-"postfix_expression","integer_expression","function_call","function_call_generic",\r
-"function_call_header_no_parameters","function_call_header_with_parameters",\r
-"function_call_header","function_identifier","constructor_identifier","unary_expression",\r
-"unary_operator","multiplicative_expression","additive_expression","shift_expression",\r
-"relational_expression","equality_expression","and_expression","exclusive_or_expression",\r
-"inclusive_or_expression","logical_and_expression","logical_xor_expression",\r
-"logical_or_expression","conditional_expression","assignment_expression","assignment_operator",\r
-"expression","constant_expression","declaration","function_prototype","function_declarator",\r
-"function_header_with_parameters","function_header","parameter_declarator","parameter_declaration",\r
-"parameter_qualifier","parameter_type_specifier","init_declarator_list","single_declaration",\r
-"fully_specified_type","type_qualifier","type_specifier","struct_specifier",\r
-"struct_declaration_list","struct_declaration","struct_declarator_list","struct_declarator",\r
-"initializer","declaration_statement","statement","simple_statement","compound_statement",\r
-"@1","@2","statement_no_new_scope","compound_statement_no_new_scope","statement_list",\r
-"expression_statement","selection_statement","selection_rest_statement","condition",\r
-"iteration_statement","@3","@4","@5","for_init_statement","conditionopt","for_rest_statement",\r
-"jump_statement","translation_unit","external_declaration","function_definition",\r
-"@6",""\r
-};\r
-#endif\r
-\r
-static const short yyr1[] = { 0,\r
- 93, 94, 94, 94, 94, 94, 95, 95, 95, 95,\r
- 95, 95, 96, 97, 98, 98, 99, 99, 100, 100,\r
- 101, 102, 102, 103, 103, 103, 103, 103, 103, 103,\r
- 103, 103, 103, 103, 103, 103, 103, 103, 103, 104,\r
- 104, 104, 104, 105, 105, 105, 105, 106, 106, 106,\r
- 106, 107, 107, 107, 108, 108, 108, 109, 109, 109,\r
- 109, 109, 110, 110, 110, 111, 111, 112, 112, 113,\r
- 113, 114, 114, 115, 115, 116, 116, 117, 117, 118,\r
- 118, 119, 119, 119, 119, 119, 119, 119, 119, 119,\r
- 119, 119, 120, 120, 121, 122, 122, 123, 124, 124,\r
- 125, 125, 126, 127, 127, 128, 128, 128, 128, 129,\r
- 129, 129, 129, 130, 130, 131, 131, 131, 131, 131,\r
- 132, 132, 132, 132, 132, 133, 133, 134, 134, 134,\r
- 134, 135, 135, 135, 135, 135, 135, 135, 135, 135,\r
- 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,\r
- 135, 135, 135, 135, 135, 136, 136, 137, 137, 138,\r
- 139, 139, 140, 140, 141, 142, 143, 143, 144, 144,\r
- 144, 144, 144, 145, 146, 147, 145, 148, 148, 149,\r
- 149, 150, 150, 151, 151, 152, 153, 153, 154, 154,\r
- 156, 155, 157, 155, 158, 155, 159, 159, 160, 160,\r
- 161, 161, 162, 162, 162, 162, 162, 163, 163, 164,\r
- 164, 166, 165\r
-};\r
-\r
-static const short yyr2[] = { 0,\r
- 1, 1, 1, 1, 1, 3, 1, 4, 1, 3,\r
- 2, 2, 1, 1, 2, 2, 2, 1, 2, 3,\r
- 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 2, 2, 2, 1, 1, 1, 1, 1, 3, 3,\r
- 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,\r
- 3, 3, 1, 3, 3, 1, 3, 1, 3, 1,\r
- 3, 1, 3, 1, 3, 1, 3, 1, 5, 1,\r
- 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 3, 1, 2, 2, 2, 1, 1,\r
- 2, 3, 3, 2, 5, 3, 2, 3, 2, 0,\r
- 1, 1, 1, 1, 4, 1, 3, 5, 6, 5,\r
- 1, 2, 4, 5, 4, 1, 2, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 1, 1, 5, 4, 1, 2, 3,\r
- 1, 3, 1, 4, 1, 1, 1, 1, 1, 1,\r
- 1, 1, 1, 2, 0, 0, 5, 1, 1, 2,\r
- 3, 1, 2, 1, 2, 5, 3, 1, 1, 4,\r
- 0, 6, 0, 8, 0, 7, 1, 1, 1, 0,\r
- 2, 3, 2, 2, 2, 3, 2, 1, 2, 1,\r
- 1, 0, 3\r
-};\r
-\r
-static const short yydefact[] = { 0,\r
- 129, 128, 135, 133, 134, 139, 140, 141, 142, 143,\r
- 144, 136, 137, 138, 145, 146, 147, 131, 130, 0,\r
- 132, 148, 149, 150, 151, 152, 153, 155, 211, 212,\r
- 0, 100, 110, 0, 116, 121, 0, 126, 154, 0,\r
- 208, 210, 0, 0, 96, 0, 98, 110, 111, 112,\r
- 113, 101, 0, 110, 0, 97, 122, 127, 209, 0,\r
- 0, 0, 158, 0, 213, 102, 107, 109, 114, 0,\r
- 117, 103, 0, 0, 0, 163, 0, 161, 157, 159,\r
- 135, 133, 134, 0, 0, 193, 0, 0, 0, 0,\r
- 139, 140, 141, 142, 143, 144, 136, 137, 138, 145,\r
- 146, 147, 0, 1, 155, 4, 3, 5, 0, 0,\r
- 0, 175, 180, 184, 46, 45, 47, 44, 2, 7,\r
- 40, 9, 14, 0, 0, 18, 0, 22, 48, 0,\r
- 52, 55, 58, 63, 66, 68, 70, 72, 74, 76,\r
- 78, 80, 93, 0, 166, 0, 169, 182, 168, 167,\r
- 0, 170, 171, 172, 173, 104, 0, 106, 108, 0,\r
- 0, 26, 24, 25, 30, 31, 32, 33, 34, 35,\r
- 27, 28, 29, 36, 37, 38, 39, 123, 48, 95,\r
- 0, 165, 125, 156, 0, 0, 160, 204, 203, 0,\r
- 195, 0, 207, 205, 0, 191, 41, 42, 0, 174,\r
- 0, 11, 12, 0, 0, 16, 15, 0, 17, 19,\r
- 21, 83, 84, 86, 85, 88, 89, 90, 91, 92,\r
- 87, 82, 0, 43, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 185, 181, 183, 0, 0,\r
- 118, 0, 120, 124, 0, 162, 0, 0, 0, 206,\r
- 0, 6, 176, 0, 13, 10, 20, 81, 49, 50,\r
- 51, 54, 53, 56, 57, 61, 62, 59, 60, 64,\r
- 65, 67, 69, 71, 73, 75, 77, 0, 94, 0,\r
- 115, 119, 164, 0, 198, 197, 200, 0, 189, 0,\r
- 0, 0, 8, 0, 105, 0, 199, 0, 0, 188,\r
- 186, 0, 0, 177, 79, 0, 201, 0, 0, 0,\r
- 179, 192, 178, 0, 202, 196, 187, 190, 194, 0,\r
- 0\r
-};\r
-\r
-static const short yydefgoto[] = { 119,\r
- 120, 121, 264, 122, 123, 124, 125, 126, 127, 128,\r
- 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,\r
- 139, 140, 141, 142, 143, 223, 144, 181, 145, 146,\r
- 31, 32, 33, 67, 52, 53, 68, 34, 35, 36,\r
- 37, 38, 39, 62, 63, 77, 78, 183, 147, 148,\r
- 149, 150, 201, 302, 322, 323, 151, 152, 153, 311,\r
- 301, 154, 261, 190, 258, 297, 308, 309, 155, 40,\r
- 41, 42, 46\r
-};\r
-\r
-static const short yypact[] = { 1130,\r
--32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r
--32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -31,\r
--32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -36,\r
- -43, 8, 4, -50,-32768, 38, 1169,-32768,-32768, 197,\r
--32768,-32768, 21, 1169,-32768, 58,-32768, 35,-32768,-32768,\r
--32768,-32768, 1169, 69, 93,-32768, -54,-32768,-32768, 1169,\r
- 94, 1047,-32768, 257,-32768,-32768,-32768,-32768, -20, 1169,\r
- -3,-32768, 707, 979, 1086, 66, -21,-32768,-32768,-32768,\r
- 70, 71, 72, 59, 63,-32768, 75, 76, 67, 775,\r
- 78, 81, 82, 83, 84, 85, 87, 88, 89, 90,\r
- 91, 95, 96, 97, 98,-32768,-32768,-32768, 979, 979,\r
- 979, 117,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r
- 10,-32768,-32768, 92, 0, 843, 99,-32768, 55, 979,\r
- 24, -12, 53, -40, 51, 79, 73, 104, 138, 140,\r
- -39,-32768,-32768, 7,-32768, -36,-32768,-32768,-32768,-32768,\r
- 338,-32768,-32768,-32768,-32768, 128, 979,-32768,-32768, 911,\r
- 979,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r
--32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r
- 133,-32768,-32768,-32768, 979, 94,-32768,-32768,-32768, 419,\r
--32768, 979,-32768,-32768, 17,-32768,-32768,-32768, 2,-32768,\r
- 419,-32768,-32768, 979, 159,-32768,-32768, 979,-32768,-32768,\r
--32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r
--32768,-32768, 979,-32768, 979, 979, 979, 979, 979, 979,\r
- 979, 979, 979, 979, 979, 979, 979, 979, 979, 979,\r
- 979, 979, 979, 979, 979,-32768,-32768,-32768, 979, 135,\r
--32768, 136,-32768,-32768, 137,-32768, 175, 571, 3,-32768,\r
- 639,-32768, 419, 139, 149,-32768,-32768,-32768,-32768,-32768,\r
--32768, 24, 24, -12, -12, 53, 53, 53, 53, -40,\r
- -40, 51, 79, 73, 104, 138, 140, 48,-32768, 154,\r
--32768,-32768,-32768, 158,-32768,-32768, 639, 419, 149, 190,\r
- 169, 167,-32768, 979,-32768, 979,-32768, 163, 173, 233,\r
--32768, 171, 500,-32768,-32768, 12, 979, 500, 419, 979,\r
--32768,-32768,-32768, 166, 149,-32768,-32768,-32768,-32768, 250,\r
--32768\r
-};\r
-\r
-static const short yypgoto[] = {-32768,\r
--32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r
- -53,-32768, -117, -104, -143, -107, 14, 15, 13, 18,\r
- 16, 42,-32768, -57, -74,-32768, -49, -154, 5, 9,\r
--32768,-32768,-32768, 185, 208, 232, 217,-32768,-32768, -247,\r
- -29, -16,-32768, 244, -52,-32768, 119, -159, 52, -150,\r
- -288,-32768,-32768,-32768, -9, 260, 110, 54,-32768,-32768,\r
- 19,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r
- 273,-32768,-32768\r
-};\r
-\r
-\r
-#define YYLAST 1212\r
-\r
-\r
-static const short yytable[] = { 182,\r
- 248, 253, 250, 54, 29, 252, 1, 2, 30, 80,\r
- 43, 232, 233, 300, 72, 180, 73, 243, 54, 179,\r
- 58, 156, 80, 74, 321, 55, 47, 61, 56, 321,\r
- 255, 49, 50, 51, 18, 19, 69, 1, 2, 257,\r
- 195, 44, 45, 61, 29, 61, 234, 235, 30, 300,\r
- 157, 210, 244, 69, 186, 197, 198, 187, 61, 202,\r
- 203, 199, 49, 50, 51, 18, 19, 160, 228, 207,\r
- 229, 262, 298, -99, 161, 208, 224, 245, 245, 57,\r
- 204, 324, 245, 48, 205, 246, 182, 245, 276, 277,\r
- 278, 279, 245, 60, 290, 260, 49, 50, 51, 180,\r
- 230, 231, 180, 179, 236, 237, 179, 225, 226, 227,\r
- 272, 273, 248, 212, 213, 214, 215, 216, 217, 218,\r
- 219, 220, 221, 245, 304, 274, 275, 180, 280, 281,\r
- 64, 179, 222, 267, 71, 76, 185, 188, -26, -24,\r
- -25, 189, 259, 191, 192, 193, -30, 310, 268, -31,\r
- -32, -33, -34, -35, 265, -27, -28, -29, -36, -37,\r
- 328, 206, 239, -38, 196, -23, -39, 211, 327, 238,\r
- 289, 269, 270, 271, 179, 179, 179, 179, 179, 179,\r
- 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,\r
- 200, 180, 240, 241, 288, 179, 330, 242, 249, 1,\r
- 2, 3, 4, 5, 254, 266, 291, 292, 293, 294,\r
- 303, 299, 6, 7, 8, 9, 10, 11, 12, 13,\r
- 14, 15, 16, 17, 245, 305, 306, 18, 19, 20,\r
- 21, 312, 22, 23, 24, 25, 26, 27, 313, 28,\r
- 314, 317, 318, 319, 329, 182, 315, 299, 320, 331,\r
- 179, 282, 284, 283, 158, 66, 316, 286, 285, 1,\r
- 2, 81, 82, 83, 84, 85, 86, 325, 87, 88,\r
- 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,\r
- 99, 100, 101, 102, 287, 70, 159, 18, 19, 20,\r
- 21, 103, 22, 23, 24, 25, 26, 27, 104, 105,\r
- 106, 107, 108, 75, 256, 65, 109, 110, 326, 295,\r
- 263, 296, 59, 0, 0, 307, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 111, 0, 0, 0, 112,\r
- 113, 0, 0, 0, 0, 114, 115, 116, 117, 118,\r
- 1, 2, 81, 82, 83, 84, 85, 86, 0, 87,\r
- 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,\r
- 98, 99, 100, 101, 102, 0, 0, 0, 18, 19,\r
- 20, 21, 103, 22, 23, 24, 25, 26, 27, 104,\r
- 105, 106, 107, 108, 0, 0, 0, 109, 110, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 111, 0, 0, 0,\r
- 112, 247, 0, 0, 0, 0, 114, 115, 116, 117,\r
- 118, 1, 2, 81, 82, 83, 84, 85, 86, 0,\r
- 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,\r
- 97, 98, 99, 100, 101, 102, 0, 0, 0, 18,\r
- 19, 20, 21, 103, 22, 23, 24, 25, 26, 27,\r
- 104, 105, 106, 107, 108, 0, 0, 0, 109, 110,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 111, 0, 0,\r
- 0, 112, 0, 0, 0, 0, 0, 114, 115, 116,\r
- 117, 118, 1, 2, 81, 82, 83, 84, 85, 86,\r
- 0, 87, 88, 89, 90, 91, 92, 93, 94, 95,\r
- 96, 97, 98, 99, 100, 101, 102, 0, 0, 0,\r
- 18, 19, 20, 21, 103, 22, 23, 24, 25, 26,\r
- 27, 104, 105, 106, 107, 108, 0, 0, 0, 109,\r
- 110, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 111, 0,\r
- 0, 0, 64, 1, 2, 81, 82, 83, 114, 115,\r
- 116, 117, 118, 0, 0, 0, 91, 92, 93, 94,\r
- 95, 96, 97, 98, 99, 100, 101, 102, 0, 0,\r
- 0, 18, 19, 20, 21, 0, 22, 23, 24, 25,\r
- 26, 27, 104, 105, 106, 107, 108, 0, 0, 0,\r
- 109, 110, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,\r
- 0, 1, 2, 81, 82, 83, 0, 0, 0, 114,\r
- 115, 116, 117, 118, 91, 92, 93, 94, 95, 96,\r
- 97, 98, 99, 100, 101, 102, 0, 0, 0, 18,\r
- 19, 20, 21, 0, 22, 23, 24, 25, 26, 27,\r
- 104, 105, 106, 107, 108, 0, 0, 0, 109, 110,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 111, 0, 0,\r
- 0, 162, 163, 164, 0, 0, 0, 0, 115, 116,\r
- 117, 118, 165, 166, 167, 168, 169, 170, 171, 172,\r
- 173, 174, 175, 176, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 104, 177,\r
- 106, 107, 108, 0, 0, 0, 109, 110, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 111, 0, 0, 178, 162,\r
- 163, 164, 0, 0, 0, 0, 115, 116, 117, 118,\r
- 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,\r
- 175, 176, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 104, 177, 106, 107,\r
- 108, 0, 0, 0, 109, 110, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 111, 0, 0, 0, 162, 163, 164,\r
- 0, 0, 0, 194, 115, 116, 117, 118, 165, 166,\r
- 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,\r
- 0, 0, 0, 0, 0, 0, 209, 0, 0, 0,\r
- 0, 0, 0, 0, 104, 177, 106, 107, 108, 0,\r
- 0, 0, 109, 110, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 111, 0, 0, 0, 162, 163, 164, 0, 0,\r
- 0, 0, 115, 116, 117, 118, 165, 166, 167, 168,\r
- 169, 170, 171, 172, 173, 174, 175, 176, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 104, 177, 106, 107, 108, 0, 0, 0,\r
- 109, 110, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,\r
- 0, 0, 251, 162, 163, 164, 0, 0, 0, 0,\r
- 115, 116, 117, 118, 165, 166, 167, 168, 169, 170,\r
- 171, 172, 173, 174, 175, 176, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 104, 177, 106, 107, 108, 0, 0, 0, 109, 110,\r
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 0, 0, 111, 0, 0,\r
- 0, 3, 4, 5, 0, 0, 0, 0, 115, 116,\r
- 117, 118, 6, 7, 8, 9, 10, 11, 12, 13,\r
- 14, 15, 16, 17, 0, 0, 0, 0, 0, 20,\r
- 21, 0, 22, 23, 24, 25, 26, 27, 0, 28,\r
- 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,\r
- 0, 6, 7, 8, 9, 10, 11, 12, 13, 14,\r
- 15, 16, 17, 0, 0, 0, 0, 0, 20, 21,\r
- 79, 22, 23, 24, 25, 26, 27, 0, 28, 0,\r
- 0, 0, 1, 2, 3, 4, 5, 0, 0, 0,\r
- 0, 0, 0, 0, 0, 6, 7, 8, 9, 10,\r
- 11, 12, 13, 14, 15, 16, 17, 0, 0, 184,\r
- 18, 19, 20, 21, 0, 22, 23, 24, 25, 26,\r
- 27, 0, 28, 3, 4, 5, 0, 0, 0, 0,\r
- 0, 0, 0, 0, 6, 7, 8, 9, 10, 11,\r
- 12, 13, 14, 15, 16, 17, 0, 0, 0, 0,\r
- 0, 20, 21, 0, 22, 23, 24, 25, 26, 27,\r
- 0, 28\r
-};\r
-\r
-static const short yycheck[] = { 74,\r
- 151, 161, 157, 33, 0, 160, 3, 4, 0, 62,\r
- 42, 52, 53, 261, 69, 73, 71, 57, 48, 73,\r
- 37, 42, 75, 78, 313, 76, 70, 44, 79, 318,\r
- 185, 28, 29, 30, 31, 32, 53, 3, 4, 190,\r
- 90, 73, 79, 60, 40, 62, 87, 88, 40, 297,\r
- 71, 126, 92, 70, 76, 109, 110, 79, 75, 50,\r
- 51, 111, 28, 29, 30, 31, 32, 71, 81, 70,\r
- 83, 70, 70, 70, 78, 76, 130, 76, 76, 42,\r
- 71, 70, 76, 76, 75, 79, 161, 76, 232, 233,\r
- 234, 235, 76, 73, 249, 79, 28, 29, 30, 157,\r
- 48, 49, 160, 157, 54, 55, 160, 84, 85, 86,\r
- 228, 229, 263, 59, 60, 61, 62, 63, 64, 65,\r
- 66, 67, 68, 76, 77, 230, 231, 185, 236, 237,\r
- 73, 185, 78, 208, 42, 42, 71, 79, 69, 69,\r
- 69, 79, 192, 69, 69, 79, 69, 298, 223, 69,\r
- 69, 69, 69, 69, 204, 69, 69, 69, 69, 69,\r
- 320, 70, 90, 69, 69, 69, 69, 69, 319, 91,\r
- 245, 225, 226, 227, 228, 229, 230, 231, 232, 233,\r
- 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,\r
- 74, 249, 89, 56, 244, 249, 0, 58, 71, 3,\r
- 4, 5, 6, 7, 72, 47, 72, 72, 72, 35,\r
- 72, 261, 16, 17, 18, 19, 20, 21, 22, 23,\r
- 24, 25, 26, 27, 76, 72, 69, 31, 32, 33,\r
- 34, 42, 36, 37, 38, 39, 40, 41, 70, 43,\r
- 74, 79, 70, 11, 79, 320, 304, 297, 78, 0,\r
- 304, 238, 240, 239, 70, 48, 306, 242, 241, 3,\r
- 4, 5, 6, 7, 8, 9, 10, 317, 12, 13,\r
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,\r
- 24, 25, 26, 27, 243, 54, 70, 31, 32, 33,\r
- 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,\r
- 44, 45, 46, 60, 186, 46, 50, 51, 318, 258,\r
- 201, 258, 40, -1, -1, 297, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, 69, -1, -1, -1, 73,\r
- 74, -1, -1, -1, -1, 79, 80, 81, 82, 83,\r
- 3, 4, 5, 6, 7, 8, 9, 10, -1, 12,\r
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,\r
- 23, 24, 25, 26, 27, -1, -1, -1, 31, 32,\r
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,\r
- 43, 44, 45, 46, -1, -1, -1, 50, 51, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, 69, -1, -1, -1,\r
- 73, 74, -1, -1, -1, -1, 79, 80, 81, 82,\r
- 83, 3, 4, 5, 6, 7, 8, 9, 10, -1,\r
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\r
- 22, 23, 24, 25, 26, 27, -1, -1, -1, 31,\r
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,\r
- 42, 43, 44, 45, 46, -1, -1, -1, 50, 51,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, 69, -1, -1,\r
- -1, 73, -1, -1, -1, -1, -1, 79, 80, 81,\r
- 82, 83, 3, 4, 5, 6, 7, 8, 9, 10,\r
- -1, 12, 13, 14, 15, 16, 17, 18, 19, 20,\r
- 21, 22, 23, 24, 25, 26, 27, -1, -1, -1,\r
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,\r
- 41, 42, 43, 44, 45, 46, -1, -1, -1, 50,\r
- 51, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, 69, -1,\r
- -1, -1, 73, 3, 4, 5, 6, 7, 79, 80,\r
- 81, 82, 83, -1, -1, -1, 16, 17, 18, 19,\r
- 20, 21, 22, 23, 24, 25, 26, 27, -1, -1,\r
- -1, 31, 32, 33, 34, -1, 36, 37, 38, 39,\r
- 40, 41, 42, 43, 44, 45, 46, -1, -1, -1,\r
- 50, 51, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 69,\r
- -1, 3, 4, 5, 6, 7, -1, -1, -1, 79,\r
- 80, 81, 82, 83, 16, 17, 18, 19, 20, 21,\r
- 22, 23, 24, 25, 26, 27, -1, -1, -1, 31,\r
- 32, 33, 34, -1, 36, 37, 38, 39, 40, 41,\r
- 42, 43, 44, 45, 46, -1, -1, -1, 50, 51,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, 69, -1, -1,\r
- -1, 5, 6, 7, -1, -1, -1, -1, 80, 81,\r
- 82, 83, 16, 17, 18, 19, 20, 21, 22, 23,\r
- 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, 42, 43,\r
- 44, 45, 46, -1, -1, -1, 50, 51, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, 69, -1, -1, 72, 5,\r
- 6, 7, -1, -1, -1, -1, 80, 81, 82, 83,\r
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,\r
- 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, 42, 43, 44, 45,\r
- 46, -1, -1, -1, 50, 51, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, 69, -1, -1, -1, 5, 6, 7,\r
- -1, -1, -1, 79, 80, 81, 82, 83, 16, 17,\r
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,\r
- -1, -1, -1, -1, -1, -1, 34, -1, -1, -1,\r
- -1, -1, -1, -1, 42, 43, 44, 45, 46, -1,\r
- -1, -1, 50, 51, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, 69, -1, -1, -1, 5, 6, 7, -1, -1,\r
- -1, -1, 80, 81, 82, 83, 16, 17, 18, 19,\r
- 20, 21, 22, 23, 24, 25, 26, 27, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, 42, 43, 44, 45, 46, -1, -1, -1,\r
- 50, 51, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 69,\r
- -1, -1, 72, 5, 6, 7, -1, -1, -1, -1,\r
- 80, 81, 82, 83, 16, 17, 18, 19, 20, 21,\r
- 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- 42, 43, 44, 45, 46, -1, -1, -1, 50, 51,\r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\r
- -1, -1, -1, -1, -1, -1, -1, 69, -1, -1,\r
- -1, 5, 6, 7, -1, -1, -1, -1, 80, 81,\r
- 82, 83, 16, 17, 18, 19, 20, 21, 22, 23,\r
- 24, 25, 26, 27, -1, -1, -1, -1, -1, 33,\r
- 34, -1, 36, 37, 38, 39, 40, 41, -1, 43,\r
- 5, 6, 7, -1, -1, -1, -1, -1, -1, -1,\r
- -1, 16, 17, 18, 19, 20, 21, 22, 23, 24,\r
- 25, 26, 27, -1, -1, -1, -1, -1, 33, 34,\r
- 74, 36, 37, 38, 39, 40, 41, -1, 43, -1,\r
- -1, -1, 3, 4, 5, 6, 7, -1, -1, -1,\r
- -1, -1, -1, -1, -1, 16, 17, 18, 19, 20,\r
- 21, 22, 23, 24, 25, 26, 27, -1, -1, 74,\r
- 31, 32, 33, 34, -1, 36, 37, 38, 39, 40,\r
- 41, -1, 43, 5, 6, 7, -1, -1, -1, -1,\r
- -1, -1, -1, -1, 16, 17, 18, 19, 20, 21,\r
- 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,\r
- -1, 33, 34, -1, 36, 37, 38, 39, 40, 41,\r
- -1, 43\r
-};\r
-#define YYPURE 1\r
-\r
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */\r
-\r
-/* Skeleton output parser for bison,\r
- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2, or (at your option)\r
- any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */\r
-\r
-/* As a special exception, when this file is copied by Bison into a\r
- Bison output file, you may use that output file without restriction.\r
- This special exception was added by the Free Software Foundation\r
- in version 1.24 of Bison. */\r
-\r
-#ifdef __GNUC__\r
-#define alloca __builtin_alloca\r
-#else /* not __GNUC__ */\r
-#if HAVE_ALLOCA_H\r
-#include <alloca.h>\r
-#else /* not HAVE_ALLOCA_H */\r
-#ifdef _AIX\r
- #pragma alloca\r
-#else /* not _AIX */\r
-char *alloca ();\r
-#endif /* not _AIX */\r
-#endif /* not HAVE_ALLOCA_H */\r
-#endif /* not __GNUC__ */\r
-\r
-extern void yyerror(char* s);\r
-\r
-#ifndef alloca\r
-#ifdef __GNUC__\r
-#define alloca __builtin_alloca\r
-#else /* not GNU C. */\r
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)\r
-#include <alloca.h>\r
-#else /* not sparc */\r
-#if (defined (MSDOS) && !defined (__TURBOC__)) || defined (WIN32)\r
-#include <malloc.h>\r
-#else /* not MSDOS, or __TURBOC__ */\r
-#if defined(_AIX)\r
-#include <malloc.h>\r
- #pragma alloca\r
-#else /* not MSDOS, __TURBOC__, or _AIX */\r
-#ifdef __hpux\r
-#ifdef __cplusplus\r
-extern "C" {\r
-void *alloca (unsigned int);\r
-};\r
-#else /* not __cplusplus */\r
-void *alloca ();\r
-#endif /* not __cplusplus */\r
-#endif /* __hpux */\r
-#endif /* not _AIX */\r
-#endif /* not MSDOS, or __TURBOC__ */\r
-#endif /* not sparc. */\r
-#endif /* not GNU C. */\r
-#endif /* alloca not defined. */\r
-\r
-/* This is the parser code that is written into each bison parser\r
- when the %semantic_parser declaration is not specified in the grammar.\r
- It was written by Richard Stallman by simplifying the hairy parser\r
- used when %semantic_parser is specified. */\r
-\r
-/* Note: there must be only one dollar sign in this file.\r
- It is replaced by the list of actions, each action\r
- as one case of the switch. */\r
-\r
-#define yyerrok (yyerrstatus = 0)\r
-#define yyclearin (yychar = YYEMPTY)\r
-#define YYEMPTY -2\r
-#define YYEOF 0\r
-#define YYACCEPT return(0)\r
-#define YYABORT return(1)\r
-#define YYERROR goto yyerrlab1\r
-/* Like YYERROR except do call yyerror.\r
- This remains here temporarily to ease the\r
- transition to the new meaning of YYERROR, for GCC.\r
- Once GCC version 2 has supplanted version 1, this can go. */\r
-#define YYFAIL goto yyerrlab\r
-#define YYRECOVERING() (!!yyerrstatus)\r
-#define YYBACKUP(token, value) \\r
-do \\r
- if (yychar == YYEMPTY && yylen == 1) \\r
- { yychar = (token), yylval = (value); \\r
- yychar1 = YYTRANSLATE (yychar); \\r
- YYPOPSTACK; \\r
- goto yybackup; \\r
- } \\r
- else \\r
- { yyerror ("syntax error: cannot back up"); YYERROR; } \\r
-while (0)\r
-\r
-#define YYTERROR 1\r
-#define YYERRCODE 256\r
-\r
-#ifndef YYPURE\r
-#define YYLEX yylex()\r
-#endif\r
-\r
-#ifdef YYPURE\r
-#ifdef YYLSP_NEEDED\r
-#ifdef YYLEX_PARAM\r
-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)\r
-#else\r
-#define YYLEX yylex(&yylval, &yylloc)\r
-#endif\r
-#else /* not YYLSP_NEEDED */\r
-#ifdef YYLEX_PARAM\r
-#define YYLEX yylex(&yylval, YYLEX_PARAM)\r
-#else\r
-#define YYLEX yylex(&yylval)\r
-#endif\r
-#endif /* not YYLSP_NEEDED */\r
-#endif\r
-\r
-/* If nonreentrant, generate the variables here */\r
-\r
-#ifndef YYPURE\r
-\r
-int yychar; /* the lookahead symbol */\r
-YYSTYPE yylval; /* the semantic value of the */\r
- /* lookahead symbol */\r
-\r
-#ifdef YYLSP_NEEDED\r
-YYLTYPE yylloc; /* location data for the lookahead */\r
- /* symbol */\r
-#endif\r
-\r
-int yynerrs; /* number of parse errors so far */\r
-#endif /* not YYPURE */\r
-\r
-#if YYDEBUG != 0\r
-int yydebug; /* nonzero means print parse trace */\r
-/* Since this is uninitialized, it does not stop multiple parsers\r
- from coexisting. */\r
-#endif\r
-\r
-/* YYINITDEPTH indicates the initial size of the parser's stacks */\r
-\r
-#ifndef YYINITDEPTH\r
-#define YYINITDEPTH 200\r
-#endif\r
-\r
-/* YYMAXDEPTH is the maximum size the stacks can grow to\r
- (effective only if the built-in stack extension method is used). */\r
-\r
-#if YYMAXDEPTH == 0\r
-#undef YYMAXDEPTH\r
-#endif\r
-\r
-#ifndef YYMAXDEPTH\r
-#define YYMAXDEPTH 10000\r
-#endif\r
-\r
-/* Prevent warning if -Wstrict-prototypes. */\r
-#ifdef __GNUC__\r
-int yyparse (void);\r
-#endif\r
-\f\r
-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */\r
-#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)\r
-#else /* not GNU C or C++ */\r
-#ifndef __cplusplus\r
-\r
-/* This is the most reliable way to avoid incompatibilities\r
- in available built-in functions on various systems. */\r
-static void\r
-__yy_memcpy (from, to, count)\r
- char *from;\r
- char *to;\r
- size_t count;\r
-{\r
- register char *f = from;\r
- register char *t = to;\r
- register size_t i = count;\r
-\r
- while (i-- > 0)\r
- *t++ = *f++;\r
-}\r
-\r
-#else /* __cplusplus */\r
-\r
-/* This is the most reliable way to avoid incompatibilities\r
- in available built-in functions on various systems. */\r
-static void\r
-__yy_memcpy (char *from, char *to, size_t count)\r
-{\r
- register char *f = from;\r
- register char *t = to;\r
- register size_t i = count;\r
-\r
- while (i-- > 0)\r
- *t++ = *f++;\r
-}\r
-\r
-#endif\r
-#endif\r
-\r
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed\r
- into yyparse. The argument should have type void *.\r
- It should actually point to an object.\r
- Grammar actions can access the variable by casting it\r
- to the proper pointer type. */\r
-\r
-#ifdef YYPARSE_PARAM\r
-#ifndef YYPARSE_PARAM_DECL\r
-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;\r
-#endif \r
-#else\r
-#define YYPARSE_PARAM\r
-#define YYPARSE_PARAM_DECL\r
-#endif\r
-\r
-extern YY_DECL;\r
-\r
-int\r
-yyparse(YYPARSE_PARAM_DECL YYPARSE_PARAM) {\r
- register int yystate;\r
- register int yyn;\r
- register short *yyssp;\r
- register YYSTYPE *yyvsp;\r
- int yyerrstatus; /* number of tokens to shift before error messages enabled */\r
- int yychar1 = 0; /* lookahead token as an internal (translated) token number */\r
-\r
- short yyssa[YYINITDEPTH]; /* the state stack */\r
- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */\r
-\r
- short *yyss = yyssa; /* refer to the stacks thru separate pointers */\r
- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */\r
-\r
-#ifdef YYLSP_NEEDED\r
- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */\r
- YYLTYPE *yyls = yylsa;\r
- YYLTYPE *yylsp;\r
-\r
-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)\r
-#else\r
-#define YYPOPSTACK (yyvsp--, yyssp--)\r
-#endif\r
-\r
- size_t yystacksize = YYINITDEPTH;\r
-\r
-#ifdef YYPURE\r
- int yychar;\r
- YYSTYPE yylval;\r
- int yynerrs;\r
-#ifdef YYLSP_NEEDED\r
- YYLTYPE yylloc;\r
-#endif\r
-#endif\r
-\r
- YYSTYPE yyval; /* the variable used to return */\r
- /* semantic values from the action */\r
- /* routines */\r
-\r
- int yylen;\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- fprintf(stderr, "Starting parse\n");\r
-#endif\r
-\r
- yystate = 0;\r
- yyerrstatus = 0;\r
- yynerrs = 0;\r
- yychar = YYEMPTY; /* Cause a token to be read. */\r
-\r
- /* Initialize stack pointers.\r
- Waste one element of value and location stack\r
- so that they stay on the same level as the state stack.\r
- The wasted elements are never initialized. */\r
-\r
- yyssp = yyss - 1;\r
- yyvsp = yyvs;\r
-#ifdef YYLSP_NEEDED\r
- yylsp = yyls;\r
-#endif\r
-\r
-/* Push a new state, which is found in yystate . */\r
-/* In all cases, when you get here, the value and location stacks\r
- have just been pushed. so pushing a state here evens the stacks. */\r
-yynewstate:\r
-\r
- *++yyssp = yystate;\r
-\r
- if (yyssp >= yyss + yystacksize - 1)\r
- {\r
- /* Give user a chance to reallocate the stack */\r
- /* Use copies of these so that the &'s don't force the real ones into memory. */\r
- YYSTYPE *yyvs1 = yyvs;\r
- short *yyss1 = yyss;\r
-#ifdef YYLSP_NEEDED\r
- YYLTYPE *yyls1 = yyls;\r
-#endif\r
-\r
- /* Get the current used size of the three stacks, in elements. */\r
- size_t size = yyssp - yyss + 1;\r
-\r
-#ifdef yyoverflow\r
- /* Each stack pointer address is followed by the size of\r
- the data in use in that stack, in bytes. */\r
-#ifdef YYLSP_NEEDED\r
- /* This used to be a conditional around just the two extra args,\r
- but that might be undefined if yyoverflow is a macro. */\r
- yyoverflow("parser stack overflow",\r
- &yyss1, size * sizeof (*yyssp),\r
- &yyvs1, size * sizeof (*yyvsp),\r
- &yyls1, size * sizeof (*yylsp),\r
- &yystacksize);\r
-#else\r
- yyoverflow("parser stack overflow",\r
- &yyss1, size * sizeof (*yyssp),\r
- &yyvs1, size * sizeof (*yyvsp),\r
- &yystacksize);\r
-#endif\r
-\r
- yyss = yyss1; yyvs = yyvs1;\r
-#ifdef YYLSP_NEEDED\r
- yyls = yyls1;\r
-#endif\r
-#else /* no yyoverflow */\r
- /* Extend the stack our own way. */\r
- if (yystacksize >= YYMAXDEPTH)\r
- {\r
- yyerror("parser stack overflow");\r
- return 2;\r
- }\r
- yystacksize *= 2;\r
- if (yystacksize > YYMAXDEPTH)\r
- yystacksize = YYMAXDEPTH;\r
- yyss = (short *) alloca (yystacksize * sizeof (*yyssp));\r
- __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));\r
- yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));\r
- __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));\r
-#ifdef YYLSP_NEEDED\r
- yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));\r
- __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));\r
-#endif\r
-#endif /* no yyoverflow */\r
-\r
- yyssp = yyss + size - 1;\r
- yyvsp = yyvs + size - 1;\r
-#ifdef YYLSP_NEEDED\r
- yylsp = yyls + size - 1;\r
-#endif\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);\r
-#endif\r
-\r
- if (yyssp >= yyss + yystacksize - 1)\r
- YYABORT;\r
- }\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- fprintf(stderr, "Entering state %d\n", yystate);\r
-#endif\r
-\r
- goto yybackup;\r
- yybackup:\r
-\r
-/* Do appropriate processing given the current state. */\r
-/* Read a lookahead token if we need one and don't already have one. */\r
-/* yyresume: */\r
-\r
- /* First try to decide what to do without reference to lookahead token. */\r
-\r
- yyn = yypact[yystate];\r
- if (yyn == YYFLAG)\r
- goto yydefault;\r
-\r
- /* Not known => get a lookahead token if don't already have one. */\r
-\r
- /* yychar is either YYEMPTY or YYEOF\r
- or a valid token in external form. */\r
-\r
- if (yychar == YYEMPTY)\r
- {\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- fprintf(stderr, "Reading a token: ");\r
-#endif\r
- yychar = YYLEX;\r
- }\r
-\r
- /* Convert token to internal form (in yychar1) for indexing tables with */\r
-\r
- if (yychar <= 0) /* This means end of input. */\r
- {\r
- yychar1 = 0;\r
- yychar = YYEOF; /* Don't call YYLEX any more */\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- fprintf(stderr, "Now at end of input.\n");\r
-#endif\r
- }\r
- else\r
- {\r
- yychar1 = YYTRANSLATE(yychar);\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- {\r
- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);\r
- /* Give the individual parser a way to print the precise meaning\r
- of a token, for further debugging info. */\r
-#ifdef YYPRINT\r
- YYPRINT (stderr, yychar, yylval);\r
-#endif\r
- fprintf (stderr, ")\n");\r
- }\r
-#endif\r
- }\r
-\r
- yyn += yychar1;\r
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)\r
- goto yydefault;\r
-\r
- yyn = yytable[yyn];\r
-\r
- /* yyn is what to do for this token type in this state.\r
- Negative => reduce, -yyn is rule number.\r
- Positive => shift, yyn is new state.\r
- New state is final state => don't bother to shift,\r
- just return success.\r
- 0, or most negative number => error. */\r
-\r
- if (yyn < 0)\r
- {\r
- if (yyn == YYFLAG)\r
- goto yyerrlab;\r
- yyn = -yyn;\r
- goto yyreduce;\r
- }\r
- else if (yyn == 0)\r
- goto yyerrlab;\r
-\r
- if (yyn == YYFINAL)\r
- YYACCEPT;\r
-\r
- /* Shift the lookahead token. */\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);\r
-#endif\r
-\r
- /* Discard the token being shifted unless it is eof. */\r
- if (yychar != YYEOF)\r
- yychar = YYEMPTY;\r
-\r
- *++yyvsp = yylval;\r
-#ifdef YYLSP_NEEDED\r
- *++yylsp = yylloc;\r
-#endif\r
-\r
- /* count tokens shifted since error; after three, turn off error status. */\r
- if (yyerrstatus) yyerrstatus--;\r
-\r
- yystate = yyn;\r
- goto yynewstate;\r
-\r
-/* Do the default action for the current state. */\r
-yydefault:\r
-\r
- yyn = yydefact[yystate];\r
- if (yyn == 0)\r
- goto yyerrlab;\r
-\r
-/* Do a reduction. yyn is the number of a rule to reduce with. */\r
-yyreduce:\r
- yylen = yyr2[yyn];\r
- if (yylen > 0)\r
- yyval = yyvsp[1-yylen]; /* implement default value of the action */\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- {\r
- int i;\r
-\r
- fprintf (stderr, "Reducing via rule %d (line %d), ",\r
- yyn, yyrline[yyn]);\r
-\r
- /* Print the symbols being reduced, and their result. */\r
- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)\r
- fprintf (stderr, "%s ", yytname[yyrhs[i]]);\r
- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);\r
- }\r
-#endif\r
-\r
-\r
- switch (yyn) {\r
-\r
-case 1:\r
-#line 210 "glslang.y"\r
-{\r
- // The symbol table search was done in the lexical phase\r
- const TSymbol* symbol = yyvsp[0].lex.symbol;\r
- const TVariable* variable;\r
- if (symbol == 0) {\r
- parseContext.error(yyvsp[0].lex.line, "undeclared identifier", yyvsp[0].lex.string->c_str(), "");\r
- parseContext.recover();\r
- TVariable* fakeVariable = new TVariable(yyvsp[0].lex.string, TType(EbtFloat));\r
- parseContext.symbolTable.insert(*fakeVariable);\r
- variable = fakeVariable;\r
- } else {\r
- // This identifier can only be a variable type symbol \r
- if (! symbol->isVariable()) {\r
- parseContext.error(yyvsp[0].lex.line, "variable expected", yyvsp[0].lex.string->c_str(), "");\r
- parseContext.recover();\r
- }\r
- variable = static_cast<const TVariable*>(symbol);\r
- }\r
-\r
- // don't delete $1.string, it's used by error recovery, and the pool\r
- // pop will reclaim the memory\r
-\r
- if (variable->getType().getQualifier() == EvqConst ) {\r
- constUnion* constArray = variable->getConstPointer();\r
- TType t = TType(variable->getType());\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(constArray, t, yyvsp[0].lex.line); \r
- } else\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addSymbol(variable->getUniqueId(), \r
- variable->getName(), \r
- variable->getType(), yyvsp[0].lex.line);\r
- ;\r
- break;}\r
-case 2:\r
-#line 244 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 3:\r
-#line 247 "glslang.y"\r
-{\r
- //\r
- // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders, \r
- // check for overflow for constants\r
- //\r
- if (abs(yyvsp[0].lex.i) >= (1 << 16)) {\r
- parseContext.error(yyvsp[0].lex.line, " integer constant overflow", "", "");\r
- parseContext.recover();\r
- }\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->iConst = yyvsp[0].lex.i;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);\r
- ;\r
- break;}\r
-case 4:\r
-#line 260 "glslang.y"\r
-{\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->fConst = yyvsp[0].lex.f;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].lex.line);\r
- ;\r
- break;}\r
-case 5:\r
-#line 265 "glslang.y"\r
-{\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = yyvsp[0].lex.b;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[0].lex.line);\r
- ;\r
- break;}\r
-case 6:\r
-#line 270 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 7:\r
-#line 276 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 8:\r
-#line 279 "glslang.y"\r
-{\r
- if (!yyvsp[-3].interm.intermTypedNode->isArray() && !yyvsp[-3].interm.intermTypedNode->isMatrix() && !yyvsp[-3].interm.intermTypedNode->isVector()) {\r
- if (yyvsp[-3].interm.intermTypedNode->getAsSymbolNode())\r
- parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", yyvsp[-3].interm.intermTypedNode->getAsSymbolNode()->getSymbol().c_str(), "");\r
- else\r
- parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", "expression", "");\r
- parseContext.recover();\r
- }\r
- if (yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst && !yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) {\r
- if (yyvsp[-3].interm.intermTypedNode->isVector()) { // constant folding for vectors\r
- TVectorFields fields;\r
- fields.num = 1;\r
- fields.offsets[0] = yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst; // need to do it this way because v.xy sends fields integer array\r
- yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);\r
- } else if (yyvsp[-3].interm.intermTypedNode->isMatrix()) { // constant folding for matrices\r
- yyval.interm.intermTypedNode = parseContext.addConstMatrixNode(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);\r
- }\r
- } else {\r
- if (yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) {\r
- if ((yyvsp[-3].interm.intermTypedNode->isVector() || yyvsp[-3].interm.intermTypedNode->isMatrix()) && yyvsp[-3].interm.intermTypedNode->getType().getNominalSize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst && !yyvsp[-3].interm.intermTypedNode->isArray() ) {\r
- parseContext.error(yyvsp[-2].lex.line, "", "[", "field selection out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);\r
- parseContext.recover();\r
- } else {\r
- if (yyvsp[-3].interm.intermTypedNode->isArray()) {\r
- if (yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) {\r
- if (yyvsp[-3].interm.intermTypedNode->getType().getMaxArraySize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst) {\r
- if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, true, yyvsp[-2].lex.line))\r
- parseContext.recover(); \r
- } else {\r
- if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), 0, false, yyvsp[-2].lex.line))\r
- parseContext.recover(); \r
- }\r
- } else if ( yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst >= yyvsp[-3].interm.intermTypedNode->getType().getArraySize()) {\r
- parseContext.error(yyvsp[-2].lex.line, "", "[", "array index out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);\r
- parseContext.recover();\r
- }\r
- }\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);\r
- }\r
- } else {\r
- if (yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) {\r
- parseContext.error(yyvsp[-2].lex.line, "", "[", "array must be redeclared with a size before being indexed with a variable");\r
- parseContext.recover();\r
- }\r
- \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexIndirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);\r
- }\r
- } \r
- if (yyval.interm.intermTypedNode == 0) {\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->fConst = 0.0;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[-2].lex.line);\r
- } else if (yyvsp[-3].interm.intermTypedNode->isArray()) {\r
- if (yyvsp[-3].interm.intermTypedNode->getType().getStruct())\r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getType().getStruct(), yyvsp[-3].interm.intermTypedNode->getType().getTypeName()));\r
- else\r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize(), yyvsp[-3].interm.intermTypedNode->isMatrix()));\r
- } else if (yyvsp[-3].interm.intermTypedNode->isMatrix() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst) \r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst, yyvsp[-3].interm.intermTypedNode->getNominalSize())); \r
- else if (yyvsp[-3].interm.intermTypedNode->isMatrix()) \r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize())); \r
- else if (yyvsp[-3].interm.intermTypedNode->isVector() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst) \r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst)); \r
- else if (yyvsp[-3].interm.intermTypedNode->isVector()) \r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary));\r
- else\r
- yyval.interm.intermTypedNode->setType(yyvsp[-3].interm.intermTypedNode->getType()); \r
- ;\r
- break;}\r
-case 9:\r
-#line 347 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 10:\r
-#line 350 "glslang.y"\r
-{ \r
- if (yyvsp[-2].interm.intermTypedNode->isArray()) {\r
- parseContext.error(yyvsp[0].lex.line, "cannot apply dot operator to an array", ".", "");\r
- parseContext.recover();\r
- }\r
-\r
- if (yyvsp[-2].interm.intermTypedNode->isVector()) {\r
- TVectorFields fields;\r
- if (! parseContext.parseVectorFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) {\r
- fields.num = 1;\r
- fields.offsets[0] = 0;\r
- parseContext.recover();\r
- }\r
-\r
- if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) { // constant folding for vector fields\r
- yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-2].interm.intermTypedNode, yyvsp[0].lex.line);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- else\r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqConst, (int) (*yyvsp[0].lex.string).size()));\r
- } else {\r
- if (fields.num == 1) {\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->iConst = fields.offsets[0];\r
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType()));\r
- } else {\r
- TString vectorString = *yyvsp[0].lex.string;\r
- TIntermTyped* index = parseContext.intermediate.addSwizzle(fields, yyvsp[0].lex.line); \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpVectorSwizzle, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(),EvqTemporary, (int) vectorString.size())); \r
- }\r
- }\r
- } else if (yyvsp[-2].interm.intermTypedNode->isMatrix()) {\r
- TMatrixFields fields;\r
- if (! parseContext.parseMatrixFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) {\r
- fields.wholeRow = false;\r
- fields.wholeCol = false;\r
- fields.row = 0;\r
- fields.col = 0;\r
- parseContext.recover();\r
- }\r
-\r
- if (fields.wholeRow || fields.wholeCol) {\r
- parseContext.error(yyvsp[-1].lex.line, " non-scalar fields not implemented yet", ".", "");\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->iConst = 0;\r
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line); \r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-2].interm.intermTypedNode->getNominalSize()));\r
- } else {\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->iConst = fields.col * yyvsp[-2].interm.intermTypedNode->getNominalSize() + fields.row;\r
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line); \r
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType()));\r
- }\r
- } else if (yyvsp[-2].interm.intermTypedNode->getBasicType() == EbtStruct) {\r
- bool fieldFound = false;\r
- TTypeList* fields = yyvsp[-2].interm.intermTypedNode->getType().getStruct();\r
- if (fields == 0) {\r
- parseContext.error(yyvsp[-1].lex.line, "structure has no fields", "Internal Error", "");\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- } else {\r
- unsigned int i;\r
- for (i = 0; i < fields->size(); ++i) {\r
- if ((*fields)[i].type->getFieldName() == *yyvsp[0].lex.string) {\r
- fieldFound = true;\r
- break;\r
- } \r
- }\r
- if (fieldFound) {\r
- if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) {\r
- yyval.interm.intermTypedNode = parseContext.addConstStruct(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode, yyvsp[-1].lex.line);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- else {\r
- yyval.interm.intermTypedNode->setType(*(*fields)[i].type);\r
- // change the qualifier of the return type, not of the structure field\r
- // as the structure definition is shared between various structures.\r
- yyval.interm.intermTypedNode->getTypePointer()->changeQualifier(EvqConst);\r
- }\r
- } else {\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->iConst = i;\r
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirectStruct, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line); \r
- yyval.interm.intermTypedNode->setType(*(*fields)[i].type);\r
- }\r
- } else {\r
- parseContext.error(yyvsp[-1].lex.line, " no such field in structure", yyvsp[0].lex.string->c_str(), "");\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- }\r
- } else {\r
- parseContext.error(yyvsp[-1].lex.line, " field selection requires structure, vector, or matrix on left hand side", yyvsp[0].lex.string->c_str(), "");\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- // don't delete $3.string, it's from the pool\r
- ;\r
- break;}\r
-case 11:\r
-#line 459 "glslang.y"\r
-{\r
- if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode))\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostIncrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.unaryOpError(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 12:\r
-#line 469 "glslang.y"\r
-{\r
- if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode))\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostDecrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.unaryOpError(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 13:\r
-#line 482 "glslang.y"\r
-{\r
- if (parseContext.integerErrorCheck(yyvsp[0].interm.intermTypedNode, "[]"))\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; \r
- ;\r
- break;}\r
-case 14:\r
-#line 490 "glslang.y"\r
-{\r
- TFunction* fnCall = yyvsp[0].interm.function;\r
- TOperator op = fnCall->getBuiltInOp();\r
- \r
- if (op != EOpNull) {\r
- //\r
- // Then this should be a constructor.\r
- //\r
- TType type(EbtVoid); // use this to get the type back\r
- if (parseContext.constructorErrorCheck(yyvsp[0].interm.line, yyvsp[0].interm.intermNode, *fnCall, op, &type)) {\r
- yyval.interm.intermTypedNode = 0;\r
- } else {\r
- //\r
- // It's a constructor, of type 'type'.\r
- //\r
- yyval.interm.intermTypedNode = parseContext.addConstructor(yyvsp[0].interm.intermNode, &type, op, fnCall, yyvsp[0].interm.line);\r
- }\r
- \r
- if (yyval.interm.intermTypedNode == 0) { \r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(0, op, yyvsp[0].interm.line);\r
- }\r
- yyval.interm.intermTypedNode->setType(type);\r
- } else {\r
- //\r
- // Not a constructor. Find it in the symbol table.\r
- //\r
- const TFunction* fnCandidate;\r
- bool builtIn;\r
- fnCandidate = parseContext.findFunction(yyvsp[0].interm.line, fnCall, &builtIn);\r
- if (fnCandidate) {\r
- //\r
- // A declared function. But, it might still map to a built-in\r
- // operation.\r
- //\r
- op = fnCandidate->getBuiltInOp();\r
- if (builtIn && op != EOpNull) {\r
- //\r
- // A function call mapped to a built-in operation.\r
- //\r
- if (fnCandidate->getParamCount() == 1) {\r
- //\r
- // Treat it like a built-in unary operator.\r
- //\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(op, yyvsp[0].interm.intermNode, 0, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.error(yyvsp[0].interm.intermNode->getLine(), " wrong operand type", "Internal Error", \r
- "built in unary operator function. Type: %s",\r
- static_cast<TIntermTyped*>(yyvsp[0].interm.intermNode)->getCompleteString().c_str());\r
- YYERROR;\r
- }\r
- } else {\r
- yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, op, yyvsp[0].interm.line);\r
- }\r
- } else {\r
- // This is a real function call\r
- \r
- yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, EOpFunctionCall, yyvsp[0].interm.line);\r
- yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType()); \r
- \r
- // this is how we know whether the given function is a builtIn function or a user defined function\r
- // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also\r
- // if builtIn == true, it's definitely a builtIn function with EOpNull\r
- if (!builtIn) \r
- yyval.interm.intermTypedNode->getAsAggregate()->setUserDefined(); \r
- yyval.interm.intermTypedNode->getAsAggregate()->setName(fnCandidate->getMangledName());\r
-\r
- TQualifier qual;\r
- TQualifierList& qualifierList = yyval.interm.intermTypedNode->getAsAggregate()->getQualifier();\r
- for (int i = 0; i < fnCandidate->getParamCount(); ++i) {\r
- qual = (*fnCandidate)[i].type->getQualifier();\r
- if (qual == EvqOut || qual == EvqInOut) {\r
- if (parseContext.lValueErrorCheck(yyval.interm.intermTypedNode->getLine(), "assign", yyval.interm.intermTypedNode->getAsAggregate()->getSequence()[i]->getAsTyped())) {\r
- parseContext.error(yyvsp[0].interm.intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");\r
- parseContext.recover();\r
- }\r
- }\r
- qualifierList.push_back(qual);\r
- }\r
- }\r
- yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType());\r
- } else {\r
- // error message was put out by PaFindFunction()\r
- // Put on a dummy node for error recovery\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->fConst = 0.0;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].interm.line);\r
- parseContext.recover();\r
- }\r
- }\r
- delete fnCall;\r
- ;\r
- break;}\r
-case 15:\r
-#line 585 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[-1].interm;\r
- yyval.interm.line = yyvsp[0].lex.line;\r
- ;\r
- break;}\r
-case 16:\r
-#line 589 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[-1].interm;\r
- yyval.interm.line = yyvsp[0].lex.line;\r
- ;\r
- break;}\r
-case 17:\r
-#line 596 "glslang.y"\r
-{\r
- yyval.interm.function = yyvsp[-1].interm.function;\r
- yyval.interm.intermNode = 0;\r
- ;\r
- break;}\r
-case 18:\r
-#line 600 "glslang.y"\r
-{\r
- yyval.interm.function = yyvsp[0].interm.function;\r
- yyval.interm.intermNode = 0;\r
- ;\r
- break;}\r
-case 19:\r
-#line 607 "glslang.y"\r
-{\r
- TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) };\r
- yyvsp[-1].interm.function->addParameter(param);\r
- yyval.interm.function = yyvsp[-1].interm.function;\r
- yyval.interm.intermNode = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 20:\r
-#line 613 "glslang.y"\r
-{\r
- TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) };\r
- yyvsp[-2].interm.function->addParameter(param);\r
- yyval.interm.function = yyvsp[-2].interm.function;\r
- yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);\r
- ;\r
- break;}\r
-case 21:\r
-#line 622 "glslang.y"\r
-{\r
- yyval.interm.function = yyvsp[-1].interm.function;\r
- ;\r
- break;}\r
-case 22:\r
-#line 628 "glslang.y"\r
-{\r
- if (yyvsp[0].interm.op == EOpConstructStruct) {\r
- TString tempString = "";\r
- TFunction *function = new TFunction(&tempString, *(yyvsp[0].interm.type.userDef), yyvsp[0].interm.op);\r
- yyval.interm.function = function;\r
- }\r
- else {\r
- TFunction *function = new TFunction(yyvsp[0].interm.op);\r
- yyval.interm.function = function;\r
- }\r
- ;\r
- break;}\r
-case 23:\r
-#line 639 "glslang.y"\r
-{\r
- if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string)) \r
- parseContext.recover();\r
- TFunction *function = new TFunction(yyvsp[0].lex.string, TType(EbtVoid));\r
- yyval.interm.function = function; \r
- ;\r
- break;}\r
-case 24:\r
-#line 654 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructFloat; ;\r
- break;}\r
-case 25:\r
-#line 655 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructInt; ;\r
- break;}\r
-case 26:\r
-#line 656 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBool; ;\r
- break;}\r
-case 27:\r
-#line 657 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec2; ;\r
- break;}\r
-case 28:\r
-#line 658 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec3; ;\r
- break;}\r
-case 29:\r
-#line 659 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec4; ;\r
- break;}\r
-case 30:\r
-#line 660 "glslang.y"\r
-{ FRAG_VERT_ONLY("bvec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec2; ;\r
- break;}\r
-case 31:\r
-#line 661 "glslang.y"\r
-{ FRAG_VERT_ONLY("bvec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec3; ;\r
- break;}\r
-case 32:\r
-#line 662 "glslang.y"\r
-{ FRAG_VERT_ONLY("bvec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec4; ;\r
- break;}\r
-case 33:\r
-#line 663 "glslang.y"\r
-{ FRAG_VERT_ONLY("ivec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec2; ;\r
- break;}\r
-case 34:\r
-#line 664 "glslang.y"\r
-{ FRAG_VERT_ONLY("ivec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec3; ;\r
- break;}\r
-case 35:\r
-#line 665 "glslang.y"\r
-{ FRAG_VERT_ONLY("ivec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec4; ;\r
- break;}\r
-case 36:\r
-#line 666 "glslang.y"\r
-{ FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat2; ;\r
- break;}\r
-case 37:\r
-#line 667 "glslang.y"\r
-{ FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat3; ;\r
- break;}\r
-case 38:\r
-#line 668 "glslang.y"\r
-{ FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat4; ;\r
- break;}\r
-case 39:\r
-#line 669 "glslang.y"\r
-{ \r
- TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line }; \r
- yyval.interm.type = t;\r
- yyval.interm.line = yyvsp[0].lex.line; \r
- yyval.interm.op = EOpConstructStruct; \r
- ;\r
- break;}\r
-case 40:\r
-#line 680 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 41:\r
-#line 683 "glslang.y"\r
-{\r
- if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode))\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreIncrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.unaryOpError(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 42:\r
-#line 693 "glslang.y"\r
-{\r
- if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode))\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreDecrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.unaryOpError(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 43:\r
-#line 703 "glslang.y"\r
-{\r
- if (yyvsp[-1].interm.op != EOpNull) {\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(yyvsp[-1].interm.op, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- char* errorOp = "";\r
- switch(yyvsp[-1].interm.op) {\r
- case EOpNegative: errorOp = "-"; break;\r
- case EOpLogicalNot: errorOp = "!"; break;\r
- case EOpBitwiseNot: errorOp = "~"; break;\r
- default: break;\r
- }\r
- parseContext.unaryOpError(yyvsp[-1].interm.line, errorOp, yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- }\r
- } else\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 44:\r
-#line 725 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNull; ;\r
- break;}\r
-case 45:\r
-#line 726 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNegative; ;\r
- break;}\r
-case 46:\r
-#line 727 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLogicalNot; ;\r
- break;}\r
-case 47:\r
-#line 728 "glslang.y"\r
-{ PACK_UNPACK_ONLY("~", yyvsp[0].lex.line); \r
- yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpBitwiseNot; ;\r
- break;}\r
-case 48:\r
-#line 734 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 49:\r
-#line 735 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("*", yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMul, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "*", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 50:\r
-#line 744 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("/", yyvsp[-1].lex.line); \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpDiv, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "/", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 51:\r
-#line 753 "glslang.y"\r
-{\r
- PACK_UNPACK_ONLY("%", yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMod, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "%", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 52:\r
-#line 765 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 53:\r
-#line 766 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAdd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "+", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 54:\r
-#line 774 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpSub, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "-", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- } \r
- ;\r
- break;}\r
-case 55:\r
-#line 785 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 56:\r
-#line 786 "glslang.y"\r
-{\r
- PACK_UNPACK_ONLY("<<", yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLeftShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "<<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 57:\r
-#line 795 "glslang.y"\r
-{\r
- PACK_UNPACK_ONLY(">>", yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpRightShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, ">>", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 58:\r
-#line 807 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 59:\r
-#line 808 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 60:\r
-#line 818 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, ">", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 61:\r
-#line 828 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "<=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 62:\r
-#line 838 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, ">=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 63:\r
-#line 851 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 64:\r
-#line 852 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "==", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 65:\r
-#line 862 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpNotEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "!=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 66:\r
-#line 875 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 67:\r
-#line 876 "glslang.y"\r
-{\r
- PACK_UNPACK_ONLY("&", yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 68:\r
-#line 888 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 69:\r
-#line 889 "glslang.y"\r
-{\r
- PACK_UNPACK_ONLY("^", yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpExclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 70:\r
-#line 901 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 71:\r
-#line 902 "glslang.y"\r
-{\r
- PACK_UNPACK_ONLY("|", yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpInclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "|", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 72:\r
-#line 914 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 73:\r
-#line 915 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "&&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 74:\r
-#line 928 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 75:\r
-#line 929 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalXor, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "^^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 76:\r
-#line 942 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 77:\r
-#line 943 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-1].lex.line, "||", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- constUnion *unionArray = new constUnion[1];\r
- unionArray->bConst = false;\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);\r
- }\r
- ;\r
- break;}\r
-case 78:\r
-#line 956 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 79:\r
-#line 957 "glslang.y"\r
-{\r
- if (parseContext.boolErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.intermTypedNode))\r
- parseContext.recover();\r
- \r
- yyval.interm.intermTypedNode = parseContext.intermediate.addSelection(yyvsp[-4].interm.intermTypedNode, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-3].lex.line);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.binaryOpError(yyvsp[-3].lex.line, ":", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 80:\r
-#line 971 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 81:\r
-#line 972 "glslang.y"\r
-{\r
- if (parseContext.lValueErrorCheck(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode))\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = parseContext.intermediate.addAssign(yyvsp[-1].interm.op, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line);\r
- if (yyval.interm.intermTypedNode == 0) {\r
- parseContext.assignError(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;\r
- }\r
- ;\r
- break;}\r
-case 82:\r
-#line 985 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAssign; ;\r
- break;}\r
-case 83:\r
-#line 986 "glslang.y"\r
-{ FRAG_VERT_ONLY("*=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpMulAssign; ;\r
- break;}\r
-case 84:\r
-#line 987 "glslang.y"\r
-{ FRAG_VERT_ONLY("/=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpDivAssign; ;\r
- break;}\r
-case 85:\r
-#line 988 "glslang.y"\r
-{ PACK_UNPACK_ONLY("%=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpModAssign; ;\r
- break;}\r
-case 86:\r
-#line 989 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAddAssign; ;\r
- break;}\r
-case 87:\r
-#line 990 "glslang.y"\r
-{ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpSubAssign; ;\r
- break;}\r
-case 88:\r
-#line 991 "glslang.y"\r
-{ PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLeftShiftAssign; ;\r
- break;}\r
-case 89:\r
-#line 992 "glslang.y"\r
-{ PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpRightShiftAssign; ;\r
- break;}\r
-case 90:\r
-#line 993 "glslang.y"\r
-{ PACK_UNPACK_ONLY("&=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAndAssign; ;\r
- break;}\r
-case 91:\r
-#line 994 "glslang.y"\r
-{ PACK_UNPACK_ONLY("^=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpExclusiveOrAssign; ;\r
- break;}\r
-case 92:\r
-#line 995 "glslang.y"\r
-{ PACK_UNPACK_ONLY("|=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpInclusiveOrAssign; ;\r
- break;}\r
-case 93:\r
-#line 999 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 94:\r
-#line 1002 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);\r
- yyval.interm.intermTypedNode->getAsAggregate()->setOperator(EOpComma); \r
- yyval.interm.intermTypedNode->setType(yyvsp[0].interm.intermTypedNode->getType());\r
- ;\r
- break;}\r
-case 95:\r
-#line 1010 "glslang.y"\r
-{\r
- if (parseContext.constErrorCheck(yyvsp[0].interm.intermTypedNode))\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 96:\r
-#line 1018 "glslang.y"\r
-{ yyval.interm.intermNode = 0; ;\r
- break;}\r
-case 97:\r
-#line 1019 "glslang.y"\r
-{ \r
- if (yyvsp[-1].interm.intermAggregate)\r
- yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence); \r
- yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate; \r
- ;\r
- break;}\r
-case 98:\r
-#line 1027 "glslang.y"\r
-{\r
- //\r
- // Multiple declarations of the same function are allowed.\r
- //\r
- // If this is a definition, the definition production code will check for redefinitions \r
- // (we don't know at this point if it's a definition or not).\r
- //\r
- // Redeclarations are allowed. But, return types and parameter qualifiers must match.\r
- // \r
- TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(yyvsp[-1].interm.function->getMangledName()));\r
- if (prevDec) {\r
- if (prevDec->getReturnType() != yyvsp[-1].interm.function->getReturnType()) {\r
- parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same return type", yyvsp[-1].interm.function->getReturnType().getBasicString(), "");\r
- parseContext.recover();\r
- }\r
- for (int i = 0; i < prevDec->getParamCount(); ++i) {\r
- if ((*prevDec)[i].type->getQualifier() != (*yyvsp[-1].interm.function)[i].type->getQualifier()) {\r
- parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same parameter qualifiers", (*yyvsp[-1].interm.function)[i].type->getQualifierString(), "");\r
- parseContext.recover();\r
- }\r
- }\r
- }\r
- \r
- //\r
- // If this is a redeclaration, it could also be a definition,\r
- // in which case, we want to use the variable names from this one, and not the one that's\r
- // being redeclared. So, pass back up this declaration, not the one in the symbol table.\r
- //\r
- yyval.interm.function = yyvsp[-1].interm.function;\r
- yyval.interm.line = yyvsp[0].lex.line;\r
-\r
- parseContext.symbolTable.insert(*yyval.interm.function);\r
- ;\r
- break;}\r
-case 99:\r
-#line 1063 "glslang.y"\r
-{\r
- yyval.interm.function = yyvsp[0].interm.function;\r
- ;\r
- break;}\r
-case 100:\r
-#line 1066 "glslang.y"\r
-{ \r
- yyval.interm.function = yyvsp[0].interm.function; \r
- ;\r
- break;}\r
-case 101:\r
-#line 1073 "glslang.y"\r
-{\r
- // Add the parameter \r
- yyval.interm.function = yyvsp[-1].interm.function;\r
- if (yyvsp[0].interm.param.type->getBasicType() != EbtVoid)\r
- yyvsp[-1].interm.function->addParameter(yyvsp[0].interm.param);\r
- else\r
- delete yyvsp[0].interm.param.type;\r
- ;\r
- break;}\r
-case 102:\r
-#line 1081 "glslang.y"\r
-{ \r
- //\r
- // Only first parameter of one-parameter functions can be void\r
- // The check for named parameters not being void is done in parameter_declarator \r
- //\r
- if (yyvsp[0].interm.param.type->getBasicType() == EbtVoid) {\r
- //\r
- // This parameter > first is void\r
- //\r
- parseContext.error(yyvsp[-1].lex.line, "cannot be an argument type except for '(void)'", "void", "");\r
- parseContext.recover();\r
- delete yyvsp[0].interm.param.type;\r
- } else {\r
- // Add the parameter \r
- yyval.interm.function = yyvsp[-2].interm.function; \r
- yyvsp[-2].interm.function->addParameter(yyvsp[0].interm.param);\r
- }\r
- ;\r
- break;}\r
-case 103:\r
-#line 1102 "glslang.y"\r
-{\r
- if (yyvsp[-2].interm.type.qualifier != EvqGlobal && yyvsp[-2].interm.type.qualifier != EvqTemporary) {\r
- parseContext.error(yyvsp[-1].lex.line, "no qualifiers allowed for function return", getQualifierString(yyvsp[-2].interm.type.qualifier), "");\r
- parseContext.recover();\r
- }\r
- // make sure a sampler is not involved as well...\r
- if (parseContext.structQualifierErrorCheck(yyvsp[-1].lex.line, yyvsp[-2].interm.type))\r
- parseContext.recover();\r
- \r
- // Add the function as a prototype after parsing it (we do not support recursion) \r
- TFunction *function;\r
- function = new TFunction(yyvsp[-1].lex.string, TType(yyvsp[-2].interm.type));\r
- yyval.interm.function = function;\r
- ;\r
- break;}\r
-case 104:\r
-#line 1120 "glslang.y"\r
-{\r
- if (yyvsp[-1].interm.type.type == EbtVoid) {\r
- parseContext.error(yyvsp[0].lex.line, "illegal use of type 'void'", yyvsp[0].lex.string->c_str(), "");\r
- parseContext.recover();\r
- }\r
- if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))\r
- parseContext.recover();\r
- TParameter param = {yyvsp[0].lex.string, new TType(yyvsp[-1].interm.type)};\r
- yyval.interm.line = yyvsp[0].lex.line;\r
- yyval.interm.param = param;\r
- ;\r
- break;}\r
-case 105:\r
-#line 1131 "glslang.y"\r
-{\r
- // Check that we can make an array out of this type\r
- if (yyvsp[-4].interm.type.array) {\r
- parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-4].interm.type).getCompleteString().c_str(), "");\r
- parseContext.recover();\r
- }\r
- if (parseContext.reservedErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string))\r
- parseContext.recover();\r
- yyvsp[-4].interm.type.array = true;\r
- TType* type = new TType(yyvsp[-4].interm.type); \r
- if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion())\r
- type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);\r
- TParameter param = { yyvsp[-3].lex.string, type };\r
- yyval.interm.line = yyvsp[-3].lex.line;\r
- yyval.interm.param = param;\r
- ;\r
- break;}\r
-case 106:\r
-#line 1158 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[0].interm;\r
- if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 107:\r
-#line 1163 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[0].interm;\r
- if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type))\r
- parseContext.recover();\r
- if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 108:\r
-#line 1173 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[0].interm;\r
- if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 109:\r
-#line 1178 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[0].interm;\r
- if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type))\r
- parseContext.recover();\r
- if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 110:\r
-#line 1188 "glslang.y"\r
-{\r
- yyval.interm.qualifier = EvqIn;\r
- ;\r
- break;}\r
-case 111:\r
-#line 1191 "glslang.y"\r
-{\r
- yyval.interm.qualifier = EvqIn;\r
- ;\r
- break;}\r
-case 112:\r
-#line 1194 "glslang.y"\r
-{\r
- yyval.interm.qualifier = EvqOut;\r
- ;\r
- break;}\r
-case 113:\r
-#line 1197 "glslang.y"\r
-{\r
- yyval.interm.qualifier = EvqInOut;\r
- ;\r
- break;}\r
-case 114:\r
-#line 1203 "glslang.y"\r
-{\r
- TParameter param = { 0, new TType(yyvsp[0].interm.type) };\r
- yyval.interm.param = param;\r
- \r
- ;\r
- break;}\r
-case 115:\r
-#line 1208 "glslang.y"\r
-{\r
- // Check that we can make an array out of this type \r
- if (yyvsp[-3].interm.type.array) {\r
- parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-3].interm.type).getCompleteString().c_str(), "");\r
- parseContext.recover();\r
- }\r
- yyvsp[-3].interm.type.array = true;\r
- TType* type = new TType(yyvsp[-3].interm.type); \r
- if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion())\r
- type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);\r
-\r
- TParameter param = { 0, type };\r
- yyval.interm.line = yyvsp[-2].lex.line;\r
- yyval.interm.param = param;\r
- ;\r
- break;}\r
-case 116:\r
-#line 1226 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[0].interm;\r
- ;\r
- break;}\r
-case 117:\r
-#line 1229 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[-2].interm;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.type))\r
- parseContext.recover();\r
- \r
- if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 118:\r
-#line 1237 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[-4].interm;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))\r
- parseContext.recover();\r
- \r
- if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 119:\r
-#line 1245 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[-5].interm;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-5].interm.type))\r
- parseContext.recover();\r
- \r
- if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 120:\r
-#line 1253 "glslang.y"\r
-{\r
- yyval.interm = yyvsp[-4].interm;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))\r
- parseContext.recover();\r
- \r
- TIntermNode* intermNode;\r
- if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-4].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) {\r
- //\r
- // build the intermediate representation\r
- //\r
- if (intermNode)\r
- yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-4].interm.intermNode, intermNode, yyvsp[-1].lex.line);\r
- else\r
- yyval.interm.intermAggregate = yyvsp[-4].interm.intermAggregate;\r
- } else {\r
- parseContext.recover();\r
- yyval.interm.intermAggregate = 0;\r
- }\r
- ;\r
- break;}\r
-case 121:\r
-#line 1275 "glslang.y"\r
-{\r
- yyval.interm.type = yyvsp[0].interm.type;\r
- yyval.interm.intermAggregate = 0;\r
- ;\r
- break;}\r
-case 122:\r
-#line 1279 "glslang.y"\r
-{\r
- yyval.interm.intermAggregate = 0;\r
- yyval.interm.type = yyvsp[-1].interm.type;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-1].interm.type))\r
- parseContext.recover();\r
- \r
- if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 123:\r
-#line 1288 "glslang.y"\r
-{\r
- yyval.interm.intermAggregate = 0;\r
- yyval.interm.type = yyvsp[-3].interm.type;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))\r
- parseContext.recover();\r
- \r
- if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 124:\r
-#line 1297 "glslang.y"\r
-{\r
- yyval.interm.intermAggregate = 0;\r
- yyval.interm.type = yyvsp[-4].interm.type;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.type))\r
- parseContext.recover();\r
- \r
- if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode))\r
- parseContext.recover();\r
- ;\r
- break;}\r
-case 125:\r
-#line 1306 "glslang.y"\r
-{\r
- yyval.interm.type = yyvsp[-3].interm.type;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))\r
- parseContext.recover();\r
- \r
- TIntermNode* intermNode;\r
- if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) {\r
- //\r
- // Build intermediate representation\r
- //\r
- if (intermNode)\r
- yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, yyvsp[-1].lex.line);\r
- else\r
- yyval.interm.intermAggregate = 0;\r
- } else {\r
- parseContext.recover();\r
- yyval.interm.intermAggregate = 0;\r
- }\r
- ;\r
- break;}\r
-case 126:\r
-#line 1396 "glslang.y"\r
-{\r
- yyval.interm.type = yyvsp[0].interm.type;\r
- ;\r
- break;}\r
-case 127:\r
-#line 1399 "glslang.y"\r
-{ \r
- TPublicType t = { yyvsp[0].interm.type.type, yyvsp[-1].interm.type.qualifier, yyvsp[0].interm.type.size, yyvsp[0].interm.type.matrix, false, yyvsp[0].interm.type.userDef, 0 };\r
- if (yyvsp[-1].interm.type.qualifier == EvqAttribute &&\r
- (yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) {\r
- parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), "");\r
- parseContext.recover();\r
- }\r
- if ((yyvsp[-1].interm.type.qualifier == EvqVaryingIn || yyvsp[-1].interm.type.qualifier == EvqVaryingOut) &&\r
- (yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) {\r
- parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), "");\r
- parseContext.recover();\r
- }\r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 128:\r
-#line 1416 "glslang.y"\r
-{ \r
- TPublicType t = { EbtVoid, EvqConst, 1, false, false, 0 }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 129:\r
-#line 1420 "glslang.y"\r
-{ \r
- VERTEX_ONLY("attribute", yyvsp[0].lex.line);\r
- if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))\r
- parseContext.recover();\r
- TPublicType t = { EbtVoid, EvqAttribute, 1, false, false, 0 }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 130:\r
-#line 1427 "glslang.y"\r
-{\r
- if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "varying"))\r
- parseContext.recover();\r
- TPublicType t = { EbtVoid, EvqVaryingIn, 1, false, false, 0 };\r
- if (parseContext.language == EShLangVertex)\r
- t.qualifier = EvqVaryingOut;\r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 131:\r
-#line 1435 "glslang.y"\r
-{\r
- if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "uniform"))\r
- parseContext.recover();\r
- TPublicType t = { EbtVoid, EvqUniform, 1, false, false, 0 }; \r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 132:\r
-#line 1444 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtVoid, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 133:\r
-#line 1449 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtFloat, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 134:\r
-#line 1454 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtInt, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 135:\r
-#line 1459 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtBool, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 136:\r
-#line 1470 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtFloat, qual, 2, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 137:\r
-#line 1475 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtFloat, qual, 3, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 138:\r
-#line 1480 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtFloat, qual, 4, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 139:\r
-#line 1485 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtBool, qual, 2, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 140:\r
-#line 1490 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtBool, qual, 3, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 141:\r
-#line 1495 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtBool, qual, 4, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 142:\r
-#line 1500 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtInt, qual, 2, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 143:\r
-#line 1505 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtInt, qual, 3, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 144:\r
-#line 1510 "glslang.y"\r
-{\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtInt, qual, 4, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 145:\r
-#line 1515 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line); \r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtFloat, qual, 2, true, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 146:\r
-#line 1521 "glslang.y"\r
-{ \r
- FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line); \r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtFloat, qual, 3, true, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 147:\r
-#line 1527 "glslang.y"\r
-{ \r
- FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line);\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtFloat, qual, 4, true, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t; \r
- ;\r
- break;}\r
-case 148:\r
-#line 1533 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("sampler1D", yyvsp[0].lex.line);\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtSampler1D, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 149:\r
-#line 1539 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("sampler2D", yyvsp[0].lex.line);\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtSampler2D, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 150:\r
-#line 1545 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("sampler3D", yyvsp[0].lex.line);\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtSampler3D, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 151:\r
-#line 1551 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("samplerCube", yyvsp[0].lex.line);\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtSamplerCube, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 152:\r
-#line 1557 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("sampler1DShadow", yyvsp[0].lex.line);\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtSampler1DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 153:\r
-#line 1563 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("sampler2DShadow", yyvsp[0].lex.line);\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtSampler2DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line }; \r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 154:\r
-#line 1569 "glslang.y"\r
-{\r
- FRAG_VERT_ONLY("struct", yyvsp[0].interm.type.line);\r
- yyval.interm.type = yyvsp[0].interm.type;\r
- yyval.interm.type.qualifier = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- ;\r
- break;}\r
-case 155:\r
-#line 1574 "glslang.y"\r
-{ \r
- //\r
- // This is for user defined type names. The lexical phase looked up the \r
- // type.\r
- //\r
- TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();\r
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
- TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line }; \r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 156:\r
-#line 1587 "glslang.y"\r
-{\r
- TType* structure = new TType(yyvsp[-1].interm.typeList, *yyvsp[-3].lex.string);\r
- TVariable* userTypeDef = new TVariable(yyvsp[-3].lex.string, *structure, true);\r
- if (! parseContext.symbolTable.insert(*userTypeDef)) {\r
- parseContext.error(yyvsp[-3].lex.line, "redefinition", yyvsp[-3].lex.string->c_str(), "struct");\r
- parseContext.recover();\r
- }\r
- TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-4].lex.line };\r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 157:\r
-#line 1597 "glslang.y"\r
-{\r
- TType* structure = new TType(yyvsp[-1].interm.typeList, TString(""));\r
- TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-3].lex.line };\r
- yyval.interm.type = t;\r
- ;\r
- break;}\r
-case 158:\r
-#line 1605 "glslang.y"\r
-{\r
- yyval.interm.typeList = yyvsp[0].interm.typeList;\r
- ;\r
- break;}\r
-case 159:\r
-#line 1608 "glslang.y"\r
-{\r
- yyval.interm.typeList = yyvsp[-1].interm.typeList;\r
- for (unsigned int i = 0; i < yyvsp[0].interm.typeList->size(); ++i) {\r
- for (unsigned int j = 0; j < yyval.interm.typeList->size(); ++j) {\r
- if ((*yyval.interm.typeList)[j].type->getFieldName() == (*yyvsp[0].interm.typeList)[i].type->getFieldName()) {\r
- parseContext.error((*yyvsp[0].interm.typeList)[i].line, "duplicate field name in structure:", "struct", (*yyvsp[0].interm.typeList)[i].type->getFieldName().c_str());\r
- parseContext.recover();\r
- }\r
- }\r
- yyval.interm.typeList->push_back((*yyvsp[0].interm.typeList)[i]);\r
- }\r
- ;\r
- break;}\r
-case 160:\r
-#line 1623 "glslang.y"\r
-{\r
- yyval.interm.typeList = yyvsp[-1].interm.typeList;\r
- \r
- if (parseContext.voidErrorCheck(yyvsp[-2].interm.type.line, (*yyvsp[-1].interm.typeList)[0].type->getFieldName(), yyvsp[-2].interm.type)) {\r
- parseContext.recover();\r
- }\r
- for (unsigned int i = 0; i < yyval.interm.typeList->size(); ++i) {\r
- //\r
- // Careful not to replace already know aspects of type, like array-ness\r
- //\r
- (*yyval.interm.typeList)[i].type->setType(yyvsp[-2].interm.type.type, yyvsp[-2].interm.type.size, yyvsp[-2].interm.type.matrix, yyvsp[-2].interm.type.userDef);\r
- if (yyvsp[-2].interm.type.userDef)\r
- (*yyval.interm.typeList)[i].type->setTypeName(yyvsp[-2].interm.type.userDef->getTypeName());\r
- }\r
- ;\r
- break;}\r
-case 161:\r
-#line 1641 "glslang.y"\r
-{\r
- yyval.interm.typeList = NewPoolTTypeList();\r
- yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);\r
- ;\r
- break;}\r
-case 162:\r
-#line 1645 "glslang.y"\r
-{\r
- yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);\r
- ;\r
- break;}\r
-case 163:\r
-#line 1651 "glslang.y"\r
-{\r
- yyval.interm.typeLine.type = new TType(EbtVoid);\r
- yyval.interm.typeLine.line = yyvsp[0].lex.line;\r
- yyval.interm.typeLine.type->setFieldName(*yyvsp[0].lex.string);\r
- ;\r
- break;}\r
-case 164:\r
-#line 1656 "glslang.y"\r
-{\r
- yyval.interm.typeLine.type = new TType(EbtVoid);\r
- yyval.interm.typeLine.line = yyvsp[-3].lex.line;\r
- yyval.interm.typeLine.type->setFieldName(*yyvsp[-3].lex.string);\r
- \r
- if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion() == 0 || yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getBasicType() != EbtInt ||\r
- yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst <= 0) {\r
- parseContext.error(yyvsp[-2].lex.line, "structure field array size must be a positive integer", yyvsp[-3].lex.string->c_str(), "");\r
- parseContext.recover();\r
- } else { \r
- yyval.interm.typeLine.type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);\r
- }\r
- ;\r
- break;}\r
-case 165:\r
-#line 1672 "glslang.y"\r
-{ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;\r
- break;}\r
-case 166:\r
-#line 1676 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 167:\r
-#line 1680 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermAggregate; ;\r
- break;}\r
-case 168:\r
-#line 1681 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 169:\r
-#line 1687 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 170:\r
-#line 1688 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 171:\r
-#line 1689 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 172:\r
-#line 1690 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 173:\r
-#line 1691 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 174:\r
-#line 1695 "glslang.y"\r
-{ yyval.interm.intermAggregate = 0; ;\r
- break;}\r
-case 175:\r
-#line 1696 "glslang.y"\r
-{ parseContext.symbolTable.push(); ;\r
- break;}\r
-case 176:\r
-#line 1696 "glslang.y"\r
-{ parseContext.symbolTable.pop(); ;\r
- break;}\r
-case 177:\r
-#line 1696 "glslang.y"\r
-{\r
- if (yyvsp[-2].interm.intermAggregate != 0) \r
- yyvsp[-2].interm.intermAggregate->setOperator(EOpSequence); \r
- yyval.interm.intermAggregate = yyvsp[-2].interm.intermAggregate;\r
- ;\r
- break;}\r
-case 178:\r
-#line 1704 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 179:\r
-#line 1705 "glslang.y"\r
-{ yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;\r
- break;}\r
-case 180:\r
-#line 1710 "glslang.y"\r
-{ \r
- yyval.interm.intermNode = 0; \r
- ;\r
- break;}\r
-case 181:\r
-#line 1713 "glslang.y"\r
-{ \r
- if (yyvsp[-1].interm.intermAggregate)\r
- yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence); \r
- yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate; \r
- ;\r
- break;}\r
-case 182:\r
-#line 1721 "glslang.y"\r
-{\r
- yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(yyvsp[0].interm.intermNode, 0); \r
- ;\r
- break;}\r
-case 183:\r
-#line 1724 "glslang.y"\r
-{ \r
- yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);\r
- ;\r
- break;}\r
-case 184:\r
-#line 1730 "glslang.y"\r
-{ yyval.interm.intermNode = 0; ;\r
- break;}\r
-case 185:\r
-#line 1731 "glslang.y"\r
-{ yyval.interm.intermNode = static_cast<TIntermNode*>(yyvsp[-1].interm.intermTypedNode); ;\r
- break;}\r
-case 186:\r
-#line 1735 "glslang.y"\r
-{ \r
- if (parseContext.boolErrorCheck(yyvsp[-4].lex.line, yyvsp[-2].interm.intermTypedNode))\r
- parseContext.recover();\r
- yyval.interm.intermNode = parseContext.intermediate.addSelection(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.nodePair, yyvsp[-4].lex.line);\r
- ;\r
- break;}\r
-case 187:\r
-#line 1743 "glslang.y"\r
-{\r
- yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermNode;\r
- yyval.interm.nodePair.node2 = yyvsp[0].interm.intermNode;\r
- ;\r
- break;}\r
-case 188:\r
-#line 1747 "glslang.y"\r
-{ \r
- yyval.interm.nodePair.node1 = yyvsp[0].interm.intermNode;\r
- yyval.interm.nodePair.node2 = 0;\r
- ;\r
- break;}\r
-case 189:\r
-#line 1757 "glslang.y"\r
-{\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- if (parseContext.boolErrorCheck(yyvsp[0].interm.intermTypedNode->getLine(), yyvsp[0].interm.intermTypedNode))\r
- parseContext.recover(); \r
- ;\r
- break;}\r
-case 190:\r
-#line 1762 "glslang.y"\r
-{\r
- TIntermNode* intermNode;\r
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))\r
- parseContext.recover();\r
- if (parseContext.boolErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))\r
- parseContext.recover();\r
- \r
- if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode))\r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;\r
- else {\r
- parseContext.recover();\r
- yyval.interm.intermTypedNode = 0;\r
- }\r
- ;\r
- break;}\r
-case 191:\r
-#line 1779 "glslang.y"\r
-{ parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ;\r
- break;}\r
-case 192:\r
-#line 1779 "glslang.y"\r
-{ \r
- parseContext.symbolTable.pop();\r
- yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, true, yyvsp[-5].lex.line);\r
- --parseContext.loopNestingLevel;\r
- ;\r
- break;}\r
-case 193:\r
-#line 1784 "glslang.y"\r
-{ ++parseContext.loopNestingLevel; ;\r
- break;}\r
-case 194:\r
-#line 1784 "glslang.y"\r
-{\r
- if (parseContext.boolErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.intermTypedNode))\r
- parseContext.recover();\r
- \r
- yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[-5].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, false, yyvsp[-4].lex.line);\r
- --parseContext.loopNestingLevel;\r
- ;\r
- break;}\r
-case 195:\r
-#line 1791 "glslang.y"\r
-{ parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ;\r
- break;}\r
-case 196:\r
-#line 1791 "glslang.y"\r
-{\r
- parseContext.symbolTable.pop();\r
- yyval.interm.intermNode = parseContext.intermediate.makeAggregate(yyvsp[-3].interm.intermNode, yyvsp[-5].lex.line);\r
- yyval.interm.intermNode = parseContext.intermediate.growAggregate(\r
- yyval.interm.intermNode,\r
- parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node1), reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node2), true, yyvsp[-6].lex.line),\r
- yyvsp[-6].lex.line);\r
- yyval.interm.intermNode->getAsAggregate()->setOperator(EOpSequence);\r
- --parseContext.loopNestingLevel;\r
- ;\r
- break;}\r
-case 197:\r
-#line 1804 "glslang.y"\r
-{\r
- yyval.interm.intermNode = yyvsp[0].interm.intermNode; \r
- ;\r
- break;}\r
-case 198:\r
-#line 1807 "glslang.y"\r
-{\r
- yyval.interm.intermNode = yyvsp[0].interm.intermNode;\r
- ;\r
- break;}\r
-case 199:\r
-#line 1813 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; \r
- ;\r
- break;}\r
-case 200:\r
-#line 1816 "glslang.y"\r
-{ \r
- yyval.interm.intermTypedNode = 0; \r
- ;\r
- break;}\r
-case 201:\r
-#line 1822 "glslang.y"\r
-{ \r
- yyval.interm.nodePair.node1 = yyvsp[-1].interm.intermTypedNode;\r
- yyval.interm.nodePair.node2 = 0;\r
- ;\r
- break;}\r
-case 202:\r
-#line 1826 "glslang.y"\r
-{\r
- yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermTypedNode;\r
- yyval.interm.nodePair.node2 = yyvsp[0].interm.intermTypedNode;\r
- ;\r
- break;}\r
-case 203:\r
-#line 1833 "glslang.y"\r
-{\r
- if (parseContext.loopNestingLevel <= 0) {\r
- parseContext.error(yyvsp[-1].lex.line, "continue statement only allowed in loops", "", "");\r
- parseContext.recover();\r
- } \r
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpContinue, yyvsp[-1].lex.line);\r
- ;\r
- break;}\r
-case 204:\r
-#line 1840 "glslang.y"\r
-{\r
- if (parseContext.loopNestingLevel <= 0) {\r
- parseContext.error(yyvsp[-1].lex.line, "break statement only allowed in loops", "", "");\r
- parseContext.recover();\r
- } \r
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpBreak, yyvsp[-1].lex.line);\r
- ;\r
- break;}\r
-case 205:\r
-#line 1847 "glslang.y"\r
-{\r
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].lex.line);\r
- if (parseContext.currentFunctionType->getBasicType() != EbtVoid) {\r
- parseContext.error(yyvsp[-1].lex.line, "non-void function must return a value", "return", "");\r
- parseContext.recover();\r
- }\r
- ;\r
- break;}\r
-case 206:\r
-#line 1854 "glslang.y"\r
-{ \r
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);\r
- parseContext.functionReturnsValue = true;\r
- if (parseContext.currentFunctionType->getBasicType() == EbtVoid) {\r
- parseContext.error(yyvsp[-2].lex.line, "void function cannot return a value", "return", "");\r
- parseContext.recover();\r
- } else if (*(parseContext.currentFunctionType) != yyvsp[-1].interm.intermTypedNode->getType()) {\r
- parseContext.error(yyvsp[-2].lex.line, "function return is not matching type:", "return", "");\r
- parseContext.recover();\r
- }\r
- ;\r
- break;}\r
-case 207:\r
-#line 1865 "glslang.y"\r
-{\r
- FRAG_ONLY("discard", yyvsp[-1].lex.line);\r
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpKill, yyvsp[-1].lex.line);\r
- ;\r
- break;}\r
-case 208:\r
-#line 1874 "glslang.y"\r
-{ \r
- yyval.interm.intermNode = yyvsp[0].interm.intermNode; \r
- parseContext.treeRoot = yyval.interm.intermNode; \r
- ;\r
- break;}\r
-case 209:\r
-#line 1878 "glslang.y"\r
-{\r
- yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermNode, yyvsp[0].interm.intermNode, 0);\r
- parseContext.treeRoot = yyval.interm.intermNode;\r
- ;\r
- break;}\r
-case 210:\r
-#line 1885 "glslang.y"\r
-{ \r
- yyval.interm.intermNode = yyvsp[0].interm.intermNode; \r
- ;\r
- break;}\r
-case 211:\r
-#line 1888 "glslang.y"\r
-{ \r
- yyval.interm.intermNode = yyvsp[0].interm.intermNode; \r
- ;\r
- break;}\r
-case 212:\r
-#line 1894 "glslang.y"\r
-{\r
- TFunction& function = *(yyvsp[0].interm.function);\r
- TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(function.getMangledName()));\r
- //\r
- // Note: 'prevDec' could be 'function' if this is the first time we've seen function\r
- // as it would have just been put in the symbol table. Otherwise, we're looking up\r
- // an earlier occurance.\r
- //\r
- if (prevDec->isDefined()) {\r
- //\r
- // Then this function already has a body.\r
- //\r
- parseContext.error(yyvsp[0].interm.line, "function already has a body", function.getName().c_str(), "");\r
- parseContext.recover();\r
- }\r
- prevDec->setDefined();\r
- \r
- //\r
- // Raise error message if main function takes any parameters or return anything other than void\r
- //\r
- if (function.getName() == "main") {\r
- if (function.getParamCount() > 0) {\r
- parseContext.error(yyvsp[0].interm.line, "function cannot take any parameter(s)", function.getName().c_str(), "");\r
- parseContext.recover();\r
- }\r
- if (function.getReturnType().getBasicType() != EbtVoid) {\r
- parseContext.error(yyvsp[0].interm.line, "", function.getReturnType().getBasicString(), "main function cannot return a value" );\r
- parseContext.recover();\r
- } \r
- }\r
- \r
- //\r
- // New symbol table scope for body of function plus its arguments\r
- //\r
- parseContext.symbolTable.push();\r
- \r
- //\r
- // Remember the return type for later checking for RETURN statements.\r
- //\r
- parseContext.currentFunctionType = &(prevDec->getReturnType());\r
- parseContext.functionReturnsValue = false;\r
- \r
- // \r
- // Insert parameters into the symbol table.\r
- // If the parameter has no name, it's not an error, just don't insert it \r
- // (could be used for unused args).\r
- //\r
- // Also, accumulate the list of parameters into the HIL, so lower level code\r
- // knows where to find parameters.\r
- //\r
- TIntermAggregate* paramNodes = new TIntermAggregate;\r
- for (int i = 0; i < function.getParamCount(); i++) {\r
- TParameter& param = function[i];\r
- if (param.name != 0) {\r
- TVariable *variable = new TVariable(param.name, *param.type);\r
- // \r
- // Insert the parameters with name in the symbol table.\r
- //\r
- if (! parseContext.symbolTable.insert(*variable)) {\r
- parseContext.error(yyvsp[0].interm.line, "redefinition", variable->getName().c_str(), "");\r
- parseContext.recover();\r
- delete variable;\r
- }\r
- //\r
- // Transfer ownership of name pointer to symbol table.\r
- //\r
- param.name = 0;\r
- \r
- //\r
- // Add the parameter to the HIL\r
- // \r
- paramNodes = parseContext.intermediate.growAggregate(\r
- paramNodes, \r
- parseContext.intermediate.addSymbol(variable->getUniqueId(),\r
- variable->getName(),\r
- variable->getType(), yyvsp[0].interm.line), \r
- yyvsp[0].interm.line);\r
- } else {\r
- paramNodes = parseContext.intermediate.growAggregate(paramNodes, parseContext.intermediate.addSymbol(0, "", *param.type, yyvsp[0].interm.line), yyvsp[0].interm.line);\r
- }\r
- }\r
- parseContext.intermediate.setAggregateOperator(paramNodes, EOpParameters, yyvsp[0].interm.line);\r
- yyvsp[0].interm.intermAggregate = paramNodes;\r
- parseContext.loopNestingLevel = 0;\r
- ;\r
- break;}\r
-case 213:\r
-#line 1979 "glslang.y"\r
-{\r
- //?? Check that all paths return a value if return type != void ?\r
- // May be best done as post process phase on intermediate code\r
- if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) {\r
- parseContext.error(yyvsp[-2].interm.line, "function does not return a value:", "", yyvsp[-2].interm.function->getName().c_str());\r
- parseContext.recover();\r
- }\r
- parseContext.symbolTable.pop();\r
- yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);\r
- parseContext.intermediate.setAggregateOperator(yyval.interm.intermNode, EOpFunction, yyvsp[-2].interm.line);\r
- yyval.interm.intermNode->getAsAggregate()->setName(yyvsp[-2].interm.function->getMangledName().c_str());\r
- yyval.interm.intermNode->getAsAggregate()->setType(yyvsp[-2].interm.function->getReturnType());\r
- ;\r
- break;}\r
-}\r
- /* the action file gets copied in in place of this dollarsign */\r
- yyvsp -= yylen;\r
- yyssp -= yylen;\r
-#ifdef YYLSP_NEEDED\r
- yylsp -= yylen;\r
-#endif\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- {\r
- short *ssp1 = yyss - 1;\r
- fprintf (stderr, "state stack now");\r
- while (ssp1 != yyssp)\r
- fprintf (stderr, " %d", *++ssp1);\r
- fprintf (stderr, "\n");\r
- }\r
-#endif\r
-\r
- *++yyvsp = yyval;\r
-\r
-#ifdef YYLSP_NEEDED\r
- yylsp++;\r
- if (yylen == 0)\r
- {\r
- yylsp->first_line = yylloc.first_line;\r
- yylsp->first_column = yylloc.first_column;\r
- yylsp->last_line = (yylsp-1)->last_line;\r
- yylsp->last_column = (yylsp-1)->last_column;\r
- yylsp->text = 0;\r
- }\r
- else\r
- {\r
- yylsp->last_line = (yylsp+yylen-1)->last_line;\r
- yylsp->last_column = (yylsp+yylen-1)->last_column;\r
- }\r
-#endif\r
-\r
- /* Now "shift" the result of the reduction.\r
- Determine what state that goes to,\r
- based on the state we popped back to\r
- and the rule number reduced by. */\r
-\r
- yyn = yyr1[yyn];\r
-\r
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;\r
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)\r
- yystate = yytable[yystate];\r
- else\r
- yystate = yydefgoto[yyn - YYNTBASE];\r
-\r
- goto yynewstate;\r
-\r
-yyerrlab: /* here on detecting error */\r
-\r
- if (! yyerrstatus)\r
- /* If not already recovering from an error, report this error. */\r
- {\r
- ++yynerrs;\r
-\r
-#ifdef YYERROR_VERBOSE\r
- yyn = yypact[yystate];\r
-\r
- if (yyn > YYFLAG && yyn < YYLAST)\r
- {\r
- int size = 0;\r
- char *msg;\r
- int x, count;\r
-\r
- count = 0;\r
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */\r
- for (x = (yyn < 0 ? -yyn : 0);\r
- x < (sizeof(yytname) / sizeof(char *)); x++)\r
- if (yycheck[x + yyn] == x)\r
- size += strlen(yytname[x]) + 15, count++;\r
- msg = (char *) malloc(size + 15);\r
- if (msg != 0)\r
- {\r
- strcpy(msg, "parse error");\r
-\r
- if (count < 5)\r
- {\r
- count = 0;\r
- for (x = (yyn < 0 ? -yyn : 0);\r
- x < (sizeof(yytname) / sizeof(char *)); x++)\r
- if (yycheck[x + yyn] == x)\r
- {\r
- strcat(msg, count == 0 ? ", expecting `" : " or `");\r
- strcat(msg, yytname[x]);\r
- strcat(msg, "'");\r
- count++;\r
- }\r
- }\r
- yyerror(msg);\r
- free(msg);\r
- }\r
- else\r
- yyerror ("parse error; also virtual memory exceeded");\r
- }\r
- else\r
-#endif /* YYERROR_VERBOSE */\r
- yyerror("parse error");\r
- }\r
-\r
- goto yyerrlab1;\r
-yyerrlab1: /* here on error raised explicitly by an action */\r
-\r
- if (yyerrstatus == 3)\r
- {\r
- /* if just tried and failed to reuse lookahead token after an error, discard it. */\r
-\r
- /* return failure if at end of input */\r
- if (yychar == YYEOF)\r
- YYABORT;\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);\r
-#endif\r
-\r
- yychar = YYEMPTY;\r
- }\r
-\r
- /* Else will try to reuse lookahead token\r
- after shifting the error token. */\r
-\r
- yyerrstatus = 3; /* Each real token shifted decrements this */\r
-\r
- goto yyerrhandle;\r
-\r
-yyerrdefault: /* current state does not do anything special for the error token. */\r
-\r
-#if 0\r
- /* This is wrong; only states that explicitly want error tokens\r
- should shift them. */\r
- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/\r
- if (yyn) goto yydefault;\r
-#endif\r
-\r
-yyerrpop: /* pop the current state because it cannot handle the error token */\r
-\r
- if (yyssp == yyss) YYABORT;\r
- yyvsp--;\r
- yystate = *--yyssp;\r
-#ifdef YYLSP_NEEDED\r
- yylsp--;\r
-#endif\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- {\r
- short *ssp1 = yyss - 1;\r
- fprintf (stderr, "Error: state stack now");\r
- while (ssp1 != yyssp)\r
- fprintf (stderr, " %d", *++ssp1);\r
- fprintf (stderr, "\n");\r
- }\r
-#endif\r
-\r
-yyerrhandle:\r
-\r
- yyn = yypact[yystate];\r
- if (yyn == YYFLAG)\r
- goto yyerrdefault;\r
-\r
- yyn += YYTERROR;\r
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)\r
- goto yyerrdefault;\r
-\r
- yyn = yytable[yyn];\r
- if (yyn < 0)\r
- {\r
- if (yyn == YYFLAG)\r
- goto yyerrpop;\r
- yyn = -yyn;\r
- goto yyreduce;\r
- }\r
- else if (yyn == 0)\r
- goto yyerrpop;\r
-\r
- if (yyn == YYFINAL)\r
- YYACCEPT;\r
-\r
-#if YYDEBUG != 0\r
- if (yydebug)\r
- fprintf(stderr, "Shifting error token, ");\r
-#endif\r
-\r
- *++yyvsp = yylval;\r
-#ifdef YYLSP_NEEDED\r
- *++yylsp = yylloc;\r
-#endif\r
-\r
- yystate = yyn;\r
- goto yynewstate;\r
-}\r
-#line 1994 "glslang.y"\r
-\r
+/* A Bison parser, made by GNU Bison 1.875. */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 1
+
+/* Using locations. */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ ATTRIBUTE = 258,
+ CONST_QUAL = 259,
+ BOOL_TYPE = 260,
+ FLOAT_TYPE = 261,
+ INT_TYPE = 262,
+ BREAK = 263,
+ CONTINUE = 264,
+ DO = 265,
+ ELSE = 266,
+ FOR = 267,
+ IF = 268,
+ DISCARD = 269,
+ RETURN = 270,
+ BVEC2 = 271,
+ BVEC3 = 272,
+ BVEC4 = 273,
+ IVEC2 = 274,
+ IVEC3 = 275,
+ IVEC4 = 276,
+ VEC2 = 277,
+ VEC3 = 278,
+ VEC4 = 279,
+ MATRIX2 = 280,
+ MATRIX3 = 281,
+ MATRIX4 = 282,
+ IN_QUAL = 283,
+ OUT_QUAL = 284,
+ INOUT_QUAL = 285,
+ UNIFORM = 286,
+ VARYING = 287,
+ STRUCT = 288,
+ VOID_TYPE = 289,
+ WHILE = 290,
+ SAMPLER1D = 291,
+ SAMPLER2D = 292,
+ SAMPLER3D = 293,
+ SAMPLERCUBE = 294,
+ SAMPLER1DSHADOW = 295,
+ SAMPLER2DSHADOW = 296,
+ IDENTIFIER = 297,
+ TYPE_NAME = 298,
+ FLOATCONSTANT = 299,
+ INTCONSTANT = 300,
+ BOOLCONSTANT = 301,
+ FIELD_SELECTION = 302,
+ LEFT_OP = 303,
+ RIGHT_OP = 304,
+ INC_OP = 305,
+ DEC_OP = 306,
+ LE_OP = 307,
+ GE_OP = 308,
+ EQ_OP = 309,
+ NE_OP = 310,
+ AND_OP = 311,
+ OR_OP = 312,
+ XOR_OP = 313,
+ MUL_ASSIGN = 314,
+ DIV_ASSIGN = 315,
+ ADD_ASSIGN = 316,
+ MOD_ASSIGN = 317,
+ LEFT_ASSIGN = 318,
+ RIGHT_ASSIGN = 319,
+ AND_ASSIGN = 320,
+ XOR_ASSIGN = 321,
+ OR_ASSIGN = 322,
+ SUB_ASSIGN = 323,
+ LEFT_PAREN = 324,
+ RIGHT_PAREN = 325,
+ LEFT_BRACKET = 326,
+ RIGHT_BRACKET = 327,
+ LEFT_BRACE = 328,
+ RIGHT_BRACE = 329,
+ DOT = 330,
+ COMMA = 331,
+ COLON = 332,
+ EQUAL = 333,
+ SEMICOLON = 334,
+ BANG = 335,
+ DASH = 336,
+ TILDE = 337,
+ PLUS = 338,
+ STAR = 339,
+ SLASH = 340,
+ PERCENT = 341,
+ LEFT_ANGLE = 342,
+ RIGHT_ANGLE = 343,
+ VERTICAL_BAR = 344,
+ CARET = 345,
+ AMPERSAND = 346,
+ QUESTION = 347
+ };
+#endif
+#define ATTRIBUTE 258
+#define CONST_QUAL 259
+#define BOOL_TYPE 260
+#define FLOAT_TYPE 261
+#define INT_TYPE 262
+#define BREAK 263
+#define CONTINUE 264
+#define DO 265
+#define ELSE 266
+#define FOR 267
+#define IF 268
+#define DISCARD 269
+#define RETURN 270
+#define BVEC2 271
+#define BVEC3 272
+#define BVEC4 273
+#define IVEC2 274
+#define IVEC3 275
+#define IVEC4 276
+#define VEC2 277
+#define VEC3 278
+#define VEC4 279
+#define MATRIX2 280
+#define MATRIX3 281
+#define MATRIX4 282
+#define IN_QUAL 283
+#define OUT_QUAL 284
+#define INOUT_QUAL 285
+#define UNIFORM 286
+#define VARYING 287
+#define STRUCT 288
+#define VOID_TYPE 289
+#define WHILE 290
+#define SAMPLER1D 291
+#define SAMPLER2D 292
+#define SAMPLER3D 293
+#define SAMPLERCUBE 294
+#define SAMPLER1DSHADOW 295
+#define SAMPLER2DSHADOW 296
+#define IDENTIFIER 297
+#define TYPE_NAME 298
+#define FLOATCONSTANT 299
+#define INTCONSTANT 300
+#define BOOLCONSTANT 301
+#define FIELD_SELECTION 302
+#define LEFT_OP 303
+#define RIGHT_OP 304
+#define INC_OP 305
+#define DEC_OP 306
+#define LE_OP 307
+#define GE_OP 308
+#define EQ_OP 309
+#define NE_OP 310
+#define AND_OP 311
+#define OR_OP 312
+#define XOR_OP 313
+#define MUL_ASSIGN 314
+#define DIV_ASSIGN 315
+#define ADD_ASSIGN 316
+#define MOD_ASSIGN 317
+#define LEFT_ASSIGN 318
+#define RIGHT_ASSIGN 319
+#define AND_ASSIGN 320
+#define XOR_ASSIGN 321
+#define OR_ASSIGN 322
+#define SUB_ASSIGN 323
+#define LEFT_PAREN 324
+#define RIGHT_PAREN 325
+#define LEFT_BRACKET 326
+#define RIGHT_BRACKET 327
+#define LEFT_BRACE 328
+#define RIGHT_BRACE 329
+#define DOT 330
+#define COMMA 331
+#define COLON 332
+#define EQUAL 333
+#define SEMICOLON 334
+#define BANG 335
+#define DASH 336
+#define TILDE 337
+#define PLUS 338
+#define STAR 339
+#define SLASH 340
+#define PERCENT 341
+#define LEFT_ANGLE 342
+#define RIGHT_ANGLE 343
+#define VERTICAL_BAR 344
+#define CARET 345
+#define AMPERSAND 346
+#define QUESTION 347
+
+
+
+
+/* Copy the first part of user declarations. */
+#line 39 "glslang.y"
+
+
+/* Based on:
+ANSI C Yacc grammar
+
+In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
+matching Lex specification) for the April 30, 1985 draft version of the
+ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that
+original, as mentioned in the answer to question 17.25 of the comp.lang.c
+FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
+
+I intend to keep this version as close to the current C Standard grammar as
+possible; please let me know if you discover discrepancies.
+
+Jutta Degener, 1995
+*/
+
+#include "SymbolTable.h"
+#include "ParseHelper.h"
+#include "../Public/ShaderLang.h"
+
+#ifdef _WIN32
+ #define YYPARSE_PARAM parseContext
+ #define YYPARSE_PARAM_DECL TParseContext&
+ #define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext)
+ #define YYLEX_PARAM parseContext
+#else
+ #define YYPARSE_PARAM parseContextLocal
+ #define parseContext (*((TParseContext*)(parseContextLocal)))
+ #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
+ #define YYLEX_PARAM (void*)(parseContextLocal)
+ extern void yyerror(char*);
+#endif
+
+#define FRAG_VERT_ONLY(S, L) { \
+ if (parseContext.language != EShLangFragment && \
+ parseContext.language != EShLangVertex) { \
+ parseContext.error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
+ parseContext.recover(); \
+ } \
+}
+
+#define VERTEX_ONLY(S, L) { \
+ if (parseContext.language != EShLangVertex) { \
+ parseContext.error(L, " supported in vertex shaders only ", S, "", ""); \
+ parseContext.recover(); \
+ } \
+}
+
+#define FRAG_ONLY(S, L) { \
+ if (parseContext.language != EShLangFragment) { \
+ parseContext.error(L, " supported in fragment shaders only ", S, "", ""); \
+ parseContext.recover(); \
+ } \
+}
+
+#define PACK_ONLY(S, L) { \
+ if (parseContext.language != EShLangPack) { \
+ parseContext.error(L, " supported in pack shaders only ", S, "", ""); \
+ parseContext.recover(); \
+ } \
+}
+
+#define UNPACK_ONLY(S, L) { \
+ if (parseContext.language != EShLangUnpack) { \
+ parseContext.error(L, " supported in unpack shaders only ", S, "", ""); \
+ parseContext.recover(); \
+ } \
+}
+
+#define PACK_UNPACK_ONLY(S, L) { \
+ if (parseContext.language != EShLangUnpack && \
+ parseContext.language != EShLangPack) { \
+ parseContext.error(L, " supported in pack/unpack shaders only ", S, "", ""); \
+ parseContext.recover(); \
+ } \
+}
+
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#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 117 "glslang.y"
+typedef union YYSTYPE {
+ struct {
+ TSourceLoc line;
+ union {
+ TString *string;
+ float f;
+ int i;
+ bool b;
+ };
+ TSymbol* symbol;
+ } lex;
+ struct {
+ TSourceLoc line;
+ TOperator op;
+ union {
+ TIntermNode* intermNode;
+ TIntermNodePair nodePair;
+ TIntermTyped* intermTypedNode;
+ TIntermAggregate* intermAggregate;
+ };
+ union {
+ TPublicType type;
+ TQualifier qualifier;
+ TFunction* function;
+ TParameter param;
+ TTypeLine typeLine;
+ TTypeList* typeList;
+ };
+ } interm;
+} YYSTYPE;
+/* Line 191 of yacc.c. */
+#line 369 "glslang.tab.c"
+# 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 148 "glslang.y"
+
+#ifndef _WIN32
+ extern int yylex(YYSTYPE*, void*);
+#endif
+
+
+/* Line 214 of yacc.c. */
+#line 386 "glslang.tab.c"
+
+#if ! defined (yyoverflow) || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# if YYSTACK_USE_ALLOCA
+# define YYSTACK_ALLOC alloca
+# else
+# ifndef YYSTACK_USE_ALLOCA
+# if defined (alloca) || defined (_ALLOCA_H)
+# define YYSTACK_ALLOC alloca
+# else
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# endif
+# 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 malloc
+# define YYSTACK_FREE free
+# endif
+#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
+
+
+#if (! defined (yyoverflow) \
+ && (! defined (__cplusplus) \
+ || (YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ short 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) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if 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 yysigned_char;
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 59
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 1231
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 93
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 75
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 214
+/* YYNRULES -- Number of states. */
+#define YYNSTATES 331
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 347
+
+#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
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const unsigned short yyprhs[] =
+{
+ 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
+ 24, 26, 30, 33, 36, 38, 40, 43, 46, 49,
+ 51, 54, 58, 61, 63, 65, 67, 69, 71, 73,
+ 75, 77, 79, 81, 83, 85, 87, 89, 91, 93,
+ 95, 97, 99, 102, 105, 108, 110, 112, 114, 116,
+ 118, 122, 126, 130, 132, 136, 140, 142, 146, 150,
+ 152, 156, 160, 164, 168, 170, 174, 178, 180, 184,
+ 186, 190, 192, 196, 198, 202, 204, 208, 210, 214,
+ 216, 222, 224, 228, 230, 232, 234, 236, 238, 240,
+ 242, 244, 246, 248, 250, 252, 256, 258, 261, 264,
+ 267, 269, 271, 274, 278, 282, 285, 291, 295, 298,
+ 302, 305, 306, 308, 310, 312, 314, 319, 321, 325,
+ 331, 338, 344, 346, 349, 354, 360, 365, 367, 370,
+ 372, 374, 376, 378, 380, 382, 384, 386, 388, 390,
+ 392, 394, 396, 398, 400, 402, 404, 406, 408, 410,
+ 412, 414, 416, 418, 420, 422, 424, 426, 432, 437,
+ 439, 442, 446, 448, 452, 454, 459, 461, 463, 465,
+ 467, 469, 471, 473, 475, 477, 480, 481, 482, 488,
+ 490, 492, 495, 499, 501, 504, 506, 509, 515, 519,
+ 521, 523, 528, 529, 536, 537, 546, 547, 555, 557,
+ 559, 561, 562, 565, 569, 572, 575, 578, 582, 585,
+ 587, 590, 592, 594, 595
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const short yyrhs[] =
+{
+ 164, 0, -1, 42, -1, 94, -1, 45, -1, 44,
+ -1, 46, -1, 69, 121, 70, -1, 95, -1, 96,
+ 71, 97, 72, -1, 98, -1, 96, 75, 47, -1,
+ 96, 50, -1, 96, 51, -1, 121, -1, 99, -1,
+ 101, 70, -1, 100, 70, -1, 102, 34, -1, 102,
+ -1, 102, 119, -1, 101, 76, 119, -1, 103, 69,
+ -1, 104, -1, 42, -1, 6, -1, 7, -1, 5,
+ -1, 22, -1, 23, -1, 24, -1, 16, -1, 17,
+ -1, 18, -1, 19, -1, 20, -1, 21, -1, 25,
+ -1, 26, -1, 27, -1, 43, -1, 96, -1, 50,
+ 105, -1, 51, 105, -1, 106, 105, -1, 83, -1,
+ 81, -1, 80, -1, 82, -1, 105, -1, 107, 84,
+ 105, -1, 107, 85, 105, -1, 107, 86, 105, -1,
+ 107, -1, 108, 83, 107, -1, 108, 81, 107, -1,
+ 108, -1, 109, 48, 108, -1, 109, 49, 108, -1,
+ 109, -1, 110, 87, 109, -1, 110, 88, 109, -1,
+ 110, 52, 109, -1, 110, 53, 109, -1, 110, -1,
+ 111, 54, 110, -1, 111, 55, 110, -1, 111, -1,
+ 112, 91, 111, -1, 112, -1, 113, 90, 112, -1,
+ 113, -1, 114, 89, 113, -1, 114, -1, 115, 56,
+ 114, -1, 115, -1, 116, 58, 115, -1, 116, -1,
+ 117, 57, 116, -1, 117, -1, 117, 92, 121, 77,
+ 119, -1, 118, -1, 105, 120, 119, -1, 78, -1,
+ 59, -1, 60, -1, 62, -1, 61, -1, 68, -1,
+ 63, -1, 64, -1, 65, -1, 66, -1, 67, -1,
+ 119, -1, 121, 76, 119, -1, 118, -1, 124, 79,
+ -1, 132, 79, -1, 125, 70, -1, 127, -1, 126,
+ -1, 127, 129, -1, 126, 76, 129, -1, 134, 42,
+ 69, -1, 136, 42, -1, 136, 42, 71, 122, 72,
+ -1, 135, 130, 128, -1, 130, 128, -1, 135, 130,
+ 131, -1, 130, 131, -1, -1, 28, -1, 29, -1,
+ 30, -1, 136, -1, 136, 71, 122, 72, -1, 133,
+ -1, 132, 76, 42, -1, 132, 76, 42, 71, 72,
+ -1, 132, 76, 42, 71, 122, 72, -1, 132, 76,
+ 42, 78, 142, -1, 134, -1, 134, 42, -1, 134,
+ 42, 71, 72, -1, 134, 42, 71, 122, 72, -1,
+ 134, 42, 78, 142, -1, 136, -1, 135, 136, -1,
+ 4, -1, 3, -1, 32, -1, 31, -1, 34, -1,
+ 6, -1, 7, -1, 5, -1, 22, -1, 23, -1,
+ 24, -1, 16, -1, 17, -1, 18, -1, 19, -1,
+ 20, -1, 21, -1, 25, -1, 26, -1, 27, -1,
+ 36, -1, 37, -1, 38, -1, 39, -1, 40, -1,
+ 41, -1, 137, -1, 43, -1, 33, 42, 73, 138,
+ 74, -1, 33, 73, 138, 74, -1, 139, -1, 138,
+ 139, -1, 136, 140, 79, -1, 141, -1, 140, 76,
+ 141, -1, 42, -1, 42, 71, 122, 72, -1, 119,
+ -1, 123, -1, 146, -1, 145, -1, 143, -1, 152,
+ -1, 153, -1, 156, -1, 163, -1, 73, 74, -1,
+ -1, -1, 73, 147, 151, 148, 74, -1, 150, -1,
+ 145, -1, 73, 74, -1, 73, 151, 74, -1, 144,
+ -1, 151, 144, -1, 79, -1, 121, 79, -1, 13,
+ 69, 121, 70, 154, -1, 144, 11, 144, -1, 144,
+ -1, 121, -1, 134, 42, 78, 142, -1, -1, 35,
+ 69, 157, 155, 70, 149, -1, -1, 10, 158, 144,
+ 35, 69, 121, 70, 79, -1, -1, 12, 69, 159,
+ 160, 162, 70, 149, -1, 152, -1, 143, -1, 155,
+ -1, -1, 161, 79, -1, 161, 79, 121, -1, 9,
+ 79, -1, 8, 79, -1, 15, 79, -1, 15, 121,
+ 79, -1, 14, 79, -1, 165, -1, 164, 165, -1,
+ 166, -1, 123, -1, -1, 124, 167, 150, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const unsigned short yyrline[] =
+{
+ 0, 210, 210, 245, 248, 261, 266, 271, 277, 280,
+ 348, 351, 460, 470, 483, 491, 586, 590, 597, 601,
+ 608, 614, 623, 629, 640, 656, 657, 658, 659, 660,
+ 661, 662, 663, 664, 665, 666, 667, 668, 669, 670,
+ 671, 682, 685, 695, 705, 727, 728, 729, 730, 736,
+ 737, 746, 755, 767, 768, 776, 787, 788, 797, 809,
+ 810, 820, 830, 840, 853, 854, 864, 877, 878, 890,
+ 891, 903, 904, 916, 917, 930, 931, 944, 945, 958,
+ 959, 976, 977, 990, 991, 992, 993, 994, 995, 996,
+ 997, 998, 999, 1000, 1004, 1007, 1018, 1026, 1027, 1035,
+ 1071, 1074, 1081, 1089, 1110, 1129, 1140, 1167, 1172, 1182,
+ 1187, 1197, 1200, 1203, 1206, 1212, 1217, 1235, 1238, 1246,
+ 1254, 1262, 1284, 1288, 1297, 1306, 1315, 1405, 1408, 1425,
+ 1429, 1436, 1444, 1453, 1458, 1463, 1468, 1479, 1484, 1489,
+ 1494, 1499, 1504, 1509, 1514, 1519, 1524, 1530, 1536, 1542,
+ 1548, 1554, 1560, 1566, 1572, 1578, 1583, 1596, 1606, 1614,
+ 1617, 1632, 1650, 1654, 1660, 1665, 1681, 1685, 1689, 1690,
+ 1696, 1697, 1698, 1699, 1700, 1704, 1705, 1705, 1705, 1713,
+ 1714, 1719, 1722, 1730, 1733, 1739, 1740, 1744, 1752, 1756,
+ 1766, 1771, 1788, 1788, 1793, 1793, 1800, 1800, 1813, 1816,
+ 1822, 1825, 1831, 1835, 1842, 1849, 1856, 1863, 1874, 1883,
+ 1887, 1894, 1897, 1903, 1903
+};
+#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", "ATTRIBUTE", "CONST_QUAL", "BOOL_TYPE",
+ "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE", "DO", "ELSE", "FOR",
+ "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
+ "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2", "MATRIX3", "MATRIX4",
+ "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM", "VARYING", "STRUCT",
+ "VOID_TYPE", "WHILE", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D",
+ "SAMPLERCUBE", "SAMPLER1DSHADOW", "SAMPLER2DSHADOW", "IDENTIFIER",
+ "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT",
+ "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP",
+ "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN",
+ "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN",
+ "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN",
+ "RIGHT_PAREN", "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE",
+ "RIGHT_BRACE", "DOT", "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG",
+ "DASH", "TILDE", "PLUS", "STAR", "SLASH", "PERCENT", "LEFT_ANGLE",
+ "RIGHT_ANGLE", "VERTICAL_BAR", "CARET", "AMPERSAND", "QUESTION",
+ "$accept", "variable_identifier", "primary_expression",
+ "postfix_expression", "integer_expression", "function_call",
+ "function_call_generic", "function_call_header_no_parameters",
+ "function_call_header_with_parameters", "function_call_header",
+ "function_identifier", "constructor_identifier", "unary_expression",
+ "unary_operator", "multiplicative_expression", "additive_expression",
+ "shift_expression", "relational_expression", "equality_expression",
+ "and_expression", "exclusive_or_expression", "inclusive_or_expression",
+ "logical_and_expression", "logical_xor_expression",
+ "logical_or_expression", "conditional_expression",
+ "assignment_expression", "assignment_operator", "expression",
+ "constant_expression", "declaration", "function_prototype",
+ "function_declarator", "function_header_with_parameters",
+ "function_header", "parameter_declarator", "parameter_declaration",
+ "parameter_qualifier", "parameter_type_specifier",
+ "init_declarator_list", "single_declaration", "fully_specified_type",
+ "type_qualifier", "type_specifier", "struct_specifier",
+ "struct_declaration_list", "struct_declaration",
+ "struct_declarator_list", "struct_declarator", "initializer",
+ "declaration_statement", "statement", "simple_statement",
+ "compound_statement", "@1", "@2", "statement_no_new_scope",
+ "compound_statement_no_new_scope", "statement_list",
+ "expression_statement", "selection_statement",
+ "selection_rest_statement", "condition", "iteration_statement", "@3",
+ "@4", "@5", "for_init_statement", "conditionopt", "for_rest_statement",
+ "jump_statement", "translation_unit", "external_declaration",
+ "function_definition", "@6", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
+static const unsigned short 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
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const unsigned char yyr1[] =
+{
+ 0, 93, 94, 95, 95, 95, 95, 95, 96, 96,
+ 96, 96, 96, 96, 97, 98, 99, 99, 100, 100,
+ 101, 101, 102, 103, 103, 104, 104, 104, 104, 104,
+ 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
+ 104, 105, 105, 105, 105, 106, 106, 106, 106, 107,
+ 107, 107, 107, 108, 108, 108, 109, 109, 109, 110,
+ 110, 110, 110, 110, 111, 111, 111, 112, 112, 113,
+ 113, 114, 114, 115, 115, 116, 116, 117, 117, 118,
+ 118, 119, 119, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 121, 121, 122, 123, 123, 124,
+ 125, 125, 126, 126, 127, 128, 128, 129, 129, 129,
+ 129, 130, 130, 130, 130, 131, 131, 132, 132, 132,
+ 132, 132, 133, 133, 133, 133, 133, 134, 134, 135,
+ 135, 135, 135, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 137, 137, 138,
+ 138, 139, 140, 140, 141, 141, 142, 143, 144, 144,
+ 145, 145, 145, 145, 145, 146, 147, 148, 146, 149,
+ 149, 150, 150, 151, 151, 152, 152, 153, 154, 154,
+ 155, 155, 157, 156, 158, 156, 159, 156, 160, 160,
+ 161, 161, 162, 162, 163, 163, 163, 163, 163, 164,
+ 164, 165, 165, 167, 166
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const unsigned char yyr2[] =
+{
+ 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
+ 1, 3, 2, 2, 1, 1, 2, 2, 2, 1,
+ 2, 3, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 2, 2, 2, 1, 1, 1, 1, 1,
+ 3, 3, 3, 1, 3, 3, 1, 3, 3, 1,
+ 3, 3, 3, 3, 1, 3, 3, 1, 3, 1,
+ 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
+ 5, 1, 3, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 3, 1, 2, 2, 2,
+ 1, 1, 2, 3, 3, 2, 5, 3, 2, 3,
+ 2, 0, 1, 1, 1, 1, 4, 1, 3, 5,
+ 6, 5, 1, 2, 4, 5, 4, 1, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 5, 4, 1,
+ 2, 3, 1, 3, 1, 4, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 0, 0, 5, 1,
+ 1, 2, 3, 1, 2, 1, 2, 5, 3, 1,
+ 1, 4, 0, 6, 0, 8, 0, 7, 1, 1,
+ 1, 0, 2, 3, 2, 2, 2, 3, 2, 1,
+ 2, 1, 1, 0, 3
+};
+
+/* 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[] =
+{
+ 0, 130, 129, 136, 134, 135, 140, 141, 142, 143,
+ 144, 145, 137, 138, 139, 146, 147, 148, 132, 131,
+ 0, 133, 149, 150, 151, 152, 153, 154, 156, 212,
+ 213, 0, 101, 111, 0, 117, 122, 0, 127, 155,
+ 0, 209, 211, 0, 0, 97, 0, 99, 111, 112,
+ 113, 114, 102, 0, 111, 0, 98, 123, 128, 1,
+ 210, 0, 0, 0, 159, 0, 214, 103, 108, 110,
+ 115, 0, 118, 104, 0, 0, 0, 164, 0, 162,
+ 158, 160, 136, 134, 135, 0, 0, 194, 0, 0,
+ 0, 0, 140, 141, 142, 143, 144, 145, 137, 138,
+ 139, 146, 147, 148, 0, 2, 156, 5, 4, 6,
+ 0, 0, 0, 176, 181, 185, 47, 46, 48, 45,
+ 3, 8, 41, 10, 15, 0, 0, 19, 0, 23,
+ 49, 0, 53, 56, 59, 64, 67, 69, 71, 73,
+ 75, 77, 79, 81, 94, 0, 167, 0, 170, 183,
+ 169, 168, 0, 171, 172, 173, 174, 105, 0, 107,
+ 109, 0, 0, 27, 25, 26, 31, 32, 33, 34,
+ 35, 36, 28, 29, 30, 37, 38, 39, 40, 124,
+ 49, 96, 0, 166, 126, 157, 0, 0, 161, 205,
+ 204, 0, 196, 0, 208, 206, 0, 192, 42, 43,
+ 0, 175, 0, 12, 13, 0, 0, 17, 16, 0,
+ 18, 20, 22, 84, 85, 87, 86, 89, 90, 91,
+ 92, 93, 88, 83, 0, 44, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 186, 182, 184,
+ 0, 0, 119, 0, 121, 125, 0, 163, 0, 0,
+ 0, 207, 0, 7, 177, 0, 14, 11, 21, 82,
+ 50, 51, 52, 55, 54, 57, 58, 62, 63, 60,
+ 61, 65, 66, 68, 70, 72, 74, 76, 78, 0,
+ 95, 0, 116, 120, 165, 0, 199, 198, 201, 0,
+ 190, 0, 0, 0, 9, 0, 106, 0, 200, 0,
+ 0, 189, 187, 0, 0, 178, 80, 0, 202, 0,
+ 0, 0, 180, 193, 179, 0, 203, 197, 188, 191,
+ 195
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const short yydefgoto[] =
+{
+ -1, 120, 121, 122, 265, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
+ 138, 139, 140, 141, 142, 143, 144, 224, 145, 182,
+ 146, 147, 31, 32, 33, 68, 52, 53, 69, 34,
+ 35, 36, 37, 38, 39, 63, 64, 78, 79, 184,
+ 148, 149, 150, 151, 202, 303, 323, 324, 152, 153,
+ 154, 312, 302, 155, 262, 191, 259, 298, 309, 310,
+ 156, 40, 41, 42, 46
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -297
+static const short yypact[] =
+{
+ 1149, -297, -297, -297, -297, -297, -297, -297, -297, -297,
+ -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
+ -27, -297, -297, -297, -297, -297, -297, -297, -297, -297,
+ -42, -28, -32, 4, 18, -297, 19, 1188, -297, -297,
+ 1108, -297, -297, -10, 1188, -297, -3, -297, 36, -297,
+ -297, -297, -297, 1188, 83, 33, -297, -9, -297, -297,
+ -297, 1188, 39, 1025, -297, 235, -297, -297, -297, -297,
+ -18, 1188, -52, -297, 685, 957, 1064, -17, 20, -297,
+ -297, -297, 29, 45, 63, 21, 23, -297, 75, 77,
+ 66, 753, 78, 79, 81, 82, 84, 85, 87, 89,
+ 90, 91, 93, 94, 95, 96, 97, -297, -297, -297,
+ 957, 957, 957, 120, -297, -297, -297, -297, -297, -297,
+ -297, -297, 5, -297, -297, 98, 1, 821, 100, -297,
+ 57, 957, 42, -56, 37, -40, 76, 61, 80, 106,
+ 111, 138, -41, -297, -297, 30, -297, -42, -297, -297,
+ -297, -297, 316, -297, -297, -297, -297, 127, 957, -297,
+ -297, 889, 957, -297, -297, -297, -297, -297, -297, -297,
+ -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
+ -297, -297, 128, -297, -297, -297, 957, 39, -297, -297,
+ -297, 397, -297, 957, -297, -297, 31, -297, -297, -297,
+ 3, -297, 397, -297, -297, 957, 152, -297, -297, 957,
+ -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
+ -297, -297, -297, -297, 957, -297, 957, 957, 957, 957,
+ 957, 957, 957, 957, 957, 957, 957, 957, 957, 957,
+ 957, 957, 957, 957, 957, 957, 957, -297, -297, -297,
+ 957, 129, -297, 130, -297, -297, 131, -297, 169, 549,
+ 12, -297, 617, -297, 397, 133, 134, -297, -297, -297,
+ -297, -297, -297, 42, 42, -56, -56, 37, 37, 37,
+ 37, -40, -40, 76, 61, 80, 106, 111, 138, 60,
+ -297, 135, -297, -297, -297, 137, -297, -297, 617, 397,
+ 134, 167, 141, 140, -297, 957, -297, 957, -297, 136,
+ 142, 205, -297, 143, 478, -297, -297, 13, 957, 478,
+ 397, 957, -297, -297, -297, 139, 134, -297, -297, -297,
+ -297
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const short yypgoto[] =
+{
+ -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
+ -297, -297, -53, -297, -91, -89, -143, -97, -20, -16,
+ -21, -15, -14, -22, -297, -57, -75, -297, -90, -155,
+ 9, 10, -297, -297, -297, 154, 175, 172, 160, -297,
+ -297, -257, -19, -33, -297, 171, -4, -297, 46, -160,
+ -25, -107, -296, -297, -297, -297, -84, 190, 35, 6,
+ -297, -297, -35, -297, -297, -297, -297, -297, -297, -297,
+ -297, -297, 224, -297, -297
+};
+
+/* 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 -101
+static const short yytable[] =
+{
+ 183, 196, 254, 251, 58, 301, 253, 1, 2, 29,
+ 30, 62, 233, 234, 54, 43, 244, 181, 322, 161,
+ 70, 180, 200, 322, 157, 229, 162, 230, 62, 54,
+ 62, 256, 49, 50, 51, 18, 19, 45, 70, 1,
+ 2, 301, 47, 62, 48, 249, 44, 235, 236, 29,
+ 30, 245, 211, 158, 186, 203, 204, 198, 199, 81,
+ 73, 57, 74, 61, 49, 50, 51, 18, 19, 75,
+ 65, 208, 81, 263, -100, 72, 205, 209, 225, 246,
+ 206, 77, 299, 325, 258, 231, 232, 183, 246, 246,
+ 277, 278, 279, 280, 55, 291, 187, 56, -27, 188,
+ 189, 181, 190, 260, 181, 180, 246, 246, 180, 247,
+ 261, 49, 50, 51, -25, 266, 213, 214, 215, 216,
+ 217, 218, 219, 220, 221, 222, 226, 227, 228, 181,
+ 237, 238, -26, 180, 268, 223, 246, 305, 273, 274,
+ 281, 282, 275, 276, 192, 194, 193, -31, -32, 269,
+ -33, -34, 239, -35, -36, 289, -28, 249, -29, -30,
+ -37, 329, -38, -39, 197, -24, -40, 242, 207, 212,
+ 240, 290, 300, 270, 271, 272, 180, 180, 180, 180,
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+ 180, 180, 311, 181, 201, 241, 243, 180, 250, 267,
+ 255, 292, 293, 294, 295, 304, 307, 306, 300, 313,
+ 246, 314, 319, 328, 315, 318, 320, 317, 330, 283,
+ 285, 321, 288, 67, 284, 159, 71, 286, 326, 287,
+ 316, 160, 76, 257, 296, 327, 66, 264, 1, 2,
+ 82, 83, 84, 85, 86, 87, 183, 88, 89, 90,
+ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
+ 101, 102, 103, 308, 60, 297, 18, 19, 20, 21,
+ 104, 22, 23, 24, 25, 26, 27, 105, 106, 107,
+ 108, 109, 0, 0, 0, 110, 111, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 112, 0, 0, 0, 113, 114,
+ 0, 0, 0, 0, 115, 116, 117, 118, 119, 1,
+ 2, 82, 83, 84, 85, 86, 87, 0, 88, 89,
+ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ 100, 101, 102, 103, 0, 0, 0, 18, 19, 20,
+ 21, 104, 22, 23, 24, 25, 26, 27, 105, 106,
+ 107, 108, 109, 0, 0, 0, 110, 111, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 112, 0, 0, 0, 113,
+ 248, 0, 0, 0, 0, 115, 116, 117, 118, 119,
+ 1, 2, 82, 83, 84, 85, 86, 87, 0, 88,
+ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
+ 99, 100, 101, 102, 103, 0, 0, 0, 18, 19,
+ 20, 21, 104, 22, 23, 24, 25, 26, 27, 105,
+ 106, 107, 108, 109, 0, 0, 0, 110, 111, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
+ 113, 0, 0, 0, 0, 0, 115, 116, 117, 118,
+ 119, 1, 2, 82, 83, 84, 85, 86, 87, 0,
+ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ 98, 99, 100, 101, 102, 103, 0, 0, 0, 18,
+ 19, 20, 21, 104, 22, 23, 24, 25, 26, 27,
+ 105, 106, 107, 108, 109, 0, 0, 0, 110, 111,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 112, 0, 0,
+ 0, 65, 1, 2, 82, 83, 84, 115, 116, 117,
+ 118, 119, 0, 0, 0, 92, 93, 94, 95, 96,
+ 97, 98, 99, 100, 101, 102, 103, 0, 0, 0,
+ 18, 19, 20, 21, 0, 22, 23, 24, 25, 26,
+ 27, 105, 106, 107, 108, 109, 0, 0, 0, 110,
+ 111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
+ 1, 2, 82, 83, 84, 0, 0, 0, 115, 116,
+ 117, 118, 119, 92, 93, 94, 95, 96, 97, 98,
+ 99, 100, 101, 102, 103, 0, 0, 0, 18, 19,
+ 20, 21, 0, 22, 23, 24, 25, 26, 27, 105,
+ 106, 107, 108, 109, 0, 0, 0, 110, 111, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
+ 163, 164, 165, 0, 0, 0, 0, 116, 117, 118,
+ 119, 166, 167, 168, 169, 170, 171, 172, 173, 174,
+ 175, 176, 177, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 105, 178, 107,
+ 108, 109, 0, 0, 0, 110, 111, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 112, 0, 0, 179, 163, 164,
+ 165, 0, 0, 0, 0, 116, 117, 118, 119, 166,
+ 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
+ 177, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 105, 178, 107, 108, 109,
+ 0, 0, 0, 110, 111, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 112, 0, 0, 0, 163, 164, 165, 0,
+ 0, 0, 195, 116, 117, 118, 119, 166, 167, 168,
+ 169, 170, 171, 172, 173, 174, 175, 176, 177, 0,
+ 0, 0, 0, 0, 0, 210, 0, 0, 0, 0,
+ 0, 0, 0, 105, 178, 107, 108, 109, 0, 0,
+ 0, 110, 111, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 112, 0, 0, 0, 163, 164, 165, 0, 0, 0,
+ 0, 116, 117, 118, 119, 166, 167, 168, 169, 170,
+ 171, 172, 173, 174, 175, 176, 177, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 105, 178, 107, 108, 109, 0, 0, 0, 110,
+ 111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
+ 0, 252, 163, 164, 165, 0, 0, 0, 0, 116,
+ 117, 118, 119, 166, 167, 168, 169, 170, 171, 172,
+ 173, 174, 175, 176, 177, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 105,
+ 178, 107, 108, 109, 0, 0, 0, 110, 111, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
+ 3, 4, 5, 0, 0, 0, 0, 116, 117, 118,
+ 119, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 0, 0, 0, 0, 0, 20, 21,
+ 0, 22, 23, 24, 25, 26, 27, 0, 28, 3,
+ 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 0, 0, 0, 0, 0, 20, 21, 80,
+ 22, 23, 24, 25, 26, 27, 0, 28, 59, 0,
+ 0, 1, 2, 3, 4, 5, 0, 0, 0, 0,
+ 0, 0, 0, 0, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 0, 0, 185, 18,
+ 19, 20, 21, 0, 22, 23, 24, 25, 26, 27,
+ 0, 28, 1, 2, 3, 4, 5, 0, 0, 0,
+ 0, 0, 0, 0, 0, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 0, 0, 0,
+ 18, 19, 20, 21, 0, 22, 23, 24, 25, 26,
+ 27, 0, 28, 3, 4, 5, 0, 0, 0, 0,
+ 0, 0, 0, 0, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 0, 0, 0, 0,
+ 0, 20, 21, 0, 22, 23, 24, 25, 26, 27,
+ 0, 28
+};
+
+static const short yycheck[] =
+{
+ 75, 91, 162, 158, 37, 262, 161, 3, 4, 0,
+ 0, 44, 52, 53, 33, 42, 57, 74, 314, 71,
+ 53, 74, 112, 319, 42, 81, 78, 83, 61, 48,
+ 63, 186, 28, 29, 30, 31, 32, 79, 71, 3,
+ 4, 298, 70, 76, 76, 152, 73, 87, 88, 40,
+ 40, 92, 127, 71, 71, 50, 51, 110, 111, 63,
+ 69, 42, 71, 73, 28, 29, 30, 31, 32, 78,
+ 73, 70, 76, 70, 70, 42, 71, 76, 131, 76,
+ 75, 42, 70, 70, 191, 48, 49, 162, 76, 76,
+ 233, 234, 235, 236, 76, 250, 76, 79, 69, 79,
+ 79, 158, 79, 193, 161, 158, 76, 76, 161, 79,
+ 79, 28, 29, 30, 69, 205, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 84, 85, 86, 186,
+ 54, 55, 69, 186, 209, 78, 76, 77, 229, 230,
+ 237, 238, 231, 232, 69, 79, 69, 69, 69, 224,
+ 69, 69, 91, 69, 69, 245, 69, 264, 69, 69,
+ 69, 321, 69, 69, 69, 69, 69, 56, 70, 69,
+ 90, 246, 262, 226, 227, 228, 229, 230, 231, 232,
+ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
+ 243, 244, 299, 250, 74, 89, 58, 250, 71, 47,
+ 72, 72, 72, 72, 35, 72, 69, 72, 298, 42,
+ 76, 70, 70, 320, 74, 79, 11, 307, 79, 239,
+ 241, 78, 244, 48, 240, 71, 54, 242, 318, 243,
+ 305, 71, 61, 187, 259, 319, 46, 202, 3, 4,
+ 5, 6, 7, 8, 9, 10, 321, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 298, 40, 259, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, -1, -1, -1, 50, 51, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 69, -1, -1, -1, 73, 74,
+ -1, -1, -1, -1, 79, 80, 81, 82, 83, 3,
+ 4, 5, 6, 7, 8, 9, 10, -1, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, -1, -1, -1, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, -1, -1, -1, 50, 51, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 69, -1, -1, -1, 73,
+ 74, -1, -1, -1, -1, 79, 80, 81, 82, 83,
+ 3, 4, 5, 6, 7, 8, 9, 10, -1, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, -1, -1, -1, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
+ 73, -1, -1, -1, -1, -1, 79, 80, 81, 82,
+ 83, 3, 4, 5, 6, 7, 8, 9, 10, -1,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, -1, -1, -1, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, -1, -1, -1, 50, 51,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 69, -1, -1,
+ -1, 73, 3, 4, 5, 6, 7, 79, 80, 81,
+ 82, 83, -1, -1, -1, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
+ 31, 32, 33, 34, -1, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, -1, -1, -1, 50,
+ 51, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 69, -1,
+ 3, 4, 5, 6, 7, -1, -1, -1, 79, 80,
+ 81, 82, 83, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, -1, -1, -1, 31, 32,
+ 33, 34, -1, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
+ 5, 6, 7, -1, -1, -1, -1, 80, 81, 82,
+ 83, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 42, 43, 44,
+ 45, 46, -1, -1, -1, 50, 51, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 69, -1, -1, 72, 5, 6,
+ 7, -1, -1, -1, -1, 80, 81, 82, 83, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 42, 43, 44, 45, 46,
+ -1, -1, -1, 50, 51, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 69, -1, -1, -1, 5, 6, 7, -1,
+ -1, -1, 79, 80, 81, 82, 83, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, -1,
+ -1, -1, -1, -1, -1, 34, -1, -1, -1, -1,
+ -1, -1, -1, 42, 43, 44, 45, 46, -1, -1,
+ -1, 50, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 69, -1, -1, -1, 5, 6, 7, -1, -1, -1,
+ -1, 80, 81, 82, 83, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 42, 43, 44, 45, 46, -1, -1, -1, 50,
+ 51, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 69, -1,
+ -1, 72, 5, 6, 7, -1, -1, -1, -1, 80,
+ 81, 82, 83, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 42,
+ 43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
+ 5, 6, 7, -1, -1, -1, -1, 80, 81, 82,
+ 83, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, -1, -1, -1, -1, -1, 33, 34,
+ -1, 36, 37, 38, 39, 40, 41, -1, 43, 5,
+ 6, 7, -1, -1, -1, -1, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, -1, -1, -1, -1, -1, 33, 34, 74,
+ 36, 37, 38, 39, 40, 41, -1, 43, 0, -1,
+ -1, 3, 4, 5, 6, 7, -1, -1, -1, -1,
+ -1, -1, -1, -1, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, -1, -1, 74, 31,
+ 32, 33, 34, -1, 36, 37, 38, 39, 40, 41,
+ -1, 43, 3, 4, 5, 6, 7, -1, -1, -1,
+ -1, -1, -1, -1, -1, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
+ 31, 32, 33, 34, -1, 36, 37, 38, 39, 40,
+ 41, -1, 43, 5, 6, 7, -1, -1, -1, -1,
+ -1, -1, -1, -1, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
+ -1, 33, 34, -1, 36, 37, 38, 39, 40, 41,
+ -1, 43
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const unsigned char yystos[] =
+{
+ 0, 3, 4, 5, 6, 7, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 31, 32,
+ 33, 34, 36, 37, 38, 39, 40, 41, 43, 123,
+ 124, 125, 126, 127, 132, 133, 134, 135, 136, 137,
+ 164, 165, 166, 42, 73, 79, 167, 70, 76, 28,
+ 29, 30, 129, 130, 135, 76, 79, 42, 136, 0,
+ 165, 73, 136, 138, 139, 73, 150, 129, 128, 131,
+ 136, 130, 42, 69, 71, 78, 138, 42, 140, 141,
+ 74, 139, 5, 6, 7, 8, 9, 10, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 35, 42, 43, 44, 45, 46,
+ 50, 51, 69, 73, 74, 79, 80, 81, 82, 83,
+ 94, 95, 96, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+ 115, 116, 117, 118, 119, 121, 123, 124, 143, 144,
+ 145, 146, 151, 152, 153, 156, 163, 42, 71, 128,
+ 131, 71, 78, 5, 6, 7, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 43, 72,
+ 105, 118, 122, 119, 142, 74, 71, 76, 79, 79,
+ 79, 158, 69, 69, 79, 79, 121, 69, 105, 105,
+ 121, 74, 147, 50, 51, 71, 75, 70, 70, 76,
+ 34, 119, 69, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 78, 120, 105, 84, 85, 86, 81,
+ 83, 48, 49, 52, 53, 87, 88, 54, 55, 91,
+ 90, 89, 56, 58, 57, 92, 76, 79, 74, 144,
+ 71, 122, 72, 122, 142, 72, 122, 141, 144, 159,
+ 121, 79, 157, 70, 151, 97, 121, 47, 119, 119,
+ 105, 105, 105, 107, 107, 108, 108, 109, 109, 109,
+ 109, 110, 110, 111, 112, 113, 114, 115, 116, 121,
+ 119, 122, 72, 72, 72, 35, 143, 152, 160, 70,
+ 121, 134, 155, 148, 72, 77, 72, 69, 155, 161,
+ 162, 144, 154, 42, 70, 74, 119, 121, 79, 70,
+ 11, 78, 145, 149, 150, 70, 121, 149, 144, 142,
+ 79
+};
+
+#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 yyerrlab1
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+
+#define YYFAIL goto yyerrlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ 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 (&yylval, YYLEX_PARAM)
+#else
+# define YYLEX yylex (&yylval)
+#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 (cinluded). |
+`------------------------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_stack_print (short *bottom, short *top)
+#else
+static void
+yy_stack_print (bottom, top)
+ short *bottom;
+ short *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 yylineno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
+ yyrule - 1, yylineno);
+ /* 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 YYMAXDEPTH == 0
+# undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+\f
+
+#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 */
+
+\f
+
+#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;
+ }
+}
+\f
+
+/* 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 */
+
+
+
+
+
+
+/*----------.
+| 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
+{
+ /* The lookahead symbol. */
+int yychar;
+
+/* The semantic value of the lookahead symbol. */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far. */
+int yynerrs;
+
+ 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 yyssa[YYINITDEPTH];
+ short *yyss = yyssa;
+ register short *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 *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 *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 2:
+#line 210 "glslang.y"
+ {
+ // The symbol table search was done in the lexical phase
+ const TSymbol* symbol = yyvsp[0].lex.symbol;
+ const TVariable* variable;
+ if (symbol == 0) {
+ parseContext.error(yyvsp[0].lex.line, "undeclared identifier", yyvsp[0].lex.string->c_str(), "");
+ parseContext.recover();
+ TType type(EbtFloat);
+ TVariable* fakeVariable = new TVariable(yyvsp[0].lex.string, type);
+ parseContext.symbolTable.insert(*fakeVariable);
+ variable = fakeVariable;
+ } else {
+ // This identifier can only be a variable type symbol
+ if (! symbol->isVariable()) {
+ parseContext.error(yyvsp[0].lex.line, "variable expected", yyvsp[0].lex.string->c_str(), "");
+ parseContext.recover();
+ }
+ variable = static_cast<const TVariable*>(symbol);
+ }
+
+ // don't delete $1.string, it's used by error recovery, and the pool
+ // pop will reclaim the memory
+
+ if (variable->getType().getQualifier() == EvqConst ) {
+ constUnion* constArray = variable->getConstPointer();
+ TType t(variable->getType());
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(constArray, t, yyvsp[0].lex.line);
+ } else
+ yyval.interm.intermTypedNode = parseContext.intermediate.addSymbol(variable->getUniqueId(),
+ variable->getName(),
+ variable->getType(), yyvsp[0].lex.line);
+ ;}
+ break;
+
+ case 3:
+#line 245 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 4:
+#line 248 "glslang.y"
+ {
+ //
+ // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
+ // check for overflow for constants
+ //
+ if (abs(yyvsp[0].lex.i) >= (1 << 16)) {
+ parseContext.error(yyvsp[0].lex.line, " integer constant overflow", "", "");
+ parseContext.recover();
+ }
+ constUnion *unionArray = new constUnion[1];
+ unionArray->iConst = yyvsp[0].lex.i;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
+ ;}
+ break;
+
+ case 5:
+#line 261 "glslang.y"
+ {
+ constUnion *unionArray = new constUnion[1];
+ unionArray->fConst = yyvsp[0].lex.f;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].lex.line);
+ ;}
+ break;
+
+ case 6:
+#line 266 "glslang.y"
+ {
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = yyvsp[0].lex.b;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[0].lex.line);
+ ;}
+ break;
+
+ case 7:
+#line 271 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 8:
+#line 277 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 9:
+#line 280 "glslang.y"
+ {
+ if (!yyvsp[-3].interm.intermTypedNode->isArray() && !yyvsp[-3].interm.intermTypedNode->isMatrix() && !yyvsp[-3].interm.intermTypedNode->isVector()) {
+ if (yyvsp[-3].interm.intermTypedNode->getAsSymbolNode())
+ parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", yyvsp[-3].interm.intermTypedNode->getAsSymbolNode()->getSymbol().c_str(), "");
+ else
+ parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
+ parseContext.recover();
+ }
+ if (yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst && !yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) {
+ if (yyvsp[-3].interm.intermTypedNode->isVector()) { // constant folding for vectors
+ TVectorFields fields;
+ fields.num = 1;
+ fields.offsets[0] = yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst; // need to do it this way because v.xy sends fields integer array
+ yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);
+ } else if (yyvsp[-3].interm.intermTypedNode->isMatrix()) { // constant folding for matrices
+ yyval.interm.intermTypedNode = parseContext.addConstMatrixNode(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);
+ }
+ } else {
+ if (yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) {
+ if ((yyvsp[-3].interm.intermTypedNode->isVector() || yyvsp[-3].interm.intermTypedNode->isMatrix()) && yyvsp[-3].interm.intermTypedNode->getType().getNominalSize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst && !yyvsp[-3].interm.intermTypedNode->isArray() ) {
+ parseContext.error(yyvsp[-2].lex.line, "", "[", "field selection out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
+ parseContext.recover();
+ } else {
+ if (yyvsp[-3].interm.intermTypedNode->isArray()) {
+ if (yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) {
+ if (yyvsp[-3].interm.intermTypedNode->getType().getMaxArraySize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst) {
+ if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, true, yyvsp[-2].lex.line))
+ parseContext.recover();
+ } else {
+ if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), 0, false, yyvsp[-2].lex.line))
+ parseContext.recover();
+ }
+ } else if ( yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst >= yyvsp[-3].interm.intermTypedNode->getType().getArraySize()) {
+ parseContext.error(yyvsp[-2].lex.line, "", "[", "array index out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
+ parseContext.recover();
+ }
+ }
+ yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
+ }
+ } else {
+ if (yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) {
+ parseContext.error(yyvsp[-2].lex.line, "", "[", "array must be redeclared with a size before being indexed with a variable");
+ parseContext.recover();
+ }
+
+ yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexIndirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
+ }
+ }
+ if (yyval.interm.intermTypedNode == 0) {
+ constUnion *unionArray = new constUnion[1];
+ unionArray->fConst = 0.0;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[-2].lex.line);
+ } else if (yyvsp[-3].interm.intermTypedNode->isArray()) {
+ if (yyvsp[-3].interm.intermTypedNode->getType().getStruct())
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getType().getStruct(), yyvsp[-3].interm.intermTypedNode->getType().getTypeName()));
+ else
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize(), yyvsp[-3].interm.intermTypedNode->isMatrix()));
+ } else if (yyvsp[-3].interm.intermTypedNode->isMatrix() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst)
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst, yyvsp[-3].interm.intermTypedNode->getNominalSize()));
+ else if (yyvsp[-3].interm.intermTypedNode->isMatrix())
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize()));
+ else if (yyvsp[-3].interm.intermTypedNode->isVector() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst)
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst));
+ else if (yyvsp[-3].interm.intermTypedNode->isVector())
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary));
+ else
+ yyval.interm.intermTypedNode->setType(yyvsp[-3].interm.intermTypedNode->getType());
+ ;}
+ break;
+
+ case 10:
+#line 348 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 11:
+#line 351 "glslang.y"
+ {
+ if (yyvsp[-2].interm.intermTypedNode->isArray()) {
+ parseContext.error(yyvsp[0].lex.line, "cannot apply dot operator to an array", ".", "");
+ parseContext.recover();
+ }
+
+ if (yyvsp[-2].interm.intermTypedNode->isVector()) {
+ TVectorFields fields;
+ if (! parseContext.parseVectorFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) {
+ fields.num = 1;
+ fields.offsets[0] = 0;
+ parseContext.recover();
+ }
+
+ if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) { // constant folding for vector fields
+ yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-2].interm.intermTypedNode, yyvsp[0].lex.line);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ else
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqConst, (int) (*yyvsp[0].lex.string).size()));
+ } else {
+ if (fields.num == 1) {
+ constUnion *unionArray = new constUnion[1];
+ unionArray->iConst = fields.offsets[0];
+ TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType()));
+ } else {
+ TString vectorString = *yyvsp[0].lex.string;
+ TIntermTyped* index = parseContext.intermediate.addSwizzle(fields, yyvsp[0].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpVectorSwizzle, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(),EvqTemporary, (int) vectorString.size()));
+ }
+ }
+ } else if (yyvsp[-2].interm.intermTypedNode->isMatrix()) {
+ TMatrixFields fields;
+ if (! parseContext.parseMatrixFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) {
+ fields.wholeRow = false;
+ fields.wholeCol = false;
+ fields.row = 0;
+ fields.col = 0;
+ parseContext.recover();
+ }
+
+ if (fields.wholeRow || fields.wholeCol) {
+ parseContext.error(yyvsp[-1].lex.line, " non-scalar fields not implemented yet", ".", "");
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->iConst = 0;
+ TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-2].interm.intermTypedNode->getNominalSize()));
+ } else {
+ constUnion *unionArray = new constUnion[1];
+ unionArray->iConst = fields.col * yyvsp[-2].interm.intermTypedNode->getNominalSize() + fields.row;
+ TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType()));
+ }
+ } else if (yyvsp[-2].interm.intermTypedNode->getBasicType() == EbtStruct) {
+ bool fieldFound = false;
+ TTypeList* fields = yyvsp[-2].interm.intermTypedNode->getType().getStruct();
+ if (fields == 0) {
+ parseContext.error(yyvsp[-1].lex.line, "structure has no fields", "Internal Error", "");
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ } else {
+ unsigned int i;
+ for (i = 0; i < fields->size(); ++i) {
+ if ((*fields)[i].type->getFieldName() == *yyvsp[0].lex.string) {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound) {
+ if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) {
+ yyval.interm.intermTypedNode = parseContext.addConstStruct(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode, yyvsp[-1].lex.line);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ else {
+ yyval.interm.intermTypedNode->setType(*(*fields)[i].type);
+ // change the qualifier of the return type, not of the structure field
+ // as the structure definition is shared between various structures.
+ yyval.interm.intermTypedNode->getTypePointer()->changeQualifier(EvqConst);
+ }
+ } else {
+ constUnion *unionArray = new constUnion[1];
+ unionArray->iConst = i;
+ TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirectStruct, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode->setType(*(*fields)[i].type);
+ }
+ } else {
+ parseContext.error(yyvsp[-1].lex.line, " no such field in structure", yyvsp[0].lex.string->c_str(), "");
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ }
+ } else {
+ parseContext.error(yyvsp[-1].lex.line, " field selection requires structure, vector, or matrix on left hand side", yyvsp[0].lex.string->c_str(), "");
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ // don't delete $3.string, it's from the pool
+ ;}
+ break;
+
+ case 12:
+#line 460 "glslang.y"
+ {
+ if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode))
+ parseContext.recover();
+ yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostIncrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.unaryOpError(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 13:
+#line 470 "glslang.y"
+ {
+ if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode))
+ parseContext.recover();
+ yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostDecrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.unaryOpError(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 14:
+#line 483 "glslang.y"
+ {
+ if (parseContext.integerErrorCheck(yyvsp[0].interm.intermTypedNode, "[]"))
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 15:
+#line 491 "glslang.y"
+ {
+ TFunction* fnCall = yyvsp[0].interm.function;
+ TOperator op = fnCall->getBuiltInOp();
+
+ if (op != EOpNull) {
+ //
+ // Then this should be a constructor.
+ //
+ TType type(EbtVoid); // use this to get the type back
+ if (parseContext.constructorErrorCheck(yyvsp[0].interm.line, yyvsp[0].interm.intermNode, *fnCall, op, &type)) {
+ yyval.interm.intermTypedNode = 0;
+ } else {
+ //
+ // It's a constructor, of type 'type'.
+ //
+ yyval.interm.intermTypedNode = parseContext.addConstructor(yyvsp[0].interm.intermNode, &type, op, fnCall, yyvsp[0].interm.line);
+ }
+
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.recover();
+ yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(0, op, yyvsp[0].interm.line);
+ }
+ yyval.interm.intermTypedNode->setType(type);
+ } else {
+ //
+ // Not a constructor. Find it in the symbol table.
+ //
+ const TFunction* fnCandidate;
+ bool builtIn;
+ fnCandidate = parseContext.findFunction(yyvsp[0].interm.line, fnCall, &builtIn);
+ if (fnCandidate) {
+ //
+ // A declared function. But, it might still map to a built-in
+ // operation.
+ //
+ op = fnCandidate->getBuiltInOp();
+ if (builtIn && op != EOpNull) {
+ //
+ // A function call mapped to a built-in operation.
+ //
+ if (fnCandidate->getParamCount() == 1) {
+ //
+ // Treat it like a built-in unary operator.
+ //
+ yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(op, yyvsp[0].interm.intermNode, 0, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.error(yyvsp[0].interm.intermNode->getLine(), " wrong operand type", "Internal Error",
+ "built in unary operator function. Type: %s",
+ static_cast<TIntermTyped*>(yyvsp[0].interm.intermNode)->getCompleteString().c_str());
+ YYERROR;
+ }
+ } else {
+ yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, op, yyvsp[0].interm.line);
+ }
+ } else {
+ // This is a real function call
+
+ yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, EOpFunctionCall, yyvsp[0].interm.line);
+ yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType());
+
+ // this is how we know whether the given function is a builtIn function or a user defined function
+ // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
+ // if builtIn == true, it's definitely a builtIn function with EOpNull
+ if (!builtIn)
+ yyval.interm.intermTypedNode->getAsAggregate()->setUserDefined();
+ yyval.interm.intermTypedNode->getAsAggregate()->setName(fnCandidate->getMangledName());
+
+ TQualifier qual;
+ TQualifierList& qualifierList = yyval.interm.intermTypedNode->getAsAggregate()->getQualifier();
+ for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
+ qual = (*fnCandidate)[i].type->getQualifier();
+ if (qual == EvqOut || qual == EvqInOut) {
+ if (parseContext.lValueErrorCheck(yyval.interm.intermTypedNode->getLine(), "assign", yyval.interm.intermTypedNode->getAsAggregate()->getSequence()[i]->getAsTyped())) {
+ parseContext.error(yyvsp[0].interm.intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
+ parseContext.recover();
+ }
+ }
+ qualifierList.push_back(qual);
+ }
+ }
+ yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType());
+ } else {
+ // error message was put out by PaFindFunction()
+ // Put on a dummy node for error recovery
+ constUnion *unionArray = new constUnion[1];
+ unionArray->fConst = 0.0;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].interm.line);
+ parseContext.recover();
+ }
+ }
+ delete fnCall;
+ ;}
+ break;
+
+ case 16:
+#line 586 "glslang.y"
+ {
+ yyval.interm = yyvsp[-1].interm;
+ yyval.interm.line = yyvsp[0].lex.line;
+ ;}
+ break;
+
+ case 17:
+#line 590 "glslang.y"
+ {
+ yyval.interm = yyvsp[-1].interm;
+ yyval.interm.line = yyvsp[0].lex.line;
+ ;}
+ break;
+
+ case 18:
+#line 597 "glslang.y"
+ {
+ yyval.interm.function = yyvsp[-1].interm.function;
+ yyval.interm.intermNode = 0;
+ ;}
+ break;
+
+ case 19:
+#line 601 "glslang.y"
+ {
+ yyval.interm.function = yyvsp[0].interm.function;
+ yyval.interm.intermNode = 0;
+ ;}
+ break;
+
+ case 20:
+#line 608 "glslang.y"
+ {
+ TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) };
+ yyvsp[-1].interm.function->addParameter(param);
+ yyval.interm.function = yyvsp[-1].interm.function;
+ yyval.interm.intermNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 21:
+#line 614 "glslang.y"
+ {
+ TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) };
+ yyvsp[-2].interm.function->addParameter(param);
+ yyval.interm.function = yyvsp[-2].interm.function;
+ yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);
+ ;}
+ break;
+
+ case 22:
+#line 623 "glslang.y"
+ {
+ yyval.interm.function = yyvsp[-1].interm.function;
+ ;}
+ break;
+
+ case 23:
+#line 629 "glslang.y"
+ {
+ if (yyvsp[0].interm.op == EOpConstructStruct) {
+ TString tempString = "";
+ TFunction *function = new TFunction(&tempString, *(yyvsp[0].interm.type.userDef), yyvsp[0].interm.op);
+ yyval.interm.function = function;
+ }
+ else {
+ TFunction *function = new TFunction(yyvsp[0].interm.op);
+ yyval.interm.function = function;
+ }
+ ;}
+ break;
+
+ case 24:
+#line 640 "glslang.y"
+ {
+ if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
+ parseContext.recover();
+ TType type(EbtVoid);
+ TFunction *function = new TFunction(yyvsp[0].lex.string, type);
+ yyval.interm.function = function;
+ ;}
+ break;
+
+ case 25:
+#line 656 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructFloat; ;}
+ break;
+
+ case 26:
+#line 657 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructInt; ;}
+ break;
+
+ case 27:
+#line 658 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBool; ;}
+ break;
+
+ case 28:
+#line 659 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec2; ;}
+ break;
+
+ case 29:
+#line 660 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec3; ;}
+ break;
+
+ case 30:
+#line 661 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec4; ;}
+ break;
+
+ case 31:
+#line 662 "glslang.y"
+ { FRAG_VERT_ONLY("bvec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec2; ;}
+ break;
+
+ case 32:
+#line 663 "glslang.y"
+ { FRAG_VERT_ONLY("bvec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec3; ;}
+ break;
+
+ case 33:
+#line 664 "glslang.y"
+ { FRAG_VERT_ONLY("bvec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec4; ;}
+ break;
+
+ case 34:
+#line 665 "glslang.y"
+ { FRAG_VERT_ONLY("ivec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec2; ;}
+ break;
+
+ case 35:
+#line 666 "glslang.y"
+ { FRAG_VERT_ONLY("ivec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec3; ;}
+ break;
+
+ case 36:
+#line 667 "glslang.y"
+ { FRAG_VERT_ONLY("ivec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec4; ;}
+ break;
+
+ case 37:
+#line 668 "glslang.y"
+ { FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat2; ;}
+ break;
+
+ case 38:
+#line 669 "glslang.y"
+ { FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat3; ;}
+ break;
+
+ case 39:
+#line 670 "glslang.y"
+ { FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat4; ;}
+ break;
+
+ case 40:
+#line 671 "glslang.y"
+ {
+ TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ yyval.interm.line = yyvsp[0].lex.line;
+ yyval.interm.op = EOpConstructStruct;
+ ;}
+ break;
+
+ case 41:
+#line 682 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 42:
+#line 685 "glslang.y"
+ {
+ if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode))
+ parseContext.recover();
+ yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreIncrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.unaryOpError(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 43:
+#line 695 "glslang.y"
+ {
+ if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode))
+ parseContext.recover();
+ yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreDecrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.unaryOpError(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 44:
+#line 705 "glslang.y"
+ {
+ if (yyvsp[-1].interm.op != EOpNull) {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(yyvsp[-1].interm.op, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ char* errorOp = "";
+ switch(yyvsp[-1].interm.op) {
+ case EOpNegative: errorOp = "-"; break;
+ case EOpLogicalNot: errorOp = "!"; break;
+ case EOpBitwiseNot: errorOp = "~"; break;
+ default: break;
+ }
+ parseContext.unaryOpError(yyvsp[-1].interm.line, errorOp, yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ }
+ } else
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 45:
+#line 727 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNull; ;}
+ break;
+
+ case 46:
+#line 728 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNegative; ;}
+ break;
+
+ case 47:
+#line 729 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLogicalNot; ;}
+ break;
+
+ case 48:
+#line 730 "glslang.y"
+ { PACK_UNPACK_ONLY("~", yyvsp[0].lex.line);
+ yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpBitwiseNot; ;}
+ break;
+
+ case 49:
+#line 736 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 50:
+#line 737 "glslang.y"
+ {
+ FRAG_VERT_ONLY("*", yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMul, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "*", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 51:
+#line 746 "glslang.y"
+ {
+ FRAG_VERT_ONLY("/", yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpDiv, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "/", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 52:
+#line 755 "glslang.y"
+ {
+ PACK_UNPACK_ONLY("%", yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMod, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "%", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 53:
+#line 767 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 54:
+#line 768 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAdd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "+", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 55:
+#line 776 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpSub, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "-", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 56:
+#line 787 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 57:
+#line 788 "glslang.y"
+ {
+ PACK_UNPACK_ONLY("<<", yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLeftShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "<<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 58:
+#line 797 "glslang.y"
+ {
+ PACK_UNPACK_ONLY(">>", yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpRightShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, ">>", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 59:
+#line 809 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 60:
+#line 810 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 61:
+#line 820 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, ">", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 62:
+#line 830 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "<=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 63:
+#line 840 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, ">=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 64:
+#line 853 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 65:
+#line 854 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "==", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 66:
+#line 864 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpNotEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "!=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 67:
+#line 877 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 68:
+#line 878 "glslang.y"
+ {
+ PACK_UNPACK_ONLY("&", yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 69:
+#line 890 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 70:
+#line 891 "glslang.y"
+ {
+ PACK_UNPACK_ONLY("^", yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpExclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 71:
+#line 903 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 72:
+#line 904 "glslang.y"
+ {
+ PACK_UNPACK_ONLY("|", yyvsp[-1].lex.line);
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpInclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "|", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 73:
+#line 916 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 74:
+#line 917 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "&&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 75:
+#line 930 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 76:
+#line 931 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalXor, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "^^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 77:
+#line 944 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 78:
+#line 945 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, "||", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ constUnion *unionArray = new constUnion[1];
+ unionArray->bConst = false;
+ yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
+ }
+ ;}
+ break;
+
+ case 79:
+#line 958 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 80:
+#line 959 "glslang.y"
+ {
+ if (parseContext.boolErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.intermTypedNode))
+ parseContext.recover();
+
+ yyval.interm.intermTypedNode = parseContext.intermediate.addSelection(yyvsp[-4].interm.intermTypedNode, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-3].lex.line);
+ if (yyvsp[-2].interm.intermTypedNode->getType() != yyvsp[0].interm.intermTypedNode->getType())
+ yyval.interm.intermTypedNode = 0;
+
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-3].lex.line, ":", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 81:
+#line 976 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 82:
+#line 977 "glslang.y"
+ {
+ if (parseContext.lValueErrorCheck(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode))
+ parseContext.recover();
+ yyval.interm.intermTypedNode = parseContext.intermediate.addAssign(yyvsp[-1].interm.op, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.assignError(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 83:
+#line 990 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAssign; ;}
+ break;
+
+ case 84:
+#line 991 "glslang.y"
+ { FRAG_VERT_ONLY("*=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpMulAssign; ;}
+ break;
+
+ case 85:
+#line 992 "glslang.y"
+ { FRAG_VERT_ONLY("/=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpDivAssign; ;}
+ break;
+
+ case 86:
+#line 993 "glslang.y"
+ { PACK_UNPACK_ONLY("%=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpModAssign; ;}
+ break;
+
+ case 87:
+#line 994 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAddAssign; ;}
+ break;
+
+ case 88:
+#line 995 "glslang.y"
+ { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpSubAssign; ;}
+ break;
+
+ case 89:
+#line 996 "glslang.y"
+ { PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLeftShiftAssign; ;}
+ break;
+
+ case 90:
+#line 997 "glslang.y"
+ { PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpRightShiftAssign; ;}
+ break;
+
+ case 91:
+#line 998 "glslang.y"
+ { PACK_UNPACK_ONLY("&=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAndAssign; ;}
+ break;
+
+ case 92:
+#line 999 "glslang.y"
+ { PACK_UNPACK_ONLY("^=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpExclusiveOrAssign; ;}
+ break;
+
+ case 93:
+#line 1000 "glslang.y"
+ { PACK_UNPACK_ONLY("|=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpInclusiveOrAssign; ;}
+ break;
+
+ case 94:
+#line 1004 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 95:
+#line 1007 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = parseContext.intermediate.addComma(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);
+ if (yyval.interm.intermTypedNode == 0) {
+ parseContext.binaryOpError(yyvsp[-1].lex.line, ",", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ }
+ ;}
+ break;
+
+ case 96:
+#line 1018 "glslang.y"
+ {
+ if (parseContext.constErrorCheck(yyvsp[0].interm.intermTypedNode))
+ parseContext.recover();
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 97:
+#line 1026 "glslang.y"
+ { yyval.interm.intermNode = 0; ;}
+ break;
+
+ case 98:
+#line 1027 "glslang.y"
+ {
+ if (yyvsp[-1].interm.intermAggregate)
+ yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence);
+ yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate;
+ ;}
+ break;
+
+ case 99:
+#line 1035 "glslang.y"
+ {
+ //
+ // Multiple declarations of the same function are allowed.
+ //
+ // If this is a definition, the definition production code will check for redefinitions
+ // (we don't know at this point if it's a definition or not).
+ //
+ // Redeclarations are allowed. But, return types and parameter qualifiers must match.
+ //
+ TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(yyvsp[-1].interm.function->getMangledName()));
+ if (prevDec) {
+ if (prevDec->getReturnType() != yyvsp[-1].interm.function->getReturnType()) {
+ parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same return type", yyvsp[-1].interm.function->getReturnType().getBasicString(), "");
+ parseContext.recover();
+ }
+ for (int i = 0; i < prevDec->getParamCount(); ++i) {
+ if ((*prevDec)[i].type->getQualifier() != (*yyvsp[-1].interm.function)[i].type->getQualifier()) {
+ parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same parameter qualifiers", (*yyvsp[-1].interm.function)[i].type->getQualifierString(), "");
+ parseContext.recover();
+ }
+ }
+ }
+
+ //
+ // If this is a redeclaration, it could also be a definition,
+ // in which case, we want to use the variable names from this one, and not the one that's
+ // being redeclared. So, pass back up this declaration, not the one in the symbol table.
+ //
+ yyval.interm.function = yyvsp[-1].interm.function;
+ yyval.interm.line = yyvsp[0].lex.line;
+
+ parseContext.symbolTable.insert(*yyval.interm.function);
+ ;}
+ break;
+
+ case 100:
+#line 1071 "glslang.y"
+ {
+ yyval.interm.function = yyvsp[0].interm.function;
+ ;}
+ break;
+
+ case 101:
+#line 1074 "glslang.y"
+ {
+ yyval.interm.function = yyvsp[0].interm.function;
+ ;}
+ break;
+
+ case 102:
+#line 1081 "glslang.y"
+ {
+ // Add the parameter
+ yyval.interm.function = yyvsp[-1].interm.function;
+ if (yyvsp[0].interm.param.type->getBasicType() != EbtVoid)
+ yyvsp[-1].interm.function->addParameter(yyvsp[0].interm.param);
+ else
+ delete yyvsp[0].interm.param.type;
+ ;}
+ break;
+
+ case 103:
+#line 1089 "glslang.y"
+ {
+ //
+ // Only first parameter of one-parameter functions can be void
+ // The check for named parameters not being void is done in parameter_declarator
+ //
+ if (yyvsp[0].interm.param.type->getBasicType() == EbtVoid) {
+ //
+ // This parameter > first is void
+ //
+ parseContext.error(yyvsp[-1].lex.line, "cannot be an argument type except for '(void)'", "void", "");
+ parseContext.recover();
+ delete yyvsp[0].interm.param.type;
+ } else {
+ // Add the parameter
+ yyval.interm.function = yyvsp[-2].interm.function;
+ yyvsp[-2].interm.function->addParameter(yyvsp[0].interm.param);
+ }
+ ;}
+ break;
+
+ case 104:
+#line 1110 "glslang.y"
+ {
+ if (yyvsp[-2].interm.type.qualifier != EvqGlobal && yyvsp[-2].interm.type.qualifier != EvqTemporary) {
+ parseContext.error(yyvsp[-1].lex.line, "no qualifiers allowed for function return", getQualifierString(yyvsp[-2].interm.type.qualifier), "");
+ parseContext.recover();
+ }
+ // make sure a sampler is not involved as well...
+ if (parseContext.structQualifierErrorCheck(yyvsp[-1].lex.line, yyvsp[-2].interm.type))
+ parseContext.recover();
+
+ // Add the function as a prototype after parsing it (we do not support recursion)
+ TFunction *function;
+ TType type(yyvsp[-2].interm.type);
+ function = new TFunction(yyvsp[-1].lex.string, type);
+ yyval.interm.function = function;
+ ;}
+ break;
+
+ case 105:
+#line 1129 "glslang.y"
+ {
+ if (yyvsp[-1].interm.type.type == EbtVoid) {
+ parseContext.error(yyvsp[0].lex.line, "illegal use of type 'void'", yyvsp[0].lex.string->c_str(), "");
+ parseContext.recover();
+ }
+ if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
+ parseContext.recover();
+ TParameter param = {yyvsp[0].lex.string, new TType(yyvsp[-1].interm.type)};
+ yyval.interm.line = yyvsp[0].lex.line;
+ yyval.interm.param = param;
+ ;}
+ break;
+
+ case 106:
+#line 1140 "glslang.y"
+ {
+ // Check that we can make an array out of this type
+ if (yyvsp[-4].interm.type.array) {
+ parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-4].interm.type).getCompleteString().c_str(), "");
+ parseContext.recover();
+ }
+ if (parseContext.reservedErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string))
+ parseContext.recover();
+ yyvsp[-4].interm.type.array = true;
+ TType* type = new TType(yyvsp[-4].interm.type);
+ if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion())
+ type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
+ TParameter param = { yyvsp[-3].lex.string, type };
+ yyval.interm.line = yyvsp[-3].lex.line;
+ yyval.interm.param = param;
+ ;}
+ break;
+
+ case 107:
+#line 1167 "glslang.y"
+ {
+ yyval.interm = yyvsp[0].interm;
+ if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 108:
+#line 1172 "glslang.y"
+ {
+ yyval.interm = yyvsp[0].interm;
+ if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type))
+ parseContext.recover();
+ if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 109:
+#line 1182 "glslang.y"
+ {
+ yyval.interm = yyvsp[0].interm;
+ if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 110:
+#line 1187 "glslang.y"
+ {
+ yyval.interm = yyvsp[0].interm;
+ if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type))
+ parseContext.recover();
+ if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 111:
+#line 1197 "glslang.y"
+ {
+ yyval.interm.qualifier = EvqIn;
+ ;}
+ break;
+
+ case 112:
+#line 1200 "glslang.y"
+ {
+ yyval.interm.qualifier = EvqIn;
+ ;}
+ break;
+
+ case 113:
+#line 1203 "glslang.y"
+ {
+ yyval.interm.qualifier = EvqOut;
+ ;}
+ break;
+
+ case 114:
+#line 1206 "glslang.y"
+ {
+ yyval.interm.qualifier = EvqInOut;
+ ;}
+ break;
+
+ case 115:
+#line 1212 "glslang.y"
+ {
+ TParameter param = { 0, new TType(yyvsp[0].interm.type) };
+ yyval.interm.param = param;
+
+ ;}
+ break;
+
+ case 116:
+#line 1217 "glslang.y"
+ {
+ // Check that we can make an array out of this type
+ if (yyvsp[-3].interm.type.array) {
+ parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-3].interm.type).getCompleteString().c_str(), "");
+ parseContext.recover();
+ }
+ yyvsp[-3].interm.type.array = true;
+ TType* type = new TType(yyvsp[-3].interm.type);
+ if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion())
+ type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
+
+ TParameter param = { 0, type };
+ yyval.interm.line = yyvsp[-2].lex.line;
+ yyval.interm.param = param;
+ ;}
+ break;
+
+ case 117:
+#line 1235 "glslang.y"
+ {
+ yyval.interm = yyvsp[0].interm;
+ ;}
+ break;
+
+ case 118:
+#line 1238 "glslang.y"
+ {
+ yyval.interm = yyvsp[-2].interm;
+ if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.type))
+ parseContext.recover();
+
+ if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 119:
+#line 1246 "glslang.y"
+ {
+ yyval.interm = yyvsp[-4].interm;
+ if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
+ parseContext.recover();
+
+ if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 120:
+#line 1254 "glslang.y"
+ {
+ yyval.interm = yyvsp[-5].interm;
+ if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-5].interm.type))
+ parseContext.recover();
+
+ if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 121:
+#line 1262 "glslang.y"
+ {
+ yyval.interm = yyvsp[-4].interm;
+ if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
+ parseContext.recover();
+
+ TIntermNode* intermNode;
+ if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-4].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) {
+ //
+ // build the intermediate representation
+ //
+ if (intermNode)
+ yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-4].interm.intermNode, intermNode, yyvsp[-1].lex.line);
+ else
+ yyval.interm.intermAggregate = yyvsp[-4].interm.intermAggregate;
+ } else {
+ parseContext.recover();
+ yyval.interm.intermAggregate = 0;
+ }
+ ;}
+ break;
+
+ case 122:
+#line 1284 "glslang.y"
+ {
+ yyval.interm.type = yyvsp[0].interm.type;
+ yyval.interm.intermAggregate = 0;
+ ;}
+ break;
+
+ case 123:
+#line 1288 "glslang.y"
+ {
+ yyval.interm.intermAggregate = 0;
+ yyval.interm.type = yyvsp[-1].interm.type;
+ if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-1].interm.type))
+ parseContext.recover();
+
+ if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 124:
+#line 1297 "glslang.y"
+ {
+ yyval.interm.intermAggregate = 0;
+ yyval.interm.type = yyvsp[-3].interm.type;
+ if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
+ parseContext.recover();
+
+ if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 125:
+#line 1306 "glslang.y"
+ {
+ yyval.interm.intermAggregate = 0;
+ yyval.interm.type = yyvsp[-4].interm.type;
+ if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.type))
+ parseContext.recover();
+
+ if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 126:
+#line 1315 "glslang.y"
+ {
+ yyval.interm.type = yyvsp[-3].interm.type;
+ if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
+ parseContext.recover();
+
+ TIntermNode* intermNode;
+ if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) {
+ //
+ // Build intermediate representation
+ //
+ if (intermNode)
+ yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, yyvsp[-1].lex.line);
+ else
+ yyval.interm.intermAggregate = 0;
+ } else {
+ parseContext.recover();
+ yyval.interm.intermAggregate = 0;
+ }
+ ;}
+ break;
+
+ case 127:
+#line 1405 "glslang.y"
+ {
+ yyval.interm.type = yyvsp[0].interm.type;
+ ;}
+ break;
+
+ case 128:
+#line 1408 "glslang.y"
+ {
+ TPublicType t = { yyvsp[0].interm.type.type, yyvsp[-1].interm.type.qualifier, yyvsp[0].interm.type.size, yyvsp[0].interm.type.matrix, false, yyvsp[0].interm.type.userDef, 0 };
+ if (yyvsp[-1].interm.type.qualifier == EvqAttribute &&
+ (yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) {
+ parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), "");
+ parseContext.recover();
+ }
+ if ((yyvsp[-1].interm.type.qualifier == EvqVaryingIn || yyvsp[-1].interm.type.qualifier == EvqVaryingOut) &&
+ (yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) {
+ parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), "");
+ parseContext.recover();
+ }
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 129:
+#line 1425 "glslang.y"
+ {
+ TPublicType t = { EbtVoid, EvqConst, 1, false, false, 0 };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 130:
+#line 1429 "glslang.y"
+ {
+ VERTEX_ONLY("attribute", yyvsp[0].lex.line);
+ if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))
+ parseContext.recover();
+ TPublicType t = { EbtVoid, EvqAttribute, 1, false, false, 0 };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 131:
+#line 1436 "glslang.y"
+ {
+ if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "varying"))
+ parseContext.recover();
+ TPublicType t = { EbtVoid, EvqVaryingIn, 1, false, false, 0 };
+ if (parseContext.language == EShLangVertex)
+ t.qualifier = EvqVaryingOut;
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 132:
+#line 1444 "glslang.y"
+ {
+ if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "uniform"))
+ parseContext.recover();
+ TPublicType t = { EbtVoid, EvqUniform, 1, false, false, 0 };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 133:
+#line 1453 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtVoid, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 134:
+#line 1458 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtFloat, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 135:
+#line 1463 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtInt, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 136:
+#line 1468 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtBool, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 137:
+#line 1479 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtFloat, qual, 2, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 138:
+#line 1484 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtFloat, qual, 3, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 139:
+#line 1489 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtFloat, qual, 4, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 140:
+#line 1494 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtBool, qual, 2, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 141:
+#line 1499 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtBool, qual, 3, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 142:
+#line 1504 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtBool, qual, 4, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 143:
+#line 1509 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtInt, qual, 2, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 144:
+#line 1514 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtInt, qual, 3, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 145:
+#line 1519 "glslang.y"
+ {
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtInt, qual, 4, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 146:
+#line 1524 "glslang.y"
+ {
+ FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtFloat, qual, 2, true, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 147:
+#line 1530 "glslang.y"
+ {
+ FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtFloat, qual, 3, true, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 148:
+#line 1536 "glslang.y"
+ {
+ FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtFloat, qual, 4, true, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 149:
+#line 1542 "glslang.y"
+ {
+ FRAG_VERT_ONLY("sampler1D", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtSampler1D, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 150:
+#line 1548 "glslang.y"
+ {
+ FRAG_VERT_ONLY("sampler2D", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtSampler2D, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 151:
+#line 1554 "glslang.y"
+ {
+ FRAG_VERT_ONLY("sampler3D", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtSampler3D, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 152:
+#line 1560 "glslang.y"
+ {
+ FRAG_VERT_ONLY("samplerCube", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtSamplerCube, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 153:
+#line 1566 "glslang.y"
+ {
+ FRAG_VERT_ONLY("sampler1DShadow", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtSampler1DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 154:
+#line 1572 "glslang.y"
+ {
+ FRAG_VERT_ONLY("sampler2DShadow", yyvsp[0].lex.line);
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtSampler2DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 155:
+#line 1578 "glslang.y"
+ {
+ FRAG_VERT_ONLY("struct", yyvsp[0].interm.type.line);
+ yyval.interm.type = yyvsp[0].interm.type;
+ yyval.interm.type.qualifier = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ ;}
+ break;
+
+ case 156:
+#line 1583 "glslang.y"
+ {
+ //
+ // This is for user defined type names. The lexical phase looked up the
+ // type.
+ //
+ TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();
+ TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 157:
+#line 1596 "glslang.y"
+ {
+ TType* structure = new TType(yyvsp[-1].interm.typeList, *yyvsp[-3].lex.string);
+ TVariable* userTypeDef = new TVariable(yyvsp[-3].lex.string, *structure, true);
+ if (! parseContext.symbolTable.insert(*userTypeDef)) {
+ parseContext.error(yyvsp[-3].lex.line, "redefinition", yyvsp[-3].lex.string->c_str(), "struct");
+ parseContext.recover();
+ }
+ TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-4].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 158:
+#line 1606 "glslang.y"
+ {
+ TType* structure = new TType(yyvsp[-1].interm.typeList, TString(""));
+ TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-3].lex.line };
+ yyval.interm.type = t;
+ ;}
+ break;
+
+ case 159:
+#line 1614 "glslang.y"
+ {
+ yyval.interm.typeList = yyvsp[0].interm.typeList;
+ ;}
+ break;
+
+ case 160:
+#line 1617 "glslang.y"
+ {
+ yyval.interm.typeList = yyvsp[-1].interm.typeList;
+ for (unsigned int i = 0; i < yyvsp[0].interm.typeList->size(); ++i) {
+ for (unsigned int j = 0; j < yyval.interm.typeList->size(); ++j) {
+ if ((*yyval.interm.typeList)[j].type->getFieldName() == (*yyvsp[0].interm.typeList)[i].type->getFieldName()) {
+ parseContext.error((*yyvsp[0].interm.typeList)[i].line, "duplicate field name in structure:", "struct", (*yyvsp[0].interm.typeList)[i].type->getFieldName().c_str());
+ parseContext.recover();
+ }
+ }
+ yyval.interm.typeList->push_back((*yyvsp[0].interm.typeList)[i]);
+ }
+ ;}
+ break;
+
+ case 161:
+#line 1632 "glslang.y"
+ {
+ yyval.interm.typeList = yyvsp[-1].interm.typeList;
+
+ if (parseContext.voidErrorCheck(yyvsp[-2].interm.type.line, (*yyvsp[-1].interm.typeList)[0].type->getFieldName(), yyvsp[-2].interm.type)) {
+ parseContext.recover();
+ }
+ for (unsigned int i = 0; i < yyval.interm.typeList->size(); ++i) {
+ //
+ // Careful not to replace already know aspects of type, like array-ness
+ //
+ (*yyval.interm.typeList)[i].type->setType(yyvsp[-2].interm.type.type, yyvsp[-2].interm.type.size, yyvsp[-2].interm.type.matrix, yyvsp[-2].interm.type.userDef);
+ if (yyvsp[-2].interm.type.userDef)
+ (*yyval.interm.typeList)[i].type->setTypeName(yyvsp[-2].interm.type.userDef->getTypeName());
+ }
+ ;}
+ break;
+
+ case 162:
+#line 1650 "glslang.y"
+ {
+ yyval.interm.typeList = NewPoolTTypeList();
+ yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);
+ ;}
+ break;
+
+ case 163:
+#line 1654 "glslang.y"
+ {
+ yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);
+ ;}
+ break;
+
+ case 164:
+#line 1660 "glslang.y"
+ {
+ yyval.interm.typeLine.type = new TType(EbtVoid);
+ yyval.interm.typeLine.line = yyvsp[0].lex.line;
+ yyval.interm.typeLine.type->setFieldName(*yyvsp[0].lex.string);
+ ;}
+ break;
+
+ case 165:
+#line 1665 "glslang.y"
+ {
+ yyval.interm.typeLine.type = new TType(EbtVoid);
+ yyval.interm.typeLine.line = yyvsp[-3].lex.line;
+ yyval.interm.typeLine.type->setFieldName(*yyvsp[-3].lex.string);
+
+ if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion() == 0 || yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getBasicType() != EbtInt ||
+ yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst <= 0) {
+ parseContext.error(yyvsp[-2].lex.line, "structure field array size must be a positive integer", yyvsp[-3].lex.string->c_str(), "");
+ parseContext.recover();
+ } else {
+ yyval.interm.typeLine.type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
+ }
+ ;}
+ break;
+
+ case 166:
+#line 1681 "glslang.y"
+ { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
+ break;
+
+ case 167:
+#line 1685 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 168:
+#line 1689 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermAggregate; ;}
+ break;
+
+ case 169:
+#line 1690 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 170:
+#line 1696 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 171:
+#line 1697 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 172:
+#line 1698 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 173:
+#line 1699 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 174:
+#line 1700 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 175:
+#line 1704 "glslang.y"
+ { yyval.interm.intermAggregate = 0; ;}
+ break;
+
+ case 176:
+#line 1705 "glslang.y"
+ { parseContext.symbolTable.push(); ;}
+ break;
+
+ case 177:
+#line 1705 "glslang.y"
+ { parseContext.symbolTable.pop(); ;}
+ break;
+
+ case 178:
+#line 1705 "glslang.y"
+ {
+ if (yyvsp[-2].interm.intermAggregate != 0)
+ yyvsp[-2].interm.intermAggregate->setOperator(EOpSequence);
+ yyval.interm.intermAggregate = yyvsp[-2].interm.intermAggregate;
+ ;}
+ break;
+
+ case 179:
+#line 1713 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 180:
+#line 1714 "glslang.y"
+ { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
+ break;
+
+ case 181:
+#line 1719 "glslang.y"
+ {
+ yyval.interm.intermNode = 0;
+ ;}
+ break;
+
+ case 182:
+#line 1722 "glslang.y"
+ {
+ if (yyvsp[-1].interm.intermAggregate)
+ yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence);
+ yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate;
+ ;}
+ break;
+
+ case 183:
+#line 1730 "glslang.y"
+ {
+ yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(yyvsp[0].interm.intermNode, 0);
+ ;}
+ break;
+
+ case 184:
+#line 1733 "glslang.y"
+ {
+ yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);
+ ;}
+ break;
+
+ case 185:
+#line 1739 "glslang.y"
+ { yyval.interm.intermNode = 0; ;}
+ break;
+
+ case 186:
+#line 1740 "glslang.y"
+ { yyval.interm.intermNode = static_cast<TIntermNode*>(yyvsp[-1].interm.intermTypedNode); ;}
+ break;
+
+ case 187:
+#line 1744 "glslang.y"
+ {
+ if (parseContext.boolErrorCheck(yyvsp[-4].lex.line, yyvsp[-2].interm.intermTypedNode))
+ parseContext.recover();
+ yyval.interm.intermNode = parseContext.intermediate.addSelection(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.nodePair, yyvsp[-4].lex.line);
+ ;}
+ break;
+
+ case 188:
+#line 1752 "glslang.y"
+ {
+ yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermNode;
+ yyval.interm.nodePair.node2 = yyvsp[0].interm.intermNode;
+ ;}
+ break;
+
+ case 189:
+#line 1756 "glslang.y"
+ {
+ yyval.interm.nodePair.node1 = yyvsp[0].interm.intermNode;
+ yyval.interm.nodePair.node2 = 0;
+ ;}
+ break;
+
+ case 190:
+#line 1766 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ if (parseContext.boolErrorCheck(yyvsp[0].interm.intermTypedNode->getLine(), yyvsp[0].interm.intermTypedNode))
+ parseContext.recover();
+ ;}
+ break;
+
+ case 191:
+#line 1771 "glslang.y"
+ {
+ TIntermNode* intermNode;
+ if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
+ parseContext.recover();
+ if (parseContext.boolErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
+ parseContext.recover();
+
+ if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode))
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ else {
+ parseContext.recover();
+ yyval.interm.intermTypedNode = 0;
+ }
+ ;}
+ break;
+
+ case 192:
+#line 1788 "glslang.y"
+ { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ;}
+ break;
+
+ case 193:
+#line 1788 "glslang.y"
+ {
+ parseContext.symbolTable.pop();
+ yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, true, yyvsp[-5].lex.line);
+ --parseContext.loopNestingLevel;
+ ;}
+ break;
+
+ case 194:
+#line 1793 "glslang.y"
+ { ++parseContext.loopNestingLevel; ;}
+ break;
+
+ case 195:
+#line 1793 "glslang.y"
+ {
+ if (parseContext.boolErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.intermTypedNode))
+ parseContext.recover();
+
+ yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[-5].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, false, yyvsp[-4].lex.line);
+ --parseContext.loopNestingLevel;
+ ;}
+ break;
+
+ case 196:
+#line 1800 "glslang.y"
+ { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ;}
+ break;
+
+ case 197:
+#line 1800 "glslang.y"
+ {
+ parseContext.symbolTable.pop();
+ yyval.interm.intermNode = parseContext.intermediate.makeAggregate(yyvsp[-3].interm.intermNode, yyvsp[-5].lex.line);
+ yyval.interm.intermNode = parseContext.intermediate.growAggregate(
+ yyval.interm.intermNode,
+ parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node1), reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node2), true, yyvsp[-6].lex.line),
+ yyvsp[-6].lex.line);
+ yyval.interm.intermNode->getAsAggregate()->setOperator(EOpSequence);
+ --parseContext.loopNestingLevel;
+ ;}
+ break;
+
+ case 198:
+#line 1813 "glslang.y"
+ {
+ yyval.interm.intermNode = yyvsp[0].interm.intermNode;
+ ;}
+ break;
+
+ case 199:
+#line 1816 "glslang.y"
+ {
+ yyval.interm.intermNode = yyvsp[0].interm.intermNode;
+ ;}
+ break;
+
+ case 200:
+#line 1822 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 201:
+#line 1825 "glslang.y"
+ {
+ yyval.interm.intermTypedNode = 0;
+ ;}
+ break;
+
+ case 202:
+#line 1831 "glslang.y"
+ {
+ yyval.interm.nodePair.node1 = yyvsp[-1].interm.intermTypedNode;
+ yyval.interm.nodePair.node2 = 0;
+ ;}
+ break;
+
+ case 203:
+#line 1835 "glslang.y"
+ {
+ yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermTypedNode;
+ yyval.interm.nodePair.node2 = yyvsp[0].interm.intermTypedNode;
+ ;}
+ break;
+
+ case 204:
+#line 1842 "glslang.y"
+ {
+ if (parseContext.loopNestingLevel <= 0) {
+ parseContext.error(yyvsp[-1].lex.line, "continue statement only allowed in loops", "", "");
+ parseContext.recover();
+ }
+ yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpContinue, yyvsp[-1].lex.line);
+ ;}
+ break;
+
+ case 205:
+#line 1849 "glslang.y"
+ {
+ if (parseContext.loopNestingLevel <= 0) {
+ parseContext.error(yyvsp[-1].lex.line, "break statement only allowed in loops", "", "");
+ parseContext.recover();
+ }
+ yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpBreak, yyvsp[-1].lex.line);
+ ;}
+ break;
+
+ case 206:
+#line 1856 "glslang.y"
+ {
+ yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].lex.line);
+ if (parseContext.currentFunctionType->getBasicType() != EbtVoid) {
+ parseContext.error(yyvsp[-1].lex.line, "non-void function must return a value", "return", "");
+ parseContext.recover();
+ }
+ ;}
+ break;
+
+ case 207:
+#line 1863 "glslang.y"
+ {
+ yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
+ parseContext.functionReturnsValue = true;
+ if (parseContext.currentFunctionType->getBasicType() == EbtVoid) {
+ parseContext.error(yyvsp[-2].lex.line, "void function cannot return a value", "return", "");
+ parseContext.recover();
+ } else if (*(parseContext.currentFunctionType) != yyvsp[-1].interm.intermTypedNode->getType()) {
+ parseContext.error(yyvsp[-2].lex.line, "function return is not matching type:", "return", "");
+ parseContext.recover();
+ }
+ ;}
+ break;
+
+ case 208:
+#line 1874 "glslang.y"
+ {
+ FRAG_ONLY("discard", yyvsp[-1].lex.line);
+ yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpKill, yyvsp[-1].lex.line);
+ ;}
+ break;
+
+ case 209:
+#line 1883 "glslang.y"
+ {
+ yyval.interm.intermNode = yyvsp[0].interm.intermNode;
+ parseContext.treeRoot = yyval.interm.intermNode;
+ ;}
+ break;
+
+ case 210:
+#line 1887 "glslang.y"
+ {
+ yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermNode, yyvsp[0].interm.intermNode, 0);
+ parseContext.treeRoot = yyval.interm.intermNode;
+ ;}
+ break;
+
+ case 211:
+#line 1894 "glslang.y"
+ {
+ yyval.interm.intermNode = yyvsp[0].interm.intermNode;
+ ;}
+ break;
+
+ case 212:
+#line 1897 "glslang.y"
+ {
+ yyval.interm.intermNode = yyvsp[0].interm.intermNode;
+ ;}
+ break;
+
+ case 213:
+#line 1903 "glslang.y"
+ {
+ TFunction& function = *(yyvsp[0].interm.function);
+ TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(function.getMangledName()));
+ //
+ // Note: 'prevDec' could be 'function' if this is the first time we've seen function
+ // as it would have just been put in the symbol table. Otherwise, we're looking up
+ // an earlier occurance.
+ //
+ if (prevDec->isDefined()) {
+ //
+ // Then this function already has a body.
+ //
+ parseContext.error(yyvsp[0].interm.line, "function already has a body", function.getName().c_str(), "");
+ parseContext.recover();
+ }
+ prevDec->setDefined();
+
+ //
+ // Raise error message if main function takes any parameters or return anything other than void
+ //
+ if (function.getName() == "main") {
+ if (function.getParamCount() > 0) {
+ parseContext.error(yyvsp[0].interm.line, "function cannot take any parameter(s)", function.getName().c_str(), "");
+ parseContext.recover();
+ }
+ if (function.getReturnType().getBasicType() != EbtVoid) {
+ parseContext.error(yyvsp[0].interm.line, "", function.getReturnType().getBasicString(), "main function cannot return a value" );
+ parseContext.recover();
+ }
+ }
+
+ //
+ // New symbol table scope for body of function plus its arguments
+ //
+ parseContext.symbolTable.push();
+
+ //
+ // Remember the return type for later checking for RETURN statements.
+ //
+ parseContext.currentFunctionType = &(prevDec->getReturnType());
+ parseContext.functionReturnsValue = false;
+
+ //
+ // Insert parameters into the symbol table.
+ // If the parameter has no name, it's not an error, just don't insert it
+ // (could be used for unused args).
+ //
+ // Also, accumulate the list of parameters into the HIL, so lower level code
+ // knows where to find parameters.
+ //
+ TIntermAggregate* paramNodes = new TIntermAggregate;
+ for (int i = 0; i < function.getParamCount(); i++) {
+ TParameter& param = function[i];
+ if (param.name != 0) {
+ TVariable *variable = new TVariable(param.name, *param.type);
+ //
+ // Insert the parameters with name in the symbol table.
+ //
+ if (! parseContext.symbolTable.insert(*variable)) {
+ parseContext.error(yyvsp[0].interm.line, "redefinition", variable->getName().c_str(), "");
+ parseContext.recover();
+ delete variable;
+ }
+ //
+ // Transfer ownership of name pointer to symbol table.
+ //
+ param.name = 0;
+
+ //
+ // Add the parameter to the HIL
+ //
+ paramNodes = parseContext.intermediate.growAggregate(
+ paramNodes,
+ parseContext.intermediate.addSymbol(variable->getUniqueId(),
+ variable->getName(),
+ variable->getType(), yyvsp[0].interm.line),
+ yyvsp[0].interm.line);
+ } else {
+ paramNodes = parseContext.intermediate.growAggregate(paramNodes, parseContext.intermediate.addSymbol(0, "", *param.type, yyvsp[0].interm.line), yyvsp[0].interm.line);
+ }
+ }
+ parseContext.intermediate.setAggregateOperator(paramNodes, EOpParameters, yyvsp[0].interm.line);
+ yyvsp[0].interm.intermAggregate = paramNodes;
+ parseContext.loopNestingLevel = 0;
+ ;}
+ break;
+
+ case 214:
+#line 1988 "glslang.y"
+ {
+ //?? Check that all paths return a value if return type != void ?
+ // May be best done as post process phase on intermediate code
+ if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) {
+ parseContext.error(yyvsp[-2].interm.line, "function does not return a value:", "", yyvsp[-2].interm.function->getName().c_str());
+ parseContext.recover();
+ }
+ parseContext.symbolTable.pop();
+ yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);
+ parseContext.intermediate.setAggregateOperator(yyval.interm.intermNode, EOpFunction, yyvsp[-2].interm.line);
+ yyval.interm.intermNode->getAsAggregate()->setName(yyvsp[-2].interm.function->getMangledName().c_str());
+ yyval.interm.intermNode->getAsAggregate()->setType(yyvsp[-2].interm.function->getReturnType());
+
+ // store the pragma information for debug and optimize and other vendor specific
+ // information. This information can be queried from the parse tree
+ yyval.interm.intermNode->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
+ yyval.interm.intermNode->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
+ yyval.interm.intermNode->getAsAggregate()->addToPragmaTable(parseContext.contextPragma.pragmaTable);
+ ;}
+ break;
+
+
+ }
+
+/* Line 999 of yacc.c. */
+#line 4158 "glslang.tab.c"
+\f
+ 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);
+ char *yymsg;
+ int yyx, yycount;
+
+ yycount = 0;
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ yysize += yystrlen (yytname[yyx]) + 15, yycount++;
+ yysize += yystrlen ("syntax error, unexpected ") + 1;
+ yysize += 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)
+ {
+ yycount = 0;
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *));
+ yyx++)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ const char *yyq = ! yycount ? ", expecting " : " or ";
+ yyp = yystpcpy (yyp, yyq);
+ yyp = yystpcpy (yyp, yytname[yyx]);
+ yycount++;
+ }
+ }
+ 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. */
+
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ {
+ /* Pop the error token. */
+ YYPOPSTACK;
+ /* Pop the rest of the stack. */
+ while (yyss < yyssp)
+ {
+ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+ yydestruct (yystos[*yyssp], yyvsp);
+ YYPOPSTACK;
+ }
+ YYABORT;
+ }
+
+ 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;
+
+
+/*----------------------------------------------------.
+| yyerrlab1 -- error raised explicitly by an action. |
+`----------------------------------------------------*/
+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);
+ yyvsp--;
+ 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 209 "glslang.y"
+
+
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
void TInfoSinkBase::append(int count, char c) \r
{ \r
if (outputStream & EString) {\r
- checkMem(1); \r
+ checkMem(count); \r
sink.append(count, c); \r
}\r
\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
\r
#include "../Include/intermediate.h"\r
#include "Initialize.h"\r
-#include <assert.h>\r
\r
-void TBuiltIns::initialize(TBuiltInResource &resources)\r
+void TBuiltIns::initialize()\r
{\r
//\r
// Initialize all the built-in strings for parsing.\r
// Texture Functions.\r
//\r
s.append(TString("vec4 texture1D(sampler1D sampler, float coord);"));\r
- s.append(TString("vec4 texture1D(sampler1D sampler, float coord, float bias);"));\r
s.append(TString("vec4 texture1DProj(sampler1D sampler, vec2 coord);"));\r
- s.append(TString("vec4 texture1DProj(sampler1D sampler, vec2 coord, float bias);"));\r
s.append(TString("vec4 texture1DProj(sampler1D sampler, vec4 coord);"));\r
- s.append(TString("vec4 texture1DProj(sampler1D sampler, vec4 coord, float bias);"));\r
- s.append(TString("vec4 texture1DLod(sampler1D sampler, float coord, float lod);"));\r
- s.append(TString("vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);"));\r
- s.append(TString("vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);"));\r
\r
s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord);"));\r
- s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord, float bias);"));\r
s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord);"));\r
- s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord, float bias);"));\r
s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord);"));\r
- s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias);"));\r
- s.append(TString("vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);"));\r
- s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);"));\r
- s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);"));\r
\r
s.append(TString("vec4 texture3D(sampler3D sampler, vec3 coord);"));\r
- s.append(TString("vec4 texture3D(sampler3D sampler, vec3 coord, float bias);"));\r
s.append(TString("vec4 texture3DProj(sampler3D sampler, vec4 coord);"));\r
- s.append(TString("vec4 texture3DProj(sampler3D sampler, vec4 coord, float bias);"));\r
- s.append(TString("vec4 texture3DLod(sampler3D sampler, vec3 coord, float lod);"));\r
- s.append(TString("vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);"));\r
\r
s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord);"));\r
- s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord, float bias);"));\r
- s.append(TString("vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);"));\r
\r
s.append(TString("vec4 shadow1D(sampler1DShadow sampler, vec3 coord);"));\r
- s.append(TString("vec4 shadow1D(sampler1DShadow sampler, vec3 coord, float bias);"));\r
\r
s.append(TString("vec4 shadow2D(sampler2DShadow sampler, vec3 coord);"));\r
- s.append(TString("vec4 shadow2D(sampler2DShadow sampler, vec3 coord, float bias);"));\r
\r
s.append(TString("vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord);"));\r
- s.append(TString("vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord, float bias);"));\r
\r
s.append(TString("vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord);"));\r
- s.append(TString("vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord, float bias);"));\r
-\r
- s.append(TString("vec4 shadow1DLod(sampler1DShadow sampler, vec3 coord, float lod);"));\r
- s.append(TString("vec4 shadow2DLod(sampler2DShadow sampler, vec3 coord, float lod);"));\r
\r
- s.append(TString("vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);"));\r
- s.append(TString("vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);"));\r
\r
//\r
// Noise functions.\r
//\r
s.append(TString("vec4 ftransform();"));\r
\r
+ //\r
+ // Texture Functions.\r
+ //\r
+ s.append(TString("vec4 texture1DLod(sampler1D sampler, float coord, float lod);"));\r
+ s.append(TString("vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);"));\r
+ s.append(TString("vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);"));\r
+\r
+ s.append(TString("vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);"));\r
+ s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);"));\r
+ s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);"));\r
+\r
+ s.append(TString("vec4 texture3DLod(sampler3D sampler, vec3 coord, float lod);"));\r
+ s.append(TString("vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);"));\r
+ s.append(TString("vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);"));\r
+\r
+ s.append(TString("vec4 shadow1DLod(sampler1DShadow sampler, vec3 coord, float lod);"));\r
+ s.append(TString("vec4 shadow2DLod(sampler2DShadow sampler, vec3 coord, float lod);"));\r
+ s.append(TString("vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);"));\r
+ s.append(TString("vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);"));\r
+\r
s.append(TString("\n"));\r
}\r
{\r
\r
TString& s = BuiltInFunctionsFragment;\r
\r
+ //\r
+ // Texture Functions.\r
+ //\r
+ s.append(TString("vec4 texture1D(sampler1D sampler, float coord, float bias);"));\r
+ s.append(TString("vec4 texture1DProj(sampler1D sampler, vec2 coord, float bias);"));\r
+ s.append(TString("vec4 texture1DProj(sampler1D sampler, vec4 coord, float bias);"));\r
+\r
+ s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord, float bias);"));\r
+ s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord, float bias);"));\r
+ s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias);"));\r
+\r
+ s.append(TString("vec4 texture3D(sampler3D sampler, vec3 coord, float bias);"));\r
+ s.append(TString("vec4 texture3DProj(sampler3D sampler, vec4 coord, float bias);"));\r
+ s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord, float bias);"));\r
+ \r
+ s.append(TString("vec4 shadow1D(sampler1DShadow sampler, vec3 coord, float bias);"));\r
+ s.append(TString("vec4 shadow2D(sampler2DShadow sampler, vec3 coord, float bias);"));\r
+ s.append(TString("vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord, float bias);"));\r
+ s.append(TString("vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord, float bias);"));\r
+\r
s.append(TString("float dFdx(float p);"));\r
s.append(TString("vec2 dFdx(vec2 p);"));\r
s.append(TString("vec3 dFdx(vec3 p);"));\r
\r
TString& s = StandardUniforms;\r
\r
- //\r
- // Implementation dependent constants. The example values below\r
- // are the minimum values allowed for these maximums.\r
- //\r
- char builtInConstant[80];\r
- sprintf(builtInConstant, "const int gl_MaxLights = %d;", resources.maxLights); // GL 1.0\r
- s.append(TString(builtInConstant)); \r
- \r
- sprintf(builtInConstant, "const int gl_MaxClipPlanes = %d;", resources.maxClipPlanes); // GL 1.0\r
- s.append(TString(builtInConstant));\r
- \r
- sprintf(builtInConstant, "const int gl_MaxTextureUnits = %d;", resources.maxTextureUnits); // GL 1.2\r
- s.append(TString(builtInConstant));\r
- \r
- sprintf(builtInConstant, "const int gl_MaxTextureCoords = %d;", resources.maxTextureCoords); // ARB_fragment_program\r
- s.append(TString(builtInConstant));\r
- \r
- sprintf(builtInConstant, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs); // ARB_vertex_shader\r
- s.append(TString(builtInConstant));\r
- \r
- sprintf(builtInConstant, "const int gl_MaxVertexUniformComponents = %d;", resources.maxVertexUniformComponents); // ARB_vertex_shader\r
- s.append(TString(builtInConstant)); \r
- \r
- sprintf(builtInConstant, "const int gl_MaxVaryingFloats = %d;", resources.maxVaryingFloats); // ARB_vertex_shader\r
- s.append(TString(builtInConstant)); \r
- \r
- sprintf(builtInConstant, "const int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits); // ARB_vertex_shader\r
- s.append(TString(builtInConstant)); \r
- \r
- sprintf(builtInConstant, "const int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits); // ARB_vertex_shader\r
- s.append(TString(builtInConstant)); \r
- \r
- sprintf(builtInConstant, "const int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits); // ARB_fragment_shader\r
- s.append(TString(builtInConstant)); \r
- \r
- sprintf(builtInConstant, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents); // ARB_fragment_shader\r
- s.append(TString(builtInConstant)); \r
- \r
- sprintf(builtInConstant, "const int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers); // proposed ARB_draw_buffers\r
- s.append(TString(builtInConstant));\r
\r
//\r
// OpenGL'uniform' state. Page numbers are in reference to version\r
s.append(TString("uniform mat4 gl_ModelViewMatrix;"));\r
s.append(TString("uniform mat4 gl_ProjectionMatrix;"));\r
s.append(TString("uniform mat4 gl_ModelViewProjectionMatrix;"));\r
- s.append(TString("uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];"));\r
\r
//\r
// Derived matrix state that provides inverse and transposed versions\r
s.append(TString("uniform mat4 gl_ModelViewMatrixInverse;"));\r
s.append(TString("uniform mat4 gl_ProjectionMatrixInverse;"));\r
s.append(TString("uniform mat4 gl_ModelViewProjectionMatrixInverse;"));\r
- s.append(TString("uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];"));\r
\r
s.append(TString("uniform mat4 gl_ModelViewMatrixTranspose;"));\r
s.append(TString("uniform mat4 gl_ProjectionMatrixTranspose;"));\r
s.append(TString("uniform mat4 gl_ModelViewProjectionMatrixTranspose;"));\r
- s.append(TString("uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];"));\r
\r
s.append(TString("uniform mat4 gl_ModelViewMatrixInverseTranspose;"));\r
s.append(TString("uniform mat4 gl_ProjectionMatrixInverseTranspose;"));\r
s.append(TString("uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;"));\r
- s.append(TString("uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];"));\r
\r
//\r
// Normal scaling p. 39.\r
s.append(TString("};"));\r
s.append(TString("uniform gl_DepthRangeParameters gl_DepthRange;"));\r
\r
- //\r
- // Clip planes p. 42.\r
- //\r
- s.append(TString("uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];"));\r
\r
//\r
// Point Size, p. 66, 67.\r
s.append(TString(" float quadraticAttenuation;"));// K2\r
s.append(TString("};"));\r
\r
- s.append(TString("uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];"));\r
\r
s.append(TString("struct gl_LightModelParameters {"));\r
s.append(TString(" vec4 ambient;")); // Acs\r
s.append(TString(" vec4 specular;")); // Scm * Scli\r
s.append(TString("};"));\r
\r
- s.append(TString("uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];"));\r
- s.append(TString("uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];"));\r
\r
- //\r
- // Textureg Environment and Generation, p. 152, p. 40-42.\r
- //\r
- s.append(TString("uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];"));\r
- s.append(TString("uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];"));\r
- s.append(TString("uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];"));\r
- s.append(TString("uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];"));\r
- s.append(TString("uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];"));\r
- s.append(TString("uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];"));\r
- s.append(TString("uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];"));\r
- s.append(TString("uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];"));\r
- s.append(TString("uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];"));\r
+\r
\r
//\r
// Fog p. 161\r
builtInStrings[EShLangVertex].push_back(StandardUniforms);\r
}\r
\r
-void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable, TBuiltInResource &resources)\r
+\r
+void TBuiltIns::initialize(const TBuiltInResource &resources)\r
+{\r
+ //\r
+ // Initialize all the built-in strings for parsing.\r
+ //\r
+ TString StandardUniforms; \r
+\r
+ {\r
+ //============================================================================\r
+ //\r
+ // Standard Uniforms\r
+ //\r
+ //============================================================================\r
+\r
+ TString& s = StandardUniforms;\r
+ \r
+ //\r
+ // Implementation dependent constants. The example values below\r
+ // are the minimum values allowed for these maximums.\r
+ //\r
+ char builtInConstant[80];\r
+ sprintf(builtInConstant, "const int gl_MaxLights = %d;", resources.maxLights); // GL 1.0\r
+ s.append(TString(builtInConstant)); \r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxClipPlanes = %d;", resources.maxClipPlanes); // GL 1.0\r
+ s.append(TString(builtInConstant));\r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxTextureUnits = %d;", resources.maxTextureUnits); // GL 1.2\r
+ s.append(TString(builtInConstant));\r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxTextureCoords = %d;", resources.maxTextureCoords); // ARB_fragment_program\r
+ s.append(TString(builtInConstant));\r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs); // ARB_vertex_shader\r
+ s.append(TString(builtInConstant));\r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxVertexUniformComponents = %d;", resources.maxVertexUniformComponents); // ARB_vertex_shader\r
+ s.append(TString(builtInConstant)); \r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxVaryingFloats = %d;", resources.maxVaryingFloats); // ARB_vertex_shader\r
+ s.append(TString(builtInConstant)); \r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits); // ARB_vertex_shader\r
+ s.append(TString(builtInConstant)); \r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits); // ARB_vertex_shader\r
+ s.append(TString(builtInConstant)); \r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits); // ARB_fragment_shader\r
+ s.append(TString(builtInConstant));\r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents); // ARB_fragment_shader\r
+ s.append(TString(builtInConstant));\r
+ \r
+ sprintf(builtInConstant, "const int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers); // proposed ARB_draw_buffers\r
+ s.append(TString(builtInConstant));\r
+\r
+ //\r
+ // OpenGL'uniform' state. Page numbers are in reference to version\r
+ // 1.4 of the OpenGL specification.\r
+ //\r
+\r
+ //\r
+ // Matrix state. p. 31, 32, 37, 39, 40.\r
+ //\r
+ s.append(TString("uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];"));\r
+\r
+ //\r
+ // Derived matrix state that provides inverse and transposed versions\r
+ // of the matrices above.\r
+ //\r
+ s.append(TString("uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];"));\r
+\r
+ s.append(TString("uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];"));\r
+\r
+ s.append(TString("uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];"));\r
+\r
+ //\r
+ // Clip planes p. 42.\r
+ //\r
+ s.append(TString("uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];"));\r
+\r
+ //\r
+ // Light State p 50, 53, 55.\r
+ //\r
+ s.append(TString("uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];"));\r
+\r
+ //\r
+ // Derived state from products of light.\r
+ //\r
+ s.append(TString("uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];"));\r
+ s.append(TString("uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];"));\r
+\r
+ //\r
+ // Textureg Environment and Generation, p. 152, p. 40-42.\r
+ //\r
+ s.append(TString("uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];"));\r
+ s.append(TString("uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];"));\r
+ s.append(TString("uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];"));\r
+ s.append(TString("uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];"));\r
+ s.append(TString("uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];"));\r
+ s.append(TString("uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];"));\r
+ s.append(TString("uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];"));\r
+ s.append(TString("uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];"));\r
+ s.append(TString("uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];"));\r
+\r
+ s.append(TString("\n"));\r
+ }\r
+\r
+ builtInStrings[EShLangFragment].push_back(StandardUniforms);\r
+ builtInStrings[EShLangVertex].push_back(StandardUniforms);\r
+}\r
+\r
+void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)\r
{\r
//\r
// First, insert some special built-in variables that are not in \r
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EvqFragColor, 4)));\r
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragDepth"), TType(EbtFloat, EvqFragDepth, 1)));\r
\r
- // Set up gl_FragData. The array size.\r
- TType fragData(EbtFloat, EvqFragColor, 4, false, true);\r
- fragData.setArraySize(resources.maxDrawBuffers);\r
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData));\r
}\r
break;\r
\r
symbolTable.relateToOperator("writeOutput", EOpWriteOutput);\r
symbolTable.relateToOperator("readPixel", EOpReadPixel);\r
break;\r
- default: assert (true && "Language not supported");\r
+ default: assert (false && "Language not supported");\r
+ }\r
+}\r
+\r
+void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)\r
+{\r
+ //\r
+ // First, insert some special built-in variables that are not in \r
+ // the built-in header files.\r
+ //\r
+ switch(language) {\r
+\r
+ case EShLangFragment: {\r
+ // Set up gl_FragData. The array size.\r
+ TType fragData(EbtFloat, EvqFragColor, 4, false, true);\r
+ fragData.setArraySize(resources.maxDrawBuffers);\r
+ symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData));\r
+ }\r
+ break;\r
+\r
+ default: break;\r
}\r
}\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
class TBuiltIns {\r
public:\r
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)\r
- void initialize(TBuiltInResource &resources);\r
+ void initialize();\r
+ void initialize(const TBuiltInResource& resources);\r
TBuiltInStrings* getBuiltInStrings() { return builtInStrings; }\r
protected:\r
TBuiltInStrings builtInStrings[EShLangCount];\r
};\r
\r
-void IdentifyBuiltIns(EShLanguage, TSymbolTable&, TBuiltInResource &resources);\r
+void IdentifyBuiltIns(EShLanguage, TSymbolTable&);\r
+void IdentifyBuiltIns(EShLanguage, TSymbolTable&, const TBuiltInResource &resources);\r
\r
#endif // _INITIALIZE_INCLUDED_\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
#include "localintermediate.h"\r
#include "QualifierAlive.h"\r
#include "RemoveTree.h"\r
-#include <assert.h>\r
#include <float.h>\r
\r
////////////////////////////////////////////////////////////////////////////\r
node->setLeft(base);\r
node->setRight(index);\r
\r
- // caller should set the type\r
+ // caller should set the type\r
\r
return node;\r
}\r
bool allConstant = true;\r
// check to see if there is an aggregate node\r
if (node->getAsAggregate()) {\r
+ if (node->getAsAggregate()->getOp() != EOpFunctionCall) {\r
+ // if the aggregate node is a constructor or a comma operator, look at its children, if they are constant\r
+ // convert them into the right type\r
TIntermSequence &sequenceVector = node->getAsAggregate()->getSequence() ;\r
for (TIntermSequence::iterator p = sequenceVector.begin(); \r
p != sequenceVector.end(); p++) {\r
if (!(*p)->getAsTyped()->getAsConstantUnion())\r
allConstant = false;\r
}\r
+ } else\r
+ allConstant = false;\r
}\r
if (allConstant && node->getAsAggregate()) { // we can do the constant folding here as all the nodes of the aggregate are const\r
TIntermSequence &sequenceVector = node->getAsAggregate()->getSequence() ;\r
return 0;\r
}\r
\r
- newNode = new TIntermUnary(newOp, TType(promoteTo, EvqTemporary,\r
- node->getNominalSize(), \r
- node->isMatrix(), \r
- node->isArray()));\r
+ TType type(promoteTo, EvqTemporary, node->getNominalSize(), node->isMatrix(), node->isArray());\r
+ newNode = new TIntermUnary(newOp, type);\r
newNode->setLine(node->getLine());\r
newNode->setOperand(node);\r
\r
return node;\r
}\r
\r
+\r
+TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc line)\r
+{\r
+ if (left->getType().getQualifier() == EvqConst && right->getType().getQualifier() == EvqConst) {\r
+ return right;\r
+ } else {\r
+ TIntermTyped *commaAggregate = growAggregate(left, right, line);\r
+ commaAggregate->getAsAggregate()->setOperator(EOpComma); \r
+ commaAggregate->setType(right->getType());\r
+ commaAggregate->getTypePointer()->changeQualifier(EvqTemporary);\r
+ return commaAggregate;\r
+ }\r
+}\r
+\r
//\r
// For "?:" test nodes. There are three children; a condition,\r
// a true path, and a false path. The two paths are specified\r
if (aggRoot && aggRoot->getOp() == EOpNull)\r
aggRoot->setOperator(EOpSequence);\r
\r
- //\r
- // Other things...\r
- //\r
-\r
- if (language == EShLangVertex && !QualifierWritten(root, EvqPosition)) {\r
- infoSink.info.message(EPrefixError, "gl_Position must be written by all paths through a vertex shader.");\r
- return false;\r
- }\r
-\r
return true;\r
}\r
\r
//\r
void TIntermediate::remove(TIntermNode* root)\r
{\r
- if (root)\r
- RemoveAllTreeNodes(root);\r
+ if (root)\r
+ RemoveAllTreeNodes(root);\r
}\r
\r
////////////////////////////////////////////////////////////////\r
case EOpAdd:\r
case EOpSub:\r
case EOpDiv:\r
- case EOpMod:\r
+ case EOpMod:\r
case EOpAddAssign:\r
case EOpSubAssign:\r
case EOpDivAssign:\r
return false;\r
setType(TType(type, EvqTemporary, size, left->isMatrix() || right->isMatrix()));\r
break;\r
- \r
- case EOpEqual:\r
+ \r
+ case EOpEqual:\r
case EOpNotEqual:\r
case EOpLessThan:\r
case EOpGreaterThan:\r
return true;\r
}\r
\r
-bool compareStructure(TType leftNodeType, constUnion* rightUnionArray, constUnion* leftUnionArray, int& index)\r
+bool compareStructure(const TType& leftNodeType, constUnion* rightUnionArray, constUnion* leftUnionArray, int& index)\r
{\r
TTypeList* fields = leftNodeType.getStruct();\r
\r
TIntermConstantUnion *node = constantNode->getAsConstantUnion();\r
TIntermConstantUnion *newNode;\r
constUnion* tempConstArray;\r
- int i;\r
switch(op) {\r
case EOpAdd: \r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) {\r
- switch (this->getType().getBasicType()) {\r
- case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst + node->getUnionArrayPointer()->fConst; break;\r
- case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst + node->getUnionArrayPointer()->iConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"+\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) {\r
+ switch (this->getType().getBasicType()) {\r
+ case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst + node->getUnionArrayPointer()->fConst; break;\r
+ case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst + node->getUnionArrayPointer()->iConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"+\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
case EOpMatrixTimesScalar: \r
case EOpVectorTimesScalar:\r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) {\r
- switch (this->getType().getBasicType()) {\r
- case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst * node->getUnionArrayPointer()->fConst; break;\r
- case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst * node->getUnionArrayPointer()->iConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"*\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) {\r
+ switch (this->getType().getBasicType()) {\r
+ case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst * node->getUnionArrayPointer()->fConst; break;\r
+ case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst * node->getUnionArrayPointer()->iConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"*\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
case EOpSub:\r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) {\r
- switch (this->getType().getBasicType()) {\r
- case EbtFloat: \r
- if (leftOperand)\r
- tempConstArray[i].fConst = unionArray[i].fConst - node->getUnionArrayPointer()->fConst; \r
- else\r
- tempConstArray[i].fConst = node->getUnionArrayPointer()->fConst - unionArray[i].fConst; \r
- break;\r
-\r
- case EbtInt: \r
- if (leftOperand) \r
- tempConstArray[i].iConst = unionArray[i].iConst - node->getUnionArrayPointer()->iConst; \r
- else\r
- tempConstArray[i].iConst = node->getUnionArrayPointer()->iConst - unionArray[i].iConst; \r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) {\r
+ switch (this->getType().getBasicType()) {\r
+ case EbtFloat: \r
+ if (leftOperand)\r
+ tempConstArray[i].fConst = unionArray[i].fConst - node->getUnionArrayPointer()->fConst; \r
+ else\r
+ tempConstArray[i].fConst = node->getUnionArrayPointer()->fConst - unionArray[i].fConst; \r
break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"-\"", this->getLine());\r
- return 0;\r
+\r
+ case EbtInt: \r
+ if (leftOperand) \r
+ tempConstArray[i].iConst = unionArray[i].iConst - node->getUnionArrayPointer()->iConst; \r
+ else\r
+ tempConstArray[i].iConst = node->getUnionArrayPointer()->iConst - unionArray[i].iConst; \r
+ break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"-\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
\r
case EOpDiv:\r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) {\r
- switch (this->getType().getBasicType()) {\r
- case EbtFloat: \r
- if (leftOperand) {\r
- if (node->getUnionArrayPointer()->fConst == 0.0) {\r
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
- tempConstArray[i].fConst = FLT_MAX;\r
- } else\r
- tempConstArray[i].fConst = unionArray[i].fConst / node->getUnionArrayPointer()->fConst; \r
- } else {\r
- if (unionArray[i].fConst == 0.0) {\r
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
- tempConstArray[i].fConst = FLT_MAX;\r
- } else\r
- tempConstArray[i].fConst = node->getUnionArrayPointer()->fConst / unionArray[i].fConst; \r
- }\r
- break;\r
-\r
- case EbtInt: \r
- if (leftOperand) {\r
- if (node->getUnionArrayPointer()->iConst == 0) {\r
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
- tempConstArray[i].iConst = INT_MAX;\r
- } else\r
- tempConstArray[i].iConst = unionArray[i].iConst / node->getUnionArrayPointer()->iConst; \r
- } else {\r
- if (unionArray[i].iConst == 0) {\r
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
- tempConstArray[i].iConst = INT_MAX;\r
- } else\r
- tempConstArray[i].iConst = node->getUnionArrayPointer()->iConst / unionArray[i].iConst; \r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) {\r
+ switch (this->getType().getBasicType()) {\r
+ case EbtFloat: \r
+ if (leftOperand) {\r
+ if (node->getUnionArrayPointer()->fConst == 0.0) {\r
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
+ tempConstArray[i].fConst = FLT_MAX;\r
+ } else\r
+ tempConstArray[i].fConst = unionArray[i].fConst / node->getUnionArrayPointer()->fConst; \r
+ } else {\r
+ if (unionArray[i].fConst == 0.0) {\r
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
+ tempConstArray[i].fConst = FLT_MAX;\r
+ } else\r
+ tempConstArray[i].fConst = node->getUnionArrayPointer()->fConst / unionArray[i].fConst; \r
+ }\r
+ break;\r
+\r
+ case EbtInt: \r
+ if (leftOperand) {\r
+ if (node->getUnionArrayPointer()->iConst == 0) {\r
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
+ tempConstArray[i].iConst = INT_MAX;\r
+ } else\r
+ tempConstArray[i].iConst = unionArray[i].iConst / node->getUnionArrayPointer()->iConst; \r
+ } else {\r
+ if (unionArray[i].iConst == 0) {\r
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
+ tempConstArray[i].iConst = INT_MAX;\r
+ } else\r
+ tempConstArray[i].iConst = node->getUnionArrayPointer()->iConst / unionArray[i].iConst; \r
+ }\r
+ break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", this->getLine());\r
+ return 0;\r
}\r
- break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", this->getLine());\r
- return 0;\r
}\r
}\r
break;\r
\r
case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently\r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) {\r
- switch (this->getType().getBasicType()) {\r
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst && node->getUnionArrayPointer()->bConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"&&\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) {\r
+ switch (this->getType().getBasicType()) {\r
+ case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst && node->getUnionArrayPointer()->bConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"&&\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
\r
case EOpLogicalXor: // this code is written for possible future use, will not get executed currently\r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) {\r
- switch (this->getType().getBasicType()) {\r
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst ^ node->getUnionArrayPointer()->bConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"^^\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) {\r
+ switch (this->getType().getBasicType()) {\r
+ case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst ^ node->getUnionArrayPointer()->bConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"^^\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
\r
- case EOpLogicalOr: // this code is written for possible future use, will not get executed currently\r
+ case EOpLogicalOr: // this code is written for possible future use, will not get executed currently \r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) {\r
- switch (this->getType().getBasicType()) {\r
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst || node->getUnionArrayPointer()->bConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"||\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) {\r
+ switch (this->getType().getBasicType()) {\r
+ case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst || node->getUnionArrayPointer()->bConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"||\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
TIntermConstantUnion *tempNode;\r
int index = 0;\r
bool boolNodeFlag = false;\r
- int i;\r
switch(op) {\r
case EOpAdd: \r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) { \r
- switch (this->getType().getBasicType()) {\r
- case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst + rightUnionArray[i].fConst; break;\r
- case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst + rightUnionArray[i].iConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"+\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ switch (this->getType().getBasicType()) {\r
+ case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst + rightUnionArray[i].fConst; break;\r
+ case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst + rightUnionArray[i].iConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"+\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
case EOpSub: \r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) { \r
- switch (this->getType().getBasicType()) { \r
- case EbtFloat: \r
- if (leftOperand)\r
- tempConstArray[i].fConst = unionArray[i].fConst - rightUnionArray[i].fConst; \r
- else\r
- tempConstArray[i].fConst = rightUnionArray[i].fConst - unionArray[i].fConst; \r
- break;\r
-\r
- case EbtInt: \r
- if (leftOperand) \r
- tempConstArray[i].iConst = unionArray[i].iConst - rightUnionArray[i].iConst;\r
- else\r
- tempConstArray[i].iConst = rightUnionArray[i].iConst - unionArray[i].iConst; \r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ switch (this->getType().getBasicType()) { \r
+ case EbtFloat: \r
+ if (leftOperand)\r
+ tempConstArray[i].fConst = unionArray[i].fConst - rightUnionArray[i].fConst; \r
+ else\r
+ tempConstArray[i].fConst = rightUnionArray[i].fConst - unionArray[i].fConst; \r
break;\r
+\r
+ case EbtInt: \r
+ if (leftOperand) \r
+ tempConstArray[i].iConst = unionArray[i].iConst - rightUnionArray[i].iConst;\r
+ else\r
+ tempConstArray[i].iConst = rightUnionArray[i].iConst - unionArray[i].iConst; \r
+ break;\r
\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"-\"", this->getLine());\r
- return 0;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"-\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
case EOpMul: \r
- {\r
- if (this->isVector()) { // two vectors multiplied together\r
- int size = this->getSize();\r
- tempConstArray = new constUnion[size];\r
- \r
- for (int i = 0; i < size; i++) { \r
- switch (this->getType().getBasicType()) {\r
- case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst * rightUnionArray[i].fConst; break;\r
- case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst * rightUnionArray[i].iConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for vector multiply", this->getLine());\r
- return 0;\r
- }\r
+ if (this->isVector()) { // two vectors multiplied together\r
+ int size = this->getSize();\r
+ tempConstArray = new constUnion[size];\r
+ \r
+ for (int i = 0; i < size; i++) { \r
+ switch (this->getType().getBasicType()) {\r
+ case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst * rightUnionArray[i].fConst; break;\r
+ case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst * rightUnionArray[i].iConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for vector multiply", this->getLine());\r
+ return 0;\r
}\r
- } \r
- }\r
+ }\r
+ } \r
break;\r
case EOpMatrixTimesMatrix: \r
- {\r
- if (this->getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat) {\r
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix multiply", this->getLine());\r
- return 0;\r
- }\r
+ if (this->getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat) {\r
+ infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix multiply", this->getLine());\r
+ return 0;\r
+ }\r
+ {// support MSVC++6.0\r
int size = this->getNominalSize();\r
tempConstArray = new constUnion[size*size];\r
for (int row = 0; row < size; row++) {\r
break;\r
case EOpDiv: \r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) { \r
- switch (this->getType().getBasicType()) {\r
- case EbtFloat: \r
- if (leftOperand) {\r
- if (rightUnionArray[i].fConst == 0.0) {\r
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
- tempConstArray[i].fConst = FLT_MAX;\r
- } else\r
- tempConstArray[i].fConst = unionArray[i].fConst / rightUnionArray[i].fConst; \r
- } else {\r
- if (unionArray[i].fConst == 0.0) {\r
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
- tempConstArray[i].fConst = FLT_MAX;\r
- } else\r
- tempConstArray[i].fConst = rightUnionArray[i].fConst / unionArray[i].fConst; \r
- }\r
- break;\r
-\r
- case EbtInt: \r
- if (leftOperand) {\r
- if (rightUnionArray[i].iConst == 0) {\r
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
- tempConstArray[i].iConst = INT_MAX;\r
- } else\r
- tempConstArray[i].iConst = unionArray[i].iConst / rightUnionArray[i].iConst; \r
- } else {\r
- if (unionArray[i].iConst == 0) {\r
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
- tempConstArray[i].iConst = INT_MAX;\r
- } else\r
- tempConstArray[i].iConst = rightUnionArray[i].iConst / unionArray[i].iConst; \r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ switch (this->getType().getBasicType()) {\r
+ case EbtFloat: \r
+ if (leftOperand) {\r
+ if (rightUnionArray[i].fConst == 0.0) {\r
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
+ tempConstArray[i].fConst = FLT_MAX;\r
+ } else\r
+ tempConstArray[i].fConst = unionArray[i].fConst / rightUnionArray[i].fConst; \r
+ } else {\r
+ if (unionArray[i].fConst == 0.0) {\r
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
+ tempConstArray[i].fConst = FLT_MAX;\r
+ } else\r
+ tempConstArray[i].fConst = rightUnionArray[i].fConst / unionArray[i].fConst; \r
+ }\r
+ break;\r
+\r
+ case EbtInt: \r
+ if (leftOperand) {\r
+ if (rightUnionArray[i].iConst == 0) {\r
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
+ tempConstArray[i].iConst = INT_MAX;\r
+ } else\r
+ tempConstArray[i].iConst = unionArray[i].iConst / rightUnionArray[i].iConst; \r
+ } else {\r
+ if (unionArray[i].iConst == 0) {\r
+ infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());\r
+ tempConstArray[i].iConst = INT_MAX;\r
+ } else\r
+ tempConstArray[i].iConst = rightUnionArray[i].iConst / unionArray[i].iConst; \r
+ }\r
+ break; \r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", this->getLine());\r
+ return 0;\r
}\r
- break; \r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", this->getLine());\r
- return 0;\r
}\r
}\r
break;\r
if (node->getBasicType() != EbtFloat) {\r
infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix times vector", this->getLine());\r
return 0;\r
- } \r
+ }\r
tempConstArray = new constUnion[this->getNominalSize()];\r
- {\r
- for (int size = this->getNominalSize(), i = 0; i < size; i++) {\r
- tempConstArray[i].fConst = 0.0;\r
- for (int j = 0; j < size; j++) {\r
- tempConstArray[i].fConst += ((unionArray[j*size + i].fConst) * rightUnionArray[j].fConst); \r
- }\r
- }\r
- }\r
+ \r
+ {// support MSVC++6.0 \r
+ for (int size = this->getNominalSize(), i = 0; i < size; i++) {\r
+ tempConstArray[i].fConst = 0.0;\r
+ for (int j = 0; j < size; j++) {\r
+ tempConstArray[i].fConst += ((unionArray[j*size + i].fConst) * rightUnionArray[j].fConst); \r
+ }\r
+ }\r
+ }\r
\r
tempNode = new TIntermConstantUnion(tempConstArray, node->getType());\r
tempNode->setLine(this->getLine());\r
\r
return tempNode; \r
- \r
+\r
case EOpVectorTimesMatrix:\r
if (this->getType().getBasicType() != EbtFloat) {\r
infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for vector times matrix", this->getLine());\r
} \r
\r
tempConstArray = new constUnion[this->getNominalSize()];\r
- {\r
- for (int size = this->getNominalSize(), i = 0; i < size; i++) {\r
- tempConstArray[i].fConst = 0.0;\r
- for (int j = 0; j < size; j++) {\r
- tempConstArray[i].fConst += ((unionArray[j].fConst) * rightUnionArray[i*size + j].fConst); \r
- }\r
- }\r
+ {// support MSVC++6.0\r
+ for (int size = this->getNominalSize(), i = 0; i < size; i++) {\r
+ tempConstArray[i].fConst = 0.0;\r
+ for (int j = 0; j < size; j++) {\r
+ tempConstArray[i].fConst += ((unionArray[j].fConst) * rightUnionArray[i*size + j].fConst); \r
+ }\r
+ }\r
}\r
break;\r
\r
case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently\r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) { \r
- switch (this->getType().getBasicType()) {\r
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst && rightUnionArray[i].bConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"&&\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ switch (this->getType().getBasicType()) {\r
+ case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst && rightUnionArray[i].bConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"&&\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
\r
case EOpLogicalXor: // this code is written for possible future use, will not get executed currently\r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) { \r
- switch (this->getType().getBasicType()) {\r
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst ^ rightUnionArray[i].bConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"^^\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ switch (this->getType().getBasicType()) {\r
+ case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst ^ rightUnionArray[i].bConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"^^\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
\r
case EOpLogicalOr: // this code is written for possible future use, will not get executed currently\r
tempConstArray = new constUnion[this->getSize()];\r
- for (i = 0; i < this->getSize(); i++) { \r
- switch (this->getType().getBasicType()) {\r
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst || rightUnionArray[i].bConst; break;\r
- default: \r
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"||\"", this->getLine());\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ switch (this->getType().getBasicType()) {\r
+ case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst || rightUnionArray[i].bConst; break;\r
+ default: \r
+ infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"||\"", this->getLine());\r
+ return 0;\r
+ }\r
}\r
}\r
break;\r
\r
switch (this->getType().getBasicType()) {\r
case EbtFloat: \r
- for (i = 0; i < this->getSize(); i++) { \r
- if (unionArray[i].fConst != rightUnionArray[i].fConst) {\r
- boolNodeFlag = true;\r
- break; // break out of for loop\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ if (unionArray[i].fConst != rightUnionArray[i].fConst) {\r
+ boolNodeFlag = true;\r
+ break; // break out of for loop\r
+ }\r
}\r
}\r
break;\r
\r
case EbtInt: \r
- for (i = 0; i < this->getSize(); i++) { \r
- if (unionArray[i].iConst != rightUnionArray[i].iConst) {\r
- boolNodeFlag = true;\r
- break; // break out of for loop\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ if (unionArray[i].iConst != rightUnionArray[i].iConst) {\r
+ boolNodeFlag = true;\r
+ break; // break out of for loop\r
+ }\r
}\r
}\r
break;\r
case EbtBool: \r
- for (i = 0; i < this->getSize(); i++) { \r
- if (unionArray[i].bConst != rightUnionArray[i].bConst) {\r
- boolNodeFlag = true;\r
- break; // break out of for loop\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ if (unionArray[i].bConst != rightUnionArray[i].bConst) {\r
+ boolNodeFlag = true;\r
+ break; // break out of for loop\r
+ }\r
}\r
}\r
break;\r
case EOpNotEqual: \r
switch (this->getType().getBasicType()) {\r
case EbtFloat: \r
- for (i = 0; i < this->getSize(); i++) { \r
- if (unionArray[i].fConst == rightUnionArray[i].fConst) {\r
- boolNodeFlag = true;\r
- break; // break out of for loop\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ if (unionArray[i].fConst == rightUnionArray[i].fConst) {\r
+ boolNodeFlag = true;\r
+ break; // break out of for loop\r
+ }\r
}\r
}\r
break;\r
\r
case EbtInt: \r
- for (i = 0; i < this->getSize(); i++) { \r
- if (unionArray[i].iConst == rightUnionArray[i].iConst) {\r
- boolNodeFlag = true;\r
- break; // break out of for loop\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ if (unionArray[i].iConst == rightUnionArray[i].iConst) {\r
+ boolNodeFlag = true;\r
+ break; // break out of for loop\r
+ }\r
}\r
}\r
break;\r
case EbtBool: \r
- for (i = 0; i < this->getSize(); i++) { \r
- if (unionArray[i].bConst == rightUnionArray[i].bConst) {\r
- boolNodeFlag = true;\r
- break; // break out of for loop\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < this->getSize(); i++) { \r
+ if (unionArray[i].bConst == rightUnionArray[i].bConst) {\r
+ boolNodeFlag = true;\r
+ break; // break out of for loop\r
+ }\r
}\r
}\r
break;\r
}\r
\r
}\r
- TType t = node->getType();\r
+ \r
+ const TType& t = node->getType();\r
\r
return addConstantUnion(leftUnionArray, TType(promoteTo, t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine());\r
}\r
\r
TIntermSequence::iterator parentNodeIter;\r
TIntermSequence &childSequence = child->getSequence();\r
- int i;\r
\r
switch (child->getOp()) {\r
case EOpConstructMat2:\r
case EOpConstructMat3:\r
case EOpConstructMat4:\r
- for (i = 0; i < child->getType().getInstanceSize(); i++) {\r
- constUnion* constantUnion = new constUnion[1];\r
- if (i % (child->getType().getNominalSize() + 1) == 0) {\r
- *constantUnion = *(childSequence[0]->getAsConstantUnion()->getUnionArrayPointer());\r
- } else {\r
- switch (parentType.getBasicType()) {\r
- case EbtInt: constantUnion->iConst = 0; break;\r
- case EbtFloat: constantUnion->fConst = 0.0; break;\r
- case EbtBool: constantUnion->bConst = false; break;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < child->getType().getInstanceSize(); i++) {\r
+ constUnion* constantUnion = new constUnion[1];\r
+ if (i % (child->getType().getNominalSize() + 1) == 0) {\r
+ *constantUnion = *(childSequence[0]->getAsConstantUnion()->getUnionArrayPointer());\r
+ } else {\r
+ switch (parentType.getBasicType()) {\r
+ case EbtInt: constantUnion->iConst = 0; break;\r
+ case EbtFloat: constantUnion->fConst = 0.0; break;\r
+ case EbtBool: constantUnion->bConst = false; break;\r
+ }\r
}\r
+ TIntermConstantUnion *constant = new TIntermConstantUnion(constantUnion,\r
+ childSequence[0]->getAsConstantUnion()->getType());\r
+ constant->setLine(child->getLine());\r
+ parentNodeIter = parentSequence.begin() + offset + i;\r
+ parentSequence.insert(parentNodeIter, constant);\r
}\r
- TIntermConstantUnion *constant = new TIntermConstantUnion(constantUnion,\r
- childSequence[0]->getAsConstantUnion()->getType());\r
- constant->setLine(child->getLine());\r
- parentNodeIter = parentSequence.begin() + offset + i;\r
- parentSequence.insert(parentNodeIter, constant);\r
}\r
return true;\r
default:\r
return false;\r
}\r
}\r
+\r
+void TIntermAggregate::addToPragmaTable(const TPragmaTable& pTable)\r
+{\r
+ assert (!pragmaTable);\r
+ pragmaTable = new TPragmaTable();\r
+ *pragmaTable = pTable;\r
+}\r
+\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
return false;\r
}\r
\r
- bool tooBig = false;\r
+ enum {\r
+ exyzw,\r
+ ergba,\r
+ estpq\r
+ } fieldSet[4];\r
\r
for (int i = 0; i < fields.num; ++i) {\r
switch (compString[i]) {\r
- case 'x': case 'r': case 's': case '0':\r
+ case 'x': \r
fields.offsets[i] = 0;\r
+ fieldSet[i] = exyzw;\r
break;\r
- case 'y': case 'g': case 't': case '1':\r
+ case 'r': \r
+ fields.offsets[i] = 0;\r
+ fieldSet[i] = ergba;\r
+ break;\r
+ case 's':\r
+ fields.offsets[i] = 0;\r
+ fieldSet[i] = estpq;\r
+ break;\r
+ case 'y': \r
+ fields.offsets[i] = 1;\r
+ fieldSet[i] = exyzw;\r
+ break;\r
+ case 'g': \r
fields.offsets[i] = 1;\r
+ fieldSet[i] = ergba;\r
+ break;\r
+ case 't':\r
+ fields.offsets[i] = 1;\r
+ fieldSet[i] = estpq;\r
+ break;\r
+ case 'z': \r
+ fields.offsets[i] = 2;\r
+ fieldSet[i] = exyzw;\r
+ break;\r
+ case 'b': \r
+ fields.offsets[i] = 2;\r
+ fieldSet[i] = ergba;\r
break;\r
- case 'z': case 'b': case 'p': case '2':\r
- if (vecSize < 3)\r
- tooBig = true;\r
+ case 'p':\r
fields.offsets[i] = 2;\r
+ fieldSet[i] = estpq;\r
break;\r
- case 'w': case 'a': case 'q': case '3':\r
- if (vecSize < 4)\r
- tooBig = true;\r
+ \r
+ case 'w': \r
+ fields.offsets[i] = 3;\r
+ fieldSet[i] = exyzw;\r
+ break;\r
+ case 'a': \r
fields.offsets[i] = 3;\r
+ fieldSet[i] = ergba;\r
+ break;\r
+ case 'q':\r
+ fields.offsets[i] = 3;\r
+ fieldSet[i] = estpq;\r
break;\r
default:\r
error(line, "illegal vector field selection", compString.c_str(), "");\r
}\r
}\r
\r
- if (tooBig) {\r
+ for (int i = 0; i < fields.num; ++i) {\r
+ if (fields.offsets[i] >= vecSize) {\r
error(line, "vector field selection out of range", compString.c_str(), "");\r
return false;\r
}\r
\r
+ if (i > 0) {\r
+ if (fieldSet[i] != fieldSet[i-1]) {\r
+ error(line, "illegal - vector component fields not from the same set", compString.c_str(), "");\r
+ return false;\r
+ }\r
+ }\r
+ }\r
+\r
return true;\r
}\r
\r
TTypeList::iterator list;\r
TTypeList* structure = 0; // Store the information (vector) about the return type of the structure.\r
if (op == EOpConstructStruct) {\r
- TType ttype = fnCall->getReturnType();\r
+ const TType& ttype = fnCall->getReturnType();\r
structure = ttype.getStruct();\r
list = (*structure).begin();\r
}\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
EBhDisable\r
} TBehavior;\r
\r
+struct TPragma {\r
+ TPragma(bool o, bool d) : optimize(o), debug(d) { }\r
+ bool optimize;\r
+ bool debug;\r
+ TPragmaTable pragmaTable;\r
+};\r
+\r
//\r
// The following are extra variables needed during parsing, grouped together so\r
// they can be passed to the parser without needing a global.\r
TParseContext(TSymbolTable& symt, TIntermediate& interm, EShLanguage L, TInfoSink& is) : \r
intermediate(interm), symbolTable(symt), infoSink(is), language(L), treeRoot(0),\r
recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0), \r
- inTypeParen(false) { }\r
+ inTypeParen(false), contextPragma(true, false) { }\r
TIntermediate& intermediate; // to hold and build a parse tree\r
TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed\r
TInfoSink& infoSink;\r
TIntermTyped* addConstMatrixNode(int , TIntermTyped*, TSourceLoc);\r
TIntermTyped* addConstStruct(TString& , TIntermTyped*, TSourceLoc);\r
bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc);\r
- typedef std::map<TString, TString> PragmaStringMap;\r
- PragmaStringMap PragmaTable;\r
+ struct TPragma contextPragma;\r
TString HashErrMsg; \r
bool AfterEOF;\r
};\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
\r
#include "../Include/PoolAlloc.h"\r
#include "../Include/Common.h"\r
-#include <assert.h>\r
\r
#include "Include/InitializeGlobals.h"\r
#include "osinclude.h"\r
TThreadGlobalPools* threadData = new TThreadGlobalPools();\r
\r
threadData->globalPoolAllocator = globalPoolAllocator;\r
- threadData->compilerPoolAllocator = 0;\r
\r
OS_SetTLSValue(PoolIndex, threadData); \r
globalPoolAllocator->push();\r
threadData->globalPoolAllocator = poolAllocator;\r
}\r
\r
-PoolAllocatorPointer& GetCompilerPoolAllocator()\r
-{\r
- TThreadGlobalPools* threadData = static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));\r
-\r
- return threadData->compilerPoolAllocator;\r
-}\r
-\r
//\r
// Implement the functionality of the TPoolAllocator class, which\r
// is documented in PoolAlloc.h.\r
}\r
}\r
\r
+// Support MSVC++ 6.0\r
+const unsigned char TAllocation::guardBlockBeginVal = 0xfb;\r
+const unsigned char TAllocation::guardBlockEndVal = 0xfe;\r
+const unsigned char TAllocation::userDataFill = 0xcd;\r
+\r
+# ifdef GUARD_BLOCKS\r
+ const size_t TAllocation::guardBlockSize = 16;\r
+# else\r
+ const size_t TAllocation::guardBlockSize = 0;\r
+# endif\r
\r
//\r
// Check a single guard block for damage\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
extern "C" int FinalizePreprocessor(void);\r
extern void SetGlobalPoolAllocatorPtr(TPoolAllocator* poolAllocator);\r
\r
-bool generateBuiltInSymbolTable(TBuiltInResource& resources, TInfoSink&);\r
-bool initializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, TBuiltInResource &resources);\r
-void GenerateResources(TBuiltInResource& resources);\r
+bool generateBuiltInSymbolTable(const TBuiltInResource* resources, TInfoSink&, TSymbolTable*, EShLanguage language = EShLangCount);\r
+bool initializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, const TBuiltInResource *resources, TSymbolTable*);\r
+\r
+//\r
+// A symbol table for each language. Each has a different\r
+// set of built-ins, and we want to preserve that from\r
+// compile to compile.\r
+//\r
+TSymbolTable SymbolTables[EShLangCount];\r
\r
TPoolAllocator* PerProcessGPA = 0;\r
//\r
int ShInitialize()\r
{\r
TInfoSink infoSink;\r
- TBuiltInResource resources;\r
- GenerateResources(resources);\r
bool ret = true;\r
\r
if (!InitProcess())\r
// we need to have thread synchronization code around the initialization of per process\r
// global pool allocator\r
if (!PerProcessGPA) { \r
+ TPoolAllocator *builtInPoolAllocator = new TPoolAllocator(true);\r
+ builtInPoolAllocator->push();\r
+ TPoolAllocator* gPoolAllocator = &GlobalPoolAllocator;\r
+ SetGlobalPoolAllocatorPtr(builtInPoolAllocator);\r
+\r
+ TSymbolTable symTables[EShLangCount];\r
+ generateBuiltInSymbolTable(0, infoSink, symTables);\r
+\r
PerProcessGPA = new TPoolAllocator(true);\r
PerProcessGPA->push();\r
- \r
- TPoolAllocator* gPoolAllocator = &GlobalPoolAllocator;\r
- SetGlobalPoolAllocatorPtr(PerProcessGPA); \r
- ret = generateBuiltInSymbolTable(resources, infoSink);\r
+ SetGlobalPoolAllocatorPtr(PerProcessGPA);\r
+\r
+ SymbolTables[EShLangVertex].copyTable(symTables[EShLangVertex]);\r
+ SymbolTables[EShLangFragment].copyTable(symTables[EShLangFragment]);\r
+\r
SetGlobalPoolAllocatorPtr(gPoolAllocator);\r
+\r
+ symTables[EShLangVertex].pop();\r
+ symTables[EShLangFragment].pop();\r
+\r
+ builtInPoolAllocator->popAll();\r
+ delete builtInPoolAllocator; \r
+\r
}\r
\r
return ret ? 1 : 0;\r
DeleteUniformMap(base->getAsUniformMap());\r
}\r
\r
-//\r
-// A symbol table for each language. Each has a different\r
-// set of built-ins, and we want to preserve that from\r
-// compile to compile.\r
-//\r
-TSymbolTable SymbolTables[EShLangCount];\r
-\r
//\r
// Cleanup symbol tables\r
//\r
return 1;\r
}\r
\r
-//\r
-// This method is required only for Sh interface, not for OGLC interface\r
-//\r
-void GenerateResources(TBuiltInResource& resources)\r
-{ \r
- resources.maxLights = 32;\r
- resources.maxClipPlanes = 6;\r
- resources.maxTextureUnits = 32;\r
- resources.maxTextureCoords = 32;\r
- resources.maxVertexAttribs = 64;\r
- resources.maxVertexUniformComponents = 4096;\r
- resources.maxVaryingFloats = 64;\r
- resources.maxVertexTextureImageUnits = 32;\r
- resources.maxCombinedTextureImageUnits = 32;\r
- resources.maxTextureImageUnits = 32;\r
- resources.maxFragmentUniformComponents = 4096;\r
- resources.maxDrawBuffers = 32;\r
-}\r
-\r
//\r
// This function should be called only once by the Master Dll. Currently, this is being called for each thread \r
// which is incorrect. This is required to keep the Sh interface working for now and will eventually be called \r
// from master dll once.\r
//\r
-bool generateBuiltInSymbolTable(TBuiltInResource& resources, TInfoSink& infoSink)\r
+bool generateBuiltInSymbolTable(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable* symbolTables, EShLanguage language)\r
{\r
TBuiltIns builtIns;\r
- builtIns.initialize(resources);\r
- initializeSymbolTable(builtIns.getBuiltInStrings(), EShLangVertex, infoSink, resources);\r
- initializeSymbolTable(builtIns.getBuiltInStrings(), EShLangFragment, infoSink, resources);\r
+ \r
+ if (resources) {\r
+ builtIns.initialize(*resources);\r
+ initializeSymbolTable(builtIns.getBuiltInStrings(), language, infoSink, resources, symbolTables);\r
+ } else {\r
+ builtIns.initialize();\r
+ initializeSymbolTable(builtIns.getBuiltInStrings(), EShLangVertex, infoSink, resources, symbolTables);\r
+ initializeSymbolTable(builtIns.getBuiltInStrings(), EShLangFragment, infoSink, resources, symbolTables);\r
+ }\r
+\r
return true;\r
}\r
\r
-bool initializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, TBuiltInResource &resources)\r
+bool initializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, const TBuiltInResource* resources, TSymbolTable* symbolTables)\r
{\r
TIntermediate intermediate(infoSink);\r
- TSymbolTable& symbolTable = SymbolTables[language];\r
- TParseContext parseContext(symbolTable, intermediate, language, infoSink);\r
+ TSymbolTable* symbolTable;\r
+ \r
+ if (resources)\r
+ symbolTable = symbolTables;\r
+ else\r
+ symbolTable = &symbolTables[language];\r
+\r
+ TParseContext parseContext(*symbolTable, intermediate, language, infoSink);\r
\r
GlobalParseContext = &parseContext;\r
\r
setInitialState();\r
\r
- if (symbolTable.isEmpty()) {\r
+ assert (symbolTable->isEmpty() || symbolTable->atSharedBuiltInLevel());\r
\r
- //\r
- // Parse the built-ins. This should only happen once per\r
- // language symbol table.\r
- //\r
- // Push the symbol table to give it an initial scope. This\r
- // push should not have a corresponding pop, so that built-ins\r
- // are preserved, and the test for an empty table fails.\r
- //\r
-\r
- symbolTable.push();\r
- \r
- //Initialize the Preprocessor\r
- int ret = InitPreprocessor();\r
- if (ret) {\r
- infoSink.info.message(EPrefixInternalError, "Unable to intialize the Preprocessor");\r
+ //\r
+ // Parse the built-ins. This should only happen once per\r
+ // language symbol table.\r
+ //\r
+ // Push the symbol table to give it an initial scope. This\r
+ // push should not have a corresponding pop, so that built-ins\r
+ // are preserved, and the test for an empty table fails.\r
+ //\r
+\r
+ symbolTable->push();\r
+ \r
+ //Initialize the Preprocessor\r
+ int ret = InitPreprocessor();\r
+ if (ret) {\r
+ infoSink.info.message(EPrefixInternalError, "Unable to intialize the Preprocessor");\r
+ return false;\r
+ }\r
+ \r
+ for (TBuiltInStrings::iterator i = BuiltInStrings[parseContext.language].begin();\r
+ i != BuiltInStrings[parseContext.language].end();\r
+ ++i) {\r
+ const char* builtInShaders[1];\r
+ int builtInLengths[1];\r
+\r
+ builtInShaders[0] = (*i).c_str();\r
+ builtInLengths[0] = (int) (*i).size();\r
+\r
+ if (PaParseStrings(const_cast<char**>(builtInShaders), builtInLengths, 1, parseContext) != 0) {\r
+ infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");\r
return false;\r
}\r
- \r
- for (TBuiltInStrings::iterator i = BuiltInStrings[parseContext.language].begin();\r
- i != BuiltInStrings[parseContext.language].end();\r
- ++i) {\r
- const char* builtInShaders[1];\r
- int builtInLengths[1];\r
-\r
- builtInShaders[0] = (*i).c_str();\r
- builtInLengths[0] = (int) (*i).size();\r
-\r
- if (PaParseStrings(const_cast<char**>(builtInShaders), builtInLengths, 1, parseContext) != 0) {\r
- infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");\r
- return false;\r
- }\r
- }\r
+ }\r
\r
- IdentifyBuiltIns(parseContext.language, symbolTable, resources);\r
- FinalizePreprocessor();\r
+ if (resources) {\r
+ IdentifyBuiltIns(parseContext.language, *symbolTable, *resources);\r
+ } else { \r
+ IdentifyBuiltIns(parseContext.language, *symbolTable);\r
}\r
\r
+ FinalizePreprocessor();\r
+\r
return true;\r
}\r
\r
const char* const shaderStrings[],\r
const int numStrings,\r
const EShOptimizationLevel optLevel,\r
+ const TBuiltInResource* resources,\r
int debugOptions\r
)\r
{\r
TCompiler* compiler = base->getAsCompiler();\r
if (compiler == 0)\r
return 0;\r
-\r
+ \r
+ GlobalPoolAllocator.push();\r
compiler->infoSink.info.erase();\r
compiler->infoSink.debug.erase();\r
\r
\r
TIntermediate intermediate(compiler->infoSink);\r
TSymbolTable symbolTable(SymbolTables[compiler->getLanguage()]);\r
+ \r
+ generateBuiltInSymbolTable(resources, compiler->infoSink, &symbolTable, compiler->getLanguage());\r
+\r
TParseContext parseContext(symbolTable, intermediate, compiler->getLanguage(), compiler->infoSink);\r
parseContext.initializeExtensionBehavior();\r
\r
// be thrown away, then push a scope for the current shader's globals.\r
//\r
bool success = true;\r
- GlobalPoolAllocator.push();\r
+ \r
symbolTable.push();\r
if (!symbolTable.atGlobalLevel())\r
parseContext.infoSink.info.message(EPrefixInternalError, "Wrong symbol table level");\r
if (ret)\r
success = false;\r
\r
- if (! ret && parseContext.treeRoot) {\r
- if (parseContext.recoveredFromError) {\r
- parseContext.infoSink.info.prefix(EPrefixError);\r
- parseContext.infoSink.info << parseContext.numErrors << " compilation errors. No code generated.\n\n";\r
- success = false;\r
- if (debugOptions & EDebugOpIntermediate)\r
- intermediate.outputTree(parseContext.treeRoot);\r
- } else {\r
- if (optLevel == EShOptNoGeneration)\r
- parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested.");\r
- else {\r
- success = intermediate.postProcess(parseContext.treeRoot, parseContext.language);\r
-\r
- if (success) {\r
-\r
- if (debugOptions & EDebugOpIntermediate)\r
- intermediate.outputTree(parseContext.treeRoot);\r
-\r
- //\r
- // Call the machine dependent compiler\r
- //\r
- if (! compiler->compile(parseContext.treeRoot))\r
- success = false;\r
- }\r
+ if (success && parseContext.treeRoot) {\r
+ if (optLevel == EShOptNoGeneration)\r
+ parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested.");\r
+ else {\r
+ success = intermediate.postProcess(parseContext.treeRoot, parseContext.language);\r
+\r
+ if (success) {\r
+\r
+ if (debugOptions & EDebugOpIntermediate)\r
+ intermediate.outputTree(parseContext.treeRoot);\r
+\r
+ //\r
+ // Call the machine dependent compiler\r
+ //\r
+ if (! compiler->compile(parseContext.treeRoot))\r
+ success = false;\r
}\r
}\r
+ } else if (!success) {\r
+ parseContext.infoSink.info.prefix(EPrefixError);\r
+ parseContext.infoSink.info << parseContext.numErrors << " compilation errors. No code generated.\n\n";\r
+ success = false;\r
+ if (debugOptions & EDebugOpIntermediate)\r
+ intermediate.outputTree(parseContext.treeRoot);\r
}\r
\r
- intermediate.remove(parseContext.treeRoot);\r
+ intermediate.remove(parseContext.treeRoot);\r
\r
//\r
// Ensure symbol table is returned to the built-in level,\r
// throwing away all but the built-ins.\r
//\r
- while (! symbolTable.atBuiltInLevel())\r
+ while (! symbolTable.atSharedBuiltInLevel())\r
symbolTable.pop();\r
\r
FinalizePreprocessor();\r
return 0;\r
\r
THandleList cObjects;\r
- int i;\r
-\r
- for (i = 0; i < numHandles; ++i) {\r
- if (compHandles[i] == 0)\r
- return 0;\r
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(compHandles[i]);\r
- if (base->getAsLinker()) {\r
- cObjects.push_back(base->getAsLinker());\r
- }\r
- if (base->getAsCompiler())\r
- cObjects.push_back(base->getAsCompiler());\r
\r
-\r
- if (cObjects[i] == 0)\r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < numHandles; ++i) {\r
+ if (compHandles[i] == 0)\r
+ return 0;\r
+ TShHandleBase* base = reinterpret_cast<TShHandleBase*>(compHandles[i]);\r
+ if (base->getAsLinker()) {\r
+ cObjects.push_back(base->getAsLinker());\r
+ }\r
+ if (base->getAsCompiler())\r
+ cObjects.push_back(base->getAsCompiler());\r
+ \r
+ \r
+ if (cObjects[i] == 0)\r
+ return 0;\r
+ }\r
}\r
\r
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(linkHandle);\r
\r
linker->infoSink.info.erase();\r
\r
- for (i = 0; i < numHandles; ++i) {\r
- if (cObjects[i]->getAsCompiler()) {\r
- if (! cObjects[i]->getAsCompiler()->linkable()) {\r
- linker->infoSink.info.message(EPrefixError, "Not all shaders have valid object code."); \r
- return 0;\r
+ {// support MSVC++6.0\r
+ for (int i = 0; i < numHandles; ++i) {\r
+ if (cObjects[i]->getAsCompiler()) {\r
+ if (! cObjects[i]->getAsCompiler()->linkable()) {\r
+ linker->infoSink.info.message(EPrefixError, "Not all shaders have valid object code."); \r
+ return 0;\r
+ }\r
}\r
}\r
}\r
if (handle == 0)\r
return 0;\r
\r
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);\r
+ TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);\r
TLinker* linker = static_cast<TLinker*>(base->getAsLinker());\r
if (linker == 0)\r
return 0;\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
else if (isVector())\r
mangledName += 'v';\r
\r
- unsigned int i;\r
-\r
switch (type) {\r
case EbtFloat: mangledName += 'f'; break;\r
case EbtInt: mangledName += 'i'; break;\r
case EbtSamplerCube: mangledName += "sC"; break;\r
case EbtSampler1DShadow: mangledName += "sS1"; break;\r
case EbtSampler2DShadow: mangledName += "sS2"; break;\r
- case EbtStruct:\r
+ case EbtStruct: \r
mangledName += "struct-";\r
- mangledName += typeName;\r
- for (i = 0; i < structure->size(); ++i) {\r
- mangledName += '-';\r
- (*structure)[i].type->buildMangledName(mangledName);\r
+ if (typeName)\r
+ mangledName += *typeName;\r
+ {// support MSVC++6.0\r
+ for (unsigned int i = 0; i < structure->size(); ++i) {\r
+ mangledName += '-';\r
+ (*structure)[i].type->buildMangledName(mangledName);\r
+ }\r
}\r
default: \r
break;\r
//\r
TFunction::~TFunction()\r
{\r
- for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)\r
- delete (*i).type;\r
+ for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)\r
+ delete (*i).type;\r
}\r
\r
//\r
//\r
TSymbolTableLevel::~TSymbolTableLevel()\r
{\r
- for (tLevel::iterator it = level.begin(); it != level.end(); ++it)\r
- delete (*it).second;\r
+ for (tLevel::iterator it = level.begin(); it != level.end(); ++it)\r
+ delete (*it).second;\r
}\r
\r
//\r
}\r
}\r
} \r
+\r
+\r
+TSymbol::TSymbol(const TSymbol& copyOf)\r
+{\r
+ name = NewPoolTString(copyOf.name->c_str());\r
+ uniqueId = copyOf.uniqueId;\r
+}\r
+\r
+TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol(copyOf)\r
+{ \r
+ type.copyType(copyOf.type, remapper);\r
+ userType = copyOf.userType;\r
+ // for builtIn symbol table level, unionArray and arrayInformation pointers should be NULL\r
+ assert(copyOf.arrayInformationType == 0); \r
+ arrayInformationType = 0;\r
+\r
+ if (copyOf.unionArray) { \r
+ assert(!copyOf.type.getStruct()); \r
+ assert(copyOf.type.getInstanceSize() == 1);\r
+ unionArray = new constUnion[1];\r
+ switch (type.getBasicType()) {\r
+ case EbtFloat: unionArray[0].fConst = copyOf.unionArray[0].fConst; break;\r
+ case EbtInt: unionArray[0].iConst = copyOf.unionArray[0].iConst; break;\r
+ case EbtBool: unionArray[0].bConst = copyOf.unionArray[0].bConst; break;\r
+ default:\r
+ assert (false && "Unknown type");\r
+ }\r
+ } else\r
+ unionArray = 0;\r
+}\r
+\r
+TVariable* TVariable::clone(TStructureMap& remapper) \r
+{\r
+ TVariable *variable = new TVariable(*this, remapper);\r
+\r
+ return variable;\r
+}\r
+\r
+TFunction::TFunction(const TFunction& copyOf, TStructureMap& remapper) : TSymbol(copyOf)\r
+{ \r
+ for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {\r
+ TParameter param;\r
+ parameters.push_back(param);\r
+ parameters.back().copyParam(copyOf.parameters[i], remapper);\r
+ }\r
+\r
+ returnType.copyType(copyOf.returnType, remapper);\r
+ mangledName = copyOf.mangledName;\r
+ op = copyOf.op;\r
+ defined = copyOf.defined;\r
+}\r
+\r
+TFunction* TFunction::clone(TStructureMap& remapper) \r
+{\r
+ TFunction *function = new TFunction(*this, remapper);\r
+\r
+ return function;\r
+}\r
+\r
+TSymbolTableLevel* TSymbolTableLevel::clone(TStructureMap& remapper)\r
+{\r
+ TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();\r
+ tLevel::iterator iter;\r
+ for (iter = level.begin(); iter != level.end(); ++iter) {\r
+ symTableLevel->insert(*iter->second->clone(remapper));\r
+ }\r
+\r
+ return symTableLevel;\r
+}\r
+\r
+void TSymbolTable::copyTable(const TSymbolTable& copyOf)\r
+{\r
+ TStructureMap remapper;\r
+ uniqueId = copyOf.uniqueId;\r
+ for (unsigned int i = 0; i < copyOf.table.size(); ++i) {\r
+ table.push_back(copyOf.table[i]->clone(remapper));\r
+ }\r
+}\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
void setUniqueId(int id) { uniqueId = id; }\r
int getUniqueId() const { return uniqueId; }\r
virtual void dump(TInfoSink &infoSink) const = 0;\r
+ TSymbol(const TSymbol&);\r
+ virtual TSymbol* clone(TStructureMap& remapper) = 0;\r
\r
protected:\r
const TString *name;\r
//\r
class TVariable : public TSymbol {\r
public:\r
- TVariable(const TString *name, TType t, bool uT = false ) : TSymbol(name), type(t), userType(uT), unionArray(0), arrayInformationType(0) { }\r
+ TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), type(t), userType(uT), unionArray(0), arrayInformationType(0) { }\r
virtual ~TVariable() { }\r
virtual bool isVariable() const { return true; } \r
TType& getType() { return type; } \r
- const TType getType() const { return type; }\r
+ const TType& getType() const { return type; }\r
bool isUserType() const { return userType; }\r
void changeQualifier(TQualifier qualifier) { type.changeQualifier(qualifier); }\r
void updateArrayInformationType(TType *t) { arrayInformationType = t; }\r
delete unionArray;\r
unionArray = constArray; \r
}\r
+ TVariable(const TVariable&, TStructureMap& remapper); // copy constructor\r
+ virtual TVariable* clone(TStructureMap& remapper);\r
\r
protected:\r
TType type;\r
struct TParameter {\r
TString *name;\r
TType* type;\r
+ void copyParam(const TParameter& param, TStructureMap& remapper) {\r
+ name = NewPoolTString(param.name->c_str());\r
+ type = param.type->clone(remapper);\r
+ }\r
};\r
\r
//\r
returnType(TType(EbtVoid)),\r
op(o),\r
defined(false) { }\r
- TFunction(const TString *name, TType retType, TOperator tOp = EOpNull) : \r
+ TFunction(const TString *name, TType& retType, TOperator tOp = EOpNull) : \r
TSymbol(name), \r
returnType(retType),\r
mangledName(*name + '('),\r
const TParameter& operator [](int i) const { return parameters[i]; }\r
\r
virtual void dump(TInfoSink &infoSink) const;\r
+ TFunction(const TFunction&, TStructureMap& remapper);\r
+ virtual TFunction* clone(TStructureMap& remapper);\r
\r
protected:\r
typedef TVector<TParameter> TParamList;\r
\r
void relateToOperator(const char* name, TOperator op);\r
void dump(TInfoSink &infoSink) const; \r
+ TSymbolTableLevel* clone(TStructureMap& remapper);\r
\r
protected:\r
typedef std::map<TString, TSymbol*, std::less<TString>, pool_allocator<std::pair<const TString, TSymbol*> > > tLevel;\r
// globals are at level 1.\r
//\r
bool isEmpty() { return table.size() == 0; }\r
- bool atBuiltInLevel() { return table.size() == 1; }\r
- bool atGlobalLevel() { return table.size() <= 2; }\r
+ bool atBuiltInLevel() { return atSharedBuiltInLevel() || atDynamicBuiltInLevel(); }\r
+ bool atSharedBuiltInLevel() { return table.size() == 1; } \r
+ bool atGlobalLevel() { return table.size() <= 3; }\r
void push() { \r
table.push_back(new TSymbolTableLevel);\r
}\r
return symbol;\r
}\r
\r
+ TSymbolTableLevel* getGlobalLevel() { assert (table.size() >= 3); return table[2]; }\r
void relateToOperator(const char* name, TOperator op) { table[0]->relateToOperator(name, op); }\r
int getMaxSymbolId() { return uniqueId; }\r
void dump(TInfoSink &infoSink) const; \r
+ void copyTable(const TSymbolTable& copyOf);\r
\r
protected: \r
int currentLevel() const { return static_cast<int>(table.size()) - 1; }\r
+ bool atDynamicBuiltInLevel() { return table.size() == 2; }\r
\r
std::vector<TSymbolTableLevel*> table;\r
int uniqueId; // for unique identification in code generation\r
-typedef union {\r
- struct {\r
- TSourceLoc line;\r
- union {\r
- TString *string;\r
- float f;\r
- int i;\r
- bool b;\r
- };\r
- TSymbol* symbol;\r
- } lex;\r
- struct {\r
- TSourceLoc line;\r
- TOperator op;\r
- union {\r
- TIntermNode* intermNode;\r
- TIntermNodePair nodePair;\r
- TIntermTyped* intermTypedNode;\r
- TIntermAggregate* intermAggregate;\r
- };\r
- union {\r
- TPublicType type;\r
- TQualifier qualifier;\r
- TFunction* function;\r
- TParameter param;\r
- TTypeLine typeLine;\r
- TTypeList* typeList;\r
- };\r
- } interm;\r
-} YYSTYPE;\r
-#define ATTRIBUTE 258\r
-#define CONST_QUAL 259\r
-#define BOOL_TYPE 260\r
-#define FLOAT_TYPE 261\r
-#define INT_TYPE 262\r
-#define BREAK 263\r
-#define CONTINUE 264\r
-#define DO 265\r
-#define ELSE 266\r
-#define FOR 267\r
-#define IF 268\r
-#define DISCARD 269\r
-#define RETURN 270\r
-#define BVEC2 271\r
-#define BVEC3 272\r
-#define BVEC4 273\r
-#define IVEC2 274\r
-#define IVEC3 275\r
-#define IVEC4 276\r
-#define VEC2 277\r
-#define VEC3 278\r
-#define VEC4 279\r
-#define MATRIX2 280\r
-#define MATRIX3 281\r
-#define MATRIX4 282\r
-#define IN_QUAL 283\r
-#define OUT_QUAL 284\r
-#define INOUT_QUAL 285\r
-#define UNIFORM 286\r
-#define VARYING 287\r
-#define STRUCT 288\r
-#define VOID_TYPE 289\r
-#define WHILE 290\r
-#define SAMPLER1D 291\r
-#define SAMPLER2D 292\r
-#define SAMPLER3D 293\r
-#define SAMPLERCUBE 294\r
-#define SAMPLER1DSHADOW 295\r
-#define SAMPLER2DSHADOW 296\r
-#define IDENTIFIER 297\r
-#define TYPE_NAME 298\r
-#define FLOATCONSTANT 299\r
-#define INTCONSTANT 300\r
-#define BOOLCONSTANT 301\r
-#define FIELD_SELECTION 302\r
-#define LEFT_OP 303\r
-#define RIGHT_OP 304\r
-#define INC_OP 305\r
-#define DEC_OP 306\r
-#define LE_OP 307\r
-#define GE_OP 308\r
-#define EQ_OP 309\r
-#define NE_OP 310\r
-#define AND_OP 311\r
-#define OR_OP 312\r
-#define XOR_OP 313\r
-#define MUL_ASSIGN 314\r
-#define DIV_ASSIGN 315\r
-#define ADD_ASSIGN 316\r
-#define MOD_ASSIGN 317\r
-#define LEFT_ASSIGN 318\r
-#define RIGHT_ASSIGN 319\r
-#define AND_ASSIGN 320\r
-#define XOR_ASSIGN 321\r
-#define OR_ASSIGN 322\r
-#define SUB_ASSIGN 323\r
-#define LEFT_PAREN 324\r
-#define RIGHT_PAREN 325\r
-#define LEFT_BRACKET 326\r
-#define RIGHT_BRACKET 327\r
-#define LEFT_BRACE 328\r
-#define RIGHT_BRACE 329\r
-#define DOT 330\r
-#define COMMA 331\r
-#define COLON 332\r
-#define EQUAL 333\r
-#define SEMICOLON 334\r
-#define BANG 335\r
-#define DASH 336\r
-#define TILDE 337\r
-#define PLUS 338\r
-#define STAR 339\r
-#define SLASH 340\r
-#define PERCENT 341\r
-#define LEFT_ANGLE 342\r
-#define RIGHT_ANGLE 343\r
-#define VERTICAL_BAR 344\r
-#define CARET 345\r
-#define AMPERSAND 346\r
-#define QUESTION 347\r
-\r
+/* A Bison parser, made by GNU Bison 1.875. */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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. */
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ ATTRIBUTE = 258,
+ CONST_QUAL = 259,
+ BOOL_TYPE = 260,
+ FLOAT_TYPE = 261,
+ INT_TYPE = 262,
+ BREAK = 263,
+ CONTINUE = 264,
+ DO = 265,
+ ELSE = 266,
+ FOR = 267,
+ IF = 268,
+ DISCARD = 269,
+ RETURN = 270,
+ BVEC2 = 271,
+ BVEC3 = 272,
+ BVEC4 = 273,
+ IVEC2 = 274,
+ IVEC3 = 275,
+ IVEC4 = 276,
+ VEC2 = 277,
+ VEC3 = 278,
+ VEC4 = 279,
+ MATRIX2 = 280,
+ MATRIX3 = 281,
+ MATRIX4 = 282,
+ IN_QUAL = 283,
+ OUT_QUAL = 284,
+ INOUT_QUAL = 285,
+ UNIFORM = 286,
+ VARYING = 287,
+ STRUCT = 288,
+ VOID_TYPE = 289,
+ WHILE = 290,
+ SAMPLER1D = 291,
+ SAMPLER2D = 292,
+ SAMPLER3D = 293,
+ SAMPLERCUBE = 294,
+ SAMPLER1DSHADOW = 295,
+ SAMPLER2DSHADOW = 296,
+ IDENTIFIER = 297,
+ TYPE_NAME = 298,
+ FLOATCONSTANT = 299,
+ INTCONSTANT = 300,
+ BOOLCONSTANT = 301,
+ FIELD_SELECTION = 302,
+ LEFT_OP = 303,
+ RIGHT_OP = 304,
+ INC_OP = 305,
+ DEC_OP = 306,
+ LE_OP = 307,
+ GE_OP = 308,
+ EQ_OP = 309,
+ NE_OP = 310,
+ AND_OP = 311,
+ OR_OP = 312,
+ XOR_OP = 313,
+ MUL_ASSIGN = 314,
+ DIV_ASSIGN = 315,
+ ADD_ASSIGN = 316,
+ MOD_ASSIGN = 317,
+ LEFT_ASSIGN = 318,
+ RIGHT_ASSIGN = 319,
+ AND_ASSIGN = 320,
+ XOR_ASSIGN = 321,
+ OR_ASSIGN = 322,
+ SUB_ASSIGN = 323,
+ LEFT_PAREN = 324,
+ RIGHT_PAREN = 325,
+ LEFT_BRACKET = 326,
+ RIGHT_BRACKET = 327,
+ LEFT_BRACE = 328,
+ RIGHT_BRACE = 329,
+ DOT = 330,
+ COMMA = 331,
+ COLON = 332,
+ EQUAL = 333,
+ SEMICOLON = 334,
+ BANG = 335,
+ DASH = 336,
+ TILDE = 337,
+ PLUS = 338,
+ STAR = 339,
+ SLASH = 340,
+ PERCENT = 341,
+ LEFT_ANGLE = 342,
+ RIGHT_ANGLE = 343,
+ VERTICAL_BAR = 344,
+ CARET = 345,
+ AMPERSAND = 346,
+ QUESTION = 347
+ };
+#endif
+#define ATTRIBUTE 258
+#define CONST_QUAL 259
+#define BOOL_TYPE 260
+#define FLOAT_TYPE 261
+#define INT_TYPE 262
+#define BREAK 263
+#define CONTINUE 264
+#define DO 265
+#define ELSE 266
+#define FOR 267
+#define IF 268
+#define DISCARD 269
+#define RETURN 270
+#define BVEC2 271
+#define BVEC3 272
+#define BVEC4 273
+#define IVEC2 274
+#define IVEC3 275
+#define IVEC4 276
+#define VEC2 277
+#define VEC3 278
+#define VEC4 279
+#define MATRIX2 280
+#define MATRIX3 281
+#define MATRIX4 282
+#define IN_QUAL 283
+#define OUT_QUAL 284
+#define INOUT_QUAL 285
+#define UNIFORM 286
+#define VARYING 287
+#define STRUCT 288
+#define VOID_TYPE 289
+#define WHILE 290
+#define SAMPLER1D 291
+#define SAMPLER2D 292
+#define SAMPLER3D 293
+#define SAMPLERCUBE 294
+#define SAMPLER1DSHADOW 295
+#define SAMPLER2DSHADOW 296
+#define IDENTIFIER 297
+#define TYPE_NAME 298
+#define FLOATCONSTANT 299
+#define INTCONSTANT 300
+#define BOOLCONSTANT 301
+#define FIELD_SELECTION 302
+#define LEFT_OP 303
+#define RIGHT_OP 304
+#define INC_OP 305
+#define DEC_OP 306
+#define LE_OP 307
+#define GE_OP 308
+#define EQ_OP 309
+#define NE_OP 310
+#define AND_OP 311
+#define OR_OP 312
+#define XOR_OP 313
+#define MUL_ASSIGN 314
+#define DIV_ASSIGN 315
+#define ADD_ASSIGN 316
+#define MOD_ASSIGN 317
+#define LEFT_ASSIGN 318
+#define RIGHT_ASSIGN 319
+#define AND_ASSIGN 320
+#define XOR_ASSIGN 321
+#define OR_ASSIGN 322
+#define SUB_ASSIGN 323
+#define LEFT_PAREN 324
+#define RIGHT_PAREN 325
+#define LEFT_BRACKET 326
+#define RIGHT_BRACKET 327
+#define LEFT_BRACE 328
+#define RIGHT_BRACE 329
+#define DOT 330
+#define COMMA 331
+#define COLON 332
+#define EQUAL 333
+#define SEMICOLON 334
+#define BANG 335
+#define DASH 336
+#define TILDE 337
+#define PLUS 338
+#define STAR 339
+#define SLASH 340
+#define PERCENT 341
+#define LEFT_ANGLE 342
+#define RIGHT_ANGLE 343
+#define VERTICAL_BAR 344
+#define CARET 345
+#define AMPERSAND 346
+#define QUESTION 347
+
+
+
+
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+#line 117 "glslang.y"
+typedef union YYSTYPE {
+ struct {
+ TSourceLoc line;
+ union {
+ TString *string;
+ float f;
+ int i;
+ bool b;
+ };
+ TSymbol* symbol;
+ } lex;
+ struct {
+ TSourceLoc line;
+ TOperator op;
+ union {
+ TIntermNode* intermNode;
+ TIntermNodePair nodePair;
+ TIntermTyped* intermTypedNode;
+ TIntermAggregate* intermAggregate;
+ };
+ union {
+ TPublicType type;
+ TQualifier qualifier;
+ TFunction* function;
+ TParameter param;
+ TTypeLine typeLine;
+ TTypeList* typeList;
+ };
+ } interm;
+} YYSTYPE;
+/* Line 1240 of yacc.c. */
+#line 251 "glslang.tab.h"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+
+
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, TSourceLoc);\r
TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, TSourceLoc);\r
TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc);\r
+ TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc);\r
TIntermConstantUnion* addConstantUnion(constUnion*, const TType&, TSourceLoc);\r
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;\r
TIntermTyped* copyConstUnion(TIntermConstantUnion*) ;\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
class TConstTraverser : public TIntermTraverser {\r
public:\r
- TConstTraverser(constUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TSymbolTable& symTable, TType t) : unionArray(cUnion), type(t),\r
+ TConstTraverser(constUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TSymbolTable& symTable, TType& t) : unionArray(cUnion), type(t),\r
constructorType(constructType), singleConstantParam(singleConstParam), infoSink(sink), symbolTable(symTable), error(false), isMatrix(false), matrixSize(0) { index = 0; tOp = EOpNull;}\r
int index ;\r
constUnion *unionArray;\r
bool ParseAggregate(bool /* preVisit */, TIntermAggregate* node, TIntermTraverser* it)\r
{\r
TConstTraverser* oit = static_cast<TConstTraverser*>(it);\r
- TType tt = node->getType();\r
\r
if (!node->isConstructor() && node->getOp() != EOpComma) {\r
char buf[200];\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-/*
-// atom.c
-*/
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "slglobals.h"
-
-#undef malloc
-#undef realloc
-#undef free
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////// String table: //////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
-static const struct {
- int val;
- const char *str;
-} tokens[] = {
- { CPP_AND_OP, "&&" },
- { CPP_AND_ASSIGN, "&=" },
- { CPP_SUB_ASSIGN, "-=" },
- { CPP_MOD_ASSIGN, "%=" },
- { CPP_ADD_ASSIGN, "+=" },
- { CPP_DIV_ASSIGN, "/=" },
- { CPP_MUL_ASSIGN, "*=" },
- { CPP_RIGHT_BRACKET, ":>" },
- { CPP_EQ_OP, "==" },
- { CPP_XOR_OP, "^^" },
- { CPP_XOR_ASSIGN, "^=" },
- { CPP_FLOATCONSTANT, "<float-const>" },
- { CPP_GE_OP, ">=" },
- { CPP_RIGHT_OP, ">>" },
- { CPP_RIGHT_ASSIGN, ">>=" },
- { CPP_IDENTIFIER, "<ident>" },
- { CPP_INTCONSTANT, "<int-const>" },
- { CPP_LE_OP, "<=" },
- { CPP_LEFT_OP, "<<" },
- { CPP_LEFT_ASSIGN, "<<=" },
- { CPP_LEFT_BRACKET, "<:" },
- { CPP_LEFT_BRACE, "<%" },
- { CPP_DEC_OP, "--" },
- { CPP_RIGHT_BRACE, "%>" },
- { CPP_NE_OP, "!=" },
- { CPP_OR_OP, "||" },
- { CPP_OR_ASSIGN, "|=" },
- { CPP_INC_OP, "++" },
- { CPP_STRCONSTANT, "<string-const>" },
- { CPP_TYPEIDENTIFIER, "<type-ident>" },
-};
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////// String table: //////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
-#define INIT_STRING_TABLE_SIZE 16384
-
-typedef struct StringTable_Rec {
- char *strings;
- int nextFree;
- int size;
-} StringTable;
-
-/*
- * InitStringTable() - Initialize the string table.
- *
- */
-
-static int InitStringTable(StringTable *stable)
-{
- stable->strings = (char *) malloc(INIT_STRING_TABLE_SIZE);
- if (!stable->strings)
- return 0;
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+\r
+/* */
+/* atom.c */
+/* */
+\r
+#include <assert.h>\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+#include "slglobals.h"\r
+\r
+#undef malloc\r
+#undef realloc\r
+#undef free\r
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*//////////////////////////////////////// String table: ////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
+static const struct {\r
+ int val;\r
+ const char *str;\r
+} tokens[] = {\r
+ { CPP_AND_OP, "&&" },\r
+ { CPP_AND_ASSIGN, "&=" },\r
+ { CPP_SUB_ASSIGN, "-=" },\r
+ { CPP_MOD_ASSIGN, "%=" },\r
+ { CPP_ADD_ASSIGN, "+=" },\r
+ { CPP_DIV_ASSIGN, "/=" },\r
+ { CPP_MUL_ASSIGN, "*=" },\r
+ { CPP_RIGHT_BRACKET, ":>" },\r
+ { CPP_EQ_OP, "==" },\r
+ { CPP_XOR_OP, "^^" }, \r
+ { CPP_XOR_ASSIGN, "^=" }, \r
+ { CPP_FLOATCONSTANT, "<float-const>" },\r
+ { CPP_GE_OP, ">=" },\r
+ { CPP_RIGHT_OP, ">>" },\r
+ { CPP_RIGHT_ASSIGN, ">>=" }, \r
+ { CPP_IDENTIFIER, "<ident>" },\r
+ { CPP_INTCONSTANT, "<int-const>" },\r
+ { CPP_LE_OP, "<=" },\r
+ { CPP_LEFT_OP, "<<" },\r
+ { CPP_LEFT_ASSIGN, "<<=" },\r
+ { CPP_LEFT_BRACKET, "<:" },\r
+ { CPP_LEFT_BRACE, "<%" }, \r
+ { CPP_DEC_OP, "--" },\r
+ { CPP_RIGHT_BRACE, "%>" }, \r
+ { CPP_NE_OP, "!=" },\r
+ { CPP_OR_OP, "||" },\r
+ { CPP_OR_ASSIGN, "|=" }, \r
+ { CPP_INC_OP, "++" },\r
+ { CPP_STRCONSTANT, "<string-const>" },\r
+ { CPP_TYPEIDENTIFIER, "<type-ident>" },\r
+};\r
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*//////////////////////////////////////// String table: ////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
+#define INIT_STRING_TABLE_SIZE 16384\r
+\r
+typedef struct StringTable_Rec {\r
+ char *strings;\r
+ int nextFree;\r
+ int size;\r
+} StringTable;\r
+\r
+/*\r
+ * InitStringTable() - Initialize the string table.\r
+ *\r
+ */\r
+\r
+static int InitStringTable(StringTable *stable)\r
+{\r
+ stable->strings = (char *) malloc(INIT_STRING_TABLE_SIZE);\r
+ if (!stable->strings)\r
+ return 0;\r
/* Zero-th offset means "empty" so don't use it. */
- stable->nextFree = 1;
- stable->size = INIT_STRING_TABLE_SIZE;
- return 1;
+ stable->nextFree = 1;\r
+ stable->size = INIT_STRING_TABLE_SIZE;\r
+ return 1;\r
} /* InitStringTable */
-
-/*
- * FreeStringTable() - Free the string table.
- *
- */
-
-static void FreeStringTable(StringTable *stable)
-{
- if (stable->strings)
- free(stable->strings);
- stable->strings = NULL;
- stable->nextFree = 0;
- stable->size = 0;
+\r
+/*\r
+ * FreeStringTable() - Free the string table.\r
+ *\r
+ */\r
+\r
+static void FreeStringTable(StringTable *stable)\r
+{\r
+ if (stable->strings)\r
+ free(stable->strings);\r
+ stable->strings = NULL;\r
+ stable->nextFree = 0;\r
+ stable->size = 0;\r
} /* FreeStringTable */
-
-/*
- * HashString() - Hash a string with the base hash function.
- *
- */
-
-static int HashString(const char *s)
-{
- int hval = 0;
-
- while (*s) {
- hval = (hval*13507 + *s*197) ^ (hval >> 2);
- s++;
- }
- return hval & 0x7fffffff;
+\r
+/*\r
+ * HashString() - Hash a string with the base hash function.\r
+ *\r
+ */\r
+\r
+static int HashString(const char *s)\r
+{\r
+ int hval = 0;\r
+\r
+ while (*s) {\r
+ hval = (hval*13507 + *s*197) ^ (hval >> 2);\r
+ s++;\r
+ }\r
+ return hval & 0x7fffffff;\r
} /* HashString */
-
-/*
- * HashString2() - Hash a string with the incrimenting hash function.
- *
- */
-
-static int HashString2(const char *s)
-{
- int hval = 0;
-
- while (*s) {
- hval = (hval*729 + *s*37) ^ (hval >> 1);
- s++;
- }
- return hval;
+\r
+/*\r
+ * HashString2() - Hash a string with the incrimenting hash function.\r
+ *\r
+ */\r
+\r
+static int HashString2(const char *s)\r
+{\r
+ int hval = 0;\r
+\r
+ while (*s) {\r
+ hval = (hval*729 + *s*37) ^ (hval >> 1);\r
+ s++;\r
+ }\r
+ return hval;\r
} /* HashString2 */
-
-/*
- * AddString() - Add a string to a string table. Return it's offset.
- *
- */
-
-static int AddString(StringTable *stable, const char *s)
-{
- int len, loc;
- char *str;
-
- len = (int) strlen(s);
- if (stable->nextFree + len + 1 >= stable->size) {
- assert(stable->size < 1000000);
- str = (char *) malloc(stable->size*2);
- memcpy(str, stable->strings, stable->size);
- free(stable->strings);
- stable->strings = str;
- }
- loc = stable->nextFree;
- strcpy(&stable->strings[loc], s);
- stable->nextFree += len + 1;
- return loc;
+\r
+/*\r
+ * AddString() - Add a string to a string table. Return it's offset.\r
+ *\r
+ */\r
+\r
+static int AddString(StringTable *stable, const char *s)\r
+{\r
+ int len, loc;\r
+ char *str;\r
+\r
+ len = (int) strlen(s);\r
+ if (stable->nextFree + len + 1 >= stable->size) {\r
+ assert(stable->size < 1000000);\r
+ str = (char *) malloc(stable->size*2);\r
+ memcpy(str, stable->strings, stable->size);\r
+ free(stable->strings);\r
+ stable->strings = str;\r
+ }\r
+ loc = stable->nextFree;\r
+ strcpy(&stable->strings[loc], s);\r
+ stable->nextFree += len + 1;\r
+ return loc;\r
} /* AddString */
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////// Hash table: ///////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
-#define INIT_HASH_TABLE_SIZE 2047
-#define HASH_TABLE_MAX_COLLISIONS 3
-
-typedef struct HashEntry_Rec {
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*///////////////////////////////////////// Hash table: /////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
+#define INIT_HASH_TABLE_SIZE 2047\r
+#define HASH_TABLE_MAX_COLLISIONS 3\r
+\r
+typedef struct HashEntry_Rec {\r
int index; /* String table offset of string representation */
int value; /* Atom (symbol) value */
-} HashEntry;
-
-typedef struct HashTable_Rec {
- HashEntry *entry;
- int size;
- int entries;
- int counts[HASH_TABLE_MAX_COLLISIONS + 1];
-} HashTable;
-
-/*
- * InitHashTable() - Initialize the hash table.
- *
- */
-
-static int InitHashTable(HashTable *htable, int fsize)
-{
- int ii;
-
- htable->entry = (HashEntry *) malloc(sizeof(HashEntry)*fsize);
- if (!htable->entry)
- return 0;
- htable->size = fsize;
- for (ii = 0; ii < fsize; ii++) {
- htable->entry[ii].index = 0;
- htable->entry[ii].value = 0;
- }
- htable->entries = 0;
- for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++)
- htable->counts[ii] = 0;
- return 1;
+} HashEntry;\r
+\r
+typedef struct HashTable_Rec {\r
+ HashEntry *entry;\r
+ int size;\r
+ int entries;\r
+ int counts[HASH_TABLE_MAX_COLLISIONS + 1];\r
+} HashTable;\r
+\r
+/*\r
+ * InitHashTable() - Initialize the hash table.\r
+ *\r
+ */\r
+\r
+static int InitHashTable(HashTable *htable, int fsize)\r
+{\r
+ int ii;\r
+\r
+ htable->entry = (HashEntry *) malloc(sizeof(HashEntry)*fsize);\r
+ if (!htable->entry)\r
+ return 0;\r
+ htable->size = fsize;\r
+ for (ii = 0; ii < fsize; ii++) {\r
+ htable->entry[ii].index = 0;\r
+ htable->entry[ii].value = 0;\r
+ }\r
+ htable->entries = 0;\r
+ for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++)\r
+ htable->counts[ii] = 0;\r
+ return 1;\r
} /* InitHashTable */
-
-/*
- * FreeHashTable() - Free the hash table.
- *
- */
-
-static void FreeHashTable(HashTable *htable)
-{
- if (htable->entry)
- free(htable->entry);
- htable->entry = NULL;
- htable->size = 0;
- htable->entries = 0;
+\r
+/*\r
+ * FreeHashTable() - Free the hash table.\r
+ *\r
+ */\r
+\r
+static void FreeHashTable(HashTable *htable)\r
+{\r
+ if (htable->entry)\r
+ free(htable->entry);\r
+ htable->entry = NULL;\r
+ htable->size = 0;\r
+ htable->entries = 0;\r
} /* FreeHashTable */
-
-/*
- * Empty() - See if a hash table entry is empty.
- *
- */
-
-static int Empty(HashTable *htable, int hashloc)
-{
- assert(hashloc >= 0 && hashloc < htable->size);
- if (htable->entry[hashloc].index == 0) {
- return 1;
- } else {
- return 0;
- }
+\r
+/*\r
+ * Empty() - See if a hash table entry is empty.\r
+ *\r
+ */\r
+\r
+static int Empty(HashTable *htable, int hashloc)\r
+{\r
+ assert(hashloc >= 0 && hashloc < htable->size);\r
+ if (htable->entry[hashloc].index == 0) {\r
+ return 1;\r
+ } else {\r
+ return 0;\r
+ }\r
} /* Empty */
-
-/*
- * Match() - See if a hash table entry is matches a string.
- *
- */
-
-static int Match(HashTable *htable, StringTable *stable, const char *s, int hashloc)
-{
- int strloc;
-
- strloc = htable->entry[hashloc].index;
- if (!strcmp(s, &stable->strings[strloc])) {
- return 1;
- } else {
- return 0;
- }
+\r
+/*\r
+ * Match() - See if a hash table entry is matches a string.\r
+ *\r
+ */\r
+\r
+static int Match(HashTable *htable, StringTable *stable, const char *s, int hashloc)\r
+{\r
+ int strloc;\r
+\r
+ strloc = htable->entry[hashloc].index;\r
+ if (!strcmp(s, &stable->strings[strloc])) {\r
+ return 1;\r
+ } else {\r
+ return 0;\r
+ }\r
} /* Match */
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////// Atom table: ///////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
-#define INIT_ATOM_TABLE_SIZE 1024
-
-
-struct AtomTable_Rec {
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*///////////////////////////////////////// Atom table: /////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
+#define INIT_ATOM_TABLE_SIZE 1024\r
+\r
+\r
+struct AtomTable_Rec {\r
StringTable stable; /* String table. */
- HashTable htable; /* Hashes string to atom number and token value. Multiple strings can
- // have the same token value but each unique string is a unique atom. */
- int *amap; /* Maps atom value to offset in string table. Atoms all map to unique
- // strings except for some undefined values in the lower, fixed part
- // of the atom table that map to "<undefined>". The lowest 256 atoms
- // correspond to single character ASCII values except for alphanumeric
- // characters and '_', which can be other tokens. Next come the
- // language tokens with their atom values equal to the token value.
- // Then come predefined atoms, followed by user specified identifiers. */
+ HashTable htable; /* Hashes string to atom number and token value. Multiple strings can */
+ /* have the same token value but each unique string is a unique atom. */
+ int *amap; /* Maps atom value to offset in string table. Atoms all map to unique */
+ /* strings except for some undefined values in the lower, fixed part */
+ /* of the atom table that map to "<undefined>". The lowest 256 atoms */
+ /* correspond to single character ASCII values except for alphanumeric */
+ /* characters and '_', which can be other tokens. Next come the */
+ /* language tokens with their atom values equal to the token value. */
+ /* Then come predefined atoms, followed by user specified identifiers. */
int *arev; /* Reversed atom for symbol table use. */
- int nextFree;
- int size;
-};
-
-static AtomTable latable = { { 0 } };
-AtomTable *atable = &latable;
-
-static int AddAtomFixed(AtomTable *atable, const char *s, int atom);
-
-/*
- * GrowAtomTable() - Grow the atom table to at least "size" if it's smaller.
- *
- */
-
-static int GrowAtomTable(AtomTable *atable, int size)
-{
- int *newmap, *newrev;
-
- if (atable->size < size) {
- if (atable->amap) {
- newmap = realloc(atable->amap, sizeof(int)*size);
- newrev = realloc(atable->arev, sizeof(int)*size);
- } else {
- newmap = malloc(sizeof(int)*size);
- newrev = malloc(sizeof(int)*size);
- atable->size = 0;
- }
- if (!newmap || !newrev) {
- /* failed to grow -- error */
- if (newmap)
- atable->amap = newmap;
- if (newrev)
- atable->amap = newrev;
- return -1;
- }
- memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int));
- memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int));
- atable->amap = newmap;
- atable->arev = newrev;
- atable->size = size;
- }
- return 0;
+ int nextFree;\r
+ int size;\r
+};\r
+\r
+static AtomTable latable = { { 0 } };\r
+AtomTable *atable = &latable;\r
+\r
+static int AddAtomFixed(AtomTable *atable, const char *s, int atom);\r
+\r
+/*\r
+ * GrowAtomTable() - Grow the atom table to at least "size" if it's smaller.\r
+ *\r
+ */\r
+\r
+static int GrowAtomTable(AtomTable *atable, int size)\r
+{\r
+ int *newmap, *newrev;\r
+\r
+ if (atable->size < size) {\r
+ if (atable->amap) {\r
+ newmap = realloc(atable->amap, sizeof(int)*size);\r
+ newrev = realloc(atable->arev, sizeof(int)*size);\r
+ } else {\r
+ newmap = malloc(sizeof(int)*size);\r
+ newrev = malloc(sizeof(int)*size);\r
+ atable->size = 0;\r
+ }\r
+ if (!newmap || !newrev) {\r
+ /* failed to grow -- error */\r
+ if (newmap)\r
+ atable->amap = newmap;\r
+ if (newrev)\r
+ atable->amap = newrev;\r
+ return -1;\r
+ }\r
+ memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int));\r
+ memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int));\r
+ atable->amap = newmap;\r
+ atable->arev = newrev;\r
+ atable->size = size;\r
+ }\r
+ return 0;\r
} /* GrowAtomTable */
-
-/*
- * lReverse() - Reverse the bottom 20 bits of a 32 bit int.
- *
- */
-
-static int lReverse(int fval)
-{
- unsigned int in = fval;
- int result = 0, cnt = 0;
-
- while(in) {
- result <<= 1;
- result |= in&1;
- in >>= 1;
- cnt++;
- }
-
- /* Don't use all 31 bits. One million atoms is plenty and sometimes the
- // upper bits are used for other things. */
-
- if (cnt < 20)
- result <<= 20 - cnt;
- return result;
+\r
+/*\r
+ * lReverse() - Reverse the bottom 20 bits of a 32 bit int.\r
+ *\r
+ */\r
+\r
+static int lReverse(int fval)\r
+{\r
+ unsigned int in = fval;\r
+ int result = 0, cnt = 0;\r
+\r
+ while(in) {\r
+ result <<= 1;\r
+ result |= in&1;\r
+ in >>= 1;\r
+ cnt++;\r
+ }\r
+\r
+ /* Don't use all 31 bits. One million atoms is plenty and sometimes the */
+ /* upper bits are used for other things. */
+\r
+ if (cnt < 20)\r
+ result <<= 20 - cnt;\r
+ return result;\r
} /* lReverse */
-
-/*
- * AllocateAtom() - Allocate a new atom. Associated with the "undefined" value of -1.
- *
- */
-
-static int AllocateAtom(AtomTable *atable)
-{
- if (atable->nextFree >= atable->size)
- GrowAtomTable(atable, atable->nextFree*2);
- atable->amap[atable->nextFree] = -1;
- atable->arev[atable->nextFree] = lReverse(atable->nextFree);
- atable->nextFree++;
- return atable->nextFree - 1;
+\r
+/*\r
+ * AllocateAtom() - Allocate a new atom. Associated with the "undefined" value of -1.\r
+ *\r
+ */\r
+\r
+static int AllocateAtom(AtomTable *atable)\r
+{\r
+ if (atable->nextFree >= atable->size)\r
+ GrowAtomTable(atable, atable->nextFree*2);\r
+ atable->amap[atable->nextFree] = -1;\r
+ atable->arev[atable->nextFree] = lReverse(atable->nextFree);\r
+ atable->nextFree++;\r
+ return atable->nextFree - 1;\r
} /* AllocateAtom */
-
-/*
- * SetAtomValue() - Allocate a new atom associated with "hashindex".
- *
- */
-
-static void SetAtomValue(AtomTable *atable, int atomnumber, int hashindex)
-{
- atable->amap[atomnumber] = atable->htable.entry[hashindex].index;
- atable->htable.entry[hashindex].value = atomnumber;
+\r
+/*\r
+ * SetAtomValue() - Allocate a new atom associated with "hashindex".\r
+ *\r
+ */\r
+\r
+static void SetAtomValue(AtomTable *atable, int atomnumber, int hashindex)\r
+{\r
+ atable->amap[atomnumber] = atable->htable.entry[hashindex].index;\r
+ atable->htable.entry[hashindex].value = atomnumber;\r
} /* SetAtomValue */
-
-/*
- * FindHashLoc() - Find the hash location for this string. Return -1 it hash table is full.
- *
- */
-
-static int FindHashLoc(AtomTable *atable, const char *s)
-{
- int hashloc, hashdelta, count;
- int FoundEmptySlot = 0;
- int collision[HASH_TABLE_MAX_COLLISIONS + 1];
-
- hashloc = HashString(s) % atable->htable.size;
- if (!Empty(&atable->htable, hashloc)) {
- if (Match(&atable->htable, &atable->stable, s, hashloc))
- return hashloc;
- collision[0] = hashloc;
- hashdelta = HashString2(s);
- count = 0;
- while (count < HASH_TABLE_MAX_COLLISIONS) {
- hashloc = ((hashloc + hashdelta) & 0x7fffffff) % atable->htable.size;
- if (!Empty(&atable->htable, hashloc)) {
- if (Match(&atable->htable, &atable->stable, s, hashloc)) {
- return hashloc;
- }
- } else {
- FoundEmptySlot = 1;
- break;
- }
- count++;
- collision[count] = hashloc;
- }
-
- if (!FoundEmptySlot) {
- if (cpp->options.DumpAtomTable) {
- int ii;
- char str[200];
- sprintf(str, "*** Hash failed with more than %d collisions. Must increase hash table size. ***",
- HASH_TABLE_MAX_COLLISIONS);
- CPPShInfoLogMsg(str);
-
- sprintf(str, "*** New string \"%s\", hash=%04x, delta=%04x", s, collision[0], hashdelta);
- CPPShInfoLogMsg(str);
- for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++) {
- sprintf(str, "*** Collides on try %d at hash entry %04x with \"%s\"",
- ii + 1, collision[ii], GetAtomString(atable, atable->htable.entry[collision[ii]].value));
- CPPShInfoLogMsg(str);
- }
- }
- return -1;
- } else {
- atable->htable.counts[count]++;
- }
- }
- return hashloc;
+\r
+/*\r
+ * FindHashLoc() - Find the hash location for this string. Return -1 it hash table is full.\r
+ *\r
+ */\r
+\r
+static int FindHashLoc(AtomTable *atable, const char *s)\r
+{\r
+ int hashloc, hashdelta, count;\r
+ int FoundEmptySlot = 0;\r
+ int collision[HASH_TABLE_MAX_COLLISIONS + 1];\r
+\r
+ hashloc = HashString(s) % atable->htable.size;\r
+ if (!Empty(&atable->htable, hashloc)) {\r
+ if (Match(&atable->htable, &atable->stable, s, hashloc))\r
+ return hashloc;\r
+ collision[0] = hashloc;\r
+ hashdelta = HashString2(s);\r
+ count = 0;\r
+ while (count < HASH_TABLE_MAX_COLLISIONS) {\r
+ hashloc = ((hashloc + hashdelta) & 0x7fffffff) % atable->htable.size;\r
+ if (!Empty(&atable->htable, hashloc)) {\r
+ if (Match(&atable->htable, &atable->stable, s, hashloc)) {\r
+ return hashloc;\r
+ }\r
+ } else {\r
+ FoundEmptySlot = 1;\r
+ break;\r
+ }\r
+ count++;\r
+ collision[count] = hashloc;\r
+ }\r
+\r
+ if (!FoundEmptySlot) {\r
+ if (cpp->options.DumpAtomTable) {\r
+ int ii;\r
+ char str[200];\r
+ sprintf(str, "*** Hash failed with more than %d collisions. Must increase hash table size. ***",\r
+ HASH_TABLE_MAX_COLLISIONS);\r
+ CPPShInfoLogMsg(str);\r
+\r
+ sprintf(str, "*** New string \"%s\", hash=%04x, delta=%04x", s, collision[0], hashdelta);\r
+ CPPShInfoLogMsg(str);\r
+ for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++) {\r
+ sprintf(str, "*** Collides on try %d at hash entry %04x with \"%s\"",\r
+ ii + 1, collision[ii], GetAtomString(atable, atable->htable.entry[collision[ii]].value));\r
+ CPPShInfoLogMsg(str);\r
+ }\r
+ }\r
+ return -1;\r
+ } else {\r
+ atable->htable.counts[count]++;\r
+ }\r
+ }\r
+ return hashloc;\r
} /* FindHashLoc */
-
-/*
- * IncreaseHashTableSize()
- *
- */
-
-static int IncreaseHashTableSize(AtomTable *atable)
-{
- int ii, strloc, oldhashloc, value, size;
- AtomTable oldtable;
- char *s;
-
+\r
+/*\r
+ * IncreaseHashTableSize()\r
+ *\r
+ */\r
+\r
+static int IncreaseHashTableSize(AtomTable *atable)\r
+{\r
+ int ii, strloc, oldhashloc, value, size;\r
+ AtomTable oldtable;\r
+ char *s;\r
+\r
/* Save the old atom table and create a new one: */
-
- oldtable = *atable;
- size = oldtable.htable.size*2 + 1;
- if (!InitAtomTable(atable, size))
- return 0;
-
+\r
+ oldtable = *atable;\r
+ size = oldtable.htable.size*2 + 1;\r
+ if (!InitAtomTable(atable, size))\r
+ return 0;\r
+\r
/* Add all the existing values to the new atom table preserving their atom values: */
-
- for (ii = atable->nextFree; ii < oldtable.nextFree; ii++) {
- strloc = oldtable.amap[ii];
- s = &oldtable.stable.strings[strloc];
- oldhashloc = FindHashLoc(&oldtable, s);
- assert(oldhashloc >= 0);
- value = oldtable.htable.entry[oldhashloc].value;
- AddAtomFixed(atable, s, value);
- }
- FreeAtomTable(&oldtable);
- return 1;
+\r
+ for (ii = atable->nextFree; ii < oldtable.nextFree; ii++) {\r
+ strloc = oldtable.amap[ii];\r
+ s = &oldtable.stable.strings[strloc];\r
+ oldhashloc = FindHashLoc(&oldtable, s);\r
+ assert(oldhashloc >= 0);\r
+ value = oldtable.htable.entry[oldhashloc].value;\r
+ AddAtomFixed(atable, s, value);\r
+ }\r
+ FreeAtomTable(&oldtable);\r
+ return 1;\r
} /* IncreaseHashTableSize */
-
-/*
- * LookUpAddStringHash() - Lookup a string in the hash table. If it's not there, add it and
- * initialize the atom value in the hash table to 0. Return the hash table index.
- */
-
-static int LookUpAddStringHash(AtomTable *atable, const char *s)
-{
- int hashloc, strloc;
-
- while(1) {
- hashloc = FindHashLoc(atable, s);
- if (hashloc >= 0)
- break;
- IncreaseHashTableSize(atable);
- }
-
- if (Empty(&atable->htable, hashloc)) {
- atable->htable.entries++;
- strloc = AddString(&atable->stable, s);
- atable->htable.entry[hashloc].index = strloc;
- atable->htable.entry[hashloc].value = 0;
- }
- return hashloc;
+\r
+/*\r
+ * LookUpAddStringHash() - Lookup a string in the hash table. If it's not there, add it and\r
+ * initialize the atom value in the hash table to 0. Return the hash table index.\r
+ */\r
+\r
+static int LookUpAddStringHash(AtomTable *atable, const char *s)\r
+{\r
+ int hashloc, strloc;\r
+\r
+ while(1) {\r
+ hashloc = FindHashLoc(atable, s);\r
+ if (hashloc >= 0)\r
+ break;\r
+ IncreaseHashTableSize(atable);\r
+ }\r
+\r
+ if (Empty(&atable->htable, hashloc)) {\r
+ atable->htable.entries++;\r
+ strloc = AddString(&atable->stable, s);\r
+ atable->htable.entry[hashloc].index = strloc;\r
+ atable->htable.entry[hashloc].value = 0;\r
+ }\r
+ return hashloc;\r
} /* LookUpAddStringHash */
-
-/*
- * LookUpAddString() - Lookup a string in the hash table. If it's not there, add it and
- * initialize the atom value in the hash table to the next atom number.
- * Return the atom value of string.
- */
-
-int LookUpAddString(AtomTable *atable, const char *s)
-{
- int hashindex, atom;
-
- hashindex = LookUpAddStringHash(atable, s);
- atom = atable->htable.entry[hashindex].value;
- if (atom == 0) {
- atom = AllocateAtom(atable);
- SetAtomValue(atable, atom, hashindex);
- }
- return atom;
+\r
+/*\r
+ * LookUpAddString() - Lookup a string in the hash table. If it's not there, add it and\r
+ * initialize the atom value in the hash table to the next atom number.\r
+ * Return the atom value of string.\r
+ */\r
+\r
+int LookUpAddString(AtomTable *atable, const char *s)\r
+{\r
+ int hashindex, atom;\r
+\r
+ hashindex = LookUpAddStringHash(atable, s);\r
+ atom = atable->htable.entry[hashindex].value;\r
+ if (atom == 0) {\r
+ atom = AllocateAtom(atable);\r
+ SetAtomValue(atable, atom, hashindex);\r
+ }\r
+ return atom;\r
} /* LookUpAddString */
-
-/*
- * GetAtomString()
- *
- */
-
-const char *GetAtomString(AtomTable *atable, int atom)
-{
- int soffset;
-
- if (atom > 0 && atom < atable->nextFree) {
- soffset = atable->amap[atom];
- if (soffset > 0 && soffset < atable->stable.nextFree) {
- return &atable->stable.strings[soffset];
- } else {
- return "<internal error: bad soffset>";
- }
- } else {
- if (atom == 0) {
- return "<null atom>";
- } else {
- if (atom == EOF) {
- return "<EOF>";
- } else {
- return "<invalid atom>";
- }
- }
- }
+\r
+/*\r
+ * GetAtomString()\r
+ *\r
+ */\r
+\r
+const char *GetAtomString(AtomTable *atable, int atom)\r
+{\r
+ int soffset;\r
+\r
+ if (atom > 0 && atom < atable->nextFree) {\r
+ soffset = atable->amap[atom];\r
+ if (soffset > 0 && soffset < atable->stable.nextFree) {\r
+ return &atable->stable.strings[soffset];\r
+ } else {\r
+ return "<internal error: bad soffset>";\r
+ }\r
+ } else {\r
+ if (atom == 0) {\r
+ return "<null atom>";\r
+ } else {\r
+ if (atom == EOF) {\r
+ return "<EOF>";\r
+ } else {\r
+ return "<invalid atom>";\r
+ }\r
+ }\r
+ }\r
} /* GetAtomString */
-
-/*
- * GetReversedAtom()
- *
- */
-
-int GetReversedAtom(AtomTable *atable, int atom)
-{
- if (atom > 0 && atom < atable->nextFree) {
- return atable->arev[atom];
- } else {
- return 0;
- }
+\r
+/*\r
+ * GetReversedAtom()\r
+ *\r
+ */\r
+\r
+int GetReversedAtom(AtomTable *atable, int atom)\r
+{\r
+ if (atom > 0 && atom < atable->nextFree) {\r
+ return atable->arev[atom];\r
+ } else {\r
+ return 0;\r
+ }\r
} /* GetReversedAtom */
-
-/*
- * AddAtom() - Add a string to the atom, hash and string tables if it isn't already there.
- * Return it's atom index.
- */
-
-int AddAtom(AtomTable *atable, const char *s)
-{
- int atom;
-
- atom = LookUpAddString(atable, s);
- return atom;
+\r
+/*\r
+ * AddAtom() - Add a string to the atom, hash and string tables if it isn't already there.\r
+ * Return it's atom index.\r
+ */\r
+\r
+int AddAtom(AtomTable *atable, const char *s)\r
+{\r
+ int atom;\r
+\r
+ atom = LookUpAddString(atable, s);\r
+ return atom;\r
} /* AddAtom */
-
-/*
- * AddAtomFixed() - Add an atom to the hash and string tables if it isn't already there.
- * Assign it the atom value of "atom".
- */
-
-static int AddAtomFixed(AtomTable *atable, const char *s, int atom)
-{
- int hashindex, lsize;
-
- hashindex = LookUpAddStringHash(atable, s);
- if (atable->nextFree >= atable->size || atom >= atable->size) {
- lsize = atable->size*2;
- if (lsize <= atom)
- lsize = atom + 1;
- GrowAtomTable(atable, lsize);
- }
- atable->amap[atom] = atable->htable.entry[hashindex].index;
- atable->htable.entry[hashindex].value = atom;
- /*if (atom >= atable->nextFree)
- // atable->nextFree = atom + 1; */
- while (atom >= atable->nextFree) {
- atable->arev[atable->nextFree] = lReverse(atable->nextFree);
- atable->nextFree++;
- }
- return atom;
+\r
+/*\r
+ * AddAtomFixed() - Add an atom to the hash and string tables if it isn't already there.\r
+ * Assign it the atom value of "atom".\r
+ */\r
+\r
+static int AddAtomFixed(AtomTable *atable, const char *s, int atom)\r
+{\r
+ int hashindex, lsize;\r
+\r
+ hashindex = LookUpAddStringHash(atable, s);\r
+ if (atable->nextFree >= atable->size || atom >= atable->size) {\r
+ lsize = atable->size*2;\r
+ if (lsize <= atom)\r
+ lsize = atom + 1;\r
+ GrowAtomTable(atable, lsize);\r
+ }\r
+ atable->amap[atom] = atable->htable.entry[hashindex].index;\r
+ atable->htable.entry[hashindex].value = atom;\r
+ /*if (atom >= atable->nextFree) */
+ /* atable->nextFree = atom + 1; */
+ while (atom >= atable->nextFree) {\r
+ atable->arev[atable->nextFree] = lReverse(atable->nextFree);\r
+ atable->nextFree++;\r
+ }\r
+ return atom;\r
} /* AddAtomFixed */
-
-/*
- * InitAtomTable() - Initialize the atom table.
- *
- */
-
-int InitAtomTable(AtomTable *atable, int htsize)
-{
- int ii;
-
- htsize = htsize <= 0 ? INIT_HASH_TABLE_SIZE : htsize;
- if (!InitStringTable(&atable->stable))
- return 0;
- if (!InitHashTable(&atable->htable, htsize))
- return 0;
-
- atable->nextFree = 0;
- atable->amap = NULL;
- atable->size = 0;
- GrowAtomTable(atable, INIT_ATOM_TABLE_SIZE);
- if (!atable->amap)
- return 0;
-
+\r
+/*\r
+ * InitAtomTable() - Initialize the atom table.\r
+ *\r
+ */\r
+\r
+int InitAtomTable(AtomTable *atable, int htsize)\r
+{\r
+ int ii;\r
+\r
+ htsize = htsize <= 0 ? INIT_HASH_TABLE_SIZE : htsize;\r
+ if (!InitStringTable(&atable->stable))\r
+ return 0;\r
+ if (!InitHashTable(&atable->htable, htsize))\r
+ return 0;\r
+\r
+ atable->nextFree = 0;\r
+ atable->amap = NULL;\r
+ atable->size = 0;\r
+ GrowAtomTable(atable, INIT_ATOM_TABLE_SIZE);\r
+ if (!atable->amap)\r
+ return 0;\r
+\r
/* Initialize lower part of atom table to "<undefined>" atom: */
-
- AddAtomFixed(atable, "<undefined>", 0);
- for (ii = 0; ii < FIRST_USER_TOKEN_SY; ii++)
- atable->amap[ii] = atable->amap[0];
-
+\r
+ AddAtomFixed(atable, "<undefined>", 0);\r
+ for (ii = 0; ii < FIRST_USER_TOKEN_SY; ii++)\r
+ atable->amap[ii] = atable->amap[0];\r
+\r
/* Add single character tokens to the atom table: */
-
- {
- const char *s = "~!%^&*()-+=|,.<>/?;:[]{}#";
- char t[2];
-
- t[1] = '\0';
- while (*s) {
- t[0] = *s;
- AddAtomFixed(atable, t, s[0]);
- s++;
- }
- }
-
+\r
+ {\r
+ const char *s = "~!%^&*()-+=|,.<>/?;:[]{}#";\r
+ char t[2];\r
+\r
+ t[1] = '\0';\r
+ while (*s) {\r
+ t[0] = *s;\r
+ AddAtomFixed(atable, t, s[0]);\r
+ s++;\r
+ }\r
+ }\r
+\r
/* Add multiple character scanner tokens : */
-
- for (ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++)
- AddAtomFixed(atable, tokens[ii].str, tokens[ii].val);
-
+\r
+ for (ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++)\r
+ AddAtomFixed(atable, tokens[ii].str, tokens[ii].val);\r
+\r
/* Add error symbol if running in error mode: */
-
- if (cpp->options.ErrorMode)
- AddAtomFixed(atable, "error", ERROR_SY);
-
- AddAtom(atable, "<*** end fixed atoms ***>");
-
- return 1;
+\r
+ if (cpp->options.ErrorMode)\r
+ AddAtomFixed(atable, "error", ERROR_SY);\r
+\r
+ AddAtom(atable, "<*** end fixed atoms ***>");\r
+\r
+ return 1;\r
} /* InitAtomTable */
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////// Debug Printing Functions: //////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
-/*
- * PrintAtomTable()
- *
- */
-
-void PrintAtomTable(AtomTable *atable)
-{
- int ii;
- char str[200];
-
- for (ii = 0; ii < atable->nextFree; ii++) {
- sprintf(str, "%d: \"%s\"", ii, &atable->stable.strings[atable->amap[ii]]);
- CPPDebugLogMsg(str);
- }
- sprintf(str, "Hash table: size=%d, entries=%d, collisions=",
- atable->htable.size, atable->htable.entries);
- CPPDebugLogMsg(str);
- for (ii = 0; ii < HASH_TABLE_MAX_COLLISIONS; ii++) {
- sprintf(str, " %d", atable->htable.counts[ii]);
- CPPDebugLogMsg(str);
- }
-
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*//////////////////////////////// Debug Printing Functions: ////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
+/*\r
+ * PrintAtomTable()\r
+ *\r
+ */\r
+\r
+void PrintAtomTable(AtomTable *atable)\r
+{\r
+ int ii;\r
+ char str[200];\r
+\r
+ for (ii = 0; ii < atable->nextFree; ii++) {\r
+ sprintf(str, "%d: \"%s\"", ii, &atable->stable.strings[atable->amap[ii]]);\r
+ CPPDebugLogMsg(str);\r
+ }\r
+ sprintf(str, "Hash table: size=%d, entries=%d, collisions=",\r
+ atable->htable.size, atable->htable.entries);\r
+ CPPDebugLogMsg(str);\r
+ for (ii = 0; ii < HASH_TABLE_MAX_COLLISIONS; ii++) {\r
+ sprintf(str, " %d", atable->htable.counts[ii]);\r
+ CPPDebugLogMsg(str);\r
+ }\r
+\r
} /* PrintAtomTable */
-
-
-/*
- * GetStringOfAtom()
- *
- */
-
-char* GetStringOfAtom(AtomTable *atable, int atom)
-{
- char* chr_str;
- chr_str=&atable->stable.strings[atable->amap[atom]];
- return chr_str;
+\r
+\r
+/*\r
+ * GetStringOfAtom()\r
+ *\r
+ */\r
+\r
+char* GetStringOfAtom(AtomTable *atable, int atom)\r
+{\r
+ char* chr_str;\r
+ chr_str=&atable->stable.strings[atable->amap[atom]];\r
+ return chr_str;\r
} /* GetStringOfAtom */
-
-/*
- * FreeAtomTable() - Free the atom table and associated memory
- *
- */
-
-void FreeAtomTable(AtomTable *atable)
-{
- FreeStringTable(&atable->stable);
- FreeHashTable(&atable->htable);
- if (atable->amap)
- free(atable->amap);
- if (atable->arev)
- free(atable->arev);
- atable->amap = NULL;
- atable->arev = NULL;
- atable->nextFree = 0;
- atable->size = 0;
+\r
+/*\r
+ * FreeAtomTable() - Free the atom table and associated memory\r
+ *\r
+ */\r
+\r
+void FreeAtomTable(AtomTable *atable)\r
+{\r
+ FreeStringTable(&atable->stable);\r
+ FreeHashTable(&atable->htable);\r
+ if (atable->amap)\r
+ free(atable->amap);\r
+ if (atable->arev)\r
+ free(atable->arev);\r
+ atable->amap = NULL;\r
+ atable->arev = NULL;\r
+ atable->nextFree = 0;\r
+ atable->size = 0;\r
} /* FreeAtomTable */
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////// End of atom.c ///////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*/////////////////////////////////////// End of atom.c /////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// atom.h
-*/
-
-#if !defined(__ATOM_H)
-#define __ATOM_H 1
-
-typedef struct AtomTable_Rec AtomTable;
-
-extern AtomTable *atable;
-
-int InitAtomTable(AtomTable *atable, int htsize);
-void FreeAtomTable(AtomTable *atable);
-int AddAtom(AtomTable *atable, const char *s);
-void PrintAtomTable(AtomTable *atable);
-int LookUpAddString(AtomTable *atable, const char *s);
-const char *GetAtomString(AtomTable *atable, int atom);
-int GetReversedAtom(AtomTable *atable, int atom);
-char* GetStringOfAtom(AtomTable *atable, int atom);
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* atom.h */
+/* */
+\r
+#if !defined(__ATOM_H)\r
+#define __ATOM_H 1\r
+\r
+typedef struct AtomTable_Rec AtomTable;\r
+\r
+extern AtomTable *atable;\r
+\r
+int InitAtomTable(AtomTable *atable, int htsize);\r
+void FreeAtomTable(AtomTable *atable);\r
+int AddAtom(AtomTable *atable, const char *s);\r
+void PrintAtomTable(AtomTable *atable);\r
+int LookUpAddString(AtomTable *atable, const char *s);\r
+const char *GetAtomString(AtomTable *atable, int atom);\r
+int GetReversedAtom(AtomTable *atable, int atom);\r
+char* GetStringOfAtom(AtomTable *atable, int atom);\r
#endif /* !defined(__ATOM_H) */
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// compile.h
-*/
-
-#if !defined(__COMPILE_H)
-#define __COMPILE_H 1
-
-int InitCPPStruct(void);
-
-typedef struct Options_Rec{
- const char *profileString;
- int ErrorMode;
- int Quiet;
-
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* compile.h */
+/* */
+\r
+#if !defined(__COMPILE_H)\r
+#define __COMPILE_H 1\r
+\r
+int InitCPPStruct(void);\r
+\r
+typedef struct Options_Rec{\r
+ const char *profileString;\r
+ int ErrorMode;\r
+ int Quiet;\r
+ \r
/* Debug The Compiler options: */
- int DumpAtomTable;
-} Options;
-
-struct CPPStruct_Rec {
+ int DumpAtomTable;\r
+} Options;\r
+\r
+struct CPPStruct_Rec {\r
/* Public members */
SourceLoc *pLastSourceLoc; /* Set at the start of each statement by the tree walkers */
Options options; /* Compile options and parameters */
-
+\r
/* Private members */
- SourceLoc lastSourceLoc;
-
+ SourceLoc lastSourceLoc;\r
+\r
/* Scanner data: */
-
+\r
SourceLoc *tokenLoc; /* Source location of most recent token seen by the scanner */
int mostRecentToken; /* Most recent token seen by the scanner */
- InputSrc *currentInput;
- int previous_token;
+ InputSrc *currentInput;\r
+ int previous_token;\r
int notAVersionToken; /* used to make sure that #version is the first token seen in the file, if present */
-
- void *pC; /* storing the parseContext of the compile object in cpp. */
-
+ \r
+ void *pC; /* storing the parseContext of the compile object in cpp. */
+ \r
/* Private members: */
- SourceLoc ltokenLoc;
- int ifdepth; /* current #if-#else-#endif nesting in the cpp.c file (pre-processor) */
- int elsedepth[64]; /* Keep a track of #if depth..Max allowed is 64. */
- int elsetracker; /* #if-#else and #endif constructs...Counter. */
- const char *ErrMsg;
- int CompileError; /* Indicate compile error when #error, #else,#elif mismatch. */
-
- /*
- // Globals used to communicate between PaParseStrings() and yy_input()and
- // also across the files.(gen_glslang.cpp and scanner.c)
- */
+ SourceLoc ltokenLoc;\r
+ int ifdepth; /*current #if-#else-#endif nesting in the cpp.c file (pre-processor) */
+ int elsedepth[64]; /*Keep a track of #if depth..Max allowed is 64. */
+ int elsetracker; /*#if-#else and #endif constructs...Counter. */
+ const char *ErrMsg;\r
+ int CompileError; /*Indicate compile error when #error, #else,#elif mismatch. */
+\r
+ /* */
+ /* Globals used to communicate between PaParseStrings() and yy_input()and */
+ /* also across the files.(gen_glslang.cpp and scanner.c) */
+ /* */
int PaWhichStr; /* which string we're parsing */
int* PaStrLen; /* array of lengths of the PaArgv strings */
int PaArgc; /* count of strings in the array */
- char** PaArgv; /* our array of strings to parse */
-};
-
+ char** PaArgv; /* our array of strings to parse */
+ unsigned int tokensBeforeEOF : 1;\r
+};\r
+\r
#endif /* !defined(__COMPILE_H) */
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// cpp.c
-*/
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "slglobals.h"
-
-#include "slang_mesa.h"
-
-static int CPPif(yystypepp * yylvalpp);
-
-/* Don't use memory.c's replacements, as we clean up properly here */
-#undef malloc
-#undef free
-
-static int bindAtom = 0;
-static int constAtom = 0;
-static int defaultAtom = 0;
-static int defineAtom = 0;
-static int definedAtom = 0;
-static int elseAtom = 0;
-static int elifAtom = 0;
-static int endifAtom = 0;
-static int ifAtom = 0;
-static int ifdefAtom = 0;
-static int ifndefAtom = 0;
-static int includeAtom = 0;
-static int lineAtom = 0;
-static int pragmaAtom = 0;
-static int texunitAtom = 0;
-static int undefAtom = 0;
-static int errorAtom = 0;
-static int __LINE__Atom = 0;
-static int __FILE__Atom = 0;
-static int __VERSION__Atom = 0;
-static int versionAtom = 0;
-static int extensionAtom = 0;
-
-static Scope *macros = 0;
-#define MAX_MACRO_ARGS 64
-#define MAX_IF_NESTING 64
-
-static SourceLoc ifloc; /* outermost #if */
-
-int InitCPP(void)
-{
- char buffer[64], *t;
- const char *f;
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* cpp.c */
+/* */
+\r
+#include <stdarg.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <ctype.h>\r
+\r
+#include "slglobals.h"\r
+\r
+static int CPPif(yystypepp * yylvalpp);\r
+\r
+/* Don't use memory.c's replacements, as we clean up properly here */\r
+#undef malloc\r
+#undef free\r
+\r
+static int bindAtom = 0;\r
+static int constAtom = 0;\r
+static int defaultAtom = 0;\r
+static int defineAtom = 0;\r
+static int definedAtom = 0;\r
+static int elseAtom = 0;\r
+static int elifAtom = 0;\r
+static int endifAtom = 0;\r
+static int ifAtom = 0;\r
+static int ifdefAtom = 0;\r
+static int ifndefAtom = 0;\r
+static int includeAtom = 0;\r
+static int lineAtom = 0;\r
+static int pragmaAtom = 0;\r
+static int texunitAtom = 0;\r
+static int undefAtom = 0;\r
+static int errorAtom = 0;\r
+static int __LINE__Atom = 0;\r
+static int __FILE__Atom = 0;\r
+static int __VERSION__Atom = 0;\r
+static int versionAtom = 0;\r
+static int extensionAtom = 0;\r
+\r
+static Scope *macros = 0;\r
+#define MAX_MACRO_ARGS 64\r
+#define MAX_IF_NESTING 64\r
+\r
+static SourceLoc ifloc; /* outermost #if */\r
+\r
+int InitCPP(void)\r
+{\r
+ char buffer[64], *t;\r
+ const char *f;\r
/* Add various atoms needed by the CPP line scanner: */
- bindAtom = LookUpAddString(atable, "bind");
- constAtom = LookUpAddString(atable, "const");
- defaultAtom = LookUpAddString(atable, "default");
- defineAtom = LookUpAddString(atable, "define");
- definedAtom = LookUpAddString(atable, "defined");
- elifAtom = LookUpAddString(atable, "elif");
- elseAtom = LookUpAddString(atable, "else");
- endifAtom = LookUpAddString(atable, "endif");
- ifAtom = LookUpAddString(atable, "if");
- ifdefAtom = LookUpAddString(atable, "ifdef");
- ifndefAtom = LookUpAddString(atable, "ifndef");
- includeAtom = LookUpAddString(atable, "include");
- lineAtom = LookUpAddString(atable, "line");
- pragmaAtom = LookUpAddString(atable, "pragma");
- texunitAtom = LookUpAddString(atable, "texunit");
- undefAtom = LookUpAddString(atable, "undef");
- errorAtom = LookUpAddString(atable, "error");
- __LINE__Atom = LookUpAddString(atable, "__LINE__");
- __FILE__Atom = LookUpAddString(atable, "__FILE__");
- __VERSION__Atom = LookUpAddString(atable, "__VERSION__");
- versionAtom = LookUpAddString(atable, "version");
- extensionAtom = LookUpAddString(atable, "extension");
- macros = NewScopeInPool(mem_CreatePool(0, 0));
- strcpy(buffer, "PROFILE_");
- t = buffer + strlen(buffer);
- f = cpp->options.profileString;
- while ((_mesa_isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)
- *t++ = toupper(*f++);
- *t = 0;
- return 1;
+ bindAtom = LookUpAddString(atable, "bind");\r
+ constAtom = LookUpAddString(atable, "const");\r
+ defaultAtom = LookUpAddString(atable, "default");\r
+ defineAtom = LookUpAddString(atable, "define");\r
+ definedAtom = LookUpAddString(atable, "defined");\r
+ elifAtom = LookUpAddString(atable, "elif");\r
+ elseAtom = LookUpAddString(atable, "else");\r
+ endifAtom = LookUpAddString(atable, "endif");\r
+ ifAtom = LookUpAddString(atable, "if");\r
+ ifdefAtom = LookUpAddString(atable, "ifdef");\r
+ ifndefAtom = LookUpAddString(atable, "ifndef");\r
+ includeAtom = LookUpAddString(atable, "include");\r
+ lineAtom = LookUpAddString(atable, "line");\r
+ pragmaAtom = LookUpAddString(atable, "pragma");\r
+ texunitAtom = LookUpAddString(atable, "texunit");\r
+ undefAtom = LookUpAddString(atable, "undef");\r
+ errorAtom = LookUpAddString(atable, "error");\r
+ __LINE__Atom = LookUpAddString(atable, "__LINE__");\r
+ __FILE__Atom = LookUpAddString(atable, "__FILE__");\r
+ __VERSION__Atom = LookUpAddString(atable, "__VERSION__");\r
+ versionAtom = LookUpAddString(atable, "version");\r
+ extensionAtom = LookUpAddString(atable, "extension");\r
+ macros = NewScopeInPool(mem_CreatePool(0, 0));\r
+ strcpy(buffer, "PROFILE_");\r
+ t = buffer + strlen(buffer);\r
+ f = cpp->options.profileString;\r
+ while ((isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)\r
+ *t++ = toupper(*f++);\r
+ *t = 0;\r
+ return 1;\r
} /* InitCPP */
-
-int FreeCPP(void)
-{
- if (macros)
- {
- mem_FreePool(macros->pool);
- macros = 0;
- }
-
- return 1;
-}
-
-int FinalCPP(void)
-{
- if (cpp->ifdepth)
- CPPErrorToInfoLog("#if mismatch");
- return 1;
-}
-
-static int CPPdefine(yystypepp * yylvalpp)
-{
- int token, name, args[MAX_MACRO_ARGS], argc;
- const char *message;
- MacroSymbol mac;
- Symbol *symb;
- SourceLoc dummyLoc;
- memset(&mac, 0, sizeof(mac));
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != CPP_IDENTIFIER) {
- CPPErrorToInfoLog("#define");
- return token;
- }
- name = yylvalpp->sc_ident;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(' && !yylvalpp->sc_int) {
+\r
+int FreeCPP(void)\r
+{\r
+ if (macros)\r
+ {\r
+ mem_FreePool(macros->pool);\r
+ macros = 0;\r
+ }\r
+\r
+ return 1;\r
+}\r
+\r
+int FinalCPP(void)\r
+{\r
+ if (cpp->ifdepth)\r
+ CPPErrorToInfoLog("#if mismatch");\r
+ return 1;\r
+}\r
+\r
+static int CPPdefine(yystypepp * yylvalpp)\r
+{\r
+ int token, name, args[MAX_MACRO_ARGS], argc;\r
+ const char *message;\r
+ MacroSymbol mac;\r
+ Symbol *symb;\r
+ SourceLoc dummyLoc;\r
+ memset(&mac, 0, sizeof(mac));\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token != CPP_IDENTIFIER) {\r
+ CPPErrorToInfoLog("#define");\r
+ return token;\r
+ }\r
+ name = yylvalpp->sc_ident;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token == '(' && !yylvalpp->sc_int) {\r
/* gather arguments */
- argc = 0;
- do {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (argc == 0 && token == ')') break;
- if (token != CPP_IDENTIFIER) {
- CPPErrorToInfoLog("#define");
- return token;
- }
- if (argc < MAX_MACRO_ARGS)
- args[argc++] = yylvalpp->sc_ident;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- } while (token == ',');
- if (token != ')') {
- CPPErrorToInfoLog("#define");
- return token;
- }
- mac.argc = argc;
- mac.args = mem_Alloc(macros->pool, argc * sizeof(int));
- memcpy(mac.args, args, argc * sizeof(int));
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- mac.body = NewTokenStream(GetAtomString(atable, name));
- while (token != '\n') {
- while (token == '\\') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- else
- RecordToken(mac.body, '\\', yylvalpp);
- }
- RecordToken(mac.body, token, yylvalpp);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- };
-
- symb = LookUpSymbol(macros, name);
- if (symb) {
- if (!symb->details.mac.undef) {
+ argc = 0;\r
+ do {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (argc == 0 && token == ')') break;\r
+ if (token != CPP_IDENTIFIER) {\r
+ CPPErrorToInfoLog("#define");\r
+ return token;\r
+ }\r
+ if (argc < MAX_MACRO_ARGS)\r
+ args[argc++] = yylvalpp->sc_ident;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ } while (token == ',');\r
+ if (token != ')') {\r
+ CPPErrorToInfoLog("#define");\r
+ return token;\r
+ }\r
+ mac.argc = argc;\r
+ mac.args = mem_Alloc(macros->pool, argc * sizeof(int));\r
+ memcpy(mac.args, args, argc * sizeof(int));\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ mac.body = NewTokenStream(GetAtomString(atable, name));\r
+ while (token != '\n') {\r
+ while (token == '\\') {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token == '\n')\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ else\r
+ RecordToken(mac.body, '\\', yylvalpp);\r
+ }\r
+ RecordToken(mac.body, token, yylvalpp);\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ };\r
+\r
+ symb = LookUpSymbol(macros, name);\r
+ if (symb) {\r
+ if (!symb->details.mac.undef) {\r
/* already defined -- need to make sure they are identical */
- if (symb->details.mac.argc != mac.argc) goto error;
- for (argc=0; argc < mac.argc; argc++)
- if (symb->details.mac.args[argc] != mac.args[argc])
- goto error;
- RewindTokenStream(symb->details.mac.body);
- RewindTokenStream(mac.body);
- do {
- int old_lval, old_token;
- old_token = ReadToken(symb->details.mac.body, yylvalpp);
- old_lval = yylvalpp->sc_int;
- token = ReadToken(mac.body, yylvalpp);
- if (token != old_token || yylvalpp->sc_int != old_lval) {
- error:
- StoreStr("Macro Redefined");
- StoreStr(GetStringOfAtom(atable,name));
- message=GetStrfromTStr();
- DecLineNumber();
- CPPShInfoLogMsg(message);
- IncLineNumber();
- ResetTString();
- break; }
- } while (token > 0);
- }
- FreeMacro(&symb->details.mac);
- } else {
- dummyLoc.file = 0;
- dummyLoc.line = 0;
- symb = AddSymbol(&dummyLoc, macros, name, MACRO_S);
- }
- symb->details.mac = mac;
- return '\n';
+ if (symb->details.mac.argc != mac.argc) goto error;\r
+ for (argc=0; argc < mac.argc; argc++)\r
+ if (symb->details.mac.args[argc] != mac.args[argc])\r
+ goto error;\r
+ RewindTokenStream(symb->details.mac.body);\r
+ RewindTokenStream(mac.body);\r
+ do {\r
+ int old_lval, old_token;\r
+ old_token = ReadToken(symb->details.mac.body, yylvalpp);\r
+ old_lval = yylvalpp->sc_int;\r
+ token = ReadToken(mac.body, yylvalpp);\r
+ if (token != old_token || yylvalpp->sc_int != old_lval) { \r
+ error:\r
+ StoreStr("Macro Redefined");\r
+ StoreStr(GetStringOfAtom(atable,name));\r
+ message=GetStrfromTStr();\r
+ DecLineNumber();\r
+ CPPShInfoLogMsg(message);\r
+ IncLineNumber();\r
+ ResetTString();\r
+ break; }\r
+ } while (token > 0);\r
+ }\r
+ FreeMacro(&symb->details.mac);\r
+ } else {\r
+ dummyLoc.file = 0;\r
+ dummyLoc.line = 0;\r
+ symb = AddSymbol(&dummyLoc, macros, name, MACRO_S);\r
+ }\r
+ symb->details.mac = mac;\r
+ return '\n';\r
} /* CPPdefine */
-
-static int CPPundef(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- Symbol *symb;
- if(token == '\n'){
- CPPErrorToInfoLog("#undef");
- return token;
- }
- if (token != CPP_IDENTIFIER)
- goto error;
- symb = LookUpSymbol(macros, yylvalpp->sc_ident);
- if (symb) {
- symb->details.mac.undef = 1;
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- error:
- CPPErrorToInfoLog("#undef");
- }
- return token;
+\r
+static int CPPundef(yystypepp * yylvalpp)\r
+{\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ Symbol *symb;\r
+ if(token == '\n'){\r
+ CPPErrorToInfoLog("#undef");\r
+ return token;\r
+ }\r
+ if (token != CPP_IDENTIFIER)\r
+ goto error;\r
+ symb = LookUpSymbol(macros, yylvalpp->sc_ident);\r
+ if (symb) {\r
+ symb->details.mac.undef = 1;\r
+ }\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token != '\n') {\r
+ error:\r
+ CPPErrorToInfoLog("#undef");\r
+ }\r
+ return token;\r
} /* CPPundef */
-
-/* CPPelse -- skip forward to appropriate spot. This is actually used
-** to skip to and #endif after seeing an #else, AND to skip to a #else,
-** #elif, or #endif after a #if/#ifdef/#ifndef/#elif test was false
-*/
-
-static int CPPelse(int matchelse, yystypepp * yylvalpp)
-{
- int atom,depth=0;
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- while (token > 0) {
- while (token != '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) != '#')
- continue;
- if ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) != CPP_IDENTIFIER)
- continue;
- atom = yylvalpp->sc_ident;
- if (atom == ifAtom || atom == ifdefAtom || atom == ifndefAtom){
- depth++; cpp->ifdepth++; cpp->elsetracker++;
- }
- else if (atom == endifAtom) {
- if(--depth<=0){
- cpp->elsedepth[cpp->elsetracker]=0;
- --cpp->elsetracker;
- if (cpp->ifdepth)
- --cpp->ifdepth;
- break;
- }
- --cpp->elsetracker;
- --cpp->ifdepth;
- }
- else if (((int)(matchelse) != 0)&& depth==0) {
- if (atom == elseAtom ){
- break;
- }
- else if (atom == elifAtom) {
- /* we decrement cpp->ifdepth here, because CPPif will increment
- * it and we really want to leave it alone */
- if (cpp->ifdepth){
- --cpp->ifdepth;
- --cpp->elsetracker;
- }
- return CPPif(yylvalpp);
- }
- }
- else if((atom==elseAtom) && (!ChkCorrectElseNesting())){
- CPPErrorToInfoLog("#else after a #else");
- cpp->CompileError=1;
- }
- };
- return token;
-}
-
-enum eval_prec {
- MIN_PREC,
- COND, LOGOR, LOGAND, OR, XOR, AND, EQUAL, RELATION, SHIFT, ADD, MUL, UNARY,
- MAX_PREC
-};
-
-static int op_logor(int a, int b) { return a || b; }
-static int op_logand(int a, int b) { return a && b; }
-static int op_or(int a, int b) { return a | b; }
-static int op_xor(int a, int b) { return a ^ b; }
-static int op_and(int a, int b) { return a & b; }
-static int op_eq(int a, int b) { return a == b; }
-static int op_ne(int a, int b) { return a != b; }
-static int op_ge(int a, int b) { return a >= b; }
-static int op_le(int a, int b) { return a <= b; }
-static int op_gt(int a, int b) { return a > b; }
-static int op_lt(int a, int b) { return a < b; }
-static int op_shl(int a, int b) { return a << b; }
-static int op_shr(int a, int b) { return a >> b; }
-static int op_add(int a, int b) { return a + b; }
-static int op_sub(int a, int b) { return a - b; }
-static int op_mul(int a, int b) { return a * b; }
-static int op_div(int a, int b) { return a / b; }
-static int op_mod(int a, int b) { return a % b; }
-static int op_pos(int a) { return a; }
-static int op_neg(int a) { return -a; }
-static int op_cmpl(int a) { return ~a; }
-static int op_not(int a) { return !a; }
-
-struct {
- int token, prec, (*op)(int, int);
-} binop[] = {
- { CPP_OR_OP, LOGOR, op_logor },
- { CPP_AND_OP, LOGAND, op_logand },
- { '|', OR, op_or },
- { '^', XOR, op_xor },
- { '&', AND, op_and },
- { CPP_EQ_OP, EQUAL, op_eq },
- { CPP_NE_OP, EQUAL, op_ne },
- { '>', RELATION, op_gt },
- { CPP_GE_OP, RELATION, op_ge },
- { '<', RELATION, op_lt },
- { CPP_LE_OP, RELATION, op_le },
- { CPP_LEFT_OP, SHIFT, op_shl },
- { CPP_RIGHT_OP, SHIFT, op_shr },
- { '+', ADD, op_add },
- { '-', ADD, op_sub },
- { '*', MUL, op_mul },
- { '/', MUL, op_div },
- { '%', MUL, op_mod },
-};
-
-struct {
- int token, (*op)(int);
-} unop[] = {
- { '+', op_pos },
- { '-', op_neg },
- { '~', op_cmpl },
- { '!', op_not },
-};
-
-#define ALEN(A) (sizeof(A)/sizeof(A[0]))
-
-static int eval(int token, int prec, int *res, int *err, yystypepp * yylvalpp)
-{
- int i, val;
- Symbol *s;
- if (token == CPP_IDENTIFIER) {
- if (yylvalpp->sc_ident == definedAtom) {
- int needclose = 0;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(') {
- needclose = 1;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- if (token != CPP_IDENTIFIER)
- goto error;
- *res = (s = LookUpSymbol(macros, yylvalpp->sc_ident))
- ? !s->details.mac.undef : 0;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (needclose) {
- if (token != ')')
- goto error;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- } else if (MacroExpand(yylvalpp->sc_ident, yylvalpp)) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- return eval(token, prec, res, err, yylvalpp);
- } else {
- goto error;
- }
- } else if (token == CPP_INTCONSTANT) {
- *res = yylvalpp->sc_int;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- } else if (token == '(') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, MIN_PREC, res, err, yylvalpp);
- if (!*err) {
- if (token != ')')
- goto error;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- } else {
- for (i = ALEN(unop) - 1; i >= 0; i--) {
- if (unop[i].token == token)
- break;
- }
- if (i >= 0) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, UNARY, res, err, yylvalpp);
- *res = unop[i].op(*res);
- } else {
- goto error;
- }
- }
- while (!*err) {
- if (token == ')' || token == '\n') break;
- for (i = ALEN(binop) - 1; i >= 0; i--) {
- if (binop[i].token == token)
- break;
- }
- if (i < 0 || binop[i].prec <= prec)
- break;
- val = *res;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, binop[i].prec, res, err, yylvalpp);
- *res = binop[i].op(val, *res);
- }
- return token;
-error:
- CPPErrorToInfoLog("#if");;
- *err = 1;
- *res = 0;
- return token;
+\r
+/* CPPelse -- skip forward to appropriate spot. This is actually used\r
+** to skip to and #endif after seeing an #else, AND to skip to a #else,\r
+** #elif, or #endif after a #if/#ifdef/#ifndef/#elif test was false\r
+*/\r
+\r
+static int CPPelse(int matchelse, yystypepp * yylvalpp)\r
+{\r
+ int atom,depth=0;\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ \r
+ while (token > 0) {\r
+ if (token != '#') {\r
+ while (token != '\n')\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ \r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ continue;\r
+ }\r
+ if ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) != CPP_IDENTIFIER)\r
+ continue;\r
+ atom = yylvalpp->sc_ident;\r
+ if (atom == ifAtom || atom == ifdefAtom || atom == ifndefAtom){\r
+ depth++; cpp->ifdepth++; cpp->elsetracker++;\r
+ }\r
+ else if (atom == endifAtom) {\r
+ if(--depth<=0){\r
+ cpp->elsedepth[cpp->elsetracker]=0;\r
+ --cpp->elsetracker;\r
+ if (cpp->ifdepth) \r
+ --cpp->ifdepth;\r
+ break;\r
+ } \r
+ --cpp->elsetracker;\r
+ --cpp->ifdepth;\r
+ }\r
+ else if (((int)(matchelse) != 0)&& depth==0) {\r
+ if (atom == elseAtom ) {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token != '\n') {\r
+ CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");\r
+ while (token != '\n')\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ } \r
+ break;\r
+ } \r
+ else if (atom == elifAtom) {\r
+ /* we decrement cpp->ifdepth here, because CPPif will increment\r
+ * it and we really want to leave it alone */\r
+ if (cpp->ifdepth){\r
+ --cpp->ifdepth;\r
+ --cpp->elsetracker;\r
+ }\r
+ return CPPif(yylvalpp);\r
+ }\r
+ }\r
+ else if((atom==elseAtom) && (!ChkCorrectElseNesting())){\r
+ CPPErrorToInfoLog("#else after a #else");\r
+ cpp->CompileError=1;\r
+ }\r
+ };\r
+ return token;\r
+}\r
+\r
+enum eval_prec {\r
+ MIN_PREC,\r
+ COND, LOGOR, LOGAND, OR, XOR, AND, EQUAL, RELATION, SHIFT, ADD, MUL, UNARY,\r
+ MAX_PREC\r
+};\r
+\r
+static int op_logor(int a, int b) { return a || b; }\r
+static int op_logand(int a, int b) { return a && b; }\r
+static int op_or(int a, int b) { return a | b; }\r
+static int op_xor(int a, int b) { return a ^ b; }\r
+static int op_and(int a, int b) { return a & b; }\r
+static int op_eq(int a, int b) { return a == b; }\r
+static int op_ne(int a, int b) { return a != b; }\r
+static int op_ge(int a, int b) { return a >= b; }\r
+static int op_le(int a, int b) { return a <= b; }\r
+static int op_gt(int a, int b) { return a > b; }\r
+static int op_lt(int a, int b) { return a < b; }\r
+static int op_shl(int a, int b) { return a << b; }\r
+static int op_shr(int a, int b) { return a >> b; }\r
+static int op_add(int a, int b) { return a + b; }\r
+static int op_sub(int a, int b) { return a - b; }\r
+static int op_mul(int a, int b) { return a * b; }\r
+static int op_div(int a, int b) { return a / b; }\r
+static int op_mod(int a, int b) { return a % b; }\r
+static int op_pos(int a) { return a; }\r
+static int op_neg(int a) { return -a; }\r
+static int op_cmpl(int a) { return ~a; }\r
+static int op_not(int a) { return !a; }\r
+\r
+struct {\r
+ int token, prec, (*op)(int, int);\r
+} binop[] = {\r
+ { CPP_OR_OP, LOGOR, op_logor },\r
+ { CPP_AND_OP, LOGAND, op_logand },\r
+ { '|', OR, op_or },\r
+ { '^', XOR, op_xor },\r
+ { '&', AND, op_and },\r
+ { CPP_EQ_OP, EQUAL, op_eq },\r
+ { CPP_NE_OP, EQUAL, op_ne },\r
+ { '>', RELATION, op_gt },\r
+ { CPP_GE_OP, RELATION, op_ge },\r
+ { '<', RELATION, op_lt },\r
+ { CPP_LE_OP, RELATION, op_le },\r
+ { CPP_LEFT_OP, SHIFT, op_shl },\r
+ { CPP_RIGHT_OP, SHIFT, op_shr },\r
+ { '+', ADD, op_add },\r
+ { '-', ADD, op_sub },\r
+ { '*', MUL, op_mul },\r
+ { '/', MUL, op_div },\r
+ { '%', MUL, op_mod },\r
+};\r
+\r
+struct {\r
+ int token, (*op)(int);\r
+} unop[] = {\r
+ { '+', op_pos },\r
+ { '-', op_neg },\r
+ { '~', op_cmpl },\r
+ { '!', op_not },\r
+};\r
+\r
+#define ALEN(A) (sizeof(A)/sizeof(A[0]))\r
+\r
+static int eval(int token, int prec, int *res, int *err, yystypepp * yylvalpp)\r
+{\r
+ int i, val;\r
+ Symbol *s;\r
+ if (token == CPP_IDENTIFIER) {\r
+ if (yylvalpp->sc_ident == definedAtom) {\r
+ int needclose = 0;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token == '(') {\r
+ needclose = 1;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ if (token != CPP_IDENTIFIER)\r
+ goto error;\r
+ *res = (s = LookUpSymbol(macros, yylvalpp->sc_ident))\r
+ ? !s->details.mac.undef : 0;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (needclose) {\r
+ if (token != ')')\r
+ goto error;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ } else if (MacroExpand(yylvalpp->sc_ident, yylvalpp)) {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ return eval(token, prec, res, err, yylvalpp);\r
+ } else {\r
+ goto error;\r
+ }\r
+ } else if (token == CPP_INTCONSTANT) {\r
+ *res = yylvalpp->sc_int;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ } else if (token == '(') {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ token = eval(token, MIN_PREC, res, err, yylvalpp);\r
+ if (!*err) {\r
+ if (token != ')')\r
+ goto error;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ } else {\r
+ for (i = ALEN(unop) - 1; i >= 0; i--) {\r
+ if (unop[i].token == token)\r
+ break;\r
+ }\r
+ if (i >= 0) {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ token = eval(token, UNARY, res, err, yylvalpp);\r
+ *res = unop[i].op(*res);\r
+ } else {\r
+ goto error;\r
+ }\r
+ }\r
+ while (!*err) {\r
+ if (token == ')' || token == '\n') break;\r
+ for (i = ALEN(binop) - 1; i >= 0; i--) {\r
+ if (binop[i].token == token)\r
+ break;\r
+ }\r
+ if (i < 0 || binop[i].prec <= prec)\r
+ break;\r
+ val = *res;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ token = eval(token, binop[i].prec, res, err, yylvalpp);\r
+ *res = binop[i].op(val, *res);\r
+ }\r
+ return token;\r
+error:\r
+ CPPErrorToInfoLog("incorrect preprocessor directive");\r
+ *err = 1;\r
+ *res = 0;\r
+ return token;\r
} /* eval */
-
-static int CPPif(yystypepp * yylvalpp) {
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- int res = 0, err = 0;
- cpp->elsetracker++;
- if (!cpp->ifdepth++)
- ifloc = *cpp->tokenLoc;
- if(cpp->ifdepth >MAX_IF_NESTING){
- CPPErrorToInfoLog("max #if nesting depth exceeded");
- return 0;
- }
- token = eval(token, MIN_PREC, &res, &err, yylvalpp);
- if (token != '\n') {
- CPPErrorToInfoLog("#if");
- } else if (!res && !err) {
- token = CPPelse(1, yylvalpp);
- }
- return token;
+\r
+static int CPPif(yystypepp * yylvalpp) {\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ int res = 0, err = 0;\r
+ cpp->elsetracker++;\r
+ if (!cpp->ifdepth++)\r
+ ifloc = *cpp->tokenLoc;\r
+ if(cpp->ifdepth >MAX_IF_NESTING){\r
+ CPPErrorToInfoLog("max #if nesting depth exceeded");\r
+ return 0;\r
+ }\r
+ token = eval(token, MIN_PREC, &res, &err, yylvalpp);\r
+ if (token != '\n') {\r
+ CPPWarningToInfoLog("unexpected tokens following the preprocessor directive - expected a newline");\r
+ while (token != '\n')\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ } \r
+ if (!res && !err) {\r
+ token = CPPelse(1, yylvalpp);\r
+ }\r
+\r
+ return token;\r
} /* CPPif */
-
-static int CPPifdef(int defined, yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- int name = yylvalpp->sc_ident;
- if(++cpp->ifdepth >MAX_IF_NESTING){
- CPPErrorToInfoLog("max #if nesting depth exceeded");
- return 0;
- }
- cpp->elsetracker++;
- if (token != CPP_IDENTIFIER) {
- defined ? CPPErrorToInfoLog("ifdef"):CPPErrorToInfoLog("ifndef");
- } else {
- Symbol *s = LookUpSymbol(macros, name);
- if (((s && !s->details.mac.undef) ? 1 : 0) != defined)
- token = CPPelse(1, yylvalpp);
- }
- return token;
+\r
+static int CPPifdef(int defined, yystypepp * yylvalpp)\r
+{\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ int name = yylvalpp->sc_ident;\r
+ if(++cpp->ifdepth >MAX_IF_NESTING){\r
+ CPPErrorToInfoLog("max #if nesting depth exceeded");\r
+ return 0;\r
+ }\r
+ cpp->elsetracker++;\r
+ if (token != CPP_IDENTIFIER) {\r
+ defined ? CPPErrorToInfoLog("ifdef"):CPPErrorToInfoLog("ifndef");\r
+ } else {\r
+ Symbol *s = LookUpSymbol(macros, name);\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token != '\n') {\r
+ CPPWarningToInfoLog("unexpected tokens following #ifdef preprocessor directive - expected a newline");\r
+ while (token != '\n')\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ if (((s && !s->details.mac.undef) ? 1 : 0) != defined)\r
+ token = CPPelse(1, yylvalpp);\r
+ }\r
+ return token;\r
} /* CPPifdef */
-
-static int CPPline(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if(token=='\n'){
- DecLineNumber();
- CPPErrorToInfoLog("#line");
- IncLineNumber();
- return token;
- }
- else if (token == CPP_INTCONSTANT) {
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- SetLineNumber(yylvalpp->sc_int);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (token == CPP_INTCONSTANT) {
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- SetStringNumber(yylvalpp->sc_int);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if(token!='\n')
- CPPErrorToInfoLog("#line");
- }
- else if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#line");
- }
- }
- else{
- CPPErrorToInfoLog("#line");
- }
- return token;
-}
-
-static int CPPerror(yystypepp * yylvalpp) {
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- const char *message;
-
- while (token != '\n') {
- if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){
- StoreStr(yylvalpp->symbol_name);
- }else if(token == CPP_IDENTIFIER || token == CPP_STRCONSTANT){
- StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
- }else {
- StoreStr(GetStringOfAtom(atable,token));
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- DecLineNumber();
- /* store this msg into the shader's information log..set the Compile Error flag!!!! */
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- cpp->CompileError=1;
- IncLineNumber();
- return '\n';
-}/* CPPerror */
-
-static int CPPpragma(yystypepp * yylvalpp)
-{
- const char *SrcStr;
- const char *DestStr;
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if(token=='\n'){
- DecLineNumber();
- CPPErrorToInfoLog("#pragma");
- IncLineNumber();
- return token;
- }
- if (token != CPP_IDENTIFIER)goto error;
- SrcStr = GetAtomString(atable, yylvalpp->sc_ident);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != CPP_IDENTIFIER) goto error;
- DestStr = GetAtomString(atable, yylvalpp->sc_ident);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != ')') goto error;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if(token!='\n')goto error;
- /* make a call to CPP function MapStrings with SrcStr and DestStr. */
- MapStrings(SrcStr,DestStr);
- }else{
-error:
- CPPErrorToInfoLog("#pragma");
- return token;
- }
-
- return token;
+\r
+static int CPPline(yystypepp * yylvalpp) \r
+{\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if(token=='\n'){\r
+ DecLineNumber();\r
+ CPPErrorToInfoLog("#line");\r
+ IncLineNumber();\r
+ return token;\r
+ }\r
+ else if (token == CPP_INTCONSTANT) {\r
+ yylvalpp->sc_int=atoi(yylvalpp->symbol_name);\r
+ SetLineNumber(yylvalpp->sc_int);\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ \r
+ if (token == CPP_INTCONSTANT) {\r
+ yylvalpp->sc_int=atoi(yylvalpp->symbol_name);\r
+ SetStringNumber(yylvalpp->sc_int);\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if(token!='\n')\r
+ CPPErrorToInfoLog("#line");\r
+ }\r
+ else if (token == '\n'){\r
+ return token;\r
+ }\r
+ else{\r
+ CPPErrorToInfoLog("#line");\r
+ }\r
+ }\r
+ else{\r
+ CPPErrorToInfoLog("#line");\r
+ }\r
+ return token;\r
+}\r
+\r
+static int CPPerror(yystypepp * yylvalpp) {\r
+\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ const char *message;\r
+ \r
+ while (token != '\n') {\r
+ if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){\r
+ StoreStr(yylvalpp->symbol_name);\r
+ }else if(token == CPP_IDENTIFIER || token == CPP_STRCONSTANT){\r
+ StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));\r
+ }else {\r
+ StoreStr(GetStringOfAtom(atable,token));\r
+ }\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ DecLineNumber();\r
+ /*store this msg into the shader's information log..set the Compile Error flag!!!! */
+ message=GetStrfromTStr();\r
+ CPPShInfoLogMsg(message);\r
+ ResetTString();\r
+ cpp->CompileError=1;\r
+ IncLineNumber();\r
+ return '\n';\r
+}/*CPPerror */
+\r
+static int CPPpragma(yystypepp * yylvalpp)\r
+{\r
+ char SrcStrName[2];\r
+ char** allTokens;\r
+ int tokenCount = 0;\r
+ int maxTokenCount = 10;\r
+ const char* SrcStr;\r
+ int i;\r
+\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ \r
+ if (token=='\n') {\r
+ DecLineNumber();\r
+ CPPErrorToInfoLog("#pragma");\r
+ IncLineNumber();\r
+ return token;\r
+ }\r
+ \r
+ allTokens = (char**)malloc(sizeof(char*) * maxTokenCount); \r
+\r
+ while (token != '\n') {\r
+ if (tokenCount >= maxTokenCount) {\r
+ maxTokenCount *= 2;\r
+ allTokens = (char**)realloc((char**)allTokens, sizeof(char*) * maxTokenCount);\r
+ }\r
+ switch (token) {\r
+ case CPP_IDENTIFIER:\r
+ SrcStr = GetAtomString(atable, yylvalpp->sc_ident);\r
+ allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);\r
+ strcpy(allTokens[tokenCount++], SrcStr);\r
+ break;\r
+ case CPP_INTCONSTANT:\r
+ SrcStr = yylvalpp->symbol_name;\r
+ allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);\r
+ strcpy(allTokens[tokenCount++], SrcStr);\r
+ break;\r
+ case CPP_FLOATCONSTANT:\r
+ SrcStr = yylvalpp->symbol_name;\r
+ allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);\r
+ strcpy(allTokens[tokenCount++], SrcStr);\r
+ break;\r
+ case -1:\r
+ /* EOF */
+ CPPShInfoLogMsg("#pragma directive must end with a newline"); \r
+ return token;\r
+ default:\r
+ SrcStrName[0] = token;\r
+ SrcStrName[1] = '\0';\r
+ allTokens[tokenCount] = (char*)malloc(2);\r
+ strcpy(allTokens[tokenCount++], SrcStrName);\r
+ }\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+\r
+ cpp->currentInput->ungetch(cpp->currentInput, token, yylvalpp);\r
+ HandlePragma(allTokens, tokenCount);\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ \r
+ for (i = 0; i < tokenCount; ++i) {\r
+ free (allTokens[i]);\r
+ }\r
+ free (allTokens); \r
+\r
+ return token;\r
} /* CPPpragma */
-
-#define GL2_VERSION_NUMBER 110
-
-static int CPPversion(yystypepp * yylvalpp)
-{
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (cpp->notAVersionToken == 1)
- CPPShInfoLogMsg("#version must occur before any other statement in the program");
-
- if(token=='\n'){
- DecLineNumber();
- CPPErrorToInfoLog("#version");
- IncLineNumber();
- return token;
- }
- if (token != CPP_INTCONSTANT)
- CPPErrorToInfoLog("#version");
-
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- /* SetVersionNumber(yylvalpp->sc_int); */
-
- if (yylvalpp->sc_int != GL2_VERSION_NUMBER)
- CPPShInfoLogMsg("Version number not supported by GL2");
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#version");
- }
- return token;
+\r
+#define GL2_VERSION_NUMBER 110\r
+\r
+static int CPPversion(yystypepp * yylvalpp)\r
+{\r
+\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+\r
+ if (cpp->notAVersionToken == 1)\r
+ CPPShInfoLogMsg("#version must occur before any other statement in the program");\r
+\r
+ if(token=='\n'){\r
+ DecLineNumber();\r
+ CPPErrorToInfoLog("#version");\r
+ IncLineNumber();\r
+ return token;\r
+ }\r
+ if (token != CPP_INTCONSTANT)\r
+ CPPErrorToInfoLog("#version");\r
+ \r
+ yylvalpp->sc_int=atoi(yylvalpp->symbol_name);\r
+ /*SetVersionNumber(yylvalpp->sc_int); */
+ \r
+ if (yylvalpp->sc_int != GL2_VERSION_NUMBER)\r
+ CPPShInfoLogMsg("Version number not supported by GL2");\r
+\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ \r
+ if (token == '\n'){\r
+ return token;\r
+ }\r
+ else{\r
+ CPPErrorToInfoLog("#version");\r
+ }\r
+ return token;\r
} /* CPPversion */
-
-static int CPPextension(yystypepp * yylvalpp)
-{
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- char extensionName[80];
-
- if(token=='\n'){
- DecLineNumber();
- CPPShInfoLogMsg("extension name not specified");
- IncLineNumber();
- return token;
- }
-
- if (token != CPP_IDENTIFIER)
- CPPErrorToInfoLog("#extension");
-
- strcpy(extensionName, GetAtomString(atable, yylvalpp->sc_ident));
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != ':') {
- CPPShInfoLogMsg("':' missing after extension name");
- return token;
- }
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != CPP_IDENTIFIER) {
- CPPShInfoLogMsg("behavior for extension not specified");
- return token;
- }
-
- updateExtensionBehavior(extensionName, GetAtomString(atable, yylvalpp->sc_ident));
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#extension");
- }
- return token;
+\r
+static int CPPextension(yystypepp * yylvalpp)\r
+{\r
+\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ char extensionName[80];\r
+\r
+ if(token=='\n'){\r
+ DecLineNumber();\r
+ CPPShInfoLogMsg("extension name not specified");\r
+ IncLineNumber();\r
+ return token;\r
+ }\r
+\r
+ if (token != CPP_IDENTIFIER)\r
+ CPPErrorToInfoLog("#extension");\r
+ \r
+ strcpy(extensionName, GetAtomString(atable, yylvalpp->sc_ident));\r
+ \r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token != ':') {\r
+ CPPShInfoLogMsg("':' missing after extension name");\r
+ return token;\r
+ }\r
+ \r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token != CPP_IDENTIFIER) {\r
+ CPPShInfoLogMsg("behavior for extension not specified");\r
+ return token;\r
+ }\r
+\r
+ updateExtensionBehavior(extensionName, GetAtomString(atable, yylvalpp->sc_ident));\r
+\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token == '\n'){\r
+ return token;\r
+ }\r
+ else{\r
+ CPPErrorToInfoLog("#extension");\r
+ }\r
+ return token;\r
} /* CPPextension */
-
-int readCPPline(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- const char *message;
- int isVersion = 0;
-
- if (token == CPP_IDENTIFIER) {
- if (yylvalpp->sc_ident == defineAtom) {
- token = CPPdefine(yylvalpp);
- } else if (yylvalpp->sc_ident == elseAtom) {
- if(ChkCorrectElseNesting()){
- if (!cpp->ifdepth ){
- CPPErrorToInfoLog("#else mismatch");
- cpp->CompileError=1;
- }
- token = CPPelse(0, yylvalpp);
- }else{
- CPPErrorToInfoLog("#else after a #else");
- cpp->ifdepth=0;
- cpp->notAVersionToken = 1;
- return 0;
- }
- } else if (yylvalpp->sc_ident == elifAtom) {
- if (!cpp->ifdepth){
- CPPErrorToInfoLog("#elif mismatch");
- cpp->CompileError=1;
- }
- token = CPPelse(0, yylvalpp);
- } else if (yylvalpp->sc_ident == endifAtom) {
- cpp->elsedepth[cpp->elsetracker]=0;
- --cpp->elsetracker;
- if (!cpp->ifdepth){
- CPPErrorToInfoLog("#endif mismatch");
- cpp->CompileError=1;
- }
- else
- --cpp->ifdepth;
- } else if (yylvalpp->sc_ident == ifAtom) {
- token = CPPif(yylvalpp);
- } else if (yylvalpp->sc_ident == ifdefAtom) {
- token = CPPifdef(1, yylvalpp);
- } else if (yylvalpp->sc_ident == ifndefAtom) {
- token = CPPifdef(0, yylvalpp);
- } else if (yylvalpp->sc_ident == lineAtom) {
- token = CPPline(yylvalpp);
- } else if (yylvalpp->sc_ident == pragmaAtom) {
- token = CPPpragma(yylvalpp);
- } else if (yylvalpp->sc_ident == undefAtom) {
- token = CPPundef(yylvalpp);
- } else if (yylvalpp->sc_ident == errorAtom) {
- token = CPPerror(yylvalpp);
- } else if (yylvalpp->sc_ident == versionAtom) {
- token = CPPversion(yylvalpp);
- isVersion = 1;
- } else if (yylvalpp->sc_ident == extensionAtom) {
- token = CPPextension(yylvalpp);
- } else {
- StoreStr("Invalid Directive");
- StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- }
- }
- while (token != '\n' && token != 0 && token != EOF) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
-
- cpp->notAVersionToken = !isVersion;
-
- return token;
+\r
+int readCPPline(yystypepp * yylvalpp)\r
+{\r
+ int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ const char *message;\r
+ int isVersion = 0;\r
+\r
+ if (token == CPP_IDENTIFIER) {\r
+ if (yylvalpp->sc_ident == defineAtom) {\r
+ token = CPPdefine(yylvalpp);\r
+ } else if (yylvalpp->sc_ident == elseAtom) {\r
+ if(ChkCorrectElseNesting()){\r
+ if (!cpp->ifdepth ){\r
+ CPPErrorToInfoLog("#else mismatch");\r
+ cpp->CompileError=1;\r
+ }\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token != '\n') {\r
+ CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");\r
+ while (token != '\n')\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ token = CPPelse(0, yylvalpp);\r
+ }else{\r
+ CPPErrorToInfoLog("#else after a #else");\r
+ cpp->ifdepth=0;\r
+ cpp->notAVersionToken = 1;\r
+ return 0;\r
+ }\r
+ } else if (yylvalpp->sc_ident == elifAtom) {\r
+ if (!cpp->ifdepth){\r
+ CPPErrorToInfoLog("#elif mismatch");\r
+ cpp->CompileError=1;\r
+ } \r
+ /* this token is really a dont care, but we still need to eat the tokens */
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp); \r
+ while (token != '\n')\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ token = CPPelse(0, yylvalpp);\r
+ } else if (yylvalpp->sc_ident == endifAtom) {\r
+ cpp->elsedepth[cpp->elsetracker]=0;\r
+ --cpp->elsetracker;\r
+ if (!cpp->ifdepth){\r
+ CPPErrorToInfoLog("#endif mismatch");\r
+ cpp->CompileError=1;\r
+ }\r
+ else\r
+ --cpp->ifdepth;\r
+ } else if (yylvalpp->sc_ident == ifAtom) {\r
+ token = CPPif(yylvalpp);\r
+ } else if (yylvalpp->sc_ident == ifdefAtom) {\r
+ token = CPPifdef(1, yylvalpp);\r
+ } else if (yylvalpp->sc_ident == ifndefAtom) {\r
+ token = CPPifdef(0, yylvalpp);\r
+ } else if (yylvalpp->sc_ident == lineAtom) {\r
+ token = CPPline(yylvalpp);\r
+ } else if (yylvalpp->sc_ident == pragmaAtom) {\r
+ token = CPPpragma(yylvalpp);\r
+ } else if (yylvalpp->sc_ident == undefAtom) {\r
+ token = CPPundef(yylvalpp);\r
+ } else if (yylvalpp->sc_ident == errorAtom) {\r
+ token = CPPerror(yylvalpp);\r
+ } else if (yylvalpp->sc_ident == versionAtom) {\r
+ token = CPPversion(yylvalpp);\r
+ isVersion = 1;\r
+ } else if (yylvalpp->sc_ident == extensionAtom) {\r
+ token = CPPextension(yylvalpp);\r
+ } else {\r
+ StoreStr("Invalid Directive");\r
+ StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));\r
+ message=GetStrfromTStr();\r
+ CPPShInfoLogMsg(message);\r
+ ResetTString();\r
+ }\r
+ }\r
+ while (token != '\n' && token != 0 && token != EOF) {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ \r
+ cpp->notAVersionToken = !isVersion;\r
+\r
+ return token;\r
} /* readCPPline */
-
-void FreeMacro(MacroSymbol *s) {
- DeleteTokenStream(s->body);
-}
-
-static int eof_scan(InputSrc *in, yystypepp * yylvalpp) { return -1; }
-static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) { }
-
-static void PushEofSrc() {
- InputSrc *in = malloc(sizeof(InputSrc));
- memset(in, 0, sizeof(InputSrc));
- in->scan = eof_scan;
- in->getch = eof_scan;
- in->ungetch = noop;
- in->prev = cpp->currentInput;
- cpp->currentInput = in;
-}
-
-static void PopEofSrc() {
- if (cpp->currentInput->scan == eof_scan) {
- InputSrc *in = cpp->currentInput;
- cpp->currentInput = in->prev;
- free(in);
- }
-}
-
-static TokenStream *PrescanMacroArg(TokenStream *a, yystypepp * yylvalpp) {
- int token;
- TokenStream *n;
- RewindTokenStream(a);
- do {
- token = ReadToken(a, yylvalpp);
- if (token == CPP_IDENTIFIER && LookUpSymbol(macros, yylvalpp->sc_ident))
- break;
- } while (token > 0);
- if (token <= 0) return a;
- n = NewTokenStream("macro arg");
- PushEofSrc();
- ReadFromTokenStream(a, 0, 0);
- while ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) > 0) {
- if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp->sc_ident, yylvalpp))
- continue;
- RecordToken(n, token, yylvalpp);
- }
- PopEofSrc();
- DeleteTokenStream(a);
- return n;
+\r
+void FreeMacro(MacroSymbol *s) {\r
+ DeleteTokenStream(s->body);\r
+}\r
+\r
+static int eof_scan(InputSrc *in, yystypepp * yylvalpp) { return -1; }\r
+static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) { }\r
+\r
+static void PushEofSrc() {\r
+ InputSrc *in = malloc(sizeof(InputSrc));\r
+ memset(in, 0, sizeof(InputSrc));\r
+ in->scan = eof_scan;\r
+ in->getch = eof_scan;\r
+ in->ungetch = noop;\r
+ in->prev = cpp->currentInput;\r
+ cpp->currentInput = in;\r
+}\r
+\r
+static void PopEofSrc() {\r
+ if (cpp->currentInput->scan == eof_scan) {\r
+ InputSrc *in = cpp->currentInput;\r
+ cpp->currentInput = in->prev;\r
+ free(in);\r
+ }\r
+}\r
+\r
+static TokenStream *PrescanMacroArg(TokenStream *a, yystypepp * yylvalpp) {\r
+ int token;\r
+ TokenStream *n;\r
+ RewindTokenStream(a);\r
+ do {\r
+ token = ReadToken(a, yylvalpp);\r
+ if (token == CPP_IDENTIFIER && LookUpSymbol(macros, yylvalpp->sc_ident))\r
+ break;\r
+ } while (token > 0);\r
+ if (token <= 0) return a;\r
+ n = NewTokenStream("macro arg");\r
+ PushEofSrc();\r
+ ReadFromTokenStream(a, 0, 0);\r
+ while ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) > 0) {\r
+ if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp->sc_ident, yylvalpp))\r
+ continue;\r
+ RecordToken(n, token, yylvalpp);\r
+ }\r
+ PopEofSrc();\r
+ DeleteTokenStream(a);\r
+ return n;\r
} /* PrescanMacroArg */
-
-typedef struct MacroInputSrc {
- InputSrc base;
- MacroSymbol *mac;
- TokenStream **args;
-} MacroInputSrc;
-
-/* macro_scan ---
-** return the next token for a macro expanion, handling macro args
-*/
-static int macro_scan(MacroInputSrc *in, yystypepp * yylvalpp) {
- int i;
- int token = ReadToken(in->mac->body, yylvalpp);
- if (token == CPP_IDENTIFIER) {
- for (i = in->mac->argc-1; i>=0; i--)
- if (in->mac->args[i] == yylvalpp->sc_ident) break;
- if (i >= 0) {
- ReadFromTokenStream(in->args[i], yylvalpp->sc_ident, 0);
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- }
- if (token > 0) return token;
- in->mac->busy = 0;
- cpp->currentInput = in->base.prev;
- if (in->args) {
- for (i=in->mac->argc-1; i>=0; i--)
- DeleteTokenStream(in->args[i]);
- free(in->args);
- }
- free(in);
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
+\r
+typedef struct MacroInputSrc {\r
+ InputSrc base;\r
+ MacroSymbol *mac;\r
+ TokenStream **args;\r
+} MacroInputSrc;\r
+\r
+/* macro_scan ---\r
+** return the next token for a macro expanion, handling macro args \r
+*/\r
+static int macro_scan(MacroInputSrc *in, yystypepp * yylvalpp) {\r
+ int i;\r
+ int token = ReadToken(in->mac->body, yylvalpp);\r
+ if (token == CPP_IDENTIFIER) {\r
+ for (i = in->mac->argc-1; i>=0; i--)\r
+ if (in->mac->args[i] == yylvalpp->sc_ident) break;\r
+ if (i >= 0) {\r
+ ReadFromTokenStream(in->args[i], yylvalpp->sc_ident, 0);\r
+ return cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ }\r
+ }\r
+ if (token > 0) return token;\r
+ in->mac->busy = 0;\r
+ cpp->currentInput = in->base.prev;\r
+ if (in->args) {\r
+ for (i=in->mac->argc-1; i>=0; i--)\r
+ DeleteTokenStream(in->args[i]);\r
+ free(in->args);\r
+ }\r
+ free(in);\r
+ return cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
} /* macro_scan */
-
-/* MacroExpand
-** check an identifier (atom) to see if it a macro that should be expanded.
-** If it is, push an InputSrc that will produce the appropriate expansion
-** and return TRUE. If not, return FALSE.
-*/
-
-int MacroExpand(int atom, yystypepp * yylvalpp)
-{
- Symbol *sym = LookUpSymbol(macros, atom);
- MacroInputSrc *in;
- int i,j, token, depth=0;
- const char *message;
- if (atom == __LINE__Atom) {
- yylvalpp->sc_int = GetLineNumber();
- sprintf(yylvalpp->symbol_name,"%d",yylvalpp->sc_int);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (atom == __FILE__Atom) {
- yylvalpp->sc_int = GetStringNumber();
- sprintf(yylvalpp->symbol_name,"%d",yylvalpp->sc_int);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (atom == __VERSION__Atom) {
- strcpy(yylvalpp->symbol_name,"100");
- yylvalpp->sc_int = atoi(yylvalpp->symbol_name);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (!sym || sym->details.mac.undef) return 0;
+\r
+/* MacroExpand\r
+** check an identifier (atom) to see if it a macro that should be expanded.\r
+** If it is, push an InputSrc that will produce the appropriate expansion\r
+** and return TRUE. If not, return FALSE.\r
+*/\r
+\r
+int MacroExpand(int atom, yystypepp * yylvalpp)\r
+{\r
+ Symbol *sym = LookUpSymbol(macros, atom);\r
+ MacroInputSrc *in;\r
+ int i,j, token, depth=0;\r
+ const char *message;\r
+ if (atom == __LINE__Atom) {\r
+ yylvalpp->sc_int = GetLineNumber();\r
+ sprintf(yylvalpp->symbol_name,"%d",yylvalpp->sc_int);\r
+ UngetToken(CPP_INTCONSTANT, yylvalpp);\r
+ return 1;\r
+ }\r
+ if (atom == __FILE__Atom) {\r
+ yylvalpp->sc_int = GetStringNumber();\r
+ sprintf(yylvalpp->symbol_name,"%d",yylvalpp->sc_int);\r
+ UngetToken(CPP_INTCONSTANT, yylvalpp);\r
+ return 1;\r
+ }\r
+ if (atom == __VERSION__Atom) {\r
+ strcpy(yylvalpp->symbol_name,"100");\r
+ yylvalpp->sc_int = atoi(yylvalpp->symbol_name);\r
+ UngetToken(CPP_INTCONSTANT, yylvalpp);\r
+ return 1;\r
+ }\r
+ if (!sym || sym->details.mac.undef) return 0;\r
if (sym->details.mac.busy) return 0; /* no recursive expansions */
- in = malloc(sizeof(*in));
- memset(in, 0, sizeof(*in));
- in->base.scan = (void *)macro_scan;
- in->base.line = cpp->currentInput->line;
- in->base.name = cpp->currentInput->name;
- in->mac = &sym->details.mac;
- if (sym->details.mac.args) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '(') {
- UngetToken(token, yylvalpp);
- yylvalpp->sc_ident = atom;
- return 0;
- }
- in->args = malloc(in->mac->argc * sizeof(TokenStream *));
- for (i=0; i<in->mac->argc; i++)
- in->args[i] = NewTokenStream("macro arg");
- i=0;j=0;
- do{
- depth = 0;
- while(1) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) {
- StoreStr("EOF in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- return 1;
- }
- if((in->mac->argc==0) && (token!=')')) break;
- if (depth == 0 && (token == ',' || token == ')')) break;
- if (token == '(') depth++;
- if (token == ')') depth--;
- RecordToken(in->args[i], token, yylvalpp);
- j=1;
- }
- if (token == ')') {
- if((in->mac->argc==1) &&j==0)
- break;
- i++;
- break;
- }
- i++;
- }while(i < in->mac->argc);
-
- if (i < in->mac->argc) {
- StoreStr("Too few args in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- } else if (token != ')') {
- depth=0;
- while (token >= 0 && (depth > 0 || token != ')')) {
- if (token == ')') depth--;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(') depth++;
- }
-
- if (token <= 0) {
- StoreStr("EOF in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- return 1;
- }
- StoreStr("Too many args in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- }
- for (i=0; i<in->mac->argc; i++) {
- in->args[i] = PrescanMacroArg(in->args[i], yylvalpp);
- }
- }
-#if 0
- printf(" <%s:%d>found macro %s\n", GetAtomString(atable, loc.file),
- loc.line, GetAtomString(atable, atom));
- for (i=0; i<in->mac->argc; i++) {
- printf("\targ %s = '", GetAtomString(atable, in->mac->args[i]));
- DumpTokenStream(stdout, in->args[i]);
- printf("'\n");
- }
-#endif
- /*retain the input source*/
- in->base.prev = cpp->currentInput;
- sym->details.mac.busy = 1;
- RewindTokenStream(sym->details.mac.body);
- cpp->currentInput = &in->base;
- return 1;
+ in = malloc(sizeof(*in));\r
+ memset(in, 0, sizeof(*in));\r
+ in->base.scan = (void *)macro_scan;\r
+ in->base.line = cpp->currentInput->line;\r
+ in->base.name = cpp->currentInput->name;\r
+ in->mac = &sym->details.mac;\r
+ if (sym->details.mac.args) {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token != '(') {\r
+ UngetToken(token, yylvalpp);\r
+ yylvalpp->sc_ident = atom;\r
+ return 0;\r
+ }\r
+ in->args = malloc(in->mac->argc * sizeof(TokenStream *));\r
+ for (i=0; i<in->mac->argc; i++)\r
+ in->args[i] = NewTokenStream("macro arg");\r
+ i=0;j=0;\r
+ do{\r
+ depth = 0;\r
+ while(1) {\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token <= 0) {\r
+ StoreStr("EOF in Macro ");\r
+ StoreStr(GetStringOfAtom(atable,atom));\r
+ message=GetStrfromTStr();\r
+ CPPShInfoLogMsg(message);\r
+ ResetTString();\r
+ return 1;\r
+ }\r
+ if((in->mac->argc==0) && (token!=')')) break;\r
+ if (depth == 0 && (token == ',' || token == ')')) break;\r
+ if (token == '(') depth++;\r
+ if (token == ')') depth--;\r
+ RecordToken(in->args[i], token, yylvalpp);\r
+ j=1;\r
+ }\r
+ if (token == ')') {\r
+ if((in->mac->argc==1) &&j==0)\r
+ break;\r
+ i++;\r
+ break;\r
+ }\r
+ i++;\r
+ }while(i < in->mac->argc);\r
+\r
+ if (i < in->mac->argc) {\r
+ StoreStr("Too few args in Macro ");\r
+ StoreStr(GetStringOfAtom(atable,atom));\r
+ message=GetStrfromTStr();\r
+ CPPShInfoLogMsg(message);\r
+ ResetTString();\r
+ } else if (token != ')') {\r
+ depth=0;\r
+ while (token >= 0 && (depth > 0 || token != ')')) {\r
+ if (token == ')') depth--;\r
+ token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+ if (token == '(') depth++;\r
+ }\r
+ \r
+ if (token <= 0) {\r
+ StoreStr("EOF in Macro ");\r
+ StoreStr(GetStringOfAtom(atable,atom));\r
+ message=GetStrfromTStr();\r
+ CPPShInfoLogMsg(message);\r
+ ResetTString();\r
+ return 1;\r
+ }\r
+ StoreStr("Too many args in Macro ");\r
+ StoreStr(GetStringOfAtom(atable,atom));\r
+ message=GetStrfromTStr();\r
+ CPPShInfoLogMsg(message);\r
+ ResetTString();\r
+ }\r
+ for (i=0; i<in->mac->argc; i++) {\r
+ in->args[i] = PrescanMacroArg(in->args[i], yylvalpp);\r
+ }\r
+ }\r
+#if 0\r
+ printf(" <%s:%d>found macro %s\n", GetAtomString(atable, loc.file),\r
+ loc.line, GetAtomString(atable, atom));\r
+ for (i=0; i<in->mac->argc; i++) {\r
+ printf("\targ %s = '", GetAtomString(atable, in->mac->args[i]));\r
+ DumpTokenStream(stdout, in->args[i]);\r
+ printf("'\n");\r
+ }\r
+#endif\r
+ /*retain the input source*/\r
+ in->base.prev = cpp->currentInput;\r
+ sym->details.mac.busy = 1;\r
+ RewindTokenStream(sym->details.mac.body);\r
+ cpp->currentInput = &in->base;\r
+ return 1;\r
} /* MacroExpand */
-
-int ChkCorrectElseNesting(void)
-{
- if(cpp->elsedepth[cpp->elsetracker]==0){
- cpp->elsedepth[cpp->elsetracker]=1;
- return 1;
- }
- return 0;
-}
-
-
+\r
+int ChkCorrectElseNesting(void)\r
+{\r
+ if(cpp->elsedepth[cpp->elsetracker]==0){\r
+ cpp->elsedepth[cpp->elsetracker]=1;\r
+ return 1; \r
+ }\r
+ return 0;\r
+}\r
+\r
+\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// cpp.h
-*/
-
-#if !defined(__CPP_H)
-#define __CPP_H 1
-
-#include "parser.h"
-#include "tokens.h"
-
-int InitCPP(void);
-int FinalCPP(void);
-int readCPPline(yystypepp * yylvalpp);
-int MacroExpand(int atom, yystypepp * yylvalpp);
-int ChkCorrectElseNesting(void);
-
-typedef struct MacroSymbol {
- int argc;
- int *args;
- TokenStream *body;
- unsigned busy:1;
- unsigned undef:1;
-} MacroSymbol;
-
-void FreeMacro(MacroSymbol *);
-int PredefineMacro(char *);
-
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* cpp.h */
+/* */
+\r
+#if !defined(__CPP_H)\r
+#define __CPP_H 1\r
+\r
+#include "parser.h"\r
+#include "tokens.h"\r
+\r
+int InitCPP(void);\r
+int FinalCPP(void);\r
+int readCPPline(yystypepp * yylvalpp);\r
+int MacroExpand(int atom, yystypepp * yylvalpp);\r
+int ChkCorrectElseNesting(void);\r
+\r
+typedef struct MacroSymbol {\r
+ int argc;\r
+ int *args;\r
+ TokenStream *body;\r
+ unsigned busy:1;\r
+ unsigned undef:1;\r
+} MacroSymbol;\r
+\r
+void FreeMacro(MacroSymbol *);\r
+int PredefineMacro(char *);\r
+\r
void CPPDebugLogMsg(const char *msg); /* Prints information into debug log */
void CPPShInfoLogMsg(const char*); /* Store cpp Err Msg into Sh.Info.Log */
-void MapStrings(const char*,const char*); /* #pragma directive container. */
+void CPPWarningToInfoLog(const char *msg); /* Prints warning messages into info log */
+void HandlePragma(const char**, int numTokens); /* #pragma directive container. */
void ResetTString(void); /* #error Message as TString. */
-void CPPErrorToInfoLog(char*); /* Stick all cpp errors into Sh.Info.log */
+void CPPErrorToInfoLog(char*); /* Stick all cpp errors into Sh.Info.log . */
void StoreStr(char*); /* Store the TString in Parse Context. */
-void SetLineNumber(int); /* Set line number. */
-void SetStringNumber(int); /* Set string number. */
-int GetLineNumber(void); /* Get the current String Number. */
-int GetStringNumber(void); /* Get the current String Number. */
-const char* GetStrfromTStr(void); /* Convert TString to String. */
-void updateExtensionBehavior(const char* extName, const char* behavior);
-int FreeCPP(void);
-
+void SetLineNumber(int); /* Set line number. */
+void SetStringNumber(int); /* Set string number. */
+int GetLineNumber(void); /* Get the current String Number. */
+int GetStringNumber(void); /* Get the current String Number. */
+const char* GetStrfromTStr(void); /* Convert TString to String. */
+void updateExtensionBehavior(const char* extName, const char* behavior);\r
+int FreeCPP(void);\r
+\r
#endif /* !(defined(__CPP_H) */
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// cppstruct.c
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "slglobals.h"
-
-CPPStruct *cpp = NULL;
-static int refCount = 0;
-
-int InitPreprocessor(void);
-int ResetPreprocessor(void);
-int FreeCPPStruct(void);
-int FinalizePreprocessor(void);
-
-/*
- * InitCPPStruct() - Initilaize the CPP structure.
- *
- */
-
-int InitCPPStruct(void)
-{
- int len;
- char *p;
-
- cpp = (CPPStruct *) malloc(sizeof(CPPStruct));
- if (cpp == NULL)
- return 0;
-
- refCount++;
-
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* cppstruct.c */
+/* */
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+\r
+#include "slglobals.h"\r
+\r
+CPPStruct *cpp = NULL;\r
+static int refCount = 0;\r
+\r
+int InitPreprocessor(void);\r
+int ResetPreprocessor(void);\r
+int FreeCPPStruct(void);\r
+int FinalizePreprocessor(void);\r
+\r
+/*\r
+ * InitCPPStruct() - Initilaize the CPP structure.\r
+ *\r
+ */\r
+\r
+int InitCPPStruct(void)\r
+{\r
+ int len;\r
+ char *p;\r
+\r
+ cpp = (CPPStruct *) malloc(sizeof(CPPStruct));\r
+ if (cpp == NULL)\r
+ return 0;\r
+\r
+ refCount++;\r
+\r
/* Initialize public members: */
- cpp->pLastSourceLoc = &cpp->lastSourceLoc;
-
- p = (char *) &cpp->options;
- len = sizeof(cpp->options);
- while (--len >= 0)
- p[len] = 0;
-
- ResetPreprocessor();
- return 1;
+ cpp->pLastSourceLoc = &cpp->lastSourceLoc;\r
+ \r
+ p = (char *) &cpp->options;\r
+ len = sizeof(cpp->options);\r
+ while (--len >= 0)\r
+ p[len] = 0;\r
+ \r
+ ResetPreprocessor();\r
+ return 1;\r
} /* InitCPPStruct */
-
-int ResetPreprocessor(void)
-{
+\r
+int ResetPreprocessor(void)\r
+{\r
/* Initialize private members: */
-
- cpp->lastSourceLoc.file = 0;
- cpp->lastSourceLoc.line = 0;
- cpp->pC=0;
- cpp->CompileError=0;
- cpp->ifdepth=0;
- for(cpp->elsetracker=0; cpp->elsetracker<64; cpp->elsetracker++)
- cpp->elsedepth[cpp->elsetracker]=0;
- cpp->elsetracker=0;
- return 1;
-}
-
+\r
+ cpp->lastSourceLoc.file = 0;\r
+ cpp->lastSourceLoc.line = 0;\r
+ cpp->pC=0;\r
+ cpp->CompileError=0; \r
+ cpp->ifdepth=0;\r
+ for(cpp->elsetracker=0; cpp->elsetracker<64; cpp->elsetracker++)\r
+ cpp->elsedepth[cpp->elsetracker]=0; \r
+ cpp->elsetracker=0;\r
+ cpp->tokensBeforeEOF = 0;\r
+ return 1;\r
+}\r
+\r
/*Intializing the Preprocessor. */
-
-int InitPreprocessor(void)
-{
- # define CPP_STUFF true
- # ifdef CPP_STUFF
- FreeCPPStruct();
- InitCPPStruct();
- cpp->options.Quiet = 1;
- cpp->options.profileString = "generic";
- if (!InitAtomTable(atable, 0))
- return 1;
- if (!InitScanner(cpp))
- return 1;
- # endif
- return 0;
-}
-
-/* FreeCPPStruct() - Free the CPP structure. */
-
-int FreeCPPStruct(void)
-{
- if (refCount)
- {
- free(cpp);
- refCount--;
- }
-
- return 1;
-}
-
-/* Finalizing the Preprocessor. */
-
-int FinalizePreprocessor(void)
-{
- # define CPP_STUFF true
- # ifdef CPP_STUFF
- FreeAtomTable(atable);
- FreeCPPStruct();
- FreeScanner();
- # endif
- return 0;
-}
-
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////// End of cppstruct.c //////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
+\r
+int InitPreprocessor(void)\r
+{\r
+ # define CPP_STUFF true\r
+ # ifdef CPP_STUFF\r
+ FreeCPPStruct();\r
+ InitCPPStruct();\r
+ cpp->options.Quiet = 1;\r
+ cpp->options.profileString = "generic";\r
+ if (!InitAtomTable(atable, 0))\r
+ return 1;\r
+ if (!InitScanner(cpp))\r
+ return 1;\r
+ # endif\r
+ return 0; \r
+}\r
+\r
+/*FreeCPPStruct() - Free the CPP structure. */
+\r
+int FreeCPPStruct(void)\r
+{\r
+ if (refCount)\r
+ {\r
+ free(cpp);\r
+ refCount--;\r
+ }\r
+ \r
+ return 1;\r
+}\r
+\r
+/*Finalizing the Preprocessor. */
+\r
+int FinalizePreprocessor(void)\r
+{\r
+ # define CPP_STUFF true\r
+ # ifdef CPP_STUFF\r
+ FreeAtomTable(atable);\r
+ FreeCPPStruct();\r
+ FreeScanner();\r
+ # endif\r
+ return 0; \r
+}\r
+\r
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*//////////////////////////////////// End of cppstruct.c ////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __STDC99__
-#include <stdint.h>
-#elif defined (_WIN64)
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-
-#include "memory.h"
-
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+#include <stddef.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+\r
+#ifdef __STDC99__\r
+#include <stdint.h>\r
+#elif defined (_WIN64)\r
+typedef unsigned __int64 uintptr_t;\r
+#else \r
+typedef unsigned int uintptr_t;\r
+#endif\r
+\r
+#include "memory.h"\r
+\r
/* default alignment and chunksize, if called with 0 arguments */
-#define CHUNKSIZE (64*1024)
-#define ALIGN 8
-
+#define CHUNKSIZE (64*1024)\r
+#define ALIGN 8\r
+\r
/* we need to call the `real' malloc and free, not our replacements */
-#undef malloc
-#undef free
-
-struct chunk {
- struct chunk *next;
-};
-
-struct cleanup {
- struct cleanup *next;
- void (*fn)(void *);
- void *arg;
-};
-
-struct MemoryPool_rec {
- struct chunk *next;
- uintptr_t free, end;
- size_t chunksize;
- uintptr_t alignmask;
- struct cleanup *cleanup;
-};
-
-MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align)
-{
- MemoryPool *pool;
-
- if (align == 0) align = ALIGN;
- if (chunksize == 0) chunksize = CHUNKSIZE;
- if (align & (align-1)) return 0;
- if (chunksize < sizeof(MemoryPool)) return 0;
- if (chunksize & (align-1)) return 0;
- if (!(pool = malloc(chunksize))) return 0;
- pool->next = 0;
- pool->chunksize = chunksize;
- pool->alignmask = (uintptr_t)(align)-1;
- pool->free = ((uintptr_t)(pool + 1) + pool->alignmask) & ~pool->alignmask;
- pool->end = (uintptr_t)pool + chunksize;
- pool->cleanup = 0;
- return pool;
-}
-
-void mem_FreePool(MemoryPool *pool)
-{
- struct cleanup *cleanup;
- struct chunk *p, *next;
-
- for (cleanup = pool->cleanup; cleanup; cleanup = cleanup->next) {
- cleanup->fn(cleanup->arg);
- }
- for (p = (struct chunk *)pool; p; p = next) {
- next = p->next;
- free(p);
- }
-}
-
-void *mem_Alloc(MemoryPool *pool, size_t size)
-{
- struct chunk *ch;
- void *rv = (void *)pool->free;
- size = (size + pool->alignmask) & ~pool->alignmask;
- if (size <= 0) size = pool->alignmask;
- pool->free += size;
- if (pool->free > pool->end || pool->free < (uintptr_t)rv) {
- size_t minreq = (size + sizeof(struct chunk) + pool->alignmask)
- & ~pool->alignmask;
- pool->free = (uintptr_t)rv;
- if (minreq >= pool->chunksize) {
- /* request size is too big for the chunksize, so allocate it as
- // a single chunk of the right size */
- ch = malloc(minreq);
- if (!ch) return 0;
- } else {
- ch = malloc(pool->chunksize);
- if (!ch) return 0;
- pool->free = (uintptr_t)ch + minreq;
- pool->end = (uintptr_t)ch + pool->chunksize;
- }
- ch->next = pool->next;
- pool->next = ch;
- rv = (void *)(((uintptr_t)(ch+1) + pool->alignmask) & ~pool->alignmask);
- }
- return rv;
-}
-
-int mem_AddCleanup(MemoryPool *pool, void (*fn)(void *), void *arg) {
- struct cleanup *cleanup;
-
- pool->free = (pool->free + sizeof(void *) - 1) & ~(sizeof(void *)-1);
- cleanup = mem_Alloc(pool, sizeof(struct cleanup));
- if (!cleanup) return -1;
- cleanup->next = pool->cleanup;
- cleanup->fn = fn;
- cleanup->arg = arg;
- pool->cleanup = cleanup;
- return 0;
-}
+#undef malloc\r
+#undef free\r
+\r
+struct chunk {\r
+ struct chunk *next;\r
+};\r
+\r
+struct cleanup {\r
+ struct cleanup *next;\r
+ void (*fn)(void *);\r
+ void *arg;\r
+};\r
+\r
+struct MemoryPool_rec {\r
+ struct chunk *next;\r
+ uintptr_t free, end;\r
+ size_t chunksize;\r
+ uintptr_t alignmask;\r
+ struct cleanup *cleanup;\r
+};\r
+\r
+MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align)\r
+{\r
+ MemoryPool *pool;\r
+\r
+ if (align == 0) align = ALIGN;\r
+ if (chunksize == 0) chunksize = CHUNKSIZE;\r
+ if (align & (align-1)) return 0;\r
+ if (chunksize < sizeof(MemoryPool)) return 0;\r
+ if (chunksize & (align-1)) return 0;\r
+ if (!(pool = malloc(chunksize))) return 0;\r
+ pool->next = 0;\r
+ pool->chunksize = chunksize;\r
+ pool->alignmask = (uintptr_t)(align)-1; \r
+ pool->free = ((uintptr_t)(pool + 1) + pool->alignmask) & ~pool->alignmask;\r
+ pool->end = (uintptr_t)pool + chunksize;\r
+ pool->cleanup = 0;\r
+ return pool;\r
+}\r
+\r
+void mem_FreePool(MemoryPool *pool)\r
+{\r
+ struct cleanup *cleanup;\r
+ struct chunk *p, *next;\r
+\r
+ for (cleanup = pool->cleanup; cleanup; cleanup = cleanup->next) {\r
+ cleanup->fn(cleanup->arg);\r
+ }\r
+ for (p = (struct chunk *)pool; p; p = next) {\r
+ next = p->next;\r
+ free(p);\r
+ }\r
+}\r
+\r
+void *mem_Alloc(MemoryPool *pool, size_t size)\r
+{\r
+ struct chunk *ch;\r
+ void *rv = (void *)pool->free;\r
+ size = (size + pool->alignmask) & ~pool->alignmask;\r
+ if (size <= 0) size = pool->alignmask;\r
+ pool->free += size;\r
+ if (pool->free > pool->end || pool->free < (uintptr_t)rv) {\r
+ size_t minreq = (size + sizeof(struct chunk) + pool->alignmask)\r
+ & ~pool->alignmask;\r
+ pool->free = (uintptr_t)rv;\r
+ if (minreq >= pool->chunksize) {\r
+ /* request size is too big for the chunksize, so allocate it as */
+ /* a single chunk of the right size */
+ ch = malloc(minreq);\r
+ if (!ch) return 0;\r
+ } else {\r
+ ch = malloc(pool->chunksize);\r
+ if (!ch) return 0;\r
+ pool->free = (uintptr_t)ch + minreq;\r
+ pool->end = (uintptr_t)ch + pool->chunksize;\r
+ }\r
+ ch->next = pool->next;\r
+ pool->next = ch;\r
+ rv = (void *)(((uintptr_t)(ch+1) + pool->alignmask) & ~pool->alignmask);\r
+ }\r
+ return rv;\r
+}\r
+\r
+int mem_AddCleanup(MemoryPool *pool, void (*fn)(void *), void *arg) {\r
+ struct cleanup *cleanup;\r
+\r
+ pool->free = (pool->free + sizeof(void *) - 1) & ~(sizeof(void *)-1);\r
+ cleanup = mem_Alloc(pool, sizeof(struct cleanup));\r
+ if (!cleanup) return -1;\r
+ cleanup->next = pool->cleanup;\r
+ cleanup->fn = fn;\r
+ cleanup->arg = arg;\r
+ pool->cleanup = cleanup;\r
+ return 0;\r
+}\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-#ifndef __MEMORY_H
-#define __MEMORY_H
-
-typedef struct MemoryPool_rec MemoryPool;
-
-extern MemoryPool *mem_CreatePool(size_t chunksize, unsigned align);
-extern void mem_FreePool(MemoryPool *);
-extern void *mem_Alloc(MemoryPool *p, size_t size);
-extern void *mem_Realloc(MemoryPool *p, void *old, size_t oldsize, size_t newsize);
-extern int mem_AddCleanup(MemoryPool *p, void (*fn)(void *), void *arg);
-
-#endif /* __MEMORY_H */
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+#ifndef __MEMORY_H\r
+#define __MEMORY_H\r
+\r
+typedef struct MemoryPool_rec MemoryPool;\r
+\r
+extern MemoryPool *mem_CreatePool(size_t chunksize, unsigned align);\r
+extern void mem_FreePool(MemoryPool *);\r
+extern void *mem_Alloc(MemoryPool *p, size_t size);\r
+extern void *mem_Realloc(MemoryPool *p, void *old, size_t oldsize, size_t newsize);\r
+extern int mem_AddCleanup(MemoryPool *p, void (*fn)(void *), void *arg);\r
+\r
+#endif /* __MEMORY_H */\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-#ifndef BISON_PARSER_H
-# define BISON_PARSER_H
-
-#ifndef yystypepp
-typedef struct {
- int sc_int;
- float sc_fval;
- int sc_ident;
- char symbol_name[MAX_SYMBOL_NAME_LEN+1];
-} yystypepp;
-
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-# define CPP_AND_OP 257
-# define CPP_SUB_ASSIGN 259
-# define CPP_MOD_ASSIGN 260
-# define CPP_ADD_ASSIGN 261
-# define CPP_DIV_ASSIGN 262
-# define CPP_MUL_ASSIGN 263
-# define CPP_EQ_OP 264
-# define CPP_XOR_OP 265
-# define ERROR_SY 266
-# define CPP_FLOATCONSTANT 267
-# define CPP_GE_OP 268
-# define CPP_RIGHT_OP 269
-# define CPP_IDENTIFIER 270
-# define CPP_INTCONSTANT 271
-# define CPP_LE_OP 272
-# define CPP_LEFT_OP 273
-# define CPP_DEC_OP 274
-# define CPP_NE_OP 275
-# define CPP_OR_OP 276
-# define CPP_INC_OP 277
-# define CPP_STRCONSTANT 278
-# define CPP_TYPEIDENTIFIER 279
-
-# define FIRST_USER_TOKEN_SY 289
-
-# define CPP_RIGHT_ASSIGN 280
-# define CPP_LEFT_ASSIGN 281
-# define CPP_AND_ASSIGN 282
-# define CPP_OR_ASSIGN 283
-# define CPP_XOR_ASSIGN 284
-# define CPP_LEFT_BRACKET 285
-# define CPP_RIGHT_BRACKET 286
-# define CPP_LEFT_BRACE 287
-# define CPP_RIGHT_BRACE 288
-
-#endif /* not BISON_PARSER_H */
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+\r
+#ifndef BISON_PARSER_H\r
+# define BISON_PARSER_H\r
+\r
+#ifndef yystypepp\r
+typedef struct {\r
+ int sc_int;\r
+ float sc_fval;\r
+ int sc_ident;\r
+ char symbol_name[MAX_SYMBOL_NAME_LEN+1];\r
+} yystypepp;\r
+\r
+# define YYSTYPE_IS_TRIVIAL 1\r
+#endif\r
+# define CPP_AND_OP 257\r
+# define CPP_SUB_ASSIGN 259\r
+# define CPP_MOD_ASSIGN 260\r
+# define CPP_ADD_ASSIGN 261\r
+# define CPP_DIV_ASSIGN 262\r
+# define CPP_MUL_ASSIGN 263\r
+# define CPP_EQ_OP 264\r
+# define CPP_XOR_OP 265 \r
+# define ERROR_SY 266\r
+# define CPP_FLOATCONSTANT 267\r
+# define CPP_GE_OP 268\r
+# define CPP_RIGHT_OP 269\r
+# define CPP_IDENTIFIER 270\r
+# define CPP_INTCONSTANT 271\r
+# define CPP_LE_OP 272\r
+# define CPP_LEFT_OP 273\r
+# define CPP_DEC_OP 274\r
+# define CPP_NE_OP 275\r
+# define CPP_OR_OP 276\r
+# define CPP_INC_OP 277\r
+# define CPP_STRCONSTANT 278\r
+# define CPP_TYPEIDENTIFIER 279\r
+\r
+# define FIRST_USER_TOKEN_SY 289\r
+\r
+# define CPP_RIGHT_ASSIGN 280\r
+# define CPP_LEFT_ASSIGN 281\r
+# define CPP_AND_ASSIGN 282\r
+# define CPP_OR_ASSIGN 283\r
+# define CPP_XOR_ASSIGN 284\r
+# define CPP_LEFT_BRACKET 285\r
+# define CPP_RIGHT_BRACKET 286\r
+# define CPP_LEFT_BRACE 287\r
+# define CPP_RIGHT_BRACE 288\r
+\r
+#endif /* not BISON_PARSER_H */\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-# include "slglobals.h"
-extern CPPStruct *cpp;
-int InitCPPStruct(void);
-int InitScanner(CPPStruct *cpp);
-int InitAtomTable(AtomTable *atable, int htsize);
-int ScanFromString(char *s);
-char* GetStringOfAtom(AtomTable *atable, int atom);
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+\r
+# include "slglobals.h"\r
+extern CPPStruct *cpp;\r
+int InitCPPStruct(void);\r
+int InitScanner(CPPStruct *cpp);\r
+int InitAtomTable(AtomTable *atable, int htsize);\r
+int ScanFromString(char *s);\r
+char* GetStringOfAtom(AtomTable *atable, int atom);\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// scanner.c
-*/
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if 0
- #include <ieeefp.h>
- #else
- #define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
- ((*(long *)&(x) & 0x007fffffL)==0000000000L))
-#endif
-
-#include "slglobals.h"
-
-
-typedef struct StringInputSrc {
- InputSrc base;
- char *p;
-} StringInputSrc;
-
-static int eof_scan(InputSrc *is, yystypepp * yylvalpp)
-{
- return EOF;
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* scanner.c */
+/* */
+\r
+#include <stdarg.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+\r
+#if 0\r
+ #include <ieeefp.h>\r
+ #else\r
+ #define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \\r
+ ((*(long *)&(x) & 0x007fffffL)==0000000000L))\r
+#endif\r
+\r
+#include "slglobals.h"\r
+\r
+\r
+typedef struct StringInputSrc {\r
+ InputSrc base;\r
+ char *p;\r
+} StringInputSrc;\r
+\r
+static int eof_scan(InputSrc *is, yystypepp * yylvalpp)\r
+{\r
+ return EOF;\r
} /* eof_scan */
-
-static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) {}
-
-static InputSrc eof_inputsrc = { 0, &eof_scan, &eof_scan, &noop };
-
-static int byte_scan(InputSrc *, yystypepp * yylvalpp);
-
-#define EOL_SY '\n'
-
-#if defined(_WIN32)
- #define DBG_BREAKPOINT() __asm int 3
- #elif defined(_M_AMD64)
- #define DBG_BREAKPOINT() assert(!"Dbg_Breakpoint");
- #else
- #define DBG_BREAKPOINT()
- #endif
-
- #if defined(_WIN32) && !defined(_M_AMD64)
- __int64 RDTSC ( void ) {
-
- __int64 v;
-
- __asm __emit 0x0f
- __asm __emit 0x31
- __asm mov dword ptr v, eax
- __asm mov dword ptr v+4, edx
-
- return v;
- }
-#endif
-
-
-int InitScanner(CPPStruct *cpp)
-{
+\r
+static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) {}\r
+\r
+static InputSrc eof_inputsrc = { 0, &eof_scan, &eof_scan, &noop };\r
+\r
+static int byte_scan(InputSrc *, yystypepp * yylvalpp);\r
+\r
+#define EOL_SY '\n'\r
+\r
+#if defined(_WIN32)\r
+ #define DBG_BREAKPOINT() __asm int 3\r
+ #elif defined(_M_AMD64)\r
+ #define DBG_BREAKPOINT() assert(!"Dbg_Breakpoint");\r
+ #else\r
+ #define DBG_BREAKPOINT()\r
+ #endif\r
+\r
+ #if defined(_WIN32) && !defined(_M_AMD64)\r
+ __int64 RDTSC ( void ) {\r
+\r
+ __int64 v;\r
+ \r
+ __asm __emit 0x0f\r
+ __asm __emit 0x31\r
+ __asm mov dword ptr v, eax\r
+ __asm mov dword ptr v+4, edx\r
+ \r
+ return v;\r
+ }\r
+#endif\r
+\r
+\r
+int InitScanner(CPPStruct *cpp)\r
+{\r
/* Add various atoms needed by the CPP line scanner: */
- if (!InitCPP())
- return 0;
-
- cpp->mostRecentToken = 0;
- cpp->tokenLoc = &cpp->ltokenLoc;
-
- cpp->ltokenLoc.file = 0;
- cpp->ltokenLoc.line = 0;
-
- cpp->currentInput = &eof_inputsrc;
- cpp->previous_token = '\n';
- cpp->notAVersionToken = 0;
-
- return 1;
+ if (!InitCPP())\r
+ return 0;\r
+\r
+ cpp->mostRecentToken = 0;\r
+ cpp->tokenLoc = &cpp->ltokenLoc;\r
+\r
+ cpp->ltokenLoc.file = 0;\r
+ cpp->ltokenLoc.line = 0;\r
+\r
+ cpp->currentInput = &eof_inputsrc;\r
+ cpp->previous_token = '\n';\r
+ cpp->notAVersionToken = 0;\r
+\r
+ return 1;\r
} /* InitScanner */
-
-int FreeScanner(void)
-{
- return (FreeCPP());
-}
-
-/*
- * str_getch()
- * takes care of reading from multiple strings.
- * returns the next-char from the input stream.
- * returns EOF when the complete shader is parsed.
- */
-static int str_getch(StringInputSrc *in)
-{
- for(;;){
- if (*in->p){
- if (*in->p == '\n') {
- in->base.line++;
- IncLineNumber();
- }
- return *in->p++;
- }
- if(++(cpp->PaWhichStr) < cpp->PaArgc){
- free(in);
- SetStringNumber(cpp->PaWhichStr);
- SetLineNumber(1);
- ScanFromString(cpp->PaArgv[cpp->PaWhichStr]);
- in=(StringInputSrc*)cpp->currentInput;
- continue;
- }
- else{
- cpp->currentInput = in->base.prev;
- cpp->PaWhichStr=0;
- free(in);
- return EOF;
- }
- }
+\r
+int FreeScanner(void)\r
+{\r
+ return (FreeCPP());\r
+}\r
+\r
+/*\r
+ * str_getch()\r
+ * takes care of reading from multiple strings.\r
+ * returns the next-char from the input stream.\r
+ * returns EOF when the complete shader is parsed.\r
+ */\r
+static int str_getch(StringInputSrc *in)\r
+{\r
+ for(;;){\r
+ if (*in->p){\r
+ if (*in->p == '\n') {\r
+ in->base.line++;\r
+ IncLineNumber();\r
+ }\r
+ return *in->p++;\r
+ }\r
+ if(++(cpp->PaWhichStr) < cpp->PaArgc){\r
+ free(in);\r
+ SetStringNumber(cpp->PaWhichStr);\r
+ SetLineNumber(1);\r
+ ScanFromString(cpp->PaArgv[cpp->PaWhichStr]);\r
+ in=(StringInputSrc*)cpp->currentInput;\r
+ continue; \r
+ }\r
+ else{\r
+ cpp->currentInput = in->base.prev;\r
+ cpp->PaWhichStr=0;\r
+ free(in);\r
+ return EOF;\r
+ } \r
+ }\r
} /* str_getch */
-
-static void str_ungetch(StringInputSrc *in, int ch, yystypepp *type) {
- if (in->p[-1] == ch)in->p--;
- else {
- *(in->p)='\0'; /* this would take care of shifting to the previous string. */
- cpp->PaWhichStr--;
- }
- if (ch == '\n') {
- in->base.line--;
- DecLineNumber();
- }
+\r
+static void str_ungetch(StringInputSrc *in, int ch, yystypepp *type) {\r
+ if (in->p[-1] == ch)in->p--;\r
+ else {\r
+ *(in->p)='\0'; /*this would take care of shifting to the previous string. */
+ cpp->PaWhichStr--;\r
+ } \r
+ if (ch == '\n') {\r
+ in->base.line--;\r
+ DecLineNumber();\r
+ }\r
} /* str_ungetch */
-
-int ScanFromString(char *s)
-{
-
- StringInputSrc *in = malloc(sizeof(StringInputSrc));
- memset(in, 0, sizeof(StringInputSrc));
- in->p = s;
- in->base.line = 1;
- in->base.scan = byte_scan;
- in->base.getch = (int (*)(InputSrc *, yystypepp *))str_getch;
- in->base.ungetch = (void (*)(InputSrc *, int, yystypepp *))str_ungetch;
- in->base.prev = cpp->currentInput;
- cpp->currentInput = &in->base;
-
- return 1;
+\r
+int ScanFromString(char *s)\r
+{\r
+ \r
+ StringInputSrc *in = malloc(sizeof(StringInputSrc));\r
+ memset(in, 0, sizeof(StringInputSrc));\r
+ in->p = s;\r
+ in->base.line = 1;\r
+ in->base.scan = byte_scan;\r
+ in->base.getch = (int (*)(InputSrc *, yystypepp *))str_getch;\r
+ in->base.ungetch = (void (*)(InputSrc *, int, yystypepp *))str_ungetch;\r
+ in->base.prev = cpp->currentInput;\r
+ cpp->currentInput = &in->base;\r
+\r
+ return 1;\r
} /* ScanFromString; */
-
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////// Floating point constants: /////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-/*
- * lBuildFloatValue() - Quick and dirty conversion to floating point. Since all
- * we need is single precision this should be quite precise.
- */
-
-static float lBuildFloatValue(const char *str, int len, int exp)
-{
- double val, expval, ten;
- int ii, llen, absexp;
- float rv;
-
- val = 0.0;
- llen = len;
- for (ii = 0; ii < len; ii++)
- val = val*10.0 + (str[ii] - '0');
- if (exp != 0) {
- absexp = exp > 0 ? exp : -exp;
- expval = 1.0f;
- ten = 10.0;
- while (absexp) {
- if (absexp & 1)
- expval *= ten;
- ten *= ten;
- absexp >>= 1;
- }
- if (exp >= 0) {
- val *= expval;
- } else {
- val /= expval;
- }
- }
- rv = (float)val;
- if (isinff(rv)) {
- CPPErrorToInfoLog(" ERROR___FP_CONST_OVERFLOW");
- }
- return rv;
+\r
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*///////////////////////////////// Floating point constants: ///////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*\r
+ * lBuildFloatValue() - Quick and dirty conversion to floating point. Since all\r
+ * we need is single precision this should be quite precise.\r
+ */\r
+\r
+static float lBuildFloatValue(const char *str, int len, int exp)\r
+{\r
+ double val, expval, ten;\r
+ int ii, llen, absexp;\r
+ float rv;\r
+\r
+ val = 0.0;\r
+ llen = len;\r
+ for (ii = 0; ii < len; ii++)\r
+ val = val*10.0 + (str[ii] - '0');\r
+ if (exp != 0) {\r
+ absexp = exp > 0 ? exp : -exp;\r
+ expval = 1.0f;\r
+ ten = 10.0;\r
+ while (absexp) {\r
+ if (absexp & 1)\r
+ expval *= ten;\r
+ ten *= ten;\r
+ absexp >>= 1;\r
+ }\r
+ if (exp >= 0) {\r
+ val *= expval;\r
+ } else {\r
+ val /= expval;\r
+ }\r
+ }\r
+ rv = (float)val;\r
+ if (isinff(rv)) {\r
+ CPPErrorToInfoLog(" ERROR___FP_CONST_OVERFLOW");\r
+ }\r
+ return rv;\r
} /* lBuildFloatValue */
-
-
-/*
- * lFloatConst() - Scan a floating point constant. Assumes that the scanner
- * has seen at least one digit, followed by either a decimal '.' or the
- * letter 'e'.
- */
-
-static int lFloatConst(char *str, int len, int ch, yystypepp * yylvalpp)
-{
- int HasDecimal, declen, exp, ExpSign;
- int str_len;
- float lval;
-
- HasDecimal = 0;
- declen = 0;
- exp = 0;
-
- str_len=len;
- if (ch == '.') {
- str[len++]=ch;
- HasDecimal = 1;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- while (ch >= '0' && ch <= '9') {
- if (len < MAX_SYMBOL_NAME_LEN) {
- declen++;
- if (len > 0 || ch != '0') {
- str[len] = ch;
- len++;str_len++;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } else {
- CPPErrorToInfoLog("ERROR___FP_CONST_TOO_LONG");
- len = 1,str_len=1;
- }
- }
- }
-
+\r
+\r
+/*\r
+ * lFloatConst() - Scan a floating point constant. Assumes that the scanner\r
+ * has seen at least one digit, followed by either a decimal '.' or the\r
+ * letter 'e'.\r
+ */\r
+\r
+static int lFloatConst(char *str, int len, int ch, yystypepp * yylvalpp)\r
+{\r
+ int HasDecimal, declen, exp, ExpSign;\r
+ int str_len;\r
+ float lval;\r
+ \r
+ HasDecimal = 0;\r
+ declen = 0;\r
+ exp = 0;\r
+ \r
+ str_len=len;\r
+ if (ch == '.') {\r
+ str[len++]=ch;\r
+ HasDecimal = 1;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ while (ch >= '0' && ch <= '9') {\r
+ if (len < MAX_SYMBOL_NAME_LEN) {\r
+ declen++;\r
+ if (len > 0 || ch != '0') {\r
+ str[len] = ch;\r
+ len++;str_len++;\r
+ }\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ } else {\r
+ CPPErrorToInfoLog("ERROR___FP_CONST_TOO_LONG");\r
+ len = 1,str_len=1;\r
+ }\r
+ }\r
+ }\r
+\r
/* Exponent: */
-
- if (ch == 'e' || ch == 'E') {
- ExpSign = 1;
- str[len++]=ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '+') {
- str[len++]=ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } else if (ch == '-') {
- ExpSign = -1;
- str[len++]=ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- if (ch >= '0' && ch <= '9') {
- while (ch >= '0' && ch <= '9') {
- exp = exp*10 + ch - '0';
- str[len++]=ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- } else {
- CPPErrorToInfoLog("ERROR___ERROR_IN_EXPONENT");
- }
- exp *= ExpSign;
- }
-
- if (len == 0) {
- lval = 0.0f;
- strcpy(str,"0.0");
- } else {
- str[len]='\0';
- lval = lBuildFloatValue(str, str_len, exp - declen);
- }
+\r
+ if (ch == 'e' || ch == 'E') {\r
+ ExpSign = 1;\r
+ str[len++]=ch;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '+') {\r
+ str[len++]=ch; \r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ } else if (ch == '-') {\r
+ ExpSign = -1;\r
+ str[len++]=ch;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ }\r
+ if (ch >= '0' && ch <= '9') {\r
+ while (ch >= '0' && ch <= '9') {\r
+ exp = exp*10 + ch - '0';\r
+ str[len++]=ch;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ }\r
+ } else {\r
+ CPPErrorToInfoLog("ERROR___ERROR_IN_EXPONENT");\r
+ }\r
+ exp *= ExpSign;\r
+ }\r
+ \r
+ if (len == 0) {\r
+ lval = 0.0f;\r
+ strcpy(str,"0.0");\r
+ } else {\r
+ str[len]='\0'; \r
+ lval = lBuildFloatValue(str, str_len, exp - declen);\r
+ }\r
/* Suffix: */
-
- yylvalpp->sc_fval = lval;
- strcpy(yylvalpp->symbol_name,str);
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return CPP_FLOATCONSTANT;
+ \r
+ yylvalpp->sc_fval = lval;\r
+ strcpy(yylvalpp->symbol_name,str);\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp); \r
+ return CPP_FLOATCONSTANT;\r
} /* lFloatConst */
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////// Normal Scanner //////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
-static int byte_scan(InputSrc *in, yystypepp * yylvalpp)
-{
- char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
- char string_val[MAX_STRING_LEN + 1];
- int AlreadyComplained;
- int len, ch, ii, ival = 0;
-
- for (;;) {
- yylvalpp->sc_int = 0;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-
- while (ch == ' ' || ch == '\t' || ch == '\r') {
- yylvalpp->sc_int = 1;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
-
- cpp->ltokenLoc.file = cpp->currentInput->name;
- cpp->ltokenLoc.line = cpp->currentInput->line;
- len = 0;
- switch (ch) {
- default:
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*/////////////////////////////////////// Normal Scanner ////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+ \r
+static int byte_scan(InputSrc *in, yystypepp * yylvalpp)\r
+{\r
+ char symbol_name[MAX_SYMBOL_NAME_LEN + 1];\r
+ char string_val[MAX_STRING_LEN + 1];\r
+ int AlreadyComplained;\r
+ int len, ch, ii, ival = 0;\r
+\r
+ for (;;) {\r
+ yylvalpp->sc_int = 0;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ \r
+ while (ch == ' ' || ch == '\t' || ch == '\r') {\r
+ yylvalpp->sc_int = 1;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ }\r
+ \r
+ cpp->ltokenLoc.file = cpp->currentInput->name;\r
+ cpp->ltokenLoc.line = cpp->currentInput->line;\r
+ len = 0;\r
+ switch (ch) {\r
+ default:\r
return ch; /* Single character token */
- case EOF:
- return -1;
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F': case 'G': case 'H': case 'I': case 'J':
- case 'K': case 'L': case 'M': case 'N': case 'O':
- case 'P': case 'Q': case 'R': case 'S': case 'T':
- case 'U': case 'V': case 'W': case 'X': case 'Y':
- case 'Z': case '_':
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f': case 'g': case 'h': case 'i': case 'j':
- case 'k': case 'l': case 'm': case 'n': case 'o':
- case 'p': case 'q': case 'r': case 's': case 't':
- case 'u': case 'v': case 'w': case 'x': case 'y':
- case 'z':
- do {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len] = ch;
- len++;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } else {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- } while ((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '_');
- if (len >= MAX_SYMBOL_NAME_LEN)
- len = MAX_SYMBOL_NAME_LEN - 1;
- symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
- return CPP_IDENTIFIER;
- break;
- case '0':
- yylvalpp->symbol_name[len++] = ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == 'x' || ch == 'X') {
- yylvalpp->symbol_name[len++] = ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if ((ch >= '0' && ch <= '9') ||
- (ch >= 'A' && ch <= 'F') ||
- (ch >= 'a' && ch <= 'f'))
- {
- AlreadyComplained = 0;
- ival = 0;
- do {
- yylvalpp->symbol_name[len++] = ch;
- if (ival <= 0x0fffffff) {
- if (ch >= '0' && ch <= '9') {
- ii = ch - '0';
- } else if (ch >= 'A' && ch <= 'F') {
- ii = ch - 'A' + 10;
- } else {
- ii = ch - 'a' + 10;
- }
- ival = (ival << 4) | ii;
- } else {
- if (!AlreadyComplained)
- CPPErrorToInfoLog("ERROR___HEX_CONST_OVERFLOW");
- AlreadyComplained = 1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while ((ch >= '0' && ch <= '9') ||
- (ch >= 'A' && ch <= 'F') ||
- (ch >= 'a' && ch <= 'f'));
- } else {
- CPPErrorToInfoLog("ERROR___ERROR_IN_HEX_CONSTANT");
- }
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_int = ival;
- return CPP_INTCONSTANT;
+ case EOF:\r
+ return -1;\r
+ case 'A': case 'B': case 'C': case 'D': case 'E':\r
+ case 'F': case 'G': case 'H': case 'I': case 'J':\r
+ case 'K': case 'L': case 'M': case 'N': case 'O':\r
+ case 'P': case 'Q': case 'R': case 'S': case 'T':\r
+ case 'U': case 'V': case 'W': case 'X': case 'Y':\r
+ case 'Z': case '_':\r
+ case 'a': case 'b': case 'c': case 'd': case 'e':\r
+ case 'f': case 'g': case 'h': case 'i': case 'j':\r
+ case 'k': case 'l': case 'm': case 'n': case 'o':\r
+ case 'p': case 'q': case 'r': case 's': case 't':\r
+ case 'u': case 'v': case 'w': case 'x': case 'y':\r
+ case 'z': \r
+ do {\r
+ if (len < MAX_SYMBOL_NAME_LEN) {\r
+ symbol_name[len] = ch;\r
+ len++;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ } else {\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ }\r
+ } while ((ch >= 'a' && ch <= 'z') ||\r
+ (ch >= 'A' && ch <= 'Z') ||\r
+ (ch >= '0' && ch <= '9') ||\r
+ ch == '_');\r
+ if (len >= MAX_SYMBOL_NAME_LEN)\r
+ len = MAX_SYMBOL_NAME_LEN - 1;\r
+ symbol_name[len] = '\0';\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);\r
+ return CPP_IDENTIFIER;\r
+ break;\r
+ case '0':\r
+ yylvalpp->symbol_name[len++] = ch;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == 'x' || ch == 'X') {\r
+ yylvalpp->symbol_name[len++] = ch;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if ((ch >= '0' && ch <= '9') ||\r
+ (ch >= 'A' && ch <= 'F') ||\r
+ (ch >= 'a' && ch <= 'f'))\r
+ {\r
+ AlreadyComplained = 0;\r
+ ival = 0;\r
+ do {\r
+ yylvalpp->symbol_name[len++] = ch;\r
+ if (ival <= 0x0fffffff) {\r
+ if (ch >= '0' && ch <= '9') {\r
+ ii = ch - '0';\r
+ } else if (ch >= 'A' && ch <= 'F') {\r
+ ii = ch - 'A' + 10;\r
+ } else {\r
+ ii = ch - 'a' + 10;\r
+ }\r
+ ival = (ival << 4) | ii;\r
+ } else {\r
+ if (!AlreadyComplained)\r
+ CPPErrorToInfoLog("ERROR___HEX_CONST_OVERFLOW");\r
+ AlreadyComplained = 1;\r
+ }\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ } while ((ch >= '0' && ch <= '9') ||\r
+ (ch >= 'A' && ch <= 'F') ||\r
+ (ch >= 'a' && ch <= 'f'));\r
+ } else {\r
+ CPPErrorToInfoLog("ERROR___ERROR_IN_HEX_CONSTANT");\r
+ }\r
+ yylvalpp->symbol_name[len] = '\0';\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ yylvalpp->sc_int = ival;\r
+ return CPP_INTCONSTANT;\r
} else if (ch >= '0' && ch <= '7') { /* octal integer constants */
- AlreadyComplained = 0;
- ival = 0;
- do {
- yylvalpp->symbol_name[len++] = ch;
- if (ival <= 0x1fffffff) {
- ii = ch - '0';
- ival = (ival << 3) | ii;
- } else {
- if (!AlreadyComplained)
- CPPErrorToInfoLog("ERROR___OCT_CONST_OVERFLOW");
- AlreadyComplained = 1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while (ch >= '0' && ch <= '7');
- if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E')
- return lFloatConst(yylvalpp->symbol_name, len, ch, yylvalpp);
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_int = ival;
- return CPP_INTCONSTANT;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- ch = '0';
- }
+ AlreadyComplained = 0;\r
+ ival = 0;\r
+ do {\r
+ yylvalpp->symbol_name[len++] = ch;\r
+ if (ival <= 0x1fffffff) {\r
+ ii = ch - '0';\r
+ ival = (ival << 3) | ii;\r
+ } else {\r
+ if (!AlreadyComplained)\r
+ CPPErrorToInfoLog("ERROR___OCT_CONST_OVERFLOW");\r
+ AlreadyComplained = 1;\r
+ }\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ } while (ch >= '0' && ch <= '7');\r
+ if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E') \r
+ return lFloatConst(yylvalpp->symbol_name, len, ch, yylvalpp);\r
+ yylvalpp->symbol_name[len] = '\0';\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ yylvalpp->sc_int = ival;\r
+ return CPP_INTCONSTANT;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ ch = '0';\r
+ }\r
/* Fall through... */
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- do {
- if (len < MAX_SYMBOL_NAME_LEN) {
- if (len > 0 || ch != '0') {
- yylvalpp->symbol_name[len] = ch;
- len++;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- } while (ch >= '0' && ch <= '9');
- if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E') {
- return lFloatConst(yylvalpp->symbol_name, len, ch, yylvalpp);
- } else {
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- ival = 0;
- AlreadyComplained = 0;
- for (ii = 0; ii < len; ii++) {
- ch = yylvalpp->symbol_name[ii] - '0';
- if ((ival > 214748364) || (ival == 214748364 && ch >= 8)) {
- if (!AlreadyComplained)
- CPPErrorToInfoLog("ERROR___INTEGER_CONST_OVERFLOW");
- AlreadyComplained = 1;
- }
- ival = ival*10 + ch;
- }
- yylvalpp->sc_int = ival;
- if(ival==0)
- strcpy(yylvalpp->symbol_name,"0");
- return CPP_INTCONSTANT;
- }
- break;
- case '-':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '-') {
- return CPP_DEC_OP;
- } else if (ch == '=') {
- return CPP_SUB_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '-';
- }
- case '+':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '+') {
- return CPP_INC_OP;
- } else if (ch == '=') {
- return CPP_ADD_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '+';
- }
- case '*':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_MUL_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '*';
- }
- case '%':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_MOD_ASSIGN;
- } else if (ch == '>'){
- return CPP_RIGHT_BRACE;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '%';
- }
- case ':':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '>') {
- return CPP_RIGHT_BRACKET;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return ':';
- }
- case '^':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '^') {
- return CPP_XOR_OP;
- } else {
- if (ch == '=')
- return CPP_XOR_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '^';
- }
- }
-
- case '=':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_EQ_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '=';
- }
- case '!':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_NE_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '!';
- }
- case '|':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '|') {
- return CPP_OR_OP;
- } else {
- if (ch == '=')
- return CPP_OR_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '|';
- }
- }
- case '&':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '&') {
- return CPP_AND_OP;
- } else {
- if (ch == '=')
- return CPP_AND_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '&';
- }
- }
- case '<':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '<') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if(ch == '=')
- return CPP_LEFT_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return CPP_LEFT_OP;
- }
- } else {
- if (ch == '=') {
- return CPP_LE_OP;
- } else {
- if (ch == '%')
- return CPP_LEFT_BRACE;
- else if (ch == ':')
- return CPP_LEFT_BRACKET;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '<';
- }
- }
- }
- case '>':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '>') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if(ch == '=')
- return CPP_RIGHT_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return CPP_RIGHT_OP;
- }
- } else {
- if (ch == '=') {
- return CPP_GE_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '>';
- }
- }
- case '.':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch >= '0' && ch <= '9') {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return lFloatConst(yylvalpp->symbol_name, 0, '.', yylvalpp);
- } else {
- if (ch == '.') {
+ case '1': case '2': case '3': case '4':\r
+ case '5': case '6': case '7': case '8': case '9':\r
+ do {\r
+ if (len < MAX_SYMBOL_NAME_LEN) {\r
+ if (len > 0 || ch != '0') {\r
+ yylvalpp->symbol_name[len] = ch;\r
+ len++;\r
+ }\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ }\r
+ } while (ch >= '0' && ch <= '9');\r
+ if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E') {\r
+ return lFloatConst(yylvalpp->symbol_name, len, ch, yylvalpp);\r
+ } else {\r
+ yylvalpp->symbol_name[len] = '\0';\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ ival = 0;\r
+ AlreadyComplained = 0;\r
+ for (ii = 0; ii < len; ii++) {\r
+ ch = yylvalpp->symbol_name[ii] - '0';\r
+ if ((ival > 214748364) || (ival == 214748364 && ch >= 8)) {\r
+ if (!AlreadyComplained)\r
+ CPPErrorToInfoLog("ERROR___INTEGER_CONST_OVERFLOW");\r
+ AlreadyComplained = 1;\r
+ }\r
+ ival = ival*10 + ch;\r
+ }\r
+ yylvalpp->sc_int = ival;\r
+ if(ival==0)\r
+ strcpy(yylvalpp->symbol_name,"0");\r
+ return CPP_INTCONSTANT;\r
+ }\r
+ break;\r
+ case '-':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '-') {\r
+ return CPP_DEC_OP;\r
+ } else if (ch == '=') {\r
+ return CPP_SUB_ASSIGN;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '-';\r
+ }\r
+ case '+':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '+') {\r
+ return CPP_INC_OP;\r
+ } else if (ch == '=') {\r
+ return CPP_ADD_ASSIGN;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '+';\r
+ }\r
+ case '*':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '=') {\r
+ return CPP_MUL_ASSIGN;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '*';\r
+ }\r
+ case '%':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '=') {\r
+ return CPP_MOD_ASSIGN;\r
+ } else if (ch == '>'){\r
+ return CPP_RIGHT_BRACE;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '%';\r
+ }\r
+ case ':':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '>') {\r
+ return CPP_RIGHT_BRACKET;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return ':';\r
+ }\r
+ case '^':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '^') {\r
+ return CPP_XOR_OP;\r
+ } else {\r
+ if (ch == '=')\r
+ return CPP_XOR_ASSIGN;\r
+ else{\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '^';\r
+ }\r
+ }\r
+ \r
+ case '=':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '=') {\r
+ return CPP_EQ_OP;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '=';\r
+ }\r
+ case '!':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '=') {\r
+ return CPP_NE_OP;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '!';\r
+ }\r
+ case '|':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '|') {\r
+ return CPP_OR_OP;\r
+ } else {\r
+ if (ch == '=')\r
+ return CPP_OR_ASSIGN;\r
+ else{\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '|';\r
+ }\r
+ }\r
+ case '&':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '&') {\r
+ return CPP_AND_OP;\r
+ } else {\r
+ if (ch == '=')\r
+ return CPP_AND_ASSIGN;\r
+ else{\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '&';\r
+ }\r
+ }\r
+ case '<':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '<') {\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if(ch == '=')\r
+ return CPP_LEFT_ASSIGN;\r
+ else{\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return CPP_LEFT_OP;\r
+ }\r
+ } else {\r
+ if (ch == '=') {\r
+ return CPP_LE_OP;\r
+ } else {\r
+ if (ch == '%')\r
+ return CPP_LEFT_BRACE;\r
+ else if (ch == ':')\r
+ return CPP_LEFT_BRACKET;\r
+ else{\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '<';\r
+ }\r
+ }\r
+ }\r
+ case '>':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '>') {\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if(ch == '=')\r
+ return CPP_RIGHT_ASSIGN;\r
+ else{\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return CPP_RIGHT_OP;\r
+ }\r
+ } else {\r
+ if (ch == '=') {\r
+ return CPP_GE_OP;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '>';\r
+ }\r
+ }\r
+ case '.':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch >= '0' && ch <= '9') {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return lFloatConst(yylvalpp->symbol_name, 0, '.', yylvalpp);\r
+ } else {\r
+ if (ch == '.') {\r
return -1; /* Special EOF hack */
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '.';
- }
- }
- case '/':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '/') {
- do {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while (ch != '\n' && ch != EOF);
- if (ch == EOF)
- return -1;
- return '\n';
- } else if (ch == '*') {
- int nlcount = 0;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- do {
- while (ch != '*') {
- if (ch == '\n') nlcount++;
- if (ch == EOF) {
- CPPErrorToInfoLog("ERROR___EOF_IN_COMMENT");
- return -1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == EOF) {
- CPPErrorToInfoLog("ERROR___EOF_IN_COMMENT");
- return -1;
- }
- } while (ch != '/');
- if (nlcount) {
- return '\n';
- }
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '.';\r
+ }\r
+ }\r
+ case '/':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '/') {\r
+ do {\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ } while (ch != '\n' && ch != EOF);\r
+ if (ch == EOF)\r
+ return -1;\r
+ return '\n';\r
+ } else if (ch == '*') {\r
+ int nlcount = 0;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ do {\r
+ while (ch != '*') {\r
+ if (ch == '\n') nlcount++;\r
+ if (ch == EOF) {\r
+ CPPErrorToInfoLog("ERROR___EOF_IN_COMMENT");\r
+ return -1;\r
+ }\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ }\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == EOF) {\r
+ CPPErrorToInfoLog("ERROR___EOF_IN_COMMENT");\r
+ return -1;\r
+ }\r
+ } while (ch != '/');\r
+ if (nlcount) {\r
+ return '\n';\r
+ }\r
/* Go try it again... */
- } else if (ch == '=') {
- return CPP_DIV_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '/';
- }
- break;
- case '"':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- while (ch != '"' && ch != '\n' && ch != EOF) {
- if (ch == '\\') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '\n' || ch == EOF) {
- break;
- }
- }
- if (len < MAX_STRING_LEN) {
- string_val[len] = ch;
- len++;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- };
- string_val[len] = '\0';
- if (ch == '"') {
- yylvalpp->sc_ident = LookUpAddString(atable, string_val);
- return CPP_STRCONSTANT;
- } else {
- CPPErrorToInfoLog("ERROR___CPP_EOL_IN_STRING");
- return ERROR_SY;
- }
- }
- }
+ } else if (ch == '=') {\r
+ return CPP_DIV_ASSIGN;\r
+ } else {\r
+ cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);\r
+ return '/';\r
+ }\r
+ break;\r
+ case '"':\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ while (ch != '"' && ch != '\n' && ch != EOF) {\r
+ if (ch == '\\') {\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ if (ch == '\n' || ch == EOF) {\r
+ break;\r
+ }\r
+ }\r
+ if (len < MAX_STRING_LEN) {\r
+ string_val[len] = ch;\r
+ len++;\r
+ ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);\r
+ }\r
+ };\r
+ string_val[len] = '\0';\r
+ if (ch == '"') {\r
+ yylvalpp->sc_ident = LookUpAddString(atable, string_val);\r
+ return CPP_STRCONSTANT;\r
+ } else {\r
+ CPPErrorToInfoLog("ERROR___CPP_EOL_IN_STRING");\r
+ return ERROR_SY;\r
+ }\r
+ }\r
+ }\r
} /* byte_scan */
-
-int yylex_CPP(char* buf, int maxSize)
-{
- yystypepp yylvalpp;
- int token = '\n';
-
- for(;;) {
-
- char* tokenString = 0;
- token = cpp->currentInput->scan(cpp->currentInput, &yylvalpp);
- if(check_EOF(token))
- return 0;
- if (token == '#' && (cpp->previous_token == '\n'||cpp->previous_token==0)) {
- token = readCPPline(&yylvalpp);
- if(check_EOF(token))
- return 0;
- continue;
- }
- cpp->previous_token = token;
+\r
+int yylex_CPP(char* buf, int maxSize)\r
+{ \r
+ yystypepp yylvalpp;\r
+ int token = '\n';\r
+\r
+ for(;;) {\r
+ \r
+ char* tokenString = 0;\r
+ token = cpp->currentInput->scan(cpp->currentInput, &yylvalpp);\r
+ if(check_EOF(token))\r
+ return 0;\r
+ if (token == '#' && (cpp->previous_token == '\n'||cpp->previous_token==0)) {\r
+ token = readCPPline(&yylvalpp);\r
+ if(check_EOF(token))\r
+ return 0;\r
+ continue;\r
+ }\r
+ cpp->previous_token = token;\r
/* expand macros */
- if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp.sc_ident, &yylvalpp)) {
- cpp->notAVersionToken = 1;
- continue;
- }
-
- if (token == '\n')
- continue;
-
- if (token == CPP_IDENTIFIER) {
- cpp->notAVersionToken = 1;
- tokenString = GetStringOfAtom(atable,yylvalpp.sc_ident);
- } else if (token == CPP_FLOATCONSTANT||token == CPP_INTCONSTANT){
- cpp->notAVersionToken = 1;
- tokenString = yylvalpp.symbol_name;
- } else {
- cpp->notAVersionToken = 1;
- tokenString = GetStringOfAtom(atable,token);
- }
-
- if (tokenString) {
- if ((signed)strlen(tokenString) >= maxSize) {
- return maxSize;
- } else if (strlen(tokenString) > 0) {
- strcpy(buf, tokenString);
- return (int)strlen(tokenString);
- }
-
- return 0;
- }
- }
-
- return 0;
+ if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp.sc_ident, &yylvalpp)) {\r
+ cpp->notAVersionToken = 1;\r
+ continue;\r
+ }\r
+ \r
+ if (token == '\n')\r
+ continue;\r
+ \r
+ if (token == CPP_IDENTIFIER) {\r
+ cpp->notAVersionToken = 1;\r
+ tokenString = GetStringOfAtom(atable,yylvalpp.sc_ident);\r
+ } else if (token == CPP_FLOATCONSTANT||token == CPP_INTCONSTANT){ \r
+ cpp->notAVersionToken = 1;\r
+ tokenString = yylvalpp.symbol_name;\r
+ } else {\r
+ cpp->notAVersionToken = 1;\r
+ tokenString = GetStringOfAtom(atable,token);\r
+ }\r
+ \r
+ if (tokenString) {\r
+ if ((signed)strlen(tokenString) >= maxSize) {\r
+ cpp->tokensBeforeEOF = 1;\r
+ return maxSize;\r
+ } else if (strlen(tokenString) > 0) {\r
+ strcpy(buf, tokenString);\r
+ cpp->tokensBeforeEOF = 1;\r
+ return (int)strlen(tokenString);\r
+ }\r
+\r
+ return 0;\r
+ }\r
+ }\r
+\r
+ return 0;\r
} /* yylex */
-
-/* Checks if the token just read is EOF or not. */
-int check_EOF(int token)
-{
- if(token==-1){
- if(cpp->ifdepth >0){
- CPPErrorToInfoLog("#endif missing!! Compilation stopped");
- cpp->CompileError=1;
- }
- return 1;
- }
- return 0;
-}
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////// End of scanner.c //////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
+\r
+/*Checks if the token just read is EOF or not. */
+int check_EOF(int token)\r
+{\r
+ if(token==-1){\r
+ if(cpp->ifdepth >0){\r
+ CPPErrorToInfoLog("#endif missing!! Compilation stopped");\r
+ cpp->CompileError=1;\r
+ }\r
+ return 1;\r
+ }\r
+ return 0;\r
+}\r
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*///////////////////////////////////// End of scanner.c ////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// scanner.h
-*/
-
-#if !defined(__SCANNER_H)
-#define __SCANNER_H 1
-
-#define MAX_SYMBOL_NAME_LEN 128
-#define MAX_STRING_LEN 512
-
-#include "parser.h"
-
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* scanner.h */
+/* */
+\r
+#if !defined(__SCANNER_H)\r
+#define __SCANNER_H 1\r
+\r
+#define MAX_SYMBOL_NAME_LEN 128\r
+#define MAX_STRING_LEN 512\r
+\r
+#include "parser.h"\r
+\r
/* Not really atom table stuff but needed first... */
-
-typedef struct SourceLoc_Rec {
- unsigned short file, line;
-} SourceLoc;
-
-int yyparse (void);
-
-int yylex_CPP(char* buf, int maxSize);
-
-typedef struct InputSrc {
- struct InputSrc *prev;
- int (*scan)(struct InputSrc *, yystypepp *);
- int (*getch)(struct InputSrc *, yystypepp *);
- void (*ungetch)(struct InputSrc *, int, yystypepp *);
- int name; /* atom */
- int line;
-} InputSrc;
-
-int InitScanner(CPPStruct *cpp); /* Intialise the cpp scanner. */
+\r
+typedef struct SourceLoc_Rec {\r
+ unsigned short file, line;\r
+} SourceLoc;\r
+\r
+int yyparse (void);\r
+\r
+int yylex_CPP(char* buf, int maxSize);\r
+\r
+typedef struct InputSrc {\r
+ struct InputSrc *prev;\r
+ int (*scan)(struct InputSrc *, yystypepp *);\r
+ int (*getch)(struct InputSrc *, yystypepp *);\r
+ void (*ungetch)(struct InputSrc *, int, yystypepp *);\r
+ int name; /* atom */\r
+ int line;\r
+} InputSrc;\r
+\r
+int InitScanner(CPPStruct *cpp); /* Intialise the cpp scanner. */
int ScanFromString(char *); /* Start scanning the input from the string mentioned. */
-int check_EOF(int); /* check if we hit a EOF abruptly */
+int check_EOF(int); /* check if we hit a EOF abruptly */
void CPPErrorToInfoLog(char *); /* sticking the msg,line into the Shader's.Info.log */
-void SetLineNumber(int);
-void SetStringNumber(int);
-void IncLineNumber(void);
-void DecLineNumber(void);
+void SetLineNumber(int);\r
+void SetStringNumber(int);\r
+void IncLineNumber(void);\r
+void DecLineNumber(void);\r
int FreeScanner(void); /* Free the cpp scanner */
#endif /* !(defined(__SCANNER_H) */
-
+\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// slglobals.h
-*/
-
-#if !defined(__SLGLOBALS_H)
-#define __SLGLOBALS_H 1
-
-typedef struct CPPStruct_Rec CPPStruct;
-
-extern CPPStruct *cpp;
-
-#undef CPPC_DEBUG_THE_COMPILER
-#if defined(_DEBUG)
-#define CPPC_DEBUG_THE_COMPILER 1
-#endif
-
-#undef CPPC_ENABLE_TOOLS
-#define CPPC_ENABLE_TOOLS 1
-
-#include "memory.h"
-#include "atom.h"
-#include "scanner.h"
-#include "cpp.h"
-#include "tokens.h"
-#include "symbols.h"
-#include "compile.h"
-#if !defined(NO_PARSER)
-#include "parser.h"
-#endif
-
-#if !defined(NULL)
-#define NULL 0
-#endif
-
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* slglobals.h */
+/* */
+\r
+#if !defined(__SLGLOBALS_H)\r
+#define __SLGLOBALS_H 1\r
+\r
+typedef struct CPPStruct_Rec CPPStruct;\r
+\r
+extern CPPStruct *cpp;\r
+\r
+#undef CPPC_DEBUG_THE_COMPILER\r
+#if defined(_DEBUG)\r
+#define CPPC_DEBUG_THE_COMPILER 1\r
+#endif\r
+\r
+#undef CPPC_ENABLE_TOOLS\r
+#define CPPC_ENABLE_TOOLS 1\r
+\r
+#include "memory.h"\r
+#include "atom.h"\r
+#include "scanner.h"\r
+#include "cpp.h"\r
+#include "tokens.h"\r
+#include "symbols.h"\r
+#include "compile.h"\r
+#if !defined(NO_PARSER)\r
+#include "parser.h"\r
+#endif\r
+\r
+#if !defined(NULL)\r
+#define NULL 0\r
+#endif\r
+\r
#endif /* !(defined(__SLGLOBALS_H) */
-
-
-
-
+\r
+\r
+ \r
+\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// symbols.c
-*/
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "slglobals.h"
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////// Symbol Table Variables: ///////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
-Scope *ScopeList = NULL;
-Scope *CurrentScope = NULL;
-Scope *GlobalScope = NULL;
-
-static void unlinkScope(void *_scope) {
- Scope *scope = _scope;
-
- if (scope->next)
- scope->next->prev = scope->prev;
- if (scope->prev)
- scope->prev->next = scope->next;
- else
- ScopeList = scope->next;
-}
-
-/*
- * NewScope()
- *
- */
-Scope *NewScopeInPool(MemoryPool *pool)
-{
- Scope *lScope;
-
- lScope = mem_Alloc(pool, sizeof(Scope));
- lScope->pool = pool;
- lScope->parent = NULL;
- lScope->funScope = NULL;
- lScope->symbols = NULL;
-
- lScope->level = 0;
-
- lScope->programs = NULL;
- if ((lScope->next = ScopeList))
- ScopeList->prev = lScope;
- lScope->prev = 0;
- ScopeList = lScope;
- mem_AddCleanup(pool, unlinkScope, lScope);
- return lScope;
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* symbols.c */
+/* */
+\r
+#include <assert.h>\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+#include "slglobals.h"\r
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*///////////////////////////////// Symbol Table Variables: /////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
+Scope *ScopeList = NULL;\r
+Scope *CurrentScope = NULL;\r
+Scope *GlobalScope = NULL;\r
+\r
+static void unlinkScope(void *_scope) {\r
+ Scope *scope = _scope;\r
+\r
+ if (scope->next)\r
+ scope->next->prev = scope->prev;\r
+ if (scope->prev)\r
+ scope->prev->next = scope->next;\r
+ else\r
+ ScopeList = scope->next;\r
+}\r
+\r
+/*\r
+ * NewScope()\r
+ *\r
+ */\r
+Scope *NewScopeInPool(MemoryPool *pool)\r
+{\r
+ Scope *lScope;\r
+\r
+ lScope = mem_Alloc(pool, sizeof(Scope));\r
+ lScope->pool = pool;\r
+ lScope->parent = NULL;\r
+ lScope->funScope = NULL;\r
+ lScope->symbols = NULL;\r
+ \r
+ lScope->level = 0;\r
+\r
+ lScope->programs = NULL;\r
+ if ((lScope->next = ScopeList))\r
+ ScopeList->prev = lScope;\r
+ lScope->prev = 0;\r
+ ScopeList = lScope;\r
+ mem_AddCleanup(pool, unlinkScope, lScope);\r
+ return lScope;\r
} /* NewScope */
-
-/*
- * PushScope()
- *
- */
-
-void PushScope(Scope *fScope)
-{
- Scope *lScope;
-
- if (CurrentScope) {
- fScope->level = CurrentScope->level + 1;
- if (fScope->level == 1) {
- if (!GlobalScope) {
- /* HACK - CTD -- if GlobalScope==NULL and level==1, we're
- * defining a function in the superglobal scope. Things
- * will break if we leave the level as 1, so we arbitrarily
- * set it to 2 */
- fScope->level = 2;
- }
- }
- if (fScope->level >= 2) {
- lScope = fScope;
- while (lScope->level > 2)
- lScope = lScope->next;
- fScope->funScope = lScope;
- }
- } else {
- fScope->level = 0;
- }
- fScope->parent = CurrentScope;
- CurrentScope = fScope;
+\r
+/*\r
+ * PushScope()\r
+ *\r
+ */\r
+\r
+void PushScope(Scope *fScope)\r
+{\r
+ Scope *lScope;\r
+\r
+ if (CurrentScope) {\r
+ fScope->level = CurrentScope->level + 1;\r
+ if (fScope->level == 1) {\r
+ if (!GlobalScope) {\r
+ /* HACK - CTD -- if GlobalScope==NULL and level==1, we're\r
+ * defining a function in the superglobal scope. Things\r
+ * will break if we leave the level as 1, so we arbitrarily\r
+ * set it to 2 */\r
+ fScope->level = 2;\r
+ }\r
+ }\r
+ if (fScope->level >= 2) {\r
+ lScope = fScope;\r
+ while (lScope->level > 2)\r
+ lScope = lScope->next;\r
+ fScope->funScope = lScope;\r
+ }\r
+ } else {\r
+ fScope->level = 0;\r
+ }\r
+ fScope->parent = CurrentScope;\r
+ CurrentScope = fScope;\r
} /* PushScope */
-
-/*
- * PopScope()
- *
- */
-
-Scope *PopScope(void)
-{
- Scope *lScope;
-
- lScope = CurrentScope;
- if (CurrentScope)
- CurrentScope = CurrentScope->parent;
- return lScope;
+\r
+/*\r
+ * PopScope()\r
+ *\r
+ */\r
+\r
+Scope *PopScope(void)\r
+{\r
+ Scope *lScope;\r
+\r
+ lScope = CurrentScope;\r
+ if (CurrentScope)\r
+ CurrentScope = CurrentScope->parent;\r
+ return lScope;\r
} /* PopScope */
-
-/*
- * NewSymbol() - Allocate a new symbol node;
- *
- */
-
-Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind)
-{
- Symbol *lSymb;
- char *pch;
- int ii;
-
- lSymb = (Symbol *) mem_Alloc(fScope->pool, sizeof(Symbol));
- lSymb->left = NULL;
- lSymb->right = NULL;
- lSymb->next = NULL;
- lSymb->name = name;
- lSymb->loc = *loc;
- lSymb->kind = kind;
-
+\r
+/*\r
+ * NewSymbol() - Allocate a new symbol node;\r
+ *\r
+ */\r
+\r
+Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind)\r
+{\r
+ Symbol *lSymb;\r
+ char *pch;\r
+ int ii;\r
+\r
+ lSymb = (Symbol *) mem_Alloc(fScope->pool, sizeof(Symbol));\r
+ lSymb->left = NULL;\r
+ lSymb->right = NULL;\r
+ lSymb->next = NULL;\r
+ lSymb->name = name;\r
+ lSymb->loc = *loc;\r
+ lSymb->kind = kind;\r
+ \r
/* Clear union area: */
-
- pch = (char *) &lSymb->details;
- for (ii = 0; ii < sizeof(lSymb->details); ii++)
- *pch++ = 0;
- return lSymb;
+\r
+ pch = (char *) &lSymb->details;\r
+ for (ii = 0; ii < sizeof(lSymb->details); ii++)\r
+ *pch++ = 0;\r
+ return lSymb;\r
} /* NewSymbol */
-
-/*
- * lAddToTree() - Using a binary tree is not a good idea for basic atom values because they
- * are generated in order. We'll fix this later (by reversing the bit pattern).
- */
-
-static void lAddToTree(Symbol **fSymbols, Symbol *fSymb)
-{
- Symbol *lSymb;
- int lrev, frev;
-
- lSymb = *fSymbols;
- if (lSymb) {
- frev = GetReversedAtom(atable, fSymb->name);
- while (lSymb) {
- lrev = GetReversedAtom(atable, lSymb->name);
- if (lrev == frev) {
- CPPErrorToInfoLog("GetAtomString(atable, fSymb->name)");
- break;
- } else {
- if (lrev > frev) {
- if (lSymb->left) {
- lSymb = lSymb->left;
- } else {
- lSymb->left = fSymb;
- break;
- }
- } else {
- if (lSymb->right) {
- lSymb = lSymb->right;
- } else {
- lSymb->right = fSymb;
- break;
- }
- }
- }
- }
- } else {
- *fSymbols = fSymb;
- }
+\r
+/*\r
+ * lAddToTree() - Using a binary tree is not a good idea for basic atom values because they\r
+ * are generated in order. We'll fix this later (by reversing the bit pattern).\r
+ */\r
+\r
+static void lAddToTree(Symbol **fSymbols, Symbol *fSymb)\r
+{\r
+ Symbol *lSymb;\r
+ int lrev, frev;\r
+\r
+ lSymb = *fSymbols;\r
+ if (lSymb) {\r
+ frev = GetReversedAtom(atable, fSymb->name);\r
+ while (lSymb) {\r
+ lrev = GetReversedAtom(atable, lSymb->name);\r
+ if (lrev == frev) {\r
+ CPPErrorToInfoLog("GetAtomString(atable, fSymb->name)");\r
+ break;\r
+ } else {\r
+ if (lrev > frev) {\r
+ if (lSymb->left) {\r
+ lSymb = lSymb->left;\r
+ } else {\r
+ lSymb->left = fSymb;\r
+ break;\r
+ }\r
+ } else {\r
+ if (lSymb->right) {\r
+ lSymb = lSymb->right;\r
+ } else {\r
+ lSymb->right = fSymb;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ } else {\r
+ *fSymbols = fSymb;\r
+ }\r
} /* lAddToTree */
-
-
-/*
- * AddSymbol() - Add a variable, type, or function name to a scope.
- *
- */
-
-Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind)
-{
- Symbol *lSymb;
-
- if (!fScope)
- fScope = CurrentScope;
- lSymb = NewSymbol(loc, fScope, atom, kind);
- lAddToTree(&fScope->symbols, lSymb);
- return lSymb;
+\r
+\r
+/*\r
+ * AddSymbol() - Add a variable, type, or function name to a scope.\r
+ *\r
+ */\r
+\r
+Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind)\r
+{\r
+ Symbol *lSymb;\r
+\r
+ if (!fScope)\r
+ fScope = CurrentScope;\r
+ lSymb = NewSymbol(loc, fScope, atom, kind);\r
+ lAddToTree(&fScope->symbols, lSymb);\r
+ return lSymb;\r
} /* AddSymbol */
-
-
-/*********************************************************************************************/
-/************************************ Symbol Semantic Functions ******************************/
-/*********************************************************************************************/
-
-/*
- * LookUpLocalSymbol()
- *
- */
-
-Symbol *LookUpLocalSymbol(Scope *fScope, int atom)
-{
- Symbol *lSymb;
- int rname, ratom;
-
- ratom = GetReversedAtom(atable, atom);
- if (!fScope)
- fScope = CurrentScope;
- lSymb = fScope->symbols;
- while (lSymb) {
- rname = GetReversedAtom(atable, lSymb->name);
- if (rname == ratom) {
- return lSymb;
- } else {
- if (rname > ratom) {
- lSymb = lSymb->left;
- } else {
- lSymb = lSymb->right;
- }
- }
- }
- return NULL;
+\r
+\r
+/*********************************************************************************************/\r
+/************************************ Symbol Semantic Functions ******************************/\r
+/*********************************************************************************************/\r
+\r
+/*\r
+ * LookUpLocalSymbol()\r
+ *\r
+ */\r
+\r
+Symbol *LookUpLocalSymbol(Scope *fScope, int atom)\r
+{\r
+ Symbol *lSymb;\r
+ int rname, ratom;\r
+\r
+ ratom = GetReversedAtom(atable, atom);\r
+ if (!fScope)\r
+ fScope = CurrentScope;\r
+ lSymb = fScope->symbols;\r
+ while (lSymb) {\r
+ rname = GetReversedAtom(atable, lSymb->name);\r
+ if (rname == ratom) {\r
+ return lSymb;\r
+ } else {\r
+ if (rname > ratom) {\r
+ lSymb = lSymb->left;\r
+ } else {\r
+ lSymb = lSymb->right;\r
+ }\r
+ }\r
+ }\r
+ return NULL;\r
} /* LookUpLocalSymbol */
-
-/*
- * LookUpSymbol()
- *
- */
-
-Symbol *LookUpSymbol(Scope *fScope, int atom)
-{
- Symbol *lSymb;
-
- if (!fScope)
- fScope = CurrentScope;
- while (fScope) {
- lSymb = LookUpLocalSymbol(fScope, atom);
- if (lSymb)
- return lSymb;
- fScope = fScope->parent;
- }
- return NULL;
+\r
+/*\r
+ * LookUpSymbol()\r
+ *\r
+ */\r
+\r
+Symbol *LookUpSymbol(Scope *fScope, int atom)\r
+{\r
+ Symbol *lSymb;\r
+\r
+ if (!fScope)\r
+ fScope = CurrentScope;\r
+ while (fScope) {\r
+ lSymb = LookUpLocalSymbol(fScope, atom);\r
+ if (lSymb)\r
+ return lSymb;\r
+ fScope = fScope->parent;\r
+ }\r
+ return NULL;\r
} /* LookUpSymbol */
-
+\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// symbols.h
-*/
-
-#if !defined(__SYMBOLS_H)
-#define __SYMBOLS_H 1
-
-#include "memory.h"
-
-typedef enum symbolkind {
- MACRO_S
-} symbolkind;
-
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* symbols.h */
+/* */
+\r
+#if !defined(__SYMBOLS_H)\r
+#define __SYMBOLS_H 1\r
+\r
+#include "memory.h"\r
+\r
+typedef enum symbolkind {\r
+ MACRO_S\r
+} symbolkind;\r
+\r
/* Typedefs for things defined here in "symbols.h": */
-
-typedef struct Scope_Rec Scope;
-typedef struct Symbol_Rec Symbol;
-
-typedef struct SymbolList_Rec {
- struct SymbolList_Rec *next;
- Symbol *symb;
-} SymbolList;
-
-struct Scope_Rec {
+\r
+typedef struct Scope_Rec Scope;\r
+typedef struct Symbol_Rec Symbol;\r
+\r
+typedef struct SymbolList_Rec {\r
+ struct SymbolList_Rec *next;\r
+ Symbol *symb;\r
+} SymbolList;\r
+\r
+struct Scope_Rec {\r
Scope *next, *prev; /* doubly-linked list of all scopes */
- Scope *parent;
+ Scope *parent;\r
Scope *funScope; /* Points to base scope of enclosing function */
MemoryPool *pool; /* pool used for allocation in this scope */
- Symbol *symbols;
-
+ Symbol *symbols;\r
+ \r
int level; /* 0 = super globals, 1 = globals, etc. */
-
+\r
/* Only used at global scope (level 1): */
SymbolList *programs; /* List of programs for this compilation. */
-};
-
-
+};\r
+\r
+\r
/* Symbol table is a simple binary tree. */
-
+\r
#include "cpp.h" /* to get MacroSymbol def */
-
-struct Symbol_Rec {
- Symbol *left, *right;
- Symbol *next;
+\r
+struct Symbol_Rec {\r
+ Symbol *left, *right;\r
+ Symbol *next;\r
int name; /* Name atom */
- SourceLoc loc;
- symbolkind kind;
- union {
- MacroSymbol mac;
- } details;
-};
-
-extern Scope *CurrentScope;
-extern Scope *GlobalScope;
-extern Scope *ScopeList;
-
-Scope *NewScopeInPool(MemoryPool *);
-#define NewScope() NewScopeInPool(CurrentScope->pool)
-void PushScope(Scope *fScope);
-Scope *PopScope(void);
-Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind);
-Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind);
-Symbol *LookUpLocalSymbol(Scope *fScope, int atom);
-Symbol *LookUpSymbol(Scope *fScope, int atom);
-void CPPErrorToInfoLog(char *);
-
-
+ SourceLoc loc;\r
+ symbolkind kind;\r
+ union {\r
+ MacroSymbol mac;\r
+ } details;\r
+};\r
+\r
+extern Scope *CurrentScope;\r
+extern Scope *GlobalScope;\r
+extern Scope *ScopeList;\r
+\r
+Scope *NewScopeInPool(MemoryPool *);\r
+#define NewScope() NewScopeInPool(CurrentScope->pool)\r
+void PushScope(Scope *fScope);\r
+Scope *PopScope(void);\r
+Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind);\r
+Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind);\r
+Symbol *LookUpLocalSymbol(Scope *fScope, int atom);\r
+Symbol *LookUpSymbol(Scope *fScope, int atom);\r
+void CPPErrorToInfoLog(char *);\r
+\r
+\r
#endif /* !defined(__SYMBOLS_H) */
-
+\r
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// tokens.c
-*/
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "slglobals.h"
-
-#include "slang_mesa.h"
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////// Preprocessor and Token Recorder and Playback: ////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
-
-/*
- * idstr()
- * Copy a string to a malloc'ed block and convert it into something suitable
- * for an ID
- *
- */
-
-static char *idstr(const char *fstr)
-{
- size_t len;
- char *str, *t;
- const char *f;
-
- len = strlen(fstr);
- str = (char *) malloc(len + 1);
- for (f=fstr, t=str; *f; f++) {
- if (_mesa_isalnum(*f)) *t++ = *f;
- else if (*f == '.' || *f == '/') *t++ = '_';
- }
- *t = 0;
- return str;
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* tokens.c */
+/* */
+\r
+#include <assert.h>\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <ctype.h>\r
+\r
+#include "slglobals.h"\r
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*////////////////////// Preprocessor and Token Recorder and Playback: //////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+\r
+/*\r
+ * idstr()\r
+ * Copy a string to a malloc'ed block and convert it into something suitable\r
+ * for an ID\r
+ *\r
+ */\r
+\r
+static char *idstr(const char *fstr)\r
+{\r
+ size_t len;\r
+ char *str, *t;\r
+ const char *f;\r
+\r
+ len = strlen(fstr);\r
+ str = (char *) malloc(len + 1);\r
+ for (f=fstr, t=str; *f; f++) {\r
+ if (isalnum(*f)) *t++ = *f;\r
+ else if (*f == '.' || *f == '/') *t++ = '_';\r
+ }\r
+ *t = 0;\r
+ return str;\r
} /* idstr */
-
-
-/*
- * lNewBlock()
- *
- */
-
-static TokenBlock *lNewBlock(TokenStream *fTok)
-{
- TokenBlock *lBlock;
-
- lBlock = (TokenBlock *) malloc(sizeof(TokenBlock) + 256);
- lBlock->count = 0;
- lBlock->current = 0;
- lBlock->data = (unsigned char *) lBlock + sizeof(TokenBlock);
- lBlock->max = 256;
- lBlock->next = NULL;
- if (fTok->head) {
- fTok->current->next = lBlock;
- } else {
- fTok->head = lBlock;
- }
- fTok->current = lBlock;
- return lBlock;
+\r
+\r
+/*\r
+ * lNewBlock()\r
+ *\r
+ */\r
+\r
+static TokenBlock *lNewBlock(TokenStream *fTok)\r
+{\r
+ TokenBlock *lBlock;\r
+\r
+ lBlock = (TokenBlock *) malloc(sizeof(TokenBlock) + 256);\r
+ lBlock->count = 0;\r
+ lBlock->current = 0;\r
+ lBlock->data = (unsigned char *) lBlock + sizeof(TokenBlock);\r
+ lBlock->max = 256;\r
+ lBlock->next = NULL;\r
+ if (fTok->head) {\r
+ fTok->current->next = lBlock;\r
+ } else {\r
+ fTok->head = lBlock;\r
+ }\r
+ fTok->current = lBlock;\r
+ return lBlock;\r
} /* lNewBlock */
-
-/*
- * lAddByte()
- *
- */
-
-static void lAddByte(TokenStream *fTok, unsigned char fVal)
-{
- TokenBlock *lBlock;
- lBlock = fTok->current;
- if (lBlock->count >= lBlock->max)
- lBlock = lNewBlock(fTok);
- lBlock->data[lBlock->count++] = fVal;
+\r
+/*\r
+ * lAddByte()\r
+ *\r
+ */\r
+\r
+static void lAddByte(TokenStream *fTok, unsigned char fVal)\r
+{\r
+ TokenBlock *lBlock;\r
+ lBlock = fTok->current;\r
+ if (lBlock->count >= lBlock->max)\r
+ lBlock = lNewBlock(fTok);\r
+ lBlock->data[lBlock->count++] = fVal;\r
} /* lAddByte */
-
-
-
-/*
- * lReadByte() - Get the next byte from a stream.
- *
- */
-
-static int lReadByte(TokenStream *pTok)
-{
- TokenBlock *lBlock;
- int lval = -1;
-
- lBlock = pTok->current;
- if (lBlock) {
- if (lBlock->current >= lBlock->count) {
- lBlock = lBlock->next;
- if (lBlock)
- lBlock->current = 0;
- pTok->current = lBlock;
- }
- if (lBlock)
- lval = lBlock->data[lBlock->current++];
- }
- return lval;
+\r
+\r
+\r
+/*\r
+ * lReadByte() - Get the next byte from a stream.\r
+ *\r
+ */\r
+\r
+static int lReadByte(TokenStream *pTok)\r
+{\r
+ TokenBlock *lBlock;\r
+ int lval = -1;\r
+\r
+ lBlock = pTok->current;\r
+ if (lBlock) {\r
+ if (lBlock->current >= lBlock->count) {\r
+ lBlock = lBlock->next;\r
+ if (lBlock)\r
+ lBlock->current = 0;\r
+ pTok->current = lBlock;\r
+ }\r
+ if (lBlock)\r
+ lval = lBlock->data[lBlock->current++];\r
+ }\r
+ return lval;\r
} /* lReadByte */
-
-/*///////////////////////////////////// Global Functions:////////////////////////////////////*/
-
-/*
- * NewTokenStream()
- *
- */
-
-TokenStream *NewTokenStream(const char *name)
-{
- TokenStream *pTok;
-
- pTok = (TokenStream *) malloc(sizeof(TokenStream));
- pTok->next = NULL;
- pTok->name = idstr(name);
- pTok->head = NULL;
- pTok->current = NULL;
- lNewBlock(pTok);
- return pTok;
+\r
+/*///////////////////////////////////// Global Functions:////////////////////////////////////// */
+\r
+/*\r
+ * NewTokenStream()\r
+ *\r
+ */\r
+\r
+TokenStream *NewTokenStream(const char *name)\r
+{\r
+ TokenStream *pTok;\r
+\r
+ pTok = (TokenStream *) malloc(sizeof(TokenStream));\r
+ pTok->next = NULL;\r
+ pTok->name = idstr(name);\r
+ pTok->head = NULL;\r
+ pTok->current = NULL;\r
+ lNewBlock(pTok);\r
+ return pTok;\r
} /* NewTokenStream */
-
-/*
- * DeleteTokenStream()
- *
- */
-
-void DeleteTokenStream(TokenStream *pTok)
-{
- TokenBlock *pBlock, *nBlock;
-
- if (pTok) {
- pBlock = pTok->head;
- while (pBlock) {
- nBlock = pBlock->next;
- free(pBlock);
- pBlock = nBlock;
- }
- if (pTok->name)
- free(pTok->name);
- free(pTok);
- }
+\r
+/*\r
+ * DeleteTokenStream()\r
+ *\r
+ */\r
+\r
+void DeleteTokenStream(TokenStream *pTok)\r
+{\r
+ TokenBlock *pBlock, *nBlock;\r
+\r
+ if (pTok) {\r
+ pBlock = pTok->head;\r
+ while (pBlock) {\r
+ nBlock = pBlock->next;\r
+ free(pBlock);\r
+ pBlock = nBlock;\r
+ }\r
+ if (pTok->name)\r
+ free(pTok->name);\r
+ free(pTok);\r
+ }\r
} /* DeleteTokenStream */
-
-/*
- * RecordToken() - Add a token to the end of a list for later playback or printout.
- *
- */
-
-void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp)
-{
- const char *s;
- unsigned char *str=NULL;
-
- if (token > 256)
- lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
- else
- lAddByte(pTok, (unsigned char)(token & 0x7f));
- switch (token) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- case CPP_STRCONSTANT:
- s = GetAtomString(atable, yylvalpp->sc_ident);
- while (*s)
- lAddByte(pTok, (unsigned char) *s++);
- lAddByte(pTok, 0);
- break;
- case CPP_FLOATCONSTANT:
- case CPP_INTCONSTANT:
- str=yylvalpp->symbol_name;
- while (*str){
- lAddByte(pTok,(unsigned char) *str);
- *str++;
- }
- lAddByte(pTok, 0);
- break;
- case '(':
- lAddByte(pTok, (unsigned char)(yylvalpp->sc_int ? 1 : 0));
- default:
- break;
- }
+\r
+/*\r
+ * RecordToken() - Add a token to the end of a list for later playback or printout.\r
+ *\r
+ */\r
+\r
+void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp)\r
+{\r
+ const char *s;\r
+ unsigned char *str=NULL;\r
+\r
+ if (token > 256)\r
+ lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));\r
+ else\r
+ lAddByte(pTok, (unsigned char)(token & 0x7f));\r
+ switch (token) {\r
+ case CPP_IDENTIFIER:\r
+ case CPP_TYPEIDENTIFIER:\r
+ case CPP_STRCONSTANT:\r
+ s = GetAtomString(atable, yylvalpp->sc_ident);\r
+ while (*s)\r
+ lAddByte(pTok, (unsigned char) *s++);\r
+ lAddByte(pTok, 0);\r
+ break;\r
+ case CPP_FLOATCONSTANT:\r
+ case CPP_INTCONSTANT:\r
+ str=yylvalpp->symbol_name;\r
+ while (*str){\r
+ lAddByte(pTok,(unsigned char) *str);\r
+ *str++;\r
+ }\r
+ lAddByte(pTok, 0);\r
+ break;\r
+ case '(':\r
+ lAddByte(pTok, (unsigned char)(yylvalpp->sc_int ? 1 : 0));\r
+ default:\r
+ break;\r
+ }\r
} /* RecordToken */
-
-/*
- * RewindTokenStream() - Reset a token stream in preperation for reading.
- *
- */
-
-void RewindTokenStream(TokenStream *pTok)
-{
- if (pTok->head) {
- pTok->current = pTok->head;
- pTok->current->current = 0;
- }
+\r
+/*\r
+ * RewindTokenStream() - Reset a token stream in preperation for reading.\r
+ *\r
+ */\r
+\r
+void RewindTokenStream(TokenStream *pTok)\r
+{\r
+ if (pTok->head) {\r
+ pTok->current = pTok->head;\r
+ pTok->current->current = 0;\r
+ }\r
} /* RewindTokenStream */
-
-/*
- * ReadToken() - Read the next token from a stream.
- *
- */
-
-int ReadToken(TokenStream *pTok, yystypepp * yylvalpp)
-{
- char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
- char string_val[MAX_STRING_LEN + 1];
- int ltoken, len;
- char ch;
-
- ltoken = lReadByte(pTok);
- if (ltoken >= 0) {
- if (ltoken > 127)
- ltoken += 128;
- switch (ltoken) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- len = 0;
- ch = lReadByte(pTok);
- while ((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '_')
- {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len] = ch;
- len++;
- ch = lReadByte(pTok);
- }
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
- return CPP_IDENTIFIER;
- break;
- case CPP_STRCONSTANT:
- len = 0;
- while ((ch = lReadByte(pTok)) != 0)
- if (len < MAX_STRING_LEN)
- string_val[len++] = ch;
- string_val[len] = 0;
- yylvalpp->sc_ident = LookUpAddString(atable, string_val);
- break;
- case CPP_FLOATCONSTANT:
- len = 0;
- ch = lReadByte(pTok);
- while ((ch >= '0' && ch <= '9')||(ch=='e'||ch=='E'||ch=='.')||(ch=='+'||ch=='-'))
- {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len] = ch;
- len++;
- ch = lReadByte(pTok);
- }
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- strcpy(yylvalpp->symbol_name,symbol_name);
- yylvalpp->sc_fval=(float)atof(yylvalpp->symbol_name);
- break;
- case CPP_INTCONSTANT:
- len = 0;
- ch = lReadByte(pTok);
- while ((ch >= '0' && ch <= '9'))
- {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len] = ch;
- len++;
- ch = lReadByte(pTok);
- }
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- strcpy(yylvalpp->symbol_name,symbol_name);
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- break;
- case '(':
- yylvalpp->sc_int = lReadByte(pTok);
- break;
- }
- return ltoken;
- }
- return EOF_SY;
+\r
+/*\r
+ * ReadToken() - Read the next token from a stream.\r
+ *\r
+ */\r
+\r
+int ReadToken(TokenStream *pTok, yystypepp * yylvalpp)\r
+{\r
+ char symbol_name[MAX_SYMBOL_NAME_LEN + 1];\r
+ char string_val[MAX_STRING_LEN + 1];\r
+ int ltoken, len;\r
+ char ch;\r
+\r
+ ltoken = lReadByte(pTok);\r
+ if (ltoken >= 0) {\r
+ if (ltoken > 127)\r
+ ltoken += 128;\r
+ switch (ltoken) {\r
+ case CPP_IDENTIFIER:\r
+ case CPP_TYPEIDENTIFIER:\r
+ len = 0;\r
+ ch = lReadByte(pTok);\r
+ while ((ch >= 'a' && ch <= 'z') ||\r
+ (ch >= 'A' && ch <= 'Z') ||\r
+ (ch >= '0' && ch <= '9') ||\r
+ ch == '_')\r
+ {\r
+ if (len < MAX_SYMBOL_NAME_LEN) {\r
+ symbol_name[len] = ch;\r
+ len++;\r
+ ch = lReadByte(pTok);\r
+ }\r
+ }\r
+ symbol_name[len] = '\0';\r
+ assert(ch == '\0');\r
+ yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);\r
+ return CPP_IDENTIFIER;\r
+ break;\r
+ case CPP_STRCONSTANT:\r
+ len = 0;\r
+ while ((ch = lReadByte(pTok)) != 0)\r
+ if (len < MAX_STRING_LEN)\r
+ string_val[len++] = ch;\r
+ string_val[len] = 0;\r
+ yylvalpp->sc_ident = LookUpAddString(atable, string_val);\r
+ break;\r
+ case CPP_FLOATCONSTANT:\r
+ len = 0;\r
+ ch = lReadByte(pTok);\r
+ while ((ch >= '0' && ch <= '9')||(ch=='e'||ch=='E'||ch=='.')||(ch=='+'||ch=='-'))\r
+ {\r
+ if (len < MAX_SYMBOL_NAME_LEN) {\r
+ symbol_name[len] = ch;\r
+ len++;\r
+ ch = lReadByte(pTok);\r
+ }\r
+ }\r
+ symbol_name[len] = '\0';\r
+ assert(ch == '\0');\r
+ strcpy(yylvalpp->symbol_name,symbol_name);\r
+ yylvalpp->sc_fval=(float)atof(yylvalpp->symbol_name);\r
+ break;\r
+ case CPP_INTCONSTANT:\r
+ len = 0;\r
+ ch = lReadByte(pTok);\r
+ while ((ch >= '0' && ch <= '9'))\r
+ {\r
+ if (len < MAX_SYMBOL_NAME_LEN) {\r
+ symbol_name[len] = ch;\r
+ len++;\r
+ ch = lReadByte(pTok);\r
+ }\r
+ }\r
+ symbol_name[len] = '\0';\r
+ assert(ch == '\0');\r
+ strcpy(yylvalpp->symbol_name,symbol_name);\r
+ yylvalpp->sc_int=atoi(yylvalpp->symbol_name);\r
+ break;\r
+ case '(':\r
+ yylvalpp->sc_int = lReadByte(pTok);\r
+ break;\r
+ }\r
+ return ltoken;\r
+ }\r
+ return EOF_SY;\r
} /* ReadToken */
-
-typedef struct TokenInputSrc {
- InputSrc base;
- TokenStream *tokens;
- int (*final)(CPPStruct *);
-} TokenInputSrc;
-
-static int scan_token(TokenInputSrc *in, yystypepp * yylvalpp)
-{
- int token = ReadToken(in->tokens, yylvalpp);
- int (*final)(CPPStruct *);
- cpp->tokenLoc->file = cpp->currentInput->name;
- cpp->tokenLoc->line = cpp->currentInput->line;
- if (token == '\n') {
- in->base.line++;
- return token;
- }
- if (token > 0) return token;
- cpp->currentInput = in->base.prev;
- final = in->final;
- free(in);
- if (final && !final(cpp)) return -1;
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-}
-
-int ReadFromTokenStream(TokenStream *ts, int name, int (*final)(CPPStruct *))
-{
- TokenInputSrc *in = malloc(sizeof(TokenInputSrc));
- memset(in, 0, sizeof(TokenInputSrc));
- in->base.name = name;
- in->base.prev = cpp->currentInput;
- in->base.scan = (int (*)(InputSrc *, yystypepp *))scan_token;
- in->base.line = 1;
- in->tokens = ts;
- in->final = final;
- RewindTokenStream(ts);
- cpp->currentInput = &in->base;
- return 1;
-}
-
-typedef struct UngotToken {
- InputSrc base;
- int token;
- yystypepp lval;
-} UngotToken;
-
-static int reget_token(UngotToken *t, yystypepp * yylvalpp)
-{
- int token = t->token;
- *yylvalpp = t->lval;
- cpp->currentInput = t->base.prev;
- free(t);
- return token;
-}
-
-void UngetToken(int token, yystypepp * yylvalpp) {
- UngotToken *t = malloc(sizeof(UngotToken));
- memset(t, 0, sizeof(UngotToken));
- t->token = token;
- t->lval = *yylvalpp;
- t->base.scan = (void *)reget_token;
- t->base.prev = cpp->currentInput;
- t->base.name = cpp->currentInput->name;
- t->base.line = cpp->currentInput->line;
- cpp->currentInput = &t->base;
-}
-
-
-void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {
- int token;
- char str[100];
-
- if (fp == 0) fp = stdout;
- RewindTokenStream(s);
- while ((token = ReadToken(s, yylvalpp)) > 0) {
- switch (token) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- sprintf(str, "%s ", GetAtomString(atable, yylvalpp->sc_ident));
- break;
- case CPP_STRCONSTANT:
- sprintf(str, "\"%s\"", GetAtomString(atable, yylvalpp->sc_ident));
- break;
- case CPP_FLOATCONSTANT:
- /*printf("%g9.6 ", yylvalpp->sc_fval);*/
- break;
- case CPP_INTCONSTANT:
- /*printf("%d ", yylvalpp->sc_int);*/
- break;
- default:
- if (token >= 127)
- sprintf(str, "%s ", GetAtomString(atable, token));
- else
- sprintf(str, "%c", token);
- break;
- }
- CPPDebugLogMsg(str);
- }
-}
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////// End of tokens.c ///////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////*/
+\r
+typedef struct TokenInputSrc {\r
+ InputSrc base;\r
+ TokenStream *tokens;\r
+ int (*final)(CPPStruct *);\r
+} TokenInputSrc;\r
+\r
+static int scan_token(TokenInputSrc *in, yystypepp * yylvalpp)\r
+{\r
+ int token = ReadToken(in->tokens, yylvalpp);\r
+ int (*final)(CPPStruct *);\r
+ cpp->tokenLoc->file = cpp->currentInput->name;\r
+ cpp->tokenLoc->line = cpp->currentInput->line;\r
+ if (token == '\n') {\r
+ in->base.line++;\r
+ return token;\r
+ }\r
+ if (token > 0) return token;\r
+ cpp->currentInput = in->base.prev;\r
+ final = in->final;\r
+ free(in);\r
+ if (final && !final(cpp)) return -1;\r
+ return cpp->currentInput->scan(cpp->currentInput, yylvalpp);\r
+}\r
+\r
+int ReadFromTokenStream(TokenStream *ts, int name, int (*final)(CPPStruct *))\r
+{\r
+ TokenInputSrc *in = malloc(sizeof(TokenInputSrc));\r
+ memset(in, 0, sizeof(TokenInputSrc));\r
+ in->base.name = name;\r
+ in->base.prev = cpp->currentInput;\r
+ in->base.scan = (int (*)(InputSrc *, yystypepp *))scan_token;\r
+ in->base.line = 1;\r
+ in->tokens = ts;\r
+ in->final = final;\r
+ RewindTokenStream(ts);\r
+ cpp->currentInput = &in->base;\r
+ return 1;\r
+}\r
+\r
+typedef struct UngotToken {\r
+ InputSrc base;\r
+ int token;\r
+ yystypepp lval;\r
+} UngotToken;\r
+\r
+static int reget_token(UngotToken *t, yystypepp * yylvalpp)\r
+{\r
+ int token = t->token;\r
+ *yylvalpp = t->lval;\r
+ cpp->currentInput = t->base.prev;\r
+ free(t);\r
+ return token;\r
+}\r
+\r
+void UngetToken(int token, yystypepp * yylvalpp) {\r
+ UngotToken *t = malloc(sizeof(UngotToken));\r
+ memset(t, 0, sizeof(UngotToken));\r
+ t->token = token;\r
+ t->lval = *yylvalpp;\r
+ t->base.scan = (void *)reget_token;\r
+ t->base.prev = cpp->currentInput;\r
+ t->base.name = cpp->currentInput->name;\r
+ t->base.line = cpp->currentInput->line;\r
+ cpp->currentInput = &t->base;\r
+}\r
+\r
+\r
+void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {\r
+ int token;\r
+ char str[100];\r
+\r
+ if (fp == 0) fp = stdout;\r
+ RewindTokenStream(s);\r
+ while ((token = ReadToken(s, yylvalpp)) > 0) {\r
+ switch (token) {\r
+ case CPP_IDENTIFIER:\r
+ case CPP_TYPEIDENTIFIER:\r
+ sprintf(str, "%s ", GetAtomString(atable, yylvalpp->sc_ident));\r
+ break;\r
+ case CPP_STRCONSTANT:\r
+ sprintf(str, "\"%s\"", GetAtomString(atable, yylvalpp->sc_ident));\r
+ break;\r
+ case CPP_FLOATCONSTANT:\r
+ /*printf("%g9.6 ", yylvalpp->sc_fval); */
+ break;\r
+ case CPP_INTCONSTANT:\r
+ /*printf("%d ", yylvalpp->sc_int); */
+ break;\r
+ default:\r
+ if (token >= 127)\r
+ sprintf(str, "%s ", GetAtomString(atable, token));\r
+ else\r
+ sprintf(str, "%c", token);\r
+ break;\r
+ }\r
+ CPPDebugLogMsg(str);\r
+ }\r
+}\r
+\r
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
+/*///////////////////////////////////// End of tokens.c /////////////////////////////////////// */
+/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/*
-// tokens.h
-*/
-
-#if !defined(__TOKENS_H)
-#define __TOKENS_H 1
-
-#include "parser.h"
-
-#define EOF_SY (-1)
-
-typedef struct TokenBlock_Rec TokenBlock;
-
-typedef struct TokenStream_Rec {
- struct TokenStream_Rec *next;
- char *name;
- TokenBlock *head;
- TokenBlock *current;
-} TokenStream;
-
-struct TokenBlock_Rec {
- TokenBlock *next;
- int current;
- int count;
- int max;
- unsigned char *data;
-};
-
-extern TokenStream stdlib_cpp_stream;
-
-
-TokenStream *NewTokenStream(const char *name);
-void DeleteTokenStream(TokenStream *pTok);
-void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp);
-void RewindTokenStream(TokenStream *pTok);
-int ReadToken(TokenStream *pTok, yystypepp * yylvalpp);
-int ReadFromTokenStream(TokenStream *pTok, int name, int (*final)(CPPStruct *));
-void UngetToken(int, yystypepp * yylvalpp);
-
-#if defined(CPPC_ENABLE_TOOLS)
-
-void DumpTokenStream(FILE *, TokenStream *, yystypepp * yylvalpp);
-
+/* */
+/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
+/*All rights reserved. */
+/* */
+/*Redistribution and use in source and binary forms, with or without */
+/*modification, are permitted provided that the following conditions */
+/*are met: */
+/* */
+/* Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials provided */
+/* with the distribution. */
+/* */
+/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
+/* contributors may be used to endorse or promote products derived */
+/* from this software without specific prior written permission. */
+/* */
+/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
+/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
+/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
+/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
+/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
+/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
+/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
+/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
+/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/*POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/****************************************************************************\\r
+Copyright (c) 2002, NVIDIA Corporation.\r
+\r
+NVIDIA Corporation("NVIDIA") supplies this software to you in\r
+consideration of your agreement to the following terms, and your use,\r
+installation, modification or redistribution of this NVIDIA software\r
+constitutes acceptance of these terms. If you do not agree with these\r
+terms, please do not use, install, modify or redistribute this NVIDIA\r
+software.\r
+\r
+In consideration of your agreement to abide by the following terms, and\r
+subject to these terms, NVIDIA grants you a personal, non-exclusive\r
+license, under NVIDIA's copyrights in this original NVIDIA software (the\r
+"NVIDIA Software"), to use, reproduce, modify and redistribute the\r
+NVIDIA Software, with or without modifications, in source and/or binary\r
+forms; provided that if you redistribute the NVIDIA Software, you must\r
+retain the copyright notice of NVIDIA, this notice and the following\r
+text and disclaimers in all such redistributions of the NVIDIA Software.\r
+Neither the name, trademarks, service marks nor logos of NVIDIA\r
+Corporation may be used to endorse or promote products derived from the\r
+NVIDIA Software without specific prior written permission from NVIDIA.\r
+Except as expressly stated in this notice, no other rights or licenses\r
+express or implied, are granted by NVIDIA herein, including but not\r
+limited to any patent rights that may be infringed by your derivative\r
+works or by other works in which the NVIDIA Software may be\r
+incorporated. No hardware is licensed hereunder. \r
+\r
+THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT\r
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,\r
+INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,\r
+NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\r
+ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER\r
+PRODUCTS.\r
+\r
+IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,\r
+INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\r
+TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\r
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY\r
+OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE\r
+NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,\r
+TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF\r
+NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\****************************************************************************/\r
+/* */
+/* tokens.h */
+/* */
+\r
+#if !defined(__TOKENS_H)\r
+#define __TOKENS_H 1\r
+\r
+#include "parser.h"\r
+\r
+#define EOF_SY (-1)\r
+\r
+typedef struct TokenBlock_Rec TokenBlock;\r
+\r
+typedef struct TokenStream_Rec {\r
+ struct TokenStream_Rec *next;\r
+ char *name;\r
+ TokenBlock *head;\r
+ TokenBlock *current;\r
+} TokenStream;\r
+\r
+struct TokenBlock_Rec {\r
+ TokenBlock *next;\r
+ int current;\r
+ int count;\r
+ int max;\r
+ unsigned char *data;\r
+};\r
+\r
+extern TokenStream stdlib_cpp_stream;\r
+\r
+\r
+TokenStream *NewTokenStream(const char *name);\r
+void DeleteTokenStream(TokenStream *pTok); \r
+void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp);\r
+void RewindTokenStream(TokenStream *pTok);\r
+int ReadToken(TokenStream *pTok, yystypepp * yylvalpp);\r
+int ReadFromTokenStream(TokenStream *pTok, int name, int (*final)(CPPStruct *));\r
+void UngetToken(int, yystypepp * yylvalpp);\r
+\r
+#if defined(CPPC_ENABLE_TOOLS)\r
+\r
+void DumpTokenStream(FILE *, TokenStream *, yystypepp * yylvalpp);\r
+\r
#endif /* defined(CPPC_ENABLE_TOOLS) */
-
+\r
#endif /* !defined(__TOKENS_H) */
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
-//
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef __OSINCLUDE_H
-#define __OSINCLUDE_H
-
-//
-// This file contains any Linux specific functions.
-//
-
-#include <pthread.h>
-#include <semaphore.h>
-#include <assert.h>
-#include <errno.h>
-#include "Include/InitializeGlobals.h"
-#include "Include/PoolAlloc.h"
-
-#define _vsnprintf vsnprintf
-
-void DetachThreadLinux(void *);
-
-//
-// Thread Local Storage Operations
-//
-typedef unsigned int OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
-
-OS_TLSIndex OS_AllocTLSIndex();
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
-
-
-inline void * OS_GetTLSValue(OS_TLSIndex nIndex)
-{
- //
- // This function should return 0 if nIndex is invalid.
- //
- assert(nIndex != OS_INVALID_TLS_INDEX);
- return (pthread_getspecific(nIndex));
-}
-
-#endif // __OSINCLUDE_H
+//\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+// Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//\r
+// Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following\r
+// disclaimer in the documentation and/or other materials provided\r
+// with the distribution.\r
+//\r
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its\r
+// contributors may be used to endorse or promote products derived\r
+// from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+\r
+#ifndef __OSINCLUDE_H\r
+#define __OSINCLUDE_H\r
+\r
+//\r
+// This file contains any Linux specific functions.\r
+//\r
+\r
+/* WORKAROUND: linux builds seem not to define "linux" */\r
+/*#if !(defined(linux))\r
+#error Trying to include a Linux specific file in a non-Linux build.\r
+#endif*/\r
+\r
+#include <pthread.h>\r
+#include <semaphore.h>\r
+#include <assert.h>\r
+#include <errno.h>\r
+#include "Include/InitializeGlobals.h"\r
+#include "Include/PoolAlloc.h"\r
+\r
+#define _vsnprintf vsnprintf\r
+\r
+void DetachThreadLinux(void *);\r
+\r
+//\r
+// Thread Local Storage Operations\r
+//\r
+typedef unsigned int OS_TLSIndex;\r
+#define OS_INVALID_TLS_INDEX 0xFFFFFFFF\r
+\r
+OS_TLSIndex OS_AllocTLSIndex();\r
+bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);\r
+bool OS_FreeTLSIndex(OS_TLSIndex nIndex); \r
+\r
+\r
+inline void * OS_GetTLSValue(OS_TLSIndex nIndex)\r
+{\r
+ //\r
+ // This function should return 0 if nIndex is invalid.\r
+ //\r
+ assert(nIndex != OS_INVALID_TLS_INDEX);\r
+ return (pthread_getspecific(nIndex)); \r
+}\r
+\r
+#endif // __OSINCLUDE_H\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
#include "osinclude.h"\r
#include "Initialisation.h"\r
\r
-#if !(defined(linux))\r
+/*#if !(defined(linux))\r
#error Trying to build a Linux specific file in a non-Linux build.\r
-#endif\r
+#endif*/\r
\r
//\r
// Thread cleanup\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
#error Trying to include a windows specific file in a non windows build.\r
#endif\r
\r
-#define STRICT 1\r
+#define STRICT\r
#define VC_EXTRALEAN 1\r
#include <windows.h>\r
#include <assert.h>\r
//\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
#error Trying to build a windows specific file in a non windows build.\r
#endif\r
\r
-//\r
-// disable DllMain on Mesa-3D builds, call appropriate Init* and Detach*\r
-// routines manually in context initialization\r
-//\r
-/*BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)\r
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)\r
{\r
switch (fdwReason)\r
{\r
}\r
\r
return true;\r
-}*/\r
+}\r
\r
//\r
// Thread Local Storage Operations\r
-/*\r
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.\r
+//\r
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.\r
//All rights reserved.\r
//\r
//Redistribution and use in source and binary forms, with or without\r
//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
//POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
+//\r
#ifndef _COMPILER_INTERFACE_INCLUDED_\r
#define _COMPILER_INTERFACE_INCLUDED_\r
\r
+#include "../Include/ResourceLimits.h"\r
\r
#ifdef _WIN32\r
#define C_DECL __cdecl\r
-#define SH_IMPORT_EXPORT\r
+#ifdef SH_EXPORTING\r
+ #define SH_IMPORT_EXPORT __declspec(dllexport)\r
+#else\r
+ #define SH_IMPORT_EXPORT __declspec(dllimport)\r
+#endif\r
#else\r
#define SH_IMPORT_EXPORT\r
#define __fastcall\r
#define C_DECL\r
#endif\r
\r
-/*\r
+//\r
// This is the platform independent interface between an OGL driver\r
// and the shading language compiler/linker.\r
-*/\r
+//\r
\r
#ifdef __cplusplus\r
extern "C" {\r
#endif\r
\r
-/*\r
+//\r
// Driver must call this first, once, before doing any other\r
// compiler/linker operations.\r
-*/\r
+//\r
SH_IMPORT_EXPORT int ShInitialize();\r
-/*\r
+//\r
// Driver should call this at shutdown.\r
-*/\r
+//\r
SH_IMPORT_EXPORT int __fastcall ShFinalize();\r
-/*\r
-// to be used for hardwareDataType and userDataType by ICD\r
-*/\r
-typedef enum {\r
- EFloat,\r
- EInt,\r
- EBool,\r
- EFloat_Vec2,\r
- EFloat_Vec3,\r
- EFloat_Vec4,\r
- EInt_Vec2,\r
- EInt_Vec3,\r
- EInt_Vec4,\r
- EBool_Vec2,\r
- EBool_Vec3,\r
- EBool_Vec4,\r
- EFloat_Mat2,\r
- EFloat_Mat3,\r
- EFloat_Mat4,\r
- ESampler_1D,\r
- ESampler_2D,\r
- ESampler_3D,\r
- ESampler_Cube,\r
- ESampler_1D_Shadow,\r
- ESampler_2D_Shadow,\r
- EStruct\r
-} ShBasicType;\r
-\r
-/*\r
+\r
+//\r
// Types of languages the compiler can consume.\r
-*/\r
+//\r
typedef enum {\r
EShLangVertex,\r
EShLangFragment,\r
EShLangCount\r
} EShLanguage;\r
\r
-/*\r
+//\r
// Types of output the linker will create.\r
-*/\r
+//\r
typedef enum {\r
EShExVertexFragment,\r
EShExPackFragment,\r
EShExFragment\r
} EShExecutable;\r
\r
-/*\r
+//\r
// Optimization level for the compiler.\r
-*/\r
+//\r
typedef enum {\r
EShOptNoGeneration,\r
EShOptNone,\r
- EShOptSimple, /* Optimizations that can be done quickly */\r
- EShOptFull /* Optimizations that will take more time */\r
+ EShOptSimple, // Optimizations that can be done quickly\r
+ EShOptFull // Optimizations that will take more time\r
} EShOptimizationLevel;\r
\r
-/*\r
+//\r
// Build a table for bindings. This can be used for locating\r
// attributes, uniforms, globals, etc., as needed.\r
-*/\r
+//\r
typedef struct {\r
char* name;\r
int binding;\r
\r
typedef struct {\r
int numBindings;\r
- ShBinding* bindings; /* array of bindings */\r
+ ShBinding* bindings; // array of bindings\r
} ShBindingTable;\r
\r
-/*\r
+//\r
// ShHandle held by but opaque to the driver. It is allocated,\r
// managed, and de-allocated by the compiler/linker. It's contents \r
// are defined by and used by the compiler and linker. For example,\r
// to the linker can be stored where ShHandle points.\r
//\r
// If handle creation fails, 0 will be returned.\r
-*/\r
+//\r
typedef void* ShHandle;\r
\r
-/*\r
+//\r
// Driver calls these to create and destroy compiler/linker\r
// objects.\r
-*/\r
-SH_IMPORT_EXPORT ShHandle ShConstructCompiler(const EShLanguage, int debugOptions); /* one per shader */\r
-SH_IMPORT_EXPORT ShHandle ShConstructLinker(const EShExecutable, int debugOptions); /* one per shader pair */\r
-SH_IMPORT_EXPORT ShHandle ShConstructUniformMap(); /* one per uniform namespace (currently entire program object) */\r
+//\r
+SH_IMPORT_EXPORT ShHandle ShConstructCompiler(const EShLanguage, int debugOptions); // one per shader\r
+SH_IMPORT_EXPORT ShHandle ShConstructLinker(const EShExecutable, int debugOptions); // one per shader pair\r
+SH_IMPORT_EXPORT ShHandle ShConstructUniformMap(); // one per uniform namespace (currently entire program object)\r
SH_IMPORT_EXPORT void ShDestruct(ShHandle);\r
\r
-/*\r
+//\r
// The return value of ShCompile is boolean, indicating\r
// success or failure.\r
//\r
// The info-log should be written by ShCompile into \r
// ShHandle, so it can answer future queries.\r
-*/\r
+//\r
SH_IMPORT_EXPORT int ShCompile(\r
const ShHandle,\r
const char* const shaderStrings[],\r
const int numStrings,\r
const EShOptimizationLevel,\r
+ const TBuiltInResource *resources,\r
int debugOptions\r
);\r
\r
\r
-/*\r
+//\r
// Similar to ShCompile, but accepts an opaque handle to an\r
// intermediate language structure.\r
-*/\r
+//\r
SH_IMPORT_EXPORT int ShCompileIntermediate(\r
ShHandle compiler,\r
ShHandle intermediate,\r
const EShOptimizationLevel,\r
- int debuggable /* boolean */\r
+ int debuggable // boolean\r
);\r
\r
SH_IMPORT_EXPORT int ShLink(\r
- const ShHandle, /* linker object */\r
- const ShHandle h[], /* compiler objects to link together */\r
+ const ShHandle, // linker object\r
+ const ShHandle h[], // compiler objects to link together\r
const int numHandles,\r
- ShHandle uniformMap, /* updated with new uniforms */\r
- short int** uniformsAccessed, /* returned with indexes of uniforms accessed */\r
+ ShHandle uniformMap, // updated with new uniforms\r
+ short int** uniformsAccessed, // returned with indexes of uniforms accessed\r
int* numUniformsAccessed); \r
\r
-/*\r
+//\r
// ShSetEncrpytionMethod is a place-holder for specifying\r
// how source code is encrypted.\r
-*/\r
+//\r
SH_IMPORT_EXPORT void ShSetEncryptionMethod(ShHandle);\r
\r
-/*\r
+//\r
// All the following return 0 if the information is not\r
// available in the object passed down, or the object is bad.\r
-*/\r
+//\r
SH_IMPORT_EXPORT const char* ShGetInfoLog(const ShHandle);\r
SH_IMPORT_EXPORT const void* ShGetExecutable(const ShHandle);\r
-SH_IMPORT_EXPORT int ShSetVirtualAttributeBindings(const ShHandle, const ShBindingTable*); /* to detect user aliasing */\r
-SH_IMPORT_EXPORT int ShSetFixedAttributeBindings(const ShHandle, const ShBindingTable*); /* to force any physical mappings */\r
-SH_IMPORT_EXPORT int ShGetPhysicalAttributeBindings(const ShHandle, const ShBindingTable**); /* for all attributes */\r
-/*\r
+SH_IMPORT_EXPORT int ShSetVirtualAttributeBindings(const ShHandle, const ShBindingTable*); // to detect user aliasing\r
+SH_IMPORT_EXPORT int ShSetFixedAttributeBindings(const ShHandle, const ShBindingTable*); // to force any physical mappings\r
+SH_IMPORT_EXPORT int ShGetPhysicalAttributeBindings(const ShHandle, const ShBindingTable**); // for all attributes\r
+//\r
// Tell the linker to never assign a vertex attribute to this list of physical attributes\r
-*/\r
+//\r
SH_IMPORT_EXPORT int ShExcludeAttributes(const ShHandle, int *attributes, int count);\r
\r
-/*\r
+//\r
// Returns the location ID of the named uniform.\r
// Returns -1 if error.\r
-*/\r
+//\r
SH_IMPORT_EXPORT int ShGetUniformLocation(const ShHandle uniformMap, const char* name);\r
-SH_IMPORT_EXPORT char* ShGetUniformName(const ShHandle linker, int virtualLocation);\r
\r
enum TDebugOptions {\r
EDebugOpNone = 0x000,\r
}\r
#endif\r
\r
-#endif /* _COMPILER_INTERFACE_INCLUDED_ */\r
+#endif // _COMPILER_INTERFACE_INCLUDED_\r
extern "C" {\r
#endif\r
\r
-typedef enum {\r
- EReserved = 0,\r
- EFixed,\r
- ERecommended,\r
- EFloating\r
-} ShPriority;\r
-\r
-typedef enum {\r
- ESymbol = 0,\r
- EFloatConst, \r
- EFloatConstPtr, \r
- EIntConst, \r
- EIntConstPtr, \r
- EBoolConst, \r
- EBoolConstPtr \r
-} ShDataType;\r
-\r
-// this definition will eventually go once we move to the new linker interface in the driver\r
-typedef enum {\r
- EVirtualBinding,\r
- EPhysicalBinding\r
-} ShVirtualPhysicalBinding;\r
-\r
-typedef struct {\r
- int size; // out - total physical size for the binding in floats - P10\r
- int location; // in-out - virtualLocation for all cases\r
- int functionPriority; // out - used for giving priorities to function bindings\r
- int proEpilogue; // out - essentially a bool defining whether its a prologue/epilogue or not, 1 means it is\r
- int builtInName; // out - basically a bool value, 0 means not a builtInName, 1 means its a builtInName\r
- int arraySize; // out - size of the array in units of its type - if the binding is for an array\r
- ShPriority bindingPriority; // in-out - EFixed, ERecommended, EFloating\r
- ShDataType bindingDataType; // in-out - whether its a symbol name or a constant value\r
- ShBasicType hardwareDataType; // out - bool are loaded as floats on the hardware\r
- ShBasicType userDataType; // out - mat3 -> mat3, ivec2 -> ivec2, vec2 -> vec2\r
- ShBasicType basicUserType; // out - mat3 -> float, ivec2 ->int, vec2 -> float\r
- int sizeOfType; // out - for vec3 -> 3, for float -> 1, for mat3 -> 3, mat3[10] -> 3\r
- int matrix; // out - essentially a boolean, 0 means vector, 1 means matrix\r
- union { // in-out\r
- char* name; \r
- float floatVal;\r
- float* floatValPtr;\r
- int intVal;\r
- int* intValPtr; \r
- };\r
- // A pointer to ShP10PhysicalBinding or ShP20PhysicalBinding\r
- void* targetDependentData; // in-out\r
-} ShBindingExt;\r
-\r
-//\r
-// to specify the type of binding\r
-//\r
-typedef enum { \r
- EAttribute, \r
- EUniform, \r
- EVarying, \r
- EFunction, \r
- EConstant, \r
- EFunctionRelocation, \r
- EArbVertexLocal,\r
- EArbVertexEnv,\r
- EArbFragmentLocal,\r
- EArbFragmentEnv,\r
- EState,\r
- ENoBindingType } ShBindingType;\r
-\r
-typedef struct {\r
- // a pointer to ShBindingExt\r
- ShBindingExt* pBinding;\r
- int numOfBindings;\r
- ShBindingType type;\r
-} ShBindingTableExt;\r
-\r
-typedef struct {\r
- ShBindingTableExt *bindingTable;\r
- int numOfBindingTables;\r
-} ShBindingList;\r
-\r
-SH_IMPORT_EXPORT ShHandle ShConstructBindings();\r
-SH_IMPORT_EXPORT ShHandle ShConstructLibrary();\r
-\r
-SH_IMPORT_EXPORT ShHandle ShAddBinding(ShHandle bindingHandle, \r
- ShBindingExt* binding, \r
- ShBindingType type);\r
-SH_IMPORT_EXPORT ShHandle ShAddBindingTable(ShHandle bindingHandle, \r
- ShBindingTableExt *bindingTable, \r
- ShBindingType type);\r
-\r
SH_IMPORT_EXPORT int ShLinkExt(\r
const ShHandle, // linker object\r
const ShHandle h[], // compiler objects to link together\r
const int numHandles);\r
\r
-SH_IMPORT_EXPORT ShBindingList* ShGetBindingList(const ShHandle linkerHandle); \r
-SH_IMPORT_EXPORT ShBindingTableExt* ShGetBindingTable(const ShHandle linkerHandle, ShBindingType type); \r
-SH_IMPORT_EXPORT int ShGetUniformLocationExt(const ShHandle linkerHandle, const char* name);\r
-SH_IMPORT_EXPORT int ShSetFixedAttributeBindingsExt(const ShHandle, const ShBindingTableExt*);\r
-SH_IMPORT_EXPORT int ShGetUniformLocationExt2(const ShHandle handle, const char* name, int* location, int* offset);\r
-SH_IMPORT_EXPORT int ShSetVirtualLocation(const ShHandle handle, ShBindingType type, int bindingIndex, int virtualLocation);\r
-SH_IMPORT_EXPORT int ShGetVirtualLocation(const ShHandle handle, ShBindingType type, int bindingIndex, int *virtualLocation);\r
-// \r
-// To get the bindings object from the linker object (after the link is done so that \r
-// bindings can be added to the list)\r
-//\r
-SH_IMPORT_EXPORT ShHandle ShGetBindings(const ShHandle linkerHandle);\r
-SH_IMPORT_EXPORT int ShAddLibraryCode(ShHandle library, const char* name, const ShHandle objectCodes[], const int numHandles);\r
-\r
-/*****************************************************************************\r
- This code is used by the new shared linker\r
- *****************************************************************************/\r
-//\r
-// Each programmable unit has a UnitExecutable. Targets may subclass\r
-// and append to this as desired.\r
-//\r
-typedef struct {\r
- int name; // name of unit to which executable is targeted\r
- int entry; // a target specific entry point\r
- int count; // size of executable\r
- const void* code; // read-only code\r
-} ShUnitExecutable;\r
-\r
-//\r
-// The "void*" returned from ShGetExecutable() will be an ShExecutable\r
-//\r
-typedef struct {\r
- int count; // count of unit executables\r
- ShUnitExecutable* executables;\r
-} ShExecutable;\r
-\r
-SH_IMPORT_EXPORT ShExecutable* ShGetExecutableExt(const ShHandle linkerHandle);\r
-\r
-typedef struct {\r
- int numThread;\r
- int stackSpacePerThread;\r
- int visBufferValidity; // essenatially a boolean\r
- int shaderFragTerminationStatus; // essentially a boolean\r
-} ShDeviceInfo;\r
-\r
#ifdef __cplusplus\r
}\r
#endif\r