00001
00044 #ifndef _MALOC_BASE_H_
00045 #define _MALOC_BASE_H_
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 #include <assert.h>
00071 #include <ctype.h>
00072 #include <errno.h>
00073 #include <float.h>
00074 #include <limits.h>
00075 #include <locale.h>
00076 #include <math.h>
00077 #include <signal.h>
00078 #include <stdarg.h>
00079 #include <stddef.h>
00080 #include <stdio.h>
00081 #include <stdlib.h>
00082 #include <string.h>
00083 #include <time.h>
00084
00088 #if !defined(CLOCKS_PER_SEC)
00089 # define CLOCKS_PER_SEC 60
00090 #endif
00091
00115 #define __FAVOR_BSD
00116
00140 #define _BSD_SIGNALS
00141
00142
00143 #include <setjmp.h>
00144
00145 #if defined(__cplusplus)
00146
00147 # define VCXX
00148
00149 # define extern "C"
00150 #else
00151
00152 # define VCC
00153
00154 # define extern
00155 #endif
00156
00157
00158
00159
00160
00161
00162
00163 #define VPRIVATE static
00164 #define VPUBLIC
00168 #define VWARN1(file, lineno) (fprintf(stderr,"VWARN: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), 0)
00169
00170 #define VASSERT1(file, lineno) (fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), exit(1), 0)
00171
00172 #define VASSERT2(file, lineno) (fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), abort(), 0)
00173
00174 #define VASSERT3(file, lineno, ex) (fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u, (%s)\n", (file), (lineno), (#ex)), abort(), 0)
00175
00177 #define VWARN(ex) ((void) ((ex) ? 0 : VWARN1(__FILE__, __LINE__)))
00178
00179 #define VASSERT(ex) ((void) ((ex) ? 0 : VASSERT3(__FILE__, __LINE__, ex)))
00180
00181
00183 #define VJMPERR0(x) if (!(x)) goto VERROR0
00184
00185 #define VJMPERR1(x) if (!(x)) goto VERROR1
00186
00187 #define VJMPERR2(x) if (!(x)) goto VERROR2
00188
00189 #define VJMPERR3(x) if (!(x)) goto VERROR3
00190
00191 #define VJMPERR4(x) if (!(x)) goto VERROR4
00192
00193 #define VJMPERR5(x) if (!(x)) goto VERROR5
00194
00195 #define VJMPERR6(x) if (!(x)) goto VERROR6
00196
00197 #define VJMPERR7(x) if (!(x)) goto VERROR7
00198
00199 #define VJMPERR8(x) if (!(x)) goto VERROR8
00200
00201 #define VJMPERR9(x) if (!(x)) goto VERROR9
00202
00203
00204
00205
00206
00207
00208
00210 #define VPI 3.14159265358979323846
00211
00212 #define VLARGE 1.0e+9
00213
00214 #define VSMALL 1.0e-9
00215
00216 #define VVLARGE 1.0e+15
00217
00218 #define VVSMALL 1.0e-15
00219
00220 #define VPRTKEY 10000
00221
00223 #define VPTRSIZE 4
00224
00225 #define VMAX_ARGNUM 50
00226
00227 #define VMAX_ARGLEN 1024
00228
00229 #define VMAX_BUFSIZE 8192
00230
00231
00232
00233
00234
00235
00237 #define VMAX_OBJECTS 1073741824
00238
00239 #define VBLOCK_POWER 14
00240
00242 #define VNULL NULL
00243
00244 #define VINULL -1
00245
00246 #define VTRUE 1
00247
00248 #define VFALSE 0
00249
00250 #define VSTDMODE 0600
00251
00253 #define VNULL_STRING "\0"
00254
00255 #define VBLANK_STRING " "
00256
00257 #define VNEWLINE_STRING "\n"
00258
00260 #define VNULL_SYMBOL '\0'
00261
00262 #define VBLANK_SYMBOL ' '
00263
00264 #define VNEWLINE_SYMBOL '\n'
00265
00266 #define VRDIN_SYMBOL '<'
00267
00268 #define VRDOUT_SYMBOL '>'
00269
00270 #define VPIPE_SYMBOL '|'
00271
00272 #define VDELIM_SET " ><|&"
00273
00274
00276 #define VABS(x) ((x) >= 0 ? (x) : -(x))
00277
00278 #define VMIN2(x,y) ((x) <= (y) ? (x) : (y))
00279
00280 #define VMAX2(x,y) ((x) >= (y) ? (x) : (y))
00281
00282 #define VSIGN(x,y) ((y) >= 0 ? (VABS(x)) : (-VABS(x)))
00283
00285 #define VODD(x) ((x)&1)
00286
00287 #define VEVEN(x) (!((x)&1))
00288
00289 #define VZERO(x) ((x)==0)
00290
00291 #define VPOS(x) ((x)>0)
00292
00293 #define VNEG(x) ((x)<0)
00294
00295 #define VEVENP(x) (VEVEN(x) && VPOS(x))
00296
00297 #define VEVENN(x) (VEVEN(x) && VNEG(x))
00298
00300 #define VSQRT(x) (sqrt(x))
00301
00302 #define VSQR(x) ((x)*(x))
00303
00304 #define VSIN(x) (sin(x))
00305
00306 #define VCOS(x) (cos(x))
00307
00308 #define VTAN(x) (tan(x))
00309
00310 #define VASIN(x) (asin(x))
00311
00312 #define VACOS(x) (acos(x))
00313
00314 #define VATAN(x) (atan(x))
00315
00316 #define VSINH(x) (sinh(x))
00317
00318 #define VCOSH(x) (cosh(x))
00319
00320 #define VTANH(x) (tanh(x))
00321
00322 #define VEXP(x) (exp(x))
00323
00324 #define VLOG(x) (log(x))
00325
00326 #define VPOW(x,y) (pow(x,y))
00327
00328 #define VRINT(x) ((int)(floor((x)+0.5)))
00329
00331 #define VRAND (rand())
00332
00333 #define VRANDMAX (RAND_MAX)
00334
00338 #if 1
00339 # define VINLINE_MALOC
00340 #endif
00341
00342 #endif
00343
00344