00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _H5private_H
00027 #define _H5private_H
00028
00029 #include "H5public.h"
00030
00031
00032 #ifdef H5_HAVE_THREADSAFE
00033 #include <pthread.h>
00034 #endif
00035
00036
00037
00038
00039 #ifdef H5_STDC_HEADERS
00040 # include <assert.h>
00041 # include <ctype.h>
00042 # include <errno.h>
00043 # include <fcntl.h>
00044 # include <float.h>
00045 # include <limits.h>
00046 # include <math.h>
00047 # include <signal.h>
00048 # include <stdarg.h>
00049 # include <stdio.h>
00050 # include <stdlib.h>
00051 # include <string.h>
00052 #endif
00053
00054
00055
00056
00057
00058 #ifdef H5_HAVE_UNISTD_H
00059 # include <sys/types.h>
00060 # include <unistd.h>
00061 #endif
00062 #ifdef _POSIX_VERSION
00063 # include <sys/wait.h>
00064 # include <pwd.h>
00065 #endif
00066
00067
00068
00069
00070 #ifndef __cplusplus
00071 #ifdef H5_HAVE_STDINT_H
00072 # include <stdint.h>
00073 #endif
00074 #endif
00075
00076
00077
00078
00079
00080
00081 #ifdef H5_HAVE_SYS_STAT_H
00082 # include <sys/stat.h>
00083 #endif
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 #if defined(H5_TIME_WITH_SYS_TIME)
00096 # include <sys/time.h>
00097 # include <time.h>
00098 #elif defined(H5_HAVE_SYS_TIME_H)
00099 # include <sys/time.h>
00100 #else
00101 # include <time.h>
00102 #endif
00103
00104
00105
00106
00107 #ifdef H5_HAVE_SETJMP_H
00108 # include <setjmp.h>
00109 #endif
00110
00111
00112
00113
00114
00115 #ifdef H5_HAVE_SYS_RESOURCE_H
00116 # include <sys/resource.h>
00117 #endif
00118
00119
00120
00121
00122
00123 #ifdef H5_HAVE_SYS_IOCTL_H
00124 # include <sys/ioctl.h>
00125 #endif
00126
00127
00128
00129
00130
00131
00132 #ifdef H5_HAVE_SYS_SYSINFO_H
00133 # include <sys/sysinfo.h>
00134 #endif
00135 #ifdef H5_HAVE_SYS_PROC_H
00136 # include <sys/proc.h>
00137 #endif
00138 #ifdef H5_HAVE_IO_H
00139 # include <io.h>
00140 #endif
00141
00142
00143 #ifdef _WIN32
00144
00145 #define VC_EXTRALEAN
00146 #include <windows.h>
00147 #include <direct.h>
00148
00149 #endif
00150
00151
00152 #ifndef H5_inline
00153 #define H5_inline
00154 #endif
00155
00156
00157 #ifndef F_OK
00158 # define F_OK 00
00159 # define W_OK 02
00160 # define R_OK 04
00161 #endif
00162
00163
00164
00165
00166 #ifdef H5_HAVE_MPE
00167
00168
00169
00170
00171
00172
00173
00174
00175 #include "mpe.h"
00176
00177
00178
00179
00180 #define eventa(func_name) h5_mpe_eventa
00181 #define eventb(func_name) h5_mpe_eventb
00182 #define MPE_LOG_VARS(func_name) \
00183 static int eventa(func_name) = -1; \
00184 static int eventb(func_name) = -1; \
00185 const char* p_end_funcname = #func_name; \
00186 const char* p_event_start = "start" #func_name;
00187
00188
00189
00190
00191
00192
00193
00194
00195 #define BEGIN_MPE_LOG(func_name) \
00196 if (H5_MPEinit_g){ \
00197 if (eventa(func_name) == -1 && eventb(func_name) == -1) { \
00198 const char* p_color = "red"; \
00199 eventa(func_name)=MPE_Log_get_event_number(); \
00200 eventb(func_name)=MPE_Log_get_event_number(); \
00201 MPE_Describe_state(eventa(func_name), eventb(func_name), (char *)p_end_funcname, (char *)p_color); \
00202 } \
00203 MPE_Log_event(eventa(func_name), 0, (char *)p_event_start); \
00204 }
00205
00206
00207
00208
00209
00210
00211
00212
00213 #define FINISH_MPE_LOG \
00214 if (H5_MPEinit_g) { \
00215 MPE_Log_event(eventb(func_name), 0, (char *)p_end_funcname); \
00216 }
00217
00218 #else
00219 #define MPE_LOG_VARS(func_name)
00220 #define BEGIN_MPE_LOG(func_name)
00221 #define FINISH_MPE_LOG
00222
00223 #endif
00224
00225
00226
00227
00228 #ifdef H5_HAVE_DMALLOC_H
00229 #include "dmalloc.h"
00230 #endif
00231
00232
00233
00234
00235
00236
00237
00238 #ifndef SIGBUS
00239 # define SIGBUS SIGILL
00240 #endif
00241
00242
00243
00244
00245
00246
00247 #ifdef __cplusplus
00248 # define __attribute__(X)
00249 # define UNUSED
00250 #else
00251 #ifdef H5_HAVE_ATTRIBUTE
00252 # define UNUSED __attribute__((unused))
00253 #else
00254 # define __attribute__(X)
00255 # define UNUSED
00256 #endif
00257 #endif
00258
00259
00260
00261
00262
00263
00264 #ifndef H5_HAVE_FUNCTION
00265 # define __FUNCTION__ "NoFunctionName"
00266 #endif
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 #define SUCCEED 0
00278 #define FAIL (-1)
00279 #define UFAIL (unsigned)(-1)
00280
00281
00282 #ifndef NELMTS
00283 # define NELMTS(X) (sizeof(X)/sizeof(X[0]))
00284 #endif
00285
00286
00287 #undef MIN
00288 #define MIN(a,b) (((a)<(b)) ? (a) : (b))
00289 #define MIN2(a,b) MIN(a,b)
00290 #define MIN3(a,b,c) MIN(a,MIN(b,c))
00291 #define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d))
00292
00293
00294 #undef MAX
00295 #define MAX(a,b) (((a)>(b)) ? (a) : (b))
00296 #define MAX2(a,b) MAX(a,b)
00297 #define MAX3(a,b,c) MAX(a,MAX(b,c))
00298 #define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
00299
00300
00301 #define RANGE(LO,X,HI) MAX(LO,MIN(X,HI))
00302
00303
00304 #ifndef ABS
00305 # define ABS(a) (((a)>=0) ? (a) : -(a))
00306 #endif
00307
00308
00309 #ifndef SIGN
00310 # define SIGN(a) ((a)>0 ? 1 : (a)<0 ? -1 : 0)
00311 #endif
00312
00313
00314
00315 # define POWER_OF_TWO(n) (!(n & (n - 1)) && n)
00316
00317
00318
00319
00320 #ifndef FALSE
00321 # define FALSE 0
00322 #endif
00323 #ifndef TRUE
00324 # define TRUE 1
00325 #endif
00326
00327
00328
00329
00330
00331
00332
00333
00334 #if H5_SIZEOF_INT8_T==0
00335 typedef signed char int8_t;
00336 # undef H5_SIZEOF_INT8_T
00337 # define H5_SIZEOF_INT8_T H5_SIZEOF_CHAR
00338 #elif H5_SIZEOF_INT8_T==1
00339 #else
00340 # error "the int8_t type must be 1 byte wide"
00341 #endif
00342
00343 #if H5_SIZEOF_UINT8_T==0
00344 typedef unsigned char uint8_t;
00345 # undef H5_SIZEOF_UINT8_T
00346 # define H5_SIZEOF_UINT8_T H5_SIZEOF_CHAR
00347 #elif H5_SIZEOF_UINT8_T==1
00348 #else
00349 # error "the uint8_t type must be 1 byte wide"
00350 #endif
00351
00352 #if H5_SIZEOF_INT16_T>=2
00353 #elif H5_SIZEOF_SHORT>=2
00354 typedef short int16_t;
00355 # undef H5_SIZEOF_INT16_T
00356 # define H5_SIZEOF_INT16_T H5_SIZEOF_SHORT
00357 #elif H5_SIZEOF_INT>=2
00358 typedef int int16_t;
00359 # undef H5_SIZEOF_INT16_T
00360 # define H5_SIZEOF_INT16_T H5_SIZEOF_INT
00361 #else
00362 # error "nothing appropriate for int16_t"
00363 #endif
00364
00365 #if H5_SIZEOF_UINT16_T>=2
00366 #elif H5_SIZEOF_SHORT>=2
00367 typedef unsigned short uint16_t;
00368 # undef H5_SIZEOF_UINT16_T
00369 # define H5_SIZEOF_UINT16_T H5_SIZEOF_SHORT
00370 #elif H5_SIZEOF_INT>=2
00371 typedef unsigned uint16_t;
00372 # undef H5_SIZEOF_UINT16_T
00373 # define H5_SIZEOF_UINT16_T H5_SIZEOF_INT
00374 #else
00375 # error "nothing appropriate for uint16_t"
00376 #endif
00377
00378 #if H5_SIZEOF_INT32_T>=4
00379 #elif H5_SIZEOF_SHORT>=4
00380 typedef short int32_t;
00381 # undef H5_SIZEOF_INT32_T
00382 # define H5_SIZEOF_INT32_T H5_SIZEOF_SHORT
00383 #elif H5_SIZEOF_INT>=4
00384 typedef int int32_t;
00385 # undef H5_SIZEOF_INT32_T
00386 # define H5_SIZEOF_INT32_T H5_SIZEOF_INT
00387 #elif H5_SIZEOF_LONG>=4
00388 typedef long int32_t;
00389 # undef H5_SIZEOF_INT32_T
00390 # define H5_SIZEOF_INT32_T H5_SIZEOF_LONG
00391 #else
00392 # error "nothing appropriate for int32_t"
00393 #endif
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404 #ifndef LLONG_MAX
00405 # define LLONG_MAX ((long long)(((unsigned long long)1 \
00406 <<(8*sizeof(long long)-1))-1))
00407 # define LLONG_MIN ((long long)(-LLONG_MAX)-1)
00408 #endif
00409 #ifndef ULLONG_MAX
00410 # define ULLONG_MAX ((unsigned long long)((long long)(-1)))
00411 #endif
00412 #ifndef SIZET_MAX
00413 # define SIZET_MAX ((size_t)(ssize_t)(-1))
00414 # define SSIZET_MAX ((ssize_t)(((size_t)1<<(8*sizeof(ssize_t)-1))-1))
00415 #endif
00416
00417
00418
00419
00420 #define HSIZET_MAX ((hsize_t)ULLONG_MAX)
00421 #define HSSIZET_MAX ((hssize_t)LLONG_MAX)
00422 #define HSSIZET_MIN (~(HSSIZET_MAX))
00423
00424
00425
00426
00427 #ifndef H5_INC_ENUM
00428 # define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1))
00429 #endif
00430
00431
00432
00433
00434 #ifndef H5_DEC_ENUM
00435 # define H5_DEC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)-1))
00436 #endif
00437
00438
00439
00440
00441 #ifndef NDEBUG
00442 #define H5_CHECK_OVERFLOW(var, vartype, casttype) \
00443 { \
00444 casttype _tmp_overflow = (casttype)(var); \
00445 assert((var) == (vartype)_tmp_overflow); \
00446 }
00447 #else
00448 #define H5_CHECK_OVERFLOW(var, vartype, casttype)
00449 #endif
00450
00451
00452
00453
00454 #ifndef NDEBUG
00455 #define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \
00456 { \
00457 srctype _tmp_overflow = (srctype)(src); \
00458 dsttype _tmp_overflow2 = (dsttype)(_tmp_overflow); \
00459 assert((dsttype)_tmp_overflow == _tmp_overflow2); \
00460 (dst) = _tmp_overflow2; \
00461 }
00462 #else
00463 #define H5_ASSIGN_OVERFLOW(dst, src, srctype, dsttype) \
00464 (dst) = (dsttype)(src);
00465 #endif
00466
00467
00468
00469
00470 typedef struct {
00471 double utime;
00472 double stime;
00473 double etime;
00474 } H5_timer_t;
00475
00476 H5_DLL void H5_timer_reset (H5_timer_t *timer);
00477 H5_DLL void H5_timer_begin (H5_timer_t *timer);
00478 H5_DLL void H5_timer_end (H5_timer_t *sum,
00479 H5_timer_t *timer);
00480 H5_DLL void H5_bandwidth(char *buf, double nbytes, double nseconds);
00481 H5_DLL time_t H5_now(void);
00482
00483
00484 typedef enum {
00485 H5_COPY_SHALLOW,
00486 H5_COPY_DEEP
00487 } H5_copy_depth_t;
00488
00489
00490 typedef struct {
00491 unsigned long fileno;
00492 haddr_t addr;
00493 } H5_obj_t;
00494
00495
00496
00497
00498
00499
00500
00501 #include "H5win32defs.h"
00502
00503 #ifndef HDabort
00504 #define HDabort() abort()
00505 #endif
00506 #ifndef HDabs
00507 #define HDabs(X) abs(X)
00508 #endif
00509 #ifndef HDaccess
00510 #define HDaccess(F,M) access(F, M)
00511 #endif
00512 #ifndef HDacos
00513 #define HDacos(X) acos(X)
00514 #endif
00515 #ifndef HDalarm
00516 #ifdef H5_HAVE_ALARM
00517 #define HDalarm(N) alarm(N)
00518 #else
00519 #define HDalarm(N) (0)
00520 #endif
00521 #endif
00522 #ifndef HDasctime
00523 #define HDasctime(T) asctime(T)
00524 #endif
00525 #ifndef HDasin
00526 #define HDasin(X) asin(X)
00527 #endif
00528 #ifndef HDassert
00529 #define HDassert(X) assert(X)
00530 #endif
00531 #ifndef HDatan
00532 #define HDatan(X) atan(X)
00533 #endif
00534 #ifndef HDatan2
00535 #define HDatan2(X,Y) atan2(X,Y)
00536 #endif
00537 #ifndef HDatexit
00538 #define HDatexit(F) atexit(F)
00539 #endif
00540 #ifndef HDatof
00541 #define HDatof(S) atof(S)
00542 #endif
00543 #ifndef HDatoi
00544 #define HDatoi(S) atoi(S)
00545 #endif
00546 #ifndef HDatol
00547 #define HDatol(S) atol(S)
00548 #endif
00549 #ifndef HDBSDgettimeofday
00550 #define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P)
00551 #endif
00552 #ifndef HDbsearch
00553 #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
00554 #endif
00555 #ifndef HDcalloc
00556 #define HDcalloc(N,Z) calloc(N,Z)
00557 #endif
00558 #ifndef HDceil
00559 #define HDceil(X) ceil(X)
00560 #endif
00561 #ifndef HDcfgetispeed
00562 #define HDcfgetispeed(T) cfgetispeed(T)
00563 #endif
00564 #ifndef HDcfgetospeed
00565 #define HDcfgetospeed(T) cfgetospeed(T)
00566 #endif
00567 #ifndef HDcfsetispeed
00568 #define HDcfsetispeed(T,S) cfsetispeed(T,S)
00569 #endif
00570 #ifndef HDcfsetospeed
00571 #define HDcfsetospeed(T,S) cfsetospeed(T,S)
00572 #endif
00573 #ifndef HDchdir
00574 #define HDchdir(S) chdir(S)
00575 #endif
00576 #ifndef HDchmod
00577 #define HDchmod(S,M) chmod(S,M)
00578 #endif
00579 #ifndef HDchown
00580 #define HDchown(S,O,G) chown(S,O,G)
00581 #endif
00582 #ifndef HDclearerr
00583 #define HDclearerr(F) clearerr(F)
00584 #endif
00585 #ifndef HDclock
00586 #define HDclock() clock()
00587 #endif
00588 #ifndef HDclose
00589 #define HDclose(F) close(F)
00590 #endif
00591 #ifndef HDclosedir
00592 #define HDclosedir(D) closedir(D)
00593 #endif
00594 #ifndef HDcos
00595 #define HDcos(X) cos(X)
00596 #endif
00597 #ifndef HDcosh
00598 #define HDcosh(X) cosh(X)
00599 #endif
00600 #ifndef HDcreat
00601 #define HDcreat(S,M) creat(S,M)
00602 #endif
00603 #ifndef HDctermid
00604 #define HDctermid(S) ctermid(S)
00605 #endif
00606 #ifndef HDctime
00607 #define HDctime(T) ctime(T)
00608 #endif
00609 #ifndef HDcuserid
00610 #define HDcuserid(S) cuserid(S)
00611 #endif
00612 #ifndef HDdifftime
00613 #ifdef H5_HAVE_DIFFTIME
00614 #define HDdifftime(X,Y) difftime(X,Y)
00615 #else
00616 #define HDdifftime(X,Y) ((double)(X)-(double)(Y))
00617 #endif
00618 #endif
00619 #ifndef HDdiv
00620 #define HDdiv(X,Y) div(X,Y)
00621 #endif
00622 #ifndef HDdup
00623 #define HDdup(F) dup(F)
00624 #endif
00625 #ifndef HDdup2
00626 #define HDdup2(F,I) dup2(F,I)
00627 #endif
00628
00629
00630
00631 #ifndef HDexecv
00632 #define HDexecv(S,AV) execv(S,AV)
00633 #endif
00634 #ifndef HDexecve
00635 #define HDexecve(S,AV,E) execve(S,AV,E)
00636 #endif
00637 #ifndef HDexecvp
00638 #define HDexecvp(S,AV) execvp(S,AV)
00639 #endif
00640 #ifndef HDexit
00641 #define HDexit(N) exit(N)
00642 #endif
00643 #ifndef HD_exit
00644 #define HD_exit(N) _exit(N)
00645 #endif
00646 #ifndef HDexp
00647 #define HDexp(X) exp(X)
00648 #endif
00649 #ifndef HDfabs
00650 #define HDfabs(X) fabs(X)
00651 #endif
00652
00653 #ifndef HDfabsf
00654 #define HDfabsf(X) ABS(X)
00655 #endif
00656 #ifndef HDfabsl
00657 #define HDfabsl(X) ABS(X)
00658 #endif
00659 #ifndef HDfclose
00660 #define HDfclose(F) fclose(F)
00661 #endif
00662
00663 #ifndef HDfdopen
00664 #define HDfdopen(N,S) fdopen(N,S)
00665 #endif
00666 #ifndef HDfeof
00667 #define HDfeof(F) feof(F)
00668 #endif
00669 #ifndef HDferror
00670 #define HDferror(F) ferror(F)
00671 #endif
00672 #ifndef HDfflush
00673 #define HDfflush(F) fflush(F)
00674 #endif
00675 #ifndef HDfgetc
00676 #define HDfgetc(F) fgetc(F)
00677 #endif
00678 #ifndef HDfgetpos
00679 #define HDfgetpos(F,P) fgetpos(F,P)
00680 #endif
00681 #ifndef HDfgets
00682 #define HDfgets(S,N,F) fgets(S,N,F)
00683 #endif
00684 #ifndef HDfileno
00685 #define HDfileno(F) fileno(F)
00686 #endif
00687 #ifndef HDfloor
00688 #define HDfloor(X) floor(X)
00689 #endif
00690 #ifndef HDfmod
00691 #define HDfmod(X,Y) fmod(X,Y)
00692 #endif
00693 #ifndef HDfopen
00694 #define HDfopen(S,M) fopen(S,M)
00695 #endif
00696 #ifndef HDfork
00697 #define HDfork() fork()
00698 #endif
00699 #ifndef HDfpathconf
00700 #define HDfpathconf(F,N) fpathconf(F,N)
00701 #endif
00702 H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
00703 #ifndef HDfputc
00704 #define HDfputc(C,F) fputc(C,F)
00705 #endif
00706 #ifndef HDfputs
00707 #define HDfputs(S,F) fputs(S,F)
00708 #endif
00709 #ifndef HDfread
00710 #define HDfread(M,Z,N,F) fread(M,Z,N,F)
00711 #endif
00712 #ifndef HDfree
00713 #define HDfree(M) free(M)
00714 #endif
00715 #ifndef HDfreopen
00716 #define HDfreopen(S,M,F) freopen(S,M,F)
00717 #endif
00718 #ifndef HDfrexp
00719 #define HDfrexp(X,N) frexp(X,N)
00720 #endif
00721
00722 #ifndef HDfrexpf
00723 #ifdef H5_HAVE_FREXPF
00724 #define HDfrexpf(X,N) frexpf(X,N)
00725 #else
00726 #define HDfrexpf(X,N) frexp(X,N)
00727 #endif
00728 #endif
00729 #ifndef HDfrexpl
00730 #ifdef H5_HAVE_FREXPL
00731 #define HDfrexpl(X,N) frexpl(X,N)
00732 #else
00733 #define HDfrexpl(X,N) frexp(X,N)
00734 #endif
00735 #endif
00736
00737 #ifndef HDfseek
00738 #ifdef H5_HAVE_FSEEKO
00739 #define HDfseek(F,O,W) fseeko(F,O,W)
00740 #else
00741 #define HDfseek(F,O,W) fseek(F,O,W)
00742 #endif
00743 #endif
00744 #ifndef HDfsetpos
00745 #define HDfsetpos(F,P) fsetpos(F,P)
00746 #endif
00747
00748
00749
00750
00751 #if !defined(HDfstat) || !defined(HDstat)
00752 #if H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64)
00753 #ifndef HDfstat
00754 #define HDfstat(F,B) fstat64(F,B)
00755 #endif
00756 #ifndef HDstat
00757 #define HDstat(S,B) stat64(S,B)
00758 #endif
00759 typedef struct stat64 h5_stat_t;
00760 typedef off64_t h5_stat_size_t;
00761 #else
00762 #ifndef HDfstat
00763 #define HDfstat(F,B) fstat(F,B)
00764 #endif
00765 #ifndef HDstat
00766 #define HDstat(S,B) stat(S,B)
00767 #endif
00768 typedef struct stat h5_stat_t;
00769 typedef off_t h5_stat_size_t;
00770 #endif
00771 #endif
00772
00773 #ifndef HDftell
00774 #define HDftell(F) ftell(F)
00775 #endif
00776 #ifndef HDftruncate
00777 #ifdef H5_HAVE_FTRUNCATE64
00778 #define HDftruncate(F,L) ftruncate64(F,L)
00779 #else
00780 #define HDftruncate(F,L) ftruncate(F,L)
00781 #endif
00782 #endif
00783 #ifndef HDfwrite
00784 #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
00785 #endif
00786 #ifndef HDgetc
00787 #define HDgetc(F) getc(F)
00788 #endif
00789 #ifndef HDgetchar
00790 #define HDgetchar() getchar()
00791 #endif
00792 #ifndef HDgetcwd
00793 #define HDgetcwd(S,Z) getcwd(S,Z)
00794 #endif
00795 #ifndef HDgetdcwd
00796 #define HDgetdcwd(D,S,Z) getcwd(S,Z)
00797 #endif
00798 #ifndef HDgetdrive
00799 #define HDgetdrive() 0
00800 #endif
00801 #ifndef HDgetegid
00802 #define HDgetegid() getegid()
00803 #endif
00804 #ifndef HDgetenv
00805 #define HDgetenv(S) getenv(S)
00806 #endif
00807 #ifndef HDgeteuid
00808 #define HDgeteuid() geteuid()
00809 #endif
00810 #ifndef HDgetgid
00811 #define HDgetgid() getgid()
00812 #endif
00813 #ifndef HDgetgrgid
00814 #define HDgetgrgid(G) getgrgid(G)
00815 #endif
00816 #ifndef HDgetgrnam
00817 #define HDgetgrnam(S) getgrnam(S)
00818 #endif
00819 #ifndef HDgetgroups
00820 #define HDgetgroups(Z,G) getgroups(Z,G)
00821 #endif
00822 #ifndef HDgetlogin
00823 #define HDgetlogin() getlogin()
00824 #endif
00825 #ifndef HDgetpgrp
00826 #define HDgetpgrp() getpgrp()
00827 #endif
00828 #ifndef HDgetpid
00829 #define HDgetpid() getpid()
00830 #endif
00831 #ifndef HDgetppid
00832 #define HDgetppid() getppid()
00833 #endif
00834 #ifndef HDgetpwnam
00835 #define HDgetpwnam(S) getpwnam(S)
00836 #endif
00837 #ifndef HDgetpwuid
00838 #define HDgetpwuid(U) getpwuid(U)
00839 #endif
00840 #ifndef HDgetrusage
00841 #define HDgetrusage(X,S) getrusage(X,S)
00842 #endif
00843 #ifndef HDgets
00844 #define HDgets(S) gets(S)
00845 #endif
00846 #ifndef HDgettimeofday
00847 #define HDgettimeofday(S,P) gettimeofday(S,P)
00848 #endif
00849 #ifndef HDgetuid
00850 #define HDgetuid() getuid()
00851 #endif
00852 #ifndef HDgmtime
00853 #define HDgmtime(T) gmtime(T)
00854 #endif
00855 #ifndef HDisalnum
00856 #define HDisalnum(C) isalnum((int)(C))
00857 #endif
00858 #ifndef HDisalpha
00859 #define HDisalpha(C) isalpha((int)(C))
00860 #endif
00861 #ifndef HDisatty
00862 #define HDisatty(F) isatty(F)
00863 #endif
00864 #ifndef HDiscntrl
00865 #define HDiscntrl(C) iscntrl((int)(C))
00866 #endif
00867 #ifndef HDisdigit
00868 #define HDisdigit(C) isdigit((int)(C))
00869 #endif
00870 #ifndef HDisgraph
00871 #define HDisgraph(C) isgraph((int)(C))
00872 #endif
00873 #ifndef HDislower
00874 #define HDislower(C) islower((int)(C))
00875 #endif
00876 #ifndef HDisprint
00877 #define HDisprint(C) isprint((int)(C))
00878 #endif
00879 #ifndef HDispunct
00880 #define HDispunct(C) ispunct((int)(C))
00881 #endif
00882 #ifndef HDisspace
00883 #define HDisspace(C) isspace((int)(C))
00884 #endif
00885 #ifndef HDisupper
00886 #define HDisupper(C) isupper((int)(C))
00887 #endif
00888 #ifndef HDisxdigit
00889 #define HDisxdigit(C) isxdigit((int)(C))
00890 #endif
00891 #ifndef HDkill
00892 #define HDkill(P,S) kill(P,S)
00893 #endif
00894 #ifndef HDlabs
00895 #define HDlabs(X) labs(X)
00896 #endif
00897 #ifndef HDldexp
00898 #define HDldexp(X,N) ldexp(X,N)
00899 #endif
00900 #ifndef HDldiv
00901 #define HDldiv(X,Y) ldiv(X,Y)
00902 #endif
00903 #ifndef HDlink
00904 #define HDlink(OLD,NEW) link(OLD,NEW)
00905 #endif
00906 #ifndef HDlocaleconv
00907 #define HDlocaleconv() localeconv()
00908 #endif
00909 #ifndef HDlocaltime
00910 #define HDlocaltime(T) localtime(T)
00911 #endif
00912 #ifndef HDlog
00913 #define HDlog(X) log(X)
00914 #endif
00915 #ifndef HDlog10
00916 #define HDlog10(X) log10(X)
00917 #endif
00918 #ifndef HDlongjmp
00919 #define HDlongjmp(J,N) longjmp(J,N)
00920 #endif
00921 #ifndef HDlseek
00922 #ifdef H5_HAVE_LSEEK64
00923 #define HDlseek(F,O,W) lseek64(F,O,W)
00924 #else
00925 #define HDlseek(F,O,W) lseek(F,O,W)
00926 #endif
00927 #endif
00928 #ifndef HDmalloc
00929 #define HDmalloc(Z) malloc(Z)
00930 #endif
00931 #ifndef HDposix_memalign
00932 #define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z)
00933 #endif
00934 #ifndef HDmblen
00935 #define HDmblen(S,N) mblen(S,N)
00936 #endif
00937 #ifndef HDmbstowcs
00938 #define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z)
00939 #endif
00940 #ifndef HDmbtowc
00941 #define HDmbtowc(P,S,Z) mbtowc(P,S,Z)
00942 #endif
00943 #ifndef HDmemchr
00944 #define HDmemchr(S,C,Z) memchr(S,C,Z)
00945 #endif
00946 #ifndef HDmemcmp
00947 #define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
00948 #endif
00949
00950
00951
00952
00953 #ifndef HDmemcpy
00954 #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
00955 #endif
00956 #ifndef HDmemmove
00957 #define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
00958 #endif
00959 #ifndef HDmemset
00960 #define HDmemset(X,C,Z) memset(X,C,Z)
00961 #endif
00962 #ifndef HDmkdir
00963 #define HDmkdir(S,M) mkdir(S,M)
00964 #endif
00965 #ifndef HDmkfifo
00966 #define HDmkfifo(S,M) mkfifo(S,M)
00967 #endif
00968 #ifndef HDmktime
00969 #define HDmktime(T) mktime(T)
00970 #endif
00971 #ifndef HDmodf
00972 #define HDmodf(X,Y) modf(X,Y)
00973 #endif
00974 #ifndef HDopen
00975 #ifdef _O_BINARY
00976 #define HDopen(S,F,M) open(S,F|_O_BINARY,M)
00977 #else
00978 #define HDopen(S,F,M) open(S,F,M)
00979 #endif
00980 #endif
00981 #ifndef HDopendir
00982 #define HDopendir(S) opendir(S)
00983 #endif
00984 #ifndef HDpathconf
00985 #define HDpathconf(S,N) pathconf(S,N)
00986 #endif
00987 #ifndef HDpause
00988 #define HDpause() pause()
00989 #endif
00990 #ifndef HDperror
00991 #define HDperror(S) perror(S)
00992 #endif
00993 #ifndef HDpipe
00994 #define HDpipe(F) pipe(F)
00995 #endif
00996 #ifndef HDpow
00997 #define HDpow(X,Y) pow(X,Y)
00998 #endif
00999
01000 #ifndef HDputc
01001 #define HDputc(C,F) putc(C,F)
01002 #endif
01003 #ifndef HDputchar
01004 #define HDputchar(C) putchar(C)
01005 #endif
01006 #ifndef HDputs
01007 #define HDputs(S) puts(S)
01008 #endif
01009 #ifndef HDqsort
01010 #define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
01011 #endif
01012 #ifndef HDraise
01013 #define HDraise(N) raise(N)
01014 #endif
01015
01016 #ifdef H5_HAVE_RAND_R
01017 #ifndef HDrandom
01018 #define HDrandom() HDrand()
01019 #endif
01020 H5_DLL int HDrand(void);
01021 #elif H5_HAVE_RANDOM
01022 #ifndef HDrand
01023 #define HDrand() random()
01024 #endif
01025 #ifndef HDrandom
01026 #define HDrandom() random()
01027 #endif
01028 #else
01029 #ifndef HDrand
01030 #define HDrand() rand()
01031 #endif
01032 #ifndef HDrandom
01033 #define HDrandom() rand()
01034 #endif
01035 #endif
01036
01037 #ifndef HDread
01038 #define HDread(F,M,Z) read(F,M,Z)
01039 #endif
01040 #ifndef HDreaddir
01041 #define HDreaddir(D) readdir(D)
01042 #endif
01043 #ifndef HDrealloc
01044 #define HDrealloc(M,Z) realloc(M,Z)
01045 #endif
01046 #ifdef H5_VMS
01047 #ifdef __cplusplus
01048 extern "C" {
01049 #endif
01050 int HDremove_all(const char * fname);
01051 #ifdef __cplusplus
01052 }
01053 #endif
01054 #ifndef HDremove
01055 #define HDremove(S) HDremove_all(S)
01056 #endif
01057 #else
01058 #ifndef HDremove
01059 #define HDremove(S) remove(S)
01060 #endif
01061 #endif
01062 #ifndef HDrename
01063 #define HDrename(OLD,NEW) rename(OLD,NEW)
01064 #endif
01065 #ifndef HDrewind
01066 #define HDrewind(F) rewind(F)
01067 #endif
01068 #ifndef HDrewinddir
01069 #define HDrewinddir(D) rewinddir(D)
01070 #endif
01071 #ifndef HDrmdir
01072 #define HDrmdir(S) rmdir(S)
01073 #endif
01074
01075 #ifndef HDsetbuf
01076 #define HDsetbuf(F,S) setbuf(F,S)
01077 #endif
01078 #ifndef HDsetgid
01079 #define HDsetgid(G) setgid(G)
01080 #endif
01081 #ifndef HDsetjmp
01082 #define HDsetjmp(J) setjmp(J)
01083 #endif
01084 #ifndef HDsetlocale
01085 #define HDsetlocale(N,S) setlocale(N,S)
01086 #endif
01087 #ifndef HDsetpgid
01088 #define HDsetpgid(P,PG) setpgid(P,PG)
01089 #endif
01090 #ifndef HDsetsid
01091 #define HDsetsid() setsid()
01092 #endif
01093 #ifndef HDsetuid
01094 #define HDsetuid(U) setuid(U)
01095 #endif
01096 #ifndef HDsetvbuf
01097 #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z)
01098 #endif
01099 #ifndef HDsigaction
01100 #define HDsigaction(N,A) sigaction(N,A)
01101 #endif
01102 #ifndef HDsigaddset
01103 #define HDsigaddset(S,N) sigaddset(S,N)
01104 #endif
01105 #ifndef HDsigdelset
01106 #define HDsigdelset(S,N) sigdelset(S,N)
01107 #endif
01108 #ifndef HDsigemptyset
01109 #define HDsigemptyset(S) sigemptyset(S)
01110 #endif
01111 #ifndef HDsigfillset
01112 #define HDsigfillset(S) sigfillset(S)
01113 #endif
01114 #ifndef HDsigismember
01115 #define HDsigismember(S,N) sigismember(S,N)
01116 #endif
01117 #ifndef HDsiglongjmp
01118 #define HDsiglongjmp(J,N) siglongjmp(J,N)
01119 #endif
01120 #ifndef HDsignal
01121 #define HDsignal(N,F) signal(N,F)
01122 #endif
01123 #ifndef HDsigpending
01124 #define HDsigpending(S) sigpending(S)
01125 #endif
01126 #ifndef HDsigprocmask
01127 #define HDsigprocmask(H,S,O) sigprocmask(H,S,O)
01128 #endif
01129 #ifndef HDsigsetjmp
01130 #define HDsigsetjmp(J,N) sigsetjmp(J,N)
01131 #endif
01132 #ifndef HDsigsuspend
01133 #define HDsigsuspend(S) sigsuspend(S)
01134 #endif
01135 #ifndef HDsin
01136 #define HDsin(X) sin(X)
01137 #endif
01138 #ifndef HDsinh
01139 #define HDsinh(X) sinh(X)
01140 #endif
01141 #ifndef HDsleep
01142 #define HDsleep(N) sleep(N)
01143 #endif
01144 #ifndef HDsnprintf
01145 #define HDsnprintf snprintf
01146 #endif
01147
01148 #ifndef HDsqrt
01149 #define HDsqrt(X) sqrt(X)
01150 #endif
01151 #ifdef H5_HAVE_RAND_R
01152 H5_DLL void HDsrand(unsigned int seed);
01153 #ifndef HDsrandom
01154 #define HDsrandom(S) HDsrand(S)
01155 #endif
01156 #elif H5_HAVE_RANDOM
01157 #ifndef HDsrand
01158 #define HDsrand(S) srandom(S)
01159 #endif
01160 #ifndef HDsrandom
01161 #define HDsrandom(S) srandom(S)
01162 #endif
01163 #else
01164 #ifndef HDsrand
01165 #define HDsrand(S) srand(S)
01166 #endif
01167 #ifndef HDsrandom
01168 #define HDsrandom(S) srand(S)
01169 #endif
01170 #endif
01171
01172
01173 #ifndef HDstrcat
01174 #define HDstrcat(X,Y) strcat(X,Y)
01175 #endif
01176 #ifndef HDstrchr
01177 #define HDstrchr(S,C) strchr(S,C)
01178 #endif
01179 #ifndef HDstrcmp
01180 #define HDstrcmp(X,Y) strcmp(X,Y)
01181 #endif
01182 #ifndef HDstrcoll
01183 #define HDstrcoll(X,Y) strcoll(X,Y)
01184 #endif
01185 #ifndef HDstrcpy
01186 #define HDstrcpy(X,Y) strcpy(X,Y)
01187 #endif
01188 #ifndef HDstrcspn
01189 #define HDstrcspn(X,Y) strcspn(X,Y)
01190 #endif
01191 #ifndef HDstrerror
01192 #define HDstrerror(N) strerror(N)
01193 #endif
01194 #ifndef HDstrftime
01195 #define HDstrftime(S,Z,F,T) strftime(S,Z,F,T)
01196 #endif
01197 #ifndef HDstrlen
01198 #define HDstrlen(S) strlen(S)
01199 #endif
01200 #ifndef HDstrncat
01201 #define HDstrncat(X,Y,Z) strncat(X,Y,Z)
01202 #endif
01203 #ifndef HDstrncmp
01204 #define HDstrncmp(X,Y,Z) strncmp(X,Y,Z)
01205 #endif
01206 #ifndef HDstrncpy
01207 #define HDstrncpy(X,Y,Z) strncpy(X,Y,Z)
01208 #endif
01209 #ifndef HDstrpbrk
01210 #define HDstrpbrk(X,Y) strpbrk(X,Y)
01211 #endif
01212 #ifndef HDstrrchr
01213 #define HDstrrchr(S,C) strrchr(S,C)
01214 #endif
01215 #ifndef HDstrspn
01216 #define HDstrspn(X,Y) strspn(X,Y)
01217 #endif
01218 #ifndef HDstrstr
01219 #define HDstrstr(X,Y) strstr(X,Y)
01220 #endif
01221 #ifndef HDstrtod
01222 #define HDstrtod(S,R) strtod(S,R)
01223 #endif
01224 #ifndef HDstrtok
01225 #define HDstrtok(X,Y) strtok(X,Y)
01226 #endif
01227 #ifndef HDstrtol
01228 #define HDstrtol(S,R,N) strtol(S,R,N)
01229 #endif
01230 H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
01231 #ifndef HDstrtoul
01232 #define HDstrtoul(S,R,N) strtoul(S,R,N)
01233 #endif
01234 #ifndef HDstrxfrm
01235 #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z)
01236 #endif
01237 #ifndef HDsysconf
01238 #define HDsysconf(N) sysconf(N)
01239 #endif
01240 #ifndef HDsystem
01241 #define HDsystem(S) system(S)
01242 #endif
01243 #ifndef HDtan
01244 #define HDtan(X) tan(X)
01245 #endif
01246 #ifndef HDtanh
01247 #define HDtanh(X) tanh(X)
01248 #endif
01249 #ifndef HDtcdrain
01250 #define HDtcdrain(F) tcdrain(F)
01251 #endif
01252 #ifndef HDtcflow
01253 #define HDtcflow(F,A) tcflow(F,A)
01254 #endif
01255 #ifndef HDtcflush
01256 #define HDtcflush(F,N) tcflush(F,N)
01257 #endif
01258 #ifndef HDtcgetattr
01259 #define HDtcgetattr(F,T) tcgetattr(F,T)
01260 #endif
01261 #ifndef HDtcgetpgrp
01262 #define HDtcgetpgrp(F) tcgetpgrp(F)
01263 #endif
01264 #ifndef HDtcsendbreak
01265 #define HDtcsendbreak(F,N) tcsendbreak(F,N)
01266 #endif
01267 #ifndef HDtcsetattr
01268 #define HDtcsetattr(F,O,T) tcsetattr(F,O,T)
01269 #endif
01270 #ifndef HDtcsetpgrp
01271 #define HDtcsetpgrp(F,N) tcsetpgrp(F,N)
01272 #endif
01273 #ifndef HDtime
01274 #define HDtime(T) time(T)
01275 #endif
01276 #ifndef HDtimes
01277 #define HDtimes(T) times(T)
01278 #endif
01279 #ifndef HDtmpfile
01280 #define HDtmpfile() tmpfile()
01281 #endif
01282 #ifndef HDtmpnam
01283 #define HDtmpnam(S) tmpnam(S)
01284 #endif
01285 #ifndef HDtolower
01286 #define HDtolower(C) tolower(C)
01287 #endif
01288 #ifndef HDtoupper
01289 #define HDtoupper(C) toupper(C)
01290 #endif
01291 #ifndef HDttyname
01292 #define HDttyname(F) ttyname(F)
01293 #endif
01294 #ifndef HDtzset
01295 #define HDtzset() tzset()
01296 #endif
01297 #ifndef HDumask
01298 #define HDumask(N) umask(N)
01299 #endif
01300 #ifndef HDuname
01301 #define HDuname(S) uname(S)
01302 #endif
01303 #ifndef HDungetc
01304 #define HDungetc(C,F) ungetc(C,F)
01305 #endif
01306 #ifndef HDunlink
01307 #define HDunlink(S) unlink(S)
01308 #endif
01309 #ifndef HDutime
01310 #define HDutime(S,T) utime(S,T)
01311 #endif
01312 #ifndef HDva_arg
01313 #define HDva_arg(A,T) va_arg(A,T)
01314 #endif
01315 #ifndef HDva_end
01316 #define HDva_end(A) va_end(A)
01317 #endif
01318 #ifndef HDva_start
01319 #define HDva_start(A,P) va_start(A,P)
01320 #endif
01321 #ifndef HDvasprintf
01322 #define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A)
01323 #endif
01324 #ifndef HDvfprintf
01325 #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A)
01326 #endif
01327 #ifndef HDvprintf
01328 #define HDvprintf(FMT,A) vprintf(FMT,A)
01329 #endif
01330 #ifndef HDvsprintf
01331 #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
01332 #endif
01333 #ifndef HDvsnprintf
01334 #define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
01335 #endif
01336 #ifndef HDwait
01337 #define HDwait(W) wait(W)
01338 #endif
01339 #ifndef HDwaitpid
01340 #define HDwaitpid(P,W,O) waitpid(P,W,O)
01341 #endif
01342 #ifndef HDwcstombs
01343 #define HDwcstombs(S,P,Z) wcstombs(S,P,Z)
01344 #endif
01345 #ifndef HDwctomb
01346 #define HDwctomb(S,C) wctomb(S,C)
01347 #endif
01348 #ifndef HDwrite
01349 #define HDwrite(F,M,Z) write(F,M,Z)
01350 #endif
01351
01352
01353
01354
01355
01356 #if !defined strdup && !defined H5_HAVE_STRDUP
01357 extern char *strdup(const char *s);
01358 #endif
01359
01360 #ifndef HDstrdup
01361 #define HDstrdup(S) strdup(S)
01362 #endif
01363
01364 #ifndef HDpthread_self
01365 #define HDpthread_self() pthread_self()
01366 #endif
01367
01368
01369 #ifndef HDpthread_self_ulong
01370 #define HDpthread_self_ulong() ((unsigned long)pthread_self())
01371 #endif
01372
01373 #if defined(H5_HAVE_WINDOW_PATH)
01374
01375
01376 #define DIR_SLASH_SEPC '/'
01377 #define DIR_SEPC '\\'
01378 #define DIR_SEPS "\\"
01379 #define CHECK_DELIMITER(SS) ((SS == DIR_SEPC)||(SS == DIR_SLASH_SEPC))
01380 #define CHECK_ABSOLUTE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':') && (CHECK_DELIMITER(NAME[2])))
01381 #define CHECK_ABS_DRIVE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':'))
01382 #define CHECK_ABS_PATH(NAME) (CHECK_DELIMITER(NAME[0]))
01383
01384 #define GET_LAST_DELIMITER(NAME, ptr) { \
01385 char *slash, *backslash; \
01386 slash = strrchr(NAME, DIR_SLASH_SEPC); \
01387 backslash = strrchr(NAME, DIR_SEPC); \
01388 if (backslash > slash) \
01389 (ptr = backslash); \
01390 else \
01391 (ptr = slash); \
01392 }
01393
01394 #elif defined(H5_HAVE_VMS_PATH)
01395
01396
01397
01398 #define DIR_SEPC '.'
01399 #define DIR_SEPS "."
01400 #define CHECK_DELIMITER(SS) (SS == DIR_SEPC)
01401 #define CHECK_ABSOLUTE(NAME) (strrchr(NAME, ':') && strrchr(NAME, '['))
01402 #define CHECK_ABS_DRIVE(NAME) (0)
01403 #define CHECK_ABS_PATH(NAME) (0)
01404 #define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, ']');
01405
01406 #else
01407
01408 #define DIR_SEPC '/'
01409 #define DIR_SEPS "/"
01410 #define CHECK_DELIMITER(SS) (SS == DIR_SEPC)
01411 #define CHECK_ABSOLUTE(NAME) (CHECK_DELIMITER(*NAME))
01412 #define CHECK_ABS_DRIVE(NAME) (0)
01413 #define CHECK_ABS_PATH(NAME) (0)
01414 #define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, DIR_SEPC);
01415
01416 #endif
01417
01418 #define COLON_SEPC ':'
01419 H5_DLL herr_t H5_build_extpath(const char *, char ** );
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432 typedef enum {
01433 H5_PKG_A,
01434 H5_PKG_AC,
01435 H5_PKG_B,
01436 H5_PKG_D,
01437 H5_PKG_E,
01438 H5_PKG_F,
01439 H5_PKG_G,
01440 H5_PKG_HG,
01441 H5_PKG_HL,
01442 H5_PKG_I,
01443 H5_PKG_MF,
01444 H5_PKG_MM,
01445 H5_PKG_O,
01446 H5_PKG_P,
01447 H5_PKG_S,
01448 H5_PKG_T,
01449 H5_PKG_V,
01450 H5_PKG_Z,
01451 H5_NPKGS
01452 } H5_pkg_t;
01453
01454 typedef struct H5_debug_t {
01455 FILE *trace;
01456 hbool_t ttop;
01457 hbool_t ttimes;
01458 struct {
01459 const char *name;
01460 FILE *stream;
01461 } pkg[H5_NPKGS];
01462 } H5_debug_t;
01463
01464 extern H5_debug_t H5_debug_g;
01465 #define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream)
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483 #ifdef H5_DEBUG_API
01484 #define H5TRACE_DECL const char *RTYPE=NULL; \
01485 double CALLTIME;
01486 #define H5TRACE0(R,T) RTYPE=R; \
01487 CALLTIME=H5_trace(NULL,FUNC,T)
01488 #define H5TRACE1(R,T,A0) RTYPE=R; \
01489 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0)
01490 #define H5TRACE2(R,T,A0,A1) RTYPE=R; \
01491 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1)
01492 #define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \
01493 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2)
01494 #define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \
01495 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3)
01496 #define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \
01497 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
01498 #A4,A4)
01499 #define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \
01500 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
01501 #A4,A4,#A5,A5)
01502 #define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) RTYPE=R; \
01503 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
01504 #A4,A4,#A5,A5,#A6,A6)
01505 #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) RTYPE=R; \
01506 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
01507 #A4,A4,#A5,A5,#A6,A6,#A7,A7)
01508 #define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) RTYPE=R; \
01509 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
01510 #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8)
01511 #define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) RTYPE=R; \
01512 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
01513 #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9)
01514 #define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) RTYPE=R; \
01515 CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
01516 #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9, \
01517 #A10,A10)
01518 #define H5TRACE_RETURN(V) if (RTYPE) { \
01519 H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \
01520 RTYPE=NULL; \
01521 }
01522 #else
01523 #define H5TRACE_DECL
01524 #define H5TRACE0(R,T)
01525 #define H5TRACE1(R,T,A0)
01526 #define H5TRACE2(R,T,A0,A1)
01527 #define H5TRACE3(R,T,A0,A1,A2)
01528 #define H5TRACE4(R,T,A0,A1,A2,A3)
01529 #define H5TRACE5(R,T,A0,A1,A2,A3,A4)
01530 #define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5)
01531 #define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6)
01532 #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7)
01533 #define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8)
01534 #define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9)
01535 #define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10)
01536 #define H5TRACE_RETURN(V)
01537 #endif
01538
01539 H5_DLL double H5_trace(const double *calltime, const char *func, const char *type, ...);
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566 #define H5_IS_API(S) ('_'!=S[2] && '_'!=S[3] && (!S[4] || '_'!=S[4]))
01567
01568
01569 extern char H5_lib_vers_info_g[];
01570
01571
01572 #ifdef H5_HAVE_THREADSAFE
01573
01574
01575 #include "H5TSprivate.h"
01576
01577
01578 typedef struct H5_api_struct {
01579 H5TS_mutex_t init_lock;
01580 hbool_t H5_libinit_g;
01581 } H5_api_t;
01582
01583
01584 #define H5_INIT_GLOBAL H5_g.H5_libinit_g
01585
01586
01587 #define H5_FIRST_THREAD_INIT \
01588 pthread_once(&H5TS_first_init_g, H5TS_first_thread_init);
01589
01590
01591 #define H5_API_LOCK \
01592 H5TS_mutex_lock(&H5_g.init_lock);
01593 #define H5_API_UNLOCK \
01594 H5TS_mutex_unlock(&H5_g.init_lock);
01595
01596
01597 #define H5_API_UNSET_CANCEL \
01598 H5TS_cancel_count_inc();
01599
01600 #define H5_API_SET_CANCEL \
01601 H5TS_cancel_count_dec();
01602
01603 extern H5_api_t H5_g;
01604
01605 #else
01606
01607
01608 #define H5_FIRST_THREAD_INIT
01609
01610
01611 #define H5_API_LOCK
01612 #define H5_API_UNLOCK
01613
01614
01615 #define H5_API_UNSET_CANCEL
01616 #define H5_API_SET_CANCEL
01617
01618
01619 extern hbool_t H5_libinit_g;
01620
01621
01622 #define H5_INIT_GLOBAL H5_libinit_g
01623
01624 #endif
01625
01626 #ifdef H5_HAVE_CODESTACK
01627
01628
01629 #include "H5CSprivate.h"
01630
01631 #define H5_PUSH_FUNC(func_name) H5CS_push(#func_name)
01632 #define H5_POP_FUNC H5CS_pop()
01633 #else
01634 #define H5_PUSH_FUNC(func_name)
01635 #define H5_POP_FUNC
01636 #endif
01637
01638 #ifdef H5_HAVE_MPE
01639 extern hbool_t H5_MPEinit_g;
01640 #endif
01641
01642
01643 #ifdef H5_HAVE_FUNCTION
01644 #define H5_CHECK_FUNCNAME(func_name) \
01645 assert(!HDstrcmp(#func_name, __FUNCTION__))
01646 #else
01647 #define H5_CHECK_FUNCNAME(func_name) \
01648 assert(func_name)
01649 #endif
01650
01651
01652 #ifdef H5_INTERFACE_INIT_FUNC
01653 static int H5_interface_initialize_g = 0;
01654 static herr_t H5_INTERFACE_INIT_FUNC(void);
01655 #define H5_INTERFACE_INIT(err) \
01656 \
01657 if (!H5_interface_initialize_g) { \
01658 H5_interface_initialize_g = 1; \
01659 if (H5_INTERFACE_INIT_FUNC()<0) { \
01660 H5_interface_initialize_g = 0; \
01661 HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \
01662 "interface initialization failed") \
01663 } \
01664 }
01665 #else
01666 #define H5_INTERFACE_INIT(err)
01667 #endif
01668
01669
01670 #ifndef NDEBUG
01671 #define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt) \
01672 static hbool_t func_check = FALSE; \
01673 \
01674 if(!func_check) { \
01675 \
01676 HDassert(asrt); \
01677 \
01678 \
01679 H5_CHECK_FUNCNAME(func_name); \
01680 \
01681 \
01682 func_check = TRUE; \
01683 }
01684 #else
01685 #define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt)
01686 #endif
01687
01688 #define FUNC_ENTER_COMMON(func_name,asrt) \
01689 static const char FUNC[]=#func_name; \
01690 FUNC_ENTER_COMMON_NOFUNC(func_name,asrt);
01691
01692
01693 #define FUNC_ENTER_API_THREADSAFE \
01694 \
01695 H5_FIRST_THREAD_INIT \
01696 \
01697 \
01698 H5_API_UNSET_CANCEL \
01699 H5_API_LOCK
01700
01701
01702 #define FUNC_LEAVE_API_THREADSAFE \
01703 H5_API_UNLOCK \
01704 H5_API_SET_CANCEL
01705
01706
01707 #define FUNC_ENTER_API_VARS(func_name) \
01708 MPE_LOG_VARS(func_name) \
01709 H5TRACE_DECL
01710
01711
01712 #define FUNC_ENTER_API(func_name,err) {{ \
01713 FUNC_ENTER_API_VARS(func_name) \
01714 FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
01715 FUNC_ENTER_API_THREADSAFE; \
01716 FUNC_ENTER_API_COMMON(func_name,err); \
01717 \
01718 H5E_clear_stack(NULL); \
01719 {
01720
01721
01722
01723
01724
01725 #define FUNC_ENTER_API_NOCLEAR(func_name,err) {{ \
01726 FUNC_ENTER_API_VARS(func_name) \
01727 FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
01728 FUNC_ENTER_API_THREADSAFE; \
01729 FUNC_ENTER_API_COMMON(func_name,err); \
01730 {
01731
01732
01733
01734
01735
01736
01737
01738 #define FUNC_ENTER_API_NOINIT(func_name) {{ \
01739 FUNC_ENTER_API_VARS(func_name) \
01740 FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
01741 FUNC_ENTER_API_THREADSAFE; \
01742 H5_PUSH_FUNC(func_name); \
01743 BEGIN_MPE_LOG(func_name); \
01744 {
01745
01746
01747
01748
01749
01750
01751
01752
01753 #define FUNC_ENTER_API_NOINIT_NOFS(func_name) {{ \
01754 FUNC_ENTER_API_VARS(func_name) \
01755 FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
01756 FUNC_ENTER_API_THREADSAFE; \
01757 BEGIN_MPE_LOG(func_name); \
01758 {
01759
01760
01761 #define FUNC_ENTER_NOAPI(func_name,err) { \
01762 FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \
01763 FUNC_ENTER_NOAPI_INIT(func_name,err) \
01764 {
01765
01766
01767 #define FUNC_ENTER_NOAPI_NOFUNC(func_name) { \
01768 FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \
01769 FUNC_ENTER_NOAPI_INIT(func_name,err) \
01770 {
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780 #define FUNC_ENTER_NOAPI_NOINIT(func_name) { \
01781 FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \
01782 H5_PUSH_FUNC(func_name); \
01783 {
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797 #define FUNC_ENTER_NOAPI_NOINIT_NOFUNC(func_name) { \
01798 FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \
01799 H5_PUSH_FUNC(func_name); \
01800 {
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811 #define FUNC_ENTER_NOAPI_NOFUNC_NOFS(func_name) { \
01812 FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \
01813 {
01814
01815 #define FUNC_ENTER_API_COMMON(func_name,err) \
01816 \
01817 if (!(H5_INIT_GLOBAL)) { \
01818 H5_INIT_GLOBAL = TRUE; \
01819 if (H5_init_library()<0) \
01820 HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \
01821 "library initialization failed") \
01822 } \
01823 \
01824 \
01825 H5_INTERFACE_INIT(err) \
01826 \
01827 \
01828 H5_PUSH_FUNC(func_name); \
01829 \
01830 BEGIN_MPE_LOG(func_name)
01831
01832
01833 #define FUNC_ENTER_NOAPI_INIT(func_name,err) \
01834 \
01835 H5_INTERFACE_INIT(err) \
01836 \
01837 \
01838 H5_PUSH_FUNC(func_name);
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856 #define FUNC_LEAVE_API(ret_value) \
01857 FINISH_MPE_LOG; \
01858 H5TRACE_RETURN(ret_value); \
01859 H5_POP_FUNC; \
01860 FUNC_LEAVE_API_THREADSAFE \
01861 return (ret_value); \
01862 } \
01863 }}
01864
01865 #define FUNC_LEAVE_API_NOFS(ret_value) \
01866 FINISH_MPE_LOG; \
01867 H5TRACE_RETURN(ret_value); \
01868 FUNC_LEAVE_API_THREADSAFE \
01869 return (ret_value); \
01870 } \
01871 }}
01872
01873 #define FUNC_LEAVE_NOAPI(ret_value) \
01874 H5_POP_FUNC; \
01875 return (ret_value); \
01876 } \
01877 }
01878
01879 #define FUNC_LEAVE_NOAPI_VOID \
01880 H5_POP_FUNC; \
01881 return; \
01882 } \
01883 }
01884
01885
01886
01887
01888
01889
01890 #define FUNC_LEAVE_NOAPI_NOFS(ret_value) \
01891 return (ret_value); \
01892 } \
01893 }
01894
01895
01896
01897 #define H5_GLUE(x,y) x##y
01898 #define H5_GLUE3(x,y,z) x##y##z
01899
01900
01901 #define HDcompile_assert(e) do { enum { compile_assert__ = 1 / (e) }; } while(0)
01902
01903
01904 H5_DLL herr_t H5_init_library(void);
01905 H5_DLL void H5_term_library(void);
01906
01907
01908 H5_DLL int H5A_term_interface(void);
01909 H5_DLL int H5AC_term_interface(void);
01910 H5_DLL int H5D_term_interface(void);
01911 H5_DLL int H5E_term_interface(void);
01912 H5_DLL int H5F_term_interface(void);
01913 H5_DLL int H5FS_term_interface(void);
01914 H5_DLL int H5G_term_interface(void);
01915 H5_DLL int H5I_term_interface(void);
01916 H5_DLL int H5L_term_interface(void);
01917 H5_DLL int H5P_term_interface(void);
01918 H5_DLL int H5R_term_interface(void);
01919 H5_DLL int H5S_term_interface(void);
01920 H5_DLL int H5T_term_interface(void);
01921 H5_DLL int H5Z_term_interface(void);
01922
01923
01924 H5_DLL uint32_t H5_checksum_fletcher32(const void *data, size_t len);
01925 H5_DLL uint32_t H5_checksum_crc(const void *data, size_t len);
01926 H5_DLL uint32_t H5_checksum_lookup3(const void *data, size_t len, uint32_t initval);
01927 H5_DLL uint32_t H5_checksum_metadata(const void *data, size_t len, uint32_t initval);
01928 H5_DLL uint32_t H5_hash_string(const char *str);
01929
01930
01931 H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, uint8_t *buf,
01932 uint8_t *marker, size_t buf_offset, size_t buf_size);
01933
01934 #endif
01935