Tcl_SetAssocData (3)
manage
associations of string keys and user specified data with Tcl
interpreters.
SYNOPSIS
#include <tcl.h>
ClientData
Tcl_GetAssocData(interp, key, delProcPtr)
Tcl_SetAssocData(interp, key, delProc, clientData)
Tcl_DeleteAssocData(interp, key)
ARGUMENTS
Tcl_InterpDeleteProc *delProcPtr
Tcl_Interp *interp in
Interpreter in which to execute the specified command.
char *key in
Key for association with which to store data or from which to delete or
retrieve data. Typically the module prefix for a package.
Tcl_InterpDeleteProc *delProc in
Procedure to call when interp is deleted.
Tcl_InterpDeleteProc **delProcPtr in
Pointer to location in which to store address of current deletion procedure
for association. Ignored if NULL.
ClientData clientData in
Arbitrary one-word value associated with the given key in this
interpreter. This data is owned by the caller.
DESCRIPTION
These procedures allow extensions to associate their own data with
a Tcl interpreter.
An association consists of a string key, typically the name of
the extension, and a one-word value, which is typically a pointer
to a data structure holding data specific to the extension.
Tcl makes no interpretation of either the key or the value for
an association.
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. It does not call the deletion procedure.
KEYWORDS
association, data, deletion procedure, interpreter, key
'\"
'\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: BoolObj.3,v 1.2 1998/09/14 18:39:46 stanton Exp $
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\" Start paragraph describing an argument to a library procedure.
'\" type is type of argument (int, etc.), in/out is either "in", "out",
'\" or "in/out" to describe whether procedure reads or modifies arg,
'\" and indent is equivalent to second arg of .IP (shouldn't ever be
'\" needed; use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\" Give maximum sizes of arguments for setting tab stops. Type and
'\" name are examples of largest possible arguments that will be passed
'\" to .AP later. If args are omitted, default tab stops are used.
'\"
'\" .BS
'\" Start box enclosure. From here until next .BE, everything will be
'\" enclosed in one large box.
'\"
'\" .BE
'\" End of box enclosure.
'\"
'\" .CS
'\" Begin code excerpt.
'\"
'\" .CE
'\" End code excerpt.
'\"
'\" .VS ?version? ?br?
'\" Begin vertical sidebar, for use in marking newly-changed parts
'\" of man pages. The first argument is ignored and used for recording
'\" the version when the .VS was added, so that the sidebars can be
'\" found and removed when they reach a certain age. If another argument
'\" is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\" End of vertical sidebar.
'\"
'\" .DS
'\" Begin an indented unfilled display.
'\"
'\" .DE
'\" End of indented unfilled display.
'\"
'\" .SO
'\" Start of list of standard options for a Tk widget. The
'\" options follow on successive lines, in four columns separated
'\" by tabs.
'\"
'\" .SE
'\" End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\" Start of description of a specific option. cmdName gives the
'\" option's name as specified in the class command, dbName gives
'\" the option's name in the option database, and dbClass gives
'\" the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\" Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.2 1998/09/14 18:39:54 stanton Exp $
'\"
'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
t .wh -1.3i ^B
^l \n(.l
b
'\" # Start an argument description
AP
!"\\$4"" .TP \\$4
\{\
!"\\$2"" .TP \\n()Cu
.TP 15
|