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