Create fake DMC2280 controllers.
r1138 | ffr | 2006-10-13 09:06:05 +1000 (Fri, 13 Oct 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
fdd815680f
commit
572b77fac2
42
site_ansto/instrument/TEST_SICS/fakeDMC/loadConfig.tcl
Normal file
42
site_ansto/instrument/TEST_SICS/fakeDMC/loadConfig.tcl
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env tclsh
|
||||
# TODO setup loopback devices for controllers.
|
||||
|
||||
# $Revision: 1.1 $
|
||||
# $Date: 2006-10-12 23:06:05 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
# Load troubleshooting setup
|
||||
#source dmc2280_util.tcl
|
||||
|
||||
if { $argc > 0 } {
|
||||
set configFileName [lindex $argv 0]
|
||||
}
|
||||
|
||||
proc loadConfig {fName} {
|
||||
global ContList
|
||||
global IPtoContName;
|
||||
|
||||
if [info exists ContList] {unset ContList}
|
||||
# Temporarily define unknown proc to skip undefined procs
|
||||
rename ::unknown _unknown
|
||||
proc ::unknown {args} {}
|
||||
if [catch {uplevel #0 source $fName} errMsg] {
|
||||
rename ::unknown ""
|
||||
rename _unknown ::unknown
|
||||
error $errMsg
|
||||
} else {
|
||||
rename ::unknown ""
|
||||
rename _unknown ::unknown
|
||||
}
|
||||
if [catch {set ContList [uplevel #0 info vars dmc2280_controller*]} result] {error $result}
|
||||
if {[llength $ContList] == 0} {error "Error: There are no dmc2280_controllerN(host/port) arrays in the $fName configuration file"}
|
||||
#Add the controller to the sics_config namespace
|
||||
foreach c $ContList {
|
||||
upvar #0 $c cont;
|
||||
set IPtoContName($cont(host)) $c;
|
||||
puts "$c IP:port = $cont(host):$cont(port)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user