Files
sics/site_ansto/instrument/hipadaba/gen_hipadaba_config.tcl
Douglas Clowes 5df5962065 *** empty log message ***
r1362 | dcl | 2006-12-11 10:52:58 +1100 (Mon, 11 Dec 2006) | 2 lines
2012-11-15 12:55:21 +11:00

90 lines
2.9 KiB
Tcl

#!/usr/bin/tclsh
# $Revision: 1.6 $
# $Date: 2006-12-10 23:52:58 $
# Author: Douglas Clowes (dcl@ansto.gov.au)
# Last revision by $Author: dcl $
# Generates the hipadaba_configuration.tcl file for the
# specified instrument.
# Usage: from the "instrument" directory do
# ./hipadaba/gen_hipadaba_config.tcl <instdir>
# where <instdir> is the directory name of an instrument.
set instName [lindex $argv 0];
# TODO The list of configuration files should be read in from
# a file in the instrument directory.
# List of configuration files for SICS device objects.
set infileList {motor_configuration.tcl counter.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} {}"
}
proc MakeCounter {name args} {
puts $::fh [format "%s(%s) %s %s" {makeHdbCounter $counter_hpath} $name $name $name]
uplevel #0 "proc $name {args} {}"
}
puts $fh "# Autogenerated by $argv0"
puts $fh "# Date: [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"]"
puts $fh ""
puts $fh "# This file serves a dual purpose: "
puts $fh "# 1. At deployment time the gen_hpdbxml.tcl script creates the"
puts $fh "# instrument description XML file (InstXML.xml) using the"
puts $fh "# versions of the hmake and makeHdb<device> commands"
puts $fh "# implemented in the hpdbxml.tcl script."
puts $fh "# 2. At runtime, when SICS is launched, the gen_hipadaba.tcl script"
puts $fh "# will create the hipadaba paths and scripts by using the"
puts $fh "# versions of the makeHdb<device> commands implemented in the"
puts $fh "# hipadaba_support.tcl script."
puts $fh ""
puts $fh "# Defines hashes which map SICS device object names to hipadaba paths"
puts $fh "source hpaths.tcl"
puts $fh ""
puts $fh "# Generate hipadaba nodes for the paths in the hpaths file"
puts $fh {foreach hp $hpaths { hmake $hp spy none }}
puts $fh ""
foreach infile $infileList {
puts $fh ""
puts $fh ""
puts $fh "# autogenerated from $instName/$infile"
puts $fh "# Source Date: [clock format [file mtime $instName/$infile] -format "%Y-%m-%d %H:%M:%S"]"
source $instName/$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