summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-03-09 22:15:28 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-03-09 22:15:28 (GMT)
commit1b837a16415462f57015738741de8dc719bbe76f (patch)
treec99d5f206aba56994e906ac94cf66ef84b5b03eb
parent06bd2deb4d175c1b779cb15076103d165150f3f0 (diff)
downloadblt-1b837a16415462f57015738741de8dc719bbe76f.zip
blt-1b837a16415462f57015738741de8dc719bbe76f.tar.gz
blt-1b837a16415462f57015738741de8dc719bbe76f.tar.bz2
add crop ds9 parser
-rw-r--r--ds9/library/crop.tcl13
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/parsers/coords.fin7
-rw-r--r--ds9/parsers/coords.tin8
-rw-r--r--ds9/parsers/coords.trl19
-rw-r--r--ds9/parsers/panlex.fcl1
-rw-r--r--ds9/parsers/panparser.tac2
-rw-r--r--ds9/parsers/skyformat.fin3
-rw-r--r--ds9/parsers/skyformat.tin3
-rw-r--r--ds9/parsers/skyformat.trl8
-rw-r--r--ds9/parsers/skyframe.fin6
-rw-r--r--ds9/parsers/skyframe.tin7
-rw-r--r--ds9/parsers/skyframe.trl17
13 files changed, 69 insertions, 27 deletions
diff --git a/ds9/library/crop.tcl b/ds9/library/crop.tcl
index f2e0fbc..6c71d91 100644
--- a/ds9/library/crop.tcl
+++ b/ds9/library/crop.tcl
@@ -388,6 +388,19 @@ proc CropBackupRGB {ch which} {
proc ProcessCropCmd {varname iname} {
upvar $varname var
+ upvar $iname ii
+
+ # we need to be realized
+ ProcessRealizeDS9
+
+ crop::YY_FLUSH_BUFFER
+ crop::yy_scan_string [lrange $var $ii end]
+ crop::yyparse
+ incr ii [expr $crop::yycnt-1]
+}
+
+proc oProcessCropCmd {varname iname} {
+ upvar $varname var
upvar $iname i
# we need to be realized
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index 6318920..4cd0890 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -196,6 +196,8 @@ source $ds9(root)/library/cmapparser.tcl
source $ds9(root)/library/cmaplex.tcl
source $ds9(root)/library/colorbarparser.tcl
source $ds9(root)/library/colorbarlex.tcl
+source $ds9(root)/library/cropparser.tcl
+source $ds9(root)/library/croplex.tcl
source $ds9(root)/library/dssesoparser.tcl
source $ds9(root)/library/dssesolex.tcl
source $ds9(root)/library/dsssaoparser.tcl
diff --git a/ds9/parsers/coords.fin b/ds9/parsers/coords.fin
index 394be49..ee01c50 100644
--- a/ds9/parsers/coords.fin
+++ b/ds9/parsers/coords.fin
@@ -31,13 +31,6 @@ physical {return $PHYSICAL_}
amplifier {return $AMPLIFIER_}
detector {return $DETECTOR_}
-fk4 {return $FK4_}
-b1950 {return $FK4_}
-fk5 {return $FK5_}
-j2000 {return $FK5_}
-galactic {return $GALACTIC_}
-ecliptic {return $ECLIPTIC_}
-
# SEXAGESIMAL
[+-]?{D}+:{D}+:{D}+"."? |
[+-]?{D}+:{D}+:{D}*"."{D}+ {set yylval $yytext; return $SEXSTR_}
diff --git a/ds9/parsers/coords.tin b/ds9/parsers/coords.tin
index ea9b92e..cd90bdd 100644
--- a/ds9/parsers/coords.tin
+++ b/ds9/parsers/coords.tin
@@ -32,11 +32,3 @@
%token WCSX_
%token WCSY_
%token WCSZ_
-
-%token FK4_
-%token FK5_
-%token ICRS_
-%token GALACTIC_
-%token ECLIPTIC_
-%token J2000_
-%token B1950_
diff --git a/ds9/parsers/coords.trl b/ds9/parsers/coords.trl
index 75a0871..f0b5f86 100644
--- a/ds9/parsers/coords.trl
+++ b/ds9/parsers/coords.trl
@@ -9,6 +9,10 @@ coordsys : IMAGE_ {set _ image}
# YYABORT
# }
+coordsysdef : {set _ physcial}
+ | coordsys {set _ $1}
+ ;
+
wcssys : WCS_ {set _ wcs}
| WCSA_ {set _ wcsa}
| WCSB_ {set _ wcsb}
@@ -43,16 +47,7 @@ wcssys : WCS_ {set _ wcs}
# YYABORT
# }
-skyframe : FK4_ {set _ fk4}
- | B1950_ {set _ fk4}
- | FK5_ {set _ fk5}
- | J2000_ {set _ fk5}
- | ICRS_ {set _ icrs}
- | GALACTIC_ {set _ galactic}
- | ECLIPTIC_ {set _ ecliptic}
+wcssysdef : {set _ wcs}
+ | wcssys {set _ $1}
;
-
-# | error {
-# yyerror "must be: fk4|fk5|icrs|galactic|ecliptic"
-# YYABORT
-# }
+
diff --git a/ds9/parsers/panlex.fcl b/ds9/parsers/panlex.fcl
index bc078fc..31f18b1 100644
--- a/ds9/parsers/panlex.fcl
+++ b/ds9/parsers/panlex.fcl
@@ -11,6 +11,7 @@ close {return $CLOSE_}
open {return $OPEN_}
to {return $TO_}
+#include skyframe.fin
#include coords.fin
#include base.fin
diff --git a/ds9/parsers/panparser.tac b/ds9/parsers/panparser.tac
index 3934b7a..68b78d7 100644
--- a/ds9/parsers/panparser.tac
+++ b/ds9/parsers/panparser.tac
@@ -1,6 +1,7 @@
%{
%}
+#include skyframe.tin
#include coords.tin
#include base.tin
@@ -12,6 +13,7 @@
%%
+#include skyframe.trl
#include coords.trl
#include base.trl
diff --git a/ds9/parsers/skyformat.fin b/ds9/parsers/skyformat.fin
new file mode 100644
index 0000000..d52ed71
--- /dev/null
+++ b/ds9/parsers/skyformat.fin
@@ -0,0 +1,3 @@
+degrees {return $DEGREES_}
+arcmin {return $ARCMIN_}
+arcsec {return $ARCSEC_}
diff --git a/ds9/parsers/skyformat.tin b/ds9/parsers/skyformat.tin
new file mode 100644
index 0000000..2fd83f8
--- /dev/null
+++ b/ds9/parsers/skyformat.tin
@@ -0,0 +1,3 @@
+%token DEGREES_
+%token ARCMIN_
+%token ARCSEC_
diff --git a/ds9/parsers/skyformat.trl b/ds9/parsers/skyformat.trl
new file mode 100644
index 0000000..a0685b5
--- /dev/null
+++ b/ds9/parsers/skyformat.trl
@@ -0,0 +1,8 @@
+skyformat : DEGREES_ {set _ degrees}
+ | ARCMIN_ {set _ arcmin}
+ | ARCSEC_ {set _ arcsec}
+ ;
+
+skyformatdef : {set _ degrees}
+ | skyformat {set _ $1}
+ ;
diff --git a/ds9/parsers/skyframe.fin b/ds9/parsers/skyframe.fin
new file mode 100644
index 0000000..6b21803
--- /dev/null
+++ b/ds9/parsers/skyframe.fin
@@ -0,0 +1,6 @@
+fk4 {return $FK4_}
+b1950 {return $FK4_}
+fk5 {return $FK5_}
+j2000 {return $FK5_}
+galactic {return $GALACTIC_}
+ecliptic {return $ECLIPTIC_}
diff --git a/ds9/parsers/skyframe.tin b/ds9/parsers/skyframe.tin
new file mode 100644
index 0000000..3ea09b8
--- /dev/null
+++ b/ds9/parsers/skyframe.tin
@@ -0,0 +1,7 @@
+%token FK4_
+%token FK5_
+%token ICRS_
+%token GALACTIC_
+%token ECLIPTIC_
+%token J2000_
+%token B1950_
diff --git a/ds9/parsers/skyframe.trl b/ds9/parsers/skyframe.trl
new file mode 100644
index 0000000..b9a7a41
--- /dev/null
+++ b/ds9/parsers/skyframe.trl
@@ -0,0 +1,17 @@
+skyframe : FK4_ {set _ fk4}
+ | B1950_ {set _ fk4}
+ | FK5_ {set _ fk5}
+ | J2000_ {set _ fk5}
+ | ICRS_ {set _ icrs}
+ | GALACTIC_ {set _ galactic}
+ | ECLIPTIC_ {set _ ecliptic}
+ ;
+
+# | error {
+# yyerror "must be: fk4|fk5|icrs|galactic|ecliptic"
+# YYABORT
+# }
+
+skyframedef : {set _ fk5}
+ | skyframe {set _ $1}
+ ;