summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-20 16:48:48 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-20 16:48:48 (GMT)
commitd8a46fb55ae9ce363612f91a453413533bbfa307 (patch)
treef15f52f851a3be542373a19729575b3edf05c620
parent764b96185d0b6778f50724d14609e5083f81abec (diff)
downloadblt-d8a46fb55ae9ce363612f91a453413533bbfa307.zip
blt-d8a46fb55ae9ce363612f91a453413533bbfa307.tar.gz
blt-d8a46fb55ae9ce363612f91a453413533bbfa307.tar.bz2
add ds9 data send parser
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/library/util.tcl72
-rw-r--r--ds9/parsers/datasendlex.fcl18
-rw-r--r--ds9/parsers/datasendparser.tac46
4 files changed, 89 insertions, 49 deletions
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index 88d3d76..c2a344a 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -240,6 +240,8 @@ source $ds9(root)/library/cubesendparser.tcl
source $ds9(root)/library/cubesendlex.tcl
source $ds9(root)/library/cursorparser.tcl
source $ds9(root)/library/cursorlex.tcl
+source $ds9(root)/library/datasendparser.tcl
+source $ds9(root)/library/datasendlex.tcl
source $ds9(root)/library/dssesoparser.tcl
source $ds9(root)/library/dssesolex.tcl
source $ds9(root)/library/dssesosendparser.tcl
diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl
index 5aa9a5f..1bf0be1 100644
--- a/ds9/library/util.tcl
+++ b/ds9/library/util.tcl
@@ -1495,60 +1495,34 @@ proc CursorCmd {x y} {
}
proc ProcessSendDataCmd {proc id param sock fn} {
- global cube
- global blink
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
+ set parse(sock) $sock
+ set parse(fn) $fn
+
+ datasend::YY_FLUSH_BUFFER
+ datasend::yy_scan_string $param
+ datasend::yyparse
+}
+
+proc DataSendCmd {sys sky xx yy ww hh strip} {
global current
- if {$current(frame) != {}} {
- set sys [lindex $param 0]
- set sky [lindex $param 1]
- set x [lindex $param 2]
- set y [lindex $param 3]
- set w [lindex $param 4]
- set h [lindex $param 5]
- set strip [lindex $param 6]
- switch -- $sys {
- image -
- physical -
- detector -
- amplifier {
- set strip $h
- set h $w
- set w $y
- set y $x
- set x $sky
- set sky fk5
- }
+ if {$current(frame) == {}} {
+ return
+ }
- fk4 -
- b1950 -
- fk5 -
- j2000 -
- icrs -
- galactic -
- ecliptic {
- set strip $h
- set h $w
- set w $y
- set y $x
- set x $sky
- set sky $sys
- set sys wcs
- }
- }
- set strip [FromYesNo $strip]
-
- $current(frame) get data $sys $sky $x $y $w $h rr
- set ss {}
- foreach ii [array names rr] {
- if {$strip} {
- append ss "$rr($ii)\n"
- } else {
- append ss "$ii = $rr($ii)\n"
- }
+ $current(frame) get data $sys $sky $xx $yy $ww $hh rr
+ set ss {}
+ foreach ii [array names rr] {
+ if {$strip} {
+ append ss "$rr($ii)\n"
+ } else {
+ append ss "$ii = $rr($ii)\n"
}
- ProcessSend $proc $id $sock $fn {.dat} $ss
}
+ ProcessSendCmdResult {.dat} $ss
}
proc ProcessIconifyCmd {varname iname} {
diff --git a/ds9/parsers/datasendlex.fcl b/ds9/parsers/datasendlex.fcl
new file mode 100644
index 0000000..0c632d7
--- /dev/null
+++ b/ds9/parsers/datasendlex.fcl
@@ -0,0 +1,18 @@
+#tab datasendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+#include coordsys.fin
+#include wcssys.fin
+#include skyframe.fin
+#include yesno.fin
+#include numeric.fin
+#include sexstr.fin
+#include ws.fin
+
+%%
diff --git a/ds9/parsers/datasendparser.tac b/ds9/parsers/datasendparser.tac
new file mode 100644
index 0000000..1ffc9fa
--- /dev/null
+++ b/ds9/parsers/datasendparser.tac
@@ -0,0 +1,46 @@
+%{
+%}
+
+#include coordsys.tin
+#include wcssys.tin
+#include skyframe.tin
+#include yesno.tin
+#include numeric.tin
+#include sexstr.tin
+
+%start datasend
+
+%%
+
+#include coordsys.trl
+#include wcssys.trl
+#include skyframe.trl
+#include yesno.trl
+#include numeric.trl
+
+datasend : coordsys numeric numeric INT_ INT_ yesno
+ {DataSendCmd $1 fk5 $2 $3 $4 $5 $6}
+ | wcssys numeric numeric numeric numeric yesno
+ {DataSendCmd $1 fk5 $2 $3 $4 $5 $6}
+ | skyframe numeric numeric numeric numeric yesno
+ {DataSendCmd wcs $1 $2 $3 $4 $5 $6}
+ | wcssys skyframe numeric numeric numeric numeric yesno
+ {DataSendCmd $1 $2 $3 $4 $5 $6 $7}
+
+ | wcssys SEXSTR_ SEXSTR_ numeric numeric yesno
+ {DataSendCmd $1 fk5 $2 $3 $4 $5 $6}
+ | skyframe SEXSTR_ SEXSTR_ numeric numeric yesno
+ {DataSendCmd wcs $1 $2 $3 $4 $5 $6}
+ | wcssys skyframe SEXSTR_ SEXSTR_ numeric numeric yesno
+ {DataSendCmd $1 $2 $3 $4 $5 $6 $7}
+ ;
+
+%%
+
+proc datasend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}