diff -r -c tcl8.2.0/generic/tclCompExpr.c tcl8.2.0-expr/generic/tclCompExpr.c
*** tcl8.2.0/generic/tclCompExpr.c	Thu Apr 15 18:46:44 1999
--- tcl8.2.0-expr/generic/tclCompExpr.c	Sun Aug 29 11:58:19 1999
***************
*** 912,918 ****
   *
   *----------------------------------------------------------------------
   */
- 
  static int
  CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr)
      Tcl_Token *exprTokenPtr;	/* Points to TCL_TOKEN_SUB_EXPR token
--- 912,917 ----
***************
*** 939,957 ****
      code = TCL_OK;
      maxDepth = 0;
      hPtr = Tcl_FindHashEntry(&iPtr->mathFuncTable, funcName);
!     if (hPtr == NULL) {
! 	Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
! 		"unknown math function \"", funcName, "\"", (char *) NULL);
! 	code = TCL_ERROR;
! 	goto done;
      }
-     mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr);
  
      /*
       * If not a builtin function, push an object with the function's name.
       */
  
!     if (mathFuncPtr->builtinFuncIndex < 0) {
  	TclEmitPush(TclRegisterLiteral(envPtr, funcName, -1, /*onHeap*/ 0),
  	        envPtr);
  	maxDepth = 1;
--- 938,952 ----
      code = TCL_OK;
      maxDepth = 0;
      hPtr = Tcl_FindHashEntry(&iPtr->mathFuncTable, funcName);
!     if (hPtr != NULL) {
!       mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr);
      }
  
      /*
       * If not a builtin function, push an object with the function's name.
       */
  
