From 3e121d75852a441cb087ae5225fe9ef7d363173b Mon Sep 17 00:00:00 2001 From: William Joye Date: Mon, 18 Jun 2018 16:48:23 -0400 Subject: add ds9 preserve send parser --- ds9/library/load.tcl | 9 +++++++++ ds9/library/source.tcl | 2 ++ ds9/library/util.tcl | 10 ++++++++++ ds9/parsers/preservesendlex.fcl | 16 ++++++++++++++++ ds9/parsers/preservesendparser.tac | 25 +++++++++++++++++++++++++ ds9/parsers/xpasendparser.tac | 4 ++-- 6 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 ds9/parsers/preservesendlex.fcl create mode 100644 ds9/parsers/preservesendparser.tac 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} ; %% -- cgit v0.12