From: Jeff Hobbs Date: Thu, 24 Jan 2002 19:44:53 +0000 (+0000) Subject: * docs/procs.html: X-Git-Tag: tkcon-2-4~31 X-Git-Url: http://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=a294c105141bff1298f18f4f0e83f079be2bb411;p=tkcon * 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. --- diff --git a/ChangeLog b/ChangeLog index 305430c..11e044a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-01-23 Jeff Hobbs + + * 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 * tkcon.tcl (ExpandPathname): use a safer regsub to first unescape diff --git a/docs/procs.html b/docs/procs.html index 23bd641..f55d6d2 100755 --- a/docs/procs.html +++ b/docs/procs.html @@ -139,8 +139,8 @@ added when -package is true.
The what command will identify the word given in string 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 -dump and which. +array variable, scalar variable, directory, file, widget, and executable. +Used by procedures dump and which.
which command
Like the 'which' command of Unix shells, this will tell you if a diff --git a/tkcon.tcl b/tkcon.tcl index 9b014f4..f5553be 100755 --- a/tkcon.tcl +++ b/tkcon.tcl @@ -3640,7 +3640,7 @@ proc observe_var {name el op} { ## 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 {} @@ -3650,7 +3650,7 @@ proc which cmd { 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 @@ -3693,7 +3693,12 @@ proc what {str {autoload 0}} { } } 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"