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