Exemple #1
0
static void PP_Include( const char *ptr )
{
    const char  *filename;
    char        delim;
    int         incl_type;
    size_t      len;

    while( *ptr == ' ' || *ptr == '\t' )
        ++ptr;
    filename = ptr + 1;
    if( *ptr == '<' ) {
        delim = '>';
        incl_type = PPINCLUDE_SYS;
    } else if( *ptr == '"' ) {
        delim = '"';
        incl_type = PPINCLUDE_USR;
    } else {
        PP_GenError( "Unrecognized INCLUDE directive" );
        return;
    }
    ++ptr;
    while( *ptr != delim && *ptr != '\0' )
        ++ptr;
    len = ptr - filename;
    if( PP_OpenInclude( filename, len, incl_type ) == NULL ) {
        sprintf( PPLineBuf + 1, "%cerror Unable to open '%*s'\n", PreProcChar, (int)len, filename );
        PPNextTokenPtr = PPLineBuf + 1;
    } else {
        PP_GenLine();
    }
}
Exemple #2
0
void PP_Include( char *ptr )
{
    char        *filename;
    char        delim;
    int         incl_type;

    while( *ptr == ' '  ||  *ptr == '\t' ) ++ptr;
    filename = ptr+1;
    if( *ptr == '<' ) {
        delim = '>';
        incl_type = PPINCLUDE_SYS;
    } else if( *ptr == '"' ) {
        delim = '"';
        incl_type = PPINCLUDE_USR;
    } else {
        PP_GenError( "Unrecognized INCLUDE directive" );
        return;
    }
    ++ptr;
    while( *ptr != delim  &&  *ptr != '\0' )
        ++ptr;
    *ptr = '\0';
    if( PP_OpenInclude( filename, incl_type ) == NULL ) {
        filename = doStrDup( filename );        // want to reuse buffer
        PPCharPtr = &PPLineBuf[1];
        sprintf( PPCharPtr, "%cerror Unable to open '%s'\n", PreProcChar, filename );
        PP_Free( filename );
    } else {
        PP_GenLine();
    }
}
Exemple #3
0
static void PP_RCInclude( const char *ptr )
{
    const char  *filename;
    bool        quoted = false;
    size_t      len;

    while( *ptr == ' ' || *ptr == '\t' )
        ++ptr;
    if( *ptr == '\"' ) {
        ptr++;
        quoted = true;
    }

    filename = ptr;
    ++ptr;
    if( quoted ) {
        while( *ptr != '\"' ) {
            ptr++;
        }
    } else {
        for( ;; ) {
            if( *ptr == ' ' )
                break;
            if( *ptr == '\t' )
                break;
            if( *ptr == '\r' )
                break;
            if( *ptr == '\n' )
                break;
            if( *ptr == '\0' )
                break;
            if( *ptr == '\"' )
                break;
            ++ptr;
        }
    }
    len = ptr - filename;
    if( PP_OpenInclude( filename, len, PPINCLUDE_USR ) == NULL ) {
        sprintf( PPLineBuf + 1, "%cerror Unable to open '%*s'\n", PreProcChar, (int)len, filename );
        PPNextTokenPtr = PPLineBuf + 1;
    } else {
        PP_GenLine();
    }
}
Exemple #4
0
void PP_RCInclude( char *ptr )
{
    char        *filename;
    int         quoted = 0;

    while( *ptr == ' '  ||  *ptr == '\t' ) ++ptr;
    if( *ptr == '\"' ) {
        ptr++;
        quoted = 1;
    }

    filename = ptr;
    ++ptr;
    if( quoted ) {
        while( *ptr != '\"' ) {
            ptr++;
        }
    } else {
        for( ;; ) {
            if( *ptr == ' ' ) break;
            if( *ptr == '\t' ) break;
            if( *ptr == '\r' ) break;
            if( *ptr == '\n' ) break;
            if( *ptr == '\0' ) break;
            if( *ptr == '\"' ) break;
            ++ptr;
        }
    }
    *ptr = '\0';
    if( PP_OpenInclude( filename, PPINCLUDE_USR ) == NULL ) {
        filename = doStrDup( filename );        // want to reuse buffer
        PPCharPtr = &PPLineBuf[1];
        sprintf( PPCharPtr, "%cerror Unable to open '%s'\n", PreProcChar, filename );
        PP_Free( filename );
    } else {
        PP_GenLine();
    }
}