示例#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 );
}
示例#2
0
STRM_T GetCHR( void )
/**************************
 * Get single next character of input
 */
{
    SENT    *head;  /* this is just here for optimizing purposes */
    STRM_T  result;

    flagEOF = 0;
    for( ;; ) {
        head = headSent;

        if( head == NULL ) {
            return( STRM_END ); /* the big mama ending! no more stream! */
        }

        switch( head->type ) {
        case SENT_FILE:
            /* GetFileLine() depends on the order of execution here */
            if( head->data.file.cur == head->data.file.max ) {
                if( !fillBuffer() ) {
                    if( head->data.file.nestLevel != GetNestLevel() ) {
                        PrtMsg( WRN | EOF_BEFORE_ENDIF, "endif" );
                    }
                    popSENT();
                    flagEOF = 1;
                    return( EOL );
                }
            }
            result = *(head->data.file.cur++);
            if( isbarf( result ) ) {
                /* ignore \r in \r\n */
                if( result == '\r' && head->data.file.cur[0] == EOL ) {
                    result = *(head->data.file.cur++);
                } else if( Glob.compat_nmake && result == 0x1a ) {
                    /* embedded ^Z terminates stream in MS mode */
                    result = EOL;
                    popSENT();
                    flagEOF = 1;
                } else {
                    PrtMsg( FTL | LOC | BARF_CHARACTER, result );
                }
            }
            if( result == '\f' ) {
                result = EOL;
            }
            if( result == EOL ) {
                head->data.file.line++;
            }
            return( result );
        case SENT_STR:
            result = *(head->data.str.cur++);
            if( result == NULLCHAR ) {
                popSENT();
                continue;   /* try again */
            }
            return( result );
        case SENT_CHAR:
            result = head->data.s;
            popSENT();
            return( result );
        }
        assert( FALSE );    /* should never get here */
    }
}