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