From ea1b537c632e38d9daa857f33ba85f184f66a61a Mon Sep 17 00:00:00 2001 From: William Joye Date: Mon, 18 Jun 2018 16:56:28 -0400 Subject: add ds9 magnifier send parser --- ds9/library/magnifier.tcl | 13 ++++++------- ds9/library/source.tcl | 2 ++ ds9/parsers/magnifiersendlex.fcl | 17 +++++++++++++++++ ds9/parsers/magnifiersendparser.tac | 29 +++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 ds9/parsers/magnifiersendlex.fcl create mode 100644 ds9/parsers/magnifiersendparser.tac diff --git a/ds9/library/magnifier.tcl b/ds9/library/magnifier.tcl index 2ddfd1b..fe0ad11 100644 --- a/ds9/library/magnifier.tcl +++ b/ds9/library/magnifier.tcl @@ -147,14 +147,13 @@ proc ProcessMagnifierCmd {varname iname} { } proc ProcessSendMagnifierCmd {proc id param {sock {}} {fn {}}} { - global pmagnifier + global parse + set parse(proc) $proc + set parse(id) $id - switch -- [string tolower [lindex $param 0]] { - color {$proc $id "$pmagnifier(color)\n"} - zoom {$proc $id "$pmagnifier(zoom)\n"} - cursor {$proc $id [ToYesNo $pmagnifier(cursor)]} - region {$proc $id [ToYesNo $pmagnifier(region)]} - } + magnifiersend::YY_FLUSH_BUFFER + magnifiersend::yy_scan_string $param + magnifiersend::yyparse } diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 4492bbe..2a16199 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -282,6 +282,8 @@ source $ds9(root)/library/locksendparser.tcl source $ds9(root)/library/locksendlex.tcl source $ds9(root)/library/magnifierparser.tcl source $ds9(root)/library/magnifierlex.tcl +source $ds9(root)/library/magnifiersendparser.tcl +source $ds9(root)/library/magnifiersendlex.tcl source $ds9(root)/library/maskparser.tcl source $ds9(root)/library/masklex.tcl source $ds9(root)/library/matchparser.tcl diff --git a/ds9/parsers/magnifiersendlex.fcl b/ds9/parsers/magnifiersendlex.fcl new file mode 100644 index 0000000..18b9379 --- /dev/null +++ b/ds9/parsers/magnifiersendlex.fcl @@ -0,0 +1,17 @@ +#tab magnifiersendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +color {return $COLOR_} +cursor {return $CURSOR_} +region {return $REGION_} +zoom {return $ZOOM_} + +#include ws.fin + +%% diff --git a/ds9/parsers/magnifiersendparser.tac b/ds9/parsers/magnifiersendparser.tac new file mode 100644 index 0000000..31124a5 --- /dev/null +++ b/ds9/parsers/magnifiersendparser.tac @@ -0,0 +1,29 @@ +%{ +%} + +%start magnifiersend + +%token COLOR_ +%token CURSOR_ +%token REGION_ +%token ZOOM_ + +%% + +magnifiersend : COLOR_ {ProcessSendCmdGet pmagnifier color} + | ZOOM_ {ProcessSendCmdGet pmagnifier zoom} + | CURSOR_ {ProcessSendCmdGet pmagnifier cursor} + | REGION_ {ProcessSendCmdGet pmagnifier region} +# backward compatibility + | {ProcessSendCmdYesNo view magnifier} + ; + +%% + +proc magnifiersend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12