summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-05-10 19:11:02 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-05-10 19:11:02 (GMT)
commit2f611d9dda542f6af7d5c55e02f3330ce55d7ba1 (patch)
tree7ea233f2d1815ddc990f6fac7235cee2f0f36499
parent92ad0b6f98fafe51cf6fbb4ff4a082cc87d8ee3c (diff)
downloadblt-2f611d9dda542f6af7d5c55e02f3330ce55d7ba1.zip
blt-2f611d9dda542f6af7d5c55e02f3330ce55d7ba1.tar.gz
blt-2f611d9dda542f6af7d5c55e02f3330ce55d7ba1.tar.bz2
add ds9 mosaicimagewcs parser
-rw-r--r--ds9/library/mosaicimagewcs.tcl36
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/parsers/mosaicimagewcslex.fcl16
-rw-r--r--ds9/parsers/mosaicimagewcsparser.tac41
4 files changed, 92 insertions, 3 deletions
diff --git a/ds9/library/mosaicimagewcs.tcl b/ds9/library/mosaicimagewcs.tcl
index 3f59eb6..89411b3 100644
--- a/ds9/library/mosaicimagewcs.tcl
+++ b/ds9/library/mosaicimagewcs.tcl
@@ -75,11 +75,20 @@ proc ProcessMosaicImageWCSCmd {varname iname sock fn} {
upvar $varname var
upvar $iname i
- global loadParam
- global current
+ global debug
+ if {$debug(tcl,parser)} {
+ global mosaicimagewcs
+ set mosaicimagewcs(load,sock) $sock
+ set mosaicimagewcs(load,fn) $fn
+ set mosaicimagewcs(load,layer) {}
+
+ mosaicimagewcs::YY_FLUSH_BUFFER
+ mosaicimagewcs::yy_scan_string [lrange $var $i end]
+ mosaicimagewcs::yyparse
+ incr i [expr $mosaicimagewcs::yycnt-1]
+ } else {
set layer {}
-
switch -- [string tolower [lindex $var $i]] {
new {
incr i
@@ -119,6 +128,27 @@ proc ProcessMosaicImageWCSCmd {varname iname sock fn} {
}
FinishLoad
}
+}
+
+proc MosaicImageWCSCmdLoad {param layer sys} {
+ global mosaicimagewcs
+
+ if {$mosaicimagewcs(load,sock) != {}} {
+ # xpa
+ if {![LoadMosaicImageWCSSocket $mosaicimagewcs(load,sock) $param $layer $sys]} {
+ InitError xpa
+ LoadMosaicImageWCSFile $param $layer $sys
+ }
+ } else {
+ # comm
+ if {$mosaicimagewcs(load,fn) != {}} {
+ LoadMosaicImageWCSAlloc $mosaicimagewcs(load,fn) $param $layer $sys
+ } else {
+ LoadMosaicImageWCSFile $param $layer $sys
+ }
+ }
+ FinishLoad
+}
proc ProcessSendMosaicImageWCSCmd {proc id param sock fn} {
global current
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index dc6073e..ca3f34c 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/mosaicimagewcsparser.tcl
+source $ds9(root)/library/mosaicimagewcslex.tcl
source $ds9(root)/library/multiframeparser.tcl
source $ds9(root)/library/multiframelex.tcl
source $ds9(root)/library/nanparser.tcl
diff --git a/ds9/parsers/mosaicimagewcslex.fcl b/ds9/parsers/mosaicimagewcslex.fcl
new file mode 100644
index 0000000..b8a006d
--- /dev/null
+++ b/ds9/parsers/mosaicimagewcslex.fcl
@@ -0,0 +1,16 @@
+#tab mosaicimagewcsparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+mask {return $MASK_}
+new {return $NEW_}
+
+#include coords.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/mosaicimagewcsparser.tac b/ds9/parsers/mosaicimagewcsparser.tac
new file mode 100644
index 0000000..746bde4
--- /dev/null
+++ b/ds9/parsers/mosaicimagewcsparser.tac
@@ -0,0 +1,41 @@
+%{
+%}
+
+#include coords.tin
+#include string.tin
+
+%start command
+
+%token MASK_
+%token NEW_
+
+%%
+
+#include coords.trl
+
+command : mosaicimagewcs
+ | mosaicimagewcs {yyclearin; YYACCEPT} STRING_
+ ;
+
+mosaicimagewcs : sys opts {MosaicImageWCSCmdLoad {} $2 $1}
+ | sys opts STRING_ {MosaicImageWCSCmdLoad $3 $2 $1}
+ ;
+
+sys : {set _ wcs}
+ | wcssys {set _ $1}
+ ;
+
+opts :
+ | NEW_ {CreateFrame; set _ {}}
+ | MASK_ {set _ mask}
+ ;
+
+%%
+
+proc mosaicimagewcs::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}