00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
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 OPENFLAGS_WRITE _O_WRONLY|_O_CREAT|_O_BINARY|_O_TRUNC
00041 # define OPEN_PERMISSIONS _S_IREAD | _S_IWRITE
00042 # define OPENFLAGS_READ _O_RDONLY|_O_BINARY
00043 # define inline _inline
00044 # define forceinline __forceinline
00045 #else
00046 # include <unistd.h>
00047 # include <sys/time.h>
00048 # include <sys/stat.h>
00049 # include <time.h>
00050
00051 # define TIMEB timeb
00052 # define TIME_T struct timeval
00053 # define tell(fd) lseek(fd, 0, SEEK_CUR)
00054 # define OPENFLAGS_WRITE O_WRONLY|O_CREAT|O_TRUNC
00055 # define OPENFLAGS_READ O_RDONLY
00056 # define OPEN_PERMISSIONS S_IRUSR | S_IWUSR
00057
00058 # if __STDC_VERSION__ >= 199901L
00059
00060 # else
00061 # define inline
00062 # endif
00063 # define forceinline inline
00064 #endif
00065
00066 #if defined(WIN32) && !defined(__GNUC__)
00067 typedef __int64 int64;
00068 # define FORMAT_OFF_T "I64d"
00069 # ifndef INT64_MIN
00070 # define INT64_MIN (-9223372036854775807i64 - 1i64)
00071 # endif
00072 #else
00073 typedef long long int64;
00074 # define FORMAT_OFF_T "lld"
00075 # ifndef INT64_MIN
00076 # define INT64_MIN (-9223372036854775807LL - 1LL)
00077 # endif
00078 #endif
00079
00080 void gettime(TIME_T* time);
00081 int64 timediff(TIME_T* start, TIME_T* end);
00082 int64 timenorm(int64 cur_time);
00083
00084 #endif