#! /bin/sh
#next line is executed by sh, not by Tcl \
   exec tclsh $0 ${1+"$@"}
#--------------------------------------------------------------------------
# This is the SICS syntax checker for the AMOR reflectometer
#
# Mark Koennecke, March 2003
#--------------------------------------------------------------------------
source /data/lnslib/bin/sicscheck/sicssyntaxlib.tcl

#------------ define AMOR motors and aliases
sicsSyntaxMap ftz       syntaxMotor
sicsSyntaxMap fom       syntaxMotor
sicsSyntaxMap d1l       syntaxMotor
sicsSyntaxMap d1r       syntaxMotor
sicsSyntaxMap d1t       syntaxMotor
sicsSyntaxMap d1b       syntaxMotor
sicsSyntaxMap moz       syntaxMotor
sicsSyntaxMap mty       syntaxMotor
sicsSyntaxMap mom       syntaxMotor
sicsSyntaxMap mtz       syntaxMotor
sicsSyntaxMap d2l       syntaxMotor
sicsSyntaxMap d2r       syntaxMotor
sicsSyntaxMap d2t       syntaxMotor
sicsSyntaxMap d2b       syntaxMotor
sicsSyntaxMap d3l       syntaxMotor
sicsSyntaxMap d3r       syntaxMotor
sicsSyntaxMap d3t       syntaxMotor
sicsSyntaxMap d3b       syntaxMotor
sicsSyntaxMap stz       syntaxMotor
sicsSyntaxMap som       syntaxMotor
sicsSyntaxMap sch       syntaxMotor
sicsSyntaxMap soz       syntaxMotor
sicsSyntaxMap stb       syntaxMotor
sicsSyntaxMap d4l       syntaxMotor
sicsSyntaxMap d4r       syntaxMotor
sicsSyntaxMap d4t       syntaxMotor
sicsSyntaxMap d4b       syntaxMotor
sicsSyntaxMap aoz       syntaxMotor
sicsSyntaxMap aom       syntaxMotor
sicsSyntaxMap atz       syntaxMotor
sicsSyntaxMap d5l       syntaxMotor
sicsSyntaxMap d5r       syntaxMotor
sicsSyntaxMap d5t       syntaxMotor
sicsSyntaxMap d5b       syntaxMotor
sicsSyntaxMap coz       syntaxMotor
sicsSyntaxMap c3z       syntaxMotor
sicsSyntaxMap com       syntaxMotor
sicsSyntaxMap cox       syntaxMotor

#------------ define AMOR counters
sicsSyntaxMap counter syntaxCounter
sicsSyntaxMap hm      syntaxHM

#------------ define AMOR variables 
sicsSyntaxMap title        syntaxTextPar
sicsSyntaxMap user         syntaxTextPar
sicsSyntaxMap adres        syntaxTextPar 
sicsSyntaxMap collimation  syntaxTextPar
sicsSyntaxMap sample       syntaxTextPar
sicsSyntaxMap comment1     syntaxTextPar
sicsSyntaxMap comment2     syntaxTextPar
sicsSyntaxMap comment3     syntaxTextPar
sicsSyntaxMap fax          syntaxTextPar
sicsSyntaxMap email        syntaxTextPar
sicsSyntaxMap sample       syntaxTextPar

#----------- define AMOR environment
sicsSyntaxMap temperature evSyntax
sicsSyntaxMap tt          evSyntax
sicsSyntaxMap pby         evSyntax
sicsSyntaxMap aby         evSyntax
sicsSyntaxMap magnet      evSyntax

#---------- define AMOR auxiliary
sicsSyntaxMap dr  syntaxDrive
sicsSyntaxMap s2t syntaxNumPar
sicsSyntaxMap o2t syntaxNumPar
sicsSyntaxMap td  syntaxNumPar
sicsSyntaxMap aw  syntaxNumPar
sicsSyntaxMap shutter syntaxTextPar

syntaxLoadSICS /data/lnslib/data/AMOR/2003/amorstatus.tcl

#puts stdout [array names sicsPar]

if { $argc < 1} {
	puts stdout "Usage: \n\tamorcheck filename"
	exit 0
}
set filename [lindex $argv 0]
lappend fileList [file tail $filename]
puts stdout "Syntax checking --> $filename <-- ........."
source $filename
puts stdout "If this completed without errors the likelihoof of your script"
puts stdout "executing properly on the instrument has increased significantly"
exit 1
 
