00001
00014 #ifndef _WIN32_H_
00015 #define _WIN32_H_
00016
00017 # include <fcntl.h>
00018 # include <stdlib.h>
00019 # include <stdio.h>
00020 # include <string.h>
00021 # include <assert.h>
00022
00023 #if defined(WIN32)
00024 # include <io.h>
00025 # include <sys/types.h>
00026 # include <sys/stat.h>
00027 # include <windows.h>
00028 # define strcasecmp _strcmpi
00029
00030 # define snprintf _snprintf
00031 # define open _open
00032 # define close _close
00033 # define read _read
00034 # define write _write
00035 # define lseek _lseeki64
00036 # define fsync _commit
00037 # define tell _telli64
00038 # define TIMEB _timeb
00039 # define TIME_T LARGE_INTEGER
00040 # define ftime _ftime
00041 # define OPENFLAGS_WRITE _O_WRONLY|_O_CREAT|_O_BINARY|_O_TRUNC
00042 # define OPEN_PERMISSIONS _S_IREAD | _S_IWRITE
00043 # define OPENFLAGS_READ _O_RDONLY|_O_BINARY
00044 # define inline _inline
00045 #else
00046 # include <unistd.h>
00047 #include <sys/time.h>
00048 #include <time.h>
00049
00050 # define TIMEB timeb
00051 # define TIME_T struct timeval
00052 # define tell(fd) lseek(fd, 0, SEEK_CUR)
00053 # define OPENFLAGS_WRITE O_WRONLY|O_CREAT|O_TRUNC
00054 # define OPENFLAGS_READ O_RDONLY
00055 # define OPEN_PERMISSIONS S_IRUSR | S_IWUSR
00056
00057 # if __STDC_VERSION__ >= 199901L
00058
00059 # else
00060 # define inline
00061 # endif
00062 #endif
00063
00064 #if defined(WIN32) && !defined(__GNUC__)
00065 typedef __int64 int64;
00066 # define FORMAT_OFF_T "I64d"
00067 # ifndef INT64_MIN
00068 # define INT64_MIN (-9223372036854775807i64 - 1i64)
00069 # endif
00070 #else
00071 typedef long long int64;
00072 # define FORMAT_OFF_T "lld"
00073 # ifndef INT64_MIN
00074 # define INT64_MIN (-9223372036854775807LL - 1LL)
00075 # endif
00076 #endif
00077
00078 void gettime(TIME_T* time);
00079 int64 timediff(TIME_T* start, TIME_T* end);
00080 int64 timenorm(int64 cur_time);
00081
00082 #endif