Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Changeset 37251 for trunk/base/src

Show
Ignore:
Timestamp:
05/31/08 21:52:50 (6 months ago)
Author:
raimue@…
Message:

port/port.tcl:
Remove hardcoded values and use action_args_const instead

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r37249 r37251  
    25032503# expects text arguments or wants an expanded list of ports 
    25042504# Return value: 
    2505 #   0   Does not expect any text argument 
    2506 #   1   Expects some strings as text argument 
    2507 #   2   Wants an expanded list of ports as text argument 
     2505#   0 none        Does not expect any text argument 
     2506#   1 strings     Expects some strings as text argument 
     2507#   2 ports       Wants an expanded list of ports as text argument 
     2508# Use action_args_const to translate them 
    25082509proc action_needs_portlist { action } { 
    25092510    global action_array 
     
    25142515    } 
    25152516 
    2516     return [expr $ret > 2 ? 2 : $ret] 
     2517    return $ret 
    25172518} 
    25182519 
     
    27502751        } 
    27512752 
    2752         # Does the port need text arguments? 
     2753        # What kind of arguments does the command expect? 
    27532754        set expand [action_needs_portlist $action] 
    27542755 
     
    27632764            } 
    27642765            default { 
    2765                 switch -- $expand { 
    2766                     0 { 
    2767                         ui_error "$action does not accept string arguments" 
     2766                if {[action_args_const none] == $expand} { 
     2767                    ui_error "$action does not accept string arguments" 
     2768                    set action_status 1 
     2769                    break 
     2770                } elseif {[action_args_const strings] == $expand} { 
     2771                    while { [moreargs] && ![match ";"] } { 
     2772                        lappend portlist [lookahead] 
     2773                        advance 
     2774                    } 
     2775                } elseif {[action_args_const ports] == $expand} { 
     2776                    # Parse port specifications into portlist 
     2777                    if {![portExpr portlist]} { 
     2778                        ui_error "Improper expression syntax while processing parameters" 
    27682779                        set action_status 1 
    27692780                        break 
    2770                     } 
    2771                     1 { 
    2772                         while { [moreargs] && ![match ";"] } { 
    2773                             lappend portlist [lookahead] 
    2774                             advance 
    2775                         } 
    2776                     } 
    2777                     2 { 
    2778                         # Parse port specifications into portlist 
    2779                         if {![portExpr portlist]} { 
    2780                             ui_error "Improper expression syntax while processing parameters" 
    2781                             set action_status 1 
    2782                             break 
    2783                         } 
    27842781                    } 
    27852782                }