From 764b96185d0b6778f50724d14609e5083f81abec Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 19 Jun 2018 17:24:38 -0400 Subject: add ds9 iexam send parser --- ds9/doc/ref/samp.html | 85 ++++++++++++++++++++++++++++++- ds9/doc/ref/xpa.html | 81 +++++++++++++++++++++++++++++- ds9/library/iexam.tcl | 108 ++++++++++++++++++++++++++++++++++++++++ ds9/library/source.tcl | 2 + ds9/parsers/iexamsendlex.fcl | 24 +++++++++ ds9/parsers/iexamsendparser.tac | 65 ++++++++++++++++++++++++ 6 files changed, 363 insertions(+), 2 deletions(-) create mode 100644 ds9/parsers/iexamsendlex.fcl create mode 100644 ds9/parsers/iexamsendparser.tac diff --git a/ds9/doc/ref/samp.html b/ds9/doc/ref/samp.html index 00e092c..4883cac 100644 --- a/ds9/doc/ref/samp.html +++ b/ds9/doc/ref/samp.html @@ -582,6 +582,7 @@ + [crosshair]
        [<ref>] [dec <col>]
@@ -700,6 +701,7 @@ + [match error <value> degrees|arcmin|arcsec]
        [<ref>] @@ -800,6 +802,7 @@ + [match function 1and2|1not2|2not1]
        [<ref>] @@ -900,6 +903,7 @@ + [match return 1and2|1only|2only]
        [<ref>] @@ -1000,6 +1004,7 @@ + [match unique yes|no]
        [<ref>] [maxrows <number>]
@@ -1056,6 +1061,7 @@ + [symbol shape circle @@ -1064,6 +1070,7 @@ + point|box point|diamond point|cross @@ -1072,6 +1079,7 @@ + point|x point|arrow point|boxcircle point]
        [<ref>] [symbol add| [#] remove]
@@ -1178,6 +1186,7 @@ + [update]

        [<ref>] [x <col>]
@@ -2228,6 +2237,7 @@ + Macros for more information.

Syntax:
iexam []
@@ -2250,7 +2260,7 @@ iexam data # return data value
iexam key data # return data value and key event
iexam data 3 3 # return all data in 3x3 box about selected point
- iexam {Click at $x,$y in file $filename}

+ iexam {'Click at $x,$y in file $filename'}

iis

Set/Get IIS Filename. Optional mosaic number maybe supplied.

Syntax:
@@ -2353,6 +2363,7 @@ +
quality (1-100)

Syntax:
jpeg [new|slice] [<filename>] [1-100]
@@ -2802,6 +2813,7 @@ + [new name <plotname> line|bar|scatter]


# load data into existing plot from @@ -2889,6 +2901,7 @@ + duplicate [#]]
     @@ -2966,6 +2979,7 @@ + [[<plotname>] stats yes|no]
    
[[<plotname>] @@ -3042,6 +3056,7 @@ + list yes|no]
    
[[<plotname>] @@ -3118,6 +3133,7 @@ + loadconfig <filename>]
     [[<plotname>] saveconfig <filename>]
@@ -3196,6 +3212,7 @@ + [[<plotname>] pagesetup orient portrait|landscape]
     [[<plotname>] pagesetup size letter|legal|tabloid|poster|a4]

@@ -3274,6 +3291,7 @@ + [[<plotname>] print]
     [[<plotname>] print destination printer|file]
@@ -3374,6 +3392,7 @@ + legend yes|no]
     [[<plotname>] legend position right|left|top|bottom]

@@ -3461,6 +3480,7 @@ + barmode normal|stacked|aligned|overlap]

# configure current dataset
@@ -3540,6 +3560,7 @@ + shape circle|square|diamond|plus|splus|scross|triangle|arrow]

     [[<plotname>] @@ -3617,6 +3638,7 @@ + shape fill yes|no]
     [[<plotname>] @@ -3697,6 +3719,7 @@ + [[<plotname>] @@ -3772,6 +3795,7 @@ + smooth step|linear|cubic|quadratic|catrom]
     @@ -3850,6 +3874,7 @@ + [[<plotname>] @@ -3925,6 +3950,7 @@ + color <value>]
     @@ -4003,6 +4029,7 @@ + [[<plotname>] @@ -4078,6 +4105,7 @@ + width <value>]
     @@ -4156,6 +4184,7 @@ + [[<plotname>] @@ -4231,6 +4260,7 @@ + dash yes|no]
     @@ -4308,6 +4338,7 @@ + [[<plotname>] @@ -4383,6 +4414,7 @@ + error yes|no]
     @@ -4460,6 +4492,7 @@ + [[<plotname>] @@ -4535,6 +4568,7 @@ + error color <value>]
     @@ -4613,6 +4647,7 @@ + [[<plotname>] @@ -4688,6 +4723,7 @@ + color <value>]
     @@ -4766,6 +4802,7 @@ + [[<plotname>] @@ -4841,6 +4878,7 @@ + error width <value>]
     @@ -4919,6 +4957,7 @@ + [[<plotname>] @@ -4994,6 +5033,7 @@ + name <string>]

@@ -5089,6 +5129,7 @@ + value = ds9.get(string cmd)
plot stats
@@ -5192,6 +5233,7 @@ + axis x auto
plot @@ -5263,6 +5305,7 @@ + axis x min
plot @@ -5334,6 +5377,7 @@ + axis x max
plot @@ -5405,6 +5449,7 @@ + axis x format
plot @@ -5476,6 +5521,7 @@ + legend
plot legend position
@@ -5555,6 +5601,7 @@ + font numbers size
plot @@ -5630,6 +5677,7 @@ + font numbers weight
plot @@ -5705,6 +5753,7 @@ + font numbers slant
plot @@ -5780,6 +5829,7 @@ + title
plot @@ -5855,6 +5905,7 @@ + title x
plot barmode
@@ -5880,6 +5931,7 @@ + cmd)
plot legend yes
plot legend position left
@@ -5891,6 +5943,7 @@ + value = ds9.get(string cmd)
plot font numbers font
@@ -5901,6 +5954,7 @@ + font numbers size
plot @@ -5909,6 +5963,7 @@ + font numbers weight
plot @@ -5917,6 +5972,7 @@ + font numbers slant
ds9.set(string @@ -5925,6 +5981,7 @@ + cmd)
plot font numbers font times
plot font numbers size 12
@@ -5938,6 +5995,7 @@ + value = ds9.get(string cmd)
plot @@ -5947,6 +6005,7 @@ + title
plot @@ -5955,6 +6014,7 @@ + title xaxis
plot @@ -5963,6 +6023,7 @@ + title yaxis
ds9.set(string @@ -5971,6 +6032,7 @@ + cmd)
plot title "This is a Title"
plot title x "X Axis"
@@ -5984,6 +6046,7 @@ + value = ds9.get(string cmd)
@@ -5994,6 +6057,7 @@ + barmode
ds9.set(string @@ -6003,6 +6067,7 @@ + cmd)
plot barmode aligned

@@ -6091,6 +6156,7 @@ + dash
plot @@ -6166,6 +6232,7 @@ + error
plot @@ -6241,6 +6308,7 @@ + error color
plot @@ -6316,6 +6384,7 @@ + error width
plot @@ -6391,6 +6460,7 @@ + name
ds9.set(string @@ -6466,6 +6536,7 @@ + cmd)
plot show yes
plot shape circle
@@ -6516,6 +6587,7 @@ +
<dms> <arcmin> <arcsec>

@@ -7137,6 +7209,7 @@ + [crosshair]

        [<ref>] [export sb|tsv <filename>]
@@ -7254,6 +7327,7 @@ + [update]

 
Example:
@@ -7377,6 +7451,7 @@ + [sigma <value>]
       @@ -7393,6 +7468,7 @@ + [sigmaminor <value>]
       @@ -7410,6 +7486,7 @@ + [angle <value>]
       @@ -7427,6 +7504,7 @@ + [match]
       [lock [yes|no]]

       [open|close]
@@ -7463,6 +7541,7 @@ + sigma 2.0
smooth @@ -7480,6 +7559,7 @@ + sigmaminor 2.0
smooth @@ -7497,6 +7577,7 @@ + angle 45
smooth @@ -7514,6 +7595,7 @@ + open
smooth close
smooth match
@@ -7640,6 +7722,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 af9c244..742fec6 100644 --- a/ds9/doc/ref/xpa.html +++ b/ds9/doc/ref/xpa.html @@ -219,6 +219,7 @@ + -p ds9 3d match

$xpaset -p ds9 3d lock yes
@@ -237,6 +238,7 @@ + -p ds9 3d open
$xpaset -p ds9 3d close
@@ -575,6 +577,7 @@ + [crosshair]

        [<ref>] [dec <col>]
@@ -698,6 +701,7 @@ + [match error <value> degrees|arcmin|arcsec]

        [<ref>] @@ -803,6 +807,7 @@ + [match function 1and2|1not2|2not1]
        [<ref>] @@ -908,6 +913,7 @@ + [match return 1and2|1only|2only]
        [<ref>] @@ -1013,6 +1019,7 @@ + [match unique yes|no]
        [<ref>] [maxrows <number>]
@@ -1068,6 +1075,7 @@ + [symbol shape
circle point|box point|diamond point|cross point|x point|arrow point|boxcircle point]
@@ -1181,6 +1189,7 @@ + [update]

        [<ref>] [x <col>]
@@ -1775,6 +1784,7 @@ + -p ds9 export envi foo.hdr foo.bsq little

$xpaset -p ds9 export tiff foo.tiff jpeg
@@ -2210,7 +2220,7 @@ $xpaget ds9 iexam key data # return data value and key event
$xpaget ds9 iexam data 3 3 # return all data in 3x3 box about selected point
- $xpaget ds9 iexam 'Click at $x,$y in file $filename'
+ $xpaget ds9 iexam {'Click at $x,$y in file $filename'}

iis

Set/Get IIS Filename. Optional mosaic number maybe supplied.

Syntax:
@@ -2314,6 +2324,7 @@ +
quality (1-100)

Syntax:
jpeg [new|slice] [<filename>] [1-100]
@@ -2738,6 +2749,7 @@ + [new name <plotname> line|bar|scatter]


# create new plot with data from stdin
@@ -2749,6 +2761,7 @@ +
[new <title> <xaxis label> <yaxis label> xy|xyex|xyey|xyexey]
@@ -2765,6 +2778,7 @@ +
[new name @@ -2773,6 +2787,7 @@ + <plotname> <title> @@ -2781,6 +2796,7 @@ + <xaxis label> <yaxis label> xy|xyex|xyey|xyexey]
    
[new name @@ -2790,6 +2806,7 @@ + <plotname> line|bar|scatter @@ -2798,6 +2815,7 @@ + <title> <xaxis label> <yaxis label> xy|xyex|xyey|xyexey]

@@ -2813,6 +2831,7 @@ +
[line|bar|scatter] @@ -2821,6 +2840,7 @@ + stdin]
     @@ -2831,6 +2851,7 @@ + [new name <plotname> stdin]
     @@ -2842,6 +2863,7 @@ + stdin]

# load data into existing plot from @@ -2930,6 +2952,7 @@ + duplicate [#]]
     @@ -3008,6 +3031,7 @@ + [[<plotname>] stats yes|no]
    
[[<plotname>] @@ -3085,6 +3109,7 @@ + list yes|no]
    
[[<plotname>] @@ -3162,6 +3187,7 @@ + loadconfig <filename>]
     [[<plotname>] saveconfig <filename>]
@@ -3241,6 +3267,7 @@ + [[<plotname>] pagesetup orient portrait|landscape]
     [[<plotname>] pagesetup size letter|legal|tabloid|poster|a4]

@@ -3320,6 +3347,7 @@ + [[<plotname>] print]
     [[<plotname>] print destination printer|file]
@@ -3421,6 +3449,7 @@ + legend yes|no]
     [[<plotname>] legend position right|left|top|bottom]

@@ -3509,6 +3538,7 @@ + barmode normal|stacked|aligned|overlap]

