summaryrefslogtreecommitdiff
path: root/tk/unix/tkAppInit.c
diff options
context:
space:
mode:
Diffstat (limited to 'tk/unix/tkAppInit.c')
-rw-r--r--tk/unix/tkAppInit.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/tk/unix/tkAppInit.c b/tk/unix/tkAppInit.c
index 19fcd974fbc..ca7febb4453 100644
--- a/tk/unix/tkAppInit.c
+++ b/tk/unix/tkAppInit.c
@@ -5,7 +5,7 @@
* use in wish and similar Tk-based applications.
*
* Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1994 Sun Microsystems, Inc.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,6 +14,7 @@
*/
#include "tk.h"
+#include "locale.h"
/*
* The following variable is a special hack that is needed in order for
@@ -24,7 +25,8 @@ extern int matherr();
int *tclDummyMathPtr = (int *) matherr;
#ifdef TK_TEST
-EXTERN int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
+extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
#endif /* TK_TEST */
/*
@@ -49,7 +51,30 @@ main(argc, argv)
int argc; /* Number of command-line arguments. */
char **argv; /* Values of command-line arguments. */
{
- Tk_Main(argc, argv, Tcl_AppInit);
+ /*
+ * The following #if block allows you to change the AppInit
+ * function by using a #define of TCL_LOCAL_APPINIT instead
+ * of rewriting this entire file. The #if checks for that
+ * #define and uses Tcl_AppInit if it doesn't exist.
+ */
+
+#ifndef TK_LOCAL_APPINIT
+#define TK_LOCAL_APPINIT Tcl_AppInit
+#endif
+ extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
+
+ /*
+ * The following #if block allows you to change how Tcl finds the startup
+ * script, prime the library or encoding paths, fiddle with the argv,
+ * etc., without needing to rewrite Tk_Main()
+ */
+
+#ifdef TK_LOCAL_MAIN_HOOK
+ extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
+ TK_LOCAL_MAIN_HOOK(&argc, &argv);
+#endif
+
+ Tk_Main(argc, argv, TK_LOCAL_APPINIT);
return 0; /* Needed only to prevent compiler warning. */
}
@@ -64,7 +89,7 @@ main(argc, argv)
*
* Results:
* Returns a standard Tcl completion code, and leaves an error
- * message in interp->result if an error occurs.
+ * message in the interp's result if an error occurs.
*
* Side effects:
* Depends on the startup script.
@@ -84,6 +109,11 @@ Tcl_AppInit(interp)
}
Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
#ifdef TK_TEST
+ if (Tcltest_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
+ (Tcl_PackageInitProc *) NULL);
if (Tktest_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -118,3 +148,4 @@ Tcl_AppInit(interp)
Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
return TCL_OK;
}
+