Tcl Source Code

Attachment Details
Login
Overview

Artifact ID: 671498b2d8be96d85f9316f2cf1adc4784a4e2ed
Ticket: 555635ffffffffffffffffffffffffffffffffff
Date: 2002-05-14 05:00:49
User: jenglish
Artifact Attached: 517bf3cb1070fefcd7e820e67ad00faeaaa19aeb
Filename:matherr-patch.txt
Description:Remove unix/tclMtherr.c and related code
Content:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
   100
   101
   102
   103
   104
   105
   106
   107
   108
   109
   110
   111
   112
   113
   114
   115
   116
   117
   118
   119
   120
   121
   122
   123
   124
   125
   126
   127
   128
   129
   130
   131
   132
   133
   134
   135
   136
   137
   138
   139
   140
   141
   142
   143
   144
   145
   146
   147
   148
   149
   150
   151
   152
   153
   154
   155
   156
   157
   158
   159
   160
   161
   162
   163
   164
   165
   166
   167
   168
   169
   170
   171
   172
   173
   174
   175
   176
   177
   178
   179
   180
   181
   182
   183
   184
   185
   186
   187
   188
   189
   190
   191
   192
   193
   194
   195
   196
   197
   198
   199
   200
   201
   202
   203
   204
   205
   206
   207
   208
   209
   210
   211
   212
   213
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)