Debian Codegraph @

pTk/mTk/tclWin/tclWinMtherr.c

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