a68g-level-3.h

     
   1  //! @file a68g-level-3.h
   2  //! @author J. Marcel van der Veer
   3  
   4  //! @section Copyright
   5  //!
   6  //! This file is part of Algol68G - an Algol 68 compiler-interpreter.
   7  //! Copyright 2001-2024 J. Marcel van der Veer [algol68g@xs4all.nl].
   8  
   9  //! @section License
  10  //!
  11  //! This program is free software; you can redistribute it and/or modify it 
  12  //! under the terms of the GNU General Public License as published by the 
  13  //! Free Software Foundation; either version 3 of the License, or 
  14  //! (at your option) any later version.
  15  //!
  16  //! This program is distributed in the hope that it will be useful, but 
  17  //! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
  18  //! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 
  19  //! more details. You should have received a copy of the GNU General Public 
  20  //! License along with this program. If not, see [http://www.gnu.org/licenses/].
  21  
  22  //! @section Synopsis
  23  //!
  24  //! Platform dependent definitions.
  25  
  26  #if !defined (__A68G_LEVEL_3_H__)
  27  #define __A68G_LEVEL_3_H__
  28  
  29  typedef long long int INT_T;
  30  typedef long long unt UNSIGNED_T;
  31  typedef UNSIGNED_T ADDR_T;
  32  typedef __float128 DOUBLE_T;
  33  typedef struct A68_DOUBLE A68_DOUBLE, A68_LONG_INT, A68_LONG_REAL, A68_LONG_BITS;
  34  typedef DOUBLE_T A68_ALIGN_T;
  35  
  36  typedef union DOUBLE_NUM_T DOUBLE_NUM_T;
  37  
  38  union DOUBLE_NUM_T
  39  {
  40    UNSIGNED_T u[2];
  41    DOUBLE_T f;
  42  };
  43  
  44  struct A68_DOUBLE
  45  {
  46    STATUS_MASK_T status;
  47    DOUBLE_NUM_T value;
  48  } ALIGNED;
  49  
  50  typedef A68_LONG_REAL A68_LONG_COMPLEX[2];
  51  #define DOUBLE_COMPLEX_T __complex128
  52  
  53  #define a68_strtoi strtoll
  54  #define a68_strtou strtoull
  55  
  56  #define A68_LD "%lld"
  57  #define A68_LU "%llu"
  58  #define A68_LX "%llx"
  59  
  60  #define A68_FRAME_ALIGN(s) (A68_ALIGN(s))
  61  #define SIGNQ(n) ((n) == 0.0q ? 0 : ((n) > 0 ? 1 : -1))
  62  
  63  void standardise_double (DOUBLE_T *, int, int, int *);
  64  DOUBLE_T ten_up_double (int);
  65  BOOL_T convert_radix_double (NODE_T *, DOUBLE_NUM_T, int, int);
  66  
  67  // Native CPU support for MP_REAL_T is preferred.
  68  #if defined (HAVE_FLT80)
  69  typedef long double MP_REAL_T;
  70  #else
  71  typedef DOUBLE_T MP_REAL_T;
  72  #endif
  73  
  74  typedef INT_T MP_INT_T;
  75  typedef UNSIGNED_T MP_BITS_T;
  76  typedef INT_T MP_T;
  77  
  78  #define FLOOR_MP floorl
  79  
  80  #endif