home *** CD-ROM | disk | FTP | other *** search
- /***
- *malloc.h - declarations and definitions for memory allocation functions
- *
- * Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
- *
- *Purpose:
- * Contains the function declarations for memory allocation functions;
- * also defines manifest constants and types used by the heap routines.
- * [System V]
- *
- ****/
-
- #ifndef _INC_MALLOC
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if defined(_DLL) && !defined(_MT)
- #error Cannot define _DLL without _MT
- #endif
-
- #ifdef _MT
- #define _FAR_ __far
- #else
- #define _FAR_
- #endif
-
- #if (_MSC_VER <= 600)
- #define __based _based
- #define __cdecl _cdecl
- #define __far _far
- #define __huge _huge
- #define __loadds _loadds
- #define __near _near
- #define __segment _segment
- #endif
-
- /* constants for based heap routines */
-
- #define _NULLSEG ((__segment)0)
- #define _NULLOFF ((void __based(void) *)0xffff)
-
- /* constants for _heapchk/_heapset/_heapwalk routines */
-
- #define _HEAPEMPTY (-1)
- #define _HEAPOK (-2)
- #define _HEAPBADBEGIN (-3)
- #define _HEAPBADNODE (-4)
- #define _HEAPEND (-5)
- #define _HEAPBADPTR (-6)
- #define _FREEENTRY 0
- #define _USEDENTRY 1
-
- /* maximum heap request that can ever be honored */
-
- #ifdef _WINDOWS
- #define _HEAP_MAXREQ 0xFFE6
- #else
- #define _HEAP_MAXREQ 0xFFE8
- #endif
-
- /* types and structures */
-
- #ifndef _SIZE_T_DEFINED
- typedef unsigned int size_t;
- #define _SIZE_T_DEFINED
- #endif
-
- #ifndef _HEAPINFO_DEFINED
- typedef struct _heapinfo {
- int __far * _pentry;
- size_t _size;
- int _useflag;
- } _HEAPINFO;
- #define _HEAPINFO_DEFINED
- #endif
-
-
- /* external variable declarations */
-
- #ifdef _DLL
- extern unsigned int _FAR_ __cdecl _amblksiz;
- #else
- extern unsigned int __near __cdecl _amblksiz;
- #endif
-
-
- /* based heap function prototypes */
-
- void __based(void) * _FAR_ __cdecl _bcalloc(__segment, size_t, size_t);
- void __based(void) * _FAR_ __cdecl _bexpand(__segment,
- void __based(void) *, size_t);
- void _FAR_ __cdecl _bfree(__segment, void __based(void) *);
- int _FAR_ __cdecl _bfreeseg(__segment);
- int _FAR_ __cdecl _bheapadd(__segment, void __based(void) *, size_t);
- int _FAR_ __cdecl _bheapchk(__segment);
- int _FAR_ __cdecl _bheapmin(__segment);
- __segment _FAR_ __cdecl _bheapseg(size_t);
- int _FAR_ __cdecl _bheapset(__segment, unsigned int);
- int _FAR_ __cdecl _bheapwalk(__segment, _HEAPINFO *);
- void __based(void) * _FAR_ __cdecl _bmalloc(__segment, size_t);
- size_t _FAR_ __cdecl _bmsize(__segment, void __based(void) *);
- void __based(void) * _FAR_ __cdecl _brealloc(__segment,
- void __based(void) *, size_t);
-
-
- /* function prototypes */
-
- #ifndef _WINDOWS
- void _FAR_ * _FAR_ __cdecl _alloca(size_t);
- #endif
- void _FAR_ * _FAR_ __cdecl calloc(size_t, size_t);
- void _FAR_ * _FAR_ __cdecl _expand(void _FAR_ *, size_t);
- void __far * _FAR_ __cdecl _fcalloc(size_t, size_t);
- void __far * _FAR_ __cdecl _fexpand(void __far *, size_t);
- void _FAR_ __cdecl _ffree(void __far *);
- int _FAR_ __cdecl _fheapchk(void);
- int _FAR_ __cdecl _fheapmin(void);
- int _FAR_ __cdecl _fheapset(unsigned int);
- int _FAR_ __cdecl _fheapwalk(_HEAPINFO _FAR_ *);
- void __far * _FAR_ __cdecl _fmalloc(size_t);
- size_t _FAR_ __cdecl _fmsize(void __far *);
- void __far * _FAR_ __cdecl _frealloc(void __far *, size_t);
- unsigned int _FAR_ __cdecl _freect(size_t);
- void _FAR_ __cdecl free(void _FAR_ *);
- void __huge * _FAR_ __cdecl _halloc(long, size_t);
- void _FAR_ __cdecl _hfree(void __huge *);
- #ifndef _WINDOWS
- int _FAR_ __cdecl _heapadd(void __far *, size_t);
- int _FAR_ __cdecl _heapchk(void);
- #endif
- int _FAR_ __cdecl _heapmin(void);
- #ifndef _WINDOWS
- int _FAR_ __cdecl _heapset(unsigned int);
- int _FAR_ __cdecl _heapwalk(_HEAPINFO _FAR_ *);
- #endif
- void _FAR_ * _FAR_ __cdecl malloc(size_t);
- size_t _FAR_ __cdecl _memavl(void);
- size_t _FAR_ __cdecl _memmax(void);
- size_t _FAR_ __cdecl _msize(void _FAR_ *);
- void __near * _FAR_ __cdecl _ncalloc(size_t, size_t);
- void __near * _FAR_ __cdecl _nexpand(void __near *, size_t);
- void _FAR_ __cdecl _nfree(void __near *);
- #ifndef _WINDOWS
- int _FAR_ __cdecl _nheapchk(void);
- #endif
- int _FAR_ __cdecl _nheapmin(void);
- #ifndef _WINDOWS
- int _FAR_ __cdecl _nheapset(unsigned int);
- int _FAR_ __cdecl _nheapwalk(_HEAPINFO _FAR_ *);
- #endif
- void __near * _FAR_ __cdecl _nmalloc(size_t);
- size_t _FAR_ __cdecl _nmsize(void __near *);
- void __near * _FAR_ __cdecl _nrealloc(void __near *, size_t);
- void _FAR_ * _FAR_ __cdecl realloc(void _FAR_ *, size_t);
- size_t _FAR_ __cdecl _stackavail(void);
-
- #ifndef __STDC__
- /* Non-ANSI names for compatibility */
- #ifndef _WINDOWS
- void _FAR_ * _FAR_ __cdecl alloca(size_t);
- #endif
- void __huge * _FAR_ __cdecl halloc(long, size_t);
- void _FAR_ __cdecl hfree(void __huge *);
- size_t _FAR_ __cdecl stackavail(void);
- #endif /* __STDC__*/
-
- #ifdef __cplusplus
- }
- #endif
-
- #define _INC_MALLOC
- #endif /* _INC_MALLOC */
-