|Home Manuel Links Faq Some examples tcl/tk codes Man of Bwidget with screenshot Man of blt with screenshot|
Storage management is facilitated by storing with each association a procedure to call when the interpreter is deleted. This procedure can dispose of the storage occupied by the client's data in any way it sees fit.
Tcl_SetAssocData creates an association between a string key and a user specified datum in the given interpreter. If there is already an association with the given key, Tcl_SetAssocData 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 deleteProc argument is non-NULL it specifies the address of a procedure to invoke if the interpreter is deleted before the association is deleted. DeleteProc should have arguments and result that match the type Tcl_InterpDeleteProc:
typedef void Tcl_InterpDeleteProc( ClientData clientData, Tcl_Interp *interp);When deleteProc is invoked the clientData and interp arguments will be the same as the corresponding arguments passed to Tcl_SetAssocData. The deletion procedure will not be invoked if the association is deleted before the interpreter is deleted.
Tcl_GetAssocData returns the datum stored in the association with the specified key in the given interpreter, and if the delProcPtr field is non-NULL, the address indicated by it gets the address of the delete procedure stored with this association. If no association with the specified key exists in the given interpreter Tcl_GetAssocData returns NULL.
Tcl_DeleteAssocData deletes an association with a specified key in the given interpreter. Then it calls the deletion procedure.
Copyright © 1995-1996 Sun Microsystems, Inc. Copyright © 1995-1997 Roger E. Critchlow Jr.Erreur (1146) : Table 'tcltk.tcltksamplemancode' doesn't exist