home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / Fortran.51 / DISK5 / HEAP.IN$ / HEAP.bin
Text File  |  1989-09-27  |  3KB  |  114 lines

  1. ;***
  2. ;heap.inc - definitions and structures for C library heap
  3. ;
  4. ;    Copyright (c) 1987-1990, Microsoft Corporation.  All rights reserved.
  5. ;
  6. ;Purpose:
  7. ;    This file contains definitions and structures used by
  8. ;    the C library heap routines.
  9. ;
  10. ;*******************************************************************************
  11.  
  12. ;
  13. ; --- Heap segment descriptor ---
  14. ;
  15. ; [***NOTE*** Some heap routines make assumptions about the layout of the
  16. ; heap descriptor.  If this descriptor changes, some routines may break.]
  17. ;
  18.  
  19. _heap_seg_desc    struc
  20.     checksum    dw    ?    ; checksum area
  21.     flags        dw    ?    ; flags word
  22.     segsize     dw    ?    ; size of segment
  23.     start        dw    ?    ; offset of first heap entry
  24.     rover        dw    ?    ; rover offset
  25.     last        dw    ?    ; offset to end-of-heap marker
  26.     nextseg     dd    ?    ; far pointer to next _heap_seg_desc
  27.     prevseg     dd    ?    ; far pointer to previous _heap_seg_desc
  28. _heap_seg_desc    ends
  29.  
  30. ;
  31. ; _heap_seg_desc.flags bit offsets
  32. ;
  33.  
  34. _HEAP_MODIFY    equ    01h        ; heap segment size can be modified
  35. _HEAP_FREE    equ    02h        ; heap segment may be freed up to OS
  36. _HEAP_NEAR    equ    04h        ; heap segment is part of the near heap
  37. _HEAP_BASED    equ    08h        ; heap segment is part of the based heap
  38.  
  39. ;
  40. ; --- Heap Linked List Descriptor ---
  41. ;
  42. ; [***NOTE*** Some heap routines make assumptions about the layout of the
  43. ; heap list descriptor.  If this descriptor changes, some routines may break.]
  44. ;
  45.  
  46. _heap_list_desc struc
  47.     startseg    dd    0    ; pointer to first heap descriptor
  48.     roverseg    dd    0    ; rover pointer
  49.     lastseg     dd    0    ; pointer to last heap descriptor
  50.     segflags    dw    0    ; flags word for init'ing new segs
  51. _heap_list_desc ends
  52.  
  53. ;
  54. ; --- General Use Heap Constants ---
  55. ;
  56.  
  57. _HEAP_END    equ    0FFFEh        ; End-of-heap flag
  58. _HEAP_COALESCE    equ    0FFFEh        ; Coalesce segment value
  59. _HEAP_GROWSEG    equ    2 shl 12    ; Default (8K) heap seg growth increment
  60. _HEAP_GROWSTART equ    2 shl 9     ; Startup heap seg growth size (1K)
  61. _HEAP_MAXREQ    equ    0FFFCh - (size _heap_seg_desc)    ; Max heap request size
  62. _HEAP_MINSEG    equ    ((size _heap_seg_desc) + 4) ; Min size heap segment
  63.  
  64. ;
  65. ; --- Heap Check/Set/Walk Definitions ---
  66. ;
  67.  
  68. ; Heap info structure used by heapwalk
  69.  
  70. _heapinfo    struc
  71.     _pentry_off    dw    ?    ; far pointer to heap entry (offset)
  72.     _pentry_seg    dw    ?    ; far pointer to heap entry (segment)
  73.     _size        dw    ?    ; size of entry
  74.     _useflag    dw    ?    ; in use flag
  75. _heapinfo    ends
  76.  
  77. ;
  78. ; Heap Check/Set/Walk Constants
  79. ; [NOTE: These definitions must match malloc.h]
  80. ;
  81.  
  82. _HEAPEMPTY    equ    -1
  83. _HEAPOK     equ    -2
  84. _HEAPBADBEGIN    equ    -3
  85. _HEAPBADNODE    equ    -4
  86. _HEAPEND    equ    -5
  87. _HEAPBADPTR    equ    -6
  88.  
  89. _HEAPSET_NOFILL equ    07FFFh
  90.  
  91. _FREEENTRY    equ    0
  92. _USEDENTRY    equ    1
  93.  
  94. ;
  95. ; Return value denoting failure for based heap functions of based pointer
  96. ; return type. The name and definition must correspond to the one given
  97. ; in MALLOC.H.
  98. ;
  99.  
  100. _NULLOFF    equ    -1
  101.  
  102.  
  103. IFDEF    M_XENIX
  104. ;
  105. ; --- XENIX Heap Support ---
  106. ;
  107.  
  108. BR_ARGSEG    equ 1            ; specified segment
  109. BR_NEWSEG    equ 2            ; new segment
  110. BR_IMPSEG    equ 3            ; last or new segment
  111. BR_FREESEG    equ 4            ; free segment
  112.  
  113. ENDIF
  114.