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 HDstat(S,B)         _stati64(S,B)
00044 #define HDgetcwd(S,Z)       _getcwd(S,Z)
00045 #define HDgetdcwd(D,S,Z)    _getdcwd(D,S,Z)
00046 #define HDgetdrive()        _getdrive()
00047 #define HDlseek(F,O,W)      _lseeki64(F,O,W)
00048 #define HDmemset(X,C,Z)     memset((void*)(X),C,Z)
00049 #define HDmkdir(S,M)        _mkdir(S)
00050 #define HDopen(S,F,M)       _open(S,F|_O_BINARY,M)
00051 #define HDread(F,M,Z)       _read(F,M,Z)
00052 #define HDsetvbuf(F,S,M,Z)  setvbuf(F,S,M,(Z>1?Z:2))
00053 #define HDstrdup(S)         _strdup(S)
00054 #define HDsnprintf          _snprintf /*varargs*/
00055 #define HDtzset()           _tzset()
00056 #define HDunlink(S)         _unlink(S)
00057 #define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A)
00058 #define HDwrite(F,M,Z)      _write(F,M,Z)
00059 
00060 /* Non-POSIX functions */
00061 
00062 /* Don't use actual pthread_self on Windows because the return
00063  * type cannot be cast as a ulong like other systems. */
00064 #define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId())
00065 
00066 
00067 #endif /* _WIN32 */