HDF5  1.12.0
H5private.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF5. The full HDF5 copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the COPYING file, which can be found at the root of the source code *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /* Programmer: Robb Matzke <matzke@llnl.gov>
15  * Friday, October 30, 1998
16  *
17  * Purpose: This file is included by all HDF5 library source files to
18  * define common things which are not defined in the HDF5 API.
19  * The configuration constants like H5_HAVE_UNISTD_H etc. are
20  * defined in H5config.h which is included by H5public.h.
21  *
22  */
23 
24 #ifndef _H5private_H
25 #define _H5private_H
26 
27 #include "H5public.h" /* Include Public Definitions */
28 
29 /* include the pthread header */
30 #ifdef H5_HAVE_THREADSAFE
31  #ifdef H5_HAVE_WIN32_API
32  #ifndef H5_HAVE_WIN_THREADS
33  #ifdef H5_HAVE_PTHREAD_H
34  #include <pthread.h>
35  #endif /* H5_HAVE_PTHREAD_H */
36  #endif /* H5_HAVE_WIN_THREADS */
37  #else /* H5_HAVE_WIN32_API */
38  #ifdef H5_HAVE_PTHREAD_H
39  #include <pthread.h>
40  #endif /* H5_HAVE_PTHREAD_H */
41  #endif /* H5_HAVE_WIN32_API */
42 #endif /* H5_HAVE_THREADSAFE */
43 
44 /*
45  * Include ANSI-C header files.
46  */
47 #ifdef H5_STDC_HEADERS
48 # include <assert.h>
49 # include <ctype.h>
50 # include <errno.h>
51 # include <fcntl.h>
52 # include <float.h>
53 # include <limits.h>
54 # include <math.h>
55 # include <signal.h>
56 # include <stdio.h>
57 # include <stdlib.h>
58 # include <string.h>
59 #endif
60 
61 /*
62  * If _POSIX_VERSION is defined in unistd.h then this system is Posix.1
63  * compliant. Otherwise all bets are off.
64  */
65 #ifdef H5_HAVE_UNISTD_H
66 # include <sys/types.h>
67 # include <unistd.h>
68 #endif
69 #ifdef _POSIX_VERSION
70 # include <sys/wait.h>
71 # include <pwd.h>
72 #endif
73 
74 /*
75  * C9x integer types
76  */
77 #ifndef __cplusplus
78 #ifdef H5_HAVE_STDINT_H
79 # include <stdint.h>
80 #endif
81 #endif
82 
83 /*
84  * The `struct stat' data type for stat() and fstat(). This is a Posix file
85  * but often apears on non-Posix systems also. The `struct stat' is required
86  * for hdf5 to compile, although only a few fields are actually used.
87  */
88 #ifdef H5_HAVE_SYS_STAT_H
89 # include <sys/stat.h>
90 #endif
91 
92 /*
93  * If a program may include both `time.h' and `sys/time.h' then
94  * TIME_WITH_SYS_TIME is defined (see AC_HEADER_TIME in configure.ac).
95  * On some older systems, `sys/time.h' includes `time.h' but `time.h' is not
96  * protected against multiple inclusion, so programs should not explicitly
97  * include both files. This macro is useful in programs that use, for example,
98  * `struct timeval' or `struct timezone' as well as `struct tm'. It is best
99  * used in conjunction with `HAVE_SYS_TIME_H', whose existence is checked
100  * by `AC_CHECK_HEADERS(sys/time.h)' in configure.ac.
101  */
102 #if defined(H5_TIME_WITH_SYS_TIME)
103 # include <sys/time.h>
104 # include <time.h>
105 #elif defined(H5_HAVE_SYS_TIME_H)
106 # include <sys/time.h>
107 #else
108 # include <time.h>
109 #endif
110 
111 /*
112  * Longjumps are used to detect alignment constrants
113  */
114 #ifdef H5_HAVE_SETJMP_H
115 # include <setjmp.h>
116 #endif
117 
118 /*
119  * flock() in sys/file.h is used for the implementation of file locking.
120  */
121 #if defined(H5_HAVE_FLOCK) && defined(H5_HAVE_SYS_FILE_H)
122 # include <sys/file.h>
123 #endif
124 
125 /*
126  * Resource usage is not Posix.1 but HDF5 uses it anyway for some performance
127  * and debugging code if available.
128  */
129 #ifdef H5_HAVE_SYS_RESOURCE_H
130 # include <sys/resource.h>
131 #endif
132 
133 /*
134  * Unix ioctls. These are used by h5ls (and perhaps others) to determine a
135  * reasonable output width.
136  */
137 #ifdef H5_HAVE_SYS_IOCTL_H
138 # include <sys/ioctl.h>
139 #endif
140 
141 /*
142  * System information. These are needed on the DEC Alpha to turn off fixing
143  * of unaligned accesses by the operating system during detection of
144  * alignment constraints in H5detect.c:main().
145  */
146 #ifdef H5_HAVE_SYS_SYSINFO_H
147 # include <sys/sysinfo.h>
148 #endif
149 #ifdef H5_HAVE_SYS_PROC_H
150 # include <sys/proc.h>
151 #endif
152 #ifdef H5_HAVE_IO_H
153 # include <io.h>
154 #endif
155 
156 /*
157  * Dynamic library handling. These are needed for dynamically loading I/O
158  * filters and VFDs.
159  */
160 #ifdef H5_HAVE_DLFCN_H
161 #include <dlfcn.h>
162 #endif
163 #ifdef H5_HAVE_DIRENT_H
164 #include <dirent.h>
165 #endif
166 
167 /* Define the default VFD for this platform.
168  * Since the removal of the Windows VFD, this is sec2 for all platforms.
169  */
170 #define H5_DEFAULT_VFD H5FD_SEC2
171 
172 /* Define the default VOL driver */
173 #define H5_DEFAULT_VOL H5VL_NATIVE
174 
175 #ifdef H5_HAVE_WIN32_API
176 /* The following two defines must be before any windows headers are included */
177 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
178 #define NOGDI /* Exclude Graphic Display Interface macros */
179 
180 #ifdef H5_HAVE_WINSOCK2_H
181 #include <winsock2.h>
182 #endif
183 
184 #ifdef H5_HAVE_THREADSAFE
185 #include <process.h> /* For _beginthread() */
186 #endif
187 
188 #include <windows.h>
189 #include <direct.h> /* For _getcwd() */
190 
191 #endif /*H5_HAVE_WIN32_API*/
192 
193 /* Various ways that inline functions can be declared */
194 #if defined(H5_HAVE___INLINE__)
195  /* GNU (alternative form) */
196  #define H5_INLINE __inline__
197 #elif defined(H5_HAVE___INLINE)
198  /* Visual Studio */
199  #define H5_INLINE __inline
200 #elif defined(H5_HAVE_INLINE)
201  /* GNU, C++
202  * Use "inline" as a last resort on the off-chance that there will
203  * be C++ problems.
204  */
205  #define H5_INLINE inline
206 #else
207  #define H5_INLINE
208 #endif /* inline choices */
209 
210 #ifndef F_OK
211 # define F_OK 00
212 # define W_OK 02
213 # define R_OK 04
214 #endif
215 
216 /*
217  * MPE Instrumentation support
218  */
219 #ifdef H5_HAVE_MPE
220 /*------------------------------------------------------------------------
221  * Purpose: Begin to collect MPE log information for a function. It should
222  * be ahead of the actual function's process.
223  *
224  * Programmer: Long Wang
225  *
226  *------------------------------------------------------------------------
227  */
228 #include "mpe.h"
229 /*
230  * #define eventa(func_name) h5_mpe_ ## func_name ## _a
231  * #define eventb(func_name) h5_mpe_ ## func_name ## _b
232  */
233 #define eventa(func_name) h5_mpe_eventa
234 #define eventb(func_name) h5_mpe_eventb
235 #define MPE_LOG_VARS \
236  static int eventa(FUNC) = -1; \
237  static int eventb(FUNC) = -1; \
238  char p_event_start[128];
239 
240 /* Hardwire the color to "red", since that's what all the routines are using
241  * now. In the future, if we want to change that color for a given routine,
242  * we should define a "FUNC_ENTER_API_COLOR" macro which takes an extra 'color'
243  * parameter and then make additional FUNC_ENTER_<foo>_COLOR macros to get that
244  * color information down to the BEGIN_MPE_LOG macro (which should have a new
245  * BEGIN_MPE_LOG_COLOR variant). -QAK
246  */
247 #define BEGIN_MPE_LOG \
248  if (H5_MPEinit_g){ \
249  sprintf(p_event_start, "start %s", FUNC); \
250  if (eventa(FUNC) == -1 && eventb(FUNC) == -1) { \
251  const char* p_color = "red"; \
252  eventa(FUNC)=MPE_Log_get_event_number(); \
253  eventb(FUNC)=MPE_Log_get_event_number(); \
254  MPE_Describe_state(eventa(FUNC), eventb(FUNC), FUNC, p_color); \
255  } \
256  MPE_Log_event(eventa(FUNC), 0, p_event_start); \
257  }
258 
259 
260 /*------------------------------------------------------------------------
261  * Purpose: Finish the collection of MPE log information for a function.
262  * It should be after the actual function's process.
263  *
264  * Programmer: Long Wang
265  */
266 #define FINISH_MPE_LOG \
267  if (H5_MPEinit_g) { \
268  MPE_Log_event(eventb(FUNC), 0, FUNC); \
269  }
270 
271 #else /* H5_HAVE_MPE */
272 #define MPE_LOG_VARS /* void */
273 #define BEGIN_MPE_LOG /* void */
274 #define FINISH_MPE_LOG /* void */
275 
276 #endif /* H5_HAVE_MPE */
277 
278 /*
279  * dmalloc (debugging malloc) support
280  */
281 #ifdef H5_HAVE_DMALLOC_H
282 #include "dmalloc.h"
283 #endif /* H5_HAVE_DMALLOC_H */
284 
285 /*
286  * NT doesn't define SIGBUS, but since NT only runs on processors
287  * that do not have alignment constraints a SIGBUS would never be
288  * raised, so we just replace it with SIGILL (which also should
289  * never be raised by the hdf5 library).
290  */
291 #ifndef SIGBUS
292 # define SIGBUS SIGILL
293 #endif
294 
295 /*
296  * Does the compiler support the __attribute__(()) syntax? It's no
297  * big deal if we don't.
298  *
299  * Note that Solaris Studio supports attribute, but does not support the
300  * attributes we use.
301  *
302  * H5_ATTR_CONST is redefined in tools/h5repack/dynlib_rpk.c to quiet
303  * gcc warnings (it has to use the public API and can't include this
304  * file). Be sure to update that file if the #ifdefs change here.
305  */
306 #ifdef __cplusplus
307 # define H5_ATTR_FORMAT(X,Y,Z) /*void*/
308 # define H5_ATTR_UNUSED /*void*/
309 # define H5_ATTR_NDEBUG_UNUSED /*void*/
310 # define H5_ATTR_NORETURN /*void*/
311 # define H5_ATTR_CONST /*void*/
312 # define H5_ATTR_PURE /*void*/
313 # define H5_ATTR_FALLTHROUGH /*void*/
314 #else /* __cplusplus */
315 #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C)
316 # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z)))
317 # define H5_ATTR_UNUSED __attribute__((unused))
318 #ifndef NDEBUG
319 #define H5_ATTR_NDEBUG_UNUSED /*void*/
320 #else /* NDEBUG */
321 #define H5_ATTR_NDEBUG_UNUSED H5_ATTR_UNUSED
322 #endif /* NDEBUG */
323 # define H5_ATTR_NORETURN __attribute__((noreturn))
324 # define H5_ATTR_CONST __attribute__((const))
325 # define H5_ATTR_PURE __attribute__((pure))
326 #if defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
327 # define H5_ATTR_FALLTHROUGH __attribute__((fallthrough));
328 #else
329 # define H5_ATTR_FALLTHROUGH /*void*/
330 #endif
331 #else
332 # define H5_ATTR_FORMAT(X,Y,Z) /*void*/
333 # define H5_ATTR_UNUSED /*void*/
334 # define H5_ATTR_NDEBUG_UNUSED /*void*/
335 # define H5_ATTR_NORETURN /*void*/
336 # define H5_ATTR_CONST /*void*/
337 # define H5_ATTR_PURE /*void*/
338 # define H5_ATTR_FALLTHROUGH /*void*/
339 #endif
340 #endif /* __cplusplus */
341 
342 /*
343  * Status return values for the `herr_t' type.
344  * Since some unix/c routines use 0 and -1 (or more precisely, non-negative
345  * vs. negative) as their return code, and some assumption had been made in
346  * the code about that, it is important to keep these constants the same
347  * values. When checking the success or failure of an integer-valued
348  * function, remember to compare against zero and not one of these two
349  * values.
350  */
351 #define SUCCEED 0
352 #define FAIL (-1)
353 #define UFAIL (unsigned)(-1)
354 
355 /* The HDF5 library uses the symbol `ERR` frequently. So do
356  * header files for libraries such as curses(3), terminfo(3), etc.
357  * Remove its definition here to avoid clashes with HDF5.
358  */
359 #ifdef ERR
360 #undef ERR
361 #endif
362 
363 /* number of members in an array */
364 #ifndef NELMTS
365 # define NELMTS(X) (sizeof(X)/sizeof(X[0]))
366 #endif
367 
368 /* minimum of two, three, or four values */
369 #undef MIN
370 #define MIN(a,b) (((a)<(b)) ? (a) : (b))
371 #define MIN2(a,b) MIN(a,b)
372 #define MIN3(a,b,c) MIN(a,MIN(b,c))
373 #define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d))
374 
375 /* maximum of two, three, or four values */
376 #undef MAX
377 #define MAX(a,b) (((a)>(b)) ? (a) : (b))
378 #define MAX2(a,b) MAX(a,b)
379 #define MAX3(a,b,c) MAX(a,MAX(b,c))
380 #define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
381 
382 /* limit the middle value to be within a range (inclusive) */
383 #define RANGE(LO,X,HI) MAX(LO,MIN(X,HI))
384 
385 /* absolute value */
386 #ifndef ABS
387 # define ABS(a) (((a)>=0) ? (a) : -(a))
388 #endif
389 
390 /* sign of argument */
391 #ifndef SIGN
392 # define SIGN(a) ((a)>0 ? 1 : (a)<0 ? -1 : 0)
393 #endif
394 
395 /* test for number that is a power of 2 */
396 /* (from: http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2) */
397 # define POWER_OF_TWO(n) (!(n & (n - 1)) && n)
398 
399 /* Raise an integer to a power of 2 */
400 # define H5_EXP2(n) (1 << (n))
401 
402 /*
403  * HDF Boolean type.
404  */
405 #ifndef FALSE
406  #define FALSE false
407 #endif
408 #ifndef TRUE
409  #define TRUE true
410 #endif
411 
412 /*
413  * Numeric data types. Some of these might be defined in Posix.1g, otherwise
414  * we define them with the closest available type which is at least as large
415  * as the number of bits indicated in the type name. The `int8' types *must*
416  * be exactly one byte wide because we use it for pointer calculations to
417  * void* memory.
418  */
419 #if H5_SIZEOF_INT8_T==0
420  typedef signed char int8_t;
421 # undef H5_SIZEOF_INT8_T
422 # define H5_SIZEOF_INT8_T H5_SIZEOF_CHAR
423 #elif H5_SIZEOF_INT8_T==1
424 #else
425 # error "the int8_t type must be 1 byte wide"
426 #endif
427 
428 #if H5_SIZEOF_UINT8_T==0
429  typedef unsigned char uint8_t;
430 # undef H5_SIZEOF_UINT8_T
431 # define H5_SIZEOF_UINT8_T H5_SIZEOF_CHAR
432 #elif H5_SIZEOF_UINT8_T==1
433 #else
434 # error "the uint8_t type must be 1 byte wide"
435 #endif
436 
437 #if H5_SIZEOF_INT16_T>=2
438 #elif H5_SIZEOF_SHORT>=2
439  typedef short int16_t;
440 # undef H5_SIZEOF_INT16_T
441 # define H5_SIZEOF_INT16_T H5_SIZEOF_SHORT
442 #elif H5_SIZEOF_INT>=2
443  typedef int int16_t;
444 # undef H5_SIZEOF_INT16_T
445 # define H5_SIZEOF_INT16_T H5_SIZEOF_INT
446 #else
447 # error "nothing appropriate for int16_t"
448 #endif
449 
450 #if H5_SIZEOF_UINT16_T>=2
451 #elif H5_SIZEOF_SHORT>=2
452  typedef unsigned short uint16_t;
453 # undef H5_SIZEOF_UINT16_T
454 # define H5_SIZEOF_UINT16_T H5_SIZEOF_SHORT
455 #elif H5_SIZEOF_INT>=2
456  typedef unsigned uint16_t;
457 # undef H5_SIZEOF_UINT16_T
458 # define H5_SIZEOF_UINT16_T H5_SIZEOF_INT
459 #else
460 # error "nothing appropriate for uint16_t"
461 #endif
462 
463 #if H5_SIZEOF_INT32_T>=4
464 #elif H5_SIZEOF_SHORT>=4
465  typedef short int32_t;
466 # undef H5_SIZEOF_INT32_T
467 # define H5_SIZEOF_INT32_T H5_SIZEOF_SHORT
468 #elif H5_SIZEOF_INT>=4
469  typedef int int32_t;
470 # undef H5_SIZEOF_INT32_T
471 # define H5_SIZEOF_INT32_T H5_SIZEOF_INT
472 #elif H5_SIZEOF_LONG>=4
473  typedef long int32_t;
474 # undef H5_SIZEOF_INT32_T
475 # define H5_SIZEOF_INT32_T H5_SIZEOF_LONG
476 #else
477 # error "nothing appropriate for int32_t"
478 #endif
479 
480 /*
481  * Maximum and minimum values. These should be defined in <limits.h> for the
482  * most part.
483  */
484 #ifndef LLONG_MAX
485 # define LLONG_MAX ((long long)(((unsigned long long)1 \
486  <<(8*sizeof(long long)-1))-1))
487 # define LLONG_MIN ((long long)(-LLONG_MAX)-1)
488 #endif
489 #ifndef ULLONG_MAX
490 # define ULLONG_MAX ((unsigned long long)((long long)(-1)))
491 #endif
492 #ifndef SIZET_MAX
493 # define SIZET_MAX ((size_t)(ssize_t)(-1))
494 # define SSIZET_MAX ((ssize_t)(((size_t)1<<(8*sizeof(ssize_t)-1))-1))
495 #endif
496 
497 /*
498  * Maximum & minimum values for our typedefs.
499  */
500 #define HSIZET_MAX ((hsize_t)ULLONG_MAX)
501 #define HSSIZET_MAX ((hssize_t)LLONG_MAX)
502 #define HSSIZET_MIN (~(HSSIZET_MAX))
503 
504 /*
505  * Types and max sizes for POSIX I/O.
506  * OS X (Darwin) is odd since the max I/O size does not match the types.
507  */
508 #if defined(H5_HAVE_WIN32_API)
509 # define h5_posix_io_t unsigned int
510 # define h5_posix_io_ret_t int
511 # define H5_POSIX_MAX_IO_BYTES INT_MAX
512 #elif defined(H5_HAVE_DARWIN)
513 # define h5_posix_io_t size_t
514 # define h5_posix_io_ret_t ssize_t
515 # define H5_POSIX_MAX_IO_BYTES INT_MAX
516 #else
517 # define h5_posix_io_t size_t
518 # define h5_posix_io_ret_t ssize_t
519 # define H5_POSIX_MAX_IO_BYTES SSIZET_MAX
520 #endif
521 
522 /* POSIX I/O mode used as the third parameter to open/_open
523  * when creating a new file (O_CREAT is set).
524  */
525 #if defined(H5_HAVE_WIN32_API)
526 # define H5_POSIX_CREATE_MODE_RW (_S_IREAD | _S_IWRITE)
527 #else
528 # define H5_POSIX_CREATE_MODE_RW 0666
529 #endif
530 
531 /* Represents an empty asynchronous request handle.
532  * Used in the VOL code.
533  */
534 #define H5_REQUEST_NULL NULL
535 
536 /*
537  * A macro to portably decrement enumerated types.
538  */
539 #ifndef H5_DEC_ENUM
540 # define H5_DEC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)-1))
541 #endif
542 
543 /* Double constant wrapper
544  *
545  * Quiets gcc warnings from -Wunsuffixed-float-constants.
546  *
547  * This is a really annoying warning since the standard specifies that
548  * constants of type double do NOT get a suffix so there's no way
549  * to specify a constant of type double. To quiet gcc, we specify floating
550  * point constants as type long double and cast to double.
551  *
552  * Note that this macro only needs to be used where using a double
553  * is important. For most code, suffixing constants with F will quiet the
554  * compiler and not produce erroneous code.
555  */
556 #define H5_DOUBLE(S) ((double) S ## L)
557 
558 /*
559  * Methods to compare the equality of floating-point values:
560  *
561  * 1. H5_XXX_ABS_EQUAL - check if the difference is smaller than the
562  * Epsilon value. The Epsilon values, FLT_EPSILON, DBL_EPSILON,
563  * and LDBL_EPSILON, are defined by compiler in float.h.
564  *
565  * 2. H5_XXX_REL_EQUAL - check if the relative difference is smaller than a
566  * predefined value M. See if two values are relatively equal.
567  * It's the developer's responsibility not to pass in the value 0, which
568  * may cause the equation to fail.
569  */
570 #define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf((X)-(Y)) < FLT_EPSILON)
571 #define H5_DBL_ABS_EQUAL(X,Y) (HDfabs ((X)-(Y)) < DBL_EPSILON)
572 #define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl((X)-(Y)) < LDBL_EPSILON)
573 
574 #define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf(((Y)-(X)) / (X)) < (M))
575 #define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs (((Y)-(X)) / (X)) < (M))
576 #define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl(((Y)-(X)) / (X)) < (M))
577 
578 /* KiB, MiB, GiB, TiB, PiB, EiB - Used in profiling and timing code */
579 #define H5_KB (1024.0F)
580 #define H5_MB (1024.0F * 1024.0F)
581 #define H5_GB (1024.0F * 1024.0F * 1024.0F)
582 #define H5_TB (1024.0F * 1024.0F * 1024.0F * 1024.0F)
583 #define H5_PB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F)
584 #define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F)
585 
586 #ifndef H5_HAVE_FLOCK
587 /* flock() operations. Used in the source so we have to define them when
588  * the call is not available (e.g.: Windows). These should NOT be used
589  * with system-provided flock() calls since the values will come from the
590  * header file.
591  */
592 #define LOCK_SH 0x01
593 #define LOCK_EX 0x02
594 #define LOCK_NB 0x04
595 #define LOCK_UN 0x08
596 #endif /* H5_HAVE_FLOCK */
597 
598 /*
599  * Data types and functions for timing certain parts of the library.
600  */
601 typedef struct {
602  double utime; /*user time */
603  double stime; /*system time */
604  double etime; /*elapsed wall-clock time */
605 } H5_timer_t;
606 
607 H5_DLL void H5_timer_reset (H5_timer_t *timer);
608 H5_DLL void H5_timer_begin (H5_timer_t *timer);
609 H5_DLL void H5_timer_end (H5_timer_t *sum/*in,out*/,
610  H5_timer_t *timer/*in,out*/);
611 H5_DLL void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds);
612 H5_DLL time_t H5_now(void);
613 
614 /* Depth of object copy */
615 typedef enum {
616  H5_COPY_SHALLOW, /* Shallow copy from source to destination, just copy field pointers */
617  H5_COPY_DEEP /* Deep copy from source to destination, including duplicating fields pointed to */
619 
620 /* Common object copying udata (right now only used for groups and datasets) */
622  struct H5O_pline_t *src_pline; /* Copy of filter pipeline for object */
624 
625 /* Unique object "position" */
626 typedef struct {
627  unsigned long fileno; /* The unique identifier for the file of the object */
628  haddr_t addr; /* The unique address of the object's header in that file */
629 } H5_obj_t;
630 
631 /*
632  * Redefine all the POSIX functions. We should never see a POSIX
633  * function (or any other non-HDF5 function) in the source!
634  */
635 
636 /* Put all platform-specific definitions in the following file */
637 /* so that the following definitions are platform free. */
638 #include "H5win32defs.h" /* For Windows-specific definitions */
639 
640 #ifndef HDabort
641  #define HDabort() abort()
642 #endif /* HDabort */
643 #ifndef HDabs
644  #define HDabs(X) abs(X)
645 #endif /* HDabs */
646 #ifndef HDaccess
647  #define HDaccess(F,M) access(F, M)
648 #endif /* HDaccess */
649 #ifndef HDacos
650  #define HDacos(X) acos(X)
651 #endif /* HDacos */
652 #ifndef HDalarm
653  #ifdef H5_HAVE_ALARM
654  #define HDalarm(N) alarm(N)
655  #else /* H5_HAVE_ALARM */
656  #define HDalarm(N) (0)
657  #endif /* H5_HAVE_ALARM */
658 #endif /* HDalarm */
659 #ifndef HDasctime
660  #define HDasctime(T) asctime(T)
661 #endif /* HDasctime */
662 #ifndef HDasin
663  #define HDasin(X) asin(X)
664 #endif /* HDasin */
665 #ifndef HDasprintf
666  #define HDasprintf asprintf /*varargs*/
667 #endif /* HDasprintf */
668 #ifndef HDassert
669  #define HDassert(X) assert(X)
670 #endif /* HDassert */
671 #ifndef HDatan
672  #define HDatan(X) atan(X)
673 #endif /* HDatan */
674 #ifndef HDatan2
675  #define HDatan2(X,Y) atan2(X,Y)
676 #endif /* HDatan2 */
677 #ifndef HDatexit
678  #define HDatexit(F) atexit(F)
679 #endif /* HDatexit */
680 #ifndef HDatof
681  #define HDatof(S) atof(S)
682 #endif /* HDatof */
683 #ifndef HDatoi
684  #define HDatoi(S) atoi(S)
685 #endif /* HDatoi */
686 #ifndef HDatol
687  #define HDatol(S) atol(S)
688 #endif /* HDatol */
689 #ifndef HDatoll
690  #define HDatoll(S) atoll(S)
691 #endif /* HDatol */
692 #ifndef HDbsearch
693  #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
694 #endif /* HDbsearch */
695 #ifndef HDcalloc
696  #define HDcalloc(N,Z) calloc(N,Z)
697 #endif /* HDcalloc */
698 #ifndef HDceil
699  #define HDceil(X) ceil(X)
700 #endif /* HDceil */
701 #ifndef HDcfgetispeed
702  #define HDcfgetispeed(T) cfgetispeed(T)
703 #endif /* HDcfgetispeed */
704 #ifndef HDcfgetospeed
705  #define HDcfgetospeed(T) cfgetospeed(T)
706 #endif /* HDcfgetospeed */
707 #ifndef HDcfsetispeed
708  #define HDcfsetispeed(T,S) cfsetispeed(T,S)
709 #endif /* HDcfsetispeed */
710 #ifndef HDcfsetospeed
711  #define HDcfsetospeed(T,S) cfsetospeed(T,S)
712 #endif /* HDcfsetospeed */
713 #ifndef HDchdir
714  #define HDchdir(S) chdir(S)
715 #endif /* HDchdir */
716 #ifndef HDchmod
717  #define HDchmod(S,M) chmod(S,M)
718 #endif /* HDchmod */
719 #ifndef HDchown
720  #define HDchown(S,O,G) chown(S,O,G)
721 #endif /* HDchown */
722 #ifndef HDclearerr
723  #define HDclearerr(F) clearerr(F)
724 #endif /* HDclearerr */
725 #ifndef HDclock
726  #define HDclock() clock()
727 #endif /* HDclock */
728 #ifndef HDclose
729  #define HDclose(F) close(F)
730 #endif /* HDclose */
731 #ifndef HDclosedir
732  #define HDclosedir(D) closedir(D)
733 #endif /* HDclosedir */
734 #ifndef HDcos
735  #define HDcos(X) cos(X)
736 #endif /* HDcos */
737 #ifndef HDcosh
738  #define HDcosh(X) cosh(X)
739 #endif /* HDcosh */
740 #ifndef HDcreat
741  #define HDcreat(S,M) creat(S,M)
742 #endif /* HDcreat */
743 #ifndef HDctermid
744  #define HDctermid(S) ctermid(S)
745 #endif /* HDctermid */
746 #ifndef HDctime
747  #define HDctime(T) ctime(T)
748 #endif /* HDctime */
749 #ifndef HDcuserid
750  #define HDcuserid(S) cuserid(S)
751 #endif /* HDcuserid */
752 #ifndef HDdifftime
753  #ifdef H5_HAVE_DIFFTIME
754  #define HDdifftime(X,Y) difftime(X,Y)
755  #else /* H5_HAVE_DIFFTIME */
756  #define HDdifftime(X,Y) ((double)(X)-(double)(Y))
757  #endif /* H5_HAVE_DIFFTIME */
758 #endif /* HDdifftime */
759 #ifndef HDdiv
760  #define HDdiv(X,Y) div(X,Y)
761 #endif /* HDdiv */
762 #ifndef HDdup
763  #define HDdup(F) dup(F)
764 #endif /* HDdup */
765 #ifndef HDdup2
766  #define HDdup2(F,I) dup2(F,I)
767 #endif /* HDdup2 */
768 /* execl() variable arguments */
769 /* execle() variable arguments */
770 /* execlp() variable arguments */
771 #ifndef HDexecv
772  #define HDexecv(S,AV) execv(S,AV)
773 #endif /* HDexecv */
774 #ifndef HDexecve
775  #define HDexecve(S,AV,E) execve(S,AV,E)
776 #endif /* HDexecve */
777 #ifndef HDexecvp
778  #define HDexecvp(S,AV) execvp(S,AV)
779 #endif /* HDexecvp */
780 #ifndef HDexit
781  #define HDexit(N) exit(N)
782 #endif /* HDexit */
783 #ifndef HD_exit
784  #define HD_exit(N) _exit(N)
785 #endif /* HD_exit */
786 #ifndef HDexp
787  #define HDexp(X) exp(X)
788 #endif /* HDexp */
789 #ifndef HDexp2
790  #define HDexp2(X) exp2(X)
791 #endif /* HDexp2 */
792 #ifndef HDfabs
793  #define HDfabs(X) fabs(X)
794 #endif /* HDfabs */
795 /* use ABS() because fabsf() fabsl() are not common yet. */
796 #ifndef HDfabsf
797  #define HDfabsf(X) ABS(X)
798 #endif /* HDfabsf */
799 #ifndef HDfabsl
800  #define HDfabsl(X) ABS(X)
801 #endif /* HDfabsl */
802 #ifndef HDfclose
803  #define HDfclose(F) fclose(F)
804 #endif /* HDfclose */
805 #ifdef H5_HAVE_FCNTL
806  #ifndef HDfcntl
807  #define HDfcntl(F,C,...) fcntl(F,C,__VA_ARGS__)
808  #endif /* HDfcntl */
809 #endif /* H5_HAVE_FCNTL */
810 #ifndef HDfdopen
811  #define HDfdopen(N,S) fdopen(N,S)
812 #endif /* HDfdopen */
813 #ifndef HDfeof
814  #define HDfeof(F) feof(F)
815 #endif /* HDfeof */
816 #ifndef HDferror
817  #define HDferror(F) ferror(F)
818 #endif /* HDferror */
819 #ifndef HDfflush
820  #define HDfflush(F) fflush(F)
821 #endif /* HDfflush */
822 #ifndef HDfgetc
823  #define HDfgetc(F) fgetc(F)
824 #endif /* HDfgetc */
825 #ifndef HDfgetpos
826  #define HDfgetpos(F,P) fgetpos(F,P)
827 #endif /* HDfgetpos */
828 #ifndef HDfgets
829  #define HDfgets(S,N,F) fgets(S,N,F)
830 #endif /* HDfgets */
831 #ifndef HDfileno
832  #define HDfileno(F) fileno(F)
833 #endif /* HDfileno */
834 /* Since flock is so prevalent, always build these functions
835  * when possible to avoid them becoming dead code.
836  */
837 #ifdef H5_HAVE_FCNTL
838 H5_DLL int Pflock(int fd, int operation);
839 #endif /* H5_HAVE_FCNTL */
840 H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
841 #ifndef HDflock
842  /* NOTE: flock(2) is not present on all POSIX systems.
843  * If it is not present, we try a flock() equivalent based on
844  * fcntl(2), then fall back to a function that always fails if
845  * it is not present at all (Windows uses a separate Wflock()
846  * function).
847  */
848  #if defined(H5_HAVE_FLOCK)
849  #define HDflock(F,L) flock(F,L)
850  #elif defined(H5_HAVE_FCNTL)
851  #define HDflock(F,L) Pflock(F,L)
852  #else
853  #define HDflock(F,L) Nflock(F,L)
854  #endif /* H5_HAVE_FLOCK */
855 #endif /* HDflock */
856 #ifndef HDfloor
857  #define HDfloor(X) floor(X)
858 #endif /* HDfloor */
859 #ifndef HDfmod
860  #define HDfmod(X,Y) fmod(X,Y)
861 #endif /* HDfmod */
862 #ifndef HDfopen
863  #define HDfopen(S,M) fopen(S,M)
864 #endif /* HDfopen */
865 #ifndef HDfork
866  #define HDfork() fork()
867 #endif /* HDfork */
868 #ifndef HDfpathconf
869  #define HDfpathconf(F,N) fpathconf(F,N)
870 #endif /* HDfpathconf */
871 H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
872 #ifndef HDfputc
873  #define HDfputc(C,F) fputc(C,F)
874 #endif /* HDfputc */
875 #ifndef HDfputs
876  #define HDfputs(S,F) fputs(S,F)
877 #endif /* HDfputs */
878 #ifndef HDfread
879  #define HDfread(M,Z,N,F) fread(M,Z,N,F)
880 #endif /* HDfread */
881 #ifndef HDfree
882  #define HDfree(M) free(M)
883 #endif /* HDfree */
884 #ifndef HDfreopen
885  #define HDfreopen(S,M,F) freopen(S,M,F)
886 #endif /* HDfreopen */
887 #ifndef HDfrexp
888  #define HDfrexp(X,N) frexp(X,N)
889 #endif /* HDfrexp */
890 /* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */
891 #ifndef HDfrexpf
892  #ifdef H5_HAVE_FREXPF
893  #define HDfrexpf(X,N) frexpf(X,N)
894  #else /* H5_HAVE_FREXPF */
895  #define HDfrexpf(X,N) frexp(X,N)
896  #endif /* H5_HAVE_FREXPF */
897 #endif /* HDfrexpf */
898 #ifndef HDfrexpl
899  #ifdef H5_HAVE_FREXPL
900  #define HDfrexpl(X,N) frexpl(X,N)
901  #else /* H5_HAVE_FREXPL */
902  #define HDfrexpl(X,N) frexp(X,N)
903  #endif /* H5_HAVE_FREXPL */
904 #endif /* HDfrexpl */
905 /* fscanf() variable arguments */
906 #ifndef HDfseek
907  #define HDfseek(F,O,W) fseeko(F,O,W)
908 #endif /* HDfseek */
909 #ifndef HDfsetpos
910  #define HDfsetpos(F,P) fsetpos(F,P)
911 #endif /* HDfsetpos */
912 #ifndef HDfstat
913  #define HDfstat(F,B) fstat(F,B)
914 #endif /* HDfstat */
915 #ifndef HDlstat
916  #define HDlstat(S,B) lstat(S,B)
917 #endif /* HDlstat */
918 #ifndef HDstat
919  #define HDstat(S,B) stat(S,B)
920 #endif /* HDstat */
921 
922 #ifndef H5_HAVE_WIN32_API
923 /* These definitions differ in Windows and are defined in
924  * H5win32defs for that platform.
925  */
926 typedef struct stat h5_stat_t;
927 typedef off_t h5_stat_size_t;
928 #define HDoff_t off_t
929 #endif /* H5_HAVE_WIN32_API */
930 
931 #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T
932 
933 #ifndef HDftell
934  #define HDftell(F) ftello(F)
935 #endif /* HDftell */
936 #ifndef HDftruncate
937  #define HDftruncate(F,L) ftruncate(F,L)
938 #endif /* HDftruncate */
939 #ifndef HDfwrite
940  #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
941 #endif /* HDfwrite */
942 #ifndef HDgetc
943  #define HDgetc(F) getc(F)
944 #endif /* HDgetc */
945 #ifndef HDgetchar
946  #define HDgetchar() getchar()
947 #endif /* HDgetchar */
948 #ifndef HDgetcwd
949  #define HDgetcwd(S,Z) getcwd(S,Z)
950 #endif /* HDgetcwd */
951 #ifndef HDgetdcwd
952  #define HDgetdcwd(D,S,Z) getcwd(S,Z)
953 #endif /* HDgetdcwd */
954 #ifndef HDgetdrive
955  #define HDgetdrive() 0
956 #endif /* HDgetdrive */
957 #ifndef HDgetegid
958  #define HDgetegid() getegid()
959 #endif /* HDgetegid() */
960 #ifndef HDgetenv
961  #define HDgetenv(S) getenv(S)
962 #endif /* HDgetenv */
963 #ifndef HDgeteuid
964  #define HDgeteuid() geteuid()
965 #endif /* HDgeteuid */
966 #ifndef HDgetgid
967  #define HDgetgid() getgid()
968 #endif /* HDgetgid */
969 #ifndef HDgetgrgid
970  #define HDgetgrgid(G) getgrgid(G)
971 #endif /* HDgetgrgid */
972 #ifndef HDgetgrnam
973  #define HDgetgrnam(S) getgrnam(S)
974 #endif /* HDgetgrnam */
975 #ifndef HDgetgroups
976  #define HDgetgroups(Z,G) getgroups(Z,G)
977 #endif /* HDgetgroups */
978 #ifndef HDgethostname
979  #define HDgethostname(N,L) gethostname(N,L)
980 #endif /* HDgetlogin */
981 #ifndef HDgetlogin
982  #define HDgetlogin() getlogin()
983 #endif /* HDgetlogin */
984 #ifndef HDgetpgrp
985  #define HDgetpgrp() getpgrp()
986 #endif /* HDgetpgrp */
987 #ifndef HDgetpid
988  #define HDgetpid() getpid()
989 #endif /* HDgetpid */
990 #ifndef HDgetppid
991  #define HDgetppid() getppid()
992 #endif /* HDgetppid */
993 #ifndef HDgetpwnam
994  #define HDgetpwnam(S) getpwnam(S)
995 #endif /* HDgetpwnam */
996 #ifndef HDgetpwuid
997  #define HDgetpwuid(U) getpwuid(U)
998 #endif /* HDgetpwuid */
999 #ifndef HDgetrusage
1000  #define HDgetrusage(X,S) getrusage(X,S)
1001 #endif /* HDgetrusage */
1002 #ifndef HDgets
1003  #define HDgets(S) gets(S)
1004 #endif /* HDgets */
1005 #ifndef HDgettimeofday
1006  #define HDgettimeofday(S,P) gettimeofday(S,P)
1007 #endif /* HDgettimeofday */
1008 #ifndef HDgetuid
1009  #define HDgetuid() getuid()
1010 #endif /* HDgetuid */
1011 #ifndef HDgmtime
1012  #define HDgmtime(T) gmtime(T)
1013 #endif /* HDgmtime */
1014 #ifndef HDisalnum
1015  #define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
1016 #endif /* HDisalnum */
1017 #ifndef HDisalpha
1018  #define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
1019 #endif /* HDisalpha */
1020 #ifndef HDisatty
1021  #define HDisatty(F) isatty(F)
1022 #endif /* HDisatty */
1023 #ifndef HDiscntrl
1024  #define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
1025 #endif /* HDiscntrl */
1026 #ifndef HDisdigit
1027  #define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
1028 #endif /* HDisdigit */
1029 #ifndef HDisgraph
1030  #define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
1031 #endif /* HDisgraph */
1032 #ifndef HDislower
1033  #define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
1034 #endif /* HDislower */
1035 #ifndef HDisnan
1036  #define HDisnan(X) isnan(X)
1037 #endif /* HDisnan */
1038 #ifndef HDisprint
1039  #define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
1040 #endif /* HDisprint */
1041 #ifndef HDispunct
1042  #define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
1043 #endif /* HDispunct */
1044 #ifndef HDisspace
1045  #define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
1046 #endif /* HDisspace */
1047 #ifndef HDisupper
1048  #define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
1049 #endif /* HDisupper */
1050 #ifndef HDisxdigit
1051  #define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
1052 #endif /* HDisxdigit */
1053 #ifndef HDkill
1054  #define HDkill(P,S) kill(P,S)
1055 #endif /* HDkill */
1056 #ifndef HDlabs
1057  #define HDlabs(X) labs(X)
1058 #endif /* HDlabs */
1059 #ifndef HDldexp
1060  #define HDldexp(X,N) ldexp(X,N)
1061 #endif /* HDldexp */
1062 #ifndef HDldiv
1063  #define HDldiv(X,Y) ldiv(X,Y)
1064 #endif /* HDldiv */
1065 #ifndef HDlink
1066  #define HDlink(OLD,NEW) link(OLD,NEW)
1067 #endif /* HDlink */
1068 #ifndef HDllround
1069  #define HDllround(V) llround(V)
1070 #endif /* HDround */
1071 #ifndef HDllroundf
1072  #define HDllroundf(V) llroundf(V)
1073 #endif /* HDllroundf */
1074 #ifndef HDllroundl
1075  #define HDllroundl(V) llroundl(V)
1076 #endif /* HDllroundl */
1077 #ifndef HDlocaleconv
1078  #define HDlocaleconv() localeconv()
1079 #endif /* HDlocaleconv */
1080 #ifndef HDlocaltime
1081  #define HDlocaltime(T) localtime(T)
1082 #endif /* HDlocaltime */
1083 #ifndef HDlog
1084  #define HDlog(X) log(X)
1085 #endif /* HDlog */
1086 #ifndef HDlog10
1087  #define HDlog10(X) log10(X)
1088 #endif /* HDlog10 */
1089 #ifndef HDlongjmp
1090  #define HDlongjmp(J,N) longjmp(J,N)
1091 #endif /* HDlongjmp */
1092 #ifndef HDlround
1093  #define HDlround(V) lround(V)
1094 #endif /* HDround */
1095 #ifndef HDlroundf
1096  #define HDlroundf(V) lroundf(V)
1097 #endif /* HDlroundf */
1098 #ifndef HDlroundl
1099  #define HDlroundl(V) lroundl(V)
1100 #endif /* HDroundl */
1101 #ifndef HDlseek
1102  #define HDlseek(F,O,W) lseek(F,O,W)
1103 #endif /* HDlseek */
1104 #ifndef HDmalloc
1105  #define HDmalloc(Z) malloc(Z)
1106 #endif /* HDmalloc */
1107 #ifndef HDposix_memalign
1108  #define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z)
1109 #endif /* HDposix_memalign */
1110 #ifndef HDmblen
1111  #define HDmblen(S,N) mblen(S,N)
1112 #endif /* HDmblen */
1113 #ifndef HDmbstowcs
1114  #define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z)
1115 #endif /* HDmbstowcs */
1116 #ifndef HDmbtowc
1117  #define HDmbtowc(P,S,Z) mbtowc(P,S,Z)
1118 #endif /* HDmbtowc */
1119 #ifndef HDmemchr
1120  #define HDmemchr(S,C,Z) memchr(S,C,Z)
1121 #endif /* HDmemchr */
1122 #ifndef HDmemcmp
1123  #define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
1124 #endif /* HDmemcmp */
1125 #ifndef HDmemcpy
1126  #define HDmemcpy(X,Y,Z) memcpy(X,Y,Z)
1127 #endif /* HDmemcpy */
1128 #ifndef HDmemmove
1129  #define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
1130 #endif /* HDmemmove */
1131 #ifndef HDmemset
1132  #define HDmemset(X,C,Z) memset(X,C,Z)
1133 #endif /* HDmemset */
1134 #ifndef HDmkdir
1135  #define HDmkdir(S,M) mkdir(S,M)
1136 #endif /* HDmkdir */
1137 #ifndef HDmkfifo
1138  #define HDmkfifo(S,M) mkfifo(S,M)
1139 #endif /* HDmkfifo */
1140 #ifndef HDmktime
1141  #define HDmktime(T) mktime(T)
1142 #endif /* HDmktime */
1143 #ifndef HDmodf
1144  #define HDmodf(X,Y) modf(X,Y)
1145 #endif /* HDmodf */
1146 #ifndef HDnanosleep
1147  #define HDnanosleep(N, O) nanosleep(N, O)
1148 #endif /* HDnanosleep */
1149 #ifndef HDopen
1150  #define HDopen(F,...) open(F,__VA_ARGS__)
1151 #endif /* HDopen */
1152 #ifndef HDopendir
1153  #define HDopendir(S) opendir(S)
1154 #endif /* HDopendir */
1155 #ifndef HDpathconf
1156  #define HDpathconf(S,N) pathconf(S,N)
1157 #endif /* HDpathconf */
1158 #ifndef HDpause
1159  #define HDpause() pause()
1160 #endif /* HDpause */
1161 #ifndef HDperror
1162  #define HDperror(S) perror(S)
1163 #endif /* HDperror */
1164 #ifndef HDpipe
1165  #define HDpipe(F) pipe(F)
1166 #endif /* HDpipe */
1167 #ifndef HDpow
1168  #define HDpow(X,Y) pow(X,Y)
1169 #endif /* HDpow */
1170 #ifndef HDpowf
1171  #define HDpowf(X,Y) powf(X,Y)
1172 #endif /* HDpowf */
1173 #ifndef HDpread
1174  #define HDpread(F,B,C,O) pread(F,B,C,O)
1175 #endif /* HDpread */
1176 #ifndef HDprintf
1177  #define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
1178 #endif /* HDprintf */
1179 #ifndef HDputc
1180  #define HDputc(C,F) putc(C,F)
1181 #endif /* HDputc*/
1182 #ifndef HDputchar
1183  #define HDputchar(C) putchar(C)
1184 #endif /* HDputchar */
1185 #ifndef HDputs
1186  #define HDputs(S) puts(S)
1187 #endif /* HDputs */
1188 #ifndef HDpwrite
1189  #define HDpwrite(F,B,C,O) pwrite(F,B,C,O)
1190 #endif /* HDpwrite */
1191 #ifndef HDqsort
1192  #define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
1193 #endif /* HDqsort*/
1194 #ifndef HDraise
1195  #define HDraise(N) raise(N)
1196 #endif /* HDraise */
1197 
1198 #ifdef H5_HAVE_RAND_R
1199  #ifndef HDrandom
1200  #define HDrandom() HDrand()
1201  #endif /* HDrandom */
1202  H5_DLL int HDrand(void);
1203  #ifndef HDsrandom
1204  #define HDsrandom(S) HDsrand(S)
1205  #endif /* HDsrandom */
1206  H5_DLL void HDsrand(unsigned int seed);
1207 #elif defined(H5_HAVE_RANDOM)
1208  #ifndef HDrand
1209  #define HDrand() random()
1210  #endif /* HDrand */
1211  #ifndef HDrandom
1212  #define HDrandom() random()
1213  #endif /* HDrandom */
1214  #ifndef HDsrand
1215  #define HDsrand(S) srandom(S)
1216  #endif /* HDsrand */
1217  #ifndef HDsrandom
1218  #define HDsrandom(S) srandom(S)
1219  #endif /* HDsrandom */
1220 #else /* H5_HAVE_RANDOM */
1221  #ifndef HDrand
1222  #define HDrand() rand()
1223  #endif /* HDrand */
1224  #ifndef HDrandom
1225  #define HDrandom() rand()
1226  #endif /* HDrandom */
1227  #ifndef HDsrand
1228  #define HDsrand(S) srand(S)
1229  #endif /* HDsrand */
1230  #ifndef HDsrandom
1231  #define HDsrandom(S) srand(S)
1232  #endif /* HDsrandom */
1233 #endif /* H5_HAVE_RANDOM */
1234 
1235 #ifndef HDread
1236  #define HDread(F,M,Z) read(F,M,Z)
1237 #endif /* HDread */
1238 #ifndef HDreaddir
1239  #define HDreaddir(D) readdir(D)
1240 #endif /* HDreaddir */
1241 #ifndef HDrealloc
1242  #define HDrealloc(M,Z) realloc(M,Z)
1243 #endif /* HDrealloc */
1244 #ifndef HDrealpath
1245  #define HDrealpath(F1,F2) realpath(F1,F2)
1246 #endif /* HDrealloc */
1247 #ifndef HDremove
1248  #define HDremove(S) remove(S)
1249 #endif /* HDremove */
1250 #ifndef HDrename
1251  #define HDrename(OLD,NEW) rename(OLD,NEW)
1252 #endif /* HDrename */
1253 #ifndef HDrewind
1254  #define HDrewind(F) rewind(F)
1255 #endif /* HDrewind */
1256 #ifndef HDrewinddir
1257  #define HDrewinddir(D) rewinddir(D)
1258 #endif /* HDrewinddir */
1259 #ifndef HDround
1260  #define HDround(V) round(V)
1261 #endif /* HDround */
1262 #ifndef HDroundf
1263  #define HDroundf(V) roundf(V)
1264 #endif /* HDroundf */
1265 #ifndef HDroundl
1266  #define HDroundl(V) roundl(V)
1267 #endif /* HDroundl */
1268 #ifndef HDrmdir
1269  #define HDrmdir(S) rmdir(S)
1270 #endif /* HDrmdir */
1271 /* scanf() variable arguments */
1272 #ifndef HDselect
1273  #define HDselect(N,RD,WR,ER,T) select(N,RD,WR,ER,T)
1274 #endif /* HDsetbuf */
1275 #ifndef HDsetbuf
1276  #define HDsetbuf(F,S) setbuf(F,S)
1277 #endif /* HDsetbuf */
1278 #ifndef HDsetenv
1279  #define HDsetenv(N,V,O) setenv(N,V,O)
1280 #endif /* HDsetenv */
1281 #ifndef HDsetgid
1282  #define HDsetgid(G) setgid(G)
1283 #endif /* HDsetgid */
1284 #ifndef HDsetjmp
1285  #define HDsetjmp(J) setjmp(J)
1286 #endif /* HDsetjmp */
1287 #ifndef HDsetlocale
1288  #define HDsetlocale(N,S) setlocale(N,S)
1289 #endif /* HDsetlocale */
1290 #ifndef HDsetpgid
1291  #define HDsetpgid(P,PG) setpgid(P,PG)
1292 #endif /* HDsetpgid */
1293 #ifndef HDsetsid
1294  #define HDsetsid() setsid()
1295 #endif /* HDsetsid */
1296 #ifndef HDsetuid
1297  #define HDsetuid(U) setuid(U)
1298 #endif /* HDsetuid */
1299 #ifndef HDsetvbuf
1300  #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z)
1301 #endif /* HDsetvbuf */
1302 #ifndef HDsigaddset
1303  #define HDsigaddset(S,N) sigaddset(S,N)
1304 #endif /* HDsigaddset */
1305 #ifndef HDsigdelset
1306  #define HDsigdelset(S,N) sigdelset(S,N)
1307 #endif /* HDsigdelset */
1308 #ifndef HDsigemptyset
1309  #define HDsigemptyset(S) sigemptyset(S)
1310 #endif /* HDsigemptyset */
1311 #ifndef HDsigfillset
1312  #define HDsigfillset(S) sigfillset(S)
1313 #endif /* HDsigfillset */
1314 #ifndef HDsigismember
1315  #define HDsigismember(S,N) sigismember(S,N)
1316 #endif /* HDsigismember */
1317 #ifndef HDsiglongjmp
1318  #define HDsiglongjmp(J,N) siglongjmp(J,N)
1319 #endif /* HDsiglongjmp */
1320 #ifndef HDsignal
1321  #define HDsignal(N,F) signal(N,F)
1322 #endif /* HDsignal */
1323 #ifndef HDsigpending
1324  #define HDsigpending(S) sigpending(S)
1325 #endif /* HDsigpending */
1326 #ifndef HDsigprocmask
1327  #define HDsigprocmask(H,S,O) sigprocmask(H,S,O)
1328 #endif /* HDsigprocmask */
1329 #ifndef HDsigsetjmp
1330  #define HDsigsetjmp(J,N) sigsetjmp(J,N)
1331 #endif /* HDsigsetjmp */
1332 #ifndef HDsigsuspend
1333  #define HDsigsuspend(S) sigsuspend(S)
1334 #endif /* HDsigsuspend */
1335 #ifndef HDsin
1336  #define HDsin(X) sin(X)
1337 #endif /* HDsin */
1338 #ifndef HDsinh
1339  #define HDsinh(X) sinh(X)
1340 #endif /* HDsinh */
1341 #ifndef HDsleep
1342  #define HDsleep(N) sleep(N)
1343 #endif /* HDsleep */
1344 #ifndef HDsnprintf
1345  #define HDsnprintf snprintf /*varargs*/
1346 #endif /* HDsnprintf */
1347 #ifndef HDsprintf
1348  #define HDsprintf sprintf /*varargs*/
1349 #endif /* HDsprintf */
1350 #ifndef HDsqrt
1351  #define HDsqrt(X) sqrt(X)
1352 #endif /* HDsqrt */
1353 #ifndef HDsscanf
1354  #define HDsscanf(S,FMT,...) sscanf(S,FMT,__VA_ARGS__)
1355 #endif /* HDsscanf */
1356 #ifndef HDstrcat
1357  #define HDstrcat(X,Y) strcat(X,Y)
1358 #endif /* HDstrcat */
1359 #ifndef HDstrchr
1360  #define HDstrchr(S,C) strchr(S,C)
1361 #endif /* HDstrchr */
1362 #ifndef HDstrcmp
1363  #define HDstrcmp(X,Y) strcmp(X,Y)
1364 #endif /* HDstrcmp */
1365 #ifndef HDstrcasecmp
1366  #define HDstrcasecmp(X,Y) strcasecmp(X,Y)
1367 #endif /* HDstrcasecmp */
1368 #ifndef HDstrcoll
1369  #define HDstrcoll(X,Y) strcoll(X,Y)
1370 #endif /* HDstrcoll */
1371 #ifndef HDstrcpy
1372  #define HDstrcpy(X,Y) strcpy(X,Y)
1373 #endif /* HDstrcpy */
1374 #ifndef HDstrcspn
1375  #define HDstrcspn(X,Y) strcspn(X,Y)
1376 #endif /* HDstrcspn */
1377 #ifndef HDstrerror
1378  #define HDstrerror(N) strerror(N)
1379 #endif /* HDstrerror */
1380 #ifndef HDstrftime
1381  #define HDstrftime(S,Z,F,T) strftime(S,Z,F,T)
1382 #endif /* HDstrftime */
1383 #ifndef HDstrlen
1384  #define HDstrlen(S) strlen(S)
1385 #endif /* HDstrlen */
1386 #ifndef HDstrncat
1387  #define HDstrncat(X,Y,Z) strncat(X,Y,Z)
1388 #endif /* HDstrncat */
1389 #ifndef HDstrncmp
1390  #define HDstrncmp(X,Y,Z) strncmp(X,Y,Z)
1391 #endif /* HDstrncmp */
1392 #ifndef HDstrncpy
1393  #define HDstrncpy(X,Y,Z) strncpy(X,Y,Z)
1394 #endif /* HDstrncpy */
1395 #ifndef HDstrpbrk
1396  #define HDstrpbrk(X,Y) strpbrk(X,Y)
1397 #endif /* HDstrpbrk */
1398 #ifndef HDstrrchr
1399  #define HDstrrchr(S,C) strrchr(S,C)
1400 #endif /* HDstrrchr */
1401 #ifndef HDstrspn
1402  #define HDstrspn(X,Y) strspn(X,Y)
1403 #endif /* HDstrspn */
1404 #ifndef HDstrstr
1405  #define HDstrstr(X,Y) strstr(X,Y)
1406 #endif /* HDstrstr */
1407 #ifndef HDstrtod
1408  #define HDstrtod(S,R) strtod(S,R)
1409 #endif /* HDstrtod */
1410 #ifndef HDstrtok
1411  #define HDstrtok(X,Y) strtok(X,Y)
1412 #endif /* HDstrtok */
1413 #ifndef HDstrtok_r
1414  #define HDstrtok_r(X,Y,Z) strtok_r(X,Y,Z)
1415 #endif /* HDstrtok */
1416 #ifndef HDstrtol
1417  #define HDstrtol(S,R,N) strtol(S,R,N)
1418 #endif /* HDstrtol */
1419 #ifndef HDstrtoll
1420  #ifdef H5_HAVE_STRTOLL
1421  #define HDstrtoll(S,R,N) strtoll(S,R,N)
1422  #else
1423  H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
1424  #endif /* H5_HAVE_STRTOLL */
1425 #endif /* HDstrtoll */
1426 #ifndef HDstrtoul
1427  #define HDstrtoul(S,R,N) strtoul(S,R,N)
1428 #endif /* HDstrtoul */
1429 #ifndef HDstrtoull
1430  #define HDstrtoull(S,R,N) strtoull(S,R,N)
1431 #endif /* HDstrtoul */
1432 #ifndef HDstrxfrm
1433  #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z)
1434 #endif /* HDstrxfrm */
1435 #ifdef H5_HAVE_SYMLINK
1436  #ifndef HDsymlink
1437  #define HDsymlink(F1,F2) symlink(F1,F2)
1438  #endif /* HDsymlink */
1439 #endif /* H5_HAVE_SYMLINK */
1440 #ifndef HDsysconf
1441  #define HDsysconf(N) sysconf(N)
1442 #endif /* HDsysconf */
1443 #ifndef HDsystem
1444  #define HDsystem(S) system(S)
1445 #endif /* HDsystem */
1446 #ifndef HDtan
1447  #define HDtan(X) tan(X)
1448 #endif /* HDtan */
1449 #ifndef HDtanh
1450  #define HDtanh(X) tanh(X)
1451 #endif /* HDtanh */
1452 #ifndef HDtcdrain
1453  #define HDtcdrain(F) tcdrain(F)
1454 #endif /* HDtcdrain */
1455 #ifndef HDtcflow
1456  #define HDtcflow(F,A) tcflow(F,A)
1457 #endif /* HDtcflow */
1458 #ifndef HDtcflush
1459  #define HDtcflush(F,N) tcflush(F,N)
1460 #endif /* HDtcflush */
1461 #ifndef HDtcgetattr
1462  #define HDtcgetattr(F,T) tcgetattr(F,T)
1463 #endif /* HDtcgetattr */
1464 #ifndef HDtcgetpgrp
1465  #define HDtcgetpgrp(F) tcgetpgrp(F)
1466 #endif /* HDtcgetpgrp */
1467 #ifndef HDtcsendbreak
1468  #define HDtcsendbreak(F,N) tcsendbreak(F,N)
1469 #endif /* HDtcsendbreak */
1470 #ifndef HDtcsetattr
1471  #define HDtcsetattr(F,O,T) tcsetattr(F,O,T)
1472 #endif /* HDtcsetattr */
1473 #ifndef HDtcsetpgrp
1474  #define HDtcsetpgrp(F,N) tcsetpgrp(F,N)
1475 #endif /* HDtcsetpgrp */
1476 #ifndef HDtime
1477  #define HDtime(T) time(T)
1478 #endif /* HDtime */
1479 #ifndef HDtimes
1480  #define HDtimes(T) times(T)
1481 #endif /* HDtimes*/
1482 #ifndef HDtmpfile
1483  #define HDtmpfile() tmpfile()
1484 #endif /* HDtmpfile */
1485 #ifndef HDtmpnam
1486  #define HDtmpnam(S) tmpnam(S)
1487 #endif /* HDtmpnam */
1488 #ifndef HDtolower
1489  #define HDtolower(C) tolower(C)
1490 #endif /* HDtolower */
1491 #ifndef HDtoupper
1492  #define HDtoupper(C) toupper(C)
1493 #endif /* HDtoupper */
1494 #ifndef HDttyname
1495  #define HDttyname(F) ttyname(F)
1496 #endif /* HDttyname */
1497 #ifndef HDtzset
1498  #define HDtzset() tzset()
1499 #endif /* HDtzset */
1500 #ifndef HDumask
1501  #define HDumask(N) umask(N)
1502 #endif /* HDumask */
1503 #ifndef HDuname
1504  #define HDuname(S) uname(S)
1505 #endif /* HDuname */
1506 #ifndef HDungetc
1507  #define HDungetc(C,F) ungetc(C,F)
1508 #endif /* HDungetc */
1509 #ifndef HDunlink
1510  #define HDunlink(S) unlink(S)
1511 #endif /* HDunlink */
1512 #ifndef HDutime
1513  #define HDutime(S,T) utime(S,T)
1514 #endif /* HDutime */
1515 #ifndef HDva_arg
1516  #define HDva_arg(A,T) va_arg(A,T)
1517 #endif /* HDva_arg */
1518 #ifndef HDva_copy
1519 #define HDva_copy(D,S) va_copy(D,S)
1520 #endif /* HDva_copy */
1521 #ifndef HDva_end
1522  #define HDva_end(A) va_end(A)
1523 #endif /* HDva_end */
1524 #ifndef HDva_start
1525  #define HDva_start(A,P) va_start(A,P)
1526 #endif /* HDva_start */
1527 #ifndef HDvasprintf
1528  #define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A)
1529 #endif /* HDvasprintf */
1530 #ifndef HDvfprintf
1531  #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A)
1532 #endif /* HDvfprintf */
1533 #ifndef HDvprintf
1534  #define HDvprintf(FMT,A) vprintf(FMT,A)
1535 #endif /* HDvprintf */
1536 #ifndef HDvsprintf
1537  #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
1538 #endif /* HDvsprintf */
1539 #ifndef HDvsnprintf
1540  #define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
1541 #endif /* HDvsnprintf */
1542 #ifndef HDwait
1543  #define HDwait(W) wait(W)
1544 #endif /* HDwait */
1545 #ifndef HDwaitpid
1546  #define HDwaitpid(P,W,O) waitpid(P,W,O)
1547 #endif /* HDwaitpid */
1548 #ifndef HDwcstombs
1549  #define HDwcstombs(S,P,Z) wcstombs(S,P,Z)
1550 #endif /* HDwcstombs */
1551 #ifndef HDwctomb
1552  #define HDwctomb(S,C) wctomb(S,C)
1553 #endif /* HDwctomb */
1554 #ifndef HDwrite
1555  #define HDwrite(F,M,Z) write(F,M,Z)
1556 #endif /* HDwrite */
1557 
1558 /*
1559  * And now for a couple non-Posix functions... Watch out for systems that
1560  * define these in terms of macros.
1561  */
1562 #if !defined strdup && !defined H5_HAVE_STRDUP
1563 extern char *strdup(const char *s);
1564 #endif
1565 
1566 #ifndef HDstrdup
1567  #define HDstrdup(S) strdup(S)
1568 #endif /* HDstrdup */
1569 
1570 #ifndef HDpthread_self
1571  #define HDpthread_self() pthread_self()
1572 #endif /* HDpthread_self */
1573 
1574 /* Use this version of pthread_self for printing the thread ID */
1575 #ifndef HDpthread_self_ulong
1576  #define HDpthread_self_ulong() ((unsigned long)pthread_self())
1577 #endif /* HDpthread_self_ulong */
1578 
1579 /* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */
1580 /* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */
1581 #define H5_STRINGIZE(x) #x
1582 #define H5_TOSTRING(x) H5_STRINGIZE(x)
1584 /* Macro for "glueing" together items, for re-scanning macros */
1585 #define H5_GLUE(x,y) x##y
1586 #define H5_GLUE3(x,y,z) x##y##z
1587 #define H5_GLUE4(w,x,y,z) w##x##y##z
1589 /*
1590  * A macro for detecting over/under-flow when casting between types
1591  */
1592 #ifndef NDEBUG
1593 #define H5_CHECK_OVERFLOW(var, vartype, casttype) \
1594 { \
1595  casttype _tmp_overflow = (casttype)(var); \
1596  HDassert((var) == (vartype)_tmp_overflow); \
1597 }
1598 #else /* NDEBUG */
1599 #define H5_CHECK_OVERFLOW(var, vartype, casttype)
1600 #endif /* NDEBUG */
1601 
1602 /*
1603  * A macro for detecting over/under-flow when assigning between types
1604  */
1605 #ifndef NDEBUG
1606 #define ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) \
1607 { \
1608  srctype _tmp_src = (srctype)(src); \
1609  dsttype _tmp_dst = (dsttype)(_tmp_src); \
1610  HDassert(_tmp_src == (srctype)_tmp_dst); \
1611  (dst) = _tmp_dst; \
1612 }
1613 
1614 #define ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) \
1615  (dst) = (dsttype)(src);
1616 
1617 #define ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) \
1618 { \
1619  srctype _tmp_src = (srctype)(src); \
1620  dsttype _tmp_dst = (dsttype)(_tmp_src); \
1621  HDassert(_tmp_src >= 0); \
1622  HDassert(_tmp_src == (srctype)_tmp_dst); \
1623  (dst) = _tmp_dst; \
1624 }
1625 
1626 #define ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) \
1627  (dst) = (dsttype)(src);
1628 
1629 #define ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) \
1630 { \
1631  srctype _tmp_src = (srctype)(src); \
1632  dsttype _tmp_dst = (dsttype)(_tmp_src); \
1633  HDassert(_tmp_dst >= 0); \
1634  HDassert(_tmp_src == (srctype)_tmp_dst); \
1635  (dst) = _tmp_dst; \
1636 }
1637 
1638 #define ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) \
1639 { \
1640  srctype _tmp_src = (srctype)(src); \
1641  dsttype _tmp_dst = (dsttype)(_tmp_src); \
1642  HDassert(_tmp_src >= 0); \
1643  HDassert(_tmp_src == (srctype)_tmp_dst); \
1644  (dst) = _tmp_dst; \
1645 }
1646 
1647 #define ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) \
1648  (dst) = (dsttype)(src);
1649 
1650 /* Include the generated overflow header file */
1651 #include "H5overflow.h"
1652 
1653 /* Assign a variable to one of a different size (think safer dst = (dsttype)src").
1654  * The code generated by the macro checks for overflows.
1655  *
1656  * Use w##x##y##z instead of H5_GLUE4(w, x, y, z) because srctype
1657  * or dsttype on some systems (e.g., NetBSD 8 and earlier) may
1658  * supply some standard types using a macro---e.g.,
1659  * #define uint8_t __uint8_t. The preprocessor will expand the
1660  * macros before it evaluates H5_GLUE4(), and that will generate
1661  * an unexpected name such as ASSIGN___uint8_t_TO___uint16_t.
1662  * The preprocessor does not expand macros in w##x##y##z, so
1663  * that will always generate the expected name.
1664  */
1665 #define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \
1666  ASSIGN_##srctype##_TO_##dsttype(dst,dsttype,src,srctype)\
1667 
1668 #else /* NDEBUG */
1669 #define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \
1670  (dst) = (dsttype)(src);
1671 #endif /* NDEBUG */
1672 
1673 #if defined(H5_HAVE_WINDOW_PATH)
1674 
1675 /* directory delimiter for Windows: slash and backslash are acceptable on Windows */
1676 #define H5_DIR_SLASH_SEPC '/'
1677 #define H5_DIR_SEPC '\\'
1678 #define H5_DIR_SEPS "\\"
1679 #define H5_CHECK_DELIMITER(SS) ((SS == H5_DIR_SEPC) || (SS == H5_DIR_SLASH_SEPC))
1680 #define H5_CHECK_ABSOLUTE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':') && (H5_CHECK_DELIMITER(NAME[2])))
1681 #define H5_CHECK_ABS_DRIVE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':'))
1682 #define H5_CHECK_ABS_PATH(NAME) (H5_CHECK_DELIMITER(NAME[0]))
1683 
1684 #define H5_GET_LAST_DELIMITER(NAME, ptr) { \
1685  char *slash, *backslash; \
1686  \
1687  slash = HDstrrchr(NAME, H5_DIR_SLASH_SEPC); \
1688  backslash = HDstrrchr(NAME, H5_DIR_SEPC); \
1689  if(backslash > slash) \
1690  (ptr = backslash); \
1691  else \
1692  (ptr = slash); \
1693 }
1694 
1695 #else /* H5_HAVE_WINDOW_PATH */
1696 
1697 #define H5_DIR_SEPC '/'
1698 #define H5_DIR_SEPS "/"
1699 #define H5_CHECK_DELIMITER(SS) (SS == H5_DIR_SEPC)
1700 #define H5_CHECK_ABSOLUTE(NAME) (H5_CHECK_DELIMITER(*NAME))
1701 #define H5_CHECK_ABS_DRIVE(NAME) (0)
1702 #define H5_CHECK_ABS_PATH(NAME) (0)
1703 #define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = HDstrrchr(NAME, H5_DIR_SEPC);
1705 #endif /* H5_HAVE_WINDOW_PATH */
1706 
1707 #define H5_COLON_SEPC ':'
1709 
1710 /* Use FUNC to safely handle variations of C99 __func__ keyword handling */
1711 #ifdef H5_HAVE_C99_FUNC
1712 #define FUNC __func__
1713 #elif defined(H5_HAVE_FUNCTION)
1714 #define FUNC __FUNCTION__
1715 #else
1716 #error "We need __func__ or __FUNCTION__ to test function names!"
1717 #endif
1718 
1719 /*
1720  * These macros check whether debugging has been requested for a certain
1721  * package at run-time. Code for debugging is conditionally compiled by
1722  * defining constants like `H5X_DEBUG'. In order to see the output though
1723  * the code must be enabled at run-time with an environment variable
1724  * HDF5_DEBUG which is a list of packages to debug.
1725  *
1726  * Note: If you add/remove items from this enum then be sure to update the
1727  * information about the package in H5_init_library().
1728  */
1729 typedef enum {
1730  H5_PKG_A, /* Attributes */
1731  H5_PKG_AC, /* Metadata cache */
1732  H5_PKG_B, /* B-trees */
1733  H5_PKG_D, /* Datasets */
1734  H5_PKG_E, /* Error handling */
1735  H5_PKG_F, /* Files */
1736  H5_PKG_G, /* Groups */
1737  H5_PKG_HG, /* Global heaps */
1738  H5_PKG_HL, /* Local heaps */
1739  H5_PKG_I, /* IDs */
1740  H5_PKG_M, /* Maps */
1741  H5_PKG_MF, /* File memory management */
1742  H5_PKG_MM, /* Core memory management */
1743  H5_PKG_O, /* Object headers */
1744  H5_PKG_P, /* Property lists */
1745  H5_PKG_S, /* Dataspaces */
1746  H5_PKG_T, /* Datatypes */
1747  H5_PKG_V, /* Vector functions */
1748  H5_PKG_VL, /* VOL functions */
1749  H5_PKG_Z, /* Raw data filters */
1750  H5_NPKGS /* Must be last */
1752 
1753 typedef struct H5_debug_open_stream_t {
1754  FILE *stream; /* Open output stream */
1755  struct H5_debug_open_stream_t *next; /* Next open output stream */
1757 
1758 typedef struct H5_debug_t {
1759  FILE *trace; /*API trace output stream */
1760  hbool_t ttop; /*Show only top-level calls? */
1761  hbool_t ttimes; /*Show trace event times? */
1762  struct {
1763  const char *name; /*package name */
1764  FILE *stream; /*output stream or NULL */
1766  H5_debug_open_stream_t *open_stream; /* Stack of open output streams */
1768 
1769 #ifdef H5_HAVE_PARALLEL
1770 extern hbool_t H5_coll_api_sanity_check_g;
1771 #endif /* H5_HAVE_PARALLEL */
1772 
1773 extern H5_debug_t H5_debug_g;
1774 #define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream)
1775 /* Do not use const else AIX strings does not show it. */
1776 extern char H5libhdf5_settings[]; /* embedded library information */
1777 
1778 /*-------------------------------------------------------------------------
1779  * Purpose: These macros are inserted automatically just after the
1780  * FUNC_ENTER() macro of API functions and are used to trace
1781  * application program execution. Unless H5_DEBUG_API has been
1782  * defined they are no-ops.
1783  *
1784  * Arguments: R - Return type encoded as a string
1785  * T - Argument types encoded as a string
1786  * A0-An - Arguments. The number at the end of the macro name
1787  * indicates the number of arguments.
1788  *
1789  *-------------------------------------------------------------------------
1790  */
1791 #ifdef H5_DEBUG_API
1792 
1793 #define H5TRACE_DECL \
1794  const char *RTYPE = NULL; \
1795  double CALLTIME;
1796 
1797 #define H5TRACE0(R,T) \
1798  RTYPE=R; \
1799  CALLTIME=H5_trace(NULL,FUNC,T)
1800 #define H5TRACE1(R,T,A0) \
1801  RTYPE=R; \
1802  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0)
1803 #define H5TRACE2(R,T,A0,A1) \
1804  RTYPE=R; \
1805  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1)
1806 #define H5TRACE3(R,T,A0,A1,A2) \
1807  RTYPE=R; \
1808  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2)
1809 #define H5TRACE4(R,T,A0,A1,A2,A3) \
1810  RTYPE=R; \
1811  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3)
1812 #define H5TRACE5(R,T,A0,A1,A2,A3,A4) \
1813  RTYPE=R; \
1814  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4)
1815 #define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) \
1816  RTYPE=R; \
1817  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5)
1818 #define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) \
1819  RTYPE=R; \
1820  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6)
1821 #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) \
1822  RTYPE=R; \
1823  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7)
1824 #define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) \
1825  RTYPE=R; \
1826  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
1827  #A8,A8)
1828 #define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) \
1829  RTYPE=R; \
1830  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
1831  #A8,A8,#A9,A9)
1832 #define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) \
1833  RTYPE=R; \
1834  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
1835  #A8,A8,#A9,A9,#A10,A10)
1836 #define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) \
1837  RTYPE=R; \
1838  CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
1839  #A8,A8,#A9,A9,#A10,A10,#A11,A11)
1840 
1841 #define H5TRACE_RETURN(V) \
1842  if (RTYPE) { \
1843  H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \
1844  RTYPE = NULL; \
1845  }
1846 #else
1847 #define H5TRACE_DECL /*void*/
1848 #define H5TRACE0(R,T) /*void*/
1849 #define H5TRACE1(R,T,A0) /*void*/
1850 #define H5TRACE2(R,T,A0,A1) /*void*/
1851 #define H5TRACE3(R,T,A0,A1,A2) /*void*/
1852 #define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/
1853 #define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/
1854 #define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/
1855 #define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/
1856 #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/
1857 #define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/
1858 #define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/
1859 #define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/
1860 #define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) /*void*/
1861 #define H5TRACE_RETURN(V) /*void*/
1862 #endif /* H5_DEBUG_API */
1863 
1864 H5_DLL double H5_trace(const double *calltime, const char *func, const char *type, ...);
1865 
1866 
1867 /*-------------------------------------------------------------------------
1868  * Purpose: Register function entry for library initialization and code
1869  * profiling.
1870  *
1871  * Notes: Every file must have a file-scope variable called
1872  * `initialize_interface_g' of type hbool_t which is initialized
1873  * to FALSE.
1874  *
1875  * Don't use local variable initializers which contain
1876  * calls to other library functions since the initializer
1877  * would happen before the FUNC_ENTER() gets called. Don't
1878  * use initializers that require special cleanup code to
1879  * execute if FUNC_ENTER() fails since a failing FUNC_ENTER()
1880  * returns immediately without branching to the `done' label.
1881  *
1882  * Programmer: Quincey Koziol
1883  *
1884  *-------------------------------------------------------------------------
1885  */
1886 
1887 /* `S' is the name of a function which is being tested to check if it's
1888  * an API function.
1889  *
1890  * BADNESS:
1891  * - Underscore at positions 2 or 3 (0-indexed string). Handles
1892  * H5_ and H5X_.
1893  * - Underscore at position 4 if position 3 is uppercase or a digit.
1894  * Handles H5XY_.
1895  */
1896 #define H5_IS_API(S) (\
1897  '_'!=((const char *)S)[2] /* underscore at position 2 */ \
1898  && '_'!=((const char *)S)[3] /* underscore at position 3 */ \
1899  && !( /* NOT */ \
1900  ((const char *)S)[4] /* pos 4 exists */ \
1901  && (HDisupper(S[3]) || HDisdigit(S[3])) /* pos 3 dig | uc */ \
1902  && '_'==((const char *)S)[4] /* pos 4 underscore */ \
1903  )\
1904 )
1905 
1906 /* `S' is the name of a function which is being tested to check if it's */
1907 /* a public API function */
1908 #define H5_IS_PUB(S) (((HDisdigit(S[1]) || HDisupper(S[1])) && HDislower(S[2])) || \
1909  ((HDisdigit(S[2]) || HDisupper(S[2])) && HDislower(S[3])) || \
1910  (!S[4] || ((HDisdigit(S[3]) || HDisupper(S[3])) && HDislower(S[4]))))
1911 
1912 /* `S' is the name of a function which is being tested to check if it's */
1913 /* a private library function */
1914 #define H5_IS_PRIV(S) (((HDisdigit(S[1]) || HDisupper(S[1])) && '_' == S[2] && HDislower(S[3])) || \
1915  ((HDisdigit(S[2]) || HDisupper(S[2])) && '_' == S[3] && HDislower(S[4])) || \
1916  ((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && HDislower(S[5])))
1917 
1918 /* `S' is the name of a function which is being tested to check if it's */
1919 /* a package private function */
1920 #define H5_IS_PKG(S) (((HDisdigit(S[1]) || HDisupper(S[1])) && '_' == S[2] && '_' == S[3] && HDislower(S[4])) || \
1921  ((HDisdigit(S[2]) || HDisupper(S[2])) && '_' == S[3] && '_' == S[4] && HDislower(S[5])) || \
1922  ((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && '_' == S[5] && HDislower(S[6])))
1923 
1924 /* global library version information string */
1925 extern char H5_lib_vers_info_g[];
1926 
1927 /* Lock headers */
1928 #ifdef H5_HAVE_THREADSAFE
1929 
1930 /* Include required thread-safety header */
1931 #include "H5TSprivate.h"
1932 
1933 /* replacement structure for original global variable */
1934 typedef struct H5_api_struct {
1935  H5TS_mutex_t init_lock; /* API entrance mutex */
1936  hbool_t H5_libinit_g; /* Has the library been initialized? */
1937  hbool_t H5_libterm_g; /* Is the library being shutdown? */
1938 } H5_api_t;
1939 
1940 /* Macros for accessing the global variables */
1941 #define H5_INIT_GLOBAL (H5_g.H5_libinit_g)
1942 #define H5_TERM_GLOBAL (H5_g.H5_libterm_g)
1943 
1944 /* Macro for first thread initialization */
1945 #ifdef H5_HAVE_WIN_THREADS
1946 #define H5_FIRST_THREAD_INIT InitOnceExecuteOnce(&H5TS_first_init_g, H5TS_win32_process_enter, NULL, NULL);
1947 #else
1948 #define H5_FIRST_THREAD_INIT pthread_once(&H5TS_first_init_g, H5TS_pthread_first_thread_init);
1949 #endif
1950 
1951 /* Macros for threadsafe HDF-5 Phase I locks */
1952 #define H5_API_LOCK \
1953  H5TS_mutex_lock(&H5_g.init_lock);
1954 #define H5_API_UNLOCK \
1955  H5TS_mutex_unlock(&H5_g.init_lock);
1956 
1957 /* Macros for thread cancellation-safe mechanism */
1958 #define H5_API_UNSET_CANCEL \
1959  H5TS_cancel_count_inc();
1960 
1961 #define H5_API_SET_CANCEL \
1962  H5TS_cancel_count_dec();
1963 
1964 extern H5_api_t H5_g;
1965 
1966 #else /* H5_HAVE_THREADSAFE */
1967 
1968 /* disable any first thread init mechanism */
1969 #define H5_FIRST_THREAD_INIT
1971 /* disable locks (sequential version) */
1972 #define H5_API_LOCK
1973 #define H5_API_UNLOCK
1975 /* disable cancelability (sequential version) */
1976 #define H5_API_UNSET_CANCEL
1977 #define H5_API_SET_CANCEL
1979 /* extern global variables */
1980 extern hbool_t H5_libinit_g; /* Has the library been initialized? */
1981 extern hbool_t H5_libterm_g; /* Is the library being shutdown? */
1982 
1983 /* Macros for accessing the global variables */
1984 #define H5_INIT_GLOBAL (H5_libinit_g)
1985 #define H5_TERM_GLOBAL (H5_libterm_g)
1987 #endif /* H5_HAVE_THREADSAFE */
1988 
1989 #ifdef H5_HAVE_CODESTACK
1990 
1991 /* Include required function stack header */
1992 #include "H5CSprivate.h"
1993 
1994 #define H5_PUSH_FUNC H5CS_push(FUNC);
1995 #define H5_POP_FUNC H5CS_pop();
1996 #else /* H5_HAVE_CODESTACK */
1997 #define H5_PUSH_FUNC /* void */
1998 #define H5_POP_FUNC /* void */
1999 #endif /* H5_HAVE_CODESTACK */
2000 
2001 #ifdef H5_HAVE_MPE
2002 extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
2003 #endif
2004 
2005 /* Macros for referencing package initialization symbols */
2006 #define H5_PACKAGE_INIT_VAR(x) H5_GLUE(x, _init_g)
2007 #define H5_PACKAGE_INIT_FUNC(x) H5_GLUE(x, __init_package)
2009 /* Macros for defining package initialization routines */
2010 #ifdef H5_MY_PKG
2011 #define H5_PKG_INIT_VAR H5_PACKAGE_INIT_VAR(H5_MY_PKG)
2012 #define H5_PKG_INIT_FUNC H5_PACKAGE_INIT_FUNC(H5_MY_PKG)
2013 #define H5_PACKAGE_YES_INIT(err) \
2014  /* Initialize this interface or bust */ \
2015  if(!H5_PKG_INIT_VAR && !H5_TERM_GLOBAL) { \
2016  H5_PKG_INIT_VAR = TRUE; \
2017  if(H5_PKG_INIT_FUNC() < 0) { \
2018  H5_PKG_INIT_VAR = FALSE; \
2019  HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "interface initialization failed") \
2020  } \
2021  }
2022 #define H5_PACKAGE_NO_INIT(err) \
2023  /* Initialize this interface or bust */ \
2024  if(!H5_PKG_INIT_VAR && !H5_TERM_GLOBAL) \
2025  H5_PKG_INIT_VAR = TRUE;
2026 #define H5_PACKAGE_INIT(pkg_init, err) H5_GLUE3(H5_PACKAGE_, pkg_init, _INIT)(err)
2027 #else /* H5_MY_PKG */
2028 #define H5_PKG_INIT_VAR (TRUE)
2029 #define H5_PACKAGE_INIT(pkg_init, err)
2030 #endif /* H5_MY_PKG */
2031 
2032 /* Forward declaration of H5CXpush() / H5CXpop() */
2033 /* (Including H5CXprivate.h creates bad circular dependencies - QAK, 3/18/2018) */
2034 H5_DLL herr_t H5CX_push(void);
2035 H5_DLL herr_t H5CX_pop(void);
2036 
2037 #ifndef NDEBUG
2038 #define FUNC_ENTER_CHECK_NAME(asrt) \
2039  { \
2040  static hbool_t func_check = FALSE; \
2041  \
2042  if(!func_check) { \
2043  /* Check function naming status */ \
2044  HDassert(asrt && "Function naming conventions are incorrect - check H5_IS_API|PUB|PRIV|PKG macros in H5private.h (this is usually due to an incorrect number of underscores)"); \
2045  \
2046  /* Don't check again */ \
2047  func_check = TRUE; \
2048  } /* end if */ \
2049  } /* end scope */
2050 #else /* NDEBUG */
2051 #define FUNC_ENTER_CHECK_NAME(asrt)
2052 #endif /* NDEBUG */
2053 
2054 
2055 #define FUNC_ENTER_COMMON(asrt) \
2056  hbool_t err_occurred = FALSE; \
2057  \
2058  FUNC_ENTER_CHECK_NAME(asrt);
2059 
2060 #define FUNC_ENTER_COMMON_NOERR(asrt) \
2061  FUNC_ENTER_CHECK_NAME(asrt);
2062 
2063 /* Threadsafety initialization code for API routines */
2064 #define FUNC_ENTER_API_THREADSAFE \
2065  /* Initialize the thread-safe code */ \
2066  H5_FIRST_THREAD_INIT \
2067  \
2068  /* Grab the mutex for the library */ \
2069  H5_API_UNSET_CANCEL \
2070  H5_API_LOCK
2071 
2072 /* Local variables for API routines */
2073 #define FUNC_ENTER_API_VARS \
2074  MPE_LOG_VARS \
2075  H5TRACE_DECL
2076 
2077 #define FUNC_ENTER_API_COMMON \
2078  FUNC_ENTER_API_VARS \
2079  FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \
2080  FUNC_ENTER_API_THREADSAFE;
2081 
2082 #define FUNC_ENTER_API_INIT(err) \
2083  /* Initialize the library */ \
2084  if(!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \
2085  H5_INIT_GLOBAL = TRUE; \
2086  if(H5_init_library() < 0) \
2087  HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "library initialization failed") \
2088  } /* end if */ \
2089  \
2090  /* Initialize the package, if appropriate */ \
2091  H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \
2092  \
2093  /* Push the name of this function on the function stack */ \
2094  H5_PUSH_FUNC \
2095  \
2096  /* Push the API context */ \
2097  if(H5CX_push() < 0) \
2098  HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context") \
2099  \
2100  BEGIN_MPE_LOG
2101 
2102 /* Use this macro for all "normal" API functions */
2103 #define FUNC_ENTER_API(err) {{ \
2104  FUNC_ENTER_API_COMMON \
2105  FUNC_ENTER_API_INIT(err); \
2106  /* Clear thread error stack entering public functions */ \
2107  H5E_clear_stack(NULL); \
2108  {
2109 
2110 /*
2111  * Use this macro for API functions that shouldn't clear the error stack
2112  * like H5Eprint and H5Ewalk.
2113  */
2114 #define FUNC_ENTER_API_NOCLEAR(err) {{ \
2115  FUNC_ENTER_API_COMMON \
2116  FUNC_ENTER_API_INIT(err); \
2117  {
2118 
2119 /*
2120  * Use this macro for API functions that shouldn't perform _any_ initialization
2121  * of the library or an interface, just perform tracing, etc. Examples
2122  * are: H5allocate_memory, H5is_library_threadsafe, public VOL callback
2123  * wrappers (e.g. H5VLfile_create, H5VLdataset_read, etc.), etc.
2124  *
2125  */
2126 #define FUNC_ENTER_API_NOINIT {{{ \
2127  FUNC_ENTER_API_COMMON \
2128  H5_PUSH_FUNC \
2129  BEGIN_MPE_LOG \
2130  {
2131 
2132 /*
2133  * Use this macro for API functions that shouldn't perform _any_ initialization
2134  * of the library or an interface or push themselves on the function
2135  * stack, just perform tracing, etc. Examples
2136  * are: H5close, H5check_version, etc.
2137  *
2138  */
2139 #define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{{{ \
2140  FUNC_ENTER_API_VARS \
2141  FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \
2142  FUNC_ENTER_API_THREADSAFE; \
2143  BEGIN_MPE_LOG \
2144  {
2145 
2146 /* Note: this macro only works when there's _no_ interface initialization routine for the module */
2147 #define FUNC_ENTER_NOAPI_INIT(err) \
2148  /* Initialize the package, if appropriate */ \
2149  H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \
2150  \
2151  /* Push the name of this function on the function stack */ \
2152  H5_PUSH_FUNC
2153 
2154 /* Use this macro for all "normal" non-API functions */
2155 #define FUNC_ENTER_NOAPI(err) { \
2156  FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
2157  FUNC_ENTER_NOAPI_INIT(err) \
2158  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2159 
2160 /* Use this macro for all non-API functions, which propagate errors, but don't issue them */
2161 #define FUNC_ENTER_NOAPI_NOERR { \
2162  FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
2163  FUNC_ENTER_NOAPI_INIT(-) \
2164  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2165 
2166 /*
2167  * Use this macro for non-API functions which fall into these categories:
2168  * - static functions, since they must be called from a function in the
2169  * interface, the library and interface must already be
2170  * initialized.
2171  * - functions which are called during library shutdown, since we don't
2172  * want to re-initialize the library.
2173  */
2174 #define FUNC_ENTER_NOAPI_NOINIT { \
2175  FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
2176  H5_PUSH_FUNC \
2177  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2178 
2179 /*
2180  * Use this macro for non-API functions which fall into these categories:
2181  * - static functions, since they must be called from a function in the
2182  * interface, the library and interface must already be
2183  * initialized.
2184  * - functions which are called during library shutdown, since we don't
2185  * want to re-initialize the library.
2186  * - functions that propagate, but don't issue errors
2187  */
2188 #define FUNC_ENTER_NOAPI_NOINIT_NOERR { \
2189  FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
2190  H5_PUSH_FUNC \
2191  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2192 
2193 /*
2194  * Use this macro for non-API functions which fall into these categories:
2195  * - functions which shouldn't push their name on the function stack
2196  * (so far, just the H5CS routines themselves)
2197  *
2198  */
2199 #define FUNC_ENTER_NOAPI_NOFS { \
2200  FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
2201  \
2202  /* Initialize the package, if appropriate */ \
2203  H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \
2204  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2205 
2206 /*
2207  * Use this macro for non-API functions which fall into these categories:
2208  * - functions which shouldn't push their name on the function stack
2209  * (so far, just the H5CS routines themselves)
2210  *
2211  * This macro is used for functions which fit the above categories _and_
2212  * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack)
2213  *
2214  */
2215 #define FUNC_ENTER_NOAPI_NOERR_NOFS { \
2216  FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
2217  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2218 
2219 /* Use the following two macros as replacements for the FUNC_ENTER_NOAPI
2220  * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set
2221  * up a metadata tag. */
2222 #define FUNC_ENTER_NOAPI_TAG(tag, err) { \
2223  haddr_t prev_tag = HADDR_UNDEF; \
2224  \
2225  FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
2226  H5AC_tag(tag, &prev_tag); \
2227  FUNC_ENTER_NOAPI_INIT(err) \
2228  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2229 
2230 #define FUNC_ENTER_NOAPI_NOINIT_TAG(tag) { \
2231  haddr_t prev_tag = HADDR_UNDEF; \
2232  \
2233  FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
2234  H5AC_tag(tag, &prev_tag); \
2235  H5_PUSH_FUNC \
2236  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2237 
2238 /* Use this macro for all "normal" package-level functions */
2239 #define FUNC_ENTER_PACKAGE { \
2240  FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
2241  H5_PUSH_FUNC \
2242  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2243 
2244 /* Use this macro for package-level functions which propgate errors, but don't issue them */
2245 #define FUNC_ENTER_PACKAGE_NOERR { \
2246  FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
2247  H5_PUSH_FUNC \
2248  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2249 
2250 /* Use the following macro as replacement for the FUNC_ENTER_PACKAGE
2251  * macro when the function needs to set up a metadata tag. */
2252 #define FUNC_ENTER_PACKAGE_TAG(tag) { \
2253  haddr_t prev_tag = HADDR_UNDEF; \
2254  \
2255  FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
2256  H5AC_tag(tag, &prev_tag); \
2257  H5_PUSH_FUNC \
2258  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2259 
2260 /* Use this macro for all "normal" staticly-scoped functions */
2261 #define FUNC_ENTER_STATIC { \
2262  FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
2263  H5_PUSH_FUNC \
2264  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2265 
2266 /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */
2267 #define FUNC_ENTER_STATIC_NOERR { \
2268  FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
2269  H5_PUSH_FUNC \
2270  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2271 
2272 /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */
2273 /* And that shouldn't push their name on the function stack */
2274 #define FUNC_ENTER_STATIC_NOERR_NOFS { \
2275  FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
2276  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2277 
2278 /* Use the following macro as replacement for the FUNC_ENTER_STATIC
2279  * macro when the function needs to set up a metadata tag. */
2280 #define FUNC_ENTER_STATIC_TAG(tag) { \
2281  haddr_t prev_tag = HADDR_UNDEF; \
2282  \
2283  FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
2284  H5AC_tag(tag, &prev_tag); \
2285  H5_PUSH_FUNC \
2286  if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
2287 
2288 
2289 /*-------------------------------------------------------------------------
2290  * Purpose: Register function exit for code profiling. This should be
2291  * the last statement executed by a function.
2292  *
2293  * Programmer: Quincey Koziol
2294  *
2295  *-------------------------------------------------------------------------
2296  */
2297 /* Threadsafety termination code for API routines */
2298 #define FUNC_LEAVE_API_THREADSAFE \
2299  H5_API_UNLOCK \
2300  H5_API_SET_CANCEL
2301 
2302 #define FUNC_LEAVE_API_COMMON(ret_value) \
2303  ; \
2304  } /*end scope from end of FUNC_ENTER*/ \
2305  FINISH_MPE_LOG \
2306  H5TRACE_RETURN(ret_value);
2307 
2308 #define FUNC_LEAVE_API(ret_value) \
2309  FUNC_LEAVE_API_COMMON(ret_value); \
2310  (void)H5CX_pop(); \
2311  H5_POP_FUNC \
2312  if(err_occurred) \
2313  (void)H5E_dump_api_stack(TRUE); \
2314  FUNC_LEAVE_API_THREADSAFE \
2315  return(ret_value); \
2316 }} /*end scope from beginning of FUNC_ENTER*/
2317 
2318 /* Use this macro to match the FUNC_ENTER_API_NOINIT macro */
2319 #define FUNC_LEAVE_API_NOINIT(ret_value) \
2320  FUNC_LEAVE_API_COMMON(ret_value); \
2321  H5_POP_FUNC \
2322  if(err_occurred) \
2323  (void)H5E_dump_api_stack(TRUE); \
2324  FUNC_LEAVE_API_THREADSAFE \
2325  return(ret_value); \
2326 }}} /*end scope from beginning of FUNC_ENTER*/
2327 
2328 /* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */
2329 #define FUNC_LEAVE_API_NOFS(ret_value) \
2330  FUNC_LEAVE_API_COMMON(ret_value); \
2331  FUNC_LEAVE_API_THREADSAFE \
2332  return(ret_value); \
2333 }}}} /*end scope from beginning of FUNC_ENTER*/
2334 
2335 #define FUNC_LEAVE_NOAPI(ret_value) \
2336  ; \
2337  } /*end scope from end of FUNC_ENTER*/ \
2338  H5_POP_FUNC \
2339  return(ret_value); \
2340 } /*end scope from beginning of FUNC_ENTER*/
2341 
2342 #define FUNC_LEAVE_NOAPI_VOID \
2343  ; \
2344  } /*end scope from end of FUNC_ENTER*/ \
2345  H5_POP_FUNC \
2346  return; \
2347 } /*end scope from beginning of FUNC_ENTER*/
2348 
2349 /*
2350  * Use this macro for non-API functions which fall into these categories:
2351  * - functions which didn't push their name on the function stack
2352  * (so far, just the H5CS routines themselves)
2353  */
2354 #define FUNC_LEAVE_NOAPI_NOFS(ret_value) \
2355  ; \
2356  } /*end scope from end of FUNC_ENTER*/ \
2357  return(ret_value); \
2358 } /*end scope from beginning of FUNC_ENTER*/
2359 
2360 /* Use this macro when exiting a function that set up a metadata tag */
2361 #define FUNC_LEAVE_NOAPI_TAG(ret_value) \
2362  ; \
2363  } /*end scope from end of FUNC_ENTER*/ \
2364  H5AC_tag(prev_tag, NULL); \
2365  H5_POP_FUNC \
2366  return(ret_value); \
2367 } /*end scope from beginning of FUNC_ENTER*/
2368 
2369 
2370 /****************************************/
2371 /* Revisions to FUNC_ENTER/LEAVE Macros */
2372 /****************************************/
2373 
2374 /* Macros to check if a package is initialized */
2375 #define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg));
2376 #define H5_CHECK_PACKAGE_INIT_REG_NO(asrt)
2377 #define H5_CHECK_PACKAGE_INIT_INIT_YES(asrt)
2378 #define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt)
2379 #define H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg)
2381 /* Macros to initialize package, if a package initialization routine is defined */
2382 #define H5_PKG_YES_INIT(pkg) \
2383  if(!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) { \
2384  H5_PACKAGE_INIT_VAR(pkg) = TRUE; \
2385  if(H5_PACKAGE_INIT_FUNC(pkg)() < 0) { \
2386  H5_PACKAGE_INIT_VAR(pkg) = FALSE; \
2387  /* (Can't use H5E_THROW here) */ \
2388  H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \
2389  ret_value = fail_value; \
2390  goto func_init_failed; \
2391  } /* end if */ \
2392  } /* end if */
2393 #define H5_PKG_NO_INIT(pkg) \
2394  if(!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) \
2395  H5_PACKAGE_INIT_VAR(pkg) = TRUE;
2396 #define H5_PKG_INIT(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg)
2398 /* Macros to declare package initialization function, if a package initialization routine is defined */
2399 #ifdef H5_PKG_SINGLE_SOURCE
2400 #define H5_PKG_DECLARE_YES_FUNC(pkg) static herr_t H5_PACKAGE_INIT_FUNC(pkg)(void);
2401 #else /* H5_PKG_SINGLE_SOURCE */
2402 #define H5_PKG_DECLARE_YES_FUNC(pkg) extern herr_t H5_PACKAGE_INIT_FUNC(pkg)(void);
2403 #endif /* H5_PKG_SINGLE_SOURCE */
2404 #define H5_PKG_DECLARE_NO_FUNC(pkg)
2406 /* Declare package initialization symbols (if in a package) */
2407 #ifdef H5_PKG_SINGLE_SOURCE
2408 #define H5_PKG_DECLARE_VAR(pkg) static hbool_t H5_PACKAGE_INIT_VAR(pkg);
2409 #else /* H5_PKG_SINGLE_SOURCE */
2410 #define H5_PKG_DECLARE_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(pkg);
2411 #endif /* H5_PKG_SINGLE_SOURCE */
2412 #define H5_PKG_DECLARE_FUNC(pkg_init, pkg) H5_GLUE3(H5_PKG_DECLARE_, pkg_init, _FUNC)(pkg)
2413 #ifdef H5_MY_PKG
2416 #endif /* H5_MY_PKG */
2417 
2418 /* API re-entrance variable */
2419 extern hbool_t H5_api_entered_g; /* Has library already been entered through API? */
2420 
2421 /* Macros for entering different scopes of routines */
2422 #define H5_PACKAGE_ENTER(pkg, pkg_init, init) \
2423  FUNC_ENTER_CHECK_NAME(H5_IS_PKG(FUNC)) \
2424  \
2425  /* The library should be initialized already */ \
2426  HDassert(H5_INIT_GLOBAL); \
2427  \
2428  /* This interface should be initialized already */ \
2429  /* (except for package initialization routines :-) */ \
2430  H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) \
2431  \
2432  /* Push the name of this function on the function stack */ \
2433  H5_PUSH_FUNC \
2434  \
2435  /* Enter scope for this type of function */ \
2436  {
2437 
2438 #define H5_PRIVATE_ENTER(pkg, pkg_init) \
2439  FUNC_ENTER_CHECK_NAME(H5_IS_PRIV(FUNC)) \
2440  \
2441  /* The library should be initialized already */ \
2442  HDassert(H5_INIT_GLOBAL); \
2443  \
2444  /* Initialize this interface if desired */ \
2445  H5_PKG_INIT(pkg_init, pkg) \
2446  \
2447  /* Push the name of this function on the function stack */ \
2448  H5_PUSH_FUNC \
2449  \
2450  /* Enter scope for this type of function */ \
2451  {{
2452 
2453 #define H5_PUBLIC_ENTER(pkg, pkg_init) \
2454  FUNC_ENTER_API_VARS \
2455  FUNC_ENTER_API_THREADSAFE; \
2456  FUNC_ENTER_CHECK_NAME(H5_IS_PUB(FUNC)) \
2457  \
2458  /* Clear thread error stack when entering public functions */ \
2459  H5E_clear_stack(NULL); \
2460  \
2461  /* Initialize the library or bust */ \
2462  if(!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \
2463  H5_INIT_GLOBAL = TRUE; \
2464  if(H5_init_library() < 0) { \
2465  /* (Can't use H5E_THROW here) */ \
2466  H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \
2467  ret_value = fail_value; \
2468  goto func_init_failed; \
2469  } /* end if */ \
2470  } /* end if */ \
2471  \
2472  /* Initialize this interface if desired */ \
2473  H5_PKG_INIT(pkg_init, pkg) \
2474  \
2475  /* Check for re-entering API routine */ \
2476  HDassert(!H5_api_entered_g); \
2477  H5_api_entered_g = TRUE; \
2478  \
2479  /* Start logging MPI's MPE information */ \
2480  BEGIN_MPE_LOG \
2481  \
2482  /* Push the name of this function on the function stack */ \
2483  H5_PUSH_FUNC \
2484  \
2485  /* Enter scope for this type of function */ \
2486  {{{
2487 
2488 /* Macros for substituting the package name */
2489 #define FUNC_ENT_STATIC(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG)
2490 #define FUNC_ENT_PKGINIT(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, INIT)
2491 #define FUNC_ENT_PKG(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG)
2492 #define FUNC_ENT_PRIV(pkg, pkg_init) H5_PRIVATE_ENTER(pkg, pkg_init)
2493 #define FUNC_ENT_PUB(pkg, pkg_init) H5_PUBLIC_ENTER(pkg, pkg_init)
2495 /* Macros for substituting a function prefix */
2496 #define FUNC_PREFIX_STATIC static
2497 #define FUNC_PREFIX_PKGINIT
2498 #define FUNC_PREFIX_PKG
2499 #define FUNC_PREFIX_PRIV
2500 #define FUNC_PREFIX_PUB
2502 /* Macros for declaring error variables */
2503 /* Function can detect errors and has a specific error return value */
2504 #define FUNC_ERR_VAR_ERR(ret_typ, err) \
2505  hbool_t past_catch = FALSE; \
2506  ret_typ fail_value = err;
2507 /* Function can detect errors but cannot return an error value (Cleanup only) */
2508 #define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \
2509  hbool_t past_catch = FALSE;
2510 /* Function has no need to detect or clean up from errors */
2511 #define FUNC_ERR_VAR_NOERR(ret_typ, err)
2513 /* Use this macro when entering all functions */
2514 #define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \
2515 H5_GLUE(FUNC_PREFIX_, scope) \
2516 ret_typ \
2517 func \
2518 /* Open function */ \
2519 { \
2520  ret_typ ret_value = ret_init; \
2521  H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \
2522  H5_GLUE(FUNC_ENT_, scope)(H5_MY_PKG, H5_MY_PKG_INIT)
2523 
2524 /* Use this macro when entering functions that have no return value */
2525 #define BEGIN_FUNC_VOID(scope, use_err, func) \
2526 H5_GLUE(FUNC_PREFIX_, scope) \
2527 void \
2528 func \
2529 /* Open function */ \
2530 { \
2531  H5_GLUE(FUNC_ERR_VAR_, use_err)(void, -, -) \
2532  H5_GLUE(FUNC_ENT_, scope)
2533 
2534 /* Macros for label when a function initialization can fail */
2535 #define H5_PRIV_YES_FUNC_INIT_FAILED func_init_failed:
2536 #define H5_PRIV_NO_FUNC_INIT_FAILED
2537 #define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED)
2539 /* Macros for leaving different scopes of routines */
2540 #define FUNC_LEAVE_PKGINIT \
2541  /* Leave scope for this type of function */ \
2542  } \
2543  \
2544  /* Pop the name of this function off the function stack */ \
2545  H5_POP_FUNC
2546 
2547 #define FUNC_LEAVE_STATIC \
2548  /* Leave scope for this type of function */ \
2549  } \
2550  \
2551  /* Pop the name of this function off the function stack */ \
2552  H5_POP_FUNC
2553 
2554 #define FUNC_LEAVE_PKG \
2555  /* Leave scope for this type of function */ \
2556  } \
2557  \
2558  /* Pop the name of this function off the function stack */ \
2559  H5_POP_FUNC
2560 
2561 #define FUNC_LEAVE_PRIV \
2562  /* Leave scope for this type of function */ \
2563  }} \
2564  \
2565  /* Label for errors during FUNC_ENTER */ \
2566  H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \
2567  \
2568  /* Pop the name of this function off the function stack */ \
2569  H5_POP_FUNC
2570 
2571 #define FUNC_LEAVE_PUB \
2572  /* Leave scope for this type of function */ \
2573  }}} \
2574  \
2575  /* Label for errors during FUNC_ENTER */ \
2576 func_init_failed: \
2577  \
2578  /* Dump error stack if an error occurred during API routine */ \
2579  if(ret_value == fail_value) \
2580  (void)H5E_dump_api_stack(TRUE); \
2581  \
2582  /* Finish the API tracing info */ \
2583  H5TRACE_RETURN(ret_value); \
2584  \
2585  /* Pop the name of this function off the function stack */ \
2586  H5_POP_FUNC \
2587  \
2588  /* Finish the MPE tracing info */ \
2589  FINISH_MPE_LOG \
2590  \
2591  /* Check for leaving API routine */ \
2592  HDassert(H5_api_entered_g); \
2593  H5_api_entered_g = FALSE; \
2594  \
2595  /* Release thread-safety semaphore */ \
2596  FUNC_LEAVE_API_THREADSAFE
2597 
2598 /* Use this macro when leaving all functions */
2599 #define END_FUNC(scope) \
2600  /* Scope-specific function conclusion */ \
2601  H5_GLUE(FUNC_LEAVE_, scope) \
2602  \
2603  /* Leave routine */ \
2604  return(ret_value); \
2605  \
2606  /* Close Function */ \
2607 }
2608 
2609 /* Use this macro when leaving void functions */
2610 #define END_FUNC_VOID(scope) \
2611  /* Scope-specific function conclusion */ \
2612  H5_GLUE(FUNC_LEAVE_, scope) \
2613  \
2614  /* Leave routine */ \
2615  return; \
2616  \
2617  /* Close Function */ \
2618 }
2619 
2620 /* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient).
2621  * Make sure to use HGOTO_ERROR_TAG and HGOTO_DONE_TAG between these macros! */
2622 #define H5_BEGIN_TAG(tag) { \
2623  haddr_t prv_tag = HADDR_UNDEF; \
2624  H5AC_tag(tag, &prv_tag); \
2625 
2626 #define H5_END_TAG \
2627  H5AC_tag(prv_tag, NULL); \
2628 }
2629 
2630 /* Compile-time "assert" macro */
2631 #define HDcompile_assert(e) ((void)sizeof(char[ !!(e) ? 1 : -1]))
2632 /* Variants that are correct, but generate compile-time warnings in some circumstances:
2633  #define HDcompile_assert(e) do { enum { compile_assert__ = 1 / (e) }; } while(0)
2634  #define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0)
2635 */
2636 
2637 /* Private functions, not part of the publicly documented API */
2639 H5_DLL void H5_term_library(void);
2640 
2641 /* Functions to terminate interfaces */
2642 H5_DLL int H5A_term_package(void);
2643 H5_DLL int H5A_top_term_package(void);
2644 H5_DLL int H5AC_term_package(void);
2645 H5_DLL int H5CX_term_package(void);
2646 H5_DLL int H5D_term_package(void);
2647 H5_DLL int H5D_top_term_package(void);
2648 H5_DLL int H5E_term_package(void);
2649 H5_DLL int H5F_term_package(void);
2650 H5_DLL int H5FD_term_package(void);
2651 H5_DLL int H5FL_term_package(void);
2653 H5_DLL int H5G_term_package(void);
2654 H5_DLL int H5G_top_term_package(void);
2655 H5_DLL int H5I_term_package(void);
2656 H5_DLL int H5L_term_package(void);
2657 H5_DLL int H5M_term_package(void);
2658 H5_DLL int H5M_top_term_package(void);
2659 H5_DLL int H5P_term_package(void);
2660 H5_DLL int H5PL_term_package(void);
2661 H5_DLL int H5R_term_package(void);
2662 H5_DLL int H5R_top_term_package(void);
2663 H5_DLL int H5S_term_package(void);
2664 H5_DLL int H5S_top_term_package(void);
2665 H5_DLL int H5SL_term_package(void);
2666 H5_DLL int H5T_term_package(void);
2667 H5_DLL int H5T_top_term_package(void);
2668 H5_DLL int H5VL_term_package(void);
2669 H5_DLL int H5Z_term_package(void);
2670 
2671 /* Checksum functions */
2672 H5_DLL uint32_t H5_checksum_fletcher32(const void *data, size_t len);
2673 H5_DLL uint32_t H5_checksum_crc(const void *data, size_t len);
2674 H5_DLL uint32_t H5_checksum_lookup3(const void *data, size_t len, uint32_t initval);
2675 H5_DLL uint32_t H5_checksum_metadata(const void *data, size_t len, uint32_t initval);
2676 H5_DLL uint32_t H5_hash_string(const char *str);
2677 
2678 /* Time related routines */
2679 H5_DLL time_t H5_make_time(struct tm *tm);
2680 H5_DLL void H5_nanosleep(uint64_t nanosec);
2681 H5_DLL double H5_get_time(void);
2682 
2683 /* Functions for building paths, etc. */
2684 H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/);
2685 H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/);
2686 
2687 #ifdef H5_HAVE_PARALLEL
2688 /* Generic MPI functions */
2689 H5_DLL hsize_t H5_mpi_set_bigio_count(hsize_t new_count);
2690 H5_DLL hsize_t H5_mpi_get_bigio_count(void);
2691 H5_DLL herr_t H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new);
2692 H5_DLL herr_t H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new);
2693 H5_DLL herr_t H5_mpi_comm_free(MPI_Comm *comm);
2694 H5_DLL herr_t H5_mpi_info_free(MPI_Info *info);
2695 H5_DLL herr_t H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result);
2696 H5_DLL herr_t H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result);
2697 H5_DLL herr_t H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
2698  MPI_Datatype old_type, MPI_Datatype *new_type);
2699 #endif /* H5_HAVE_PARALLEL */
2700 
2701 /* Functions for debugging */
2702 H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf,
2703  const uint8_t *marker, size_t buf_offset, size_t buf_size);
2704 
2705 #endif /* _H5private_H */
2706 
H5public.h
Nflock
H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation)
H5Z_term_package
H5_DLL int H5Z_term_package(void)
Definition: H5Z.c:127
H5_libinit_g
hbool_t H5_libinit_g
Definition: H5.c:76
H5A_top_term_package
H5_DLL int H5A_top_term_package(void)
Definition: H5A.c:177
H5O_copy_file_ud_common_t
struct H5O_copy_file_ud_common_t H5O_copy_file_ud_common_t
H5_MY_PKG
#define H5_MY_PKG
Definition: H5ACmodule.h:28
H5_checksum_fletcher32
H5_DLL uint32_t H5_checksum_fletcher32(const void *data, size_t len)
Definition: H5checksum.c:110
H5_term_library
H5_DLL void H5_term_library(void)
Definition: H5.c:258
H5_PKG_MM
@ H5_PKG_MM
Definition: H5private.h:1742
H5S_top_term_package
H5_DLL int H5S_top_term_package(void)
Definition: H5S.c:162
H5_debug_t::open_stream
H5_debug_open_stream_t * open_stream
Definition: H5private.h:1766
H5_debug_t::stream
FILE * stream
Definition: H5private.h:1764
uint32_t
uint32_t
Definition: H5overflow.txt:38
H5_PKG_VL
@ H5_PKG_VL
Definition: H5private.h:1748
H5T_top_term_package
H5_DLL int H5T_top_term_package(void)
Definition: H5T.c:1409
haddr_t
CATCH haddr_t
Definition: H5EAdblock.c:162
H5_checksum_metadata
H5_DLL uint32_t H5_checksum_metadata(const void *data, size_t len, uint32_t initval)
Definition: H5checksum.c:460
H5_PKG_D
@ H5_PKG_D
Definition: H5private.h:1733
H5_PKG_M
@ H5_PKG_M
Definition: H5private.h:1740
indent
*s *s indent
Definition: H5HLdbg.c:111
H5PL_term_package
H5_DLL int H5PL_term_package(void)
Definition: H5PLint.c:192
HDrand
#define HDrand()
Definition: H5private.h:1222
result
Definition: H5Ztrans.c:67
H5_debug_t::pkg
struct H5_debug_t::@40 pkg[H5_NPKGS]
H5O_pline_t
Definition: H5Oprivate.h:701
H5_PKG_HL
@ H5_PKG_HL
Definition: H5private.h:1738
H5_PKG_AC
@ H5_PKG_AC
Definition: H5private.h:1731
H5D_term_package
H5_DLL int H5D_term_package(void)
Definition: H5Dint.c:309
H5_trace
H5_DLL double H5_trace(const double *calltime, const char *func, const char *type,...)
Definition: H5trace.c:120
H5_debug_open_stream_t::next
struct H5_debug_open_stream_t * next
Definition: H5private.h:1755
H5_PKG_B
@ H5_PKG_B
Definition: H5private.h:1732
H5_timer_end
H5_DLL void H5_timer_end(H5_timer_t *sum, H5_timer_t *timer)
Definition: H5timer.c:160
uint8_t
unsigned char uint8_t
Definition: H5private.h:429
HDstrtoll
H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base)
Definition: H5system.c:511
H5L_term_package
H5_DLL int H5L_term_package(void)
Definition: H5L.c:234
H5_lib_vers_info_g
char H5_lib_vers_info_g[]
Definition: H5.c:84
int64_t
int64_t
Definition: H5overflow.txt:35
HDsrand
#define HDsrand(S)
Definition: H5private.h:1228
H5overflow.h
H5_checksum_lookup3
H5_DLL uint32_t H5_checksum_lookup3(const void *data, size_t len, uint32_t initval)
Definition: H5checksum.c:372
H5_bandwidth
H5_DLL void H5_bandwidth(char *buf, double nbytes, double nseconds)
Definition: H5timer.c:205
H5T_term_package
H5_DLL int H5T_term_package(void)
Definition: H5T.c:1615
H5_PKG_E
@ H5_PKG_E
Definition: H5private.h:1734
int8_t
signed char int8_t
Definition: H5private.h:420
H5_timer_t::etime
double etime
Definition: H5private.h:604
H5O_copy_file_ud_common_t
Definition: H5private.h:621
H5_PKG_V
@ H5_PKG_V
Definition: H5private.h:1747
H5_api_entered_g
hbool_t H5_api_entered_g
Definition: H5.c:69
H5_COPY_DEEP
@ H5_COPY_DEEP
Definition: H5private.h:617
uint16_t
uint16_t
Definition: H5overflow.txt:37
FILE
Invalid arguments to routine Resource unavailable Internal File accessibility Low level I O Function entry exit Object atom Object cache Links B Tree node Symbol table Heap Object header Datatype Dataspace Dataset Data storage Property lists Attribute Data filters External file list References Virtual File Layer Virtual Object Layer Ternary Search Trees Reference Counted Strings Error API Skip Lists Free Space Manager Shared Object Header Messages Extensible Array Fixed Array Plugin for dynamically loaded library Page Buffering API Context Map No error Argument errors Resource errors File accessibility errors FILE
Definition: H5err.txt:88
H5CX_term_package
H5_DLL int H5CX_term_package(void)
Definition: H5CX.c:655
H5TSprivate.h
H5FL_term_package
H5_DLL int H5FL_term_package(void)
Definition: H5FL.c:176
H5O_copy_file_ud_common_t::src_pline
struct H5O_pline_t * src_pline
Definition: H5private.h:622
H5_timer_t
Definition: H5private.h:601
H5CX_pop
H5_DLL herr_t H5CX_pop(void)
Definition: H5CX.c:3578
H5R_top_term_package
H5_DLL int H5R_top_term_package(void)
Definition: H5Rint.c:207
H5_PKG_G
@ H5_PKG_G
Definition: H5private.h:1736
H5_PKG_F
@ H5_PKG_F
Definition: H5private.h:1735
HDfprintf
H5_DLL int HDfprintf(FILE *stream, const char *fmt,...)
Definition: H5system.c:112
uint64_t
uint64_t
Definition: H5overflow.txt:39
H5win32defs.h
H5_debug_t::name
const char * name
Definition: H5private.h:1763
H5_debug_t
struct H5_debug_t H5_debug_t
H5_PKG_I
@ H5_PKG_I
Definition: H5private.h:1739
H5_init_library
H5_DLL herr_t H5_init_library(void)
Definition: H5.c:109
H5_PKG_DECLARE_FUNC
#define H5_PKG_DECLARE_FUNC(pkg_init, pkg)
Definition: H5private.h:2412
H5TS_mutex_struct
Definition: H5TSprivate.h:78
H5_PKG_O
@ H5_PKG_O
Definition: H5private.h:1743
H5_obj_t
Definition: H5private.h:626
H5CX_push
H5_DLL herr_t H5CX_push(void)
Definition: H5CX.c:787
H5AC_term_package
H5_DLL int H5AC_term_package(void)
Definition: H5AC.c:215
H5D_top_term_package
H5_DLL int H5D_top_term_package(void)
Definition: H5Dint.c:252
H5_debug_open_stream_t::stream
FILE * stream
Definition: H5private.h:1754
H5_debug_t::trace
FILE * trace
Definition: H5private.h:1759
H5_debug_g
H5_debug_t H5_debug_g
Definition: H5.c:86
H5_DLL
#define H5_DLL
Definition: H5api_adpt.h:234
H5_PKG_P
@ H5_PKG_P
Definition: H5private.h:1744
H5_pkg_t
H5_pkg_t
Definition: H5private.h:1729
H5_ATTR_CONST
#define H5_ATTR_CONST
Definition: H5private.h:336
H5_timer_begin
H5_DLL void H5_timer_begin(H5_timer_t *timer)
Definition: H5timer.c:114
H5_PKG_MF
@ H5_PKG_MF
Definition: H5private.h:1741
H5_timer_t::utime
double utime
Definition: H5private.h:602
H5_PKG_DECLARE_VAR
#define H5_PKG_DECLARE_VAR(pkg)
Definition: H5private.h:2410
H5FS_term_package
H5_DLL int H5FS_term_package(void)
H5_PKG_A
@ H5_PKG_A
Definition: H5private.h:1730
H5F_term_package
H5_DLL int H5F_term_package(void)
Definition: H5F.c:186
h5_stat_size_t
off_t h5_stat_size_t
Definition: H5private.h:927
H5_PKG_T
@ H5_PKG_T
Definition: H5private.h:1746
H5_debug_t::ttimes
hbool_t ttimes
Definition: H5private.h:1761
H5_libterm_g
hbool_t H5_libterm_g
Definition: H5.c:77
H5_copy_depth_t
H5_copy_depth_t
Definition: H5private.h:615
H5I_term_package
H5_DLL int H5I_term_package(void)
Definition: H5I.c:163
H5_timer_t::stime
double stime
Definition: H5private.h:603
H5_debug_open_stream_t
Definition: H5private.h:1753
H5_build_extpath
H5_DLL herr_t H5_build_extpath(const char *name, char **extpath)
Definition: H5system.c:1170
H5E_term_package
H5_DLL int H5E_term_package(void)
Definition: H5E.c:243
H5_COPY_SHALLOW
@ H5_COPY_SHALLOW
Definition: H5private.h:616
H5libhdf5_settings
char H5libhdf5_settings[]
H5_timer_reset
H5_DLL void H5_timer_reset(H5_timer_t *timer)
Definition: H5timer.c:94
H5FD_term_package
H5_DLL int H5FD_term_package(void)
Definition: H5FD.c:148
H5CSprivate.h
H5M_top_term_package
H5_DLL int H5M_top_term_package(void)
Definition: H5M.c:145
H5M_term_package
H5_DLL int H5M_term_package(void)
Definition: H5M.c:180
H5VL_term_package
H5_DLL int H5VL_term_package(void)
Definition: H5VLint.c:259
H5_get_time
H5_DLL double H5_get_time(void)
Definition: H5system.c:1386
H5G_top_term_package
H5_DLL int H5G_top_term_package(void)
Definition: H5G.c:222
H5_checksum_crc
H5_DLL uint32_t H5_checksum_crc(const void *data, size_t len)
Definition: H5checksum.c:242
H5_PKG_S
@ H5_PKG_S
Definition: H5private.h:1745
herr_t
int herr_t
Definition: H5public.h:128
H5SL_term_package
H5_DLL int H5SL_term_package(void)
Definition: H5SL.c:645
h5_stat_t
struct stat h5_stat_t
Definition: H5private.h:926
H5_debug_t
Definition: H5private.h:1758
H5_buffer_dump
H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *marker, size_t buf_offset, size_t buf_size)
Definition: H5dbg.c:79
hbool_t
bool hbool_t
Definition: H5public.h:159
H5_debug_t::ttop
hbool_t ttop
Definition: H5private.h:1760
H5_nanosleep
H5_DLL void H5_nanosleep(uint64_t nanosec)
Definition: H5system.c:1358
H5G_term_package
H5_DLL int H5G_term_package(void)
Definition: H5G.c:261
H5_obj_t::fileno
unsigned long fileno
Definition: H5private.h:627
H5_obj_t::addr
haddr_t addr
Definition: H5private.h:628
H5P_term_package
H5_DLL int H5P_term_package(void)
Definition: H5Pint.c:550
H5_hash_string
H5_DLL uint32_t H5_hash_string(const char *str)
Definition: H5checksum.c:490
H5_NPKGS
@ H5_NPKGS
Definition: H5private.h:1750
hsize_t
hsize_t
Definition: H5overflow.txt:44
H5_combine_path
H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name)
Definition: H5system.c:1285
H5_PKG_HG
@ H5_PKG_HG
Definition: H5private.h:1737
H5_MY_PKG_INIT
#define H5_MY_PKG_INIT
Definition: H5ACmodule.h:30
H5A_term_package
H5_DLL int H5A_term_package(void)
Definition: H5A.c:218
H5_PKG_Z
@ H5_PKG_Z
Definition: H5private.h:1749
H5S_term_package
H5_DLL int H5S_term_package(void)
Definition: H5S.c:209
strdup
char * strdup(const char *s)
H5_now
H5_DLL time_t H5_now(void)
Definition: H5timer.c:254
H5_debug_open_stream_t
struct H5_debug_open_stream_t H5_debug_open_stream_t
H5_make_time
H5_DLL time_t H5_make_time(struct tm *tm)
Definition: H5system.c:709
H5R_term_package
H5_DLL int H5R_term_package(void)
Definition: H5Rint.c:243