5 |
|
#ifndef _RAD_PLATFORM_H_ |
6 |
|
#define _RAD_PLATFORM_H_ |
7 |
|
|
8 |
< |
#ifdef _WIN32 |
8 |
> |
#if defined(_WIN32) || defined(_WIN64) |
9 |
|
|
10 |
|
#include <io.h> /* _setmode() and stuff from unistd.h */ |
11 |
– |
typedef long off_t; |
12 |
– |
|
11 |
|
#include <stdio.h> |
12 |
< |
#define popen _popen |
13 |
< |
#define pclose _pclose |
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 <string.h> |
30 |
+ |
#define strcasecmp _stricmp |
31 |
+ |
#define strncasecmp _strnicmp |
32 |
+ |
#define strdup _strdup |
33 |
+ |
|
34 |
|
#include <windows.h> |
35 |
< |
#define sleep(s) Sleep(s*1000) |
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 |
|
|
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_FILE_BINARY(fp) _setmode(fileno(fp),_O_BINARY) |
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 */ |
68 |
> |
#else /* _WIN32 || _WIN64 */ |
69 |
|
|
70 |
|
#ifdef AMIGA |
71 |
|
#define NON_POSIX |
72 |
|
#else |
73 |
|
/* assumedly posix systems */ |
74 |
|
#include <unistd.h> |
42 |
– |
#define RHAS_GETPWNAM |
75 |
|
#define RHAS_STAT |
76 |
|
#define RHAS_FORK_EXEC |
77 |
|
#endif |
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 |
< |
#endif /* _WIN32 */ |
89 |
> |
#endif /* _WIN32 || _WIN64 */ |
90 |
|
|
91 |
|
#ifdef __cplusplus |
92 |
|
extern "C" { |