diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-04-13 16:41:46 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-04-13 16:41:46 (GMT) |
commit | 8050b080d7d62e077946e5ac320a12fc76789651 (patch) | |
tree | 55bb739a1de68486155a3ee6a210f6bfa589addd /ds9/library/array.tcl | |
parent | 034da8e9c36e92b102725e46ad17bb62d3ca348c (diff) | |
download | blt-8050b080d7d62e077946e5ac320a12fc76789651.zip blt-8050b080d7d62e077946e5ac320a12fc76789651.tar.gz blt-8050b080d7d62e077946e5ac320a12fc76789651.tar.bz2 |
add ds9 array parser
Diffstat (limited to 'ds9/library/array.tcl')
-rw-r--r-- | ds9/library/array.tcl | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ds9/library/array.tcl b/ds9/library/array.tcl index 31a1f2e..08b7a92 100644 --- a/ds9/library/array.tcl +++ b/ds9/library/array.tcl @@ -76,6 +76,19 @@ proc ProcessArrayCmd {varname iname sock fn} { upvar $varname var upvar $iname i + global debug + if {$debug(tcl,parser)} { + global array + set array(load,sock) $sock + set array(load,fn) $fn + set array(load,layer) {} + + array::YY_FLUSH_BUFFER + array::yy_scan_string [lrange $var $i end] + array::yyparse + incr i [expr $array::yycnt-1] + } else { + if {[ProcessArrayBackwardCmd $varname $iname $sock $fn]} { return } @@ -117,6 +130,53 @@ proc ProcessArrayCmd {varname iname sock fn} { } FinishLoad } +} + +proc ArrayCmdSet {which value} { + global array + + set array($which) $value +} + +proc ArrayCmdLoad {param} { + global array + + if {$array(load,sock) != {}} { + # xpa + if {![ImportArraySocket $array(load,sock) $param $array(load,layer)]} { + InitError xpa + ImportArrayFile $param $array(load,layer) + } + } else { + # comm + if {$array(load,fn) != {}} { + ImportArrayAlloc $array(load,fn) $param $array(load,layer) + } else { + ImportArrayFile $param $array(load,layer) + } + } + FinishLoad +} + +proc ArrayCmdLoadRGB {param} { + global array + + if {$array(load,sock) != {}} { + # xpa + if {![ImportRGBArraySocket $array(load,sock) $param]} { + InitError xpa + ImportRGBArrayFile $param + } + } else { + # comm + if {$array(load,fn) != {}} { + ImportRGBArrayAlloc $array(load,fn) $param + } else { + ImportRGBArrayFile $param + } + } + FinishLoad +} proc ProcessSendArrayCmd {proc id param sock fn} { global current |