/**************************************************************************/
/*                                                                        */
/*                                 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_iabt.c,v 1.2 1997/09/25 18:14:35 ae59 Exp $ */
/*
$Log: t_iabt.c,v $
 * Revision 1.2  1997/09/25  18:14:35  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:25:25  ae59
 * Put under RCS control
 *
 */
/*
**   ieee_abort[ri][12]:
**     werden aus den PXSC-aufrufbaren Funktionen aus aufgerufen,
**     falls ein Laufzeitfehler erzeugt werden soll.
**     Die Aufrufe stehen in makehead.h.
**
**     pxsccode: setzt die ieee-eigenen Fehlercodes in die 
**               PXSC-Fehlercodes fuer e_trap um.
*/

#ifdef AIX
#include "/u/p88c/runtime/tbyte/t_defs.h"
#else
#include "t_defs.h"
#endif

#ifdef LINT_ARGS
a_btyp pxsccode(int rc)
#else
a_btyp pxsccode(rc)
int rc;
#endif /* LINT_ARGS */
{
    switch (rc)
    {
        case DOMAIN:    return(INV_ARG);
        case SING:      return(INV_ARG);
        case OVER_FLOW: return(OVERFLOW);   /* +E_IEEE ? */
        case UNDER_FLOW: return(UNDERFLOW);
        case TLOSS:     return(INEXACT);
        case PLOSS:     return(INEXACT);
        case ExcNoI:    return(INV_ARG);
        case ExcInvalid: return(INV_ARG);
        case ExcISing:  return(INV_ARG);
        case ExcDBZ:    return(DIV_BY_ZERO);
        case ExcDIZ:    return(DIV_BY_ZERO);
        default:        return(INV_ARG);
    }
}


#ifdef LINT_ARGS
void ieee_abortr1(int rc, void *arg)
#else
void ieee_abortr1(rc, arg)
int rc;
int *arg;       /* IBM PC/RT cc kennt keine void * */
#endif /* LINT_ARGS */
{
    a_btyp ecode;
    ecode = pxsccode(rc);
    e_trap(ecode, 2, E_TDBL, arg);
}

#ifdef LINT_ARGS
void ieee_abortr2(int rc, void *arg1, void *arg2)
#else
void ieee_abortr2(rc, arg1, arg2)
int rc;
int *arg1, *arg2;
#endif /* LINT_ARGS */
{
    a_btyp ecode;
    ecode = pxsccode(rc);
    e_trap(ecode, 4, E_TDBL, arg1, E_TDBL, arg2);
}

#ifdef LINT_ARGS
void ieee_aborti1(int rc, void *ai)
#else
void ieee_aborti1(rc, ai)
int rc;
int *ai;
#endif /* LINT_ARGS */
{
    a_btyp ecode;
    ecode = pxsccode(rc);
    e_trap(ecode, 4,
           E_TDBL, &(((a_intv *)ai)->INF), E_TDBL, &(((a_intv *)ai)->SUP));
}

#ifdef LINT_ARGS
void ieee_aborti2(int rc, void *ai, void *bi)
#else
void ieee_aborti2(rc, ai, bi)
int rc;
int *ai, *bi;
#endif /* LINT_ARGS */
{
    a_btyp ecode;
    ecode = pxsccode(rc);
    e_trap(ecode, 8,
           E_TDBL, &(((a_intv *)ai)->INF), E_TDBL, &(((a_intv *)ai)->SUP),
           E_TDBL, &(((a_intv *)bi)->INF), E_TDBL, &(((a_intv *)bi)->SUP));
}
