/**************************************************************************/
/*                                                                        */
/*                                 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: b_glbl.c,v 1.7 1997/09/25 17:02:50 ae59 Exp $ */
/*
$Log: b_glbl.c,v $
 * Revision 1.7  1997/09/25  17:02:50  ae59
 * Copyright-message
 *
 * Revision 1.6  1996/03/22  15:07:28  ae59
 * Hardware support for RS6000 with precise and imprecise (default) traps
 *
 * Revision 1.5  1996/03/18  12:12:33  ae59
 * Hardware support for sparc solaris
 *
 * Revision 1.4  1995/09/04  17:03:39  ae59
 * hardware support for ibm_emx_c similar to ibm_linux_c
 *
 * Revision 1.3  1995/08/17  12:31:17  ae59
 * support for linux-387 added (CB)
 *
 * Revision 1.2  1994/10/25  11:40:17  ae59
 * add Shortabtyp for 64 bit systems
 *
 * Revision 1.1  1994/01/27  13:21:25  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : b_glbl.c                              */
/*                                                              */
/*      Description     : Definition of global variables.       */
/*                                                              */
/*      Note            : All variables must be initialized.    */
/*                                                              */
/*      Date            : 1993-08-23                            */
/*      1996-03-14 cb : ibm rs6000 xlc hardware                 */
/*      1995-08-10 cb : i486-linux hardware arithmetic          */
/*      1993-08-23 : use B_TYPINI for a_btyp init. =b=          */
/*      1993-08-12 : tp_001 introduced (full dyn.) =b=          */
/*      1993-06-18 : forcing linkage for Cray      =b=          */
/*      1992-07-21 : add sun4_gnu_c and sun4_cpp_c =b=          */
/*      1992-07-08 : changed fsr(d,q)(n,u,d), temd to e_sr(d,q) */
/*                   (n,u,d),fsrq to e_srq_ =b=                 */
/*      1992-05-20 : fsrd{n,u,d}, temd fuer HP PA FP HW         */
/*      1992-04-28 : fsr{d,q}{n,u,d,c} bei SPARC HW             */
/*      1992-01-16 : remove variable f_udir,f_sdir              */
/*      1992-01-15 : remove variable e_renv                     */
/*      1991-12-03 : f_orgc,f_orgv new                          */
/*      1991-11-14 : STDTRC_DISABLE considered                  */
/*                   hardware control word variable b_ctrl      */
/*      1991-11-07 : r_max_, r_mmax new constants               */
/*      1991-09-18 : f_ftop linked list of file descriptors     */
/*      1991-08-02 : globals defined by user moved to o_user    */
/*      1991-08-01 : definition of e_mfld moved to e_tmsg       */
/*      1991-06-20 : new flag b_rflg for tenbyte rounding mode  */
/*      1991-05-06 : new flag f_ppmt for prog.parm. prompting   */
/*      1991-05-02 : status flags moved from e_ieee.c           */
/*      1991-04-23 : Initialization with std... moved to f_init */
/*      1991-04-18 : new stack variable a_ptop                  */
/*      1991-03-08 : global working area moved to b_cmcp.c      */
/*                   f_name reserves working space for filenames*/
/*      1991-02-25 : f_ppdn flag indicates normalized # used    */
/*                   in r_pred(), r_succ().                     */
/*                   DIRNAME_LENGTH used.                       */
/*      1991-02-22 : initialization of f_errr,f_pmti,f_pmto     */
/*                   final record corrected                     */
/*      1991-02-18 : tp_000 defined                             */
/*      1991-01-22 : VAX_VMS_C considered / MSG_FILE_ENABLED    */
/*      1991-01-15 : f_pplt defined                             */
/****************************************************************/

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

local unsigned long int b_ctrl = 0;

local struct a_pptr *a_ptop = NULL;

local char *tp_000 = NULL;
local char *tp_001 = NULL;

local bentry *e_bstk = (bentry *)NULL;
local bentry *e_btop = (bentry *)NULL;

local int e_line = 0;

local a_bool e_efio = FALSE;
local a_bool e_efdz = FALSE;
local a_bool e_efof = FALSE;
local a_bool e_efuf = FALSE;
local a_bool e_efie = FALSE;
local a_bool e_ofio = FALSE;
local a_bool e_ofdz = FALSE;
local a_bool e_ofof = FALSE;
local a_bool e_ofuf = FALSE;
local a_bool e_ofie = FALSE;

#ifdef IEEE_HARDWARE
#if SUN4_OS4_C+SUN4_GNU_C+SUN4_CPP_C+SUN4_OS5_GNU_C
local unsigned int e_srdn = 0x2d000000;		/* SPARC FSR double, near */
local unsigned int e_srdu = 0xad000000;		/* SPARC FSR double, up   */
local unsigned int e_srdd = 0xed000000;		/* SPARC FSR double, down */
/* default traps: division by zero, invalid operation, overflow */

