ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/platform.h
(Generate patch)

Comparing ray/src/common/platform.h (file contents):
Revision 3.3 by schorsch, Sun Jun 8 12:03:09 2003 UTC vs.
Revision 3.14 by greg, Thu Aug 18 17:57:57 2016 UTC

# Line 4 | Line 4
4   */
5   #ifndef _RAD_PLATFORM_H_
6   #define _RAD_PLATFORM_H_
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
7  
8 < #include "copyright.h"
8 > #if defined(_WIN32) || defined(_WIN64)
9  
10 < #ifdef _WIN32
10 >  #include <io.h>     /* _setmode() and stuff from unistd.h */
11 >  #include <stdio.h>
12 >  typedef long off_t;
13 >  #define fdopen _fdopen
14 >  #define read _read
15 >  #define open _open
16 >  #define close _close
17 >  #define write _write
18 >  #define ftruncate _chsize_s
19 >  #define unlink _unlink
20 >  #define fileno _fileno
21 >  #define snprintf _snprintf
22 >  #define vsnprintf _vsnprintf
23 >  /* XXX should we check first if size_t is 32 bit? */
24 >  #define fseeko _fseeki64
25 >  #define lseek _lseek
26 >  #define access _access
27 >  #define mktemp _mktemp
28  
29 < #include <stdio.h>
30 < #define popen _popen
31 < #define pclose _pclose
32 < #include <fcntl.h>  /* _O_BINARY, _O_TEXT */
19 < #include <io.h>     /* _setmode() */
20 < #include <stdlib.h> /* _fmode */
29 >  #include <string.h>
30 >  #define strcasecmp _stricmp
31 >  #define strncasecmp _strnicmp
32 >  #define strdup _strdup
33  
34 < #define SET_DEFAULT_BINARY() _fmode = _O_BINARY
35 < #define SET_FILE_BINARY(fp) _setmode(fileno(fp),_O_BINARY)
36 < #define SET_FD_BINARY(fd) _setmode(fd,_O_BINARY)
34 >  #include <windows.h>
35 >  /* really weird defines by Microsoft in <resource.h>
36 >         generating lots of name collisions in Radiance. */
37 >  #if defined(rad1)
38 >    #undef rad1
39 >    #undef rad2
40 >    #undef rad3
41 >    #undef rad4
42 >    #undef rad5
43 >    #undef rad6
44 >    #undef rad7
45 >    #undef rad8
46 >    #undef rad9
47 >  #endif
48 >  #define sleep(s) Sleep((DWORD)((s)*1000))
49  
50 +  #define NON_POSIX
51  
52 +  #include <sys/types.h>
53 +  #include <sys/stat.h>
54 +  #define RHAS_STAT
55 +  #define S_IFREG _S_IFREG
56 +  #define W_IFDIR _S_IFDIR
57  
58 +  #include <fcntl.h>  /* _O_BINARY, _O_TEXT */
59 +  #include <stdlib.h> /* _fmode */
60 +  #define SET_DEFAULT_BINARY() (_fmode = _O_BINARY)
61 +  #define SET_DEFAULT_TEXT() (_fmode = _O_TEXT)
62 +  #define SET_FILE_BINARY(fp) _setmode(_fileno(fp),_O_BINARY)
63 +  #define SET_FILE_TEXT(fp) _setmode(_fileno(fp),_O_TEXT)
64 +  #define SET_FD_BINARY(fd) _setmode(fd,_O_BINARY)
65 +  #define SET_FD_TEXT(fd) _setmode(fd,_O_TEXT)
66 +  #define putenv _putenv
67  
68 + #else /* _WIN32 || _WIN64 */
69  
70 +  #ifdef AMIGA
71 +    #define NON_POSIX
72 +  #else
73 +    /* assumedly posix systems */
74 +        #include <unistd.h>
75 +    #define RHAS_STAT
76 +    #define RHAS_FORK_EXEC
77 +  #endif
78  
79 +  /* everybody except Windows */
80  
81 < #else /* _WIN32 */
81 >  /* NOPs */
82 >  #define SET_DEFAULT_BINARY()
83 >  #define SET_FILE_BINARY(fp)
84 >  #define SET_FD_BINARY(fd)
85 >  #define SET_DEFAULT_TEXT()
86 >  #define SET_FILE_TEXT(fp)
87 >  #define SET_FD_TEXT(fd)
88  
89 < /* NOPs on unix */
35 < #define SET_DEFAULT_BINARY()
36 < #define SET_FILE_BINARY(fp)
37 < #define SET_FD_BINARY(fd)
89 > #endif /* _WIN32 || _WIN64 */
90  
91 + #ifdef __cplusplus
92 + extern "C" {
93 + #endif
94  
95 <
41 <
42 <
43 <
44 <
45 < #endif /* _WIN32 */
46 <
95 > /* nothing to protect yet */
96  
97   #ifdef __cplusplus
98   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines