a68g.h

     
   1  //! @file a68g.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  //! Master include file.
  25  
  26  #if ! defined (__A68G_H__)
  27  #define __A68G_H__
  28  
  29  // Debugging switch, only useful during development.
  30  
  31  #if defined (A68_DEBUG)
  32  #  undef A68_DEBUG
  33  #endif
  34  
  35  #include "a68g-platform.h"
  36  
  37  // Configuration starts here.
  38  
  39  #define unt unsigned
  40  
  41  #include "a68g-includes.h"
  42  
  43  // Build switches depending on platform.
  44  
  45  #if ((defined (BUILD_LINUX) || defined (BUILD_BSD)) && defined (HAVE_DL))
  46  #  define BUILD_A68_COMPILER
  47  #else
  48  #  undef BUILD_A68_COMPILER
  49  #endif
  50  
  51  #if defined (BUILD_LINUX)
  52  #  define BUILD_UNIX
  53  #elif defined (BUILD_BSD)
  54  #  define BUILD_UNIX
  55  #elif defined (BUILD_CYGWIN)
  56  #  define BUILD_UNIX
  57  #elif defined (BUILD_HAIKU)
  58  #  define BUILD_UNIX
  59  #endif
  60  
  61  // REAL_T should be a REAL*8 for external libs.
  62  typedef double REAL_T; 
  63  
  64  // Compatibility.
  65  
  66  #if ! defined (O_BINARY)
  67  #  define O_BINARY 0x0000
  68  #endif
  69  
  70  // Forward type definitions.
  71  
  72  typedef struct NODE_T NODE_T;
  73  typedef unt STATUS_MASK_T, BOOL_T;
  74  
  75  // Decide the internal representation of A68 modes.
  76  
  77  #include "a68g-stddef.h"
  78  
  79  #define ALIGNED __attribute__((aligned (sizeof (A68_ALIGN_T))))
  80  #define A68_ALIGN(s) ((int) ((s) % A68_ALIGNMENT) == 0 ? (s) : ((s) - (s) % A68_ALIGNMENT + A68_ALIGNMENT))
  81  #define A68_ALIGNMENT ((int) (sizeof (A68_ALIGN_T)))
  82  #define SIZE_ALIGNED(p) ((int) A68_ALIGN (sizeof (p)))
  83  
  84  #if (A68_LEVEL >= 3)
  85  #  include "a68g-level-3.h"
  86  #else // Vintage Algol 68 Genie (versions 1 and 2).
  87  #  include "a68g-generic.h"
  88  #endif
  89  
  90  #define MP_REAL_RADIX ((MP_REAL_T) MP_RADIX)
  91  
  92  #if defined (BUILD_WIN32)
  93  typedef unt __off_t;
  94  #  if defined (__MSVCRT__) && defined (_environ)
  95  #    undef _environ
  96  #  endif
  97  #endif
  98  
  99  #include "a68g-defines.h"
 100  #include "a68g-stack.h"
 101  #include "a68g-masks.h"
 102  #include "a68g-enums.h"
 103  #include "a68g-types.h"
 104  #include "a68g-nil.h"
 105  #include "a68g-diagnostics.h"
 106  #include "a68g-common.h"
 107  #include "a68g-lib.h"
 108  #include "a68g-mach.h"
 109  
 110  // Global declarations
 111  
 112  BOOL_T a68_mkstemp (char *, int, mode_t);
 113  BYTE_T *get_fixed_heap_space (size_t);
 114  BYTE_T *get_heap_space (size_t);
 115  BYTE_T *get_temp_heap_space (size_t);
 116  char *a68_basename (char *);
 117  char *a68_dirname (char *);
 118  char *a68_relpath (char *, char *, char *);
 119  char *ctrl_char (int);
 120  char *moid_to_string (MOID_T *, int, NODE_T *);
 121  char *new_fixed_string (char *);
 122  char *new_string (char *, ...);
 123  char *new_temp_string (char *);
 124  char *non_terminal_string (char *, int);
 125  char *read_string_from_tty (char *);
 126  char *standard_environ_proc_name (GPROC);
 127  int a68_bufprt (char *, size_t, const char *, ...);
 128  int a68_usleep (unsigned);
 129  int get_row_size (A68_TUPLE *, int);
 130  int moid_digits (MOID_T *);
 131  int moid_size (MOID_T *);
 132  unsigned a68_alarm (unsigned);
 133  void *a68_alloc (size_t, const char *, int);
 134  void *a68_bufset (void *, int, size_t);
 135  void a68_bufcat (char *, char *, size_t);
 136  void a68_bufcpy (char *, char *, size_t);
 137  void a68_exit (int);
 138  void a68_free (void *);
 139  void a68_getty (int *, int *);
 140  void a68_rm (char *);
 141  void abend (char *, char *, char *, int);
 142  void announce_phase (char *);
 143  void apropos (FILE_T, char *, char *);
 144  void default_mem_sizes (int);
 145  void discard_heap (void);
 146  void free_file_entries (void);
 147  void free_syntax_tree (NODE_T *);
 148  void get_stack_size (void);
 149  void indenter (MODULE_T *);
 150  void init_curses (void);
 151  void init_file_entries (void);
 152  void init_file_entry (int);
 153  void init_heap (void);
 154  void init_rng (unt);
 155  void init_tty (void);
 156  void install_signal_handlers (void);
 157  void online_help (FILE_T);
 158  void state_version (FILE_T);
 159  
 160  // Below from R mathlib
 161  
 162  void GetRNGstate (void);
 163  void PutRNGstate (void);
 164  REAL_T a68_unif_rand (void);
 165  REAL_T a68_gauss_rand (void);
 166  REAL_T R_unif_index (REAL_T);
 167  
 168  #endif
     


© 2002-2024 J.M. van der Veer (jmvdveer@xs4all.nl)