home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / umbscheme-2.12.lha / UMBScheme / src / portable.h < prev    next >
C/C++ Source or Header  |  1993-11-29  |  4KB  |  136 lines

  1. /* portable.h -- UMB Scheme, general portability definitions 
  2.  
  3. UMB Scheme Interpreter                  $Revision: 2.12 $
  4. Copyright (C) 1988, 1991 William R Campbell
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. UMB Scheme was written by Bill Campbell with help from Karl Berry,
  21. Barbara Dixey, Ira Gerstein, Mary Glaser, Kathy Hargreaves, Bill McCabe,
  22. Long Nguyen, Susan Quina, Jeyashree Sivasubram, Bela Sohoni and Thang Quoc Tran.
  23.  
  24. For additional information about UMB Scheme, contact the author:
  25.  
  26.     Bill Campbell
  27.     Department of Mathematics and Computer Science
  28.     University of Massachusetts at Boston
  29.     Harbor Campus
  30.     Boston, MA 02125
  31.  
  32.     Telephone: 617-287-6449        Internet: bill@cs.umb.edu
  33.  
  34. */
  35.  
  36. #include <stdio.h>
  37. #include <ctype.h>
  38. #include <errno.h>
  39. #include <string.h>
  40. #include <math.h>
  41.  
  42. /* Machine dependencies */
  43.  
  44. /* ALIGNMENT is the byte-boundary on which double's must be aligned
  45.    in memory.  This constant is necessary for insuring the proper
  46.    alignment of Scheme objects in the Heap (architecture.c).
  47.    For example, on the Vax structs can be aligned on any 1-byte
  48.    boundary, so ALIGNMENT=1.  On the other hand, on the Sun Sparc
  49.    (and most RISC machines) structs must be aligned on 8-byte
  50.    boundaries, so ALIGNMENT=8.  If you don't know, then 8 is safest
  51.    (but will cause a little more fragmentation); better safe than sorry.
  52. */
  53.  
  54. /* IF YOUR MACHINE (eg M68000's, Vaxes) ALLOWS DOUBLE PRECISION OBJECTS TO
  55.    BE ALIGNED ON SMALLER THAN 8_BYTE BOUNDARIES THEN CHANGE THIS: */
  56.  
  57. #define ALIGNMENT 8
  58.  
  59. /* NEGATIVE_ADDRESSES is defined to be 1 iff memory addresses have a 1 in the 
  60.    highest bit; otherwise it is defined to be 0.  This is the usual case. */
  61.  
  62. /* IF YOUR MACHINE HAS ADDRESSES WITH 1 IN THE HIGH-ORDER BIT THEN
  63.    CHANGE THIS:                                                          */
  64.  
  65. #ifdef u3b2
  66. #define NEGATIVE_ADDRESSES 1
  67. #else
  68. #define NEGATIVE_ADDRESSES 0
  69. #endif
  70.  
  71.  
  72. /* The following declarations ought not to be necessary for C environments
  73.    that support the ANSI C Standard. */
  74.  
  75. extern void * malloc( /* size_t size */ );
  76. extern void   free( /* char *ptr */ );
  77. extern char * getenv( /* const char *name */ );
  78. extern int    system( /* const char command */ );
  79. extern void   exit( /* int status */ );
  80. extern int    abs( /* int x */ );
  81.  
  82. /* IF YOUR ENVIRONMENT HAS (any standard ANSI C library ought to have)
  83.    a float.h defns file then replace the definition of DBL_MIN with
  84.    an #include <float.h>                                                 */
  85.  
  86. #define DBL_MIN 10e-307
  87.  
  88. #ifdef sun
  89. extern int    fclose( /* FILE *stream */ );
  90. extern int    ungetc( /* int c, FILE *stream */ );
  91. extern int    fprintf( /* FILE *stream, const char *format, ...  */ );
  92. extern int    _filbuf(), _flsbuf(); /* Yes, I know; talk to Sun! */
  93. #endif
  94.  
  95. #ifdef sun386
  96. extern int    sprintf( /* char *s,      const char *format, ...  */ );
  97. extern char * memcpy( /* void *dest, const void *src, size_t len */ );
  98. #endif
  99.  
  100.  
  101. /* The following are UMB Scheme src definitions.  It is unlikely that they
  102.    will have to be modified.  
  103. */
  104.  
  105.  
  106. #define    TRUE    1
  107. #define    FALSE    0
  108.  
  109. #define MAX_TOKEN_SIZE 1000
  110. #define RADIX          0x8000
  111.  
  112. #define    Private     static
  113. #define    Public
  114. #define Import   extern
  115. #define External extern
  116.  
  117. typedef unsigned char  Byte;
  118. typedef    char           Character ;
  119. typedef    char *           String ;
  120. typedef    int           Boolean ;
  121. typedef    int           Integer ;
  122. typedef short           Short ;
  123. typedef double         Double ;
  124. typedef unsigned short Unsigned_Short;
  125.  
  126. #define Integer_Format "%d"
  127. #define Short_Format   "%d"
  128. #define Double_Format  "%.16g"
  129.  
  130. typedef enum { LESS_THAN, GREATER_THAN, EQUAL_TO } Compare_Type;
  131.  
  132. #define Eq_Strs(s1,s2) (strcmp((s1),(s2)) == 0)
  133.  
  134. #define Is_Terminal(stream) (isatty(fileno(stream)))
  135.  
  136.