# configure current dataset
@@ -3589,6 +3619,7 @@ + shape circle|square|diamond|plus|splus|scross|triangle|arrow]

     [[<plotname>] @@ -3667,6 +3698,7 @@ + shape fill yes|no]
     [[<plotname>] @@ -3748,6 +3780,7 @@ + [[<plotname>] @@ -3824,6 +3857,7 @@ + smooth step|linear|cubic|quadratic|catrom]
     @@ -3903,6 +3937,7 @@ + [[<plotname>] @@ -3979,6 +4014,7 @@ + color <value>]
     @@ -4058,6 +4094,7 @@ + [[<plotname>] @@ -4134,6 +4171,7 @@ + width <value>]
     @@ -4213,6 +4251,7 @@ + [[<plotname>] @@ -4289,6 +4328,7 @@ + dash yes|no]
     @@ -4367,6 +4407,7 @@ + [[<plotname>] @@ -4443,6 +4484,7 @@ + error yes|no]
     @@ -4521,6 +4563,7 @@ + [[<plotname>] @@ -4597,6 +4640,7 @@ + error color <value>]
     @@ -4676,6 +4720,7 @@ + [[<plotname>] @@ -4752,6 +4797,7 @@ + color <value>]
     @@ -4831,6 +4877,7 @@ + [[<plotname>] @@ -4907,6 +4954,7 @@ + error width <value>]
     @@ -4986,6 +5034,7 @@ + [[<plotname>] @@ -5062,6 +5111,7 @@ + name <string>]

@@ -5108,6 +5158,7 @@ + data into existing plot from stdin

$cat xy.dat | xpaset ds9 plot data xy
$cat xy.dat | xpaset ds9 plot foo data xy
@@ -5218,6 +5269,7 @@ + ds9 plot axis x min
$xpaget @@ -5295,6 +5347,7 @@ + ds9 plot axis x max
$xpaget ds9 plot axis x format
$xpaset @@ -5305,6 +5358,7 @@ + -p ds9 plot axis x grid yes
$xpaset -p ds9 plot axis x log yes

$xpaset -p ds9 plot axis x flip yes
@@ -5397,6 +5451,7 @@ + ds9 plot font numbers size
$xpaget @@ -5474,6 +5529,7 @@ + ds9 plot font numbers weight
$xpaget @@ -5551,6 +5607,7 @@ + ds9 plot font numbers slant
$xpaset @@ -5560,6 +5617,7 @@ + -p ds9 plot font numbers font times
$xpaset -p ds9 plot font numbers size 12
$xpaset -p ds9 plot font numbers weight bold
@@ -5642,6 +5700,7 @@ + ds9 plot title xaxis
$xpaget @@ -5719,6 +5778,7 @@ + ds9 plot title yaxis
$xpaset @@ -5728,6 +5788,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}
@@ -5824,6 +5885,7 @@ + ds9 plot dash
$xpaget @@ -5901,6 +5963,7 @@ + ds9 plot error
$xpaget @@ -5978,6 +6041,7 @@ + ds9 plot error color
$xpaget @@ -6056,6 +6120,7 @@ + ds9 plot error width
$xpaget @@ -6134,6 +6199,7 @@ + ds9 plot name
$xpaset @@ -6211,6 +6277,7 @@ + -p ds9 plot show yes
$xpaset -p ds9 plot shape circle
$xpaset -p ds9 plot shape fill no
@@ -6259,6 +6326,7 @@ +
<dms> <arcmin> <arcsec>

@@ -6757,6 +6825,7 @@ + method.

Syntax:
saveimage
[fits|eps|gif|tiff|jpeg|png] <filename>
@@ -6991,6 +7060,7 @@ + [sigma <value>]
       @@ -7009,6 +7079,7 @@ + [sigmaminor <value>]
       @@ -7027,6 +7098,7 @@ + [angle <value>]
    @@ -7045,6 +7117,7 @@ +    [match]
       [lock [yes|no]]

       [open|close]
@@ -7071,6 +7144,7 @@ + ds9 smooth sigmaminor
$xpaget ds9 smooth lock
@@ -7097,6 +7171,7 @@ + -p ds9 smooth sigma 2.0
$xpaset @@ -7115,6 +7190,7 @@ + -p ds9 smooth sigmaminor 2.0
$xpaset @@ -7133,6 +7209,7 @@ + -p ds9 smooth angle 45
$xpaset @@ -7151,6 +7228,7 @@ + -p ds9 smooth match
$xpaset -p ds9 smooth lock yes

$xpaset -p ds9 smooth open
@@ -7277,6 +7355,7 @@ +
compression method.

