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