system.pp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. {$ifdef BSD}
  18. Unit {$ifdef VER1_0}SysBSD{$else}System{$endif};
  19. {$else}
  20. Unit {$ifdef VER1_0}Syslinux{$else}System{$endif};
  21. {$endif}
  22. Interface
  23. {$I sysunixh.inc}
  24. Implementation
  25. Var Errno : longint;
  26. function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO'];
  27. begin
  28. GetErrno:=Errno;
  29. end;
  30. procedure seterrno(err:longint); [public, alias: 'FPC_SYS_SETERRNO'];
  31. begin
  32. Errno:=err;
  33. end;
  34. { OS independant parts}
  35. {$I system.inc}
  36. { OS dependant parts }
  37. {$I errno.inc}
  38. {$I osposixh.inc}
  39. {$ifdef BSD}
  40. {$I bsdsysc.inc}
  41. {$else}
  42. {$I linsysc.inc}
  43. {$endif}
  44. {$I sysposix.inc}
  45. {$I text.inc}
  46. {$I heap.inc}
  47. {*****************************************************************************
  48. UnTyped File Handling
  49. *****************************************************************************}
  50. {$i file.inc}
  51. {*****************************************************************************
  52. Typed File Handling
  53. *****************************************************************************}
  54. {$i typefile.inc}
  55. procedure SysInitStdIO;
  56. begin
  57. OpenStdIO(Input,fmInput,StdInputHandle);
  58. OpenStdIO(Output,fmOutput,StdOutputHandle);
  59. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  60. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  61. end;
  62. Begin
  63. IsConsole := TRUE;
  64. IsLibrary := FALSE;
  65. StackBottom := Sptr - StackLength;
  66. { Set up signals handlers }
  67. InstallSignals;
  68. { Setup heap }
  69. InitHeap;
  70. SysInitExceptions;
  71. { Arguments }
  72. SetupCmdLine;
  73. { Setup stdin, stdout and stderr }
  74. SysInitStdIO;
  75. { Reset IO Error }
  76. InOutRes:=0;
  77. {$ifdef HASVARIANT}
  78. initvariantmanager;
  79. {$endif HASVARIANT}
  80. End.
  81. {
  82. $Log$
  83. Revision 1.7 2002-11-12 14:57:48 marco
  84. * Ugly hack to temporarily be able to use system.pp for Linux too
  85. Revision 1.6 2002/10/27 11:58:30 marco
  86. * Modifications from Saturday.
  87. Revision 1.5 2002/10/26 18:27:51 marco
  88. * First series POSIX calls commits. Including getcwd.
  89. Revision 1.4 2002/10/18 12:19:58 marco
  90. * Fixes to get the generic *BSD RTL compiling again + fixes for thread
  91. support. Still problems left in fexpand. (inoutres?) Therefore fixed
  92. sysposix not yet commited
  93. Revision 1.3 2002/10/13 09:25:39 florian
  94. + call to initvariantmanager inserted
  95. Revision 1.2 2002/09/07 16:01:17 peter
  96. * old logs removed and tabs fixed
  97. Revision 1.1 2002/08/19 12:29:11 marco
  98. * First working POSIX *BSD system unit.
  99. }