diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-05-11 18:47:55 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-05-11 18:47:55 (GMT) |
commit | 53b50211e69350789ad170bfe6ce01b0e255c1c0 (patch) | |
tree | e7ebca33b2fab855be784083617bf17731254688 | |
parent | d51c41654a715f539154ec29fe1603a07dbcec58 (diff) | |
download | blt-53b50211e69350789ad170bfe6ce01b0e255c1c0.zip blt-53b50211e69350789ad170bfe6ce01b0e255c1c0.tar.gz blt-53b50211e69350789ad170bfe6ce01b0e255c1c0.tar.bz2 |
add ds9 sfits parser
-rw-r--r-- | ds9/library/sfits.tcl | 11 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/sfitslex.fcl | 16 | ||||
-rw-r--r-- | ds9/parsers/sfitsparser.tac | 36 | ||||
-rw-r--r-- | ds9/parsers/srgbcubelex.fcl | 2 | ||||
-rw-r--r-- | ds9/parsers/srgbcubeparser.tac | 8 |
6 files changed, 67 insertions, 8 deletions
diff --git a/ds9/library/sfits.tcl b/ds9/library/sfits.tcl index e976e20..d2cfdca 100644 --- a/ds9/library/sfits.tcl +++ b/ds9/library/sfits.tcl @@ -21,12 +21,16 @@ proc ProcessSFitsCmd {varname iname sock fn} { upvar $varname var upvar $iname i - global loadParam - global current + global debug + if {$debug(tcl,parser)} { + sfits::YY_FLUSH_BUFFER + sfits::yy_scan_string [lrange $var $i end] + sfits::yyparse + incr i [expr $sfits::yycnt-1] + } else { set layer {} set mode {} - switch -- [string tolower [lindex $var $i]] { new { incr i @@ -61,3 +65,4 @@ proc ProcessSFitsCmd {varname iname sock fn} { } FinishLoad } +} diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 236441f..239838d 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -314,6 +314,8 @@ source $ds9(root)/library/saveimageparser.tcl source $ds9(root)/library/saveimagelex.tcl source $ds9(root)/library/scaleparser.tcl source $ds9(root)/library/scalelex.tcl +source $ds9(root)/library/sfitsparser.tcl +source $ds9(root)/library/sfitslex.tcl source $ds9(root)/library/siaparser.tcl source $ds9(root)/library/sialex.tcl source $ds9(root)/library/skyviewparser.tcl diff --git a/ds9/parsers/sfitslex.fcl b/ds9/parsers/sfitslex.fcl new file mode 100644 index 0000000..5baebf6 --- /dev/null +++ b/ds9/parsers/sfitslex.fcl @@ -0,0 +1,16 @@ +#tab sfitsparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +mask {return $MASK_} +new {return $NEW_} +slice {return $SLICE_} + +#include string.fin + +%% diff --git a/ds9/parsers/sfitsparser.tac b/ds9/parsers/sfitsparser.tac new file mode 100644 index 0000000..3340139 --- /dev/null +++ b/ds9/parsers/sfitsparser.tac @@ -0,0 +1,36 @@ +%{ +%} + +#include string.tin + +%start command + +%token MASK_ +%token NEW_ +%token SLICE_ + +%% + +command : sfits + | sfits {yyclearin; YYACCEPT} STRING_ + ; + +sfits: new STRING_ STRING_ {LoadSFitsFile $2 $3 {} {}} + | new MASK_ STRING_ STRING_ {LoadSFitsFile $3 $4 mask {}} + | new SLICE_ STRING_ STRING_ {LoadSFitsFile $3 $4 {} slice} + | new MASK_ SLICE_ STRING_ STRING_ {LoadSFitsFile $4 $5 mask slice} +; + +new : + | NEW_ {CreateFrame} + ; + +%% + +proc sfits::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/srgbcubelex.fcl b/ds9/parsers/srgbcubelex.fcl index bf43fb5..f70cdca 100644 --- a/ds9/parsers/srgbcubelex.fcl +++ b/ds9/parsers/srgbcubelex.fcl @@ -1,4 +1,4 @@ -#tab rgbcubeparser.tab.tcl +#tab srgbcubeparser.tab.tcl %{ %} diff --git a/ds9/parsers/srgbcubeparser.tac b/ds9/parsers/srgbcubeparser.tac index 34b386a..b0bab2d 100644 --- a/ds9/parsers/srgbcubeparser.tac +++ b/ds9/parsers/srgbcubeparser.tac @@ -9,11 +9,11 @@ %% -command : rgbcube - | rgbcube {yyclearin; YYACCEPT} STRING_ +command : srgbcube + | srgbcube {yyclearin; YYACCEPT} STRING_ ; -rgbcube : opts STRING_ STRING_ {LoadSRGBCubeFile $2 $3} +srgbcube : opts STRING_ STRING_ {LoadSRGBCubeFile $2 $3} ; opts : @@ -22,7 +22,7 @@ opts : %% -proc rgbcube::yyerror {msg} { +proc srgbcube::yyerror {msg} { variable yycnt variable yy_current_buffer variable index_ |