chiark / gitweb /
better output in tooltip
[chiark-tcl-applet.git] / utils.tcl
1
2 proc manyset {list args} {
3     foreach val $list var $args {
4         upvar 1 $var my
5         set my $val
6     }
7 }
8
9 namespace eval debug {
10
11 # Debug:
12
13 #    Caller may call
14 #       debug::setup ON-DEBUG
15 #    which will result in calls to [concat ON-DEBUG [list MESSAGE]]
16 #    (or ON-DEBUG may be "" in which case messages are discarded)
17 #
18 #    And caller may call
19 #       debug::debug MSG
20
21 variable debug {}
22
23 proc debug {m} {
24     variable debug
25     if {![llength $debug]} return
26     set ns [uplevel 1 namespace current]
27     uplevel #0 $debug [list "DEBUG $ns $m"]
28 }
29
30 proc setup {d} {
31     variable debug $d
32 }
33
34 }