Debian Codegraph @

pTk/mTk/tixUnix/tk8.0/tixAppInit.c

raw symbols SCIP
1 /* $Id: tixAppInit.c,v 1.2.2.1 2001/11/15 05:18:16 idiscovery Exp $ */
2 /*
3 * tixAppInit.c --
4 *
5 * Provides a default version of the Tcl_AppInit procedure for
6 * use in wish and similar Tk-based applications.
7 *
8 * Copyright (c) 1995 Ioi K Lam
9 * Copyright (c) 1993 The Regents of the University of California.
10 * Copyright (c) 1994 Sun Microsystems, Inc.
11 *
12 * See the file "license.terms" for information on usage and redistribution
13 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 */
15
16 #include <tk.h>
17 #include <tix.h>
18
19 /*
20 * The following variable is a special hack that is needed in order for
21 * Sun shared libraries to be used for Tcl.
22 */
23
24 extern int matherr();
25 int *tclDummyMathPtr = (int *) matherr;
26
27 /*
28 *----------------------------------------------------------------------
29 *
30 * main --
31 *
32 * This is the main program for the application.
33 *
34 * Results:
35 * None: Tk_Main never returns here, so this procedure never
36 * returns either.
37 *
38 * Side effects:
39 * Whatever the application does.
40 *
41 *----------------------------------------------------------------------
42 */
43
44 int
45 main(argc, argv)
46 int argc; /* Number of command-line arguments. */
47 char **argv; /* Values of command-line arguments. */
48 {
49 Tk_Main(argc, argv, Tcl_AppInit);
50 return 0; /* Needed only to prevent compiler warning. */
51 }
52
53 /*
54 *----------------------------------------------------------------------
55 *
56 * Tcl_AppInit --
57 *
58 * This procedure performs application-specific initialization.
59 * Most applications, especially those that incorporate additional
60 * packages, will have their own version of this procedure.
61 *
62 * Results:
63 * Returns a standard Tcl completion code, and leaves an error
64 * message in interp->result if an error occurs.
65 *
66 * Side effects:
67 * Depends on the startup script.
68 *
69 *----------------------------------------------------------------------
70 */
71
72 int
73 Tcl_AppInit(interp)
74 Tcl_Interp *interp; /* Interpreter for application. */
75 {
76 Tk_Window main;
77
78 if (Tcl_Init(interp) == TCL_ERROR) {
79 return TCL_ERROR;
80 }
81 if (Tk_Init(interp) == TCL_ERROR) {
82 return TCL_ERROR;
83 }
84 if (Tix_Init(interp) == TCL_ERROR) {
85 return TCL_ERROR;
86 }
87
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 /*
100 * Call Tcl_CreateCommand for application-specific commands, if
101 * they weren't already created by the init procedures called above.
102 */
103
104 /*
105 Tix_SetRcFileName(interp, "~/.tixwishrc");
106 In the past, the interactive initialization file was inconsistent,
107 and on Windows, $env(HOME) is undefined or most users don't even
108 know where there HOME is (Profiles\User\Application Data\)!
109 So a site wide initialization file tixwishrc.tcl is now used,
110 which must be in the same directory as the executable. To restore
111 the past behaviour, simply add the following line to that file:
112 if {[file isfile [set file ~/.tixwishrc]]} {source $file}
113 */
114
115 tcl_RcFileName = "~/.tixwishrc";
116 return TCL_OK;
117 }