system.pp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 bunxtype.inc}
  39. {$I ossysc.inc}
  40. {$I osmain.inc}
  41. {$I text.inc}
  42. {$I heap.inc}
  43. {*****************************************************************************
  44. UnTyped File Handling
  45. *****************************************************************************}
  46. {$i file.inc}
  47. {*****************************************************************************
  48. Typed File Handling
  49. *****************************************************************************}
  50. {$i typefile.inc}
  51. procedure SysInitStdIO;
  52. begin
  53. OpenStdIO(Input,fmInput,StdInputHandle);
  54. OpenStdIO(Output,fmOutput,StdOutputHandle);
  55. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  56. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  57. end;
  58. Begin
  59. IsConsole := TRUE;
  60. IsLibrary := FALSE;
  61. StackBottom := Sptr - StackLength;
  62. { Set up signals handlers }
  63. InstallSignals;
  64. { Setup heap }
  65. InitHeap;
  66. SysInitExceptions;
  67. { Arguments }
  68. SetupCmdLine;
  69. { Setup stdin, stdout and stderr }
  70. SysInitStdIO;
  71. { Reset IO Error }
  72. InOutRes:=0;
  73. {$ifdef HASVARIANT}
  74. initvariantmanager;
  75. {$endif HASVARIANT}
  76. End.
  77. {
  78. $Log$
  79. Revision 1.8 2003-01-05 19:01:28 marco
  80. * FreeBSD compiles now with baseunix mods.
  81. Revision 1.7 2002/11/12 14:57:48 marco
  82. * Ugly hack to temporarily be able to use system.pp for Linux too
  83. Revision 1.6 2002/10/27 11:58:30 marco
  84. * Modifications from Saturday.
  85. Revision 1.5 2002/10/26 18:27:51 marco
  86. * First series POSIX calls commits. Including getcwd.
  87. Revision 1.4 2002/10/18 12:19:58 marco
  88. * Fixes to get the generic *BSD RTL compiling again + fixes for thread
  89. support. Still problems left in fexpand. (inoutres?) Therefore fixed
  90. sysposix not yet commited
  91. Revision 1.3 2002/10/13 09:25:39 florian
  92. + call to initvariantmanager inserted
  93. Revision 1.2 2002/09/07 16:01:17 peter
  94. * old logs removed and tabs fixed
  95. Revision 1.1 2002/08/19 12:29:11 marco
  96. * First working POSIX *BSD system unit.
  97. }