Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / bsd / openldap / dist / contrib / ldaptcl / tkAppInit.c
blob9b99373da4f391f62a12cf9580da288d53595b34
1 /*
2 * tkXAppInit.c --
4 * Provides a default version of the Tcl_AppInit procedure for use with
5 * applications built with Extended Tcl and Tk on Unix systems. This is based
6 * on the the UCB Tk file tkAppInit.c
7 *-----------------------------------------------------------------------------
8 * Copyright 1991-1996 Karl Lehenbauer and Mark Diekhans.
10 * Permission to use, copy, modify, and distribute this software and its
11 * documentation for any purpose and without fee is hereby granted, provided
12 * that the above copyright notice appear in all copies. Karl Lehenbauer and
13 * Mark Diekhans make no representations about the suitability of this
14 * software for any purpose. It is provided "as is" without express or
15 * implied warranty.
16 *-----------------------------------------------------------------------------
17 * $OpenLDAP: pkg/ldap/contrib/ldaptcl/tkAppInit.c,v 1.3 2000/05/11 08:35:27 hyc Exp $
18 *-----------------------------------------------------------------------------
21 #include "tclExtend.h"
22 #include "tk.h"
25 * The following variable is a special hack that insures the tcl
26 * version of matherr() is used when linking against shared libraries
27 * Even if matherr is not used on this system, there is a dummy version
28 * in libtcl.
30 EXTERN int matherr ();
31 int (*tclDummyMathPtr)() = matherr;
34 /*-----------------------------------------------------------------------------
35 * main --
37 * This is the main program for the application.
38 *-----------------------------------------------------------------------------
40 #ifdef __cplusplus
41 int
42 main (int argc,
43 char **argv)
44 #else
45 int
46 main (argc, argv)
47 int argc;
48 char **argv;
49 #endif
51 #ifdef USE_TCLX
52 TkX_Main(argc, argv, Tcl_AppInit);
53 #else
54 Tk_Main(argc, argv, Tcl_AppInit);
55 #endif
56 return 0; /* Needed only to prevent compiler warning. */
59 /*-----------------------------------------------------------------------------
60 * Tcl_AppInit --
62 * This procedure performs application-specific initialization. Most
63 * applications, especially those that incorporate additional packages, will
64 * have their own version of this procedure.
66 * Results:
67 * Returns a standard Tcl completion code, and leaves an error message in
68 * interp->result if an error occurs.
69 *-----------------------------------------------------------------------------
71 #ifdef __cplusplus
72 int
73 Tcl_AppInit (Tcl_Interp *interp)
74 #else
75 int
76 Tcl_AppInit (interp)
77 Tcl_Interp *interp;
78 #endif
80 if (Tcl_Init (interp) == TCL_ERROR) {
81 return TCL_ERROR;
83 #ifdef USE_TCLX
84 if (Tclx_Init(interp) == TCL_ERROR) {
85 return TCL_ERROR;
87 Tcl_StaticPackage(interp, "Tclx", Tclx_Init, Tclx_SafeInit);
88 #endif
89 if (Tk_Init(interp) == TCL_ERROR) {
90 return TCL_ERROR;
92 Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);
93 #ifdef USE_TCLX
94 if (Tkx_Init(interp) == TCL_ERROR) {
95 return TCL_ERROR;
97 Tcl_StaticPackage(interp, "Tkx", Tkx_Init, (Tcl_PackageInitProc *) NULL);
98 #endif
100 if (Ldaptcl_Init(interp) == TCL_ERROR) {
101 return TCL_ERROR;
103 Tcl_StaticPackage(interp, "Ldaptcl", Ldaptcl_Init,
104 (Tcl_PackageInitProc *) NULL);
107 * Call Tcl_CreateCommand for application-specific commands, if
108 * they weren't already created by the init procedures called above.
112 * Specify a user-specific startup file to invoke if the application
113 * is run interactively. Typically the startup file is "~/.apprc"
114 * where "app" is the name of the application. If this line is deleted
115 * then no user-specific startup file will be run under any conditions.
117 Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishxrc", TCL_GLOBAL_ONLY);
118 return TCL_OK;