Browse Source

* some fixes, intended to get units fgl and classes to compile on 16-bit cpus

git-svn-id: trunk@24649 -
nickysn 12 năm trước cách đây
mục cha
commit
730f7c82b7

+ 1 - 0
.gitattributes

@@ -8259,6 +8259,7 @@ rtl/msdos/sysos.inc svneol=native#text/plain
 rtl/msdos/sysosh.inc svneol=native#text/plain
 rtl/msdos/system.pp svneol=native#text/plain
 rtl/msdos/sysutils.pp svneol=native#text/plain
+rtl/msdos/tthread.inc svneol=native#text/plain
 rtl/msdos/varutils.pp svneol=native#text/plain
 rtl/nativent/Makefile svneol=native#text/plain
 rtl/nativent/Makefile.fpc svneol=native#text/plain

+ 86 - 0
rtl/msdos/tthread.inc

@@ -0,0 +1,86 @@
+{
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 1999-2000 by 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.
+
+ **********************************************************************}
+{****************************************************************************}
+{*                             TThread                                      *}
+{****************************************************************************}
+
+
+procedure TThread.CallOnTerminate;
+
+begin
+end;
+
+
+function TThread.GetPriority: TThreadPriority;
+
+begin
+  GetPriority:=tpNormal;
+end;
+
+
+procedure TThread.SetPriority(Value: TThreadPriority);
+
+begin
+end;
+
+
+procedure TThread.SetSuspended(Value: Boolean);
+
+begin
+end;
+
+
+procedure TThread.DoTerminate;
+
+begin
+end;
+
+
+procedure TThread.SysCreate(CreateSuspended: Boolean; const StackSize: SizeUInt);
+
+begin
+ {IsMultiThread := TRUE; }
+end;
+
+
+procedure TThread.SysDestroy;
+
+begin
+end;
+
+
+procedure TThread.Resume;
+
+begin
+end;
+
+
+procedure TThread.Suspend;
+
+begin
+end;
+
+
+procedure TThread.Terminate;
+
+begin
+end;
+
+
+function TThread.WaitFor: Integer;
+
+begin
+  WaitFor:=0;
+end;
+
+

+ 9 - 1
rtl/objpas/classes/classesh.inc

@@ -46,7 +46,11 @@ const
 
 { Maximum TList size }
 
+{$ifdef cpu16}
+  MaxListSize = {Maxint div 16}1024;
+{$else cpu16}
   MaxListSize = Maxint div 16;
+{$endif cpu16}
 
 { values for TShortCut }
 
@@ -377,7 +381,11 @@ const
    BITSHIFT = 5;
    MASK = 31; {for longs that are 32-bit in size}
    // to further increase, signed integer limits have to be researched.
+{$ifdef cpu16}
+   MaxBitFlags = $7FE0;
+{$else cpu16}
    MaxBitFlags = $7FFFFFE0;
+{$endif cpu16}
    MaxBitRec = MaxBitFlags Div (SizeOf(cardinal)*8);
 type
    TBitArray = array[0..MaxBitRec - 1] of cardinal;
@@ -960,7 +968,7 @@ type
     procedure Clear;
     procedure LoadFromStream(Stream: TStream);
     procedure LoadFromFile(const FileName: string);
-    procedure SetSize({$ifdef CPU64}const{$endif CPU64} NewSize: PtrInt); override;
+    procedure SetSize({$ifdef CPU64}const NewSize: Int64{$else}NewSize: LongInt{$endif}); override;
     function Write(const Buffer; Count: LongInt): LongInt; override;
   end;
 

+ 1 - 1
rtl/objpas/classes/reader.inc

@@ -523,7 +523,7 @@ type
 {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
   record
     Count: Word;
-    Entries: array[Word] of TPersistentClass;
+    Entries: array[{$ifdef cpu16}0..16384 div sizeof(TPersistentClass){$else}Word{$endif}] of TPersistentClass;
   end;
 
   PFieldTable = ^TFieldTable;

+ 1 - 1
rtl/objpas/classes/streams.inc

@@ -718,7 +718,7 @@ begin
 end;
 
 
-procedure TMemoryStream.SetSize({$ifdef CPU64}const{$endif CPU64} NewSize: PtrInt);
+procedure TMemoryStream.SetSize({$ifdef CPU64}const NewSize: Int64{$else}NewSize: LongInt{$endif});
 
 begin
   SetCapacity (NewSize);

+ 4 - 0
rtl/objpas/fgl.pp

@@ -89,7 +89,11 @@ type
   end;
 
 const
+{$ifdef cpu16}
+  MaxGListSize = {MaxInt div} 1024;
+{$else cpu16}
   MaxGListSize = MaxInt div 1024;
+{$endif cpu16}
 
 type
   generic TFPGListEnumerator<T> = class(TObject)