]>
Commit | Line | Data |
---|---|---|
c90f71dd RD |
1 | // |
2 | // SWIG Interface file for building a new version of iwish | |
3 | // Dave Beazley | |
4 | // August 14, 1996 | |
5 | // | |
6 | ||
7 | ||
8 | #ifdef AUTODOC | |
9 | %subsection "iwish.i" | |
10 | %text %{ | |
11 | This module provides a main() program needed to build a new version | |
12 | of the [incr Tcl] 'iwish' executable. It has been tested with itcl 2.1, | |
13 | but may need tweaking for later versions and for use with C++. | |
14 | %} | |
15 | #endif | |
16 | ||
17 | %{ | |
18 | /* | |
19 | * tkAppInit.c -- | |
20 | * | |
21 | * Provides a default version of the Tcl_AppInit procedure for | |
22 | * use in wish and similar Tk-based applications. | |
23 | * | |
24 | * Copyright (c) 1993 The Regents of the University of California. | |
25 | * Copyright (c) 1994 Sun Microsystems, Inc. | |
26 | * | |
27 | * See the file "license.terms" for information on usage and redistribution | |
28 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
29 | * | |
30 | * SCCS: @(#) tkAppInit.c 1.21 96/03/26 16:47:07 | |
31 | */ | |
32 | ||
33 | ||
34 | #ifdef __cplusplus | |
35 | extern "C" { | |
36 | #endif | |
37 | ||
38 | #ifndef SWIG_RcFileName | |
39 | char *SWIG_RcFileName = "~/.wishrc"; | |
40 | #endif | |
41 | ||
42 | extern int Tk_Init _ANSI_ARGS_((Tcl_Interp *interp)); | |
43 | extern void Tk_Main _ANSI_ARGS_((int argc, char **argv, | |
44 | Tcl_AppInitProc *appInitProc)); | |
45 | ||
46 | /* | |
47 | * The following variable is a special hack that is needed in order for | |
48 | * Sun shared libraries to be used for Tcl. | |
49 | */ | |
50 | ||
51 | extern int matherr _ANSI_ARGS_((void)); | |
52 | static int (*tclDummyMathPtr) _ANSI_ARGS_((void)) = matherr; | |
53 | ||
54 | #ifdef __cplusplus | |
55 | } | |
56 | #endif | |
57 | ||
58 | #ifdef TK_TEST | |
59 | extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp)); | |
60 | #endif /* TK_TEST */ | |
61 | ||
62 | \f | |
63 | #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION < 4) | |
64 | /* | |
65 | * The following variable is a special hack that allows applications | |
66 | * to be linked using the procedure "main" from the Tcl7.3 library. The | |
67 | * variable generates a reference to "main", which causes main to | |
68 | * be brought in from the library (and all of Tcl with it). | |
69 | */ | |
70 | ||
71 | extern int main _ANSI_ARGS_((int argc, char **argv)); | |
72 | static int (*dummyMainPtr) _ANSI_ARGS_((int argc, char **argv)) = main; | |
73 | ||
74 | #else | |
75 | ||
76 | /* | |
77 | *---------------------------------------------------------------------- | |
78 | * | |
79 | * main -- | |
80 | * | |
81 | * This is the main program for the application. | |
82 | * | |
83 | * Results: | |
84 | * None: Tk_Main never returns here, so this procedure never | |
85 | * returns either. | |
86 | * | |
87 | * Side effects: | |
88 | * Whatever the application does. | |
89 | * | |
90 | *---------------------------------------------------------------------- | |
91 | */ | |
92 | ||
93 | int | |
94 | #ifdef _USING_PROTOTYPES_ | |
95 | main (int argc, /* Number of command-line arguments. */ | |
96 | char **argv) /* Values of command-line arguments. */ | |
97 | #else | |
98 | main(argc, argv) | |
99 | int argc; /* Number of command-line arguments. */ | |
100 | char **argv; /* Values of command-line arguments. */ | |
101 | #endif | |
102 | { | |
103 | Tk_Main(argc, argv, Tcl_AppInit); | |
104 | return 0; /* Needed only to prevent compiler warning. */ | |
105 | } | |
106 | #endif | |
107 | \f | |
108 | /* | |
109 | *---------------------------------------------------------------------- | |
110 | * | |
111 | * Tcl_AppInit -- | |
112 | * | |
113 | * This procedure performs application-specific initialization. | |
114 | * Most applications, especially those that incorporate additional | |
115 | * packages, will have their own version of this procedure. | |
116 | * | |
117 | * Results: | |
118 | * Returns a standard Tcl completion code, and leaves an error | |
119 | * message in interp->result if an error occurs. | |
120 | * | |
121 | * Side effects: | |
122 | * Depends on the startup script. | |
123 | * | |
124 | *---------------------------------------------------------------------- | |
125 | */ | |
126 | ||
127 | int | |
128 | #ifdef _USING_PROTOTYPES_ | |
129 | Tcl_AppInit (Tcl_Interp *interp) /* Interpreter for application. */ | |
130 | #else | |
131 | Tcl_AppInit(interp) | |
132 | Tcl_Interp *interp; /* Interpreter for application. */ | |
133 | #endif | |
134 | { | |
135 | if (Tcl_Init(interp) == TCL_ERROR) { | |
136 | return TCL_ERROR; | |
137 | } | |
138 | if (Tk_Init(interp) == TCL_ERROR) { | |
139 | return TCL_ERROR; | |
140 | } | |
141 | if (SWIG_init(interp) == TCL_ERROR) { | |
142 | return TCL_ERROR; | |
143 | } | |
144 | ||
145 | #if (TCL_MAJOR_VERSION > 7) || (TCL_MINOR_VERSION > 4) | |
146 | Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL); | |
147 | #endif | |
148 | ||
149 | /* | |
150 | * Call the init procedures for included packages. Each call should | |
151 | * look like this: | |
152 | * | |
153 | * if (Mod_Init(interp) == TCL_ERROR) { | |
154 | * return TCL_ERROR; | |
155 | * } | |
156 | * | |
157 | * where "Mod" is the name of the module. | |
158 | */ | |
159 | ||
160 | /* | |
161 | * Call Tcl_CreateCommand for application-specific commands, if | |
162 | * they weren't already created by the init procedures called above. | |
163 | */ | |
164 | ||
165 | /* | |
166 | * Specify a user-specific startup file to invoke if the application | |
167 | * is run interactively. Typically the startup file is "~/.apprc" | |
168 | * where "app" is the name of the application. If this line is deleted | |
169 | * then no user-specific startup file will be run under any conditions. | |
170 | */ | |
171 | ||
172 | #if (TCL_MAJOR_VERSION > 7) || (TCL_MINOR_VERSION > 4) | |
173 | Tcl_SetVar(interp, "tcl_rcFileName", SWIG_RcFileName, TCL_GLOBAL_ONLY); | |
174 | #else | |
175 | tcl_RcFileName = SWIG_RcFileName; | |
176 | #endif | |
177 | return TCL_OK; | |
178 | } | |
179 | ||
180 | %} |