--- ray/src/common/platform.h 2003/10/27 10:19:31 3.11 +++ ray/src/common/platform.h 2016/08/05 00:12:46 3.13 @@ -1,20 +1,51 @@ -/* RCSid $Id: platform.h,v 3.11 2003/10/27 10:19:31 schorsch Exp $ */ +/* RCSid $Id: platform.h,v 3.13 2016/08/05 00:12:46 greg Exp $ */ /* * platform.h - header file for platform specific definitions */ #ifndef _RAD_PLATFORM_H_ #define _RAD_PLATFORM_H_ -#ifdef _WIN32 +#if defined(_WIN32) || defined(_WIN64) #include /* _setmode() and stuff from unistd.h */ - typedef long off_t; - #include + typedef long off_t; + #define fdopen _fdopen + #define read _read + #define open _open + #define close _close + #define write _write + #define ftruncate _chsize_s + #define unlink _unlink + #define fileno _fileno #define snprintf _snprintf + #define vsnprintf _vsnprintf + /* XXX should we check first if size_t is 32 bit? */ + #define fseeko _fseeki64 + #define lseek _lseek + #define access _access + #define mktemp _mktemp + #include + #define strcasecmp _stricmp + #define strncasecmp _strnicmp + #define strdup _strdup + #include - #define sleep(s) Sleep(s*1000) + /* really weird defines by Microsoft in + generating lots of name collisions in Radiance. */ + #if defined(rad1) + #undef rad1 + #undef rad2 + #undef rad3 + #undef rad4 + #undef rad5 + #undef rad6 + #undef rad7 + #undef rad8 + #undef rad9 + #endif + #define sleep(s) Sleep((DWORD)((s)*1000)) #define NON_POSIX @@ -27,10 +58,11 @@ #include /* _O_BINARY, _O_TEXT */ #include /* _fmode */ #define SET_DEFAULT_BINARY() _fmode = _O_BINARY - #define SET_FILE_BINARY(fp) _setmode(fileno(fp),_O_BINARY) + #define SET_FILE_BINARY(fp) _setmode(_fileno(fp),_O_BINARY) #define SET_FD_BINARY(fd) _setmode(fd,_O_BINARY) + #define putenv _putenv -#else /* _WIN32 */ +#else /* _WIN32 || _WIN64 */ #ifdef AMIGA #define NON_POSIX @@ -48,7 +80,7 @@ #define SET_FILE_BINARY(fp) #define SET_FD_BINARY(fd) -#endif /* _WIN32 */ +#endif /* _WIN32 || _WIN64 */ #ifdef __cplusplus extern "C" {