Browse Source

* obsolete

peter 20 years ago
parent
commit
d88d7d846a

+ 0 - 10
rtl/fakertl/objpas.pp

@@ -1,10 +0,0 @@
-unit objpas;
-interface
-{$Y-}
-implementation
-end.
-  $Log$
-  Revision 1.3  2002-09-07 16:01:17  peter
-    * old logs removed and tabs fixed
-
-}

+ 0 - 2
rtl/fakertl/readme

@@ -1,2 +0,0 @@
-This directory contains a fake system unit to test the new
-code generator without compiling the hole system unit

+ 0 - 14
rtl/fakertl/syslinux.pp

@@ -1,14 +0,0 @@
-{ This is a fake system unit to allow testing of the new code generator }
-
-unit system;
-
-  interface
-
-  implementation
-
-end.
-  $Log$
-  Revision 1.2  2000-07-13 11:33:38  michael
-  + removed logs
- 
-}

+ 0 - 59
rtl/fakertl/system.pp

@@ -1,59 +0,0 @@
-unit system;
-interface
-
-{$Y-}
-
-type
-  integer=-32768..32767;
-  byte=0..255;
-  word=0..65535;
-  longint=$80000000..$7fffffff;
-  pchar=^char;
-
-var
-   a,b,c,d : longint;
-   s1,s2 : string;
-   i1,i2 : int64;
-
-implementation
-
-{ $i ../powerpc/powerpc.inc}
-
-{
-procedure p1(l1,l2,l3 : longint);
-
-  begin
-  end;
-
-
-procedure do_exit;[public,alias:'FPC_DO_EXIT'];
-begin
-end;
-}
-
-function GetProcessID: SizeUInt;
-begin
- GetProcessID := 1;
-end;
-
-begin
-   b:=4;
-   a:=b;
-   i1:=i2;
-   // p1(a,b,3);
-   // s1:=s2;
-end.
-
-{
-  $Log$
-  Revision 1.5  2004-12-05 14:36:37  hajny
-    + GetProcessID added
-
-  Revision 1.4  2002/09/07 16:01:17  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.3  2002/07/28 20:43:47  florian
-    * several fixes for linux/powerpc
-    * several fixes to MT
-
-}

+ 0 - 63
rtl/posix/errno.tem

@@ -1,63 +0,0 @@
-{***********************************************************************}
-{                       POSIX ERROR DEFINITIONS                         }
-{***********************************************************************}
-const
-    { The following constants are system dependent but must all exist }
-    Sys_E2BIG       =
-    Sys_EACCES      =
-    Sys_EAGAIN      =
-    Sys_EBADF       =
-    Sys_EBUSY       =
-    Sys_ECANCELED   =
-    Sys_ECHILD      =
-    Sys_EDEADLK     =
-    Sys_EDOM        =
-    Sys_EEXIST      =
-    Sys_EFAULT      =
-    Sys_EFBIG       =
-    Sys_EINPROGRESS =
-    Sys_EINTR       =
-    Sys_EINVAL      =
-    Sys_EIO         =
-    Sys_EISDIR      =
-    Sys_EMFILE      =
-    Sys_EMLINK      =
-    Sys_EMSGSIZE    =
-    Sys_ENAMETOOLONG=
-    Sys_ENFILE      =
-    Sys_ENODEV      =
-    Sys_ENOENT      =
-    Sys_ENOEXEC     =
-    Sys_ENOLCK      =
-    Sys_ENOMEM      =
-    Sys_ENOSPC      =
-    Sys_ENOSYS      =
-    Sys_ENOTDIR     =
-    Sys_ENOTEMPTY   =
-    Sys_ENOTTY      =
-    Sys_ENXIO       =
-    Sys_EPERM       =
-    Sys_EPIPE       =
-    Sys_ERANGE      =
-    Sys_EROFS       =
-    Sys_ESPIPE      =
-    Sys_ESRCH       =
-    Sys_ETIMEDOUT   =
-    Sys_EXDEV       =
-    { These next errors are POSIX, but only defined when    }
-    { certain types of POSIX extensions are defined:        }
-    {Sys_EBADMSG     =    realtime extension POSIX only   }
-    {Sys_ECANCELED   =    async. I/O extension POSIX only }
-    {Sys_EMSGSIZE    =    realtime extension POSIX only   }
-    {Sys_EINPROGRESS =    async. I/O extension POSIX only }
-    {Sys_ENOTSUP     =    unsupported syscall - optional  }
-
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.2  2002/08/10 13:42:36  marco
-   * Fixes Posix dir copied to devel branch
-
-}

+ 0 - 102
rtl/posix/osposix.tem

