systemh.inc 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. This File contains the OS independent declarations of the system unit
  6. See the File COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {****************************************************************************
  13. Needed switches
  14. ****************************************************************************}
  15. {$I-,Q-,H-,R-,V-}
  16. {$mode objfpc}
  17. { Using inlining for small system functions/wrappers }
  18. {$ifdef HASINLINE}
  19. {$inline on}
  20. {$define SYSTEMINLINE}
  21. {$endif}
  22. { Use threadvars when the compiler supports it }
  23. {$ifdef HASTHREADVAR}
  24. {$define SUPPORT_THREADVAR}
  25. {$endif HASTHREADVAR}
  26. { don't use FPU registervariables on the i386 }
  27. {$ifdef i386}
  28. {$maxfpuregisters 0}
  29. {$endif i386}
  30. { needed for insert,delete,readln }
  31. {$P+}
  32. { stack checking always disabled
  33. for system unit. This is because
  34. the startup code might not
  35. have been called yet when we
  36. get a stack error, this will
  37. cause big crashes
  38. }
  39. {$S-}
  40. {****************************************************************************
  41. Global Types and Constants
  42. ****************************************************************************}
  43. Type
  44. ShortInt = -128..127;
  45. SmallInt = -32768..32767;
  46. { can't use -2147483648 because of a bug in 1.0.2's val() procedure (JM) }
  47. Longint = +(-2147483647-1)..$7fffffff;
  48. Byte = 0..255;
  49. Word = 0..65535;
  50. {$ifndef ver1_0}
  51. DWord = LongWord;
  52. Cardinal = LongWord;
  53. {$else}
  54. Longword = cardinal;
  55. Dword = cardinal;
  56. {$endif}
  57. Integer = SmallInt;
  58. {$ifdef i386}
  59. StrLenInt = LongInt;
  60. {$define DEFAULT_EXTENDED}
  61. {$define SUPPORT_SINGLE}
  62. {$define SUPPORT_DOUBLE}
  63. {$define SUPPORT_EXTENDED}
  64. {$define SUPPORT_COMP}
  65. ValSInt = Longint;
  66. ValUInt = Cardinal;
  67. ValReal = Extended;
  68. {$endif i386}
  69. {$ifdef x86_64}
  70. StrLenInt = LongInt;
  71. {$define DEFAULT_EXTENDED}
  72. {$define SUPPORT_SINGLE}
  73. {$define SUPPORT_DOUBLE}
  74. {$define SUPPORT_EXTENDED}
  75. {$define SUPPORT_COMP}
  76. ValSInt = Longint;
  77. ValUInt = Cardinal;
  78. ValReal = Extended;
  79. {$endif x86_64}
  80. {$ifdef m68k}
  81. StrLenInt = Longint;
  82. ValSInt = Longint;
  83. ValUInt = Cardinal;
  84. ValReal = Real;
  85. { Comp type does not exist on fpu }
  86. Comp = int64;
  87. {$define SUPPORT_SINGLE}
  88. {$IFDEF Unix}
  89. { Linux FPU emulator will be used }
  90. {$define SUPPORT_DOUBLE}
  91. {$ENDIF}
  92. {$IFOPT E-}
  93. { If not compiling with emulation }
  94. { then support double type. }
  95. {$define SUPPORT_DOUBLE}
  96. {$ENDIF}
  97. {$endif}
  98. {$ifdef powerpc}
  99. StrLenInt = LongInt;
  100. {$define DEFAULT_DOUBLE}
  101. {$define SUPPORT_SINGLE}
  102. {$define SUPPORT_DOUBLE}
  103. ValSInt = Longint;
  104. ValUInt = Cardinal;
  105. ValReal = Double;
  106. { map comp to int64, but this doesn't mean to compile the comp support in! }
  107. Comp = Int64;
  108. {$endif powerpc}
  109. { Zero - terminated strings }
  110. PChar = ^Char;
  111. PPChar = ^PChar;
  112. TAnsiChar = Char;
  113. AnsiChar = TAnsiChar;
  114. PAnsiChar = ^TAnsiChar;
  115. PPAnsiChar = ^PAnsiChar;
  116. UCS4Char = Cardinal;
  117. PUCS4Char = ^UCS4Char;
  118. {$ifndef HASCURRENCY}
  119. Currency = Int64;
  120. {$endif HASCURRENCY}
  121. HRESULT = Longint;
  122. TDateTime = Double;
  123. Error = Longint;
  124. PSingle = ^Single;
  125. PDouble = ^Double;
  126. PCurrency = ^Currency;
  127. {$ifdef SUPPORT_COMP}
  128. PComp = ^Comp;
  129. {$endif SUPPORT_COMP}
  130. PExtended = ^Extended;
  131. PSmallInt = ^Smallint;
  132. PShortInt = ^Shortint;
  133. PInteger = ^Longint;
  134. PByte = ^Byte;
  135. PWord = ^word;
  136. PDWord = ^DWord;
  137. PLongWord = ^LongWord;
  138. PLongint = ^Longint;
  139. PCardinal = ^Cardinal;
  140. PQWord = ^QWord;
  141. PInt64 = ^Int64;
  142. PPointer = ^Pointer;
  143. PPPointer = ^PPointer;
  144. PBoolean = ^Boolean;
  145. PWordBool = ^WordBool;
  146. PLongBool = ^LongBool;
  147. PShortString = ^ShortString;
  148. PAnsiString = ^AnsiString;
  149. PDate = ^TDateTime;
  150. PError = ^Error;
  151. {$ifdef HASVARIANT}
  152. PVariant = ^Variant;
  153. {$endif HASVARIANT}
  154. {$ifdef HASWIDECHAR}
  155. PWideChar = ^WideChar;
  156. PPWideChar = ^PWideChar;
  157. { 1.0.x also has HASWIDECHAR defined, but doesn't support it
  158. fully, setting WChar to Word as fallback (PFV) }
  159. {$ifndef VER1_0}
  160. WChar = Widechar;
  161. {$else}
  162. WChar = Word;
  163. {$endif}
  164. {$else}
  165. WChar = Word;
  166. {$endif HASWIDECHAR}
  167. {$ifdef HASWIDESTRING}
  168. PWideString = ^WideString;
  169. {$endif HASWIDESTRING}
  170. TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
  171. { procedure type }
  172. TProcedure = Procedure;
  173. const
  174. { Maximum value of the biggest signed and unsigned integer type available}
  175. MaxSIntValue = High(ValSInt);
  176. MaxUIntValue = High(ValUInt);
  177. { max. values for longint and int}
  178. maxLongint = $7fffffff;
  179. maxSmallint = 32767;
  180. const
  181. maxint = maxsmallint;
  182. { Compatibility With TP }
  183. const
  184. {$ifdef i386}
  185. Test8086 : byte = 2; { Always i386 or newer }
  186. Test8087 : byte = 3; { Always 387 or newer. Emulated if needed. }
  187. {$endif i386}
  188. {$ifdef m68k}
  189. Test68000 : byte = 0; { Must be determined at startup for both }
  190. Test68881 : byte = 0;
  191. {$endif}
  192. { max level in dumping on error }
  193. Max_Frame_Dump : Word = 8;
  194. { Exit Procedure handling consts and types }
  195. ExitProc : pointer = nil;
  196. Erroraddr: pointer = nil;
  197. Errorcode: Word = 0;
  198. { file input modes }
  199. fmClosed = $D7B0;
  200. fmInput = $D7B1;
  201. fmOutput = $D7B2;
  202. fmInOut = $D7B3;
  203. fmAppend = $D7B4;
  204. Filemode : byte = 2;
  205. CmdLine : PChar = nil;
  206. { assume that this program will not spawn other threads, when the
  207. first thread is started the following constants need to be filled }
  208. IsMultiThread : boolean = FALSE;
  209. { Indicates if there was an error }
  210. StackError : boolean = FALSE;
  211. var
  212. ExitCode : Word;
  213. RandSeed : Cardinal;
  214. { Delphi compatibility }
  215. IsLibrary : boolean;
  216. IsConsole : boolean;
  217. { Threading support }
  218. fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
  219. {$ifdef SUPPORT_THREADVAR}
  220. ThreadVar
  221. {$else SUPPORT_THREADVAR}
  222. Var
  223. {$endif SUPPORT_THREADVAR}
  224. { Standard In- and Output }
  225. Output,
  226. Input,
  227. StdOut,
  228. StdErr : Text;
  229. InOutRes : Word;
  230. { Stack checking }
  231. StackBottom,
  232. StackLength : Cardinal;
  233. {****************************************************************************
  234. Processor specific routines
  235. ****************************************************************************}
  236. Procedure Move(const source;var dest;count:Longint);
  237. Procedure FillChar(Var x;count:Longint;Value:Boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
  238. Procedure FillChar(Var x;count:Longint;Value:Char);{$ifdef SYSTEMINLINE}inline;{$endif}
  239. Procedure FillChar(Var x;count:Longint;Value:Byte);
  240. procedure FillByte(var x;count:longint;value:byte);
  241. Procedure FillWord(Var x;count:Longint;Value:Word);
  242. procedure FillDWord(var x;count:longint;value:DWord);
  243. function IndexChar(const buf;len:longint;b:char):longint;
  244. function IndexByte(const buf;len:longint;b:byte):longint;
  245. function Indexword(const buf;len:longint;b:word):longint;
  246. function IndexDWord(const buf;len:longint;b:DWord):longint;
  247. function CompareChar(const buf1,buf2;len:longint):longint;
  248. function CompareByte(const buf1,buf2;len:longint):longint;
  249. function CompareWord(const buf1,buf2;len:longint):longint;
  250. function CompareDWord(const buf1,buf2;len:longint):longint;
  251. procedure MoveChar0(const buf1;var buf2;len:longint);
  252. function IndexChar0(const buf;len:longint;b:char):longint;
  253. function CompareChar0(const buf1,buf2;len:longint):longint;
  254. {****************************************************************************
  255. Math Routines
  256. ****************************************************************************}
  257. Function lo(w:Word):byte;
  258. Function lo(l:Longint):Word;
  259. Function lo(l:DWord):Word;
  260. Function lo(i:Integer):byte;
  261. Function lo(B: Byte):Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
  262. Function hi(w:Word):byte;
  263. Function hi(i:Integer):byte;
  264. Function hi(l:Longint):Word;
  265. Function hi(b : Byte) : Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
  266. Function hi(l: DWord): Word;
  267. Function lo(q : QWord) : DWord;
  268. Function lo(i : Int64) : DWord;
  269. Function hi(q : QWord) : DWord;
  270. Function hi(i : Int64) : DWord;
  271. Function Swap (X:Word):Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  272. Function Swap (X:Integer):Integer;{$ifdef SYSTEMINLINE}inline;{$endif}
  273. Function Swap (X:Cardinal):Cardinal;{$ifdef SYSTEMINLINE}inline;{$endif}
  274. Function Swap (X:LongInt):LongInt;{$ifdef SYSTEMINLINE}inline;{$endif}
  275. Function Swap (X:QWord):QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
  276. Function Swap (X:Int64):Int64;{$ifdef SYSTEMINLINE}inline;{$endif}
  277. Function Random(l:cardinal):cardinal;
  278. Function Random(l:longint):longint;
  279. Function Random: extended;
  280. Procedure Randomize;
  281. Function abs(l:Longint):Longint;{$ifdef SYSTEMINLINE}inline;{$endif}
  282. Function abs(l:Int64):Int64;{$ifdef SYSTEMINLINE}inline;{$endif}
  283. Function sqr(l:Longint):Longint;{$ifdef SYSTEMINLINE}inline;{$endif}
  284. Function sqr(l:Int64):Int64;{$ifdef SYSTEMINLINE}inline;{$endif}
  285. Function sqr(l:QWord):QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
  286. Function odd(l:Longint):Boolean;{$ifdef SYSTEMINLINE}inline;{$endif}
  287. Function odd(l:Longword):Boolean;{$ifdef SYSTEMINLINE}inline;{$endif}
  288. Function odd(l:Int64):Boolean;{$ifdef SYSTEMINLINE}inline;{$endif}
  289. Function odd(l:QWord):Boolean;{$ifdef SYSTEMINLINE}inline;{$endif}
  290. { float math routines }
  291. {$I mathh.inc}
  292. {****************************************************************************
  293. Addr/Pointer Handling
  294. ****************************************************************************}
  295. Function ptr(sel,off:Longint):farpointer;{$ifdef SYSTEMINLINE}inline;{$endif}
  296. Function Cseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  297. Function Dseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  298. Function Sseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  299. {****************************************************************************
  300. PChar and String Handling
  301. ****************************************************************************}
  302. function strpas(p:pchar):shortstring;
  303. function strlen(p:pchar):longint;
  304. { Shortstring functions }
  305. {$ifndef INTERNSETLENGTH}
  306. Procedure SetLength (Var S:ShortString;len:StrLenInt);
  307. {$endif INTERNSETLENGTH}
  308. {$ifndef InternCopy}
  309. Function Copy(const s:shortstring;index:StrLenInt;count:StrLenInt):shortstring;
  310. {$endif interncopy}
  311. Procedure Delete(Var s:shortstring;index:StrLenInt;count:StrLenInt);
  312. Procedure Insert(const source:shortstring;Var s:shortstring;index:StrLenInt);
  313. Procedure Insert(source:Char;Var s:shortstring;index:StrLenInt);
  314. Function Pos(const substr:shortstring;const s:shortstring):StrLenInt;
  315. Function Pos(C:Char;const s:shortstring):StrLenInt;
  316. Procedure SetString (Var S : Shortstring; Buf : PChar; Len : Longint);
  317. Procedure SetString (Var S : AnsiString; Buf : PChar; Len : Longint);
  318. {$ifndef INTERNLENGTH}
  319. Function Length(s:string):byte;
  320. {$endif INTERNLENGTH}
  321. Function upCase(const s:shortstring):shortstring;
  322. Function lowerCase(const s:shortstring):shortstring; overload;
  323. Function Space(b:byte):shortstring;
  324. Function hexStr(Val:Longint;cnt:byte):shortstring;
  325. Function OctStr(Val:Longint;cnt:byte):shortstring;
  326. Function binStr(Val:Longint;cnt:byte):shortstring;
  327. Function hexStr(Val:int64;cnt:byte):shortstring;
  328. Function OctStr(Val:int64;cnt:byte):shortstring;
  329. Function binStr(Val:int64;cnt:byte):shortstring;
  330. { Char functions }
  331. Function Chr(b:byte):Char;
  332. Function upCase(c:Char):Char;
  333. Function lowerCase(c:Char):Char; overload;
  334. {$ifndef InternCopy}
  335. function copy(c:char;index : StrLenInt;count : StrLenInt): shortstring;
  336. {$endif interncopy}
  337. function pos(const substr : shortstring;c:char): StrLenInt;
  338. {$ifndef INTERNLENGTH}
  339. function length(c:char):byte;
  340. {$endif INTERNLENGTH}
  341. {****************************************************************************
  342. AnsiString Handling
  343. ****************************************************************************}
  344. {$ifndef INTERNSETLENGTH}
  345. Procedure SetLength (Var S : AnsiString; l : Longint);
  346. {$endif INTERNSETLENGTH}
  347. Procedure UniqueString (Var S : AnsiString);
  348. {$ifndef INTERNLENGTH}
  349. Function Length (Const S : AnsiString) : Longint;
  350. {$endif INTERNLENGTH}
  351. {$ifndef InternCopy}
  352. Function Copy (Const S : AnsiString; Index,Size : Longint) : AnsiString;
  353. {$endif interncopy}
  354. Function Pos (Const Substr : AnsiString; Const Source : AnsiString) : Longint;
  355. Function Pos (c : Char; Const s : AnsiString) : Longint;
  356. Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : Longint);
  357. Procedure Delete (Var S : AnsiString; Index,Size: Longint);
  358. Function StringOfChar(c : char;l : longint) : AnsiString;
  359. function upcase(const s : ansistring) : ansistring;
  360. function lowercase(const s : ansistring) : ansistring;
  361. {****************************************************************************
  362. WideString Handling
  363. ****************************************************************************}
  364. {$ifdef HASWIDESTRING}
  365. {$ifndef INTERNSETLENGTH}
  366. Procedure SetLength (Var S : WideString; l : Longint);
  367. {$endif INTERNSETLENGTH}
  368. Procedure UniqueString (Var S : WideString);
  369. {$ifndef INTERNLENGTH}
  370. Function Length (Const S : WideString) : Longint;
  371. {$endif INTERNLENGTH}
  372. {$ifndef InternCopy}
  373. Function Copy (Const S : WideString; Index,Size : Longint) : WideString;
  374. {$endif interncopy}
  375. Function Pos (Const Substr : WideString; Const Source : WideString) : Longint;
  376. Function Pos (c : Char; Const s : WideString) : Longint;
  377. Function Pos (c : WideChar; Const s : WideString) : Longint;
  378. Procedure Insert (Const Source : WideString; Var S : WideString; Index : Longint);
  379. Procedure Delete (Var S : WideString; Index,Size: Longint);
  380. function WideCharToString(S : PWideChar) : AnsiString;
  381. function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : LongInt) : PWideChar;
  382. function WideCharLenToString(S : PWideChar;Len : LongInt) : AnsiString;
  383. procedure WideCharLenToStrVar(Src : PWideChar;Len : LongInt;var Dest : AnsiString);
  384. procedure WideCharToStrVar(S : PWideChar;var Dest : AnsiString);
  385. {$endif HASWIDESTRING}
  386. {****************************************************************************
  387. Untyped File Management
  388. ****************************************************************************}
  389. Procedure Assign(Var f:File;const Name:string);
  390. Procedure Assign(Var f:File;p:pchar);
  391. Procedure Assign(Var f:File;c:char);
  392. Procedure Rewrite(Var f:File;l:Longint);
  393. Procedure Rewrite(Var f:File);
  394. Procedure Reset(Var f:File;l:Longint);
  395. Procedure Reset(Var f:File);
  396. Procedure Close(Var f:File);
  397. Procedure BlockWrite(Var f:File;Const Buf;Count:Longint;Var Result:Longint);
  398. Procedure BlockWrite(Var f:File;Const Buf;Count:Cardinal;var Result:Cardinal);
  399. Procedure BlockWrite(Var f:File;Const Buf;Count:Word;Var Result:Word);
  400. Procedure BlockWrite(Var f:File;Const Buf;Count:Word;Var Result:Integer);
  401. Procedure BlockWrite(Var f:File;Const Buf;Count:Longint);
  402. Procedure BlockRead(Var f:File;Var Buf;count:Longint;Var Result:Longint);
  403. Procedure BlockRead(Var f:File;Var Buf;count:Cardinal;Var Result:Cardinal);
  404. Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Word);
  405. Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Integer);
  406. Procedure BlockRead(Var f:File;Var Buf;count:Longint);
  407. Function FilePos(Var f:File):Longint;
  408. Function FileSize(Var f:File):Longint;
  409. Procedure Seek(Var f:File;Pos:Longint);
  410. Function EOF(Var f:File):Boolean;
  411. Procedure Erase(Var f:File);
  412. Procedure Rename(Var f:File;const s:string);
  413. Procedure Rename(Var f:File;p:pchar);
  414. Procedure Rename(Var f:File;c:char);
  415. Procedure Truncate (Var F:File);
  416. {****************************************************************************
  417. Typed File Management
  418. ****************************************************************************}
  419. Procedure Assign(Var f:TypedFile;const Name:string);
  420. Procedure Assign(Var f:TypedFile;p:pchar);
  421. Procedure Assign(Var f:TypedFile;c:char);
  422. Procedure Rewrite(Var f:TypedFile);
  423. Procedure Reset(Var f:TypedFile);
  424. {****************************************************************************
  425. Text File Management
  426. ****************************************************************************}
  427. Procedure Assign(Var t:Text;const s:string);
  428. Procedure Assign(Var t:Text;p:pchar);
  429. Procedure Assign(Var t:Text;c:char);
  430. Procedure Close(Var t:Text);
  431. Procedure Rewrite(Var t:Text);
  432. Procedure Reset(Var t:Text);
  433. Procedure Append(Var t:Text);
  434. Procedure Flush(Var t:Text);
  435. Procedure Erase(Var t:Text);
  436. Procedure Rename(Var t:Text;const s:string);
  437. Procedure Rename(Var t:Text;p:pchar);
  438. Procedure Rename(Var t:Text;c:char);
  439. Function EOF(Var t:Text):Boolean;
  440. Function EOF:Boolean;
  441. Function EOLn(Var t:Text):Boolean;
  442. Function EOLn:Boolean;
  443. Function SeekEOLn (Var t:Text):Boolean;
  444. Function SeekEOF (Var t:Text):Boolean;
  445. Function SeekEOLn:Boolean;
  446. Function SeekEOF:Boolean;
  447. Procedure SetTextBuf(Var f:Text; Var Buf);
  448. Procedure SetTextBuf(Var f:Text; Var Buf; Size:Longint);
  449. {****************************************************************************
  450. Directory Management
  451. ****************************************************************************}
  452. Procedure chdir(const s:string);
  453. Procedure mkdir(const s:string);
  454. Procedure rmdir(const s:string);
  455. Procedure getdir(drivenr:byte;Var dir:shortstring);
  456. Procedure getdir(drivenr:byte;Var dir:ansistring);
  457. {*****************************************************************************
  458. Miscelleaous
  459. *****************************************************************************}
  460. { os independent calls to allow backtraces }
  461. function get_frame:longint;{$ifdef SYSTEMINLINE}inline;{$endif}
  462. function get_caller_addr(framebp:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}
  463. function get_caller_frame(framebp:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}
  464. Function IOResult:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  465. Function Sptr:Longint;{$ifdef SYSTEMINLINE}inline;{$endif}
  466. {*****************************************************************************
  467. Init / Exit / ExitProc
  468. *****************************************************************************}
  469. Function Paramcount:Longint;
  470. Function ParamStr(l:Longint):string;
  471. Procedure Dump_Stack(var f : text;bp:Longint);
  472. Procedure RunError(w:Word);
  473. Procedure RunError;{$ifdef SYSTEMINLINE}inline;{$endif}
  474. Procedure halt(errnum:byte);
  475. Procedure AddExitProc(Proc:TProcedure);
  476. Procedure halt;{$ifdef SYSTEMINLINE}inline;{$endif}
  477. { Need to be exported for threads unit }
  478. Procedure SysInitExceptions;
  479. procedure SysInitStdIO;
  480. Procedure SysResetFPU;
  481. {*****************************************************************************
  482. Abstract/Assert/Error Handling
  483. *****************************************************************************}
  484. procedure AbstractError;
  485. Function SysBackTraceStr(Addr: Longint): ShortString;
  486. Procedure SysAssert(Const Msg,FName:ShortString;LineNo,ErrorAddr:Longint);
  487. { Error handlers }
  488. Type
  489. TBackTraceStrFunc = Function (Addr: Longint): ShortString;
  490. TErrorProc = Procedure (ErrNo : Longint; Address,Frame : Pointer);
  491. TAbstractErrorProc = Procedure;
  492. TAssertErrorProc = Procedure(const msg,fname:ShortString;lineno,erroraddr:longint);
  493. const
  494. BackTraceStrFunc : TBackTraceStrFunc = @SysBackTraceStr;
  495. ErrorProc : TErrorProc = nil;
  496. AbstractErrorProc : TAbstractErrorProc = nil;
  497. AssertErrorProc : TAssertErrorProc = @SysAssert;
  498. {*****************************************************************************
  499. SetJmp/LongJmp
  500. *****************************************************************************}
  501. {$i setjumph.inc}
  502. {*****************************************************************************
  503. Object Pascal support
  504. *****************************************************************************}
  505. {$i objpash.inc}
  506. {*****************************************************************************
  507. Variant support
  508. *****************************************************************************}
  509. {$ifdef HASVARIANT}
  510. {$i varianth.inc}
  511. {$endif HASVARIANT}
  512. {*****************************************************************************
  513. Internal helper routines support
  514. *****************************************************************************}
  515. {$i dynarrh.inc}
  516. {$i compproc.inc}
  517. {
  518. $Log$
  519. Revision 1.59 2002-10-14 19:39:17 peter
  520. * threads unit added for thread support
  521. Revision 1.58 2002/10/06 13:56:47 carl
  522. - remove stack checking for every target in system unit
  523. Revision 1.57 2002/10/02 18:21:51 peter
  524. * Copy() changed to internal function calling compilerprocs
  525. * FPC_SHORTSTR_COPY renamed to FPC_SHORTSTR_ASSIGN because of the
  526. new copy functions
  527. Revision 1.56 2002/09/28 21:18:02 florian
  528. * map comp to int64 for the powerpc
  529. Revision 1.55 2002/09/26 21:50:37 florian
  530. + some WideString<->AnsiString conversion functions added
  531. Revision 1.54 2002/09/07 21:20:50 carl
  532. * cardinal -> longword
  533. - remove FPUInt64 variable
  534. Revision 1.53 2002/09/07 15:07:46 peter
  535. * old logs removed and tabs fixed
  536. Revision 1.52 2002/08/19 19:34:02 peter
  537. * SYSTEMINLINE define that will add inline directives for small
  538. functions and wrappers. This will be defined automaticly when
  539. the compiler defines the HASINLINE directive
  540. Revision 1.51 2002/08/06 20:53:38 michael
  541. + Added support for octal strings (using &)
  542. Revision 1.50 2002/07/26 22:46:06 florian
  543. * interface of system unit for Linux/PowerPC compiles
  544. Revision 1.49 2002/07/26 21:29:03 florian
  545. + powerpc type support
  546. Revision 1.48 2002/07/04 20:40:09 florian
  547. + some x86-64 support added
  548. Revision 1.47 2002/07/01 16:29:05 peter
  549. * sLineBreak changed to normal constant like Kylix
  550. Revision 1.46 2002/06/02 10:49:30 marco
  551. * Renamefest supports_double for FreeBSD too
  552. Revision 1.45 2002/04/21 15:51:51 carl
  553. * StackError is now a typed constant
  554. + $S can be used under unix
  555. Revision 1.44 2002/04/12 17:35:24 carl
  556. - removed unused variable
  557. Revision 1.43 2002/01/25 17:41:05 peter
  558. * moved array types to objpas unit
  559. Revision 1.42 2002/01/25 17:39:35 peter
  560. * array types added
  561. Revision 1.41 2002/01/24 18:27:06 peter
  562. * lowercase() overloaded
  563. Revision 1.40 2002/01/24 12:33:53 jonas
  564. * adapted ranges of native types to int64 (e.g. high cardinal is no
  565. longer longint($ffffffff), but just $fffffff in psystem)
  566. * small additional fix in 64bit rangecheck code generation for 32 bit
  567. processors
  568. * adaption of ranges required the matching talgorithm used for selecting
  569. which overloaded procedure to call to be adapted. It should now always
  570. select the closest match for ordinal parameters.
  571. + inttostr(qword) in sysstr.inc/sysstrh.inc
  572. + abs(int64), sqr(int64), sqr(qword) in systemh.inc/generic.inc (previous
  573. fixes were required to be able to add them)
  574. * is_in_limit() moved from ncal to types unit, should always be used
  575. instead of direct comparisons of low/high values of orddefs because
  576. qword is a special case
  577. }