summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-04-11 21:41:31 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-04-11 21:41:31 (GMT)
commit4ae99e055b8b3f55884206154283adfdae60ba3a (patch)
tree6e267ddcd3bb38126d2f71b07c9128a2a4ce33df /ds9
parent1fcc04b2f17d703e7be022ffa37a14ce2ebc3cc6 (diff)
downloadblt-4ae99e055b8b3f55884206154283adfdae60ba3a.zip
blt-4ae99e055b8b3f55884206154283adfdae60ba3a.tar.gz
blt-4ae99e055b8b3f55884206154283adfdae60ba3a.tar.bz2
add ds9 vo parser
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/library/vo.tcl43
-rw-r--r--ds9/parsers/volex.fcl25
-rw-r--r--ds9/parsers/voparser.tac53
4 files changed, 123 insertions, 0 deletions
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index dda0394..f9a517e 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -246,6 +246,8 @@ source $ds9(root)/library/vlaparser.tcl
source $ds9(root)/library/vlalex.tcl
source $ds9(root)/library/vlssparser.tcl
source $ds9(root)/library/vlsslex.tcl
+source $ds9(root)/library/voparser.tcl
+source $ds9(root)/library/volex.tcl
source $ds9(root)/library/wcsparser.tcl
source $ds9(root)/library/wcslex.tcl
source $ds9(root)/library/xpaparser.tcl
diff --git a/ds9/library/vo.tcl b/ds9/library/vo.tcl
index d865c17..c96c597 100644
--- a/ds9/library/vo.tcl
+++ b/ds9/library/vo.tcl
@@ -466,6 +466,14 @@ proc ProcessVOCmd {varname iname} {
upvar $varname var
upvar $iname i
+ global debug
+ if {$debug(tcl,parser)} {
+ vo::YY_FLUSH_BUFFER
+ vo::yy_scan_string [lrange $var $i end]
+ vo::yyparse
+ incr i [expr $vo::yycnt-1]
+ } else {
+
set vvarname voi
upvar #0 $vvarname vvar
global $vvarname
@@ -528,6 +536,41 @@ proc ProcessVOCmd {varname iname} {
}
}
}
+}
+
+proc VOCmdSet {which value} {
+ global pvo
+
+ set pvo($which) $value
+}
+
+proc VOCmdConnect {str} {
+ global voi
+ global ivo
+
+ VODialog
+
+ # find best match
+ set ii [lsearch $ivo(server,url) "*$str*"]
+ if {$ii>=0} {
+ set ivo(b$ii) 1
+ VOCheck voi $ii
+ }
+}
+
+proc VOCmdDisconnect {str} {
+ global voi
+ global ivo
+
+ VODialog
+
+ # find best match
+ set ii [lsearch $ivo(server,url) "*$str*"]
+ if {$ii>=0} {
+ set ivo(b$ii) 0
+ VOCheck voi $ii
+ }
+}
proc ProcessSendVOCmd {proc id param} {
global ivo
diff --git a/ds9/parsers/volex.fcl b/ds9/parsers/volex.fcl
new file mode 100644
index 0000000..511c614
--- /dev/null
+++ b/ds9/parsers/volex.fcl
@@ -0,0 +1,25 @@
+#tab voparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+close {return $CLOSE_}
+connect {return $CONNECT_}
+delay {return $DELAY_}
+disconnect {return $DISCONNECT_}
+internal {return $INTERNAL_}
+method {return $METHOD_}
+mime {return $MIME_}
+open {return $OPEN_}
+server {return $SERVER_}
+xpa {return $XPA_}
+
+#include yesno.fin
+#include numeric.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/voparser.tac b/ds9/parsers/voparser.tac
new file mode 100644
index 0000000..85ce25d
--- /dev/null
+++ b/ds9/parsers/voparser.tac
@@ -0,0 +1,53 @@
+%{
+%}
+
+#include yesno.tin
+#include numeric.tin
+#include string.tin
+
+%start command
+
+%token CLOSE_
+%token CONNECT_
+%token DELAY_
+%token DISCONNECT_
+%token INTERNAL_
+%token METHOD_
+%token MIME_
+%token OPEN_
+%token SERVER_
+%token XPA_
+
+%%
+
+#include yesno.trl
+#include numeric.trl
+
+command : vo
+ | vo {yyclearin; YYACCEPT} STRING_
+ ;
+
+vo : OPEN_ {VODialog}
+ | CLOSE_ {VODestroy voi}
+ | METHOD_ method {VOCmdSet method $2}
+ | SERVER_ STRING_ {VOCmdSet server $2}
+ | INTERNAL_ yesno {VOCmdSet hv $2}
+ | DELAY_ INT_ {VOCmdSet delay $2}
+ | CONNECT_ STRING_ {VOCmdConnect $2}
+ | DISCONNECT_ STRING_ {VOCmdDisconnect $2}
+ | STRING_ {VOCmdConnect $1}
+ ;
+
+method : XPA_ {set _ xpa}
+ | MIME_ {set _ mime}
+ ;
+
+%%
+
+proc vo::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}