From 730f7c82b7bd418f61b359ec67c2c8c38bdda2e4 Mon Sep 17 00:00:00 2001 From: nickysn Date: Thu, 30 May 2013 18:58:25 +0000 Subject: [PATCH] * some fixes, intended to get units fgl and classes to compile on 16-bit cpus git-svn-id: trunk@24649 - --- .gitattributes | 1 + rtl/msdos/tthread.inc | 86 +++++++++++++++++++++++++++++++++ rtl/objpas/classes/classesh.inc | 10 +++- rtl/objpas/classes/reader.inc | 2 +- rtl/objpas/classes/streams.inc | 2 +- rtl/objpas/fgl.pp | 4 ++ 6 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 rtl/msdos/tthread.inc diff --git a/.gitattributes b/.gitattributes index 4241c9029f..54e783ed66 100644 --- a/.gitattributes +++ b/.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 diff --git a/rtl/msdos/tthread.inc b/rtl/msdos/tthread.inc new file mode 100644 index 0000000000..24e7e37f19 --- /dev/null +++ b/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; + + diff --git a/rtl/objpas/classes/classesh.inc b/rtl/objpas/classes/classesh.inc index 735d05d2d2..9f7ea8d201 100644 --- a/rtl/objpas/classes/classesh.inc +++ b/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; diff --git a/rtl/objpas/classes/reader.inc b/rtl/objpas/classes/reader.inc index f6ebd1e0a3..77a457e259 100644 --- a/rtl/objpas/classes/reader.inc +++ b/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; diff --git a/rtl/objpas/classes/streams.inc b/rtl/objpas/classes/streams.inc index 5030b34d99..62b2a86cf1 100644 --- a/rtl/objpas/classes/streams.inc +++ b/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); diff --git a/rtl/objpas/fgl.pp b/rtl/objpas/fgl.pp index 0335cd4c22..59f0482027 100644 --- a/rtl/objpas/fgl.pp +++ b/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 = class(TObject)