summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-07 19:10:36 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-07 19:10:36 (GMT)
commit75d81565076d3bab3e92a10c8e04fd949faaea90 (patch)
tree98452c618b63405efd457fc3621e7fc84d20e93e /ds9
parent4fc3cdba34e1f5656fd0ecd62dbd10d3f608a399 (diff)
downloadblt-75d81565076d3bab3e92a10c8e04fd949faaea90.zip
blt-75d81565076d3bab3e92a10c8e04fd949faaea90.tar.gz
blt-75d81565076d3bab3e92a10c8e04fd949faaea90.tar.bz2
add ds9 cube send parser
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/cube.tcl33
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/parsers/cubesendlex.fcl18
-rw-r--r--ds9/parsers/cubesendparser.tac36
4 files changed, 68 insertions, 21 deletions
diff --git a/ds9/library/cube.tcl b/ds9/library/cube.tcl
index de4beca..d94955c 100644
--- a/ds9/library/cube.tcl
+++ b/ds9/library/cube.tcl
@@ -727,27 +727,18 @@ proc CubeCmdCoord {ss sys axis} {
}
proc ProcessSendCubeCmd {proc id param {sock {}} {fn {}}} {
- global cube
- global current
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
+
+ cubesend::YY_FLUSH_BUFFER
+ cubesend::yy_scan_string $param
+ cubesend::yyparse
+}
+
+proc CubeSendCmdInterval {} {
+ global parse
global blink
- switch -- [string tolower [lindex $param 0]] {
- lock {$proc $id "$cube(lock)\n"}
- axes -
- order {
- switch -- [string tolower [lindex $param 1]] {
- lock {$proc $id [ToYesNo $cube(lock,axes)]}
- default {$proc $id "$cube(axes)\n"}
- }
- }
- interval {$proc $id "[expr $blink(interval)/1000.]\n"}
- axis {$proc $id "$cube(axis)\n"}
- default {
- if {$current(frame) != {}} {
- $proc $id "[$current(frame) get fits slice $cube(axis)]\n"
- } else {
- $proc $id "1\n"
- }
- }
- }
+ $parse(proc) $parse(id) "[expr $blink(interval)/1000.]\n"
}
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index e82eaa8..9b0137e 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -234,6 +234,8 @@ 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/cubesendparser.tcl
+source $ds9(root)/library/cubesendlex.tcl
source $ds9(root)/library/cursorparser.tcl
source $ds9(root)/library/cursorlex.tcl
source $ds9(root)/library/dssesoparser.tcl
diff --git a/ds9/parsers/cubesendlex.fcl b/ds9/parsers/cubesendlex.fcl
new file mode 100644
index 0000000..5a51bdd
--- /dev/null
+++ b/ds9/parsers/cubesendlex.fcl
@@ -0,0 +1,18 @@
+#tab cubesendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+axis {return $AXIS_}
+axes {return $AXES_}
+interval {return $INTERVAL_}
+lock {return $LOCK_}
+order {return $ORDER_}
+
+#include string.fin
+
+%%
diff --git a/ds9/parsers/cubesendparser.tac b/ds9/parsers/cubesendparser.tac
new file mode 100644
index 0000000..70cfb3e
--- /dev/null
+++ b/ds9/parsers/cubesendparser.tac
@@ -0,0 +1,36 @@
+%{
+%}
+
+#include string.tin
+
+%start cubesend
+
+%token AXIS_
+%token AXES_
+%token INTERVAL_
+%token LOCK_
+%token ORDER_
+
+%%
+
+cubesend : {global cube; ProcessSendCmdCurrent frame "get fits slice $cube(axis)"}
+ | LOCK_ {ProcessSendCmdGet cube lock}
+ | INTERVAL_ {CubeSendCmdInterval}
+ | AXIS_ {ProcessSendCmdGet cube axis}
+ | AXES_ order
+ | ORDER_ order
+ ;
+
+order : {ProcessSendCmdGet cube axes}
+ | LOCK_ {ProcessSendCmdYesNo cube lock,axes}
+ ;
+
+%%
+
+proc cubesend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}