Browse Source

* uniform filerec/textrec (with recsize:longint and name:0..255)

peter 27 years ago
parent
commit
8c0de1dd76
5 changed files with 146 additions and 99 deletions
  1. 6 3
      rtl/inc/file.inc
  2. 76 75
      rtl/inc/filerec.inc
  3. 6 3
      rtl/inc/systemh.inc
  4. 50 13
      rtl/inc/textrec.inc
  5. 8 5
      rtl/linux/syslinux.pp

+ 6 - 3
rtl/inc/file.inc

@@ -49,7 +49,7 @@ begin
 end;
 end;
 
 
 
 
-Procedure Rewrite(var f:File;l:Word);[IOCheck];
+Procedure Rewrite(var f:File;l:Longint);[IOCheck];
 {
 {
   Create file f with recordsize of l
   Create file f with recordsize of l
 }
 }
@@ -65,7 +65,7 @@ Begin
 End;
 End;
 
 
 
 
-Procedure Reset(var f:File;l:Word);[IOCheck];
+Procedure Reset(var f:File;l:Longint);[IOCheck];
 {
 {
   Open file f with recordsize of l and filemode
   Open file f with recordsize of l and filemode
 }
 }
@@ -319,7 +319,10 @@ End;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.6  1998-07-19 19:55:32  michael
+  Revision 1.7  1998-09-04 18:16:12  peter
+    * uniform filerec/textrec (with recsize:longint and name:0..255)
+
+  Revision 1.6  1998/07/19 19:55:32  michael
   + fixed rename. Changed p to p^
   + fixed rename. Changed p to p^
 
 
   Revision 1.5  1998/07/02 12:15:39  carl
   Revision 1.5  1998/07/02 12:15:39  carl

+ 76 - 75
rtl/inc/filerec.inc

@@ -3,6 +3,9 @@
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
     Copyright (c) 1993,97 by the Free Pascal development team
     Copyright (c) 1993,97 by the Free Pascal development team
 
 
+    FileRec record definition
+
+
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
 
 
@@ -12,110 +15,108 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
+{
+  This file contains the definition of the filerec record.
+  It is put separately, so it is available outside the system
+  unit without sacrificing TP compatibility.
+}
+
+{$ifndef VER0_99_5}
+  {$ifndef VER0_99_6}
+    {$define UNIFORM_FILEREC}
+  {$endif}
+{$endif}
+
+
+{$ifdef UNIFORM_FILEREC}
+
+
 const
 const
-{$ifdef linux}
   filerecnamelength = 255;
   filerecnamelength = 255;
-{$endif}
-{$ifdef Win32}
+type
+  FileRec = Packed Record
+    Handle,
+    Mode,
+    RecSize   : longint;
+    _private  : array[1..32] of byte;
+    UserData  : array[1..16] of byte;
+    name      : array[0..filerecnamelength] of char;
+  End;
+
+
+{$else UNIFORM_FILEREC}
+
+
+{**********************************
+   Old style for 0.99.5/0.99.6
+**********************************}
+
+const
+  {$ifdef linux}
     filerecnamelength = 255;
     filerecnamelength = 255;
-{$endif}
-{$ifdef MACOS}
+  {$endif}
+  {$ifdef Win32}
     filerecnamelength = 255;
     filerecnamelength = 255;
-{$endif}
-{$ifdef AMIGA}
+  {$endif}
+  {$ifdef MACOS}
     filerecnamelength = 255;
     filerecnamelength = 255;
-{$endif}
-{$ifdef OS2}
+  {$endif}
+  {$ifdef AMIGA}
+    filerecnamelength = 255;
+  {$endif}
+  {$ifdef OS2}
     filerecnamelength = 79;
     filerecnamelength = 79;
-{$endif}
-{$ifdef GO32V2}
+  {$endif}
+  {$ifdef GO32V2}
     filerecnamelength = 79;
     filerecnamelength = 79;
-{$endif GO32V2}
-{$ifdef GO32V1}
+  {$endif GO32V2}
+  {$ifdef GO32V1}
     filerecnamelength = 79;
     filerecnamelength = 79;
-{$endif Go32v1}
-{$ifdef ATARI}
+  {$endif Go32v1}
+  {$ifdef ATARI}
     filerecnamelength = 79;
     filerecnamelength = 79;
-{$endif}
+  {$endif}
 
 
 Type
 Type
 {$PACKRECORDS 2}
 {$PACKRECORDS 2}
   FileRec = Record
   FileRec = Record
-{$ifdef win32}
+  {$ifdef win32}
      handle    : longint;
      handle    : longint;
-{$endif win32}
-{$ifdef amiga}
+  {$endif win32}
+  {$ifdef amiga}
      handle    : longint;
      handle    : longint;
-{$endif amiga}
-{$ifdef macos}
+  {$endif amiga}
+  {$ifdef macos}
      handle    : longint;
      handle    : longint;
-{$endif macos}
-{$ifdef linux}
+  {$endif macos}
+  {$ifdef linux}
      handle    : word;
      handle    : word;
-{$endif}
-{$ifdef go32v1}
+  {$endif}
+  {$ifdef go32v1}
      handle    : word;
      handle    : word;
-{$endif go32v1}
-{$ifdef go32v2}
+  {$endif go32v1}
+  {$ifdef go32v2}
      handle    : word;
      handle    : word;
-{$endif go32v2}
-{$ifdef atari}
+  {$endif go32v2}
+  {$ifdef atari}
      handle    : word;
      handle    : word;
-{$endif atari}
-{$ifdef os2}
+  {$endif atari}
+  {$ifdef os2}
      handle    : word;
      handle    : word;
-{$endif os2}
+  {$endif os2}
     Mode      : word;
     Mode      : word;
     RecSize   : word;
     RecSize   : word;
     _private  : array[1..26] of byte;
     _private  : array[1..26] of byte;
     UserData  : array[1..16] of byte;
     UserData  : array[1..16] of byte;
     name      : array[0..filerecnamelength] of char;
     name      : array[0..filerecnamelength] of char;
   End;
   End;
+{$endif UNIFORM_FILEREC}
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-05-21 11:55:59  carl
-   * works with all OS
+  Revision 1.4  1998-09-04 18:16:13  peter
+    * uniform filerec/textrec (with recsize:longint and name:0..255)
 
 
-  Revision 1.1.1.1  1998/03/25 11:18:43  root
-  * Restored version
-
-  Revision 1.7  1998/02/05 12:08:54  pierre
-    * added packrecords to about dword alignment
-      for structures used in dos calls
-
-  Revision 1.6  1998/01/26 12:00:21  michael
-  + Added log at the end
-
-
-  
-  Working file: rtl/inc/filerec.inc
-  description:
-  ----------------------------
-  revision 1.5
-  date: 1998/01/06 00:29:32;  author: michael;  state: Exp;  lines: +20 -19
-  Implemented a system independent sequence of reset/rewrite/append fileopenfunc etc system \n (from Peter Vreman)
-  ----------------------------
-  revision 1.4
-  date: 1997/12/01 12:08:03;  author: michael;  state: Exp;  lines: +13 -0
-  + added copyright reference header.
-  ----------------------------
-  revision 1.3
-  date: 1997/11/28 18:56:18;  author: pierre;  state: Exp;  lines: +2 -1
-    bug fix     in ifdef win32
-  ----------------------------
-  revision 1.2
-  date: 1997/11/27 22:49:04;  author: florian;  state: Exp;  lines: +7 -0
-  - CPU.PP added
-  - some bugs in DOS fixed (espsecially for go32v1)
-  - the win32 system unit is now compilable
-  ----------------------------
-  revision 1.1
-  date: 1997/11/27 08:33:46;  author: michael;  state: Exp;
-  Initial revision
-  ----------------------------
-  revision 1.1.1.1
-  date: 1997/11/27 08:33:46;  author: michael;  state: Exp;  lines: +0 -0
-  FPC RTL CVS start
-  =============================================================================
+  Revision 1.3  1998/05/21 11:55:59  carl
+   * works with all OS
 }
 }

+ 6 - 3
rtl/inc/systemh.inc

@@ -339,9 +339,9 @@ Procedure Str (Const SI : ShortInt; Len : longint; Var S : AnsiString);
 Procedure Assign(Var f:File;const Name:string);
 Procedure Assign(Var f:File;const Name:string);
 Procedure Assign(Var f:File;p:pchar);
 Procedure Assign(Var f:File;p:pchar);
 Procedure Assign(Var f:File;c:char);
 Procedure Assign(Var f:File;c:char);
-Procedure Rewrite(Var f:File;l:Word);
+Procedure Rewrite(Var f:File;l:Longint);
 Procedure Rewrite(Var f:File);
 Procedure Rewrite(Var f:File);
-Procedure Reset(Var f:File;l:Word);
+Procedure Reset(Var f:File;l:Longint);
 Procedure Reset(Var f:File);
 Procedure Reset(Var f:File);
 Procedure Close(Var f:File);
 Procedure Close(Var f:File);
 Procedure BlockWrite(Var f:File;Var Buf;Count:Longint;Var Result:Longint);
 Procedure BlockWrite(Var f:File;Var Buf;Count:Longint;Var Result:Longint);
@@ -440,7 +440,10 @@ Procedure halt;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.25  1998-09-01 17:36:22  peter
+  Revision 1.26  1998-09-04 18:16:14  peter
+    * uniform filerec/textrec (with recsize:longint and name:0..255)
+
+  Revision 1.25  1998/09/01 17:36:22  peter
     + internconst
     + internconst
 
 
   Revision 1.24  1998/08/11 21:39:08  peter
   Revision 1.24  1998/08/11 21:39:08  peter

