From dba5cc81beb293afe82fd4f51a9844ae05ce8fe6 Mon Sep 17 00:00:00 2001
From: William Joye
Date: Tue, 5 Jun 2018 14:23:36 -0400
Subject: update ds9 regions parser
---
ds9/doc/ref/command.html | 58 +++++++++++++++--
ds9/doc/ref/samp.html | 92 ++++++++++++++++++++++++---
ds9/doc/ref/xpa.html | 85 +++++++++++++++++++++++--
ds9/library/cat.tcl | 18 ------
ds9/library/marker.tcl | 43 ++++++++++++-
ds9/library/source.tcl | 2 +
ds9/library/util.tcl | 13 +++-
ds9/parsers/regionlex.fcl | 11 ++--
ds9/parsers/regionparser.tac | 24 +++----
ds9/parsers/regionsendlex.fcl | 59 +++++++++++++++++
ds9/parsers/regionsendparser.tac | 133 +++++++++++++++++++++++++++++++++++++++
11 files changed, 479 insertions(+), 59 deletions(-)
create mode 100644 ds9/parsers/regionsendlex.fcl
create mode 100644 ds9/parsers/regionsendparser.tac
diff --git a/ds9/doc/ref/command.html b/ds9/doc/ref/command.html
index 4d3a450..fbf230d 100644
--- a/ds9/doc/ref/command.html
+++ b/ds9/doc/ref/command.html
@@ -523,6 +523,7 @@
+
[crosshair]
[<ref>] [dec
<col>]
@@ -638,6 +639,7 @@
+
[match error <value> degrees|arcmin|arcsec]
[<ref>]
@@ -735,6 +737,7 @@
+
[match function 1and2|1not2|2not1]
[<ref>]
@@ -832,6 +835,7 @@
+
[match return 1and2|1only|2only]
[<ref>]
@@ -929,6 +933,7 @@
+
[match unique yes|no]
[<ref>] [maxrows
<number>]
@@ -981,12 +986,15 @@
+
[symbol shape circle
+
point|box point|diamond point|cross
+
point|x point|arrow point|boxcircle point]
[<ref>] [symbol add| [#] remove]
@@ -1090,6 +1098,7 @@
+
[update]
[<ref>] [x
<col>]
@@ -1220,6 +1229,7 @@
+
[match]
[lock
[yes|no]]
@@ -1485,6 +1495,7 @@
+
[match <coordsys>]
[lock
<coordsys>|none]
@@ -1644,6 +1655,7 @@
+
-envi foo.hdr foo.bsq
exit
@@ -2391,6 +2403,7 @@
+
[pan]
@@ -2531,6 +2544,7 @@
+
[crosshair]
@@ -2671,6 +2685,7 @@
+
[open|close]
Example:
@@ -2914,6 +2929,7 @@
+
[yes|open]
[no|close]
@@ -3017,9 +3033,11 @@
+
duplicate [#]]
+
[[<plotname>] stats
yes|no]
[[<plotname>]
@@ -3092,6 +3110,7 @@
+
list yes|no]
[[<plotname>]
@@ -3163,6 +3182,7 @@
+
loadconfig <filename>]
[[<plotname>] saveconfig
<filename>]
@@ -3266,6 +3286,7 @@
+
legend yes|no]
[[<plotname>] legend position
right|left|top|bottom]
@@ -3348,6 +3369,7 @@
+
barmode normal|stacked|aligned|overlap]
# configure current dataset
@@ -3422,6 +3444,7 @@
+
shape
circle|square|diamond|plus|splus|scross|triangle|arrow]
[[<plotname>]
@@ -3494,12 +3517,14 @@
+
shape fill yes|no]
[[<plotname>] shape
color <value>]
+
[[<plotname>]
@@ -3570,10 +3595,12 @@
+
smooth
step|linear|cubic|quadratic|catrom]
+
[[<plotname>]
@@ -3644,10 +3671,12 @@
+
color
<value>]
+
[[<plotname>]
@@ -3718,6 +3747,7 @@
+
width
<value>]
@@ -3790,6 +3820,7 @@
+
[[<plotname>]
@@ -3860,6 +3891,7 @@
+
dash yes|no]
@@ -3932,6 +3964,7 @@
+
[[<plotname>]
@@ -4002,6 +4035,7 @@
+
error yes|no]
@@ -4074,6 +4108,7 @@
+
[[<plotname>]
@@ -4144,6 +4179,7 @@
+
error color
<value>]
@@ -4217,6 +4253,7 @@
+
[[<plotname>]
@@ -4287,6 +4324,7 @@
+
color
<value>]
@@ -4360,6 +4398,7 @@
+
[[<plotname>]
@@ -4430,6 +4469,7 @@
+
error width
<value>]
@@ -4503,6 +4543,7 @@
+
[[<plotname>]
@@ -4573,6 +4614,7 @@
+
name
<string>]
@@ -4624,6 +4666,7 @@
$ds9
+
-plot title 'This is a Title'
$ds9 -plot title x 'X Axis'
$ds9 -plot title y 'Y Axis'
@@ -4692,6 +4735,7 @@
+
<dms>
<arcmin> <arcsec>
@@ -4796,10 +4840,8 @@
[fixed|edit|rotate|delete yes|no]
[include|exclude|source|background]
- [delim
- [nl|<char>]]
- [command
- <marker command>]
+
+ [command <marker command>]
[composite]
[dissolve]
[template
@@ -4873,7 +4915,6 @@
$ds9 -regions system wcs
$ds9 -regions sky fk5
$ds9 -regions skyformat degrees
- $ds9 -regions delim nl
$ds9 -regions strip yes
$ds9 -regions shape ellipse
$ds9 -regions color red
@@ -5095,6 +5136,7 @@
+
<filename> [image|table|slice]
Example:
@@ -5339,6 +5381,7 @@
+
[sigma <value>]
@@ -5351,6 +5394,7 @@
+
[sigmaminor <value>]
@@ -5363,6 +5407,7 @@
+
[angle <value>]
@@ -5375,6 +5420,7 @@
+
[match]
[lock [yes|no]]
@@ -5397,6 +5443,7 @@
+
-smooth sigmaminor 2.0
$ds9
@@ -5409,6 +5456,7 @@
+
-smooth angle 45
$ds9 -smooth
match
diff --git a/ds9/doc/ref/samp.html b/ds9/doc/ref/samp.html
index 3941900..3554c5e 100644
--- a/ds9/doc/ref/samp.html
+++ b/ds9/doc/ref/samp.html
@@ -576,6 +576,7 @@
+
[crosshair]
[<ref>] [dec
<col>]
@@ -689,6 +690,7 @@
+
[match error <value> degrees|arcmin|arcsec]
[<ref>]
@@ -784,6 +786,7 @@
+
[match function 1and2|1not2|2not1]
[<ref>]
@@ -879,6 +882,7 @@
+
[match return 1and2|1only|2only]
[<ref>]
@@ -974,6 +978,7 @@
+
[match unique yes|no]
[<ref>] [maxrows
<number>]
@@ -1025,12 +1030,15 @@
+
[symbol shape circle
+
point|box point|diamond point|cross
+
point|x point|arrow point|boxcircle point]
[<ref>]
[symbol add| [#] remove]
@@ -1132,6 +1140,7 @@
+
[update]
[<ref>] [x
<col>]
@@ -2194,6 +2203,7 @@
+
Macros for more information.
Syntax:
iexam []
@@ -2314,6 +2324,7 @@
+
quality (1-100)
Syntax:
jpeg [new|slice] [<filename>] [1-100]
@@ -2758,6 +2769,7 @@
name <plotname>]
+
[new name <plotname> line|bar|scatter]
# load data into existing plot from
@@ -2840,6 +2852,7 @@
+
duplicate [#]]
@@ -2912,6 +2925,7 @@
+
[[<plotname>] stats yes|no]
[[<plotname>]
@@ -2983,6 +2997,7 @@
+
list yes|no]
[[<plotname>]
@@ -3054,6 +3069,7 @@
+
loadconfig <filename>]
[[<plotname>] saveconfig
<filename>]
@@ -3127,6 +3143,7 @@
+
[[<plotname>] pagesetup orient portrait|landscape]
[[<plotname>] pagesetup
size letter|legal|tabloid|poster|a4]
@@ -3200,6 +3217,7 @@
+
[[<plotname>] print]
[[<plotname>] print
destination printer|file]
@@ -3295,6 +3313,7 @@
+
legend yes|no]
[[<plotname>] legend position
right|left|top|bottom]
@@ -3377,6 +3396,7 @@
+
barmode normal|stacked|aligned|overlap]
# configure current dataset
@@ -3451,6 +3471,7 @@
+
shape
circle|square|diamond|plus|splus|scross|triangle|arrow]
[[<plotname>]
@@ -3523,6 +3544,7 @@
+
shape fill yes|no]
[[<plotname>]
@@ -3598,6 +3620,7 @@
+
[[<plotname>]
@@ -3668,6 +3691,7 @@
+
smooth
step|linear|cubic|quadratic|catrom]
@@ -3741,6 +3765,7 @@
+
[[<plotname>]
@@ -3811,6 +3836,7 @@
+
color
<value>]
@@ -3884,6 +3910,7 @@
+
[[<plotname>]
@@ -3954,6 +3981,7 @@
+
width
<value>]
@@ -4027,6 +4055,7 @@
+
[[<plotname>]
@@ -4097,6 +4126,7 @@
+
dash yes|no]
@@ -4169,6 +4199,7 @@
+
[[<plotname>]
@@ -4239,6 +4270,7 @@
+
error yes|no]
@@ -4311,6 +4343,7 @@
+
[[<plotname>]
@@ -4381,6 +4414,7 @@
+
error color
<value>]
@@ -4454,6 +4488,7 @@
+
[[<plotname>]
@@ -4524,6 +4559,7 @@
+
color
<value>]
@@ -4597,6 +4633,7 @@
+
[[<plotname>]
@@ -4667,6 +4704,7 @@
+
error width
<value>]
@@ -4740,6 +4778,7 @@
+
[[<plotname>]
@@ -4810,6 +4849,7 @@
+
name
<string>]
@@ -4900,6 +4940,7 @@
+
value = ds9.get(string cmd)
plot
stats
@@ -4998,6 +5039,7 @@
+
axis x auto
plot
@@ -5064,6 +5106,7 @@
+
axis x min
plot
@@ -5130,6 +5173,7 @@
+
axis x max
plot
@@ -5196,6 +5240,7 @@
+
axis x format
plot
@@ -5262,6 +5307,7 @@
+
legend
plot legend
position
@@ -5336,6 +5382,7 @@
+
font numbers size
plot
@@ -5406,6 +5453,7 @@
+
font numbers weight
plot
@@ -5476,6 +5524,7 @@
+
font numbers slant
plot
@@ -5546,6 +5595,7 @@
+
title
plot
@@ -5616,6 +5666,7 @@
+
title x
plot barmode
@@ -5636,26 +5687,32 @@
position
ds9.set(string
+
cmd)
plot legend yes
plot legend position left
string
+
value = ds9.get(string cmd)
plot font
numbers font
plot
+
font numbers size
plot
+
font numbers weight
plot
+
font numbers slant
ds9.set(string
+
cmd)
plot font numbers font times
plot font numbers size 12
@@ -5664,19 +5721,24 @@
string
+
value = ds9.get(string
cmd)
plot
+
title
plot
+
title xaxis
plot
+
title yaxis
ds9.set(string
+
cmd)
plot title "This is a Title"
plot title x "X Axis"
@@ -5685,15 +5747,18 @@
string
+
value =
ds9.get(string
cmd)
plot
+
barmode
ds9.set(string
+
cmd)
plot barmode aligned
@@ -5777,6 +5842,7 @@
+
dash
plot
@@ -5847,6 +5913,7 @@
+
error
plot
@@ -5917,6 +5984,7 @@
+
error color
plot
@@ -5987,6 +6055,7 @@
+
error width
plot
@@ -6057,6 +6126,7 @@
+
name
ds9.set(string
@@ -6127,6 +6197,7 @@
+
cmd)
plot show yes
plot shape circle
@@ -6172,6 +6243,7 @@
+
<dms>
<arcmin> <arcsec>
@@ -6290,10 +6362,8 @@
[fixed|edit|rotate|delete yes|no]
[include|exclude|source|background]
- [delim
- [nl|<char>]]
- [command <marker
- command>]
+ [command
+ <marker command>]
[composite]
[dissolve]
[template
@@ -6340,7 +6410,6 @@
fk4|fk5|icrs|galactic|ecliptic]
[-skyformat
degrees|sexagesimal]
- [-delim [nl|<char>]]
[-prop
select|edit|move|rotate|delete|fixed|include|source 1|0]
[-group <tag>]
@@ -6369,7 +6438,6 @@
regions shape
regions color
regions width
- regions delim
regions source
regions background
regions include
@@ -6410,7 +6478,6 @@
regions system wcs
regions sky fk5
regions skyformat degrees
- regions delim nl
regions strip yes
regions shape ellipse
regions color red
@@ -6793,6 +6860,7 @@
+
[crosshair]
[<ref>]
[export sb|tsv <filename>]
@@ -6905,6 +6973,7 @@
+
[update]
Example:
@@ -7021,6 +7090,7 @@
+
[sigma <value>]
@@ -7032,6 +7102,7 @@
+
[sigmaminor <value>]
@@ -7044,6 +7115,7 @@
+
[angle <value>]
@@ -7056,6 +7128,7 @@
+
[match]
[lock [yes|no]]
[open|close]
@@ -7087,6 +7160,7 @@
+
sigma 2.0
smooth
@@ -7099,6 +7173,7 @@
+
sigmaminor 2.0
smooth
@@ -7111,6 +7186,7 @@
+
angle 45
smooth
@@ -7123,6 +7199,7 @@
+
open
smooth close
smooth match
@@ -7244,6 +7321,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 7e34fb4..3f88c5a 100644
--- a/ds9/doc/ref/xpa.html
+++ b/ds9/doc/ref/xpa.html
@@ -212,6 +212,7 @@
+
-p ds9 3d match
$xpaset -p ds9 3d lock
yes
@@ -224,6 +225,7 @@
+
-p ds9 3d open
$xpaset -p ds9 3d close
@@ -556,6 +558,7 @@
+
[crosshair]
[<ref>] [dec
<col>]
@@ -673,6 +676,7 @@
+
[match error <value> degrees|arcmin|arcsec]
[<ref>]
@@ -772,6 +776,7 @@
+
[match function 1and2|1not2|2not1]
[<ref>]
@@ -871,6 +876,7 @@
+
[match return 1and2|1only|2only]
[<ref>]
@@ -970,6 +976,7 @@
+
[match unique yes|no]
[<ref>] [maxrows
<number>]
@@ -1019,6 +1026,7 @@
+
[symbol shape circle point|box
point|diamond point|cross point|x point|arrow
point|boxcircle point]
@@ -1126,6 +1134,7 @@
+
[update]
[<ref>] [x
<col>]
@@ -1714,6 +1723,7 @@
+
-p ds9 export envi foo.hdr foo.bsq little
$xpaset -p ds9 export tiff
foo.tiff jpeg
@@ -2248,6 +2258,7 @@
+
quality (1-100)
Syntax:
jpeg [new|slice] [<filename>] [1-100]
@@ -2666,11 +2677,13 @@
name <plotname>]
+
[new name <plotname> line|bar|scatter]
# create new plot with data from stdin
plot
+
[new
<title> <xaxis label>
<yaxis label> xy|xyex|xyey|xyexey]
@@ -2681,15 +2694,20 @@
+
[new name
+
<plotname> <title>
+
<xaxis label> <yaxis label> xy|xyex|xyey|xyexey]
[new name
+
<plotname> line|bar|scatter
+
<title> <xaxis label> <yaxis
label> xy|xyex|xyey|xyexey]
@@ -2699,17 +2717,21 @@
plot [new stdin]
[new
+
[line|bar|scatter]
+
stdin]
+
[new name <plotname>
stdin]
[new name <plotname> line|bar|scatter
+
stdin]
# load data into existing plot from
@@ -2792,6 +2814,7 @@
+
duplicate [#]]
@@ -2864,6 +2887,7 @@
+
[[<plotname>] stats yes|no]
[[<plotname>]
@@ -2935,6 +2959,7 @@
+
list yes|no]
[[<plotname>]
@@ -3006,6 +3031,7 @@
+
loadconfig <filename>]
[[<plotname>] saveconfig
<filename>]
@@ -3079,6 +3105,7 @@
+
[[<plotname>] pagesetup orient portrait|landscape]
[[<plotname>] pagesetup
size letter|legal|tabloid|poster|a4]
@@ -3152,6 +3179,7 @@
+
[[<plotname>] print]
[[<plotname>] print
destination printer|file]
@@ -3247,6 +3275,7 @@
+
legend yes|no]
[[<plotname>] legend position
right|left|top|bottom]
@@ -3329,6 +3358,7 @@
+
barmode normal|stacked|aligned|overlap]
# configure current dataset
@@ -3403,6 +3433,7 @@
+
shape
circle|square|diamond|plus|splus|scross|triangle|arrow]
[[<plotname>]
@@ -3475,6 +3506,7 @@
+
shape fill yes|no]
[[<plotname>]
@@ -3550,6 +3582,7 @@
+
[[<plotname>]
@@ -3620,6 +3653,7 @@
+
smooth
step|linear|cubic|quadratic|catrom]
@@ -3693,6 +3727,7 @@
+
[[<plotname>]
@@ -3763,6 +3798,7 @@
+
color
<value>]
@@ -3836,6 +3872,7 @@
+
[[<plotname>]
@@ -3906,6 +3943,7 @@
+
width
<value>]
@@ -3979,6 +4017,7 @@
+
[[<plotname>]
@@ -4049,6 +4088,7 @@
+
dash yes|no]
@@ -4121,6 +4161,7 @@
+
[[<plotname>]
@@ -4191,6 +4232,7 @@
+
error yes|no]
@@ -4263,6 +4305,7 @@
+
[[<plotname>]
@@ -4333,6 +4376,7 @@
+
error color
<value>]
@@ -4406,6 +4450,7 @@
+
[[<plotname>]
@@ -4476,6 +4521,7 @@
+
color
<value>]
@@ -4549,6 +4595,7 @@
+
[[<plotname>]
@@ -4619,6 +4666,7 @@
+
error width
<value>]
@@ -4692,6 +4740,7 @@
+
[[<plotname>]
@@ -4762,6 +4811,7 @@
+
name
<string>]
@@ -4802,6 +4852,7 @@
# load
+
data into existing plot from stdin
$cat xy.dat | xpaset ds9 plot data xy
$cat xy.dat | xpaset ds9 plot foo data xy
@@ -4906,6 +4957,7 @@
+
ds9 plot axis x min
$xpaget
@@ -4977,10 +5029,12 @@
+
ds9 plot axis x max
$xpaget ds9 plot axis x format
$xpaset
+
-p ds9 plot axis x grid yes
$xpaset -p ds9 plot axis x log yes
$xpaset -p ds9 plot axis x flip yes
@@ -5067,6 +5121,7 @@
+
ds9 plot font numbers size
$xpaget
@@ -5138,6 +5193,7 @@
+
ds9 plot font numbers weight
$xpaget
@@ -5209,9 +5265,11 @@
+
ds9 plot font numbers slant
$xpaset
+
-p ds9 plot font numbers font times
$xpaset -p ds9 plot font numbers size 12
$xpaset -p ds9 plot font numbers weight bold
@@ -5288,6 +5346,7 @@
+
ds9 plot title xaxis
$xpaget
@@ -5359,9 +5418,11 @@
+
ds9 plot title yaxis
$xpaset
+
-p ds9 plot title {This is a Title}
$xpaset -p ds9 plot title x {X Axis}
$xpaset -p ds9 plot title y {Y Axis}
@@ -5452,6 +5513,7 @@
+
ds9 plot dash
$xpaget
@@ -5523,6 +5585,7 @@
+
ds9 plot error
$xpaget
@@ -5594,6 +5657,7 @@
+
ds9 plot error
color
$xpaget
@@ -5666,6 +5730,7 @@
+
ds9 plot error
width
$xpaget
@@ -5738,6 +5803,7 @@
+
ds9 plot name
$xpaset
@@ -5809,6 +5875,7 @@
+
-p ds9 plot show yes
$xpaset -p ds9 plot shape circle
$xpaset -p ds9 plot shape fill no
@@ -5851,6 +5918,7 @@
+
<dms>
<arcmin> <arcsec>
@@ -5958,9 +6026,7 @@
[fixed|edit|rotate|delete yes|no]
[include|exclude|source|background]
- [delim
- [nl|<char>]]
- [command <marker
+ [command <marker
command>]
[composite]
[dissolve]
@@ -6032,7 +6098,6 @@
$xpaget ds9 regions shape
$xpaget ds9 regions color
$xpaget ds9 regions width
- $xpaget ds9 regions delim
$xpaget ds9 regions source
$xpaget ds9 regions background
$xpaget ds9 regions include
@@ -6088,7 +6153,6 @@
$xpaset -p ds9 regions system wcs
$xpaset -p ds9 regions sky fk5
$xpaset -p ds9 regions skyformat degrees
- $xpaset -p ds9 regions delim nl
$xpaset -p ds9 regions strip yes
$xpaset -p ds9 regions shape ellipse
$xpaset -p ds9 regions color red
@@ -6347,6 +6411,7 @@
+
method.
Syntax:
saveimage [fits|eps|gif|tiff|jpeg|png] <filename>
@@ -6574,6 +6639,7 @@
+
[sigma <value>]
@@ -6586,6 +6652,7 @@
+
[sigmaminor <value>]
@@ -6598,6 +6665,7 @@
+
[angle <value>]
@@ -6610,6 +6678,7 @@
+
[match]
[lock [yes|no]]
[open|close]
@@ -6630,6 +6699,7 @@
+
ds9 smooth sigmaminor
$xpaget
ds9 smooth lock
@@ -6650,6 +6720,7 @@
+
-p ds9 smooth sigma 2.0
$xpaset
@@ -6662,6 +6733,7 @@
+
-p ds9 smooth sigmaminor 2.0
$xpaset
@@ -6674,6 +6746,7 @@
+
-p ds9 smooth angle 45
$xpaset
@@ -6686,6 +6759,7 @@
+
-p ds9 smooth match
$xpaset -p ds9 smooth lock yes
$xpaset -p ds9 smooth open
@@ -6806,6 +6880,7 @@
+
compression method.
Syntax:
tiff [new|slice] [<filename>] [none|jpeg|packbits|deflate]
diff --git a/ds9/library/cat.tcl b/ds9/library/cat.tcl
index 0fc90fa..69391a6 100644
--- a/ds9/library/cat.tcl
+++ b/ds9/library/cat.tcl
@@ -1541,7 +1541,6 @@ proc CatalogCmdSymbolSave {fn} {
}
proc ProcessSendCatalogCmd {proc id param sock fn} {
- if {1} {
global parse
set parse(proc) $proc
set parse(id) $id
@@ -1556,23 +1555,6 @@ proc ProcessSendCatalogCmd {proc id param sock fn} {
catsend::YY_FLUSH_BUFFER
catsend::yy_scan_string $param
catsend::yyparse
- } else {
-
- global icat
- set cc [lindex $icat(cats) end]
- switch -- [string tolower [lindex $param 0]] {
- header {}
- default {
- set cc [lindex $param 0]
- set param [lreplace $param 0 0]
- }
- }
-
- switch -- [string tolower [lindex $param 0]] {
- {} {$proc $id "$icat(cats)\n"}
- header {ProcessSend $proc $id $sock $fn {.txt} "[CATGetHeader $cc]\n"}
- }
-}
}
proc CatalogSendCmdRef {ref} {
diff --git a/ds9/library/marker.tcl b/ds9/library/marker.tcl
index 3adc9a8..12a7a52 100644
--- a/ds9/library/marker.tcl
+++ b/ds9/library/marker.tcl
@@ -1565,10 +1565,31 @@ proc RegionCmdCommand {cmd} {
}
proc ProcessSendRegionsCmd {proc id param sock fn} {
+ if {1} {
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
+ set parse(sock) $sock
+ set parse(fn) $fn
+
+ global marker
+ set marker(load,format) $marker(format)
+ set marker(load,system) $marker(system)
+ set marker(load,sky) $marker(sky)
+ set marker(load,skyformat) $marker(skyformat)
+ set marker(load,strip) $marker(strip)
+ set marker(load,select) {}
+ set marker(load,props) {}
+ set marker(load,tags) {}
+
+ regionsend::YY_FLUSH_BUFFER
+ regionsend::yy_scan_string $param
+ regionsend::yyparse
+ } else {
+
global current
global marker
global pmarker
-
if {$current(frame) == {}} {
return
}
@@ -1693,3 +1714,23 @@ proc ProcessSendRegionsCmd {proc id param sock fn} {
}
}
}
+}
+
+proc RegionSendCmd {} {
+ global marker
+ global current
+
+ if {$current(frame) == {}} {
+ return
+ }
+
+ switch -- $marker(load,format) {
+ xml {set ext {.xml}}
+ default {set ext {.rgn}}
+ }
+
+ set rr [$current(frame) marker list $marker(load,select) $marker(load,format) $marker(load,system) $marker(load,sky) $marker(load,skyformat) $marker(load,strip) $marker(load,props) $marker(load,tags)]
+
+ puts $rr
+ ProcessSendCmdResult $ext $rr
+}
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index 2f8ba4f..a9b124b 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -316,6 +316,8 @@ source $ds9(root)/library/psparser.tcl
source $ds9(root)/library/pslex.tcl
source $ds9(root)/library/regionparser.tcl
source $ds9(root)/library/regionlex.tcl
+source $ds9(root)/library/regionsendparser.tcl
+source $ds9(root)/library/regionsendlex.tcl
source $ds9(root)/library/restoreparser.tcl
source $ds9(root)/library/restorelex.tcl
source $ds9(root)/library/rgbparser.tcl
diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl
index e8e82fa..b2fdc8d 100644
--- a/ds9/library/util.tcl
+++ b/ds9/library/util.tcl
@@ -175,6 +175,15 @@ proc ProcessCmdSet {varname key value {cmd {}}} {
}
}
+proc ProcessCmdAppend {varname key value {cmd {}}} {
+ global $varname
+
+ append ${varname}($key) $value
+ if {$cmd != {}} {
+ eval $cmd
+ }
+}
+
proc ProcessCmdCVAR {which value {cmd {}}} {
global cvarname
upvar #0 $cvarname cvar
@@ -225,7 +234,7 @@ proc ProcessSendCmdResult {ext rr} {
global parse
if {$parse(sock) != {}} {
- # not implemented
+ puts $parse(sock) $rr
} elseif {$parse(fn) != {}} {
append parse(fn) $ext
set ch [open $parse(fn) w]
@@ -240,7 +249,7 @@ proc ProcessSendCmdResult {ext rr} {
# old
proc ProcessSend {proc id sock fn ext rr} {
if {$sock != {}} {
- # not implemented
+ puts $sock $rr
} elseif {$fn != {}} {
append fn $ext
set ch [open $fn w]
diff --git a/ds9/parsers/regionlex.fcl b/ds9/parsers/regionlex.fcl
index 1f1a5fe..d30d5f4 100644
--- a/ds9/parsers/regionlex.fcl
+++ b/ds9/parsers/regionlex.fcl
@@ -19,8 +19,6 @@ close {return $CLOSE_}
color {return $COLOR_}
command {return $COMMAND_}
composite {return $COMPOSITE_}
-coord {return $COORD_}
-coordformat {return $COORDFORMAT_}
copy {return $COPY_}
cut {return $CUT_}
delete {return $DELETE_}
@@ -32,6 +30,7 @@ epsilon {return $EPSILON_}
exclude {return $EXCLUDE_}
file {return $FILE_}
fixed {return $FIXED_}
+font {return $FONT_}
format {return $FORMAT_}
front {return $FRONT_}
getinfo {return $GETINFO_}
@@ -65,7 +64,6 @@ skyformat {return $SKYFORMAT_}
source {return $SOURCE_}
strip {return $STRIP_}
system {return $SYSTEM_}
-tag {return $TAG_}
template {return $TEMPLATE_}
undo {return $UNDO_}
update {return $UPDATE_}
@@ -100,12 +98,11 @@ cross {return $CROSS_}
arrow {return $ARROW_}
boxcircle {return $BOXCIRCLE_}
--format {return $-FORMAT_}
--system {return $-SYSTEM_}
--sky {return $-SKY_}
+-format {return $MFORMAT_}
+-system {return $MSYSTEM_}
+-sky {return $MSKY_}
#include yesno.fin
-#include font.fin
#include coords.fin
#include numeric.fin
#include string.fin
diff --git a/ds9/parsers/regionparser.tac b/ds9/parsers/regionparser.tac
index 5142ea4..a413ef4 100644
--- a/ds9/parsers/regionparser.tac
+++ b/ds9/parsers/regionparser.tac
@@ -2,7 +2,6 @@
%}
#include yesno.tin
-#include font.tin
#include coords.tin
#include numeric.tin
#include string.tin
@@ -20,8 +19,6 @@
%token COLOR_
%token COMMAND_
%token COMPOSITE_
-%token COORD_
-%token COORDFORMAT_
%token COPY_
%token CUT_
%token DELETE_
@@ -33,6 +30,7 @@
%token EXCLUDE_
%token FILE_
%token FIXED_
+%token FONT_
%token FORMAT_
%token FRONT_
%token GETINFO_
@@ -66,7 +64,6 @@
%token SOURCE_
%token STRIP_
%token SYSTEM_
-%token TAG_
%token TEMPLATE_
%token UNDO_
%token UPDATE_
@@ -101,14 +98,13 @@
%token ARROW_
%token BOXCIRCLE_
-%token -FORMAT_
-%token -SYSTEM_
-%token -SKY_
+%token MFORMAT_
+%token MSYSTEM_
+%token MSKY_
%%
#include yesno.trl
-#include font.trl
#include coords.trl
#include numeric.trl
@@ -153,6 +149,7 @@ region : {RegionCmdLoad}
| SKY_ skyframe {ProcessCmdSet marker sky $2}
| SKYFORMAT_ skyformat {ProcessCmdSet marker skyformat $2}
| STRIP_ yesno {ProcessCmdSet marker strip $2}
+# backward compatibility
| DELIM_ delim {ProcessCmdSet marker strip $2}
| SHAPE_ shape {ProcessCmdSet marker shape $2}
| COLOR_ STRING_ {ProcessCmdSet marker color $2 MarkerColor}
@@ -186,12 +183,12 @@ props : props prop
| prop
;
-prop : -FORMAT_ format {ProcessCmdSet marker load,format $2}
- | -SYSTEM_ coordsys {ProcessCmdSet marker load,system $2}
- | -SYSTEM_ wcssys {ProcessCmdSet marker load,system $2}
+prop : MFORMAT_ format {ProcessCmdSet marker load,format $2}
+ | MSYSTEM_ coordsys {ProcessCmdSet marker load,system $2}
+ | MSYSTEM_ wcssys {ProcessCmdSet marker load,system $2}
# backward compatibility
- | -SYSTEM_ skyframe {ProcessCmdSet marker load,system wcs; ProcessCmdSet marker load,sky $2}
- | -SKY_ skyframe {ProcessCmdSet marker load,sky $2}
+ | MSYSTEM_ skyframe {ProcessCmdSet marker load,system wcs; ProcessCmdSet marker load,sky $2}
+ | MSKY_ skyframe {ProcessCmdSet marker load,sky $2}
;
loadall : {set _ 0}
@@ -265,7 +262,6 @@ point :
delim : NL_ {set _ 0}
| STRING_ {set _ 1}
- | yesno {set _ $1}
;
template : STRING_ {RegionCmdTemplate $1}
diff --git a/ds9/parsers/regionsendlex.fcl b/ds9/parsers/regionsendlex.fcl
new file mode 100644
index 0000000..0e38358
--- /dev/null
+++ b/ds9/parsers/regionsendlex.fcl
@@ -0,0 +1,59 @@
+#tab regionsendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+
+auto {return $AUTO_}
+autocentroid {return $AUTOCENTROID_}
+background {return $BACKGROUND_}
+centroid {return $CENTROID_}
+color {return $COLOR_}
+delim {return $DELIM_}
+epsilon {return $EPSILON_}
+exclude {return $EXCLUDE_}
+format {return $FORMAT_}
+group {return $GROUP_}
+groups {return $GROUPS_}
+include {return $INCLUDE_}
+iteration {return $ITERATION_}
+nl {return $NL_}
+radius {return $RADIUS_}
+selected {return $SELECTED_}
+shape {return $SHAPE_}
+show {return $SHOW_}
+showtext {return $SHOWTEXT_}
+sky {return $SKY_}
+skyformat {return $SKYFORMAT_}
+source {return $SOURCE_}
+strip {return $STRIP_}
+system {return $SYSTEM_}
+width {return $WIDTH_}
+
+ds9 {return $DS9_}
+xml {return $XML_}
+ciao {return $CIAO_}
+saotng {return $SAOTNG_}
+pros {return $PROS_}
+saoimage {return $SAOIMAGE_}
+xy {return $XY_}
+
+-format {return $MFORMAT_}
+-system {return $MSYSTEM_}
+-sky {return $MSKY_}
+-skyformat {return $MSKYFORMAT_}
+-strip {return $MSTRIP_}
+-delim {return $MDELIM_}
+-prop {return $MPROP_}
+-group {return $MGROUP_}
+
+#include yesno.fin
+#include coords.fin
+#include numeric.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/regionsendparser.tac b/ds9/parsers/regionsendparser.tac
new file mode 100644
index 0000000..294bd97
--- /dev/null
+++ b/ds9/parsers/regionsendparser.tac
@@ -0,0 +1,133 @@
+%{
+%}
+
+#include yesno.tin
+#include coords.tin
+#include numeric.tin
+#include string.tin
+
+%start regionsend
+
+%token AUTO_
+%token AUTOCENTROID_
+%token BACKGROUND_
+%token CENTROID_
+%token COLOR_
+%token DELIM_
+%token EPSILON_
+%token EXCLUDE_
+%token FORMAT_
+%token GROUP_
+%token GROUPS_
+%token INCLUDE_
+%token ITERATION_
+%token NL_
+%token RADIUS_
+%token SELECTED_
+%token SHAPE_
+%token SHOW_
+%token SHOWTEXT_
+%token SKY_
+%token SKYFORMAT_
+%token SOURCE_
+%token STRIP_
+%token SYSTEM_
+%token WIDTH_
+
+%token DS9_
+%token XML_
+%token CIAO_
+%token SAOTNG_
+%token PROS_
+%token SAOIMAGE_
+%token XY_
+
+%token MFORMAT_
+%token MSYSTEM_
+%token MSKY_
+%token MSKYFORMAT_
+%token MSTRIP_
+%token MDELIM_
+%token MPROP_
+%token MGROUP_
+
+%%
+
+#include yesno.trl
+#include coords.trl
+#include numeric.trl
+
+regionsend : {RegionSendCmd}
+ | props {RegionSendCmd}
+
+ | EPSILON_ {ProcessSendCmdGet pmarker epsilon}
+ | SHOW_ {ProcessSendCmdYesNo marker show}
+ | SHOWTEXT_ {ProcessSendCmdYesNo marker show,text}
+ | CENTROID_ centroid
+# backword compatibility
+ | AUTOCENTROID_ {ProcessSendCmdYesNo marker centroid,auto}
+ | FORMAT_ {ProcessSendCmdGet marker format}
+ | SYSTEM_ {ProcessSendCmdGet marker system}
+ | SKY_ {ProcessSendCmdGet marker sky}
+ | SKYFORMAT_ {ProcessSendCmdGet marker skyformat}
+ | STRIP_ {ProcessSendCmdYesNo marker strip}
+# backward compatibility
+ | DELIM_ {}
+ | SHAPE_ {ProcessSendCmdGet marker shape}
+ | COLOR_ {ProcessSendCmdGet marker color}
+ | WIDTH_ {ProcessSendCmdGet marker width}
+ | GROUP_ {ProcessSendCmdCurrent "get marker tag all"}
+ | GROUPS_ {ProcessSendCmdCurrent "get marker tag all"}
+ ;
+
+centroid: AUTO_ {ProcessSendCmdYesNo marker centroid,auto}
+ | RADIUS_ {ProcessSendCmdGet marker centroid,radius}
+ | ITERATION_ {ProcessSendCmdGet marker centroid,iteration}
+ ;
+
+format : DS9_ {set _ ds9}
+ | XML_ {set _ xml}
+ | CIAO_ {set _ ciao}
+ | SAOTNG_ {set _ saotng}
+ | PROS_ {set _ pros}
+ | SAOIMAGE_ {set _ saoimage}
+ | XY_ {set _ xy}
+ ;
+
+delim : NL_ {set _ 0}
+ | STRING_ {set _ 1}
+ ;
+
+props : props prop
+ | prop
+ ;
+
+prop : MFORMAT_ format {ProcessCmdSet marker load,format $2}
+ | MSYSTEM_ coordsys {ProcessCmdSet marker load,system $2}
+ | MSYSTEM_ wcssys {ProcessCmdSet marker load,system $2}
+# backward compatibility
+ | MSYSTEM_ skyframe {ProcessCmdSet marker load,system wcs; ProcessCmdSet marker load,sky $2}
+ | MSKY_ skyframe {ProcessCmdSet marker load,sky $2}
+ | MSKYFORMAT_ skyformat {ProcessCmdSet marker load,skyformat $2}
+ | MSTRIP_ yesno {ProcessCmdSet marker load,strip $2}
+# backward compatibility
+ | MDELIM_ delim {ProcessCmdSet marker load,strip $2}
+ | MPROP_ STRING_ INT_ {ProcessCmdAppend marker load,props "$2 = $3 "}
+ | MPROP_ STRING_ STRING_ {ProcessCmdAppend marker load,props "$2 = $3 "}
+ | INCLUDE_ {ProcessCmdAppend marker load,props "include = 1 "}
+ | EXCLUDE_ {ProcessCmdAppend marker load,props "include = 0 "}
+ | SOURCE_ {ProcessCmdAppend marker load,props "source = 1 "}
+ | BACKGROUND_ {ProcessCmdAppend marker load,props "source = 0 "}
+ | MGROUP_ STRING_ {ProcessCmdAppend marker load,tags "tag = $2 "}
+ | SELECTED_ {ProcessCmdSet marker load,select select}
+ ;
+
+%%
+
+proc regionsend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
--
cgit v0.12