Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/AssocData.3 @ 25

Last change on this file since 25 was 25, checked in by landauf, 16 years ago

added tcl to libs

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