From 5bbe43169c680d1669d344adcc4f7ea63c5751e2 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 18 Dec 2002 16:44:09 +0000 Subject: [PATCH] * more new RTL --- rtl/linux/baseunix.pp | 45 ++++++++++++++++ rtl/linux/system.pp | 116 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 156 insertions(+), 5 deletions(-) create mode 100644 rtl/linux/baseunix.pp diff --git a/rtl/linux/baseunix.pp b/rtl/linux/baseunix.pp new file mode 100644 index 0000000000..47cf2f769c --- /dev/null +++ b/rtl/linux/baseunix.pp @@ -0,0 +1,45 @@ +{ + $Id$ + This file is part of the Free Pascal run time library. + Copyright (c) 2001 by Carl Eric Codere development team + + Base Unix unit modelled after POSIX 2001. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} +Unit BaseUnix; + +Interface +{$define oldreaddir} // Keep using readdir system call instead + // of userland getdents stuff. +{$define usedomain} // Allow uname with "domain" entry. + // (which is a GNU extension) +{$define posixworkaround} // Temporary ugly workaround for signal handler. + // (mainly until baseunix migration is complete) + +{$i errno.inc} { Error numbers } +{$i bunxtype.inc} { Types } +{$i bunxh.inc} { Functions} + +implementation + +{$i bunxmain.inc} { implementation} +{$i bunxovl.inc} { redefs and overloads implementation} + +end. + +{ + $Log$ + Revision 1.1 2002-12-18 16:44:09 marco + * more new RTL + + Revision 1.2 2002/11/14 12:17:28 marco + * for now. + +} \ No newline at end of file diff --git a/rtl/linux/system.pp b/rtl/linux/system.pp index 5fde071d7a..7dfbccbede 100644 --- a/rtl/linux/system.pp +++ b/rtl/linux/system.pp @@ -1,9 +1,11 @@ { $Id$ - This file is part of the Free Pascal run time library. - Copyright (c) 1999-2000 by Michael Van Canneyt, + This file is part of the Free Pascal run time librar~y. + Copyright (c) 2000 by Marco van de Voort member of the Free Pascal development team. + System unit for the *BSD's. + See the file COPYING.FPC, included in this distribution, for details about the copyright. @@ -19,18 +21,122 @@ { If you use an aout system, set the conditional AOUT} { $Define AOUT} +{$ifdef BSD} +Unit {$ifdef VER1_0}SysBSD{$else}System{$endif}; +{$else} Unit {$ifdef VER1_0}Syslinux{$else}System{$endif}; +{$endif} + Interface +{$define oldreaddir} +{$define usedomain} +{$define posixworkaround} {$I sysunixh.inc} Implementation -{$I sysunix.inc} +{$ifdef ver_1_0} +Var +{$else} +ThreadVar +{$endif} + Errno : longint; + +function geterrno:longint; [public, alias: 'FPC_SYS_GETERRNO']; + +begin + GetErrno:=Errno; +end; + +procedure seterrno(err:longint); [public, alias: 'FPC_SYS_SETERRNO']; + +begin + Errno:=err; +end; + + +{$I system.inc} + +{ OS dependant parts } + +{$I errno.inc} // error numbers +{$I bunxtype.inc} // c-types, unix base types, unix + // base structures +{$I ossysc.inc} // base syscalls +{$I osmain.inc} // base wrappers *nix RTL (derivatives) + +{ more OS independant parts} + +{$I text.inc} +{$I heap.inc} + +{***************************************************************************** + UnTyped File Handling +*****************************************************************************} + +{$i file.inc} + +{***************************************************************************** + Typed File Handling +*****************************************************************************} + +{$i typefile.inc} + +procedure SysInitStdIO; +begin + OpenStdIO(Input,fmInput,StdInputHandle); + OpenStdIO(Output,fmOutput,StdOutputHandle); + OpenStdIO(StdOut,fmOutput,StdOutputHandle); + OpenStdIO(StdErr,fmOutput,StdErrorHandle); +end; + +Begin + IsConsole := TRUE; + IsLibrary := FALSE; + StackBottom := Sptr - StackLength; +{ Set up signals handlers } + InstallSignals; +{ Setup heap } + InitHeap; + SysInitExceptions; +{ Arguments } + SetupCmdLine; +{ Setup stdin, stdout and stderr } + SysInitStdIO; +{ Reset IO Error } + InOutRes:=0; +{$ifdef HASVARIANT} + initvariantmanager; +{$endif HASVARIANT} +End. { $Log$ - Revision 1.2 2002-09-07 16:01:20 peter + Revision 1.3 2002-12-18 16:44:09 marco + * more new RTL + + Revision 1.7 2002/11/12 14:57:48 marco + * Ugly hack to temporarily be able to use system.pp for Linux too + + Revision 1.6 2002/10/27 11:58:30 marco + * Modifications from Saturday. + + Revision 1.5 2002/10/26 18:27:51 marco + * First series POSIX calls commits. Including getcwd. + + Revision 1.4 2002/10/18 12:19:58 marco + * Fixes to get the generic *BSD RTL compiling again + fixes for thread + support. Still problems left in fexpand. (inoutres?) Therefore fixed + sysposix not yet commited + + Revision 1.3 2002/10/13 09:25:39 florian + + call to initvariantmanager inserted + + Revision 1.2 2002/09/07 16:01:17 peter * old logs removed and tabs fixed -} + Revision 1.1 2002/08/19 12:29:11 marco + * First working POSIX *BSD system unit. + +} \ No newline at end of file