Exemplo n.º 1
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 );
}
Exemplo n.º 2
0
static void     CallMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    call_chain  *chain;
    call_window *call = WndCall( wnd );

    piece=piece;

    chain = GetCallChain( &call->tb, row );
    switch( id ) {
    case MENU_INITIALIZE:
        if( chain == NULL ) {
            WndMenuGrayAll( wnd );
        } else {
            WndMenuEnableAll( wnd );
            WndMenuEnable( wnd, MENU_CALL_EXECUTE_TO_RETURN, ( row != 0 ) );
            WndMenuEnable( wnd, MENU_CALL_SOURCE, ( chain->source_line != NULL ) );
        }
        break;
    case MENU_CALL_BREAK:
        DlgBreak( row == 0 ? chain->lc.execution : FindNextIns( chain->lc.execution ) );
        break;
    case MENU_CALL_SOURCE:
        WndSrcInspect( chain->lc.execution );
        break;
    case MENU_CALL_UNWIND:
        UnWindToFrame( chain, row, CallNumRows( wnd ) );
        break;
    case MENU_CALL_ASSEMBLY:
        WndAsmInspect( chain->lc.execution );
        break;
    case MENU_CALL_EXECUTE_TO_RETURN:
        GoToAddr( FindNextIns( chain->lc.execution ) );
        break;
    }
}
Exemplo n.º 3
0
extern void     GlobMenuItem( a_window *wnd, unsigned id, int row, int piece )
{
    glob_window *glob = WndGlob( wnd );
    address     addr;
    char        buff[TXT_LEN];

    piece=piece;
    addr = NameListAddr( NameList( glob ), row );
    switch( id ) {
    case MENU_INITIALIZE:
        if( IS_NIL_ADDR( addr ) ) {
            WndMenuGrayAll( wnd );
        } else {
            WndMenuEnableAll( wnd );
        }
        WndMenuEnable( wnd, MENU_GLOB_D2_ONLY, TRUE );
        WndMenuCheck( wnd, MENU_GLOB_D2_ONLY, glob->d2_only );
        break;
    case MENU_GLOB_INSPECT_MEMORY:
        WndAddrInspect( addr );
        break;
    case MENU_GLOB_WATCH:
        NameListName( NameList( glob ), row, buff, SN_QUALIFIED );
        WndVarInspect( buff );
        break;
    case MENU_GLOB_D2_ONLY:
        glob->d2_only = !glob->d2_only;
        GlobInit( wnd );
        break;
    default:
        break;
    }
}
Exemplo n.º 4
0
static void     FuncMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    address     addr;
    func_window *func = WndFunc( wnd );

    piece=piece;
    addr = ( row == WND_NO_ROW ) ? NilAddr : NameListAddr( NameList( func ), row );
    switch( id ) {
    case MENU_INITIALIZE:
        if( IS_NIL_ADDR( addr ) ) {
            WndMenuGrayAll( wnd );
        } else {
            WndMenuEnableAll( wnd );
            WndMenuEnable( wnd, MENU_FUNCTIONS_SOURCE, HasLineInfo( addr ) );
        }
        WndMenuEnable( wnd, MENU_FUNCTIONS_D2_ONLY, TRUE );
        WndMenuCheck( wnd, MENU_FUNCTIONS_D2_ONLY, func->d2_only );
        break;
    case MENU_FUNCTIONS_SOURCE:
        WndSrcInspect( addr );
        break;
    case MENU_FUNCTIONS_ASSEMBLY:
        WndAsmInspect( addr );
        break;
    case MENU_FUNCTIONS_BREAK:
        DlgBreak( addr );
        break;
    case MENU_FUNCTIONS_D2_ONLY:
        func->d2_only = !func->d2_only;
        FuncNewOptions( wnd );
        break;
    }
}
Exemplo n.º 5
0
static void RepMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    event_record        *ev;

    ev = RepGetEvent( row );
    wnd=wnd;piece=piece;
    switch( id ) {
    case MENU_INITIALIZE:
        WndMenuGrayAll( wnd );
        if( ev != NULL ) {
            WndMenuEnable( wnd, MENU_REPLAY_GOTO, true );
            if( !IS_NIL_ADDR( ev->ip ) ) {
                WndMenuEnable( wnd, MENU_REPLAY_SOURCE, true );
                WndMenuEnable( wnd, MENU_REPLAY_ASSEMBLY, true );
            }
        }
        break;
    case MENU_REPLAY_SOURCE:
        WndSrcInspect( ev->ip );
        break;
    case MENU_REPLAY_ASSEMBLY:
        WndAsmInspect( ev->ip );
        break;
    case MENU_REPLAY_GOTO:
        ReplayTo( ev );
        break;
    }
}
Exemplo n.º 6
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 );
}
Exemplo n.º 7
0
static void     ModMenuItem( a_window *wnd, unsigned id, int row, int piece )
{
    address     addr;
    mod_handle  handle;
    mod_window  *mod = WndMod( wnd );

    piece=piece;

    handle = NO_MOD;
    addr = NilAddr;
    if( ModListNumRows( ModList( mod ) ) != 0 && row >= 0 ) {
        handle =  ModListMod( ModList( mod ), row );
        if( handle != NO_MOD ) {
            addr = ModFirstAddr( handle );
        }
    }
    switch( id ) {
    case MENU_INITIALIZE:
        WndMenuGrayAll( wnd );
        if( handle != NO_MOD ) {
            WndMenuEnable( wnd, MENU_MODULES_BREAK_SET_ALL, TRUE );
            WndMenuEnable( wnd, MENU_MODULES_BREAK_CLEAR_ALL, TRUE );
            WndMenuEnable( wnd, MENU_MODULES_ASSEMBLY, !IS_NIL_ADDR( addr ) );
            WndMenuEnable( wnd, MENU_MODULES_FUNCTIONS, TRUE );
            if( ModHasSourceInfo( handle ) ) {
                WndMenuEnable( wnd, MENU_MODULES_SOURCE, TRUE );
            }
        }
        WndMenuEnable( wnd, MENU_MODULES_SHOW_ALL, TRUE );
        WndMenuCheck( wnd, MENU_MODULES_SHOW_ALL, mod->all_modules );
        break;
    case MENU_MODULES_BREAK_SET_ALL:
        BreakAllModEntries( handle );
        break;
    case MENU_MODULES_BREAK_CLEAR_ALL:
        ClearAllModBreaks( handle );
        break;
    case MENU_MODULES_SOURCE:
        if( IS_NIL_ADDR( addr ) ) {
            ModName( handle, TxtBuff, TXT_LEN );
            WndFileInspect( TxtBuff, FALSE );
        } else {
            WndSrcInspect( addr );
        }
        break;
    case MENU_MODULES_ASSEMBLY:
        WndAsmInspect( addr );
        break;
    case MENU_MODULES_FUNCTIONS:
        WndFuncInspect( handle );
        break;
    case MENU_MODULES_SHOW_ALL:
        mod->all_modules = !mod->all_modules;
        ModInit( wnd );
        break;
    }
}
Exemplo n.º 8
0
static void     ImgMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    image_entry *img;
    char        *new_name;
    char        *old_name;

    piece=piece;
    img = ImgGetImage( row );
    switch( id ) {
    case MENU_INITIALIZE:
        WndMenuGrayAll( wnd );
        if( img != NULL ) {
            if( img->dip_handle == NO_MOD ) {
                WndMenuEnable( wnd, MENU_IMAGE_ADD_SYMBOLS, TRUE );
            } else {
                WndMenuEnableAll( wnd );
            }
        }
        break;
    case MENU_IMAGE_ADD_SYMBOLS:
        // nyi - change sym_file
        if( img->deferred_symbols ) {
            ReLoadSymInfo( img );
        } else {
            new_name = DupStr( ImgSymName( img, TRUE ) );
            if( !SymBrowse( &new_name ) ) {
                _Free( new_name );
            } else {
                UnLoadSymInfo( img, TRUE );
                old_name = img->sym_name;
                img->sym_name = new_name;
                if( ReLoadSymInfo( img ) ) {
                    _Free( old_name );
                } else {
                    img->sym_name = old_name;
                    _Free( new_name );
                }
            }
        }
        ImgInit( wnd );
        break;
    case MENU_IMAGE_DEL_SYMBOLS:
        UnLoadSymInfo( img, TRUE );
        ImgInit( wnd );
        break;
    case MENU_IMAGE_SHOW_FUNCTIONS:
        WndGblFuncInspect( img->dip_handle );
        break;
    case MENU_IMAGE_SHOW_MODULES:
        WndModListInspect( img->dip_handle );
        break;
    case MENU_IMAGE_SHOW_GLOBALS:
        WndGblVarInspect( img->dip_handle );
        break;
    }
}
Exemplo n.º 9
0
static void     BrkMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    brkp        *bp;

    piece=piece;
    if( row < 0 ) {
        bp = NULL;
    } else {
        bp = BrkGetBP( row );
    }
    switch( id ) {
    case MENU_INITIALIZE:
        if( bp != NULL ) {
            WndMenuEnableAll( wnd );
            WndMenuEnable( wnd, MENU_BREAK_ENABLE, !bp->status.b.active );
            WndMenuEnable( wnd, MENU_BREAK_DISABLE, bp->status.b.active );
            WndMenuEnable( wnd, MENU_BREAK_SOURCE, bp != NULL && IS_BP_EXECUTE( bp->th ) );
            WndMenuEnable( wnd, MENU_BREAK_ASSEMBLY, bp != NULL && IS_BP_EXECUTE( bp->th ) );
        } else {
            WndMenuGrayAll( wnd );
        }
        WndMenuEnable( wnd, MENU_BREAK_CREATE_NEW, true );
        break;
    case MENU_BREAK_ENABLE:
        ActPoint( bp, true );
        break;
    case MENU_BREAK_DISABLE:
        ActPoint( bp, false );
        break;
    case MENU_BREAK_CREATE_NEW:
        if( DlgBreak( NilAddr ) )
            WndScrollBottom( wnd );
        break;
    case MENU_BREAK_CLEAR:
        RemoveBreak( bp->loc.addr );
        break;
    case MENU_BREAK_MODIFY:
        DlgBreak( bp->loc.addr );
        break;
    case MENU_BREAK_SOURCE:
        WndSrcInspect( bp->loc.addr );
        break;
    case MENU_BREAK_ASSEMBLY:
        WndAsmInspect( bp->loc.addr );
        break;
    }
}
Exemplo n.º 10
0
extern void     W4MenuItem( a_window *wnd, unsigned id, int row, int piece )
{

    row=row;piece=piece;
    switch( id ) {
    case MENU_INITIALIZE:
        WndMenuGrayAll( wnd );
        if( row < 0 ) break;
        WndMenuEnableAll( wnd );
        break;
    case MENU_W2_SAY:
        Say2( "Say", WndPopItem( wnd ) );
        break;
    case MENU_W2_OPEN1:
        W1Open();
        break;
    case MENU_W2_TOP:
        WndScrollAbs( wnd, 0 );
        break;
    }
}
Exemplo n.º 11
0
static void VarInitPopup( a_window *wnd, var_window *var, var_node *v )
{
    type_kind           class;
    bool                pointer;
    bool                noedit;

    WndMenuGrayAll( wnd );
    WndMenuEnable( wnd, MENU_VAR_OPTIONS, TRUE );
    WndMenuEnable( wnd, MENU_VAR_CLASS, TRUE );
    WndMenuEnable( wnd, MENU_VAR_TYPE, TRUE );
    WndMenuEnable( wnd, MENU_VAR_SHOW_MEMBER, TRUE );
    WndMenuEnable( wnd, MENU_VAR_SHOW_WHOLE_EXPR, TRUE );
    noedit = ( var->vtype == VAR_LOCALS || var->vtype == VAR_FILESCOPE );
    WndMenuIgnore( wnd, MENU_VAR_EDIT_EXPRESSION, noedit );
    WndMenuIgnore( wnd, MENU_VAR_NEW_EXPRESSION, noedit );
    WndMenuIgnore( wnd, MENU_VAR_DELETE, noedit );
    if( !noedit ) {
        WndMenuEnable( wnd, MENU_VAR_EDIT_EXPRESSION, v != NULL && v->parent == NULL );
        WndMenuEnable( wnd, MENU_VAR_NEW_EXPRESSION, TRUE );
        WndMenuEnable( wnd, MENU_VAR_DELETE, v != NULL && v->parent == NULL );
    }
    WndMenuEnable( wnd, MENU_VAR_WATCH, v != NULL );
    WndMenuEnable( wnd, MENU_VAR_INSPECT, v != NULL );

    if( v != NULL && !VarError ) {
        VarGetStackClass( &class );
        pointer = VarIsPointer( class );
        WndMenuEnable( wnd, MENU_VAR_TYPE, TRUE );
        WndMenuEnable( wnd, MENU_VAR_SHOW, TRUE );
        WndMenuEnable( wnd, MENU_VAR_CLASS, TRUE );
        WndMenuEnable( wnd, MENU_VAR_OPTIONS, TRUE );
//      WndMenuEnable( wnd, MENU_VAR_SHOW_ROOT, v->parent != NULL );
        WndMenuEnable( wnd, MENU_VAR_ARRAY_EXPAND, pointer && v->expand == NULL );
        WndMenuEnable( wnd, MENU_VAR_INSPECT_POINTER, pointer );
        WndMenuEnable( wnd, MENU_VAR_INSPECT_CODE, pointer );
        WndMenuEnable( wnd, MENU_VAR_FIELD_TOP, v->node_type == NODE_FIELD );
        WndMenuEnable( wnd, MENU_VAR_INSPECT_MEMORY, VarIsLValue() );
        WndMenuEnable( wnd, MENU_VAR_WATCH, TRUE );
        WndMenuEnable( wnd, MENU_VAR_INSPECT, TRUE );
#ifdef I_EVER_SOLVE_THE_THORNY_HIDE_PROBLEM
        WndMenuEnable( wnd, MENU_VAR_HIDE, v->node_type == NODE_FIELD );
        WndMenuEnable( wnd, MENU_VAR_UNHIDE, v->expand != NULL );
#endif
        WndMenuEnable( wnd, MENU_VAR_SHOW_TYPE, TRUE );

        WndMenuEnable( wnd, MENU_VAR_POINTER, pointer );
        WndMenuEnable( wnd, MENU_VAR_STRING, pointer );
        if( v->expand == NULL ) {
            if( !VarExpandable( class ) ) {
                WndMenuEnable( wnd, MENU_VAR_MODIFY, TRUE );
                WndMenuEnable( wnd, MENU_VAR_BREAK, TRUE );
                WndMenuEnable( wnd, MENU_VAR_ALLHEX, VarParentIsArray( v ) );
                WndMenuEnable( wnd, MENU_VAR_ALLDECIMAL, VarParentIsArray( v ) );
                WndMenuEnable( wnd, MENU_VAR_HEX, !pointer );
                WndMenuEnable( wnd, MENU_VAR_DECIMAL, !pointer );
                WndMenuEnable( wnd, MENU_VAR_CHAR, !pointer );
            } 
        }
        /* Enable even if already expanded */
        if( VarExpandable( class ) ) {
            WndMenuEnable( wnd, MENU_VAR_EXPAND_ALL, TRUE );
        }
        if( VarDisplayIsStruct( v ) ) {
            WndMenuEnable( wnd, MENU_VAR_SHOW_CODE, TRUE );
            WndMenuEnable( wnd, MENU_VAR_SHOW_INHERIT, TRUE );
            WndMenuEnable( wnd, MENU_VAR_SHOW_COMPILER, TRUE );
            WndMenuEnable( wnd, MENU_VAR_SHOW_PRIVATE, TRUE );
            WndMenuEnable( wnd, MENU_VAR_SHOW_PROTECTED, TRUE );
            WndMenuEnable( wnd, MENU_VAR_SHOW_STATIC, TRUE );
            WndMenuCheck( wnd, MENU_VAR_SHOW_CODE, !VarDisplayIsHidden( v, VARNODE_CODE ) );
            WndMenuCheck( wnd, MENU_VAR_SHOW_INHERIT, !VarDisplayIsHidden( v, VARNODE_INHERIT ) );
            WndMenuCheck( wnd, MENU_VAR_SHOW_COMPILER, !VarDisplayIsHidden( v, VARNODE_COMPILER ) );
            WndMenuCheck( wnd, MENU_VAR_SHOW_PRIVATE, !VarDisplayIsHidden( v, VARNODE_PRIVATE ) );
            WndMenuCheck( wnd, MENU_VAR_SHOW_PROTECTED, !VarDisplayIsHidden( v, VARNODE_PROTECTED ) );
            WndMenuCheck( wnd, MENU_VAR_SHOW_STATIC, !VarDisplayIsHidden( v, VARNODE_STATIC ) );
        }
    }
Exemplo n.º 12
0
STATIC void sampleMenuItem( a_window * wnd, gui_ctl_id id, int row, int piece )
/*****************************************************************************/
{
    sio_data *      curr_sio;
    int             sort_type;

    piece=piece;
    curr_sio = WndExtra( wnd );
    row += STATUS_ROW + 1;
    switch( id ) {
    case MENU_INITIALIZE:
        if( row <= STATUS_ROW ) {
            WndMenuGrayAll( wnd );
            if( row < 0 || row-1 >= curr_sio->level_open ) break;
            WndMenuEnable( wnd, MENU_SAMP_ZOOM_IN, true );
            break;
        }
        WndMenuEnableAll( wnd );
        WndMenuCheck( wnd, MENU_SAMP_GATHER, GetCurrentGather( curr_sio ) );
        WndMenuCheck( wnd, MENU_SAMP_BAR_MAX_TIME, GetCurrentMaxBar( curr_sio ) );
        WndMenuCheck( wnd, MENU_SAMP_ABS, GetCurrentAbsBar( curr_sio ) );
        WndMenuCheck( wnd, MENU_SAMP_REL, GetCurrentRelBar( curr_sio ) );
        sort_type = GetCurrentSort( curr_sio );
        WndMenuCheck( wnd, MENU_SORT_COUNT, sort_type==SORT_COUNT );
        WndMenuCheck( wnd, MENU_SORT_NAME, sort_type==SORT_NAME );
        if( row <= STATUS_ROW || curr_sio->level_open >= LEVEL_ROUTINE ) {
            WndMenuEnable( wnd, MENU_SAMP_GATHER, false );
            WndMenuEnable( wnd, MENU_SAMP_SORT, false );
            WndMenuEnable( wnd, MENU_SORT_COUNT, false );
            WndMenuEnable( wnd, MENU_SORT_NAME, false );
            if( row <= STATUS_ROW ) {
                WndMenuEnable( wnd, MENU_SAMP_BAR_MAX_TIME, false );
                WndMenuEnable( wnd, MENU_SAMP_ABS, false );
                WndMenuEnable( wnd, MENU_SAMP_REL, false );
            }
        }
        break;
    case MENU_SAMP_ZOOM_IN:
        WPZoomIn( wnd, row );
        break;
    case MENU_SAMP_BACK_OUT:
        WPBackOut( wnd );
        break;
//    case MENU_SAMP_DATA:
//        WPSImageOpen( curr_sio );
//        break;
    case MENU_SAMP_GATHER:
        FlipCurrentGather( curr_sio );
        WndMenuCheck( wnd, MENU_SAMP_GATHER, GetCurrentGather( curr_sio ) );
        gatherSort( curr_sio );
        setDisplay( wnd, curr_sio, true );
        break;
    case MENU_SAMP_BAR_MAX_TIME:
        FlipCurrentMaxBar( curr_sio );
        WndMenuCheck( wnd, MENU_SAMP_BAR_MAX_TIME, GetCurrentMaxBar( curr_sio ) );
        setDisplay( wnd, curr_sio, false );
        break;
    case MENU_SAMP_ABS:
        FlipCurrentAbsBar( curr_sio );
        WndMenuCheck( wnd, MENU_SAMP_ABS, GetCurrentAbsBar( curr_sio ) );
        setDisplay( wnd, curr_sio, false );
        break;
    case MENU_SAMP_REL:
        FlipCurrentRelBar( curr_sio );
        WndMenuCheck( wnd, MENU_SAMP_ABS, GetCurrentRelBar( curr_sio ) );
        setDisplay( wnd, curr_sio, false );
        break;
    case MENU_SORT_COUNT:
    case MENU_SORT_NAME:
        WndMenuCheck( wnd, MENU_SORT_COUNT, ( id == MENU_SORT_COUNT ) );
        WndMenuCheck( wnd, MENU_SORT_NAME, ( id == MENU_SORT_COUNT ) );
        if( id == MENU_SORT_COUNT ) {
            SetCurrentSort( curr_sio, SORT_COUNT );
        } else {
            SetCurrentSort( curr_sio, SORT_NAME );
        }
        SortCurrent( curr_sio );
        setDisplay( wnd, curr_sio, true );
        break;
    }
}
Exemplo n.º 13
0
OVL_EXTERN void     IOMenuItem( a_window wnd, gui_ctl_id id, wnd_row row, wnd_piece piece )
{
    io_window   *io = WndIO( wnd );
    address     addr;
    bool        ok;
    item_mach   item;
    io_location *curr;
    mad_radix   old_radix;

    /* unused parameters */ (void)piece;

    if( row < io->num_rows && row >= 0 ) {
        curr = &io->list[row];
    } else {
        curr = NULL;
    }
    switch( id ) {
    case MENU_INITIALIZE:
        if( curr == NULL ) {
            WndMenuGrayAll( wnd );
        } else {
            WndMenuEnableAll( wnd );
        }
        WndMenuEnable( wnd, MENU_IO_NEW_ADDRESS, true );
        break;
    case MENU_IO_DELETE:
        io->num_rows--;
        memcpy( &io->list[row], &io->list[row + 1],
                ( io->num_rows - row ) * sizeof( io_location ) );
        WndNoSelect( wnd );
        WndSetRepaint( wnd );
        break;
    case MENU_IO_NEW_ADDRESS:
        addr = NilAddr;
        if( !DlgGivenAddr( LIT_DUI( New_Port_Addr ), &addr ) )
            return;
        WndRowDirty( wnd, io->num_rows );
        IOAddNewAddr( wnd, &addr, MENU_IO_FIRST_TYPE );
        WndScrollBottom( wnd );
        break;
    case MENU_IO_MODIFY:
        if( row >= io->num_rows || row < 0 )
            break;
        if( piece == PIECE_VALUE ) {
            old_radix = NewCurrRadix( IOData.info[curr->type].piece_radix );
            item.ud = curr->value_known ? curr->value.ud : 0;
            ok = DlgMadTypeExpr( TxtBuff, &item, IOData.info[curr->type].mth );
            if( ok ) {
                curr->value = item;
                curr->value_known = true;
            }
            NewCurrRadix( old_radix );
        } else {
            addr = curr->addr;
            if( !DlgGivenAddr( LIT_DUI( New_Port_Addr ), &addr ) )
                return;
            curr->addr = addr;
            curr->value_known = false;
        }
        WndRowDirty( wnd, row );
        break;
    case MENU_IO_READ:
        curr->value_known = true;
        if( ItemGetMAD( &curr->addr, &curr->value, IT_IO, IOData.info[curr->type].mth ) == IT_NIL ) {
            curr->value_known = false;
        }
        WndPieceDirty( wnd, row, PIECE_VALUE );
        break;
    case MENU_IO_WRITE:
        if( curr->value_known ) {
            ItemPutMAD( &curr->addr, &curr->value, IT_IO, IOData.info[curr->type].mth );
        }
        break;
    default:
        curr->type = PIECE_TYPE( id );
        WndZapped( wnd );
        break;
    }
}