Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
4.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1997-1998.
  4. //
  5. // File: platform.h
  6. //
  7. // Contents: Macros for portable access to platform dependent values.
  8. //
  9. //
  10. // This file contains macros for easy cross platform developing.
  11. // There are macros for compiler differences and platform/layer differences.
  12. //
  13. //----------------------------------------------------------------------------
  14. #ifndef __PLATFORM_H_
  15. #define __PLATFORM_H_
  16. #ifdef __cplusplus
  17. // +++ Unaligned memory access templates/macros
  18. # include <unaligned.hpp>
  19. #endif
  20. ////////////////////////////////////////////////////////////////////
  21. //
  22. // Global defines (should be moved to NT public headers)
  23. //
  24. #define VER_PLATFORM_WIN32_UNIX 9
  25. ////////////////////////////////////////////////////////////////////
  26. //
  27. // Compiler differences
  28. //
  29. #if !defined(_MSC_VER) && !defined(__APOGEE__)
  30. // For compilers lacking VC++ extensions
  31. # define __cdecl
  32. # define INLINEOP /* Inline operators not available IEUNIX */
  33. # ifdef UNIX
  34. // Unix specific compiler problems
  35. # define UNSIZED_ARRAY 1
  36. # else
  37. # define UNSIZED_ARRAY
  38. # endif // UNIX
  39. #else // !_MSC_VER
  40. // VC++ compilers
  41. # define INLINEOP inline
  42. # define UNSIZED_ARRAY
  43. #endif
  44. #define EMPTY_SIZE UNSIZED_ARRAY
  45. ////////////////////////////////////////////////////////////////////
  46. //
  47. // Platform / Layer dependent sections.
  48. //
  49. // NOTE! #ifdefing based on WIN32 is invalid as some layers define
  50. // WIN32 for compatability.
  51. //
  52. #define ENDEXCEPT __endexcept
  53. #define ENDFINALLY __endfinally
  54. #if !defined( UNIX )
  55. #define __endexcept
  56. #define __endfinally
  57. #endif // UNIX
  58. // +++ File Separators
  59. #if defined( UNIX )
  60. // UNIX
  61. # ifndef FILENAME_SEPARATOR
  62. # define FILENAME_SEPARATOR '/'
  63. # endif
  64. # ifndef FILENAME_SEPARATOR_W
  65. # define FILENAME_SEPARATOR_W L'/'
  66. # endif
  67. # ifndef FILENAME_SEPARATOR_STR
  68. # define FILENAME_SEPARATOR_STR "/"
  69. # endif
  70. # ifndef FILENAME_SEPARATOR_STR_W
  71. # define FILENAME_SEPARATOR_STR_W L"/"
  72. # endif
  73. # ifndef PATH_SEPARATOR
  74. # define PATH_SEPARATOR ':'
  75. # endif
  76. # ifndef PATH_SEPARATOR_W
  77. # define PATH_SEPARATOR_W L':'
  78. # endif
  79. # ifndef PATH_SEPARATOR_STR
  80. # define PATH_SEPARATOR_STR ":"
  81. # endif
  82. # ifndef PATH_SEPARATOR_STR_W
  83. # define PATH_SEPARATOR_STR_W L":"
  84. # endif
  85. # ifndef LINE_SEPARATOR_STR
  86. # define LINE_SEPARATOR_STR "\n"
  87. # endif
  88. # ifndef LINE_SEPARATOR_STR_W
  89. # define LINE_SEPARATOR_STR_W L"\n"
  90. # endif
  91. #else // UNIX
  92. // Windows / MAC
  93. # ifndef FILENAME_SEPARATOR
  94. # define FILENAME_SEPARATOR '\\'
  95. # endif
  96. # ifndef FILENAME_SEPARATOR_W
  97. # define FILENAME_SEPARATOR_W L'\\'
  98. # endif
  99. # ifndef FILENAME_SEPARATOR_STR
  100. # define FILENAME_SEPARATOR_STR "\\"
  101. # endif
  102. # ifndef FILENAME_SEPARATOR_STR_W
  103. # define FILENAME_SEPARATOR_STR_W L"\\"
  104. # endif
  105. # ifndef PATH_SEPARATOR
  106. # define PATH_SEPARATOR ';'
  107. # endif
  108. # ifndef PATH_SEPARATOR_W
  109. # define PATH_SEPARATOR_W L';'
  110. # endif
  111. # ifndef PATH_SEPARATOR_STR
  112. # define PATH_SEPARATOR_STR ";"
  113. # endif
  114. # ifndef PATH_SEPARATOR_STR_W
  115. # define PATH_SEPARATOR_STR_W L";"
  116. # endif
  117. # ifndef LINE_SEPARATOR_STR
  118. # define LINE_SEPARATOR_STR "\r\n"
  119. # endif
  120. # ifndef LINE_SEPARATOR_STR_W
  121. # define LINE_SEPARATOR_STR_W L"\r\n"
  122. # endif
  123. #endif // Windows / MAC
  124. #ifdef UNIX
  125. # define PLATFORM_ACCEL_KEY ALT
  126. # define PLATFORM_ACCEL_STR "Alt" // -- Look in rc.sed files
  127. # define FACCELKEY FALT
  128. #define VK_OEM_SLASH 0xBF
  129. #else /* UNIX */
  130. #define INTERFACE_PROLOGUE(a)
  131. #define INTERFACE_EPILOGUE(a)
  132. #define INTERFACE_PROLOGUE_(a,b)
  133. #define INTERFACE_EPILOGUE_(a,b)
  134. # define PLATFORM_ACCEL_KEY CONTROL
  135. # define PLATFORM_ACCEL_STR "Ctrl" // -- Look in rc.sed files
  136. # define FACCELKEY FCONTROL
  137. #define VK_OEM_SLASH '/'
  138. #endif /* UNIX */
  139. #define MAKELONGLONG(low,high) ((LONGLONG)(((DWORD)(low)) | ((LONGLONG)((DWORD)(high))) << 32))
  140. #ifdef BIG_ENDIAN
  141. #define MAKE_LI(low,high) { high, low }
  142. #define PALETTE_ENTRY( r, g, b, f ) { f, b, g, r }
  143. #else
  144. #define MAKE_LI(low,high) { low, high }
  145. #define PALETTE_ENTRY( r, g, b, f ) { r, g, b, f }
  146. #endif
  147. #endif // __PLATFORM_H_