This code automatically generates the hipadaba_configuration.tcl file from the motor_configuration.tcl file in the instrument directory.
r1302 | dcl | 2006-11-21 09:16:16 +1100 (Tue, 21 Nov 2006) | 2 lines
This commit is contained in:
56
site_ansto/instrument/hipadaba/gen_hipadaba_config.tcl
Normal file
56
site_ansto/instrument/hipadaba/gen_hipadaba_config.tcl
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/tclsh
|
||||||
|
|
||||||
|
set instName [lindex $argv 0];
|
||||||
|
set infile $instName/motor_configuration.tcl
|
||||||
|
set fh [open $instName/hipadaba_configuration.tcl w]
|
||||||
|
|
||||||
|
proc publish {args} {}
|
||||||
|
|
||||||
|
if 1 {
|
||||||
|
# Use this to create an array of named parameters to initialise motors.
|
||||||
|
proc params {args} {
|
||||||
|
upvar 1 "" x;
|
||||||
|
if [info exists x] {unset x}
|
||||||
|
foreach {k v} $args {set x([string tolower $k]) $v}
|
||||||
|
}
|
||||||
|
proc setHomeandRange {args} {}
|
||||||
|
proc SplitReply { text } {}
|
||||||
|
proc setpos {motor pos} {}
|
||||||
|
} else {
|
||||||
|
source utility.tcl
|
||||||
|
}
|
||||||
|
|
||||||
|
proc Motor {name type parms} {
|
||||||
|
puts $::fh [format "%s(%s) %s %s" {makeHdbMotor $motor_hpath} $name $name $name]
|
||||||
|
uplevel #0 "proc $name {args} {}"
|
||||||
|
}
|
||||||
|
proc MakeConfigurableMotor {name} {
|
||||||
|
puts $::fh [format "%s(%s) %s %s" {makeHdbVirtMotor $motor_hpath} $name $name $name]
|
||||||
|
uplevel #0 "proc $name {args} {}"
|
||||||
|
}
|
||||||
|
|
||||||
|
puts $fh "# autogenerated from $infile"
|
||||||
|
puts $fh "# Output Date: [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"]"
|
||||||
|
puts $fh "# Source Date: [clock format [file mtime $infile] -format "%Y-%m-%d %H:%M:%S"]"
|
||||||
|
puts $fh ""
|
||||||
|
puts $fh "# Defines hashes which map motor names to arrays"
|
||||||
|
puts $fh "source hpaths.tcl"
|
||||||
|
puts $fh ""
|
||||||
|
puts $fh "# Enumerate the categories"
|
||||||
|
puts $fh {foreach hp $hpaths { hmake $hp spy none }}
|
||||||
|
puts $fh ""
|
||||||
|
puts $fh "# Enumerate the motors"
|
||||||
|
|
||||||
|
|
||||||
|
source $infile
|
||||||
|
|
||||||
|
if 0 {
|
||||||
|
foreach m $motors {
|
||||||
|
puts [format "%s(%s) %s %s" {makeHdbMotor $motor_hpath} $name $name $name]
|
||||||
|
}
|
||||||
|
foreach m $vmotors {
|
||||||
|
puts [format "%s(%s) %s %s" {makeHdbVirtMotor $motor_hpath} $name $name $name]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close $fh
|
||||||
Reference in New Issue
Block a user