diff options
Diffstat (limited to 'doc/trace.n')
| -rw-r--r-- | doc/trace.n | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/doc/trace.n b/doc/trace.n index 9b8fd57..97fbdba 100644 --- a/doc/trace.n +++ b/doc/trace.n @@ -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. -'\" +'\" .TH trace n "8.4" Tcl "Tcl Built-In Commands" .so man.macros .BS @@ -20,8 +20,7 @@ trace \- Monitor variable accesses, command usages and command executions This command causes Tcl commands to be executed whenever certain operations are invoked. The legal \fIoption\fRs (which may be abbreviated) are: .TP -\fBtrace add \fItype name ops\fR ?\fIargs\fR? -. +\fBtrace add \fItype name ops ?args?\fR Where \fItype\fR is \fBcommand\fR, \fBexecution\fR, or \fBvariable\fR. .RS .TP @@ -55,11 +54,9 @@ execute them. When the trace triggers, depending on the operations being traced, a number of arguments are appended to \fIcommandPrefix\fR so that the actual command is as follows: -.PP .CS \fIcommandPrefix oldName newName op\fR .CE -.PP \fIOldName\fR and \fInewName\fR give the traced command's current (old) name, and the name to which it is being renamed (the empty string if this is a .QW delete @@ -124,11 +121,9 @@ number of arguments are appended to \fIcommandPrefix\fR so that the actual command is as follows: .PP For \fBenter\fR and \fBenterstep\fR operations: -.PP .CS \fIcommandPrefix command-string op\fR .CE -.PP \fICommand-string\fR gives the complete current command being executed (the traced command for a \fBenter\fR operation, an arbitrary command for a \fBenterstep\fR operation), including @@ -142,11 +137,9 @@ course when the command is subsequently executed, an error will occur. .PP For \fBleave\fR and \fBleavestep\fR operations: -.PP .CS \fIcommandPrefix command-string code result op\fR .CE -.PP \fICommand-string\fR gives the complete current command being executed (the traced command for a \fBenter\fR operation, an arbitrary command for a \fBenterstep\fR operation), including @@ -224,11 +217,9 @@ interpreter in which to execute them. .PP When the trace triggers, three arguments are appended to \fIcommandPrefix\fR so that the actual command is as follows: -.PP .CS \fIcommandPrefix name1 name2 op\fR .CE -.PP \fIName1\fR and \fIname2\fR give the name(s) for the variable being accessed: if the variable is a scalar then \fIname1\fR gives the variable's name and \fIname2\fR is an empty string; @@ -238,7 +229,7 @@ if an entire array is being deleted and the trace was registered on the overall array, rather than a single element, then \fIname1\fR gives the array name and \fIname2\fR is an empty string. \fIName1\fR and \fIname2\fR are not necessarily the same as the -name used in the \fBtrace add variable\fR command: the \fBupvar\fR +name used in the \fBtrace variable\fR command: the \fBupvar\fR command allows a procedure to reference a variable under a different name. \fIOp\fR indicates what operation is being performed on the @@ -377,11 +368,9 @@ future version of Tcl. They use an older syntax in which \fBarray\fR, list, but simply a string concatenation of the operations, such as \fBrwua\fR. .SH EXAMPLES -.PP Print a message whenever either of the global variables \fBfoo\fR and \fBbar\fR are updated, even if they have a different local name at the time (which can be done with the \fBupvar\fR command): -.PP .CS proc tracer {varname args} { upvar #0 $varname var @@ -393,7 +382,6 @@ proc tracer {varname args} { .PP Ensure that the global variable \fBfoobar\fR always contains the product of the global variables \fBfoo\fR and \fBbar\fR: -.PP .CS proc doMult args { global foo bar foobar @@ -405,7 +393,6 @@ proc doMult args { .PP Print a trace of what commands are executed during the processing of a Tcl procedure: -.PP .CS proc x {} { y } proc y {} { z } @@ -422,6 +409,3 @@ x set(n), unset(n) .SH KEYWORDS read, command, rename, variable, write, trace, unset -.\" Local Variables: -.\" mode: nroff -.\" End: |
