systemh.inc 23 KB

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