home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c031 / 4.ddi / INCLUDE / MALLOC.H$ / MALLOC
Encoding:
Text File  |  1991-11-06  |  4.1 KB  |  160 lines

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