home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 2.ddi / INCLUDE.ZIP / ALLOC.H next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  3.0 KB  |  138 lines

  1. /*  alloc.h
  2.  
  3.   memory management functions and variables.
  4.  
  5.   Copyright (c) Borland International 1987,1988,1990,1991
  6.   All Rights Reserved.
  7. */
  8.  
  9. #if     !defined(__ALLOC_H)
  10. #define __ALLOC_H
  11.  
  12. #ifdef __DLL__
  13. #define _FAR far
  14. #else
  15. #define _FAR
  16. #endif
  17.  
  18. #define _HEAPEMPTY      1
  19. #define _HEAPOK         2
  20. #define _FREEENTRY      3
  21. #define _USEDENTRY      4
  22. #define _HEAPEND        5
  23. #define _HEAPCORRUPT    -1
  24. #define _BADNODE        -2
  25. #define _BADVALUE       -3
  26.  
  27. #if __STDC__
  28. #define _Cdecl
  29. #else
  30. #define _Cdecl  cdecl
  31. #endif
  32.  
  33. #ifndef __PAS__
  34. #define _CType _Cdecl
  35. #else
  36. #define _CType pascal
  37. #endif
  38.  
  39. #ifndef _STDDEF
  40. #define _STDDEF
  41. #ifndef _PTRDIFF_T
  42. #define _PTRDIFF_T
  43. #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  44. typedef long  ptrdiff_t;
  45. #else
  46. typedef int ptrdiff_t;
  47. #endif
  48. #endif
  49. #ifndef _SIZE_T
  50. #define _SIZE_T
  51. typedef unsigned size_t;
  52. #endif
  53. #endif
  54.  
  55. #if !__STDC__
  56. struct farheapinfo
  57.   {
  58.   void huge *ptr;
  59.   unsigned long size;
  60.   int in_use;
  61.   };
  62. #endif
  63.  
  64. #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
  65. struct heapinfo
  66.   {
  67.   void _FAR *ptr;
  68.   unsigned int size;
  69.   int in_use;
  70.   };
  71. #else
  72. #define heapinfo farheapinfo 
  73. #endif
  74.  
  75. #ifndef NULL
  76. #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
  77. #define NULL  0
  78. #else
  79. #define NULL  0L
  80. #endif
  81. #endif
  82.  
  83. #ifdef __cplusplus
  84. extern "C" {
  85. #endif
  86.  
  87. void  _FAR *_Cdecl calloc  (size_t __nitems, size_t __size);
  88. void        _Cdecl free  (void _FAR *__block);
  89. void  _FAR *_Cdecl malloc  (size_t  __size);
  90. void  _FAR *_Cdecl realloc (void _FAR *__block, size_t __size);
  91.  
  92. #if !defined( _Windows )
  93.  
  94. int         _Cdecl brk  (void _FAR *__addr);
  95. void  _FAR *_Cdecl sbrk  (int __incr);
  96.  
  97. int         _Cdecl heapcheck( void );
  98. int         _Cdecl heapfillfree( unsigned int __fillvalue );
  99. int         _Cdecl heapcheckfree( unsigned int __fillvalue );
  100.  
  101. #if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
  102.  
  103. unsigned long _Cdecl coreleft (void);
  104.  
  105. #if !__STDC__
  106. int         _Cdecl heapchecknode( void far *__node );
  107. int         _Cdecl heapwalk( struct farheapinfo far *__hi );
  108. #endif
  109.  
  110. #else
  111.  
  112. unsigned    _Cdecl coreleft  (void);
  113. int         _Cdecl heapchecknode( void _FAR *__node );
  114. int         _Cdecl heapwalk( struct heapinfo _FAR *__hi );
  115.  
  116. #endif
  117.  
  118. #endif  /* WINDOWS */
  119.  
  120. #if !__STDC__
  121. void far  * _Cdecl farcalloc(unsigned long __nunits, unsigned long __unitsz);
  122. unsigned long _Cdecl farcoreleft( void );
  123. void        _Cdecl      farfree( void far *__block);
  124. void far  * _Cdecl farmalloc( unsigned long __nbytes);
  125. void far  * _Cdecl farrealloc( void far *__oldblock, unsigned long __nbytes);
  126. int         _Cdecl farheapcheck( void );
  127. int         _Cdecl farheapchecknode( void far *__node );
  128. int         _Cdecl farheapfillfree( unsigned int __fillvalue );
  129. int         _Cdecl farheapcheckfree( unsigned int __fillvalue );
  130. int         _Cdecl farheapwalk( struct farheapinfo *__hi );
  131. #endif
  132.  
  133. #ifdef __cplusplus
  134. }
  135. #endif
  136.  
  137. #endif  /* __ALLOC_H */
  138.