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