Version 0 of inspect

Updated 2001-07-20 12:03:03

RS - Soon to come: a packlet of routines for introspecting your Tcl/Tk interpreter. Here's just a starter... (note also the documentation format used with, but not requiring, htext).

 namespace eval inspect {}

set docu(inspect::value) { This routine searches all global variables (scalar or array) for the specified value. Returns the list of variable names whose value matches. }

 proc inspect::value value {
    set res {}
    foreach i [info globals] {
        upvar #0 $i name 
        if [array exists name] {
            foreach j [array names name] {
               if [string equal $name($j)$value] {
                  lappend res ${i}($j)
               }
        } elseif [string equal $name $value] {
            lappend res $i
        }
    }
 }

LV have you ever seen tkinspect - lots of neat features relating to introspection...


Arts and crafts of Tcl-Tk programming