From e18118239079bc8b1881e2095a3b5f6a3ff7a15b Mon Sep 17 00:00:00 2001 From: William Joye Date: Mon, 18 Jun 2018 16:22:30 -0400 Subject: update ds9 parsers --- ds9/library/colorbar.tcl | 18 ++++++++++++++++++ ds9/library/util.tcl | 25 +++++++------------------ ds9/parsers/binsendparser.tac | 6 +++--- ds9/parsers/cmapsendparser.tac | 6 +++--- ds9/parsers/cropsendparser.tac | 24 ++++++++++++------------ ds9/parsers/crosshairsendparser.tac | 16 ++++++++-------- ds9/parsers/cubesendparser.tac | 2 +- ds9/parsers/framesendparser.tac | 20 ++++++++++---------- ds9/parsers/iissendparser.tac | 8 ++++---- ds9/parsers/pansendparser.tac | 16 ++++++++-------- ds9/parsers/regionsendparser.tac | 4 ++-- ds9/parsers/scalesendparser.tac | 4 ++-- 12 files changed, 78 insertions(+), 71 deletions(-) diff --git a/ds9/library/colorbar.tcl b/ds9/library/colorbar.tcl index 08bfbdb..251a638 100644 --- a/ds9/library/colorbar.tcl +++ b/ds9/library/colorbar.tcl @@ -1273,6 +1273,24 @@ proc ProcessSendColorbarCmd {proc id param {sock {}} {fn {}}} { colorbarsend::yyparse } +proc ColorbarSendCmdCurrent {cmd} { + global parse + global current + + if {$current(colorbar) != {}} { + $parse(proc) $parse(id) "[$current(colorbar) $cmd]\n" + } +} + +proc ColorbarSendCmdContrastBias {} { + global parse + global current + + if {$current(colorbar) != {}} { + $parse(proc) $parse(id) "[$current(colorbar) get contrast] [$current(colorbar) get bias]\n" + } +} + proc ColorbarSendCmdSpace {} { global parse global colorbar diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index 6ae250f..98d8d2c 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -339,30 +339,21 @@ proc ProcessSendCmdYesNo {varname key} { $parse(proc) $parse(id) [ToYesNo $var($key)] } -proc ProcessSendCmdCurrent {key cmd} { +proc ProcessSendCmdCurrent {cmd} { global parse global current - if {$current($key) != {}} { - $parse(proc) $parse(id) "[$current($key) $cmd]\n" - } -} - -proc ProcessSendCmdCurrent2 {key cmd cmd2} { - global parse - global current - - if {$current($key) != {}} { - $parse(proc) $parse(id) "[$current($key) $cmd] [$current($key) $cmd2]\n" + if {$current(frame) != {}} { + $parse(proc) $parse(id) "[$current(frame) $cmd]\n" } } -proc ProcessSendCmdCurrentYesNo {key cmd} { +proc ProcessSendCmdCurrentYesNo {cmd} { global parse global current - if {$current($key) != {}} { - $parse(proc) $parse(id) "[ToYesNo [$current($key) $cmd]]" + if {$current(frame) != {}} { + $parse(proc) $parse(id) "[ToYesNo [$current(frame) $cmd]]" } } @@ -371,10 +362,8 @@ proc ProcessSendCmdSend {ext cmd} { global current if {$current(frame) == {}} { - return + ProcessSendCmdResult $ext [$current(frame) $cmd] } - - ProcessSendCmdResult $ext [$current(frame) $cmd] } proc ProcessSendCmdResult {ext rr} { diff --git a/ds9/parsers/binsendparser.tac b/ds9/parsers/binsendparser.tac index eb0fc89..ac130b1 100644 --- a/ds9/parsers/binsendparser.tac +++ b/ds9/parsers/binsendparser.tac @@ -15,12 +15,12 @@ %% binsend : LOCK_ {ProcessSendCmdYesNo bin lock} - | ABOUT_ {ProcessSendCmdCurrent frame "get bin cursor"} + | ABOUT_ {ProcessSendCmdCurrent "get bin cursor"} | BUFFERSIZE_ {ProcessSendCmdGet bin buffersize} - | COLS_ {ProcessSendCmdCurrent frame "get bin cols"} + | COLS_ {ProcessSendCmdCurrent "get bin cols"} | FACTOR_ {ProcessSendCmdGet bin factor} | DEPTH_ {ProcessSendCmdGet bin depth} - | FILTER_ {ProcessSendCmdCurrent frame "get bin filter"} + | FILTER_ {ProcessSendCmdCurrent "get bin filter"} | FUNCTION_ {ProcessSendCmdGet bin function} ; diff --git a/ds9/parsers/cmapsendparser.tac b/ds9/parsers/cmapsendparser.tac index 4d1a201..940ca8d 100644 --- a/ds9/parsers/cmapsendparser.tac +++ b/ds9/parsers/cmapsendparser.tac @@ -10,11 +10,11 @@ %% -cmapsend : {ProcessSendCmdCurrent colorbar "get name"} - | FILE_ {ProcessSendCmdCurrent colorbar "get file name"} +cmapsend : {ColorbarSendCmdCurrent "get name"} + | FILE_ {ColorbarSendCmdCurrent "get file name"} | INVERT_ {ProcessSendCmdYesNo colorbar invert} # backward compatibility - | VALUE_ {ProcessSendCmdCurrent2 colorbar "get contrast" "get bias"} + | VALUE_ {ColorbarSendCmdContrastBias} # backward compatibility | LOCK_ {ProcessSendCmdYesNo colorbar lock} ; diff --git a/ds9/parsers/cropsendparser.tac b/ds9/parsers/cropsendparser.tac index a65d44b..3fac322 100644 --- a/ds9/parsers/cropsendparser.tac +++ b/ds9/parsers/cropsendparser.tac @@ -18,32 +18,32 @@ #include skyframe.trl #include wcsformat.trl -cropsend : {ProcessSendCmdCurrent frame "get crop center physical fk5 degrees physical degrees"} - | coordsys {ProcessSendCmdCurrent frame "get crop center $1 fk5 degrees $1 degrees"} +cropsend : {ProcessSendCmdCurrent "get crop center physical fk5 degrees physical degrees"} + | coordsys {ProcessSendCmdCurrent "get crop center $1 fk5 degrees $1 degrees"} - | wcssys {ProcessSendCmdCurrent frame "get crop center $1 fk5 degrees $1 degrees"} - | skyframe {ProcessSendCmdCurrent frame "get crop center wcs $1 degrees wcs degrees"} + | wcssys {ProcessSendCmdCurrent "get crop center $1 fk5 degrees $1 degrees"} + | skyframe {ProcessSendCmdCurrent "get crop center wcs $1 degrees wcs degrees"} | wcssys skyformat - {ProcessSendCmdCurrent frame "get crop center $1 fk5 $2 $1 degrees"} + {ProcessSendCmdCurrent "get crop center $1 fk5 $2 $1 degrees"} | skyframe skyformat - {ProcessSendCmdCurrent frame "get crop center wcs $1 $2 wcs degrees"} + {ProcessSendCmdCurrent "get crop center wcs $1 $2 wcs degrees"} | wcssys skyformat rformat - {ProcessSendCmdCurrent frame "get crop center $1 fk5 $2 $1 $3"} + {ProcessSendCmdCurrent "get crop center $1 fk5 $2 $1 $3"} | skyframe skyformat rformat - {ProcessSendCmdCurrent frame "get crop center wcs $1 $2 wcs $3"} + {ProcessSendCmdCurrent "get crop center wcs $1 $2 wcs $3"} | wcssys skyframe skyformat rformat - {ProcessSendCmdCurrent frame "get crop center $1 $2 $3 $1 $4"} + {ProcessSendCmdCurrent "get crop center $1 $2 $3 $1 $4"} | 3D_ 3d | LOCK_ {ProcessSendCmdGet crop lock} ; -3d : {ProcessSendCmdCurrent frame "get crop 3d image"} - | coordsys {ProcessSendCmdCurrent frame "get crop 3d $1"} - | wcssys {ProcessSendCmdCurrent frame "get crop 3d $1"} +3d : {ProcessSendCmdCurrent "get crop 3d image"} + | coordsys {ProcessSendCmdCurrent "get crop 3d $1"} + | wcssys {ProcessSendCmdCurrent "get crop 3d $1"} ; %% diff --git a/ds9/parsers/crosshairsendparser.tac b/ds9/parsers/crosshairsendparser.tac index e60b972..017a73d 100644 --- a/ds9/parsers/crosshairsendparser.tac +++ b/ds9/parsers/crosshairsendparser.tac @@ -17,14 +17,14 @@ #include skyframe.trl #include skyformat.trl -crosshairsend : {ProcessSendCmdCurrent frame "get crosshair physical fk5 degrees"} - | coordsys {ProcessSendCmdCurrent frame "get crosshair $1 fk5 degrees"} - | wcssys {ProcessSendCmdCurrent frame "get crosshair $1 fk5 degrees"} - | skyframe {ProcessSendCmdCurrent frame "get crosshair wcs $1 degrees"} - | wcssys skyframe {ProcessSendCmdCurrent frame "get crosshair $1 $2 degrees"} - | wcssys skyformat {ProcessSendCmdCurrent frame "get crosshair $1 fk5 $2"} - | skyframe skyformat {ProcessSendCmdCurrent frame "get crosshair wcs $1 $2"} - | wcssys skyframe skyformat {ProcessSendCmdCurrent frame "get crosshair $1 $2 $3"} +crosshairsend : {ProcessSendCmdCurrent "get crosshair physical fk5 degrees"} + | coordsys {ProcessSendCmdCurrent "get crosshair $1 fk5 degrees"} + | wcssys {ProcessSendCmdCurrent "get crosshair $1 fk5 degrees"} + | skyframe {ProcessSendCmdCurrent "get crosshair wcs $1 degrees"} + | wcssys skyframe {ProcessSendCmdCurrent "get crosshair $1 $2 degrees"} + | wcssys skyformat {ProcessSendCmdCurrent "get crosshair $1 fk5 $2"} + | skyframe skyformat {ProcessSendCmdCurrent "get crosshair wcs $1 $2"} + | wcssys skyframe skyformat {ProcessSendCmdCurrent "get crosshair $1 $2 $3"} | LOCK_ {ProcessSendCmdGet crosshair lock} ; diff --git a/ds9/parsers/cubesendparser.tac b/ds9/parsers/cubesendparser.tac index 328770d..0c8ae1e 100644 --- a/ds9/parsers/cubesendparser.tac +++ b/ds9/parsers/cubesendparser.tac @@ -11,7 +11,7 @@ %% -cubesend : {global cube; ProcessSendCmdCurrent frame "get fits slice $cube(axis)"} +cubesend : {global cube; ProcessSendCmdCurrent "get fits slice $cube(axis)"} | LOCK_ {ProcessSendCmdGet cube lock} | INTERVAL_ {BlinkSendCmdInterval} | AXIS_ {ProcessSendCmdGet cube axis} diff --git a/ds9/parsers/framesendparser.tac b/ds9/parsers/framesendparser.tac index 1efe865..8a01dc1 100644 --- a/ds9/parsers/framesendparser.tac +++ b/ds9/parsers/framesendparser.tac @@ -45,12 +45,12 @@ framesend : {FrameSendCmd} | HAS_ has ; -has : coordsys {ProcessSendCmdCurrentYesNo frame "has $1"} - | wcssys {ProcessSendCmdCurrentYesNo frame "has wcs $1"} - | param {ProcessSendCmdCurrentYesNo frame "has $1"} - | CONTOUR_ contour {ProcessSendCmdCurrentYesNo frame "has contour $2"} - | FITS_ fits {ProcessSendCmdCurrentYesNo frame "has fits $2"} - | MARKER_ marker {ProcessSendCmdCurrentYesNo frame "has marker $2"} +has : coordsys {ProcessSendCmdCurrentYesNo "has $1"} + | wcssys {ProcessSendCmdCurrentYesNo "has wcs $1"} + | param {ProcessSendCmdCurrentYesNo "has $1"} + | CONTOUR_ contour {ProcessSendCmdCurrentYesNo "has contour $2"} + | FITS_ fits {ProcessSendCmdCurrentYesNo "has fits $2"} + | MARKER_ marker {ProcessSendCmdCurrentYesNo "has marker $2"} | SYSTEM_ system | WCS_ wcs ; @@ -79,12 +79,12 @@ marker : HIGHLITE_ {set _ highlite} | UNDO_ {set _ undo} ; -system : coordsys {ProcessSendCmdCurrentYesNo frame "has $1"} - | wcssys {ProcessSendCmdCurrentYesNo frame "has wcs $1"} +system : coordsys {ProcessSendCmdCurrentYesNo "has $1"} + | wcssys {ProcessSendCmdCurrentYesNo "has wcs $1"} ; -wcs : wcssys {ProcessSendCmdCurrentYesNo frame "has wcs $1"} - | wcstype wcssys {ProcessSendCmdCurrentYesNo frame "has wcs $1 $2"} +wcs : wcssys {ProcessSendCmdCurrentYesNo "has wcs $1"} + | wcstype wcssys {ProcessSendCmdCurrentYesNo "has wcs $1 $2"} ; wcstype : EQUATORIAL_ {set _ equatorial} diff --git a/ds9/parsers/iissendparser.tac b/ds9/parsers/iissendparser.tac index 524c90d..659df3a 100644 --- a/ds9/parsers/iissendparser.tac +++ b/ds9/parsers/iissendparser.tac @@ -9,10 +9,10 @@ %% -iissend : {ProcessSendCmdCurrent frame "get iis file name 1"} - | INT_ {ProcessSendCmdCurrent frame "get iis file name $1"} - | FILENAME_ {ProcessSendCmdCurrent frame "get iis file name 1"} - | FILENAME_ INT_ {ProcessSendCmdCurrent frame "get iis file name $2"} +iissend : {ProcessSendCmdCurrent "get iis file name 1"} + | INT_ {ProcessSendCmdCurrent "get iis file name $1"} + | FILENAME_ {ProcessSendCmdCurrent "get iis file name 1"} + | FILENAME_ INT_ {ProcessSendCmdCurrent "get iis file name $2"} ; %% diff --git a/ds9/parsers/pansendparser.tac b/ds9/parsers/pansendparser.tac index 2e201ae..afb9076 100644 --- a/ds9/parsers/pansendparser.tac +++ b/ds9/parsers/pansendparser.tac @@ -15,14 +15,14 @@ #include skyframe.trl #include skyformat.trl -pansend : {ProcessSendCmdCurrent frame "get cursor physical fk5 degrees"} - | coordsys {ProcessSendCmdCurrent frame "get cursor $1 fk5 degrees"} - | wcssys {ProcessSendCmdCurrent frame "get cursor $1 fk5 degrees"} - | skyframe {ProcessSendCmdCurrent frame "get cursor wcs $1 degrees"} - | wcssys skyframe {ProcessSendCmdCurrent frame "get cursor $1 $2 degrees"} - | wcssys skyformat {ProcessSendCmdCurrent frame "get cursor $1 fk5 $2"} - | skyframe skyformat {ProcessSendCmdCurrent frame "get cursor wcs $1 $2"} - | wcssys skyframe skyformat {ProcessSendCmdCurrent frame "get cursor $1 $2 $3"} +pansend : {ProcessSendCmdCurrent "get cursor physical fk5 degrees"} + | coordsys {ProcessSendCmdCurrent "get cursor $1 fk5 degrees"} + | wcssys {ProcessSendCmdCurrent "get cursor $1 fk5 degrees"} + | skyframe {ProcessSendCmdCurrent "get cursor wcs $1 degrees"} + | wcssys skyframe {ProcessSendCmdCurrent "get cursor $1 $2 degrees"} + | wcssys skyformat {ProcessSendCmdCurrent "get cursor $1 fk5 $2"} + | skyframe skyformat {ProcessSendCmdCurrent "get cursor wcs $1 $2"} + | wcssys skyframe skyformat {ProcessSendCmdCurrent "get cursor $1 $2 $3"} ; %% diff --git a/ds9/parsers/regionsendparser.tac b/ds9/parsers/regionsendparser.tac index d3d11bf..954b960 100644 --- a/ds9/parsers/regionsendparser.tac +++ b/ds9/parsers/regionsendparser.tac @@ -81,8 +81,8 @@ regionsend : {RegionSendCmd} | SHAPE_ {ProcessSendCmdGet marker shape} | COLOR_ {ProcessSendCmdGet marker color} | WIDTH_ {ProcessSendCmdGet marker width} - | GROUP_ {ProcessSendCmdCurrent frame "get marker tag all"} - | GROUPS_ {ProcessSendCmdCurrent frame "get marker tag all"} + | GROUP_ {ProcessSendCmdCurrent "get marker tag all"} + | GROUPS_ {ProcessSendCmdCurrent "get marker tag all"} ; centroid: AUTO_ {ProcessSendCmdYesNo marker centroid,auto} diff --git a/ds9/parsers/scalesendparser.tac b/ds9/parsers/scalesendparser.tac index 9e301b2..0348819 100644 --- a/ds9/parsers/scalesendparser.tac +++ b/ds9/parsers/scalesendparser.tac @@ -18,9 +18,9 @@ scalesend : {ProcessSendCmdGet scale type} | LOCK_ {ProcessSendCmdYesNo scale lock} | LOCK_ LIMITS_ {ProcessSendCmdYesNo scale lock,limits} | DATASEC_ {ProcessSendCmdGet scale datasec} - | LIMITS_ {ProcessSendCmdCurrent frame "get clip"} + | LIMITS_ {ProcessSendCmdCurrent "get clip"} # backward compatibility - | SCALELIMITS_ {ProcessSendCmdCurrent frame "get clip"} + | SCALELIMITS_ {ProcessSendCmdCurrent "get clip"} | MODE_ {ProcessSendCmdGet scale mode} | SCOPE_ {ProcessSendCmdGet scale scope} | LOG_ EXP_ {ProcessSendCmdGet scale log} -- cgit v0.12