/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: t_ehi1.c,v 1.2 1997/09/25 18:12:20 ae59 Exp $ */
/*
$Log: t_ehi1.c,v $
 * Revision 1.2  1997/09/25  18:12:20  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:25:18  ae59
 * Put under RCS control
 *
 */
#ifdef AIX
#include "/u/p88c/runtime/tbyte/t_defs.h"
#else
#include "t_defs.h"
#endif
#include <stdio.h>

/*--------------------------------------------------------------*
 | Exception Handle IntervallFunktionen mit einem Argument      |
 *--------------------------------------------------------------*/
#ifdef ANSI_C
#ifdef LINT_ARGS
int exc_handle_i1(int fct, int exctype, const IExtReal *arg, IExtReal *res)
#else
int exc_handle_i1(fct, exctype, arg, res)
      int      fct;        /* FunktionsNummer                   */
      int      exctype;    /* ExceptionNummer                   */
const IExtReal *arg;
      IExtReal *res;
#endif /* LINT_ARGS */
#else  /* NOT ANSI_C */
#ifdef LINT_ARGS
int exc_handle_i1(int fct, int exctype, IExtReal *arg, IExtReal *res)
#else
int exc_handle_i1(fct, exctype, arg, res)
int      fct;              /* FunktionsNummer                   */
int      exctype;          /* ExceptionNummer                   */
IExtReal *arg;
IExtReal *res;
#endif /* LINT_ARGS */
#endif /* ANSI_C */
{
   struct ieee_exception exc;
   IExtReal              ia2;
   IExtReal              ir;
   char     *name;         /* NamensString der Funktion         */

   /* --- kopiere, falls arg==res --- */
   icopyee(res, &ir);

   /* --- hole Standard Antwort und FunktionsName --- */
   default_handle_i1(fct, exctype, arg, &ir);
   excfct_to_a(fct, &name);

   /* --- matherr vorbereiten --- */
   copyee(&Zero,  &ia2.u);
   copyee(&Zero,  &ia2.l);

   exc.type = exctype;
   exc.name = name;
   exc.arg1 = arg;
   exc.arg2 = &ia2;
   exc.res  = &ir;

   /* --- Aufruf AnwenderFunktion --- */
   if (TakeOver==ieee_matherr(&exc)) {

      /* --- Uebernahme vom Anwender gesetzter Werte, Ende --- */
      icopyee(exc.res, res);
      return exc.type;
   }

   /* --- sonst Ausgabe der unveraenderten FunktionsParameter --- */
   msg_exctyp(exc.type, name);
/*   msg_exc("arg.u", &(arg->u));
   msg_exc("arg.l", &(arg->l));
   msg_exc("res.u", &ir.u);
   msg_exc("res.l", &ir.l); */

   /* --- kopiere default Antwort nach res (erst hier, falls arg==res) --- */
   icopyee(&ir, res);

   return exctype;
} /* except_handle_i1() */
