Mercurial > cpython-lru_cache-weakref
annotate Modules/tkappinit.c @ 16798:258dcafe2d0b legacy-trunk
Gustavo Niemeyer <niemeyer@conectiva.com>:
Fixed recno support (keys are integers rather than strings).
Work around DB bug that cause stdin to be closed by rnopen() when the
DB file needed to exist but did not (no longer segfaults).
This closes SF tracker patch #403445.
Also wrapped some long lines and added whitespace around operators -- FLD.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Tue, 27 Feb 2001 18:56:46 +0000 |
| parents | 4c3f977ce06c |
| children | 1852caba7014 |
| rev | line source |
|---|---|
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
1 /* appinit.c -- Tcl and Tk application initialization. |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
2 |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
3 The function Tcl_AppInit() below initializes various Tcl packages. |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
4 It is called for each Tcl interpreter created by _tkinter.create(). |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
5 It needs to be compiled with -DWITH_<package> flags for each package |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
6 that you are statically linking with. You may have to add sections |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
7 for packages not yet listed below. |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
8 |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
9 Note that those packages for which Tcl_StaticPackage() is called with |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
10 a NULL first argument are known as "static loadable" packages to |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
11 Tcl but not actually initialized. To use these, you have to load |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
12 it explicitly, e.g. tkapp.eval("load {} Blt"). |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
13 */ |
| 1691 | 14 |
| 15 #include <tcl.h> | |
| 16 #include <tk.h> | |
| 17 | |
| 18 int | |
|
13492
5087d1d45f1d
ANSI-fication (and test if committing files works now)
Peter Schneider-Kamp <nowonder@nowonder.de>
parents:
11444
diff
changeset
|
19 Tcl_AppInit(Tcl_Interp *interp) |
| 1691 | 20 { |
|
13862
4c3f977ce06c
Removing warnings discovered by gcc -Wall
Moshe Zadka <moshez@math.huji.ac.il>
parents:
13492
diff
changeset
|
21 Tk_Window main_window; |
| 1691 | 22 |
| 4955 | 23 if (Tcl_Init (interp) == TCL_ERROR) |
| 24 return TCL_ERROR; | |
| 25 if (Tk_Init (interp) == TCL_ERROR) | |
| 26 return TCL_ERROR; | |
| 1691 | 27 |
|
13862
4c3f977ce06c
Removing warnings discovered by gcc -Wall
Moshe Zadka <moshez@math.huji.ac.il>
parents:
13492
diff
changeset
|
28 main_window = Tk_MainWindow(interp); |
|
11444
90f4830e2122
Patch by Dieter Maurer to make things work for Tcl/Tk 8.1. This
Guido van Rossum <guido@python.org>
parents:
6720
diff
changeset
|
29 |
| 1691 | 30 #ifdef WITH_MOREBUTTONS |
| 4955 | 31 { |
| 32 extern Tcl_CmdProc studButtonCmd; | |
| 33 extern Tcl_CmdProc triButtonCmd; | |
| 1691 | 34 |
| 4955 | 35 Tcl_CreateCommand(interp, "studbutton", studButtonCmd, |
|
13862
4c3f977ce06c
Removing warnings discovered by gcc -Wall
Moshe Zadka <moshez@math.huji.ac.il>
parents:
13492
diff
changeset
|
36 (ClientData) main_window, NULL); |
| 4955 | 37 Tcl_CreateCommand(interp, "tributton", triButtonCmd, |
|
13862
4c3f977ce06c
Removing warnings discovered by gcc -Wall
Moshe Zadka <moshez@math.huji.ac.il>
parents:
13492
diff
changeset
|
38 (ClientData) main_window, NULL); |
| 4955 | 39 } |
| 1691 | 40 #endif |
|
5518
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
41 |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
42 #ifdef WITH_PIL /* 0.2b5 and later -- not yet released as of May 14 */ |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
43 { |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
44 extern void TkImaging_Init(Tcl_Interp *); |
|
5518
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
45 TkImaging_Init(interp); |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
46 /* XXX TkImaging_Init() doesn't have the right return type */ |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
47 /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/ |
|
5518
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
48 } |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
49 #endif |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
50 |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
51 #ifdef WITH_PIL_OLD /* 0.2b4 and earlier */ |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
52 { |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
53 extern void TkImaging_Init(void); |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
54 /* XXX TkImaging_Init() doesn't have the right prototype */ |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
55 /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/ |
|
5518
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
56 } |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
57 #endif |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
58 |
|
6603
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
59 #ifdef WITH_TIX |
|
6720
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
60 { |
|
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
61 extern int Tix_Init(Tcl_Interp *interp); |
|
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
62 extern int Tix_SafeInit(Tcl_Interp *interp); |
|
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
63 Tcl_StaticPackage(NULL, "Tix", Tix_Init, Tix_SafeInit); |
|
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
64 } |
|
6603
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
65 #endif |
|
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
66 |
|
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
67 #ifdef WITH_BLT |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
68 { |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
69 extern int Blt_Init(Tcl_Interp *); |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
70 extern int Blt_SafeInit(Tcl_Interp *); |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
71 Tcl_StaticPackage(NULL, "Blt", Blt_Init, Blt_SafeInit); |
|
6603
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
72 } |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
73 #endif |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
74 |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
75 #ifdef WITH_TOGL |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
76 { |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
77 /* XXX I've heard rumors that this doesn't work */ |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
78 extern int Togl_Init(Tcl_Interp *); |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
79 /* XXX Is there no Togl_SafeInit? */ |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
80 Tcl_StaticPackage(NULL, "Togl", Togl_Init, NULL); |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
81 } |
|
6603
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
82 #endif |
|
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
83 |
| 1691 | 84 #ifdef WITH_XXX |
| 85 | |
| 86 #endif | |
| 4955 | 87 return TCL_OK; |
| 1691 | 88 } |