+ 50 - 13
rtl/inc/textrec.inc

@@ -1,7 +1,10 @@
 {
 {
     $Id$
     $Id$
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
-    Copyright (c) 1993,97 by the Free Pascal development team
+    Copyright (c) 1993-98 by the Free Pascal development team
+
+    Textrec record definition
+
 
 
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
@@ -18,8 +21,46 @@
   unit without sacrificing TP compatibility.
   unit without sacrificing TP compatibility.
 }
 }
 
 
-Const
+{$ifndef VER0_99_5}
+  {$ifndef VER0_99_6}
+    {$define UNIFORM_TEXTREC}
+  {$endif}
+{$endif}
+
+
+{$ifdef UNIFORM_TEXTREC}
+
+
+const
+  TextRecNameLength = 255;
+type
+  TextBuf = array[0..255] of char;
+  TextRec = Packed Record
+    Handle,
+    Mode,
+    bufsize,
+    _private,
+    bufpos,
+    bufend    : longint;
+    bufptr    : ^textbuf;
+    openfunc,
+    inoutfunc,
+    flushfunc,
+    closefunc : pointer;
+    UserData  : array[1..16] of byte;
+    name      : array[0..textrecnamelength] of char;
+    buffer    : textbuf;
+  End;
+
 
 
+{$else UNIFORM_TEXTREC}
+
+
+{**********************************
+   Old style for 0.99.5/0.99.6
+**********************************}
+
+Const
 {$ifdef linux}
 {$ifdef linux}
   textrecnamelength = 255;
   textrecnamelength = 255;
 {$endif}
 {$endif}
@@ -74,8 +115,6 @@ type
 {$ifdef os2}
 {$ifdef os2}
      handle    : word;
      handle    : word;
 {$endif os2}
 {$endif os2}
-
-
      mode      : word;
      mode      : word;
      bufsize,
      bufsize,
      _private,
      _private,
@@ -86,20 +125,18 @@ type
      inoutfunc,
      inoutfunc,
      flushfunc,
      flushfunc,
      closefunc : pointer;
      closefunc : pointer;
-     userdata  : array[1..16] of byte; 
+     userdata  : array[1..16] of byte;
      name      : array[0..textrecnamelength] of char;
      name      : array[0..textrecnamelength] of char;
      buffer    : textbuf;
      buffer    : textbuf;
   end;
   end;
 
 
+{$endif UNIFORM_TEXTREC}
+
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-05-21 15:37:19  carl
-   + working version now ok
-
-  Revision 1.2  1998/05/12 10:42:45  peter
-    * moved getopts to inc/, all supported OS's need argc,argv exported
-    + strpas, strlen are now exported in the systemunit
-    * removed logs
-    * removed $ifdef ver_above
+  Revision 1.4  1998-09-04 18:16:15  peter
+    * uniform filerec/textrec (with recsize:longint and name:0..255)
 
 
+  Revision 1.3  1998/05/21 15:37:19  carl
+   + working version now ok
 }
 }

+ 8 - 5
rtl/linux/syslinux.pp

@@ -30,15 +30,16 @@ Unit SysLinux;
 Interface
 Interface
 
 
 {$ifdef m68k}
 {$ifdef m68k}
-    { used for single computations }
-    const BIAS4 = $7f-1;
+{ used for single computations }
+const
+  BIAS4 = $7f-1;
 {$endif}
 {$endif}
 
 
 {$I systemh.inc}
 {$I systemh.inc}
 {$I heaph.inc}
 {$I heaph.inc}
 
 
 const
 const
-  UnusedHandle    = $ffff;
+  UnusedHandle    = -1;
   StdInputHandle  = 0;
   StdInputHandle  = 0;
   StdOutputHandle = 1;
   StdOutputHandle = 1;
   StdErrorHandle  = 2;
   StdErrorHandle  = 2;
@@ -120,7 +121,6 @@ Var
   pp     : ppchar;
   pp     : ppchar;
 {$else}
 {$else}
   b      : Array[0..255] of Char;
   b      : Array[0..255] of Char;
-
 {$endif}
 {$endif}
 Begin
 Begin
 {$ifdef crtlib}
 {$ifdef crtlib}
@@ -689,7 +689,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.13  1998-08-14 11:59:41  carl
+  Revision 1.14  1998-09-04 18:16:16  peter
+    * uniform filerec/textrec (with recsize:longint and name:0..255)
+
+  Revision 1.13  1998/08/14 11:59:41  carl
     + m68k fixes
     + m68k fixes
 
 
   Revision 1.12  1998/08/12 14:01:37  michael
   Revision 1.12  1998/08/12 14:01:37  michael