summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ds9/library/source.tcl4
-rw-r--r--ds9/library/xpa.tcl24
-rw-r--r--ds9/parsers/xpafirstlex.fcl25
-rw-r--r--ds9/parsers/xpafirstparser.tac54
-rw-r--r--ds9/parsers/xpalex.fcl25
-rw-r--r--ds9/parsers/xpaparser.tac54
6 files changed, 186 insertions, 0 deletions
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index a3fb0cf..dda0394 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -248,6 +248,10 @@ source $ds9(root)/library/vlssparser.tcl
source $ds9(root)/library/vlsslex.tcl
source $ds9(root)/library/wcsparser.tcl
source $ds9(root)/library/wcslex.tcl
+source $ds9(root)/library/xpaparser.tcl
+source $ds9(root)/library/xpalex.tcl
+source $ds9(root)/library/xpafirstparser.tcl
+source $ds9(root)/library/xpafirstlex.tcl
source $ds9(root)/library/zscaleparser.tcl
source $ds9(root)/library/zscalelex.tcl
source $ds9(root)/library/zoomparser.tcl
diff --git a/ds9/library/xpa.tcl b/ds9/library/xpa.tcl
index 6052eca..dc34a39 100644
--- a/ds9/library/xpa.tcl
+++ b/ds9/library/xpa.tcl
@@ -2205,6 +2205,14 @@ proc ProcessXPAFirstCmd {varname iname} {
upvar $varname var
upvar $iname i
+ global debug
+ if {$debug(tcl,parser)} {
+ xpafirst::YY_FLUSH_BUFFER
+ xpafirst::yy_scan_string [lrange $var $i end]
+ xpafirst::yyparse
+ incr i [expr $xpafirst::yycnt-1]
+ } else {
+
global ds9
global pds9
global env
@@ -2226,11 +2234,20 @@ proc ProcessXPAFirstCmd {varname iname} {
0 {set pds9(xpa) [FromYesNo [lindex $var $i]]}
}
}
+}
proc ProcessXPACmd {varname iname} {
upvar $varname var
upvar $iname i
+ global debug
+ if {$debug(tcl,parser)} {
+ xpa::YY_FLUSH_BUFFER
+ xpa::yy_scan_string [lrange $var $i end]
+ xpa::yyparse
+ incr i [expr $xpa::yycnt-1]
+ } else {
+
global ds9
global pds9
@@ -2245,6 +2262,13 @@ proc ProcessXPACmd {varname iname} {
info {XPAInfo}
}
}
+}
+
+proc XPACmdSet {varname which value} {
+ upvar #0 $varname var
+
+ set var($which) $value
+}
proc ProcessSendXPACmd {proc id param} {
switch -- [string tolower [lindex $param 0]] {
diff --git a/ds9/parsers/xpafirstlex.fcl b/ds9/parsers/xpafirstlex.fcl
new file mode 100644
index 0000000..0ba673b
--- /dev/null
+++ b/ds9/parsers/xpafirstlex.fcl
@@ -0,0 +1,25 @@
+#tab xpaparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+close {return $CLOSE_}
+connect {return $CONNECT_}
+disconnect {return $DISCONNECT_}
+inet {return $INET_}
+info {return $INFO_}
+local {return $LOCAL_}
+localhost {return $LOCALHOST_}
+noxpans {return $NOXPANS_}
+tcl {return $TCL_}
+unix {return $UNIX_}
+
+#include yesno.fin
+#include numeric.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/xpafirstparser.tac b/ds9/parsers/xpafirstparser.tac
new file mode 100644
index 0000000..85c6cd4
--- /dev/null
+++ b/ds9/parsers/xpafirstparser.tac
@@ -0,0 +1,54 @@
+%{
+%}
+
+#include yesno.tin
+#include numeric.tin
+#include string.tin
+
+%start command
+
+%token CONNECT_
+%token DISCONNECT_
+%token INET_
+%token INFO_
+%token LOCAL_
+%token LOCALHOST_
+%token NOXPANS_
+%token TCL_
+%token UNIX_
+
+%%
+
+#include yesno.trl
+#include numeric.trl
+
+command : xpa
+ | xpa {yyclearin; YYACCEPT} STRING_
+ ;
+
+xpa : yesno {XPACmdSet pds9 xpa $1}
+ | method {XPACmdSet env XPA_METHOD $1}
+ | NOXPANS_ {XPACmdSet env XPA_NSREGISTER false}
+
+| CONNECT_
+ | DISCONNECT_
+ | INFO_
+# backward compatibility
+ | TCL_ # do nothing
+ ;
+
+method : UNIX_ {set _ unix}
+ | INET_ {set _ inet}
+ | LOCAL_ {set _ local}
+ | LOCALHOST_ {set _ localhost}
+ ;
+
+%%
+
+proc xpa::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
diff --git a/ds9/parsers/xpalex.fcl b/ds9/parsers/xpalex.fcl
new file mode 100644
index 0000000..0ba673b
--- /dev/null
+++ b/ds9/parsers/xpalex.fcl
@@ -0,0 +1,25 @@
+#tab xpaparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+close {return $CLOSE_}
+connect {return $CONNECT_}
+disconnect {return $DISCONNECT_}
+inet {return $INET_}
+info {return $INFO_}
+local {return $LOCAL_}
+localhost {return $LOCALHOST_}
+noxpans {return $NOXPANS_}
+tcl {return $TCL_}
+unix {return $UNIX_}
+
+#include yesno.fin
+#include numeric.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/xpaparser.tac b/ds9/parsers/xpaparser.tac
new file mode 100644
index 0000000..944a29f
--- /dev/null
+++ b/ds9/parsers/xpaparser.tac
@@ -0,0 +1,54 @@
+%{
+%}
+
+#include yesno.tin
+#include numeric.tin
+#include string.tin
+
+%start command
+
+%token CONNECT_
+%token DISCONNECT_
+%token INET_
+%token INFO_
+%token LOCAL_
+%token LOCALHOST_
+%token NOXPANS_
+%token TCL_
+%token UNIX_
+
+%%
+
+#include yesno.trl
+#include numeric.trl
+
+command : xpa
+ | xpa {yyclearin; YYACCEPT} STRING_
+ ;
+
+xpa : yesno
+ | method
+ | NOXPANS_
+
+| CONNECT_ {XPAConnect}
+ | DISCONNECT_ {XPADisconnect}
+ | INFO_ {XPAInfo}
+# backward compatibility
+ | TCL_ # do nothing
+ ;
+
+method : UNIX_ {set _ unix}
+ | INET_ {set _ inet}
+ | LOCAL_ {set _ local}
+ | LOCALHOST_ {set _ localhost}
+ ;
+
+%%
+
+proc xpa::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}