LCOV - code coverage report
Current view: directory - gfx/angle/src/compiler/preprocessor - cppstruct.c (source / functions) Found Hit Coverage
Test: app.info Lines: 43 0 0.0 %
Date: 2012-06-02 Functions: 5 0 0.0 %

       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                 : // cppstruct.c
      46                 : //
      47                 : 
      48                 : #include <stdio.h>
      49                 : #include <stdlib.h>
      50                 : 
      51                 : #include "compiler/preprocessor/slglobals.h"
      52                 : 
      53                 : CPPStruct  *cpp      = NULL;
      54                 : static int  refCount = 0;
      55                 : 
      56                 : int InitPreprocessor(void);
      57                 : int ResetPreprocessor(void);
      58                 : int FreeCPPStruct(void);
      59                 : int FinalizePreprocessor(void);
      60                 : 
      61                 : /*
      62                 :  * InitCPPStruct() - Initilaize the CPP structure.
      63                 :  *
      64                 :  */
      65                 : 
      66               0 : int InitCPPStruct(void)
      67                 : {
      68                 :     int len;
      69                 :     char *p;
      70                 : 
      71               0 :     cpp = (CPPStruct *) malloc(sizeof(CPPStruct));
      72               0 :     if (cpp == NULL)
      73               0 :         return 0;
      74                 : 
      75               0 :     refCount++;
      76                 : 
      77                 :     // Initialize public members:
      78               0 :     cpp->pLastSourceLoc = &cpp->lastSourceLoc;
      79                 :     
      80               0 :         p = (char *) &cpp->options;
      81               0 :     len = sizeof(cpp->options);
      82               0 :     while (--len >= 0)
      83               0 :         p[len] = 0;
      84                 :      
      85               0 :     ResetPreprocessor();
      86               0 :     return 1;
      87                 : } // InitCPPStruct
      88                 : 
      89               0 : int ResetPreprocessor(void)
      90                 : {
      91                 :     // Initialize private members:
      92                 : 
      93               0 :     cpp->lastSourceLoc.file = 0;
      94               0 :     cpp->lastSourceLoc.line = 0;
      95               0 :     cpp->pC = 0;
      96               0 :     cpp->CompileError = 0;
      97               0 :     cpp->ifdepth = 0;
      98               0 :     for(cpp->elsetracker = 0; cpp->elsetracker < MAX_IF_NESTING; cpp->elsetracker++)
      99               0 :         cpp->elsedepth[cpp->elsetracker] = 0;
     100               0 :     cpp->elsetracker = 0;
     101               0 :     cpp->tokensBeforeEOF = 0;
     102               0 :     return 1;
     103                 : }
     104                 : 
     105                 : //Intializing the Preprocessor.
     106                 : 
     107               0 : int InitPreprocessor(void)
     108                 : {
     109                 :    #  define CPP_STUFF true
     110                 :         #  ifdef CPP_STUFF
     111               0 :             FreeCPPStruct();
     112               0 :             InitCPPStruct();
     113               0 :             cpp->options.Quiet = 1;
     114               0 :             cpp->options.profileString = "generic";
     115               0 :             if (!InitAtomTable(atable, 0))
     116               0 :                 return 1;
     117               0 :             if (!InitScanner(cpp))
     118               0 :                     return 1;
     119                 :        #  endif
     120               0 :   return 0; 
     121                 : }
     122                 : 
     123                 : //FreeCPPStruct() - Free the CPP structure.
     124                 : 
     125               0 : int FreeCPPStruct(void)
     126                 : {
     127               0 :     if (refCount)
     128                 :     {
     129               0 :        free(cpp);
     130               0 :        refCount--;
     131                 :     }
     132                 :     
     133               0 :     return 1;
     134                 : }
     135                 : 
     136                 : //Finalizing the Preprocessor.
     137                 : 
     138               0 : int FinalizePreprocessor(void)
     139                 : {
     140                 :    #  define CPP_STUFF true
     141                 :         #  ifdef CPP_STUFF
     142               0 :             FreeAtomTable(atable);
     143               0 :             FreeCPPStruct();
     144               0 :             FreeScanner();
     145                 :        #  endif
     146               0 :   return 0; 
     147                 : }
     148                 : 
     149                 : 
     150                 : ///////////////////////////////////////////////////////////////////////////////////////////////
     151                 : ////////////////////////////////////// End of cppstruct.c //////////////////////////////////////
     152                 : ///////////////////////////////////////////////////////////////////////////////////////////////

Generated by: LCOV version 1.7