summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhershey <hershey>1999-07-21 02:01:36 (GMT)
committerhershey <hershey>1999-07-21 02:01:36 (GMT)
commit260866213706058f45fa00cd53cda25614228082 (patch)
treefd1832a309ca508b8e298c8853b2310ab363342d
parent8cc4afecef5625f0c32a63a6a3e8bb6eed1a5eff (diff)
downloadtcl-260866213706058f45fa00cd53cda25614228082.zip
tcl-260866213706058f45fa00cd53cda25614228082.tar.gz
tcl-260866213706058f45fa00cd53cda25614228082.tar.bz2
* generic/tclInitScript.h:
* unix/tclUnixInit.c: merged code with 8.0.5. We now use an intermediate global tcl var "tclDefaultLibrary" to keep the "tcl_library" var from being set by the default value in the Makefile. Also fixed a bug in which caused the value of TCL_LIBRARY env var to be ignored. * unix/tclWinInit.c: just updated some comments.
-rw-r--r--ChangeLog10
-rw-r--r--generic/tclInitScript.h54
-rw-r--r--unix/tclUnixInit.c12
-rw-r--r--win/tclWinInit.c12
4 files changed, 62 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f30a5d..cc10759 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+1999-07-20 Melissa Hirschl <hershey@matisse.scriptics.com>
+
+ * generic/tclInitScript.h:
+ * unix/tclUnixInit.c: merged code with 8.0.5. We now use an
+ intermediate global tcl var "tclDefaultLibrary" to keep the
+ "tcl_library" var from being set by the default value in the
+ Makefile. Also fixed a bug in which caused the value of
+ TCL_LIBRARY env var to be ignored.
+ * unix/tclWinInit.c: just updated some comments.
+
1999-07-19 Melissa Hirschl <hershey@matisse.scriptics.com>
* library/http2.1/http.tcl: updated -useragent text to say version
diff --git a/generic/tclInitScript.h b/generic/tclInitScript.h
index a1da091..c74868b 100644
--- a/generic/tclInitScript.h
+++ b/generic/tclInitScript.h
@@ -5,39 +5,67 @@
* It is not used on the Mac. (the mac init script is in tclMacInit.c)
*
* Copyright (c) 1998 Sun Microsystems, Inc.
+ * Copyright (c) 1999 by Scriptics Corporation.
+ * All rights reserved.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * RCS: @(#) $Id: tclInitScript.h,v 1.9 1999/04/16 00:46:47 stanton Exp $
+ * RCS: @(#) $Id: tclInitScript.h,v 1.10 1999/07/21 02:01:36 hershey Exp $
*/
/*
- * The following string is the startup script executed in new
- * interpreters. It looks on disk in several 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.
+ * In order to find init.tcl during initialization, the following script
+ * is invoked by Tcl_Init(). It looks in several different directories:
+ *
+ * $tcl_library - can specify a primary location, if set
+ * no other locations will be checked
+ *
+ * $env(TCL_LIBRARY) - highest priority so user can always override
+ * the search path unless the application has
+ * specified an exact directory above
+ *
+ * $tclDefaultLibrary - this value is initialized by TclPlatformInit
+ * from a static C variable that was set at
+ * compile time
+ *
+ * $tcl_libPath - this value is initialized by a call to
+ * TclGetLibraryPath called from Tcl_Init.
+ *
+ * The first directory on this path that contains a valid init.tcl script
+ * will be set as the value of tcl_library.
+ *
+ * Note that this entire search mechanism can be bypassed by defining an
+ * alternate tclInit procedure before calling Tcl_Init().
*/
static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
proc tclInit {} {\n\
global tcl_libPath tcl_library errorInfo\n\
+ global env tclDefaultLibrary\n\
rename tclInit {}\n\
set errors {}\n\
- foreach i $tcl_libPath {\n\
+ set dirs {}\n\
+ if {[info exists tcl_library]} {\n\
+ lappend dirs $tcl_library\n\
+ } else {\n\
+ if {[info exists env(TCL_LIBRARY)]} {\n\
+ lappend dirs $env(TCL_LIBRARY)\n\
+ }\n\
+ lappend dirs $tclDefaultLibrary\n\
+ unset tclDefaultLibrary\n\
+ set dirs [concat $dirs $tcl_libPath]
+ }\n\
+ foreach i $dirs {\n\
set tcl_library $i\n\
set tclfile [file join $i init.tcl]\n\
if {[file exists $tclfile]} {\n\
- if {[catch {uplevel #0 [list source $tclfile]} msg] != 1} {\n\
- return\n\
+ if {![catch {uplevel #0 [list source $tclfile]} msg]} {\n\
+ return\n\
} else {\n\
append errors \"$tclfile: $msg\n$errorInfo\n\"\n\
}\n\
}\n\
}\n\
set msg \"Can't find a usable init.tcl in the following directories: \n\"\n\
- append msg \" $tcl_libPath\n\n\"\n\
+ append msg \" $dirs\n\n\"\n\
append msg \"$errors\n\n\"\n\
append msg \"This probably means that Tcl wasn't installed properly.\n\"\n\
error $msg\n\
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 4d5f8c7..344686d 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -4,11 +4,10 @@
* Contains the Unix-specific interpreter initialization functions.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright (c) 1999 by Scriptics Corporation.
+ * All rights reserved.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * RCS: @(#) $Id: tclUnixInit.c,v 1.15 1999/05/14 02:18:32 stanton Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.16 1999/07/21 02:01:36 hershey Exp $
*/
#include "tclInt.h"
@@ -521,7 +520,8 @@ TclpSetInitialEncodings()
* None.
*
* Side effects:
- * Sets "tcl_library" and "tcl_platform" Tcl variables.
+ * Sets "tclDefaultLibrary", "tcl_pkgPath", and "tcl_platform" Tcl
+ * variables.
*
*----------------------------------------------------------------------
*/
@@ -537,7 +537,7 @@ TclpSetVariables(interp)
char *user;
Tcl_DString ds;
- Tcl_SetVar(interp, "tcl_library", defaultLibraryDir, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "tclDefaultLibrary", defaultLibraryDir, TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "tcl_platform", "platform", "unix", TCL_GLOBAL_ONLY);
unameOK = 0;
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index a471257..2a02872 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -5,11 +5,9 @@
*
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-1999 by Scriptics Corporation.
+ * All rights reserved.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * RCS: @(#) $Id: tclWinInit.c,v 1.17 1999/05/13 01:50:17 stanton Exp $
+ * RCS: @(#) $Id: tclWinInit.c,v 1.18 1999/07/21 02:01:37 hershey Exp $
*/
#include "tclWinInt.h"
@@ -527,14 +525,14 @@ TclpSetInitialEncodings()
* TclpSetVariables --
*
* Performs platform-specific interpreter initialization related to
- * the tcl_library and tcl_platform variables, and other platform-
- * specific things.
+ * the tcl_platform and env variables, and other platform-specific
+ * things.
*
* Results:
* None.
*
* Side effects:
- * Sets "tcl_library", "tcl_platform", and "env(HOME)" Tcl variables.
+ * Sets "tcl_platform" and "env(HOME)" Tcl variables.
*
*----------------------------------------------------------------------
*/