summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-05-08 20:40:25 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-05-08 20:40:25 (GMT)
commit00025e4e4f0b0469fc6c3bd5ffb4ef3e457fd30f (patch)
treee4c286837d11a258ac251c2ffa8f19da0c3a3d26
parentc052962410047d3b2a444b693f7c3bd678b539ed (diff)
downloadblt-00025e4e4f0b0469fc6c3bd5ffb4ef3e457fd30f.zip
blt-00025e4e4f0b0469fc6c3bd5ffb4ef3e457fd30f.tar.gz
blt-00025e4e4f0b0469fc6c3bd5ffb4ef3e457fd30f.tar.bz2
add ds9 sleep parser
-rw-r--r--ds9/library/frame.tcl35
-rw-r--r--ds9/library/source.tcl6
-rw-r--r--ds9/library/util.tcl9
-rw-r--r--ds9/parsers/frameparser.tac6
-rw-r--r--ds9/parsers/sleeplex.fcl13
-rw-r--r--ds9/parsers/sleepparser.tac29
6 files changed, 63 insertions, 35 deletions
diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl
index 85fa0fd..2d13398 100644
--- a/ds9/library/frame.tcl
+++ b/ds9/library/frame.tcl
@@ -2219,28 +2219,13 @@ proc ProcessFrameCmd {varname iname} {
}
}
-proc FrameCmdHideCurrent {} {
- global active
- global current
-
- set active($current(frame)) 0
- UpdateActiveFrames
-}
-
-proc FrameCmdHide {which} {
- global active
-
- set ff "Frame$which"
- set active($ff) 0
- UpdateActiveFrames
-}
-
-proc FrameCmdShow {which} {
+proc ActiveCmdSet {which value {cmd {}}} {
global active
- set ff "Frame$which"
- set active($ff) 1
- UpdateActiveFrames
+ set active($which) $value
+ if {$cmd != {}} {
+ eval $cmd
+ }
}
proc CurrentCmdSet {which value {cmd {}}} {
@@ -2252,16 +2237,6 @@ proc CurrentCmdSet {which value {cmd {}}} {
}
}
-proc CurrentCmdDisplay {which} {
- global current
-
- if {$which} {
- set current(display) blink
- } else {
- set current(display) single
- }
-}
-
proc ProcessSendFrameCmd {proc id param} {
global ds9
global current
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index 304f996..f70f0e1 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -282,12 +282,14 @@ source $ds9(root)/library/saveparser.tcl
source $ds9(root)/library/savelex.tcl
source $ds9(root)/library/saveimageparser.tcl
source $ds9(root)/library/saveimagelex.tcl
-source $ds9(root)/library/siaparser.tcl
-source $ds9(root)/library/sialex.tcl
source $ds9(root)/library/scaleparser.tcl
source $ds9(root)/library/scalelex.tcl
+source $ds9(root)/library/siaparser.tcl
+source $ds9(root)/library/sialex.tcl
source $ds9(root)/library/skyviewparser.tcl
source $ds9(root)/library/skyviewlex.tcl
+source $ds9(root)/library/sleepparser.tcl
+source $ds9(root)/library/sleeplex.tcl
source $ds9(root)/library/smoothparser.tcl
source $ds9(root)/library/smoothlex.tcl
source $ds9(root)/library/threedparser.tcl
diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl
index 6c6c709..dfb7991 100644
--- a/ds9/library/util.tcl
+++ b/ds9/library/util.tcl
@@ -1629,6 +1629,14 @@ proc ProcessSleepCmd {varname iname} {
UpdateDS9
RealizeDS9
+ global debug
+ if {$debug(tcl,parser)} {
+ sleep::YY_FLUSH_BUFFER
+ sleep::yy_scan_string [lrange $var $i end]
+ sleep::yyparse
+ incr i [expr $sleep::yycnt-1]
+ } else {
+
set sec 1
if {[lindex $var $i] != {} && [string range [lindex $var $i] 0 0] != {-}} {
set sec [lindex $var $i]
@@ -1637,6 +1645,7 @@ proc ProcessSleepCmd {varname iname} {
}
after [expr int($sec*1000)]
}
+}
proc ProcessSourceCmd {varname iname} {
upvar $varname var
diff --git a/ds9/parsers/frameparser.tac b/ds9/parsers/frameparser.tac
index e636d73..82f9066 100644
--- a/ds9/parsers/frameparser.tac
+++ b/ds9/parsers/frameparser.tac
@@ -87,13 +87,13 @@ refresh : {UpdateCurrentFrame}
| ALL_ {UpdateAllFrame}
;
-hide : {FrameCmdHideCurrent}
- | INT_ {FrameCmdHide $1}
+hide : {global current; ActiveCmdSet $current(frame) 0 UpdateActiveFrames}
+ | INT_ {ActiveCmdSet "Frame$1" 0 UpdateActiveFrames}
| ALL_ {ActiveFrameNone}
;
show :
- | INT_ {FrameCmdShow $1}
+ | INT_ {ActiveCmdSet "Frame$1" 1 UpdateActiveFrames}
| ALL_ {ActiveFrameAll}
;
diff --git a/ds9/parsers/sleeplex.fcl b/ds9/parsers/sleeplex.fcl
new file mode 100644
index 0000000..3987b50
--- /dev/null
+++ b/ds9/parsers/sleeplex.fcl
@@ -0,0 +1,13 @@
+#tab sleepparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+#include numeric.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/sleepparser.tac b/ds9/parsers/sleepparser.tac
new file mode 100644
index 0000000..047d6bc
--- /dev/null
+++ b/ds9/parsers/sleepparser.tac
@@ -0,0 +1,29 @@
+%{
+%}
+
+#include numeric.tin
+#include string.tin
+
+%start command
+
+%%
+
+#include numeric.trl
+
+command : sleep
+ | sleep {yyclearin; YYACCEPT} STRING_
+ ;
+
+sleep : {after 1000}
+ | numeric {after [expr int($1*1000)]}
+ ;
+
+%%
+
+proc sleep::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}