diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-04-16 18:55:26 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-04-16 18:55:26 (GMT) |
commit | c19ffff9f651c480e0fddcf889189c27e099916b (patch) | |
tree | d67c1023e482628a8a3f12ee508980e47da777dd /ds9/library/sia.tcl | |
parent | 6789ffe9781b0b50525b2f71eca17709f5a1540e (diff) | |
download | blt-c19ffff9f651c480e0fddcf889189c27e099916b.zip blt-c19ffff9f651c480e0fddcf889189c27e099916b.tar.gz blt-c19ffff9f651c480e0fddcf889189c27e099916b.tar.bz2 |
add ds9 sia parser
Diffstat (limited to 'ds9/library/sia.tcl')
-rw-r--r-- | ds9/library/sia.tcl | 134 |
1 files changed, 122 insertions, 12 deletions
diff --git a/ds9/library/sia.tcl b/ds9/library/sia.tcl index 116f715..33f8570 100644 --- a/ds9/library/sia.tcl +++ b/ds9/library/sia.tcl @@ -292,7 +292,7 @@ proc SIATable {varname} { puts stderr "SIATable $varname" } - if {![CATValidDB $var(tbldb)]} { + if {![SIAValidDB $var(tbldb)]} { return } @@ -325,6 +325,38 @@ proc SIATable {varname} { } } +proc SIAValidDB {varname} { + upvar #0 $varname var + global $varname + + if {[info exists var(Nrows)] && + [info exists var(Ncols)] && + [info exists var(HLines)] && + [info exists var(Header)]} { + return 1 + } else { + return 0 + } +} + +proc SIASaveFn {varname fn writer} { + upvar #0 $varname var + global $varname + global $var(tbldb) + + if {$fn == {}} { + return + } + + # do we have a db? + if {![SIAValidDB $var(tbldb)]} { + return + } + + $writer $var(tbldb) $fn + ARDone $varname +} + # Process Cmds proc ProcessSIACmd {varname iname} { @@ -332,6 +364,8 @@ proc ProcessSIACmd {varname iname} { upvar $iname i global isia + # we need to be realized + ProcessRealizeDS9 global debug if {$debug(tcl,parser)} { @@ -345,10 +379,6 @@ proc ProcessSIACmd {varname iname} { incr i [expr $sia::yycnt-1] } else { - - # we need to be realized - ProcessRealizeDS9 - set item [string tolower [lindex $var $i]] switch -- $item { cancel - @@ -467,8 +497,8 @@ proc ProcessSIA {varname iname cvarname} { } set fn [lindex $var $i] - CATSaveFn $cvarname $fn $writer - FileLast catfbox $fn + SIASaveFn $cvarname $fn $writer + FileLast siafbox $fn } name { incr i @@ -506,15 +536,95 @@ proc ProcessSIA {varname iname cvarname} { } } -proc SIACmdSet {which value {cmd {}}} { - global sia +proc SIACmdCheck {} { + global cvarname + upvar #0 $cvarname cvar + + if {![info exists cvar(top)]} { + Error "[msgcat::mc {Unable to find SIAP window}] $cvarname" + cat::YYABORT + return + } + if {![winfo exists $cvar(top)]} { + Error "[msgcat:: mc {Unable to find SIAP window}] $cvarname" + cat::YYABORT + return + } +} + +proc SIACmdRef {ref} { + global isia + global cvarname + + # look for reference in current list + if {[lsearch $isia(sias) sia${ref}] < 0} { + # see if its from our list of sias + foreach mm $isia(def) { + set title [lindex $mm 0] + set vars [lindex $mm 1] + set url [lindex $mm 2] + set opts [lindex $mm 3] + set method [lindex $mm 4] + + if {$title != {-} && "sia${ref}" == $vars} { + SIADialog $vars $title $url $opts $method sync + set cvarname sia${ref} + } + } + } +} + +proc SIACmdSet {which value} { + global cvarname + upvar #0 $cvarname cvar + + set cvar($which) $value +} + +proc SIACmdCoord {xx yy sky} { + global cvarname + upvar #0 $cvarname cvar + + set cvar(x) $xx + set cvar(y) $yy + set cvar(sky) $sky +} + +proc SIACmdSave {fn writer} { + global cvarname - set sia($which) $value - if {$cmd != {}} { - eval $cmd + if {$fn != {}} { + SIASaveFn $cvarname $fn $writer + FileLast siafbox $fn } } +proc SIACmdSize {width height rformat} { + global cvarname + upvar #0 $cvarname cvar + + set cvar(width) $width + set cvar(height) $height + set cvar(rformat) $rformat + set cvar(rformat,msg) $rformat +} + +proc SIACmdSkyframe {skyframe} { + global cvarname + upvar #0 $cvarname cvar + + set cvar(sky) $skyframe + CoordMenuButtonCmd $cvarname system sky [list SIAWCSMenuUpdate $cvarname] +} + +proc SIACmdSystem {sys} { + global cvarname + upvar #0 $cvarname cvar + + set cvar(system) $sys + CoordMenuButtonCmd $cvarname system sky [list SIAWCSMenuUpdate $cvarname] +} + proc ProcessSendSIACmd {proc id param sock fn} { global isia |