#!/usr/bin/tclsh # $Revision: 1.4 $ # $Date: 2006-12-07 22:26:26 $ # Author: Douglas Clowes (dcl@ansto.gov.au) # Last revision by $Author: ffr $ # Generates the hipadaba_configuration.tcl file for the # specified instrument. # Usage: from the "instrument" directory do # ./hipadaba/gen_hipadaba_config.tcl # where 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 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 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