diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-05-08 18:13:16 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-05-08 18:13:16 (GMT) |
commit | 86654caa76c90695a985bb5f0dbbcc683411354e (patch) | |
tree | 5e81f198826578589f9a5126af8319108a139352 | |
parent | e95361dcf0ecd4af0011315ad839e1076c80ed66 (diff) | |
download | blt-86654caa76c90695a985bb5f0dbbcc683411354e.zip blt-86654caa76c90695a985bb5f0dbbcc683411354e.tar.gz blt-86654caa76c90695a985bb5f0dbbcc683411354e.tar.bz2 |
add ds9 width/height parsers
-rw-r--r-- | ds9/library/layout.tcl | 27 | ||||
-rw-r--r-- | ds9/library/source.tcl | 4 | ||||
-rw-r--r-- | ds9/parsers/heightlex.fcl | 13 | ||||
-rw-r--r-- | ds9/parsers/heightparser.tac | 28 | ||||
-rw-r--r-- | ds9/parsers/widthlex.fcl | 13 | ||||
-rw-r--r-- | ds9/parsers/widthparser.tac | 28 |
6 files changed, 113 insertions, 0 deletions
diff --git a/ds9/library/layout.tcl b/ds9/library/layout.tcl index ea30ef3..f026b52 100644 --- a/ds9/library/layout.tcl +++ b/ds9/library/layout.tcl @@ -810,6 +810,15 @@ proc ViewVertCmd {} { # Process Cmds +proc CanvasCmdSet {which value {cmd {}}} { + global canvas + + set canvas($which) $value + if {$cmd != {}} { + eval $cmd + } +} + proc ProcessHeightCmd {varname iname} { upvar $varname var upvar $iname i @@ -818,10 +827,19 @@ proc ProcessHeightCmd {varname iname} { # can't use ProcessRealize RealizeDS9 + global debug + if {$debug(tcl,parser)} { + height::YY_FLUSH_BUFFER + height::yy_scan_string [lrange $var $i end] + height::yyparse + incr i [expr $height::yycnt-1] + } else { + global canvas set canvas(height) [lindex $var $i] UpdateView } +} proc ProcessSendHeightCmd {proc id param} { global canvas @@ -836,10 +854,19 @@ proc ProcessWidthCmd {varname iname} { # can't use ProcessRealize RealizeDS9 + global debug + if {$debug(tcl,parser)} { + width::YY_FLUSH_BUFFER + width::yy_scan_string [lrange $var $i end] + width::yyparse + incr i [expr $width::yycnt-1] + } else { + global canvas set canvas(width) [lindex $var $i] UpdateView } +} proc ProcessSendWidthCmd {proc id param} { global canvas diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index b4b8386..6e6bf58 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -234,6 +234,8 @@ source $ds9(root)/library/gridparser.tcl source $ds9(root)/library/gridlex.tcl source $ds9(root)/library/headerparser.tcl source $ds9(root)/library/headerlex.tcl +source $ds9(root)/library/heightparser.tcl +source $ds9(root)/library/heightlex.tcl source $ds9(root)/library/lockparser.tcl source $ds9(root)/library/locklex.tcl source $ds9(root)/library/magnifierparser.tcl @@ -296,6 +298,8 @@ source $ds9(root)/library/voparser.tcl source $ds9(root)/library/volex.tcl source $ds9(root)/library/wcsparser.tcl source $ds9(root)/library/wcslex.tcl +source $ds9(root)/library/widthparser.tcl +source $ds9(root)/library/widthlex.tcl source $ds9(root)/library/xpaparser.tcl source $ds9(root)/library/xpalex.tcl source $ds9(root)/library/xpafirstparser.tcl diff --git a/ds9/parsers/heightlex.fcl b/ds9/parsers/heightlex.fcl new file mode 100644 index 0000000..49bf3fd --- /dev/null +++ b/ds9/parsers/heightlex.fcl @@ -0,0 +1,13 @@ +#tab heightparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/heightparser.tac b/ds9/parsers/heightparser.tac new file mode 100644 index 0000000..c9fdc5c --- /dev/null +++ b/ds9/parsers/heightparser.tac @@ -0,0 +1,28 @@ +%{ +%} + +#include numeric.tin +#include string.tin + +%start command + +%% + +#include numeric.trl + +command : height + | height {yyclearin; YYACCEPT} STRING_ + ; + +height : INT_ {CanvasCmdSet height $1 UpdateView} + ; + +%% + +proc height::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/widthlex.fcl b/ds9/parsers/widthlex.fcl new file mode 100644 index 0000000..665274e --- /dev/null +++ b/ds9/parsers/widthlex.fcl @@ -0,0 +1,13 @@ +#tab widthparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/widthparser.tac b/ds9/parsers/widthparser.tac new file mode 100644 index 0000000..b7d03df --- /dev/null +++ b/ds9/parsers/widthparser.tac @@ -0,0 +1,28 @@ +%{ +%} + +#include numeric.tin +#include string.tin + +%start command + +%% + +#include numeric.trl + +command : width + | width {yyclearin; YYACCEPT} STRING_ + ; + +width : INT_ {CanvasCmdSet width $1 UpdateView} + ; + +%% + +proc width::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |