📄 assocdata.3
字号:
'\"'\" Copyright (c) 1995-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" '\" SCCS: @(#) AssocData.3 1.8 96/03/25 19:56:17.so man.macros.TH Tcl_SetAssocData 3 7.5 Tcl "Tcl Library Procedures".BS.SH NAMETcl_GetAssocData, Tcl_SetAssocData, Tcl_DeleteAssocData \- manageassociations of string keys and user specified data with Tclinterpreters..SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spClientData\fBTcl_GetAssocData\fR(\fIinterp, key, delProcPtr\fR).sp\fBTcl_SetAssocData\fR(\fIinterp, key, delProc, clientData\fR).sp\fBTcl_DeleteAssocData\fR(\fIinterp, key\fR).SH ARGUMENTS.AS Tcl_InterpDeleteProc *delProcPtr.AP Tcl_Interp *interp inInterpreter in which to execute the specified command..AP char *key inKey for association with which to store data or from which to delete orretrieve data. Typically the module prefix for a package..AP Tcl_InterpDeleteProc *delProc inProcedure to call when \fIinterp\fR is deleted..AP Tcl_InterpDeleteProc **delProcPtr inPointer to location in which to store address of current deletion procedurefor association. Ignored if NULL..AP ClientData clientData inArbitrary one-word value associated with the given key in thisinterpreter. This data is owned by the caller..BE.SH DESCRIPTION.PPThese procedures allow extensions to associate their own data witha Tcl interpreter.An association consists of a string key, typically the name ofthe extension, and a one-word value, which is typically a pointerto a data structure holding data specific to the extension.Tcl makes no interpretation of either the key or the value foran association..PPStorage management is facilitated by storing with each association aprocedure to call when the interpreter is deleted. Thisprocedure can dispose of the storage occupied by the client's data in anyway it sees fit..PP\fBTcl_SetAssocData\fR creates an association between a stringkey and a user specified datum in the given interpreter.If there is already an association with the given \fIkey\fR,\fBTcl_SetAssocData\fR overwrites it with the new information.It is up to callers to organize their use of names to avoid conflicts,for example, by using package names as the keys.If the \fIdeleteProc\fR argument is non-NULL it specifies the address of aprocedure to invoke if the interpreter is deleted before the associationis deleted. \fIDeleteProc\fR should have arguments and result that matchthe type \fBTcl_InterpDeleteProc\fR:.CStypedef void Tcl_InterpDeleteProc( ClientData \fIclientData\fR, Tcl_Interp *\fIinterp\fR);.CEWhen \fIdeleteProc\fR is invoked the \fIclientData\fR and \fIinterp\fRarguments will be the same as the corresponding arguments passed to\fBTcl_SetAssocData\fR.The deletion procedure will \fInot\fR be invoked if the associationis deleted before the interpreter is deleted..PP\fBTcl_GetAssocData\fR returns the datum stored in the association with thespecified key in the given interpreter, and if the \fIdelProcPtr\fR fieldis non-\fBNULL\fR, the address indicated by it gets the address of thedelete procedure stored with this association. If no association with thespecified key exists in the given interpreter \fBTcl_GetAssocData\fRreturns \fBNULL\fR..PP\fBTcl_DeleteAssocData\fR deletes an association with a specified key inthe given interpreter. It does not call the deletion procedure..SH KEYWORDSassociation, data, deletion procedure, interpreter, key
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -