SYNOPSIS
#include <tcl.h>
Tcl_Trace Tcl_CreateTrace(interp, level, proc, clientData)
Tcl_DeleteTrace(interp, trace)
ARGUMENTS
- Tcl_Interp *interp (in)
-
Interpreter containing command to be traced or untraced.
- int level (in)
-
Only commands at or below this nesting level will be traced. 1 means top-level commands only, 2 means top-level commands or those that are invoked as immediate consequences of executing top-level commands (procedure bodies, bracketed commands, etc.) and so on.
- Tcl_CmdTraceProc *proc (in)
-
Procedure to call for each command that's executed. See below for details on the calling sequence.
- ClientData clientData (in)
-
Arbitrary one-word value to pass to proc.
- Tcl_Trace trace (in)
-
Token for trace to be removed (return value from previous call to
Tcl_CreateTrace() ).
DESCRIPTION
Proc should have arguments and result that match the type Tcl_CmdTraceProc:
typedef void Tcl_CmdTraceProc( ClientData clientData, Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *cmdProc, ClientData cmdClientData, int argc, char *argv[]);
The clientData and interp parameters are
copies of the corresponding arguments given to
Tracing will only occur for commands at nesting level less than
or equal to the level parameter (that is, the
level
parameter to proc will always be less than or equal to the
level parameter to
Calls to proc will be made by the Tcl parser immediately before it calls the command procedure for the command (cmdProc). This occurs after argument parsing and substitution, so tracing for substituted commands occurs before tracing of the commands containing the substitutions. If there is a syntax error in a command, or if there is no command procedure associated with a command name, then no tracing will occur for that command. If a string passed to Tcl_Eval contains multiple commands (bracketed, or on different lines) then multiple calls to proc will occur, one for each command. The command string for each of these trace calls will reflect only a single command, not the entire string passed to Tcl_Eval.
PORTABILITY
Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.5 Documentation Build 40.