summaryrefslogtreecommitdiffstats
path: root/doc/TraceVar.3
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-09-18 17:01:02 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-09-18 17:01:02 (GMT)
commit5e5bcd132f05719b0bd2dbd8449cc26b325ef811 (patch)
treed0721a6b5b5206782155cb04dd3b28fd41bd8564 /doc/TraceVar.3
parent5c5d25ff6d6cf79ce06105cd339492f10e32aa82 (diff)
downloadtcl-5e5bcd132f05719b0bd2dbd8449cc26b325ef811.zip
tcl-5e5bcd132f05719b0bd2dbd8449cc26b325ef811.tar.gz
tcl-5e5bcd132f05719b0bd2dbd8449cc26b325ef811.tar.bz2
More fixes from Mikhail Kolesnitchenko, and also standardize highlighting
of symbols like TCL_OK, TCL_ERROR, etc.
Diffstat (limited to 'doc/TraceVar.3')
-rw-r--r--doc/TraceVar.353
1 files changed, 27 insertions, 26 deletions
diff --git a/doc/TraceVar.3 b/doc/TraceVar.3
index acaaad3..f214ee1 100644
--- a/doc/TraceVar.3
+++ b/doc/TraceVar.3
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: TraceVar.3,v 1.9 2004/09/06 09:44:57 dkf Exp $
+'\" RCS: @(#) $Id: TraceVar.3,v 1.10 2004/09/18 17:01:06 dkf Exp $
'\"
.so man.macros
.TH Tcl_TraceVar 3 7.4 Tcl "Tcl Library Procedures"
@@ -40,9 +40,10 @@ Name of variable. May refer to a scalar variable, to
an array variable with no index, or to an array variable
with a parenthesized index.
.AP int flags in
-OR-ed combination of the values TCL_TRACE_READS, TCL_TRACE_WRITES,
-TCL_TRACE_UNSETS, TCL_TRACE_ARRAY, TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
-TCL_TRACE_RESULT_DYNAMIC and TCL_TRACE_RESULT_OBJECT.
+OR-ed combination of the values \fBTCL_TRACE_READS\fR,
+\fBTCL_TRACE_WRITES\fR, \fBTCL_TRACE_UNSETS\fR, \fBTCL_TRACE_ARRAY\fR,
+\fBTCL_GLOBAL_ONLY\fR, \fBTCL_NAMESPACE_ONLY\fR,
+\fBTCL_TRACE_RESULT_DYNAMIC\fR and \fBTCL_TRACE_RESULT_OBJECT\fR.
Not all flags are used by all
procedures. See below for more information.
.AP Tcl_VarTraceProc *proc in
@@ -68,8 +69,8 @@ trace.
access to a Tcl variable, so that the C procedure is invoked
whenever the variable is read or written or unset.
If the trace is created successfully then \fBTcl_TraceVar\fR returns
-TCL_OK. If an error occurred (e.g. \fIvarName\fR specifies an element
-of an array, but the actual variable isn't an array) then TCL_ERROR
+\fBTCL_OK\fR. If an error occurred (e.g. \fIvarName\fR specifies an element
+of an array, but the actual variable isn't an array) then \fBTCL_ERROR\fR
is returned and an error message is left in the interpreter's result.
.PP
The \fIflags\fR argument to \fBTcl_TraceVar\fR indicates when the
@@ -111,14 +112,14 @@ before an array set, but that will trigger write traces.
The result of invoking the \fIproc\fR is a dynamically allocated
string that will be released by the Tcl library via a call to
\fBckfree\fR. Must not be specified at the same time as
-TCL_TRACE_RESULT_OBJECT.
+\fBTCL_TRACE_RESULT_OBJECT\fR.
.TP
\fBTCL_TRACE_RESULT_OBJECT\fR
The result of invoking the \fIproc\fR is a Tcl_Obj* (cast to a char*)
with a reference count of at least one. The ownership of that
reference will be transferred to the Tcl core for release (when the
core has finished with it) via a call to \fBTcl_DecrRefCount\fR. Must
-not be specified at the same time as TCL_TRACE_RESULT_DYNAMIC.
+not be specified at the same time as \fBTCL_TRACE_RESULT_DYNAMIC\fR.
.VE 8.4
.PP
Whenever one of the specified operations occurs on the variable,
@@ -144,30 +145,30 @@ in the normal two-part form (see the description of \fBTcl_TraceVar2\fR
below for details).
\fIFlags\fR is an OR-ed combination of bits providing several
pieces of information.
-One of the bits TCL_TRACE_READS, TCL_TRACE_WRITES, TCL_TRACE_ARRAY,
-or TCL_TRACE_UNSETS
+One of the bits \fBTCL_TRACE_READS\fR, \fBTCL_TRACE_WRITES\fR,
+\fBTCL_TRACE_ARRAY\fR, or \fBTCL_TRACE_UNSETS\fR
will be set in \fIflags\fR to indicate which operation is being performed
on the variable.
-The bit TCL_GLOBAL_ONLY will be set whenever the variable being
+The bit \fBTCL_GLOBAL_ONLY\fR will be set whenever the variable being
accessed is a global one not accessible from the current level of
procedure call: the trace procedure will need to pass this flag
back to variable-related procedures like \fBTcl_GetVar\fR if it
attempts to access the variable.
-The bit TCL_NAMESPACE_ONLY will be set whenever the variable being
+The bit \fBTCL_NAMESPACE_ONLY\fR will be set whenever the variable being
accessed is a namespace one not accessible from the current level of
procedure call: the trace procedure will need to pass this flag
back to variable-related procedures like \fBTcl_GetVar\fR if it
attempts to access the variable.
-The bit TCL_TRACE_DESTROYED will be set in \fIflags\fR if the trace is
+The bit \fBTCL_TRACE_DESTROYED\fR will be set in \fIflags\fR if the trace is
about to be destroyed; this information may be useful to \fIproc\fR
so that it can clean up its own internal data structures (see
-the section TCL_TRACE_DESTROYED below for more details).
-Lastly, the bit TCL_INTERP_DESTROYED will be set if the entire
+the section \fBTCL_TRACE_DESTROYED\fR below for more details).
+Lastly, the bit \fBTCL_INTERP_DESTROYED\fR will be set if the entire
interpreter is being destroyed.
When this bit is set, \fIproc\fR must be especially careful in
-the things it does (see the section TCL_INTERP_DESTROYED below).
+the things it does (see the section \fBTCL_INTERP_DESTROYED\fR below).
The trace procedure's return value should normally be NULL; see
-ERROR RETURNS below for information on other possibilities.
+\fBERROR RETURNS\fR below for information on other possibilities.
.PP
\fBTcl_UntraceVar\fR may be used to remove a trace.
If the variable specified by \fIinterp\fR, \fIvarName\fR, and \fIflags\fR
@@ -182,8 +183,8 @@ traces set on a given variable.
The return value from \fBTcl_VarTraceInfo\fR is the \fIclientData\fR
associated with a particular trace.
The trace must be on the variable specified by the \fIinterp\fR,
-\fIvarName\fR, and \fIflags\fR arguments (only the TCL_GLOBAL_ONLY and
-TCL_NAMESPACE_ONLY bits from \fIflags\fR is used; other bits are
+\fIvarName\fR, and \fIflags\fR arguments (only the \fBTCL_GLOBAL_ONLY\fR and
+\fBTCL_NAMESPACE_ONLY\fR bits from \fIflags\fR is used; other bits are
ignored) and its trace procedure must the same as the \fIproc\fR
argument.
If the \fIprevClientData\fR argument is NULL then the return
@@ -323,8 +324,8 @@ error occurred.
The return value must be a pointer to a static character string
containing an error message,
.VS 8.4
-unless (\fIexactly\fR one of) the TCL_TRACE_RESULT_DYNAMIC and
-TCL_TRACE_RESULT_OBJECT flags is set, which specify that the result is
+unless (\fIexactly\fR one of) the \fBTCL_TRACE_RESULT_DYNAMIC\fR and
+\fBTCL_TRACE_RESULT_OBJECT\fR flags is set, which specify that the result is
either a dynamic string (to be released with \fBckfree\fR) or a
Tcl_Obj* (cast to char* and to be released with
\fBTcl_DecrRefCount\fR) containing the error message.
@@ -363,11 +364,11 @@ procedure will still be invoked.
.SH "TCL_TRACE_DESTROYED FLAG"
.PP
-In an unset callback to \fIproc\fR, the TCL_TRACE_DESTROYED bit
+In an unset callback to \fIproc\fR, the \fBTCL_TRACE_DESTROYED\fR bit
is set in \fIflags\fR if the trace is being removed as part
of the deletion.
Traces on a variable are always removed whenever the variable
-is deleted; the only time TCL_TRACE_DESTROYED isn't set is for
+is deleted; the only time \fBTCL_TRACE_DESTROYED\fR isn't set is for
a whole-array trace invoked when only a single element of an
array is unset.
@@ -375,10 +376,10 @@ array is unset.
.PP
When an interpreter is destroyed, unset traces are called for
all of its variables.
-The TCL_INTERP_DESTROYED bit will be set in the \fIflags\fR
+The \fBTCL_INTERP_DESTROYED\fR bit will be set in the \fIflags\fR
argument passed to the trace procedures.
Trace procedures must be extremely careful in what they do if
-the TCL_INTERP_DESTROYED bit is set.
+the \fBTCL_INTERP_DESTROYED\fR bit is set.
It is not safe for the procedures to invoke any Tcl procedures
on the interpreter, since its state is partially deleted.
All that trace procedures should do under these circumstances is
@@ -387,7 +388,7 @@ to clean up and free their own internal data structures.
.SH BUGS
.PP
Tcl doesn't do any error checking to prevent trace procedures
-from misusing the interpreter during traces with TCL_INTERP_DESTROYED
+from misusing the interpreter during traces with \fBTCL_INTERP_DESTROYED\fR
set.
.PP
Array traces are not yet integrated with the Tcl "info exists" command,