Back to index

radiance  4R0+20100331
platform.h
Go to the documentation of this file.
00001 /* RCSid $Id: platform.h,v 3.11 2003/10/27 10:19:31 schorsch Exp $ */
00002 /*
00003  *  platform.h - header file for platform specific definitions
00004  */
00005 #ifndef _RAD_PLATFORM_H_
00006 #define _RAD_PLATFORM_H_
00007 
00008 #ifdef _WIN32
00009 
00010   #include <io.h>     /* _setmode() and stuff from unistd.h */
00011   typedef long off_t;
00012 
00013   #include <stdio.h>
00014   #define snprintf _snprintf
00015 
00016   #include <windows.h>
00017   #define sleep(s) Sleep(s*1000)
00018 
00019   #define NON_POSIX
00020 
00021   #include <sys/types.h>
00022   #include <sys/stat.h>
00023   #define RHAS_STAT
00024   #define S_IFREG _S_IFREG
00025   #define W_IFDIR _S_IFDIR
00026 
00027   #include <fcntl.h>  /* _O_BINARY, _O_TEXT */
00028   #include <stdlib.h> /* _fmode */
00029   #define SET_DEFAULT_BINARY() _fmode = _O_BINARY
00030   #define SET_FILE_BINARY(fp) _setmode(fileno(fp),_O_BINARY)
00031   #define SET_FD_BINARY(fd) _setmode(fd,_O_BINARY)
00032 
00033 #else /* _WIN32 */
00034 
00035   #ifdef AMIGA
00036     #define NON_POSIX
00037   #else
00038     /* assumedly posix systems */
00039        #include <unistd.h>
00040     #define RHAS_STAT
00041     #define RHAS_FORK_EXEC
00042   #endif
00043 
00044   /* everybody except Windows */
00045 
00046   /* NOPs */
00047   #define SET_DEFAULT_BINARY()
00048   #define SET_FILE_BINARY(fp)
00049   #define SET_FD_BINARY(fd)
00050 
00051 #endif /* _WIN32 */
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 /* nothing to protect yet */
00058 
00059 #ifdef __cplusplus
00060 }
00061 #endif
00062 #endif /* _RAD_PLATFORM_H_ */
00063