diff options
| author | kjnash <k.j.nash@usa.net> | 2022-08-31 14:28:57 (GMT) |
|---|---|---|
| committer | kjnash <k.j.nash@usa.net> | 2022-08-31 14:28:57 (GMT) |
| commit | 19f8c3bb6b2aa8d571a7534b588ddacfb49952d3 (patch) | |
| tree | 5051f34456c20c798d30e7741fae52575927fd7a /generic/tclProc.c | |
| parent | d9b5be0959a8ee2b81ba519ff3d4c70b2da9a6ce (diff) | |
| parent | ff1e919a1bae9ff88ab6dbc094b18cfadedfe8af (diff) | |
| download | tcl-19f8c3bb6b2aa8d571a7534b588ddacfb49952d3.zip tcl-19f8c3bb6b2aa8d571a7534b588ddacfb49952d3.tar.gz tcl-19f8c3bb6b2aa8d571a7534b588ddacfb49952d3.tar.bz2 | |
Merge old 8.7 674a6ad0472c7
Diffstat (limited to 'generic/tclProc.c')
| -rw-r--r-- | generic/tclProc.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index 0d67c37..20af5fe 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -632,7 +632,8 @@ TclCreateProc( * local variables for the argument. */ - localPtr = (CompiledLocal *)ckalloc(offsetof(CompiledLocal, name) + fieldValues[0]->length +1); + localPtr = (CompiledLocal *)ckalloc( + offsetof(CompiledLocal, name) + fieldValues[0]->length + 1); if (procPtr->firstLocalPtr == NULL) { procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr; } else { @@ -909,9 +910,28 @@ TclNRUplevelObjCmd( Tcl_Obj *objPtr; if (objc < 2) { + /* to do + * simplify things by interpreting the argument as a command when there + * is only one argument. This requires a TIP since currently a single + * argument is interpreted as a level indicator if possible. + */ uplevelSyntax: Tcl_WrongNumArgs(interp, 1, objv, "?level? command ?arg ...?"); return TCL_ERROR; + } else if (!TclHasStringRep(objv[1]) && objc == 2) { + int status ,llength; + status = Tcl_ListObjLength(interp, objv[1], &llength); + if (status == TCL_OK && llength > 1) { + /* the first argument can't interpreted as a level. Avoid + * generating a string representation of the script. */ + result = TclGetFrame(interp, "1", &framePtr); + if (result == -1) { + return TCL_ERROR; + } + objc -= 1; + objv += 1; + goto havelevel; + } } /* @@ -928,6 +948,8 @@ TclNRUplevelObjCmd( } objv += result + 1; + havelevel: + /* * Modify the interpreter state to execute in the given frame. */ @@ -1313,8 +1335,8 @@ InitLocalCache( * for future calls. */ - localCachePtr = (LocalCache *)ckalloc(sizeof(LocalCache) - + (localCt - 1) * sizeof(Tcl_Obj *) + localCachePtr = (LocalCache *)ckalloc(offsetof(LocalCache, varName0) + + localCt * sizeof(Tcl_Obj *) + numArgs * sizeof(Var)); namePtr = &localCachePtr->varName0; |
