- Included new exe command into syntax check program

This commit is contained in:
koennecke
2005-04-22 14:10:36 +00:00
parent a14e06dd91
commit 95c91a77c4
3 changed files with 68 additions and 4 deletions

View File

@ -6,7 +6,7 @@
#
# Mark Koennecke, March 2003
#--------------------------------------------------------------------------
source /data/lnslib/bin/sicscheck/sicssyntaxlib.tcl
source sicssyntaxlib.tcl
#------------------------- define HRPT motors and aliases
sicsSyntaxMap momu syntaxMotor
@ -83,4 +83,4 @@ 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

View File

@ -131,7 +131,7 @@ proc syntaxDummy {name args} {
#---------------------------------------------------------------------------
# syntaxWarn is a syntax checking procedure which does nothing. This is a
# quick fix for SICS commands for which no syntax checking procedure has not
# yet been defined or makes no sense. This version wanrs about it.
# yet been defined or makes no sense. This version warns about it.
#-------------------------------------------------------------------------
proc syntaxWarn {name args} {
puts stdout "INFO: Syntax for $name not checked"
@ -549,7 +549,11 @@ proc syntaxDrive {name args} {
#--------------------------------------------------------------------------
# The syntax count command
#--------------------------------------------------------------------------
set countSum 0
set countSavedPreset 1
#------------------------------------------------------------------------
proc count { {mode NULL } { preset NULL } } {
global countSum countSavedPreset
set m [string trim [string tolower $mode]]
if { [string compare $m null] == 0} {
return
@ -561,11 +565,14 @@ proc count { {mode NULL } { preset NULL } } {
}
set p [string trim [string tolower $preset]]
if { [string compare $p null] == 0} {
set countSum [expr $countSum + $countSavedPreset]
return
} else {
if {[syntaxNumeric $p] != 1 } {
error "ERROR: count expected numeric preset, got $p"
}
set countSum [expr $countSum + $p]
set countSavedPreset $p
}
}
#---------------------------------------------------------------------------
@ -578,6 +585,7 @@ proc co { {mode NULL} {prest NULL} } {
# the syntax repeat command
#---------------------------------------------------------------------------
proc repeat { num {mode NULL} {preset NULL} } {
global countSum countSavedPreset
if { [syntaxNumeric $num] != 1 } {
error "ERROR: expected numeric repeat count, got $num"
}
@ -592,11 +600,15 @@ proc repeat { num {mode NULL} {preset NULL} } {
}
set p [string trim [string tolower $preset]]
if { [string compare $p null] == 0} {
set countSum [expr $countSum + $num*$countSavedPreset]
return
} else {
if {[syntaxNumeric $p] != 1 } {
error "ERROR: count expected numeric preset, got $p"
}
set countSum [expr $countSum + $num*$p]
set countSavedPreset $p
}
}
#----------------------------------------------------------------------------
@ -1077,6 +1089,58 @@ proc syntaxXY {name args} {
}
}
}
#--------------------------------------------------------------------------
# Syntax check for the exe batch manager
#--------------------------------------------------------------------------
lappend exeFileList grrrrrrrmmmppppppppfffffff
proc checkExeBuffer {buffer} {
global exeFileList
if { [string compare [string index $buffer 0] "/"] == 0 } {
set name [file tail $buffer]
} else {
set name buffer
}
if { [lsearch $exeFileList $buffer] >= 0} {
puts stdout "INFO: Command file loop detected!"
return
}
}
#-------------------------------------------------------------------------
proc exe args {
global sicsPar
if { [llength $args] < 1} {
error "ERROR: exe needs at least one argument"
}
set key [lindex $args 0]
set key [string tolower $key]
switch $key {
syspath {
if { [llength $args] > 1} {
set sicsPar(exe.syspath) [lindex $args 1]
} else {
return [syntaxGet exe.syspath]
}
}
batchpath {
if { [llength $args] > 1} {
set sicsPar(exe.batchpath) [lindex $args 1]
} else {
return [syntaxGet exe.batchpath]
}
}
print -
info -
enqueue -
clear -
run -
interest -
queue {}
default {
checkExeBuffer $key
}
}
}
#---------------------------------------------------------------------------
# Mappings for some common SICS commands and variables
#---------------------------------------------------------------------------

View File

@ -1,2 +1,2 @@
drive mex -190
exe hugo.dat