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.17 2004/10/19 21:54:07 dgp Exp $
* RCS: @(#) $Id: tclTrace.c,v 1.18 2004/10/25 01:06:51 msofer Exp $
*/
#include "tclInt.h"
/*
* Structure used to hold information about variable traces:
*/
|
| ︙ | | |
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
|
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
|
-
+
-
+
|
TclInterpState state = NULL;
/*
* If there are already similar trace procedures active for the
* variable, don't call them again.
*/
if (varPtr->flags & VAR_TRACE_ACTIVE) {
if (TclIsVarTraceActive(varPtr)) {
return code;
}
varPtr->flags |= VAR_TRACE_ACTIVE;
TclSetVarTraceActive(varPtr);
varPtr->refCount++;
if (arrayPtr != NULL) {
arrayPtr->refCount++;
}
/*
* If the variable name hasn't been parsed into array name and
|
| ︙ | | |
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
|
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
|
-
+
|
* Invoke traces on the array containing the variable, if relevant.
*/
result = NULL;
active.nextPtr = iPtr->activeVarTracePtr;
iPtr->activeVarTracePtr = &active;
Tcl_Preserve((ClientData) iPtr);
if (arrayPtr != NULL && !(arrayPtr->flags & VAR_TRACE_ACTIVE)) {
if (arrayPtr != NULL && !TclIsVarTraceActive(arrayPtr)) {
active.varPtr = arrayPtr;
for (tracePtr = arrayPtr->tracePtr; tracePtr != NULL;
tracePtr = active.nextTracePtr) {
active.nextTracePtr = tracePtr->nextPtr;
if (!(tracePtr->flags & flags)) {
continue;
}
|
| ︙ | | |
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
|
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
|
-
+
|
if (arrayPtr != NULL) {
arrayPtr->refCount--;
}
if (copiedName) {
Tcl_DStringFree(&nameCopy);
}
varPtr->flags &= ~VAR_TRACE_ACTIVE;
TclClearVarTraceActive(varPtr);
varPtr->refCount--;
iPtr->activeVarTracePtr = active.nextPtr;
Tcl_Release((ClientData) iPtr);
return code;
}
/*
|
| ︙ | | |