summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/info.n7
-rw-r--r--doc/package.n8
-rw-r--r--generic/tclCmdIL.c18
-rw-r--r--generic/tclCmdMZ.c28
-rw-r--r--generic/tclIOUtil.c1
-rw-r--r--generic/tclInt.h5
-rw-r--r--generic/tclInterp.c19
-rw-r--r--generic/tclLoad.c35
-rw-r--r--generic/tclPkg.c122
-rw-r--r--library/init.tcl2
-rw-r--r--library/package.tcl2
-rw-r--r--library/tclIndex134
-rw-r--r--tests/info.test4
-rw-r--r--tests/load.test4
-rw-r--r--tests/package.test14
15 files changed, 303 insertions, 100 deletions
diff --git a/doc/info.n b/doc/info.n
index 477e272..01ca10b 100644
--- a/doc/info.n
+++ b/doc/info.n
@@ -297,10 +297,11 @@ scripts are stored.
This is actually the value of the \fBtcl_library\fR
variable and may be changed by setting \fBtcl_library\fR.
.TP
-\fBinfo loaded \fR?\fIinterp\fR?
+\fBinfo loaded \fR?\fIinterp\fR? \fR?\fIpackage\fR?
.
-Returns a list describing all of the packages that have been loaded into
-\fIinterp\fR with the \fBload\fR command.
+Returns the filename loaded as part of \fIpackage\fR. If \fIpackage\fR
+is not specified, returns a list describing all of the packages
+that have been loaded into \fIinterp\fR with the \fBload\fR command.
Each list element is a sub-list with two elements consisting of the
name of the file from which the package was loaded and the name of
the package.
diff --git a/doc/package.n b/doc/package.n
index 47b2aa6..5687480 100644
--- a/doc/package.n
+++ b/doc/package.n
@@ -12,6 +12,7 @@
package \- Facilities for package loading and version control
.SH SYNOPSIS
.nf
+\fBpackage files\fR \fIpackage\fR
\fBpackage forget\fR ?\fIpackage package ...\fR?
\fBpackage ifneeded \fIpackage version\fR ?\fIscript\fR?
\fBpackage names\fR
@@ -43,6 +44,13 @@ primarily by system scripts that maintain the package database.
The behavior of the \fBpackage\fR command is determined by its first argument.
The following forms are permitted:
.TP
+\fBpackage files\fR \fIpackage\fR
+.
+Lists all files forming part of \fIpackage\fR. Auto-loaded files are not
+included in this list, only files which were directly sourced during package
+initialization. The list order corresponds with the order in which the
+files were sourced.
+.TP
\fBpackage forget\fR ?\fIpackage package ...\fR?
.
Removes all information about each specified package from this interpreter,
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 73bd36f..ec85741 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -1717,19 +1717,27 @@ InfoLoadedCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- const char *interpName;
+ const char *interpName, *packageName;
- if ((objc != 1) && (objc != 2)) {
- Tcl_WrongNumArgs(interp, 1, objv, "?interp?");
+ if (objc > 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "?interp? ?packageName?");
return TCL_ERROR;
}
- if (objc == 1) { /* Get loaded pkgs in all interpreters. */
+ if (objc < 2) { /* Get loaded pkgs in all interpreters. */
interpName = NULL;
} else { /* Get pkgs just in specified interp. */
interpName = TclGetString(objv[1]);
+ if (!interpName[0]) {
+ interpName = NULL;
+ }
+ }
+ if (objc < 3) { /* Get loaded files in all packages. */
+ packageName = NULL;
+ } else { /* Get pkgs just in specified interp. */
+ packageName = TclGetString(objv[2]);
}
- return TclGetLoadedPackages(interp, interpName);
+ return TclGetLoadedPackagesEx(interp, interpName, packageName);
}
/*
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 2572b2b..c06b197 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -989,8 +989,11 @@ TclNRSourceObjCmd(
{
const char *encodingName = NULL;
Tcl_Obj *fileName;
+ int result;
+ void **pkgFiles = NULL;
+ void *names = NULL;
- if (objc != 2 && objc !=4) {
+ if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "?-encoding name? fileName");
return TCL_ERROR;
}
@@ -1008,9 +1011,28 @@ TclNRSourceObjCmd(
return TCL_ERROR;
}
encodingName = TclGetString(objv[2]);
- }
+ } else if (objc == 3) {
+ static const char *const nopkgoptions[] = {
+ "-nopkg", NULL
+ };
+ int index;
- return TclNREvalFile(interp, fileName, encodingName);
+ if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1], nopkgoptions,
+ "option", TCL_EXACT, &index)) {
+ return TCL_ERROR;
+ }
+ pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
+ /* Make sure that during the following TclNREvalFile no filenames
+ * are recorded for inclusion in the "package files" command */
+ names = *pkgFiles;
+ *pkgFiles = NULL;
+ }
+ result = TclNREvalFile(interp, fileName, encodingName);
+ if (pkgFiles) {
+ /* restore "tclPkgFiles" assocdata to how it was. */
+ *pkgFiles = names;
+ }
+ return result;
}
/*
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index e3a6b2a..de5d62d 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1890,6 +1890,7 @@ TclNREvalFile(
Tcl_GetString(pathPtr), Tcl_PosixError(interp)));
return TCL_ERROR;
}
+ TclPkgFileSeen(interp, Tcl_GetString(pathPtr));
/*
* The eofchar is \32 (^Z). This is the usual on Windows, but we effect
diff --git a/generic/tclInt.h b/generic/tclInt.h
index ca8ad70..37908bc 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2974,6 +2974,9 @@ MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc,
Tcl_Obj *const objv[]);
MODULE_SCOPE char * TclGetStringStorage(Tcl_Obj *objPtr,
unsigned int *sizePtr);
+MODULE_SCOPE int TclGetLoadedPackagesEx(Tcl_Interp *interp,
+ const char *targetName,
+ const char *packageName);
MODULE_SCOPE int TclGlob(Tcl_Interp *interp, char *pattern,
Tcl_Obj *unquotedPrefix, int globFlags,
Tcl_GlobTypeData *types);
@@ -3100,6 +3103,8 @@ MODULE_SCOPE int TclpObjChdir(Tcl_Obj *pathPtr);
MODULE_SCOPE Tcl_Channel TclpOpenTemporaryFile(Tcl_Obj *dirObj,
Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
Tcl_Obj *resultingNameObj);
+MODULE_SCOPE void TclPkgFileSeen(Tcl_Interp *interp, const char *fileName);
+MODULE_SCOPE void *TclInitPkgFiles(Tcl_Interp *interp);
MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr,
Tcl_PathPart portion);
MODULE_SCOPE char * TclpReadlink(const char *fileName,
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 1bfe76a..7874de9 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -331,13 +331,24 @@ TclSetPreInitScript(
*----------------------------------------------------------------------
*/
+typedef struct PkgName {
+ struct PkgName *nextPtr; /* Next in list of package names being initialized. */
+ char name[4];
+} PkgName;
+
int
Tcl_Init(
Tcl_Interp *interp) /* Interpreter to initialize. */
{
+ PkgName pkgName = {NULL, "Tcl"};
+ PkgName **names = TclInitPkgFiles(interp);
+ int result = TCL_ERROR;
+
+ pkgName.nextPtr = *names;
+ *names = &pkgName;
if (tclPreInitScript != NULL) {
if (Tcl_EvalEx(interp, tclPreInitScript, -1, 0) == TCL_ERROR) {
- return TCL_ERROR;
+ goto end;
}
}
@@ -382,7 +393,7 @@ Tcl_Init(
* alternate tclInit command before calling Tcl_Init().
*/
- return Tcl_EvalEx(interp,
+ result = Tcl_EvalEx(interp,
"if {[namespace which -command tclInit] eq \"\"} {\n"
" proc tclInit {} {\n"
" global tcl_libPath tcl_library env tclDefaultLibrary\n"
@@ -445,6 +456,10 @@ Tcl_Init(
" }\n"
"}\n"
"tclInit", -1, 0);
+
+end:
+ *names = (*names)->nextPtr;
+ return result;
}
/*
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index be296b3..aabe3bb 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -998,7 +998,7 @@ Tcl_StaticPackage(
}
/*
- * Package isn't loade in the current interp yet. Mark it as now being
+ * Package isn't loaded in the current interp yet. Mark it as now being
* loaded.
*/
@@ -1012,7 +1012,7 @@ Tcl_StaticPackage(
/*
*----------------------------------------------------------------------
*
- * TclGetLoadedPackages --
+ * TclGetLoadedPackages, TclGetLoadedPackagesEx --
*
* This function returns information about all of the files that are
* loaded (either in a particular interpreter, or for all interpreters).
@@ -1039,6 +1039,21 @@ TclGetLoadedPackages(
* otherwise, just return info about this
* interpreter. */
{
+ return TclGetLoadedPackagesEx(interp, targetName, NULL);
+}
+
+int
+TclGetLoadedPackagesEx(
+ Tcl_Interp *interp, /* Interpreter in which to return information
+ * or error message. */
+ const char *targetName, /* Name of target interpreter or NULL. If
+ * NULL, return info about all interps;
+ * otherwise, just return info about this
+ * interpreter. */
+ const char *packageName) /* Package name or NULL. If NULL, return info
+ * all packages.
+ */
+{
Tcl_Interp *target;
LoadedPackage *pkgPtr;
InterpPackage *ipPtr;
@@ -1048,6 +1063,22 @@ TclGetLoadedPackages(
/*
* Return information about all of the available packages.
*/
+ if (packageName) {
+ resultObj = NULL;
+ Tcl_MutexLock(&packageMutex);
+ for (pkgPtr = firstPackagePtr; pkgPtr != NULL;
+ pkgPtr = pkgPtr->nextPtr) {
+ if (!strcmp(packageName, pkgPtr->packageName)) {
+ resultObj = Tcl_NewStringObj(pkgPtr->fileName, -1);
+ break;
+ }
+ }
+ Tcl_MutexUnlock(&packageMutex);
+ if (resultObj) {
+ Tcl_SetObjResult(interp, resultObj);
+ }
+ return TCL_OK;
+ }
resultObj = Tcl_NewObj();
Tcl_MutexLock(&packageMutex);
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index 244eb94..42dd08d 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -32,6 +32,17 @@ typedef struct PkgAvail {
* same package. */
} PkgAvail;
+typedef struct PkgName {
+ struct PkgName *nextPtr; /* Next in list of package names being initialized. */
+ char name[1];
+} PkgName;
+
+typedef struct PkgFiles {
+ PkgName *names; /* Package names being initialized. Must be first field*/
+ Tcl_HashTable table; /* Table which contains files for each package */
+} PkgFiles;
+
+
/*
* For each package that is known in any way to an interpreter, there is one
* record of the following type. These records are stored in the
@@ -81,7 +92,7 @@ static const char * PkgRequireCore(Tcl_Interp *interp, const char *name,
((v) = ckalloc(len), memcpy((v),(s),(len)))
#define DupString(v,s) \
do { \
- unsigned local__len = (unsigned) (strlen(s) + 1); \
+ size_t local__len = strlen(s) + 1; \
DupBlock((v),(s),local__len); \
} while (0)
@@ -189,6 +200,62 @@ Tcl_PkgProvideEx(
*----------------------------------------------------------------------
*/
+static void PkgFilesCleanupProc(ClientData clientData,
+ Tcl_Interp *interp)
+{
+ PkgFiles *pkgFiles = (PkgFiles *) clientData;
+ Tcl_HashSearch search;
+ Tcl_HashEntry *entry;
+
+ while (pkgFiles->names) {
+ PkgName *name = pkgFiles->names;
+ pkgFiles->names = name->nextPtr;
+ ckfree(name);
+ }
+ entry = Tcl_FirstHashEntry(&pkgFiles->table, &search);
+ while (entry) {
+ Tcl_Obj *obj = (Tcl_Obj *)Tcl_GetHashValue(entry);
+ Tcl_DecrRefCount(obj);
+ entry = Tcl_NextHashEntry(&search);
+ }
+ Tcl_DeleteHashTable(&pkgFiles->table);
+ return;
+}
+
+void *TclInitPkgFiles(Tcl_Interp *interp)
+{
+ /* If assocdata "tclPkgFiles" doesn't exist yet, create it */
+ PkgFiles *pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
+ if (!pkgFiles) {
+ pkgFiles = ckalloc(sizeof(PkgFiles));
+ pkgFiles->names = NULL;
+ Tcl_InitHashTable(&pkgFiles->table, TCL_STRING_KEYS);
+ Tcl_SetAssocData(interp, "tclPkgFiles", PkgFilesCleanupProc, pkgFiles);
+ }
+ return pkgFiles;
+}
+
+void TclPkgFileSeen(Tcl_Interp *interp, const char *fileName)
+{
+ PkgFiles *pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
+ if (pkgFiles && pkgFiles->names) {
+ const char *name = pkgFiles->names->name;
+ Tcl_HashTable *table = &pkgFiles->table;
+ int new;
+ Tcl_HashEntry *entry = Tcl_CreateHashEntry(table, name, &new);
+ Tcl_Obj *list;
+
+ if (new) {
+ list = Tcl_NewObj();
+ Tcl_SetHashValue(entry, list);
+ Tcl_IncrRefCount(list);
+ } else {
+ list = Tcl_GetHashValue(entry);
+ }
+ Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(fileName, -1));
+ }
+}
+
#undef Tcl_PkgRequire
const char *
Tcl_PkgRequire(
@@ -489,12 +556,23 @@ PkgRequireCore(
*/
char *versionToProvide = bestPtr->version;
+ PkgFiles *pkgFiles;
+ PkgName *pkgName;
script = bestPtr->script;
pkgPtr->clientData = versionToProvide;
- Tcl_Preserve(script);
Tcl_Preserve(versionToProvide);
+ Tcl_Preserve(script);
+ pkgFiles = TclInitPkgFiles(interp);
+ /* Push "ifneeded" package name in "tclPkgFiles" assocdata. */
+ pkgName = ckalloc(sizeof(PkgName) + strlen(name));
+ pkgName->nextPtr = pkgFiles->names;
+ strcpy(pkgName->name, name);
+ pkgFiles->names = pkgName;
code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL);
+ /* Pop the "ifneeded" package name from "tclPkgFiles" assocdata*/
+ pkgFiles->names = pkgName->nextPtr;
+ ckfree(pkgName);
Tcl_Release(script);
pkgPtr = FindPackage(interp, name);
@@ -764,14 +842,14 @@ Tcl_PackageObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const pkgOptions[] = {
- "forget", "ifneeded", "names", "prefer", "present",
- "provide", "require", "unknown", "vcompare", "versions",
- "vsatisfies", NULL
+ "files", "forget", "ifneeded", "names", "prefer",
+ "present", "provide", "require", "unknown", "vcompare",
+ "versions", "vsatisfies", NULL
};
enum pkgOptions {
- PKG_FORGET, PKG_IFNEEDED, PKG_NAMES, PKG_PREFER, PKG_PRESENT,
- PKG_PROVIDE, PKG_REQUIRE, PKG_UNKNOWN, PKG_VCOMPARE, PKG_VERSIONS,
- PKG_VSATISFIES
+ PKG_FILES, PKG_FORGET, PKG_IFNEEDED, PKG_NAMES, PKG_PREFER,
+ PKG_PRESENT, PKG_PROVIDE, PKG_REQUIRE, PKG_UNKNOWN, PKG_VCOMPARE,
+ PKG_VERSIONS, PKG_VSATISFIES
};
Interp *iPtr = (Interp *) interp;
int optionIndex, exact, i, satisfies;
@@ -794,11 +872,37 @@ Tcl_PackageObjCmd(
return TCL_ERROR;
}
switch ((enum pkgOptions) optionIndex) {
+ case PKG_FILES: {
+ PkgFiles *pkgFiles;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "package");
+ return TCL_ERROR;
+ }
+ pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
+ if (pkgFiles) {
+ Tcl_HashEntry *entry = Tcl_FindHashEntry(&pkgFiles->table, Tcl_GetString(objv[2]));
+ if (entry) {
+ Tcl_SetObjResult(interp, (Tcl_Obj *)Tcl_GetHashValue(entry));
+ }
+ }
+ break;
+ }
case PKG_FORGET: {
const char *keyString;
+ PkgFiles *pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
for (i = 2; i < objc; i++) {
keyString = TclGetString(objv[i]);
+ if (pkgFiles) {
+ hPtr = Tcl_FindHashEntry(&pkgFiles->table, keyString);
+ if (hPtr) {
+ Tcl_Obj *obj = Tcl_GetHashValue(hPtr);
+ Tcl_DeleteHashEntry(hPtr);
+ Tcl_DecrRefCount(obj);
+ }
+ }
+
hPtr = Tcl_FindHashEntry(&iPtr->packageTable, keyString);
if (hPtr == NULL) {
continue;
@@ -1220,7 +1324,7 @@ FindPackage(
void
TclFreePackageInfo(
- Interp *iPtr) /* Interpereter that is being deleted. */
+ Interp *iPtr) /* Interpreter that is being deleted. */
{
Package *pkgPtr;
Tcl_HashSearch search;
diff --git a/library/init.tcl b/library/init.tcl
index 544ea77..bac6270 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -483,7 +483,7 @@ proc auto_load_index {} {
set dir [lindex $auto_path $i]
set f ""
if {$issafe} {
- catch {source [file join $dir tclIndex]}
+ catch {source -nopkg [file join $dir tclIndex]}
} elseif {[catch {set f [open [file join $dir tclIndex]]}]} {
continue
} else {
diff --git a/library/package.tcl b/library/package.tcl
index 44e3b28..cb1bea6 100644
--- a/library/package.tcl
+++ b/library/package.tcl
@@ -488,7 +488,7 @@ proc tclPkgUnknown {name args} {
set dir [file dirname $file]
if {![info exists procdDirs($dir)]} {
try {
- source $file
+ source -nopkg $file
} trap {POSIX EACCES} {} {
# $file was not readable; silently ignore
continue
diff --git a/library/tclIndex b/library/tclIndex
index 26603c1..2762ce4 100644
--- a/library/tclIndex
+++ b/library/tclIndex
@@ -1,75 +1,75 @@
# Tcl autoload index file, version 2.0
# -*- tcl -*-
# This file is generated by the "auto_mkindex" command
-# and sourced to set up indexing information for one or
+# and source -nopkgd to set up indexing information for one or
# more commands. Typically each line is a command that
# sets an element in the auto_index array, where the
# element name is the name of a command and the value is
# a script that loads the command.
-set auto_index(auto_reset) [list source [file join $dir auto.tcl]]
-set auto_index(tcl_findLibrary) [list source [file join $dir auto.tcl]]
-set auto_index(auto_mkindex) [list source [file join $dir auto.tcl]]
-set auto_index(auto_mkindex_old) [list source [file join $dir auto.tcl]]
-set auto_index(::auto_mkindex_parser::init) [list source [file join $dir auto.tcl]]
-set auto_index(::auto_mkindex_parser::cleanup) [list source [file join $dir auto.tcl]]
-set auto_index(::auto_mkindex_parser::mkindex) [list source [file join $dir auto.tcl]]
-set auto_index(::auto_mkindex_parser::hook) [list source [file join $dir auto.tcl]]
-set auto_index(::auto_mkindex_parser::slavehook) [list source [file join $dir auto.tcl]]
-set auto_index(::auto_mkindex_parser::command) [list source [file join $dir auto.tcl]]
-set auto_index(::auto_mkindex_parser::commandInit) [list source [file join $dir auto.tcl]]
-set auto_index(::auto_mkindex_parser::fullname) [list source [file join $dir auto.tcl]]
-set auto_index(history) [list source [file join $dir history.tcl]]
-set auto_index(::tcl::HistAdd) [list source [file join $dir history.tcl]]
-set auto_index(::tcl::HistKeep) [list source [file join $dir history.tcl]]
-set auto_index(::tcl::HistClear) [list source [file join $dir history.tcl]]
-set auto_index(::tcl::HistInfo) [list source [file join $dir history.tcl]]
-set auto_index(::tcl::HistRedo) [list source [file join $dir history.tcl]]
-set auto_index(::tcl::HistIndex) [list source [file join $dir history.tcl]]
-set auto_index(::tcl::HistEvent) [list source [file join $dir history.tcl]]
-set auto_index(::tcl::HistChange) [list source [file join $dir history.tcl]]
-set auto_index(pkg_mkIndex) [list source [file join $dir package.tcl]]
-set auto_index(tclPkgSetup) [list source [file join $dir package.tcl]]
-set auto_index(tclPkgUnknown) [list source [file join $dir package.tcl]]
-set auto_index(::tcl::MacOSXPkgUnknown) [list source [file join $dir package.tcl]]
-set auto_index(::pkg::create) [list source [file join $dir package.tcl]]
-set auto_index(parray) [list source [file join $dir parray.tcl]]
-set auto_index(::safe::InterpStatics) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::InterpNested) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::interpCreate) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::interpInit) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::CheckInterp) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::interpConfigure) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::InterpCreate) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::InterpSetConfig) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::interpFindInAccessPath) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::interpAddToAccessPath) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::InterpInit) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::AddSubDirs) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::interpDelete) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::setLogCmd) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::SyncAccessPath) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::PathToken) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::TranslatePath) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::Log) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::CheckFileName) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::AliasGlob) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::AliasSource) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::AliasLoad) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::FileInAccessPath) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::DirInAccessPath) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::Subset) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::AliasSubset) [list source [file join $dir safe.tcl]]
-set auto_index(::safe::AliasEncoding) [list source [file join $dir safe.tcl]]
-set auto_index(tcl_wordBreakAfter) [list source [file join $dir word.tcl]]
-set auto_index(tcl_wordBreakBefore) [list source [file join $dir word.tcl]]
-set auto_index(tcl_endOfWord) [list source [file join $dir word.tcl]]
-set auto_index(tcl_startOfNextWord) [list source [file join $dir word.tcl]]
-set auto_index(tcl_startOfPreviousWord) [list source [file join $dir word.tcl]]
-set auto_index(::tcl::tm::add) [list source [file join $dir tm.tcl]]
-set auto_index(::tcl::tm::remove) [list source [file join $dir tm.tcl]]
-set auto_index(::tcl::tm::list) [list source [file join $dir tm.tcl]]
-set auto_index(::tcl::tm::Defaults) [list source [file join $dir tm.tcl]]
-set auto_index(::tcl::tm::UnknownHandler) [list source [file join $dir tm.tcl]]
-set auto_index(::tcl::tm::roots) [list source [file join $dir tm.tcl]]
-set auto_index(::tcl::tm::path) [list source [file join $dir tm.tcl]]
+set auto_index(auto_reset) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(tcl_findLibrary) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(auto_mkindex) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(auto_mkindex_old) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(::auto_mkindex_parser::init) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(::auto_mkindex_parser::cleanup) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(::auto_mkindex_parser::mkindex) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(::auto_mkindex_parser::hook) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(::auto_mkindex_parser::slavehook) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(::auto_mkindex_parser::command) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(::auto_mkindex_parser::commandInit) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(::auto_mkindex_parser::fullname) [list source -nopkg [file join $dir auto.tcl]]
+set auto_index(history) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(::tcl::HistAdd) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(::tcl::HistKeep) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(::tcl::HistClear) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(::tcl::HistInfo) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(::tcl::HistRedo) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(::tcl::HistIndex) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(::tcl::HistEvent) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(::tcl::HistChange) [list source -nopkg [file join $dir history.tcl]]
+set auto_index(pkg_mkIndex) [list source -nopkg [file join $dir package.tcl]]
+set auto_index(tclPkgSetup) [list source -nopkg [file join $dir package.tcl]]
+set auto_index(tclPkgUnknown) [list source -nopkg [file join $dir package.tcl]]
+set auto_index(::tcl::MacOSXPkgUnknown) [list source -nopkg [file join $dir package.tcl]]
+set auto_index(::pkg::create) [list source -nopkg [file join $dir package.tcl]]
+set auto_index(parray) [list source -nopkg [file join $dir parray.tcl]]
+set auto_index(::safe::InterpStatics) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::InterpNested) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::interpCreate) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::interpInit) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::CheckInterp) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::interpConfigure) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::InterpCreate) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::InterpSetConfig) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::interpFindInAccessPath) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::interpAddToAccessPath) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::InterpInit) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::AddSubDirs) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::interpDelete) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::setLogCmd) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::SyncAccessPath) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::PathToken) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::TranslatePath) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::Log) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::CheckFileName) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::AliasGlob) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::AliasSource) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::AliasLoad) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::FileInAccessPath) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::DirInAccessPath) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::Subset) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::AliasSubset) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(::safe::AliasEncoding) [list source -nopkg [file join $dir safe.tcl]]
+set auto_index(tcl_wordBreakAfter) [list source -nopkg [file join $dir word.tcl]]
+set auto_index(tcl_wordBreakBefore) [list source -nopkg [file join $dir word.tcl]]
+set auto_index(tcl_endOfWord) [list source -nopkg [file join $dir word.tcl]]
+set auto_index(tcl_startOfNextWord) [list source -nopkg [file join $dir word.tcl]]
+set auto_index(tcl_startOfPreviousWord) [list source -nopkg [file join $dir word.tcl]]
+set auto_index(::tcl::tm::add) [list source -nopkg [file join $dir tm.tcl]]
+set auto_index(::tcl::tm::remove) [list source -nopkg [file join $dir tm.tcl]]
+set auto_index(::tcl::tm::list) [list source -nopkg [file join $dir tm.tcl]]
+set auto_index(::tcl::tm::Defaults) [list source -nopkg [file join $dir tm.tcl]]
+set auto_index(::tcl::tm::UnknownHandler) [list source -nopkg [file join $dir tm.tcl]]
+set auto_index(::tcl::tm::roots) [list source -nopkg [file join $dir tm.tcl]]
+set auto_index(::tcl::tm::path) [list source -nopkg [file join $dir tm.tcl]]
diff --git a/tests/info.test b/tests/info.test
index a6a5919..fd89b47 100644
--- a/tests/info.test
+++ b/tests/info.test
@@ -397,8 +397,8 @@ test info-10.3 {info library option} -body {
set tcl_library $savedLibrary; unset savedLibrary
test info-11.1 {info loaded option} -body {
- info loaded a b
-} -returnCodes error -result {wrong # args: should be "info loaded ?interp?"}
+ info loaded a b c
+} -returnCodes error -result {wrong # args: should be "info loaded ?interp? ?packageName?"}
test info-11.2 {info loaded option} -body {
info loaded {}; info loaded gorp
} -returnCodes error -result {could not find interpreter "gorp"}
diff --git a/tests/load.test b/tests/load.test
index 7c4b47f..94451e9 100644
--- a/tests/load.test
+++ b/tests/load.test
@@ -197,14 +197,14 @@ test load-8.2 {TclGetLoadedPackages procedure} -body {
} -returnCodes error -result {could not find interpreter "gorp"}
test load-8.3a {TclGetLoadedPackages procedure} [list teststaticpkg $dll $loaded] {
lsort -index 1 [info loaded {}]
-} [lsort -index 1 [list {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga] [list [file join $testDir pkgb$ext] Pkgb] {*}$alreadyLoaded]]
+} [lsort -index 1 [list {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga] [list [file join $testDir pkgb$ext] Pkgb] [list [file join $testDir pkge$ext] Pkge] {*}$alreadyLoaded]]
test load-8.3b {TclGetLoadedPackages procedure} [list teststaticpkg $dll $loaded] {
lsort -index 1 [info loaded child]
} [lsort -index 1 [list {{} Test} [list [file join $testDir pkgb$ext] Pkgb]]]
test load-8.4 {TclGetLoadedPackages procedure} [list $dll $loaded teststaticpkg] {
load [file join $testDir pkgb$ext] pkgb
list [lsort -index 1 [info loaded {}]] [lsort [info commands pkgb_*]]
-} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}]
+} [list [lsort -index 1 [concat [list [list [file join $testDir pkgb$ext] Pkgb] [list [file join $testDir pkge$ext] Pkge] {{} Double} {{} More} {{} Another} {{} Test} [list [file join $testDir pkga$ext] Pkga]] $alreadyLoaded]] {pkgb_demo pkgb_sub pkgb_unsafe}]
interp delete child
test load-9.1 {Tcl_StaticPackage, load already-loaded package into another interp} \
diff --git a/tests/package.test b/tests/package.test
index 49346d8..55bba8a 100644
--- a/tests/package.test
+++ b/tests/package.test
@@ -55,8 +55,8 @@ test package-1.7 {pkg::create gives correct output for 1 direct source} {
::pkg::create -name foo -version 1.0 -source test.tcl
} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]}
test package-1.8 {pkg::create gives correct output for 2 direct sources} {
- ::pkg::create -name foo -version 1.0 -source test.tcl -source test2.tcl
-} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list source [file join $dir test2.tcl]]}
+ list [::pkg::create -name foo -version 1.0 -source test.tcl -source test2.tcl] [package files foo]
+} {{package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list source [file join $dir test2.tcl]]} {}}
test package-1.9 {pkg::create gives correct output for 1 direct load} {
::pkg::create -name foo -version 1.0 -load test.so
} {package ifneeded foo 1.0 [list load [file join $dir test.so]]}
@@ -832,7 +832,7 @@ test package-4.52 {Tcl_PackageCmd procedure, "vsatisfies" option} {
} {0}
test package-4.53 {Tcl_PackageCmd procedure, "versions" option} -body {
package foo
-} -returnCodes error -result {bad option "foo": must be forget, ifneeded, names, prefer, present, provide, require, unknown, vcompare, versions, or vsatisfies}
+} -returnCodes error -result {bad option "foo": must be files, forget, ifneeded, names, prefer, present, provide, require, unknown, vcompare, versions, or vsatisfies}
test package-4.54 {Tcl_PackageCmd procedure, "vsatisfies" option} -body {
package vsatisfies 2.1 2.1-3.2-4.5
} -returnCodes error -result {expected versionMin-versionMax but got "2.1-3.2-4.5"}
@@ -870,6 +870,14 @@ test package-5.2 {TclFreePackageInfo procedure} -body {
}
foo eval package require x 3.1
} -returnCodes error -match glob -result *
+test package-5.3 {package files} -body {
+ interp create foo
+ foo eval {
+ package ifneeded t 2.4 {package provide t 2.4;package require http}
+ }
+ foo eval package require t 2.4
+ foo eval {list [package files http] [package files t]}
+} -result {{} {}}
test package-6.1 {CheckVersion procedure} {
package vcompare 1 2.1