basetsd.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * Compilers that uses ILP32, LP64 or P64 type models
  3. * for both Win32 and Win64 are supported by this file.
  4. *
  5. * Copyright (C) 1999 Patrik Stridvall
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #ifndef __WINE_BASETSD_H
  22. #define __WINE_BASETSD_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif /* defined(__cplusplus) */
  26. /*
  27. * Win32 was easy to implement under Unix since most (all?) 32-bit
  28. * Unices uses the same type model (ILP32) as Win32, where int, long
  29. * and pointer are 32-bit.
  30. *
  31. * Win64, however, will cause some problems when implemented under Unix.
  32. * Linux/{Alpha, Sparc64} and most (all?) other 64-bit Unices uses
  33. * the LP64 type model where int is 32-bit and long and pointer are
  34. * 64-bit. Win64 on the other hand uses the P64 (sometimes called LLP64)
  35. * type model where int and long are 32 bit and pointer is 64-bit.
  36. */
  37. /* Type model independent typedefs */
  38. /* The __intXX types are native types defined by the MS C compiler.
  39. * Apps that make use of them before they get defined here, can
  40. * simply add to the command line:
  41. * -D__int8=char -D__int16=short -D__int32=int "-D__int64=long long"
  42. */
  43. #if !defined(_MSC_VER) && !defined(__WIDL__)
  44. # ifndef __int8
  45. # define __int8 char
  46. # endif
  47. # ifndef __int16
  48. # define __int16 short
  49. # endif
  50. # ifndef __int32
  51. # define __int32 int
  52. # endif
  53. # ifndef __int64
  54. # define __int64 long long
  55. # endif
  56. #endif /* !defined(_MSC_VER) */
  57. /* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */
  58. #ifndef DECLSPEC_ALIGN
  59. # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
  60. # define DECLSPEC_ALIGN(x) __declspec(align(x))
  61. # elif defined(__GNUC__)
  62. # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
  63. # else
  64. # define DECLSPEC_ALIGN(x)
  65. # endif
  66. #endif
  67. typedef signed char INT8, *PINT8;
  68. typedef signed short INT16, *PINT16;
  69. typedef signed int INT32, *PINT32;
  70. typedef signed __int64 DECLSPEC_ALIGN(8) INT64, *PINT64;
  71. typedef unsigned char UINT8, *PUINT8;
  72. typedef unsigned short UINT16, *PUINT16;
  73. typedef unsigned int UINT32, *PUINT32;
  74. typedef unsigned __int64 DECLSPEC_ALIGN(8) UINT64, *PUINT64;
  75. typedef signed int LONG32, *PLONG32;
  76. typedef unsigned int ULONG32, *PULONG32;
  77. typedef unsigned int DWORD32, *PDWORD32;
  78. typedef signed __int64 DECLSPEC_ALIGN(8) LONG64, *PLONG64;
  79. typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONG64, *PULONG64;
  80. typedef unsigned __int64 DECLSPEC_ALIGN(8) DWORD64, *PDWORD64;
  81. /* Win32 or Win64 dependent typedef/defines. */
  82. #ifdef _WIN64
  83. typedef signed __int64 INT_PTR, *PINT_PTR;
  84. typedef signed __int64 LONG_PTR, *PLONG_PTR;
  85. typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
  86. typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
  87. typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
  88. #define MAXINT_PTR 0x7fffffffffffffff
  89. #define MININT_PTR 0x8000000000000000
  90. #define MAXUINT_PTR 0xffffffffffffffff
  91. typedef int HALF_PTR, *PHALF_PTR;
  92. typedef unsigned int UHALF_PTR, *PUHALF_PTR;
  93. #define MAXHALF_PTR 0x7fffffff
  94. #define MINHALF_PTR 0x80000000
  95. #define MAXUHALF_PTR 0xffffffff
  96. #else /* FIXME: defined(_WIN32) */
  97. typedef int INT_PTR, *PINT_PTR;
  98. typedef long LONG_PTR, *PLONG_PTR;
  99. typedef unsigned int UINT_PTR, *PUINT_PTR;
  100. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  101. typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
  102. #define MAXINT_PTR 0x7fffffff
  103. #define MININT_PTR 0x80000000
  104. #define MAXUINT_PTR 0xffffffff
  105. typedef signed short HALF_PTR, *PHALF_PTR;
  106. typedef unsigned short UHALF_PTR, *PUHALF_PTR;
  107. #define MAXUHALF_PTR 0xffff
  108. #define MAXHALF_PTR 0x7fff
  109. #define MINHALF_PTR 0x8000
  110. #endif /* defined(_WIN64) || defined(_WIN32) */
  111. typedef LONG_PTR SSIZE_T, *PSSIZE_T;
  112. typedef ULONG_PTR SIZE_T, *PSIZE_T;
  113. /* Some Wine-specific definitions */
  114. /* Architecture dependent settings. */
  115. /* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
  116. #if defined(__i386__)
  117. # undef WORDS_BIGENDIAN
  118. # undef BITFIELDS_BIGENDIAN
  119. # define ALLOW_UNALIGNED_ACCESS
  120. #elif defined(__sparc__)
  121. # define WORDS_BIGENDIAN
  122. # define BITFIELDS_BIGENDIAN
  123. # undef ALLOW_UNALIGNED_ACCESS
  124. #elif defined(__powerpc__)
  125. # define WORDS_BIGENDIAN
  126. # define BITFIELDS_BIGENDIAN
  127. # undef ALLOW_UNALIGNED_ACCESS
  128. #elif defined(__ALPHA__)
  129. # undef WORDS_BIGENDIAN
  130. # undef BITFIELDS_BIGENDIAN
  131. # undef ALLOW_UNALIGNED_ACCESS
  132. #elif !defined(RC_INVOKED) && !defined(__WIDL__)
  133. # error Unknown CPU architecture!
  134. #endif
  135. #ifdef __cplusplus
  136. } /* extern "C" */
  137. #endif /* defined(__cplusplus) */
  138. #endif /* !defined(__WINE_BASETSD_H) */