Tcl Source Code

Hex Artifact Content
Login

Artifact 7efccd0870a56b5af10fef0e72c7718f0e30e934:

Attachment "nsPath.diff" to ticket [1159942fff] added by dkf 2005-05-20 22:35:09.
0000: 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74  Index: generic/t
0010: 63 6c 42 61 73 69 63 2e 63 0a 3d 3d 3d 3d 3d 3d  clBasic.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 3d 3d 0a 52 43  =============.RC
0060: 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74  S file: /cvsroot
0070: 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63  /tcl/tcl/generic
0080: 2f 74 63 6c 42 61 73 69 63 2e 63 2c 76 0a 72 65  /tclBasic.c,v.re
0090: 74 72 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f  trieving revisio
00a0: 6e 20 31 2e 31 35 35 0a 64 69 66 66 20 2d 75 20  n 1.155.diff -u 
00b0: 2d 72 31 2e 31 35 35 20 74 63 6c 42 61 73 69 63  -r1.155 tclBasic
00c0: 2e 63 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74  .c.--- generic/t
00d0: 63 6c 42 61 73 69 63 2e 63 09 31 39 20 4d 61 79  clBasic.c.19 May
00e0: 20 32 30 30 35 20 31 35 3a 31 38 3a 30 32 20 2d   2005 15:18:02 -
00f0: 30 30 30 30 09 31 2e 31 35 35 0a 2b 2b 2b 20 67  0000.1.155.+++ g
0100: 65 6e 65 72 69 63 2f 74 63 6c 42 61 73 69 63 2e  eneric/tclBasic.
0110: 63 09 32 30 20 4d 61 79 20 32 30 30 35 20 31 35  c.20 May 2005 15
0120: 3a 32 35 3a 30 33 20 2d 30 30 30 30 0a 40 40 20  :25:03 -0000.@@ 
0130: 2d 31 35 37 36 2c 36 20 2b 31 35 37 36 2c 37 20  -1576,6 +1576,7 
0140: 40 40 0a 20 09 20 2a 2f 0a 20 0a 20 09 54 63 6c  @@. . */. . .Tcl
0150: 49 6e 76 61 6c 69 64 61 74 65 4e 73 43 6d 64 4c  InvalidateNsCmdL
0160: 6f 6f 6b 75 70 28 6e 73 50 74 72 29 3b 0a 2b 09  ookup(nsPtr);.+.
0170: 54 63 6c 49 6e 76 61 6c 69 64 61 74 65 4e 73 50  TclInvalidateNsP
0180: 61 74 68 28 6e 73 50 74 72 29 3b 0a 20 20 20 20  ath(nsPtr);.    
0190: 20 7d 0a 20 20 20 20 20 63 6d 64 50 74 72 20 3d   }.     cmdPtr =
01a0: 20 28 43 6f 6d 6d 61 6e 64 20 2a 29 20 63 6b 61   (Command *) cka
01b0: 6c 6c 6f 63 28 73 69 7a 65 6f 66 28 43 6f 6d 6d  lloc(sizeof(Comm
01c0: 61 6e 64 29 29 3b 0a 20 20 20 20 20 54 63 6c 5f  and));.     Tcl_
01d0: 53 65 74 48 61 73 68 56 61 6c 75 65 28 68 50 74  SetHashValue(hPt
01e0: 72 2c 20 63 6d 64 50 74 72 29 3b 0a 40 40 20 2d  r, cmdPtr);.@@ -
01f0: 31 37 30 30 2c 36 20 2b 31 37 30 31 2c 37 20 40  1700,6 +1701,7 @
0200: 40 0a 20 20 20 20 20 7d 0a 20 0a 20 20 20 20 20  @.     }. .     
0210: 68 50 74 72 20 3d 20 54 63 6c 5f 43 72 65 61 74  hPtr = Tcl_Creat
0220: 65 48 61 73 68 45 6e 74 72 79 28 26 6e 73 50 74  eHashEntry(&nsPt
0230: 72 2d 3e 63 6d 64 54 61 62 6c 65 2c 20 74 61 69  r->cmdTable, tai
0240: 6c 2c 20 26 6e 65 77 29 3b 0a 2b 09 54 63 6c 49  l, &new);.+.TclI
0250: 6e 76 61 6c 69 64 61 74 65 4e 73 50 61 74 68 28  nvalidateNsPath(
0260: 6e 73 50 74 72 29 3b 0a 20 20 20 20 20 69 66 20  nsPtr);.     if 
0270: 28 21 6e 65 77 29 20 7b 0a 20 09 63 6d 64 50 74  (!new) {. .cmdPt
0280: 72 20 3d 20 28 43 6f 6d 6d 61 6e 64 20 2a 29 20  r = (Command *) 
0290: 54 63 6c 5f 47 65 74 48 61 73 68 56 61 6c 75 65  Tcl_GetHashValue
02a0: 28 68 50 74 72 29 3b 0a 20 0a 40 40 20 2d 31 37  (hPtr);. .@@ -17
02b0: 34 36 2c 36 20 2b 31 37 34 38 2c 37 20 40 40 0a  46,6 +1748,7 @@.
02c0: 20 09 20 2a 2f 0a 20 0a 20 09 54 63 6c 49 6e 76   . */. . .TclInv
02d0: 61 6c 69 64 61 74 65 4e 73 43 6d 64 4c 6f 6f 6b  alidateNsCmdLook
02e0: 75 70 28 6e 73 50 74 72 29 3b 0a 2b 09 54 63 6c  up(nsPtr);.+.Tcl
02f0: 49 6e 76 61 6c 69 64 61 74 65 4e 73 50 61 74 68  InvalidateNsPath
0300: 28 6e 73 50 74 72 29 3b 0a 20 20 20 20 20 7d 0a  (nsPtr);.     }.
0310: 20 20 20 20 20 63 6d 64 50 74 72 20 3d 20 28 43       cmdPtr = (C
0320: 6f 6d 6d 61 6e 64 20 2a 29 20 63 6b 61 6c 6c 6f  ommand *) ckallo
0330: 63 28 73 69 7a 65 6f 66 28 43 6f 6d 6d 61 6e 64  c(sizeof(Command
0340: 29 29 3b 0a 20 20 20 20 20 54 63 6c 5f 53 65 74  ));.     Tcl_Set
0350: 48 61 73 68 56 61 6c 75 65 28 68 50 74 72 2c 20  HashValue(hPtr, 
0360: 63 6d 64 50 74 72 29 3b 0a 49 6e 64 65 78 3a 20  cmdPtr);.Index: 
0370: 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 49 4c  generic/tclCmdIL
0380: 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .c.=============
0390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
03a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
03b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
03c0: 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a  ======.RCS file:
03d0: 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63   /cvsroot/tcl/tc
03e0: 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64  l/generic/tclCmd
03f0: 49 4c 2e 63 2c 76 0a 72 65 74 72 69 65 76 69 6e  IL.c,v.retrievin
0400: 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 37 34 0a  g revision 1.74.
0410: 64 69 66 66 20 2d 75 20 2d 72 31 2e 37 34 20 74  diff -u -r1.74 t
0420: 63 6c 43 6d 64 49 4c 2e 63 0a 2d 2d 2d 20 67 65  clCmdIL.c.--- ge
0430: 6e 65 72 69 63 2f 74 63 6c 43 6d 64 49 4c 2e 63  neric/tclCmdIL.c
0440: 09 31 30 20 4d 61 79 20 32 30 30 35 20 31 38 3a  .10 May 2005 18:
0450: 33 34 3a 30 38 20 2d 30 30 30 30 09 31 2e 37 34  34:08 -0000.1.74
0460: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c  .+++ generic/tcl
0470: 43 6d 64 49 4c 2e 63 09 32 30 20 4d 61 79 20 32  CmdIL.c.20 May 2
0480: 30 30 35 20 31 35 3a 32 35 3a 30 33 20 2d 30 30  005 15:25:03 -00
0490: 30 30 0a 40 40 20 2d 37 31 32 2c 36 20 2b 37 31  00.@@ -712,6 +71
04a0: 32 2c 37 20 40 40 0a 20 20 20 20 20 54 63 6c 5f  2,7 @@.     Tcl_
04b0: 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 20 2a 65  Obj *listPtr, *e
04c0: 6c 65 6d 4f 62 6a 50 74 72 3b 0a 20 20 20 20 20  lemObjPtr;.     
04d0: 69 6e 74 20 73 70 65 63 69 66 69 63 4e 73 49 6e  int specificNsIn
04e0: 50 61 74 74 65 72 6e 20 3d 20 30 3b 20 20 2f 2a  Pattern = 0;  /*
04f0: 20 49 6e 69 74 2e 20 74 6f 20 61 76 6f 69 64 20   Init. to avoid 
0500: 63 6f 6d 70 69 6c 65 72 20 77 61 72 6e 69 6e 67  compiler warning
0510: 2e 20 2a 2f 0a 20 20 20 20 20 54 63 6c 5f 43 6f  . */.     Tcl_Co
0520: 6d 6d 61 6e 64 20 63 6d 64 3b 0a 2b 20 20 20 20  mmand cmd;.+    
0530: 69 6e 74 20 69 3b 0a 20 0a 20 20 20 20 20 2f 2a  int i;. .     /*
0540: 0a 20 20 20 20 20 20 2a 20 47 65 74 20 74 68 65  .      * Get the
0550: 20 70 61 74 74 65 72 6e 20 61 6e 64 20 66 69 6e   pattern and fin
0560: 64 20 74 68 65 20 22 65 66 66 65 63 74 69 76 65  d the "effective
0570: 20 6e 61 6d 65 73 70 61 63 65 22 20 69 6e 20 77   namespace" in w
0580: 68 69 63 68 20 74 6f 0a 40 40 20 2d 37 37 39 2c  hich to.@@ -779,
0590: 31 36 20 2b 37 38 30 2c 34 33 20 40 40 0a 20 09  16 +780,43 @@. .
05a0: 09 65 6c 65 6d 4f 62 6a 50 74 72 20 3d 20 54 63  .elemObjPtr = Tc
05b0: 6c 5f 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28 63  l_NewStringObj(c
05c0: 6d 64 4e 61 6d 65 2c 20 2d 31 29 3b 0a 20 09 20  mdName, -1);. . 
05d0: 20 20 20 7d 0a 20 09 20 20 20 20 54 63 6c 5f 4c     }. .    Tcl_L
05e0: 69 73 74 4f 62 6a 41 70 70 65 6e 64 45 6c 65 6d  istObjAppendElem
05f0: 65 6e 74 28 69 6e 74 65 72 70 2c 20 6c 69 73 74  ent(interp, list
0600: 50 74 72 2c 20 65 6c 65 6d 4f 62 6a 50 74 72 29  Ptr, elemObjPtr)
0610: 3b 0a 2d 09 7d 20 65 6c 73 65 20 69 66 20 28 28  ;.-.} else if ((
0620: 6e 73 50 74 72 20 21 3d 20 67 6c 6f 62 61 6c 4e  nsPtr != globalN
0630: 73 50 74 72 29 20 26 26 20 21 73 70 65 63 69 66  sPtr) && !specif
0640: 69 63 4e 73 49 6e 50 61 74 74 65 72 6e 29 20 7b  icNsInPattern) {
0650: 0a 2d 09 20 20 20 20 65 6e 74 72 79 50 74 72 20  .-.    entryPtr 
0660: 3d 20 54 63 6c 5f 46 69 6e 64 48 61 73 68 45 6e  = Tcl_FindHashEn
0670: 74 72 79 28 26 67 6c 6f 62 61 6c 4e 73 50 74 72  try(&globalNsPtr
0680: 2d 3e 63 6d 64 54 61 62 6c 65 2c 0a 2d 09 09 20  ->cmdTable,.-.. 
0690: 20 20 20 73 69 6d 70 6c 65 50 61 74 74 65 72 6e     simplePattern
06a0: 29 3b 0a 2b 09 20 20 20 20 54 63 6c 5f 53 65 74  );.+.    Tcl_Set
06b0: 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 70  ObjResult(interp
06c0: 2c 20 6c 69 73 74 50 74 72 29 3b 0a 2b 09 20 20  , listPtr);.+.  
06d0: 20 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b    return TCL_OK;
06e0: 0a 2b 09 7d 0a 2b 09 69 66 20 28 28 6e 73 50 74  .+.}.+.if ((nsPt
06f0: 72 20 21 3d 20 67 6c 6f 62 61 6c 4e 73 50 74 72  r != globalNsPtr
0700: 29 20 26 26 20 21 73 70 65 63 69 66 69 63 4e 73  ) && !specificNs
0710: 49 6e 50 61 74 74 65 72 6e 29 20 7b 0a 2b 09 20  InPattern) {.+. 
0720: 20 20 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65     Tcl_HashTable
0730: 20 2a 74 61 62 6c 65 50 74 72 3b 0a 2b 0a 2b 09   *tablePtr;.+.+.
0740: 20 20 20 20 66 6f 72 20 28 69 3d 30 20 3b 20 69      for (i=0 ; i
0750: 3c 6e 73 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64 50  <nsPtr->commandP
0760: 61 74 68 4c 65 6e 67 74 68 20 3b 20 69 2b 2b 29  athLength ; i++)
0770: 20 7b 0a 2b 09 09 4e 61 6d 65 73 70 61 63 65 20   {.+..Namespace 
0780: 2a 70 61 74 68 4e 73 50 74 72 20 3d 20 6e 73 50  *pathNsPtr = nsP
0790: 74 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68 41  tr->commandPathA
07a0: 72 72 61 79 5b 69 5d 2e 6e 73 50 74 72 3b 0a 2b  rray[i].nsPtr;.+
07b0: 0a 2b 09 09 69 66 20 28 70 61 74 68 4e 73 50 74  .+..if (pathNsPt
07c0: 72 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09  r == NULL) {.+..
07d0: 20 20 20 20 63 6f 6e 74 69 6e 75 65 3b 0a 2b 09      continue;.+.
07e0: 09 7d 0a 2b 09 09 74 61 62 6c 65 50 74 72 20 3d  .}.+..tablePtr =
07f0: 20 26 70 61 74 68 4e 73 50 74 72 2d 3e 63 6d 64   &pathNsPtr->cmd
0800: 54 61 62 6c 65 3b 0a 2b 09 09 65 6e 74 72 79 50  Table;.+..entryP
0810: 74 72 20 3d 20 54 63 6c 5f 46 69 6e 64 48 61 73  tr = Tcl_FindHas
0820: 68 45 6e 74 72 79 28 74 61 62 6c 65 50 74 72 2c  hEntry(tablePtr,
0830: 20 73 69 6d 70 6c 65 50 61 74 74 65 72 6e 29 3b   simplePattern);
0840: 0a 2b 09 09 69 66 20 28 65 6e 74 72 79 50 74 72  .+..if (entryPtr
0850: 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 20   != NULL) {.+.. 
0860: 20 20 20 62 72 65 61 6b 3b 0a 2b 09 09 7d 0a 2b     break;.+..}.+
0870: 09 20 20 20 20 7d 0a 2b 09 20 20 20 20 69 66 20  .    }.+.    if 
0880: 28 65 6e 74 72 79 50 74 72 20 3d 3d 20 4e 55 4c  (entryPtr == NUL
0890: 4c 29 20 7b 0a 2b 09 09 74 61 62 6c 65 50 74 72  L) {.+..tablePtr
08a0: 20 3d 20 26 67 6c 6f 62 61 6c 4e 73 50 74 72 2d   = &globalNsPtr-
08b0: 3e 63 6d 64 54 61 62 6c 65 3b 0a 2b 09 09 65 6e  >cmdTable;.+..en
08c0: 74 72 79 50 74 72 20 3d 20 54 63 6c 5f 46 69 6e  tryPtr = Tcl_Fin
08d0: 64 48 61 73 68 45 6e 74 72 79 28 74 61 62 6c 65  dHashEntry(table
08e0: 50 74 72 2c 20 73 69 6d 70 6c 65 50 61 74 74 65  Ptr, simplePatte
08f0: 72 6e 29 3b 0a 2b 09 20 20 20 20 7d 0a 20 09 20  rn);.+.    }. . 
0900: 20 20 20 69 66 20 28 65 6e 74 72 79 50 74 72 20     if (entryPtr 
0910: 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2d 09 09 63 6d  != NULL) {.-..cm
0920: 64 4e 61 6d 65 20 3d 20 54 63 6c 5f 47 65 74 48  dName = Tcl_GetH
0930: 61 73 68 4b 65 79 28 26 67 6c 6f 62 61 6c 4e 73  ashKey(&globalNs
0940: 50 74 72 2d 3e 63 6d 64 54 61 62 6c 65 2c 20 65  Ptr->cmdTable, e
0950: 6e 74 72 79 50 74 72 29 3b 0a 2b 09 09 63 6d 64  ntryPtr);.+..cmd
0960: 4e 61 6d 65 20 3d 20 54 63 6c 5f 47 65 74 48 61  Name = Tcl_GetHa
0970: 73 68 4b 65 79 28 74 61 62 6c 65 50 74 72 2c 20  shKey(tablePtr, 
0980: 65 6e 74 72 79 50 74 72 29 3b 0a 20 09 09 54 63  entryPtr);. ..Tc
0990: 6c 5f 4c 69 73 74 4f 62 6a 41 70 70 65 6e 64 45  l_ListObjAppendE
09a0: 6c 65 6d 65 6e 74 28 69 6e 74 65 72 70 2c 20 6c  lement(interp, l
09b0: 69 73 74 50 74 72 2c 0a 20 09 09 09 54 63 6c 5f  istPtr,. ...Tcl_
09c0: 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28 63 6d 64  NewStringObj(cmd
09d0: 4e 61 6d 65 2c 20 2d 31 29 29 3b 0a 2b 09 09 54  Name, -1));.+..T
09e0: 63 6c 5f 53 65 74 4f 62 6a 52 65 73 75 6c 74 28  cl_SetObjResult(
09f0: 69 6e 74 65 72 70 2c 20 6c 69 73 74 50 74 72 29  interp, listPtr)
0a00: 3b 0a 2b 09 09 72 65 74 75 72 6e 20 54 43 4c 5f  ;.+..return TCL_
0a10: 4f 4b 3b 0a 20 09 20 20 20 20 7d 0a 20 09 7d 0a  OK;. .    }. .}.
0a20: 2d 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 2b 20  -    } else {.+ 
0a30: 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6e 73     } else if (ns
0a40: 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68  Ptr->commandPath
0a50: 4c 65 6e 67 74 68 20 3d 3d 20 30 20 7c 7c 20 73  Length == 0 || s
0a60: 70 65 63 69 66 69 63 4e 73 49 6e 50 61 74 74 65  pecificNsInPatte
0a70: 72 6e 29 20 7b 0a 2b 09 2f 2a 0a 2b 09 20 2a 20  rn) {.+./*.+. * 
0a80: 54 68 65 20 70 61 74 74 65 72 6e 20 69 73 20 6e  The pattern is n
0a90: 6f 6e 2d 74 72 69 76 69 61 6c 2c 20 62 75 74 20  on-trivial, but 
0aa0: 65 69 74 68 65 72 20 74 68 65 72 65 20 69 73 20  either there is 
0ab0: 6e 6f 20 65 78 70 6c 69 63 69 74 0a 2b 09 20 2a  no explicit.+. *
0ac0: 20 70 61 74 68 20 6f 72 20 74 68 65 72 65 20 69   path or there i
0ad0: 73 20 61 6e 20 65 78 70 6c 69 63 69 74 20 6e 61  s an explicit na
0ae0: 6d 65 73 70 61 63 65 20 69 6e 20 74 68 65 20 70  mespace in the p
0af0: 61 74 74 65 72 6e 2e 20 49 6e 0a 2b 09 20 2a 20  attern. In.+. * 
0b00: 62 6f 74 68 20 63 61 73 65 73 2c 20 74 68 65 20  both cases, the 
0b10: 6f 6c 64 20 6d 61 74 63 68 69 6e 67 20 73 63 68  old matching sch
0b20: 65 6d 65 20 69 73 20 70 65 72 66 65 63 74 2e 0a  eme is perfect..
0b30: 2b 09 20 2a 2f 0a 2b 0a 20 09 65 6e 74 72 79 50  +. */.+. .entryP
0b40: 74 72 20 3d 20 54 63 6c 5f 46 69 72 73 74 48 61  tr = Tcl_FirstHa
0b50: 73 68 45 6e 74 72 79 28 26 6e 73 50 74 72 2d 3e  shEntry(&nsPtr->
0b60: 63 6d 64 54 61 62 6c 65 2c 20 26 73 65 61 72 63  cmdTable, &searc
0b70: 68 29 3b 0a 20 09 77 68 69 6c 65 20 28 65 6e 74  h);. .while (ent
0b80: 72 79 50 74 72 20 21 3d 20 4e 55 4c 4c 29 20 7b  ryPtr != NULL) {
0b90: 0a 20 09 20 20 20 20 63 6d 64 4e 61 6d 65 20 3d  . .    cmdName =
0ba0: 20 54 63 6c 5f 47 65 74 48 61 73 68 4b 65 79 28   Tcl_GetHashKey(
0bb0: 26 6e 73 50 74 72 2d 3e 63 6d 64 54 61 62 6c 65  &nsPtr->cmdTable
0bc0: 2c 20 65 6e 74 72 79 50 74 72 29 3b 0a 40 40 20  , entryPtr);.@@ 
0bd0: 2d 38 32 38 2c 36 20 2b 38 35 36 2c 39 35 20 40  -828,6 +856,95 @
0be0: 40 0a 20 09 09 65 6e 74 72 79 50 74 72 20 3d 20  @. ..entryPtr = 
0bf0: 54 63 6c 5f 4e 65 78 74 48 61 73 68 45 6e 74 72  Tcl_NextHashEntr
0c00: 79 28 26 73 65 61 72 63 68 29 3b 0a 20 09 20 20  y(&search);. .  
0c10: 20 20 7d 0a 20 09 7d 0a 2b 20 20 20 20 7d 20 65    }. .}.+    } e
0c20: 6c 73 65 20 7b 0a 2b 09 2f 2a 0a 2b 09 20 2a 20  lse {.+./*.+. * 
0c30: 54 68 65 20 70 61 74 74 65 72 6e 20 69 73 20 6e  The pattern is n
0c40: 6f 6e 2d 74 72 69 76 69 61 6c 20 28 63 61 6e 20  on-trivial (can 
0c50: 6d 61 74 63 68 20 6d 6f 72 65 20 74 68 61 6e 20  match more than 
0c60: 6f 6e 65 20 63 6f 6d 6d 61 6e 64 0a 2b 09 20 2a  one command.+. *
0c70: 20 6e 61 6d 65 29 2c 20 74 68 65 72 65 20 69 73   name), there is
0c80: 20 61 6e 20 65 78 70 6c 69 63 69 74 20 70 61 74   an explicit pat
0c90: 68 2c 20 61 6e 64 20 74 68 65 72 65 20 69 73 20  h, and there is 
0ca0: 6e 6f 20 65 78 70 6c 69 63 69 74 0a 2b 09 20 2a  no explicit.+. *
0cb0: 20 6e 61 6d 65 73 70 61 63 65 20 69 6e 20 74 68   namespace in th
0cc0: 65 20 70 61 74 74 65 72 6e 2e 20 54 68 69 73 20  e pattern. This 
0cd0: 6d 65 61 6e 73 20 74 68 61 74 20 77 65 20 68 61  means that we ha
0ce0: 76 65 20 74 6f 0a 2b 09 20 2a 20 74 72 61 76 65  ve to.+. * trave
0cf0: 72 73 65 20 74 68 65 20 70 61 74 68 20 74 6f 20  rse the path to 
0d00: 64 69 73 63 6f 76 65 72 20 61 6c 6c 20 74 68 65  discover all the
0d10: 20 63 6f 6d 6d 61 6e 64 73 20 64 65 66 69 6e 65   commands define
0d20: 64 2e 0a 2b 09 20 2a 2f 0a 2b 0a 2b 09 54 63 6c  d..+. */.+.+.Tcl
0d30: 5f 48 61 73 68 54 61 62 6c 65 20 61 64 64 65 64  _HashTable added
0d40: 43 6f 6d 6d 61 6e 64 73 54 61 62 6c 65 3b 0a 2b  CommandsTable;.+
0d50: 09 69 6e 74 20 69 73 4e 65 77 3b 0a 2b 09 69 6e  .int isNew;.+.in
0d60: 74 20 66 6f 75 6e 64 47 6c 6f 62 61 6c 20 3d 20  t foundGlobal = 
0d70: 28 6e 73 50 74 72 20 3d 3d 20 67 6c 6f 62 61 6c  (nsPtr == global
0d80: 4e 73 50 74 72 29 3b 0a 2b 0a 2b 09 2f 2a 0a 2b  NsPtr);.+.+./*.+
0d90: 09 20 2a 20 57 65 20 6b 65 65 70 20 61 20 68 61  . * We keep a ha
0da0: 73 68 20 6f 66 20 74 68 65 20 6f 62 6a 65 63 74  sh of the object
0db0: 73 20 61 6c 72 65 61 64 79 20 61 64 64 65 64 20  s already added 
0dc0: 74 6f 20 74 68 65 20 72 65 73 75 6c 74 0a 2b 09  to the result.+.
0dd0: 20 2a 20 6c 69 73 74 2e 0a 2b 09 20 2a 2f 0a 2b   * list..+. */.+
0de0: 09 54 63 6c 5f 49 6e 69 74 4f 62 6a 48 61 73 68  .Tcl_InitObjHash
0df0: 54 61 62 6c 65 28 26 61 64 64 65 64 43 6f 6d 6d  Table(&addedComm
0e00: 61 6e 64 73 54 61 62 6c 65 29 3b 0a 2b 0a 2b 09  andsTable);.+.+.
0e10: 65 6e 74 72 79 50 74 72 20 3d 20 54 63 6c 5f 46  entryPtr = Tcl_F
0e20: 69 72 73 74 48 61 73 68 45 6e 74 72 79 28 26 6e  irstHashEntry(&n
0e30: 73 50 74 72 2d 3e 63 6d 64 54 61 62 6c 65 2c 20  sPtr->cmdTable, 
0e40: 26 73 65 61 72 63 68 29 3b 0a 2b 09 77 68 69 6c  &search);.+.whil
0e50: 65 20 28 65 6e 74 72 79 50 74 72 20 21 3d 20 4e  e (entryPtr != N
0e60: 55 4c 4c 29 20 7b 0a 2b 09 20 20 20 20 63 6d 64  ULL) {.+.    cmd
0e70: 4e 61 6d 65 20 3d 20 54 63 6c 5f 47 65 74 48 61  Name = Tcl_GetHa
0e80: 73 68 4b 65 79 28 26 6e 73 50 74 72 2d 3e 63 6d  shKey(&nsPtr->cm
0e90: 64 54 61 62 6c 65 2c 20 65 6e 74 72 79 50 74 72  dTable, entryPtr
0ea0: 29 3b 0a 2b 09 20 20 20 20 69 66 20 28 28 73 69  );.+.    if ((si
0eb0: 6d 70 6c 65 50 61 74 74 65 72 6e 20 3d 3d 20 4e  mplePattern == N
0ec0: 55 4c 4c 29 0a 2b 09 09 20 20 20 20 7c 7c 20 54  ULL).+..    || T
0ed0: 63 6c 5f 53 74 72 69 6e 67 4d 61 74 63 68 28 63  cl_StringMatch(c
0ee0: 6d 64 4e 61 6d 65 2c 20 73 69 6d 70 6c 65 50 61  mdName, simplePa
0ef0: 74 74 65 72 6e 29 29 20 7b 0a 2b 09 09 65 6c 65  ttern)) {.+..ele
0f00: 6d 4f 62 6a 50 74 72 20 3d 20 54 63 6c 5f 4e 65  mObjPtr = Tcl_Ne
0f10: 77 53 74 72 69 6e 67 4f 62 6a 28 63 6d 64 4e 61  wStringObj(cmdNa
0f20: 6d 65 2c 20 2d 31 29 3b 0a 2b 09 09 54 63 6c 5f  me, -1);.+..Tcl_
0f30: 4c 69 73 74 4f 62 6a 41 70 70 65 6e 64 45 6c 65  ListObjAppendEle
0f40: 6d 65 6e 74 28 69 6e 74 65 72 70 2c 20 6c 69 73  ment(interp, lis
0f50: 74 50 74 72 2c 20 65 6c 65 6d 4f 62 6a 50 74 72  tPtr, elemObjPtr
0f60: 29 3b 0a 2b 09 09 28 76 6f 69 64 29 20 54 63 6c  );.+..(void) Tcl
0f70: 5f 43 72 65 61 74 65 48 61 73 68 45 6e 74 72 79  _CreateHashEntry
0f80: 28 26 61 64 64 65 64 43 6f 6d 6d 61 6e 64 73 54  (&addedCommandsT
0f90: 61 62 6c 65 2c 0a 2b 09 09 09 28 63 68 61 72 20  able,.+...(char 
0fa0: 2a 29 65 6c 65 6d 4f 62 6a 50 74 72 2c 20 26 69  *)elemObjPtr, &i
0fb0: 73 4e 65 77 29 3b 0a 2b 09 20 20 20 20 7d 0a 2b  sNew);.+.    }.+
0fc0: 09 20 20 20 20 65 6e 74 72 79 50 74 72 20 3d 20  .    entryPtr = 
0fd0: 54 63 6c 5f 4e 65 78 74 48 61 73 68 45 6e 74 72  Tcl_NextHashEntr
0fe0: 79 28 26 73 65 61 72 63 68 29 3b 0a 2b 09 7d 0a  y(&search);.+.}.
0ff0: 2b 0a 2b 09 2f 2a 0a 2b 09 20 2a 20 53 65 61 72  +.+./*.+. * Sear
1000: 63 68 20 74 68 65 20 70 61 74 68 20 6e 65 78 74  ch the path next
1010: 2e 0a 2b 09 20 2a 2f 0a 2b 0a 2b 09 66 6f 72 20  ..+. */.+.+.for 
1020: 28 69 3d 30 20 3b 20 69 3c 6e 73 50 74 72 2d 3e  (i=0 ; i<nsPtr->
1030: 63 6f 6d 6d 61 6e 64 50 61 74 68 4c 65 6e 67 74  commandPathLengt
1040: 68 20 3b 20 69 2b 2b 29 20 7b 0a 2b 09 20 20 20  h ; i++) {.+.   
1050: 20 4e 61 6d 65 73 70 61 63 65 20 2a 70 61 74 68   Namespace *path
1060: 4e 73 50 74 72 20 3d 20 6e 73 50 74 72 2d 3e 63  NsPtr = nsPtr->c
1070: 6f 6d 6d 61 6e 64 50 61 74 68 41 72 72 61 79 5b  ommandPathArray[
1080: 69 5d 2e 6e 73 50 74 72 3b 0a 2b 0a 2b 09 20 20  i].nsPtr;.+.+.  
1090: 20 20 69 66 20 28 70 61 74 68 4e 73 50 74 72 20    if (pathNsPtr 
10a0: 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 63 6f  == NULL) {.+..co
10b0: 6e 74 69 6e 75 65 3b 0a 2b 09 20 20 20 20 7d 0a  ntinue;.+.    }.
10c0: 2b 09 20 20 20 20 69 66 20 28 70 61 74 68 4e 73  +.    if (pathNs
10d0: 50 74 72 20 3d 3d 20 67 6c 6f 62 61 6c 4e 73 50  Ptr == globalNsP
10e0: 74 72 29 20 7b 0a 2b 09 09 66 6f 75 6e 64 47 6c  tr) {.+..foundGl
10f0: 6f 62 61 6c 20 3d 20 31 3b 0a 2b 09 20 20 20 20  obal = 1;.+.    
1100: 7d 0a 2b 09 20 20 20 20 65 6e 74 72 79 50 74 72  }.+.    entryPtr
1110: 20 3d 20 54 63 6c 5f 46 69 72 73 74 48 61 73 68   = Tcl_FirstHash
1120: 45 6e 74 72 79 28 26 70 61 74 68 4e 73 50 74 72  Entry(&pathNsPtr
1130: 2d 3e 63 6d 64 54 61 62 6c 65 2c 20 26 73 65 61  ->cmdTable, &sea
1140: 72 63 68 29 3b 0a 2b 09 20 20 20 20 77 68 69 6c  rch);.+.    whil
1150: 65 20 28 65 6e 74 72 79 50 74 72 20 21 3d 20 4e  e (entryPtr != N
1160: 55 4c 4c 29 20 7b 0a 2b 09 09 63 6d 64 4e 61 6d  ULL) {.+..cmdNam
1170: 65 20 3d 20 54 63 6c 5f 47 65 74 48 61 73 68 4b  e = Tcl_GetHashK
1180: 65 79 28 26 70 61 74 68 4e 73 50 74 72 2d 3e 63  ey(&pathNsPtr->c
1190: 6d 64 54 61 62 6c 65 2c 20 65 6e 74 72 79 50 74  mdTable, entryPt
11a0: 72 29 3b 0a 2b 09 09 69 66 20 28 28 73 69 6d 70  r);.+..if ((simp
11b0: 6c 65 50 61 74 74 65 72 6e 20 3d 3d 20 4e 55 4c  lePattern == NUL
11c0: 4c 29 0a 2b 09 09 09 7c 7c 20 54 63 6c 5f 53 74  L).+...|| Tcl_St
11d0: 72 69 6e 67 4d 61 74 63 68 28 63 6d 64 4e 61 6d  ringMatch(cmdNam
11e0: 65 2c 20 73 69 6d 70 6c 65 50 61 74 74 65 72 6e  e, simplePattern
11f0: 29 29 20 7b 0a 2b 09 09 20 20 20 20 65 6c 65 6d  )) {.+..    elem
1200: 4f 62 6a 50 74 72 20 3d 20 54 63 6c 5f 4e 65 77  ObjPtr = Tcl_New
1210: 53 74 72 69 6e 67 4f 62 6a 28 63 6d 64 4e 61 6d  StringObj(cmdNam
1220: 65 2c 20 2d 31 29 3b 0a 2b 09 09 20 20 20 20 28  e, -1);.+..    (
1230: 76 6f 69 64 29 20 54 63 6c 5f 43 72 65 61 74 65  void) Tcl_Create
1240: 48 61 73 68 45 6e 74 72 79 28 26 61 64 64 65 64  HashEntry(&added
1250: 43 6f 6d 6d 61 6e 64 73 54 61 62 6c 65 2c 0a 2b  CommandsTable,.+
1260: 09 09 09 20 20 20 20 28 63 68 61 72 20 2a 29 20  ...    (char *) 
1270: 65 6c 65 6d 4f 62 6a 50 74 72 2c 20 26 69 73 4e  elemObjPtr, &isN
1280: 65 77 29 3b 0a 2b 09 09 20 20 20 20 69 66 20 28  ew);.+..    if (
1290: 69 73 4e 65 77 29 20 7b 0a 2b 09 09 09 54 63 6c  isNew) {.+...Tcl
12a0: 5f 4c 69 73 74 4f 62 6a 41 70 70 65 6e 64 45 6c  _ListObjAppendEl
12b0: 65 6d 65 6e 74 28 69 6e 74 65 72 70 2c 20 6c 69  ement(interp, li
12c0: 73 74 50 74 72 2c 20 65 6c 65 6d 4f 62 6a 50 74  stPtr, elemObjPt
12d0: 72 29 3b 0a 2b 09 09 20 20 20 20 7d 20 65 6c 73  r);.+..    } els
12e0: 65 20 7b 0a 2b 09 09 09 54 63 6c 44 65 63 72 52  e {.+...TclDecrR
12f0: 65 66 43 6f 75 6e 74 28 65 6c 65 6d 4f 62 6a 50  efCount(elemObjP
1300: 74 72 29 3b 0a 2b 09 09 20 20 20 20 7d 0a 2b 09  tr);.+..    }.+.
1310: 09 7d 0a 2b 09 09 65 6e 74 72 79 50 74 72 20 3d  .}.+..entryPtr =
1320: 20 54 63 6c 5f 4e 65 78 74 48 61 73 68 45 6e 74   Tcl_NextHashEnt
1330: 72 79 28 26 73 65 61 72 63 68 29 3b 0a 2b 09 20  ry(&search);.+. 
1340: 20 20 20 7d 0a 2b 09 7d 0a 2b 0a 2b 09 2f 2a 0a     }.+.}.+.+./*.
1350: 2b 09 20 2a 20 49 66 20 74 68 65 20 65 66 66 65  +. * If the effe
1360: 63 74 69 76 65 20 6e 61 6d 65 73 70 61 63 65 20  ctive namespace 
1370: 69 73 6e 27 74 20 74 68 65 20 67 6c 6f 62 61 6c  isn't the global
1380: 20 3a 3a 20 6e 61 6d 65 73 70 61 63 65 2c 20 61   :: namespace, a
1390: 6e 64 20 61 0a 2b 09 20 2a 20 73 70 65 63 69 66  nd a.+. * specif
13a0: 69 63 20 6e 61 6d 65 73 70 61 63 65 20 77 61 73  ic namespace was
13b0: 6e 27 74 20 72 65 71 75 65 73 74 65 64 20 69 6e  n't requested in
13c0: 20 74 68 65 20 70 61 74 74 65 72 6e 2c 20 74 68   the pattern, th
13d0: 65 6e 20 61 64 64 20 69 6e 0a 2b 09 20 2a 20 61  en add in.+. * a
13e0: 6c 6c 20 67 6c 6f 62 61 6c 20 3a 3a 20 63 6f 6d  ll global :: com
13f0: 6d 61 6e 64 73 20 74 68 61 74 20 6d 61 74 63 68  mands that match
1400: 20 74 68 65 20 73 69 6d 70 6c 65 20 70 61 74 74   the simple patt
1410: 65 72 6e 2e 20 4f 66 20 63 6f 75 72 73 65 2c 0a  ern. Of course,.
1420: 2b 09 20 2a 20 77 65 20 61 64 64 20 69 6e 20 6f  +. * we add in o
1430: 6e 6c 79 20 74 68 6f 73 65 20 63 6f 6d 6d 61 6e  nly those comman
1440: 64 73 20 74 68 61 74 20 61 72 65 6e 27 74 20 68  ds that aren't h
1450: 69 64 64 65 6e 20 62 79 20 61 20 63 6f 6d 6d 61  idden by a comma
1460: 6e 64 20 69 6e 0a 2b 09 20 2a 20 74 68 65 20 65  nd in.+. * the e
1470: 66 66 65 63 74 69 76 65 20 6e 61 6d 65 73 70 61  ffective namespa
1480: 63 65 2e 0a 2b 09 20 2a 2f 0a 2b 0a 2b 09 69 66  ce..+. */.+.+.if
1490: 20 28 21 66 6f 75 6e 64 47 6c 6f 62 61 6c 29 20   (!foundGlobal) 
14a0: 7b 0a 2b 09 20 20 20 20 65 6e 74 72 79 50 74 72  {.+.    entryPtr
14b0: 20 3d 20 54 63 6c 5f 46 69 72 73 74 48 61 73 68   = Tcl_FirstHash
14c0: 45 6e 74 72 79 28 26 67 6c 6f 62 61 6c 4e 73 50  Entry(&globalNsP
14d0: 74 72 2d 3e 63 6d 64 54 61 62 6c 65 2c 20 26 73  tr->cmdTable, &s
14e0: 65 61 72 63 68 29 3b 0a 2b 09 20 20 20 20 77 68  earch);.+.    wh
14f0: 69 6c 65 20 28 65 6e 74 72 79 50 74 72 20 21 3d  ile (entryPtr !=
1500: 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 63 6d 64 4e   NULL) {.+..cmdN
1510: 61 6d 65 20 3d 20 54 63 6c 5f 47 65 74 48 61 73  ame = Tcl_GetHas
1520: 68 4b 65 79 28 26 67 6c 6f 62 61 6c 4e 73 50 74  hKey(&globalNsPt
1530: 72 2d 3e 63 6d 64 54 61 62 6c 65 2c 20 65 6e 74  r->cmdTable, ent
1540: 72 79 50 74 72 29 3b 0a 2b 09 09 69 66 20 28 28  ryPtr);.+..if ((
1550: 73 69 6d 70 6c 65 50 61 74 74 65 72 6e 20 3d 3d  simplePattern ==
1560: 20 4e 55 4c 4c 29 0a 2b 09 09 09 7c 7c 20 54 63   NULL).+...|| Tc
1570: 6c 5f 53 74 72 69 6e 67 4d 61 74 63 68 28 63 6d  l_StringMatch(cm
1580: 64 4e 61 6d 65 2c 20 73 69 6d 70 6c 65 50 61 74  dName, simplePat
1590: 74 65 72 6e 29 29 20 7b 0a 2b 09 09 20 20 20 20  tern)) {.+..    
15a0: 65 6c 65 6d 4f 62 6a 50 74 72 20 3d 20 54 63 6c  elemObjPtr = Tcl
15b0: 5f 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28 63 6d  _NewStringObj(cm
15c0: 64 4e 61 6d 65 2c 20 2d 31 29 3b 0a 2b 09 09 20  dName, -1);.+.. 
15d0: 20 20 20 69 66 20 28 54 63 6c 5f 46 69 6e 64 48     if (Tcl_FindH
15e0: 61 73 68 45 6e 74 72 79 28 26 61 64 64 65 64 43  ashEntry(&addedC
15f0: 6f 6d 6d 61 6e 64 73 54 61 62 6c 65 2c 0a 2b 09  ommandsTable,.+.
1600: 09 09 20 20 20 20 28 63 68 61 72 20 2a 29 20 65  ..    (char *) e
1610: 6c 65 6d 4f 62 6a 50 74 72 29 20 3d 3d 20 4e 55  lemObjPtr) == NU
1620: 4c 4c 29 20 7b 0a 2b 09 09 09 54 63 6c 5f 4c 69  LL) {.+...Tcl_Li
1630: 73 74 4f 62 6a 41 70 70 65 6e 64 45 6c 65 6d 65  stObjAppendEleme
1640: 6e 74 28 69 6e 74 65 72 70 2c 20 6c 69 73 74 50  nt(interp, listP
1650: 74 72 2c 20 65 6c 65 6d 4f 62 6a 50 74 72 29 3b  tr, elemObjPtr);
1660: 0a 2b 09 09 20 20 20 20 7d 20 65 6c 73 65 20 7b  .+..    } else {
1670: 0a 2b 09 09 09 54 63 6c 44 65 63 72 52 65 66 43  .+...TclDecrRefC
1680: 6f 75 6e 74 28 65 6c 65 6d 4f 62 6a 50 74 72 29  ount(elemObjPtr)
1690: 3b 0a 2b 09 09 20 20 20 20 7d 0a 2b 09 09 7d 0a  ;.+..    }.+..}.
16a0: 2b 09 09 65 6e 74 72 79 50 74 72 20 3d 20 54 63  +..entryPtr = Tc
16b0: 6c 5f 4e 65 78 74 48 61 73 68 45 6e 74 72 79 28  l_NextHashEntry(
16c0: 26 73 65 61 72 63 68 29 3b 0a 2b 09 20 20 20 20  &search);.+.    
16d0: 7d 0a 2b 09 7d 0a 2b 0a 2b 09 54 63 6c 5f 44 65  }.+.}.+.+.Tcl_De
16e0: 6c 65 74 65 48 61 73 68 54 61 62 6c 65 28 26 61  leteHashTable(&a
16f0: 64 64 65 64 43 6f 6d 6d 61 6e 64 73 54 61 62 6c  ddedCommandsTabl
1700: 65 29 3b 0a 20 20 20 20 20 7d 0a 20 0a 20 20 20  e);.     }. .   
1710: 20 20 54 63 6c 5f 53 65 74 4f 62 6a 52 65 73 75    Tcl_SetObjResu
1720: 6c 74 28 69 6e 74 65 72 70 2c 20 6c 69 73 74 50  lt(interp, listP
1730: 74 72 29 3b 0a 49 6e 64 65 78 3a 20 67 65 6e 65  tr);.Index: gene
1740: 72 69 63 2f 74 63 6c 49 6e 74 2e 68 0a 3d 3d 3d  ric/tclInt.h.===
1750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1760: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1790: 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72  .RCS file: /cvsr
17a0: 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65  oot/tcl/tcl/gene
17b0: 72 69 63 2f 74 63 6c 49 6e 74 2e 68 2c 76 0a 72  ric/tclInt.h,v.r
17c0: 65 74 72 69 65 76 69 6e 67 20 72 65 76 69 73 69  etrieving revisi
17d0: 6f 6e 20 31 2e 32 33 30 0a 64 69 66 66 20 2d 75  on 1.230.diff -u
17e0: 20 2d 72 31 2e 32 33 30 20 74 63 6c 49 6e 74 2e   -r1.230 tclInt.
17f0: 68 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63  h.--- generic/tc
1800: 6c 49 6e 74 2e 68 09 31 38 20 4d 61 79 20 32 30  lInt.h.18 May 20
1810: 30 35 20 31 35 3a 34 33 3a 33 36 20 2d 30 30 30  05 15:43:36 -000
1820: 30 09 31 2e 32 33 30 0a 2b 2b 2b 20 67 65 6e 65  0.1.230.+++ gene
1830: 72 69 63 2f 74 63 6c 49 6e 74 2e 68 09 32 30 20  ric/tclInt.h.20 
1840: 4d 61 79 20 32 30 30 35 20 31 35 3a 32 35 3a 30  May 2005 15:25:0
1850: 33 20 2d 30 30 30 30 0a 40 40 20 2d 31 33 31 2c  3 -0000.@@ -131,
1860: 36 20 2b 31 33 31 2c 37 20 40 40 0a 20 20 2a 2f  6 +131,7 @@.  */
1870: 0a 20 0a 20 74 79 70 65 64 65 66 20 73 74 72 75  . . typedef stru
1880: 63 74 20 54 63 6c 5f 45 6e 73 65 6d 62 6c 65 20  ct Tcl_Ensemble 
1890: 54 63 6c 5f 45 6e 73 65 6d 62 6c 65 3b 0a 2b 74  Tcl_Ensemble;.+t
18a0: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 4e 61  ypedef struct Na
18b0: 6d 65 73 70 61 63 65 50 61 74 68 45 6e 74 72 79  mespacePathEntry
18c0: 20 4e 61 6d 65 73 70 61 63 65 50 61 74 68 45 6e   NamespacePathEn
18d0: 74 72 79 3b 0a 20 0a 20 2f 2a 0a 20 20 2a 20 54  try;. . /*.  * T
18e0: 68 65 20 73 74 72 75 63 74 75 72 65 20 62 65 6c  he structure bel
18f0: 6f 77 20 64 65 66 69 6e 65 73 20 61 20 6e 61 6d  ow defines a nam
1900: 65 73 70 61 63 65 2e 0a 40 40 20 2d 32 33 33 2c  espace..@@ -233,
1910: 39 20 2b 32 33 34 2c 33 35 20 40 40 0a 20 20 20  9 +234,35 @@.   
1920: 20 20 54 63 6c 5f 45 6e 73 65 6d 62 6c 65 20 2a    Tcl_Ensemble *
1930: 65 6e 73 65 6d 62 6c 65 73 3b 09 2f 2a 20 4c 69  ensembles;./* Li
1940: 73 74 20 6f 66 20 73 74 72 75 63 74 75 72 65 73  st of structures
1950: 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 20 74 68   that contain th
1960: 65 20 64 65 74 61 69 6c 73 0a 20 09 09 09 09 20  e details. .... 
1970: 2a 20 6f 66 20 74 68 65 20 65 6e 73 65 6d 62 6c  * of the ensembl
1980: 65 73 20 74 68 61 74 20 61 72 65 20 69 6d 70 6c  es that are impl
1990: 65 6d 65 6e 74 65 64 20 6f 6e 0a 20 09 09 09 09  emented on. ....
19a0: 20 2a 20 74 6f 70 20 6f 66 20 74 68 69 73 20 6e   * top of this n
19b0: 61 6d 65 73 70 61 63 65 2e 20 2a 2f 0a 2b 20 20  amespace. */.+  
19c0: 20 20 69 6e 74 20 63 6f 6d 6d 61 6e 64 50 61 74    int commandPat
19d0: 68 4c 65 6e 67 74 68 3b 09 2f 2a 20 54 68 65 20  hLength;./* The 
19e0: 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 65 78  length of the ex
19f0: 70 6c 69 63 69 74 20 70 61 74 68 2e 20 2a 2f 0a  plicit path. */.
1a00: 2b 20 20 20 20 4e 61 6d 65 73 70 61 63 65 50 61  +    NamespacePa
1a10: 74 68 45 6e 74 72 79 20 2a 63 6f 6d 6d 61 6e 64  thEntry *command
1a20: 50 61 74 68 41 72 72 61 79 3b 0a 2b 09 09 09 09  PathArray;.+....
1a30: 2f 2a 20 54 68 65 20 65 78 70 6c 69 63 69 74 20  /* The explicit 
1a40: 70 61 74 68 20 6f 66 20 74 68 65 20 6e 61 6d 65  path of the name
1a50: 73 70 61 63 65 20 61 73 20 61 6e 0a 2b 09 09 09  space as an.+...
1a60: 09 20 2a 20 61 72 72 61 79 2e 20 2a 2f 0a 2b 20  . * array. */.+ 
1a70: 20 20 20 4e 61 6d 65 73 70 61 63 65 50 61 74 68     NamespacePath
1a80: 45 6e 74 72 79 20 2a 63 6f 6d 6d 61 6e 64 50 61  Entry *commandPa
1a90: 74 68 53 6f 75 72 63 65 4c 69 73 74 3b 0a 2b 09  thSourceList;.+.
1aa0: 09 09 09 2f 2a 20 4c 69 6e 6b 65 64 20 6c 69 73  .../* Linked lis
1ab0: 74 20 6f 66 20 70 61 74 68 20 65 6e 74 72 69 65  t of path entrie
1ac0: 73 20 74 68 61 74 20 70 6f 69 6e 74 20 74 6f 0a  s that point to.
1ad0: 2b 09 09 09 09 20 2a 20 74 68 69 73 20 6e 61 6d  +.... * this nam
1ae0: 65 73 70 61 63 65 2e 20 2a 2f 0a 20 7d 20 4e 61  espace. */. } Na
1af0: 6d 65 73 70 61 63 65 3b 0a 20 0a 20 2f 2a 0a 2b  mespace;. . /*.+
1b00: 20 2a 20 41 6e 20 65 6e 74 72 79 20 6f 6e 20 61   * An entry on a
1b10: 20 6e 61 6d 65 73 70 61 63 65 27 73 20 63 6f 6d   namespace's com
1b20: 6d 61 6e 64 20 72 65 73 6f 6c 75 74 69 6f 6e 20  mand resolution 
1b30: 70 61 74 68 2e 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74  path..+ */.+.+st
1b40: 72 75 63 74 20 4e 61 6d 65 73 70 61 63 65 50 61  ruct NamespacePa
1b50: 74 68 45 6e 74 72 79 20 7b 0a 2b 20 20 20 20 4e  thEntry {.+    N
1b60: 61 6d 65 73 70 61 63 65 20 2a 6e 73 50 74 72 3b  amespace *nsPtr;
1b70: 09 09 2f 2a 20 57 68 61 74 20 64 6f 65 73 20 74  ../* What does t
1b80: 68 69 73 20 70 61 74 68 20 65 6e 74 72 79 20 70  his path entry p
1b90: 6f 69 6e 74 20 74 6f 3f 20 49 66 20 69 74 0a 2b  oint to? If it.+
1ba0: 09 09 09 09 20 2a 69 73 20 4e 55 4c 4c 2c 20 74  .... *is NULL, t
1bb0: 68 69 73 20 70 61 74 68 20 65 6e 74 72 79 20 70  his path entry p
1bc0: 6f 69 6e 74 73 20 69 73 20 72 65 64 75 6e 64 61  oints is redunda
1bd0: 6e 74 0a 2b 09 09 09 09 20 2a 20 61 6e 64 20 73  nt.+.... * and s
1be0: 68 6f 75 6c 64 20 62 65 20 73 6b 69 70 70 65 64  hould be skipped
1bf0: 2e 20 2a 2f 0a 2b 20 20 20 20 4e 61 6d 65 73 70  . */.+    Namesp
1c00: 61 63 65 20 2a 63 72 65 61 74 6f 72 4e 73 50 74  ace *creatorNsPt
1c10: 72 3b 09 2f 2a 20 57 68 65 72 65 20 64 6f 65 73  r;./* Where does
1c20: 20 74 68 69 73 20 70 61 74 68 20 65 6e 74 72 79   this path entry
1c30: 20 70 6f 69 6e 74 20 66 72 6f 6d 3f 20 54 68 69   point from? Thi
1c40: 73 0a 2b 09 09 09 09 20 2a 20 61 6c 6c 6f 77 73  s.+.... * allows
1c50: 20 66 6f 72 20 65 66 66 69 63 69 65 6e 74 20 69   for efficient i
1c60: 6e 76 61 6c 69 64 61 74 69 6f 6e 20 6f 66 0a 2b  nvalidation of.+
1c70: 09 09 09 09 20 2a 20 72 65 66 65 72 65 6e 63 65  .... * reference
1c80: 73 20 77 68 65 6e 20 74 68 65 20 70 61 74 68 20  s when the path 
1c90: 65 6e 74 72 79 27 73 20 74 61 72 67 65 74 0a 2b  entry's target.+
1ca0: 09 09 09 09 20 2a 20 75 70 64 61 74 65 73 20 69  .... * updates i
1cb0: 74 73 20 63 75 72 72 65 6e 74 20 6c 69 73 74 20  ts current list 
1cc0: 6f 66 20 64 65 66 69 6e 65 64 0a 2b 09 09 09 09  of defined.+....
1cd0: 20 2a 20 63 6f 6d 6d 61 6e 64 73 2e 20 2a 2f 0a   * commands. */.
1ce0: 2b 20 20 20 20 4e 61 6d 65 73 70 61 63 65 50 61  +    NamespacePa
1cf0: 74 68 45 6e 74 72 79 20 2a 70 72 65 76 50 74 72  thEntry *prevPtr
1d00: 2c 20 2a 6e 65 78 74 50 74 72 3b 0a 2b 09 09 09  , *nextPtr;.+...
1d10: 09 2f 2a 20 4c 69 6e 6b 65 64 20 6c 69 73 74 20  ./* Linked list 
1d20: 70 6f 69 6e 74 65 72 73 20 6f 72 20 4e 55 4c 4c  pointers or NULL
1d30: 20 61 74 20 65 69 74 68 65 72 20 65 6e 64 0a 2b   at either end.+
1d40: 09 09 09 09 20 2a 20 6f 66 20 74 68 65 20 6c 69  .... * of the li
1d50: 73 74 20 74 68 61 74 20 68 61 6e 67 73 20 6f 66  st that hangs of
1d60: 66 20 4e 61 6d 65 73 70 61 63 65 73 27 0a 2b 09  f Namespaces'.+.
1d70: 09 09 09 20 2a 20 63 6f 6d 6d 61 6e 64 50 61 74  ... * commandPat
1d80: 68 53 6f 75 72 63 65 4c 69 73 74 20 66 69 65 6c  hSourceList fiel
1d90: 64 2e 20 2a 2f 0a 2b 7d 3b 0a 2b 0a 2b 2f 2a 0a  d. */.+};.+.+/*.
1da0: 20 20 2a 20 46 6c 61 67 73 20 75 73 65 64 20 74    * Flags used t
1db0: 6f 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20  o represent the 
1dc0: 73 74 61 74 75 73 20 6f 66 20 61 20 6e 61 6d 65  status of a name
1dd0: 73 70 61 63 65 3a 0a 20 20 2a 0a 20 20 2a 20 4e  space:.  *.  * N
1de0: 53 5f 44 59 49 4e 47 20 2d 09 31 20 6d 65 61 6e  S_DYING -.1 mean
1df0: 73 20 54 63 6c 5f 44 65 6c 65 74 65 4e 61 6d 65  s Tcl_DeleteName
1e00: 73 70 61 63 65 20 68 61 73 20 62 65 65 6e 20 63  space has been c
1e10: 61 6c 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20  alled to delete 
1e20: 74 68 65 0a 40 40 20 2d 32 34 33 34 2c 36 20 2b  the.@@ -2434,6 +
1e30: 32 34 36 31 2c 37 20 40 40 0a 20 09 09 09 20 20  2461,7 @@. ...  
1e40: 20 20 56 61 72 20 2a 76 61 72 50 74 72 2c 20 56    Var *varPtr, V
1e50: 61 72 20 2a 61 72 72 61 79 50 74 72 2c 20 43 4f  ar *arrayPtr, CO
1e60: 4e 53 54 20 63 68 61 72 20 2a 70 61 72 74 31 2c  NST char *part1,
1e70: 0a 20 09 09 09 20 20 20 20 43 4f 4e 53 54 20 63  . ...    CONST c
1e80: 68 61 72 20 2a 70 61 72 74 32 2c 20 43 4f 4e 53  har *part2, CONS
1e90: 54 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 69 2c  T Tcl_WideInt i,
1ea0: 0a 20 09 09 09 20 20 20 20 43 4f 4e 53 54 20 69  . ...    CONST i
1eb0: 6e 74 20 66 6c 61 67 73 29 29 3b 0a 2b 4d 4f 44  nt flags));.+MOD
1ec0: 55 4c 45 5f 53 43 4f 50 45 20 76 6f 69 64 09 54  ULE_SCOPE void.T
1ed0: 63 6c 49 6e 76 61 6c 69 64 61 74 65 4e 73 50 61  clInvalidateNsPa
1ee0: 74 68 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28  th _ANSI_ARGS_((
1ef0: 4e 61 6d 65 73 70 61 63 65 20 2a 6e 73 50 74 72  Namespace *nsPtr
1f00: 29 29 3b 0a 20 0a 20 2f 2a 0a 20 20 2a 2d 2d 2d  ));. . /*.  *---
1f10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1f20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1f30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1f40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 49 6e  -------------.In
1f50: 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c  dex: generic/tcl
1f60: 4e 61 6d 65 73 70 2e 63 0a 3d 3d 3d 3d 3d 3d 3d  Namesp.c.=======
1f70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1f80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1f90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1fa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53  ============.RCS
1fb0: 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f   file: /cvsroot/
1fc0: 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f  tcl/tcl/generic/
1fd0: 74 63 6c 4e 61 6d 65 73 70 2e 63 2c 76 0a 72 65  tclNamesp.c,v.re
1fe0: 74 72 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f  trieving revisio
1ff0: 6e 20 31 2e 37 35 0a 64 69 66 66 20 2d 75 20 2d  n 1.75.diff -u -
2000: 72 31 2e 37 35 20 74 63 6c 4e 61 6d 65 73 70 2e  r1.75 tclNamesp.
2010: 63 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63  c.--- generic/tc
2020: 6c 4e 61 6d 65 73 70 2e 63 09 31 39 20 4d 61 79  lNamesp.c.19 May
2030: 20 32 30 30 35 20 32 32 3a 34 39 3a 30 31 20 2d   2005 22:49:01 -
2040: 30 30 30 30 09 31 2e 37 35 0a 2b 2b 2b 20 67 65  0000.1.75.+++ ge
2050: 6e 65 72 69 63 2f 74 63 6c 4e 61 6d 65 73 70 2e  neric/tclNamesp.
2060: 63 09 32 30 20 4d 61 79 20 32 30 30 35 20 31 35  c.20 May 2005 15
2070: 3a 32 35 3a 30 34 20 2d 30 30 30 30 0a 40 40 20  :25:04 -0000.@@ 
2080: 2d 32 34 32 2c 36 20 2b 32 34 32 2c 39 20 40 40  -242,6 +242,9 @@
2090: 0a 20 73 74 61 74 69 63 20 69 6e 74 09 09 4e 61  . static int..Na
20a0: 6d 65 73 70 61 63 65 50 61 72 65 6e 74 43 6d 64  mespaceParentCmd
20b0: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 0a 20   _ANSI_ARGS_((. 
20c0: 09 09 09 20 20 20 20 43 6c 69 65 6e 74 44 61 74  ...    ClientDat
20d0: 61 20 64 75 6d 6d 79 2c 20 54 63 6c 5f 49 6e 74  a dummy, Tcl_Int
20e0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 20 09 09  erp *interp,. ..
20f0: 09 20 20 20 20 69 6e 74 20 6f 62 6a 63 2c 20 54  .    int objc, T
2100: 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62  cl_Obj *CONST ob
2110: 6a 76 5b 5d 29 29 3b 0a 2b 73 74 61 74 69 63 20  jv[]));.+static 
2120: 69 6e 74 09 09 4e 61 6d 65 73 70 61 63 65 50 61  int..NamespacePa
2130: 74 68 43 6d 64 20 5f 41 4e 53 49 5f 41 52 47 53  thCmd _ANSI_ARGS
2140: 5f 28 28 0a 2b 09 09 09 20 20 20 20 43 6c 69 65  _((.+...    Clie
2150: 6e 74 44 61 74 61 20 64 75 6d 6d 79 2c 20 54 63  ntData dummy, Tc
2160: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70  l_Interp *interp
2170: 2c 0a 2b 09 09 09 20 20 20 20 69 6e 74 20 6f 62  ,.+...    int ob
2180: 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e  jc, Tcl_Obj *CON
2190: 53 54 20 6f 62 6a 76 5b 5d 29 29 3b 0a 20 73 74  ST objv[]));. st
21a0: 61 74 69 63 20 69 6e 74 09 09 4e 61 6d 65 73 70  atic int..Namesp
21b0: 61 63 65 51 75 61 6c 69 66 69 65 72 73 43 6d 64  aceQualifiersCmd
21c0: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 0a 20   _ANSI_ARGS_((. 
21d0: 09 09 09 20 20 20 20 43 6c 69 65 6e 74 44 61 74  ...    ClientDat
21e0: 61 20 64 75 6d 6d 79 2c 20 54 63 6c 5f 49 6e 74  a dummy, Tcl_Int
21f0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 20 09 09  erp *interp,. ..
2200: 09 20 20 20 20 69 6e 74 20 6f 62 6a 63 2c 20 54  .    int objc, T
2210: 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62  cl_Obj *CONST ob
2220: 6a 76 5b 5d 29 29 3b 0a 40 40 20 2d 32 37 30 2c  jv[]));.@@ -270,
2230: 36 20 2b 32 37 33 2c 39 20 40 40 0a 20 73 74 61  6 +273,9 @@. sta
2240: 74 69 63 20 76 6f 69 64 09 09 44 75 70 45 6e 73  tic void..DupEns
2250: 65 6d 62 6c 65 43 6d 64 52 65 70 20 5f 41 4e 53  embleCmdRep _ANS
2260: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 4f 62 6a  I_ARGS_((Tcl_Obj
2270: 20 2a 6f 62 6a 50 74 72 2c 0a 20 09 09 09 20 20   *objPtr,. ...  
2280: 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 70 79 50    Tcl_Obj *copyP
2290: 74 72 29 29 3b 0a 20 73 74 61 74 69 63 20 76 6f  tr));. static vo
22a0: 69 64 09 09 53 74 72 69 6e 67 4f 66 45 6e 73 65  id..StringOfEnse
22b0: 6d 62 6c 65 43 6d 64 52 65 70 20 5f 41 4e 53 49  mbleCmdRep _ANSI
22c0: 5f 41 52 47 53 5f 28 28 54 63 6c 5f 4f 62 6a 20  _ARGS_((Tcl_Obj 
22d0: 2a 6f 62 6a 50 74 72 29 29 3b 0a 2b 73 74 61 74  *objPtr));.+stat
22e0: 69 63 20 76 6f 69 64 09 09 55 6e 6c 69 6e 6b 4e  ic void..UnlinkN
22f0: 73 50 61 74 68 20 5f 41 4e 53 49 5f 41 52 47 53  sPath _ANSI_ARGS
2300: 5f 28 28 4e 61 6d 65 73 70 61 63 65 20 2a 6e 73  _((Namespace *ns
2310: 50 74 72 29 29 3b 0a 2b 73 74 61 74 69 63 20 76  Ptr));.+static v
2320: 6f 69 64 09 09 53 65 74 4e 73 50 61 74 68 20 5f  oid..SetNsPath _
2330: 41 4e 53 49 5f 41 52 47 53 5f 28 28 4e 61 6d 65  ANSI_ARGS_((Name
2340: 73 70 61 63 65 20 2a 6e 73 50 74 72 2c 0a 2b 09  space *nsPtr,.+.
2350: 09 09 20 20 20 20 69 6e 74 20 70 61 74 68 4c 65  ..    int pathLe
2360: 6e 67 74 68 2c 20 54 63 6c 5f 4e 61 6d 65 73 70  ngth, Tcl_Namesp
2370: 61 63 65 20 2a 70 61 74 68 41 72 79 5b 5d 29 29  ace *pathAry[]))
2380: 3b 0a 20 0a 20 2f 2a 0a 20 20 2a 20 54 68 69 73  ;. . /*.  * This
2390: 20 73 74 72 75 63 74 75 72 65 20 64 65 66 69 6e   structure defin
23a0: 65 73 20 61 20 54 63 6c 20 6f 62 6a 65 63 74 20  es a Tcl object 
23b0: 74 79 70 65 20 74 68 61 74 20 63 6f 6e 74 61 69  type that contai
23c0: 6e 73 20 61 0a 40 40 20 2d 38 34 34 2c 36 20 2b  ns a.@@ -844,6 +
23d0: 38 35 30 2c 39 20 40 40 0a 20 20 20 20 20 6e 73  850,9 @@.     ns
23e0: 50 74 72 2d 3e 63 6f 6d 70 69 6c 65 64 56 61 72  Ptr->compiledVar
23f0: 52 65 73 50 72 6f 63 20 3d 20 4e 55 4c 4c 3b 0a  ResProc = NULL;.
2400: 20 20 20 20 20 6e 73 50 74 72 2d 3e 65 78 70 6f       nsPtr->expo
2410: 72 74 4c 6f 6f 6b 75 70 45 70 6f 63 68 20 3d 20  rtLookupEpoch = 
2420: 30 3b 0a 20 20 20 20 20 6e 73 50 74 72 2d 3e 65  0;.     nsPtr->e
2430: 6e 73 65 6d 62 6c 65 73 20 3d 20 4e 55 4c 4c 3b  nsembles = NULL;
2440: 0a 2b 20 20 20 20 6e 73 50 74 72 2d 3e 63 6f 6d  .+    nsPtr->com
2450: 6d 61 6e 64 50 61 74 68 4c 65 6e 67 74 68 20 3d  mandPathLength =
2460: 20 30 3b 0a 2b 20 20 20 20 6e 73 50 74 72 2d 3e   0;.+    nsPtr->
2470: 63 6f 6d 6d 61 6e 64 50 61 74 68 41 72 72 61 79  commandPathArray
2480: 20 3d 20 4e 55 4c 4c 3b 0a 2b 20 20 20 20 6e 73   = NULL;.+    ns
2490: 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68  Ptr->commandPath
24a0: 53 6f 75 72 63 65 4c 69 73 74 20 3d 20 4e 55 4c  SourceList = NUL
24b0: 4c 3b 0a 20 0a 20 20 20 20 20 69 66 20 28 70 61  L;. .     if (pa
24c0: 72 65 6e 74 50 74 72 20 21 3d 20 4e 55 4c 4c 29  rentPtr != NULL)
24d0: 20 7b 0a 20 09 65 6e 74 72 79 50 74 72 20 3d 20   {. .entryPtr = 
24e0: 54 63 6c 5f 43 72 65 61 74 65 48 61 73 68 45 6e  Tcl_CreateHashEn
24f0: 74 72 79 28 26 70 61 72 65 6e 74 50 74 72 2d 3e  try(&parentPtr->
2500: 63 68 69 6c 64 54 61 62 6c 65 2c 20 73 69 6d 70  childTable, simp
2510: 6c 65 4e 61 6d 65 2c 0a 40 40 20 2d 31 30 36 35  leName,.@@ -1065
2520: 2c 36 20 2b 31 30 37 34 2c 32 32 20 40 40 0a 20  ,6 +1074,22 @@. 
2530: 20 20 20 20 6e 73 50 74 72 2d 3e 70 61 72 65 6e      nsPtr->paren
2540: 74 50 74 72 20 3d 20 4e 55 4c 4c 3b 0a 20 0a 20  tPtr = NULL;. . 
2550: 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 44      /*.+     * D
2560: 65 6c 65 74 65 20 74 68 65 20 6e 61 6d 65 73 70  elete the namesp
2570: 61 63 65 20 70 61 74 68 20 69 66 20 6f 6e 65 20  ace path if one 
2580: 69 73 20 69 6e 73 74 61 6c 6c 65 64 2e 0a 2b 20  is installed..+ 
2590: 20 20 20 20 2a 2f 0a 2b 0a 2b 20 20 20 20 69 66      */.+.+    if
25a0: 20 28 6e 73 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64   (nsPtr->command
25b0: 50 61 74 68 4c 65 6e 67 74 68 20 21 3d 20 30 29  PathLength != 0)
25c0: 20 7b 0a 2b 09 55 6e 6c 69 6e 6b 4e 73 50 61 74   {.+.UnlinkNsPat
25d0: 68 28 6e 73 50 74 72 29 3b 0a 2b 09 6e 73 50 74  h(nsPtr);.+.nsPt
25e0: 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68 4c 65  r->commandPathLe
25f0: 6e 67 74 68 20 3d 20 30 3b 0a 2b 20 20 20 20 7d  ngth = 0;.+    }
2600: 0a 2b 20 20 20 20 69 66 20 28 6e 73 50 74 72 2d  .+    if (nsPtr-
2610: 3e 63 6f 6d 6d 61 6e 64 50 61 74 68 53 6f 75 72  >commandPathSour
2620: 63 65 4c 69 73 74 20 21 3d 20 4e 55 4c 4c 29 20  ceList != NULL) 
2630: 7b 0a 2b 09 4e 61 6d 65 73 70 61 63 65 50 61 74  {.+.NamespacePat
2640: 68 45 6e 74 72 79 20 2a 6e 73 50 61 74 68 50 74  hEntry *nsPathPt
2650: 72 20 3d 20 6e 73 50 74 72 2d 3e 63 6f 6d 6d 61  r = nsPtr->comma
2660: 6e 64 50 61 74 68 53 6f 75 72 63 65 4c 69 73 74  ndPathSourceList
2670: 3b 0a 2b 09 64 6f 20 7b 0a 2b 09 20 20 20 20 6e  ;.+.do {.+.    n
2680: 73 50 61 74 68 50 74 72 2d 3e 6e 73 50 74 72 20  sPathPtr->nsPtr 
2690: 3d 20 4e 55 4c 4c 3b 0a 2b 09 20 20 20 20 6e 73  = NULL;.+.    ns
26a0: 50 61 74 68 50 74 72 20 3d 20 6e 73 50 61 74 68  PathPtr = nsPath
26b0: 50 74 72 2d 3e 6e 65 78 74 50 74 72 3b 0a 2b 09  Ptr->nextPtr;.+.
26c0: 7d 20 77 68 69 6c 65 20 28 6e 73 50 61 74 68 50  } while (nsPathP
26d0: 74 72 20 21 3d 20 4e 55 4c 4c 29 3b 0a 2b 20 20  tr != NULL);.+  
26e0: 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 0a 20 20    }.+.+    /*.  
26f0: 20 20 20 20 2a 20 44 65 6c 65 74 65 20 61 6c 6c      * Delete all
2700: 20 74 68 65 20 63 68 69 6c 64 20 6e 61 6d 65 73   the child names
2710: 70 61 63 65 73 2e 0a 20 20 20 20 20 20 2a 0a 20  paces..      *. 
2720: 20 20 20 20 20 2a 20 42 45 20 43 41 52 45 46 55       * BE CAREFU
2730: 4c 3a 20 57 68 65 6e 20 65 61 63 68 20 63 68 69  L: When each chi
2740: 6c 64 20 69 73 20 64 65 6c 65 74 65 64 2c 20 69  ld is deleted, i
2750: 74 20 77 69 6c 6c 20 64 69 76 6f 72 63 65 0a 40  t will divorce.@
2760: 40 20 2d 32 33 30 39 2c 31 35 20 2b 32 33 33 34  @ -2309,15 +2334
2770: 2c 31 31 20 40 40 0a 20 09 09 09 09 20 20 2a 20  ,11 @@. ....  * 
2780: 69 67 6e 6f 72 65 64 2e 20 2a 2f 0a 20 7b 0a 20  ignored. */. {. 
2790: 20 20 20 20 49 6e 74 65 72 70 20 2a 69 50 74 72      Interp *iPtr
27a0: 20 3d 20 28 49 6e 74 65 72 70 2a 29 69 6e 74 65   = (Interp*)inte
27b0: 72 70 3b 0a 2d 0a 2d 20 20 20 20 52 65 73 6f 6c  rp;.-.-    Resol
27c0: 76 65 72 53 63 68 65 6d 65 20 2a 72 65 73 50 74  verScheme *resPt
27d0: 72 3b 0a 2d 20 20 20 20 4e 61 6d 65 73 70 61 63  r;.-    Namespac
27e0: 65 20 2a 6e 73 50 74 72 5b 32 5d 2c 20 2a 63 78  e *nsPtr[2], *cx
27f0: 74 4e 73 50 74 72 3b 0a 2d 20 20 20 20 43 4f 4e  tNsPtr;.-    CON
2800: 53 54 20 63 68 61 72 20 2a 73 69 6d 70 6c 65 4e  ST char *simpleN
2810: 61 6d 65 3b 0a 2b 20 20 20 20 4e 61 6d 65 73 70  ame;.+    Namesp
2820: 61 63 65 20 2a 63 78 74 4e 73 50 74 72 3b 0a 20  ace *cxtNsPtr;. 
2830: 20 20 20 20 72 65 67 69 73 74 65 72 20 54 63 6c      register Tcl
2840: 5f 48 61 73 68 45 6e 74 72 79 20 2a 65 6e 74 72  _HashEntry *entr
2850: 79 50 74 72 3b 0a 20 20 20 20 20 72 65 67 69 73  yPtr;.     regis
2860: 74 65 72 20 43 6f 6d 6d 61 6e 64 20 2a 63 6d 64  ter Command *cmd
2870: 50 74 72 3b 0a 2d 20 20 20 20 72 65 67 69 73 74  Ptr;.-    regist
2880: 65 72 20 69 6e 74 20 73 65 61 72 63 68 3b 0a 2b  er int search;.+
2890: 20 20 20 20 43 4f 4e 53 54 20 63 68 61 72 20 2a      CONST char *
28a0: 73 69 6d 70 6c 65 4e 61 6d 65 3b 0a 20 20 20 20  simpleName;.    
28b0: 20 69 6e 74 20 72 65 73 75 6c 74 3b 0a 2d 20 20   int result;.-  
28c0: 20 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 20 63 6d    Tcl_Command cm
28d0: 64 3b 0a 20 0a 20 20 20 20 20 2f 2a 0a 20 20 20  d;. .     /*.   
28e0: 20 20 20 2a 20 49 66 20 74 68 69 73 20 6e 61 6d     * If this nam
28f0: 65 73 70 61 63 65 20 68 61 73 20 61 20 63 6f 6d  espace has a com
2900: 6d 61 6e 64 20 72 65 73 6f 6c 76 65 72 2c 20 74  mand resolver, t
2910: 68 65 6e 20 67 69 76 65 20 69 74 20 66 69 72 73  hen give it firs
2920: 74 0a 40 40 20 2d 32 33 32 36 2c 37 20 2b 32 33  t.@@ -2326,7 +23
2930: 34 37 2c 37 20 40 40 0a 20 20 20 20 20 20 2a 20  47,7 @@.      * 
2940: 70 72 6f 63 65 64 75 72 65 73 20 6d 61 79 20 72  procedures may r
2950: 65 74 75 72 6e 20 61 20 54 63 6c 5f 43 6f 6d 6d  eturn a Tcl_Comm
2960: 61 6e 64 20 76 61 6c 75 65 2c 20 74 68 65 79 20  and value, they 
2970: 6d 61 79 20 73 69 67 6e 61 6c 0a 20 20 20 20 20  may signal.     
2980: 20 2a 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 6f   * to continue o
2990: 6e 77 61 72 64 2c 20 6f 72 20 74 68 65 79 20 6d  nward, or they m
29a0: 61 79 20 73 69 67 6e 61 6c 20 61 6e 20 65 72 72  ay signal an err
29b0: 6f 72 2e 0a 20 20 20 20 20 20 2a 2f 0a 2d 20 20  or..      */.-  
29c0: 20 20 69 66 20 28 28 66 6c 61 67 73 20 26 20 54    if ((flags & T
29d0: 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 29 20  CL_GLOBAL_ONLY) 
29e0: 21 3d 20 30 29 20 7b 0a 2b 20 20 20 20 69 66 20  != 0) {.+    if 
29f0: 28 66 6c 61 67 73 20 26 20 54 43 4c 5f 47 4c 4f  (flags & TCL_GLO
2a00: 42 41 4c 5f 4f 4e 4c 59 29 20 7b 0a 20 09 63 78  BAL_ONLY) {. .cx
2a10: 74 4e 73 50 74 72 20 3d 20 28 4e 61 6d 65 73 70  tNsPtr = (Namesp
2a20: 61 63 65 20 2a 29 20 54 63 6c 5f 47 65 74 47 6c  ace *) Tcl_GetGl
2a30: 6f 62 61 6c 4e 61 6d 65 73 70 61 63 65 28 69 6e  obalNamespace(in
2a40: 74 65 72 70 29 3b 0a 20 20 20 20 20 7d 20 65 6c  terp);.     } el
2a50: 73 65 20 69 66 20 28 63 6f 6e 74 65 78 74 4e 73  se if (contextNs
2a60: 50 74 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 20  Ptr != NULL) {. 
2a70: 09 63 78 74 4e 73 50 74 72 20 3d 20 28 4e 61 6d  .cxtNsPtr = (Nam
2a80: 65 73 70 61 63 65 20 2a 29 20 63 6f 6e 74 65 78  espace *) contex
2a90: 74 4e 73 50 74 72 3b 0a 40 40 20 2d 32 33 33 35  tNsPtr;.@@ -2335
2aa0: 2c 37 20 2b 32 33 35 36 2c 38 20 40 40 0a 20 20  ,7 +2356,8 @@.  
2ab0: 20 20 20 7d 0a 20 0a 20 20 20 20 20 69 66 20 28     }. .     if (
2ac0: 63 78 74 4e 73 50 74 72 2d 3e 63 6d 64 52 65 73  cxtNsPtr->cmdRes
2ad0: 50 72 6f 63 20 21 3d 20 4e 55 4c 4c 20 7c 7c 20  Proc != NULL || 
2ae0: 69 50 74 72 2d 3e 72 65 73 6f 6c 76 65 72 50 74  iPtr->resolverPt
2af0: 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2d 09 72  r != NULL) {.-.r
2b00: 65 73 50 74 72 20 3d 20 69 50 74 72 2d 3e 72 65  esPtr = iPtr->re
2b10: 73 6f 6c 76 65 72 50 74 72 3b 0a 2b 09 52 65 73  solverPtr;.+.Res
2b20: 6f 6c 76 65 72 53 63 68 65 6d 65 20 2a 72 65 73  olverScheme *res
2b30: 50 74 72 20 3d 20 69 50 74 72 2d 3e 72 65 73 6f  Ptr = iPtr->reso
2b40: 6c 76 65 72 50 74 72 3b 0a 2b 09 54 63 6c 5f 43  lverPtr;.+.Tcl_C
2b50: 6f 6d 6d 61 6e 64 20 63 6d 64 3b 0a 20 0a 20 09  ommand cmd;. . .
2b60: 69 66 20 28 63 78 74 4e 73 50 74 72 2d 3e 63 6d  if (cxtNsPtr->cm
2b70: 64 52 65 73 50 72 6f 63 29 20 7b 0a 20 09 20 20  dResProc) {. .  
2b80: 20 20 72 65 73 75 6c 74 20 3d 20 28 2a 63 78 74    result = (*cxt
2b90: 4e 73 50 74 72 2d 3e 63 6d 64 52 65 73 50 72 6f  NsPtr->cmdResPro
2ba0: 63 29 28 69 6e 74 65 72 70 2c 20 6e 61 6d 65 2c  c)(interp, name,
2bb0: 0a 40 40 20 2d 32 33 36 33 2c 33 33 20 2b 32 33  .@@ -2363,33 +23
2bc0: 38 35 2c 39 30 20 40 40 0a 20 20 20 20 20 20 2a  85,90 @@.      *
2bd0: 20 46 69 6e 64 20 74 68 65 20 6e 61 6d 65 73 70   Find the namesp
2be0: 61 63 65 28 73 29 20 74 68 61 74 20 63 6f 6e 74  ace(s) that cont
2bf0: 61 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 2e  ain the command.
2c00: 0a 20 20 20 20 20 20 2a 2f 0a 20 0a 2d 20 20 20  .      */. .-   
2c10: 20 54 63 6c 47 65 74 4e 61 6d 65 73 70 61 63 65   TclGetNamespace
2c20: 46 6f 72 51 75 61 6c 4e 61 6d 65 28 69 6e 74 65  ForQualName(inte
2c30: 72 70 2c 20 6e 61 6d 65 2c 20 28 4e 61 6d 65 73  rp, name, (Names
2c40: 70 61 63 65 20 2a 29 20 63 6f 6e 74 65 78 74 4e  pace *) contextN
2c50: 73 50 74 72 2c 0a 2d 09 20 20 20 20 66 6c 61 67  sPtr,.-.    flag
2c60: 73 2c 20 26 6e 73 50 74 72 5b 30 5d 2c 20 26 6e  s, &nsPtr[0], &n
2c70: 73 50 74 72 5b 31 5d 2c 20 26 63 78 74 4e 73 50  sPtr[1], &cxtNsP
2c80: 74 72 2c 20 26 73 69 6d 70 6c 65 4e 61 6d 65 29  tr, &simpleName)
2c90: 3b 0a 2d 0a 2d 20 20 20 20 2f 2a 0a 2d 20 20 20  ;.-.-    /*.-   
2ca0: 20 20 2a 20 4c 6f 6f 6b 20 66 6f 72 20 74 68 65    * Look for the
2cb0: 20 63 6f 6d 6d 61 6e 64 20 69 6e 20 74 68 65 20   command in the 
2cc0: 63 6f 6d 6d 61 6e 64 20 74 61 62 6c 65 20 6f 66  command table of
2cd0: 20 69 74 73 20 6e 61 6d 65 73 70 61 63 65 2e 0a   its namespace..
2ce0: 2d 20 20 20 20 20 2a 20 42 65 20 73 75 72 65 20  -     * Be sure 
2cf0: 74 6f 20 63 68 65 63 6b 20 62 6f 74 68 20 70 6f  to check both po
2d00: 73 73 69 62 6c 65 20 73 65 61 72 63 68 20 70 61  ssible search pa
2d10: 74 68 73 3a 20 66 72 6f 6d 20 74 68 65 20 73 70  ths: from the sp
2d20: 65 63 69 66 69 65 64 0a 2d 20 20 20 20 20 2a 20  ecified.-     * 
2d30: 6e 61 6d 65 73 70 61 63 65 20 63 6f 6e 74 65 78  namespace contex
2d40: 74 20 61 6e 64 20 66 72 6f 6d 20 74 68 65 20 67  t and from the g
2d50: 6c 6f 62 61 6c 20 6e 61 6d 65 73 70 61 63 65 2e  lobal namespace.
2d60: 0a 2d 20 20 20 20 20 2a 2f 0a 2d 0a 20 20 20 20  .-     */.-.    
2d70: 20 63 6d 64 50 74 72 20 3d 20 4e 55 4c 4c 3b 0a   cmdPtr = NULL;.
2d80: 2d 20 20 20 20 66 6f 72 20 28 73 65 61 72 63 68  -    for (search
2d90: 20 3d 20 30 3b 20 20 28 73 65 61 72 63 68 20 3c   = 0;  (search <
2da0: 20 32 29 20 26 26 20 28 63 6d 64 50 74 72 20 3d   2) && (cmdPtr =
2db0: 3d 20 4e 55 4c 4c 29 3b 20 20 73 65 61 72 63 68  = NULL);  search
2dc0: 2b 2b 29 20 7b 0a 2d 09 69 66 20 28 28 6e 73 50  ++) {.-.if ((nsP
2dd0: 74 72 5b 73 65 61 72 63 68 5d 20 21 3d 20 4e 55  tr[search] != NU
2de0: 4c 4c 29 20 26 26 20 28 73 69 6d 70 6c 65 4e 61  LL) && (simpleNa
2df0: 6d 65 20 21 3d 20 4e 55 4c 4c 29 29 20 7b 0a 2d  me != NULL)) {.-
2e00: 09 20 20 20 20 65 6e 74 72 79 50 74 72 20 3d 20  .    entryPtr = 
2e10: 54 63 6c 5f 46 69 6e 64 48 61 73 68 45 6e 74 72  Tcl_FindHashEntr
2e20: 79 28 26 6e 73 50 74 72 5b 73 65 61 72 63 68 5d  y(&nsPtr[search]
2e30: 2d 3e 63 6d 64 54 61 62 6c 65 2c 0a 2d 09 09 20  ->cmdTable,.-.. 
2e40: 20 20 20 73 69 6d 70 6c 65 4e 61 6d 65 29 3b 0a     simpleName);.
2e50: 2b 20 20 20 20 69 66 20 28 63 78 74 4e 73 50 74  +    if (cxtNsPt
2e60: 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68 4c 65  r->commandPathLe
2e70: 6e 67 74 68 21 3d 30 20 26 26 20 73 74 72 6e 63  ngth!=0 && strnc
2e80: 6d 70 28 6e 61 6d 65 2c 20 22 3a 3a 22 2c 20 32  mp(name, "::", 2
2e90: 29 29 20 7b 0a 2b 09 69 6e 74 20 69 3b 0a 2b 09  )) {.+.int i;.+.
2ea0: 4e 61 6d 65 73 70 61 63 65 20 2a 70 61 74 68 4e  Namespace *pathN
2eb0: 73 50 74 72 2c 20 2a 72 65 61 6c 4e 73 50 74 72  sPtr, *realNsPtr
2ec0: 2c 20 2a 64 75 6d 6d 79 4e 73 50 74 72 3b 0a 2b  , *dummyNsPtr;.+
2ed0: 0a 2b 09 28 76 6f 69 64 29 20 54 63 6c 47 65 74  .+.(void) TclGet
2ee0: 4e 61 6d 65 73 70 61 63 65 46 6f 72 51 75 61 6c  NamespaceForQual
2ef0: 4e 61 6d 65 28 69 6e 74 65 72 70 2c 20 6e 61 6d  Name(interp, nam
2f00: 65 2c 20 63 78 74 4e 73 50 74 72 2c 0a 2b 09 09  e, cxtNsPtr,.+..
2f10: 54 43 4c 5f 4e 41 4d 45 53 50 41 43 45 5f 4f 4e  TCL_NAMESPACE_ON
2f20: 4c 59 2c 20 26 72 65 61 6c 4e 73 50 74 72 2c 20  LY, &realNsPtr, 
2f30: 26 64 75 6d 6d 79 4e 73 50 74 72 2c 20 26 64 75  &dummyNsPtr, &du
2f40: 6d 6d 79 4e 73 50 74 72 2c 0a 2b 09 09 26 73 69  mmyNsPtr,.+..&si
2f50: 6d 70 6c 65 4e 61 6d 65 29 3b 0a 2b 09 69 66 20  mpleName);.+.if 
2f60: 28 72 65 61 6c 4e 73 50 74 72 20 21 3d 20 4e 55  (realNsPtr != NU
2f70: 4c 4c 20 26 26 20 73 69 6d 70 6c 65 4e 61 6d 65  LL && simpleName
2f80: 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 20 20   != NULL) {.+.  
2f90: 20 20 65 6e 74 72 79 50 74 72 20 3d 20 54 63 6c    entryPtr = Tcl
2fa0: 5f 46 69 6e 64 48 61 73 68 45 6e 74 72 79 28 26  _FindHashEntry(&
2fb0: 72 65 61 6c 4e 73 50 74 72 2d 3e 63 6d 64 54 61  realNsPtr->cmdTa
2fc0: 62 6c 65 2c 20 73 69 6d 70 6c 65 4e 61 6d 65 29  ble, simpleName)
2fd0: 3b 0a 20 09 20 20 20 20 69 66 20 28 65 6e 74 72  ;. .    if (entr
2fe0: 79 50 74 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a  yPtr != NULL) {.
2ff0: 20 09 09 63 6d 64 50 74 72 20 3d 20 28 43 6f 6d   ..cmdPtr = (Com
3000: 6d 61 6e 64 20 2a 29 20 54 63 6c 5f 47 65 74 48  mand *) Tcl_GetH
3010: 61 73 68 56 61 6c 75 65 28 65 6e 74 72 79 50 74  ashValue(entryPt
3020: 72 29 3b 0a 20 09 20 20 20 20 7d 0a 20 09 7d 0a  r);. .    }. .}.
3030: 2b 0a 2b 09 2f 2a 0a 2b 09 20 2a 20 4e 65 78 74  +.+./*.+. * Next
3040: 2c 20 63 68 65 63 6b 20 61 6c 6f 6e 67 20 74 68  , check along th
3050: 65 20 70 61 74 68 2e 0a 2b 09 20 2a 2f 0a 2b 0a  e path..+. */.+.
3060: 2b 09 66 6f 72 20 28 69 3d 30 20 3b 20 69 3c 63  +.for (i=0 ; i<c
3070: 78 74 4e 73 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64  xtNsPtr->command
3080: 50 61 74 68 4c 65 6e 67 74 68 20 26 26 20 63 6d  PathLength && cm
3090: 64 50 74 72 3d 3d 4e 55 4c 4c 20 3b 20 69 2b 2b  dPtr==NULL ; i++
30a0: 29 20 7b 0a 2b 09 20 20 20 20 70 61 74 68 4e 73  ) {.+.    pathNs
30b0: 50 74 72 20 3d 20 63 78 74 4e 73 50 74 72 2d 3e  Ptr = cxtNsPtr->
30c0: 63 6f 6d 6d 61 6e 64 50 61 74 68 41 72 72 61 79  commandPathArray
30d0: 5b 69 5d 2e 6e 73 50 74 72 3b 0a 2b 09 20 20 20  [i].nsPtr;.+.   
30e0: 20 69 66 20 28 70 61 74 68 4e 73 50 74 72 20 3d   if (pathNsPtr =
30f0: 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 63 6f 6e  = NULL) {.+..con
3100: 74 69 6e 75 65 3b 0a 2b 09 20 20 20 20 7d 0a 2b  tinue;.+.    }.+
3110: 09 20 20 20 20 28 76 6f 69 64 29 20 54 63 6c 47  .    (void) TclG
3120: 65 74 4e 61 6d 65 73 70 61 63 65 46 6f 72 51 75  etNamespaceForQu
3130: 61 6c 4e 61 6d 65 28 69 6e 74 65 72 70 2c 20 6e  alName(interp, n
3140: 61 6d 65 2c 20 70 61 74 68 4e 73 50 74 72 2c 0a  ame, pathNsPtr,.
3150: 2b 09 09 20 20 20 20 54 43 4c 5f 4e 41 4d 45 53  +..    TCL_NAMES
3160: 50 41 43 45 5f 4f 4e 4c 59 2c 20 26 72 65 61 6c  PACE_ONLY, &real
3170: 4e 73 50 74 72 2c 20 26 64 75 6d 6d 79 4e 73 50  NsPtr, &dummyNsP
3180: 74 72 2c 20 26 64 75 6d 6d 79 4e 73 50 74 72 2c  tr, &dummyNsPtr,
3190: 0a 2b 09 09 20 20 20 20 26 73 69 6d 70 6c 65 4e  .+..    &simpleN
31a0: 61 6d 65 29 3b 0a 2b 09 20 20 20 20 69 66 20 28  ame);.+.    if (
31b0: 72 65 61 6c 4e 73 50 74 72 20 21 3d 20 4e 55 4c  realNsPtr != NUL
31c0: 4c 20 26 26 20 73 69 6d 70 6c 65 4e 61 6d 65 20  L && simpleName 
31d0: 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 65 6e  != NULL) {.+..en
31e0: 74 72 79 50 74 72 20 3d 20 54 63 6c 5f 46 69 6e  tryPtr = Tcl_Fin
31f0: 64 48 61 73 68 45 6e 74 72 79 28 26 72 65 61 6c  dHashEntry(&real
3200: 4e 73 50 74 72 2d 3e 63 6d 64 54 61 62 6c 65 2c  NsPtr->cmdTable,
3210: 20 73 69 6d 70 6c 65 4e 61 6d 65 29 3b 0a 2b 09   simpleName);.+.
3220: 09 69 66 20 28 65 6e 74 72 79 50 74 72 20 21 3d  .if (entryPtr !=
3230: 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 20 20 20 20   NULL) {.+..    
3240: 63 6d 64 50 74 72 20 3d 20 28 43 6f 6d 6d 61 6e  cmdPtr = (Comman
3250: 64 20 2a 29 20 54 63 6c 5f 47 65 74 48 61 73 68  d *) Tcl_GetHash
3260: 56 61 6c 75 65 28 65 6e 74 72 79 50 74 72 29 3b  Value(entryPtr);
3270: 0a 2b 09 09 7d 0a 2b 09 20 20 20 20 7d 0a 2b 09  .+..}.+.    }.+.
3280: 7d 0a 2b 0a 2b 09 2f 2a 0a 2b 09 20 2a 20 49 66  }.+.+./*.+. * If
3290: 20 77 65 27 76 65 20 73 74 69 6c 6c 20 6e 6f 74   we've still not
32a0: 20 66 6f 75 6e 64 20 74 68 65 20 63 6f 6d 6d 61   found the comma
32b0: 6e 64 2c 20 6c 6f 6f 6b 20 69 6e 20 74 68 65 20  nd, look in the 
32c0: 67 6c 6f 62 61 6c 0a 2b 09 20 2a 20 6e 61 6d 65  global.+. * name
32d0: 73 70 61 63 65 20 61 73 20 61 20 6c 61 73 74 20  space as a last 
32e0: 72 65 73 6f 72 74 2e 0a 2b 09 20 2a 2f 0a 2b 0a  resort..+. */.+.
32f0: 2b 09 69 66 20 28 63 6d 64 50 74 72 20 3d 3d 20  +.if (cmdPtr == 
3300: 4e 55 4c 4c 29 20 7b 0a 2b 09 20 20 20 20 28 76  NULL) {.+.    (v
3310: 6f 69 64 29 20 54 63 6c 47 65 74 4e 61 6d 65 73  oid) TclGetNames
3320: 70 61 63 65 46 6f 72 51 75 61 6c 4e 61 6d 65 28  paceForQualName(
3330: 69 6e 74 65 72 70 2c 20 6e 61 6d 65 2c 20 4e 55  interp, name, NU
3340: 4c 4c 2c 0a 2b 09 09 20 20 20 20 54 43 4c 5f 47  LL,.+..    TCL_G
3350: 4c 4f 42 41 4c 5f 4f 4e 4c 59 2c 20 26 72 65 61  LOBAL_ONLY, &rea
3360: 6c 4e 73 50 74 72 2c 20 26 64 75 6d 6d 79 4e 73  lNsPtr, &dummyNs
3370: 50 74 72 2c 20 26 64 75 6d 6d 79 4e 73 50 74 72  Ptr, &dummyNsPtr
3380: 2c 0a 2b 09 09 20 20 20 20 26 73 69 6d 70 6c 65  ,.+..    &simple
3390: 4e 61 6d 65 29 3b 0a 2b 09 20 20 20 20 69 66 20  Name);.+.    if 
33a0: 28 72 65 61 6c 4e 73 50 74 72 20 21 3d 20 4e 55  (realNsPtr != NU
33b0: 4c 4c 20 26 26 20 73 69 6d 70 6c 65 4e 61 6d 65  LL && simpleName
33c0: 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 65   != NULL) {.+..e
33d0: 6e 74 72 79 50 74 72 20 3d 20 54 63 6c 5f 46 69  ntryPtr = Tcl_Fi
33e0: 6e 64 48 61 73 68 45 6e 74 72 79 28 26 72 65 61  ndHashEntry(&rea
33f0: 6c 4e 73 50 74 72 2d 3e 63 6d 64 54 61 62 6c 65  lNsPtr->cmdTable
3400: 2c 20 73 69 6d 70 6c 65 4e 61 6d 65 29 3b 0a 2b  , simpleName);.+
3410: 09 09 69 66 20 28 65 6e 74 72 79 50 74 72 20 21  ..if (entryPtr !
3420: 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 20 20 20  = NULL) {.+..   
3430: 20 63 6d 64 50 74 72 20 3d 20 28 43 6f 6d 6d 61   cmdPtr = (Comma
3440: 6e 64 20 2a 29 20 54 63 6c 5f 47 65 74 48 61 73  nd *) Tcl_GetHas
3450: 68 56 61 6c 75 65 28 65 6e 74 72 79 50 74 72 29  hValue(entryPtr)
3460: 3b 0a 2b 09 09 7d 0a 2b 09 20 20 20 20 7d 0a 2b  ;.+..}.+.    }.+
3470: 09 7d 0a 2b 20 20 20 20 7d 20 65 6c 73 65 20 7b  .}.+    } else {
3480: 0a 2b 09 4e 61 6d 65 73 70 61 63 65 20 2a 6e 73  .+.Namespace *ns
3490: 50 74 72 5b 32 5d 3b 0a 2b 09 72 65 67 69 73 74  Ptr[2];.+.regist
34a0: 65 72 20 69 6e 74 20 73 65 61 72 63 68 3b 0a 2b  er int search;.+
34b0: 0a 2b 09 54 63 6c 47 65 74 4e 61 6d 65 73 70 61  .+.TclGetNamespa
34c0: 63 65 46 6f 72 51 75 61 6c 4e 61 6d 65 28 69 6e  ceForQualName(in
34d0: 74 65 72 70 2c 20 6e 61 6d 65 2c 20 28 4e 61 6d  terp, name, (Nam
34e0: 65 73 70 61 63 65 20 2a 29 20 63 6f 6e 74 65 78  espace *) contex
34f0: 74 4e 73 50 74 72 2c 0a 2b 09 09 66 6c 61 67 73  tNsPtr,.+..flags
3500: 2c 20 26 6e 73 50 74 72 5b 30 5d 2c 20 26 6e 73  , &nsPtr[0], &ns
3510: 50 74 72 5b 31 5d 2c 20 26 63 78 74 4e 73 50 74  Ptr[1], &cxtNsPt
3520: 72 2c 20 26 73 69 6d 70 6c 65 4e 61 6d 65 29 3b  r, &simpleName);
3530: 0a 2b 0a 2b 09 2f 2a 0a 2b 09 20 2a 20 4c 6f 6f  .+.+./*.+. * Loo
3540: 6b 20 66 6f 72 20 74 68 65 20 63 6f 6d 6d 61 6e  k for the comman
3550: 64 20 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64  d in the command
3560: 20 74 61 62 6c 65 20 6f 66 20 69 74 73 20 6e 61   table of its na
3570: 6d 65 73 70 61 63 65 2e 0a 2b 09 20 2a 20 42 65  mespace..+. * Be
3580: 20 73 75 72 65 20 74 6f 20 63 68 65 63 6b 20 62   sure to check b
3590: 6f 74 68 20 70 6f 73 73 69 62 6c 65 20 73 65 61  oth possible sea
35a0: 72 63 68 20 70 61 74 68 73 3a 20 66 72 6f 6d 20  rch paths: from 
35b0: 74 68 65 0a 2b 09 20 2a 20 73 70 65 63 69 66 69  the.+. * specifi
35c0: 65 64 20 6e 61 6d 65 73 70 61 63 65 20 63 6f 6e  ed namespace con
35d0: 74 65 78 74 20 61 6e 64 20 66 72 6f 6d 20 74 68  text and from th
35e0: 65 20 67 6c 6f 62 61 6c 20 6e 61 6d 65 73 70 61  e global namespa
35f0: 63 65 2e 0a 2b 09 20 2a 2f 0a 2b 0a 2b 09 66 6f  ce..+. */.+.+.fo
3600: 72 20 28 73 65 61 72 63 68 20 3d 20 30 3b 20 20  r (search = 0;  
3610: 28 73 65 61 72 63 68 20 3c 20 32 29 20 26 26 20  (search < 2) && 
3620: 28 63 6d 64 50 74 72 20 3d 3d 20 4e 55 4c 4c 29  (cmdPtr == NULL)
3630: 3b 20 20 73 65 61 72 63 68 2b 2b 29 20 7b 0a 2b  ;  search++) {.+
3640: 09 20 20 20 20 69 66 20 28 28 6e 73 50 74 72 5b  .    if ((nsPtr[
3650: 73 65 61 72 63 68 5d 20 21 3d 20 4e 55 4c 4c 29  search] != NULL)
3660: 20 26 26 20 28 73 69 6d 70 6c 65 4e 61 6d 65 20   && (simpleName 
3670: 21 3d 20 4e 55 4c 4c 29 29 20 7b 0a 2b 09 09 65  != NULL)) {.+..e
3680: 6e 74 72 79 50 74 72 20 3d 20 54 63 6c 5f 46 69  ntryPtr = Tcl_Fi
3690: 6e 64 48 61 73 68 45 6e 74 72 79 28 26 6e 73 50  ndHashEntry(&nsP
36a0: 74 72 5b 73 65 61 72 63 68 5d 2d 3e 63 6d 64 54  tr[search]->cmdT
36b0: 61 62 6c 65 2c 0a 2b 09 09 09 73 69 6d 70 6c 65  able,.+...simple
36c0: 4e 61 6d 65 29 3b 0a 2b 09 09 69 66 20 28 65 6e  Name);.+..if (en
36d0: 74 72 79 50 74 72 20 21 3d 20 4e 55 4c 4c 29 20  tryPtr != NULL) 
36e0: 7b 0a 2b 09 09 20 20 20 20 63 6d 64 50 74 72 20  {.+..    cmdPtr 
36f0: 3d 20 28 43 6f 6d 6d 61 6e 64 20 2a 29 20 54 63  = (Command *) Tc
3700: 6c 5f 47 65 74 48 61 73 68 56 61 6c 75 65 28 65  l_GetHashValue(e
3710: 6e 74 72 79 50 74 72 29 3b 0a 2b 09 09 7d 0a 2b  ntryPtr);.+..}.+
3720: 09 20 20 20 20 7d 0a 2b 09 7d 0a 20 20 20 20 20  .    }.+.}.     
3730: 7d 0a 2b 0a 20 20 20 20 20 69 66 20 28 63 6d 64  }.+.     if (cmd
3740: 50 74 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 20  Ptr != NULL) {. 
3750: 09 72 65 74 75 72 6e 20 28 54 63 6c 5f 43 6f 6d  .return (Tcl_Com
3760: 6d 61 6e 64 29 20 63 6d 64 50 74 72 3b 0a 2d 20  mand) cmdPtr;.- 
3770: 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 66 6c     } else if (fl
3780: 61 67 73 20 26 20 54 43 4c 5f 4c 45 41 56 45 5f  ags & TCL_LEAVE_
3790: 45 52 52 5f 4d 53 47 29 20 7b 0a 2b 20 20 20 20  ERR_MSG) {.+    
37a0: 7d 0a 2b 0a 2b 20 20 20 20 69 66 20 28 66 6c 61  }.+.+    if (fla
37b0: 67 73 20 26 20 54 43 4c 5f 4c 45 41 56 45 5f 45  gs & TCL_LEAVE_E
37c0: 52 52 5f 4d 53 47 29 20 7b 0a 20 09 54 63 6c 5f  RR_MSG) {. .Tcl_
37d0: 52 65 73 65 74 52 65 73 75 6c 74 28 69 6e 74 65  ResetResult(inte
37e0: 72 70 29 3b 0a 20 09 54 63 6c 5f 41 70 70 65 6e  rp);. .Tcl_Appen
37f0: 64 52 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20  dResult(interp, 
3800: 22 75 6e 6b 6e 6f 77 6e 20 63 6f 6d 6d 61 6e 64  "unknown command
3810: 20 5c 22 22 2c 20 6e 61 6d 65 2c 0a 20 09 09 22   \"", name,. .."
3820: 5c 22 22 2c 20 28 63 68 61 72 20 2a 29 20 4e 55  \"", (char *) NU
3830: 4c 4c 29 3b 0a 20 20 20 20 20 7d 0a 2d 0a 20 20  LL);.     }.-.  
3840: 20 20 20 72 65 74 75 72 6e 20 28 54 63 6c 5f 43     return (Tcl_C
3850: 6f 6d 6d 61 6e 64 29 20 4e 55 4c 4c 3b 0a 20 7d  ommand) NULL;. }
3860: 0a 20 0c 0a 40 40 20 2d 32 36 32 38 2c 36 20 2b  . ..@@ -2628,6 +
3870: 32 37 30 37 2c 37 20 40 40 0a 20 09 20 20 20 20  2707,7 @@. .    
3880: 68 50 74 72 20 3d 20 54 63 6c 5f 46 69 6e 64 48  hPtr = Tcl_FindH
3890: 61 73 68 45 6e 74 72 79 28 26 73 68 61 64 6f 77  ashEntry(&shadow
38a0: 4e 73 50 74 72 2d 3e 63 6d 64 54 61 62 6c 65 2c  NsPtr->cmdTable,
38b0: 20 63 6d 64 4e 61 6d 65 29 3b 0a 20 09 20 20 20   cmdName);. .   
38c0: 20 69 66 20 28 68 50 74 72 20 21 3d 20 4e 55 4c   if (hPtr != NUL
38d0: 4c 29 20 7b 0a 20 09 09 6e 73 50 74 72 2d 3e 63  L) {. ..nsPtr->c
38e0: 6d 64 52 65 66 45 70 6f 63 68 2b 2b 3b 0a 2b 09  mdRefEpoch++;.+.
38f0: 09 54 63 6c 49 6e 76 61 6c 69 64 61 74 65 4e 73  .TclInvalidateNs
3900: 50 61 74 68 28 6e 73 50 74 72 29 3b 0a 20 0a 20  Path(nsPtr);. . 
3910: 09 09 2f 2a 20 0a 20 09 09 20 2a 20 49 66 20 74  ../* . .. * If t
3920: 68 65 20 73 68 61 64 6f 77 65 64 20 63 6f 6d 6d  he shadowed comm
3930: 61 6e 64 20 77 61 73 20 63 6f 6d 70 69 6c 65 64  and was compiled
3940: 20 74 6f 20 62 79 74 65 63 6f 64 65 73 2c 20 77   to bytecodes, w
3950: 65 0a 40 40 20 2d 32 38 33 31 2c 31 33 20 2b 32  e.@@ -2831,13 +2
3960: 39 31 31 2c 31 33 20 40 40 0a 20 20 20 20 20 73  911,13 @@.     s
3970: 74 61 74 69 63 20 43 4f 4e 53 54 20 63 68 61 72  tatic CONST char
3980: 20 2a 73 75 62 43 6d 64 73 5b 5d 20 3d 20 7b 0a   *subCmds[] = {.
3990: 20 09 22 63 68 69 6c 64 72 65 6e 22 2c 20 22 63   ."children", "c
39a0: 6f 64 65 22 2c 20 22 63 75 72 72 65 6e 74 22 2c  ode", "current",
39b0: 20 22 64 65 6c 65 74 65 22 2c 20 22 65 6e 73 65   "delete", "ense
39c0: 6d 62 6c 65 22 2c 0a 20 09 22 65 76 61 6c 22 2c  mble",. ."eval",
39d0: 20 22 65 78 69 73 74 73 22 2c 20 22 65 78 70 6f   "exists", "expo
39e0: 72 74 22 2c 20 22 66 6f 72 67 65 74 22 2c 20 22  rt", "forget", "
39f0: 69 6d 70 6f 72 74 22 2c 0a 2d 09 22 69 6e 73 63  import",.-."insc
3a00: 6f 70 65 22 2c 20 22 6f 72 69 67 69 6e 22 2c 20  ope", "origin", 
3a10: 22 70 61 72 65 6e 74 22 2c 20 22 71 75 61 6c 69  "parent", "quali
3a20: 66 69 65 72 73 22 2c 0a 2b 09 22 69 6e 73 63 6f  fiers",.+."insco
3a30: 70 65 22 2c 20 22 6f 72 69 67 69 6e 22 2c 20 22  pe", "origin", "
3a40: 70 61 72 65 6e 74 22 2c 20 22 70 61 74 68 22 2c  parent", "path",
3a50: 20 22 71 75 61 6c 69 66 69 65 72 73 22 2c 0a 20   "qualifiers",. 
3a60: 09 22 74 61 69 6c 22 2c 20 22 77 68 69 63 68 22  ."tail", "which"
3a70: 2c 20 28 63 68 61 72 20 2a 29 20 4e 55 4c 4c 0a  , (char *) NULL.
3a80: 20 20 20 20 20 7d 3b 0a 20 20 20 20 20 65 6e 75       };.     enu
3a90: 6d 20 4e 53 53 75 62 43 6d 64 49 64 78 20 7b 0a  m NSSubCmdIdx {.
3aa0: 20 09 4e 53 43 68 69 6c 64 72 65 6e 49 64 78 2c   .NSChildrenIdx,
3ab0: 20 4e 53 43 6f 64 65 49 64 78 2c 20 4e 53 43 75   NSCodeIdx, NSCu
3ac0: 72 72 65 6e 74 49 64 78 2c 20 4e 53 44 65 6c 65  rrentIdx, NSDele
3ad0: 74 65 49 64 78 2c 20 4e 53 45 6e 73 65 6d 62 6c  teIdx, NSEnsembl
3ae0: 65 49 64 78 2c 0a 20 09 4e 53 45 76 61 6c 49 64  eIdx,. .NSEvalId
3af0: 78 2c 20 4e 53 45 78 69 73 74 73 49 64 78 2c 20  x, NSExistsIdx, 
3b00: 4e 53 45 78 70 6f 72 74 49 64 78 2c 20 4e 53 46  NSExportIdx, NSF
3b10: 6f 72 67 65 74 49 64 78 2c 20 4e 53 49 6d 70 6f  orgetIdx, NSImpo
3b20: 72 74 49 64 78 2c 0a 2d 09 4e 53 49 6e 73 63 6f  rtIdx,.-.NSInsco
3b30: 70 65 49 64 78 2c 20 4e 53 4f 72 69 67 69 6e 49  peIdx, NSOriginI
3b40: 64 78 2c 20 4e 53 50 61 72 65 6e 74 49 64 78 2c  dx, NSParentIdx,
3b50: 20 4e 53 51 75 61 6c 69 66 69 65 72 73 49 64 78   NSQualifiersIdx
3b60: 2c 0a 2b 09 4e 53 49 6e 73 63 6f 70 65 49 64 78  ,.+.NSInscopeIdx
3b70: 2c 20 4e 53 4f 72 69 67 69 6e 49 64 78 2c 20 4e  , NSOriginIdx, N
3b80: 53 50 61 72 65 6e 74 49 64 78 2c 20 4e 53 50 61  SParentIdx, NSPa
3b90: 74 68 49 64 78 2c 20 4e 53 51 75 61 6c 69 66 69  thIdx, NSQualifi
3ba0: 65 72 73 49 64 78 2c 0a 20 09 4e 53 54 61 69 6c  ersIdx,. .NSTail
3bb0: 49 64 78 2c 20 4e 53 57 68 69 63 68 49 64 78 0a  Idx, NSWhichIdx.
3bc0: 20 20 20 20 20 7d 3b 0a 20 20 20 20 20 69 6e 74       };.     int
3bd0: 20 69 6e 64 65 78 2c 20 72 65 73 75 6c 74 3b 0a   index, result;.
3be0: 40 40 20 2d 32 38 39 37 2c 36 20 2b 32 39 37 37  @@ -2897,6 +2977
3bf0: 2c 39 20 40 40 0a 20 20 20 20 20 63 61 73 65 20  ,9 @@.     case 
3c00: 4e 53 50 61 72 65 6e 74 49 64 78 3a 0a 20 09 72  NSParentIdx:. .r
3c10: 65 73 75 6c 74 20 3d 20 4e 61 6d 65 73 70 61 63  esult = Namespac
3c20: 65 50 61 72 65 6e 74 43 6d 64 28 63 6c 69 65 6e  eParentCmd(clien
3c30: 74 44 61 74 61 2c 20 69 6e 74 65 72 70 2c 20 6f  tData, interp, o
3c40: 62 6a 63 2c 20 6f 62 6a 76 29 3b 0a 20 09 62 72  bjc, objv);. .br
3c50: 65 61 6b 3b 0a 2b 20 20 20 20 63 61 73 65 20 4e  eak;.+    case N
3c60: 53 50 61 74 68 49 64 78 3a 0a 2b 09 72 65 73 75  SPathIdx:.+.resu
3c70: 6c 74 20 3d 20 4e 61 6d 65 73 70 61 63 65 50 61  lt = NamespacePa
3c80: 74 68 43 6d 64 28 63 6c 69 65 6e 74 44 61 74 61  thCmd(clientData
3c90: 2c 20 69 6e 74 65 72 70 2c 20 6f 62 6a 63 2c 20  , interp, objc, 
3ca0: 6f 62 6a 76 29 3b 0a 2b 09 62 72 65 61 6b 3b 0a  objv);.+.break;.
3cb0: 20 20 20 20 20 63 61 73 65 20 4e 53 51 75 61 6c       case NSQual
3cc0: 69 66 69 65 72 73 49 64 78 3a 0a 20 09 72 65 73  ifiersIdx:. .res
3cd0: 75 6c 74 20 3d 20 4e 61 6d 65 73 70 61 63 65 51  ult = NamespaceQ
3ce0: 75 61 6c 69 66 69 65 72 73 43 6d 64 28 63 6c 69  ualifiersCmd(cli
3cf0: 65 6e 74 44 61 74 61 2c 20 69 6e 74 65 72 70 2c  entData, interp,
3d00: 20 6f 62 6a 63 2c 20 6f 62 6a 76 29 3b 0a 20 09   objc, objv);. .
3d10: 62 72 65 61 6b 3b 0a 40 40 20 2d 33 39 30 36 2c  break;.@@ -3906,
3d20: 36 20 2b 33 39 38 39 2c 32 32 35 20 40 40 0a 20  6 +3989,225 @@. 
3d30: 2f 2a 0a 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  /*.  *----------
3d40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3d50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3d60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3d70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a  ------------.  *
3d80: 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  .+ *.+ *--------
3d90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3da0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3db0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b  --------------.+
3dd0: 20 2a 2f 0a 2b 0a 2b 73 74 61 74 69 63 20 69 6e   */.+.+static in
3de0: 74 0a 2b 4e 61 6d 65 73 70 61 63 65 50 61 74 68  t.+NamespacePath
3df0: 43 6d 64 28 64 75 6d 6d 79 2c 20 69 6e 74 65 72  Cmd(dummy, inter
3e00: 70 2c 20 6f 62 6a 63 2c 20 6f 62 6a 76 29 0a 2b  p, objc, objv).+
3e10: 20 20 20 20 43 6c 69 65 6e 74 44 61 74 61 20 64      ClientData d
3e20: 75 6d 6d 79 3b 09 09 2f 2a 20 4e 6f 74 20 75 73  ummy;../* Not us
3e30: 65 64 2e 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f  ed. */.+    Tcl_
3e40: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 3b 09  Interp *interp;.
3e50: 09 2f 2a 20 43 75 72 72 65 6e 74 20 69 6e 74 65  ./* Current inte
3e60: 72 70 72 65 74 65 72 2e 20 2a 2f 0a 2b 20 20 20  rpreter. */.+   
3e70: 20 69 6e 74 20 6f 62 6a 63 3b 09 09 09 2f 2a 20   int objc;.../* 
3e80: 4e 75 6d 62 65 72 20 6f 66 20 61 72 67 75 6d 65  Number of argume
3e90: 6e 74 73 2e 20 2a 2f 0a 2b 20 20 20 20 54 63 6c  nts. */.+    Tcl
3ea0: 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76  _Obj *CONST objv
3eb0: 5b 5d 3b 09 2f 2a 20 41 72 67 75 6d 65 6e 74 20  [];./* Argument 
3ec0: 6f 62 6a 65 63 74 73 2e 20 2a 2f 0a 2b 7b 0a 2b  objects. */.+{.+
3ed0: 20 20 20 20 4e 61 6d 65 73 70 61 63 65 20 2a 6e      Namespace *n
3ee0: 73 50 74 72 20 3d 20 28 4e 61 6d 65 73 70 61 63  sPtr = (Namespac
3ef0: 65 20 2a 29 20 54 63 6c 5f 47 65 74 43 75 72 72  e *) Tcl_GetCurr
3f00: 65 6e 74 4e 61 6d 65 73 70 61 63 65 28 69 6e 74  entNamespace(int
3f10: 65 72 70 29 3b 0a 2b 20 20 20 20 69 6e 74 20 69  erp);.+    int i
3f20: 2c 20 6e 73 4f 62 6a 63 2c 20 72 65 73 75 6c 74  , nsObjc, result
3f30: 20 3d 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20   = TCL_ERROR;.+ 
3f40: 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 2a 6e 73 4f     Tcl_Obj **nsO
3f50: 62 6a 76 3b 0a 2b 20 20 20 20 54 63 6c 5f 4e 61  bjv;.+    Tcl_Na
3f60: 6d 65 73 70 61 63 65 20 2a 2a 6e 61 6d 65 73 70  mespace **namesp
3f70: 61 63 65 4c 69 73 74 20 3d 20 4e 55 4c 4c 3b 0a  aceList = NULL;.
3f80: 2b 20 20 20 20 54 63 6c 5f 4e 61 6d 65 73 70 61  +    Tcl_Namespa
3f90: 63 65 20 2a 73 74 61 74 69 63 4e 73 5b 34 5d 3b  ce *staticNs[4];
3fa0: 0a 2b 0a 2b 20 20 20 20 69 66 20 28 6f 62 6a 63  .+.+    if (objc
3fb0: 20 3e 20 33 29 20 7b 0a 2b 09 54 63 6c 5f 57 72   > 3) {.+.Tcl_Wr
3fc0: 6f 6e 67 4e 75 6d 41 72 67 73 28 69 6e 74 65 72  ongNumArgs(inter
3fd0: 70 2c 20 32 2c 20 6f 62 6a 76 2c 20 22 3f 70 61  p, 2, objv, "?pa
3fe0: 74 68 4c 69 73 74 3f 22 29 3b 0a 2b 09 72 65 74  thList?");.+.ret
3ff0: 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b  urn TCL_ERROR;.+
4000: 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 0a      }.+.+    /*.
4010: 2b 20 20 20 20 20 2a 20 49 66 20 6e 6f 20 70 61  +     * If no pa
4020: 74 68 20 69 73 20 67 69 76 65 6e 2c 20 72 65 74  th is given, ret
4030: 75 72 6e 20 74 68 65 20 63 75 72 72 65 6e 74 20  urn the current 
4040: 70 61 74 68 2e 0a 2b 20 20 20 20 20 2a 2f 0a 2b  path..+     */.+
4050: 0a 2b 20 20 20 20 69 66 20 28 6f 62 6a 63 20 3d  .+    if (objc =
4060: 3d 20 32 29 20 7b 0a 2b 09 2f 2a 0a 2b 09 20 2a  = 2) {.+./*.+. *
4070: 20 4e 6f 74 20 61 20 76 65 72 79 20 66 61 73 74   Not a very fast
4080: 20 77 61 79 20 74 6f 20 63 6f 6d 70 75 74 65 20   way to compute 
4090: 74 68 69 73 2c 20 62 75 74 20 65 61 73 79 20 74  this, but easy t
40a0: 6f 20 67 65 74 20 72 69 67 68 74 2e 0a 2b 09 20  o get right..+. 
40b0: 2a 2f 0a 2b 09 66 6f 72 20 28 69 3d 30 20 3b 20  */.+.for (i=0 ; 
40c0: 69 3c 6e 73 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64  i<nsPtr->command
40d0: 50 61 74 68 4c 65 6e 67 74 68 20 3b 20 69 2b 2b  PathLength ; i++
40e0: 29 20 7b 0a 2b 09 20 20 20 20 69 66 20 28 6e 73  ) {.+.    if (ns
40f0: 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68  Ptr->commandPath
4100: 41 72 72 61 79 5b 69 5d 2e 6e 73 50 74 72 20 21  Array[i].nsPtr !
4110: 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 54 63 6c  = NULL) {.+..Tcl
4120: 5f 41 70 70 65 6e 64 45 6c 65 6d 65 6e 74 28 69  _AppendElement(i
4130: 6e 74 65 72 70 2c 0a 2b 09 09 09 6e 73 50 74 72  nterp,.+...nsPtr
4140: 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68 41 72 72  ->commandPathArr
4150: 61 79 5b 69 5d 2e 6e 73 50 74 72 2d 3e 66 75 6c  ay[i].nsPtr->ful
4160: 6c 4e 61 6d 65 29 3b 0a 2b 09 20 20 20 20 7d 0a  lName);.+.    }.
4170: 2b 09 7d 0a 2b 09 72 65 74 75 72 6e 20 54 43 4c  +.}.+.return TCL
4180: 5f 4f 4b 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20  _OK;.+    }.+.+ 
4190: 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 54 68     /*.+     * Th
41a0: 65 72 65 20 69 73 20 61 20 70 61 74 68 20 67 69  ere is a path gi
41b0: 76 65 6e 2c 20 73 6f 20 70 61 72 73 65 20 69 74  ven, so parse it
41c0: 20 69 6e 74 6f 20 61 6e 20 61 72 72 61 79 20 6f   into an array o
41d0: 66 20 6e 61 6d 65 73 70 61 63 65 0a 2b 20 20 20  f namespace.+   
41e0: 20 20 2a 20 70 6f 69 6e 74 65 72 73 2e 0a 2b 20    * pointers..+ 
41f0: 20 20 20 20 2a 2f 0a 2b 0a 2b 20 20 20 20 69 66      */.+.+    if
4200: 20 28 54 63 6c 5f 4c 69 73 74 4f 62 6a 47 65 74   (Tcl_ListObjGet
4210: 45 6c 65 6d 65 6e 74 73 28 69 6e 74 65 72 70 2c  Elements(interp,
4220: 20 6f 62 6a 76 5b 32 5d 2c 20 26 6e 73 4f 62 6a   objv[2], &nsObj
4230: 63 2c 20 26 6e 73 4f 62 6a 76 29 20 21 3d 20 54  c, &nsObjv) != T
4240: 43 4c 5f 4f 4b 29 20 7b 0a 2b 09 67 6f 74 6f 20  CL_OK) {.+.goto 
4250: 62 61 64 4e 61 6d 65 73 70 61 63 65 3b 0a 2b 20  badNamespace;.+ 
4260: 20 20 20 7d 0a 2b 20 20 20 20 69 66 20 28 6e 73     }.+    if (ns
4270: 4f 62 6a 63 20 21 3d 20 30 29 20 7b 0a 2b 09 69  Objc != 0) {.+.i
4280: 66 20 28 6e 73 4f 62 6a 63 20 3e 20 34 29 20 7b  f (nsObjc > 4) {
4290: 0a 2b 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65  .+.    namespace
42a0: 4c 69 73 74 20 3d 20 28 54 63 6c 5f 4e 61 6d 65  List = (Tcl_Name
42b0: 73 70 61 63 65 20 2a 2a 29 0a 2b 09 09 20 20 20  space **).+..   
42c0: 20 63 6b 61 6c 6c 6f 63 28 73 69 7a 65 6f 66 28   ckalloc(sizeof(
42d0: 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 20 2a 29  Tcl_Namespace *)
42e0: 20 2a 20 6e 73 4f 62 6a 63 29 3b 0a 2b 09 7d 20   * nsObjc);.+.} 
42f0: 65 6c 73 65 20 7b 0a 2b 09 20 20 20 20 6e 61 6d  else {.+.    nam
4300: 65 73 70 61 63 65 4c 69 73 74 20 3d 20 73 74 61  espaceList = sta
4310: 74 69 63 4e 73 3b 0a 2b 09 7d 0a 2b 0a 2b 09 66  ticNs;.+.}.+.+.f
4320: 6f 72 20 28 69 3d 30 20 3b 20 69 3c 6e 73 4f 62  or (i=0 ; i<nsOb
4330: 6a 63 20 3b 20 69 2b 2b 29 20 7b 0a 2b 09 20 20  jc ; i++) {.+.  
4340: 20 20 69 66 20 28 54 63 6c 47 65 74 4e 61 6d 65    if (TclGetName
4350: 73 70 61 63 65 46 72 6f 6d 4f 62 6a 28 69 6e 74  spaceFromObj(int
4360: 65 72 70 2c 20 6e 73 4f 62 6a 76 5b 69 5d 2c 0a  erp, nsObjv[i],.
4370: 2b 09 09 20 20 20 20 26 6e 61 6d 65 73 70 61 63  +..    &namespac
4380: 65 4c 69 73 74 5b 69 5d 29 20 21 3d 20 54 43 4c  eList[i]) != TCL
4390: 5f 4f 4b 29 20 7b 0a 2b 09 09 67 6f 74 6f 20 62  _OK) {.+..goto b
43a0: 61 64 4e 61 6d 65 73 70 61 63 65 3b 0a 2b 09 20  adNamespace;.+. 
43b0: 20 20 20 7d 0a 2b 09 20 20 20 20 69 66 20 28 6e     }.+.    if (n
43c0: 61 6d 65 73 70 61 63 65 4c 69 73 74 5b 69 5d 20  amespaceList[i] 
43d0: 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 54 63  == NULL) {.+..Tc
43e0: 6c 5f 41 70 70 65 6e 64 52 65 73 75 6c 74 28 69  l_AppendResult(i
43f0: 6e 74 65 72 70 2c 20 22 75 6e 6b 6e 6f 77 6e 20  nterp, "unknown 
4400: 6e 61 6d 65 73 70 61 63 65 20 5c 22 22 2c 0a 2b  namespace \"",.+
4410: 09 09 09 54 63 6c 47 65 74 53 74 72 69 6e 67 28  ...TclGetString(
4420: 6e 73 4f 62 6a 76 5b 69 5d 29 2c 20 22 5c 22 22  nsObjv[i]), "\""
4430: 2c 20 4e 55 4c 4c 29 3b 0a 2b 09 09 67 6f 74 6f  , NULL);.+..goto
4440: 20 62 61 64 4e 61 6d 65 73 70 61 63 65 3b 0a 2b   badNamespace;.+
4450: 09 20 20 20 20 7d 0a 2b 09 7d 0a 2b 20 20 20 20  .    }.+.}.+    
4460: 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20 20  }.+.+    /*.+   
4470: 20 20 2a 20 4e 6f 77 20 77 65 20 68 61 76 65 20    * Now we have 
4480: 74 68 65 20 6c 69 73 74 20 6f 66 20 76 61 6c 69  the list of vali
4490: 64 20 6e 61 6d 65 73 70 61 63 65 73 2c 20 69 6e  d namespaces, in
44a0: 73 74 61 6c 6c 20 69 74 20 61 73 20 74 68 65 0a  stall it as the.
44b0: 2b 20 20 20 20 20 2a 20 70 61 74 68 2e 0a 2b 20  +     * path..+ 
44c0: 20 20 20 20 2a 2f 0a 2b 0a 2b 20 20 20 20 53 65      */.+.+    Se
44d0: 74 4e 73 50 61 74 68 28 6e 73 50 74 72 2c 20 6e  tNsPath(nsPtr, n
44e0: 73 4f 62 6a 63 2c 20 6e 61 6d 65 73 70 61 63 65  sObjc, namespace
44f0: 4c 69 73 74 29 3b 0a 2b 0a 2b 20 20 20 20 72 65  List);.+.+    re
4500: 73 75 6c 74 20 3d 20 54 43 4c 5f 4f 4b 3b 0a 2b  sult = TCL_OK;.+
4510: 20 20 62 61 64 4e 61 6d 65 73 70 61 63 65 3a 0a    badNamespace:.
4520: 2b 20 20 20 20 69 66 20 28 6e 61 6d 65 73 70 61  +    if (namespa
4530: 63 65 4c 69 73 74 20 21 3d 20 4e 55 4c 4c 20 26  ceList != NULL &
4540: 26 20 6e 61 6d 65 73 70 61 63 65 4c 69 73 74 20  & namespaceList 
4550: 21 3d 20 73 74 61 74 69 63 4e 73 29 20 7b 0a 2b  != staticNs) {.+
4560: 09 63 6b 66 72 65 65 28 28 63 68 61 72 20 2a 29  .ckfree((char *)
4570: 20 6e 61 6d 65 73 70 61 63 65 4c 69 73 74 29 3b   namespaceList);
4580: 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20 72 65 74  .+    }.+    ret
4590: 75 72 6e 20 72 65 73 75 6c 74 3b 0a 2b 7d 0a 2b  urn result;.+}.+
45a0: 0c 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d  ..+/*.+ *-------
45b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
45c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
45d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
45e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
45f0: 2b 20 2a 0a 2b 20 2a 20 53 65 74 4e 73 50 61 74  + *.+ * SetNsPat
4600: 68 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a 09 53 65 74  h --.+ *.+ *.Set
4610: 73 20 74 68 65 20 6e 61 6d 65 73 70 61 63 65 20  s the namespace 
4620: 63 6f 6d 6d 61 6e 64 20 6e 61 6d 65 20 72 65 73  command name res
4630: 6f 6c 75 74 69 6f 6e 20 70 61 74 68 20 74 6f 20  olution path to 
4640: 74 68 65 20 67 69 76 65 6e 0a 2b 20 2a 09 6c 69  the given.+ *.li
4650: 73 74 20 6f 66 20 6e 61 6d 65 73 70 61 63 65 73  st of namespaces
4660: 2e 20 49 66 20 74 68 65 20 6c 69 73 74 20 69 73  . If the list is
4670: 20 65 6d 70 74 79 20 28 6f 66 20 7a 65 72 6f 20   empty (of zero 
4680: 6c 65 6e 67 74 68 29 20 74 68 65 0a 2b 20 2a 09  length) the.+ *.
4690: 70 61 74 68 20 69 73 20 73 65 74 20 74 6f 20 65  path is set to e
46a0: 6d 70 74 79 20 61 6e 64 20 74 68 65 20 64 65 66  mpty and the def
46b0: 61 75 6c 74 20 6f 6c 64 2d 73 74 79 6c 65 20 62  ault old-style b
46c0: 65 68 61 76 69 6f 75 72 20 6f 66 0a 2b 20 2a 09  ehaviour of.+ *.
46d0: 63 6f 6d 6d 61 6e 64 20 6e 61 6d 65 20 72 65 73  command name res
46e0: 6f 6c 75 74 69 6f 6e 20 69 73 20 75 73 65 64 2e  olution is used.
46f0: 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 73  .+ *.+ * Results
4700: 3a 0a 2b 20 2a 09 6e 6f 74 68 69 6e 67 0a 2b 20  :.+ *.nothing.+ 
4710: 2a 0a 2b 20 2a 20 53 69 64 65 20 65 66 66 65 63  *.+ * Side effec
4720: 74 73 3a 0a 2b 20 2a 09 49 6e 76 61 6c 69 64 61  ts:.+ *.Invalida
4730: 74 65 73 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20  tes the command 
4740: 6e 61 6d 65 20 72 65 73 6f 6c 75 74 69 6f 6e 20  name resolution 
4750: 63 61 63 68 65 73 20 66 6f 72 20 61 6e 79 20 63  caches for any c
4760: 6f 6d 6d 61 6e 64 0a 2b 20 2a 09 72 65 73 6f 6c  ommand.+ *.resol
4770: 76 65 64 20 69 6e 20 74 68 65 20 67 69 76 65 6e  ved in the given
4780: 20 6e 61 6d 65 73 70 61 63 65 2e 0a 2b 20 2a 0a   namespace..+ *.
4790: 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  + *-------------
47a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
47b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
47c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
47d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b  ---------.+ */.+
47e0: 0a 2b 2f 2a 20 45 58 50 4f 53 45 20 4d 45 3f 20  .+/* EXPOSE ME? 
47f0: 2a 2f 0a 2b 73 74 61 74 69 63 20 76 6f 69 64 0a  */.+static void.
4800: 2b 53 65 74 4e 73 50 61 74 68 28 6e 73 50 74 72  +SetNsPath(nsPtr
4810: 2c 20 70 61 74 68 4c 65 6e 67 74 68 2c 20 70 61  , pathLength, pa
4820: 74 68 41 72 79 29 0a 2b 20 20 20 20 4e 61 6d 65  thAry).+    Name
4830: 73 70 61 63 65 20 2a 6e 73 50 74 72 3b 09 09 2f  space *nsPtr;../
4840: 2a 20 4e 61 6d 65 73 70 61 63 65 20 77 68 6f 73  * Namespace whos
4850: 65 20 70 61 74 68 20 69 73 20 74 6f 20 62 65 20  e path is to be 
4860: 73 65 74 2e 20 2a 2f 0a 2b 20 20 20 20 69 6e 74  set. */.+    int
4870: 20 70 61 74 68 4c 65 6e 67 74 68 3b 09 09 2f 2a   pathLength;../*
4880: 20 4c 65 6e 67 74 68 20 6f 66 20 70 61 74 68 41   Length of pathA
4890: 72 79 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 4e  ry */.+    Tcl_N
48a0: 61 6d 65 73 70 61 63 65 20 2a 70 61 74 68 41 72  amespace *pathAr
48b0: 79 5b 5d 3b 09 2f 2a 20 41 72 72 61 79 20 6f 66  y[];./* Array of
48c0: 20 6e 61 6d 65 73 70 61 63 65 73 20 74 68 61 74   namespaces that
48d0: 20 61 72 65 20 74 68 65 20 70 61 74 68 2e 20 2a   are the path. *
48e0: 2f 0a 2b 7b 0a 2b 20 20 20 20 4e 61 6d 65 73 70  /.+{.+    Namesp
48f0: 61 63 65 50 61 74 68 45 6e 74 72 79 20 2a 74 6d  acePathEntry *tm
4900: 70 50 61 74 68 41 72 72 61 79 3b 0a 2b 20 20 20  pPathArray;.+   
4910: 20 69 6e 74 20 69 3b 0a 2b 0a 2b 20 20 20 20 69   int i;.+.+    i
4920: 66 20 28 70 61 74 68 4c 65 6e 67 74 68 20 21 3d  f (pathLength !=
4930: 20 30 29 20 7b 0a 2b 09 74 6d 70 50 61 74 68 41   0) {.+.tmpPathA
4940: 72 72 61 79 20 3d 20 28 4e 61 6d 65 73 70 61 63  rray = (Namespac
4950: 65 50 61 74 68 45 6e 74 72 79 20 2a 29 0a 2b 09  ePathEntry *).+.
4960: 09 63 6b 61 6c 6c 6f 63 28 73 69 7a 65 6f 66 28  .ckalloc(sizeof(
4970: 4e 61 6d 65 73 70 61 63 65 50 61 74 68 45 6e 74  NamespacePathEnt
4980: 72 79 29 20 2a 20 70 61 74 68 4c 65 6e 67 74 68  ry) * pathLength
4990: 29 3b 0a 2b 09 66 6f 72 20 28 69 3d 30 20 3b 20  );.+.for (i=0 ; 
49a0: 69 3c 70 61 74 68 4c 65 6e 67 74 68 20 3b 20 69  i<pathLength ; i
49b0: 2b 2b 29 20 7b 0a 2b 09 20 20 20 20 74 6d 70 50  ++) {.+.    tmpP
49c0: 61 74 68 41 72 72 61 79 5b 69 5d 2e 6e 73 50 74  athArray[i].nsPt
49d0: 72 20 3d 20 28 4e 61 6d 65 73 70 61 63 65 20 2a  r = (Namespace *
49e0: 29 20 70 61 74 68 41 72 79 5b 69 5d 3b 0a 2b 09  ) pathAry[i];.+.
49f0: 20 20 20 20 74 6d 70 50 61 74 68 41 72 72 61 79      tmpPathArray
4a00: 5b 69 5d 2e 63 72 65 61 74 6f 72 4e 73 50 74 72  [i].creatorNsPtr
4a10: 20 3d 20 6e 73 50 74 72 3b 0a 2b 09 20 20 20 20   = nsPtr;.+.    
4a20: 74 6d 70 50 61 74 68 41 72 72 61 79 5b 69 5d 2e  tmpPathArray[i].
4a30: 70 72 65 76 50 74 72 20 3d 20 4e 55 4c 4c 3b 0a  prevPtr = NULL;.
4a40: 2b 09 20 20 20 20 74 6d 70 50 61 74 68 41 72 72  +.    tmpPathArr
4a50: 61 79 5b 69 5d 2e 6e 65 78 74 50 74 72 20 3d 0a  ay[i].nextPtr =.
4a60: 2b 09 09 20 20 20 20 74 6d 70 50 61 74 68 41 72  +..    tmpPathAr
4a70: 72 61 79 5b 69 5d 2e 6e 73 50 74 72 2d 3e 63 6f  ray[i].nsPtr->co
4a80: 6d 6d 61 6e 64 50 61 74 68 53 6f 75 72 63 65 4c  mmandPathSourceL
4a90: 69 73 74 3b 0a 2b 09 20 20 20 20 69 66 20 28 74  ist;.+.    if (t
4aa0: 6d 70 50 61 74 68 41 72 72 61 79 5b 69 5d 2e 6e  mpPathArray[i].n
4ab0: 65 78 74 50 74 72 20 21 3d 20 4e 55 4c 4c 29 20  extPtr != NULL) 
4ac0: 7b 0a 2b 09 09 74 6d 70 50 61 74 68 41 72 72 61  {.+..tmpPathArra
4ad0: 79 5b 69 5d 2e 6e 65 78 74 50 74 72 2d 3e 70 72  y[i].nextPtr->pr
4ae0: 65 76 50 74 72 20 3d 20 26 74 6d 70 50 61 74 68  evPtr = &tmpPath
4af0: 41 72 72 61 79 5b 69 5d 3b 0a 2b 09 20 20 20 20  Array[i];.+.    
4b00: 7d 0a 2b 09 20 20 20 20 74 6d 70 50 61 74 68 41  }.+.    tmpPathA
4b10: 72 72 61 79 5b 69 5d 2e 6e 73 50 74 72 2d 3e 63  rray[i].nsPtr->c
4b20: 6f 6d 6d 61 6e 64 50 61 74 68 53 6f 75 72 63 65  ommandPathSource
4b30: 4c 69 73 74 20 3d 20 26 74 6d 70 50 61 74 68 41  List = &tmpPathA
4b40: 72 72 61 79 5b 69 5d 3b 0a 2b 09 7d 0a 2b 09 69  rray[i];.+.}.+.i
4b50: 66 20 28 6e 73 50 74 72 2d 3e 63 6f 6d 6d 61 6e  f (nsPtr->comman
4b60: 64 50 61 74 68 4c 65 6e 67 74 68 20 21 3d 20 30  dPathLength != 0
4b70: 29 20 7b 0a 2b 09 20 20 20 20 55 6e 6c 69 6e 6b  ) {.+.    Unlink
4b80: 4e 73 50 61 74 68 28 6e 73 50 74 72 29 3b 0a 2b  NsPath(nsPtr);.+
4b90: 09 7d 0a 2b 09 6e 73 50 74 72 2d 3e 63 6f 6d 6d  .}.+.nsPtr->comm
4ba0: 61 6e 64 50 61 74 68 41 72 72 61 79 20 3d 20 74  andPathArray = t
4bb0: 6d 70 50 61 74 68 41 72 72 61 79 3b 0a 2b 20 20  mpPathArray;.+  
4bc0: 20 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 69 66 20    } else {.+.if 
4bd0: 28 6e 73 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64 50  (nsPtr->commandP
4be0: 61 74 68 4c 65 6e 67 74 68 20 21 3d 20 30 29 20  athLength != 0) 
4bf0: 7b 0a 2b 09 20 20 20 20 55 6e 6c 69 6e 6b 4e 73  {.+.    UnlinkNs
4c00: 50 61 74 68 28 6e 73 50 74 72 29 3b 0a 2b 09 7d  Path(nsPtr);.+.}
4c10: 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 6e  .+    }.+.+    n
4c20: 73 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74  sPtr->commandPat
4c30: 68 4c 65 6e 67 74 68 20 3d 20 70 61 74 68 4c 65  hLength = pathLe
4c40: 6e 67 74 68 3b 0a 2b 20 20 20 20 6e 73 50 74 72  ngth;.+    nsPtr
4c50: 2d 3e 63 6d 64 52 65 66 45 70 6f 63 68 2b 2b 3b  ->cmdRefEpoch++;
4c60: 0a 2b 20 20 20 20 6e 73 50 74 72 2d 3e 72 65 73  .+    nsPtr->res
4c70: 6f 6c 76 65 72 45 70 6f 63 68 2b 2b 3b 0a 2b 7d  olverEpoch++;.+}
4c80: 0a 2b 0c 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d  .+..+/*.+ *-----
4c90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4ca0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4cb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4cc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4cd0: 2d 0a 2b 20 2a 0a 2b 20 2a 20 55 6e 6c 69 6e 6b  -.+ *.+ * Unlink
4ce0: 4e 73 50 61 74 68 20 2d 2d 0a 2b 20 2a 0a 2b 20  NsPath --.+ *.+ 
4cf0: 2a 09 44 65 6c 65 74 65 20 74 68 65 20 67 69 76  *.Delete the giv
4d00: 65 6e 20 6e 61 6d 65 73 70 61 63 65 27 73 20 63  en namespace's c
4d10: 6f 6d 6d 61 6e 64 20 6e 61 6d 65 20 72 65 73 6f  ommand name reso
4d20: 6c 75 74 69 6f 6e 20 70 61 74 68 2e 20 4f 6e 6c  lution path. Onl
4d30: 79 0a 2b 20 2a 09 63 61 6c 6c 20 69 66 20 74 68  y.+ *.call if th
4d40: 65 20 70 61 74 68 20 69 73 20 6e 6f 6e 2d 65 6d  e path is non-em
4d50: 70 74 79 2e 20 43 61 6c 6c 65 72 20 6d 75 73 74  pty. Caller must
4d60: 20 72 65 73 65 74 20 74 68 65 20 63 6f 75 6e 74   reset the count
4d70: 65 72 0a 2b 20 2a 09 63 6f 6e 74 61 69 6e 69 6e  er.+ *.containin
4d80: 67 20 74 68 65 20 70 61 74 68 20 73 69 7a 65 2e  g the path size.
4d90: 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 73  .+ *.+ * Results
4da0: 3a 0a 2b 20 2a 09 6e 6f 74 68 69 6e 67 0a 2b 20  :.+ *.nothing.+ 
4db0: 2a 0a 2b 20 2a 20 53 69 64 65 20 65 66 66 65 63  *.+ * Side effec
4dc0: 74 73 3a 0a 2b 20 2a 09 44 65 6c 65 74 65 73 20  ts:.+ *.Deletes 
4dd0: 74 68 65 20 61 72 72 61 79 20 6f 66 20 70 61 74  the array of pat
4de0: 68 20 65 6e 74 72 69 65 73 20 61 6e 64 20 75 6e  h entries and un
4df0: 6c 69 6e 6b 73 20 74 68 6f 73 65 20 70 61 74 68  links those path
4e00: 20 65 6e 74 72 69 65 73 0a 2b 20 2a 09 66 72 6f   entries.+ *.fro
4e10: 6d 20 74 68 65 20 74 61 72 67 65 74 20 6e 61 6d  m the target nam
4e20: 65 73 70 61 63 65 27 73 20 6c 69 73 74 20 6f 66  espace's list of
4e30: 20 69 6e 74 65 72 65 73 74 65 64 20 6e 61 6d 65   interested name
4e40: 73 70 61 63 65 73 2e 0a 2b 20 2a 0a 2b 20 2a 2d  spaces..+ *.+ *-
4e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e90: 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74  -----.+ */.+.+st
4ea0: 61 74 69 63 20 76 6f 69 64 0a 2b 55 6e 6c 69 6e  atic void.+Unlin
4eb0: 6b 4e 73 50 61 74 68 28 6e 73 50 74 72 29 0a 2b  kNsPath(nsPtr).+
4ec0: 20 20 20 20 4e 61 6d 65 73 70 61 63 65 20 2a 6e      Namespace *n
4ed0: 73 50 74 72 3b 0a 2b 7b 0a 2b 20 20 20 20 69 6e  sPtr;.+{.+    in
4ee0: 74 20 69 3b 0a 2b 20 20 20 20 66 6f 72 20 28 69  t i;.+    for (i
4ef0: 3d 30 20 3b 20 69 3c 6e 73 50 74 72 2d 3e 63 6f  =0 ; i<nsPtr->co
4f00: 6d 6d 61 6e 64 50 61 74 68 4c 65 6e 67 74 68 20  mmandPathLength 
4f10: 3b 20 69 2b 2b 29 20 7b 0a 2b 09 4e 61 6d 65 73  ; i++) {.+.Names
4f20: 70 61 63 65 50 61 74 68 45 6e 74 72 79 20 2a 6e  pacePathEntry *n
4f30: 73 50 61 74 68 50 74 72 20 3d 20 26 6e 73 50 74  sPathPtr = &nsPt
4f40: 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68 41 72  r->commandPathAr
4f50: 72 61 79 5b 69 5d 3b 0a 2b 09 69 66 20 28 6e 73  ray[i];.+.if (ns
4f60: 50 61 74 68 50 74 72 2d 3e 70 72 65 76 50 74 72  PathPtr->prevPtr
4f70: 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 20 20   != NULL) {.+.  
4f80: 20 20 6e 73 50 61 74 68 50 74 72 2d 3e 70 72 65    nsPathPtr->pre
4f90: 76 50 74 72 2d 3e 6e 65 78 74 50 74 72 20 3d 20  vPtr->nextPtr = 
4fa0: 6e 73 50 61 74 68 50 74 72 2d 3e 6e 65 78 74 50  nsPathPtr->nextP
4fb0: 74 72 3b 0a 2b 09 7d 0a 2b 09 69 66 20 28 6e 73  tr;.+.}.+.if (ns
4fc0: 50 61 74 68 50 74 72 2d 3e 6e 65 78 74 50 74 72  PathPtr->nextPtr
4fd0: 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 20 20   != NULL) {.+.  
4fe0: 20 20 6e 73 50 61 74 68 50 74 72 2d 3e 6e 65 78    nsPathPtr->nex
4ff0: 74 50 74 72 2d 3e 70 72 65 76 50 74 72 20 3d 20  tPtr->prevPtr = 
5000: 6e 73 50 61 74 68 50 74 72 2d 3e 70 72 65 76 50  nsPathPtr->prevP
5010: 74 72 3b 0a 2b 09 7d 0a 2b 09 69 66 20 28 6e 73  tr;.+.}.+.if (ns
5020: 50 61 74 68 50 74 72 2d 3e 6e 73 50 74 72 20 21  PathPtr->nsPtr !
5030: 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 20 20 20 20  = NULL) {.+.    
5040: 69 66 20 28 6e 73 50 61 74 68 50 74 72 2d 3e 6e  if (nsPathPtr->n
5050: 73 50 74 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74  sPtr->commandPat
5060: 68 53 6f 75 72 63 65 4c 69 73 74 20 3d 3d 20 6e  hSourceList == n
5070: 73 50 61 74 68 50 74 72 29 20 7b 0a 2b 09 09 6e  sPathPtr) {.+..n
5080: 73 50 61 74 68 50 74 72 2d 3e 6e 73 50 74 72 2d  sPathPtr->nsPtr-
5090: 3e 63 6f 6d 6d 61 6e 64 50 61 74 68 53 6f 75 72  >commandPathSour
50a0: 63 65 4c 69 73 74 20 3d 20 6e 73 50 61 74 68 50  ceList = nsPathP
50b0: 74 72 2d 3e 6e 65 78 74 50 74 72 3b 0a 2b 09 20  tr->nextPtr;.+. 
50c0: 20 20 20 7d 0a 2b 09 7d 0a 2b 20 20 20 20 7d 0a     }.+.}.+    }.
50d0: 2b 20 20 20 20 63 6b 66 72 65 65 28 28 63 68 61  +    ckfree((cha
50e0: 72 20 2a 29 20 6e 73 50 74 72 2d 3e 63 6f 6d 6d  r *) nsPtr->comm
50f0: 61 6e 64 50 61 74 68 41 72 72 61 79 29 3b 0a 2b  andPathArray);.+
5100: 7d 0a 2b 0c 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d  }.+..+/*.+ *----
5110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5120: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5150: 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 54 63 6c 49 6e  --.+ *.+ * TclIn
5160: 76 61 6c 69 64 61 74 65 4e 73 50 61 74 68 20 2d  validateNsPath -
5170: 2d 0a 2b 20 2a 0a 2b 20 2a 09 49 6e 76 61 6c 69  -.+ *.+ *.Invali
5180: 64 61 74 65 20 74 68 65 20 6e 61 6d 65 20 72 65  date the name re
5190: 73 6f 6c 75 74 69 6f 6e 20 63 61 63 68 65 73 20  solution caches 
51a0: 66 6f 72 20 61 6c 6c 20 6e 61 6d 65 73 20 6c 6f  for all names lo
51b0: 6f 6b 65 64 20 75 70 0a 2b 20 2a 09 69 6e 20 6e  oked up.+ *.in n
51c0: 61 6d 65 73 70 61 63 65 73 20 77 68 6f 73 65 20  amespaces whose 
51d0: 6e 61 6d 65 20 70 61 74 68 20 69 6e 63 6c 75 64  name path includ
51e0: 65 73 20 74 68 65 20 67 69 76 65 6e 20 6e 61 6d  es the given nam
51f0: 65 73 70 61 63 65 2e 0a 2b 20 2a 0a 2b 20 2a 20  espace..+ *.+ * 
5200: 52 65 73 75 6c 74 73 3a 0a 2b 20 2a 09 6e 6f 74  Results:.+ *.not
5210: 68 69 6e 67 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64  hing.+ *.+ * Sid
5220: 65 20 65 66 66 65 63 74 73 3a 0a 2b 20 2a 09 49  e effects:.+ *.I
5230: 6e 63 72 65 6d 65 6e 74 73 20 74 68 65 20 63 6f  ncrements the co
5240: 6d 6d 61 6e 64 20 72 65 66 65 72 65 6e 63 65 20  mmand reference 
5250: 65 70 6f 63 68 20 69 6e 20 65 61 63 68 20 6e 61  epoch in each na
5260: 6d 65 73 70 61 63 65 20 77 68 6f 73 65 0a 2b 20  mespace whose.+ 
5270: 2a 09 70 61 74 68 20 69 6e 63 6c 75 64 65 73 20  *.path includes 
5280: 74 68 65 20 67 69 76 65 6e 20 6e 61 6d 65 73 70  the given namesp
5290: 61 63 65 2e 20 54 68 69 73 20 63 61 75 73 65 73  ace. This causes
52a0: 20 61 6e 79 20 63 61 63 68 65 64 0a 2b 20 2a 09   any cached.+ *.
52b0: 72 65 73 6f 6c 76 65 64 20 6e 61 6d 65 73 20 77  resolved names w
52c0: 68 6f 73 65 20 72 6f 6f 74 20 63 61 63 68 65 69  hose root cachei
52d0: 6e 67 20 63 6f 6e 74 65 78 74 20 73 74 61 72 74  ng context start
52e0: 73 20 61 74 20 74 68 61 74 0a 2b 20 2a 09 6e 61  s at that.+ *.na
52f0: 6d 65 73 70 61 63 65 20 74 6f 20 62 65 20 72 65  mespace to be re
5300: 63 6f 6d 70 75 74 65 64 20 74 68 65 20 6e 65 78  computed the nex
5310: 74 20 74 69 6d 65 20 74 68 65 79 20 61 72 65 20  t time they are 
5320: 75 73 65 64 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d  used..+ *.+ *---
5330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5360: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5370: 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 76 6f 69 64  ---.+ */.+.+void
5380: 0a 2b 54 63 6c 49 6e 76 61 6c 69 64 61 74 65 4e  .+TclInvalidateN
5390: 73 50 61 74 68 28 6e 73 50 74 72 29 0a 2b 20 20  sPath(nsPtr).+  
53a0: 20 20 4e 61 6d 65 73 70 61 63 65 20 2a 6e 73 50    Namespace *nsP
53b0: 74 72 3b 0a 2b 7b 0a 2b 20 20 20 20 4e 61 6d 65  tr;.+{.+    Name
53c0: 73 70 61 63 65 50 61 74 68 45 6e 74 72 79 20 2a  spacePathEntry *
53d0: 6e 73 50 61 74 68 50 74 72 20 3d 20 6e 73 50 74  nsPathPtr = nsPt
53e0: 72 2d 3e 63 6f 6d 6d 61 6e 64 50 61 74 68 53 6f  r->commandPathSo
53f0: 75 72 63 65 4c 69 73 74 3b 0a 2b 20 20 20 20 77  urceList;.+    w
5400: 68 69 6c 65 20 28 6e 73 50 61 74 68 50 74 72 20  hile (nsPathPtr 
5410: 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 69 66 20  != NULL) {.+.if 
5420: 28 6e 73 50 61 74 68 50 74 72 2d 3e 6e 73 50 74  (nsPathPtr->nsPt
5430: 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 20  r != NULL) {.+. 
5440: 20 20 20 6e 73 50 61 74 68 50 74 72 2d 3e 63 72     nsPathPtr->cr
5450: 65 61 74 6f 72 4e 73 50 74 72 2d 3e 63 6d 64 52  eatorNsPtr->cmdR
5460: 65 66 45 70 6f 63 68 2b 2b 3b 0a 2b 09 7d 0a 2b  efEpoch++;.+.}.+
5470: 09 6e 73 50 61 74 68 50 74 72 20 3d 20 6e 73 50  .nsPathPtr = nsP
5480: 61 74 68 50 74 72 2d 3e 6e 65 78 74 50 74 72 3b  athPtr->nextPtr;
5490: 0a 2b 20 20 20 20 7d 0a 2b 7d 0a 2b 0c 0a 2b 2f  .+    }.+}.+..+/
54a0: 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *.+ *-----------
54b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a  -----------.+ *.
54f0: 20 20 2a 20 4e 61 6d 65 73 70 61 63 65 51 75 61    * NamespaceQua
5500: 6c 69 66 69 65 72 73 43 6d 64 20 2d 2d 0a 20 20  lifiersCmd --.  
5510: 2a 0a 20 20 2a 09 49 6e 76 6f 6b 65 64 20 74 6f  *.  *.Invoked to
5520: 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 22   implement the "
5530: 6e 61 6d 65 73 70 61 63 65 20 71 75 61 6c 69 66  namespace qualif
5540: 69 65 72 73 22 20 63 6f 6d 6d 61 6e 64 20 74 68  iers" command th
5550: 61 74 20 72 65 74 75 72 6e 73 0a 49 6e 64 65 78  at returns.Index
5560: 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c 52 65 73  : generic/tclRes
5570: 6f 6c 76 65 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d  olve.c.=========
5580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
55a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
55b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66  ==========.RCS f
55c0: 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63  ile: /cvsroot/tc
55d0: 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63  l/tcl/generic/tc
55e0: 6c 52 65 73 6f 6c 76 65 2e 63 2c 76 0a 72 65 74  lResolve.c,v.ret
55f0: 72 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e  rieving revision
5600: 20 31 2e 34 0a 64 69 66 66 20 2d 75 20 2d 72 31   1.4.diff -u -r1
5610: 2e 34 20 74 63 6c 52 65 73 6f 6c 76 65 2e 63 0a  .4 tclResolve.c.
5620: 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c 52  --- generic/tclR
5630: 65 73 6f 6c 76 65 2e 63 09 32 35 20 4a 61 6e 20  esolve.c.25 Jan 
5640: 32 30 30 32 20 32 32 3a 30 31 3a 33 32 20 2d 30  2002 22:01:32 -0
5650: 30 30 30 09 31 2e 34 0a 2b 2b 2b 20 67 65 6e 65  000.1.4.+++ gene
5660: 72 69 63 2f 74 63 6c 52 65 73 6f 6c 76 65 2e 63  ric/tclResolve.c
5670: 09 32 30 20 4d 61 79 20 32 30 30 35 20 31 35 3a  .20 May 2005 15:
5680: 32 35 3a 30 34 20 2d 30 30 30 30 0a 40 40 20 2d  25:04 -0000.@@ -
5690: 32 37 33 2c 36 20 2b 32 37 33 2c 37 20 40 40 0a  273,6 +273,7 @@.
56a0: 20 20 20 20 20 20 20 20 20 63 68 69 6c 64 4e 73           childNs
56b0: 50 74 72 20 3d 20 28 4e 61 6d 65 73 70 61 63 65  Ptr = (Namespace
56c0: 20 2a 29 20 54 63 6c 5f 47 65 74 48 61 73 68 56   *) Tcl_GetHashV
56d0: 61 6c 75 65 28 65 6e 74 72 79 29 3b 0a 20 20 20  alue(entry);.   
56e0: 20 20 20 20 20 20 42 75 6d 70 43 6d 64 52 65 66        BumpCmdRef
56f0: 45 70 6f 63 68 73 28 63 68 69 6c 64 4e 73 50 74  Epochs(childNsPt
5700: 72 29 3b 0a 20 20 20 20 20 7d 0a 2b 20 20 20 20  r);.     }.+    
5710: 54 63 6c 49 6e 76 61 6c 69 64 61 74 65 4e 73 50  TclInvalidateNsP
5720: 61 74 68 28 6e 73 50 74 72 29 3b 0a 20 7d 0a 20  ath(nsPtr);. }. 
5730: 0a 20 0c 0a 40 40 20 2d 33 36 39 2c 36 20 2b 33  . ..@@ -369,6 +3
5740: 37 30 2c 37 20 40 40 0a 20 0a 20 20 20 20 20 6e  70,7 @@. .     n
5750: 73 50 74 72 2d 3e 63 6d 64 52 65 66 45 70 6f 63  sPtr->cmdRefEpoc
5760: 68 2b 2b 3b 0a 20 20 20 20 20 6e 73 50 74 72 2d  h++;.     nsPtr-
5770: 3e 72 65 73 6f 6c 76 65 72 45 70 6f 63 68 2b 2b  >resolverEpoch++
5780: 3b 0a 2b 20 20 20 20 54 63 6c 49 6e 76 61 6c 69  ;.+    TclInvali
5790: 64 61 74 65 4e 73 50 61 74 68 28 6e 73 50 74 72  dateNsPath(nsPtr
57a0: 29 3b 0a 20 7d 0a 20 0c 0a 20 2f 2a 0a 49 6e 64  );. }. .. /*.Ind
57b0: 65 78 3a 20 74 65 73 74 73 2f 6e 61 6d 65 73 70  ex: tests/namesp
57c0: 61 63 65 2e 74 65 73 74 0a 3d 3d 3d 3d 3d 3d 3d  ace.test.=======
57d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
57e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
57f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5800: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53  ============.RCS
5810: 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f   file: /cvsroot/
5820: 74 63 6c 2f 74 63 6c 2f 74 65 73 74 73 2f 6e 61  tcl/tcl/tests/na
5830: 6d 65 73 70 61 63 65 2e 74 65 73 74 2c 76 0a 72  mespace.test,v.r
5840: 65 74 72 69 65 76 69 6e 67 20 72 65 76 69 73 69  etrieving revisi
5850: 6f 6e 20 31 2e 34 33 0a 64 69 66 66 20 2d 75 20  on 1.43.diff -u 
5860: 2d 72 31 2e 34 33 20 6e 61 6d 65 73 70 61 63 65  -r1.43 namespace
5870: 2e 74 65 73 74 0a 2d 2d 2d 20 74 65 73 74 73 2f  .test.--- tests/
5880: 6e 61 6d 65 73 70 61 63 65 2e 74 65 73 74 09 32  namespace.test.2
5890: 39 20 4f 63 74 20 32 30 30 34 20 31 35 3a 33 39  9 Oct 2004 15:39
58a0: 3a 31 30 20 2d 30 30 30 30 09 31 2e 34 33 0a 2b  :10 -0000.1.43.+
58b0: 2b 2b 20 74 65 73 74 73 2f 6e 61 6d 65 73 70 61  ++ tests/namespa
58c0: 63 65 2e 74 65 73 74 09 32 30 20 4d 61 79 20 32  ce.test.20 May 2
58d0: 30 30 35 20 31 35 3a 32 35 3a 30 37 20 2d 30 30  005 15:25:07 -00
58e0: 30 30 0a 40 40 20 2d 38 33 38 2c 37 20 2b 38 33  00.@@ -838,7 +83
58f0: 38 2c 37 20 40 40 0a 20 7d 20 7b 31 20 7b 77 72  8,7 @@. } {1 {wr
5900: 6f 6e 67 20 23 20 61 72 67 73 3a 20 73 68 6f 75  ong # args: shou
5910: 6c 64 20 62 65 20 22 6e 61 6d 65 73 70 61 63 65  ld be "namespace
5920: 20 73 75 62 63 6f 6d 6d 61 6e 64 20 3f 61 72 67   subcommand ?arg
5930: 20 2e 2e 2e 3f 22 7d 7d 0a 20 74 65 73 74 20 6e   ...?"}}. test n
5940: 61 6d 65 73 70 61 63 65 2d 32 30 2e 32 20 7b 54  amespace-20.2 {T
5950: 63 6c 5f 4e 61 6d 65 73 70 61 63 65 4f 62 6a 43  cl_NamespaceObjC
5960: 6d 64 2c 20 62 61 64 20 73 75 62 63 6f 6d 6d 61  md, bad subcomma
5970: 6e 64 7d 20 7b 0a 20 20 20 20 20 6c 69 73 74 20  nd} {.     list 
5980: 5b 63 61 74 63 68 20 7b 6e 61 6d 65 73 70 61 63  [catch {namespac
5990: 65 20 77 6f 6d 62 61 74 20 7b 7d 7d 20 6d 73 67  e wombat {}} msg
59a0: 5d 20 24 6d 73 67 0a 2d 7d 20 7b 31 20 7b 62 61  ] $msg.-} {1 {ba
59b0: 64 20 6f 70 74 69 6f 6e 20 22 77 6f 6d 62 61 74  d option "wombat
59c0: 22 3a 20 6d 75 73 74 20 62 65 20 63 68 69 6c 64  ": must be child
59d0: 72 65 6e 2c 20 63 6f 64 65 2c 20 63 75 72 72 65  ren, code, curre
59e0: 6e 74 2c 20 64 65 6c 65 74 65 2c 20 65 6e 73 65  nt, delete, ense
59f0: 6d 62 6c 65 2c 20 65 76 61 6c 2c 20 65 78 69 73  mble, eval, exis
5a00: 74 73 2c 20 65 78 70 6f 72 74 2c 20 66 6f 72 67  ts, export, forg
5a10: 65 74 2c 20 69 6d 70 6f 72 74 2c 20 69 6e 73 63  et, import, insc
5a20: 6f 70 65 2c 20 6f 72 69 67 69 6e 2c 20 70 61 72  ope, origin, par
5a30: 65 6e 74 2c 20 71 75 61 6c 69 66 69 65 72 73 2c  ent, qualifiers,
5a40: 20 74 61 69 6c 2c 20 6f 72 20 77 68 69 63 68 7d   tail, or which}
5a50: 7d 0a 2b 7d 20 7b 31 20 7b 62 61 64 20 6f 70 74  }.+} {1 {bad opt
5a60: 69 6f 6e 20 22 77 6f 6d 62 61 74 22 3a 20 6d 75  ion "wombat": mu
5a70: 73 74 20 62 65 20 63 68 69 6c 64 72 65 6e 2c 20  st be children, 
5a80: 63 6f 64 65 2c 20 63 75 72 72 65 6e 74 2c 20 64  code, current, d
5a90: 65 6c 65 74 65 2c 20 65 6e 73 65 6d 62 6c 65 2c  elete, ensemble,
5aa0: 20 65 76 61 6c 2c 20 65 78 69 73 74 73 2c 20 65   eval, exists, e
5ab0: 78 70 6f 72 74 2c 20 66 6f 72 67 65 74 2c 20 69  xport, forget, i
5ac0: 6d 70 6f 72 74 2c 20 69 6e 73 63 6f 70 65 2c 20  mport, inscope, 
5ad0: 6f 72 69 67 69 6e 2c 20 70 61 72 65 6e 74 2c 20  origin, parent, 
5ae0: 70 61 74 68 2c 20 71 75 61 6c 69 66 69 65 72 73  path, qualifiers
5af0: 2c 20 74 61 69 6c 2c 20 6f 72 20 77 68 69 63 68  , tail, or which
5b00: 7d 7d 0a 20 74 65 73 74 20 6e 61 6d 65 73 70 61  }}. test namespa
5b10: 63 65 2d 32 30 2e 33 20 7b 54 63 6c 5f 4e 61 6d  ce-20.3 {Tcl_Nam
5b20: 65 73 70 61 63 65 4f 62 6a 43 6d 64 2c 20 61 62  espaceObjCmd, ab
5b30: 62 72 65 76 69 61 74 69 6f 6e 73 20 61 72 65 20  breviations are 
5b40: 6f 6b 61 79 7d 20 7b 0a 20 20 20 20 20 6e 61 6d  okay} {.     nam
5b50: 65 73 70 61 63 65 20 63 68 20 3a 3a 20 74 65 73  espace ch :: tes
5b60: 74 5f 6e 73 5f 2a 0a 20 7d 20 7b 7d 0a 40 40 20  t_ns_*. } {}.@@ 
5b70: 2d 39 34 35 2c 37 20 2b 39 34 35 2c 37 20 40 40  -945,7 +945,7 @@
5b80: 0a 20 7d 20 7b 31 20 7b 77 72 6f 6e 67 20 23 20  . } {1 {wrong # 
5b90: 61 72 67 73 3a 20 73 68 6f 75 6c 64 20 62 65 20  args: should be 
5ba0: 22 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20  "namespace eval 
5bb0: 6e 61 6d 65 20 61 72 67 20 3f 61 72 67 2e 2e 2e  name arg ?arg...
5bc0: 3f 22 7d 7d 0a 20 74 65 73 74 20 6e 61 6d 65 73  ?"}}. test names
5bd0: 70 61 63 65 2d 32 35 2e 32 20 7b 4e 61 6d 65 73  pace-25.2 {Names
5be0: 70 61 63 65 45 76 61 6c 43 6d 64 2c 20 62 61 64  paceEvalCmd, bad
5bf0: 20 61 72 67 73 7d 20 7b 0a 20 20 20 20 20 6c 69   args} {.     li
5c00: 73 74 20 5b 63 61 74 63 68 20 7b 6e 61 6d 65 73  st [catch {names
5c10: 70 61 63 65 20 74 65 73 74 5f 6e 73 5f 31 7d 20  pace test_ns_1} 
5c20: 6d 73 67 5d 20 24 6d 73 67 0a 2d 7d 20 7b 31 20  msg] $msg.-} {1 
5c30: 7b 62 61 64 20 6f 70 74 69 6f 6e 20 22 74 65 73  {bad option "tes
5c40: 74 5f 6e 73 5f 31 22 3a 20 6d 75 73 74 20 62 65  t_ns_1": must be
5c50: 20 63 68 69 6c 64 72 65 6e 2c 20 63 6f 64 65 2c   children, code,
5c60: 20 63 75 72 72 65 6e 74 2c 20 64 65 6c 65 74 65   current, delete
5c70: 2c 20 65 6e 73 65 6d 62 6c 65 2c 20 65 76 61 6c  , ensemble, eval
5c80: 2c 20 65 78 69 73 74 73 2c 20 65 78 70 6f 72 74  , exists, export
5c90: 2c 20 66 6f 72 67 65 74 2c 20 69 6d 70 6f 72 74  , forget, import
5ca0: 2c 20 69 6e 73 63 6f 70 65 2c 20 6f 72 69 67 69  , inscope, origi
5cb0: 6e 2c 20 70 61 72 65 6e 74 2c 20 71 75 61 6c 69  n, parent, quali
5cc0: 66 69 65 72 73 2c 20 74 61 69 6c 2c 20 6f 72 20  fiers, tail, or 
5cd0: 77 68 69 63 68 7d 7d 0a 2b 7d 20 7b 31 20 7b 62  which}}.+} {1 {b
5ce0: 61 64 20 6f 70 74 69 6f 6e 20 22 74 65 73 74 5f  ad option "test_
5cf0: 6e 73 5f 31 22 3a 20 6d 75 73 74 20 62 65 20 63  ns_1": must be c
5d00: 68 69 6c 64 72 65 6e 2c 20 63 6f 64 65 2c 20 63  hildren, code, c
5d10: 75 72 72 65 6e 74 2c 20 64 65 6c 65 74 65 2c 20  urrent, delete, 
5d20: 65 6e 73 65 6d 62 6c 65 2c 20 65 76 61 6c 2c 20  ensemble, eval, 
5d30: 65 78 69 73 74 73 2c 20 65 78 70 6f 72 74 2c 20  exists, export, 
5d40: 66 6f 72 67 65 74 2c 20 69 6d 70 6f 72 74 2c 20  forget, import, 
5d50: 69 6e 73 63 6f 70 65 2c 20 6f 72 69 67 69 6e 2c  inscope, origin,
5d60: 20 70 61 72 65 6e 74 2c 20 70 61 74 68 2c 20 71   parent, path, q
5d70: 75 61 6c 69 66 69 65 72 73 2c 20 74 61 69 6c 2c  ualifiers, tail,
5d80: 20 6f 72 20 77 68 69 63 68 7d 7d 0a 20 63 61 74   or which}}. cat
5d90: 63 68 20 7b 75 6e 73 65 74 20 76 7d 0a 20 74 65  ch {unset v}. te
5da0: 73 74 20 6e 61 6d 65 73 70 61 63 65 2d 32 35 2e  st namespace-25.
5db0: 33 20 7b 4e 61 6d 65 73 70 61 63 65 45 76 61 6c  3 {NamespaceEval
5dc0: 43 6d 64 2c 20 6e 65 77 20 6e 61 6d 65 73 70 61  Cmd, new namespa
5dd0: 63 65 7d 20 7b 0a 20 20 20 20 20 73 65 74 20 76  ce} {.     set v
5de0: 20 31 32 33 0a 40 40 20 2d 31 39 35 36 2c 36 20   123.@@ -1956,6 
5df0: 2b 31 39 35 36 2c 33 38 39 20 40 40 0a 20 20 20  +1956,389 @@.   
5e00: 20 20 72 65 6e 61 6d 65 20 61 20 7b 7d 0a 20 7d    rename a {}. }
5e10: 0a 20 0a 2b 74 65 73 74 20 6e 61 6d 65 73 70 61  . .+test namespa
5e20: 63 65 2d 35 31 2e 31 20 7b 6e 61 6d 65 20 72 65  ce-51.1 {name re
5e30: 73 6f 6c 75 74 69 6f 6e 20 70 61 74 68 20 63 6f  solution path co
5e40: 6e 74 72 6f 6c 7d 20 2d 62 6f 64 79 20 7b 0a 2b  ntrol} -body {.+
5e50: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76      namespace ev
5e60: 61 6c 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 20 7b  al ::test_ns_1 {
5e70: 0a 2b 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61  .+.namespace eva
5e80: 6c 20 74 65 73 74 5f 6e 73 5f 32 20 7b 0a 2b 09  l test_ns_2 {.+.
5e90: 20 20 20 20 70 72 6f 63 20 70 61 74 68 74 65 73      proc pathtes
5ea0: 74 41 20 7b 7d 20 7b 0a 2b 09 09 3a 3a 72 65 74  tA {} {.+..::ret
5eb0: 75 72 6e 20 5b 70 61 74 68 74 65 73 74 42 5d 2c  urn [pathtestB],
5ec0: 5b 70 61 74 68 74 65 73 74 43 5d 2c 5b 70 61 74  [pathtestC],[pat
5ed0: 68 74 65 73 74 44 5d 2c 5b 6e 61 6d 65 73 70 61  htestD],[namespa
5ee0: 63 65 20 70 61 74 68 5d 0a 2b 09 20 20 20 20 7d  ce path].+.    }
5ef0: 0a 2b 09 20 20 20 20 70 72 6f 63 20 70 61 74 68  .+.    proc path
5f00: 74 65 73 74 43 20 7b 7d 20 7b 0a 2b 09 09 3a 3a  testC {} {.+..::
5f10: 72 65 74 75 72 6e 20 32 0a 2b 09 20 20 20 20 7d  return 2.+.    }
5f20: 0a 2b 09 7d 0a 2b 09 70 72 6f 63 20 70 61 74 68  .+.}.+.proc path
5f30: 74 65 73 74 42 20 7b 7d 20 7b 0a 2b 09 20 20 20  testB {} {.+.   
5f40: 20 72 65 74 75 72 6e 20 31 0a 2b 09 7d 0a 2b 09   return 1.+.}.+.
5f50: 70 72 6f 63 20 70 61 74 68 74 65 73 74 43 20 7b  proc pathtestC {
5f60: 7d 20 7b 0a 2b 09 20 20 20 20 72 65 74 75 72 6e  } {.+.    return
5f70: 20 31 0a 2b 09 7d 0a 2b 09 6e 61 6d 65 73 70 61   1.+.}.+.namespa
5f80: 63 65 20 70 61 74 68 20 3a 3a 74 65 73 74 5f 6e  ce path ::test_n
5f90: 73 5f 31 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20  s_1.+    }.+    
5fa0: 70 72 6f 63 20 3a 3a 70 61 74 68 74 65 73 74 42  proc ::pathtestB
5fb0: 20 7b 7d 20 7b 0a 2b 09 72 65 74 75 72 6e 20 67   {} {.+.return g
5fc0: 6c 6f 62 61 6c 0a 2b 20 20 20 20 7d 0a 2b 20 20  lobal.+    }.+  
5fd0: 20 20 70 72 6f 63 20 3a 3a 70 61 74 68 74 65 73    proc ::pathtes
5fe0: 74 44 20 7b 7d 20 7b 0a 2b 09 72 65 74 75 72 6e  tD {} {.+.return
5ff0: 20 67 6c 6f 62 61 6c 0a 2b 20 20 20 20 7d 0a 2b   global.+    }.+
6000: 20 20 20 20 74 65 73 74 5f 6e 73 5f 31 3a 3a 74      test_ns_1::t
6010: 65 73 74 5f 6e 73 5f 32 3a 3a 70 61 74 68 74 65  est_ns_2::pathte
6020: 73 74 41 0a 2b 7d 20 2d 72 65 73 75 6c 74 20 22  stA.+} -result "
6030: 67 6c 6f 62 61 6c 2c 32 2c 67 6c 6f 62 61 6c 2c  global,2,global,
6040: 22 20 2d 63 6c 65 61 6e 75 70 20 7b 0a 2b 20 20  " -cleanup {.+  
6050: 20 20 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65    namespace dele
6060: 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 0a 2b  te ::test_ns_1.+
6070: 20 20 20 20 63 61 74 63 68 20 7b 72 65 6e 61 6d      catch {renam
6080: 65 20 3a 3a 70 61 74 68 74 65 73 74 42 20 7b 7d  e ::pathtestB {}
6090: 7d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 72 65  }.+    catch {re
60a0: 6e 61 6d 65 20 3a 3a 70 61 74 68 74 65 73 74 44  name ::pathtestD
60b0: 20 7b 7d 7d 0a 2b 7d 0a 2b 74 65 73 74 20 6e 61   {}}.+}.+test na
60c0: 6d 65 73 70 61 63 65 2d 35 31 2e 32 20 7b 6e 61  mespace-51.2 {na
60d0: 6d 65 20 72 65 73 6f 6c 75 74 69 6f 6e 20 70 61  me resolution pa
60e0: 74 68 20 63 6f 6e 74 72 6f 6c 7d 20 2d 62 6f 64  th control} -bod
60f0: 79 20 7b 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61  y {.+    namespa
6100: 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e  ce eval ::test_n
6110: 73 5f 31 20 7b 0a 2b 09 6e 61 6d 65 73 70 61 63  s_1 {.+.namespac
6120: 65 20 65 76 61 6c 20 74 65 73 74 5f 6e 73 5f 32  e eval test_ns_2
6130: 20 7b 0a 2b 09 20 20 20 20 6e 61 6d 65 73 70 61   {.+.    namespa
6140: 63 65 20 70 61 74 68 20 3a 3a 74 65 73 74 5f 6e  ce path ::test_n
6150: 73 5f 31 0a 2b 09 20 20 20 20 70 72 6f 63 20 70  s_1.+.    proc p
6160: 61 74 68 74 65 73 74 41 20 7b 7d 20 7b 0a 2b 09  athtestA {} {.+.
6170: 09 3a 3a 72 65 74 75 72 6e 20 5b 70 61 74 68 74  .::return [patht
6180: 65 73 74 42 5d 2c 5b 70 61 74 68 74 65 73 74 43  estB],[pathtestC
6190: 5d 2c 5b 70 61 74 68 74 65 73 74 44 5d 2c 5b 6e  ],[pathtestD],[n
61a0: 61 6d 65 73 70 61 63 65 20 70 61 74 68 5d 0a 2b  amespace path].+
61b0: 09 20 20 20 20 7d 0a 2b 09 20 20 20 20 70 72 6f  .    }.+.    pro
61c0: 63 20 70 61 74 68 74 65 73 74 43 20 7b 7d 20 7b  c pathtestC {} {
61d0: 0a 2b 09 09 3a 3a 72 65 74 75 72 6e 20 32 0a 2b  .+..::return 2.+
61e0: 09 20 20 20 20 7d 0a 2b 09 7d 0a 2b 09 70 72 6f  .    }.+.}.+.pro
61f0: 63 20 70 61 74 68 74 65 73 74 42 20 7b 7d 20 7b  c pathtestB {} {
6200: 0a 2b 09 20 20 20 20 72 65 74 75 72 6e 20 31 0a  .+.    return 1.
6210: 2b 09 7d 0a 2b 09 70 72 6f 63 20 70 61 74 68 74  +.}.+.proc patht
6220: 65 73 74 43 20 7b 7d 20 7b 0a 2b 09 20 20 20 20  estC {} {.+.    
6230: 72 65 74 75 72 6e 20 31 0a 2b 09 7d 0a 2b 20 20  return 1.+.}.+  
6240: 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63 20 3a 3a    }.+    proc ::
6250: 70 61 74 68 74 65 73 74 42 20 7b 7d 20 7b 0a 2b  pathtestB {} {.+
6260: 09 72 65 74 75 72 6e 20 67 6c 6f 62 61 6c 0a 2b  .return global.+
6270: 20 20 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63 20      }.+    proc 
6280: 3a 3a 70 61 74 68 74 65 73 74 44 20 7b 7d 20 7b  ::pathtestD {} {
6290: 0a 2b 09 72 65 74 75 72 6e 20 67 6c 6f 62 61 6c  .+.return global
62a0: 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20 3a 3a 74  .+    }.+    ::t
62b0: 65 73 74 5f 6e 73 5f 31 3a 3a 74 65 73 74 5f 6e  est_ns_1::test_n
62c0: 73 5f 32 3a 3a 70 61 74 68 74 65 73 74 41 0a 2b  s_2::pathtestA.+
62d0: 7d 20 2d 72 65 73 75 6c 74 20 22 31 2c 32 2c 67  } -result "1,2,g
62e0: 6c 6f 62 61 6c 2c 3a 3a 74 65 73 74 5f 6e 73 5f  lobal,::test_ns_
62f0: 31 22 20 2d 63 6c 65 61 6e 75 70 20 7b 0a 2b 20  1" -cleanup {.+ 
6300: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 64 65 6c     namespace del
6310: 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 0a  ete ::test_ns_1.
6320: 2b 20 20 20 20 63 61 74 63 68 20 7b 72 65 6e 61  +    catch {rena
6330: 6d 65 20 3a 3a 70 61 74 68 74 65 73 74 42 20 7b  me ::pathtestB {
6340: 7d 7d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 72  }}.+    catch {r
6350: 65 6e 61 6d 65 20 3a 3a 70 61 74 68 74 65 73 74  ename ::pathtest
6360: 44 20 7b 7d 7d 0a 2b 7d 0a 2b 74 65 73 74 20 6e  D {}}.+}.+test n
6370: 61 6d 65 73 70 61 63 65 2d 35 31 2e 33 20 7b 6e  amespace-51.3 {n
6380: 61 6d 65 20 72 65 73 6f 6c 75 74 69 6f 6e 20 70  ame resolution p
6390: 61 74 68 20 63 6f 6e 74 72 6f 6c 7d 20 2d 62 6f  ath control} -bo
63a0: 64 79 20 7b 0a 2b 20 20 20 20 6e 61 6d 65 73 70  dy {.+    namesp
63b0: 61 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f  ace eval ::test_
63c0: 6e 73 5f 31 20 7b 0a 2b 09 6e 61 6d 65 73 70 61  ns_1 {.+.namespa
63d0: 63 65 20 65 76 61 6c 20 74 65 73 74 5f 6e 73 5f  ce eval test_ns_
63e0: 32 20 7b 0a 2b 09 20 20 20 20 70 72 6f 63 20 70  2 {.+.    proc p
63f0: 61 74 68 74 65 73 74 41 20 7b 7d 20 7b 0a 2b 09  athtestA {} {.+.
6400: 09 3a 3a 72 65 74 75 72 6e 20 5b 70 61 74 68 74  .::return [patht
6410: 65 73 74 42 5d 2c 5b 70 61 74 68 74 65 73 74 43  estB],[pathtestC
6420: 5d 2c 5b 70 61 74 68 74 65 73 74 44 5d 2c 5b 6e  ],[pathtestD],[n
6430: 61 6d 65 73 70 61 63 65 20 70 61 74 68 5d 0a 2b  amespace path].+
6440: 09 20 20 20 20 7d 0a 2b 09 20 20 20 20 70 72 6f  .    }.+.    pro
6450: 63 20 70 61 74 68 74 65 73 74 43 20 7b 7d 20 7b  c pathtestC {} {
6460: 0a 2b 09 09 3a 3a 72 65 74 75 72 6e 20 32 0a 2b  .+..::return 2.+
6470: 09 20 20 20 20 7d 0a 2b 09 7d 0a 2b 09 70 72 6f  .    }.+.}.+.pro
6480: 63 20 70 61 74 68 74 65 73 74 42 20 7b 7d 20 7b  c pathtestB {} {
6490: 0a 2b 09 20 20 20 20 72 65 74 75 72 6e 20 31 0a  .+.    return 1.
64a0: 2b 09 7d 0a 2b 09 70 72 6f 63 20 70 61 74 68 74  +.}.+.proc patht
64b0: 65 73 74 43 20 7b 7d 20 7b 0a 2b 09 20 20 20 20  estC {} {.+.    
64c0: 72 65 74 75 72 6e 20 31 0a 2b 09 7d 0a 2b 20 20  return 1.+.}.+  
64d0: 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63 20 3a 3a    }.+    proc ::
64e0: 70 61 74 68 74 65 73 74 42 20 7b 7d 20 7b 0a 2b  pathtestB {} {.+
64f0: 09 72 65 74 75 72 6e 20 67 6c 6f 62 61 6c 0a 2b  .return global.+
6500: 20 20 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63 20      }.+    proc 
6510: 3a 3a 70 61 74 68 74 65 73 74 44 20 7b 7d 20 7b  ::pathtestD {} {
6520: 0a 2b 09 72 65 74 75 72 6e 20 67 6c 6f 62 61 6c  .+.return global
6530: 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20 73 65 74  .+    }.+    set
6540: 20 72 65 73 75 6c 74 20 5b 3a 3a 74 65 73 74 5f   result [::test_
6550: 6e 73 5f 31 3a 3a 74 65 73 74 5f 6e 73 5f 32 3a  ns_1::test_ns_2:
6560: 3a 70 61 74 68 74 65 73 74 41 5d 0a 2b 20 20 20  :pathtestA].+   
6570: 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20   namespace eval 
6580: 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a 74 65 73  ::test_ns_1::tes
6590: 74 5f 6e 73 5f 32 20 7b 0a 2b 09 6e 61 6d 65 73  t_ns_2 {.+.names
65a0: 70 61 63 65 20 70 61 74 68 20 3a 3a 74 65 73 74  pace path ::test
65b0: 5f 6e 73 5f 31 0a 2b 20 20 20 20 7d 0a 2b 20 20  _ns_1.+    }.+  
65c0: 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74    lappend result
65d0: 20 5b 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a 74   [::test_ns_1::t
65e0: 65 73 74 5f 6e 73 5f 32 3a 3a 70 61 74 68 74 65  est_ns_2::pathte
65f0: 73 74 41 5d 0a 2b 20 20 20 20 72 65 6e 61 6d 65  stA].+    rename
6600: 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a 70 61   ::test_ns_1::pa
6610: 74 68 74 65 73 74 42 20 7b 7d 0a 2b 20 20 20 20  thtestB {}.+    
6620: 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 20 5b  lappend result [
6630: 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a 74 65 73  ::test_ns_1::tes
6640: 74 5f 6e 73 5f 32 3a 3a 70 61 74 68 74 65 73 74  t_ns_2::pathtest
6650: 41 5d 0a 2b 7d 20 2d 72 65 73 75 6c 74 20 22 67  A].+} -result "g
6660: 6c 6f 62 61 6c 2c 32 2c 67 6c 6f 62 61 6c 2c 20  lobal,2,global, 
6670: 31 2c 32 2c 67 6c 6f 62 61 6c 2c 3a 3a 74 65 73  1,2,global,::tes
6680: 74 5f 6e 73 5f 31 20 67 6c 6f 62 61 6c 2c 32 2c  t_ns_1 global,2,
6690: 67 6c 6f 62 61 6c 2c 3a 3a 74 65 73 74 5f 6e 73  global,::test_ns
66a0: 5f 31 22 20 2d 63 6c 65 61 6e 75 70 20 7b 0a 2b  _1" -cleanup {.+
66b0: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 64 65      namespace de
66c0: 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 31  lete ::test_ns_1
66d0: 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 72 65 6e  .+    catch {ren
66e0: 61 6d 65 20 3a 3a 70 61 74 68 74 65 73 74 42 20  ame ::pathtestB 
66f0: 7b 7d 7d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b  {}}.+    catch {
6700: 72 65 6e 61 6d 65 20 3a 3a 70 61 74 68 74 65 73  rename ::pathtes
6710: 74 44 20 7b 7d 7d 0a 2b 7d 0a 2b 74 65 73 74 20  tD {}}.+}.+test 
6720: 6e 61 6d 65 73 70 61 63 65 2d 35 31 2e 34 20 7b  namespace-51.4 {
6730: 6e 61 6d 65 20 72 65 73 6f 6c 75 74 69 6f 6e 20  name resolution 
6740: 70 61 74 68 20 63 6f 6e 74 72 6f 6c 7d 20 2d 62  path control} -b
6750: 6f 64 79 20 7b 0a 2b 20 20 20 20 6e 61 6d 65 73  ody {.+    names
6760: 70 61 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74  pace eval ::test
6770: 5f 6e 73 5f 31 20 7b 0a 2b 09 6e 61 6d 65 73 70  _ns_1 {.+.namesp
6780: 61 63 65 20 65 76 61 6c 20 74 65 73 74 5f 6e 73  ace eval test_ns
6790: 5f 32 20 7b 0a 2b 09 20 20 20 20 70 72 6f 63 20  _2 {.+.    proc 
67a0: 70 61 74 68 74 65 73 74 41 20 7b 7d 20 7b 0a 2b  pathtestA {} {.+
67b0: 09 09 3a 3a 72 65 74 75 72 6e 20 5b 70 61 74 68  ..::return [path
67c0: 74 65 73 74 42 5d 2c 5b 70 61 74 68 74 65 73 74  testB],[pathtest
67d0: 43 5d 2c 5b 70 61 74 68 74 65 73 74 44 5d 2c 5b  C],[pathtestD],[
67e0: 6e 61 6d 65 73 70 61 63 65 20 70 61 74 68 5d 0a  namespace path].
67f0: 2b 09 20 20 20 20 7d 0a 2b 09 20 20 20 20 70 72  +.    }.+.    pr
6800: 6f 63 20 70 61 74 68 74 65 73 74 43 20 7b 7d 20  oc pathtestC {} 
6810: 7b 0a 2b 09 09 3a 3a 72 65 74 75 72 6e 20 32 0a  {.+..::return 2.
6820: 2b 09 20 20 20 20 7d 0a 2b 09 7d 0a 2b 09 70 72  +.    }.+.}.+.pr
6830: 6f 63 20 70 61 74 68 74 65 73 74 42 20 7b 7d 20  oc pathtestB {} 
6840: 7b 0a 2b 09 20 20 20 20 72 65 74 75 72 6e 20 31  {.+.    return 1
6850: 0a 2b 09 7d 0a 2b 09 70 72 6f 63 20 70 61 74 68  .+.}.+.proc path
6860: 74 65 73 74 43 20 7b 7d 20 7b 0a 2b 09 20 20 20  testC {} {.+.   
6870: 20 72 65 74 75 72 6e 20 31 0a 2b 09 7d 0a 2b 20   return 1.+.}.+ 
6880: 20 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63 20 3a     }.+    proc :
6890: 3a 70 61 74 68 74 65 73 74 42 20 7b 7d 20 7b 0a  :pathtestB {} {.
68a0: 2b 09 72 65 74 75 72 6e 20 67 6c 6f 62 61 6c 0a  +.return global.
68b0: 2b 20 20 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63  +    }.+    proc
68c0: 20 3a 3a 70 61 74 68 74 65 73 74 44 20 7b 7d 20   ::pathtestD {} 
68d0: 7b 0a 2b 09 72 65 74 75 72 6e 20 67 6c 6f 62 61  {.+.return globa
68e0: 6c 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20 73 65  l.+    }.+    se
68f0: 74 20 72 65 73 75 6c 74 20 5b 3a 3a 74 65 73 74  t result [::test
6900: 5f 6e 73 5f 31 3a 3a 74 65 73 74 5f 6e 73 5f 32  _ns_1::test_ns_2
6910: 3a 3a 70 61 74 68 74 65 73 74 41 5d 0a 2b 20 20  ::pathtestA].+  
6920: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c    namespace eval
6930: 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a 74 65   ::test_ns_1::te
6940: 73 74 5f 6e 73 5f 32 20 7b 0a 2b 09 6e 61 6d 65  st_ns_2 {.+.name
6950: 73 70 61 63 65 20 70 61 74 68 20 3a 3a 74 65 73  space path ::tes
6960: 74 5f 6e 73 5f 31 0a 2b 20 20 20 20 7d 0a 2b 20  t_ns_1.+    }.+ 
6970: 20 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c     lappend resul
6980: 74 20 5b 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a  t [::test_ns_1::
6990: 74 65 73 74 5f 6e 73 5f 32 3a 3a 70 61 74 68 74  test_ns_2::patht
69a0: 65 73 74 41 5d 0a 2b 20 20 20 20 6e 61 6d 65 73  estA].+    names
69b0: 70 61 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74  pace eval ::test
69c0: 5f 6e 73 5f 31 3a 3a 74 65 73 74 5f 6e 73 5f 32  _ns_1::test_ns_2
69d0: 20 7b 0a 2b 09 6e 61 6d 65 73 70 61 63 65 20 70   {.+.namespace p
69e0: 61 74 68 20 7b 7d 0a 2b 20 20 20 20 7d 0a 2b 20  ath {}.+    }.+ 
69f0: 20 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c     lappend resul
6a00: 74 20 5b 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a  t [::test_ns_1::
6a10: 74 65 73 74 5f 6e 73 5f 32 3a 3a 70 61 74 68 74  test_ns_2::patht
6a20: 65 73 74 41 5d 0a 2b 7d 20 2d 72 65 73 75 6c 74  estA].+} -result
6a30: 20 22 67 6c 6f 62 61 6c 2c 32 2c 67 6c 6f 62 61   "global,2,globa
6a40: 6c 2c 20 31 2c 32 2c 67 6c 6f 62 61 6c 2c 3a 3a  l, 1,2,global,::
6a50: 74 65 73 74 5f 6e 73 5f 31 20 67 6c 6f 62 61 6c  test_ns_1 global
6a60: 2c 32 2c 67 6c 6f 62 61 6c 2c 22 20 2d 63 6c 65  ,2,global," -cle
6a70: 61 6e 75 70 20 7b 0a 2b 20 20 20 20 6e 61 6d 65  anup {.+    name
6a80: 73 70 61 63 65 20 64 65 6c 65 74 65 20 3a 3a 74  space delete ::t
6a90: 65 73 74 5f 6e 73 5f 31 0a 2b 20 20 20 20 63 61  est_ns_1.+    ca
6aa0: 74 63 68 20 7b 72 65 6e 61 6d 65 20 3a 3a 70 61  tch {rename ::pa
6ab0: 74 68 74 65 73 74 42 20 7b 7d 7d 0a 2b 20 20 20  thtestB {}}.+   
6ac0: 20 63 61 74 63 68 20 7b 72 65 6e 61 6d 65 20 3a   catch {rename :
6ad0: 3a 70 61 74 68 74 65 73 74 44 20 7b 7d 7d 0a 2b  :pathtestD {}}.+
6ae0: 7d 0a 2b 74 65 73 74 20 6e 61 6d 65 73 70 61 63  }.+test namespac
6af0: 65 2d 35 31 2e 35 20 7b 6e 61 6d 65 20 72 65 73  e-51.5 {name res
6b00: 6f 6c 75 74 69 6f 6e 20 70 61 74 68 20 63 6f 6e  olution path con
6b10: 74 72 6f 6c 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20  trol} -body {.+ 
6b20: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61     namespace eva
6b30: 6c 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 20 7b 0a  l ::test_ns_1 {.
6b40: 2b 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c  +.namespace eval
6b50: 20 74 65 73 74 5f 6e 73 5f 32 20 7b 0a 2b 09 20   test_ns_2 {.+. 
6b60: 20 20 20 70 72 6f 63 20 70 61 74 68 74 65 73 74     proc pathtest
6b70: 41 20 7b 7d 20 7b 0a 2b 09 09 3a 3a 72 65 74 75  A {} {.+..::retu
6b80: 72 6e 20 5b 70 61 74 68 74 65 73 74 42 5d 2c 5b  rn [pathtestB],[
6b90: 70 61 74 68 74 65 73 74 43 5d 2c 5b 70 61 74 68  pathtestC],[path
6ba0: 74 65 73 74 44 5d 2c 5b 6e 61 6d 65 73 70 61 63  testD],[namespac
6bb0: 65 20 70 61 74 68 5d 0a 2b 09 20 20 20 20 7d 0a  e path].+.    }.
6bc0: 2b 09 20 20 20 20 70 72 6f 63 20 70 61 74 68 74  +.    proc patht
6bd0: 65 73 74 43 20 7b 7d 20 7b 0a 2b 09 09 3a 3a 72  estC {} {.+..::r
6be0: 65 74 75 72 6e 20 32 0a 2b 09 20 20 20 20 7d 0a  eturn 2.+.    }.
6bf0: 2b 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20  +.    namespace 
6c00: 70 61 74 68 20 3a 3a 74 65 73 74 5f 6e 73 5f 31  path ::test_ns_1
6c10: 0a 2b 09 7d 0a 2b 09 70 72 6f 63 20 70 61 74 68  .+.}.+.proc path
6c20: 74 65 73 74 42 20 7b 7d 20 7b 0a 2b 09 20 20 20  testB {} {.+.   
6c30: 20 72 65 74 75 72 6e 20 31 0a 2b 09 7d 0a 2b 09   return 1.+.}.+.
6c40: 70 72 6f 63 20 70 61 74 68 74 65 73 74 43 20 7b  proc pathtestC {
6c50: 7d 20 7b 0a 2b 09 20 20 20 20 72 65 74 75 72 6e  } {.+.    return
6c60: 20 31 0a 2b 09 7d 0a 2b 09 70 72 6f 63 20 70 61   1.+.}.+.proc pa
6c70: 74 68 74 65 73 74 44 20 7b 7d 20 7b 0a 2b 09 20  thtestD {} {.+. 
6c80: 20 20 20 72 65 74 75 72 6e 20 31 0a 2b 09 7d 0a     return 1.+.}.
6c90: 2b 20 20 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63  +    }.+    proc
6ca0: 20 3a 3a 70 61 74 68 74 65 73 74 42 20 7b 7d 20   ::pathtestB {} 
6cb0: 7b 0a 2b 09 72 65 74 75 72 6e 20 67 6c 6f 62 61  {.+.return globa
6cc0: 6c 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20 70 72  l.+    }.+    pr
6cd0: 6f 63 20 3a 3a 70 61 74 68 74 65 73 74 44 20 7b  oc ::pathtestD {
6ce0: 7d 20 7b 0a 2b 09 72 65 74 75 72 6e 20 67 6c 6f  } {.+.return glo
6cf0: 62 61 6c 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20  bal.+    }.+    
6d00: 73 65 74 20 72 65 73 75 6c 74 20 5b 3a 3a 74 65  set result [::te
6d10: 73 74 5f 6e 73 5f 31 3a 3a 74 65 73 74 5f 6e 73  st_ns_1::test_ns
6d20: 5f 32 3a 3a 70 61 74 68 74 65 73 74 41 5d 0a 2b  _2::pathtestA].+
6d30: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76      namespace ev
6d40: 61 6c 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a  al ::test_ns_1::
6d50: 74 65 73 74 5f 6e 73 5f 32 20 7b 0a 2b 09 6e 61  test_ns_2 {.+.na
6d60: 6d 65 73 70 61 63 65 20 70 61 74 68 20 7b 3a 3a  mespace path {::
6d70: 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 7d 0a 2b 20   ::test_ns_1}.+ 
6d80: 20 20 20 7d 0a 2b 20 20 20 20 6c 61 70 70 65 6e     }.+    lappen
6d90: 64 20 72 65 73 75 6c 74 20 5b 3a 3a 74 65 73 74  d result [::test
6da0: 5f 6e 73 5f 31 3a 3a 74 65 73 74 5f 6e 73 5f 32  _ns_1::test_ns_2
6db0: 3a 3a 70 61 74 68 74 65 73 74 41 5d 0a 2b 20 20  ::pathtestA].+  
6dc0: 20 20 72 65 6e 61 6d 65 20 3a 3a 74 65 73 74 5f    rename ::test_
6dd0: 6e 73 5f 31 3a 3a 74 65 73 74 5f 6e 73 5f 32 3a  ns_1::test_ns_2:
6de0: 3a 70 61 74 68 74 65 73 74 43 20 7b 7d 0a 2b 20  :pathtestC {}.+ 
6df0: 20 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c     lappend resul
6e00: 74 20 5b 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a 3a  t [::test_ns_1::
6e10: 74 65 73 74 5f 6e 73 5f 32 3a 3a 70 61 74 68 74  test_ns_2::patht
6e20: 65 73 74 41 5d 0a 2b 7d 20 2d 72 65 73 75 6c 74  estA].+} -result
6e30: 20 22 31 2c 32 2c 31 2c 3a 3a 74 65 73 74 5f 6e   "1,2,1,::test_n
6e40: 73 5f 31 20 7b 67 6c 6f 62 61 6c 2c 32 2c 67 6c  s_1 {global,2,gl
6e50: 6f 62 61 6c 2c 3a 3a 20 3a 3a 74 65 73 74 5f 6e  obal,:: ::test_n
6e60: 73 5f 31 7d 20 7b 67 6c 6f 62 61 6c 2c 31 2c 67  s_1} {global,1,g
6e70: 6c 6f 62 61 6c 2c 3a 3a 20 3a 3a 74 65 73 74 5f  lobal,:: ::test_
6e80: 6e 73 5f 31 7d 22 20 2d 63 6c 65 61 6e 75 70 20  ns_1}" -cleanup 
6e90: 7b 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65  {.+    namespace
6ea0: 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e   delete ::test_n
6eb0: 73 5f 31 0a 2b 20 20 20 20 63 61 74 63 68 20 7b  s_1.+    catch {
6ec0: 72 65 6e 61 6d 65 20 3a 3a 70 61 74 68 74 65 73  rename ::pathtes
6ed0: 74 42 20 7b 7d 7d 0a 2b 20 20 20 20 63 61 74 63  tB {}}.+    catc
6ee0: 68 20 7b 72 65 6e 61 6d 65 20 3a 3a 70 61 74 68  h {rename ::path
6ef0: 74 65 73 74 44 20 7b 7d 7d 0a 2b 7d 0a 2b 74 65  testD {}}.+}.+te
6f00: 73 74 20 6e 61 6d 65 73 70 61 63 65 2d 35 31 2e  st namespace-51.
6f10: 36 20 7b 6e 61 6d 65 20 72 65 73 6f 6c 75 74 69  6 {name resoluti
6f20: 6f 6e 20 70 61 74 68 20 63 6f 6e 74 72 6f 6c 7d  on path control}
6f30: 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 6e 61   -body {.+    na
6f40: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 74  mespace eval ::t
6f50: 65 73 74 5f 6e 73 5f 31 20 7b 0a 2b 09 6e 61 6d  est_ns_1 {.+.nam
6f60: 65 73 70 61 63 65 20 65 76 61 6c 20 74 65 73 74  espace eval test
6f70: 5f 6e 73 5f 32 20 7b 0a 2b 09 20 20 20 20 70 72  _ns_2 {.+.    pr
6f80: 6f 63 20 70 61 74 68 74 65 73 74 41 20 7b 7d 20  oc pathtestA {} 
6f90: 7b 0a 2b 09 09 3a 3a 72 65 74 75 72 6e 20 5b 70  {.+..::return [p
6fa0: 61 74 68 74 65 73 74 42 5d 2c 5b 70 61 74 68 74  athtestB],[patht
6fb0: 65 73 74 43 5d 2c 5b 70 61 74 68 74 65 73 74 44  estC],[pathtestD
6fc0: 5d 2c 5b 6e 61 6d 65 73 70 61 63 65 20 70 61 74  ],[namespace pat
6fd0: 68 5d 0a 2b 09 20 20 20 20 7d 0a 2b 09 20 20 20  h].+.    }.+.   
6fe0: 20 70 72 6f 63 20 70 61 74 68 74 65 73 74 43 20   proc pathtestC 
6ff0: 7b 7d 20 7b 0a 2b 09 09 3a 3a 72 65 74 75 72 6e  {} {.+..::return
7000: 20 32 0a 2b 09 20 20 20 20 7d 0a 2b 09 20 20 20   2.+.    }.+.   
7010: 20 6e 61 6d 65 73 70 61 63 65 20 70 61 74 68 20   namespace path 
7020: 3a 3a 74 65 73 74 5f 6e 73 5f 31 0a 2b 09 7d 0a  ::test_ns_1.+.}.
7030: 2b 09 70 72 6f 63 20 70 61 74 68 74 65 73 74 42  +.proc pathtestB
7040: 20 7b 7d 20 7b 0a 2b 09 20 20 20 20 72 65 74 75   {} {.+.    retu
7050: 72 6e 20 31 0a 2b 09 7d 0a 2b 09 70 72 6f 63 20  rn 1.+.}.+.proc 
7060: 70 61 74 68 74 65 73 74 43 20 7b 7d 20 7b 0a 2b  pathtestC {} {.+
7070: 09 20 20 20 20 72 65 74 75 72 6e 20 31 0a 2b 09  .    return 1.+.
7080: 7d 0a 2b 09 70 72 6f 63 20 70 61 74 68 74 65 73  }.+.proc pathtes
7090: 74 44 20 7b 7d 20 7b 0a 2b 09 20 20 20 20 72 65  tD {} {.+.    re
70a0: 74 75 72 6e 20 31 0a 2b 09 7d 0a 2b 20 20 20 20  turn 1.+.}.+    
70b0: 7d 0a 2b 20 20 20 20 70 72 6f 63 20 3a 3a 70 61  }.+    proc ::pa
70c0: 74 68 74 65 73 74 42 20 7b 7d 20 7b 0a 2b 09 72  thtestB {} {.+.r
70d0: 65 74 75 72 6e 20 67 6c 6f 62 61 6c 0a 2b 20 20  eturn global.+  
70e0: 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63 20 3a 3a    }.+    proc ::
70f0: 70 61 74 68 74 65 73 74 44 20 7b 7d 20 7b 0a 2b  pathtestD {} {.+
7100: 09 72 65 74 75 72 6e 20 67 6c 6f 62 61 6c 0a 2b  .return global.+
7110: 20 20 20 20 7d 0a 2b 20 20 20 20 73 65 74 20 72      }.+    set r
7120: 65 73 75 6c 74 20 5b 3a 3a 74 65 73 74 5f 6e 73  esult [::test_ns
7130: 5f 31 3a 3a 74 65 73 74 5f 6e 73 5f 32 3a 3a 70  _1::test_ns_2::p
7140: 61 74 68 74 65 73 74 41 5d 0a 2b 20 20 20 20 6e  athtestA].+    n
7150: 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a  amespace eval ::
7160: 74 65 73 74 5f 6e 73 5f 31 3a 3a 74 65 73 74 5f  test_ns_1::test_
7170: 6e 73 5f 32 20 7b 0a 2b 09 6e 61 6d 65 73 70 61  ns_2 {.+.namespa
7180: 63 65 20 70 61 74 68 20 7b 3a 3a 20 3a 3a 74 65  ce path {:: ::te
7190: 73 74 5f 6e 73 5f 31 7d 0a 2b 20 20 20 20 7d 0a  st_ns_1}.+    }.
71a0: 2b 20 20 20 20 6c 61 70 70 65 6e 64 20 72 65 73  +    lappend res
71b0: 75 6c 74 20 5b 3a 3a 74 65 73 74 5f 6e 73 5f 31  ult [::test_ns_1
71c0: 3a 3a 74 65 73 74 5f 6e 73 5f 32 3a 3a 70 61 74  ::test_ns_2::pat
71d0: 68 74 65 73 74 41 5d 0a 2b 20 20 20 20 72 65 6e  htestA].+    ren
71e0: 61 6d 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 3a  ame ::test_ns_1:
71f0: 3a 74 65 73 74 5f 6e 73 5f 32 3a 3a 70 61 74 68  :test_ns_2::path
7200: 74 65 73 74 43 20 7b 7d 0a 2b 20 20 20 20 6c 61  testC {}.+    la
7210: 70 70 65 6e 64 20 72 65 73 75 6c 74 20 5b 3a 3a  ppend result [::
7220: 74 65 73 74 5f 6e 73 5f 31 3a 3a 74 65 73 74 5f  test_ns_1::test_
7230: 6e 73 5f 32 3a 3a 70 61 74 68 74 65 73 74 41 5d  ns_2::pathtestA]
7240: 0a 2b 20 20 20 20 70 72 6f 63 20 3a 3a 70 61 74  .+    proc ::pat
7250: 68 74 65 73 74 43 20 7b 7d 20 7b 0a 2b 09 72 65  htestC {} {.+.re
7260: 74 75 72 6e 20 67 6c 6f 62 61 6c 0a 2b 20 20 20  turn global.+   
7270: 20 7d 0a 2b 20 20 20 20 6c 61 70 70 65 6e 64 20   }.+    lappend 
7280: 72 65 73 75 6c 74 20 5b 3a 3a 74 65 73 74 5f 6e  result [::test_n
7290: 73 5f 31 3a 3a 74 65 73 74 5f 6e 73 5f 32 3a 3a  s_1::test_ns_2::
72a0: 70 61 74 68 74 65 73 74 41 5d 0a 2b 7d 20 2d 72  pathtestA].+} -r
72b0: 65 73 75 6c 74 20 22 31 2c 32 2c 31 2c 3a 3a 74  esult "1,2,1,::t
72c0: 65 73 74 5f 6e 73 5f 31 20 7b 67 6c 6f 62 61 6c  est_ns_1 {global
72d0: 2c 32 2c 67 6c 6f 62 61 6c 2c 3a 3a 20 3a 3a 74  ,2,global,:: ::t
72e0: 65 73 74 5f 6e 73 5f 31 7d 20 7b 67 6c 6f 62 61  est_ns_1} {globa
72f0: 6c 2c 31 2c 67 6c 6f 62 61 6c 2c 3a 3a 20 3a 3a  l,1,global,:: ::
7300: 74 65 73 74 5f 6e 73 5f 31 7d 20 7b 67 6c 6f 62  test_ns_1} {glob
7310: 61 6c 2c 67 6c 6f 62 61 6c 2c 67 6c 6f 62 61 6c  al,global,global
7320: 2c 3a 3a 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 7d  ,:: ::test_ns_1}
7330: 22 20 2d 63 6c 65 61 6e 75 70 20 7b 0a 2b 20 20  " -cleanup {.+  
7340: 20 20 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65    namespace dele
7350: 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 0a 2b  te ::test_ns_1.+
7360: 20 20 20 20 63 61 74 63 68 20 7b 72 65 6e 61 6d      catch {renam
7370: 65 20 3a 3a 70 61 74 68 74 65 73 74 42 20 7b 7d  e ::pathtestB {}
7380: 7d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 72 65  }.+    catch {re
7390: 6e 61 6d 65 20 3a 3a 70 61 74 68 74 65 73 74 44  name ::pathtestD
73a0: 20 7b 7d 7d 0a 2b 7d 0a 2b 74 65 73 74 20 6e 61   {}}.+}.+test na
73b0: 6d 65 73 70 61 63 65 2d 35 31 2e 37 20 7b 6e 61  mespace-51.7 {na
73c0: 6d 65 20 72 65 73 6f 6c 75 74 69 6f 6e 20 70 61  me resolution pa
73d0: 74 68 20 63 6f 6e 74 72 6f 6c 7d 20 2d 62 6f 64  th control} -bod
73e0: 79 20 7b 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61  y {.+    namespa
73f0: 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e  ce eval ::test_n
7400: 73 5f 31 20 7b 0a 2b 20 20 20 20 7d 0a 2b 20 20  s_1 {.+    }.+  
7410: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c    namespace eval
7420: 20 3a 3a 74 65 73 74 5f 6e 73 5f 32 20 7b 0a 2b   ::test_ns_2 {.+
7430: 09 6e 61 6d 65 73 70 61 63 65 20 70 61 74 68 20  .namespace path 
7440: 3a 3a 74 65 73 74 5f 6e 73 5f 31 0a 2b 09 70 72  ::test_ns_1.+.pr
7450: 6f 63 20 67 65 74 70 61 74 68 20 7b 7d 20 7b 6e  oc getpath {} {n
7460: 61 6d 65 73 70 61 63 65 20 70 61 74 68 7d 0a 2b  amespace path}.+
7470: 20 20 20 20 7d 0a 2b 20 20 20 20 6c 69 73 74 20      }.+    list 
7480: 5b 3a 3a 74 65 73 74 5f 6e 73 5f 32 3a 3a 67 65  [::test_ns_2::ge
7490: 74 70 61 74 68 5d 20 5b 6e 61 6d 65 73 70 61 63  tpath] [namespac
74a0: 65 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f  e delete ::test_
74b0: 6e 73 5f 31 5d 20 5b 3a 3a 74 65 73 74 5f 6e 73  ns_1] [::test_ns
74c0: 5f 32 3a 3a 67 65 74 70 61 74 68 5d 0a 2b 7d 20  _2::getpath].+} 
74d0: 2d 72 65 73 75 6c 74 20 7b 3a 3a 74 65 73 74 5f  -result {::test_
74e0: 6e 73 5f 31 20 7b 7d 20 7b 7d 7d 20 2d 63 6c 65  ns_1 {} {}} -cle
74f0: 61 6e 75 70 20 7b 0a 2b 20 20 20 20 63 61 74 63  anup {.+    catc
7500: 68 20 7b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c  h {namespace del
7510: 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 7d  ete ::test_ns_1}
7520: 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20  .+    namespace 
7530: 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73  delete ::test_ns
7540: 5f 32 0a 2b 7d 0a 2b 74 65 73 74 20 6e 61 6d 65  _2.+}.+test name
7550: 73 70 61 63 65 2d 35 31 2e 38 20 7b 6e 61 6d 65  space-51.8 {name
7560: 20 72 65 73 6f 6c 75 74 69 6f 6e 20 70 61 74 68   resolution path
7570: 20 63 6f 6e 74 72 6f 6c 7d 20 2d 62 6f 64 79 20   control} -body 
7580: 7b 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65  {.+    namespace
7590: 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e 73 5f   eval ::test_ns_
75a0: 31 20 7b 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20  1 {.+    }.+    
75b0: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a  namespace eval :
75c0: 3a 74 65 73 74 5f 6e 73 5f 32 20 7b 0a 2b 20 20  :test_ns_2 {.+  
75d0: 20 20 7d 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61    }.+    namespa
75e0: 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e  ce eval ::test_n
75f0: 73 5f 33 20 7b 0a 2b 20 20 20 20 7d 0a 2b 20 20  s_3 {.+    }.+  
7600: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c    namespace eval
7610: 20 3a 3a 74 65 73 74 5f 6e 73 5f 34 20 7b 0a 2b   ::test_ns_4 {.+
7620: 09 6e 61 6d 65 73 70 61 63 65 20 70 61 74 68 20  .namespace path 
7630: 7b 3a 3a 74 65 73 74 5f 6e 73 5f 31 20 3a 3a 74  {::test_ns_1 ::t
7640: 65 73 74 5f 6e 73 5f 32 20 3a 3a 74 65 73 74 5f  est_ns_2 ::test_
7650: 6e 73 5f 33 7d 0a 2b 09 70 72 6f 63 20 67 65 74  ns_3}.+.proc get
7660: 70 61 74 68 20 7b 7d 20 7b 6e 61 6d 65 73 70 61  path {} {namespa
7670: 63 65 20 70 61 74 68 7d 0a 2b 20 20 20 20 7d 0a  ce path}.+    }.
7680: 2b 20 20 20 20 6c 69 73 74 20 5b 3a 3a 74 65 73  +    list [::tes
7690: 74 5f 6e 73 5f 34 3a 3a 67 65 74 70 61 74 68 5d  t_ns_4::getpath]
76a0: 20 5b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65   [namespace dele
76b0: 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 32 5d 20  te ::test_ns_2] 
76c0: 5b 3a 3a 74 65 73 74 5f 6e 73 5f 34 3a 3a 67 65  [::test_ns_4::ge
76d0: 74 70 61 74 68 5d 0a 2b 7d 20 2d 72 65 73 75 6c  tpath].+} -resul
76e0: 74 20 7b 7b 3a 3a 74 65 73 74 5f 6e 73 5f 31 20  t {{::test_ns_1 
76f0: 3a 3a 74 65 73 74 5f 6e 73 5f 32 20 3a 3a 74 65  ::test_ns_2 ::te
7700: 73 74 5f 6e 73 5f 33 7d 20 7b 7d 20 7b 3a 3a 74  st_ns_3} {} {::t
7710: 65 73 74 5f 6e 73 5f 31 20 3a 3a 74 65 73 74 5f  est_ns_1 ::test_
7720: 6e 73 5f 33 7d 7d 20 2d 63 6c 65 61 6e 75 70 20  ns_3}} -cleanup 
7730: 7b 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 6e 61  {.+    catch {na
7740: 6d 65 73 70 61 63 65 20 64 65 6c 65 74 65 20 3a  mespace delete :
7750: 3a 74 65 73 74 5f 6e 73 5f 31 7d 0a 2b 20 20 20  :test_ns_1}.+   
7760: 20 63 61 74 63 68 20 7b 6e 61 6d 65 73 70 61 63   catch {namespac
7770: 65 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f  e delete ::test_
7780: 6e 73 5f 32 7d 0a 2b 20 20 20 20 63 61 74 63 68  ns_2}.+    catch
7790: 20 7b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65   {namespace dele
77a0: 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 33 7d 0a  te ::test_ns_3}.
77b0: 2b 20 20 20 20 63 61 74 63 68 20 7b 6e 61 6d 65  +    catch {name
77c0: 73 70 61 63 65 20 64 65 6c 65 74 65 20 3a 3a 74  space delete ::t
77d0: 65 73 74 5f 6e 73 5f 34 7d 0a 2b 7d 0a 2b 74 65  est_ns_4}.+}.+te
77e0: 73 74 20 6e 61 6d 65 73 70 61 63 65 2d 35 31 2e  st namespace-51.
77f0: 39 20 7b 6e 61 6d 65 20 72 65 73 6f 6c 75 74 69  9 {name resoluti
7800: 6f 6e 20 70 61 74 68 20 63 6f 6e 74 72 6f 6c 7d  on path control}
7810: 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 6e 61   -body {.+    na
7820: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 74  mespace eval ::t
7830: 65 73 74 5f 6e 73 5f 31 20 7b 0a 2b 20 20 20 20  est_ns_1 {.+    
7840: 7d 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65  }.+    namespace
7850: 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e 73 5f   eval ::test_ns_
7860: 32 20 7b 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20  2 {.+    }.+    
7870: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a  namespace eval :
7880: 3a 74 65 73 74 5f 6e 73 5f 33 20 7b 0a 2b 20 20  :test_ns_3 {.+  
7890: 20 20 7d 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61    }.+    namespa
78a0: 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e  ce eval ::test_n
78b0: 73 5f 34 20 7b 0a 2b 09 6e 61 6d 65 73 70 61 63  s_4 {.+.namespac
78c0: 65 20 70 61 74 68 20 7b 3a 3a 74 65 73 74 5f 6e  e path {::test_n
78d0: 73 5f 31 20 3a 3a 74 65 73 74 5f 6e 73 5f 32 20  s_1 ::test_ns_2 
78e0: 3a 3a 74 65 73 74 5f 6e 73 5f 33 7d 0a 2b 09 70  ::test_ns_3}.+.p
78f0: 72 6f 63 20 67 65 74 70 61 74 68 20 7b 7d 20 7b  roc getpath {} {
7900: 6e 61 6d 65 73 70 61 63 65 20 70 61 74 68 7d 0a  namespace path}.
7910: 2b 20 20 20 20 7d 0a 2b 20 20 20 20 6c 69 73 74  +    }.+    list
7920: 20 5b 3a 3a 74 65 73 74 5f 6e 73 5f 34 3a 3a 67   [::test_ns_4::g
7930: 65 74 70 61 74 68 5d 20 5b 6e 61 6d 65 73 70 61  etpath] [namespa
7940: 63 65 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74  ce delete ::test
7950: 5f 6e 73 5f 32 5d 20 5b 6e 61 6d 65 73 70 61 63  _ns_2] [namespac
7960: 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e 73  e eval ::test_ns
7970: 5f 32 20 7b 7d 5d 20 5b 3a 3a 74 65 73 74 5f 6e  _2 {}] [::test_n
7980: 73 5f 34 3a 3a 67 65 74 70 61 74 68 5d 0a 2b 7d  s_4::getpath].+}
7990: 20 2d 72 65 73 75 6c 74 20 7b 7b 3a 3a 74 65 73   -result {{::tes
79a0: 74 5f 6e 73 5f 31 20 3a 3a 74 65 73 74 5f 6e 73  t_ns_1 ::test_ns
79b0: 5f 32 20 3a 3a 74 65 73 74 5f 6e 73 5f 33 7d 20  _2 ::test_ns_3} 
79c0: 7b 7d 20 7b 7d 20 7b 3a 3a 74 65 73 74 5f 6e 73  {} {} {::test_ns
79d0: 5f 31 20 3a 3a 74 65 73 74 5f 6e 73 5f 33 7d 7d  _1 ::test_ns_3}}
79e0: 20 2d 63 6c 65 61 6e 75 70 20 7b 0a 2b 20 20 20   -cleanup {.+   
79f0: 20 63 61 74 63 68 20 7b 6e 61 6d 65 73 70 61 63   catch {namespac
7a00: 65 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f  e delete ::test_
7a10: 6e 73 5f 31 7d 0a 2b 20 20 20 20 63 61 74 63 68  ns_1}.+    catch
7a20: 20 7b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65   {namespace dele
7a30: 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 32 7d 0a  te ::test_ns_2}.
7a40: 2b 20 20 20 20 63 61 74 63 68 20 7b 6e 61 6d 65  +    catch {name
7a50: 73 70 61 63 65 20 64 65 6c 65 74 65 20 3a 3a 74  space delete ::t
7a60: 65 73 74 5f 6e 73 5f 33 7d 0a 2b 20 20 20 20 63  est_ns_3}.+    c
7a70: 61 74 63 68 20 7b 6e 61 6d 65 73 70 61 63 65 20  atch {namespace 
7a80: 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73  delete ::test_ns
7a90: 5f 34 7d 0a 2b 7d 0a 2b 74 65 73 74 20 6e 61 6d  _4}.+}.+test nam
7aa0: 65 73 70 61 63 65 2d 35 31 2e 31 30 20 7b 6e 61  espace-51.10 {na
7ab0: 6d 65 20 72 65 73 6f 6c 75 74 69 6f 6e 20 70 61  me resolution pa
7ac0: 74 68 20 63 6f 6e 74 72 6f 6c 7d 20 2d 62 6f 64  th control} -bod
7ad0: 79 20 7b 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61  y {.+    namespa
7ae0: 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e  ce eval ::test_n
7af0: 73 5f 31 20 7b 0a 2b 09 6e 61 6d 65 73 70 61 63  s_1 {.+.namespac
7b00: 65 20 70 61 74 68 20 64 6f 65 73 3a 3a 6e 6f 74  e path does::not
7b10: 3a 3a 65 78 69 73 74 0a 2b 20 20 20 20 7d 0a 2b  ::exist.+    }.+
7b20: 7d 20 2d 72 65 74 75 72 6e 43 6f 64 65 73 20 65  } -returnCodes e
7b30: 72 72 6f 72 20 2d 72 65 73 75 6c 74 20 7b 75 6e  rror -result {un
7b40: 6b 6e 6f 77 6e 20 6e 61 6d 65 73 70 61 63 65 20  known namespace 
7b50: 22 64 6f 65 73 3a 3a 6e 6f 74 3a 3a 65 78 69 73  "does::not::exis
7b60: 74 22 7d 20 2d 63 6c 65 61 6e 75 70 20 7b 0a 2b  t"} -cleanup {.+
7b70: 20 20 20 20 63 61 74 63 68 20 7b 6e 61 6d 65 73      catch {names
7b80: 70 61 63 65 20 64 65 6c 65 74 65 20 3a 3a 74 65  pace delete ::te
7b90: 73 74 5f 6e 73 5f 31 7d 0a 2b 7d 0a 2b 74 65 73  st_ns_1}.+}.+tes
7ba0: 74 20 6e 61 6d 65 73 70 61 63 65 2d 35 31 2e 31  t namespace-51.1
7bb0: 31 20 7b 6e 61 6d 65 20 72 65 73 6f 6c 75 74 69  1 {name resoluti
7bc0: 6f 6e 20 70 61 74 68 20 63 6f 6e 74 72 6f 6c 7d  on path control}
7bd0: 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 6e 61   -body {.+    na
7be0: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 74  mespace eval ::t
7bf0: 65 73 74 5f 6e 73 5f 31 20 7b 0a 2b 09 70 72 6f  est_ns_1 {.+.pro
7c00: 63 20 66 6f 6f 20 7b 7d 20 7b 72 65 74 75 72 6e  c foo {} {return
7c10: 20 31 7d 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20   1}.+    }.+    
7c20: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a  namespace eval :
7c30: 3a 74 65 73 74 5f 6e 73 5f 32 20 7b 0a 2b 09 70  :test_ns_2 {.+.p
7c40: 72 6f 63 20 66 6f 6f 20 7b 7d 20 7b 72 65 74 75  roc foo {} {retu
7c50: 72 6e 20 32 7d 0a 2b 20 20 20 20 7d 0a 2b 20 20  rn 2}.+    }.+  
7c60: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c    namespace eval
7c70: 20 3a 3a 74 65 73 74 5f 6e 73 5f 33 20 7b 0a 2b   ::test_ns_3 {.+
7c80: 09 6e 61 6d 65 73 70 61 63 65 20 70 61 74 68 20  .namespace path 
7c90: 3a 3a 74 65 73 74 5f 6e 73 5f 31 0a 2b 20 20 20  ::test_ns_1.+   
7ca0: 20 7d 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61 63   }.+    namespac
7cb0: 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e 73  e eval ::test_ns
7cc0: 5f 34 20 7b 0a 2b 09 6e 61 6d 65 73 70 61 63 65  _4 {.+.namespace
7cd0: 20 70 61 74 68 20 7b 3a 3a 74 65 73 74 5f 6e 73   path {::test_ns
7ce0: 5f 33 20 3a 3a 74 65 73 74 5f 6e 73 5f 32 7d 0a  _3 ::test_ns_2}.
7cf0: 2b 09 66 6f 6f 0a 2b 20 20 20 20 7d 0a 2b 7d 20  +.foo.+    }.+} 
7d00: 2d 72 65 73 75 6c 74 20 32 20 2d 63 6c 65 61 6e  -result 2 -clean
7d10: 75 70 20 7b 0a 2b 20 20 20 20 63 61 74 63 68 20  up {.+    catch 
7d20: 7b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65 74  {namespace delet
7d30: 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 7d 0a 2b  e ::test_ns_1}.+
7d40: 20 20 20 20 63 61 74 63 68 20 7b 6e 61 6d 65 73      catch {names
7d50: 70 61 63 65 20 64 65 6c 65 74 65 20 3a 3a 74 65  pace delete ::te
7d60: 73 74 5f 6e 73 5f 32 7d 0a 2b 20 20 20 20 63 61  st_ns_2}.+    ca
7d70: 74 63 68 20 7b 6e 61 6d 65 73 70 61 63 65 20 64  tch {namespace d
7d80: 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f  elete ::test_ns_
7d90: 33 7d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 6e  3}.+    catch {n
7da0: 61 6d 65 73 70 61 63 65 20 64 65 6c 65 74 65 20  amespace delete 
7db0: 3a 3a 74 65 73 74 5f 6e 73 5f 34 7d 0a 2b 7d 0a  ::test_ns_4}.+}.
7dc0: 2b 74 65 73 74 20 6e 61 6d 65 73 70 61 63 65 2d  +test namespace-
7dd0: 35 31 2e 31 32 20 7b 6e 61 6d 65 20 72 65 73 6f  51.12 {name reso
7de0: 6c 75 74 69 6f 6e 20 70 61 74 68 20 63 6f 6e 74  lution path cont
7df0: 72 6f 6c 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20  rol} -body {.+  
7e00: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c    namespace eval
7e10: 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 20 7b 0a 2b   ::test_ns_1 {.+
7e20: 09 70 72 6f 63 20 66 6f 6f 20 7b 7d 20 7b 72 65  .proc foo {} {re
7e30: 74 75 72 6e 20 31 7d 0a 2b 20 20 20 20 7d 0a 2b  turn 1}.+    }.+
7e40: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76      namespace ev
7e50: 61 6c 20 3a 3a 74 65 73 74 5f 6e 73 5f 32 20 7b  al ::test_ns_2 {
7e60: 0a 2b 09 70 72 6f 63 20 66 6f 6f 20 7b 7d 20 7b  .+.proc foo {} {
7e70: 72 65 74 75 72 6e 20 32 7d 0a 2b 20 20 20 20 7d  return 2}.+    }
7e80: 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20  .+    namespace 
7e90: 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e 73 5f 33  eval ::test_ns_3
7ea0: 20 7b 0a 2b 09 6e 61 6d 65 73 70 61 63 65 20 70   {.+.namespace p
7eb0: 61 74 68 20 3a 3a 74 65 73 74 5f 6e 73 5f 31 0a  ath ::test_ns_1.
7ec0: 2b 20 20 20 20 7d 0a 2b 20 20 20 20 6e 61 6d 65  +    }.+    name
7ed0: 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 74 65 73  space eval ::tes
7ee0: 74 5f 6e 73 5f 34 20 7b 0a 2b 09 6e 61 6d 65 73  t_ns_4 {.+.names
7ef0: 70 61 63 65 20 70 61 74 68 20 7b 3a 3a 74 65 73  pace path {::tes
7f00: 74 5f 6e 73 5f 33 20 3a 3a 74 65 73 74 5f 6e 73  t_ns_3 ::test_ns
7f10: 5f 32 7d 0a 2b 09 6c 69 73 74 20 5b 66 6f 6f 5d  _2}.+.list [foo]
7f20: 20 5b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65   [namespace dele
7f30: 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 33 5d 20  te ::test_ns_3] 
7f40: 5b 66 6f 6f 5d 0a 2b 20 20 20 20 7d 0a 2b 7d 20  [foo].+    }.+} 
7f50: 2d 72 65 73 75 6c 74 20 7b 32 20 7b 7d 20 32 7d  -result {2 {} 2}
7f60: 20 2d 63 6c 65 61 6e 75 70 20 7b 0a 2b 20 20 20   -cleanup {.+   
7f70: 20 63 61 74 63 68 20 7b 6e 61 6d 65 73 70 61 63   catch {namespac
7f80: 65 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f  e delete ::test_
7f90: 6e 73 5f 31 7d 0a 2b 20 20 20 20 63 61 74 63 68  ns_1}.+    catch
7fa0: 20 7b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65   {namespace dele
7fb0: 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 32 7d 0a  te ::test_ns_2}.
7fc0: 2b 20 20 20 20 63 61 74 63 68 20 7b 6e 61 6d 65  +    catch {name
7fd0: 73 70 61 63 65 20 64 65 6c 65 74 65 20 3a 3a 74  space delete ::t
7fe0: 65 73 74 5f 6e 73 5f 33 7d 0a 2b 20 20 20 20 63  est_ns_3}.+    c
7ff0: 61 74 63 68 20 7b 6e 61 6d 65 73 70 61 63 65 20  atch {namespace 
8000: 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73  delete ::test_ns
8010: 5f 34 7d 0a 2b 7d 0a 2b 23 20 46 61 69 6c 73 20  _4}.+}.+# Fails 
8020: 72 69 67 68 74 20 6e 6f 77 20 64 75 65 20 74 6f  right now due to
8030: 20 75 6e 72 65 6c 61 74 65 64 20 62 75 67 2e 2e   unrelated bug..
8040: 2e 0a 2b 74 65 73 74 20 6e 61 6d 65 73 70 61 63  ..+test namespac
8050: 65 2d 35 31 2e 31 33 20 7b 6e 61 6d 65 20 72 65  e-51.13 {name re
8060: 73 6f 6c 75 74 69 6f 6e 20 70 61 74 68 20 63 6f  solution path co
8070: 6e 74 72 6f 6c 7d 20 2d 63 6f 6e 73 74 72 61 69  ntrol} -constrai
8080: 6e 74 73 20 6b 6e 6f 77 6e 42 75 67 20 2d 62 6f  nts knownBug -bo
8090: 64 79 20 7b 0a 2b 20 20 20 20 73 65 74 20 3a 3a  dy {.+    set ::
80a0: 72 65 73 75 6c 74 20 7b 7d 0a 2b 20 20 20 20 6e  result {}.+    n
80b0: 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a  amespace eval ::
80c0: 74 65 73 74 5f 6e 73 5f 31 20 7b 0a 2b 09 70 72  test_ns_1 {.+.pr
80d0: 6f 63 20 66 6f 6f 20 7b 7d 20 7b 6c 61 70 70 65  oc foo {} {lappe
80e0: 6e 64 20 3a 3a 72 65 73 75 6c 74 20 31 7d 0a 2b  nd ::result 1}.+
80f0: 20 20 20 20 7d 0a 2b 20 20 20 20 6e 61 6d 65 73      }.+    names
8100: 70 61 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74  pace eval ::test
8110: 5f 6e 73 5f 32 20 7b 0a 2b 09 70 72 6f 63 20 66  _ns_2 {.+.proc f
8120: 6f 6f 20 7b 7d 20 7b 6c 61 70 70 65 6e 64 20 3a  oo {} {lappend :
8130: 3a 72 65 73 75 6c 74 20 32 7d 0a 2b 09 74 72 61  :result 2}.+.tra
8140: 63 65 20 61 64 64 20 63 6f 6d 6d 61 6e 64 20 66  ce add command f
8150: 6f 6f 20 64 65 6c 65 74 65 20 7b 6e 61 6d 65 73  oo delete {names
8160: 70 61 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74  pace eval ::test
8170: 5f 6e 73 5f 33 20 66 6f 6f 3b 23 7d 0a 2b 20 20  _ns_3 foo;#}.+  
8180: 20 20 7d 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61    }.+    namespa
8190: 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e  ce eval ::test_n
81a0: 73 5f 33 20 7b 0a 2b 09 70 72 6f 63 20 66 6f 6f  s_3 {.+.proc foo
81b0: 20 7b 7d 20 7b 0a 2b 09 20 20 20 20 6c 61 70 70   {} {.+.    lapp
81c0: 65 6e 64 20 3a 3a 72 65 73 75 6c 74 20 33 0a 2b  end ::result 3.+
81d0: 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 64  .    namespace d
81e0: 65 6c 65 74 65 20 5b 6e 61 6d 65 73 70 61 63 65  elete [namespace
81f0: 20 63 75 72 72 65 6e 74 5d 0a 2b 09 20 20 20 20   current].+.    
8200: 3a 3a 74 65 73 74 5f 6e 73 5f 34 3a 3a 62 61 72  ::test_ns_4::bar
8210: 0a 2b 09 7d 0a 2b 20 20 20 20 7d 0a 2b 20 20 20  .+.}.+    }.+   
8220: 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20   namespace eval 
8230: 3a 3a 74 65 73 74 5f 6e 73 5f 34 20 7b 0a 2b 09  ::test_ns_4 {.+.
8240: 6e 61 6d 65 73 70 61 63 65 20 70 61 74 68 20 7b  namespace path {
8250: 3a 3a 74 65 73 74 5f 6e 73 5f 32 20 3a 3a 74 65  ::test_ns_2 ::te
8260: 73 74 5f 6e 73 5f 33 20 3a 3a 74 65 73 74 5f 6e  st_ns_3 ::test_n
8270: 73 5f 31 7d 0a 2b 09 70 72 6f 63 20 62 61 72 20  s_1}.+.proc bar 
8280: 7b 7d 20 7b 0a 2b 09 20 20 20 20 6c 69 73 74 20  {} {.+.    list 
8290: 5b 66 6f 6f 5d 20 5b 6e 61 6d 65 73 70 61 63 65  [foo] [namespace
82a0: 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e   delete ::test_n
82b0: 73 5f 32 5d 20 5b 66 6f 6f 5d 0a 2b 09 7d 0a 2b  s_2] [foo].+.}.+
82c0: 09 62 61 72 0a 2b 20 20 20 20 7d 0a 2b 20 20 20  .bar.+    }.+   
82d0: 20 23 20 53 68 6f 75 6c 64 20 74 68 65 20 72 65   # Should the re
82e0: 73 75 6c 74 20 62 65 20 22 32 20 7b 7d 20 7b 32  sult be "2 {} {2
82f0: 20 33 20 31 20 31 7d 22 20 69 6e 73 74 65 61 64   3 1 1}" instead
8300: 3f 0a 2b 7d 20 2d 72 65 73 75 6c 74 20 7b 32 20  ?.+} -result {2 
8310: 7b 7d 20 7b 32 20 33 20 32 20 31 7d 7d 20 2d 63  {} {2 3 2 1}} -c
8320: 6c 65 61 6e 75 70 20 7b 0a 2b 20 20 20 20 63 61  leanup {.+    ca
8330: 74 63 68 20 7b 6e 61 6d 65 73 70 61 63 65 20 64  tch {namespace d
8340: 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f  elete ::test_ns_
8350: 31 7d 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 6e  1}.+    catch {n
8360: 61 6d 65 73 70 61 63 65 20 64 65 6c 65 74 65 20  amespace delete 
8370: 3a 3a 74 65 73 74 5f 6e 73 5f 32 7d 0a 2b 20 20  ::test_ns_2}.+  
8380: 20 20 63 61 74 63 68 20 7b 6e 61 6d 65 73 70 61    catch {namespa
8390: 63 65 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74  ce delete ::test
83a0: 5f 6e 73 5f 33 7d 0a 2b 20 20 20 20 63 61 74 63  _ns_3}.+    catc
83b0: 68 20 7b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c  h {namespace del
83c0: 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 34 7d  ete ::test_ns_4}
83d0: 0a 2b 7d 0a 2b 74 65 73 74 20 6e 61 6d 65 73 70  .+}.+test namesp
83e0: 61 63 65 2d 35 31 2e 31 34 20 7b 6e 61 6d 65 20  ace-51.14 {name 
83f0: 72 65 73 6f 6c 75 74 69 6f 6e 20 70 61 74 68 20  resolution path 
8400: 63 6f 6e 74 72 6f 6c 7d 20 2d 62 6f 64 79 20 7b  control} -body {
8410: 0a 2b 20 20 20 20 70 72 6f 63 20 66 6f 6f 30 20  .+    proc foo0 
8420: 7b 7d 20 7b 7d 0a 2b 20 20 20 20 6e 61 6d 65 73  {} {}.+    names
8430: 70 61 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74  pace eval ::test
8440: 5f 6e 73 5f 31 20 7b 0a 2b 09 70 72 6f 63 20 66  _ns_1 {.+.proc f
8450: 6f 6f 31 20 7b 7d 20 7b 7d 0a 2b 20 20 20 20 7d  oo1 {} {}.+    }
8460: 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20  .+    namespace 
8470: 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e 73 5f 32  eval ::test_ns_2
8480: 20 7b 0a 2b 09 70 72 6f 63 20 66 6f 6f 32 20 7b   {.+.proc foo2 {
8490: 7d 20 7b 7d 0a 2b 20 20 20 20 7d 0a 2b 20 20 20  } {}.+    }.+   
84a0: 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20   namespace eval 
84b0: 3a 3a 74 65 73 74 5f 6e 73 5f 33 20 7b 0a 2b 09  ::test_ns_3 {.+.
84c0: 76 61 72 69 61 62 6c 65 20 72 65 73 75 6c 74 20  variable result 
84d0: 7b 7d 0a 2b 09 6c 61 70 70 65 6e 64 20 72 65 73  {}.+.lappend res
84e0: 75 6c 74 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e  ult [info comman
84f0: 64 73 20 66 6f 6f 2a 5d 0a 2b 09 6e 61 6d 65 73  ds foo*].+.names
8500: 70 61 63 65 20 70 61 74 68 20 7b 3a 3a 74 65 73  pace path {::tes
8510: 74 5f 6e 73 5f 31 20 3a 3a 74 65 73 74 5f 6e 73  t_ns_1 ::test_ns
8520: 5f 32 7d 0a 2b 09 6c 61 70 70 65 6e 64 20 72 65  _2}.+.lappend re
8530: 73 75 6c 74 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61  sult [info comma
8540: 6e 64 73 20 66 6f 6f 2a 5d 0a 2b 09 70 72 6f 63  nds foo*].+.proc
8550: 20 66 6f 6f 32 20 7b 7d 20 7b 7d 0a 2b 09 6c 61   foo2 {} {}.+.la
8560: 70 70 65 6e 64 20 72 65 73 75 6c 74 20 5b 69 6e  ppend result [in
8570: 66 6f 20 63 6f 6d 6d 61 6e 64 73 20 66 6f 6f 2a  fo commands foo*
8580: 5d 0a 2b 09 72 65 6e 61 6d 65 20 66 6f 6f 32 20  ].+.rename foo2 
8590: 7b 7d 0a 2b 09 6c 61 70 70 65 6e 64 20 72 65 73  {}.+.lappend res
85a0: 75 6c 74 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e  ult [info comman
85b0: 64 73 20 66 6f 6f 2a 5d 0a 2b 09 6e 61 6d 65 73  ds foo*].+.names
85c0: 70 61 63 65 20 64 65 6c 65 74 65 20 3a 3a 74 65  pace delete ::te
85d0: 73 74 5f 6e 73 5f 31 0a 2b 09 6c 61 70 70 65 6e  st_ns_1.+.lappen
85e0: 64 20 72 65 73 75 6c 74 20 5b 69 6e 66 6f 20 63  d result [info c
85f0: 6f 6d 6d 61 6e 64 73 20 66 6f 6f 2a 5d 0a 2b 20  ommands foo*].+ 
8600: 20 20 20 7d 0a 2b 7d 20 2d 72 65 73 75 6c 74 20     }.+} -result 
8610: 7b 66 6f 6f 30 20 7b 66 6f 6f 31 20 66 6f 6f 32  {foo0 {foo1 foo2
8620: 20 66 6f 6f 30 7d 20 7b 66 6f 6f 32 20 66 6f 6f   foo0} {foo2 foo
8630: 31 20 66 6f 6f 30 7d 20 7b 66 6f 6f 31 20 66 6f  1 foo0} {foo1 fo
8640: 6f 32 20 66 6f 6f 30 7d 20 7b 66 6f 6f 32 20 66  o2 foo0} {foo2 f
8650: 6f 6f 30 7d 7d 20 2d 63 6c 65 61 6e 75 70 20 7b  oo0}} -cleanup {
8660: 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 6e 61 6d  .+    catch {nam
8670: 65 73 70 61 63 65 20 64 65 6c 65 74 65 20 3a 3a  espace delete ::
8680: 74 65 73 74 5f 6e 73 5f 31 7d 0a 2b 20 20 20 20  test_ns_1}.+    
8690: 63 61 74 63 68 20 7b 6e 61 6d 65 73 70 61 63 65  catch {namespace
86a0: 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e   delete ::test_n
86b0: 73 5f 32 7d 0a 2b 20 20 20 20 63 61 74 63 68 20  s_2}.+    catch 
86c0: 7b 6e 61 6d 65 73 70 61 63 65 20 64 65 6c 65 74  {namespace delet
86d0: 65 20 3a 3a 74 65 73 74 5f 6e 73 5f 33 7d 0a 2b  e ::test_ns_3}.+
86e0: 7d 0a 2b 74 65 73 74 20 6e 61 6d 65 73 70 61 63  }.+test namespac
86f0: 65 2d 35 31 2e 31 35 20 7b 6e 61 6d 65 73 70 61  e-51.15 {namespa
8700: 63 65 20 72 65 73 6f 6c 75 74 69 6f 6e 20 70 61  ce resolution pa
8710: 74 68 20 63 6f 6e 74 72 6f 6c 7d 20 2d 62 6f 64  th control} -bod
8720: 79 20 7b 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61  y {.+    namespa
8730: 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74 5f 6e  ce eval ::test_n
8740: 73 5f 32 20 7b 0a 2b 09 70 72 6f 63 20 66 6f 6f  s_2 {.+.proc foo
8750: 20 7b 7d 20 7b 72 65 74 75 72 6e 20 32 7d 0a 2b   {} {return 2}.+
8760: 20 20 20 20 7d 0a 2b 20 20 20 20 6e 61 6d 65 73      }.+    names
8770: 70 61 63 65 20 65 76 61 6c 20 3a 3a 74 65 73 74  pace eval ::test
8780: 5f 6e 73 5f 31 20 7b 0a 2b 09 6e 61 6d 65 73 70  _ns_1 {.+.namesp
8790: 61 63 65 20 65 76 61 6c 20 74 65 73 74 5f 6e 73  ace eval test_ns
87a0: 5f 32 20 7b 0a 2b 09 20 20 20 20 70 72 6f 63 20  _2 {.+.    proc 
87b0: 66 6f 6f 20 7b 7d 20 7b 72 65 74 75 72 6e 20 31  foo {} {return 1
87c0: 5f 32 7d 0a 2b 09 7d 0a 2b 09 6e 61 6d 65 73 70  _2}.+.}.+.namesp
87d0: 61 63 65 20 65 76 61 6c 20 74 65 73 74 5f 6e 73  ace eval test_ns
87e0: 5f 33 20 7b 0a 2b 09 20 20 20 20 6e 61 6d 65 73  _3 {.+.    names
87f0: 70 61 63 65 20 70 61 74 68 20 3a 3a 74 65 73 74  pace path ::test
8800: 5f 6e 73 5f 31 0a 2b 09 20 20 20 20 74 65 73 74  _ns_1.+.    test
8810: 5f 6e 73 5f 32 3a 3a 66 6f 6f 0a 2b 09 7d 0a 2b  _ns_2::foo.+.}.+
8820: 20 20 20 20 7d 0a 2b 7d 20 2d 72 65 73 75 6c 74      }.+} -result
8830: 20 31 5f 32 20 2d 63 6c 65 61 6e 75 70 20 7b 0a   1_2 -cleanup {.
8840: 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 64  +    namespace d
8850: 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e 73 5f  elete ::test_ns_
8860: 31 0a 2b 20 20 20 20 6e 61 6d 65 73 70 61 63 65  1.+    namespace
8870: 20 64 65 6c 65 74 65 20 3a 3a 74 65 73 74 5f 6e   delete ::test_n
8880: 73 5f 32 0a 2b 7d 0a 2b 0a 20 23 20 63 6c 65 61  s_2.+}.+. # clea
8890: 6e 75 70 0a 20 63 61 74 63 68 20 7b 72 65 6e 61  nup. catch {rena
88a0: 6d 65 20 63 6d 64 31 20 7b 7d 7d 0a 20 63 61 74  me cmd1 {}}. cat
88b0: 63 68 20 7b 75 6e 73 65 74 20 6c 7d 0a           ch {unset l}.