system.pp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 ver_1_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. StackBottom := Sptr - StackLength;
  71. { Set up signals handlers }
  72. InstallSignals;
  73. { Setup heap }
  74. InitHeap;
  75. SysInitExceptions;
  76. { Arguments }
  77. SetupCmdLine;
  78. { Setup stdin, stdout and stderr }
  79. SysInitStdIO;
  80. { Reset IO Error }
  81. InOutRes:=0;
  82. {$ifdef HASVARIANT}
  83. initvariantmanager;
  84. {$endif HASVARIANT}
  85. End.
  86. {
  87. $Log$
  88. Revision 1.3 2002-12-18 16:44:09 marco
  89. * more new RTL
  90. Revision 1.7 2002/11/12 14:57:48 marco
  91. * Ugly hack to temporarily be able to use system.pp for Linux too
  92. Revision 1.6 2002/10/27 11:58:30 marco
  93. * Modifications from Saturday.
  94. Revision 1.5 2002/10/26 18:27:51 marco
  95. * First series POSIX calls commits. Including getcwd.
  96. Revision 1.4 2002/10/18 12:19:58 marco
  97. * Fixes to get the generic *BSD RTL compiling again + fixes for thread
  98. support. Still problems left in fexpand. (inoutres?) Therefore fixed
  99. sysposix not yet commited
  100. Revision 1.3 2002/10/13 09:25:39 florian
  101. + call to initvariantmanager inserted
  102. Revision 1.2 2002/09/07 16:01:17 peter
  103. * old logs removed and tabs fixed
  104. Revision 1.1 2002/08/19 12:29:11 marco
  105. * First working POSIX *BSD system unit.
  106. }