systemh.inc 23 KB

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