From 1ad3c6846690c6d70fe611d3a6be84186ad4ab26 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 11 Jun 2004 22:39:28 +0000 Subject: * doc/Encoding.3: Removed bogus claims about tcl_libPath. * generic/tclInterp.c (Tcl_Init): Stopped setting the tcl_libPath variable. [tclInit] can get all its directories without it. * tests/unixInit.test: Modified test code that made use of tcl_libPath variable. * unix/tclUnixInit.c: Stopped setting the tclDefaultLibrary variable, execept on the Mac OS X platform with HAVE_CFBUNDLE. In that configuration we should seek some way to make use of the TIP 59 facilities and get rid of that usage of tclDefaultLibrary as well. --- ChangeLog | 14 ++++++++++++++ doc/Encoding.3 | 6 +++--- generic/tclInterp.c | 39 +++++++++++++++++++++++---------------- tests/unixInit.test | 7 +++++-- unix/tclUnixInit.c | 4 +--- 5 files changed, 46 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index b17d6f5..6159c09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2004-06-11 Don Porter + * doc/Encoding.3: Removed bogus claims about tcl_libPath. + + * generic/tclInterp.c (Tcl_Init): Stopped setting the + tcl_libPath variable. [tclInit] can get all its directories + without it. + + * tests/unixInit.test: Modified test code that made use of + tcl_libPath variable. + + * unix/tclUnixInit.c: Stopped setting the tclDefaultLibrary variable, + execept on the Mac OS X platform with HAVE_CFBUNDLE. In that configuration + we should seek some way to make use of the TIP 59 facilities and + get rid of that usage of tclDefaultLibrary as well. + * generic/tclInterp.c: Updated [tclInit] to make $env(TCL_LIBRARY) an absolute path, and to include the scriptdir,runtime configuration value on the search path for init.tcl. diff --git a/doc/Encoding.3 b/doc/Encoding.3 index 126bb89..5884b45 100644 --- a/doc/Encoding.3 +++ b/doc/Encoding.3 @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: Encoding.3,v 1.14 2004/03/17 18:14:12 das Exp $ +'\" RCS: @(#) $Id: Encoding.3,v 1.15 2004/06/11 22:39:28 dgp Exp $ '\" .so man.macros .TH Tcl_GetEncoding 3 "8.1" Tcl "Tcl Library Procedures" @@ -512,8 +512,8 @@ example, for instance, ``\fB{}\fR'' represents the empty string and .PP When \fBTcl_GetEncoding\fR encounters an encoding \fIname\fR that has not been loaded, it attempts to load an encoding file called \fIname\fB.enc\fR -from the \fBencoding\fR subdirectory of each directory specified in the -library path \fB$tcl_libPath\fR. If the encoding file exists, but is +from the \fBencoding\fR subdirectory of each directory that Tcl searches +for its script library. If the encoding file exists, but is malformed, an error message will be left in \fIinterp\fR. .SH KEYWORDS utf, encoding, convert diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 389fcf7..b5ef40f 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInterp.c,v 1.38 2004/06/11 21:55:53 dgp Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.39 2004/06/11 22:39:29 dgp Exp $ */ #include "tclInt.h" @@ -21,18 +21,33 @@ * 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 + * no other locations will be checked. This + * is the recommended way for a program that + * embeds Tcl to specifically tell Tcl where + * to find an init.tcl file. * * $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. + * $tclDefaultLibrary - INTERNAL: This variable is set by Tcl + * only on the Mac OSX platform, and in time + * we expect to disable it altogether. Any + * program that embeds Tcl that is using + * this variable to customize [tclInit] should + * migrate to use of tcl_library instead. + * + * $tcl_libPath - OBSOLETE: This variable is no longer + * set by Tcl itself, but [tclInit] examines + * it in case some program that embeds Tcl + * is customizing [tclInit] by setting this + * variable to a list of directories in which + * to search. + * + * [tcl::pkgconfig get scriptdir,runtime] + * - the directory determined by configure to + * be the place where Tcl's script library + * is to be installed. * * The first directory on this path that contains a valid init.tcl script * will be set as the value of tcl_library. @@ -362,19 +377,11 @@ int Tcl_Init(interp) Tcl_Interp *interp; /* Interpreter to initialize. */ { - Tcl_Obj *pathPtr; - if (tclPreInitScript != NULL) { if (Tcl_Eval(interp, tclPreInitScript) == TCL_ERROR) { return (TCL_ERROR); }; } - - pathPtr = TclGetLibraryPath(); - if (pathPtr == NULL) { - pathPtr = Tcl_NewObj(); - } - Tcl_SetVar2Ex(interp, "tcl_libPath", NULL, pathPtr, TCL_GLOBAL_ONLY); return Tcl_Eval(interp, initScript); } diff --git a/tests/unixInit.test b/tests/unixInit.test index a9b25fe..89e5d78 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: unixInit.test,v 1.38 2004/06/10 22:21:53 dgp Exp $ +# RCS: @(#) $Id: unixInit.test,v 1.39 2004/06/11 22:39:29 dgp Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -95,7 +95,10 @@ test unixInit-1.2 {initialisation: standard channel type deduction} {unixOnly st proc getlibpath [list [list program [interpreter]]] { set f [open "|[list $program]" w+] fconfigure $f -buffering none - puts $f {puts $tcl_libPath; exit} + puts $f { + puts [list $::env(TCL_LIBRARY) [tcl::pkgconfig get scriptdir,runtime]] + exit + } set path [gets $f] close $f return $path diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 87b6412..7934e28 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.43 2004/06/11 21:30:08 dgp Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.44 2004/06/11 22:39:30 dgp Exp $ */ #if defined(HAVE_CFBUNDLE) @@ -792,8 +792,6 @@ TclpSetVariables(interp) } else #endif /* HAVE_CFBUNDLE */ { - Tcl_SetVar(interp, "tclDefaultLibrary", defaultLibraryDir, - TCL_GLOBAL_ONLY); Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY); } -- cgit v0.12