diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-05-16 18:17:06 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-05-16 18:17:06 (GMT) |
commit | 290312bc296c888fb080aa2bed0e4d8116aafc34 (patch) | |
tree | 6019d8c14a00fa5db776fd5ac703b0f73680d3d8 /ds9/library | |
parent | 212a5a2635286012d36b32f1e5cce0de95c2a4d4 (diff) | |
download | blt-290312bc296c888fb080aa2bed0e4d8116aafc34.zip blt-290312bc296c888fb080aa2bed0e4d8116aafc34.tar.gz blt-290312bc296c888fb080aa2bed0e4d8116aafc34.tar.bz2 |
add ds9 shm parser
Diffstat (limited to 'ds9/library')
-rw-r--r-- | ds9/library/command.tcl | 16 | ||||
-rw-r--r-- | ds9/library/hvsup.tcl | 4 | ||||
-rw-r--r-- | ds9/library/imgsvr.tcl | 2 | ||||
-rw-r--r-- | ds9/library/load.tcl | 58 | ||||
-rw-r--r-- | ds9/library/shm.tcl | 40 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 |
6 files changed, 65 insertions, 57 deletions
diff --git a/ds9/library/command.tcl b/ds9/library/command.tcl index 38af0d6..525c032 100644 --- a/ds9/library/command.tcl +++ b/ds9/library/command.tcl @@ -534,11 +534,11 @@ proc CommandLineLoadBase {item argvname iname} { rgbimage { - CreateRGBFrame + MultiLoadRGB LoadRGBImageFile $item } rgbcube { - CreateRGBFrame + MultiLoadRGB LoadRGBCubeFile $item } @@ -574,7 +574,7 @@ proc CommandLineLoadBase {item argvname iname} { } srgbcube { #backward compatibility - CreateRGBFrame + MultiLoadRGB incr i LoadSRGBCubeFile $item [lindex $argv $i] } @@ -592,7 +592,7 @@ proc CommandLineLoadBase {item argvname iname} { ImportArrayFile $item $file(layer) } rgbarray { - CreateRGBFrame + MultiLoadRGB ImportRGBArrayFile $item } nrrd { @@ -713,11 +713,11 @@ proc CommandLineLoad3D {item argvname iname} { } rgbimage { - CreateRGBFrame + MultiLoadRGB LoadRGBImageFile $item } rgbcube { - CreateRGBFrame + MultiLoadRGB LoadRGBCubeFile $item } @@ -753,7 +753,7 @@ proc CommandLineLoad3D {item argvname iname} { } srgbcube { #backward compatibility - CreateRGBFrame + MultiLoadRGB incr i LoadSRGBCubeFile $item [lindex $argv $i] } @@ -771,7 +771,7 @@ proc CommandLineLoad3D {item argvname iname} { ImportArrayFile $item {} } rgbarray { - CreateRGBFrame + MultiLoadRGB ImportRGBArrayFile $item } nrrd { diff --git a/ds9/library/hvsup.tcl b/ds9/library/hvsup.tcl index 0aca788..7e2a8da 100644 --- a/ds9/library/hvsup.tcl +++ b/ds9/library/hvsup.tcl @@ -1194,7 +1194,7 @@ proc HVParseImg {varname} { } switch -- $var(frame) { - new {MultiLoadBase} + new {MultiLoad} current {} } @@ -1231,7 +1231,7 @@ proc HVParseFITS {varname} { } switch -- $var(frame) { - new {MultiLoadBase} + new {MultiLoad} current {} } diff --git a/ds9/library/imgsvr.tcl b/ds9/library/imgsvr.tcl index a962e74..2375731 100644 --- a/ds9/library/imgsvr.tcl +++ b/ds9/library/imgsvr.tcl @@ -427,7 +427,7 @@ proc IMGSVRParse {varname} { } switch -- $var(mode) { - new {MultiLoadBase} + new {MultiLoad} current {} } diff --git a/ds9/library/load.tcl b/ds9/library/load.tcl index 221a1f6..cc10f10 100644 --- a/ds9/library/load.tcl +++ b/ds9/library/load.tcl @@ -13,46 +13,20 @@ proc MultiLoad {{layer {}} {mode {}}} { puts stderr "MultiLoad" } - if {$layer != {} || $mode != {}} { - return - } - if {$current(frame) != {}} { - if {![$current(frame) has fits]} { - return - } switch -- [$current(frame) get type] { base - - 3d {CreateFrame} - rgb {} - } - } else { - CreateFrame - return - } - - # go into tile mode if more than one - set cnt [llength $ds9(frames)] - if {$cnt > 1 && $current(display) != "tile"} { - set current(display) tile - DisplayMode - } -} - -proc MultiLoadBase {} { - global ds9 - global current - - global debug - if {$debug(tcl,layout)} { - puts stderr "MultiLoadBase" - } - - if {$current(frame) != {}} { - if {![$current(frame) has fits]} { - return + 3d { + if {$layer != {} || $mode != {}} { + return + } + if {![$current(frame) has fits]} { + return + } + CreateFrame + } + rgb {CreateFrame} } - CreateFrame } else { CreateFrame return @@ -76,10 +50,16 @@ proc MultiLoadRGB {} { } if {$current(frame) != {}} { - if {![$current(frame) has fits]} { - return + switch -- [$current(frame) get type] { + base - + 3d {CreateRGBFrame} + rgb { + if {![$current(frame) has fits]} { + return + } + CreateRGBFrame + } } - CreateRGBFrame } else { CreateRGBFrame return diff --git a/ds9/library/shm.tcl b/ds9/library/shm.tcl index bd95bc8..7bf5249 100644 --- a/ds9/library/shm.tcl +++ b/ds9/library/shm.tcl @@ -7,10 +7,18 @@ package provide DS9 1.0 proc ProcessShmCmd {varname iname ml} { upvar $varname var upvar $iname i - global loadParam - global current - global ds9 + + global debug + if {$debug(tcl,parser)} { + global parse + set parse(ml) $ml + + shm::YY_FLUSH_BUFFER + shm::yy_scan_string [lrange $var $i end] + shm::yyparse + incr i [expr $shm::yycnt-1] + } else { set done 0 while {!$done} { @@ -161,7 +169,7 @@ proc ProcessShmCmd {varname iname ml} { rgbcube { if {$ml} { - CreateRGBFrame + MultiLoadRGB } set loadParam(file,mode) {rgb cube} set loadParam(shared,idtype) [lindex $var [expr $i+1]] @@ -171,7 +179,7 @@ proc ProcessShmCmd {varname iname ml} { } srgbcube { if {$ml} { - CreateRGBFrame + MultiLoadRGB } set loadParam(load,type) sshared set loadParam(file,mode) {rgb cube} @@ -183,7 +191,7 @@ proc ProcessShmCmd {varname iname ml} { } rgbimage { if {$ml} { - CreateRGBFrame + MultiLoadRGB } set loadParam(file,mode) {rgb image} set loadParam(shared,idtype) [lindex $var [expr $i+1]] @@ -193,7 +201,7 @@ proc ProcessShmCmd {varname iname ml} { } rgbarray { if {$ml} { - CreateRGBFrame + MultiLoadRGB } set loadParam(file,type) array set loadParam(file,mode) {rgb cube} @@ -239,6 +247,24 @@ proc ProcessShmCmd {varname iname ml} { } FinishLoad } +} + +proc ShmCmdSet {loadtype filetype filemode sharedidtype sharedid filename {sharedhdr {}}} { + + global loadparam + set loadparam(load,type) $loadtype + set loadparam(file,type) $filetype + set loadparam(file,mode) $filemode + set loadparam(shared,idtype) $sharedidtype + set loadparam(shared,id) $sharedid + set loadparam(file,name) $filename + set loadparam(shared,hdr) $sharedhdr + + # mask not supported + set loadParam(load,layer) {} + + ProcessLoad +} proc ProcessSendShmCmd {proc id param} { global current diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index a249248..26c60f2 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -322,6 +322,8 @@ source $ds9(root)/library/scaleparser.tcl source $ds9(root)/library/scalelex.tcl source $ds9(root)/library/sfitsparser.tcl source $ds9(root)/library/sfitslex.tcl +source $ds9(root)/library/shmparser.tcl +source $ds9(root)/library/shmlex.tcl source $ds9(root)/library/siaparser.tcl source $ds9(root)/library/sialex.tcl source $ds9(root)/library/skyviewparser.tcl |