2
0

platform.inc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. {***************[ PLATFORM INCLUDE UNIT ]******************}
  2. { }
  3. { System independent INCLUDE file to sort PLATFORMS }
  4. { }
  5. { Parts Copyright (c) 1997 by Balazs Scheidler }
  6. { [email protected] }
  7. { }
  8. { Parts Copyright (c) 1999, 2000 by Leon de Boer }
  9. { [email protected] - primary e-mail address }
  10. { [email protected] - backup e-mail address }
  11. { }
  12. {****************[ THIS CODE IS FREEWARE ]*****************}
  13. { }
  14. { This sourcecode is released for the purpose to }
  15. { promote the pascal language on all platforms. You may }
  16. { redistribute it and/or modify with the following }
  17. { DISCLAIMER. }
  18. { }
  19. { This SOURCE CODE is distributed "AS IS" WITHOUT }
  20. { WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR }
  21. { ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. }
  22. { }
  23. {*****************[ SUPPORTED PLATFORMS ]******************}
  24. { 16 and 32 Bit compilers }
  25. { DOS - Turbo Pascal 7.0 + (16 Bit) }
  26. { DPMI - Turbo Pascal 7.0 + (16 Bit) }
  27. { - FPC 0.9912+ (GO32V2) (32 Bit) }
  28. { WINDOWS - Turbo Pascal 7.0 + (16 Bit) }
  29. { - Delphi 1.0+ (16 Bit) }
  30. { WIN95/NT - Delphi 2.0+ (32 Bit) }
  31. { - Virtual Pascal 2.0+ (32 Bit) }
  32. { - Speedsoft Sybil 2.0+ (32 Bit) }
  33. { - FPC 0.9912+ (32 Bit) }
  34. { OS2 - Virtual Pascal 1.0+ (32 Bit) }
  35. { - C'T patch to BP (16 Bit) }
  36. { LINUX - FPC 0.9912+ (32 Bit) }
  37. { }
  38. {******************[ REVISION HISTORY ]********************}
  39. { Version Date Who Fix }
  40. { ------- -------- --- ---------------------------- }
  41. { 0.1 02 Jul 97 Bazsi Initial implementation }
  42. { 0.2 28 Aug 97 LdB Fixed OS2 platform sort }
  43. { 0.3 29 Aug 97 LdB Added assembler type changes }
  44. { 0.4 29 Aug 97 LdB OS_DOS removed from WINDOWS }
  45. { 0.5 23 Oct 97 LdB Delphi & speed compilers }
  46. { 0.6 05 May 98 LdB Virtual Pascal 2.0 added }
  47. { 0.7 19 May 98 LdB Delphi 2/3 definitions added }
  48. { 0.8 06 Aug 98 CEC FPC only support fixed WIN32 }
  49. { 0.9 10 Aug 98 LdB BP_VMTLink def/Undef added }
  50. { 1.0 27 Aug 98 LdB Atari, Mac etc not undef dos }
  51. { 1.1 25 Oct 98 PfV Delphi 4 definitions added }
  52. { 1.2 06 Jun 99 LdB Sybil 2.0 support added }
  53. { 1.3 13 Jun 99 LdB Sybil 2.0 undef BP_VMT link }
  54. { 1.31 03 Nov 99 LdB FPC windows defines WIN32 }
  55. { 1.32 04 Nov 99 LdB Delphi 5 definitions added }
  56. { 1.33 16 Oct 00 LdB WIN32/WIN16 defines added }
  57. { 1.34 02 May 02 MvdV FreeBSD, NetBSD, OS_UNIX }
  58. {**********************************************************}
  59. { ****************************************************************************
  60. This include file defines some conditional defines to allow us to select
  61. the compiler/platform/target in a consequent way.
  62. OS_XXXX The operating system used (XXXX may be one of:
  63. DOS, OS2, Linux, Windows, Go32)
  64. PPC_XXXX The compiler used: BP, FPK, Virtual, Speed
  65. BIT_XX The number of bits of the target platform: 16 or 32
  66. PROC_XXXX The mode of the target processor (Real or Protected)
  67. This shouldn't be used, except for i386 specific parts.
  68. ASM_XXXX This is the assembler type: BP, ISO-ANSI, FPK
  69. ****************************************************************************
  70. This is how the IFDEF and UNDEF statements below should translate.
  71. PLATFORM SYSTEM COMPILER COMP ID CPU MODE BITS ASSEMBLER
  72. -------- ------ -------- ------- -------- ---- ---------
  73. DOS OS_DOS BP/TP7 PPC_BP PROC_Real BIT_16 ASM_BP
  74. DPMI OS_DOS BP/TP7 PPC_BP PROC_Protected BIT_16 ASM_BP
  75. FPC PPC_FPC PROC_Protected BIT_32 ASM_FPC
  76. LINUX OS_LINUX FPC PPC_FPC PROC_Protected BIT_32 ASM_FPC
  77. OS_UNIX
  78. FREEBSD OS_FREEBSD FPC PPC_FPC PROC_Protected BIT_32 ASM_FPC
  79. OS_UNIX
  80. NETBSD OS_NETBSD FPC PPC_FPC PROC_Protected BIT_32 ASM_FPC
  81. OS_UNIX
  82. WINDOWS OS_WINDOWS BP/TP7 PPC_BP PROC_Protected BIT_16 ASM_BP
  83. DELPHI PPC_DELPHI PROC_Protected BIT_16 ASM_BP
  84. DELPHI2 PPC_DELPHI2 PROC_Protected BIT_16 ASM_BP
  85. WIN95/NT OS_WINDOWS DELPHI2 PPC_DELPHI2 PROC_Protected BIT_32 ASM_BP
  86. DELPHI3 PPC_DELPHI3 PROC_Protected BIT_32 ASM_BP
  87. DELPHI4 PPC_DELPHI3 PROC_Protected BIT_32 ASM_BP
  88. DELPHI5 PPC_DELPHI3 PROC_Protected BIT_32 ASM_BP
  89. VIRTUAL PPC_VIRTUAL PROC_Protected BIT 32 ASM_BP
  90. SYBIL2 PPC_SPEED PROC_Protected BIT_32 ASM_BP
  91. FPC PPC_FPC PROC_Protected BIT_32 ASM_FPC
  92. OS2 OS_OS2 BPOS2 PPC_BPOS2 PROC_Protected BIT_16 ASM_BP
  93. VIRTUAL PPC_VIRTUAL PROC_Protected BIT_32 ASM_BP
  94. SPEED PPC_SPEED PROC_Protected BIT_32 ASM_BP
  95. SYBIL2 PPC_SPEED PROC_Protected BIT_32 ASM_BP
  96. FPC PPC_FPC PROC_Protected BIT_32 ASM_FPC
  97. ****************************************************************************}
  98. {****************************************************************************
  99. FOR ALL COMPILERS BP_VMTLink defined but FPC and Delphi3/Delphi4 undefine it
  100. ****************************************************************************}
  101. {****************************************************************************
  102. FOR FPC THESE ARE THE TRANSLATIONS
  103. PLATFORM SYSTEM COMPILER HANDLE SIZE ASM CPU
  104. -------- ------ -------- ----------- ---- ---
  105. DOS OS_DOS,OS_GO32 FPC 32-bit AT&T CPU86
  106. WIN32 OS_WINDOWS FPC 32-bit AT&T ----
  107. LINUX OS_LINUX,OS_UNIX FPC 32-bit AT&T ----
  108. FREEBSD OS_NETBSD,OS_UNIX FPC 32-bit AT&T ----
  109. NETBSD OS_FREEBSD,OS_UNIX FPC 32-bit AT&T ----
  110. OS2 OS_OS2 FPC ????? AT&T CPU86
  111. ATARI OS_ATARI FPC 32-bit Internal CPU68
  112. MACOS OS_MAC FPC ????? Internal CPU68
  113. AMIGA OS_AMIGA FPC 32-bit Internal CPU68
  114. ****************************************************************************}
  115. {---------------------------------------------------------------------------}
  116. { Initial assume BORLAND 16 BIT DOS COMPILER - Updated 27Aug98 LdB }
  117. {---------------------------------------------------------------------------}
  118. {$DEFINE OS_DOS}
  119. {$DEFINE PROC_Real}
  120. {$DEFINE BIT_16}
  121. {$DEFINE PPC_BP}
  122. {$DEFINE ASM_BP}
  123. {$DEFINE BP_VMTLink}
  124. {$DEFINE CPU86}
  125. {---------------------------------------------------------------------------}
  126. { FPC 32 BIT COMPILER changes ASM, 32 bits etc - Updated 27Aug98 LdB }
  127. {---------------------------------------------------------------------------}
  128. {$IFDEF FPC}
  129. {$mode fpc}
  130. {$UNDEF PROC_Real}
  131. {$DEFINE PROC_Protected}
  132. {$UNDEF BIT_16}
  133. {$DEFINE BIT_32}
  134. {$UNDEF PPC_BP}
  135. {$DEFINE PPC_FPC}
  136. {$UNDEF ASM_BP}
  137. {$DEFINE ASM_FPC}
  138. {$UNDEF BP_VMTLink}
  139. {$DEFINE Use_API}
  140. {$DEFINE NO_WINDOW}
  141. {$ENDIF}
  142. {---------------------------------------------------------------------------}
  143. { FPC LINUX COMPILER changes operating system - Updated 27Aug98 LdB }
  144. { Note: Other linux compilers would need to change other details }
  145. {---------------------------------------------------------------------------}
  146. {$IFDEF LINUX}
  147. {$UNDEF OS_DOS}
  148. {$DEFINE OS_LINUX}
  149. {$DEFINE OS_UNIX}
  150. {$ENDIF}
  151. {$IFDEF FreeBSD}
  152. {$UNDEF OS_DOS}
  153. {$DEFINE OS_FREEBSD}
  154. {$DEFINE OS_UNIX}
  155. {$ENDIF}
  156. {$IFDEF NETBSD}
  157. {$UNDEF OS_DOS}
  158. {$DEFINE OS_NETBSD}
  159. {$DEFINE OS_UNIX}
  160. {$ENDIF}
  161. {$IFDEF Darwin}
  162. {$UNDEF OS_DOS}
  163. {$DEFINE OS_DARWIN}
  164. {$DEFINE OS_UNIX}
  165. {$ENDIF}
  166. {$IFDEF SOLARIS}
  167. {$UNDEF OS_DOS}
  168. {$DEFINE OS_SOLARIS}
  169. {$DEFINE OS_UNIX}
  170. {$ENDIF}
  171. {------------------------------------------------}
  172. { FPC Netware COMPILER changes operating system }
  173. {------------------------------------------------}
  174. {$IFDEF Netware}
  175. {$UNDEF OS_DOS}
  176. {$DEFINE OS_NETWARE}
  177. {$IFDEF NETWARE_LIBC}
  178. {$DEFINE OS_NETWARE_LIBC}
  179. {$ELSE}
  180. {$DEFINE OS_NETWARE_CLIB}
  181. {$ENDIF}
  182. {$DEFINE HasSysMsgUnit}
  183. {$ENDIF}
  184. {---------------------------------------------------------------------------}
  185. { FPC GO32V2 COMPILER changes operating system - Updated 27Aug98 LdB }
  186. {---------------------------------------------------------------------------}
  187. {$IFDEF GO32V2}
  188. {$DEFINE OS_GO32}
  189. {$ENDIF}
  190. {---------------------------------------------------------------------------}
  191. { 32 BIT WINDOWS COMPILERS changes bit size - Updated 27Aug98 LdB }
  192. {---------------------------------------------------------------------------}
  193. {$IFDEF WIN32}
  194. {$IFNDEF WINDOWS}
  195. {$DEFINE WINDOWS}
  196. {$ENDIF}
  197. {$UNDEF BIT_16}
  198. {$DEFINE BIT_32}
  199. {$ENDIF}
  200. {---------------------------------------------------------------------------}
  201. { WINDOWS COMPILERS change op system and proc mode - Updated 03Nov99 LdB }
  202. {---------------------------------------------------------------------------}
  203. {$IFDEF WINDOWS}
  204. {$UNDEF OS_DOS}
  205. {$DEFINE OS_WINDOWS}
  206. {$UNDEF PROC_Real}
  207. {$DEFINE PROC_Protected}
  208. {$IFDEF FPC}
  209. {$DEFINE WIN32}
  210. {$ENDIF}
  211. {$ENDIF}
  212. {---------------------------------------------------------------------------}
  213. { DELPHI1 COMPILER changes compiler type - Updated 27Aug98 LdB }
  214. {---------------------------------------------------------------------------}
  215. {$IFDEF VER80}
  216. {$UNDEF PPC_BP}
  217. {$DEFINE PPC_DELPHI}
  218. {$ENDIF}
  219. {---------------------------------------------------------------------------}
  220. { DELPHI2 COMPILER changes compiler type - Updated 27Aug98 LdB }
  221. {---------------------------------------------------------------------------}
  222. {$IFDEF VER90}
  223. {$UNDEF PPC_BP}
  224. {$DEFINE PPC_DELPHI}
  225. {$DEFINE PPC_DELPHI2}
  226. {$ENDIF}
  227. {---------------------------------------------------------------------------}
  228. { DELPHI3 COMPILER changes compiler type - Updated 27Aug98 LdB }
  229. {---------------------------------------------------------------------------}
  230. {$IFDEF VER100}
  231. {$UNDEF PPC_BP}
  232. {$DEFINE PPC_DELPHI}
  233. {$DEFINE PPC_DELPHI3}
  234. {$UNDEF BP_VMTLink}
  235. {$ENDIF}
  236. {---------------------------------------------------------------------------}
  237. { DELPHI4 COMPILER changes compiler type - Updated 25Oct98 pfv }
  238. {---------------------------------------------------------------------------}
  239. {$IFDEF VER120}
  240. {$UNDEF PPC_BP}
  241. {$DEFINE PPC_DELPHI}
  242. {$DEFINE PPC_DELPHI3}
  243. {$DEFINE PPC_DELPHI4}
  244. {$UNDEF BP_VMTLink}
  245. {$ENDIF}
  246. {---------------------------------------------------------------------------}
  247. { DELPHI5 COMPILER changes compiler type - Updated 04Nov99 pfv }
  248. {---------------------------------------------------------------------------}
  249. {$IFDEF VER130}
  250. {$UNDEF PPC_BP}
  251. {$DEFINE PPC_DELPHI}
  252. {$DEFINE PPC_DELPHI3}
  253. {$DEFINE PPC_DELPHI4}
  254. {$DEFINE PPC_DELPHI5}
  255. {$UNDEF BP_VMTLink
  256. }
  257. {$ENDIF}
  258. {---------------------------------------------------------------------------}
  259. { OS2 COMPILERS change compiler type and mode - Updated 27Aug98 LdB }
  260. { Note: Assumes BPOS2 16BIT OS2 patch except for FPC which undefines this }
  261. {---------------------------------------------------------------------------}
  262. {$IFDEF OS2}
  263. {$UNDEF OS_DOS}
  264. {$DEFINE OS_OS2}
  265. {$UNDEF PROC_Real}
  266. {$DEFINE PROC_Protected}
  267. {$UNDEF PPC_BP}
  268. {$DEFINE PPC_BPOS2}
  269. {$IFDEF FPC}
  270. {$UNDEF PPC_BPOS2}
  271. {$ENDIF}
  272. {$ENDIF}
  273. {---------------------------------------------------------------------------}
  274. { VIRTUAL PASCAL changes compiler type/32 bit - Updated 27Aug98 LdB }
  275. { Note: VP2 can compile win 32 code so changes op system as needed }
  276. {---------------------------------------------------------------------------}
  277. {$IFDEF VirtualPascal}
  278. {$UNDEF BIT_16}
  279. {$DEFINE BIT_32}
  280. {$IFDEF PPC_BPOS2}
  281. {$UNDEF PPC_BPOS2}
  282. {$ENDIF}
  283. {$DEFINE PPC_VIRTUAL}
  284. {$IFDEF WIN32}
  285. {$UNDEF PPC_BP}
  286. {$UNDEF OS_OS2}
  287. {$DEFINE OS_WINDOWS}
  288. {$ENDIF}
  289. {$ENDIF}
  290. {---------------------------------------------------------------------------}
  291. { SPEED COMPILER changes compiler type/32 bit - Updated 27Aug98 LdB }
  292. {---------------------------------------------------------------------------}
  293. {$IFDEF Speed}
  294. {$UNDEF BIT_16}
  295. {$DEFINE BIT_32}
  296. {$UNDEF PPC_BPOS2}
  297. {$DEFINE PPC_SPEED}
  298. {$UNDEF BP_VMTLink}
  299. {$ENDIF}
  300. {---------------------------------------------------------------------------}
  301. { FPC AMIGA COMPILER changes op system and CPU type - Updated 27Aug98 LdB }
  302. {---------------------------------------------------------------------------}
  303. {$IFDEF AMIGA}
  304. {$UNDEF OS_DOS}
  305. {$DEFINE OS_AMIGA}
  306. {$IFDEF CPU86}
  307. {$UNDEF CPU86}
  308. {$ENDIF}
  309. {$IFNDEF CPU68}
  310. {$DEFINE CPU68}
  311. {$ENDIF}
  312. {$ENDIF}
  313. {---------------------------------------------------------------------------}
  314. { FPC ATARI COMPILER changes op system and CPU type - Updated 27Aug98 LdB }
  315. {---------------------------------------------------------------------------}
  316. {$IFDEF ATARI}
  317. {$UNDEF OS_DOS}
  318. {$DEFINE OS_ATARI}
  319. {$IFDEF CPU86}
  320. {$UNDEF CPU86}
  321. {$ENDIF}
  322. {$IFNDEF CPU68}
  323. {$DEFINE CPU68}
  324. {$ENDIF}
  325. {$ENDIF}
  326. {---------------------------------------------------------------------------}
  327. { FPC MAC COMPILER changes op system and CPU type - Updated 27Aug98 LdB }
  328. {---------------------------------------------------------------------------}
  329. {$IFDEF MACOS}
  330. {$UNDEF OS_DOS}
  331. {$DEFINE OS_MAC}
  332. {$IFDEF CPU86}
  333. {$UNDEF CPU86}
  334. {$ENDIF}
  335. {$IFNDEF CPU68}
  336. {$DEFINE CPU68}
  337. {$ENDIF}
  338. {$ENDIF}
  339. {$IFDEF OS_DOS}
  340. {$DEFINE NO_WINDOW}
  341. {$ENDIF}
  342. {---------------------------------------------------------------------------}
  343. { WIN16 AND WIN32 set if in windows - Updated 16Oct2000 LdB }
  344. {---------------------------------------------------------------------------}
  345. {$IFDEF OS_WINDOWS} { WINDOWS SYSTEM }
  346. {$IFDEF BIT_16}
  347. {$DEFINE WIN16} { 16 BIT WINDOWS }
  348. {$ENDIF}
  349. {$IFDEF BIT_32}
  350. {$DEFINE WIN32} { 32 BIT WINDOWS }
  351. {$ENDIF}
  352. {$ENDIF}