home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 7.img / INCLUDE.ZIP / ALLOC.H next >
Encoding:
C/C++ Source or Header  |  1990-05-04  |  2.7 KB  |  120 lines

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