Tcl Source Code

Artifact [517bf3cb10]
Login

Artifact 517bf3cb1070fefcd7e820e67ad00faeaaa19aeb:

Attachment "matherr-patch.txt" to ticket [555635ffff] added by jenglish 2002-05-14 05:00:49.
Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.53
diff -u -r1.53 tclExecute.c
--- generic/tclExecute.c	18 Apr 2002 13:04:20 -0000	1.53
+++ generic/tclExecute.c	13 May 2002 21:05:53 -0000
@@ -66,33 +66,6 @@
 int tclTraceExec = 0;
 #endif
 
-typedef struct ThreadSpecificData {
-    /*
-     * The following global variable is use to signal matherr that Tcl
-     * is responsible for the arithmetic, so errors can be handled in a
-     * fashion appropriate for Tcl.  Zero means no Tcl math is in
-     * progress;  non-zero means Tcl is doing math.
-     */
-    
-    int mathInProgress;
-
-} ThreadSpecificData;
-
-static Tcl_ThreadDataKey dataKey;
-
-/*
- * The variable below serves no useful purpose except to generate
- * a reference to matherr, so that the Tcl version of matherr is
- * linked in rather than the system version. Without this reference
- * the need for matherr won't be discovered during linking until after
- * libtcl.a has been processed, so Tcl's version won't be used.
- */
-
-#ifdef NEED_MATHERR
-extern int matherr();
-int (*tclMatherrPtr)() = matherr;
-#endif
-
 /*
  * Mapping from expression instruction opcodes to strings; used for error
  * messages. Note that these entries must match the order and number of the
@@ -3912,7 +3885,6 @@
 		 */
 
 		BuiltinFunc *mathFuncPtr;
-		ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
 		if ((opnd < 0) || (opnd > LAST_BUILTIN_FUNC)) {
 		    TRACE(("UNRECOGNIZED BUILTIN FUNC CODE %d\n", opnd));
@@ -3920,10 +3892,8 @@
 		}
 		mathFuncPtr = &(builtinFuncTable[opnd]);
 		DECACHE_STACK_INFO();
-		tsdPtr->mathInProgress++;
 		result = (*mathFuncPtr->proc)(interp, eePtr,
 		        mathFuncPtr->clientData);
-		tsdPtr->mathInProgress--;
 		CACHE_STACK_INFO();
 		if (result != TCL_OK) {
 		    goto checkForCatch;
@@ -3944,13 +3914,10 @@
 				    * is the 0-th argument. */
 		Tcl_Obj **objv;	   /* The array of arguments. The function
 				    * name is objv[0]. */
-		ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
 		objv = &(stackPtr[stackTop - (objc-1)]); /* "objv[0]" */
 		DECACHE_STACK_INFO();
-		tsdPtr->mathInProgress++;
 		result = ExprCallMathFunc(interp, eePtr, objc, objv);
-		tsdPtr->mathInProgress--;
 		CACHE_STACK_INFO();
 		if (result != TCL_OK) {
 		    goto checkForCatch;
@@ -5651,7 +5618,6 @@
     long i;
     double d;
     int j, k, result;
-    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
     Tcl_ResetResult(interp);
 
@@ -5749,10 +5715,8 @@
      * Invoke the function and copy its result back into valuePtr.
      */
 
-    tsdPtr->mathInProgress++;
     result = (*mathFuncPtr->proc)(mathFuncPtr->clientData, interp, args,
 	    &funcResult);
-    tsdPtr->mathInProgress--;
     if (result != TCL_OK) {
 	goto done;
     }
@@ -5840,30 +5804,6 @@
 	Tcl_AppendToObj(Tcl_GetObjResult(interp), msg, -1);
 	Tcl_SetErrorCode(interp, "ARITH", "UNKNOWN", msg, (char *) NULL);
     }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TclMathInProgress --
- *
- *	This procedure is called to find out if Tcl is doing math
- *	in this thread.
- *
- * Results:
- *	0 or 1.
- *
- * Side effects:
- *	None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TclMathInProgress()
-{
-    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-    return tsdPtr->mathInProgress;
 }
 
 #ifdef TCL_COMPILE_STATS
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.87
diff -u -r1.87 tclInt.h
--- generic/tclInt.h	13 May 2002 13:20:00 -0000	1.87
+++ generic/tclInt.h	13 May 2002 21:05:53 -0000
@@ -1778,7 +1778,6 @@
 						 Tcl_Obj *CONST indexArray[],
 						 Tcl_Obj* valuePtr
 						 ));
-EXTERN int		TclMathInProgress _ANSI_ARGS_((void));
 EXTERN Tcl_Obj *	TclNewProcBodyObj _ANSI_ARGS_((Proc *procPtr));
 EXTERN int		TclObjCommandComplete _ANSI_ARGS_((Tcl_Obj *cmdPtr));
 EXTERN int		TclObjInterpProc _ANSI_ARGS_((ClientData clientData,
Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.98
diff -u -r1.98 Makefile.in
--- unix/Makefile.in	23 Apr 2002 05:41:03 -0000	1.98
+++ unix/Makefile.in	13 May 2002 21:05:54 -0000
@@ -123,7 +123,7 @@
 # the current one does).
 GENERIC_FLAGS =
 #GENERIC_FLAGS = -DTCL_GENERIC_ONLY
-UNIX_OBJS = tclMtherr.o tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \
+UNIX_OBJS = tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \
 	tclUnixFile.o tclUnixPipe.o tclUnixSock.o \
 	tclUnixTime.o tclUnixInit.o tclUnixThrd.o 
 #UNIX_OBJS =
@@ -378,7 +378,6 @@
 
 UNIX_SRCS = \
 	$(UNIX_DIR)/tclAppInit.c \
-	$(UNIX_DIR)/tclMtherr.c \
 	$(UNIX_DIR)/tclUnixChan.c \
 	$(UNIX_DIR)/tclUnixEvent.c \
 	$(UNIX_DIR)/tclUnixFCmd.c \
@@ -888,9 +887,6 @@
 
 tclMain.o: $(GENERIC_DIR)/tclMain.c
 	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclMain.c
-
-tclMtherr.o: $(UNIX_DIR)/tclMtherr.c
-	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclMtherr.c
 
 tclNamesp.o: $(GENERIC_DIR)/tclNamesp.c
 	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclNamesp.c
Index: unix/tclAppInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclAppInit.c,v
retrieving revision 1.10
diff -u -r1.10 tclAppInit.c
--- unix/tclAppInit.c	12 Feb 2002 14:23:33 -0000	1.10
+++ unix/tclAppInit.c	13 May 2002 21:05:54 -0000
@@ -16,15 +16,6 @@
 
 #include "tcl.h"
 
-/*
- * The following variable is a special hack that is needed in order for
- * Sun shared libraries to be used for Tcl.
- */
-
-extern int matherr();
-int *tclDummyMathPtr = (int *) matherr;
-
-
 #ifdef TCL_TEST
 
 #include "tclInt.h"
Index: win/tclWinMtherr.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinMtherr.c,v
retrieving revision 1.4
diff -u -r1.4 tclWinMtherr.c
--- win/tclWinMtherr.c	15 Feb 2002 14:28:51 -0000	1.4
+++ win/tclWinMtherr.c	13 May 2002 21:05:54 -0000
@@ -40,9 +40,6 @@
 _matherr(xPtr)
     struct exception *xPtr;	/* Describes error that occurred. */
 {
-    if (!TclMathInProgress()) {
-	return 0;
-    }
     if ((xPtr->type == DOMAIN)
 #ifdef __BORLANDC__
 	    || (xPtr->type == TLOSS)