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 / trap.h < prev    next >
C/C++ Source or Header  |  2000-12-05  |  4KB  |  112 lines

  1. /* -*-C-*-
  2.  
  3. $Id: trap.h,v 9.45 2000/12/05 21:23:48 cph Exp $
  4.  
  5. Copyright (c) 1987, 1988, 1989, 1999, 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. /* Kinds of traps:
  23.  
  24.    Note that for every trap there is a dangerous version.
  25.    The danger bit is the bottom bit of the trap number,
  26.    thus all dangerous traps are odd and viceversa.
  27.  
  28.    For efficiency, some traps are immediate, while some are
  29.    pointer objects.  The type code is multiplexed, and the
  30.    garbage collector handles it specially.
  31.  */
  32.  
  33. /* The following are immediate traps: */
  34.  
  35. #define TRAP_UNASSIGNED                0
  36. #define TRAP_UNASSIGNED_DANGEROUS        1
  37. #define TRAP_UNBOUND                2
  38. #define TRAP_UNBOUND_DANGEROUS            3
  39. #define TRAP_ILLEGAL                4
  40. #define TRAP_ILLEGAL_DANGEROUS            5
  41. #define TRAP_EXPENSIVE                6
  42. #define TRAP_EXPENSIVE_DANGEROUS        7
  43.  
  44. /* TRAP_MAX_IMMEDIATE is defined in const.h */
  45.  
  46. /* The following are not: */
  47.  
  48. #define TRAP_NOP                10
  49. #define TRAP_DANGEROUS                11
  50. #define TRAP_FLUID                12
  51. #define TRAP_FLUID_DANGEROUS            13
  52. #define TRAP_COMPILER_CACHED            14
  53. #define TRAP_COMPILER_CACHED_DANGEROUS        15
  54.  
  55. /* These MUST be distinct */
  56.  
  57. #define TRAP_EXTENSION_TYPE            TC_QUAD
  58. #define TRAP_REFERENCES_TYPE            TC_HUNK3
  59.  
  60. /* Trap utilities */
  61.  
  62. #define get_trap_kind(variable, what)                    \
  63. {                                    \
  64.   variable = OBJECT_DATUM (what);                    \
  65.   if (variable > TRAP_MAX_IMMEDIATE)                    \
  66.     variable = OBJECT_DATUM (MEMORY_REF (what, TRAP_TAG));        \
  67. }
  68.  
  69. /* Common constants */
  70.  
  71. #if (SIZEOF_UNSIGNED_LONG == 4)    /* 32 bit objects */
  72. #  if (TYPE_CODE_LENGTH == 8)
  73. #    define UNASSIGNED_OBJECT        0x32000000
  74. #    define DANGEROUS_UNASSIGNED_OBJECT    0x32000001
  75. #    define UNBOUND_OBJECT        0x32000002
  76. #    define DANGEROUS_UNBOUND_OBJECT    0x32000003
  77. #    define ILLEGAL_OBJECT        0x32000004
  78. #    define DANGEROUS_ILLEGAL_OBJECT    0x32000005
  79. #    define EXPENSIVE_OBJECT        0x32000006
  80. #    define DANGEROUS_EXPENSIVE_OBJECT    0x32000007
  81. #  endif
  82. #  if (TYPE_CODE_LENGTH == 6)
  83. #    define UNASSIGNED_OBJECT        0xc8000000
  84. #    define DANGEROUS_UNASSIGNED_OBJECT    0xc8000001
  85. #    define UNBOUND_OBJECT        0xc8000002
  86. #    define DANGEROUS_UNBOUND_OBJECT    0xc8000003
  87. #    define ILLEGAL_OBJECT        0xc8000004
  88. #    define DANGEROUS_ILLEGAL_OBJECT    0xc8000005
  89. #    define EXPENSIVE_OBJECT        0xc8000006
  90. #    define DANGEROUS_EXPENSIVE_OBJECT    0xc8000007
  91. #  endif
  92. #  if (TC_REFERENCE_TRAP != 0x32)
  93. #    include "error: trap.h and types.h are inconsistent"
  94. #  endif
  95. #endif
  96.  
  97. #ifndef UNASSIGNED_OBJECT        /* Safe version */
  98. #  define UNASSIGNED_OBJECT        MAKE_OBJECT (TC_REFERENCE_TRAP, TRAP_UNASSIGNED)
  99. #  define DANGEROUS_UNASSIGNED_OBJECT    MAKE_OBJECT (TC_REFERENCE_TRAP, TRAP_UNASSIGNED_DANGEROUS)
  100. #  define UNBOUND_OBJECT        MAKE_OBJECT (TC_REFERENCE_TRAP, TRAP_UNBOUND)
  101. #  define DANGEROUS_UNBOUND_OBJECT    MAKE_OBJECT (TC_REFERENCE_TRAP, TRAP_UNBOUND_DANGEROUS)
  102. #  define ILLEGAL_OBJECT        MAKE_OBJECT (TC_REFERENCE_TRAP, TRAP_ILLEGAL)
  103. #  define DANGEROUS_ILLEGAL_OBJECT    MAKE_OBJECT (TC_REFERENCE_TRAP, TRAP_ILLEGAL_DANGEROUS)
  104. #  define EXPENSIVE_OBJECT        MAKE_OBJECT (TC_REFERENCE_TRAP, TRAP_EXPENSIVE)
  105. #  define DANGEROUS_EXPENSIVE_OBJECT    MAKE_OBJECT (TC_REFERENCE_TRAP, TRAP_EXPENSIVE_DANGEROUS)
  106. #endif
  107.  
  108. #define NOP_OBJECT (LONG_TO_UNSIGNED_FIXNUM (TRAP_NOP))
  109. #define DANGEROUS_OBJECT (LONG_TO_UNSIGNED_FIXNUM (TRAP_DANGEROUS))
  110. #define REQUEST_RECACHE_OBJECT DANGEROUS_ILLEGAL_OBJECT
  111. #define EXPENSIVE_ASSIGNMENT_OBJECT EXPENSIVE_OBJECT
  112.