system.pp 3.5 KB

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