ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/util.tcl
Revision: 2.2
Committed: Sun Oct 30 08:33:02 1994 UTC (29 years, 5 months ago) by greg
Content type: application/x-tcl
Branch: MAIN
Changes since 2.1: +13 -0 lines
Log Message:
added index files to speed loading of help info

File Contents

# User Rev Content
1 greg 2.1 # SCCSid "$SunId$ LBL"
2     #
3     # General utility routines
4     #
5    
6     proc beep {} { # ring the bell
7     puts -nonewline stderr "\a"
8     }
9    
10     proc view_txt fn { # view a text file
11     global env
12     if [info exists env(EDITOR)] {
13     eval exec xterm -e $env(EDITOR) $fn
14     } else {
15     foreach f $fn {
16     exec xedit $f
17     }
18     }
19     }
20    
21     proc cardval {var cvl} { # set variable to one of a set of values
22     upvar $var v
23     set tv [string toupper $v]
24     foreach cv $cvl {
25     if {[string first $tv [string toupper $cv]] == 0} {
26     set v $cv
27     return $cv
28     }
29     }
30     return {} ; # this would seem to be an error
31     }
32 greg 2.2
33     proc writevars {f vl} { # write variables to a file
34     foreach v $vl {
35     upvar $v myv
36     if [catch {set il [array names myv]}] {
37     puts $f "set $v [list $myv]"
38     } else {
39     foreach i $il {
40     puts $f "set ${v}($i) [list $myv($i)]"
41     }
42     }
43     }
44     }