Package: saods9 / 8.0.1+repack-2

ds9-Don-t-load-TclTk-extensions-as-shared-libs-but-as-pac.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
From: Ole Streicher <olebole@debian.org>
Date: Fri, 16 Dec 2016 09:23:38 +0100
Subject: [ds9] Don't load TclTk extensions as shared libs, but as packages

This allows one to start DS9 as a normal tk application without
special initialization.
---
 ds9/ds9             |  2 ++
 ds9/library/ds9.tcl | 60 +++++++++++++++++++++++++++++------------------------
 tksao/saotk.C       | 10 +++++++++
 3 files changed, 45 insertions(+), 27 deletions(-)
 create mode 100644 ds9/ds9

diff --git a/ds9/ds9 b/ds9/ds9
new file mode 100644
index 0000000..cea402f
--- /dev/null
+++ b/ds9/ds9
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/wish -f ${DS9_HOME-/usr/share/saods9}/library/ds9.tcl $*
diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl
index 9954af1..2fb4d25 100644
--- a/ds9/library/ds9.tcl
+++ b/ds9/library/ds9.tcl
@@ -170,7 +170,7 @@ if {[catch {tk windowingsystem} ds9(wm)]} {
 }
 
 # who are we?
-set ds9(app) [file tail [info nameofexecutable]]
+set ds9(app) [file rootname [file tail [info script]]]
 
 # Themes are now hardcoded
 switch $ds9(wm) {
@@ -201,34 +201,40 @@ switch $ds9(wm) {
     x11 {
 	# set to absolute path so that if -cd command is used,
 	# so we can still find our files
-	set ds9(root) [file normalize [file join [pwd] zvfsmntpt]]
+	set ds9(root) [file normalize [file join [file dirname [info script]] ..]]
 
-	if {![namespace exists msgcat]} {
-	    source $ds9(root)/tcl8/8.5/msgcat-1.5.2.tm
-	}
-	if {![namespace exists http]} {
-	    source $ds9(root)/tcl8/8.6/http-2.8.12.tm
-	    source $ds9(root)/library/htp.tcl
-	}
+	package require msgcat
+	package require http
+	source $ds9(root)/library/htp.tcl
+	package require xml
 
-	source $ds9(root)/tk8.6/tearoff.tcl
-	source $ds9(root)/tk8.6/comdlg.tcl
-	source $ds9(root)/tk8.6/focus.tcl
-	source $ds9(root)/tk8.6/mkpsenc.tcl
-	source $ds9(root)/tk8.6/msgbox.tcl
-	source $ds9(root)/tk8.6/optMenu.tcl
-	source $ds9(root)/tk8.6/unsupported.tcl
-
-	source $ds9(root)/base64/base64.tcl
-	source $ds9(root)/log/log.tcl
-	source $ds9(root)/ftp/ftp.tcl
-	source $ds9(root)/textutil/repeat.tcl
-	source $ds9(root)/textutil/tabify.tcl
-	source $ds9(root)/math/fuzzy.tcl
-
-	source $ds9(root)/tkcon/tkcon.tcl
-	source $ds9(root)/tkblt/graph.tcl
-	source $ds9(root)/tls/tls.tcl
+	package require base64
+	package require log
+	package require ftp
+	package require textutil::repeat
+	package require textutil::tabify
+	package require math::fuzzy
+
+	package require tkcon
+	package require tkblt
+	package require tls
+	package require tksao
+	package require tkhtml1
+	package require tcliis
+	package require tkmpeg
+	package require Tktable
+	package require tclxpa
+	package require Signal
+
+	package require img::base
+	package require img::jpeg
+	package require img::tiff
+	package require img::png
+	package require img::gif
+	package require img::ppm
+	package require img::bmp
+	package require img::xbm
+	package require img::window
 
 	source $ds9(root)/library/source.tcl
 
diff --git a/tksao/saotk.C b/tksao/saotk.C
index 3484746..18eb111 100644
--- a/tksao/saotk.C
+++ b/tksao/saotk.C
@@ -27,6 +27,7 @@ extern int ColorbarRGBTrueColor24_Init(Tcl_Interp*);
 extern int PannerTrueColor_Init(Tcl_Interp*);
 
 extern int MagnifierTrueColor_Init(Tcl_Interp*);
+static Tcl_Interp *global_interp;
 
 extern "C" {
   int Tksao_Init(Tcl_Interp* interp);
@@ -91,6 +92,8 @@ int Tksao_Init(Tcl_Interp* interp) {
   if (Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION) != TCL_OK)
     return TCL_ERROR;
 
+  global_interp = interp;
+
   return TCL_OK;
 }
 
@@ -98,3 +101,10 @@ int SaotkCmd(ClientData data, Tcl_Interp *interp, int argc, const char* argv[])
 {
   return TCL_OK;
 }
+
+void internalError(const char* msg)
+{
+  Tcl_SetVar2(global_interp, "ds9", "msg", msg, TCL_GLOBAL_ONLY);
+  Tcl_SetVar2(global_interp, "ds9", "msg,level", "error", TCL_GLOBAL_ONLY);
+}
+