1
- /* appinit.c -- Tcl and Tk application initialization. */
1
+ /* appinit.c -- Tcl and Tk application initialization.
2
+
3
+ The function Tcl_AppInit() below initializes various Tcl packages.
4
+ It is called for each Tcl interpreter created by _tkinter.create().
5
+ It needs to be compiled with -DWITH_<package> flags for each package
6
+ that you are statically linking with. You may have to add sections
7
+ for packages not yet listed below.
8
+
9
+ Note that those packages for which Tcl_StaticPackage() is called with
10
+ a NULL first argument are known as "static loadable" packages to
11
+ Tcl but not actually initialized. To use these, you have to load
12
+ it explicitly, e.g. tkapp.eval("load {} Blt").
13
+ */
2
14
3
15
#include <tcl.h>
4
16
#include <tk.h>
5
17
6
- #ifdef WITH_BLT
7
- #include "blt.h"
8
- #endif
9
-
10
18
int
11
- Tcl_AppInit (interp )
19
+ Tcl_AppInit (interp )
12
20
Tcl_Interp * interp ;
13
21
{
14
22
Tk_Window main ;
@@ -34,31 +42,44 @@ Tcl_AppInit (interp)
34
42
35
43
#ifdef WITH_PIL /* 0.2b5 and later -- not yet released as of May 14 */
36
44
{
37
- extern void TkImaging_Init (Tcl_Interp * interp );
45
+ extern void TkImaging_Init (Tcl_Interp * );
38
46
TkImaging_Init (interp );
47
+ /* XXX TkImaging_Init() doesn't have the right return type */
48
+ /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/
39
49
}
40
50
#endif
41
51
42
52
#ifdef WITH_PIL_OLD /* 0.2b4 and earlier */
43
53
{
44
54
extern void TkImaging_Init (void );
45
- TkImaging_Init ();
55
+ /* XXX TkImaging_Init() doesn't have the right prototype */
56
+ /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/
46
57
}
47
58
#endif
48
59
49
60
#ifdef WITH_TIX
50
- if (Tix_Init (interp ) == TCL_ERROR ) {
51
- fprintf (stderr , "Tix_Init error: #s\n" , interp -> result );
52
- return TCL_ERROR ;
61
+ {
62
+ extern int Tix_Init (Tcl_Interp * );
63
+ /* XXX Is there no Tix_SafeInit? */
64
+ Tcl_StaticPackage (NULL , "Tix" , Tix_Init , NULL );
53
65
}
54
66
#endif
55
67
56
68
#ifdef WITH_BLT
57
- if (Blt_Init (interp ) != TCL_OK ) {
58
- fprintf (stderr , "BLT_Init error: #s\n" , interp -> result );
59
- return TCL_ERROR ;
69
+ {
70
+ extern int Blt_Init (Tcl_Interp * );
71
+ extern int Blt_SafeInit (Tcl_Interp * );
72
+ Tcl_StaticPackage (NULL , "Blt" , Blt_Init , Blt_SafeInit );
73
+ }
74
+ #endif
75
+
76
+ #ifdef WITH_TOGL
77
+ {
78
+ /* XXX I've heard rumors that this doesn't work */
79
+ extern int Togl_Init (Tcl_Interp * );
80
+ /* XXX Is there no Togl_SafeInit? */
81
+ Tcl_StaticPackage (NULL , "Togl" , Togl_Init , NULL );
60
82
}
61
- Tcl_StaticPackage (interp , "Blt" , Blt_Init , Blt_SafeInit );
62
83
#endif
63
84
64
85
#ifdef WITH_XXX
0 commit comments