home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tclX6.5c / src / tclXmatherr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  2.0 KB  |  65 lines

  1. /* 
  2.  * tclXmatherr.c --
  3.  *
  4.  *   Extended Tcl default matherr routine, may be replace by an application
  5.  *   specified version.
  6.  *-----------------------------------------------------------------------------
  7.  * Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  8.  *
  9.  * Permission to use, copy, modify, and distribute this software and its
  10.  * documentation for any purpose and without fee is hereby granted, provided
  11.  * that the above copyright notice appear in all copies.  Karl Lehenbauer and
  12.  * Mark Diekhans make no representations about the suitability of this
  13.  * software for any purpose.  It is provided "as is" without express or
  14.  * implied warranty.
  15.  *-----------------------------------------------------------------------------
  16.  * $Id: tclXmatherr.c,v 2.1 1992/11/09 07:33:02 markd Exp $
  17.  *-----------------------------------------------------------------------------
  18.  */
  19.  
  20. #ifndef TCL_IEEE_FP_MATH
  21.  
  22. #include <math.h>
  23.  
  24. /*
  25.  *-----------------------------------------------------------------------------
  26.  *
  27.  * matherr --
  28.  *    Default matherr routine for extended Tcl.  If the error does not
  29.  *  belong to Tcl, standard math error processing is done.  An
  30.  *  aplication may replace this routine with their own, however it must
  31.  *  call \fBTcl_MathError\fR to check if the error belongs to tcl.
  32.  *
  33.  *-----------------------------------------------------------------------------
  34.  */
  35. int
  36. matherr (except)
  37.     struct exception *except;
  38. {
  39.     if (Tcl_MathError (except->name, except->type))
  40.         return 1;
  41.     else
  42.         return 0;
  43. }
  44.  
  45. #else
  46.  
  47. /*
  48.  *-----------------------------------------------------------------------------
  49.  *
  50.  * matherr --
  51.  *    Dummy matherr for systems wanting to use IEEE 745-1985 floating point
  52.  * math error reporting.  This just disables standard Unix matherr message
  53.  * printing by returning 1.  Except parameter not specified, since some systems
  54.  * don't define it or even use matherr.
  55.  *
  56.  *-----------------------------------------------------------------------------
  57.  */
  58. int
  59. matherr ()
  60. {
  61.     return 1;
  62. }
  63.  
  64. #endif /* TCL_IEEE_FP_MATH */
  65.