summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorScott Wegner <swegner@hdfgroup.org>2008-06-05 18:52:19 (GMT)
committerScott Wegner <swegner@hdfgroup.org>2008-06-05 18:52:19 (GMT)
commit532e23b808886527c6037c876ea6b203db16bcff (patch)
tree34f6a6c3e945a6ce9461a7b880f3b890c364ddd2 /src
parent92d070ab393fdd64267dfe53f55d39ef17c52257 (diff)
downloadhdf5-532e23b808886527c6037c876ea6b203db16bcff.zip
hdf5-532e23b808886527c6037c876ea6b203db16bcff.tar.gz
hdf5-532e23b808886527c6037c876ea6b203db16bcff.tar.bz2
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description: In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about. Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h. This checkin also cleans up various source files to use the HD* macros when possible. Tested: VS2005 on WinXP VS.NET on WinXP h5committest (kagiso, linew, smirom)
Diffstat (limited to 'src')
-rw-r--r--src/H5FDlog.c4
-rw-r--r--src/H5private.h1206
-rw-r--r--src/win32defs.h56
3 files changed, 880 insertions, 386 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index df07c0a..dee4581 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -628,7 +628,7 @@ H5FD_log_close(H5FD_t *_file)
if(file->fa.flags&H5FD_LOG_TIME_CLOSE)
HDgettimeofday(&timeval_start,NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
- if (close(file->fd)<0)
+ if (HDclose(file->fd)<0)
HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
#ifdef H5_HAVE_GETTIMEOFDAY
if(file->fa.flags&H5FD_LOG_TIME_CLOSE)
@@ -1331,7 +1331,7 @@ H5FD_log_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing)
if(file->eoa>file->eof) {
if(-1 == file_seek(file->fd, (file_offset_t)(file->eoa - 1), SEEK_SET))
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
- if(write(file->fd, "", (size_t)1) != 1)
+ if(HDwrite(file->fd, "", (size_t)1) != 1)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
file->eof = file->eoa;
file->pos = file->eoa;
diff --git a/src/H5private.h b/src/H5private.h
index b60c50a..b6a65f3 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -495,429 +495,867 @@ typedef struct {
* Redefine all the POSIX functions. We should never see a POSIX
* function (or any other non-HDF5 function) in the source!
*/
-#define HDabort() abort()
-#define HDabs(X) abs(X)
-#define HDaccess(F,M) access(F, M)
-#define HDacos(X) acos(X)
-#ifdef H5_HAVE_ALARM
-#define HDalarm(N) alarm(N)
-#else /* H5_HAVE_ALARM */
-#define HDalarm(N) (0)
-#endif /* H5_HAVE_ALARM */
-#define HDasctime(T) asctime(T)
-#define HDasin(X) asin(X)
-#define HDassert(X) assert(X)
-#define HDatan(X) atan(X)
-#define HDatan2(X,Y) atan2(X,Y)
-#define HDatexit(F) atexit(F)
-#define HDatof(S) atof(S)
-#define HDatoi(S) atoi(S)
-#define HDatol(S) atol(S)
-#define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P)
-#define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
-#define HDcalloc(N,Z) calloc(N,Z)
-#define HDceil(X) ceil(X)
-#define HDcfgetispeed(T) cfgetispeed(T)
-#define HDcfgetospeed(T) cfgetospeed(T)
-#define HDcfsetispeed(T,S) cfsetispeed(T,S)
-#define HDcfsetospeed(T,S) cfsetospeed(T,S)
-#define HDchdir(S) chdir(S)
-#define HDchmod(S,M) chmod(S,M)
-#define HDchown(S,O,G) chown(S,O,G)
-#define HDclearerr(F) clearerr(F)
-#define HDclock() clock()
-#define HDclose(F) close(F)
-#define HDclosedir(D) closedir(D)
-#define HDcos(X) cos(X)
-#define HDcosh(X) cosh(X)
-#define HDcreat(S,M) creat(S,M)
-#define HDctermid(S) ctermid(S)
-#define HDctime(T) ctime(T)
-#define HDcuserid(S) cuserid(S)
-#ifdef H5_HAVE_DIFFTIME
-#define HDdifftime(X,Y) difftime(X,Y)
-#else
-#define HDdifftime(X,Y) ((double)(X)-(double)(Y))
-#endif
-#define HDdiv(X,Y) div(X,Y)
-#define HDdup(F) dup(F)
-#define HDdup2(F,I) dup2(F,I)
+
+ /* Use platform-specific versions if necessary */
+#include "win32defs.h"
+
+#ifndef HDabort
+ #define HDabort() abort()
+#endif /* HDabort */
+#ifndef HDabs
+ #define HDabs(X) abs(X)
+#endif /* HDabs */
+#ifndef HDaccess
+ #define HDaccess(F,M) access(F, M)
+#endif /* HDaccess */
+#ifndef HDacos
+ #define HDacos(X) acos(X)
+#endif /* HDacos */
+#ifndef HDalarm
+ #ifdef H5_HAVE_ALARM
+ #define HDalarm(N) alarm(N)
+ #else /* H5_HAVE_ALARM */
+ #define HDalarm(N) (0)
+ #endif /* H5_HAVE_ALARM */
+#endif /* HDalarm */
+#ifndef HDasctime
+ #define HDasctime(T) asctime(T)
+#endif /* HDasctime */
+#ifndef HDasin
+ #define HDasin(X) asin(X)
+#endif /* HDasin */
+#ifndef HDassert
+ #define HDassert(X) assert(X)
+#endif /* HDassert */
+#ifndef HDatan
+ #define HDatan(X) atan(X)
+#endif /* HDatan */
+#ifndef HDatan2
+ #define HDatan2(X,Y) atan2(X,Y)
+#endif /* HDatan2 */
+#ifndef HDatexit
+ #define HDatexit(F) atexit(F)
+#endif /* HDatexit */
+#ifndef HDatof
+ #define HDatof(S) atof(S)
+#endif /* HDatof */
+#ifndef HDatoi
+ #define HDatoi(S) atoi(S)
+#endif /* HDatoi */
+#ifndef HDatol
+ #define HDatol(S) atol(S)
+#endif /* HDatol */
+#ifndef HDBSDgettimeofday
+ #define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P)
+#endif /* HDBSDgettimeofday */
+#ifndef HDbsearch
+ #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
+#endif /* HDbsearch */
+#ifndef HDcalloc
+ #define HDcalloc(N,Z) calloc(N,Z)
+#endif /* HDcalloc */
+#ifndef HDceil
+ #define HDceil(X) ceil(X)
+#endif /* HDceil */
+#ifndef HDcfgetispeed
+ #define HDcfgetispeed(T) cfgetispeed(T)
+#endif /* HDcfgetispeed */
+#ifndef HDcfgetospeed
+ #define HDcfgetospeed(T) cfgetospeed(T)
+#endif /* HDcfgetospeed */
+#ifndef HDcfsetispeed
+ #define HDcfsetispeed(T,S) cfsetispeed(T,S)
+#endif /* HDcfsetispeed */
+#ifndef HDcfsetospeed
+ #define HDcfsetospeed(T,S) cfsetospeed(T,S)
+#endif /* HDcfsetospeed */
+#ifndef HDchdir
+ #define HDchdir(S) chdir(S)
+#endif /* HDchdir */
+#ifndef HDchmod
+ #define HDchmod(S,M) chmod(S,M)
+#endif /* HDchmod */
+#ifndef HDchown
+ #define HDchown(S,O,G) chown(S,O,G)
+#endif /* HDchown */
+#ifndef HDclearerr
+ #define HDclearerr(F) clearerr(F)
+#endif /* HDclearerr */
+#ifndef HDclock
+ #define HDclock() clock()
+#endif /* HDclock */
+#ifndef HDclose
+ #define HDclose(F) close(F)
+#endif /* HDclose */
+#ifndef HDclosedir
+ #define HDclosedir(D) closedir(D)
+#endif /* HDclosedir */
+#ifndef HDcos
+ #define HDcos(X) cos(X)
+#endif /* HDcos */
+#ifndef HDcosh
+ #define HDcosh(X) cosh(X)
+#endif /* HDcosh */
+#ifndef HDcreat
+ #define HDcreat(S,M) creat(S,M)
+#endif /* HDcreat */
+#ifndef HDctermid
+ #define HDctermid(S) ctermid(S)
+#endif /* HDctermid */
+#ifndef HDctime
+ #define HDctime(T) ctime(T)
+#endif /* HDctime */
+#ifndef HDcuserid
+ #define HDcuserid(S) cuserid(S)
+#endif /* HDcuserid */
+#ifndef HDdifftime
+ #ifdef H5_HAVE_DIFFTIME
+ #define HDdifftime(X,Y) difftime(X,Y)
+ #else /* H5_HAVE_DIFFTIME */
+ #define HDdifftime(X,Y) ((double)(X)-(double)(Y))
+ #endif /* H5_HAVE_DIFFTIME */
+#endif /* HDdifftime */
+#ifndef HDdiv
+ #define HDdiv(X,Y) div(X,Y)
+#endif /* HDdiv */
+#ifndef HDdup
+ #define HDdup(F) dup(F)
+#endif /* HDdup */
+#ifndef HDdup2
+ #define HDdup2(F,I) dup2(F,I)
+#endif /* HDdup2 */
/* execl() variable arguments */
/* execle() variable arguments */
/* execlp() variable arguments */
-#define HDexecv(S,AV) execv(S,AV)
-#define HDexecve(S,AV,E) execve(S,AV,E)
-#define HDexecvp(S,AV) execvp(S,AV)
-#define HDexit(N) exit(N)
-#if defined __MWERKS__
-#include <abort_exit.h>
-#define HD_exit(N) __exit(N)
-#else /* __MWERKS __ */
-#define HD_exit(N) _exit(N)
-#endif /* __MWERKS __ */
-#define HDexp(X) exp(X)
-#define HDfabs(X) fabs(X)
+#ifndef HDexecv
+ #define HDexecv(S,AV) execv(S,AV)
+#endif /* HDexecv */
+#ifndef HDexecve
+ #define HDexecve(S,AV,E) execve(S,AV,E)
+#endif /* HDexecve */
+#ifndef HDexecvp
+ #define HDexecvp(S,AV) execvp(S,AV)
+#endif /* HDexecvp */
+#ifndef HDexit
+ #define HDexit(N) exit(N)
+#endif /* HDexit */
+#ifndef HD_exit
+ #define HD_exit(N) _exit(N)
+#endif /* HD_exit */
+#ifndef HDexp
+ #define HDexp(X) exp(X)
+#endif /* HDexp */
+#ifndef HDfabs
+ #define HDfabs(X) fabs(X)
+#endif /* HDfabs */
/* use ABS() because fabsf() fabsl() are not common yet. */
-#define HDfabsf(X) ABS(X)
-#define HDfabsl(X) ABS(X)
-#define HDfclose(F) fclose(F)
+#ifndef HDfabsf
+ #define HDfabsf(X) ABS(X)
+#endif /* HDfabsf */
+#ifndef HDfabsl
+ #define HDfabsl(X) ABS(X)
+#endif /* HDfabsl */
+#ifndef HDfclose
+ #define HDfclose(F) fclose(F)
+#endif /* HDfclose */
/* fcntl() variable arguments */
-#define HDfdopen(N,S) fdopen(N,S)
-#define HDfeof(F) feof(F)
-#define HDferror(F) ferror(F)
-#define HDfflush(F) fflush(F)
-#define HDfgetc(F) fgetc(F)
-#define HDfgetpos(F,P) fgetpos(F,P)
-#define HDfgets(S,N,F) fgets(S,N,F)
-#ifdef _WIN32
-#define HDfileno(F) _fileno(F)
-#else /* _WIN32 */
-#define HDfileno(F) fileno(F)
-#endif /* _WIN32 */
-#define HDfloor(X) floor(X)
-#define HDfmod(X,Y) fmod(X,Y)
-#define HDfopen(S,M) fopen(S,M)
-#define HDfork() fork()
-#define HDfpathconf(F,N) fpathconf(F,N)
+#ifndef HDfdopen
+ #define HDfdopen(N,S) fdopen(N,S)
+#endif /* HDfdopen */
+#ifndef HDfeof
+ #define HDfeof(F) feof(F)
+#endif /* HDfeof */
+#ifndef HDferror
+ #define HDferror(F) ferror(F)
+#endif /* HDferror */
+#ifndef HDfflush
+ #define HDfflush(F) fflush(F)
+#endif /* HDfflush */
+#ifndef HDfgetc
+ #define HDfgetc(F) fgetc(F)
+#endif /* HDfgetc */
+#ifndef HDfgetpos
+ #define HDfgetpos(F,P) fgetpos(F,P)
+#endif /* HDfgetpos */
+#ifndef HDfgets
+ #define HDfgets(S,N,F) fgets(S,N,F)
+#endif /* HDfgets */
+#ifndef HDfileno
+ #define HDfileno(F) fileno(F)
+#endif /* HDfileno */
+#ifndef HDfloor
+ #define HDfloor(X) floor(X)
+#endif /* HDfloor */
+#ifndef HDfmod
+ #define HDfmod(X,Y) fmod(X,Y)
+#endif /* HDfmod */
+#ifndef HDfopen
+ #define HDfopen(S,M) fopen(S,M)
+#endif /* HDfopen */
+#ifndef HDfork
+ #define HDfork() fork()
+#endif /* HDfork */
+#ifndef HDfpathconf
+ #define HDfpathconf(F,N) fpathconf(F,N)
+#endif /* HDfpathconf */
H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
-#define HDfputc(C,F) fputc(C,F)
-#define HDfputs(S,F) fputs(S,F)
-#define HDfread(M,Z,N,F) fread(M,Z,N,F)
-#define HDfree(M) free(M)
-#define HDfreopen(S,M,F) freopen(S,M,F)
-#define HDfrexp(X,N) frexp(X,N)
+#ifndef HDfputc
+ #define HDfputc(C,F) fputc(C,F)
+#endif /* HDfputc */
+#ifndef HDfputs
+ #define HDfputs(S,F) fputs(S,F)
+#endif /* HDfputs */
+#ifndef HDfread
+ #define HDfread(M,Z,N,F) fread(M,Z,N,F)
+#endif /* HDfread */
+#ifndef HDfree
+ #define HDfree(M) free(M)
+#endif /* HDfree */
+#ifndef HDfreopen
+ #define HDfreopen(S,M,F) freopen(S,M,F)
+#endif /* HDfreopen */
+#ifndef HDfrexp
+ #define HDfrexp(X,N) frexp(X,N)
+#endif /* HDfrexp */
/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */
-#ifdef H5_HAVE_FREXPF
-#define HDfrexpf(X,N) frexpf(X,N)
-#else /* H5_HAVE_FREXPF */
-#define HDfrexpf(X,N) frexp(X,N)
-#endif /* H5_HAVE_FREXPF */
-#ifdef H5_HAVE_FREXPL
-#define HDfrexpl(X,N) frexpl(X,N)
-#else /* H5_HAVE_FREXPL */
-#define HDfrexpl(X,N) frexp(X,N)
-#endif /* H5_HAVE_FREXPL */
+#ifndef HDfrexpf
+ #ifdef H5_HAVE_FREXPF
+ #define HDfrexpf(X,N) frexpf(X,N)
+ #else /* H5_HAVE_FREXPF */
+ #define HDfrexpf(X,N) frexp(X,N)
+ #endif /* H5_HAVE_FREXPF */
+#endif /* HDfrexpf */
+#ifndef HDfrexpl
+ #ifdef H5_HAVE_FREXPL
+ #define HDfrexpl(X,N) frexpl(X,N)
+ #else /* H5_HAVE_FREXPL */
+ #define HDfrexpl(X,N) frexp(X,N)
+ #endif /* H5_HAVE_FREXPL */
+#endif /* HDfrexpl */
/* fscanf() variable arguments */
-#ifdef H5_HAVE_FSEEKO
- #define HDfseek(F,O,W) fseeko(F,O,W)
-#else
- #define HDfseek(F,O,W) fseek(F,O,W)
-#endif
-#define HDfsetpos(F,P) fsetpos(F,P)
+#ifndef HDfseek
+ #ifdef H5_HAVE_FSEEKO
+ #define HDfseek(F,O,W) fseeko(F,O,W)
+ #else /* H5_HAVE_FSEEKO */
+ #define HDfseek(F,O,W) fseek(F,O,W)
+ #endif /* H5_HAVE_FSEEKO */
+#endif /* HDfseek */
+#ifndef HDfsetpos
+ #define HDfsetpos(F,P) fsetpos(F,P)
+#endif /* HDfsetpos */
/* definitions related to the file stat utilities.
- * Windows have its own function names.
* For Unix, if off_t is not 64bit big, try use the pseudo-standard
* xxx64 versions if available.
*/
-#ifdef _WIN32
- #ifdef __MWERKS__
- #define HDfstat(F,B) fstat(F,B)
- #define HDstat(S,B) stat(S,B)
- typedef struct stat h5_stat_t;
- typedef off_t h5_stat_size_t;
- #else /*MSVC*/
- #define HDfstat(F,B) _fstati64(F,B)
- #define HDstat(S,B) _stati64(S,B)
- typedef struct _stati64 h5_stat_t;
- typedef __int64 h5_stat_size_t;
+#if !defined(HDfstat) || !defined(HDstat)
+ #if H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64)
+ #ifndef HDfstat
+ #define HDfstat(F,B) fstat64(F,B)
+ #endif /* HDfstat */
+ #ifndef HDstat
+ #define HDstat(S,B) stat64(S,B)
+ #endif /* HDstat */
+ typedef struct stat64 h5_stat_t;
+ typedef off64_t h5_stat_size_t;
+ #else /* H5_SIZEOF_OFF_T!=8 && ... */
+ #ifndef HDfstat
+ #define HDfstat(F,B) fstat(F,B)
+ #endif /* HDfstat */
+ #ifndef HDstat
+ #define HDstat(S,B) stat(S,B)
+ #endif /* HDstat */
+ typedef struct stat h5_stat_t;
+ typedef off_t h5_stat_size_t;
+ #endif /* H5_SIZEOF_OFF_T!=8 && ... */
+#endif /* !defined(HDfstat) || !defined(HDstat) */
+
+#ifndef HDftell
+ #define HDftell(F) ftell(F)
+#endif /* HDftell */
+#ifndef HDftruncate
+ #define HDftruncate(F,L) ftruncate(F,L)
+#endif /* HDftruncate */
+#ifndef HDfwrite
+ #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
+#endif /* HDfwrite */
+#ifndef HDgetc
+ #define HDgetc(F) getc(F)
+#endif /* HDgetc */
+#ifndef HDgetchar
+ #define HDgetchar() getchar()
+#endif /* HDgetchar */
+#ifndef HDgetcwd
+ #define HDgetcwd(S,Z) getcwd(S,Z)
+#endif /* HDgetcwd */
+#ifndef HDgetdcwd
+ #define HDgetdcwd(D,S,Z) getcwd(S,Z)
+#endif /* HDgetdcwd */
+#ifndef HDgetdrive
+ #define HDgetdrive() 0
+#endif /* HDgetdrive */
+#ifndef HDgetegid
+ #define HDgetegid() getegid()
+#endif /* HDgetegid() */
+#ifndef HDgetenv
+ #define HDgetenv(S) getenv(S)
+#endif /* HDgetenv */
+#ifndef HDgeteuid
+ #define HDgeteuid() geteuid()
+#endif /* HDgeteuid */
+#ifndef HDgetgid
+ #define HDgetgid() getgid()
+#endif /* HDgetgid */
+#ifndef HDgetgrgid
+ #define HDgetgrgid(G) getgrgid(G)
+#endif /* HDgetgrgid */
+#ifndef HDgetgrnam
+ #define HDgetgrnam(S) getgrnam(S)
+#endif /* HDgetgrnam */
+#ifndef HDgetgroups
+ #define HDgetgroups(Z,G) getgroups(Z,G)
+#endif /* HDgetgroups */
+#ifndef HDgetlogin
+ #define HDgetlogin() getlogin()
+#endif /* HDgetlogin */
+#ifndef HDgetpgrp
+ #define HDgetpgrp() getpgrp()
+#endif /* HDgetpgrp */
+#ifndef HDgetpid
+ #define HDgetpid() getpid()
+#endif /* HDgetpid */
+#ifndef HDgetppid
+ #define HDgetppid() getppid()
+#endif /* HDgetppid */
+#ifndef HDgetpwnam
+ #define HDgetpwnam(S) getpwnam(S)
+#endif /* HDgetpwnam */
+#ifndef HDgetpwuid
+ #define HDgetpwuid(U) getpwuid(U)
+#endif /* HDgetpwuid */
+#ifndef HDgetrusage
+ #define HDgetrusage(X,S) getrusage(X,S)
+#endif /* HDgetrusage */
+#ifndef HDgets
+ #define HDgets(S) gets(S)
+#endif /* HDgets */
+#ifndef HDgettimeofday
+ #define HDgettimeofday(S,P) gettimeofday(S,P)
+#endif /* HDgettimeofday */
+#ifndef HDgetuid
+ #define HDgetuid() getuid()
+#endif /* HDgetuid */
+#ifndef HDgmtime
+ #define HDgmtime(T) gmtime(T)
+#endif /* HDgmtime */
+#ifndef HDisalnum
+ #define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
+#endif /* HDisalnum */
+#ifndef HDisalpha
+ #define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
+#endif /* HDisalpha */
+#ifndef HDisatty
+ #define HDisatty(F) isatty(F)
+#endif /* HDisatty */
+#ifndef HDiscntrl
+ #define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
+#endif /* HDiscntrl */
+#ifndef HDisdigit
+ #define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
+#endif /* HDisdigit */
+#ifndef HDisgraph
+ #define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
+#endif /* HDisgraph */
+#ifndef HDislower
+ #define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
+#endif /* HDislower */
+#ifndef HDisprint
+ #define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
+#endif /* HDisprint */
+#ifndef HDispunct
+ #define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
+#endif /* HDispunct */
+#ifndef HDisspace
+ #define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
+#endif /* HDisspace */
+#ifndef HDisupper
+ #define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
+#endif /* HDisupper */
+#ifndef HDisxdigit
+ #define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
+#endif /* HDisxdigit */
+#ifndef HDkill
+ #define HDkill(P,S) kill(P,S)
+#endif /* HDkill */
+#ifndef HDlabs
+ #define HDlabs(X) labs(X)
+#endif /* HDlabs */
+#ifndef HDldexp
+ #define HDldexp(X,N) ldexp(X,N)
+#endif /* HDldexp */
+#ifndef HDldiv
+ #define HDldiv(X,Y) ldiv(X,Y)
+#endif /* HDldiv */
+#ifndef HDlink
+ #define HDlink(OLD,NEW) link(OLD,NEW)
+#endif /* HDlink */
+#ifndef HDlocaleconv
+ #define HDlocaleconv() localeconv()
+#endif /* HDlocaleconv */
+#ifndef HDlocaltime
+ #define HDlocaltime(T) localtime(T)
+#endif /* HDlocaltime */
+#ifndef HDlog
+ #define HDlog(X) log(X)
+#endif /* HDlog */
+#ifndef HDlog10
+ #define HDlog10(X) log10(X)
+#endif /* HDlog10 */
+#ifndef HDlongjmp
+ #define HDlongjmp(J,N) longjmp(J,N)
+#endif /* HDlongjmp */
+#ifndef HDlseek
+ #ifdef H5_HAVE_FSEEK64
+ #define HDlseek(F,O,W) lseek64(F,O,W)
+ #else
+ #define HDlseek(F,O,W) lseek(F,O,W)
#endif
-#elif H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64)
- #define HDfstat(F,B) fstat64(F,B)
- #define HDstat(S,B) stat64(S,B)
- typedef struct stat64 h5_stat_t;
- typedef off64_t h5_stat_size_t;
-#else
- #define HDfstat(F,B) fstat(F,B)
- #define HDstat(S,B) stat(S,B)
- typedef struct stat h5_stat_t;
- typedef off_t h5_stat_size_t;
-#endif
-
-#define HDftell(F) ftell(F)
-#define HDftruncate(F,L) ftruncate(F,L)
-#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
-#define HDgetc(F) getc(F)
-#define HDgetchar() getchar()
-#ifdef _WIN32
-#define HDgetcwd(S,Z) _getcwd(S,Z)
-#define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z)
-#define HDgetdrive() _getdrive()
-#else
-#define HDgetcwd(S,Z) getcwd(S,Z)
-#define HDgetdcwd(D,S,Z) getcwd(S,Z)
-#define HDgetdrive() 0
-#endif
-#define HDgetegid() getegid()
-#define HDgetenv(S) getenv(S)
-#define HDgeteuid() geteuid()
-#define HDgetgid() getgid()
-#define HDgetgrgid(G) getgrgid(G)
-#define HDgetgrnam(S) getgrnam(S)
-#define HDgetgroups(Z,G) getgroups(Z,G)
-#define HDgetlogin() getlogin()
-#define HDgetpgrp() getpgrp()
-#define HDgetpid() getpid()
-#define HDgetppid() getppid()
-#define HDgetpwnam(S) getpwnam(S)
-#define HDgetpwuid(U) getpwuid(U)
-#define HDgetrusage(X,S) getrusage(X,S)
-#define HDgets(S) gets(S)
-#define HDgettimeofday(S,P) gettimeofday(S,P)
-#define HDgetuid() getuid()
-#define HDgmtime(T) gmtime(T)
-#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
-#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
-#define HDisatty(F) isatty(F)
-#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
-#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
-#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
-#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
-#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
-#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
-#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
-#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
-#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
-#define HDkill(P,S) kill(P,S)
-#define HDlabs(X) labs(X)
-#define HDldexp(X,N) ldexp(X,N)
-#define HDldiv(X,Y) ldiv(X,Y)
-#define HDlink(OLD,NEW) link(OLD,NEW)
-#define HDlocaleconv() localeconv()
-#define HDlocaltime(T) localtime(T)
-#define HDlog(X) log(X)
-#define HDlog10(X) log10(X)
-#define HDlongjmp(J,N) longjmp(J,N)
-#ifdef _WIN32
- #ifdef __MWERKS__
- #define HDlseek(F,O,W) lseek(F,O,W)
- #else /*MSVS */
- #define HDlseek(F,O,W) _lseeki64(F,O,W)
- #endif
-#else
- #ifdef H5_HAVE_FSEEK64
- #define HDlseek(F,O,W) lseek64(F,O,W)
- #else
- #define HDlseek(F,O,W) lseek(F,O,W)
- #endif
-#endif
-#define HDmalloc(Z) malloc(Z)
-#define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z)
-#define HDmblen(S,N) mblen(S,N)
-#define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z)
-#define HDmbtowc(P,S,Z) mbtowc(P,S,Z)
-#define HDmemchr(S,C,Z) memchr(S,C,Z)
-#define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
+#endif /* HDlseek */
+#ifndef HDmalloc
+ #define HDmalloc(Z) malloc(Z)
+#endif /* HDmalloc */
+#ifndef HDposix_memalign
+ #define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z)
+#endif /* HDposix_memalign */
+#ifndef HDmblen
+ #define HDmblen(S,N) mblen(S,N)
+#endif /* HDmblen */
+#ifndef HDmbstowcs
+ #define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z)
+#endif /* HDmbstowcs */
+#ifndef HDmbtowc
+ #define HDmbtowc(P,S,Z) mbtowc(P,S,Z)
+#endif /* HDmbtowc */
+#ifndef HDmemchr
+ #define HDmemchr(S,C,Z) memchr(S,C,Z)
+#endif /* HDmemchr */
+#ifndef HDmemcmp
+ #define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
+#endif /* HDmemcmp */
/*
* The (char*) casts are required for the DEC when optimizations are turned
* on and the source and/or destination are not aligned.
*/
-#define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
-#define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
-/*
- * The (void*) cast just avoids a compiler warning in _WIN32
- */
-#ifdef _WIN32
-#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
-#else /* _WIN32 */
-#define HDmemset(X,C,Z) memset(X,C,Z)
-#endif /* _WIN32 */
-#ifdef _WIN32
-#define HDmkdir(S,M) _mkdir(S)
-#else /* _WIN32 */
-#define HDmkdir(S,M) mkdir(S,M)
-#endif /* _WIN32 */
-#define HDmkfifo(S,M) mkfifo(S,M)
-#define HDmktime(T) mktime(T)
-#define HDmodf(X,Y) modf(X,Y)
-#ifdef _O_BINARY
-#define HDopen(S,F,M) open(S,F|_O_BINARY,M)
-#else
-#define HDopen(S,F,M) open(S,F,M)
-#endif
-#define HDopendir(S) opendir(S)
-#define HDpathconf(S,N) pathconf(S,N)
-#define HDpause() pause()
-#define HDperror(S) perror(S)
-#define HDpipe(F) pipe(F)
-#define HDpow(X,Y) pow(X,Y)
+#ifndef HDmemcpy
+ #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
+#endif /* HDmemcpy */
+#ifndef HDmemmove
+ #define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
+#endif /* HDmemmove */
+#ifndef HDmemset
+ #define HDmemset(X,C,Z) memset(X,C,Z)
+#endif /* HDmemset */
+#ifndef HDmkdir
+ #define HDmkdir(S,M) mkdir(S,M)
+#endif /* HDmkdir */
+#ifndef HDmkfifo
+ #define HDmkfifo(S,M) mkfifo(S,M)
+#endif /* HDmkfifo */
+#ifndef HDmktime
+ #define HDmktime(T) mktime(T)
+#endif /* HDmktime */
+#ifndef HDmodf
+ #define HDmodf(X,Y) modf(X,Y)
+#endif /* HDmodf */
+#ifndef HDopen
+ #ifdef _O_BINARY
+ #define HDopen(S,F,M) open(S,F|_O_BINARY,M)
+ #else
+ #define HDopen(S,F,M) open(S,F,M)
+ #endif
+#endif /* HDopen */
+#ifndef HDopendir
+ #define HDopendir(S) opendir(S)
+#endif /* HDopendir */
+#ifndef HDpathconf
+ #define HDpathconf(S,N) pathconf(S,N)
+#endif /* HDpathconf */
+#ifndef HDpause
+ #define HDpause() pause()
+#endif /* HDpause */
+#ifndef HDperror
+ #define HDperror(S) perror(S)
+#endif /* HDperror */
+#ifndef HDpipe
+ #define HDpipe(F) pipe(F)
+#endif /* HDpipe */
+#ifndef HDpow
+ #define HDpow(X,Y) pow(X,Y)
+#endif /* HDpow */
/* printf() variable arguments */
-#define HDputc(C,F) putc(C,F)
-#define HDputchar(C) putchar(C)
-#define HDputs(S) puts(S)
-#define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
-#define HDraise(N) raise(N)
+#ifndef HDputc
+ #define HDputc(C,F) putc(C,F)
+#endif /* HDputc*/
+#ifndef HDputchar
+ #define HDputchar(C) putchar(C)
+#endif /* HDputchar */
+#ifndef HDputs
+ #define HDputs(S) puts(S)
+#endif /* HDputs */
+#ifndef HDqsort
+ #define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
+#endif /* HDqsort*/
+#ifndef HDraise
+ #define HDraise(N) raise(N)
+#endif /* HDraise */
#ifdef H5_HAVE_RAND_R
-#define HDrandom() HDrand()
-H5_DLL int HDrand(void);
+ #ifndef HDrandom
+ #define HDrandom() HDrand()
+ #endif /* HDrandom */
+ H5_DLL int HDrand(void);
#elif H5_HAVE_RANDOM
-#define HDrand() random()
-#define HDrandom() random()
-#else
-#define HDrand() rand()
-#define HDrandom() rand()
-#endif
-
-#define HDread(F,M,Z) read(F,M,Z)
-#define HDreaddir(D) readdir(D)
-#define HDrealloc(M,Z) realloc(M,Z)
+ #ifndef HDrand
+ #define HDrand() random()
+ #endif /* HDrand */
+ #ifndef HDrandom
+ #define HDrandom() random()
+ #endif /* HDrandom */
+#else /* H5_HAVE_RANDOM */
+ #ifndef HDrand
+ #define HDrand() rand()
+ #endif /* HDrand */
+ #ifndef HDrandom
+ #define HDrandom() rand()
+ #endif /* HDrandom */
+#endif /* H5_HAVE_RANDOM */
+
+#ifndef HDread
+ #define HDread(F,M,Z) read(F,M,Z)
+#endif /* HDread */
+#ifndef HDreaddir
+ #define HDreaddir(D) readdir(D)
+#endif /* HDreaddir */
+#ifndef HDrealloc
+ #define HDrealloc(M,Z) realloc(M,Z)
+#endif /* HDrealloc */
#ifdef H5_VMS
-#ifdef __cplusplus
-extern "C" {
-#endif
-int HDremove_all(const char * fname);
-#ifdef __cplusplus
-}
-#endif
-#define HDremove(S) HDremove_all(S)
-#else
-#define HDremove(S) remove(S)
+ #ifdef __cplusplus
+ extern "C" {
+ #endif /* __cplusplus */
+ int HDremove_all(const char * fname);
+ #ifdef __cplusplus
+ }
+ #endif /* __cplusplus */
+ #ifndef HDremove
+ #define HDremove(S) HDremove_all(S)
+ #endif /* HDremove */
+#else /* H5_VMS */
+ #ifndef HDremove
+ #define HDremove(S) remove(S)
+ #endif /* HDremove */
#endif /*H5_VMS*/
-#define HDrename(OLD,NEW) rename(OLD,NEW)
-#define HDrewind(F) rewind(F)
-#define HDrewinddir(D) rewinddir(D)
-#define HDrmdir(S) rmdir(S)
+#ifndef HDrename
+ #define HDrename(OLD,NEW) rename(OLD,NEW)
+#endif /* HDrename */
+#ifndef HDrewind
+ #define HDrewind(F) rewind(F)
+#endif /* HDrewind */
+#ifndef HDrewinddir
+ #define HDrewinddir(D) rewinddir(D)
+#endif /* HDrewinddir */
+#ifndef HDrmdir
+ #define HDrmdir(S) rmdir(S)
+#endif /* HDrmdir */
/* scanf() variable arguments */
-#define HDsetbuf(F,S) setbuf(F,S)
-#define HDsetgid(G) setgid(G)
-#define HDsetjmp(J) setjmp(J)
-#define HDsetlocale(N,S) setlocale(N,S)
-#define HDsetpgid(P,PG) setpgid(P,PG)
-#define HDsetsid() setsid()
-#define HDsetuid(U) setuid(U)
-/* Windows does not permit setting the buffer size to values
- less than 2. */
-#ifndef _WIN32
-#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z)
-#else
-#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
-#endif
-#define HDsigaction(N,A) sigaction(N,A)
-#define HDsigaddset(S,N) sigaddset(S,N)
-#define HDsigdelset(S,N) sigdelset(S,N)
-#define HDsigemptyset(S) sigemptyset(S)
-#define HDsigfillset(S) sigfillset(S)
-#define HDsigismember(S,N) sigismember(S,N)
-#define HDsiglongjmp(J,N) siglongjmp(J,N)
-#define HDsignal(N,F) signal(N,F)
-#define HDsigpending(S) sigpending(S)
-#define HDsigprocmask(H,S,O) sigprocmask(H,S,O)
-#define HDsigsetjmp(J,N) sigsetjmp(J,N)
-#define HDsigsuspend(S) sigsuspend(S)
-#define HDsin(X) sin(X)
-#define HDsinh(X) sinh(X)
-#define HDsleep(N) sleep(N)
-#ifdef _WIN32
-#define HDsnprintf _snprintf /*varargs*/
-#else
-#define HDsnprintf snprintf /*varargs*/
-#endif
+#ifndef HDsetbuf
+ #define HDsetbuf(F,S) setbuf(F,S)
+#endif /* HDsetbuf */
+#ifndef HDsetgid
+ #define HDsetgid(G) setgid(G)
+#endif /* HDsetgid */
+#ifndef HDsetjmp
+ #define HDsetjmp(J) setjmp(J)
+#endif /* HDsetjmp */
+#ifndef HDsetlocale
+ #define HDsetlocale(N,S) setlocale(N,S)
+#endif /* HDsetlocale */
+#ifndef HDsetpgid
+ #define HDsetpgid(P,PG) setpgid(P,PG)
+#endif /* HDsetpgid */
+#ifndef HDsetsid
+ #define HDsetsid() setsid()
+#endif /* HDsetsid */
+#ifndef HDsetuid
+ #define HDsetuid(U) setuid(U)
+#endif /* HDsetuid */
+#ifndef HDsetvbuf
+ #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z)
+#endif /* HDsetvbuf */
+#ifndef HDsigaction
+ #define HDsigaction(N,A) sigaction(N,A)
+#endif /* HDsigaction */
+#ifndef HDsigaddset
+ #define HDsigaddset(S,N) sigaddset(S,N)
+#endif /* HDsigaddset */
+#ifndef HDsigdelset
+ #define HDsigdelset(S,N) sigdelset(S,N)
+#endif /* HDsigdelset */
+#ifndef HDsigemptyset
+ #define HDsigemptyset(S) sigemptyset(S)
+#endif /* HDsigemptyset */
+#ifndef HDsigfillset
+ #define HDsigfillset(S) sigfillset(S)
+#endif /* HDsigfillset */
+#ifndef HDsigismember
+ #define HDsigismember(S,N) sigismember(S,N)
+#endif /* HDsigismember */
+#ifndef HDsiglongjmp
+ #define HDsiglongjmp(J,N) siglongjmp(J,N)
+#endif /* HDsiglongjmp */
+#ifndef HDsignal
+ #define HDsignal(N,F) signal(N,F)
+#endif /* HDsignal */
+#ifndef HDsigpending
+ #define HDsigpending(S) sigpending(S)
+#endif /* HDsigpending */
+#ifndef HDsigprocmask
+ #define HDsigprocmask(H,S,O) sigprocmask(H,S,O)
+#endif /* HDsigprocmask */
+#ifndef HDsigsetjmp
+ #define HDsigsetjmp(J,N) sigsetjmp(J,N)
+#endif /* HDsigsetjmp */
+#ifndef HDsigsuspend
+ #define HDsigsuspend(S) sigsuspend(S)
+#endif /* HDsigsuspend */
+#ifndef HDsin
+ #define HDsin(X) sin(X)
+#endif /* HDsin */
+#ifndef HDsinh
+ #define HDsinh(X) sinh(X)
+#endif /* HDsinh */
+#ifndef HDsleep
+ #define HDsleep(N) sleep(N)
+#endif /* HDsleep */
+#ifndef HDsnprintf
+ #define HDsnprintf snprintf /*varargs*/
+#endif /* HDsnprintf */
/* sprintf() variable arguments */
-#define HDsqrt(X) sqrt(X)
+#ifndef HDsqrt
+ #define HDsqrt(X) sqrt(X)
+#endif /* HDsqrt */
#ifdef H5_HAVE_RAND_R
-H5_DLL void HDsrand(unsigned int seed);
-#define HDsrandom(S) HDsrand(S)
-#elif H5_HAVE_RANDOM
-#define HDsrand(S) srandom(S)
-#define HDsrandom(S) srandom(S)
-#else
-#define HDsrand(S) srand(S)
-#define HDsrandom(S) srand(S)
-#endif
+ H5_DLL void HDsrand(unsigned int seed);
+ #ifndef HDsrandom
+ #define HDsrandom(S) HDsrand(S)
+ #endif /* HDsrandom */
+ #elif H5_HAVE_RANDOM
+ #ifndef HDsrand
+ #define HDsrand(S) srandom(S)
+ #endif /* HDsrand */
+ #ifndef HDsrandom
+ #define HDsrandom(S) srandom(S)
+ #endif /* HDsrandom */
+#else /* H5_HAVE_RAND_R */
+ #ifndef HDsrand
+ #define HDsrand(S) srand(S)
+ #endif /* HDsrand */
+ #ifndef HDsrandom
+ #define HDsrandom(S) srand(S)
+ #endif /* HDsrandom */
+#endif /* H5_HAVE_RAND_R */
/* sscanf() variable arguments */
-#define HDstrcat(X,Y) strcat(X,Y)
-#define HDstrchr(S,C) strchr(S,C)
-#define HDstrcmp(X,Y) strcmp(X,Y)
-#define HDstrcoll(X,Y) strcoll(X,Y)
-#define HDstrcpy(X,Y) strcpy(X,Y)
-#define HDstrcspn(X,Y) strcspn(X,Y)
-#define HDstrerror(N) strerror(N)
-#define HDstrftime(S,Z,F,T) strftime(S,Z,F,T)
-#define HDstrlen(S) strlen(S)
-#define HDstrncat(X,Y,Z) strncat(X,Y,Z)
-#define HDstrncmp(X,Y,Z) strncmp(X,Y,Z)
-#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z)
-#define HDstrpbrk(X,Y) strpbrk(X,Y)
-#define HDstrrchr(S,C) strrchr(S,C)
-#define HDstrspn(X,Y) strspn(X,Y)
-#define HDstrstr(X,Y) strstr(X,Y)
-#define HDstrtod(S,R) strtod(S,R)
-#define HDstrtok(X,Y) strtok(X,Y)
-#define HDstrtol(S,R,N) strtol(S,R,N)
+#ifndef HDstrcat
+ #define HDstrcat(X,Y) strcat(X,Y)
+#endif /* HDstrcat */
+#ifndef HDstrchr
+ #define HDstrchr(S,C) strchr(S,C)
+#endif /* HDstrchr */
+#ifndef HDstrcmp
+ #define HDstrcmp(X,Y) strcmp(X,Y)
+#endif /* HDstrcmp */
+#ifndef HDstrcoll
+ #define HDstrcoll(X,Y) strcoll(X,Y)
+#endif /* HDstrcoll */
+#ifndef HDstrcpy
+ #define HDstrcpy(X,Y) strcpy(X,Y)
+#endif /* HDstrcpy */
+#ifndef HDstrcspn
+ #define HDstrcspn(X,Y) strcspn(X,Y)
+#endif /* HDstrcspn */
+#ifndef HDstrerror
+ #define HDstrerror(N) strerror(N)
+#endif /* HDstrerror */
+#ifndef HDstrftime
+ #define HDstrftime(S,Z,F,T) strftime(S,Z,F,T)
+#endif /* HDstrftime */
+#ifndef HDstrlen
+ #define HDstrlen(S) strlen(S)
+#endif /* HDstrlen */
+#ifndef HDstrncat
+ #define HDstrncat(X,Y,Z) strncat(X,Y,Z)
+#endif /* HDstrncat */
+#ifndef HDstrncmp
+ #define HDstrncmp(X,Y,Z) strncmp(X,Y,Z)
+#endif /* HDstrncmp */
+#ifndef HDstrncpy
+ #define HDstrncpy(X,Y,Z) strncpy(X,Y,Z)
+#endif /* HDstrncpy */
+#ifndef HDstrpbrk
+ #define HDstrpbrk(X,Y) strpbrk(X,Y)
+#endif /* HDstrpbrk */
+#ifndef HDstrrchr
+ #define HDstrrchr(S,C) strrchr(S,C)
+#endif /* HDstrrchr */
+#ifndef HDstrspn
+ #define HDstrspn(X,Y) strspn(X,Y)
+#endif /* HDstrspn */
+#ifndef HDstrstr
+ #define HDstrstr(X,Y) strstr(X,Y)
+#endif /* HDstrstr */
+#ifndef HDstrtod
+ #define HDstrtod(S,R) strtod(S,R)
+#endif /* HDstrtod */
+#ifndef HDstrtok
+ #define HDstrtok(X,Y) strtok(X,Y)
+#endif /* HDstrtok */
+#ifndef HDstrtol
+ #define HDstrtol(S,R,N) strtol(S,R,N)
+#endif /* HDstrtol */
H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
-#define HDstrtoul(S,R,N) strtoul(S,R,N)
-#define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z)
-#define HDsysconf(N) sysconf(N)
-#define HDsystem(S) system(S)
-#define HDtan(X) tan(X)
-#define HDtanh(X) tanh(X)
-#define HDtcdrain(F) tcdrain(F)
-#define HDtcflow(F,A) tcflow(F,A)
-#define HDtcflush(F,N) tcflush(F,N)
-#define HDtcgetattr(F,T) tcgetattr(F,T)
-#define HDtcgetpgrp(F) tcgetpgrp(F)
-#define HDtcsendbreak(F,N) tcsendbreak(F,N)
-#define HDtcsetattr(F,O,T) tcsetattr(F,O,T)
-#define HDtcsetpgrp(F,N) tcsetpgrp(F,N)
-#define HDtime(T) time(T)
-#define HDtimes(T) times(T)
-#define HDtmpfile() tmpfile()
-#define HDtmpnam(S) tmpnam(S)
-#define HDtolower(C) tolower(C)
-#define HDtoupper(C) toupper(C)
-#define HDttyname(F) ttyname(F)
-#define HDtzset() tzset()
-#define HDumask(N) umask(N)
-#define HDuname(S) uname(S)
-#define HDungetc(C,F) ungetc(C,F)
-#ifdef _WIN32
-#define HDunlink(S) _unlink(S)
-#else
-#define HDunlink(S) unlink(S)
-#endif
-#define HDutime(S,T) utime(S,T)
-#define HDva_arg(A,T) va_arg(A,T)
-#define HDva_end(A) va_end(A)
-#define HDva_start(A,P) va_start(A,P)
-#define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A)
-#define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A)
-#define HDvprintf(FMT,A) vprintf(FMT,A)
-#define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
-#ifdef _WIN32
-# define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A)
-#else
-# define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
-#endif
-#define HDwait(W) wait(W)
-#define HDwaitpid(P,W,O) waitpid(P,W,O)
-#define HDwcstombs(S,P,Z) wcstombs(S,P,Z)
-#define HDwctomb(S,C) wctomb(S,C)
-
-#if defined (__MWERKS__)
-/* workaround for a bug in the Metrowerks version 6.0 header file for write
- which is not defined as const void*
- */
-#define HDwrite(F,M,Z) write(F,(void*)M,Z)
-#else
-#define HDwrite(F,M,Z) write(F,M,Z)
-#endif
+#ifndef HDstrtoul
+ #define HDstrtoul(S,R,N) strtoul(S,R,N)
+#endif /* HDstrtoul */
+#ifndef HDstrxfrm
+ #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z)
+#endif /* HDstrxfrm */
+#ifndef HDsysconf
+ #define HDsysconf(N) sysconf(N)
+#endif /* HDsysconf */
+#ifndef HDsystem
+ #define HDsystem(S) system(S)
+#endif /* HDsystem */
+#ifndef HDtan
+ #define HDtan(X) tan(X)
+#endif /* HDtan */
+#ifndef HDtanh
+ #define HDtanh(X) tanh(X)
+#endif /* HDtanh */
+#ifndef HDtcdrain
+ #define HDtcdrain(F) tcdrain(F)
+#endif /* HDtcdrain */
+#ifndef HDtcflow
+ #define HDtcflow(F,A) tcflow(F,A)
+#endif /* HDtcflow */
+#ifndef HDtcflush
+ #define HDtcflush(F,N) tcflush(F,N)
+#endif /* HDtcflush */
+#ifndef HDtcgetattr
+ #define HDtcgetattr(F,T) tcgetattr(F,T)
+#endif /* HDtcgetattr */
+#ifndef HDtcgetpgrp
+ #define HDtcgetpgrp(F) tcgetpgrp(F)
+#endif /* HDtcgetpgrp */
+#ifndef HDtcsendbreak
+ #define HDtcsendbreak(F,N) tcsendbreak(F,N)
+#endif /* HDtcsendbreak */
+#ifndef HDtcsetattr
+ #define HDtcsetattr(F,O,T) tcsetattr(F,O,T)
+#endif /* HDtcsetattr */
+#ifndef HDtcsetpgrp
+ #define HDtcsetpgrp(F,N) tcsetpgrp(F,N)
+#endif /* HDtcsetpgrp */
+#ifndef HDtime
+ #define HDtime(T) time(T)
+#endif /* HDtime */
+#ifndef HDtimes
+ #define HDtimes(T) times(T)
+#endif /* HDtimes*/
+#ifndef HDtmpfile
+ #define HDtmpfile() tmpfile()
+#endif /* HDtmpfile */
+#ifndef HDtmpnam
+ #define HDtmpnam(S) tmpnam(S)
+#endif /* HDtmpnam */
+#ifndef HDtolower
+ #define HDtolower(C) tolower(C)
+#endif /* HDtolower */
+#ifndef HDtoupper
+ #define HDtoupper(C) toupper(C)
+#endif /* HDtoupper */
+#ifndef HDttyname
+ #define HDttyname(F) ttyname(F)
+#endif /* HDttyname */
+#ifndef HDtzset
+ #define HDtzset() tzset()
+#endif /* HDtzset */
+#ifndef HDumask
+ #define HDumask(N) umask(N)
+#endif /* HDumask */
+#ifndef HDuname
+ #define HDuname(S) uname(S)
+#endif /* HDuname */
+#ifndef HDungetc
+ #define HDungetc(C,F) ungetc(C,F)
+#endif /* HDungetc */
+#ifndef HDunlink
+ #define HDunlink(S) unlink(S)
+#endif /* HDunlink */
+#ifndef HDutime
+ #define HDutime(S,T) utime(S,T)
+#endif /* HDutime */
+#ifndef HDva_arg
+ #define HDva_arg(A,T) va_arg(A,T)
+#endif /* HDva_arg */
+#ifndef HDva_end
+ #define HDva_end(A) va_end(A)
+#endif /* HDva_end */
+#ifndef HDva_start
+ #define HDva_start(A,P) va_start(A,P)
+#endif /* HDva_start */
+#ifndef HDvasprintf
+ #define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A)
+#endif /* HDvasprintf */
+#ifndef HDvfprintf
+ #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A)
+#endif /* HDvfprintf */
+#ifndef HDvprintf
+ #define HDvprintf(FMT,A) vprintf(FMT,A)
+#endif /* HDvprintf */
+#ifndef HDvsprintf
+ #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
+#endif /* HDvsprintf */
+#ifndef HDvsnprintf
+ #define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
+#endif /* HDvsnprintf */
+#ifndef HDwait
+ #define HDwait(W) wait(W)
+#endif /* HDwait */
+#ifndef HDwaitpid
+ #define HDwaitpid(P,W,O) waitpid(P,W,O)
+#endif /* HDwaitpid */
+#ifndef HDwcstombs
+ #define HDwcstombs(S,P,Z) wcstombs(S,P,Z)
+#endif /* HDwcstombs */
+#ifndef HDwctomb
+ #define HDwctomb(S,C) wctomb(S,C)
+#endif /* HDwctomb */
+#ifndef HDwrite
+ #define HDwrite(F,M,Z) write(F,M,Z)
+#endif /* HDwrite */
/*
* And now for a couple non-Posix functions... Watch out for systems that
* define these in terms of macros.
*/
-#ifdef _WIN32
-#define HDstrdup(S) _strdup(S)
-#else /* _WIN32 */
-
#if !defined strdup && !defined H5_HAVE_STRDUP
extern char *strdup(const char *s);
#endif
-#define HDstrdup(S) strdup(S)
+#ifndef HDstrdup
+ #define HDstrdup(S) strdup(S)
+#endif /* HDstrdup */
-#endif /* _WIN32 */
#ifdef H5_HAVE_WINDOW_PATH
diff --git a/src/win32defs.h b/src/win32defs.h
new file mode 100644
index 0000000..484b73d
--- /dev/null
+++ b/src/win32defs.h
@@ -0,0 +1,56 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Programmer: Scott Wegner
+ * June 3, 2008
+ *
+ * Purpose: This file is used to map HDF macros to Windows functions. This
+ * should get included H5private mappings, so as to override them.
+ * Any macro not mapped here, however, will receive a similar mapping
+ * inside H5private.h
+ *
+ */
+
+#ifdef _WIN32
+
+typedef struct _stati64 h5_stat_t;
+typedef __int64 h5_stat_size_t;
+
+#define HDaccess(F,M) _access(F,M)
+#define HDclose(F) _close(F)
+#define HDdup(F) _dup(F)
+#define HDfdopen(N,S) _fdopen(N,S)
+#define HDfileno(F) _fileno(F)
+#define HDfstat(F,B) _fstati64(F,B)
+#define HDisatty(F) _isatty(F)
+#define HDstat(S,B) _stati64(S,B)
+#define HDgetcwd(S,Z) _getcwd(S,Z)
+#define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z)
+#define HDgetdrive() _getdrive()
+#define HDlseek(F,O,W) _lseeki64(F,O,W)
+#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
+#define HDmkdir(S,M) _mkdir(S)
+#define HDopen(S,F,M) _open(S,F|_O_BINARY,M)
+#define HDread(F,M,Z) _read(F,M,Z)
+#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
+#define HDstrdup(S) _strdup(S)
+#define HDsnprintf _snprintf /*varargs*/
+#define HDtzset() _tzset()
+#define HDunlink(S) _unlink(S)
+#define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A)
+#define HDwrite(F,M,Z) _write(F,M,Z)
+
+
+#endif /* _WIN32 */