system.pp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. {$define FPC_IS_SYSTEM}
  15. { include system-independent routine headers }
  16. {$I sysunixh.inc}
  17. implementation
  18. { OS independant parts}
  19. {$I system.inc}
  20. procedure SysInitStdIO;
  21. begin
  22. OpenStdIO(Input,fmInput,StdInputHandle);
  23. OpenStdIO(Output,fmOutput,StdOutputHandle);
  24. OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
  25. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  26. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  27. end;
  28. function GetProcessID: SizeUInt;
  29. begin
  30. GetProcessID := SizeUInt (fpGetPID);
  31. end;
  32. procedure pascalmain; external name 'PASCALMAIN';
  33. { Main entry point in C style, needed to capture program parameters. }
  34. procedure main(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public];
  35. begin
  36. argc:= argcparam;
  37. argv:= argvparam;
  38. envp:= envpparam;
  39. pascalmain; {run the pascal main program}
  40. end;
  41. Begin
  42. IsConsole := TRUE;
  43. IsLibrary := FALSE;
  44. StackLength := InitialStkLen;
  45. StackBottom := Sptr - StackLength;
  46. { Set up signals handlers }
  47. InstallSignals;
  48. { Setup heap }
  49. InitHeap;
  50. SysInitExceptions;
  51. { Arguments }
  52. SetupCmdLine;
  53. { Setup stdin, stdout and stderr }
  54. SysInitStdIO;
  55. { Reset IO Error }
  56. InOutRes:=0;
  57. InitSystemThreads;
  58. {$ifdef HASVARIANT}
  59. initvariantmanager;
  60. {$endif HASVARIANT}
  61. {$ifdef HASWIDESTRING}
  62. initwidestringmanager;
  63. {$endif HASWIDESTRING}
  64. End.
  65. {
  66. $Log$
  67. Revision 1.3 2005-02-13 21:47:56 peter
  68. * include file cleanup part 2
  69. Revision 1.2 2005/02/10 17:30:54 peter
  70. * renamed to solaris
  71. Revision 1.5 2005/02/07 22:17:26 peter
  72. * updated for 1.9.x unix rtl
  73. Revision 1.4 2005/02/01 20:22:50 florian
  74. * improved widestring infrastructure manager
  75. Revision 1.3 2004/12/05 14:36:38 hajny
  76. + GetProcessID added
  77. Revision 1.2 2004/11/06 22:22:28 florian
  78. * some sunos stuff from 1.0.x merged
  79. }