!     if (hPtr == NULL || mathFuncPtr->builtinFuncIndex < 0) {
  	TclEmitPush(TclRegisterLiteral(envPtr, funcName, -1, /*onHeap*/ 0),
  	        envPtr);
  	maxDepth = 1;
***************
*** 963,1007 ****
  
      tokenPtr = exprTokenPtr+2;
      afterSubexprPtr = exprTokenPtr + (exprTokenPtr->numComponents + 1);
!     if (mathFuncPtr->numArgs > 0) {
! 	for (i = 0;  i < mathFuncPtr->numArgs;  i++) {
! 	    if (tokenPtr == afterSubexprPtr) {
! 		Tcl_ResetResult(interp);
! 		Tcl_AppendToObj(Tcl_GetObjResult(interp),
! 		        "too few arguments for math function", -1);
! 		code = TCL_ERROR;
! 		goto done;
! 	    }
! 	    infoPtr->exprIsComparison = 0;
! 	    code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
! 	    if (code != TCL_OK) {
! 		goto done;
! 	    }
! 	    tokenPtr += (tokenPtr->numComponents + 1);
! 	    maxDepth++;
  	}
! 	if (tokenPtr != afterSubexprPtr) {
! 	    Tcl_ResetResult(interp);
  	    Tcl_AppendToObj(Tcl_GetObjResult(interp),
! 		    "too many arguments for math function", -1);
! 	    code = TCL_ERROR;
! 	    goto done;
! 	} 
!     } else if (tokenPtr != afterSubexprPtr) {
! 	Tcl_ResetResult(interp);
! 	Tcl_AppendToObj(Tcl_GetObjResult(interp),
! 		"too many arguments for math function", -1);
  	code = TCL_ERROR;
  	goto done;
      }
!     
      /*
       * Compile the call on the math function. Note that the "objc" argument
       * count for non-builtin functions is incremented by 1 to include the
       * function name itself.
       */
  
!     if (mathFuncPtr->builtinFuncIndex >= 0) { /* a builtin function */
  	TclEmitInstInt1(INST_CALL_BUILTIN_FUNC1, 
  	        mathFuncPtr->builtinFuncIndex, envPtr);
      } else {
--- 958,998 ----
  
      tokenPtr = exprTokenPtr+2;
      afterSubexprPtr = exprTokenPtr + (exprTokenPtr->numComponents + 1);
!     for (i = 0; tokenPtr != afterSubexprPtr; i += 1) {
!         infoPtr->exprIsComparison = 0;
!         code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
! 	if (code != TCL_OK) {
! 	    goto done;
  	}
! 	tokenPtr += (tokenPtr->numComponents + 1);
! 	maxDepth++;
!     }
!     if (hPtr != NULL && mathFuncPtr->numArgs != i) {
!         Tcl_ResetResult(interp);
!         if (mathFuncPtr->numArgs < i) {
  	    Tcl_AppendToObj(Tcl_GetObjResult(interp),
! 			    "too many arguments for math function", -1);
! 	} else if (mathFuncPtr->numArgs > i) {
! 	    Tcl_AppendToObj(Tcl_GetObjResult(interp),
! 			    "too few arguments for math function", -1);
! 	}
  	code = TCL_ERROR;
  	goto done;
      }
! 
      /*
       * Compile the call on the math function. Note that the "objc" argument
       * count for non-builtin functions is incremented by 1 to include the
       * function name itself.
       */
  
!     if (hPtr == NULL) {
!         if (i+1 <= 255) {
! 	    TclEmitInstInt1(INST_INVOKE_STK1, i+1, envPtr);
! 	} else {
! 	    TclEmitInstInt4(INST_INVOKE_STK4, i+1, envPtr);
! 	}
!     } else if (mathFuncPtr->builtinFuncIndex >= 0) { /* a builtin function */
  	TclEmitInstInt1(INST_CALL_BUILTIN_FUNC1, 
  	        mathFuncPtr->builtinFuncIndex, envPtr);
      } else {
diff -r -c tcl8.2.0/generic/tclParseExpr.c tcl8.2.0-expr/generic/tclParseExpr.c
*** tcl8.2.0/generic/tclParseExpr.c	Wed Apr 21 15:50:28 1999
--- tcl8.2.0-expr/generic/tclParseExpr.c	Sun Aug 29 14:09:28 1999
***************
*** 1354,1360 ****
  	
      case FUNC_NAME:
  	/*
! 	 * math_func '(' expr {',' expr} ')'
  	 */
  	
  	if (parsePtr->numTokens == parsePtr->tokensAvailable) {
--- 1354,1360 ----
  	
      case FUNC_NAME:
  	/*
! 	 * math_func { '(' expr {',' expr} ')' }
  	 */
  	
  	if (parsePtr->numTokens == parsePtr->tokensAvailable) {
***************
*** 1366,1398 ****
  	tokenPtr->size = infoPtr->size;
  	tokenPtr->numComponents = 0;
  	parsePtr->numTokens++;
! 	
  	code = GetLexeme(infoPtr); /* skip over function name */
  	if (code != TCL_OK) {
  	    return code;
  	}
- 	if (infoPtr->lexeme != OPEN_PAREN) {
- 	    goto syntaxError;
- 	}
- 	code = GetLexeme(infoPtr); /* skip over '(' */
- 	if (code != TCL_OK) {
- 	    return code;
- 	}
  
! 	while (infoPtr->lexeme != CLOSE_PAREN) {
! 	    code = ParseCondExpr(infoPtr);
  	    if (code != TCL_OK) {
! 		return code;
  	    }
! 	    
! 	    if (infoPtr->lexeme == COMMA) {
! 		code = GetLexeme(infoPtr); /* skip over , */
  		if (code != TCL_OK) {
  		    return code;
  		}
! 	    } else if (infoPtr->lexeme != CLOSE_PAREN) {
! 		goto syntaxError;
  	    }
  	}
  
  	exprTokenPtr = &parsePtr->tokenPtr[exprIndex];
--- 1366,1415 ----
  	tokenPtr->size = infoPtr->size;
  	tokenPtr->numComponents = 0;
  	parsePtr->numTokens++;
! 
  	code = GetLexeme(infoPtr); /* skip over function name */
  	if (code != TCL_OK) {
  	    return code;
  	}
  
! 	if (infoPtr->lexeme == OPEN_PAREN) {
! 
! 	    code = GetLexeme(infoPtr); /* skip over '(' */
  	    if (code != TCL_OK) {
! 	        return code;
  	    }
! 
! 	    while (infoPtr->lexeme != CLOSE_PAREN) {
! 	        code = ParseCondExpr(infoPtr);
  		if (code != TCL_OK) {
  		    return code;
  		}
! 	    
! 		if (infoPtr->lexeme == COMMA) {
! 		    code = GetLexeme(infoPtr); /* skip over , */
! 		    if (code != TCL_OK) {
! 		        return code;
! 		    }
! 		} else if (infoPtr->lexeme != CLOSE_PAREN) {
! 		    goto syntaxError;
! 		}
  	    }
+ 
+ 	} else {
+ 
+ 	    tokenPtr->type = TCL_TOKEN_VARIABLE; /* rewrite to var ref */
+ 	    tokenPtr->numComponents = 1;
+ 	    if (parsePtr->numTokens == parsePtr->tokensAvailable) {
+ 	        TclExpandTokenArray(parsePtr);
+ 	    }
+ 	    tokenPtr = &parsePtr->tokenPtr[parsePtr->numTokens];
+ 	    tokenPtr->type = TCL_TOKEN_TEXT;
+ 	    tokenPtr->start = tokenPtr[-1].start;
+ 	    tokenPtr->size = tokenPtr[-1].size;
+ 	    tokenPtr->numComponents = 0;
+ 	    parsePtr->numTokens++;
+ 
+ 	    infoPtr->next = tokenPtr->start+tokenPtr->size;
  	}
  
  	exprTokenPtr = &parsePtr->tokenPtr[exprIndex];
***************
*** 1716,1731 ****
  	    return TCL_OK;
  
  	default:
! 	    offset = Tcl_UtfToUniChar(src, &ch);
! 	    c = UCHAR(ch);
! 	    if (isalpha(UCHAR(c))) {	/* INTL: ISO only. */
! 		infoPtr->lexeme = FUNC_NAME;
! 		while (isalnum(UCHAR(c)) || (c == '_')) { /* INTL: ISO only. */
  		    src += offset;
! 		    offset = Tcl_UtfToUniChar(src, &ch);
! 		    c = UCHAR(ch);
  		}
! 		infoPtr->size = (src - infoPtr->start);
  		infoPtr->next = src;
  		parsePtr->term = infoPtr->next;
  		return TCL_OK;
--- 1733,1762 ----
  	    return TCL_OK;
  
  	default:
! 	    /*
! 	     * Parse FUNC_NAME using same rules as Tcl_ParseVarName()
! 	     * does for reading simple names, specifically, allow
! 	     * namespace :: delimiters.
! 	     */
! 	    while (src != infoPtr->lastChar) {
! 	        offset = Tcl_UtfToUniChar(src, &ch);
! 		c = UCHAR(ch);
! 		if (isalnum(c) || (c == '_')) { /* INTL: ISO only, UCHAR. */
  		    src += offset;
! 		    continue;
! 		}
! 		if ((c == ':') && (((src+1) != infoPtr->lastChar) && (src[1] == ':'))) {
! 		    src += 2;
! 		    while ((src != infoPtr->lastChar) && (*src == ':')) {
! 		        src += 1;
! 		    }
! 		    continue;
  		}
! 		break;
! 	    }
! 	    if ((src - infoPtr->start) > 0) {
! 		infoPtr->lexeme = FUNC_NAME;
! 	        infoPtr->size = (src - infoPtr->start);
  		infoPtr->next = src;
  		parsePtr->term = infoPtr->next;
  		return TCL_OK;
