summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-18 18:17:21 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-18 18:17:21 (GMT)
commit671eda8b795f09fa708fb36c5212c9b8c339eb83 (patch)
tree1584a4dc84f6cbebfed285a27e72fe077cc296f8 /ds9
parent212ccd4858884d2110f4ff07324e6315c9ce940b (diff)
downloadblt-671eda8b795f09fa708fb36c5212c9b8c339eb83.zip
blt-671eda8b795f09fa708fb36c5212c9b8c339eb83.tar.gz
blt-671eda8b795f09fa708fb36c5212c9b8c339eb83.tar.bz2
add ds9 frame send parser
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/frame.tcl26
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/library/util.tcl9
-rw-r--r--ds9/parsers/framesendlex.fcl40
-rw-r--r--ds9/parsers/framesendparser.tac102
5 files changed, 179 insertions, 0 deletions
diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl
index efd630b..b1d3719 100644
--- a/ds9/library/frame.tcl
+++ b/ds9/library/frame.tcl
@@ -2063,6 +2063,15 @@ proc ProcessFrameCmd {varname iname} {
}
proc ProcessSendFrameCmd {proc id param {sock {}} {fn {}}} {
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
+
+ framesend::YY_FLUSH_BUFFER
+ framesend::yy_scan_string $param
+ framesend::yyparse
+ return
+
global ds9
global current
global rgb
@@ -2136,6 +2145,23 @@ proc ProcessSendFrameCmd {proc id param {sock {}} {fn {}}} {
}
}
+proc FrameSendCmd {} {
+ global parse
+ global current
+ $parse(proc) $parse(id) "[string range $current(frame) 5 end]\n"
+}
+
+proc FrameSendCmdGet {which} {
+ global parse
+ global ds9
+
+ set rr {}
+ foreach ff $ds9($which) {
+ append rr "[string range $ff 5 end] "
+ }
+ $parse(proc) $parse(id) "$rr\n"
+}
+
proc ProcessSingleCmd {varname iname} {
upvar $varname var
upvar $iname i
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index 29e11c7..823dded 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -260,6 +260,8 @@ source $ds9(root)/library/fitsparser.tcl
source $ds9(root)/library/fitslex.tcl
source $ds9(root)/library/frameparser.tcl
source $ds9(root)/library/framelex.tcl
+source $ds9(root)/library/framesendparser.tcl
+source $ds9(root)/library/framesendlex.tcl
source $ds9(root)/library/gridparser.tcl
source $ds9(root)/library/gridlex.tcl
source $ds9(root)/library/gridsendparser.tcl
diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl
index 04073f2..6ae250f 100644
--- a/ds9/library/util.tcl
+++ b/ds9/library/util.tcl
@@ -357,6 +357,15 @@ proc ProcessSendCmdCurrent2 {key cmd cmd2} {
}
}
+proc ProcessSendCmdCurrentYesNo {key cmd} {
+ global parse
+ global current
+
+ if {$current($key) != {}} {
+ $parse(proc) $parse(id) "[ToYesNo [$current($key) $cmd]]"
+ }
+}
+
proc ProcessSendCmdSend {ext cmd} {
global parse
global current
diff --git a/ds9/parsers/framesendlex.fcl b/ds9/parsers/framesendlex.fcl
new file mode 100644
index 0000000..4fe5af3
--- /dev/null
+++ b/ds9/parsers/framesendlex.fcl
@@ -0,0 +1,40 @@
+#tab framesendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+active {return $ACTIVE_}
+all {return $ALL_}
+aux {return $AUX_}
+bin {return $BIN_}
+contour {return $CONTOUR_}
+cube {return $CUBE_}
+datamin {return $DATAMIN_}
+datasec {return $DATASEC_}
+equatorial {return $EQUATORIAL_}
+fits {return $FITS_}
+frameno {return $FRAMENO_}
+grid {return $GRID_}
+has {return $HAS_}
+highlite {return $HIGHLITE_}
+iis {return $IIS_}
+irafmin {return $IRAFMIN_}
+linear {return $LINEAR_}
+lock {return $LOCK_}
+marker {return $MARKER_}
+mosaic {return $MOSAIC_}
+paste {return $PASTE_}
+select {return $SELECT_}
+smooth {return $SMOOTH_}
+system {return $SYSTEM_}
+undo {return $UNDO_}
+
+#include coordsys.fin
+#include wcssys.fin
+#include ws.fin
+
+%%
diff --git a/ds9/parsers/framesendparser.tac b/ds9/parsers/framesendparser.tac
new file mode 100644
index 0000000..1efe865
--- /dev/null
+++ b/ds9/parsers/framesendparser.tac
@@ -0,0 +1,102 @@
+%{
+%}
+
+#include coordsys.tin
+#include wcssys.tin
+
+%start framesend
+
+%token ACTIVE_
+%token ALL_
+%token AUX_
+%token BIN_
+%token CONTOUR_
+%token CUBE_
+%token DATAMIN_
+%token DATASEC_
+%token EQUATORIAL_
+%token FITS_
+%token FRAMENO_
+%token GRID_
+%token HAS_
+%token HIGHLITE_
+%token IIS_
+%token IRAFMIN_
+%token LINEAR_
+%token LOCK_
+%token MARKER_
+%token MOSAIC_
+%token PASTE_
+%token SELECT_
+%token SMOOTH_
+%token SYSTEM_
+%token UNDO_
+
+%%
+
+#include coordsys.trl
+#include wcssys.trl
+
+framesend : {FrameSendCmd}
+ | FRAMENO_ {FrameSendCmd}
+ | LOCK_ {ProcessSendCmdGet panzoom lock}
+ | ACTIVE_ {FrameSendCmdGet active}
+ | ALL_ {FrameSendCmdGet frames}
+ | 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"}
+ | SYSTEM_ system
+ | WCS_ wcs
+ ;
+
+param : IIS_ {set _ iis}
+ | DATAMIN_ {set _ datamin}
+ | IRAFMIN_ {set _ irafmin}
+ | DATASEC_ {set _ datasec}
+ | GRID_ {set _ grid}
+ | SMOOTH_ {set _ smooth}
+ ;
+
+contour : {set _ {}}
+ | AUX_ {set _ aux}
+ ;
+
+fits : {set _ {}}
+ | BIN_ {set _ bin}
+ | CUBE_ {set _ cube}
+ | MOSAIC_ {set _ mosaic}
+ ;
+
+marker : HIGHLITE_ {set _ highlite}
+ | PASTE_ {set _ paste}
+ | SELECT_ {set _ select}
+ | UNDO_ {set _ undo}
+ ;
+
+system : coordsys {ProcessSendCmdCurrentYesNo frame "has $1"}
+ | wcssys {ProcessSendCmdCurrentYesNo frame "has wcs $1"}
+ ;
+
+wcs : wcssys {ProcessSendCmdCurrentYesNo frame "has wcs $1"}
+ | wcstype wcssys {ProcessSendCmdCurrentYesNo frame "has wcs $1 $2"}
+ ;
+
+wcstype : EQUATORIAL_ {set _ equatorial}
+ | LINEAR_ {set _ linear}
+ ;
+
+%%
+
+proc framesend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}