-
Notifications
You must be signed in to change notification settings - Fork 0
/
d.sh
executable file
·102 lines (93 loc) · 1.98 KB
/
d.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#
# Write out list of default widget options
#
defscript1() {
cat >/tmp/d$$.tcl <<'EOD'
set count 0
foreach c [lsort -ascii [info commands]] {
if {$c == "puts" || $c == "vwait"} {
continue
}
if {[catch {$c .w$count} tmp]} {
continue
}
if {"$tmp" != ".w$count"} {
continue
}
if {[catch {.w$count configure} clist]} {
incr count
continue
}
puts stderr [format "\n\t\t\t%s\n" $c]
foreach i [lsort -ascii $clist] {
if {[llength $i] > 2} {
puts stderr [format "%-35s\t%s" [lindex $i 0] [lindex $i 3]]
}
}
incr count
}
exit 0
EOD
echo /tmp/d$$.tcl
}
#
# Write out list of class bindings
#
defscript2() {
cat >/tmp/d$$.tcl <<'EOD'
proc all w { return $w }
set count 0
foreach c [lsort -ascii [info commands]] {
if {$c == "puts" || $c == "vwait"} {
continue
}
if {[catch {$c .w$count} tmp]} {
continue
}
if {"$tmp" != ".w$count"} {
continue
}
set class $c
if {$class != "all" && [catch {winfo class .w$count} class]} {
incr count
continue
}
puts stderr [format "\n\t\t\t%s\n" $class]
set out ""
set icnt 0
foreach i [lsort -ascii [bind $class]] {
append out [format "%-19.19s" $i]
incr icnt
if {$icnt % 4 == 0} {
append out "\n"
} else {
append out " "
}
}
if {$out == ""} {
set out "*** no events bound to class ***"
}
puts stderr [string trimright $out "\n"]
incr count
}
exit 0
EOD
echo /tmp/d$$.tcl
}
SCRIPT=`defscript1`
rm -f def.list
exec 2>def.list
echo "Terminals w/ color" >&2
echo "------------------" >&2
TERM=color_xterm ./cwsh $SCRIPT
echo -e "\f" >&2
echo "Terminals w/o color" >&2
echo "-------------------" >&2
TERM=vt100 ./cwsh $SCRIPT
rm -f $SCRIPT
SCRIPT=`defscript2`
echo -e "\f" >&2
echo "Events bound to classes" >&2
echo "-----------------------" >&2
TERM=vt100 ./cwsh $SCRIPT
rm -f $SCRIPT