From 39a20376dc46c9d2212b4e87d3e9711d7405dab7 Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 19 Jun 2018 11:57:20 -0400 Subject: add ds9 vo send parser --- ds9/library/source.tcl | 2 ++ ds9/library/vo.tcl | 45 +++++++++++++++++++------------------------- ds9/parsers/vosendlex.fcl | 18 ++++++++++++++++++ ds9/parsers/vosendparser.tac | 30 +++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 26 deletions(-) create mode 100644 ds9/parsers/vosendlex.fcl create mode 100644 ds9/parsers/vosendparser.tac 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_ +} -- cgit v0.12