Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Changeset 37758 for trunk/base/src

Show
Ignore:
Timestamp:
06/21/08 18:47:12 (5 months ago)
Author:
raimue@…
Message:

port/port.tcl:

  • Rename cmd_args_array to cmd_opts_array, as this name is more appropriate
  • Fix a possible issue with the restructured array in proc action_get_usage
Files:
1 modified

Legend:

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

    r37757 r37758  
    11941194 
    11951195proc action_get_usage { action } { 
    1196     global action_array cmd_args_array 
     1196    global action_array cmd_opts_array 
    11971197 
    11981198    if {[info exists action_array($action)]} { 
    11991199        set cmds "" 
    1200         if {[info exists cmd_args_array($action)]} { 
    1201             foreach cmd $cmd_args_array($action) { 
    1202                 set name [lindex $cmd 0] 
    1203                 set argc [lindex $cmd 1] 
     1200        if {[info exists cmd_opts_array($action)]} { 
     1201            foreach opt $cmd_opts_array($action) { 
     1202                if {[llength $opt] == 1} { 
     1203                    set name $opt 
     1204                    set optc 0 
     1205                } else { 
     1206                    set name [lindex $opt 0] 
     1207                    set optc [lindex $opt 1] 
     1208                } 
    12041209 
    12051210                append cmds " --$name" 
    12061211 
    1207                 for {set i 1} {$i <= $argc} {incr i} { 
     1212                for {set i 1} {$i <= $optc} {incr i} { 
    12081213                    append cmds " <arg$i>" 
    12091214                } 
     
    26252630} 
    26262631 
    2627 # cmd_args_array specifies which arguments the commands accept 
     2632# cmd_opts_array specifies which arguments the commands accept 
    26282633# Commands not listed here do not accept any arguments 
    26292634# Syntax if {option argn} 
    26302635# Where option is the name of the option and argn specifies how many arguments 
    26312636# this argument takes 
    2632 global cmd_args_array 
    2633 array set cmd_args_array { 
     2637global cmd_opts_array 
     2638array set cmd_opts_array { 
    26342639    edit        {{editor 1}} 
    26352640    ed          {{editor 1}} 
     
    26542659#                  this option 
    26552660proc cmd_option_exists { action option {upoptargc ""}} { 
    2656     global cmd_args_array 
     2661    global cmd_opts_array 
    26572662    upvar 1 $upoptargc optargc 
    26582663 
     
    26602665    # but that's only available as of Tcl 8.5 
    26612666 
    2662     if {![info exists cmd_args_array($action)]} { 
     2667    if {![info exists cmd_opts_array($action)]} { 
    26632668        return 0 
    26642669    } 
    26652670 
    2666     foreach item $cmd_args_array($action) { 
     2671    foreach item $cmd_opts_array($action) { 
    26672672        if {[llength $item] == 1} { 
    26682673            set name $item 
     
    26932698    upvar $ui_options_name ui_options 
    26942699    upvar $global_options_name global_options 
    2695     global cmdname cmd_args_array 
     2700    global cmdname cmd_opts_array 
    26962701     
    26972702    while {[moreargs]} {