/**************************************************************************/
/*                                                                        */
/*                                 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: e_ienv.c,v 1.2 1997/09/25 17:16:10 ae59 Exp $ */
/*
$Log: e_ienv.c,v $
 * Revision 1.2  1997/09/25  17:16:10  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:22:15  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : e_ienv.c                              */
/*                                                              */
/*      Entry           : void e_ienv(action,code,mode)         */
/*                        a_intg action;                        */
/*                        a_intg code;                          */
/*                        a_bool mode;                          */
/*                                                              */
/*      Arguments       : code - error code                     */
/*                        action - action to be performed       */
/*                        mode - set or reset                   */
/*                                                              */
/*      Description     : Interface routine for PASCAL.         */
/*                                                              */
/*      Date            : 1991-01-07                            */
/*      1991-01-07 : E_BACK may be altered                      */
/*      1990-11-12 : INV_OP                                     */
/*      1990-10-29 : code must be splitted before compare       */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local void e_ienv(a_intg action,a_intg code,a_bool mode)
#else
local void e_ienv(action,code,mode)

a_intg action;
a_intg code;
a_bool mode;
#endif
        {
        a_btyp e_action;

        e_action = E_CHNG+E_ACTIVE+E_DEFAULT+1;
        if (((a_btyp)action & (E_CONT+E_BACK))==ZERO) return;
        if (((a_btyp)action & E_CONT) && mode) e_action += E_CONT;
        if (((a_btyp)action & E_BACK) && mode) e_action += E_BACK;

        *(a_btyp *)&code = (a_btyp)code & E_MASK;

        if ((a_btyp)code==INV_OP)
           e_actn(e_action,INV_OP,NO_TRAP);
        else if ((a_btyp)code==DIV_BY_ZERO)
           e_actn(e_action,DIV_BY_ZERO,NO_TRAP);
        else if ((a_btyp)code==OVERFLOW)
           e_actn(e_action,OVERFLOW,NO_TRAP);
        else if ((a_btyp)code==UNDERFLOW)
           e_actn(e_action,UNDERFLOW,NO_TRAP);
        else if ((a_btyp)code==INEXACT)
           e_actn(e_action,INEXACT,NO_TRAP);

        return;
        }
