summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-18 20:48:23 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-18 20:48:23 (GMT)
commit3e121d75852a441cb087ae5225fe9ef7d363173b (patch)
treed7c4db55c19de8c3628edf77fe2689deae3fe5d2
parent2a2c1efa881b41e32e272b3686b8102a9ec6d234 (diff)
downloadblt-3e121d75852a441cb087ae5225fe9ef7d363173b.zip
blt-3e121d75852a441cb087ae5225fe9ef7d363173b.tar.gz
blt-3e121d75852a441cb087ae5225fe9ef7d363173b.tar.bz2
add ds9 preserve send parser
-rw-r--r--ds9/library/load.tcl9
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/library/util.tcl10
-rw-r--r--ds9/parsers/preservesendlex.fcl16
-rw-r--r--ds9/parsers/preservesendparser.tac25
-rw-r--r--ds9/parsers/xpasendparser.tac4
6 files changed, 64 insertions, 2 deletions
diff --git a/ds9/library/load.tcl b/ds9/library/load.tcl
index 22d76b6..f07f405 100644
--- a/ds9/library/load.tcl
+++ b/ds9/library/load.tcl
@@ -421,6 +421,15 @@ proc ProcessPreserveCmd {varname iname} {
}
proc ProcessSendPreserveCmd {proc id param {sock {}} {fn {}}} {
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
+
+ preservesend::YY_FLUSH_BUFFER
+ preservesend::yy_scan_string $param
+ preservesend::yyparse
+ return
+
global scale
global panzoom
global marker
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index fc55f64..4492bbe 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -344,6 +344,8 @@ source $ds9(root)/library/prefssendparser.tcl
source $ds9(root)/library/prefssendlex.tcl
source $ds9(root)/library/preserveparser.tcl
source $ds9(root)/library/preservelex.tcl
+source $ds9(root)/library/preservesendparser.tcl
+source $ds9(root)/library/preservesendlex.tcl
source $ds9(root)/library/psparser.tcl
source $ds9(root)/library/pslex.tcl
source $ds9(root)/library/pssendparser.tcl
diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl
index 98d8d2c..1f937c3 100644
--- a/ds9/library/util.tcl
+++ b/ds9/library/util.tcl
@@ -299,6 +299,16 @@ proc ProcessCmdCVAR4 {key value key2 value2 key3 value3 key4 value4 {cmd {}}} {
}
}
+proc ProcessSendCmd {cmd} {
+ global parse
+ $parse(proc) $parse(id) "[$cmd]"
+}
+
+proc ProcessSendCmdTxt {rr} {
+ global parse
+ $parse(proc) $parse(id) "$rr\n"
+}
+
proc ProcessSendCmdGet {varname key} {
upvar #0 $varname var
global $varname
diff --git a/ds9/parsers/preservesendlex.fcl b/ds9/parsers/preservesendlex.fcl
new file mode 100644
index 0000000..24652fc
--- /dev/null
+++ b/ds9/parsers/preservesendlex.fcl
@@ -0,0 +1,16 @@
+#tab preservesendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+pan {return $PAN_}
+regions {return $REGIONS_}
+scale {return $SCALE_}
+
+#include ws.fin
+
+%%
diff --git a/ds9/parsers/preservesendparser.tac b/ds9/parsers/preservesendparser.tac
new file mode 100644
index 0000000..b1576f0
--- /dev/null
+++ b/ds9/parsers/preservesendparser.tac
@@ -0,0 +1,25 @@
+%{
+%}
+
+%start preservesend
+
+%token PAN_
+%token REGIONS_
+%token SCALE_
+
+%%
+
+preservesend : SCALE_ {ProcessSendCmdTxt "no"}
+ | PAN_ {ProcessSendCmdYesNo panzoom preserve}
+ | REGIONS_ {ProcessSendCmdYesNo marker preserve}
+ ;
+
+%%
+
+proc preservesend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
diff --git a/ds9/parsers/xpasendparser.tac b/ds9/parsers/xpasendparser.tac
index c27b80f..63a44ec 100644
--- a/ds9/parsers/xpasendparser.tac
+++ b/ds9/parsers/xpasendparser.tac
@@ -7,8 +7,8 @@
%%
-xpasend : {global parse; $parse(proc) $parse(id) [XPAInfoResult]}
- | INFO_ {global parse; $parse(proc) $parse(id) [XPAInfoResult]}
+xpasend : {ProcessSendCmd XPAInfoResult}
+ | INFO_ {ProcessSendCmd XPAInfoResult}
;
%%