Browse Source

* started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)

florian 22 years ago
parent
commit
eab5d1f7c5

+ 5 - 2
rtl/inc/astrings.inc

@@ -89,7 +89,7 @@ Procedure DisposeAnsiString(Var S : Pointer);
 begin
   If S=Nil then
     exit;
-  Dec (Longint(S),FirstOff);
+  Dec (S,FirstOff);
   FreeMem (S);
   S:=Nil;
 end;
@@ -833,7 +833,10 @@ end;
 
 {
   $Log$
-  Revision 1.36  2003-02-26 19:16:55  jonas
+  Revision 1.37  2003-05-01 08:05:23  florian
+    * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+  Revision 1.36  2003/02/26 19:16:55  jonas
     * fixed setstring (+- like suggested by Dimitry Sibiryakov)
 
   Revision 1.35  2002/12/09 08:33:31  michael

+ 5 - 2
rtl/inc/except.inc

@@ -38,7 +38,7 @@ Type
   TExceptObjectClass = Class of TObject;
 
 Const
-  CatchAllExceptions = -1;
+  CatchAllExceptions = SizeInt(-1);
 {$ifdef SUPPORT_THREADVAR}
 ThreadVar
 {$else SUPPORT_THREADVAR}
@@ -281,7 +281,10 @@ begin
 end;
 {
   $Log$
-  Revision 1.9  2002-10-14 19:39:17  peter
+  Revision 1.10  2003-05-01 08:05:23  florian
+    * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+  Revision 1.9  2002/10/14 19:39:17  peter
     * threads unit added for thread support
 
   Revision 1.8  2002/09/07 15:07:45  peter

+ 6 - 3
rtl/inc/heap.inc

@@ -1130,10 +1130,10 @@ end;
                                 Grow Heap
 *****************************************************************************}
 
-function growheap(size :longint) : integer;
+function growheap(size : SizeInt) : integer;
 var
   sizeleft,s1,
-  NewPos    : longint;
+  NewPos    : SizeInt;
   pcurr     : pfreerecord;
 begin
 {$ifdef DUMPGROW}
@@ -1265,7 +1265,10 @@ end;
 
 {
   $Log$
-  Revision 1.19  2002-11-01 17:38:04  peter
+  Revision 1.20  2003-05-01 08:05:23  florian
+    * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+  Revision 1.19  2002/11/01 17:38:04  peter
     * fix setmemorymutexmanager to call mutexdone on the already
       installed manager instead of the passed manager
 

+ 11 - 8
rtl/inc/objpas.inc

@@ -414,7 +414,7 @@
 
            pmsgtable = ^tmsgtable;
 
-           pdword = ^dword;
+           PSizeUInt = ^SizeUInt;
 
         var
            index : dword;
@@ -433,8 +433,8 @@
                 p:=pointer(vmt)+vmtDynamicTable;
                 If Assigned(p) and (Pdword(p)^<>0) then
                   begin
-                  msgtable:=pmsgtable(pdword(P)^+4);
-                  count:=pdword(pdword(P)^)^;
+                     msgtable:=pmsgtable(PSizeUInt(P)^+4);
+                     count:=pdword(PSizeUInt(P)^)^;
                   end
                 else
                   Count:=0;
@@ -458,7 +458,7 @@
       procedure TObject.DispatchStr(var message);
 
         type
-           pdword = ^dword;
+           PSizeUInt = ^SizeUInt;
 
         var
            name : shortstring;
@@ -476,8 +476,8 @@
                 p:=(pointer(vmt)+vmtMsgStrPtr);
                 If (P<>Nil) and (PDWord(P)^<>0) then
                   begin
-                  count:=pdword(pdword(p)^)^;
-                  msgstrtable:=pmsgstrtable(pdword(P)^+4);
+                  count:=pdword(PSizeUInt(p)^)^;
+                  msgstrtable:=pmsgstrtable(PSizeUInt(P)^+4);
                   end
                 else
                   Count:=0;
@@ -691,7 +691,10 @@
 
 {
   $Log$
-  Revision 1.31  2003-03-17 20:55:58  peter
+  Revision 1.32  2003-05-01 08:05:23  florian
+    * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+  Revision 1.31  2003/03/17 20:55:58  peter
     * ClassType changed to class method
 
   Revision 1.30  2002/10/19 15:53:20  peter
@@ -712,4 +715,4 @@
   Revision 1.25  2002/08/31 13:11:11  florian
     * several fixes for Linux/PPC compilation
 
-}
+}

+ 18 - 10
rtl/inc/systemh.inc

@@ -70,7 +70,8 @@ Type
   Integer  = SmallInt;
 
 {$ifdef CPUI386}
-  StrLenInt = LongInt;
+  { for bootstrapping with 1.0.x }
+  {$define CPU32}
 
   {$define DEFAULT_EXTENDED}
 
@@ -85,8 +86,6 @@ Type
 {$endif CPUI386}
 
 {$ifdef CPUX86_64}
-  StrLenInt = Int64;
-
   {$define DEFAULT_EXTENDED}
 
   {$define SUPPORT_SINGLE}
@@ -100,8 +99,6 @@ Type
 {$endif CPUX86_64}
 
 {$ifdef CPUM68K}
-  StrLenInt = Longint;
-
   ValSInt = Longint;
   ValUInt = Cardinal;
   ValReal = Real;
@@ -121,8 +118,6 @@ Type
 {$endif CPUM68K}
 
 {$ifdef CPUPOWERPC}
-  StrLenInt = LongInt;
-
   {$define DEFAULT_DOUBLE}
 
   {$define SUPPORT_SINGLE}
@@ -138,8 +133,6 @@ Type
 {$endif CPUPOWERPC}
 
 {$ifdef CPUSPARC}
-  StrLenInt = LongInt;
-
   {$define DEFAULT_DOUBLE}
 
   {$define SUPPORT_SINGLE}
@@ -153,6 +146,18 @@ Type
   Comp = Int64;
 {$endif CPUSPARC}
 
+{$ifdef CPU64}
+  StrLenInt = Int64;
+  SizeInt = Int64;
+  SizeUInt = QWord;
+{$endif CPU64}
+
+{$ifdef CPU32}
+  StrLenInt = Longint;
+  SizeInt = Longint;
+  SizeUInt = DWord;
+{$endif CPU32}
+
 { Zero - terminated strings }
   PChar               = ^Char;
   PPChar              = ^PChar;
@@ -666,7 +671,10 @@ const
 
 {
   $Log$
-  Revision 1.68  2003-04-30 16:36:39  florian
+  Revision 1.69  2003-05-01 08:05:23  florian
+    * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+  Revision 1.68  2003/04/30 16:36:39  florian
     + support for generic pchar routines added
     + some basic rtl stuff for x86-64 added
 

+ 5 - 2
rtl/inc/wstrings.inc

@@ -157,7 +157,7 @@ Procedure DisposeWideString(Var S : Pointer);
 begin
   If S=Nil then
     exit;
-  Dec (Longint(S),WideFirstOff);
+  Dec (S,WideFirstOff);
   FreeMem (S);
   S:=Nil;
 end;
@@ -990,7 +990,10 @@ end;
 
 {
   $Log$
-  Revision 1.28  2002-12-29 16:59:17  peter
+  Revision 1.29  2003-05-01 08:05:23  florian
+    * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+  Revision 1.28  2002/12/29 16:59:17  peter
     * implemented some more conversions
 
   Revision 1.27  2002/12/15 22:33:12  peter

+ 6 - 3
rtl/linux/osmain.inc

@@ -208,7 +208,7 @@ Begin
 End;
 
 
-Function Do_Write(Handle,Addr,Len:Longint):longint;
+Function Do_Write(Handle,Addr,Len:SizeInt):longint;
 Begin
   repeat
     Do_Write:=Fpwrite(Handle,pchar(addr),len);
@@ -223,7 +223,7 @@ Begin
 End;
 
 
-Function Do_Read(Handle,Addr,Len:Longint):Longint;
+Function Do_Read(Handle,Addr,Len:SizeInt):Longint;
 Begin
   repeat
     Do_Read:=Fpread(Handle,pchar(addr),len);
@@ -616,7 +616,10 @@ End.
 *)
 {
  $Log$
- Revision 1.4  2002-12-24 19:45:40  peter
+ Revision 1.5  2003-05-01 08:05:23  florian
+   * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+ Revision 1.4  2002/12/24 19:45:40  peter
    * Fix do_erase which was wrong with inoutres setting
 
  Revision 1.3  2002/12/23 22:23:43  peter

+ 6 - 3
rtl/linux/x86_64/syscallh.inc

@@ -24,7 +24,7 @@
 
 Type
 
-  TSysResult = longint; // all platforms, cint=32-bit.
+  TSysResult = int64;   // all platforms, cint=32-bit.
                         // On platforms with off_t =64-bit, people should
                         // use int64, and typecast all calls that don't
                         // return off_t to cint.
@@ -32,7 +32,7 @@ Type
 // I don't think this is going to work on several platforms
 // 64-bit machines don't have only 64-bit params.
 
-  TSysParam  = Longint;
+  TSysParam  = int64;
 
 function Do_SysCall(sysnr:TSysParam):TSysResult;  external name 'FPC_SYSCALL0';
 function Do_SysCall(sysnr,param1:TSysParam):TSysResult; external name 'FPC_SYSCALL1';
@@ -46,7 +46,10 @@ function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):T
 
 {
   $Log$
-  Revision 1.1  2003-04-30 22:11:06  florian
+  Revision 1.2  2003-05-01 08:05:23  florian
+    * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+  Revision 1.1  2003/04/30 22:11:06  florian
     + for a lot of x86-64 dependend files mostly dummies added
 
   Revision 1.3  2002/12/18 20:41:33  peter

+ 7 - 4
rtl/x86_64/x86_64.inc

@@ -132,12 +132,12 @@ Procedure FillChar(var x;count:longint;value:byte);assembler;
     movq %rdi,%r10
     movq %rdx,%r11
 
-    /* expand byte value  */
+    { expand byte value  }
     movzbl %sil,%ecx
     movabs $0x0101010101010101,%rax
-    mul    %rcx		/* with rax, clobbers rdx */
+    mul    %rcx		{ with rax, clobbers rdx }
 
-    /* align dst */
+    { align dst }
     movl  %edi,%r9d
     andl  $7,%r9d
     jnz  bad_alignment
@@ -239,7 +239,10 @@ procedure inclocked(var l : longint);assembler;
 
 {
   $Log$
-  Revision 1.2  2003-04-30 22:11:06  florian
+  Revision 1.3  2003-05-01 08:05:23  florian
+    * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
+
+  Revision 1.2  2003/04/30 22:11:06  florian
     + for a lot of x86-64 dependend files mostly dummies added
 
   Revision 1.1  2003/01/06 19:40:18  florian