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-2025 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 (A68G_DEBUG)
  32    #undef A68G_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_A68G_COMPILER
  47  #else
  48    #undef BUILD_A68G_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 (A68G_ALIGN_T))))
  80  #define A68G_ALIGN(s) ((s) % A68G_ALIGNMENT) == 0 ? (s) : ((s) - (s) % A68G_ALIGNMENT + A68G_ALIGNMENT)
  81  #define A68G_ALIGNMENT (sizeof (A68G_ALIGN_T))
  82  #define SIZE_ALIGNED(p) (A68G_ALIGN (sizeof (p)))
  83  
  84  #if (A68G_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_LINUX) && defined (__off_t_defined) // See fcntl.h
  93    typedef __off_t a68g_off_t;
  94  #else // Reasonable default
  95    typedef ssize_t a68g_off_t;
  96  #endif
  97  
  98  #if defined (BUILD_WIN32) || defined (BUILD_WIN64)
  99    #if defined (__MSVCRT__) && defined (_environ)
 100      #undef _environ
 101    #endif
 102  #endif
 103  
 104  
 105  #include "a68g-defines.h"
 106  #include "a68g-stack.h"
 107  #include "a68g-masks.h"
 108  #include "a68g-enums.h"
 109  #include "a68g-types.h"
 110  #include "a68g-nil.h"
 111  #include "a68g-diagnostics.h"
 112  #include "a68g-common.h"
 113  #include "a68g-lib.h"
 114  #include "a68g-mach.h"
 115  
 116  // Global declarations
 117  
 118  BOOL_T a68g_mkstemp (char *, int, mode_t);
 119  BYTE_T *get_fixed_heap_space (size_t);
 120  BYTE_T *get_heap_space (size_t);
 121  BYTE_T *get_temp_heap_space (size_t);
 122  char *a68g_basename (char *);
 123  char *a68g_dirname (char *);
 124  char *a68g_relpath (char *, char *, char *);
 125  char *ctrl_char (int);
 126  char *moid_to_string (MOID_T *, int, NODE_T *);
 127  char *new_fixed_string (char *);
 128  char *new_string (char *, ...);
 129  char *new_temp_string (char *);
 130  char *non_terminal_string (char *, int);
 131  char *read_string_from_tty (char *);
 132  char *standard_environ_proc_name (GPROC);
 133  int a68g_bufprt (char *, size_t, const char *, ...);
 134  int a68g_usleep (unsigned);
 135  int moid_digits (MOID_T *);
 136  size_t get_row_size (A68G_TUPLE *, int);
 137  size_t moid_size (MOID_T *);
 138  unsigned a68g_alarm (unsigned);
 139  void *a68g_alloc (size_t, const char *, int);
 140  void a68g_bufcat (char *, char *, size_t);
 141  void a68g_bufcpy (char *, char *, size_t);
 142  void *a68g_bufset (void *, int, size_t);
 143  void a68g_exit (int);
 144  void a68g_free (void *);
 145  void a68g_getty (int *, int *);
 146  void a68g_rm (char *);
 147  void abend (char *, char *, char *, int);
 148  void announce_phase (char *);
 149  void apropos (FILE_T, char *, char *);
 150  void default_mem_sizes (INT_T, LINE_T *, char *);
 151  void discard_heap (void);
 152  void free_file_entries (void);
 153  void free_syntax_tree (NODE_T *);
 154  void get_stack_size (void);
 155  void indenter (MODULE_T *);
 156  void init_curses (void);
 157  void init_file_entries (void);
 158  void init_file_entry (int);
 159  void init_heap (void);
 160  void init_rng (unt);
 161  void init_tty (void);
 162  void install_signal_handlers (void);
 163  void online_help (FILE_T);
 164  void state_version (FILE_T);
 165  void storage_limit (size_t);
 166  
 167  // Below from R mathlib
 168  
 169  void GetRNGstate (void);
 170  void PutRNGstate (void);
 171  REAL_T a68g_unif_rand (void);
 172  REAL_T a68g_gauss_rand (void);
 173  REAL_T R_unif_index (REAL_T);
 174  
 175  #endif
     


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