Microwave filters GUI 2.0.3

- Main Page
- Related Pages
- Packages
- Classes
- Files

- File List

tkAppInit.c
1 /*
2 * tkAppInit.c --
3 *
4 * Provides a default version of the Tcl_AppInit procedure for use in
5 * wish and similar Tk-based applications.
6 *
7 * Copyright (c) 1993 The Regents of the University of California.
8 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
9 *
10 * See the file "license.terms" for information on usage and redistribution of
11 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 */
13
14 #include "tk.h"
15 #include "locale.h"
16
17 #ifdef TK_TEST
18 extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
19 #endif /* TK_TEST */
20
21 /*
22 *----------------------------------------------------------------------
23 *
24 * main --
25 *
26 * This is the main program for the application.
27 *
28 * Results:
29 * None: Tk_Main never returns here, so this procedure never returns
30 * either.
31 *
32 * Side effects:
33 * Whatever the application does.
34 *
35 *----------------------------------------------------------------------
36 */
37
38 int
39 main(
40 int argc, /* Number of command-line arguments. */
41 char **argv) /* Values of command-line arguments. */
42 {
43 /*
44 * The following #if block allows you to change the AppInit function by
45 * using a #define of TCL_LOCAL_APPINIT instead of rewriting this entire
46 * file. The #if checks for that #define and uses Tcl_AppInit if it
47 * doesn't exist.
48 */
49
50 #ifndef TK_LOCAL_APPINIT
51 #define TK_LOCAL_APPINIT Tcl_AppInit
52 #endif
53 extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
54
55 /*
56 * The following #if block allows you to change how Tcl finds the startup
57 * script, prime the library or encoding paths, fiddle with the argv,
58 * etc., without needing to rewrite Tk_Main()
59 */
60
61 #ifdef TK_LOCAL_MAIN_HOOK
62 extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
63 TK_LOCAL_MAIN_HOOK(&argc, &argv);
64 #endif
65
66 Tk_Main(argc, argv, TK_LOCAL_APPINIT);
67 return 0; /* Needed only to prevent compiler warning. */
68 }
69
70 /*
71 *----------------------------------------------------------------------
72 *
73 * Tcl_AppInit --
74 *
75 * This procedure performs application-specific initialization. Most
76 * applications, especially those that incorporate additional packages,
77 * will have their own version of this procedure.
78 *
79 * Results:
80 * Returns a standard Tcl completion code, and leaves an error message in
81 * the interp's result if an error occurs.
82 *
83 * Side effects:
84 * Depends on the startup script.
85 *
86 *----------------------------------------------------------------------
87 */
88
89 int
90 Tcl_AppInit(
91 Tcl_Interp *interp) /* Interpreter for application. */
92 {
93 if (Tcl_Init(interp) == TCL_ERROR) {
94 return TCL_ERROR;
95 }
96 if (Tk_Init(interp) == TCL_ERROR) {
97 return TCL_ERROR;
98 }
99 Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
100 #ifdef TK_TEST
101 if (Tktest_Init(interp) == TCL_ERROR) {
102 return TCL_ERROR;
103 }
104 Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
105 (Tcl_PackageInitProc *) NULL);
106 #endif /* TK_TEST */
107
108 /*
109 * Call the init procedures for included packages. Each call should look
110 * like this:
111 *
112 * if (Mod_Init(interp) == TCL_ERROR) {
113 * return TCL_ERROR;
114 * }
115 *
116 * where "Mod" is the name of the module.
117 */
118
119 /*
120 * Call Tcl_CreateCommand for application-specific commands, if they
121 * weren't already created by the init procedures called above.
122 */
123
124 /*
125 * Specify a user-specific startup file to invoke if the application is
126 * run interactively. Typically the startup file is "~/.apprc" where "app"
127 * is the name of the application. If this line is deleted then no user-
128 * -specific startup file will be run under any conditions.
129 */
130
131 Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
132 return TCL_OK;
133 }
134
135 /*
136 * Local Variables:
137 * mode: c
138 * c-basic-offset: 4
139 * fill-column: 78
140 * End:
141 */
142
143