📄 crttrace.3
字号:
'\"'\" Copyright (c) 1989-1993 The Regents of the University of California.'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) CrtTrace.3 1.14 96/03/25 20:01:10'\" .so man.macros.TH Tcl_CreateTrace 3 "" Tcl "Tcl Library Procedures".BS.SH NAMETcl_CreateTrace, Tcl_DeleteTrace \- arrange for command execution to be traced.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spTcl_Trace\fBTcl_CreateTrace\fR(\fIinterp, level, proc, clientData\fR).sp\fBTcl_DeleteTrace\fR(\fIinterp, trace\fR).SH ARGUMENTS.AS Tcl_CmdTraceProc (clientData)().AP Tcl_Interp *interp inInterpreter containing command to be traced or untraced..AP int level inOnly commands at or below this nesting level will be traced. 1 meanstop-level commands only, 2 means top-level commands or those that areinvoked as immediate consequences of executing top-level commands(procedure bodies, bracketed commands, etc.) and so on..AP Tcl_CmdTraceProc *proc inProcedure to call for each command that's executed. See below fordetails on the calling sequence..AP ClientData clientData inArbitrary one-word value to pass to \fIproc\fR..AP Tcl_Trace trace inToken for trace to be removed (return value from previous callto \fBTcl_CreateTrace\fR)..BE.SH DESCRIPTION.PP\fBTcl_CreateTrace\fR arranges for command tracing. From now on, \fIproc\fRwill be invoked before Tcl calls command procedures to processcommands in \fIinterp\fR. The return value from\fBTcl_CreateTrace\fR is a token for the trace,which may be passed to \fBTcl_DeleteTrace\fR to remove the trace. There maybe many traces in effect simultaneously for the same command interpreter..PP\fIProc\fR should have arguments and result that match thetype \fBTcl_CmdTraceProc\fR:.CStypedef void Tcl_CmdTraceProc( ClientData \fIclientData\fR, Tcl_Interp *\fIinterp\fR, int \fIlevel\fR, char *\fIcommand\fR, Tcl_CmdProc *\fIcmdProc\fR, ClientData \fIcmdClientData\fR, int \fIargc\fR, char *\fIargv\fR[]);.CEThe \fIclientData\fR and \fIinterp\fR parameters arecopies of the corresponding arguments given to \fBTcl_CreateTrace\fR.\fIClientData\fR typically points to an application-specificdata structure that describes what to do when \fIproc\fRis invoked. \fILevel\fR gives the nesting level of the command(1 for top-level commands passed to \fBTcl_Eval\fR by the application,2 for the next-level commands passed to \fBTcl_Eval\fR as part of parsingor interpreting level-1 commands, and so on). \fICommand\fRpoints to a string containing the text of thecommand, before any argument substitution.\fICmdProc\fR contains the address of the command procedure thatwill be called to process the command (i.e. the \fIproc\fR argumentof some previous call to \fBTcl_CreateCommand\fR) and \fIcmdClientData\fRcontains the associated client data for \fIcmdProc\fR (the \fIclientData\fRvalue passed to \fBTcl_CreateCommand\fR). \fIArgc\fR and \fIargv\fR givethe final argument information that will be passed to \fIcmdProc\fR, aftercommand, variable, and backslash substitution.\fIProc\fR must not modify the \fIcommand\fR or \fIargv\fR strings..PPTracing will only occur for commands at nesting level less thanor equal to the \fIlevel\fR parameter (i.e. the \fIlevel\fRparameter to \fIproc\fR will always be less than or equal to the\fIlevel\fR parameter to \fBTcl_CreateTrace\fR)..PPCalls to \fIproc\fR will be made by the Tcl parser immediately beforeit calls the command procedure for the command (\fIcmdProc\fR). Thisoccurs after argument parsing and substitution, so tracing forsubstituted commands occurs before tracing of the commandscontaining the substitutions. If there is a syntax error in acommand, or if there is no command procedure associated with acommand name, then no tracing will occur for that command. If astring passed to Tcl_Eval contains multiple commands (bracketed, oron different lines) then multiple calls to \fIproc\fR will occur,one for each command. The \fIcommand\fR string for each of thesetrace calls will reflect only a single command, not the entire stringpassed to Tcl_Eval..PP\fBTcl_DeleteTrace\fR removes a trace, so that no future calls will bemade to the procedure associated with the trace. After \fBTcl_DeleteTrace\fRreturns, the caller should never again use the \fItrace\fR token..SH KEYWORDScommand, create, delete, interpreter, trace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -