system.pp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. System unit for the *BSD's.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. { These things are set in the makefile, }
  14. { But you can override them here.}
  15. { If you use an aout system, set the conditional AOUT}
  16. { $Define AOUT}
  17. Unit {$ifdef VER1_0}SysBSD{$else}System{$endif};
  18. Interface
  19. {$I sysunixh.inc}
  20. Implementation
  21. Var Errno : longint;
  22. function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO'];
  23. begin
  24. GetErrno:=Errno;
  25. end;
  26. procedure seterrno(err:longint); [public, alias: 'FPC_SYS_SETERRNO'];
  27. begin
  28. Errno:=err;
  29. end;
  30. { OS independant parts}
  31. {$I system.inc}
  32. { OS dependant parts }
  33. {$I errno.inc}
  34. {$I osposixh.inc}
  35. {$I bsdsysc.inc}
  36. {$I sysposix.inc}
  37. {$I text.inc}
  38. {$I heap.inc}
  39. {*****************************************************************************
  40. UnTyped File Handling
  41. *****************************************************************************}
  42. {$i file.inc}
  43. {*****************************************************************************
  44. Typed File Handling
  45. *****************************************************************************}
  46. {$i typefile.inc}
  47. procedure SysInitStdIO;
  48. begin
  49. OpenStdIO(Input,fmInput,StdInputHandle);
  50. OpenStdIO(Output,fmOutput,StdOutputHandle);
  51. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  52. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  53. end;
  54. Begin
  55. IsConsole := TRUE;
  56. IsLibrary := FALSE;
  57. StackBottom := Sptr - StackLength;
  58. { Set up signals handlers }
  59. InstallSignals;
  60. { Setup heap }
  61. InitHeap;
  62. SysInitExceptions;
  63. { Arguments }
  64. SetupCmdLine;
  65. { Setup stdin, stdout and stderr }
  66. SysInitStdIO;
  67. { Reset IO Error }
  68. InOutRes:=0;
  69. {$ifdef HASVARIANT}
  70. initvariantmanager;
  71. {$endif HASVARIANT}
  72. End.
  73. {
  74. $Log$
  75. Revision 1.6 2002-10-27 11:58:30 marco
  76. * Modifications from Saturday.
  77. Revision 1.5 2002/10/26 18:27:51 marco
  78. * First series POSIX calls commits. Including getcwd.
  79. Revision 1.4 2002/10/18 12:19:58 marco
  80. * Fixes to get the generic *BSD RTL compiling again + fixes for thread
  81. support. Still problems left in fexpand. (inoutres?) Therefore fixed
  82. sysposix not yet commited
  83. Revision 1.3 2002/10/13 09:25:39 florian
  84. + call to initvariantmanager inserted
  85. Revision 1.2 2002/09/07 16:01:17 peter
  86. * old logs removed and tabs fixed
  87. Revision 1.1 2002/08/19 12:29:11 marco
  88. * First working POSIX *BSD system unit.
  89. }