From 69a0db6f952dbb1c0359667cbec48407770083d2 Mon Sep 17 00:00:00 2001
From: William Joye
Date: Tue, 19 Jun 2018 13:47:50 -0400
Subject: add ds9 fits send parser
---
ds9/doc/ref/samp.html | 163 ++++++++++++++++++++++++++++-------------
ds9/doc/ref/xpa.html | 82 ++++++++++++++++++++-
ds9/library/fits.tcl | 106 +++++++++------------------
ds9/library/source.tcl | 2 +
ds9/parsers/fitssendlex.fcl | 31 ++++++++
ds9/parsers/fitssendparser.tac | 83 +++++++++++++++++++++
6 files changed, 342 insertions(+), 125 deletions(-)
create mode 100644 ds9/parsers/fitssendlex.fcl
create mode 100644 ds9/parsers/fitssendparser.tac
diff --git a/ds9/doc/ref/samp.html b/ds9/doc/ref/samp.html
index 82c25c4..00e092c 100644
--- a/ds9/doc/ref/samp.html
+++ b/ds9/doc/ref/samp.html
@@ -581,6 +581,7 @@
+
[crosshair]
[<ref>] [dec
<col>]
@@ -698,6 +699,7 @@
+
[match error <value> degrees|arcmin|arcsec]
[<ref>]
@@ -797,6 +799,7 @@
+
[match function 1and2|1not2|2not1]
[<ref>]
@@ -896,6 +899,7 @@
+
[match return 1and2|1only|2only]
[<ref>]
@@ -995,6 +999,7 @@
+
[match unique yes|no]
[<ref>] [maxrows
<number>]
@@ -1050,6 +1055,7 @@
+
[symbol shape circle
@@ -1057,6 +1063,7 @@
+
point|box point|diamond point|cross
@@ -1064,6 +1071,7 @@
+
point|x point|arrow point|boxcircle point]
[<ref>]
[symbol add| [#] remove]
@@ -1169,6 +1177,7 @@
+
[update]
[<ref>] [x
<col>]
@@ -1773,60 +1782,40 @@
fits mask
Syntax:
- fits [size|width|height|depth|bitpix]
- [size [wcs|wcsa...wcsz]
- [fk4|fk5|icrs|galactic|ecliptic] [degrees|arcmin|arcsecs]]
- [type]
- [header [<ext>] [keyword
- <string>]]
- [image|table|resample] [gz]
- [new|mask][<options>]
- [new][slice <options>]
- [new][mecube <options>]
- [new|mask][mosaicimage
- [iraf|wcs|wcsa...wcsz|wfpc2] <options>]
- [new|mask][mosaic
- [iraf|wcs|wcsa...wcsz] <options>]
- [new][rgbcube <options>]
- [new][rgbimage <options>]
-
+ fits [new|mask|slice]
+ [<filename>]
+ [width|height|depth|bitpix]
+ [size [wcs|wcsa...wcsz]
+ [fk4|fk5|icrs|galactic|ecliptic] [degrees|arcmin|arcsecs]]
+ [header [<ext>] [keyword
+ <string>]]
+ [image|table|slice]
+
Example:
string value = ds9.get(string cmd)
- fits size
- fits width
- fits height
- fits depth
- fits bitpix
- fits size wcs fk5 arcmin
- fits type
- fits header keyword BITPIX
- fits header 1 keyword BITPIX
- string url = ds9.get(string cmd)
+ fits width
+ fits height
+ fits depth
+ fits bitpix
+ fits size
+ fits size wcs fk5 arcmin
+ fits header # primary
+ fits header 2 # hdu 2
+ fits header -2 # hdu 2 with inherit
+ fits header keyword BITPIX
+ fits header 1 keyword BITPIX
fits
fits image
- fits image gz
- fits table
- fits table gz
- fits resample
- fits resample gz
- fits header # primary
- fits header 2 # hdu 2
- fits header -2 # hdu 2 with inherit
- ds9.set(string cmd, string url)
- fits
- fits [2]
- fits new [bin=detx,dety]
- fits slice
- fits mecube
- fits mosaicimage iraf
- fits mosaicimage wcs
- fits mosaicimage wcsa
- fits mosaicimage wfpc2
- fits mosaic iraf
- fits mosaic wcs
- fits rgbcube
- fits rgbimage
- frame
+ fits table
+ fits slice
+ ds9.set(string cmd, string url)
+ fits foo.fits
+ fits new foo.fits
+ fits bar.fits[bin=detx,dety]
+ fits slice foo.fits
+ fits mask foo.fits
+
+ frame
Controls frame functions. Frames may be created, deleted,
reset, and centered. While return the current frame number. If
you goto a frame that does not exists, it will be created. If
@@ -2238,6 +2227,7 @@
+
Macros for more information.
Syntax:
iexam []
@@ -2362,6 +2352,7 @@
+
quality (1-100)
Syntax:
jpeg [new|slice] [<filename>] [1-100]
@@ -2810,6 +2801,7 @@
+
[new name <plotname> line|bar|scatter]
# load data into existing plot from
@@ -2896,6 +2888,7 @@
+
duplicate [#]]
@@ -2972,6 +2965,7 @@
+
[[<plotname>] stats yes|no]
[[<plotname>]
@@ -3047,6 +3041,7 @@
+
list yes|no]
[[<plotname>]
@@ -3122,6 +3117,7 @@
+
loadconfig <filename>]
[[<plotname>] saveconfig
<filename>]
@@ -3199,6 +3195,7 @@
+
[[<plotname>] pagesetup orient portrait|landscape]
[[<plotname>] pagesetup
size letter|legal|tabloid|poster|a4]
@@ -3276,6 +3273,7 @@
+
[[<plotname>] print]
[[<plotname>] print
destination printer|file]
@@ -3375,6 +3373,7 @@
+
legend yes|no]
[[<plotname>] legend position
right|left|top|bottom]
@@ -3461,6 +3460,7 @@
+
barmode normal|stacked|aligned|overlap]
# configure current dataset
@@ -3539,6 +3539,7 @@
+
shape
circle|square|diamond|plus|splus|scross|triangle|arrow]
[[<plotname>]
@@ -3615,6 +3616,7 @@
+
shape fill yes|no]
[[<plotname>]
@@ -3694,6 +3696,7 @@
+
[[<plotname>]
@@ -3768,6 +3771,7 @@
+
smooth
step|linear|cubic|quadratic|catrom]
@@ -3845,6 +3849,7 @@
+
[[<plotname>]
@@ -3919,6 +3924,7 @@
+
color
<value>]
@@ -3996,6 +4002,7 @@
+
[[<plotname>]
@@ -4070,6 +4077,7 @@
+
width
<value>]
@@ -4147,6 +4155,7 @@
+
[[<plotname>]
@@ -4221,6 +4230,7 @@
+
dash yes|no]
@@ -4297,6 +4307,7 @@
+
[[<plotname>]
@@ -4371,6 +4382,7 @@
+
error yes|no]
@@ -4447,6 +4459,7 @@
+
[[<plotname>]
@@ -4521,6 +4534,7 @@
+
error color
<value>]
@@ -4598,6 +4612,7 @@
+
[[<plotname>]
@@ -4672,6 +4687,7 @@
+
color
<value>]
@@ -4749,6 +4765,7 @@
+
[[<plotname>]
@@ -4823,6 +4840,7 @@
+
error width
<value>]
@@ -4900,6 +4918,7 @@
+
[[<plotname>]
@@ -4974,6 +4993,7 @@
+
name
<string>]
@@ -5068,6 +5088,7 @@
+
value = ds9.get(string cmd)
plot
stats
@@ -5170,6 +5191,7 @@
+
axis x auto
plot
@@ -5240,6 +5262,7 @@
+
axis x min
plot
@@ -5310,6 +5333,7 @@
+
axis x max
plot
@@ -5380,6 +5404,7 @@
+
axis x format
plot
@@ -5450,6 +5475,7 @@
+
legend
plot legend
position
@@ -5528,6 +5554,7 @@
+
font numbers size
plot
@@ -5602,6 +5629,7 @@
+
font numbers weight
plot
@@ -5676,6 +5704,7 @@
+
font numbers slant
plot
@@ -5750,6 +5779,7 @@
+
title
plot
@@ -5824,6 +5854,7 @@
+
title x
plot barmode
@@ -5848,6 +5879,7 @@
+
cmd)
plot legend yes
plot legend position left
@@ -5858,6 +5890,7 @@
+
value = ds9.get(string cmd)
plot font
numbers font
@@ -5867,6 +5900,7 @@
+
font numbers size
plot
@@ -5874,6 +5908,7 @@
+
font numbers weight
plot
@@ -5881,6 +5916,7 @@
+
font numbers slant
ds9.set(string
@@ -5888,6 +5924,7 @@
+
cmd)
plot font numbers font times
plot font numbers size 12
@@ -5900,6 +5937,7 @@
+
value = ds9.get(string
cmd)
plot
@@ -5908,6 +5946,7 @@
+
title
plot
@@ -5915,6 +5954,7 @@
+
title xaxis
plot
@@ -5922,6 +5962,7 @@
+
title yaxis
ds9.set(string
@@ -5929,6 +5970,7 @@
+
cmd)
plot title "This is a Title"
plot title x "X Axis"
@@ -5941,6 +5983,7 @@
+
value =
ds9.get(string
cmd)
@@ -5950,6 +5993,7 @@
+
barmode
ds9.set(string
@@ -5958,6 +6002,7 @@
+
cmd)
plot barmode aligned
@@ -6045,6 +6090,7 @@
+
dash
plot
@@ -6119,6 +6165,7 @@
+
error
plot
@@ -6193,6 +6240,7 @@
+
error color
plot
@@ -6267,6 +6315,7 @@
+
error width
plot
@@ -6341,6 +6390,7 @@
+
name
ds9.set(string
@@ -6415,6 +6465,7 @@
+
cmd)
plot show yes
plot shape circle
@@ -6464,6 +6515,7 @@
+
<dms>
<arcmin> <arcsec>
@@ -7084,6 +7136,7 @@
+
[crosshair]
[<ref>]
[export sb|tsv <filename>]
@@ -7200,6 +7253,7 @@
+
[update]
Example:
@@ -7322,6 +7376,7 @@
+
[sigma <value>]
@@ -7337,6 +7392,7 @@
+
[sigmaminor <value>]
@@ -7353,6 +7409,7 @@
+
[angle <value>]
@@ -7369,6 +7426,7 @@
+
[match]
[lock [yes|no]]
[open|close]
@@ -7404,6 +7462,7 @@
+
sigma 2.0
smooth
@@ -7420,6 +7479,7 @@
+
sigmaminor 2.0
smooth
@@ -7436,6 +7496,7 @@
+
angle 45
smooth
@@ -7452,6 +7513,7 @@
+
open
smooth close
smooth match
@@ -7577,6 +7639,7 @@
+
compression method.
Syntax:
tiff [new|slice] [<filename>] [none|jpeg|packbits|deflate]
diff --git a/ds9/doc/ref/xpa.html b/ds9/doc/ref/xpa.html
index af2de5e..af9c244 100644
--- a/ds9/doc/ref/xpa.html
+++ b/ds9/doc/ref/xpa.html
@@ -218,6 +218,7 @@
+
-p ds9 3d match
$xpaset -p ds9 3d lock
yes
@@ -235,6 +236,7 @@
+
-p ds9 3d open
$xpaset -p ds9 3d close
@@ -572,6 +574,7 @@
+
[crosshair]
[<ref>] [dec
<col>]
@@ -694,6 +697,7 @@
+
[match error <value> degrees|arcmin|arcsec]
[<ref>]
@@ -798,6 +802,7 @@
+
[match function 1and2|1not2|2not1]
[<ref>]
@@ -902,6 +907,7 @@
+
[match return 1and2|1only|2only]
[<ref>]
@@ -1006,6 +1012,7 @@
+
[match unique yes|no]
[<ref>] [maxrows
<number>]
@@ -1060,6 +1067,7 @@
+
[symbol shape circle point|box
point|diamond point|cross point|x point|arrow
point|boxcircle point]
@@ -1172,6 +1180,7 @@
+
[update]
[<ref>] [x
<col>]
@@ -1765,6 +1774,7 @@
+
-p ds9 export envi foo.hdr foo.bsq little
$xpaset -p ds9 export tiff
foo.tiff jpeg
@@ -1783,7 +1793,7 @@
Syntax:
fits [new|mask|slice] [<filename>]
- [width|height|depth|bitpix|type]
+ [width|height|depth|bitpix]
[size [wcs|wcsa...wcsz]
[fk4|fk5|icrs|galactic|ecliptic] [degrees|arcmin|arcsecs]]
[header [<ext>] [keyword
@@ -1796,7 +1806,6 @@
$xpaget ds9 fits height
$xpaget ds9 fits depth
$xpaget ds9 fits bitpix
- $xpaget ds9 fits type
$xpaget ds9 fits size
$xpaget ds9 fits size wcs fk5 arcmin
$xpaget ds9 fits header # primary
@@ -2304,6 +2313,7 @@
+
quality (1-100)
Syntax:
jpeg [new|slice] [<filename>] [1-100]
@@ -2727,6 +2737,7 @@
+
[new name <plotname> line|bar|scatter]
# create new plot with data from stdin
@@ -2737,6 +2748,7 @@
+
[new
<title> <xaxis label>
<yaxis label> xy|xyex|xyey|xyexey]
@@ -2752,6 +2764,7 @@
+
[new name
@@ -2759,6 +2772,7 @@
+
<plotname> <title>
@@ -2766,6 +2780,7 @@
+
<xaxis label> <yaxis label> xy|xyex|xyey|xyexey]
[new name
@@ -2774,6 +2789,7 @@
+
<plotname> line|bar|scatter
@@ -2781,6 +2797,7 @@
+
<title> <xaxis label> <yaxis
label> xy|xyex|xyey|xyexey]
@@ -2795,6 +2812,7 @@
+
[line|bar|scatter]
@@ -2802,6 +2820,7 @@
+
stdin]
@@ -2811,6 +2830,7 @@
+
[new name <plotname>
stdin]
@@ -2821,6 +2841,7 @@
+
stdin]
# load data into existing plot from
@@ -2908,6 +2929,7 @@
+
duplicate [#]]
@@ -2985,6 +3007,7 @@
+
[[<plotname>] stats yes|no]
[[<plotname>]
@@ -3061,6 +3084,7 @@
+
list yes|no]
[[<plotname>]
@@ -3137,6 +3161,7 @@
+
loadconfig <filename>]
[[<plotname>] saveconfig
<filename>]
@@ -3215,6 +3240,7 @@
+
[[<plotname>] pagesetup orient portrait|landscape]
[[<plotname>] pagesetup
size letter|legal|tabloid|poster|a4]
@@ -3293,6 +3319,7 @@
+
[[<plotname>] print]
[[<plotname>] print
destination printer|file]
@@ -3393,6 +3420,7 @@
+
legend yes|no]
[[<plotname>] legend position
right|left|top|bottom]
@@ -3480,6 +3508,7 @@
+
barmode normal|stacked|aligned|overlap]
# configure current dataset
@@ -3559,6 +3588,7 @@
+
shape
circle|square|diamond|plus|splus|scross|triangle|arrow]
[[<plotname>]
@@ -3636,6 +3666,7 @@
+
shape fill yes|no]
[[<plotname>]
@@ -3716,6 +3747,7 @@
+
[[<plotname>]
@@ -3791,6 +3823,7 @@
+
smooth
step|linear|cubic|quadratic|catrom]
@@ -3869,6 +3902,7 @@
+
[[<plotname>]
@@ -3944,6 +3978,7 @@
+
color
<value>]
@@ -4022,6 +4057,7 @@
+
[[<plotname>]
@@ -4097,6 +4133,7 @@
+
width
<value>]
@@ -4175,6 +4212,7 @@
+
[[<plotname>]
@@ -4250,6 +4288,7 @@
+
dash yes|no]
@@ -4327,6 +4366,7 @@
+
[[<plotname>]
@@ -4402,6 +4442,7 @@
+
error yes|no]
@@ -4479,6 +4520,7 @@
+
[[<plotname>]
@@ -4554,6 +4596,7 @@
+
error color
<value>]
@@ -4632,6 +4675,7 @@
+
[[<plotname>]
@@ -4707,6 +4751,7 @@
+
color
<value>]
@@ -4785,6 +4830,7 @@
+
[[<plotname>]
@@ -4860,6 +4906,7 @@
+
error width
<value>]
@@ -4938,6 +4985,7 @@
+
[[<plotname>]
@@ -5013,6 +5061,7 @@
+
name
<string>]
@@ -5058,6 +5107,7 @@
+
data into existing plot from stdin
$cat xy.dat | xpaset ds9 plot data xy
$cat xy.dat | xpaset ds9 plot foo data xy
@@ -5167,6 +5217,7 @@
+
ds9 plot axis x min
$xpaget
@@ -5243,6 +5294,7 @@
+
ds9 plot axis x max
$xpaget ds9 plot axis x format
$xpaset
@@ -5252,6 +5304,7 @@
+
-p ds9 plot axis x grid yes
$xpaset -p ds9 plot axis x log yes
$xpaset -p ds9 plot axis x flip yes
@@ -5343,6 +5396,7 @@
+
ds9 plot font numbers size
$xpaget
@@ -5419,6 +5473,7 @@
+
ds9 plot font numbers weight
$xpaget
@@ -5495,6 +5550,7 @@
+
ds9 plot font numbers slant
$xpaset
@@ -5503,6 +5559,7 @@
+
-p ds9 plot font numbers font times
$xpaset -p ds9 plot font numbers size 12
$xpaset -p ds9 plot font numbers weight bold
@@ -5584,6 +5641,7 @@
+
ds9 plot title xaxis
$xpaget
@@ -5660,6 +5718,7 @@
+
ds9 plot title yaxis
$xpaset
@@ -5668,6 +5727,7 @@
+
-p ds9 plot title {This is a Title}
$xpaset -p ds9 plot title x {X Axis}
$xpaset -p ds9 plot title y {Y Axis}
@@ -5763,6 +5823,7 @@
+
ds9 plot dash
$xpaget
@@ -5839,6 +5900,7 @@
+
ds9 plot error
$xpaget
@@ -5915,6 +5977,7 @@
+
ds9 plot error
color
$xpaget
@@ -5992,6 +6055,7 @@
+
ds9 plot error
width
$xpaget
@@ -6069,6 +6133,7 @@
+
ds9 plot name
$xpaset
@@ -6145,6 +6210,7 @@
+
-p ds9 plot show yes
$xpaset -p ds9 plot shape circle
$xpaset -p ds9 plot shape fill no
@@ -6192,6 +6258,7 @@
+
<dms>
<arcmin> <arcsec>
@@ -6689,6 +6756,7 @@
+
method.
Syntax:
saveimage [fits|eps|gif|tiff|jpeg|png] <filename>
@@ -6922,6 +6990,7 @@
+
[sigma <value>]
@@ -6939,6 +7008,7 @@
+
[sigmaminor <value>]
@@ -6956,6 +7026,7 @@
+
[angle <value>]
@@ -6973,6 +7044,7 @@
+
[match]
[lock [yes|no]]
[open|close]
@@ -6998,6 +7070,7 @@
+
ds9 smooth sigmaminor
$xpaget
ds9 smooth lock
@@ -7023,6 +7096,7 @@
+
-p ds9 smooth sigma 2.0
$xpaset
@@ -7040,6 +7114,7 @@
+
-p ds9 smooth sigmaminor 2.0
$xpaset
@@ -7057,6 +7132,7 @@
+
-p ds9 smooth angle 45
$xpaset
@@ -7074,6 +7150,7 @@
+
-p ds9 smooth match
$xpaset -p ds9 smooth lock yes
$xpaset -p ds9 smooth open
@@ -7199,6 +7276,7 @@
+
compression method.
Syntax:
tiff [new|slice] [<filename>] [none|jpeg|packbits|deflate]
diff --git a/ds9/library/fits.tcl b/ds9/library/fits.tcl
index 86f02a3..1c5ab0f 100644
--- a/ds9/library/fits.tcl
+++ b/ds9/library/fits.tcl
@@ -138,85 +138,45 @@ proc FitsCmdLoad {param layer mode} {
}
proc ProcessSendFitsCmd {proc id param sock fn} {
- global current
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
- if {$current(frame) == {}} {
- return
+ fitssend::YY_FLUSH_BUFFER
+ fitssend::yy_scan_string $param
+ fitssend::yyparse
+}
+
+proc FitsSendCmd {which} {
+ global parse
+
+ if {$parse(sock) != {}} {
+ # xpa
+ SaveFitsSocket $which $parse(sock)
+ } elseif {$parse(fn) != {}} {
+ # comm
+ SaveFitsFile $which $parse(fn)
+ $parse(proc) $parse(id) {} $parse(fn)
}
+}
- set which image
+proc FitsSendCmdType {} {
+ global current
- switch -- [string tolower [lindex $param 0]] {
- width {
- $proc $id "[$current(frame) get fits width]\n"
- return
- }
- height {
- $proc $id "[$current(frame) get fits height]\n"
- return
- }
- depth {
- $proc $id "[$current(frame) get fits depth 2]\n"
- return
- }
- bitpix {
- $proc $id "[$current(frame) get fits bitpix]\n"
- return
- }
- size {
- set sys [lindex $param 1]
- set sky [lindex $param 2]
- set format [lindex $param 3]
- if {$sys == {} && $sky == {} && $format == {}} {
- $proc $id "[$current(frame) get fits size]\n"
- } else {
- FixSpec sys sky format image fk5 degrees
- $proc $id "[$current(frame) get fits size $sys $sky $format]\n"
- }
- return
- }
- header {
- switch -- [llength $param] {
- 1 {ProcessSend $proc $id {} $fn {.txt} "[$current(frame) get fits header 1]\n"}
- 2 {ProcessSend $proc $id {} $fn {.txt} "[$current(frame) get fits header [lindex $param 1]]\n"}
- 3 {
- set key [lindex $param 2]
- set key [string trim $key \']
- set key [string trim $key \{]
- set key [string trim $key \}]
- $proc $id "[string trim [$current(frame) get fits header keyword \{$key\}]]\n"
- }
- 4 {
- set key [lindex $param 3]
- set key [string trim $key \']
- set key [string trim $key \{]
- set key [string trim $key \}]
- $proc $id "[string trim [$current(frame) get fits header [lindex $param 1] keyword \{$key\}]]\n"
- }
- }
- return
- }
- type {
- if {[$current(frame) has fits bin]} {
- $proc $id "table\n"
- } else {
- $proc $id "image\n"
- }
- return
- }
- table {set which table}
- image {}
- slice {set which slice}
- resample {set which resample}
+ if {$current(frame) == {}} {
+ return
}
- if {$sock != {}} {
- # xpa
- SaveFitsSocket $which $sock
- } elseif {$fn != {}} {
- # comm
- SaveFitsFile $which $fn
- $proc $id {} $fn
+ if {[$current(frame) has fits bin]} {
+ ProcessSendCmdTxt "table"
+ } elseif {[$current(frame) has fits cube]} {
+ ProcessSendCmdTxt "cube"
+ } elseif {[$current(frame) has fits mosaic]} {
+ ProcessSendCmdTxt "mosaic"
+ } elseif {[$current(frame) has fits]} {
+ ProcessSendCmdTxt "image"
+ } else {
+ return
}
}
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index f71b9e0..26ca935 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -258,6 +258,8 @@ source $ds9(root)/library/exportparser.tcl
source $ds9(root)/library/exportlex.tcl
source $ds9(root)/library/fitsparser.tcl
source $ds9(root)/library/fitslex.tcl
+source $ds9(root)/library/fitssendparser.tcl
+source $ds9(root)/library/fitssendlex.tcl
source $ds9(root)/library/frameparser.tcl
source $ds9(root)/library/framelex.tcl
source $ds9(root)/library/framesendparser.tcl
diff --git a/ds9/parsers/fitssendlex.fcl b/ds9/parsers/fitssendlex.fcl
new file mode 100644
index 0000000..3678ff8
--- /dev/null
+++ b/ds9/parsers/fitssendlex.fcl
@@ -0,0 +1,31 @@
+#tab fitssendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+bitpix {return $BITPIX_}
+depth {return $DEPTH_}
+gz {return $GZ_}
+header {return $HEADER_}
+height {return $HEIGHT_}
+image {return $IMAGE_}
+keyword {return $KEYWORD_}
+resample {return $RESAMPLE_}
+size {return $SIZE_}
+slice {return $SLICE_}
+table {return $TABLE_}
+type {return $TYPE_}
+width {return $WIDTH_}
+
+#include wcssys.fin
+#include skyframe.fin
+#include rformat.fin
+#include int.fin
+#include string.fin
+#include ws.fin
+
+%%
diff --git a/ds9/parsers/fitssendparser.tac b/ds9/parsers/fitssendparser.tac
new file mode 100644
index 0000000..9d334a9
--- /dev/null
+++ b/ds9/parsers/fitssendparser.tac
@@ -0,0 +1,83 @@
+%{
+%}
+
+#include wcssys.tin
+#include skyframe.tin
+#include rformat.tin
+#include int.tin
+#include string.tin
+
+%start fitssend
+
+%token BITPIX_
+%token DEPTH_
+%token GZ_
+%token HEADER_
+%token HEIGHT_
+%token IMAGE_
+%token KEYWORD_
+%token RESAMPLE_
+%token SIZE_
+%token SLICE_
+%token TABLE_
+%token TYPE_
+%token WIDTH_
+
+%%
+
+#include wcssys.trl
+#include skyframe.trl
+#include rformat.trl
+
+fitssend: WIDTH_ {ProcessSendCmdCurrent "get fits width"}
+ | HEIGHT_ {ProcessSendCmdCurrent "get fits height"}
+ | DEPTH_ {ProcessSendCmdCurrent "get fits depth 2"}
+ | BITPIX_ {ProcessSendCmdCurrent "get fits bitpix"}
+# backward compatibility
+ | TYPE_ {FitsSendCmdType}
+ | SIZE_ size
+ | HEADER_ header
+ | opt gz {FitsSendCmd $1}
+;
+
+size : {ProcessSendCmdCurrent "get fits size"}
+ | wcssys {ProcessSendCmdCurrent "get fits size $1 fk5 degrees"}
+ | skyframe {ProcessSendCmdCurrent "get fits size wcs $1 degrees"}
+ | rformat {ProcessSendCmdCurrent "get fits size wcs fk5 $1"}
+ | wcssys skyframe {ProcessSendCmdCurrent "get fits size $1 $2 degrees"}
+ | wcssys rformat {ProcessSendCmdCurrent "get fits size $1 fk5 $2"}
+ | skyframe rformat {ProcessSendCmdCurrent "get fits size wcs $1 $2"}
+ | wcssys skyframe rformat {ProcessSendCmdCurrent "get fits size $1 $2 $3"}
+ ;
+
+header : {ProcessSendCmdSend {.txt} "get fits header 1"}
+ | INT_ {ProcessSendCmdSend {.txt} "get fits header $1"}
+ | KEYWORD_ STRING_ {ProcessSendCmdCurrent "get fits header keyword \{$2\}"}
+
+# has to be quoted because of common tokens
+ | INT_ KEYWORD_ STRING_ {ProcessSendCmdCurrent "get fits header $1 keyword \{$3\}"}
+ | KEYWORD_ BITPIX_ {ProcessSendCmdCurrent "get fits header keyword \{BITPIX\}"}
+ | INT_ KEYWORD_ BITPIX_ {ProcessSendCmdCurrent "get fits header $1 keyword \{BITPIX\}"}
+ ;
+
+opt : {set _ image}
+ | TABLE_ {set _ table}
+ | IMAGE_ {set _ image}
+ | SLICE_ {set _ slice}
+# backward compatibility
+ | RESAMPLE_ {set _ resample}
+ ;
+
+gz :
+ | GZ_
+ ;
+
+%%
+
+proc fitssend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
--
cgit v0.12