View Issue Details

IDProjectCategoryView StatusLast Update
0037812pas2jsrtlpublic2020-09-25 15:35
Reporterhenrique Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPas2JsOSWindows 
Fixed in Versiontrunk 
Summary0037812: Compatibility of classes.pas with Delphi
DescriptionI removed the definition to compile as FPC and added a new procedure, to register more than one classes at a time.

To make everything compatible with Delphi
TagsNo tags attached.
Fixed in Revision883
Attached Files

Activities

henrique

2020-09-24 18:44

reporter  

Classes.patch (3,031 bytes)   
diff -r packages/rtl/classes.pas (b86448d4) packages/rtl/classes.pas (Working Tree)
15,16d14
< {$mode objfpc}
< 
119,120c117,118
<     procedure ForEachCall(const proc2call: TListCallback; const arg: JSValue);
<     procedure ForEachCall(const proc2call: TListStaticCallback; const arg: JSValue);
---
>     procedure ForEachCall(const proc2call: TListCallback; const arg: JSValue); overload;
>     procedure ForEachCall(const proc2call: TListStaticCallback; const arg: JSValue); overload;
398,399c396,397
<     procedure InsertItem(Index: Integer; const S: string); virtual;
<     procedure InsertItem(Index: Integer; const S: string; O: TObject); virtual;
---
>     procedure InsertItem(Index: Integer; const S: string); virtual; overload;
>     procedure InsertItem(Index: Integer; const S: string; O: TObject); virtual; overload;
920c918
<     function ReadFloat: Extended; virtual; abstract;
---
>     function ReadFloat: Double; virtual; abstract;
957c955
<     function ReadFloat: Extended; override;
---
>     function ReadFloat: Double; override;
1194,1195c1192,1193
<     constructor Create(ADriver: TAbstractObjectWriter);
<     constructor Create(Stream: TStream);
---
>     constructor Create(ADriver: TAbstractObjectWriter); overload;
>     constructor Create(Stream: TStream); overload;
1332,1333c1330,1331
<      function ReadInt(ValueType: TValueType): NativeInt;
<      function ReadInt: NativeInt;
---
>      function ReadInt(ValueType: TValueType): NativeInt; overload;
>      function ReadInt: NativeInt; overload;
1343,1344c1341,1342
<      procedure ObjectBinaryToText(aInput, aOutput: TStream);
<      procedure ObjectBinaryToText(aInput, aOutput: TStream; aEncoding: TObjectTextEncoding);
---
>      procedure ObjectBinaryToText(aInput, aOutput: TStream); overload;
>      procedure ObjectBinaryToText(aInput, aOutput: TStream; aEncoding: TObjectTextEncoding); overload;
1405a1404
> Procedure RegisterClasses(AClasses : TArray<TPersistentClass>);
1419,1420c1418,1419
< function CollectionsEqual(C1, C2: TCollection): Boolean;
< function CollectionsEqual(C1, C2: TCollection; Owner1, Owner2: TComponent): Boolean;
---
> function CollectionsEqual(C1, C2: TCollection): Boolean; overload;
> function CollectionsEqual(C1, C2: TCollection; Owner1, Owner2: TComponent): Boolean; overload;
1423,1424c1422,1423
< procedure ObjectBinaryToText(aInput, aOutput: TStream);
< procedure ObjectBinaryToText(aInput, aOutput: TStream; aEncoding: TObjectTextEncoding);
---
> procedure ObjectBinaryToText(aInput, aOutput: TStream); overload;
> procedure ObjectBinaryToText(aInput, aOutput: TStream; aEncoding: TObjectTextEncoding); overload;
6436c6435
< function TBinaryObjectReader.ReadFloat: Extended;
---
> function TBinaryObjectReader.ReadFloat: Double;
9320a9320,9328
> Procedure RegisterClasses(AClasses : TArray<TPersistentClass>);
> var
>   AClass : TPersistentClass;
> 
> begin
>   for AClass in AClasses do
>     RegisterClass(AClass);
> end;
> 
Classes.patch (3,031 bytes)   

Michael Van Canneyt

2020-09-25 00:26

administrator   ~0125831

Please put back in the $Mode objfpc.
This is there for a reason. It has no influence for units using the classes unit.

henrique

2020-09-25 13:00

reporter   ~0125840

:D
I'm sorry, but the tiresome messed up, I just set up the change of the new procedure, which I need to look like Delphi!
Classes-2.patch (371 bytes)   
diff -r packages/rtl/classes.pas (b86448d4) packages/rtl/classes.pas (Working Tree)
1405a1406
> Procedure RegisterClasses(AClasses : TArray<TPersistentClass>);
9320a9322,9330
> Procedure RegisterClasses(AClasses : TArray<TPersistentClass>);
> var
>   AClass : TPersistentClass;
> 
> begin
>   for AClass in AClasses do
>     RegisterClass(AClass);
> end;
> 
Classes-2.patch (371 bytes)   

Michael Van Canneyt

2020-09-25 13:22

administrator   ~0125841

Thanks, checked & applied !

Sven Barth

2020-09-25 15:23

developer   ~0125855

Seems like you did not check correctly, cause mode ObjFPC requires the specialize keyword. :P Fixed in r887.

Michael Van Canneyt

2020-09-25 15:35

administrator   ~0125859

Last edited: 2020-09-25 15:35

View 2 revisions

@Sven,
I did check by compiling classes.pas but it since I didn't actually use the function, it seems the compiler didn't complain.
Later I changed the definition to array of TPersistent, but it seems I forgot to commit that part :/

Thanks for fixing it too :-)

Issue History

Date Modified Username Field Change
2020-09-24 18:44 henrique New Issue
2020-09-24 18:44 henrique File Added: Classes.patch
2020-09-25 00:24 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-09-25 00:24 Michael Van Canneyt Status new => assigned
2020-09-25 00:26 Michael Van Canneyt Note Added: 0125831
2020-09-25 13:00 henrique Note Added: 0125840
2020-09-25 13:00 henrique File Added: Classes-2.patch
2020-09-25 13:22 Michael Van Canneyt Status assigned => resolved
2020-09-25 13:22 Michael Van Canneyt Resolution open => fixed
2020-09-25 13:22 Michael Van Canneyt Fixed in Version => trunk
2020-09-25 13:22 Michael Van Canneyt Fixed in Revision => 883
2020-09-25 13:22 Michael Van Canneyt Note Added: 0125841
2020-09-25 15:23 Sven Barth Note Added: 0125855
2020-09-25 15:35 Michael Van Canneyt Note Added: 0125859
2020-09-25 15:35 Michael Van Canneyt Note Edited: 0125859 View Revisions