H5win32defs.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * Copyright by The HDF Group.                                               *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00013  * access to either file, you may request a copy from help@hdfgroup.org.     *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 /* Programmer:  Scott Wegner
00017  *              June 3, 2008
00018  *
00019  * Purpose: This file is used to map HDF macros to Windows functions.  This
00020  *          should get included H5private mappings, so as to override them.
00021  *          Any macro not mapped here, however, will receive a similar mapping
00022  *          inside H5private.h
00023  *
00024  */
00025 
00026 #ifdef _WIN32
00027 
00028 typedef struct _stati64     h5_stat_t;
00029 typedef __int64             h5_stat_size_t;
00030 
00031 #define HDaccess(F,M)       _access(F,M)
00032 #define HDclose(F)          _close(F)
00033 #define HDdup(F)            _dup(F)
00034 #define HDfdopen(N,S)       _fdopen(N,S)
00035 #define HDfileno(F)         _fileno(F)
00036 #if _MSC_VER > 1310 /* Newer than VS.NET 2003 */
00037 #define HDftruncate(F,L)    _chsize_s(F,L)
00038 #else
00039 #define HDftruncate(F,L)    chsize(F,L)
00040 #endif
00041 #define HDfstat(F,B)        _fstati64(F,B)
00042 #define HDisatty(F)         _isatty(F)
00043 #define HDlstat(S,B)        _lstati64(S,B)
00044 #define HDstat(S,B)         _stati64(S,B)
00045 #define HDgetcwd(S,Z)       _getcwd(S,Z)
00046 #define HDgetdcwd(D,S,Z)    _getdcwd(D,S,Z)
00047 #ifndef H5_HAVE_GETTIMEOFDAY
00048     #ifdef __cplusplus
00049         extern "C" {
00050     #endif /* __cplusplus */
00051     H5_DLL int HDgettimeofday(struct timeval *tv, void *tz);
00052     #ifdef __cplusplus
00053         }
00054     #endif /* __cplusplus */
00055     #define HDgettimeofday(V,Z) HDgettimeofday(V,Z)
00056 #endif /* H5_HAVE_GETTIMEOFDAY */
00057 #define HDgetdrive()        _getdrive()
00058 #define HDlseek(F,O,W)      _lseeki64(F,O,W)
00059 #define HDmemset(X,C,Z)     memset((void*)(X),C,Z)
00060 #define HDmkdir(S,M)        _mkdir(S)
00061 #define HDopen(S,F,M)       _open(S,F|_O_BINARY,M)
00062 #define HDread(F,M,Z)       _read(F,M,Z)
00063 #define HDsetvbuf(F,S,M,Z)  setvbuf(F,S,M,(Z>1?Z:2))
00064 #define HDsleep(S)          Sleep(S*1000)
00065 #define HDstrcasecmp(A,B)   _stricmp(A,B)
00066 #define HDstrtoull(S,R,N)   _strtoui64(S,R,N)
00067 #define HDstrdup(S)         _strdup(S)
00068 #define HDsnprintf          _snprintf /*varargs*/
00069 #define HDtzset()           _tzset()
00070 #define HDunlink(S)         _unlink(S)
00071 #define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A)
00072 #define HDwrite(F,M,Z)      _write(F,M,Z)
00073 
00074 /* Non-POSIX functions */
00075 
00076 /* Don't use actual pthread_self on Windows because the return
00077  * type cannot be cast as a ulong like other systems. */
00078 #define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId())
00079 
00080 
00081 #endif /* _WIN32 */