4 |
|
*/ |
5 |
|
#ifndef _RAD_PLATFORM_H_ |
6 |
|
#define _RAD_PLATFORM_H_ |
7 |
– |
#ifdef __cplusplus |
8 |
– |
extern "C" { |
9 |
– |
#endif |
7 |
|
|
8 |
|
#ifdef _WIN32 |
9 |
|
|
10 |
< |
#include <stdio.h> |
11 |
< |
#define popen _popen |
15 |
< |
#define pclose _pclose |
16 |
< |
#include <fcntl.h> /* _O_BINARY, _O_TEXT */ |
17 |
< |
#include <io.h> /* _setmode() */ |
18 |
< |
#include <stdlib.h> /* _fmode */ |
10 |
> |
#include <io.h> /* _setmode() and stuff from unistd.h */ |
11 |
> |
typedef long off_t; |
12 |
|
|
13 |
< |
#define SET_DEFAULT_BINARY() _fmode = _O_BINARY |
14 |
< |
#define SET_FILE_BINARY(fp) _setmode(fileno(fp),_O_BINARY) |
15 |
< |
#define SET_FD_BINARY(fd) _setmode(fd,_O_BINARY) |
13 |
> |
#include <stdio.h> |
14 |
> |
#define popen _popen |
15 |
> |
#define pclose _pclose |
16 |
|
|
17 |
+ |
#include <windows.h> |
18 |
+ |
#define sleep(s) Sleep(s*1000) |
19 |
|
|
20 |
+ |
#define NON_POSIX |
21 |
|
|
22 |
+ |
#include <sys/types.h> |
23 |
+ |
#include <sys/stat.h> |
24 |
+ |
#define RHAS_STAT |
25 |
+ |
#define S_IFREG _S_IFREG |
26 |
+ |
#define W_IFDIR _S_IFDIR |
27 |
|
|
28 |
+ |
#include <fcntl.h> /* _O_BINARY, _O_TEXT */ |
29 |
+ |
#include <stdlib.h> /* _fmode */ |
30 |
+ |
#define SET_DEFAULT_BINARY() _fmode = _O_BINARY |
31 |
+ |
#define SET_FILE_BINARY(fp) _setmode(fileno(fp),_O_BINARY) |
32 |
+ |
#define SET_FD_BINARY(fd) _setmode(fd,_O_BINARY) |
33 |
|
|
28 |
– |
|
29 |
– |
|
34 |
|
#else /* _WIN32 */ |
35 |
|
|
36 |
< |
/* NOPs on unix */ |
37 |
< |
#define SET_DEFAULT_BINARY() |
38 |
< |
#define SET_FILE_BINARY(fp) |
39 |
< |
#define SET_FD_BINARY(fd) |
36 |
> |
#ifdef AMIGA |
37 |
> |
#define NON_POSIX |
38 |
> |
#else |
39 |
> |
/* assumedly posix systems */ |
40 |
> |
#include <unistd.h> |
41 |
> |
#define RHAS_GETPWNAM |
42 |
> |
#define RHAS_STAT |
43 |
> |
#define RHAS_FORK_EXEC |
44 |
> |
#endif |
45 |
|
|
46 |
+ |
/* everybody except Windows */ |
47 |
|
|
48 |
+ |
/* NOPs */ |
49 |
+ |
#define SET_DEFAULT_BINARY() |
50 |
+ |
#define SET_FILE_BINARY(fp) |
51 |
+ |
#define SET_FD_BINARY(fd) |
52 |
|
|
39 |
– |
|
40 |
– |
|
41 |
– |
|
42 |
– |
|
53 |
|
#endif /* _WIN32 */ |
54 |
|
|
55 |
+ |
#ifdef __cplusplus |
56 |
+ |
extern "C" { |
57 |
+ |
#endif |
58 |
+ |
|
59 |
+ |
/* nothing to protect yet */ |
60 |
|
|
61 |
|
#ifdef __cplusplus |
62 |
|
} |