Esempio n. 1
0
int main( void )
/***************/
{
    int     i;
    bool    noneyet;

    /*printf( "extern UINT8 IsArray[] = {\n" );*/
    printf( "/*STRM_MAGIC*/  0,\n" );
    printf( "/*STRM_END  */  0" );      /* note: no ",\n" !! */

    for( i = 0; i <= 255; i++ ) {
        noneyet = true;

        if( isprint( i ) ) {
            printf( ",\n/*   '%c'    */  ", i );
        } else {
            printf( ",\n/*   0x%02x   */  ", i );
        }

        if( isws( i ) ) {
            BAR( IS_WS    );
        }
        if( isprt( i ) ) {
            BAR( IS_PRINT );
        }
        if( isalpha( i ) ) {
            BAR( IS_ALPHA );
        }
        if( isextc( i ) ) {
            BAR( IS_EXTC  );
        }
        if( isdirc( i ) ) {
            BAR( IS_DIRC  );
        }
        if( isfilec( i ) ) {
            BAR( IS_FILEC );
        }
        if( ismacc( i ) ) {
            BAR( IS_MACC );
        }
        if( isbarf( i ) ) {
            BAR( IS_BARF );
        }

        if( noneyet ) {
            printf( "0" );
        }
    }

    /*printf("\n};\n");*/
    printf( "\n" );
    return( 0 );
}
Esempio n. 2
0
STATIC TOKEN_T lexDotName( void )
/********************************
 * Given that the last character was a DOT, input the maximum string
 * possible, and check if it is a TOK_DOTNAME, TOK_SUF, or TOK_SUFSUF
 * Special cases to look for: "."{dirc}; ".."{dirc}; ".."{extc}+;
 * and "."{extc}+"."
 * recognizes:
 *   "."{extc}*                                 TOK_SUF
 *   "."{extc}*"."{extc}*                       TOK_SUFSUF
 *   "{"path"}""."{extc}*"{"path"}""."{extc}    TOK_SUFSUF
 *   "."{dot-name}                              TOK_DOTNAME
 *   "."{dirc}                                  passes to lexFileName()
 *   ".."{dirc}                                 passes to lexFileName()
 */
{
    char        ext[MAX_SUFFIX];
    unsigned    pos;
    STRM_T      s;
    STRM_T      s2;
    TOKEN_T     ret;

    pos  = 0;

    if( *targ_path != NULLCHAR ) {
        FreeSafe( targ_path );
        targ_path = "";
    }
    if( *dep_path != NULLCHAR ) {
        FreeSafe( dep_path );
        dep_path = "";
    }
    dep_path = getCurlPath();
    s = PreGetCH();
    if( s != DOT ) {
        PrtMsg( ERR | LOC | INVALID_SUFSUF );
        return( TOK_NULL );
    } else {
        ext[pos++] = DOT;
        s = PreGetCH();
    }

    if( isdirc( s ) || s == PATH_SPLIT || s == ';' ) {  // check for "."{dirc}
        UnGetCH( s );
        if( *dep_path != NULLCHAR ) {
            PrtMsg( ERR | LOC | INVALID_SUFSUF );
        }
        return( lexFileName( DOT ) );
    }

    if( s == DOT ) {        /* check if ".."{extc} or ".."{dirc} */
        s2 = PreGetCH();    /* probe one character */
        UnGetCH( s2 );
        if( isdirc( s2 ) || s2 == PATH_SPLIT || s2 == ';' ) {   // is ".."{dirc}
            UnGetCH( s );
            if( *dep_path != NULLCHAR ) {
                PrtMsg( ERR | LOC | INVALID_SUFSUF );
            }
            return( lexFileName( DOT ) );
        }
    } else {    /* get string {extc}+ */
        while( pos < MAX_SUFFIX && isextc( s ) && s != L_CURL_PAREN ) {
            ext[pos++] = s;
            s = PreGetCH();
        }
        if( pos == MAX_SUFFIX ) {
            PrtMsgExit(( FTL | LOC | MAXIMUM_TOKEN_IS, MAX_SUFFIX - 1 ));
        }
        ext[pos] = NULLCHAR;
    }

    UnGetCH( s );

    targ_path = getCurlPath();

    s = PreGetCH();         /* next char */

    if( s == DOT ) {        /* maybe of form "."{extc}*"."{extc}* */
        ext[pos++] = s;
        for( s = PreGetCH(); pos < MAX_SUFFIX && isextc( s ); s = PreGetCH() ) {
            ext[pos++] = s;
        }
        if( pos == MAX_SUFFIX ) {
            PrtMsgExit(( FTL | LOC | MAXIMUM_TOKEN_IS, MAX_SUFFIX - 1 )); //NOTREACHED
        }
        ext[pos] = NULLCHAR;

        ret = TOK_SUFSUF;
    } else {
        if( *targ_path != NULLCHAR && *dep_path != NULLCHAR ) {
            PrtMsg( ERR | LOC | INVALID_SUFSUF );
        }
        ret = TOK_SUF;
    }
    UnGetCH( s );           /* put back what we don't need */

    if( *targ_path != NULLCHAR && *dep_path != NULLCHAR && ret == TOK_SUF ) {
        PrtMsg( ERR | LOC | INVALID_SUFSUF );
    } else if( ret == TOK_SUF && checkDotName( ext ) ) {
        return( TOK_DOTNAME );
    }
    CurAttr.u.ptr = StrDupSafe( ext );
    return( ret );
}