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 / fasl.h < prev    next >
C/C++ Source or Header  |  1999-01-02  |  5KB  |  129 lines

  1. /* -*-C-*-
  2.  
  3. $Id: fasl.h,v 9.38 1999/01/02 06:06:43 cph Exp $
  4.  
  5. Copyright (c) 1987-1999 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. /* Contains information relating to the format of FASL files.
  23.    The machine/opsys information is contained in config.h
  24.    The processor and compiled code version information is
  25.    contained in the appropriate cmp* file, or compiler.c */
  26.  
  27. /* FASL Version */
  28.  
  29. #define FASL_FILE_MARKER    0xFAFAFAFA
  30.  
  31. /* The FASL file has a header which begins as follows: */
  32.  
  33. #define FASL_HEADER_LENGTH    50    /* Scheme objects in header */
  34.  
  35. #define FASL_Offset_Marker    0    /* Marker to indicate FASL format */
  36. #define FASL_Offset_Heap_Count    1    /* Count of objects in heap */
  37. #define FASL_Offset_Heap_Base    2    /* Address of heap when dumped */
  38. #define FASL_Offset_Dumped_Obj    3    /* Where dumped object was */
  39. #define FASL_Offset_Const_Count    4    /* Count of objects in const. area */
  40. #define FASL_Offset_Const_Base    5    /* Address of const. area at dump */
  41. #define FASL_Offset_Version    6    /* FASL format version info. */
  42. #define FASL_Offset_Stack_Top    7    /* Top of stack when dumped */
  43. #define FASL_Offset_Prim_Length 8    /* Number of entries in primitive table */
  44. #define FASL_Offset_Prim_Size    9    /* Size of primitive table in SCHEME_OBJECTs */
  45. #define FASL_Offset_Ci_Version    10    /* Version number for compiled code interface */
  46. #define FASL_Offset_Ut_Base    11    /* Address of the utilities vector */
  47. #define FASL_Offset_Check_Sum    12    /* Header and data checksum. */
  48. #define FASL_Offset_C_Length    13    /* Number of entries in the C code table */
  49. #define FASL_Offset_C_Size    14    /* Size of C code table in SCHEME_OBJECTs */
  50. #define FASL_Offset_Mem_Base    15    /* Base address when not HEAP_IN_LOW_MEMORY */
  51.  
  52. #define FASL_Offset_First_Free    16    /* Used to clear header */
  53.  
  54. /* Aliases for backwards compatibility. */
  55.  
  56. /* Where ext. prims. vector is */
  57. #define FASL_Offset_Ext_Loc    FASL_Offset_Prim_Length
  58.  
  59. /* Version information encoding */
  60.  
  61. #define ONE            ((SCHEME_OBJECT) 1)
  62.  
  63. #define MACHINE_TYPE_LENGTH    (OBJECT_LENGTH / 2)
  64. #define MACHINE_TYPE_MASK    ((ONE << MACHINE_TYPE_LENGTH) - 1)
  65. #define The_Machine_Type(P)    ((P) & MACHINE_TYPE_MASK)
  66. #define SUBVERSION_LENGTH    (MACHINE_TYPE_LENGTH - TYPE_CODE_LENGTH)
  67. #define SUBVERSION_MASK        ((ONE << SUBVERSION_LENGTH) - 1)
  68. #define The_Sub_Version(P)    (((P) >> MACHINE_TYPE_LENGTH) & SUBVERSION_MASK)
  69. #define The_Version(P)        (OBJECT_TYPE (P))
  70.  
  71. #define Make_Version(V, S, M)                        \
  72.   MAKE_OBJECT ((V), ((((unsigned long) (S)) << MACHINE_TYPE_LENGTH)    \
  73.              | (M)))                        \
  74.  
  75. #define CI_MASK            ((ONE << (DATUM_LENGTH / 2)) - 1)
  76. #define CI_VERSION(P)        (((P) >> (DATUM_LENGTH / 2)) & CI_MASK)
  77. #define CI_PROCESSOR(P)        ((P) & CI_MASK)
  78. #define CI_BAND_P(P)        ((OBJECT_TYPE (P)) == TC_CONSTANT)
  79.  
  80. #define MAKE_CI_VERSION(Band_p, Version, Processor_Type)        \
  81.   MAKE_OBJECT (((Band_p) ? TC_CONSTANT : TC_NULL),                \
  82.            ((((unsigned long) (Version)) << (DATUM_LENGTH / 2))    \
  83.         | (Processor_Type)))
  84.  
  85. /* "Memorable" FASL versions -- ones where we modified something
  86.    and want to remain backwards compatible.
  87. */
  88.  
  89. /* Versions. */
  90.  
  91. #define FASL_FORMAT_ADDED_STACK    1
  92.  
  93. /* Subversions of highest numbered version. */
  94.  
  95. #define FASL_LONG_HEADER    3
  96. #define FASL_DENSE_TYPES    4
  97. #define FASL_PADDED_STRINGS    5
  98. #define FASL_REFERENCE_TRAP    6
  99. #define FASL_MERGED_PRIMITIVES    7
  100. #define FASL_INTERFACE_VERSION    8
  101. #define FASL_NEW_BIGNUMS    9
  102. #define FASL_C_CODE        10
  103.  
  104. /* Current parameters.  Always used on output. */
  105.  
  106. #define FASL_FORMAT_VERSION    FASL_FORMAT_ADDED_STACK
  107. #define FASL_SUBVERSION        FASL_C_CODE
  108.  
  109. /*
  110.   The definitions below correspond to the ones above.  They usually
  111.   have the same values.  They differ when the format is changing: A
  112.   system can be built which reads the old format, but dumps the new one.
  113.  */
  114.  
  115. #ifndef FASL_READ_VERSION
  116. #define FASL_READ_VERSION    FASL_FORMAT_ADDED_STACK
  117. #endif
  118.  
  119. #ifndef FASL_READ_SUBVERSION
  120. #define FASL_READ_SUBVERSION    FASL_NEW_BIGNUMS
  121. #endif
  122.  
  123. /* These are for Bintopsb.
  124.    They are the values of the oldest supported formats.
  125.  */
  126.  
  127. #define FASL_OLDEST_VERSION    FASL_FORMAT_ADDED_STACK
  128. #define FASL_OLDEST_SUBVERSION    FASL_PADDED_STRINGS
  129.