os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/tclAppInit.c
First public contribution.
4 * Provides a default version of the main program and Tcl_AppInit
5 * procedure for Tcl applications (without Tk).
7 * Copyright (c) 1993 The Regents of the University of California.
8 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
9 * Copyright (c) 1998-1999 by Scriptics Corporation.
11 * See the file "license.terms" for information on usage and redistribution
12 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * RCS: @(#) $Id: tclAppInit.c,v 1.11 2002/05/31 22:20:22 dgp Exp $
23 extern int Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp));
24 extern int Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
25 extern int TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
26 extern int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
28 extern int TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
34 extern void XtToolkitInitialize _ANSI_ARGS_((void));
35 extern int Tclxttest_Init _ANSI_ARGS_((Tcl_Interp *interp));
39 *----------------------------------------------------------------------
43 * This is the main program for the application.
46 * None: Tcl_Main never returns here, so this procedure never
50 * Whatever the application does.
52 *----------------------------------------------------------------------
57 int argc; /* Number of command-line arguments. */
58 char **argv; /* Values of command-line arguments. */
61 * The following #if block allows you to change the AppInit
62 * function by using a #define of TCL_LOCAL_APPINIT instead
63 * of rewriting this entire file. The #if checks for that
64 * #define and uses Tcl_AppInit if it doesn't exist.
67 #ifndef TCL_LOCAL_APPINIT
68 #define TCL_LOCAL_APPINIT Tcl_AppInit
70 extern int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
73 * The following #if block allows you to change how Tcl finds the startup
74 * script, prime the library or encoding paths, fiddle with the argv,
75 * etc., without needing to rewrite Tcl_Main()
78 #ifdef TCL_LOCAL_MAIN_HOOK
79 extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
83 XtToolkitInitialize();
86 #ifdef TCL_LOCAL_MAIN_HOOK
87 TCL_LOCAL_MAIN_HOOK(&argc, &argv);
90 Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);
92 return 0; /* Needed only to prevent compiler warning. */
96 *----------------------------------------------------------------------
100 * This procedure performs application-specific initialization.
101 * Most applications, especially those that incorporate additional
102 * packages, will have their own version of this procedure.
105 * Returns a standard Tcl completion code, and leaves an error
106 * message in the interp's result if an error occurs.
109 * Depends on the startup script.
111 *----------------------------------------------------------------------
116 Tcl_Interp *interp; /* Interpreter for application. */
118 if (Tcl_Init(interp) == TCL_ERROR) {
124 if (Tclxttest_Init(interp) == TCL_ERROR) {
128 if (Tcltest_Init(interp) == TCL_ERROR) {
131 Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
132 (Tcl_PackageInitProc *) NULL);
133 if (TclObjTest_Init(interp) == TCL_ERROR) {
137 if (TclThread_Init(interp) == TCL_ERROR) {
141 if (Procbodytest_Init(interp) == TCL_ERROR) {
144 Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
145 Procbodytest_SafeInit);
146 #endif /* TCL_TEST */
149 * Call the init procedures for included packages. Each call should
152 * if (Mod_Init(interp) == TCL_ERROR) {
156 * where "Mod" is the name of the module.
160 * Call Tcl_CreateCommand for application-specific commands, if
161 * they weren't already created by the init procedures called above.
165 * Specify a user-specific startup file to invoke if the application
166 * is run interactively. Typically the startup file is "~/.apprc"
167 * where "app" is the name of the application. If this line is deleted
168 * then no user-specific startup file will be run under any conditions.
172 Tcl_SetVar(interp, "tcl_rcFileName", "~/tclsh.rc", TCL_GLOBAL_ONLY);
174 Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);