summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorsuresh <suresh>1998-07-09 13:46:23 (GMT)
committersuresh <suresh>1998-07-09 13:46:23 (GMT)
commitd53df4119776f97484c23827a7c69370a5a2ec51 (patch)
treefc79c3ce66f33f69a622cd112f5f0786c3012939 /generic
parent280cb7621484ef66cbfe5a793275a8951978293f (diff)
downloadtcl-d53df4119776f97484c23827a7c69370a5a2ec51.zip
tcl-d53df4119776f97484c23827a7c69370a5a2ec51.tar.gz
tcl-d53df4119776f97484c23827a7c69370a5a2ec51.tar.bz2
Fixed a bug in the Tcl init script that did not have a "global env" and thus
setting the TCL_LIBRARY environment variable was not being set in the global 'env' array. Moved the varaibe 'tclPreInitScript' from respective tcl<plat>Init.c file. Added a routine 'TclSetPreInitScript()' to facilite setting the pre-init script variable. This file should only be included once in the entire set of C source files for Tcl (by the respective platform initialization C source file, tclUnixInit.c and tclWinInit.c) and thus the presence of the routine, TclSetPreInitScript, below, should be harmless.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclInitScript.h52
1 files changed, 45 insertions, 7 deletions
diff --git a/generic/tclInitScript.h b/generic/tclInitScript.h
index c3b21a3..3c0e1e3 100644
--- a/generic/tclInitScript.h
+++ b/generic/tclInitScript.h
@@ -3,27 +3,31 @@
*
* This file contains Unix & Windows common init script
* It is not used on the Mac. (the mac init script is in tclMacInit.c)
+ * This file should only be included once in the entire set of C
+ * source files for Tcl (by the respective platform initialization
+ * C source file, tclUnixInit.c and tclWinInit.c) and thus the
+ * presence of the routine, TclSetPreInitScript, below, should be
+ * harmless.
*
* Copyright (c) 1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * SCCS: %Z% $Id: tclInitScript.h,v 1.1 1998/06/27 22:11:40 welch Exp $
+ * SCCS: %Z% $Id: tclInitScript.h,v 1.2 1998/07/09 13:46:23 suresh Exp $
*/
/*
- * The following string is the startup script executed in new
- * interpreters. It looks on disk in (way too many) different directories
- * for a script "init.tcl" that is compatible with this version
- * of Tcl. The init.tcl script does all of the real work of
- * initialization.
+ * The following string is the startup script executed in new interpreters.
+ * It looks on disk in (way too many) different directories for a script
+ * "init.tcl" that is compatible with this version of Tcl. The init.tcl
+ * script does all of the real work of initialization.
*/
static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
proc tclInit {} {\n\
global tcl_library tcl_version tcl_patchLevel errorInfo\n\
- global tcl_pkgPath\n\
+ global tcl_pkgPath env\n\
rename tclInit {}\n\
set errors {}\n\
set dirs {}\n\
@@ -63,3 +67,37 @@ static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
}\n\
tclInit";
+/*
+ * A pointer to a string that holds an initialization script that if non-NULL
+ * is evaluated in Tcl_Init() prior to the the built-in initialization script
+ * above. This variable can be modified by the procedure below.
+ */
+
+static char * tclPreInitScript = NULL;
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclSetPreInitScript --
+ *
+ * This routine is used to change the value of the internal
+ * variable, tclPreInitScript.
+ *
+ * Results:
+ * Returns the current value of tclPreInitScript.
+ *
+ * Side effects:
+ * Changes the way Tcl_Init() routine behaves.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+TclSetPreInitScript (string)
+ char *string; /* Pointer to a script. */
+{
+ char *prevString = tclPreInitScript;
+ tclPreInitScript = string;
+ return(prevString);
+}