Overview
| Artifact ID: | 04d2a7b96e7326566417d519e4022e6d329a51eb |
|---|---|
| Ticket: | 218574ffffffffffffffffffffffffffffffffff
Tcl_ObjGetVar2 and Tcl_ObjSetVar2 |
| User & Date: | nobody on 2000-10-26 01:02:37 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
OriginalBugID: 1263 RFE Version: 8.1b1 SubmitDate: '1999-02-23' LastModified: '1999-03-17' Severity: LOW Status: Released Submitter: pat ChangedBy: stanton OS: Other Machine: NA FixedDate: '1999-03-17' FixedInVersion: 8.1b2 ClosedDate: '2000-10-25' Name: Kevin B. Kenny CVS: * RCS: @(#) $Id: tclVar.c,v 1.1.2.3 1998/11/06 21:51:57 stanton Exp $ DesiredBehavior: It seems a bit gratuitous to eliminate Tcl_ObjGetVar2 and Tcl_ObjSetVar2 from Tcl 8.1. Since Tcl strings are once again null terminated (with UTF-8 used to represent embedded multibyte characters that contain nulls), it would appear safe to implement them as straightforward wrappers around the new Tcl_GetObjVar2 and Tcl_SetObjVar2 functions. That change would avoid breaking a fair amount of existing code. Patch: I've just been adding the following in a separate source file so as not to hack up the Tcl core. It should probably go in tclVar.c, and of course the functions should go back into tcl.h. /* * Tcl_ObjSetVar2 -- * *Given a two-part variable name, which may refer to either a scalar *variable or an element of an array, change the value of the variable *to a new Tcl object value. If the named scalar or array element *doesn't exist, then create it. * * Results: *Returns a pointer to the Tcl_Obj structure that holds the new *value of the variable. If the write operation was disallowed *because an array was expected but a scalar was found (or vice *versa), or because a write trace failed, then NULL is returned. *If the TCL_LEAVE_ERR_MSG flag is set, then an explanatory message *is left in the interpreter's result. Note that the returned object *may not be the same one that was passed in newValuePtr, nor need *it have the same value; write traces could have modified the *value of the variable before Tcl_ObjSetVar2 returns. * * Side effects: *The value of the variable is set. If either the array or the *entry didn't exist, then a new variable is created. * * This function is simply a wrapper around Tcl_SetObjVar2, provided * for compatibility with Tcl 8.0. * *---------------------------------------------------------------------- */ Tcl_Obj* Tcl_ObjSetVar2( interp, part1Ptr, part2Ptr, newValuePtr, flags ) Tcl_Interp* interp;/* Tcl interpreter */ Tcl_Obj* part1Ptr;/* Part 1 of the variable name */ Tcl_Obj* part2Ptr;/* Part 2 of the variable name */ Tcl_Obj* newValuePtr;/* New value of the variable */ int flags;/* OR-ed combination of bits providing * additional information for the operation. */ { return Tcl_SetObjVar2( interp, Tcl_GetString( part1Ptr ), Tcl_GetString( part2Ptr ), newValuePtr, flags ); } /* *---------------------------------------------------------------------- * * Tcl_GetObjVar2 -- * *Return the value of a Tcl variable as a Tcl object, given a *two-part name consisting of array name and element within array. * * Results: *The return value points to the current object value of the variable *given by part1Ptr and part2Ptr. If the specified variable doesn't *exist, or if there is a clash in array usage, then NULL is returned *and a message will be left in the interpreter's result if the *TCL_LEAVE_ERR_MSG flag is set. * * Side effects: *The ref count for the returned object is _not_ incremented to *reflect the returned reference; if you want to keep a reference to *the object you must increment its ref count yourself. * *---------------------------------------------------------------------- */ Tcl_Obj* Tcl_ObjGetVar2( interp, part1Ptr, part2Ptr, flags ) Tcl_Interp* interp;/* Tcl interpreter */ Tcl_Obj* part1;/* Name of the array or variable */ Tcl_Obj* part2;/* Subscript in the array, or NULL */ int flags;/* OR-ed combination of bits providing * additional information for the operation. */ { return Tcl_GetObjVar2( interp, Tcl_GetString( part1Ptr ), Tcl_GetString( part2Ptr ), flags ); } 03/17/1999 17:50 - stanton - Obj*Var2 interfaces were added back to 8.1b2 - foundin changed to: "obsolete: 8.1b1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "69. Other"
- title changed to: "Tcl_ObjGetVar2 and Tcl_ObjSetVar2"
- type changed to: "Bug"