home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / BCPPOWL3.ZIP / PATINC.ZIP / ALLOC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-28  |  2.9 KB  |  124 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. #if !defined( __DEFS_H )
  13. #include <_defs.h>
  14. #endif
  15.  
  16. #define _HEAPEMPTY      1
  17. #define _HEAPOK         2
  18. #define _FREEENTRY      3
  19. #define _USEDENTRY      4
  20. #define _HEAPEND        5
  21. #define _HEAPCORRUPT    -1
  22. #define _BADNODE        -2
  23. #define _BADVALUE       -3
  24.  
  25. #ifndef _STDDEF
  26. #define _STDDEF
  27. #ifndef _PTRDIFF_T
  28. #define _PTRDIFF_T
  29. #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  30. typedef long  ptrdiff_t;
  31. #else
  32. typedef int ptrdiff_t;
  33. #endif
  34. #endif
  35. #ifndef _SIZE_T
  36. #define _SIZE_T
  37. typedef unsigned size_t;
  38. #endif
  39. #endif
  40.  
  41. #if !__STDC__
  42. struct farheapinfo
  43.   {
  44.   void huge *ptr;
  45.   unsigned long size;
  46.   int in_use;
  47.   };
  48. #endif
  49.  
  50. #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
  51. struct heapinfo
  52.   {
  53.   void _FAR *ptr;
  54.   unsigned int size;
  55.   int in_use;
  56.   };
  57. #else
  58. #define heapinfo farheapinfo 
  59. #endif
  60.  
  61. #ifndef NULL
  62. #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
  63. #define NULL  0
  64. #else
  65. #define NULL  0L
  66. #endif
  67. #endif
  68.  
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif
  72.  
  73. void  _FAR *_Cdecl _FARFUNC calloc  (size_t __nitems, size_t __size);
  74. void        _Cdecl _FARFUNC free  (void _FAR *__block);
  75. void  _FAR *_Cdecl _FARFUNC malloc  (size_t  __size);
  76. void  _FAR *_Cdecl _FARFUNC realloc (void _FAR *__block, size_t __size);
  77.  
  78. #if !defined( _Windows )
  79.  
  80. int         _Cdecl brk  (void _FAR *__addr);
  81. void  _FAR *_Cdecl sbrk  (int __incr);
  82.  
  83. int         _Cdecl heapcheck( void );
  84. int         _Cdecl heapfillfree( unsigned int __fillvalue );
  85. int         _Cdecl heapcheckfree( unsigned int __fillvalue );
  86.  
  87. #if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
  88.  
  89. unsigned long _Cdecl coreleft (void);
  90.  
  91. #if !__STDC__
  92. int         _Cdecl heapchecknode( void far *__node );
  93. int         _Cdecl heapwalk( struct farheapinfo far *__hi );
  94. #endif
  95.  
  96. #else
  97.  
  98. unsigned    _Cdecl coreleft  (void);
  99. int         _Cdecl heapchecknode( void _FAR *__node );
  100. int         _Cdecl heapwalk( struct heapinfo _FAR *__hi );
  101.  
  102. #endif
  103.  
  104. #endif  /* WINDOWS */
  105.  
  106. #if !__STDC__
  107. void far  * _Cdecl _FARFUNC farcalloc(unsigned long __nunits, unsigned long __unitsz);
  108. unsigned long _Cdecl farcoreleft( void );
  109. void        _Cdecl _FARFUNC farfree( void far *__block);
  110. void far  * _Cdecl _FARFUNC farmalloc( unsigned long __nbytes);
  111. void far  * _Cdecl _FARFUNC farrealloc( void far *__oldblock, unsigned long __nbytes);
  112. int         _Cdecl farheapcheck( void );
  113. int         _Cdecl farheapchecknode( void far *__node );
  114. int         _Cdecl farheapfillfree( unsigned int __fillvalue );
  115. int         _Cdecl farheapcheckfree( unsigned int __fillvalue );
  116. int         _Cdecl farheapwalk( struct farheapinfo *__hi );
  117. #endif
  118.  
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122.  
  123. #endif  /* __ALLOC_H */
  124.