system.inc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  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. 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. Local types
  13. ****************************************************************************}
  14. {
  15. TextRec and FileRec are put in a separate file to make it available to other
  16. units without putting it explicitly in systemh.
  17. This way we keep TP compatibility, and the TextRec definition is available
  18. for everyone who needs it.
  19. }
  20. {$i filerec.inc}
  21. {$i textrec.inc}
  22. Procedure HandleError (Errno : Longint); forward;
  23. Procedure HandleErrorFrame (Errno : longint;frame : longint); forward;
  24. type
  25. FileFunc = Procedure(var t : TextRec);
  26. const
  27. STACK_MARGIN = 16384; { Stack size margin for stack checking }
  28. { Random / Randomize constants }
  29. OldRandSeed : Cardinal = 0;
  30. InitialSeed : Boolean = TRUE;
  31. Seed2 : Cardinal = 0;
  32. Seed3 : Cardinal = 0;
  33. { For Error Handling.}
  34. ErrorBase : Longint = 0;
  35. { Used by the ansistrings and maybe also other things in the future }
  36. var
  37. emptychar : char;public name 'FPC_EMPTYCHAR';
  38. stacklength : longint;external name '__stklen';
  39. {****************************************************************************
  40. Routines which have compiler magic
  41. ****************************************************************************}
  42. {$I innr.inc}
  43. Function lo(i : Integer) : byte; [INTERNPROC: In_lo_Word];
  44. Function lo(w : Word) : byte; [INTERNPROC: In_lo_Word];
  45. Function lo(l : Longint) : Word; [INTERNPROC: In_lo_long];
  46. Function lo(l : DWord) : Word; [INTERNPROC: In_lo_long];
  47. Function hi(i : Integer) : byte; [INTERNPROC: In_hi_Word];
  48. Function hi(w : Word) : byte; [INTERNPROC: In_hi_Word];
  49. Function hi(l : Longint) : Word; [INTERNPROC: In_hi_long];
  50. Function hi(l : DWord) : Word; [INTERNPROC: In_hi_long];
  51. Function lo(q : QWord) : DWord; [INTERNPROC: In_lo_qword];
  52. Function lo(i : Int64) : DWord; [INTERNPROC: In_lo_qword];
  53. Function hi(q : QWord) : DWord; [INTERNPROC: In_hi_qword];
  54. Function hi(i : Int64) : DWord; [INTERNPROC: In_hi_qword];
  55. Function chr(b : byte) : Char; [INTERNPROC: In_chr_byte];
  56. {$ifndef INTERNLENGTH}
  57. Function Length(s : string) : byte; [INTERNPROC: In_Length_string];
  58. Function Length(c : char) : byte; [INTERNPROC: In_Length_string];
  59. {$endif INTERNLENGTH}
  60. Procedure Reset(var f : TypedFile); [INTERNPROC: In_Reset_TypedFile];
  61. Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
  62. {****************************************************************************
  63. Include processor specific routines
  64. ****************************************************************************}
  65. {$IFDEF I386}
  66. {$IFNDEF ENDIAN_LITTLE}
  67. {$DEFINE ENDIAN_LITTLE}
  68. {$ENDIF}
  69. {$IFDEF M68K}
  70. {$Error Can't determine processor type !}
  71. {$ENDIF}
  72. {$I i386.inc} { Case dependent, don't change }
  73. {$ELSE}
  74. {$IFDEF M68K}
  75. {$IFNDEF ENDIAN_BIG}
  76. {$DEFINE ENDIAN_BIG}
  77. {$ENDIF}
  78. {$I m68k.inc} { Case dependent, don't change }
  79. {$ELSE}
  80. {$Error Can't determine processor type !}
  81. {$ENDIF}
  82. {$ENDIF}
  83. { Include generic pascal only routines which are not defined in the processor
  84. specific include file }
  85. {$I generic.inc}
  86. {****************************************************************************
  87. Set Handling
  88. ****************************************************************************}
  89. { Include set support which is processor specific}
  90. {$I set.inc}
  91. { Include generic pascal routines for sets if the processor }
  92. { specific routines are not available. }
  93. {$I genset.inc}
  94. {****************************************************************************
  95. Math Routines
  96. ****************************************************************************}
  97. function Hi(b : byte): byte;
  98. begin
  99. Hi := b shr 4
  100. end;
  101. function Lo(b : byte): byte;
  102. begin
  103. Lo := b and $0f
  104. end;
  105. Function swap (X : Word) : Word;[internconst:in_const_swap_word];
  106. Begin
  107. swap:=(X and $ff) shl 8 + (X shr 8)
  108. End;
  109. Function Swap (X : Integer) : Integer;[internconst:in_const_swap_word];
  110. Begin
  111. swap:=(X and $ff) shl 8 + (X shr 8)
  112. End;
  113. Function swap (X : Longint) : Longint;[internconst:in_const_swap_long];
  114. Begin
  115. Swap:=(X and $ffff) shl 16 + (X shr 16)
  116. End;
  117. Function Swap (X : Cardinal) : Cardinal;[internconst:in_const_swap_long];
  118. Begin
  119. Swap:=(X and $ffff) shl 16 + (X shr 16)
  120. End;
  121. Function Swap (X : QWord) : QWord;
  122. Begin
  123. Swap:=(X and $ffffffff) shl 32 + (X shr 32);
  124. End;
  125. Function swap (X : Int64) : Int64;
  126. Begin
  127. Swap:=(X and $ffffffff) shl 32 + (X shr 32);
  128. End;
  129. operator := (b:real48) d:double;
  130. begin
  131. D:=real2double(b);
  132. end;
  133. operator := (b:real48) e:extended;
  134. begin
  135. e:=real2double(b);
  136. end;
  137. { Include processor specific routines }
  138. {$I math.inc}
  139. { Include generic version }
  140. {$I genmath.inc}
  141. {****************************************************************************
  142. Subroutines for String handling
  143. ****************************************************************************}
  144. { Needs to be before RTTI handling }
  145. {$i sstrings.inc}
  146. { requires sstrings.inc for initval }
  147. {$I int64.inc}
  148. {Requires int64.inc, since that contains the VAL functions for int64 and qword}
  149. {$i astrings.inc}
  150. {$ifdef HASWIDESTRING}
  151. {$i wstrings.inc}
  152. {$endif HASWIDESTRING}
  153. {$i aliases.inc}
  154. {*****************************************************************************
  155. Dynamic Array support
  156. *****************************************************************************}
  157. {$i dynarr.inc}
  158. {*****************************************************************************
  159. Object Pascal support
  160. *****************************************************************************}
  161. {$i objpas.inc}
  162. {*****************************************************************************
  163. Variant support
  164. *****************************************************************************}
  165. {$ifdef HASVARIANT}
  166. {$i variant.inc}
  167. {$endif HASVARIANT}
  168. {****************************************************************************
  169. Run-Time Type Information (RTTI)
  170. ****************************************************************************}
  171. {$i rtti.inc}
  172. {****************************************************************************
  173. Random function routines
  174. This implements a very long cycle random number generator by combining
  175. three independant generators. The technique was described in the March
  176. 1987 issue of Byte.
  177. Taken and modified with permission from the PCQ Pascal rtl code.
  178. ****************************************************************************}
  179. {$R-}
  180. {$Q-}
  181. Procedure NewSeed;Forward;
  182. Function Random : Extended;
  183. begin
  184. if (InitialSeed) OR (RandSeed <> OldRandSeed) then
  185. Begin
  186. { This is a pretty complicated affair }
  187. { Initially we must call NewSeed when RandSeed is initalized }
  188. { We must also call NewSeed each time RandSeed is reinitialized }
  189. { DO NOT CHANGE THE ORDER OF DECLARATIONS IN THIS BLOCK }
  190. { UNLESS YOU WANT RANDON TO CRASH OF COURSE (CEC) }
  191. InitialSeed:=FALSE;
  192. OldRandSeed:=RandSeed;
  193. NewSeed;
  194. end;
  195. Inc(RandSeed);
  196. RandSeed := (RandSeed * 706) mod 500009;
  197. OldRandSeed:=RandSeed;
  198. INC(Seed2);
  199. Seed2 := (Seed2 * 774) MOD 600011;
  200. INC(Seed3);
  201. Seed3 := (Seed3 * 871) MOD 765241;
  202. Random :=
  203. frac(RandSeed/500009.0 +
  204. Seed2/600011.0 +
  205. Seed3/765241.0);
  206. end;
  207. Function internRandom(l : Cardinal) : Cardinal;
  208. begin
  209. if (InitialSeed) OR (RandSeed <> OldRandSeed) then
  210. Begin
  211. { This is a pretty complicated affair }
  212. { Initially we must call NewSeed when RandSeed is initalized }
  213. { We must also call NewSeed each time RandSeed is reinitialized }
  214. { DO NOT CHANGE THE ORDER OF DECLARATIONS IN THIS BLOCK }
  215. { UNLESS YOU WANT RANDOM TO CRASH OF COURSE (CEC) }
  216. InitialSeed:=FALSE;
  217. OldRandSeed:=RandSeed;
  218. NewSeed;
  219. end;
  220. Inc(RandSeed);
  221. RandSeed := (RandSeed * 998) mod 1000003;
  222. OldRandSeed:=RandSeed;
  223. if l<>0 then
  224. begin
  225. internRandom := RandSeed mod l;
  226. end
  227. else internRandom:=0;
  228. end;
  229. function random(l:cardinal): cardinal;
  230. begin
  231. random := trunc(random()*l);
  232. end;
  233. function random(l:longint): longint;
  234. begin
  235. random := trunc(random()*l);
  236. end;
  237. Procedure NewSeed;
  238. begin
  239. randseed := randseed mod 1000003;
  240. Seed2 := (internRandom(65000) * internRandom(65000)) mod 600011;
  241. Seed3 := (internRandom(65000) * internRandom(65000)) mod 765241;
  242. end;
  243. {****************************************************************************
  244. Memory Management
  245. ****************************************************************************}
  246. Function Ptr(sel,off : Longint) : farpointer;[internconst:in_const_ptr];
  247. Begin
  248. ptr:=farpointer((sel shl 4)+off);
  249. End;
  250. Function CSeg : Word;
  251. Begin
  252. Cseg:=0;
  253. End;
  254. Function DSeg : Word;
  255. Begin
  256. Dseg:=0;
  257. End;
  258. Function SSeg : Word;
  259. Begin
  260. Sseg:=0;
  261. End;
  262. {*****************************************************************************
  263. Directory support.
  264. *****************************************************************************}
  265. Procedure getdir(drivenr:byte;Var dir:ansistring);
  266. { this is needed to also allow ansistrings, the shortstring version is
  267. OS dependent }
  268. var
  269. s : shortstring;
  270. begin
  271. getdir(drivenr,s);
  272. dir:=s;
  273. end;
  274. {$ifopt R+}
  275. {$define RangeCheckWasOn}
  276. {$R-}
  277. {$endif opt R+}
  278. {$ifopt I+}
  279. {$define IOCheckWasOn}
  280. {$I-}
  281. {$endif opt I+}
  282. {$ifopt Q+}
  283. {$define OverflowCheckWasOn}
  284. {$Q-}
  285. {$endif opt Q+}
  286. {*****************************************************************************
  287. Miscellaneous
  288. *****************************************************************************}
  289. procedure fpc_rangeerror;[public,alias:'FPC_RANGEERROR']; {$ifdef hascompilerproc} compilerproc; {$endif}
  290. begin
  291. HandleErrorFrame(201,get_frame);
  292. end;
  293. procedure fpc_overflow;[public,alias:'FPC_OVERFLOW']; {$ifdef hascompilerproc} compilerproc; {$endif}
  294. begin
  295. HandleErrorFrame(215,get_frame);
  296. end;
  297. procedure fpc_iocheck(addr : longint);[saveregisters,public,alias:'FPC_IOCHECK']; {$ifdef hascompilerproc} compilerproc; {$endif}
  298. var
  299. l : longint;
  300. begin
  301. if InOutRes<>0 then
  302. begin
  303. l:=InOutRes;
  304. InOutRes:=0;
  305. HandleErrorFrame(l,get_frame);
  306. end;
  307. end;
  308. Function IOResult:Word;
  309. Begin
  310. IOResult:=InOutRes;
  311. InOutRes:=0;
  312. End;
  313. procedure fillchar(var x;count : longint;value : boolean);
  314. begin
  315. fillchar(x,count,byte(value));
  316. end;
  317. procedure fillchar(var x;count : longint;value : char);
  318. begin
  319. fillchar(x,count,byte(value));
  320. end;
  321. {*****************************************************************************
  322. Stack check code
  323. *****************************************************************************}
  324. {$IFNDEF NO_GENERIC_STACK_CHECK}
  325. {$IFOPT S+}
  326. {$DEFINE STACKCHECK}
  327. {$ENDIF}
  328. {$S-}
  329. procedure fpc_stackcheck(stack_size:longint);[saveregisters,public,alias:'FPC_STACKCHECK'];
  330. var
  331. c: cardinal;
  332. begin
  333. { Avoid recursive calls when called from the exit routines }
  334. if StackError then
  335. exit;
  336. c := cardinal(Sptr) - cardinal(stack_size) - STACK_MARGIN;
  337. if (c <= cardinal(StackBottom)) then
  338. begin
  339. StackError:=true;
  340. HandleError(202);
  341. end;
  342. end;
  343. {$IFDEF STACKCHECK}
  344. {$S+}
  345. {$ENDIF}
  346. {$UNDEF STACKCHECK}
  347. {$ENDIF NO_GENERIC_STACK_CHECK}
  348. {*****************************************************************************
  349. Initialization / Finalization
  350. *****************************************************************************}
  351. const
  352. maxunits=1024; { See also files.pas of the compiler source }
  353. type
  354. TInitFinalRec=record
  355. InitProc,
  356. FinalProc : TProcedure;
  357. end;
  358. TInitFinalTable=record
  359. TableCount,
  360. InitCount : longint;
  361. Procs : array[1..maxunits] of TInitFinalRec;
  362. end;
  363. var
  364. InitFinalTable : TInitFinalTable;external name 'INITFINAL';
  365. procedure fpc_InitializeUnits;[public,alias:'FPC_INITIALIZEUNITS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  366. var
  367. i : longint;
  368. begin
  369. with InitFinalTable do
  370. begin
  371. for i:=1to TableCount do
  372. begin
  373. if assigned(Procs[i].InitProc) then
  374. Procs[i].InitProc();
  375. InitCount:=i;
  376. end;
  377. end;
  378. end;
  379. procedure FinalizeUnits;[public,alias:'FPC_FINALIZEUNITS'];
  380. begin
  381. with InitFinalTable do
  382. begin
  383. while (InitCount>0) do
  384. begin
  385. // we've to decrement the cound before calling the final. code
  386. // else a halt in the final. code leads to a endless loop
  387. dec(InitCount);
  388. if assigned(Procs[InitCount+1].FinalProc) then
  389. Procs[InitCount+1].FinalProc();
  390. end;
  391. end;
  392. end;
  393. {*****************************************************************************
  394. Error / Exit / ExitProc
  395. *****************************************************************************}
  396. Procedure system_exit;forward;
  397. Procedure InternalExit;
  398. var
  399. current_exit : Procedure;
  400. Begin
  401. while exitProc<>nil Do
  402. Begin
  403. InOutRes:=0;
  404. current_exit:=tProcedure(exitProc);
  405. exitProc:=nil;
  406. current_exit();
  407. End;
  408. { Finalize units }
  409. FinalizeUnits;
  410. { Show runtime error and exit }
  411. If erroraddr<>nil Then
  412. Begin
  413. Writeln(stdout,'Runtime error ',Errorcode,' at 0x',hexstr(Longint(Erroraddr),8));
  414. { to get a nice symify }
  415. Writeln(stdout,BackTraceStrFunc(Longint(Erroraddr)));
  416. dump_stack(stdout,ErrorBase);
  417. Writeln(stdout,'');
  418. End;
  419. End;
  420. Procedure do_exit;[Public,Alias:'FPC_DO_EXIT'];
  421. begin
  422. InternalExit;
  423. System_exit;
  424. end;
  425. Procedure lib_exit;saveregisters;[Public,Alias:'FPC_LIB_EXIT'];
  426. begin
  427. InternalExit;
  428. end;
  429. Procedure Halt(ErrNum: Byte);
  430. Begin
  431. ExitCode:=Errnum;
  432. Do_Exit;
  433. end;
  434. function SysBackTraceStr (Addr: longint): ShortString;
  435. begin
  436. SysBackTraceStr:=' 0x'+HexStr(addr,8);
  437. end;
  438. Procedure HandleErrorAddrFrame (Errno : longint;addr,frame : longint);[public,alias:'FPC_BREAK_ERROR'];
  439. begin
  440. If pointer(ErrorProc)<>Nil then
  441. ErrorProc(Errno,pointer(addr),pointer(frame));
  442. errorcode:=Errno;
  443. exitcode:=Errno;
  444. erroraddr:=pointer(addr);
  445. errorbase:=frame;
  446. halt(errorcode);
  447. end;
  448. Procedure HandleErrorFrame (Errno : longint;frame : longint);
  449. {
  450. Procedure to handle internal errors, i.e. not user-invoked errors
  451. Internal function should ALWAYS call HandleError instead of RunError.
  452. Can be used for exception handlers to specify the frame
  453. }
  454. begin
  455. HandleErrorAddrFrame(Errno,get_caller_addr(frame),get_caller_frame(frame));
  456. end;
  457. Procedure HandleError (Errno : longint);[public,alias : 'FPC_HANDLEERROR'];
  458. {
  459. Procedure to handle internal errors, i.e. not user-invoked errors
  460. Internal function should ALWAYS call HandleError instead of RunError.
  461. }
  462. begin
  463. HandleErrorFrame(Errno,get_frame);
  464. end;
  465. procedure runerror(w : word);[alias: 'FPC_RUNERROR'];
  466. begin
  467. errorcode:=w;
  468. exitcode:=w;
  469. erroraddr:=pointer(get_caller_addr(get_frame));
  470. errorbase:=get_caller_frame(get_frame);
  471. halt(errorcode);
  472. end;
  473. Procedure RunError;
  474. Begin
  475. RunError (0);
  476. End;
  477. Procedure Halt;
  478. Begin
  479. Halt(0);
  480. End;
  481. function do_isdevice(handle:longint):boolean;forward;
  482. Procedure dump_stack(var f : text;bp : Longint);
  483. var
  484. i, prevbp : Longint;
  485. is_dev : boolean;
  486. caller_addr : longint;
  487. Begin
  488. prevbp:=bp-1;
  489. i:=0;
  490. is_dev:=do_isdevice(textrec(f).Handle);
  491. while bp > prevbp Do
  492. Begin
  493. caller_addr := get_caller_addr(bp);
  494. if caller_addr <> 0 then
  495. Writeln(f,BackTraceStrFunc(caller_addr));
  496. Inc(i);
  497. If ((i>max_frame_dump) and is_dev) or (i>256) Then
  498. exit;
  499. prevbp:=bp;
  500. bp:=get_caller_frame(bp);
  501. End;
  502. End;
  503. Type
  504. PExitProcInfo = ^TExitProcInfo;
  505. TExitProcInfo = Record
  506. Next : PExitProcInfo;
  507. SaveExit : Pointer;
  508. Proc : TProcedure;
  509. End;
  510. const
  511. ExitProcList: PExitProcInfo = nil;
  512. Procedure DoExitProc;
  513. var
  514. P : PExitProcInfo;
  515. Proc : TProcedure;
  516. Begin
  517. P:=ExitProcList;
  518. ExitProcList:=P^.Next;
  519. ExitProc:=P^.SaveExit;
  520. Proc:=P^.Proc;
  521. DisPose(P);
  522. Proc();
  523. End;
  524. Procedure AddExitProc(Proc: TProcedure);
  525. var
  526. P : PExitProcInfo;
  527. Begin
  528. New(P);
  529. P^.Next:=ExitProcList;
  530. P^.SaveExit:=ExitProc;
  531. P^.Proc:=Proc;
  532. ExitProcList:=P;
  533. ExitProc:=@DoExitProc;
  534. End;
  535. {*****************************************************************************
  536. Abstract/Assert support.
  537. *****************************************************************************}
  538. procedure AbstractError;[public,alias : 'FPC_ABSTRACTERROR'];
  539. begin
  540. If pointer(AbstractErrorProc)<>nil then
  541. AbstractErrorProc();
  542. HandleErrorFrame(211,get_frame);
  543. end;
  544. {$ifdef hascompilerproc}
  545. { alias for internal usage in the compiler }
  546. procedure fpc_AbstractErrorIntern; compilerproc; external name 'FPC_ABSTRACTERROR';
  547. {$endif hascompilerproc}
  548. Procedure fpc_assert(Const Msg,FName:Shortstring;LineNo,ErrorAddr:Longint); [SaveRegisters,Public,Alias : 'FPC_ASSERT']; {$ifdef hascompilerproc} compilerproc; {$endif}
  549. begin
  550. if pointer(AssertErrorProc)<>nil then
  551. AssertErrorProc(Msg,FName,LineNo,ErrorAddr)
  552. else
  553. HandleErrorFrame(227,get_frame);
  554. end;
  555. Procedure SysAssert(Const Msg,FName:Shortstring;LineNo,ErrorAddr:Longint);
  556. begin
  557. If msg='' then
  558. write(stderr,'Assertion failed')
  559. else
  560. write(stderr,msg);
  561. Writeln(stderr,' (',FName,', line ',LineNo,').');
  562. Writeln(stderr,'');
  563. end;
  564. {*****************************************************************************
  565. SetJmp/LongJmp support.
  566. *****************************************************************************}
  567. {$i setjump.inc}
  568. {$ifdef IOCheckWasOn}
  569. {$I+}
  570. {$endif}
  571. {$ifdef RangeCheckWasOn}
  572. {$R+}
  573. {$endif}
  574. {$ifdef OverflowCheckWasOn}
  575. {$Q+}
  576. {$endif}
  577. {
  578. $Log$
  579. Revision 1.28 2002-04-21 15:51:50 carl
  580. * StackError is now a typed constant
  581. + $S can be used under unix
  582. Revision 1.27 2002/04/15 19:38:40 peter
  583. * stackcheck protected against infinite recursive after stack error
  584. * stackcheck requires saveregisters, because it can be called from
  585. iocheck and then will destroy the result of the original function
  586. Revision 1.26 2002/04/15 18:51:20 carl
  587. + generic stack checking can be overriden
  588. Revision 1.25 2002/04/12 17:37:36 carl
  589. + generic stack checking
  590. Revision 1.24 2001/12/13 20:23:19 michael
  591. + Added double2real function from main branch
  592. Revision 1.23 2001/11/19 02:40:24 carl
  593. + don't print stack information if previous frame = 0
  594. Revision 1.22 2001/08/19 21:02:01 florian
  595. * fixed and added a lot of stuff to get the Jedi DX( headers
  596. compiled
  597. Revision 1.21 2001/08/01 15:00:10 jonas
  598. + "compproc" helpers
  599. * renamed several helpers so that their name is the same as their
  600. "public alias", which should facilitate the conversion of processor
  601. specific code in the code generator to processor independent code
  602. * some small fixes to the val_ansistring and val_widestring helpers
  603. (always immediately exit if the source string is longer than 255
  604. chars)
  605. * fixed fpc_dynarray_high and fpc_dynarray_length if the dynarray is
  606. still nil (used to crash, now return resp -1 and 0)
  607. Revision 1.20 2001/07/30 21:38:55 peter
  608. * m68k updates merged
  609. Revision 1.19 2001/07/29 14:05:55 peter
  610. * include lowmath for m68k (merged)
  611. Revision 1.18 2001/07/29 13:49:15 peter
  612. * m68k updates merged
  613. Revision 1.17 2001/07/09 21:15:41 peter
  614. * Length made internal
  615. * Add array support for Length
  616. Revision 1.16 2001/07/08 21:00:18 peter
  617. * various widestring updates, it works now mostly without charset
  618. mapping supported
  619. Revision 1.15 2001/06/13 18:32:05 peter
  620. * big endian updates (merged)
  621. Revision 1.14 2001/06/03 15:15:58 peter
  622. * lib_exit added
  623. Revision 1.13 2001/05/09 19:57:07 peter
  624. *** empty log message ***
  625. Revision 1.12 2001/04/13 18:06:28 peter
  626. * removed rtllite define
  627. Revision 1.11 2000/12/16 15:56:19 jonas
  628. - removed all ifdef cardinalmulfix code
  629. Revision 1.10 2000/11/13 14:47:46 jonas
  630. * support for range checking when converting from 64bit to something
  631. smaller (32bit, 16bit, 8bit)
  632. * fixed range checking between longint/cardinal and for array indexing
  633. with cardinal (values > $7fffffff were considered negative)
  634. Revision 1.9 2000/11/11 16:12:01 peter
  635. * ptr returns farpointer
  636. Revision 1.8 2000/11/06 21:35:59 peter
  637. * removed some warnings
  638. Revision 1.7 2000/11/04 17:52:46 florian
  639. * fixed linker errors
  640. Revision 1.6 2000/10/13 12:04:03 peter
  641. * FPC_BREAK_ERROR added
  642. Revision 1.5 2000/08/13 17:55:14 michael
  643. + Added some delphi compatibility types
  644. Revision 1.4 2000/08/09 19:31:18 marco
  645. * fixes for val(int64 or qword) to ansistring
  646. Revision 1.3 2000/07/14 10:33:10 michael
  647. + Conditionals fixed
  648. Revision 1.2 2000/07/13 11:33:45 michael
  649. + removed logs
  650. }