diff options
-rw-r--r-- | ds9/library/bin.tcl | 41 | ||||
-rw-r--r-- | ds9/library/block.tcl | 29 | ||||
-rw-r--r-- | ds9/library/crop.tcl | 46 | ||||
-rw-r--r-- | ds9/library/grid.tcl | 180 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/library/util.tcl | 45 | ||||
-rw-r--r-- | ds9/parsers/blocksendlex.fcl | 14 | ||||
-rw-r--r-- | ds9/parsers/blocksendparser.tac | 22 |
8 files changed, 112 insertions, 267 deletions
diff --git a/ds9/library/bin.tcl b/ds9/library/bin.tcl index f0d4f47..3395abe 100644 --- a/ds9/library/bin.tcl +++ b/ds9/library/bin.tcl @@ -730,40 +730,11 @@ proc ProcessBinCmd {varname iname} { } proc ProcessSendBinCmd {proc id param {sock {}} {fn {}}} { - if {1} { - global parse - set parse(proc) $proc - set parse(id) $id - - binsend::YY_FLUSH_BUFFER - binsend::yy_scan_string $param - binsend::yyparse - } else { - - global bin - global current + global parse + set parse(proc) $proc + set parse(id) $id - switch -- [string tolower [lindex $param 0]] { - lock {$proc $id [ToYesNo $bin(lock)]} - about { - if {$current(frame) != {}} { - $proc $id "[$current(frame) get bin cursor]\n" - } - } - buffersize {$proc $id "$bin(buffersize)\n"} - cols { - if {$current(frame) != {}} { - $proc $id "[$current(frame) get bin cols]\n" - } - } - factor {$proc $id "$bin(factor)\n"} - depth {$proc $id "$bin(depth)\n"} - filter { - if {$current(frame) != {}} { - $proc $id "[$current(frame) get bin filter]\n" - } - } - function {$proc $id "$bin(function)\n"} - } -} + binsend::YY_FLUSH_BUFFER + binsend::yy_scan_string $param + binsend::yyparse } diff --git a/ds9/library/block.tcl b/ds9/library/block.tcl index eb22c07..e06b447 100644 --- a/ds9/library/block.tcl +++ b/ds9/library/block.tcl @@ -296,19 +296,24 @@ proc ProcessBlockCmd {varname iname} { } proc ProcessSendBlockCmd {proc id param {sock {}} {fn {}}} { + global parse + set parse(proc) $proc + set parse(id) $id + + blocksend::YY_FLUSH_BUFFER + blocksend::yy_scan_string $param + blocksend::yyparse +} + +proc BlockSendCmd {} { + global parse global block - switch -- [lindex $param 0] { - lock {$proc $id [ToYesNo $block(lock)]} - default { - set z1 [lindex $block(factor) 0] - set z2 [lindex $block(factor) 1] - if {$z1 != $z2} { - $proc $id "$block(factor)\n" - } else { - $proc $id "$z1\n" - } - } + set z1 [lindex $block(factor) 0] + set z2 [lindex $block(factor) 1] + if {$z1 != $z2} { + $parse(proc) $parse(id) "$block(factor)\n" + } else { + $parse(proc) $parse(id) "$z1\n" } } - diff --git a/ds9/library/crop.tcl b/ds9/library/crop.tcl index 7ca5779..b505b18 100644 --- a/ds9/library/crop.tcl +++ b/ds9/library/crop.tcl @@ -402,7 +402,6 @@ proc ProcessCropCmd {varname iname} { proc ProcessSendCropCmd {proc id param {sock {}} {fn {}}} { global crop global current - switch -- [string tolower [lindex $param 0]] { lock {$proc $id "$crop(lock)\n"} 3d { @@ -426,3 +425,48 @@ proc ProcessSendCropCmd {proc id param {sock {}} {fn {}}} { } } } + +proc FixSpecSystem {sysname defsys} { + upvar $sysname sys + + set rr 0 + + switch -- $sys { + image - + physical - + detector - + amplifier - + wcs - + wcsa - + wcsb - + wcsc - + wcsd - + wcse - + wcsf - + wcsg - + wcsh - + wcsi - + wcsj - + wcsk - + wcsl - + wcsm - + wcsn - + wcso - + wcsp - + wcsq - + wcsr - + wcss - + wcst - + wcsu - + wcsv - + wcsw - + wcsx - + wcsy - + wcsz {incr rr} + default { + set sys $defsys + } + } + + return $rr +} diff --git a/ds9/library/grid.tcl b/ds9/library/grid.tcl index d7ecac5..eb56a3b 100644 --- a/ds9/library/grid.tcl +++ b/ds9/library/grid.tcl @@ -1170,179 +1170,11 @@ proc GridCmdFontStyle {which value {cmd {}}} { } proc ProcessSendGridCmd {proc id param {sock {}} {fn {}}} { - if {1} { - global parse - set parse(proc) $proc - set parse(id) $id - - gridsend::YY_FLUSH_BUFFER - gridsend::yy_scan_string $param - gridsend::yyparse - } else { - - global grid - switch -- [lindex $param 0] { - type { - switch -- [lindex $param 1] { - axes { - # backward compatible - $proc $id "$grid(axes,type)\n" - } - numerics { - # backward compatible - $proc $id "$grid(numlab,type)\n" - } - default {$proc $id "$grid(type)\n"} - } - } - - system {$proc $id "$grid(system)\n"} - sky {$proc $id "$grid(sky)\n"} - skyformat {$proc $id "$grid(skyformat)\n"} - - grid { - switch -- [lindex $param 1] { - color {$proc $id "$grid(grid,color)\n"} - width {$proc $id "$grid(grid,width)\n"} - dash {$proc $id [ToYesNo $grid(grid,style)]} - style { - # backward compatible - $proc $id "$grid(grid,style)\n" - } - gap1 {$proc $id "$grid(grid,gap1)\n"} - gap2 {$proc $id "$grid(grid,gap2)\n"} - gap3 {$proc $id "$grid(grid,gap3)\n"} - default {$proc $id [ToYesNo $grid(grid)]} - } - } + global parse + set parse(proc) $proc + set parse(id) $id - axes { - switch -- [lindex $param 1] { - color {$proc $id "$grid(axes,color)\n"} - width {$proc $id "$grid(axes,width)\n"} - dash {$proc $id [ToYesNo $grid(axes,style)]} - style { - # backward compatible - $proc $id "$grid(axes,style)\n" - } - type {$proc $id "$grid(axes,type)\n"} - origin {$proc $id "$grid(axes,origin)\n"} - default {$proc $id [ToYesNo $grid(axes)]} - } - } - - format1 {$proc $id "$grid(format1)\n"} - format2 {$proc $id "$grid(format2)\n"} - - tickmark - - tickmarks - - tick { - switch -- [lindex $param 1] { - color {$proc $id "$grid(tick,color)\n"} - width {$proc $id "$grid(tick,width)\n"} - dash {$proc $id [ToYesNo $grid(tick,style)]} - style { - # backward compatible - $proc $id "$grid(tick,style)\n" - } - default {$proc $id [ToYesNo $grid(tick)]} - } - } - - border { - switch -- [lindex $param 1] { - color {$proc $id "$grid(border,color)\n"} - width {$proc $id "$grid(border,width)\n"} - dash {$proc $id [ToYesNo $grid(border,style)]} - style { - # backward compatible - $proc $id "$grid(border,style)\n" - } - default {$proc $id [ToYesNo $grid(border)]} - } - } - - numeric - - numerics - - numlab { - switch -- [lindex $param 1] { - font {$proc $id "$grid(numlab,font)\n"} - fontsize {$proc $id "$grid(numlab,size)\n"} - fontweight {$proc $id "$grid(numlab,weight)\n"} - fontslant {$proc $id "$grid(numlab,slant)\n"} - fontstyle { - # backward compatible - $proc $id "$grid(numlab,weight)\n" - } - color {$proc $id "$grid(numlab,color)\n"} - gap1 {$proc $id "$grid(numlab,gap1)\n"} - gap2 {$proc $id "$grid(numlab,gap2)\n"} - gap3 {$proc $id "$grid(numlab,gap3)\n"} - type {$proc $id "$grid(numlab,type)\n"} - vertical {$proc $id "$grid(numlab,vertical)\n"} - default {$proc $id [ToYesNo $grid(numlab)]} - } - } - - title { - switch -- [lindex $param 1] { - text {$proc $id "$grid(title,text)\n"} - def {$proc $id [ToYesNo $grid(title,def)]} - gap {$proc $id "$grid(title,gap)\n"} - font {$proc $id "$grid(title,font)\n"} - fontsize {$proc $id "$grid(title,size)\n"} - fontweight {$proc $id "$grid(title,weight)\n"} - fontslant {$proc $id "$grid(title,slant)\n"} - fontstyle { - # backward compatible - $proc $id "$grid(title,weight)\n" - } - color {$proc $id "$grid(title,color)\n"} - default {$proc $id [ToYesNo $grid(title)]} - } - } - - label - - labels - - textlab { - switch -- [lindex $param 1] { - text1 {$proc $id "$grid(textlab,text1)\n"} - text2 {$proc $id "$grid(textlab,text2)\n"} - def1 {$proc $id [ToYesNo $grid(textlab,def1)]} - def2 {$proc $id [ToYesNo $grid(textlab,def2)]} - gap1 {$proc $id "$grid(textlab,gap1)\n"} - gap2 {$proc $id "$grid(textlab,gap2)\n"} - font {$proc $id "$grid(textlab,font)\n"} - fontsize {$proc $id "$grid(textlab,size)\n"} - fontweight {$proc $id "$grid(textlab,weight)\n"} - fontslant {$proc $id "$grid(textlab,slant)\n"} - fontstyle { - # backward compatible - $proc $id "$grid(textlab,weight)\n" - } - color {$proc $id "$grid(textlab,color)\n"} - default {$proc $id [ToYesNo $grid(textlab)]} - } - } - - view { - # backward compatible - switch -- [lindex $param 1] { - grid {$proc $id [ToYesNo $grid(grid)]} - axes { - switch -- [lindex $param 2] { - numbers {$proc $id [ToYesNo $grid(numlab)]} - tickmarks {$proc $id [ToYesNo $grid(tick)]} - label {$proc $id [ToYesNo $grid(textlab)]} - default {$proc $id [ToYesNo $grid(axes)]} - } - } - title {$proc $id [ToYesNo $grid(title)]} - border {$proc $id [ToYesNo $grid(border)]} - vertical {$proc $id [ToYesNo $grid(numlab,vertical)]} - } - } - default {$proc $id [ToYesNo $grid(view)]} - } -} + gridsend::YY_FLUSH_BUFFER + gridsend::yy_scan_string $param + gridsend::yyparse } diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index fdb40b9..581b9a7 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -206,6 +206,8 @@ source $ds9(root)/library/blinkparser.tcl source $ds9(root)/library/blinklex.tcl source $ds9(root)/library/blockparser.tcl source $ds9(root)/library/blocklex.tcl +source $ds9(root)/library/blocksendparser.tcl +source $ds9(root)/library/blocksendlex.tcl source $ds9(root)/library/catparser.tcl source $ds9(root)/library/catlex.tcl source $ds9(root)/library/cmapparser.tcl diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index bd27680..5e7e9dc 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -1163,51 +1163,6 @@ proc FixSpec {sysname skyname formatname defsys defsky defformat} { return $rr } -proc FixSpecSystem {sysname defsys} { - upvar $sysname sys - - set rr 0 - - switch -- $sys { - image - - physical - - detector - - amplifier - - wcs - - wcsa - - wcsb - - wcsc - - wcsd - - wcse - - wcsf - - wcsg - - wcsh - - wcsi - - wcsj - - wcsk - - wcsl - - wcsm - - wcsn - - wcso - - wcsp - - wcsq - - wcsr - - wcss - - wcst - - wcsu - - wcsv - - wcsw - - wcsx - - wcsy - - wcsz {incr rr} - default { - set sys $defsys - } - } - - return $rr -} - proc DS9Backup {ch which} { global pds9 diff --git a/ds9/parsers/blocksendlex.fcl b/ds9/parsers/blocksendlex.fcl new file mode 100644 index 0000000..7306a81 --- /dev/null +++ b/ds9/parsers/blocksendlex.fcl @@ -0,0 +1,14 @@ +#tab blocksendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +lock {return $LOCK_} + +#include string.fin + +%% diff --git a/ds9/parsers/blocksendparser.tac b/ds9/parsers/blocksendparser.tac new file mode 100644 index 0000000..551f7ca --- /dev/null +++ b/ds9/parsers/blocksendparser.tac @@ -0,0 +1,22 @@ +%{ +%} + +#include string.tin + +%token LOCK_ + +%% + +blocksend : {BlockSendCmd} + | LOCK_ {ProcessSendCmdYesNo block lock} + ; + +%% + +proc blocksend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |