Artifacts Associated With Ticket 218695
Ticket change [e3f0c20fa4] (rid 87879) by nobody on 2000-10-26 01:04:13:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 1775 RFE Version: 8.0.5 SubmitDate: '1999-04-09' LastModified: '1999-09-15' Severity: LOW Status: Released Submitter: pat ChangedBy: hobbs OS: Solaris OSVersion: 5.5.1 Machine: Other FixedDate: '1999-09-15' FixedInVersion: 8.3b1 ClosedDate: '2000-10-25' Name: scott murdock Extensions: tclx tcl-dp img itcl Comments: This is simpler and faster than a loop to get the names to unset. The alternative of a separate array for the subset may not be appropriate for a given program. I just copied the array names code and modified it a little. The only thing about this that is specific to 8.0.5 is the patch line numbers. DesiredBehavior: enables unsetting a selected set of array elements, using a name pattern, eg. array unset foo xyz,* Patch: *** generic/tclVar.c.orig Tue Feb 2 16:55:06 1999 --- generic/tclVar.c Thu Apr 8 18:04:21 1999 *************** *** 2872,2881 **** enum {ARRAY_ANYMORE, ARRAY_DONESEARCH, ARRAY_EXISTS, ARRAY_GET, ARRAY_NAMES, ARRAY_NEXTELEMENT, ARRAY_SET, ARRAY_SIZE, ! ARRAY_STARTSEARCH}; static char *arrayOptions[] = {"anymore", "donesearch", "exists", "get", "names", "nextelement", "set", "size", "startsearch", ! (char *) NULL}; Var *varPtr, *arrayPtr; Tcl_HashEntry *hPtr; --- 2872,2881 ---- enum {ARRAY_ANYMORE, ARRAY_DONESEARCH, ARRAY_EXISTS, ARRAY_GET, ARRAY_NAMES, ARRAY_NEXTELEMENT, ARRAY_SET, ARRAY_SIZE, ! ARRAY_STARTSEARCH, ARRAY_UNSET}; static char *arrayOptions[] = {"anymore", "donesearch", "exists", "get", "names", "nextelement", "set", "size", "startsearch", ! "unset", (char *) NULL}; Var *varPtr, *arrayPtr; Tcl_HashEntry *hPtr; *************** *** 3233,3238 **** --- 3233,3271 ---- &searchPtr->search); searchPtr->nextPtr = varPtr->searchPtr; varPtr->searchPtr = searchPtr; + break; + } + case ARRAY_UNSET: { + Tcl_HashSearch search; + Var *varPtr2; + char *pattern = NULL; + char *name; + Tcl_Obj *namePtr; + + if ((objc != 3) && (objc != 4)) { + Tcl_WrongNumArgs(interp, 2, objv, "arrayName ?pattern?"); + return TCL_ERROR; + } + if (notArray) { + return TCL_OK; + } + if (objc == 4) { + pattern = Tcl_GetStringFromObj(objv[3], (int *) NULL); + } + for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + varPtr2 = (Var *) Tcl_GetHashValue(hPtr); + if (TclIsVarUndefined(varPtr2)) { + continue; + } + name = Tcl_GetHashKey(varPtr->value.tablePtr, hPtr); + if ((objc == 4) && !Tcl_StringMatch(name, pattern)) { + continue; /* element name doesn't match pattern */ + } + if (Tcl_UnsetVar2(interp, varName, name, 0) != TCL_OK) { + return TCL_ERROR; + } + } break; } } PatchFiles: generic/tclVar.c Added to 8.3 with minor mods. -- 09/15/1999 hobbs - foundin initialized to: "final: 8.0.5"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "add array unset subcommand."
- type initialized to: "RFE"
Ticket change [dbb8dbbf6d] (rid 108008) by welch on 2000-10-26 08:27:11:
- closedate changed to: "2000-10-26T01:27:11"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [ea55d528bf] (rid 103356) by dgp on 2001-04-21 03:49:30:
- foundin changed to: "None"
- status changed to: "Open"
- subsystem changed to: "None"
Ticket change [6af9e38910] (rid 128240) by dgp on 2001-04-21 03:50:09:
- closedate changed to: "2001-04-20T20:50:09"
- closer changed to: "dgp"
- status changed to: "Closed"
- subsystem changed to: "07. Variables"