summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--changes8
-rw-r--r--generic/tclInitScript.h7
-rw-r--r--library/init.tcl38
3 files changed, 38 insertions, 15 deletions
diff --git a/changes b/changes
index 37ea500..0ef6d93 100644
--- a/changes
+++ b/changes
@@ -1,6 +1,6 @@
Recent user-visible changes to Tcl:
-RCS: @(#) $Id: changes,v 1.28 1998/10/20 20:01:22 rjohnson Exp $
+RCS: @(#) $Id: changes,v 1.29 1998/10/23 22:22:02 welch Exp $
1. No more [command1] [command2] construct for grouping multiple
commands on a single command line.
@@ -3649,3 +3649,9 @@ changed for IRIX to build n32 binaries instead of the old 32 abi
format. If you have extensions built with the o32 abi's you will need
to update them to n32 for them to work with Tcl. (RJ)
*** POTENTIAL INCOMPATIBILITY ***
+
+10/23/98 (bug fix) tcl_findLibrary had a stray ] in one of the pathnames
+it searched for the initialization script. tclInitScript.h was incorrectly
+adding the parent of tcl_library to tcl_pkgPath. This logic was moved
+into init.tcl, and the initialization of auto_path was documented.
+Thanks to Donald Porter and Tom Silva for related patches. (BW)
diff --git a/generic/tclInitScript.h b/generic/tclInitScript.h
index a847872..25ce3a9 100644
--- a/generic/tclInitScript.h
+++ b/generic/tclInitScript.h
@@ -14,7 +14,7 @@
* 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.7 1998/09/14 18:40:00 stanton Exp $
+ * RCS: @(#) $Id: tclInitScript.h,v 1.8 1998/10/23 22:22:15 welch Exp $
*/
/*
@@ -56,7 +56,7 @@
* down inside unix/arch directory
*
* The first directory on this path that contains a valid init.tcl script
- * will be appended to tcl_pkgPath and set as the value of tcl_library.
+ * 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().
@@ -65,7 +65,7 @@
static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
proc tclInit {} {\n\
global tcl_library tcl_version tcl_patchLevel errorInfo\n\
- global tcl_pkgPath env tclDefaultLibrary\n\
+ global env tclDefaultLibrary\n\
rename tclInit {}\n\
set errors {}\n\
set dirs {}\n\
@@ -95,7 +95,6 @@ static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
set tclfile [file join $i init.tcl]\n\
if {[file exists $tclfile]} {\n\
if {![catch {uplevel #0 [list source $tclfile]} msg]} {\n\
- lappend tcl_pkgPath [file dirname $i]\n\
return\n\
} else {\n\
append errors \"$tclfile: $msg\n$errorInfo\n\"\n\
diff --git a/library/init.tcl b/library/init.tcl
index 71c0b78..1dba84d 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -3,7 +3,7 @@
# Default system startup file for Tcl-based applications. Defines
# "unknown" procedure and auto-load facilities.
#
-# RCS: @(#) $Id: init.tcl,v 1.16 1998/10/17 00:15:40 escoffon Exp $
+# RCS: @(#) $Id: init.tcl,v 1.17 1998/10/23 22:22:15 welch Exp $
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -18,24 +18,42 @@ if {[info commands package] == ""} {
package require -exact Tcl 8.0
# Compute the auto path to use in this interpreter.
-# (auto_path could be already set, in safe interps for instance)
+# The values on the path come from several locations:
+#
+# The environment variable TCLLIBPATH
+#
+# tcl_library, which is the directory containing this init.tcl script.
+# tclInitScript.h searches around for the directory containing this
+# init.tcl and defines tcl_library to that location before sourcing it.
+#
+# The parent directory of tcl_library. Adding the parent
+# means that packages in peer directories will be found automatically.
+#
+# tcl_pkgPath, which is set by the platform-specific initialization routines
+# On UNIX it is compiled in
+# On Windows it comes from the registry
+# On Macintosh it is "Tool Command Language" in the Extensions folder
if {![info exists auto_path]} {
- if {[catch {set auto_path $env(TCLLIBPATH)}]} {
+ if {[info exist env(TCLLIBPATH)]} {
+ set auto_path $env(TCLLIBPATH)
+ } else {
set auto_path ""
}
}
-if {[lsearch -exact $auto_path [info library]] < 0} {
- lappend auto_path [info library]
+foreach __dir [list [info library] [file dirname [info library]]] {
+ if {[lsearch -exact $auto_path $__dir] < 0} {
+ lappend auto_path $__dir
+ }
}
-catch {
+if {[info exist tcl_pkgPath]} {
foreach __dir $tcl_pkgPath {
if {[lsearch -exact $auto_path $__dir] < 0} {
lappend auto_path $__dir
}
}
- unset __dir
}
+unset __dir
# Windows specific initialization to handle case isses with envars
@@ -621,12 +639,12 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
lappend dirs [file join $grandParentDir lib $basename$version]
lappend dirs [file join $parentDir library]
lappend dirs [file join $grandParentDir library]
- if [string match {*[ab]*} $patch] {
+ if {[string match {*[ab]*} $patch]} {
set ver $patch
} else {
set ver $version
}
- lappend dirs [file join $grandParentDir] $basename$ver library]
+ lappend dirs [file join $grandParentDir $basename$ver library]
lappend dirs [file join [file dirname $grandParentDir] $basename$ver library]
}
foreach i $dirs {
@@ -1163,7 +1181,7 @@ proc pkg_mkIndex {args} {
}
set dir [lindex $args $idx]
- set patternList [lrange $args [expr $idx + 1] end]
+ set patternList [lrange $args [expr {$idx + 1}] end]
if {[llength $patternList] == 0} {
set patternList [list "*.tcl" "*[info sharedlibextension]"]
}