#!/bin/sh  
# \
exec oagtclsh "$0" "$@"

# $Log: not supported by cvs2svn $
# Revision 1.6  2002/10/15 04:44:39  emery
# Fixed typo in lattice name.
#
# Revision 1.5  2002/10/15 04:43:17  emery
# Changed the list of User lattices in the latticeList.
#
# Revision 1.4  2002/01/25 18:15:46  emery
# Changed argument name to latticeList.
#
# Revision 1.3  2002/01/25 18:12:08  emery
# Create glitch matrices in /home/helios/oagData/sr/lattices/<..>
# directories instead.
#
# Revision 1.2  2001/06/27 21:38:37  emery
# Fewer blank lines.
#
# Revision 1.1  2000/10/27 02:09:24  emery
# First installation.
#

set auto_path [linsert $auto_path 0  /usr/local/oag/apps/lib/$env(HOST_ARCH)]
set auto_path [linsert $auto_path 0 /usr/local/oag/lib_patch/$env(HOST_ARCH)]
APSStandardSetup

puts "Use makeSROrbitGlitchInput instead"
exit
set usage "usage: makeOrbitGlitchFiles -latticeList \"<lattice1> <lattice2>\""
set latticeList "nux36nuy19 nuy19.3"
set args $argv
APSParseArguments {latticeList}

if ![llength $latticeList] {
    puts stderr "Error (0) for $argv0 in [pwd]: No latticeList given"
}

foreach lattice $latticeList {
    cd /home/helios/oagData/sr/lattices/$lattice
    if ![llength [glob -nocomplain sr.h1rm-????]] {
        set output sr.h1rm-0001
    } else {
        set output [APSNextGenerationedName \
                      -name [lindex [lsort [glob -nocomplain sr.h1rm-????]] end] \
                      -newFile 1]
    }
    if [catch {exec sddsxref aps.hrm aps.twi -take=etax -pipe=out \
                 -match=BPMName=ElementName \
                 | sddsnormalize -pipe=in -columns=*:* $output
        file delete sr.h1rm 
        exec ln -s $output sr.h1rm} result] {
        puts stderr "Error (4) for $argv0 in [pwd]: $result"
        exit 1
    }
    if ![llength [glob -nocomplain sr.v1rm-????]] {
        set output sr.v1rm-0001
    } else {
        set output [APSNextGenerationedName \
                      -name [lindex [lsort [glob -nocomplain sr.v1rm-????]] end] \
                      -newFile 1]
    }
    if [catch {exec sddsnormalize aps.vrm $output -column=*:* 
        file delete sr.v1rm 
        exec ln -s $output sr.v1rm} result] {
        puts stderr "Error (5) for $argv0 in [pwd]: $result"
        exit 1
    }
}

exit
