Diff
Not logged in

Differences From Artifact [b3dfbdd197]:

To Artifact [4f9e04831c]:


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.13 2004/10/01 00:10:23 dgp Exp $
 * RCS: @(#) $Id: tclTrace.c,v 1.14 2004/10/05 18:14:28 dgp Exp $
 */

#include "tclInt.h"

/*
 * Structure used to hold information about variable traces:
 */
2447
2448
2449
2450
2451
2452
2453
2454






2455
2456
2457
2458
2459
2460
2461
2447
2448
2449
2450
2451
2452
2453

2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466







-
+
+
+
+
+
+







    char *result;
    CONST char *openParen, *p;
    Tcl_DString nameCopy;
    int copiedName;
    int code = TCL_OK;
    int disposeFlags = 0;
    int saveErrFlags = iPtr->flags
	    & (ERR_IN_PROGRESS | ERR_ALREADY_LOGGED | ERROR_CODE_SET);
	    & (ERR_IN_PROGRESS | ERR_ALREADY_LOGGED);
    Tcl_Obj *saveErrCode = iPtr->errorCode;

    if (saveErrCode) {
	Tcl_IncrRefCount(saveErrCode);
    }

    /*
     * If there are already similar trace procedures active for the
     * variable, don't call them again.
     */

    if (varPtr->flags & VAR_TRACE_ACTIVE) {
2572
2573
2574
2575
2576
2577
2578






2579
2580
2581
2582
2583
2584
2585
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596







+
+
+
+
+
+







     * Restore the variable's flags, remove the record of our active
     * traces, and then return.
     */

    done:
    if (code == TCL_OK) {
	iPtr->flags |= saveErrFlags;
	if (iPtr->errorCode) {
	    Tcl_DecrRefCount(iPtr->errorCode);
	}
	iPtr->errorCode = saveErrCode;
    } else if (saveErrCode) {
	Tcl_DecrRefCount(saveErrCode);
    }
    if (code == TCL_ERROR) {
	if (leaveErrMsg) {
	    CONST char *type = "";
	    switch (flags&(TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_ARRAY)) {
		case TCL_TRACE_READS: {
		    type = "read";