Tcl Source Code

Hex Artifact Content
Login

Artifact 909379f7e3744772d7bb5d1c05cf453bd706b146:

Attachment "1706140.patch" to ticket [1706140fff] added by dgp 2007-05-04 05:24:20.
0000: 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74  Index: generic/t
0010: 63 6c 56 61 72 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d  clVar.c.========
0020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20  ===========.RCS 
0060: 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74  file: /cvsroot/t
0070: 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74  cl/tcl/generic/t
0080: 63 6c 56 61 72 2e 63 2c 76 0a 72 65 74 72 69 65  clVar.c,v.retrie
0090: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e  ving revision 1.
00a0: 31 33 33 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e  133.diff -u -r1.
00b0: 31 33 33 20 74 63 6c 56 61 72 2e 63 0a 2d 2d 2d  133 tclVar.c.---
00c0: 20 67 65 6e 65 72 69 63 2f 74 63 6c 56 61 72 2e   generic/tclVar.
00d0: 63 09 32 20 4d 61 79 20 32 30 30 37 20 30 30 3a  c.2 May 2007 00:
00e0: 33 31 3a 32 32 20 2d 30 30 30 30 09 31 2e 31 33  31:22 -0000.1.13
00f0: 33 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63  3.+++ generic/tc
0100: 6c 56 61 72 2e 63 09 33 20 4d 61 79 20 32 30 30  lVar.c.3 May 200
0110: 37 20 32 32 3a 32 31 3a 32 38 20 2d 30 30 30 30  7 22:21:28 -0000
0120: 0a 40 40 20 2d 31 30 39 37 2c 31 35 20 2b 31 30  .@@ -1097,15 +10
0130: 39 37 2c 31 30 20 40 40 0a 20 7b 0a 20 20 20 20  97,10 @@. {.    
0140: 20 56 61 72 20 2a 76 61 72 50 74 72 2c 20 2a 61   Var *varPtr, *a
0150: 72 72 61 79 50 74 72 3b 0a 20 0a 2d 20 20 20 20  rrayPtr;. .-    
0160: 2f 2a 0a 2d 20 20 20 20 20 2a 20 57 65 20 6e 65  /*.-     * We ne
0170: 65 64 20 61 20 73 70 65 63 69 61 6c 20 66 6c 61  ed a special fla
0180: 67 20 63 68 65 63 6b 20 74 6f 20 73 65 65 20 69  g check to see i
0190: 66 20 77 65 20 77 61 6e 74 20 74 6f 20 63 72 65  f we want to cre
01a0: 61 74 65 20 70 61 72 74 20 31 2c 0a 2d 20 20 20  ate part 1,.-   
01b0: 20 20 2a 20 62 65 63 61 75 73 65 20 63 6f 6d 6d    * because comm
01c0: 61 6e 64 73 20 6c 69 6b 65 20 6c 61 70 70 65 6e  ands like lappen
01d0: 64 20 72 65 71 75 69 72 65 20 72 65 61 64 20 74  d require read t
01e0: 72 61 63 65 73 20 74 6f 20 74 72 69 67 67 65 72  races to trigger
01f0: 20 66 6f 72 0a 2d 20 20 20 20 20 2a 20 70 72 65   for.-     * pre
0200: 76 69 6f 75 73 6c 79 20 6e 6f 6e 2d 65 78 69 73  viously non-exis
0210: 74 65 6e 74 20 76 61 6c 75 65 73 2e 0a 2d 20 20  tent values..-  
0220: 20 20 20 2a 2f 0a 2d 0a 2b 20 20 20 20 2f 2a 20     */.-.+    /* 
0230: 46 69 6c 74 65 72 20 74 6f 20 70 61 73 73 20 74  Filter to pass t
0240: 68 72 6f 75 67 68 20 6f 6e 6c 79 20 74 68 65 20  hrough only the 
0250: 66 6c 61 67 73 20 74 68 69 73 20 69 6e 74 65 72  flags this inter
0260: 66 61 63 65 20 73 75 70 70 6f 72 74 73 2e 20 2a  face supports. *
0270: 2f 0a 2b 20 20 20 20 66 6c 61 67 73 20 26 3d 20  /.+    flags &= 
0280: 28 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59  (TCL_GLOBAL_ONLY
0290: 7c 54 43 4c 5f 4e 41 4d 45 53 50 41 43 45 5f 4f  |TCL_NAMESPACE_O
02a0: 4e 4c 59 7c 54 43 4c 5f 4c 45 41 56 45 5f 45 52  NLY|TCL_LEAVE_ER
02b0: 52 5f 4d 53 47 29 3b 0a 20 20 20 20 20 76 61 72  R_MSG);.     var
02c0: 50 74 72 20 3d 20 54 63 6c 4c 6f 6f 6b 75 70 56  Ptr = TclLookupV
02d0: 61 72 28 69 6e 74 65 72 70 2c 20 70 61 72 74 31  ar(interp, part1
02e0: 2c 20 70 61 72 74 32 2c 20 66 6c 61 67 73 2c 20  , part2, flags, 
02f0: 22 72 65 61 64 22 2c 0a 2d 09 20 20 20 20 2f 2a  "read",.-.    /*
0300: 63 72 65 61 74 65 50 61 72 74 31 2a 2f 20 28 66  createPart1*/ (f
0310: 6c 61 67 73 20 26 20 54 43 4c 5f 54 52 41 43 45  lags & TCL_TRACE
0320: 5f 52 45 41 44 53 29 2c 0a 2d 09 20 20 20 20 2f  _READS),.-.    /
0330: 2a 63 72 65 61 74 65 50 61 72 74 32 2a 2f 20 31  *createPart2*/ 1
0340: 2c 20 26 61 72 72 61 79 50 74 72 29 3b 0a 2b 09  , &arrayPtr);.+.
0350: 20 20 20 20 2f 2a 63 72 65 61 74 65 50 61 72 74      /*createPart
0360: 31 2a 2f 20 30 2c 20 2f 2a 63 72 65 61 74 65 50  1*/ 0, /*createP
0370: 61 72 74 32 2a 2f 20 31 2c 20 26 61 72 72 61 79  art2*/ 1, &array
0380: 50 74 72 29 3b 0a 20 20 20 20 20 69 66 20 28 76  Ptr);.     if (v
0390: 61 72 50 74 72 20 3d 3d 20 4e 55 4c 4c 29 20 7b  arPtr == NULL) {
03a0: 0a 20 09 72 65 74 75 72 6e 20 4e 55 4c 4c 3b 0a  . .return NULL;.
03b0: 20 20 20 20 20 7d 0a 40 40 20 2d 31 31 35 35 2c       }.@@ -1155,
03c0: 31 35 20 2b 31 31 35 30 2c 31 30 20 40 40 0a 20  15 +1150,10 @@. 
03d0: 20 20 20 20 70 61 72 74 31 20 3d 20 54 63 6c 47      part1 = TclG
03e0: 65 74 53 74 72 69 6e 67 28 70 61 72 74 31 50 74  etString(part1Pt
03f0: 72 29 3b 0a 20 20 20 20 20 70 61 72 74 32 20 3d  r);.     part2 =
0400: 20 28 28 70 61 72 74 32 50 74 72 20 3d 3d 20 4e   ((part2Ptr == N
0410: 55 4c 4c 29 20 3f 20 4e 55 4c 4c 20 3a 20 54 63  ULL) ? NULL : Tc
0420: 6c 47 65 74 53 74 72 69 6e 67 28 70 61 72 74 32  lGetString(part2
0430: 50 74 72 29 29 3b 0a 20 0a 2d 20 20 20 20 2f 2a  Ptr));. .-    /*
0440: 0a 2d 20 20 20 20 20 2a 20 57 65 20 6e 65 65 64  .-     * We need
0450: 20 61 20 73 70 65 63 69 61 6c 20 66 6c 61 67 20   a special flag 
0460: 63 68 65 63 6b 20 74 6f 20 73 65 65 20 69 66 20  check to see if 
0470: 77 65 20 77 61 6e 74 20 74 6f 20 63 72 65 61 74  we want to creat
0480: 65 20 70 61 72 74 20 31 2c 0a 2d 20 20 20 20 20  e part 1,.-     
0490: 2a 20 62 65 63 61 75 73 65 20 63 6f 6d 6d 61 6e  * because comman
04a0: 64 73 20 6c 69 6b 65 20 6c 61 70 70 65 6e 64 20  ds like lappend 
04b0: 72 65 71 75 69 72 65 20 72 65 61 64 20 74 72 61  require read tra
04c0: 63 65 73 20 74 6f 20 74 72 69 67 67 65 72 20 66  ces to trigger f
04d0: 6f 72 0a 2d 20 20 20 20 20 2a 20 70 72 65 76 69  or.-     * previ
04e0: 6f 75 73 6c 79 20 6e 6f 6e 2d 65 78 69 73 74 65  ously non-existe
04f0: 6e 74 20 76 61 6c 75 65 73 2e 0a 2d 20 20 20 20  nt values..-    
0500: 20 2a 2f 0a 2d 0a 2b 20 20 20 20 2f 2a 20 46 69   */.-.+    /* Fi
0510: 6c 74 65 72 20 74 6f 20 70 61 73 73 20 74 68 72  lter to pass thr
0520: 6f 75 67 68 20 6f 6e 6c 79 20 74 68 65 20 66 6c  ough only the fl
0530: 61 67 73 20 74 68 69 73 20 69 6e 74 65 72 66 61  ags this interfa
0540: 63 65 20 73 75 70 70 6f 72 74 73 2e 20 2a 2f 0a  ce supports. */.
0550: 2b 20 20 20 20 66 6c 61 67 73 20 26 3d 20 28 54  +    flags &= (T
0560: 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 7c 54  CL_GLOBAL_ONLY|T
0570: 43 4c 5f 4e 41 4d 45 53 50 41 43 45 5f 4f 4e 4c  CL_NAMESPACE_ONL
0580: 59 7c 54 43 4c 5f 4c 45 41 56 45 5f 45 52 52 5f  Y|TCL_LEAVE_ERR_
0590: 4d 53 47 29 3b 0a 20 20 20 20 20 76 61 72 50 74  MSG);.     varPt
05a0: 72 20 3d 20 54 63 6c 4f 62 6a 4c 6f 6f 6b 75 70  r = TclObjLookup
05b0: 56 61 72 28 69 6e 74 65 72 70 2c 20 70 61 72 74  Var(interp, part
05c0: 31 50 74 72 2c 20 70 61 72 74 32 2c 20 66 6c 61  1Ptr, part2, fla
05d0: 67 73 2c 20 22 72 65 61 64 22 2c 0a 2d 09 20 20  gs, "read",.-.  
05e0: 20 20 2f 2a 63 72 65 61 74 65 50 61 72 74 31 2a    /*createPart1*
05f0: 2f 20 28 66 6c 61 67 73 20 26 20 54 43 4c 5f 54  / (flags & TCL_T
0600: 52 41 43 45 5f 52 45 41 44 53 29 2c 0a 2d 09 20  RACE_READS),.-. 
0610: 20 20 20 2f 2a 63 72 65 61 74 65 50 61 72 74 32     /*createPart2
0620: 2a 2f 20 31 2c 20 26 61 72 72 61 79 50 74 72 29  */ 1, &arrayPtr)
0630: 3b 0a 2b 09 20 20 20 20 2f 2a 63 72 65 61 74 65  ;.+.    /*create
0640: 50 61 72 74 31 2a 2f 20 30 2c 20 2f 2a 63 72 65  Part1*/ 0, /*cre
0650: 61 74 65 50 61 72 74 32 2a 2f 20 31 2c 20 26 61  atePart2*/ 1, &a
0660: 72 72 61 79 50 74 72 29 3b 0a 20 20 20 20 20 69  rrayPtr);.     i
0670: 66 20 28 76 61 72 50 74 72 20 3d 3d 20 4e 55 4c  f (varPtr == NUL
0680: 4c 29 20 7b 0a 20 09 72 65 74 75 72 6e 20 4e 55  L) {. .return NU
0690: 4c 4c 3b 0a 20 20 20 20 20 7d 0a 40 40 20 2d 31  LL;.     }.@@ -1
06a0: 34 35 33 2c 36 20 2b 31 34 34 33 2c 39 20 40 40  453,6 +1443,9 @@
06b0: 0a 20 7b 0a 20 20 20 20 20 56 61 72 20 2a 76 61  . {.     Var *va
06c0: 72 50 74 72 2c 20 2a 61 72 72 61 79 50 74 72 3b  rPtr, *arrayPtr;
06d0: 0a 20 0a 2b 20 20 20 20 2f 2a 20 46 69 6c 74 65  . .+    /* Filte
06e0: 72 20 74 6f 20 70 61 73 73 20 74 68 72 6f 75 67  r to pass throug
06f0: 68 20 6f 6e 6c 79 20 74 68 65 20 66 6c 61 67 73  h only the flags
0700: 20 74 68 69 73 20 69 6e 74 65 72 66 61 63 65 20   this interface 
0710: 73 75 70 70 6f 72 74 73 2e 20 2a 2f 0a 2b 20 20  supports. */.+  
0720: 20 20 66 6c 61 67 73 20 26 3d 20 28 54 43 4c 5f    flags &= (TCL_
0730: 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 7c 54 43 4c 5f  GLOBAL_ONLY|TCL_
0740: 4e 41 4d 45 53 50 41 43 45 5f 4f 4e 4c 59 7c 54  NAMESPACE_ONLY|T
0750: 43 4c 5f 4c 45 41 56 45 5f 45 52 52 5f 4d 53 47  CL_LEAVE_ERR_MSG
0760: 0a 2b 09 20 20 20 20 7c 54 43 4c 5f 41 50 50 45  .+.    |TCL_APPE
0770: 4e 44 5f 56 41 4c 55 45 7c 54 43 4c 5f 4c 49 53  ND_VALUE|TCL_LIS
0780: 54 5f 45 4c 45 4d 45 4e 54 29 3b 0a 20 20 20 20  T_ELEMENT);.    
0790: 20 76 61 72 50 74 72 20 3d 20 54 63 6c 4c 6f 6f   varPtr = TclLoo
07a0: 6b 75 70 56 61 72 28 69 6e 74 65 72 70 2c 20 70  kupVar(interp, p
07b0: 61 72 74 31 2c 20 70 61 72 74 32 2c 20 66 6c 61  art1, part2, fla
07c0: 67 73 2c 20 22 73 65 74 22 2c 0a 20 09 20 20 20  gs, "set",. .   
07d0: 20 2f 2a 63 72 65 61 74 65 50 61 72 74 31 2a 2f   /*createPart1*/
07e0: 20 31 2c 20 2f 2a 63 72 65 61 74 65 50 61 72 74   1, /*createPart
07f0: 32 2a 2f 20 31 2c 20 26 61 72 72 61 79 50 74 72  2*/ 1, &arrayPtr
0800: 29 3b 0a 20 20 20 20 20 69 66 20 28 76 61 72 50  );.     if (varP
0810: 74 72 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 40 40  tr == NULL) {.@@
0820: 20 2d 31 35 31 32 2c 36 20 2b 31 35 30 35 2c 39   -1512,6 +1505,9
0830: 20 40 40 0a 20 20 20 20 20 70 61 72 74 31 20 3d   @@.     part1 =
0840: 20 54 63 6c 47 65 74 53 74 72 69 6e 67 28 70 61   TclGetString(pa
0850: 72 74 31 50 74 72 29 3b 0a 20 20 20 20 20 70 61  rt1Ptr);.     pa
0860: 72 74 32 20 3d 20 28 28 70 61 72 74 32 50 74 72  rt2 = ((part2Ptr
0870: 20 3d 3d 20 4e 55 4c 4c 29 20 3f 20 4e 55 4c 4c   == NULL) ? NULL
0880: 20 3a 20 54 63 6c 47 65 74 53 74 72 69 6e 67 28   : TclGetString(
0890: 70 61 72 74 32 50 74 72 29 29 3b 0a 20 0a 2b 20  part2Ptr));. .+ 
08a0: 20 20 20 2f 2a 20 46 69 6c 74 65 72 20 74 6f 20     /* Filter to 
08b0: 70 61 73 73 20 74 68 72 6f 75 67 68 20 6f 6e 6c  pass through onl
08c0: 79 20 74 68 65 20 66 6c 61 67 73 20 74 68 69 73  y the flags this
08d0: 20 69 6e 74 65 72 66 61 63 65 20 73 75 70 70 6f   interface suppo
08e0: 72 74 73 2e 20 2a 2f 0a 2b 20 20 20 20 66 6c 61  rts. */.+    fla
08f0: 67 73 20 26 3d 20 28 54 43 4c 5f 47 4c 4f 42 41  gs &= (TCL_GLOBA
0900: 4c 5f 4f 4e 4c 59 7c 54 43 4c 5f 4e 41 4d 45 53  L_ONLY|TCL_NAMES
0910: 50 41 43 45 5f 4f 4e 4c 59 7c 54 43 4c 5f 4c 45  PACE_ONLY|TCL_LE
0920: 41 56 45 5f 45 52 52 5f 4d 53 47 0a 2b 09 20 20  AVE_ERR_MSG.+.  
0930: 20 20 7c 54 43 4c 5f 41 50 50 45 4e 44 5f 56 41    |TCL_APPEND_VA
0940: 4c 55 45 7c 54 43 4c 5f 4c 49 53 54 5f 45 4c 45  LUE|TCL_LIST_ELE
0950: 4d 45 4e 54 29 3b 0a 20 20 20 20 20 76 61 72 50  MENT);.     varP
0960: 74 72 20 3d 20 54 63 6c 4f 62 6a 4c 6f 6f 6b 75  tr = TclObjLooku
0970: 70 56 61 72 28 69 6e 74 65 72 70 2c 20 70 61 72  pVar(interp, par
0980: 74 31 50 74 72 2c 20 70 61 72 74 32 2c 20 66 6c  t1Ptr, part2, fl
0990: 61 67 73 2c 20 22 73 65 74 22 2c 0a 20 09 20 20  ags, "set",. .  
09a0: 20 20 2f 2a 63 72 65 61 74 65 50 61 72 74 31 2a    /*createPart1*
09b0: 2f 20 31 2c 20 2f 2a 63 72 65 61 74 65 50 61 72  / 1, /*createPar
09c0: 74 32 2a 2f 20 31 2c 20 26 61 72 72 61 79 50 74  t2*/ 1, &arrayPt
09d0: 72 29 3b 0a 20 20 20 20 20 69 66 20 28 76 61 72  r);.     if (var
09e0: 50 74 72 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 40  Ptr == NULL) {.@
09f0: 40 20 2d 31 36 30 33 2c 37 20 2b 31 35 39 39 2c  @ -1603,7 +1599,
0a00: 38 20 40 40 0a 20 0a 20 20 20 20 20 2f 2a 0a 20  8 @@. .     /*. 
0a10: 20 20 20 20 20 2a 20 49 6e 76 6f 6b 65 20 61 6e       * Invoke an
0a20: 79 20 72 65 61 64 20 74 72 61 63 65 73 20 74 68  y read traces th
0a30: 61 74 20 68 61 76 65 20 62 65 65 6e 20 73 65 74  at have been set
0a40: 20 66 6f 72 20 74 68 65 20 76 61 72 69 61 62 6c   for the variabl
0a50: 65 20 69 66 20 69 74 20 69 73 0a 2d 20 20 20 20  e if it is.-    
0a60: 20 2a 20 72 65 71 75 65 73 74 65 64 3b 20 74 68   * requested; th
0a70: 69 73 20 69 73 20 6f 6e 6c 79 20 64 6f 6e 65 20  is is only done 
0a80: 69 6e 20 74 68 65 20 63 6f 72 65 20 77 68 65 6e  in the core when
0a90: 20 6c 61 70 70 65 6e 64 69 6e 67 2e 0a 2b 20 20   lappending..+  
0aa0: 20 20 20 2a 20 72 65 71 75 65 73 74 65 64 3b 20     * requested; 
0ab0: 74 68 69 73 20 69 73 20 6f 6e 6c 79 20 64 6f 6e  this is only don
0ac0: 65 20 69 6e 20 74 68 65 20 63 6f 72 65 20 62 79  e in the core by
0ad0: 20 74 68 65 20 49 4e 53 54 5f 4c 41 50 50 45 4e   the INST_LAPPEN
0ae0: 44 5f 2a 0a 2b 20 20 20 20 20 2a 20 69 6e 73 74  D_*.+     * inst
0af0: 72 75 63 74 69 6f 6e 73 2e 0a 20 20 20 20 20 20  ructions..      
0b00: 2a 2f 0a 20 0a 20 20 20 20 20 69 66 20 28 28 66  */. .     if ((f
0b10: 6c 61 67 73 20 26 20 54 43 4c 5f 54 52 41 43 45  lags & TCL_TRACE
0b20: 5f 52 45 41 44 53 29 20 26 26 20 28 28 76 61 72  _READS) && ((var
0b30: 50 74 72 2d 3e 74 72 61 63 65 50 74 72 20 21 3d  Ptr->tracePtr !=
0b40: 20 4e 55 4c 4c 29 0a 40 40 20 2d 31 39 33 36 2c   NULL).@@ -1936,
0b50: 36 20 2b 31 39 33 33 2c 38 20 40 40 0a 20 0a 20  6 +1933,8 @@. . 
0b60: 20 20 20 20 70 61 72 74 31 50 74 72 20 3d 20 54      part1Ptr = T
0b70: 63 6c 5f 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28  cl_NewStringObj(
0b80: 70 61 72 74 31 2c 20 2d 31 29 3b 0a 20 20 20 20  part1, -1);.    
0b90: 20 54 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e   Tcl_IncrRefCoun
0ba0: 74 28 70 61 72 74 31 50 74 72 29 3b 0a 2b 20 20  t(part1Ptr);.+  
0bb0: 20 20 2f 2a 20 46 69 6c 74 65 72 20 74 6f 20 70    /* Filter to p
0bc0: 61 73 73 20 74 68 72 6f 75 67 68 20 6f 6e 6c 79  ass through only
0bd0: 20 74 68 65 20 66 6c 61 67 73 20 74 68 69 73 20   the flags this 
0be0: 69 6e 74 65 72 66 61 63 65 20 73 75 70 70 6f 72  interface suppor
0bf0: 74 73 2e 20 2a 2f 0a 2b 20 20 20 20 66 6c 61 67  ts. */.+    flag
0c00: 73 20 26 3d 20 28 54 43 4c 5f 47 4c 4f 42 41 4c  s &= (TCL_GLOBAL
0c10: 5f 4f 4e 4c 59 7c 54 43 4c 5f 4e 41 4d 45 53 50  _ONLY|TCL_NAMESP
0c20: 41 43 45 5f 4f 4e 4c 59 7c 54 43 4c 5f 4c 45 41  ACE_ONLY|TCL_LEA
0c30: 56 45 5f 45 52 52 5f 4d 53 47 29 3b 0a 20 20 20  VE_ERR_MSG);.   
0c40: 20 20 72 65 73 75 6c 74 20 3d 20 54 63 6c 4f 62    result = TclOb
0c50: 6a 55 6e 73 65 74 56 61 72 32 28 69 6e 74 65 72  jUnsetVar2(inter
0c60: 70 2c 20 70 61 72 74 31 50 74 72 2c 20 70 61 72  p, part1Ptr, par
0c70: 74 32 2c 20 66 6c 61 67 73 29 3b 0a 20 20 20 20  t2, flags);.    
0c80: 20 54 63 6c 44 65 63 72 52 65 66 43 6f 75 6e 74   TclDecrRefCount
0c90: 28 70 61 72 74 31 50 74 72 29 3b 0a 20 0a 40 40  (part1Ptr);. .@@
0ca0: 20 2d 32 31 32 31 2c 38 20 2b 32 31 32 30 2c 38   -2121,8 +2120,8
0cb0: 20 40 40 0a 20 20 20 20 20 69 66 20 28 28 64 75   @@.     if ((du
0cc0: 6d 6d 79 56 61 72 2e 74 72 61 63 65 50 74 72 20  mmyVar.tracePtr 
0cd0: 21 3d 20 4e 55 4c 4c 29 0a 20 09 20 20 20 20 7c  != NULL). .    |
0ce0: 7c 20 28 28 61 72 72 61 79 50 74 72 20 21 3d 20  | ((arrayPtr != 
0cf0: 4e 55 4c 4c 29 20 26 26 20 28 61 72 72 61 79 50  NULL) && (arrayP
0d00: 74 72 2d 3e 74 72 61 63 65 50 74 72 20 21 3d 20  tr->tracePtr != 
0d10: 4e 55 4c 4c 29 29 29 20 7b 0a 20 09 64 75 6d 6d  NULL))) {. .dumm
0d20: 79 56 61 72 2e 66 6c 61 67 73 20 26 3d 20 7e 56  yVar.flags &= ~V
0d30: 41 52 5f 54 52 41 43 45 5f 41 43 54 49 56 45 3b  AR_TRACE_ACTIVE;
0d40: 0a 2d 09 54 63 6c 43 61 6c 6c 56 61 72 54 72 61  .-.TclCallVarTra
0d50: 63 65 73 28 69 50 74 72 2c 20 61 72 72 61 79 50  ces(iPtr, arrayP
0d60: 74 72 2c 20 26 64 75 6d 6d 79 56 61 72 2c 20 70  tr, &dummyVar, p
0d70: 61 72 74 31 2c 20 70 61 72 74 32 2c 0a 2d 09 09  art1, part2,.-..
0d80: 28 66 6c 61 67 73 20 26 20 28 54 43 4c 5f 47 4c  (flags & (TCL_GL
0d90: 4f 42 41 4c 5f 4f 4e 4c 59 7c 54 43 4c 5f 4e 41  OBAL_ONLY|TCL_NA
0da0: 4d 45 53 50 41 43 45 5f 4f 4e 4c 59 7c 54 43 4c  MESPACE_ONLY|TCL
0db0: 5f 49 4e 54 45 52 50 5f 44 45 53 54 52 4f 59 45  _INTERP_DESTROYE
0dc0: 44 29 29 0a 2b 09 54 63 6c 43 61 6c 6c 56 61 72  D)).+.TclCallVar
0dd0: 54 72 61 63 65 73 28 69 50 74 72 2c 20 61 72 72  Traces(iPtr, arr
0de0: 61 79 50 74 72 2c 20 26 64 75 6d 6d 79 56 61 72  ayPtr, &dummyVar
0df0: 2c 20 70 61 72 74 31 2c 20 70 61 72 74 32 2c 20  , part1, part2, 
0e00: 28 66 6c 61 67 73 0a 2b 09 09 26 20 28 54 43 4c  (flags.+..& (TCL
0e10: 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 7c 54 43 4c  _GLOBAL_ONLY|TCL
0e20: 5f 4e 41 4d 45 53 50 41 43 45 5f 4f 4e 4c 59 7c  _NAMESPACE_ONLY|
0e30: 54 43 4c 5f 49 4e 54 45 52 50 5f 44 45 53 54 52  TCL_INTERP_DESTR
0e40: 4f 59 45 44 29 29 0a 20 09 09 7c 20 54 43 4c 5f  OYED)). ..| TCL_
0e50: 54 52 41 43 45 5f 55 4e 53 45 54 53 2c 20 2f 2a  TRACE_UNSETS, /*
0e60: 20 6c 65 61 76 65 45 72 72 4d 73 67 20 2a 2f 20   leaveErrMsg */ 
0e70: 30 29 3b 0a 20 09 77 68 69 6c 65 20 28 64 75 6d  0);. .while (dum
0e80: 6d 79 56 61 72 2e 74 72 61 63 65 50 74 72 20 21  myVar.tracePtr !
0e90: 3d 20 4e 55 4c 4c 29 20 7b 0a 20 09 20 20 20 20  = NULL) {. .    
0ea0: 56 61 72 54 72 61 63 65 20 2a 74 72 61 63 65 50  VarTrace *traceP
0eb0: 74 72 20 3d 20 64 75 6d 6d 79 56 61 72 2e 74 72  tr = dummyVar.tr
0ec0: 61 63 65 50 74 72 3b 0a 40 40 20 2d 32 31 34 36  acePtr;.@@ -2146
0ed0: 2c 32 31 20 2b 32 31 34 35 2c 38 20 40 40 0a 20  ,21 +2145,8 @@. 
0ee0: 0a 20 20 20 20 20 64 75 6d 6d 79 56 61 72 50 74  .     dummyVarPt
0ef0: 72 20 3d 20 26 64 75 6d 6d 79 56 61 72 3b 0a 20  r = &dummyVar;. 
0f00: 20 20 20 20 69 66 20 28 54 63 6c 49 73 56 61 72      if (TclIsVar
0f10: 41 72 72 61 79 28 64 75 6d 6d 79 56 61 72 50 74  Array(dummyVarPt
0f20: 72 29 20 26 26 20 21 54 63 6c 49 73 56 61 72 55  r) && !TclIsVarU
0f30: 6e 64 65 66 69 6e 65 64 28 64 75 6d 6d 79 56 61  ndefined(dummyVa
0f40: 72 50 74 72 29 29 20 7b 0a 2d 09 2f 2a 0a 2d 09  rPtr)) {.-./*.-.
0f50: 20 2a 20 44 65 6c 65 74 69 6e 67 20 74 68 65 20   * Deleting the 
0f60: 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 20  elements of the 
0f70: 61 72 72 61 79 20 6d 61 79 20 63 61 75 73 65 20  array may cause 
0f80: 74 72 61 63 65 73 20 74 6f 20 62 65 20 66 69 72  traces to be fir
0f90: 65 64 20 6f 6e 0a 2d 09 20 2a 20 74 68 6f 73 65  ed on.-. * those
0fa0: 20 65 6c 65 6d 65 6e 74 73 2e 20 42 65 66 6f 72   elements. Befor
0fb0: 65 20 64 65 6c 65 74 69 6e 67 20 74 68 65 6d 2c  e deleting them,
0fc0: 20 62 75 6d 70 20 74 68 65 20 72 65 66 65 72 65   bump the refere
0fd0: 6e 63 65 20 63 6f 75 6e 74 20 6f 66 0a 2d 09 20  nce count of.-. 
0fe0: 2a 20 74 68 65 20 61 72 72 61 79 2c 20 73 6f 20  * the array, so 
0ff0: 74 68 61 74 20 69 66 20 74 68 6f 73 65 20 74 72  that if those tr
1000: 61 63 65 20 70 72 6f 63 73 20 6d 61 6b 65 20 61  ace procs make a
1010: 20 67 6c 6f 62 61 6c 20 6f 72 20 75 70 76 61 72   global or upvar
1020: 20 6c 69 6e 6b 0a 2d 09 20 2a 20 74 6f 20 74 68   link.-. * to th
1030: 65 20 61 72 72 61 79 2c 20 74 68 65 20 61 72 72  e array, the arr
1040: 61 79 20 69 73 20 6e 6f 74 20 64 65 6c 65 74 65  ay is not delete
1050: 64 20 77 68 65 6e 20 74 68 65 20 63 61 6c 6c 20  d when the call 
1060: 73 74 61 63 6b 20 67 65 74 73 0a 2d 09 20 2a 20  stack gets.-. * 
1070: 70 6f 70 70 65 64 20 28 77 65 20 77 69 6c 6c 20  popped (we will 
1080: 64 65 6c 65 74 65 20 74 68 65 20 61 72 72 61 79  delete the array
1090: 20 6f 75 72 73 65 6c 76 65 73 20 6c 61 74 65 72   ourselves later
10a0: 20 69 6e 20 74 68 69 73 20 66 75 6e 63 74 69 6f   in this functio
10b0: 6e 29 2e 0a 2d 09 20 2a 0a 2d 09 20 2a 20 42 75  n)..-. *.-. * Bu
10c0: 6d 70 69 6e 67 20 74 68 65 20 63 6f 75 6e 74 20  mping the count 
10d0: 63 61 6e 20 6c 65 61 64 20 74 6f 20 74 68 65 20  can lead to the 
10e0: 6f 64 64 20 73 69 74 75 61 74 69 6f 6e 20 74 68  odd situation th
10f0: 61 74 20 65 6c 65 6d 65 6e 74 73 20 6f 66 0a 2d  at elements of.-
1100: 09 20 2a 20 74 68 65 20 61 72 72 61 79 20 61 72  . * the array ar
1110: 65 20 62 65 69 6e 67 20 64 65 6c 65 74 65 64 20  e being deleted 
1120: 77 68 65 6e 20 74 68 65 20 61 72 72 61 79 20 73  when the array s
1130: 74 69 6c 6c 20 65 78 69 73 74 73 2c 20 62 75 74  till exists, but
1140: 20 73 69 6e 63 65 0a 2d 09 20 2a 20 74 68 65 20   since.-. * the 
1150: 61 72 72 61 79 20 69 73 20 61 62 6f 75 74 20 74  array is about t
1160: 6f 20 62 65 20 72 65 6d 6f 76 65 64 20 61 6e 79  o be removed any
1170: 77 61 79 2c 20 74 68 61 74 20 73 68 6f 75 6c 64  way, that should
1180: 6e 27 74 20 72 65 61 6c 6c 79 0a 2d 09 20 2a 20  n't really.-. * 
1190: 6d 61 74 74 65 72 2e 0a 2d 09 20 2a 2f 0a 2d 0a  matter..-. */.-.
11a0: 2d 09 44 65 6c 65 74 65 41 72 72 61 79 28 69 50  -.DeleteArray(iP
11b0: 74 72 2c 20 70 61 72 74 31 2c 20 64 75 6d 6d 79  tr, part1, dummy
11c0: 56 61 72 50 74 72 2c 0a 2d 09 09 28 66 6c 61 67  VarPtr,.-..(flag
11d0: 73 20 26 20 28 54 43 4c 5f 47 4c 4f 42 41 4c 5f  s & (TCL_GLOBAL_
11e0: 4f 4e 4c 59 7c 54 43 4c 5f 4e 41 4d 45 53 50 41  ONLY|TCL_NAMESPA
11f0: 43 45 5f 4f 4e 4c 59 29 29 0a 2b 09 44 65 6c 65  CE_ONLY)).+.Dele
1200: 74 65 41 72 72 61 79 28 69 50 74 72 2c 20 70 61  teArray(iPtr, pa
1210: 72 74 31 2c 20 64 75 6d 6d 79 56 61 72 50 74 72  rt1, dummyVarPtr
1220: 2c 20 28 66 6c 61 67 73 20 0a 2b 09 09 26 20 28  , (flags .+..& (
1230: 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 7c  TCL_GLOBAL_ONLY|
1240: 54 43 4c 5f 4e 41 4d 45 53 50 41 43 45 5f 4f 4e  TCL_NAMESPACE_ON
1250: 4c 59 7c 54 43 4c 5f 49 4e 54 45 52 50 5f 44 45  LY|TCL_INTERP_DE
1260: 53 54 52 4f 59 45 44 29 29 0a 20 09 09 7c 20 54  STROYED)). ..| T
1270: 43 4c 5f 54 52 41 43 45 5f 55 4e 53 45 54 53 29  CL_TRACE_UNSETS)
1280: 3b 0a 20 0a 20 09 2f 2a 0a 40 40 20 2d 32 33 39  ;. . ./*.@@ -239
1290: 30 2c 31 30 20 2b 32 33 37 36 2c 37 20 40 40 0a  0,10 +2376,7 @@.
12a0: 20 09 63 72 65 61 74 65 64 4e 65 77 4f 62 6a 20   .createdNewObj 
12b0: 3d 20 30 3b 0a 20 0a 20 09 2f 2a 0a 2d 09 20 2a  = 0;. . ./*.-. *
12c0: 20 55 73 65 20 74 68 65 20 54 43 4c 5f 54 52 41   Use the TCL_TRA
12d0: 43 45 5f 52 45 41 44 53 20 66 6c 61 67 20 74 6f  CE_READS flag to
12e0: 20 65 6e 73 75 72 65 20 74 68 61 74 20 69 66 20   ensure that if 
12f0: 77 65 20 68 61 76 65 20 61 6e 20 61 72 72 61 79  we have an array
1300: 0a 2d 09 20 2a 20 77 69 74 68 20 6e 6f 20 65 6c  .-. * with no el
1310: 65 6d 65 6e 74 73 20 73 65 74 20 79 65 74 2c 20  ements set yet, 
1320: 62 75 74 20 77 69 74 68 20 61 20 72 65 61 64 20  but with a read 
1330: 74 72 61 63 65 20 6f 6e 20 69 74 2c 20 77 65 20  trace on it, we 
1340: 77 69 6c 6c 0a 2d 09 20 2a 20 63 72 65 61 74 65  will.-. * create
1350: 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 61 6e   the variable an
1360: 64 20 67 65 74 20 72 65 61 64 20 74 72 61 63 65  d get read trace
1370: 73 20 74 72 69 67 67 65 72 65 64 2e 20 4e 6f 74  s triggered. Not
1380: 65 20 74 68 61 74 20 79 6f 75 0a 2d 09 20 2a 20  e that you.-. * 
1390: 68 61 76 65 20 74 6f 20 70 72 6f 74 65 63 74 20  have to protect 
13a0: 74 68 65 20 76 61 72 69 61 62 6c 65 20 70 6f 69  the variable poi
13b0: 6e 74 65 72 73 20 61 72 6f 75 6e 64 20 74 68 65  nters around the
13c0: 20 54 63 6c 50 74 72 47 65 74 56 61 72 20 63 61   TclPtrGetVar ca
13d0: 6c 6c 0a 2b 09 20 2a 20 50 72 6f 74 65 63 74 20  ll.+. * Protect 
13e0: 74 68 65 20 76 61 72 69 61 62 6c 65 20 70 6f 69  the variable poi
13f0: 6e 74 65 72 73 20 61 72 6f 75 6e 64 20 74 68 65  nters around the
1400: 20 54 63 6c 50 74 72 47 65 74 56 61 72 20 63 61   TclPtrGetVar ca
1410: 6c 6c 0a 20 09 20 2a 20 74 6f 20 69 6e 73 75 72  ll. . * to insur
1420: 65 20 74 68 61 74 20 74 68 65 79 20 72 65 6d 61  e that they rema
1430: 69 6e 20 76 61 6c 69 64 20 65 76 65 6e 20 69 66  in valid even if
1440: 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 77 61   the variable wa
1450: 73 20 75 6e 64 65 66 69 6e 65 64 0a 20 09 20 2a  s undefined. . *
1460: 20 61 6e 64 20 75 6e 75 73 65 64 2e 0a 20 09 20   and unused.. . 
1470: 2a 2f 0a 40 40 20 2d 32 34 30 39 2c 37 20 2b 32  */.@@ -2409,7 +2
1480: 33 39 32 2c 37 20 40 40 0a 20 09 7d 0a 20 09 70  392,7 @@. .}. .p
1490: 61 72 74 31 20 3d 20 54 63 6c 47 65 74 53 74 72  art1 = TclGetStr
14a0: 69 6e 67 28 6f 62 6a 76 5b 31 5d 29 3b 0a 20 09  ing(objv[1]);. .
14b0: 76 61 72 56 61 6c 75 65 50 74 72 20 3d 20 54 63  varValuePtr = Tc
14c0: 6c 50 74 72 47 65 74 56 61 72 28 69 6e 74 65 72  lPtrGetVar(inter
14d0: 70 2c 20 76 61 72 50 74 72 2c 20 61 72 72 61 79  p, varPtr, array
14e0: 50 74 72 2c 20 70 61 72 74 31 2c 20 4e 55 4c 4c  Ptr, part1, NULL
14f0: 2c 0a 2d 09 09 28 54 43 4c 5f 54 52 41 43 45 5f  ,.-..(TCL_TRACE_
1500: 52 45 41 44 53 20 7c 20 54 43 4c 5f 4c 45 41 56  READS | TCL_LEAV
1510: 45 5f 45 52 52 5f 4d 53 47 29 29 3b 0a 2b 09 09  E_ERR_MSG));.+..
1520: 54 43 4c 5f 4c 45 41 56 45 5f 45 52 52 5f 4d 53  TCL_LEAVE_ERR_MS
1530: 47 29 3b 0a 20 09 76 61 72 50 74 72 2d 3e 72 65  G);. .varPtr->re
1540: 66 43 6f 75 6e 74 2d 2d 3b 0a 20 09 69 66 20 28  fCount--;. .if (
1550: 61 72 72 61 79 50 74 72 20 21 3d 20 4e 55 4c 4c  arrayPtr != NULL
1560: 29 20 7b 0a 20 09 20 20 20 20 61 72 72 61 79 50  ) {. .    arrayP
1570: 74 72 2d 3e 72 65 66 43 6f 75 6e 74 2d 2d 3b 0a  tr->refCount--;.
1580: 40 40 20 2d 34 32 39 33 2c 36 20 2b 34 32 37 36  @@ -4293,6 +4276
1590: 2c 39 20 40 40 0a 20 20 20 20 20 69 6e 74 20 6e  ,9 @@.     int n
15a0: 75 6d 4c 6f 63 61 6c 73 2c 20 69 3b 0a 20 0a 20  umLocals, i;. . 
15b0: 20 20 20 20 66 6c 61 67 73 20 3d 20 54 43 4c 5f      flags = TCL_
15c0: 54 52 41 43 45 5f 55 4e 53 45 54 53 3b 0a 2b 20  TRACE_UNSETS;.+ 
15d0: 20 20 20 69 66 20 28 54 63 6c 5f 49 6e 74 65 72     if (Tcl_Inter
15e0: 70 44 65 6c 65 74 65 64 28 28 54 63 6c 5f 49 6e  pDeleted((Tcl_In
15f0: 74 65 72 70 20 2a 29 69 50 74 72 29 29 20 7b 0a  terp *)iPtr)) {.
1600: 2b 09 66 6c 61 67 73 20 7c 3d 20 54 43 4c 5f 49  +.flags |= TCL_I
1610: 4e 54 45 52 50 5f 44 45 53 54 52 4f 59 45 44 3b  NTERP_DESTROYED;
1620: 0a 2b 20 20 20 20 7d 0a 20 20 20 20 20 6e 75 6d  .+    }.     num
1630: 4c 6f 63 61 6c 73 20 3d 20 66 72 61 6d 65 50 74  Locals = framePt
1640: 72 2d 3e 6e 75 6d 43 6f 6d 70 69 6c 65 64 4c 6f  r->numCompiledLo
1650: 63 61 6c 73 3b 0a 20 20 20 20 20 76 61 72 50 74  cals;.     varPt
1660: 72 20 3d 20 66 72 61 6d 65 50 74 72 2d 3e 63 6f  r = framePtr->co
1670: 6d 70 69 6c 65 64 4c 6f 63 61 6c 73 3b 0a 20 20  mpiledLocals;.  
1680: 20 20 20 66 6f 72 20 28 69 3d 30 20 3b 20 69 3c     for (i=0 ; i<
1690: 6e 75 6d 4c 6f 63 61 6c 73 20 3b 20 69 2b 2b 29  numLocals ; i++)
16a0: 20 7b 0a                                          {.