diff options
author | welch <welch> | 1998-12-02 20:07:52 (GMT) |
---|---|---|
committer | welch <welch> | 1998-12-02 20:07:52 (GMT) |
commit | 32a79b2ff96bfafd432e5aa9c1de68fdaa028544 (patch) | |
tree | 43c0af64380a54e6b8326d1712821de3ed40d8bf /doc | |
parent | 268b0e0536f8b73a091b695841708ebe48c4606b (diff) | |
download | tcl-32a79b2ff96bfafd432e5aa9c1de68fdaa028544.zip tcl-32a79b2ff96bfafd432e5aa9c1de68fdaa028544.tar.gz tcl-32a79b2ff96bfafd432e5aa9c1de68fdaa028544.tar.bz2 |
8.0.4 merge
Diffstat (limited to 'doc')
-rw-r--r-- | doc/pkgMkIndex.n | 74 |
1 files changed, 46 insertions, 28 deletions
diff --git a/doc/pkgMkIndex.n b/doc/pkgMkIndex.n index 2c7fa0f..b89ee53 100644 --- a/doc/pkgMkIndex.n +++ b/doc/pkgMkIndex.n @@ -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: pkgMkIndex.n,v 1.1.2.3 1998/11/11 04:08:14 stanton Exp $ +'\" RCS: @(#) $Id: pkgMkIndex.n,v 1.1.2.4 1998/12/02 20:08:03 welch Exp $ '\" .so man.macros .TH pkg_mkIndex n 8.0 Tcl "Tcl Built-In Commands" @@ -15,7 +15,7 @@ pkg_mkIndex \- Build an index for automatic loading of packages .SH SYNOPSIS .nf .VS 8.0.3 -\fBpkg_mkIndex ?\fI-direct\fR? ?\fI-verbose\fR? \fIdir\fR ?\fIpattern pattern ...\fR? +\fBpkg_mkIndex ?\fI-direct\fR? ?\fI-load pkgPat\fR? ?\fI-verbose\fR? \fIdir\fR ?\fIpattern pattern ...\fR? .VE .fi .BE @@ -43,24 +43,22 @@ The \fIdir\fR argument gives the name of a directory and each script or binary files in \fIdir\fR. .VS 8.0.3 The default pattern is \fB*.tcl\fR and \fB*.[info sharedlibextension]\fR. -If the optional \fI-direct\fR argument is given, the generated index -will manage to load the package immediately upon \fBpackage require\fR -instead of delaying loading until actual use of one of the commands. .VE -.RS -.LP +.sp 1 \fBPkg_mkIndex\fR will create a file \fBpkgIndex.tcl\fR in \fIdir\fR with package information about all the files given by the \fIpattern\fR arguments. -It does this by loading each file and seeing what packages +It does this by loading each file into a slave +interpreter and seeing what packages and new commands appear (this is why it is essential to have \fBpackage provide\fR commands or \fBTcl_PkgProvide\fR calls in the files, as described above). If you have a package split among scripts and binary files, or if you have dependencies among files, -you may have to adjust the order in which \fBpkg_mkIndex\fR processes +you may have to use the \fB-load\fP option +or adjust the order in which \fBpkg_mkIndex\fR processes the files. See COMPLEX CASES below. -.RE + .IP [3] Install the package as a subdirectory of one of the directories given by the \fBtcl_pkgPath\fR variable. If \fB$tcl_pkgPath\fR contains more @@ -74,8 +72,7 @@ the package's script and/or binary files as well as the \fBpkgIndex.tcl\fR file. As long as the package is installed as a subdirectory of a directory in \fB$tcl_pkgPath\fR it will automatically be found during \fBpackage require\fR commands. -.RS -.LP +.sp 1 If you install the package anywhere else, then you must ensure that the directory containing the package is in the \fBauto_path\fR global variable or an immediate subdirectory of one of the directories in \fBauto_path\fR. @@ -88,7 +85,6 @@ You can add a directory to \fBauto_path\fR explicitly in your application, or you can add the directory to your \fBTCLLIBPATH\fR environment variable: if this environment variable is present, Tcl initializes \fBauto_path\fR from it during application startup. -.RE .IP [4] Once the above steps have been taken, all you need to do to use a package is to invoke \fBpackage require\fR. @@ -103,6 +99,27 @@ interpreter, based on the first call to \fBpackage require\fR. Different versions of a package may be loaded in different interpreters. +.SH OPTIONS +The optional switches are: +.TP 15 +\fB\-direct\fR +The generated index +will manage to load the package immediately upon \fBpackage require\fR +instead of delaying loading until actual use of one of the commands. +.TP 15 +\fB\-load \fIpkgPat\fR +The index process will pre-load any packages that exist in the +current interpreter and match \fIpkgPat\fP into the slave interpreter used to +generate the index. The pattern match uses string match rules. +See COMPLEX CASES below. +.TP 15 +\fB\-verbose\fR +Generate output during the indexing process. Output is via +the \fBtclLog\fP procedure, which by default prints to stderr. +.TP 15 +\fB\-\-\fR +End of the flags, in case \fIdir\fP begins with a dash. + .SH "PACKAGES AND THE AUTO-LOADER" .PP The package management facilities overlap somewhat with the auto-loader, @@ -168,8 +185,6 @@ Most complex cases of dependencies among scripts and binary files, and packages being split among scripts and binary files are handled OK. However, you may have to adjust the order in which files are processed by \fBpkg_mkIndex\fR. -The only case that is not supported is a package that is -provided by more than one binary file. These issues are described in detail below. .PP If each script or file contains one package, and packages @@ -190,12 +205,16 @@ also bad coding style. .PP If binary files have dependencies on other packages, things can become tricky because it is not possible to stub out -the C-level \fBTcl_PkgRequire\fP API. +C-level API's such as \fBTcl_PkgRequire\fP API +when loading a binary file. For example, suppose the BLT package requires Tk, and expresses this with a call to \fBTcl_PkgRequire\fP in its \fBBlt_Init\fP routine. -To support this, you must run \fBpkg_mkIndex\fR in a shell that -has Tk loaded. \fBpkg_mkIndex\fR will load any packages listed by -\fBinfo loaded\fP into the interpreter used to process files. +To support this, you must run \fBpkg_mkIndex\fR in an interpreter that +has Tk loaded. You can achieve this with the +\fB-load \fIpkgPat\fR option. If you specify this option, +\fBpkg_mkIndex\fR will load any packages listed by +\fBinfo loaded\fP and that match \fIpkgPat\fP +into the interpreter used to process files. In most cases this will satisfy the \fBTcl_PkgRequire\fP calls made by binary files. .PP @@ -204,17 +223,16 @@ you should specify the one that has dependencies last. This way the one without dependencies will get loaded and indexed, and then the package it provides will be available when the second file is processed. -.PP -You cannot have the same package provided by two different binary -files. Well, you can, but they cannot be indexed by \fBpkg_mkIndex\fR -and it seems like a poor design choice anyway. The problem is that -once the package is provided by the first binary file, then that -masks the provide made by the other binary file. If you -absolutely must do this, you'll have to run \fBpkg_mkIndex\fR on -each different file, save the resulting pkgIndex.tcl files, -and merge the results. +You may also need to load the first package into the +temporary interpreter used to create the index by using +the \fB-load\fP flag; +it won't hurt to specify package patterns that are not yet loaded. .PP If you have a package that is split across scripts and a binary file, +then you should avoid the \fB-load\fP flag. The problem is that +if you load a package before computing the index it masks any +other files that provide part of the same package. +If you must use \fB-load\fP, then you must specify the scripts first; otherwise the package loaded from the binary file may mask the package defined by the scripts. |