1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-
+
|
/*
* tclTrace.c --
*
* This file contains code to handle most trace management.
*
* Copyright (c) 1987-1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 Scriptics Corporation.
* Copyright (c) 2002 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclTrace.c,v 1.2.2.16 2005/12/02 18:42:08 dgp Exp $
* RCS: @(#) $Id: tclTrace.c,v 1.2.2.17 2006/01/25 18:38:33 dgp Exp $
*/
#include "tclInt.h"
/*
* Structures used to hold information about variable traces:
*/
|
| ︙ | | |
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
-
-
-
+
+
+
-
-
-
+
+
+
|
/*
* Forward declarations for functions defined in this file:
*/
typedef int (Tcl_TraceTypeObjCmd)(Tcl_Interp *interp, int optionIndex,
int objc, Tcl_Obj *CONST objv[]);
MODULE_SCOPE Tcl_TraceTypeObjCmd TclTraceVariableObjCmd;
MODULE_SCOPE Tcl_TraceTypeObjCmd TclTraceCommandObjCmd;
MODULE_SCOPE Tcl_TraceTypeObjCmd TclTraceExecutionObjCmd;
static Tcl_TraceTypeObjCmd TraceVariableObjCmd;
static Tcl_TraceTypeObjCmd TraceCommandObjCmd;
static Tcl_TraceTypeObjCmd TraceExecutionObjCmd;
/*
* Each subcommand has a number of 'types' to which it can apply. Currently
* 'execution', 'command' and 'variable' are the only types supported. These
* three arrays MUST be kept in sync! In the future we may provide an API to
* add to the list of supported trace types.
*/
static CONST char *traceTypeOptions[] = {
"execution", "command", "variable", NULL
};
static Tcl_TraceTypeObjCmd *traceSubCmds[] = {
TclTraceExecutionObjCmd,
TclTraceCommandObjCmd,
TclTraceVariableObjCmd,
TraceExecutionObjCmd,
TraceCommandObjCmd,
TraceVariableObjCmd,
};
/*
* Declarations for local functions to this file:
*/
static int CallTraceFunction(Tcl_Interp *interp, Trace *tracePtr,
|
| ︙ | | |
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
|
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
|
-
+
-
-
+
+
|
"\": should be one or more of rwua", NULL);
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* TclTraceExecutionObjCmd --
* TraceExecutionObjCmd --
*
* Helper function for Tcl_TraceObjCmd; implements the [trace
* {add|remove|info} execution ...] subcommands. See the user
* documentation for details on what these do.
*
* Results:
* Standard Tcl result.
*
* Side effects:
* Depends on the operation (add, remove, or info) being performed; may
* add or remove command traces on a command.
*
*----------------------------------------------------------------------
*/
int
TclTraceExecutionObjCmd(
static int
TraceExecutionObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
int optionIndex, /* Add, info or remove */
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int commandLength, index;
char *name, *command;
|
| ︙ | | |
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
|
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
|
-
+
-
-
+
+
|
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclTraceCommandObjCmd --
* TraceCommandObjCmd --
*
* Helper function for Tcl_TraceObjCmd; implements the [trace
* {add|info|remove} command ...] subcommands. See the user documentation
* for details on what these do.
*
* Results:
* Standard Tcl result.
*
* Side effects:
* Depends on the operation (add, remove, or info) being performed; may
* add or remove command traces on a command.
*
*----------------------------------------------------------------------
*/
int
TclTraceCommandObjCmd(
static int
TraceCommandObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
int optionIndex, /* Add, info or remove */
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int commandLength, index;
char *name, *command;
|
| ︙ | | |
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
|
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
|
-
+
-
-
+
+
|
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TclTraceVariableObjCmd --
* TraceVariableObjCmd --
*
* Helper function for Tcl_TraceObjCmd; implements the [trace
* {add|info|remove} variable ...] subcommands. See the user
* documentation for details on what these do.
*
* Results:
* Standard Tcl result.
*
* Side effects:
* Depends on the operation (add, remove, or info) being performed; may
* add or remove variable traces on a variable.
*
*----------------------------------------------------------------------
*/
int
TclTraceVariableObjCmd(
static int
TraceVariableObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
int optionIndex, /* Add, info or remove */
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int commandLength, index;
char *name, *command;
|
| ︙ | | |