Syntax:
tiff [new|slice] [<filename>] [none|jpeg|packbits|deflate]
diff --git a/ds9/library/iexam.tcl b/ds9/library/iexam.tcl index 144bd14..aeea756 100644 --- a/ds9/library/iexam.tcl +++ b/ds9/library/iexam.tcl @@ -54,6 +54,114 @@ proc IExamKey {which K xx yy} { } proc ProcessSendIExamCmd {proc id param {sock {}} {fn {}}} { + global parse + set parse(proc) $proc + set parse(id) $id + + global iexam + global icursor + global current + set iexam(frame) {} + set iexam(x) {} + set iexam(y) {} + set iexam(event) {} + set iexam(mode) $current(mode) + + set current(mode) iexam + + set iexam(button) 1 + set iexam(key) 0 + set iexam(any) 0 + + global cvarname + set cvarname {iexam(button)} + + # turn on blinking cursor + set icursor(timer) 1 + CursorTimer + + iexamsend::YY_FLUSH_BUFFER + iexamsend::yy_scan_string $param + iexamsend::yyparse + + # turn off blinking cursor + set icursor(timer) 0 + + set current(mode) $iexam(mode) + + set iexam(button) 0 + set iexam(key) 0 + + set iexam(frame) {} + set iexam(x) {} + set iexam(y) {} + set iexam(event) {} + set iexam(mode) {} + + unset cvarname +} + +proc IExamSendCmdDest {which} { + global iexam + global cvarname + + set iexam($which) 1 + set cvarname "iexam($which)" +} + +proc IExamSendCmdData {ww hh} { + global iexam + + global cvarname + vwait $cvarname + ProcessSendCmdTxt "$iexam(event) [$iexam(frame) get data canvas $iexam(x) $iexam(y) $ww $hh]" +} + +proc IExamSendCmdCoord {sys sky skyformat} { + global iexam + + global cvarname + vwait $cvarname + ProcessSendCmdTxt "$iexam(event) [$iexam(frame) get coordinates $iexam(x) $iexam(y) $sys $sky $skyformat]" +} + +proc IExamSendCmdMacro {cmd} { + global iexam + + global cvarname + vwait $cvarname + + # $width,$height,$depth,$bitpix + ParseXYBitpixMacro cmd $iexam(frame) + + # $filename[$regions] + ParseFilenameRegionMacro cmd $iexam(frame) + + # $filename + ParseFilenameMacro cmd $iexam(frame) + + # $regions + ParseRegionMacro cmd $iexam(frame) + + # $env + ParseEnvMacro cmd + + # $pan + ParsePanMacro cmd $iexam(frame) + + # $value + ParseValueMacro cmd $iexam(frame) $iexam(x) $iexam(y) + + # $x,$y + ParseXYMacro cmd $iexam(frame) $iexam(x) $iexam(y) + + # $z + ParseZMacro cmd $iexam(frame) + + ProcessSendCmdTxt "$iexam(event) $cmd" +} + +proc ProcessSendIExamCmdOld {proc id param {sock {}} {fn {}}} { global iexam global icursor diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 2fdd76d..88d3d76 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -268,6 +268,8 @@ source $ds9(root)/library/gridparser.tcl source $ds9(root)/library/gridlex.tcl source $ds9(root)/library/gridsendparser.tcl source $ds9(root)/library/gridsendlex.tcl +source $ds9(root)/library/iexamsendparser.tcl +source $ds9(root)/library/iexamsendlex.tcl source $ds9(root)/library/headerparser.tcl source $ds9(root)/library/headerlex.tcl source $ds9(root)/library/heightparser.tcl diff --git a/ds9/parsers/iexamsendlex.fcl b/ds9/parsers/iexamsendlex.fcl new file mode 100644 index 0000000..9acf95f --- /dev/null +++ b/ds9/parsers/iexamsendlex.fcl @@ -0,0 +1,24 @@ +#tab iexamsendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +any {return $ANY_} +button {return $BUTTON_} +coordinate {return $COORDINATE_} +data {return $DATA_} +key {return $KEY_} +value {return $VALUE_} + +#include coordsys.fin +#include wcssys.fin +#include skyframe.fin +#include skyformat.fin +#include string.fin +#include ws.fin + +%% diff --git a/ds9/parsers/iexamsendparser.tac b/ds9/parsers/iexamsendparser.tac new file mode 100644 index 0000000..9bd277a --- /dev/null +++ b/ds9/parsers/iexamsendparser.tac @@ -0,0 +1,65 @@ +%{ +%} + +#include coordsys.tin +#include wcssys.tin +#include skyframe.tin +#include skyformat.tin +#include string.tin +#include int.tin + +%token ANY_ +%token BUTTON_ +%token COORDINATE_ +%token DATA_ +%token KEY_ +%token VALUE_ + +%start iexamsend + +%% + +#include coordsys.trl +#include wcssys.trl +#include skyframe.trl +#include skyformat.trl + +iexamsend : dest cmd + | cmd + ; + +cmd : COORDINATE_ coordinate + | DATA_ data +# backward compatibility + | VALUE_ data + | STRING_ {IExamSendCmdMacro $1} + ; + +dest : BUTTON_ {IExamSendCmdDest button} + | KEY_ {IExamSendCmdDest key} + | ANY_ {IExamSendCmdDest any} + ; + +coordinate : {IExamSendCmdCoord image fk5 degrees} + | coordsys {IExamSendCmdCoord $1 fk5 degrees} + | wcssys {IExamSendCmdCoord $1 fk5 degrees} + | skyframe {IExamSendCmdCoord wcs $1 degrees} + | wcssys skyframe {IExamSendCmdCoord $1 $2 degrees} + | wcssys skyformat {IExamSendCmdCoord $1 fk5 $2} + | skyframe skyformat {IExamSendCmdCoord wcs $1 $2} + | wcssys skyframe skyformat {IExamSendCmdCoord $1 $2 $3} + ; + +data : {IExamSendCmdData 1 1} + | INT_ INT_ {IExamSendCmdData $1 $2} + ; + +%% + +proc iexamsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12