2 // SWIG Interface file for building a new version of iwish
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++.
21 * Provides a default version of the Tcl_AppInit procedure for
22 * use in wish and similar Tk-based applications.
24 * Copyright (c) 1993 The Regents of the University of California.
25 * Copyright (c) 1994 Sun Microsystems, Inc.
27 * See the file "license.terms" for information on usage and redistribution
28 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
30 * SCCS: @(#) tkAppInit.c 1.21 96/03/26 16:47:07
38 #ifndef SWIG_RcFileName
39 char *SWIG_RcFileName = "~/.wishrc";
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));
47 * The following variable is a special hack that is needed in order for
48 * Sun shared libraries to be used for Tcl.
51 extern int matherr _ANSI_ARGS_((void));
52 static int (*tclDummyMathPtr) _ANSI_ARGS_((void)) = matherr;
59 extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
63 #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION < 4)
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).
71 extern int main _ANSI_ARGS_((int argc, char **argv));
72 static int (*dummyMainPtr) _ANSI_ARGS_((int argc, char **argv)) = main;
77 *----------------------------------------------------------------------
81 * This is the main program for the application.
84 * None: Tk_Main never returns here, so this procedure never
88 * Whatever the application does.
90 *----------------------------------------------------------------------
94 #ifdef _USING_PROTOTYPES_
95 main (int argc, /* Number of command-line arguments. */
96 char **argv) /* Values of command-line arguments. */
99 int argc; /* Number of command-line arguments. */
100 char **argv; /* Values of command-line arguments. */
103 Tk_Main(argc, argv, Tcl_AppInit);
104 return 0; /* Needed only to prevent compiler warning. */
109 *----------------------------------------------------------------------
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.
118 * Returns a standard Tcl completion code, and leaves an error
119 * message in interp->result if an error occurs.
122 * Depends on the startup script.
124 *----------------------------------------------------------------------
128 #ifdef _USING_PROTOTYPES_
129 Tcl_AppInit (Tcl_Interp *interp) /* Interpreter for application. */
132 Tcl_Interp *interp; /* Interpreter for application. */
135 if (Tcl_Init(interp) == TCL_ERROR) {
138 if (Tk_Init(interp) == TCL_ERROR) {
141 if (SWIG_init(interp) == TCL_ERROR) {
145 #if (TCL_MAJOR_VERSION > 7) || (TCL_MINOR_VERSION > 4)
146 Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);
150 * Call the init procedures for included packages. Each call should
153 * if (Mod_Init(interp) == TCL_ERROR) {
157 * where "Mod" is the name of the module.
161 * Call Tcl_CreateCommand for application-specific commands, if
162 * they weren't already created by the init procedures called above.
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.
172 #if (TCL_MAJOR_VERSION > 7) || (TCL_MINOR_VERSION > 4)
173 Tcl_SetVar(interp, "tcl_rcFileName", SWIG_RcFileName, TCL_GLOBAL_ONLY);
175 tcl_RcFileName = SWIG_RcFileName;