local unsigned int e_srqn = 0x30000000;		/* SPARC FSR quad(80), near */
local unsigned int e_srqu = 0xb0000000;		/* SPARC FSR quad(80), up   */
local unsigned int e_srqd = 0xf0000000;		/* SPARC FSR quad(80), down */
local unsigned int e_srqc = 0x70000000;		/* SPARC FSR quad(80), chop */
local unsigned int e_srq_;                   /* SPARC FSR quad, aktuell  */
#endif
#if HP_9000_C
local unsigned int e_srdn = 0x00000000;		/* HP9000 FSR, near */
local unsigned int e_srdu = 0x00000400;		/* HP9000 FSR, up   */
local unsigned int e_srdd = 0x00000600;		/* HP9000 FSR, down */
/* default traps: division by zero, invalid operation, overflow */
local unsigned int e_temd  = 0xe0000000;
#endif
#if IBM_LINUX_C+IBM_EMX_C
local unsigned short e_cwdn = 0x0272;		/* i486 cw double, near */
local unsigned short e_cwdu = 0x0a72;		/* i486 cw double, up   */
local unsigned short e_cwdd = 0x0672;		/* i486 cw double, down */
/* default traps: division by zero, invalid operation, overflow */

local unsigned short e_cwen = 0x037f;		/* i486 cw extended, near */
local unsigned short e_cweu = 0x0b7f;		/* i486 cw extended, up   */
local unsigned short e_cwed = 0x077f;		/* i486 cw extended, down */
local unsigned short e_cwec = 0x0f7f;		/* i486 cw extended, chop */
/* default traps: none */
local unsigned short e_cwe_;			/* i486 cw extended, aktuell */
#endif
#if IBM_RS6000_C
local double e_srdn = 1.0;			/* RS/6000 fpscr near */
local double e_srdu = 1.0;			/* RS/6000 fpscr up   */
local double e_srdd = 1.0;			/* RS/6000 fpscr down */
/* default traps: division by zero, invalid operation, overflow */
/* Initialisierung in r_fini */
#endif
#endif

local a_btyp b_maxl = 3;

local char *e_head = NULL;

local char f_name[f_fnsz];

local int f_argc = 0;
local int f_orgc = 0;
local char **f_argv = NULL;
local char **f_orgv = NULL;
local int f_apos = 0;
local a_bool f_ppcc = FALSE;
#ifdef NORMALIZE_ENABLE
local a_bool f_ppdn = FALSE;
#endif
#ifdef COPYIB_ENABLE
local a_bool f_ppib = FALSE;
#endif
local a_bool f_ppmt = FALSE;

/****** f_pppd: indicates that program parameter list is displayed ******/
local a_bool f_pppd = FALSE;

/****** f_pppl: indicates that program parameter list is processed ******/
local a_bool f_pppl = TRUE;

/****** f_ppsz: indicates that signed IEEE zero is displayed as -0 ******/
#ifdef SIGNED_ENABLE
local a_bool f_ppsz = FALSE;
#endif
#ifdef STATTB_ENABLE
local a_bool f_pptb = FALSE;
#endif

/****** f_ftop: top of linked list of file descriptors ******************/
local a_VOID f_ftop = NULL;

/****** f_pptf: indicates that no temporary files are generated *********/
local a_bool f_pptf = FALSE;

#ifdef TRACEC_ENABLE
local a_bool f_pptr = FALSE;
local int e_tlvl = 0;
#endif

local f_text f_inpu;
local f_text f_outp;
local f_text f_errr = { NULL,   FALSE, FALSE, TRUE, FALSE, TRUE,
                                FALSE, TRUE, TRUE, FALSE, FALSE, 1 };
local f_text f_pmti = { NULL,   FALSE, TRUE, TRUE, TRUE, FALSE,
                                TRUE, FALSE, TRUE, FALSE, FALSE, 1 };
local f_text f_pmto = { NULL,   FALSE, FALSE, TRUE, FALSE, TRUE,
                                FALSE, TRUE, TRUE, FALSE, FALSE, 1 };

