]>
Commit | Line | Data |
---|---|---|
1 | // | |
2 | // SWIG Interface file for building a new version of itkwish | |
3 | // Dave Beazley | |
4 | // August 14, 1996 | |
5 | // | |
6 | ||
7 | ||
8 | #ifdef AUTODOC | |
9 | %subsection "itkwish.i" | |
10 | %text %{ | |
11 | This module provides a main() program needed to build a new version | |
12 | of the [incr Tcl] 'itkwish' 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 | /* | |
20 | * tkAppInit.c -- | |
21 | * | |
22 | * Provides a default version of the Tcl_AppInit procedure for | |
23 | * use in wish and similar Tk-based applications. | |
24 | * | |
25 | * Copyright (c) 1993 The Regents of the University of California. | |
26 | * Copyright (c) 1994 Sun Microsystems, Inc. | |
27 | * | |
28 | * See the file "license.terms" for information on usage and redistribution | |
29 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
30 | */ | |
31 | ||
32 | #ifndef lint | |
33 | static char sccsid[] = "@(#) tkAppInit.c 1.15 95/06/28 13:14:28"; | |
34 | #endif /* not lint */ | |
35 | ||
36 | #include <tk.h> | |
37 | ||
38 | EXTERN int Itcl_Init _ANSI_ARGS_((Tcl_Interp *interp)); | |
39 | EXTERN int Itk_Init _ANSI_ARGS_((Tcl_Interp *interp)); | |
40 | ||
41 | /* | |
42 | * The following variable is a special hack that is needed in order for | |
43 | * Sun shared libraries to be used for Tcl. | |
44 | */ | |
45 | ||
46 | #ifndef SWIG_RcFileName | |
47 | char *SWIG_RcFileName = "~/.itkwishrc"; | |
48 | #endif | |
49 | ||
50 | extern int matherr(); | |
51 | static int (*dummyMathPtr)() = matherr; | |
52 | ||
53 | \f | |
54 | /* | |
55 | *---------------------------------------------------------------------- | |
56 | * | |
57 | * main -- | |
58 | * | |
59 | * This is the main program for the application. | |
60 | * | |
61 | * Results: | |
62 | * None: Tk_Main never returns here, so this procedure never | |
63 | * returns either. | |
64 | * | |
65 | * Side effects: | |
66 | * Whatever the application does. | |
67 | * | |
68 | *---------------------------------------------------------------------- | |
69 | */ | |
70 | ||
71 | int | |
72 | main(argc, argv) | |
73 | int argc; /* Number of command-line arguments. */ | |
74 | char **argv; /* Values of command-line arguments. */ | |
75 | { | |
76 | Tk_Main(argc, argv, Tcl_AppInit); | |
77 | return 0; /* Needed only to prevent compiler warning. */ | |
78 | } | |
79 | \f | |
80 | /* | |
81 | *---------------------------------------------------------------------- | |
82 | * | |
83 | * Tcl_AppInit -- | |
84 | * | |
85 | * This procedure performs application-specific initialization. | |
86 | * Most applications, especially those that incorporate additional | |
87 | * packages, will have their own version of this procedure. | |
88 | * | |
89 | * Results: | |
90 | * Returns a standard Tcl completion code, and leaves an error | |
91 | * message in interp->result if an error occurs. | |
92 | * | |
93 | * Side effects: | |
94 | * Depends on the startup script. | |
95 | * | |
96 | *---------------------------------------------------------------------- | |
97 | */ | |
98 | ||
99 | int | |
100 | Tcl_AppInit(interp) | |
101 | Tcl_Interp *interp; /* Interpreter for application. */ | |
102 | { | |
103 | if (Tcl_Init(interp) == TCL_ERROR) { | |
104 | return TCL_ERROR; | |
105 | } | |
106 | if (Tk_Init(interp) == TCL_ERROR) { | |
107 | return TCL_ERROR; | |
108 | } | |
109 | ||
110 | /* | |
111 | * Call the init procedures for included packages. Each call should | |
112 | * look like this: | |
113 | * | |
114 | * if (Mod_Init(interp) == TCL_ERROR) { | |
115 | * return TCL_ERROR; | |
116 | * } | |
117 | * | |
118 | * where "Mod" is the name of the module. | |
119 | */ | |
120 | if (Itcl_Init(interp) == TCL_ERROR) { | |
121 | return TCL_ERROR; | |
122 | } | |
123 | if (Itk_Init(interp) == TCL_ERROR) { | |
124 | return TCL_ERROR; | |
125 | } | |
126 | if (SWIG_init(interp) == TCL_ERROR) { | |
127 | return TCL_ERROR; | |
128 | } | |
129 | ||
130 | if (Tcl_PkgRequire(interp, "Iwidgets", (char*)NULL, 0) == NULL) { | |
131 | return TCL_ERROR; | |
132 | } | |
133 | ||
134 | /* | |
135 | * Call Tcl_CreateCommand for application-specific commands, if | |
136 | * they weren't already created by the init procedures called above. | |
137 | */ | |
138 | ||
139 | /* | |
140 | * Specify a user-specific startup file to invoke if the application | |
141 | * is run interactively. Typically the startup file is "~/.apprc" | |
142 | * where "app" is the name of the application. If this line is deleted | |
143 | * then no user-specific startup file will be run under any conditions. | |
144 | */ | |
145 | ||
146 | Tcl_SetVar(interp, "tcl_rcFileName", SWIG_RcFileName, TCL_GLOBAL_ONLY); | |
147 | return TCL_OK; | |
148 | } | |
149 | ||
150 | %} |