summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ds9/library/panzoom.tcl18
-rw-r--r--ds9/library/source.tcl4
-rw-r--r--ds9/parsers/orientlex.fcl17
-rw-r--r--ds9/parsers/orientparser.tac40
-rw-r--r--ds9/parsers/rotatelex.fcl17
-rw-r--r--ds9/parsers/rotateparser.tac35
-rw-r--r--ds9/parsers/zoomparser.tac1
7 files changed, 131 insertions, 1 deletions
diff --git a/ds9/library/panzoom.tcl b/ds9/library/panzoom.tcl
index 851e003..ae3de93 100644
--- a/ds9/library/panzoom.tcl
+++ b/ds9/library/panzoom.tcl
@@ -817,6 +817,14 @@ proc ProcessOrientCmd {varname iname} {
# we need to be realized
ProcessRealizeDS9
+ global debug
+ if {$debug(tcl,parser)} {
+ orient::YY_FLUSH_BUFFER
+ orient::yy_scan_string [lrange $var $i end]
+ orient::yyparse
+ incr i [expr $orient::yycnt-1]
+ } else {
+
global current
switch -- [string tolower [lindex $var $i]] {
open {PanZoomDialog}
@@ -827,6 +835,7 @@ proc ProcessOrientCmd {varname iname} {
}
}
}
+}
proc ProcessSendOrientCmd {proc id param} {
global current
@@ -840,6 +849,14 @@ proc ProcessRotateCmd {varname iname} {
# we need to be realized
ProcessRealizeDS9
+ global debug
+ if {$debug(tcl,parser)} {
+ rotate::YY_FLUSH_BUFFER
+ rotate::yy_scan_string [lrange $var $i end]
+ rotate::yyparse
+ incr i [expr $rotate::yycnt-1]
+ } else {
+
global current
switch -- [string tolower [lindex $var $i]] {
open {PanZoomDialog}
@@ -852,6 +869,7 @@ proc ProcessRotateCmd {varname iname} {
default {Rotate [lindex $var $i]}
}
}
+}
proc ProcessSendRotateCmd {proc id param} {
global current
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index a9eccf3..145fa01 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -240,6 +240,10 @@ source $ds9(root)/library/nanparser.tcl
source $ds9(root)/library/nanlex.tcl
source $ds9(root)/library/nvssparser.tcl
source $ds9(root)/library/nvsslex.tcl
+source $ds9(root)/library/orientparser.tcl
+source $ds9(root)/library/orientlex.tcl
+source $ds9(root)/library/rotateparser.tcl
+source $ds9(root)/library/rotatelex.tcl
source $ds9(root)/library/panparser.tcl
source $ds9(root)/library/panlex.tcl
source $ds9(root)/library/plotparser.tcl
diff --git a/ds9/parsers/orientlex.fcl b/ds9/parsers/orientlex.fcl
new file mode 100644
index 0000000..65b0253
--- /dev/null
+++ b/ds9/parsers/orientlex.fcl
@@ -0,0 +1,17 @@
+#tab orientparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+close {return $CLOSE_}
+none {return $NONE_}
+open {return $OPEN_}
+xy {return $XY_}
+
+#include string.fin
+
+%%
diff --git a/ds9/parsers/orientparser.tac b/ds9/parsers/orientparser.tac
new file mode 100644
index 0000000..0b5f0bb
--- /dev/null
+++ b/ds9/parsers/orientparser.tac
@@ -0,0 +1,40 @@
+%{
+%}
+
+#include string.tin
+
+%start command
+
+%token CLOSE_
+%token NONE_
+%token OPEN_
+%token XY_
+
+%%
+
+command : orient
+ | orient {yyclearin; YYACCEPT} STRING_
+ ;
+
+orient : orientation {CurrentCmdSet orient $1 ChangeOrient}
+ | OPEN_ {PanZoomDialog}
+ | CLOSE_ {PanZoomDestroyDialog}
+ ;
+
+orientation : NONE_ {set _ none}
+ | 'x' {set _ x}
+ | 'X' {set _ x}
+ | 'y' {set _ y}
+ | 'Y' {set _ y}
+ | XY_ {set _ xy}
+ ;
+
+%%
+
+proc orient::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
diff --git a/ds9/parsers/rotatelex.fcl b/ds9/parsers/rotatelex.fcl
new file mode 100644
index 0000000..633dfcf
--- /dev/null
+++ b/ds9/parsers/rotatelex.fcl
@@ -0,0 +1,17 @@
+#tab rotateparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+close {return $CLOSE_}
+open {return $OPEN_}
+to {return $TO_}
+
+#include numeric.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/rotateparser.tac b/ds9/parsers/rotateparser.tac
new file mode 100644
index 0000000..e9d81df
--- /dev/null
+++ b/ds9/parsers/rotateparser.tac
@@ -0,0 +1,35 @@
+%{
+%}
+
+#include numeric.tin
+#include string.tin
+
+%start command
+
+%token CLOSE_
+%token OPEN_
+%token TO_
+
+%%
+
+#include numeric.trl
+
+command : rotate
+ | rotate {yyclearin; YYACCEPT} STRING_
+ ;
+
+rotate : numeric {Rotate $1}
+ | TO_ numeric {CurrentCmdSet rotate $2 ChangeRotate}
+ | OPEN_ {PanZoomDialog}
+ | CLOSE_ {PanZoomDestroyDialog}
+ ;
+
+%%
+
+proc rotate::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
diff --git a/ds9/parsers/zoomparser.tac b/ds9/parsers/zoomparser.tac
index df3f7a1..2585324 100644
--- a/ds9/parsers/zoomparser.tac
+++ b/ds9/parsers/zoomparser.tac
@@ -21,7 +21,6 @@ command : zoom
| zoom {yyclearin; YYACCEPT} STRING_
;
-
zoom : OPEN_ {PanZoomDialog}
| CLOSE_ {PanZoomDestroyDialog}
| IN_ {Zoom 2 2}