#!/usr/bin/tclsh #----------------------------------------------------------------------- # This script analyzes a given instrument. It connects to a running # SICS server and queries it. From the query, a list of objects and # drivables is output into a file in a format suitable to be # included into a instrument testing script. These lists are then used # to check the inventory of the SICS server and to check each motor. # This can be extended to get even more lists of things to be checked # automatically. # # Mark Koennecke, November 2006 #----------------------------------------------------------------------- if {$argc < 1} { puts stdout "Usage:\n\tanalyzeinst instrument" exit 1 } source sicstcldebug.tcl #---------------------------------------------------------------------- proc writeInventory {out} { set txt [sicscommand list] set l [split $txt ,] foreach obj $l { if {[regexp {con[0-9]*} $obj] == 1} { continue } if {[string equal tt $obj] == 1} { continue } if {[string equal temperature $obj] == 1} { continue } if {[string first ENDLIST $obj] >= 0} { continue } if {[string equal sea $obj] == 1} { continue } if {[string equal tecs $obj] == 1} { continue } puts $out "lappend inventory $obj" } } #---------------------------------------------------------------------- proc writeMotors {out} { set txt [sicscommand list interface drivable] set l [split $txt ,] foreach obj $l { if {[string equal tt $obj] == 1} { continue } if {[string equal temperature $obj] == 1} { continue } if {[string first ENDLIST $obj] >= 0} { continue } puts $out "lappend motors $obj" } } #======================= "MAIN" ====================================== set instrument [lindex $argv 0] initSicsDebug $instrument set filnam [format "%sinventory.tcl" $instrument] set out [open $filnam w] writeInventory $out writeMotors $out close $out puts stdout Done exit 0