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-1995 Sun Microsystems, Inc.
10 * See the file "license.terms" for information on usage and redistribution
11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * SCCS: @(#) tclAppInit.c 1.17 96/03/26 12:45:29
19 * The following variable is a special hack that is needed in order for
20 * Sun shared libraries to be used for Tcl.
24 int *tclDummyMathPtr
= (int *) matherr
;
27 EXTERN
int Tcltest_Init
_ANSI_ARGS_((Tcl_Interp
*interp
));
31 *----------------------------------------------------------------------
35 * This is the main program for the application.
38 * None: Tcl_Main never returns here, so this procedure never
42 * Whatever the application does.
44 *----------------------------------------------------------------------
49 int argc
; /* Number of command-line arguments. */
50 char **argv
; /* Values of command-line arguments. */
53 TclX_Main(argc
, argv
, Tcl_AppInit
);
55 Tcl_Main(argc
, argv
, Tcl_AppInit
);
57 return 0; /* Needed only to prevent compiler warning. */
61 *----------------------------------------------------------------------
65 * This procedure performs application-specific initialization.
66 * Most applications, especially those that incorporate additional
67 * packages, will have their own version of this procedure.
70 * Returns a standard Tcl completion code, and leaves an error
71 * message in interp->result if an error occurs.
74 * Depends on the startup script.
76 *----------------------------------------------------------------------
81 Tcl_Interp
*interp
; /* Interpreter for application. */
83 if (Tcl_Init(interp
) == TCL_ERROR
) {
88 if (Itcl_Init(interp
) == TCL_ERROR
) {
91 Tcl_StaticPackage (interp
, "Itcl", Itcl_Init
, NULL
);
95 if (Tcltest_Init(interp
) == TCL_ERROR
) {
98 Tcl_StaticPackage(interp
, "Tcltest", Tcltest_Init
,
99 (Tcl_PackageInitProc
*) NULL
);
100 #endif /* TCL_TEST */
103 if (Tclx_Init (interp
) == TCL_ERROR
) {
106 Tcl_StaticPackage (interp
, "Tclx", Tclx_Init
, NULL
);
109 if (Ldaptcl_Init(interp
) == TCL_ERROR
) {
112 Tcl_StaticPackage(interp
, "Ldaptcl", Ldaptcl_Init
,
113 (Tcl_PackageInitProc
*) NULL
);
116 * Call the init procedures for included packages. Each call should
119 * if (Mod_Init(interp) == TCL_ERROR) {
123 * where "Mod" is the name of the module.
127 * Call Tcl_CreateCommand for application-specific commands, if
128 * they weren't already created by the init procedures called above.
132 * Specify a user-specific startup file to invoke if the application
133 * is run interactively. Typically the startup file is "~/.apprc"
134 * where "app" is the name of the application. If this line is deleted
135 * then no user-specific startup file will be run under any conditions.
138 Tcl_SetVar(interp
, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY
);