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