| 1 |
'\" |
| 2 |
'\" Copyright (c) 1996 Sun Microsystems, Inc. |
| 3 |
'\" |
| 4 |
'\" See the file "license.terms" for information on usage and redistribution |
| 5 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 6 |
'\" |
| 7 |
.TH Tcl_PkgRequire 3 7.5 Tcl "Tcl Library Procedures" |
| 8 |
.so man.macros |
| 9 |
.BS |
| 10 |
.SH NAME |
| 11 |
Tcl_PkgRequire, Tcl_PkgRequireEx, Tcl_PkgRequireProc, Tcl_PkgPresent, Tcl_PkgPresentEx, Tcl_PkgProvide, Tcl_PkgProvideEx \- package version control |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
\fB#include <tcl.h>\fR |
| 15 |
.sp |
| 16 |
const char * |
| 17 |
\fBTcl_PkgRequire\fR(\fIinterp, name, version, exact\fR) |
| 18 |
.sp |
| 19 |
const char * |
| 20 |
\fBTcl_PkgRequireEx\fR(\fIinterp, name, version, exact, clientDataPtr\fR) |
| 21 |
.sp |
| 22 |
int |
| 23 |
\fBTcl_PkgRequireProc\fR(\fIinterp, name, objc, objv, clientDataPtr\fR) |
| 24 |
.sp |
| 25 |
const char * |
| 26 |
\fBTcl_PkgPresent\fR(\fIinterp, name, version, exact\fR) |
| 27 |
.sp |
| 28 |
const char * |
| 29 |
\fBTcl_PkgPresentEx\fR(\fIinterp, name, version, exact, clientDataPtr\fR) |
| 30 |
.sp |
| 31 |
int |
| 32 |
\fBTcl_PkgProvide\fR(\fIinterp, name, version\fR) |
| 33 |
.sp |
| 34 |
int |
| 35 |
\fBTcl_PkgProvideEx\fR(\fIinterp, name, version, clientData\fR) |
| 36 |
.SH ARGUMENTS |
| 37 |
.AS void *clientDataPtr out |
| 38 |
.AP Tcl_Interp *interp in |
| 39 |
Interpreter where package is needed or available. |
| 40 |
.AP "const char" *name in |
| 41 |
Name of package. |
| 42 |
.AP "const char" *version in |
| 43 |
A version specification string as described for \fBpackage require\fR. |
| 44 |
.AP int exact in |
| 45 |
Non-zero means that only the particular version specified by |
| 46 |
\fIversion\fR is acceptable. |
| 47 |
Zero means that newer versions than \fIversion\fR are also |
| 48 |
acceptable as long as they have the same major version number |
| 49 |
as \fIversion\fR. |
| 50 |
.AP "const void" *clientData in |
| 51 |
Arbitrary value to be associated with the package. |
| 52 |
.AP void *clientDataPtr out |
| 53 |
Pointer to place to store the value associated with the matching |
| 54 |
package. It is only changed if the pointer is not NULL and the |
| 55 |
function completed successfully. The storage can be any pointer |
| 56 |
type with the same size as a void pointer. |
| 57 |
.AP int objc in |
| 58 |
Number of requirements. |
| 59 |
.AP Tcl_Obj* objv[] in |
| 60 |
Array of requirements. |
| 61 |
.BE |
| 62 |
.SH DESCRIPTION |
| 63 |
.PP |
| 64 |
These procedures provide C-level interfaces to Tcl's package and |
| 65 |
version management facilities. |
| 66 |
.PP |
| 67 |
\fBTcl_PkgRequire\fR is equivalent to the \fBpackage require\fR |
| 68 |
command, \fBTcl_PkgPresent\fR is equivalent to the \fBpackage present\fR |
| 69 |
command, and \fBTcl_PkgProvide\fR is equivalent to the |
| 70 |
\fBpackage provide\fR command. |
| 71 |
.PP |
| 72 |
See the documentation for the Tcl commands for details on what these |
| 73 |
procedures do. |
| 74 |
.PP |
| 75 |
If \fBTcl_PkgPresent\fR or \fBTcl_PkgRequire\fR complete successfully |
| 76 |
they return a pointer to the version string for the version of the package |
| 77 |
that is provided in the interpreter (which may be different than |
| 78 |
\fIversion\fR); if an error occurs they return NULL and leave an error |
| 79 |
message in the interpreter's result. |
| 80 |
.PP |
| 81 |
\fBTcl_PkgProvide\fR returns \fBTCL_OK\fR if it completes successfully; |
| 82 |
if an error occurs it returns \fBTCL_ERROR\fR and leaves an error message |
| 83 |
in the interpreter's result. |
| 84 |
.PP |
| 85 |
\fBTcl_PkgProvideEx\fR, \fBTcl_PkgPresentEx\fR and \fBTcl_PkgRequireEx\fR |
| 86 |
allow the setting and retrieving of the client data associated with |
| 87 |
the package. In all other respects they are equivalent to the matching |
| 88 |
functions. |
| 89 |
.PP |
| 90 |
\fBTcl_PkgRequireProc\fR is the form of \fBpackage require\fR handling |
| 91 |
multiple requirements. The other forms are present for backward |
| 92 |
compatibility and translate their invocations to this form. |
| 93 |
.SH KEYWORDS |
| 94 |
package, present, provide, require, version |
| 95 |
.SH "SEE ALSO" |
| 96 |
package(n), Tcl_StaticPackage(3) |