os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/mac/tclMacAppInit.c
First public contribution.
4 * Provides a version of the Tcl_AppInit procedure for the example shell.
6 * Copyright (c) 1993-1994 Lockheed Missle & Space Company, AI Center
7 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
9 * See the file "license.terms" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 * RCS: @(#) $Id: tclMacAppInit.c,v 1.9 2001/11/23 01:27:13 das Exp $
19 #include "tclMacInt.h"
23 #elif defined(__MWERKS__)
25 EXTERN short InstallConsole _ANSI_ARGS_((short fd));
29 extern int Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp));
30 extern int Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
31 extern int TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
32 extern int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
36 * Forward declarations for procedures defined later in this file:
39 static int MacintoshInit _ANSI_ARGS_((void));
42 *----------------------------------------------------------------------
46 * Main program for tclsh. This file can be used as a prototype
47 * for other applications using the Tcl library.
50 * None. This procedure never returns (it exits the process when
54 * This procedure initializes the Macintosh world and then
55 * calls Tcl_Main. Tcl_Main will never return except to exit.
57 *----------------------------------------------------------------------
62 int argc, /* Number of arguments. */
63 char **argv) /* Array of argument strings. */
67 if (MacintoshInit() != TCL_OK) {
74 Tcl_Main(argc, newArgv, Tcl_AppInit);
78 *----------------------------------------------------------------------
82 * This procedure performs application-specific initialization.
83 * Most applications, especially those that incorporate additional
84 * packages, will have their own version of this procedure.
87 * Returns a standard Tcl completion code, and leaves an error
88 * message in the interp's result if an error occurs.
91 * Depends on the startup script.
93 *----------------------------------------------------------------------
98 Tcl_Interp *interp) /* Interpreter for application. */
100 if (Tcl_Init(interp) == TCL_ERROR) {
105 if (Tcltest_Init(interp) == TCL_ERROR) {
108 Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
109 (Tcl_PackageInitProc *) NULL);
110 if (TclObjTest_Init(interp) == TCL_ERROR) {
113 if (Procbodytest_Init(interp) == TCL_ERROR) {
116 Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
117 Procbodytest_SafeInit);
118 #endif /* TCL_TEST */
121 * Call the init procedures for included packages. Each call should
124 * if (Mod_Init(interp) == TCL_ERROR) {
128 * where "Mod" is the name of the module.
132 * Call Tcl_CreateCommand for application-specific commands, if
133 * they weren't already created by the init procedures called above.
134 * Each call would loo like this:
136 * Tcl_CreateCommand(interp, "tclName", CFuncCmd, NULL, NULL);
140 * Specify a user-specific startup script to invoke if the application
141 * is run interactively. On the Mac we can specifiy either a TEXT resource
142 * which contains the script or the more UNIX like file location
143 * may also used. (I highly recommend using the resource method.)
146 Tcl_SetVar(interp, "tcl_rcRsrcName", "tclshrc", TCL_GLOBAL_ONLY);
147 /* Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); */
153 *----------------------------------------------------------------------
157 * This procedure calls initalization routines to set up a simple
158 * console on a Macintosh. This is necessary as the Mac doesn't
159 * have a stdout & stderr by default.
162 * Returns TCL_OK if everything went fine. If it didn't the
163 * application should probably fail.
166 * Inits the appropiate console package.
168 *----------------------------------------------------------------------
174 #if GENERATING68K && !GENERATINGCFM
175 SetApplLimit(GetApplLimit() - (TCL_MAC_68K_STACK_GROWTH));
181 /* Set options for Think C console package */
182 /* The console package calls the Mac init calls */
183 console_options.pause_atexit = 0;
184 console_options.title = "\pTcl Interpreter";
186 #elif defined(__MWERKS__)
188 /* Set options for CodeWarrior SIOUX package */
189 SIOUXSettings.autocloseonquit = true;
190 SIOUXSettings.showstatusline = true;
191 SIOUXSettings.asktosaveonclose = false;
192 SIOUXSettings.wasteusetempmemory = true;
194 SIOUXSetTitle("\pTcl Interpreter");
196 #elif defined(applec)
198 /* Init packages used by MPW SIOW package */
199 InitGraf((Ptr)&qd.thePort);
209 Tcl_MacSetEventProc((Tcl_MacConvertEventPtr) SIOUXHandleOneEvent);
211 /* No problems with initialization */