|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# inc.tcl: a file that is "included" by many of my scripts.
# The usual line used to include this is:
# source $env(HOME)/TCL/inc.tcl ;# (find-angg "TCL/inc.tcl")
proc readfile {fname} {
set f [open $fname r]; set s [read $f]; close $f
return $s
}
proc writefile {fname s} {
set f [open $fname w]; puts -nonewline $f $s; close $f
}
proc ord {c} { scan $c %c n; return $n }
proc char {n} { format %c $n }
proc ?= {varname args} {
global env $varname
set $varname [
expr {[info exists env($varname)] ? $env($varname) : [join $args]}
]
}
proc putstr {str} {
puts -nonewline $str
flush stdout
}