]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxSWIG/swig_lib/tcl/wish.i
unicode compilation fix
[wxWidgets.git] / wxPython / wxSWIG / swig_lib / tcl / wish.i
1 //
2 // $Header$
3 //
4 // SWIG File for making wish
5 // Dave Beazley
6 // April 25, 1996
7 //
8 /* Revision History
9 * $Log$
10 * Revision 1.1 2002/04/29 19:56:57 RD
11 * Since I have made several changes to SWIG over the years to accomodate
12 * special cases and other things in wxPython, and since I plan on making
13 * several more, I've decided to put the SWIG sources in wxPython's CVS
14 * instead of relying on maintaining patches. This effectivly becomes a
15 * fork of an obsolete version of SWIG, :-( but since SWIG 1.3 still
16 * doesn't have some things I rely on in 1.1, not to mention that my
17 * custom patches would all have to be redone, I felt that this is the
18 * easier road to take.
19 *
20 * Revision 1.2 1999/11/05 21:45:14 beazley
21 * Minor Changes
22 *
23 * Revision 1.1.1.1 1999/02/28 02:00:56 beazley
24 * Swig1.1
25 *
26 * Revision 1.1 1996/05/22 19:47:45 beazley
27 * Initial revision
28 *
29 */
30
31 #ifdef AUTODOC
32 %subsection "wish.i"
33 %text %{
34 This module provides the Tk_AppInit() function needed to build a
35 new version of the wish executable. Like tclsh.i, this file should
36 not be used with dynamic loading. To make an interface file work with
37 both static and dynamic loading, put something like this in your
38 interface file :
39
40 #ifdef STATIC
41 %include wish.i
42 #endif
43
44 A startup file may be specified by defining the symbol SWIG_RcFileName
45 as follows (this should be included in a code-block) :
46
47 #define SWIG_RcFileName "~/.mywishrc"
48 %}
49 #endif
50
51 %{
52
53
54 /* Initialization code for wish */
55
56 #include <tk.h>
57
58 #ifndef SWIG_RcFileName
59 char *SWIG_RcFileName = "~/.wishrc";
60 #endif
61
62 #ifdef MAC_TCL
63 extern int MacintoshInit _ANSI_ARGS_((void));
64 extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp));
65 #endif
66
67 /*
68 *----------------------------------------------------------------------
69 *
70 * Tcl_AppInit --
71 *
72 * This procedure performs application-specific initialization.
73 * Most applications, especially those that incorporate additional
74 * packages, will have their own version of this procedure.
75 *
76 * Results:
77 * Returns a standard Tcl completion code, and leaves an error
78 * message in interp->result if an error occurs.
79 *
80 * Side effects:
81 * Depends on the startup script.
82 *
83 *----------------------------------------------------------------------
84 */
85
86 int Tcl_AppInit(Tcl_Interp *interp)
87 {
88 #ifndef MAC_TCL
89 Tk_Window main;
90 main = Tk_MainWindow(interp);
91 #endif
92 /*
93 * Call the init procedures for included packages. Each call should
94 * look like this:
95 *
96 * if (Mod_Init(interp) == TCL_ERROR) {
97 * return TCL_ERROR;
98 * }
99 *
100 * where "Mod" is the name of the module.
101 */
102
103 if (Tcl_Init(interp) == TCL_ERROR) {
104 return TCL_ERROR;
105 }
106
107 if (Tk_Init(interp) == TCL_ERROR) {
108 return TCL_ERROR;
109 }
110
111 /*
112 * Call Tcl_CreateCommand for application-specific commands, if
113 * they weren't already created by the init procedures called above.
114 */
115
116 if (SWIG_init(interp) == TCL_ERROR) {
117 return TCL_ERROR;
118 }
119
120 #ifdef MAC_TCL
121 SetupMainInterp(interp);
122 #endif
123
124 /*
125 * Specify a user-specific startup file to invoke if the application
126 * is run interactively. Typically the startup file is "~/.apprc"
127 * where "app" is the name of the application. If this line is deleted
128 * then no user-specific startup file will be run under any conditions.
129 */
130
131 #if TCL_MAJOR_VERSION >= 8 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5
132 Tcl_SetVar(interp,"tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
133 #else
134 tcl_RcFileName = SWIG_RcFileName;
135 #endif
136
137 /* For Macintosh might also want this */
138
139 #ifdef MAC_TCL
140 #ifdef SWIG_RcRsrcName
141 Tcl_SetVar(interp,"tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL_ONLY);
142 #endif
143 #endif
144 return TCL_OK;
145 }
146
147 #if TK_MAJOR_VERSION >= 4
148 int main(int argc, char **argv) {
149
150 #ifdef MAC_TCL
151 char *newArgv[2];
152 if (MacintoshInit() != TCL_OK) {
153 Tcl_Exit(1);
154 }
155 argc = 1;
156 newArgv[0] = "Wish";
157 newArgv[1] = NULL;
158 argv = newArgv;
159 #endif
160 Tk_Main(argc, argv, Tcl_AppInit);
161 return(0);
162 }
163 #else
164 extern int main();
165 #endif
166
167 %}
168
169
170