summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-18 20:56:28 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-18 20:56:28 (GMT)
commitea1b537c632e38d9daa857f33ba85f184f66a61a (patch)
tree83854d31b9a686f5f3675b3cc1620413786eb314
parentee0c9f405c9ccbf762b2a9ebce4879683e00b801 (diff)
downloadblt-ea1b537c632e38d9daa857f33ba85f184f66a61a.zip
blt-ea1b537c632e38d9daa857f33ba85f184f66a61a.tar.gz
blt-ea1b537c632e38d9daa857f33ba85f184f66a61a.tar.bz2
add ds9 magnifier send parser
-rw-r--r--ds9/library/magnifier.tcl13
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/parsers/magnifiersendlex.fcl17
-rw-r--r--ds9/parsers/magnifiersendparser.tac29
4 files changed, 54 insertions, 7 deletions
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_
+}