home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c045 / 2.ddi / INCLUDE / MALLOC.H$ / MALLOC.bin
Encoding:
Text File  |  1992-01-01  |  4.8 KB  |  175 lines

  1. /***
  2. *malloc.h - declarations and definitions for memory allocation functions
  3. *
  4. *    Copyright (c) 1985-1991, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    Contains the function declarations for memory allocation functions;
  8. *    also defines manifest constants and types used by the heap routines.
  9. *    [System V]
  10. *
  11. ****/
  12.  
  13. #ifndef _INC_MALLOC
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18.  
  19. #if defined(_DLL) && !defined(_MT)
  20. #error Cannot define _DLL without _MT
  21. #endif
  22.  
  23. #ifdef _MT
  24. #define _FAR_ __far
  25. #else
  26. #define _FAR_
  27. #endif
  28.  
  29. #if (_MSC_VER <= 600)
  30. #define __based     _based
  31. #define __cdecl     _cdecl
  32. #define __far       _far
  33. #define __huge        _huge
  34. #define __loadds    _loadds
  35. #define __near      _near
  36. #define __segment   _segment
  37. #endif
  38.  
  39. /* constants for based heap routines */
  40.  
  41. #define _NULLSEG    ((__segment)0)
  42. #define _NULLOFF    ((void __based(void) *)0xffff)
  43.  
  44. /* constants for _heapchk/_heapset/_heapwalk routines */
  45.  
  46. #define _HEAPEMPTY    (-1)
  47. #define _HEAPOK     (-2)
  48. #define _HEAPBADBEGIN    (-3)
  49. #define _HEAPBADNODE    (-4)
  50. #define _HEAPEND    (-5)
  51. #define _HEAPBADPTR    (-6)
  52. #define _FREEENTRY    0
  53. #define _USEDENTRY    1
  54.  
  55. /* maximum heap request that can ever be honored */
  56.  
  57. #ifdef _WINDOWS
  58. #define _HEAP_MAXREQ    0xFFE6
  59. #else
  60. #define _HEAP_MAXREQ    0xFFE8
  61. #endif
  62.  
  63. /* types and structures */
  64.  
  65. #ifndef _SIZE_T_DEFINED
  66. typedef unsigned int size_t;
  67. #define _SIZE_T_DEFINED
  68. #endif
  69.  
  70. #ifndef _HEAPINFO_DEFINED
  71. typedef struct _heapinfo {
  72.     int __far * _pentry;
  73.     size_t _size;
  74.     int _useflag;
  75.     } _HEAPINFO;
  76. #define _HEAPINFO_DEFINED
  77. #endif
  78.  
  79.  
  80. /* external variable declarations */
  81.  
  82. #ifdef _DLL
  83. extern unsigned int _FAR_ __cdecl _amblksiz;
  84. #else
  85. extern unsigned int __near __cdecl _amblksiz;
  86. #endif
  87.  
  88.  
  89. /* based heap function prototypes */
  90.  
  91. void __based(void) * _FAR_ __cdecl _bcalloc(__segment, size_t, size_t);
  92. void __based(void) * _FAR_ __cdecl _bexpand(__segment,
  93.     void __based(void) *, size_t);
  94. void _FAR_ __cdecl _bfree(__segment, void __based(void) *);
  95. int _FAR_ __cdecl _bfreeseg(__segment);
  96. int _FAR_ __cdecl _bheapadd(__segment, void __based(void) *, size_t);
  97. int _FAR_ __cdecl _bheapchk(__segment);
  98. int _FAR_ __cdecl _bheapmin(__segment);
  99. __segment _FAR_ __cdecl _bheapseg(size_t);
  100. int _FAR_ __cdecl _bheapset(__segment, unsigned int);
  101. int _FAR_ __cdecl _bheapwalk(__segment, _HEAPINFO *);
  102. void __based(void) * _FAR_ __cdecl _bmalloc(__segment, size_t);
  103. size_t _FAR_ __cdecl _bmsize(__segment, void __based(void) *);
  104. void __based(void) * _FAR_ __cdecl _brealloc(__segment,
  105.     void __based(void) *, size_t);
  106.  
  107.  
  108. /* function prototypes */
  109.  
  110. #ifndef _WINDOWS
  111. void _FAR_ * _FAR_ __cdecl _alloca(size_t);
  112. #endif
  113. void _FAR_ * _FAR_ __cdecl calloc(size_t, size_t);
  114. void _FAR_ * _FAR_ __cdecl _expand(void _FAR_ *, size_t);
  115. void __far * _FAR_ __cdecl _fcalloc(size_t, size_t);
  116. void __far * _FAR_ __cdecl _fexpand(void __far *, size_t);
  117. void _FAR_ __cdecl _ffree(void __far *);
  118. int _FAR_ __cdecl _fheapchk(void);
  119. int _FAR_ __cdecl _fheapmin(void);
  120. int _FAR_ __cdecl _fheapset(unsigned int);
  121. int _FAR_ __cdecl _fheapwalk(_HEAPINFO _FAR_ *);
  122. void __far * _FAR_ __cdecl _fmalloc(size_t);
  123. size_t _FAR_ __cdecl _fmsize(void __far *);
  124. void __far * _FAR_ __cdecl _frealloc(void __far *, size_t);
  125. unsigned int _FAR_ __cdecl _freect(size_t);
  126. void _FAR_ __cdecl free(void _FAR_ *);
  127. void __huge * _FAR_ __cdecl _halloc(long, size_t);
  128. void _FAR_ __cdecl _hfree(void __huge *);
  129. #ifndef _WINDOWS
  130. int _FAR_ __cdecl _heapadd(void __far *, size_t);
  131. int _FAR_ __cdecl _heapchk(void);
  132. #endif
  133. int _FAR_ __cdecl _heapmin(void);
  134. #ifndef _WINDOWS
  135. int _FAR_ __cdecl _heapset(unsigned int);
  136. int _FAR_ __cdecl _heapwalk(_HEAPINFO _FAR_ *);
  137. #endif
  138. void _FAR_ * _FAR_ __cdecl malloc(size_t);
  139. size_t _FAR_ __cdecl _memavl(void);
  140. size_t _FAR_ __cdecl _memmax(void);
  141. size_t _FAR_ __cdecl _msize(void _FAR_ *);
  142. void __near * _FAR_ __cdecl _ncalloc(size_t, size_t);
  143. void __near * _FAR_ __cdecl _nexpand(void __near *, size_t);
  144. void _FAR_ __cdecl _nfree(void __near *);
  145. #ifndef _WINDOWS
  146. int _FAR_ __cdecl _nheapchk(void);
  147. #endif
  148. int _FAR_ __cdecl _nheapmin(void);
  149. #ifndef _WINDOWS
  150. int _FAR_ __cdecl _nheapset(unsigned int);
  151. int _FAR_ __cdecl _nheapwalk(_HEAPINFO _FAR_ *);
  152. #endif
  153. void __near * _FAR_ __cdecl _nmalloc(size_t);
  154. size_t _FAR_ __cdecl _nmsize(void __near *);
  155. void __near * _FAR_ __cdecl _nrealloc(void __near *, size_t);
  156. void _FAR_ * _FAR_ __cdecl realloc(void _FAR_ *, size_t);
  157. size_t _FAR_ __cdecl _stackavail(void);
  158.  
  159. #ifndef __STDC__
  160. /* Non-ANSI names for compatibility */
  161. #ifndef _WINDOWS
  162. void _FAR_ * _FAR_ __cdecl alloca(size_t);
  163. #endif
  164. void __huge * _FAR_ __cdecl halloc(long, size_t);
  165. void _FAR_ __cdecl hfree(void __huge *);
  166. size_t _FAR_ __cdecl stackavail(void);
  167. #endif    /* __STDC__*/
  168.  
  169. #ifdef __cplusplus
  170. }
  171. #endif
  172.  
  173. #define _INC_MALLOC
  174. #endif    /* _INC_MALLOC */
  175.