/**************************************************************************/
/*                                                                        */
/*                                 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_defs.h,v 1.3 1997/09/25 16:42:30 ae59 Exp $ */
/*
$Log: b_defs.h,v $
 * Revision 1.3  1997/09/25  16:42:30  ae59
 * Copyright-message
 *
 * Revision 1.2  1994/10/25  11:04:47  ae59
 * add Shortabtyp for 64 bit systems
 *
 * Revision 1.1  1994/01/27  13:21:21  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : b_defs.h                              */
/*                                                              */
/*      Date            : 1992-01-24                            */
/*      1992-01-24 : MOD_BITS_PER_CHAR/LOG_BITS_PER_CHAR        */
/*      1991-06-20 : constants for tenbyte arithmetic           */
/*      1991-02-25 : DIRNAME_LENGTH defined                     */
/*      1991-01-15 : FPPLT defined                              */
/****************************************************************/

/*    Number of bits generated in one cycle of the decimal-to-  */
/*    binary conversion.                                        */
/*    The product 'BIN_PACK_POWER*DEC_PACK_POWER' must be       */
/*    less than '2**B_LENGTH'.                                  */
#define BIN_PACK                8
#define BIN_PACK_POWER          256

/*    Number of bits forming a 'char' value.                    */
#define BITS_PER_CHAR           8
#define LOG_BITS_PER_CHAR       3
#define MOD_BITS_PER_CHAR       0x7

/*    Number of bits forming a 'a_btyp' value.                  */
/*    This number must be 32.                                   */
#define B_LENGTH                32

/*    Number of decimals generated in one cycle of the binary-  */
/*    to-decimal binary conversion.                             */
#define B2D_LOG10               4
#define B2D_POWER               10000

/*    Number of decimals packed for decimal-to-binary           */
/*    conversion.                                               */
/*    This number must be greater than sizeof(a_btyp).          */
/*    The product 'BIN_PACK_POWER*DEC_PACK_POWER' must be       */
/*    less than '2**B_LENGTH'.                                  */
#define DEC_PACK                7
#if SHORTABTYP
#define DEC_PACK_POWER          10000000
#else
#define DEC_PACK_POWER          10000000L
#endif

/*    Size of character array reserved for SYSTEM_DIRECTORY     */
/*    and USER_DIRECTORY including final '\0'.                  */
#define DIRNAME_LENGTH          64

/*    Number of decimal digits in exponent.                     */
#define ExpDigits               3

/*    Number of program parameters in PASCAL-XSC program        */
#define FPPLT                   16

/*    Number of bits forming an 'a_intg' value.                 */
/*    This number must be less than or equal to B_LENGTH.       */
#define I_LENGTH                C_P_8

/*    Log base 2 of B_LENGTH.                                   */
#define LOG_B_LENGTH            5

/*    MAXINT maximum signed integer value                       */
#if I_LENGTH-32
#if I_LENGTH-16
#define MAXINT                  ((a_intg)0)
#else
#define MAXINT                  ((a_intg)0x7FFF)
#endif
#else
#if SHORTABTYP
#define MAXINT                  ((a_intg)0x7FFFFFFF)
#else
#define MAXINT                  ((a_intg)0x7FFFFFFFL)
#endif
#endif

/*    SQRT_MAXINT square root of maximum signed integer value   */
#if I_LENGTH-32
#if I_LENGTH-16
#define SQRT_MAXINT             ((a_intg)0)
#else
#define SQRT_MAXINT             ((a_intg)0x00b5)
#endif
#else
#if SHORTABTYP
#define SQRT_MAXINT             ((a_intg)0x0000b504)
#else
#define SQRT_MAXINT             ((a_intg)0x0000b504L)
#endif
#endif

/*    MININT minimum signed integer value                       */
#if I_LENGTH-32
#if I_LENGTH-16
#define MININT                  ((a_intg)0)
#else
#define MININT                  ((a_intg)0x8000)
#endif
#else
#if SHORTABTYP
#define MININT                  ((a_intg)0x80000000)
#else
#define MININT                  ((a_intg)0x80000000L)
#endif
#endif

