diff options
-rw-r--r-- | ds9/library/mecube.tcl | 33 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/mecubelex.fcl | 16 | ||||
-rw-r--r-- | ds9/parsers/mecubeparser.tac | 36 |
4 files changed, 87 insertions, 0 deletions
diff --git a/ds9/library/mecube.tcl b/ds9/library/mecube.tcl index 4523239..3c08660 100644 --- a/ds9/library/mecube.tcl +++ b/ds9/library/mecube.tcl @@ -81,6 +81,18 @@ proc ProcessMECubeCmd {varname iname sock fn} { upvar $varname var upvar $iname i + global debug + if {$debug(tcl,parser)} { + global mecube + set mecube(load,sock) $sock + set mecube(load,fn) $fn + + mecube::YY_FLUSH_BUFFER + mecube::yy_scan_string [lrange $var $i end] + mecube::yyparse + incr i [expr $mecube::yycnt-1] + } else { + switch -- [string tolower [lindex $var $i]] { new { incr i @@ -113,6 +125,27 @@ proc ProcessMECubeCmd {varname iname sock fn} { } FinishLoad } +} + +proc MECubeCmdLoad {param} { + global mecube + + if {$mecube(load,sock) != {}} { + # xpa + if {![LoadMECubeSocket $mecube(load,sock) $param]} { + InitError xpa + LoadMECubeFile $param + } + } else { + # comm + if {$mecube(load,fn) != {}} { + LoadMECubeAlloc $mecube(load,fn) $param + } else { + LoadMECubeFile $param + } + } + FinishLoad +} proc ProcessSendMECubeCmd {proc id param sock fn} { global current diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 24364f2..91624db 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -250,6 +250,8 @@ source $ds9(root)/library/maskparser.tcl source $ds9(root)/library/masklex.tcl source $ds9(root)/library/matchparser.tcl source $ds9(root)/library/matchlex.tcl +source $ds9(root)/library/mecubeparser.tcl +source $ds9(root)/library/mecubelex.tcl source $ds9(root)/library/minmaxparser.tcl source $ds9(root)/library/minmaxlex.tcl source $ds9(root)/library/modeparser.tcl diff --git a/ds9/parsers/mecubelex.fcl b/ds9/parsers/mecubelex.fcl new file mode 100644 index 0000000..ad9d44a --- /dev/null +++ b/ds9/parsers/mecubelex.fcl @@ -0,0 +1,16 @@ +#tab mecubeparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +mask {return $MASK_} +new {return $NEW_} +slice {return $SLICE_} + +#include string.fin + +%% diff --git a/ds9/parsers/mecubeparser.tac b/ds9/parsers/mecubeparser.tac new file mode 100644 index 0000000..cb4b8ff --- /dev/null +++ b/ds9/parsers/mecubeparser.tac @@ -0,0 +1,36 @@ +%{ +%} + +#include string.tin + +%start command + +%token MASK_ +%token NEW_ +%token SLICE_ + +%% + +command : mecube + | mecube {yyclearin; YYACCEPT} STRING_ + ; + +mecube : opts {MECubeCmdLoad {}} + | opts STRING_ {MECubeCmdLoad $2} + ; + +opts : + | NEW_ {CreateFrame} + | MASK_ + | SLICE_ + ; + +%% + +proc mecube::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |