system.pp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team.
  5. Solaris system unit
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit System;
  13. interface
  14. { include system-independent routine headers }
  15. {$I sysunixh.inc}
  16. implementation
  17. { OS independant parts}
  18. {$I system.inc}
  19. procedure SysInitStdIO;
  20. begin
  21. OpenStdIO(Input,fmInput,StdInputHandle);
  22. OpenStdIO(Output,fmOutput,StdOutputHandle);
  23. OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
  24. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  25. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  26. end;
  27. function GetProcessID: SizeUInt;
  28. begin
  29. GetProcessID := SizeUInt (fpGetPID);
  30. end;
  31. procedure pascalmain; external name 'PASCALMAIN';
  32. { Main entry point in C style, needed to capture program parameters. }
  33. procedure main(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public];
  34. begin
  35. argc:= argcparam;
  36. argv:= argvparam;
  37. envp:= envpparam;
  38. pascalmain; {run the pascal main program}
  39. end;
  40. Begin
  41. IsConsole := TRUE;
  42. IsLibrary := FALSE;
  43. StackLength := InitialStkLen;
  44. StackBottom := Sptr - StackLength;
  45. { Set up signals handlers }
  46. InstallSignals;
  47. { Setup heap }
  48. InitHeap;
  49. SysInitExceptions;
  50. { Arguments }
  51. SetupCmdLine;
  52. { Setup stdin, stdout and stderr }
  53. SysInitStdIO;
  54. { Reset IO Error }
  55. InOutRes:=0;
  56. InitSystemThreads;
  57. {$ifdef HASVARIANT}
  58. initvariantmanager;
  59. {$endif HASVARIANT}
  60. {$ifdef HASWIDESTRING}
  61. initwidestringmanager;
  62. {$endif HASWIDESTRING}
  63. End.
  64. {
  65. $Log$
  66. Revision 1.5 2005-02-07 22:17:26 peter
  67. * updated for 1.9.x unix rtl
  68. Revision 1.4 2005/02/01 20:22:50 florian
  69. * improved widestring infrastructure manager
  70. Revision 1.3 2004/12/05 14:36:38 hajny
  71. + GetProcessID added
  72. Revision 1.2 2004/11/06 22:22:28 florian
  73. * some sunos stuff from 1.0.x merged
  74. }