diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-06-11 16:45:42 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-06-11 16:45:42 (GMT) |
commit | d233cb16ebbd17b7b0279a369554531709e1e9e5 (patch) | |
tree | bb11d67d77e5976eec672e63a32cfc1dfdba8e5e | |
parent | 9a7fedd488a60e755afeffc1fa60c560f2492446 (diff) | |
download | blt-d233cb16ebbd17b7b0279a369554531709e1e9e5.zip blt-d233cb16ebbd17b7b0279a369554531709e1e9e5.tar.gz blt-d233cb16ebbd17b7b0279a369554531709e1e9e5.tar.bz2 |
add ds9 prefs send parser
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/library/util.tcl | 24 | ||||
-rw-r--r-- | ds9/library/wcs.tcl | 12 | ||||
-rw-r--r-- | ds9/parsers/prefssendlex.fcl | 18 | ||||
-rw-r--r-- | ds9/parsers/prefssendparser.tac | 29 |
5 files changed, 63 insertions, 22 deletions
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index e5d3a8a..b5abccc 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -334,6 +334,8 @@ source $ds9(root)/library/precisionparser.tcl source $ds9(root)/library/precisionlex.tcl source $ds9(root)/library/prefsparser.tcl source $ds9(root)/library/prefslex.tcl +source $ds9(root)/library/prefssendparser.tcl +source $ds9(root)/library/prefssendlex.tcl source $ds9(root)/library/preserveparser.tcl source $ds9(root)/library/preservelex.tcl source $ds9(root)/library/psparser.tcl diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index ebbd522..1724235 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -318,6 +318,14 @@ proc ProcessSendCmdGet3 {varname key key2 key3} { $parse(proc) $parse(id) "$var($key) $var($key2) $var($key3)\n" } +proc ProcessSendCmdGet6 {varname key key2 key3 key4 key5 key6} { + upvar #0 $varname var + global $varname + + global parse + $parse(proc) $parse(id) "$var($key) $var($key2) $var($key3) $var($key4) $var($key5) $var($key6)\n" +} + proc ProcessSendCmdYesNo {varname key} { upvar #0 $varname var global $varname @@ -1343,17 +1351,13 @@ proc ProcessPrefsCmd {varname iname} { } proc ProcessSendPrefsCmd {proc id param {sock {}} {fn {}}} { - global pds9 - global ds9 + global parse + set parse(proc) $proc + set parse(id) $id - # backward compatibility - switch -- [string tolower [lindex $param 0]] { - precision {$proc $id "$pds9(prec,linear) $pds9(prec,deg) $pds9(prec,hms) $pds9(prec,dms) $pds9(prec,arcmin) $pds9(prec,arcsec)\n"} - bgcolor {$proc $id "$pds9(bg)\n"} - nancolor {$proc $id "$pds9(nan)\n"} - threads {$proc $id "$ds9(threads)\n"} - irafalign {$proc $id [ToYesNo $pds9(iraf)]} - } + prefssend::YY_FLUSH_BUFFER + prefssend::yy_scan_string $param + prefssend::yyparse } proc ProcessPrecisionCmd {varname iname} { diff --git a/ds9/library/wcs.tcl b/ds9/library/wcs.tcl index 1162369..d0e1f5c 100644 --- a/ds9/library/wcs.tcl +++ b/ds9/library/wcs.tcl @@ -1194,18 +1194,6 @@ proc ProcessSendWCSCmd {proc id param {sock {}} {fn {}}} { wcssend::YY_FLUSH_BUFFER wcssend::yy_scan_string $param wcssend::yyparse - return - - global current - global wcs - switch -- [string tolower $param] { - align {$proc $id [ToYesNo $current(align)]} - system {$proc $id "$wcs(system)\n"} - sky {$proc $id "$wcs(sky)\n"} - format - - skyformat {$proc $id "$wcs(skyformat)\n"} - default {$proc $id "$wcs(system)\n"} - } } # backward compatibilty diff --git a/ds9/parsers/prefssendlex.fcl b/ds9/parsers/prefssendlex.fcl new file mode 100644 index 0000000..aa1554a --- /dev/null +++ b/ds9/parsers/prefssendlex.fcl @@ -0,0 +1,18 @@ +#tab prefssendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +bgcolor {return $BGCOLOR_} +irafalign {return $IRAFALIGN_} +nancolor {return $NANCOLOR_} +precision {return $PRECISION_} +threads {return $THREADS_} + +#include ws.fin + +%% diff --git a/ds9/parsers/prefssendparser.tac b/ds9/parsers/prefssendparser.tac new file mode 100644 index 0000000..5c5c761 --- /dev/null +++ b/ds9/parsers/prefssendparser.tac @@ -0,0 +1,29 @@ +%{ +%} + +%start prefssend + +%token BGCOLOR_ +%token IRAFALIGN_ +%token NANCOLOR_ +%token PRECISION_ +%token THREADS_ + +%% + +prefssend : PRECISION_ {ProcessSendCmdGet6 pds9 prec,linear prec,deg prec,hms prec,dms prec,arcmin prec,arcsec} + | BGCOLOR_ {ProcessSendCmdGet pds9 bg} + | NANCOLOR_ {ProcessSendCmdGet pds9 nan} + | THREADS_ {ProcessSendCmdGet ds9 threads} + | IRAFALIGN_ {ProcessSendCmdYesNo pds9 iraf} + ; + +%% + +proc prefssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |