1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1995-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 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: AssocData.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
|
9 |
|
|
.so man.macros
|
10 |
|
|
.TH Tcl_SetAssocData 3 7.5 Tcl "Tcl Library Procedures"
|
11 |
|
|
.BS
|
12 |
|
|
.SH NAME
|
13 |
|
|
Tcl_GetAssocData, Tcl_SetAssocData, Tcl_DeleteAssocData \- manage
|
14 |
|
|
associations of string keys and user specified data with Tcl
|
15 |
|
|
interpreters.
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
.nf
|
18 |
|
|
\fB#include \fR
|
19 |
|
|
.sp
|
20 |
|
|
ClientData
|
21 |
|
|
\fBTcl_GetAssocData\fR(\fIinterp, key, delProcPtr\fR)
|
22 |
|
|
.sp
|
23 |
|
|
\fBTcl_SetAssocData\fR(\fIinterp, key, delProc, clientData\fR)
|
24 |
|
|
.sp
|
25 |
|
|
\fBTcl_DeleteAssocData\fR(\fIinterp, key\fR)
|
26 |
|
|
.SH ARGUMENTS
|
27 |
|
|
.AS Tcl_InterpDeleteProc *delProcPtr
|
28 |
|
|
.AP Tcl_Interp *interp in
|
29 |
|
|
Interpreter in which to execute the specified command.
|
30 |
|
|
.AP char *key in
|
31 |
|
|
Key for association with which to store data or from which to delete or
|
32 |
|
|
retrieve data. Typically the module prefix for a package.
|
33 |
|
|
.AP Tcl_InterpDeleteProc *delProc in
|
34 |
|
|
Procedure to call when \fIinterp\fR is deleted.
|
35 |
|
|
.AP Tcl_InterpDeleteProc **delProcPtr in
|
36 |
|
|
Pointer to location in which to store address of current deletion procedure
|
37 |
|
|
for association. Ignored if NULL.
|
38 |
|
|
.AP ClientData clientData in
|
39 |
|
|
Arbitrary one-word value associated with the given key in this
|
40 |
|
|
interpreter. This data is owned by the caller.
|
41 |
|
|
.BE
|
42 |
|
|
|
43 |
|
|
.SH DESCRIPTION
|
44 |
|
|
.PP
|
45 |
|
|
These procedures allow extensions to associate their own data with
|
46 |
|
|
a Tcl interpreter.
|
47 |
|
|
An association consists of a string key, typically the name of
|
48 |
|
|
the extension, and a one-word value, which is typically a pointer
|
49 |
|
|
to a data structure holding data specific to the extension.
|
50 |
|
|
Tcl makes no interpretation of either the key or the value for
|
51 |
|
|
an association.
|
52 |
|
|
.PP
|
53 |
|
|
Storage management is facilitated by storing with each association a
|
54 |
|
|
procedure to call when the interpreter is deleted. This
|
55 |
|
|
procedure can dispose of the storage occupied by the client's data in any
|
56 |
|
|
way it sees fit.
|
57 |
|
|
.PP
|
58 |
|
|
\fBTcl_SetAssocData\fR creates an association between a string
|
59 |
|
|
key and a user specified datum in the given interpreter.
|
60 |
|
|
If there is already an association with the given \fIkey\fR,
|
61 |
|
|
\fBTcl_SetAssocData\fR overwrites it with the new information.
|
62 |
|
|
It is up to callers to organize their use of names to avoid conflicts,
|
63 |
|
|
for example, by using package names as the keys.
|
64 |
|
|
If the \fIdeleteProc\fR argument is non-NULL it specifies the address of a
|
65 |
|
|
procedure to invoke if the interpreter is deleted before the association
|
66 |
|
|
is deleted. \fIDeleteProc\fR should have arguments and result that match
|
67 |
|
|
the type \fBTcl_InterpDeleteProc\fR:
|
68 |
|
|
.CS
|
69 |
|
|
typedef void Tcl_InterpDeleteProc(
|
70 |
|
|
ClientData \fIclientData\fR,
|
71 |
|
|
Tcl_Interp *\fIinterp\fR);
|
72 |
|
|
.CE
|
73 |
|
|
When \fIdeleteProc\fR is invoked the \fIclientData\fR and \fIinterp\fR
|
74 |
|
|
arguments will be the same as the corresponding arguments passed to
|
75 |
|
|
\fBTcl_SetAssocData\fR.
|
76 |
|
|
The deletion procedure will \fInot\fR be invoked if the association
|
77 |
|
|
is deleted before the interpreter is deleted.
|
78 |
|
|
.PP
|
79 |
|
|
\fBTcl_GetAssocData\fR returns the datum stored in the association with the
|
80 |
|
|
specified key in the given interpreter, and if the \fIdelProcPtr\fR field
|
81 |
|
|
is non-\fBNULL\fR, the address indicated by it gets the address of the
|
82 |
|
|
delete procedure stored with this association. If no association with the
|
83 |
|
|
specified key exists in the given interpreter \fBTcl_GetAssocData\fR
|
84 |
|
|
returns \fBNULL\fR.
|
85 |
|
|
.PP
|
86 |
|
|
\fBTcl_DeleteAssocData\fR deletes an association with a specified key in
|
87 |
|
|
the given interpreter. It does not call the deletion procedure.
|
88 |
|
|
.SH KEYWORDS
|
89 |
|
|
association, data, deletion procedure, interpreter, key
|