+2002-01-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * docs/procs.html:
+ * tkcon.tcl (what): changed to differentiate between 'array' and
+ 'scalar' instead of just returning 'variable'.
+ (which): called what in uplevel to get scope right.
+
2002-01-22 Jeff Hobbs <jeffh@ActiveState.com>
* tkcon.tcl (ExpandPathname): use a safer regsub to first unescape
<DD> The <CODE>what</CODE> command will identify the word given in
<i>string</i> in the Tcl environment and return a list of types that
it was recognized as. Possible types are: alias, procedure, command,
-variable, directory, file, widget, and executable. Used by procedures
-<CODE>dump</CODE> and <CODE>which</CODE>.
+array variable, scalar variable, directory, file, widget, and executable.
+Used by procedures <CODE>dump</CODE> and <CODE>which</CODE>.
<DT> <B>which</B> <i>command</i>
<DD> Like the 'which' command of Unix shells, this will tell you if a
##
proc which cmd {
## This tries to auto-load a command if not recognized
- set types [what $cmd 1]
+ set types [uplevel 1 [list what $cmd 1]]
if {[llength $types]} {
set out {}
procedure { set res "$cmd: procedure" }
command { set res "$cmd: internal command" }
executable { lappend out [auto_execok $cmd] }
- variable { lappend out "$cmd: variable" }
+ variable { lappend out "$cmd: $type" }
}
if {[info exists res]} {
global auto_index
}
}
if {[llength [uplevel 1 info vars $str]]} {
- lappend types "variable"
+ upvar 1 $str var
+ if {[array exists var]} {
+ lappend types array variable
+ } else {
+ lappend types scalar variable
+ }
}
if {[file isdirectory $str]} {
lappend types "directory"