sl@0
|
1 |
/*
|
sl@0
|
2 |
* tclWinMtherr.c --
|
sl@0
|
3 |
*
|
sl@0
|
4 |
* This function provides a default implementation of the
|
sl@0
|
5 |
* _matherr function for Borland C++.
|
sl@0
|
6 |
*
|
sl@0
|
7 |
* Copyright (c) 1995 Sun Microsystems, Inc.
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* See the file "license.terms" for information on usage and redistribution
|
sl@0
|
10 |
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* RCS: @(#) $Id: tclWinMtherr.c,v 1.5 2002/05/31 22:20:22 dgp Exp $
|
sl@0
|
13 |
*/
|
sl@0
|
14 |
|
sl@0
|
15 |
#include "tclWinInt.h"
|
sl@0
|
16 |
#include <math.h>
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/*
|
sl@0
|
20 |
*----------------------------------------------------------------------
|
sl@0
|
21 |
*
|
sl@0
|
22 |
* _matherr --
|
sl@0
|
23 |
*
|
sl@0
|
24 |
* This procedure is invoked by Borland C++ when certain
|
sl@0
|
25 |
* errors occur in mathematical functions. This procedure
|
sl@0
|
26 |
* replaces the default implementation which generates pop-up
|
sl@0
|
27 |
* warnings.
|
sl@0
|
28 |
*
|
sl@0
|
29 |
* Results:
|
sl@0
|
30 |
* Returns 1 to indicate that we've handled the error
|
sl@0
|
31 |
* locally.
|
sl@0
|
32 |
*
|
sl@0
|
33 |
* Side effects:
|
sl@0
|
34 |
* Sets errno based on what's in xPtr.
|
sl@0
|
35 |
*
|
sl@0
|
36 |
*----------------------------------------------------------------------
|
sl@0
|
37 |
*/
|
sl@0
|
38 |
|
sl@0
|
39 |
int
|
sl@0
|
40 |
_matherr(xPtr)
|
sl@0
|
41 |
struct exception *xPtr; /* Describes error that occurred. */
|
sl@0
|
42 |
{
|
sl@0
|
43 |
if ((xPtr->type == DOMAIN)
|
sl@0
|
44 |
#ifdef __BORLANDC__
|
sl@0
|
45 |
|| (xPtr->type == TLOSS)
|
sl@0
|
46 |
#endif
|
sl@0
|
47 |
|| (xPtr->type == SING)) {
|
sl@0
|
48 |
errno = EDOM;
|
sl@0
|
49 |
} else {
|
sl@0
|
50 |
errno = ERANGE;
|
sl@0
|
51 |
}
|
sl@0
|
52 |
return 1;
|
sl@0
|
53 |
}
|