From a03f2552f6d9f20d602fc82b139d46fb059c85db Mon Sep 17 00:00:00 2001 From: William Joye Date: Wed, 6 Jun 2018 11:35:39 -0400 Subject: add ds9 2mass send parser --- ds9/library/2mass.tcl | 9 ++++++++- ds9/library/source.tcl | 2 ++ ds9/library/util.tcl | 16 ++++++++++++++++ ds9/parsers/twomassparser.tac | 6 +++--- ds9/parsers/twomasssendlex.fcl | 13 +++++++++++++ ds9/parsers/twomasssendparser.tac | 28 ++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 ds9/parsers/twomasssendlex.fcl create mode 100644 ds9/parsers/twomasssendparser.tac diff --git a/ds9/library/2mass.tcl b/ds9/library/2mass.tcl index 36158ea..e8697ac 100644 --- a/ds9/library/2mass.tcl +++ b/ds9/library/2mass.tcl @@ -141,5 +141,12 @@ proc Process2MASSCmd {varname iname} { proc ProcessSend2MASSCmd {proc id param {sock {}} {fn {}}} { 2MASSDialog - IMGSVRProcessSendCmd $proc $id $param dtwomass + + global parse + set parse(proc) $proc + set parse(id) $id + + twomasssend::YY_FLUSH_BUFFER + twomasssend::yy_scan_string $param + twomasssend::yyparse } diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 6f52cac..6d7c950 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -370,6 +370,8 @@ source $ds9(root)/library/tileparser.tcl source $ds9(root)/library/tilelex.tcl source $ds9(root)/library/twomassparser.tcl source $ds9(root)/library/twomasslex.tcl +source $ds9(root)/library/twomasssendparser.tcl +source $ds9(root)/library/twomasssendlex.tcl source $ds9(root)/library/updateparser.tcl source $ds9(root)/library/updatelex.tcl source $ds9(root)/library/urlfitsparser.tcl diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index b2fdc8d..b72eb2a 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -202,6 +202,22 @@ proc ProcessSendCmdGet {varname key} { $parse(proc) $parse(id) "$var($key)\n" } +proc ProcessSendCmdGet2 {varname key key2} { + upvar #0 $varname var + global $varname + + global parse + $parse(proc) $parse(id) "$var($key) $var($key2)\n" +} + +proc ProcessSendCmdGet3 {varname key key2 key3} { + upvar #0 $varname var + global $varname + + global parse + $parse(proc) $parse(id) "$var($key) $var($key2) $var($key3)\n" +} + proc ProcessSendCmdYesNo {varname key} { upvar #0 $varname var global $varname diff --git a/ds9/parsers/twomassparser.tac b/ds9/parsers/twomassparser.tac index 4432080..ce02100 100644 --- a/ds9/parsers/twomassparser.tac +++ b/ds9/parsers/twomassparser.tac @@ -16,11 +16,11 @@ #include imgsvr.trl #include numeric.trl -command : 2mass - | 2mass {yyclearin; YYACCEPT} STRING_ +command : twomass + | twomass {yyclearin; YYACCEPT} STRING_ ; -2mass : {IMGSVRApply dtwomass 1} +twomass : {IMGSVRApply dtwomass 1} | OPEN_ {} | CLOSE_ {ARDestroy dtwomass} | STRING_ {IMGSVRCmdName dtwomass $1} diff --git a/ds9/parsers/twomasssendlex.fcl b/ds9/parsers/twomasssendlex.fcl new file mode 100644 index 0000000..82c9463 --- /dev/null +++ b/ds9/parsers/twomasssendlex.fcl @@ -0,0 +1,13 @@ +#tab twomasssendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +#include imgsvr.fin +#include string.fin + +%% diff --git a/ds9/parsers/twomasssendparser.tac b/ds9/parsers/twomasssendparser.tac new file mode 100644 index 0000000..0c8abe4 --- /dev/null +++ b/ds9/parsers/twomasssendparser.tac @@ -0,0 +1,28 @@ +%{ +%} + +#include imgsvr.tin +#include string.tin + +%start twomasssend + +%% + +twomasssend : {ProcessSendCmdGet dtwomass name} + | NAME_ {ProcessSendCmdGet dtwomass name} + | SAVE_ {ProcessSendCmdYesNo dtwomass save} + | FRAME_ {ProcessSendCmdGet dtwomass mode} + | SURVEY_ {ProcessSendCmdGet dtwomass survey} + | SIZE_ {ProcessSendCmdGet3 dtwomass width height rformat} + | COORD_ {ProcessSendCmdGet3 dtwomass x y skyformat} + ; + +%% + +proc twomasssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12