]>
Commit | Line | Data |
---|---|---|
c90f71dd RD |
1 | // |
2 | // SWIG Interface file for building a new version of itclsh | |
3 | // Dave Beazley | |
4 | // August 14, 1996 | |
5 | // | |
6 | ||
7 | ||
8 | #ifdef AUTODOC | |
9 | %subsection "itclsh.i" | |
10 | %text %{ | |
11 | This module provides a main() program needed to build a new version | |
12 | of the [incr Tcl] 'itclsh' 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 | ||
32 | static char sccsid[] = "@(#) tclAppInit.c 1.13 95/06/08 10:55:54"; | |
33 | ||
34 | #ifdef __cplusplus | |
35 | extern "C" { | |
36 | #endif | |
37 | ||
38 | #ifndef SWIG_RcFileName | |
39 | char *SWIG_RcFileName = "~/.tclshrc"; | |
40 | #endif | |
41 | ||
42 | extern int Itcl_Init _ANSI_ARGS_((Tcl_Interp *interp)); | |
43 | ||
44 | /* | |
45 | * The following variable is a special hack that is needed in order for | |
46 | * Sun shared libraries to be used for Tcl. | |
47 | */ | |
48 | ||
49 | extern int matherr _ANSI_ARGS_((void)); | |
50 | static int (*dummyMathPtr) _ANSI_ARGS_((void)) = matherr; | |
51 | ||
52 | #ifdef __cplusplus | |
53 | } | |
54 | #endif | |
55 | ||
56 | \f | |
57 | /* | |
58 | *---------------------------------------------------------------------- | |
59 | * | |
60 | * main -- | |
61 | * | |
62 | * This is the main program for the application. | |
63 | * | |
64 | * Results: | |
65 | * None: Tcl_Main never returns here, so this procedure never | |
66 | * returns either. | |
67 | * | |
68 | * Side effects: | |
69 | * Whatever the application does. | |
70 | * | |
71 | *---------------------------------------------------------------------- | |
72 | */ | |
73 | ||
74 | int | |
75 | main(argc, argv) | |
76 | int argc; /* Number of command-line arguments. */ | |
77 | char **argv; /* Values of command-line arguments. */ | |
78 | { | |
79 | Tcl_Main(argc, argv, Tcl_AppInit); | |
80 | return 0; /* Needed only to prevent compiler warning. */ | |
81 | } | |
82 | \f | |
83 | /* | |
84 | *---------------------------------------------------------------------- | |
85 | * | |
86 | * Tcl_AppInit -- | |
87 | * | |
88 | * This procedure performs application-specific initialization. | |
89 | * Most applications, especially those that incorporate additional | |
90 | * packages, will have their own version of this procedure. | |
91 | * | |
92 | * Results: | |
93 | * Returns a standard Tcl completion code, and leaves an error | |
94 | * message in interp->result if an error occurs. | |
95 | * | |
96 | * Side effects: | |
97 | * Depends on the startup script. | |
98 | * | |
99 | *---------------------------------------------------------------------- | |
100 | */ | |
101 | ||
102 | int | |
103 | Tcl_AppInit(interp) | |
104 | Tcl_Interp *interp; /* Interpreter for application. */ | |
105 | { | |
106 | if (Tcl_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 | ||
121 | if (Itcl_Init(interp) == TCL_ERROR) { | |
122 | return TCL_ERROR; | |
123 | } | |
124 | if (SWIG_init(interp) == TCL_ERROR) { | |
125 | return TCL_ERROR; | |
126 | } | |
127 | ||
128 | #if (TCL_MAJOR_VERSION > 7) || (TCL_MINOR_VERSION > 4) | |
129 | Tcl_StaticPackage(interp, "Itcl", Itcl_Init, (Tcl_PackageInitProc *) NULL); | |
130 | #endif | |
131 | ||
132 | /* | |
133 | * Call Tcl_CreateCommand for application-specific commands, if | |
134 | * they weren't already created by the init procedures called above. | |
135 | */ | |
136 | ||
137 | /* | |
138 | * Specify a user-specific startup file to invoke if the application | |
139 | * is run interactively. Typically the startup file is "~/.apprc" | |
140 | * where "app" is the name of the application. If this line is deleted | |
141 | * then no user-specific startup file will be run under any conditions. | |
142 | */ | |
143 | ||
144 | #if (TCL_MAJOR_VERSION > 7) || (TCL_MINOR_VERSION > 4) | |
145 | Tcl_SetVar(interp, "tcl_rcFileName", SWIG_RcFileName, TCL_GLOBAL_ONLY); | |
146 | #else | |
147 | tcl_RcFileName = SWIG_RcFileName; | |
148 | #endif | |
149 | return TCL_OK; | |
150 | } | |
151 | ||
152 | %} |