os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/win/tclWinMtherr.c
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/win/tclWinMtherr.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,53 @@
1.4 +/*
1.5 + * tclWinMtherr.c --
1.6 + *
1.7 + * This function provides a default implementation of the
1.8 + * _matherr function for Borland C++.
1.9 + *
1.10 + * Copyright (c) 1995 Sun Microsystems, Inc.
1.11 + *
1.12 + * See the file "license.terms" for information on usage and redistribution
1.13 + * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.14 + *
1.15 + * RCS: @(#) $Id: tclWinMtherr.c,v 1.5 2002/05/31 22:20:22 dgp Exp $
1.16 + */
1.17 +
1.18 +#include "tclWinInt.h"
1.19 +#include <math.h>
1.20 +
1.21 +
1.22 +/*
1.23 + *----------------------------------------------------------------------
1.24 + *
1.25 + * _matherr --
1.26 + *
1.27 + * This procedure is invoked by Borland C++ when certain
1.28 + * errors occur in mathematical functions. This procedure
1.29 + * replaces the default implementation which generates pop-up
1.30 + * warnings.
1.31 + *
1.32 + * Results:
1.33 + * Returns 1 to indicate that we've handled the error
1.34 + * locally.
1.35 + *
1.36 + * Side effects:
1.37 + * Sets errno based on what's in xPtr.
1.38 + *
1.39 + *----------------------------------------------------------------------
1.40 + */
1.41 +
1.42 +int
1.43 +_matherr(xPtr)
1.44 + struct exception *xPtr; /* Describes error that occurred. */
1.45 +{
1.46 + if ((xPtr->type == DOMAIN)
1.47 +#ifdef __BORLANDC__
1.48 + || (xPtr->type == TLOSS)
1.49 +#endif
1.50 + || (xPtr->type == SING)) {
1.51 + errno = EDOM;
1.52 + } else {
1.53 + errno = ERANGE;
1.54 + }
1.55 + return 1;
1.56 +}