/*
 * SUMMARY:      RestoreErrorHandling.c - Reset system error handlers
 * USAGE:        Part of DHSVM
 *
 * AUTHOR:       Bart Nijssen
 * ORG:          University of Washington, Department of Civil Engineering
 * E-MAIL:       nijssen@u.washington.edu
 * ORIG-DATE:    Apr-96
 * LAST-MOD:     23-Aug-96 at 16:16:07 by DHSVM Project Account
 * DESCRIPTION:  Reset system error handlers
 * DESCRIP-END.
 * FUNCTIONS:    RestoreErrorHandling()
 * COMMENTS:     
 */

#ifndef lint
static char vcid[] = "$Id: RestoreErrorHandling.c,v 1.2 2001/03/31 00:10:34 waichler Exp $";
#endif /* lint */

#include <stdio.h>
#include <stdlib.h>
#include "DHSVMerror.h"

/* The parts that are only executed ifdef plane_ieee are added to allow better 
   exception handling when running DHSVM on plane  - Sun Sparc20 workstation,  
   Solaris OS.  In this case the makefile needs to include the CFLAGS -fnonstd 
   and -Dplane_ieee, as well as the libraries "sunmath" and 
   "/opt/SUNWspro/SC3.0.1/lib" */

#ifdef plane_ieee
#include <sunmath.h>
#include "errorplane.h"
#endif

void RestoreErrorHandling(void)
{
#ifdef plane_ieee
 
  printf("Restoring IEEE FP exception handlers\n");

  (void) ieee_handler("set", "inexact", OldHandler[0]);
  (void) ieee_handler("set", "division", OldHandler[1]);
  (void) ieee_handler("set", "underflow", OldHandler[2]);
  (void) ieee_handler("set", "overflow", OldHandler[3]);
  (void) ieee_handler("set", "invalid", OldHandler[4]);

#endif
}



