HDF5
1.12.0
hdf5-1.12.0
src
H5win32defs.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: Scott Wegner
15
* June 3, 2008
16
*
17
* Purpose: This file is used to map HDF macros to Windows functions. This
18
* should get included H5private mappings, so as to override them.
19
* Any macro not mapped here, however, will receive a similar mapping
20
* inside H5private.h
21
*
22
*/
23
24
/*
25
* _MSC_VER = 1900 VS2015
26
* _MSC_VER = 1800 VS2013
27
* _MSC_VER = 1700 VS2012
28
*/
29
#ifdef H5_HAVE_WIN32_API
30
31
typedef
struct
_stati64
h5_stat_t
;
32
typedef
__int64
h5_stat_size_t
;
33
34
#define HDaccess(F,M) _access(F,M)
35
#define HDchdir(S) _chdir(S)
36
#define HDclose(F) _close(F)
37
#define HDcreat(S,M) Wopen_utf8(S,O_CREAT|O_TRUNC|O_RDWR,M)
38
#define HDdup(F) _dup(F)
39
#define HDfdopen(N,S) _fdopen(N,S)
40
#define HDfileno(F) _fileno(F)
41
#define HDfstat(F,B) _fstati64(F,B)
42
#define HDisatty(F) _isatty(F)
43
44
/* The isnan function needs underscore in VS2012 and earlier */
45
#if (_MSC_VER <= 1700)
46
#define HDisnan(X) _isnan(X)
47
#endif
/* MSC_VER < 1700 */
48
49
#define HDgetcwd(S,Z) _getcwd(S,Z)
50
#define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z)
51
#define HDgetdrive() _getdrive()
52
#define HDlseek(F,O,W) _lseeki64(F,O,W)
53
#define HDlstat(S,B) _lstati64(S,B)
54
#define HDmkdir(S,M) _mkdir(S)
55
#define HDnanosleep(N, O) Wnanosleep(N, O)
56
#define HDoff_t __int64
57
58
/* Note that the variadic HDopen macro is using a VC++ extension
59
* where the comma is dropped if nothing is passed to the ellipsis.
60
*/
61
#ifndef H5_HAVE_MINGW
62
#define HDopen(S,F,...) Wopen_utf8(S,F,__VA_ARGS__)
63
#else
64
#define HDopen(S,F,...) Wopen_utf8(S,F,##__VA_ARGS__)
65
#endif
66
#define HDread(F,M,Z) _read(F,M,Z)
67
#define HDremove(S) Wremove_utf8(S)
68
#define HDrmdir(S) _rmdir(S)
69
#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
70
#define HDsleep(S) Sleep(S*1000)
71
#define HDstat(S,B) _stati64(S,B)
72
#define HDstrcasecmp(A,B) _stricmp(A,B)
73
#define HDstrdup(S) _strdup(S)
74
#define HDstrtok_r(X,Y,Z) strtok_s(X,Y,Z)
75
#define HDtzset() _tzset()
76
#define HDunlink(S) _unlink(S)
77
#define HDwrite(F,M,Z) _write(F,M,Z)
78
79
#ifdef H5_HAVE_VISUAL_STUDIO
80
81
#if (_MSC_VER < 1800)
82
#ifndef H5_HAVE_STRTOLL
83
#define HDstrtoll(S,R,N) _strtoi64(S,R,N)
84
#endif
/* H5_HAVE_STRTOLL */
85
#ifndef H5_HAVE_STRTOULL
86
#define HDstrtoull(S,R,N) _strtoui64(S,R,N)
87
#endif
/* H5_HAVE_STRTOULL */
88
/* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are
89
* just pointers into the stack in those CRTs, the usual work-around
90
* is to just define the operation as a pointer copy.
91
*/
92
#define HDva_copy(D,S) ((D) = (S))
93
#endif
/* MSC_VER < 1800 */
94
95
/*
96
* The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
97
*/
98
#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
99
100
struct
timezone {
101
int
tz_minuteswest;
102
int
tz_dsttime;
103
};
104
105
/* time.h before VS2015 does not include timespec */
106
#if (_MSC_VER < 1900)
107
struct
timespec
108
{
109
time_t tv_sec;
/* Seconds - >= 0 */
110
long
tv_nsec;
/* Nanoseconds - [0, 999999999] */
111
};
112
#endif
/* MSC_VER < 1900 */
113
114
/* The round functions do not exist in VS2012 and earlier */
115
#if (_MSC_VER <= 1700)
116
#define HDllround(V) Wllround(V)
117
#define HDllroundf(V) Wllroundf(V)
118
#define HDlround(V) Wlround(V)
119
#define HDlroundf(V) Wlroundf(V)
120
#define HDround(V) Wround(V)
121
#define HDroundf(V) Wroundf(V)
122
#endif
/* MSC_VER < 1700 */
123
124
#endif
/* H5_HAVE_VISUAL_STUDIO */
125
126
127
#ifdef __cplusplus
128
extern
"C"
{
129
#endif
/* __cplusplus */
130
H5_DLL
int
Wgettimeofday(
struct
timeval *tv,
struct
timezone *tz);
131
H5_DLL
int
Wsetenv(
const
char
*name,
const
char
*value,
int
overwrite);
132
H5_DLL
int
Wflock(
int
fd,
int
operation);
133
H5_DLL
char
* Wgetlogin(
void
);
134
H5_DLL
int
c99_snprintf(
char
* str,
size_t
size
,
const
char
* format, ...);
135
H5_DLL
int
c99_vsnprintf(
char
* str,
size_t
size
,
const
char
* format, va_list ap);
136
H5_DLL
int
Wnanosleep(
const
struct
timespec *req,
struct
timespec *rem);
137
H5_DLL
herr_t
H5_expand_windows_env_vars(
char
**env_var);
138
H5_DLL
const
wchar_t
*H5_get_utf16_str(
const
char
*s);
139
H5_DLL
int
Wopen_utf8(
const
char
*
path
,
int
oflag, ...);
140
H5_DLL
int
Wremove_utf8(
const
char
*
path
);
141
142
/* Round functions only needed for VS2012 and earlier.
143
* They are always built to ensure they don't go stale and
144
* can be deleted (along with their #defines, above) when we
145
* drop VS2012 support.
146
*/
147
H5_DLL
long
long
Wllround(
double
arg);
148
H5_DLL
long
long
Wllroundf(
float
arg);
149
H5_DLL
long
Wlround(
double
arg);
150
H5_DLL
long
Wlroundf(
float
arg);
151
H5_DLL
double
Wround(
double
arg);
152
H5_DLL
float
Wroundf(
float
arg);
153
#ifdef __cplusplus
154
}
155
#endif
/* __cplusplus */
156
157
#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
158
#define HDsetenv(N,V,O) Wsetenv(N,V,O)
159
#define HDflock(F,L) Wflock(F,L)
160
#define HDgetlogin() Wgetlogin()
161
#define HDsnprintf c99_snprintf
/*varargs*/
162
#define HDvsnprintf c99_vsnprintf
/*varargs*/
163
164
/* Non-POSIX functions */
165
166
/* Don't use actual pthread_self on Windows because the return
167
* type cannot be cast as a ulong like other systems. */
168
#define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId())
169
170
#ifndef H5_HAVE_MINGW
171
#define HDftruncate(F,L) _chsize_s(F,L)
172
#define HDfseek(F,O,W) _fseeki64(F,O,W)
173
#endif
/* H5_HAVE_MINGW */
174
175
#endif
/* H5_HAVE_WIN32_API */
176
size
iblock size
Definition:
H5EAcache.c:787
path
H5T_path_t ** path
Definition:
H5T.c:558
H5_DLL
#define H5_DLL
Definition:
H5api_adpt.h:234
h5_stat_size_t
off_t h5_stat_size_t
Definition:
H5private.h:927
herr_t
int herr_t
Definition:
H5public.h:128
h5_stat_t
struct stat h5_stat_t
Definition:
H5private.h:926
Generated by
1.8.18