/*------ constants of type 'a_bool' ----------------------------*/

/*    TRUE must be one                                          */
#ifndef TRUE
#define TRUE                    ((a_bool)1)
#endif

/*    FALSE must be zero                                        */
#ifndef FALSE
#define FALSE                   ((a_bool)0)
#endif

/*------ constants of type 'a_btyp' ----------------------------*/

/*    Mask for upper half of a_btyp value.                      */
#if SHORTABTYP
#define HIGH_MASK               ((a_btyp)0xFFFF0000)

/*    Mask for lower half of a_btyp value.                      */
#define LOW_MASK                ((a_btyp)0x0000FFFF)

/*    Mask for least significant bit position of a_btyp value.  */
#define LSB                     ((a_btyp)0x00000001)

/*    Maximum possible a_btyp value.                            */
#define MAX_BASETYPE            ((a_btyp)0xFFFFFFFF)

/*    Mask for most significant bit position of a_btyp value.   */
#define MSB                     ((a_btyp)0x80000000)

/*    Inverse mask for most significant bit position of         */
/*    a_btyp value.                                             */
#define NOT_MSB                 ((a_btyp)0x7FFFFFFF)

/*    Minimum possible a_btyp value.                            */
#define ZERO                    ((a_btyp)0x00000000)
#else
#define HIGH_MASK               ((a_btyp)0xFFFF0000L)

/*    Mask for lower half of a_btyp value.                      */
#define LOW_MASK                ((a_btyp)0x0000FFFFL)

/*    Mask for least significant bit position of a_btyp value.  */
#define LSB                     ((a_btyp)0x00000001L)

/*    Maximum possible a_btyp value.                            */
#define MAX_BASETYPE            ((a_btyp)0xFFFFFFFFL)

/*    Mask for most significant bit position of a_btyp value.   */
#define MSB                     ((a_btyp)0x80000000L)

/*    Inverse mask for most significant bit position of         */
/*    a_btyp value.                                             */
#define NOT_MSB                 ((a_btyp)0x7FFFFFFFL)

/*    Minimum possible a_btyp value.                            */
#define ZERO                    ((a_btyp)0x00000000L)
#endif

/*------ constants of type 'char' ------------------------------*/

/*    end of line character                                     */
#define EOLN                    '\n'

/*    tabulator character                                       */
#define TAB                     '\t'

/* -------- Macro definitions --------------------------------- */

/*    Free allocated 'a_btyp' array.                            */
#define B_FREE(x)               free((char *)(x));

/*    Get upper half of 'a_btyp' value moved to lower half.     */
#define GETHIGH(x)              (((x) >> (B_LENGTH/2)) & LOW_MASK)

/*    Get lower half of 'a_btyp' value.                         */
#define GETLOW(x)               ((x) & LOW_MASK)

/*    Move lower half to upper half position.                   */
#define MOVEHIGH(x)             (((x) << (B_LENGTH/2)) & HIGH_MASK)

/*    Logical negation                                          */
#define NOT(b)                  (a_bool)(TRUE-(b))

/*    Constants for tenbyte arithmetic                          */
#define tCHARAC                 ((int)0x3fff)
#define tEXPO_ADJUST            ((int)0x3fff)
#define tEXPO_MAX               (((int)0x7ffe)-(tCHARAC))
#define tEXPO_MIN               (1-(tCHARAC))
#if SHORTABTYP
#define tFIRST_BIT              ((a_btyp)0x00800000)
#define tMASK                   ((a_btyp)0x000000FF)
#else
#define tFIRST_BIT              ((a_btyp)0x00800000L)
#define tMASK                   ((a_btyp)0x000000FFL)
#endif
#define tMANTL                  64
#define tMSB                    ((unsigned char)0x80)
#define tSHIFT                  BITS_PER_CHAR

