From 68409ff3a87e74b06307f782a0b1343d58a0e614 Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 31 May 2018 13:27:04 -0400 Subject: update ds9 bin parser --- ds9/library/2mass.tcl | 2 +- ds9/library/3d.tcl | 2 +- ds9/library/bin.tcl | 21 +++++++++-------- ds9/library/block.tcl | 2 +- ds9/library/colorbar.tcl | 4 ++-- ds9/library/crop.tcl | 2 +- ds9/library/crosshair.tcl | 2 +- ds9/library/cube.tcl | 2 +- ds9/library/eso.tcl | 2 +- ds9/library/file.tcl | 2 +- ds9/library/frame.tcl | 10 ++++---- ds9/library/grid.tcl | 2 +- ds9/library/hv.tcl | 2 +- ds9/library/iexam.tcl | 2 +- ds9/library/iis.tcl | 2 +- ds9/library/layout.tcl | 6 ++--- ds9/library/load.tcl | 2 +- ds9/library/magnifier.tcl | 2 +- ds9/library/mask.tcl | 2 +- ds9/library/nameres.tcl | 2 +- ds9/library/nvss.tcl | 2 +- ds9/library/pagesetup.tcl | 4 ++-- ds9/library/panzoom.tcl | 8 +++---- ds9/library/photo.tcl | 22 ++++++++--------- ds9/library/plotprocess.tcl | 2 +- ds9/library/print.tcl | 4 ++-- ds9/library/rgb.tcl | 2 +- ds9/library/sao.tcl | 2 +- ds9/library/scale.tcl | 6 ++--- ds9/library/shm.tcl | 2 +- ds9/library/skyview.tcl | 2 +- ds9/library/smooth.tcl | 2 +- ds9/library/source.tcl | 2 ++ ds9/library/stsci.tcl | 2 +- ds9/library/util.tcl | 57 ++++++++++++++++++++++++++++++++++++--------- ds9/library/vla.tcl | 2 +- ds9/library/vlss.tcl | 2 +- ds9/library/vo.tcl | 2 +- ds9/library/wcs.tcl | 4 ++-- ds9/library/xpa.tcl | 2 +- ds9/make.include | 8 +++---- ds9/parsers/binparser.tac | 12 +++++----- 42 files changed, 131 insertions(+), 93 deletions(-) diff --git a/ds9/library/2mass.tcl b/ds9/library/2mass.tcl index cb2fa23..36158ea 100644 --- a/ds9/library/2mass.tcl +++ b/ds9/library/2mass.tcl @@ -139,7 +139,7 @@ proc Process2MASSCmd {varname iname} { incr i [expr $twomass::yycnt-1] } -proc ProcessSend2MASSCmd {proc id param} { +proc ProcessSend2MASSCmd {proc id param {sock {}} {fn {}}} { 2MASSDialog IMGSVRProcessSendCmd $proc $id $param dtwomass } diff --git a/ds9/library/3d.tcl b/ds9/library/3d.tcl index 78a6c2a..9bac5a9 100644 --- a/ds9/library/3d.tcl +++ b/ds9/library/3d.tcl @@ -480,7 +480,7 @@ proc ThreedCmdSet {which value {cmd {}}} { } } -proc ProcessSend3DCmd {proc id param} { +proc ProcessSend3DCmd {proc id param {sock {}} {fn {}}} { global threed switch -- [string tolower [lindex $param 0]] { diff --git a/ds9/library/bin.tcl b/ds9/library/bin.tcl index d8dfd42..f0d4f47 100644 --- a/ds9/library/bin.tcl +++ b/ds9/library/bin.tcl @@ -729,16 +729,17 @@ proc ProcessBinCmd {varname iname} { incr i [expr $bin::yycnt-1] } -proc BinCmdSet {which value {cmd {}}} { - global bin - - set bin($which) $value - if {$cmd != {}} { - eval $cmd - } -} +proc ProcessSendBinCmd {proc id param {sock {}} {fn {}}} { + if {1} { + global parse + set parse(proc) $proc + set parse(id) $id + + binsend::YY_FLUSH_BUFFER + binsend::yy_scan_string $param + binsend::yyparse + } else { -proc ProcessSendBinCmd {proc id param} { global bin global current @@ -765,4 +766,4 @@ proc ProcessSendBinCmd {proc id param} { function {$proc $id "$bin(function)\n"} } } - +} diff --git a/ds9/library/block.tcl b/ds9/library/block.tcl index 214604c..18dba19 100644 --- a/ds9/library/block.tcl +++ b/ds9/library/block.tcl @@ -304,7 +304,7 @@ proc BlockCmdSet {which value {cmd {}}} { } } -proc ProcessSendBlockCmd {proc id param} { +proc ProcessSendBlockCmd {proc id param {sock {}} {fn {}}} { global block switch -- [lindex $param 0] { diff --git a/ds9/library/colorbar.tcl b/ds9/library/colorbar.tcl index 8575336..2949f6e 100644 --- a/ds9/library/colorbar.tcl +++ b/ds9/library/colorbar.tcl @@ -1244,7 +1244,7 @@ proc CmapValueCmd {c b} { UpdateColorDialog } -proc ProcessSendCmapCmd {proc id param} { +proc ProcessSendCmapCmd {proc id param {sock {}} {fn {}}} { global colorbar global current @@ -1299,7 +1299,7 @@ proc ColorbarCmdFontStyle {value {cmd {}}} { } } -proc ProcessSendColorbarCmd {proc id param} { +proc ProcessSendColorbarCmd {proc id param {sock {}} {fn {}}} { global colorbar global view diff --git a/ds9/library/crop.tcl b/ds9/library/crop.tcl index e4a2c01..b418922 100644 --- a/ds9/library/crop.tcl +++ b/ds9/library/crop.tcl @@ -408,7 +408,7 @@ proc CropCmdSet {which value {cmd {}}} { } } -proc ProcessSendCropCmd {proc id param} { +proc ProcessSendCropCmd {proc id param {sock {}} {fn {}}} { global crop global current diff --git a/ds9/library/crosshair.tcl b/ds9/library/crosshair.tcl index 18c9466..8a259e0 100644 --- a/ds9/library/crosshair.tcl +++ b/ds9/library/crosshair.tcl @@ -278,7 +278,7 @@ proc CrosshairCmdSet {which value {cmd {}}} { } } -proc ProcessSendCrosshairCmd {proc id param} { +proc ProcessSendCrosshairCmd {proc id param {sock {}} {fn {}}} { global crosshair global current diff --git a/ds9/library/cube.tcl b/ds9/library/cube.tcl index 6fe09ec..920bf66 100644 --- a/ds9/library/cube.tcl +++ b/ds9/library/cube.tcl @@ -735,7 +735,7 @@ proc CubeCmdSet {which value {cmd {}}} { } } -proc ProcessSendCubeCmd {proc id param} { +proc ProcessSendCubeCmd {proc id param {sock {}} {fn {}}} { global cube global current global blink diff --git a/ds9/library/eso.tcl b/ds9/library/eso.tcl index ab7c199..38a341d 100644 --- a/ds9/library/eso.tcl +++ b/ds9/library/eso.tcl @@ -168,7 +168,7 @@ proc ProcessESOCmd {varname iname} { incr i [expr $dsseso::yycnt-1] } -proc ProcessSendESOCmd {proc id param} { +proc ProcessSendESOCmd {proc id param {sock {}} {fn {}}} { ESODialog IMGSVRProcessSendCmd $proc $id $param deso } diff --git a/ds9/library/file.tcl b/ds9/library/file.tcl index ba7c4e8..9472421 100644 --- a/ds9/library/file.tcl +++ b/ds9/library/file.tcl @@ -296,7 +296,7 @@ proc ProcessFileCmd {varname iname sock ch fn} { } } -proc ProcessSendFileCmd {proc id param} { +proc ProcessSendFileCmd {proc id param {sock {}} {fn {}}} { global current if {$current(frame) != {}} { diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl index 2bbbe91..db6b5d0 100644 --- a/ds9/library/frame.tcl +++ b/ds9/library/frame.tcl @@ -2080,7 +2080,7 @@ proc CurrentCmdSet {which value {cmd {}}} { } } -proc ProcessSendFrameCmd {proc id param} { +proc ProcessSendFrameCmd {proc id param {sock {}} {fn {}}} { global ds9 global current global rgb @@ -2166,7 +2166,7 @@ proc ProcessSingleCmd {varname iname} { DisplayMode } -proc ProcessSendSingleCmd {proc id param} { +proc ProcessSendSingleCmd {proc id param {sock {}} {fn {}}} { global current if {$current(display) == "single"} { @@ -2195,7 +2195,7 @@ proc TileCmdSet {which value {cmd {}}} { } } -proc ProcessSendTileCmd {proc id param} { +proc ProcessSendTileCmd {proc id param {sock {}} {fn {}}} { global current global tile @@ -2238,7 +2238,7 @@ proc BlinkCmdSet {which value {cmd {}}} { } } -proc ProcessSendBlinkCmd {proc id param} { +proc ProcessSendBlinkCmd {proc id param {sock {}} {fn {}}} { global current global blink @@ -2267,7 +2267,7 @@ proc ProcessLockCmd {varname iname} { incr i [expr $lock::yycnt-1] } -proc ProcessSendLockCmd {proc id param} { +proc ProcessSendLockCmd {proc id param {sock {}} {fn {}}} { global panzoom global crop global crosshair diff --git a/ds9/library/grid.tcl b/ds9/library/grid.tcl index 3333e84..844d88a 100644 --- a/ds9/library/grid.tcl +++ b/ds9/library/grid.tcl @@ -1178,7 +1178,7 @@ proc GridCmdFontStyle {which value {cmd {}}} { } } -proc ProcessSendGridCmd {proc id param} { +proc ProcessSendGridCmd {proc id param {sock {}} {fn {}}} { global grid switch -- [lindex $param 0] { diff --git a/ds9/library/hv.tcl b/ds9/library/hv.tcl index c167a5d..8d63b03 100644 --- a/ds9/library/hv.tcl +++ b/ds9/library/hv.tcl @@ -917,7 +917,7 @@ proc WebCmdClick {id} { } } -proc ProcessSendWebCmd {proc id param} { +proc ProcessSendWebCmd {proc id param {sock {}} {fn {}}} { global ihv $proc $id "$ihv(windows)\n" } diff --git a/ds9/library/iexam.tcl b/ds9/library/iexam.tcl index a2f5201..144bd14 100644 --- a/ds9/library/iexam.tcl +++ b/ds9/library/iexam.tcl @@ -53,7 +53,7 @@ proc IExamKey {which K xx yy} { } } -proc ProcessSendIExamCmd {proc id param} { +proc ProcessSendIExamCmd {proc id param {sock {}} {fn {}}} { global iexam global icursor diff --git a/ds9/library/iis.tcl b/ds9/library/iis.tcl index 1cda226..091861d 100644 --- a/ds9/library/iis.tcl +++ b/ds9/library/iis.tcl @@ -374,7 +374,7 @@ proc IISCmd {filename {which {}}} { $current(frame) iis set file name $filename $which } -proc ProcessSendIISCmd {proc id param} { +proc ProcessSendIISCmd {proc id param {sock {}} {fn {}}} { global current switch -- [string tolower [lindex $param 0]] { diff --git a/ds9/library/layout.tcl b/ds9/library/layout.tcl index 99661c7..9abab0a 100644 --- a/ds9/library/layout.tcl +++ b/ds9/library/layout.tcl @@ -833,7 +833,7 @@ proc ProcessHeightCmd {varname iname} { incr i [expr $height::yycnt-1] } -proc ProcessSendHeightCmd {proc id param} { +proc ProcessSendHeightCmd {proc id param {sock {}} {fn {}}} { global canvas $proc $id "$canvas(height)\n" } @@ -852,7 +852,7 @@ proc ProcessWidthCmd {varname iname} { incr i [expr $width::yycnt-1] } -proc ProcessSendWidthCmd {proc id param} { +proc ProcessSendWidthCmd {proc id param {sock {}} {fn {}}} { global canvas $proc $id "$canvas(width)\n" } @@ -876,7 +876,7 @@ proc ViewCmdSet {which value {cmd {}}} { } } -proc ProcessSendViewCmd {proc id param} { +proc ProcessSendViewCmd {proc id param {sock {}} {fn {}}} { global view switch -- [string tolower [lindex $param 0]] { diff --git a/ds9/library/load.tcl b/ds9/library/load.tcl index dd49c0f..22d76b6 100644 --- a/ds9/library/load.tcl +++ b/ds9/library/load.tcl @@ -420,7 +420,7 @@ proc ProcessPreserveCmd {varname iname} { incr i [expr $preserve::yycnt-1] } -proc ProcessSendPreserveCmd {proc id param} { +proc ProcessSendPreserveCmd {proc id param {sock {}} {fn {}}} { global scale global panzoom global marker diff --git a/ds9/library/magnifier.tcl b/ds9/library/magnifier.tcl index 80379d8..1dc0866 100644 --- a/ds9/library/magnifier.tcl +++ b/ds9/library/magnifier.tcl @@ -155,7 +155,7 @@ proc PmagnifierCmdSet {which value {cmd {}}} { } } -proc ProcessSendMagnifierCmd {proc id param} { +proc ProcessSendMagnifierCmd {proc id param {sock {}} {fn {}}} { global pmagnifier switch -- [string tolower [lindex $param 0]] { diff --git a/ds9/library/mask.tcl b/ds9/library/mask.tcl index d5128d9..55129ed 100644 --- a/ds9/library/mask.tcl +++ b/ds9/library/mask.tcl @@ -281,7 +281,7 @@ proc MaskCmdSet {which value {cmd {}}} { } } -proc ProcessSendMaskCmd {proc id param} { +proc ProcessSendMaskCmd {proc id param {sock {}} {fn {}}} { global mask switch -- [string tolower $param] { diff --git a/ds9/library/nameres.tcl b/ds9/library/nameres.tcl index 8acb236..9539994 100644 --- a/ds9/library/nameres.tcl +++ b/ds9/library/nameres.tcl @@ -210,7 +210,7 @@ proc NRESCmdName {value} { NRESApply $cvarname 1 } -proc ProcessSendNRESCmd {proc id param} { +proc ProcessSendNRESCmd {proc id param {sock {}} {fn {}}} { global nres global pnres global dnres diff --git a/ds9/library/nvss.tcl b/ds9/library/nvss.tcl index 8496cad..8c3b8c2 100644 --- a/ds9/library/nvss.tcl +++ b/ds9/library/nvss.tcl @@ -160,7 +160,7 @@ proc ProcessNVSSCmd {varname iname} { incr i [expr $nvss::yycnt-1] } -proc ProcessSendNVSSCmd {proc id param} { +proc ProcessSendNVSSCmd {proc id param {sock {}} {fn {}}} { NVSSDialog IMGSVRProcessSendCmd $proc $id $param dnvss } diff --git a/ds9/library/pagesetup.tcl b/ds9/library/pagesetup.tcl index 3c03050..0b1f3db 100644 --- a/ds9/library/pagesetup.tcl +++ b/ds9/library/pagesetup.tcl @@ -167,7 +167,7 @@ proc ProcessPageSetupCmd {varname iname} { } } -proc ProcessSendPageSetupCmd {proc id param} { +proc ProcessSendPageSetupCmd {proc id param {sock {}} {fn {}}} { global ds9 switch $ds9(wm) { @@ -187,7 +187,7 @@ proc ProcessPSPageSetupCmd {varname iname} { incr i [expr $pagesetup::yycnt-1] } -proc ProcessSendPSPageSetupCmd {proc id param} { +proc ProcessSendPSPageSetupCmd {proc id param {sock {}} {fn {}}} { global ps switch -- [string tolower $param] { diff --git a/ds9/library/panzoom.tcl b/ds9/library/panzoom.tcl index 0c0fd67..dd2fa53 100644 --- a/ds9/library/panzoom.tcl +++ b/ds9/library/panzoom.tcl @@ -699,7 +699,7 @@ proc ProcessPanCmd {varname iname} { incr i [expr $pan::yycnt-1] } -proc ProcessSendPanCmd {proc id param} { +proc ProcessSendPanCmd {proc id param {sock {}} {fn {}}} { global current set sys [lindex $param 0] @@ -725,7 +725,7 @@ proc ProcessZoomCmd {varname iname} { incr i [expr $zoom::yycnt-1] } -proc ProcessSendZoomCmd {proc id param} { +proc ProcessSendZoomCmd {proc id param {sock {}} {fn {}}} { global current set z1 [lindex $current(zoom) 0] @@ -750,7 +750,7 @@ proc ProcessOrientCmd {varname iname} { incr i [expr $orient::yycnt-1] } -proc ProcessSendOrientCmd {proc id param} { +proc ProcessSendOrientCmd {proc id param {sock {}} {fn {}}} { global current $proc $id "$current(orient)\n" } @@ -768,7 +768,7 @@ proc ProcessRotateCmd {varname iname} { incr i [expr $rotate::yycnt-1] } -proc ProcessSendRotateCmd {proc id param} { +proc ProcessSendRotateCmd {proc id param {sock {}} {fn {}}} { global current $proc $id "$current(rotate)\n" } diff --git a/ds9/library/photo.tcl b/ds9/library/photo.tcl index dad5534..ad3f7eb 100644 --- a/ds9/library/photo.tcl +++ b/ds9/library/photo.tcl @@ -241,23 +241,23 @@ proc PhotoCmdLoad {param mode} { FinishLoad } -proc ProcessSendGIFCmd {proc id param ch fn} { - ProcessSendPhotoCmd gif $proc $id $param $ch $fn +proc ProcessSendGIFCmd {proc id param sock fn} { + ProcessSendPhotoCmd gif $proc $id $param $sock $fn } -proc ProcessSendJPEGCmd {proc id param ch fn} { - ProcessSendPhotoCmd jpeg $proc $id $param $ch $fn +proc ProcessSendJPEGCmd {proc id param sock fn} { + ProcessSendPhotoCmd jpeg $proc $id $param $sock $fn } -proc ProcessSendPNGCmd {proc id param ch fn} { - ProcessSendPhotoCmd png $proc $id $param $ch $fn +proc ProcessSendPNGCmd {proc id param sock fn} { + ProcessSendPhotoCmd png $proc $id $param $sock $fn } -proc ProcessSendTIFFCmd {proc id param ch fn} { - ProcessSendPhotoCmd tiff $proc $id $param $ch $fn +proc ProcessSendTIFFCmd {proc id param sock fn} { + ProcessSendPhotoCmd tiff $proc $id $param $sock $fn } -proc ProcessSendPhotoCmd {format proc id param ch fn} { +proc ProcessSendPhotoCmd {format proc id param sock fn} { global current global export @@ -266,13 +266,13 @@ proc ProcessSendPhotoCmd {format proc id param ch fn} { } set opt [string tolower [lindex $param 0]] - if {$ch != {}} { + if {$sock != {}} { # xpa global tcl_platform switch $tcl_platform(os) { Linux - Darwin - - SunOS {ExportPhotoSocket $ch $format $opt} + SunOS {ExportPhotoSocket $sock $format $opt} {Windows NT} {} } } elseif {$fn != {}} { diff --git a/ds9/library/plotprocess.tcl b/ds9/library/plotprocess.tcl index 42d9c4d..fc7b171 100644 --- a/ds9/library/plotprocess.tcl +++ b/ds9/library/plotprocess.tcl @@ -842,7 +842,7 @@ proc ProcessPlotLine {varname xarname iname} { $var(proc,updateelement) $varname } -proc ProcessSendPlotCmd {proc id param} { +proc ProcessSendPlotCmd {proc id param {sock {}} {fn {}}} { global iap set i 0 diff --git a/ds9/library/print.tcl b/ds9/library/print.tcl index 933dbf8..d82e53d 100644 --- a/ds9/library/print.tcl +++ b/ds9/library/print.tcl @@ -566,7 +566,7 @@ proc ProcessPrintCmd {varname iname} { } } -proc ProcessSendPrintCmd {proc id param} { +proc ProcessSendPrintCmd {proc id param {sock {}} {fn {}}} { global ds9 switch $ds9(wm) { @@ -595,7 +595,7 @@ proc PSCmdSet {which value {cmd {}}} { } } -proc ProcessSendPSPrintCmd {proc id param} { +proc ProcessSendPSPrintCmd {proc id param {sock {}} {fn {}}} { global ps switch -- [string tolower $param] { diff --git a/ds9/library/rgb.tcl b/ds9/library/rgb.tcl index b028384..ca90e98 100644 --- a/ds9/library/rgb.tcl +++ b/ds9/library/rgb.tcl @@ -279,7 +279,7 @@ proc RGBCmdSet {which value {cmd {}}} { } } -proc ProcessSendRGBCmd {proc id param} { +proc ProcessSendRGBCmd {proc id param {sock {}} {fn {}}} { global current global rgb diff --git a/ds9/library/sao.tcl b/ds9/library/sao.tcl index 4889df2..6a62f26 100644 --- a/ds9/library/sao.tcl +++ b/ds9/library/sao.tcl @@ -155,7 +155,7 @@ proc ProcessSAOCmd {varname iname} { incr i [expr $dsssao::yycnt-1] } -proc ProcessSendSAOCmd {proc id param} { +proc ProcessSendSAOCmd {proc id param {sock {}} {fn {}}} { SAODialog IMGSVRProcessSendCmd $proc $id $param dsao } diff --git a/ds9/library/scale.tcl b/ds9/library/scale.tcl index 3555d47..4ad2b65 100644 --- a/ds9/library/scale.tcl +++ b/ds9/library/scale.tcl @@ -842,7 +842,7 @@ proc ScaleCmdSet {which value {cmd {}}} { } } -proc ProcessSendScaleCmd {proc id param} { +proc ProcessSendScaleCmd {proc id param {sock {}} {fn {}}} { global current global scale @@ -883,7 +883,7 @@ proc MinmaxCmdSet {which value {cmd {}}} { } } -proc ProcessSendMinMaxCmd {proc id param} { +proc ProcessSendMinMaxCmd {proc id param {sock {}} {fn {}}} { global minmax switch -- [string tolower $param] { @@ -915,7 +915,7 @@ proc ZscaleCmdSet {which value {cmd {}}} { } } -proc ProcessSendZScaleCmd {proc id param} { +proc ProcessSendZScaleCmd {proc id param {sock {}} {fn {}}} { global zscale switch -- [string tolower $param] { diff --git a/ds9/library/shm.tcl b/ds9/library/shm.tcl index d67002d..3fbddc0 100644 --- a/ds9/library/shm.tcl +++ b/ds9/library/shm.tcl @@ -34,7 +34,7 @@ proc ShmCmdSet {loadtype filetype filemode sharedidtype sharedid filename {share ProcessLoad } -proc ProcessSendShmCmd {proc id param} { +proc ProcessSendShmCmd {proc id param {sock {}} {fn {}}} { global current if {$current(frame) != {}} { diff --git a/ds9/library/skyview.tcl b/ds9/library/skyview.tcl index 81ac65f..ad8e3ba 100644 --- a/ds9/library/skyview.tcl +++ b/ds9/library/skyview.tcl @@ -616,7 +616,7 @@ proc ProcessSkyViewCmd {varname iname} { incr i [expr $skyview::yycnt-1] } -proc ProcessSendSkyViewCmd {proc id param} { +proc ProcessSendSkyViewCmd {proc id param {sock {}} {fn {}}} { SkyViewDialog IMGSVRProcessSendCmd $proc $id $param dskyview } diff --git a/ds9/library/smooth.tcl b/ds9/library/smooth.tcl index 24e9ed9..ce2daed 100644 --- a/ds9/library/smooth.tcl +++ b/ds9/library/smooth.tcl @@ -360,7 +360,7 @@ proc SmoothCmdSet {which value {cmd {}}} { } } -proc ProcessSendSmoothCmd {proc id param} { +proc ProcessSendSmoothCmd {proc id param {sock {}} {fn {}}} { global smooth switch -- [lindex $param 0] { diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 9b358c5..7000b33 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -198,6 +198,8 @@ source $ds9(root)/library/backupparser.tcl source $ds9(root)/library/backuplex.tcl source $ds9(root)/library/binparser.tcl source $ds9(root)/library/binlex.tcl +source $ds9(root)/library/binsendparser.tcl +source $ds9(root)/library/binsendlex.tcl source $ds9(root)/library/bgparser.tcl source $ds9(root)/library/bglex.tcl source $ds9(root)/library/blinkparser.tcl diff --git a/ds9/library/stsci.tcl b/ds9/library/stsci.tcl index 8126689..47ef6a3 100644 --- a/ds9/library/stsci.tcl +++ b/ds9/library/stsci.tcl @@ -180,7 +180,7 @@ proc ProcessSTSCICmd {varname iname} { incr i [expr $dssstsci::yycnt-1] } -proc ProcessSendSTSCICmd {proc id param} { +proc ProcessSendSTSCICmd {proc id param {sock {}} {fn {}}} { STSCIDialog IMGSVRProcessSendCmd $proc $id $param dstsci } diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index b581c09..e2a7a0f 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -166,6 +166,41 @@ proc UpdateMain {} { } } +proc ProcessCmdSet {varname key value {cmd {}}} { + upvar #0 $varname var + global $varname + + set ${varname}($key) $value + if {$cmd != {}} { + eval $cmd + } +} + +proc ProcessSendCmdGet {varname key} { + upvar #0 $varname var + global $varname + + global parse + $parse(proc) $parse(id) "$var($key)\n" +} + +proc ProcessSendCmdYesNo {varname key} { + upvar #0 $varname var + global $varname + + global parse + $parse(proc) $parse(id) [ToYesNo $var($key)] +} + +proc ProcessSendCmdCurrent {cmd} { + global parse + global current + + if {$current(frame) != {}} { + $parse(proc) $parse(id) "[$current(frame) $cmd]\n" + } +} + proc ProcessSend {proc id sock fn ext rr} { if {$sock != {}} { # not implemented @@ -1203,7 +1238,7 @@ proc ProcessPrefsCmd {varname iname} { incr i [expr $prefs::yycnt-1] } -proc ProcessSendPrefsCmd {proc id param} { +proc ProcessSendPrefsCmd {proc id param {sock {}} {fn {}}} { global pds9 global ds9 @@ -1227,7 +1262,7 @@ proc ProcessPrecisionCmd {varname iname} { incr i [expr $precision::yycnt-1] } -proc ProcessSendPrecisionCmd {proc id param} { +proc ProcessSendPrecisionCmd {proc id param {sock {}} {fn {}}} { global pds9 $proc $id "$pds9(prec,linear) $pds9(prec,deg) $pds9(prec,hms) $pds9(prec,dms) $pds9(prec,arcmin) $pds9(prec,arcsec)\n" @@ -1243,7 +1278,7 @@ proc ProcessBgCmd {varname iname} { incr i [expr $bg::yycnt-1] } -proc ProcessSendBgCmd {proc id param} { +proc ProcessSendBgCmd {proc id param {sock {}} {fn {}}} { global pds9 $proc $id "$pds9(bg)\n" @@ -1259,7 +1294,7 @@ proc ProcessNanCmd {varname iname} { incr i [expr $nan::yycnt-1] } -proc ProcessSendNanCmd {proc id param} { +proc ProcessSendNanCmd {proc id param {sock {}} {fn {}}} { global pds9 $proc $id "$pds9(nan)\n" @@ -1275,13 +1310,13 @@ proc ProcessThreadsCmd {varname iname} { incr i [expr $threads::yycnt-1] } -proc ProcessSendThreadsCmd {proc id param} { +proc ProcessSendThreadsCmd {proc id param {sock {}} {fn {}}} { global ds9 $proc $id "$ds9(threads)\n" } -proc ProcessSendIRAFAlignCmd {proc id param} { +proc ProcessSendIRAFAlignCmd {proc id param {sock {}} {fn {}}} { global pds9 $proc $id [ToYesNo $pds9(iraf)] @@ -1294,7 +1329,7 @@ proc ProcessCDCmd {varname iname} { cd [lindex $var $i] } -proc ProcessSendCDCmd {proc id param} { +proc ProcessSendCDCmd {proc id param {sock {}} {fn {}}} { $proc $id "[pwd]\n" } @@ -1420,7 +1455,7 @@ proc IconifyCmd {which} { } } -proc ProcessSendIconifyCmd {proc id param} { +proc ProcessSendIconifyCmd {proc id param {sock {}} {fn {}}} { global ds9 if {[wm state $ds9(top)] == "normal"} { $proc $id "no\n" @@ -1454,7 +1489,7 @@ proc ProcessQuitCmd {varname iname} { QuitDS9 } -proc ProcessSendModeCmd {proc id param} { +proc ProcessSendModeCmd {proc id param {sock {}} {fn {}}} { global current $proc $id "$current(mode)\n" @@ -1540,12 +1575,12 @@ proc ProcessThemeCmd {varname iname} { } # backward compatibility -proc ProcessSendThemeCmd {proc id param} { +proc ProcessSendThemeCmd {proc id param {sock {}} {fn {}}} { global pds9 $proc $id "native\n" } -proc ProcessSendVersionCmd {proc id param} { +proc ProcessSendVersionCmd {proc id param {sock {}} {fn {}}} { global ds9 $proc $id "$ds9(title) [lindex $ds9(version) 0]\n" } diff --git a/ds9/library/vla.tcl b/ds9/library/vla.tcl index 129a03e..48fab6a 100644 --- a/ds9/library/vla.tcl +++ b/ds9/library/vla.tcl @@ -171,7 +171,7 @@ proc ProcessVLACmd {varname iname} { incr i [expr $vla::yycnt-1] } -proc ProcessSendVLACmd {proc id param} { +proc ProcessSendVLACmd {proc id param {sock {}} {fn {}}} { VLADialog IMGSVRProcessSendCmd $proc $id $param dvla } diff --git a/ds9/library/vlss.tcl b/ds9/library/vlss.tcl index 1d85c3e..8c585a0 100644 --- a/ds9/library/vlss.tcl +++ b/ds9/library/vlss.tcl @@ -130,7 +130,7 @@ proc ProcessVLSSCmd {varname iname} { incr i [expr $vlss::yycnt-1] } -proc ProcessSendVLSSCmd {proc id param} { +proc ProcessSendVLSSCmd {proc id param {sock {}} {fn {}}} { VLSSDialog IMGSVRProcessSendCmd $proc $id $param dvlss } diff --git a/ds9/library/vo.tcl b/ds9/library/vo.tcl index 10ff0fb..aec60ee 100644 --- a/ds9/library/vo.tcl +++ b/ds9/library/vo.tcl @@ -506,7 +506,7 @@ proc VOCmdDisconnect {str} { } } -proc ProcessSendVOCmd {proc id param} { +proc ProcessSendVOCmd {proc id param {sock {}} {fn {}}} { global ivo global pvo diff --git a/ds9/library/wcs.tcl b/ds9/library/wcs.tcl index 53f1171..8d9ceec 100644 --- a/ds9/library/wcs.tcl +++ b/ds9/library/wcs.tcl @@ -1195,7 +1195,7 @@ proc WCSCmdLoadFn {cmd ext fn} { UpdateWCS } -proc ProcessSendWCSCmd {proc id param} { +proc ProcessSendWCSCmd {proc id param {sock {}} {fn {}}} { global current global wcs @@ -1220,7 +1220,7 @@ proc ProcessAlignCmd {varname iname} { incr i [expr $align::yycnt-1] } -proc ProcessSendAlignCmd {proc id param} { +proc ProcessSendAlignCmd {proc id param {sock {}} {fn {}}} { global current $proc $id [ToYesNo $current(align)] diff --git a/ds9/library/xpa.tcl b/ds9/library/xpa.tcl index e4f6d70..00ddf29 100644 --- a/ds9/library/xpa.tcl +++ b/ds9/library/xpa.tcl @@ -2227,7 +2227,7 @@ proc XPACmdSet {varname which value} { set var($which) $value } -proc ProcessSendXPACmd {proc id param} { +proc ProcessSendXPACmd {proc id param {sock {}} {fn {}}} { switch -- [string tolower [lindex $param 0]] { info {$proc $id [XPAInfoResult]} } diff --git a/ds9/make.include b/ds9/make.include index 0d0e028..37a7189 100644 --- a/ds9/make.include +++ b/ds9/make.include @@ -7,13 +7,13 @@ vpath %.fcl $(prefix)/ds9/parsers # -w generate warnings # -d generate lexer table $(prefix)/ds9/parsers/%parser.tcl : %parser.tac - tclsh $(prefix)/taccle/taccle.tcl -p $* -d $< -# tclsh $(prefix)/taccle/taccle.tcl -p $* -d -w -v $< +# tclsh $(prefix)/taccle/taccle.tcl -p $* -d $< + tclsh $(prefix)/taccle/taccle.tcl -p $* -d -w -v $< # -d debug $(prefix)/ds9/parsers/%lex.tcl : %lex.fcl - tclsh $(prefix)/fickle/fickle.tcl -P $* $< -# tclsh $(prefix)/fickle/fickle.tcl -P $* -d $< +# tclsh $(prefix)/fickle/fickle.tcl -P $* $< + tclsh $(prefix)/fickle/fickle.tcl -P $* -d $< #--------------------------library diff --git a/ds9/parsers/binparser.tac b/ds9/parsers/binparser.tac index 4d1f7eb..bcd0f66 100644 --- a/ds9/parsers/binparser.tac +++ b/ds9/parsers/binparser.tac @@ -40,15 +40,15 @@ command : bin bin : OPEN_ {BinDialog} | CLOSE_ {BinDestroyDialog} | MATCH_ {MatchBinCurrent} - | LOCK_ yesno {BinCmdSet lock $2 LockBinCurrent} + | LOCK_ yesno {ProcessCmdSet bin lock $2 LockBinCurrent} | ABOUT_ about - | BUFFERSIZE_ INT_ {BinCmdSet buffersize $2 ChangeBinBufferSize} + | BUFFERSIZE_ INT_ {ProcessCmdSet bin buffersize $2 ChangeBinBufferSize} | COLS_ cols cols {BinCols \"$2\" \"$3\" \"\"} | COLSZ_ cols cols cols {BinCols \"$2\" \"$3\" \"$4\"} | FACTOR_ factor - | DEPTH_ INT_ {BinCmdSet depth $2 ChangeBinDepth} + | DEPTH_ INT_ {ProcessCmdSet bin depth $2 ChangeBinDepth} | FILTER_ filter {BinFilter $2} - | FUNCTION_ function {BinCmdSet function) $2 ChangeBinFunction} + | FUNCTION_ function {ProcessCmdSet bin function $2 ChangeBinFunction} | IN_ {Bin .5 .5} | OUT_ {Bin 2 2} | TO_ to @@ -70,8 +70,8 @@ about : numeric numeric {BinAbout $1 $2} | CENTER_ {BinAboutCenter} ; -factor : numeric {BinCmdSet factor "$1 $1" ChangeBinFactor} - | numeric numeric {BinCmdSet factor "$1 $2"; ChangeBinFactor} +factor : numeric {ProcessCmdSet bin factor "$1 $1" ChangeBinFactor} + | numeric numeric {ProcessCmdSet bin factor "$1 $2" ChangeBinFactor} ; filter : CLEAR_ {set _ {}} -- cgit v0.12