sl@0: /* sl@0: * tclWinMtherr.c -- sl@0: * sl@0: * This function provides a default implementation of the sl@0: * _matherr function for Borland C++. sl@0: * sl@0: * Copyright (c) 1995 Sun Microsystems, Inc. sl@0: * sl@0: * See the file "license.terms" for information on usage and redistribution sl@0: * of this file, and for a DISCLAIMER OF ALL WARRANTIES. sl@0: * sl@0: * RCS: @(#) $Id: tclWinMtherr.c,v 1.5 2002/05/31 22:20:22 dgp Exp $ sl@0: */ sl@0: sl@0: #include "tclWinInt.h" sl@0: #include sl@0: sl@0: sl@0: /* sl@0: *---------------------------------------------------------------------- sl@0: * sl@0: * _matherr -- sl@0: * sl@0: * This procedure is invoked by Borland C++ when certain sl@0: * errors occur in mathematical functions. This procedure sl@0: * replaces the default implementation which generates pop-up sl@0: * warnings. sl@0: * sl@0: * Results: sl@0: * Returns 1 to indicate that we've handled the error sl@0: * locally. sl@0: * sl@0: * Side effects: sl@0: * Sets errno based on what's in xPtr. sl@0: * sl@0: *---------------------------------------------------------------------- sl@0: */ sl@0: sl@0: int sl@0: _matherr(xPtr) sl@0: struct exception *xPtr; /* Describes error that occurred. */ sl@0: { sl@0: if ((xPtr->type == DOMAIN) sl@0: #ifdef __BORLANDC__ sl@0: || (xPtr->type == TLOSS) sl@0: #endif sl@0: || (xPtr->type == SING)) { sl@0: errno = EDOM; sl@0: } else { sl@0: errno = ERANGE; sl@0: } sl@0: return 1; sl@0: }