summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-19 15:57:20 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-19 15:57:20 (GMT)
commit39a20376dc46c9d2212b4e87d3e9711d7405dab7 (patch)
tree371ece0533a7a6778fd8039e27e731c7e8bb2b8f
parent1c1aa7532515c455508065839b03c3da2011f885 (diff)
downloadblt-39a20376dc46c9d2212b4e87d3e9711d7405dab7.zip
blt-39a20376dc46c9d2212b4e87d3e9711d7405dab7.tar.gz
blt-39a20376dc46c9d2212b4e87d3e9711d7405dab7.tar.bz2
add ds9 vo send parser
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/library/vo.tcl45
-rw-r--r--ds9/parsers/vosendlex.fcl18
-rw-r--r--ds9/parsers/vosendparser.tac30
4 files changed, 69 insertions, 26 deletions
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index ffee7f2..f71b9e0 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -436,6 +436,8 @@ source $ds9(root)/library/vlsssendparser.tcl
source $ds9(root)/library/vlsssendlex.tcl
source $ds9(root)/library/voparser.tcl
source $ds9(root)/library/volex.tcl
+source $ds9(root)/library/vosendparser.tcl
+source $ds9(root)/library/vosendlex.tcl
source $ds9(root)/library/wcsparser.tcl
source $ds9(root)/library/wcslex.tcl
source $ds9(root)/library/wcssendparser.tcl
diff --git a/ds9/library/vo.tcl b/ds9/library/vo.tcl
index 3f52ac7..b5c1be4 100644
--- a/ds9/library/vo.tcl
+++ b/ds9/library/vo.tcl
@@ -501,35 +501,28 @@ proc VOCmdDisconnect {str} {
}
proc ProcessSendVOCmd {proc id param {sock {}} {fn {}}} {
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
+
+ vosend::YY_FLUSH_BUFFER
+ vosend::yy_scan_string $param
+ vosend::yyparse
+}
+
+proc VOSendCmdConnect {{all {0}}} {
global ivo
global pvo
- switch -- [string tolower $param] {
- method {$proc $id "$pvo(method)\n"}
- server {$proc $id "$pvo(server)\n"}
- internal {$proc $id [ToYesNo $pvo(hv)]}
- delay {$proc $id "$pvo(delay)\n"}
- connect {
- # current connections
- set len [llength $ivo(server,button)]
- set rr {}
- for {set ii 0} {$ii<$len} {incr ii} {
- if {$ivo(b$ii)} {
- append rr "[lindex $ivo(server,host) $ii] [lindex $ivo(server,title) $ii] [lindex $ivo(server,url) $ii] $ivo(b$ii)\n"
- }
- }
- $proc $id $rr
- }
- default {
- VODialog
- # all possible connections
- set len [llength $ivo(server,button)]
- set rr {}
- for {set ii 0} {$ii<$len} {incr ii} {
- append rr "[lindex $ivo(server,host) $ii] [lindex $ivo(server,title) $ii] [lindex $ivo(server,url) $ii] $ivo(b$ii)\n"
- }
- $proc $id $rr
+ VODialog
+
+ set len [llength $ivo(server,button)]
+ set rr {}
+ for {set ii 0} {$ii<$len} {incr ii} {
+ if {$all || $ivo(b$ii)} {
+ append rr "[lindex $ivo(server,host) $ii] [lindex $ivo(server,title) $ii] [lindex $ivo(server,url) $ii] $ivo(b$ii)\n"
}
}
-}
+ ProcessSendCmdTxt $rr
+}
diff --git a/ds9/parsers/vosendlex.fcl b/ds9/parsers/vosendlex.fcl
new file mode 100644
index 0000000..22ed2e6
--- /dev/null
+++ b/ds9/parsers/vosendlex.fcl
@@ -0,0 +1,18 @@
+#tab vosendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+connect {return $CONNECT_}
+delay {return $DELAY_}
+internal {return $INTERNAL_}
+method {return $METHOD_}
+server {return $SERVER_}
+
+#include ws.fin
+
+%%
diff --git a/ds9/parsers/vosendparser.tac b/ds9/parsers/vosendparser.tac
new file mode 100644
index 0000000..065f8e5
--- /dev/null
+++ b/ds9/parsers/vosendparser.tac
@@ -0,0 +1,30 @@
+%{
+%}
+
+%start vosend
+
+%token CONNECT_
+%token DELAY_
+%token INTERNAL_
+%token METHOD_
+%token SERVER_
+
+%%
+
+vosend : {VOSendCmdConnect 1}
+ | METHOD_ {ProcessSendCmdGet pvo method}
+ | SERVER_ {ProcessSendCmdGet pvo server}
+ | INTERNAL_ {ProcessSendCmdYesNo pvo hv}
+ | DELAY_ {ProcessSendCmdGet pvo delay}
+ | CONNECT_ {VOSendCmdConnect}
+ ;
+
+%%
+
+proc vosend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}