jsystemh_types.inc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. {
  2. This file contains the OS independent declarations of the system unit
  3. This file is part of the Free Pascal Run time library.
  4. Copyright (c) 1999-2005 by the Free Pascal development team
  5. See the File COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {****************************************************************************
  12. Needed switches
  13. ****************************************************************************}
  14. {$I-,Q-,H-,R-,V-}
  15. {$mode objfpc}
  16. { At least 2.4.0 is required }
  17. {$if defined(VER1) or defined(VER2_0) or defined(VER2_2) }
  18. {$fatal You need at least FPC 2.4.0 to build this version of FPC}
  19. {$endif}
  20. { Using inlining for small system functions/wrappers }
  21. {$inline on}
  22. {$define SYSTEMINLINE}
  23. { don't use FPU registervariables on the i386 }
  24. {$ifdef CPUI386}
  25. {$maxfpuregisters 0}
  26. {$endif CPUI386}
  27. { the assembler helpers need this}
  28. {$ifdef CPUPOWERPC}
  29. {$goto+}
  30. {$endif CPUPOWERPC}
  31. {$ifdef CPUAVR}
  32. {$goto+}
  33. {$endif CPUAVR}
  34. { needed for insert,delete,readln }
  35. {$P+}
  36. { stack checking always disabled
  37. for system unit. This is because
  38. the startup code might not
  39. have been called yet when we
  40. get a stack error, this will
  41. cause big crashes
  42. }
  43. {$S-}
  44. {****************************************************************************
  45. Global Types and Constants
  46. ****************************************************************************}
  47. Type
  48. { The compiler has all integer types defined internally. Here
  49. we define only aliases }
  50. DWord = LongWord;
  51. Cardinal = LongWord;
  52. Integer = SmallInt;
  53. UInt64 = QWord;
  54. { moved here from psystem.pas
  55. Delphi allows chose of overloaded procedure depending
  56. on Real <-> Double, so use type here, see also tw7425.pp (FK) }
  57. {$ifndef FPUNONE}
  58. Real = type Double;
  59. {$endif}
  60. {$ifdef CPUI386}
  61. {$define CPU32}
  62. {$define DEFAULT_EXTENDED}
  63. {$define SUPPORT_SINGLE}
  64. {$define SUPPORT_DOUBLE}
  65. {$define SUPPORT_EXTENDED}
  66. {$define SUPPORT_COMP}
  67. {$ifndef FPUNONE}
  68. ValReal = Extended;
  69. {$endif}
  70. {$endif CPUI386}
  71. {$ifdef CPUX86_64}
  72. {$ifdef FPC_HAS_TYPE_EXTENDED}
  73. { win64 doesn't support the legacy fpu }
  74. {$define DEFAULT_EXTENDED}
  75. {$define SUPPORT_EXTENDED}
  76. {$define SUPPORT_COMP}
  77. {$ifndef FPUNONE}
  78. ValReal = Extended;
  79. {$endif}
  80. {$else FPC_HAS_TYPE_EXTENDED}
  81. {$define DEFAULT_DOUBLE}
  82. {$ifndef FPUNONE}
  83. ValReal = Double;
  84. {$endif}
  85. { map comp to int64, but this doesn't mean we compile the comp support in! }
  86. Comp = Int64;
  87. PComp = ^Comp;
  88. {$endif FPC_HAS_TYPE_EXTENDED}
  89. {$define SUPPORT_SINGLE}
  90. {$define SUPPORT_DOUBLE}
  91. {$endif CPUX86_64}
  92. {$ifdef CPUM68K}
  93. {$define DEFAULT_DOUBLE}
  94. {$define SUPPORT_SINGLE}
  95. {$define SUPPORT_DOUBLE}
  96. {$ifndef FPUNONE}
  97. ValReal = Real;
  98. {$endif}
  99. { Comp type does not exist on fpu }
  100. Comp = int64;
  101. PComp = ^Comp;
  102. FarPointer = Pointer;
  103. {$endif CPUM68K}
  104. {$ifdef CPUPOWERPC}
  105. {$define DEFAULT_DOUBLE}
  106. {$ifndef FPUNONE}
  107. {$define SUPPORT_SINGLE}
  108. {$define SUPPORT_DOUBLE}
  109. {$define FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
  110. ValReal = Double;
  111. {$endif}
  112. { map comp to int64, but this doesn't mean we compile the comp support in! }
  113. Comp = Int64;
  114. PComp = ^Comp;
  115. FarPointer = Pointer;
  116. {$endif CPUPOWERPC}
  117. {$ifdef CPUSPARC}
  118. {$define DEFAULT_DOUBLE}
  119. {$define SUPPORT_SINGLE}
  120. {$define SUPPORT_DOUBLE}
  121. {$define FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
  122. {$ifndef FPUNONE}
  123. ValReal = Double;
  124. {$endif}
  125. { map comp to int64, but this doesn't mean we compile the comp support in! }
  126. Comp = Int64;
  127. PComp = ^Comp;
  128. FarPointer = Pointer;
  129. {$endif CPUSPARC}
  130. {$ifdef CPUARM}
  131. {$define DEFAULT_DOUBLE}
  132. {$define SUPPORT_SINGLE}
  133. {$define SUPPORT_DOUBLE}
  134. {$define FPC_INCLUDE_SOFTWARE_MOD_DIV}
  135. {$define FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
  136. {$define FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
  137. {$ifndef FPUNONE}
  138. ValReal = Real;
  139. {$endif}
  140. { map comp to int64, but this doesn't mean we compile the comp support in! }
  141. Comp = Int64;
  142. PComp = ^Comp;
  143. FarPointer = Pointer;
  144. {$endif CPUARM}
  145. {$ifdef CPUAVR}
  146. {$define DEFAULT_SINGLE}
  147. {$define FPC_INCLUDE_SOFTWARE_MOD_DIV}
  148. {$define FPC_INCLUDE_SOFTWARE_MUL}
  149. {$define FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
  150. {$ifndef FPUNONE}
  151. {$define SUPPORT_SINGLE}
  152. {$define SUPPORT_DOUBLE}
  153. {$define FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
  154. ValReal = Real;
  155. {$endif}
  156. { map comp to int64, but this doesn't mean we compile the comp support in! }
  157. Comp = Int64;
  158. PComp = ^Comp;
  159. FarPointer = Pointer;
  160. {$endif CPUARM}
  161. {$ifdef CPUJVM}
  162. {$define DEFAULT_DOUBLE}
  163. {$define SUPPORT_SINGLE}
  164. {$define SUPPORT_DOUBLE}
  165. ValReal = Double;
  166. { map comp to int64, but this doesn't mean we compile the comp support in! }
  167. Comp = Int64;
  168. PComp = ^Comp;
  169. {$endif CPUJVM}
  170. {$ifdef CPU64}
  171. SizeInt = Int64;
  172. SizeUInt = QWord;
  173. PtrInt = Int64;
  174. PtrUInt = QWord;
  175. ValSInt = int64;
  176. ValUInt = qword;
  177. {$endif CPU64}
  178. {$ifdef CPU32}
  179. SizeInt = Longint;
  180. SizeUInt = DWord;
  181. PtrInt = Longint;
  182. PtrUInt = DWord;
  183. ValSInt = Longint;
  184. ValUInt = Cardinal;
  185. {$endif CPU32}
  186. {$ifdef CPU16}
  187. SizeInt = Integer;
  188. SizeUInt = Word;
  189. PtrInt = Integer;
  190. PtrUInt = Word;
  191. ValSInt = Integer;
  192. ValUInt = Word;
  193. {$endif CPU16}
  194. NativeInt = PtrInt;
  195. NativeUint = PtrUint;
  196. (*
  197. { Zero - terminated strings }
  198. PChar = ^Char;
  199. PPChar = ^PChar;
  200. PPPChar = ^PPChar;
  201. *)
  202. { AnsiChar is equivalent of Char, so we need
  203. to use type renamings }
  204. TAnsiChar = Char;
  205. AnsiChar = Char;
  206. (*
  207. PAnsiChar = PChar;
  208. PPAnsiChar = PPChar;
  209. *)
  210. UCS4Char = type 0..$10ffff;
  211. (*
  212. PUCS4Char = ^UCS4Char;
  213. *)
  214. {$ifdef CPU16}
  215. TUCS4CharArray = array[0..32767 div sizeof(UCS4Char)-1] of UCS4Char;
  216. {$else CPU16}
  217. TUCS4CharArray = array[0..$effffff] of UCS4Char;
  218. {$endif CPU16}
  219. (*
  220. PUCS4CharArray = ^TUCS4CharArray;
  221. *)
  222. UCS4String = array of UCS4Char;
  223. UTF8String = type ansistring;
  224. (*
  225. PUTF8String = ^UTF8String;
  226. *)
  227. HRESULT = type Longint;
  228. {$ifndef FPUNONE}
  229. TDateTime = type Double;
  230. TDate = type TDateTime;
  231. TTime = type TDateTime;
  232. {$endif}
  233. TError = type Longint;
  234. {$ifndef FPUNONE}
  235. (*
  236. PSingle = ^Single;
  237. PDouble = ^Double;
  238. PExtended = ^Extended;
  239. PPDouble = ^PDouble;
  240. *)
  241. {$endif}
  242. (*
  243. PCurrency = ^Currency;
  244. *)
  245. {$ifdef SUPPORT_COMP}
  246. (*
  247. PComp = ^Comp;
  248. *)
  249. {$endif SUPPORT_COMP}
  250. (*
  251. PSmallInt = ^Smallint;
  252. PShortInt = ^Shortint;
  253. PInteger = ^Integer;
  254. PByte = ^Byte;
  255. PWord = ^word;
  256. PDWord = ^DWord;
  257. PLongWord = ^LongWord;
  258. PLongint = ^Longint;
  259. PCardinal = ^Cardinal;
  260. PQWord = ^QWord;
  261. PInt64 = ^Int64;
  262. PPtrInt = ^PtrInt;
  263. PPtrUInt = ^PtrUInt;
  264. PSizeInt = ^SizeInt;
  265. PPByte = ^PByte;
  266. PPLongint = ^PLongint;
  267. PPointer = ^Pointer;
  268. PPPointer = ^PPointer;
  269. PBoolean = ^Boolean;
  270. PWordBool = ^WordBool;
  271. PLongBool = ^LongBool;
  272. *)
  273. PShortString = ^ShortString;
  274. (*
  275. PAnsiString = ^AnsiString;
  276. {$ifndef FPUNONE}
  277. PDate = ^TDateTime;
  278. PDateTime = ^TDateTime;
  279. {$endif}
  280. PError = ^TError;
  281. PVariant = ^Variant;
  282. POleVariant = ^OleVariant;
  283. PWideChar = ^WideChar;
  284. PPWideChar = ^PWideChar;
  285. PPPWideChar = ^PPWideChar;
  286. *)
  287. WChar = Widechar;
  288. UCS2Char = WideChar;
  289. (*
  290. PUCS2Char = PWideChar;
  291. PWideString = ^WideString;
  292. *)
  293. UnicodeChar = WideChar;
  294. (*
  295. PUnicodeChar = ^UnicodeChar;
  296. PUnicodeString = ^UnicodeString;
  297. { Needed for fpc_get_output }
  298. PText = ^Text;
  299. *)
  300. TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
  301. { procedure type }
  302. TProcedure = Procedure;
  303. { platform dependent types }
  304. {$i sysosh.inc}
  305. (*
  306. type
  307. TEntryInformation = record
  308. InitFinalTable : Pointer;
  309. ThreadvarTablesTable : Pointer;
  310. asm_exit : Procedure;stdcall;
  311. PascalMain : Procedure;stdcall;
  312. valgrind_used : boolean;
  313. end;
  314. *)
  315. const
  316. { Maximum value of the biggest signed and unsigned integer type available}
  317. MaxSIntValue = High(ValSInt);
  318. MaxUIntValue = High(ValUInt);
  319. { max. values for longint and int}
  320. maxLongint = $7fffffff;
  321. maxSmallint = 32767;
  322. maxint = maxsmallint;
  323. type
  324. {$ifdef CPU16}
  325. IntegerArray = array[0..maxSmallint div sizeof(Integer)-1] of Integer;
  326. {$else CPU16}
  327. IntegerArray = array[0..$effffff] of Integer;
  328. {$endif CPU16}
  329. PIntegerArray = ^IntegerArray;
  330. {$ifdef CPU16}
  331. PointerArray = array [0..32767 div sizeof(Pointer)-1] of Pointer;
  332. {$else CPU16}
  333. PointerArray = array [0..512*1024*1024-2] of Pointer;
  334. {$endif CPU16}
  335. (*
  336. PPointerArray = ^PointerArray;
  337. *)
  338. TBoundArray = array of SizeInt;
  339. (*
  340. {$ifdef CPU16}
  341. TPCharArray = packed array[0..(MaxSmallint div SizeOf(PChar))-1] of PChar;
  342. {$else CPU16}
  343. TPCharArray = packed array[0..(MaxLongint div SizeOf(PChar))-1] of PChar;
  344. {$endif CPU16}
  345. PPCharArray = ^TPCharArray;
  346. *)
  347. (* CtrlBreak set to true signalizes Ctrl-Break signal, otherwise Ctrl-C. *)
  348. (* Return value of true means that the signal has been processed, false *)
  349. (* means that default handling should be used. *)
  350. (*
  351. TCtrlBreakHandler = function (CtrlBreak: boolean): boolean;
  352. *)
  353. const
  354. {$ifdef cpui386}
  355. { Always i386 or newer }
  356. Test8086 : byte = 2;
  357. { Always 387 or newer. Emulated if needed. }
  358. Test8087 : byte = 3;
  359. { will be detected at startup }
  360. has_sse_support : boolean = false;
  361. has_mmx_support : boolean = false;
  362. {$endif cpui386}
  363. {$ifdef cpum68k}
  364. Test68000 : byte = 0; { Must be determined at startup for both }
  365. Test68881 : byte = 0;
  366. {$endif cpum68k}
  367. { max level in dumping on error }
  368. Max_Frame_Dump : Word = 8;
  369. (*
  370. { Exit Procedure handling consts and types }
  371. ExitProc : pointer = nil;
  372. Erroraddr: pointer = nil;
  373. *)
  374. Errorcode: Word = 0;
  375. { file input modes }
  376. fmClosed = $D7B0;
  377. fmInput = $D7B1;
  378. fmOutput = $D7B2;
  379. fmInOut = $D7B3;
  380. fmAppend = $D7B4;
  381. Filemode : byte = 2;
  382. (* Value should be changed during system initialization as appropriate. *)
  383. { assume that this program will not spawn other threads, when the
  384. first thread is started the following constants need to be filled }
  385. IsMultiThread : longbool = FALSE;
  386. { set to true, if a threading helper is used before a thread
  387. manager has been installed }
  388. ThreadingAlreadyUsed : boolean = FALSE;
  389. { Indicates if there was an error }
  390. StackError : boolean = FALSE;
  391. (*
  392. InitProc : Pointer = nil;
  393. *)
  394. { compatibility }
  395. ModuleIsLib : Boolean = FALSE;
  396. ModuleIsPackage : Boolean = FALSE;
  397. ModuleIsCpp : Boolean = FALSE;
  398. var
  399. ExitCode : Longint; (* public name 'operatingsystem_result'; *)
  400. RandSeed : Cardinal;
  401. { Delphi compatibility }
  402. IsLibrary : boolean = false;
  403. IsConsole : boolean;
  404. { Threading support }
  405. fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
  406. (*
  407. {$ifndef HAS_CMDLINE}
  408. {Value should be changed during system initialization as appropriate.}
  409. var cmdline:Pchar=nil;
  410. {$endif}
  411. *)
  412. (*
  413. ThreadVar
  414. ThreadID : TThreadID;
  415. { Standard In- and Output }
  416. ErrOutput,
  417. Output,
  418. Input,
  419. StdOut,
  420. StdErr : Text;
  421. InOutRes : Word;
  422. { Stack checking }
  423. StackTop,
  424. StackBottom : Pointer;
  425. StackLength : SizeUInt;
  426. *)
  427. { Numbers for routines that have compiler magic }
  428. {$I innr.inc}