IdCTypes.pas 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. unit IdCTypes;
  2. interface
  3. {$I IdCompilerDefines.inc}
  4. {
  5. This unit should not contain ANY program code. It is meant to be extremely
  6. thin. The idea is that the unit will contain type mappings that used for headers
  7. and API calls using the headers. The unit is here because in cross-platform
  8. headers, the types may not always be the same as they would for Win32 on x86
  9. Intel architecture. We also want to be completely compatiable with Borland
  10. Delphi for Win32.
  11. }
  12. {$IFDEF FPC}
  13. uses
  14. ctypes
  15. {$IFDEF HAS_UNIT_UnixType}
  16. , UnixType
  17. {$ENDIF}
  18. ;
  19. {$ELSE}
  20. // Delphi defines (P)SIZE_T and (P)SSIZE_T in the Winapi.Windows unit in
  21. // XE2+, but we don't want to pull in that whole unit here just to define
  22. // a few aliases...
  23. {
  24. ($IFDEF WINDOWS)
  25. ($IFDEF VCL_XE2_OR_ABOVE)
  26. uses Winapi.Windows;
  27. ($ENDIF)
  28. ($ENDIF)
  29. }
  30. {$ENDIF}
  31. {
  32. IMPORTANT!!!
  33. The types below are defined to hide architecture differences for various C++
  34. types while also making this header compile with Borland Delphi.
  35. }
  36. type
  37. {$IFDEF FPC}
  38. TIdC_LONG = cLong;
  39. PIdC_LONG = pcLong;
  40. TIdC_ULONG = cuLong;
  41. PIdC_ULONG = pculong;
  42. TIdC_LONGLONG = clonglong;
  43. PIdC_LONGLONG = pclonglong;
  44. TIdC_ULONGLONG = culonglong;
  45. PIdC_ULONGLONG = pculonglong;
  46. TIdC_SHORT = cshort;
  47. PIdC_SHORT = pcshort;
  48. TIdC_USHORT = cuShort;
  49. PIdC_USHORT = pcuShort;
  50. TIdC_INT = cInt;
  51. PIdC_INT = pcInt;
  52. TIdC_UINT = cUInt;
  53. PIdC_UINT = pcUInt;
  54. TIdC_SIGNED = csigned;
  55. PIdC_SIGNED = pcsigned;
  56. TIdC_UNSIGNED = cunsigned;
  57. PIdC_UNSIGNED = pcunsigned;
  58. TIdC_INT8 = cint8;
  59. PIdC_INT8 = pcint8;
  60. TIdC_UINT8 = cuint8;
  61. PIdC_UINT8 = pcuint8;
  62. TIdC_INT16 = cint16;
  63. PIdC_INT16 = pcint16;
  64. TIdC_UINT16 = cuint16;
  65. PIdC_UINT16 = pcuint16;
  66. TIdC_INT32 = cint32;
  67. PIdC_INT32 = pcint32;
  68. TIdC_UINT32 = cuint32;
  69. PIdC_UINT32 = pcuint32;
  70. TIdC_INT64 = cint64;
  71. PIdC_INT64 = pcint64;
  72. TIdC_UINT64 = cuint64;
  73. PIdC_UINT64 = pcuint64;
  74. TIdC_FLOAT = cfloat;
  75. PIdC_FLOAT = pcfloat;
  76. TIdC_DOUBLE = cdouble;
  77. PIdC_DOUBLE = pcdouble;
  78. TIdC_LONGDOUBLE = clongdouble;
  79. PIdC_LONGDOUBLE = pclongdouble;
  80. {$IFDEF HAS_SIZE_T}
  81. TIdC_SIZET = size_t;
  82. {$ELSE}
  83. {$IFDEF HAS_PtrUInt}
  84. TIdC_SIZET = PtrUInt;
  85. {$ELSE}
  86. {$IFDEF CPU32}
  87. TIdC_SIZET = TIdC_UINT32;
  88. {$ENDIF}
  89. {$IFDEF CPU64}
  90. TIdC_SIZET = TIdC_UINT64;
  91. {$ENDIF}
  92. {$ENDIF}
  93. {$ENDIF}
  94. {$IFDEF HAS_PSIZE_T}
  95. PIdC_SIZET = psize_t;
  96. {$ELSE}
  97. PIdC_SIZET = ^TIdC_SIZET;
  98. {$ENDIF}
  99. {$IFDEF HAS_SSIZE_T}
  100. TIdC_SSIZET = ssize_t;
  101. {$ELSE}
  102. {$IFDEF HAS_PtrInt}
  103. TIdC_SSIZET = PtrInt;
  104. {$ELSE}
  105. {$IFDEF CPU32}
  106. TIdC_SSIZET = TIdC_INT32;
  107. {$ENDIF}
  108. {$IFDEF CPU64}
  109. TIdC_SSIZET = TIdC_INT64;
  110. {$ENDIF}
  111. {$ENDIF}
  112. {$ENDIF}
  113. {$IFDEF HAS_PSSIZE_T}
  114. // in ptypes.inc, pssize_t is missing, but pSSize is present, and it is defined as ^ssize_t...
  115. PIdC_SSIZET = {pssize_t}pSSize;
  116. {$ELSE}
  117. PIdC_SSIZET = ^TIdC_SSIZET;
  118. {$ENDIF}
  119. {$IFDEF HAS_TIME_T}
  120. TIdC_TIMET = time_t;
  121. {$ELSE}
  122. {$IFDEF HAS_PtrUInt}
  123. TIdC_TIMET = PtrUInt;
  124. {$ELSE}
  125. {$IFDEF CPU32}
  126. TIdC_TIMET = TIdC_UINT32;
  127. {$ENDIF}
  128. {$IFDEF CPU64}
  129. TIdC_TIMET = TIdC_UINT64;
  130. {$ENDIF}
  131. {$ENDIF}
  132. {$ENDIF}
  133. {$IFDEF HAS_PTIME_T}
  134. PIdC_TIMET = ptime_t;
  135. {$ELSE}
  136. PIdC_TIMET = ^TIdC_TIMET;
  137. {$ENDIF}
  138. {$ELSE}
  139. // this is necessary because Borland still doesn't support QWord
  140. // (unsigned 64bit type).
  141. {$IFNDEF HAS_QWord}
  142. qword = {$IFDEF HAS_UInt64}UInt64{$ELSE}Int64{$ENDIF};
  143. {$ENDIF}
  144. TIdC_LONG = LongInt;
  145. PIdC_LONG = ^TIdC_LONG;
  146. TIdC_ULONG = LongWord;
  147. PIdC_ULONG = ^TIdC_ULONG;
  148. TIdC_LONGLONG = Int64;
  149. PIdC_LONGLONG = ^TIdC_LONGLONG;
  150. TIdC_ULONGLONG = QWord;
  151. PIdC_ULONGLONG = ^TIdC_ULONGLONG;
  152. TIdC_SHORT = Smallint;
  153. PIdC_SHORT = ^TIdC_SHORT;
  154. TIdC_USHORT = Word;
  155. PIdC_USHORT = ^TIdC_USHORT;
  156. TIdC_INT = Integer;
  157. PIdC_INT = ^TIdC_INT;
  158. TIdC_UINT = Cardinal;
  159. PIdC_UINT = ^TIdC_UINT;
  160. TIdC_SIGNED = Integer;
  161. PIdC_SIGNED = ^TIdC_SIGNED;
  162. TIdC_UNSIGNED = Cardinal;
  163. PIdC_UNSIGNED = ^TIdC_UNSIGNED;
  164. TIdC_INT8 = Shortint;
  165. PIdC_INT8 = ^TIdC_INT8{PShortint};
  166. TIdC_UINT8 = Byte;
  167. PIdC_UINT8 = ^TIdC_UINT8{PByte};
  168. TIdC_INT16 = Smallint;
  169. PIdC_INT16 = ^TIdC_INT16{PSmallint};
  170. TIdC_UINT16 = Word;
  171. PIdC_UINT16 = ^TIdC_UINT16{PWord};
  172. TIdC_INT32 = Integer;
  173. PIdC_INT32 = ^TIdC_INT32{PInteger};
  174. TIdC_UINT32 = Cardinal;
  175. PIdC_UINT32 = ^TIdC_UINT32{PCardinal};
  176. TIdC_INT64 = Int64;
  177. PIdC_INT64 = ^TIdC_INT64{PInt64};
  178. TIdC_UINT64 = QWord;
  179. PIdC_UINT64 = ^TIdC_UINT64{PQWord};
  180. TIdC_FLOAT = Single;
  181. PIdC_FLOAT = ^TIdC_FLOAT{PSingle};
  182. TIdC_DOUBLE = Double;
  183. PIdC_DOUBLE = ^TIdC_DOUBLE{PDouble};
  184. TIdC_LONGDOUBLE = Extended;
  185. PIdC_LONGDOUBLE = ^TIdC_LONGDOUBLE{PExtended};
  186. {.$IFDEF HAS_SIZE_T}
  187. //TIdC_SIZET = Winapi.Windows.SIZE_T;
  188. {.$ELSE}
  189. {$IFDEF HAS_NativeUInt}
  190. TIdC_SIZET = NativeUInt;
  191. {$ELSE}
  192. {$IFDEF CPU32}
  193. TIdC_SIZET = TIdC_UINT32;
  194. {$ENDIF}
  195. {$IFDEF CPU64}
  196. TIdC_SIZET = TIdC_UINT64;
  197. {$ENDIF}
  198. {$ENDIF}
  199. {.$ENDIF}
  200. {.$IFDEF HAS_PSIZE_T}
  201. //PIdC_SIZET = Winapi.Windows.PSIZE_T;
  202. {.$ELSE}
  203. PIdC_SIZET = ^TIdC_SIZET;
  204. {.$ENDIF}
  205. {.$IFDEF HAS_SSIZE_T}
  206. //TIdC_SSIZET = Winapi.Windows.SSIZE_T;
  207. {.$ELSE}
  208. {$IFDEF HAS_NativeInt}
  209. TIdC_SSIZET = NativeInt;
  210. {$ELSE}
  211. {$IFDEF CPU32}
  212. TIdC_SSIZET = TIdC_INT32;
  213. {$ENDIF}
  214. {$IFDEF CPU64}
  215. TIdC_SSIZET = TIdC_INT64;
  216. {$ENDIF}
  217. {$ENDIF}
  218. {.$ENDIF}
  219. {.$IFDEF HAS_PSSIZE_T}
  220. //PIdC_SSIZET = Winapi.Windows.PSSIZE_T;
  221. {.$ELSE}
  222. PIdC_SSIZET = ^TIdC_SSIZET;
  223. {.$ENDIF}
  224. {$IFDEF HAS_TIME_T}
  225. TIdC_TIMET = time_t;
  226. {$ELSE}
  227. {$IFDEF HAS_NativeUInt}
  228. TIdC_TIMET = NativeUInt;
  229. {$ELSE}
  230. {$IFDEF CPU32}
  231. TIdC_TIMET = TIdC_UINT32;
  232. {$ENDIF}
  233. {$IFDEF CPU64}
  234. TIdC_TIMET = TIdC_UINT64;
  235. {$ENDIF}
  236. {$ENDIF}
  237. {$ENDIF}
  238. {$IFDEF HAS_PTIME_T}
  239. PIdC_TIMET = PTIME_T;
  240. {$ELSE}
  241. PIdC_TIMET = ^TIdC_TIMET;
  242. {$ENDIF}
  243. // Some headers require this in D5 or earlier.
  244. // FreePascal already has this in its system unit.
  245. {$IFNDEF HAS_PByte}PByte = ^Byte;{$ENDIF}
  246. {$IFNDEF HAS_PWord}PWord = ^Word;{$ENDIF}
  247. {$ENDIF}
  248. implementation
  249. end.