Files
sics/countf.tcl
2000-02-07 10:38:55 +00:00

51 lines
1.6 KiB
Tcl

#--------------------------------------------------------------------------
# A count command for FOCUS
# All arguments are optional. The current values will be used if not
# specified
# Dr. Mark Koennecke, Juli 1997
#--------------------------------------------------------------------------
proc SplitReply { text } {
set l [split $text =]
return [lindex $l 1]
}
#--------------------------------------------------------------------------
proc count { {mode NULL } { preset NULL } } {
starttime [sicstime]
#----- deal with mode
set mode2 [string toupper $mode]
set mode3 [string trim $mode2]
set mc [string index $mode2 0]
if { [string compare $mc T] == 0 } {
hm CountMode Timer
} elseif { [string compare $mc M] == 0 } {
hm CountMode Monitor
}
#------ deal with preset
if { [string compare $preset NULL] != 0 } {
hm preset $preset
}
#------ prepare a count message
set a [hm preset]
set aa [SplitReply $a]
set b [hm CountMode]
set bb [SplitReply $b]
ClientPut [format " Starting counting in %s mode with a preset of %s" \
$bb $aa]
#------- count
# hm InitVal 0
wait 1
set ret [catch {hm countblock} msg]
#------- StoreData
storefocus update
# wait 5
if { $ret != 0 } {
error [format "Counting ended with error: %s" $msg]
}
}
#---------------- Repeat -----------------------------------------------
proc repeat { num {mode NULL} {preset NULL} } {
for { set i 0 } { $i < $num } { incr i } {
count $mode $preset
}
}