system.pp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time librar~y.
  4. Copyright (c) 2000 by Marco van de Voort
  5. member of the Free Pascal development team.
  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. { These things are set in the makefile, }
  13. { But you can override them here.}
  14. { If you use an aout system, set the conditional AOUT}
  15. { $Define AOUT}
  16. Unit {$ifdef VER1_0}SysBSD{$else}System{$endif};
  17. Interface
  18. {$I sysunixh.inc}
  19. Implementation
  20. Var Errno : longint;
  21. function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO'];
  22. begin
  23. GetErrno:=Errno;
  24. end;
  25. { OS independant parts}
  26. {$I system.inc}
  27. { OS dependant parts }
  28. {$I errno.inc}
  29. {$I osposixh.inc}
  30. {$I bsdsysc.inc}
  31. {$I sysposix.inc}
  32. {$I text.inc}
  33. {$I heap.inc}
  34. {*****************************************************************************
  35. UnTyped File Handling
  36. *****************************************************************************}
  37. {$i file.inc}
  38. {*****************************************************************************
  39. Typed File Handling
  40. *****************************************************************************}
  41. {$i typefile.inc}
  42. procedure SysInitStdIO;
  43. begin
  44. OpenStdIO(Input,fmInput,StdInputHandle);
  45. OpenStdIO(Output,fmOutput,StdOutputHandle);
  46. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  47. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  48. end;
  49. Begin
  50. IsConsole := TRUE;
  51. IsLibrary := FALSE;
  52. StackBottom := Sptr - StackLength;
  53. { Set up signals handlers }
  54. InstallSignals;
  55. { Setup heap }
  56. InitHeap;
  57. SysInitExceptions;
  58. { Arguments }
  59. SetupCmdLine;
  60. { Setup stdin, stdout and stderr }
  61. SysInitStdIO;
  62. { Reset IO Error }
  63. InOutRes:=0;
  64. {$ifdef HASVARIANT}
  65. initvariantmanager;
  66. {$endif HASVARIANT}
  67. End.
  68. {
  69. $Log$
  70. Revision 1.4 2002-10-18 12:19:58 marco
  71. * Fixes to get the generic *BSD RTL compiling again + fixes for thread
  72. support. Still problems left in fexpand. (inoutres?) Therefore fixed
  73. sysposix not yet commited
  74. Revision 1.3 2002/10/13 09:25:39 florian
  75. + call to initvariantmanager inserted
  76. Revision 1.2 2002/09/07 16:01:17 peter
  77. * old logs removed and tabs fixed
  78. Revision 1.1 2002/08/19 12:29:11 marco
  79. * First working POSIX *BSD system unit.
  80. }