diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-05-10 21:16:35 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-05-10 21:16:35 (GMT) |
commit | abebccd43ae4ebf24ef336ef5c1c2bf18a03becc (patch) | |
tree | cd4004d366ba172de5de980b65eb2cf3fdd05cf0 /ds9 | |
parent | 14ce7d934c7c9b22d6718052a32e371d0d845f82 (diff) | |
download | blt-abebccd43ae4ebf24ef336ef5c1c2bf18a03becc.zip blt-abebccd43ae4ebf24ef336ef5c1c2bf18a03becc.tar.gz blt-abebccd43ae4ebf24ef336ef5c1c2bf18a03becc.tar.bz2 |
add ds9 mosaicimageiraf parser
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/mosaicimageiraf.tcl | 35 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/mosaicimageiraflex.fcl | 15 | ||||
-rw-r--r-- | ds9/parsers/mosaicimageirafparser.tac | 34 |
4 files changed, 83 insertions, 3 deletions
diff --git a/ds9/library/mosaicimageiraf.tcl b/ds9/library/mosaicimageiraf.tcl index 4cf0ce4..f12db74 100644 --- a/ds9/library/mosaicimageiraf.tcl +++ b/ds9/library/mosaicimageiraf.tcl @@ -47,11 +47,19 @@ proc ProcessMosaicImageIRAFCmd {varname iname sock fn} { upvar $varname var upvar $iname i - global loadParam - global current + global debug + if {$debug(tcl,parser)} { + global parse + set parse(sock) $sock + set parse(fn) $fn - set layer {} + mosaicimageiraf::YY_FLUSH_BUFFER + mosaicimageiraf::yy_scan_string [lrange $var $i end] + mosaicimageiraf::yyparse + incr i [expr $mosaicimageiraf::yycnt-1] + } else { + set layer {} switch -- [string tolower [lindex $var $i]] { new { incr i @@ -84,3 +92,24 @@ proc ProcessMosaicImageIRAFCmd {varname iname sock fn} { } FinishLoad } +} + +proc MosaicImageIRAFCmdLoad {param layer} { + global parse + + if {$parse(sock) != {}} { + # xpa + if {![LoadMosaicImageIRAFSocket $parse(sock) $param $layer]} { + InitError xpa + LoadMosaicImageIRAFFile $param $layer + } + } else { + # comm + if {$parse(fn) != {}} { + LoadMosaicImageIRAFAlloc $parse(fn) $param $layer + } else { + LoadMosaicImageIRAFFile $param $layer + } + } + FinishLoad +} diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index ca3f34c..15cd215 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -256,6 +256,8 @@ source $ds9(root)/library/minmaxparser.tcl source $ds9(root)/library/minmaxlex.tcl source $ds9(root)/library/modeparser.tcl source $ds9(root)/library/modelex.tcl +source $ds9(root)/library/mosaicimageirafparser.tcl +source $ds9(root)/library/mosaicimageiraflex.tcl source $ds9(root)/library/mosaicimagewcsparser.tcl source $ds9(root)/library/mosaicimagewcslex.tcl source $ds9(root)/library/multiframeparser.tcl diff --git a/ds9/parsers/mosaicimageiraflex.fcl b/ds9/parsers/mosaicimageiraflex.fcl new file mode 100644 index 0000000..31be3ff --- /dev/null +++ b/ds9/parsers/mosaicimageiraflex.fcl @@ -0,0 +1,15 @@ +#tab mosaicimageirafparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +mask {return $MASK_} +new {return $NEW_} + +#include string.fin + +%% diff --git a/ds9/parsers/mosaicimageirafparser.tac b/ds9/parsers/mosaicimageirafparser.tac new file mode 100644 index 0000000..819c260 --- /dev/null +++ b/ds9/parsers/mosaicimageirafparser.tac @@ -0,0 +1,34 @@ +%{ +%} + +#include string.tin + +%start command + +%token MASK_ +%token NEW_ + +%% + +command : mosaicimageiraf + | mosaicimageiraf {yyclearin; YYACCEPT} STRING_ + ; + +mosaicimageiraf : opts {MosaicImageIRAFCmdLoad {} $1} + | opts STRING_ {MosaicImageIRAFCmdLoad $2 $1} + ; + +opts : + | NEW_ {CreateFrame; set _ {}} + | MASK_ {set _ mask} + ; + +%% + +proc mosaicimageiraf::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |