From f593b42ef7b6650c56ea035f37a2e2bfc4348a59 Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 29 Mar 2018 17:57:26 -0400 Subject: update ds9 parsers --- ds9/library/cat.tcl | 11 +--- ds9/library/grid.tcl | 30 +++++++++ ds9/parsers/catparser.tac | 18 +++--- ds9/parsers/gridparser.tac | 154 ++++++++++++++++++++++----------------------- 4 files changed, 118 insertions(+), 95 deletions(-) diff --git a/ds9/library/cat.tcl b/ds9/library/cat.tcl index 90b2c3a..308f7e2 100644 --- a/ds9/library/cat.tcl +++ b/ds9/library/cat.tcl @@ -1872,7 +1872,7 @@ proc CatalogCmdIcat {which value} { set icat($which) $value } -proc CatalogCmdCat {which value} { +proc CatalogCmdSet {which value} { global cvarname upvar #0 $cvarname cvar @@ -2035,13 +2035,6 @@ proc CatalogCmdSkyframe {skyframe} { CoordMenuButtonCmd $cvarname system sky [list CATWCSMenuUpdate $cvarname] } -proc CatalogCmdSkyformat {skyformat} { - global cvarname - upvar #0 $cvarname cvar - - set cvar(skyformat) $skyformat -} - proc CatalogCmdSystem {sys} { global cvarname upvar #0 $cvarname cvar @@ -2069,7 +2062,7 @@ proc CatalogCmdSymbol {col value} { CATGenerate $cvarname } -proc CatalogCmdSymbolStyle {value} { +proc CatalogCmdSymbolFontStyle {value} { global cvarname upvar #0 $cvarname cvar global $cvar(symdb) diff --git a/ds9/library/grid.tcl b/ds9/library/grid.tcl index ae4d11f..00eb9cd 100644 --- a/ds9/library/grid.tcl +++ b/ds9/library/grid.tcl @@ -1415,6 +1415,36 @@ proc ProcessGridCmd {varname iname} { } } +proc GridCmdSet {which value} { + global grid + + set grid($which) $value +} + +proc GridCmdCurrent {which value} { + global grid + + set grid($which) $value + GridUpdateCurrent +} + +proc GridCmdFontStyle {which value} { + switch $value { + normal { + set grid($which,weight) normal + set grid($which,slant) roman + } + bold { + set grid($which,weight) bold + set grid($which,slant) roman + } + italic { + set grid($which,weight) normal + set grid($which,slant) italic + } + } +} + proc ProcessSendGridCmd {proc id param} { global grid diff --git a/ds9/parsers/catparser.tac b/ds9/parsers/catparser.tac index 8f41c04..3a9cd32 100644 --- a/ds9/parsers/catparser.tac +++ b/ds9/parsers/catparser.tac @@ -127,8 +127,8 @@ catalog : {CATTool} ; catCmd : coordinate - | ALLCOLS_ yesno {CatalogCmdCat allcols $2} - | ALLROWS_ yesno {CatalogCmdCat allrows $2} + | ALLCOLS_ yesno {CatalogCmdSet allcols $2} + | ALLROWS_ yesno {CatalogCmdSet allrows $2} | CANCEL_ {global cvarname; ARCancel $cvarname} | CLEAR_ {global cvarname; CATOff $cvarname} | CLOSE_ {global cvarname; CATDestroy $cvarname} @@ -141,9 +141,9 @@ catCmd : coordinate | HIDE_ {CatalogCmdGenerate show 0} | LOCATION_ INT_ {CatalogCmdGenerate loc $2} | MATCH_ match - | MAXROWS_ INT_ {CatalogCmdCat max $2} - | NAME_ STRING_ {CatalogCmdCat name $2} - | PANTO_ yesno {CatalogCmdCat panto $2} + | MAXROWS_ INT_ {CatalogCmdSet max $2} + | NAME_ STRING_ {CatalogCmdSet name $2} + | PANTO_ yesno {CatalogCmdSet panto $2} | PLOT_ STRING_ STRING_ STRING_ STRING_ {CatalogCmdPlot $2 $3 $4 $5} | PRINT_ {global cvarname; CATPrint $cvarname} | PSKY_ skyframe {CatalogCmdGenerate psky $2} @@ -152,13 +152,13 @@ catCmd : coordinate | RETRIEVE_ {global cvarname; CATApply $cvarname 1} | SAMP_ samp | SAVE_ STRING_ {CatalogCmdSave $2 VOTWrite} - | SERVER_ server {CatalogCmdCat server $2} + | SERVER_ server {CatalogCmdSet server $2} | SHOW_ yesno {CatalogCmdGenerate show $2} | SIZE_ numeric numeric skyformat {CatalogCmdSize $2 $3 $4} | SKY_ skyframe {CatalogCmdSkyframe $2} - | SKYFORMAT_ skyformat {CatalogCmdSkyformat $2} + | SKYFORMAT_ skyformat {CatalogCmdSet skyformat $2} | SORT_ sort - | SYMBOL_ {CatalogCmdCat row 1} symbol + | SYMBOL_ {CatalogCmdSet row 1} symbol | SYMBOL_ INT_ {CagtalogCmdCat row $2} symbol | SYSTEM_ wcssys {CatalogCmdSystem $2} | UPDATE_ {global cvarname; CATUpdate $cvarname} @@ -240,7 +240,7 @@ symbol : ADD_ {CatalogCmdSymbolAdd} | FONTSIZE_ INT_ {CatalogCmdSymbol fontsize $2} | FONTWEIGHT_ fontWeight {CatalogCmdSymbol fontweight $2} | FONTSLANT_ fontSlant {CatalogCmdSymbol fontslant $2} - | FONTSTYLE_ fontStyle {CatalogCmdSymbolStyle $2} + | FONTSTYLE_ fontStyle {CatalogCmdSymbolFontStyle $2} | SIZE_ numeric {CatalogCmdSymbol size $2} | SIZE2_ numeric {CatalogCmdSymbol size2 $2} | SHAPE_ symbolShape {CatalogCmdSymbol shape $2} diff --git a/ds9/parsers/gridparser.tac b/ds9/parsers/gridparser.tac index f0d2974..2e15dac 100644 --- a/ds9/parsers/gridparser.tac +++ b/ds9/parsers/gridparser.tac @@ -82,17 +82,17 @@ interiortype : INTERIOR_ {set _ interior} | EXTERIOR_ {set _ exterior} ; -grid : yesno {global grid; set grid(view) $1; GridUpdateCurrent} +grid : yesno {GridCmdCurrent view $1} | OPEN_ {GridDialog} | CLOSE_ {GridDestroyDialog} # backward compatible | TYPE_ type {GridUpdateCurrent} - | SYSTEM_ system {global grid; set grid(system) $2; GridUpdateCurrent} - | SKYFRAME_ skyframe {global grid; set grid(sky) $2; GridUpdateCurrent} - | SKYFORMAT_ skyformat {global grid; set grid(skyformat) $2; GridUpdateCurrent} + | SYSTEM_ system {GridCmdCurrent system $2} + | SKYFRAME_ skyframe {GridCmdCurrent sky $2} + | SKYFORMAT_ skyformat {GridCmdCurrent skyformat $2} | GRID_ gridgrid {GridUpdateCurrent} - | FORMAT1_ STRING_ {global grid; set grid(format1) $2; GridUpdateCurrent} - | FORMAT2_ STRING_ {global grid; set grid(format2) $2; GridUpdateCurrent} + | FORMAT1_ STRING_ {GridCmdCurrent format1 $2} + | FORMAT2_ STRING_ {GridCmdCurrent format2 $2} | AXES_ axes {GridUpdateCurrent} | TICKMARKS_ tickmarks {GridUpdateCurrent} | BORDER_ border {GridUpdateCurrent} @@ -105,34 +105,34 @@ grid : yesno {global grid; set grid(view) $1; GridUpdateCurrent} | SAVE_ STRING_ {FileLast gridfbox $2; GridSave $2} ; -type : typegrid {global grid; set grid(type) $1} - | AXES_ interiortype {global grid; set grid(axes,type) $2} - | NUMERICS_ interiortype {global grid; set grid(numlab,type) $2} +type : typegrid {GridCmdSet type $1} + | AXES_ interiortype {GridCmdSet axes,type $2} + | NUMERICS_ interiortype {GridCmdSet numlab,type $2} ; system : coordsys {set _ $1} | wcssys {set _ $1} ; -gridgrid : yesno {global grid; set grid(grid) $1} - | COLOR_ STRING_ {global grid; set grid(grid,color) $2} - | WIDTH_ INT_ {global grid; set grid(grid,width) $2} - | DASH_ yesno {global grid; set grid(grid,style) $2} +gridgrid : yesno {GridCmdSet grid $1} + | COLOR_ STRING_ {GridCmdSet grid,color $2} + | WIDTH_ INT_ {GridCmdSet grid,width $2} + | DASH_ yesno {GridCmdSet grid,style $2} # backward compatible - | STYLE_ INT_ {global grid; set grid(grid,style) $2} - | GAP1_ numeric {global grid; set grid(grid,gap1) $2} - | GAP2_ numeric {global grid; set grid(grid,gap2) $2} - | GAP3_ numeric {global grid; set grid(grid,gap3) $2} + | STYLE_ INT_ {GridCmdSet grid,style $2} + | GAP1_ numeric {GridCmdSet grid,gap1 $2} + | GAP2_ numeric {GridCmdSet grid,gap2 $2} + | GAP3_ numeric {GridCmdSet grid,gap3 $2} ; -axes : yesno {global grid; set grid(axes) $1} - | COLOR_ STRING_ {global grid; set grid(axes,color) $2} - | WIDTH_ INT_ {global grid; set grid(axes,width) $2} - | DASH_ yesno {global grid; set grid(axes,style) $2} +axes : yesno {GridCmdSet axes $1} + | COLOR_ STRING_ {GridCmdSet axes,color $2} + | WIDTH_ INT_ {GridCmdSet axes,width $2} + | DASH_ yesno {GridCmdSet axes,style $2} # backward compatible - | STYLE_ INT_ {global grid; set grid(axes,style) $2} - | TYPE_ interiortype {global grid; set grid(axes,type) $2} - | ORIGIN_ origin {global grid; set grid(axes,origin) $2} + | STYLE_ INT_ {GridCmdSet axes,style $2} + | TYPE_ interiortype {GridCmdSet axes,type $2} + | ORIGIN_ origin {GridCmdSet axes,origin $2} ; origin : LLL_ {set _ lll} @@ -145,74 +145,74 @@ origin : LLL_ {set _ lll} | UUU_ {set _ uuu} ; -tickmarks : yesno {global grid; set grid(tick) $1} - | COLOR_ STRING_ {global grid; set grid(tick,color) $2} - | WIDTH_ INT_ {global grid; set grid(tick,width) $2} - | DASH_ yesno {global grid; set grid(tick,style) $2} +tickmarks : yesno {GridCmdSet tick $1} + | COLOR_ STRING_ {GridCmdSet tick,color $2} + | WIDTH_ INT_ {GridCmdSet tick,width $2} + | DASH_ yesno {GridCmdSet tick,style $2} # backward compatible - | STYLE_ INT_ {global grid; set grid(tick,style) $2} + | STYLE_ INT_ {GridCmdSet tick,style $2} ; -border : yesno {global grid; set grid(border) $1} - | COLOR_ STRING_ {global grid; set grid(border,color) $2} - | WIDTH_ INT_ {global grid; set grid(border,width) $2} - | DASH_ yesno {global grid; set grid(border,style) $2} +border : yesno {GridCmdSet border $1} + | COLOR_ STRING_ {GridCmdSet border,color $2} + | WIDTH_ INT_ {GridCmdSet border,width $2} + | DASH_ yesno {GridCmdSet border,style $2} # backward compatible - | STYLE_ INT_ {global grid; set grid(border,style) $2} + | STYLE_ INT_ {GridCmdSet border,style $2} ; -numerics : yesno {global grid; set grid(numlab) $1} - | FONT_ font {global grid; set grid(numlab,font) $2} - | FONTSIZE_ INT_ {global grid; set grid(numlab,size) $2} - | FONTWEIGHT_ fontWeight {global grid; set grid(numlab,weight) $2} - | FONTSLANT_ fontSlant {global grid; set grid(numlab,slant) $2} - | FONTSTYLE_ fontStyle - | COLOR_ STRING_ {global grid; set grid(numlab,color) $2} - | GAP1_ numeric {global grid; set grid(numlab,gap1) $2} - | GAP2_ numeric {global grid; set grid(numlab,gap2) $2} - | GAP3_ numeric {global grid; set grid(numlab,gap3) $2} - | TYPE_ interiortype {global grid; set grid(numlab,type) $2} - | VERTICAL_ yesno {global grid; set grid(numlab,vertical) $2} +numerics : yesno {GridCmdSet numlab $1} + | FONT_ font {GridCmdSet numlab,font $2} + | FONTSIZE_ INT_ {GridCmdSet numlab,size $2} + | FONTWEIGHT_ fontWeight {GridCmdSet numlab,weight $2} + | FONTSLANT_ fontSlant {GridCmdSet numlab,slant $2} + | FONTSTYLE_ fontStyle {GridCmdFontStyle numlab $2} + | COLOR_ STRING_ {GridCmdSet numlab,color $2} + | GAP1_ numeric {GridCmdSet numlab,gap1 $2} + | GAP2_ numeric {GridCmdSet numlab,gap2 $2} + | GAP3_ numeric {GridCmdSet numlab,gap3 $2} + | TYPE_ interiortype {GridCmdSet numlab,type $2} + | VERTICAL_ yesno {GridCmdSet numlab,vertical $2} ; -title : yesno {global grid; set grid(title) $1} - | TEXT_ STRING_ {global grid; set grid(title,text) $2} - | DEF_ yesno {global grid; set grid(title,def) $2} - | GAP_ numeric {global grid; set grid(title,gap) $2} - | FONT_ font {global grid; set grid(title,font) $2} - | FONTSIZE_ INT_ {global grid; set grid(title,size) $2} - | FONTWEIGHT_ fontWeight {global grid; set grid(title,weight) $2} - | FONTSLANT_ fontSlant {global grid; set grid(title,slant) $2} - | FONTSTYLE_ fontStyle - | COLOR_ STRING_ {global grid; set grid(title,color) $2} +title : yesno {GridCmdSet title $1} + | TEXT_ STRING_ {GridCmdSet title,text $2} + | DEF_ yesno {GridCmdSet title,def $2} + | GAP_ numeric {GridCmdSet title,gap $2} + | FONT_ font {GridCmdSet title,font $2} + | FONTSIZE_ INT_ {GridCmdSet title,size $2} + | FONTWEIGHT_ fontWeight {GridCmdSet title,weight $2} + | FONTSLANT_ fontSlant {GridCmdSet title,slant $2} + | FONTSTYLE_ fontStyle {GridCmdFontStyle title $2} + | COLOR_ STRING_ {GridCmdSet title,color $2} ; -labels : yesno {global grid; set grid(textlab) $1} - | TEXT1_ STRING_ {global grid; set grid(textlab,text1) $2} - | TEXT2_ STRING_ {global grid; set grid(textlab,text2) $2} - | DEF1_ yesno {global grid; set grid(textlab,def1) $2} - | DEF2_ yesno {global grid; set grid(textlab,def2) $2} - | GAP1_ numeric {global grid; set grid(textlab,gap1) $2} - | GAP2_ numeric {global grid; set grid(textlab,gap2) $2} - | FONT_ font {global grid; set grid(textlab,font) $2} - | FONTSIZE_ INT_ {global grid; set grid(textlab,size) $2} - | FONTWEIGHT_ fontWeight {global grid; set grid(textlab,weight) $2} - | FONTSLANT_ fontSlant {global grid; set grid(textlab,slant) $2} - | FONTSTYLE_ fontStyle - | COLOR_ STRING_ {global grid; set grid(textlab,color) $2} +labels : yesno {GridCmdSet textlab $1} + | TEXT1_ STRING_ {GridCmdSet textlab,text1 $2} + | TEXT2_ STRING_ {GridCmdSet textlab,text2 $2} + | DEF1_ yesno {GridCmdSet textlab,def1 $2} + | DEF2_ yesno {GridCmdSet textlab,def2 $2} + | GAP1_ numeric {GridCmdSet textlab,gap1 $2} + | GAP2_ numeric {GridCmdSet textlab,gap2 $2} + | FONT_ font {GridCmdSet textlab,font $2} + | FONTSIZE_ INT_ {GridCmdSet textlab,size $2} + | FONTWEIGHT_ fontWeight {GridCmdSet textlab,weight $2} + | FONTSLANT_ fontSlant {GridCmdSet textlab,slant $2} + | FONTSTYLE_ fontStyle {GridCmdFontStyle textlab $2} + | COLOR_ STRING_ {GridCmdSet textlab,color $2} ; -view : GRID_ yesno {global grid; set grid(grid) $1} +view : GRID_ yesno {GridCmdSet grid $1} | AXES_ viewaxes - | TITLE_ yesno {global grid; set grid(title) $2} - | BORDER_ yesno {global grid; set grid(border) $2} - | VERTICAL_ yesno {global grid; set grid(numlab,vertical) $2} + | TITLE_ yesno {GridCmdSet title $2} + | BORDER_ yesno {GridCmdSet border $2} + | VERTICAL_ yesno {GridCmdSet numlab,vertical $2} ; -viewaxes : yesno {global grid; set grid(axes) $1} - | NUMBERS_ yesno {global grid; set grid(numlab) $2} - | TICKMARKS_ yesno {global grid; set grid(tick) $2} - | LABELS_ yesno {global grid; set grid(textlab) $2} +viewaxes : yesno {GridCmdSet axes $1} + | NUMBERS_ yesno {GridCmdSet numlab $2} + | TICKMARKS_ yesno {GridCmdSet tick $2} + | LABELS_ yesno {GridCmdSet textlab $2} ; %% -- cgit v0.12