diff options
-rw-r--r-- | ds9/library/magnifier.tcl | 18 | ||||
-rw-r--r-- | ds9/library/marker.tcl | 4 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/magnifierlex.fcl | 19 | ||||
-rw-r--r-- | ds9/parsers/magnifierparser.tac | 40 | ||||
-rw-r--r-- | ds9/parsers/regionparser.tac | 70 |
6 files changed, 116 insertions, 37 deletions
diff --git a/ds9/library/magnifier.tcl b/ds9/library/magnifier.tcl index 21b1aa3..25fa9ed 100644 --- a/ds9/library/magnifier.tcl +++ b/ds9/library/magnifier.tcl @@ -140,6 +140,14 @@ proc ProcessMagnifierCmd {varname iname} { upvar $varname var upvar $iname i + global debug + if {$debug(tcl,parser)} { + magnifier::YY_FLUSH_BUFFER + magnifier::yy_scan_string [lrange $var $i end] + magnifier::yyparse + incr i [expr $magnifier::yycnt-1] + } else { + global pmagnifier global view @@ -172,6 +180,16 @@ proc ProcessMagnifierCmd {varname iname} { } } } +} + +proc PmagnifierCmdSet {which value {cmd {}}} { + global pmagnifier + + set pmagnifier($which) $value + if {$cmd != {}} { + eval $cmd + } +} proc ProcessSendMagnifierCmd {proc id param} { global pmagnifier diff --git a/ds9/library/marker.tcl b/ds9/library/marker.tcl index 78a31da..bc998d3 100644 --- a/ds9/library/marker.tcl +++ b/ds9/library/marker.tcl @@ -1976,7 +1976,7 @@ proc ProcessRegionsCmd {varname iname sock fn} { } } -proc RegionCmdSet {which value {cmd {}}} { +proc MarkerCmdSet {which value {cmd {}}} { global marker set marker($which) $value @@ -1985,7 +1985,7 @@ proc RegionCmdSet {which value {cmd {}}} { } } -proc PRegionCmdSet {which value {cmd {}}} { +proc PmarkerCmdSet {which value {cmd {}}} { global pmarker set pmarker($which) $value diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 0dee8b4..a9eccf3 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -232,6 +232,8 @@ source $ds9(root)/library/headerparser.tcl source $ds9(root)/library/headerlex.tcl source $ds9(root)/library/lockparser.tcl source $ds9(root)/library/locklex.tcl +source $ds9(root)/library/magnifierparser.tcl +source $ds9(root)/library/magnifierlex.tcl source $ds9(root)/library/matchparser.tcl source $ds9(root)/library/matchlex.tcl source $ds9(root)/library/nanparser.tcl diff --git a/ds9/parsers/magnifierlex.fcl b/ds9/parsers/magnifierlex.fcl new file mode 100644 index 0000000..d5a3561 --- /dev/null +++ b/ds9/parsers/magnifierlex.fcl @@ -0,0 +1,19 @@ +#tab magnifierparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +color {return $COLOR_} +cursor {return $CURSOR_} +region {return $REGION_} +zoom {return $ZOOM_} + +#include yesno.fin +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/magnifierparser.tac b/ds9/parsers/magnifierparser.tac new file mode 100644 index 0000000..69dc5dc --- /dev/null +++ b/ds9/parsers/magnifierparser.tac @@ -0,0 +1,40 @@ +%{ +%} + +#include yesno.tin +#include numeric.tin +#include string.tin + +%start command + +%token COLOR_ +%token CURSOR_ +%token REGION_ +%token ZOOM_ + +%% + +#include yesno.trl +#include numeric.trl + +command : magnifier + | magnifier {yyclearin; YYACCEPT} STRING_ + ; + +magnifier : COLOR_ STRING_ {PmagnifierCmdSet color $2 MagnifierColor} + | ZOOM_ numeric {PmagnifierCmdSet zoom $2 MagnifierZoom} + | CURSOR_ yesno {PmagnifierCmdSet cursor $2 MagnifierCursor} + | REGION_ yesno {PmagnifierCmdSet region $2 MagnifierRegion} +# backward compatibility + | yesno {ViewCmdSet magnifier $1 UpdateView} + ; + +%% + +proc magnifier::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/regionparser.tac b/ds9/parsers/regionparser.tac index 4651f43..dd9c61c 100644 --- a/ds9/parsers/regionparser.tac +++ b/ds9/parsers/regionparser.tac @@ -125,12 +125,12 @@ region : {RegionCmdLoad} | FILE_ loadall STRING_ {RegionCmdLoadFn $3 $2} | SAVE_ STRING_ {RegionCmdSave $2} | LIST_ list - | EPSILON_ INT_ {PRegionCmdSet epsilon $2 MarkerEpsilon} - | SHOW_ yesno {RegionCmdSet show $2 MarkerShow} - | SHOWTEXT_ yesno {RegionCmdSet show,text $2 MarkerShowText} + | EPSILON_ INT_ {PmarkerCmdSet epsilon $2 MarkerEpsilon} + | SHOW_ yesno {MarkerCmdSet show $2 MarkerShow} + | SHOWTEXT_ yesno {MarkerCmdSet show,text $2 MarkerShowText} | CENTROID_ centroid # backward compatibility - | AUTOCENTROID_ yesno {RegionCmdSet centroid,auto $2 MarkerCentroidAuto} + | AUTOCENTROID_ yesno {MarkerCmdSet centroid,auto $2 MarkerCentroidAuto} | GETINFO_ {MarkerInfo} | MOVE_ move # backward compatibility @@ -145,35 +145,35 @@ region : {RegionCmdLoad} | DELETE_ delete # backward compatibility | DELETEALL_ {MarkerDeleteAll} - | FORMAT_ format {RegionCmdSet format $2} - | SYSTEM_ coordsys {RegionCmdSet system $2} - | SYSTEM_ wcssys {RegionCmdSet system $2} + | FORMAT_ format {MarkerCmdSet format $2} + | SYSTEM_ coordsys {MarkerCmdSet system $2} + | SYSTEM_ wcssys {MarkerCmdSet system $2} # backward compatibility - | SYSTEM_ skyframe {RegionCmdSet system wcs; RegionCmdSet sky $2} - | SKY_ skyframe {RegionCmdSet sky $2} - | SKYFORMAT_ skyformat {RegionCmdSet skyformat $2} - | STRIP_ yesno {RegionCmdSet strip $2} - | DELIM_ delim {RegionCmdSet strip $2} - | SHAPE_ shape {RegionCmdSet shape $2} - | COLOR_ STRING_ {RegionCmdSet color $2 MarkerColor} - | WIDTH_ INT_ {RegionCmdSet width $2 MarkerWidth} - | FIXED_ yesno {RegionCmdSet fixed $2 [list MarkerProp fixed]} - | EDIT_ yesno {RegionCmdSet edit $2 [list MarkerProp edit]} - | ROTATE_ yesno {RegionCmdSet rotate $2 [list MarkerProp rotate]} - | DELETE_ yesno {RegionCmdSet delete $2 [list MarkerProp delete]} - | INCLUDE_ {RegionCmdSet include 1 [list MarkerProp include]} - | EXCLUDE_ {RegionCmdSet include 0 [list MarkerProp include]} - | SOURCE_ {RegionCmdSet source 1 [list MarkerProp source]} - | BACKGROUND_ {RegionCmdSet source 0 [list MarkerProp source]} + | SYSTEM_ skyframe {MarkerCmdSet system wcs; MarkerCmdSet sky $2} + | SKY_ skyframe {MarkerCmdSet sky $2} + | SKYFORMAT_ skyformat {MarkerCmdSet skyformat $2} + | STRIP_ yesno {MarkerCmdSet strip $2} + | DELIM_ delim {MarkerCmdSet strip $2} + | SHAPE_ shape {MarkerCmdSet shape $2} + | COLOR_ STRING_ {MarkerCmdSet color $2 MarkerColor} + | WIDTH_ INT_ {MarkerCmdSet width $2 MarkerWidth} + | FIXED_ yesno {MarkerCmdSet fixed $2 [list MarkerProp fixed]} + | EDIT_ yesno {MarkerCmdSet edit $2 [list MarkerProp edit]} + | ROTATE_ yesno {MarkerCmdSet rotate $2 [list MarkerProp rotate]} + | DELETE_ yesno {MarkerCmdSet delete $2 [list MarkerProp delete]} + | INCLUDE_ {MarkerCmdSet include 1 [list MarkerProp include]} + | EXCLUDE_ {MarkerCmdSet include 0 [list MarkerProp include]} + | SOURCE_ {MarkerCmdSet source 1 [list MarkerProp source]} + | BACKGROUND_ {MarkerCmdSet source 0 [list MarkerProp source]} | GROUPS_ group | GROUP_ group | COPY_ {MarkerCopy} | CUT_ {MarkerCut} - | PASTE_ {RegionCmdSet paste,system wcs MarkerPaste} - | PASTE_ coordsys {RegionCmdSet paste,system $2 MarkerPaste} - | PASTE_ wcssys {RegionCmdSet paste,system $2 MarkerPaste} + | PASTE_ {MarkerCmdSet paste,system wcs MarkerPaste} + | PASTE_ coordsys {MarkerCmdSet paste,system $2 MarkerPaste} + | PASTE_ wcssys {MarkerCmdSet paste,system $2 MarkerPaste} # backward compatibility - | PASTE_ skyframe {RegionCmdSet paste,system wcs MarkerPaste} + | PASTE_ skyframe {MarkerCmdSet paste,system wcs MarkerPaste} | UNDO_ {MarkerUndo} | COMPOSITE_ {CompositeCreate} | DISSOLVE_ {CompositeDelete} @@ -186,12 +186,12 @@ props : props prop | prop ; -prop : -FORMAT_ format {RegionCmdSet load,format $2} - | -SYSTEM_ coordsys {RegionCmdSet load,system $2} - | -SYSTEM_ wcssys {RegionCmdSet load,system $2} +prop : -FORMAT_ format {MarkerCmdSet load,format $2} + | -SYSTEM_ coordsys {MarkerCmdSet load,system $2} + | -SYSTEM_ wcssys {MarkerCmdSet load,system $2} # backward compatibility - | -SYSTEM_ skyframe {RegionCmdSet load,system wcs; RegionCmdSet load,sky $2} - | -SKY_ skyframe {RegionCmdSet load,sky $2} + | -SYSTEM_ skyframe {MarkerCmdSet load,system wcs; MarkerCmdSet load,sky $2} + | -SKY_ skyframe {MarkerCmdSet load,sky $2} ; loadall : {set _ 0} @@ -203,9 +203,9 @@ list : {RegionCmdList} ; centroid : {MarkerCentroid} - | AUTO_ yesno {RegionCmdSet centroid,auto $2 MarkerCentroidAuto} - | RADIUS_ numeric {RegionCmdSet centroid,radius $2 MarkerCentroidRadius} - | ITERATION_ INT_ {RegionCmdSet centroid,iteration $2 MarkerCentroidIteration} + | AUTO_ yesno {MarkerCmdSet centroid,auto $2 MarkerCentroidAuto} + | RADIUS_ numeric {MarkerCmdSet centroid,radius $2 MarkerCentroidRadius} + | ITERATION_ INT_ {MarkerCmdSet centroid,iteration $2 MarkerCentroidIteration} ; move : FRONT_ {MarkerFront} |