예제 #1
0
파일: dui.c 프로젝트: seyko2/open-watcom-v2
bool DUIGetSourceLine( cue_handle *ch, char *buff, unsigned len )
{
    void        *viewhndl;

    viewhndl = OpenSrcFile( ch );
    if( viewhndl == NULL ) return( FALSE );
    buff[ FReadLine( viewhndl, CueLine( ch ), 0, buff, len )] = '\0';
    FDoneSource( viewhndl );
    return( TRUE );
}
예제 #2
0
bool DUIGetSourceLine( cue_handle *ch, char *buff, unsigned len )
{
    void        *viewhndl;

    viewhndl = OpenSrcFile( ch );
    if( viewhndl == NULL ) return( false );
    buff[FReadLine( viewhndl, CueLine( ch ), 0, buff, len )] = NULLCHAR;
    FDoneSource( viewhndl );
    return( true );
}
예제 #3
0
extern void WPSourceClose( wp_srcfile * wpsrc_file )
/**************************************************/
{
    if( wpsrc_file != NULL ) {
        FDoneSource( wpsrc_file->src_file );
        if( wpsrc_file->src_buff != NULL ) {
            ProfFree( wpsrc_file->src_buff );
        }
        ProfFree( wpsrc_file );
    }
}
예제 #4
0
int main( void )
{
    char        buff[256];
    struct browser *fp;
    int         len;
    int         i;
    int         got;

    fp = FOpenSource( "testsrcm.c", 0, 0 );
    if( fp != NULL ) {
        for( i = 1; FReadLine( fp, i, 0, buff, 256 ) != FREADLINE_ERROR; ++i ) {
        }
        for( --i; i >= 1; --i ) {
            buff[FReadLine( fp, i, 0, buff, 256 )] = '\0';
            printf( "%s\n", buff );
        }
        FDoneSource( fp );
    }
}
예제 #5
0
void WPAsmClose( wp_asmfile * wpasm_file )
/****************************************/
{
    wp_asmline *        asm_line;
    int                 row;
    int                 asm_group;
    int                 asm_row;

    if( wpasm_file != NULL ) {
        if( wpasm_file->asm_data != NULL ) {
            row = 0;
            while( row < wpasm_file->asm_rows ) {
                asm_line = WPGetAsmLoc( wpasm_file, row, &asm_group, &asm_row );
                if( asm_line->source_line ) {
                    FDoneSource( asm_line->u.src.src_file );
                }
                row++;
            }
            row = wpasm_file->asm_rows;
            asm_group = 0;
            for( ;; ) {
                ProfFree( wpasm_file->asm_data[asm_group++].asm_lines );
                row -= MAX_ASM_LINE_INDEX;
                if( row < 0 ) break;
            }
            ProfFree( wpasm_file->asm_data );
        }
        if( wpasm_file->asm_buff != NULL ) {
            ProfFree( wpasm_file->asm_buff );
        }
        if( wpasm_file->fh != 0 ) {
            ExeClose( wpasm_file->fh );
        }
        ProfFree( wpasm_file );
    }
}
예제 #6
0
static void FileTrack( a_window *wnd, cue_handle *ch )
{
    unsigned    active, old_active;
    unsigned    end_line;
    int         slack;
    file_window *file = WndFile( wnd );
    mod_handle  mod;
    cue_fileid  id;
    wnd_row     curr_row;
    int         curr_piece;

    if( ch == NULL ) {
        mod = NO_MOD;
        id = 0;
    } else {
        mod = CueMod( ch );
        id = CueFileId( ch );
    }
    if( file->viewhndl == NULL
      || file->mod != mod
      || file->file_id != id ) {
        if( file->viewhndl != NULL ) {
            FDoneSource( file->viewhndl );
        }
        file->mod = mod;
        file->file_id = id;
        FileSetDotAddr( wnd, GetCodeDot() );
        if( file->mod == NO_MOD ) {
            file->viewhndl = NULL;
        } else {
            file->viewhndl = OpenSrcFile( ch );
        }
        FileSetTitle( wnd, mod );
        SeekToTheEnd( file );
        file->eof = UINT_MAX;
        WndZapped( wnd );
        FilePosInit( wnd );
        file->active = NOT_ACTIVE;
        FilePos( wnd, 0 );
        DbgUpdate( UP_OPEN_CHANGE );
    }
    active = ActiveLine();
    if( active != file->active ) {
        FileSetDotAddr( wnd, GetCodeDot() );
        WndGetCurrent( wnd, &curr_row, &curr_piece );
        WndNoCurrent( wnd );
        if( curr_row != WND_NO_ROW ) {
            WndRowDirty( wnd, curr_row );
        }
    }
    old_active = file->active;
    file->active = NOT_ACTIVE;
    slack = WndRows( wnd ) / 4;
    if( slack > 2 )
        slack = 2;
    end_line = WndTop( wnd ) + WndRows( wnd ) - 1;
    if( old_active == NOT_ACTIVE || active > end_line ) {
        WndZapped( wnd );
        WndScroll( wnd, active - slack - WndTop( wnd ) );
    } else if( active > end_line - slack ) {
        WndRowDirtyImmed( wnd, old_active );
        WndScroll( wnd, WndRows( wnd ) - 2 * slack );
    } else if( active < WndTop( wnd ) ) {
        WndRowDirtyImmed( wnd, old_active );
        WndScroll( wnd, active - WndTop( wnd ) - slack );
    } else {
        WndRowDirty( wnd, old_active );
    }
    WndNewCurrent( wnd, active, PIECE_SOURCE );
    WndRowDirty( wnd, active );
    file->active = active;
}