blob: 11808531ccb66c1bfb9acd5ef7ba6518b1f0fb3b [file] [log] [blame]
cmarrin@apple.comf0c26ac2010-08-03 16:26:48 +00001/****************************************************************************\
2Copyright (c) 2002, NVIDIA Corporation.
3
4NVIDIA Corporation("NVIDIA") supplies this software to you in
5consideration of your agreement to the following terms, and your use,
6installation, modification or redistribution of this NVIDIA software
7constitutes acceptance of these terms. If you do not agree with these
8terms, please do not use, install, modify or redistribute this NVIDIA
9software.
10
11In consideration of your agreement to abide by the following terms, and
12subject to these terms, NVIDIA grants you a personal, non-exclusive
13license, under NVIDIA's copyrights in this original NVIDIA software (the
14"NVIDIA Software"), to use, reproduce, modify and redistribute the
15NVIDIA Software, with or without modifications, in source and/or binary
16forms; provided that if you redistribute the NVIDIA Software, you must
17retain the copyright notice of NVIDIA, this notice and the following
18text and disclaimers in all such redistributions of the NVIDIA Software.
19Neither the name, trademarks, service marks nor logos of NVIDIA
20Corporation may be used to endorse or promote products derived from the
21NVIDIA Software without specific prior written permission from NVIDIA.
22Except as expressly stated in this notice, no other rights or licenses
23express or implied, are granted by NVIDIA herein, including but not
24limited to any patent rights that may be infringed by your derivative
25works or by other works in which the NVIDIA Software may be
26incorporated. No hardware is licensed hereunder.
27
28THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
29WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
30INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
31NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
32ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
33PRODUCTS.
34
35IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
36INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
37TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
38USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
39OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
40NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
41TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
42NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43\****************************************************************************/
44//
45// compile.h
46//
47
48#if !defined(__COMPILE_H)
49#define __COMPILE_H 1
50
51int InitCPPStruct(void);
52
53typedef struct Options_Rec{
54 const char *profileString;
55 int ErrorMode;
56 int Quiet;
57
58 // Debug The Compiler options:
59 int DumpAtomTable;
60} Options;
61
zmo@google.com86c3f272011-06-21 02:23:19 +000062#define MAX_IF_NESTING 64
cmarrin@apple.comf0c26ac2010-08-03 16:26:48 +000063struct CPPStruct_Rec {
64 // Public members
65 SourceLoc *pLastSourceLoc; // Set at the start of each statement by the tree walkers
66 Options options; // Compile options and parameters
67
68 // Private members
69 SourceLoc lastSourceLoc;
70
71 // Scanner data:
72
73 SourceLoc *tokenLoc; // Source location of most recent token seen by the scanner
74 int mostRecentToken; // Most recent token seen by the scanner
75 InputSrc *currentInput;
76 int previous_token;
77 int pastFirstStatement; // used to make sure that #version is the first statement seen in the file, if present
78
79 void *pC; // storing the parseContext of the compile object in cpp.
80
81 // Private members:
82 SourceLoc ltokenLoc;
83 int ifdepth; //current #if-#else-#endif nesting in the cpp.c file (pre-processor)
zmo@google.com86c3f272011-06-21 02:23:19 +000084 int elsedepth[MAX_IF_NESTING];//Keep a track of #if depth..Max allowed is 64.
cmarrin@apple.comf0c26ac2010-08-03 16:26:48 +000085 int elsetracker; //#if-#else and #endif constructs...Counter.
86 const char *ErrMsg;
87 int CompileError; //Indicate compile error when #error, #else,#elif mismatch.
88
89 //
90 // Globals used to communicate between PaParseStrings() and yy_input()and
91 // also across the files.(gen_glslang.cpp and scanner.c)
92 //
kbr@google.com4ab3da02011-01-19 03:00:39 +000093 int PaWhichStr; // which string we're parsing
94 const int* PaStrLen; // array of lengths of the PaArgv strings
95 int PaArgc; // count of strings in the array
96 const char* const* PaArgv; // our array of strings to parse
cmarrin@apple.comf0c26ac2010-08-03 16:26:48 +000097 unsigned int tokensBeforeEOF : 1;
98};
99
100#endif // !defined(__COMPILE_H)