diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-04-13 21:26:20 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-04-13 21:26:20 (GMT) |
commit | 6789ffe9781b0b50525b2f71eca17709f5a1540e (patch) | |
tree | f5818cd8e0292e8c29504caaf966f3daab987ec1 | |
parent | a05e03dc6a6b011f0ca615c8abf26962df5ca8a2 (diff) | |
download | blt-6789ffe9781b0b50525b2f71eca17709f5a1540e.zip blt-6789ffe9781b0b50525b2f71eca17709f5a1540e.tar.gz blt-6789ffe9781b0b50525b2f71eca17709f5a1540e.tar.bz2 |
add ds9 sia parser
-rw-r--r-- | ds9/library/sia.tcl | 23 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/sialex.fcl | 40 | ||||
-rw-r--r-- | ds9/parsers/siaparser.tac | 70 |
4 files changed, 135 insertions, 0 deletions
diff --git a/ds9/library/sia.tcl b/ds9/library/sia.tcl index 43637a8..116f715 100644 --- a/ds9/library/sia.tcl +++ b/ds9/library/sia.tcl @@ -333,6 +333,19 @@ proc ProcessSIACmd {varname iname} { global isia + global debug + if {$debug(tcl,parser)} { + set ref [lindex $isia(sias) end] + global cvarname + set cvarname $ref + + sia::YY_FLUSH_BUFFER + sia::yy_scan_string [lrange $var $i end] + sia::yyparse + incr i [expr $sia::yycnt-1] + } else { + + # we need to be realized ProcessRealizeDS9 @@ -402,6 +415,7 @@ proc ProcessSIACmd {varname iname} { } } } +} proc ProcessSIA {varname iname cvarname} { upvar 2 $varname var @@ -492,6 +506,15 @@ proc ProcessSIA {varname iname cvarname} { } } +proc SIACmdSet {which value {cmd {}}} { + global sia + + set sia($which) $value + if {$cmd != {}} { + eval $cmd + } +} + proc ProcessSendSIACmd {proc id param sock fn} { global isia diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 145fa01..bc4b668 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -250,6 +250,8 @@ source $ds9(root)/library/plotparser.tcl source $ds9(root)/library/plotlex.tcl source $ds9(root)/library/regionparser.tcl source $ds9(root)/library/regionlex.tcl +source $ds9(root)/library/siaparser.tcl +source $ds9(root)/library/sialex.tcl source $ds9(root)/library/scaleparser.tcl source $ds9(root)/library/scalelex.tcl source $ds9(root)/library/skyviewparser.tcl diff --git a/ds9/parsers/sialex.fcl b/ds9/parsers/sialex.fcl new file mode 100644 index 0000000..ef13f11 --- /dev/null +++ b/ds9/parsers/sialex.fcl @@ -0,0 +1,40 @@ +#tab siaparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +cancel {return $CANCEL_} +clear {return $CLEAR_} +close {return $CLOSE_} +coordinate {return $COORDINATE_} +crosshair {return $CROSSHAIR_} +export {return $EXPORT_} +name {return $NAME_} +print {return $PRINT_} +retrieve {return $RETRIEVE_} +save {return $SAVE_} +size {return $SIZE_} +sky {return $SKY_} +skyformat {return $SKYFORMAT_} +system {return $SYSTEM_} +update {return $UPDATE_} + +2mass {return $2MASS_} +akari {return $AKARI_} +astrowise {return $ASTROWISE_} +cadc {return $CADC_} +cxc {return $CXC_} +mast {return $MAST_} +sdss {return $SDSS_} +skyview {return $SKYVIEW_} +tgssadr {return $TGSSADR_} + +#include coords.fin +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/siaparser.tac b/ds9/parsers/siaparser.tac new file mode 100644 index 0000000..6a78b58 --- /dev/null +++ b/ds9/parsers/siaparser.tac @@ -0,0 +1,70 @@ +%{ +%} + +#include coords.tin +#include numeric.tin +#include string.tin + +%start command + +%token CANCEL_ +%token CLEAR_ +%token CLOSE_ +%token COORDINATE_ +%token CROSSHAIR_ +%token EXPORT_ +%token NAME_ +%token PRINT_ +%token RETRIEVE_ +%token SAVE_ +%token SIZE_ +%token SKY_ +%token SKYFORMAT_ +%token SYSTEM_ +%token UPDATE_ + +%token 2MASS_ +%token AKARI_ +%token ASTROWISE_ +%token CADC_ +%token CXC_ +%token MAST_ +%token SDSS_ +%token SKYVIEW_ +%token TGSSADR_ + +%% + +#include coords.trl +#include numeric.trl + +command : sia + | sia {yyclearin; YYACCEPT} STRING_ + ; + +sia : CANCEL_ {global cvarname; ARCancel $cvarname} + | CLOSE_ {global cvarname; SIADestroy $cvarname} + | CLEAR_ {global cvarname; SIAOff $cvarname} + | COORDINATE_ + | CROSSHAIR_ {global cvarname; IMGSVRCrosshair $cvarname} + | EXPORT_ + | SAVE_ + | NAME_ + | PRINT_ {global cvarname; CATPrint $cvarname} + | RETRIEVE_ {global cvarname; SIAApply $cvarname 1} + | SIZE_ + | SKY_ + | SKYFORMAT_ + | SYSTEM_ + | UPDATE_ {global cvarname; IMGSVRUpdate $cvarname} + ; + +%% + +proc sia::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |