Пример #1
0
void    Drop( char ch ) {
//=======================

    ftnfile     *fcb;
    bool        save;
    int         chr_size;

    fcb = IOCB->fileinfo;
    chr_size = 1;
    if( IOCB->flags & DBLE_BYTE_CHAR ) {
        // must be processing second byte of double-byte character
        IOCB->flags &= ~DBLE_BYTE_CHAR;
    } else {
        if( CharSetInfo.is_double_byte_char( ch ) ) {
            chr_size = 2;
            IOCB->flags |= DBLE_BYTE_CHAR;
        }
    }
    if( fcb->col + chr_size > fcb->bufflen ) {
        save = ( IOCB->flags & IOF_NOCR ) != 0;
        IOCB->flags &= ~IOF_NOCR;
        SendEOR();
        if( save ) {
            IOCB->flags |= IOF_NOCR;
        }
        if( ( ( IOCB->flags & IOF_NOFMT ) == 0 ) &&
            ( ( IOCB->set_flags & SET_FMTPTR ) == 0 ) && IsCarriage() ) {
            strcpy( fcb->buffer, NormalCtrlSeq );
            fcb->col = strlen( NormalCtrlSeq );
        }
    }
    fcb->buffer[ fcb->col ] = ch;
    fcb->col++;
}
Пример #2
0
void    _AllocBuffer( ftnfile *fcb ) {
//====================================

    if( fcb->buffer == NULL ) {
        if( IsCarriage() ) {
            fcb->bufflen += strlen( NormalCtrlSeq );
        }
        fcb->buffer = RChkAlloc( fcb->bufflen + 1 );
    }
}