1 /* malloc.h -- Public #include File (module.h template V1.0)
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Contributed by James Craig Burley.
5 This file is part of GNU Fortran.
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
28 /* Allow multiple inclusion to work. */
34 #define MALLOC_DEBUG 0 /* 1 means check caller's use of this module. */
37 /* Simple definitions and enumerations. */
52 typedef struct _malloc_area_
*mallocArea_
;
53 typedef struct _malloc_pool_
*mallocPool
;
54 typedef unsigned long int mallocSize
;
55 #define mallocSize_f "l"
57 /* Include files needed by this one. */
60 /* Structure definitions. */
88 unsigned long allocations
;
90 unsigned long resizes
;
97 struct _malloc_pool_ malloc_pool_image_
;
100 /* Global objects accessed by users of this module. */
102 extern struct _malloc_root_ malloc_root_
;
104 /* Declare functions with prototypes. */
106 void malloc_display_ (mallocArea_ a
);
107 mallocArea_
malloc_find_inpool_ (mallocPool pool
, void *ptr
);
108 void malloc_init (void);
109 void malloc_kill_inpool_ (mallocPool pool
, mallocType_ type
, void *ptr
,
111 void *malloc_new_ (mallocSize size
);
112 void *malloc_new_inpool_ (mallocPool pool
, mallocType_ type
, const char *name
,
114 void *malloc_new_zinpool_ (mallocPool pool
, mallocType_ type
, const char *name
,
115 mallocSize size
, int z
);
116 void malloc_pool_display (mallocPool p
);
117 char malloc_pool_find_ (mallocPool p
, mallocPool parent
);
118 void malloc_pool_kill (mallocPool p
);
119 mallocPool
malloc_pool_new (const char *name
, mallocPool parent
, unsigned long chunks
);
120 mallocPool
malloc_pool_use (mallocPool p
);
121 void *malloc_resize_ (void *ptr
, mallocSize new_size
);
122 void *malloc_resize_inpool_ (mallocPool pool
, mallocType_ type
, void *ptr
,
123 mallocSize new_size
, mallocSize old_size
);
124 void malloc_verify_inpool_ (mallocPool pool
, mallocType_ type
, void *ptr
,
129 #define malloc_new_ks(pool,name,size) \
130 malloc_new_inpool_ (pool,MALLOC_typeKS_,name,size)
131 #define malloc_new_ksr(pool,name,size) \
132 malloc_new_inpool_ (pool,MALLOC_typeKSR_,name,size)
133 #define malloc_new_kp(pool,name,size) \
134 malloc_new_inpool_ (pool,MALLOC_typeKP_,name,size)
135 #define malloc_new_kpr(pool,name,size) \
136 malloc_new_inpool_ (pool,MALLOC_typeKPR_,name,size)
137 #define malloc_new_us(pool,name,size) \
138 malloc_new_inpool_ (pool,MALLOC_typeUS_,name,size)
139 #define malloc_new_usr(pool,name,size) \
140 malloc_new_inpool_ (pool,MALLOC_typeUSR_,name,size)
141 #define malloc_new_zks(pool,name,size,z) \
142 malloc_new_zinpool_ (pool,MALLOC_typeKS_,name,size,z)
143 #define malloc_new_zksr(pool,name,size,z) \
144 malloc_new_zinpool_ (pool,MALLOC_typeKSR_,name,size,z)
145 #define malloc_new_zkp(pool,name,size,z) \
146 malloc_new_zinpool_ (pool,MALLOC_typeKP_,name,size,z)
147 #define malloc_new_zkpr(pool,name,size,z) \
148 malloc_new_zinpool_ (pool,MALLOC_typeKPR_,name,size,z)
149 #define malloc_new_zus(pool,name,size,z) \
150 malloc_new_zinpool_ (pool,MALLOC_typeUS_,name,size,z)
151 #define malloc_new_zusr(pool,name,size,z) \
152 malloc_new_zinpool_ (pool,MALLOC_typeUSR_,name,size,z)
153 #define malloc_kill_ks(pool,ptr,size) \
154 malloc_kill_inpool_ (pool,MALLOC_typeKS_,ptr,size)
155 #define malloc_kill_ksr(pool,ptr,size) \
156 malloc_kill_inpool_ (pool,MALLOC_typeKSR_,ptr,size)
157 #define malloc_kill_us(pool,ptr) \
158 malloc_kill_inpool_ (pool,MALLOC_typeUS_,ptr,0)
159 #define malloc_kill_usr(pool,ptr) \
160 malloc_kill_inpool_ (pool,MALLOC_typeUSR_,ptr,0)
161 #define malloc_pool_image() (&malloc_root_.malloc_pool_image_)
162 #define malloc_resize_ksr(pool,ptr,new_size,old_size) \
163 malloc_resize_inpool_ (pool,MALLOC_typeKSR_,ptr,new_size,old_size)
164 #define malloc_resize_kpr(pool,ptr,new_size,old_size) \
165 malloc_resize_inpool_ (pool,MALLOC_typeKPR_,ptr,new_size,old_size)
166 #define malloc_resize_usr(pool,ptr,new_size) \
167 malloc_resize_inpool_ (pool,MALLOC_typeUSR_,ptr,new_size,0)
168 #define malloc_verify_kp(pool,name,size) \
169 malloc_verify_inpool_ (pool,MALLOC_typeKP_,name,size)
170 #define malloc_verify_kpr(pool,name,size) \
171 malloc_verify_inpool_ (pool,MALLOC_typeKPR_,name,size)
172 #define malloc_verify_ks(pool,ptr,size) \
173 malloc_verify_inpool_ (pool,MALLOC_typeKS_,ptr,size)
174 #define malloc_verify_ksr(pool,ptr,size) \
175 malloc_verify_inpool_ (pool,MALLOC_typeKSR_,ptr,size)
176 #define malloc_verify_us(pool,ptr) \
177 malloc_verify_inpool_ (pool,MALLOC_typeUS_,ptr,0)
178 #define malloc_verify_usr(pool,ptr) \
179 malloc_verify_inpool_ (pool,MALLOC_typeUSR_,ptr,0)
181 /* End of #include file. */