#if SHORTABTYP
static a_btyp o_1o2_[] = B_TYPINI( 0x3fe00000, 0x00000000 );
static a_btyp o_eps_[] = B_TYPINI( 0x00000000, 0x00000001 );
static a_btyp o_flnb[] = B_TYPINI( 0x40362e42, 0xfefa39ef );
static a_btyp o_fln2[] = B_TYPINI( 0x3fe62e42, 0xfefa39ef );
static a_btyp o_max_[] = B_TYPINI( 0x7fefffff, 0xffffffff );
static a_btyp o_meps[] = B_TYPINI( 0x80000000, 0x00000001 );
static a_btyp o_minf[] = B_TYPINI( 0xfff00000, 0x00000000 );
static a_btyp o_mmax[] = B_TYPINI( 0xffefffff, 0xffffffff );
static a_btyp o_mone[] = B_TYPINI( 0xbff00000, 0x00000000 );
static a_btyp o_one_[] = B_TYPINI( 0x3ff00000, 0x00000000 );
static a_btyp o_pinf[] = B_TYPINI( 0x7ff00000, 0x00000000 );
static a_btyp o_pio2[] = B_TYPINI( 0x3ff921fb, 0x54442d18 );  /* chopped */
static a_btyp o_pio4[] = B_TYPINI( 0x3fe921fb, 0x54442d18 );  /* chopped */
static a_btyp o_sero[] = B_TYPINI( 0x80000000, 0x00000000 );
static a_btyp o_ten_[] = B_TYPINI( 0x40240000, 0x00000000 );
static a_btyp o_two_[] = B_TYPINI( 0x40000000, 0x00000000 );
static a_btyp o_zero[] = B_TYPINI( 0x00000000, 0x00000000 );
#else
static a_btyp o_1o2_[] = B_TYPINI( 0x3fe00000L, 0x00000000L );
static a_btyp o_eps_[] = B_TYPINI( 0x00000000L, 0x00000001L );
static a_btyp o_flnb[] = B_TYPINI( 0x40362e42L, 0xfefa39efL );
static a_btyp o_fln2[] = B_TYPINI( 0x3fe62e42L, 0xfefa39efL );
static a_btyp o_max_[] = B_TYPINI( 0x7fefffffL, 0xffffffffL );
static a_btyp o_meps[] = B_TYPINI( 0x80000000L, 0x00000001L );
static a_btyp o_minf[] = B_TYPINI( 0xfff00000L, 0x00000000L );
static a_btyp o_mmax[] = B_TYPINI( 0xffefffffL, 0xffffffffL );
static a_btyp o_mone[] = B_TYPINI( 0xbff00000L, 0x00000000L );
static a_btyp o_one_[] = B_TYPINI( 0x3ff00000L, 0x00000000L );
static a_btyp o_pinf[] = B_TYPINI( 0x7ff00000L, 0x00000000L );
static a_btyp o_pio2[] = B_TYPINI( 0x3ff921fbL, 0x54442d18L );  /* chopped */
static a_btyp o_pio4[] = B_TYPINI( 0x3fe921fbL, 0x54442d18L );  /* chopped */
static a_btyp o_sero[] = B_TYPINI( 0x80000000L, 0x00000000L );
static a_btyp o_ten_[] = B_TYPINI( 0x40240000L, 0x00000000L );
static a_btyp o_two_[] = B_TYPINI( 0x40000000L, 0x00000000L );
static a_btyp o_zero[] = B_TYPINI( 0x00000000L, 0x00000000L );
#endif

/* possible allignment problems if a_real and a_btyp are not    */
/* alligned the same way                                        */
local a_real *r_1o2_ = (a_real *)&o_1o2_[0];
local a_real *r_eps_ = (a_real *)&o_eps_[0];
local a_real *r_fln2 = (a_real *)&o_fln2[0];
local a_real *r_flnb = (a_real *)&o_flnb[0];
local a_real *r_max_ = (a_real *)&o_max_[0];
local a_real *r_meps = (a_real *)&o_meps[0];
local a_real *r_minf = (a_real *)&o_minf[0];
local a_real *r_mmax = (a_real *)&o_mmax[0];
local a_real *r_mone = (a_real *)&o_mone[0];
local a_real *r_one_ = (a_real *)&o_one_[0];
local a_real *r_pinf = (a_real *)&o_pinf[0];
local a_real *r_pio2 = (a_real *)&o_pio2[0];
local a_real *r_pio4 = (a_real *)&o_pio4[0];
local a_real *r_sero = (a_real *)&o_sero[0];
local a_real *r_ten_ = (a_real *)&o_ten_[0];
local a_real *r_two_ = (a_real *)&o_two_[0];
local a_real *r_zero = (a_real *)&o_zero[0];

local aentry *e_astk = (aentry *)NULL;

local a_VOID e_rptr = NULL;
local int e_rtyp = 0;

local char *f_pplt[FPPLT] = { NULL };

local int b_rflg = NEAREST;

#if VAX_VMS_C+CRAY_UNIX_C
#ifdef LINT_ARGS
local void b_glbl(void)
#else
local void b_glbl()
#endif
        {
        }
#endif

