Example #1
0
static void PP_Elif( const char *ptr )
{
    int         value;

    while( *ptr == ' ' || *ptr == '\t' )
        ++ptr;
    if( NestLevel == 0 || PPStack->cpp_type == PP_ELSE ) {
        // CErr1( ERR_MISPLACED_ELIF );
    } else {
        if( NestLevel == SkipLevel ) {
            --SkipLevel;                /* start skipping else part */
            PPStack->processing = FALSE;
            PPStack->cpp_type = PP_ELIF;
        } else if( NestLevel == SkipLevel + 1 ) {
            /* only evaluate the expression when required */
            if( PPStack->cpp_type == PP_IF ) {
                value = PPConstExpr( ptr );
                if( value ) {
                    SkipLevel = NestLevel; /* start including else part */
                    PPStack->processing = TRUE;
                    PPStack->cpp_type = PP_ELIF;
                }
            }
        }
    }
}
Example #2
0
void PP_If( char *ptr )
{
    int         value;

    while( *ptr == ' '  ||  *ptr == '\t' ) ++ptr;
    if( NestLevel == SkipLevel ) {
        value = PPConstExpr( ptr );
        IncLevel( value );
    } else {                /* no need to evaluate expression */
        IncLevel( 0 );
    }
}