/tags/ttn-post-libtool-1-4-3-upgrade/SWIG/Lib/tcl/wish.i
Swig | 166 lines | 81 code | 27 blank | 58 comment | 0 complexity | 86f3ca673aa7e1f046f368486917fb4d MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
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.2.1 2001/06/20 11:47:29 mkoeppe
11 * Portability fixes
12 *
13 * Revision 1.1 2000/01/11 21:15:54 beazley
14 * Added files
15 *
16 * Revision 1.2 1999/11/05 21:45:14 beazley
17 * Minor Changes
18 *
19 * Revision 1.1.1.1 1999/02/28 02:00:56 beazley
20 * Swig1.1
21 *
22 * Revision 1.1 1996/05/22 19:47:45 beazley
23 * Initial revision
24 *
25 */
26
27#ifdef AUTODOC
28%subsection "wish.i"
29%text %{
30This module provides the Tk_AppInit() function needed to build a
31new version of the wish executable. Like tclsh.i, this file should
32not be used with dynamic loading. To make an interface file work with
33both static and dynamic loading, put something like this in your
34interface file :
35
36 #ifdef STATIC
37 %include wish.i
38 #endif
39
40A startup file may be specified by defining the symbol SWIG_RcFileName
41as follows (this should be included in a code-block) :
42
43 #define SWIG_RcFileName "~/.mywishrc"
44%}
45#endif
46
47%{
48
49
50/* Initialization code for wish */
51
52#include <tk.h>
53
54#ifndef SWIG_RcFileName
55char *SWIG_RcFileName = "~/.wishrc";
56#endif
57
58#ifdef MAC_TCL
59extern int MacintoshInit _ANSI_ARGS_((void));
60extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp));
61#endif
62
63/*
64 *----------------------------------------------------------------------
65 *
66 * Tcl_AppInit --
67 *
68 * This procedure performs application-specific initialization.
69 * Most applications, especially those that incorporate additional
70 * packages, will have their own version of this procedure.
71 *
72 * Results:
73 * Returns a standard Tcl completion code, and leaves an error
74 * message in interp->result if an error occurs.
75 *
76 * Side effects:
77 * Depends on the startup script.
78 *
79 *----------------------------------------------------------------------
80 */
81
82int Tcl_AppInit(Tcl_Interp *interp)
83{
84#ifndef MAC_TCL
85 Tk_Window main;
86 main = Tk_MainWindow(interp);
87#endif
88 /*
89 * Call the init procedures for included packages. Each call should
90 * look like this:
91 *
92 * if (Mod_Init(interp) == TCL_ERROR) {
93 * return TCL_ERROR;
94 * }
95 *
96 * where "Mod" is the name of the module.
97 */
98
99 if (Tcl_Init(interp) == TCL_ERROR) {
100 return TCL_ERROR;
101 }
102
103 if (Tk_Init(interp) == TCL_ERROR) {
104 return TCL_ERROR;
105 }
106
107 /*
108 * Call Tcl_CreateCommand for application-specific commands, if
109 * they weren't already created by the init procedures called above.
110 */
111
112 if (SWIG_init(interp) == TCL_ERROR) {
113 return TCL_ERROR;
114 }
115
116#ifdef MAC_TCL
117 SetupMainInterp(interp);
118#endif
119
120 /*
121 * Specify a user-specific startup file to invoke if the application
122 * is run interactively. Typically the startup file is "~/.apprc"
123 * where "app" is the name of the application. If this line is deleted
124 * then no user-specific startup file will be run under any conditions.
125 */
126
127#if TCL_MAJOR_VERSION >= 8 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5
128 Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
129#else
130 tcl_RcFileName = SWIG_RcFileName;
131#endif
132
133/* For Macintosh might also want this */
134
135#ifdef MAC_TCL
136#ifdef SWIG_RcRsrcName
137 Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL_ONLY);
138#endif
139#endif
140 return TCL_OK;
141}
142
143#if TK_MAJOR_VERSION >= 4
144int main(int argc, char **argv) {
145
146#ifdef MAC_TCL
147 char *newArgv[2];
148 if (MacintoshInit() != TCL_OK) {
149 Tcl_Exit(1);
150 }
151 argc = 1;
152 newArgv[0] = "Wish";
153 newArgv[1] = NULL;
154 argv = newArgv;
155#endif
156 Tk_Main(argc, argv, Tcl_AppInit);
157 return(0);
158}
159#else
160extern int main();
161#endif
162
163%}
164
165
166