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