From 2c8f85e6ec1aa94588df630d810ff9b1e25b3f10 Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 7 Jun 2018 13:38:55 -0400 Subject: add ds9 threed send parser --- ds9/library/3d.tcl | 35 +++++--------------------- ds9/library/source.tcl | 2 ++ ds9/parsers/binsendlex.fcl | 1 + ds9/parsers/threedsendlex.fcl | 28 +++++++++++++++++++++ ds9/parsers/threedsendparser.tac | 54 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 91 insertions(+), 29 deletions(-) create mode 100644 ds9/parsers/threedsendlex.fcl create mode 100644 ds9/parsers/threedsendparser.tac diff --git a/ds9/library/3d.tcl b/ds9/library/3d.tcl index 85ef8eb..2a9aa0b 100644 --- a/ds9/library/3d.tcl +++ b/ds9/library/3d.tcl @@ -472,34 +472,11 @@ proc Process3DCmd {varname iname} { } proc ProcessSend3DCmd {proc id param {sock {}} {fn {}}} { - global threed + global parse + set parse(proc) $proc + set parse(id) $id - switch -- [string tolower [lindex $param 0]] { - az {$proc $id "$threed(az)\n"} - el {$proc $id "$threed(el)\n"} - view - - vp {$proc $id "$threed(az) $threed(el)\n"} - scale {$proc $id "$threed(scale)\n"} - method {$proc $id "$threed(method)\n"} - background {$proc $id "$threed(background)\n"} - lock {$proc $id [ToYesNo $threed(lock)]} - highlite { - switch [string tolower [lindex $param 1]] { - color {$proc $id "$threed(highlite,color)\n"} - default {$proc $id [ToYesNo $threed(highlite)]} - } - } - border { - switch [string tolower [lindex $param 1]] { - color {$proc $id "$threed(border,color)\n"} - default {$proc $id [ToYesNo $threed(border)]} - } - } - compass { - switch [string tolower [lindex $param 1]] { - color {$proc $id "$threed(compass,color)\n"} - default {$proc $id [ToYesNo $threed(compass)]} - } - } - } + threedsend::YY_FLUSH_BUFFER + threedsend::yy_scan_string $param + threedsend::yyparse } diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 2867569..5a2ddc1 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -378,6 +378,8 @@ source $ds9(root)/library/threadsparser.tcl source $ds9(root)/library/threadslex.tcl source $ds9(root)/library/threedparser.tcl source $ds9(root)/library/threedlex.tcl +source $ds9(root)/library/threedsendparser.tcl +source $ds9(root)/library/threedsendlex.tcl source $ds9(root)/library/tileparser.tcl source $ds9(root)/library/tilelex.tcl source $ds9(root)/library/twomassparser.tcl diff --git a/ds9/parsers/binsendlex.fcl b/ds9/parsers/binsendlex.fcl index 712f9e5..1f25d03 100644 --- a/ds9/parsers/binsendlex.fcl +++ b/ds9/parsers/binsendlex.fcl @@ -17,4 +17,5 @@ function {return $FUNCTION_} lock {return $LOCK_} #include string.fin + %% diff --git a/ds9/parsers/threedsendlex.fcl b/ds9/parsers/threedsendlex.fcl new file mode 100644 index 0000000..61ff179 --- /dev/null +++ b/ds9/parsers/threedsendlex.fcl @@ -0,0 +1,28 @@ +#tab threedsendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +az {return $AZ_} +azimuth {return $AZ_} +background {return $BG_} +bg {return $BG_} +border {return $BORDER_} +color {return $COLOR_} +compass {return $COMPASS_} +el {return $EL_} +elevation {return $EL_} +highlite {return $HIGHLITE_} +lock {return $LOCK_} +method {return $METHOD_} +scale {return $SCALE_} +view {return $VIEW_} +vp {return $VIEW_} + +#include string.fin + +%% diff --git a/ds9/parsers/threedsendparser.tac b/ds9/parsers/threedsendparser.tac new file mode 100644 index 0000000..941bf5c --- /dev/null +++ b/ds9/parsers/threedsendparser.tac @@ -0,0 +1,54 @@ +%{ +%} + +#include string.tin + +%start threedsend + +%token AZ_ +%token BG_ +%token BORDER_ +%token COLOR_ +%token COMPASS_ +%token EL_ +%token HIGHLITE_ +%token LOCK_ +%token METHOD_ +%token SCALE_ +%token VIEW_ + +%% + +threedsend : AZ_ {ProcessSendCmdGet threed az} + | EL_ {ProcessSendCmdGet threed el} + | VIEW_ {ProcessSendCmdGet2 threed az el} + | SCALE_ {ProcessSendCmdGet threed scale} + | METHOD_ {ProcessSendCmdGet threed method} + | BG_ {ProcessSendCmdGet threed background} + | LOCK_ {ProcessSendCmdYesNo threed lock} + | HIGHLITE_ highlite + | BORDER_ border + | COMPASS_ compass + ; + +highlite: {ProcessSendCmdYesNo threed highlite} + | COLOR_ {ProcessSendCmdGet threed highlite,color} + ; + +border: {ProcessSendCmdYesNo threed border} + | COLOR_ {ProcessSendCmdGet threed border,color} + ; + +compass: {ProcessSendCmdYesNo threed compass} + | COLOR_ {ProcessSendCmdGet threed compass,color} + ; + +%% + +proc threedsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12