-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnamespaces_list.tcl
59 lines (52 loc) · 1.68 KB
/
namespaces_list.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# namespaces_list.tcl - Originally written by Paul Healy <[email protected]>
#
# $Id$
widget namespaces_list {
object_include tkinspect_list
param title "Namespaces"
method get_item_name {} { return namespace }
method update {target} {
$self clear
foreach namespace [names::names $target] {
$self append $namespace
}
}
method retrieve {target namespace} {
set result "namespace eval $namespace {\n"
set exports [names::exports $target $namespace]
if {$exports!=""} {
append result "\n namespace export $exports\n"
}
set vars [names::vars $target $namespace]
if {$vars!=""} {
append result "\n"
}
foreach var [lsort $vars] {
append result " [names::value $target $var]"
}
set procs [lsort [names::procs $target $namespace]]
append result "\n# export:\n"
foreach proc $procs {
if {[lsearch -exact $exports [namespace tail $proc]]!=-1} {
append result " [names::prototype $target $proc]\n"
}
}
append result "\n# internal:\n"
foreach proc $procs {
if {[lsearch -exact $exports [namespace tail $proc]]==-1} {
append result " [names::prototype $target $proc]\n"
}
}
append result "}\n\n"
set children [names::names $target $namespace]
foreach child [lsort $children] {
if {$child!=$namespace} {
append result "namespace eval $child {}\n"
}
}
return $result
}
method send_filter {value} {
return $value
}
}