OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [win/] [tclWinMtherr.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
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.1.1.1 2002-01-16 10:25:38 markom Exp $
13
 */
14
 
15
#include "tclInt.h"
16
#include "tclPort.h"
17
#include <math.h>
18
 
19
/*
20
 * The following variable is secretly shared with Tcl so we can
21
 * tell if expression evaluation is in progress.  If not, matherr
22
 * just emulates the default behavior, which includes printing
23
 * a message.
24
 */
25
 
26
extern int tcl_MathInProgress;
27
 
28
/*
29
 *----------------------------------------------------------------------
30
 *
31
 * _matherr --
32
 *
33
 *      This procedure is invoked by Borland C++ when certain
34
 *      errors occur in mathematical functions.  This procedure
35
 *      replaces the default implementation which generates pop-up
36
 *      warnings.
37
 *
38
 * Results:
39
 *      Returns 1 to indicate that we've handled the error
40
 *      locally.
41
 *
42
 * Side effects:
43
 *      Sets errno based on what's in xPtr.
44
 *
45
 *----------------------------------------------------------------------
46
 */
47
 
48
int
49
_matherr(xPtr)
50
    struct exception *xPtr;     /* Describes error that occurred. */
51
{
52
    if (!tcl_MathInProgress) {
53
        return 0;
54
    }
55
    if ((xPtr->type == DOMAIN) || (xPtr->type == SING)) {
56
        errno = EDOM;
57
    } else {
58
        errno = ERANGE;
59
    }
60
    return 1;
61
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.