home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / microcode / const.h < prev    next >
C/C++ Source or Header  |  2000-12-05  |  5KB  |  175 lines

  1. /* -*-C-*-
  2.  
  3. $Id: const.h,v 9.46 2000/12/05 21:23:43 cph Exp $
  4.  
  5. Copyright (c) 1987-2000 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. /* Named constants used throughout the interpreter */
  23.  
  24. #if (CHAR_BIT != 8)
  25. #define MAX_CHAR        ((1<<CHAR_BIT)-1)
  26. #else
  27. #define MAX_CHAR        0xFF
  28. #endif
  29.  
  30. #define PI            3.1415926535
  31. #define STACK_FRAME_HEADER    1
  32.  
  33. /* Precomputed typed pointers */
  34. #if (SIZEOF_UNSIGNED_LONG == 4)    /* 32 bit word */
  35. #  if (TYPE_CODE_LENGTH == 8)
  36. #    define SHARP_F        0x00000000
  37. #    define SHARP_T        0x08000000
  38. #    define UNSPECIFIC        0x08000001
  39. #    define FIXNUM_ZERO        0x1A000000
  40. #    define BROKEN_HEART_ZERO    0x22000000
  41. #  endif
  42. #  if (TYPE_CODE_LENGTH == 6)
  43. #    define SHARP_F        0x00000000
  44. #    define SHARP_T        0x20000000
  45. #    define UNSPECIFIC        0x20000001
  46. #    define FIXNUM_ZERO        0x68000000
  47. #    define BROKEN_HEART_ZERO    0x88000000
  48. #  endif
  49. #endif
  50.  
  51. #ifndef SHARP_F            /* Safe version */
  52. #  define SHARP_F        MAKE_OBJECT (TC_NULL, 0)
  53. #  define SHARP_T        MAKE_OBJECT (TC_CONSTANT, 0)
  54. #  define UNSPECIFIC        MAKE_OBJECT (TC_CONSTANT, 1)
  55. #  define FIXNUM_ZERO        MAKE_OBJECT (TC_FIXNUM, 0)
  56. #  define BROKEN_HEART_ZERO    MAKE_OBJECT (TC_BROKEN_HEART, 0)
  57. #endif /* SHARP_F */
  58.  
  59. #define EMPTY_LIST SHARP_F
  60.  
  61. /* Assorted sizes used in various places */
  62.  
  63. #ifdef MAXPATHLEN
  64. #define FILE_NAME_LENGTH    MAXPATHLEN
  65. #else
  66. #define FILE_NAME_LENGTH    1024       /* Max. chars. in a file name */
  67. #endif
  68.  
  69. #define OBARRAY_SIZE        3001    /* Interning hash table */
  70.  
  71. #ifndef STACK_GUARD_SIZE
  72. #define STACK_GUARD_SIZE    4096    /* Cells between constant and
  73.                        stack before overflow
  74.                        occurs */
  75. #endif
  76.  
  77. /* Some versions of stdio define this. */
  78. #ifndef _NFILE
  79. #define _NFILE        15
  80. #endif
  81.  
  82. #define FILE_CHANNELS        _NFILE
  83.  
  84. #define MAX_LIST_PRINT        10
  85.  
  86. #define ILLEGAL_PRIMITIVE    -1
  87.  
  88. /* Last immediate reference trap. */
  89.  
  90. #define TRAP_MAX_IMMEDIATE    9
  91.  
  92. /* For headers in pure / constant area */
  93.  
  94. #define END_OF_BLOCK        TC_FIXNUM
  95. #define CONSTANT_PART        TC_CONSTANT
  96. #define PURE_PART        TC_FALSE
  97.  
  98. /* Primitive flow control codes: directs computation after
  99.  * processing a primitive application.
  100.  */
  101.  
  102. #define PRIM_DONE            -1
  103. #define PRIM_DO_EXPRESSION        -2
  104. #define PRIM_APPLY            -3
  105. #define PRIM_INTERRUPT            -4
  106. #define PRIM_NO_TRAP_EVAL        -5
  107. #define PRIM_NO_TRAP_APPLY        -6
  108. #define PRIM_POP_RETURN            -7
  109. #define PRIM_TOUCH            -8
  110. #define PRIM_APPLY_INTERRUPT        -9
  111. #define PRIM_REENTER            -10
  112. #define PRIM_NO_TRAP_POP_RETURN        -11
  113.  
  114. #define ABORT_NAME_TABLE                        \
  115. {                                    \
  116.   /* -1 */    "DONE",                            \
  117.   /* -2 */    "DO-EXPRESSION",                    \
  118.   /* -3 */    "APPLY",                        \
  119.   /* -4 */    "INTERRUPT",                        \
  120.   /* -5 */    "NO-TRAP-EVAL",                        \
  121.   /* -6 */    "NO-TRAP_APPLY",                    \
  122.   /* -7 */    "POP-RETURN",                        \
  123.   /* -8 */    "TOUCH",                        \
  124.   /* -9 */    "APPLY-INTERRUPT",                    \
  125.   /* -10 */    "REENTER",                        \
  126.   /* -11 */    "NO-TRAP-POP-RETURN"                    \
  127. }
  128.  
  129. /* Some numbers of parameters which mean something special */
  130.  
  131. #define LEXPR_PRIMITIVE_ARITY        -1
  132. #define UNKNOWN_PRIMITIVE_ARITY        -2
  133.  
  134. /* Error case detection for precomputed constants */
  135. /* VMS preprocessor does not like line continuations in conditionals */
  136.  
  137. #define Are_The_Constants_Incompatible                    \
  138. ((TC_NULL != 0x00) || (TC_CONSTANT != 0x08) ||                \
  139.  (TC_FIXNUM != 0x1A) || (TC_BROKEN_HEART != 0x22) ||             \
  140.  (TC_CHARACTER_STRING != 0x1E))
  141.  
  142. /* The values used above are in sdata.h and types.h,
  143.    check for consistency if the check below fails. */
  144.  
  145. #if Are_The_Constants_Incompatible
  146. #include "Error: const.h and types.h disagree"
  147. #endif
  148.  
  149. /* These are the only entries in Registers[] needed by the microcode.
  150.    All other entries are used only by the compiled code interface. */
  151.  
  152. #define REGBLOCK_MEMTOP            0
  153. #define REGBLOCK_INT_MASK        1
  154. #define REGBLOCK_VAL            2
  155. #define REGBLOCK_ENV            3
  156. #define REGBLOCK_COMPILER_TEMP        4    /* For use by compiler */
  157. #define REGBLOCK_EXPR            5
  158. #define REGBLOCK_RETURN            6
  159. #define REGBLOCK_LEXPR_ACTUALS        7
  160. #define REGBLOCK_PRIMITIVE        8
  161. #define REGBLOCK_CLOSURE_FREE        9    /* For use by compiler */
  162. #define REGBLOCK_CLOSURE_SPACE        10    /* For use by compiler */
  163. #define REGBLOCK_STACK_GUARD        11
  164. #define REGBLOCK_INT_CODE        12
  165. #define REGBLOCK_REFLECT_TO_INTERFACE    13    /* For use by compiler */
  166.  
  167. #define REGBLOCK_MINIMUM_LENGTH        14
  168.  
  169. /* Codes specifying how to start scheme at boot time. */
  170.  
  171. #define BOOT_FASLOAD        0
  172. #define BOOT_LOAD_BAND        1
  173. #define BOOT_GET_WORK        2
  174. #define BOOT_EXECUTE        3
  175.