@@ -1,102 +0,0 @@
-{
-    $Id$
-    Copyright (c) 2001 by Carl Eric Codere
-
-    Implements POSIX 1003.1 conforming interface
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    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.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-
-  {$Linklib c}
-
-{   var
-     Errno : cint; external name 'errno';}
-
-
-
-    function sys_fork : pid_t; cdecl; external name 'fork';
-    function sys_execve(const path : pchar; const argv : ppchar; const envp: ppchar): cint; cdecl; external name 'execve';
-    function sys_waitpid(pid : pid_t; var stat_loc : cint; options: cint): pid_t; cdecl; external name 'waitpid';
-    procedure sys_exit(status : cint); cdecl; external name '_exit';
-    function sys_uname(var name: utsname): cint; cdecl; external name 'uname';
-    function sys_opendir(const dirname : pchar): pdir; cdecl; external name 'opendir';
-    function sys_readdir(dirp : pdir) : pdirent;cdecl; external name 'readdir';
-    function sys_closedir(dirp : pdir): cint; cdecl; external name 'closedir';
-    function sys_chdir(const path : pchar): cint; cdecl; external name 'chdir';
-    function sys_open(const path: pchar; flags : cint; mode: mode_t):cint; cdecl; external name 'open';
-    function sys_mkdir(const path : pchar; mode: mode_t):cint; cdecl; external name 'mkdir';
-    function sys_unlink(const path: pchar): cint; cdecl; external name 'unlink';
-    function sys_rmdir(const path : pchar): cint; cdecl; external name 'rmdir';
-    function sys_rename(const old : pchar; const newpath: pchar): cint; cdecl;external name 'rename';
-    function sys_fstat(fd : cint; var sb : stat): cint; cdecl; external name 'fstat';
-    function sys_stat(const path: pchar; var buf : stat): cint; cdecl; external name 'stat';
-    function sys_access(const pathname : pchar; amode : cint): cint; cdecl; external name 'access';
-    function sys_close(fd : cint): cint; cdecl; external name 'close';
-    function sys_read(fd: cint; buf: pchar; nbytes : size_t): ssize_t; cdecl; external name 'read';
-    function sys_write(fd: cint;const buf:pchar; nbytes : size_t): ssize_t; cdecl; external name 'write';
-    function sys_lseek(fd : cint; offset : off_t; whence : cint): off_t; cdecl; external name 'lseek';
-    function sys_time(var tloc:time_t): time_t; cdecl; external name 'time';
-    function sys_ftruncate(fd : cint; flength : off_t): cint; cdecl; external name 'ftruncate';
-    function sys_sigaction(sig: cint; var act : sigactionrec; var oact : sigactionrec): cint; cdecl; external name 'sigaction';
-
-
-    function S_ISDIR(m : mode_t): boolean;
-      begin
-      end;
-
-    function S_ISCHR(m : mode_t): boolean;
-      begin
-      end;
-
-    function S_ISBLK(m : mode_t): boolean;
-      begin
-      end;
-
-    function S_ISREG(m : mode_t): boolean;
-      begin
-      end;
-
-    function S_ISFIFO(m : mode_t): boolean;
-      begin
-      end;
-
-    function wifexited(status : cint): cint;
-      begin
-      end;
-
-    function wexitstatus(status : cint): cint;
-     begin
-     end;
-
-    function wstopsig(status : cint): cint;
-     begin
-     end;
-
-    function wifsignaled(status : cint): cint;
-     begin
-     end;
-
-{
-
- $Log$
- Revision 1.3  2002-09-07 16:01:26  peter
-   * old logs removed and tabs fixed
-
- Revision 1.2  2002/08/10 13:42:36  marco
-  * Fixes Posix dir copied to devel branch
-
-}

+ 0 - 130
rtl/posix/osposixh.tem

@@ -1,130 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2001 by Free Pascal development team
-
-    This file implements all the types/constants which must
-    be defined to port FPC to a new POSIX compliant OS.
-
-    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.
-
- **********************************************************************}
-
-{***********************************************************************}
-{                       POSIX TYPE DEFINITIONS                          }
-{***********************************************************************}
-
-type
-    { the following type definitions are compiler dependant }
-    { and system dependant                                  }
-
-    cint  =        { minimum range is : 32-bit                   }
-    cuint =        { minimum range is : 32-bit                   }
-
-
-    dev_t  =              { used for device numbers      }
-    gid_t  =              { used for group IDs           }
-    ino_t  =              { used for file serial numbers }
-    mode_t =              { used for file attributes     }
-    nlink_t  =            { used for link counts         }
-    off_t  =              { used for file sizes          }
-    pid_t  =              { used as process identifier   }
-    size_t =              { as definied in the C standard }
-    ssize_t =             { used by function for returning number of bytes }
-    uid_t =               { used for user ID type        }
-    time_t =              { used for returning the time  }
-
-{***********************************************************************}
-{                         POSIX STRUCTURES                              }
-{***********************************************************************}
-CONST
-    _UTSNAME_LENGTH = ;
-    _UTSNAME_NODENAME_LENGTH = ;
-
-TYPE
-   { system information services }
-   utsname = packed record   { don't forget to verify the alignment }
-   end;
-
-  { file characteristics services }
-   stat = packed record { verify the alignment of the members }
-   end;
-
-  { directory services }
-   pdirent = ^dirent;
-   dirent = packed record    { directory entry record - verify alignment }
-   end;
-
-   pdir = ^dir;
-   dir = packed record
-   end;
-
-
-{***********************************************************************}
-{                  POSIX CONSTANT ROUTINE DEFINITIONS                   }
-{***********************************************************************}
-CONST
-    { access routine - these maybe OR'ed together }
-    F_OK        =  ;   { test for existence of file }
-    R_OK        =  ;   { test for read permission on file }
-    W_OK        =  ;   { test for write permission on file }
-    X_OK        =  ;   { test for execute or search permission }
-    { seek routine }
-    SEEK_SET    =  ;    { seek from beginning of file }
-    SEEK_CUR    =  ;    { seek from current position  }
-    SEEK_END    =  ;    { seek from end of file       }
-    { open routine                                 }
-    { File access modes for `open' and `fcntl'.    }
-    O_RDONLY    =  ;	{ Open read-only.  }
-    O_WRONLY    =  ;	{ Open write-only. }
-    O_RDWR      =  ;	{ Open read/write. }
-    { Bits OR'd into the second argument to open.  }
-    O_CREAT     =  ;	{ Create file if it doesn't exist.  }
-    O_EXCL      =  ;	{ Fail if file already exists.      }
-    O_TRUNC     =  ;	{ Truncate file to zero length.     }
-    O_NOCTTY    =  ;	{ Don't assign a controlling terminal. }
-    { File status flags for `open' and `fcntl'.  }
-    O_APPEND    =  ;	{ Writes append to the file.        }
-    O_NONBLOCK	=  ;	{ Non-blocking I/O.                 }
-
-    { mode_t possible values                                 }
-    S_IRUSR =   ;           { Read permission for owner   }
-    S_IWUSR =   ;           { Write permission for owner  }
-    S_IXUSR =   ;           { Exec  permission for owner  }
-    S_IRGRP =   ;           { Read permission for group   }
-    S_IWGRP =   ;           { Write permission for group  }
-    S_IXGRP =   ;           { Exec permission for group   }
-    S_IROTH =   ;           { Read permission for world   }
-    S_IWOTH =   ;           { Write permission for world  }
-    S_IXOTH =   ;           { Exec permission for world   }
-
-    { Used for waitpid }
-    WNOHANG   = ;               { don't block waiting               }
-    WUNTRACED = ;               { report status of stopped children }
-
-    { POSIX limits, used for buffer and stack allocation }
-    ARG_MAX =           { Maximum number of argument size     }
-    NAME_MAX =          { Maximum number of bytes in filename }
-    PATH_MAX =          { Maximum number of bytes in pathname }
-    
-    {*************************************************************************}
-    {                               SIGNALS                                   }
-    {*************************************************************************}
-    
-    {$i signal.inc}
-
-
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.2  2002/08/10 13:42:36  marco
-   * Fixes Posix dir copied to devel branch
-
-}

+ 0 - 138
rtl/posix/posix.pp

@@ -1,138 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2001 by Carl Eric Codere
-    development team
-
-    POSIX Compliant interface unit
-
-    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 posix;
-
-interface
-
-{***********************************************************************}
-{                       POSIX PUBLIC INTERFACE                          }
-{***********************************************************************}
-
-
-{$i errno.inc}
-{$i osposixh.inc}
-
-type tgrparr = array[0..0] of gid_t;		{ C style array workarounds}
-     tfildes = array[0..1] of cint;
-
-    function sys_sigemptyset(var _set : sigset_t): cint;
-    function sys_sigfillset(var _set : sigset_t): cint;
-    function sys_sigaddset(var _set : sigset_t; signo : cint): cint;
-    function sys_sigdelset(var _set : sigset_t; signo : cint): cint;
-    function sys_sigismember(const _set : sigset_t; signo : cint): cint;
-    function sys_sigprocmask(how : cint; var _set : sigset_t; var _oset : sigset_t): cint;
-    function sys_sigpending(var _set : sigset_t): cint;
-    function sys_sigsuspend(const sigmask : sigset_t): cint;
-
-    function sys_umask(cmask : mode_t): mode_t;
-    function sys_link(existing : pchar; _new : pchar): cint;
-    function sys_mkfifo(path : pchar; mode : mode_t): cint;
-    function sys_chmod(path : pchar; mode : mode_t): cint;
-    function sys_chown(path: pchar; owner : uid_t; group : gid_t): cint;
-    function sys_utime(path : pchar; times : putimbuf): cint;
-    function sys_pipe(var fildes : tfildes):cint;
-    function sys_dup(fildes : cint): cint;
-    function sys_dup2(fildes, fildes2 : cint): cint;
-    function sys_times(var buffer : tms): clock_t;
-
-    function sys_alarm(seconds : cuint): cuint;
-    function sys_pause : cint;
-    function sys_sleep(seconds : cuint): cuint;
- 
-    function sys_getpid : pid_t;
-    function sys_getppid : pid_t;
-    function sys_getuid : uid_t;
-    function sys_geteuid : uid_t;
-    function sys_getgid : gid_t;
-    function sys_getegid : gid_t;
-    function sys_setuid(uid : uid_t): cint;
-    function sys_setgid(gid : gid_t): cint;
-    function sys_getgroups(gidsetsize : cint; var grouplist : tgrparr): cint;
-    function sys_getpgrp : pid_t;
-    function sys_setsid : pid_t;
-    function sys_fcntl(fildes : cint; cmd : cint): cint;
-    function sys_fcntl(fildes : cint; cmd : cint; arg : cint): cint;
-    function sys_fcntl(fildes : cint; cmd : cint; var arg : flock): cint;
-
-    function sys_getcwd(pt:pchar; _size:size_t):pchar;
-    function sys_fork : pid_t;
-    function sys_execve(path : pchar; argv : ppchar; envp: ppchar): cint;
-    function sys_execv(path : pchar; argv : ppchar): cint;
-    function sys_waitpid(pid : pid_t; var stat_loc : cint; options: cint): pid_t;
-    function sys_wait(var stat_loc : cint): pid_t;
-    procedure sys_exit(status : cint);
-    function sys_kill(pid : pid_t; sig: cint): cint;
-    { get system specific information }
-    function sys_uname(var name: utsname): cint;
-    function sys_opendir(const dirname : pchar): pdir;
-    function sys_readdir(var dirp : dir) : pdirent;
-    function sys_closedir(var dirp : dir): cint;
-    function sys_chdir(const path : pchar): cint;
-    function sys_open(const path: pchar; flags : cint; mode: mode_t):cint;
-    function sys_mkdir(const path : pchar; mode: mode_t):cint;
-    function sys_unlink(const path: pchar): cint;
-    function sys_rmdir(const path : pchar): cint;
-    function sys_rename(const old : pchar; const newpath: pchar): cint;
-    function sys_fstat(fd : cint; var sb : stat): cint;
-    function sys_stat(const path: pchar; var buf : stat): cint;
-    function sys_access(const pathname : pchar; amode : cint): cint;
-    function sys_close(fd : cint): cint;
-    function sys_read(fd: cint; buf: pchar; nbytes : size_t): ssize_t;
-    function sys_write(fd: cint;const buf:pchar; nbytes : size_t): ssize_t;
-    function sys_lseek(fd : cint; offset : off_t; whence : cint): off_t;
-    function sys_time(var tloc:time_t): time_t;
-    function sys_ftruncate(fd : cint; flength : off_t): cint;
-
-    function sys_getenv(const name : pchar): pchar;
-    function sys_getenv(name : string): pchar;
-
-    function S_ISDIR(m : mode_t): boolean;
-    function S_ISCHR(m : mode_t): boolean;
-    function S_ISBLK(m : mode_t): boolean;
-    function S_ISREG(m : mode_t): boolean;
-    function S_ISFIFO(m : mode_t): boolean;
-
-    function wifexited(status : cint): cint;
-    function wexitstatus(status : cint): cint;
-    function wstopsig(status : cint): cint;
-    function wifsignaled(status : cint): cint;
-    function wtermsig(status : cint): cint;
-    
-implementation
-
-{$i osposix.inc}
-
-end.
-
-{
-  $Log$
-  Revision 1.2  2002-11-14 12:17:28  marco
-   * for now.
-
-  Revision 1.2  2002/08/10 13:42:36  marco
-   * Fixes Posix dir copied to devel branch
-
-  Revision 1.1.2.2  2001/12/09 03:31:56  carl
-  + wifsignaled() added
-
-  Revision 1.1.2.1  2001/12/04 02:29:59  carl
-  + posix unit template file
-
-  Revision 1.1.2.1  2001/08/15 01:06:32  carl
-  + first version of posix unit
-
-}

+ 0 - 89
rtl/posix/posix.tem

@@ -1,89 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2001 by Carl Eric Codere
-    development team
-
-    POSIX Compliant interface unit
-
-    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 posix;
-
-interface
-
-{***********************************************************************}
-{                       POSIX PUBLIC INTERFACE                          }
-{***********************************************************************}
-
-
-{$i errno.inc}
-{$i osposixh.inc}
-
-
-    function sys_fork : pid_t;
-    function sys_execve(const path : pchar; const argv : ppchar; const envp: ppchar): cint;
-    function sys_waitpid(pid : pid_t; var stat_loc : cint; options: cint): pid_t;
-    procedure sys_exit(status : cint);
-    { get system specific information }
-    function sys_uname(var name: utsname): cint;
-    function sys_opendir(const dirname : pchar): pdir;
-    function sys_readdir(var dirp : dir) : pdirent;
-    function sys_closedir(var dirp : pdir): cint;
-    function sys_chdir(const path : pchar): cint;
-    function sys_open(const path: pchar; flags : cint; mode: mode_t):cint;
-    function sys_mkdir(const path : pchar; mode: mode_t):cint;
-    function sys_unlink(const path: pchar): cint;
-    function sys_rmdir(const path : pchar): cint;
-    function sys_rename(const old : pchar; const newpath: pchar): cint;
-    function sys_fstat(fd : cint; var sb : stat): cint;
-    function sys_stat(const path: pchar; var buf : stat): cint;
-    function sys_access(const pathname : pchar; amode : cint): cint;
-    function sys_close(fd : cint): cint;
-    function sys_read(fd: cint; buf: pchar; nbytes : size_t): ssize_t;
-    function sys_write(fd: cint;const buf:pchar; nbytes : size_t): ssize_t;
-    function sys_lseek(fd : cint; offset : off_t; whence : cint): off_t;
-    function sys_time(var tloc:time_t): time_t;
-
-
-    function sys_sigaction(sig: cint; var act : sigactionrec; var oact : sigactionrec): cint;
-    function sys_ftruncate(fd : cint; flength : off_t): cint;
-
-    function S_ISDIR(m : mode_t): boolean;
-    function S_ISCHR(m : mode_t): boolean;
-    function S_ISBLK(m : mode_t): boolean;
-    function S_ISREG(m : mode_t): boolean;
-    function S_ISFIFO(m : mode_t): boolean;
-
-    function wifexited(status : cint): cint;
-    function wexitstatus(status : cint): cint;
-    function wstopsig(status : cint): cint;
-    function wifsignaled(status : cint): cint;
-
-
-
-
-implementation
-
-{$i osposix.inc}
-
-
-
-
-end.
-
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.2  2002/08/10 13:42:36  marco
-   * Fixes Posix dir copied to devel branch
-
-}

+ 0 - 108
rtl/posix/readme.txt

@@ -1,108 +0,0 @@
-POSIX directory information
----------------------------
-This directory contains the system call interface to
-POSIX compliant systems. These files should be
-completed by OS-specific files. This permits to
-easily create  common and maintanable base
-runtime library units (such as dos and system).
-
-Limitations:
-------------
-- Only single byte character sets are supported (ASCII, ISO8859-1)
-- Path and filenames are limited to 255 characters 
-  (shortstrings are limited to 255 characters)
-
-Files in this directory
-
-posix.tem
-----------
-Posix unit template.
-
-dos.pp
-------
-POSIX compliant dos unit. The following routines
-and variables must be implemented / declared on
-a platform by platform basis:
-
-DiskFree()
-DiskSize()
-DosVersion()
-GetTimeZoneString(): Should return the string of
-the timezone information , as defined by POSIX,
-if not available, should return an empty string.
-This string is usually stored in the 'TZ' environment
-variable.
-GetTimeZoneFileName() : Should return the absolute path to 
-the timezone filename to use to convert the UTC time to 
-local time. The format of the timezone files are those 
-specific in glibc.
-FixDriveStr : Array of pchar which contains
-the names of the fixed disks :
-(index 0 : current directory
- index 1 : first floppy disk
- index 2 : second floppy disk
- index 3 : boot disk
-)
-
-
-sysposix.inc
-------------
-Most of the specific operating system
-routines which can be implemented using
-the POSIX interface are implemented in
-this unit. This should be included in
-the target operating system system unit
-to create a complete system unit.
-
-Files required to port the compiler to a POSIX
-compliant system (should reside in the target
-OS directory):
-
-  osposixh.inc : This includes all constants,
-  type definitions and structures used
-  (this is operating system dependant), except
-  for those related to signals. It includes
-  the signal file.
-
-  osposix.inc : The actuall system call routines
-  to the routine prototypes defined in posixh.inc.
-  (either these can be an interface to a libc, or
-  actual system calls).
-
-  errno.inc : All possible error codes which
-  can be returned by the operating system.
-  
-  signal.inc : Defines all constants and types
-  related to signals, it must at least define
-  the POSIX signal types and constants, but
-  can also add other OS specific types and
-  constants related to signals.
-
-
-Templates for the osposix.inc file (when linked
-with the GNU libc), errno.inc and osposixh.inc
-are included in this directory and have the 
-extension .tem . They should be used as a basis 
-to port to a new operating system.
-
-When sysposix.inc is used, the following system
-unit routines must be implemented for each new
-operating system, as they are not reproducable
-under the POSIX interface:
-
- function sbrk(size : longint): longint;
- procedure do_truncate (handle,pos:longint);
- function do_isdevice(handle:longint):boolean;
-
-When dos.pp is used, the following dos
-unit routines must be implemented for each new
-operating system, as they are not reproducable
-under the POSIX interface:
-
- function diskfree(drive : byte) : int64;
- function disksize(drive: byte) : int64;
-
-
-
-
-

+ 0 - 66
rtl/posix/signal.tem

@@ -1,66 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2001 by Free Pascal development team
-
-    This file implements all the types/constants which must
-    be defined to port FPC to a new POSIX compliant OS.
-    This defines all signal related types and constants.
-
-    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.
-
- **********************************************************************}
-
-type
-    sigset_t =;          { used for additional signal   }
-
-
-   sighandler_t = procedure (signo: cint); cdecl;
-
-   { signal services }
-   sigactionrec = packed record
-   end;
-
-
-const
-
-    {************************ signals *****************************}
-    { more can be provided. Herein are only included the required  }
-    { values.                                                      }
-    {**************************************************************}
-    SIGABRT    =  ;     { abnormal termination           }
-    SIGALRM    =  ;     { alarm clock (used with alarm() }
-    SIGFPE     =  ;     { illegal arithmetic operation   }
-    SIGHUP     =  ;     { Hangup                         }
-    SIGILL     =  ;     { Illegal instruction            }
-    SIGINT     =  ;     { Interactive attention signal   }
-    SIGKILL    =  ;     { Kill, cannot be caught         }
-    SIGPIPE    =  ;     { Broken pipe signal             }
-    SIGQUIT    =  ;     { Interactive termination signal }
-    SIGSEGV    =  ;     { Detection of invalid memory reference }
-    SIGTERM    =  ;     { Termination request           }
-    SIGUSR1    =  ;     { Application defined signal 1  }
-    SIGUSR2    =  ;     { Application defined signal 2  }
-    SIGCHLD    =  ;     { Child process terminated / stopped }
-    SIGCONT    =  ;     { Continue if stopped               }
-    SIGSTOP    =  ;     { Stop signal. cannot be cuaght     }
-    SIGSTP     =  ;     { Interactive stop signal           }
-    SIGTTIN    =  ;     { Background read from TTY          }
-    SIGTTOU    =  ;     { Background write to TTY           }
-    SIGBUS     =  ;     { Access to undefined memory        }
-
-
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.2  2002/08/10 13:42:36  marco
-   * Fixes Posix dir copied to devel branch
-
-}

+ 0 - 669
rtl/posix/sysposix.inc

@@ -1,669 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-
-    POSIX Interface to the system unit
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This is the core of the system unit *nix systems (now FreeBSD
-     and Unix).
-
-    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.
-
- **********************************************************************}
-
-
-
-const
-     { Default creation mode for directories and files }
-
-     { read/write permission for everyone }
-     MODE_OPEN = S_IWUSR OR S_IRUSR OR
-                 S_IWGRP OR S_IRGRP OR
-                 S_IWOTH OR S_IROTH;
-     { read/write search permission for everyone }
-     MODE_MKDIR = MODE_OPEN OR
-                 S_IXUSR OR S_IXGRP OR S_IXOTH;
-
-
-{*****************************************************************************
-                         Stack check code
-*****************************************************************************}
-
-{
-{$IFOPT S+}
-{$DEFINE STACKCHECK}
-{$ENDIF}
-{$S-}
-procedure int_stackcheck(stack_size:longint);[public,alias:'FPC_STACKCHECK'];
-var
- c: cardinal;
-begin
- c := cardinal(Sptr) - cardinal(stack_size) - STACK_MARGIN;
- if (c <= cardinal(StackBottom)) then
-     HandleError(202);
-end;
-{$IFDEF STACKCHECK}
-{$S+}
-{$ENDIF}
-{$UNDEF STACKCHECK}
-}
-
-{*****************************************************************************
-                       Misc. System Dependent Functions
-*****************************************************************************}
-
-procedure System_exit;
-begin
-   sys_exit(cint(ExitCode));
-End;
-
-
-Function ParamCount: Longint;
-Begin
-  Paramcount:=argc-1
-End;
-
-
-function BackPos(c:char; const s: shortstring): integer;
-var
- i: integer;
-Begin
-  for i:=length(s) downto 0 do
-    if s[i] = c then break;
-  if i=0 then
-    BackPos := 0
-  else
-    BackPos := i;
-end;
-
-
- { variable where full path and filename and executable is stored }
- { is setup by the startup of the system unit.                    }
-var
- execpathstr : shortstring;
-
-function paramstr(l: longint) : string;
- var
-  s: string;
-  s1: string;
- begin
-   { stricly conforming POSIX applications  }
-   { have the executing filename as argv[0] }
-   if l=0 then
-     begin
-       paramstr := execpathstr;
-     end
-   else
-     paramstr:=strpas(argv[l]);
- end;
-
-Procedure Randomize;
-Begin
-  randseed:=longint(sys_time(nil));
-End;
-
-
-{*****************************************************************************
-                          Low Level File Routines
-*****************************************************************************}
-
-{
-  The lowlevel file functions should take care of setting the InOutRes to the
-  correct value if an error has occured, else leave it untouched
-}
-
-Function PosixToRunError  (PosixErrno : longint) : longint;
-{
-  Convert ErrNo error to the correct Inoutres value
-}
-
-begin
-  if PosixErrNo=0 then { Else it will go through all the cases }
-   exit;
-  case PosixErrNo of
-   Sys_ENFILE,
-   Sys_EMFILE : Inoutres:=4;
-   Sys_ENOENT : Inoutres:=2;
-    Sys_EBADF : Inoutres:=6;
-   Sys_ENOMEM,
-   Sys_EFAULT : Inoutres:=217;
-   Sys_EINVAL : Inoutres:=218;
-    Sys_EPIPE,
-    Sys_EINTR,
-      Sys_EIO,
-   Sys_EAGAIN,
-   Sys_ENOSPC : Inoutres:=101;
- Sys_ENAMETOOLONG : Inoutres := 3;
-    Sys_EROFS,
-   Sys_EEXIST,
-   Sys_ENOTEMPTY,
-   Sys_EACCES : Inoutres:=5;
-   Sys_EISDIR : InOutRes:=5;
-  else
-    begin
-       InOutRes := Integer(PosixErrno);
-    end;
-  end;
-end;
-
-Function Errno2InoutRes : longint;
-
-begin
-  Errno2InoutRes:=PosixToRunError(Errno);
-  InoutRes:=Errno2InoutRes;
-end;
-
-Procedure Do_Close(Handle:Longint);
-Begin
-  sys_close(cint(Handle));
-End;
-
-Procedure Do_Erase(p:pchar);
-var
- fileinfo : stat;
-Begin
-  { verify if the filename is actually a directory }
-  { if so return error and do nothing, as defined  }
-  { by POSIX                                       }
-  if sys_stat(p,fileinfo)<0 then
-   begin
-     Errno2Inoutres;
-     exit;
-   end;
-  if S_ISDIR(fileinfo.st_mode) then
-   begin
-     InOutRes := 2;
-     exit;
-   end;
-  sys_unlink(p);
-  Errno2Inoutres;
-End;
-
-{ truncate at a given position }
-procedure do_truncate (handle,fpos:longint);
-begin
-  { should be simulated in cases where it is not }
-  { available.                                   }
-  If sys_ftruncate(handle,fpos)<0 Then
-   Errno2Inoutres
-  Else
-   InOutRes:=0;
-end;
-
-
-
-Procedure Do_Rename(p1,p2:pchar);
-Begin
-  If sys_rename(p1,p2)<0 Then
-   Errno2Inoutres
-  Else
-   InOutRes:=0;
-End;
-
-
-Function Do_Write(Handle,Addr,Len:Longint):longint;
-Begin
-  repeat
-    Do_Write:=sys_write(Handle,pchar(addr),len);
-  until ErrNo<>Sys_EINTR;
-  If Do_Write<0 Then
-   Begin
-    Errno2InOutRes;
-    Do_Write:=0;
-   End
-  else
-   InOutRes:=0;
-End;
-
-
-Function Do_Read(Handle,Addr,Len:Longint):Longint;
-Begin
-  repeat
-    Do_Read:=sys_read(Handle,pchar(addr),len);
-  until ErrNo<>Sys_EINTR;
-  If Do_Read<0 Then
-   Begin
-    Errno2InOutRes;
-    Do_Read:=0;
-   End
-  else
-   InOutRes:=0;
-End;
-
-function Do_FilePos(Handle: Longint):longint;
-Begin
-  do_FilePos:=sys_lseek(Handle, 0, SEEK_CUR);
-  If Do_FilePos<0 Then
-    Errno2InOutRes
-  else
-   InOutRes:=0;
-End;
-
-Procedure Do_Seek(Handle,Pos:Longint);
-Begin
-  If sys_lseek(Handle, pos, SEEK_SET)<0 Then
-   Errno2Inoutres
-  Else
-   InOutRes:=0;
-End;
-
-Function Do_SeekEnd(Handle:Longint): Longint;
-begin
-  Do_SeekEnd:=sys_lseek(Handle,0,SEEK_END);
-  If Do_SeekEnd<0 Then
-   Errno2Inoutres
-  Else
-   InOutRes:=0;
-end;
-
-Function Do_FileSize(Handle:Longint): Longint;
-var
-  Info : Stat;
-  Ret  : Longint;
-Begin
-  Ret:=sys_fstat(handle,info);
-  If Ret=0 Then
-   Do_FileSize:=Info.st_size
-  else
-   Do_FileSize:=0;
-  If Ret<0 Then
-   Errno2InOutRes
-  Else
-   InOutRes:=0;
-End;
-
-Procedure Do_Open(var f;p:pchar;flags:longint);
-{
-  FileRec and textrec have both Handle and mode as the first items so
-  they could use the same routine for opening/creating.
-  when (flags and $100)   the file will be append
-  when (flags and $1000)  the file will be truncate/rewritten
-  when (flags and $10000) there is no check for close (needed for textfiles)
-}
-var
-  oflags : cint;
-Begin
-{ close first if opened }
-  if ((flags and $10000)=0) then
-   begin
-     case FileRec(f).mode of
-      fminput,fmoutput,fminout : Do_Close(FileRec(f).Handle);
-      fmclosed : ;
-     else
-      begin
-        inoutres:=102; {not assigned}
-        exit;
-      end;
-     end;
-   end;
-{ reset file Handle }
-  FileRec(f).Handle:=UnusedHandle;
-{ We do the conversion of filemodes here, concentrated on 1 place }
-  case (flags and 3) of
-   0 : begin
-         oflags :=O_RDONLY;
-         FileRec(f).mode:=fminput;
-       end;
-   1 : begin
-         oflags :=O_WRONLY;
-         FileRec(f).mode:=fmoutput;
-       end;
-   2 : begin
-         oflags :=O_RDWR;
-         FileRec(f).mode:=fminout;
-       end;
-  end;
-  if (flags and $1000)=$1000 then
-   oflags:=oflags or (O_CREAT or O_TRUNC)
-  else
-   if (flags and $100)=$100 then
-    oflags:=oflags or (O_APPEND);
-{ empty name is special }
-  if p[0]=#0 then
-   begin
-     case FileRec(f).mode of
-       fminput :
-         FileRec(f).Handle:=StdInputHandle;
-       fminout, { this is set by rewrite }
-       fmoutput :
-         FileRec(f).Handle:=StdOutputHandle;
-       fmappend :
-         begin
-           FileRec(f).Handle:=StdOutputHandle;
-           FileRec(f).mode:=fmoutput; {fool fmappend}
-         end;
-     end;
-     exit;
-   end;
-{ real open call }
-  FileRec(f).Handle:=sys_open(p,oflags,MODE_OPEN);
-  if (ErrNo=Sys_EROFS) and ((OFlags and O_RDWR)<>0) then
-   begin
-     Oflags:=Oflags and not(O_RDWR);
-     FileRec(f).Handle:=sys_open(p,oflags,MODE_OPEN);
-   end;
-  If Filerec(f).Handle<0 Then
-   Errno2Inoutres
-  else
-   InOutRes:=0;
-End;
-
-
-
-{*****************************************************************************
-                           Directory Handling
-*****************************************************************************}
-
-Procedure MkDir(Const s: String);[IOCheck];
-Var
-  Buffer: Array[0..255] of Char;
-Begin
-  If (s='') or (InOutRes <> 0) then
-   exit;
-  Move(s[1], Buffer, Length(s));
-  Buffer[Length(s)] := #0;
-  If sys_mkdir(@buffer, MODE_MKDIR)<0 Then
-   Errno2Inoutres
-  Else
-   InOutRes:=0;
-End;
-
-
-Procedure RmDir(Const s: String);[IOCheck];
-Var
-  Buffer: Array[0..255] of Char;
-Begin
-  if (s = '.') then
-    InOutRes := 16;
-  If (s='') or (InOutRes <> 0) then
-   exit;
-  Move(s[1], Buffer, Length(s));
-  Buffer[Length(s)] := #0;
-  If sys_rmdir(@buffer)<0 Then
-   Errno2Inoutres
-  Else
-   InOutRes:=0;
-End;
-
-
-Procedure ChDir(Const s: String);[IOCheck];
-Var
-  Buffer: Array[0..255] of Char;
-Begin
-  If (s='') or (InOutRes <> 0) then
-   exit;
-  Move(s[1], Buffer, Length(s));
-  Buffer[Length(s)] := #0;
-  If sys_chdir(@buffer)<0 Then
-   Errno2Inoutres
-  Else
-   InOutRes:=0;
-  { file not exists is path not found under tp7 }
-  if InOutRes=2 then
-   InOutRes:=3;
-End;
-
-{ // $define usegetcwd}
-
-procedure getdir(drivenr : byte;var dir : shortstring);
-var
-{$ifndef usegetcwd}
-  cwdinfo      : stat;
-  rootinfo     : stat;
-  thedir,dummy : string[255];
-  dirstream    : pdir;
-  d            : pdirent;
-  name         : string[255];
-  thisdir      : stat;
-{$endif}
-  tmp          : string[255];
-
-begin
-{$ifdef usegetcwd}
- sys_getcwd(@tmp[1],255);
- dir:=tmp;
-{$else}
-  dir:='';
-  thedir:='';
-  dummy:='';
-
-  { get root directory information }
-  tmp := '/'+#0;
-  if sys_stat(@tmp[1],rootinfo)<0 then
-      Begin
-      Errno2Inoutres;
-      Exit
-     End
-    Else
-     InOutRes:=0;
-  repeat
-    tmp := dummy+'.'+#0;
-    { get current directory information }
-    if sys_stat(@tmp[1],cwdinfo)<0 then
-      Begin
-        Errno2Inoutres;
-        Exit
-      End
-    Else
-      InOutRes:=0;
-    tmp:=dummy+'..'+#0;
-    { open directory stream }
-    { try to find the current inode number of the cwd }
-    dirstream:=sys_opendir(@tmp[1]);
-    if dirstream=nil then
-       exit;
-    repeat
-      name:='';
-      d:=sys_readdir(dirstream);
-      { no more entries to read ... }
-      if not assigned(d) then
-        begin
-          break;
-        end;
-      tmp:=dummy+'../'+strpas(d^.d_name) + #0;
-      if sys_stat(@tmp[1],thisdir)<0 then
-        begin
-          Errno2Inoutres;
-          Exit
-        End
-      Else
-        InOutRes:=0;
-      { found the entry for this directory name }
-      if (cwdinfo.st_dev=thisdir.st_dev) and (cwdinfo.st_ino=thisdir.st_ino) then
-        begin
-          { are the filenames of type '.' or '..' ? }
-          { then do not set the name.               }
-          if (not ((d^.d_name[0]='.') and ((d^.d_name[1]=#0) or
-                  ((d^.d_name[1]='.') and (d^.d_name[2]=#0))))) then
-            begin
-              name:='/'+strpas(d^.d_name);
-            end;
-        end
-    until (name<>'');
-    If sys_closedir(dirstream)<0 THen
-      Begin
-        Errno2Inoutres;
-        Exit
-      End
-    Else
-      InOutRes:=0;
-    thedir:=name+thedir;
-    dummy:=dummy+'../';
-    if ((cwdinfo.st_dev=rootinfo.st_dev) and (cwdinfo.st_ino=rootinfo.st_ino)) then
-      begin
-        if thedir='' then
-          dir:='/'
-        else
-          dir:=thedir;
-        exit;
-      end;
-  until false;
- {$endif}
-end;
-
-
-{*****************************************************************************
-                         SystemUnit Initialization
-*****************************************************************************}
-
-
-procedure SignalToRunerror(signo: cint); cdecl;
-var
-  res : word;
-begin
-    res:=0;
-    if signo = SIGFPE then
-     begin
-        res := 200;
-     end
-    else
-    if (signo = SIGILL) or (signo = SIGBUS) or (signo = SIGSEGV) then
-      begin
-        res := 216;
-      end;
-  { give runtime error at the position where the signal was raised }
-  if res<>0 then
-   begin
-     HandleError(res);
-   end;
-end;
-
-
-var
-  act: SigActionRec;
-
-Procedure InstallSignals;
-var
-  oldact: SigActionRec;
-begin
-  { Initialize the sigaction structure }
-  { all flags and information set to zero }
-  FillChar(act, sizeof(SigActionRec),0);
-  { initialize handler                    }
-  act.sa_handler := @SignalToRunError;
-  sys_SigAction(SIGFPE,act,oldact);
-  sys_SigAction(SIGSEGV,act,oldact);
-  sys_SigAction(SIGBUS,act,oldact);
-  sys_SigAction(SIGILL,act,oldact);
-end;
-
-
-procedure SetupCmdLine;
-var
-  bufsize,
-  len,j,
-  size,i : longint;
-  found  : boolean;
-  buf    : pchar;
-
-  procedure AddBuf;
-  begin
-    reallocmem(cmdline,size+bufsize);
-    move(buf^,cmdline[size],bufsize);
-    inc(size,bufsize);
-    bufsize:=0;
-  end;
-
-begin
-  GetMem(buf,ARG_MAX);
-  size:=0;
-  bufsize:=0;
-  i:=0;
-  while (i<argc) do
-   begin
-     len:=strlen(argv[i]);
-     if len>ARG_MAX-2 then
-      len:=ARG_MAX-2;
-     found:=false;
-     for j:=1 to len do
-      if argv[i][j]=' ' then
-       begin
-         found:=true;
-         break;
-       end;
-     if bufsize+len>=ARG_MAX-2 then
-      AddBuf;
-     if found then
-      begin
-        buf[bufsize]:='"';
-        inc(bufsize);
-      end;
-     move(argv[i]^,buf[bufsize],len);
-     inc(bufsize,len);
-     if found then
-      begin
-        buf[bufsize]:='"';
-        inc(bufsize);
-      end;
-     if i<argc then
-      buf[bufsize]:=' '
-     else
-      buf[bufsize]:=#0;
-     inc(bufsize);
-     inc(i);
-   end;
-  AddBuf;
-  FreeMem(buf,ARG_MAX);
-end;
-
-(*
-Begin
-{ Set up signals handlers }
-   InstallSignals;
-{ Setup heap }
-  InitHeap;
-  InitExceptions;
-{ Arguments }
-  SetupCmdLine;
-{ Setup stdin, stdout and stderr }
-  OpenStdIO(Input,fmInput,StdInputHandle);
-  OpenStdIO(Output,fmOutput,StdOutputHandle);
-  OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
-  OpenStdIO(StdOut,fmOutput,StdOutputHandle);
-  OpenStdIO(StdErr,fmOutput,StdErrorHandle);
-{ Reset IO Error }
-  InOutRes:=0;
-End.
-*)
-{
- $Log$
- Revision 1.9  2004-11-04 09:32:31  peter
- ErrOutput added
-
- Revision 1.8  2004/10/25 15:38:59  peter
-   * compiler defined HEAP and HEAPSIZE removed
-
- Revision 1.7  2002/11/14 12:18:03  marco
-  * fixed sys_time call to (NIL)
-
- Revision 1.6  2002/10/27 17:21:29  marco
-  * Only "difficult" functions + execvp + termios + rewinddir left to do
-
- Revision 1.5  2002/10/26 18:27:52  marco
-  * First series POSIX calls commits. Including getcwd.
-
- Revision 1.4  2002/09/07 16:01:26  peter
-   * old logs removed and tabs fixed
-
- Revision 1.3  2002/08/20 12:50:22  marco
-  * New errno handling. Should be libc compatible.
-
- Revision 1.2  2002/08/10 13:42:36  marco
-  * Fixes Posix dir copied to devel branch
-
- Revision 1.1.2.18  2002/03/10 11:45:02  carl
- * InOutRes := 16 with rmdir()
- * InOutRes := 5 more checking
-
- Revision 1.1.2.17  2002/03/03 15:11:51  carl
- * erase() bugfix (erasing a directory is done via rmdir() only!)
-
- Revision 1.1.2.16  2002/02/15 18:13:35  carl
- * bugfix for paramstr(0)
-
-}

+ 0 - 600
rtl/posix/sysutils.pp

@@ -1,600 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2001 by Florian Klaempfl
-    member of the Free Pascal development team
-
-    Sysutils unit for POSIX compliant systems
-
-    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 sysutils;
-interface
-
-{$MODE objfpc}
-{ force ansistrings }
-{$H+}
-
-
-{ Include platform independent interface part }
-{$i sysutilh.inc}
-
-{ Platform dependent calls }
-
-Procedure AddDisk(const path:string);
-
-implementation
-
-  uses
-    sysconst,dos,posix;
- 
-{ Include platform independent implementation part }
-{$i sysutils.inc}
-
-
-
-{****************************************************************************
-                              File Functions
-****************************************************************************}
-{$I-}
-const
-     { read/write permission for everyone }
-     MODE_OPEN = S_IWUSR OR S_IRUSR OR
-                 S_IWGRP OR S_IRGRP OR
-                 S_IWOTH OR S_IROTH;
-
-
-Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
-
-Var Flags : cint;
-    FileHandle : cint;
-{    lock: flock;}
-BEGIN
-  Flags:=0;
-  Case (Mode and 3) of
-    fmOpenRead : Flags:=Flags or O_RDONLY;
-    fmOpenWrite : Flags:=Flags or O_WRONLY;
-    fmOpenReadWrite : Flags:=Flags or O_RDWR;
-  end;
-  FileHandle:=sys_Open (pchar(FileName),Flags,MODE_OPEN);
-  if (ErrNo=Sys_EROFS) and ((Flags and O_RDWR)<>0) then
-   begin
-     Flags:=Flags and not(O_RDWR);
-     FileHandle:=sys_open(pchar(FileName),Flags,MODE_OPEN);
-   end;
-  FileOpen := longint(FileHandle);
-(*
-  { if there was an error, then don't do anything }
-  if FileHandle = -1 then
-     exit;
-  { now check if the file can actually be used }
-  { by verifying the locks on the file         }
-  lock.l_whence := SEEK_SET;
-  lock.l_start := 0; { from start of file }
-  lock.l_len := 0;   { to END of file    }
-  if sys_fcntl(FileHandle, F_GETLK, @lock)<>-1 then
-    begin
-        { if another process has created a lock on this file }
-        { exclusive lock? }
-        if (lock.l_type = F_WRLCK) then
-           begin
-             { close and exit }
-             sys_close(FileHandle);
-             FileOpen := -1;
-             exit;
-           end;
-        { shared lock? }
-        if (lock.l_type = F_RDLK) and
-          ((Flags = O_RDWR) or Flags = O_WRONLY)) then
-           begin
-             { close and exit }
-             sys_close(FileHandle);
-             FileOpen := -1;
-             exit;
-           end;
-    end;
-  { now actually set the lock: }
-  { only the following are simulated with sysutils : }
-  {  - fmShareDenywrite (get exclusive lock)         }
-  {  - fmShareExclusive (get exclusive lock)         }
-  if ((Mode and fmShareDenyWrite)<>0) or
-     ((Mode and fmShareExclusive)<>0) then
-    begin
-      lock.l_whence := SEEK_SET;
-      lock.l_start := 0; { from stat of file    }
-      lock.l_len := 0;   { to END of file       }
-      lock.l_type := F_WRLCK;  { exclusive lock }
-      if sys_fcntl(FileHandle, F_SETLK, @lock)=-1 then
-        begin
-          sys_close(FileHandel);
-          FileOpen := -1;
-          exit;
-        end;
-    end;
-*)
-end;
-
-
-Function FileCreate (Const FileName : String) : Longint;
-
-begin
-  FileCreate:=sys_Open(pchar(FileName),O_RDWR or O_CREAT or O_TRUNC,MODE_OPEN);
-end;
-
-
-Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
-
-begin
-  repeat
-    FileRead:=sys_read(Handle,pchar(@Buffer),Count);
-  until ErrNo<>Sys_EINTR;
-  If FileRead = -1 then
-    FileRead := 0;
-end;
-
-
-Function FileWrite (Handle : Longint; const Buffer; Count : Longint) : Longint;
-
-begin
-  repeat
-    FileWrite:=sys_write(Handle,pchar(@Buffer),Count);
-  until ErrNo<>Sys_EINTR;
-  if FileWrite = -1 then
-    FileWrite := 0;
-end;
-
-
-Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
-var
- whence : cint;
-begin
-  FileSeek := -1;
-  case Origin of
-  { from beginning of file }
-  0 :  whence := SEEK_SET;
-  { from current position }
-  1 :  whence := SEEK_CUR;
-  { from end of file       }
-  2 :  whence := SEEK_END;
-  else
-   exit;
-  end;
-  FileSeek := sys_lseek(Handle,FOffset,whence);
-  if errno <> 0 then
-   FileSeek := -1;
-end;
-
-
-Procedure FileClose (Handle : Longint);
-
-begin
-  sys_close(Handle);
-end;
-
-Function FileTruncate (Handle,Size: Longint) : boolean;
-
-begin
-  if sys_ftruncate(Handle,Size)=0 then
-    FileTruncate := true
-  else
-    FileTruncate := false;
-end;
-
-
-Function FileAge (Const FileName : String): Longint;
-
-var F: file;
-    Time: longint;
-begin
-   Assign(F,FileName);
-   Reset(F,1);
-   dos.GetFTime(F,Time);
-   Close(F);
-   FileAge := Time;
-end;
-
-
-Function FileExists (Const FileName : String) : Boolean;
-
-Var Info : Stat;
-
-begin
-  if sys_stat(pchar(filename),Info)<>0 then
-    FileExists := false
-  else
-    FileExists := true;
-end;
-
-
-Function UNIXToWinAttr (FN : Pchar; Const Info : Stat) : Longint;
-
-begin
-  Result:=faArchive;
-  If S_ISDIR(Info.st_mode) then
-    Result:=Result or faDirectory ;
-  If (FN[0]='.') and (not (FN[1] in [#0,'.']))  then
-    Result:=Result or faHidden;
-  if (info.st_mode and S_IWUSR)=0 then
-    Result:=Result or fareadonly;
-  If S_ISREG(Info.st_Mode) Then
-     Result:=Result or faSysFile;
-end;
-
-
-
-
-type
-  PDOSSearchRec = ^SearchRec;
-
-Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
-
-Const
-  faSpecial = faHidden or faSysFile or faVolumeID or faDirectory;
-var
-  p : pDOSSearchRec;
-  dosattr: word;
-begin
- dosattr:=0;
- if Attr and faHidden <> 0 then
-   dosattr := dosattr or Hidden;
- if Attr and faSysFile <> 0 then
-   dosattr := dosattr or SysFile;
- if Attr and favolumeID <> 0 then
-   dosattr := dosattr or VolumeID;
- if Attr and faDirectory <> 0 then
-   dosattr := dosattr or faDirectory;
- New(p);
- Rslt.FindHandle :=  THandle(p);
- dos.FindFirst(path,dosattr,p^);
- if DosError <> 0 then
-    begin
-      FindFirst := -1;
-    end
- else
-   begin
-     Rslt.Name := p^.Name;
-     Rslt.Time := p^.Time;
-     Rslt.Attr := p^.Attr;
-     Rslt.ExcludeAttr := not p^.Attr;
-     Rslt.Size := p^.Size;
-     FindFirst := 0;
-   end;
-end;
-
-
-Function FindNext (Var Rslt : TSearchRec) : Longint;
-var
- p : pDOSSearchRec;
-begin
-  p:= PDOsSearchRec(Rslt.FindHandle);
-  if not assigned(p) then
-     begin
-       FindNext := -1;
-       exit;
-     end;
-  Dos.FindNext(p^);
- if DosError <> 0 then
-    begin
-      FindNext := -1;
-    end
- else
-   begin
-     Rslt.Name := p^.Name;
-     Rslt.Time := p^.Time;
-     Rslt.Attr := p^.Attr;
-     Rslt.ExcludeAttr := not p^.Attr;
-     Rslt.Size := p^.Size;
-     FindNext := 0;
-   end;
-end;
-
-
-Procedure FindClose (Var F : TSearchrec);
-
-Var
-  p : PDOSSearchRec;
-
-begin
-  p:=PDOSSearchRec(f.FindHandle);
-  if not assigned(p) then
-       exit;
-  Dos.FindClose(p^);
-  if assigned(p) then
-     Dispose(p);
-  f.FindHandle := THandle(nil);
-end;
-
-Function FileGetDate (Handle : Longint) : Longint;
-
-Var Info : Stat;
-
-begin
-  If sys_FStat(Handle,Info)<>0 then
-    Result:=-1
-  else
-    Result:=Info.st_mtime;
-end;
-
-
-Function FileSetDate (Handle,Age : Longint) : Longint;
-
-begin
-  // Impossible under unix from FileHandle !!
-  FileSetDate:=-1;
-end;
-
-
-Function FileGetAttr (Const FileName : String) : Longint;
-
-Var Info : Stat;
-
-begin
-  If sys_stat (pchar(FileName),Info)<>0 then
-    Result:=-1
-  Else
-    Result:=UNIXToWinAttr(Pchar(FileName),Info);
-end;
-
-
-Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
-
-begin
-  Result:=-1;
-end;
-
-
-Function DeleteFile (Const FileName : String) : Boolean;
-begin
-  if sys_unlink(pchar(FileName))=0 then
-    DeleteFile := true
-  else
-    DeleteFile := false;
-end;
-
-Function RenameFile (Const OldName, NewName : String) : Boolean;
-
-begin
-  { you can directly typecast and ansistring to a pchar }
-  if sys_rename(pchar(OldName),pchar(NewName))=0 then
-    RenameFile := TRUE
-  else
-    RenameFile := FALSE;
-end;
-
-
-
-
-{****************************************************************************
-                              Disk Functions
-****************************************************************************}
-
-{
-  The Diskfree and Disksize functions need a file on the specified drive, since this
-  is required for the statfs system call.
-  These filenames are set in drivestr[0..26], and have been preset to :
-   0 - '.'      (default drive - hence current dir is ok.)
-   1 - '/fd0/.'  (floppy drive 1 - should be adapted to local system )
-   2 - '/fd1/.'  (floppy drive 2 - should be adapted to local system )
-   3 - '/'       (C: equivalent of dos is the root partition)
-   4..26          (can be set by you're own applications)
-  ! Use AddDisk() to Add new drives !
-  They both return -1 when a failure occurs.
-}
-Const
-  FixDriveStr : array[0..3] of pchar=(
-    '.',
-    '/fd0/.',
-    '/fd1/.',
-    '/.'
-    );
-var
-  Drives   : byte;
-  DriveStr : array[4..26] of pchar;
-
-Procedure AddDisk(const path:string);
-begin
-  if not (DriveStr[Drives]=nil) then
-   FreeMem(DriveStr[Drives],StrLen(DriveStr[Drives])+1);
-  GetMem(DriveStr[Drives],length(Path)+1);
-  StrPCopy(DriveStr[Drives],path);
-  inc(Drives);
-  if Drives>26 then
-   Drives:=4;
-end;
-
-
-
-Function DiskFree(Drive: Byte): int64;
-Begin
-  DiskFree := dos.diskFree(Drive);
-End;
-
-
-
-Function DiskSize(Drive: Byte): int64;
-Begin
-  DiskSize := dos.DiskSize(Drive);
-End;
-
-
-
-
-Function GetCurrentDir : String;
-begin
-  GetDir (0,Result);
-end;
-
-
-Function SetCurrentDir (Const NewDir : String) : Boolean;
-begin
-   ChDir(NewDir);
-  result := (IOResult = 0);
-end;
-
-
-Function CreateDir (Const NewDir : String) : Boolean;
-begin
-   MkDir(NewDir);
-  result := (IOResult = 0);
-end;
-
-
-Function RemoveDir (Const Dir : String) : Boolean;
-begin
-   RmDir(Dir);
-  result := (IOResult = 0);
-end;
-
-
-Function DirectoryExists(const Directory: string): Boolean;
-
-var
-  Info : Stat;
-  l: cint;
-begin
-  l:=sys_Stat(pchar(Directory),Info);
-  if l<>0 then
-    Result:=S_ISDIR(info.st_mode)
-  else
-    Result := false;
-end;
-
-
-{****************************************************************************
-                              Misc Functions
-****************************************************************************}
-
-procedure Beep;
-begin
-end;
-
-
-{****************************************************************************
-                              Locale Functions
-****************************************************************************}
-
-Procedure GetLocalTime(var SystemTime: TSystemTime);
-var
- dayOfWeek: word;
-begin
-  dos.GetTime(SystemTime.Hour, SystemTime.Minute, SystemTime.Second,SystemTime.Millisecond);
-  dos.GetDate(SystemTime.Year, SystemTime.Month, SystemTime.Day, DayOfWeek);
-end ;
-
-
-Procedure InitAnsi;
-Var
-  i : longint;
-begin
-  {  Fill table entries 0 to 127  }
-  for i := 0 to 96 do
-    UpperCaseTable[i] := chr(i);
-  for i := 97 to 122 do
-    UpperCaseTable[i] := chr(i - 32);
-  for i := 123 to 191 do
-    UpperCaseTable[i] := chr(i);
-  Move (CPISO88591UCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
-
-  for i := 0 to 64 do
-    LowerCaseTable[i] := chr(i);
-  for i := 65 to 90 do
-    LowerCaseTable[i] := chr(i + 32);
-  for i := 91 to 191 do
-    LowerCaseTable[i] := chr(i);
-  Move (CPISO88591LCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
-end;
-
-
-Procedure InitInternational;
-begin
-  InitAnsi;
-end;
-
-function SysErrorMessage(ErrorCode: Integer): String;
-
-begin
-{  Result:=StrError(ErrorCode);}
-end;
-
-{****************************************************************************
-                              OS utility functions
-****************************************************************************}
-
-Function GetEnvironmentVariable(Const EnvVar : String) : String;
-
-begin
-  Result:=Dos.Getenv(shortstring(EnvVar));
-end;
-
-Function GetEnvironmentVariableCount : Integer;
-
-begin
-  // Bad bad bad...
-  Result:=Dos.EnvCount;
-  // Result:=FPCCountEnvVar(EnvP);
-end;
-    
-Function GetEnvironmentString(Index : Integer) : String;
-    
-begin
-  // Bad bad bad...
-  Result:=Dos.EnvStr(Index);
-  // Result:=FPCGetEnvStrFromP(Envp,Index);
-end;
-        
-
-{****************************************************************************
-                              Initialization code
-****************************************************************************}
-
-Initialization
-  InitExceptions;       { Initialize exceptions. OS independent }
-  InitInternational;    { Initialize internationalization settings }
-Finalization
-  DoneExceptions;
-end.
-{
-    $Log$
-    Revision 1.10  2004-12-11 11:32:44  michael
-    + Added GetEnvironmentVariableCount and GetEnvironmentString calls
-
-    Revision 1.9  2003/11/26 20:00:19  florian
-      * error handling for Variants improved
-
-    Revision 1.8  2003/10/25 23:43:59  hajny
-      * THandle in sysutils common using System.THandle
-
-    Revision 1.7  2003/10/09 20:13:19  florian
-      * more type alias updates as suggested by DarekM
-
-    Revision 1.6  2003/04/01 15:57:41  peter
-      * made THandle platform dependent and unique type
-
-    Revision 1.5  2003/03/29 15:36:58  hajny
-      * DirectoryExists merged from the fixes branch
-
-    Revision 1.4  2003/03/29 15:16:26  hajny
-      * dummy DirectoryExists added
-
-    Revision 1.3  2002/09/07 16:01:26  peter
-      * old logs removed and tabs fixed
-
-    Revision 1.2  2002/08/10 13:42:36  marco
-     * Fixes Posix dir copied to devel branch
-
-    Revision 1.1.2.5  2002/04/28 07:28:43  carl
-    * some cleanup
-
-    Revision 1.1.2.4  2002/03/03 08:47:37  carl
-    + FindFirst / FindNext implemented
-
-    Revision 1.1.2.3  2002/01/22 07:41:11  michael
-    + Fixed FileSearch bug in Win32 and made FIleSearch platform independent
-
-}

+ 0 - 442
rtl/posix/timezone.inc

@@ -1,442 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2002 by the Free Pascal development team.
-
-    Timezone extraction routines
-
-    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.
-
- **********************************************************************}
-
-const
-  TZ_MAGIC = 'TZif';
-
-type
-  plongint=^longint;
-  pbyte=^byte;
-
-  ttzhead=packed record
-    tzh_magic : array[0..3] of char;
-    tzh_reserved : array[1..16] of byte;
-    tzh_ttisgmtcnt,
-    tzh_ttisstdcnt,
-    tzh_leapcnt,
-    tzh_timecnt,
-    tzh_typecnt,
-    tzh_charcnt  : longint;
-  end;
-
-  pttinfo=^tttinfo;
-  tttinfo=packed record
-    offset : longint;
-    isdst  : boolean;
-    idx    : byte;
-    isstd  : byte;
-    isgmt  : byte;
-  end;
-
-  pleap=^tleap;
-  tleap=record
-    transition : longint;
-    change     : longint;
-  end;
-
-var
-  num_transitions,
-  num_leaps,
-  num_types    : longint;
-
-  transitions  : plongint;
-  type_idxs    : pbyte;
-  types        : pttinfo;
-  zone_names   : pchar;
-  leaps        : pleap;
-
-function find_transition(timer:time_t):pttinfo;
-var
-  i : longint;
-begin
-  if (num_transitions=0) or (timer<time_t(transitions[0])) then
-   begin
-     i:=0;
-     while (i<num_types) and (types[i].isdst) do
-      inc(i);
-     if (i=num_types) then
-      i:=0;
-   end
-  else
-   begin
-     for i:=1 to num_transitions do
-      if (timer<transitions[i]) then
-       break;
-     i:=type_idxs[i-1];
-   end;
-  find_transition:=@types[i];
-end;
-
-
-procedure GetLocalTimezone(timer:time_t;var leap_correct,leap_hit:longint);
-var
-  info : pttinfo;
-  i    : longint;
-begin
-{ reset }
-  TZDaylight:=false;
-  TZSeconds:=0;
-  TZName[false]:=nil;
-  TZName[true]:=nil;
-  leap_correct:=0;
-  leap_hit:=0;
-{ get info }
-  info:=find_transition(timer);
-  if not assigned(info) then
-   exit;
-  TZDaylight:=info^.isdst;
-  TZSeconds:=info^.offset;
-  i:=0;
-  while (i<num_types) do
-   begin
-     tzname[types[i].isdst]:=@zone_names[types[i].idx];
-     inc(i);
-   end;
-  tzname[info^.isdst]:=@zone_names[info^.idx];
-  i:=num_leaps;
-  repeat
-    if i=0 then
-     exit;
-    dec(i);
-  until (timer>leaps[i].transition);
-  leap_correct:=leaps[i].change;
-  if (timer=leaps[i].transition) and
-     (((i=0) and (leaps[i].change>0)) or
-      (leaps[i].change>leaps[i-1].change)) then
-   begin
-     leap_hit:=1;
-     while (i>0) and
-           (leaps[i].transition=leaps[i-1].transition+1) and
-           (leaps[i].change=leaps[i-1].change+1) do
-      begin
-        inc(leap_hit);
-        dec(i);
-      end;
-   end;
-end;
-
-
-procedure GetLocalTimezone(timer:longint);
-var
-  lc,lh : longint;
-begin
-  GetLocalTimezone(timer,lc,lh);
-end;
-
-
-procedure ReadTimezoneFile(fn:string);
-
-  procedure decode(var l:longint);
-  var
-    k : longint;
-    p : pbyte;
-  begin
-    p:=pbyte(@l);
-    if (p[0] and (1 shl 7))<>0 then
-     k:=not 0
-    else
-     k:=0;
-    k:=(k shl 8) or p[0];
-    k:=(k shl 8) or p[1];
-    k:=(k shl 8) or p[2];
-    k:=(k shl 8) or p[3];
-    l:=k;
-  end;
-
-var
-  f      : File;
-  tzdir  : string;
-  tzhead : ttzhead;
-  i      : longint;
-  chars  : longint;
-  buf    : pbyte;
-  _result : longint;
-  label  lose;
-begin
-  if fn = '' then
-    exit;
-{$IFOPT I+}
-{$DEFINE IOCHECK_ON}
-{$ENDIF}
-{$I-}
-  Assign(F, fn);
-  Reset(F,1);
-  If IOResult <> 0 then
-   exit;
-{$IFDEF IOCHECK_ON}
-{$I+}
-{$ENDIF}
-{$UNDEF IOCHECK_ON}
-  BlockRead(f,tzhead,sizeof(tzhead),i);
-  if i<>sizeof(tzhead) then
-     goto lose;
-  if tzhead.tzh_magic<>TZ_MAGIC then
-  begin
-     goto lose;
-  end;
-  decode(tzhead.tzh_timecnt);
-  decode(tzhead.tzh_typecnt);
-  decode(tzhead.tzh_charcnt);
-  decode(tzhead.tzh_leapcnt);
-  decode(tzhead.tzh_ttisstdcnt);
-  decode(tzhead.tzh_ttisgmtcnt);
-
-  num_transitions:=tzhead.tzh_timecnt;
-  num_types:=tzhead.tzh_typecnt;
-  chars:=tzhead.tzh_charcnt;
-
-  reallocmem(transitions,num_transitions*sizeof(longint));
-  reallocmem(type_idxs,num_transitions);
-  reallocmem(types,num_types*sizeof(tttinfo));
-  reallocmem(zone_names,chars);
-  reallocmem(leaps,num_leaps*sizeof(tleap));
-
-  BlockRead(f,transitions^,num_transitions*4,_result);
-  if _result <> num_transitions*4 then
-  begin
-     goto lose;
-  end;
-  BlockRead(f,type_idxs^,num_transitions,_result);
-  if _result <> num_transitions then
-  begin
-    goto lose;
-  end;
-  {* Check for bogus indices in the data file, so we can hereafter
-     safely use type_idxs[T] as indices into `types' and never crash.  *}
-  for i := 0 to num_transitions-1 do
-    if (type_idxs[i] >= num_types) then
-    begin
-      goto lose;
-    end;
-
-
-  for i:=0 to num_transitions-1 do
-   decode(transitions[i]);
-
-  for i:=0 to num_types-1 do
-   begin
-     blockread(f,types[i].offset,4,_result);
-     if _result <> 4 then
-     begin
-      goto lose;
-     end;
-     blockread(f,types[i].isdst,1,_result);
-     if _result <> 1 then
-     begin
-      goto lose;
-     end;
-     blockread(f,types[i].idx,1,_result);
-     if _result <> 1 then
-     begin
-      goto lose;
-     end;
-     decode(types[i].offset);
-     types[i].isstd:=0;
-     types[i].isgmt:=0;
-   end;
-
-  blockread(f,zone_names^,chars,_result);
-  if _result<>chars then
-     begin
-      goto lose;
-     end;
-
-
-  for i:=0 to num_leaps-1 do
-   begin
-     blockread(f,leaps[i].transition,4);
-     if _result <> 4 then
-     begin
-      goto lose;
-     end;
-     blockread(f,leaps[i].change,4);
-     begin
-      goto lose;
-     end;
-     decode(leaps[i].transition);
-     decode(leaps[i].change);
-   end;
-
-  getmem(buf,tzhead.tzh_ttisstdcnt);
-  blockread(f,buf^,tzhead.tzh_ttisstdcnt,_result);
-  if _result<>tzhead.tzh_ttisstdcnt then
-     begin
-      goto lose;
-     end;
-  for i:=0 to tzhead.tzh_ttisstdcnt-1 do
-   types[i].isstd:=byte(buf[i]<>0);
-  freemem(buf);
-
-  getmem(buf,tzhead.tzh_ttisgmtcnt);
-  blockread(f,buf^,tzhead.tzh_ttisgmtcnt);
-  if _result<>tzhead.tzh_ttisgmtcnt then
-     begin
-      goto lose;
-     end;
-  for i:=0 to tzhead.tzh_ttisgmtcnt-1 do
-   types[i].isgmt:=byte(buf[i]<>0);
-  freemem(buf);
-  close(f);
-  exit;
-lose:
-  close(f);
-end;
-
-
-{ help function to extract TZ variable data }
-function extractnumberend(tzstr: string; offset : integer): integer;
-var
- j: integer;
-begin
- j:=0;
- extractnumberend := 0;
- repeat
-   if (offset+j) > length(tzstr) then
-     begin
-       exit;
-     end;
-  inc(j);
- until not (tzstr[offset+j] in ['0'..'9']);
- extractnumberend := offset+j;
-end;
-
-function getoffsetseconds(tzstr: string): longint;
-{ extract GMT timezone information }
-{ Returns the number of minutes to }
-{ add or subtract to the GMT time  }
-{ to get the local time.           }
-{ Format of TZ variable (POSIX)    }
-{  std offset dst                  }
-{  std = characters of timezone    }
-{  offset = hh[:mm] to add to GMT  }
-{  dst = daylight savings time     }
-{ CURRENTLY DOES NOT TAKE CARE     }
-{ OF SUMMER TIME DIFFERENCIAL      }
-var
- s: string;
- i, j: integer;
- code : integer;
- hours : longint;
- minutes : longint;
- negative : boolean;
-begin
- hours:=0;
- minutes:=0;
- getoffsetseconds := 0;
- negative := FALSE;
- i:=-1;
- { get to offset field }
- repeat
-   if i > length(tzstr) then
-     begin
-       exit;
-     end;
-   inc(i);
- until (tzstr[i] = '-') or (tzstr[i] in ['0'..'9']);
- if tzstr[i] = '-' then
-  begin
-   Inc(i);
-   negative := TRUE;
-  end;
- j:=extractnumberend(tzstr,i);
- s:=copy(tzstr,i,j-i);
- val(s,hours,code);
- if code <> 0 then
-   begin
-     exit;
-   end;
- if tzstr[j] = ':' then
-   begin
-     i:=j;
-     Inc(i);
-     j:=extractnumberend(tzstr,i);
-     s:=copy(tzstr,i,j-i);
-     val(s,minutes,code);
-     if code <> 0 then
-      begin
-        exit;
-      end;
-   end;
- if negative then
-  begin
-    minutes := -minutes;
-    hours := -hours;
-  end;
- getoffsetseconds := minutes*60 + hours*3600;
-end;
-
-
-procedure InitLocalTime;
-var
- tloc: time_t;
- s : string;
-begin
-  TZSeconds:=0;
-  { try to get the POSIX version  }
-  { of the local time offset      }
-  { if '', then it does not exist }
-  { if ': ..', then non-POSIX     }
-  s:=GetTimezoneString;
-  if (s<>'') and (s[1]<>':') then
-   begin
-     TZSeconds := getoffsetseconds(s);
-   end
-  else
-   begin
-     s:=GetTimeZoneFile;
-     { only read if there is something to read }
-     if s<>'' then
-     begin
-       ReadTimezoneFile(s);
-       tloc:=sys_time(tloc);
-       GetLocalTimezone(tloc);
-     end;
-   end;
-end;
-
-
-procedure DoneLocalTime;
-begin
-  if assigned(transitions) then
-   freemem(transitions);
-  if assigned(type_idxs) then
-   freemem(type_idxs);
-  if assigned(types) then
-   freemem(types);
-  if assigned(zone_names) then
-   freemem(zone_names);
-  if assigned(leaps) then
-   freemem(leaps);
-  num_transitions:=0;
-  num_leaps:=0;
-  num_types:=0;
-end;
-
-
-
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.2  2002/08/10 13:42:36  marco
-   * Fixes Posix dir copied to devel branch
-
-  Revision 1.1.2.2  2002/05/01 14:06:13  carl
-  * bugfix for stricter POSIX checking
-  + TZ is now taken from GetTimezoneSitrng instead of getenv
-
-}

+ 0 - 59
rtl/template/disk.inc

@@ -1,59 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by the Free Pascal development team
-
-    Disk functions from Delphi's sysutils.pas
-
-    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.
-
- **********************************************************************}
-
-Function DiskFree (Drive : Byte) : Longint;
-
-begin
-end;
-
-
-Function DiskSize (Drive : Byte) : Longint;
-
-begin
-end;
-
-
-Function GetCurrentDir : String;
-
-begin
-end;
-
-
-Function SetCurrentDir (Const NewDir : String) : Boolean;
-
-begin
-end;
-
-
-Function CreateDir (Const NewDir : String) : Boolean;
-
-begin
-end;
-
-
-Function RemoveDir (Const Dir : String) : Boolean;
-
-begin
-end;
-
-
-
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-}

+ 0 - 62
rtl/template/dynlibs.inc

@@ -1,62 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by the Free Pascal development team
-
-    Implements OS dependent part for loading of dynamic libraries.
-
-    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.
-
- **********************************************************************}
-
-
-{$ifdef readinterface}
-
-{ ---------------------------------------------------------------------
-    Interface declarations
-  ---------------------------------------------------------------------}
-
-Type
-  TLibHandle = Longint;
-
-Const
-  NilHandle = 0;
-
-{$else}
-
-{ ---------------------------------------------------------------------
-    Implementation section
-  ---------------------------------------------------------------------}
-
-
-Function LoadLibrary(Name : AnsiString) : TlibHandle;
-
-begin
-  Result:=NilHandle;
-end;
-
-Function GetProcedureAddress(Lib : TLibHandle; ProcName : AnsiString) : Pointer;
-
-begin
-  Result:=Nil;
-end;
-
-Function UnloadLibrary(Lib : TLibHandle) : Boolean;
-
-begin
-  Result:=False;
-end;
-
-{$endif}
-
-{
-  $Log$
-  Revision 1.2  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-}

+ 0 - 173
rtl/template/filutil.inc

@@ -1,173 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by the Free Pascal development team
-
-    File utility calls
-
-    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.
-
- **********************************************************************}
-
-
-Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
-
-Begin
-  //!! Needs implementing
-end;
-
-
-Function FileCreate (Const FileName : String) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileWrite (Handle : Longint; Var Buffer; Count : Longint) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Procedure FileClose (Handle : Longint);
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileTruncate (Handle,Size: Longint) : boolean;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileAge (Const FileName : String): Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileExists (Const FileName : String) : Boolean;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FindNext (Var Rslt : TSearchRec) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Procedure FindClose (Var F : TSearchrec);
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileGetDate (Handle : Longint) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileSetDate (Handle,Age : Longint) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileGetAttr (Const FileName : String) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function DeleteFile (Const FileName : String) : Boolean;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function RenameFile (Const OldName, NewName : String) : Boolean;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Function FileSearch (Const Name, DirList : String) : String;
-
-begin
-  //!! Needs implementing
-end;
-
-
-Procedure GetLocalTime(var SystemTime: TSystemTime);
-
-begin
-  //!! Needs implementing
-end ;
-
-Procedure InitAnsi;
-begin
-  //!! Needs implementing
-end;
-
-Procedure InitInternational;
-begin
-  InitAnsi;
-end;
-
-
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-}

+ 0 - 340
rtl/template/gpl.txt

@@ -1,340 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    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.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) 19yy name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.

+ 0 - 15
rtl/template/header

@@ -1,15 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by the Free Pascal development team
-
-    <What does this file>
-    
-    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.
-
- **********************************************************************}

+ 0 - 481
rtl/template/lgpl.txt

@@ -1,481 +0,0 @@
-		  GNU LIBRARY GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
-    		    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL.  It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it.  You can use it for
-your libraries, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library.  If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software.  To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
-  Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs.  This
-license, the GNU Library General Public License, applies to certain
-designated libraries.  This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
-  The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it.  Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program.  However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
-  Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries.  We
-concluded that weaker conditions might promote sharing better.
-
-  However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves.  This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them.  (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.)  The hope is that this
-will lead to faster development of free libraries.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, while the latter only
-works together with the library.
-
-  Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-
-		  GNU LIBRARY GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License").  Each licensee is
-addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also compile or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    c) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    d) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-			    NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library 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.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public
-    License along with this library; if not, write to the Free
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!

+ 0 - 10
rtl/template/readme

@@ -1,10 +0,0 @@
-This directory contains :
-
-template files i.e.  files written entirely in pascal  and thus usable 
-as a guideline for processor or operating system specific implementations.
-(this excludes files from the inc directory which are used by all os/proc's)
-
-strings.pp    Turbo pascal compatible strings unit
-math.inc      RTL Mathematical functions (on real type)
-rttip.inc     Runtime type information include
-system.pp     System unit template

+ 0 - 168
rtl/template/rttip.inc

@@ -1,168 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Michael Van Canneyt
-    member of the Free Pascal development team
-
-    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.
-
- **********************************************************************}
-
-{ Run-Time type information routines - processor dependent part }
-
-
-Procedure Initialize (Data,TypeInfo : pointer);[Alias : 'INITIALIZE'];
-
-Var Temp       : PByte;
-    I          : longint;
-    Size,Count : longint;
-    TInfo : Pointer;
-
-begin
-  Temp:=PByte(TypeInfo);
-  case temp^ of
-    tkLstring,tkWstring : PPchar(Data)^:=Nil;
-    tkArray :
-      begin
-      temp:=Temp+1;
-      I:=temp^;
-      temp:=temp+(I+1);               // skip name string;
-      Size:=PArrayRec(Temp)^.Size;     // get element size
-      Count:=PArrayRec(Temp)^.Count;  // get element Count
-      TInfo:=PArrayRec(Temp)^.Info;   // Get element info
-      For I:=0 to Count-1 do
-        Initialize (Data+(I*size),TInfo);
-      end;
-    tkRecord,tkObject,tkClass:
-      begin
-      Temp:=Temp+1;
-      I:=Temp^;
-      temp:=temp+(I+1);             // skip name string;
-      Size:=PRecRec(Temp)^.Size;    // get record size; not needed.
-      Count:=PRecRec(Temp)^.Count;  // get element Count
-      For I:=1 to count Do
-        With PRecRec(Temp)^.elements[I] do
-          Initialize (Data+Offset,Info);
-      end;
-  end;
-end;
-
-Procedure Finalize (Data,TypeInfo: Pointer);[Alias : 'FINALIZE'];
-
-Var Temp       : PByte;
-    I          : longint;
-    Size,Count : longint;
-    TInfo : Pointer;
-
-begin
-  Temp:=PByte(TypeInfo);
-  case temp^ of
-    tkLstring,tkWstring : Decr_Ansi_ref(Data);
-    tkArray :
-      begin
-      Temp:=Temp+1;
-      I:=temp^;
-      temp:=temp+(I+1);               // skip name string;
-      Size:=PArrayRec(Temp)^.Size;     // get element size
-      Count:=PArrayRec(Temp)^.Count;  // get element Count
-      TInfo:=PArrayRec(Temp)^.Info;   // Get element info
-      For I:=0 to Count-1 do
-        Finalize (Data+(I*size),TInfo);
-      end;
-    tkRecord,tkObject,tkClass:
-      begin
-      Temp:=Temp+1;
-      I:=Temp^;
-      temp:=temp+(I+1);             // skip name string;
-      Size:=PRecRec(Temp)^.Size;    // get record size; not needed.
-      Count:=PRecRec(Temp)^.Count;  // get element Count
-      For I:=1 to count do
-        With PRecRec(Temp)^.elements[I] do
-          Finalize (Data+Offset,Info);
-      end;
-  end;
-end;
-
-Procedure Addref (Data,TypeInfo : Pointer); [alias : 'ADDREF'];
-
-Var Temp       : PByte;
-    I          : longint;
-    Size,Count : longint;
-    TInfo : Pointer;
-
-begin
-  Temp:=PByte(TypeInfo);
-  case temp^ of
-    tkLstring,tkWstring : Incr_Ansi_ref(Data);
-    tkArray :
-      begin
-      Temp:=Temp+1;
-      I:=temp^;
-      temp:=temp+(I+1);               // skip name string;
-      Size:=PArrayRec(Temp)^.Size;     // get element size
-      Count:=PArrayRec(Temp)^.Count;  // get element Count
-      TInfo:=PArrayRec(Temp)^.Info;   // Get element info
-      For I:=0 to Count-1 do
-        AddRef (Data+(I*size),TInfo);
-      end;
-    tkRecord,tkObject,tkClass:
-      begin
-      Temp:=Temp+1;
-      I:=Temp^;
-      temp:=temp+(I+1);             // skip name string;
-      Size:=PRecRec(Temp)^.Size;    // get record size; not needed.
-      Count:=PRecRec(Temp)^.Count;  // get element Count
-      For I:=1 to count do
-        With PRecRec(Temp)^.elements[I] do
-          Addref (Data+Offset,Info);
-      end;
-  end;
-end;
-
-Procedure DecRef (Data, TypeInfo : Pointer);
-
-Var Temp       : PByte;
-    I          : longint;
-    Size,Count : longint;
-    TInfo : Pointer;
-
-begin
-  Temp:=PByte(TypeInfo);
-  case temp^ of
-    tkLstring,tkWstring : Decr_Ansi_ref(Data);
-    tkArray :
-      begin
-      Temp:=Temp+1;
-      I:=temp^;
-      temp:=temp+(I+1);               // skip name string;
-      Size:=PArrayRec(Temp)^.Size;     // get element size
-      Count:=PArrayRec(Temp)^.Count;  // get element Count
-      TInfo:=PArrayRec(Temp)^.Info;   // Get element info
-      For I:=0 to Count-1 do
-        DecRef (Data+(I*size),TInfo);
-      end;
-    tkRecord,tkObject,tkClass:
-      begin
-      Temp:=Temp+1;
-      I:=Temp^;
-      temp:=temp+(I+1);             // skip name string;
-      Size:=PRecRec(Temp)^.Size;    // get record size; not needed.
-      Count:=PRecRec(Temp)^.Count;  // get element Count
-      For I:=1 to count do
-        With PRecRec(Temp)^.elements[I] do
-          DecRef (Data+Offset,Info);
-      end;
-  end;
-end;
-
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:26  peter
-    * old logs removed and tabs fixed
-
-}

+ 0 - 616
rtl/template/strings.pp

@@ -1,616 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Carl-Eric Codere,
-    member of the Free Pascal development team.
-
-    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 Strings;
-
-
-  {*********************************************************************}
-  { Strings unit, 100% portable.                                        }
-  {- COMPILING INFORMATION ---------------------------------------------}
-  {   The only difference between this  unit and the one supplied with  }
-  {   Turbo Pascal 7.01, are that StrLen returns a longint, and the     }
-  {   routines requiring a length now use longints instead of words.    }
-  {   This should not influence the behaviour of your programs under    }
-  {   Turbo Pascal. (it will even create better error checking for your }
-  {   programs).                                                        }
-  {*********************************************************************}
-
- Interface
- {*********************************************************************}
- { Returns the number of Characters in Str,not counting the Null       }
- { chracter.                                                           }
- {*********************************************************************}
-
-function StrLen(Str: PChar): longint;
-
-
-function StrEnd(Str: PChar): PChar;
-
-  {*********************************************************************}
-  {  Description: Move count characters from source to dest.            }
-  {   Do not forget to use StrLen(source)+1 as l parameter to also move }
-  {   the null character.                                               }
-  {  Return value: Dest                                                 }
-  {   Remarks: Source and Dest may overlap.                             }
-  {*********************************************************************}
-
-function StrMove(Dest,Source : Pchar;l : Longint) : pchar;
-
-
-function StrCopy(Dest, Source: PChar): PChar;
-
- {*********************************************************************}
- {  Input: Source -> Source of the null-terminated string to copy.     }
- {         Dest   -> Destination of null terminated string to copy.    }
- {    Return Value: Pointer to the end of the copied string of Dest.   }
- {  Output: Dest ->   Pointer to the copied string.                    }
- {*********************************************************************}
-function StrECopy(Dest, Source: PChar): PChar;
-
-  {*********************************************************************}
-  {  Copies at most MaxLen characters from Source to Dest.              }
-  {                                                                     }
-  {   Remarks: According to the Turbo Pascal programmer's Reference     }
-  {    this routine performs length checking. From the code of the      }
-  {    original strings unit, this does not seem true...                }
-  {   Furthermore, copying a null string gives two null characters in   }
-  {   the destination according to the Turbo Pascal routine.            }
-  {*********************************************************************}
-
-function StrLCopy(Dest, Source: PChar; MaxLen: Longint): PChar;
-
- {*********************************************************************}
- {  Input: Source -> Source of the pascal style string to copy.        }
- {         Dest   -> Destination of null terminated string to copy.    }
- {    Return Value: Dest. (with noew copied string)                    }
- {*********************************************************************}
-
-function StrPCopy(Dest: PChar; Source: String): PChar;
-
- {*********************************************************************}
- {  Description: Appends a copy of Source to then end of Dest and      }
- {               return Dest.                                          }
- {*********************************************************************}
-
-function StrCat(Dest, Source: PChar): PChar;
-
- {*********************************************************************}
- { Description: Appends at most MaxLen - StrLen(Dest) characters from  }
- { Source to the end of Dest, and returns Dest.                        }
- {*********************************************************************}
-
-      function strlcat(dest,source : pchar;l : Longint) : pchar;
-
-  {*********************************************************************}
-  {  Compares two strings. Does the ASCII value substraction of the     }
-  {  first non matching characters                                      }
-  {   Returns 0 if both strings are equal                               }
-  {   Returns < 0 if Str1 < Str2                                        }
-  {   Returns > 0 if Str1 > Str2                                        }
-  {*********************************************************************}
-
-function StrComp(Str1, Str2: PChar): Integer;
-
-  {*********************************************************************}
-  {  Compares two strings without case sensitivity. See StrComp for more}
-  {  information.                                                       }
-  {   Returns 0 if both strings are equal                               }
-  {   Returns < 0 if Str1 < Str2                                        }
-  {   Returns > 0 if Str1 > Str2                                        }
-  {*********************************************************************}
-
-function StrIComp(Str1, Str2: PChar): Integer;
-
-  {*********************************************************************}
-  {  Compares two strings up to a maximum of MaxLen characters.         }
-  {                                                                     }
-  {   Returns 0 if both strings are equal                               }
-  {   Returns < 0 if Str1 < Str2                                        }
-  {   Returns > 0 if Str1 > Str2                                        }
-  {*********************************************************************}
-
-function StrLComp(Str1, Str2: PChar; MaxLen: Longint): Integer;
-
-  {*********************************************************************}
-  {  Compares two strings up to a maximum of MaxLen characters.         }
-  {  The comparison is case insensitive.                                }
-  {   Returns 0 if both strings are equal                               }
-  {   Returns < 0 if Str1 < Str2                                        }
-  {   Returns > 0 if Str1 > Str2                                        }
-  {*********************************************************************}
-
-function StrLIComp(Str1, Str2: PChar; MaxLen: Longint): Integer;
-
- {*********************************************************************}
- {  Input: Str  -> String to search.                                   }
- {         Ch   -> Character to find in Str.                           }
- {  Return Value: Pointer to first occurence of Ch in Str, nil if      }
- {                not found.                                           }
- {  Remark: The null terminator is considered being part of the string }
- {*********************************************************************}
-
-function StrScan(Str: PChar; Ch: Char): PChar;
-
- {*********************************************************************}
- {  Input: Str  -> String to search.                                   }
- {         Ch   -> Character to find in Str.                           }
- {  Return Value: Pointer to last occurence of Ch in Str, nil if       }
- {                not found.                                           }
- {  Remark: The null terminator is considered being part of the string }
- {*********************************************************************}
-
-
-function StrRScan(Str: PChar; Ch: Char): PChar;
-
- {*********************************************************************}
- {  Input: Str1 -> String to search.                                   }
- {         Str2 -> String to match in Str1.                            }
- {  Return Value: Pointer to first occurence of Str2 in Str1, nil if   }
- {                not found.                                           }
- {*********************************************************************}
-
-function StrPos(Str1, Str2: PChar): PChar;
-
- {*********************************************************************}
- {  Input: Str -> null terminated string to uppercase.                 }
- {  Output:Str -> null terminated string in upper case characters.     }
- {    Return Value: null terminated string in upper case characters.   }
- {  Remarks: Case conversion is dependant on upcase routine.           }
- {*********************************************************************}
-
-function StrUpper(Str: PChar): PChar;
-
- {*********************************************************************}
- {  Input: Str -> null terminated string to lower case.                }
- {  Output:Str -> null terminated string in lower case characters.     }
- {    Return Value: null terminated string in lower case characters.   }
- {  Remarks: Only converts standard ASCII characters.                  }
- {*********************************************************************}
-
-function StrLower(Str: PChar): PChar;
-
-{ StrPas converts Str to a Pascal style string.                 }
-
-function StrPas(Str: PChar): String;
-
- {*********************************************************************}
- {  Input: Str  -> String to duplicate.                                }
- {  Return Value: Pointer to the new allocated string. nil if no       }
- {                  string allocated. If Str = nil then return value   }
- {                  will also be nil (in this case, no allocation      }
- {                  occurs). The size allocated is of StrLen(Str)+1    }
- {                  bytes.                                             }
- {*********************************************************************}
-function StrNew(P: PChar): PChar;
-
-{ StrDispose disposes a string that was previously allocated    }
-{ with StrNew. If Str is NIL, StrDispose does nothing.          }
-
-procedure StrDispose(P: PChar);
-
-Implementation
-
-
- function strlen(Str : pchar) : Longint;
-  var
-   counter : Longint;
- Begin
-   counter := 0;
-   while Str[counter] <> #0 do
-     Inc(counter);
-   strlen := counter;
- end;
-
-
-
- Function strpas(Str: pchar): string;
- { only 255 first characters are actually copied. }
-  var
-   counter : byte;
-   lstr: string;
- Begin
-   counter := 0;
-   lstr := '';
-   while (ord(Str[counter]) <> 0) and (counter < 255) do
-   begin
-     Inc(counter);
-     lstr[counter] := char(Str[counter-1]);
-   end;
-   lstr[0] := char(counter);
-   strpas := lstr;
- end;
-
- Function StrEnd(Str: PChar): PChar;
- var
-  counter: Longint;
- begin
-   counter := 0;
-   while Str[counter] <> #0 do
-      Inc(counter);
-   StrEnd := @(Str[Counter]);
- end;
-
-
- Function StrCopy(Dest, Source:PChar): PChar;
- var
-   counter : Longint;
- Begin
-   counter := 0;
-   while Source[counter] <> #0 do
-   begin
-     Dest[counter] := char(Source[counter]);
-     Inc(counter);
-   end;
-   { terminate the string }
-   Dest[counter] := #0;
-   StrCopy := Dest;
- end;
-
-
- function StrCat(Dest,Source: PChar): PChar;
- var
-  counter: Longint;
-  PEnd: PChar;
- begin
-   PEnd := StrEnd(Dest);
-   counter := 0;
-   while (Source[counter] <> #0) do
-   begin
-     PEnd[counter] := char(Source[counter]);
-     Inc(counter);
-   end;
-   { terminate the string }
-   PEnd[counter] := #0;
-   StrCat := Dest;
- end;
-
- function StrUpper(Str: PChar): PChar;
- var
-  counter: Longint;
- begin
-   counter := 0;
-   while (Str[counter] <> #0) do
-   begin
-     if Str[Counter] in [#97..#122,#128..#255] then
-        Str[counter] := Upcase(Str[counter]);
-     Inc(counter);
-   end;
-   StrUpper := Str;
- end;
-
- function StrLower(Str: PChar): PChar;
- var
-  counter: Longint;
- begin
-   counter := 0;
-   while (Str[counter] <> #0) do
-   begin
-     if Str[counter] in [#65..#90] then
-        Str[Counter] := chr(ord(Str[Counter]) + 32);
-     Inc(counter);
-   end;
-   StrLower := Str;
- end;
-
-
-  function StrPos(Str1,Str2: PChar): PChar;
- var
-  count: Longint;
-  oldindex: Longint;
-  found: boolean;
-  Str1Length: Longint;
-  Str2Length: Longint;
-  ll: Longint;
- Begin
-
-   Str1Length := StrLen(Str1);
-   Str2Length := StrLen(Str2);
-   found := true;
-   oldindex := 0;
-
-   { If the search string is greater than the string to be searched }
-   { it is certain that we will not find it.                        }
-   { Furthermore looking for a null will simply give out a pointer, }
-   { to the null character of str1 as in Borland Pascal.            }
-   if (Str2Length > Str1Length) or (Str2[0] = #0) then
-   begin
-     StrPos := nil;
-     exit;
-   end;
-
-   Repeat
-     { Find first matching character of Str2 in Str1 }
-     { put index of this character in oldindex       }
-     for count:= oldindex to Str1Length-1 do
-     begin
-        if Str2[0] = Str1[count] then
-        begin
-           oldindex := count;
-           break;
-        end;
-        { nothing found - exit routine }
-        if count = Str1Length-1 then
-        begin
-           StrPos := nil;
-           exit;
-        end;
-     end;
-
-     found := true;
-     { Compare the character strings }
-     { and check if they match.      }
-     for ll := 0 to Str2Length-1 do
-     begin
-       { no match, stop iteration }
-        if (Str2[ll] <> Str1[ll+oldindex]) then
-        begin
-           found := false;
-           break;
-        end;
-     end;
-     { Not found, the index will no point at next character }
-     if not found then
-       Inc(oldindex);
-     { There was a match }
-     if found then
-     begin
-        StrPos := @(Str1[oldindex]);
-        exit;
-     end;
-   { If we have gone through the whole string to search }
-   { then exit routine.                                 }
-   Until (Str1Length-oldindex) <= 0;
-   StrPos := nil;
- end;
-
-
- function StrScan(Str: PChar; Ch: Char): PChar;
-   Var
-     count: Longint;
-  Begin
-
-   count := 0;
-   { As in Borland Pascal , if looking for NULL return null }
-   if ch = #0 then
-   begin
-     StrScan := @(Str[StrLen(Str)]);
-     exit;
-   end;
-   { Find first matching character of Ch in Str }
-   while Str[count] <> #0 do
-   begin
-     if Ch = Str[count] then
-      begin
-          StrScan := @(Str[count]);
-          exit;
-      end;
-     Inc(count);
-   end;
-   { nothing found. }
-   StrScan := nil;
- end;
-
-
-
- function StrRScan(Str: PChar; Ch: Char): PChar;
- Var
-  count: Longint;
-  index: Longint;
- Begin
-   count := Strlen(Str);
-   { As in Borland Pascal , if looking for NULL return null }
-   if ch = #0 then
-   begin
-     StrRScan := @(Str[count]);
-     exit;
-   end;
-   Dec(count);
-   for index := count downto 0 do
-   begin
-     if Ch = Str[index] then
-      begin
-          StrRScan := @(Str[index]);
-          exit;
-      end;
-   end;
-   { nothing found. }
-   StrRScan := nil;
- end;
-
-
- function StrNew(p:PChar): PChar;
-      var
-         len : Longint;
-         tmp : pchar;
-      begin
-         strnew:=nil;
-         if (p=nil) or (p^=#0) then
-           exit;
-         len:=strlen(p)+1;
-         getmem(tmp,len);
-         if tmp<>nil then
-           strmove(tmp,p,len);
-         StrNew := tmp;
-      end;
-
-
-  Function StrECopy(Dest, Source: PChar): PChar;
- { Equivalent to the following:                                          }
- {  strcopy(Dest,Source);                                                }
- {  StrECopy := StrEnd(Dest);                                            }
- var
-   counter : Longint;
- Begin
-   counter := 0;
-   while Source[counter] <> #0 do
-   begin
-     Dest[counter] := char(Source[counter]);
-     Inc(counter);
-   end;
-   { terminate the string }
-   Dest[counter] := #0;
-   StrECopy:=@(Dest[counter]);
- end;
-
-
-   Function StrPCopy(Dest: PChar; Source: String):PChar;
-   var
-    counter : byte;
-  Begin
-    counter := 0;
-   { if empty pascal string  }
-   { then setup and exit now }
-   if Source = '' then
-   Begin
-     Dest[0] := #0;
-     StrPCopy := Dest;
-     exit;
-   end;
-   for counter:=1 to length(Source) do
-   begin
-     Dest[counter-1] := Source[counter];
-   end;
-   { terminate the string }
-   Dest[counter] := #0;
-   StrPCopy:=Dest;
- end;
-
-
- procedure strdispose(p : pchar);
- begin
-   if p<>nil then
-      freemem(p,strlen(p)+1);
- end;
-
-
- function strmove(dest,source : pchar;l : Longint) : pchar;
- begin
-   move(source^,dest^,l);
-   strmove:=dest;
- end;
-
-
- function strlcat(dest,source : pchar;l : Longint) : pchar;
- var
-   destend : pchar;
- begin
-   destend:=strend(dest);
-   l:=l-(destend-dest);
-   strlcat:=strlcopy(destend,source,l);
- end;
-
-
- Function StrLCopy(Dest,Source: PChar; MaxLen: Longint): PChar;
-  var
-   counter: Longint;
- Begin
-   counter := 0;
-   { To be compatible with BP, on a null string, put two nulls }
-   If Source[0] = #0 then
-   Begin
-     Dest[0]:=Source[0];
-     Inc(counter);
-   end;
-   while (Source[counter] <> #0)  and (counter < MaxLen) do
-   Begin
-      Dest[counter] := char(Source[counter]);
-      Inc(counter);
-   end;
-   { terminate the string }
-   Dest[counter] := #0;
-   StrLCopy := Dest;
- end;
-
-
- function StrComp(Str1, Str2 : PChar): Integer;
-     var
-      counter: Longint;
-     Begin
-        counter := 0;
-       While str1[counter] = str2[counter] do
-       Begin
-         if (str2[counter] = #0) or (str1[counter] = #0) then
-            break;
-         Inc(counter);
-       end;
-       StrComp := ord(str1[counter]) - ord(str2[counter]);
-     end;
-
-     function StrIComp(Str1, Str2 : PChar): Integer;
-     var
-      counter: Longint;
-      c1, c2: char;
-     Begin
-        counter := 0;
-        c1 := upcase(str1[counter]);
-        c2 := upcase(str2[counter]);
-       While c1 = c2 do
-       Begin
-         if (c1 = #0) or (c2 = #0) then break;
-         Inc(counter);
-         c1 := upcase(str1[counter]);
-         c2 := upcase(str2[counter]);
-      end;
-       StrIComp := ord(c1) - ord(c2);
-     end;
-
-
-     function StrLComp(Str1, Str2 : PChar; MaxLen: Longint): Integer;
-     var
-      counter: Longint;
-      c1, c2: char;
-     Begin
-        counter := 0;
-       if MaxLen = 0 then
-       begin
-         StrLComp := 0;
-         exit;
-       end;
-       Repeat
-         if (c1 = #0) or (c2 = #0) then break;
-         c1 := str1[counter];
-         c2 := str2[counter];
-         Inc(counter);
-      Until (c1 <> c2) or (counter >= MaxLen);
-       StrLComp := ord(c1) - ord(c2);
-     end;
-
-
-
-     function StrLIComp(Str1, Str2 : PChar; MaxLen: Longint): Integer;
-     var
-      counter: Longint;
-      c1, c2: char;
-     Begin
-        counter := 0;
-       if MaxLen = 0 then
-       begin
-         StrLIComp := 0;
-         exit;
-       end;
-       Repeat
-         if (c1 = #0) or (c2 = #0) then break;
-         c1 := upcase(str1[counter]);
-         c2 := upcase(str2[counter]);
-         Inc(counter);
-      Until (c1 <> c2) or (counter >= MaxLen);
-       StrLIComp := ord(c1) - ord(c2);
-     end;
-end.
-{
-  $Log$
-  Revision 1.3  2002-09-07 16:01:27  peter
-    * old logs removed and tabs fixed
-
-}

+ 0 - 323
rtl/template/system.pp

@@ -1,323 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by the Free Pascal development team.
-
-    This is a prototype file to show all function that need to be implemented
-    for a new operating system (provided the processor specific
-    function are already implemented !)
-
-    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.
-
- **********************************************************************}
-{ no stack check in system }
-{$S-}
-unit system;
-
-interface
-
-{ include system-independent routine headers }
-
-{$I systemh.inc}
-
-type
- THandle = longint;
-
-
-{ include heap support headers }
-
-{$I heaph.inc}
-
-{Platform specific information}
-const
- LineEnding = #13#10;
- LFNSupport = true;
- DirectorySeparator = '\';
- DriveSeparator = ':';
- PathSeparator = ';';
- FileNameCaseSensitive = false;
-
- {The highest exit code which can be returned to the operating system.
-  Should be at least 255.}
- maxExitCode = 255;
-
-const
-  UnusedHandle    = -1;
-  StdInputHandle  = 0;
-  StdOutputHandle = 1;
-  StdErrorHandle  = 2;
-
-  sLineBreak : string[1] = LineEnding;
-  DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
-
-var
-  argc : longint;
-  argv : ppchar;
-  envp : ppchar;
-
-implementation
-
-{ include system independent routines }
-
-{$I system.inc}
-
-procedure setup_arguments;
-begin
-end;
-
-procedure setup_environment;
-begin
-end;
-
-function GetProcessID: SizeUInt;
-begin
-end;
-
-{*****************************************************************************
-                         System Dependent Exit code
-*****************************************************************************}
-Procedure system_exit;
-begin
-end;
-
-
-{*****************************************************************************
-                              ParamStr/Randomize
-*****************************************************************************}
-
-{ number of args }
-function paramcount : longint;
-begin
-  {paramcount := argc - 1;}
-  paramcount:=0;
-end;
-
-{ argument number l }
-function paramstr(l : longint) : string;
-begin
-  {if (l>=0) and (l+1<=argc) then
-   paramstr:=strpas(argv[l])
-  else}
-   paramstr:='';
-end;
-
-{ set randseed to a new pseudo random value }
-procedure randomize;
-begin
-  {regs.realeax:=$2c00;
-  sysrealintr($21,regs);
-  hl:=regs.realedx and $ffff;
-  randseed:=hl*$10000+ (regs.realecx and $ffff);}
-  randseed:=0;
-end;
-
-
-{*****************************************************************************
-      OS Memory allocation / deallocation
- ****************************************************************************}
-
-function SysOSAlloc(size: ptrint): pointer;
-begin
-  // code to allocate memory block
-end;
-
-// If the OS is capable of freeing memory, define HAS_SYSOSFREE and implement
-// the SysOSFree function properly
-//{$define HAS_SYSOSFREE}
-{
-procedure SysOSFree(p: pointer; size: ptrint);
-begin
-  // code to release memory block
-end;
-}
-
-{ include standard heap management }
-{$I heap.inc}
-
-
-{****************************************************************************
-                        Low level File Routines
-       All these functions can set InOutRes on errors
- ****************************************************************************}
-
-{ close a file from the handle value }
-procedure do_close(handle : longint);
-begin
-  InOutRes:=1;
-end;
-
-procedure do_erase(p : pchar);
-begin
-  InOutRes:=1;
-end;
-
-procedure do_rename(p1,p2 : pchar);
-begin
-  InOutRes:=1;
-end;
-
-function do_write(h,addr,len : longint) : longint;
-begin
-  InOutRes:=1;
-end;
-
-function do_read(h,addr,len : longint) : longint;
-begin
-  InOutRes:=1;
-end;
-
-function do_filepos(handle : longint) : longint;
-begin
-  InOutRes:=1;
-end;
-
-procedure do_seek(handle,pos : longint);
-begin
-  InOutRes:=1;
-end;
-
-function do_seekend(handle:longint):longint;
-begin
-  InOutRes:=1;
-end;
-
-function do_filesize(handle : longint) : longint;
-begin
-  InOutRes:=1;
-end;
-
-{ truncate at a given position }
-procedure do_truncate (handle,pos:longint);
-begin
-  InOutRes:=1;
-end;
-
-procedure do_open(var f;p:pchar;flags:longint);
-{
-  filerec and textrec have both handle and mode as the first items so
-  they could use the same routine for opening/creating.
-  when (flags and $10)   the file will be append
-  when (flags and $100)  the file will be truncate/rewritten
-  when (flags and $1000) there is no check for close (needed for textfiles)
-}
-begin
-  InOutRes:=1;
-end;
-
-function do_isdevice(handle:longint):boolean;
-begin
-  do_isdevice:=false;
-end;
-
-
-{*****************************************************************************
-                           UnTyped File Handling
-*****************************************************************************}
-
-{$i file.inc}
-
-{*****************************************************************************
-                           Typed File Handling
-*****************************************************************************}
-
-{$i typefile.inc}
-
-{*****************************************************************************
-                           Text File Handling
-*****************************************************************************}
-
-{ should we consider #26 as the  end of a file ? }
-{?? $DEFINE EOF_CTRLZ}
-
-{$i text.inc}
-
-{*****************************************************************************
-                           Directory Handling
-*****************************************************************************}
-procedure mkdir(const s : string);[IOCheck];
-begin
-  InOutRes:=1;
-end;
-
-procedure rmdir(const s : string);[IOCheck];
-begin
-  InOutRes:=1;
-end;
-
-procedure chdir(const s : string);[IOCheck];
-begin
-  InOutRes:=1;
-end;
-
-procedure GetDir (DriveNr: byte; var Dir: ShortString);
-
-begin
-  InOutRes := 1;
-end;
-
-
-{*****************************************************************************
-                         SystemUnit Initialization
-*****************************************************************************}
-
-Begin
-  { To be set if this is a GUI or console application }
-  IsConsole := TRUE;
-  { To be set if this is a library and not a program  }
-  IsLibrary := FALSE;
-  StackBottom := SPtr - StackLength;
-  ExitCode := 0;
-{ Setup heap }
-  InitHeap;
-{ Setup stdin, stdout and stderr }
-  OpenStdIO(Input,fmInput,StdInputHandle);
-  OpenStdIO(Output,fmOutput,StdOutputHandle);
-  OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
-  OpenStdIO(StdOut,fmOutput,StdOutputHandle);
-  OpenStdIO(StdErr,fmOutput,StdErrorHandle);
-{ Setup environment and arguments }
-  Setup_Environment;
-  Setup_Arguments;
-{ Reset IO Error }
-  InOutRes:=0;
-(* This should be changed to a real value during *)
-(* thread driver initialization if appropriate.  *)
-  ThreadID := 1;
-End.
-{
-  $Log$
-  Revision 1.15  2004-12-05 14:36:38  hajny
-    + GetProcessID added
-
-  Revision 1.14  2004/11/04 09:32:31  peter
-  ErrOutput added
-
-  Revision 1.13  2004/10/25 15:38:59  peter
-    * compiler defined HEAP and HEAPSIZE removed
-
-  Revision 1.12  2004/09/03 19:26:57  olle
-    + added maxExitCode to all System.pp
-    * constrained error code to be below maxExitCode in RunError et. al.
-
-  Revision 1.11  2004/06/17 16:16:14  peter
-    * New heapmanager that releases memory back to the OS, donated
-      by Micha Nelissen
-
-  Revision 1.10  2004/01/20 23:12:49  hajny
-    * ExecuteProcess fixes, ProcessID and ThreadID added
-
-  Revision 1.9  2003/09/27 11:52:36  peter
-    * sbrk returns pointer
-
-  Revision 1.8  2002/09/07 16:01:27  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.7  2002/04/21 15:55:14  carl
-  + initialize some global variables
-
-}

+ 0 - 334
rtl/template/sysutils.pp

@@ -1,334 +0,0 @@
-{
-    $Id$
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Florian Klaempfl
-    member of the Free Pascal development team
-
-    Sysutils unit for linux
-
-    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 sysutils;
-interface
-
-{$MODE objfpc}
-{ force ansistrings }
-{$H+}
-
-uses
-  beos;
-
-{ Include platform independent interface part }
-{$i sysutilh.inc}
-
-
-implementation
-
-{ Include platform independent implementation part }
-{$i sysutils.inc}
-
-
-{****************************************************************************
-                              File Functions
-****************************************************************************}
-
-Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
-BEGIN
-end;
-
-
-Function FileCreate (Const FileName : String) : Longint;
-begin
-end;
-
-
-Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
-begin
-end;
-
-
-Function FileWrite (Handle : Longint; const Buffer; Count : Longint) : Longint;
-begin
-end;
-
-
-Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
-begin
-end;
-
-
-Procedure FileClose (Handle : Longint);
-begin
-end;
-
-
-Function FileTruncate (Handle,Size: Longint) : boolean;
-begin
-end;
-
-
-Function FileAge (Const FileName : String): Longint;
-begin
-end;
-
-
-Function FileExists (Const FileName : String) : Boolean;
-begin
-end;
-
-
-Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
-begin
-end;
-
-
-Function FindNext (Var Rslt : TSearchRec) : Longint;
-begin
-end;
-
-
-Procedure FindClose (Var F : TSearchrec);
-begin
-end;
-
-
-Function FileGetDate (Handle : Longint) : Longint;
-begin
-end;
-
-
-Function FileSetDate (Handle,Age : Longint) : Longint;
-begin
-end;
-
-
-Function FileGetAttr (Const FileName : String) : Longint;
-begin
-end;
-
-
-Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
-begin
-end;
-
-
-Function DeleteFile (Const FileName : String) : Boolean;
-begin
-end;
-
-
-Function RenameFile (Const OldName, NewName : String) : Boolean;
-begin
-end;
-
-
-Function FileSearch (Const Name, DirList : String) : String;
-begin
-end;
-
-
-{****************************************************************************
-                              Disk Functions
-****************************************************************************}
-
-Function DiskFree(Drive: Byte): int64;
-Begin
-End;
-
-
-
-Function DiskSize(Drive: Byte): int64;
-Begin
-End;
-
-
-Function GetCurrentDir : String;
-begin
-  GetDir(0,Result);
-end;
-
-
-Function SetCurrentDir (Const NewDir : String) : Boolean;
-begin
-  {$I-}
-   ChDir(NewDir);
-  {$I+}
-  result := (IOResult = 0);
-end;
-
-
-Function CreateDir (Const NewDir : String) : Boolean;
-begin
-  {$I-}
-   MkDir(NewDir);
-  {$I+}
-  result := (IOResult = 0);
-end;
-
-
-Function RemoveDir (Const Dir : String) : Boolean;
-begin
-  {$I-}
-   RmDir(Dir);
-  {$I+}
-  result := (IOResult = 0);
-end;
-
-
-function DirectoryExists (const Directory: string): boolean;
-begin
-end;
-
-
-{****************************************************************************
-                              Misc Functions
-****************************************************************************}
-
-procedure Beep;
-begin
-end;
-
-
-{****************************************************************************
-                              Locale Functions
-****************************************************************************}
-
-Procedure GetLocalTime(var SystemTime: TSystemTime);
-begin
-end ;
-
-
-Procedure InitAnsi;
-Var
-  i : longint;
-begin
-  {  Fill table entries 0 to 127  }
-  for i := 0 to 96 do
-    UpperCaseTable[i] := chr(i);
-  for i := 97 to 122 do
-    UpperCaseTable[i] := chr(i - 32);
-  for i := 123 to 191 do
-    UpperCaseTable[i] := chr(i);
-  Move (CPISO88591UCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
-
-  for i := 0 to 64 do
-    LowerCaseTable[i] := chr(i);
-  for i := 65 to 90 do
-    LowerCaseTable[i] := chr(i + 32);
-  for i := 91 to 191 do
-    LowerCaseTable[i] := chr(i);
-  Move (CPISO88591LCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
-end;
-
-
-Procedure InitInternational;
-begin
-  InitAnsi;
-end;
-
-function SysErrorMessage(ErrorCode: Integer): String;
-
-begin
-  Str(Errorcode,Result);
-  Result:='Error '+Result;
-end;
-
-{****************************************************************************
-                              OS utility functions
-****************************************************************************}
-
-Function GetEnvironmentVariable(Const EnvVar : String) : String;
-
-begin
-  Result:=StrPas(beos.Getenv(PChar(EnvVar)));
-end;
-
-Function GetEnvironmentVariableCount : Integer;
-
-begin
-  Result:=FPCCountEnvVar(EnvP);
-end;
-  
-Function GetEnvironmentString(Index : Integer) : String;
-  
-begin
-  Result:=FPCGetEnvStrFromP(Envp,Index);
-end;
-    
-function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
-
-var
-  e : EOSError;
-  CommandLine: AnsiString;
-
-begin
-  dos.exec(path,comline);
-
-  if (Dos.DosError <> 0) then
-    begin
-      if ComLine <> '' then
-       CommandLine := Path + ' ' + ComLine
-      else
-       CommandLine := Path;
-      e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,Dos.DosError]);
-      e.ErrorCode:=Dos.DosError;
-      raise e;
-    end;
-  Result := DosExitCode;
-end;
-
-
-function ExecuteProcess (const Path: AnsiString;
-                                  const ComLine: array of AnsiString): integer;
-
-var 
-  CommandLine: AnsiString;
-  I: integer;
-
-begin
-  Commandline := '';
-  for I := 0 to High (ComLine) do
-   if Pos (' ', ComLine [I]) <> 0 then
-    CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
-   else
-    CommandLine := CommandLine + ' ' + Comline [I];
-  ExecuteProcess := ExecuteProcess (Path, CommandLine);
-end;
-
-
-
-{****************************************************************************
-                              Initialization code
-****************************************************************************}
-
-Initialization
-  InitExceptions;       { Initialize exceptions. OS independent }
-  InitInternational;    { Initialize internationalization settings }
-Finalization
-  OutOfMemory.Free;
-  InValidPointer.Free;
-end.
-{
-  $Log$
-  Revision 1.6  2004-12-11 11:32:44  michael
-  + Added GetEnvironmentVariableCount and GetEnvironmentString calls
-
-  Revision 1.5  2004/02/15 21:36:10  hajny
-    * overloaded ExecuteProcess added, EnvStr param changed to longint
-
-  Revision 1.4  2004/01/20 23:12:49  hajny
-    * ExecuteProcess fixes, ProcessID and ThreadID added
-
-  Revision 1.3  2003/03/29 15:16:26  hajny
-    * dummy DirectoryExists added
-
-  Revision 1.2  2002/09/07 16:01:27  peter
-    * old logs removed and tabs fixed
-
-}