diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-06-07 19:10:36 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-06-07 19:10:36 (GMT) |
commit | 75d81565076d3bab3e92a10c8e04fd949faaea90 (patch) | |
tree | 98452c618b63405efd457fc3621e7fc84d20e93e /ds9 | |
parent | 4fc3cdba34e1f5656fd0ecd62dbd10d3f608a399 (diff) | |
download | blt-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.tcl | 33 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/cubesendlex.fcl | 18 | ||||
-rw-r--r-- | ds9/parsers/cubesendparser.tac | 36 |
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_ +} |