source: trunk/include/incl_vac/MALLOC.H@ 10367

Last change on this file since 10367 was 9707, checked in by sandervl, 23 years ago

Added changed VAC headers to rename memory and file functions; add include\incl_vac to include path (/I)

File size: 9.0 KB
Line 
1#if (defined(__IBMC__) || defined(__IBMCPP__))
2#pragma info( none )
3#ifndef __CHKHDR__
4 #pragma info( none )
5#endif
6#pragma info( restore )
7#endif
8
9#if ( !defined(__malloc_h))
10 #define __malloc_h
11
12 #ifndef _LNK_CONV
13 #ifdef _M_I386
14 #define _LNK_CONV _Optlink
15 #else
16 #define _LNK_CONV
17 #endif
18 #endif
19
20 #ifndef _IMPORT
21 #ifdef __IMPORTLIB__
22 #define _IMPORT _Import
23 #else
24 #define _IMPORT
25 #endif
26 #endif
27
28 /********************************************************************/
29 /* <malloc.h> header file */
30 /* */
31 /* IBM VisualAge C++ for OS/2, Version 3.00 */
32 /* (C) Copyright IBM Corp. 1991, 1995. */
33 /* - Licensed Material - Program-Property of IBM */
34 /* - All rights reserved */
35 /* */
36 /********************************************************************/
37
38 #ifndef __size_t
39 #define __size_t
40 typedef unsigned int size_t;
41 #endif
42
43 #ifndef __umalloc_h
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 int _IMPORT _LNK_CONV _heap_walk(int (* _LNK_CONV callback)(const void *, size_t,
49 int,int ,const char *, size_t)) ;
50
51 int _IMPORT _LNK_CONV _heapset(unsigned int fill);
52 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 #ifdef __cplusplus
62 }
63 #endif
64 #endif
65
66 #if (!defined(__stdlib_h))
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70
71 #if defined(__EXTENDED__)
72
73 #ifndef __size_t
74 #define __size_t
75 typedef unsigned int size_t;
76 #endif
77
78 /* Define different memory model versions of memory management */
79 /* routines to the standard names. */
80
81 #define _ncalloc( x, y ) calloc( (x), (y) )
82 #define _fcalloc( x, y ) calloc( (x), (y) )
83 #define _nfree( x ) free( (x) )
84 #define _ffree( x ) free( (x) )
85 #define _nmalloc( x ) malloc( (x) )
86 #define _fmalloc( x ) malloc( (x) )
87 #define _nrealloc( x, y ) realloc( (x), (y) )
88 #define _frealloc( x, y ) realloc( (x), (y) )
89 #define _fheapmin( ) _heapmin( )
90 #define _nheapmin( ) _heapmin( )
91
92 /* function prototypes */
93
94 #ifdef _M_I386
95 #ifndef _alloca
96 void * _Builtin __alloca( size_t );
97 #pragma info( none )
98 #define _alloca( x ) __alloca( (x) )
99 #define alloca( x ) __alloca( (x) )
100 #pragma info( restore )
101 #endif
102 #endif
103
104 #ifndef CRTWRAP
105 #define CRTWRAP(a) odin_##a
106 #endif
107#ifndef ORIGINAL_VAC_FUNCTIONS
108 #define calloc CRTWRAP(calloc)
109 #define free CRTWRAP(free)
110 #define malloc CRTWRAP(malloc)
111 #define realloc CRTWRAP(realloc)
112 #define _heapmin CRTWRAP(_heapmin)
113 #define _msize CRTWRAP(_msize)
114#endif
115
116 void * _IMPORT _LNK_CONV calloc( size_t, size_t );
117 void _IMPORT _LNK_CONV free( void * );
118 void * _IMPORT _LNK_CONV malloc( size_t );
119 void * _IMPORT _LNK_CONV realloc( void *, size_t );
120 int _IMPORT _LNK_CONV _heapmin(void);
121 size_t _IMPORT _LNK_CONV _msize(void *);
122
123 #ifdef __TILED__
124 void * _IMPORT _LNK_CONV _tcalloc( size_t, size_t );
125 void _IMPORT _LNK_CONV _tfree( void * );
126 void * _IMPORT _LNK_CONV _tmalloc( size_t );
127 void * _IMPORT _LNK_CONV _trealloc( void *, size_t );
128 void * _IMPORT _LNK_CONV _theapmin(void);
129 #ifndef __DEBUG_ALLOC__
130 #pragma map( calloc , "_tcalloc" )
131 #pragma map( free , "_tfree" )
132 #pragma map( malloc , "_tmalloc" )
133 #pragma map( realloc, "_trealloc" )
134 #pragma map( heapmin, "_theapmin" )
135 #endif
136 #endif
137
138 #ifdef __DEBUG_ALLOC__
139 #ifdef __TILED__
140 void * _IMPORT _LNK_CONV _debug_tcalloc( size_t, size_t, const char *, size_t );
141 void _IMPORT _LNK_CONV _debug_tfree( void *, const char *, size_t );
142 void * _IMPORT _LNK_CONV _debug_tmalloc( size_t, const char *, size_t );
143 void * _IMPORT _LNK_CONV _debug_trealloc( void *, size_t, const char *, size_t );
144 int _IMPORT _LNK_CONV _debug_theapmin( const char *, size_t );
145 void _IMPORT _LNK_CONV _theap_check( void );
146 void _IMPORT _LNK_CONV _tdump_allocated( int );
147 void _IMPORT _LNK_CONV _tdump_allocated_delta( int );
148 void _IMPORT _LNK_CONV __theap_check( const char *,size_t );
149 void _IMPORT _LNK_CONV __tdump_allocated( int ,const char *, size_t);
150 void _IMPORT _LNK_CONV __tdump_allocated_delta( int, const char *,size_t);
151
152 #pragma info( none )
153 #define _tcalloc(x,y) _debug_tcalloc( (x), (y), __FILE__, __LINE__ )
154 #define _tfree( x ) _debug_tfree( (x), __FILE__, __LINE__ )
155 #define _tmalloc( x ) _debug_tmalloc( (x), __FILE__, __LINE__ )
156 #define _trealloc(x,y) _debug_trealloc( (x), (y), __FILE__, __LINE__ )
157 #define _theapmin( ) _debug_theapmin( __FILE__, __LINE__ )
158
159 #define calloc(x,y) _debug_tcalloc( (x), (y), __FILE__, __LINE__ )
160 #define free( x ) _debug_tfree( (x), __FILE__, __LINE__ )
161 #define malloc( x ) _debug_tmalloc( (x), __FILE__, __LINE__ )
162 #define realloc(x,y) _debug_trealloc( (x), (y), __FILE__, __LINE__ )
163 #define _heapmin( ) _debug_theapmin( __FILE__, __LINE__ )
164
165 #define _heap_check() __theap_check(__FILE__,__LINE__)
166 #define _dump_allocated(x) __tdump_allocated((x),__FILE__,__LINE__)
167 #define _dump_allocated_delta(x) __tdump_allocated_delta((x),__FILE__,__LINE__)
168
169 #pragma info( restore )
170 #else
171
172#ifndef ORIGINAL_VAC_FUNCTIONS
173 #define _debug_calloc CRTWRAP(_debug_calloc)
174 #define _debug_free CRTWRAP(_debug_free)
175 #define _debug_malloc CRTWRAP(_debug_malloc)
176 #define _debug_realloc CRTWRAP(_debug_realloc)
177 #define _heap_check CRTWRAP(_heap_check)
178 #define _dump_allocated CRTWRAP(_dump_allocated)
179 #define _dump_allocated_delta CRTWRAP(_dump_allocated_delta)
180 #define _debug_heapmin CRTWRAP(_debug_heapmin)
181 #define __heap_check CRTWRAP(__heap_check)
182 #define __dump_allocated CRTWRAP(__dump_allocated)
183 #define __dump_allocated_delta CRTWRAP(__dump_allocated_delta)
184#endif
185
186 void * _IMPORT _LNK_CONV _debug_calloc( size_t, size_t, const char *, size_t );
187 void _IMPORT _LNK_CONV _debug_free( void *, const char *, size_t );
188 void * _IMPORT _LNK_CONV _debug_malloc( size_t, const char *, size_t );
189 void * _IMPORT _LNK_CONV _debug_realloc( void *, size_t, const char *, size_t );
190 int _IMPORT _LNK_CONV _debug_heapmin( const char *, size_t );
191 void _IMPORT _LNK_CONV _heap_check( void );
192 void _IMPORT _LNK_CONV _dump_allocated( int );
193 void _IMPORT _LNK_CONV _dump_allocated_delta( int );
194 void _IMPORT _LNK_CONV __heap_check( const char *,size_t );
195 void _IMPORT _LNK_CONV __dump_allocated( int ,const char *, size_t);
196 void _IMPORT _LNK_CONV __dump_allocated_delta( int, const char *, size_t);
197
198 #if (defined(__IBMC__) || defined(__IBMCPP__))
199 #pragma info( none )
200 #endif
201#ifndef ORIGINAL_VAC_FUNCTIONS
202 #undef calloc
203 #undef free
204 #undef malloc
205 #undef realloc
206 #undef _heapmin
207 #undef _heap_check
208 #undef _dump_allocated
209 #undef _dump_allocated_delta
210#endif
211 #define calloc( x, y ) _debug_calloc( (x), (y), __FILE__, __LINE__ )
212 #define free( x ) _debug_free( (x), __FILE__, __LINE__ )
213 #define malloc( x ) _debug_malloc( (x), __FILE__, __LINE__ )
214 #define realloc( x, y ) _debug_realloc( (x), (y), __FILE__, __LINE__ )
215 #define _heapmin( ) _debug_heapmin( __FILE__, __LINE__ )
216
217 #define _heap_check() CRTWRAP(__heap_check)(__FILE__,__LINE__)
218 #define _dump_allocated(x) CRTWRAP(__dump_allocated)((x),__FILE__,__LINE__)
219 #define _dump_allocated_delta(x) CRTWRAP(__dump_allocated_delta)((x),__FILE__,__LINE__)
220
221 #if (defined(__IBMC__) || defined(__IBMCPP__))
222 #pragma info( restore )
223 #endif
224 #endif
225 #else
226 #define _heap_check( )
227 #define _dump_allocated( x )
228 #define _theap_check( )
229 #define _tdump_allocated( x )
230 #define _dump_allocated_delta( x )
231 #define _tdump_allocated_delta( x )
232 #endif
233
234
235 #endif
236
237 #ifdef __cplusplus
238 }
239 #endif
240
241 #endif
242#endif
243
244#if (defined(__IBMC__) || defined(__IBMCPP__))
245#pragma info( none )
246#ifndef __CHKHDR__
247 #pragma info( restore )
248#endif
249#pragma info( restore )
250#endif
Note: See TracBrowser for help on using the repository browser.