OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [doc/] [CrtTrace.3] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1989-1993 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: CrtTrace.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
9
'\"
10
.so man.macros
11
.TH Tcl_CreateTrace 3 "" Tcl "Tcl Library Procedures"
12
.BS
13
.SH NAME
14
Tcl_CreateTrace, Tcl_DeleteTrace \- arrange for command execution to be traced
15
.SH SYNOPSIS
16
.nf
17
\fB#include \fR
18
.sp
19
Tcl_Trace
20
\fBTcl_CreateTrace\fR(\fIinterp, level, proc, clientData\fR)
21
.sp
22
\fBTcl_DeleteTrace\fR(\fIinterp, trace\fR)
23
.SH ARGUMENTS
24
.AS Tcl_CmdTraceProc (clientData)()
25
.AP Tcl_Interp *interp in
26
Interpreter containing command to be traced or untraced.
27
.AP int level in
28
Only commands at or below this nesting level will be traced.  1 means
29
top-level commands only, 2 means top-level commands or those that are
30
invoked as immediate consequences of executing top-level commands
31
(procedure bodies, bracketed commands, etc.) and so on.
32
.AP Tcl_CmdTraceProc *proc in
33
Procedure to call for each command that's executed.  See below for
34
details on the calling sequence.
35
.AP ClientData clientData in
36
Arbitrary one-word value to pass to \fIproc\fR.
37
.AP Tcl_Trace trace in
38
Token for trace to be removed (return value from previous call
39
to \fBTcl_CreateTrace\fR).
40
.BE
41
 
42
.SH DESCRIPTION
43
.PP
44
\fBTcl_CreateTrace\fR arranges for command tracing.  From now on, \fIproc\fR
45
will be invoked before Tcl calls command procedures to process
46
commands in \fIinterp\fR.  The return value from
47
\fBTcl_CreateTrace\fR is a token for the trace,
48
which may be passed to \fBTcl_DeleteTrace\fR to remove the trace.  There may
49
be many traces in effect simultaneously for the same command interpreter.
50
.PP
51
\fIProc\fR should have arguments and result that match the
52
type \fBTcl_CmdTraceProc\fR:
53
.CS
54
typedef void Tcl_CmdTraceProc(
55
        ClientData \fIclientData\fR,
56
        Tcl_Interp *\fIinterp\fR,
57
        int \fIlevel\fR,
58
        char *\fIcommand\fR,
59
        Tcl_CmdProc *\fIcmdProc\fR,
60
        ClientData \fIcmdClientData\fR,
61
        int \fIargc\fR,
62
        char *\fIargv\fR[]);
63
.CE
64
The \fIclientData\fR and \fIinterp\fR parameters are
65
copies of the corresponding arguments given to \fBTcl_CreateTrace\fR.
66
\fIClientData\fR typically points to an application-specific
67
data structure that describes what to do when \fIproc\fR
68
is invoked.  \fILevel\fR gives the nesting level of the command
69
(1 for top-level commands passed to \fBTcl_Eval\fR by the application,
70
2 for the next-level commands passed to \fBTcl_Eval\fR as part of parsing
71
or interpreting level-1 commands, and so on).  \fICommand\fR
72
points to a string containing the text of the
73
command, before any argument substitution.
74
\fICmdProc\fR contains the address of the command procedure that
75
will be called to process the command (i.e. the \fIproc\fR argument
76
of some previous call to \fBTcl_CreateCommand\fR) and \fIcmdClientData\fR
77
contains the associated client data for \fIcmdProc\fR (the \fIclientData\fR
78
value passed to \fBTcl_CreateCommand\fR).  \fIArgc\fR and \fIargv\fR give
79
the final argument information that will be passed to \fIcmdProc\fR, after
80
command, variable, and backslash substitution.
81
\fIProc\fR must not modify the \fIcommand\fR or \fIargv\fR strings.
82
.PP
83
Tracing will only occur for commands at nesting level less than
84
or equal to the \fIlevel\fR parameter (i.e. the \fIlevel\fR
85
parameter to \fIproc\fR will always be less than or equal to the
86
\fIlevel\fR parameter to \fBTcl_CreateTrace\fR).
87
.PP
88
Calls to \fIproc\fR will be made by the Tcl parser immediately before
89
it calls the command procedure for the command (\fIcmdProc\fR).  This
90
occurs after argument parsing and substitution, so tracing for
91
substituted commands occurs before tracing of the commands
92
containing the substitutions.  If there is a syntax error in a
93
command, or if there is no command procedure associated with a
94
command name, then no tracing will occur for that command.  If a
95
string passed to Tcl_Eval contains multiple commands (bracketed, or
96
on different lines) then multiple calls to \fIproc\fR will occur,
97
one for each command.  The \fIcommand\fR string for each of these
98
trace calls will reflect only a single command, not the entire string
99
passed to Tcl_Eval.
100
.PP
101
\fBTcl_DeleteTrace\fR removes a trace, so that no future calls will be
102
made to the procedure associated with the trace.  After \fBTcl_DeleteTrace\fR
103
returns, the caller should never again use the \fItrace\fR token.
104
 
105
.SH KEYWORDS
106
command, create, delete, interpreter, trace

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.