Exemple #1
0
static bool DlgDoScan( char *str, void *value, void (*rtn)(void*) )
{
    char        *old;
    bool        ok;

    old = ReScan( str );
    _SwitchOn( SW_ERR_IN_TXTBUFF );
    FreezeStack();
    ok = ( SpawnP( rtn, value ) == 0 );
    UnFreezeStack( FALSE );
    _SwitchOff( SW_ERR_IN_TXTBUFF );
    ReScan( old );
    return( ok );
}
Exemple #2
0
static  void    VarModify( a_window *wnd, int row, int piece )
{
    var_node            *v;
    type_kind           class;
    var_window          *var = WndVar( wnd );
    bool                ok;
    bool                followable;
    unsigned            old;

    if( row < 0 ) {
        if( var->vtype == VAR_WATCH || var->vtype == VAR_VARIABLE ) {
            VarMenuItem( wnd, MENU_VAR_NEW_EXPRESSION, row, piece );
        }
        return;
    }
    VarErrState();
    VarKillExprSPCache( &var->i );
    v = VarFindRow( &var->i, row );
    if( v == NULL ) {
        v = VarFindRowNode( &var->i, row );
        if( v == NULL ) return;
        if( piece != VAR_PIECE_GADGET && piece != VAR_PIECE_NAME ) return;
        if( v->expand != NULL || v->node_type == NODE_INHERIT ) {
            VarExpandRow( &var->i, v, row );
            WndNewCurrent( wnd, row, VAR_PIECE_NAME );
            VarRepaint( wnd );
        }
        return;
    }
    followable = VarGetStackClass( &class );
    switch( piece ) {
    case VAR_PIECE_GADGET:
    case VAR_PIECE_NAME:
        if( VarExpandable( class ) || followable || v->expand != NULL ) {
            VarExpandRow( &var->i, v, row );
            WndNewCurrent( wnd, row, VAR_PIECE_NAME );
            VarRepaint( wnd );
        }
        break;
    case VAR_PIECE_VALUE:
        if( !VarExpandable( class ) ) {
            char *value = DbgAlloc( TXT_LEN );
            char *name = DbgAlloc( TXT_LEN );
            old = VarNewCurrRadix( v );
            ExprValue( ExprSP );
            VarBuildName( &var->i, v, FALSE );
            StrCopy( TxtBuff, name );
            VarPrintText( &var->i, value, PrintValue, TXT_LEN );
            VarKillExprSPCache( &var->i );
            v = VarFindRow( &var->i, row );
            FreezeStack();
            ok = DlgAnyExpr( name, value, TXT_LEN );
            UnFreezeStack( FALSE );
            if( ok ) VarDoAssign( &var->i, v, value );
            NewCurrRadix( old );
            WndRowDirty( wnd, row );
            DbgFree( value );
            DbgFree( name );
        }
        break;
    }
    VarDoneRow( &var->i );
    VarOldErrState();
}