summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ds9/library/print.tcl17
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/parsers/pssendlex.fcl20
-rw-r--r--ds9/parsers/pssendparser.tac34
4 files changed, 62 insertions, 11 deletions
diff --git a/ds9/library/print.tcl b/ds9/library/print.tcl
index 953e410..cab7933 100644
--- a/ds9/library/print.tcl
+++ b/ds9/library/print.tcl
@@ -587,16 +587,11 @@ proc ProcessPSPrintCmd {varname iname} {
}
proc ProcessSendPSPrintCmd {proc id param {sock {}} {fn {}}} {
- global ps
+ global parse
+ set parse(proc) $proc
+ set parse(id) $id
- switch -- [string tolower $param] {
- destination {$proc $id "$ps(dest)\n"}
- command {$proc $id "$ps(cmd)\n"}
- filename {$proc $id "$ps(filename)\n"}
- palette -
- color {$proc $id "$ps(color)\n"}
- level {$proc $id "$ps(level)\n"}
- interpolate {$proc $id "0\n"}
- resolution {$proc $id "$ps(resolution)\n"}
- }
+ pssend::YY_FLUSH_BUFFER
+ pssend::yy_scan_string $param
+ pssend::yyparse
}
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index e6e75e4..810c0db 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -340,6 +340,8 @@ source $ds9(root)/library/preserveparser.tcl
source $ds9(root)/library/preservelex.tcl
source $ds9(root)/library/psparser.tcl
source $ds9(root)/library/pslex.tcl
+source $ds9(root)/library/pssendparser.tcl
+source $ds9(root)/library/pssendlex.tcl
source $ds9(root)/library/regionparser.tcl
source $ds9(root)/library/regionlex.tcl
source $ds9(root)/library/regionsendparser.tcl
diff --git a/ds9/parsers/pssendlex.fcl b/ds9/parsers/pssendlex.fcl
new file mode 100644
index 0000000..4b68654
--- /dev/null
+++ b/ds9/parsers/pssendlex.fcl
@@ -0,0 +1,20 @@
+#tab pssendparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+color {return $COLOR_}
+command {return $COMMAND_}
+destination {return $DESTINATION_}
+filename {return $FILENAME_}
+interpolate {return $INTERPOLATE_}
+level {return $LEVEL_}
+resolution {return $RESOLUTION_}
+
+#include ws.fin
+
+%%
diff --git a/ds9/parsers/pssendparser.tac b/ds9/parsers/pssendparser.tac
new file mode 100644
index 0000000..7a84beb
--- /dev/null
+++ b/ds9/parsers/pssendparser.tac
@@ -0,0 +1,34 @@
+%{
+%}
+
+%start pssend
+
+%token COLOR_
+%token COMMAND_
+%token DESTINATION_
+%token FILENAME_
+%token INTERPOLATE_
+%token LEVEL_
+%token RESOLUTION_
+
+%%
+
+pssend : DESTINATION_ {ProcessSendCmdGet ps dest}
+ | COMMAND_ {ProcessSendCmdGet ps cmd}
+ | FILENAME_ {ProcessSendCmdGet ps filename}
+ | COLOR_ {ProcessSendCmdGet ps color}
+ | LEVEL_ {ProcessSendCmdGet ps level}
+ | RESOLUTION_ {ProcessSendCmdGet ps resolution}
+#backward compatibility
+ | INTERPOLATE_ {global ps; $parse(proc) $parse(id) "0\n"}
+ ;
+
+%%
+
+proc pssend::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}