os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/tclTestInit.c
First public contribution.
4 * Provides a default version of the main program and Tcl_AppInit
5 * procedure for Tcl applications (without Tk). Based on tclAppInit.c
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.
10 * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiaries. All rights reserved.
12 * See the file "license.terms" for information on usage and redistribution
13 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 * RCS: @(#) $Id: tclAppInit.c,v 1.11 2002/05/31 22:20:22 dgp Exp $
19 #if defined(__SYMBIAN32__)
27 extern int Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp));
28 extern int Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
29 extern int TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
30 extern int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
32 extern int TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
38 extern void XtToolkitInitialize _ANSI_ARGS_((void));
39 extern int Tclxttest_Init _ANSI_ARGS_((Tcl_Interp *interp));
43 *----------------------------------------------------------------------
47 * This is the main program for the application.
50 * None: Tcl_Main never returns here, so this procedure never
54 * Whatever the application does.
56 *----------------------------------------------------------------------
61 int argc; /* Number of command-line arguments. */
62 char **argv; /* Values of command-line arguments. */
65 * The following #if block allows you to change the AppInit
66 * function by using a #define of TCL_LOCAL_APPINIT instead
67 * of rewriting this entire file. The #if checks for that
68 * #define and uses Tcl_AppInit if it doesn't exist.
70 #ifndef TCL_LOCAL_APPINIT
71 #define TCL_LOCAL_APPINIT Tcl_AppInit
73 extern int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
76 * The following #if block allows you to change how Tcl finds the startup
77 * script, prime the library or encoding paths, fiddle with the argv,
78 * etc., without needing to rewrite Tcl_Main()
81 #ifdef TCL_LOCAL_MAIN_HOOK
82 extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
86 XtToolkitInitialize();
89 #ifdef TCL_LOCAL_MAIN_HOOK
90 TCL_LOCAL_MAIN_HOOK(&argc, &argv);
93 Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);
95 return 0; /* Needed only to prevent compiler warning. */
99 *----------------------------------------------------------------------
103 * This procedure performs application-specific initialization.
104 * Most applications, especially those that incorporate additional
105 * packages, will have their own version of this procedure.
108 * Returns a standard Tcl completion code, and leaves an error
109 * message in the interp's result if an error occurs.
112 * Depends on the startup script.
114 *----------------------------------------------------------------------
119 Tcl_Interp *interp; /* Interpreter for application. */
121 if (Tcl_Init(interp) == TCL_ERROR) {
127 if (Tclxttest_Init(interp) == TCL_ERROR) {
131 if (Tcltest_Init(interp) == TCL_ERROR) {
134 Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
135 (Tcl_PackageInitProc *) NULL);
136 if (TclObjTest_Init(interp) == TCL_ERROR) {
140 if (TclThread_Init(interp) == TCL_ERROR) {
144 if (Procbodytest_Init(interp) == TCL_ERROR) {
147 Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
148 Procbodytest_SafeInit);
149 #endif /* TCL_TEST */
152 * Call the init procedures for included packages. Each call should
155 * if (Mod_Init(interp) == TCL_ERROR) {
159 * where "Mod" is the name of the module.
163 * Call Tcl_CreateCommand for application-specific commands, if
164 * they weren't already created by the init procedures called above.
168 * Specify a user-specific startup file to invoke if the application
169 * is run interactively. Typically the startup file is "~/.apprc"
170 * where "app" is the name of the application. If this line is deleted
171 * then no user-specific startup file will be run under any conditions.
175 Tcl_SetVar(interp, "tcl_rcFileName", "~/tclsh.rc", TCL_GLOBAL_ONLY);
177 Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);