44 #ifndef _MALOC_BASE_H_
45 #define _MALOC_BASE_H_
88 #if !defined(CLOCKS_PER_SEC)
89 # define CLOCKS_PER_SEC 60
145 #if defined(__cplusplus)
163 #define VPRIVATE static
168 #define VWARN1(file, lineno) (fprintf(stderr,"VWARN: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), 0)
170 #define VASSERT1(file, lineno) (fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), exit(1), 0)
172 #define VASSERT2(file, lineno) (fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), abort(), 0)
174 #define VASSERT3(file, lineno, ex) (fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u, (%s)\n", (file), (lineno), (#ex)), abort(), 0)
177 #define VWARN(ex) ((void) ((ex) ? 0 : VWARN1(__FILE__, __LINE__)))
179 #define VASSERT(ex) ((void) ((ex) ? 0 : VASSERT3(__FILE__, __LINE__, ex)))
183 #define VJMPERR0(x) if (!(x)) goto VERROR0
185 #define VJMPERR1(x) if (!(x)) goto VERROR1
187 #define VJMPERR2(x) if (!(x)) goto VERROR2
189 #define VJMPERR3(x) if (!(x)) goto VERROR3
191 #define VJMPERR4(x) if (!(x)) goto VERROR4
193 #define VJMPERR5(x) if (!(x)) goto VERROR5
195 #define VJMPERR6(x) if (!(x)) goto VERROR6
197 #define VJMPERR7(x) if (!(x)) goto VERROR7
199 #define VJMPERR8(x) if (!(x)) goto VERROR8
201 #define VJMPERR9(x) if (!(x)) goto VERROR9
210 #define VPI 3.14159265358979323846
212 #define VLARGE 1.0e+9
214 #define VSMALL 1.0e-9
216 #define VVLARGE 1.0e+15
218 #define VVSMALL 1.0e-15
220 #define VPRTKEY 10000
225 #define VMAX_ARGNUM 50
227 #define VMAX_ARGLEN 1024
229 #define VMAX_BUFSIZE 8192
237 #define VMAX_OBJECTS 1073741824
239 #define VBLOCK_POWER 14
250 #define VSTDMODE 0600
253 #define VNULL_STRING "\0"
255 #define VBLANK_STRING " "
257 #define VNEWLINE_STRING "\n"
260 #define VNULL_SYMBOL '\0'
262 #define VBLANK_SYMBOL ' '
264 #define VNEWLINE_SYMBOL '\n'
266 #define VRDIN_SYMBOL '<'
268 #define VRDOUT_SYMBOL '>'
270 #define VPIPE_SYMBOL '|'
272 #define VDELIM_SET " ><|&"
276 #define VABS(x) ((x) >= 0 ? (x) : -(x))
278 #define VMIN2(x,y) ((x) <= (y) ? (x) : (y))
280 #define VMAX2(x,y) ((x) >= (y) ? (x) : (y))
282 #define VSIGN(x,y) ((y) >= 0 ? (VABS(x)) : (-VABS(x)))
285 #define VODD(x) ((x)&1)
287 #define VEVEN(x) (!((x)&1))
289 #define VZERO(x) ((x)==0)
291 #define VPOS(x) ((x)>0)
293 #define VNEG(x) ((x)<0)
295 #define VEVENP(x) (VEVEN(x) && VPOS(x))
297 #define VEVENN(x) (VEVEN(x) && VNEG(x))
300 #define VSQRT(x) (sqrt(x))
302 #define VSQR(x) ((x)*(x))
304 #define VSIN(x) (sin(x))
306 #define VCOS(x) (cos(x))
308 #define VTAN(x) (tan(x))
310 #define VASIN(x) (asin(x))
312 #define VACOS(x) (acos(x))
314 #define VATAN(x) (atan(x))
316 #define VSINH(x) (sinh(x))
318 #define VCOSH(x) (cosh(x))
320 #define VTANH(x) (tanh(x))
322 #define VEXP(x) (exp(x))
324 #define VLOG(x) (log(x))
326 #define VPOW(x,y) (pow(x,y))
328 #define VRINT(x) ((int)(floor((x)+0.5)))
331 #define VRAND (rand())
333 #define VRANDMAX (RAND_MAX)
339 # define VINLINE_MALOC