Source code of Windows XP (NT5)
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.

251 lines
5.5 KiB

  1. /***
  2. *cruntime.h - definitions specific to the target operating system and
  3. * hardware
  4. *
  5. * Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
  6. *
  7. *Purpose:
  8. * This header file contains widely used definitions specific to the
  9. * host operating system and hardware. It is included by every C source
  10. * and most every other header file.
  11. * [Internal]
  12. *
  13. *Revision History:
  14. * 02-27-90 GJF File created
  15. * 03-06-90 GJF Added register macros (REG1,...,etc.)
  16. * 04-11-90 GJF Set _CALLTYPE1 and _CALLTYPE4 to _stdcall.
  17. * 10-30-90 GJF Added macros defining variable args interface.
  18. * 10-31-90 GJF Added definition of _JBLEN (from setjmp.h).
  19. * 11-13-90 GJF Revised #ifdef-s, now use symbolic constants
  20. * representing target OS and target processor, with
  21. * #error directives for unsupported targets. Note the
  22. * general grouping of only OS-dependent definitions
  23. * followed by OS and processor dependent definitions.
  24. * 02-25-91 SRW Move _JBLEN definition back to setjmp.h [_WIN32_]
  25. * 04-09-91 PNT Added _MAC_ definitions
  26. * 05-09-91 GJF Restored _JBLEN definitions. Also fixed the macros
  27. * defining the target processor so both Stevewo's stuff
  28. * and mine would work.
  29. * 05-13-91 GJF Changed _CALLTYPE1 and _CALLTYPE4 to _cdecl for
  30. * Cruiser (_CRUISER_).
  31. * 08-28-91 JCR ANSI keywords
  32. * 11-01-91 GDP _JBLEN back to setjmp.h, stdarg macros back to stdarg.h
  33. * 03-30-92 DJM POSIX support.
  34. * 08-07-92 GJF Revised various macros.
  35. * 09-08-92 GJF Restored definition of _MIPS_ (temporarily).
  36. * 11-09-92 GJF Revised preprocessing conditionals for MIPS.
  37. * 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
  38. * Use _MIPS_ and _ALPHA_ instead.
  39. * 02-01-93 GJF Removed support for C6-386.
  40. *
  41. ****/
  42. #ifndef _INC_CRUNTIME
  43. /*
  44. * Some CRT sources have code conditioned on _MIPS_. Continue to define
  45. * _MIPS_ when MIPS is defined until these sources are fixed.
  46. */
  47. #if defined(MIPS) && !defined(_MIPS_)
  48. #define _MIPS_
  49. #endif
  50. #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
  51. #define UNALIGNED __unaligned
  52. #else
  53. #define UNALIGNED
  54. #endif
  55. /*
  56. * Old function calling type and variable type qualifier macros
  57. */
  58. #define _CALLTYPE1 __cdecl
  59. #define _CALLTYPE2 __cdecl
  60. #define _CALLTYPE4 __cdecl
  61. #define _VARTYPE1
  62. #ifdef _CRUISER_
  63. /*
  64. * DEFINITIONS FOR CRUISER (AKA OS/2 2.0).
  65. */
  66. #define _CALLTYPE3 __syscall /* OS API functions */
  67. /*
  68. * Macros for register variable declarations
  69. */
  70. #define REG1 register
  71. #define REG2 register
  72. #define REG3 register
  73. #define REG4
  74. #define REG5
  75. #define REG6
  76. #define REG7
  77. #define REG8
  78. #define REG9
  79. /*
  80. * Macros for varargs support
  81. */
  82. #define _VA_LIST_T char *
  83. #else /* ndef _CRUISER_ */
  84. #ifdef _WIN32_
  85. /*
  86. * DEFINITIONS FOR WIN32
  87. */
  88. #ifdef _ALPHA_
  89. #define _VA_LIST_T \
  90. struct { \
  91. char *a0; /* pointer to first homed integer argument */ \
  92. int offset; /* byte offset of next parameter */ \
  93. }
  94. #else
  95. #define _VA_LIST_T char *
  96. #endif
  97. #if defined(_M_IX86)
  98. /*
  99. * 386/486
  100. */
  101. #define REG1 register
  102. #define REG2 register
  103. #define REG3 register
  104. #define REG4
  105. #define REG5
  106. #define REG6
  107. #define REG7
  108. #define REG8
  109. #define REG9
  110. #elif defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
  111. /*
  112. * MIPS or ALPHA
  113. */
  114. #define REG1 register
  115. #define REG2 register
  116. #define REG3 register
  117. #define REG4 register
  118. #define REG5 register
  119. #define REG6 register
  120. #define REG7 register
  121. #define REG8 register
  122. #define REG9 register
  123. #else
  124. #error ERROR - SUPPORT FOR WIN32 NT-X86, NT-MIPS, NT-ALPHA, AND NT-PPC ONLY
  125. #endif
  126. #else /* ndef _WIN32_ */
  127. #ifdef _POSIX_
  128. /*
  129. * DEFINITIONS FOR POSIX
  130. */
  131. #ifdef _ALPHA_
  132. #define _VA_LIST_T \
  133. struct { \
  134. char *a0; /* pointer to first homed integer argument */ \
  135. int offset; /* byte offset of next parameter */ \
  136. }
  137. #else
  138. #define _VA_LIST_T char *
  139. #define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
  140. #define _VA_START(ap,v) ap = (va_list)&v + _INTSIZEOF(v)
  141. #define _VA_ARG(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
  142. #define _VA_END(ap) ap = (va_list)0
  143. #endif
  144. #if defined(_M_IX86)
  145. /*
  146. * 386/486
  147. */
  148. #define REG1 register
  149. #define REG2 register
  150. #define REG3 register
  151. #define REG4
  152. #define REG5
  153. #define REG6
  154. #define REG7
  155. #define REG8
  156. #define REG9
  157. #elif defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
  158. /*
  159. * MIPS/Alpha/PPC
  160. */
  161. #define REG1 register
  162. #define REG2 register
  163. #define REG3 register
  164. #define REG4 register
  165. #define REG5 register
  166. #define REG6 register
  167. #define REG7 register
  168. #define REG8 register
  169. #define REG9 register
  170. #else
  171. #error ERROR - SUPPORT FOR POSIX NT-X86, NT-MIPS, NT-ALPHA, AND NT_PPC ONLY
  172. #endif
  173. #else /* ndef _POSIX_ */
  174. #ifdef _MAC_
  175. /*
  176. * DEFINITIONS FOR MAC.
  177. */
  178. /*
  179. * Macros for register variable declarations
  180. */
  181. #define REG1
  182. #define REG2
  183. #define REG3
  184. #define REG4
  185. #define REG5
  186. #define REG6
  187. #define REG7
  188. #define REG8
  189. #define REG9
  190. /*
  191. * Macros for varargs support
  192. */
  193. #define _VA_LIST_T char *
  194. #else /* ndef _MAC_ */
  195. #error ERROR - ONLY CRUISER, WIN32, OR MAC TARGET SUPPORTED!
  196. #endif /* _MAC_ */
  197. #endif /* _WIN32_ */
  198. #endif /* _POSIX_ */
  199. #endif /* _CRUISER_ */
  200. #define _INC_CRUNTIME
  201. #endif /* _INC_CRUNTIME */