home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / umalloc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-20  |  4.6 KB  |  138 lines

  1. /********************************************************************/
  2. /*  <umalloc.h> header file                                         */
  3. /*                                                                  */
  4. /*  VisualAge for C++ for Windows, Version 3.5                      */
  5. /*    Licensed Material - Property of IBM                           */
  6. /*                                                                  */
  7. /*  5801-ARR and Other Materials                                    */
  8. /*                                                                  */
  9. /*  (c) Copyright IBM Corp 1991, 1996. All rights reserved.         */
  10. /*                                                                  */
  11. /********************************************************************/
  12.  
  13. #ifndef __umalloc_h
  14.  
  15.  #define __umalloc_h
  16.  
  17.  #ifdef __cplusplus
  18.     extern "C" {
  19.  #endif
  20.  
  21.  #ifndef __size_t
  22.     #define __size_t
  23.     typedef unsigned int size_t;
  24.  #endif
  25.  
  26.  #ifndef __HEAP_HDR__
  27.    typedef  struct _Heap *Heap_t;
  28.  #endif
  29.  
  30.  #ifndef  _LNK_CONV
  31.     #ifdef _M_I386
  32.        #define _LNK_CONV   _Optlink
  33.     #else
  34.        #define _LNK_CONV
  35.     #endif
  36.  #endif
  37.  
  38.  #ifndef _IMPORT
  39.     #ifdef __IMPORTLIB__
  40.        #define _IMPORT _Import
  41.     #else
  42.        #define _IMPORT
  43.     #endif
  44.  #endif
  45.  
  46.  #define _HEAP_TILED        0x01
  47.  #define _HEAP_SHARED       0x02
  48.  #define _HEAP_REGULAR      0x04
  49.  
  50.  #define _BLOCK_CLEAN       1
  51.  #define _FORCE             1
  52.  #define _HEAP_MIN_SIZE     256
  53.  #define _RUNTIME_HEAP      ((Heap_t)_reg_heap)
  54.  
  55.  
  56.  typedef struct __stats
  57.     {
  58.      size_t _provided;
  59.      size_t _used;
  60.      size_t _tiled;
  61.      size_t _shared;
  62.      size_t _max_free;
  63.     } _HEAPSTATS;
  64.  
  65.  #ifdef _WIN32S
  66.     extern Heap_t * _IMPORT __reg_heap( void );
  67.     #define _reg_heap (*__reg_heap())
  68.  #else
  69.     extern Heap_t _IMPORT _reg_heap;
  70.  #endif
  71.  
  72.  #ifdef __DEBUG_ALLOC__
  73.     extern void * _IMPORT _LNK_CONV _debug_umalloc(Heap_t , size_t , const char *,size_t);
  74.     extern void * _IMPORT _LNK_CONV _debug_ucalloc(Heap_t , size_t, size_t ,const char *,size_t);
  75.     extern int    _IMPORT _LNK_CONV _debug_uheapmin(Heap_t , const char *, size_t);
  76.     extern void   _IMPORT _LNK_CONV _uheap_check(Heap_t );
  77.     extern void   _IMPORT _LNK_CONV _udump_allocated(Heap_t ,int );
  78.     extern void   _IMPORT _LNK_CONV _udump_allocated_delta(Heap_t ,int );
  79.     extern void   _IMPORT _LNK_CONV __uheap_check( Heap_t ,const char *,size_t );
  80.     extern void   _IMPORT _LNK_CONV __udump_allocated( Heap_t, int ,const char *, size_t);
  81.     extern void   _IMPORT _LNK_CONV __udump_allocated_delta( Heap_t, int, const char *, size_t);
  82.  
  83.     #define _uheap_check(h)             __uheap_check((h),__FILE__,__LINE__)
  84.     #define _udump_allocated(h,x)       __udump_allocated((h),(x),__FILE__,__LINE__)
  85.     #define _udump_allocated_delta(h,x) __udump_allocated_delta((h),(x),__FILE__,__LINE__)
  86.  
  87.     #define _umalloc(h,s)     _debug_umalloc((h),(s),__FILE__,__LINE__)
  88.     #define _ucalloc(h,s,q)   _debug_ucalloc((h),(s),(q),__FILE__,__LINE__)
  89.     #define _uheapmin(h)      _debug_uheapmin((h),__FILE__,__LINE__)
  90.  
  91.  #else
  92.     extern void * _IMPORT _LNK_CONV _umalloc(Heap_t , size_t );
  93.     extern void * _IMPORT _LNK_CONV _ucalloc(Heap_t , size_t, size_t );
  94.     extern int    _IMPORT _LNK_CONV _uheapmin(Heap_t);
  95.  
  96.     #define _uheap_check(h)
  97.     #define _udump_allocated(h,s)
  98.     #define _udump_allocated_delta(h,s)
  99.  #endif
  100.  
  101.  extern Heap_t _IMPORT _LNK_CONV _ucreate(void *, size_t, int, int ,
  102.                          void *(* _LNK_CONV rtn_get)(Heap_t,size_t *,int *),
  103.                          void  (* _LNK_CONV rtn_rel)(Heap_t,void *, size_t));
  104.  
  105.  extern Heap_t _IMPORT _LNK_CONV _uaddmem(Heap_t , void *, size_t, int);
  106.  extern Heap_t _IMPORT _LNK_CONV _udefault(Heap_t);
  107.  extern Heap_t _IMPORT _LNK_CONV _mheap(const void *);
  108.  
  109.  extern int _IMPORT _LNK_CONV _udestroy(Heap_t ,int );
  110.  extern int _IMPORT _LNK_CONV _uopen(Heap_t);
  111.  extern int _IMPORT _LNK_CONV _uclose(Heap_t);
  112.  extern int _IMPORT _LNK_CONV _ustats(Heap_t,_HEAPSTATS *);
  113.  
  114.  extern int _IMPORT _LNK_CONV _uheap_walk(Heap_t, int (* _LNK_CONV callback)
  115.                                           (const void *, size_t,
  116.                                            int, int, const char *, size_t));
  117.  
  118.  
  119.  extern int  _IMPORT _LNK_CONV _uheapset(Heap_t, unsigned int fill);
  120.  
  121.  extern int  _IMPORT _LNK_CONV _uheapchk(Heap_t);
  122.  
  123.  #ifndef __malloc_h
  124.   #define _HEAPOK        (0)
  125.   #define _HEAPEMPTY     (1)
  126.   #define _HEAPBADNODE   (2)
  127.   #define _HEAPBADBEGIN  (3)
  128.   #define _FREEENTRY     (4)
  129.   #define _USEDENTRY     (5)
  130.  #endif
  131.  
  132.  #ifdef __cplusplus
  133.     }
  134.  #endif
  135.  
  136. #endif
  137.  
  138.