home *** CD-ROM | disk | FTP | other *** search
- From ficc%sugar!texbell!allspice.Berkeley.EDU!ouster Sat Mar 3 18:12:05 1990
- Received: by sugar.hackercorp.com (smail2.5)
- id AA26093; 3 Mar 90 17:54:45 CST (Sat)
- Received: by sugar.hackercorp.com (smail2.5)
- id AA19332; 3 Mar 90 01:11:29 CST (Sat)
- Received: by texbell (/\=-/\ Smail3.1.16.1 #16.6)
- id <m0h4R8G-0000uOC@texbell>; Fri, 2 Mar 90 22:54 CST
- Posted-Date: Fri, 2 Mar 90 08:43:20 PST
- Received: from tyranny.Berkeley.EDU by cs.utexas.edu (5.59/1.50)
- id AA10952; Fri, 2 Mar 90 10:45:46 CST
- Received: by sprite.Berkeley.EDU (5.59/1.29)
- id AA412483; Fri, 2 Mar 90 08:43:20 PST
- Date: Fri, 2 Mar 90 08:43:20 PST
- From: ouster@allspice.Berkeley.EDU (John Ousterhout)
- Message-Id: <9003021643.AA412483@sprite.Berkeley.EDU>
- To: ficc!peter@uunet.uu.net
- Subject: Re: Variables fix
- Cc: peter@sugar.lonestar.org
- Status: O
-
- I hope to have the non-existent-variable patches complete in the
- next week or two. In case that's not soon enough for you, I'm
- returning a copy of your patches at the end of this message.
- >From ficc!peter@uunet.UU.NET Thu Feb 22 21:14:42 1990
- From: ficc!peter@uunet.UU.NET
- To: ouster@sprite.Berkeley.EDU
- Subject: Patches for empty variables.
- Cc: karl@uunet.UU.NET
- Date: Wed Feb 21 16:29:46 1990
-
- The following patches let you differentiate between empty variables
- and non-existant ones.
-
- *** old/tclBasic.c
- --- tcl/tclBasic.c
- ***************
- *** 686,692 ****
- */
-
- value = Tcl_ParseVar(interp, src, &tmp);
- ! if (*value == 0) {
- result = TCL_ERROR;
- goto done;
- }
- --- 686,692 ----
- */
-
- value = Tcl_ParseVar(interp, src, &tmp);
- ! if (value == 0) {
- result = TCL_ERROR;
- goto done;
- }
- ***************
- *** 1211,1216 ****
- --- 1211,1217 ----
- char *buffer, *oldVar;
-
- oldVar = Tcl_GetVar(interp, "errorInfo", 1);
- + if(!oldVar) oldVar = "";
- length = strlen(oldVar);
- buffer = (char *)malloc((unsigned) (length + strlen(message) + 1));
- strcpy(buffer, oldVar);
- *** old/tclExpr.c
- --- tcl/tclExpr.c
- ***************
- *** 250,256 ****
- case '$':
- infoPtr->token = NUMBER;
- var = Tcl_ParseVar(infoPtr->interp, p, &infoPtr->expr);
- ! if (*var == '\0') {
- return TCL_ERROR;
- }
- if (((Interp *) infoPtr->interp)->noEval) {
- --- 250,256 ----
- case '$':
- infoPtr->token = NUMBER;
- var = Tcl_ParseVar(infoPtr->interp, p, &infoPtr->expr);
- ! if (var == 0) {
- return TCL_ERROR;
- }
- if (((Interp *) infoPtr->interp)->noEval) {
- *** old/tclProc.c
- --- tcl/tclProc.c
- ***************
- *** 158,164 ****
- * Results:
- * The return value points to the current value of varName. If
- * the variable is not defined in interp, either as a local or
- ! * global variable, then a pointer to an empty string is returned.
- * Note: the return value is only valid up until the next call to
- * Tcl_SetVar; if you depend on the value lasting longer than that,
- * then make yourself a private copy.
- --- 158,165 ----
- * Results:
- * The return value points to the current value of varName. If
- * the variable is not defined in interp, either as a local or
- ! * global variable, then a NULL pointer is returned.
- ! *
- * Note: the return value is only valid up until the next call to
- * Tcl_SetVar; if you depend on the value lasting longer than that,
- * then make yourself a private copy.
- ***************
- *** 185,191 ****
- varPtr = FindVar(&iPtr->varFramePtr->varPtr, varName);
- }
- if (varPtr == NULL) {
- ! return "";
- }
- if (varPtr->flags & VAR_GLOBAL) {
- varPtr = varPtr->globalPtr;
- --- 186,192 ----
- varPtr = FindVar(&iPtr->varFramePtr->varPtr, varName);
- }
- if (varPtr == NULL) {
- ! return NULL;
- }
- if (varPtr->flags & VAR_GLOBAL) {
- varPtr = varPtr->globalPtr;
- ***************
- *** 323,329 ****
- c = *string;
- *string = 0;
- result = Tcl_GetVar(interp, name, 0);
- ! if (*result == '\0') {
- Tcl_Return(interp, (char *) NULL, TCL_STATIC);
- sprintf(interp->result, "couldn't find variable \"%.50s\"", name);
- }
- --- 324,330 ----
- c = *string;
- *string = 0;
- result = Tcl_GetVar(interp, name, 0);
- ! if (!result) {
- Tcl_Return(interp, (char *) NULL, TCL_STATIC);
- sprintf(interp->result, "couldn't find variable \"%.50s\"", name);
- }
- ***************
- *** 360,366 ****
- char *value;
-
- value = Tcl_GetVar(interp, argv[1], 0);
- ! if (*value == 0) {
- sprintf(interp->result, "couldn't find variable \"%.50s\"",
- argv[1]);
- return TCL_ERROR;
- --- 361,367 ----
- char *value;
-
- value = Tcl_GetVar(interp, argv[1], 0);
- ! if (value == 0) {
- sprintf(interp->result, "couldn't find variable \"%.50s\"",
- argv[1]);
- return TCL_ERROR;
-
-
-