Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / bsd / openldap / dist / contrib / ldaptcl / tclAppInit.c
blobf84e1826f2ebd74c796ea2492af3518de00c1565
1 /*
2 * tclAppInit.c --
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
16 #include "tcl.h"
19 * The following variable is a special hack that is needed in order for
20 * Sun shared libraries to be used for Tcl.
23 extern int matherr();
24 int *tclDummyMathPtr = (int *) matherr;
26 #ifdef TCL_TEST
27 EXTERN int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
28 #endif /* TCL_TEST */
31 *----------------------------------------------------------------------
33 * main --
35 * This is the main program for the application.
37 * Results:
38 * None: Tcl_Main never returns here, so this procedure never
39 * returns either.
41 * Side effects:
42 * Whatever the application does.
44 *----------------------------------------------------------------------
47 int
48 main(argc, argv)
49 int argc; /* Number of command-line arguments. */
50 char **argv; /* Values of command-line arguments. */
52 #ifdef USE_TCLX
53 TclX_Main(argc, argv, Tcl_AppInit);
54 #else
55 Tcl_Main(argc, argv, Tcl_AppInit);
56 #endif
57 return 0; /* Needed only to prevent compiler warning. */
61 *----------------------------------------------------------------------
63 * Tcl_AppInit --
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.
69 * Results:
70 * Returns a standard Tcl completion code, and leaves an error
71 * message in interp->result if an error occurs.
73 * Side effects:
74 * Depends on the startup script.
76 *----------------------------------------------------------------------
79 int
80 Tcl_AppInit(interp)
81 Tcl_Interp *interp; /* Interpreter for application. */
83 if (Tcl_Init(interp) == TCL_ERROR) {
84 return TCL_ERROR;
87 #ifdef USE_ITCL
88 if (Itcl_Init(interp) == TCL_ERROR) {
89 return TCL_ERROR;
91 Tcl_StaticPackage (interp, "Itcl", Itcl_Init, NULL);
92 #endif
94 #ifdef TCL_TEST
95 if (Tcltest_Init(interp) == TCL_ERROR) {
96 return TCL_ERROR;
98 Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
99 (Tcl_PackageInitProc *) NULL);
100 #endif /* TCL_TEST */
102 #ifdef USE_TCLX
103 if (Tclx_Init (interp) == TCL_ERROR) {
104 return TCL_ERROR;
106 Tcl_StaticPackage (interp, "Tclx", Tclx_Init, NULL);
107 #endif
109 if (Ldaptcl_Init(interp) == TCL_ERROR) {
110 return TCL_ERROR;
112 Tcl_StaticPackage(interp, "Ldaptcl", Ldaptcl_Init,
113 (Tcl_PackageInitProc *) NULL);
116 * Call the init procedures for included packages. Each call should
117 * look like this:
119 * if (Mod_Init(interp) == TCL_ERROR) {
120 * return 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);
139 return TCL_OK;