home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / winnt-pdo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  5.1 KB  |  178 lines

  1. /******************************************************************
  2. *
  3. *    PDO Windows NT compatibility header file 
  4. *    
  5. *    You should include this in every file that gets compiled 
  6. *    by gcc.  
  7. *
  8. ******************************************************************/
  9.  
  10. #ifndef _WINNT_PDO_H_
  11. #define _WINNT_PDO_H_
  12.  
  13. // These things are only of interest to gcc, so this will make
  14. // it safe to include this file regardless of if youre using 
  15. // a different compiler or not.
  16. #ifdef __GNUC__
  17.  
  18. // The version of the MS compiler.  The headers do a lot
  19. // of conditional stuff with this flag that gcc can handle
  20. // so we define it here.
  21. #define _MSC_VER 0x0900
  22.  
  23. #endif /* __GNUC__ */
  24.  
  25. // This is the default calling convention supported by gcc so 
  26. // this doesnt have any special meaning.  The only other
  27. // calling convention supported by gcc so far is __stdcall
  28. #define __cdecl
  29.  
  30. // NT doesnt support the _export keyword
  31. #define _export
  32.  
  33. // These have no meaning under NT 
  34. #define far
  35. #define near
  36. #define _huge
  37.  
  38. // This is used in WINDOWS.H to include a whole lot of stuff
  39. // that gcc choked on.  If you need anything in the following
  40. // list, then either we need to clean the headers up or just
  41. // include it manually and fix up the specific header if there
  42. // is a conflick.  The following headers are NOT include if 
  43. // WIN32_LEAN_AND_MEAN is defined:
  44. //     cderr.h
  45. //     dde.h
  46. //     ddeml.h
  47. //     dlgs.h
  48. //     lzexpand.h
  49. //     mmsystem.h
  50. //     nb30.h
  51. //     rpc.h
  52. //     shellapi.h
  53. //     winperf.h
  54. //     winsock.h
  55. //     commdlg.h
  56. //     drivinit.h
  57. //     winspool.h
  58. //     ole2.h
  59. #define WIN32_LEAN_AND_MEAN
  60.  
  61. // Again, some headers use this to indicate that youre on 
  62. // an NT platform...I needed this to include process.h in specific
  63. #define _NTSDK
  64.  
  65. // NT header files use this to indicate that unions cant be nameless.
  66. // Unfortuately, only SOME of the header files use this!
  67. #define NONAMELESSUNION
  68.  
  69. // Make sure were not using bcopy since it doesnt handle overlapping
  70. // memory regions properly.  memmove does.
  71. #ifndef HOOD
  72. #define bcopy(src,dst,cnt) memmove(dst,src,cnt)
  73. #endif /* HOOD */
  74.  
  75. // To support bzero
  76. #define bzero(dst,cnt) memset(dst,0,cnt)
  77.  
  78. // Microsoft defines all of their C type filenames with "_".  I didnt 
  79. // immediately find a header that had these mappings so I just built
  80. // them manually.  If these are in a header somewhere or are no longer
  81. // needed, then they should be removed. - pmarcos
  82. //#define O_TRUNC _O_TRUNC        // include <fcntl.h> instead
  83. #define O_RDONLY _O_RDONLY
  84. #define O_WRONLY _O_WRONLY
  85. #define O_RDWR _O_RDWR
  86. #define O_CREAT _O_CREAT
  87. #define alloca _alloca
  88. #define stat _stat
  89. #define environ _environ
  90. #define strdup _strdup
  91. #define strncasecmp _strnicmp
  92. #define putenv _putenv
  93. #define access _access
  94. #define chmod _chmod
  95. #define getcwd _getcwd
  96. #define fdopen _fdopen
  97. #define fstat _fstat
  98. #define fileno _fileno
  99. #define umask _umask
  100. #define getpid _getpid
  101. #define lseek _lseek
  102. #define mktemp _mktemp
  103. #define SIGHUP SIGBREAK
  104. #define chdir _chdir
  105. #define close(h)       _close(h)
  106. #define open(f,o,m)       _open(f,o,m)
  107. #define read(h,b,c)       _read(h,b,c)
  108. #define unlink(f)       _unlink(f)
  109. #define write(h,b,c)       _write(h,b,c)
  110.  
  111. // NT doesnt support these functions, so just map them to 0
  112. #define getuid() 0
  113. #define getgid() 0
  114.  
  115. // sbrk is not supported under NT
  116. #define sbrk(x) ""
  117.  
  118. // NT doesnt have a MAXPATHLEN variable.  I needed this when compiling 
  119. // bfd for gas.  
  120. #ifndef MAXPATHLEN
  121. #define MAXPATHLEN 255
  122. #endif /* MAXPATHLEN */
  123.  
  124. #ifndef _NEXT_FOK_DEFINED_
  125. #define _NEXT_FOK_DEFINED_
  126. // I needed these for compiling the gnu binutils when getting gas to work
  127. #define R_OK 04
  128. #define W_OK 02
  129. #define X_OK 01
  130.  
  131. // Needed for calls to access()
  132. #ifndef F_OK
  133. #define F_OK 00
  134. #endif /* F_OK */
  135.  
  136. #endif _NEXT_FOK_DEFINED_
  137.  
  138. // These are needed by gcc.  Shouldnt these be in the compiler?
  139. #define NO_FCNTL 1
  140. #define HAVE_PUTENV
  141.  
  142. // NT doesnt support symbolic links so we just let stat stand in for 
  143. // lstat.  If the file exists then thats fine, stat will do the right 
  144. // thing.  If it doesnt exist, then it will return -1 which is what 
  145. // lstat would have returned in the event of an error.  Additionally, 
  146. // we set S_IFLNK to be 0xFFFF so that if somebody does something like
  147. //         if ((statb.st_mode & S_IFLNK) == S_IFLNK)
  148. // that it will fail meaning that the file isnt a sym link.  
  149. #define lstat _stat
  150. #define S_IFLNK 0xFFFF
  151.  
  152. // Windows defines the macros max and min so be sure we pick them up
  153. #ifndef MAX
  154. #define MAX max
  155. #endif /* MAX */
  156. #ifndef MIN
  157. #define MIN min
  158. #endif /* MIN */
  159.  
  160. // NT doesnt have fsync and ftruncate so well define them to return an error
  161. #define fsync(a) -1
  162. #define ftruncate(a,b) -1
  163.  
  164. // NT doesnt have readlink so we define it to return an error
  165. #define readlink(a,b,c) -1
  166.  
  167. // These would normally be in limits.h but NT doesnt provide them.
  168. #define ULONG_LONG_MAX 18446744073709551615ULL
  169. #define LONG_LONG_MAX 9223372036854775807LL
  170. #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
  171.  
  172. #define MINFLOAT ((float)1.17549435e-038)
  173. #define MAXFLOAT ((float)3.40282347e+038)
  174. #define MINDOUBLE 2.2250738585072014e-308
  175. #define MAXDOUBLE 1.7976931348623157e+308
  176.  
  177. #endif /* _WINNT_PDO_H_ */
  178.