summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-07 18:05:43 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-07 18:05:43 (GMT)
commit6afd05303f916e56011822d03b29b2b4f9b463ab (patch)
tree3ea839eb0acc7a404f9023db85a5ecc9bd9d12e7
parent2c8f85e6ec1aa94588df630d810ff9b1e25b3f10 (diff)
downloadblt-6afd05303f916e56011822d03b29b2b4f9b463ab.zip
blt-6afd05303f916e56011822d03b29b2b4f9b463ab.tar.gz
blt-6afd05303f916e56011822d03b29b2b4f9b463ab.tar.bz2
add ds9 cmap/colorbar send parsers
-rw-r--r--ds9/library/colorbar.tcl38
-rw-r--r--ds9/library/source.tcl4
-rw-r--r--ds9/library/util.tcl15
-rw-r--r--ds9/parsers/binsendparser.tac6
-rw-r--r--ds9/parsers/cmapsendlex.fcl17
-rw-r--r--ds9/parsers/cmapsendparser.tac32
-rw-r--r--ds9/parsers/colorbarsendlex.fcl21
-rw-r--r--ds9/parsers/colorbarsendparser.tac42
-rw-r--r--ds9/parsers/cropsendparser.tac24
-rw-r--r--ds9/parsers/pansendparser.tac16
-rw-r--r--ds9/parsers/regionsendparser.tac4
-rw-r--r--ds9/parsers/scalesendparser.tac4
12 files changed, 181 insertions, 42 deletions
diff --git a/ds9/library/colorbar.tcl b/ds9/library/colorbar.tcl
index 7706fa3..dd60d18 100644
--- a/ds9/library/colorbar.tcl
+++ b/ds9/library/colorbar.tcl
@@ -1245,16 +1245,13 @@ proc CmapValueCmd {c b} {
}
proc ProcessSendCmapCmd {proc id param {sock {}} {fn {}}} {
- global colorbar
- global current
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
- switch -- [string tolower $param] {
- file {$proc $id "[$current(colorbar) get file name]\n"}
- invert {$proc $id [ToYesNo $colorbar(invert)]}
- value {$proc $id "[$current(colorbar) get contrast] [$current(colorbar) get bias]\n"}
- lock {$proc $id [ToYesNo $colorbar(lock)]}
- {} {$proc $id "[$current(colorbar) get name]\n"}
- }
+ cmapsend::YY_FLUSH_BUFFER
+ cmapsend::yy_scan_string $param
+ cmapsend::yyparse
}
proc ProcessColorbarCmd {varname iname} {
@@ -1268,13 +1265,19 @@ proc ProcessColorbarCmd {varname iname} {
}
proc ProcessSendColorbarCmd {proc id param {sock {}} {fn {}}} {
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
+ colorbarsend::YY_FLUSH_BUFFER
+ colorbarsend::yy_scan_string $param
+ colorbarsend::yyparse
+
+ return
global colorbar
global view
switch -- [string tolower [lindex $param 0]] {
- lock {
- $proc $id [ToYesNo $colorbar(lock)]
- }
+ lock {$proc $id [ToYesNo $colorbar(lock)]}
orientation {$proc $id "$colorbar(orientation)\n"}
numerics {$proc $id [ToYesNo $colorbar(numerics)]}
space {
@@ -1297,3 +1300,14 @@ proc ProcessSendColorbarCmd {proc id param {sock {}} {fn {}}} {
default {$proc $id [ToYesNo $view(colorbar)]}
}
}
+
+proc ColorbarSendCmdSpace {} {
+ global parse
+ global colorbar
+
+ if {$colorbar(space)} {
+ $parse(proc) $parse(id) "value\n"
+ } else {
+ $parse(proc) $parse(id) "distance\n"
+ }
+}
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index 5a2ddc1..8c439ab 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -214,8 +214,12 @@ source $ds9(root)/library/catsendparser.tcl
source $ds9(root)/library/catsendlex.tcl
source $ds9(root)/library/cmapparser.tcl
source $ds9(root)/library/cmaplex.tcl
+source $ds9(root)/library/cmapsendparser.tcl
+source $ds9(root)/library/cmapsendlex.tcl
source $ds9(root)/library/colorbarparser.tcl
source $ds9(root)/library/colorbarlex.tcl
+source $ds9(root)/library/colorbarsendparser.tcl
+source $ds9(root)/library/colorbarsendlex.tcl
source $ds9(root)/library/contourparser.tcl
source $ds9(root)/library/contourlex.tcl
source $ds9(root)/library/contoursendparser.tcl
diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl
index 9c89ca1..1f03068 100644
--- a/ds9/library/util.tcl
+++ b/ds9/library/util.tcl
@@ -318,12 +318,21 @@ proc ProcessSendCmdYesNo {varname key} {
$parse(proc) $parse(id) [ToYesNo $var($key)]
}
-proc ProcessSendCmdCurrent {cmd} {
+proc ProcessSendCmdCurrent {key cmd} {
global parse
global current
- if {$current(frame) != {}} {
- $parse(proc) $parse(id) "[$current(frame) $cmd]\n"
+ 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"
}
}
diff --git a/ds9/parsers/binsendparser.tac b/ds9/parsers/binsendparser.tac
index 7c6266f..f855995 100644
--- a/ds9/parsers/binsendparser.tac
+++ b/ds9/parsers/binsendparser.tac
@@ -17,12 +17,12 @@
%%
binsend : LOCK_ {ProcessSendCmdYesNo bin lock}
- | ABOUT_ {ProcessSendCmdCurrent "get bin cursor"}
+ | ABOUT_ {ProcessSendCmdCurrent frame "get bin cursor"}
| BUFFERSIZE_ {ProcessSendCmdGet bin buffersize}
- | COLS_ {ProcessSendCmdCurrent "get bin cols"}
+ | COLS_ {ProcessSendCmdCurrent frame "get bin cols"}
| FACTOR_ {ProcessSendCmdGet bin factor}
| DEPTH_ {ProcessSendCmdGet bin depth}
- | FILTER_ {ProcessSendCmdCurrent "get bin filter"}
+ | FILTER_ {ProcessSendCmdCurrent frame "get bin filter"}
| FUNCTION_ {ProcessSendCmdGet bin function}
;
diff --git a/ds9/parsers/cmapsendlex.fcl b/ds9/parsers/cmapsendlex.fcl
new file mode 100644
index 0000000..7a6af6c
--- /dev/null
+++ b/ds9/parsers/cmapsendlex.fcl
@@ -0,0 +1,17 @@
+#tab cmapsendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+file {return $FILE_}
+invert {return $INVERT_}
+lock {return $LOCK_}
+value {return $VALUE_}
+
+#include string.fin
+
+%%
diff --git a/ds9/parsers/cmapsendparser.tac b/ds9/parsers/cmapsendparser.tac
new file mode 100644
index 0000000..24ec0cd
--- /dev/null
+++ b/ds9/parsers/cmapsendparser.tac
@@ -0,0 +1,32 @@
+%{
+%}
+
+#include string.tin
+
+%start cmapsend
+
+%token FILE_
+%token INVERT_
+%token LOCK_
+%token VALUE_
+
+%%
+
+cmapsend : {ProcessSendCmdCurrent colorbar "get name"}
+ | FILE_ {ProcessSendCmdCurrent colorbar "get file name"}
+ | INVERT_ {ProcessSendCmdYesNo colorbar invert}
+# backward compatibility
+ | VALUE_ {ProcessSendCmdCurrent2 colorbar "get contrast" "get bias"}
+# backward compatibility
+ | LOCK_ {ProcessSendCmdYesNo colorbar lock}
+ ;
+
+%%
+
+proc cmapsend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
diff --git a/ds9/parsers/colorbarsendlex.fcl b/ds9/parsers/colorbarsendlex.fcl
new file mode 100644
index 0000000..05d06f2
--- /dev/null
+++ b/ds9/parsers/colorbarsendlex.fcl
@@ -0,0 +1,21 @@
+#tab colorbarsendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+lock {return $LOCK_}
+numerics {return $NUMERICS_}
+orientation {return $ORIENTATION_}
+size {return $SIZE_}
+space {return $SPACE_}
+ticks {return $TICKS_}
+value {return $VALUE_}
+
+#include font.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/colorbarsendparser.tac b/ds9/parsers/colorbarsendparser.tac
new file mode 100644
index 0000000..0f27545
--- /dev/null
+++ b/ds9/parsers/colorbarsendparser.tac
@@ -0,0 +1,42 @@
+%{
+%}
+
+#include font.tin
+#include string.tin
+
+%start colorbarsend
+
+%token LOCK_
+%token NUMERICS_
+%token ORIENTATION_
+%token SIZE_
+%token SPACE_
+%token TICKS_
+%token VALUE_
+
+%%
+
+colorbarsend : {ProcessSendCmdYesNo view colorbar}
+ | LOCK_ {ProcessSendCmdYesNo colorbar lock}
+ | ORIENTATION_ {ProcessSendCmdGet colorbar orientation}
+ | NUMERICS_ {ProcessSendCmdYesNo colorbar numerics}
+ | SPACE_ {ColorbarSendCmdSpace}
+ | FONT_ {ProcessSendCmdGet colorbar font}
+ | FONTSIZE_ {ProcessSendCmdGet colorbar font,size}
+ | FONTWEIGHT_ {ProcessSendCmdGet colorbar font,weight}
+ | FONTSLANT_ {ProcessSendCmdGet colorbar font,slant}
+# backward compatibility
+ | FONTSTYLE_ {ProcessSendCmdGet colorbar font,weight}
+ | SIZE_ {ProcessSendCmdGet colorbar size}
+ | TICKS_ {ProcessSendCmdGet colorbar ticks}
+ ;
+
+%%
+
+proc colorbarsend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
diff --git a/ds9/parsers/cropsendparser.tac b/ds9/parsers/cropsendparser.tac
index b6100cb..96e97ef 100644
--- a/ds9/parsers/cropsendparser.tac
+++ b/ds9/parsers/cropsendparser.tac
@@ -14,32 +14,32 @@
#include matchlock.trl
#include coords.trl
-cropsend : {ProcessSendCmdCurrent "get crop center physical fk5 degrees physical degrees"}
- | coordsys {ProcessSendCmdCurrent "get crop center $1 fk5 degrees $1 degrees"}
+cropsend : {ProcessSendCmdCurrent frame "get crop center physical fk5 degrees physical degrees"}
+ | coordsys {ProcessSendCmdCurrent frame "get crop center $1 fk5 degrees $1 degrees"}
- | wcssys {ProcessSendCmdCurrent "get crop center $1 fk5 degrees $1 degrees"}
- | skyframe {ProcessSendCmdCurrent "get crop center wcs $1 degrees wcs degrees"}
+ | wcssys {ProcessSendCmdCurrent frame "get crop center $1 fk5 degrees $1 degrees"}
+ | skyframe {ProcessSendCmdCurrent frame "get crop center wcs $1 degrees wcs degrees"}
| wcssys skyformat
- {ProcessSendCmdCurrent "get crop center $1 fk5 $2 $1 degrees"}
+ {ProcessSendCmdCurrent frame "get crop center $1 fk5 $2 $1 degrees"}
| skyframe skyformat
- {ProcessSendCmdCurrent "get crop center wcs $1 $2 wcs degrees"}
+ {ProcessSendCmdCurrent frame "get crop center wcs $1 $2 wcs degrees"}
| wcssys skyformat rformat
- {ProcessSendCmdCurrent "get crop center $1 fk5 $2 $1 $3"}
+ {ProcessSendCmdCurrent frame "get crop center $1 fk5 $2 $1 $3"}
| skyframe skyformat rformat
- {ProcessSendCmdCurrent "get crop center wcs $1 $2 wcs $3"}
+ {ProcessSendCmdCurrent frame "get crop center wcs $1 $2 wcs $3"}
| wcssys skyframe skyformat rformat
- {ProcessSendCmdCurrent "get crop center $1 $2 $3 $1 $4"}
+ {ProcessSendCmdCurrent frame "get crop center $1 $2 $3 $1 $4"}
| 3D_ 3d
| LOCK_ {ProcessSendCmdGet crop lock}
;
-3d : {ProcessSendCmdCurrent "get crop 3d image"}
- | coordsys {ProcessSendCmdCurrent "get crop 3d $1"}
- | wcssys {ProcessSendCmdCurrent "get crop 3d $1"}
+3d : {ProcessSendCmdCurrent frame "get crop 3d image"}
+ | coordsys {ProcessSendCmdCurrent frame "get crop 3d $1"}
+ | wcssys {ProcessSendCmdCurrent frame "get crop 3d $1"}
;
%%
diff --git a/ds9/parsers/pansendparser.tac b/ds9/parsers/pansendparser.tac
index d9d4481..806104d 100644
--- a/ds9/parsers/pansendparser.tac
+++ b/ds9/parsers/pansendparser.tac
@@ -10,14 +10,14 @@
#include coords.trl
-pansend : {ProcessSendCmdCurrent "get cursor image 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"}
+pansend : {ProcessSendCmdCurrent frame "get cursor image 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"}
;
%%
diff --git a/ds9/parsers/regionsendparser.tac b/ds9/parsers/regionsendparser.tac
index 294bd97..26149c5 100644
--- a/ds9/parsers/regionsendparser.tac
+++ b/ds9/parsers/regionsendparser.tac
@@ -76,8 +76,8 @@ regionsend : {RegionSendCmd}
| SHAPE_ {ProcessSendCmdGet marker shape}
| COLOR_ {ProcessSendCmdGet marker color}
| WIDTH_ {ProcessSendCmdGet marker width}
- | GROUP_ {ProcessSendCmdCurrent "get marker tag all"}
- | GROUPS_ {ProcessSendCmdCurrent "get marker tag all"}
+ | GROUP_ {ProcessSendCmdCurrent frame "get marker tag all"}
+ | GROUPS_ {ProcessSendCmdCurrent frame "get marker tag all"}
;
centroid: AUTO_ {ProcessSendCmdYesNo marker centroid,auto}
diff --git a/ds9/parsers/scalesendparser.tac b/ds9/parsers/scalesendparser.tac
index b47f4a6..1af2c5b 100644
--- a/ds9/parsers/scalesendparser.tac
+++ b/ds9/parsers/scalesendparser.tac
@@ -20,9 +20,9 @@ scalesend : {ProcessSendCmdGet scale type}
| LOCK_ {ProcessSendCmdYesNo scale lock}
| LOCK_ LIMITS_ {ProcessSendCmdYesNo scale lock,limits}
| DATASEC_ {ProcessSendCmdGet scale datasec}
- | LIMITS_ {ProcessSendCmdCurrent "get clip"}
+ | LIMITS_ {ProcessSendCmdCurrent frame "get clip"}
# backward compatibility
- | SCALELIMITS_ {ProcessSendCmdCurrent "get clip"}
+ | SCALELIMITS_ {ProcessSendCmdCurrent frame "get clip"}
| MODE_ {ProcessSendCmdGet scale mode}
| SCOPE_ {ProcessSendCmdGet scale scope}
| LOG_ EXP_ {ProcessSendCmdGet scale log}