diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-06-08 19:12:14 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-06-08 19:12:14 (GMT) |
commit | 7f05adf25227fd956f5fb194fcfc4e82cf82135d (patch) | |
tree | 120c8d6dac493195f2c98f5c46fdffafdfe77bbb | |
parent | 8fe9a25bafd93b4cb1ac7b07b486330c750b834b (diff) | |
download | blt-7f05adf25227fd956f5fb194fcfc4e82cf82135d.zip blt-7f05adf25227fd956f5fb194fcfc4e82cf82135d.tar.gz blt-7f05adf25227fd956f5fb194fcfc4e82cf82135d.tar.bz2 |
add ds9 tile send parser
-rw-r--r-- | ds9/library/frame.tcl | 74 | ||||
-rw-r--r-- | ds9/library/imgsvr.tcl | 15 | ||||
-rw-r--r-- | ds9/library/scale.tcl | 22 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/tilesendlex.fcl | 18 | ||||
-rw-r--r-- | ds9/parsers/tilesendparser.tac | 33 |
6 files changed, 69 insertions, 95 deletions
diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl index b04b18a..b1fc945 100644 --- a/ds9/library/frame.tcl +++ b/ds9/library/frame.tcl @@ -2169,26 +2169,23 @@ proc ProcessTileCmd {varname iname} { } proc ProcessSendTileCmd {proc id param {sock {}} {fn {}}} { - global current - global tile + global parse + set parse(proc) $proc + set parse(id) $id - switch -- [lindex $param 0] { - mode {$proc $id "$tile(mode)\n"} - grid { - switch -- [lindex $param 1] { - mode {$proc $id "$tile(grid,mode)\n"} - direction {$proc $id "$tile(grid,dir)\n"} - layout {$proc $id "$tile(grid,col) $tile(grid,row)\n"} - gap {$proc $id "$tile(grid,gap)\n"} - } - } - default { - if {$current(display)=="tile"} { - $proc $id [ToYesNo 1] - } else { - $proc $id [ToYesNo 0] - } - } + tilesend::YY_FLUSH_BUFFER + tilesend::yy_scan_string $param + tilesend::yyparse +} + +proc TileSendCmd {} { + global parse + global current + + if {$current(display)=="tile"} { + $parse(proc) $parse(id) "yes\n" + } else { + $parse(proc) $parse(id) "no\n" } } @@ -2239,45 +2236,6 @@ proc ProcessSendLockCmd {proc id param {sock {}} {fn {}}} { locksend::YY_FLUSH_BUFFER locksend::yy_scan_string $param locksend::yyparse - - return - global panzoom - global crop - global crosshair - global cube - global ime - global bin - global scale - global colorbar - global block - global smooth - global threed - - switch -- [lindex $param 0] { - frame - - frames {$proc $id "$panzoom(lock)\n"} - crosshair - - crosshairs {$proc $id "$crosshair(lock)\n"} - crop {$proc $id "$crop(lock)\n"} - slice - - cube - - datacube {$proc $id "$cube(lock)\n"} - analysis {$proc $id "$ime(lock)\n"} - bin {$proc $id [ToYesNo $bin(lock)]} - axes - - order {$proc $id [ToYesNo $cube(lock,axes)]} - scale - - scales {$proc $id [ToYesNo $scale(lock)]} - limits - - scalelimits {$proc $id [ToYesNo $scale(lock,limits)]} - color - - colormap - - colorbar - - colorbars {$proc $id [ToYesNo $colorbar(lock)]} - block {$proc $id [ToYesNo $block(lock)]} - smooth {$proc $id [ToYesNo $smooth(lock)]} - 3d {$proc $id [ToYesNo $threed(lock)]} - } } proc ProcessMatchCmd {varname iname} { diff --git a/ds9/library/imgsvr.tcl b/ds9/library/imgsvr.tcl index e1da71a..5a9f761 100644 --- a/ds9/library/imgsvr.tcl +++ b/ds9/library/imgsvr.tcl @@ -482,18 +482,3 @@ proc IMGSVRProgress {varname token totalsize currentsize} { ARStatus $varname "$currentsize bytes" } } - -proc IMGSVRProcessSendCmd {proc id param vvarname} { - upvar #0 $vvarname vvar - - switch -- [string tolower [lindex $param 0]] { - save {$proc $id [ToYesNo $vvar(save)]} - frame {$proc $id "$vvar(mode)\n"} - survey {$proc $id "$vvar(survey)\n"} - size {$proc $id "$vvar(width) $vvar(height) $vvar(rformat)\n"} - pixels {$proc $id "$vvar(width,pixels) $vvar(height,pixels)\n"} - coord {$proc $id "$vvar(x) $vvar(y) $vvar(skyformat)\n"} - name - - default {$proc $id "$vvar(name)\n"} - } -} diff --git a/ds9/library/scale.tcl b/ds9/library/scale.tcl index a2dab7a..012937a 100644 --- a/ds9/library/scale.tcl +++ b/ds9/library/scale.tcl @@ -834,7 +834,6 @@ proc ProcessScaleCmd {varname iname} { } proc ProcessSendScaleCmd {proc id param {sock {}} {fn {}}} { - if {1} { global parse set parse(proc) $proc set parse(id) $id @@ -842,27 +841,6 @@ proc ProcessSendScaleCmd {proc id param {sock {}} {fn {}}} { scalesend::YY_FLUSH_BUFFER scalesend::yy_scan_string $param scalesend::yyparse - } else { - - global current - global scale - switch -- [string tolower $param] { - lock {$proc $id [ToYesNo $scale(lock)]} - {lock limits} {$proc $id [ToYesNo $scale(lock,limits)]} - datasec {$proc $id "$scale(datasec)\n"} - limits { - if {$current(frame) != {}} { - set lims [$current(frame) get clip] - $proc $id "[lindex $lims 0] [lindex $lims 1]\n" - } - } - mode {$proc $id "$scale(mode)\n"} - scope {$proc $id "$scale(scope)\n"} - log - - {log exp} {$proc $id "$scale(log)\n"} - default {$proc $id "$scale(type)\n"} - } -} } proc ProcessMinMaxCmd {varname iname} { diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index db997e3..a2cf94f 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -392,6 +392,8 @@ source $ds9(root)/library/threedsendparser.tcl source $ds9(root)/library/threedsendlex.tcl source $ds9(root)/library/tileparser.tcl source $ds9(root)/library/tilelex.tcl +source $ds9(root)/library/tilesendparser.tcl +source $ds9(root)/library/tilesendlex.tcl source $ds9(root)/library/twomassparser.tcl source $ds9(root)/library/twomasslex.tcl source $ds9(root)/library/twomasssendparser.tcl diff --git a/ds9/parsers/tilesendlex.fcl b/ds9/parsers/tilesendlex.fcl new file mode 100644 index 0000000..8c4eeca --- /dev/null +++ b/ds9/parsers/tilesendlex.fcl @@ -0,0 +1,18 @@ +#tab tilesendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +direction {return $DIRECTION_} +gap {return $GAP_} +grid {return $GRID_} +layout {return $LAYOUT_} +mode {return $MODE_} + +#include ws.fin + +%% diff --git a/ds9/parsers/tilesendparser.tac b/ds9/parsers/tilesendparser.tac new file mode 100644 index 0000000..45edbe5 --- /dev/null +++ b/ds9/parsers/tilesendparser.tac @@ -0,0 +1,33 @@ +%{ +%} + +%start tilesend + +%token DIRECTION_ +%token GAP_ +%token GRID_ +%token LAYOUT_ +%token MODE_ + +%% + +tilesend: {TileSendCmd} + | MODE_ {ProcessSendCmdGet tile mode} + | GRID_ grid + ; + +grid : MODE_ {ProcessSendCmdGet tile grid,mode} + | DIRECTION_ {ProcessSendCmdGet tile grid,dir} + | LAYOUT_ {ProcessSendCmdGet tile grid,row} + | GAP_ {ProcessSendCmdGet tile grid,gap} + ; + +%% + +proc tilesend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |