|
/* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tcl_base/tclwinmtherr.c,v 1.1.1.1 2001/06/13 04:49:20 dtashley Exp $ */ |
|
|
|
|
|
/* |
|
|
* tclWinMtherr.c -- |
|
|
* |
|
|
* This function provides a default implementation of the |
|
|
* _matherr function for Borland C++. |
|
|
* |
|
|
* Copyright (c) 1995 Sun Microsystems, Inc. |
|
|
* |
|
|
* See the file "license.terms" for information on usage and redistribution |
|
|
* of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
|
|
* |
|
|
* RCS: @(#) $Id: tclwinmtherr.c,v 1.1.1.1 2001/06/13 04:49:20 dtashley Exp $ |
|
|
*/ |
|
|
|
|
|
#include "tclWinInt.h" |
|
|
#include <math.h> |
|
|
|
|
|
|
|
|
/* |
|
|
*---------------------------------------------------------------------- |
|
|
* |
|
|
* _matherr -- |
|
|
* |
|
|
* This procedure is invoked by Borland C++ when certain |
|
|
* errors occur in mathematical functions. This procedure |
|
|
* replaces the default implementation which generates pop-up |
|
|
* warnings. |
|
|
* |
|
|
* Results: |
|
|
* Returns 1 to indicate that we've handled the error |
|
|
* locally. |
|
|
* |
|
|
* Side effects: |
|
|
* Sets errno based on what's in xPtr. |
|
|
* |
|
|
*---------------------------------------------------------------------- |
|
|
*/ |
|
|
|
|
|
int |
|
|
_matherr(xPtr) |
|
|
struct exception *xPtr; /* Describes error that occurred. */ |
|
|
{ |
|
|
if (!TclMathInProgress()) { |
|
|
return 0; |
|
|
} |
|
|
if ((xPtr->type == DOMAIN) || (xPtr->type == SING)) { |
|
|
errno = EDOM; |
|
|
} else { |
|
|
errno = ERANGE; |
|
|
} |
|
|
return 1; |
|
|
} |
|
|
|
|
|
|
|
|
/* $History: tclwinmtherr.c $ |
|
|
* |
|
|
* ***************** Version 1 ***************** |
|
|
* User: Dtashley Date: 1/02/01 Time: 12:28a |
|
|
* Created in $/IjuScripter, IjuConsole/Source/Tcl Base |
|
|
* Initial check-in. |
|
|
*/ |
|
|
|
|
|
/* End of TCLWINMTHERR.C */ |
|
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 */ |