home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / detk45he.zip / libc / malloc.h < prev    next >
Text File  |  1999-03-15  |  9KB  |  210 lines

  1. #if __IBMC__ || __IBMCPP__
  2. #pragma info( none )
  3. #ifndef __CHKHDR__
  4.    #pragma info( none )
  5. #endif
  6. #pragma info( restore )
  7. #endif
  8.  
  9. #ifndef __malloc_h
  10.    #define __malloc_h
  11.  
  12.    #ifdef __cplusplus
  13.       extern "C" {
  14.    #endif
  15.  
  16.    #ifndef  _LNK_CONV
  17.       #if __IBMC__ || __IBMCPP__ || defined(_OPTLINK_SUPPORTED)
  18.          #define _LNK_CONV   _Optlink
  19.       #else
  20.          #define _LNK_CONV
  21.       #endif
  22.    #endif
  23.  
  24.    #ifndef _IMPORT
  25.       #ifdef __IMPORTLIB__
  26.          #define _IMPORT _Import
  27.       #else
  28.          #define _IMPORT
  29.       #endif
  30.    #endif
  31.  
  32.    /********************************************************************/
  33.    /*  <malloc.h> header file                                          */
  34.    /*                                                                  */
  35.    /*  (C) Copyright IBM Corp. 1991, 1995.                             */
  36.    /*  - Licensed Material - Program-Property of IBM                   */
  37.    /*  - All rights reserved                                           */
  38.    /*                                                                  */
  39.    /********************************************************************/
  40.  
  41.    #ifndef __size_t
  42.       #define __size_t
  43.       typedef unsigned int size_t;
  44.    #endif
  45.  
  46.    #ifndef __umalloc_h
  47.  
  48.       extern int  _IMPORT _LNK_CONV _heap_walk(int (* _LNK_CONV callback)(const void *, size_t,
  49.                                 int,int ,const char *, size_t)) ;
  50.  
  51.       extern int  _IMPORT _LNK_CONV _heapset(unsigned int fill);
  52.       extern int  _IMPORT _LNK_CONV _heapchk(void);
  53.  
  54.       #define _HEAPOK        (0)
  55.       #define _HEAPEMPTY     (1)
  56.       #define _HEAPBADNODE   (2)
  57.       #define _HEAPBADBEGIN  (3)
  58.       #define _FREEENTRY     (4)
  59.       #define _USEDENTRY     (5)
  60.  
  61.    #endif
  62.  
  63.    #ifndef __stdlib_h
  64.  
  65.       #ifndef __size_t
  66.          #define __size_t
  67.          typedef unsigned int size_t;
  68.       #endif
  69.  
  70.       #ifdef __EXTENDED__
  71.  
  72.          /* Define different memory model versions of memory management       */
  73.          /* routines to the standard names.                                   */
  74.  
  75.          #define _ncalloc( x, y )  calloc( (x), (y) )
  76.          #define _fcalloc( x, y )  calloc( (x), (y) )
  77.          #define _nfree( x )       free( (x) )
  78.          #define _ffree( x )       free( (x) )
  79.          #define _nmalloc( x )     malloc( (x) )
  80.          #define _fmalloc( x )     malloc( (x) )
  81.          #define _nrealloc( x, y ) realloc( (x), (y) )
  82.          #define _frealloc( x, y ) realloc( (x), (y) )
  83.          #define _fheapmin( )      _heapmin( )
  84.          #define _nheapmin( )      _heapmin( )
  85.  
  86.          /* function prototypes */
  87.  
  88.          #if __IBMC__ || __IBMCPP__
  89.             #ifndef _alloca
  90.                void * _Builtin __alloca( size_t );
  91.                #define _alloca( x ) __alloca( (x) )
  92.                #define alloca( x ) __alloca( (x) )
  93.             #endif
  94.  
  95.             #if __THW_INTEL__
  96.                unsigned char _Builtin __parmdwords( void );
  97.             #endif
  98.          #endif
  99.  
  100.          extern void * _IMPORT _LNK_CONV calloc( size_t, size_t );
  101.          extern void   _IMPORT _LNK_CONV free( void * );
  102.          extern void * _IMPORT _LNK_CONV malloc( size_t );
  103.          extern void * _IMPORT _LNK_CONV realloc( void *, size_t );
  104.          extern int    _IMPORT _LNK_CONV _heapmin(void);
  105.          extern size_t _IMPORT _LNK_CONV _msize(void *);
  106.  
  107.          #if defined(__TILED__) && __OS2__ && __THW_INTEL__
  108.             extern void * _IMPORT _LNK_CONV _tcalloc( size_t, size_t );
  109.             extern void   _IMPORT _LNK_CONV _tfree( void * );
  110.             extern void * _IMPORT _LNK_CONV _tmalloc( size_t );
  111.             extern void * _IMPORT _LNK_CONV _trealloc( void *, size_t );
  112.             extern void * _IMPORT _LNK_CONV _theapmin(void);
  113.             #ifndef __DEBUG_ALLOC__
  114.                #if __IBMC__ || __IBMCPP__
  115.                   #pragma map( calloc , "_tcalloc"  )
  116.                   #pragma map( free   , "_tfree"    )
  117.                   #pragma map( malloc , "_tmalloc"  )
  118.                   #pragma map( realloc, "_trealloc" )
  119.                   #pragma map( heapmin, "_theapmin" )
  120.                #else
  121.                   #define calloc _tcalloc
  122.                   #define free _tfree
  123.                   #define malloc _tmalloc
  124.                   #define realloc _trealloc
  125.                   #define heapmin _theapmin
  126.                #endif
  127.             #endif
  128.          #endif
  129.  
  130.          #ifdef __DEBUG_ALLOC__
  131.             #if defined(__TILED__) && __OS2__ && __THW_INTEL__
  132.                extern void * _IMPORT _LNK_CONV _debug_tcalloc( size_t, size_t, const char *, size_t );
  133.                extern void   _IMPORT _LNK_CONV _debug_tfree( void *, const char *, size_t );
  134.                extern void * _IMPORT _LNK_CONV _debug_tmalloc( size_t, const char *, size_t );
  135.                extern void * _IMPORT _LNK_CONV _debug_trealloc( void *, size_t, const char *, size_t );
  136.                extern int    _IMPORT _LNK_CONV _debug_theapmin( const char *, size_t );
  137.                extern void   _IMPORT _LNK_CONV _theap_check( void );
  138.                extern void   _IMPORT _LNK_CONV _tdump_allocated( int );
  139.                extern void   _IMPORT _LNK_CONV _tdump_allocated_delta( int );
  140.                extern void   _IMPORT _LNK_CONV __theap_check( const char *,size_t );
  141.                extern void   _IMPORT _LNK_CONV __tdump_allocated( int ,const char *, size_t);
  142.                extern void   _IMPORT _LNK_CONV __tdump_allocated_delta( int, const char *,size_t);
  143.  
  144.                #define _tcalloc(x,y)  _debug_tcalloc( (x), (y), __FILE__, __LINE__ )
  145.                #define _tfree( x )    _debug_tfree( (x), __FILE__, __LINE__ )
  146.                #define _tmalloc( x )  _debug_tmalloc( (x), __FILE__, __LINE__ )
  147.                #define _trealloc(x,y) _debug_trealloc( (x), (y), __FILE__, __LINE__ )
  148.                #define _theapmin( )   _debug_theapmin( __FILE__, __LINE__ )
  149.  
  150.                #define calloc(x,y)    _debug_tcalloc( (x), (y), __FILE__, __LINE__ )
  151.                #define free( x )      _debug_tfree( (x), __FILE__, __LINE__ )
  152.                #define malloc( x )    _debug_tmalloc( (x), __FILE__, __LINE__ )
  153.                #define realloc(x,y)   _debug_trealloc( (x), (y), __FILE__, __LINE__ )
  154.                #define _heapmin( )    _debug_theapmin( __FILE__, __LINE__ )
  155.  
  156.                #define _heap_check()            __theap_check(__FILE__,__LINE__)
  157.                #define _dump_allocated(x)       __tdump_allocated((x),__FILE__,__LINE__)
  158.                #define _dump_allocated_delta(x) __tdump_allocated_delta((x),__FILE__,__LINE__)
  159.  
  160.             #else
  161.                extern void * _IMPORT _LNK_CONV _debug_calloc( size_t, size_t, const char *, size_t );
  162.                extern void   _IMPORT _LNK_CONV _debug_free( void *, const char *, size_t );
  163.                extern void * _IMPORT _LNK_CONV _debug_malloc( size_t, const char *, size_t );
  164.                extern void * _IMPORT _LNK_CONV _debug_realloc( void *, size_t, const char *, size_t );
  165.                extern int    _IMPORT _LNK_CONV _debug_heapmin( const char *, size_t );
  166.                extern void   _IMPORT _LNK_CONV _heap_check( void );
  167.                extern void   _IMPORT _LNK_CONV _dump_allocated( int );
  168.                extern void   _IMPORT _LNK_CONV _dump_allocated_delta( int );
  169.                extern void   _IMPORT _LNK_CONV __heap_check( const char *,size_t );
  170.                extern void   _IMPORT _LNK_CONV __dump_allocated( int ,const char *, size_t);
  171.                extern void   _IMPORT _LNK_CONV __dump_allocated_delta( int, const char *, size_t);
  172.  
  173.                #define calloc( x, y )  _debug_calloc( (x), (y), __FILE__, __LINE__ )
  174.                #define free( x )       _debug_free( (x), __FILE__, __LINE__ )
  175.                #define malloc( x )     _debug_malloc( (x), __FILE__, __LINE__ )
  176.                #define realloc( x, y ) _debug_realloc( (x), (y), __FILE__, __LINE__ )
  177.                #define _heapmin( )     _debug_heapmin( __FILE__, __LINE__ )
  178.  
  179.                #define _heap_check()            __heap_check(__FILE__,__LINE__)
  180.                #define _dump_allocated(x)       __dump_allocated((x),__FILE__,__LINE__)
  181.                #define _dump_allocated_delta(x) __dump_allocated_delta((x),__FILE__,__LINE__)
  182.  
  183.             #endif
  184.          #else
  185.             #define _heap_check( )
  186.             #define _dump_allocated( x )
  187.             #define _theap_check( )
  188.             #define _tdump_allocated( x )
  189.             #define _dump_allocated_delta( x )
  190.             #define _tdump_allocated_delta( x )
  191.          #endif
  192.  
  193.       #endif /* __EXTENDED__ */
  194.    #endif /* !__stdlib_h */
  195.  
  196.    #ifdef __cplusplus
  197.       }
  198.    #endif
  199.  
  200. #endif
  201.  
  202. #if __IBMC__ || __IBMCPP__
  203. #pragma info( none )
  204. #ifndef __CHKHDR__
  205.    #pragma info( restore )
  206. #endif
  207. #pragma info( restore )
  208. #endif
  209.  
  210.