diff options
author | Julien Cristau <[email protected]> | 2007-02-01 11:50:36 +0100 |
---|---|---|
committer | Julien Cristau <[email protected]> | 2007-02-01 11:50:36 +0100 |
commit | 2634f06c2095b79d4252bb81c0b0272139dad890 (patch) | |
tree | 855ba634812939982daa999dc44365a4d889d11e /src/mesa/shader/slang/MachineIndependent/ParseHelper.h | |
parent | 7549426a168f3803d6023622dd9e630a5fa2faf6 (diff) | |
parent | eb667b979bc941f05b8f40a2fc39af6fac960ac5 (diff) |
Merge branch 'upstream-experimental' into debian-experimental
Conflicts:
progs/util/README
progs/util/glstate.c
progs/util/glstate.h
progs/util/sampleMakefile
src/glu/sgi/libnurbs/interface/bezierEval.h
src/glu/sgi/libnurbs/interface/bezierPatch.cc
src/glu/sgi/libnurbs/interface/bezierPatch.h
src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc
src/glu/sgi/libnurbs/interface/bezierPatchMesh.h
src/glu/sgi/libnurbs/interface/glcurveval.cc
src/glu/sgi/libnurbs/interface/glimports.h
src/glu/sgi/libnurbs/interface/glinterface.cc
src/glu/sgi/libnurbs/interface/glrenderer.h
src/glu/sgi/libnurbs/interface/incurveeval.cc
src/glu/sgi/libnurbs/interface/insurfeval.cc
src/glu/sgi/libnurbs/interface/mystdio.h
src/glu/sgi/libnurbs/interface/mystdlib.h
src/glu/sgi/libnurbs/internals/arc.h
src/glu/sgi/libnurbs/internals/arcsorter.cc
src/glu/sgi/libnurbs/internals/arcsorter.h
src/glu/sgi/libnurbs/internals/arctess.h
src/glu/sgi/libnurbs/internals/backend.cc
src/glu/sgi/libnurbs/internals/backend.h
src/glu/sgi/libnurbs/internals/basiccrveval.h
src/glu/sgi/libnurbs/internals/basicsurfeval.h
src/glu/sgi/libnurbs/internals/bezierarc.h
src/glu/sgi/libnurbs/internals/bin.cc
src/glu/sgi/libnurbs/internals/bin.h
src/glu/sgi/libnurbs/internals/bufpool.cc
src/glu/sgi/libnurbs/internals/bufpool.h
src/glu/sgi/libnurbs/internals/cachingeval.cc
src/glu/sgi/libnurbs/internals/cachingeval.h
src/glu/sgi/libnurbs/internals/ccw.cc
src/glu/sgi/libnurbs/internals/coveandtiler.h
src/glu/sgi/libnurbs/internals/curve.cc
src/glu/sgi/libnurbs/internals/curve.h
src/glu/sgi/libnurbs/internals/curvelist.cc
src/glu/sgi/libnurbs/internals/curvelist.h
src/glu/sgi/libnurbs/internals/curvesub.cc
src/glu/sgi/libnurbs/internals/dataTransform.cc
src/glu/sgi/libnurbs/internals/dataTransform.h
src/glu/sgi/libnurbs/internals/defines.h
src/glu/sgi/libnurbs/internals/displaylist.cc
src/glu/sgi/libnurbs/internals/displaylist.h
src/glu/sgi/libnurbs/internals/displaymode.h
src/glu/sgi/libnurbs/internals/flist.cc
src/glu/sgi/libnurbs/internals/flist.h
src/glu/sgi/libnurbs/internals/flistsorter.cc
src/glu/sgi/libnurbs/internals/flistsorter.h
src/glu/sgi/libnurbs/internals/gridline.h
src/glu/sgi/libnurbs/internals/gridtrimvertex.h
src/glu/sgi/libnurbs/internals/gridvertex.h
src/glu/sgi/libnurbs/internals/hull.cc
src/glu/sgi/libnurbs/internals/hull.h
src/glu/sgi/libnurbs/internals/intersect.cc
src/glu/sgi/libnurbs/internals/jarcloc.h
src/glu/sgi/libnurbs/internals/knotvector.h
src/glu/sgi/libnurbs/internals/mapdesc.cc
src/glu/sgi/libnurbs/internals/mapdesc.h
src/glu/sgi/libnurbs/internals/mapdescv.cc
src/glu/sgi/libnurbs/internals/maplist.cc
src/glu/sgi/libnurbs/internals/maplist.h
src/glu/sgi/libnurbs/internals/mesher.cc
src/glu/sgi/libnurbs/internals/mesher.h
src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc
src/glu/sgi/libnurbs/internals/monotonizer.cc
src/glu/sgi/libnurbs/internals/monotonizer.h
src/glu/sgi/libnurbs/internals/myassert.h
src/glu/sgi/libnurbs/internals/mycode.cc
src/glu/sgi/libnurbs/internals/mystring.h
src/glu/sgi/libnurbs/internals/nurbsconsts.h
src/glu/sgi/libnurbs/internals/nurbstess.cc
src/glu/sgi/libnurbs/internals/patch.cc
src/glu/sgi/libnurbs/internals/patch.h
src/glu/sgi/libnurbs/internals/patchlist.cc
src/glu/sgi/libnurbs/internals/patchlist.h
src/glu/sgi/libnurbs/internals/pwlarc.h
src/glu/sgi/libnurbs/internals/quilt.cc
src/glu/sgi/libnurbs/internals/quilt.h
src/glu/sgi/libnurbs/internals/reader.cc
src/glu/sgi/libnurbs/internals/reader.h
src/glu/sgi/libnurbs/internals/renderhints.cc
src/glu/sgi/libnurbs/internals/renderhints.h
src/glu/sgi/libnurbs/internals/simplemath.h
src/glu/sgi/libnurbs/internals/slicer.cc
src/glu/sgi/libnurbs/internals/slicer.h
src/glu/sgi/libnurbs/internals/sorter.cc
src/glu/sgi/libnurbs/internals/sorter.h
src/glu/sgi/libnurbs/internals/splitarcs.cc
src/glu/sgi/libnurbs/internals/subdivider.h
src/glu/sgi/libnurbs/internals/tobezier.cc
src/glu/sgi/libnurbs/internals/trimline.cc
src/glu/sgi/libnurbs/internals/trimline.h
src/glu/sgi/libnurbs/internals/trimregion.cc
src/glu/sgi/libnurbs/internals/trimregion.h
src/glu/sgi/libnurbs/internals/trimvertex.h
src/glu/sgi/libnurbs/internals/trimvertpool.cc
src/glu/sgi/libnurbs/internals/trimvertpool.h
src/glu/sgi/libnurbs/internals/types.h
src/glu/sgi/libnurbs/internals/uarray.cc
src/glu/sgi/libnurbs/internals/uarray.h
src/glu/sgi/libnurbs/internals/varray.cc
src/glu/sgi/libnurbs/internals/varray.h
src/glu/sgi/libnurbs/nurbtess/definitions.h
src/glu/sgi/libnurbs/nurbtess/directedLine.h
src/glu/sgi/libnurbs/nurbtess/glimports.h
src/glu/sgi/libnurbs/nurbtess/gridWrap.cc
src/glu/sgi/libnurbs/nurbtess/gridWrap.h
src/glu/sgi/libnurbs/nurbtess/monoChain.cc
src/glu/sgi/libnurbs/nurbtess/monoChain.h
src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc
src/glu/sgi/libnurbs/nurbtess/monoTriangulation.h
src/glu/sgi/libnurbs/nurbtess/mystdio.h
src/glu/sgi/libnurbs/nurbtess/mystdlib.h
src/glu/sgi/libnurbs/nurbtess/partitionX.cc
src/glu/sgi/libnurbs/nurbtess/partitionX.h
src/glu/sgi/libnurbs/nurbtess/partitionY.cc
src/glu/sgi/libnurbs/nurbtess/partitionY.h
src/glu/sgi/libnurbs/nurbtess/polyDBG.h
src/glu/sgi/libnurbs/nurbtess/polyUtil.cc
src/glu/sgi/libnurbs/nurbtess/polyUtil.h
src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc
src/glu/sgi/libnurbs/nurbtess/primitiveStream.h
src/glu/sgi/libnurbs/nurbtess/quicksort.cc
src/glu/sgi/libnurbs/nurbtess/quicksort.h
src/glu/sgi/libnurbs/nurbtess/rectBlock.cc
src/glu/sgi/libnurbs/nurbtess/rectBlock.h
src/glu/sgi/libnurbs/nurbtess/sampleComp.cc
src/glu/sgi/libnurbs/nurbtess/sampleComp.h
src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc
src/glu/sgi/libnurbs/nurbtess/sampleCompBot.h
src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc
src/glu/sgi/libnurbs/nurbtess/sampleCompRight.h
src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc
src/glu/sgi/libnurbs/nurbtess/sampleCompTop.h
src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc
src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.h
src/glu/sgi/libnurbs/nurbtess/sampledLine.cc
src/glu/sgi/libnurbs/nurbtess/sampledLine.h
src/glu/sgi/libnurbs/nurbtess/searchTree.cc
src/glu/sgi/libnurbs/nurbtess/searchTree.h
src/glu/sgi/libnurbs/nurbtess/zlassert.h
src/glu/sgi/libtess/README
src/glu/sgi/libtess/alg-outline
src/glu/sgi/libtess/dict-list.h
src/glu/sgi/libtess/dict.c
src/glu/sgi/libtess/dict.h
src/glu/sgi/libtess/geom.c
src/glu/sgi/libtess/memalloc.c
src/glu/sgi/libtess/memalloc.h
src/glu/sgi/libtess/mesh.c
src/glu/sgi/libtess/mesh.h
src/glu/sgi/libtess/normal.h
src/glu/sgi/libtess/priorityq-heap.c
src/glu/sgi/libtess/priorityq-heap.h
src/glu/sgi/libtess/priorityq-sort.h
src/glu/sgi/libtess/priorityq.c
src/glu/sgi/libtess/priorityq.h
src/glu/sgi/libtess/render.c
src/glu/sgi/libtess/render.h
src/glu/sgi/libtess/sweep.h
src/glu/sgi/libtess/tess.h
src/glu/sgi/libtess/tessmono.c
src/glu/sgi/libtess/tessmono.h
src/glu/sgi/libutil/error.c
src/glu/sgi/libutil/glue.c
src/glu/sgi/libutil/gluint.h
src/glu/sgi/libutil/project.c
src/glu/sgi/libutil/registry.c
Diffstat (limited to 'src/mesa/shader/slang/MachineIndependent/ParseHelper.h')
-rwxr-xr-x | src/mesa/shader/slang/MachineIndependent/ParseHelper.h | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/MachineIndependent/ParseHelper.h b/src/mesa/shader/slang/MachineIndependent/ParseHelper.h new file mode 100755 index 00000000000..00552b85548 --- /dev/null +++ b/src/mesa/shader/slang/MachineIndependent/ParseHelper.h @@ -0,0 +1,143 @@ +//
+//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.
+//
+#ifndef _PARSER_HELPER_INCLUDED_
+#define _PARSER_HELPER_INCLUDED_
+
+#include "../Include/ShHandle.h"
+#include "SymbolTable.h"
+#include "localintermediate.h"
+
+struct TMatrixFields {
+ bool wholeRow;
+ bool wholeCol;
+ int row;
+ int col;
+};
+
+typedef enum {
+ EBhRequire,
+ EBhEnable,
+ EBhWarn,
+ EBhDisable
+} TBehavior;
+
+struct TPragma {
+ TPragma(bool o, bool d) : optimize(o), debug(d) { }
+ bool optimize;
+ bool debug;
+ TPragmaTable pragmaTable;
+};
+
+//
+// The following are extra variables needed during parsing, grouped together so
+// they can be passed to the parser without needing a global.
+//
+struct TParseContext {
+ TParseContext(TSymbolTable& symt, TIntermediate& interm, EShLanguage L, TInfoSink& is) :
+ intermediate(interm), symbolTable(symt), infoSink(is), language(L), treeRoot(0),
+ recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0),
+ inTypeParen(false), contextPragma(true, false) { }
+ TIntermediate& intermediate; // to hold and build a parse tree
+ TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
+ TInfoSink& infoSink;
+ EShLanguage language; // vertex or fragment language (future: pack or unpack)
+ TIntermNode* treeRoot; // root of parse tree being created
+ bool recoveredFromError; // true if a parse error has occurred, but we continue to parse
+ int numErrors;
+ bool lexAfterType; // true if we've recognized a type, so can only be looking for an identifier
+ int loopNestingLevel; // 0 if outside all loops
+ bool inTypeParen; // true if in parentheses, looking only for an identifier
+ const TType* currentFunctionType; // the return type of the function that's currently being parsed
+ bool functionReturnsValue; // true if a non-void function has a return
+ TMap<TString, TBehavior> extensionBehavior;
+ void initializeExtensionBehavior();
+
+ void C_DECL error(TSourceLoc, const char *szReason, const char *szToken,
+ const char *szExtraInfoFormat, ...);
+ bool reservedErrorCheck(int line, const TString& identifier);
+ void recover();
+
+ bool parseVectorFields(const TString&, int vecSize, TVectorFields&, int line);
+ bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, int line);
+ void assignError(int line, const char* op, TString left, TString right);
+ void unaryOpError(int line, char* op, TString operand);
+ void binaryOpError(int line, char* op, TString left, TString right);
+ bool lValueErrorCheck(int line, char* op, TIntermTyped*);
+ bool constErrorCheck(TIntermTyped* node);
+ bool integerErrorCheck(TIntermTyped* node, char* token);
+ bool globalErrorCheck(int line, bool global, char* token);
+ bool constructorErrorCheck(int line, TIntermNode*, TFunction&, TOperator, TType*);
+ bool arrayErrorCheck(int line, TString& identifier, TPublicType type, TIntermTyped* size);
+ bool insertBuiltInArrayAtGlobalLevel();
+ bool voidErrorCheck(int, const TString&, const TPublicType&);
+ bool boolErrorCheck(int, const TIntermTyped*);
+ bool boolErrorCheck(int, const TPublicType&);
+ bool samplerErrorCheck(int line, const TPublicType& pType, const char* reason);
+ bool structQualifierErrorCheck(int line, const TPublicType& pType);
+ bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type);
+ bool containsSampler(TType& type);
+ bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type);
+ bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
+ const TFunction* findFunction(int line, TFunction* pfnCall, bool *builtIn = 0);
+ bool executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType,
+ TIntermTyped* initializer, TIntermNode*& intermNode);
+ bool canNodeBeRemoved(TIntermNode*);
+ TIntermTyped* addConstructor(TIntermNode*, TType*, TOperator, TFunction*, TSourceLoc);
+ TIntermTyped* constructStruct(TIntermNode*, TType*, int, TSourceLoc, bool subset);
+ TIntermTyped* constructBuiltIn(TType*, TOperator, TIntermNode*, TSourceLoc, bool subset);
+ TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, TSourceLoc);
+ TIntermTyped* addConstMatrixNode(int , TIntermTyped*, TSourceLoc);
+ TIntermTyped* addConstStruct(TString& , TIntermTyped*, TSourceLoc);
+ bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc);
+ struct TPragma contextPragma;
+ TString HashErrMsg;
+ bool AfterEOF;
+};
+
+int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext&);
+void PaReservedWord();
+int PaIdentOrType(TString& id, TParseContext&, TSymbol*&);
+int PaParseComment(int &lineno, TParseContext&);
+void setInitialState();
+
+typedef TParseContext* TParseContextPointer;
+extern TParseContextPointer& GetGlobalParseContext();
+#define GlobalParseContext GetGlobalParseContext()
+
+typedef struct TThreadParseContextRec
+{
+ TParseContext *lpGlobalParseContext;
+} TThreadParseContext;
+
+#endif // _PARSER_HELPER_INCLUDED_
|