Beispiel #1
0
void            DIGCLIENT MADCliNotify( mad_notify_type nt, const void *d )
{
    switch( nt ) {
    case MNT_ERROR:
        MADStatus = *(mad_status *)d;
        break;
    case MNT_MODIFY_REG:
        DbgUpdate( UP_REG_CHANGE );
        break;
    case MNT_MODIFY_IP:
        DbgUpdate( UP_CSIP_CHANGE );
        break;
    case MNT_MODIFY_SP:
    case MNT_MODIFY_FP:
        break;
    case MNT_EXECUTE_TOUCH_SCREEN_BUFF:
        _SwitchOn( SW_TOUCH_SCREEN_BUFF );
        break;
    case MNT_EXECUTE_LONG:
        _SwitchOn( SW_EXECUTE_LONG );
        break;
    case MNT_REDRAW_DISASM:
        DbgUpdate( UP_ASM_RESIZE );
        break;
    case MNT_REDRAW_REG:
        DbgUpdate( UP_REG_RESIZE );
        break;
    }
}
Beispiel #2
0
void CheckMADChange( void )
{
    mad_status          ms;
    mad_type_info       mti;

    if( MADActiveSet( SysConfig.mad ) != SysConfig.mad ) {
        if( MADLoaded( SysConfig.mad ) != MS_OK ) {
            ms = MADLoad( SysConfig.mad );
            if( ms != MS_OK ) {
                ReportMADFailure( ms );
            }
        }
        DbgUpdate( UP_MAD_CHANGE );
        ResizeTraceData();
        ResizeRegData();
        PendingToggles();
        if( MADCallStackGrowsUp() == MS_OK ) {
            _SwitchOn( SW_STACK_GROWS_UP );
        } else {
            _SwitchOff( SW_STACK_GROWS_UP );
        }
        GetMADTypeDefault( MTK_ADDRESS, &mti );
        if( mti.a.seg.bits != 0 ) {
            _SwitchOn( SW_HAVE_SEGMENTS );
        } else {
            _SwitchOff( SW_HAVE_SEGMENTS );
        }
        SetMADMenuItems();
        ClearMachineDataCache();
    }
}
Beispiel #3
0
static void ThdCmd( thread_state *thd, enum thread_cmds cmd )
{
    unsigned    up;

    up = UP_THREAD_STATE;
    switch( cmd ) {
    case T_SHOW:
        FormThdState( thd, TxtBuff, TXT_LEN );
        DUIDlgTxt( TxtBuff );
        up = UP_NO_CHANGE;
        break;
    case T_FREEZE:
        if( thd->state == THD_THAW )
            thd->state = THD_FREEZE;
        break;
    case T_THAW:
        if( thd->state == THD_FREEZE )
            thd->state = THD_THAW;
        break;
    case T_CHANGE:
        MakeThdCurr( thd );
        break;
    }
    DbgUpdate( up );
}
Beispiel #4
0
void SourceSet( void )
{
    char_ring **owner;
    char      *start;
    unsigned   len;

    if( CurrToken == T_DIV ) {
        Scan();
        if( ScanCmd( AddTab ) == 0 ) {
            Error( ERR_LOC, LIT( ERR_BAD_SUBCOMMAND ), GetCmdName( CMD_SET ) );
        }
        owner = RingEnd( &SrcSpec );
    } else {
        owner = &SrcSpec;
        FiniSource();
    }
    while( ScanItem( TRUE, &start, &len ) ) {
        while( len > 0 && *start == ' ' ) {
            ++start;
            --len;
        }
        InsertRing( owner, start, len );
    }
    DbgUpdate( UP_NEW_SRC );
}
Beispiel #5
0
bool ReportTrap( unsigned conditions, bool stack_cmds )
{
    bool    cmds_pushed;
    char        *p;

    if( conditions & COND_EXCEPTION ) {
        RecordMsgText( &conditions ); // get the 'access violation, etc' message
        p = StrCopy( LIT_ENG( Task_Exception ), TxtBuff );
        if( MsgText != NULL ) StrCopy( MsgText, p );
        MsgText = DbgRealloc( MsgText, strlen( TxtBuff ) + 1 );
        StrCopy( TxtBuff, MsgText );
        DUIMsgBox( MsgText );
    }
    if( conditions & (COND_EXCEPTION|COND_TERMINATE) ) {
        RingBell();
    }
    DisplayMsgText();
    if( conditions & COND_USER ) {
        DUIInfoBox( LIT_ENG( User_Interupt ) );
        PurgeInpStack();
        RecordAsynchEvent();
    } else if( conditions & COND_TERMINATE ) {
        DUIInfoBox( LIT_ENG( Task_Completed ) );
        _SwitchOff( SW_HAVE_TASK );
    } else if( conditions & COND_LIBRARIES ) {
        Format( TxtBuff, "%s '%s'", LIT_ENG( Break_on_DLL_Load ), GetLastImageName() );
        DUIInfoBox( TxtBuff );
    } else {
        DUIStatusText( LIT_ENG( Empty ) );
    }
    cmds_pushed = DispBPMsg( stack_cmds );
    DbgUpdate( UP_MEM_CHANGE | UP_CSIP_CHANGE | UP_REG_CHANGE |
               UP_CODE_EXECUTED | UP_THREAD_STATE );
    return( cmds_pushed );
}
Beispiel #6
0
void SkipToAddr( address addr )
{
    if( IS_NIL_ADDR( addr ) ) return;
    if( !AdvMachState( ACTION_MODIFY_IP ) ) return;
    RecordSetRegIP( addr );
    DbgUpdate( UP_CSIP_CHANGE | UP_REG_CHANGE );
}
Beispiel #7
0
void ActPoint( brkp *bp, bool act )
{
    if( act && bp->status.b.unmapped )
        return;
    DoActPoint( bp, act );
    DbgUpdate( UP_BREAK_CHANGE );
}
Beispiel #8
0
bool ReLoadSymInfo( image_entry *image )
{
    if( ProcSymInfo( image ) ) {
        DIPMapInfo( image->dip_handle, image );
        DbgUpdate( UP_SYMBOLS_ADDED );
        return( TRUE );
    }
    return( FALSE );
}
Beispiel #9
0
void BrkDisableAll( void )
{
    brkp    *bp;

    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        DoActPoint( bp, false );
    }
    DbgUpdate( UP_BREAK_CHANGE );
}
Beispiel #10
0
bool ReLoadImgSymInfo( image_entry *image )
{
    if( ProcImgSymInfo( image ) ) {
        DIPMapInfo( image->dip_handle, image );
        DbgUpdate( UP_SYMBOLS_ADDED );
        return( true );
    }
    return( false );
}
Beispiel #11
0
void UnFreezeRegs( void )
{
    if( FreezeRegSet != NULL ) {
        CopyMachState( FreezeRegSet, DbgRegs );
        Context = FreezeContext;
        FreeMachState( FreezeRegSet );
        DbgUpdate( UP_MEM_CHANGE );
        FreezeRegSet = NULL;
        ContextMod = FreezeContextMod;
    }
}
Beispiel #12
0
void BPsDeac( void )
{
    brkp    *bp;

    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        DoActPoint( bp, false );
    }
    DbgUpdate( UP_BREAK_CHANGE );
    NullStatus( &UserTmpBrk );
    NullStatus( &DbgTmpBrk );
}
Beispiel #13
0
void MakeRunThdCurr( thread_state *thd )
{
    unsigned    err;

    if( !AdvMachState( ACTION_THREAD_CHANGE ) ) return;
    if( RemoteSetRunThreadWithErr( thd->tid, &err ) == 0 ) {
        Error( ERR_NONE, LIT( ERR_NO_MAKE_CURR_THREAD ), thd->tid, err );
    }
    DbgRegs->tid = thd->tid;
    ReadDbgRegs();
    SetCodeDot( GetRegIP() );
    DbgUpdate( UP_REG_CHANGE | UP_CSIP_CHANGE | UP_THREAD_STATE );
}
Beispiel #14
0
void UnLoadImgSymInfo( image_entry *image, bool nofree )
{
    if( image->dip_handle != NO_MOD ) {
        image->nofree = nofree;
        DIPUnloadInfo( image->dip_handle );
        if( nofree ) {
            image->dip_handle = NO_MOD;
            image->nofree = false;
        }
        DbgUpdate( UP_SYMBOLS_LOST );
        FClearOpenSourceCache();
    }
}
Beispiel #15
0
static void     RunTrdMenuItem( a_window *wnd, unsigned id, int row, int piece )
{
    thread_state        *thd = GetThreadRow( row );

    piece=piece;
    switch( id ) {
    case MENU_INITIALIZE:
        if( thd == NULL ) {
            WndMenuGrayAll( wnd );
        } else {
            switch( thd->state ) {
            case THD_SIGNAL:
                WndMenuEnable( wnd, MENU_RUN_THREAD_STOP, TRUE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_SIGNAL_STOP, TRUE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_CHANGE_TO, FALSE );
                break;

            case THD_DEBUG:
                WndMenuEnable( wnd, MENU_RUN_THREAD_STOP, FALSE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_SIGNAL_STOP, FALSE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_CHANGE_TO, TRUE );
                break;

            case THD_RUN:
            case THD_WAIT:
            case THD_BLOCKED:
                WndMenuEnable( wnd, MENU_RUN_THREAD_STOP, TRUE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_SIGNAL_STOP, FALSE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_CHANGE_TO, FALSE );
                break;

            default:
                WndMenuGrayAll( wnd );
                break;
            }                    
        }
        return;
    case MENU_RUN_THREAD_STOP:
        RemoteStopThread( thd );
        break;
    case MENU_RUN_THREAD_SIGNAL_STOP:
        RemoteSignalStopThread( thd );
        break;
    case MENU_RUN_THREAD_CHANGE_TO:
        MakeRunThdCurr( thd );
        break;
    }
    DbgUpdate( UP_THREAD_STATE );
}
Beispiel #16
0
extern brkp *AddBreak( address addr )
{
    brkp        *bp;

    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        if( AddrComp( bp->loc.addr, addr ) == 0 ) {
            DoActPoint( bp, TRUE );
            DbgUpdate( UP_BREAK_CHANGE );
            return( bp );
        }
    }
    bp = AddPoint( addr, MAD_NIL_TYPE_HANDLE, FALSE );
    if( bp == NULL ) return( NULL );
    RecordBreakEvent( bp, B_SET );
    return( bp );
}
Beispiel #17
0
brkp *AddBreak( address addr )
{
    brkp        *bp;

    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        if( AddrComp( bp->loc.addr, addr ) == 0 ) {
            DoActPoint( bp, true );
            DbgUpdate( UP_BREAK_CHANGE );
            return( bp );
        }
    }
    bp = AddPoint( addr, BP_EXECUTE, false );
    if( bp != NULL )
        RecordBreakEvent( bp, B_SET );
    return( bp );
}
Beispiel #18
0
void MakeThdCurr( thread_state *thd )
{
    error_handle    errh;

    if( !AdvMachState( ACTION_THREAD_CHANGE ) )
        return;
    // NYI - PUI - record the thread change?
    WriteDbgRegs();
    if( RemoteSetThreadWithErr( thd->tid, &errh ) == 0 ) {
        Error( ERR_NONE, LIT_ENG( ERR_NO_MAKE_CURR_THREAD ), thd->tid, errh );
    }
    DbgRegs->tid = thd->tid;
    ReadDbgRegs();
    SetCodeDot( GetRegIP() );
    DbgUpdate( UP_REG_CHANGE | UP_CSIP_CHANGE | UP_THREAD_STATE );
}
Beispiel #19
0
static void TrdMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    thread_state        *thd = GetThreadRow( row );

    piece=piece;
    switch( id ) {
    case MENU_INITIALIZE:
        if( thd == NULL ) {
            WndMenuGrayAll( wnd );
        } else {
            switch( thd->state ) {
            case THD_THAW:
            case THD_FREEZE:
                WndMenuEnable( wnd, MENU_THREAD_FREEZE, true );
                WndMenuEnable( wnd, MENU_THREAD_THAW, true );
                WndMenuEnable( wnd, MENU_THREAD_CHANGE_TO, true );
                break;
            case THD_DEBUG:
                WndMenuEnable( wnd, MENU_THREAD_FREEZE, false );
                WndMenuEnable( wnd, MENU_THREAD_THAW, false );
                WndMenuEnable( wnd, MENU_THREAD_CHANGE_TO, true );
                break;
            default:
                WndMenuGrayAll( wnd );
                break;
            }                    
        }
        return;
    case MENU_THREAD_FREEZE:
        if( thd->state == THD_THAW )
            thd->state = THD_FREEZE;
        break;
    case MENU_THREAD_THAW:
        if( thd->state == THD_FREEZE )
            thd->state = THD_THAW;
        break;
    case MENU_THREAD_CHANGE_TO:
        switch( thd->state ) {
        case THD_THAW:
        case THD_FREEZE:
        case THD_DEBUG:    
            MakeThdCurr( thd );
            break;
        }
    }
    DbgUpdate( UP_THREAD_STATE );
}
Beispiel #20
0
void ChangeMemUndoable( address addr, const void *data, size_t size )
{
    char                *p;
    char                *end;

    if( AdvMachState( ACTION_MODIFY_MEMORY ) ) {
        ChangeMem( addr, data, size );
        end = TxtBuff + TXT_LEN;
        p = Format( TxtBuff, "%s %A", GetCmdName( CMD_MODIFY ), addr );
        for( ; size > 0 && p < end - ( 2 + 8 ); --size ) {
            p = StrCopy( ", ", p );
            p = CnvULong( *(unsigned char *)data, p, end - p );
            data = (char *)data + 1;
        }
        RecordEvent( TxtBuff );
        DbgUpdate( UP_MEM_CHANGE );
        CollapseMachState();
    }
}
Beispiel #21
0
void ChangeMemUndoable( address addr, const void *item, unsigned size )
{
    char                *p;
    const unsigned char *it;
    char                *end;

    if( AdvMachState( ACTION_MODIFY_MEMORY ) ) {
        ChangeMem( addr, item, size );
        it = item;
        end = TxtBuff + TXT_LEN;
        p = Format( TxtBuff, "%s %A", GetCmdName( CMD_MODIFY ), addr );
        for( ; size > 0; --size ) {
            p = StrCopy( ", ", p );
            p = CnvULong( *it++, p, end - p );
        }
        RecordEvent( TxtBuff );
        DbgUpdate( UP_MEM_CHANGE );
        CollapseMachState();
    }
}
Beispiel #22
0
static void AsmSetDotAddr( a_window *wnd, address addr )
{
    mod_handle  mod;
    asm_window  *asw = WndAsm( wnd );

    if( AddrComp( asw->dotaddr, addr ) != 0 ) {
        WndRowDirty( wnd, -TITLE_SIZE );
        asw->dotaddr = addr;
        DeAliasAddrMod( addr, &mod );
        if( mod != asw->mod ) {
            DbgUpdate( UP_OPEN_CHANGE );
            asw->mod = mod;
            AsmSetTitle( wnd );
        }
        if( IS_NIL_ADDR( addr ) ) return;
        if( wnd == WndFindActive() ) {
            SrcMoveDot( asw->src, addr );
            SetCodeDot( addr );
        }
    }
}
Beispiel #23
0
void RemovePoint( brkp *bp )
{
    brkp        **owner;

    for( owner = &BrkList; ; owner = &(*owner)->next ) {
        if( ( *owner ) == bp ) {
            RecordBreakEvent( bp, B_CLEAR );
            FreeCmdList( bp->cmds );
            _Free( bp->condition );
            _Free( bp->source_line );
            _Free( bp->image_name );
            _Free( bp->mod_name );
            _Free( bp->sym_name );
            *owner = bp->next;
            DbgUpdate( UP_BREAK_CHANGE );
            FiniMappableAddr( &bp->loc );
            _Free( bp );
            break;
        }
    }
}
Beispiel #24
0
static brkp *AddPoint( address loc, mad_type_handle th, bool unmapped )
{
    brkp                *bp;
    brkp                **owner;

    if( !IS_BP_EXECUTE( th ) && !BrkCheckWatchLimit( loc, th ) )
        return( NULL );
    _Alloc( bp, sizeof( brkp ) );
    InitMappableAddr( &bp->loc );
    bp->th = th;
    bp->mad = SysConfig.mad;
    NullStatus( bp );
    bp->status.b.active = true;
    bp->source_line = NULL;
    bp->image_name = NULL;
    bp->mod_name = NULL;
    bp->sym_name = NULL;
    bp->cue_diff = 0;
    bp->status.b.unmapped = unmapped;
    SetPointAddr( bp, loc );
    bp->cmds = NULL;
    bp->status.b.use_cmds = false;
    bp->index = FindNextBPIndex();

    bp->total_hits = 0;
    bp->countdown = 0;
    bp->initial_countdown = 0;
    bp->status.b.use_countdown = false;
    bp->condition = NULL;
    bp->status.b.use_condition = false;
    bp->error = NULL;
    owner = &BrkList;
    while( *owner != NULL ) {
        owner = &((*owner)->next);
    }
    bp->next = NULL;
    *owner = bp;
    DbgUpdate( UP_BREAK_CHANGE );
    return( bp );
}
Beispiel #25
0
static void MemMod( mad_type_handle mth, mad_type_kind mas )
{
    item_mach           item;
    item_type           ops;
    address             addr;
    mad_type_info       mti;

    ops = IT_ERR | IT_INC;
    if( mas & MAS_IO ) {
        ops |= IT_IO;
        addr.mach.offset = ReqExpr();
    } else {
        addr = GetDataDot();
        OptMemAddr( EXPR_DATA, &addr );
    }
    if( CurrToken == T_COMMA )
        Scan();
    MADTypeInfo( mth, &mti );
    while( !ScanEOC() ) {
        if( !( ops & IT_IO ) ) {
            SetDataDot( addr );
        }
        if( CurrToken != T_COMMA ) {
            NormalExpr();
            ToItemMAD( ExprSP, &item, &mti );
            PopEntry();
            if( CurrToken != T_COMMA && !ScanEOC() ) {
                Error( ERR_LOC, LIT_ENG( ERR_WANT_EOC ) );
            }
            ItemPutMAD( &addr, &item, ops, mth );
        }
        if( CurrToken == T_COMMA ) {
            Scan();
        }
    }
    if( !(ops & IT_IO) ) {
        DbgUpdate( UP_MEM_CHANGE | UP_CODE_ADDR_CHANGE | UP_REG_CHANGE );
    }
}
Beispiel #26
0
unsigned ExecProg( bool tracing, bool do_flip, bool want_wps )
{
    bool                have_brk_at_ip;
    bool                act_wps;
    bool                first_time;
    mad_trace_how       how;
    execute_state       es;
    unsigned            conditions;
    unsigned            run_conditions;
    bool                already_stopping;
    bool                force_stop;

    if( !want_wps )
        ++InCall;
    tracing = TraceStart( tracing );
    WriteDbgRegs();
    first_time = true;
    es = ES_NORMAL;
    run_conditions = 0;
    if( !HaveRemoteAsync() ) {
        DUIPlayDead( true );
    }
    how = MTRH_STOP;
    for( ;; ) {
        switch( es ) {
        case ES_FORCE_BREAK:
        case ES_NORMAL:
            if( tracing ) {
                how = TraceHow( false );
            } else {
                _SwitchOn( SW_EXECUTE_LONG );
                how = MTRH_BREAK;
            }
            break;
        case ES_STEP_ONE:
            how = TraceHow( true );
            break;
        }
        if( how == MTRH_STOP )
            break;
        switch( how ) {
        case MTRH_BREAK:
            DbgUpdate( UP_CSIP_JUMPED );
            _SwitchOn( SW_TOUCH_SCREEN_BUFF );
            /* fall through */
        case MTRH_SIMULATE:
        case MTRH_STEP:
        case MTRH_STEPBREAK:
            if( _IsOff( SW_TOUCH_SCREEN_BUFF ) )
                break;
            /* fall through */
        default:
            if( !(ScrnState & USR_SCRN_ACTIVE) && do_flip ) {
                DUIStop();
            }
            _SwitchOff( SW_TOUCH_SCREEN_BUFF );
            break;
        }
        if( first_time ) {
            /* got to be down here so that SW_EXECUTE_LONG is properly set */
            SetThreadStates();
            first_time = false;
        }
        have_brk_at_ip = InsertBPs( (es == ES_FORCE_BREAK) );
        act_wps = UpdateWPs();
        if( how == MTRH_BREAK ) {
            if( have_brk_at_ip ) {
                es = ES_STEP_ONE;
                RemoveBPs();
                continue;       /* back to top */
            }
            if( act_wps && want_wps ) {
                InsertWPs();
            }
        }

        SetMemBefore( tracing );
        switch( how ) {
        case MTRH_SIMULATE:
            if( TraceSimulate() ) {
                conditions = COND_TRACE;
                break;
            }
            /* fall through */
        case MTRH_STEP:
            /* only updates stack/execution */
            conditions = DoRun( true );
            break;
        default:
            /* only updates stack/execution */
            conditions = DoRun( false  );
            break;
        }
        if( _IsOn( SW_EXECUTE_LONG ) ) {
            if( ScrnState & DBG_SCRN_ACTIVE ) {
                _SwitchOn( SW_MIGHT_HAVE_LOST_DISPLAY );
            }
            _SwitchOff( SW_EXECUTE_LONG );
        }
        SetMemAfter( tracing );
        run_conditions &= ~COND_WATCH;
        run_conditions |= conditions;

        RemoveBPs();
        if( conditions & COND_MESSAGE ) {
            if( !RecordMsgText( &conditions ) ) {
                conditions &= ~COND_MESSAGE;
            }
        }
        conditions = CheckBPs( conditions, run_conditions );
        if( _IsOn( SW_BREAK_ON_DEBUG_MESSAGE ) && ( conditions & COND_MESSAGE ) ) {
            conditions |= COND_STOP;
        }
        if( HaveRemoteAsync() && (conditions & COND_THREAD ) ) {
            conditions |= COND_STOP;
        }
        if( how == MTRH_STEPBREAK && (conditions & COND_BREAK) && DbgTmpBrk.status.b.hit ) {
            conditions &= ~COND_BREAK;
            conditions |= COND_TRACE;
        }
        if( conditions & COND_LIBRARIES ) {
            already_stopping = ( conditions & COND_STOPPERS ) != 0;
            conditions &= ~COND_LIBRARIES;
            force_stop = false;
            if( AddLibInfo( already_stopping, &force_stop ) ) {
                if( force_stop || DLLMatch() ) {
                    conditions |= COND_STOP | COND_LIBRARIES;
                }
            }
            ReMapPoints( NULL );
        }
        if( conditions & COND_SECTIONS ) {
            SectTblRead( DbgRegs );
            InvalidateTblCache();
        }
        if( (es == ES_STEP_ONE) && (conditions & COND_TRACE) ) {
            conditions &= ~COND_TRACE;
        }
        if( tracing ) {
            conditions = TraceCheck( conditions );
        }
        if( !(conditions & COND_STOPPERS) && TBreak() ) {
            conditions |= COND_USER;
            break;
        }
        if( conditions & COND_STOPPERS )
            break;
        switch( es ) {
        case ES_STEP_ONE:
            es = ES_FORCE_BREAK;
            break;
        case ES_FORCE_BREAK:
            es = ES_NORMAL;
            break;
        }
        if( (run_conditions & COND_WATCH) && es == ES_NORMAL ) {
            /*
                We got a spurious watch point indication. Make the
                next instruction single step since we might be
                dealing with a control flow opcode on a machine without
                a T-bit (e.g. Alpha).
            */
            es = ES_STEP_ONE;
        }
    }
    TraceStop( tracing );
    DUIPlayDead( false );
    SetProgState( run_conditions );
    _SwitchOff( SW_KNOW_EMULATOR );
    if( !want_wps )
        --InCall;
    return( conditions );
}
Beispiel #27
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;
}
Beispiel #28
0
void DefaultRadixSet( unsigned radix )
{
    DefRadix = radix;
    CurrRadix = radix;
    DbgUpdate( UP_RADIX_CHANGE );
}
Beispiel #29
0
void DlgSource()
{
    DlgList( LIT( New_Source ), FiniSource, AddSourceSpec,
                                NextSourceSpec, SourceName );
    DbgUpdate( UP_NEW_SRC );
}