summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-07 18:57:14 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-07 18:57:14 (GMT)
commit4fc3cdba34e1f5656fd0ecd62dbd10d3f608a399 (patch)
tree8aca19febd6de529d6ec366eee60ee229277a927 /ds9
parent0f031457dc54364fd58dcecc3c635e5b5c727c73 (diff)
downloadblt-4fc3cdba34e1f5656fd0ecd62dbd10d3f608a399.zip
blt-4fc3cdba34e1f5656fd0ecd62dbd10d3f608a399.tar.gz
blt-4fc3cdba34e1f5656fd0ecd62dbd10d3f608a399.tar.bz2
add ds9 crosshair send parser
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/crosshair.tcl21
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/parsers/crosshairsendlex.fcl16
-rw-r--r--ds9/parsers/crosshairsendparser.tac34
-rw-r--r--ds9/parsers/pansendparser.tac2
5 files changed, 59 insertions, 16 deletions
diff --git a/ds9/library/crosshair.tcl b/ds9/library/crosshair.tcl
index c74c659..d2fca4b 100644
--- a/ds9/library/crosshair.tcl
+++ b/ds9/library/crosshair.tcl
@@ -270,21 +270,12 @@ proc ProcessCrosshairCmd {varname iname} {
}
proc ProcessSendCrosshairCmd {proc id param {sock {}} {fn {}}} {
- global crosshair
- global current
-
- switch -- [string tolower $param] {
- lock {$proc $id "$crosshair(lock)\n"}
- default {
- set sys [lindex $param 0]
- set sky [lindex $param 1]
- set format [lindex $param 2]
- FixSpec sys sky format physical fk5 degrees
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
- if {$current(frame) != {}} {
- $proc $id "[$current(frame) get crosshair $sys $sky $format]\n"
- }
- }
- }
+ crosshairsend::YY_FLUSH_BUFFER
+ crosshairsend::yy_scan_string $param
+ crosshairsend::yyparse
}
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index 8c439ab..e82eaa8 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -230,6 +230,8 @@ source $ds9(root)/library/cropsendparser.tcl
source $ds9(root)/library/cropsendlex.tcl
source $ds9(root)/library/crosshairparser.tcl
source $ds9(root)/library/crosshairlex.tcl
+source $ds9(root)/library/crosshairsendparser.tcl
+source $ds9(root)/library/crosshairsendlex.tcl
source $ds9(root)/library/cubeparser.tcl
source $ds9(root)/library/cubelex.tcl
source $ds9(root)/library/cursorparser.tcl
diff --git a/ds9/parsers/crosshairsendlex.fcl b/ds9/parsers/crosshairsendlex.fcl
new file mode 100644
index 0000000..0fa3d47
--- /dev/null
+++ b/ds9/parsers/crosshairsendlex.fcl
@@ -0,0 +1,16 @@
+#tab crosshairsendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+lock {return $LOCK_}
+
+#include coords.fin
+#include string.fin
+
+%%
+
diff --git a/ds9/parsers/crosshairsendparser.tac b/ds9/parsers/crosshairsendparser.tac
new file mode 100644
index 0000000..32db6ca
--- /dev/null
+++ b/ds9/parsers/crosshairsendparser.tac
@@ -0,0 +1,34 @@
+%{
+%}
+
+#include coords.tin
+#include string.tin
+
+%start crosshairsend
+
+%token LOCK_
+
+%%
+
+#include coords.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"}
+ | LOCK_ {ProcessSendCmdGet crosshair lock}
+ ;
+
+%%
+
+proc crosshairsend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
diff --git a/ds9/parsers/pansendparser.tac b/ds9/parsers/pansendparser.tac
index 806104d..2fa0d5f 100644
--- a/ds9/parsers/pansendparser.tac
+++ b/ds9/parsers/pansendparser.tac
@@ -10,7 +10,7 @@
#include coords.trl
-pansend : {ProcessSendCmdCurrent frame "get cursor image fk5 degrees"}
+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"}