From adbf89acf2d2393e65f78481838a72fc6fbcc35c Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 31 May 2018 17:32:01 -0400 Subject: add ds9 parser grid send --- ds9/library/grid.tcl | 12 ++- ds9/library/source.tcl | 2 + ds9/parsers/gridsendlex.fcl | 52 +++++++++++++ ds9/parsers/gridsendparser.tac | 167 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 ds9/parsers/gridsendlex.fcl create mode 100644 ds9/parsers/gridsendparser.tac diff --git a/ds9/library/grid.tcl b/ds9/library/grid.tcl index ac32009..d7ecac5 100644 --- a/ds9/library/grid.tcl +++ b/ds9/library/grid.tcl @@ -1170,8 +1170,17 @@ proc GridCmdFontStyle {which value {cmd {}}} { } proc ProcessSendGridCmd {proc id param {sock {}} {fn {}}} { - global grid + if {1} { + global parse + set parse(proc) $proc + set parse(id) $id + + gridsend::YY_FLUSH_BUFFER + gridsend::yy_scan_string $param + gridsend::yyparse + } else { + global grid switch -- [lindex $param 0] { type { switch -- [lindex $param 1] { @@ -1336,3 +1345,4 @@ proc ProcessSendGridCmd {proc id param {sock {}} {fn {}}} { default {$proc $id [ToYesNo $grid(view)]} } } +} diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 7000b33..fdb40b9 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -238,6 +238,8 @@ source $ds9(root)/library/frameparser.tcl source $ds9(root)/library/framelex.tcl source $ds9(root)/library/gridparser.tcl source $ds9(root)/library/gridlex.tcl +source $ds9(root)/library/gridsendparser.tcl +source $ds9(root)/library/gridsendlex.tcl source $ds9(root)/library/headerparser.tcl source $ds9(root)/library/headerlex.tcl source $ds9(root)/library/heightparser.tcl diff --git a/ds9/parsers/gridsendlex.fcl b/ds9/parsers/gridsendlex.fcl new file mode 100644 index 0000000..eadbb27 --- /dev/null +++ b/ds9/parsers/gridsendlex.fcl @@ -0,0 +1,52 @@ +#tab gridsendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +axes {return $AXES_} +border {return $BORDER_} +color {return $COLOR_} +dash {return $DASH_} +def {return $DEF_} +def1 {return $DEF1_} +def2 {return $DEF2_} +format1 {return $FORMAT1_} +format2 {return $FORMAT2_} +gap {return $GAP_} +gap1 {return $GAP1_} +gap2 {return $GAP2_} +gap3 {return $GAP3_} +grid {return $GRID_} +label {return $LABELS_} +labels {return $LABELS_} +textlab {return $LABELS_} +numlab {return $NUMERICS_} +numbers {return $NUMBERS_} +numeric {return $NUMERICS_} +numerics {return $NUMERICS_} +origin {return $ORIGIN_} +sky {return $SKYFRAME_} +skyframe {return $SKYFRAME_} +skyformat {return $SKYFORMAT_} +style {return $STYLE_} +system {return $SYSTEM_} +text {return $TEXT_} +text1 {return $TEXT1_} +text2 {return $TEXT2_} +tick {return $TICKMARKS_} +tickmark {return $TICKMARKS_} +tickmarks {return $TICKMARKS_} +title {return $TITLE_} +type {return $TYPE_} +vertical {return $VERTICAL_} +view {return $VIEW_} +width {return $WIDTH_} + +#include font.fin +#include string.fin + +%% diff --git a/ds9/parsers/gridsendparser.tac b/ds9/parsers/gridsendparser.tac new file mode 100644 index 0000000..769c824 --- /dev/null +++ b/ds9/parsers/gridsendparser.tac @@ -0,0 +1,167 @@ +%{ +%} + +#include font.tin +#include string.tin + +%token AXES_ +%token BORDER_ +%token COLOR_ +%token DASH_ +%token DEF_ +%token DEF1_ +%token DEF2_ +%token FORMAT1_ +%token FORMAT2_ +%token GAP_ +%token GAP1_ +%token GAP2_ +%token GAP3_ +%token GRID_ +%token LABELS_ +%token NUMBERS_ +%token NUMERICS_ +%token ORIGIN_ +%token SKYFRAME_ +%token SKYFORMAT_ +%token STYLE_ +%token SYSTEM_ +%token TEXT_ +%token TEXT1_ +%token TEXT2_ +%token TICKMARKS_ +%token TITLE_ +%token TYPE_ +%token VERTICAL_ +%token WIDTH_ +%token VIEW_ + +%% + +gridsend : {ProcessSendCmdYesNo grid view} + | TYPE_ type + | SYSTEM_ {ProcessSendCmdGet grid system} + | SKYFRAME_ {ProcessSendCmdGet grid sky} + | SKYFORMAT_ {ProcessSendCmdGet grid skyformat} + | GRID_ grid + | AXES_ axes + | FORMAT1_ {ProcessSendCmdGet grid format1} + | FORMAT2_ {ProcessSendCmdGet grid format2} + | TICKMARKS_ tickmarks + | BORDER_ border + | NUMERICS_ numerics + | TITLE_ title + | LABELS_ labels +# backward compatibility + | VIEW_ view + ; + +type : {ProcessSendCmdGet grid type} +# backward compatibility + | AXES_ {ProcessSendCmdGet grid axis,type} +# backward compatibility + | NUMERICS_ {ProcessSendCmdGet grid numlab,type} + ; + +grid : {ProcessSendCmdYesNo grid grid} + | COLOR_ {ProcessSendCmdGet grid grid,color} + | WIDTH_ {ProcessSendCmdGet grid grid,width} + | DASH_ {ProcessSendCmdYesNo grid grid,style} + | STYLE_ {ProcessSendCmdGet grid grid,style} + | GAP1_ {ProcessSendCmdGet grid grid,gap1} + | GAP2_ {ProcessSendCmdGet grid grid,gap2} + | GAP3_ {ProcessSendCmdGet grid grid,gap3} + ; + +axes: {ProcessSendCmdYesNo grid axes} + | COLOR_ {ProcessSendCmdGet grid axes,color} + | WIDTH_ {ProcessSendCmdGet grid axes,width} + | DASH_ {ProcessSendCmdYesNo grid axes,style} +# backward compatibility + | STYLE_ {ProcessSendCmdGet grid axes,style} + | TYPE_ {ProcessSendCmdGet grid axes,type} + | ORIGIN_ {ProcessSendCmdGet grid axes,origin} + ; + +tickmarks : {ProcessSendCmdYesNo grid tick} + | COLOR_ {ProcessSendCmdGet grid tick,color} + | WIDTH_ {ProcessSendCmdGet grid tick,width} + | DASH_ {ProcessSendCmdYesNo grid tick,style} +# backward compatibility + | STYLE_ {ProcessSendCmdGet grid tick,style} + ; + +border : {ProcessSendCmdYesNo grid border} + | COLOR_ {ProcessSendCmdGet grid border,color} + | WIDTH_ {ProcessSendCmdGet grid border,width} + | DASH_ {ProcessSendCmdYesNo grid border,style} +# backward compatibility + | STYLE_ {ProcessSendCmdGet grid border,style} + ; + +numerics : {ProcessSendCmdYesNo grid numlab} + | FONT_ {ProcessSendCmdGet grid numlab,font} + | FONTSIZE_ {ProcessSendCmdGet grid numlab,size} + | FONTWEIGHT_ {ProcessSendCmdGet grid numlab,weight} + | FONTSLANT_ {ProcessSendCmdGet grid numlab,slant} +# backward compatibility + | FONTSTYLE_ {ProcessSendCmdGet grid numlab,weight} + | COLOR_ {ProcessSendCmdGet grid numlab,color} + | GAP1_ {ProcessSendCmdGet grid numlab,gap1} + | GAP2_ {ProcessSendCmdGet grid numlab,gap2} + | GAP3_ {ProcessSendCmdGet grid numlab,gap3} + | TYPE_ {ProcessSendCmdGet grid numlab,type} + | VERTICAL_ {ProcessSendCmdGet grid numlab,vertical} + ; + +title : {ProcessSendCmdYesNo grid title} + | TEXT_ {ProcessSendCmdGet grid title,text} + | DEF_ {ProcessSendCmdYesNo grid title,def} + | GAP_ {ProcessSendCmdGet grid title,gap} + | FONT_ {ProcessSendCmdGet grid title,font} + | FONTSIZE_ {ProcessSendCmdGet grid title,size} + | FONTWEIGHT_ {ProcessSendCmdGet grid title,weight} + | FONTSLANT_ {ProcessSendCmdGet grid title,slant} +# backward compatibility + | FONTSTYLE_ {ProcessSendCmdGet grid title,weight} + | COLOR_ {ProcessSendCmdGet grid title,color} + ; + +labels : {ProcessSendCmdYesNo grid textlab} + | TEXT1_ {ProcessSendCmdGet grid textlab,text1} + | TEXT2_ {ProcessSendCmdGet grid textlab,text2} + | DEF1_ {ProcessSendCmdYesNo grid textlab,def1} + | DEF2_ {ProcessSendCmdYesNo grid textlab,def2} + | GAP1_ {ProcessSendCmdGet grid textlab,gap1} + | GAP2_ {ProcessSendCmdGet grid textlab,gap2} + | FONT_ {ProcessSendCmdGet grid textlab,font} + | FONTSIZE_ {ProcessSendCmdGet grid textlab,size} + | FONTWEIGHT_ {ProcessSendCmdGet grid textlab,weight} + | FONTSLANT_ {ProcessSendCmdGet grid textlab,slant} +# backward compatibility + | FONTSTYLE_ {ProcessSendCmdGet grid textlab,weight} + | COLOR_ {ProcessSendCmdGet grid textlab,color} + ; + +view : GRID_ {ProcessSendCmdYesNo grid grid} + | AXES_ viewaxes + | TITLE_ {ProcessSendCmdYesNo grid title} + | BORDER_ {ProcessSendCmdYesNo grid border} + | VERTICAL_ {ProcessSendCmdYesNo grid numlab,vertical} + ; + +viewaxes : {ProcessSendCmdYesNo grid axes} + | NUMBERS_ {ProcessSendCmdYesNo grid numlab} + | TICKMARKS_ {ProcessSendCmdYesNo grid tick} + | LABELS_ {ProcessSendCmdYesNo grid textlab} + ; + +%% + +proc gridsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12